Is it possible to use tab normally when suggestions aren't shown and to accept suggestions when they are? #153
-
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
Strangely enough, binding |
Beta Was this translation helpful? Give feedback.
-
You can have super-tab like behavior, e.g.: https://github.com/MunifTanjim/dotfiles/blob/6b5199346f7e96065d5e517e61e2d8768e10770d/private_dot_config/nvim/lua/plugins/cmp.lua#L48-L63 For example: vim.keymap.set('i', '<Tab>', function()
if require("copilot.suggestion").is_visible() then
require("copilot.suggestion").accept()
else
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Tab>", true, false, true), "n", false)
end
end, { desc = "Super Tab" }) |
Beta Was this translation helpful? Give feedback.
-
Hey @MunifTanjim I did this, but it still doesn't work can you please help return {
{
"zbirenbaum/copilot.lua",
cmd = "Copilot",
event = "InsertEnter",
config = function()
require("copilot").setup({ suggestion = { auto_trigger = true, keymap = { accept = false } } })
vim.keymap.set("i", "<Tab>", function()
if require("copilot.suggestion").is_visible() then
require("copilot.suggestion").accept()
else
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Tab>", true, false, true), "n", false)
end
end, { desc = "Super Tab" })
end,
},
} |
Beta Was this translation helpful? Give feedback.
-
$XDG_CONFIG_HOME/nvim/lua/plugins/copilot.lua:
Your help is much appreciated. Matthias |
Beta Was this translation helpful? Give feedback.
You can have super-tab like behavior, e.g.: https://github.com/MunifTanjim/dotfiles/blob/6b5199346f7e96065d5e517e61e2d8768e10770d/private_dot_config/nvim/lua/plugins/cmp.lua#L48-L63
For example: