shownotes-w3m-rice/zsh_vim_mode.txt
2016-02-07 02:39:46 -08:00

48 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
# http://zshwiki.org/home/zle/vi-mode
bindkey -a u undo
bindkey -a '^T' redo
bindkey '^?' backward-delete-char #backspace
# history search in vim mode
# http://zshwiki.org./home/zle/bindkeys#why_isn_t_control-r_working_anymore
# ctrl+r to search history
bindkey -M viins '^r' history-incremental-search-backward
bindkey -M vicmd '^r' 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"