在Vim的命令模式下导航

Roh*_*hit 55 vi vim text-editor

我是很长时间的emacs用户学习Vim.Emacs允许我使用与任何其他缓冲区相同的导航键盘快捷键在迷你缓冲区(我发布Cx Cs等命令)中导航.例如,即使在迷你缓冲区中,我也可以使用Cf向前导航一个角色.我也可以使用箭头键,但它们太远了.

是否有任何键盘快捷键可以在Vim的命令模式(:)中导航,而不使用箭头键 - 相当于emacs Cf,Cb?谢谢.

Bol*_*wyn 77

添加到Greg Hewgill的答案中,您可以使用q:打开命令行窗口,您可以在其中拥有任何Vim编辑功能.

  • 此外,如果您已经在命令行中并且想要保留已编写的内容并仍然进入命令行窗口,请键入ctrl-F.因此":<CF>"应该完成与"q:"相同的事情.如果它不起作用,则设置"兼容"或者将某个其他键映射到"cedit"选项.请参阅:help q:了解更多详情:) (23认同)
  • 这个命令是我最讨厌的命令之一.现在它是最有用的一个:) (6认同)
  • 每当这种情况意外出现时,我都会恼怒多年。现在我知道它的作用并且我喜欢它! (5认同)
  • 当我学会了关于Vim的一件事,然后你永远不会停止学习一些新的和惊人的功能;-) (2认同)
  • 要设为默认值:`nnoremap : q:i` (2认同)

Jee*_*eet 37

一些来自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.  
Run Code Online (Sandbox Code Playgroud)


Tas*_*sos 23

我在.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>
Run Code Online (Sandbox Code Playgroud)


Gre*_*ill 10

使用默认键绑定,vim不提供命令行编辑的非箭头键导航.但是,请参阅:help cmdline-editing有关如何使用该:cnoremap命令设置备用键绑定的示例.