Skip to content

Mapping to include undo breakpoint <c-g>u before completion #1802

Answered by fitrh
GNRSN asked this question in Q&A
Discussion options

You must be logged in to vote

I think in your cmp mapping you can do something like this

mapping = {
  ['<C-i>'] = cmp.mapping({
    i = function(fallback)
      if cmp.visible() then
        local CTRLg_u = vim.api.nvim_replace_termcodes('<C-g>u', true, true, true)
        vim.api.nvim_feedkeys(CTRLg_u, 'n', true)
        return cmp.confirm({
          behavior = cmp.ConfirmBehavior.Insert,
          select = true,
        })
      end

      fallback()
    end,
  }),
}

Replies: 1 comment 1 reply

Comment options

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

Answer selected by GNRSN
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