Tip #344: Cut / Copy / Delete / Paste Lines without knowing the number of lines
tip karma |
Rating 45/24, Viewed by 1293
|
created: |
|
October 15, 2002 11:57 |
|
complexity: |
|
basic |
author: |
|
Kdr |
|
as of Vim: |
|
5.7 |
If you ever need to cut / copy / delete / paste lines without knowing the actual number of lines, here is what you should do.
1. In the command Mode, Go to the beginning of the first mark (lets say line 50).
2. Type: mk
3. Go to the end of your selection (lets say 100), using j's or Ctrl -F or anything. You don't need to count the lines.
4. Type: "ay'k (i.e. Double Quotes, <reg name from a-z>, <y-yank or d-delete>, single quote, k
5. The above command copies those lines into register a.
6. If you do "ad'k , it will delete them from the current location and copies them into register a.
7. You can paste those lines wherever you want just as you print from registers, i.e. "ap
I use this a lot, since I don't need to count the number of lines.
-Kdr
<<Faster loading of large files |
Visual Studio + vim Quickfix mode + cygwin + XFree86 >>
Additional Notes
|