Sublime Forum

Confirmation for "Remove Folder from Project"

#1

I often find myself accidentally clicking on the “Remove Folder from Project” menu item since it’s right below “Find in Folder…”. It would be great if there was a confirmation dialog for this, or if Undo would add the folder back to the project.

1 Like

#2

you can achieve this with a really simple plugin:

import sublime
import sublime_plugin


class RemoveFolderConfirmationListener(sublime_plugin.EventListener):
    def on_window_command(self, window, command, args):
        if command == 'remove_folder':
            if not sublime.ok_cancel_dialog('Are you sure you want to remove folder {}?'.format(args['dirs']), 'Yes'):
                return ('noop', args)
4 Likes

Add confirm disalog for Remove Folder from Project
#3

Woah, I think you might have given me the nudge towards learning how to write ST plugins. Thanks a ton.

0 Likes

#4

Aside: I use the Side Bar Enhancements plugin/package. This does at least separate the “Remove Folder from Project” option so it is less easily clicked. (It also provides a ton of useful context menu file operations).

0 Likes