Skip to content

Commit

Permalink
Don't override customized environments in subshells
Browse files Browse the repository at this point in the history
Only set up environment for the top-level shell, and allow it to be
inherited normally.

See: sorin-ionescu/prezto#500
  • Loading branch information
Pablo Olmos de Aguilera Corradini committed Apr 12, 2014
1 parent 3558651 commit 1907b62
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 80 deletions.
80 changes: 79 additions & 1 deletion zprofile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Executes commands at login pre-zshrc.
#
# Authors:
# Sorin Ionescu <[email protected]>
# Pablo Olmos de Aguilera C. <pablo at glatelier dot org>
#

Expand All @@ -17,9 +18,86 @@
# done < $HOME/.systemd-profile
# }

#
# Browser
#

BROWSER='firefox'

#
# Editors
#

EDITOR='vim'
VISUAL='gvim'
PAGER='less'
SUDO_EDITOR='vim' # to use sudoedit (or sudo -e)

export BROWSER EDITOR VISUAL PAGER SUDO_EDITOR

#
# Language
#

if [[ -z "$LANG" ]]; then
export LANG='en_US.UTF-8'
fi

#
# Paths
#

# Ensure path arrays do not contain duplicates.
typeset -gU cdpath fpath mailpath path

# Set the the list of directories that cd searches.
# cdpath=(
# $cdpath
# )

# Set the list of directories that Zsh searches for programs.
# I manage some binaries and scripts on my ~/bin directory, so I add it first
path=(
${HOME}/bin
${HOME}/.npm-packages/bin
${HOME}/.cabal/bin
# /usr/local/{bin,sbin} # is this necessary on Arch Linux?
$path
)

#
# Less
#

# Set the default Less options.
# Mouse-wheel scrolling has been disabled by -X (disable screen clearing).
# Remove -X and -F (exit if the content fits on one screen) to enable it.
export LESS='-g -i -M -R -S -w -z-4'

# Set the Less input preprocessor.
if (( $+commands[lesspipe.sh] )); then
export LESSOPEN='| /usr/bin/env lesspipe.sh %s 2>&-'
fi

#
# Temporary Files
#

if [[ ! -d "$TMPDIR" ]]; then
export TMPDIR="/tmp/$USER"
mkdir -p -m 700 "$TMPDIR"
fi

TMPPREFIX="${TMPDIR%/}/zsh"
if [[ ! -d "$TMPPREFIX" ]]; then
mkdir -p "$TMPPREFIX"
fi

# Load super secret stuff
[[ -s $HOME/.secrets ]] && source $HOME/.secrets

[[ $TTY == /dev/tty1 ]] \
&& (( $UID )) \
&& [[ -z $DISPLAY ]] \
&& startx
# && systemctl --user start wm.target

69 changes: 3 additions & 66 deletions zshenv
Original file line number Diff line number Diff line change
Expand Up @@ -3,76 +3,13 @@
#
# Authors:
# Sorin Ionescu <[email protected]>
# Pablo Olmos de Aguilera <pablo at glatelier dot org>

#
# Browser
#

export BROWSER='firefox'

#
# Editors
#

EDITOR='vim'
VISUAL='gvim'
PAGER='less'
SUDO_EDITOR='vim' # to use sudoedit (or sudo -e)

export EDITOR VISUAL PAGER SUDO_EDITOR

#
# Language
#

if [[ -z $LANG ]]; then
export LANG='en_US.UTF-8'
# Ensure that a non-login, non-interactive shell has a defined environment.
if [[ "$SHLVL" -eq 1 && ! -o LOGIN ]]; then
source "${ZDOTDIR:-$HOME}/.zprofile"
fi

#
# Paths
#

typeset -gU cdpath fpath mailpath path

# Set the the list of directories that cd searches.
# cdpath=(
# $cdpath
# )

#
# Less
#

# Set the default Less options.
# Mouse-wheel scrolling has been disabled by -X (disable screen clearing).
# Remove -X and -F (exit if the content fits on one screen) to enable it.
export LESS='-g -i -M -R -S -w -z-4'


# Set the Less input preprocessor.
if (( $+commands[lesspipe.sh] )); then
export LESSOPEN='| /usr/bin/env lesspipe.sh %s 2>&-'
fi

#
# Temporary Files
#

if [[ ! -d "$TMPDIR" ]]; then
export TMPDIR="/tmp/$USER"
mkdir -p -m 700 "$TMPDIR"
fi

TMPPREFIX="${TMPDIR%/}/zsh"
if [[ ! -d "$TMPPREFIX" ]]; then
mkdir -p "$TMPPREFIX"
fi

# Load super secret stuff
[[ -s $HOME/.secrets ]] && source $HOME/.secrets

# Fix steam closing
export STEAM_FRAME_FORCE_CLOSE=1

13 changes: 0 additions & 13 deletions zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,6 @@ ZSH=${ZDOTDIR:-$HOME}/.zsh.d
# Working dir for developing
PZT_PROJECT_DIR=${HOME}/dev

#
# Path
#

# Set the list of directories that Zsh searches for programs.
# I manage some binaries and scripts on my ~/bin directory, so I add it first
path=(
${HOME}/bin
${HOME}/.npm-packages/bin
${HOME}/.cabal/bin
$path
)

#
# Functions
#
Expand Down

0 comments on commit 1907b62

Please sign in to comment.