mcauley-penney / tidy.nvim

A small Neovim plugin to remove trailing whitespace and empty lines at end of file on every save
107 stars 15 forks source link

vim code became unnecessary #4

Closed matu3ba closed 2 years ago

matu3ba commented 2 years ago

You can use now with neovim master

vim.api.nvim_create_augroup('MYAUCMDS',  {clear = true})
vim.api.nvim_create_autocmd('BufWritePre', {group = 'MYAUCMDS', pattern = '*', command = [[:keepjumps keeppatterns %s/\s\+$//e]]}) -- remove trailing spaces

Also, I dont understand what you want to preserve in the undotree. Marks will be lost, if they correspond to deleted text. You would need to tell neovim how the text was moved, once parts get deleted. But you only delete empty lines, which should not have marks. So its unclear to me, what behavior has problems.

mcauley-penney commented 2 years ago

Thank you for the issue! I hadn't gotten around yet to changing over to the new aucmd API even though, like you displayed, it's a small change. I'll take care of that and, again, I appreciate the contribution.

Concerning the undotree remark that I made in the README: I had some issues cropping up a while back that I didn't document here and probably wrongly suspected that it had to do with it. Having never had a chance to experiment with manipulating or handling the undotree, I felt that it would be smart to investigate it and give myself that experience. No one else has mentioned that they are experiencing the issues I had and I haven't had them in a while so the comment about preserving the undotree is likely invalid at this point.