mirror of
https://github.com/gryf/.vim.git
synced 2025-12-17 11:30:29 +01:00
Added calendar plugin, update of tagbar
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
" Author: Jan Larres <jan@majutsushi.net>
|
||||
" Licence: Vim licence
|
||||
" Website: http://majutsushi.github.com/tagbar/
|
||||
" Version: 2.1
|
||||
" Version: 2.2
|
||||
" Note: This plugin was heavily inspired by the 'Taglist' plugin by
|
||||
" Yegappan Lakshmanan and uses a small amount of code from it.
|
||||
"
|
||||
@@ -18,19 +18,12 @@
|
||||
" use of this software.
|
||||
" ============================================================================
|
||||
|
||||
if &cp || exists('g:loaded_tagbar')
|
||||
finish
|
||||
endif
|
||||
scriptencoding utf-8
|
||||
|
||||
" Initialization {{{1
|
||||
|
||||
" Basic init {{{2
|
||||
|
||||
if v:version < 700
|
||||
echomsg 'Tagbar: Vim version is too old, Tagbar requires at least 7.0'
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists('g:tagbar_ctags_bin')
|
||||
if executable('ctags-exuberant')
|
||||
let g:tagbar_ctags_bin = 'ctags-exuberant'
|
||||
@@ -38,6 +31,12 @@ if !exists('g:tagbar_ctags_bin')
|
||||
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')
|
||||
@@ -49,7 +48,14 @@ if !exists('g:tagbar_ctags_bin')
|
||||
finish
|
||||
endif
|
||||
else
|
||||
" reset 'wildignore' temporarily in case *.exe is included in it
|
||||
let wildignore_save = &wildignore
|
||||
set wildignore&
|
||||
|
||||
let g:tagbar_ctags_bin = expand(g:tagbar_ctags_bin)
|
||||
|
||||
let &wildignore = wildignore_save
|
||||
|
||||
if !executable(g:tagbar_ctags_bin)
|
||||
echomsg 'Tagbar: Exuberant ctags not found in specified place,'
|
||||
\ 'skipping plugin'
|
||||
@@ -67,52 +73,6 @@ if s:ftype_out !~# 'detection:ON'
|
||||
endif
|
||||
unlet s:ftype_out
|
||||
|
||||
let g:loaded_tagbar = 1
|
||||
|
||||
if !exists('g:tagbar_left')
|
||||
let g:tagbar_left = 0
|
||||
endif
|
||||
|
||||
if !exists('g:tagbar_width')
|
||||
let g:tagbar_width = 40
|
||||
endif
|
||||
|
||||
if !exists('g:tagbar_autoclose')
|
||||
let g:tagbar_autoclose = 0
|
||||
endif
|
||||
|
||||
if !exists('g:tagbar_autofocus')
|
||||
let g:tagbar_autofocus = 0
|
||||
endif
|
||||
|
||||
if !exists('g:tagbar_sort')
|
||||
let g:tagbar_sort = 1
|
||||
endif
|
||||
|
||||
if !exists('g:tagbar_compact')
|
||||
let g:tagbar_compact = 0
|
||||
endif
|
||||
|
||||
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 !exists('g:tagbar_systemenc')
|
||||
let g:tagbar_systemenc = &encoding
|
||||
endif
|
||||
|
||||
if has('multi_byte') && has('unix') && &encoding == 'utf-8' &&
|
||||
\ (empty(&termencoding) || &termencoding == 'utf-8')
|
||||
let s:icon_closed = '▶'
|
||||
@@ -136,7 +96,9 @@ let s:access_symbols = {
|
||||
\ 'private' : '-'
|
||||
\ }
|
||||
|
||||
autocmd SessionLoadPost * nested call s:RestoreSession()
|
||||
let g:loaded_tagbar = 1
|
||||
|
||||
let s:last_highlight_tline = 0
|
||||
|
||||
" s:InitTypes() {{{2
|
||||
function! s:InitTypes()
|
||||
@@ -861,22 +823,28 @@ function! s:RestoreSession()
|
||||
call s:InitWindow(g:tagbar_autoclose)
|
||||
|
||||
" Leave the Tagbar window and come back so the update event gets triggered
|
||||
execute 'wincmd p'
|
||||
wincmd p
|
||||
execute tagbarwinnr . 'wincmd w'
|
||||
|
||||
if !in_tagbar
|
||||
execute 'wincmd p'
|
||||
wincmd p
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" s:MapKeys() {{{2
|
||||
function! s:MapKeys()
|
||||
nnoremap <script> <silent> <buffer> <CR> :call <SID>JumpToTag(0)<CR>
|
||||
nnoremap <script> <silent> <buffer> <2-LeftMouse>
|
||||
\ :call <SID>JumpToTag(0)<CR>
|
||||
nnoremap <script> <silent> <buffer> p :call <SID>JumpToTag(1)<CR>
|
||||
nnoremap <script> <silent> <buffer> <LeftRelease>
|
||||
\ <LeftRelease>:call <SID>CheckMouseClick()<CR>
|
||||
|
||||
inoremap <script> <silent> <buffer> <2-LeftMouse>
|
||||
\ <C-o>:call <SID>JumpToTag(0)<CR>
|
||||
inoremap <script> <silent> <buffer> <LeftRelease>
|
||||
\ <LeftRelease><C-o>:call <SID>CheckMouseClick()<CR>
|
||||
|
||||
nnoremap <script> <silent> <buffer> <CR> :call <SID>JumpToTag(0)<CR>
|
||||
nnoremap <script> <silent> <buffer> p :call <SID>JumpToTag(1)<CR>
|
||||
nnoremap <script> <silent> <buffer> <Space> :call <SID>ShowPrototype()<CR>
|
||||
|
||||
nnoremap <script> <silent> <buffer> + :call <SID>OpenFold()<CR>
|
||||
@@ -914,7 +882,11 @@ function! s:CreateAutocommands()
|
||||
autocmd BufUnload __Tagbar__ call s:CleanUp()
|
||||
autocmd CursorHold __Tagbar__ call s:ShowPrototype()
|
||||
|
||||
autocmd BufEnter,CursorHold * call
|
||||
autocmd BufWritePost *
|
||||
\ if line('$') < g:tagbar_updateonsave_maxlines |
|
||||
\ call s:AutoUpdate(fnamemodify(expand('<afile>'), ':p')) |
|
||||
\ endif
|
||||
autocmd BufEnter,CursorHold,FileType * call
|
||||
\ s:AutoUpdate(fnamemodify(expand('<afile>'), ':p'))
|
||||
autocmd BufDelete * call
|
||||
\ s:CleanupFileinfo(fnamemodify(expand('<afile>'), ':p'))
|
||||
@@ -968,6 +940,10 @@ endfunction
|
||||
|
||||
" s:CheckExCtagsVersion() {{{2
|
||||
function! s:CheckExCtagsVersion(output)
|
||||
if a:output =~ 'Exuberant Ctags Development'
|
||||
return 1
|
||||
endif
|
||||
|
||||
let matchlist = matchlist(a:output, '\vExuberant Ctags (\d+)\.(\d+)')
|
||||
let major = matchlist[1]
|
||||
let minor = matchlist[2]
|
||||
@@ -1097,6 +1073,7 @@ function! s:BaseTag.closeFold() dict
|
||||
elseif self.isFoldable() && !self.isFolded()
|
||||
" Tag is parent of a scope and is not folded
|
||||
let self.fileinfo.tagfolds[self.fields.kind][self.fullpath] = 1
|
||||
let newline = self.tline
|
||||
elseif !empty(self.parent)
|
||||
" Tag is normal child, so close parent
|
||||
let parent = self.parent
|
||||
@@ -1396,12 +1373,20 @@ function! s:ToggleWindow()
|
||||
endfunction
|
||||
|
||||
" s:OpenWindow() {{{2
|
||||
function! s:OpenWindow(autoclose)
|
||||
" If the tagbar window is already open jump to it
|
||||
function! s:OpenWindow(flags)
|
||||
let autofocus = a:flags =~# 'f'
|
||||
let jump = a:flags =~# 'j'
|
||||
let autoclose = a:flags =~# 'c'
|
||||
|
||||
" If the tagbar window is already open check jump flag
|
||||
" Also set the autoclose flag if requested
|
||||
let tagbarwinnr = bufwinnr('__Tagbar__')
|
||||
if tagbarwinnr != -1
|
||||
if winnr() != tagbarwinnr
|
||||
if winnr() != tagbarwinnr && jump
|
||||
execute tagbarwinnr . 'wincmd w'
|
||||
if autoclose
|
||||
let w:autoclose = autoclose
|
||||
endif
|
||||
endif
|
||||
return
|
||||
endif
|
||||
@@ -1422,16 +1407,21 @@ function! s:OpenWindow(autoclose)
|
||||
let s:window_expanded = 1
|
||||
endif
|
||||
|
||||
let eventignore_save = &eventignore
|
||||
set eventignore=all
|
||||
|
||||
let openpos = g:tagbar_left ? 'topleft vertical ' : 'botright vertical '
|
||||
exe 'silent keepalt ' . openpos . g:tagbar_width . 'split ' . '__Tagbar__'
|
||||
|
||||
call s:InitWindow(a:autoclose)
|
||||
let &eventignore = eventignore_save
|
||||
|
||||
execute 'wincmd p'
|
||||
call s:InitWindow(autoclose)
|
||||
|
||||
wincmd p
|
||||
|
||||
" Jump back to the tagbar window if autoclose or autofocus is set. Can't
|
||||
" just stay in it since it wouldn't trigger the update event
|
||||
if g:tagbar_autoclose || a:autoclose || g:tagbar_autofocus
|
||||
if g:tagbar_autoclose || autofocus || g:tagbar_autofocus
|
||||
let tagbarwinnr = bufwinnr('__Tagbar__')
|
||||
execute tagbarwinnr . 'wincmd w'
|
||||
endif
|
||||
@@ -1451,19 +1441,27 @@ function! s:InitWindow(autoclose)
|
||||
setlocal nowrap
|
||||
setlocal winfixwidth
|
||||
setlocal textwidth=0
|
||||
setlocal nocursorline
|
||||
setlocal nocursorcolumn
|
||||
|
||||
if exists('+relativenumber')
|
||||
setlocal norelativenumber
|
||||
endif
|
||||
|
||||
setlocal nofoldenable
|
||||
setlocal foldcolumn=0
|
||||
" Reset fold settings in case a plugin set them globally to something
|
||||
" expensive. Apparently 'foldexpr' gets executed even if 'foldenable' is
|
||||
" off, and then for every appended line (like with :put).
|
||||
setlocal foldmethod&
|
||||
setlocal foldexpr&
|
||||
|
||||
" Earlier versions have a bug in local, evaluated statuslines
|
||||
if v:version > 701 || (v:version == 701 && has('patch097'))
|
||||
setlocal statusline=%!TagbarGenerateStatusline()
|
||||
else
|
||||
setlocal statusline=Tagbar
|
||||
endif
|
||||
|
||||
" Script-local variable needed since compare functions can't
|
||||
" take extra arguments
|
||||
@@ -1506,6 +1504,7 @@ function! s:CloseWindow()
|
||||
if winbufnr(2) != -1
|
||||
" Other windows are open, only close the tagbar one
|
||||
close
|
||||
wincmd p
|
||||
endif
|
||||
else
|
||||
" Go to the tagbar window, close it and then come back to the
|
||||
@@ -1671,7 +1670,11 @@ function! s:ExecuteCtagsOnFile(fname, ftype)
|
||||
endif
|
||||
|
||||
if has_key(typeinfo, 'ctagsbin')
|
||||
" reset 'wildignore' temporarily in case *.exe is included in it
|
||||
let wildignore_save = &wildignore
|
||||
set wildignore&
|
||||
let ctags_bin = expand(typeinfo.ctagsbin)
|
||||
let &wildignore = wildignore_save
|
||||
else
|
||||
let ctags_bin = g:tagbar_ctags_bin
|
||||
endif
|
||||
@@ -1721,7 +1724,7 @@ function! s:ParseTagline(part1, part2, typeinfo, fileinfo)
|
||||
let dollar = ''
|
||||
endif
|
||||
let pattern = strpart(pattern, start, end - start)
|
||||
let taginfo.pattern = '\V\^' . pattern . dollar
|
||||
let taginfo.pattern = '\V\^\C' . pattern . dollar
|
||||
let prototype = substitute(pattern, '^[[:space:]]\+', '', '')
|
||||
let prototype = substitute(prototype, '[[:space:]]\+$', '', '')
|
||||
let taginfo.prototype = prototype
|
||||
@@ -1758,7 +1761,13 @@ function! s:ParseTagline(part1, part2, typeinfo, fileinfo)
|
||||
let taginfo.fileinfo = a:fileinfo
|
||||
|
||||
" Needed for folding
|
||||
try
|
||||
call taginfo.initFoldState()
|
||||
catch /^Vim(\a\+):E716:/ " 'Key not present in Dictionary'
|
||||
" The tag has a 'kind' that doesn't exist in the type definition
|
||||
echoerr 'Your ctags and Tagbar configurations are out of sync!'
|
||||
\ 'Please read '':help tagbar-extend''.'
|
||||
endtry
|
||||
|
||||
return taginfo
|
||||
endfunction
|
||||
@@ -2067,7 +2076,7 @@ function! s:RenderContent(...)
|
||||
" Delete empty lines at the end of the buffer
|
||||
for linenr in range(line('$'), 1, -1)
|
||||
if getline(linenr) =~ '^$'
|
||||
execute linenr . 'delete _'
|
||||
execute 'silent ' . linenr . 'delete _'
|
||||
else
|
||||
break
|
||||
endif
|
||||
@@ -2090,6 +2099,9 @@ function! s:RenderContent(...)
|
||||
" window by jumping to the top after drawing
|
||||
execute 1
|
||||
call winline()
|
||||
|
||||
" Invalidate highlight cache from old file
|
||||
let s:last_highlight_tline = 0
|
||||
endif
|
||||
|
||||
let &lazyredraw = lazyredraw_save
|
||||
@@ -2128,9 +2140,22 @@ function! s:PrintKinds(typeinfo, fileinfo)
|
||||
let tag.tline = curline
|
||||
let a:fileinfo.tline[curline] = tag
|
||||
|
||||
" Print children
|
||||
if tag.isFoldable() && !tag.isFolded()
|
||||
for childtag in tag.children
|
||||
call s:PrintTag(childtag, 1, a:fileinfo, a:typeinfo)
|
||||
for ckind in a:typeinfo.kinds
|
||||
let childtags = filter(copy(tag.children),
|
||||
\ 'v:val.fields.kind ==# ckind.short')
|
||||
if len(childtags) > 0
|
||||
" Print 'kind' header of following children
|
||||
if !has_key(a:typeinfo.kind2scope, ckind.short)
|
||||
silent put =' [' . ckind.long . ']'
|
||||
let a:fileinfo.tline[line('.')] = tag
|
||||
endif
|
||||
for childtag in childtags
|
||||
call s:PrintTag(childtag, 1,
|
||||
\ a:fileinfo, a:typeinfo)
|
||||
endfor
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
@@ -2196,8 +2221,21 @@ function! s:PrintTag(tag, depth, fileinfo, typeinfo)
|
||||
|
||||
" Recursively print children
|
||||
if a:tag.isFoldable() && !a:tag.isFolded()
|
||||
for childtag in a:tag.children
|
||||
call s:PrintTag(childtag, a:depth + 1, a:fileinfo, a:typeinfo)
|
||||
for ckind in a:typeinfo.kinds
|
||||
let childtags = filter(copy(a:tag.children),
|
||||
\ 'v:val.fields.kind ==# ckind.short')
|
||||
if len(childtags) > 0
|
||||
" Print 'kind' header of following children
|
||||
if !has_key(a:typeinfo.kind2scope, ckind.short)
|
||||
silent put =' ' . repeat(' ', a:depth * 2) .
|
||||
\ '[' . ckind.long . ']'
|
||||
let a:fileinfo.tline[line('.')] = a:tag
|
||||
endif
|
||||
for childtag in childtags
|
||||
call s:PrintTag(childtag, a:depth + 1,
|
||||
\ a:fileinfo, a:typeinfo)
|
||||
endfor
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
endfunction
|
||||
@@ -2266,6 +2304,15 @@ function! s:HighlightTag()
|
||||
let tagline = tag.tline
|
||||
endif
|
||||
|
||||
" Don't highlight the tag again if it's the same one as last time.
|
||||
" This prevents the Tagbar window from jumping back after scrolling with
|
||||
" the mouse.
|
||||
if tagline == s:last_highlight_tline
|
||||
return
|
||||
else
|
||||
let s:last_highlight_tline = tagline
|
||||
endif
|
||||
|
||||
let eventignore_save = &eventignore
|
||||
set eventignore=all
|
||||
|
||||
@@ -2320,10 +2367,13 @@ function! s:JumpToTag(stay_in_tagbar)
|
||||
|
||||
let tagbarwinnr = winnr()
|
||||
|
||||
let eventignore_save = &eventignore
|
||||
set eventignore=all
|
||||
|
||||
" This elaborate construct will try to switch to the correct
|
||||
" buffer/window; if the buffer isn't currently shown in a window it will
|
||||
" open it in the first window with a non-special buffer in it
|
||||
execute 'wincmd p'
|
||||
wincmd p
|
||||
let filebufnr = bufnr(taginfo.fileinfo.fpath)
|
||||
if bufnr('%') != filebufnr
|
||||
let filewinnr = bufwinnr(filebufnr)
|
||||
@@ -2341,7 +2391,7 @@ function! s:JumpToTag(stay_in_tagbar)
|
||||
" To make ctrl-w_p work we switch between the Tagbar window and the
|
||||
" correct window once
|
||||
execute tagbarwinnr . 'wincmd w'
|
||||
execute 'wincmd p'
|
||||
wincmd p
|
||||
endif
|
||||
|
||||
" Mark current position so it can be jumped back to
|
||||
@@ -2352,6 +2402,31 @@ function! s:JumpToTag(stay_in_tagbar)
|
||||
" with the same name are defined in different scopes (e.g. classes)
|
||||
execute taginfo.fields.line
|
||||
|
||||
" If the file has been changed but not saved, the tag may not be on the
|
||||
" saved line anymore, so search for it in the vicinity of the saved line
|
||||
if match(getline('.'), taginfo.pattern) == -1
|
||||
let interval = 1
|
||||
let forward = 1
|
||||
while search(taginfo.pattern, 'W' . forward ? '' : 'b') == 0
|
||||
if !forward
|
||||
if interval > line('$')
|
||||
break
|
||||
else
|
||||
let interval = interval * 2
|
||||
endif
|
||||
endif
|
||||
let forward = !forward
|
||||
endwhile
|
||||
endif
|
||||
|
||||
" If the tag is on a different line after unsaved changes update the tag
|
||||
" and file infos/objects
|
||||
let curline = line('.')
|
||||
if taginfo.fields.line != curline
|
||||
let taginfo.fields.line = curline
|
||||
let taginfo.fileinfo.fline[curline] = taginfo
|
||||
endif
|
||||
|
||||
" Center the tag in the window
|
||||
normal! z.
|
||||
|
||||
@@ -2361,6 +2436,8 @@ function! s:JumpToTag(stay_in_tagbar)
|
||||
|
||||
redraw
|
||||
|
||||
let &eventignore = eventignore_save
|
||||
|
||||
if a:stay_in_tagbar
|
||||
call s:HighlightTag()
|
||||
execute tagbarwinnr . 'wincmd w'
|
||||
@@ -2788,6 +2865,8 @@ function! s:CheckMouseClick()
|
||||
call s:CloseFold()
|
||||
elseif (match(line, s:icon_closed . '[-+ ]') + 1) == curcol
|
||||
call s:OpenFold()
|
||||
elseif g:tagbar_singleclick
|
||||
call s:JumpToTag(0)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -2818,13 +2897,31 @@ function! TagbarGenerateStatusline()
|
||||
return text
|
||||
endfunction
|
||||
|
||||
" Commands {{{1
|
||||
command! -nargs=0 TagbarToggle call s:ToggleWindow()
|
||||
command! -nargs=0 TagbarOpen call s:OpenWindow(0)
|
||||
command! -nargs=0 TagbarOpenAutoClose call s:OpenWindow(1)
|
||||
command! -nargs=0 TagbarClose call s:CloseWindow()
|
||||
command! -nargs=1 TagbarSetFoldlevel call s:SetFoldLevel(<args>)
|
||||
command! -nargs=0 TagbarShowTag call s:OpenParents()
|
||||
" Autoload functions {{{1
|
||||
function! tagbar#ToggleWindow()
|
||||
call s:ToggleWindow()
|
||||
endfunction
|
||||
|
||||
function! tagbar#OpenWindow(...)
|
||||
let flags = a:0 > 0 ? a:1 : ''
|
||||
call s:OpenWindow(flags)
|
||||
endfunction
|
||||
|
||||
function! tagbar#CloseWindow()
|
||||
call s:CloseWindow()
|
||||
endfunction
|
||||
|
||||
function! tagbar#SetFoldLevel(...)
|
||||
call s:SetFoldLevel(a:1)
|
||||
endfunction
|
||||
|
||||
function! tagbar#OpenParents()
|
||||
call s:OpenParents()
|
||||
endfunction
|
||||
|
||||
function! tagbar#RestoreSession()
|
||||
call s:RestoreSession()
|
||||
endfunction
|
||||
|
||||
" Modeline {{{1
|
||||
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1
|
||||
147
doc/tagbar.txt
147
doc/tagbar.txt
@@ -3,7 +3,7 @@
|
||||
Author: Jan Larres <jan@majutsushi.net>
|
||||
Licence: Vim licence, see |license|
|
||||
Homepage: http://majutsushi.github.com/tagbar/
|
||||
Version: 2.1
|
||||
Version: 2.2
|
||||
|
||||
==============================================================================
|
||||
Contents *tagbar* *tagbar-contents*
|
||||
@@ -21,7 +21,7 @@ Contents *tagbar* *tagbar-contents*
|
||||
Highlight colours ............. |tagbar-highlight|
|
||||
Automatically opening Tagbar .. |tagbar-autoopen|
|
||||
6. Extending Tagbar ................ |tagbar-extend|
|
||||
7. Bugs and limitations ............ |tagbar-bugs|
|
||||
7. Troubleshooting & Known issues .. |tagbar-issues|
|
||||
8. History ......................... |tagbar-history|
|
||||
9. Todo ............................ |tagbar-todo|
|
||||
10. Credits ......................... |tagbar-credits|
|
||||
@@ -113,11 +113,7 @@ 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.
|
||||
|
||||
Note: jsctags has to be newer than 2011-01-06 since it needs the "-f" option
|
||||
to work. Also, the output of jsctags seems to be a bit unreliable at the
|
||||
moment (especially regarding line numbers), so if you notice some strange
|
||||
behaviour with it please run it manually in a terminal to check whether the
|
||||
bug is in jsctags or Tagbar.
|
||||
Note: Please check |tagbar-issues| for some possible issues with jsctags.
|
||||
|
||||
==============================================================================
|
||||
2. Requirements *tagbar-requirements*
|
||||
@@ -229,9 +225,22 @@ displayed when the cursor stays on a tag for 'updatetime' milliseconds.
|
||||
------------------------------------------------------------------------------
|
||||
COMMANDS *tagbar-commands*
|
||||
|
||||
:TagbarOpen
|
||||
Open the Tagbar if it is closed. In case it is already open jump to it.
|
||||
:TagbarOpen [{flags}]
|
||||
Open the Tagbar window if it is closed.
|
||||
|
||||
Additional behaviour can be specified with the optional {flags} argument.
|
||||
It is a string which can contain these character flags:
|
||||
'f' Jump to Tagbar window when opening (just as if |g:tagbar_autofocus|
|
||||
were set to 1)
|
||||
'j' Jump to Tagbar window if already open
|
||||
'c' Close Tagbar on tag selection (just as if |g:tagbar_autoclose| were
|
||||
set to 1, but doesn't imply 'f')
|
||||
|
||||
For example, the following command would always jump to the Tagbar window,
|
||||
opening it first if necessary, but keep it open after selecting a tag
|
||||
(unless |g:tagbar_autoclose| is set): >
|
||||
:TagbarOpen fj
|
||||
<
|
||||
:TagbarClose
|
||||
Close the Tagbar window if it is open.
|
||||
|
||||
@@ -239,11 +248,11 @@ COMMANDS *tagbar-commands*
|
||||
Open the Tagbar window if it is closed or close it if it is open.
|
||||
|
||||
:TagbarOpenAutoClose
|
||||
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.
|
||||
Open the Tagbar window, jump to it and close it on tag selection. This is
|
||||
an alias for ":TagbarOpen fc".
|
||||
|
||||
:TagbarSetFoldlevel [number]
|
||||
Set the foldlevel of the tags of the current file to [number]. The
|
||||
: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'.
|
||||
|
||||
@@ -254,7 +263,7 @@ COMMANDS *tagbar-commands*
|
||||
------------------------------------------------------------------------------
|
||||
KEY MAPPINGS *tagbar-keys*
|
||||
|
||||
These mappings are valid in the Tagbar window:
|
||||
The following mappings are valid in the Tagbar window:
|
||||
|
||||
<F1> Display key mapping help.
|
||||
<CR>/<Enter> Jump to the tag under the cursor. Doesn't work for pseudo-tags
|
||||
@@ -262,7 +271,8 @@ These mappings are valid in the Tagbar window:
|
||||
p Jump to the tag under the cursor, but stay in the Tagbar window.
|
||||
<LeftMouse> When on a fold icon, open or close the fold depending on the
|
||||
current state.
|
||||
<2-LeftMouse> Same as <CR>.
|
||||
<2-LeftMouse> Same as <CR>. See |g:tagbar_singleclick| if you want to use a
|
||||
single- instead of a double-click.
|
||||
<Space> Display the prototype of the current tag (i.e. the line defining
|
||||
it) in the command line.
|
||||
+/zo Open the fold under the cursor.
|
||||
@@ -321,7 +331,7 @@ g:tagbar_autoclose~
|
||||
Default: 0
|
||||
|
||||
If you set this option the Tagbar window will automatically close when you
|
||||
jump to a tag.
|
||||
jump to a tag. This implies |g:tagbar_autofocus|.
|
||||
|
||||
Example:
|
||||
>
|
||||
@@ -379,6 +389,18 @@ Example:
|
||||
let g:tagbar_expand = 1
|
||||
<
|
||||
|
||||
*g:tagbar_singleclick*
|
||||
g:tagbar_singleclick~
|
||||
Default: 0
|
||||
|
||||
If this option is set then a single- instead of a double-click is used to jump
|
||||
to the tag definition.
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:tagbar_singleclick = 1
|
||||
<
|
||||
|
||||
*g:tagbar_foldlevel*
|
||||
g:tagbar_foldlevel~
|
||||
Default: 99
|
||||
@@ -423,6 +445,22 @@ Example:
|
||||
let g:tagbar_autoshowtag = 1
|
||||
<
|
||||
|
||||
*g:tagbar_updateonsave_maxlines*
|
||||
g:tagbar_updateonsave_maxlines~
|
||||
Default: 5000
|
||||
|
||||
If the current file has fewer lines than the value of this variable, Tagbar
|
||||
will update immediately after saving the file. If it is longer then the update
|
||||
will only happen on the |CursorHold| event and when switching buffers (or
|
||||
windows). This is to prevent the time it takes to save a large file from
|
||||
becoming annoying in case you have a slow computer. If you have a fast
|
||||
computer you can set it to a higher value.
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:tagbar_updateonsave_maxlines = 10000
|
||||
<
|
||||
|
||||
*g:tagbar_systemenc*
|
||||
g:tagbar_systemenc~
|
||||
Default: value of 'encoding'
|
||||
@@ -450,6 +488,9 @@ TagbarComment
|
||||
TagbarKind
|
||||
The header of generic "kinds" like "functions" and "variables".
|
||||
|
||||
TagbarNestedKind
|
||||
The "kind" headers in square brackets inside of scopes.
|
||||
|
||||
TagbarScope
|
||||
Tags that define a scope like classes, structs etc.
|
||||
|
||||
@@ -511,6 +552,16 @@ existing types and to add completely new types. A complete configuration
|
||||
consists of a type definition for Tagbar in your |vimrc| and optionally a
|
||||
language definition for ctags in case you want to add a new language.
|
||||
|
||||
Before writing your own extension try googling for already existing ones. For
|
||||
example, here is one for Scala:
|
||||
http://latestbuild.net/scala-ctags-and-vim-tagbar
|
||||
Since those aren't "canonical" configurations and are somewhat subjective they
|
||||
probably won't be included in Tagbar, but it is easy enough to just copy&paste
|
||||
them into your own setup. Note that you don't have to modify Tagbar directly
|
||||
like the article suggests, you can just put the configuration into your
|
||||
|vimrc| (see below for more details).
|
||||
|
||||
|
||||
Every type definition in Tagbar is a dictionary with the following keys:
|
||||
|
||||
ctagstype: The name of the language as recognized by ctags. Use the command >
|
||||
@@ -535,7 +586,7 @@ kinds: A list of the "language kinds" that should be listed in Tagbar,
|
||||
< would list all the function definitions in a file under the header
|
||||
"functions" and fold them.
|
||||
sro: The scope resolution operator. For example, in C++ it is "::" and
|
||||
in Java it is ".". If in doubt run ctags as shown above and check
|
||||
in Java it is ".". If in doubt run ctags as shown below and check
|
||||
the output.
|
||||
kind2scope: A dictionary describing the mapping of tag kinds (in their
|
||||
one-character representation) to the scopes their children will
|
||||
@@ -552,8 +603,8 @@ kind2scope: A dictionary describing the mapping of tag kinds (in their
|
||||
private:
|
||||
int var;
|
||||
};
|
||||
< We then run ctags in the followin way: >
|
||||
ctags -f - --format=2 --excmd=pattern --fields=nksazSmt --extra= test.cpp
|
||||
< We then run ctags in the following way: >
|
||||
ctags -f - --format=2 --excmd=pattern --extra= --fields=nksaSmt test.cpp
|
||||
< Then the output for the variable "var" would look like this: >
|
||||
var tmp.cpp /^ int var;$/;" kind:m line:11 class:Foo access:private
|
||||
< This shows that the scope name for an entry in a C++ class is
|
||||
@@ -614,7 +665,8 @@ and vim will display the file type of the current buffer.
|
||||
|
||||
Example: C++~
|
||||
Here is a complete example that shows the default configuration for C++ as
|
||||
used in Tagbar.
|
||||
used in Tagbar. This is just for illustration purposes since user
|
||||
configurations will usually be less complicated.
|
||||
>
|
||||
let g:tagbar_type_cpp = {
|
||||
\ 'ctagstype' : 'c++',
|
||||
@@ -676,7 +728,7 @@ the order of enums and typedefs, you would do it like this:
|
||||
\ ]
|
||||
\ }
|
||||
<
|
||||
Compare with the complete example above to see the exact change.
|
||||
Compare with the complete example above to see the difference.
|
||||
|
||||
Adding a definition for a new language/file type~
|
||||
In order to be able to add a new language to Tagbar you first have to create a
|
||||
@@ -756,14 +808,32 @@ Tagbar should now be able to show the sections and other tags from LaTeX
|
||||
files.
|
||||
|
||||
==============================================================================
|
||||
7. Bugs and limitations *tagbar-bugs*
|
||||
7. Troubleshooting & Known issues *tagbar-issues*
|
||||
|
||||
As a general rule, if the tag information displayed by Tagbar is wrong (for
|
||||
example, a method doesn't show up or is in the wrong place) you should first
|
||||
try running ctags manually to see whether ctags reports the wrong information
|
||||
or whether that information is correct and Tagbar does something wrong. To run
|
||||
ctags manually execute the following command in a terminal:
|
||||
>
|
||||
ctags -f - --format=2 --excmd=pattern --extra= --fields=nksaSmt myfile
|
||||
<
|
||||
If you set the |g:tagbar_ctags_bin| variable you probably have to use the same
|
||||
value here instead of simply "ctags".
|
||||
|
||||
|
||||
- jsctags has to be newer than 2011-01-06 since it needs the "-f" option to
|
||||
work. Also, the output of jsctags seems to be a bit unreliable at the
|
||||
moment (especially regarding line numbers), so if you notice some strange
|
||||
behaviour with it please run it manually in a terminal to check whether
|
||||
the bug is in jsctags or Tagbar.
|
||||
|
||||
- Nested pseudo-tags cannot be properly parsed since only the direct parent
|
||||
scope of a tag gets assigned a type, the type of the grandparents is not
|
||||
reported by ctags (assuming the grandparents don't have direct, real
|
||||
children).
|
||||
|
||||
For example, if we have a C++ with the following content:
|
||||
For example, if we have a C++ file with the following content:
|
||||
>
|
||||
foo::Bar::init()
|
||||
{
|
||||
@@ -804,6 +874,23 @@ files.
|
||||
==============================================================================
|
||||
8. History *tagbar-history*
|
||||
|
||||
2.2 (2011-11-26)
|
||||
- Small incompatible change: TagbarOpen now doesn't jump to the Tagbar
|
||||
window anymore if it is already open. Use "TagbarOpen j" instead or see
|
||||
its documentation for more options.
|
||||
- Tags inside of scopes now have a header displaying their "kind".
|
||||
- The Tagbar contents are now immediately updated on save for files
|
||||
smaller than a configurable size.
|
||||
- Tagbar can now be configured to jump to a tag with only a single-click
|
||||
instead of a double-click.
|
||||
- Most of the script has been moved to the |autoload| directory, so Vim
|
||||
startup should be faster (thanks to Kien N).
|
||||
- Jumping to tags should work most of the time even if the file has been
|
||||
modified and not saved.
|
||||
- If Ctags has been installed into the default location using Homebrew or
|
||||
MacPorts it should now be found automatically.
|
||||
- Several bugfixes.
|
||||
|
||||
2.1 (2011-05-29)
|
||||
- Make Tagbar work in (hopefully) all cases under Windows
|
||||
- Handle cases where 'encoding' is different from system encoding, for
|
||||
@@ -883,13 +970,13 @@ 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
|
||||
Thanks to the following people for code contributions, feature suggestions etc:
|
||||
Jan Christoph Ebersbach
|
||||
Leandro Freitas
|
||||
Seth Milliken
|
||||
Kien N
|
||||
pielgrzym
|
||||
Taybin Rutkin
|
||||
|
||||
==============================================================================
|
||||
vim: tw=78 ts=8 sw=8 sts=8 noet ft=help
|
||||
|
||||
4
doc/tags
4
doc/tags
@@ -413,8 +413,10 @@ 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_singleclick tagbar.txt /*g:tagbar_singleclick*
|
||||
g:tagbar_sort tagbar.txt /*g:tagbar_sort*
|
||||
g:tagbar_systemenc tagbar.txt /*g:tagbar_systemenc*
|
||||
g:tagbar_updateonsave_maxlines tagbar.txt /*g:tagbar_updateonsave_maxlines*
|
||||
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*
|
||||
@@ -921,7 +923,6 @@ 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*
|
||||
tagbar-contents tagbar.txt /*tagbar-contents*
|
||||
@@ -932,6 +933,7 @@ 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-issues tagbar.txt /*tagbar-issues*
|
||||
tagbar-keys tagbar.txt /*tagbar-keys*
|
||||
tagbar-other tagbar.txt /*tagbar-other*
|
||||
tagbar-pseudotags tagbar.txt /*tagbar-pseudotags*
|
||||
|
||||
1328
plugin/calendar.vim
Normal file
1328
plugin/calendar.vim
Normal file
File diff suppressed because it is too large
Load Diff
111
plugin/tagbar.vim
Normal file
111
plugin/tagbar.vim
Normal file
@@ -0,0 +1,111 @@
|
||||
" ============================================================================
|
||||
" File: tagbar.vim
|
||||
" Description: List the current file's tags in a sidebar, ordered by class etc
|
||||
" Author: Jan Larres <jan@majutsushi.net>
|
||||
" Licence: Vim licence
|
||||
" Website: http://majutsushi.github.com/tagbar/
|
||||
" Version: 2.2
|
||||
" Note: This plugin was heavily inspired by the 'Taglist' plugin by
|
||||
" Yegappan Lakshmanan and uses a small amount of code from it.
|
||||
"
|
||||
" Original taglist copyright notice:
|
||||
" Permission is hereby granted to use and distribute this code,
|
||||
" with or without modifications, provided that this copyright
|
||||
" notice is copied with it. Like anything else that's free,
|
||||
" taglist.vim is provided *as is* and comes with no warranty of
|
||||
" any kind, either expressed or implied. In no event will the
|
||||
" copyright holder be liable for any damamges resulting from the
|
||||
" use of this software.
|
||||
" ============================================================================
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if &cp || exists('g:loaded_tagbar')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Basic init {{{1
|
||||
|
||||
if v:version < 700
|
||||
echohl WarningMsg
|
||||
echomsg 'Tagbar: Vim version is too old, Tagbar requires at least 7.0'
|
||||
echohl None
|
||||
finish
|
||||
endif
|
||||
|
||||
if v:version == 700 && !has('patch167')
|
||||
echohl WarningMsg
|
||||
echomsg 'Tagbar: Vim versions lower than 7.0.167 have a bug'
|
||||
\ 'that prevents this version of Tagbar from working.'
|
||||
\ 'Please use the alternate version posted on the website.'
|
||||
echohl None
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists('g:tagbar_left')
|
||||
let g:tagbar_left = 0
|
||||
endif
|
||||
|
||||
if !exists('g:tagbar_width')
|
||||
let g:tagbar_width = 40
|
||||
endif
|
||||
|
||||
if !exists('g:tagbar_autoclose')
|
||||
let g:tagbar_autoclose = 0
|
||||
endif
|
||||
|
||||
if !exists('g:tagbar_autofocus')
|
||||
let g:tagbar_autofocus = 0
|
||||
endif
|
||||
|
||||
if !exists('g:tagbar_sort')
|
||||
let g:tagbar_sort = 1
|
||||
endif
|
||||
|
||||
if !exists('g:tagbar_compact')
|
||||
let g:tagbar_compact = 0
|
||||
endif
|
||||
|
||||
if !exists('g:tagbar_expand')
|
||||
let g:tagbar_expand = 0
|
||||
endif
|
||||
|
||||
if !exists('g:tagbar_singleclick')
|
||||
let g:tagbar_singleclick = 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 !exists('g:tagbar_updateonsave_maxlines')
|
||||
let g:tagbar_updateonsave_maxlines = 5000
|
||||
endif
|
||||
|
||||
if !exists('g:tagbar_systemenc')
|
||||
let g:tagbar_systemenc = &encoding
|
||||
endif
|
||||
|
||||
augroup TagbarSession
|
||||
autocmd!
|
||||
autocmd SessionLoadPost * nested call tagbar#RestoreSession()
|
||||
augroup END
|
||||
|
||||
" Commands {{{1
|
||||
command! -nargs=0 TagbarToggle call tagbar#ToggleWindow()
|
||||
command! -nargs=? TagbarOpen call tagbar#OpenWindow(<f-args>)
|
||||
command! -nargs=0 TagbarOpenAutoClose call tagbar#OpenWindow('fc')
|
||||
command! -nargs=0 TagbarClose call tagbar#CloseWindow()
|
||||
command! -nargs=1 TagbarSetFoldlevel call tagbar#SetFoldLevel(<args>)
|
||||
command! -nargs=0 TagbarShowTag call tagbar#OpenParents()
|
||||
|
||||
" Modeline {{{1
|
||||
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1
|
||||
@@ -3,7 +3,9 @@
|
||||
" Author: Jan Larres <jan@majutsushi.net>
|
||||
" Licence: Vim licence
|
||||
" Website: http://majutsushi.github.com/tagbar/
|
||||
" Version: 2.1
|
||||
" Version: 2.2
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
@@ -39,6 +41,7 @@ else
|
||||
syntax match TagbarAccessPrivate '\([-+ ]\)\@<=-\([^-+# ]\)\@='
|
||||
endif
|
||||
|
||||
syntax match TagbarNestedKind '^\s\+\[[^]]\+\]$'
|
||||
syntax match TagbarComment '^".*'
|
||||
syntax match TagbarType ' : \zs.*'
|
||||
syntax match TagbarSignature '(.*)'
|
||||
@@ -46,6 +49,7 @@ syntax match TagbarPseudoID '\*\ze :'
|
||||
|
||||
highlight default link TagbarComment Comment
|
||||
highlight default link TagbarKind Identifier
|
||||
highlight default link TagbarNestedKind TagbarKind
|
||||
highlight default link TagbarScope Title
|
||||
highlight default link TagbarType Type
|
||||
highlight default link TagbarSignature SpecialKey
|
||||
@@ -58,3 +62,5 @@ highlight default TagbarAccessProtected guifg=Blue ctermfg=Blue
|
||||
highlight default TagbarAccessPrivate guifg=Red ctermfg=Red
|
||||
|
||||
let b:current_syntax = "tagbar"
|
||||
|
||||
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1
|
||||
|
||||
Reference in New Issue
Block a user