blob: 574fee254c4bf7e4877fbd95c9541031dfa78aff (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'puppet') == -1
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.*'))
Tabularize /=>/l1
normal! 0
echo repeat('\([^=]\|=[^>]\)*=>',column).'\s\{-\}'.repeat('.',position)
call search(repeat('\([^=]\|=[^>]\)*=>',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
endfunction
endif
endif
|