- place cursor on line 4
:1,+1p (line 1 through line 5)
:1;+2p (line 1 through line 2, note that this moves the cursor)
:set clipbboard=unnamedplus to make default yank etc go to
- Handy when doing lots of migrating from one doc to another
"0 is populated by yank, not delete.
"1 is populated by change or delete unless a register is specified.
"_ can be used to disable the population of any register.
%( ~~ perl’s
\ze controls match
s/foo \zsbar\ze baz/biff/ replaces
foo bar baz with
foo biff baz
- relevant blog post
- edit search or command history in command window
<C-f> to upgrade to this
<Enter> to exit
- Allows “remote” copying (ie no moving cursor)
:t . ==
:1t 2 == copy line one to line 3 (or to the end of line 2)
:m does the same thing, except moves instead of copies
- Runs an ex command for each match
:vg inverts the match (like
- Investigate using these for more automation