Legal Disclaimer

Tech in your hand
An easy approach to understand tech specs
Home.
TYH
Learn to Impress
Custom Search

Feedback ? Send it to admin@fullchipdesign.com or join me at fullchip@gmail.com

Legal Disclaimer

Previous.
Next.
GVIM VI VIM GVIM empty GVIM Merge GVIM drop GVIM Num GVim duplicate GVIM time GVIM Make GVIM Markers GVIM spellcheck GVIM Syntax GVIM Reverse GVIM lines GVIM Intro
Home.Pics.LTE Home.OFDMA  .
How to reverse line order in gVIM? GVIM regular expression to reverse the order of lines in any block of text in a file is shown below.


Command to reverse order in entire file or global operation.
:g/^/m 0

Let’s discuss it with an example of block of text starting at line 10 and going till line 20 end.  

Command,

:10,20g/^/ mo 10

The operation is simply carried by moving every line in text file before the first line in the block.

In the command above

:g stands for :global - the commands to executed globally
/^ stands to match beginning of any line.
/m stands for move in gvim
GVIM command to reverse line order.