1 # vim: foldmethod=marker:foldlevel=0
4 setopt GLOB_STAR_SHORT GLOB_DOTS EXTENDED_GLOB
6 setopt AUTO_PUSHD PUSHD_IGNORE_DUPS
15 setopt APPEND_HISTORY SHARE_HISTORY INC_APPEND_HISTORY HIST_IGNORE_ALL_DUPS
16 setopt HIST_IGNORE_SPACE
17 HISTORY_IGNORE="(yt* *|t *|t|sdcv *|mmfileget *|arr)"
26 bindkey "^[[1~" beginning-of-line # Home
27 bindkey "^[[4~" end-of-line # End
30 # Command-line editing {{{
31 autoload -U edit-command-line
32 zle -N edit-command-line
33 bindkey -M vicmd v edit-command-line
37 autoload -U history-search-end
38 zle -N history-beginning-search-backward-end history-search-end
39 zle -N history-beginning-search-forward-end history-search-end
40 bindkey "^[[A" history-beginning-search-backward-end
41 bindkey "^[[B" history-beginning-search-forward-end
43 beginning-history-incremental-pattern-search-backward() {
44 zle history-incremental-pattern-search-backward ${BUFFER:gs/ /*/}
46 zle -N beginning-history-incremental-pattern-search-backward
47 bindkey "^[[1;2A" beginning-history-incremental-pattern-search-backward
48 bindkey -M isearch "^[[A" history-incremental-pattern-search-backward
49 bindkey -M isearch "^[[B" history-incremental-pattern-search-forward
53 function zle-line-init zle-keymap-select {
54 local state="%#" timer_val="?"
55 [[ ${KEYMAP} == vicmd ]] && state="+"
56 [[ $timer ]] && timer_val=$(( $SECONDS - $timer ))
58 prompt+="%U${timer_val}%u|"
60 prompt+="%B%F{magenta}${state}%f%b "
65 zle -N zle-keymap-select
72 printf "\a\033]2;\033\\"
82 alias -g W="| wc -l | sed 's/ //g'"
83 alias -g T="| tai64nlocal"
84 alias mc="mc --nomouse"
87 bfs . -name "*$1*" -print
90 alias ssh="TERM=xterm ssh"
91 alias sshnm="ssh -S none"
93 ssh -C -t $1 tmux attach -t0
96 autoload -U zsh-mime-setup ; zsh-mime-setup
102 # Faster movement {{{
109 bindkey "
\eOQ" cddotdot # F2
116 bindkey "
\eOS" popdquiet # F4
121 alias Gb="git branch"
122 alias Gc="git checkout"
124 alias Gdc="git diff --cached"
125 alias Gs="git show --show-signature"
126 alias Gm="git diff --name-only --diff-filter=M --relative"
127 alias Gam="git commit --amend"
128 alias Gl="git log --oneline --graph --decorate=short"
129 alias Gld="git log --format=format:'%ai %Cgreen%h%Creset %s'"
131 bindkey -s "
\eOR" " git status --short\n" # F3
139 --dereference-recursive
140 --binary-files=without-match
145 grep $GREP_ARGS $@ | less
147 alias -g G="| grep --colour=always"
152 export GPG_TTY=$(tty)
157 ~/mail/mbox"?Neue Nachrichten in =mbox"
158 ~/mail/arbeit"?Neue Nachrichten in =arbeit"
160 alias arr="mutt -f =arbeit -e 'source ~/.mutt/accounts/stcnet.ru'"
161 alias sent="mutt -f =sent-\`date '+%y-%m'\`"
162 bindkey -s "
\eOP" " inc\n" # F1
166 zstyle ":completion:*" list-colors ""
168 zstyle ":completion:*:functions" ignored-patterns "_*"
169 zstyle ":completion:*:manuals" separate-sections true
171 zstyle ":completion:*" group-name ""
172 zstyle ":completion:*:messages" format "%d"
173 zstyle ":completion:*:warnings" format "%F{red}no matches: %d%f"
174 zstyle ":completion:*:*:*:*:descriptions" format "%B... %d%b"
175 zstyle ":completion:*:files:*:*:descriptions" format ""
177 zstyle ":completion:*" file-patterns "%p:globbed" "*"
178 zstyle ":completion:*" matcher-list "" "m:{a-z-}={A-Z_}" "r:|?=** m:{a-z-}={A-Z_}"
179 zstyle ":completion:*" completer _mycomp _parameters _ignored
182 [[ $CURRENT -eq 1 ]] && curcontext="${curcontext%:*:*}:-command-:" \
183 _command_names && return
184 [[ $IPREFIX =~ ~.* ]] && _tilde && return
186 curcontext=:files:${curcontext#:*:} _files && has_files=1
187 [[ ${words[1]} == man ]] && curcontext=:man:${curcontext#:*:} \
188 _dispatch "" man man "" -default- && _value && return
189 [[ ${words[1]} == info ]] && curcontext=:info:${curcontext#:*:} \
190 _dispatch "" info info "" -default- && return
191 [[ $has_files ]] && return
193 # MAGIC_EQUAL_SUBST {{{
194 [[ $PREFIX = *\=* ]] || return 1
195 compstate[parameter]=${PREFIX%%\=*}
201 autoload -U compinit ; compinit -d /tmp/.zcompdump
206 ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
207 . ~/work/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
208 typeset -A ZSH_HIGHLIGHT_STYLES
209 ZSH_HIGHLIGHT_STYLES[assign]="fg=yellow"
210 ZSH_HIGHLIGHT_STYLES[commandseparator]="fg=red"
211 ZSH_HIGHLIGHT_STYLES[single-hyphen-option]="fg=green,bold"
212 ZSH_HIGHLIGHT_STYLES[double-hyphen-option]="fg=green"
213 ZSH_HIGHLIGHT_STYLES[globbing]="fg=magenta"
214 ZSH_HIGHLIGHT_STYLES[global-alias]="fg=yellow,bold"
215 ZSH_HIGHLIGHT_STYLES[history-expansion]="fg=magenta"
216 ZSH_HIGHLIGHT_STYLES[redirection]="fg=red"
217 ZSH_HIGHLIGHT_STYLES[path]="fg=white,underline"
218 ZSH_HIGHLIGHT_STYLES[path_pathseparator]="fg=white,bold,underline"
222 . ~/work/zsh-autosuggestions/zsh-autosuggestions.zsh
223 ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=cyan"
228 local dir=$(bfs -L ${1:-.} -mindepth 1 \
229 -path "*/\.git" -prune -o \
230 -path "*/\.redo" -prune -o \
231 -type d -print 2>/dev/null |
232 fzf --height 40% --reverse --preview="tree -CN {}")
233 [[ -z $dir ]] || { print -s cd $dir ; cd $dir }
237 # Named directories {{{
240 hash -d ${w[1]}=${~${w[2]}}
246 . /usr/local/bin/virtualenvwrapper.sh
251 . ~/work/zsh-autoenv/autoenv.zsh