Professional Documents
Culture Documents
Mode:: Nouns
Mode:: Nouns
Mode:: Nouns
Normal mode — the default mode. You can type text commands and do navigation. To enter this mode press ESC
Command mode — editor commands (like save, open, etc.). To enter this mode press: “esc” key.
Insert/Edit mode — in this mode you can type text as in other editors. To enter this mode press i/I/a/A/o/O. To
exit this mode, press “esc” key.
Visual mode — here you can select text. To enter this mode press v / ctrl-v/ V (individual/blockwise/linewise), to
exit, use “esc” key.
VIM language
Nouns:
w — word
s — sentence
p — paragraph
b — (block/parentheses)
t — tag
{, }, (, ), [, ] — braces
Verbs:
v — visualize
d — delete and copy (delete text and does not change VIM mode)
Adverbs:
i — inside
a — around
t — till
f — till (inclusive)
Examples:
Pay attention that these commands may work by itself not as you expect. Moreover, when you create a
VIM sentence, it should be sufficient and all constructions should be on their place, otherwise, you will
get another result. Now let's create some easy VIM sentences as an example:
ciw — change inside word — deletes the whole word under cursor and switches to insert mode, unlike
cw which deletes a word from cursor to the end of this word.
ci" — change inside " brace — deletes all text between " braces.
da} — delete around } brace — deletes all text inside curly braces including them.
you want to remove all code inside {} of foo function. Using number modifier it is easy to do. Just type
2ci{ — change inside curly braces 2 times. After run the 2ci{ command, you’ll get:
function foo() {}
Number modifier works not only in sentences but it works almost everywhere:
2fK — moves the cursor to the second occurrence of litter k in the line.
Then use :n or :prev to move among them. See which file are open with: args. To close all current files
and open a new file :n file4 (now only file4 is open)
Using windows
Ctrl-W s and Ctrl-W v (or :split and :vertical split (:sp and :vs)) to split the current window horizontally
and vertically.
Ctrl-W w to switch between open windows, and Ctrl-W h (or j or k or l) to navigate through open
windows.
Ctrl-W c to close the current window, and Ctrl-W o to close all other windows except the current one.
Starting vim with a -o or -O flag opens each file in its own split.
Ctag
To use vim + ctag,