Hi all
On “find results” list I can double-click on any result and it navigates to the corresponding file and line.
Is there any way to achieve the same using keyboard? (I don’t mean sequential navigation with F4!)
regards for all
Find results: How to go to certain result with keyboard?
Open file from find results keyboard shortcut
Two years down, I think I am still facing same problem. I love using Buffer to list the search results than another file panel for it. After I hit F4 then Esc, I have hidden the search results buffer. I can always go back to results by click mouse on tiny “Switch Panel” on left-most side of status bar. But how can I do same with keyboard?
Thanks in advance !
Love Sublime so far…I think I am going to switch over from Eclipse…just need to sort out such small things…!
you can bind a key to the command show_panel
with arguments {"panel": "output.find_results"}
in your User keybindings to re-display the Find Results panel
@kingkeith, first, thanks a lot for quick reply.
I missed to inform that, I did use the key binding, it shows the search buffer, but the cursor/focus still remains in the source window ! How to change the focus as well?
thanks a lot.
I’m not sure it is possible unfortunately, though I’d love to be proven wrong!
I’ve had problems in the past doing the opposite - switching from a panel to the main document.
I’ve looked and the API only allows getting a View
object for an “output” panel, so it’s not possible to write a plugin to switch focus to a non-output panel like the “Find Results” AFAICT (unless the panel takes the focus when it is shown, but the Find Results panel doesn’t seem to do so).
my attempt at writing a plugin was:
import sublime
import sublime_plugin
class FocusActivePanelCommand(sublime_plugin.TextCommand):
def run(self, edit):
panel_name = self.view.window().active_panel()
if panel_name is not None:
panel = self.view.window().find_output_panel(panel_name)
if panel is not None:
panel.window().focus_view(panel)
Thanks buddy.
It is strange that people are not finding this issue to be problem. For it that means using mouse, which I avoid using as much I can. And in Eclipse I was able to do it well so far. Let’s see, this seems hurdle to move to ET for me now. I think if API works, that can save the day. I will try your code sometime anyway. Thanks.
It’s a shame that after these years this and system dialogs not being in focus (on mac) are the only things which stop me from a mouse-less experience
some update. I could get search buffer show up and change focus in that window…
import sublime
import sublime_plugin
class ShowSearchWindowCommand(sublime_plugin.WindowCommand):
def run(self):
sublime.active_window().run_command('show_panel', args={'panel': 'output.find_results'})
a = sublime.active_window().find_output_panel("find_results")
sublime.active_window().focus_view(a)
And keyboard mapping would be :
{ "keys": ["alt+s"], "command": "show_search_window"},
with this, I can open up search buffer with keyboard, navigate to some search line and hit F4 to go to that search. All this without using mouse…which is what I intended as primary goal.
Now, need to see if I can use “ENTER” key instead of “F4”. That would be much cleaner solution. Anyways sharing code as this would be useful to someone.