Currently the only way to duplicate a block of code is to go through a tedious process of select->copy->go down->unindent if needed->paste.
ST1 had a plugin (poweredit) that made Ctrl+Sift+D duplicate currently selected text if it's available. If not, it would duplicate current line. This is super useful and productive feature and I think must come by default with ST2.
I've hacked the existing duplicate_line.py a bit. It copies the current line if nothing selected. Otherwise it inserts the selection after the selection. For duplicating complete lines you have to select the whole line (including the newline character).
import sublime_plugin
class DuplicateLineCommand(sublime_plugin.TextCommand): def run(self, edit): for region in self.view.sel(): line = region if line.empty(): line = self.view.full_line(region) line_contents = self.view.substr(line) self.view.insert(edit, line.end(), line_contents)
I've seen that some of my co-workers did indent it wrongly. You have to indent the last two lines at the same column like the "if line.empty()" is, otherwise nearly nothing will happen. As always you install it by putting it into your User folder.