Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Key binding for "New View into File"

Tags:

sublimetext3

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?

like image 634
Abrab Avatar asked Jun 17 '15 23:06

Abrab


3 Answers

I solved this by navigating to Sublime Text --> Preferences --> Key Bindings

<code>Sublime Text</code> --> <code>Preferences</code> --> <code>Key Bindings</code>

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

enter image description here

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)

like image 130
Micah Stubbs Avatar answered Dec 03 '22 06:12

Micah Stubbs


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.

like image 36
sergioFC Avatar answered Dec 03 '22 07:12

sergioFC


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" }}
like image 38
Simon1901 Avatar answered Dec 03 '22 06:12

Simon1901