2013-08-04 02:04:37 -07:00
|
|
|
bindkey -v
|
2014-12-07 12:14:27 -08:00
|
|
|
bindkey '^ ' edit-command-line
|
2013-08-02 12:37:20 -07:00
|
|
|
|
2014-08-12 22:19:03 -07:00
|
|
|
bindkey -M viins '^w' backward-kill-word
|
2015-01-16 12:24:00 -08:00
|
|
|
bindkey -M viins '^[w' forward-word
|
|
|
|
bindkey -M viins '^[b' backward-word
|
2014-08-21 00:28:28 -07:00
|
|
|
|
2015-06-18 13:16:54 -07:00
|
|
|
bindkey -M vicmd 'yy' vi-yank-whole-line
|
|
|
|
bindkey -M vicmd 'Y' vi-yank-eol
|
|
|
|
|
|
|
|
bindkey -M vicmd '^r' redo
|
|
|
|
|
2014-08-21 00:28:28 -07:00
|
|
|
bindkey -M viins ' ' magic-space
|
2014-12-07 12:14:27 -08:00
|
|
|
bindkey -M viins 'jk' vi-cmd-mode
|
2014-08-21 00:28:28 -07:00
|
|
|
|
2014-08-24 03:31:37 -07:00
|
|
|
bindkey -M viins '^x^f' fasd-complete-f # C-x C-f to do fasd-complete-f (only files)
|
|
|
|
bindkey -M viins '^x^d' fasd-complete-d # C-x C-d to do fasd-complete-d (only directories)
|
2014-09-05 13:55:50 -07:00
|
|
|
|
2015-06-18 13:16:54 -07:00
|
|
|
bindkey -M viins '^q' push-line-or-edit
|
|
|
|
|
|
|
|
bindkey -M vicmd "?" history-incremental-pattern-search-backward
|
|
|
|
bindkey -M vicmd "/" history-incremental-pattern-search-forward
|
|
|
|
|
|
|
|
# bind UP and DOWN arrow keys
|
|
|
|
zmodload zsh/terminfo
|
|
|
|
bindkey "$terminfo[kcuu1]" history-substring-search-up
|
|
|
|
bindkey "$terminfo[kcud1]" history-substring-search-down
|
|
|
|
# bind UP and DOWN arrow keys (compatibility fallback
|
|
|
|
# for Ubuntu 12.04, Fedora 21, and MacOSX 10.9 users)
|
|
|
|
bindkey '^[[A' history-substring-search-up
|
|
|
|
bindkey '^[[B' history-substring-search-down]]]]
|
|
|
|
|
|
|
|
# Edit command in an external editor.
|
|
|
|
bindkey -M vicmd "v" edit-command-line
|
|
|
|
|
|
|
|
# # Undo/Redo
|
|
|
|
bindkey -M vicmd "u" undo
|
|
|
|
bindkey -M vicmd "$key_info[Control]R" redo
|
|
|
|
|
|
|
|
bindkey -M viins "." expand-dot-to-parent-directory-path
|
|
|
|
|
2014-09-05 13:55:50 -07:00
|
|
|
# Completing words in buffer in tmux
|
|
|
|
if [ -n "$TMUX" ]; then
|
|
|
|
_tmux_pane_words() {
|
|
|
|
local expl
|
|
|
|
local -a w
|
|
|
|
if [[ -z "$TMUX_PANE" ]]; then
|
|
|
|
_message "not running inside tmux!"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
w=( ${(u)=$(tmux capture-pane \; show-buffer \; delete-buffer)} )
|
|
|
|
_wanted values expl 'words from current tmux pane' compadd -a w
|
|
|
|
}
|
|
|
|
|
|
|
|
zle -C tmux-pane-words-prefix complete-word _generic
|
|
|
|
zle -C tmux-pane-words-anywhere complete-word _generic
|
|
|
|
|
2014-12-07 12:14:27 -08:00
|
|
|
bindkey -M viins '^n' tmux-pane-words-prefix
|
|
|
|
bindkey -M viins '^o' tmux-pane-words-anywhere
|
2014-09-05 13:55:50 -07:00
|
|
|
|
|
|
|
zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' completer _tmux_pane_words
|
|
|
|
zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' ignore-line current
|
|
|
|
zstyle ':completion:tmux-pane-words-anywhere:*' matcher-list 'b:=* m:{A-Za-z}={a-zA-Z}'
|
|
|
|
fi
|
2015-06-18 13:16:54 -07:00
|
|
|
|
|
|
|
# Expands .... to ../..
|
|
|
|
function expand-dot-to-parent-directory-path {
|
|
|
|
if [[ $LBUFFER = *.. ]]; then
|
|
|
|
LBUFFER+='/..'
|
|
|
|
else
|
|
|
|
LBUFFER+='.'
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
zle -N expand-dot-to-parent-directory-path
|