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

fix: correctly handle non-blink keymaps with string rhs #78

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

jose-elias-alvarez
Copy link
Contributor

Given the following config:

require("blink.cmp").setup({
    keymap = {
        select_prev = { "<S-Tab>" },
    },
})

vim.keymap.set("i", "<S-Tab>", "<C-o>A")

Pressing <S-Tab> in insert mode when the Blink window is not visible creates an error:

E5108: Error executing lua: Vim:E15: Invalid expression: "^OA"

The issue is that nvim_eval is unconditionally called on mapping.rhs, so this PR fixes the logic to only evaluate the result of <expr> mappings.

I also fixed a bug in the if mapping conditions, which are a little different in nvim-cmp because these fields are converted into boolean values.

As you noted in a comment, handling fallback keymaps correctly in all cases is tricky, but for the moment, this should at least unblock a common case.

@Saghen Saghen merged commit 1ad59aa into Saghen:main Oct 10, 2024
@Saghen
Copy link
Owner

Saghen commented Oct 10, 2024

Thanks!

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