Sorting selected lines

Is there a way in the Community Edition (thanks, JetBrains!) to sort selected lines of text? Either buit-in, a plugin, or "escape" to the underlying OS would be fine.

I am running on Apple Os X 10.6.3.

6 comments
Comment actions Permalink

Hello,

Please provide more information about your use-case, i.e. it's not that clear what is your target file type (java, xml, properties etc) and what sort criteria do you want to use.

Regards, Denis

0
Comment actions Permalink

I am trying to sort the import statements in Java and Scala source files. Being able to do a general lines sort in text files would be useful also (simply sort all selected lines case-sensitive or insensitive).

0
Comment actions Permalink

Take a look at Settings -> Code Style -> Imports

I am trying to sort the import statements in Java and Scala source
files. Being able to do a general lines sort in text files would be
useful also.

---
Original message URL:
http://www.jetbrains.net/devnet/message/5264023#5264023



0
Comment actions Permalink

Already did, but there does not seems to be a way to do this in the Scala plugin. A more general solution
(albeit tedious) is to allow the user the sort arbitrary lines in the file.

0
Comment actions Permalink

Out of curiousity why would you want to sort your imports? I generally don't even give a 2nd thought about imports. IntelliJ takes care of them and on occasion I have to decide between some ambigious imports. That is about it.

If you really want to sort them you can cut/paste them into a text file on your Mac and then from the command-line (terminal) run:

cat myfile.txt | sort

then cut/paste them back in.

Seems tedious though.

Also, use cmd-alt-o to organize your imports (doesn't sort them, but tidies them up)

-2
Comment actions Permalink

It should be a pretty quick job to modify this plugin to do what you want:

http://code.google.com/p/ideapropertysorterplugin/

Additionally, perhaps it's worth making a feature request to the people developing
the scala plugin.

Already did, but there does not seems to be a way to do this in the
Scala plugin. A more general solution

(albeit tedious) is to allow the user the sort arbitrary lines in the
file.



0

Please sign in to leave a comment.