Skip to content

Instantly share code, notes, and snippets.

@g8up
Created June 3, 2017 07:05
Show Gist options
  • Save g8up/405c9372512be540cd6bfe13a49ce6e1 to your computer and use it in GitHub Desktop.
Save g8up/405c9372512be540cd6bfe13a49ce6e1 to your computer and use it in GitHub Desktop.
SublimeText3 增强:自动填充已选文本到`Ctrl + P`面板
# 增强 Ctrl + P 快捷键功能
# 当选择一个资源路径,并按 Ctrl + P 时,可自动将选择文本填充到面板,
# 你只需回车即可直接跳转到文件
# 配置:
# 1、Preferences -> Key Bindings 添加:
#
# [{
# "keys": ["ctrl+p"],
# "command": "show_goto_overlay_with_selection"
# }]
# 2、本文件置于 Preferences -> Browser Packages 弹出的目录下
# @author https://gist.github.com/g8up
import sublime_plugin
class ShowGotoOverlayWithSelectionCommand(sublime_plugin.WindowCommand):
def run(self):
window = self.window
view = window.active_view()
text = view.substr(view.sel()[0])
window.run_command("show_overlay", {
"overlay": "goto",
"show_files": True,
"text": text
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment