Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
docs:vim:commands [2007/12/19 22:06] – billh | docs:vim:commands [2008/08/03 00:25] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== VIM Commands ====== | ====== VIM Commands ====== | ||
- | * you can start the VIM tutor by typing ' | + | |
- | + | * :!: make sure to read the [[reference_documents]] | |
Line 15: | Line 14: | ||
| Ctrl-f | | Ctrl-f | ||
| Ctrl-b | | Ctrl-b | ||
+ | | Ctrl-] | ||
+ | | Ctrl-t | ||
===== Files ===== | ===== Files ===== | ||
Line 51: | Line 52: | ||
| Ctrl-w n\\ :new |create a new window and start editing an empty file in it| | | Ctrl-w n\\ :new |create a new window and start editing an empty file in it| | ||
| Ctrl-w q\\ :q\\ :quit |quit current window; when quitting the last window, exit VIM| | | Ctrl-w q\\ :q\\ :quit |quit current window; when quitting the last window, exit VIM| | ||
- | |||
===== Copy, Cut, Paste (yank, delete, put) ===== | ===== Copy, Cut, Paste (yank, delete, put) ===== | ||
- | | p |put (paste below)| | + | | p/P |put (paste below/above)| |
- | | Shift-P | + | | v/V |
- | | v |block select (characterwise) mode| | + | | |
- | | V |block select (linewise) mode| | + | |
- | | | + | |
| y |(after block select) yank (copy)| | | y |(after block select) yank (copy)| | ||
| d |(after block select) delete (cut)| | | d |(after block select) delete (cut)| | ||
+ | ^ gv |restore previous selection\\ //(useful after indent if you need to indent again)// | | ||
+ | | :reg |show current registers (like current clipboard entries) | ||
+ | | " | ||
===== Editing ===== | ===== Editing ===== | ||
- | | i |insert| | + | | i\\ I |
- | | | + | | |
- | | a |append| | + | | a\\ A |
+ | | o\\ O |begin a new line below/above the current line | | ||
+ | | r\\ R |replace one char under cursor/ | ||
+ | | c< | ||
+ | | C |change from cursor to end of line | ||
| cw |change word (delete remaining portion of the word, and begin editing)| | | cw |change word (delete remaining portion of the word, and begin editing)| | ||
| c(same options as d) |change line, change word etc...| | | c(same options as d) |change line, change word etc...| | ||
+ | | d< | ||
| dd |delete line| | | dd |delete line| | ||
| de |delete word (no space)| | | de |delete word (no space)| | ||
Line 76: | Line 81: | ||
| u | | u | ||
| U |undo all for line| | | U |undo all for line| | ||
- | | Ctrl-r | + | | Ctrl-r |
- | | > |indent| | + | | |
- | | < |outdent| | + | | |
+ | |||
+ | ===== Motions ===== | ||
+ | A motion is a command that moves the cursor. | ||
+ | | w\\ e |to start/end of word | | ||
+ | | b |to beginning of word | | ||
+ | | 4j |4 lines down | | ||
+ | | f{char}\\ F{char} | ||
+ | | t{char}\\ T{char} | ||
+ | | ; |Repeat latest f, t, F or T [count] times | | ||
+ | | , |Repeat latest f, t, F or T in opposite direction [count] times | | ||
+ | | [number]gg\\ [number]G | ||
+ | | (\\ ) |move sentences forward/ | ||
+ | | {\\ } |move paragraphs forward/ | ||
+ | |||
+ | ===== Text Object Selection ===== | ||
+ | These commands word in Visual modes. | ||
+ | | aw |a word, trailing whitespace is included | ||
+ | | iw |inner word | | ||
+ | | a[\\ a] |a [] block (use i for inner block) | ||
+ | | a(\\ a)\\ ab |a () block (use i for inner block) | ||
+ | | a<\\ a>|a <> block (use i for inner block) | ||
+ | | a{\\ a}|a {} block (use i for inner block) | ||
+ | |||
+ | ===== Marks ===== | ||
+ | FIXME | ||
+ | |||
+ | ===== Various Commands ===== | ||
+ | | ga |show value of character under the cursor in decimal, hex, and octal | | ||
+ | | g8 |show the hex values of the bytes used in the character under the cursor | ||
===== Code Completion ===== | ===== Code Completion ===== | ||
:help ins-completion | :help ins-completion | ||
+ | |||
+ | ===== Abbreviations ===== | ||
+ | :help abbreviations | ||
+ | |||
+ | You can use abbreviations to quickly enter a short sequence of characters that will be expanded into your defined sequence of characters. | ||
+ | |||
+ | Examples: | ||
+ | |:ab de document.getElementById(' | ||
===== Settings ===== | ===== Settings ===== |