2

Ctrl+P of Sublime Text lets me find a file from all project files.

However, there are too many duplicated names. I’m looking for a shortcut key like Ctrl+E in Eclipse, so that I just need to find the file in my opened file. That would save a lot of key striking. Probably called “sidebar filter”?

Does not matter if it’s 2 or 3.

3 Answers 3

3

Sounds easy to implement just select Tools >> Developer >> New Plugin... and add the content:

import sublime_plugin
import os


def _show_name(name):
    return ([os.path.basename(name), name] if name
            else ["untitled", "untitled"])


class ShowBuffersCommand(sublime_plugin.WindowCommand):
    def run(self):
        window = self.window
        views = list(window.views())
        show_entries = [_show_name(v.file_name()) for v in views]

        def on_done(index):
            if index == -1:
                return
            window.focus_view(views[index])

        window.show_quick_panel(show_entries, on_done)

Afterwards save it into your Package/User folder and add this (or an other keybinding) to your keymap:

{
    "keys": ["ctrl+e"],
    "command": "show_buffers"
},

(Tested on ST3)

0
1
5
1

There is in Sublime Text a useful function called Goto Anything. You can access this by pressing Ctrl + P in Windows, and then you can search through any file located in a current project (to open a project, enable the sidebar, and drag and drop a folder from the explorer to the sidebar).

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.