[zsh] Update shell init: rc

This commit is contained in:
Eryn Wells 2021-12-31 11:54:55 -08:00
parent b09d523218
commit c30b46a88b
26 changed files with 479 additions and 462 deletions

120
rc
View file

@ -1,120 +0,0 @@
# .rc
# vim: ft=zsh
# Generic interactive shell setup
# Eryn Wells <eryn@erynwells.me>
print_heading -l 1 'Initializing interactive shell'
print_info -l 2 'Creating aliases'
alias j='jobs'
alias h='history'
alias df='df -h'
alias du='du -h'
alias e='emacs'
binary_exists ledger && alias l='ledger'
binary_exists gpg2 && alias gpg='gpg2'
binary_exists keybase && alias keybase="keybase --gpg \"`which gpg2`\""
alias chux='chmod u+x'
alias chuw='chmod u+w'
alias chur='chmod u+r'
alias cho="chown $USER"
alias today='date +%Y-%m-%d'
alias addkey="ssh-agent ~/.ssh/id_rsa"
alias pprint="python -c 'import sys,pprint; pprint.pprint(eval(sys.stdin.read()))'"
alias pprint-json="python -c 'import sys,json;print json.dumps(json.load(sys.stdin), indent=2)'"
#
# Git
#
function g
{
if [[ $# -gt 0 ]]; then
git $@
else
git status --short --branch
fi
return $?
}
function vi
{
if whence -cp nvim 1>/dev/null 2>&1; then
command nvim $@
elif whence -cp vim 1>/dev/null 2>&1; then
command vim $@
elif whence -cp vi 1>/dev/null 2>&1; then
command vi $@
fi
}
alias gp='g p origin $gitbranch'
alias gpf='g p -f origin $gitbranch'
#
# Setup
#
function configure_ls
{
local has_gnu_ls
local ls_options
if [[ ! -e "$1" ]]; then
return
fi
if $1 --version 2>&1 | grep GNU 1>/dev/null; then
has_gnu_ls=1
ls_options='--color=auto'
else
has_gnu_ls=0
ls_options='-G'
fi
print_info_sub -l 3 "Setting up ls: $1"
alias ls="$1 $ls_options"
alias la="$1 -A $ls_options"
alias ll="$1 -l $ls_options"
alias l.="$1 -d $ls_options .*"
local dircolors_bin=`whence -p dircolors || whence -p gdircolors`
if [[ $has_gnu_ls -eq 1 && -n "$dircolors_bin" ]]; then
if [[ -e "$HOME/.dircolors/$SYS.cfg" ]]; then
dircolors="$HOME/.dircolors/$SYS.cfg"
else
dircolors="$HOME/.dircolors/default.cfg"
fi
print_info_sub -l 3 "Setting up dircolors: `basename $dircolors`"
eval `$dircolors_bin $dircolors`
fi
}
# NetHack options
# use color in the terminal
binary_exists nethack && export NETHACKOPTIONS="color"
# Default ledger file
[[ -e "$HOME/Documents/Ledger/personal.ledger" ]] && \
LEDGER_FILE=$HOME/Documents/Ledger/personal.ledger
if [[ -e "$HOME/.rc.$SYS" ]]; then
print_info -l 2 "Sourcing $SYS interactive shell setup"
source "$HOME/.rc.$SYS"
fi
# Set up ls if it wasn't already done.
if ! alias ls 2>&1 1>/dev/null; then
configure_ls `which ls`
fi
if [[ -e "$HOME/.rc.local" ]]; then
print_info -l 2 'Sourcing local interactive shell setup'
source "$HOME/.rc.local"
fi

View file

@ -1,52 +0,0 @@
# .rc.darwin
# vim: ft=zsh
# Interactive shell setup for Darwin systems
# Eryn Wells <eryn@erynwells.me>
alias acls='command ls -le'
# These things might have been installed by Homebrew, and I like the GNU versions better.
binary_exists gdircolors && alias dircolors='gdircolors'
binary_exists gfind && alias find='gfind'
binary_exists gnuindent && alias indent='gnuindent'
if binary_exists gls; then
configure_ls `which gls`
fi
# ldd doesn't exist on OS X, but otool -L does the same thing.
alias ldd='otool -L'
SOUNDSDIR=/System/Library/Sounds
alias glass="afplay $SOUNDSDIR/Glass.aiff"
alias funk="afplay $SOUNDSDIR/Funk.aiff"
unset SOUNDSDIR
function darwin-icloud-drive-path
{
echo "$HOME/Library/Mobile Documents/com~apple~CloudDocs"
}
function darwin-init
{
# Dim dock icons of apps that have been hidden.
print_info "Auto-hiding Dock"
defaults write com.apple.Dock showhidden -boolean yes
killall Dock
# Put screenshots in iCloud Drive, in a directory according to hostname
icloud=`darwin-icloud-drive-path`
if [[ -d "$icloud" ]]; then
local name=`hostname -s | tr A-Z a-z`
local loc="$(darwin-icloud-drive-path)/Screenshots/$name"
print_info "Setting screenshot directory: $loc"
mkdir -p "$loc"
defaults write com.apple.screencapture location "$loc"
else
echo "iCloud directory doesn't exist: $icloud"
fi
echo "Disabling overly restrictive Gatekeeper"
# See https://techstuffer.com/this-app-is-damaged-error-macos-sierra/
sudo spctl --master-disable
}

View file

@ -1,4 +0,0 @@
# .rc.freebsd
# vim: ft=zsh
# Interactive shell setup for FreeBSD systems
# Eryn Wells <eryn@erynwells.me>

View file

@ -1,10 +0,0 @@
# .rc.linux
# vim: ft=zsh
# Interactive shell setup for Linux systems
# Eryn Wells <eryn@erynwells.me>
# iptables aliases
alias iptls='sudo iptables --line-numbers -nv -L'
alias ip6tls='sudo ip6tables --line-numbers -nv -L'
alias rlx="xrdb $HOME/.Xdefaults"

View file

@ -1,6 +0,0 @@
# .rc.local
# vim: set ft=zsh:
# Local customizations for interactive shells
# Eryn Wells <eryn@erynwells.me>

10
zsh/func/binary_exists Normal file
View file

@ -0,0 +1,10 @@
# .zshrc
# vim:ft=zsh:
# Eryn Wells <eryn@erynwells.me>
function binary_exists
{
return $(hash $1 1>/dev/null 2>&1)
}
binary_exists "$@"

View file

@ -0,0 +1,24 @@
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
autoload darwin_icloud_drive_path
function darwin_configure_screenshots_directory
{
icloud=`darwin_icloud_drive_path`
if [[ ! -d "$icloud" ]]; then
shell-log -l error "iCloud directory doesn't exist: $icloud"
return 1
fi
# Put screenshots in iCloud Drive, in a directory according to hostname
local name=`hostname -s | tr A-Z a-z`
local screenshots_dir="$icloud/Screenshots/$name"
shell-log "Setting screenshot directory: $screenshots_dir"
mkdir -p "$screenshots_dir"
defaults write com.apple.screencapture screenshots_diration "$screenshots_dir"
return 0
}
darwin_configure_screenshots_directory "$@"

View file

@ -0,0 +1,9 @@
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
function darwin_icloud_drive_path
{
echo "$HOME/Library/Mobile Documents/com~apple~CloudDocs"
}
darwin_icloud_drive_path "$@"

21
zsh/func/darwin_init_once Normal file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
autoload darwin_icloud_drive_path
autoload darwin_configure_screenshots_directory
function darwin_init_once
{
# Dim dock icons of apps that have been hidden.
shell-log "Auto-hiding Dock"
defaults write com.apple.Dock showhidden -boolean yes
killall Dock
darwin_configure_screenshots_directory
# See https://techstuffer.com/this-app-is-damaged-error-macos-sierra/
shell-log "Disabling overly restrictive Gatekeeper"
sudo spctl --master-disable
}
darwin_init_once "$@"

14
zsh/func/g Normal file
View file

@ -0,0 +1,14 @@
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
function g
{
if [[ $# -gt 0 ]]; then
git $@
else
git status --short --branch
fi
return $?
}
g "$@"

View file

@ -0,0 +1,17 @@
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
autoload binary_exists
function init_app_environments
{
# NetHack options
# use color in the terminal
binary_exists nethack && export NETHACKOPTIONS="color"
# Default ledger file
local ledgerFile="$HOME/Documents/Ledger/personal.ledger"
[[ -e "$ledgerFile" ]] && LEDGER_FILE="$ledgerFile"
}
init_app_environments "$@"

43
zsh/func/init_rc_aliases Normal file
View file

@ -0,0 +1,43 @@
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
autoload binary_exists
function init_rc_aliases
{
shell-log -l 'debug' "Setting up shell aliases"
alias j='jobs'
alias h='history'
alias df='df -h'
alias du='du -h'
alias e='emacs'
alias chux='chmod u+x'
alias chuw='chmod u+w'
alias chur='chmod u+r'
alias cho="chown $USER"
alias today='date +%Y-%m-%d'
alias addkey="ssh-agent ~/.ssh/id_rsa"
alias pprint="python -c 'import sys,pprint; pprint.pprint(eval(sys.stdin.read()))'"
alias pprint-json="python -c 'import sys,json;print json.dumps(json.load(sys.stdin), indent=2)'"
alias gp='g p origin $gitbranch'
alias gpf='g p -f origin $gitbranch'
alias bx='bundle exec'
binary_exists ledger && alias l='ledger'
binary_exists gpg2 && alias gpg='gpg2'
shell-log -l debug 'Setting up suffix aliases'
alias -s c='vim'
alias -s tex='vim'
alias -s txt='vim'
alias -s xml='vim'
alias -s jar='java -jar'
}
init_rc_aliases "$@"

View file

@ -0,0 +1,43 @@
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
function init_rc_configure_completion
{
shell-log 'Initializing completion system'
autoload -U compinit
compinit
# Cache completions
zstyle ':completion::complete:*' use-cache 1
zstyle ':completion::complete:*' cache-path ~/.zsh/cache
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
# For rm, cp, and mv don't complete if file is on the line already
zstyle ':completion:*:rm:*' ignore-line yes
zstyle ':completion:*:cp:*' ignore-line yes
zstyle ':completion:*:mv:*' ignore-line yes
# Remove trailing slashes in directory arguments
zstyle ':completion:*' squeeze-slashes true
# Never select parent directory
zstyle ':completion:*:cd:*' ignore-parents parent pwd
# Expand partial paths
zstyle ':completion:*' expand 'yes'
# Show a pretty menu of killable processes
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:*:kill:*' menu yes select
# Complete man pages by section
zstyle ':completion:*:manuals' separate-sections true
zstyle ':completion:*:manuals.*' insert-sections true
# Use git completion for the g function
compdef g='git'
}
init_rc_configure_completion "$@"

View file

@ -0,0 +1,41 @@
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
function init_configure_ls
{
local has_gnu_ls
local ls_options
if [[ ! -e "$1" ]]; then
shell-log -l error 'Missing required path to ls binary'
return
fi
if $1 --version 2>&1 | grep GNU 1>/dev/null; then
has_gnu_ls=1
ls_options='--color=auto'
else
has_gnu_ls=0
ls_options='-G'
fi
shell-log -l debug "Setting up aliases for $1"
alias ls="$1 $ls_options"
alias la="$1 -A $ls_options"
alias ll="$1 -l $ls_options"
alias l.="$1 -d $ls_options .*"
local dircolors_bin=`whence -p dircolors || whence -p gdircolors`
if [[ $has_gnu_ls -eq 1 && -n "$dircolors_bin" ]]; then
if [[ -e "$HOME/.dircolors/$SYS.cfg" ]]; then
dircolors="$HOME/.dircolors/$SYS.cfg"
else
dircolors="$HOME/.dircolors/default.cfg"
fi
shell-log -l debug "Setting up dircolors: `basename $dircolors`"
eval `$dircolors_bin $dircolors`
fi
}
init_configure_ls "$@"

View file

@ -0,0 +1,37 @@
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
function init_rc_configure_prompt
{
local theme=$1
if [[ -z "$1" ]]; then
theme=loquacious
fi
shell-log -l debug 'Configuring vcs_info'
autoload -U add-zsh-hook
autoload -Uz vcs_info
zstyle ':vcs_info:*' disable p4 bzr cdv darcs mtn svk tla cvs svn
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:git:general:*' formats '%b'
# Export the current Git branch before every prompt.
function export_gitbranch {
vcs_info general
if [[ "$gitbranches[1]" != "${vcs_info_msg_0_}" ]]; then
export gitbranches=(${vcs_info_msg_0_} $gitbranches[1,4])
fi
export gitbranch=${vcs_info_msg_0_}
}
add-zsh-hook precmd export_gitbranch
shell-log "Configuring prompt with '$theme' theme"
autoload -U promptinit
promptinit
prompt $theme
}
init_rc_configure_prompt "$@"

View file

@ -0,0 +1,27 @@
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
function init_rc_configure_zle
{
shell-log 'Configuring ZLE'
local mode=$1
if [[ -z "$mode" ]]; then
mode=emacs
fi
function configure_zle_emacs { }
function configure_zle_vim { }
shell-log -l debug "Using $mode command line editing mode"
if [[ $mode == 'vim' ]]; then
bindkey -v
configure_zle_vim
zle -A .backward-delete-char vi-backward-delete-char
elif [[ $mode == 'emacs' ]]; then
bindkey -e
configure_zle_emacs
fi
}
init_rc_configure_zle "$@"

38
zsh/func/init_rc_darwin Normal file
View file

@ -0,0 +1,38 @@
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
autoload binary_exists
function init_rc_darwin
{
shell-log 'Initializing Interactive Environment for macOS'
alias acls='command ls -le'
# These things might have been installed by Homebrew, and I like the GNU
# versions better.
binary_exists gdircolors && alias dircolors='gdircolors'
binary_exists gfind && alias find='gfind'
binary_exists gnuindent && alias indent='gnuindent'
binary_exists gls && init_rc_configure_ls `which gls`
# ldd doesn't exist on OS X, but otool -L does the same thing.
alias ldd='otool -L'
local sounds=/System/Library/Sounds
alias glass="afplay $sounds/Glass.aiff"
alias funk="afplay $sounds/Funk.aiff"
autoload +X darwin_init_once
autoload +X darwin_icloud_drive_path
autoload +X darwin_configure_screenshots_directory
# Open a file/folder in Finder
alias reveal='open -R'
alias -s app='open'
alias -s xcodeproj='open -a Xcode'
}
init_rc_darwin "$@"

13
zsh/func/init_rc_linux Normal file
View file

@ -0,0 +1,13 @@
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
function init_rc_linux
{
shell-log 'Initializing Interactive Environment for Linux'
alias iptls='sudo iptables --line-numbers -nv -L'
alias ip6tls='sudo ip6tables --line-numbers -nv -L'
alias rlx="xrdb $HOME/.Xdefaults"
}
init_rc_linux "$@"

View file

@ -0,0 +1,25 @@
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
autoload load_module
function init_zsh_functions
{
local myfpath="$HOME/.zsh/func"
shell-log "Loading functions in $myfpath"
for func in $myfpath/*; do
[[ ! -e "$func" || -d "$func" ]] && continue
local functionName=`basename $func`
[[ "$functionName" =~ "prompt_*" ]] && continue
[[ "$functionName" =~ "init_*" ]] && continue
shell-log -l debug "Loading $functionName"
autoload +X $functionName
done
load_module makers
}
init_zsh_functions "$@"

23
zsh/func/init_zsh_history Normal file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
function init_zsh_history
{
shell-log 'Setting up history'
setopt \
APPEND_HISTORY \
EXTENDED_HISTORY \
INC_APPEND_HISTORY \
HIST_FIND_NO_DUPS \
HIST_IGNORE_SPACE \
HIST_NO_STORE \
HIST_IGNORE_DUPS \
HIST_REDUCE_BLANKS
HISTSIZE=1000000
SAVEHIST=1000000
HISTFILE="$HOME/.zhistory"
}
init_zsh_history "$@"

18
zsh/func/init_zsh_options Normal file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
function init_zsh_options
{
shell-log 'Setting shell options'
# Report seconds since shell was invoked in milliseconds
typeset -F SECONDS
# See zshoptions(1)
setopt EXTENDED_GLOB \
MULTIOS \
AUTO_REMOVE_SLASH \
COMPLETE_IN_WORD
}
init_zsh_options "$@"

31
zsh/func/load_module Normal file
View file

@ -0,0 +1,31 @@
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
function load_module
{
local mod=$1
local modpath
for p in $fpath; do
modpath=$p/$mod
[[ -d $modpath ]] && break
modpath=''
done
if [[ -z "$modpath" ]]; then
shell-log -l error "Couldn't find path to module: $mod"
return 1
fi
fpath+=($modpath)
shell-log "Loading module: $mod"
for func in `ls $modpath`; do
shell-log "Loading function: $func"
autoload $func
done
return 0
}
load_module "$@"

15
zsh/func/vi Normal file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
function vi
{
if whence -cp nvim 1>/dev/null 2>&1; then
command nvim $@
elif whence -cp vim 1>/dev/null 2>&1; then
command vim $@
elif whence -cp vi 1>/dev/null 2>&1; then
command vi $@
fi
}
vi "$@"

285
zshrc
View file

@ -1,259 +1,34 @@
# .zshrc
# vim:ft=zsh:fdm=marker:sw=4:sts=4:
#
# ZSH init for interactive shells
#
#!/usr/bin/env zsh
# Eryn Wells <eryn@erynwells.me>
PROMPT_THEME='loquacious'
ZLE_MODE='emacs'
# load bash/zsh/ksh agnostic configurations
[[ -e $HOME/.rc ]] && source $HOME/.rc
print_heading -l 1 "Initializing interactive Z Shell"
function configure_general #{{{
{
print_info -l 2 'Configuring general ZSH settings'
# Report seconds since shell was invoked in milliseconds
typeset -F SECONDS
print_info_sub -l 3 'Setting shell options'
# See zshoptions(1)
setopt EXTENDED_GLOB \
MULTIOS \
AUTO_REMOVE_SLASH \
COMPLETE_IN_WORD
} #}}}
# Configure oh-my-zsh
function configure_omz #{{{
{
if [[ ! -d ~/.oh-my-zsh ]]; then
print_error -l 2 "No ~/.oh-my-zsh directory; skipping"
return
fi
print_info -l 2 'Configuring Oh My ZSH!'
ZSH=$HOME/.oh-my-zsh
DISABLE_AUTO_UPDATE="true"
COMPLETION_WAITING_DOTS="true"
plugins=(autojump brew encode64 fasd gnu-utils history osx python)
source $ZSH/oh-my-zsh.sh
alias v='f -t -e vim -b viminfo'
} #}}}
function configure_zle #{{{
{
print_info -l 2 'Configuring ZLE'
print_info_sub -l 5 "Using $ZLE_MODE command line editing mode"
[[ -z "$ZLE_MODE" ]] && ZLE_MODE='vim'
if [[ $ZLE_MODE == 'vim' ]]; then
bindkey -v
configure_zle_vim
elif [[ $ZLE_MODE == 'emacs' ]]; then
bindkey -e
configure_zle_emacs
fi
# Allow deleting over the start of insert mode
zle -A .backward-delete-char vi-backward-delete-char
} #}}}
function configure_zle_vim #{{{
{
# Edit commands in $EDITOR on 'v' in command mode
autoload -Uz edit-command-line
zle -N edit-command-line
bindkey -M vicmd v edit-command-line
# Use 'jj' to get to Cmd mode
bindkey -M viins 'jj' vi-cmd-mode
# Backwards incremental history search on ^R in insert mode
bindkey -M viins '^R' history-incremental-search-backwards
# Use arrow keys to go up and down lines and/or history in insert mode
bindkey -M viins "^[OA" up-line-or-history
bindkey -M viins "^[[A" up-line-or-history
bindkey -M viins "^[OB" down-line-or-history
bindkey -M viins "^[[B" down-line-or-history
} #}}}
function configure_zle_emacs #{{{
{
} #}}}
function configure_modules_and_functions #{{{
{
local myfpath="$HOME/.zsh/func"
fpath=($myfpath/makers $myfpath $fpath)
print_info -l 2 "Loading functions in $myfpath"
for func in $myfpath/*; do
if [[ ! -e "$func" ]]; then
continue
fi
# Skip prompt_* functions; these are handled elsewhere.
if [[ "$func" =~ "/prompt_*" ]]; then
continue
fi
local fname=`basename $func`
print_info_sub -l 3 "Loading $fname"
autoload $fname
done
load_module 'makers'
} #}}}
function configure_prompt #{{{
{
print_info -l 2 "Configuring prompt: $PROMPT_THEME"
autoload -U promptinit
promptinit
prompt $PROMPT_THEME
} #}}}
function configure_zsh_aliases #{{{
{
print_info -l 3 'Creating ZSH-specific aliases'
#alias -g nc='netcat'
alias -g lessnw='less -S'
# suffix aliases
alias -s c='vim'
alias -s tex='vim'
alias -s txt='vim'
alias -s xml='vim'
alias -s jar='java -jar'
alias bx='bundle exec'
} #}}}
function configure_history #{{{
{
print_info -l 2 'Setting up history'
setopt \
APPEND_HISTORY \
EXTENDED_HISTORY \
INC_APPEND_HISTORY \
HIST_FIND_NO_DUPS \
HIST_IGNORE_SPACE \
HIST_NO_STORE \
HIST_IGNORE_DUPS \
HIST_REDUCE_BLANKS
HISTSIZE=1000000
SAVEHIST=1000000
HISTFILE="$HOME/.zhistory"
} #}}}
function configure_completion #{{{
{
print_info -l 2 'Initializing completion system'
autoload -U compinit
compinit
# Cache completions
zstyle ':completion::complete:*' use-cache 1
zstyle ':completion::complete:*' cache-path ~/.zsh/cache
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
# For rm, cp, and mv don't complete if file is on the line already
zstyle ':completion:*:rm:*' ignore-line yes
zstyle ':completion:*:cp:*' ignore-line yes
zstyle ':completion:*:mv:*' ignore-line yes
# Remove trailing slashes in directory arguments
zstyle ':completion:*' squeeze-slashes true
# Never select parent directory
zstyle ':completion:*:cd:*' ignore-parents parent pwd
# Expand partial paths
zstyle ':completion:*' expand 'yes'
# Show a pretty menu of killable processes
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:*:kill:*' menu yes select
# Complete man pages by section
zstyle ':completion:*:manuals' separate-sections true
zstyle ':completion:*:manuals.*' insert-sections true
# Use git completion for the g function (which is a small wrapper around git; see .rc)
if [[ `whence -w g` =~ "function" ]]; then
compdef g='git'
fi
} #}}}
function configure_vcs_info #{{{
{
print_info -l 3 'Loading vcs_info'
autoload -U add-zsh-hook
autoload -Uz vcs_info
zstyle ':vcs_info:*' disable p4 bzr cdv darcs mtn svk tla cvs svn
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:git:general:*' formats '%b'
# Export the current Git branch before every prompt.
function export_gitbranch {
vcs_info general
if [[ "$gitbranches[1]" != "${vcs_info_msg_0_}" ]]; then
export gitbranches=(${vcs_info_msg_0_} $gitbranches[1,4])
fi
export gitbranch=${vcs_info_msg_0_}
}
add-zsh-hook precmd export_gitbranch
} #}}}
configure_general
#configure_omz
configure_zle
configure_modules_and_functions
configure_zsh_aliases
configure_history
configure_completion
configure_vcs_info
configure_prompt
if [ -e $HOME/.zshrc.$SYS ]; then
print_info -l 3 "Sourcing ${SYS}-specific Z Shell settings"
source $HOME/.zshrc.$SYS
shell-log 'Initializing Interactive Environment'
autoload init_app_environments
autoload init_rc_aliases
autoload init_rc_configure_completion
autoload init_rc_configure_ls
autoload init_rc_configure_prompt
autoload init_rc_configure_zle
autoload init_zsh_options
autoload init_zsh_history
autoload init_zsh_functions
init_rc_aliases
init_rc_configure_prompt loquacious
init_rc_configure_zle emacs
init_rc_configure_completion
init_zsh_options
init_zsh_history
init_zsh_functions
init_app_environments
autoload +X init_rc_$SYS
init_rc_$SYS
# Configure ls with the system ls if it hasn't been done already.
if ! alias ls 2>&1 1>/dev/null; then
init_rc_configure_ls `which ls`
fi
if [ -e $HOME/.zshrc.local ]; then
print_info -l 3 "Sourcing local Z Shell settings"
source $HOME/.zshrc.local
fi
autoload g
autoload vi

View file

@ -1,10 +0,0 @@
# zshrc.darwin
# OS X customizations for ZSH
#
# Eryn Wells <eryn@erynwells.me>
# Open a file/folder in Finder
alias reveal='open -R'
alias -s app='open'
alias -s xcodeproj='open -a Xcode'

View file

@ -1,5 +0,0 @@
# .zshrc.local
# Local customizations for zsh
# Eryn Wells <eryn@erynwells.me>