diff --git a/.config/nvim/after/ftplugin/tex.lua b/.config/nvim/after/ftplugin/tex.lua new file mode 100644 index 00000000..06af552c --- /dev/null +++ b/.config/nvim/after/ftplugin/tex.lua @@ -0,0 +1,4 @@ +vim.b.autoformat = false +vim.keymap.set("n", "test", function() + dd(vim.b.autoformat) +end) diff --git a/.config/nvim/lua/config/autocmds.lua b/.config/nvim/lua/config/autocmds.lua index beaa1b59..e060abd5 100644 --- a/.config/nvim/lua/config/autocmds.lua +++ b/.config/nvim/lua/config/autocmds.lua @@ -7,14 +7,20 @@ -- but disable it for normal mode commands like `o` -- vim.g.prev_conceallevel = 0 -vim.api.nvim_create_autocmd("FileType", { - pattern = "tex", - callback = function() - dd(vim.b.autoformat) - vim.b.autoformat = false - dd(vim.b.autoformat) - end, -}) +-- vim.api.nvim_create_autocmd("FileType", { +-- -- pattern = "*.tex", +-- pattern = "tex", +-- callback = function(args) +-- local buf = args.buf +-- local b = vim.b[buf] +-- dd(b.autoformat) +-- b.autoformat = false +-- dd(b.autoformat) +-- vim.keymap.set("n", "test", function () +-- dd(b.autoformat) +-- end) +-- end, +-- }) vim.api.nvim_create_autocmd({ "InsertLeave", "FileType" }, { -- pattern = "*", diff --git a/.config/nvim/lua/plugins/vimtex.lua b/.config/nvim/lua/plugins/vimtex.lua index 47284fd7..34a4d613 100644 --- a/.config/nvim/lua/plugins/vimtex.lua +++ b/.config/nvim/lua/plugins/vimtex.lua @@ -19,23 +19,6 @@ return { "stevearc/conform.nvim", optional = true, opts = { - -- format_on_save = function(bufnr) - -- local ignore_filetypes = {"tex"} - -- if vim.tbl_contains(ignore_filetypes, vim.bo[bufnr].filetype) then - -- return - -- end - -- -- Disable with a global or buffer-local variable - -- if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then - -- return - -- end - -- -- Disable autoformat for files in a certain path - -- local bufname = vim.api.nvim_buf_get_name(bufnr) - -- if bufname:match("/node_modules/") then - -- return - -- end - -- -- ...additional logic... - -- return { timeout_ms = 500, lsp_format = "fallback" } - -- end, formatters_by_ft = { -- requires install via AUR -- TODO: add to mason registry?