Tuesday, 8 March 2016

Experiment with Vim

A week ago, I switched to vim. Vim is the most popular editor. It is famous for been faster than other editor and helped me to improve my speed because now my hands rarely need to leave keyboard to perform different tasks.

Vim is a modal editor, its has different modes for inserting, editing, movement, commands, etc. Its three modes are:

- Command Mode
- Insert Mode
- Last Line Mode

Vim can be started by typing to terminal.
- $ vim

For inserting text, type i to enter insert mode and enter text. Type o to enter
insert mode and open line below cursor and O to open line above cursor.

Then I learnt about how to move around a file, when you are in command mode.
 -h moves the cursor one character left.
 -j moves the cursor down the line.
 -k moves the cursor up one line.
 -l moves the cursor one character to the right.
 -0 moves the cursor to the beginning of the line.
 -$ moves the cursor to the end of the line.
 -w move forward one word.
 -b move backward one word.
 -G move to the end of the file.
 -gg move to the beginning of the file.

Next I stepped to cut, copy, paste commands, practiced them and believe me they were easy.
  -e   edit some text at current cursor position
  -r   replace to with some new character
  -x,d delete a character
  -dw  delete a word
  -y   copy
  -p   paste
and many more......

  see line number-       :set nu
  go to particular line- :<line number>
  turn off line number-  :set nu!

Then I learnt about how to move around the files
 -ctrl+F -> Forward one screen
 -ctrl+B -> Scroll backward
 -ctrl+D -> Forward halfscreen
 -ctrl+U -> Backward halfscreen

Also I came through file splitting in vim
 :split -for horizontal split
 :vsplit-for vertical split

Now I'm stepping towards python which will help me to get started with programming.

No comments:

Post a Comment