Tip #646: moving lines up/down in a file
tip karma |
Rating 57/32, Viewed by 1690
|
created: |
|
January 28, 2004 22:33 |
|
complexity: |
|
basic |
author: |
|
Frank Butler |
|
as of Vim: |
|
5.7 |
The following mappings in .vimrc provide a quick way to move a line of text up or down within a file:
map <C-Up> dd-P
map <C-Down> ddp
Hold down the Control key, and the <Up> and <Down> arrow keys move the line. Check it out!
This is particularly useful when editing a file consisting of single-line items in a particular order (such as priority) - it makes it easy to change the relative position of items in the list.
<<Enabling Windows shortcuts (eg alt+space, F10 etc) for gvim window |
Single letter insert >>
Additional Notes
|