Set cursor to foo()| instead of foo(|) with no function parameters #1744
Answered
by
Sam-programs
GordianDziwis
asked this question in
Q&A
Replies: 1 comment 1 reply
-
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
end) this should work |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
GordianDziwis
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have nvim-autopairs and lsp-signature for handling function signatures.
But on a function, that does not have any parameters, the cursor is after completion inside the parameters brackets:
foo(|)
but it should be like this:foo()|
The building blocks are there, but I do not know how to achieve this functionality.
Beta Was this translation helpful? Give feedback.
All reactions