aboutsummaryrefslogtreecommitdiff
path: root/vim/after/ftplugin/perl/tidy.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-06-17 00:38:10 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-06-17 00:38:10 +1200
commit054fd12294d979b66ca757bd2e6a80138ce45ef1 (patch)
tree31bc3de29f425966139d9f6efcdf13f0f09660d1 /vim/after/ftplugin/perl/tidy.vim
parent0086f00732b424650f9867ceac4db81112b5376c (diff)
downloaddotfiles-054fd12294d979b66ca757bd2e6a80138ce45ef1.tar.gz
dotfiles-054fd12294d979b66ca757bd2e6a80138ce45ef1.zip
Arrange for tidiers to hold window position
Diffstat (limited to 'vim/after/ftplugin/perl/tidy.vim')
-rw-r--r--vim/after/ftplugin/perl/tidy.vim9
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'