From 877214a6314ad0fb1c8758eb4d0bc29a8a6abd3d Mon Sep 17 00:00:00 2001 From: Spenser Truex Date: Wed, 13 Jan 2021 15:31:47 -0800 Subject: [PATCH] Leave a single newline if reducing trailing. While removing trailing newlines is a good idea, it is a problem when editing C files which "must" have an empty line at the bottom. So we leave just a single newline, if there were any. --- .config/nvim/init.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index bf982c1a..c4307176 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -113,7 +113,7 @@ set noshowcmd " Automatically deletes all trailing whitespace and newlines at end of file on save. autocmd BufWritePre * %s/\s\+$//e - autocmd BufWritePre * %s/\n\+\%$//e + autocmd BufWritePre * %s/\n\+\%$/\n/e " When shortcut files are updated, renew bash and ranger configs with new material: autocmd BufWritePost bm-files,bm-dirs !shortcuts