Reputation: 831
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?
Upvotes: 11
Views: 2779
Reputation: 2334
Navigate the menu to key bindings:
Sublime Text -> Preferences -> Key Bindings
Two files, side by side, will open. The file on the right is for user settings. Add the following line:
{"keys": ["ctrl+shift+n"], "command": "clone_file"}
I am using ctrl+shift+n, but you can replace it with whatever shortcut you wish
Upvotes: 0
Reputation: 1927
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)
Upvotes: 4
Reputation: 341
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" }}
Upvotes: 7
Reputation: 6016
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.
Upvotes: 13