Using normal-mode motions in command-line mode in Vim

前端 未结 6 877
旧巷少年郎
旧巷少年郎 2021-01-30 02:07

Is modal editing possible in command-line mode?

Some examples:

  • After writing !ls ~/foo/bar I want to db to delete bar
6条回答
  •  旧时难觅i
    2021-01-30 02:53

    Built-in hotkeys for movement and editing in Command-line mode

            abandon command-line without executing it
    CTRL-C       abandon command-line without executing it
    
    CTRL-B       cursor to begin of command-line
    CTRL-E       cursor to end   of command-line
    
    CTRL-F       opens the command-line window (unless a different key is specified in 'cedit')
    
    CTRL-H       delete the character  in front of the cursor (same as )
    CTRL-W       delete the word       in front of the cursor
    CTRL-U       delete all characters in front of the cursor
    
    CTRL-P       recall previous command-line from history (that matches pattern in front of the cursor)
    CTRL-N       recall next     command-line from history (that matches pattern in front of the cursor)
             recall previous command-line from history (that matches pattern in front of the cursor)
           recall next     command-line from history (that matches pattern in front of the cursor)
           recall previous command-line from history
         recall next     command-line from history
         recall previous command-line from history
       recall next     command-line from history
    
         cursor one word left
         cursor one word left
        cursor one word right
        cursor one word right
    
      cursor at mouse click
    

    Reference: :help ex-edit-index

    (Sorry for the overlap with older answers. Hopefully this complete°, structured overview is useful nevertheless.)
    ° as of 2014 – new keyboard shortcuts may have been added since then

提交回复
热议问题