From: Stefan Huber Date: Thu, 16 Apr 2020 06:42:35 +0000 (+0200) Subject: xml: Add XML_reformat() function X-Git-Url: https://git.sthu.org/?a=commitdiff_plain;h=a89eb6e1fb9a8f310d64c5bc11ca109a887d4461;p=vimconf.git xml: Add XML_reformat() function This function pretty-prints the file. --- diff --git a/ftplugin/xml.vim b/ftplugin/xml.vim new file mode 100644 index 0000000..e72b00e --- /dev/null +++ b/ftplugin/xml.vim @@ -0,0 +1,9 @@ +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +" Pretty format the XML content by passing it through xmllint. +function XML_reformat() + exec "%!xmllint --format -" +endfunction diff --git a/init.vim b/init.vim index f4b86e1..75f8c34 100644 --- a/init.vim +++ b/init.vim @@ -60,6 +60,7 @@ runtime plugsetup.vim " Some preferences for indent detection let g:detectindent_min_indent = 2 +let g:detectindent_max_indent = 4 let g:detectindent_preferred_indent = 4 " Attention: Must be run after plugsetup.vim @@ -172,7 +173,7 @@ au FileType markdown call RagtagInit() let g:detectspelllang_langs = {} let g:detectspelllang_langs.aspell =[ 'en_US', 'de_AT'] -"au BufReadPost * :DetectIndent +au BufReadPost *.java :DetectIndent au BufEnter *.c* let b:fswitchlocs='reg:/lib/include/,rel:.' au BufEnter *.h* let b:fswitchlocs='reg:/include/lib/,rel:.'