-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimTrivia
37 lines (36 loc) · 2.89 KB
/
vimTrivia
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Commands Explanations
-------- ------------
w Jump to the first letter of the next word. If there's an intervening punctuation then jump to the punctuation.
W Just like w but ignore the punctuation.
b Jump from the middle of current word to the first letter. Or, jump from the first letter of current word to the first letter
of previous word. If there's an intervening punctuation, jump to the punctuation.
B Just like b, but ignore intervening punctuation.
^f Page down.
^b Page up.
J(shft+j) Join current line with the line bellow it by removing the linefeed character at the end of this line.
:ls Lists all file in the buffer while editing more than one file. This is actually an alias for ":buffers" command.
:e <file> Adds <file> to the buffer.
:bd#n/:#nbd Deletes the #nth file from the buffer. If #n argument isn't given, removes the current file from the buffer.
:syntax on Turns on syntax highlighting.
:set hlsearch Turns on highlighiting search result. ":set hls" is the short form. The disable ":set no hlsearch"/":set no hls".
:set incsearch Turns on incremental search. In sort form the command is ":set inc". Likewise ":set noinc"/":set noincsearch" undoes it.
:set tabstop=4 Sets tab width to 4.
:set autoindent Turns on autoindentation. Likewise ":set noautoindent" turns off autoindentation.
ctrl+](^]) When cursor is on a hyperlink tag, pressing ^] loads the linked page to current window. Its called "push tag" command.
ctrl+T(^T) Load the previous window. Its called "pop tag" command.
^u Scroll up half a screen.
^d Scroll down half a screen.
. Repeat the last delete action.
^k+<digraph seq> Enter the character represented by respective digraph sequence. Eg: ^k+Co inserts the "©" character.
:digraph Lists all the digraph characters supported by current version of vim. Digraph list is shown in a new window.
/<str> Searches and jump to first occurance of <str> in the document.
/Enter Jump to next instance of <str> in the document. Its name as pressing "n".
?<str> Searches and jump to the last occurance of <str> in the document. Upon pressing "n" the cursor moves to previous occurance
of <str> and to the next occurance on "N", exactly opposite of "/<str>" command. This is why "?<str>" is called reversed
search.
/^[str] Search for [str] when it appears at the beginning of the line.
/[str]$ Search for [str] when it appears at the end of the line.
/^[str]$ Search for the [str] when it appears as the sole word of a line.
/^$ Search for empty lines.
/[lt].[ltr] The regular expression "." represents a single letter. Thus "/c.m" searches for all: com.., cam..., cim... etc.
*Note: Macros in vim record action, not words phrases or strings, just like "." command.