我是一个长期使用Emacs的用户,正在学习Vim。在Emacs中,我可以使用与其他缓冲区相同的导航键盘快捷方式来浏览迷你缓冲区(用于发出诸如C-x C-s之类的命令)。例如,即使在迷你缓冲区中,我也可以使用C-f向前移动一个字符。我也可以使用箭头键,但它们离得太远了。
是否有任何键盘快捷键可在Vim命令模式(:)中进行导航,而不使用箭头键 - 相当于Emacs的C-f、C-b?谢谢。
我是一个长期使用Emacs的用户,正在学习Vim。在Emacs中,我可以使用与其他缓冲区相同的导航键盘快捷方式来浏览迷你缓冲区(用于发出诸如C-x C-s之类的命令)。例如,即使在迷你缓冲区中,我也可以使用C-f向前移动一个字符。我也可以使用箭头键,但它们离得太远了。
是否有任何键盘快捷键可在Vim命令模式(:)中进行导航,而不使用箭头键 - 相当于Emacs的C-f、C-b?谢谢。
除了 Greg Hewgill 的回答,你还可以使用 q:
打开命令行窗口,在此处你可以使用 Vim 的编辑功能。
nnoremap : q:i
- Rudolf Adamkovič以下是来自 Vim 帮助文档中的一些内容:
CTRL-B or <Home>
cursor to beginning of command-line
CTRL-E or <End>
cursor to end of command-line
CTRL-H
<BS> Delete the character in front of the cursor (see |:fixdel| if
your <BS> key does not do what you want).
<Del> Delete the character under the cursor (at end of line:
character before the cursor).
CTRL-W Delete the |word| before the cursor. This depends on the
'iskeyword' option.
CTRL-U Remove all characters between the cursor position and
the beginning of the line.
我在我的.vimrc文件中有以下内容:
cnoremap <C-a> <Home>
cnoremap <C-e> <End>
cnoremap <C-p> <Up>
cnoremap <C-n> <Down>
cnoremap <C-b> <Left>
cnoremap <C-f> <Right>
cnoremap <M-b> <S-Left>
cnoremap <M-f> <S-Right>
<Meta>
问题的用户,请参见https://dev59.com/E2s05IYBdhLWcg3wB9af#27206531。 - cdosbornC-f
,因为它已经被有用地绑定到“在缓冲区中编辑当前行的命令模式”。在Vim的命令模式中,^b
已经绑定了(类似于Emacs的)<Home>
,而^a
与screen(1)
(以及许多人的tmux(1)
)冲突。 - Ben Fowler使用默认的键位绑定,vim不提供除箭头键以外的命令行编辑导航。但是,请参考:help cmdline-editing
了解如何使用:cnoremap
命令设置替代键位。