2015-07-18 17:05:45 -04:00
|
|
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'puppet') == -1
|
|
|
|
|
2014-08-12 17:45:36 -04:00
|
|
|
if !exists('g:puppet_align_hashes')
|
|
|
|
let g:puppet_align_hashes = 1
|
|
|
|
endif
|
|
|
|
|
|
|
|
if g:puppet_align_hashes && exists(':Tabularize')
|
|
|
|
inoremap <buffer> <silent> > ><Esc>:call <SID>puppetalign()<CR>a
|
|
|
|
function! s:puppetalign()
|
|
|
|
let p = '^\s*\w+\s*[=+]>.*$'
|
|
|
|
let column = strlen(substitute(getline('.')[0:col('.')],'\([^=]\|=[^>]\)','','g'))
|
|
|
|
let position = strlen(matchstr(getline('.')[0:col('.')],'.*=>\s*\zs.*'))
|
2014-04-14 19:26:34 -04:00
|
|
|
Tabularize /=>/l1
|
|
|
|
normal! 0
|
2014-08-12 17:45:36 -04:00
|
|
|
echo repeat('\([^=]\|=[^>]\)*=>',column).'\s\{-\}'.repeat('.',position)
|
|
|
|
call search(repeat('\([^=]\|=[^>]\)*=>',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
|
|
|
|
endfunction
|
|
|
|
endif
|
2015-07-18 17:05:45 -04:00
|
|
|
|
|
|
|
endif
|