Created
January 16, 2013 17:53
-
-
Save thricedotted/4549204 to your computer and use it in GitHub Desktop.
supa messy .zshrc with so many things that i borrowed from different places on the internet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# yo make sure we got colors | |
autoload -U colors && colors | |
export EDITOR=vim | |
export BROWSER=dwb | |
export PATH=~/bin:~/.gem/ruby/1.9.1/bin:$PATH | |
setopt PROMPT_SUBST | |
fpath=(~/.zsh/functions $fpath) | |
autoload -U ~/.zsh/functions/*(:t) | |
# Enable auto-execution of functions. | |
typeset -ga preexec_functions | |
typeset -ga precmd_functions | |
typeset -ga chpwd_functions | |
# Append git functions needed for prompt. | |
preexec_functions+='preexec_update_git_vars' | |
precmd_functions+='precmd_update_git_vars' | |
chpwd_functions+='chpwd_update_git_vars' | |
precmd() { | |
PWDLEN=$(($COLUMNS-30)) | |
PROMPT=" | |
%{$fg[white]%}ââ⤠%{$fg[green]%}%T %{$fg[cyan]%}%m %{$fg[red]%}%${(e)PWDLEN}<...<%~%<<$(prompt_git_info) %{$fg[white]%}ââ¼ | |
%{$fg[white]%}âââ%{$reset_color%} " | |
} | |
PROMPT=" | |
%{$fg[white]%}ââ⤠%{$fg[green]%}%T %{$fg[cyan]%}%m %{$fg[red]%}%${(e)PWDLEN}<...<%~%<<$(prompt_git_info) %{$fg[white]%}ââ¼ | |
%{$fg[white]%}âââ%{$reset_color%} " | |
# fix keys | |
bindkey '^[[3~' delete-char | |
bindkey "^[[H" beginning-of-line | |
bindkey "^[[1~" beginning-of-line | |
bindkey "^[OH" beginning-of-line | |
bindkey "^[[F" end-of-line | |
bindkey "^[[4~" end-of-line | |
bindkey "^[OF" end-of-line | |
# some more fun keybinding crap | |
bindkey -v | |
bindkey '' insert-last-word | |
bindkey '' push-line-or-edit | |
bindkey '' history-incremental-pattern-search-backward | |
# tmux compatibility | |
[ -n "$TMUX" ] && export TERM=screen-256color | |
# Lines configured by zsh-newuser-install | |
HISTFILE=~/.histfile | |
HISTSIZE=1000 | |
SAVEHIST=1000 | |
# End of lines configured by zsh-newuser-install | |
# The following lines were added by compinstall | |
zstyle :compinstall filename '/home/lzilles/.zshrc' | |
autoload -Uz compinit && compinit | |
# End of lines added by compinstall | |
# more autocomplete stuff | |
zstyle ':completion:*' menu select | |
zstyle ':completion:*' completer _complete _match _approximate | |
zstyle ':completion:*:*:kill:*' menu yes select | |
zstyle ':completion:*:kill:*' force-list always | |
zstyle ':completion:*:functions' ignored-patterns '_*' | |
# ssh tab completion | |
zstyle ':completion:*:scp:*' tag-order \ | |
'hosts:-host hosts:-domain:domain hosts:-ipaddr:IP\ address *' | |
zstyle ':completion:*:scp:*' group-order \ | |
users files all-files hosts-domain hosts-host hosts-ipaddr | |
zstyle ':completion:*:ssh:*' tag-order \ | |
users 'hosts:-host hosts:-domain:domain hosts:-ipaddr:IP\ address *' | |
zstyle ':completion:*:ssh:*' group-order \ | |
hosts-domain hosts-host users hosts-ipaddr | |
zstyle ':completion:*:(ssh|scp):*:hosts-host' ignored-patterns \ | |
'*.*' loopback localhost | |
zstyle ':completion:*:(ssh|scp):*:hosts-domain' ignored-patterns \ | |
'<->.<->.<->.<->' '^*.*' '*@*' | |
zstyle ':completion:*:(ssh|scp):*:hosts-ipaddr' ignored-patterns \ | |
'^<->.<->.<->.<->' '127.0.0.<->' | |
zstyle ':completion:*:(ssh|scp):*:users' ignored-patterns \ | |
adm bin daemon halt lp named shutdown sync | |
# autocomplete colors! from http://chneukirchen.org/dotfiles/.zshrc | |
export LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32' | |
zstyle ':completion:*' list-colors '' | |
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} | |
# history settings -- most of these are me being cranky about dups | |
setopt HIST_IGNORE_ALL_DUPS | |
setopt HIST_EXPIRE_DUPS_FIRST | |
setopt HIST_FIND_NO_DUPS | |
setopt HIST_SAVE_NO_DUPS | |
setopt INC_APPEND_HISTORY # add things to file as soon as entered? | |
setopt SHARE_HISTORY # update history file as soon as command entered | |
# stuff for changing directories | |
setopt AUTO_CD # no need to type dir name | |
setopt AUTO_PUSHD | |
setopt PUSHD_IGNOREDUPS | |
setopt PUSHD_MINUS | |
# things for globbin' and completion | |
setopt EXTENDED_GLOB | |
setopt COMPLETE_ALIASES | |
setopt MARKDIRS # puts a / after dirs in completion | |
setopt NUMERIC_GLOB_SORT # sorts by numbers if it's a <-> | |
setopt INTERACTIVE_COMMENTS # pound at start of lines = comment | |
# ALIASES | |
alias ls=" ls --color=auto" | |
alias cd=" cd" | |
alias bg=" bg" | |
alias fg=" fg" | |
alias grep='grep --color=auto' | |
alias -s tex=vim | |
alias -s txt=vim | |
alias -s jpg=feh | |
alias -s png=feh | |
alias -s bmp=feh | |
alias -s gif=feh | |
alias -s html=dwb | |
alias -s org=dwb | |
alias -s com=dwb | |
alias -s net=dwb | |
alias -s edu=dwb | |
alias -s avi=mplayer | |
alias -s pdf=zathura | |
alias -s ps=zathura | |
# this is neat for cd -<TAB> | |
DIRSTACKSIZE=9 | |
DIRSTACKFILE=~/.zdirs | |
if [[ -f $DIRSTACKFILE ]] && [[ $#dirstack -eq 0 ]]; then | |
dirstack=( ${(f)"$(< $DIRSTACKFILE)"} ) | |
[[ -d $dirstack[1] ]] && cd $dirstack[1] && cd $OLDPWD | |
fi | |
function chpwd() { | |
emulate -L zsh | |
print -l $PWD ${(u)dirstack} >$DIRSTACKFILE | |
ls | |
} | |
alias zrc='vim ~/.zshrc && source ~/.zshrc && echo ".zshrc updated!"' | |
alias zsource='source ~/.zshrc && echo ".zshrc updated!"' | |
alias vrc='vim ~/.vimrc && echo ".vimrc updated!"' | |
# cleverly bring vi to foreground! | |
foreground-vi() { fg %vim } | |
zle -N foreground-vi | |
bindkey '' foreground-vi | |
# grep history! | |
h() { | |
fc -l 0 -1 | sed -n "/$1/s/^ */!/p" | tail -n ${2:-10} | |
} | |
alias h=' h' | |
# better history completion LOAD B4 SYNTAX!! | |
#source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh | |
# live syntax highlighting fuck yes | |
source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh | |
alias dtoggleon='xrandr --output VGA1 --auto && xrandr --output eDP1 --off; xmodmap -e "clear Lock" -e "keycode 0x42 = Escape"' | |
alias dtoggleoff='xrandr --output VGA1 --off && xrandr --output eDP1 --auto' | |
# let's play crawl! | |
alias crawl='TERM=rxvt-256color ssh -C -i ~/.ssh/cao_key -l joshua crawl.akrasiac.org' | |
mkcd() { mkdir $1 && cd $1 } | |
dump() { vim ~/dump/$(date "+%F")_$1 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment