From bf20ba480ee907e5a61b4570c404279e64bc7b98 Mon Sep 17 00:00:00 2001 From: Geoff Harcourt Date: Sat, 31 Oct 2015 10:17:05 -0400 Subject: [PATCH] squash! Further changes to enable zsh configuration splitting * Add back missing EDITOR and VISUAL variables: these aliases were lost when reconciling changes from #426's changes to `zshrc`. * Move aliases setup to occur after loading other config, as some of our aliases depend on environment variables having been set, so alias loading must come last after we've sourced `zsh/configs`. * Move autocompletion for `g` function from the function definition to to `zsh/completions/_g` * Move `PATH` setup to `zsh/configs/post` to ensure it happens after other configuration that might alter the `PATH` --- zsh/completion/_g | 2 ++ zsh/configs/editor.zsh | 2 ++ zsh/configs/{ => post}/completion.zsh | 0 zsh/configs/post/path.zsh | 10 ++++++++++ zsh/functions/g | 3 --- zshrc | 6 +++--- 6 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 zsh/completion/_g create mode 100644 zsh/configs/editor.zsh rename zsh/configs/{ => post}/completion.zsh (100%) create mode 100644 zsh/configs/post/path.zsh diff --git a/zsh/completion/_g b/zsh/completion/_g new file mode 100644 index 0000000000..f600877829 --- /dev/null +++ b/zsh/completion/_g @@ -0,0 +1,2 @@ +#compdef g +compdef g=git diff --git a/zsh/configs/editor.zsh b/zsh/configs/editor.zsh new file mode 100644 index 0000000000..4d6ef2a3fd --- /dev/null +++ b/zsh/configs/editor.zsh @@ -0,0 +1,2 @@ +export VISUAL=vim +export EDITOR=$VISUAL diff --git a/zsh/configs/completion.zsh b/zsh/configs/post/completion.zsh similarity index 100% rename from zsh/configs/completion.zsh rename to zsh/configs/post/completion.zsh diff --git a/zsh/configs/post/path.zsh b/zsh/configs/post/path.zsh new file mode 100644 index 0000000000..48f41962c8 --- /dev/null +++ b/zsh/configs/post/path.zsh @@ -0,0 +1,10 @@ +# ensure dotfiles bin directory is loaded first +export PATH="$HOME/.bin:/usr/local/sbin:$PATH" + +# load rbenv if available +if command -v rbenv >/dev/null; then + eval "$(rbenv init - --no-rehash)" +fi + +# mkdir .git/safe in the root of repositories you trust +export PATH=".git/safe/../../bin:$PATH" diff --git a/zsh/functions/g b/zsh/functions/g index 7e2d5b0518..438db752e7 100644 --- a/zsh/functions/g +++ b/zsh/functions/g @@ -7,6 +7,3 @@ g() { git status fi } - -# Complete g like git -compdef g=git diff --git a/zshrc b/zshrc index 8ac9f91cbc..db56349448 100644 --- a/zshrc +++ b/zshrc @@ -3,9 +3,6 @@ for function in ~/.zsh/functions/*; do source $function done -# aliases -[[ -f ~/.aliases ]] && source ~/.aliases - # extra files in ~/.zsh/configs/pre , ~/.zsh/configs , and ~/.zsh/configs/post # these are loaded first, second, and third, respectively. _load_settings() { @@ -42,5 +39,8 @@ _load_settings() { } _load_settings "$HOME/.zsh/configs" +# aliases +[[ -f ~/.aliases ]] && source ~/.aliases + # Local config [[ -f ~/.zshrc.local ]] && source ~/.zshrc.local