Sublime Text是否有找到打开文件的快捷方式(Eclipse Ctrl + E)? [英] Is there a shortcut for Sublime Text to find an open file (Eclipse Ctrl + E)?
问题描述
Ctrl + P 可让我从所有项目文件中查找文件.
Ctrl+P of Sublime Text lets me find a file from all project files.
但是,重复的名称太多.我正在寻找Eclipse中的 Ctrl + E 之类的快捷键,因此我只需要在打开的文件中找到该文件即可.这样可以省去很多关键操作.也许叫做侧边栏过滤器"?
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"?
是2还是3都不重要.
推荐答案
易于实现的声音只需选择Tools >> Developer >> New Plugin...
并添加内容:
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)
然后将其保存到您的Package/User
文件夹中,并将其(或其他键绑定)添加到您的键盘映射中:
Afterwards save it into your Package/User
folder and add this (or an other keybinding) to your keymap:
{
"keys": ["ctrl+e"],
"command": "show_buffers"
},
(在ST3上测试)
这篇关于Sublime Text是否有找到打开文件的快捷方式(Eclipse Ctrl + E)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!