Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method to enable/disable stabs at runtime #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

smemsh
Copy link
Contributor

@smemsh smemsh commented May 25, 2024

Stabs currently has no method to load/unload, so it's "always on" for the lifetime of the vim session. We want to be able to disable it. So this patch puts all the maps and autocommands into a function that will enable/disable them. It calls the enable function once at plugin load. After that, user can either toggle, disable, or enable.

this allows to "disable" and "enable" smart tabs, by putting all the
maps in functions.  we also have an autocommand we need to
install/uninstall during enable/disable
This allows only a single map to be used, driven by state retained in a
single global variable
@smemsh
Copy link
Contributor Author

smemsh commented May 26, 2024

amended the patch slightly:

  • changed to use a different variable g:stabs_active for toggle than the g:loaded_stabs already used to prevent script double-load, otherwise the guard functionality of that variable will not work
  • stopped the toggle function from toggling g:stabs_active itself, since this was already being done in the install/uninstall functions
  • guard against double-calling the install or uninstall functions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant