Sublime Forum

Navigating between open tabs via search

#1

Hi All,

Is there a keyboard shortcut to just navigate only between open tabs via ctrl+p like search. I understand ctrl+p can be used to do that today, but the question is more specifically to list only opened tabs. This is not about switching/cycling between tabs via ctrl+tab/ctrl+shift+tab or ctrl+pageup/ctrl+pagedown.

Thanks in advance,
Vineel

0 Likes

#2

In the default ST configuration, there is no way to do that.

So, I have made a quick plugin:

import sublime, sublime_plugin
import os

def viewStr(view):
	if view.name():
		return view.name()

	path = view.file_name()
	if view.settings().get('show_full_path'):
		return path

	return os.path.basename(path)

class SearchTabsCommand(sublime_plugin.WindowCommand):
	def __init__(self, window):
		self.views = []

		sublime_plugin.WindowCommand.__init__(self, window)

	def on_panel_done(self, i):
                if i == -1:
                    return

		self.window.focus_view(self.views[i])

	def run(self):
		self.views = self.window.views_in_group(self.window.active_group())

		activeViewIndex = self.views.index(self.window.active_view())
		strs = map(viewStr, self.views)

		self.window.show_quick_panel(list(strs), self.on_panel_done, sublime.KEEP_OPEN_ON_FOCUS_LOST, activeViewIndex)

Maybe I will put it on Package Control one day…

0 Likes

#3

https://packagecontrol.io/packages/ListOpenFiles
https://packagecontrol.io/packages/Show%20Open%20Files

1 Like

#4

Thank for the reply

0 Likes

#5

I think Tab Filter does exactly what you want. Just press shift+alt+p to fuzzy-find open tabs.

(Late reply I know, but I just stumbled upon this searching for the same feature.)

1 Like