diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-07-07 01:00:43 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-07-07 01:00:43 +1200 |
commit | 14f4daaacca9e36a5281e54c105ca5d90fc70c87 (patch) | |
tree | 251c16e5e29dffb334c2366d8c9f0ee4cce917b0 | |
parent | Adjust leading comment for Vim Perl indent (diff) | |
download | dotfiles-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.
-rw-r--r-- | vim/indent/perl.vim | 4 |
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*#' |