Open Source Projects
In vim text editor we can control the cursor and accomplish some cool movements in few key press. So, lets start learning few of the tricks that will help us in moving the cursor in vim easily.
For this tutorial we will open the hello.txt file which contain some text.
$ vim hello.txt
To move the cursor up we can use the up arrow key and k. Similarly to move the cursor down we can use the down arrow key and j.
To move the cursor left we can use the left arrow key and h. Similarly to move the cursor right we use the right arrow key or l.
To move to the last line in a file in vim type G
To move to the first line in a file in vim type 1G
To move to the nth line in a file in vim type nG where n is any integer denoting the line number, i.e., 1 for first line, 2 for second line and so on.
To move to the end of a current line in a file in vim type $
To move to the end of a current line in a file in vim type 0
To move down one page in a file in vim press Ctrl+f
To move down one page in a file in vim press Ctrl+b
To move to the beginning of the next word or punctuation in vim simply type w
To move to the beginning of the previous word or punctuation in vim simply type b
Have fun learning :-)
Copyright © 2014 - 2018 DYclassroom. All rights reserved.
rendered in 0.0555 sec