Vim 的一大优势是 object-select ,提供对单词、段落和各种分隔符内的内容的快速操作。
例如,
vi{
将选择一对 {} 大括号内的所有内容。
是否有任何等效的功能来选择 here document或继承人:
<<<HTML
....
....
HTML;
基于
ErichBSchulz 的回答我想出了以下的 heredoc 内部选择:
nmap <F6> ?<<<<CR>w*kV?<<<<CR>j
?<<<<CR>w " find beginning tag (after <<<)
*k " find matching end tag and go up 1 line
V " enter visual mode
?<<<<CR>j " find beginning tag and go down 1 line
最佳答案
为了选择heredoc,我通常将光标放在第一行,在heredoc标识符上,然后按V*
V 将开始行选择, * 将开始搜索,转到标识符的下一个匹配项,即heredoc 的结尾...
关于vim - 是否可以使用vim对象选择heredoc或 "here document"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2343906/