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

unmap Select mode mappings (smap) before snippet expansion #128

Open
karamellpelle opened this issue Feb 25, 2024 · 1 comment
Open

unmap Select mode mappings (smap) before snippet expansion #128

karamellpelle opened this issue Feb 25, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@karamellpelle
Copy link

karamellpelle commented Feb 25, 2024

Problem Statement

I had some map (and noremap) in my .vimrc which also applies to Visual mode (:h map-table). Visual mode (vmap) consists of both xmap and smap.

nvim-snippy uses Select mode, so my map will also apply to Snippy expansion. Which caused a lot of problems since typing regular letters could map to a completely different action that destroyed the snippet expansion.

Ideas or possible solutions

Is it possible for nvim-snippy to unmap all smap (i.e. vmap too) settings before snippet expansion (and then map them back afterwords)? I'm not sure if NeoVim is capable of this, though.

Alternatives you have considered

I changed all map X (and noremap) to nmap X and xmap X (abandoning Select and Operator mode). But I've been really confused why nvim-snippy did not work properly. Maybe this feature can help other users too.

@karamellpelle karamellpelle added the enhancement New feature or request label Feb 25, 2024
@karamellpelle karamellpelle changed the title unmap mappings in Select mode (smap) before snippet expansion unmap Select mode mappings (smap) before snippet expansion Feb 25, 2024
@dcampos
Copy link
Owner

dcampos commented Jan 6, 2025

Is it possible for nvim-snippy to unmap all smap (i.e. vmap too) settings before snippet expansion (and then map them back afterwords)? I'm not sure if NeoVim is capable of this, though.

I believe it's possible, but I don't think it would be the best approach, since we would need to keep track of all mappings in order to restore them later.

I changed all map X (and noremap) to nmap X and xmap X (abandoning Select and Operator mode). But I've been really confused why nvim-snippy did not work properly. Maybe this feature can help other users too.

I agree that Select mode mappings being set by v is confusing, but unfortunately that's the how Neovim works. In my opinion, select mode should rarely share mappings with visual mode.

Instead of implementing a workaround, we could add an entry to the FAQ and docs explaining this behaviour. I think that would eliminate at least some of the confusion.

Sorry for the late response.

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

No branches or pull requests

2 participants