Most important vim editor commands in ubuntu

There are two modes in Vim Editor Command mode and Insert mode.By default when we open a new file we are in command mode.

So to go from command mode to insert mode we enter i

and to go insert  mode to command mode we use ESC

for eg.

Open a new file

(1) type vim test (creates a file named test)

(2) type i ( switch to insert mode)

(3) enter text (any text)

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

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

Now these are the basic commands to work in vim.There are some other commands also.So first we need to enter into command mode that we can do by hitting ESC key and then.

To Save text                                :w

Quit                                              :q

Quit  without saving                  :q!

Search                                        :/SEARCH_TEXT

Continue  Search                      :n

Line number                             :set nu

Copy                                         :5yy(it will copy  5 lines starting from cursor)

Paste                                         :p(will paste 5 lines that  we copied earliar)

Delete                                       :dd (will delete current line)


About Kapil Chugh

In love with PHP and tweaking WordPress. Hungry for Open Source and new technologies. Honest. God-fearing. Happiest when solving problems.
This entry was posted in Ubuntu and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s