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"
}
# string length ignoring ansi escapes
_string_length() {
# Subtract one since newline is counted as two characters
echo $(( ${#${(S%%)1//(\%([KF1]|)\{*\}|\%[Bbkf])}} - 1 ))
_strlen () {
FOO=$1
local zero='%([BSUbfksu]|([FB]|){*})'
LEN=${#${(S%%)FOO//$~zero/}}
echo $LEN
}
# fastest possible way to check if repo is dirty
@ -54,10 +55,14 @@ prompt_hook_preexec() {
}
prompt_hook_precmd() {
last_time=$EPOCHSECONDS
# shows the full path in the title
print -Pn '\e]0;%~\a'
# git 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

9
zshenv
View file

@ -53,20 +53,17 @@ export GOPATH=$HOME/Dropbox/work/go
export ANDROID_HOME=/usr/local/opt/android-sdk
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.
path=(
$HOME/.dotfiles/{bin,scripts}
/usr/local/{bin,sbin}
/usr/{bin,sbin}
/{bin,sbin}
$HOME/.{rb,py}env/bin
$GOPATH/bin
$ANDROID_HOME/platform-tools
$ANDROID_HOME/tools
/Library/TeX/texbin
/usr/local/{bin,sbin}
/usr/{bin,sbin}
/{bin,sbin}
$path
)

26
zshrc
View file

@ -4,38 +4,42 @@
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 [ ! $TERM = dumb ]; then
ZGEN_AUTOLOAD_COMPINIT=true
if [[ "${USER}" == "root" ]]; then
ZGEN_AUTOLOAD_COMPINIT=false
fi
[[ "${USER}" == "root" ]] && ZGEN_AUTOLOAD_COMPINIT=false
source ~/.zsh/zgen/zgen.zsh
if ! zgen saved; then
echo "Creating zgen save"
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 hlissner/zsh-autopair
zgen load StackExchange/blackbox
[[ "$SSH_CONNECTION" == '' ]] && zgen load zsh-users/zsh-syntax-highlighting
zgen load $DOTFILES/zsh/config.zsh
zgen load $DOTFILES/zsh/completion.zsh
zgen load $DOTFILES/zsh/keybinds.zsh
zgen load $DOTFILES/zsh/prompt.zsh
zgen load zsh-users/zsh-completions src
zgen load "$DOTFILES/zsh/config.zsh"
zgen load "$DOTFILES/zsh/completion.zsh"
zgen load "$DOTFILES/zsh/keybinds.zsh"
zgen load "$DOTFILES/zsh/prompt.zsh"
zgen save
fi
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
source $DOTFILES/zsh/aliases.zsh
source "$DOTFILES/zsh/aliases.zsh"
cache rbenv init - --no-rehash
cache pyenv init - --no-rehash