vi editor is a very powerful text editor
that comes pre-installed on all Linux OS.
vim is variant of vi editor, basically an
improved version.
Practically, it is more error tolerant than vi.
There are two modes –
Command mode, which is the default mode.
You basically scroll through the file content or enter commands.
h moves the cursor to the left,
l moves it to the right,
k to move up, and
j to move down
dd will delete current line
:w to save (write) the changes made
:q will exit the editor
:q! will exit the editor
without saving changes
Text input mode. You enter this mode by
pressing the Insert key. There are some basic guidelines to note -
don’t attempt to scroll or change the
cursor position in this mode, position the cursor where you want to add extra
text before changing to the text input mode. The only exception is when you are
using vim.
To change to this mode pressing -
a will append, move the cursor one
position to the right before switching to the inserting mode
i will insert
o will insert a blank line under the
current cursor position and move the cursor to that line
Vim is better, just not as pre-installed
on Linux OSs as Vi.
Run vimtutor to start a recommended 30 minutes
tutorial on using vim.
0 comments:
Post a Comment