path: root/vim/ftplugin/html.vim
diff options
authorTom Ryder <tom@sanctum.geek.nz>2017-11-04 00:32:44 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-11-04 00:37:18 +1300
commit374ceec9af29401a183b3be44f5dc75e096abae9 (patch)
treec368ffbddf1afa798652aab59f76c2200b1fcf0d /vim/ftplugin/html.vim
parentccabcefafef457e7d488ef2ee1b27b4b56e03267 (diff)
Add tidy mapping for HTML
This mapping mirrors the one for Perl that passes the content of the buffer through a program to tidy it (i.e. not merely check but actively change it). The tidy(1) option chosen here, -quiet, is the bare minimum to make this invocation useful. We would never want the boilerplate it otherwise emits to be in the buffer after a call. Everything else should be applied in a configuration file, which I'll do in a separate feature.
Diffstat (limited to 'vim/ftplugin/html.vim')
1 files changed, 4 insertions, 0 deletions
diff --git a/vim/ftplugin/html.vim b/vim/ftplugin/html.vim
index a56ae778..c756eb80 100644
--- a/vim/ftplugin/html.vim
+++ b/vim/ftplugin/html.vim
@@ -2,6 +2,10 @@
nnoremap <buffer> <silent> <LocalLeader>c
\ :write !tidy -errors -quiet<CR>
+" Filter buffer through `tidy`
+nnoremap <buffer> <silent> <LocalLeader>t
+ \ :%!tidy -quiet<CR>
" Make a bare URL into a link to itself
function! s:UrlLink()