views:

96

answers:

3

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;
+4  A: 

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...

CMS
+2  A: 

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.

ephemient
+2  A: 

There's this plugin that let's you define your own text objects.

http://www.vim.org/scripts/script.php?script_id=2100

I imagine it would be nice to define one so you could say 'yih' (yank in heredoc) so you don't have to explicitly go to the start.

Note I haven't fooled around with this myself.

If you just want a visual select you could.

 nnoremap <leader>ih ?HTML<cr>V/HTML<cr>
michael