Skip to content

Commit

Permalink
Add vintageous_exit_app_when_quiting_last_window; When the last win…
Browse files Browse the repository at this point in the history
…dow is closed, quit Sublime Text completely
  • Loading branch information
haze committed Apr 23, 2022
1 parent 23f8379 commit f31e169
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Preferences.sublime-settings
Expand Up @@ -116,6 +116,9 @@
// When quitting the last window exit ST.
"vintageous_exit_when_quiting_last_window": true,

// When quitting the last window exit ST.
"vintageous_exit_app_when_quiting_last_window": true,

// Delegate configured keys to be handled by Sublime Text.
//
// For example to use native Sublime Text behaviour for ctrl+f:
Expand Down
5 changes: 5 additions & 0 deletions nv/window.py
Expand Up @@ -22,6 +22,8 @@
from NeoVintageous.nv.utils import set_selection
from NeoVintageous.nv.vim import status_message

import sublime


_LAYOUT_SINGLE_CELL = {
'cells': [[0, 0, 1, 1]],
Expand Down Expand Up @@ -244,9 +246,12 @@ def window_quit_view(window, **kwargs) -> None:
# Need to get the setting before quiting the the view because if closing the
# last view there may not be a view to get the setting from.
exit_when_quiting_last_window = get_setting(window.active_view(), 'exit_when_quiting_last_window')
exit_app_when_quitting_last_window = get_setting(window.active_view(), 'exit_app_when_quiting_last_window')

_close_view(window, **kwargs)

if len(sublime.windows()) == 1 and exit_app_when_quitting_last_window:
sublime.run_command('exit')
if len(window.views()) == 0 and exit_when_quiting_last_window:
window.run_command('close')

Expand Down

0 comments on commit f31e169

Please sign in to comment.