zsh: use vi mode with cursor shape matching mode
This commit is contained in:
parent
590c5f4f8b
commit
483163dbbc
1 changed files with 15 additions and 0 deletions
15
files/zshrc
15
files/zshrc
|
@ -16,3 +16,18 @@ HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/history"
|
||||||
HISTSIZE=1000000
|
HISTSIZE=1000000
|
||||||
SAVEHIST=1000000
|
SAVEHIST=1000000
|
||||||
|
|
||||||
|
# Use vi mode for line editing.
|
||||||
|
bindkey -v
|
||||||
|
|
||||||
|
# Use beam cursor on each new prompt
|
||||||
|
precmd() { echo -ne '\e[5 q'; }
|
||||||
|
|
||||||
|
# Switch cursor shape depending on editing mode.
|
||||||
|
zle-keymap-select() {
|
||||||
|
case $KEYMAP in
|
||||||
|
vicmd) echo -ne '\e[1 q';; # block cursor for command mode
|
||||||
|
viins|main) echo -ne '\e[5 q';; # beam cursor for insert mode
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
zle -N zle-keymap-select
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue