vim - 是否可以使用vim对象选择heredoc或 "here document"?

标签 vim keyboard-shortcuts heredoc

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/

相关文章:

php - if/else 与 Heredoc 的行为不符合预期

linux - Bash 尝试执行 heredoc 中的命令

bash - 使用 heredoc 重定向命令输出

windows - 在 Windows 上运行 vim 会留下不可写的交换文件

当行的第一个字符是尖锐的# 字符时,Vim 编辑器缩进问题

javascript - 使用 jquery 捕获按键

java - 如何引用 Java 的 KeyStroke.getKeyStroke 的 String 版本中的 mac 命令键?

vim - 在 Vim 中卸载插件

perl - 如何编写 vim 脚本以在缓冲区上运行 perltidy?

visual-studio - "quick fix"的 Visual Studio 快捷方式