From Scribby Peafowl, 2 Years ago, written in Plain Text.
This paste will shuffle off the mortal coil in 1 Second.
Embed
  1. # Vi mode settings
  2. set -o vi
  3. export KEYTIMEOUT=10
  4.  
  5. # Adds notice for vim mode [NOMRAL] and [INSERT] depending on shell mode
  6. function zle-keymap-select() {
  7.     VIM_NORMAL_PROMPT="%{$fg_bold[red]%} [% NORMAL]% %{$reset_color%}"
  8.     VIM_INSERT_PROMPT="%{$fg_bold[yellow]%} [% INSERT]% %{$reset_color%}"
  9.     RPS1="${${KEYMAP/vicmd/$VIM_NORMAL_PROMPT}/(viins|main)/$VIM_INSERT_PROMPT} $EPS1"
  10.     zle reset-prompt
  11. }
  12. function zle-line-init() {
  13.   zle-keymap-select
  14. }
  15. zle -N zle-line-init
  16. zle -N zle-keymap-select
  17.  
  18. # Use vim cli mode
  19. bindkey '^P' up-history
  20. bindkey '^N' down-history
  21. bindkey 'jk' vi-cmd-mode
  22. bindkey 'kj' vi-cmd-mode
  23.  
  24. bindkey '^ ' autosuggest-accept
  25.  
  26. bindkey '^e' edit-command-line