Closed BODH1SATVA closed 6 months ago
I'm not sure about the specifics of your case, but I just thought I'd share that I was having a similar problem recently because I was trying to define the remap in a config file set in a snips.lua file in the "after" folder specifically for UltiSnips, like I do for most config stuff. I found that the
I ended up putting
vim.cmd([[
let g:UltiSnipsExpandTrigger = '<tab>'
let g:UltiSnipsJumpForwardTrigger = '<tab>'
let g:UltiSnipsJumpBackwardTrigger = '<s-tab>'
]])
in my init.lua and everything works fine now like I was trying to get it.
Perhaps doing separate commands for forward and expand would work? Or moving it to a piece of your config that initializes sooner, if you're having a problem I was having? I'm not exactly sure but I thought I'd share. Sorry I can't help more.
@AshyAspen I tried moving commands to init.lua file and tried separate commands. It still would not work. Thanks for suggestion though.
I also noticed that vim.g.UltiSnipsExpandTrigger
does not work in my case. I can't set anything other then <tab>
as an expand trigger.
I still don't have any idea what could be wrong here. I checked my config several times, all I have there is simple stuff like setting colorscheme, line numbers... and few other maps that don't use <tab>
(most of them are for normal mode anyway).
I have figured these out. I changed my ultisnips.lua file to have
return {"SirVer/ultisnips",
lazy = false,
init = function()
vim.g.UltiSnipsExpandOrJumpTrigger = '<tab>'
vim.g.UltiSnipsJumpBackwardTrigger = '<s-tab>'
end
}
Everithing works as it should now.
Glad you made it work. I do not use Neovim and it is officially not supported by UltiSnips, hence i could not have helped in either case.
I want to set
<tab>
for both to expand and jump forward but it seems likevim.g.UltiSnipsExpandOrJumpTrigger = '<tab>'
does not work. I thought that other maps could get in the way or it might be due to the conflict with other plugins, but I don't use<tab>
in any other maps and I have tried deleting other plugins (left only VimTex and UltiSnips), It still would not work. Later I found that this does not work for any keys not just for<tab>
.vim.g.UltiSnipsJumpBackwardTrigger = '<s-tab>'
works fine though.I use lazy.nvim as my plugin manager. I have tried updating UltiSnips but it says it's up to date.
I have tried more direct way and I changed my ultisnips.lua file inside my plugins folder to have
This works with other keys (
<c-k>
for example ) but not with<tab>
(also this does not remove default mappings obviously). When I try to set<tab>
this way and use command:imap<tab>
it gives me<C-R>=UltiSnips#ExpandSnippet()<CR>
instead of<C-R>=UltiSnips#ExpandSnippetOrJump()<CR>
.