How to search for continuation line, as detected by c-indent in vim ? ie. the +N cinoption.
1 Answer
Vim's source code has a section dedicated to do this, and it's a lot more complicated than a simple regex. Here's a link to the neovim file that does this.
This leaves you with 2 options:
- Write your own regex to do a "close enough" guess job
If you're using the +N option and can define continuation lines as lines that are indented N spaces more than the line before. You can use a regex to find these lines:
\v^( +)\S.*\n\1 \zs\S \v "very magic mode" so we don't have to escape too many things ^ start of a line ( +) all the spaces, captured in group 1 \S a non-space character .* the rest of this line \n newline \1 the same number of spaces again \zs N extra spaces, then start the match \S a non-space