I am learning vi , partly because my job demands it and partly because it is a cool editor.
Things i knew already:
To open a text file in vi type:
$ vi mytextfile
This is the most important part you’ve to get past as a beginner:
In your normal text editor , you can always write new text or delete or change text in the file you have opened.
In vi , you can be in writing mode (normal-text-editor like behavior , its called insert-mode) , and this is NOT the mode you’ll be in once you’ve opened a file. When in insert mode --Insert-- will be displayed at the bottom.
To get into insert mode press i or a , now you can edit text.
For saving the file , hit the escape key to escape from insert-mode. Now type :wq (yes, colon w and q) to write the file and quit. For quitting without saving hit :q!.
Things i learned yesterday:
To delete an entire line of text get out of insert mode , move your cursor to the line you want using the arrow keys or the h j k l keys (BTW j and k are valid shortcuts for the same purpose in gmail and twitter) , now hit dd and the line is gone!
Things i learned today:
I had to find some text in the file i opened. First get out of insert-mode by hitting ESC , then type / (thats a slash) followed by the word to find. Hit enter to find the first occurrence and then hit n to move to the next occurrence.
i -- insert-mode
:wq -- write and quit
:q! -- quit without writing
/word -- search for word
n -- find next occurrence of word
dd -- delete a line of text
u -- undo
Tomorrow i need to know more about copying and pasting. Heard it is powerful.
So i’ve got started , hoping to learn more soon.
:wq