简体   繁体   中英

Zsh - can not do backspace after new line

I am using zsh(not oh my zsh). The back button works, but it only works on the same line. If I have a new line(like if I hit the up arrow and bring back the last command) the back button will not go to the previous line.

I am using the vim key bindings. Any ideas how to fix?

bindkey -v
bindkey '^R' history-incremental-search-backward
bindkey "^[[A" history-search-backward
bindkey -v '^?' backward-delete-char

It's not clear what you mean by the "Back" button. You're showing bindings for Ctrl-R, Up cursor and Ctrl-?. Ctrl-? could be produced by Backspace or Delete depending on your terminal.

What are you trying to achieve with the -v option in that last binding? You've already selected vi mode. To bind a key in the vi command-mode keymap, use -a .

So what you perhaps want is:

bindkey -a '^?' backward-delete-char

Backspace stopping at the beginning of a line is consistent with actual vi behaviour. Vim behaves more like the following:

bindkey -a '^?' backward-char

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM