Vim: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 3: | Line 3: | ||
==Switch to last file== | ==Switch to last file== | ||
:e# | :e# | ||
==Delete to end of line== | |||
D | |||
==yank buffers== | ==yank buffers== | ||
Copy data to different buffers. | Copy data to different buffers. |
Revision as of 10:36, 18 December 2009
Useful commands.
Switch to last file
:e#
Delete to end of line
D
yank buffers
Copy data to different buffers.
vi /etc/{passwd,group,shadow} /tmp/newfile "a2yy # Yank two lines to yank buffer a. :n # Go to next file. "b2yy :n #c2yy :n "ap # paste yank buffer a. "bp "cp
Delete lines and add to a buffer.
vi /tmp/tmp1 /tmp/tmp2 "add # Delete some lines and add to buffer a. "Add # Go to next lines and add lines to buffer a. :wn "ap # Paste buffer.
Deleted lines atomically get numbered buffers.
"2p # Get back the deletion you did before this one.
filter
Sort part of file.
:96,99!sort # will pass lines 96 through 99 through the sort filter and replace those lines with the output of sort.
run command
:!date