Quantcast
Viewing latest article 6
Browse Latest Browse All 15

VIM tips & tricks

VIM

VIM – Visual Interface Improved editor.

It is the improvements in VI editor. It’s used for text editing, scripting, In VIM, there are three modes of operations – Insert Mode, Command Mode, Extended Mode

At Insert Mode -

i-Inserts text at current cursor position.

I- Inserts text at beginning of the line.

a- Append text after current cursor position.

o- Inserts line below the current cursor position.

O- Inserts line above the current cursor position.

r- Replace a single character at current cursor position.

At Extended Command Mode -

:q – quit without saving

:q! – quit forcefully without saving

:w – save

:wq – save & quit

:wq! – save & quit forcefully

Image may be NSFW.
Clik here to view.
:x
– save & quit

:sh – provides temporary shell
:se nu – setting line numbers

:se nonu – removing line numbers

:84(enter) – goes to line number 84

Cursor navigation commands -

w – Cursor moves in forward direction word to word

b – Cursor moves in backward direction word to word

e – Cursor moves in forward end of word to word

$ – end of line

0 – beginning of line

[ - beginning of sentence

] – ending of sentence

{ – beginning of paragraph

} – ending of paragraph

[[ - beginning of file

]] – ending of file

Delete / Copy / Paste / Undo in Command Mode -

dd – deletes a line

2dd – deletes 2 lines

dw – deletes a word

5dw – deletes 5 word

3d) – deletes 3 lines

4d} – deletes 4 paragraphs

x – deletes a single character

yy – copy a line

2yy – copies 2 lines

3yw – copies 3 words

5y} – copies 5 paragraphs

p – put ( deleted OR copied text )

u – undo ( can undo 1000 times )

Ctrl + r – Redo

G – Moves cursor to last line of file

5G – Moves cursor to 5th line of file

shift + zz – save & quit

/<find word> – locate word

Ctrl + u – Scrolling up

Ctrl + d – Scrolling down



The post VIM tips & tricks appeared first on DIG into CMS.


Viewing latest article 6
Browse Latest Browse All 15

Trending Articles