Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim select paragraph -- how to redefine paragraph boundaries?

Tags:

vim

In vim, vip selects "inner paragraph" :help v_ip, however it is of limited use.

vim paragraph boundary is hard coded, a paragraph is separated by 2 or more blank lines. :help paragraph

Some archaic marcos like .IP, also seem to be supported as paragraph separators, but it is all hard coded.

I want to specify my own paragraph separators to easily select paragraphs of text in vim.

Like perl in paragraph mode using an regexp splitter.

I tried setting paragraphs to be delimited by blank lines or braces: :set paragraph+={ cpoptions+={ but does NOT work as documented, braces are ignored by 'vip' selection command.

The solution I want should work for all paragraphs commands like vip, vap, dip, dap, {,}.

like image 362
mosh Avatar asked Oct 14 '10 19:10

mosh


1 Answers

Note how you can map operators, so you won't have to remap vip or vap (you could map aH to your movement operation - and all of the following work magically using your selections:

 daH
 vaHy
 d2aH

etc

like image 117
sehe Avatar answered Oct 09 '22 11:10

sehe