How to configure Ultisnips in init.lua
Renormalisation opened this issue · 2 comments
Expected behavior:
setting vim.g.UltiSnipsJumpForwardTrigger = '' doesn't jump forward
Actual behavior:
Usual tab space in the insert mode
Steps to reproduce
- vim.g.UltisSnipsJumpForwardTrigger = '' inside init.lua
- Operating System: Ubuntu 20.04
- Vim Version: neovim 0.8
- UltiSnips Version:
- Python inside Vim:
- Docker repo/vimrc:
This issue was closed due to it only affecting Neovim and not core Vim.
Why is Neovim only best-effort?
UltiSnips maintenance is a lot of work. Reproducing bug reports is tedious, slow and error prone. The current maintainers have to limit their scope to provide a reasonable level of service to the community.
Neovim should work with any plugin that core vim works with. But in the past, Neovim support has been difficult for UltiSnips: It regularly had bugs that did not affect the core Vim distributions, i.e. Vim, gVim, MacVim, and Vim for Windows and its testing approach required a completely separate code path from core as well. Therefore, currently Neovim bugs are considered on a best effort basis.
UltiSnips is looking for an additional maintainer that is interested in bringing the Neovim level of service on par with core Vim. If you are interested in helping out, please reach out to SirVer.
@Renormalisation I'm trying to configure UltiSnips on nvim + nvchad, this is a piece of code that I was able to set up in order to make it working, note that if you use "lazy" you need to turn it off otherwise doesn't works, or just put the settings in the init instead of config/opts blocks, for example:
{
"SirVer/ultisnips",
init = function()
require("core.utils").lazy_load "ultisnips"
-- require("core.utils").load_mappings "ultisnips"
vim.g.UltiSnipsEditSplit = "horizontal"
vim.g.UltiSnipsExpandTrigger = "<c-j>" -- expand snippets using this hotkey
vim.g.UltiSnipsJumpForwardTrigger = "<c-j>"
vim.g.UltiSnipsJumpBackwardTrigger = "<c-k>" -- backwards jumps
vim.g.UltiSnipsListSnippets = "<c-l>" -- list available snippets for keyword
-- set the path for your ultisnip snippets
local ultisnips_snippets = vim.fn.expand('$HOME/.vim/UltiSnips') -- location of your snippets
vim.g.UltiSnipsSnippetDirectories = { ultisnips_snippets, "UltiSnips" }
end,
},
Also note that you need to not have disabled the python3 provider in neovim, and so the "python3-neovim" package installed (debian/bookworm)
I tried a bit but I have no time to see how to integrate it with the CMP plugin in a good way, there's an external plugin for it, but for now I'm simply happy having the "c-j" to trigger my keywords