aboutsummaryrefslogtreecommitdiff
path: root/vim/indent
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-06 18:24:04 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-06 18:24:04 +1200
commitc9da3d324cdaf57adb10a0d6ca29928145877c59 (patch)
tree6f4f98a12f0133c76c96e9c6558e12910ca0a204 /vim/indent
parentAdd a comment to Vim Perl indent rules (diff)
downloaddotfiles-c9da3d324cdaf57adb10a0d6ca29928145877c59.tar.gz
dotfiles-c9da3d324cdaf57adb10a0d6ca29928145877c59.zip
Refactor opening of Vim Perl indent script
Diffstat (limited to 'vim/indent')
-rw-r--r--vim/indent/perl.vim11
1 files changed, 5 insertions, 6 deletions
diff --git a/vim/indent/perl.vim b/vim/indent/perl.vim
index a3509dbf..890e2e3e 100644
--- a/vim/indent/perl.vim
+++ b/vim/indent/perl.vim
@@ -13,16 +13,15 @@ let b:did_indent = 1
" Define indent function
function! GetPerlIndent()
- " Get properties of current line
- let l:cn = v:lnum
- let l:cl = getline(l:cn)
- let l:ci = indent(l:cn)
-
- " Get properties of previous non-blank line
+ " Just return 0 if we have no previous line to work from
let l:pn = prevnonblank(v:lnum - 1)
if !l:pn
return 0
endif
+
+ " Get line properties
+ let l:cl = getline(v:lnum)
+ let l:ci = indent(l:cn)
let l:pl = getline(l:pn)
let l:pi = indent(l:pn)