From 66f954ee85e8c2b9d5b5fd58232023b129b10ad8 Mon Sep 17 00:00:00 2001 From: TiynGER Date: Tue, 10 Nov 2020 16:40:34 +0100 Subject: [PATCH] vim: updated format options for html and increased readability --- .config/nvim/init.vim | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 665087b..238539f 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -273,17 +273,23 @@ autocmd BufWritePre * :call TrimWhitespace() " read files correctly autocmd BufRead,BufNewFile *.tex set filetype=tex +autocmd BufRead,BufNewFile *.html set filetype=html autocmd BufRead,BufNewFile *.h set filetype=c -" formatting -autocmd FileType c setlocal formatprg=astyle\ --mode=c -autocmd FileType java setlocal formatprg=astyle\ --indent=spaces=2\ --style=google +" formatting options autocmd FileType java setlocal shiftwidth=2 softtabstop=2 + +" formatting programs +autocmd FileType c setlocal formatprg=astyle\ --mode=c\ --style=ansi +autocmd FileType c noremap gggqG +autocmd FileType html noremap :silent %!tidy -q -i --show-errors 0 +autocmd FileType java setlocal formatprg=astyle\ --indent=spaces=2\ --style=google +autocmd FileType java noremap gggqG autocmd FileType markdown noremap :silent %!prettier --stdin-filepath % autocmd FileType python setlocal formatprg=autopep8\ - +autocmd FileType python noremap gggqG autocmd FileType tex,latex setlocal formatprg=latexindent\ - -autocmd FileType c,java,python,tex,latex noremap gggqG - +autocmd FileType tex,latex noremap gggqG " cleanup certain files after leaving the editor autocmd VimLeave *.tex !texclear %