Last active
September 27, 2015 11:17
-
-
Save homm/1261735 to your computer and use it in GitHub Desktop.
User key bindings for sublime text and modificated duplicate_line.py in /Packages/Default/duplicate_line.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ "keys": ["super+g"], "command": "find_under", "context": | |
[ | |
{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true } | |
] | |
}, | |
{ "keys": ["super+c"], "command": "noop", "context": | |
[ | |
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true } | |
] | |
}, | |
{ "keys": ["super+d"], "command": "duplicate_line", "args": {"force_lines": true}}, | |
{ "keys": ["shift+enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line.sublime-macro"} }, | |
{ "keys": ["super+shift+x"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} }, | |
{ "keys": ["super+k", "super+m"], "command": "set_mark" }, | |
{ "keys": ["alt+up"], "command": "swap_line_up" }, | |
{ "keys": ["alt+down"], "command": "swap_line_down" }, | |
{ "keys": ["ctrl+q"], "command": "previous_edit" }, | |
{ "keys": ["ctrl+shift+q"], "command": "next_edit" }, | |
{ "keys": ["super+."], "command": "auto_complete" } | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sublime, sublime_plugin | |
class DuplicateLineCommand(sublime_plugin.TextCommand): | |
def run(self, edit, force_lines=False): | |
for region in self.view.sel(): | |
if force_lines or region.empty(): | |
line = self.view.line(region) | |
line_contents = self.view.substr(line) + '\n' | |
self.view.insert(edit, line.begin(), line_contents) | |
else: | |
self.view.insert(edit, region.begin(), self.view.substr(region)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment