Vim Editor commands

> to open a file in vim
vim  file_name.extension

> navigate
can navigate up and down with key "j" and "k"
or with the up down arrow

> insert or edit the code
press "i" to go the insert mode in the vim

> to write a command for the vim
press "shift + :" and then write the command and hit enter

>commands : following are the some command which are helpful in vim
>> write and quit
: wq
>> to undo the editing
: u
>> only write but remain in the file
: w
 >> to close a tab without making any editing
: q!
>> to close a vim tab
: q
>> to delete the lines containing a particular pattern
: g/pattern/d 
>> search in the file
: \search_word_or_latter
>> opening multiple files in different tabls
vim -p file1.extension file2.extension file3.extension ..
>> if u opened a file and now want a new file to open in a new tab
: tabnew file.txt
if u omit the file name then u will get a new empty tab

To close a tab, use :tabc. To switch to the next tab, use :tabn, and to switch to the previous tab, use :tabp (short for tabnext and tabprevious respectively). You can also jump over tabs by using :tabn 2, which will move to the second next tab. To jump to the first tab, use :tabr (tabrewind) and to jump to the last tab use :tabl (tablast). Finally, :tabs will give you a list of open tabs.

Comments

Popular posts from this blog

QUADRATURE ENCODER

Distance on LCD display using Arduino and HC-SR04 Ultrasonic Sensor

Arduino with Speakers Project #01 a