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 VimwikiToggleListItem mapping to be replaced #1047

Merged
merged 3 commits into from
Nov 13, 2020

Conversation

deepredsky
Copy link
Contributor

@deepredsky deepredsky commented Nov 8, 2020

Currently VimwikiToggleListItem mapping cannot be removed but only new mapping
to it can be added. This commit will allow to add custom binding to this
function and release default mapping of <C-space> and <C-@>, which was how it
was before #686

Steps for submitting a pull request:

  • ALL pull requests should be made against the dev branch!
  • Take a look at CONTRIBUTING.MD
  • Reference any related issues.
  • Provide a description of the proposed changes.
  • PRs must pass Vint tests and add new Vader tests as applicable.
  • Make sure to update the documentation in doc/vimwiki.txt if applicable,
    including the Changelog and Contributors sections.

Currently VimwikiToggleListItem mapping cannot be removed but only new mapping
to it can be added. This commit will allow to add custom binding to this
function and release default mapping of <C-space> and <C-@>, which was how it
was before vimwiki#686
@tinmarino
Copy link
Member

I don't know why it was forced.
Thank you @deepredsky nice catch.

@tinmarino tinmarino merged commit 48baa1f into vimwiki:dev Nov 13, 2020
tinmarino pushed a commit that referenced this pull request Jan 15, 2021
A changed aimed to allow user configuration files to be able to override
all default mappings for the VimwikiToggleListItem plug did so by
removing the optional forth argument to vimwiki#u#map_key(). This
argument if set to 1 allows the same plug to be mapped to multiple keys
in the same mode. If not present only the first mapping takes effect and
all later attempts to map the plug in the same mode result in a no-op.
Thus allowing any user configuration to set it first and then 'skipping'
the defaults.

The change however did not account for that the default on Unix systems
was to map both <C-Space> _and_ <C-@> to VimwikiToggleListItem so the
change breaks this behavior, described in issue #1061.

Fix this by restoring the forth argument to vimwiki#u#map_key() to allow
multiple mappings to the same plug/mode but wrap it in a block to first
check if the user have overridden it or not. This goes back to how his
was handled before vimwiki#u#map_key() was added in [1].

1. 4106cb7 ("New option g:vimwiki_key_mappings to enable/disable key mappings.")

Fixes: 48baa1f ("Allow VimwikiToggleListItem mapping to be replaced (#1047)")
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
deepredsky pushed a commit to deepredsky/vimwiki that referenced this pull request Jan 16, 2021
jls83 pushed a commit to jls83/vimwiki that referenced this pull request Jan 17, 2023
* Allow VimwikiToggleListItem mapping to be replaced

Currently VimwikiToggleListItem mapping cannot be removed but only new mapping
to it can be added. This commit will allow to add custom binding to this
function and release default mapping of <C-space> and <C-@>, which was how it
was before vimwiki#686

* Update changelog + contributor list

* endi -> endif

Co-authored-by: Tinmarino <tinmarino@gmail.com>
jls83 pushed a commit to jls83/vimwiki that referenced this pull request Jan 17, 2023
A changed aimed to allow user configuration files to be able to override
all default mappings for the VimwikiToggleListItem plug did so by
removing the optional forth argument to vimwiki#u#map_key(). This
argument if set to 1 allows the same plug to be mapped to multiple keys
in the same mode. If not present only the first mapping takes effect and
all later attempts to map the plug in the same mode result in a no-op.
Thus allowing any user configuration to set it first and then 'skipping'
the defaults.

The change however did not account for that the default on Unix systems
was to map both <C-Space> _and_ <C-@> to VimwikiToggleListItem so the
change breaks this behavior, described in issue vimwiki#1061.

Fix this by restoring the forth argument to vimwiki#u#map_key() to allow
multiple mappings to the same plug/mode but wrap it in a block to first
check if the user have overridden it or not. This goes back to how his
was handled before vimwiki#u#map_key() was added in [1].

1. 4106cb7 ("New option g:vimwiki_key_mappings to enable/disable key mappings.")

Fixes: 48baa1f ("Allow VimwikiToggleListItem mapping to be replaced (vimwiki#1047)")
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
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.

None yet

2 participants