How do I open a specific file with a custom command palette entry or with a key binding aka shortcut key?
There are some files I open a lot but are not associated with any specific project. It would be useful to be able to open them quickly using the command palette or with a key binding.
It took a few minutes of trial and error to work out how but here's how to do it.
To add an entry in the command palette to open a specific file, add a modified version of the following template to your user Default.sublime-commands
file.
// Modify the caption "File Open: Whatever" to something
// appropriate and of course change the file path.
{ "caption": "File Open: Whatever", "command": "open_file",
"args": {"file": "/path/to/whatever"} },
To add a key binding to open a specific file, add a modified version of the following template to your user Default (OS).sublime-keymap
file.
// Modify the key bindings to what you want and change the file path.
{ "keys": ["ctrl+t", "ctrl+w"], "command": "open_file",
"args": {"file": "/path/to/whatever"} },
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With