This plugin adds a directional "Duplicate Line" command. You can duplicate lines and selections either "up" (before current line/selection) or "down" (after, which is the default duplicate_line
behavior).
As many other simple text editor plugins, this one comes from a desire to make the new editor behave more like another one. I liked Eclipse's duplicate line functionality. You press ctrl+alt+up
/ ctrl+alt+down
(command
and option
on macs) and it duplicates the line you're on, either up or down.
Yes.
Copy the application folder into Sublime's Packages
folder. That's it.
You have to bind the commands to keys. This is what I did (on a mac, trying to mimic Eclipse's bindings):
{ "keys": ["super+alt+up"], "command": "directional_duplicate_line", "args": {"direction": 1} },
{ "keys": ["super+alt+down"], "command": "directional_duplicate_line", "args": {"direction": 0} },
-
Now,
command+shift+down
will behave like the regularduplicate_line
(usuallycommand+shift+d
) and, well, duplicate your line. Or selection. -
command+shift+up
will duplicate your lines "up", which actually means duplicating it regularly but keeping the cursor where it is. Same for selections.
Behavior with multiple selection seems kind of weird sometimes, but is consistent with the original duplicate_line
command.
Thanks to the guys who wrote the awesome Sublime Text 2.
Also, thanks to whoever wrote http://www.sublimetext.info/ and the original duplicate_line
script.
And thanks to Alexander Staubo, who wrote the sublime_text_alternative_autocompletion plugin, from which this Readme's structure is blatantly copied.
Copyright 2011 Marcelo Alvim. MIT license. See LICENSE
file for license.