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

前端 未结 6 826
旧巷少年郎
旧巷少年郎 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条回答
  •  爱一瞬间的悲伤
    2021-01-30 02:37

    Search for :help cmdline-editingin Vim.

    It will give a list of shortcut working in command line mode.

    An extract for your current problem :

    CTRL-B or                     *c_CTRL-B* *c_*
        cursor to beginning of command-line
    CTRL-E or                      *c_CTRL-E* *c_*
        cursor to end of command-line
     or                     *c_*
        cursor one WORD left
                            *c_*
     or                   *c_*
        cursor one WORD right
    

    or use q: as mentioned by Rene which allows you to edit previous typed commands in different modes.

提交回复
热议问题