The acronym for Vim is Vi IMproved. Written by Bram Moolenaar, it is a free and open-source text editor. It was first released for UNIX variants in 1991, and its primary purpose was to develop the Vi editor, which was released back in 1976.
➔ Install vim editor.
➔ Open up a file in vim editor
➔ Hit i to enter into insert mode
=> type few lines => hit Esc
=> type :wq
=> Enter.
➔ Read file with cat command.
VI Visual display editor
VIM Visual display editor improved
This is command mode editor for files. Other editors in Linux are emacs, gedit vi editor is most popular
It has 3 modes:
Command Mode
Insert mode (edit mode)
extended command mode
Note: When you open the vim editor, it will be in the command mode by default.
Command Mode:
gg – To go to the beginning of the page
G – To go to end of the page
w – To move the cursor forward, word by word
b – To move the cursor backward, word by word
nw – To move the cursor forward to n words (SW)
nb – To move the cursor backward to n words {SB)
u – To undo last change (word)
u – To undo the previous changes (entire line)
Ctrl+R – To redo the changes
VY – To copy a line
nyy – To copy n lines (Syy or 4yy)
P – To paste line below the cursor position
p – To paste line above the cursor position
dw – To delete the word letter by letter {like Backspace}
X – To delete the world letter by letter (like DEL Key)
dd – To delete entire line
ndd – To delete n no. of lines from cursor position{Sdd)
I – To search a word in the file
Extended Mode: ( Colon Mode)
Extended Mode is used for save and quit or save without quit using “Esc” Key with”:”
Esc+:w – To Save the changes
Esc+:q – To quit (Without saving)
Esc+:wq – To save and quit
Esc+:w! – To save forceful
Esc+wq! – To save and quit forcefully
Esc+:x – To save and quit
Esc+:X – To give passwd or d to the file and remove password
Esc+:20(n) – To go to line no 20 or n
Esc+: se nu – To set the line numbers to the file
Esc+:se nonu – To remove a set line number
Is command options