Update folding for vim

- <space> toggles folding
 - Change vim folding text
main
Buddy Sandidge 11 years ago
parent c85b6df990
commit d61576640c

13
vimrc

@ -18,6 +18,7 @@ set history=1000
set autoread " Set to auto read when a file is changed from the outside
set autochdir " Change current directory to be directory of current file
set colorcolumn=80
set foldmethod=syntax
if $TMUX == ''
set clipboard+=unnamed
@ -46,6 +47,8 @@ map <leader>ct :TlistToggle<CR> " taglist shortcut
map <leader>ts :%s/\s\s*$//g<CR> " trim trailing whitespace
map <leader>cc :CoffeeCompile<CR> " Complie CoffeeScript
nnoremap <leader>rc :split $MYVIMRC<cr>
" Use space to toggle folding
nnoremap <space> za
if bufwinnr(1)
map <leader>+ <C-W><
@ -67,7 +70,7 @@ let g:syntastic_css_checkers = []
" Close all open buffers on entering a window if the only
" buffer that's left is the NERDTree buffer
function s:CloseIfOnlyNerdTreeLeft()
function! s:CloseIfOnlyNerdTreeLeft()
if exists("t:NERDTreeBufName")
if bufwinnr(t:NERDTreeBufName) != -1
if winnr("$") == 1
@ -77,6 +80,14 @@ function s:CloseIfOnlyNerdTreeLeft()
endif
endfunction
function! FoldText()
let nl = v:foldend - v:foldstart + 1
let linetext = getline(v:foldstart)
let txt = linetext . ' ' . nl . ' lines '
return txt
endfunction
set foldtext=FoldText()
" Vim Tabs
map <leader>tt :tabnew<cr>
map <leader>te :tabedit

Loading…
Cancel
Save