'Keyboard short-cut for New file for Sidebar Enhancement plugin in Sublime text
I want that if I press Ctrl + n I should have same functionality as when I right on my side bar and do new file i.e. I should be asked to put in a file name.
I know Ctrl + 0 will focus me on the sidebar. But still takes too many steps.
Or any other method since I only want to put in a file name with extension when new file is opened otherwise it won't syntax highlight my code.
Solution 1:[1]
Open: Preferences -> Package Settings -> Side Bar -> Key Bindings - User
Paste this:
[
{
"keys": ["ctrl+alt+n"],
"command": "side_bar_new_file"
},
]
Bonus shortcut:
{
"keys": ["f2"],
"command": "side_bar_rename"
}
Solution 2:[2]
AdvancedNewFile worked perfect for my purpose. Just a Ctrl + Alt + n voila you are done.
Hope it helps somebody.
Solution 3:[3]
Tested on: Sublime Text Build 4113
For package FileManager.
Open: Preferences -> Key Bindings - User
Paste this code:
[
{
"keys": ["ctrl+alt+n"],
"command": "fm_create",
"args": { "initial_text": "$here/" }
},
]
Note:
"args": { "initial_text": "$here/" }
allows you to create the new file on the same route as the current file (thaks OdatNurd).
Look at the"aliases"
section in Preferences -> Package Settings -> FileManager to see other Alias useful in addition to"$here/"
Then, press the assigned keys, this will open an input.
Write part of the name of an existing folder, and just press TAB to cycle through the auto completion.
If you want to create nested folders, write the names of the intermediate folders and pressing ENTER, these will be created.
If the last character you type in is a /
folder will be created. Otherwise it will be a file.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | hahahoho |
Solution 2 | ROOT |
Solution 3 |