diff --git a/Default (Linux).sublime-keymap b/Default (Linux).sublime-keymap index 591606a..3fa75fb 100644 --- a/Default (Linux).sublime-keymap +++ b/Default (Linux).sublime-keymap @@ -22,5 +22,11 @@ {"key": "selection_empty", "operator": "equal", "operand": false}, {"key": "selector", "operator": "equal", "operand": "text.html.asciidoc"} ] + }, + { "keys": ["ctrl+alt+v"], "command": "adoc_paste_as_link", "context": + [ + {"key": "selection_empty", "operator": "equal", "operand": false}, + {"key": "selector", "operator": "equal", "operand": "text.html.asciidoc"} + ] } ] diff --git a/Default (OSX).sublime-keymap b/Default (OSX).sublime-keymap index baa415b..8297f4f 100644 --- a/Default (OSX).sublime-keymap +++ b/Default (OSX).sublime-keymap @@ -22,5 +22,11 @@ {"key": "selection_empty", "operator": "equal", "operand": false}, {"key": "selector", "operator": "equal", "operand": "text.html.asciidoc"} ] + }, + { "keys": ["super+alt+v"], "command": "adoc_paste_as_link", "context": + [ + {"key": "selection_empty", "operator": "equal", "operand": false}, + {"key": "selector", "operator": "equal", "operand": "text.html.asciidoc"} + ] } ] diff --git a/Default (Windows).sublime-keymap b/Default (Windows).sublime-keymap index 591606a..3fa75fb 100644 --- a/Default (Windows).sublime-keymap +++ b/Default (Windows).sublime-keymap @@ -22,5 +22,11 @@ {"key": "selection_empty", "operator": "equal", "operand": false}, {"key": "selector", "operator": "equal", "operand": "text.html.asciidoc"} ] + }, + { "keys": ["ctrl+alt+v"], "command": "adoc_paste_as_link", "context": + [ + {"key": "selection_empty", "operator": "equal", "operand": false}, + {"key": "selector", "operator": "equal", "operand": "text.html.asciidoc"} + ] } ] diff --git a/adoc_paste_as_link.py b/adoc_paste_as_link.py new file mode 100644 index 0000000..575e346 --- /dev/null +++ b/adoc_paste_as_link.py @@ -0,0 +1,14 @@ +import sublime +import sublime_plugin + + +class AdocPasteAsLinkCommand(sublime_plugin.TextCommand): + def run(self, edit): + view = self.view + sel = view.sel()[0] + text = view.substr(sel) + contents = sublime.get_clipboard() + view.replace(edit, sel, "" + contents + "["+text+"]") + + def is_enabled(self): + return bool(self.view.sel())