diff options
Diffstat (limited to 'vim/after/ftplugin/perl/tidy.vim')
-rw-r--r-- | vim/after/ftplugin/perl/tidy.vim | 9 |
1 files changed, 8 insertions, 1 deletions
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 <buffer> <silent> <unique> \ <Plug>PerlTidy - \ :<C-U>%!perltidy<CR> + \ :<C-U>call <SID>PerlTidy()<CR> let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap <buffer> <Plug>PerlTidy' |