Normal mode )
}
and (
{
navigate paragraphs and lines but they don't skip blank lines. (They land on them.)
This is obviously the preferable behavior when writing code, but when writing "normal" text it's infuriating. I would like to jump to the beginning of the next sentence/paragraph respectively, not the empty lines I leave between them for readability while editing the text.
Perhaps a solution would be: detecting current position after the initial movement, and while current position = white-space, do a w
normal motion. Regrettably, I don't know how to string these commands in a vim.keymap.set
, even if it is the right way to go about this.
This is all in Neovim. (Hence the vim.keymap.set
) That being said, both the original behavior and the answer should be vim/neovim agnostic (now and in the future,) and hopefully serve both.
A more detailed explanation:
With the cursor at amet, a }
or a )
followed by another )
will land me at the blank line between consequat and Duis. Desired behavior is to land on Duis. Similar behavior for {
and (
if starting from Ut Excepteur. Desired behavior is for it also to skip (n) number of blank lines: if there were three or ten blank lines between the paragraphs they should be skipped just the same as one blank line.
To explain the purpose of this, I add blank lines for readability while editing, but it messes with the navigation of the text since neovim interprets blanks lines as "Oh, you are probably writing code and those blank lines are important landmarks for you, let me land you there.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Example text for Vivian (for context, go through the comments.) :
<Empty first line>
(1)This is a line without quotes.
(2)”This is a line with quotes,” she said. (3)”This is a line with quotes.”
”This is a line with quotes,” he said.
”This is a line with quotes.”
”This is another line with quotes.”
”This is a line with quotes.” This is a line without quotes. (4)”This is a line with quotes."
This is a line without quotes.<EOF>
Legend: Numbers in parenthesis and <> are not part of the text. I've inserted them to simplify explaining motions. When descending, it jumps from 1 to 2 to 3, then all the way to 4. When ascending, It goes 4 3 2 1. In neither case does it acknowledge the final line.