diff --git a/GetLatest/GetLatestVimScripts.dat b/GetLatest/GetLatestVimScripts.dat index fcab87c..b0ef066 100644 --- a/GetLatest/GetLatestVimScripts.dat +++ b/GetLatest/GetLatestVimScripts.dat @@ -7,7 +7,7 @@ ScriptID SourceID Filename 311 7645 grep.vim 3304 15211 gundo.vim 2727 11120 jsbeautify.vim -2666 15477 Mark +2666 15603 Mark 2262 8944 occur.vim 910 14691 pydoc.vim #2421 9423 pysmell.vim @@ -16,7 +16,7 @@ ScriptID SourceID Filename 1697 12566 :AutoInstall: surround.vim #273 7701 taglist.vim # exchanged with taglisttoo #and taglisttoo was exchanged by tagbar -3465 15165 Tagbar +3465 15532 Tagbar 90 13751 vcscommand.vim 2226 13756 vimwiki.vim 2289 0 loremipsum.vim @@ -32,7 +32,7 @@ ScriptID SourceID Filename 3309 14699 vydark 2589 14175 vylight 1165 3741 tolerable.vim -415 15463 zenburn +415 15531 zenburn # compiler 891 10365 pylint.vim # ftplugin diff --git a/autoload/mark.vim b/autoload/mark.vim index a29d216..22148f1 100644 --- a/autoload/mark.vim +++ b/autoload/mark.vim @@ -10,8 +10,38 @@ " Dependencies: " - SearchSpecial.vim autoload script (optional, for improved search messages). " -" Version: 2.4.4 +" Version: 2.5.0 " Changes: +" 06-May-2011, Ingo Karkat +" - Also print status message on :MarkClear to be consistent with :MarkToggle. +" +" 21-Apr-2011, Ingo Karkat +" - Implement toggling of mark display (keeping the mark patterns, unlike the +" clearing of marks), determined by s:enable. s:DoMark() now toggles on empty +" regexp, affecting the \n mapping and :Mark. Introduced +" s:EnableAndMarkScope() wrapper to correctly handle the highlighting updates +" depending on whether marks were previously disabled. +" - Implement persistence of s:enable via g:MARK_ENABLED. +" - Generalize s:Enable() and combine with intermediate s:Disable() into +" s:MarkEnable(), which also performs the persistence of s:enabled. +" - Implement lazy-loading of disabled persistent marks via g:mwDoDeferredLoad +" flag passed from plugin/mark.vim. +" +" 20-Apr-2011, Ingo Karkat +" - Extract setting of s:pattern into s:SetPattern() and implement the automatic +" persistence there. +" +" 19-Apr-2011, Ingo Karkat +" - ENH: Add enabling functions for mark persistence: mark#Load() and +" mark#ToPatternList(). +" - Implement :MarkLoad and :MarkSave commands in mark#LoadCommand() and +" mark#SaveCommand(). +" - Remove superfluous update autocmd on VimEnter: Persistent marks trigger the +" update themselves, same for :Mark commands which could potentially be issued +" e.g. in .vimrc. Otherwise, when no marks are defined after startup, the +" autosource script isn't even loaded yet, so the autocmd on the VimEnter +" event isn't yet defined. +" " 18-Apr-2011, Ingo Karkat " - BUG: Include trailing newline character in check for current mark, so that a " mark that matches the entire line (e.g. created by Vm) can be @@ -33,6 +63,8 @@ " and make the remaining g:mw... variables script-local, as these contain " internal housekeeping information that does not need to be accessible by the " user. +" - Add :MarkSave warning if 'viminfo' doesn't enable global variable +" persistence. " " 15-Apr-2011, Ingo Karkat " - Robustness: Move initialization of w:mwMatch from mark#UpdateMark() to @@ -191,6 +223,18 @@ function! s:MarkMatch( indices, expr ) let w:mwMatch[l:index] = matchadd('MarkWord' . (l:index + 1), l:expr, l:priority) endif endfunction +" Initialize mark colors in a (new) window. +function! mark#UpdateMark() + let i = 0 + while i < s:markNum + if ! s:enabled || empty(s:pattern[i]) + call s:MarkMatch([i], '') + else + call s:MarkMatch([i], s:pattern[i]) + endif + let i += 1 + endwhile +endfunction " Set / clear matches in all windows. function! s:MarkScope( indices, expr ) let l:currentWinNr = winnr() @@ -217,23 +261,87 @@ function! mark#UpdateScope() execute l:currentWinNr . 'wincmd w' silent! execute l:originalWindowLayout endfunction + +function! s:MarkEnable( enable, ...) + if s:enabled != a:enable + " En-/disable marks and perform a full refresh in all windows, unless + " explicitly suppressed by passing in 0. + let s:enabled = a:enable + if g:mwAutoSaveMarks + let g:MARK_ENABLED = s:enabled + endif + + if ! a:0 || ! a:1 + call mark#UpdateScope() + endif + endif +endfunction +function! s:EnableAndMarkScope( indices, expr ) + if s:enabled + " Marks are already enabled, we just need to push the changes to all + " windows. + call s:MarkScope(a:indices, a:expr) + else + call s:MarkEnable(1) + endif +endfunction + +" Toggle visibility of marks, like :nohlsearch does for the regular search +" highlighting. +function! mark#Toggle() + if s:enabled + call s:MarkEnable(0) + echo 'Disabled marks' + else + call s:MarkEnable(1) + + let l:markCnt = len(filter(copy(s:pattern), '! empty(v:val)')) + echo 'Enabled' (l:markCnt > 0 ? l:markCnt . ' ' : '') . 'marks' + endif +endfunction + + " Mark or unmark a regular expression. +function! s:SetPattern( index, pattern ) + let s:pattern[a:index] = a:pattern + + if g:mwAutoSaveMarks + call s:SavePattern() + endif +endfunction +function! mark#ClearAll() + let i = 0 + let indices = [] + while i < s:markNum + if ! empty(s:pattern[i]) + call s:SetPattern(i, '') + call add(indices, i) + endif + let i += 1 + endwhile + let s:lastSearch = '' + +" Re-enable marks; not strictly necessary, since all marks have just been +" cleared, and marks will be re-enabled, anyway, when the first mark is added. +" It's just more consistent for mark persistence. But save the full refresh, as +" we do the update ourselves. + call s:MarkEnable(0, 0) + + call s:MarkScope(l:indices, '') + + if len(indices) > 0 + echo 'Cleared all' len(indices) 'marks' + else + echo 'All marks cleared' + endif +endfunction function! mark#DoMark(...) " DoMark(regexp) let regexp = (a:0 ? a:1 : '') - " clear all marks if regexp is null + " Disable marks if regexp is empty. Otherwise, we will be either removing a + " mark or adding one, so marks will be re-enabled. if empty(regexp) - let i = 0 - let indices = [] - while i < s:markNum - if !empty(s:pattern[i]) - let s:pattern[i] = '' - call add(indices, i) - endif - let i += 1 - endwhile - let s:lastSearch = "" - call s:MarkScope(l:indices, '') + call mark#Toggle() return endif @@ -244,8 +352,8 @@ function! mark#DoMark(...) " DoMark(regexp) if s:lastSearch == s:pattern[i] let s:lastSearch = '' endif - let s:pattern[i] = '' - call s:MarkScope([i], '') + call s:SetPattern(i, '') + call s:EnableAndMarkScope([i], '') return endif let i += 1 @@ -253,7 +361,7 @@ function! mark#DoMark(...) " DoMark(regexp) if s:markNum <= 0 " Uh, somehow no mark highlightings were defined. Try to detect them again. - call s:InitMarkVariables() + call mark#Init() if s:markNum <= 0 " Still no mark highlightings; complain. let v:errmsg = 'No mark highlightings defined' @@ -276,9 +384,9 @@ function! mark#DoMark(...) " DoMark(regexp) let i = 0 while i < s:markNum if empty(s:pattern[i]) - let s:pattern[i] = regexp + call s:SetPattern(i, regexp) call s:Cycle(i) - call s:MarkScope([i], regexp) + call s:EnableAndMarkScope([i], regexp) return endif let i += 1 @@ -289,20 +397,8 @@ function! mark#DoMark(...) " DoMark(regexp) if s:lastSearch == s:pattern[i] let s:lastSearch = '' endif - let s:pattern[i] = regexp - call s:MarkScope([i], regexp) -endfunction -" Initialize mark colors in a (new) window. -function! mark#UpdateMark() - let i = 0 - while i < s:markNum - if empty(s:pattern[i]) - call s:MarkMatch([i], '') - else - call s:MarkMatch([i], s:pattern[i]) - endif - let i += 1 - endwhile + call s:SetPattern(i, regexp) + call s:EnableAndMarkScope([i], regexp) endfunction " Return [mark text, mark start position] of the mark under the cursor (or @@ -480,6 +576,11 @@ function! s:Search( pattern, isBackward, currentMarkPosition, searchType ) normal! m' call setpos('.', l:matchPosition) + " Enable marks (in case they were disabled) after arriving at the mark (to + " avoid unnecessary screen updates) but before the error message (to avoid + " it getting lost due to the screen updates). + call s:MarkEnable(1) + if l:isWrapped call s:WrapMessage(a:searchType, a:pattern, a:isBackward) else @@ -494,6 +595,12 @@ function! s:Search( pattern, isBackward, currentMarkPosition, searchType ) " Restore the view to the state before the search. call winrestview(l:save_view) endif + + " Enable marks (in case they were disabled) after arriving at the mark (to + " avoid unnecessary screen updates) but before the error message (to avoid + " it getting lost due to the screen updates). + call s:MarkEnable(1) + call s:ErrorMessage(a:searchType, a:pattern, a:isBackward) return 0 endif @@ -527,25 +634,119 @@ function! mark#SearchNext( isBackward ) endif endfunction +" Load mark patterns from list. +function! mark#Load( pattern, enabled ) + if s:markNum > 0 && len(a:pattern) > 0 + " Initialize mark patterns with the passed list. Ensure that, regardless of + " the list length, s:pattern contains exactly s:markNum elements. + let s:pattern = a:pattern[0:(s:markNum - 1)] + let s:pattern += repeat([''], (s:markNum - len(s:pattern))) + + let s:enabled = a:enabled + + call mark#UpdateScope() + + " The list of patterns may be sparse, return only the actual patterns. + return len(filter(copy(a:pattern), '! empty(v:val)')) + endif + return 0 +endfunction + +" Access the list of mark patterns. +function! mark#ToPatternList() + " Trim unused patterns from the end of the list, the amount of available marks + " may differ on the next invocation (e.g. due to a different number of + " highlight groups in Vim and GVIM). We want to keep empty patterns in the + " front and middle to maintain the mapping to highlight groups, though. + let l:highestNonEmptyIndex = s:markNum -1 + while l:highestNonEmptyIndex >= 0 && empty(s:pattern[l:highestNonEmptyIndex]) + let l:highestNonEmptyIndex -= 1 + endwhile + + return (l:highestNonEmptyIndex < 0 ? [] : s:pattern[0:l:highestNonEmptyIndex]) +endfunction + +" :MarkLoad command. +function! mark#LoadCommand( isShowMessages ) + if exists('g:MARK_MARKS') + try + " Persistent global variables cannot be of type List, so we actually store + " the string representation, and eval() it back to a List. + execute 'let l:loadedMarkNum = mark#Load(' . g:MARK_MARKS . ', ' . (exists('g:MARK_ENABLED') ? g:MARK_ENABLED : 1) . ')' + if a:isShowMessages + if l:loadedMarkNum == 0 + echomsg 'No persistent marks found' + else + echomsg printf('Loaded %d mark%s', l:loadedMarkNum, (l:loadedMarkNum == 1 ? '' : 's')) + endif + endif + catch /^Vim\%((\a\+)\)\=:E/ + let v:errmsg = 'Corrupted persistent mark info in g:MARK_MARKS and g:MARK_ENABLED' + echohl ErrorMsg + echomsg v:errmsg + echohl None + + unlet! g:MARK_MARKS + unlet! g:MARK_ENABLED + endtry + elseif a:isShowMessages + let v:errmsg = 'No persistent marks found' + echohl ErrorMsg + echomsg v:errmsg + echohl None + endif +endfunction + +" :MarkSave command. +function! s:SavePattern() + let l:savedMarks = mark#ToPatternList() + let g:MARK_MARKS = string(l:savedMarks) + let g:MARK_ENABLED = s:enabled + return ! empty(l:savedMarks) +endfunction +function! mark#SaveCommand() + if index(split(&viminfo, ','), '!') == -1 + let v:errmsg = "Cannot persist marks, need ! flag in 'viminfo': :set viminfo+=!" + echohl ErrorMsg + echomsg v:errmsg + echohl None + return + endif + + if ! s:SavePattern() + let v:warningmsg = 'No marks defined' + echohl WarningMsg + echomsg v:warningmsg + echohl None + endif +endfunction + + "- initializations ------------------------------------------------------------ augroup Mark autocmd! - autocmd VimEnter * if ! exists('w:mwMatch') | call mark#UpdateMark() | endif autocmd WinEnter * if ! exists('w:mwMatch') | call mark#UpdateMark() | endif autocmd TabEnter * call mark#UpdateScope() augroup END " Define global variables and initialize current scope. -function! s:InitMarkVariables() +function! mark#Init() let s:markNum = 0 while hlexists('MarkWord' . (s:markNum + 1)) let s:markNum += 1 endwhile - let s:cycle = 0 let s:pattern = repeat([''], s:markNum) - let s:lastSearch = "" + let s:cycle = 0 + let s:lastSearch = '' + let s:enabled = 1 endfunction -call s:InitMarkVariables() -call mark#UpdateScope() + +call mark#Init() +if exists('g:mwDoDeferredLoad') && g:mwDoDeferredLoad + unlet g:mwDoDeferredLoad + call mark#LoadCommand(0) +else + call mark#UpdateScope() +endif " vim: ts=2 sw=2 diff --git a/colors/zenburn.vim b/colors/zenburn.vim index 86abe6c..1f4acee 100644 --- a/colors/zenburn.vim +++ b/colors/zenburn.vim @@ -1,6 +1,6 @@ " Vim color file " Maintainer: Jani Nurminen -" Last Change: $Id: zenburn.vim,v 2.16 2010/10/24 10:55:30 slinky Exp slinky $ +" Last Change: $Id: zenburn.vim,v 2.21 2011/04/26 12:13:41 slinky Exp slinky $ " URL: http://slinky.imukuppi.org/zenburnpage/ " License: GNU GPL " @@ -34,12 +34,17 @@ " - Tim Smith - force dark background " - John Gabriele - spotted bad Ignore-group handling " - Zac Thompson - spotted invisible NonText in low contrast mode -" - Christophe-Marie Duquesne - suggested making a Vimball +" - Christophe-Marie Duquesne - suggested making a Vimball, +" suggested support for ctags_highlighting.vim " - Andrew Wagner - noted the CursorColumn bug (guifg was unintentionally set), " unify CursorColumn colour " - Martin Langasek - clarify the license, whitespace fixes " - Marcin Szamotulski - support autocomplete for Zenburn configuration -" parameters +" parameters +" - Clayton Parker (claytron) - Convinced by Kurt Maier to use Zenburn. Point +" out issues with LineNr, fix directory styles, and their usage in MacVim. +" - Paweł Piekarski - Spotted bad FoldColumn and TabLine. Made better +" FoldColumn colors, fixed TabLine colors. " " CONFIGURABLE PARAMETERS: " @@ -71,6 +76,9 @@ " " let g:zenburn_alternate_Visual = 1 " +" Note: this is enabled only if the old-style Visual +" if used, see g:zenburn_old_Visual +" " * To use alternate colouring for Error message, use " " let g:zenburn_alternate_Error = 1 @@ -96,6 +104,24 @@ " ":set cursorline cursorcolumn", since otherwise the effect won't be " seen. " +" * New (dark) Visual coloring has been introduced. +" The dark Visual is more aligned with the rest of the colour scheme, +" especially if you use line numbers. If you wish to use the +" old Visual coloring, use +" +" let g:zenburn_old_Visual = 1 +" +" Default is to use the new Visual. +" +" * EXPERIMENTAL FEATURE: Zenburn will automatically detect if you +" have ctags_highlighting.vim (by Al Budden, +" http://www.vim.org/scripts/script.php?script_id=2646) enabled, and +" will set sensible highlight links. Nothing will happen if you do +" not have ctags_highlighting.vim. If you do not want this feature, you can +" override the check with: +" +" let g:zenburn_disable_ctags_highlighting_support = 1 +" " NOTE: " " * To turn the parameter(s) back to defaults, use UNLET or set them to 0: @@ -139,6 +165,16 @@ endif if ! exists("g:zenburn_unified_CursorColumn") let g:zenburn_unified_CursorColumn = 0 endif + +if ! exists("g:zenburn_old_Visual") + let g:zenburn_old_Visual = 0 +endif + +if ! exists("g:zenburn_disable_ctags_highlighting_support") + " enabled by default + let g:zenburn_disable_ctags_highlighting_support = 0 +endif + " ----------------------------------------------- set background=dark @@ -148,6 +184,12 @@ if exists("syntax_on") endif let g:colors_name="zenburn" +" check for ctags-highlighting +if exists("g:loaded_ctags_highlighting") && g:loaded_ctags_highlighting && ! g:zenburn_disable_ctags_highlighting_support + " internal + let _zenburn_ctags = 1 +endif + hi Boolean guifg=#dca3a3 hi Character guifg=#dca3a3 gui=bold hi Comment guifg=#7f9f7f gui=italic @@ -161,7 +203,7 @@ hi DiffAdd guifg=#709080 guibg=#313c36 gui=bold hi DiffChange guibg=#333333 hi DiffDelete guifg=#333333 guibg=#464646 hi DiffText guifg=#ecbcbc guibg=#41363c gui=bold -hi Directory guifg=#dcdccc gui=bold +hi Directory guifg=#9fafaf gui=bold hi ErrorMsg guifg=#80d4aa guibg=#2f2f2f gui=bold hi Exception guifg=#c3bf9f gui=bold hi Float guifg=#c0bed1 @@ -172,7 +214,6 @@ hi Identifier guifg=#efdcbc hi IncSearch guibg=#f8f893 guifg=#385f38 hi Keyword guifg=#f0dfaf gui=bold hi Label guifg=#dfcfaf gui=underline -hi LineNr guifg=#9fafaf guibg=#262626 hi Macro guifg=#ffcfaf gui=bold hi ModeMsg guifg=#ffcfaf gui=none hi MoreMsg guifg=#ffffff gui=bold @@ -224,18 +265,16 @@ if &t_Co > 255 hi DiffChange ctermbg=236 hi DiffDelete ctermfg=236 ctermbg=238 hi DiffText ctermfg=217 ctermbg=237 cterm=bold - hi Directory ctermfg=188 cterm=bold + hi Directory ctermfg=109 cterm=bold hi ErrorMsg ctermfg=115 ctermbg=236 cterm=bold hi Exception ctermfg=249 cterm=bold hi Float ctermfg=251 - hi FoldColumn ctermfg=109 ctermbg=238 - hi Folded ctermfg=109 ctermbg=238 hi Function ctermfg=228 hi Identifier ctermfg=223 hi IncSearch ctermbg=228 ctermfg=238 hi Keyword ctermfg=223 cterm=bold hi Label ctermfg=187 cterm=underline - hi LineNr ctermfg=248 ctermbg=235 + hi LineNr ctermfg=248 ctermbg=233 hi Macro ctermfg=223 cterm=bold hi ModeMsg ctermfg=223 cterm=none hi MoreMsg ctermfg=15 cterm=bold @@ -290,10 +329,8 @@ if &t_Co > 255 if exists("g:zenburn_unified_CursorColumn") && g:zenburn_unified_CursorColumn hi CursorColumn ctermbg=233 cterm=none - hi ColorColumn ctermbg=233 cterm=none else hi CursorColumn ctermbg=235 cterm=none - hi ColorColumn ctermbg=235 cterm=none endif else hi Normal ctermfg=188 ctermbg=237 @@ -302,10 +339,8 @@ if &t_Co > 255 hi diffdelete ctermbg=238 hi difftext ctermbg=237 hi errormsg ctermbg=237 - hi foldcolumn ctermbg=238 - hi folded ctermbg=238 hi incsearch ctermbg=228 - hi linenr ctermbg=238 + hi linenr ctermbg=235 hi search ctermbg=238 hi statement ctermbg=237 hi statusline ctermbg=144 @@ -328,10 +363,8 @@ if &t_Co > 255 if exists("g:zenburn_unified_CursorColumn") && g:zenburn_unified_CursorColumn hi CursorColumn ctermbg=238 cterm=none - hi ColorColumn ctermbg=238 cterm=none else hi CursorColumn ctermbg=239 cterm=none - hi ColorColumn ctermbg=239 cterm=none endif endif @@ -358,10 +391,8 @@ if exists("g:zenburn_high_Contrast") && g:zenburn_high_Contrast hi CursorLine guibg=#121212 gui=bold if exists("g:zenburn_unified_CursorColumn") && g:zenburn_unified_CursorColumn hi CursorColumn guibg=#121212 gui=bold - hi ColorColumn guibg=#121212 gui=bold else hi CursorColumn guibg=#2b2b2b - hi ColorColumn guibg=#2b2b2b endif hi Pmenu guibg=#242424 guifg=#ccccbc hi PMenuSel guibg=#353a37 guifg=#ccdc90 gui=bold @@ -373,16 +404,16 @@ if exists("g:zenburn_high_Contrast") && g:zenburn_high_Contrast hi TabLineSel guifg=#efefef guibg=#1c1c1b gui=bold hi TabLine guifg=#b6bf98 guibg=#181818 gui=bold hi NonText guifg=#404040 gui=bold + + hi LineNr guifg=#9fafaf guibg=#161616 else " Original, lighter background hi Normal guifg=#dcdccc guibg=#3f3f3f hi CursorLine guibg=#434443 if exists("g:zenburn_unified_CursorColumn") && g:zenburn_unified_CursorColumn hi CursorColumn guibg=#434343 - hi ColorColumn guibg=#434343 else hi CursorColumn guibg=#4f4f4f - hi ColorColumn guibg=#4f4f4f endif hi Pmenu guibg=#2c2e2e guifg=#9f9f9f hi PMenuSel guibg=#242424 guifg=#d0d0a0 gui=bold @@ -394,18 +425,44 @@ else hi TabLineSel guifg=#efefef guibg=#3a3a39 gui=bold hi TabLine guifg=#b6bf98 guibg=#353535 gui=bold hi NonText guifg=#5b605e gui=bold + + hi LineNr guifg=#9fafaf guibg=#262626 endif - -if exists("g:zenburn_alternate_Visual") && g:zenburn_alternate_Visual - " Visual with more contrast, thanks to Steve Hall & Cream posse - " gui=none fixes weird highlight problem in at least GVim 7.0.66, thanks to Kurt Maier - hi Visual guifg=#000000 guibg=#71d3b4 gui=none - hi VisualNOS guifg=#000000 guibg=#71d3b4 gui=none +if exists("g:zenburn_old_Visual") && g:zenburn_old_Visual + if exists("g:zenburn_alternate_Visual") && g:zenburn_alternate_Visual + " Visual with more contrast, thanks to Steve Hall & Cream posse + " gui=none fixes weird highlight problem in at least GVim 7.0.66, thanks to Kurt Maier + hi Visual guifg=#000000 guibg=#71d3b4 gui=none + hi VisualNOS guifg=#000000 guibg=#71d3b4 gui=none + else + " use default visual + hi Visual guifg=#233323 guibg=#71d3b4 gui=none + hi VisualNOS guifg=#233323 guibg=#71d3b4 gui=none + endif else - " use default visual - hi Visual guifg=#233323 guibg=#71d3b4 gui=none - hi VisualNOS guifg=#233323 guibg=#71d3b4 gui=none + " new Visual style + if exists("g:zenburn_high_Contrast") && g:zenburn_high_Contrast + " high contrast + "hi Visual guibg=#304a3d + "hi VisualNos guibg=#304a3d + "TODO no nice greenish in console, 65 is closest. use full black instead, + "although i like the green..! + hi Visual guibg=#0f0f0f + hi VisualNos guibg=#0f0f0f + if &t_Co > 255 + hi Visual ctermbg=0 + endif + else + " low contrast + hi Visual guibg=#2f2f2f + hi VisualNOS guibg=#2f2f2f + + if &t_Co > 255 + hi Visual ctermbg=235 + hi VisualNOS ctermbg=235 + endif + endif endif if exists("g:zenburn_alternate_Error") && g:zenburn_alternate_Error @@ -430,4 +487,75 @@ if exists("g:zenburn_color_also_Ignore") && g:zenburn_color_also_Ignore hi Ignore guifg=#545a4f endif +" new tabline and fold column +if exists("g:zenburn_high_Contrast") && g:zenburn_high_Contrast + hi FoldColumn guibg=#161616 + hi Folded guibg=#161616 + hi TabLine guifg=#88b090 guibg=#313633 gui=none + hi TabLineSel guifg=#ccd990 guibg=#222222 + hi TabLineFill guifg=#88b090 guibg=#313633 gui=none + + hi SpecialKey guibg=#242424 + + if &t_Co > 255 + hi FoldColumn ctermbg=233 ctermfg=109 + hi Folded ctermbg=233 ctermfg=109 + hi TabLine ctermbg=236 ctermfg=108 cterm=none + hi TabLineSel ctermbg=235 ctermfg=186 cterm=bold + hi TabLineFill ctermbg=236 ctermfg=236 + endif +else + hi FoldColumn guibg=#333333 + hi Folded guibg=#333333 + hi TabLine guifg=#d0d0b8 guibg=#222222 gui=none + hi TabLineSel guifg=#f0f0b0 guibg=#333333 gui=bold + hi TabLineFill guifg=#dccdcc guibg=#101010 gui=none + + hi SpecialKey guibg=#444444 + + if &t_Co > 255 + hi FoldColumn ctermbg=236 ctermfg=109 + hi Folded ctermbg=236 ctermfg=109 + hi TabLine ctermbg=235 ctermfg=187 cterm=none + hi TabLineSel ctermbg=236 ctermfg=229 cterm=bold + hi TabLineFill ctermbg=233 ctermfg=233 + endif +endif + +" EXPERIMENTAL ctags_highlighting support +" link/set sensible defaults here; +" +" For now I mostly link to subset of Zenburn colors, the linkage is based +" on appearance, not semantics. In later versions I might define more new colours. +" +" HELP NEEDED to make this work properly. +if exists("_zenburn_ctags") && _zenburn_ctags + + " Highlighter seems to think a lot of things are global variables even + " though they're not. Example: python method-local variable is + " coloured as a global variable. They should not be global, since + " they're not visible outside the method. + " If this is some very bright colour group then things look bad. + hi link CTagsGlobalVariable Identifier + + hi CTagsClass guifg=#acd0b3 + if &t_Co > 255 + hi CTagsClass ctermfg=115 + endif + + hi link CTagsImport Statement + hi link CTagsMember Function + + hi link CTagsGlobalConstant Constant + + " These do not yet have support, I can't get them to appear + hi link EnumerationValue Float + hi link EnumerationName Identifier + hi link DefinedName WarningMsg + hi link LocalVariable WarningMsg + hi link Structure WarningMsg + hi link Union WarningMsg +endif + " TODO check for more obscure syntax groups that they're ok + diff --git a/doc/mark.txt b/doc/mark.txt index a54c3e8..343489d 100644 --- a/doc/mark.txt +++ b/doc/mark.txt @@ -55,14 +55,15 @@ HIGHLIGHTING *mark-highlighting* {Visual}m Mark or unmark the visual selection. *r* *v_r* r Manually input a regular expression to mark. -{Visual}r (Based on the visual selection.) +{Visual}r Ditto, based on the visual selection. In accordance with the built-in |star| command, all these mappings use 'ignorecase', but not 'smartcase'. *n* n Clear the mark under the cursor. - If not on a mark: Clear all marks. + If not on a mark: Disable all marks, similar to + |:nohlsearch|. Note: Marks that span multiple lines are not detected, so the use of n on such a mark will @@ -73,7 +74,13 @@ HIGHLIGHTING *mark-highlighting* :Mark {pattern} Mark or unmark {pattern}. For implementation reasons, {pattern} cannot use the 'smartcase' setting, only 'ignorecase'. -:Mark Clear all marks. +:Mark Disable all marks, similar to |:nohlsearch|. Marks + will automatically re-enable when a mark is added or + removed, or a search for marks is performed. + *:MarkClear* +:MarkClear Clear all marks. In contrast to disabling marks, the + actual mark information is cleared, the next mark will + use the first highlight group. This cannot be undone. SEARCHING *mark-searching* @@ -109,16 +116,47 @@ SEARCHING *mark-searching* You can use Vim's |jumplist| to go back to previous mark matches and the position before a mark search. +MARK PERSISTENCE *mark-persistence* + +The marks can be kept and restored across Vim sessions, using the |viminfo| +file. For this to work, the "!" flag must be part of the 'viminfo' setting: > + set viminfo+=! " Save and restore global variables. +< *:MarkLoad* +:MarkLoad Restore the marks from the previous Vim session. All + current marks are discarded. + *:MarkSave* +:MarkSave Save the currently defined marks (or clear the + persisted marks if no marks are currently defined) for + use in a future Vim session. + +By default, automatic persistence is enabled (so you don't need to explicitly +|:MarkSave|), but you have to explicitly load the persisted marks in a new Vim +session via |:MarkLoad|, to avoid that you accidentally drag along outdated +highlightings from Vim session to session, and be surprised by the arbitrary +highlight groups and occasional appearance of forgotten marks. If you want +just that though and automatically restore any marks, set |g:mwAutoLoadMarks|. + +You can also initialize the marks to static values, e.g. by including this in +|vimrc|: > + runtime plugin/mark.vim + silent MarkClear + Mark foo + Mark bar +Or you can define custom commands that preset certain marks: > + command -bar MyMarks silent MarkClear | execute 'Mark foo' | execute 'Mark bar' +Or a command that adds to the existing marks and then toggles them: > + command -bar ToggleFooBarMarks execute 'Mark foo' | execute 'Mark bar' + ============================================================================== INSTALLATION *mark-installation* This script is packaged as a|vimball|. If you have the "gunzip" decompressor in your PATH, simply edit the *.vba.gz package in Vim; otherwise, decompress the archive first, e.g. using WinZip. Inside Vim, install by sourcing the -vimball or via the|:UseVimball|command. > +vimball or via the |:UseVimball| command. > vim mark.vba.gz :so % -To uninstall, use the|:RmVimball|command. +To uninstall, use the |:RmVimball| command. DEPENDENCIES *mark-dependencies* @@ -135,13 +173,30 @@ Higher numbers always take precedence and are displayed above lower ones. The search type highlighting (in the search message) can be changed via: > highlight link SearchSpecialSearchType MoreMsg -< *g:mwHistAdd* +< + *g:mwHistAdd* By default, any marked words are also added to the search (/) and input (@) history; if you don't want that, remove the corresponding symbols from: > let g:mwHistAdd = '/@' < -You can use different mappings by mapping to the Mark... mappings before -this plugin is sourced. To remove the default overriding of * and #, use: > + *g:mwAutoLoadMarks* +To enable the automatic restore of marks from a previous Vim session: > + let g:mwAutoLoadMarks = 1 +< *g:mwAutoSaveMarks* +To turn off the automatic persistence of marks across Vim sessions: > + let g:mwAutoSaveMarks = 0 +You can still explicitly save marks via |:MarkSave|. + + *mark-mappings* +You can use different mappings by mapping to the Mark... mappings (use +":map Mark" to list them all) before this plugin is sourced. + +There are no default mappings for toggling all marks and for the |:MarkClear| +command, but you can define some yourself: > + nmap M MarkToggle + nmap N MarkAllClear +< +To remove the default overriding of * and #, use: > nmap IgnoreMarkSearchNext MarkSearchNext nmap IgnoreMarkSearchPrev MarkSearchPrev < @@ -163,20 +218,21 @@ IDEAS *mark-ideas* Taken from an alternative implementation at http://vim.wikia.com/wiki/Highlight_multiple_words: -- Allow to specify the highlight group number via :Mark [n] {regexp} +- Allow to specify the highlight group number via :[N]Mark {regexp} - Use keys 1-9 on the numeric keypad to toggle a highlight group number. -- Persist the patterns in a uppercase global variable across Vim sessions. - (Request from Mun Johl, 16-Apr-2010.) - Can be somewhat emulated by placing something like this in |vimrc|: > - runtime plugin/mark.vim - Mark foo - Mark bar -< or defining a custom command a la: > - command -bar MyMarks execute "Mark foo" | execute "Mark bar" ============================================================================== HISTORY *mark-history* +2.5.0 07-May-2011 +- ENH: Add explicit mark persistence via :MarkLoad and :MarkSave commands and + automatic persistence via the g:mwAutoLoadMarks and g:mwAutoSaveMarks + configuration flags. (Request from Mun Johl, 16-Apr-2010) +- Expose toggling of mark display (keeping the mark patterns) via new + MarkToggle mapping. Offer :MarkClear command as a replacement for the + old argumentless :Mark command, which now just disables, but not clears all + marks. + 2.4.4 18-Apr-2011 - BUG: Include trailing newline character in check for current mark, so that a mark that matches the entire line (e.g. created by Vm) can be diff --git a/doc/tagbar.txt b/doc/tagbar.txt index 805fa7a..a80b93f 100644 --- a/doc/tagbar.txt +++ b/doc/tagbar.txt @@ -3,7 +3,7 @@ Author: Jan Larres Licence: Vim licence, see |license| Homepage: http://majutsushi.github.com/tagbar/ -Version: 1.5 +Version: 2.0.1 ============================================================================== Contents *tagbar* *tagbar-contents* @@ -11,12 +11,15 @@ Contents *tagbar* *tagbar-contents* 1. Intro ........................... |tagbar-intro| Pseudo-tags ................... |tagbar-pseudotags| Supported features ............ |tagbar-features| + Other ctags-compatible programs |tagbar-other| 2. Requirements .................... |tagbar-requirements| 3. Installation .................... |tagbar-installation| 4. Usage ........................... |tagbar-usage| Commands ...................... |tagbar-commands| Key mappings .................. |tagbar-keys| 5. Configuration ................... |tagbar-configuration| + Highlight colours ............. |tagbar-highlight| + Automatically opening Tagbar .. |tagbar-autoopen| 6. Extending Tagbar ................ |tagbar-extend| 7. Bugs and limitations ............ |tagbar-bugs| 8. History ......................... |tagbar-history| @@ -100,6 +103,16 @@ The following features are supported by Tagbar: Tex, Vera, Verilog, VHDL, Vim and YACC. - Can be extended to support arbitrary new types. +------------------------------------------------------------------------------ +OTHER CTAGS-COMPATIBLE PROGRAMS *tagbar-other* + +Tagbar theoretically also supports filetype-specific programs that can output +tag information that is compatible with ctags. However due to potential +incompatibilities this may not always completely work. Tagbar has been tested +with doctorjs/jsctags and will use that if present, other programs require +some configuration (see |tagbar-extend|). If a program does not work even with +correct configuration please contact me. + ============================================================================== 2. Requirements *tagbar-requirements* @@ -117,15 +130,15 @@ The following requirements have to be met in order to be able to use tagbar: Tagbar will work on any platform that ctags runs on -- this includes UNIX derivatives, Mac OS X and Windows. Note that other versions like GNU ctags will not work. - Tagbar generates the tag information by itself and doesn't need already - existing tag files. + Tagbar generates the tag information by itself and doesn't need (or use) + already existing tag files. - File type detection must be turned on in vim. This can be done with the following command in your vimrc: > filetype on < See |filetype| for more information. - - Tagbar will not work in |restricted-mode|. + - Tagbar will not work in |restricted-mode| or with 'compatible' set. ============================================================================== 3. Installation *tagbar-installation* @@ -195,9 +208,9 @@ in the Tagbar window. The current sort order is displayed in the statusbar of the Tagbar window. Folding~ -The displayed scopes (and unscoped types) can be folded to hide untinteresting -information. Unfortunately the folding state is lost once you leave the Tagbar -window, see |tagbar-bugs|. +The displayed scopes (and unscoped types) can be folded to hide uninteresting +information. Mappings similar to Vim's built-in ones are provided. Folds can +also be opened and closed by clicking on the fold icon with the mouse. Displaying the prototype of a tag~ Tagbar can display the prototype of a tag. More precisely it can display the @@ -223,20 +236,38 @@ COMMANDS *tagbar-commands* Open the Tagbar window and close it on tag selection, regardless of the setting of |g:tagbar_autoclose|. If it was already open jump to it. +:TagbarSetFoldlevel [number] + Set the foldlevel of the tags of the current file to [number]. The + foldlevel of tags in other files remains unaffected. Works in the same way + as 'foldlevel'. + +:TagbarShowTag + Open the parent folds of the current tag in the file window as much as + needed for the tag to be visible in the Tagbar window. + ------------------------------------------------------------------------------ KEY MAPPINGS *tagbar-keys* These mappings are valid in the Tagbar window: Display key mapping help. -/ Jump to the tag under the cursor. Doesn't work for pseudo-tags. +/ Jump to the tag under the cursor. Doesn't work for pseudo-tags + or generic headers. +p Jump to the tag under the cursor, but stay in the Tagbar window. + When on a fold icon, open or close the fold depending on the + current state. <2-LeftMouse> Same as . Display the prototype of the current tag (i.e. the line defining it) in the command line. -+ Open the fold under the cursor. -- Close the fold under the cursor. -* Open all folds. -= Close all folds. ++/zo Open the fold under the cursor. +-/zc Close the fold under the cursor or the current one if there is + no fold under the cursor. +o/za Toggle the fold under the cursor or the current one if there is + no fold under the cursor. +*/zR Open all folds by setting foldlevel to 99. +=/zM Close all folds by setting foldlevel to 0. + Go to the next top-level tag. + Go to the previous top-level tag. s Toggle sort order between name and file order. x Toggle zooming the window. q Close the Tagbar window. @@ -246,6 +277,8 @@ q Close the Tagbar window. *g:tagbar_ctags_bin* g:tagbar_ctags_bin~ +Default: empty + Use this option to specify the location of your ctags executable. Only needed if it is not in one of the directories in your $PATH environment variable. @@ -256,6 +289,8 @@ Example: *g:tagbar_left* g:tagbar_left~ +Default: 0 + By default the Tagbar window will be opened on the right-hand side of vim. Set this option to open it on the left instead. @@ -266,7 +301,9 @@ Example: *g:tagbar_width* g:tagbar_width~ -Width of the Tagbar window in characters. The default is 40. +Default: 40 + +Width of the Tagbar window in characters. Example: > @@ -275,8 +312,10 @@ Example: *g:tagbar_autoclose* g:tagbar_autoclose~ +Default: 0 + If you set this option the Tagbar window will automatically close when you -jump to a tag. The default is to not automatically close the window. +jump to a tag. Example: > @@ -285,8 +324,10 @@ Example: *g:tagbar_autofocus* g:tagbar_autofocus~ +Default: 0 + If you set this option the cursor will move to the Tagbar window when it is -opened. The default is to not move the cursor to the window. +opened. Example: > @@ -295,9 +336,12 @@ Example: *g:tagbar_sort* g:tagbar_sort~ +Default: 1 + If this option is set the tags are sorted according to their name. If it is -unset they are sorted according to their order in the source file. The default -is to sort them by name. +unset they are sorted according to their order in the source file. Note that +in the second case Pseudo-tags are always sorted before normal tags of the +same kind since they don't have a real position in the file. Example: > @@ -306,9 +350,11 @@ Example: *g:tagbar_compact* g:tagbar_compact~ +Default: 0 + Setting this option will result in Tagbar omitting the short help at the top of the window and the blank lines in between top-level scopes in order to -save screen real estate. The default is to not use compact mode. +save screen real estate. Example: > @@ -317,15 +363,124 @@ Example: *g:tagbar_expand* g:tagbar_expand~ +Default: 0 + If this option is set the Vim window will be expanded by the width of the -Tagbar window if using a GUI version of Vim. The default is not to expand the -window. +Tagbar window if using a GUI version of Vim. Example: > let g:tagbar_expand = 1 < + *g:tagbar_foldlevel* +g:tagbar_foldlevel~ +Default: 99 + +The initial foldlevel for folds in the Tagbar window. Fold with a level higher +than this number will be closed. + +Example: +> + let g:tagbar_foldlevel = 2 +< + + *g:tagbar_usearrows* +g:tagbar_usearrows~ +{Windows only} +Default: 0 + +Tagbar can display nice Unicode arrows instead of +/- characters as fold icons. +However, Windows doesn't seem to be able to substitute in characters from +other fonts if the current font doesn't support them. This means that you have +to use a font that supports those arrows. Unfortunately there is no way to +detect whether specific characters are supported in the current font. So if +your font supports those arrows you have to set this option to make it work. + +Example: +> + let g:tagbar_usearrows = 1 +< + + *g:tagbar_autoshowtag* +g:tagbar_autoshowtag~ +Default: 0 + +If this variable is set and the current tag is inside of a closed fold then +the folds will be opened as much as needed for the tag to be visible so it can +be highlighted. If it is not set then the folds won't be opened and the parent +tag will be highlighted instead. You can use the TagbarShowTag command to open +the folds manually. + +Example: +> + let g:tagbar_autoshowtag = 1 +< + +------------------------------------------------------------------------------ +HIGHLIGHT COLOURS *tagbar-highlight* + +All of the colours used by Tagbar can be customized. Here is a list of the +highlight groups that are defined by Tagbar: + +TagbarComment + The help at the top of the buffer. + +TagbarKind + The header of generic "kinds" like "functions" and "variables". + +TagbarScope + Tags that define a scope like classes, structs etc. + +TagbarType + The type of a tag or scope if available. + +TagbarSignature + Function signatures. + +TagbarPseudoID + The asterisk (*) that signifies a pseudo-tag. + +TagbarFoldIcon + The fold icon on the left of foldable tags. + +TagbarHighlight + The colour that is used for automatically highlighting the current tag. + +TagbarAccessPublic + The "public" visibility/access symbol. + +TagbarAccessProtected + The "protected" visibility/access symbol. + +TagbarAccessPrivate + The "private" visibility/access symbol. + +If you want to change any of those colours put a line like the following in +your vimrc: +> + highlight TagbarScope guifg=Green ctermfg=Green +< +See |:highlight| for more information. + +------------------------------------------------------------------------------ +AUTOMATICALLY OPENING TAGBAR *tagbar-autoopen* + +If you want Tagbar to open automatically, for example on Vim startup or for +specific filetypes, there are various ways to do it. For example, to always +open Tagbar on Vim startup you can put this into your vimrc file: +> + autocmd VimEnter * nested TagbarOpen +< +If you want to have it start for specific filetypes put +> + TagbarOpen +< +into a corresponding filetype plugin (see |filetype-plugin|). + +Check out |autocmd.txt| if you want it to automatically open in more +complicated cases. + ============================================================================== 6. Extending Tagbar *tagbar-extend* @@ -344,17 +499,21 @@ kinds: A list of the "language kinds" that should be listed in Tagbar, Use the command > ctags --list-kinds={language name} < to get a list of the kinds ctags supports for a given language. An - entry in this list is a string with two parts separated by a - colon: the first part is the one-character abbreviation that ctags - uses, and the second part is an arbitrary string that will be used - in Tagbar as the header for the tags of this kind that are not - listed under a specific scope. For example, the string > - "f:functions" + entry in this list is a string with two or three parts separated + by a colon: the first part is the one-character abbreviation that + ctags uses, and the second part is an arbitrary string that will + be used in Tagbar as the header for the tags of this kind that are + not listed under a specific scope. The optional third part + determines whether tags of this kind should be folded by default, + with 1 meaning they should be folded and 0 they should not. If + this part is omitted the tags will not be folded by default. For + example, the string > + "f:functions:1" < would list all the function definitions in a file under the header - "functions". + "functions" and fold them. sro: The scope resolution operator. For example, in C++ it is "::" and - in Java it is ".". When in doubt run ctags as shown above and look - at the output. + in Java it is ".". If in doubt run ctags as shown above and check + the output. kind2scope: A dictionary describing the mapping of tag kinds (in their one-character representation) to the scopes their children will appear in, for example classes, structs etc. @@ -403,8 +562,20 @@ deffile: The path to a file with additional ctags definitions (see the < Then the "deffile" entry would look like this to allow for the plugin to be installed in an arbitray location (for example with pathogen): > + 'deffile' : expand(':p:h:h') . '/ctags/mylang.cnf' < +ctagsbin: The path to a filetype-specific ctags-compatible program like +{optional} jsctags. Set it in the same way as |g:tagbar_ctags_bin|. jsctags is + used automatically if found in your $PATH and does not have to be + set in that case. If it is not in your path you have to provide the + complete configuration and use the "replace" key (see the + Tagbar source code for the suggested configuration). +ctagsargs: The arguments to be passed to the filetype-specific ctags program +{optional} (without the filename). Make sure you set an option that makes the + program output its data on stdout. Not used for the normal ctags + program. + You then have to assign this dictionary to a variable with the name > @@ -424,8 +595,8 @@ used in Tagbar. let g:tagbar_type_cpp = { \ 'ctagstype' : 'c++', \ 'kinds' : [ - \ 'd:macros', - \ 'p:prototypes', + \ 'd:macros:1', + \ 'p:prototypes:1', \ 'g:enums', \ 'e:enumerators', \ 't:typedefs', @@ -467,7 +638,7 @@ the order of enums and typedefs, you would do it like this: > let g:tagbar_type_cpp = { \ 'kinds' : [ - \ 'd:macros', + \ 'd:macros:1', \ 'g:enums', \ 't:typedefs', \ 'e:enumerators', @@ -542,8 +713,8 @@ Now we have to create the Tagbar language definition in our vimrc: \ 's:sections', \ 'g:graphics', \ 'l:labels', - \ 'r:refs', - \ 'p:pagerefs' + \ 'r:refs:1', + \ 'p:pagerefs:1' \ ], \ 'sort' : 0, \ 'deffile' : expand(':p:h:h') . '/ctags/latex.cnf' @@ -606,13 +777,24 @@ files. problem in practice anyway. Tags with the same name at any other level are no problem, though. - - The fold state of the Tagbar window is lost when the window is left. - Again, I don't know of any proper way around this that still allows - auto-updating -- |winsaveview()| doesn't really help here. - ============================================================================== 8. History *tagbar-history* +2.0.1 (2011-04-26) + - Fix sorting bug when 'ignorecase' is set + +2.0 (2011-04-26) + - Folding now works correctly. Folds will be preserved when leaving the + Tagbar window and when switching between files. Also tag types can be + configured to be folded by default, which is useful for things like + includes and imports. + - DoctorJS/jsctags and other compatible programs are now supported. + - All of the highlight groups can now be overridden. + - Added keybinding to quickly jump to next/previous top-level tag. + - Added Taglist's "p" keybinding for jumping to a tag without leaving the + Tagbar window. + - Several bugfixes and other small improvements. + 1.5 (2011-03-06) - Type definitions can now include a path to a file with the ctags definition. This is especially useful for ftplugins that can now ship @@ -659,5 +841,15 @@ warranty of any kind, either expressed or implied. In no event will the copyright holder be liable for any damamges resulting from the use of this software. +The folding technique was inspired by NERDTree by Martin Grenfell. + +Taybin Rutkin: + - Contributed tagbar_autofocus option +Seth Milliken: + - Contributed folding keybindings that resemble the built-in ones + +Thanks to the following people for feature suggestions etc: Jan Christoph +Ebersbach, pielgrzym + ============================================================================== vim: tw=78 ts=8 sw=8 sts=8 noet ft=help diff --git a/doc/tags b/doc/tags index 2237788..5bc907e 100644 --- a/doc/tags +++ b/doc/tags @@ -79,6 +79,9 @@ :Loremipsum loremipsum.txt /*:Loremipsum* :Loreplace loremipsum.txt /*:Loreplace* :Mark mark.txt /*:Mark* +:MarkClear mark.txt /*:MarkClear* +:MarkLoad mark.txt /*:MarkLoad* +:MarkSave mark.txt /*:MarkSave* :Modified: vimblogger_ft.txt /*:Modified:* :PreviewBlogArticle vimblogger_ft.txt /*:PreviewBlogArticle* :SendBlogArticle vimblogger_ft.txt /*:SendBlogArticle* @@ -365,16 +368,21 @@ g:loremipsum_files loremipsum.txt /*g:loremipsum_files* g:loremipsum_marker loremipsum.txt /*g:loremipsum_marker* g:loremipsum_paragraph_template loremipsum.txt /*g:loremipsum_paragraph_template* g:loremipsum_words loremipsum.txt /*g:loremipsum_words* +g:mwAutoLoadMarks mark.txt /*g:mwAutoLoadMarks* +g:mwAutoSaveMarks mark.txt /*g:mwAutoSaveMarks* g:mwHistAdd mark.txt /*g:mwHistAdd* g:snippets_dir snipMate.txt /*g:snippets_dir* g:snips_author snipMate.txt /*g:snips_author* g:tagbar_autoclose tagbar.txt /*g:tagbar_autoclose* g:tagbar_autofocus tagbar.txt /*g:tagbar_autofocus* +g:tagbar_autoshowtag tagbar.txt /*g:tagbar_autoshowtag* g:tagbar_compact tagbar.txt /*g:tagbar_compact* g:tagbar_ctags_bin tagbar.txt /*g:tagbar_ctags_bin* g:tagbar_expand tagbar.txt /*g:tagbar_expand* +g:tagbar_foldlevel tagbar.txt /*g:tagbar_foldlevel* g:tagbar_left tagbar.txt /*g:tagbar_left* g:tagbar_sort tagbar.txt /*g:tagbar_sort* +g:tagbar_usearrows tagbar.txt /*g:tagbar_usearrows* g:tagbar_width tagbar.txt /*g:tagbar_width* g:vimwiki_CJK_length vimwiki.txt /*g:vimwiki_CJK_length* g:vimwiki_auto_checkbox vimwiki.txt /*g:vimwiki_auto_checkbox* @@ -440,6 +448,8 @@ mark-ideas mark.txt /*mark-ideas* mark-installation mark.txt /*mark-installation* mark-known-problems mark.txt /*mark-known-problems* mark-limitations mark.txt /*mark-limitations* +mark-mappings mark.txt /*mark-mappings* +mark-persistence mark.txt /*mark-persistence* mark-searching mark.txt /*mark-searching* mark-todo mark.txt /*mark-todo* mark-usage mark.txt /*mark-usage* @@ -873,6 +883,7 @@ surround-replacements surround.txt /*surround-replacements* surround-targets surround.txt /*surround-targets* surround.txt surround.txt /*surround.txt* tagbar tagbar.txt /*tagbar* +tagbar-autoopen tagbar.txt /*tagbar-autoopen* tagbar-bugs tagbar.txt /*tagbar-bugs* tagbar-commands tagbar.txt /*tagbar-commands* tagbar-configuration tagbar.txt /*tagbar-configuration* @@ -880,10 +891,12 @@ tagbar-contents tagbar.txt /*tagbar-contents* tagbar-credits tagbar.txt /*tagbar-credits* tagbar-extend tagbar.txt /*tagbar-extend* tagbar-features tagbar.txt /*tagbar-features* +tagbar-highlight tagbar.txt /*tagbar-highlight* tagbar-history tagbar.txt /*tagbar-history* tagbar-installation tagbar.txt /*tagbar-installation* tagbar-intro tagbar.txt /*tagbar-intro* tagbar-keys tagbar.txt /*tagbar-keys* +tagbar-other tagbar.txt /*tagbar-other* tagbar-pseudotags tagbar.txt /*tagbar-pseudotags* tagbar-requirements tagbar.txt /*tagbar-requirements* tagbar-todo tagbar.txt /*tagbar-todo* diff --git a/plugin/mark.vim b/plugin/mark.vim index 7a6378f..e51c373 100644 --- a/plugin/mark.vim +++ b/plugin/mark.vim @@ -13,8 +13,28 @@ " - Requires Vim 7.1 with "matchadd()", or Vim 7.2 or higher. " - mark.vim autoload script. " -" Version: 2.4.3 +" Version: 2.5.0 " Changes: +" 06-May-2011, Ingo Karkat +" - By default, enable g:mwAutoSaveMarks, so that marks are always persisted, +" but disable g:mwAutoLoadMarks, so that persisted marks have to be explicitly +" loaded, if that is desired. I often wondered why I got unexpected mark +" highlightings in a new Vim session until I realized that I had used marks in +" a previous session and forgot to clear them. +" +" 21-Apr-2011, Ingo Karkat +" - Expose toggling of mark display (keeping the mark patterns) via new +" MarkToggle mapping. Offer :MarkClear command as a replacement for the +" old argumentless :Mark command, which now just disables, but not clears all +" marks. +" - Implement lazy-loading of disabled persistent marks via g:mwDoDeferredLoad +" flag passing to autoload/mark.vim. +" +" 19-Apr-2011, Ingo Karkat +" - ENH: Add explicit mark persistence via :MarkLoad and :MarkSave commands and +" automatic persistence via the g:mwAutoLoadMarks and g:mwAutoSaveMarks +" configuration flags. +" " 15-Apr-2011, Ingo Karkat " - Avoid losing the mark highlightings on :syn on or :colorscheme commands. " Thanks to Zhou YiChao for alerting me to this issue and suggesting a fix. @@ -138,10 +158,18 @@ endif let g:loaded_mark = 1 "- configuration -------------------------------------------------------------- -if !exists('g:mwHistAdd') +if ! exists('g:mwHistAdd') let g:mwHistAdd = '/@' endif +if ! exists('g:mwAutoLoadMarks') + let g:mwAutoLoadMarks = 0 +endif + +if ! exists('g:mwAutoSaveMarks') + let g:mwAutoSaveMarks = 1 +endif + "- default highlightings ------------------------------------------------------ function! s:DefaultHighlightings() @@ -168,7 +196,8 @@ vnoremap MarkSet :call mark#DoMark(mark#GetVisualSele nnoremap MarkRegex :call mark#MarkRegex('') vnoremap MarkRegex :call mark#MarkRegex(mark#GetVisualSelectionAsRegexp()) nnoremap MarkClear :call mark#DoMark(mark#CurrentMark()[0]) -nnoremap MarkAllClear :call mark#DoMark() +nnoremap MarkAllClear :call mark#ClearAll() +nnoremap MarkToggle :call mark#Toggle() nnoremap MarkSearchCurrentNext :call mark#SearchCurrentMark(0) nnoremap MarkSearchCurrentPrev :call mark#SearchCurrentMark(1) @@ -196,6 +225,7 @@ if !hasmapto('MarkClear', 'n') nmap n MarkClear endif " No default mapping for MarkAllClear. +" No default mapping for MarkToggle. if !hasmapto('MarkSearchCurrentNext', 'n') nmap * MarkSearchCurrentNext @@ -219,5 +249,41 @@ endif "- commands ------------------------------------------------------------------- command! -nargs=? Mark call mark#DoMark() +command! -bar MarkClear call mark#ClearAll() + +command! -bar MarkLoad call mark#LoadCommand(1) +command! -bar MarkSave call mark#SaveCommand() + + +"- marks persistence ---------------------------------------------------------- +if g:mwAutoLoadMarks + " As the viminfo is only processed after sourcing of the runtime files, the + " persistent global variables are not yet available here. Defer this until Vim + " startup has completed. + function! s:AutoLoadMarks() + if g:mwAutoLoadMarks && exists('g:MARK_MARKS') && g:MARK_MARKS !=# '[]' + if ! exists('g:MARK_ENABLED') || g:MARK_ENABLED + " There are persistent marks and they haven't been disabled; we need to + " show them right now. + call mark#LoadCommand(0) + else + " Though there are persistent marks, they have been disabled. We avoid + " sourcing the autoload script and its invasive autocmds right now; + " maybe the marks are never turned on. We just inform the autoload + " script that it should do this once it is sourced on-demand by a + " mark mapping or command. + let g:mwDoDeferredLoad = 1 + endif + endif + endfunction + + augroup MarkInitialization + autocmd! + " Note: Avoid triggering the autoload unless there actually are persistent + " marks. For that, we need to check that g:MARK_MARKS doesn't contain the + " empty list representation, and also :execute the :call. + autocmd VimEnter * call AutoLoadMarks() + augroup END +endif " vim: ts=2 sw=2 diff --git a/plugin/tagbar.vim b/plugin/tagbar.vim index d0371e8..b9aaf7f 100644 --- a/plugin/tagbar.vim +++ b/plugin/tagbar.vim @@ -4,7 +4,7 @@ " Author: Jan Larres " Licence: Vim licence " Website: http://majutsushi.github.com/tagbar/ -" Version: 1.5 +" Version: 2.0.1 " Note: This plugin was heavily inspired by the 'Taglist' plugin by " Yegappan Lakshmanan and uses a small amount of code from it. " @@ -23,6 +23,8 @@ if &cp || exists('g:loaded_tagbar') endif " Initialization {{{1 + +" Basic init {{{2 if !exists('g:tagbar_ctags_bin') if executable('ctags-exuberant') let g:tagbar_ctags_bin = 'ctags-exuberant' @@ -38,6 +40,13 @@ if !exists('g:tagbar_ctags_bin') echomsg 'Tagbar: Exuberant ctags not found, skipping plugin' finish endif +else + let g:tagbar_ctags_bin = expand(g:tagbar_ctags_bin) + if !executable(g:tagbar_ctags_bin) + echomsg 'Tagbar: Exuberant ctags not found in specified place,' + \ 'skipping plugin' + finish + endif endif let g:loaded_tagbar = 1 @@ -70,97 +79,115 @@ if !exists('g:tagbar_expand') let g:tagbar_expand = 0 endif +if !exists('g:tagbar_foldlevel') + let g:tagbar_foldlevel = 99 +endif + +if !exists('g:tagbar_usearrows') + let g:tagbar_usearrows = 0 +endif + +if !exists('g:tagbar_autoshowtag') + let g:tagbar_autoshowtag = 0 +endif + +if has('multi_byte') && has('unix') && &encoding == 'utf-8' && + \ (empty(&termencoding) || &termencoding == 'utf-8') + let s:icon_closed = '▶' + let s:icon_open = '▼' +elseif has('multi_byte') && (has('win32') || has('win64')) && g:tagbar_usearrows + let s:icon_closed = '▷' + let s:icon_open = '◢' +else + let s:icon_closed = '+' + let s:icon_open = '-' +endif + let s:type_init_done = 0 -let s:key_mapping_done = 0 let s:autocommands_done = 0 let s:window_expanded = 0 +let s:access_symbols = { + \ 'public' : '+', + \ 'protected' : '#', + \ 'private' : '-' +\ } + " s:InitTypes() {{{2 function! s:InitTypes() - " Dictionary of the already processed files, indexed by file name with - " complete path. - " The entries are again dictionaries with the following fields: - " - mtime: File modification time - " - ftype: The vim file type - " - tags: List of the tags that are present in the file, sorted - " according to the value of 'g:tagbar_sort' - " - fline: Dictionary of the tags, indexed by line number in the file - " - tline: Dictionary of the tags, indexed by line number in the tagbar - let s:known_files = {} - let s:known_types = {} " Ant {{{3 let type_ant = {} let type_ant.ctagstype = 'ant' let type_ant.kinds = [ - \ 'p:projects', - \ 't:targets' + \ {'short' : 'p', 'long' : 'projects', 'fold' : 0}, + \ {'short' : 't', 'long' : 'targets', 'fold' : 0} \ ] let s:known_types.ant = type_ant " Asm {{{3 let type_asm = {} let type_asm.ctagstype = 'asm' let type_asm.kinds = [ - \ 'm:macros', - \ 't:types', - \ 'd:defines', - \ 'l:labels' + \ {'short' : 'm', 'long' : 'macros', 'fold' : 0}, + \ {'short' : 't', 'long' : 'types', 'fold' : 0}, + \ {'short' : 'd', 'long' : 'defines', 'fold' : 0}, + \ {'short' : 'l', 'long' : 'labels', 'fold' : 0} \ ] let s:known_types.asm = type_asm " ASP {{{3 let type_aspvbs = {} let type_aspvbs.ctagstype = 'asp' let type_aspvbs.kinds = [ - \ 'd:constants', - \ 'c:classes', - \ 'f:functions', - \ 's:subroutines', - \ 'v:variables' + \ {'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} \ ] let s:known_types.aspvbs = type_aspvbs " Awk {{{3 let type_awk = {} let type_awk.ctagstype = 'awk' let type_awk.kinds = [ - \ 'f:functions' + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} \ ] let s:known_types.awk = type_awk " Basic {{{3 let type_basic = {} let type_basic.ctagstype = 'basic' let type_basic.kinds = [ - \ 'c:constants', - \ 'g:enumerations', - \ 'f:functions', - \ 'l:labels', - \ 't:types', - \ 'v:variables' + \ {'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} \ ] let s:known_types.basic = type_basic " BETA {{{3 let type_beta = {} let type_beta.ctagstype = 'beta' let type_beta.kinds = [ - \ 'f:fragments', - \ 's:slots', - \ 'v:patterns' + \ {'short' : 'f', 'long' : 'fragments', 'fold' : 0}, + \ {'short' : 's', 'long' : 'slots', 'fold' : 0}, + \ {'short' : 'v', 'long' : 'patterns', 'fold' : 0} \ ] let s:known_types.beta = type_beta " C {{{3 let type_c = {} let type_c.ctagstype = 'c' let type_c.kinds = [ - \ 'd:macros', - \ 'p:prototypes', - \ 'g:enums', - \ 'e:enumerators', - \ 't:typedefs', - \ 's:structs', - \ 'u:unions', - \ 'm:members', - \ 'v:variables', - \ 'f:functions' + \ {'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} \ ] let type_c.sro = '::' let type_c.kind2scope = { @@ -178,18 +205,18 @@ function! s:InitTypes() let type_cpp = {} let type_cpp.ctagstype = 'c++' let type_cpp.kinds = [ - \ 'd:macros', - \ 'p:prototypes', - \ 'g:enums', - \ 'e:enumerators', - \ 't:typedefs', - \ 'n:namespaces', - \ 'c:classes', - \ 's:structs', - \ 'u:unions', - \ 'f:functions', - \ 'm:members', - \ 'v:variables' + \ {'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} \ ] let type_cpp.sro = '::' let type_cpp.kind2scope = { @@ -211,18 +238,18 @@ function! s:InitTypes() let type_cs = {} let type_cs.ctagstype = 'c#' let type_cs.kinds = [ - \ 'd:macros', - \ 'f:fields', - \ 'g:enums', - \ 'e:enumerators', - \ 't:typedefs', - \ 'n:namespaces', - \ 'i:interfaces', - \ 'c:classes', - \ 's:structs', - \ 'E:events', - \ 'm:methods', - \ 'p:properties' + \ {'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} \ ] let type_cs.sro = '.' let type_cs.kind2scope = { @@ -244,28 +271,28 @@ function! s:InitTypes() let type_cobol = {} let type_cobol.ctagstype = 'cobol' let type_cobol.kinds = [ - \ 'd:data items', - \ 'f:file descriptions', - \ 'g:group items', - \ 'p:paragraphs', - \ 'P:program ids', - \ 's:sections' + \ {'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} \ ] let s:known_types.cobol = type_cobol " DOS Batch {{{3 let type_dosbatch = {} let type_dosbatch.ctagstype = 'dosbatch' let type_dosbatch.kinds = [ - \ 'l:labels', - \ 'v:variables' + \ {'short' : 'l', 'long' : 'labels', 'fold' : 0}, + \ {'short' : 'v', 'long' : 'variables', 'fold' : 0} \ ] let s:known_types.dosbatch = type_dosbatch " Eiffel {{{3 let type_eiffel = {} let type_eiffel.ctagstype = 'eiffel' let type_eiffel.kinds = [ - \ 'c:classes', - \ 'f:features' + \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, + \ {'short' : 'f', 'long' : 'features', 'fold' : 0} \ ] let type_eiffel.sro = '.' " Not sure, is nesting even possible? let type_eiffel.kind2scope = { @@ -281,10 +308,10 @@ function! s:InitTypes() let type_erlang = {} let type_erlang.ctagstype = 'erlang' let type_erlang.kinds = [ - \ 'm:modules', - \ 'd:macro definitions', - \ 'f:functions', - \ 'r:record definitions' + \ {'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} \ ] let type_erlang.sro = '.' " Not sure, is nesting even possible? let type_erlang.kind2scope = { @@ -302,12 +329,12 @@ function! s:InitTypes() let type_mxml = {} let type_mxml.ctagstype = 'flex' let type_mxml.kinds = [ - \ 'v:global variables', - \ 'c:classes', - \ 'm:methods', - \ 'p:properties', - \ 'f:functions', - \ 'x:mxtags' + \ {'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} \ ] let type_mxml.sro = '.' let type_mxml.kind2scope = { @@ -321,18 +348,18 @@ function! s:InitTypes() let type_fortran = {} let type_fortran.ctagstype = 'fortran' let type_fortran.kinds = [ - \ 'm:modules', - \ 'p:programs', - \ 'k:components', - \ 't:derived types and structures', - \ 'c:common blocks', - \ 'b:block data', - \ 'e:entry points', - \ 'f:functions', - \ 's:subroutines', - \ 'l:labels', - \ 'n:namelists', - \ 'v:variables' + \ {'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} \ ] let type_fortran.sro = '.' " Not sure, is nesting even possible? let type_fortran.kind2scope = { @@ -352,21 +379,21 @@ function! s:InitTypes() let type_html = {} let type_html.ctagstype = 'html' let type_html.kinds = [ - \ 'f:JavaScript funtions', - \ 'a:named anchors' + \ {'short' : 'f', 'long' : 'JavaScript funtions', 'fold' : 0}, + \ {'short' : 'a', 'long' : 'named anchors', 'fold' : 0} \ ] let s:known_types.html = type_html " Java {{{3 let type_java = {} let type_java.ctagstype = 'java' let type_java.kinds = [ - \ 'p:packages', - \ 'f:fields', - \ 'g:enum types', - \ 'e:enum constants', - \ 'i:interfaces', - \ 'c:classes', - \ 'm:methods' + \ {'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} \ ] let type_java.sro = '.' let type_java.kind2scope = { @@ -384,57 +411,75 @@ function! s:InitTypes() " JavaScript is weird -- it does have scopes, but ctags doesn't seem to " 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.ctagstype = 'javascript' - let type_javascript.kinds = [ - \ 'v:global variables', - \ 'c:classes', - \ 'p:properties', - \ 'm:methods', - \ 'f:functions' - \ ] + if executable('jsctags') + let type_javascript.kinds = [ + \ {'short' : 'v', 'long' : 'variables', 'fold' : 0}, + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} + \ ] + let type_javascript.sro = '.' + let type_javascript.kind2scope = { + \ 'v' : 'namespace', + \ 'f' : 'namespace' + \ } + let type_javascript.scope2kind = { + \ 'namespace' : 'v' + \ } + let type_javascript.ctagsbin = 'jsctags' + 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} + \ ] + endif let s:known_types.javascript = type_javascript " Lisp {{{3 let type_lisp = {} let type_lisp.ctagstype = 'lisp' let type_lisp.kinds = [ - \ 'f:functions' + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} \ ] let s:known_types.lisp = type_lisp " Lua {{{3 let type_lua = {} let type_lua.ctagstype = 'lua' let type_lua.kinds = [ - \ 'f:functions' + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} \ ] let s:known_types.lua = type_lua " Make {{{3 let type_make = {} let type_make.ctagstype = 'make' let type_make.kinds = [ - \ 'm:macros' + \ {'short' : 'm', 'long' : 'macros', 'fold' : 0} \ ] let s:known_types.make = type_make " Matlab {{{3 let type_matlab = {} let type_matlab.ctagstype = 'matlab' let type_matlab.kinds = [ - \ 'f:functions' + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} \ ] let s:known_types.matlab = type_matlab " Ocaml {{{3 let type_ocaml = {} let type_ocaml.ctagstype = 'ocaml' let type_ocaml.kinds = [ - \ 'M:modules or functors', - \ 'v:global variables', - \ 'c:classes', - \ 'C:constructors', - \ 'm:methods', - \ 'e:exceptions', - \ 't:type names', - \ 'f:functions', - \ 'r:structure fields' + \ {'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} \ ] let type_ocaml.sro = '.' " Not sure, is nesting even possible? let type_ocaml.kind2scope = { @@ -452,49 +497,49 @@ function! s:InitTypes() let type_pascal = {} let type_pascal.ctagstype = 'pascal' let type_pascal.kinds = [ - \ 'f:functions', - \ 'p:procedures' + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, + \ {'short' : 'p', 'long' : 'procedures', 'fold' : 0} \ ] let s:known_types.pascal = type_pascal " Perl {{{3 let type_perl = {} let type_perl.ctagstype = 'perl' let type_perl.kinds = [ - \ 'p:packages', - \ 'c:constants', - \ 'f:formats', - \ 'l:labels', - \ 's:subroutines' + \ {'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} \ ] let s:known_types.perl = type_perl " PHP {{{3 let type_php = {} let type_php.ctagstype = 'php' let type_php.kinds = [ - \ 'i:interfaces', - \ 'c:classes', - \ 'd:constant definitions', - \ 'f:functions', - \ 'v:variables', - \ 'j:javascript functions' + \ {'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} \ ] let s:known_types.php = type_php " Python {{{3 let type_python = {} let type_python.ctagstype = 'python' let type_python.kinds = [ - \ 'i:imports', - \ 'c:classes', - \ 'f:functions', - \ 'm:members', - \ 'v:variables' + \ {'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} \ ] + let type_python.sro = '.' let type_python.kind2scope = { \ 'c' : 'class', \ 'f' : 'function', \ 'm' : 'function' \ } - let type_python.sro = '.' let type_python.scope2kind = { \ 'class' : 'c', \ 'function' : 'f' @@ -504,17 +549,17 @@ function! s:InitTypes() let type_rexx = {} let type_rexx.ctagstype = 'rexx' let type_rexx.kinds = [ - \ 's:subroutines' + \ {'short' : 's', 'long' : 'subroutines', 'fold' : 0} \ ] let s:known_types.rexx = type_rexx " Ruby {{{3 let type_ruby = {} let type_ruby.ctagstype = 'ruby' let type_ruby.kinds = [ - \ 'm:modules', - \ 'c:classes', - \ 'f:methods', - \ 'F:singleton methods' + \ {'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} \ ] let type_ruby.sro = '.' let type_ruby.kind2scope = { @@ -529,15 +574,15 @@ function! s:InitTypes() let type_scheme = {} let type_scheme.ctagstype = 'scheme' let type_scheme.kinds = [ - \ 'f:functions', - \ 's:sets' + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0}, + \ {'short' : 's', 'long' : 'sets', 'fold' : 0} \ ] let s:known_types.scheme = type_scheme " Shell script {{{3 let type_sh = {} let type_sh.ctagstype = 'sh' let type_sh.kinds = [ - \ 'f:functions' + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} \ ] let s:known_types.sh = type_sh let s:known_types.csh = type_sh @@ -546,21 +591,21 @@ function! s:InitTypes() let type_slang = {} let type_slang.ctagstype = 'slang' let type_slang.kinds = [ - \ 'n:namespaces', - \ 'f:functions' + \ {'short' : 'n', 'long' : 'namespaces', 'fold' : 0}, + \ {'short' : 'f', 'long' : 'functions', 'fold' : 0} \ ] let s:known_types.slang = type_slang " SML {{{3 let type_sml = {} let type_sml.ctagstype = 'sml' let type_sml.kinds = [ - \ 'e:exception declarations', - \ 'f:function definitions', - \ 'c:functor definitions', - \ 's:signature declarations', - \ 'r:structure declarations', - \ 't:type definitions', - \ 'v:value bindings' + \ {'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} \ ] let s:known_types.sml = type_sml " SQL {{{3 @@ -570,47 +615,47 @@ function! s:InitTypes() let type_sql = {} let type_sql.ctagstype = 'sql' let type_sql.kinds = [ - \ 'c:cursors', - \ 'f:functions', - \ 'F:record fields', - \ 'L:block label', - \ 'P:packages', - \ 'p:procedures', - \ 's:subtypes', - \ 't:tables', - \ 'T:triggers', - \ 'v:variables', - \ 'i:indexes', - \ 'e:events', - \ 'U:publications', - \ 'R:services', - \ 'D:domains', - \ 'V:views', - \ 'n:synonyms', - \ 'x:MobiLink Table Scripts', - \ 'y:MobiLink Conn Scripts' + \ {'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} \ ] let s:known_types.sql = type_sql " Tcl {{{3 let type_tcl = {} let type_tcl.ctagstype = 'tcl' let type_tcl.kinds = [ - \ 'c:classes', - \ 'm:methods', - \ 'p:procedures' + \ {'short' : 'c', 'long' : 'classes', 'fold' : 0}, + \ {'short' : 'm', 'long' : 'methods', 'fold' : 0}, + \ {'short' : 'p', 'long' : 'procedures', 'fold' : 0} \ ] let s:known_types.tcl = type_tcl " LaTeX {{{3 let type_tex = {} let type_tex.ctagstype = 'tex' let type_tex.kinds = [ - \ 'p:parts', - \ 'c:chapters', - \ 's:sections', - \ 'u:subsections', - \ 'b:subsubsections', - \ 'P:paragraphs', - \ 'G:subparagraphs', + \ {'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} \ ] let s:known_types.tex = type_tex " Vera {{{3 @@ -618,16 +663,16 @@ function! s:InitTypes() let type_vera = {} let type_vera.ctagstype = 'vera' let type_vera.kinds = [ - \ 'd:macros', - \ 'g:enums', - \ 'T:typedefs', - \ 'c:classes', - \ 'e:enumerators', - \ 'm:members', - \ 'f:functions', - \ 't:tasks', - \ 'v:variables', - \ 'p:programs' + \ {'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} \ ] let type_vera.sro = '.' " Nesting doesn't seem to be possible let type_vera.kind2scope = { @@ -645,14 +690,14 @@ function! s:InitTypes() let type_verilog = {} let type_verilog.ctagstype = 'verilog' let type_verilog.kinds = [ - \ 'c:constants', - \ 'e:events', - \ 'f:functions', - \ 'm:modules', - \ 'n:net data types', - \ 'p:ports', - \ 'r:register data types', - \ 't:tasks' + \ {'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} \ ] let s:known_types.verilog = type_verilog " VHDL {{{3 @@ -660,32 +705,32 @@ function! s:InitTypes() let type_vhdl = {} let type_vhdl.ctagstype = 'vhdl' let type_vhdl.kinds = [ - \ 'c:constants', - \ 't:types', - \ 'T:subtypes', - \ 'r:records', - \ 'e:entities', - \ 'f:functions', - \ 'p:procedures', - \ 'P:packages' + \ {'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} \ ] let s:known_types.vhdl = type_vhdl " Vim {{{3 let type_vim = {} let type_vim.ctagstype = 'vim' let type_vim.kinds = [ - \ 'v:variables', - \ 'f:functions', - \ 'a:autocommand groups', - \ 'c:commands', - \ 'm:maps' + \ {'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} \ ] let s:known_types.vim = type_vim " YACC {{{3 let type_yacc = {} let type_yacc.ctagstype = 'yacc' let type_yacc.kinds = [ - \ 'l:labels' + \ {'short' : 'l', 'long' : 'labels', 'fold' : 0} \ ] let s:known_types.yacc = type_yacc " }}}3 @@ -706,24 +751,18 @@ function! s:InitTypes() let i = 0 let type.kinddict = {} for kind in type.kinds - let type.kinddict[kind[0]] = i + let type.kinddict[kind.short] = i let i += 1 endfor endfor - let s:access_symbols = { - \ 'public' : '+', - \ 'protected' : '#', - \ 'private' : '-' - \ } - let s:type_init_done = 1 endfunction " s:GetUserTypeDefs() {{{2 function! s:GetUserTypeDefs() redir => defs - silent! execute 'let g:' + silent execute 'let g:' redir END let deflist = split(defs, '\n') @@ -738,7 +777,21 @@ function! s:GetUserTypeDefs() " 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 for def in values(defdict) + let kinds = def.kinds + let def.kinds = [] + for kind in kinds + let kindlist = split(kind, ':') + let kinddict = {'short' : kindlist[0], 'long' : kindlist[1]} + if len(kindlist) == 3 + let kinddict.fold = kindlist[2] + else + let kinddict.fold = 0 + endif + call add(def.kinds, kinddict) + endfor + if has_key(def, 'kind2scope') && !has_key(def, 'scope2kind') let def.scope2kind = {} for [key, value] in items(def.kind2scope) @@ -757,25 +810,39 @@ endfunction " s:MapKeys() {{{2 function! s:MapKeys() - nnoremap