From d61576640c2b71105c9802a351d59fab581c55f1 Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Thu, 9 Jan 2014 11:56:57 -0800 Subject: [PATCH] Update folding for vim - toggles folding - Change vim folding text --- vimrc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/vimrc b/vimrc index 29db0d5..9ada4a4 100644 --- a/vimrc +++ b/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 ct :TlistToggle " taglist shortcut map ts :%s/\s\s*$//g " trim trailing whitespace map cc :CoffeeCompile " Complie CoffeeScript nnoremap rc :split $MYVIMRC +" Use space to toggle folding +nnoremap za if bufwinnr(1) map + < @@ -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 tt :tabnew map te :tabedit