diff --git a/ftplugin/tex.lua b/ftplugin/tex.lua deleted file mode 100644 index 8e220af..0000000 --- a/ftplugin/tex.lua +++ /dev/null @@ -1,10 +0,0 @@ --- vimtex configuration -vim.g.vimtex_view_method = 'zathura' -vim.g.maplocalleader = ' ' --- Legacy shortcut from my vim-latexsuite days -vim.api.nvim_set_keymap("n", "ls", ":VimtexView", {noremap = true, silent = true, desc = 'View [L]atex Document'}) - -vim.o.foldmethod = 'expr' -vim.o.foldexpr='vimtex#fold#level(v:lnum)' -vim.o.foldtext='vimtex#fold#text()' -vim.o.spell = true diff --git a/lua/autocommands.lua b/lua/autocommands.lua index 00c3e99..4aa7f46 100644 --- a/lua/autocommands.lua +++ b/lua/autocommands.lua @@ -46,3 +46,23 @@ vim.api.nvim_create_autocmd({"OptionSet"}, { end end }) + +-- LaTeX configuration +local texgroup = vim.api.nvim_create_augroup("latex", { clear = true }) + +vim.api.nvim_create_autocmd("FileType", { + pattern = {"latex"}, + group = texgroup, + callback = function() + -- vimtex configuration + vim.g.vimtex_view_method = 'zathura' + vim.g.maplocalleader = ' ' + -- Legacy shortcut from my vim-latexsuite days + vim.api.nvim_set_keymap("n", "ls", ":VimtexView", {noremap = true, silent = true, desc = 'View [L]atex Document'}) + + vim.o.foldmethod = 'expr' + vim.o.foldexpr='vimtex#fold#level(v:lnum)' + vim.o.foldtext='vimtex#fold#text()' + vim.o.spell = true + end, +})