How to install and use vim editor in ubuntu

Just try this 

$  sudo apt-get install vim

$  vim <file name>


Exit Commands

:wq Write file to disk and quit the editor

:q! Quit (no warning)

:q Quit (a warning is printed if a modified file has not been saved)


Opening a New File
 

Step 1 type vim filename (create a file named filename)

Step 2 type i ( switch to insert mode)

Step 3 enter text (enter your program)

Step 4 hit Esc key (switch back to command mode)

Step 5 type :wq (write file and exit vim)


Editing the Existing File


Step 1 type vim filename (edit the existing file named filename)

Step 2 move around the file using h/j/k/l key or any appropriate command

                               h Moves the cursor one character to the left

                               l Moves the cursor one character to the right

                               k Moves the cursor up one line

                               j Moves the cursor down one line



Step 3 edit required text (replace or delete or insert)

Step 4 hit Esc key (exit from insert mode if you insert or replace text)

Step 5 type :wq

Comments

Popular posts from this blog

AttributeError: Got AttributeError when attempting to get a value for field `abc` on serializer `PfleSerializer`. The serializer field might be named incorrectly and not match any attribute or key on the `QuerySet` instance. Original exception text was: 'QuerySet' object has no attribute 'abc'.

ImportError: No module named regex