30 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			VimL
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			VimL
		
	
	
	
	
	
" Fold Text
 | 
						|
set foldtext=FoldText()
 | 
						|
function! FoldText()
 | 
						|
  let l:line = getline(v:foldstart)
 | 
						|
  return l:line.' '.string(v:foldend - v:foldstart + 1).' lines '
 | 
						|
endfunction
 | 
						|
 | 
						|
" Derived from http://stackoverflow.com/a/1333025
 | 
						|
function! CloneHighlightGroupWithAttributes(group, new_group, attributes)
 | 
						|
  " Get group details, resolving group links.
 | 
						|
  redir => l:group
 | 
						|
  exe 'silent hi ' . a:group
 | 
						|
  redir END
 | 
						|
  while l:group =~? 'links to'
 | 
						|
    let l:index = stridx(l:group, 'links to') + len('links to')
 | 
						|
    let l:linked_group =  strpart(l:group, l:index + 1)
 | 
						|
    redir => l:group
 | 
						|
    exe 'silent hi ' . l:linked_group
 | 
						|
    redir END
 | 
						|
  endwhile
 | 
						|
 | 
						|
  " Get highlight parameters and existing remove attributes.
 | 
						|
  let l:parameters = matchlist(l:group, '\<xxx\>\s\+\(.*\)')[1]
 | 
						|
  let l:parameters = substitute(l:parameters, '\(c\?term\|gui\)=\w\+', '', 'g')
 | 
						|
 | 
						|
  " Create the cloned highlight group with new attributes.
 | 
						|
  exe 'hi '.a:new_group.' '.l:parameters.
 | 
						|
        \' term='.a:attributes.' cterm='.a:attributes.' gui='.a:attributes
 | 
						|
endfunction
 |