I recently switched to linux OS and I started using vim for text editing. It seems strange in the beginning because people are not used with using so many keyboard commands for text editing. The good news is things are not that complicated as keyboard commands get more intuitive as one practices a little bit.
I decided to post a list of common used commands such that anybody can begin using vim by having this list close by.
Basic shortcuts that must be memorised - it will help remembering the rest of the commands:
$ - end^ - start
i - insert
a - append
d - cut
p - paste
y - yanc (copy)
Note:
- the enumerated vim commands are used in COMMAND mode !
- commands are case sensitive
VIM commands:
Cursor handling:
Move to the bol / eol: $ / ^
Move to the beginning of next word: W ( w punctuation sensitive )
Move to the end of next word: E ( e punctuation sensitive )
Move to the beginning of prev word: B ( b punctuation sensitive )
Go to start / end of file: gg / shift+g
Copy / Paste:
Copy a line: yy
Cut a line: dd
Paste a line after / before the current line: p / P
Copy several lines: shift+V y
Cut several lines: shift+V d
Copy / Paste from clipboard
Paste from OS clipboard: "+p
Copy entire file to OS clipboard: :%y+
Undo: U
Text insertion:
Insert text before / after the cursor: i / a
Insert text at the bol / eol: I / A
Open blank line below / above the cursor o / O
Text deletions:
delete character at / after cursor x / X
delete n characters starting at cursor nx
delete 1 word: dw
delete current line dd
delete next n lines(including current) ndd
delete from cursor to bol / eol d^ / d$
Text replacement and substitution
Replace letter r[new letter]
Substitute a letter with several: s[letters] ESC
Substitute n letters with several: ns[letters] ESC
Change rest of word: cw[word] ESC
Change n words: ncw[text]
Replace all characters in line cc
Replace remaining chars in line from cursor C
Short Legend:
bol beginning of line
eol end of line
chars characters
Enjoy!
Niciun comentariu:
Trimiteți un comentariu