WELCOME EVERYONE! Below, I will be sharing a tutorial on how to navigate a text editor called vim. Let's begin!
Vim Navigation Tutorial
Basics of navigation
Vim is a text editor that requires navigation different from that of a normal navigation. When in command mode in vim, users cannot use the arrow keys to go up, left, right, and down. There are special keys and various other shortcuts that will come in handy when using this text editor. The following bullets will hopefully be an easy and helpful way for you to understand how to navigate vim.
BEFORE CONTINUING, MAKE SURE YOU ARE IN COMMAND MODE BY HITTING ESC.
To enter insert mode, hit i.
Moving up, down, left, and right
· To move up, use the k key
· To move down, use the j key
· To move left, use the h key
· To move right, use the l key
Using the above method is very slow, so here are some shortcuts to make it faster for you to navigate vim.
Line, Word, Paragraph, and Search Navigation Shortcuts
o LINE NAVIGATIONS
· If you know how many lines or letters you want to skip, simply type in that number of spaces and then the key which indicates the direction in which you want to go
o Example: “6l” means 6 spaces to the right
· To go to the beginning of the line, type in 0
· To go to the first non-blank character of the line, type in ^
· To go to the end of the current line, type in $
· To go to the last non-blank character of the line, type in g_
· To go to the Nth percentage line of the file, type in N%
· To go to the Nth line of the file, type in NG
· To go to the Nth line of the file after opening it, type in
Vim +N filename
· To go to the particular pattern’s line where it first occurs inside the file, type in
Vim +/pattern filename
· To go to the particular pattern’s line where it last occurs inside the file, type in
Vim +?pattern filename
o WORD NAVIGATIONS
· To go to the end of a word, type in e
· To go backward to the beginning of the current word, type in b
· To go forward to the beginning of a word, type in w
· By attaching numbers before b and w, you can go back or forward that many words
o Example: 3w takes you back 3 words
Not only are there shortcuts for navigating words and lines, but there are also shortcuts for navigating paragraphs.
o PARAGRAPH NAVIGATIONS
· To go the beginning of the current paragraph, type in {
· To go the end of the current paragraph, type in }
· By pressing either of these more than once, you can go to previous paragraphs or go forward to paragraphs
In addition to paragraph navigations, search navigations are essential as well.
o SEARCH NAVIGATIONS
· To search for a pattern, type in /I and you will be taken to the next occurrence
· To search for a pattern, type in?i and you will be taken to the previous occurrence
· To go to the next occurrence of the word that you are on, type in *
· To go to the previous occurrence of the word that you are on, type in #
Feel free to ask any questions or make any suggestions.
Also, check out these other tutorials on vim!
Vim inserting: http://tinaluo29.wordpress.com/
Vim copy/paste: http://amhrla.wordpress.com/
Vim command: http://adventuresandwhatnot.wordpress.com/
Vim record: http://wondersoflife1.blogspot.com/
Vim Buffer: http://hauntedrain.wordpress.com/
Until next time... check back -- there is more to come!