I use these 3 editors for programming on linux:
1. vi -- available in all Linux and unix box, used to edit
2. vim -- not in all Linux flavors and it has got default coloring of key words feature, used to edit
3. view --Its used only to view, recommended to use for viewing of system config files, as it should not get edited without your notice.
Following are the basic commands comes handy with these editors
#Open a file for edit
$ vi test -- creates a file if file is not exist in the current directory
$ vim test.cpp -- key words will be in different colors
#Start editing the file
To edit the file press ‘i’ key , then you write your program
#To save the file and exit
After you finished editing the file press “ Esc ctrl+z ” to save file and exit.
Press “Esc ctrl+q!” to exit the file without saving the file.
# To search the word inside a file using Vi or vim
Once you’re inside the file using this command
$vi test
If you want to search word say “sample” inside your file, use this command
Press “Esc /sample” Note: sample is the word to search
To go to next word press “n” to go from top-to-bottom search
To go to next word press “shift n” or “N” to go from bottom-to-top search
# To search and replace the word inside a file using Vi or vim
I am going to give you only the useful commands to do this.
Command is to search word “sample” from top to bottom and replace with “hello” based on your confirmation[y/n].
Press “Esc” then type “ :g/sample/s//hello/gc ”
The command you typed just now will display bottom left of your screen.
This will keep on replacing “sample” with “hello” based on your
Confirmation[y/n].
# To delet the line inside a file using vi or vim
Press “Esc dd” to delete the current line (cursor pointing to).
Press “Esc 2dd” to delete 2 lines from the current line (cursor pointing to).
# To cut the line and paste it in some other place inside a file using vi or vim
Press “Esc dd” to cut the current line (cursor pointing to) and move your cursor to the point where you want to paste then press “p” to paste the line.
# To copy the line and paste it in some other place inside a file using vi or vim
Press “Esc yy” to copy the line (cursor pointing to) and move your cursor to the point where you want to paste then press “p” to paste the line.
Press “Esc 2yy” to copy two line (cursor pointing to) and move your cursor to the point where you want to paste then press “p” to paste the line.
These are the basic some of the commands mainly used to work with vi or vim.
For today this is sufficient, I will add some more based on your feedback.

