Like Notepad text editor in Windows operating system we have VIM text editor in various Linux Distributions. Vim text editor is based on vi text editor or Vim is modified version of vi editor which is currently available for all the cross platform including Linux which was written by Bram Moolenaar. Vim’s interface is not based on menus and icons but on commands given in terminal interface. gVim is the GUI based interface of vim text editor and it has menus and toolbar like other text editors but full functionality can be accessed through the command line mode only. Vim text editor works on the basis on three modes they are:-
- Command Mode :-File Editing commands like copy, paste, search, replace, delete etc can be used in command mode.
- Insert Mode :- In this mode you can insert as well as delete the text easily.
- Ex Mode :-Exit mode is used to save the text file and can be also used to quit from the file by using the proper commands.
Following are the commands which are used in VIM text editor for performing the specific tasks.
|#vi abc||Used to create a file|
|Press i||To insert text in a file|
|Press esc||To come back in cmd mode|
|Press esc||Used to come on ex mode|
|Press :w||Used to save the text file (ex mode)|
|Press :q||Used to quit from a file (ex mode)|
|Press :wq||Used to save and quit from a file (ex mode)|
|Press :q!||Used to quit forcefully without saving|
|Press :wq!||Used to quit forcefully and save a file|
|Press :u||Used to undo the last changes|
|Press :/Tom||Used to search a word in a file|
|Press yy||Used to copy a single line (cmd mode)|
|Press p||Used to paste the copied text|
|Press dd||For deletion of a line|
|Press ctrl+r||To redo the changes|
|Press o||Used to insert a line down|
|Press shift+o||Used to insert a line at up|
|Press shift+g||Used to insert a cursor at end of line.|
|Press shift + m||Used to put the cursor at the middle of screen|
|Press shift+h||Used to put the cursor at the top of screen|
|Press yw||Used to copy a single word|
|Press yc||Used to copy a single character|
|Press dw||For deletion of particular word|
|Press 8+dw||Used to delete the number of words|
|Press :67||Used to reach to the particular line number|