Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the most efficient way to move to the end of a paragraph/sentence in Vim?

Tags:

vim

vi

I write prose in Vim in markdown, and many times I want to jump to the end of text-objects to edit them. Some text objects are easy to navigate: words and WORDS are easy (using e and E), but sentences and paragraphs are a little less efficient. I use }gE and )gE to jump to the ends of paragraphs and sentences (respectively).

Before I bind )gE and }gE to a single key, is there another (more efficient) way to get to the end of a sentence or paragraph in Vim?

like image 462
keyofnight Avatar asked Dec 01 '18 23:12

keyofnight


People also ask

How do I jump to the end of a line in vim?

Press ^ to move the cursor to the start of the current line. Press $ to move the cursor to the end of the current line.


1 Answers

I can't say for the end of paragraph, but you can use $ to go to the end of line. And while we're on the topic, here are two more commands for navigating sentences:

0 to go to the start of the line

^ to go to the first non-white character in the line

def sample():
&   print('sample string')

To properly explain the difference between the two, let's say you're in an indented code block, and you want to go to the very first position in the line (marked as & in the sample code), but if you wanted to go to the first non-white character, in this case, p, then you would use ^

like image 154
MetaStag Avatar answered Oct 06 '22 03:10

MetaStag