autocommand: move ftplugin to autocommands

This commit is contained in:
Fabrice Mouhartem 2023-12-25 12:17:23 +01:00
parent a88aec9556
commit 5670348cfb
2 changed files with 20 additions and 10 deletions

View File

@ -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", "<Leader>ls", ":VimtexView<CR>", {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

View File

@ -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", "<Leader>ls", ":VimtexView<CR>", {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,
})