From 7be02219d4db534b1dcacc646378718aba037e0e Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Thu, 26 May 2011 14:01:52 +0200 Subject: [PATCH] [vim] reorganize conf files --- .vim/plugin/WhatFunction.vim | 63 ++ .vim/plugin/cctree.vim | 1078 ++++++++++++++++++++++++++++++++ .vim/plugin/cscope.vim | 130 ++++ .vim/plugin/eclim.vim | 170 ----- .vim/{ => plugin}/filetype.vim | 0 .vim/plugin/indent_finder.pyc | Bin 0 -> 12021 bytes .vim/plugin/indent_finder.vim | 8 +- .vim/plugin/language.vim | 30 + .vim/plugin/mycolor.vim | 98 +++ .vimrc | 337 +--------- 10 files changed, 1435 insertions(+), 479 deletions(-) create mode 100644 .vim/plugin/WhatFunction.vim create mode 100644 .vim/plugin/cctree.vim create mode 100644 .vim/plugin/cscope.vim delete mode 100644 .vim/plugin/eclim.vim rename .vim/{ => plugin}/filetype.vim (100%) create mode 100644 .vim/plugin/indent_finder.pyc create mode 100644 .vim/plugin/language.vim create mode 100644 .vim/plugin/mycolor.vim diff --git a/.vim/plugin/WhatFunction.vim b/.vim/plugin/WhatFunction.vim new file mode 100644 index 0000000..6df4cff --- /dev/null +++ b/.vim/plugin/WhatFunction.vim @@ -0,0 +1,63 @@ +" Display current function in status bar +" +" Use WhatFunction could create some problems with lines longer that the +" screen size. WhatFunction could be interesting for C++ function +function! GetProtoLine() + let ret = "" + let line_save = line(".") + let col_save = col(".") + let top = line_save - winline() + 1 + let so_save = &so + let &so = 0 + let istypedef = 0 + " find closing brace + let closing_lnum = search('^}','cW') + if closing_lnum > 0 + if getline(line(".")) =~ '\w\s*;\s*$' + let istypedef = 1 + let closingline = getline(".") + endif + " go to the opening brace + normal! % + " if the start position is between the two braces + if line(".") <= line_save + if istypedef + let ret = matchstr(closingline, '\w\+\s*;') + else + " find a line contains function name + let lnum = search('^\w','bcnW') + if lnum > 0 + let ret = getline(lnum) + endif + endif + endif + endif + " restore position and screen line + exe "normal! " . top . "Gz\" + call cursor(line_save, col_save) + let &so = so_save + return ret +endfunction + +function! WhatFunction() + if &ft != "c" && &ft != "cpp" + return "" + endif + let proto = GetProtoLine() + if proto == "" + return "?" + endif + if stridx(proto, '(') > 0 + let ret = matchstr(proto, '\w\+(\@=') + elseif proto =~# '\' + let ret = matchstr(proto, 'struct\s\+\w\+') + elseif proto =~# '\' + let ret = matchstr(proto, 'class\s\+\w\+') + else + let ret = strpart(proto, 0, 15) . "..." + endif + return ret +endfunction + +" set statusline=%<%f\ %h%w%m%r%3.(\ %)%{fugitive#statusline()}%=%([%{Tlist_Get_Tagname_By_Line()}%{WhatFunction()}]%)%3.(\ %)%-14.(%l,%c%V%)\ %P + diff --git a/.vim/plugin/cctree.vim b/.vim/plugin/cctree.vim new file mode 100644 index 0000000..4aab5a5 --- /dev/null +++ b/.vim/plugin/cctree.vim @@ -0,0 +1,1078 @@ +" C Call-Tree Explorer (CCTree) +" +" +" Script Info and Documentation +"============================================================================= +" Copyright: Copyright (C) August 2008, Hari Rangarajan +" Permission is hereby granted to use and distribute this code, +" with or without modifications, provided that this copyright +" notice is copied with it. Like anything else that's free, +" cctree.vim is provided *as is* and comes with no +" warranty of any kind, either expressed or implied. In no +" event will the copyright holder be liable for any damamges +" resulting from the use of this software. +" +" Name Of File: CCTree.vim +" Description: C Call-Tree Explorer Vim Plugin +" Maintainer: Hari Rangarajan +" URL: http://vim.sourceforge.net/scripts/script.php?script_id=2368 +" Last Change: December 24, 2008 +" Version: 0.61 +" +"============================================================================= +" +" Description: +" Plugin generates call-trees for any function or macro in real-time inside +" Vim. +" +" Requirements: 1) Cscope +" 2) Vim 7.xx +" +" Tested on Unix and the following Win32 versions: +" + Cscope, mlcscope (WIN32) +" http://www.geocities.com/shankara_c/cscope.html +" http://www.bell-labs.com/project/wwexptools/packages.html +" +" +" +" Installation: +" Copy this file to ~/.vim/plugins/ +" or to /vimfiles/plugins/ (on Win32 platforms) +" +" It might also be possible to load it as a filetype plugin +" ~/.vim/ftplugin/c/ +" +" Need to set :filetype plugin on +" +" +" Usage: +" Build cscope database, for example: +" > cscope -b -i cscope.files +" [Tip: add -c option to build uncompressed databases for faster +" load speeds] +" +" Load database with command ":CCTreeLoadDB" +" (Please note that it might take a while depending on the +" database size) +" +" A database name, i.e., my_cscope.out, can be specified with +" the command. If not provided, a prompt will ask for the +" filename; default is cscope.out. +" +" To unload database, use command ":CCTreeUnLoadDB" +" +" Default Mappings: +" Get reverse call tree for symbol < +" Get forward call tree for symbol > +" Increase depth of tree and update = +" Decrease depth of tree and update - +" +" Open symbol in other window +" Preview symbol in other window +" +" Command List: +" CCTreeLoadDB +" CCTreeUnLoadDB +" CCTreeTraceForward +" CCTreeTraceReverse +" CCTreeRecurseDepthPlus +" CCTreeRecurseDepthMinus +" +" +" +" Settings: +" Customize behavior by changing the variable settings +" +" Cscope database file, g:CCTreeCscopeDb = "cscope.out" +" Maximum call levels, g:CCTreeRecursiveDepth = 3 +" Maximum visible(unfolded) level, g:CCTreeMinVisibleDepth = 3 +" Orientation of window, g:CCTreeOrientation = "leftabove" +" (standard vim options for split: [right|left][above|below]) +" +" Use Vertical window, g:CCTreeWindowVertical = 1 +" Min width for window, g:CCTreeWindowMinWidth = 40 +" g:CCTreeWindowWidth = -1, auto-select best width to fit +" +" Horizontal window, g:CCTreeWindowHeight, default is -1 +" +" +" Display format, g:CCTreeDisplayMode, default 1 +" +" Values: 1 -- Ultra-compact (takes minimum screen width) +" 2 -- Compact (Takes little more space) +" 3 -- Wide (Takes copious amounts of space) +" +" For vertical splits, 1 and 2 are good, while 3 is good for +" horizontal displays +" +" NOTE: To get older behavior, add the following to your vimrc +" let g:CCTreeDisplayMode = 3 +" let g:CCTreeWindowVertical = 0 +" +" Syntax Coloring: +" CCTreeSymbol is the symbol name +" CCTreeMarkers include "|","+--->" +" +" CCTreeHiSymbol is the highlighted call tree functions +" CCTreeHiMarkers is the same as CCTreeMarkers except +" these denote the highlighted call-tree +" +" +" CCTreeHiXXXX allows dynamic highlighting of the call-tree. +" To observe the effect, move the cursor to the function to +" highlight the current call-tree. This option can be +" turned off using the setting, g:CCTreeHilightCallTree. +" For faster highlighting, the value of 'updatetime' can be +" changed +" +" Limitations: +" The accuracy of the call-tree will only be as good as the cscope +" database generation. +" NOTE: Different flavors of Cscope have some known +" limitations due to the lexical analysis engine. This results +" in incorrectly identified function blocks, etc. +" +" History: +" +" Version 0.61: December 24, 2008 +" 1. Fixed bug when processing include files +" 2. Remove 'set ruler' option +" +" Version 0.60: November 26, 2008 +" 1. Added support for source-file dependency tree +" +" Version 0.50: October 17, 2008 +" 1. Optimizations for compact memory foot-print and +" improved compressed-database load speeds +" +" Version 0.41: October 6, 2008 +" 1. Minor fix: Compressed cscope databases will load +" incorrectly if encoding is not 8-bit +" +" Version 0.4: September 28, 2008 +" 1. Rewrite of "tree-display" code +" 2. New syntax hightlighting +" 3. Dynamic highlighting for call-trees +" 4. Support for new window modes (vertical, horizontal) +" 5. New display format option for compact or wide call-trees +" NOTE: defaults for tree-orientation set to vertical +" +" Version 0.3: +" September 21, 2008 +" 1. Support compressed cscope databases +" 2. Display window related bugs fixed +" 3. More intuitive display and folding capabilities +" +" Version 0.2: +" September 12, 2008 +" (Patches from Yegappan Lakshmanan, thanks!) +" 1. Support for using the plugin in Vi-compatible mode. +" 2. Filtering out unwanted lines before processing the db. +" 3. Command-line completion for the commands. +" 4. Using the cscope db from any directory. +" +" Version 0.1: +" August 31,2008 +" 1. Cross-referencing support for only functions and macros +" Functions inside macro definitions will be incorrectly +" attributed to the top level calling function +" +" +" Thanks: +" +" Arun Chaganty/Timo Tiefel (Ver 0.60 -- bug report) +" Michael Wookey (Ver 0.4 -- Testing/bug report/patches) +" Yegappan Lakshmanan (Ver 0.2 -- Patches) +" +" The Vim Community, ofcourse :) +" +"============================================================================= + +if !exists('loaded_cctree') && v:version >= 700 + " First time loading the cctree plugin + "let loaded_cctree = 1 +else + finish +endif + +" Line continuation used here +let s:cpo_save = &cpoptions +set cpoptions&vim + +" Global variables +" Modify in .vimrc to modify default behavior +if !exists('CCTreeCscopeDb') + let CCTreeCscopeDb = "cscope.out" +endif +if !exists('CCTreeRecursiveDepth') + let CCTreeRecursiveDepth = 3 +endif +if !exists('CCTreeMinVisibleDepth') + let CCTreeMinVisibleDepth = 3 +endif +if !exists('CCTreeOrientation') + let CCTreeOrientation = "leftabove" +endif +if !exists('CCTreeWindowVertical') + let CCTreeWindowVertical = 1 +endif +if !exists('CCTreeWindowWidth') + " -1 is auto select best width + let CCTreeWindowWidth = -1 +endif +if !exists('CCTreeWindowMinWidth') + let CCTreeWindowMinWidth = 40 +endif +if !exists('CCTreeWindowHeight') + let CCTreeWindowHeight = -1 +endif +if !exists('CCTreeDisplayMode') + let CCTreeDisplayMode = 1 +endif +if !exists('CCTreeHilightCallTree') + let CCTreeHilightCallTree = 1 +endif + +" Plugin related local variables +let s:pluginname = 'CCTree' +let s:windowtitle = 'CCTree-Preview' + +" There could be duplicate keywords on different lines +let s:CCTreekeyword = '' +let s:CCTreekeywordLine = -1 + +" Definition of a keyword... +let s:CCTreeKeywordRegEx = '[A-Za-z0-9_\\\.\/]\+' + +" Other state variables +let s:currentkeyword = '' +let s:currentdirection = '' +let s:dbloaded = 0 +let s:symhashtable = {} +let s:save_statusline = '' +let s:lastbufname = '' + +" Turn on/off debugs +let s:tag_debug=0 + +" Use the Decho plugin for debugging +function! DBGecho(...) + if s:tag_debug + Decho(a:000) + endif +endfunction + +function! DBGredir(...) + if s:tag_debug + Decho(a:000) + endif +endfunction + + +let s:symlistindex = 0 +let s:symlisttable = [] + +function! s:CCTreeSymbolListAdd(name) + if !has_key(s:symhashtable, a:name) + let s:symhashtable[a:name] = s:symlistindex + call add(s:symlisttable, s:CCTreeSymbolDictCreate(a:name)) + let s:symlistindex += 1 + endif + return s:symhashtable[a:name] +endfunction + +function! s:CCTreeSymbolDictCreate(name) + let retval = {} + + let retval['n'] = a:name + let retval['c'] = "" + let retval['p'] = "" + return retval +endfunction + +function! s:CCTreeSymbolMarkXRef(funcentryidx, newfuncidx) + let s:symlisttable[a:funcentryidx]['c'] .= (a:newfuncidx. ",") + let s:symlisttable[a:newfuncidx]['p'] .= (a:funcentryidx. ",") +endfunction + + +function! s:CCTreeInitStatusLine() + let s:symlastprogress = 0 + let s:symprogress = 0 + let s:cursym = 0 + let s:currentstatus = '' + let s:statusextra = '' + + let s:save_statusline = &statusline + setlocal statusline=%{CCTreeStatusLine()} +endfunction + +function! s:CCTreeRestoreStatusLine() + let &statusline = s:save_statusline +endfunction + +function! s:CCTreeBusyStatusLineUpdate(msg) + let s:currentstatus = a:msg + redrawstatus +endfunction + +function! s:CCTreeBusyStatusLineExtraInfo(msg) + let s:statusextra = a:msg + redrawstatus +endfunction + +function! CCTreeStatusLine() + return s:pluginname. " ". s:currentstatus. " -- ". s:statusextra +endfunction + + +let s:progresscurrent = 0 +let s:progressmax = 0 + +function! s:CCTreeProgressBarInit(maxcount) + let s:progressmax = a:maxcount + let s:progress1percent = a:maxcount/100 + let s:progresspercent = 0 +endfunction + + +function! s:CCTreeProgressBarTick(count) + let s:progresscurrent += a:count + if s:progress1percent < s:progresscurrent + let s:progresscurrent = 0 + let s:progresspercent += 1 + call s:CCTreeBusyStatusLineExtraInfo("Processing ". s:progresspercent . + \ "\%, total ". s:progressmax. " items") + endif +endfunction + + +function! s:CCTreeWarningMsg(msg) + echohl WarningMsg + echo a:msg + echohl None +endfunction + +function! s:CCTreePreprocessFilter (val) + call s:CCTreeProgressBarTick(1) + return a:val =~ "^\t[`#$}]|^\k" +endfunction + +function! s:CCTreeLoadDB(db_name) + let curfuncidx = -1 + let newfuncidx = -1 + let curfileidx = -1 + let newfileidx = -1 + + call s:CCTreeUnloadDB() + + let cscope_db = a:db_name + if cscope_db == '' + let cscope_db = input('Cscope database: ', g:CCTreeCscopeDb, 'file') + if cscope_db == '' + return + endif + endif + + if !filereadable(cscope_db) + call s:CCTreeWarningMsg('Cscope database ' . cscope_db . ' not found') + return + endif + + call s:CCTreeBusyStatusLineUpdate('Loading database') + let symbols = readfile(cscope_db) + if empty(symbols) + call s:CCTreeWarningMsg("Failed to read cscope database") + call s:CCTreeRestoreStatusLine() + return + endif + + let symindex = 0 + let symlocalstart = 0 + let symlocalcount = 0 + + " Grab previous status line + call s:CCTreeInitStatusLine() + + call s:CCTreeBusyStatusLineUpdate('Reading database') + " Check if database was built uncompressed + if symbols[0] !~ "cscope.*\-c" + let s:dbcompressed = 1 + else + let s:dbcompressed = 0 + endif + " Filter-out lines that doesn't have relevant information + call filter(symbols, 'v:val =~ "^\t[`#$}@\~]"') + call s:CCTreeProgressBarInit(len(symbols)) + + call s:CCTreeBusyStatusLineUpdate('Analyzing database') + for a in symbols + call s:CCTreeProgressBarTick(1) + + if a[1] == "`" + if curfuncidx != -1 + let newfuncidx = s:CCTreeSymbolListAdd(a[2:]) + call s:CCTreeSymbolMarkXRef(curfuncidx, newfuncidx) + endif + elseif a[1] == "$" + let curfuncidx = s:CCTreeSymbolListAdd(a[2:]) + elseif a[1] == "#" + call s:CCTreeSymbolListAdd(a[2:]) + elseif a[1] == "}" + let curfuncidx = -1 + elseif a[1] == "~" + let newfileidx = s:CCTreeSymbolListAdd(a[3:]) + call s:CCTreeSymbolMarkXRef(curfileidx, newfileidx) + elseif a[1] == "@" + if a[2] != "" + let curfileidx = s:CCTreeSymbolListAdd(a[2:]) + endif + endif + endfor + + if s:dbcompressed == 1 + call s:CCTreeBusyStatusLineUpdate('Uncompressing database') + " inplace uncompression + call s:Digraph_Uncompress(s:symlisttable, s:symhashtable) + endif + + call s:CCTreeRestoreStatusLine() + let s:dbloaded = 1 + echomsg "Done building database" +endfunction + + +function! s:CCTreeUnloadDB() + unlet s:symlisttable + unlet s:symhashtable + let s:dbloaded = 0 + " Force cleanup + call garbagecollect() + + let s:symlisttable = [] + let s:symhashtable = {} +endfunction + +function! s:CCTreeGetSymbolXRef(symname, direction) + let symentryidx = s:symhashtable[a:symname] + let symidslist = split(s:symlisttable[symentryidx][a:direction], ",") + let xrefs = {} + + for asymid in symidslist + let xrefs[s:symlisttable[asymid]['n']] = 1 + endfor + return xrefs +endfunction + +function! s:CCTreeGetCallsForSymbol(symname, depth, direction) + if (a:depth > g:CCTreeRecursiveDepth) + return {} + endif + + if !has_key(s:symhashtable, a:symname) + return {} + endif + + let calltree_dict = {} + let calltree_dict['entry'] = a:symname + + for entry in keys(s:CCTreeGetSymbolXRef(a:symname, a:direction)) + if !has_key(calltree_dict, 'childlinks') + let calltree_dict['childlinks'] = [] + endif + let tmpDict = + \s:CCTreeGetCallsForSymbol(entry, a:depth+1, a:direction) + call add(calltree_dict['childlinks'], tmpDict) + endfor + return calltree_dict +endfunction + +func! s:FindOpenBuffer(filename) + let bnrList = tabpagebuflist(tabpagenr()) + + for bufnrs in bnrList + if (bufname(bufnrs) == a:filename) + let newWinnr = bufwinnr(bufnrs) + exec newWinnr.'wincmd w' + return 1 + endif + endfor + " Could not find the buffer + return 0 +endfunction + +function! s:CCTreePreviewWindowLeave() + call s:FindOpenBuffer(s:lastbufname) +endfunction + +function! CCTreePreviewStatusLine() + let rtitle= s:windowtitle. ' -- '. s:currentkeyword. + \'[Depth: '. g:CCTreeRecursiveDepth.',' + + if s:currentdirection == 'p' + let rtitle .= "(Reverse)" + else + let rtitle .= "(Forward)" + endif + + return rtitle.']' +endfunction + +function! s:CCTreePreviewWindowEnter() + let s:lastbufname = bufname("%") + if s:FindOpenBuffer(s:windowtitle) == 0 + if g:CCTreeWindowVertical == 1 + exec g:CCTreeOrientation." vsplit ". s:windowtitle + set winfixwidth + else + exec g:CCTreeOrientation." split ". s:windowtitle + set winfixheight + endif + + setlocal buftype=nofile + setlocal bufhidden=wipe + setlocal noswapfile + setlocal nonumber + setlocal statusline=%=%{CCTreePreviewStatusLine()} + + + syntax match CCTreePathMark /\s[|+]/ contained + syntax match CCTreeArrow /-*[<>]/ contained + syntax match CCTreeSymbol / [A-Za-z0-9_\.\\\/]\+/ contained + + syntax region CCTreeSymbolLine start="^\s" end="$" contains=CCTreeArrow,CCTreePathMark,CCTreeSymbol oneline + + syntax match CCTreeHiArrow /-*[<>]/ contained + syntax match CCTreeHiSymbol / [A-Za-z0-9_\.\\\/]\+/ contained + syntax match CCTreeHiPathMark /\s[|+]/ contained + + syntax match CCTreeMarkExcl /^[!#]/ contained + syntax match CCTreeMarkTilde /@/ contained + syntax region CCTreeUpArrowBlock start="@" end=/[|+]/ contains=CCTreeMarkTilde contained oneline + + syntax region CCTreeHiSymbolLine start="!" end="$" contains=CCTreeMarkExcl, + \ CCTreeUpArrowBlock, + \ CCTreeHiSymbol,CCTreeHiArrow,CCTreeHiPathMark oneline + + syntax region CCTreeMarkedSymbolLine start="#" end="$" contains=CCTreeMarkExcl, + \ CCTreeMarkTilde,CCTreePathMark, + \ CCTreeArrow,CCTreeSymbol,CCTreeUpArrowBlock oneline + + let cpo_save = &cpoptions + set cpoptions&vim + + call s:CCTreeBufferKeyMappingsCreate() + nnoremap :CCTreePreviewBufferUsingTag + nnoremap :CCTreeLoadBufferUsingTag + nnoremap <2-LeftMouse> :CCTreeLoadBufferUsingTag + + let &cpoptions = cpo_save + endif + setlocal foldmethod=expr + setlocal foldexpr=s:CCTreeFoldExpr(getline(v:lnum)) + setlocal foldtext=CCTreeFoldText() + let &l:foldlevel=g:CCTreeMinVisibleDepth +endfunction + + +function! s:CCTreeBuildTreeForLevel(dict, level, treelist, lvllen) + if !has_key(a:dict, 'entry') + return + endif + + if g:CCTreeDisplayMode == 1 + let curlevellen = 1 + elseif g:CCTreeDisplayMode == 2 + let curlevellen = a:level + 2 + elseif g:CCTreeDisplayMode == 3 + let curlevellen = strlen(a:dict['entry']) + a:level + 2 + endif + + let a:lvllen[a:level] = min([a:lvllen[a:level], curlevellen]) + + + call add(a:treelist, [a:dict['entry'], a:level]) + if has_key(a:dict, 'childlinks') + for a in a:dict['childlinks'] + call s:CCTreeBuildTreeForLevel(a, a:level+1, a:treelist, a:lvllen) + endfor + endif +endfunction + + +let s:calltreemaxdepth = 10 +function! s:CCTreeBuildTreeDisplayItems(treedict, treesymlist) + let treexinfo = repeat([255], s:calltreemaxdepth) + call s:CCTreeBuildTreeForLevel(a:treedict, 0, a:treesymlist, treexinfo) + return s:CCTreeBuildDisplayPrependText(treexinfo) +endfunction + + +function! s:CCTreeBuildDisplayPrependText(lenlist) + let pptxt = " " + let treepptext = repeat([" "], s:calltreemaxdepth) + + if s:currentdirection == 'p' + let directiontxt = "< " + elseif s:currentdirection == 'c' + let directiontxt = "> " + endif + + let treepptext[0] = pptxt."+".directiontxt + + for idx in range(1, s:calltreemaxdepth-1) + if a:lenlist[idx] != 255 + let pptxt .= repeat(" ", a:lenlist[idx-1]) + let treepptext[idx] = pptxt."+" + + if g:CCTreeDisplayMode == 1 + let arrows = '-' + elseif g:CCTreeDisplayMode >= 2 + let arrows = repeat("-", idx) + endif + + let treepptext[idx] = pptxt."+".arrows.directiontxt + let pptxt .= "|" + endif + endfor + return treepptext +endfunction + +function! s:CCTreeDisplayTreeList(pptxtlst, treelst) + for aentry in a:treelst + call setline(".", a:pptxtlst[aentry[1]]. aentry[0]) + let b:maxwindowlen = max([strlen(getline("."))+1, b:maxwindowlen]) + exec "normal o" + endfor +endfunction + + +" Provide dynamic call-tree highlighting using +" syntax highlight tricks +" +" There are 3 types of lines, marked with the start character [\s, !, #] +" Also @ is used to mark the path that is going up + +function! s:CCTreeMarkCallTree(treelst, keyword) + let declevel = -1 + + for idx in range(line("."), 1, -1) + " Find our keyword + if declevel == -1 + if a:treelst[idx-1][0] == a:keyword + let declevel = a:treelst[idx-1][1] + endif + endif + + " Skip folds + if declevel != -1 && foldclosed(idx) == -1 + let curline = getline(idx) + if declevel == a:treelst[idx-1][1] + let linemarker = '!' + let declevel -= 1 + else + let linemarker = '#' + endif + let pos = match(curline, '[+|]', 0, declevel+1) + " Unconventional change char + let curline = linemarker.strpart(curline, 1, pos-2).'@'. + \ strpart(curline, pos, 1). strpart(curline, pos+1) + call setline(idx, curline) + endif + endfor +endfunction + + + +function! s:CCTreeDisplayTreeInWindow(atree) + let incctreewin = 1 + if (bufname('%') != s:windowtitle) + call s:CCTreePreviewWindowEnter() + let incctreewin = 0 + endif + setlocal modifiable + 1,$d + let b:treelist = [] + let b:maxwindowlen = g:CCTreeWindowMinWidth + let treemarkertxtlist = s:CCTreeBuildTreeDisplayItems(a:atree, b:treelist) + call s:CCTreeDisplayTreeList(treemarkertxtlist, b:treelist) + + if g:CCTreeWindowVertical == 1 + if g:CCTreeWindowWidth == -1 + exec "vert resize". b:maxwindowlen + else + exec "vertical resize". g:CCTreeWindowWidth + endif + else + if g:CCTreeWindowHeight != -1 + let &winminheight = g:CCTreeWindowHeight + exec "resize".g:CCTreeWindowHeight + endif + endif + + exec "normal gg" + + " Need to force this again + let &l:foldlevel=g:CCTreeMinVisibleDepth + setlocal nomodifiable + if (incctreewin == 0) + call s:CCTreePreviewWindowLeave() + endif +endfunction + +function! s:CCTreeFoldExpr(line) + let lvl = b:treelist[v:lnum-1][1] + if lvl == 0 + let lvl = 1 + endif + return '>'.lvl +endfunction + + +function! CCTreeFoldText() + let line = substitute(getline(v:foldstart), '[!@#]', ' ' , 'g') + return line. " (+". (v:foldend - v:foldstart). + \ ')'. repeat(" ", winwidth(0)) +endfunction + + +function! s:CCTreeStoreState(symbol, direction) + let s:currentkeyword = a:symbol + let s:currentdirection = a:direction +endfunction + +function! s:CCTreeDBIsLoaded() + if s:dbloaded == 0 + call s:CCTreeWarningMsg('CCTree database not loaded') + return 0 + endif + return 1 +endfunction + +" Trick to get the current script ID +map xx xx +let s:sid = substitute(maparg('xx'), '\(\d\+_\)xx$', '\1', '') +unmap xx + +function! s:CCTreeTraceTreeForSymbol(sym_arg, direction) + if s:CCTreeDBIsLoaded() == 0 + return + endif + + let symbol = a:sym_arg + if symbol == '' + let symbol = input('Trace symbol: ', expand(''), + \ 'customlist,' . s:sid . 'CCTreeCompleteKwd') + if symbol == '' + return + endif + endif + + let atree = s:CCTreeGetCallsForSymbol(symbol, 0, a:direction) + call s:CCTreeStoreState(symbol, a:direction) + call s:CCTreeUpdateForCurrentSymbol() +endfunction + +function! s:CCTreeUpdateForCurrentSymbol() + if s:currentkeyword != '' + let atree = s:CCTreeGetCallsForSymbol(s:currentkeyword, 0, s:currentdirection) + call s:CCTreeDisplayTreeInWindow(atree) + endif +endfunction + + +function! s:CCTreeGetCurrentKeyword() + let curline = line(".") + if foldclosed(curline) == -1 + let curkeyword = matchstr(getline("."), s:CCTreeKeywordRegEx) + if curkeyword != '' + if curkeyword != s:CCTreekeyword || curline != s:CCTreekeywordLine + let s:CCTreekeyword = curkeyword + let s:CCTreekeywordLine = line(".") + return 1 + endif + endif + endif + return -1 +endfunction + +function! s:CCTreeLoadBufferFromKeyword() + if s:CCTreeGetCurrentKeyword() == -1 + return + endif + + try + exec 'wincmd p' + catch + call s:CCTreeWarningMsg('No buffer to load file') + finally + if (cscope_connection() > 0) + try + exec "cs find g ".s:CCTreekeyword + catch + " cheap hack + exec "cs find f ".s:CCTreekeyword + endtry + else + try + " Ctags is smart enough to figure the path + exec "tag ".fnamemodify(s:CCTreekeyword, ":t") + catch /^Vim\%((\a\+)\)\=:E426/ + call s:CCTreeWarningMsg('Tag '. s:CCTreekeyword .' not found') + wincmd p + endtry + endif + endtry +endfunction + +function! s:CCTreePreviewBufferFromKeyword() + call s:CCTreeGetCurrentKeyword() + if s:CCTreekeyword == '' + return + endif + silent! wincmd P + if !&previewwindow + wincmd p + endif + exec "ptag ".s:CCTreekeyword +endfunction + + +function! s:CCTreeSanitizeCallDepth() + let error = 0 + if g:CCTreeRecursiveDepth >= s:calltreemaxdepth + g:CCTreeRecursiveDepth = s:calltreemaxdepth + let error = 1 + elseif g:CCTreeRecursiveDepth < 1 + g:CCTreeRecursiveDepth = 1 + let error = 1 + endif + + if error == 1 + call s:CCTreeWarningMsg('Depth out of bounds') + endif + return error +endfunction + +function! s:CCTreeRecursiveDepthIncrease() + let g:CCTreeRecursiveDepth += 1 + if s:CCTreeSanitizeCallDepth() == 0 + call s:CCTreeUpdateForCurrentSymbol() + endif +endfunction + +function! s:CCTreeRecursiveDepthDecrease() + let g:CCTreeRecursiveDepth -= 1 + if s:CCTreeSanitizeCallDepth() == 0 + call s:CCTreeUpdateForCurrentSymbol() + endif +endfunction + + +" Use this function to determine the correct "g" flag +" for substitution +function! s:CCTreeGetSearchFlag(gvalue) + let ret = (!a:gvalue)* (&gdefault) + (!&gdefault)*(a:gvalue) + if ret == 1 + return 'g' + endif + return '' +endfunc + +function! s:CCTreeClearMarks() + let windict = winsaveview() + silent! exec "1,$s/[!#@]/ /e".s:CCTreeGetSearchFlag(1) + call winrestview(windict) +endfunction + +function! s:CCTreeCursorHoldHandle() + if g:CCTreeHilightCallTree && s:CCTreeGetCurrentKeyword() != -1 + setlocal modifiable + call s:CCTreeClearMarks() + call s:CCTreeMarkCallTree(b:treelist, s:CCTreekeyword) + setlocal nomodifiable + endif +endfunction + +" CCTreeCompleteKwd +" Command line completion function to return names from the db +function! s:CCTreeCompleteKwd(arglead, cmdline, cursorpos) + if a:arglead == '' + return keys(s:symhashtable) + else + return filter(keys(s:symhashtable), 'v:val =~? a:arglead') + endif +endfunction + +augroup CCTreeGeneral + au! + autocmd CursorHold CCTree-Preview call s:CCTreeCursorHoldHandle() +augroup END + + + +"Standard display +highlight link CCTreeSymbol Function +highlight link CCTreeMarkers LineNr +highlight link CCTreeArrow CCTreeMarkers +highlight link CCTreePathMark CCTreeArrow +highlight link CCTreeHiPathMark CCTreePathMark + +" highlighted display +highlight link CCTreeHiSymbol TODO +highlight link CCTreeHiMarkers StatusLine +highlight link CCTreeHiArrow CCTreeHiMarkers +highlight link CCTreeUpArrowBlock CCTreeHiArrow + +highlight link CCTreeMarkExcl Ignore +highlight link CCTreeMarkTilde Ignore + + +" Define commands +command! -nargs=? -complete=file CCTreeLoadDB call s:CCTreeLoadDB() +command! -nargs=0 CCTreeUnLoadDB call s:CCTreeUnloadDB() +command! -nargs=? -complete=customlist,s:CCTreeCompleteKwd + \ CCTreeTraceForward call s:CCTreeTraceTreeForSymbol(, 'c') +command! -nargs=? -complete=customlist,s:CCTreeCompleteKwd CCTreeTraceReverse + \ call s:CCTreeTraceTreeForSymbol(, 'p') +command! -nargs=0 CCTreeLoadBufferUsingTag call s:CCTreeLoadBufferFromKeyword() +command! -nargs=0 CCTreePreviewBufferUsingTag call s:CCTreePreviewBufferFromKeyword() +command! -nargs=0 CCTreeRecurseDepthPlus call s:CCTreeRecursiveDepthIncrease() +command! -nargs=0 CCTreeRecurseDepthMinus call s:CCTreeRecursiveDepthDecrease() + + +function! s:CCTreeGetKeyword() + let keyw = expand("") + let keyf = expand("") + + if keyw != keyf + if has_key(s:symhashtable, keyf) + return keyf + elseif has_key(s:symhashtable, keyw) + return keyw + endif + else + return keyw + endif + return '' +endfunction + + +function! s:CCTreeBufferKeyMappingsCreate() + let func_expr = ''.s:sid.'CCTreeGetKeyword()' + exec 'nnoremap < :CCTreeTraceReverse ='.func_expr.'' + exec 'nnoremap > :CCTreeTraceForward ='.func_expr.'' + + nnoremap = :CCTreeRecurseDepthPlus + nnoremap - :CCTreeRecurseDepthMinus +endfunction + +augroup CCTreeMaps +au! +" Header files get detected as cpp? +" This is a bug in Vim 7.2, a patch needs to be applied to the runtime c +" syntax files +" For now, use this hack to make *.h files work +autocmd FileType * if &ft == 'c'|| &ft == 'cpp' |call s:CCTreeBufferKeyMappingsCreate()| endif +augroup END + + +" Cscope Digraph character compression/decompression routines +" the logic of these routines are based off the Cscope source code + +let s:dichar1 = " teisaprnl(of)=c" +let s:dichar2 = " tnerpla" + +function! s:Digraph_DictTable_Init () + let dicttable = [] + let index = 0 + + for dc1 in range(strlen(s:dichar1)) + for dc2 in range(strlen(s:dichar2)) + call add(dicttable, s:dichar1[dc1].s:dichar2[dc2]) + endfor + endfor + + return dicttable +endfunction + +function! s:Digraph_Uncompress_Slow (value, dicttable) + let retval = "" + for idx in range(strlen(a:value)) + let charext = char2nr(a:value[idx])-128 + if charext >= 0 + let retval .= a:dicttable[charext] + else + let retval .= a:value[idx] + endif + endfor + return retval +endfunction + +function! s:Digraph_Uncompress_Fast (value, dicttable) + let dichar_list = split(a:value, '[^\d128-\d255]\{}') + let retval = a:value + for adichar in dichar_list + let retval = substitute(retval, '\C'.adichar, a:dicttable[char2nr(adichar)-128], "g") + endfor + return retval +endfunction + + +function! s:Digraph_Uncompress_filter_loop(compressedsym, symlist, symhash, cmpdict) + let idx = a:symhash[a:compressedsym] + let uncmpname = s:Digraph_Uncompress_Fast(a:compressedsym, a:cmpdict) + let a:symhash[uncmpname] = idx + let a:symlist[idx]['n'] = uncmpname + call s:CCTreeProgressBarTick(1) + return 0 +endfunction + +function! s:Digraph_Uncompress (symlist, symhash) + let compressdict = s:Digraph_DictTable_Init() + + call s:CCTreeProgressBarInit(len(a:symhash)) +" The encoding needs to be changed to 8-bit, otherwise we can't swap special +" 8-bit characters; restore after done + let encoding_save=&encoding + let &encoding="latin1" + + for compressedsym in keys(a:symhash) + let idx = a:symhash[compressedsym] + let uncmpname = s:Digraph_Uncompress_Fast(compressedsym, compressdict) + let a:symhash[uncmpname] = idx + " free the old entry + unlet a:symhash[compressedsym] + let a:symlist[idx]['n'] = uncmpname + call s:CCTreeProgressBarTick(1) + endfor + let &encoding=encoding_save +endfunction + + +function! s:Digraph_Compress(value, dicttable) + let index = 0 + let retval = "" + + while index < strlen(a:value) + let dc1 = stridx(s:dichar1, a:value[index]) + if dc1 != -1 + let dc2 = stridx(s:dichar2, a:value[index+1]) + if dc2 != -1 + let retval .= nr2char(128 + (dc1*8) + dc2) + " skip 2 chars + let index += 2 + continue + endif + endif + let retval .= a:value[index] + let index += 1 + endwhile + return retval +endfunction + + +" restore 'cpo' +let &cpoptions = s:cpo_save +unlet s:cpo_save + diff --git a/.vim/plugin/cscope.vim b/.vim/plugin/cscope.vim new file mode 100644 index 0000000..ed07574 --- /dev/null +++ b/.vim/plugin/cscope.vim @@ -0,0 +1,130 @@ + +" if compiled with --enable-cscope +if has("cscope") + " use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t' + set cscopetag + " use ctags before cscope + set csto=0 + " add any cscope database in current directory + if filereadable("cscope.out") + cscope add cscope.out + endif + " add the database pointed by environment variable. + " Cscope file added from db should contains full path to file. Otherwise they + " should be added with cscope add PATH_TO_CSCOPE_FILE PATH_TO_SRC_ROOT + if $CSCOPE_DB != "" + if filereadable($CSCOPE_DB) + cscope add $CSCOPE_DB + endif + endif + " show message when any other cscope db added + set cscopeverbose + " open include file with F4 and split with shift+F4 + nmap :cscope find f =expand("") + nmap :scscope find f =expand("") + " find this C symbol with F5 and split with shift+F5 + nmap :cscope find s =expand("") + nmap :scscope find s =expand("") + " go to definition with F6 and split with shift+F6 and use ctags with alt+shift+F6 + nmap :cscope find g =expand("") + nmap :scscope find g =expand("") + nmap :tag =expand("") + " go to calls with F7 and split with shift+F7 + nmap :cscope find c =expand("") + nmap :scscope find c =expand("") + " go to ... with 'ctrl+s letter' and go back with ctrl+t + nmap s :cscope find s =expand("") + nmap g :cscope find g =expand("") + nmap c :cscope find c =expand("") + nmap t :cscope find t =expand("") + nmap e :cscope find e =expand("") + nmap f :cscope find f =expand("") + nmap i :cscope find i ^=expand("")$ + nmap d :cscope find d =expand("") + " split to ... with 'ctrl+space letter' + nmap s :scscope find s =expand("") + nmap g :scscope find g =expand("") + nmap c :scscope find c =expand("") + nmap t :scscope find t =expand("") + nmap e :scscope find e =expand("") + nmap f :scscope find f =expand("") + nmap i :scscope find i ^=expand("")$ + nmap d :scscope find d =expand("") + " vertical split to ... with 'ctrl+space ctrl+space letter' + nmap s :vertical scscope find s =expand("") + nmap g :vertical scscope find g =expand("") + nmap c :vertical scscope find c =expand("") + nmap t :vertical scscope find t =expand("") + nmap e :vertical scscope find e =expand("") + nmap f :vertical scscope find f =expand("") + nmap i :vertical scscope find i ^=expand("")$ + nmap d :vertical scscope find d =expand("") + " s symbol find all references to the token under cursor + " //find this C symbol + " g global find global definition of the token under cursor + " //find this definition + " c calls find all calls to the function name under cursor + " //find function calling this function + " d called find functions that function under cursor calls + " //find function called by this function + " t text find all instances of the text under cursor + " //find this text string + " e egrep egrep search for the word under cursor + " //find this egrep pattern + " f file open the filename under cursor + " //find this file + " i includes find files that include the filename under cursor + " //find files #including this file + + + function! GetCscopeDb(pathname) + if !isdirectory(a:pathname) || a:pathname == $HOME || a:pathname == '/' + return + endif + + let l:has_link = 0 + let l:tag_found = 0 + if resolve(a:pathname) != a:pathname + let l:has_link = 1 + endif + + let s:cscopefile = $HOME."/.vim/cscope/".substitute(a:pathname, '/', '_', 'g').".cscope" + if filereadable(s:cscopefile) + execute "cscope add ".s:cscopefile + let l:tag_found = 1 + endif + + if l:tag_found == 0 && l:has_link == 1 + let s:cscopefile = $HOME."/.vim/cscope/".substitute(resolve(a:pathname), '/', '_', 'g').".cscope" + if filereadable(s:cscopefile) + execute "cscope add ".s:cscopefile + let l:tag_found = 1 + endif + endif + + unlet s:cscopefile + + call GetCscopeDb(fnamemodify(a:pathname, ":h")) + endfunction + + function! GenerateCscopeDb() + let path = input('Create cscope db for: ', getcwd(), 'dir') + + echohl WarningMsg + echo "Please wait, generating cscope db..." + + let file = tempname() + let cscopefile = $HOME."/.vim/cscope/".substitute(path, '/', '_', 'g').".cscope" + call system("cd ".path."; find . -name '*.c' -or -name '*.h' > ".file."; cscope -b -i ".file." -f ".cscopefile) + call delete(file) + + redraw + echo "Please wait, generating cscope db... Done" + echohl None + + call GetCscopeDb(path) + endfunction + command! GenerateCscopeDb :call GenerateCscopeDb() + + +endif diff --git a/.vim/plugin/eclim.vim b/.vim/plugin/eclim.vim deleted file mode 100644 index 207967b..0000000 --- a/.vim/plugin/eclim.vim +++ /dev/null @@ -1,170 +0,0 @@ -" Author: Eric Van Dewoestine -" -" Description: {{{ -" Plugin which bootstraps the eclim environment. -" -" License: -" -" Copyright (C) 2005 - 2009 Eric Van Dewoestine -" -" This program is free software: you can redistribute it and/or modify -" it under the terms of the GNU General Public License as published by -" the Free Software Foundation, either version 3 of the License, or -" (at your option) any later version. -" -" This program is distributed in the hope that it will be useful, -" but WITHOUT ANY WARRANTY; without even the implied warranty of -" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -" GNU General Public License for more details. -" -" You should have received a copy of the GNU General Public License -" along with this program. If not, see . -" -" }}} - -" Command Declarations {{{ -if !exists(":EclimValidate") - command EclimValidate :call Validate() -endif -" }}} - -" Validate() {{{ -" Validates some settings and environment values required by eclim. -" NOTE: don't add command-line continuation characters anywhere in the -" function, just in case the user has &compatible set. -function! s:Validate() - " Check vim version. - if v:version < 700 - let ver = strpart(v:version, 0, 1) . '.' . strpart(v:version, 2) - echom "Error: Your vim version is " . ver . "." - echom " Eclim requires version 7.x.x" - return - endif - - let errors = [] - - " Check 'compatible' option. - if &compatible - call add(errors, "Error: You have 'compatible' set:") - call add(errors, " Eclim requires 'set nocompatible' in your vimrc.") - call add(errors, " Type \":help 'compatible'\" for more details.") - endif - - " Check filetype support - redir => ftsupport - silent filetype - redir END - let ftsupport = substitute(ftsupport, '\n', '', 'g') - if ftsupport !~ 'detection:ON' || ftsupport !~ 'plugin:ON' - echo " " - let chose = 0 - while string(chose) !~ '1\|2' - redraw - echo "Filetype plugin support looks to be disabled, but due to possible" - echo "language differences, please check the following line manually." - echo " " . ftsupport - echo "Does it have detection and plugin 'ON'?" - echo "1) Yes" - echo "2) No" - let chose = input("Please Choose (1 or 2): ") - endwhile - if chose != 1 - call add(errors, "Error: Eclim requires filetype plugins to be enabled.") - call add(errors, " Please add 'filetype plugin indent on' to your vimrc.") - call add(errors, " Type \":help filetype-plugin-on\" for more details.") - endif - endif - - " Print the results. - redraw - echohl Statement - if len(errors) == 0 - echom "Result: OK, required settings are valid." - else - for error in errors - echom error - endfor - endif - echohl None -endfunction " }}} - -" exit early if unsupported vim version, compatible is set, or eclim is -" disabled. -if v:version < 700 || &compatible || exists("g:EclimDisabled") - finish -endif - -" EclimBaseDir() {{{ -" Gets the base directory where the eclim vim scripts are located. -function! EclimBaseDir() - if !exists("g:EclimBaseDir") - let savewig = &wildignore - set wildignore="" - let file = findfile('plugin/eclim.vim', escape(&runtimepath, ' ')) - let &wildignore = savewig - - if file == '' - echoe 'Unable to determine eclim basedir. ' . - \ 'Please report this issue on the eclim user mailing list.' - let g:EclimBaseDir = '' - return g:EclimBaseDir - endif - let basedir = substitute(fnamemodify(file, ':p:h:h'), '\', '/', 'g') - - let g:EclimBaseDir = escape(basedir, ' ') - endif - - return g:EclimBaseDir -endfunction " }}} - -" Init() {{{ -" Initializes eclim. -function! s:Init() - " on windows, this eclim plugin gets called first, so force taglist to be - " called prior. - runtime! plugin/taglist.vim - - " add eclim dir to runtime path. - let basedir = EclimBaseDir() - if basedir == '' - return - endif - - exec 'set runtimepath+=' . - \ basedir . '/eclim,' . - \ basedir . '/eclim/after' - - " Alternate version which inserts the eclim path just after the currently - " executing runtime path element and puts the eclim/after path at the very - " end. - "let paths = split(&rtp, ',') - "let index = 0 - "for path in paths - " let index += 1 - " if tolower(path) == tolower(basedir) - " break - " endif - "endfor - - "let tail = paths[index :] - - "for path in tail - " exec 'set runtimepath-=' . escape(path, ' ') - "endfor - - "exec 'set runtimepath+=' . basedir . '/eclim' - - "for path in tail - " exec 'set runtimepath+=' . escape(path, ' ') - "endfor - - "exec 'set runtimepath+=' . basedir . '/eclim/after' - - " need to be manually sourced - runtime! eclim/plugin/*.vim - runtime! eclim/after/plugin/*.vim -endfunction " }}} - -call Init() - -" vim:ft=vim:fdm=marker diff --git a/.vim/filetype.vim b/.vim/plugin/filetype.vim similarity index 100% rename from .vim/filetype.vim rename to .vim/plugin/filetype.vim diff --git a/.vim/plugin/indent_finder.pyc b/.vim/plugin/indent_finder.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b63046de40b0ea944951404984e4fe5d48a66951 GIT binary patch literal 12021 zcmbtaO>7)ja(>-28ghoDsDF`m;%!NmHIzyE|0jxMuVl&+*Aitnsg+Dy9yF(W$R=mH zhy8j)av>o>Y+x6A$OZ_4#RkFN0{9RhK!CuxCumABOFf8>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|1BYx^SjI%$fFDQ7)wkJnn3S$mP7{kSX#qnz=M>Y_}-ViHnf1w;wmaHSM2d}#jcjC zqt%J($?Ch+g=(W(ZK8ub4xy=u_OF3ssQ5$0=mgroD|u!nvTgO9g?m2{On?>}6@P=( z=)3(4RUGOL)z&wqY}CA=0Dxtt7j34zOL*=ta}mTjZ#jrLM5qe&LOzj(88>-Nfrw^!V0+zJ_S*Eq#iD3A6A%KSt<7Lxe( z&Y#m1nY&WR0#%R@=VQGo!SSkvOb|Y0`>LjxMaxXV-lAlbpu|AIVOaVfJ88XTW93E%@QGE yz~s{{Rw%q^-avhabI7ZmfSRM=w^XU}fq==ARZ2%k_^_%9dp`Orl~n8F*8c%Z;7Tn3 literal 0 HcmV?d00001 diff --git a/.vim/plugin/indent_finder.vim b/.vim/plugin/indent_finder.vim index 9ab9d24..e511393 100755 --- a/.vim/plugin/indent_finder.vim +++ b/.vim/plugin/indent_finder.vim @@ -1,10 +1,10 @@ - +" Done in .vimrc augroup IndentFinder au! IndentFinder au BufRead *.* let b:indent_finder_result = system('python2 -c "import indent_finder; indent_finder.main()" --vim-output "' . expand('%') . '"' ) au BufRead *.* execute b:indent_finder_result - - " Uncomment the next line to see which indentation is applied on all your loaded files - " au BufRead *.* echo "Indent Finder: " . b:indent_finder_result +" +" " Uncomment the next line to see which indentation is applied on all your loaded files +" " au BufRead *.* echo "Indent Finder: " . b:indent_finder_result augroup End diff --git a/.vim/plugin/language.vim b/.vim/plugin/language.vim new file mode 100644 index 0000000..4439500 --- /dev/null +++ b/.vim/plugin/language.vim @@ -0,0 +1,30 @@ +""""""""""""""""""""""""""""""""""""""""""" +" Language +""""""""""""""""""""""""""""""""""""""""""" +" Using dictd +function! Translate() + let word = expand("") + let output = system("echo -n $(dict -d eng-fra -f " .word. " 2> /dev/null | tail -n +3 | head -n -1 | sed '1s/$/:/;2,$s/$/;/')") + if output != "" + echohl WarningMsg + echo output + echohl None + else + echohl WarningMsg + echo "No translation found" + echohl None + endif +endfunction +"default Leader is \ +nnoremap t :call Translate() + +" to enable spellchecking :set spell" +" c.f. :help spell +" ]s search next misspelled +" [s search previous misspelled +" z= suggestion +" trad files should be under /usr/share/vim/vimfiles/spell +" or .vim/spell +" they can be download at http://ftp.vim.org/vim/runtime/spell/ +set spell spelllang=en +set nospell diff --git a/.vim/plugin/mycolor.vim b/.vim/plugin/mycolor.vim new file mode 100644 index 0000000..9e6366b --- /dev/null +++ b/.vim/plugin/mycolor.vim @@ -0,0 +1,98 @@ +""""""""""" +" DISPLAY " +""""""""""" +" color palette +set t_Co=256 +" syntax highlighting when the terminal has colors +if &t_Co > 2 || has("gui_running") + syntax on + " my colors + set background=dark + highlight clear + if exists("syntax_on") + syntax reset + endif +if &t_Co == 256 + highlight! Normal ctermfg=77 ctermbg=Black + highlight! Statement ctermfg=254 ctermbg=Black + highlight! Comment ctermfg=191 ctermbg=Black + highlight! PreProc ctermfg=200 ctermbg=Black +else + highlight! Normal ctermfg=Green ctermbg=Black + highlight! Statement ctermfg=White ctermbg=Black + highlight! Comment ctermfg=Yellow ctermbg=Black + highlight! PreProc ctermfg=Magenta ctermbg=Black +endif + highlight! Constant ctermfg=Red ctermbg=Black + highlight! def link Structure Statement + highlight! def link StorageClass Statement + highlight! Type ctermfg=Grey ctermbg=Black + highlight! def link Identifier Type + highlight! Todo ctermfg=Black ctermbg=DarkRed + highlight! Search ctermfg=Black ctermbg=Yellow + highlight! def link IncSearch Visual +if &t_Co == 256 + highlight! DiffAdd ctermbg=54 cterm=none + highlight! DiffDelete ctermfg=Black ctermbg=54 cterm=none +else + highlight! DiffAdd ctermbg=DarkMagenta cterm=none + highlight! DiffDelete ctermfg=Black ctermbg=DarkMagenta cterm=none +endif + highlight! def link DiffChange DiffAdd + highlight! DiffText ctermfg=White ctermbg=DarkBlue cterm=none + highlight! def link Folded TabLineSel + highlight! def link FoldColumn Folded + highlight! MatchParen ctermbg=Blue +if &t_Co == 256 + highlight! BadWhitespace ctermbg=235 +elseif &t_Co > 8 + highlight! BadWhitespace ctermbg=DarkGrey +else + highlight! BadWhitespace ctermbg=DarkCyan +endif + highlight! Pmenu ctermfg=Grey ctermbg=DarkBlue +if &t_Co > 8 + highlight! PmenuSel ctermfg=Yellow ctermbg=Blue +else + highlight! PmenuSel ctermfg=Yellow ctermbg=Cyan +endif + highlight! def link PmenuSbar Pmenu + highlight! PmenuThumb ctermbg=DarkMagenta cterm=none +if &t_Co == 256 + highlight! LineNr ctermfg=DarkCyan ctermbg=235 + highlight! CursorLine ctermbg=236 cterm=none +else + highlight! LineNr ctermfg=DarkCyan ctermbg=Black + highlight! CursorLine ctermbg=DarkGrey cterm=none +endif + highlight! def link CursorColumn CursorLine + highlight! Visual ctermfg=White ctermbg=Blue cterm=none + highlight! VertSplit ctermfg=Grey ctermbg=Grey cterm=none + highlight! StatusLine ctermfg=Black ctermbg=Grey cterm=none +if &t_Co > 8 + highlight! StatusLineNC ctermfg=DarkGrey ctermbg=Grey cterm=none +else + highlight! StatusLineNC ctermfg=Cyan ctermbg=Grey cterm=none +endif + highlight! def link TabLine StatusLineNC + highlight! def link TabLineFill TabLine +if &t_Co == 256 + highlight! TabLineSel ctermfg=White ctermbg=235 cterm=none +elseif &t_Co > 8 + highlight! TabLineSel ctermfg=White ctermbg=Black cterm=none +else + highlight! TabLineSel ctermfg=White ctermbg=Black +endif + highlight! ModeMsg ctermfg=DarkCyan ctermbg=Black + highlight! WarningMsg ctermfg=Yellow ctermbg=Black + highlight! ErrorMsg ctermfg=Red ctermbg=Black +endif + + + +" define whitespaces at end of line as bad whitespaces +match BadWhitespace /\s\+$/ +" define extra spaces at the front of the line as bad whitespaces +match BadWhitespace /^\ \+/ +" define redundant whitespaces as bad whitespaces +match BadWhitespace /\s\+$\| \+\ze\t/ diff --git a/.vimrc b/.vimrc index c4c2aac..5950028 100644 --- a/.vimrc +++ b/.vimrc @@ -12,7 +12,7 @@ " S-F8 build ctags/cscope databases " M-F8 build kernel ctags/cscope databases " F9 view changes -" F10 folding ? +" F10 folding " F11 unhighlight search " F12 paste mode " C-left/right switch tab @@ -66,92 +66,6 @@ set updatetime=1000 """"""""""" " DISPLAY " """"""""""" -" color palette -set t_Co=256 -" syntax highlighting when the terminal has colors -if &t_Co > 2 || has("gui_running") - syntax on - " my colors - set background=dark - highlight clear - if exists("syntax_on") - syntax reset - endif -if &t_Co == 256 - highlight! Normal ctermfg=77 ctermbg=Black - highlight! Statement ctermfg=254 ctermbg=Black - highlight! Comment ctermfg=191 ctermbg=Black - highlight! PreProc ctermfg=200 ctermbg=Black -else - highlight! Normal ctermfg=Green ctermbg=Black - highlight! Statement ctermfg=White ctermbg=Black - highlight! Comment ctermfg=Yellow ctermbg=Black - highlight! PreProc ctermfg=Magenta ctermbg=Black -endif - highlight! Constant ctermfg=Red ctermbg=Black - highlight! def link Structure Statement - highlight! def link StorageClass Statement - highlight! Type ctermfg=Grey ctermbg=Black - highlight! def link Identifier Type - highlight! Todo ctermfg=Black ctermbg=DarkRed - highlight! Search ctermfg=Black ctermbg=Yellow - highlight! def link IncSearch Visual -if &t_Co == 256 - highlight! DiffAdd ctermbg=54 cterm=none - highlight! DiffDelete ctermfg=Black ctermbg=54 cterm=none -else - highlight! DiffAdd ctermbg=DarkMagenta cterm=none - highlight! DiffDelete ctermfg=Black ctermbg=DarkMagenta cterm=none -endif - highlight! def link DiffChange DiffAdd - highlight! DiffText ctermfg=White ctermbg=DarkBlue cterm=none - highlight! def link Folded TabLineSel - highlight! def link FoldColumn Folded - highlight! MatchParen ctermbg=Blue -if &t_Co == 256 - highlight! BadWhitespace ctermbg=235 -elseif &t_Co > 8 - highlight! BadWhitespace ctermbg=DarkGrey -else - highlight! BadWhitespace ctermbg=DarkCyan -endif - highlight! Pmenu ctermfg=Grey ctermbg=DarkBlue -if &t_Co > 8 - highlight! PmenuSel ctermfg=Yellow ctermbg=Blue -else - highlight! PmenuSel ctermfg=Yellow ctermbg=Cyan -endif - highlight! def link PmenuSbar Pmenu - highlight! PmenuThumb ctermbg=DarkMagenta cterm=none -if &t_Co == 256 - highlight! LineNr ctermfg=DarkCyan ctermbg=235 - highlight! CursorLine ctermbg=236 cterm=none -else - highlight! LineNr ctermfg=DarkCyan ctermbg=Black - highlight! CursorLine ctermbg=DarkGrey cterm=none -endif - highlight! def link CursorColumn CursorLine - highlight! Visual ctermfg=White ctermbg=Blue cterm=none - highlight! VertSplit ctermfg=Grey ctermbg=Grey cterm=none - highlight! StatusLine ctermfg=Black ctermbg=Grey cterm=none -if &t_Co > 8 - highlight! StatusLineNC ctermfg=DarkGrey ctermbg=Grey cterm=none -else - highlight! StatusLineNC ctermfg=Cyan ctermbg=Grey cterm=none -endif - highlight! def link TabLine StatusLineNC - highlight! def link TabLineFill TabLine -if &t_Co == 256 - highlight! TabLineSel ctermfg=White ctermbg=235 cterm=none -elseif &t_Co > 8 - highlight! TabLineSel ctermfg=White ctermbg=Black cterm=none -else - highlight! TabLineSel ctermfg=White ctermbg=Black -endif - highlight! ModeMsg ctermfg=DarkCyan ctermbg=Black - highlight! WarningMsg ctermfg=Yellow ctermbg=Black - highlight! ErrorMsg ctermfg=Red ctermbg=Black -endif " highlight the cursor line set cursorline " show the status line @@ -164,10 +78,39 @@ set showmode set showcmd " display line number" set number +" set status line +set statusline=%<%f\ %h%w%m%r%3.(\ %)%{fugitive#statusline()}%=%([%{Tlist_Get_Tagname_By_Line()}]%)%3.(\ %)%-14.(%l,%c%V%)\ %P +" always display status line +set laststatus=2 """"""""""""""" " INDENTATION " """"""""""""""" +" use tabs at the start of a line, spaces elsewhere +" set smarttab +set smartindent +set autoindent +" tab=4 +set tabstop=4 +set softtabstop=4 +set shiftwidth=4 +" real tabs +set noexpandtab + +if has("autocmd") + " python + " autocmd FileType python set tabstop=4|set shiftwidth=4|set expandtab + autocmd BufRead,BufNewFile *.py syntax on + autocmd BufRead,BufNewFile *.py set ai + autocmd BufRead,BufNewFile *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class + autocmd BufRead,BufNewFile *.py set tabstop=4 + autocmd BufRead,BufNewFile *.py set expandtab + autocmd BufRead,BufNewFile *.py set shiftwidth=4 + autocmd BufRead,BufNewFile *.py set softtabstop=4 + autocmd BufRead,BufNewFile *.py set modeline + +endif + if has("autocmd") " enable file type detection and do language-dependent indenting filetype plugin indent on @@ -184,33 +127,6 @@ else " indent-expr "set indentexpr "" endif -" tab=4 -set tabstop=4 -set softtabstop=4 -set shiftwidth=4 -" real tabs -set noexpandtab -" use tabs at the start of a line, spaces elsewhere -set smarttab -if has("autocmd") - " python - " autocmd FileType python set tabstop=4|set shiftwidth=4|set expandtab - autocmd BufRead,BufNewFile *.py syntax on - autocmd BufRead,BufNewFile *.py set ai - autocmd BufRead,BufNewFile *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class - autocmd BufRead,BufNewFile *.py set tabstop=4 - autocmd BufRead,BufNewFile *.py set expandtab - autocmd BufRead,BufNewFile *.py set shiftwidth=4 - autocmd BufRead,BufNewFile *.py set softtabstop=4 - autocmd BufRead,BufNewFile *.py set modeline - -endif -" define whitespaces at end of line as bad whitespaces -match BadWhitespace /\s\+$/ -" define extra spaces at the front of the line as bad whitespaces -match BadWhitespace /^\ \+/ -" define redundant whitespaces as bad whitespaces -match BadWhitespace /\s\+$\| \+\ze\t/ """""""""" " SEARCH " @@ -248,6 +164,7 @@ function GoToDefinition() endfunction nmap , :call GoToDefinition() nmap ; + " plugin taglist let Tlist_Ctags_Cmd = '/usr/bin/ctags' let Tlist_Process_File_Always = 1 @@ -265,88 +182,7 @@ let Tlist_Inc_Winwidth = 0 let Tlist_Use_Right_Window = 1 " open/close tag list window with F8 map :TlistToggle -" shown current tag in status bar -" set statusline=%<%f\ %h%m%r%=%([%{Tlist_Get_Tagname_By_Line()}]%)%3.(\ %)%-14.(%l,%c%V%)\ %P -" include Git status(plugin vim-fugitiv) and tag name in status -set laststatus=2 -"set statusline=%<%f\ %h%w%m%r%3.(\ %)%{fugitive#statusline()}%=%([%{Tlist_Get_Tagname_By_Line()}]%)%3.(\ %)%-14.(%l,%c%V%)\ %P -" if compiled with --enable-cscope -if has("cscope") - " use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t' - set cscopetag - " use ctags before cscope - set csto=0 - " add any cscope database in current directory - if filereadable("cscope.out") - cscope add cscope.out - endif - " add the database pointed by environment variable. - " Cscope file added from db should contains full path to file. Otherwise they - " should be added with cscope add PATH_TO_CSCOPE_FILE PATH_TO_SRC_ROOT - if $CSCOPE_DB != "" - if filereadable($CSCOPE_DB) - cscope add $CSCOPE_DB - endif - endif - " show message when any other cscope db added - set cscopeverbose - " open include file with F4 and split with shift+F4 - nmap :cscope find f =expand("") - nmap :scscope find f =expand("") - " find this C symbol with F5 and split with shift+F5 - nmap :cscope find s =expand("") - nmap :scscope find s =expand("") - " go to definition with F6 and split with shift+F6 and use ctags with alt+shift+F6 - nmap :cscope find g =expand("") - nmap :scscope find g =expand("") - nmap :tag =expand("") - " go to calls with F7 and split with shift+F7 - nmap :cscope find c =expand("") - nmap :scscope find c =expand("") - " go to ... with 'ctrl+s letter' and go back with ctrl+t - nmap s :cscope find s =expand("") - nmap g :cscope find g =expand("") - nmap c :cscope find c =expand("") - nmap t :cscope find t =expand("") - nmap e :cscope find e =expand("") - nmap f :cscope find f =expand("") - nmap i :cscope find i ^=expand("")$ - nmap d :cscope find d =expand("") - " split to ... with 'ctrl+space letter' - nmap s :scscope find s =expand("") - nmap g :scscope find g =expand("") - nmap c :scscope find c =expand("") - nmap t :scscope find t =expand("") - nmap e :scscope find e =expand("") - nmap f :scscope find f =expand("") - nmap i :scscope find i ^=expand("")$ - nmap d :scscope find d =expand("") - " vertical split to ... with 'ctrl+space ctrl+space letter' - nmap s :vertical scscope find s =expand("") - nmap g :vertical scscope find g =expand("") - nmap c :vertical scscope find c =expand("") - nmap t :vertical scscope find t =expand("") - nmap e :vertical scscope find e =expand("") - nmap f :vertical scscope find f =expand("") - nmap i :vertical scscope find i ^=expand("")$ - nmap d :vertical scscope find d =expand("") - " s symbol find all references to the token under cursor - " //find this C symbol - " g global find global definition of the token under cursor - " //find this definition - " c calls find all calls to the function name under cursor - " //find function calling this function - " d called find functions that function under cursor calls - " //find function called by this function - " t text find all instances of the text under cursor - " //find this text string - " e egrep egrep search for the word under cursor - " //find this egrep pattern - " f file open the filename under cursor - " //find this file - " i includes find files that include the filename under cursor - " //find files #including this file -endif + " cat Makefile | grep '\-I\/' | tr '[:space:]' '\n' | grep '\-I/' | sort -u | tr '\n' ' ' " build tags database with shift+F8 or alt+F8 to ignore /usr/include @@ -528,23 +364,6 @@ set tags+=~/.vim/qttags set tags+=~/.vim/qtembedded set tags+=~/.vim/tags/linux-sh4-ST-2.6.23.17 -" Affichage du prototype d'une fonction sur le -" plugin echofunc - - -" Eclim -command -range -nargs=* Google call eclim#web#SearchEngine( - \ 'http://www.google.com/search?q=', , , ) - -" QT manual with C-b -function! QtClassDoc() - let qt_dir = "/usr/share/qt4/doc/html/" - let class = tolower(expand("")) - silent execute "!x-www-browser " . qt_dir . class . ".html &>/dev/null" . " &" | redraw! -endfunction - -nmap :call QtClassDoc() - """""""""""""""""""""""""""""""""""""""""""""""""" "Poser une marque visible avec F7 """"""""""""""""""""""""""""""""""""""""""""""""""" @@ -554,98 +373,6 @@ nmap :call QtClassDoc() "map :sign unplace -function! GetProtoLine() - let ret = "" - let line_save = line(".") - let col_save = col(".") - let top = line_save - winline() + 1 - let so_save = &so - let &so = 0 - let istypedef = 0 - " find closing brace - let closing_lnum = search('^}','cW') - if closing_lnum > 0 - if getline(line(".")) =~ '\w\s*;\s*$' - let istypedef = 1 - let closingline = getline(".") - endif - " go to the opening brace - normal! % - " if the start position is between the two braces - if line(".") <= line_save - if istypedef - let ret = matchstr(closingline, '\w\+\s*;') - else - " find a line contains function name - let lnum = search('^\w','bcnW') - if lnum > 0 - let ret = getline(lnum) - endif - endif - endif - endif - " restore position and screen line - exe "normal! " . top . "Gz\" - call cursor(line_save, col_save) - let &so = so_save - return ret -endfunction - -function! WhatFunction() - if &ft != "c" && &ft != "cpp" - return "" - endif - let proto = GetProtoLine() - if proto == "" - return "?" - endif - if stridx(proto, '(') > 0 - let ret = matchstr(proto, '\w\+(\@=') - elseif proto =~# '\' - let ret = matchstr(proto, 'struct\s\+\w\+') - elseif proto =~# '\' - let ret = matchstr(proto, 'class\s\+\w\+') - else - let ret = strpart(proto, 0, 15) . "..." - endif - return ret -endfunction - -set statusline=%<%f\ %h%w%m%r%3.(\ %)%{fugitive#statusline()}%=%([%{Tlist_Get_Tagname_By_Line()}]%)%3.(\ %)%-14.(%l,%c%V%)\ %P -" Use WhatFunction could create some problems with lines longer that the -" screen size. WhatFunction could be interesting for C++ function -" set statusline=%<%f\ %h%w%m%r%3.(\ %)%{fugitive#statusline()}%=%([%{Tlist_Get_Tagname_By_Line()}%{WhatFunction()}]%)%3.(\ %)%-14.(%l,%c%V%)\ %P - -""""""""""""""""""""""""""""""""""""""""""" -" Language -""""""""""""""""""""""""""""""""""""""""""" -" Using dictd -function! Translate() - let word = expand("") - let output = system("echo -n $(dict -d eng-fra -f " .word. " 2> /dev/null | tail -n +3 | head -n -1 | sed '1s/$/:/;2,$s/$/;/')") - if output != "" - echohl WarningMsg - echo output - echohl None - else - echohl WarningMsg - echo "No translation found" - echohl None - endif -endfunction -"default Leader is \ -nnoremap t :call Translate() - -" to enable spellchecking :set spell" -" c.f. :help spell -" ]s search next misspelled -" [s search previous misspelled -" z= suggestion -" trad files should be under /usr/share/vim/vimfiles/spell -" or .vim/spell -" they can be download at http://ftp.vim.org/vim/runtime/spell/ -set spell spelllang=en -set nospell """"""""""""" " Latex "