Sublime Forum

New/rename/delete item in sidebar shortcuts

#1

Please can we have a way to access the context menu commands for the sidebar via shortcuts?

I have considered writing an ApplicationCommand, but these commands require a ‘dirs’ argument and I’m uncertain how get the currently selected directory from the sidebar via the API.

(Note: super+n is not the same, it doesn’t take the context of the sidebar into account!)

0 Likes

#2

Look for a file named Context.sublime-menu (in the Default package). It contains the sidebar context menu items and their corresponding commands.

And to copy the currently selected directory to clipboard:

branch, leaf = os.path.split(self.view.file_name()) sublime.set_clipboard(branch)

0 Likes

#3

The above commands retrieve the path of the current buffer/view, not the expanded folder in the sidebar.

Consider this: no windows are open and you are expanding directories in the sidebar - I need to be able to retrieve the currently selected directory.

0 Likes