rst.vim (337B)
1 function! s:ResizeHeading(char) abort 2 normal mm 3 exe "1,$-1g/^" . a:char . "\\+$/normal ddkyypVr" . a:char 4 normal `m 5 endfunction 6 7 function! ResizeHeadings() abort 8 call s:ResizeHeading("=") 9 call s:ResizeHeading("-") 10 endfunction 11 12 13 augroup RST 14 autocmd! 15 autocmd InsertLeave *.rst call ResizeHeadings() 16 augroup END