Skip to content

With autotrigger enabled, accept suggestion and move to a new line? #109

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

You must be logged in to vote

You can make your custom accept keymap for that:

require("copilot").setup({
  -- ...
  suggestion = { 
    keymap = {
      accept = false, -- disable default accept keymap
      -- ...
    },
    -- ...
  },
  -- ...
})

vim.keymap.set("i", "<M-l>", function ()
  require("copilot.suggestion").accept()

  -- extra newline
  vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<CR>", true, false, true), "n", false)
end, {
  desc = "[copilot] accept suggestion",
  silent = true,
})

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@raine
Comment options

Answer selected by MunifTanjim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants