[英]VIM : word completion in command-line mode?
When replacing a word with another in a buffer in command-line mode, :%s/verylongword/newword/g
, is there a way to word-complete 'verylongword' somewhow from the contents of the buffer ?在命令行模式下在缓冲区中用另一个单词替换一个单词时,
:%s/verylongword/newword/g
,有没有办法从缓冲区的内容中以某种方式完成“verylongword”?
Failing that, is there a way of copy-pasting 'verylongword' from the buffer when typing :%s/verylongword/newword/g
?如果做不到这一点,是否可以在键入
:%s/verylongword/newword/g
时从缓冲区复制粘贴“verylongword”?
While typing the command press Ctrl F to open the command-line window, see :h c_CTRL-f
.键入命令时按Ctrl F打开命令行窗口,请参阅
:h c_CTRL-f
。
In the command-line window you can use all the usual vim commands to edit your command line.在命令行窗口中,您可以使用所有常用的 vim 命令来编辑命令行。
To paste from a buffer in command-line mode press Ctrl R followed by the register name.要在命令行模式下从缓冲区粘贴,请按Ctrl R后跟寄存器名称。
For example press Ctrl R 0 to paste from register 0
to paste the last yanked text.例如,按Ctrl R 0从寄存器
0
粘贴以粘贴上次拉出的文本。
See :h c_CTRL-R
for more info.有关更多信息,请参阅
:h c_CTRL-R
。
Ctrl R also allows the following completions (quoted from vim help): Ctrl R还允许以下补全(引用自 vim 帮助):
CTRL-R CTRL-F c_CTRL-R_CTRL-F c_<C-R>_<C-F>
CTRL-R CTRL-P c_CTRL-R_CTRL-P c_<C-R>_<C-P>
CTRL-R CTRL-W c_CTRL-R_CTRL-W c_<C-R>_<C-W>
CTRL-R CTRL-A c_CTRL-R_CTRL-A c_<C-R>_<C-A>
Insert the object under the cursor:
CTRL-F the Filename under the cursor
CTRL-P the Filename under the cursor, expanded with
'path' as in gf
CTRL-W the Word under the cursor
CTRL-A the WORD under the cursor; see WORD
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.