Skip to content

Include Keymaps in result #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Default.sublime-commands
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"command": "pref_toggle_setting_file"
},
{
"caption": "Preference Helper: Open *.sublime-settings",
"caption": "Preference Helper: Open *.sublime-settings and *.sublime-keymap",
"command": "pref_open_setting_file"
},
{
Expand Down
3 changes: 2 additions & 1 deletion Preference Helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ class PrefOpenSettingFileCommand(sublime_plugin.WindowCommand):

def run(self):

resources = [resource[9:] for resource in find_resources("*.sublime-settings")]
resources = find_resources("*.sublime-settings") + find_resources("*.sublime-keymap")
resources = [resource[9:] for resource in resources]
def on_done(i):
if i >= 0:
self.window.run_command("open_file", { "file": "${packages}/%s" % resources[i]})
Expand Down
7 changes: 6 additions & 1 deletion preference_helper/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ def decode_value(string):
return json.loads("\n".join(lines))

def is_sublime_settings(view):
def corrct_syntax():
return view.match_selector(0, "source.json") or view.match_selector(0, "source.sublime-settings") or view.match_selector(0, "source.sublimekeymap")
def correct_ending():
return view.file_name().endswith(".sublime-settings") or view.file_name().endswith(".sublime-keymap")

try:
return view.match_selector(0, "source.json") and os.path.dirname(view.file_name()).startswith(sublime.packages_path()) and view.file_name().endswith(".sublime-settings")
return corrct_syntax() and os.path.dirname(view.file_name()).startswith(sublime.packages_path()) and correct_ending()
except:
return False

Expand Down