Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have some c++ includes that I want to sort:

#ifndef t
#define t

#include <b>
#include <a>
#include <c>

#endif

I can shift-v to highlight the #include lines and then do :sort but I would like to do this with a simpler command if there is one.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Assuming the #include lines are delimited from the rest of the text by at least one blank line place the cursor on the start of the first #include line and enter:

!}sort
share|improve this answer

Try this:

:command Psort :'{+1,'}-1sort

Then you should just be able to type :Psort to sort the paragraph (delimited by blank lines) that the cursor is on. (This has the advantage of working regardless of where the cursor is within the paragraph.)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.