diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index 59331b4d8..46f76c83b 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -178,6 +178,7 @@ Changed * `run-macro` -> `macro-run` * `record-macro` -> `macro-record` * `buffer` -> `tab-select` + * `open-editor` -> `edit-text` - Various performance improvements, including for the startup time. Fixed diff --git a/doc/help/commands.asciidoc b/doc/help/commands.asciidoc index cc9c4cb2f..d6bf5d357 100644 --- a/doc/help/commands.asciidoc +++ b/doc/help/commands.asciidoc @@ -60,6 +60,7 @@ possible to run or bind multiple commands by separating them with `;;`. |<>|Remove the last/[count]th download from the list. |<>|Retry the first failed/[count]th download. |<>|Open an editor to modify the current command. +|<>|Open an external editor with the currently selected form field. |<>|Navigate to a url formed in an external editor. |<>|Enter a key mode. |<>|Send a fake keypress or key string to the website or qutebrowser. @@ -85,7 +86,6 @@ possible to run or bind multiple commands by separating them with `;;`. |<>|Open typical prev/next links or navigate using the URL path. |<>|Do nothing. |<>|Open a URL in the current/[count]th tab. -|<>|Open an external editor with the currently selected form field. |<>|Print the current/[count]th tab. |<>|Add a new quickmark. |<>|Delete a quickmark. @@ -492,6 +492,12 @@ Open an editor to modify the current command. ==== optional arguments * +*-r*+, +*--run*+: Run the command if the editor exits successfully. +[[edit-text]] +=== edit-text +Open an external editor with the currently selected form field. + +The editor which should be launched can be configured via the `editor.command` config option. + [[edit-url]] === edit-url Syntax: +:edit-url [*--bg*] [*--tab*] [*--window*] [*--private*] [*--related*] ['url']+ @@ -915,12 +921,6 @@ The tab index to open the URL in. ==== note * This command does not split arguments after the last argument and handles quotes literally. -[[open-editor]] -=== open-editor -Open an external editor with the currently selected form field. - -The editor which should be launched can be configured via the `editor.command` config option. - [[print]] === print Syntax: +:print [*--preview*] [*--pdf* 'file']+ diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index cf7bf5561..e1a241658 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -203,7 +203,7 @@ |<>|Default program used to open downloads. |<>|Where to show the downloaded files. |<>|Duration (in milliseconds) to wait before removing finished downloads. -|<>|Editor (and arguments) to use for the `open-editor` command. +|<>|Editor (and arguments) to use for the `edit-*` commands. |<>|Encoding to use for the editor. |<>|Handler for selecting file(s) in forms. If `external`, then the commands specified by `fileselect.single_file.command` and `fileselect.multiple_files.command` are used to select one or multiple files respectively. |<>|Command (and arguments) to use for selecting multiple files in forms. The command should write the selected file paths to the specified file, separated by newlines. @@ -532,7 +532,7 @@ Default: * +pass:[<Return>]+: +pass:[follow-hint]+ - +pass:[insert]+: -* +pass:[<Ctrl-E>]+: +pass:[open-editor]+ +* +pass:[<Ctrl-E>]+: +pass:[edit-text]+ * +pass:[<Escape>]+: +pass:[leave-mode]+ * +pass:[<Shift-Ins>]+: +pass:[insert-text -- {primary}]+ - +pass:[normal]+: @@ -2756,7 +2756,7 @@ Default: +pass:[-1]+ [[editor.command]] === editor.command -Editor (and arguments) to use for the `open-editor` command. +Editor (and arguments) to use for the `edit-*` commands. The following placeholders are defined: * `{file}`: Filename of the file to be edited. diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 9fd864158..213a5b5dc 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1447,8 +1447,8 @@ class CommandDispatcher: self._open(url, tab, bg, window) - def _open_editor_cb(self, elem): - """Open editor after the focus elem was found in open_editor.""" + def _edit_text_cb(self, elem): + """Open editor after the focus elem was found in edit_text.""" if elem is None: message.error("No element focused!") return @@ -1472,14 +1472,14 @@ class CommandDispatcher: ed.edit(text, caret_position) @cmdutils.register(instance='command-dispatcher', scope='window') - def open_editor(self): + def edit_text(self): """Open an external editor with the currently selected form field. The editor which should be launched can be configured via the `editor.command` config option. """ tab = self._current_widget() - tab.elements.find_focused(self._open_editor_cb) + tab.elements.find_focused(self._edit_text_cb) def on_file_updated(self, ed, elem, text): """Write the editor text into the form field and clean up tempfile. diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index 74ea37038..6c3839ef8 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -1200,7 +1200,7 @@ editor.command: placeholder: true default: ["gvim", "-f", "{file}", "-c", "normal {line}G{column0}l"] desc: | - Editor (and arguments) to use for the `open-editor` command. + Editor (and arguments) to use for the `edit-*` commands. The following placeholders are defined: * `{file}`: Filename of the file to be edited. @@ -3389,7 +3389,7 @@ bindings.default: tCu: config-cycle -p -u {url} content.cookies.accept all no-3rdparty never ;; reload insert: - : open-editor + : edit-text : insert-text -- {primary} : leave-mode hint: diff --git a/tests/end2end/features/editor.feature b/tests/end2end/features/editor.feature index 8aa17f90a..811e25c66 100644 --- a/tests/end2end/features/editor.feature +++ b/tests/end2end/features/editor.feature @@ -100,7 +100,7 @@ Feature: Opening external editors And I open data/editor.html And I run :click-element id qute-textarea And I wait for "Entering mode KeyMode.insert (reason: clicking input)" in the log - And I run :open-editor + And I run :edit-text And I wait for "Read back: foobar" in the log Then the javascript message "text: foobar" should be logged @@ -111,7 +111,7 @@ Feature: Opening external editors And I wait for "Entering mode KeyMode.insert (reason: clicking input)" in the log And I run :leave-mode And I wait for "Leaving mode KeyMode.insert (reason: leave current)" in the log - And I run :open-editor + And I run :edit-text And I wait for "Read back: foobar" in the log Then the javascript message "text: foobar" should be logged @@ -123,7 +123,7 @@ Feature: Opening external editors And I open data/editor.html And I run :click-element id qute-textarea And I wait for "Entering mode KeyMode.insert (reason: clicking input)" in the log - And I run :open-editor + And I run :edit-text And I wait until the editor has started And I set tabs.last_close to blank And I run :tab-close @@ -138,7 +138,7 @@ Feature: Opening external editors And I open data/editor.html And I run :click-element id qute-textarea And I wait for "Entering mode KeyMode.insert (reason: clicking input)" in the log - And I run :open-editor + And I run :edit-text And I wait until the editor has started And I save without exiting the editor And I wait for "Read back: foobar" in the log @@ -153,7 +153,7 @@ Feature: Opening external editors And I wait for "Leaving mode KeyMode.insert (reason: leave current)" in the log And I run :enter-mode caret And I wait for "Entering mode KeyMode.caret (reason: command)" in the log - And I run :open-editor + And I run :edit-text And I wait for "Read back: foobar" in the log And I run :leave-mode Then the javascript message "text: foobar" should be logged @@ -165,7 +165,7 @@ Feature: Opening external editors And I wait for "Entering mode KeyMode.insert (reason: clicking input)" in the log And I run :insert-text foo And I wait for "Inserting text into element *" in the log - And I run :open-editor + And I run :edit-text And I wait for "Read back: bar" in the log Then the javascript message "text: bar" should be logged