From 7cbe6dca6df77872108b54e9f4af91a0bd174491 Mon Sep 17 00:00:00 2001 From: gryf Date: Mon, 12 Mar 2012 17:00:46 +0100 Subject: [PATCH] Plugins update --- .vimrc | 22 +- GetLatest/GetLatestVimScripts.dat | 17 +- bundle/git_ctrlp/autoload/ctrlp.vim | 387 ++++++++++-------- bundle/git_ctrlp/autoload/ctrlp/buffertag.vim | 13 +- bundle/git_ctrlp/autoload/ctrlp/changes.vim | 106 +++++ bundle/git_ctrlp/autoload/ctrlp/line.vim | 23 +- bundle/git_ctrlp/autoload/ctrlp/mrufiles.vim | 15 +- bundle/git_ctrlp/autoload/ctrlp/quickfix.vim | 9 +- bundle/git_ctrlp/autoload/ctrlp/tag.vim | 25 +- bundle/git_ctrlp/autoload/ctrlp/undo.vim | 6 +- bundle/git_ctrlp/doc/ctrlp.txt | 245 ++++++----- bundle/git_ctrlp/plugin/ctrlp.vim | 6 +- bundle/git_ctrlp/readme.md | 31 +- bundle/git_syntastic/README.markdown | 12 +- bundle/git_syntastic/autoload/syntastic/c.vim | 28 ++ bundle/git_syntastic/plugin/syntastic.vim | 144 ++++--- bundle/git_syntastic/syntax_checkers/c.vim | 45 +- bundle/git_syntastic/syntax_checkers/cpp.vim | 47 ++- .../syntax_checkers/javascript/jslint.vim | 5 +- bundle/git_syntastic/syntax_checkers/lua.vim | 11 +- bundle/git_syntastic/syntax_checkers/nasm.vim | 32 ++ bundle/git_syntastic/syntax_checkers/php.vim | 10 +- .../git_syntastic/syntax_checkers/python.vim | 59 +-- .../syntax_checkers/python/flake8.vim | 31 ++ .../syntax_checkers/python/pyflakes.vim | 34 ++ .../syntax_checkers/python/pylint.vim | 14 + bundle/git_syntastic/syntax_checkers/rst.vim | 2 +- bundle/git_syntastic/syntax_checkers/ruby.vim | 18 +- .../syntax_checkers/ruby/jruby.vim | 16 + .../syntax_checkers/ruby/mri.vim | 22 + .../git_syntastic/syntax_checkers/scala.vim | 33 ++ bundle/git_syntastic/syntax_checkers/vala.vim | 8 +- bundle/git_syntastic/syntax_checkers/z80.vim | 31 ++ .../autoload/taglisttoo/taglist.vim | 27 +- bundle/mark/autoload/mark.vim | 9 +- bundle/mark/doc/mark.txt | 11 +- bundle/mark/plugin/mark.vim | 12 +- 37 files changed, 977 insertions(+), 589 deletions(-) create mode 100644 bundle/git_ctrlp/autoload/ctrlp/changes.vim create mode 100644 bundle/git_syntastic/syntax_checkers/nasm.vim create mode 100644 bundle/git_syntastic/syntax_checkers/python/flake8.vim create mode 100644 bundle/git_syntastic/syntax_checkers/python/pyflakes.vim create mode 100644 bundle/git_syntastic/syntax_checkers/python/pylint.vim create mode 100644 bundle/git_syntastic/syntax_checkers/ruby/jruby.vim create mode 100644 bundle/git_syntastic/syntax_checkers/ruby/mri.vim create mode 100644 bundle/git_syntastic/syntax_checkers/scala.vim create mode 100644 bundle/git_syntastic/syntax_checkers/z80.vim diff --git a/.vimrc b/.vimrc index 3af8bd9..f2589a5 100644 --- a/.vimrc +++ b/.vimrc @@ -197,6 +197,9 @@ let g:ctrlp_custom_ignore = { let g:ctrlp_map = '' map b :CtrlPBuffer "}}} +"NERDCommenter {{{2 +let g:NERDSpaceDelims=1 +"}}} "}}} "KEYS: User defined keyboard shortcuts {{{ @@ -396,13 +399,20 @@ endfunction "}}} " GUI: detect graphics mode, set colorscheme {{{ if has('gui_running') - "set guifont=Consolas\ 12 "I like this font, but it looks like crap on linux - "set guifont=DejaVu\ Sans\ Mono\ 12 "at least, some ttf font that looks good - set guifont=Fixed\ 14 "I like this font better. + " I like this font, but it looks like crap on linux + "set guifont=Consolas\ 12 + " at least, some ttf font that looks good + "set guifont=DejaVu\ Sans\ Mono\ 12 + " Unfortunately there is a problem with TTF fonts in my gvim instance. + " After editing a while there are some leaving trash appearing on the + " buffer. Refreshing the screen helps, but is kinda annoying. It is + " probably my X11 setup, because on other similar workstations and setup I + " didn't noticed such behavior. Fallback to fixed-misc for a while. + set guifont=Fixed\ 14 set mouse=a "Enable mouse support - "No toolbar, menu, scrollbars, draw simple text tabs. This would keep - "window in one place, and also this will conserve space. Tabs are huge - "under GTK. + " No toolbar, menu, scrollbars, draw simple text tabs. This would keep + " window in one place, and also this will conserve space. Tabs are huge + " under GTK. set guioptions=agit "add menuitem OpenInWebBrowser nmenu 666 PopUp.&Open\ in\ browser :call OpenInWebBrowser() diff --git a/GetLatest/GetLatestVimScripts.dat b/GetLatest/GetLatestVimScripts.dat index ad53cda..574f5c6 100644 --- a/GetLatest/GetLatestVimScripts.dat +++ b/GetLatest/GetLatestVimScripts.dat @@ -7,7 +7,7 @@ ScriptID SourceID Filename 3304 17406 gundo.vim 2727 11120 jsbeautify.vim 2289 8922 loremipsum -2666 16840 Mark +2666 17554 Mark 1218 14455 nerdcommenter 2262 8944 occur.vim 2136 8206 repeat.vim @@ -21,19 +21,8 @@ ScriptID SourceID Filename 2321 9055 zoom.vim 52 14880 calendar.vim 3736 17319 ctrlp.vim -### colors -2855 12456 github.vim -1143 11833 inkpot.vim -2555 17225 jellybeans.vim -2536 16615 lucius.vim -3299 16882 sorcerer.vim -1165 3741 tolerable.vim -3309 15759 vydark -2589 15760 vylight -415 15531 zenburn -#3597 1 ColorV -# ftplugin -3818 1 MatchTag +### ftplugin +3818 16921 MatchTag 910 14691 pydoc.vim 2441 14403 pyflakes.vim 30 9196 python_fn.vim diff --git a/bundle/git_ctrlp/autoload/ctrlp.vim b/bundle/git_ctrlp/autoload/ctrlp.vim index a4390a5..a186072 100644 --- a/bundle/git_ctrlp/autoload/ctrlp.vim +++ b/bundle/git_ctrlp/autoload/ctrlp.vim @@ -2,7 +2,7 @@ " File: autoload/ctrlp.vim " Description: Fuzzy file, buffer, mru and tag finder. " Author: Kien Nguyen -" Version: 1.7.1 +" Version: 1.7.2 " ============================================================================= " Static variables {{{1 @@ -42,6 +42,15 @@ fu! s:opts() for [ke, va] in items(opts) exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1]) endfo + let new_opts = { + \ 'g:ctrlp_open_multiple_files': 's:opmul', + \ 'g:ctrlp_regexp': 's:regexp', + \ 'g:ctrlp_reuse_window': 's:nosplit', + \ 'g:ctrlp_switch_buffer': 's:jmptobuf', + \ } + for [key, val] in items(new_opts) + exe 'let' val '=' string(eval(exists(key) ? key : val)) + endfo if !exists('g:ctrlp_newcache') | let g:ctrlp_newcache = 0 | en let s:maxdepth = min([s:maxdepth, 100]) let s:mxheight = max([s:mxheight, 1]) @@ -49,9 +58,9 @@ fu! s:opts() let s:igntype = empty(s:usrign) ? -1 : type(s:usrign) " Extensions let g:ctrlp_builtins = 2 - if !empty(s:extensions) | for each in s:extensions + for each in s:extensions exe 'ru autoload/ctrlp/'.each.'.vim' - endfo | en + endfo " Keymaps let [s:lcmap, s:prtmaps] = ['nn ', { \ 'PrtBS()': ['', ''], @@ -60,10 +69,10 @@ fu! s:opts() \ 'PrtClear()': [''], \ 'PrtSelectMove("j")': ['', ''], \ 'PrtSelectMove("k")': ['', ''], - \ 'PrtSelectMove("t")': [''], - \ 'PrtSelectMove("b")': [''], - \ 'PrtSelectMove("u")': [''], - \ 'PrtSelectMove("d")': [''], + \ 'PrtSelectMove("t")': ['', ''], + \ 'PrtSelectMove("b")': ['', ''], + \ 'PrtSelectMove("u")': ['', ''], + \ 'PrtSelectMove("d")': ['', ''], \ 'PrtHistory(-1)': [''], \ 'PrtHistory(1)': [''], \ 'AcceptSelection("e")': ['', '<2-LeftMouse>'], @@ -97,26 +106,11 @@ fu! s:opts() if type(s:urprtmaps) == 4 cal extend(s:prtmaps, s:urprtmaps) en - let s:prtunmaps = [ - \ 'PrtBS()', - \ 'PrtDelete()', - \ 'PrtDeleteWord()', - \ 'PrtClear()', - \ 'PrtCurStart()', - \ 'PrtCurEnd()', - \ 'PrtCurLeft()', - \ 'PrtCurRight()', - \ 'PrtHistory(-1)', - \ 'PrtHistory(1)', - \ 'PrtInsert("w")', - \ 'PrtInsert("s")', - \ 'PrtInsert("v")', - \ 'PrtInsert("+")', - \ ] " Global options let s:glbs = { 'magic': 1, 'to': 1, 'tm': 0, 'sb': 1, 'hls': 0, 'im': 0, \ 'report': 9999, 'sc': 0, 'ss': 0, 'siso': 0, 'mfd': 200, 'mouse': 'n', - \ 'gcr': 'a:blinkon0', 'ic': 1, 'scs': 1, 'lmap': '' } + \ 'gcr': 'a:blinkon0', 'ic': 1, 'scs': 1, 'lmap': '', 'mousef': 0, + \ 'imd': 1 } if s:lazy cal extend(s:glbs, { 'ut': ( s:lazy > 1 ? s:lazy : 250 ) }) en @@ -136,6 +130,33 @@ let s:fpats = { \ '^\S\\?$': '\\?', \ } +" Mappings +let s:prtunmaps = [ + \ 'PrtBS()', + \ 'PrtDelete()', + \ 'PrtDeleteWord()', + \ 'PrtClear()', + \ 'PrtCurStart()', + \ 'PrtCurEnd()', + \ 'PrtCurLeft()', + \ 'PrtCurRight()', + \ 'PrtHistory(-1)', + \ 'PrtHistory(1)', + \ 'PrtInsert("w")', + \ 'PrtInsert("s")', + \ 'PrtInsert("v")', + \ 'PrtInsert("+")', + \ ] + +" Keypad +let s:kprange = { + \ 'Plus': '+', + \ 'Minus': '-', + \ 'Divide': '/', + \ 'Multiply': '*', + \ 'Point': '.', + \ } + " Highlight groups let s:hlgrps = { \ 'NoEntries': 'Error', @@ -149,21 +170,18 @@ let s:hlgrps = { \ } " * Open & Close {{{1 fu! s:Open() - if exists('g:ctrlp_log') && g:ctrlp_log - let cadir = ctrlp#utils#cachedir() - sil! exe 'redi! >' cadir.s:lash(cadir).'ctrlp.log' - en + cal s:log(1) cal s:getenv() sil! exe 'noa keepa' ( s:mwbottom ? 'bo' : 'to' ) '1new ControlP' - let [s:bufnr, s:prompt] = [bufnr('%'), ['', '', '']] + let [s:bufnr, s:prompt, s:winw] = [bufnr('%'), ['', '', ''], winwidth(0)] abc if !exists('s:hstry') let hst = filereadable(s:gethistloc()[1]) ? s:gethistdata() : [''] let s:hstry = empty(hst) || !s:maxhst ? [''] : hst en - for [ke, va] in items(s:glbs) + for [ke, va] in items(s:glbs) | if exists('+'.ke) sil! exe 'let s:glb_'.ke.' = &'.ke.' | let &'.ke.' = '.string(va) - endfo + en | endfo if s:opmul != '0' && has('signs') sign define ctrlpmark text=+> texthl=Search en @@ -174,21 +192,19 @@ fu! s:Close() try | noa bun! cat | noa clo! | endt cal s:unmarksigns() - for key in keys(s:glbs) + for key in keys(s:glbs) | if exists('+'.key) sil! exe 'let &'.key.' = s:glb_'.key - endfo + en | endfo if exists('s:glb_acd') | let &acd = s:glb_acd | en let [g:ctrlp_lines, g:ctrlp_allfiles] = [[], []] if s:winres[1] >= &lines && s:winres[2] == winnr('$') exe s:winres[0] en unl! s:focus s:hisidx s:hstgot s:marked s:statypes s:cline s:init s:savestr - \ s:winh g:ctrlp_nolimit + \ g:ctrlp_nolimit cal ctrlp#recordhist() cal s:onexit() - if exists('g:ctrlp_log') && g:ctrlp_log - sil! redi END - en + cal s:log(0) ec endf " * Clear caches {{{1 @@ -210,10 +226,9 @@ fu! ctrlp#reset() cal s:opts() cal ctrlp#utils#opts() cal ctrlp#mrufiles#opts() - unl! s:cline endf -" * Files() {{{1 -fu! s:Files() +" * Files {{{1 +fu! ctrlp#files() let [cwd, cafile, g:ctrlp_allfiles] = [getcwd(), ctrlp#utils#cachefile(), []] if g:ctrlp_newcache || !filereadable(cafile) || !s:caching let lscmd = s:lsCmd() @@ -292,23 +307,17 @@ fu! s:lsCmd() retu cmd['types'][key][1] en endf -fu! s:Buffers() "{{{1 - let allbufs = [] - for each in range(1, bufnr('$')) - if getbufvar(each, '&bl') && each != s:crbufnr - let bufname = bufname(each) - if strlen(bufname) && getbufvar(each, '&ma') && bufname != 'ControlP' - cal add(allbufs, fnamemodify(bufname, ':.')) - en - en - endfo - retu allbufs +" Buffers {{{1 +fu! ctrlp#buffers() + retu map(filter(range(1, bufnr('$')), 'empty(getbufvar(v:val, "&bt"))' + \ .' && getbufvar(v:val, "&bl") && strlen(bufname(v:val))'), + \ 'fnamemodify(bufname(v:val), ":.")') endf " * MatchedItems() {{{1 -fu! s:MatchIt(items, pat, limit, mfunc) - let newitems = [] +fu! s:MatchIt(items, pat, limit, mfunc, ipt) + let [newitems, crfile] = [[], exists('s:crfilerel') ? s:crfilerel : ''] for item in a:items - try | if call(a:mfunc, [item, a:pat]) >= 0 + try | if !( a:ipt && item == crfile ) && call(a:mfunc, [item, a:pat]) >= 0 cal add(newitems, item) en | cat | brea | endt if a:limit > 0 && len(newitems) >= a:limit | brea | en @@ -316,16 +325,15 @@ fu! s:MatchIt(items, pat, limit, mfunc) retu newitems endf -fu! s:MatchedItems(items, pat, limit) - let [items, pat, limit] = [a:items, a:pat, a:limit] - let [type, ipt, mfunc] = [s:type(1), s:ispathitem(), 'match'] - if s:byfname && ipt +fu! s:MatchedItems(items, pat, limit, ipt) + let [type, mfunc] = [s:type(1), 'match'] + if s:byfname && a:ipt let mfunc = 's:matchfname' elsei s:itemtype > 2 let types = { 'tabs': 's:matchtabs', 'tabe': 's:matchtabe' } if has_key(types, type) | let mfunc = types[type] | en en - let newitems = s:MatchIt(items, pat, limit, mfunc) + let newitems = s:MatchIt(a:items, a:pat, a:limit, mfunc, a:ipt) let s:matches = len(newitems) retu newitems endf @@ -358,31 +366,31 @@ fu! s:SplitPattern(str) "{{{1 retu escape(pat, '~') endf " * BuildPrompt() {{{1 -fu! s:Render(lines, pat) - let lines = a:lines +fu! s:Render(lines, pat, ipt) + let [&ma, lines, s:height] = [1, a:lines, min([len(a:lines), s:winh])] " Setup the match window - let s:height = min([len(lines), s:winh]) sil! exe '%d _ | res' s:height " Print the new items if empty(lines) - setl nocul + let s:matched = [] cal setline(1, ' == NO ENTRIES ==') + setl noma nocul cal s:unmarksigns() if s:dohighlight() | cal clearmatches() | en retu en - setl cul " Sort if not MRU if ( s:itemtype != 2 && !exists('g:ctrlp_nolimit') ) - \ || !empty(join(s:prompt, '')) + \ || s:prompt != ['', '', ''] let s:compat = a:pat cal sort(lines, 's:mixedsort') unl s:compat en if s:mwreverse | cal reverse(lines) | en let s:matched = copy(lines) - cal map(lines, '"> ".v:val') + cal map(lines, 's:formatline(v:val, a:ipt)') cal setline(1, lines) + setl noma cul exe 'keepj norm!' ( s:mwreverse ? 'G' : 'gg' ).'1|' cal s:unmarksigns() cal s:remarksigns() @@ -391,7 +399,7 @@ fu! s:Render(lines, pat) en " Highlighting if s:dohighlight() - cal s:highlight(a:pat, s:mathi[1] == '' ? 'Identifier' : s:mathi[1]) + cal s:highlight(a:pat, s:mathi[1], a:ipt) en endf @@ -401,13 +409,11 @@ fu! s:Update(str) " Get the new string sans tail let str = s:sanstail(a:str) " Stop if the string's unchanged - if str == oldstr && !empty(str) && !exists('s:force') - retu - en - let pat = s:SplitPattern(str) + if str == oldstr && !empty(str) && !exists('s:force') | retu | en + let [pat, ipt] = [s:SplitPattern(str), s:ispathitem()] let lines = exists('g:ctrlp_nolimit') && empty(str) ? copy(g:ctrlp_lines) - \ : s:MatchedItems(g:ctrlp_lines, pat, s:winh) - cal s:Render(lines, pat) + \ : s:MatchedItems(g:ctrlp_lines, pat, s:winh, ipt) + cal s:Render(lines, pat, ipt) endf fu! s:ForceUpdate() @@ -459,8 +465,7 @@ endf fu! s:PrtBS() unl! s:hstgot - let [prt, s:matches] = [s:prompt, 1] - let prt[0] = substitute(prt[0], '.$', '', '') + let [s:prompt[0], s:matches] = [substitute(s:prompt[0], '.$', '', ''), 1] cal s:BuildPrompt(1) endf @@ -485,7 +490,6 @@ endf fu! s:PrtInsert(type) unl! s:hstgot - " Insert current word, search register, last visual and clipboard let s:prompt[0] .= a:type == 'w' ? s:crword \ : a:type == 's' ? getreg('/') \ : a:type == 'v' ? s:crvisual @@ -507,20 +511,18 @@ fu! s:PrtExpandDir() endf " Movement {{{2 fu! s:PrtCurLeft() - if !empty(s:prompt[0]) - let prt = s:prompt - let prt[2] = prt[1] . prt[2] - let prt[1] = matchstr(prt[0], '.$') - let prt[0] = substitute(prt[0], '.$', '', '') + let prt = s:prompt + if !empty(prt[0]) + let s:prompt = [substitute(prt[0], '.$', '', ''), matchstr(prt[0], '.$'), + \ prt[1] . prt[2]] en cal s:BuildPrompt(0) endf fu! s:PrtCurRight() let prt = s:prompt - let prt[0] .= prt[1] - let prt[1] = matchstr(prt[2], '^.') - let prt[2] = substitute(prt[2], '^.', '', '') + let s:prompt = [prt[0] . prt[1], matchstr(prt[2], '^.'), + \ substitute(prt[2], '^.', '', '')] cal s:BuildPrompt(0) endf @@ -577,7 +579,7 @@ fu! s:PrtClearCache() if s:itemtype == 2 let g:ctrlp_lines = ctrlp#mrufiles#list(-1, 1) el - cal s:SetLines(s:itemtype) + cal ctrlp#setlines(s:itemtype) en let s:force = 1 cal s:BuildPrompt(1) @@ -585,12 +587,16 @@ fu! s:PrtClearCache() endf fu! s:PrtDeleteMRU() - if s:itemtype == 2 - let s:force = 1 - let g:ctrlp_lines = ctrlp#mrufiles#list(-1, 2) - cal s:BuildPrompt(1) - unl s:force + if s:itemtype != 2 | retu | en + let [s:force, ags] = [1, [-1, 2]] + if exists('s:marked') + let ags = [-1, 2, values(s:marked)] + cal s:unmarksigns() + unl s:marked en + let g:ctrlp_lines = call('ctrlp#mrufiles#list', ags) + cal s:BuildPrompt(1) + unl s:force endf fu! s:PrtExit() @@ -616,11 +622,18 @@ endf fu! s:MapKeys(...) " Normal keys let pfunc = a:0 && !a:1 ? 'PrtSelectJump' : 'PrtAdd' - let dojmp = s:byfname && pfunc == 'PrtSelectJump' ? ', 1' : '' + let dojmp = s:byfname && a:0 && !a:1 ? ', 1' : '' + let pcmd = "nn \ \ \ :\cal \%s(\"%s\"%s)\" + let cmd = substitute(pcmd, 'k%s', 'char-%d', '') for each in range(32, 126) - let cmd = "nn \ \ \ :\cal \%s(\"%s\"%s)\" exe printf(cmd, each, pfunc, escape(nr2char(each), '"|\'), dojmp) endfo + for each in range(0, 9) + exe printf(pcmd, each, pfunc, each, dojmp) + endfo + for [ke, va] in items(s:kprange) + exe printf(pcmd, ke, pfunc, va, dojmp) + endfo " Special keys if a:0 < 2 cal call('s:MapSpecs', a:0 && !a:1 ? [1] : []) @@ -675,9 +688,9 @@ fu! s:ToggleType(dir) if s:byfname && !s:ispathitem() | let s:byfname = 0 | en unl! g:ctrlp_nolimit if has('syntax') && exists('g:syntax_on') - cal s:syntax() + cal ctrlp#syntax() en - cal s:SetLines(s:itemtype) + cal ctrlp#setlines(s:itemtype) cal s:PrtSwitcher() endf @@ -687,7 +700,7 @@ fu! s:PrtSwitcher() unl s:force endf fu! s:SetWD(...) "{{{1 - let pathmode = s:pathmode + let [pathmode, s:crfilerel] = [s:wpmode, fnamemodify(s:crfile, ':.')] if a:0 && strlen(a:1) | if type(a:1) cal ctrlp#setdir(a:1) | retu el @@ -699,7 +712,7 @@ fu! s:SetWD(...) "{{{1 cal ctrlp#setdir(s:crfpath) en if pathmode == 1 | retu | en - let markers = ['root.dir','.git/','.hg/','_darcs/','.bzr/'] + let markers = ['root.dir', '.git/', '.hg/', '.svn/', '.bzr/', '_darcs/'] if type(s:rmarkers) == 3 && !empty(s:rmarkers) cal extend(markers, s:rmarkers, 0) en @@ -710,8 +723,8 @@ fu! s:SetWD(...) "{{{1 unl! s:foundroot endf " * AcceptSelection() {{{1 -fu! ctrlp#acceptfile(mode, matchstr, ...) - let [md, filpath] = [a:mode, fnamemodify(a:matchstr, ':p')] +fu! ctrlp#acceptfile(mode, line, ...) + let [md, filpath] = [a:mode, fnamemodify(a:line, ':p')] cal s:PrtExit() let [bufnr, tail] = [bufnr('^'.filpath.'$'), s:tail()] let j2l = a:0 ? a:1 : str2nr(matchstr(tail, '^ +\D*\zs\d\+\ze\D*')) @@ -752,12 +765,12 @@ fu! s:SpecInputs(str) let [str, type] = [a:str, s:type()] if str == '..' && type =~ '\v^(0|dir)$' cal s:parentdir(getcwd()) - cal s:SetLines(s:itemtype) + cal ctrlp#setlines(s:itemtype) cal s:PrtClear() retu 1 elsei str =~ '^[\/]$' && type =~ '\v^(0|dir)$' cal s:SetWD(2, 0) - cal s:SetLines(s:itemtype) + cal ctrlp#setlines(s:itemtype) cal s:PrtClear() retu 1 elsei str == '?' @@ -773,17 +786,16 @@ fu! s:AcceptSelection(mode) let str = join(s:prompt, '') if a:mode == 'e' | if s:SpecInputs(str) | retu | en | en " Get the selected line - let line = getline('.') - if a:mode != 'e' && s:itemtype < 3 && line == ' == NO ENTRIES ==' + let line = !empty(s:matched) ? s:matched[line('.') - 1] : '' + if a:mode != 'e' && s:itemtype < 3 && line == '' \ && str !~ '\v^(\.\.|/|\\|\?)$' cal s:CreateNewFile(a:mode) | retu en - let matchstr = matchstr(line, '^> \zs.\+\ze\t*$') - if empty(matchstr) | retu | en + if empty(line) | retu | en " Do something with it let actfunc = s:itemtype < 3 ? 'ctrlp#acceptfile' \ : g:ctrlp_ext_vars[s:itemtype - ( g:ctrlp_builtins + 1 )]['accept'] - cal call(actfunc, [a:mode, matchstr]) + cal call(actfunc, [a:mode, line]) endf fu! s:CreateNewFile(...) "{{{1 let [md, str] = ['', join(s:prompt, '')] @@ -807,7 +819,7 @@ fu! s:CreateNewFile(...) "{{{1 en if !exists('optyp') | retu | en let [filpath, tail] = [fnamemodify(optyp, ':p'), s:tail()] - cal s:insertcache(str) + if !stridx(filpath, getcwd()) | cal s:insertcache(str) | en cal s:PrtExit() let cmd = md == 'r' ? ctrlp#normcmd('e') : \ s:newfop =~ '1\|t' || ( a:0 && a:1 == 't' ) || md == 't' ? 'tabe' : @@ -822,9 +834,9 @@ fu! s:MarkToOpen() \ || ( s:itemtype > g:ctrlp_builtins && s:type() !~ 'rts' ) retu en - let matchstr = matchstr(getline('.'), '^> \zs.\+\ze\t*$') - if empty(matchstr) | retu | en - let filpath = fnamemodify(matchstr, ':p') + let line = !empty(s:matched) ? s:matched[line('.') - 1] : '' + if empty(line) | retu | en + let filpath = fnamemodify(line, ':p') if exists('s:marked') && s:dictindex(s:marked, filpath) > 0 " Unmark and remove the file from s:marked let key = s:dictindex(s:marked, filpath) @@ -861,8 +873,8 @@ fu! s:OpenMulti() cal s:sanstail(join(s:prompt, '')) cal s:PrtExit() " Move the cursor to a reusable window - let tail = s:tail() - let emptytail = empty(tail) + let [tail, fnesc] = [s:tail(), exists('*fnameescape') && v:version > 701] + let [emptytail, nwpt] = [empty(tail), exists('g:ctrlp_open_multiple_files')] let useb = bufnr('^'.mkd[0].'$') > 0 && emptytail let fst = call('ctrlp#normcmd', useb ? ['b', 'bo vert sb'] : ['e']) " Check if it's a replaceable buffer @@ -875,12 +887,19 @@ fu! s:OpenMulti() for va in mkd let bufnr = bufnr('^'.va.'$') let useb = bufnr > 0 && emptytail - let snd = md != '' && has_key(cmds, md) - \ ? ( useb ? cmds[md][0] : cmds[md][1] ) : ( useb ? 'vert sb' : 'vne' ) - let fid = useb ? bufnr : va - cal s:openfile(ic == 1 && ( ucr == 'r' || repabl ) ? fst : snd, fid, tail) - if ( nr != '' && nr > 1 && nr < ic ) || ( nr == '' && ic > 1 ) - sil! hid clo! | el | let ic += 1 + let snd = md != '' && has_key(cmds, md) ? + \ ( useb ? cmds[md][0] : cmds[md][1] ) : ( useb ? 'vert sb' : 'vne' ) + let cmd = ic == 1 && ( ucr == 'r' || repabl ) ? fst : snd + let conds = [( nr != '' && nr > 1 && nr < ic ) || ( nr == '' && ic > 1 ), + \ nr != '' && nr < ic] + if conds[nwpt] + if bufnr <= 0 | if fnesc + cal s:openfile('bad', fnamemodify(va, ':.'), '') + el + cal s:openfile(cmd, va, tail) | sil! hid clo! + en | en + el + cal s:openfile(cmd, useb ? bufnr : va, tail) | let ic += 1 en endfo let &swb = swb @@ -919,6 +938,13 @@ fu! s:comparent(s1, s2) retu 0 endf +fu! s:compfnlen(s1, s2) + " By filename length + let len1 = strlen(split(a:s1, s:lash)[-1]) + let len2 = strlen(split(a:s2, s:lash)[-1]) + retu len1 == len2 ? 0 : len1 > len2 ? 1 : -1 +endf + fu! s:matchlens(str, pat, ...) if empty(a:pat) || index(['^', '$'], a:pat) >= 0 | retu {} | en let st = a:0 ? a:1 : 0 @@ -940,11 +966,12 @@ endf fu! s:mixedsort(s1, s2) let [cml, cln] = [s:compmatlen(a:s1, a:s2), ctrlp#complen(a:s1, a:s2)] if s:itemtype < 3 && s:height < 51 - let par = s:comparent(a:s1, a:s2) + let [par, cfn] = [s:comparent(a:s1, a:s2), s:compfnlen(a:s1, a:s2)] if s:height < 21 - retu 6 * cml + 3 * par + 2 * s:comptime(a:s1, a:s2) + cln + let ctm = s:comptime(a:s1, a:s2) + retu 12 * cml + 6 * par + 3 * cfn + 2 * ctm + cln en - retu 3 * cml + 2 * par + cln + retu 6 * cml + 3 * par + 2 * cfn + cln en retu 2 * cml + cln endf @@ -973,7 +1000,7 @@ fu! ctrlp#statusline() let focus = s:Focus() ? 'prt' : 'win' let byfname = s:byfname ? 'file' : 'path' let marked = s:opmul != '0' ? - \ exists('s:marked') ? ' <'.s:dismrk().'>' : ' <+>' : '' + \ exists('s:marked') ? ' <'.s:dismrk().'>' : ' <->' : '' if has_key(s:status, 'main') let args = [focus, byfname, s:regexp, prv, item, nxt, marked] let &l:stl = call(s:status['main'], args) @@ -989,7 +1016,7 @@ fu! ctrlp#statusline() endf fu! s:dismrk() - retu has('signs') ? '+'.len(s:marked) : + retu has('signs') ? len(s:marked) : \ '%<'.join(values(map(copy(s:marked), 'split(v:val, "[\\/]")[-1]')), ', ') endf @@ -997,9 +1024,14 @@ fu! ctrlp#progress(enum) if has('macunix') || has('mac') | sl 1m | en let &l:stl = has_key(s:status, 'prog') ? call(s:status['prog'], [a:enum]) \ : '%#CtrlPStats# '.a:enum.' %* %=%<%#CtrlPMode2# '.getcwd().' %*' - redr + redraws endf " Paths {{{2 +fu! s:formatline(str, ipt) + let cond = a:ipt && ( s:winw - 4 ) < s:strwidth(a:str) + retu '> '.( cond ? pathshorten(a:str) : a:str ) +endf + fu! s:dircompl(be, sd) if a:sd == '' | retu [] | en let [be, sd] = a:be == '' ? [getcwd(), a:sd] : [a:be, a:be.s:lash(a:be).a:sd] @@ -1124,9 +1156,16 @@ endf fu! ctrlp#setdir(path, ...) let cmd = a:0 ? a:1 : 'lc!' sil! exe cmd ctrlp#fnesc(a:path) + let s:crfilerel = fnamemodify(s:crfile, ':.') +endf + +fu! ctrlp#setlcdir() + if exists('*haslocaldir') + cal ctrlp#setdir(getcwd(), haslocaldir() ? 'lc!' : 'cd!') + en endf " Highlighting {{{2 -fu! s:syntax() +fu! ctrlp#syntax() for [ke, va] in items(s:hlgrps) | if !hlexists('CtrlP'.ke) exe 'hi link CtrlP'.ke va en | endfo @@ -1140,9 +1179,9 @@ fu! s:syntax() en endf -fu! s:highlight(pat, grp) +fu! s:highlight(pat, grp, ipt) cal clearmatches() - if !empty(a:pat) && s:ispathitem() + if !empty(a:pat) && a:ipt let pat = s:regexp ? substitute(a:pat, '\\\@ \\zs', 'g') : a:pat if s:byfname " Match only filename @@ -1157,7 +1196,7 @@ fu! s:highlight(pat, grp) endf fu! s:dohighlight() - retu len(s:mathi) > 1 && s:mathi[0] && exists('*clearmatches') + retu s:mathi[0] && exists('*clearmatches') endf " Prompt history {{{2 fu! s:gethistloc() @@ -1218,37 +1257,21 @@ fu! s:buftab(bufnr, md) let buflist = tabpagebuflist(tabnr) if index(buflist, a:bufnr) >= 0 for winnr in range(1, tabpagewinnr(tabnr, '$')) - if buflist[winnr - 1] == a:bufnr - retu [tabnr, winnr] - en + if buflist[winnr - 1] == a:bufnr | retu [tabnr, winnr] | en endfo en endfo retu [0, 0] endf -fu! s:normbuf() - let winnrs = [] - for each in range(1, winnr('$')) - let bufnr = winbufnr(each) - if getbufvar(bufnr, '&bl') && empty(getbufvar(bufnr, '&bt')) - \ && getbufvar(bufnr, '&ma') - cal add(winnrs, each) - en - endfo - retu winnrs -endf - fu! ctrlp#normcmd(cmd, ...) - if s:nosplit() - retu a:cmd - en - let norwins = s:normbuf() + if s:nosplit() | retu a:cmd | en + let norwins = filter(range(1, winnr('$')), + \ 'empty(getbufvar(winbufnr(v:val), "&bt"))') for each in norwins let bufnr = winbufnr(each) if empty(bufname(bufnr)) && empty(getbufvar(bufnr, '&ft')) - let fstemp = each - brea + let fstemp = each | brea en endfo let norwin = empty(norwins) ? 0 : norwins[0] @@ -1262,7 +1285,7 @@ fu! ctrlp#normcmd(cmd, ...) endf fu! s:nosplit() - retu !empty(s:nosplit) && match([bufname('%'), &l:ft], s:nosplit) >= 0 + retu !empty(s:nosplit) && match([bufname('%'), &l:ft, &l:bt], s:nosplit) >= 0 endf fu! s:setupblank() @@ -1274,8 +1297,7 @@ fu! s:setupblank() endf fu! s:leavepre() - if s:clrex && ( !has('clientserver') || - \ ( has('clientserver') && len(split(serverlist(), "\n")) == 1 ) ) + if s:clrex && !( has('clientserver') && len(split(serverlist(), "\n")) > 1 ) cal ctrlp#clra() en endf @@ -1320,18 +1342,37 @@ fu! s:argmaps(md, ...) retu a:md endf " Misc {{{2 +fu! s:log(m) + if exists('g:ctrlp_log') && g:ctrlp_log | if a:m + let cadir = ctrlp#utils#cachedir() + sil! exe 'redi! >' cadir.s:lash(cadir).'ctrlp.log' + el + sil! redi END + en | en +endf + +fu! s:strwidth(str) + retu exists('*strdisplaywidth') ? strdisplaywidth(a:str) : strlen(a:str) +endf + fu! s:getenv() - let s:winh = min([s:mxheight, &lines]) let [s:cwd, s:winres] = [getcwd(), [winrestcmd(), &lines, winnr('$')]] let [s:crfile, s:crfpath] = [expand('%:p', 1), expand('%:p:h', 1)] let [s:crword, s:crline] = [expand(''), getline('.')] - let [s:tagfiles, s:crcursor] = [s:tagfiles(), getpos('.')] + let [s:winh, s:crcursor] = [min([s:mxheight, &lines]), getpos('.')] let [s:crbufnr, s:crvisual] = [bufnr('%'), s:lastvisual()] - if exists('g:ctrlp_extensions') && index(g:ctrlp_extensions, 'undo') >= 0 - \ && v:version > 702 && has('patch005') && exists('*undotree') - let s:undotree = undotree() - en let s:currwin = s:mwbottom ? winnr() : winnr() + has('autocmd') + let s:wpmode = exists('b:ctrlp_working_path_mode') + \ ? b:ctrlp_working_path_mode : s:pathmode + if exists('g:ctrlp_extensions') + if index(g:ctrlp_extensions, 'undo') >= 0 && exists('*undotree') + \ && ( v:version > 703 || ( v:version == 703 && has('patch005') ) ) + let s:undotree = undotree() + en + if index(g:ctrlp_extensions, 'tag') >= 0 + let s:tagfiles = s:tagfiles() + en + en endf fu! s:lastvisual() @@ -1373,8 +1414,8 @@ fu! s:openfile(cmd, fid, tail, ...) if !empty(a:tail) || j2l sil! norm! zvzz en - if exists('*haslocaldir') - cal ctrlp#setdir(getcwd(), haslocaldir() ? 'lc!' : 'cd!') + if cmd != 'bad' + cal ctrlp#setlcdir() en endf @@ -1452,20 +1493,6 @@ fu! s:onexit() en endf -fu! ctrlp#allbufs() - let bufs = [] - for each in range(1, bufnr('$')) - if getbufvar(each, '&bl') - let bufname = bufname(each) - if strlen(bufname) && bufname != 'ControlP' - cal add(bufs, fnamemodify(bufname, ':p')) - en - en - endfo - cal filter(bufs, 'filereadable(v:val)') - retu bufs -endf - fu! ctrlp#exit() cal s:PrtExit() endf @@ -1473,17 +1500,13 @@ endf fu! ctrlp#prtclear() cal s:PrtClear() endf - -fu! ctrlp#setlines(type) - cal s:SetLines(a:type) -endf "}}}1 " * Initialization {{{1 -fu! s:SetLines(type) +fu! ctrlp#setlines(type) let s:itemtype = a:type let types = [ - \ 's:Files()', - \ 's:Buffers()', + \ 'ctrlp#files()', + \ 'ctrlp#buffers()', \ 'ctrlp#mrufiles#list(-1)', \ ] if exists('g:ctrlp_ext_vars') @@ -1499,9 +1522,9 @@ fu! ctrlp#init(type, ...) cal s:SetWD(a:0 ? a:1 : '') cal s:MapKeys() if has('syntax') && exists('g:syntax_on') - cal s:syntax() + cal ctrlp#syntax() en - cal s:SetLines(a:type) + cal ctrlp#setlines(a:type) cal s:BuildPrompt(1) endf if has('autocmd') "{{{1 diff --git a/bundle/git_ctrlp/autoload/ctrlp/buffertag.vim b/bundle/git_ctrlp/autoload/ctrlp/buffertag.vim index a45d507..345f876 100644 --- a/bundle/git_ctrlp/autoload/ctrlp/buffertag.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/buffertag.vim @@ -198,17 +198,20 @@ fu! s:parseline(line) endf " Public {{{1 fu! ctrlp#buffertag#init(fname) - let fname = exists('s:bufname') ? s:bufname : a:fname - let bufs = exists('s:btmode') && s:btmode ? ctrlp#allbufs() : [fname] + let bufs = exists('s:btmode') && s:btmode + \ ? filter(ctrlp#buffers(), 'filereadable(v:val)') + \ : [exists('s:bufname') ? s:bufname : a:fname] let lines = [] for each in bufs let tftype = get(split(getbufvar(each, '&ft'), '\.'), 0, '') cal extend(lines, s:process(each, tftype)) endfo - if !hlexists('CtrlPTabExtra') - hi link CtrlPTabExtra Comment + if has('syntax') && exists('g:syntax_on') + if !hlexists('CtrlPTabExtra') + hi link CtrlPTabExtra Comment + en + sy match CtrlPTabExtra '\zs\t.*\ze$' en - sy match CtrlPTabExtra '\zs\t.*\ze$' retu lines endf diff --git a/bundle/git_ctrlp/autoload/ctrlp/changes.vim b/bundle/git_ctrlp/autoload/ctrlp/changes.vim new file mode 100644 index 0000000..4fe5f68 --- /dev/null +++ b/bundle/git_ctrlp/autoload/ctrlp/changes.vim @@ -0,0 +1,106 @@ +" ============================================================================= +" File: autoload/ctrlp/changes.vim +" Description: Change list extension - Jump to a recent change in any buffer +" Author: Kien Nguyen +" ============================================================================= + +" User Configuration {{{1 +" Enable: +" let g:ctrlp_extensions += ['changes'] +" Create Some Commands: +" " Single buffer +" com! -n=? -com=buffer CtrlPChange +" \ cal ctrlp#init(ctrlp#changes#cmd(0, )) +" " All listed buffers +" com! CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1)) +"}}} + +" Init {{{1 +if exists('g:loaded_ctrlp_changes') && g:loaded_ctrlp_changes + fini +en +let g:loaded_ctrlp_changes = 1 + +let s:changes_var = { + \ 'init': 'ctrlp#changes#init(s:bufnr, s:crfile)', + \ 'accept': 'ctrlp#changes#accept', + \ 'lname': 'changes', + \ 'sname': 'chs', + \ 'exit': 'ctrlp#changes#exit()', + \ 'type': 'tabe', + \ } + +let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars) + \ ? add(g:ctrlp_ext_vars, s:changes_var) : [s:changes_var] + +let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) +" Utilities {{{1 +fu! s:changelist(bufnr) + sil! exe 'noa hid b' a:bufnr + redi => result + sil! changes + redi END + retu map(split(result, "\n")[1:], 'tr(v:val, " ", " ")') +endf + +fu! s:process(clines, ...) + let [clines, evas] = [[], []] + for each in a:clines + let parts = matchlist(each, '\v^.\s*\d+\s+(\d+)\s+(\d+)\s(.*)$') + if !empty(parts) + if parts[3] == '' | let parts[3] = ' ' | en + cal add(clines, parts[3].' |'.a:1.':'.a:2.'|'.parts[1].':'.parts[2].'|') + en + endfo + retu reverse(filter(clines, 'count(clines, v:val) == 1')) +endf +" Public {{{1 +fu! ctrlp#changes#init(original_bufnr, fname) + let fname = exists('s:bufname') ? s:bufname : a:fname + let bufs = exists('s:clmode') && s:clmode + \ ? filter(ctrlp#buffers(), 'filereadable(v:val)') : [fname] + let [swb, &swb] = [&swb, ''] + let lines = [] + for each in bufs + let [bufnr, fnamet] = [bufnr('^'.each.'$'), fnamemodify(each, ':t')] + if bufnr > 0 + cal extend(lines, s:process(s:changelist(bufnr), bufnr, fnamet)) + en + endfo + sil! exe 'noa hid b' a:original_bufnr + let &swb = swb + let g:ctrlp_nolimit = 1 + if has('syntax') && exists('g:syntax_on') + cal ctrlp#syntax() + if !hlexists('CtrlPTabExtra') + hi link CtrlPTabExtra Comment + en + sy match CtrlPTabExtra '\zs\t.*\ze$' + en + retu lines +endf + +fu! ctrlp#changes#accept(mode, str) + let info = matchlist(a:str, '\t|\(\d\+\):[^|]\+|\(\d\+\):\(\d\+\)|$') + let bufnr = str2nr(get(info, 1)) + if bufnr + cal ctrlp#acceptfile(a:mode, fnamemodify(bufname(bufnr), ':p')) + cal cursor(get(info, 2), get(info, 3)) + sil! norm! zvzz + en +endf + +fu! ctrlp#changes#cmd(mode, ...) + let s:clmode = a:mode + if a:0 && !empty(a:1) + let s:bufname = fnamemodify(a:1, ':p') + en + retu s:id +endf + +fu! ctrlp#changes#exit() + unl! s:clmode s:bufname +endf +"}}} + +" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2 diff --git a/bundle/git_ctrlp/autoload/ctrlp/line.vim b/bundle/git_ctrlp/autoload/ctrlp/line.vim index 903bbf9..961ede4 100644 --- a/bundle/git_ctrlp/autoload/ctrlp/line.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/line.vim @@ -31,30 +31,31 @@ let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars) let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) " Public {{{1 fu! ctrlp#line#init() - let [bufs, lines] = [ctrlp#allbufs(), []] + let [bufs, lines] = [filter(ctrlp#buffers(), 'filereadable(v:val)'), []] for each in bufs - let from_file = readfile(each) + let [fnamet, from_file] = [fnamemodify(each, ':t'), readfile(each)] cal map(from_file, 'tr(v:val, '' '', '' '')') let [id, len_ff, bufnr] = [1, len(from_file), bufnr('^'.each.'$')] wh id <= len_ff - let from_file[id-1] .= ' #:'.bufnr.':'.id + let from_file[id-1] .= ' |'.fnamet.'|'.bufnr.':'.id.'|' let id += 1 endw - cal filter(from_file, 'v:val !~ ''^\s*\t#:\d\+:\d\+$''') + cal filter(from_file, 'v:val !~ ''^\s*\t|[^|]\+|\d\+:\d\+|$''') cal extend(lines, from_file) endfo - if !hlexists('CtrlPTabExtra') - hi link CtrlPTabExtra Comment + if has('syntax') && exists('g:syntax_on') + if !hlexists('CtrlPTabExtra') + hi link CtrlPTabExtra Comment + en + sy match CtrlPTabExtra '\zs\t.*\ze$' en - sy match CtrlPTabExtra '\zs\t.*\ze$' retu lines endf fu! ctrlp#line#accept(mode, str) - let info = get(split(a:str, '\t#:\ze\d\+:\d\+$'), 1, 0) - let bufnr = str2nr(get(split(info, ':'), 0, 0)) - let linenr = get(split(info, ':'), 1, 0) - if bufnr + let info = matchlist(a:str, '\t|[^|]\+|\(\d\+\):\(\d\+\)|$') + let [bufnr, linenr] = [str2nr(get(info, 1)), get(info, 2)] + if bufnr > 0 cal ctrlp#acceptfile(a:mode, fnamemodify(bufname(bufnr), ':p'), linenr) en endf diff --git a/bundle/git_ctrlp/autoload/ctrlp/mrufiles.vim b/bundle/git_ctrlp/autoload/ctrlp/mrufiles.vim index 12b4a17..ff485e7 100644 --- a/bundle/git_ctrlp/autoload/ctrlp/mrufiles.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/mrufiles.vim @@ -36,8 +36,13 @@ fu! ctrlp#mrufiles#list(bufnr, ...) "{{{1 let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt' en if a:0 && a:1 == 2 - cal ctrlp#utils#writecache([], s:cadir, s:cafile) - retu [] + let mrufs = [] + if a:0 == 2 + let mrufs = ctrlp#utils#readfile(s:cafile) + cal filter(mrufs, 'index(a:2, v:val) < 0') + en + cal ctrlp#utils#writecache(mrufs, s:cadir, s:cafile) + retu map(mrufs, 'fnamemodify(v:val, '':.'')') en " Get the list let mrufs = ctrlp#utils#readfile(s:cafile) @@ -52,15 +57,11 @@ fu! ctrlp#mrufiles#list(bufnr, ...) "{{{1 en " Return the list with the active buffer removed if bufnr == -1 - let crf = fnamemodify(bufname(winbufnr(winnr('#'))), ':p') - let crf = exists('+ssl') ? tr(crf, '/', '\') : crf - let mrufs = empty(crf) ? mrufs : filter(mrufs, 'v:val !='.s:csen.' crf') if s:re let cwd = exists('+ssl') ? tr(getcwd(), '/', '\') : getcwd() cal filter(mrufs, '!stridx(v:val, cwd)') en - cal map(mrufs, 'fnamemodify(v:val, '':.'')') - retu mrufs + retu map(mrufs, 'fnamemodify(v:val, '':.'')') en " Remove old entry cal filter(mrufs, 'v:val !='.s:csen.' fn') diff --git a/bundle/git_ctrlp/autoload/ctrlp/quickfix.vim b/bundle/git_ctrlp/autoload/ctrlp/quickfix.vim index 3238762..cb1d6a5 100644 --- a/bundle/git_ctrlp/autoload/ctrlp/quickfix.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/quickfix.vim @@ -30,10 +30,12 @@ endf " Public {{{1 fu! ctrlp#quickfix#init() let g:ctrlp_nolimit = 1 - if !hlexists('CtrlPqfLineCol') - hi link CtrlPqfLineCol Search + if has('syntax') && exists('g:syntax_on') + if !hlexists('CtrlPqfLineCol') + hi link CtrlPqfLineCol Search + en + sy match CtrlPqfLineCol '|\zs\d\+:\d\+\ze|' en - sy match CtrlPqfLineCol '|\zs\d\+:\d\+\ze|' retu map(getqflist(), 's:lineout(v:val)') endf @@ -48,6 +50,7 @@ fu! ctrlp#quickfix#accept(mode, str) exe cmd ctrlp#fnesc(filpath) cal cursor(items[2], items[3]) sil! norm! zvzz + cal ctrlp#setlcdir() endf fu! ctrlp#quickfix#id() diff --git a/bundle/git_ctrlp/autoload/ctrlp/tag.vim b/bundle/git_ctrlp/autoload/ctrlp/tag.vim index b43e4cd..2b9a86c 100644 --- a/bundle/git_ctrlp/autoload/ctrlp/tag.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/tag.vim @@ -23,14 +23,6 @@ let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars) let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) " Utilities {{{1 -fu! s:nodup(items) - let dict = {} - for each in a:items - cal extend(dict, { each : 0 }) - endfo - retu keys(dict) -endf - fu! s:findcount(str) let [tg, fname] = split(a:str, '\t\+\ze[^\t]\+$') let [fname, tgs] = [expand(fname, 1), taglist('^'.tg.'$')] @@ -67,30 +59,32 @@ endf " Public {{{1 fu! ctrlp#tag#init(tagfiles) if empty(a:tagfiles) | retu [] | en - let [tagfiles, g:ctrlp_alltags] = [sort(s:nodup(a:tagfiles)), []] + let g:ctrlp_alltags = [] + let tagfiles = sort(filter(a:tagfiles, 'count(a:tagfiles, v:val) == 1')) for each in tagfiles let alltags = s:filter(ctrlp#utils#readfile(each)) cal extend(g:ctrlp_alltags, alltags) endfo - if !hlexists('CtrlPTabExtra') - hi link CtrlPTabExtra Comment + if has('syntax') && exists('g:syntax_on') + if !hlexists('CtrlPTabExtra') + hi link CtrlPTabExtra Comment + en + sy match CtrlPTabExtra '\zs\t.*\ze$' en - sy match CtrlPTabExtra '\zs\t.*\ze$' retu g:ctrlp_alltags endf fu! ctrlp#tag#accept(mode, str) cal ctrlp#exit() let str = matchstr(a:str, '^[^\t]\+\t\+[^\t]\+\ze\t') - let [md, tg] = [a:mode, split(str, '^[^\t]\+\zs\t')[0]] - let fnd = s:findcount(str) + let [tg, fnd] = [split(str, '^[^\t]\+\zs\t')[0], s:findcount(str)] let cmds = { \ 't': ['tab sp', 'tab stj'], \ 'h': ['sp', 'stj'], \ 'v': ['vs', 'vert stj'], \ 'e': ['', 'tj'], \ } - let cmd = fnd[0] == 1 ? cmds[md][0] : cmds[md][1] + let cmd = fnd[0] == 1 ? cmds[a:mode][0] : cmds[a:mode][1] let cmd = cmd == 'tj' && &modified ? 'hid '.cmd : cmd let cmd = cmd =~ '^tab' ? tabpagenr('$').cmd : cmd if fnd[0] == 1 @@ -101,6 +95,7 @@ fu! ctrlp#tag#accept(mode, str) el exe cmd tg en + cal ctrlp#setlcdir() endf fu! ctrlp#tag#id() diff --git a/bundle/git_ctrlp/autoload/ctrlp/undo.vim b/bundle/git_ctrlp/autoload/ctrlp/undo.vim index f4d4625..9b371d8 100644 --- a/bundle/git_ctrlp/autoload/ctrlp/undo.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/undo.vim @@ -13,7 +13,7 @@ " Init {{{1 if ( exists('g:loaded_ctrlp_undo') && g:loaded_ctrlp_undo ) - \ || !( v:version > 702 && has('patch005') ) + \ || !( v:version > 703 || ( v:version == 703 && has('patch005') ) ) fini en let g:loaded_ctrlp_undo = 1 @@ -102,7 +102,9 @@ endf fu! ctrlp#undo#init(undo) let entries = a:undo['entries'] if empty(entries) | retu [] | en - cal s:syntax() + if has('syntax') && exists('g:syntax_on') + cal s:syntax() + en let g:ctrlp_nolimit = 1 let entries = sort(s:dict2list(s:flatten(entries)), 's:compval') retu map(entries, 'v:val[1]." [".v:val[0]."]"') diff --git a/bundle/git_ctrlp/doc/ctrlp.txt b/bundle/git_ctrlp/doc/ctrlp.txt index 0a202cc..a63f461 100644 --- a/bundle/git_ctrlp/doc/ctrlp.txt +++ b/bundle/git_ctrlp/doc/ctrlp.txt @@ -1,4 +1,4 @@ -*ctrlp.txt* Fuzzy file, buffer, mru and tag finder. v1.7.1 +*ctrlp.txt* Fuzzy file, buffer, mru and tag finder. v1.7.2 *CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'* =============================================================================== # # @@ -21,7 +21,7 @@ CONTENTS *ctrlp-contents* 6. Extensions...................................|ctrlp-extensions| =============================================================================== -1. Intro *ctrlp-intro* +INTRO *ctrlp-intro* Full path fuzzy file, buffer, mru and tag finder with an intuitive interface. Written in pure Vimscript for MacVim and Vim version 7.0+. Has full support for @@ -31,7 +31,7 @@ finder, and more. To enable optional extensions (tag, dir, rtscript...), see |ctrlp-extensions|. =============================================================================== -2. Options *ctrlp-options* +OPTIONS *ctrlp-options* Below are the available options and their default values:~ @@ -51,14 +51,16 @@ Use this to disable the plugin completely: > < *'g:ctrlp_by_filename'* -Set this to 1 to set search by filename (not full path) as the default: > +Set this to 1 to set searching by filename (not full path) as the default: > let g:ctrlp_by_filename = 0 < +Can be toggled on/off by pressing inside the prompt. - *'g:ctrlp_regexp_search'* + *'g:ctrlp_regexp'* Set this to 1 to set |regexp| search as the default: > - let g:ctrlp_regexp_search = 0 + let g:ctrlp_regexp = 0 < +Can be toggled on/off by pressing inside the prompt. *'g:ctrlp_match_window_bottom'* Set this to 0 to show the match window at the top of the screen: > @@ -66,8 +68,8 @@ Set this to 0 to show the match window at the top of the screen: > < *'g:ctrlp_match_window_reversed'* -Change the listing order of the matched files in the match window. The default -setting (1) is from bottom to top: > +Change the listing order of the files in the match window. The default setting +(1) is from bottom to top: > let g:ctrlp_match_window_reversed = 1 < @@ -76,28 +78,37 @@ Set the maximum height of the match window: > let g:ctrlp_max_height = 10 < - *'g:ctrlp_jump_to_buffer'* -When opening a file with or , if the file's already opened somewhere + *'g:ctrlp_switch_buffer'* +When opening a file with or , if the file’s already opened somewhere |CtrlP| will try to jump to it instead of opening a new instance: > - let g:ctrlp_jump_to_buffer = 2 + let g:ctrlp_switch_buffer = 2 < 1 - only jump to the buffer if it’s opened in the current tab. - 2 - jump tab as well if the buffer's opened in another tab. + 2 - jump tab as well if the buffer’s opened in another tab. 0 - disable this feature. + *'g:ctrlp_reuse_window'* +When opening a file with , |CtrlP| avoids opening it in windows created by +plugins, help and quickfix. Use this to setup some exceptions: > + let g:ctrlp_reuse_window = 'netrw' +< +Acceptable values are partial name, filetype or buftype of the special buffers. +Use |regexp| to specify the pattern. +Example: > + let g:ctrlp_reuse_window = 'netrw\|help\|quickfix' +< + *'g:ctrlp_working_path_mode'* When starting up, |CtrlP| sets its local working directory according to this variable: > let g:ctrlp_working_path_mode = 2 < 1 - the parent directory of the current file. - 2 - the nearest ancestor that contains one of these directories/files: - .git/ - .hg/ - .bzr/ - _darcs/ - root.dir + 2 - the nearest ancestor that contains one of these directories or files: + .git/ .hg/ .svn/ .bzr/ _darcs/ 0 - don’t manage working directory. +Note: you can use b:ctrlp_working_path_mode (a |b:var|) to set this option on a +per buffer basis. *'g:ctrlp_root_markers'* Use this to set your own root markers in addition to the default ones. Your @@ -105,7 +116,7 @@ markers will take precedence: > let g:ctrlp_root_markers = [''] < These markers (builtins and yours) will serve as identifiers for the '/' and -'\' special inputs (section 5.e). +'\' special inputs (|ctrlp-input-formats| (e)). *'g:ctrlp_use_caching'* Set this to 0 to disable per-session caching. When disabled, caching will still @@ -165,11 +176,10 @@ only need to keep the lines that you’ve changed the values (inside []): > < Note: In some terminals, it’s not possible to remap without also changing (|key-codes|). So if pressing moves the cursor to the left instead of -deleting a char for you, add this to your |vimrc| to change the default +deleting a char for you, add this to your |vimrc| to disable the default mapping: > let g:ctrlp_prompt_mappings = { - \ 'PrtBS()': ['', '', ''], - \ 'PrtCurLeft()': ['', ''], + \ 'PrtCurLeft()': ['', ''] \ } < @@ -213,7 +223,7 @@ Set to 1 to sort the MRU file list to most-recently-entered-buffer order: > < *'g:ctrlp_dotfiles'* -Set this to 0 if you don’t want |CtrlP| to search for dotfiles and dotdirs: > +Set this to 0 if you don’t want |CtrlP| to scan for dotfiles and dotdirs: > let g:ctrlp_dotfiles = 1 < You can use |'wildignore'| to exclude anything from the search. @@ -225,9 +235,9 @@ Examples: > Note #1: the `*/` in front of each directory glob is required. Note #2: |wildignore| influences the result of |expand()|, |globpath()| and -|glob()| which many plugins use to find stuff on the system (e.g. fugitive.vim -looks for .git/, some other plugins look for external .exe tools on Windows). -So be a little mindful of what you put in your |wildignore|. +|glob()| which many plugins use to find stuff on the system (e.g. VCS related +plugins look for .git/, .hg/,... some other plugins look for external *.exe +tools on Windows). So be a little mindful of what you put in your |wildignore|. *'g:ctrlp_custom_ignore'* In addition to |'wildignore'|, use this for files and directories you want only @@ -243,12 +253,6 @@ Examples: > \ } < - *'g:ctrlp_highlight_match'* -Use this to enable/disable highlighting of the matched patterns and to specify -the highlight group that’ll be used: > - let g:ctrlp_highlight_match = [1, 'Identifier'] -< - *'g:ctrlp_max_files'* The maximum number of files to scan, set to 0 for no limit: > let g:ctrlp_max_files = 10000 @@ -317,20 +321,21 @@ pressing : let g:ctrlp_open_new_file = 'v' < - *'g:ctrlp_open_multi'* + *'g:ctrlp_open_multiple_files'* If non-zero, this will enable opening multiple files with and : > - let g:ctrlp_open_multi = '1v' + let g:ctrlp_open_multiple_files = 'v' +< +Example: > + let g:ctrlp_open_multiple_files = '2vr' < For the number: - - If bigger than 1, it’ll be used as the maximum number of windows or tabs to - create when opening the files (the rest will be hidden buffers). - - If is 1, will open all files, each in a new window or new tab. - - If no number is given, only the first file will be opened in a window, - either new window or reused, and the rest will be hidden buffers. + - If given, it’ll be used as the maximum number of windows or tabs to create + when opening the files (the rest will be opened as hidden buffers). + - If not given, will open all files, each in a new window or new tab. For the letters: - t - each in a new tab - h - each in a new horizontal split - v - each in a new vertical split + t - each file in a new tab. + h - each file in a new horizontal split. + v - each file in a new vertical split. Reuse the current window: tr, hr, @@ -349,17 +354,7 @@ Pressing or will then prompt for a keypress. The key can be: r - open in current window (for only) , - cancel and go back to the prompt. Any other key - use the behavior specified with |g:ctrlp_open_new_file| and - |g:ctrlp_open_multi|. - - *'g:ctrlp_dont_split'* -When opening a file with , |CtrlP| avoids opening it in windows created by -plugins, help and quickfix. Use this to setup some exceptions: > - let g:ctrlp_dont_split = 'netrw' -< -Acceptable values are partial names or filetypes of the special buffers. Use -|regexp| to specify the pattern. Example: > - let g:ctrlp_dont_split = 'netrw\|help\|quickfix' -< + |g:ctrlp_open_multiple_files|. *'g:ctrlp_follow_symlinks'* Set this to 1 to follow symbolic links when listing files: > @@ -394,7 +389,7 @@ Example: > See https://gist.github.com/1610859 for a working example. =============================================================================== -3. Commands *ctrlp-commands* +COMMANDS *ctrlp-commands* *:CtrlP* :CtrlP [starting-directory] @@ -412,19 +407,19 @@ See https://gist.github.com/1610859 for a working example. :CtrlPMRU Open |CtrlP| in find Most-Recently-Used file mode. - *:ClearCtrlPCache* -:ClearCtrlPCache + *:CtrlPClearCache* +:CtrlPClearCache Flush the cache for the current working directory. The same as pressing inside |CtrlP|. You can also enable/disable caching with the option |g:ctrlp_use_caching|. - *:ClearAllCtrlPCaches* -:ClearAllCtrlPCaches + *:CtrlPClearAllCaches* +:CtrlPClearAllCaches Delete all the cache files saved in |g:ctrlp_cache_dir|. - *:ResetCtrlP* -:ResetCtrlP - Reset all options and take in new values of the option variables. + *:CtrlPReload* +:CtrlPReload + Load new values for the option variables. ------------------------------------------------------------------------------- The following commands ignore the current value of |g:ctrlp_working_path_mode|: @@ -439,7 +434,7 @@ The following commands ignore the current value of |g:ctrlp_working_path_mode|: This acts like |:CtrlP| with |path_mode| = 2 =============================================================================== -4. Mappings *ctrlp-mappings* +MAPPINGS *ctrlp-mappings* *'ctrlp-'* @@ -448,14 +443,14 @@ The following commands ignore the current value of |g:ctrlp_working_path_mode|: Once inside the prompt:~ *'ctrlp-fullregexp'* - Toggle between the string mode (section 5.a & b) and full |regexp| mode. - (note: in full |regexp| mode, the prompt’s base is 'r>>' instead of '>>>') + Toggle between the string mode and full |regexp| mode. + Note: in full |regexp| mode, the prompt’s base is 'r>>' instead of '>>>' See also |input-formats| (guide) and |g:ctrlp_regexp_search| (option). Toggle between full-path search and filename only search. - (note: in filename mode, the prompt’s base is '>d>' instead of '>>>') + Note: in filename mode, the prompt’s base is '>d>' instead of '>>>' , 'forward' @@ -543,7 +538,8 @@ Once inside the prompt:~ - Remove deleted files from MRU list. - Clear MRU list. + - Wipe MRU list. + - Delete MRU entries marked by . Insert the word under the cursor (in the active buffer) into the prompt. @@ -552,7 +548,7 @@ Once inside the prompt:~ , Exit |CtrlP|. - can also be used to stop the scan if it’s taking too long. + Note: can also be used to stop the scan if it’s taking too long. Choose your own mappings with |g:ctrlp_prompt_mappings|. @@ -565,7 +561,7 @@ When inside the match window (press to switch):~ matches that key. =============================================================================== -5. Input Formats *ctrlp-input-formats* +INPUT FORMATS *ctrlp-input-formats* Formats for inputting in the prompt:~ @@ -613,7 +609,7 @@ f) Type the name of a non-existent file and press to create it. Mark a g) Submit ? to open this help file. =============================================================================== -6. Extensions *g:ctrlp-extensions* +EXTENSIONS *g:ctrlp-extensions* Extensions are optional. To enable an extension, add its name to the variable g:ctrlp_extensions: > @@ -720,6 +716,48 @@ Statuslines:~ For rebuilding the statuslines, see |g:ctrlp_status_func|. +=============================================================================== +MISCELLANEOUS CONFIGS *ctrlp-miscellaneous-configs* + +* Use |wildignore| for |g:ctrlp_user_command|: +> + function! s:wig2cmd() + " Change wildignore into space or | separated groups + " e.g. .aux .out .toc .jpg .bmp .gif + " or .aux$\|.out$\|.toc$\|.jpg$\|.bmp$\|.gif$ + let pats = ['[*\/]*\([?_.0-9A-Za-z]\+\)\([*\/]*\)\(\\\@) + +* A standalone function to set the working directory to the project’s root, or + to the parent directory of the current file if a root can’t be found: +> + function! s:setcwd() + let cph = expand('%:p:h', 1) + if match(cph, '\v^<.+>://') >= 0 | retu | en + for mkr in ['.git/', '.hg/', '.svn/', '.bzr/', '_darcs/', '.vimprojects'] + let wd = call('find'.(mkr =~ '/$' ? 'dir' : 'file'), [mkr, cph.';']) + if wd != '' | let &acd = 0 | brea | en + endfo + exe 'lc!' fnameescape(wd == '' ? cph : substitute(wd, mkr.'$', '.', '')) + endfunction + + autocmd BufEnter * call s:setcwd() +< +(requires Vim 7.1.299+) + =============================================================================== CREDITS *ctrlp-credits* @@ -736,32 +774,37 @@ gibhub, bitbucket, and through email. Special thanks:~ * Woojong Koh - Forked and suggested the support for VCS listing commands. - - * Yasuhiro Matsumoto - Added option to use Migemo for Japanese filenames. - - * Kyo Nagashima - Made some enhancements to file opening mappings. - - * Piet Delport - Changed the default cache directory to meet XDG spec. - - * Kent Sibilev - Debugged and made various patches. - * Simon Ruderich + * Yasuhiro Matsumoto * Ken Earley + * Kyo Nagashima * Zak Johnson * Diego Viola + * Piet Delport * Thibault Duplessis + * Kent Sibilev * Tacahiroy - Bugfixes/Corrections. + * Luca Pette =============================================================================== CHANGELOG *ctrlp-changelog* - + New option: |g:ctrlp_mruf_last_entered| change MRU to recently-entered. + + Rename: + *ClearCtrlPCache* -> |CtrlPClearCache| + *ClearAllCtrlPCaches* -> |CtrlPClearAllCaches| + *ResetCtrlP* -> |CtrlPReload| + +Before 2012/03/02~ + + + Rename: + *g:ctrlp_regexp_search* -> |g:ctrlp_regexp|, + *g:ctrlp_dont_split* -> |g:ctrlp_reuse_window|, + *g:ctrlp_jump_to_buffer* -> |g:ctrlp_switch_buffer|. + + Rename and tweak: + *g:ctrlp_open_multi* -> |g:ctrlp_open_multiple_files|. + + Deprecate *g:ctrlp_highlight_match* + + Extend |g:ctrlp_user_command| to support multiple commands. + + New option: |g:ctrlp_mruf_last_entered| change MRU to Recently-Entered. Before 2012/01/15~ @@ -770,7 +813,7 @@ Before 2012/01/15~ + New options: |g:ctrlp_arg_map| for , to accept an argument. |g:ctrlp_status_func| custom statusline. |g:ctrlp_mruf_relative| show only MRU files inside cwd. - + Extend |g:ctrlp_open_multi| with new optional values: tr, hr, vr. + + Extend g:ctrlp_open_multi with new optional values: tr, hr, vr. + Extend |g:ctrlp_custom_ignore| to specifically filter dir, file and link. Before 2012/01/05~ @@ -790,29 +833,29 @@ Before 2011/11/30~ Before 2011/11/13~ - + New special input: '/' and '\' find root (section 5.e) + + New special input: '/' and '\' find root (|ctrlp-input-formats| (e)) + Remove ctrlp#SetWorkingPath(). - + Remove |g:ctrlp_mru_files|, make MRU permanent. - + Extend |g:ctrlp_open_multi|, add new ways to open files. - + New option: |g:ctrlp_dont_split|, + + Remove *g:ctrlp_mru_files* and make MRU mode permanent. + + Extend g:ctrlp_open_multi, add new ways to open files. + + New option: g:ctrlp_dont_split, |g:ctrlp_mruf_case_sensitive| Before 2011/10/30~ + New feature: Support for custom extensions. also removes non-existent files from MRU list. - + New option: |g:ctrlp_jump_to_buffer| + + New option: g:ctrlp_jump_to_buffer Before 2011/10/12~ + New features: Open multiple files. Pass Vim’s |++opt| and |+cmd| to the opening file - (section 5.c) + (|ctrlp-input-formats| (c)) Auto-complete each dir for |:CtrlP| [starting-directory] + New mappings: mark/unmark a file to be opened with . open all marked files. - + New option: |g:ctrlp_open_multi| - + Remove |g:ctrlp_persistent_input|, |g:ctrlp_live_update| and . + + New option: g:ctrlp_open_multi + + Remove *g:ctrlp_persistent_input* *g:ctrlp_live_update* and . Before 2011/09/29~ @@ -824,22 +867,22 @@ Before 2011/09/29~ Before 2011/09/19~ - + New command: |ResetCtrlP| + + New command: ResetCtrlP + New options: |g:ctrlp_max_files|, |g:ctrlp_max_depth|, - |g:ctrlp_live_update| + g:ctrlp_live_update + New mapping: Before 2011/09/12~ + Ability to cycle through matched lines in the match window. - + Extend the behavior of |g:ctrlp_persistent_input| + + Extend the behavior of g:ctrlp_persistent_input + Extend the behavior of |:CtrlP| + New options: |g:ctrlp_dotfiles|, |g:ctrlp_clear_cache_on_exit|, - |g:ctrlp_highlight_match|, + g:ctrlp_highlight_match, |g:ctrlp_user_command| - + New special input: '..' (section 5.d) + + New special input: '..' (|ctrlp-input-formats| (d)) + New mapping: . + New commands: |:CtrlPCurWD|, |:CtrlPCurFile|, @@ -848,11 +891,11 @@ Before 2011/09/12~ + New feature: Search in most recently used (MRU) files + New mapping: . + Extended the behavior of . - + New options: |g:ctrlp_mru_files|, + + New options: g:ctrlp_mru_files, |g:ctrlp_mruf_max|, |g:ctrlp_mruf_exclude|, |g:ctrlp_mruf_include| - + New command: |:CtrlPMRUFiles| + + New command: |:CtrlPMRU| First public release: 2011/09/06~ diff --git a/bundle/git_ctrlp/plugin/ctrlp.vim b/bundle/git_ctrlp/plugin/ctrlp.vim index 5150c43..162a055 100644 --- a/bundle/git_ctrlp/plugin/ctrlp.vim +++ b/bundle/git_ctrlp/plugin/ctrlp.vim @@ -18,6 +18,10 @@ com! -n=? -com=dir CtrlP cal ctrlp#init(0, ) com! CtrlPBuffer cal ctrlp#init(1) com! CtrlPMRUFiles cal ctrlp#init(2) +com! CtrlPClearCache cal ctrlp#clr() +com! CtrlPClearAllCaches cal ctrlp#clra() +com! CtrlPReload cal ctrlp#reset() + com! ClearCtrlPCache cal ctrlp#clr() com! ClearAllCtrlPCaches cal ctrlp#clra() com! ResetCtrlP cal ctrlp#reset() @@ -26,7 +30,7 @@ com! CtrlPCurWD cal ctrlp#init(0, 0) com! CtrlPCurFile cal ctrlp#init(0, 1) com! CtrlPRoot cal ctrlp#init(0, 2) -if g:ctrlp_map != '' +if g:ctrlp_map != '' && !hasmapto(':'.g:ctrlp_cmd.'', 'n') exe 'nn ' g:ctrlp_map ':'.g:ctrlp_cmd.'' en diff --git a/bundle/git_ctrlp/readme.md b/bundle/git_ctrlp/readme.md index 8d106fe..3ae6360 100644 --- a/bundle/git_ctrlp/readme.md +++ b/bundle/git_ctrlp/readme.md @@ -16,14 +16,17 @@ Full path fuzzy __file__, __buffer__, __mru__ and __tag__ finder for Vim. Once CtrlP is open: -* Press `` and `` to switch between find file, buffer, and MRU file modes. +* Press `` and `` to switch between find file, buffer, and MRU file +modes. * Press `` to switch to filename only search instead of full path. * Press `` to purge the cache for the current directory and get new files. * Use `*` or `|` in the prompt to submit the string as a Vim’s regexp pattern. * Or press `` to switch to regexp mode. -* End the input string with a colon `:` followed by a command to execute after opening the file. +* End the input string with a colon `:` followed by a command to execute after +opening the file. e.g. `abc:45` will open the file matched the pattern and jump to line 45. -* Submit two dots `..` as the input string to go backward the directory tree by 1 level. +* Submit two dots `..` as the input string to go backward the directory tree by +1 level. * Use `` to create a new file and its parent dirs. * Use `` to mark/unmark files and `` to open them. @@ -34,7 +37,8 @@ e.g. `abc:45` will open the file matched the pattern and jump to line 45. let g:ctrlp_map = '' ``` -* When CtrlP is invoked, it automatically sets the working directory according to this variable: +* When CtrlP is invoked, it automatically sets its local working directory +according to this variable: ```vim let g:ctrlp_working_path_mode = 2 @@ -43,19 +47,14 @@ e.g. `abc:45` will open the file matched the pattern and jump to line 45. 0 - don’t manage working directory. 1 - the parent directory of the current file. 2 - the nearest ancestor that contains one of these directories or files: + `.git/` `.hg/` `.svn/` `.bzr/` `_darcs/` - .git/ - .hg/ - .bzr/ - _darcs/ - root.dir - -* If you want to exclude directories or files from the search, you can use the Vim’s option `wildignore` -and/or the option `g:ctrlp_custom_ignore`. Examples: +* If you want to exclude directories or files from the search, use the Vim’s +option `wildignore` and/or the option `g:ctrlp_custom_ignore`. Examples: ```vim - set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " for Linux/MacOSX - set wildignore+=.git\*,.hg\*,.svn\* " for Windows + set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux + set wildignore+=tmp\*,*.swp,*.zip,*.exe " Windows let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$' let g:ctrlp_custom_ignore = { @@ -68,8 +67,8 @@ and/or the option `g:ctrlp_custom_ignore`. Examples: * Use a custom file listing command with: ```vim - let g:ctrlp_user_command = 'find %s -type f' " MacOSX/Linux - let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' " Windows + let g:ctrlp_user_command = 'find %s -type f' " MacOSX/Linux + let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' " Windows ``` _Check [the docs][2] for more mappings, commands and options._ diff --git a/bundle/git_syntastic/README.markdown b/bundle/git_syntastic/README.markdown index 57c3101..78f97c6 100644 --- a/bundle/git_syntastic/README.markdown +++ b/bundle/git_syntastic/README.markdown @@ -55,7 +55,7 @@ Installation cd ~/.vim/bundle git clone https://github.com/scrooloose/syntastic.git -Then reload vim, run `:helptags`, and check out `:help syntastic.txt`. +Then reload vim, run `:Helptags`, and check out `:help syntastic.txt`. Google group @@ -64,6 +64,16 @@ Google group To get information or make suggestions check out the [google group](https://groups.google.com/group/vim-syntastic). +FAQ +--- + +__Q. I installed syntastic but it isn't reporting any errors ...__ + +A. The most likely reason is that the syntax checker that it requires isn't installed. For example: python requires either `flake8`, `pyflakes` or `pylint` to be installed and in `$PATH`. To see which executable is required, just look in `syntax_checkers/.vim`. + +Another reason it could fail is that the error output for the syntax checker may have changed. In this case, make sure you have the latest version of the syntax checker installed. If it still fails then create an issue - or better yet, create a pull request. + + Changelog --------- 2.3.0 (16-feb-2012) diff --git a/bundle/git_syntastic/autoload/syntastic/c.vim b/bundle/git_syntastic/autoload/syntastic/c.vim index c7232df..73623b1 100644 --- a/bundle/git_syntastic/autoload/syntastic/c.vim +++ b/bundle/git_syntastic/autoload/syntastic/c.vim @@ -38,6 +38,34 @@ function! s:Init() call s:RegHandler('php\.h', 'syntastic#c#CheckPhp', []) endfunction +" default include directories +let s:default_includes = [ '.', '..', 'include', 'includes', + \ '../include', '../includes' ] + +" uniquify the input list +function! s:Unique(list) + let l = [] + for elem in a:list + if index(l, elem) == -1 + let l = add(l, elem) + endif + endfor + return l +endfunction + +" get the gcc include directory argument depending on the default +" includes and the optional user-defined 'g:syntastic_c_include_dirs' +function! syntastic#c#GetIncludeDirs(filetype) + let include_dirs = copy(s:default_includes) + + if exists('g:syntastic_'.a:filetype.'_include_dirs') + call extend(include_dirs, g:syntastic_{a:filetype}_include_dirs) + endif + + return join(map(s:Unique(include_dirs), '"-I" . v:val'), ' ') +endfunction + + " search the first 100 lines for include statements that are " given in the handlers dictionary function! syntastic#c#SearchHeaders() diff --git a/bundle/git_syntastic/plugin/syntastic.vim b/bundle/git_syntastic/plugin/syntastic.vim index 0eb657a..4e3486f 100644 --- a/bundle/git_syntastic/plugin/syntastic.vim +++ b/bundle/git_syntastic/plugin/syntastic.vim @@ -127,6 +127,10 @@ function! s:UpdateErrors(auto_invoked) call s:RefreshSigns() endif + if g:syntastic_enable_highlighting + call s:HightlightErrors() + endif + if g:syntastic_auto_jump && s:BufHasErrorsOrWarningsToDisplay() silent! ll endif @@ -160,8 +164,10 @@ function! s:LocList() endfunction "clear the loc list for the buffer -function! s:ClearLocList() +function! s:ClearCache() let b:syntastic_loclist = [] + unlet! b:syntastic_errors + unlet! b:syntastic_warnings endfunction "detect and cache all syntax errors in this buffer @@ -169,7 +175,7 @@ endfunction "depends on a function called SyntaxCheckers_{&ft}_GetLocList() existing "elsewhere function! s:CacheErrors() - call s:ClearLocList() + call s:ClearCache() if filereadable(expand("%")) @@ -195,7 +201,7 @@ function! s:ToggleMode() let g:syntastic_mode_map['mode'] = "active" endif - call s:ClearLocList() + call s:ClearCache() call s:UpdateErrors(1) echo "Syntastic: " . g:syntastic_mode_map['mode'] . " mode enabled" @@ -217,30 +223,22 @@ function! s:ModeMapAllowsAutoChecking() endif endfunction -"return true if there are cached errors/warnings for this buf -function! s:BufHasErrorsOrWarnings() - return !empty(s:LocList()) -endfunction - -"return true if there are cached errors for this buf -function! s:BufHasErrors() - return len(s:ErrorsForType('E')) > 0 -endfunction - function! s:BufHasErrorsOrWarningsToDisplay() - return s:BufHasErrors() || (!g:syntastic_quiet_warnings && s:BufHasErrorsOrWarnings()) -endfunction - -function! s:ErrorsForType(type) - return s:FilterLocList({'type': a:type}) + return len(s:Errors()) || (!g:syntastic_quiet_warnings && !empty(s:LocList())) endfunction function! s:Errors() - return s:ErrorsForType("E") + if !exists("b:syntastic_errors") + let b:syntastic_errors = s:FilterLocList({'type': "E"}) + endif + return b:syntastic_errors endfunction function! s:Warnings() - return s:ErrorsForType("W") + if !exists("b:syntastic_warnings") + let b:syntastic_warnings = s:FilterLocList({'type': "W"}) + endif + return b:syntastic_warnings endfunction "Filter a loc list (defaults to s:LocList()) by a:filters @@ -253,16 +251,21 @@ endfunction function! s:FilterLocList(filters, ...) let llist = a:0 ? a:1 : s:LocList() - let rv = deepcopy(llist) - for error in llist - for key in keys(a:filters) - let rhs = a:filters[key] - if type(rhs) == 1 "string - let rhs = '"' . rhs . '"' - endif + let rv = [] - call filter(rv, "v:val['".key."'] ==? " . rhs) + for error in llist + + let passes_filters = 1 + for key in keys(a:filters) + if error[key] !=? a:filters[key] + let passes_filters = 0 + break + endif endfor + + if passes_filters + call add(rv, error) + endif endfor return rv endfunction @@ -351,6 +354,43 @@ function! s:ShowLocList() endif endfunction +"highlight the current errors using matchadd() +" +"The function `Syntastic_{&ft}_GetHighlightRegex` is used to get the regex to +"highlight errors that do not have a 'col' key (and hence cant be done +"automatically). This function must take one arg (an error item) and return a +"regex to match that item in the buffer. +" +"If the 'force_highlight_callback' key is set for an error item, then invoke +"the callback even if it can be highlighted automatically. +function! s:HightlightErrors() + call s:ClearErrorHighlights() + + let fts = substitute(&ft, '-', '_', 'g') + for ft in split(fts, '\.') + + for item in s:LocList() + + let force_callback = has_key(item, 'force_highlight_callback') && item['force_highlight_callback'] + + let group = item['type'] == 'E' ? 'SyntasticError' : 'SyntasticWarning' + if item['col'] && !force_callback + let lastcol = col([item['lnum'], '$']) + let lcol = min([lastcol, item['col']]) + call matchadd(group, '\%'.item['lnum'].'l\%'.lcol.'c') + else + + if exists("*SyntaxCheckers_". ft ."_GetHighlightRegex") + let term = SyntaxCheckers_{ft}_GetHighlightRegex(item) + if len(term) > 0 + call matchadd(group, '\%' . item['lnum'] . 'l' . term) + endif + endif + endif + endfor + endfor +endfunction + "remove all error highlights from the window function! s:ClearErrorHighlights() for match in getmatches() @@ -439,30 +479,33 @@ function! SyntasticStatuslineFlag() let errors = s:Errors() let warnings = s:Warnings() + let num_errors = len(errors) + let num_warnings = len(warnings) + let output = g:syntastic_stl_format "hide stuff wrapped in %E(...) unless there are errors - let output = substitute(output, '\C%E{\([^}]*\)}', len(errors) ? '\1' : '' , 'g') + let output = substitute(output, '\C%E{\([^}]*\)}', num_errors ? '\1' : '' , 'g') "hide stuff wrapped in %W(...) unless there are warnings - let output = substitute(output, '\C%W{\([^}]*\)}', len(warnings) ? '\1' : '' , 'g') + let output = substitute(output, '\C%W{\([^}]*\)}', num_warnings ? '\1' : '' , 'g') "hide stuff wrapped in %B(...) unless there are both errors and warnings - let output = substitute(output, '\C%B{\([^}]*\)}', (len(warnings) && len(errors)) ? '\1' : '' , 'g') + let output = substitute(output, '\C%B{\([^}]*\)}', (num_warnings && num_errors) ? '\1' : '' , 'g') "sub in the total errors/warnings/both - let output = substitute(output, '\C%w', len(warnings), 'g') - let output = substitute(output, '\C%e', len(errors), 'g') + let output = substitute(output, '\C%w', num_warnings, 'g') + let output = substitute(output, '\C%e', num_errors, 'g') let output = substitute(output, '\C%t', len(s:LocList()), 'g') "first error/warning line num let output = substitute(output, '\C%F', s:LocList()[0]['lnum'], 'g') "first error line num - let output = substitute(output, '\C%fe', len(errors) ? errors[0]['lnum'] : '', 'g') + let output = substitute(output, '\C%fe', num_errors ? errors[0]['lnum'] : '', 'g') "first warning line num - let output = substitute(output, '\C%fw', len(warnings) ? warnings[0]['lnum'] : '', 'g') + let output = substitute(output, '\C%fw', num_warnings ? warnings[0]['lnum'] : '', 'g') return output else @@ -539,37 +582,6 @@ function! SyntasticErrorBalloonExpr() return get(b:syntastic_balloons, v:beval_lnum, '') endfunction -"highlight the list of errors (a:errors) using matchadd() -" -"a:termfunc is provided to highlight errors that do not have a 'col' key (and -"hence cant be done automatically). This function must take one arg (an error -"item) and return a regex to match that item in the buffer. -" -"an optional boolean third argument can be provided to force a:termfunc to be -"used regardless of whether a 'col' key is present for the error -function! SyntasticHighlightErrors(errors, termfunc, ...) - if !g:syntastic_enable_highlighting - return - endif - - call s:ClearErrorHighlights() - - let force_callback = a:0 && a:1 - for item in a:errors - let group = item['type'] == 'E' ? 'SyntasticError' : 'SyntasticWarning' - if item['col'] && !force_callback - let lastcol = col([item['lnum'], '$']) - let lcol = min([lastcol, item['col']]) - call matchadd(group, '\%'.item['lnum'].'l\%'.lcol.'c') - else - let term = a:termfunc(item) - if len(term) > 0 - call matchadd(group, '\%' . item['lnum'] . 'l' . term) - endif - endif - endfor -endfunction - "take a list of errors and add default values to them from a:options function! SyntasticAddToErrors(errors, options) for i in range(0, len(a:errors)-1) diff --git a/bundle/git_syntastic/syntax_checkers/c.vim b/bundle/git_syntastic/syntax_checkers/c.vim index 8bd486b..c20b68d 100644 --- a/bundle/git_syntastic/syntax_checkers/c.vim +++ b/bundle/git_syntastic/syntax_checkers/c.vim @@ -64,56 +64,33 @@ endif let s:save_cpo = &cpo set cpo&vim -" default include directories -let s:default_includes = [ '.', '..', 'include', 'includes', - \ '../include', '../includes' ] - -" uniquify the input list -function! s:Unique(list) - let l = [] - for elem in a:list - if index(l, elem) == -1 - let l = add(l, elem) - endif - endfor - return l -endfunction - -" get the gcc include directory argument depending on the default -" includes and the optional user-defined 'g:syntastic_c_include_dirs' -function! s:GetIncludeDirs() - let include_dirs = s:default_includes - - if exists('g:syntastic_c_include_dirs') - call extend(include_dirs, g:syntastic_c_include_dirs) - endif - - return join(map(s:Unique(include_dirs), '"-I" . v:val'), ' ') -endfunction +if !exists('g:syntastic_c_compiler_options') + let g:syntastic_c_compiler_options = '-std=gnu99' +endif function! SyntaxCheckers_c_GetLocList() - let makeprg = 'gcc -fsyntax-only -std=gnu99 '.shellescape(expand('%')). - \ ' '.s:GetIncludeDirs() + let makeprg = 'gcc -fsyntax-only ' let errorformat = '%-G%f:%s:,%-G%f:%l: %#error: %#(Each undeclared '. \ 'identifier is reported only%.%#,%-G%f:%l: %#error: %#for '. \ 'each function it appears%.%#,%-GIn file included%.%#,'. \ '%-G %#from %f:%l\,,%f:%l:%c: %m,%f:%l: %trror: %m,%f:%l: %m' + " add optional user-defined compiler options + let makeprg .= g:syntastic_c_compiler_options + + let makeprg .= ' '.shellescape(expand('%')). + \ ' '.syntastic#c#GetIncludeDirs('c') + " determine whether to parse header files as well if expand('%') =~? '.h$' if exists('g:syntastic_c_check_header') let makeprg = 'gcc -c '.shellescape(expand('%')). - \ ' '.s:GetIncludeDirs() + \ ' '.syntastic#c#GetIncludeDirs('c') else return [] endif endif - " add optional user-defined compiler options - if exists('g:syntastic_c_compiler_options') - let makeprg .= g:syntastic_c_compiler_options - endif - " check if the user manually set some cflags if !exists('b:syntastic_c_cflags') " check whether to search for include files at all diff --git a/bundle/git_syntastic/syntax_checkers/cpp.vim b/bundle/git_syntastic/syntax_checkers/cpp.vim index 1bacf93..7fe2e0e 100644 --- a/bundle/git_syntastic/syntax_checkers/cpp.vim +++ b/bundle/git_syntastic/syntax_checkers/cpp.vim @@ -20,6 +20,12 @@ " " let g:syntastic_cpp_no_include_search = 1 " +" In order to add some custom include directories that should be added to the +" gcc command line you can add those to the global variable +" g:syntastic_cpp_include_dirs. This list can be used like this: +" +" let g:syntastic_cpp_include_dirs = [ 'includes', 'headers' ] +" " To enable header files being re-checked on every file write add the " following line to your .vimrc. Otherwise the header files are checked only " one time on initially loading the file. @@ -39,6 +45,12 @@ " checking execution via the variable 'g:syntastic_cpp_compiler_options': " " let g:syntastic_cpp_compiler_options = ' -std=c++0x' +" +" Using the global variable 'g:syntastic_cpp_remove_include_errors' you can +" specify whether errors of files included via the +" g:syntastic_cpp_include_dirs' setting are removed from the result set: +" +" let g:syntastic_cpp_remove_include_errors = 1 if exists('loaded_cpp_syntax_checker') finish @@ -53,21 +65,25 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_cpp_GetLocList() - let makeprg = 'g++ -fsyntax-only '.shellescape(expand('%')) + let makeprg = 'g++ -fsyntax-only ' let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m' - if expand('%') =~? '\%(.h\|.hpp\|.hh\)$' - if exists('g:syntastic_cpp_check_header') - let makeprg = 'g++ -c '.shellescape(expand('%')) - else - return [] - endif - endif - if exists('g:syntastic_cpp_compiler_options') let makeprg .= g:syntastic_cpp_compiler_options endif + let makeprg .= ' ' . shellescape(expand('%')) . + \ ' ' . syntastic#c#GetIncludeDirs('cpp') + + if expand('%') =~? '\%(.h\|.hpp\|.hh\)$' + if exists('g:syntastic_cpp_check_header') + let makeprg = 'g++ -c '.shellescape(expand('%')). + \ ' ' . syntastic#c#GetIncludeDirs('cpp') + else + return [] + endif + endif + if !exists('b:syntastic_cpp_cflags') if !exists('g:syntastic_cpp_no_include_search') || \ g:syntastic_cpp_no_include_search != 1 @@ -85,7 +101,18 @@ function! SyntaxCheckers_cpp_GetLocList() let makeprg .= b:syntastic_cpp_cflags endif - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + " process makeprg + let errors = SyntasticMake({ 'makeprg': makeprg, + \ 'errorformat': errorformat }) + + " filter the processed errors if desired + if exists('g:syntastic_cpp_remove_include_errors') && + \ g:syntastic_cpp_remove_include_errors != 0 + return filter(errors, + \ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr('')) + else + return errors + endif endfunction let &cpo = s:save_cpo diff --git a/bundle/git_syntastic/syntax_checkers/javascript/jslint.vim b/bundle/git_syntastic/syntax_checkers/javascript/jslint.vim index 94d48f0..a503a95 100644 --- a/bundle/git_syntastic/syntax_checkers/javascript/jslint.vim +++ b/bundle/git_syntastic/syntax_checkers/javascript/jslint.vim @@ -23,9 +23,6 @@ endfunction function! SyntaxCheckers_javascript_GetLocList() let makeprg = "jslint " . g:syntastic_javascript_jslint_conf . " " . shellescape(expand('%')) let errorformat='%E %##%n %m,%-Z%.%#Line %l\, Pos %c,%-G%.%#' - let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr("")} }) - call SyntasticHighlightErrors(errors, function('SyntaxCheckers_javascript_HighlightTerm')) - - return errors + return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr("")} }) endfunction diff --git a/bundle/git_syntastic/syntax_checkers/lua.vim b/bundle/git_syntastic/syntax_checkers/lua.vim index 03acb08..1fe3745 100644 --- a/bundle/git_syntastic/syntax_checkers/lua.vim +++ b/bundle/git_syntastic/syntax_checkers/lua.vim @@ -20,7 +20,7 @@ if !executable('luac') finish endif -function! SyntaxCheckers_lua_Term(pos) +function! SyntaxCheckers_lua_GetHighlightRegex(pos) let near = matchstr(a:pos['text'], "near '[^']\\+'") let result = '' if len(near) > 0 @@ -47,12 +47,9 @@ function! SyntaxCheckers_lua_GetLocList() let makeprg = 'luac -p ' . shellescape(expand('%')) let errorformat = 'luac: %#%f:%l: %m' - let loclist = SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': { 'bufnr': bufnr(''), 'type': 'E' } }) + return SyntasticMake({ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': { 'bufnr': bufnr(''), 'type': 'E' } }) - call SyntasticHighlightErrors(loclist, function("SyntaxCheckers_lua_Term")) - - return loclist endfunction diff --git a/bundle/git_syntastic/syntax_checkers/nasm.vim b/bundle/git_syntastic/syntax_checkers/nasm.vim new file mode 100644 index 0000000..f42cc8c --- /dev/null +++ b/bundle/git_syntastic/syntax_checkers/nasm.vim @@ -0,0 +1,32 @@ +"============================================================================ +"File: nasm.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Håvard Pettersson +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ +if exists("loaded_nasm_syntax_checker") + finish +endif +let loaded_nasm_syntax_checker = 1 + +"bail if the user doesnt have nasm installed +if !executable("nasm") + finish +endif + +function! SyntaxCheckers_nasm_GetLocList() + if has("win32") + let outfile="NUL" + else + let outfile="/dev/null" + endif + let wd = shellescape(expand("%:p:h") . "/") + let makeprg = "nasm -X gnu -f elf -I " . wd . " -o " . outfile . " " . shellescape(expand("%")) + let errorformat = '%f:%l: %t%*[^:]: %m' + return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) +endfunction diff --git a/bundle/git_syntastic/syntax_checkers/php.vim b/bundle/git_syntastic/syntax_checkers/php.vim index 4f22f91..99c3eca 100644 --- a/bundle/git_syntastic/syntax_checkers/php.vim +++ b/bundle/git_syntastic/syntax_checkers/php.vim @@ -28,9 +28,11 @@ if !exists("g:syntastic_phpcs_disable") let g:syntastic_phpcs_disable = 0 endif -function! SyntaxCheckers_php_Term(item) +function! SyntaxCheckers_php_GetHighlightRegex(item) let unexpected = matchstr(a:item['text'], "unexpected '[^']\\+'") - if len(unexpected) < 1 | return '' | end + if len(unexpected) < 1 + return '' + endif return '\V'.split(unexpected, "'")[1] endfunction @@ -38,7 +40,7 @@ function! SyntaxCheckers_php_GetLocList() let errors = [] - let makeprg = "php -l ".shellescape(expand('%')) + let makeprg = "php -l -d error_reporting=E_PARSE -d display_errors=0 -d error_log='' ".shellescape(expand('%')) let errorformat='%-GNo syntax errors detected in%.%#,PHP Parse error: %#syntax %trror\, %m in %f on line %l,PHP Fatal %trror: %m in %f on line %l,%-GErrors parsing %.%#,%-G\s%#,Parse error: %#syntax %trror\, %m in %f on line %l,Fatal %trror: %m in %f on line %l' let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) @@ -46,8 +48,6 @@ function! SyntaxCheckers_php_GetLocList() let errors = errors + s:GetPHPCSErrors() endif - call SyntasticHighlightErrors(errors, function('SyntaxCheckers_php_Term')) - return errors endfunction diff --git a/bundle/git_syntastic/syntax_checkers/python.vim b/bundle/git_syntastic/syntax_checkers/python.vim index a20539b..93a0b52 100644 --- a/bundle/git_syntastic/syntax_checkers/python.vim +++ b/bundle/git_syntastic/syntax_checkers/python.vim @@ -6,75 +6,22 @@ " kstep " Parantapa Bhattacharya " -"============================================================================ " " For forcing the use of flake8, pyflakes, or pylint set " " let g:syntastic_python_checker = 'pyflakes' " " in your .vimrc. Default is flake8. +"============================================================================ if exists("loaded_python_syntax_checker") finish endif let loaded_python_syntax_checker = 1 -"bail if the user doesnt have his favorite checker or flake8 or pyflakes installed -if !exists('g:syntastic_python_checker') || !executable(g:syntastic_python_checker) - if executable("flake8") - let g:syntastic_python_checker = 'flake8' - elseif executable("pyflakes") - let g:syntastic_python_checker = 'pyflakes' - elseif executable("pylint") - let g:syntastic_python_checker = 'pylint' - else - finish - endif -endif if !exists('g:syntastic_python_checker_args') let g:syntastic_python_checker_args = '' endif -function! SyntaxCheckers_python_Term(i) - if a:i['type'] ==# 'E' - let a:i['text'] = "Syntax error" - endif - if match(a:i['text'], 'is assigned to but never used') > -1 - \ || match(a:i['text'], 'imported but unused') > -1 - \ || match(a:i['text'], 'undefined name') > -1 - \ || match(a:i['text'], 'redefinition of') > -1 - \ || match(a:i['text'], 'referenced before assignment') > -1 - \ || match(a:i['text'], 'duplicate argument') > -1 - \ || match(a:i['text'], 'after other statements') > -1 - \ || match(a:i['text'], 'shadowed by loop variable') > -1 - - let term = split(a:i['text'], "'", 1)[1] - return '\V\<'.term.'\>' - endif - return '' -endfunction - -if g:syntastic_python_checker == 'pylint' - function! SyntaxCheckers_python_GetLocList() - let makeprg = 'pylint -f parseable -r n -i y ' . - \ shellescape(expand('%')) . - \ ' \| sed ''s_: \[[RC]_: \[W_''' . - \ ' \| sed ''s_: \[[F]_:\ \[E_''' - let errorformat = '%f:%l: [%t%n] %m,%-GNo config%m' - let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) - - return errors - endfunction -else - function! SyntaxCheckers_python_GetLocList() - let makeprg = g:syntastic_python_checker.' '.g:syntastic_python_checker_args.' '.shellescape(expand('%')) - let errorformat = - \ '%E%f:%l: could not compile,%-Z%p^,%W%f:%l:%c: %m,%W%f:%l: %m,%-G%.%#' - - let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) - - call SyntasticHighlightErrors(errors, function('SyntaxCheckers_python_Term')) - - return errors - endfunction -endif +let s:supported_checkers = ["flake8", "pyflakes", "pylint"] +call SyntasticLoadChecker(s:supported_checkers) diff --git a/bundle/git_syntastic/syntax_checkers/python/flake8.vim b/bundle/git_syntastic/syntax_checkers/python/flake8.vim new file mode 100644 index 0000000..ef65ab8 --- /dev/null +++ b/bundle/git_syntastic/syntax_checkers/python/flake8.vim @@ -0,0 +1,31 @@ +"============================================================================ +"File: flake8.vim +"Description: Syntax checking plugin for syntastic.vim +"Authors: Sylvain Soliman +" kstep +" +"============================================================================ +function! SyntaxCheckers_python_GetHighlightRegex(i) + if a:i['type'] ==# 'E' + let a:i['text'] = "Syntax error" + endif + if match(a:i['text'], 'is assigned to but never used') > -1 + \ || match(a:i['text'], 'imported but unused') > -1 + \ || match(a:i['text'], 'undefined name') > -1 + \ || match(a:i['text'], 'redefinition of') > -1 + \ || match(a:i['text'], 'referenced before assignment') > -1 + \ || match(a:i['text'], 'duplicate argument') > -1 + \ || match(a:i['text'], 'after other statements') > -1 + \ || match(a:i['text'], 'shadowed by loop variable') > -1 + + let term = split(a:i['text'], "'", 1)[1] + return '\V\<'.term.'\>' + endif + return '' +endfunction + +function! SyntaxCheckers_python_GetLocList() + let makeprg = 'flake8 '.g:syntastic_python_checker_args.' '.shellescape(expand('%')) + let errorformat = '%E%f:%l: could not compile,%-Z%p^,%W%f:%l:%c: %m,%W%f:%l: %m,%-G%.%#' + return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) +endfunction diff --git a/bundle/git_syntastic/syntax_checkers/python/pyflakes.vim b/bundle/git_syntastic/syntax_checkers/python/pyflakes.vim new file mode 100644 index 0000000..e28e1f5 --- /dev/null +++ b/bundle/git_syntastic/syntax_checkers/python/pyflakes.vim @@ -0,0 +1,34 @@ +"============================================================================ +"File: pyflakes.vim +"Description: Syntax checking plugin for syntastic.vim +"Authors: Martin Grenfell +" kstep +" Parantapa Bhattacharya +" +"============================================================================ +function! SyntaxCheckers_python_GetHighlightRegex(i) + if match(a:i['text'], 'is assigned to but never used') > -1 + \ || match(a:i['text'], 'imported but unused') > -1 + \ || match(a:i['text'], 'undefined name') > -1 + \ || match(a:i['text'], 'redefinition of') > -1 + \ || match(a:i['text'], 'referenced before assignment') > -1 + \ || match(a:i['text'], 'duplicate argument') > -1 + \ || match(a:i['text'], 'after other statements') > -1 + \ || match(a:i['text'], 'shadowed by loop variable') > -1 + + let term = split(a:i['text'], "'", 1)[1] + return '\V\<'.term.'\>' + endif + return '' +endfunction + +function! SyntaxCheckers_python_GetLocList() + let makeprg = 'pyflakes '.g:syntastic_python_checker_args.' '.shellescape(expand('%')) + let errorformat = '%E%f:%l: could not compile,%-Z%p^,%E%f:%l:%c: %m,%E%f:%l: %m,%-G%.%#' + + let errors = SyntasticMake({ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'text': "Syntax error"} }) + + return errors +endfunction diff --git a/bundle/git_syntastic/syntax_checkers/python/pylint.vim b/bundle/git_syntastic/syntax_checkers/python/pylint.vim new file mode 100644 index 0000000..62676f1 --- /dev/null +++ b/bundle/git_syntastic/syntax_checkers/python/pylint.vim @@ -0,0 +1,14 @@ +"============================================================================ +"File: pylint.vim +"Description: Syntax checking plugin for syntastic.vim +"Author: Parantapa Bhattacharya +" +"============================================================================ +function! SyntaxCheckers_python_GetLocList() + let makeprg = 'pylint -f parseable -r n -i y ' . + \ shellescape(expand('%')) . + \ ' \| sed ''s_: \[[RC]_: \[W_''' . + \ ' \| sed ''s_: \[[F]_:\ \[E_''' + let errorformat = '%f:%l: [%t%n%.%#] %m,%-GNo config%m' + return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) +endfunction diff --git a/bundle/git_syntastic/syntax_checkers/rst.vim b/bundle/git_syntastic/syntax_checkers/rst.vim index 107aafe..848e47d 100644 --- a/bundle/git_syntastic/syntax_checkers/rst.vim +++ b/bundle/git_syntastic/syntax_checkers/rst.vim @@ -24,7 +24,7 @@ if !executable("rst2pseudoxml.py") endif function! SyntaxCheckers_rst_GetLocList() - let makeprg = 'rst2pseudoxml.py --report=1 --exit-status=1 ' . + let makeprg = 'rst2pseudoxml.py --report=2 --exit-status=1 ' . \ shellescape(expand('%')) . ' /dev/null' let errorformat = '%f:%l:\ (%tNFO/1)\ %m, diff --git a/bundle/git_syntastic/syntax_checkers/ruby.vim b/bundle/git_syntastic/syntax_checkers/ruby.vim index 8c3cd81..17d00ca 100644 --- a/bundle/git_syntastic/syntax_checkers/ruby.vim +++ b/bundle/git_syntastic/syntax_checkers/ruby.vim @@ -8,6 +8,10 @@ " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. " +"Supports MRI and JRuby but loads the MRI syntax checker by default. +" +"Use the g:syntastic_ruby_checker option to specify which checker to load - +"set it to "jruby" to load the jruby checker. "============================================================================ if exists("loaded_ruby_syntax_checker") finish @@ -19,14 +23,8 @@ if !executable("ruby") finish endif -function! SyntaxCheckers_ruby_GetLocList() - " we cannot set RUBYOPT on windows like that - if has('win32') || has('win64') - let makeprg = 'ruby -W1 -T1 -c '.shellescape(expand('%')) - else - let makeprg = 'RUBYOPT= ruby -W1 -c '.shellescape(expand('%')) - endif - let errorformat = '%-GSyntax OK,%E%f:%l: syntax error\, %m,%Z%p^,%W%f:%l: warning: %m,%Z%p^,%W%f:%l: %m,%-C%.%#' +if !exists("g:syntastic_ruby_checker") + let g:syntastic_ruby_checker = "mri" +endif +exec "runtime! syntax_checkers/ruby/" . g:syntastic_ruby_checker . ".vim" - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) -endfunction diff --git a/bundle/git_syntastic/syntax_checkers/ruby/jruby.vim b/bundle/git_syntastic/syntax_checkers/ruby/jruby.vim new file mode 100644 index 0000000..bec5168 --- /dev/null +++ b/bundle/git_syntastic/syntax_checkers/ruby/jruby.vim @@ -0,0 +1,16 @@ +"============================================================================ +"File: jruby.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Leonid Shevtsov +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ +function! SyntaxCheckers_ruby_GetLocList() + "let makeprg = '' + "let errorformat = '' + "return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) +endfunction diff --git a/bundle/git_syntastic/syntax_checkers/ruby/mri.vim b/bundle/git_syntastic/syntax_checkers/ruby/mri.vim new file mode 100644 index 0000000..50a8a11 --- /dev/null +++ b/bundle/git_syntastic/syntax_checkers/ruby/mri.vim @@ -0,0 +1,22 @@ +"============================================================================ +"File: mri.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Martin Grenfell +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ +function! SyntaxCheckers_ruby_GetLocList() + " we cannot set RUBYOPT on windows like that + if has('win32') || has('win64') + let makeprg = 'ruby -W1 -T1 -c '.shellescape(expand('%')) + else + let makeprg = 'RUBYOPT= ruby -W1 -c '.shellescape(expand('%')) + endif + let errorformat = '%-GSyntax OK,%E%f:%l: syntax error\, %m,%Z%p^,%W%f:%l: warning: %m,%Z%p^,%W%f:%l: %m,%-C%.%#' + + return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) +endfunction diff --git a/bundle/git_syntastic/syntax_checkers/scala.vim b/bundle/git_syntastic/syntax_checkers/scala.vim new file mode 100644 index 0000000..f6f05af --- /dev/null +++ b/bundle/git_syntastic/syntax_checkers/scala.vim @@ -0,0 +1,33 @@ +"============================================================================ +"File: scala.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Rickey Visinski +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ +if exists("loaded_scala_syntax_checker") + finish +endif +let loaded_scala_syntax_checker = 1 + +"bail if the user doesnt have the scala binary installed +if !executable("scala") + finish +endif + +if !exists("g:syntastic_scala_options") + let g:syntastic_scala_options = " " +endif + +function! SyntaxCheckers_scala_GetLocList() + let makeprg = 'scala '. g:syntastic_scala_options .' '. shellescape(expand('%')) . ' /dev/null' + + let errorformat = '%f\:%l: %trror: %m' + + return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) +endfunction + diff --git a/bundle/git_syntastic/syntax_checkers/vala.vim b/bundle/git_syntastic/syntax_checkers/vala.vim index f174790..cf619f3 100644 --- a/bundle/git_syntastic/syntax_checkers/vala.vim +++ b/bundle/git_syntastic/syntax_checkers/vala.vim @@ -32,7 +32,7 @@ if exists('g:syntastic_vala_check_disabled') && g:syntastic_vala_check_disabled finish endif -function! SyntaxCheckers_vala_Term(pos) +function! SyntaxCheckers_vala_GetHighlightRegex(pos) let strlength = strlen(matchstr(a:pos['text'], '\^\+$')) return '\%>'.(a:pos.col-1).'c.*\%<'.(a:pos.col+strlength+1).'c' endfunction @@ -49,8 +49,8 @@ function! SyntaxCheckers_vala_GetLocList() let makeprg = 'valac -C ' . vala_pkg_args . ' ' .shellescape(expand('%')) let errorformat = '%A%f:%l.%c-%\d%\+.%\d%\+: %t%[a-z]%\+: %m,%C%m,%Z%m' - let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) - call SyntasticHighlightErrors(loclist, function("SyntaxCheckers_vala_Term"), 1) - return loclist + return SyntasticMake({ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'force_highlight_callback': 1} }) endfunction diff --git a/bundle/git_syntastic/syntax_checkers/z80.vim b/bundle/git_syntastic/syntax_checkers/z80.vim new file mode 100644 index 0000000..15cba23 --- /dev/null +++ b/bundle/git_syntastic/syntax_checkers/z80.vim @@ -0,0 +1,31 @@ +"============================================================================ +"File: z80.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Romain Giot +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ +if exists("loaded_z80_syntax_checker") + finish +endif +let loaded_z80_syntax_checker = 1 + +"bail if the user doesnt have z80_syntax_checker.py installed +"To obtain this application there are two solutions: +" - Install this python package: https://github.com/rgiot/pycpcdemotools +" - Copy/paste this script in your search path: https://raw.github.com/rgiot/pycpcdemotools/master/cpcdemotools/source_checker/z80_syntax_checker.py +if !executable("z80_syntax_checker.py") + finish +endif + +function! SyntaxCheckers_z80_GetLocList() + let makeprg = 'z80_syntax_checker.py '.shellescape(expand('%')) + let errorformat = '%f:%l %m' + let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + return loclist +endfunction + diff --git a/bundle/git_taglisttoo/autoload/taglisttoo/taglist.vim b/bundle/git_taglisttoo/autoload/taglisttoo/taglist.vim index cab0f90..906a5db 100644 --- a/bundle/git_taglisttoo/autoload/taglisttoo/taglist.vim +++ b/bundle/git_taglisttoo/autoload/taglisttoo/taglist.vim @@ -1,7 +1,7 @@ " Author: Eric Van Dewoestine " " License: {{{ -" Copyright (c) 2005 - 2011, Eric Van Dewoestine +" Copyright (c) 2005 - 2012, Eric Van Dewoestine " All rights reserved. " " Redistribution and use of this software in source and binary forms, with @@ -980,15 +980,9 @@ function! s:Window(settings, tags) " {{{ let winnum = s:GetTagListWinnr() if winnum == -1 - if exists('g:VerticalToolWindowSide') && - \ g:VerticalToolWindowSide == g:TaglistTooPosition - call eclim#display#window#VerticalToolWindowOpen(s:taglisttoo_title, 10, 1) - else - let position = g:TaglistTooPosition == 'right' ? 'botright' : 'topleft' - silent exec - \ position . ' vertical ' . g:Tlist_WinWidth . - \ ' split ' . escape(s:taglisttoo_title, ' ') - endif + let position = g:TaglistTooPosition == 'right' ? 'botright' : 'topleft' + exec position . ' vertical ' . g:Tlist_WinWidth . + \ ' split ' . escape(s:taglisttoo_title, ' ') let winnum = s:GetTagListWinnr() exe winnum . 'wincmd w' @@ -1182,14 +1176,11 @@ function! s:FileSupported(filename, ftype) " {{{ endfunction " }}} function! s:CloseIfLastWindow() " {{{ - if histget(':', -1) !~ '^bd' - let numtoolwindows = 0 - if winnr('$') == 1 - if tabpagenr('$') > 1 - tabclose - else - quitall - endif + if winnr('$') == 1 + if tabpagenr('$') > 1 + tabclose + else + quitall endif endif endfunction " }}} diff --git a/bundle/mark/autoload/mark.vim b/bundle/mark/autoload/mark.vim index 2774465..71a8bb4 100644 --- a/bundle/mark/autoload/mark.vim +++ b/bundle/mark/autoload/mark.vim @@ -23,7 +23,8 @@ " set l:isWrapped instead. " - FIX: Wrong logic for determining l:isWrapped lets wrap-around go undetected " when v:count >= number of total matches. [l:startLine, l:startCol] must -" be updated on every iteration. +" be updated on every iteration, and should therefore be named [l:prevLine, +" l:prevCol]. " " 17-May-2011, Ingo Karkat " - Make s:GetVisualSelection() public to allow use in suggested @@ -531,7 +532,7 @@ function! s:Search( pattern, isBackward, currentMarkPosition, searchType ) let l:isMatch = 0 let l:line = 0 while l:count > 0 - let [l:startLine, l:startCol] = [line('.'), col('.')] + let [l:prevLine, l:prevCol] = [line('.'), col('.')] " Search for next match, 'wrapscan' applies. let [l:line, l:col] = searchpos( a:pattern, (a:isBackward ? 'b' : '') ) @@ -571,9 +572,9 @@ function! s:Search( pattern, isBackward, currentMarkPosition, searchType ) " Note: No need to check 'wrapscan'; the wrapping can only occur if " 'wrapscan' is actually on. - if ! a:isBackward && (l:startLine > l:line || l:startLine == l:line && l:startCol >= l:col) + if ! a:isBackward && (l:prevLine > l:line || l:prevLine == l:line && l:prevCol >= l:col) let l:isWrapped = 1 - elseif a:isBackward && (l:startLine < l:line || l:startLine == l:line && l:startCol <= l:col) + elseif a:isBackward && (l:prevLine < l:line || l:prevLine == l:line && l:prevCol <= l:col) let l:isWrapped = 1 endif else diff --git a/bundle/mark/doc/mark.txt b/bundle/mark/doc/mark.txt index 5528d09..1bd4080 100644 --- a/bundle/mark/doc/mark.txt +++ b/bundle/mark/doc/mark.txt @@ -176,6 +176,9 @@ your vimrc file (or anywhere before this plugin is sourced), in the following form (where N = 1..): > highlight MarkWordN ctermbg=Cyan ctermfg=Black guibg=#8CCBEA guifg=Black Higher numbers always take precedence and are displayed above lower ones. +If you want to avoid losing the highlightings on |:colorscheme| commands, you +need to re-apply your highlights on the |ColorScheme| event, similar to how +this plugin does. The search type highlighting (in the search message) can be changed via: > highlight link SearchSpecialSearchType MoreMsg @@ -249,6 +252,10 @@ http://vim.wikia.com/wiki/Highlight_multiple_words: ============================================================================== HISTORY *mark-history* +2.5.3 02-Mar-2012 +- BUG: Version check mistakenly excluded Vim 7.1 versions that do have the + matchadd() function. Thanks to Philipp Marek for sending a patch. + 2.5.2 09-Nov-2011 Fixed various problems with wrap-around warnings: - BUG: With a single match and 'wrapscan' set, a search error was issued. @@ -397,8 +404,8 @@ Last version published by Yuheng Xie on vim.org. Initial version published by Yuheng Xie on vim.org. ============================================================================== -Copyright: (C) 2005-2008 by Yuheng Xie - (C) 2008-2011 by Ingo Karkat +Copyright: (C) 2005-2008 Yuheng Xie + (C) 2008-2012 Ingo Karkat The VIM LICENSE applies to this script; see|copyright|. Maintainer: Ingo Karkat diff --git a/bundle/mark/plugin/mark.vim b/bundle/mark/plugin/mark.vim index e51c373..4bd2c1b 100644 --- a/bundle/mark/plugin/mark.vim +++ b/bundle/mark/plugin/mark.vim @@ -1,8 +1,8 @@ " Script Name: mark.vim " Description: Highlight several words in different colors simultaneously. " -" Copyright: (C) 2005-2008 by Yuheng Xie -" (C) 2008-2011 by Ingo Karkat +" Copyright: (C) 2005-2008 Yuheng Xie +" (C) 2008-2012 Ingo Karkat " The VIM LICENSE applies to this script; see ':help copyright'. " " Maintainer: Ingo Karkat @@ -13,8 +13,12 @@ " - Requires Vim 7.1 with "matchadd()", or Vim 7.2 or higher. " - mark.vim autoload script. " -" Version: 2.5.0 +" Version: 2.5.3 " Changes: +" 02-Mar-2012, Philipp Marek +" - BUG: Version check mistakenly excluded Vim 7.1 versions that do have the +" matchadd() function. +" " 06-May-2011, Ingo Karkat " - By default, enable g:mwAutoSaveMarks, so that marks are always persisted, " but disable g:mwAutoLoadMarks, so that persisted marks have to be explicitly @@ -152,7 +156,7 @@ " -> e.g. :Mark Mark.\{-}\ze( " Avoid installing twice or when in unsupported Vim version. -if exists('g:loaded_mark') || (v:version == 701 && ! exists('*matchadd')) || (v:version < 702) +if exists('g:loaded_mark') || (v:version == 701 && ! exists('*matchadd')) || (v:version < 701) finish endif let g:loaded_mark = 1