Lawrence Wagerfield
Lawrence Wagerfield

Reputation: 6621

How do I assign Sublime key mappings for commands in the sidebar context menu?

When browsing files in the Sublime sidebar, I would like to quickly access the commands available in the context menu via shortcuts. E.g. Delete file, rename file/folder, new file/folder.

(FYI: super+N is not an ideal solution for creating new files - it isn't context aware and will usually choose an inappropriate default location).

Upvotes: 0

Views: 206

Answers (1)

skuroda
skuroda

Reputation: 19754

You can enable command logging by inserting the following into the console sublime.log_commands(True). This will give you the commands and arguments being executed. You can then create a key binding with the appropriate command. My guess is the commands will use some sort of path, so you may need to write a small plugin to inject the correct paths for the various commands.

For new file creation specifically, you may want to take a look at AdvancedNewFile. Disclaimer - I'm the current maintainer of the plugin. I've tried to make it a more flexible than it originally was, with regards to specifying where to create the file. Though if you do decide to use it and have feature request, feel free to create an issue about it.

Upvotes: 1

Related Questions