aboutsummaryrefslogtreecommitdiff
path: root/vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-07 01:00:43 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-07 01:00:43 +1200
commit14f4daaacca9e36a5281e54c105ca5d90fc70c87 (patch)
tree251c16e5e29dffb334c2366d8c9f0ee4cce917b0 /vim
parentc30a12e7e866f5b51701ab637932103c43fa2f9a (diff)
downloaddotfiles-14f4daaacca9e36a5281e54c105ca5d90fc70c87.tar.gz
dotfiles-14f4daaacca9e36a5281e54c105ca5d90fc70c87.zip
Get 'shiftwidth' in Vim Perl indent portably
From `:help shiftwidth()`: > Returns the effective value of 'shiftwidth'. This is the 'shiftwidth' > value unless it is zero, in which case it is the 'tabstop' value. This > function was introduced with patch 7.3.694 in 2012, everybody should > have it by now. I'd like my stuff to work on older versions, though, and it's not hard to make it work.
Diffstat (limited to 'vim')
-rw-r--r--vim/indent/perl.vim4
1 files changed, 3 insertions, 1 deletions
diff --git a/vim/indent/perl.vim b/vim/indent/perl.vim
index ee7028ec..edb91028 100644
--- a/vim/indent/perl.vim
+++ b/vim/indent/perl.vim
@@ -22,7 +22,9 @@ function! GetPerlIndent()
let l:pi = indent(l:pn)
" Get value of 'shiftwidth'
- let l:sw = shiftwidth()
+ let l:sw = exists('*shiftwidth')
+ \ ? shiftwidth()
+ \ : &shiftwidth
" Don't touch comments
if l:pl =~# '^\s*#'