I'd like to customize a key binding for "New View into File" (that appears in the "File" menu) in Sublime Text 3, but I can't figure out what to set for command
:
{"keys": ["ctrl+alt+v"], "command": "???"}
According to https://www.sublimetext.com/docs/commands, I would expect clone
, but it doesn't seem to work, nor a few other expressions that I tried.
Who knows the trick?
I solved this by navigating to Sublime Text
--> Preferences
--> Key Bindings
and then adding the line
{ "keys": ["super+shift+x"], "command": "clone_file" }
to the Default (OSX).sublime-keymap
file that Sublime Text 3 opens for you when you click Key Bindings
my Default (OSX).sublime-keymap
file now looks like this
now I save my Default (OSX).sublime-keymap
file and voila, cmd+shift+x
now opens a New View into File
🎉
(a note - the super
key in this Sublime Text 3 key binding maps to the cmd
key on the Mac)
The command you are looking for is clone_file
.
You can see the commands asociated to sublime menus (main menu, side bar context menu, etc) inside the files with extension .sublime-menu located inside Sublime Text 3\Packages\Default.sublime-package. In this case the main menu file name is Main.sublime-menu.
Usually I find this Sublime Text Unofficial Documentation better and more complete than the original, it includes this command.
to find what command that is doing it, you open the console
ctrl + `
View > Show Console
and type/paste "sublime.log_commands(True)"
sublime.log_input(True) # start logging input
sublime.log_input(False) # stop logging input
sublime.log_commands(True) # start commands input
sublime.log_commands(False) # stop commands input
here is output from to commands
command: left_delete
command: show_overlay {"overlay": "command_palette"}
if you want to set a new keyboard shortcut
{"keys": ["ctrl+alt+v"], "command": "left_delete"}
{"keys": ["ctrl+alt+b"], "command": "left_delete", "args": {"overlay": "command_palette" }}
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