Skip to content

Is it possible to use tab normally when suggestions aren't shown and to accept suggestions when they are? #153

Answered by MunifTanjim
Roundlay asked this question in Q&A
Discussion options

You must be logged in to vote

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" })

Replies: 4 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@Roundlay
Comment options

@carmilso
Comment options

@MunifTanjim
Comment options

Answer selected by Roundlay
Comment options

You must be logged in to vote
3 replies
@MunifTanjim
Comment options

@mikkybang
Comment options

@MunifTanjim
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants