Jer*_*lim 98
默认情况下,您可以在Vim命令行上按Control + f
(或以其他方式查看set cedit
),这将打开命令行窗口,您可以使用常规模式Vim编辑键编辑命令.
Enter
将运行该命令或Control + c
将返回标准命令行.
因此,在您的具体示例中,您可以按下Control + f
Vim命令行然后db
它会执行您想要的操作.
当我不得不做更复杂的编辑命令时,我使用上面的方法,因为我对Vim编辑键的熟悉程度比我对替代程序更熟悉.我还发现普通模式的vim键更强大.
有关:help c_ctrl-f
更多信息,请参阅
Ren*_*ger 25
在vim的命令行模式下:
<ctrl-w>
删除一个单词
在正常模式下:
q:
转到命令历史记录(可以使用vim命令编辑)
看到:help cmdline-editing
并:help cmdline-window
获得更多命令.
Aar*_*oma 12
<Esc> 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 <Backspace>)
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)
<Up> recall previous command-line from history (that matches pattern in front of the cursor)
<Down> recall next command-line from history (that matches pattern in front of the cursor)
<S-Up> recall previous command-line from history
<S-Down> recall next command-line from history
<PageUp> recall previous command-line from history
<PageDown> recall next command-line from history
<S-Left> cursor one word left
<C-Left> cursor one word left
<S-Right> cursor one word right
<C-Right> cursor one word right
<LeftMouse> cursor at mouse click
Run Code Online (Sandbox Code Playgroud)
(很抱歉与旧答案重叠.希望这个完整的结构概述仍然有用.)
°截至2014年 - 从那时起可能添加了新的键盘快捷键
:help cmdline-editing
在Vim中搜索.
它将提供在命令行模式下工作的快捷方式列表.
您当前问题的摘录:
CTRL-B or <Home> *c_CTRL-B* *c_<Home>*
cursor to beginning of command-line
CTRL-E or <End> *c_CTRL-E* *c_<End>*
cursor to end of command-line
<S-Left> or <C-Left> *c_<C-Left>*
cursor one WORD left
*c_<S-Right>*
<S-Right> or <C-Right> *c_<C-Right>*
cursor one WORD right
Run Code Online (Sandbox Code Playgroud)
或使用q:
Rene提到的,允许您在不同模式下编辑以前键入的命令.
emacscommandline 通过添加 Emacs 风格的映射(如在 Bash shell 中)使命令行模式的行为更像 Unix 命令行。一些映射只是映射现有的 vim 命令,但其余的实现了本机不可用的功能。
conomode.vim在命令行之上实现了一种普通模式(“Cmdline-Normal 模式”)。目的类似于 cmdline-window (q:),但导航和编辑可以就地完成。当然 cmdline-window 更强大。
Conomode 并没有取代 Vim 的原生 emacs 风格的命令行编辑,它只是增加了一个键:CTRL-O(见下文)。
- 用 c_ 输入(在命令行模式下按 CTRL-O)
- 模式指示符是一个冒号“:”,随着光标移动,隐藏在它下面的字符
- 使用 I、i、a、A、: 或任何未映射的键(然后执行或插入自身)退出到 Cmdline 模式,或等待 60 秒。
- 使用 Esc 退出普通模式
(诚然,我不明白这个插件的意义,因为不是点击Ctrl+O进入它的 Cono 模式,你可以用Ctrl+快速弹出命令行窗口F。)
可能还有其他插件。? https://www.google.com/webhp?q=command-line+editing+plugin+vim
您可以定义自己的映射,而不是使用成熟的插件或作为它的补充。? 请参阅我的另一个答案。
归档时间: |
|
查看次数: |
11963 次 |
最近记录: |