问题
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.
回答1:
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)
回答2:
- Option One, Go to the "View" menu and choose "Side Bar", then "Show Open Files"
- Option Two, There is a small plugin here https://github.com/rrg/ListOpenFiles
回答3:
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).
来源:https://stackoverflow.com/questions/38561302/is-there-a-shortcut-for-sublime-text-to-find-an-open-file-eclipse-ctrl-e