Skip to content

Set cursor to foo()| instead of foo(|) with no function parameters #1744

Answered by Sam-programs
GordianDziwis asked this question in Q&A
Discussion options

You must be logged in to vote
         cmp.event:on(
            'confirm_done',
            cmp_autopairs.on_confirm_done()
         )
         local kind = cmp.lsp.CompletionItemKind
         cmp.event:on('confirm_done', function(event)
            local entry = event.entry
            local item = entry:get_completion_item()
            local functionsig = item.label
            if  item.kind == kind.Function or item.kind == kind.Method then
               if functionsig:sub(#functionsig - 1, #functionsig) == '()' then
                  vim.api.nvim_feedkeys(
                     vim.api.nvim_replace_termcodes('<C-g>U<right>',true,false,true)
                     , "n", false)
               end
            end

Replies: 1 comment 1 reply

Comment options

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

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