Add ~/.lib/bin

Made pager.sh and editor.sh accesible from anywhere in the shell. Also
made pager.sh smart in that it will use emacsclient when INSIDE_EMACS
environment variable is set.
This commit is contained in:
Ivan Malison 2015-08-15 22:49:59 -07:00
parent 64012779c1
commit 9eaf9b2832
6 changed files with 12 additions and 6 deletions

View File

@ -49,7 +49,7 @@
# Use custom `.gitignore` and `.gitattributes` # Use custom `.gitignore` and `.gitattributes`
excludesfile = ~/.gitignore excludesfile = ~/.gitignore
attributesfile = ~/.gitattributes attributesfile = ~/.gitattributes
# pager = less -FXr # set with environment variable so that pager can be different when inside emacs pager = pager.sh # set with environment variable so that pager can be different when inside emacs
[color] [color]
# Use colors in Git commands that are capable of colored output when # Use colors in Git commands that are capable of colored output when

7
dotfiles/lib/bin/pager.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env zsh
if environment_variable_exists INSIDE_EMACS; then
emacs_pager "$@"
else
less -FXr
fi
return 0

View File

@ -1,3 +0,0 @@
#!/usr/bin/env zsh
emacs_pager "$@"
return 0

View File

@ -58,6 +58,8 @@ function _setup_env {
idem_add_to_front_of_path "$HOME/.rbenv/bin" idem_add_to_front_of_path "$HOME/.rbenv/bin"
hash rbenv 2> /dev/null && eval "$(rbenv init -)" hash rbenv 2> /dev/null && eval "$(rbenv init -)"
hash brew 2>/dev/null && idem_add_to_front_of_path "$(brew --prefix coreutils)/libexec/gnubin" hash brew 2>/dev/null && idem_add_to_front_of_path "$(brew --prefix coreutils)/libexec/gnubin"
idem_add_to_front_of_path "$HOME/.lib/bin"
export ENVIRONMENT_SETUP_DONE="$(date)" export ENVIRONMENT_SETUP_DONE="$(date)"
} }

View File

@ -128,14 +128,14 @@ function emacs_pager {
} }
# Make emacs the default editor. # Make emacs the default editor.
export EDITOR="$HOME/.lib/editor.sh" export EDITOR="$HOME/.lib/bin/editor.sh"
export ALTERNATE_EDITOR="" export ALTERNATE_EDITOR=""
export VISUAL="$EDITOR" export VISUAL="$EDITOR"
export GIT_EDITOR="$EDITOR" export GIT_EDITOR="$EDITOR"
# This actually gets executed in dotfiles/lib/shellrc.sh to make sure that it takes precedence over other settings # This actually gets executed in dotfiles/lib/shellrc.sh to make sure that it takes precedence over other settings
function inside_emacs_hook { function inside_emacs_hook {
export PAGER="$HOME/.lib/pager.sh" export PAGER="$HOME/.lib/bin/pager.sh"
export GITPAGER="$PAGER" export GITPAGER="$PAGER"
export MANPAGER="$PAGER" export MANPAGER="$PAGER"
} }