From ff9550d5522f066fb9028cbe2d6a8ff3d3d0181b Mon Sep 17 00:00:00 2001 From: tiyn Date: Thu, 4 Jan 2024 19:44:24 +0100 Subject: [PATCH] nvim: switch back to official tidy with newly added manual cleanup --- .config/nvim/after/ftplugin/markdown.lua | 12 ++++++++++++ .config/nvim/after/ftplugin/tex.lua | 11 +++++++++++ .config/nvim/lazy-lock.json | 8 ++++---- .config/nvim/lua/plugins/tidy.lua | 5 +++-- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.config/nvim/after/ftplugin/markdown.lua b/.config/nvim/after/ftplugin/markdown.lua index 98e8b0a..9aba2d9 100644 --- a/.config/nvim/after/ftplugin/markdown.lua +++ b/.config/nvim/after/ftplugin/markdown.lua @@ -1,6 +1,7 @@ vim.api.nvim_create_autocmd({ 'VimEnter' }, { callback = function() + require("tidy").opts.enabled_on_save = false require("knap").toggle_autopreviewing() end }) @@ -12,6 +13,17 @@ vim.api.nvim_create_autocmd({ 'BufEnter' }, end }) +vim.api.nvim_create_autocmd({ 'BufLeave' }, + { + callback = function() + if vim.o.ma then + require("tidy").run() + end + end + } +) + + vim.api.nvim_create_autocmd({ 'VimLeave' }, { callback = function() diff --git a/.config/nvim/after/ftplugin/tex.lua b/.config/nvim/after/ftplugin/tex.lua index edb7eb5..693b391 100644 --- a/.config/nvim/after/ftplugin/tex.lua +++ b/.config/nvim/after/ftplugin/tex.lua @@ -1,10 +1,21 @@ vim.api.nvim_create_autocmd({ 'VimEnter' }, { callback = function() + require("tidy").opts.enabled_on_save = false require("knap").toggle_autopreviewing() end }) +vim.api.nvim_create_autocmd({ 'BufLeave' }, + { + callback = function() + if vim.o.ma then + require("tidy").run() + end + end + } +) + vim.api.nvim_create_autocmd({ 'VimLeave' }, { callback = function() diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 8e472d2..b2f3f91 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -24,7 +24,7 @@ "mason-lspconfig.nvim": { "branch": "main", "commit": "56e435e09f8729af2d41973e81a0db440f8fe9c9" }, "mason-null-ls.nvim": { "branch": "main", "commit": "62ca3b15d637936147b19d921c228a7b6ba5263e" }, "mason.nvim": { "branch": "main", "commit": "a09da6ac634926a299dd439da08bdb547a8ca011" }, - "none-ls.nvim": { "branch": "main", "commit": "5c72382d14ea9debccf52dd06adff086e98f6e22" }, + "none-ls.nvim": { "branch": "main", "commit": "fbdcbf8e152529af846b3a333f039751829b84c2" }, "nvim-autopairs": { "branch": "master", "commit": "9fd41181693dd4106b3e414a822bb6569924de81" }, "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, "nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" }, @@ -34,11 +34,11 @@ "nvim-scrollbar": { "branch": "main", "commit": "35f99d559041c7c0eff3a41f9093581ceea534e8" }, "nvim-surround": { "branch": "main", "commit": "703ec63aa798e5e07d309b35e42def34bebe0174" }, "nvim-tree.lua": { "branch": "master", "commit": "f1b3e6a7eb92da492bd693257367d9256839ed3d" }, - "nvim-treesitter": { "branch": "master", "commit": "65ef62092ef997d2ecf68ede01a0afbda17808c3" }, + "nvim-treesitter": { "branch": "master", "commit": "0da349ed303bea955942f409d29059cdb89dbe2c" }, "nvim-ts-autotag": { "branch": "main", "commit": "8515e48a277a2f4947d91004d9aa92c29fdc5e18" }, "nvim-ts-rainbow": { "branch": "master", "commit": "ef95c15a935f97c65a80e48e12fe72d49aacf9b9" }, "nvim-ufo": { "branch": "main", "commit": "c6d88523f574024b788f1c3400c5d5b9bb1a0407" }, - "nvim-web-devicons": { "branch": "master", "commit": "cff25ce621e6d15fae0b0bfe38c00be50ce38468" }, + "nvim-web-devicons": { "branch": "master", "commit": "3e24abe1ae66532135cec911562f553fe247cb56" }, "nvim-yarp": { "branch": "master", "commit": "bb5f5e038bfe119d3b777845a76b0b919b35ebc8" }, "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, "popup-menu.nvim": { "branch": "master", "commit": "b618bd0c824a20417d845fa0022327228e6988a2" }, @@ -48,7 +48,7 @@ "tabular": { "branch": "master", "commit": "339091ac4dd1f17e225fe7d57b48aff55f99b23a" }, "tccs.nvim": { "branch": "master", "commit": "fa75ae924ac0131c6f4c68b9ad4d18e0a8f5e14d" }, "telescope.nvim": { "branch": "master", "commit": "776b509f80dd49d8205b9b0d94485568236d1192" }, - "tidy.nvim": { "branch": "main", "commit": "1b83aba8f085e28b4fdfb8f10517654fa25d048d" }, + "tidy.nvim": { "branch": "triggerable-tidy", "commit": "1cbed7676273057c8af22438deaae73cd5cb96b5" }, "todo-comments.nvim": { "branch": "main", "commit": "4a6737a8d70fe1ac55c64dfa47fcb189ca431872" }, "trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" }, "vim-hug-neovim-rpc": { "branch": "master", "commit": "93ae38792bc197c3bdffa2716ae493c67a5e7957" }, diff --git a/.config/nvim/lua/plugins/tidy.lua b/.config/nvim/lua/plugins/tidy.lua index 4f4879c..be75259 100644 --- a/.config/nvim/lua/plugins/tidy.lua +++ b/.config/nvim/lua/plugins/tidy.lua @@ -1,9 +1,10 @@ return { -- clean up white spaces and empty lines before writing { - "tiyn/tidy.nvim", + "mcauley-penney/tidy.nvim", + branch = "triggerable-tidy", opts = { - filetype_exclude = {} + filetype_exclude = { "diff" } } } }