From 7c53ba40f726f000c42b5b39dce146eaf56fa277 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Fri, 24 Jan 2014 12:17:22 +0100 Subject: [Tags] always loads cscope bindings, to allow future « cs add ... » MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vimrc | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/vimrc b/vimrc index 130ebca..f6b4d61 100644 --- a/vimrc +++ b/vimrc @@ -118,16 +118,18 @@ function! CscopeSearch(csearch) return 'set hls | cscope find '.l:ctype.' '.a:csearch endfunction -" Load local cscope db if exists -if filereadable( expand("$PWD/tags") ) - set tags=tags -elseif filereadable( expand("$PWD/ctags.out") ) - set tags=$pwd/ctags.out -elseif has("cscope") - if filereadable( expand("$PWD/cscope.out") ) - set cst - - " Automagically done... +function! LoadTags() + " Load local cscope db if exists + if filereadable( expand("$PWD/tags") ) + set tags=tags + elseif filereadable( expand("$PWD/ctags.out") ) + set tags=$pwd/ctags.out + elseif has("cscope") + if filereadable( expand("$PWD/cscope.out") ) + set cst + endif + + " Automagically done... "cscope add $PWD/cscope.out " cscope macros @@ -142,14 +144,14 @@ elseif has("cscope") nmap F :execute CscopeSearch(expand("")) nmap f :cs find f - " search files #including current file - "nmap % :execute CscopeSearch(expand("%:t")) - nmap % :cs find i %:t + " search current file + nmap % :execute CscopeSearch(expand("%:t")) + "nmap % :cs find i %:t nmap r :execute CscopeSearch(input("Rechercher : ")) endif -endif - +endfunction +call LoadTags() " F*cking whitespaces autocmd BufRead * highlight ExtraWhitespace ctermbg=red ctermfg=black guibg=red -- cgit v1.2.3