aboutsummaryrefslogtreecommitdiff
path: root/vim/ftplugin/perl.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-11-03 22:47:59 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-11-03 22:47:59 +1300
commit04031093dd873153b8af734fae5122bf27dcdb19 (patch)
tree971462c2ef8df1dd28ce93874861c0020f04fd56 /vim/ftplugin/perl.vim
parenta6b6f843eea0d101bf533c1e0894a95e13dd1c75 (diff)
downloaddotfiles-04031093dd873153b8af734fae5122bf27dcdb19.tar.gz
dotfiles-04031093dd873153b8af734fae5122bf27dcdb19.zip
Check for availability of Vim shellescape()
It doesn't seem to be in very old Vims; worth testing for to avoid errors if I try to use the function.
Diffstat (limited to 'vim/ftplugin/perl.vim')
-rw-r--r--vim/ftplugin/perl.vim17
1 files changed, 11 insertions, 6 deletions
diff --git a/vim/ftplugin/perl.vim b/vim/ftplugin/perl.vim
index 53341183..c4923051 100644
--- a/vim/ftplugin/perl.vim
+++ b/vim/ftplugin/perl.vim
@@ -1,6 +1,11 @@
-" Run perl -c on file for the current buffer
-nnoremap <LocalLeader>pc :exe "!perl -c " . shellescape(expand("%"))<CR>
-" Run perlcritic on the file for the current buffer
-nnoremap <LocalLeader>pl :exe "!perlcritic " . shellescape(expand("%"))<CR>
-" Run the current buffer through perltidy
-nnoremap <LocalLeader>pt :%!perltidy<CR>
+" External commands for Perl files
+if exists('*shellescape')
+
+ " Run perl -c on file for the current buffer
+ nnoremap <LocalLeader>pc :exe "!perl -c " . shellescape(expand("%"))<CR>
+ " Run perlcritic on the file for the current buffer
+ nnoremap <LocalLeader>pl :exe "!perlcritic " . shellescape(expand("%"))<CR>
+ " Run the current buffer through perltidy
+ nnoremap <LocalLeader>pt :%!perltidy<CR>
+
+endif