Navigation in Vim
Vim, the more advanced form of the earlier Vi editor(found in the older versions) is one of the most powerful text editors in the Linux Platform. Slight alterations in the configuration files can be of the upmost importance and can change the whole setting of the system therefore learning the basics of navigation of this text editor is a minimal prerequisite for any Linux novice.
Everything in Linux is a file, from all the software to any hardware which makes the vim text editor a very powerful tool. Be it starting an FTP server or Samba sharing almost everything in Linux can be done with the slightest of modifications, making it compulsory for anyone and almost everyone to have a strong command over the navigation of the text editor. Here I have discussed some of the most basic and necessary problems that I have come up across while using the Vim editor.
Note that the vim editor works in 2 basic modes, the command mode and the insert mode (entered by pressing the character ‘i’). Here all the commands are executed in the command mode as the name suggests. Also the magic key for entering from the text mode to the command mode is Esc.
1. Searching for a word
||/word (e.g. /boot)|
||?word (e.g. ?boot)|
2. To move to the bottom of the page: G or GG in some cases
3. To move to the top of the page: gg
4. Altering words using a: For instance if you want to change the word boot to booot, then go to the last o in boot, press a and then enter the character o.
5. Appending to the end of the line: A
6. Deleting a character under the cursor: x
7. Going to the end of the current line: $
8. Going to the beginning of the current line: 0
9. To move to a particular line number: :line number ( e.g. To go to the fifth line of the editor: :5 )