Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

#ifndef t
#define t

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


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
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:

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .