Skip to content

Instantly share code, notes, and snippets.

@f0i
Created January 31, 2013 06:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save f0i/4680890 to your computer and use it in GitHub Desktop.
Save f0i/4680890 to your computer and use it in GitHub Desktop.
Highlight loops based on indention in vim
highlight loop1 ctermbg=233
highlight loop2 ctermbg=235
highlight loop3 ctermbg=237
let g:showtree=0
function! TreeView()
if (g:showtree == 0)
let g:showtree=1
match loop1 "^ .*$\|\(^ \)\@<= .*$"
2match loop2 "\(^ \)\@<= [^\ ].*$\|\(^ \)\@<= \|\(^ \)\@<= .*$"
3match loop3 "\(^ \)\@<= [^\ ].*$\|\(^ \)\@<= \|\(^ \)\@<= .*$"
else
let g:showtree=0
match none
2match none
3match none
endif
endfunction
map <F5> :call TreeView()<CR>
@f0i
Copy link
Author

f0i commented May 18, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment