Keep trailing whitespaces for *.md files

They are syntax for the md files so they should stay.

    Also added some documentation.
This commit is contained in:
Arjun Karangiya 2022-02-06 18:04:54 +05:30
parent c28d25c152
commit b11073ac63

View File

@ -111,10 +111,12 @@ set noshowcmd
autocmd BufRead,BufNewFile /tmp/neomutt* map ZZ :Goyo\|x!<CR>
autocmd BufRead,BufNewFile /tmp/neomutt* map ZQ :Goyo\|q!<CR>
" Automatically deletes all trailing whitespace and newlines at end of file on save. & reset cursor position
autocmd BufWritePre * let currPos = getpos(".")
autocmd BufWritePre * %s/\s\+$//e
autocmd BufWritePre * %s/\n\+\%$//e
" Remove trailing whitespaces except in '.md' files
autocmd BufWritePre *[^m][^d] %s/\s\+$//e
" Remove trailing newlines at the end of file
autocmd BufWritePre * %s/\n\+\%$//e
" Replace trailing newlines with one newline in '.c' or '.h' files
autocmd BufWritePre *.[ch] %s/\%$/\r/e
autocmd BufWritePre * cal cursor(currPos[1], currPos[2])