This is probably a long shot(?).
I’d like to run shell scripts on various files and folders by right clicking them on the sidebar file tree.
Run scripts from sidebar context-menu
You can add entries to that context menu, and have them call a plugin which then runs your shell script.
For an example, take a look at the Diff package (it adds a ‘Diff Files’ entry to the context menu when you select two files within an open folder)
Very cool feature that I had no idea existed. One thing I noticed is that the “Diff files…” option is only available if you select two files from open folders in the “Folders” area of the sidebar, but not if you select two files in the “Files” area of the sidebar. Would it be possible to enable diffing files in the “Files” area of the sidebar as well?
Another question is what magic is being used to only show the menu option when exactly two files are selected? There are no hints in “Side Bar.sublime-menu” that suggest how this might be done…
This is done by DiffFilesCommand.is_visible(), in diff.py
Customising the context menu for files is still on the todo list - it’s hard coded atm
Dynamic menu items
jps,
I am trying to run the diff command, in v2126, and it seems like there is a bug:
DiffFilesCommand.is_visible consistently only gets 1 file in the files parameter.
I have printed the files list, and it only has the last selected file. Sounds like a bug?
Extending SideBar, questions, suggestions
I was testing on v2126 on Ubuntu 10.04, where this was failing.
In v2126 on OSX 10.7, it seems to work fine.
Ok, with both v2126 and v2132, I’ve confirmed this on OSX 10.6 Snow Leopard and Ubuntu 10.04. There is only a single file being passed to the Diff function even though 2 files are selected.
The behavior does work correctly on OSX 10.7. Any ideas?