Use tidy for Autoformat with html then remove linebreaks not between tags

This commit is contained in:
Kevin MacMartin 2015-01-05 20:53:42 -05:00
parent f76af68373
commit 8d64e464af
2 changed files with 10 additions and 0 deletions

View file

@ -782,6 +782,10 @@
autocmd FileType help map <buffer> <silent><expr> <Leader>? ':q<CR>' autocmd FileType help map <buffer> <silent><expr> <Leader>? ':q<CR>'
endif endif
"html
"after running autoformat, remove linebreaks that aren't between tags
autocmd FileType html,xhtml nnoremap <buffer> <silent><expr> <Leader>F ':Autoformat<CR>:%s/\n\s*\([^<\ ]\)/ \1/g<CR>:echo "The document has been formatted with :Autoformat"<CR>'
"markdown "markdown
autocmd FileType mkd nnoremap <buffer> <silent><expr> <Leader>F ':TableFormat<CR>' autocmd FileType mkd nnoremap <buffer> <silent><expr> <Leader>F ':TableFormat<CR>'
autocmd FileType mkd xnoremap <buffer> <silent><expr> <Leader>F '<Esc>:TableFormat<CR>gv' autocmd FileType mkd xnoremap <buffer> <silent><expr> <Leader>F '<Esc>:TableFormat<CR>gv'

View file

@ -34,6 +34,12 @@ scriptencoding utf-8
set tags=./.tags;,~/.vim/tags set tags=./.tags;,~/.vim/tags
"}}} "}}}
"AUTOFORMAT: {{{
"use tidy for html instead of html-beautify
let g:formatprg_html = "tidy"
let g:formatprg_args_expr_html = '"-q --show-errors 0 --show-warnings 0 --force-output --indent auto --indent-spaces ".&shiftwidth." --vertical-space yes --tidy-mark no -ashtml -wrap ".&textwidth'
"}}
"BOOKMARKS: {{{ "BOOKMARKS: {{{
let g:bookmark_sign = '★' let g:bookmark_sign = '★'
let g:bookmark_annotation_sign = '📌' let g:bookmark_annotation_sign = '📌'