Show signs of vi in shell
309219fdb1d6272517bf424a682cb4224b39c62f
1 parent
e70333ab
.zshrc
+24 -3
| 14 | 14 | # |
|
| 15 | 15 | autoload colors && colors |
|
| 16 | 16 | autoload -U compinit && compinit |
|
| 17 | 17 | autoload -U complist |
|
| 18 | 18 | ||
| 19 | - | # Set input mode to vi |
|
| 20 | - | set -o vi |
|
| 21 | - | ||
| 22 | 19 | # Fzy integration |
|
| 23 | 20 | if command -v fzy >/dev/null 2>&1 && test -f ~/.fzy.zsh; then |
|
| 24 | 21 | source ~/.fzy.zsh |
|
| 25 | 22 | else |
|
| 26 | 23 | bindkey '^R' history-incremental-search-backward |
| 92 | 89 | if [ "$RPROMPT" != "" ]; then |
|
| 93 | 90 | RPROMPT="%{$fg[red]%}#$RPROMPT%{$reset_color%}" |
|
| 94 | 91 | fi |
|
| 95 | 92 | } |
|
| 96 | 93 | ||
| 94 | + | # |
|
| 95 | + | # Vi-mode |
|
| 96 | + | # |
|
| 97 | + | set -o vi |
|
| 98 | + | # |
|
| 99 | + | zle-keymap-select zle-line-init() { |
|
| 100 | + | # Check ~/.st/config.h for the cursor escape sequences. |
|
| 101 | + | case $KEYMAP in |
|
| 102 | + | vicmd) print -n -- "\e[2 q";; |
|
| 103 | + | viins|main) print -n -- "\e[4 q";; |
|
| 104 | + | esac |
|
| 105 | + | ||
| 106 | + | zle reset-prompt |
|
| 107 | + | zle -R |
|
| 108 | + | } |
|
| 109 | + | ||
| 110 | + | zle-line-finish() { |
|
| 111 | + | print -n -- "\e[2 q" |
|
| 112 | + | } |
|
| 113 | + | ||
| 114 | + | zle -N zle-line-init |
|
| 115 | + | zle -N zle-line-finish |
|
| 116 | + | zle -N zle-keymap-select |
|
| 117 | + | ||
| 97 | 118 | col() { |
|
| 98 | 119 | awk "{ print \$$1 }" |
|
| 99 | 120 | } |
|
| 100 | 121 | ||
| 101 | 122 | source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh |