Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to configure Ultisnips in init.lua #1505

Closed
Renormalisation opened this issue Nov 8, 2022 · 2 comments
Closed

How to configure Ultisnips in init.lua #1505

Renormalisation opened this issue Nov 8, 2022 · 2 comments

Comments

@Renormalisation
Copy link

Expected behavior:
setting vim.g.UltiSnipsJumpForwardTrigger = '' doesn't jump forward

Actual behavior:
Usual tab space in the insert mode

Steps to reproduce

  1. vim.g.UltisSnipsJumpForwardTrigger = '' inside init.lua

  • Operating System: Ubuntu 20.04
  • Vim Version: neovim 0.8
  • UltiSnips Version:
  • Python inside Vim:
  • Docker repo/vimrc:
@SirVer
Copy link
Owner

SirVer commented Dec 18, 2022

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.

@Thanatermesis
Copy link

@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

@SirVer SirVer closed this as completed Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants