Vi
holds the distinction of being a very powerful text editor when it
comes to Linux systems. The fact that it is applicable even in the case
of embedded systems makes it an instant hit. It is indeed lightening
quick in comparison to many other text editors out there. Learning its
key bindings is therefore a necessity in order to bring out the best of
it! |
Mode Switching
1. i: Enter insert mode
2. Escape: Leave insert mode. Also ensures if you’re in command mode.
Moving the Cursor
3. h: Move cursor left
4. j: Move cursor down
5. k: Move cursor up
6. l: Move cursor right
7. /: / followed by some text you want to find, then Enter brings the cursor to the location of the text in the file
8. ?: Like /, but searches backwards
9. f: f followed by any character to moves the cursor to the next occurrence of the character on the current line
10. F: Like f, but searches backwards
11. %: Jump between the nearest (), [], or {} characters on the line
12. H: Move cursor to highest line in file
13. M: Move cursor to middle line in file
14. L: Move cursor to lowest line in file
15. #G: go to that line in the file
16. w: Move forward a word
17. #w: Move forward a number of words
18. b: Move back a word
19. #b: Move back a number of words
20. e: Move to end of the current word
Copying and Pasting
21. v: select a section of text
22. y: Copy the selected text
23. p: Paste at cursor
24. x: Cuts the selected text
25. r: Type r and then type another character to replace the character under the cursor
Combining Commands
26. dw: Deletes the next word
27. db: Deletes the previous word
28. de: Deletes to the end of the current word
29. dL: Deletes all text below the cursor in the file
30. d/unicorn: After pressing Enter, deletes all text between the cursor and the word “unicorn” in the current file
31. dd: Deletes an entire line
Repeat and Undo
32. u: Undo
33. .: repeats the last full command
Source: How-To Geek
(EFYTIMES News Network)
No comments:
Post a Comment