Sublime Forum

Close project Key Binding (Sublime Text 3)

#1

Hi,

in Sublime Text 2, you could add a “close project” keybinding like this:

{ "keys": "ctrl+alt+w"], "command": "close_project" }

In Sublime Text 3 though, this removes all folders from your project instead. Is this a bug or there’s another command I can use to close a project?

0 Likes

#2

Try “close_workspace” command. Efficient way to find out which command is executed on specific action: ctrl+` (show console), enter “sublime.log_commands(True)” and try to do stuff around. You’ll see list of commands are executed in console.

1 Like

#3

I know this is an old conversation, but I’m searching for how to close a project with a keybinding, and this is what comes up. I don’t understand the proposed solution here.

What is the simplest way to bind “Close Project” to a key combo?

0 Likes

#4

The post above is still the correct way to do this. In order to bind a key to do something you need to know the command, and if you don’t know the command BUT you know of a way to take that action by other means, then you can get Sublime to tell you.

Since Project: Close Project appears in the menu, there’s way to take the action. So, View > Show Console will open the sublime console, and inside of it sublime.log_commands(True) will turn on command logging, making Sublime tell you every command that it’s executing.

If you do that and then choose the menu item, it will log the close_workspace command, indicating that’s what you want in your key binds.

So you just need to bind a key to close_workspace and you should be good to go; the menu will even show you the binding you chose after you add one.

1 Like

#5

Oh, I get it now. I wasn’t understanding the other user’s explanation. Thanks again, OdatNurd.

0 Likes