If I am in the middle of a line, how to I cut to the beginning/end of a line? (is copy different)
If I am in the middle of a line, how do I paste over to the beg/end of the line? (is pasting w/o copying over the text much different?)
thanks allot!
Lowercase 'p' will paste AFTER the cursor. Use a capital 'P' and it will end up BEFORE the cursor.
Copying (Yanking) yy - Yank (copy) the current line, including the newline character. 3yy - Yank (copy) three lines, starting from the line where the cursor is positioned. y$ - Yank (copy) everything from the cursor to the end of the line. y^ - Yank (copy) everything from the cursor to the start of the line.
shift-i : insert text at line beginning.
As Yoda said:
d$
cuts to the end of the lined0
cuts to the beginningd^
cuts to first non-whitespace characterTo paste over the 'head' of the line:
v^p
or
v0p
To make it remember the default register, you could use the _
unnamed register:
v$"_p
Note that in that case, the overwritten text is 'forgotten' instead of yanked. (By default replacing a visual selection effectively yanks the overwritten text, so you can put it somewhere else)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With