Ex Mode Flashcards
Specify a range
:{num},{num}
go to end of file
:$
go to line
:{num}
all lines in file
%
select range between patterns
:/{pattern}+1,/{pattern}-1
select range including pattern
:/{pattern}/,/{pattern}/
line where cursor is placed
.
move a line to another position
:{num}m{num} (or move)
copy a line to a position
:{num}t{num} (or copy, or co)
execute a command on each line in the selection in normal mode
:{range}normal {command}
copy the word under the cursor
:Ctrl-rCtrl-w
efficient global replace
*{old}cw{new}:%s//Ctrl-rCtrl-w/g
bring up command line window
q:
bring up command line window from command mode
Ctrl-f
run a command in the shell
:!{cmd}
start an interactive shell session
:shell
send output of command to buffer
:read !{cmd}
write buffer to command
:write !{cmd}
filter a range with a command
:{range}!{filter} (e.g. :2,$!sort -t’,’ -k2)
setup a range for a command
!{motion} (e.g. !3j)