Reputation: 1511
I mainly use curly brackets { }
to move around in vim when I'm working on something. However, sometimes it will skip too many lines. I assume this is because there is no paragraph break, because if I go put new lines in, I can skip to those. This is mainly an issue when working on HTML that I didn't type or after pasting in some lines. It is very annoying when it skips too many lines for me to see what's between where I started and where I ended.
I hope I've described this well enough for some of you to know what I'm talking about.
Is there a remedy for this other than going through using j
and adding line breaks? It's a huge hassle and blow to productivity when having to do this.
EDIT: I wanted to mention I only use the curly brackets to get close to pieces I need to work on. After I am close, I use other means.
Upvotes: 0
Views: 162
Reputation: 10623
That sounds like an issue where some lines contain only whitespace, and so don't get counted as paragraph breaks, even though they look like they should. Since it's only an issue in a few situations, I'd suggest just running a substitution to clean up those lines whenever you notice that it's a problem. For example:
%s/^\s*$//g
To translate what the regex means:
^
match the start of a line\s*
match any number of whitespace characters$
match the end of the lineSo it matches anything that contains only whitespace between the start and end of the line, and replaces it with nothing (note that replacing $
does not overwrite the newline character).
Upvotes: 4