sublime-sqlexec icon indicating copy to clipboard operation
sublime-sqlexec copied to clipboard

Focus the output panel with keyboard shortcut

Open Cottin opened this issue 10 years ago • 3 comments

First of all, great plugin!! :)

Second, the output gets displayed in some kind of "panel", I'm guessing by this code:

class Command:
    def __init__(self, text):
        self.text = text

    def _display(self, panelName, text):
        if not sublime.load_settings("SQLExec.sublime-settings").get('show_result_on_window'):
            panel = sublime.active_window().create_output_panel(panelName)
            sublime.active_window().run_command("show_panel", {"panel": "output." + panelName})
        else:
            panel = sublime.active_window().new_file()

        panel.set_read_only(False)
        panel.set_syntax_file('Packages/SQL/SQL.tmLanguage')
        panel.run_command('append', {'characters': text})
        panel.set_read_only(True)

Is there some way to focus this panel with a keyboard shortcut? Sometimes when the output gets large I want to be able to scroll in it and maybe do a ctrl+f in some large Desc Table results.

Cottin avatar Jul 03 '14 09:07 Cottin

You could make it output to a new window instead.. see https://github.com/jum4/sublime-sqlexec/issues/28

Works great!

TheunisKotze avatar Jul 03 '14 09:07 TheunisKotze

Ahh, nice one @TheunisKotze !

#28 in combination with a horizontal split worked quite nice.

For anyone interested in the split (makes the split and moves the tab you had opened to the group created underneath):

    // `,hs` horizontal split columns and move current tab into right column
    {
        "keys": [",", "h", "s"],
      "command": "run_multiple_commands",
      "args": {
        "commands": [
          {
            "command": "set_layout",
            "args": {
                        "cols": [0.0, 1.0],
                        "rows": [0.0, 0.5, 1.0],
                        "cells": [[0, 0, 1, 1], [0, 1, 1, 2]]
                    },
                    "context": "window"
                },
                {
                    "command": "move_group_focus",
                    "args": {"direction": "up"},
                    "context": "window"
                },
                {
                    "command": "move_to_group",
                    "args": { "group": 1 },
                    "context": "window"
                }
        ]
      }
    },

Cottin avatar Jul 03 '14 09:07 Cottin

Maybe the coup de grâce would be if the horizontal split was done automatically when executing the query :)

Cottin avatar Jul 03 '14 09:07 Cottin