Closed tiyn closed 8 months ago
This is a reasonable request and mirrors the functionality provided by LSP. I'll work on this today 👍🏻
@tiyn I've added this functionality in the triggerable-tidy
branch. If you find that its what you expected, I'll merge it.
If you are using lazy.nvim, you can test this branch out with the below configuration. With it, you can activate tidy using <leader>tr
.
return {
"mcauley-penney/tidy.nvim",
branch = "triggerable-tidy",
opts = {
enabled_on_save = false,
filetype_exclude = { "diff" }
},
init = function()
vim.keymap.set('n', "<leader>te", require("tidy").toggle, {})
vim.keymap.set('n', "<leader>tr", require("tidy").run, {})
end
}
I've tested the provided branch for both manual and automatic cleanup. It looks really good to me and the new function fixes the problem described. Thank you!
Closed by 1cbed7676273057c8af22438deaae73cd5cb96b5
In some cases (for example when using real-time preview for markdown or tex files) many saves can happen. This causes the plugin to repeatedly delete trailing whitespaces while writing. For situations like these it could be useful to stop the plugin and run it manually. A function to stop the plugin and a function to run the cleanup could be provided.