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/perl/tidy.vim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'vim/after/ftplugin/perl') diff --git a/vim/after/ftplugin/perl/tidy.vim b/vim/after/ftplugin/perl/tidy.vim index 01ca0210..f6744f3a 100644 --- a/vim/after/ftplugin/perl/tidy.vim +++ b/vim/after/ftplugin/perl/tidy.vim @@ -15,6 +15,13 @@ let b:did_ftplugin_perl_tidy = 1 let b:undo_ftplugin = b:undo_ftplugin \ . '|unlet b:did_ftplugin_perl_tidy' +" Plugin function +function s:PerlTidy() + let l:view = winsaveview() + %!perltidy + call winrestview(l:view) +endfunction + " Stop here if the user doesn't want ftplugin mappings if exists('g:no_plugin_maps') || exists('g:no_perl_maps') finish @@ -23,7 +30,7 @@ endif " Define a mapping target nnoremap \ PerlTidy - \ :%!perltidy + \ :call PerlTidy() let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap PerlTidy' -- cgit v1.2.3