Skip to content

Instantly share code, notes, and snippets.

@madmax
Created June 27, 2012 14:32
Show Gist options
  • Save madmax/3004435 to your computer and use it in GitHub Desktop.
Save madmax/3004435 to your computer and use it in GitHub Desktop.
""" Code folding options
nmap <leader>0 :set foldlevel=0<CR>
nmap <leader>1 :set foldlevel=1<CR>
nmap <leader>2 :set foldlevel=2<CR>
nmap <leader>3 :set foldlevel=3<CR>
nmap <leader>4 :set foldlevel=4<CR>
nmap <leader>5 :set foldlevel=5<CR>
nmap <leader>6 :set foldlevel=6<CR>
nmap <leader>7 :set foldlevel=7<CR>
nmap <leader>8 :set foldlevel=8<CR>
nmap <leader>9 :set foldlevel=9<CR>
" au FileType ruby setlocal foldmethod=syntax
" au FileType css setlocal foldmethod=indent
" au FileType scss setlocal foldmethod=indent
" Don't screw up folds when inserting text that might affect them, until
" leaving insert mode. Foldmethod is local to the window. Protect against
" screwing up folding when switching between windows.
" autocmd InsertEnter * if !exists('w:last_fdm') | let w:last_fdm=&foldmethod | setlocal foldmethod=manual | endif
" autocmd InsertLeave,WinLeave * if exists('w:last_fdm') | let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment