Open kentliau opened 8 years ago
I don't think it's possible in an easy and elegant way using the current API. We need an API to be able to read keybindings programmatically to find the bound keys, which as far as I know is not provided by SublimeText. You can ask SublimeHQ to add this feature.
If you install via Package Control on ST3 you can create Packages/FileBrowser/shortcuts.md
with your own content.
I think we should at least set correct keybindings in status-bar when renaming dynamically.
I think we should at least set correct keybindings in status-bar when renaming dynamically.
The Question is, can we?
@vovkkk thanks, just learned this.
@aziz reading dynamically from the key binding file is cool, for the time being I am good for just having a customized shortcuts.md
in my user package dir, and I just learned that I can do that. But why not read from the shortcuts.md
as well for the status bar message?
It feels very hacky. I want a more robust and reliable solution, not just a hack!
i stumble upon this FindKeyConflicts, it go through all the binding files. But for a specific package, is it only have to go through the package's default and user's key binding file right?
only have to go through the package's default and user's key binding file right?
No, keybinding can be anywhere.
I thought command has info about keybinding since ST show keys in menus dynamically, but apparently it does not.
some of the commands in command palette show the key binding even third party one
That is what I meant menu and command palette, but this info is not available programmatically it seems.
You can get all text command as list with sublime_plugin.text_command_classes
you can init command with c = sublime_plugin.text_command_classes[105](view)
(105 is an index i.e. the 106th command in the list)
you can print attributes of command pprint.pprint([(a, getattr(c, a)) for a in dir(c)])
All these steps can be done in console View
→Show Console
→ import sublime_plugin, pprint
You can look at sublime.py
and sublime_plugin.py
in the same directory as ST executable.
You will see that there is no any way in API to get keys for command.
You can create menu Packages/User/Main.sublime-menu
:
[
{
"id": "filebrowser",
"caption": "FileBrowser",
"children":
[
{ "command": "dired_rename_commit" },
{ "command": "dired_rename_cancel" },
{ "command": "dired_expand" }
]
}
]
I use different shortcut for rename mode to commit and discard changes due to I want esc to clear out multiple cursors not to undo.
I do by adding these shortcut to my user key binding
So now I want to customize the help file when press ? and the status bar help message down it the bottom of the windows. Can it like have another setting field to specify the custom
shortcuts.md
?