Can not setup <tab> keybinding to accept code in lazyvim
Describe the bug
A clear and concise description of what the bug is.
Can not setup keybinding in lazyvim, so the tab can not be used tabby --version
no need
Information about your GPU
Please provide output of nvidia-smi
no need
Additional context
Add any other context about the problem here.
I tried other key such as '9' and it can be used by this setting
--- lua
vim.g.tabby_keybinding_accept = '9'
I guess this may caused mainly by lazyvim(starter), but I think it is helpful to add some tips and tricks to solve this. Since lazyvim is a popular neovim distribution. Thx!
Hi, @meicale,
Thank you for reporting this issue. It seems that the bug occurs when the Tabby plugin attempts to remap the <Tab> key, which has been modified by lazyvim. Setting a non-<Tab> keybinding helps avoid this problem.
I will further investigate later and try to make it compatible with lazyvim.
Where are you setting the keybinding? I was able to remap the tabby keybinding within the lua table where I installed it.
// plugins/tabby.lua
return {
"TabbyML/vim-tabby",
event = "BufRead",
init = function()
vim.g.tabby_keybinding_accept = '<C-CR>'
end
}
Hi, all lazyvim users
I just updated the readme in #1173 with some known keymap conflicts that can cause the <tab> key to not work properly. There are two main reasons for this issue:
- Other lazily loaded plugins may overwrite the
<tab>keymap. The vim-tabby plugin maps keys and performs some other initialization tasks upon theVimEnterevent. However, if there are plugins loaded after this event, they might overwrite the keymap. - If the
<C-R>key has been mapped to a customized function, it can cause problems on inserting suggestion. The vim-tabby plugin internally utilizes the<C-R><C-O>command to insert the completion. If<C-R>is remapped, vim-tabby will not be able to insert completions properly.
The conflict is here https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/coding.lua#L121-L137
I don't know if there is a workaround other than setting another key for Tabby
I'm new to LazyVim and only been using it for less than a day, but my workaround was to disable that specific key from the coding.lua using overrides (this way you dont have to modify and keep track of upstream source code):
-- Avoids conflict with Tabby
return {
{
"nvim-cmp",
keys = {
{ "<Tab>", mode = { "i", "s" }, false },
},
},
}
This does disable tab for the snippet function, I don't use it but if you're attached to it, you can remap it to another key!