LuaSnip problem #198
-
Hi there! I'm trying to add LuaSnip to the SCNvim setup following this post and I'm changing the init.vim for the init.lua. I put this in the end of the luasnip.lua config file I copy pasted from here: I did the
I checked and they are really there, with their content and all. but then, when I save the buffer and Error detected while processing /home/skmecs/.config/nvim/lua/plugins/luasnip.lua:
E5113: Error while calling lua chunk: /home/skmecs/.config/nvim/lua/plugins/luasnip.lua:564: attempt to index field 'snippets' (a nil value)
stack traceback:
/home/skmecs/.config/nvim/lua/plugins/luasnip.lua:564: in main chunk In my scnvim.lua config file I put this: If I try vim.cmd [[
syntax enable
filetype plugin on
]]
local o = vim.o
local g = vim.g
local set = vim.opt
require "paq" {
"savq/paq-nvim"; -- Let Paq manage itself
"neovim/nvim-lspconfig"; -- Mind the semi-colons
"hrsh7th/nvim-cmp";
'hrsh7th/cmp-nvim-lsp';
'hrsh7th/cmp-buffer';
'hrsh7th/cmp-path';
'hrsh7th/cmp-cmdline';
'hrsh7th/nvim-cmp';
'L3MON4D3/LuaSnip';
'saadparwaiz1/cmp_luasnip';
'windwp/nvim-autopairs';
'numToStr/Comment.nvim';
'karb94/neoscroll.nvim';
'nvim-treesitter/nvim-treesitter';
'JoosepAlviste/nvim-ts-context-commentstring';
'nvim-treesitter/nvim-treesitter-context';
'p00f/nvim-ts-rainbow';
'nvim-treesitter/nvim-treesitter-refactor';
'nvim-treesitter/playground';
{ 'junegunn/fzf', run = './install --bin', };
'kyazdani42/nvim-web-devicons';
-- {'ibhagwan/fzf-lua', branch = 'main' };
'vijaymarupudi/nvim-fzf';
'davidgranstrom/scnvim';
'madskjeldgaard/fzf-sc';
{"lervag/vimtex", opt=true}; -- Use braces when passing options
"ellisonleao/gruvbox.nvim";
"tidalcycles/vim-tidal";
'zhou13/vim-easyescape';
'nvim-lualine/lualine.nvim';
}
g.mapleader = 'ö'
g.maplocaleader = ','
g.python2_host_prog = "/usr/bin/python2"
g.python3_host_prog = "/usr/bin/python3"
require ('skmecs.settings')
require ('skmecs.themes')
require ('plugins.easy-escape')
require ('plugins.nvim-cpm')
require ('plugins.autopairs')
require ('plugins.comment')
require('plugins.neoscroll')
require('plugins.lualine')
require('plugins.treesitter')
require('plugins.scnvim')
require('plugins.luasnip')
Everything but LuaSnip, playground and fzf-sc work fine. I'll make another Q for the latter. Thank you in advance for any direction pointed. bests, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi, I spotted two things from the config and error message.
snippet = {
engine = {
name = 'luasnip',
},
}, See this page for an overview off the default options, and check out the reference for detailed descriptions. Error detected while processing /home/skmecs/.config/nvim/lua/plugins/luasnip.lua:
E5113: Error while calling lua chunk: /home/skmecs/.config/nvim/lua/plugins/luasnip.lua:564: attempt to index field 'snippets' (a nil value)
stack traceback:
/home/skmecs/.config/nvim/lua/plugins/luasnip.lua:564: in main chunk This error message is not related to scnvim but to local ls = require'luasnip'
ls.snippets.supercollider = require'scnvim/utils'.get_snippets() |
Beta Was this translation helpful? Give feedback.
-
There seems to have been a breaking change in the LuaSnip API: L3MON4D3/LuaSnip#81 (comment) This works for me: ls.add_snippets('supercollider', {
s('sb', { t('s.boot;') }),
}, {
key = 'supercollider'
}) And ls.add_snippets('supercollider', require'scnvim.utils'.get_snippets()) ..to use the generated snippets. Note that this file is pretty big so adding the snippets it will affect the overall startup time of nvim. If you plan to use the generated snippets you might consider loading them by using an autocmd instead. |
Beta Was this translation helpful? Give feedback.
There seems to have been a breaking change in the LuaSnip API: L3MON4D3/LuaSnip#81 (comment)
This works for me:
And
..to use the generated snippets. Note that this file is pretty big so adding the snippets it will affect the overall startup time of nvim. If you plan to use the generated snippets you might consider loading them by using an autocmd instead.