diff --git a/.vimrc b/.vimrc index ee062c6..1568b11 100644 --- a/.vimrc +++ b/.vimrc @@ -91,6 +91,7 @@ autocmd BufWritePre *.xml :call StripTrailingWhitespaces() "set correct filetype for tmux autocmd BufRead *.tmux.conf set filetype=tmux autocmd BufRead *.mako set filetype=mako +autocmd BufRead *.ass set filetype=kickass " }}} "TERMINAL: options for terminal emulators {{{ if $TERM == 'rxvt-unicode-256color' || $TERM == 'xterm' diff --git a/GetLatest/GetLatestVimScripts.dat b/GetLatest/GetLatestVimScripts.dat index cd85c2f..68c9004 100644 --- a/GetLatest/GetLatestVimScripts.dat +++ b/GetLatest/GetLatestVimScripts.dat @@ -4,23 +4,22 @@ ScriptID SourceID Filename 2572 10433 ack.vim 102 16171 DirDiff.vim 311 7645 grep.vim -3304 17406 gundo.vim +3304 18081 gundo.vim 2727 11120 jsbeautify.vim 2289 8922 loremipsum -2666 17666 Mark +2666 17810 Mark 1218 14455 nerdcommenter 2262 8944 occur.vim 2136 8206 repeat.vim 152 3342 showmarks.vim 2540 11006 snipMate.vim 1697 12566 surround.vim -3465 17112 Tagbar +3465 18143 Tagbar 90 17031 vcscommand.vim -2226 15854 vimwiki.vim +2226 18100 vimwiki.vim 1334 6377 vst.vim 2321 9055 zoom.vim 52 14880 calendar.vim -3736 17669 ctrlp.vim ### ftplugin 3818 16921 MatchTag 910 14691 pydoc.vim diff --git a/bundle/git_ctrlp/autoload/ctrlp.vim b/bundle/git_ctrlp/autoload/ctrlp.vim index 136d752..8444da6 100644 --- a/bundle/git_ctrlp/autoload/ctrlp.vim +++ b/bundle/git_ctrlp/autoload/ctrlp.vim @@ -1,122 +1,141 @@ " ============================================================================= " File: autoload/ctrlp.vim -" Description: Fuzzy file, buffer, mru and tag finder. +" Description: Fuzzy file, buffer, mru, tag, etc finder. " Author: Kien Nguyen -" Version: 1.7.4 +" Version: 1.7.7 " ============================================================================= -" * Static variables {{{1 -fu! s:opts() - " Options - let hst = exists('+hi') ? &hi : 20 - let opts = { - \ 'g:ctrlp_arg_map': ['s:argmap', 0], - \ 'g:ctrlp_by_filename': ['s:byfname', 0], - \ 'g:ctrlp_clear_cache_on_exit': ['s:clrex', 1], - \ 'g:ctrlp_custom_ignore': ['s:usrign', ''], - \ 'g:ctrlp_default_input': ['s:deftxt', 0], - \ 'g:ctrlp_dont_split': ['s:nosplit', 'netrw'], - \ 'g:ctrlp_dotfiles': ['s:dotfiles', 1], - \ 'g:ctrlp_extensions': ['s:extensions', []], - \ 'g:ctrlp_follow_symlinks': ['s:folsym', 0], - \ 'g:ctrlp_highlight_match': ['s:mathi', [1, 'CtrlPMatch']], - \ 'g:ctrlp_jump_to_buffer': ['s:jmptobuf', 2], - \ 'g:ctrlp_lazy_update': ['s:lazy', 0], - \ 'g:ctrlp_match_func': ['s:matcher', {}], - \ 'g:ctrlp_match_window_bottom': ['s:mwbottom', 1], - \ 'g:ctrlp_match_window_reversed': ['s:mwreverse', 1], - \ 'g:ctrlp_max_depth': ['s:maxdepth', 40], - \ 'g:ctrlp_max_files': ['s:maxfiles', 10000], - \ 'g:ctrlp_max_height': ['s:mxheight', 10], - \ 'g:ctrlp_max_history': ['s:maxhst', hst], - \ 'g:ctrlp_open_multi': ['s:opmul', '1v'], - \ 'g:ctrlp_open_new_file': ['s:newfop', 'v'], - \ 'g:ctrlp_prompt_mappings': ['s:urprtmaps', 0], - \ 'g:ctrlp_regexp_search': ['s:regexp', 0], - \ 'g:ctrlp_root_markers': ['s:rmarkers', []], - \ 'g:ctrlp_split_window': ['s:splitwin', 0], - \ 'g:ctrlp_status_func': ['s:status', {}], - \ 'g:ctrlp_use_caching': ['s:caching', 1], - \ 'g:ctrlp_use_migemo': ['s:migemo', 0], - \ 'g:ctrlp_user_command': ['s:usrcmd', ''], - \ 'g:ctrlp_working_path_mode': ['s:pathmode', 2], +" ** Static variables {{{1 +fu! s:ignore() "{{{2 + let igdirs = [ + \ '\.git$', + \ '\.hg$', + \ '\.svn$', + \ '_darcs$', + \ '\.bzr$', + \ '\.cdv$', + \ '\~\.dep$', + \ '\~\.dot$', + \ '\~\.nib$', + \ '\~\.plst$', + \ '\.pc$', + \ '_MTN$', + \ ' ', { - \ 'PrtBS()': ['', ''], - \ 'PrtDelete()': [''], - \ 'PrtDeleteWord()': [''], - \ 'PrtClear()': [''], - \ 'PrtSelectMove("j")': ['', ''], - \ 'PrtSelectMove("k")': ['', ''], - \ 'PrtSelectMove("t")': ['', ''], - \ 'PrtSelectMove("b")': ['', ''], - \ 'PrtSelectMove("u")': ['', ''], - \ 'PrtSelectMove("d")': ['', ''], - \ 'PrtHistory(-1)': [''], - \ 'PrtHistory(1)': [''], - \ 'AcceptSelection("e")': ['', '<2-LeftMouse>'], - \ 'AcceptSelection("h")': ['', '', ''], - \ 'AcceptSelection("t")': ['', ''], - \ 'AcceptSelection("v")': ['', ''], - \ 'ToggleFocus()': [''], - \ 'ToggleRegex()': [''], - \ 'ToggleByFname()': [''], - \ 'ToggleType(1)': ['', ''], - \ 'ToggleType(-1)': ['', ''], - \ 'PrtExpandDir()': [''], - \ 'PrtInsert("w")': ['', ''], - \ 'PrtInsert("s")': [''], - \ 'PrtInsert("v")': [''], - \ 'PrtInsert("+")': [''], - \ 'PrtCurStart()': [''], - \ 'PrtCurEnd()': [''], - \ 'PrtCurLeft()': ['', '', ''], - \ 'PrtCurRight()': ['', ''], - \ 'PrtClearCache()': [''], - \ 'PrtDeleteMRU()': [''], - \ 'CreateNewFile()': [''], - \ 'MarkToOpen()': [''], - \ 'OpenMulti()': [''], - \ 'PrtExit()': ['', '', ''], - \ }] - if !has('gui_running') && ( has('win32') || has('win64') ) - cal add(s:prtmaps['PrtBS()'], remove(s:prtmaps['PrtCurLeft()'], 0)) - en - if type(s:urprtmaps) == 4 - cal extend(s:prtmaps, s:urprtmaps) - en - " 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': '', 'mousef': 0, - \ 'imd': 1 } - if s:lazy - cal extend(s:glbs, { 'ut': ( s:lazy > 1 ? s:lazy : 250 ) }) - en -endf -cal s:opts() +endf "}}}2 +" Options +let [s:pref, s:opts, s:new_opts] = ['g:ctrlp_', { + \ 'arg_map': ['s:argmap', 0], + \ 'buffer_func': ['s:buffunc', {}], + \ 'by_filename': ['s:byfname', 0], + \ 'custom_ignore': ['s:usrign', s:ignore()], + \ 'default_input': ['s:deftxt', 0], + \ 'dont_split': ['s:nosplit', 'netrw'], + \ 'dotfiles': ['s:dotfiles', 1], + \ 'extensions': ['s:extensions', []], + \ 'follow_symlinks': ['s:folsym', 0], + \ 'highlight_match': ['s:mathi', [1, 'CtrlPMatch']], + \ 'jump_to_buffer': ['s:jmptobuf', 2], + \ 'lazy_update': ['s:lazy', 0], + \ 'match_func': ['s:matcher', {}], + \ 'match_window_bottom': ['s:mwbottom', 1], + \ 'match_window_reversed': ['s:mwreverse', 1], + \ 'max_depth': ['s:maxdepth', 40], + \ 'max_files': ['s:maxfiles', 10000], + \ 'max_height': ['s:mxheight', 10], + \ 'max_history': ['s:maxhst', exists('+hi') ? &hi : 20], + \ 'mruf_default_order': ['s:mrudef', 0], + \ 'open_multi': ['s:opmul', '1v'], + \ 'open_new_file': ['s:newfop', 'v'], + \ 'prompt_mappings': ['s:urprtmaps', 0], + \ 'regexp_search': ['s:regexp', 0], + \ 'root_markers': ['s:rmarkers', []], + \ 'split_window': ['s:splitwin', 0], + \ 'status_func': ['s:status', {}], + \ 'use_caching': ['s:caching', 1], + \ 'use_migemo': ['s:migemo', 0], + \ 'user_command': ['s:usrcmd', ''], + \ 'working_path_mode': ['s:pathmode', 2], + \ }, { + \ 'open_multiple_files': 's:opmul', + \ 'regexp': 's:regexp', + \ 'reuse_window': 's:nosplit', + \ 'switch_buffer': 's:jmptobuf', + \ }] + +" 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': '', 'mousef': 0, + \ 'imd': 1 } + +" Keymaps +let [s:lcmap, s:prtmaps] = ['nn ', { + \ 'PrtBS()': ['', ''], + \ 'PrtDelete()': [''], + \ 'PrtDeleteWord()': [''], + \ 'PrtClear()': [''], + \ 'PrtSelectMove("j")': ['', ''], + \ 'PrtSelectMove("k")': ['', ''], + \ 'PrtSelectMove("t")': ['', ''], + \ 'PrtSelectMove("b")': ['', ''], + \ 'PrtSelectMove("u")': ['', ''], + \ 'PrtSelectMove("d")': ['', ''], + \ 'PrtHistory(-1)': [''], + \ 'PrtHistory(1)': [''], + \ 'AcceptSelection("e")': ['', '<2-LeftMouse>'], + \ 'AcceptSelection("h")': ['', '', ''], + \ 'AcceptSelection("t")': [''], + \ 'AcceptSelection("v")': ['', ''], + \ 'ToggleFocus()': [''], + \ 'ToggleRegex()': [''], + \ 'ToggleByFname()': [''], + \ 'ToggleType(1)': ['', ''], + \ 'ToggleType(-1)': ['', ''], + \ 'PrtExpandDir()': [''], + \ 'PrtInsert("c")': ['', ''], + \ 'PrtInsert()': [''], + \ 'PrtCurStart()': [''], + \ 'PrtCurEnd()': [''], + \ 'PrtCurLeft()': ['', '', ''], + \ 'PrtCurRight()': ['', ''], + \ 'PrtClearCache()': [''], + \ 'PrtDeleteEnt()': [''], + \ 'CreateNewFile()': [''], + \ 'MarkToOpen()': [''], + \ 'OpenMulti()': [''], + \ 'PrtExit()': ['', '', ''], + \ }] + +if !has('gui_running') && ( has('win32') || has('win64') ) + cal add(s:prtmaps['PrtBS()'], remove(s:prtmaps['PrtCurLeft()'], 0)) +en let s:lash = ctrlp#utils#lash() @@ -131,7 +150,7 @@ let s:fpats = { \ '^\S\\?$': '\\?', \ } -" Mappings +" Specials let s:prtunmaps = [ \ 'PrtBS()', \ 'PrtDelete()', @@ -143,10 +162,8 @@ let s:prtunmaps = [ \ 'PrtCurRight()', \ 'PrtHistory(-1)', \ 'PrtHistory(1)', - \ 'PrtInsert("w")', - \ 'PrtInsert("s")', - \ 'PrtInsert("v")', - \ 'PrtInsert("+")', + \ 'PrtInsert("c")', + \ 'PrtInsert()', \ ] " Keypad @@ -169,12 +186,51 @@ let s:hlgrps = { \ 'PrtText': 'Normal', \ 'PrtCursor': 'Constant', \ } + +fu! s:opts() "{{{2 + " Options + unl! s:usrign s:usrcmd s:urprtmaps + for each in ['byfname', 'regexp', 'extensions'] | if exists('s:'.each) + let {each} = s:{each} + en | endfo + for [ke, va] in items(s:opts) + let {va[0]} = exists(s:pref.ke) ? {s:pref.ke} : va[1] + endfo + unl va + for [ke, va] in items(s:new_opts) + let {va} = {exists(s:pref.ke) ? s:pref.ke : va} + endfo + for each in ['byfname', 'regexp'] | if exists(each) + let s:{each} = {each} + en | 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]) + let s:glob = s:dotfiles ? '.*\|*' : '*' + let s:igntype = empty(s:usrign) ? -1 : type(s:usrign) + if s:lazy + cal extend(s:glbs, { 'ut': ( s:lazy > 1 ? s:lazy : 250 ) }) + en + " Extensions + if !( exists('extensions') && extensions == s:extensions ) + for each in s:extensions + exe 'ru autoload/ctrlp/'.each.'.vim' + endfo + en + " Keymaps + if type(s:urprtmaps) == 4 + cal extend(s:prtmaps, s:urprtmaps) + en +endf +"}}}1 " * Open & Close {{{1 fu! s:Open() + let s:ermsg = v:errmsg cal s:log(1) cal s:getenv() cal s:execextvar('enter') - sil! exe 'noa keepa' ( s:mwbottom ? 'bo' : 'to' ) '1new ControlP' + sil! exe 'keepa' ( s:mwbottom ? 'bo' : 'to' ) '1new ControlP' + cal s:buffunc(1) let [s:bufnr, s:prompt, s:winw] = [bufnr('%'), ['', '', ''], winwidth(0)] abc if !exists('s:hstry') @@ -191,34 +247,37 @@ fu! s:Open() endf fu! s:Close() - try | noa bun! - cat | noa clo! | endt + cal s:buffunc(0) + try | bun! + cat | clo! | endt cal s:unmarksigns() for key in keys(s:glbs) | if exists('+'.key) sil! exe 'let &'.key.' = s:glb_'.key en | endfo if exists('s:glb_acd') | let &acd = s:glb_acd | en - let [g:ctrlp_lines, g:ctrlp_allfiles] = [[], []] + let g:ctrlp_lines = [] 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 - \ g:ctrlp_nolimit + \ s:mrbs cal ctrlp#recordhist() cal s:execextvar('exit') cal s:log(0) + let v:errmsg = s:ermsg ec endf " * Clear caches {{{1 fu! ctrlp#clr(...) - exe 'let g:ctrlp_new'.( a:0 ? a:1 : 'cache' ).' = 1' + let [s:matches, g:ctrlp_new{ a:0 ? a:1 : 'cache' }] = [1, 1] endf fu! ctrlp#clra() let cache_dir = ctrlp#utils#cachedir() if isdirectory(cache_dir) let cache_files = split(s:glbpath(cache_dir, '**', 1), "\n") - let eval = '!isdirectory(v:val) && v:val !~ ''\[.a-z]+$|\.log$''' sil! cal map(filter(cache_files, eval), 'delete(v:val)') en cal ctrlp#clr() @@ -228,33 +287,33 @@ fu! ctrlp#reset() cal s:opts() cal s:autocmds() cal ctrlp#utils#opts() - cal ctrlp#mrufiles#opts() cal s:execextvar('opts') endf " * Files {{{1 fu! ctrlp#files() - let [cwd, cafile, g:ctrlp_allfiles] = [getcwd(), ctrlp#utils#cachefile(), []] + let cafile = ctrlp#utils#cachefile() if g:ctrlp_newcache || !filereadable(cafile) || !s:caching - let lscmd = s:lsCmd() + let [lscmd, s:initcwd, g:ctrlp_allfiles] = [s:lsCmd(), s:dyncwd, []] " Get the list of files if empty(lscmd) - cal s:GlobPath(cwd, 0) + cal s:GlobPath(s:dyncwd, 0) el sil! cal ctrlp#progress('Indexing...') - try | cal s:UserCmd(cwd, lscmd) + try | cal s:UserCmd(lscmd) cat | retu [] | endt en " Remove base directory cal ctrlp#rmbasedir(g:ctrlp_allfiles) - let read_cache = 0 if len(g:ctrlp_allfiles) <= s:compare_lim cal sort(g:ctrlp_allfiles, 'ctrlp#complen') en + cal s:writecache(cafile) el - let g:ctrlp_allfiles = ctrlp#utils#readfile(cafile) - let read_cache = 1 + if !( exists('s:initcwd') && s:initcwd == s:dyncwd ) + let s:initcwd = s:dyncwd + let g:ctrlp_allfiles = ctrlp#utils#readfile(cafile) + en en - cal s:writecache(read_cache, cafile) retu g:ctrlp_allfiles endf @@ -263,18 +322,21 @@ fu! s:GlobPath(dirs, depth) let [dnf, depth] = [ctrlp#dirnfile(entries), a:depth + 1] cal extend(g:ctrlp_allfiles, dnf[1]) if !empty(dnf[0]) && !s:maxf(len(g:ctrlp_allfiles)) && depth <= s:maxdepth - sil! cal ctrlp#progress(len(g:ctrlp_allfiles)) + sil! cal ctrlp#progress(len(g:ctrlp_allfiles), 1) cal s:GlobPath(join(dnf[0], ','), depth) en endf -fu! s:UserCmd(path, lscmd) - let path = a:path +fu! s:UserCmd(lscmd) + let [path, lscmd] = [s:dyncwd, a:lscmd] if exists('+ssl') && &ssl let [ssl, &ssl, path] = [&ssl, 0, tr(path, '/', '\')] en + if has('win32') || has('win64') + let lscmd = substitute(lscmd, '\v(^|&&\s*)\zscd (/d)@!', 'cd /d ', '') + en let path = exists('*shellescape') ? shellescape(path) : path - let g:ctrlp_allfiles = split(system(printf(a:lscmd, path)), "\n") + let g:ctrlp_allfiles = split(system(printf(lscmd, path)), "\n") if exists('+ssl') && exists('ssl') let &ssl = ssl cal map(g:ctrlp_allfiles, 'tr(v:val, "\\", "/")') @@ -290,7 +352,7 @@ fu! s:lsCmd() retu cmd elsei type(cmd) == 3 && len(cmd) >= 2 && cmd[:1] != ['', ''] " Find a repo root - cal s:findroot(getcwd(), cmd[0], 0, 1) + cal s:findroot(s:dyncwd, cmd[0], 0, 1) if !exists('s:vcsroot') " Try the secondary_command retu len(cmd) == 3 ? cmd[2] : '' @@ -300,7 +362,7 @@ fu! s:lsCmd() retu cmd[1] elsei type(cmd) == 4 && has_key(cmd, 'types') for key in sort(keys(cmd['types']), 's:compval') - cal s:findroot(getcwd(), cmd['types'][key][0], 0, 1) + cal s:findroot(s:dyncwd, cmd['types'][key][0], 0, 1) if exists('s:vcsroot') | brea | en endfo if !exists('s:vcsroot') @@ -312,44 +374,37 @@ fu! s:lsCmd() en endf " - 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), ":.")') +fu! ctrlp#buffers(...) + let ids = sort(filter(range(1, bufnr('$')), 'empty(getbufvar(v:val, "&bt"))' + \ .' && getbufvar(v:val, "&bl") && strlen(bufname(v:val))'), 's:compmreb') + retu a:0 && a:1 == 'id' ? ids : map(ids, 'fnamemodify(bufname(v:val), ":.")') endf " * MatchedItems() {{{1 -fu! s:MatchIt(items, pat, limit, mfunc, ipt, exc) - let [newitems, id] = [[], 0] +fu! s:MatchIt(items, pat, limit, exc) + let [lines, id] = [[], 0] + let pat = s:byfname ? split(a:pat, '^[^;]\+\zs;', 1) : a:pat for item in a:items let id += 1 - try | if !( a:ipt && item == a:exc ) && call(a:mfunc, [item, a:pat]) >= 0 - cal add(newitems, item) + try | if !( s:ispath && item == a:exc ) && call(s:mfunc, [item, pat]) >= 0 + cal add(lines, item) en | cat | brea | endt - if a:limit > 0 && len(newitems) >= a:limit | brea | en + if a:limit > 0 && len(lines) >= a:limit | brea | en endfo let s:mdata = [s:dyncwd, s:itemtype, s:regexp, s:sublist(a:items, id, -1)] - retu newitems + retu lines endf -fu! s:MatchedItems(items, str, 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 +fu! s:MatchedItems(items, pat, limit) let exc = exists('s:crfilerel') ? s:crfilerel : '' - let matfunc = 's:MatchIt' let items = s:narrowable() ? s:matched + s:mdata[3] : a:items - let argms = [items, a:pat, a:limit, mfunc, a:ipt, exc] - if s:matcher != {} && has_key(s:matcher, 'match') - let [matfunc, argms[1], argms[3]] = s:matargs(mfunc, a:str) - let argms += [s:regexp] + if s:matcher != {} + let argms = [items, a:pat, a:limit, s:mmode(), s:ispath, exc, s:regexp] + let lines = call(s:matcher['match'], argms) + el + let lines = s:MatchIt(items, a:pat, a:limit, exc) en - let newitems = call(matfunc, argms) - let s:matches = len(newitems) - retu newitems + let s:matches = len(lines) + retu lines endf fu! s:SplitPattern(str) @@ -358,7 +413,7 @@ fu! s:SplitPattern(str) let str = s:migemo(str) en let s:savestr = str - if s:regexp || match(str, '\\\(<\|>\)\|[*|]') >= 0 + if s:regexp let pat = s:regexfilter(str) el let lst = split(str, '\zs') @@ -372,17 +427,22 @@ fu! s:SplitPattern(str) if exists('lst') let pat = '' if !empty(lst) - let pat = lst[0] - for item in range(1, len(lst) - 1) - let pat .= '[^'.lst[item - 1].']\{-}'.lst[item] - endfo + if s:byfname && index(lst, ';') > 0 + let fbar = index(lst, ';') + let lst_1 = s:sublist(lst, 0, fbar - 1) + let lst_2 = len(lst) - 1 > fbar ? s:sublist(lst, fbar + 1, -1) : [''] + let pat = s:buildpat(lst_1).';'.s:buildpat(lst_2) + el + let pat = s:buildpat(lst) + en en en retu escape(pat, '~') endf " * BuildPrompt() {{{1 -fu! s:Render(lines, pat, ipt) +fu! s:Render(lines, pat) let [&ma, lines, s:height] = [1, a:lines, min([len(a:lines), s:winh])] + let pat = s:byfname ? split(a:pat, '^[^;]\+\zs;', 1)[0] : a:pat " Setup the match window sil! exe '%d _ | res' s:height " Print the new items @@ -394,27 +454,27 @@ fu! s:Render(lines, pat, ipt) if s:dohighlight() | cal clearmatches() | en retu en + let s:matched = copy(lines) " Sorting - if s:dosort() - let s:compat = a:pat + if !s:nosort() + let s:compat = pat cal sort(lines, 's:mixedsort') unl s:compat en - let s:matched = copy(lines) if s:mwreverse | cal reverse(lines) | en let s:lines = copy(lines) - cal map(lines, 's:formatline(v:val, a:ipt)') + cal map(lines, 's:formatline(v:val)') cal setline(1, lines) setl noma cul exe 'keepj norm!' ( s:mwreverse ? 'G' : 'gg' ).'1|' cal s:unmarksigns() cal s:remarksigns() - if exists('s:cline') && !exists('g:ctrlp_nolimit') + if exists('s:cline') && s:nolim != 1 cal cursor(s:cline, 1) en " Highlighting if s:dohighlight() - cal s:highlight(a:pat, s:mathi[1], a:ipt) + cal s:highlight(pat, s:mathi[1]) en endf @@ -425,10 +485,10 @@ fu! s:Update(str) let str = s:sanstail(a:str) " Stop if the string's unchanged 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, str, pat, s:winh, ipt) - cal s:Render(lines, pat, ipt) + let pat = s:matcher == {} ? s:SplitPattern(str) : str + let lines = s:nolim == 1 && empty(str) ? copy(g:ctrlp_lines) + \ : s:MatchedItems(g:ctrlp_lines, pat, s:winh) + cal s:Render(lines, pat) endf fu! s:ForceUpdate() @@ -444,7 +504,7 @@ fu! s:BuildPrompt(upd, ...) let str = join(prt, '') let lazy = empty(str) || exists('s:force') || !has('autocmd') ? 0 : s:lazy if a:upd && !lazy && ( s:matches || s:regexp - \ || match(str, '\(\\\(<\|>\)\|[*|]\)\|\(\\\:\([^:]\|\\:\)*$\)') >= 0 ) + \ || str =~ '\(\\\(<\|>\)\|[*|]\)\|\(\\\:\([^:]\|\\:\)*$\)' ) sil! cal s:Update(str) en sil! cal ctrlp#statusline() @@ -466,12 +526,14 @@ fu! s:BuildPrompt(upd, ...) endf " - SetDefTxt() {{{1 fu! s:SetDefTxt() - if s:deftxt == '0' || s:pathmode == 1 | retu | en + if s:deftxt == '0' || !s:ispath | retu | en let txt = s:deftxt if !type(txt) let txt = txt && !stridx(s:crfpath, s:dyncwd) \ ? ctrlp#rmbasedir([s:crfpath])[0] : '' let txt = txt != '' ? txt.s:lash(s:crfpath) : '' + el + let txt = expand(txt, 1) en let s:prompt[0] = txt endf @@ -508,37 +570,53 @@ endf fu! s:PrtDeleteWord() unl! s:hstgot let [str, s:matches] = [s:prompt[0], 1] - let str = match(str, '\W\w\+$') >= 0 ? matchstr(str, '^.\+\W\ze\w\+$') - \ : match(str, '\w\W\+$') >= 0 ? matchstr(str, '^.\+\w\ze\W\+$') - \ : match(str, '\s\+$') >= 0 ? matchstr(str, '^.*[^ \t]\+\ze\s\+$') - \ : match(str, ' ') <= 0 ? '' : str + let str = str =~ '\W\w\+$' ? matchstr(str, '^.\+\W\ze\w\+$') + \ : str =~ '\w\W\+$' ? matchstr(str, '^.\+\w\ze\W\+$') + \ : str =~ '\s\+$' ? matchstr(str, '^.*\S\ze\s\+$') + \ : str =~ '\v^(\S+|\s+)$' ? '' : str let s:prompt[0] = str cal s:BuildPrompt(1) endf -fu! s:PrtInsert(type) +fu! s:PrtInsert(...) + let type = !a:0 ? '' : a:1 + if !a:0 + let type = s:insertstr() + if type == 'cancel' | retu | en + en + if type ==# 'r' + let regcont = s:getregs() + if regcont < 0 | retu | en + en unl! s:hstgot let s:act_add = 1 - let s:prompt[0] .= a:type == 'w' ? s:crword - \ : a:type == 's' ? getreg('/') - \ : a:type == 'v' ? s:crvisual - \ : a:type == '+' ? substitute(getreg('+'), '\n', '\\n', 'g') : s:prompt[0] + let s:prompt[0] .= type ==# 'w' ? s:crword + \ : type ==# 'f' ? s:crgfile + \ : type ==# 's' ? s:regisfilter('/') + \ : type ==# 'v' ? s:crvisual + \ : type ==# 'c' ? s:regisfilter('+') + \ : type ==# 'r' ? regcont : '' cal s:BuildPrompt(1) unl s:act_add endf fu! s:PrtExpandDir() - let prt = s:prompt - if prt[0] == '' | retu | en + let str = s:prompt[0] + if str =~ '\v^\@(cd|lc[hd]?|chd)\s.+' && s:spi + let hasat = split(str, '\v^\@(cd|lc[hd]?|chd)\s*\zs') + let str = get(hasat, 1, '') + en + if str == '' | retu | en unl! s:hstgot let s:act_add = 1 - let [base, seed] = s:headntail(prt[0]) + let [base, seed] = s:headntail(str) let dirs = s:dircompl(base, seed) if len(dirs) == 1 - let prt[0] = dirs[0] + let str = dirs[0] elsei len(dirs) > 1 - let prt[0] .= s:findcommon(dirs, prt[0]) + let str .= s:findcommon(dirs, str) en + let s:prompt[0] = exists('hasat') ? hasat[0].str : str cal s:BuildPrompt(1) unl s:act_add endf @@ -574,7 +652,7 @@ fu! s:PrtSelectMove(dir) let wht = winheight(0) let dirs = {'t': 'gg','b': 'G','j': 'j','k': 'k','u': wht.'k','d': wht.'j'} exe 'keepj norm!' dirs[a:dir] - if !exists('g:ctrlp_nolimit') | let s:cline = line('.') | en + if s:nolim != 1 | let s:cline = line('.') | en if line('$') > winheight(0) | cal s:BuildPrompt(0, s:Focus()) | en endf @@ -597,13 +675,12 @@ fu! s:PrtSelectJump(char, ...) let [jmpln, s:jmpchr] = [npos == -1 ? pos : npos, [chr, npos]] en keepj exe jmpln + 1 - if !exists('g:ctrlp_nolimit') | let s:cline = line('.') | en + if s:nolim != 1 | let s:cline = line('.') | en if line('$') > winheight(0) | cal s:BuildPrompt(0, s:Focus()) | en en endf " Misc {{{2 fu! s:PrtClearCache() - if s:itemtype == 1 | retu | en if s:itemtype == 0 cal ctrlp#clr() elsei s:itemtype > 2 @@ -612,29 +689,30 @@ fu! s:PrtClearCache() if s:itemtype == 2 let g:ctrlp_lines = ctrlp#mrufiles#refresh() el - cal ctrlp#setlines(s:itemtype) + cal ctrlp#setlines() en let s:force = 1 cal s:BuildPrompt(1) unl s:force endf -fu! s:PrtDeleteMRU() - if s:itemtype != 2 | retu | en - let [s:force, tbrem] = [1, []] - if exists('s:marked') - let tbrem = values(s:marked) - cal s:unmarksigns() - unl s:marked +fu! s:PrtDeleteEnt() + if s:itemtype == 2 + cal s:PrtDeleteMRU() + elsei type(s:getextvar('wipe')) == 1 + cal s:delent(s:getextvar('wipe')) + en +endf + +fu! s:PrtDeleteMRU() + if s:itemtype == 2 + cal s:delent('ctrlp#mrufiles#remove') en - let g:ctrlp_lines = ctrlp#mrufiles#remove(tbrem) - cal s:BuildPrompt(1) - unl s:force endf fu! s:PrtExit() if !has('autocmd') | cal s:Close() | en - exe s:currwin.'winc w' + exe ( winnr('$') == 1 ? 'bw!' : 'winc p' ) endf fu! s:PrtHistory(...) @@ -675,8 +753,8 @@ endf fu! s:MapSpecs(...) " Correct arrow keys in terminal - if ( has('termresponse') && match(v:termresponse, "\") >= 0 ) - \ || &term =~? 'xterm\|\" ) + \ || &term =~? '\vxterm|','\B ','\C ','\D '] exe s:lcmap.' ['.each endfo @@ -708,22 +786,19 @@ fu! s:ToggleRegex() endf fu! s:ToggleByFname() - if s:ispathitem() + if s:ispath let s:byfname = s:byfname ? 0 : 1 + let s:mfunc = s:mfunc() cal s:MapKeys(s:Focus(), 1) cal s:PrtSwitcher() en endf fu! s:ToggleType(dir) - let ext = exists('g:ctrlp_ext_vars') ? len(g:ctrlp_ext_vars) : 0 - let s:itemtype = s:walker(2 + ext, s:itemtype, a:dir) - if s:byfname && !s:ispathitem() | let s:byfname = 0 | en - unl! g:ctrlp_nolimit - if has('syntax') && exists('g:syntax_on') - cal ctrlp#syntax() - en - cal ctrlp#setlines(s:itemtype) + let max = len(g:ctrlp_ext_vars) + 2 + let next = s:walker(max, s:itemtype, a:dir) + cal ctrlp#syntax() + cal ctrlp#setlines(next) cal s:PrtSwitcher() endf @@ -742,14 +817,15 @@ fu! s:SetWD(...) let pathmode = a:1 en | en if a:0 < 2 - if match(s:crfile, '^\<.\+\>://.*') >= 0 || !pathmode | retu | en + if s:crfile =~ '^.\+://' || !pathmode | retu | en if exists('+acd') | let [s:glb_acd, &acd] = [&acd, 0] | en cal ctrlp#setdir(s:crfpath) en if pathmode == 1 | retu | en - let markers = ['root.dir', '.git/', '.hg/', '.svn/', '.bzr/', '_darcs/'] + let markers = ['.git', '.hg', '.svn', '.bzr', '_darcs'] if type(s:rmarkers) == 3 && !empty(s:rmarkers) cal extend(markers, s:rmarkers, 0) + let markers = reverse(filter(reverse(markers), 'count(markers, v:val) == 1')) en for marker in markers cal s:findroot(s:dyncwd, marker, 0, 0) @@ -777,38 +853,37 @@ fu! ctrlp#acceptfile(mode, line, ...) if j2l | cal ctrlp#j2l(j2l) | en el " Determine the command to use - let useb = bufnr > 0 && getbufvar(bufnr, '&bl') && empty(tail) + let useb = bufnr > 0 && buflisted(bufnr) && empty(tail) let cmd = \ md == 't' || s:splitwin == 1 ? ( useb ? 'tab sb' : 'tabe' ) : \ md == 'h' || s:splitwin == 2 ? ( useb ? 'sb' : 'new' ) : \ md == 'v' || s:splitwin == 3 ? ( useb ? 'vert sb' : 'vne' ) : \ call('ctrlp#normcmd', useb ? ['b', 'bo vert sb'] : ['e']) " Reset &switchbuf option - if useb - let [swb, &swb] = [&swb, ''] - en + let [swb, &swb] = [&swb, ''] " Open new window/buffer let args = [cmd, useb ? bufnr : filpath, a:0 ? ' +'.a:1 : tail, useb, j2l] cal call('s:openfile', args) - if useb - let &swb = swb - en + let &swb = swb en endf fu! s:SpecInputs(str) - let [str, type] = [a:str, s:type()] - if str == '..' && type =~ '\v^(0|dir)$' - cal s:parentdir(getcwd()) - cal ctrlp#setlines(s:itemtype) + if a:str =~ '\v^(\.\.([\/]\.\.)*[\/]?[.\/]*)$' && s:spi + let cwd = s:dyncwd + cal ctrlp#setdir(a:str =~ '^\.\.\.*$' ? + \ '../'.repeat('../', strlen(a:str) - 2) : a:str) + if cwd != s:dyncwd | cal ctrlp#setlines() | en cal s:PrtClear() retu 1 - elsei str =~ '^[\/]$' && type =~ '\v^(0|dir)$' + elsei a:str == s:lash && s:spi cal s:SetWD(2, 0) - cal ctrlp#setlines(s:itemtype) + cal ctrlp#setlines() cal s:PrtClear() retu 1 - elsei str == '?' + elsei a:str =~ '^@.\+' && s:spi + retu s:at(a:str) + elsei a:str == '?' cal s:PrtExit() let hlpwin = &columns > 159 ? '| vert res 80' : '' sil! exe 'bo vert h ctrlp-mappings' hlpwin '| norm! 0' @@ -818,18 +893,18 @@ fu! s:SpecInputs(str) endf fu! s:AcceptSelection(mode) + if a:mode != 'e' && s:OpenMulti(a:mode) != -1 | retu | en let str = join(s:prompt, '') if a:mode == 'e' | if s:SpecInputs(str) | retu | en | en " Get the selected line let line = !empty(s:lines) ? s:lines[line('.') - 1] : '' - if a:mode != 'e' && s:itemtype < 3 && line == '' - \ && str !~ '\v^(\.\.|/|\\|\?)$' + if a:mode != 'e' && !s:itemtype && line == '' + \ && str !~ '\v^(\.\.([\/]\.\.)*[\/]?[.\/]*|/|\\|\?|\@.+)$' cal s:CreateNewFile(a:mode) | retu en if empty(line) | retu | en " Do something with it - let actfunc = s:itemtype < 3 ? 'ctrlp#acceptfile' - \ : g:ctrlp_ext_vars[s:itemtype - 3]['accept'] + let actfunc = s:itemtype < 3 ? 'ctrlp#acceptfile' : s:getextvar('accept') cal call(actfunc, [a:mode, line]) endf " - CreateNewFile() {{{1 @@ -855,7 +930,7 @@ fu! s:CreateNewFile(...) en if !exists('optyp') | retu | en let [filpath, tail] = [fnamemodify(optyp, ':p'), s:tail()] - if !stridx(filpath, getcwd()) | cal s:insertcache(str) | en + if !stridx(filpath, s:dyncwd) | 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' : @@ -866,17 +941,18 @@ fu! s:CreateNewFile(...) endf " * OpenMulti() {{{1 fu! s:MarkToOpen() - if s:bufnr <= 0 || s:opmul == '0' || ( s:itemtype > 2 && s:type() !~ 'rts' ) + if s:bufnr <= 0 || s:opmul == '0' + \ || ( s:itemtype > 2 && s:getextvar('opmul') != 1 ) retu en let line = !empty(s:lines) ? s:lines[line('.') - 1] : '' if empty(line) | retu | en - let filpath = fnamemodify(line, ':p') + let filpath = s:ispath ? fnamemodify(line, ':p') : line 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) cal remove(s:marked, key) - if empty(s:marked) | unl! s:marked | en + if empty(s:marked) | unl s:marked | en if has('signs') exe 'sign unplace' key 'buffer='.s:bufnr en @@ -896,25 +972,38 @@ fu! s:MarkToOpen() sil! cal ctrlp#statusline() endf -fu! s:OpenMulti() - if !exists('s:marked') || s:opmul == '0' | retu | en +fu! s:OpenMulti(...) + if !exists('s:marked') || s:opmul == '0' || !s:ispath | retu -1 | en " Get the options - let [nr, md, ucr] = matchlist(s:opmul, '\v^(\d+)=(\w)=(\w)=$')[1:3] - if s:argmap - let md = s:argmaps(md) - if md == 'cancel' | retu | en + let [nr, md] = [matchstr(s:opmul, '\d\+'), matchstr(s:opmul, '[thvi]')] + let [ur, jf] = [matchstr(s:opmul, 'r') == 'r', matchstr(s:opmul, 'j') == 'j'] + let md = a:0 ? a:1 : ( md == '' ? 'v' : md ) + let nopt = exists('g:ctrlp_open_multiple_files') + if s:argmap && !a:0 + let md = s:argmaps(md, 0) + if md == 'c' + cal s:unmarksigns() + unl! s:marked + cal s:BuildPrompt(0) + en + if md =~ '\v^c(ancel)?$' | retu | en + let nr = nr == '0' ? ( nopt ? '' : '1' ) : nr en let mkd = values(s:marked) cal s:sanstail(join(s:prompt, '')) cal s:PrtExit() - " Move the cursor to a reusable window + if nr == '0' || md == 'i' + retu map(mkd, "s:openfile('bad', fnamemodify(v:val, ':.'), '')") + en let [tail, fnesc] = [s:tail(), exists('*fnameescape') && v:version > 701] - let [emptytail, nwpt] = [empty(tail), exists('g:ctrlp_open_multiple_files')] - let bufnr = bufnr('^'.mkd[0].'$') - let useb = bufnr > 0 && getbufvar(bufnr, '&bl') && emptytail - let fst = call('ctrlp#normcmd', useb ? ['b', 'bo vert sb'] : ['e']) - " Check if it's a replaceable buffer - let repabl = ( empty(bufname('%')) && empty(&l:ft) ) || s:nosplit() + let [emptytail, bufnr] = [empty(tail), bufnr('^'.mkd[0].'$')] + let useb = bufnr > 0 && buflisted(bufnr) && emptytail + " Move to a replaceable window + let ncmd = ( useb ? ['b', 'bo vert sb'] : ['e', 'bo vne'] ) + \ + ( ur ? [] : ['ignruw'] ) + let fst = call('ctrlp#normcmd', ncmd) + " Check if the current window has a replaceable buffer + let repabl = empty(bufname('%')) && empty(&l:ft) " Commands for the rest of the files let [ic, cmds] = [1, { 'v': ['vert sb', 'vne'], 'h': ['sb', 'new'], \ 't': ['tab sb', 'tabe'] }] @@ -922,13 +1011,14 @@ fu! s:OpenMulti() " Open the files for va in mkd let bufnr = bufnr('^'.va.'$') - let useb = bufnr > 0 && getbufvar(bufnr, '&bl') && emptytail + if bufnr < 0 && getftype(va) == '' | con | en + let useb = bufnr > 0 && buflisted(bufnr) && emptytail 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 cmd = ic == 1 && ( !( !ur && fst =~ '^[eb]$' ) || repabl ) ? fst : snd let conds = [( nr != '' && nr > 1 && nr < ic ) || ( nr == '' && ic > 1 ), \ nr != '' && nr < ic] - if conds[nwpt] + if conds[nopt] if bufnr <= 0 | if fnesc cal s:openfile('bad', fnamemodify(va, ':.'), '') el @@ -936,45 +1026,56 @@ fu! s:OpenMulti() en | en el cal s:openfile(cmd, useb ? bufnr : va, tail) | let ic += 1 + if jf | if ic == 2 + let crpos = [tabpagenr(), winnr()] + el + let crpos[0] += tabpagenr() == crpos[0] + let crpos[1] += winnr() == crpos[1] + en | en en endfo + if jf && exists('crpos') && ic > 2 + exe ( md == 't' ? 'tabn '.crpos[0] : crpos[1].'winc w' ) + en let &swb = swb endf " ** Helper functions {{{1 " Sorting {{{2 -fu! ctrlp#complen(s1, s2) +fu! ctrlp#complen(...) " By length - let [len1, len2] = [strlen(a:s1), strlen(a:s2)] + let [len1, len2] = [strlen(a:1), strlen(a:2)] retu len1 == len2 ? 0 : len1 > len2 ? 1 : -1 endf -fu! s:compmatlen(s1, s2) +fu! s:compmatlen(...) " By match length - let mln1 = s:shortest(s:matchlens(a:s1, s:compat)) - let mln2 = s:shortest(s:matchlens(a:s2, s:compat)) + let mln1 = s:shortest(s:matchlens(a:1, s:compat)) + let mln2 = s:shortest(s:matchlens(a:2, s:compat)) retu mln1 == mln2 ? 0 : mln1 > mln2 ? 1 : -1 endf -fu! s:comptime(s1, s2) +fu! s:comptime(...) " By last modified time - let [time1, time2] = [getftime(a:s1), getftime(a:s2)] + let [time1, time2] = [getftime(a:1), getftime(a:2)] retu time1 == time2 ? 0 : time1 < time2 ? 1 : -1 endf -fu! s:compmre(...) - " By last entered time (buffer only) - if !exists('s:mrbs') - let s:mrbs = ctrlp#mrufiles#bufs() - en - let cwd = getcwd() - retu index(s:mrbs, cwd.s:lash().a:1) - index(s:mrbs, cwd.s:lash().a:2) +fu! s:compmreb(...) + " By last entered time (bufnr) + let [id1, id2] = [index(s:mrbs, a:1), index(s:mrbs, a:2)] + retu id1 == id2 ? 0 : id1 > id2 ? 1 : -1 endf -fu! s:comparent(s1, s2) +fu! s:compmref(...) + " By last entered time (MRU) + let [id1, id2] = [index(g:ctrlp_lines, a:1), index(g:ctrlp_lines, a:2)] + retu id1 == id2 ? 0 : id1 > id2 ? 1 : -1 +endf + +fu! s:comparent(...) " By same parent dir - let cwd = getcwd() - if match(s:crfpath, escape(cwd, '.^$*\')) >= 0 - let [as1, as2] = [cwd.s:lash().a:s1, cwd.s:lash().a:s2] + if !stridx(s:crfpath, s:dyncwd) + let [as1, as2] = [s:dyncwd.s:lash().a:1, s:dyncwd.s:lash().a:2] let [loc1, loc2] = [s:getparent(as1), s:getparent(as2)] if loc1 == s:crfpath && loc2 != s:crfpath | retu -1 | en if loc2 == s:crfpath && loc1 != s:crfpath | retu 1 | en @@ -983,10 +1084,10 @@ fu! s:comparent(s1, s2) retu 0 endf -fu! s:compfnlen(s1, s2) +fu! s:compfnlen(...) " By filename length - let len1 = strlen(split(a:s1, s:lash)[-1]) - let len2 = strlen(split(a:s2, s:lash)[-1]) + let len1 = strlen(split(a:1, s:lash)[-1]) + let len2 = strlen(split(a:2, s:lash)[-1]) retu len1 == len2 ? 0 : len1 > len2 ? 1 : -1 endf @@ -1008,20 +1109,32 @@ fu! s:shortest(lens) retu min(map(values(a:lens), 'v:val[0]')) 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, cfn] = [s:comparent(a:s1, a:s2), s:compfnlen(a:s1, a:s2)] +fu! s:mixedsort(...) + let [cln, cml] = [ctrlp#complen(a:1, a:2), s:compmatlen(a:1, a:2)] + if s:ispath + let ms = [] if s:height < 21 - let [muls, ctm] = s:itemtype == 1 - \ ? [[6, 3, 2, 12], s:compmre(a:s1, a:s2)] - \ : [[12, 6, 3, 2], s:comptime(a:s1, a:s2)] - unl! s:mrbs - retu muls[0] * cml + muls[1] * par + muls[2] * cfn + muls[3] * ctm + cln + let ms += [s:compfnlen(a:1, a:2)] + if s:itemtype !~ '^[12]$' | let ms += [s:comptime(a:1, a:2)] | en + if !s:itemtype | let ms += [s:comparent(a:1, a:2)] | en en - retu 6 * cml + 3 * par + 2 * cfn + cln + if s:itemtype =~ '^[12]$' + let ms += [s:compmref(a:1, a:2)] + let cln = cml ? cln : 0 + en + let ms += [cml, 0, 0, 0] + let mp = call('s:multipliers', ms[:3]) + retu cln + ms[0] * mp[0] + ms[1] * mp[1] + ms[2] * mp[2] + ms[3] * mp[3] en - retu 2 * cml + cln + retu cln + cml * 2 +endf + +fu! s:multipliers(...) + let mp0 = !a:1 ? 0 : 2 + let mp1 = !a:2 ? 0 : 1 + ( !mp0 ? 1 : mp0 ) + let mp2 = !a:3 ? 0 : 1 + ( !( mp0 + mp1 ) ? 1 : ( mp0 + mp1 ) ) + let mp3 = !a:4 ? 0 : 1 + ( !( mp0 + mp1 + mp2 ) ? 1 : ( mp0 + mp1 + mp2 ) ) + retu [mp0, mp1, mp2, mp3] endf fu! s:compval(...) @@ -1035,7 +1148,7 @@ fu! ctrlp#statusline() \ ['buffers', 'buf'], \ ['mru files', 'mru'], \ ] - if exists('g:ctrlp_ext_vars') + if !empty(g:ctrlp_ext_vars) cal map(copy(g:ctrlp_ext_vars), \ 'add(s:statypes, [ v:val["lname"], v:val["sname"] ])') en @@ -1049,7 +1162,7 @@ fu! ctrlp#statusline() let byfname = s:byfname ? 'file' : 'path' let marked = s:opmul != '0' ? \ exists('s:marked') ? ' <'.s:dismrk().'>' : ' <->' : '' - if s:status != {} && has_key(s:status, 'main') + if s:status != {} let args = [focus, byfname, s:regexp, prv, item, nxt, marked] let &l:stl = call(s:status['main'], args) el @@ -1058,7 +1171,7 @@ fu! ctrlp#statusline() let byfname = '%#CtrlPMode1# '.byfname.' %*' let regex = s:regexp ? '%#CtrlPMode2# regex %*' : '' let slider = ' <'.prv.'>={'.item.'}=<'.nxt.'>' - let dir = ' %=%<%#CtrlPMode2# '.getcwd().' %*' + let dir = ' %=%<%#CtrlPMode2# '.s:dyncwd.' %*' let &l:stl = focus.byfname.regex.slider.marked.dir en endf @@ -1068,25 +1181,30 @@ fu! s:dismrk() \ '%<'.join(values(map(copy(s:marked), 'split(v:val, "[\\/]")[-1]')), ', ') endf -fu! ctrlp#progress(enum) +fu! ctrlp#progress(enum, ...) if has('macunix') || has('mac') | sl 1m | en - let &l:stl = s:status != {} && has_key(s:status, 'prog') - \ ? call(s:status['prog'], [a:enum]) - \ : '%#CtrlPStats# '.a:enum.' %* %=%<%#CtrlPMode2# '.getcwd().' %*' + let txt = a:0 ? '(press ctrl-c to abort)' : '' + let &l:stl = s:status != {} ? call(s:status['prog'], [a:enum]) + \ : '%#CtrlPStats# '.a:enum.' %* '.txt.'%=%<%#CtrlPMode2# '.s:dyncwd.' %*' 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 ) +fu! s:formatline(str) + let cond = s:ispath && ( s:winw - 4 ) < s:strwidth(a:str) + retu '> '.( cond ? s:pathshorten(a:str) : a:str ) +endf + +fu! s:pathshorten(str) + retu matchstr(a:str, '^.\{9}').'...' + \ .matchstr(a:str, '.\{'.( s:winw - 16 ).'}$') 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] + let [be, sd] = a:be == '' ? [s:dyncwd, a:sd] : [a:be, a:be.s:lash(a:be).a:sd] let dirs = ctrlp#rmbasedir(split(globpath(be, a:sd.'*/'), "\n")) cal filter(dirs, '!match(v:val, escape(sd, ''~$.\''))' - \ . ' && match(v:val, ''\v(^|[\/])\.{1,2}[\/]$'') < 0') + \ . ' && v:val !~ ''\v(^|[\/])\.{1,2}[\/]$''') retu dirs endf @@ -1110,21 +1228,20 @@ fu! s:headntail(str) endf fu! s:lash(...) - retu match(a:0 ? a:1 : getcwd(), '[\/]$') < 0 ? s:lash : '' + retu ( a:0 ? a:1 : s:dyncwd ) !~ '[\/]$' ? s:lash : '' endf fu! s:ispathitem() - retu s:itemtype < 3 || - \ ( s:itemtype > 2 && g:ctrlp_ext_vars[s:itemtype - 3]['type'] == 'path' ) + retu s:itemtype < 3 || ( s:itemtype > 2 && s:getextvar('type') == 'path' ) endf fu! ctrlp#dirnfile(entries) - let [items, cwd] = [[[], []], getcwd().s:lash()] + let [items, cwd] = [[[], []], s:dyncwd.s:lash()] for each in a:entries let etype = getftype(each) if s:igntype >= 0 && s:usrign(each, etype) | con | en if etype == 'dir' - if s:dotfiles | if match(each, '[\/]\.\{1,2}$') < 0 + if s:dotfiles | if each !~ '[\/]\.\{1,2}$' cal add(items[0], each) en | el cal add(items[0], each) @@ -1132,7 +1249,7 @@ fu! ctrlp#dirnfile(entries) elsei etype == 'link' if s:folsym let isfile = !isdirectory(each) - if !s:samerootsyml(each, isfile, cwd) + if s:folsym == 2 || !s:samerootsyml(each, isfile, cwd) cal add(items[isfile], each) en en @@ -1156,22 +1273,16 @@ fu! s:samerootsyml(each, isfile, cwd) endf fu! ctrlp#rmbasedir(items) - let cwd = getcwd() - if a:items != [] && !stridx(a:items[0], cwd) - let idx = strlen(cwd) + ( match(cwd, '[\/]$') < 0 ) + if a:items != [] && !stridx(a:items[0], s:dyncwd) + let idx = strlen(s:dyncwd) + ( s:dyncwd !~ '[\/]$' ) retu map(a:items, 'strpart(v:val, idx)') en retu a:items endf -fu! s:parentdir(curr) - let parent = s:getparent(a:curr) - if parent != a:curr | cal ctrlp#setdir(parent) | en -endf - fu! s:getparent(item) let parent = substitute(a:item, '[\/][^\/]\+[\/:]\?$', '', '') - if parent == '' || match(parent, '[\/]') < 0 + if parent == '' || parent !~ '[\/]' let parent .= s:lash en retu parent @@ -1214,9 +1325,8 @@ fu! ctrlp#setlcdir() endf " Highlighting {{{2 fu! ctrlp#syntax() - for [ke, va] in items(s:hlgrps) | if !hlexists('CtrlP'.ke) - exe 'hi link CtrlP'.ke va - en | endfo + if ctrlp#nosy() | retu | en + for [ke, va] in items(s:hlgrps) | cal ctrlp#hicheck('CtrlP'.ke, va) | endfo if !hlexists('CtrlPLinePre') \ && synIDattr(synIDtrans(hlID('Normal')), 'bg') !~ '^-1$\|^$' sil! exe 'hi CtrlPLinePre '.( has("gui_running") ? 'gui' : 'cterm' ).'fg=bg' @@ -1227,25 +1337,22 @@ fu! ctrlp#syntax() en endf -fu! s:highlight(pat, grp, ipt) +fu! s:highlight(pat, grp) if s:matcher != {} | retu | en cal clearmatches() - if !empty(a:pat) && a:ipt + if !empty(a:pat) && s:ispath let pat = s:regexp ? substitute(a:pat, '\\\@ \\zs', 'g') : a:pat if s:byfname - " Match only filename let pat = substitute(pat, '\[\^\(.\{-}\)\]\\{-}', '[^\\/\1]\\{-}', 'g') let pat = substitute(pat, '\$\@') - en + cal matchadd('CtrlPLinePre', '^>') en endf fu! s:dohighlight() - retu s:mathi[0] && exists('*clearmatches') + retu s:mathi[0] && exists('*clearmatches') && !ctrlp#nosy() endf " Prompt history {{{2 fu! s:gethistloc() @@ -1278,7 +1385,8 @@ endf fu! s:remarksigns() if !s:dosigns() | retu | en for ic in range(1, len(s:lines)) - let key = s:dictindex(s:marked, fnamemodify(s:lines[ic - 1], ':p')) + let line = s:ispath ? fnamemodify(s:lines[ic - 1], ':p') : s:lines[ic - 1] + let key = s:dictindex(s:marked, line) if key > 0 exe 'sign place' key 'line='.ic.' name=ctrlpmark buffer='.s:bufnr en @@ -1301,7 +1409,16 @@ fu! s:vacantdict(dict) endf fu! s:sublist(l, s, e) - retu v:version > 701 ? a:l[(a:s):(a:e)] : remove(copy(a:l), a:s, a:e) + retu v:version > 701 ? a:l[(a:s):(a:e)] : s:sublist7071(a:l, a:s, a:e) +endf + +fu! s:sublist7071(l, s, e) + let [newlist, id, ae] = [[], a:s, a:e == -1 ? len(a:l) - 1 : a:e] + wh id <= ae + cal add(newlist, get(a:l, id)) + let id += 1 + endw + retu newlist endf " Buffers {{{2 fu! s:buftab(bufnr, md) @@ -1318,7 +1435,7 @@ fu! s:buftab(bufnr, md) endf fu! ctrlp#normcmd(cmd, ...) - if s:nosplit() | retu a:cmd | en + if a:0 < 2 && s:nosplit() | retu a:cmd | en let norwins = filter(range(1, winnr('$')), \ 'empty(getbufvar(winbufnr(v:val), "&bt"))') for each in norwins @@ -1342,7 +1459,7 @@ fu! s:nosplit() endf fu! s:setupblank() - setl noswf nobl nonu nowrap nolist nospell nocuc wfh + setl noswf nonu nobl nowrap nolist nospell nocuc wfh setl fdc=0 fdl=99 tw=0 bt=nofile bh=unload if v:version > 702 setl nornu noudf cc=0 @@ -1350,54 +1467,126 @@ fu! s:setupblank() endf fu! s:leavepre() - if s:clrex && !( has('clientserver') && len(split(serverlist(), "\n")) > 1 ) + if exists('s:bufnr') && s:bufnr == bufnr('%') | bw! | en + if !( exists('g:ctrlp_clear_cache_on_exit') && !g:ctrlp_clear_cache_on_exit ) + \ && !( has('clientserver') && len(split(serverlist(), "\n")) > 1 ) cal ctrlp#clra() en endf fu! s:checkbuf() - if exists('s:init') | retu | en - if exists('s:bufnr') && s:bufnr > 0 + if !exists('s:init') && exists('s:bufnr') && s:bufnr > 0 exe s:bufnr.'bw!' en endf + +fu! s:iscmdwin() + let ermsg = v:errmsg + sil! noa winc p + sil! noa winc p + let [v:errmsg, ermsg] = [ermsg, v:errmsg] + retu ermsg =~ '^E11:' +endf " Arguments {{{2 +fu! s:at(str) + if a:str =~ '\v^\@(cd|lc[hd]?|chd).*' + let str = substitute(a:str, '\v^\@(cd|lc[hd]?|chd)\s*', '', '') + if str == '' | retu 1 | en + let str = str =~ '^%:.\+' ? fnamemodify(s:crfile, str[1:]) : str + let path = fnamemodify(expand(str, 1), ':p') + if isdirectory(path) + if path != s:dyncwd + cal ctrlp#setdir(path) + cal ctrlp#setlines() + en + cal ctrlp#recordhist() + cal s:PrtClear() + en + retu 1 + en + retu 0 +endf + fu! s:tail() if exists('s:optail') && !empty('s:optail') - let tailpref = match(s:optail, '^\s*+') < 0 ? ' +' : ' ' + let tailpref = s:optail !~ '^\s*+' ? ' +' : ' ' retu tailpref.s:optail en retu '' endf fu! s:sanstail(str) - let [str, pat] = [substitute(a:str, '\\\\', '\', 'g'), '\([^:]\|\\:\)*$'] + let str = s:spi ? + \ substitute(a:str, '^\(@.*$\|\\\\\ze@\|\.\.\zs[.\/]\+$\)', '', 'g') : a:str + let [str, pat] = [substitute(str, '\\\\', '\', 'g'), '\([^:]\|\\:\)*$'] unl! s:optail - if match(str, '\\\@= 0 + if str =~ '\\\@= 0 +fu! s:argmaps(md, i) + let roh = [ + \ ['OpenMulti', '/h[i]dden/[c]lear', ['i', 'c']], + \ ['CreateNewFile', '/[r]eplace', ['r']], + \ ] + let str = roh[a:i][0].': [t]ab/[v]ertical/[h]orizontal'.roh[a:i][1].'? ' + retu s:choices(str, ['t', 'v', 'h'] + roh[a:i][2], 's:argmaps', [a:md, a:i]) +endf + +fu! s:insertstr() + let str = 'Insert: c[w]ord/c[f]ile/[s]earch/[v]isual/[c]lipboard/[r]egister? ' + retu s:choices(str, ['w', 'f', 's', 'v', 'c', 'r'], 's:insertstr', []) +endf + +fu! s:textdialog(str) + redr | echoh MoreMsg | echon a:str | echoh None + retu nr2char(getchar()) +endf + +fu! s:choices(str, choices, func, args) + let char = s:textdialog(a:str) + if index(a:choices, char) >= 0 retu char - elsei char =~# "\\v\|\|\" + elsei char =~# "\\v\|\|\|\|\|\" cal s:BuildPrompt(0) retu 'cancel' + elsei char =~# "\" && a:args != [] + retu a:args[0] en - retu a:md + retu call(a:func, a:args) +endf + +fu! s:getregs() + let char = s:textdialog('Insert from register: ') + if char =~# "\\v\|\|\|\|\|\" + cal s:BuildPrompt(0) + retu -1 + elsei char =~# "\" + retu s:getregs() + en + retu s:regisfilter(char) +endf + +fu! s:regisfilter(reg) + retu substitute(getreg(a:reg), "[\t\n]", ' ', 'g') endf " Misc {{{2 -fu! s:dosort() - retu s:matcher == {} && ( ( s:itemtype != 2 && !exists('g:ctrlp_nolimit') ) - \ || s:prompt != ['', '', ''] ) && s:getextvar('sort') +fu! s:modevar() + let s:matchtype = s:mtype() + let s:ispath = s:ispathitem() + if !s:ispath | let s:byfname = 0 | en + let s:mfunc = s:mfunc() + let s:nolim = s:getextvar('nolim') + let s:dosort = s:getextvar('sort') + let s:spi = !s:itemtype || s:getextvar('specinput') > 0 +endf + +fu! s:nosort() + retu s:matcher != {} || s:nolim == 1 || ( s:itemtype == 2 && s:mrudef ) + \ || ( s:itemtype =~ '\v^(1|2)$' && s:prompt == ['', '', ''] ) || !s:dosort endf fu! s:narrowable() @@ -1437,7 +1626,7 @@ endf fu! s:regexfilter(str) let str = a:str - for key in keys(s:fpats) | if match(str, key) >= 0 + for key in keys(s:fpats) | if str =~ key let str = substitute(str, s:fpats[key], '', 'g') en | endfo retu str @@ -1447,25 +1636,34 @@ fu! s:walker(m, p, d) retu a:d > 0 ? a:p < a:m ? a:p + a:d : 0 : a:p > 0 ? a:p + a:d : a:m endf -fu! s:matargs(mfunc, str) - let match_type = { - \ 'match': 'full-line', - \ 's:matchfname': 'filename-only', - \ 's:matchtabs': 'first-non-tab', - \ 's:matchtabe': 'until-last-tab', - \ } - retu [s:matcher['match'], a:str, match_type[a:mfunc]] +fu! s:delent(rfunc) + if a:rfunc == '' | retu | en + let [s:force, tbrem] = [1, []] + if exists('s:marked') + let tbrem = values(s:marked) + cal s:unmarksigns() + unl s:marked + en + if tbrem == [] && ( has('dialog_gui') || has('dialog_con') ) && + \ confirm("Wipe all entries?", "&OK\n&Cancel") != 1 + unl s:force + cal s:BuildPrompt(0) + retu + en + let g:ctrlp_lines = call(a:rfunc, [tbrem]) + cal s:BuildPrompt(1) + unl s:force endf " Entering & Exiting {{{2 fu! s:getenv() 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:crword, s:crline] = [expand('', 1), getline('.')] let [s:winh, s:crcursor] = [min([s:mxheight, &lines]), getpos('.')] let [s:crbufnr, s:crvisual] = [bufnr('%'), s:lastvisual()] - 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 + let [s:mrbs, s:crgfile] = [ctrlp#mrufiles#bufs(), expand('', 1)] endf fu! s:lastvisual() @@ -1473,7 +1671,7 @@ fu! s:lastvisual() let [ovreg, ovtype] = [getreg('v'), getregtype('v')] let [oureg, outype] = [getreg('"'), getregtype('"')] sil! norm! gv"vy - let selected = substitute(getreg('v'), '\n', '\\n', 'g') + let selected = s:regisfilter('v') cal setreg('v', ovreg, ovtype) cal setreg('"', oureg, outype) cal winrestview(cview) @@ -1489,6 +1687,14 @@ fu! s:log(m) en | en endf +fu! s:buffunc(e) + if a:e && has_key(s:buffunc, 'enter') + cal call(s:buffunc['enter'], []) + elsei !a:e && has_key(s:buffunc, 'exit') + cal call(s:buffunc['exit'], []) + en +endf + fu! s:openfile(cmd, fid, tail, ...) let cmd = a:cmd =~ '^[eb]$' && &modified ? 'hid '.a:cmd : a:cmd let cmd = cmd =~ '^tab' ? tabpagenr('$').cmd : cmd @@ -1504,9 +1710,18 @@ fu! s:openfile(cmd, fid, tail, ...) cal ctrlp#setlcdir() en endf -" Matchfuncs {{{2 + +fu! s:settype(type) + retu a:type < 0 ? exists('s:itemtype') ? s:itemtype : 0 : a:type +endf +" Matching {{{2 fu! s:matchfname(item, pat) - retu match(split(a:item, s:lash)[-1], a:pat) + let parts = split(a:item, '[\/]\ze[^\/]\+$') + let mfn = match(parts[-1], a:pat[0]) + retu len(a:pat) == 1 ? mfn : len(a:pat) == 2 ? + \ ( mfn >= 0 && ( len(parts) == 2 ? match(parts[0], a:pat[1]) : -1 ) >= 0 + \ ? 0 : -1 ) : -1 + en endf fu! s:matchtabs(item, pat) @@ -1516,12 +1731,44 @@ endf fu! s:matchtabe(item, pat) retu match(split(a:item, '\t\+[^\t]\+$')[0], a:pat) endf + +fu! s:buildpat(lst) + let pat = a:lst[0] + for item in range(1, len(a:lst) - 1) + let pat .= '[^'.a:lst[item - 1].']\{-}'.a:lst[item] + endfo + retu pat +endf + +fu! s:mfunc() + let mfunc = 'match' + if s:byfname && s:ispath + let mfunc = 's:matchfname' + elsei s:itemtype > 2 + let matchtypes = { 'tabs': 's:matchtabs', 'tabe': 's:matchtabe' } + if has_key(matchtypes, s:matchtype) + let mfunc = matchtypes[s:matchtype] + en + en + retu mfunc +endf + +fu! s:mmode() + let matchmodes = { + \ 'match': 'full-line', + \ 's:matchfname': 'filename-only', + \ 's:matchtabs': 'first-non-tab', + \ 's:matchtabe': 'until-last-tab', + \ } + retu matchmodes[s:mfunc] +endf " Cache {{{2 -fu! s:writecache(read_cache, cache_file) - if !a:read_cache && ( ( g:ctrlp_newcache || !filereadable(a:cache_file) ) - \ && s:caching || len(g:ctrlp_allfiles) > s:nocache_lim ) - if len(g:ctrlp_allfiles) > s:nocache_lim | let s:caching = 1 | en +fu! s:writecache(cache_file) + let fwrite = len(g:ctrlp_allfiles) > s:nocache_lim + if ( g:ctrlp_newcache || !filereadable(a:cache_file) ) && s:caching || fwrite + if fwrite | let s:caching = 1 | en cal ctrlp#utils#writecache(g:ctrlp_allfiles) + let g:ctrlp_newcache = 0 en endf @@ -1539,16 +1786,15 @@ fu! s:insertcache(str) endfo en cal insert(data, str, pos) - cal s:writecache(0, ctrlp#utils#cachefile()) + cal s:writecache(ctrlp#utils#cachefile()) endf " Extensions {{{2 -fu! s:type(...) - retu s:itemtype > 2 - \ ? g:ctrlp_ext_vars[s:itemtype - 3][a:0 ? 'type' : 'sname'] : s:itemtype +fu! s:mtype() + retu s:itemtype > 2 ? s:getextvar('type') : 'path' endf fu! s:execextvar(key) - if exists('g:ctrlp_ext_vars') + if !empty(g:ctrlp_ext_vars) cal map(filter(copy(g:ctrlp_ext_vars), \ 'has_key(v:val, a:key)'), 'eval(v:val[a:key])') en @@ -1573,39 +1819,56 @@ endf fu! ctrlp#switchtype(id) cal s:ToggleType(a:id - s:itemtype) endf + +fu! ctrlp#nosy() + retu !( has('syntax') && exists('g:syntax_on') ) +endf + +fu! ctrlp#hicheck(grp, defgrp) + if !hlexists(a:grp) + exe 'hi link' a:grp a:defgrp + en +endf + +fu! ctrlp#call(func, ...) + cal call(a:func, a:000) +endf "}}}1 " * Initialization {{{1 -fu! ctrlp#setlines(type) - let s:itemtype = a:type +fu! ctrlp#setlines(...) + if a:0 | let s:itemtype = a:1 | en + cal s:modevar() let types = ['ctrlp#files()', 'ctrlp#buffers()', 'ctrlp#mrufiles#list()'] - if exists('g:ctrlp_ext_vars') + if !empty(g:ctrlp_ext_vars) cal map(copy(g:ctrlp_ext_vars), 'add(types, v:val["init"])') en - let g:ctrlp_lines = eval(types[a:type]) + let g:ctrlp_lines = eval(types[s:itemtype]) endf fu! ctrlp#init(type, ...) - if exists('s:init') | retu | en + if exists('s:init') || s:iscmdwin() | retu | en let [s:matches, s:init] = [1, 1] - cal s:Open() + cal ctrlp#reset() + noa cal s:Open() cal s:SetWD(a:0 ? a:1 : '') - cal s:SetDefTxt() cal s:MapKeys() - if has('syntax') && exists('g:syntax_on') - cal ctrlp#syntax() - en - cal ctrlp#setlines(a:type) + cal ctrlp#syntax() + cal ctrlp#setlines(s:settype(a:type)) + cal s:SetDefTxt() cal s:BuildPrompt(1) endf " - Autocmds {{{1 -fu! s:autocmds() - if !has('autocmd') | retu | en +if has('autocmd') aug CtrlPAug au! au BufEnter ControlP cal s:checkbuf() - au BufLeave ControlP cal s:Close() + au BufLeave ControlP noa cal s:Close() au VimLeavePre * cal s:leavepre() aug END +en + +fu! s:autocmds() + if !has('autocmd') | retu | en if exists('#CtrlPLazy') au! CtrlPLazy en @@ -1616,8 +1879,6 @@ fu! s:autocmds() aug END en endf - -cal s:autocmds() "}}} " vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2 diff --git a/bundle/git_ctrlp/autoload/ctrlp/bookmarkdir.vim b/bundle/git_ctrlp/autoload/ctrlp/bookmarkdir.vim new file mode 100644 index 0000000..7d955b5 --- /dev/null +++ b/bundle/git_ctrlp/autoload/ctrlp/bookmarkdir.vim @@ -0,0 +1,140 @@ +" ============================================================================= +" File: autoload/ctrlp/bookmarkdir.vim +" Description: Bookmarked directories extension +" Author: Kien Nguyen +" ============================================================================= + +" Init {{{1 +if exists('g:loaded_ctrlp_bookmarkdir') && g:loaded_ctrlp_bookmarkdir + fini +en +let g:loaded_ctrlp_bookmarkdir = 1 + +cal add(g:ctrlp_ext_vars, { + \ 'init': 'ctrlp#bookmarkdir#init()', + \ 'accept': 'ctrlp#bookmarkdir#accept', + \ 'lname': 'bookmarked dirs', + \ 'sname': 'bkd', + \ 'type': 'tabs', + \ 'opmul': 1, + \ 'nolim': 1, + \ 'wipe': 'ctrlp#bookmarkdir#remove', + \ }) + +let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) +" Utilities {{{1 +fu! s:getinput(str, ...) + echoh Identifier + cal inputsave() + let input = call('input', a:0 ? [a:str] + a:000 : [a:str]) + cal inputrestore() + echoh None + retu input +endf + +fu! s:cachefile() + if !exists('s:cadir') || !exists('s:cafile') + let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'bkd' + let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt' + en + retu s:cafile +endf + +fu! s:writecache(lines) + cal ctrlp#utils#writecache(a:lines, s:cadir, s:cafile) +endf + +fu! s:getbookmarks() + retu ctrlp#utils#readfile(s:cachefile()) +endf + +fu! s:savebookmark(name, cwd) + let cwds = exists('+ssl') ? [tr(a:cwd, '\', '/'), tr(a:cwd, '/', '\')] : [a:cwd] + let entries = filter(s:getbookmarks(), 'index(cwds, s:parts(v:val)[1]) < 0') + cal s:writecache(insert(entries, a:name.' '.a:cwd)) +endf + +fu! s:setentries() + let time = getftime(s:cachefile()) + if !( exists('s:bookmarks') && time == s:bookmarks[0] ) + let s:bookmarks = [time, s:getbookmarks()] + en +endf + +fu! s:parts(str) + let mlist = matchlist(a:str, '\v([^\t]+)\t(.*)$') + retu mlist != [] ? mlist[1:2] : ['', ''] +endf + +fu! s:process(entries, type) + retu map(a:entries, 's:modify(v:val, a:type)') +endf + +fu! s:modify(entry, type) + let [name, dir] = s:parts(a:entry) + let dir = fnamemodify(dir, a:type) + retu name.' '.( dir == '' ? '.' : dir ) +endf + +fu! s:msg(name, cwd) + redr + echoh Identifier | echon 'Bookmarked ' | echoh Constant + echon a:name.' ' | echoh Directory | echon a:cwd + echoh None +endf + +fu! s:syntax() + if !ctrlp#nosy() + cal ctrlp#hicheck('CtrlPBookmark', 'Identifier') + cal ctrlp#hicheck('CtrlPTabExtra', 'Comment') + sy match CtrlPBookmark '^> [^\t]\+' contains=CtrlPLinePre + sy match CtrlPTabExtra '\zs\t.*\ze$' + en +endf +" Public {{{1 +fu! ctrlp#bookmarkdir#init() + cal s:setentries() + cal s:syntax() + retu s:process(copy(s:bookmarks[1]), ':.') +endf + +fu! ctrlp#bookmarkdir#accept(mode, str) + let parts = s:parts(s:modify(a:str, ':p')) + cal call('s:savebookmark', parts) + if a:mode =~ 't\|v\|h' + cal ctrlp#exit() + en + cal ctrlp#setdir(parts[1], a:mode =~ 't\|h' ? 'chd!' : 'lc!') + if a:mode == 'e' + cal ctrlp#switchtype(0) + cal ctrlp#recordhist() + cal ctrlp#prtclear() + en +endf + +fu! ctrlp#bookmarkdir#add(dir) + let str = 'Directory to bookmark: ' + let cwd = a:dir != '' ? a:dir : s:getinput(str, getcwd(), 'dir') + if cwd == '' | retu | en + let cwd = fnamemodify(cwd, ':p') + let name = s:getinput('Bookmark as: ', cwd) + if name == '' | retu | en + let name = tr(name, ' ', ' ') + cal s:savebookmark(name, cwd) + cal s:msg(name, cwd) +endf + +fu! ctrlp#bookmarkdir#remove(entries) + cal s:process(a:entries, ':p') + cal s:writecache(a:entries == [] ? [] : + \ filter(s:getbookmarks(), 'index(a:entries, v:val) < 0')) + cal s:setentries() + retu s:process(copy(s:bookmarks[1]), ':.') +endf + +fu! ctrlp#bookmarkdir#id() + retu s:id +endf +"}}} + +" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2 diff --git a/bundle/git_ctrlp/autoload/ctrlp/buffertag.vim b/bundle/git_ctrlp/autoload/ctrlp/buffertag.vim index 68c131d..73c5d9b 100644 --- a/bundle/git_ctrlp/autoload/ctrlp/buffertag.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/buffertag.vim @@ -13,7 +13,7 @@ if exists('g:loaded_ctrlp_buftag') && g:loaded_ctrlp_buftag en let g:loaded_ctrlp_buftag = 1 -let s:buftag_var = { +cal add(g:ctrlp_ext_vars, { \ 'init': 'ctrlp#buffertag#init(s:crfile)', \ 'accept': 'ctrlp#buffertag#accept', \ 'lname': 'buffer tags', @@ -21,48 +21,27 @@ let s:buftag_var = { \ 'exit': 'ctrlp#buffertag#exit()', \ 'type': 'tabs', \ 'opts': 'ctrlp#buffertag#opts()', - \ } - -let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars) - \ ? add(g:ctrlp_ext_vars, s:buftag_var) : [s:buftag_var] + \ }) let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) -fu! ctrlp#buffertag#opts() - let opts = { - \ 'g:ctrlp_buftag_systemenc': ['s:enc', &enc], - \ 'g:ctrlp_buftag_ctags_bin': ['s:bin', ''], - \ 'g:ctrlp_buftag_types': ['s:usr_types', ''], - \ } - for [ke, va] in items(opts) - exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1]) - endfo -endf -cal ctrlp#buffertag#opts() +let [s:pref, s:opts] = ['g:ctrlp_buftag_', { + \ 'systemenc': ['s:enc', &enc], + \ 'ctags_bin': ['s:bin', ''], + \ 'types': ['s:usr_types', {}], + \ }] -fu! s:bins() - let bins = [ - \ 'ctags-exuberant', - \ 'exuberant-ctags', - \ 'exctags', - \ '/usr/local/bin/ctags', - \ '/opt/local/bin/ctags', - \ 'ctags', - \ 'ctags.exe', - \ 'tags', - \ ] - if empty(s:bin) - for bin in bins | if executable(bin) - let s:bin = bin - brea - en | endfo - el - let s:bin = expand(s:bin, 1) - en -endf -cal s:bins() +let s:bins = [ + \ 'ctags-exuberant', + \ 'exuberant-ctags', + \ 'exctags', + \ '/usr/local/bin/ctags', + \ '/opt/local/bin/ctags', + \ 'ctags', + \ 'ctags.exe', + \ 'tags', + \ ] -" s:types {{{2 let s:types = { \ 'asm' : '%sasm%sasm%sdlmt', \ 'aspperl': '%sasp%sasp%sfsv', @@ -109,9 +88,22 @@ if executable('jsctags') cal extend(s:types, { 'javascript': { 'args': '-f -', 'bin': 'jsctags' } }) en -if type(s:usr_types) == 4 +fu! ctrlp#buffertag#opts() + for [ke, va] in items(s:opts) + let {va[0]} = exists(s:pref.ke) ? {s:pref.ke} : va[1] + endfo + " Ctags bin + if empty(s:bin) + for bin in s:bins | if executable(bin) + let s:bin = bin + brea + en | endfo + el + let s:bin = expand(s:bin, 1) + en + " Types cal extend(s:types, s:usr_types) -en +endf " Utilities {{{1 fu! s:validfile(fname, ftype) if ( !empty(a:fname) || !empty(a:ftype) ) && filereadable(a:fname) @@ -193,24 +185,20 @@ endf fu! s:parseline(line) let eval = '\v^([^\t]+)\t(.+)\t\/\^(.+)\$\/\;\"\t(.+)\tline(no)?\:(\d+)' let vals = matchlist(a:line, eval) - if empty(vals) | retu '' | en + if vals == [] | retu '' | en let [bufnr, bufname] = [bufnr('^'.vals[2].'$'), fnamemodify(vals[2], ':p:t')] retu vals[1].' '.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'| '.vals[3] endf fu! s:syntax() - if !hlexists('CtrlPTagKind') - hi link CtrlPTagKind Title + if !ctrlp#nosy() + cal ctrlp#hicheck('CtrlPTagKind', 'Title') + cal ctrlp#hicheck('CtrlPBufName', 'Directory') + cal ctrlp#hicheck('CtrlPTabExtra', 'Comment') + sy match CtrlPTagKind '\zs[^\t|]\+\ze|\d\+:[^|]\+|\d\+|' + sy match CtrlPBufName '|\d\+:\zs[^|]\+\ze|\d\+|' + sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName,CtrlPTagKind en - if !hlexists('CtrlPBufName') - hi link CtrlPBufName Directory - en - if !hlexists('CtrlPTabExtra') - hi link CtrlPTabExtra Comment - en - sy match CtrlPTagKind '\zs[^\t|]\+\ze|\d\+:[^|]\+|\d\+|' - sy match CtrlPBufName '|\d\+:\zs[^|]\+\ze|\d\+|' - sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName,CtrlPTagKind endf " Public {{{1 fu! ctrlp#buffertag#init(fname) @@ -223,14 +211,13 @@ fu! ctrlp#buffertag#init(fname) let tftype = get(split(getbufvar(bname, '&ft'), '\.'), 0, '') cal extend(lines, s:process(bname, tftype)) endfo - if has('syntax') && exists('g:syntax_on') - cal s:syntax() - en + cal s:syntax() retu lines endf fu! ctrlp#buffertag#accept(mode, str) let vals = matchlist(a:str, '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|') + if vals == [] | retu | en let [bufnm, linenr] = [fnamemodify(bufname(str2nr(vals[1])), ':p'), vals[2]] cal ctrlp#acceptfile(a:mode, bufnm, linenr) endf diff --git a/bundle/git_ctrlp/autoload/ctrlp/changes.vim b/bundle/git_ctrlp/autoload/ctrlp/changes.vim index 736e911..a658a80 100644 --- a/bundle/git_ctrlp/autoload/ctrlp/changes.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/changes.vim @@ -10,18 +10,16 @@ if exists('g:loaded_ctrlp_changes') && g:loaded_ctrlp_changes en let g:loaded_ctrlp_changes = 1 -let s:changes_var = { - \ 'init': 'ctrlp#changes#init(s:bufnr, s:crfile)', +cal add(g:ctrlp_ext_vars, { + \ 'init': 'ctrlp#changes#init(s:bufnr, s:crbufnr)', \ 'accept': 'ctrlp#changes#accept', \ 'lname': 'changes', \ 'sname': 'chs', \ 'exit': 'ctrlp#changes#exit()', \ 'type': 'tabe', \ 'sort': 0, - \ } - -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] + \ 'nolim': 1, + \ }) let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) " Utilities {{{1 @@ -46,41 +44,34 @@ fu! s:process(clines, ...) endf fu! s:syntax() - if !hlexists('CtrlPBufName') - hi link CtrlPBufName Directory + if !ctrlp#nosy() + cal ctrlp#hicheck('CtrlPBufName', 'Directory') + cal ctrlp#hicheck('CtrlPTabExtra', 'Comment') + sy match CtrlPBufName '\t|\d\+:\zs[^|]\+\ze|\d\+:\d\+|$' + sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName en - if !hlexists('CtrlPTabExtra') - hi link CtrlPTabExtra Comment - en - sy match CtrlPBufName '\t|\d\+:\zs[^|]\+\ze|\d\+:\d\+|$' - sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName 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] +fu! ctrlp#changes#init(original_bufnr, bufnr) + let bufnr = exists('s:bufnr') ? s:bufnr : a:bufnr + let bufs = exists('s:clmode') && s:clmode ? ctrlp#buffers('id') : [bufnr] + cal filter(bufs, 'v:val > 0') let [swb, &swb] = [&swb, ''] let lines = [] for each in bufs - let [bname, fnamet] = [fnamemodify(each, ':p'), fnamemodify(each, ':t')] - let bufnr = bufnr('^'.bname.'$') - if bufnr > 0 - cal extend(lines, s:process(s:changelist(bufnr), bufnr, fnamet)) - en + let fnamet = fnamemodify(bufname(each), ':t') + cal extend(lines, s:process(s:changelist(each), each, fnamet)) 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() - cal s:syntax() - en + cal ctrlp#syntax() + cal s:syntax() retu lines endf fu! ctrlp#changes#accept(mode, str) let info = matchlist(a:str, '\t|\(\d\+\):[^|]\+|\(\d\+\):\(\d\+\)|$') + if info == [] | retu | en let bufnr = str2nr(get(info, 1)) if bufnr cal ctrlp#acceptfile(a:mode, fnamemodify(bufname(bufnr), ':p')) @@ -92,13 +83,13 @@ endf fu! ctrlp#changes#cmd(mode, ...) let s:clmode = a:mode if a:0 && !empty(a:1) - let s:bufname = fnamemodify(a:1, ':p') + let s:bufnr = bufnr('^'.fnamemodify(a:1, ':p').'$') en retu s:id endf fu! ctrlp#changes#exit() - unl! s:clmode s:bufname + unl! s:clmode s:bufnr endf "}}} diff --git a/bundle/git_ctrlp/autoload/ctrlp/dir.vim b/bundle/git_ctrlp/autoload/ctrlp/dir.vim index 982f298..b775408 100644 --- a/bundle/git_ctrlp/autoload/ctrlp/dir.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/dir.vim @@ -17,16 +17,14 @@ let s:ars = [ \ 's:glob', \ ] -let s:dir_var = { +cal add(g:ctrlp_ext_vars, { \ 'init': 'ctrlp#dir#init('.join(s:ars, ', ').')', \ 'accept': 'ctrlp#dir#accept', \ 'lname': 'dirs', \ 'sname': 'dir', \ 'type': 'path', - \ } - -let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars) - \ ? add(g:ctrlp_ext_vars, s:dir_var) : [s:dir_var] + \ 'specinput': 1, + \ }) let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) " Utilities {{{1 @@ -34,9 +32,9 @@ fu! s:globdirs(dirs, depth) let entries = split(globpath(a:dirs, s:glob), "\n") let [dirs, depth] = [ctrlp#dirnfile(entries)[0], a:depth + 1] cal extend(g:ctrlp_alldirs, dirs) - if !empty(dirs) && !s:max(len(g:ctrlp_alldirs), s:maxfiles) - \ && depth <= s:maxdepth - sil! cal ctrlp#progress(len(g:ctrlp_alldirs)) + let nr = len(g:ctrlp_alldirs) + if !empty(dirs) && !s:max(nr, s:maxfiles) && depth <= s:maxdepth + sil! cal ctrlp#progress(nr) cal s:globdirs(join(dirs, ','), depth) en endf @@ -48,25 +46,24 @@ endf fu! ctrlp#dir#init(...) let s:cwd = getcwd() for each in range(len(s:ars)) - exe 'let' s:ars[each] '=' string(eval('a:'.(each + 1))) + let {s:ars[each]} = a:{each + 1} endfo - let cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().s:dir_var['sname'] - let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile(s:dir_var['sname']) + let cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'dir' + let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile('dir') if g:ctrlp_newdir || !filereadable(cafile) - let g:ctrlp_alldirs = [] + let [s:initcwd, g:ctrlp_alldirs] = [s:cwd, []] cal s:globdirs(s:cwd, 0) cal ctrlp#rmbasedir(g:ctrlp_alldirs) - let read_cache = 0 if len(g:ctrlp_alldirs) <= s:compare_lim cal sort(g:ctrlp_alldirs, 'ctrlp#complen') en - el - let g:ctrlp_alldirs = ctrlp#utils#readfile(cafile) - let read_cache = 1 - en - if !read_cache cal ctrlp#utils#writecache(g:ctrlp_alldirs, cadir, cafile) let g:ctrlp_newdir = 0 + el + if !( exists('s:initcwd') && s:initcwd == s:cwd ) + let s:initcwd = s:cwd + let g:ctrlp_alldirs = ctrlp#utils#readfile(cafile) + en en retu g:ctrlp_alldirs endf diff --git a/bundle/git_ctrlp/autoload/ctrlp/line.vim b/bundle/git_ctrlp/autoload/ctrlp/line.vim index 28b81d6..10a45fa 100644 --- a/bundle/git_ctrlp/autoload/ctrlp/line.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/line.vim @@ -10,52 +10,45 @@ if exists('g:loaded_ctrlp_line') && g:loaded_ctrlp_line en let g:loaded_ctrlp_line = 1 -let s:line_var = { +cal add(g:ctrlp_ext_vars, { \ 'init': 'ctrlp#line#init()', \ 'accept': 'ctrlp#line#accept', \ 'lname': 'lines', \ 'sname': 'lns', \ 'type': 'tabe', - \ } - -let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars) - \ ? add(g:ctrlp_ext_vars, s:line_var) : [s:line_var] + \ }) let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) " Utilities {{{1 fu! s:syntax() - if !hlexists('CtrlPBufName') - hi link CtrlPBufName Directory + if !ctrlp#nosy() + cal ctrlp#hicheck('CtrlPBufName', 'Directory') + cal ctrlp#hicheck('CtrlPTabExtra', 'Comment') + sy match CtrlPBufName '\t|\zs[^|]\+\ze|\d\+:\d\+|$' + sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName en - if !hlexists('CtrlPTabExtra') - hi link CtrlPTabExtra Comment - en - sy match CtrlPBufName '\t|\zs[^|]\+\ze|\d\+:\d\+|$' - sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName endf " Public {{{1 fu! ctrlp#line#init() - let [bufs, lines] = [filter(ctrlp#buffers(), 'filereadable(v:val)'), []] - for each in bufs - let [fnamet, from_file] = [fnamemodify(each, ':t'), readfile(each)] - let bname = fnamemodify(each, ':p') - cal map(from_file, 'tr(v:val, '' '', '' '')') - let [id, len_ff, bufnr] = [1, len(from_file), bufnr('^'.bname.'$')] - wh id <= len_ff - let from_file[id-1] .= ' |'.fnamet.'|'.bufnr.':'.id.'|' - let id += 1 + let [bufs, lines] = [ctrlp#buffers('id'), []] + for bufnr in bufs + let [lfb, bufn] = [getbufline(bufnr, 1, '$'), bufname(bufnr)] + let lfb = lfb == [] ? ctrlp#utils#readfile(fnamemodify(bufn, ':p')) : lfb + cal map(lfb, 'tr(v:val, '' '', '' '')') + let [linenr, len_lfb, buft] = [1, len(lfb), fnamemodify(bufn, ':t')] + wh linenr <= len_lfb + let lfb[linenr - 1] .= ' |'.buft.'|'.bufnr.':'.linenr.'|' + let linenr += 1 endw - cal filter(from_file, 'v:val !~ ''^\s*\t|[^|]\+|\d\+:\d\+|$''') - cal extend(lines, from_file) + cal extend(lines, filter(lfb, 'v:val !~ ''^\s*\t|[^|]\+|\d\+:\d\+|$''')) endfo - if has('syntax') && exists('g:syntax_on') - cal s:syntax() - en + cal s:syntax() retu lines endf fu! ctrlp#line#accept(mode, str) let info = matchlist(a:str, '\t|[^|]\+|\(\d\+\):\(\d\+\)|$') + if info == [] | retu | en let [bufnr, linenr] = [str2nr(get(info, 1)), get(info, 2)] if bufnr > 0 cal ctrlp#acceptfile(a:mode, fnamemodify(bufname(bufnr), ':p'), linenr) diff --git a/bundle/git_ctrlp/autoload/ctrlp/mixed.vim b/bundle/git_ctrlp/autoload/ctrlp/mixed.vim new file mode 100644 index 0000000..cf01d10 --- /dev/null +++ b/bundle/git_ctrlp/autoload/ctrlp/mixed.vim @@ -0,0 +1,83 @@ +" ============================================================================= +" File: autoload/ctrlp/mixed.vim +" Description: Mixing Files + MRU + Buffers +" Author: Kien Nguyen +" ============================================================================= + +" Init {{{1 +if exists('g:loaded_ctrlp_mixed') && g:loaded_ctrlp_mixed + fini +en +let [g:loaded_ctrlp_mixed, g:ctrlp_newmix] = [1, 0] + +cal add(g:ctrlp_ext_vars, { + \ 'init': 'ctrlp#mixed#init(s:compare_lim)', + \ 'accept': 'ctrlp#acceptfile', + \ 'lname': 'fil + mru + buf', + \ 'sname': 'mix', + \ 'type': 'path', + \ 'opmul': 1, + \ 'specinput': 1, + \ }) + +let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) +" Utilities {{{1 +fu! s:newcache(cwd) + if g:ctrlp_newmix || !has_key(g:ctrlp_allmixes, 'data') | retu 1 | en + retu g:ctrlp_allmixes['cwd'] != a:cwd + \ || g:ctrlp_allmixes['filtime'] < getftime(ctrlp#utils#cachefile()) + \ || g:ctrlp_allmixes['mrutime'] < getftime(ctrlp#mrufiles#cachefile()) + \ || g:ctrlp_allmixes['bufs'] < len(ctrlp#mrufiles#bufs()) +endf + +fu! s:getnewmix(cwd, clim) + if g:ctrlp_newmix + cal ctrlp#mrufiles#refresh('raw') + let g:ctrlp_newcache = 1 + en + let g:ctrlp_lines = copy(ctrlp#files()) + cal ctrlp#progress('Mixing...') + let mrufs = copy(ctrlp#mrufiles#list('raw')) + if exists('+ssl') && &ssl + cal map(mrufs, 'tr(v:val, "\\", "/")') + en + let bufs = map(ctrlp#buffers('id'), 'fnamemodify(bufname(v:val), ":p")') + let mrufs = bufs + filter(mrufs, 'index(bufs, v:val) < 0') + if len(mrufs) > len(g:ctrlp_lines) + cal filter(mrufs, 'stridx(v:val, a:cwd)') + el + let cwd_mrufs = filter(copy(mrufs), '!stridx(v:val, a:cwd)') + let cwd_mrufs = ctrlp#rmbasedir(cwd_mrufs) + for each in cwd_mrufs + let id = index(g:ctrlp_lines, each) + if id >= 0 | cal remove(g:ctrlp_lines, id) | en + endfo + en + cal map(mrufs, 'fnamemodify(v:val, ":.")') + let g:ctrlp_lines = len(mrufs) > len(g:ctrlp_lines) + \ ? g:ctrlp_lines + mrufs : mrufs + g:ctrlp_lines + if len(g:ctrlp_lines) <= a:clim + cal sort(g:ctrlp_lines, 'ctrlp#complen') + en + let g:ctrlp_allmixes = { 'filtime': getftime(ctrlp#utils#cachefile()), + \ 'mrutime': getftime(ctrlp#mrufiles#cachefile()), 'cwd': a:cwd, + \ 'bufs': len(ctrlp#mrufiles#bufs()), 'data': g:ctrlp_lines } +endf +" Public {{{1 +fu! ctrlp#mixed#init(clim) + let cwd = getcwd() + if s:newcache(cwd) + cal s:getnewmix(cwd, a:clim) + el + let g:ctrlp_lines = g:ctrlp_allmixes['data'] + en + let g:ctrlp_newmix = 0 + retu g:ctrlp_lines +endf + +fu! ctrlp#mixed#id() + retu s:id +endf +"}}} + +" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2 diff --git a/bundle/git_ctrlp/autoload/ctrlp/mrufiles.vim b/bundle/git_ctrlp/autoload/ctrlp/mrufiles.vim index f8c3048..161df2d 100644 --- a/bundle/git_ctrlp/autoload/ctrlp/mrufiles.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/mrufiles.vim @@ -5,120 +5,114 @@ " ============================================================================= " Static variables {{{1 +let [s:mrbs, s:mrufs] = [[], []] + fu! ctrlp#mrufiles#opts() - let opts = { - \ 'g:ctrlp_mruf_max': ['s:max', 250], - \ 'g:ctrlp_mruf_include': ['s:in', ''], - \ 'g:ctrlp_mruf_exclude': ['s:ex', ''], - \ 'g:ctrlp_mruf_case_sensitive': ['s:csen', 1], - \ 'g:ctrlp_mruf_relative': ['s:re', 0], - \ 'g:ctrlp_mruf_last_entered': ['s:mre', 0], - \ } + let [pref, opts] = ['g:ctrlp_mruf_', { + \ 'max': ['s:max', 250], + \ 'include': ['s:in', ''], + \ 'exclude': ['s:ex', ''], + \ 'case_sensitive': ['s:cseno', 1], + \ 'relative': ['s:re', 0], + \ }] for [ke, va] in items(opts) - exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1]) + let [{va[0]}, {pref.ke}] = [pref.ke, exists(pref.ke) ? {pref.ke} : va[1]] endfo - let [s:csen, s:mrbs] = [s:csen ? '#' : '?', []] - if exists('s:locked') - cal ctrlp#mrufiles#init() - en endf cal ctrlp#mrufiles#opts() " Utilities {{{1 fu! s:excl(fn) - retu !empty(s:ex) && a:fn =~# s:ex + retu !empty({s:ex}) && a:fn =~# {s:ex} endf -fu! s:readcache() - if !exists('s:cadir') || !exists('s:cafile') - let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'mru' - let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt' - en - retu ctrlp#utils#readfile(s:cafile) +fu! s:mergelists() + let diskmrufs = ctrlp#utils#readfile(ctrlp#mrufiles#cachefile()) + cal filter(diskmrufs, 'index(s:mrufs, v:val) < 0') + let mrufs = s:mrufs + diskmrufs + retu s:chop(mrufs) +endf + +fu! s:chop(mrufs) + if len(a:mrufs) > {s:max} | cal remove(a:mrufs, {s:max}, -1) | en + retu a:mrufs endf fu! s:reformat(mrufs) - if s:re + if {s:re} let cwd = exists('+ssl') ? tr(getcwd(), '/', '\') : getcwd() cal filter(a:mrufs, '!stridx(v:val, cwd)') en - retu map(a:mrufs, 'fnamemodify(v:val, '':.'')') + retu map(a:mrufs, 'fnamemodify(v:val, ":.")') endf -fu! s:record(bufnr, ...) +fu! s:record(bufnr) if s:locked | retu | en let bufnr = a:bufnr + 0 if bufnr <= 0 | retu | en - let fn = fnamemodify(bufname(bufnr), ':p') + let bufname = bufname(bufnr) + if empty(bufname) | retu | en + let fn = fnamemodify(bufname, ':p') let fn = exists('+ssl') ? tr(fn, '/', '\') : fn - cal filter(s:mrbs, 'v:val !='.s:csen.' fn') - cal insert(s:mrbs, fn) - if empty(fn) || !empty(&bt) || ( !empty(s:in) && fn !~# s:in ) - \ || ( !empty(s:ex) && fn =~# s:ex ) || !filereadable(fn) - \ || ( a:0 && a:1 == 1 ) - retu + cal filter(s:mrbs, 'v:val != bufnr') + cal insert(s:mrbs, bufnr) + if ( !empty({s:in}) && fn !~# {s:in} ) || ( !empty({s:ex}) && fn =~# {s:ex} ) + \ || !empty(&bt) || !filereadable(fn) | retu en - let mrufs = s:readcache() - cal filter(mrufs, 'v:val !='.s:csen.' fn') - cal insert(mrufs, fn) - if len(mrufs) > s:max | cal remove(mrufs, s:max, -1) | en - cal ctrlp#utils#writecache(mrufs, s:cadir, s:cafile) + cal filter(s:mrufs, 'v:val !='.( {s:cseno} ? '#' : '?' ).' fn') + cal insert(s:mrufs, fn) +endf + +fu! s:savetofile(mrufs) + cal ctrlp#utils#writecache(a:mrufs, s:cadir, s:cafile) endf " Public {{{1 -fu! ctrlp#mrufiles#refresh() - let mrufs = s:readcache() - cal filter(mrufs, '!empty(ctrlp#utils#glob(v:val, 1)) && !s:excl(v:val)') +fu! ctrlp#mrufiles#refresh(...) + let s:mrufs = s:mergelists() + cal filter(s:mrufs, '!empty(ctrlp#utils#glob(v:val, 1)) && !s:excl(v:val)') if exists('+ssl') - cal map(mrufs, 'tr(v:val, ''/'', ''\'')') - cal filter(mrufs, 'count(mrufs, v:val) == 1') + cal map(s:mrufs, 'tr(v:val, "/", "\\")') + cal filter(s:mrufs, 'count(s:mrufs, v:val) == 1') en - cal ctrlp#utils#writecache(mrufs, s:cadir, s:cafile) - retu s:reformat(mrufs) + cal s:savetofile(s:mrufs) + retu a:0 && a:1 == 'raw' ? [] : s:reformat(copy(s:mrufs)) endf fu! ctrlp#mrufiles#remove(files) - let mrufs = [] + let s:mrufs = [] if a:files != [] - let mrufs = s:readcache() - cal filter(mrufs, 'index(a:files, v:val) < 0') + let s:mrufs = s:mergelists() + cal filter(s:mrufs, 'index(a:files, v:val, 0, '.(!{s:cseno}).') < 0') en - cal ctrlp#utils#writecache(mrufs, s:cadir, s:cafile) - retu map(mrufs, 'fnamemodify(v:val, '':.'')') + cal s:savetofile(s:mrufs) + retu s:reformat(copy(s:mrufs)) endf fu! ctrlp#mrufiles#list(...) - if a:0 | cal s:record(a:1) | retu | en - retu s:reformat(s:readcache()) + retu a:0 ? a:1 == 'raw' ? s:mergelists() : 0 : s:reformat(s:mergelists()) endf fu! ctrlp#mrufiles#bufs() retu s:mrbs endf +fu! ctrlp#mrufiles#cachefile() + if !exists('s:cadir') || !exists('s:cafile') + let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'mru' + let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt' + en + retu s:cafile +endf + fu! ctrlp#mrufiles#init() if !has('autocmd') | retu | en let s:locked = 0 aug CtrlPMRUF au! - au BufReadPost,BufNewFile,BufWritePost * cal s:record(expand('', 1)) + au BufAdd,BufEnter,BufLeave,BufUnload * cal s:record(expand('', 1)) au QuickFixCmdPre *vimgrep* let s:locked = 1 au QuickFixCmdPost *vimgrep* let s:locked = 0 + au VimLeavePre * cal s:savetofile(s:mergelists()) aug END - aug CtrlPMREB - au! - au BufEnter,BufUnload * cal s:record(expand('', 1), 1) - aug END - if exists('#CtrlPMREF') - au! CtrlPMREF - en - if s:mre - aug CtrlPMREF - au! - au BufEnter,BufUnload * cal s:record(expand('', 1)) - aug END - if exists('#CtrlPMREB') - au! CtrlPMREB - en - en endf "}}} diff --git a/bundle/git_ctrlp/autoload/ctrlp/quickfix.vim b/bundle/git_ctrlp/autoload/ctrlp/quickfix.vim index 1296df9..144851d 100644 --- a/bundle/git_ctrlp/autoload/ctrlp/quickfix.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/quickfix.vim @@ -10,17 +10,15 @@ if exists('g:loaded_ctrlp_quickfix') && g:loaded_ctrlp_quickfix en let g:loaded_ctrlp_quickfix = 1 -let s:var_qf = { +cal add(g:ctrlp_ext_vars, { \ 'init': 'ctrlp#quickfix#init()', \ 'accept': 'ctrlp#quickfix#accept', \ 'lname': 'quickfix', \ 'sname': 'qfx', \ 'type': 'line', \ 'sort': 0, - \ } - -let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars) - \ ? add(g:ctrlp_ext_vars, s:var_qf) : [s:var_qf] + \ 'nolim': 1, + \ }) let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) @@ -28,20 +26,22 @@ fu! s:lineout(dict) retu printf('%s|%d:%d| %s', bufname(a:dict['bufnr']), a:dict['lnum'], \ a:dict['col'], matchstr(a:dict['text'], '\s*\zs.*\S')) endf -" Public {{{1 -fu! ctrlp#quickfix#init() - let g:ctrlp_nolimit = 1 - if has('syntax') && exists('g:syntax_on') - if !hlexists('CtrlPqfLineCol') - hi link CtrlPqfLineCol Search - en +" Utilities {{{1 +fu! s:syntax() + if !ctrlp#nosy() + cal ctrlp#hicheck('CtrlPqfLineCol', 'Search') sy match CtrlPqfLineCol '|\zs\d\+:\d\+\ze|' en +endf +" Public {{{1 +fu! ctrlp#quickfix#init() + cal s:syntax() retu map(getqflist(), 's:lineout(v:val)') endf fu! ctrlp#quickfix#accept(mode, str) let items = matchlist(a:str, '^\([^|]\+\ze\)|\(\d\+\):\(\d\+\)|') + if items == [] | retu | en let [md, filpath] = [a:mode, fnamemodify(items[1], ':p')] if empty(filpath) | retu | en cal ctrlp#exit() diff --git a/bundle/git_ctrlp/autoload/ctrlp/rtscript.vim b/bundle/git_ctrlp/autoload/ctrlp/rtscript.vim index dda9dd0..c55889e 100644 --- a/bundle/git_ctrlp/autoload/ctrlp/rtscript.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/rtscript.vim @@ -10,16 +10,14 @@ if exists('g:loaded_ctrlp_rtscript') && g:loaded_ctrlp_rtscript en let [g:loaded_ctrlp_rtscript, g:ctrlp_newrts] = [1, 0] -let s:rtscript_var = { +cal add(g:ctrlp_ext_vars, { \ 'init': 'ctrlp#rtscript#init()', \ 'accept': 'ctrlp#acceptfile', \ 'lname': 'runtime scripts', \ 'sname': 'rts', \ 'type': 'path', - \ } - -let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars) - \ ? add(g:ctrlp_ext_vars, s:rtscript_var) : [s:rtscript_var] + \ 'opmul': 1, + \ }) let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) " Public {{{1 diff --git a/bundle/git_ctrlp/autoload/ctrlp/tag.vim b/bundle/git_ctrlp/autoload/ctrlp/tag.vim index 5e002ef..26af1a0 100644 --- a/bundle/git_ctrlp/autoload/ctrlp/tag.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/tag.vim @@ -10,17 +10,14 @@ if exists('g:loaded_ctrlp_tag') && g:loaded_ctrlp_tag en let g:loaded_ctrlp_tag = 1 -let s:tag_var = { +cal add(g:ctrlp_ext_vars, { \ 'init': 'ctrlp#tag#init()', \ 'accept': 'ctrlp#tag#accept', \ 'lname': 'tags', \ 'sname': 'tag', \ 'enter': 'ctrlp#tag#enter()', \ 'type': 'tabs', - \ } - -let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars) - \ ? add(g:ctrlp_ext_vars, s:tag_var) : [s:tag_var] + \ }) let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) " Utilities {{{1 @@ -43,19 +40,27 @@ fu! s:findcount(str) endf fu! s:filter(tags) - let [nr, alltags] = [0, a:tags] + let nr = 0 wh 0 < 1 - if alltags[nr] =~ '^!' && alltags[nr] !~ '^!_TAG_' + if a:tags == [] | brea | en + if a:tags[nr] =~ '^!' && a:tags[nr] !~ '^!_TAG_' let nr += 1 con en - if alltags[nr] =~ '^!_TAG_' && len(alltags) > nr - cal remove(alltags, nr) + if a:tags[nr] =~ '^!_TAG_' && len(a:tags) > nr + cal remove(a:tags, nr) el brea en endw - retu alltags + retu a:tags +endf + +fu! s:syntax() + if !ctrlp#nosy() + cal ctrlp#hicheck('CtrlPTabExtra', 'Comment') + sy match CtrlPTabExtra '\zs\t.*\ze$' + en endf " Public {{{1 fu! ctrlp#tag#init() @@ -66,12 +71,7 @@ fu! ctrlp#tag#init() let alltags = s:filter(ctrlp#utils#readfile(each)) cal extend(g:ctrlp_alltags, alltags) endfo - if has('syntax') && exists('g:syntax_on') - if !hlexists('CtrlPTabExtra') - hi link CtrlPTabExtra Comment - en - sy match CtrlPTabExtra '\zs\t.*\ze$' - en + cal s:syntax() retu g:ctrlp_alltags endf diff --git a/bundle/git_ctrlp/autoload/ctrlp/undo.vim b/bundle/git_ctrlp/autoload/ctrlp/undo.vim index 3604ba0..dee705e 100644 --- a/bundle/git_ctrlp/autoload/ctrlp/undo.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/undo.vim @@ -10,7 +10,7 @@ if ( exists('g:loaded_ctrlp_undo') && g:loaded_ctrlp_undo ) en let g:loaded_ctrlp_undo = 1 -let s:undo_var = { +cal add(g:ctrlp_ext_vars, { \ 'init': 'ctrlp#undo#init()', \ 'accept': 'ctrlp#undo#accept', \ 'lname': 'undo', @@ -19,10 +19,8 @@ let s:undo_var = { \ 'exit': 'ctrlp#undo#exit()', \ 'type': 'line', \ 'sort': 0, - \ } - -let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars) - \ ? add(g:ctrlp_ext_vars, s:undo_var) : [s:undo_var] + \ 'nolim': 1, + \ }) let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) @@ -82,11 +80,10 @@ fu! s:elapsed(nr) endf fu! s:syntax() + if ctrlp#nosy() | retu | en for [ke, va] in items({'T': 'Directory', 'Br': 'Comment', 'Nr': 'String', \ 'Sv': 'Comment', 'Po': 'Title'}) - if !hlexists('CtrlPUndo'.ke) - exe 'hi link CtrlPUndo'.ke va - en + cal ctrlp#hicheck('CtrlPUndo'.ke, va) endfo sy match CtrlPUndoT '\v\d+ \zs[^ ]+\ze|\d+:\d+:\d+' sy match CtrlPUndoBr '\[\|\]' @@ -115,16 +112,13 @@ endf fu! s:formatul(...) let parts = matchlist(a:1, \ '\v^\s+(\d+)\s+\d+\s+([^ ]+\s?[^ ]+|\d+\s\w+\s\w+)(\s*\d*)$') - retu parts[2].' ['.parts[1].']'.( parts[3] != '' ? ' saved' : '' ) + retu parts == [] ? '----' + \ : parts[2].' ['.parts[1].']'.( parts[3] != '' ? ' saved' : '' ) endf " Public {{{1 fu! ctrlp#undo#init() let entries = s:undos[0] ? s:undos[1]['entries'] : s:undos[1] if empty(entries) | retu [] | en - if has('syntax') && exists('g:syntax_on') - cal s:syntax() - en - let g:ctrlp_nolimit = 1 if !exists('s:lines') if s:undos[0] let entries = s:dict2list(s:flatten(entries, s:undos[1]['seq_cur'])) @@ -133,6 +127,7 @@ fu! ctrlp#undo#init() let s:lines = map(reverse(entries), 's:formatul(v:val)') en en + cal s:syntax() retu s:lines endf diff --git a/bundle/git_ctrlp/autoload/ctrlp/utils.vim b/bundle/git_ctrlp/autoload/ctrlp/utils.vim index b4af577..f2aa905 100644 --- a/bundle/git_ctrlp/autoload/ctrlp/utils.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/utils.vim @@ -11,7 +11,7 @@ endf let s:lash = ctrlp#utils#lash() fu! s:lash(...) - retu match(a:0 ? a:1 : getcwd(), '[\/]$') < 0 ? s:lash : '' + retu ( a:0 ? a:1 : getcwd() ) !~ '[\/]$' ? s:lash : '' endf fu! ctrlp#utils#opts() @@ -33,9 +33,9 @@ fu! ctrlp#utils#cachedir() endf fu! ctrlp#utils#cachefile(...) - let tail = a:0 ? '.'.a:1 : '' - let cache_file = substitute(getcwd(), '\([\/]\|^\a\zs:\)', '%', 'g').tail.'.txt' - retu a:0 ? cache_file : s:cache_dir.s:lash(s:cache_dir).cache_file + let [tail, dir] = [a:0 == 1 ? '.'.a:1 : '', a:0 == 2 ? a:1 : getcwd()] + let cache_file = substitute(dir, '\([\/]\|^\a\zs:\)', '%', 'g').tail.'.txt' + retu a:0 == 1 ? cache_file : s:cache_dir.s:lash(s:cache_dir).cache_file endf fu! ctrlp#utils#readfile(file) @@ -60,9 +60,6 @@ endf fu! ctrlp#utils#writecache(lines, ...) if isdirectory(ctrlp#utils#mkdir(a:0 ? a:1 : s:cache_dir)) sil! cal writefile(a:lines, a:0 >= 2 ? a:2 : ctrlp#utils#cachefile()) - if !a:0 - let g:ctrlp_newcache = 0 - en en endf diff --git a/bundle/git_ctrlp/doc/ctrlp.txt b/bundle/git_ctrlp/doc/ctrlp.txt index ccffbe5..daa18b4 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.4 +*ctrlp.txt* Fuzzy file, buffer, mru, tag, ... finder. v1.7.7 *CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'* =============================================================================== # # @@ -23,17 +23,63 @@ CONTENTS *ctrlp-contents* =============================================================================== 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 -Vim’s |regexp| as search pattern, built-in MRU files monitoring, project’s root -finder, and more. +Full path fuzzy file, buffer, mru, tag, ... finder with an intuitive interface. +Written in pure Vimscript for MacVim, gVim and Vim version 7.0+. Has full +support for Vim's |regexp| as search pattern, built-in MRU files monitoring, +project's root finder, and more. To enable optional extensions (tag, dir, rtscript...), see |ctrlp-extensions|. =============================================================================== OPTIONS *ctrlp-options* -Below are the available options and their default values:~ +Overview:~ + + |loaded_ctrlp| Disable the plugin. + |ctrlp_map| Default mapping. + |ctrlp_cmd| Default command used for the default mapping. + |ctrlp_by_filename| Default to filename mode or not. + |ctrlp_regexp| Default to regexp mode or not. + |ctrlp_match_window_bottom| Where to show the match window. + |ctrlp_match_window_reversed| Sort order in the match window. + |ctrlp_max_height| Max height of the match window. + |ctrlp_switch_buffer| Jump to an open buffer if already opened. + |ctrlp_reuse_window| Reuse special windows (help, quickfix, etc). + |ctrlp_working_path_mode| How to set CtrlP's local working directory. + |ctrlp_root_markers| Additional, high priority root markers. + |ctrlp_use_caching| Use per-session caching or not. + |ctrlp_clear_cache_on_exit| Keep cache after exiting Vim or not. + |ctrlp_cache_dir| Location of the cache directory. + |ctrlp_dotfiles| Ignore dotfiles and dotdirs or not. + |ctrlp_custom_ignore| Hide stuff when using |globpath()|. + |ctrlp_max_files| Number of files to scan initially. + |ctrlp_max_depth| Directory depth to recurse into when scanning. + |ctrlp_user_command| Use an external scanner. + |ctrlp_max_history| Number of entries saved in the prompt history. + |ctrlp_open_new_file| How to open a file created by . + |ctrlp_open_multiple_files| How to open files selected by . + |ctrlp_arg_map| Intercept and or not. + |ctrlp_follow_symlinks| Follow symbolic links or not. + |ctrlp_lazy_update| Only update when typing has stopped. + |ctrlp_default_input| Seed the prompt with an initial string. + |ctrlp_use_migemo| Use Migemo patterns for Japanese filenames. + |ctrlp_prompt_mappings| Change the mappings in the prompt. + + MRU mode: + |ctrlp_mruf_max| Max MRU entries to remember. + |ctrlp_mruf_exclude| Files that shouldn't be remembered. + |ctrlp_mruf_include| Files to be remembered. + |ctrlp_mruf_relative| Show only MRU files in the working directory. + |ctrlp_mruf_default_order| Disable sorting. + |ctrlp_mruf_case_sensitive| MRU files are case sensitive or not. + + Advanced options: + |ctrlp_status_func| Change CtrlP's two statuslines. + |ctrlp_buffer_func| Call custom functions in the CtrlP buffer. + |ctrlp_match_func| Replace the built-in matching algorithm. + +------------------------------------------------------------------------------- +Detailed descriptions and default values:~ *'g:ctrlp_map'* Use this option to change the mapping to invoke CtrlP in |Normal| mode: > @@ -58,7 +104,7 @@ default: > Can be toggled on/off by pressing inside the prompt. *'g:ctrlp_regexp'* -Set this to 1 to set |regexp| search as the default: > +Set this to 1 to set regexp search as the default: > let g:ctrlp_regexp = 0 < Can be toggled on/off by pressing inside the prompt. @@ -80,12 +126,12 @@ Set the maximum height of the match window: > < *'g:ctrlp_switch_buffer'* -When opening a file with or , if the file’s already opened somewhere +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_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. + 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. 0 - disable this feature. *'g:ctrlp_reuse_window'* @@ -94,7 +140,7 @@ 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. +Use regexp to specify the pattern. Example: > let g:ctrlp_reuse_window = 'netrw\|help\|quickfix' < @@ -104,16 +150,16 @@ 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. + 1 - the directory of the current file. 2 - the nearest ancestor that contains one of these directories or files: - .git/ .hg/ .svn/ .bzr/ _darcs/ - 0 - don’t manage working directory. + .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 (.git/, -.hg/, .svn/, .bzr/, and _darcs/). Your markers will take precedence: > +Use this to set your own root markers in addition to the default ones (.git, +.hg, .svn, .bzr, and _darcs). Your markers will take precedence: > let g:ctrlp_root_markers = [''] < @@ -135,91 +181,8 @@ Set the directory to store the cache files: > let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp' < - *'g:ctrlp_prompt_mappings'* -Use this to customize the mappings inside CtrlP’s prompt to your liking. You -only need to keep the lines that you’ve changed the values (inside []): > - let g:ctrlp_prompt_mappings = { - \ 'PrtBS()': ['', ''], - \ 'PrtDelete()': [''], - \ 'PrtDeleteWord()': [''], - \ 'PrtClear()': [''], - \ 'PrtSelectMove("j")': ['', ''], - \ 'PrtSelectMove("k")': ['', ''], - \ 'PrtHistory(-1)': [''], - \ 'PrtHistory(1)': [''], - \ 'AcceptSelection("e")': ['', '<2-LeftMouse>'], - \ 'AcceptSelection("h")': ['', '', ''], - \ 'AcceptSelection("t")': ['', ''], - \ 'AcceptSelection("v")': ['', ''], - \ 'ToggleFocus()': [''], - \ 'ToggleRegex()': [''], - \ 'ToggleByFname()': [''], - \ 'ToggleType(1)': ['', ''], - \ 'ToggleType(-1)': ['', ''], - \ 'PrtExpandDir()': [''], - \ 'PrtInsert("w")': ['', ''], - \ 'PrtInsert("s")': [''], - \ 'PrtInsert("v")': [''], - \ 'PrtInsert("+")': [''], - \ 'PrtCurStart()': [''], - \ 'PrtCurEnd()': [''], - \ 'PrtCurLeft()': ['', '', ''], - \ 'PrtCurRight()': ['', ''], - \ 'PrtClearCache()': [''], - \ 'PrtDeleteMRU()': [''], - \ 'CreateNewFile()': [''], - \ 'MarkToOpen()': [''], - \ 'OpenMulti()': [''], - \ 'PrtExit()': ['', '', ''], - \ } -< -Note: In some terminals, it’s not possible to remap without also changing - (|keycodes|). So if pressing moves the cursor to the left instead of -deleting a char for you, add this to your |.vimrc| to disable the plugin’s -default mapping: > - let g:ctrlp_prompt_mappings = { 'PrtCurLeft()': ['', ''] } -< - - *'g:ctrlp_mruf_max'* -Specify the number of recently opened files you want CtrlP to remember: > - let g:ctrlp_mruf_max = 250 -< - - *'g:ctrlp_mruf_exclude'* -Files you don’t want CtrlP to remember. Use |regexp| to specify the patterns: > - let g:ctrlp_mruf_exclude = '' -< -Examples: > - let g:ctrlp_mruf_exclude = '/tmp/.*\|/temp/.*' " MacOSX/Linux - let g:ctrlp_mruf_exclude = '^C:\\dev\\tmp\\.*' " Windows -< - - *'g:ctrlp_mruf_include'* -And if you want CtrlP to only remember some files, specify them here: > - let g:ctrlp_mruf_include = '' -< -Example: > - let g:ctrlp_mruf_include = '\.py$\|\.rb$' -< - - *'g:ctrlp_mruf_relative'* -Set this to 1 to show only MRU files in the current working directory: > - let g:ctrlp_mruf_relative = 0 -< - - *'g:ctrlp_mruf_case_sensitive'* -Match this with your file system case-sensitivity setting to avoid duplicate -MRU entries: > - let g:ctrlp_mruf_case_sensitive = 1 -< - - *'g:ctrlp_mruf_last_entered'* -Set to 1 to sort the MRU file list to most-recently-entered-buffer order: > - let g:ctrlp_mruf_last_entered = 0 -< - *'g:ctrlp_dotfiles'* -Set this to 0 if you don’t want CtrlP to scan 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. @@ -237,7 +200,7 @@ 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 -CtrlP to not show. Use |regexp| to specify the patterns: > +CtrlP to not show. Use regexp to specify the patterns: > let g:ctrlp_custom_ignore = '' < Examples: > @@ -262,7 +225,7 @@ The maximum depth of a directory tree to recurse into: > Note: the larger these values, the more memory Vim uses. *'g:ctrlp_user_command'* -Specify an external tool to use for listing files instead of using Vim’s +Specify an external tool to use for listing files instead of using Vim's |globpath()|. Use %s in place of the target directory: > let g:ctrlp_user_command = '' < @@ -302,10 +265,10 @@ when searching outside a repo. *'g:ctrlp_max_history'* The maximum number of input strings you want CtrlP to remember. The default -value mirrors Vim’s global |'history'| option: > +value mirrors Vim's global |'history'| option: > let g:ctrlp_max_history = &history < -Set to 0 to disable prompt’s history. Browse the history with and . +Set to 0 to disable prompt's history. Browse the history with and . *'g:ctrlp_open_new_file'* Use this option to specify how the newly created file is to be opened when @@ -323,16 +286,18 @@ If non-zero, this will enable opening multiple files with and : > let g:ctrlp_open_multiple_files = 'v' < Example: > - let g:ctrlp_open_multiple_files = '2vr' + let g:ctrlp_open_multiple_files = '2vjr' < For the number: - - If given, it’ll be used as the maximum number of windows or tabs to create + - 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 file in a new tab. h - each file in a new horizontal split. v - each file in a new vertical split. + i - all files as hidden buffers. + j - after opening, jump to the first opened tab or window. Reuse the current window: tr, hr, @@ -348,37 +313,132 @@ Pressing or will then prompt for a keypress. The key can be: t - open in tab(s) h - open in horizontal split(s) v - open in vertical split(s) - 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 + i - open as hidden buffers (for only) + c - clear the marked files (for only) + r - open in the current window (for only) + , , - cancel and go back to the prompt. + - use the default behavior specified with |g:ctrlp_open_new_file| and |g:ctrlp_open_multiple_files|. *'g:ctrlp_follow_symlinks'* -Set this to 1 to follow symbolic links when listing files: > +If non-zero, CtrlP will follow symbolic links when listing files: > let g:ctrlp_follow_symlinks = 0 < -When enabled, looped internal symlinks will be ignored to avoid duplicates. + 0 - don't follow symbolic links. + 1 - follow but ignore looped internal symlinks to avoid duplicates. + 2 - follow all symlinks indiscriminately. *'g:ctrlp_lazy_update'* Set this to 1 to enable the lazy-update feature: only update the match window -after typing’s been stopped for a certain amount of time: > +after typing's been stopped for a certain amount of time: > let g:ctrlp_lazy_update = 0 < If is 1, update after 250ms. If bigger than 1, the number will be used as the delay time in milliseconds. *'g:ctrlp_default_input'* -Set this to 1 to enable seeding the prompt with the current file’s relative +Set this to 1 to enable seeding the prompt with the current file's relative path: > let g:ctrlp_default_input = 0 < *'g:ctrlp_use_migemo'* Set this to 1 to use Migemo Pattern for Japanese filenames. Migemo Search only -works in |regexp| mode. To split the pattern, separate words with space: > +works in regexp mode. To split the pattern, separate words with space: > let g:ctrlp_use_migemo = 0 < + *'g:ctrlp_prompt_mappings'* +Use this to customize the mappings inside CtrlP's prompt to your liking. You +only need to keep the lines that you've changed the values (inside []): > + let g:ctrlp_prompt_mappings = { + \ 'PrtBS()': ['', ''], + \ 'PrtDelete()': [''], + \ 'PrtDeleteWord()': [''], + \ 'PrtClear()': [''], + \ 'PrtSelectMove("j")': ['', ''], + \ 'PrtSelectMove("k")': ['', ''], + \ 'PrtSelectMove("t")': ['', ''], + \ 'PrtSelectMove("b")': ['', ''], + \ 'PrtSelectMove("u")': ['', ''], + \ 'PrtSelectMove("d")': ['', ''], + \ 'PrtHistory(-1)': [''], + \ 'PrtHistory(1)': [''], + \ 'AcceptSelection("e")': ['', '<2-LeftMouse>'], + \ 'AcceptSelection("h")': ['', '', ''], + \ 'AcceptSelection("t")': [''], + \ 'AcceptSelection("v")': ['', ''], + \ 'ToggleFocus()': [''], + \ 'ToggleRegex()': [''], + \ 'ToggleByFname()': [''], + \ 'ToggleType(1)': ['', ''], + \ 'ToggleType(-1)': ['', ''], + \ 'PrtExpandDir()': [''], + \ 'PrtInsert("c")': ['', ''], + \ 'PrtInsert()': [''], + \ 'PrtCurStart()': [''], + \ 'PrtCurEnd()': [''], + \ 'PrtCurLeft()': ['', '', ''], + \ 'PrtCurRight()': ['', ''], + \ 'PrtClearCache()': [''], + \ 'PrtDeleteEnt()': [''], + \ 'CreateNewFile()': [''], + \ 'MarkToOpen()': [''], + \ 'OpenMulti()': [''], + \ 'PrtExit()': ['', '', ''], + \ } +< +Note: In some terminals, it's not possible to remap without also changing + (|keycodes|). So if pressing moves the cursor to the left instead of +deleting a char for you, add this to your |.vimrc| to disable the plugin's +default mapping: > + let g:ctrlp_prompt_mappings = { 'PrtCurLeft()': ['', ''] } +< + +---------------------------------------- +MRU mode options:~ + + *'g:ctrlp_mruf_max'* +Specify the number of recently opened files you want CtrlP to remember: > + let g:ctrlp_mruf_max = 250 +< + + *'g:ctrlp_mruf_exclude'* +Files you don't want CtrlP to remember. Use regexp to specify the patterns: > + let g:ctrlp_mruf_exclude = '' +< +Examples: > + let g:ctrlp_mruf_exclude = '/tmp/.*\|/temp/.*' " MacOSX/Linux + let g:ctrlp_mruf_exclude = '^C:\\dev\\tmp\\.*' " Windows +< + + *'g:ctrlp_mruf_include'* +And if you want CtrlP to only remember some files, specify them here: > + let g:ctrlp_mruf_include = '' +< +Example: > + let g:ctrlp_mruf_include = '\.py$\|\.rb$' +< + + *'g:ctrlp_mruf_relative'* +Set this to 1 to show only MRU files in the current working directory: > + let g:ctrlp_mruf_relative = 0 +< + + *'g:ctrlp_mruf_default_order'* +Set this to 1 to disable sorting when searching in MRU mode: > + let g:ctrlp_mruf_default_order = 0 +< + + *'g:ctrlp_mruf_case_sensitive'* +Match this with your file system case-sensitivity setting to avoid duplicate +MRU entries: > + let g:ctrlp_mruf_case_sensitive = 1 +< + +---------------------------------------- +Advanced options:~ + *'g:ctrlp_status_func'* Use this to customize the statuslines for the CtrlP window: > let g:ctrlp_status_func = {} @@ -407,7 +467,7 @@ Structure of the functions: > " +- a:next : The next search mode. " | " +- a:marked : The number of marked files, or a comma separated list of - " the filenames. + " the marked filenames. return full_statusline endfunction @@ -422,6 +482,18 @@ Structure of the functions: > < See https://gist.github.com/1610859 for a working example. + *'g:ctrlp_buffer_func'* +Specify the functions that will be called after entering and before exiting the +CtrlP buffer: > + let g:ctrlp_buffer_func = {} +< +Example: > + let g:ctrlp_buffer_func = { + \ 'enter': 'Function_Name_1', + \ 'exit': 'Function_Name_2', + \ } +< + *'g:ctrlp_match_func'* Set an external fuzzy matching function for CtrlP to use: > let g:ctrlp_match_func = {} @@ -446,8 +518,8 @@ Structure of the function: > " | + "first-non-tab": match until the first tab char. " | + "until-last-tab": match until the last tab char. " | - " +- a:ispath : Is 1 when searching in file, buffer, mru, dir, and rtscript - " | modes. Is 0 otherwise. + " +- a:ispath : Is 1 when searching in file, buffer, mru, mixed, dir, and + " | rtscript modes. Is 0 otherwise. " | " +- a:crfile : The file in the current window. Should be excluded from the " | results when a:ispath == 1. @@ -467,6 +539,7 @@ COMMANDS *ctrlp-commands* If no argument is given, the value of |g:ctrlp_working_path_mode| will be used to determine the starting directory. + You can use to auto-complete the [starting-directory] when typing it. *:CtrlPBuffer* @@ -477,31 +550,27 @@ COMMANDS *ctrlp-commands* :CtrlPMRU Open CtrlP in find Most-Recently-Used file mode. + *:CtrlPLastMode* +:CtrlPLastMode + Open CtrlP in the last mode used. + + *:CtrlPRoot* +:CtrlPRoot + This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 2 (ignores the + variable's current value). + *:CtrlPClearCache* :CtrlPClearCache Flush the cache for the current working directory. The same as pressing inside CtrlP. - You can enable/disable caching with the |g:ctrlp_use_caching| option. + To enable or disable caching, use the |g:ctrlp_use_caching| option. *:CtrlPClearAllCaches* :CtrlPClearAllCaches - Delete all the cache files saved in |g:ctrlp_cache_dir|. - - *:CtrlPReload* -:CtrlPReload - Load new values for the option variables. + Delete all the cache files saved in |g:ctrlp_cache_dir| location. ------------------------------------------------------------------------------- -The following commands ignore the current value of |g:ctrlp_working_path_mode|: - -:CtrlPCurWD *:CtrlPCurWD* - This acts like |:CtrlP| with |path_mode| = 0 - -:CtrlPCurFile *:CtrlPCurFile* - This acts like |:CtrlP| with |path_mode| = 1 - -:CtrlPRoot *:CtrlPRoot* - This acts like |:CtrlP| with |path_mode| = 2 +For commands provided by bundled extensions, see |ctrlp-extensions|. =============================================================================== MAPPINGS *ctrlp-mappings* @@ -510,17 +579,18 @@ MAPPINGS *ctrlp-mappings* Default |Normal| mode mapping to open the CtrlP prompt in find file mode. +---------------------------------------- Once inside the prompt:~ 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 '>>>' *'ctrlp-fullregexp'* - Toggle between the string mode 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). + See also: |input-formats| (guide) and |g:ctrlp_regexp_search| (option). , 'forward' @@ -530,13 +600,19 @@ Once inside the prompt:~ Scroll to the 'previous' search mode in the sequence. - + *'ctrlp-autocompletion'* Auto-complete directory names under the current working directory inside the prompt. Toggle the focus between the match window and the prompt. + , + + Exit CtrlP. + +Moving:~ + , Move selection down. @@ -560,6 +636,8 @@ Once inside the prompt:~ Move the cursor one character to the 'right'. +Editing:~ + , Delete the preceding character. @@ -573,55 +651,66 @@ Once inside the prompt:~ Clear the input field. +Browsing input history:~ + + + Next string in the prompt's history. + + + Previous string in the prompt's history. + +Opening/Creating a file:~ + - Open selected file in the active window if possible. + Open the selected file in the 'current' window if possible. - Open selected file in a new 'tab' after the last tabpage. + Open the selected file in a new 'tab' after the last tabpage. - Open selected file in a 'vertical' split. + Open the selected file in a 'vertical' split. , , - Open selected file in a 'horizontal' split. + Open the selected file in a 'horizontal' split. Create a new file and its parent directories. - - Next string in the prompt’s history. - - - Previous string in the prompt’s history. +Opening multiple files:~ - Mark/unmark a file to be opened with . - - Or mark/unmark a file to create a new file in its directory using . + - Mark/unmark a file to create a new file in its directory using . Open files marked by . +Function keys:~ + - Refresh the match window and purge the cache for the current directory. - - Or remove deleted files from the MRU list. + - Remove deleted files from the MRU list. - Wipe the MRU list. - - Or delete MRU entries marked by . + - Delete MRU entries marked by . - - Insert the word under the cursor (in the current buffer) into the prompt. +Pasting:~ - , - , - - Exit CtrlP. - Note: can also be used to stop the scan if it’s taking too long. + , *'ctrlp-pasting'* + + Paste the clipboard content into the prompt. + + + Open a text dialog to paste , , the content of the search + register, the last visual selection, the clipboard or any register into the + prompt. Choose your own mappings with |g:ctrlp_prompt_mappings|. +---------------------------------------- When inside the match window (press to switch):~ a-z @@ -639,61 +728,78 @@ a) Simple string. E.g. 'abc' is understood internally as 'a[^a]\{-}b[^b]\{-}c' -b) Vim |regexp|. If the input string contains '*' or '|', it’ll be treated as - a Vim’s |regexp| |pattern| without any modification. +b) When in regexp mode, the input string's treated as a Vim's regexp |pattern| + without any modification. E.g. 'abc\d*efg' will be read as 'abc\d*efg'. - See also |ctrlp-fullregexp| (keymap) and |g:ctrlp_regexp_search| (option). + See |ctrlp-fullregexp| (keymap) and |g:ctrlp_regexp_search| (option) for + how to enable regexp mode. c) End the string with a colon ':' followed by a Vim command to execute that command after opening the file. If you need to use ':' literally, escape it with a backslash: '\:'. When opening multiple files, the command will be executed on each opening file. - E.g. 'abc:45' will open the selected file and jump to line 45. + E.g. Use ':45' to jump to line 45. - 'abc:/any\:string' will open the selected file and jump to the first - instance of 'any:string'. + Use ':/any\:string' to jump to the first instance of 'any:string'. - 'abc:+setf\ myfiletype|50' will open the selected file and set its - filetype to 'myfiletype', then jump to line 50. + Use ':+setf\ myfiletype|50' to set the filetype to 'myfiletype', then + jump to line 50. - 'abc:diffthis' will open the selected files and run |:diffthis| on the - first 4 files (if marked). + Use ':diffthis' when opening multiple files to run |:diffthis| on the + first 4 files. - See also Vim’s |++opt| and |+cmd|. + See also: Vim's |++opt| and |+cmd|. -d) Type exactly two dots '..' at the start of the prompt and press enter to go - backward in the directory tree by 1 level. If the parent directory is - large, this might be slow. +d) Submit two dots '..' to go upward the directory tree by 1 level. To go up + multiple levels, use one extra dot for each extra level: +> + Raw input Interpreted as + .. ../ + ... ../../ + .... ../../../ +< + Note: if the parent directories are large and uncached, this can be slow. -e) Similarly, submit '/' or '\' to find and go to the project’s root. If the - project is large, using a VCS listing command to look for files might help - speeding up the intial scan (see |g:ctrlp_user_command| for more details). + You can also use '@cd path/' to change CtrlP's local working directory. + Use '@cd %:h' to change to the directory of the current file. + +e) Similarly, submit '/' or '\' to find and go to the project's root. + + If the project is large, using a VCS listing command to look for files + might help speeding up the intial scan (see |g:ctrlp_user_command| for more + details). + + Note: d) and e) only work in file, directory and mixed modes. f) Type the name of a non-existent file and press to create it. Mark a file with to create the new file in the same directory as the marked file. - E.g. 'parentdir/newfile.txt' will create a directory named 'parentdir' as - well as 'newfile.txt'. + E.g. Using 'newdir/newfile.txt' will create a directory named 'newdir' as + well as a file named 'newfile.txt'. - If 'some/old/dirs/oldfile.txt' is marked with , then 'parentdir' - and 'newfile.txt' will be created in 'some/old/dirs'. The final path - will then be 'some/old/dirs/parentdir/newfile.txt'. + If an entry 'some/old/dirs/oldfile.txt' is marked with , then + 'newdir' and 'newfile.txt' will be created under 'some/old/dirs'. The + final path will then be 'some/old/dirs/newdir/newfile.txt'. - Use '\' in place of '/' on Windows (if |'ssl'| is not set). + Note: use '\' in place of '/' on Windows (if |'shellslash'| is not set). -g) Submit ? to open this help file. +g) In filename mode (toggle with ), you can use one primary pattern and + one refining pattern separated by a semicolon. Both patterns work like (a), + or (b) when in regexp mode. + +h) Submit ? to open this help file. =============================================================================== -EXTENSIONS *g:ctrlp-extensions* +EXTENSIONS *ctrlp-extensions* Extensions are optional. To enable an extension, add its name to the variable g:ctrlp_extensions: > let g:ctrlp_extensions = ['tag', 'buffertag', 'quickfix', 'dir', 'rtscript', - \ 'undo', 'line', 'changes'] + \ 'undo', 'line', 'changes', 'mixed', 'bookmarkdir'] < The order of the items will be the order they appear on the statusline and when using , . @@ -705,7 +811,7 @@ Available extensions:~ - Name: 'tag' - Command: ':CtrlPTag' - Search for a tag within a generated central tags file, and jump to the - definition. Use the Vim’s option |'tags'| to specify the names and the + definition. Use the Vim's option |'tags'| to specify the names and the locations of the tags file(s). E.g. set tags+=doc/tags @@ -713,7 +819,7 @@ Available extensions:~ *:CtrlPBufTagAll* * Buffer Tag mode:~ - Name: 'buffertag' - - Commands: ':CtrlPBufTag [buffer-name]', + - Commands: ':CtrlPBufTag [buffer]', ':CtrlPBufTagAll'. - Search for a tag within the current buffer or all listed buffers and jump to the definition. Requires |exuberant_ctags| or compatible programs. @@ -733,7 +839,7 @@ Available extensions:~ + change the local working directory for CtrlP and keep it open. + change the global working directory (exit). + change the local working directory for the current window (exit). - + change the global working directory to CtrlP’s current local + + change the global working directory to CtrlP's current local working directory (exit). *:CtrlPRTS* @@ -758,21 +864,43 @@ Available extensions:~ *:CtrlPChangeAll* * Change list mode:~ - Name: 'changes' - - Commands: ':CtrlPChange [buffer-name]', + - Commands: ':CtrlPChange [buffer]', ':CtrlPChangeAll'. - Search for and jump to a recent change in the current buffer or in all listed buffers. -------------------------------------------------------------------------------- + *:CtrlPMixed* + * Mixed mode:~ + - Name: 'mixed' + - Command: ':CtrlPMixed' + - Search in files, buffers and MRU files at the same time. + + *:CtrlPBookmarkDir* + *:CtrlPBookmarkDirAdd* + * BookmarkDir mode:~ + - Name: 'bookmarkdir' + - Commands: ':CtrlPBookmarkDir', + ':CtrlPBookmarkDirAdd [directory]'. + - Search for a bookmarked directory and change the working directory to it. + - Mappings: + + change the local working directory for CtrlP, keep it open and + switch to find file mode. + + change the global working directory (exit). + + change the local working directory for the current window (exit). + + + - Wipe bookmark list. + - Delete entries marked by . + +---------------------------------------- Buffer Tag mode options:~ *'g:ctrlp_buftag_ctags_bin'* -If ctags isn’t in your $PATH, use this to set its location: > +If ctags isn't in your $PATH, use this to set its location: > let g:ctrlp_buftag_ctags_bin = '' < *'g:ctrlp_buftag_systemenc'* -Match this with your OS’s encoding (not Vim’s). The default value mirrors Vim’s +Match this with your OS's encoding (not Vim's). The default value mirrors Vim's global |'encoding'| option: > let g:ctrlp_buftag_systemenc = &encoding < @@ -799,12 +927,12 @@ Highlighting:~ CtrlPNoEntries : the message when no match is found (Error) CtrlPMatch : the matched pattern (Identifier) CtrlPLinePre : the line prefix '>' in the match window - CtrlPPrtBase : the prompt’s base (Comment) - CtrlPPrtText : the prompt’s text (|hl-Normal|) - CtrlPPrtCursor : the prompt’s cursor when moving over the text (Constant) + CtrlPPrtBase : the prompt's base (Comment) + CtrlPPrtText : the prompt's text (|hl-Normal|) + CtrlPPrtCursor : the prompt's cursor when moving over the text (Constant) * In extensions: - CtrlPTabExtra : the part of each line that’s not matched against (Comment) + CtrlPTabExtra : the part of each line that's not matched against (Comment) CtrlPBufName : the buffer name an entry belongs to (|hl-Directory|) CtrlPTagKind : the kind of the tag in buffer-tag mode (|hl-Title|) CtrlPqfLineCol : the line and column numbers in quickfix mode (Comment) @@ -813,6 +941,7 @@ Highlighting:~ CtrlPUndoNr : the undo number inside [] in undo mode (String) CtrlPUndoSv : the point where the file was saved (Comment) CtrlPUndoPo : the current position in the undo tree (|hl-Title|) + CtrlPBookmark : the name of the bookmark (Identifier) Statuslines:~ * Highlight groups: @@ -825,7 +954,7 @@ Statuslines:~ =============================================================================== MISCELLANEOUS CONFIGS *ctrlp-miscellaneous-configs* -* Use |wildignore| for |g:ctrlp_user_command|: +* Using |wildignore| for |g:ctrlp_user_command|: > function! s:wig2cmd() " Change wildignore into space or | separated groups @@ -847,12 +976,12 @@ MISCELLANEOUS CONFIGS *ctrlp-miscellaneous-configs* < (submitted by Rich Alesi ) -* 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: +* 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 + if cph =~ '^.\+://' | 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 @@ -864,12 +993,17 @@ MISCELLANEOUS CONFIGS *ctrlp-miscellaneous-configs* < (requires Vim 7.1.299+) +* Using a |count| to invoke different commands using the same mapping: +> + let g:ctrlp_cmd = 'exe "CtrlP".get(["", "Buffer", "MRU"], v:count)' +< + =============================================================================== CREDITS *ctrlp-credits* Developed by Kien Nguyen . -Project’s homepage: http://kien.github.com/ctrlp.vim +Project's homepage: http://kien.github.com/ctrlp.vim Git repository: https://github.com/kien/ctrlp.vim Mercurial repository: https://bitbucket.org/kien/ctrlp.vim @@ -891,14 +1025,38 @@ Special thanks:~ * Kent Sibilev * Tacahiroy * Luca Pette + * Seth Fowler + * Lowe Thiderman =============================================================================== CHANGELOG *ctrlp-changelog* +Before 2012/06/15~ + + + New value for |g:ctrlp_follow_symlinks|: 2. + + New value for |g:ctrlp_open_multiple_files|: 'j'. + + Allow using , , to open files marked by . + + Extend '..' (|ctrlp-input-formats| (d)) + + New input format: '@cd' (|ctrlp-input-formats| (d)) + +Before 2012/04/30~ + + + New option: |g:ctrlp_mruf_default_order| + + New feature: Bookmarked directories extension. + + New commands: |:CtrlPBookmarkDir| + |:CtrlPBookmarkDirAdd| + +Before 2012/04/15~ + + + New option: |g:ctrlp_buffer_func|, callback functions for CtrlP buffer. + + Remove: g:ctrlp_mruf_last_entered, make it a default for MRU mode. + + New commands: |:CtrlPLastMode|, open CtrlP in the last mode used. + |:CtrlPMixed|, search in files, buffers and MRU files. + Before 2012/03/31~ - + New option: |g:ctrlp_default_input|, default input when entering CtrlP. - |g:ctrlp_match_func|, allow using a custom fuzzy matcher. + + New options: |g:ctrlp_default_input|, default input when entering CtrlP. + |g:ctrlp_match_func|, allow using a custom fuzzy matcher. + Rename: *ClearCtrlPCache* -> |CtrlPClearCache| *ClearAllCtrlPCaches* -> |CtrlPClearAllCaches| @@ -959,7 +1117,7 @@ Before 2011/10/30~ Before 2011/10/12~ + New features: Open multiple files. - Pass Vim’s |++opt| and |+cmd| to the opening file + Pass Vim's |++opt| and |+cmd| to the opening file (|ctrlp-input-formats| (c)) Auto-complete each dir for |:CtrlP| [starting-directory] + New mappings: mark/unmark a file to be opened with . diff --git a/bundle/git_ctrlp/plugin/ctrlp.vim b/bundle/git_ctrlp/plugin/ctrlp.vim index 75c4f5a..245f712 100644 --- a/bundle/git_ctrlp/plugin/ctrlp.vim +++ b/bundle/git_ctrlp/plugin/ctrlp.vim @@ -1,6 +1,6 @@ " ============================================================================= " File: plugin/ctrlp.vim -" Description: Fuzzy file, buffer, mru and tag finder. +" Description: Fuzzy file, buffer, mru, tag, etc finder. " Author: Kien Nguyen " ============================================================================= " GetLatestVimScripts: 3736 1 :AutoInstall: ctrlp.zip @@ -11,7 +11,8 @@ en let g:loaded_ctrlp = 1 let [g:ctrlp_lines, g:ctrlp_allfiles, g:ctrlp_alltags, g:ctrlp_alldirs, - \ g:ctrlp_buftags, g:ctrlp_builtins] = [[], [], [], [], {}, 2] + \ g:ctrlp_allmixes, g:ctrlp_buftags, g:ctrlp_ext_vars, g:ctrlp_builtins] + \ = [[], [], [], [], {}, {}, [], 2] if !exists('g:ctrlp_map') | let g:ctrlp_map = '' | en if !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en @@ -21,6 +22,8 @@ com! -n=? -com=dir CtrlP cal ctrlp#init(0, ) com! CtrlPBuffer cal ctrlp#init(1) com! CtrlPMRUFiles cal ctrlp#init(2) +com! CtrlPLastMode cal ctrlp#init(-1) + com! CtrlPClearCache cal ctrlp#clr() com! CtrlPClearAllCaches cal ctrlp#clra() com! CtrlPReload cal ctrlp#reset() @@ -39,22 +42,20 @@ en cal ctrlp#mrufiles#init() -com! CtrlPTag cal ctrlp#init(ctrlp#tag#id()) - -com! CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id()) - -com! -n=? -com=dir CtrlPDir cal ctrlp#init(ctrlp#dir#id(), ) - +com! CtrlPTag cal ctrlp#init(ctrlp#tag#id()) +com! CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id()) +com! -n=? -com=dir CtrlPDir + \ cal ctrlp#init(ctrlp#dir#id(), ) com! -n=? -com=buffer CtrlPBufTag \ cal ctrlp#init(ctrlp#buffertag#cmd(0, )) -com! CtrlPBufTagAll cal ctrlp#init(ctrlp#buffertag#cmd(1)) - -com! CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id()) - -com! CtrlPUndo cal ctrlp#init(ctrlp#undo#id()) - -com! CtrlPLine cal ctrlp#init(ctrlp#line#id()) - +com! CtrlPBufTagAll cal ctrlp#init(ctrlp#buffertag#cmd(1)) +com! CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id()) +com! CtrlPUndo cal ctrlp#init(ctrlp#undo#id()) +com! CtrlPLine cal ctrlp#init(ctrlp#line#id()) com! -n=? -com=buffer CtrlPChange \ cal ctrlp#init(ctrlp#changes#cmd(0, )) -com! CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1)) +com! CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1)) +com! CtrlPMixed cal ctrlp#init(ctrlp#mixed#id()) +com! CtrlPBookmarkDir cal ctrlp#init(ctrlp#bookmarkdir#id()) +com! -n=? -com=dir CtrlPBookmarkDirAdd + \ cal ctrlp#call('ctrlp#bookmarkdir#add', ) diff --git a/bundle/git_ctrlp/readme.md b/bundle/git_ctrlp/readme.md index 3ae6360..af6b554 100644 --- a/bundle/git_ctrlp/readme.md +++ b/bundle/git_ctrlp/readme.md @@ -1,56 +1,69 @@ # ctrlp.vim -Full path fuzzy __file__, __buffer__, __mru__ and __tag__ finder for Vim. +Fuzzy __file__, __buffer__, __mru__, __tag__, ... finder for Vim. -* Written in pure Vimscript for MacVim and Vim 7.0+. -* Full support for Vim’s regexp as search pattern. +* Written in pure Vimscript for MacVim, gVim and Vim 7.0+. +* Full support for Vim's regexp as search patterns. * Built-in Most Recently Used (MRU) files monitoring. -* Built-in project’s root finder. -* Open Multiple Files. -* [Extensible][3]. +* Built-in project's root finder. +* Open multiple files at once. +* Create new files and directories. +* [Extensible][2]. ![ctrlp][1] -## Basic Usage -* Press `` or run `:CtrlP` to invoke CtrlP in find file mode. -* Or run `:CtrlPBuffer` or `:CtrlPMRU` to invoke CtrlP in buffer or MRU mode. +## Installation +1. Clone the plugin into a separate directory: -Once CtrlP is open: - -* 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. -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. -* Use `` to create a new file and its parent dirs. -* Use `` to mark/unmark files and `` to open them. - -## Basic Options -* Change the mapping to invoke CtrlP: - - ```vim - let g:ctrlp_map = '' + ``` + $ cd ~/.vim + $ git clone https://github.com/kien/ctrlp.vim.git bundle/ctrlp.vim ``` -* When CtrlP is invoked, it automatically sets its local working directory -according to this variable: +2. Add to your `~/.vimrc`: + + ```vim + set runtimepath^=~/.vim/bundle/ctrlp.vim + ``` + +3. Run at Vim's command line: + + ``` + :helptags ~/.vim/bundle/ctrlp.vim/doc + ``` + +4. Restart Vim and start reading `:help ctrlp.txt` for usage and configuration details. + +On Windows, use the `$HOME/vimfiles` or the `$VIM/vimfiles` directory instead of the `~/.vim` directory. + +## Usage +1. See `:help ctrlp-commands` and `:help ctrlp-extensions`. +2. Once the prompt's open: + * Press `` and `` to cycle between 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. + * Submit two or more dots `..` to go up the directory tree by one or multiple levels. + * Use ``, `` to go to the next/previous string in the prompt's history. + * Use `` to create a new file and its parent dirs. + * Use `` to mark/unmark multiple files and `` to open them. + * End the input string with a colon `:` followed by a command to execute it on the opening file(s). + + More at `:help ctrlp-mappings`. + +## Configuration +* Unless a starting directory is specified, the local working directory will be set according to this variable: ```vim let g:ctrlp_working_path_mode = 2 ``` - 0 - don’t manage working directory. - 1 - the parent directory of the current file. + 0 - don't manage working directory. + 1 - the directory of the current file. 2 - the nearest ancestor that contains one of these directories or files: - `.git/` `.hg/` `.svn/` `.bzr/` `_darcs/` + `.git` `.hg` `.svn` `.bzr` `_darcs` -* 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: + Define additional root markers with the `g:ctrlp_root_markers` option. + +* Exclude files and directories: ```vim set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux @@ -64,15 +77,14 @@ option `wildignore` and/or the option `g:ctrlp_custom_ignore`. Examples: \ } ``` -* Use a custom file listing command with: +* Use a custom file listing command: ```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 ``` -_Check [the docs][2] for more mappings, commands and options._ +More at `:help ctrlp-options`. [1]: http://i.imgur.com/yIynr.png -[2]: https://github.com/kien/ctrlp.vim/blob/master/doc/ctrlp.txt -[3]: https://github.com/kien/ctrlp.vim/tree/extensions +[2]: https://github.com/kien/ctrlp.vim/tree/extensions diff --git a/bundle/git_syntastic/autoload/syntastic/c.vim b/bundle/git_syntastic/autoload/syntastic/c.vim index 49f7099..8d32949 100644 --- a/bundle/git_syntastic/autoload/syntastic/c.vim +++ b/bundle/git_syntastic/autoload/syntastic/c.vim @@ -128,7 +128,7 @@ function! syntastic#c#SearchHeaders() " search included headers for hfile in files if hfile != '' - let filename = expand('%:p:h') . ((has('win32') || has('win64')) ? + let filename = expand('%:p:h') . (has('win32') ? \ '\' : '/') . hfile try let lines = readfile(filename, '', 100) diff --git a/bundle/git_syntastic/plugin/syntastic.vim b/bundle/git_syntastic/plugin/syntastic.vim index e2c56c9..39e9a55 100644 --- a/bundle/git_syntastic/plugin/syntastic.vim +++ b/bundle/git_syntastic/plugin/syntastic.vim @@ -17,7 +17,7 @@ if exists("g:loaded_syntastic_plugin") endif let g:loaded_syntastic_plugin = 1 -let s:running_windows = has("win16") || has("win32") || has("win64") +let s:running_windows = has("win16") || has("win32") if !s:running_windows let s:uname = system('uname') @@ -185,6 +185,8 @@ function! s:CacheErrors() for ft in split(fts, '\.') if s:Checkable(ft) let errors = SyntaxCheckers_{ft}_GetLocList() + "keep only lines that effectively match an error/warning + let errors = s:FilterLocList({'valid': 1}, errors) "make errors have type "E" by default call SyntasticAddToErrors(errors, {'type': 'E'}) call extend(s:LocList(), errors) @@ -529,10 +531,10 @@ endfunction " 'subtype' - all errors will be assigned the given subtype function! SyntasticMake(options) let old_loclist = getloclist(0) - let old_makeprg = &makeprg + let old_makeprg = &l:makeprg let old_shellpipe = &shellpipe let old_shell = &shell - let old_errorformat = &errorformat + let old_errorformat = &l:errorformat if !s:running_windows && (s:uname !~ "FreeBSD") "this is a hack to stop the screen needing to be ':redraw'n when @@ -542,19 +544,19 @@ function! SyntasticMake(options) endif if has_key(a:options, 'makeprg') - let &makeprg = a:options['makeprg'] + let &l:makeprg = a:options['makeprg'] endif if has_key(a:options, 'errorformat') - let &errorformat = a:options['errorformat'] + let &l:errorformat = a:options['errorformat'] endif silent lmake! let errors = getloclist(0) call setloclist(0, old_loclist) - let &makeprg = old_makeprg - let &errorformat = old_errorformat + let &l:makeprg = old_makeprg + let &l:errorformat = old_errorformat let &shellpipe=old_shellpipe let &shell=old_shell diff --git a/bundle/git_syntastic/syntax_checkers/c.vim b/bundle/git_syntastic/syntax_checkers/c.vim index 8da23f3..a2cedfb 100644 --- a/bundle/git_syntastic/syntax_checkers/c.vim +++ b/bundle/git_syntastic/syntax_checkers/c.vim @@ -125,7 +125,7 @@ function! SyntaxCheckers_c_GetLocList() endif " add optional config file parameters - let makeprg .= syntastic#c#ReadConfig(g:syntastic_c_config_file) + let makeprg .= ' '.syntastic#c#ReadConfig(g:syntastic_c_config_file) " process makeprg let errors = SyntasticMake({ 'makeprg': makeprg, diff --git a/bundle/git_syntastic/syntax_checkers/cpp.vim b/bundle/git_syntastic/syntax_checkers/cpp.vim index 20528e4..16bebde 100644 --- a/bundle/git_syntastic/syntax_checkers/cpp.vim +++ b/bundle/git_syntastic/syntax_checkers/cpp.vim @@ -113,7 +113,7 @@ function! SyntaxCheckers_cpp_GetLocList() endif " add optional config file parameters - let makeprg .= syntastic#c#ReadConfig(g:syntastic_cpp_config_file) + let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_cpp_config_file) " process makeprg let errors = SyntasticMake({ 'makeprg': makeprg, diff --git a/bundle/git_syntastic/syntax_checkers/d.vim b/bundle/git_syntastic/syntax_checkers/d.vim new file mode 100644 index 0000000..19d2302 --- /dev/null +++ b/bundle/git_syntastic/syntax_checkers/d.vim @@ -0,0 +1,140 @@ +"============================================================================ +"File: d.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Alfredo Di Napoli +"License: Based on the original work of Gregor Uhlenheuer and his +" cpp.vim checker so credits are dued. +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +" OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +" HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +" OTHER DEALINGS IN THE SOFTWARE. +" +"============================================================================ + +" in order to also check header files add this to your .vimrc: +" (this usually creates a .gch file in your source directory) +" +" let g:syntastic_d_check_header = 1 +" +" To disable the search of included header files after special +" libraries like gtk and glib add this line to your .vimrc: +" +" let g:syntastic_d_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_d_include_dirs. This list can be used like this: +" +" let g:syntastic_d_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. +" In order to force syntastic to refresh the header includes simply +" unlet b:syntastic_d_includes. Then the header files are being re-checked +" on the next file write. +" +" let g:syntastic_d_auto_refresh_includes = 1 +" +" Alternatively you can set the buffer local variable b:syntastic_d_cflags. +" If this variable is set for the current buffer no search for additional +" libraries is done. I.e. set the variable like this: +" +" let b:syntastic_d_cflags = ' -I/usr/include/libsoup-2.4' +" +" Moreover it is possible to add additional compiler options to the syntax +" checking execution via the variable 'g:syntastic_d_compiler_options': +" +" let g:syntastic_d_compiler_options = ' -std=c++0x' +" +" Additionally the setting 'g:syntastic_d_config_file' allows you to define +" a file that contains additional compiler arguments like include directories +" or CFLAGS. The file is expected to contain one option per line. If none is +" given the filename defaults to '.syntastic_d_config': +" +" let g:syntastic_d_config_file = '.config' +" +" Using the global variable 'g:syntastic_d_remove_include_errors' you can +" specify whether errors of files included via the +" g:syntastic_d_include_dirs' setting are removed from the result set: +" +" let g:syntastic_d_remove_include_errors = 1 + +if exists('loaded_d_syntax_checker') + finish +endif +let loaded_d_syntax_checker = 1 + +if !executable('dmd') + finish +endif + +let s:save_cpo = &cpo +set cpo&vim + +if !exists('g:syntastic_d_config_file') + let g:syntastic_d_config_file = '.syntastic_d_config' +endif + +function! SyntaxCheckers_d_GetLocList() + let makeprg = 'dmd -of/dev/null -c ' + let errorformat = '%-G%f:%s:,%f(%l): %m,%f:%l: %m' + + if exists('g:syntastic_d_compiler_options') + let makeprg .= g:syntastic_d_compiler_options + endif + + let makeprg .= ' ' . shellescape(expand('%')) . + \ ' ' . syntastic#c#GetIncludeDirs('d') + + if expand('%') =~? '\%(.di\)$' + if exists('g:syntastic_d_check_header') + let makeprg = 'dmd -c '.shellescape(expand('%')). + \ ' ' . syntastic#c#GetIncludeDirs('d') + else + return [] + endif + endif + + if !exists('b:syntastic_d_cflags') + if !exists('g:syntastic_d_no_include_search') || + \ g:syntastic_d_no_include_search != 1 + if exists('g:syntastic_d_auto_refresh_includes') && + \ g:syntastic_d_auto_refresh_includes != 0 + let makeprg .= syntastic#c#SearchHeaders() + else + if !exists('b:syntastic_d_includes') + let b:syntastic_d_includes = syntastic#c#SearchHeaders() + endif + let makeprg .= b:syntastic_d_includes + endif + endif + else + let makeprg .= b:syntastic_d_cflags + endif + + " add optional config file parameters + let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_d_config_file) + + " process makeprg + let errors = SyntasticMake({ 'makeprg': makeprg, + \ 'errorformat': errorformat }) + + " filter the processed errors if desired + if exists('g:syntastic_d_remove_include_errors') && + \ g:syntastic_d_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 +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/bundle/git_syntastic/syntax_checkers/efm_perl.pl b/bundle/git_syntastic/syntax_checkers/efm_perl.pl index 570d6e7..3d75418 100644 --- a/bundle/git_syntastic/syntax_checkers/efm_perl.pl +++ b/bundle/git_syntastic/syntax_checkers/efm_perl.pl @@ -4,6 +4,7 @@ # with the quickfix mode of Vim # # Copyright (©) 2001 by Jörg Ziefle +# Copyright (c) 2012 Eric Harmon # You may use and distribute this software under the same terms as Perl itself. # # Usage: put one of the two configurations below in your ~/.vimrc (without the @@ -13,25 +14,27 @@ # Program is run interactively with 'perl -w': # # set makeprg=$HOME/bin/vimparse.pl\ %\ $* -# set errorformat=%f:%l:%m +# set errorformat=%t:%f:%l:%m # # Program is only compiled with 'perl -wc': # # set makeprg=$HOME/bin/vimparse.pl\ -c\ %\ $* -# set errorformat=%f:%l:%m +# set errorformat=%t:%f:%l:%m # # Usage: -# vimparse.pl [-c] [-f ] [programargs] +# vimparse.pl [-c] [-w] [-f ] [programargs] # # -c compile only, don't run (perl -wc) +# -w output warnings as warnings instead of errors (slightly slower) # -f write errors to # # Example usages: # * From the command line: # vimparse.pl program.pl # -# vimparse.pl -c -f errorfile program.pl +# vimparse.pl -c -w -f errorfile program.pl # Then run vim -q errorfile to edit the errors with Vim. +# This uses the custom errorformat: %t:%f:%l:%m. # # * From Vim: # Edit in Vim (and save, if you don't have autowrite on), then @@ -39,6 +42,9 @@ # to error check. # # Version history: +# 0.3 (05/31/2012): +# * Added support for the seperate display of warnings +# * Switched output format to %t:%f:%l:%m to support error levels # 0.2 (04/12/2001): # * First public version (sent to Bram) # * -c command line option for compiling only @@ -64,11 +70,11 @@ use strict; use Getopt::Std; -use vars qw/$opt_c $opt_f $opt_h/; # needed for Getopt in combination with use strict 'vars' +use vars qw/$opt_c $opt_w $opt_f $opt_h/; # needed for Getopt in combination with use strict 'vars' use constant VERSION => 0.2; -getopts('cf:h'); +getopts('cwf:h'); &usage if $opt_h; # not necessarily needed, but good for further extension @@ -86,20 +92,33 @@ my $handle = (defined $opt_f ? \*FILE : \*STDOUT); (my $file = shift) or &usage; # display usage if no filename is supplied my $args = (@ARGV ? ' ' . join ' ', @ARGV : ''); -my @lines = `perl @{[defined $opt_c ? '-c ' : '' ]} -w "$file$args" 2>&1`; +my @error_lines = `perl @{[defined $opt_c ? '-c ' : '' ]} @{[defined $opt_w ? '-X ' : '-w ']} "$file$args" 2>&1`; + +my @lines = map { "E:$_" } @error_lines; + +my @warn_lines; +if(defined($opt_w)) { + @warn_lines = `perl @{[defined $opt_c ? '-c ' : '' ]} -w "$file$args" 2>&1`; +} + +# Any new errors must be warnings +foreach my $line (@warn_lines) { + if(!grep { $_ eq $line } @error_lines) { + push(@lines, "W:$line"); + } +} my $errors = 0; foreach my $line (@lines) { chomp($line); - my ($file, $lineno, $message, $rest); + my ($file, $lineno, $message, $rest, $severity); - if ($line =~ /^(.*)\sat\s(.*)\sline\s(\d+)(\.|,\snear\s\".*\")$/) { - - ($message, $file, $lineno, $rest) = ($1, $2, $3, $4); + if ($line =~ /^(.*)\sat\s(.*)\sline\s(\d+)(.*)$/) { + ($severity, $message, $file, $lineno, $rest) = ($1, $2, $3, $4, $5); $errors++; $message .= $rest if ($rest =~ s/^,//); - print $handle "$file:$lineno:$message\n"; + print $handle "$severity:$file:$lineno:$message\n"; } else { next }; @@ -129,9 +148,10 @@ sub usage { (local $0 = $0) =~ s/^.*\/([^\/]+)$/$1/; # remove path from name of program print<] [programargs] + $0 [-c] [-w] [-f ] [programargs] - -c compile only, don't run (executes 'perl -wc') + -c compile only, don't run (executes 'perl -c') + -w output warnings as warnings instead of errors (slightly slower) -f write errors to Examples: @@ -139,8 +159,9 @@ Examples: $0 program.pl Displays output on STDOUT. - $0 -c -f errorfile program.pl + $0 -c -w -f errorfile program.pl Then run 'vim -q errorfile' to edit the errors with Vim. + This uses the custom errorformat: %t:%f:%l:%m. * In Vim: Edit in Vim (and save, if you don't have autowrite on), then diff --git a/bundle/git_syntastic/syntax_checkers/eruby.vim b/bundle/git_syntastic/syntax_checkers/eruby.vim index fcff063..52cec3a 100644 --- a/bundle/git_syntastic/syntax_checkers/eruby.vim +++ b/bundle/git_syntastic/syntax_checkers/eruby.vim @@ -20,7 +20,7 @@ if !executable("ruby") || !executable("cat") endif function! SyntaxCheckers_eruby_GetLocList() - if has('win32') || has('win64') + if has('win32') let makeprg='sed "s/<\%=/<\%/g" '. shellescape(expand("%")) . ' \| ruby -e "require \"erb\"; puts ERB.new(ARGF.read, nil, \"-\").src" \| ruby -c' else let makeprg='sed "s/<\%=/<\%/g" '. shellescape(expand("%")) . ' \| RUBYOPT= ruby -e "require \"erb\"; puts ERB.new(ARGF.read, nil, \"-\").src" \| RUBYOPT= ruby -c' diff --git a/bundle/git_syntastic/syntax_checkers/go.vim b/bundle/git_syntastic/syntax_checkers/go.vim index 6d78b48..b48d07d 100644 --- a/bundle/git_syntastic/syntax_checkers/go.vim +++ b/bundle/git_syntastic/syntax_checkers/go.vim @@ -18,5 +18,5 @@ if exists("loaded_go_syntax_checker") endif let loaded_go_syntax_checker = 1 -let s:supported_checkers = ["6g", "gofmt"] +let s:supported_checkers = ["go", "6g", "gofmt"] call SyntasticLoadChecker(s:supported_checkers, 'go') diff --git a/bundle/git_syntastic/syntax_checkers/go/go.vim b/bundle/git_syntastic/syntax_checkers/go/go.vim new file mode 100644 index 0000000..8b3dd5c --- /dev/null +++ b/bundle/git_syntastic/syntax_checkers/go/go.vim @@ -0,0 +1,17 @@ +"============================================================================ +"File: go.vim +"Description: Check go syntax using 'go build' +"Maintainer: Kamil Kisiel +"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_go_GetLocList() + let makeprg = 'go build -o /dev/null' + let errorformat = '%f:%l:%c:%m,%f:%l%m,%-G#%.%#' + + return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) +endfunction diff --git a/bundle/git_syntastic/syntax_checkers/html.vim b/bundle/git_syntastic/syntax_checkers/html.vim index 2c1b8b4..4aace24 100644 --- a/bundle/git_syntastic/syntax_checkers/html.vim +++ b/bundle/git_syntastic/syntax_checkers/html.vim @@ -14,73 +14,16 @@ if exists("loaded_html_syntax_checker") endif let loaded_html_syntax_checker = 1 -"bail if the user doesnt have tidy or grep installed -if !executable("tidy") || !executable("grep") - finish +if !exists('g:syntastic_html_checker') + let g:syntastic_html_checker = "tidy" endif -" TODO: join this with xhtml.vim for DRY's sake? -function! s:TidyEncOptByFenc() - let tidy_opts = { - \'utf-8' : '-utf8', - \'ascii' : '-ascii', - \'latin1' : '-latin1', - \'iso-2022-jp' : '-iso-2022', - \'cp1252' : '-win1252', - \'macroman' : '-mac', - \'utf-16le' : '-utf16le', - \'utf-16' : '-utf16', - \'big5' : '-big5', - \'sjis' : '-shiftjis', - \'cp850' : '-ibm858', - \} - return get(tidy_opts, &fileencoding, '-utf8') -endfunction - -let s:ignore_html_errors = [ - \ " lacks \"summary\" attribute", - \ "not approved by W3C", - \ "attribute \"placeholder\"", - \ " proprietary attribute \"charset\"", - \ " lacks \"content\" attribute", - \ "inserting \"type\" attribute", - \ "proprietary attribute \"data-" - \] - -function! s:ValidateError(text) - let valid = 0 - for i in s:ignore_html_errors - if stridx(a:text, i) != -1 - let valid = 1 - break - endif - endfor - return valid -endfunction - - -function! SyntaxCheckers_html_GetLocList() - - let encopt = s:TidyEncOptByFenc() - let makeprg="tidy ".encopt." --new-blocklevel-tags ".shellescape('section, article, aside, hgroup, header, footer, nav, figure, figcaption')." --new-inline-tags ".shellescape('video, audio, embed, mark, progress, meter, time, ruby, rt, rp, canvas, command, details, datalist')." --new-empty-tags ".shellescape('wbr, keygen')." -e ".shellescape(expand('%'))." 2>&1" - let errorformat='%Wline %l column %c - Warning: %m,%Eline %l column %c - Error: %m,%-G%.%#,%-G%.%#' - let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) - - " process loclist since we need to add some info and filter out valid HTML5 - " from the errors - let n = len(loclist) - 1 - let bufnum = bufnr("") - while n >= 0 - let i = loclist[n] - " filter out valid HTML5 - if s:ValidateError(i['text']) == 1 - unlet loclist[n] - else - "the file name isnt in the output so stick in the buf num manually - let i['bufnr'] = bufnum - endif - let n -= 1 - endwhile - - return loclist -endfunction +if g:syntastic_html_checker == "tidy" + if executable("tidy") && executable("grep") + runtime! syntax_checkers/html/tidy.vim + endif +elseif g:syntastic_html_checker == "w3" + if executable("curl") && executable("sed") + runtime! syntax_checkers/html/w3.vim + endif +endif diff --git a/bundle/git_syntastic/syntax_checkers/html/tidy.vim b/bundle/git_syntastic/syntax_checkers/html/tidy.vim new file mode 100644 index 0000000..5e52f80 --- /dev/null +++ b/bundle/git_syntastic/syntax_checkers/html/tidy.vim @@ -0,0 +1,74 @@ +"============================================================================ +"File: tidy.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. +" +"============================================================================ +" TODO: join this with xhtml.vim for DRY's sake? +function! s:TidyEncOptByFenc() + let tidy_opts = { + \'utf-8' : '-utf8', + \'ascii' : '-ascii', + \'latin1' : '-latin1', + \'iso-2022-jp' : '-iso-2022', + \'cp1252' : '-win1252', + \'macroman' : '-mac', + \'utf-16le' : '-utf16le', + \'utf-16' : '-utf16', + \'big5' : '-big5', + \'sjis' : '-shiftjis', + \'cp850' : '-ibm858', + \} + return get(tidy_opts, &fileencoding, '-utf8') +endfunction + +let s:ignore_html_errors = [ + \ "
lacks \"summary\" attribute", + \ "not approved by W3C", + \ "attribute \"placeholder\"", + \ " proprietary attribute \"charset\"", + \ " lacks \"content\" attribute", + \ "inserting \"type\" attribute", + \ "proprietary attribute \"data-" + \] + +function! s:ValidateError(text) + let valid = 0 + for i in s:ignore_html_errors + if stridx(a:text, i) != -1 + let valid = 1 + break + endif + endfor + return valid +endfunction + +function! SyntaxCheckers_html_GetLocList() + let encopt = s:TidyEncOptByFenc() + let makeprg="tidy ".encopt." --new-blocklevel-tags ".shellescape('section, article, aside, hgroup, header, footer, nav, figure, figcaption')." --new-inline-tags ".shellescape('video, audio, embed, mark, progress, meter, time, ruby, rt, rp, canvas, command, details, datalist')." --new-empty-tags ".shellescape('wbr, keygen')." -e ".shellescape(expand('%'))." 2>&1" + let errorformat='%Wline %l column %c - Warning: %m,%Eline %l column %c - Error: %m,%-G%.%#,%-G%.%#' + let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + " process loclist since we need to add some info and filter out valid HTML5 + " from the errors + let n = len(loclist) - 1 + let bufnum = bufnr("") + while n >= 0 + let i = loclist[n] + " filter out valid HTML5 + if s:ValidateError(i['text']) == 1 + unlet loclist[n] + else + "the file name isnt in the output so stick in the buf num manually + let i['bufnr'] = bufnum + endif + let n -= 1 + endwhile + + return loclist +endfunction diff --git a/bundle/git_syntastic/syntax_checkers/html/w3.vim b/bundle/git_syntastic/syntax_checkers/html/w3.vim new file mode 100644 index 0000000..032de31 --- /dev/null +++ b/bundle/git_syntastic/syntax_checkers/html/w3.vim @@ -0,0 +1,32 @@ +"============================================================================ +"File: w3.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_html_GetLocList() + let makeprg2="curl -s -F output=text -F \"uploaded_file=@".expand('%:p').";type=text/html\" http://validator.w3.org/check \\| sed -n -e '/\Line\.\*/ \{ N; s/\\n//; N; s/\\n//; /msg/p; \}' -e ''/msg_warn/p'' -e ''/msg_info/p'' \\| sed -e 's/[ ]\\+/ /g' -e 's/\<[\^\>]\*\>//g' -e 's/\^[ ]//g'" + let errorformat2='Line %l\, Column %c: %m' + let loclist = SyntasticMake({ 'makeprg': makeprg2, 'errorformat': errorformat2 }) + + let n = len(loclist) - 1 + let bufnum = bufnr("") + while n >= 0 + let i = loclist[n] + let i['bufnr'] = bufnum + + if i['lnum'] == 0 + let i['type'] = 'w' + else + let i['type'] = 'e' + endif + let n -= 1 + endwhile + + return loclist +endfunction diff --git a/bundle/git_syntastic/syntax_checkers/java.vim b/bundle/git_syntastic/syntax_checkers/java.vim new file mode 100644 index 0000000..8d9b247 --- /dev/null +++ b/bundle/git_syntastic/syntax_checkers/java.vim @@ -0,0 +1,28 @@ +"============================================================================ +"File: java.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Jochen Keil +"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_java_GetLocList() + + let makeprg = 'javac -Xlint ' + \. expand ( '%:p:h' ) . '/' . expand ( '%:t' ) + \. ' 2>&1 \| ' + \. 'sed -e "s\|' + \. expand ( '%:t' ) + \. '\|' + \. expand ( '%:p:h' ) . '/' . expand ( '%:t' ) + \. '\|"' + + " unashamedly stolen from *errorformat-javac* (quickfix.txt) + let errorformat = '%A%f:%l:\ %m,%+Z%p^,%+C%.%#,%-G%.%#' + + return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + +endfunction diff --git a/bundle/git_syntastic/syntax_checkers/perl.vim b/bundle/git_syntastic/syntax_checkers/perl.vim index e8aa577..1d48f61 100644 --- a/bundle/git_syntastic/syntax_checkers/perl.vim +++ b/bundle/git_syntastic/syntax_checkers/perl.vim @@ -1,7 +1,8 @@ "============================================================================ "File: perl.vim "Description: Syntax checking plugin for syntastic.vim -"Maintainer: Anthony Carapetis +"Maintainer: Anthony Carapetis , +" Eric Harmon "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 @@ -19,11 +20,12 @@ if !executable("perl") finish endif -let s:checker = 'perl ' . shellescape(expand(':p:h') . '/efm_perl.pl') . ' -c' +"remove '-w' switch to change all warnings to errors +let s:checker = 'perl ' . shellescape(expand(':p:h') . '/efm_perl.pl') . ' -c -w' function! SyntaxCheckers_perl_GetLocList() let makeprg = s:checker . ' ' . shellescape(expand('%')) - let errorformat = '%f:%l:%m' + let errorformat = '%t:%f:%l:%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 3e1a77e..a2c909d 100644 --- a/bundle/git_syntastic/syntax_checkers/php.vim +++ b/bundle/git_syntastic/syntax_checkers/php.vim @@ -41,7 +41,7 @@ function! SyntaxCheckers_php_GetLocList() let errors = [] let makeprg = "php -l -d error_reporting=E_ALL -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 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,PHP Parse %trror: %m in %f on line %l' let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) if empty(errors) && !g:syntastic_phpcs_disable && executable("phpcs") diff --git a/bundle/git_syntastic/syntax_checkers/puppet.vim b/bundle/git_syntastic/syntax_checkers/puppet.vim index 0ec02cb..28c9e33 100644 --- a/bundle/git_syntastic/syntax_checkers/puppet.vim +++ b/bundle/git_syntastic/syntax_checkers/puppet.vim @@ -24,7 +24,7 @@ if !exists("g:syntastic_puppet_lint_disable") endif if !executable("puppet-lint") - let g:syntastic_puppet_lint_disable = 0 + let g:syntastic_puppet_lint_disable = 1 endif function! s:PuppetExtractVersion() @@ -44,11 +44,15 @@ let s:puppetVersion = s:PuppetExtractVersion() let s:lintVersion = s:PuppetLintExtractVersion() if !(s:lintVersion[0] >= '0' && s:lintVersion[1] >= '1' && s:lintVersion[2] >= '10') - let g:syntastic_puppet_lint_disable = 0 + let g:syntastic_puppet_lint_disable = 1 endif function! s:getPuppetLintErrors() - let makeprg = 'puppet-lint --log-format "\%{KIND} [\%{check}] \%{message} at \%{fullpath}:\%{linenumber}" '.shellescape(expand('%')) + if !exists("g:syntastic_puppet_lint_arguments") + let g:syntastic_puppet_lint_arguments = '' + endif + + let makeprg = 'puppet-lint --log-format "\%{KIND} [\%{check}] \%{message} at \%{fullpath}:\%{linenumber}" '.g:syntastic_puppet_lint_arguments.shellescape(expand('%')) let errorformat = '%t%*[a-zA-Z] %m at %f:%l' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'subtype': 'Style' }) endfunction diff --git a/bundle/git_syntastic/syntax_checkers/python/flake8.vim b/bundle/git_syntastic/syntax_checkers/python/flake8.vim index e135ef5..497f359 100644 --- a/bundle/git_syntastic/syntax_checkers/python/flake8.vim +++ b/bundle/git_syntastic/syntax_checkers/python/flake8.vim @@ -6,9 +6,6 @@ " "============================================================================ 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 diff --git a/bundle/git_syntastic/syntax_checkers/ruby/macruby.vim b/bundle/git_syntastic/syntax_checkers/ruby/macruby.vim new file mode 100644 index 0000000..94075e4 --- /dev/null +++ b/bundle/git_syntastic/syntax_checkers/ruby/macruby.vim @@ -0,0 +1,15 @@ +"============================================================================ +"File: macruby.vim +"Description: Syntax checking plugin for syntastic.vim +"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 = 'RUBYOPT= macruby -W1 -c '.shellescape(expand('%')) + 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/ruby/mri.vim b/bundle/git_syntastic/syntax_checkers/ruby/mri.vim index 50a8a11..ee72b5a 100644 --- a/bundle/git_syntastic/syntax_checkers/ruby/mri.vim +++ b/bundle/git_syntastic/syntax_checkers/ruby/mri.vim @@ -11,7 +11,7 @@ "============================================================================ function! SyntaxCheckers_ruby_GetLocList() " we cannot set RUBYOPT on windows like that - if has('win32') || has('win64') + if has('win32') let makeprg = 'ruby -W1 -T1 -c '.shellescape(expand('%')) else let makeprg = 'RUBYOPT= ruby -W1 -c '.shellescape(expand('%')) diff --git a/bundle/git_syntastic/syntax_checkers/sass.vim b/bundle/git_syntastic/syntax_checkers/sass.vim index 23bf345..f475841 100644 --- a/bundle/git_syntastic/syntax_checkers/sass.vim +++ b/bundle/git_syntastic/syntax_checkers/sass.vim @@ -26,7 +26,7 @@ if executable("compass") endif function! SyntaxCheckers_sass_GetLocList() - let makeprg='sass '.s:imports.' --check '.shellescape(expand('%')) + let makeprg='sass --no-cache '.s:imports.' --check '.shellescape(expand('%')) let errorformat = '%ESyntax %trror:%m,%C on line %l of %f,%Z%.%#' let errorformat .= ',%Wwarning on line %l:,%Z%m,Syntax %trror on line %l: %m' let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) diff --git a/bundle/git_tagbar/.gitattributes b/bundle/git_tagbar/.gitattributes new file mode 100644 index 0000000..3b1db11 --- /dev/null +++ b/bundle/git_tagbar/.gitattributes @@ -0,0 +1,4 @@ +.gitignore export-ignore +.gitattributes export-ignore +README export-ignore +.info export-ignore diff --git a/bundle/git_tagbar/.gitignore b/bundle/git_tagbar/.gitignore new file mode 100644 index 0000000..0a56e3f --- /dev/null +++ b/bundle/git_tagbar/.gitignore @@ -0,0 +1 @@ +/doc/tags diff --git a/bundle/git_tagbar/.info b/bundle/git_tagbar/.info new file mode 100644 index 0000000..f4d9137 --- /dev/null +++ b/bundle/git_tagbar/.info @@ -0,0 +1,2 @@ +tagbar +3465 diff --git a/bundle/git_tagbar/README b/bundle/git_tagbar/README new file mode 100644 index 0000000..c95f2c4 --- /dev/null +++ b/bundle/git_tagbar/README @@ -0,0 +1,7 @@ +Tagbar is a vim plugin for browsing the tags of source code files. It provides +a sidebar that displays the ctags-generated tags of the current file, ordered +by their scope. This means that for example methods in C++ are displayed under +the class they are defined in. + +Check out the homepage at http://majutsushi.github.com/tagbar/ for more +information. diff --git a/bundle/tagbar/autoload/tagbar.vim b/bundle/git_tagbar/autoload/tagbar.vim similarity index 72% rename from bundle/tagbar/autoload/tagbar.vim rename to bundle/git_tagbar/autoload/tagbar.vim index 48ad320..1e28051 100644 --- a/bundle/tagbar/autoload/tagbar.vim +++ b/bundle/git_tagbar/autoload/tagbar.vim @@ -4,7 +4,7 @@ " Author: Jan Larres " Licence: Vim licence " Website: http://majutsushi.github.com/tagbar/ -" Version: 2.3 +" Version: 2.4 " Note: This plugin was heavily inspired by the 'Taglist' plugin by " Yegappan Lakshmanan and uses a small amount of code from it. " @@ -25,25 +25,23 @@ scriptencoding utf-8 " Basic init {{{2 if !exists('g:tagbar_ctags_bin') - if executable('ctags-exuberant') - let g:tagbar_ctags_bin = 'ctags-exuberant' - elseif executable('exuberant-ctags') - let g:tagbar_ctags_bin = 'exuberant-ctags' - elseif executable('exctags') - let g:tagbar_ctags_bin = 'exctags' - elseif has('macunix') && executable('/usr/local/bin/ctags') - " Homebrew default location - let g:tagbar_ctags_bin = '/usr/local/bin/ctags' - elseif has('macunix') && executable('/opt/local/bin/ctags') - " Macports default location - let g:tagbar_ctags_bin = '/opt/local/bin/ctags' - elseif executable('ctags') - let g:tagbar_ctags_bin = 'ctags' - elseif executable('ctags.exe') - let g:tagbar_ctags_bin = 'ctags.exe' - elseif executable('tags') - let g:tagbar_ctags_bin = 'tags' - else + let ctagsbins = [] + let ctagsbins += ['ctags-exuberant'] " Debian + let ctagsbins += ['exuberant-ctags'] + let ctagsbins += ['exctags'] " FreeBSD, NetBSD + let ctagsbins += ['/usr/local/bin/ctags'] " Homebrew + let ctagsbins += ['/opt/local/bin/ctags'] " Macports + let ctagsbins += ['ectags'] " OpenBSD + let ctagsbins += ['ctags'] + let ctagsbins += ['ctags.exe'] + let ctagsbins += ['tags'] + for ctags in ctagsbins + if executable(ctags) + let g:tagbar_ctags_bin = ctags + break + endif + endfor + if !exists('g:tagbar_ctags_bin') echomsg 'Tagbar: Exuberant ctags not found, skipping plugin' finish endif @@ -57,8 +55,9 @@ else let &wildignore = wildignore_save if !executable(g:tagbar_ctags_bin) - echomsg 'Tagbar: Exuberant ctags not found in specified place,' - \ 'skipping plugin' + echomsg "Tagbar: Exuberant ctags not found at " . + \ "'" . g:tagbar_ctags_bin . "', " . + \ "skipping plugin" finish endif endif @@ -76,10 +75,13 @@ unlet s:ftype_out let s:icon_closed = g:tagbar_iconchars[0] let s:icon_open = g:tagbar_iconchars[1] -let s:type_init_done = 0 -let s:autocommands_done = 0 -let s:checked_ctags = 0 -let s:window_expanded = 0 +let s:type_init_done = 0 +let s:autocommands_done = 0 +let s:checked_ctags = 0 +let s:checked_ctags_types = 0 +let s:ctags_types = {} +let s:window_expanded = 0 + let s:access_symbols = { \ 'public' : '+', @@ -95,15 +97,26 @@ let s:debug_file = '' " s:Init() {{{2 function! s:Init() + if !s:checked_ctags + if !s:CheckForExCtags() + return 0 + endif + endif + + if !s:checked_ctags_types + call s:GetSupportedFiletypes() + endif + if !s:type_init_done call s:InitTypes() endif - if !s:checked_ctags - if !s:CheckForExCtags() - return - endif + if !s:autocommands_done + call s:CreateAutocommands() + doautocmd CursorHold endif + + return 1 endfunction " s:InitTypes() {{{2 @@ -113,76 +126,76 @@ function! s:InitTypes() let s:known_types = {} " Ant {{{3 - let type_ant = {} + let type_ant = s:TypeInfo.New() let type_ant.ctagstype = 'ant' let type_ant.kinds = [ - \ {'short' : 'p', 'long' : 'projects', 'fold' : 0}, - \ {'short' : 't', 'long' : 'targets', 'fold' : 0} + \ {'short' : 'p', 'long' : 'projects', 'fold' : 0, 'stl' : 1}, + \ {'short' : 't', 'long' : 'targets', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.ant = type_ant " Asm {{{3 - let type_asm = {} + let type_asm = s:TypeInfo.New() let type_asm.ctagstype = 'asm' let type_asm.kinds = [ - \ {'short' : 'm', 'long' : 'macros', 'fold' : 0}, - \ {'short' : 't', 'long' : 'types', 'fold' : 0}, - \ {'short' : 'd', 'long' : 'defines', 'fold' : 0}, - \ {'short' : 'l', 'long' : 'labels', 'fold' : 0} + \ {'short' : 'm', 'long' : 'macros', 'fold' : 0, 'stl' : 1}, + \ {'short' : 't', 'long' : 'types', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'd', 'long' : 'defines', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'l', 'long' : 'labels', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.asm = type_asm " ASP {{{3 - let type_aspvbs = {} + let type_aspvbs = s:TypeInfo.New() let type_aspvbs.ctagstype = 'asp' let type_aspvbs.kinds = [ - \ {'short' : 'd', 'long' : 'constants', 'fold' : 0}, - \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, - \ {'short' : 's', 'long' : 'subroutines', 'fold' : 0}, - \ {'short' : 'v', 'long' : 'variables', 'fold' : 0} + \ {'short' : 'd', 'long' : 'constants', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 's', 'long' : 'subroutines', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.aspvbs = type_aspvbs " Awk {{{3 - let type_awk = {} + let type_awk = s:TypeInfo.New() let type_awk.ctagstype = 'awk' let type_awk.kinds = [ - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.awk = type_awk " Basic {{{3 - let type_basic = {} + let type_basic = s:TypeInfo.New() let type_basic.ctagstype = 'basic' let type_basic.kinds = [ - \ {'short' : 'c', 'long' : 'constants', 'fold' : 0}, - \ {'short' : 'g', 'long' : 'enumerations', 'fold' : 0}, - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, - \ {'short' : 'l', 'long' : 'labels', 'fold' : 0}, - \ {'short' : 't', 'long' : 'types', 'fold' : 0}, - \ {'short' : 'v', 'long' : 'variables', 'fold' : 0} + \ {'short' : 'c', 'long' : 'constants', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'g', 'long' : 'enumerations', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'l', 'long' : 'labels', 'fold' : 0, 'stl' : 1}, + \ {'short' : 't', 'long' : 'types', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.basic = type_basic " BETA {{{3 - let type_beta = {} + let type_beta = s:TypeInfo.New() let type_beta.ctagstype = 'beta' let type_beta.kinds = [ - \ {'short' : 'f', 'long' : 'fragments', 'fold' : 0}, - \ {'short' : 's', 'long' : 'slots', 'fold' : 0}, - \ {'short' : 'v', 'long' : 'patterns', 'fold' : 0} + \ {'short' : 'f', 'long' : 'fragments', 'fold' : 0, 'stl' : 1}, + \ {'short' : 's', 'long' : 'slots', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'v', 'long' : 'patterns', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.beta = type_beta " C {{{3 - let type_c = {} + let type_c = s:TypeInfo.New() let type_c.ctagstype = 'c' let type_c.kinds = [ - \ {'short' : 'd', 'long' : 'macros', 'fold' : 1}, - \ {'short' : 'p', 'long' : 'prototypes', 'fold' : 1}, - \ {'short' : 'g', 'long' : 'enums', 'fold' : 0}, - \ {'short' : 'e', 'long' : 'enumerators', 'fold' : 0}, - \ {'short' : 't', 'long' : 'typedefs', 'fold' : 0}, - \ {'short' : 's', 'long' : 'structs', 'fold' : 0}, - \ {'short' : 'u', 'long' : 'unions', 'fold' : 0}, - \ {'short' : 'm', 'long' : 'members', 'fold' : 0}, - \ {'short' : 'v', 'long' : 'variables', 'fold' : 0}, - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} + \ {'short' : 'd', 'long' : 'macros', 'fold' : 1, 'stl' : 0}, + \ {'short' : 'p', 'long' : 'prototypes', 'fold' : 1, 'stl' : 0}, + \ {'short' : 'g', 'long' : 'enums', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'e', 'long' : 'enumerators', 'fold' : 0, 'stl' : 0}, + \ {'short' : 't', 'long' : 'typedefs', 'fold' : 0, 'stl' : 0}, + \ {'short' : 's', 'long' : 'structs', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'u', 'long' : 'unions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'm', 'long' : 'members', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1} \ ] let type_c.sro = '::' let type_c.kind2scope = { @@ -197,21 +210,21 @@ function! s:InitTypes() \ } let s:known_types.c = type_c " C++ {{{3 - let type_cpp = {} + let type_cpp = s:TypeInfo.New() let type_cpp.ctagstype = 'c++' let type_cpp.kinds = [ - \ {'short' : 'd', 'long' : 'macros', 'fold' : 1}, - \ {'short' : 'p', 'long' : 'prototypes', 'fold' : 1}, - \ {'short' : 'g', 'long' : 'enums', 'fold' : 0}, - \ {'short' : 'e', 'long' : 'enumerators', 'fold' : 0}, - \ {'short' : 't', 'long' : 'typedefs', 'fold' : 0}, - \ {'short' : 'n', 'long' : 'namespaces', 'fold' : 0}, - \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, - \ {'short' : 's', 'long' : 'structs', 'fold' : 0}, - \ {'short' : 'u', 'long' : 'unions', 'fold' : 0}, - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, - \ {'short' : 'm', 'long' : 'members', 'fold' : 0}, - \ {'short' : 'v', 'long' : 'variables', 'fold' : 0} + \ {'short' : 'd', 'long' : 'macros', 'fold' : 1, 'stl' : 0}, + \ {'short' : 'p', 'long' : 'prototypes', 'fold' : 1, 'stl' : 0}, + \ {'short' : 'g', 'long' : 'enums', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'e', 'long' : 'enumerators', 'fold' : 0, 'stl' : 0}, + \ {'short' : 't', 'long' : 'typedefs', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'n', 'long' : 'namespaces', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1}, + \ {'short' : 's', 'long' : 'structs', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'u', 'long' : 'unions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'm', 'long' : 'members', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 0} \ ] let type_cpp.sro = '::' let type_cpp.kind2scope = { @@ -230,21 +243,21 @@ function! s:InitTypes() \ } let s:known_types.cpp = type_cpp " C# {{{3 - let type_cs = {} + let type_cs = s:TypeInfo.New() let type_cs.ctagstype = 'c#' let type_cs.kinds = [ - \ {'short' : 'd', 'long' : 'macros', 'fold' : 1}, - \ {'short' : 'f', 'long' : 'fields', 'fold' : 0}, - \ {'short' : 'g', 'long' : 'enums', 'fold' : 0}, - \ {'short' : 'e', 'long' : 'enumerators', 'fold' : 0}, - \ {'short' : 't', 'long' : 'typedefs', 'fold' : 0}, - \ {'short' : 'n', 'long' : 'namespaces', 'fold' : 0}, - \ {'short' : 'i', 'long' : 'interfaces', 'fold' : 0}, - \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, - \ {'short' : 's', 'long' : 'structs', 'fold' : 0}, - \ {'short' : 'E', 'long' : 'events', 'fold' : 0}, - \ {'short' : 'm', 'long' : 'methods', 'fold' : 0}, - \ {'short' : 'p', 'long' : 'properties', 'fold' : 0} + \ {'short' : 'd', 'long' : 'macros', 'fold' : 1, 'stl' : 0}, + \ {'short' : 'f', 'long' : 'fields', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'g', 'long' : 'enums', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'e', 'long' : 'enumerators', 'fold' : 0, 'stl' : 0}, + \ {'short' : 't', 'long' : 'typedefs', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'n', 'long' : 'namespaces', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'i', 'long' : 'interfaces', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1}, + \ {'short' : 's', 'long' : 'structs', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'E', 'long' : 'events', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'm', 'long' : 'methods', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'p', 'long' : 'properties', 'fold' : 0, 'stl' : 1} \ ] let type_cs.sro = '.' let type_cs.kind2scope = { @@ -263,31 +276,31 @@ function! s:InitTypes() \ } let s:known_types.cs = type_cs " COBOL {{{3 - let type_cobol = {} + let type_cobol = s:TypeInfo.New() let type_cobol.ctagstype = 'cobol' let type_cobol.kinds = [ - \ {'short' : 'd', 'long' : 'data items', 'fold' : 0}, - \ {'short' : 'f', 'long' : 'file descriptions', 'fold' : 0}, - \ {'short' : 'g', 'long' : 'group items', 'fold' : 0}, - \ {'short' : 'p', 'long' : 'paragraphs', 'fold' : 0}, - \ {'short' : 'P', 'long' : 'program ids', 'fold' : 0}, - \ {'short' : 's', 'long' : 'sections', 'fold' : 0} + \ {'short' : 'd', 'long' : 'data items', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'f', 'long' : 'file descriptions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'g', 'long' : 'group items', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'p', 'long' : 'paragraphs', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'P', 'long' : 'program ids', 'fold' : 0, 'stl' : 1}, + \ {'short' : 's', 'long' : 'sections', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.cobol = type_cobol " DOS Batch {{{3 - let type_dosbatch = {} + let type_dosbatch = s:TypeInfo.New() let type_dosbatch.ctagstype = 'dosbatch' let type_dosbatch.kinds = [ - \ {'short' : 'l', 'long' : 'labels', 'fold' : 0}, - \ {'short' : 'v', 'long' : 'variables', 'fold' : 0} + \ {'short' : 'l', 'long' : 'labels', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.dosbatch = type_dosbatch " Eiffel {{{3 - let type_eiffel = {} + let type_eiffel = s:TypeInfo.New() let type_eiffel.ctagstype = 'eiffel' let type_eiffel.kinds = [ - \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, - \ {'short' : 'f', 'long' : 'features', 'fold' : 0} + \ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'f', 'long' : 'features', 'fold' : 0, 'stl' : 1} \ ] let type_eiffel.sro = '.' " Not sure, is nesting even possible? let type_eiffel.kind2scope = { @@ -300,13 +313,13 @@ function! s:InitTypes() \ } let s:known_types.eiffel = type_eiffel " Erlang {{{3 - let type_erlang = {} + let type_erlang = s:TypeInfo.New() let type_erlang.ctagstype = 'erlang' let type_erlang.kinds = [ - \ {'short' : 'm', 'long' : 'modules', 'fold' : 0}, - \ {'short' : 'd', 'long' : 'macro definitions', 'fold' : 0}, - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, - \ {'short' : 'r', 'long' : 'record definitions', 'fold' : 0} + \ {'short' : 'm', 'long' : 'modules', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'd', 'long' : 'macro definitions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'r', 'long' : 'record definitions', 'fold' : 0, 'stl' : 1} \ ] let type_erlang.sro = '.' " Not sure, is nesting even possible? let type_erlang.kind2scope = { @@ -321,15 +334,15 @@ function! s:InitTypes() " guesses and probably requires " http://www.vim.org/scripts/script.php?script_id=2909 " Improvements welcome! - let type_mxml = {} + let type_mxml = s:TypeInfo.New() let type_mxml.ctagstype = 'flex' let type_mxml.kinds = [ - \ {'short' : 'v', 'long' : 'global variables', 'fold' : 0}, - \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, - \ {'short' : 'm', 'long' : 'methods', 'fold' : 0}, - \ {'short' : 'p', 'long' : 'properties', 'fold' : 0}, - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, - \ {'short' : 'x', 'long' : 'mxtags', 'fold' : 0} + \ {'short' : 'v', 'long' : 'global variables', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'm', 'long' : 'methods', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'p', 'long' : 'properties', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'x', 'long' : 'mxtags', 'fold' : 0, 'stl' : 0} \ ] let type_mxml.sro = '.' let type_mxml.kind2scope = { @@ -340,21 +353,22 @@ function! s:InitTypes() \ } let s:known_types.mxml = type_mxml " Fortran {{{3 - let type_fortran = {} + let type_fortran = s:TypeInfo.New() let type_fortran.ctagstype = 'fortran' let type_fortran.kinds = [ - \ {'short' : 'm', 'long' : 'modules', 'fold' : 0}, - \ {'short' : 'p', 'long' : 'programs', 'fold' : 0}, - \ {'short' : 'k', 'long' : 'components', 'fold' : 0}, - \ {'short' : 't', 'long' : 'derived types and structures', 'fold' : 0}, - \ {'short' : 'c', 'long' : 'common blocks', 'fold' : 0}, - \ {'short' : 'b', 'long' : 'block data', 'fold' : 0}, - \ {'short' : 'e', 'long' : 'entry points', 'fold' : 0}, - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, - \ {'short' : 's', 'long' : 'subroutines', 'fold' : 0}, - \ {'short' : 'l', 'long' : 'labels', 'fold' : 0}, - \ {'short' : 'n', 'long' : 'namelists', 'fold' : 0}, - \ {'short' : 'v', 'long' : 'variables', 'fold' : 0} + \ {'short' : 'm', 'long' : 'modules', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'p', 'long' : 'programs', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'k', 'long' : 'components', 'fold' : 0, 'stl' : 1}, + \ {'short' : 't', 'long' : 'derived types and structures', 'fold' : 0, + \ 'stl' : 1}, + \ {'short' : 'c', 'long' : 'common blocks', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'b', 'long' : 'block data', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'e', 'long' : 'entry points', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 's', 'long' : 'subroutines', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'l', 'long' : 'labels', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'n', 'long' : 'namelists', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 0} \ ] let type_fortran.sro = '.' " Not sure, is nesting even possible? let type_fortran.kind2scope = { @@ -371,24 +385,24 @@ function! s:InitTypes() \ } let s:known_types.fortran = type_fortran " HTML {{{3 - let type_html = {} + let type_html = s:TypeInfo.New() let type_html.ctagstype = 'html' let type_html.kinds = [ - \ {'short' : 'f', 'long' : 'JavaScript funtions', 'fold' : 0}, - \ {'short' : 'a', 'long' : 'named anchors', 'fold' : 0} + \ {'short' : 'f', 'long' : 'JavaScript funtions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'a', 'long' : 'named anchors', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.html = type_html " Java {{{3 - let type_java = {} + let type_java = s:TypeInfo.New() let type_java.ctagstype = 'java' let type_java.kinds = [ - \ {'short' : 'p', 'long' : 'packages', 'fold' : 1}, - \ {'short' : 'f', 'long' : 'fields', 'fold' : 0}, - \ {'short' : 'g', 'long' : 'enum types', 'fold' : 0}, - \ {'short' : 'e', 'long' : 'enum constants', 'fold' : 0}, - \ {'short' : 'i', 'long' : 'interfaces', 'fold' : 0}, - \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, - \ {'short' : 'm', 'long' : 'methods', 'fold' : 0} + \ {'short' : 'p', 'long' : 'packages', 'fold' : 1, 'stl' : 0}, + \ {'short' : 'f', 'long' : 'fields', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'g', 'long' : 'enum types', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'e', 'long' : 'enum constants', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'i', 'long' : 'interfaces', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'm', 'long' : 'methods', 'fold' : 0, 'stl' : 1} \ ] let type_java.sro = '.' let type_java.kind2scope = { @@ -407,13 +421,13 @@ function! s:InitTypes() " properly generate the information for them, instead it simply uses the " complete name. So ctags has to be fixed before I can do anything here. " Alternatively jsctags/doctorjs will be used if available. - let type_javascript = {} + let type_javascript = s:TypeInfo.New() let type_javascript.ctagstype = 'javascript' let jsctags = s:CheckFTCtags('jsctags', 'javascript') if jsctags != '' let type_javascript.kinds = [ - \ {'short' : 'v', 'long' : 'variables', 'fold' : 0}, - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} + \ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1} \ ] let type_javascript.sro = '.' let type_javascript.kind2scope = { @@ -427,55 +441,55 @@ function! s:InitTypes() let type_javascript.ctagsargs = '-f -' else let type_javascript.kinds = [ - \ {'short' : 'v', 'long' : 'global variables', 'fold' : 0}, - \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, - \ {'short' : 'p', 'long' : 'properties', 'fold' : 0}, - \ {'short' : 'm', 'long' : 'methods', 'fold' : 0}, - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} + \ {'short' : 'v', 'long' : 'global variables', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'p', 'long' : 'properties', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'm', 'long' : 'methods', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1} \ ] endif let s:known_types.javascript = type_javascript " Lisp {{{3 - let type_lisp = {} + let type_lisp = s:TypeInfo.New() let type_lisp.ctagstype = 'lisp' let type_lisp.kinds = [ - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.lisp = type_lisp " Lua {{{3 - let type_lua = {} + let type_lua = s:TypeInfo.New() let type_lua.ctagstype = 'lua' let type_lua.kinds = [ - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.lua = type_lua " Make {{{3 - let type_make = {} + let type_make = s:TypeInfo.New() let type_make.ctagstype = 'make' let type_make.kinds = [ - \ {'short' : 'm', 'long' : 'macros', 'fold' : 0} + \ {'short' : 'm', 'long' : 'macros', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.make = type_make " Matlab {{{3 - let type_matlab = {} + let type_matlab = s:TypeInfo.New() let type_matlab.ctagstype = 'matlab' let type_matlab.kinds = [ - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.matlab = type_matlab " Ocaml {{{3 - let type_ocaml = {} + let type_ocaml = s:TypeInfo.New() let type_ocaml.ctagstype = 'ocaml' let type_ocaml.kinds = [ - \ {'short' : 'M', 'long' : 'modules or functors', 'fold' : 0}, - \ {'short' : 'v', 'long' : 'global variables', 'fold' : 0}, - \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, - \ {'short' : 'C', 'long' : 'constructors', 'fold' : 0}, - \ {'short' : 'm', 'long' : 'methods', 'fold' : 0}, - \ {'short' : 'e', 'long' : 'exceptions', 'fold' : 0}, - \ {'short' : 't', 'long' : 'type names', 'fold' : 0}, - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, - \ {'short' : 'r', 'long' : 'structure fields', 'fold' : 0} + \ {'short' : 'M', 'long' : 'modules or functors', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'v', 'long' : 'global variables', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'C', 'long' : 'constructors', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'm', 'long' : 'methods', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'e', 'long' : 'exceptions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 't', 'long' : 'type names', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'r', 'long' : 'structure fields', 'fold' : 0, 'stl' : 0} \ ] let type_ocaml.sro = '.' " Not sure, is nesting even possible? let type_ocaml.kind2scope = { @@ -490,45 +504,45 @@ function! s:InitTypes() \ } let s:known_types.ocaml = type_ocaml " Pascal {{{3 - let type_pascal = {} + let type_pascal = s:TypeInfo.New() let type_pascal.ctagstype = 'pascal' let type_pascal.kinds = [ - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, - \ {'short' : 'p', 'long' : 'procedures', 'fold' : 0} + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'p', 'long' : 'procedures', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.pascal = type_pascal " Perl {{{3 - let type_perl = {} + let type_perl = s:TypeInfo.New() let type_perl.ctagstype = 'perl' let type_perl.kinds = [ - \ {'short' : 'p', 'long' : 'packages', 'fold' : 1}, - \ {'short' : 'c', 'long' : 'constants', 'fold' : 0}, - \ {'short' : 'f', 'long' : 'formats', 'fold' : 0}, - \ {'short' : 'l', 'long' : 'labels', 'fold' : 0}, - \ {'short' : 's', 'long' : 'subroutines', 'fold' : 0} + \ {'short' : 'p', 'long' : 'packages', 'fold' : 1, 'stl' : 0}, + \ {'short' : 'c', 'long' : 'constants', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'f', 'long' : 'formats', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'l', 'long' : 'labels', 'fold' : 0, 'stl' : 1}, + \ {'short' : 's', 'long' : 'subroutines', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.perl = type_perl " PHP {{{3 - let type_php = {} + let type_php = s:TypeInfo.New() let type_php.ctagstype = 'php' let type_php.kinds = [ - \ {'short' : 'i', 'long' : 'interfaces', 'fold' : 0}, - \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, - \ {'short' : 'd', 'long' : 'constant definitions', 'fold' : 0}, - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, - \ {'short' : 'v', 'long' : 'variables', 'fold' : 0}, - \ {'short' : 'j', 'long' : 'javascript functions', 'fold' : 0} + \ {'short' : 'i', 'long' : 'interfaces', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'd', 'long' : 'constant definitions', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'j', 'long' : 'javascript functions', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.php = type_php " Python {{{3 - let type_python = {} + let type_python = s:TypeInfo.New() let type_python.ctagstype = 'python' let type_python.kinds = [ - \ {'short' : 'i', 'long' : 'imports', 'fold' : 1}, - \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, - \ {'short' : 'm', 'long' : 'members', 'fold' : 0}, - \ {'short' : 'v', 'long' : 'variables', 'fold' : 0} + \ {'short' : 'i', 'long' : 'imports', 'fold' : 1, 'stl' : 0}, + \ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'm', 'long' : 'members', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 0} \ ] let type_python.sro = '.' let type_python.kind2scope = { @@ -542,20 +556,20 @@ function! s:InitTypes() \ } let s:known_types.python = type_python " REXX {{{3 - let type_rexx = {} + let type_rexx = s:TypeInfo.New() let type_rexx.ctagstype = 'rexx' let type_rexx.kinds = [ - \ {'short' : 's', 'long' : 'subroutines', 'fold' : 0} + \ {'short' : 's', 'long' : 'subroutines', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.rexx = type_rexx " Ruby {{{3 - let type_ruby = {} + let type_ruby = s:TypeInfo.New() let type_ruby.ctagstype = 'ruby' let type_ruby.kinds = [ - \ {'short' : 'm', 'long' : 'modules', 'fold' : 0}, - \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, - \ {'short' : 'f', 'long' : 'methods', 'fold' : 0}, - \ {'short' : 'F', 'long' : 'singleton methods', 'fold' : 0} + \ {'short' : 'm', 'long' : 'modules', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'f', 'long' : 'methods', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'F', 'long' : 'singleton methods', 'fold' : 0, 'stl' : 1} \ ] let type_ruby.sro = '.' let type_ruby.kind2scope = { @@ -567,108 +581,166 @@ function! s:InitTypes() \ } let s:known_types.ruby = type_ruby " Scheme {{{3 - let type_scheme = {} + let type_scheme = s:TypeInfo.New() let type_scheme.ctagstype = 'scheme' let type_scheme.kinds = [ - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, - \ {'short' : 's', 'long' : 'sets', 'fold' : 0} + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 's', 'long' : 'sets', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.scheme = type_scheme " Shell script {{{3 - let type_sh = {} + let type_sh = s:TypeInfo.New() let type_sh.ctagstype = 'sh' let type_sh.kinds = [ - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.sh = type_sh let s:known_types.csh = type_sh let s:known_types.zsh = type_sh " SLang {{{3 - let type_slang = {} + let type_slang = s:TypeInfo.New() let type_slang.ctagstype = 'slang' let type_slang.kinds = [ - \ {'short' : 'n', 'long' : 'namespaces', 'fold' : 0}, - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} + \ {'short' : 'n', 'long' : 'namespaces', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.slang = type_slang " SML {{{3 - let type_sml = {} + let type_sml = s:TypeInfo.New() let type_sml.ctagstype = 'sml' let type_sml.kinds = [ - \ {'short' : 'e', 'long' : 'exception declarations', 'fold' : 0}, - \ {'short' : 'f', 'long' : 'function definitions', 'fold' : 0}, - \ {'short' : 'c', 'long' : 'functor definitions', 'fold' : 0}, - \ {'short' : 's', 'long' : 'signature declarations', 'fold' : 0}, - \ {'short' : 'r', 'long' : 'structure declarations', 'fold' : 0}, - \ {'short' : 't', 'long' : 'type definitions', 'fold' : 0}, - \ {'short' : 'v', 'long' : 'value bindings', 'fold' : 0} + \ {'short' : 'e', 'long' : 'exception declarations', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'f', 'long' : 'function definitions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'c', 'long' : 'functor definitions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 's', 'long' : 'signature declarations', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'r', 'long' : 'structure declarations', 'fold' : 0, 'stl' : 0}, + \ {'short' : 't', 'long' : 'type definitions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'v', 'long' : 'value bindings', 'fold' : 0, 'stl' : 0} \ ] let s:known_types.sml = type_sml " SQL {{{3 " The SQL ctags parser seems to be buggy for me, so this just uses the " normal kinds even though scopes should be available. Improvements " welcome! - let type_sql = {} + let type_sql = s:TypeInfo.New() let type_sql.ctagstype = 'sql' let type_sql.kinds = [ - \ {'short' : 'P', 'long' : 'packages', 'fold' : 1}, - \ {'short' : 'c', 'long' : 'cursors', 'fold' : 0}, - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, - \ {'short' : 'F', 'long' : 'record fields', 'fold' : 0}, - \ {'short' : 'L', 'long' : 'block label', 'fold' : 0}, - \ {'short' : 'p', 'long' : 'procedures', 'fold' : 0}, - \ {'short' : 's', 'long' : 'subtypes', 'fold' : 0}, - \ {'short' : 't', 'long' : 'tables', 'fold' : 0}, - \ {'short' : 'T', 'long' : 'triggers', 'fold' : 0}, - \ {'short' : 'v', 'long' : 'variables', 'fold' : 0}, - \ {'short' : 'i', 'long' : 'indexes', 'fold' : 0}, - \ {'short' : 'e', 'long' : 'events', 'fold' : 0}, - \ {'short' : 'U', 'long' : 'publications', 'fold' : 0}, - \ {'short' : 'R', 'long' : 'services', 'fold' : 0}, - \ {'short' : 'D', 'long' : 'domains', 'fold' : 0}, - \ {'short' : 'V', 'long' : 'views', 'fold' : 0}, - \ {'short' : 'n', 'long' : 'synonyms', 'fold' : 0}, - \ {'short' : 'x', 'long' : 'MobiLink Table Scripts', 'fold' : 0}, - \ {'short' : 'y', 'long' : 'MobiLink Conn Scripts', 'fold' : 0} + \ {'short' : 'P', 'long' : 'packages', 'fold' : 1, 'stl' : 1}, + \ {'short' : 'c', 'long' : 'cursors', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'F', 'long' : 'record fields', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'L', 'long' : 'block label', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'p', 'long' : 'procedures', 'fold' : 0, 'stl' : 1}, + \ {'short' : 's', 'long' : 'subtypes', 'fold' : 0, 'stl' : 1}, + \ {'short' : 't', 'long' : 'tables', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'T', 'long' : 'triggers', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'i', 'long' : 'indexes', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'e', 'long' : 'events', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'U', 'long' : 'publications', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'R', 'long' : 'services', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'D', 'long' : 'domains', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'V', 'long' : 'views', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'n', 'long' : 'synonyms', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'x', 'long' : 'MobiLink Table Scripts', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'y', 'long' : 'MobiLink Conn Scripts', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.sql = type_sql " Tcl {{{3 - let type_tcl = {} + let type_tcl = s:TypeInfo.New() let type_tcl.ctagstype = 'tcl' let type_tcl.kinds = [ - \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, - \ {'short' : 'm', 'long' : 'methods', 'fold' : 0}, - \ {'short' : 'p', 'long' : 'procedures', 'fold' : 0} + \ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'm', 'long' : 'methods', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'p', 'long' : 'procedures', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.tcl = type_tcl " LaTeX {{{3 - let type_tex = {} + let type_tex = s:TypeInfo.New() let type_tex.ctagstype = 'tex' let type_tex.kinds = [ - \ {'short' : 'p', 'long' : 'parts', 'fold' : 0}, - \ {'short' : 'c', 'long' : 'chapters', 'fold' : 0}, - \ {'short' : 's', 'long' : 'sections', 'fold' : 0}, - \ {'short' : 'u', 'long' : 'subsections', 'fold' : 0}, - \ {'short' : 'b', 'long' : 'subsubsections', 'fold' : 0}, - \ {'short' : 'P', 'long' : 'paragraphs', 'fold' : 0}, - \ {'short' : 'G', 'long' : 'subparagraphs', 'fold' : 0} + \ {'short' : 'i', 'long' : 'includes', 'fold' : 1, 'stl' : 0}, + \ {'short' : 'p', 'long' : 'parts', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'c', 'long' : 'chapters', 'fold' : 0, 'stl' : 1}, + \ {'short' : 's', 'long' : 'sections', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'u', 'long' : 'subsections', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'b', 'long' : 'subsubsections', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'P', 'long' : 'paragraphs', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'G', 'long' : 'subparagraphs', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'l', 'long' : 'labels', 'fold' : 0, 'stl' : 0} \ ] + let type_tex.sro = '""' + let type_tex.kind2scope = { + \ 'p' : 'part', + \ 'c' : 'chapter', + \ 's' : 'section', + \ 'u' : 'subsection', + \ 'b' : 'subsubsection' + \ } + let type_tex.scope2kind = { + \ 'part' : 'p', + \ 'chapter' : 'c', + \ 'section' : 's', + \ 'subsection' : 'u', + \ 'subsubsection' : 'b' + \ } + let type_tex.sort = 0 let s:known_types.tex = type_tex + " Vala {{{3 + " Vala is supported by the ctags fork provided by Anjuta, so only add the + " type if the fork is used to prevent error messages otherwise + if has_key(s:ctags_types, 'vala') || executable('anjuta-tags') + let type_vala = s:TypeInfo.New() + let type_vala.ctagstype = 'vala' + let type_vala.kinds = [ + \ {'short' : 'e', 'long' : 'Enumerations', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'v', 'long' : 'Enumeration values', 'fold' : 0, 'stl' : 0}, + \ {'short' : 's', 'long' : 'Structures', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'i', 'long' : 'Interfaces', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'd', 'long' : 'Delegates', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'c', 'long' : 'Classes', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'p', 'long' : 'Properties', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'f', 'long' : 'Fields', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'm', 'long' : 'Methods', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'E', 'long' : 'Error domains', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'r', 'long' : 'Error codes', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'S', 'long' : 'Signals', 'fold' : 0, 'stl' : 1} + \ ] + let type_vala.sro = '.' + " 'enum' doesn't seem to be used as a scope, but it can't hurt to have + " it here + let type_vala.kind2scope = { + \ 's' : 'struct', + \ 'i' : 'interface', + \ 'c' : 'class', + \ 'e' : 'enum' + \ } + let type_vala.scope2kind = { + \ 'struct' : 's', + \ 'interface' : 'i', + \ 'class' : 'c', + \ 'enum' : 'e' + \ } + let s:known_types.vala = type_vala + endif + if !has_key(s:ctags_types, 'vala') && executable('anjuta-tags') + let s:known_types.vala.ctagsbin = 'anjuta-tags' + endif " Vera {{{3 " Why are variables 'virtual'? - let type_vera = {} + let type_vera = s:TypeInfo.New() let type_vera.ctagstype = 'vera' let type_vera.kinds = [ - \ {'short' : 'd', 'long' : 'macros', 'fold' : 1}, - \ {'short' : 'g', 'long' : 'enums', 'fold' : 0}, - \ {'short' : 'T', 'long' : 'typedefs', 'fold' : 0}, - \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, - \ {'short' : 'e', 'long' : 'enumerators', 'fold' : 0}, - \ {'short' : 'm', 'long' : 'members', 'fold' : 0}, - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, - \ {'short' : 't', 'long' : 'tasks', 'fold' : 0}, - \ {'short' : 'v', 'long' : 'variables', 'fold' : 0}, - \ {'short' : 'p', 'long' : 'programs', 'fold' : 0} + \ {'short' : 'd', 'long' : 'macros', 'fold' : 1, 'stl' : 0}, + \ {'short' : 'g', 'long' : 'enums', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'T', 'long' : 'typedefs', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'e', 'long' : 'enumerators', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'm', 'long' : 'members', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 't', 'long' : 'tasks', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'p', 'long' : 'programs', 'fold' : 0, 'stl' : 1} \ ] let type_vera.sro = '.' " Nesting doesn't seem to be possible let type_vera.kind2scope = { @@ -683,99 +755,79 @@ function! s:InitTypes() \ } let s:known_types.vera = type_vera " Verilog {{{3 - let type_verilog = {} + let type_verilog = s:TypeInfo.New() let type_verilog.ctagstype = 'verilog' let type_verilog.kinds = [ - \ {'short' : 'c', 'long' : 'constants', 'fold' : 0}, - \ {'short' : 'e', 'long' : 'events', 'fold' : 0}, - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, - \ {'short' : 'm', 'long' : 'modules', 'fold' : 0}, - \ {'short' : 'n', 'long' : 'net data types', 'fold' : 0}, - \ {'short' : 'p', 'long' : 'ports', 'fold' : 0}, - \ {'short' : 'r', 'long' : 'register data types', 'fold' : 0}, - \ {'short' : 't', 'long' : 'tasks', 'fold' : 0} + \ {'short' : 'c', 'long' : 'constants', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'e', 'long' : 'events', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'm', 'long' : 'modules', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'n', 'long' : 'net data types', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'p', 'long' : 'ports', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'r', 'long' : 'register data types', 'fold' : 0, 'stl' : 1}, + \ {'short' : 't', 'long' : 'tasks', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.verilog = type_verilog " VHDL {{{3 " The VHDL ctags parser unfortunately doesn't generate proper scopes - let type_vhdl = {} + let type_vhdl = s:TypeInfo.New() let type_vhdl.ctagstype = 'vhdl' let type_vhdl.kinds = [ - \ {'short' : 'P', 'long' : 'packages', 'fold' : 1}, - \ {'short' : 'c', 'long' : 'constants', 'fold' : 0}, - \ {'short' : 't', 'long' : 'types', 'fold' : 0}, - \ {'short' : 'T', 'long' : 'subtypes', 'fold' : 0}, - \ {'short' : 'r', 'long' : 'records', 'fold' : 0}, - \ {'short' : 'e', 'long' : 'entities', 'fold' : 0}, - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, - \ {'short' : 'p', 'long' : 'procedures', 'fold' : 0} + \ {'short' : 'P', 'long' : 'packages', 'fold' : 1, 'stl' : 0}, + \ {'short' : 'c', 'long' : 'constants', 'fold' : 0, 'stl' : 0}, + \ {'short' : 't', 'long' : 'types', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'T', 'long' : 'subtypes', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'r', 'long' : 'records', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'e', 'long' : 'entities', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'p', 'long' : 'procedures', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.vhdl = type_vhdl " Vim {{{3 - let type_vim = {} + let type_vim = s:TypeInfo.New() let type_vim.ctagstype = 'vim' let type_vim.kinds = [ - \ {'short' : 'v', 'long' : 'variables', 'fold' : 1}, - \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, - \ {'short' : 'a', 'long' : 'autocommand groups', 'fold' : 1}, - \ {'short' : 'c', 'long' : 'commands', 'fold' : 0}, - \ {'short' : 'm', 'long' : 'maps', 'fold' : 1} + \ {'short' : 'v', 'long' : 'variables', 'fold' : 1, 'stl' : 0}, + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}, + \ {'short' : 'a', 'long' : 'autocommand groups', 'fold' : 1, 'stl' : 1}, + \ {'short' : 'c', 'long' : 'commands', 'fold' : 0, 'stl' : 0}, + \ {'short' : 'm', 'long' : 'maps', 'fold' : 1, 'stl' : 0} \ ] let s:known_types.vim = type_vim " YACC {{{3 - let type_yacc = {} + let type_yacc = s:TypeInfo.New() let type_yacc.ctagstype = 'yacc' let type_yacc.kinds = [ - \ {'short' : 'l', 'long' : 'labels', 'fold' : 0} + \ {'short' : 'l', 'long' : 'labels', 'fold' : 0, 'stl' : 1} \ ] let s:known_types.yacc = type_yacc " }}}3 - let user_defs = s:GetUserTypeDefs() - for [key, value] in items(user_defs) - if !has_key(s:known_types, key) || - \ (has_key(value, 'replace') && value.replace) - let s:known_types[key] = value - else - call extend(s:known_types[key], value) - endif - endfor + call s:LoadUserTypeDefs() - " Create a dictionary of the kind order for fast - " access in sorting functions for type in values(s:known_types) - let i = 0 - let type.kinddict = {} - for kind in type.kinds - let type.kinddict[kind.short] = i - let i += 1 - endfor + call s:CreateTypeKinddict(type) endfor let s:type_init_done = 1 endfunction -" s:GetUserTypeDefs() {{{2 -function! s:GetUserTypeDefs() - call s:LogDebugMessage('Initializing user types') +" s:LoadUserTypeDefs() {{{2 +function! s:LoadUserTypeDefs(...) + if a:0 > 0 + let type = a:1 - redir => defs - silent execute 'let g:' - redir END + call s:LogDebugMessage("Initializing user type '" . type . "'") - let deflist = split(defs, '\n') - call map(deflist, 'substitute(v:val, ''^\S\+\zs.*'', "", "")') - call filter(deflist, 'v:val =~ "^tagbar_type_"') + let defdict = {} + let defdict[type] = g:tagbar_type_{type} + else + call s:LogDebugMessage('Initializing user types') - let defdict = {} - for defstr in deflist - let type = substitute(defstr, '^tagbar_type_', '', '') - execute 'let defdict["' . type . '"] = g:' . defstr - endfor + let defdict = tagbar#getusertypes() + endif - " If the user only specified one of kind2scope and scope2kind use it to - " generate the other one - " Also, transform the 'kind' definitions into dictionary format + " Transform the 'kind' definitions into dictionary format for def in values(defdict) if has_key(def, 'kinds') let kinds = def.kinds @@ -783,15 +835,22 @@ function! s:GetUserTypeDefs() for kind in kinds let kindlist = split(kind, ':') let kinddict = {'short' : kindlist[0], 'long' : kindlist[1]} - if len(kindlist) == 3 + if len(kindlist) == 4 let kinddict.fold = kindlist[2] + let kinddict.stl = kindlist[3] + elseif len(kindlist) == 3 + let kinddict.fold = kindlist[2] + let kinddict.stl = 1 else let kinddict.fold = 0 + let kinddict.stl = 1 endif call add(def.kinds, kinddict) endfor endif + " If the user only specified one of kind2scope and scope2kind use it + " to generate the other one if has_key(def, 'kind2scope') && !has_key(def, 'scope2kind') let def.scope2kind = {} for [key, value] in items(def.kind2scope) @@ -804,8 +863,31 @@ function! s:GetUserTypeDefs() endfor endif endfor + unlet! key value - return defdict + for [key, value] in items(defdict) + if !has_key(s:known_types, key) || + \ (has_key(value, 'replace') && value.replace) + let s:known_types[key] = s:TypeInfo.New(value) + else + call extend(s:known_types[key], value) + endif + endfor + + if a:0 > 0 + call s:CreateTypeKinddict(s:known_types[type]) + endif +endfunction + +" s:CreateTypeKinddict() {{{2 +function! s:CreateTypeKinddict(type) + " Create a dictionary of the kind order for fast access in sorting + " functions + let i = 0 + for kind in a:type.kinds + let a:type.kinddict[kind.short] = i + let i += 1 + endfor endfunction " s:RestoreSession() {{{2 @@ -813,6 +895,8 @@ endfunction function! s:RestoreSession() call s:LogDebugMessage('Restoring session') + let curfile = fnamemodify(bufname('%'), ':p') + let tagbarwinnr = bufwinnr('__Tagbar__') if tagbarwinnr == -1 " Tagbar wasn't open in the saved session, nothing to do @@ -820,21 +904,21 @@ function! s:RestoreSession() else let in_tagbar = 1 if winnr() != tagbarwinnr - execute tagbarwinnr . 'wincmd w' + call s:winexec(tagbarwinnr . 'wincmd w') let in_tagbar = 0 endif endif + let s:last_autofocus = 0 + call s:Init() call s:InitWindow(g:tagbar_autoclose) - " Leave the Tagbar window and come back so the update event gets triggered - wincmd p - execute tagbarwinnr . 'wincmd w' + call s:AutoUpdate(curfile) if !in_tagbar - wincmd p + call s:winexec('wincmd p') endif endfunction @@ -865,12 +949,12 @@ function! s:MapKeys() nnoremap + +2. installing MathJax locally (faster, no internet required). Choose a +folder on your hard drive and save MathJax in it. Then add to your HTML +template the following line: + + + +where is the folder on your HD, as a relative path to the +template folder. For instance, a sensible folder structure could be: + +- wiki + - text + - html + - templates + - mathjax + +In this case, would be "../mathjax" (without quotes). + + +------------------------------------------------------------------------------ +5.9. Blockquotes *vimwiki-syntax-blockquotes* Text started with 4 or more spaces is a blockquote. @@ -782,7 +891,7 @@ Text started with 4 or more spaces is a blockquote. ------------------------------------------------------------------------------ -5.9. Comments *vimwiki-syntax-comments* +5.10. Comments *vimwiki-syntax-comments* Text line started with %% is a comment. E.g.: > @@ -791,12 +900,128 @@ E.g.: > ------------------------------------------------------------------------------ -5.10. Horizontal line *vimwiki-syntax-hr* +5.11. Horizontal line *vimwiki-syntax-hr* 4 or more dashes at the start of the line is a 'horizontal line' (
): > ---- < +------------------------------------------------------------------------------ +5.12. Schemes *vimwiki-syntax-schemes* + +In addition to standard web schemes (e.g. `http:`, `https:`, `ftp:`, etc.) a +number of special schemes are supported: "wiki#:", "local:", "diary:", +"file:", and schemeless. + +While "wiki:#", "diary" and schemeless links are automatically opened in Vi, +all other links are opened with the system command. To customize this +behavior, see |VimwikiLinkHandler|. + +Interwiki:~ + +If you maintain more than one wiki, you can create interwiki links between them +by adding a numbered prefix "wiki#:" in front of a link: > + [[wiki#:This is a link]] +or: > + [[wiki#:This is a link source|Description of the link]] + +The number "#", in the range 0..N-1, identifies the destination wiki in +|g:vimwiki_list|. + +Diary:~ + +The diary scheme is used to concisely link to diary entries: > + [[diary:2012-03-05]] + +This scheme precludes explicit inclusion of |vimwiki-option-diary_rel_path|, +and is most useful on subwiki pages to avoid links such as: > + [[../../diary/2012-03-05]] + +Local:~ + +A local resource that is not a wiki page may be specified with a path relative +to the current page: > + [[local:../assets/data.csv|data (CSV)]] + +When followed or converted to HTML, extensions of local-scheme links are not +modified. + +File:~ + +The file scheme allows you to directly link to arbitray resources using +absolute paths and extensions: > + [[file:///home/somebody/a/b/c/music.mp3]] + +Schemeless:~ + +Schemeless URLs, which are the default, are treated internally as "wiki#:" +URLs in all respects except when converted to Html. + +Schemeless links convert to plain relative path URLs, nearly verbatim: > + relpath/wikipage.html + +The "wiki#:", "local:", and "diary:" schemes use absolute paths as URLs: > + file:///abs_path_to_html#/relpath/wikipage.html + +When |vimwiki-option-maxhi| equals 1, a distinct highlighting style is used to +identify schemeless links whose targets are not found. All other links appear +as regular links even if the files to which they refer do not exist. + + +------------------------------------------------------------------------------ +5.13. Transclusions *vimwiki-syntax-transclude* + +Transclusion (Wiki-Include) Links~ + +Links that use "{{" and "}}" delimiters signify content that is to be +included into the Html output, rather than referenced via hyperlink. + +Wiki-include URLs may use any of the supported schemes, may be absolute or +relative, and need not end with an extension. + +The primary purpose for wiki-include links is to include images. + +Transclude from a local URL: > + {{local:../../images/vimwiki_logo.png}} +or from a universal URL: > + {{http://vimwiki.googlecode.com/hg/images/vimwiki_logo.png}} + +Transclude image with alternate text: > + {{http://vimwiki.googlecode.com/hg/images/vimwiki_logo.png|Vimwiki}} +in HTML: > + Vimwiki + +Transclude image with alternate text and some style: > + {{http://.../vimwiki_logo.png|cool stuff|style="width:150px; height: 120px;"}} +in HTML: > + cool stuff + +Transclude image _without_ alternate text and with css class: > + {{http://.../vimwiki_logo.png||class="center flow blabla"}} +in HTML: > + + +A trial feature allows you to supply your own handler for wiki-include links. +See |VimwikiWikiIncludeHandler|. + + +------------------------------------------------------------------------------ +5.14. Thumbnails *vimwiki-syntax-thumbnails* + +Thumbnail links~ +> +Thumbnail links are constructed like this: > + [[http://someaddr.com/bigpicture.jpg|{{http://someaddr.com/thumbnail.jpg}}]] + +in HTML: > + + + let g:vimwiki_ext2syntax = {'.md': 'markdown', + \ '.mkd': 'markdown', + \ '.wiki': 'media'} + +An extension that is registered with vimwiki can trigger creation of a +|vimwiki-temporary-wiki| with the associated syntax. File extensions used in +|g:vimwiki_list| are automatically registered with vimwiki using the default +syntax. + +Default: {'.md': 'markdown'} ------------------------------------------------------------------------------ *g:vimwiki_auto_checkbox* @@ -1439,31 +1755,6 @@ etc. Default: 'Vimwiki' ------------------------------------------------------------------------------- -*g:vimwiki_stripsym* - -Change strip symbol -- in Windows you cannot use /*?<>:" in filenames, so -vimwiki replaces them with a neutral symbol (_ is default): > - let g:vimwiki_stripsym = '_' - -You can change it to a for example: > - let g:vimwiki_stripsym = ' ' - - ------------------------------------------------------------------------------- -*g:vimwiki_badsyms* - -If you do not like spaces in filenames (as some vimwiki users do), you can set -up bad symbols to include spaces, so that they are also converted: -|g:vimwiki_stripsym|: > - let g:vimwiki_badsyms = ' ' - -Now files for all [[links with spaces]] would be created like -'links_with_spaces'. - -This option is a complement one to |g:vimwiki_stripsym|. - - ------------------------------------------------------------------------------ *g:vimwiki_listsyms* @@ -1511,30 +1802,6 @@ Value Description~ Default: 0 ------------------------------------------------------------------------------- -*g:vimwiki_fold_trailing_empty_lines* - -Fold or do not fold empty lines between folded headers. - -Value Description~ -0 Fold only one empty line. Leave the rest of the empty lines. -1 Fold in all empty lines. - -Default: 0 - - ------------------------------------------------------------------------------- -*g:vimwiki_camel_case* - -If you do not want WikiWord to be a link, this setting is just for you. - -Value Description~ -0 Do not make links from CamelCased words. -1 Make links from CamelCased words. - -Default: 1 - - ------------------------------------------------------------------------------ *g:vimwiki_list_ignore_newline* @@ -1562,34 +1829,110 @@ Default: 1 ------------------------------------------------------------------------------ -*g:vimwiki_browsers* *VimwikiWeblinkHandler* +*VimwikiLinkHandler* -You can open external weblinks in a webbrowser. Webbrowsers are listed in -|g:vimwiki_browsers|. +A customizable link handler, |VimwikiLinkHandler|, can be defined to override +Vimwiki's opening of links. Each recognized link, whether it is a wikilink, +wiki-include link or a weblink, is first passed to |VimwikiLinkHandler| to see +if it can be handled. The return value 1/0 indicates success. -For win32 it is: chrome, opera, firefox and explorer. -For other OSes it is: opera, firefox and konqueror. +If the link is not handled successfully, the behaviour of Vimwiki depends on +the scheme. Wiki:, diary: or schemeless links are opened in Vim. All others, +including local: and file: schemes, are opened with a system default handler; +i.e. Linux (!xdg-open), Mac (!open), and Windows (!start). -The first available browser from the list is used to open the weblink. -If you have opera and firefox and want weblinks to be opened in the latter, -just specify: > - let g:vimwiki_browsers=['C:\Program Files\Firefox\firefox.exe'] +You can redefine |VimwikiLinkHandler| function to do something else: > -or redefine VimwikiWeblinkHandler function: > - function! VimwikiWeblinkHandler(weblink) - let browser = 'C:\Program Files\Firefox\firefox.exe' - execute '!start "'.browser.'" ' . a:weblink + function! VimwikiLinkHandler(link) + try + let browser = 'C:\Program Files\Firefox\firefox.exe' + execute '!start "'.browser.'" ' . a:link + return 1 + catch + echo "This can happen for a variety of reasons ..." + endtry + return 0 endfunction +A second example handles two new schemes, 'vlocal:' and 'vfile:', which behave +similar to 'local:' and 'file:' schemes, but are always opened with Vim: > + + function! VimwikiLinkHandler(link) "{{{ Use Vim to open links with the + " 'vlocal:' or 'vfile:' schemes. E.g.: + " 1) [[vfile:///~/Code/PythonProject/abc123.py]], and + " 2) [[vlocal:./|Wiki Home]] + let link = a:link + if link =~ "vlocal:" || link =~ "vfile:" + let link = link[1:] + else + return 0 + endif + let [idx, scheme, path, subdir, lnk, ext, url] = + \ vimwiki#base#resolve_scheme(link, 0) + if g:vimwiki_debug + echom 'LinkHandler: idx='.idx.', scheme=[v]'.scheme.', path='.path. + \ ', subdir='.subdir.', lnk='.lnk.', ext='.ext.', url='.url + endif + if url == '' + echom 'Vimwiki Error: Unable to resolve link!' + return 0 + else + call vimwiki#base#edit_file('tabnew', url, [], 0) + return 1 + endif + endfunction " }}} + + +----------------------------------------------------------------------------- +*VimwikiWikiIncludeHandler*~ + +Vimwiki includes the contents of a wiki-include URL as an image by default. + +A trial feature allows you to supply your own handler for wiki-include links. +The handler should return the empty string when it does not recognize or +cannot otherwise convert the link. A customized handler might look like this: > + + " Convert {{URL|#|ID}} -> URL#ID + function! VimwikiWikiIncludeHandler(value) "{{{ + let str = a:value + + " complete URL + let url_0 = matchstr(str, g:vimwiki_rxWikiInclMatchUrl) + " URL parts + let [scheme, path, subdir, lnk, ext, url] = + \ vimwiki#base#resolve_scheme(url_0, VimwikiGet('ext')) + let arg1 = matchstr(str, VimwikiWikiInclMatchArg(1)) + let arg2 = matchstr(str, VimwikiWikiInclMatchArg(2)) + + if arg1 =~ '#' + return url.'#'.arg2 + endif + + " Return the empty string when unable to process link + return '' + endfunction "}}} +< + +------------------------------------------------------------------------------ +*g:vimwiki_table_mappings* + +Enable/disable table mappings for INSERT mode. + +Value Description~ +0 Disable table mappings. +1 Enable table mappings. + +Default: 1 + ------------------------------------------------------------------------------ *g:vimwiki_table_auto_fmt* -Turn on/off table auto-formatting. +Enable/disable table auto formatting after leaving INSERT mode. Value Description~ -0 Do not auto-format tables. -1 Auto-format tables. +0 Disable table auto formatting. +1 Enable table auto formatting. Default: 1 @@ -1691,7 +2034,7 @@ Value Description~ etc. With - let g:vimwiki_html_header_numbering = '.' + let g:vimwiki_html_header_numbering_sym = '.' headers would look like: > 1. Header1 1.1. Header2 @@ -1706,20 +2049,6 @@ headers would look like: > Default: '' (empty) ------------------------------------------------------------------------------- -*g:vimwiki_file_exts* - -Comma-separated list of file extensions. - -Consider you have the following link: [[my_script.php][my script]]. -If there is a 'php' extension in g:vimwiki_file_exts, this link would be -htmlized to my script. -Otherwise it would be my script (note .html) - - -Default: 'pdf,txt,doc,rtf,xls,php,zip,rar,7z,html,gz' - - ------------------------------------------------------------------------------ *g:vimwiki_valid_html_tags* @@ -1752,7 +2081,67 @@ a new tab or window, it would be set to default value. Vimwiki sets |conceallevel| to g:vimwiki_conceallevel everytime vimwiki buffer is entered. -Default: 3 +Default: 2 + + +------------------------------------------------------------------------------ +*g:vimwiki_url_mingain* + +The minimum number of characters that should be gained by concealing URLs. If +the length of the concealed part of the URL would be less than +|g:vimwiki_url_mingain|, the URL is not concealed at all. +The conceal feature works only with vim >= 7.3. + +Default: 12 + + +------------------------------------------------------------------------------ +*g:vimwiki_url_maxsave* + +The maximum number of characters that is retained at the end after concealing +URLs. At most there will be |g:vimwiki_url_maxsave| characters left at the end of the URL. +However, it could be less when one of /,#,? can be found at the end. +In that case the URL will be concealed right before the last occurrence of one +of these characters. +The conceal feature works only with vim >= 7.3. Beware: when using the default +'wrap' option, the effect is not always pleasing. + +Default: 15 + + +------------------------------------------------------------------------------ +*g:vimwiki_debug* + +Controls verbosity of debugging output, for example, the diagnostic +information about HTML conversion. + +Value Description~ +0 Do not show debug messages. +1 Show debug messages. + +Default: 0 + +------------------------------------------------------------------------------ +*g:vimwiki_diary_months* + +It is a |Dictionary| with the numbers of months and corresponding names. Diary +uses it. + +Redefine it in your .vimrc to get localized months in your diary: +let g:vimwiki_diary_months = { + \ 1: 'Январь', 2: 'Февраль', 3: 'Март', + \ 4: 'Ðпрель', 5: 'Май', 6: 'Июнь', + \ 7: 'Июль', 8: 'ÐвгуÑÑ‚', 9: 'СентÑбрь', + \ 10: 'ОктÑбрь', 11: 'ÐоÑбрь', 12: 'Декабрь' + \ } + +Default: +let g:vimwiki_diary_months = { + \ 1: 'January', 2: 'February', 3: 'March', + \ 4: 'April', 5: 'May', 6: 'June', + \ 7: 'July', 8: 'August', 9: 'September', + \ 10: 'October', 11: 'November', 12: 'December' + \ } ============================================================================== @@ -1769,6 +2158,8 @@ Issues can be filed at http://code.google.com/p/vimwiki/issues . 13. Developers *vimwiki-developers* - Maxim Kim as original author. + - Stuart Andrews + - Tomas Pospichal - See the http://code.google.com/p/vimwiki/people/list for the others. Web: http://code.google.com/p/vimwiki/ @@ -1779,6 +2170,42 @@ Vim plugins: http://www.vim.org/scripts/script.php?script_id=2226 ============================================================================== 14. Changelog *vimwiki-changelog* +2.0 'stu'~ + +This release is partly incompatible with previous. + +Summary ~ + + * Quick page-link creation. + * Redesign of link syntaxes (!) + * No more CamelCase links. Check the ways to convert them + https://groups.google.com/forum/?fromgroups#!topic/vimwiki/NdS9OBG2dys + * No more [[link][desc]] links. + * No more [http://link description] links. + * No more plain image links. Use transclusions. + * No more image links identified by extension. Use transclusions. + * Interwiki links. See |vimwiki-syntax-schemes|. + * Link schemes. See |vimwiki-syntax-schemes|. + * Transclusions. See |vimwiki-syntax-transclude|. + * Normalize link command. See |vimwiki_+|. + * Improved diary organization and generation. See |vimwiki-diary|. + * List manipulation. See |vimwiki-list-manipulation|. + * Markdown support. + * Mathjax support. See |vimwiki-syntax-math|. + * Improved handling of special characters and punctuation in filenames and + urls. + * Back links command: list links referring to the current page. + * Highlighting nonexisted links are off by default. + * Table syntax change. Row separator uses | instead of +. + * Fold multilined list items. + * Custom wiki to HTML converters. See |vimwiki-option-custom_wiki2html|. + * Conceal long weblinks. See |g:vimwiki_url_mingain|. + * Option to disable table mappings. See |g:vimwiki_table_mappings|. + +For detailed information see issues list on +http://code.google.com/p/vimwiki/issues/list + + 1.2~ * Issue 70: Table spanning cell support. * Issue 72: Do not convert again for unchanged file. |:VimwikiAll2HTML| @@ -1842,468 +2269,11 @@ Vim plugins: http://www.vim.org/scripts/script.php?script_id=2226 * NEW: Added wh mapping to call |:Vimwiki2HTML| -1.1.1~ - * FIX: Issue 122: Dot character in vimwiki's directory path isn't escaped. - * FIX: Issue 123: Where is Vimwiki2HTML and other commands? Sometimes - filetype is not set up to vimwiki. - * FIX: Issue 124: Highlight group not found: Normal +... -1.1~ - * NEW: Issue 57: Make it possible to have pre block inside list item. - * NEW: Issue 82: Add quick goto command. See |:VimwikiGoto|. - * NEW: Issue 83: Quick switch in diary. See |:VimwikiDiaryNextDay| and - |:VimwikiDiaryPrevDay| commands. - * FIX: Issue 84: Vimwiki rename removed the WikiWord display name. - * FIX: Issue 85: Errors if you have '~' subdirectory in a wiki directory. - * FIX: Issue 86: Existed links '[[WikiLink1|Alias1]] | [[WikiLink2]]' are - highlighted as a single link. - * FIX: Issue 88: Underline text. See |g:vimwiki_valid_html_tags|. - * FIX: Issue 92: Wikies in a subdir could be renamed to an empty file. - * FIX: Issue 93: Use alias name in HTML title. See |vimwiki-title|. - * FIX: Issue 94: Relative links to PHP files are broken. See - |g:vimwiki_file_exts| for details. - * FIX: Issue 96: Closing bracket at the end of weblink shouldn't be a part - of that link. - * FIX: Issue 97: Error opening weblink in a browser if it has # inside. - * FIX: Issue 99: Vim is not responding while opening arbitrary wiki file. - * FIX: Issue 100: Additional content on diary index page could be - corrupted. - * NEW: Issue 101: Customized HTML tags. See |g:vimwiki_valid_html_tags| - * NEW: Issue 102: Conceal feature usage. See |g:vimwiki_conceallevel|. - * FIX: Issue 103: Always highlight links to non-wiki files as existed. - * FIX: Issue 104: vimwiki#nested_syntax needs 'keepend' to avoid contained - language syntax eat needed '}}}'. - * FIX: Issue 105: on a todo list item with [ ] doesn't create new - todo list item. - * FIX: Issue 106: With MediaWiki syntax on a child todo list - item produce errors. - * FIX: Issue 107: With MediaWiki syntax on a list item creates - todo list item without space between * and [ ]. - * FIX: Issue 110: Syntax highlighting doesn't work for indented codeblock. - * FIX: Issue 115: Nested Perl syntax highlighting differs from regular - one. - * MISC: Many vimwiki commands were renamed from Vimwiki.*Word to - Vimwiki.*Link. VimwikiGoHome is renamed to VimwikiIndex, - VimwikiTabGoHome to VimwikiTabIndex. - * MISC: vimwiki-option-gohome is removed. +39 releases -1.0~ - * NEW: Issue 41: Table cell and column text objects. See - |vimwiki-text-objects|. - * NEW: Issue 42: Commands to move table columns left and right. See - |:VimwikiTableMoveColumnLeft| and |:VimwikiTableMoveColumnRight|. - * NEW: Issue 44: should move cursor to the previous table cell. - * NEW: Issue 45: It should be possible to indent tables. Indented tables - are centered in HTML. - * NEW: Issue 46: Do not htmlize some wiki pages (blacklist). New - placeholder is added: %nohtml. See |vimwiki-nohtml|. - * FIX: Issue 47: Lists aren't HTMLized properly. - * FIX: Issue 48: With autochdir it is impossible to have path_html such as - 'd:\vimwiki\html\' - * FIX: Issue 49: Table is not HTMLized properly at the end of wiki page. - * FIX: Issue 50: Inline formatting is not performed in table cells. - * FIX: Issue 51: Cannot insert '-' (minus) into table cells of the first - column. - * FIX: Issue 52: Table cell width is incorrect when double wide characters - are used (ie. Chinese). Check |g:vimwiki_CJK_length|. - * NEW: Issue 53: Wiki markup can not nested. (Use links and inline markup - in Headers). - * NEW: Issue 54: Highlight for placeholders. - * NEW: Issue 56: Directory indexes. See |g:vimwiki_dir_link| option and - |:VimwikiGenerateLinks| command. - * NEW: Issue 58: Html new lines with
. Could be inserted with - in insert mode. - * FIX: Issue 59: List item's text can't be started from *. - * NEW: Issue 60: Links inside completed gtd-items. - * NEW: Issue 61: Headers numbering. See |g:vimwiki_html_header_numbering| - and |g:vimwiki_html_header_numbering_sym| options. - * FIX: Issue 63: Table cannot have leading empty cells in HTML. - * FIX: Issue 65: Table separator is not htmlized right if on top of the - table. - * FIX: Issue 66: Table empty cells are very small in HTML. - * FIX: Issue 67: Wrong HTML conversion of multilined list item with bold - text on the start of next line. - * FIX: Issue 68: auto-indent problem with langmap. - * FIX: Issue 73: Link navigation by Tab. "Escaped" wiki-word should be - skipped for navigation with . - * FIX: Issue 75: `code` syntax doesn't display correctly in toc. - * FIX: Issue 77: Diary index only showing link to today's diary entry - file for extensions other than '.wiki'. - * FIX: Issue 79: Further calendar.vim integration -- add sign to calendar - date if it has corresponding diary page. - * FIX: Issue 80: Debian Lenny GUI Vim 7.2 has problems with toggling inner - todo list items. - * FIX: Issue 81: Don't convert WikiWord as a link in HTML when - `let g:vimwiki_camel_case = 0` - -0.9.9~ - * NEW: Diary. Help in making daily notes. See |vimwiki-diary|. Now you can - really easy add information into vimwiki that should be sorted out - later. - * NEW: Tables are redesigned. Syntax is changed. Now they are - auto-formattable. You can navigate them with and in insert - mode. See |vimwiki-syntax-tables| and |vimwiki-tables| for more details. - * NEW: Keyword STARTED: is added. - * NEW: Words TODO:, DONE:, STARTED:, XXX:, FIXME:, FIXED: are highlighed - inside headers. - * FIX: Export to HTML external links with 'file://' protocol. Ex: - [file:///home/user1/book.pdf my book]. - * FIX: Menu is corrupted if wiki's path contains spaces. - * FIX: Settings |wrap| and |linebreak| are removed from ftplugin. Add them - into your personal settings file `.vim/after/ftplugin/vimwiki.vim` if - needed. - * NEW: Headers are highlighted in different colors by default. - See |g:vimwiki_hl_headers| to turn it off. - * FIX: Issue 40: Links with russian subdirs don't work. - * NEW: It is now possible to generate HTML files automatically on page - save. See |vimwiki-option-auto_export|. - - -0.9.8~ - * NEW: Rename |g:vimwiki_fold_empty_lines| to - |g:vimwiki_fold_trailing_empty_lines|. - * NEW: One can use '-' along with '*' to start unordered list item. - * NEW: List items could be started from the first column. - As a result some limitations appeared: - - a space after *, - or # for a list item is mandatory. - - |g:vimwiki_fold_trailing_empty_lines| if set to 0 folds one trailing - empty line. - * NEW: Folding is off by default. Use |g:vimwiki_folding| to enable it. - * NEW: Speed up vimwiki's folding a bit. Should lag a bit less in a long - todo lists. - * NEW: Centered headers. Start header with at least one space to make it - HTML centered. - * NEW: Change in default CSS: header's colors. - * NEW: Vimwiki is aware of |GetLatestVimScripts| now. - * FIX: Use tag instead of custom in HTML. - * FIX: There are no text styling in htmlized quoted text. - * FIX: set default value of g:vimwiki_fold_lists to 0 as written in this - help. - * FIX: Issue 33: Folded list items have wrong indentation when 'tabs' are - used. - * FIX: Issue 34: vimwiki#subdir got wrong dir when VimwikiGet('path') is a - symbolic link. Thanks lilydjwg for the patch. - * FIX: Issue 28: todo-list auto-indent enhancement. New item should always - be unchecked. - * Issue 36: Change the name of the Search command to VimwikiSearch as it - conflicts with MultipleSearch. Alias :VWS is also available. - * NEW: You can generate 'Table of contents' of your wiki page. See - |vimwiki-toc| for details. - -0.9.701~ - * FIX: Issue 30: Highlighting doesn't work for checked list item. - -0.9.7~ - * NEW: Default checkbox symbols are changed to [ ], [.], [o], [O], [X]. - You can change them using |g:vimwiki_listsyms| variable. - * NEW: Color group names are renamed from wikiBold, wikiItalic, etc to - VimwikiBold, VimwikiItalic, etc. - * NEW: Open external links in a browser. There are default browsers - defined in |g:vimwiki_browsers| list. You can also redefine - |VimwikiWeblinkHandler| function to open weblinks in other programs. - * NEW: Issue 25: Toggle the states of multiple TODO list items at a time - (in VISUAL and in VISUAL LINE modes) - * NEW: Issue 26: Highlight code snippets in vimwiki's pre. See - |vimwiki-option-nested_syntaxes|. Thanks kriomant. - * NEW: Issue 27: Automatic garbage deletion from HTML directory. - * NEW: Save all open vimwiki buffers before export to HTML. - * NEW: Issue 29: Custom :Search command. - * NEW: Header text objects are now expandable in VISUAL mode. Tap 'vah' to - select a header. Tap again 'ah' to expand selection further. Thanks Andy - Wokula. - * FIX: Folding settings are reset to vim defaults in a new tab (think of - \wt) so you cannot hide things in folds. - * FIX: https links in form of [https://hello.world.com] are not exported - into HTML. Thanks Saurabh Sarpal for the patch. - -0.9.6~ - * NEW: You can have multiline list items. See |vimwiki-syntax-lists|. - * NEW: You can ignore newlines in multiline list items when do export to - HTML. See |g:vimwiki_list_ignore_newline| option. - * NEW: Different checkbox symbols [.], [:], [o] are added. See - |vimwiki-todo-lists|. - * NEW: Now there is no longer syntax of preformatted text that is started - by a whitespace. - * NEW: Blockquotes. See |vimwiki-syntax-blockquote|. - * NEW: Per wiki folding option (vimwiki-option-folding) is removed. Global - |g:vimwiki_folding| and |g:vimwiki_fold_lists| are added. - * NEW: Due to being quite slow folding of list items is off by default. - Use |g:vimwiki_fold_lists| to turn it on. - * NEW: If you want replace some symbols in a wikifilename use - |g:vimwiki_badsyms| option (Andreas Baldeau). - * FIX: Command |:VimwikiToggleListItem| doesn't work for one of the two - wikies opened at the same time with different syntaxes. - * FIX: Command |:VimwikiToggleListItem| do not switch parent checkboxes if - there are non-checkbox list items available. - * FIX: Issue 24: Link error in HTML when write [[one.two.three]]. - * FIX: Rename WikiWord to something with a colon (:) does nasty things. - * FIX: Command |:VimwikiToggleListItem| do not switch right if there are - list items without checkboxes in the list. - -0.9.5~ - * NEW: Added |g:vimwiki_global_ext| to control creation of temporary - wikies in dirs that are not listed in |g:vimwiki_list|. - * NEW: Added |g:vimwiki_hl_headers| to highlight headers with different - predefined colors. - * NEW: Checked [X] items are not highlighted with Comment syntax group by - default. Use |g:vimwiki_hl_cb_checked| to turn it on. - * NEW: Added new syntax for links: [[link address][link description]]. - * NEW: Added allias of mapping for *nix systems. - * NEW: Added |g:vimwiki_camel_case|. Set it to 0 if you do not want - CamelCased WikiWords to be linkified. - * FIX: Links with g:vimwiki_stripsym (default '_') [[My_Link|Text]] are - not highlighted when created. - * FIX: indent/vimwiki.vim is obsolete. If you upgrade from previous - versions remove it. It causes wrong list indentation if noexpandtab is - set. - * FIX: If tabs and spaces are used to indent list items HTML export gives - error. Thanks Klaus Ethgen for report. - * FIX: Some HTML export fixes. - -0.9.4~ - * NEW: Links with directories: [[dir1/dir2/Link|Text]]. Thanks Jie Wu. - * NEW: Added %root_path% template variable to get relative root dir of - path_html. See |vimwiki-option-html_header|. - * FIX: Indent is incorrect for vim without "float" compile option. Thanks - Julian Kooij. - * FIX: Convert to HTML doesn't work right with links like [[foo::bar]]. - * FIX: Rename wikiword doesn't work right when rename WikiWord to - [[WikiWord blablabla]]. - * FIX: Renaming of links with description doesn't work. - * FIX: Weblinks with commas are not highlighted. - * MISC: Some changes in default CSS file. - -0.9.3~ - * NEW: g:vimwiki_menu option is a string which is menu path. So one can - use let g:vimwiki_menu = 'Plugin.Vimwiki' to set the menu to the right - place. - * NEW: g:vimwiki_fold_empty_lines -- don't or do fold in empty lines - between headers. See |g:vimwiki_fold_empty_lines| - * FIX: Encoding error when running vimwiki in Windows XP Japanese. - Thanks KarasAya. - -0.9.2c~ - * FIX: Regression: Export HTML link error with [[Link|Text]]. - -0.9.2b~ - * FIX: Installation on Linux doesn't work. (Dos line endings in Vimball - archive file). - * FIX: Clear out FlexWiki ftplugin's setup. Now you don't have to hack - filetype.vim to get rid of unexpected ':setlocal bomb' from FlexWiki's - ftplugin. - * FIX: When write done: it will show another done: in HTML file. - -0.9.2a~ - * FIX: Installation on Linux doesn't work. (Dos line endings in - autoload/vimwiki_lst.vim and indent/vimwiki.vim). - -0.9.2~ - * NEW: Option 'folding' added to turn folding on/off. - * NEW: Header text object. See |vimwiki-text-objects|. - * NEW: Add/remove Header levels with '=' and '-'. See |vimwiki_=|. - * NEW: Vimwiki GUI menu to select available wikies. See |g:vimwiki_menu|. - * NEW: You can specify the name of your CSS file now. See - |vimwiki-option-css_name| - * NEW: You can add styles to image links, see |vimwiki-syntax-links|. - * FIX: History doesn't work after |VimwikiRenameWord|. - * FIX: Some of wikipedia links are not correctly highlighted. Links with - parentheses. - * MISC: Renamed vimwiki_gtd to vimwiki_lst. - -0.9.1~ - * NEW: HTML Table cell text alignment, see |vimwiki-syntax-tables| - * NEW: Wikipage history simplified. Each vimwiki buffer now holds - b:vimwiki_prev_word which is list of [PrevWord, getpos()]. - * NEW: If highlight for groups wikiHeader1..wikiHeader6 exist (defined in - a colorscheme) -- use it. Otherwise use Title highlight for all Headers. - * FIX: Warn only once if 'html_header' or 'html_footer' does not exist. - * FIX: Wrong folding for the text after the last nested list item. - * FIX: Bold and Italic aren't highlighted in tables without spaces - between || and * or _. ||*bold*||_asdf_ || (Thanks Brett Stahlman) - -0.9.0~ - * NEW: You can add classes to 'pre' tag -- |vimwiki-syntax-preformatted|. - This might be useful for coloring some programming code with external js - tools like google syntax highlighter. - * NEW: !WikiPage is not highlighted. It is just a plain word WikiPage in - HTML, without exclamation mark - * NEW: Definition lists, see |vimwiki-syntax-lists|. - * NEW: New implementation of |:VimwikiRenameWord|. CAUTION: It was tested - on 2 computers only, backup your wiki before use it. Email me if it - doesn't work for you. - * FIX: Less than 3 symbols are not highlighted in Bold and Italic. - * FIX: Added vimwiki autocmd group to avoid clashes with user defined - autocmds. - * FIX: Pressing ESC while |:VimwikiUISelect| opens current wiki index - file. Should cancel wiki selection. - -0.8.3~ - * NEW: on a list item creates checkbox. - * FIX: With * in the first column, shouldn't insert more * (default - syntax). - * FIX: With MediaWiki's ** [ ], should insert it on the next line. - * FIX: HTML export should use 'fileencoding' instead of 'encoding'. - * FIX: Code cleanup. - -0.8.2~ - * DEL: Removed google syntax file. - * NEW: Default vimwiki syntax is a subset of google's one. Header's has - been changed from !Header to =Header=. It is easier to maintain only 2 - syntaxes. See |vimwiki-syntax-headers|. - * NEW: Multiline paragraphs -- less longlines. - * NEW: Comments. See |vimwiki-syntax-comments|. - * DEL: Removed setlocal textwidth = 0 from ftplugin. - * FIX: New regexps for bold, italic, bolditalic. - * FIX: The last item in List sometimes fold-in incorrectly. - * FIX: Minor tweaks on default CSS. - -0.8.1~ - * NEW: Vimwiki's foldmethod changed from syntax to expr. Foldtext is - changed to be nicer with folded list items. - * NEW: Fold/outline list items. - * NEW: It is possible now to edit wiki files in arbitrary directories - which is not in g:vimwiki_list's paths. New WikiWords are created in the - path of the current WikiWord. - * NEW: User can remap Vimwiki's built in mappings. - * NEW: Added |g:vimwiki_use_mouse|. It is off by default. - * FIX: Removed mapping. - -0.8.0~ - * NEW: Multiple wikies support. A lot of options have been changed, see - |vimwiki-options| - * NEW: Auto create directories. - * NEW: Checked list item highlighted as comment. - * FIX: Multiple 'set ft=vimwiki' for each buffer disabled. Vimwiki should - load its buffers a bit faster now. - -0.7.1~ - * NEW: VimwikiToggleListItem added to be able to remap to - anything user prefers more. - * FIX: Toggleable list items do not work with MediaWiki markup. - * FIX: Changing g:vimwiki_home_html to path with ~ while vimwiki is - loaded gives errors for HTML export. - * DEL: Command :VimwikiExploreHome. - -0.7.0~ - * NEW: GTD stuff -- toggleable list items. See |vimwiki-todo-lists|. - * FIX: Headers do not fold inner headers. (Thanks Brett Stahlman) - * FIX: Remove last blank lines from preformatted text at the end of file. - * DEL: Removed g:vimwiki_smartCR option. - -0.6.2~ - * NEW: [[link|description]] is available now. - * FIX: Barebone links (ie: http://bla-bla-bla.org/h.pl?id=98) get extra - escaping of ? and friends so they become invalid in HTML. - * FIX: In linux going to [[wiki with whitespaces]] and then pressing BS - to go back to prev wikipage produce error. (Thanks Brendon Bensel for - the fix) - * FIX: Remove setlocal encoding and fileformat from vimwiki ftplugin. - * FIX: Some tweaks on default style.css - -0.6.1~ - * FIX: [blablabla bla] shouldn't be converted to a link. - * FIX: Remove extra annoing empty strings from PRE tag made from - whitespaces in HTML export. - * FIX: Moved functions related to HTML converting to new autoload module - to increase a bit vimwiki startup time. - -0.6~ - * NEW: Header and footer templates. See|g:vimwiki_html_header| and - |g:vimwiki_html_footer|. - * FIX: |:Vimwiki2HTML| does not recognize ~ as part of a valid path. - -0.5.3~ - * FIX: Fixed |:VimwikiRenameWord|. Error when g:vimwiki_home had - whitespaces in path. - * FIX: |:VimwikiSplitWord| and |:VimwikiVSplitWord| didn't work. - -0.5.2~ - * NEW: Added |:VimwikiGoHome|, |:VimwikiTabGoHome| and - |:VimwikiExploreHome| commands. - * NEW: Added wt mapping to open vimwiki index file in a new tab. - * NEW: Added g:vimwiki_gohome option that controls how|:VimwikiGoHome| - works when current buffer is changed. (Thanks Timur Zaripov) - * FIX: Fixed |:VimwikiRenameWord|. Very bad behaviour when autochdir - isn't set up. - * FIX: Fixed commands :Wiki2HTML and :WikiAll2HTML to be available only - for vimwiki buffers. - * FIX: Renamed :Wiki2HTML and :WikiAll2HTML to |:Vimwiki2HTML| and - |:VimwikiAll2HTML| commands. - * FIX: Help file corrections. - -0.5.1~ - * NEW: This help is created. - * NEW: Now you can fold headers. - * NEW: VimwikiGoHome and VimwikiExploreHome were added. - * FIX: Bug with {{{HelloWikiWord}}} export to HTML is fixed. - * DEL: Sync option removed from: Syntax highlighting for preformatted - text {{{ }}}. - -0.5~ - * NEW: vimwiki default markup to HTML conversion improved. - * NEW: Added basic GoogleWiki and MediaWiki markup languages. - * NEW: Chinese [[complex wiki words]]. - -0.4~ - * NEW: vimwiki=>HTML converter in plain Vim language. - * NEW: Plugin autoload. - -0.3.4~ - * FIX: Backup files (.wiki~) caused a bunch of errors while opening wiki - files. - -0.3.3~ - * FIX: [[wiki word with dots at the end...]] didn't work. - * NEW: Added error handling for delete wiki word function. - * NEW: Added keybindings o and O for list items when g:vimwiki_smartCR=1. - * NEW: Added keybinding wh to visit wiki home directory. - -0.3.2~ - * FIX: Renaming -- error if complex wiki word contains %. - * FIX: Syntax highlighting for preformatted text {{{ }}}. Sync option - added. - * FIX: smartCR bug fix. - -0.3.1~ - * FIX: Renaming -- [[hello world?]] to [[hello? world]] links are not - updated. - * FIX: Buffers menu is a bit awkward after renaming. - * NEW: Use mouse to follow links. Left double-click to follow WikiWord, - Rightclick then Leftclick to go back. - -0.3~ - * NEW: Highlight non-existent WikiWords. - * NEW: Delete current WikiWord (wd). - * NEW: g:vimwiki_smartCR=2 => use Vim comments (see :h comments :h - formatoptions) feature to deal with list items. (thx -- Dmitry - Alexandrov) - * NEW: Highlight TODO:, DONE:, FIXED:, FIXME:. - * NEW: Rename current WikiWord -- be careful on Windows you cannot rename - wikiword to WikiWord. After renaming update all links to that renamed - WikiWord. - * FIX: Bug -- do not duplicate WikiWords in wiki history. - * FIX: After renaming [[wiki word]] twice buffers are not deleted. - * FIX: Renaming from [[wiki word]] to WikiWord result is [[WikiWord]] - * FIX: More than one complex words on one line is bugging each other when - try go to one of them. [[bla bla bla]] [[dodo dodo dodo]] becomes bla - bla bla]] [[dodo dodo dodo. - - -0.2.2~ - * NEW: Added keybinding -- split WikiWord - * NEW: Added keybinding -- vertical split WikiWord - -0.2.1~ - * NEW: Install on Linux now works. - -0.2~ - * NEW: Added part of Google's Wiki syntax. - * NEW: Added auto insert # with ENTER. - * NEW: On/Off auto insert bullet with ENTER. - * NEW: Strip [[complex wiki name]] from symbols that cannot be used in - file names. - * NEW: Links to non-wiki files. Non wiki files are files with extensions - ie [[hello world.txt]] or [[my homesite.html]] +... 0.1~ * First public version. diff --git a/bundle/vimwiki/ftplugin/vimwiki.vim b/bundle/git_vimwiki/ftplugin/vimwiki.vim similarity index 74% rename from bundle/vimwiki/ftplugin/vimwiki.vim rename to bundle/git_vimwiki/ftplugin/vimwiki.vim index 5d31b37..bf6e7b5 100644 --- a/bundle/vimwiki/ftplugin/vimwiki.vim +++ b/bundle/git_vimwiki/ftplugin/vimwiki.vim @@ -35,13 +35,17 @@ setlocal isfname-=[,] " Autocreate list items {{{ " for list items, and list items with checkboxes +setlocal formatoptions+=tnro +setlocal formatoptions-=cq if VimwikiGet('syntax') == 'default' setl comments=b:*,b:#,b:- setl formatlistpat=^\\s*[*#-]\\s* +elseif VimwikiGet('syntax') == 'markdown' + setlocal comments=fb:*,fb:-,fb:+,nb:> commentstring=\ >\ %s + setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+j else setl comments=n:*,n:# endif -setlocal formatoptions=tnro if !empty(&langmap) " Valid only if langmap is a comma separated pairs of chars @@ -64,23 +68,15 @@ function! VimwikiFoldLevel(lnum) "{{{ " Header folding... if line =~ g:vimwiki_rxHeader - let n = vimwiki#base#count_first_sym(line) + let n = vimwiki#u#count_first_sym(line) return '>'.n endif - if g:vimwiki_fold_trailing_empty_lines == 0 && line =~ '^\s*$' - let nnline = getline(nextnonblank(a:lnum + 1)) - else - let nnline = getline(a:lnum + 1) - endif - if nnline =~ g:vimwiki_rxHeader - let n = vimwiki#base#count_first_sym(nnline) - return '<'.n - endif + let base_level = s:get_base_level(a:lnum) " List item folding... if g:vimwiki_fold_lists - let base_level = s:get_base_level(a:lnum) + let nnline = getline(a:lnum + 1) let rx_list_item = '\('. \ g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber. @@ -95,6 +91,10 @@ function! VimwikiFoldLevel(lnum) "{{{ if leveln > level return ">".(base_level+leveln-adj) + " check if multilined list item + elseif (nnum-a:lnum) > 1 + \ && nline =~ rx_list_item && nnline !~ '^\s*$' + return ">".(base_level+level+1-adj) else return (base_level+level-adj) endif @@ -102,34 +102,23 @@ function! VimwikiFoldLevel(lnum) "{{{ " process multilined list items let [pnum, pline] = s:find_backward(rx_list_item, a:lnum) if pline =~ rx_list_item - if indent(a:lnum) > indent(pnum) + if indent(a:lnum) >= indent(pnum) && line !~ '^\s*$' let level = s:get_li_level(pnum) let adj = s:get_li_level(s:get_start_list(rx_list_item, pnum)) - - let [nnum, nline] = s:find_forward(rx_list_item, a:lnum) - if nline =~ rx_list_item - let leveln = s:get_li_level(nnum) - if leveln > level - return (base_level+leveln-adj) - endif - endif - - return (base_level+level-adj) + return (base_level+level+1-adj) endif endif endif - - return base_level endif - return -1 + return base_level endfunction "}}} function! s:get_base_level(lnum) "{{{ let lnum = a:lnum - 1 while lnum > 0 if getline(lnum) =~ g:vimwiki_rxHeader - return vimwiki#base#count_first_sym(getline(lnum)) + return vimwiki#u#count_first_sym(getline(lnum)) endif let lnum -= 1 endwhile @@ -169,7 +158,7 @@ endfunction "}}} function! s:get_li_level(lnum) "{{{ if VimwikiGet('syntax') == 'media' - let level = vimwiki#base#count_first_sym(getline(a:lnum)) + let level = vimwiki#u#count_first_sym(getline(a:lnum)) else let level = (indent(a:lnum) / &sw) endif @@ -198,12 +187,16 @@ endfunction "}}} " COMMANDS {{{ command! -buffer Vimwiki2HTML - \ w call vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')), + \ silent w + \ let res = vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')), \ expand('%')) + \ + \ if res != '' | echo 'Vimwiki: HTML conversion is done.' | endif command! -buffer Vimwiki2HTMLBrowse - \ w call VimwikiWeblinkHandler( - \ vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')), - \ expand('%'))) + \ silent w + \ call vimwiki#base#system_open_link(vimwiki#html#Wiki2HTML( + \ expand(VimwikiGet('path_html')), + \ expand('%'))) command! -buffer VimwikiAll2HTML \ call vimwiki#html#WikiAll2HTML(expand(VimwikiGet('path_html'))) @@ -216,12 +209,17 @@ command! -buffer VimwikiGoBackLink call vimwiki#base#go_back_link() command! -buffer VimwikiSplitLink call vimwiki#base#follow_link('split') command! -buffer VimwikiVSplitLink call vimwiki#base#follow_link('vsplit') +command! -buffer -nargs=? VimwikiNormalizeLink call vimwiki#base#normalize_link() + command! -buffer VimwikiTabnewLink call vimwiki#base#follow_link('tabnew') command! -buffer -range VimwikiToggleListItem call vimwiki#lst#ToggleListItem(, ) command! -buffer VimwikiGenerateLinks call vimwiki#base#generate_links() +command! -buffer -nargs=0 VimwikiBacklinks call vimwiki#base#backlinks() +command! -buffer -nargs=0 VWB call vimwiki#base#backlinks() + exe 'command! -buffer -nargs=* VimwikiSearch lvimgrep '. \ escape(VimwikiGet('path').'**/*'.VimwikiGet('ext'), ' ') @@ -230,6 +228,10 @@ exe 'command! -buffer -nargs=* VWS lvimgrep '. command! -buffer -nargs=1 VimwikiGoto call vimwiki#base#goto("") + +" list commands +command! -buffer -nargs=* VimwikiListChangeLevel call vimwiki#lst#change_level() + " table commands command! -buffer -nargs=* VimwikiTable call vimwiki#tbl#create() command! -buffer VimwikiTableAlignQ call vimwiki#tbl#align_or_cmd('gqq') @@ -247,7 +249,7 @@ command! -buffer VimwikiDiaryPrevDay call vimwiki#diary#goto_prev_day() if g:vimwiki_use_mouse nmap nmap - nnoremap <2-LeftMouse> :VimwikiFollowLink + nnoremap <2-LeftMouse> :call vimwiki#base#follow_link("nosplit", "\2-LeftMouse>") nnoremap :VimwikiSplitLink nnoremap :VimwikiVSplitLink nnoremap :VimwikiGoBackLink @@ -284,6 +286,24 @@ endif nnoremap