TabbyML / tabby

Self-hosted AI coding assistant
https://tabby.tabbyml.com/
Other
21.37k stars 961 forks source link

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

Open meicale opened 10 months ago

meicale commented 10 months ago

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!

icycodes commented 10 months ago

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.

jbigler commented 9 months ago

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
}
icycodes commented 9 months ago

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:

metal3d commented 4 months ago

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

peterwilli commented 3 months ago

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!