diff options
Diffstat (limited to 'after/ftplugin')
-rw-r--r-- | after/ftplugin/puppet.vim | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/after/ftplugin/puppet.vim b/after/ftplugin/puppet.vim new file mode 100644 index 00000000..2bac2dc8 --- /dev/null +++ b/after/ftplugin/puppet.vim @@ -0,0 +1,11 @@ +inoremap <buffer> <silent> > ><Esc>:call <SID>puppetalign()<CR>A +function! s:puppetalign() + let p = '^\s*\w+\s*[=+]>.*$' + let lineContainsHashrocket = getline('.') =~# '^\s*\w+\s*[=+]>' + let hashrocketOnPrevLine = getline(line('.') - 1) =~# p + let hashrocketOnNextLine = getline(line('.') + 1) =~# p + if exists(':Tabularize') " && lineContainsHashrocket && (hashrocketOnPrevLine || hashrocketOnNextLine) + Tabularize /=>/l1 + normal! 0 + endif +endfunction |