- AuthorPosts
- January 22, 2013 at 5:57 pm #10784ArthurZParticipant
Please add the ability to swap lines
E.g. when we have several lines like
int main () {
ofstream myfile;
myfile.open (“example.txt”);
myfile.close();
myfile << "Writing this to a file.n";
return 0; }May want to swap to
int main () {
ofstream myfile;
myfile.open (“example.txt”);
myfile << "Writing this to a file.n";
myfile.close();
return 0; }using a simply keystroke while standing within myfile.close (w/o the need to highlight the line).
Thank You!
January 22, 2013 at 8:53 pm #10785MeirParticipantOh no! Please no!
EE is a lightning fast, full featured great editor. Why do you need such a “feature”? It requires learning, remembering, a shortcut, configuring GUI, etc., etc. Why can’t you select a line and drag it up one line?
Even as it is, there are numerous functions people, including me, are not aware of. These forums are replete with questions about this and that and poor Yutaka has so much work just pointing people in the right direction (meaning the right menus path.)
Please do not burden EE and make it a big footprint, slow monster. We have those and I hate them!
Thumbs down, absolutely, totally!!!
January 22, 2013 at 10:01 pm #10786ArthurZParticipantI would disagree with you on this comment Meir,
Such functionality exists in many editors EE has to compete against.
For example Sublime Text can swap lines with Ctrl-Shift-ArrowUp.
And it is one of its most used features: http://bit.ly/VYn8xWDoes it add slowness? I doubt that. Yet, people who shell $50 for an editor probably are on a 2-3 year hardware refresh cycle. For the rest, slowness is in each app.
On the contrary, it adds productivity.
Dragging is not going to do that in one hit, and for example not possible if you want to position a line at the top.
I think most EE users work on platforms as say Unix and use Windows as merely a window into their OS editing files quickly on the Win side. For them using keyboard is more natural and unintuitive than the mouse and they pick new commands naturally.
January 23, 2013 at 5:50 am #10787StefanParticipant.
You can extend EmEditor yourself.
Just save a macro, add to My Macros, add an shortcut.
(or use Snippet plugin)A macro could look like:
SwapWithLineAbove.jsee
document.selection.SelectLine(); //select line with cursor
cLine = document.selection.text; //store line to var
if(cLine.indexOf("n") < 0){cLine = cLine + "rn";}
document.selection.Delete(); //delete line
document.selection.LineUp(); //move cursor up one line
document.write(cLine); //paste line from var
or
MoveLineUp_(on-and-on).jsee
(assign to Shift+Alt+U)
document.selection.SelectLine(); //select line with cursor
cLine = document.selection.text; //store line to var
if(cLine.indexOf("n") < 0){cLine = cLine + "rn";}
document.selection.Delete(); //delete line
document.selection.LineUp(); //move cursor up on line
document.write(cLine); //paste line from var
document.selection.LineUp(); //move cursor up one line
and
MoveLineDown_(on-and-on).jsee
(assign to Shift+Alt+D)
document.selection.SelectLine(); //select line with cursor
cLine = document.selection.text; //store line to var
if(cLine.indexOf("n") < 0){cLine = cLine + "rn";}
document.selection.Delete(); //delete line
document.selection.LineDown(); //move cursor down one line
document.write(cLine); //paste line from var
document.selection.LineUp(); //move cursor up one line
– – –
Swap Lines UpSideDown.jsee
FROM:
1 – x
2 – Y
3 – Z
TO:
3 – Z
2 – Y
1 – x
Sel = document.selection.text;
SelArr = Sel.split("rn"); SelArr.reverse();
for(i=0,L=SelArr.length; i<L; i++){
document.selection.text = SelArr[i];
if(i<L-1){document.selection.text ="rn";}
}
.
January 23, 2013 at 2:59 pm #10788ArthurZParticipantThis is an excellent idea and the Macros, too; thank you for supplying them!
Besides, are you the same Stefan who is the moderator on the HippoEdit forum?
January 25, 2013 at 6:28 pm #10792shxParticipantThanks Stefan,
Is it possible to have it move numerous lines if preselected?
January 25, 2013 at 9:25 pm #10793ArthurZParticipantHi Steven,
no, the macro even does not run on highlighted lines.
January 28, 2013 at 8:28 am #10796TommyMillsMemberI would also love this feature. I, too, have created a one line macro to do this in the meantime, but it doesn’t work perfectly with “auto indent” enabled. It’d be nice to have this and multi line support too.
January 2, 2014 at 1:33 am #17778StefanParticipantThis is implemented now, see:
http://www.emeditor.com/text-editor-features/history/new-in-version-14/
The Move Line Up and Move Line Down commands were added.
By default, these commands were assigned as CTRL + SHIFT + UP and CTRL + SHIFT + DOWN.
If these shortcut keys don’t work, please go to Configuration Properties, Keyboard tab, and click Reset, or assign your favorite shortcut keys to these commands.Thank you, Yutaka.
Find me: transpose lines move line up move lines down switch lines
- AuthorPosts
- You must be logged in to reply to this topic.