[go: up one dir, main page]

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

Allow us to disable the default keymappings easily #248

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

Conversation

aileot
Copy link
@aileot aileot commented Feb 29, 2020

Before the PR, the default keymappings sometimes annoyed us, who would like to use s as vim's default (the synonym for cl) and so on.

@justinmk
Copy link
Owner

This makes no sense. And plugins that have this kind of option are broken.

Sneak will not map s if the user has mapped <Plug>Sneak_s/S to anything else:

nmap ? <Plug>Sneak_s
nmap ? <Plug>Sneak_S

If that's too much work, then why have Sneak installed in the first place? Its entire purpose is to provide a mapping. If you don't like the default mapping then you need to choose a different mapping (as shown above). So a "disable mappings" option makes no sense.

@justinmk justinmk closed this Feb 29, 2020
justinmk added a commit that referenced this pull request Feb 29, 2020
@justinmk
Copy link
Owner

Added documentation :help sneak-disable-mappings in 0841477

@aileot
Copy link
Author
aileot commented Mar 1, 2020

You seems to have overlooked some users

  1. who want to map only with sneak#wrap() flexibly, but without <Plug>Sneak_foo
  2. who want to use Sneak only buffer-locally, like readonly-buffer or in specific filetype/buftype
  3. who only want to use <Plug>Sneak_f/t or <Plug>SneakLabel_s and so on, but without <Plug>Sneak_s

I may also overlook other problems which the feature solve.

Isn't it an easiest, certain way for Sneak users to understand in the analogy of other vim-plugins which have g:foo#no_default_mappings? Or do you have any other reasons to cling to the current, smartest way?

@justinmk
Copy link
Owner
justinmk commented Mar 1, 2020

Thanks, that is a good list of use cases. In those cases user is going to a lot of trouble already, so this is not much more trouble:

map <f99> <Plug>Sneak_s<Plug>Sneak_S
map! <f99> <Plug>Sneak_s<Plug>Sneak_S

However it's definitely obscure. Sneak has a bunch of weird options already so I guess I will cave here.

@justinmk justinmk reopened this Mar 1, 2020
@@ -259,6 +259,13 @@ OPTIONS *sneak-options*
To change an option, add a |let| statement in your |vimrc|. Example: >
let g:sneak#use_ic_scs = 0
<
g:sneak#no_default_mappings = 0
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flip it so it is "positive logic"

Suggested change
g:sneak#no_default_mappings = 0
g:sneak#default_mappings = 1

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the negative one here because it sounds natural for me (at least) to be set to 0 as default, and user will set it to 1 to turn on especially when an option expects either 0 or 1 as "OFF" or "ON".

Addition to that, I usually unify default values to be set to 0 unless the variable has specific reason to be other than 0; such unification reduces unnecessary chances that users should grep default values.

However, I also know positive logic is preferable in most cases so that it's a matter of taste after all. Please adopt the one on your preference.

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.

2 participants