sponsor Vim development Vim logo Vim Book Ad

reverse.vim : reverse (1st line becomes last ...) the lines in a file

 script karma  Rating 2/11, Downloaded by 630  Comments, bugs, improvements  Vim wiki

created by
Amit Jain
 
script type
utility
 
description
This file has a vim script to reverse the lines in the file.
(line 1 swapped with last line say 5, line 2 swapped with line4 ...)

I build it because I had such a requirement and could not
think of anything quicker on Windows.

Unix people have lot better tricks-).


How to use :
Method 1: press <F2> if you wanna reverse all the lines
Method 2: select lines in visual mode and press <F2>
                if you wanna swap only the highlighted lines
Method 3: To reverse line1 to line2 use :line1,line2 Reverse
 
install details
simply source the file using
:source <filepath>\\reverse.vim
or source it in your vimrc file
for automatically sourcing this everytime

Caution: This script maps <F2> key, so if you have already mapped <F2>
key you should change the mapping in this file to some other key
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
reverse.vim 1.0 2004-10-29 6.0 Amit Jain Initial upload
ip used for rating: 18.226.169.94

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github