One of Vim's great strengths is object-select, offering quick manipulation of content inside words, paragraphs and assorted delimiters.
For example,
vi{
will select everything inside a pair of {} braces.
Is there any equivalent functionality for selecting a here document or heredoc:
<<<HTML
....
....
HTML;
Based on ErichBSchulz's answer I came up with the following for an heredoc inner select:
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
For selecting heredoc's I usually place the cursor at the first line, over the heredoc identifier and press V*
V will start a line selection, and * will start a search, going to the next match of the identifier, the end of the heredoc...
A <<''
heredoc terminated by an empty line is easy, if you're already at the start (?<<^M^M
): v}
selects from here until the empty line.
Otherwise, in your example the best I can think of is v/^HTML
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With