1

I'm very new to neovim and I'm trying to set it up for LaTeX. I've been unable to indent in .tex files after changing tabstop and shiftwidth after using :set to set them both to 4. Specifically, my setup and what I've done are as follows:

Setup:

  1. Install neovim and used kickstart.nvim.

  2. Installed vimtex and vim-dispatch (following supercharged LaTeX using neovim)

  3. Changed tabstop and shiftwidth to 4 using :set.

To reproduce issue:

  1. Create a new .tex file.

  2. Enter insert mode and press tab.

  3. No indenting occurs, and I get the following error:

Error executing vim.schedule lua callback: ...al/share/nvim/lazy/LuaSnip/lua/luasnip/nodes/snippet.lua:1054: attempt to call method 'indent' (a nil value)
    stack traceback:
    ...al/share/nvim/lazy/LuaSnip/lua/luasnip/nodes/snippet.lua:1054: in function 'indent'
    ...al/share/nvim/lazy/LuaSnip/lua/luasnip/nodes/snippet.lua:716: in function 'trigger_expand'
    ...jack/.local/share/nvim/lazy/LuaSnip/lua/luasnip/init.lua:282: in function 'snip_expand'
    ...jack/.local/share/nvim/lazy/LuaSnip/lua/luasnip/init.lua:351: in function 'expand'
    ...jack/.local/share/nvim/lazy/LuaSnip/lua/luasnip/init.lua:394: in function 'jump'
    .../.local/share/nvim/lazy/blink.cmp/lua/blink/cmp/init.lua:341: in function <.../.local/share/nvim/lazy/blink.cmp/lua/blink/cmp/init.lua:341>

This issue does not arise with normal .txt files (i.e., I can entire insert mode and indent empty lines as expected). I've tried adjusting tabstop back to 8 and reinstalling neovim, but the issue persists.

Any help would be greatly appreciated.

1 Answer 1

1

My mistake was in a completely different place. In my ~/.config/nvim/LuaSnip directory, I had a tex.lua file which contained the following snippet:

s({ trig = '^', regTrig = false}, { fmta('_{<>}', { i(1) }) }),

I removed the extra pair of parentheses:

s({ trig = '^', regTrig = false}, fmta('_{<>}', { i(1) }) ),

and the error went away (after also fixing the trigger on the magic character ^).

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.