Added toggling foldmarker
This commit is contained in:
parent
8fe0d01df9
commit
8cd3eb9312
1 changed files with 29 additions and 17 deletions
46
.vimrc
46
.vimrc
|
|
@ -144,9 +144,17 @@ inoremap # X<BS>#
|
||||||
|
|
||||||
" Enable folds
|
" Enable folds
|
||||||
if has("folding")
|
if has("folding")
|
||||||
|
fun! ToggleFoldmethod()
|
||||||
|
if &foldmethod == "marker"
|
||||||
|
set foldmethod=syntax
|
||||||
|
else
|
||||||
|
set foldmethod=marker
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
command! Tfdm call ToggleFoldmethod()
|
||||||
set foldenable
|
set foldenable
|
||||||
set foldmethod=marker
|
set foldmethod=marker
|
||||||
"set foldlevelstart=99
|
set foldlevelstart=99
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Syntax when printing
|
" Syntax when printing
|
||||||
|
|
@ -290,17 +298,17 @@ set fillchars=fold:-
|
||||||
"-----------------------------------------------------------------------
|
"-----------------------------------------------------------------------
|
||||||
au! CursorHold *.[ch] nested call PreviewWord()
|
au! CursorHold *.[ch] nested call PreviewWord()
|
||||||
func PreviewWord()
|
func PreviewWord()
|
||||||
if &previewwindow " don't do this in the preview window
|
if &previewwindow " don't do this in the preview window
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
let w = expand("<cword>") " get the word under cursor
|
let w = expand("<cword>") " get the word under cursor
|
||||||
if w =~ '\a' " if the word contains a letter
|
if w =~ '\a' " if the word contains a letter
|
||||||
|
|
||||||
" Delete any existing highlight before showing another tag
|
" Delete any existing highlight before showing another tag
|
||||||
silent! wincmd P " jump to preview window
|
silent! wincmd P " jump to preview window
|
||||||
if &previewwindow " if we really get there...
|
if &previewwindow " if we really get there...
|
||||||
match none " delete existing highlight
|
match none " delete existing highlight
|
||||||
wincmd p " back to old window
|
wincmd p " back to old window
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Try displaying a matching tag for the word under the cursor
|
" Try displaying a matching tag for the word under the cursor
|
||||||
|
|
@ -310,21 +318,23 @@ func PreviewWord()
|
||||||
return
|
return
|
||||||
endtry
|
endtry
|
||||||
|
|
||||||
silent! wincmd P " jump to preview window
|
silent! wincmd P " jump to preview window
|
||||||
if &previewwindow " if we really get there...
|
if &previewwindow " if we really get there...
|
||||||
|
exe "wincmd J"
|
||||||
if has("folding")
|
if has("folding")
|
||||||
silent! .foldopen " don't want a closed fold
|
silent! .foldopen " don't want a closed fold
|
||||||
endif
|
endif
|
||||||
call search("$", "b") " to end of previous line
|
call search("$", "b") " to end of previous line
|
||||||
let w = substitute(w, '\\', '\\\\', "")
|
let w = substitute(w, '\\', '\\\\', "")
|
||||||
call search('\<\V' . w . '\>') " position cursor on match
|
call search('\<\V' . w . '\>') " position cursor on match
|
||||||
" Add a match highlight to the word at this position
|
" 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*"'
|
exe 'match previewWord "\%' . line(".") . 'l\%' . col(".") . 'c\k*"'
|
||||||
wincmd p " back to old window
|
wincmd p " back to old window
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
"-----------------------------------------------------------------------
|
"-----------------------------------------------------------------------
|
||||||
" completion
|
" completion
|
||||||
"-----------------------------------------------------------------------
|
"-----------------------------------------------------------------------
|
||||||
|
|
@ -348,13 +358,14 @@ if has("eval")
|
||||||
" If we're in a wide window, enable line numbers.
|
" If we're in a wide window, enable line numbers.
|
||||||
fun! <SID>WindowWidth()
|
fun! <SID>WindowWidth()
|
||||||
if winwidth(0) > 90
|
if winwidth(0) > 90
|
||||||
setlocal foldcolumn=2
|
setlocal foldcolumn=1
|
||||||
setlocal number
|
setlocal number
|
||||||
else
|
else
|
||||||
setlocal nonumber
|
setlocal nonumber
|
||||||
setlocal foldcolumn=0
|
setlocal foldcolumn=0
|
||||||
endif
|
endif
|
||||||
endfun
|
endfun
|
||||||
|
autocmd VimEnter * :call <SID>WindowWidth()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" content creation
|
" content creation
|
||||||
|
|
@ -635,8 +646,9 @@ inoremap <C-z>q <C-o>gq}<C-o>k<C-o>$
|
||||||
"nmap <F5> <C-w>c
|
"nmap <F5> <C-w>c
|
||||||
"nmap <F6> :exec "make check TESTS_ENVIRONMENT=true LOG_COMPILER=true XFAIL_TESTS="<CR>
|
"nmap <F6> :exec "make check TESTS_ENVIRONMENT=true LOG_COMPILER=true XFAIL_TESTS="<CR>
|
||||||
"nmap <Leader><F6> :exec "make -C " . expand("%:p:h") . " check TESTS_ENVIRONMENT=true LOG_COMPILER=true XFAIL_TESTS="<CR>
|
"nmap <Leader><F6> :exec "make -C " . expand("%:p:h") . " check TESTS_ENVIRONMENT=true LOG_COMPILER=true XFAIL_TESTS="<CR>
|
||||||
nmap <F7> :make all-then-check<CR>
|
"nmap <F7> :make all-then-check<CR>
|
||||||
nmap <Leader><F7> :exec "make -C " . expand("%:p:h") . " check"<CR>
|
map <F7> :Tfdm<CR>
|
||||||
|
"nmap <Leader><F7> :exec "make -C " . expand("%:p:h") . " check"<CR>
|
||||||
nmap <F8> :make<CR>
|
nmap <F8> :make<CR>
|
||||||
nmap <Leader><F8> :exec "make -C " . expand("%:p:h")<CR>
|
nmap <Leader><F8> :exec "make -C " . expand("%:p:h")<CR>
|
||||||
"nmap <F9> :exec "make -C " . expand("%:p:h") . " check SUBDIRS= check_PROGRAMS=" . GetCurrentTest()
|
"nmap <F9> :exec "make -C " . expand("%:p:h") . " check SUBDIRS= check_PROGRAMS=" . GetCurrentTest()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue