This topic was published by Saptarshi Nag and viewed 1936 times since "". The last page revision was "".
- Topics - 6
The one of the most handy tools in Linux is the vi editor. We can write any text,script,code here and run through the command line in the Linux environment (provided the corresponding compiler or interpreter exists in the Linux system).
Now it has the feature of syntax highlighting and many more features mixing those of gedit and vi.
Generally ubuntu does not contain vim but we can download it for free through command line-
[code]sudo apt-get install vim[/code]
And now we can open the editor through command-line-
We can omit filename here and give it after writing something in editor. Now vim editor it has three modes:
- Command mode
- Insert mode
- Last line mode
In command mode we can edit, delete and do many operations. While opening vim it is always in command mode.
In insert mode we can write text on the editor and edit the text.
Last line mode is a part of command mode which is used to save the file and quit the environment of vi editor etc.
Now we move from one mode to one mode through mere keyboard-
[code]command mode -> insert mode= press 'i'
command mode ->last line mode=press ':'
insert mode -> command mode= 'Esc'
insert mode -> last line mode='Esc' then ':'[/code]
Again, for convenience we can go into insert mode by pressing 'o' or 'O'.
[code]'o' -> enters into insert mode and opens a line below cursor
'O'->enters into insert mode and opens a line above cursor[/code]
whereas pressing 'i' enters into insert mode and opens a line on the cursor position.
Now let's write some text there.
- Part 1 - http://dcjtech.info/topic/vim-editor-part-i/
- Part 2 - http://dcjtech.info/topic/vim-editor-part-ii/
- Part 3 - http://dcjtech.info/topic/vim-editor-part-iii/
Check out DCJTech's official Facebook page - http://dcjtech.info/members/saptarshi/