Closed JoseConseco closed 3 years ago
Thanks for reporting,
I tried to create separate mapping
snoremap <tab> "<C-R>=UltiSnips#JumpForwards()<CR>"
but then using tab on $2 will create double-quote character for no reason (not sure why)
it should be, then it works
snoremap <Tab> <ESC>:call UltiSnips#JumpForwards()<CR>
I'm investigating why it doesn't work by the current mapping ...
Seems as of now, 's' map does not work as it mentioned from nvim-cmp
['<Tab>'] = cmp.mapping(function(fallback)
...
end, { "i", "s"}),
you can check like:
:verbose imap <tab>
it has the mapping, but
:verbose smap <tab>
it doesn't have any mapping. (actually, it had the mapping on the first time but I have no idea why the mapping was cleaned up)
For now, you can use as a workaround
snoremap <Tab> <ESC>:call UltiSnips#JumpForwards()<CR>
I will raise this issue with nvim-cmp author
Ok I found the the issue thanks to you and nvim-cmp author (no need to contact him, as this was UltiSnip problem). I will paste the fix here for other people:
we have to use :
vim.fn.feedkeys(t("<esc>:call UltiSnips#JumpForwards()<CR>"))
For tab jumping to work in both insert and select mode (even though UltiSnip is using two separate mappings - not sure why, but single line above works in nivm-cmp for both modes)
Tab still wont work, but in file linked above I found variable UltiSnipsRemoveSelectModeMappings
and bingo - UltiSnip was auto-removing tab mappings. We can disable this in Packer config:
use {'SirVer/ultisnips', requires='honza/vim-snippets',
config=function() vim.g.UltiSnipsRemoveSelectModeMappings = 0 end,}
Now tab mapping is not removed by UltiSnips, and we can jump in both insert and select mode
Hey, thanks, that was a good finding. I will update README for this.
I cant jump to next tabstop, unless I will fill the current one. For example for this snippet:
If I want to leave default value at $2, I press < tab > but it wont jump forward to $0 (only using ultiSnip build-in map < c-j > work for jump) . If I enter anything at $2, then I can < tab > jump forward no problem. It feels almost like I can jump only from insert mode (and select mode jump wont work)
My mappings:
I tried to create separate mapping
snoremap <tab> "<C-R>=UltiSnips#JumpForwards()<CR>"
but then using tab on $2 will create double-quote character for no reason (not sure why). I also tried remapping g:UltiSnipsJumpForwardTrigger to tab in ultisnips config, but then in conflicts with tab in cmp. Any ideas what is going on? WHy:
if vim.fn["UltiSnips#CanJumpForwards"]() == 1 then vim.fn.feedkeys(t("<C-R>=UltiSnips#JumpForwards()<CR>"))
wont jump to next tab if I wont fill in $2 ?