Jump to some specific line in the vi editor
You can find the line by searching for some unique part of it with /
Press esc and type:
/printf
and the cursor will jump to the first instance of printf
. press n
to go to the next match until you reach the line you want. To move to the end in normal mode, type
$
To jump to the end and change to insert mode, type:
A
(shift+A)
You can also press the end key which will put the cursor to the end of the line.
To go to a specific line like line 44 press esc then
:44
Here are some basic vim commands which will help you accomplish some of the basic tasks. Try this in normal mode not in insert mode.
e Move to the end of a word.
w Move forward to the beginning of a word.
3w Move forward three words.
W Move forward a WORD (any non-whitespace characters).
b Move backward to the beginning of a word.
3b Move backward three words.
$ Move to the end of the line.
0 Move to the beginning of the line.
If you are new to vim I recommend you to complete the vimtutor. From terminal type vimtutor . Finish it so that you will be confident in editng using vim.