Vim: Keyboard shortcut to navigate between content in a file

Home Gasner

On Linux, Vim is one of the most powerful and popular editor out there. In this post, I'll show you how to use Vim to quickly navigate between content in a file.

However, the actual sample.txt file has NOT been added yet and if you press : + q and the hit Enter to quit Vim . Since no content has been added to sample.txt this file, Vim automaticaldeleted it.

Go to Beginning of the File

To navigate to the beginning of the file press G + G.

Go to End of the File

To navigate to the end of the file and press Shift + G.

Go to Any Line Number

To navigate to line number n press : + n and hit Enter.

Go to End of Line

To navigate to the End of the current line press Shift + $.

Go to Beginning of Line

To navigate to the End of the current line press O.

Go One Word Forward

To go one word forward press W.

Go n Words Forward

To go n words forward where n is a positive integer press n + W.

Go One Word Backward

To go one word backward press B.

Go n Words Backward

To go n words backward where n is a positive integer press n + B.

Go One Line Forward

To go one Line forward press J.

Go n Line Forward

To go n lines fordward where n is a positive integer press n + J.

Go One Line Backward

To go one Line forward press J.

Go n Line Backward

To go n lines backward where n is a positive integer press n + B.

Reply