From 21aee0a482c87f1ef4cfbf99f620132ee9f2abc6 Mon Sep 17 00:00:00 2001 From: Viktor Gamov Date: Wed, 31 Jul 2013 16:12:36 -0400 Subject: [PATCH 1/2] added plugin Paste asciidoc link --- Default (OSX).sublime-keymap | 8 +++++++- adoc_paste_as_link.py | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 adoc_paste_as_link.py diff --git a/Default (OSX).sublime-keymap b/Default (OSX).sublime-keymap index baa415b..831d828 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/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()) From f3056466c4ab47d6e3dacc405e3d093a24339d35 Mon Sep 17 00:00:00 2001 From: Viktor Gamov Date: Tue, 5 Jan 2016 22:37:52 -0500 Subject: [PATCH 2/2] added Win and Linux keymap for past url --- Default (Linux).sublime-keymap | 6 ++++++ Default (OSX).sublime-keymap | 10 +++++----- Default (Windows).sublime-keymap | 6 ++++++ 3 files changed, 17 insertions(+), 5 deletions(-) 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 831d828..8297f4f 100644 --- a/Default (OSX).sublime-keymap +++ b/Default (OSX).sublime-keymap @@ -24,9 +24,9 @@ ] }, { "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"} - ] - } + [ + {"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"} + ] } ]