Background:
- Vim
:help
states that a section begins after a form-feed (^L
) in the first column [*]. - In normal mode ]] or [[ can be used to navigate to the next or previous section (respectively).
- However, it also stops at the next/previous
{
in the first column.
[*] I am ignoring that a section also starts at some troff macros
My problem:
- I want to navigate between sections only, i.e., I want motions like ]] and [[ that only stop at the beginning of a section.
Questions:
- Is there already a built-in motion that solves my problem?
- Sure, I could just map some key combination to
/^<C-L><CR>
), but is there a better way? In particular, I don't like the idea of it messing with my search history.
PS:
- To be honest, my real problem is that sometimes it is easier for me (and gcc!) to work with one HUGE file instead of splitting into several translation units. So I divide it into sections and I want to jump fast between sections without stopping at each function block. If you have a better approach, I would appreciate a suggestion as a comment.
- Even though I am mainly editing C files, I guess I wouldn't care (that much) if a solution overrides the default behavior of [[ and ]]. Not overriding would be a plus, though.