shownotes-w3m-rice/zsh_vim_mode.txt
2013-05-24 15:14:09 -07:00

49 lines
1.2 KiB
Plaintext

# this is notes for video: http://www.youtube.com/watch?v=EIp6TSC8SOQ
##### for ~/.zshrc
# enable vim mode on commmand line
bindkey -v
# no delay entering normal mode
# https://coderwall.com/p/h63etq
# https://github.com/pda/dotzsh/blob/master/keyboard.zsh#L10
# 10ms for key sequences
KEYTIMEOUT=1
# show vim status
# http://zshwiki.org/home/examples/zlewidgets
function zle-line-init zle-keymap-select {
RPS1="${${KEYMAP/vicmd/-- NORMAL --}/(main|viins)/-- INSERT --}"
RPS2=$RPS1
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select
# add missing vim hotkeys
# fixes backspace deletion issues
# http://zshwiki.org/home/zle/vi-mode
bindkey -a u undo
bindkey -a '^R' redo
bindkey '^?' backward-delete-char
bindkey '^H' backward-delete-char
# history search in vim mode
# http://zshwiki.org./home/zle/bindkeys#why_isn_t_control-r_working_anymore
bindkey -M viins '^s' history-incremental-search-backward
bindkey -M vicmd '^s' history-incremental-search-backward
##### for ~/tmux.conf
# Lowers the delay time between the prefix key and other keys - fixes pausing in vim
set -sg escape-time 1
# reload .tmux.conf
bind-key r source-file ~/.tmux.conf \; display-message "Configuration reloaded"