Add syntax folding for cmake
This commit is contained in:
		
							parent
							
								
									126f6401e9
								
							
						
					
					
						commit
						7b83821608
					
				@ -1,17 +1,5 @@
 | 
			
		||||
" TODO Create fold markers based on cmake syntax, eg.
 | 
			
		||||
"
 | 
			
		||||
"   if() <- open
 | 
			
		||||
"   endif() <- close
 | 
			
		||||
"
 | 
			
		||||
"   foreach() <- open
 | 
			
		||||
"   endforeach() <- close
 | 
			
		||||
"
 | 
			
		||||
" and so on for all other begin end style command pairs.
 | 
			
		||||
"
 | 
			
		||||
" Then change the setting.
 | 
			
		||||
"
 | 
			
		||||
"   setlocal foldmethod=syntax
 | 
			
		||||
setlocal foldmethod=indent
 | 
			
		||||
" Enable syntax folding, see .vim/after/syntax/cmake.vim
 | 
			
		||||
setlocal foldmethod=syntax
 | 
			
		||||
" Set comment string
 | 
			
		||||
setlocal commentstring=#%s
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										6
									
								
								after/syntax/cmake.vim
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								after/syntax/cmake.vim
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,6 @@
 | 
			
		||||
" Transparent regions to enable syntax based folding.
 | 
			
		||||
syntax region cmakeIfBlock start='if(.*)' end='endif(.*)' fold transparent keepend
 | 
			
		||||
syntax region cmakeFunctionBlock start='function(.*)' end='endfunction(.*)' fold transparent keepend
 | 
			
		||||
syntax region cmakeMacroBlock start='macro(.*)' end='endmacro(.*)' fold transparent keepend
 | 
			
		||||
syntax region cmakeForeachBlock start='foreach(.*)' end='endforeach(.*)' fold transparent keepend
 | 
			
		||||
syntax region cmakeWhileBlock start='while(.*)' end='endwhile(.*)' fold transparent keepend
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user