如何在Mac上的插入模式下启用vim箭头键?

xqkwcwgp  于 2022-11-11  发布在  Mac
关注(0)|答案(1)|浏览(222)

在Mac以外的环境中使用vim后,我发现自己在插入模式下无法使用箭头键进行导航。我知道我必须更改的是~/.vimrc,但我不知道它的语法:

inoremap  <Up>     <NOP>
inoremap  <Down>   <NOP>
inoremap  <Left>   <NOP>
inoremap  <Right>  <NOP>
noremap   <Up>     <NOP>
noremap   <Down>   <NOP>
noremap   <Left>   <NOP>
noremap   <Right>  <NOP>

我知道键是^[[A^[[B^[[C^[[D,分别表示上、下、左和右。语法是imap <Down> <^[[B>吗?在我确定之前,我有点粗略地修改它,因为我不希望vim搞砸。

osh3o9ms

osh3o9ms1#

The arrow keys work out of the box so you don't have to change anything to the default setup.
If you are considering adding those lines or variations of them to your vimrc , then you can stop right now as the original form is utterly pointless and the way you are trying to change them is useless.
If you already have mindlessly copied them from somewhere or they are part of someone else's config you took for your own, then remove them as they are probably the reason why your arrow keys don't work.

相关问题