I finally found the time to do what I wanted to do since I discovered LineMover plugin. With a help of a very small extra code it now moves lines AND then indents them in the same way as CtrlAltI does (Auto-Indent Lines). I do not invoke Auto-Indent Lines action because it move caret to a rather wrong for this plugin place. I used some code from IDEA to do the trick, so my contribution here is very limited.

I am not sure that I need to iterate to the next version the existing plugin. I suspect some people would want to use the old one instead. So I created a new plugin entry in the repository. It's called LineMoverIndent. Two these plugins can be used at the same time, just make sure you assign different keystrokes for them. I'll post the source code later on.

Votes

Share

Dmitry > I am not sure that I need to iterate to the next version the existing plugin. I suspect some people would want to use the old one instead. So I created a new plugin entry in the repository. It's called LineMoverIndent. Two these plugins can be used at the same time, just make sure you assign different keystrokes for them. I'll post the source code later on.

I seem to remember that the plug-in fuctionalituy was to be integrated into IDEA's core for Palada.Am I wrong?

Very nice. LineMover is the plugin I use most on a day-to-day basis, and the lack of auto-indent has always irked me.

That said, I have absolutely no idea why this functionality isn't in the core product. IDEA has such nice line-based features already (Ctrl-D, Ctrl-Shift-J, etc.) that these seem like natural additions.

AR> I seem to remember that the plug-in fuctionalituy was to beAR> integrated into IDEA's core for Palada.AR> Am I wrong?

Frankly I have no idea whether it is going to be included into IDEA's core or not (I am not on IDEA team). It took me a half an hour to do anyway, so even if it going to be useless in a month I did not waste a lot of time doing that :)

Is multi-line block moving in this plugin (or the original) supposed to work on anything other than java files? For me, it doesn't. I tried on a text file and an HTML file and in both cases the selection was lost and only one line gets moved (and if you completely undo your changes the selection reverts back to a range that's different from what you started with).

LineMover plugin. With a help of a very small extra code it now moves linesAND then indents them in the same way as CtrlAltI does (Auto-IndentLines). I do not invoke Auto-Indent Lines action because it move caret to arather wrong for this plugin place. I used some code from IDEA to do thetrick, so my contribution here is very limited.>

I am not sure that I need to iterate to the next version the existing

plugin. I suspect some people would want to use the old one instead. So Icreated a new plugin entry in the repository. It's called LineMoverIndent.Two these plugins can be used at the same time, just make sure you assigndifferent keystrokes for them. I'll post the source code later on.>

DB> Uhm, I don't understand: are the shortcut still ctrl-shift-IDB> ctrl-shift-K? On my system the line is correctly moved up and down,DB> but indentation does not change!

Now I think that if you have two these plugins installed (with and without indentation) then only one will work because the class names are the same. So if this is the case you'll need to uninstall one of them.

I see no reason to not consider your plugin as the next version of LineMoverPlugin. You could simply publish it as the next version, and reuse the old default shortcuts.(the doc and source is on the wiki)

Should the auto-indent be an annoyance in some cases - is it? - , you could maybe add a config option.

No, no, I didn't use the old one, I directly installed the LineMoverIndent one (I just double-checked in my plugin updater). If I open the keymap, I see that the actions bound to ctrl-shift-I and ctrl-shift-K are "Editor actions / Move line 1 Up" and "Editor actions / Move line 1 Down", so no mention to indentation is done: is this correct?

I see no reason to not consider your plugin as thenext version of LineMoverPlugin. You could simply publish it as thenext version, and reuse the old default shortcuts.(the doc and source is on the wiki)

Should the auto-indent be an annoyance in some cases- is it? - , you could maybe add a config option.

DB> No, no, I didn't use the old one, I directly installed theDB> LineMoverIndent one (I just double-checked in my plugin updater). IfDB> I open the keymap, I see that the actions bound to ctrl-shift-I andDB> ctrl-shift-K are "Editor actions / Move line 1 Up" and "EditorDB> actions / Move line 1 Down", so no mention to indentation is done:DB> is this correct?

Yes, this is correct. I did not change the text for keystrokes. I have different mapping than this (CtrlShiftUp/Down).

If you use the new one then it should indent lines in Java files. It's really strange if it does not. Can it be that you tried it on non java files?

AR> I see no reason to not consider your plugin as the next version ofAR> LineMoverPlugin. You could simply publish it as the next version,AR> and reuse the old default shortcuts.AR> (the doc and source is on the wiki)

Well, thanks for the permission, I'll do that as soon as I get home :)

AR> Should the auto-indent be an annoyance in some cases - is it? - ,AR> you could maybe add a config option.

Same here, I use it a lot (and now that it also has indentation I'm gonna use it even more). It's definitelly something you'd expect in the core product.

Thanks for the enhancement.Andrei

DG> Very nice. LineMover is the plugin I use most on a day-to-dayDG> basis, and the lack of auto-indent has always irked me.DG> DG> That said, I have absolutely no idea why this functionality isn't inDG> the core product. IDEA has such nice line-basedDG> DG> features already (Ctrl-D, Ctrl-Shift-J, etc.) that these seem likeDG> natural additions.DG> DG> --Dave GriffithDG>

Another problem: if I move multiple lines (in java code) to a position which causes a syntax error, then the selection is lost. Here's how to reproduce it with the code shown below:

1) Select the two lines within the try block.2) Move them up 1 line, so that they're located between the try and the opening brace.3) IDEA recognizes this as a syntax error (as it should), but the selection is lost. Further attempts to move the block fail, and only a single line is moved.

Well, after much hair pulling I've determined that the key combinationCtrlShiftI doesn't work for me. I reassigned the Line Mover toCtrl+UpArrow and it works fine. Don't know why that certain combinationdoesn't work. Doesn't even register if I try to set it to a 'command'.

Try assigning the shortcut to any desktop icon. Windows won't let you if it's already in use. It won't tell you who's using it, though, but that wouldn't be the first "surprise" you got from Windows, would it? :)

HTH,Andrei

B> Do you know if there is a way to verify that? Just hittingB> CtrlShiftI doesn't seem to do anything.B> B> "Jacques Morel" <jacmorel@yahoo.com> wrote in messageB> news:17333794.1084563251497.JavaMail.itn@is.intellij.net...B> >> If you are on windows, you might want to verify that you don't have a>> B> desktop or quickstart icons with shortcut. They will take precedenceB> over any application's.B> >> Jacques>>