Navigating in Vim's Command Mode

前端 未结 4 573
栀梦
栀梦 2021-01-30 02:28

I am a long time emacs user learning Vim. Emacs lets me navigate in the mini-buffer (where I issue commands like C-x C-s) using the same navigation keyboard shortcuts as in any

相关标签:
4条回答
  • 2021-01-30 02:52

    With the default key bindings, vim does not offer non-arrow-key navigation of the command line editing. However, see :help cmdline-editing for an example of how to use the :cnoremap command to set up alternate key bindings.

    0 讨论(0)
  • 2021-01-30 02:56

    Some from the Vim help:

    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.  
    
    0 讨论(0)
  • 2021-01-30 02:58

    Adding to Greg Hewgill's answer, you can use q: to open the command-line window, where you have any Vim editing power at your hand.

    0 讨论(0)
  • 2021-01-30 03:00

    I have these in my .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>
    
    0 讨论(0)
提交回复
热议问题