zsh: general clean up

This commit is contained in:
Henrik Lissner 2015-12-17 05:32:03 -05:00
parent aeca37d359
commit b8ff51f0d0
3 changed files with 27 additions and 21 deletions

View file

@ -15,10 +15,11 @@ _human_time() {
echo "${seconds}s" echo "${seconds}s"
} }
# string length ignoring ansi escapes _strlen () {
_string_length() { FOO=$1
# Subtract one since newline is counted as two characters local zero='%([BSUbfksu]|([FB]|){*})'
echo $(( ${#${(S%%)1//(\%([KF1]|)\{*\}|\%[Bbkf])}} - 1 )) LEN=${#${(S%%)FOO//$~zero/}}
echo $LEN
} }
# fastest possible way to check if repo is dirty # fastest possible way to check if repo is dirty
@ -54,10 +55,14 @@ prompt_hook_preexec() {
} }
prompt_hook_precmd() { prompt_hook_precmd() {
last_time=$EPOCHSECONDS
# shows the full path in the title # shows the full path in the title
print -Pn '\e]0;%~\a' print -Pn '\e]0;%~\a'
# git info # git info
vcs_info vcs_info
# newline before prompt (except on first prompt)
[[ -n "$_DONE" ]] && print ""
_DONE=1
} }
# Updates cursor shape and prompt symbol based on vim mode # Updates cursor shape and prompt symbol based on vim mode

9
zshenv
View file

@ -53,20 +53,17 @@ export GOPATH=$HOME/Dropbox/work/go
export ANDROID_HOME=/usr/local/opt/android-sdk export ANDROID_HOME=/usr/local/opt/android-sdk
export ANDROID_SDK=/usr/local/Cellar/android-sdk/24.2 export ANDROID_SDK=/usr/local/Cellar/android-sdk/24.2
# basictex
# export PATH=/usr/local/texlive/2015basic/bin/x86_64-darwin:$PATH
# Set the list of directories that Zsh searches for programs. # Set the list of directories that Zsh searches for programs.
path=( path=(
$HOME/.dotfiles/{bin,scripts} $HOME/.dotfiles/{bin,scripts}
/usr/local/{bin,sbin}
/usr/{bin,sbin}
/{bin,sbin}
$HOME/.{rb,py}env/bin $HOME/.{rb,py}env/bin
$GOPATH/bin $GOPATH/bin
$ANDROID_HOME/platform-tools $ANDROID_HOME/platform-tools
$ANDROID_HOME/tools $ANDROID_HOME/tools
/Library/TeX/texbin /Library/TeX/texbin
/usr/local/{bin,sbin}
/usr/{bin,sbin}
/{bin,sbin}
$path $path
) )

26
zshrc
View file

@ -4,38 +4,42 @@
DOTFILES=$HOME/.dotfiles DOTFILES=$HOME/.dotfiles
source $DOTFILES/zsh/functions.zsh ZSH_CACHE_DIR="$HOME/.zsh/cache/$(hostname)"
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
# if not running through emacs' shell-command # if not running through emacs' shell-command
if [ ! $TERM = dumb ]; then if [ ! $TERM = dumb ]; then
ZGEN_AUTOLOAD_COMPINIT=true ZGEN_AUTOLOAD_COMPINIT=true
if [[ "${USER}" == "root" ]]; then [[ "${USER}" == "root" ]] && ZGEN_AUTOLOAD_COMPINIT=false
ZGEN_AUTOLOAD_COMPINIT=false
fi
source ~/.zsh/zgen/zgen.zsh source ~/.zsh/zgen/zgen.zsh
if ! zgen saved; then if ! zgen saved; then
echo "Creating zgen save" echo "Creating zgen save"
zgen load zsh-users/zsh-history-substring-search zgen load zsh-users/zsh-history-substring-search
zgen load zsh-users/zsh-completions src
zgen load Tarrasch/zsh-bd
zgen load willghatch/zsh-hooks zgen load willghatch/zsh-hooks
zgen load hlissner/zsh-autopair zgen load hlissner/zsh-autopair
zgen load StackExchange/blackbox
[[ "$SSH_CONNECTION" == '' ]] && zgen load zsh-users/zsh-syntax-highlighting [[ "$SSH_CONNECTION" == '' ]] && zgen load zsh-users/zsh-syntax-highlighting
zgen load $DOTFILES/zsh/config.zsh zgen load zsh-users/zsh-completions src
zgen load $DOTFILES/zsh/completion.zsh
zgen load $DOTFILES/zsh/keybinds.zsh zgen load "$DOTFILES/zsh/config.zsh"
zgen load $DOTFILES/zsh/prompt.zsh zgen load "$DOTFILES/zsh/completion.zsh"
zgen load "$DOTFILES/zsh/keybinds.zsh"
zgen load "$DOTFILES/zsh/prompt.zsh"
zgen save zgen save
fi fi
cache fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install cache fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install
export FZF_DEFAULT_COMMAND='ag -g ""'
export FZF_DEFAULT_OPTS='--reverse --inline-info'
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
fi fi
source $DOTFILES/zsh/aliases.zsh source "$DOTFILES/zsh/aliases.zsh"
cache rbenv init - --no-rehash cache rbenv init - --no-rehash
cache pyenv init - --no-rehash cache pyenv init - --no-rehash