-
-
Notifications
You must be signed in to change notification settings - Fork 2
14.4. Command Line Mode
Shin Okada edited this page Aug 15, 2015
·
2 revisions
:1 # move to line 1
:print # print
:$ # to the last line
:p # print
:3p # print line 3
:2,5p # print line 2-5
:2
:.,$p # print from current line (2) to the end
:%p # print the page
2G # move to line 2
VG # visual mode from line 2 to the end
: # this will prepopulate the command-line with :'<,'>
:/<html>/,/<\/html>/p
:/<html>/+1,/<\/html>/-1p
:2
:.,.+3p
Symbol | Address |
---|---|
1 | First line of the file |
$ | Last line of the file |
0 | Virtual line above first line of the file . Line where the cursor is placed |
'm | Line containing mark m |
'< | Start of visual selection |
'> | End of visual selection |
% | The entire file (shorthand for :1,$) |
:6copy. # [range]copy{address} Make a copy of line 6 and put it below the current line
:6co. # same as above co=copy
Command | Effect |
---|---|
:6t. | Copy line 6 to just below the current line |
:t6 | Copy the current line to just below line 6 |
:t. | Duplicate the current line (similar to Normal mode yyp) |
:t$ | Copy the current line to the end of the file |
:'<,'>t0 | Copy the visually selected lines to the start of the file |
:[range]move{address}
or use :m
.
Move three lines at the end.
Vjj # visual mode and select two more lines
:m$ # by : it will show :'<,'>m$
A;<Esc> # Append ; and escape
jVG # go down one line and change to the visual mode and select to the end
:normal. # : will show :'<,'>. This will append ; to all selected area.
:<','>normal
can be read as For each line in the visual selection, execute the Normal mode .
dot command.
:%normal A; # Append ; at the end of every line of the file
:%normal i// # Add // at the beginning of every line of the file
:bnext # or :bn(ext) :bp(revious) to iterate items in the buffer list
@: # to repeat :bn. : holds the most recently executed command line
@@ # to repeat the previous since : holds the most recent command line
<C-o> # adds a record to the jump list, use a command from the list.
:col<C-d> # to display a list of possible completions
:col<Tab> # to cycle through the list
:col<S-Tab> # Shift-Tab cycle backwards
to display a list and this allow to use ,, , , or
set wildmenu
set wildmode=full
* # to search a word under the cursor
cwcounter<Esc> # change the word to counter
:%s//<C-r><C-w> # Substitute words which are seletced by * with the word under the cursor.
Here you don't need to write a search word since you have selected words with *
.
Use <C-r><C-a>
to get the WORD.
:help <C-r><C-w> # to look up the doc
Important: The Tables of Content are generated. Any change will be overridden on the next update.
For more information: GitHub Wikifier