Skip to content

Commit

Permalink
fix: setting typo "quiting" should be "quitting"
Browse files Browse the repository at this point in the history
Rename setting to fix typo:

    vintageous_exit_when_quiting_last_window

to

    vintageous_exit_when_quitting_last_window

This is backwards compatible meaning both settings now currently work,
but all documentation now references the correct setting.

Re #953
Fix #819
  • Loading branch information
gerardroche committed Aug 11, 2023
1 parent 1472d77 commit ce3ba5f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt

### Deprecated

* [#819](https://github.com/NeoVintageous/NeoVintageous/issues/819): Setting vintageous_exit_when_quiting_last_window is deprecated, use vintageous_exit_when_quitting_last_window instead
* [#952](https://github.com/NeoVintageous/NeoVintageous/issues/952): Setting highlightedyank is deprecated, use vintageous_highlighted_yank instead
* [#952](https://github.com/NeoVintageous/NeoVintageous/issues/952): Setting highlightedyank_style is deprecated, use vintageous_highlighted_yank_style instead
* [#952](https://github.com/NeoVintageous/NeoVintageous/issues/952): Setting highlightedyank_duration is deprecated, use vintageous_highlighted_yank_duration instead
Expand Down
6 changes: 4 additions & 2 deletions Preferences.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,10 @@
// (ported from the vim-unimpaired plugin by @tpope).
"vintageous_enable_unimpaired": true,

// When quitting the last window exit ST.
"vintageous_exit_when_quiting_last_window": true,
// Controls the behaviour of commands like ZZ, :quit, :wq, etc. When set to
// `true`, quitting the last view will also exit Sublime Text. When set to
// `false`, Sublime Text remains open after closing the last view.
"vintageous_exit_when_quitting_last_window": true,

// Delegate configured keys to be handled by Sublime Text.
//
Expand Down
2 changes: 1 addition & 1 deletion nv/goto.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def _goto_modification(action: str, view, mode: str, count: int) -> None:
set_selection(view, a)
enter_normal_mode(view, mode)
else:
# TODO Remove DEPRECATED code, deprecated since build 3189
# @deprecated sinxe build 3189
view.run_command('git_gutter_' + action + '_change', {'count': count, 'wrap': False})
line = view.line(view.sel()[0].b)
if line.size() > 0:
Expand Down
17 changes: 11 additions & 6 deletions nv/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,19 @@ def set_internal_setting(obj, name: str, value) -> None:
_set_private(obj, name, value)


# @deprecated use get_setting() instead.
# @deprecated since v1.32 use get_setting() instead.
def get_setting_neo(view, name: str):
# @deprecated neovintageous_* settings.
# @deprecated since v1.32 neovintageous_* settings.
# The following is for backward compatibility.
if view.settings().has('neovintageous_%s' % name):
return view.settings().get('neovintageous_%s' % name)

return get_setting(view, name)


# @deprecated use get_setting() instead.
# @deprecated since v1.32 use get_setting() instead.
def get_setting_hly(view, name: str):
# @deprecated highlightedyank* settings.
# @deprecated since v1.32 highlightedyank* settings.
# The following is for backward compatibility.
old_name = name.replace('highlighted_yank', 'highlightedyank')
if view.settings().has(old_name):
Expand Down Expand Up @@ -172,8 +172,13 @@ def set_last_substitute_string(replacement: str) -> None:
set_session_value('last_substitute_string', replacement, persist=True)


def get_exit_when_quiting_last_window(view) -> bool:
return get_setting(view, 'exit_when_quiting_last_window')
def get_exit_when_quitting_last_window(view) -> bool:
# @deprecated since v1.32 use exit_when_quitting_last_window instead.
should_exit = get_setting(view, 'exit_when_quiting_last_window')
if should_exit is not None:
return should_exit

return get_setting(view, 'exit_when_quitting_last_window')


# Supports repeating the last search commands. For example the command ";"
Expand Down
8 changes: 4 additions & 4 deletions nv/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from NeoVintageous.nv.polyfill import set_selection
from NeoVintageous.nv.registers import get_alternate_file_register
from NeoVintageous.nv.settings import get_cmdline_cwd
from NeoVintageous.nv.settings import get_exit_when_quiting_last_window
from NeoVintageous.nv.settings import get_exit_when_quitting_last_window
from NeoVintageous.nv.ui import ui_bell
from NeoVintageous.nv.utils import clone_file
from NeoVintageous.nv.utils import create_pane
Expand Down Expand Up @@ -211,13 +211,13 @@ def _close_active_view(window, close_if_last=False) -> None:


def window_quit_view(window, **kwargs) -> None:
# Need to get the setting before quiting the the view because if closing the
# Need to get the setting before quitting 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_exit_when_quiting_last_window(window.active_view())
exit_when_quitting_last_window = get_exit_when_quitting_last_window(window.active_view())

_close_view(window, **kwargs)

if len(window.views()) == 0 and exit_when_quiting_last_window:
if len(window.views()) == 0 and exit_when_quitting_last_window:
window.run_command('close')


Expand Down

0 comments on commit ce3ba5f

Please sign in to comment.