Browse Source

improve close window command

master
Randy Lai 6 years ago
parent
commit
e2ab864da9
  1. 12
      Default (Linux).sublime-keymap
  2. 8
      Default (OSX).sublime-keymap
  3. 12
      Default (Windows).sublime-keymap
  4. 2
      README.md
  5. 17
      closewindow.py

12
Default (Linux).sublime-keymap

@ -1,6 +1,10 @@
[
{
"keys": ["ctrl+alt+p"],
"command": "project_manager"
}
{
"keys": ["ctrl+alt+p"],
"command": "project_manager"
},
{
"keys": ["ctrl+shift+w"],
"command": "project_manager_close_window"
}
]

8
Default (OSX).sublime-keymap

@ -1,6 +1,6 @@
[
{
"keys": ["super+ctrl+p"],
"command": "project_manager"
}
{
"keys": ["super+ctrl+p"],
"command": "project_manager"
}
]

12
Default (Windows).sublime-keymap

@ -1,6 +1,10 @@
[
{
"keys": ["ctrl+alt+p"],
"command": "project_manager"
}
{
"keys": ["ctrl+alt+p"],
"command": "project_manager"
},
{
"keys": ["ctrl+shift+w"],
"command": "project_manager_close_window"
}
]

2
README.md

@ -3,6 +3,8 @@ Project Manager for Sublime Text 3
Dont't have any idea what `*.sublime-project` and `*.sublime-workspace` are doing? Forget where the project files are? Project Manager will help organizing the project files for you. It is inspired by Atom's [Project Manager](https://atom.io/packages/project-manager).
Project Manager also improves the shortcut `ctrl+shift+w` on Windows and Linux so that it will behave similar to that on OSX.
![](https://raw.githubusercontent.com/randy3k/Project-Manager/master/pm.png)
If you like it, you could send me some tips via [![](http://img.shields.io/gittip/randy3k.svg)](https://www.gittip.com/randy3k).

17
closewindow.py

@ -0,0 +1,17 @@
import sublime_plugin
class ProjectManagerCloseWindow(sublime_plugin.WindowCommand):
def run(self):
if self.window.project_file_name():
# if it is a project, close the project
self.window.run_command('close_workspace')
else:
self.window.run_command('close_all')
# exit if there are dirty views
if any([v.is_dirty() for v in self.window.views()]):
return
# close the sidebar
self.window.run_command('close_project')
# close the window
self.window.run_command('close_window')
Loading…
Cancel
Save