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

possible ignore_missing bug #62

Closed
rmagillxyz opened this issue May 11, 2021 · 9 comments
Closed

possible ignore_missing bug #62

rmagillxyz opened this issue May 11, 2021 · 9 comments

Comments

@rmagillxyz
Copy link

While ignore_missing = true and in insert mode, a single press of the <LocalLeader> key outputs <c-r>+<LocalLeader>.

e.g. If LocalLeader is set to ,, <c-r>+, is output, and changing the local key just changes the last output char, but if an actual local leader binding is used it works as expected.

the binding causing this is <Cmd>lua require("which-key").show(",", {mode = "i", auto = true})<CR>

I was able to fix this and stop the output by setting the triggers array to anything but auto.

@folke
Copy link
Owner

folke commented May 11, 2021

This is quite embarrassing. When the WK popup opens, we save the register used to perform the action, to feed it back once we have a full key sequence.

For some weird reason I figured it was a good idea to do this with <c-r> in INSERT mode, which would actually paste that register. Or in this case tried to paste the default register +.

Pasting also miserably failed since the <c-r> sequence wasn't properly escaped by terminal codes.

Either way, this is simply not needed in INSERT mode, so I removed that part.

Should be working as expected now. With or without ignore_missing = true

@jssteinberg
Copy link

jssteinberg commented May 11, 2021

Maybe it's not fixed ... This could be related, in insert mode, my custom mapping for <esc> is qq. If I only write one "q" (so I don't escape), "<c-r>+q" is output. EDIT: wait, I didn't realize you responded 1 hour ago. I just updated Whichkey. It works! With and without ignore_missing = true.

@rmagillxyz
Copy link
Author

rmagillxyz commented May 12, 2021

@folke Absolutely no need for embarrassment. I appreciate the fix. Hey, just curious, since you're from Belgium, is your native tongue Dutch or French?

@folke
Copy link
Owner

folke commented May 12, 2021

@rmagillxyz dutch 🙂

@Maswor
Copy link

Maswor commented Jun 19, 2021

ignore_missing: true still trigger z suggestion even if set:

                ignore_missing = true,
                marks = false,
                registers = false,
                spelling = false,
                presets = {
                    operators = false,
                    motions = false,
                    text_objects = false,
                    windows = false,
                    nav = false,
                    z = false,
                    g = false,
                },

@folke
Copy link
Owner

folke commented Jun 19, 2021

@Maswor ignore_missing is a top level options, please refer to the docs

@Maswor
Copy link

Maswor commented Jun 19, 2021

@folke : I did, mine is basically like this:

    use {
        "folke/which-key.nvim",
        config = function()
            vim.opt.timeoutlen=500
            local wk = require("which-key")
            wk.setup {
                ignore_missing = true,
                marks = false,
                registers = false,
                spelling = false,
                presets = {
                    operators = false,
                    motions = false,
                    text_objects = false,
                    windows = false,
                    nav = false,
                    z = false,
                    g = false,
                },
                layout = {
                    height = { min = 1, max = 25 },
                    width = { min = 1, max = 100 },
                    spacing = 3,
                    align = "center",
                },
                window = {
                    border = "double",
                    position = "bottom",
                    margin = { 0, 0, 0, 0 },
                    padding = { 0, 0, 0, 0 },
                },
            }
            wk.register({
                name = 'Single level map',
                a = 'Actions',
                b = 'Buffer',
                c = 'Command',
                d = 'Diagnostics',
                f = 'Files',
                g = 'Grep',
                i = 'Lines',
                l = 'CocList',
                o = 'Outline',
                r = 'Resume Coc',
                s = 'Symbols',
                e = 'Explorer',
                m = 'Commit',
                t = 'Commits',
            }, {prefix = " "})
}

@folke
Copy link
Owner

folke commented Jun 19, 2021

@Maswor again, please check the docs. Presets etc should be under plugins, not top-level. The docs describe exactly what structure is expected. Anything else won't work.

@Maswor
Copy link

Maswor commented Jun 19, 2021

I've got it working now. Thank you!

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

No branches or pull requests

4 participants