From 8cd3eb9312a3369a9a8bc0c039c939c9e1a60121 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Sun, 13 Mar 2011 16:30:51 -0700 Subject: [PATCH] Added toggling foldmarker --- .vimrc | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/.vimrc b/.vimrc index 092e7e1..cc67f54 100644 --- a/.vimrc +++ b/.vimrc @@ -144,9 +144,17 @@ inoremap # X# " Enable folds if has("folding") + fun! ToggleFoldmethod() + if &foldmethod == "marker" + set foldmethod=syntax + else + set foldmethod=marker + endif + endfun + command! Tfdm call ToggleFoldmethod() set foldenable set foldmethod=marker - "set foldlevelstart=99 + set foldlevelstart=99 endif " Syntax when printing @@ -290,17 +298,17 @@ set fillchars=fold:- "----------------------------------------------------------------------- au! CursorHold *.[ch] nested call PreviewWord() func PreviewWord() - if &previewwindow " don't do this in the preview window + if &previewwindow " don't do this in the preview window return endif - let w = expand("") " get the word under cursor - if w =~ '\a' " if the word contains a letter + let w = expand("") " get the word under cursor + if w =~ '\a' " if the word contains a letter " Delete any existing highlight before showing another tag - silent! wincmd P " jump to preview window - if &previewwindow " if we really get there... - match none " delete existing highlight - wincmd p " back to old window + silent! wincmd P " jump to preview window + if &previewwindow " if we really get there... + match none " delete existing highlight + wincmd p " back to old window endif " Try displaying a matching tag for the word under the cursor @@ -310,21 +318,23 @@ func PreviewWord() return endtry - silent! wincmd P " jump to preview window - if &previewwindow " if we really get there... + silent! wincmd P " jump to preview window + if &previewwindow " if we really get there... + exe "wincmd J" if has("folding") - silent! .foldopen " don't want a closed fold + silent! .foldopen " don't want a closed fold endif - call search("$", "b") " to end of previous line + call search("$", "b") " to end of previous line let w = substitute(w, '\\', '\\\\', "") call search('\<\V' . w . '\>') " position cursor on match " Add a match highlight to the word at this position - hi previewWord term=bold ctermbg=green guibg=green + hi previewWord term=bold cterm=underline gui=underline exe 'match previewWord "\%' . line(".") . 'l\%' . col(".") . 'c\k*"' - wincmd p " back to old window + wincmd p " back to old window endif endif endfun + "----------------------------------------------------------------------- " completion "----------------------------------------------------------------------- @@ -348,13 +358,14 @@ if has("eval") " If we're in a wide window, enable line numbers. fun! WindowWidth() if winwidth(0) > 90 - setlocal foldcolumn=2 + setlocal foldcolumn=1 setlocal number else setlocal nonumber setlocal foldcolumn=0 endif endfun + autocmd VimEnter * :call WindowWidth() endif " content creation @@ -635,8 +646,9 @@ inoremap q gq}k$ "nmap c "nmap :exec "make check TESTS_ENVIRONMENT=true LOG_COMPILER=true XFAIL_TESTS=" "nmap :exec "make -C " . expand("%:p:h") . " check TESTS_ENVIRONMENT=true LOG_COMPILER=true XFAIL_TESTS=" -nmap :make all-then-check -nmap :exec "make -C " . expand("%:p:h") . " check" +"nmap :make all-then-check +map :Tfdm +"nmap :exec "make -C " . expand("%:p:h") . " check" nmap :make nmap :exec "make -C " . expand("%:p:h") "nmap :exec "make -C " . expand("%:p:h") . " check SUBDIRS= check_PROGRAMS=" . GetCurrentTest()