autoload -U colors && colors autoload -U promptinit; compinit autoload -U complist # Set vim mode set -o vi # Allow editing of current line in $EDITOR using command mode V autoload -U edit-command-line zle -N edit-command-line bindkey -M vicmd v edit-command-line # ctrl-r search history backward to keep old pattern bindkey '^r' history-incremental-search-backward # ctrl-j search history backward to have vim like binding # TODO: Find out why this breaks within neoterminal when sending commands like from test or repl # bindkey '^j' history-incremental-search-backward # # ctrl-k search history forward to have vim like binding bindkey '^k' history-search-forward # Use vim keys within completion zmodload zsh/complist bindkey -M menuselect 'h' vi-backward-char bindkey -M menuselect 'k' vi-up-line-or-history bindkey -M menuselect 'l' vi-forward-char bindkey -M menuselect 'j' vi-down-line-or-history # Add vim like text objects autoload -Uz select-bracketed select-quoted zle -N select-quoted zle -N select-bracketed for km in viopp visual; do bindkey -M $km -- '-' vi-up-line-or-history for c in {a,i}${(s..)^:-\'\"\`\|,./:;=+@}; do bindkey -M $km $c select-quoted done for c in {a,i}${(s..)^:-'()[]{}<>bB'}; do bindkey -M $km $c select-bracketed done done # Set options # also complete defined alias setopt completealiases # Correct mistyped commands setopt correctall # Try to make the completion list smaller (occupying less lines) by printing the matches in columns with different widths. setopt list_packed # When listing files that are possible completions, show the type of each file with a trailing identifying mark. setopt list_types # Set Prompt # Allow for functions in the prompt. setopt PROMPT_SUBST PROMPT=$'%{$fg[blue]%}%1~ > %{$reset_color%}' zstyle ':completion:*:descriptions' format '%F{blue}-- %d --%f' zstyle ':completion:*:messages' format ' %F{purple} -- %d --%f' zstyle ':completion:*:warnings' format '%F{yellow} -- Sorry no matches -- %d%b%f' zstyle ':completion:*:*:*:*:corrections' format '%F{yellow}!- %d (errors: %e) -!%f' zstyle ':completion:*' menu select zstyle ':completion:*' use-cache on zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} zstyle ':completion:*' completer _extensions _complete zstyle ':completion:*' group-name '' zstyle ':completion::complete:git-checkout:argument-rest:' group-order heads-local heads-remote commit-tags zstyle ':completion::complete:git-checkout:argument-rest:commits' command 'echo' zstyle ':completion::complete:git-checkout:argument-rest:valid-ref-names' command 'echo' zstyle ':completion::complete:git-checkout:argument-rest:remote-branch-refs-noprefix' command 'echo'