Created
March 30, 2018 09:15
-
-
Save worldofprasanna/28a57168109bccf148f32dbfae450e03 to your computer and use it in GitHub Desktop.
Enable vi mode in command line with indicator for Normal/Insert mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Indicate whether user is in Normal / Insert mode | |
function zle-line-init zle-keymap-select { | |
VIM_PROMPT="%{$fg_bold[yellow]%} [% NORMAL]% %{$reset_color%}" | |
RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1" | |
zle reset-prompt | |
} | |
set -o vi | |
zle -N zle-line-init | |
zle -N zle-keymap-select | |
# Increase the switching time between insert and normal mode in vim | |
autoload edit-command-line | |
zle -N edit-command-line | |
bindkey -M vicmd v edit-command-line |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment