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
Use <plug> mappings instead of global variables #186
Comments
Hmm, possibly, yeah. I'm not completely opposed to this at all, but I'd consider it lower priority than the mountain of other things I want to get to 🤔 I hadn't thought of checking for existing definitions as a way to allow mapping with defaults before, makes sense. I haven't really ever integrated plug mappings into my plugins, but I can see the appeal. I went with my own config system to keep things consistent within Conjure: All config for the entire plugin is done in the same way. I suppose this would simplify some things in a few ways. Consider the idea in my head, I'll see what I make of it after some more development. I feel like it'll be a pretty delicate thing to integrate in a way I'm happy with + being backwards compatible for a time + warning. So maybe I'll at least write up the plan here some day, then if I get around to it or someone else does it'll fit into my idea of the architecture. I need to make it fit well with the core mappings as well as every client, so there will be some edge cases to think through... I think. Maybe macros will help. |
Yeah, This isn't really top priority. It's just to keep things tidy. A map can have the same implementation as a command, and it works with I also assumed it would be easier to change. I didn't know aniseed had it's own module system (?) and used nvim.lua. That tripped me up. Hopefully upgrading to nvim 0.5 in the future will simplify some stuff. |
It breaks my binds, literally even after all the configuration is done conjure swoops in and breaks it. How do I stop it from messing with the K key? This bind works except when conjure is enabled. Also how do I set mapping using lua? Using vimscript in the middle of lua configuration file is awkward. |
@Rawieo you can disable a mapping entirely by setting it to false. Lines 229 to 231 in 2482871
You can configure that from Lua with: vim.g.conjure#mapping#doc_word = false An overhaul of the config system to use the "modern" Lua style of So that'll be on another branch some time soon. |
@Olical that's quite helpful, thank you very much! |
I successfully used vim.g["conjure#mapping#def_word"] = false (Based on nanotee/nvim-lua-guide#66 (comment)) |
That's even better! Thank you for your suggestion |
Conjure currently uses global variables for user-defined mappings, which is a bit unconventional. Vim already provides a mechanism for this. See
:h <Plug>
and:h 41.11
(/MAPPING
).Using
<Plug>
is more versatile because users can remap keys as they prefer, including remapping to other modes. It's also easy to check whether the mapping has already been defined.I don't think this is that big of a change, so I'd be interested in contributing it myself. The global variables can stay for backwards compatibility of course.
The text was updated successfully, but these errors were encountered: