From 054fd12294d979b66ca757bd2e6a80138ce45ef1 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 17 Jun 2018 00:38:10 +1200 Subject: Arrange for tidiers to hold window position --- vim/after/ftplugin/html/tidy.vim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'vim/after/ftplugin/html/tidy.vim') diff --git a/vim/after/ftplugin/html/tidy.vim b/vim/after/ftplugin/html/tidy.vim index e0c43f01..5a8ded7e 100644 --- a/vim/after/ftplugin/html/tidy.vim +++ b/vim/after/ftplugin/html/tidy.vim @@ -20,6 +20,13 @@ let b:did_ftplugin_html_tidy = 1 let b:undo_ftplugin = b:undo_ftplugin \ . '|unlet b:did_ftplugin_html_tidy' +" Plugin function +function s:HtmlTidy() + let l:view = winsaveview() + %!tidy -quiet + call winrestview(l:view) +endfunction + " Stop here if the user doesn't want ftplugin mappings if exists('g:no_plugin_maps') || exists('g:no_html_maps') finish @@ -28,7 +35,7 @@ endif " Define a mapping target nnoremap \ HtmlTidy - \ :%!tidy -quiet + \ :call HtmlTidy() let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap HtmlTidy' -- cgit v1.2.3