1 # vim: foldmethod=marker:foldlevel=0
4 setopt GLOB_STAR_SHORT GLOB_DOTS EXTENDED_GLOB
6 setopt AUTO_PUSHD PUSHD_IGNORE_DUPS
14 setopt APPEND_HISTORY SHARE_HISTORY INC_APPEND_HISTORY HIST_IGNORE_ALL_DUPS
15 setopt HIST_IGNORE_SPACE
16 HISTORY_IGNORE="(yt* *|t *|t|sdcv *|mmfileget *|arr)"
25 bindkey "^[[1~" beginning-of-line # Home
26 bindkey "^[[4~" end-of-line # End
29 # Command-line editing {{{
30 autoload -U edit-command-line
31 zle -N edit-command-line
32 bindkey -M vicmd v edit-command-line
36 autoload -U history-search-end
37 zle -N history-beginning-search-backward-end history-search-end
38 zle -N history-beginning-search-forward-end history-search-end
39 bindkey "^[[A" history-beginning-search-backward-end
40 bindkey "^[[B" history-beginning-search-forward-end
42 beginning-history-incremental-pattern-search-backward() {
43 zle history-incremental-pattern-search-backward ${BUFFER:gs/ /*/}
45 zle -N beginning-history-incremental-pattern-search-backward
46 bindkey "^[[1;2A" beginning-history-incremental-pattern-search-backward
47 bindkey -M isearch "^[[A" history-incremental-pattern-search-backward
48 bindkey -M isearch "^[[B" history-incremental-pattern-search-forward
52 function zle-line-init zle-keymap-select {
53 local state="%#" timer_val="?"
54 [[ ${KEYMAP} == vicmd ]] && state="+"
55 [[ $timer ]] && timer_val=$(( $SECONDS - $timer ))
57 prompt+="%U${timer_val}%u|"
59 prompt+="%B%F{magenta}${state}%f%b "
64 zle -N zle-keymap-select
71 printf "\a\033]2;\033\\"
81 alias -g W="| wc -l | sed 's/ //g'"
82 alias mc="mc --nomouse"
85 bfs . -name "*$1*" -print
88 alias ssh="TERM=xterm ssh"
89 alias sshnm="ssh -S none"
91 ssh -C -t $1 tmux attach -t0
94 autoload -U zsh-mime-setup
100 # Faster movement {{{
107 bindkey "
\eOQ" cddotdot # F2
114 bindkey "
\eOS" popdquiet # F4
119 alias Gb="git branch"
120 alias Gc="git checkout"
122 alias Gdc="git diff --cached"
123 alias Gs="git show --show-signature"
124 alias Gm="git diff --name-only --diff-filter=M --relative"
125 alias Gam="git commit --amend"
126 alias Gl="git log --oneline --graph --decorate=short"
127 alias Gld="git log --format=format:'%ai %Cgreen%h%Creset %s'"
129 bindkey -s "
\eOR" " git status --short\n" # F3
137 --dereference-recursive
138 --binary-files=without-match
143 grep $GREP_ARGS $@ | less
145 alias -g G="| grep --colour=always"
150 export GPG_TTY=$(tty)
155 ~/mail/mbox"?Neue Nachrichten in =mbox"
156 ~/mail/arbeit"?Neue Nachrichten in =arbeit"
158 alias arr="mutt -f =arbeit -e 'source ~/.mutt/accounts/stcnet.ru'"
159 alias sent="mutt -f =sent-\`date '+%y-%m'\`"
160 bindkey -s "
\eOP" " inc\n" # F1
164 zstyle ":completion:*:functions" ignored-patterns "_*"
165 zstyle ":completion:*" matcher-list "" 'm:{a-z\-}={A-Z\_}' 'r:|?=** m:{a-z\-}={A-Z\_}'
167 [[ ${words[1]} != man ]] || { _man && return 0 }
168 [[ $CURRENT -eq 1 ]] && _command_names || _files && return 0
169 # MAGIC_EQUAL_SUBST {{{
170 [[ $PREFIX = *\=* ]] || return 1
171 compstate[parameter]=${PREFIX%%\=*}
176 zstyle ":completion:*" completer _mycomp _parameters
177 autoload -U compinit ; compinit -d /tmp/.zcompdump
178 zstyle ":completion:*:default" list-colors ""
183 ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
184 . ~/work/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
185 typeset -A ZSH_HIGHLIGHT_STYLES
186 ZSH_HIGHLIGHT_STYLES[assign]="fg=yellow"
187 ZSH_HIGHLIGHT_STYLES[commandseparator]="fg=red"
188 ZSH_HIGHLIGHT_STYLES[single-hyphen-option]="fg=green,bold"
189 ZSH_HIGHLIGHT_STYLES[double-hyphen-option]="fg=green"
190 ZSH_HIGHLIGHT_STYLES[globbing]="fg=magenta"
191 ZSH_HIGHLIGHT_STYLES[global-alias]="fg=yellow,bold"
192 ZSH_HIGHLIGHT_STYLES[history-expansion]="fg=magenta"
193 ZSH_HIGHLIGHT_STYLES[redirection]="fg=red"
194 ZSH_HIGHLIGHT_STYLES[path]="fg=white,underline"
195 ZSH_HIGHLIGHT_STYLES[path_pathseparator]="fg=white,bold,underline"
199 . ~/work/zsh-autosuggestions/zsh-autosuggestions.zsh
200 ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=cyan"
205 local dir=$(bfs -L ${1:-.} -mindepth 1 \
206 -path "*/\.git" -prune -o \
207 -path "*/\.redo" -prune -o \
208 -type d -print 2>/dev/null |
209 fzf --height 40% --reverse --preview="tree -CN {}")
210 [[ -z $dir ]] || { print -s cd $dir ; cd $dir }
214 # Named directories {{{
217 hash -d ${w[1]}=${~${w[2]}}
222 . ~/work/zsh-autoenv/autoenv.zsh
227 . /usr/local/bin/virtualenvwrapper.sh