tabby icon indicating copy to clipboard operation
tabby copied to clipboard

Can not setup <tab> keybinding to accept code in lazyvim

Open meicale opened this issue 2 years ago • 5 comments

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 to accept the code gennerated. Information about your version Please provide output of 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!

meicale avatar Nov 22 '23 03:11 meicale

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.

icycodes avatar Nov 22 '23 05:11 icycodes

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
}

jbigler avatar Dec 28 '23 04:12 jbigler

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 the VimEnter event. 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.

icycodes avatar Jan 08 '24 11:01 icycodes

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

metal3d avatar May 28 '24 09:05 metal3d

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!

peterwilli avatar Jul 02 '24 20:07 peterwilli