1
0
mirror of https://github.com/gryf/.vim.git synced 2025-12-17 19:40:29 +01:00

Tagbar update, removed tab config from common in python ft

This commit is contained in:
2011-12-28 21:58:53 +01:00
parent 34e72ff7f5
commit 3a2343fbce
8 changed files with 331 additions and 125 deletions

4
.vimrc
View File

@@ -181,6 +181,8 @@ nmap <C-Down> \dj
let g:buffergator_split_size=10
let g:buffergator_viewport_split_policy='B'
let g:buffergator_suppress_keymaps=1
let g:buffergator_sort_regime="filepath"
let g:buffergator_display_regime="filepath"
map <Leader>b :BuffergatorToggle<CR>
" }}}
"Gundo {{{2
@@ -386,7 +388,7 @@ endfunction
" GUI: detect graphics mode, set colorscheme {{{
if has('gui_running')
"set guifont=Consolas\ 12 "I like this font, but it looks like crap on linux
"set guifont=Consolas\ 13 "Let's try again
"set guifont=DejaVu\ Sans\ Mono\ 12 "at least, some ttf font that looks good
set guifont=Fixed\ 14 "I like this font better.
set mouse=a "Enable mouse support
"No toolbar, menu, scrollbars, draw simple text tabs. This would keep

View File

@@ -17,7 +17,7 @@ ScriptID SourceID Filename
152 3342 showmarks.vim
2540 11006 snipMate.vim
1697 12566 :AutoInstall: surround.vim
3465 16977 Tagbar
3465 17112 Tagbar
90 17031 vcscommand.vim
2226 15854 vimwiki.vim
1334 6377 vst.vim

View File

@@ -4,7 +4,7 @@
" Author: Jan Larres <jan@majutsushi.net>
" Licence: Vim licence
" Website: http://majutsushi.github.com/tagbar/
" Version: 2.2
" Version: 2.3
" Note: This plugin was heavily inspired by the 'Taglist' plugin by
" Yegappan Lakshmanan and uses a small amount of code from it.
"
@@ -73,17 +73,8 @@ if s:ftype_out !~# 'detection:ON'
endif
unlet s:ftype_out
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:icon_closed = g:tagbar_iconchars[0]
let s:icon_open = g:tagbar_iconchars[1]
let s:type_init_done = 0
let s:autocommands_done = 0
@@ -99,9 +90,26 @@ let s:access_symbols = {
let g:loaded_tagbar = 1
let s:last_highlight_tline = 0
let s:debug = 0
let s:debug_file = ''
" s:Init() {{{2
function! s:Init()
if !s:type_init_done
call s:InitTypes()
endif
if !s:checked_ctags
if !s:CheckForExCtags()
return
endif
endif
endfunction
" s:InitTypes() {{{2
function! s:InitTypes()
call s:LogDebugMessage('Initializing types')
let s:known_types = {}
" Ant {{{3
@@ -401,7 +409,8 @@ function! s:InitTypes()
" Alternatively jsctags/doctorjs will be used if available.
let type_javascript = {}
let type_javascript.ctagstype = 'javascript'
if executable('jsctags')
let jsctags = s:CheckFTCtags('jsctags', 'javascript')
if jsctags != ''
let type_javascript.kinds = [
\ {'short' : 'v', 'long' : 'variables', 'fold' : 0},
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0}
@@ -414,7 +423,7 @@ function! s:InitTypes()
let type_javascript.scope2kind = {
\ 'namespace' : 'v'
\ }
let type_javascript.ctagsbin = 'jsctags'
let type_javascript.ctagsbin = jsctags
let type_javascript.ctagsargs = '-f -'
else
let type_javascript.kinds = [
@@ -748,6 +757,8 @@ endfunction
" s:GetUserTypeDefs() {{{2
function! s:GetUserTypeDefs()
call s:LogDebugMessage('Initializing user types')
redir => defs
silent execute 'let g:'
redir END
@@ -766,6 +777,7 @@ function! s:GetUserTypeDefs()
" generate the other one
" Also, transform the 'kind' definitions into dictionary format
for def in values(defdict)
if has_key(def, 'kinds')
let kinds = def.kinds
let def.kinds = []
for kind in kinds
@@ -778,6 +790,7 @@ function! s:GetUserTypeDefs()
endif
call add(def.kinds, kinddict)
endfor
endif
if has_key(def, 'kind2scope') && !has_key(def, 'scope2kind')
let def.scope2kind = {}
@@ -798,6 +811,8 @@ endfunction
" s:RestoreSession() {{{2
" Properly restore Tagbar after a session got loaded
function! s:RestoreSession()
call s:LogDebugMessage('Restoring session')
let tagbarwinnr = bufwinnr('__Tagbar__')
if tagbarwinnr == -1
" Tagbar wasn't open in the saved session, nothing to do
@@ -810,15 +825,7 @@ function! s:RestoreSession()
endif
endif
if !s:type_init_done
call s:InitTypes()
endif
if !s:checked_ctags
if !s:CheckForExCtags()
return
endif
endif
call s:Init()
call s:InitWindow(g:tagbar_autoclose)
@@ -833,6 +840,8 @@ endfunction
" s:MapKeys() {{{2
function! s:MapKeys()
call s:LogDebugMessage('Mapping keys')
nnoremap <script> <silent> <buffer> <2-LeftMouse>
\ :call <SID>JumpToTag(0)<CR>
nnoremap <script> <silent> <buffer> <LeftRelease>
@@ -876,6 +885,8 @@ endfunction
" s:CreateAutocommands() {{{2
function! s:CreateAutocommands()
call s:LogDebugMessage('Creating autocommands')
augroup TagbarAutoCmds
autocmd!
autocmd BufEnter __Tagbar__ nested call s:QuitIfOnlyWindow()
@@ -899,6 +910,8 @@ endfunction
" Test whether the ctags binary is actually Exuberant Ctags and not GNU ctags
" (or something else)
function! s:CheckForExCtags()
call s:LogDebugMessage('Checking for Exuberant Ctags')
let ctags_cmd = s:EscapeCtagsCmd(g:tagbar_ctags_bin, '--version')
if ctags_cmd == ''
return
@@ -940,6 +953,8 @@ endfunction
" s:CheckExCtagsVersion() {{{2
function! s:CheckExCtagsVersion(output)
call s:LogDebugMessage('Checking Exuberant Ctags version')
if a:output =~ 'Exuberant Ctags Development'
return 1
endif
@@ -951,6 +966,24 @@ function! s:CheckExCtagsVersion(output)
return major >= 6 || (major == 5 && minor >= 5)
endfunction
" s:CheckFTCtags() {{{2
function! s:CheckFTCtags(bin, ftype)
if executable(a:bin)
return a:bin
endif
if exists('g:tagbar_type_' . a:ftype)
execute 'let userdef = ' . 'g:tagbar_type_' . a:ftype
if has_key(userdef, 'ctagsbin')
return userdef.ctagsbin
else
return ''
endif
endif
return ''
endfunction
" Prototypes {{{1
" Base tag {{{2
let s:BaseTag = {}
@@ -1369,7 +1402,7 @@ function! s:ToggleWindow()
return
endif
call s:OpenWindow(0)
call s:OpenWindow('')
endfunction
" s:OpenWindow() {{{2
@@ -1391,15 +1424,7 @@ function! s:OpenWindow(flags)
return
endif
if !s:type_init_done
call s:InitTypes()
endif
if !s:checked_ctags
if !s:CheckForExCtags()
return
endif
endif
call s:Init()
" Expand the Vim window to accomodate for the Tagbar window if requested
if g:tagbar_expand && !s:window_expanded && has('gui_running')
@@ -1550,18 +1575,23 @@ endfunction
" s:ProcessFile() {{{2
" Execute ctags and put the information into a 'FileInfo' object
function! s:ProcessFile(fname, ftype)
call s:LogDebugMessage('ProcessFile called on ' . a:fname)
if !s:IsValidFile(a:fname, a:ftype)
call s:LogDebugMessage('Not a valid file, returning')
return
endif
let ctags_output = s:ExecuteCtagsOnFile(a:fname, a:ftype)
if ctags_output == -1
call s:LogDebugMessage('Ctags error when processing file')
" put an empty entry into known_files so the error message is only
" shown once
call s:known_files.put({}, a:fname)
return
elseif ctags_output == ''
call s:LogDebugMessage('Ctags output empty')
return
endif
@@ -1577,8 +1607,14 @@ function! s:ProcessFile(fname, ftype)
let typeinfo = s:known_types[a:ftype]
" Parse the ctags output lines
call s:LogDebugMessage('Parsing ctags output')
let rawtaglist = split(ctags_output, '\n\+')
for line in rawtaglist
" skip comments
if line =~# '^!_TAG_'
continue
endif
let parts = split(line, ';"')
if len(parts) == 2 " Is a valid tag line
let taginfo = s:ParseTagline(parts[0], parts[1], typeinfo, fileinfo)
@@ -1590,6 +1626,8 @@ function! s:ProcessFile(fname, ftype)
" Process scoped tags
let processedtags = []
if has_key(typeinfo, 'kind2scope')
call s:LogDebugMessage('Processing scoped tags')
let scopedtags = []
let is_scoped = 'has_key(typeinfo.kind2scope, v:val.fields.kind) ||
\ has_key(v:val, "scope")'
@@ -1605,11 +1643,15 @@ function! s:ProcessFile(fname, ftype)
\ 'Please contact the script maintainer with an example.'
endif
endif
call s:LogDebugMessage('Number of top-level tags: ' . len(processedtags))
" Create a placeholder tag for the 'kind' header for folding purposes
for kind in typeinfo.kinds
let curtags = filter(copy(fileinfo.tags),
\ 'v:val.fields.kind ==# kind.short')
call s:LogDebugMessage('Processing kind: ' . kind.short .
\ ', number of tags: ' . len(curtags))
if empty(curtags)
continue
@@ -1629,7 +1671,7 @@ function! s:ProcessFile(fname, ftype)
call extend(fileinfo.tags, processedtags)
endif
" Clear old folding information from previous file version
" Clear old folding information from previous file version to prevent leaks
call fileinfo.clearOldFolds()
" Sort the tags
@@ -1641,6 +1683,8 @@ endfunction
" s:ExecuteCtagsOnFile() {{{2
function! s:ExecuteCtagsOnFile(fname, ftype)
call s:LogDebugMessage('ExecuteCtagsOnFile called on ' . a:fname)
let typeinfo = s:known_types[a:ftype]
if has_key(typeinfo, 'ctagsargs')
@@ -1690,6 +1734,8 @@ function! s:ExecuteCtagsOnFile(fname, ftype)
echoerr 'Tagbar: Could not execute ctags for ' . a:fname . '!'
echomsg 'Executed command: "' . ctags_cmd . '"'
if !empty(ctags_output)
call s:LogDebugMessage('Command output:')
call s:LogDebugMessage(ctags_output)
echomsg 'Command output:'
for line in split(ctags_output, '\n')
echomsg line
@@ -1698,6 +1744,7 @@ function! s:ExecuteCtagsOnFile(fname, ftype)
return -1
endif
call s:LogDebugMessage('Ctags executed successfully')
return ctags_output
endfunction
@@ -1736,7 +1783,9 @@ function! s:ParseTagline(part1, part2, typeinfo, fileinfo)
let delimit = stridx(field, ':')
let key = strpart(field, 0, delimit)
let val = strpart(field, delimit + 1)
if len(val) > 0
let taginfo.fields[key] = val
endif
endfor
" Needed for jsctags
if has_key(taginfo.fields, 'lineno')
@@ -2029,6 +2078,8 @@ endfunction
" Display {{{1
" s:RenderContent() {{{2
function! s:RenderContent(...)
call s:LogDebugMessage('RenderContent called')
if a:0 == 1
let fileinfo = a:1
else
@@ -2036,6 +2087,7 @@ function! s:RenderContent(...)
endif
if empty(fileinfo)
call s:LogDebugMessage('Empty fileinfo, returning')
return
endif
@@ -2052,6 +2104,7 @@ function! s:RenderContent(...)
if !empty(s:known_files.getCurrent()) &&
\ fileinfo.fpath ==# s:known_files.getCurrent().fpath
" We're redisplaying the same file, so save the view
call s:LogDebugMessage('Redisplaying file' . fileinfo.fpath)
let saveline = line('.')
let savecol = col('.')
let topline = line('w0')
@@ -2114,11 +2167,15 @@ endfunction
" s:PrintKinds() {{{2
function! s:PrintKinds(typeinfo, fileinfo)
call s:LogDebugMessage('PrintKinds called')
let first_tag = 1
for kind in a:typeinfo.kinds
let curtags = filter(copy(a:fileinfo.tags),
\ 'v:val.fields.kind ==# kind.short')
call s:LogDebugMessage('Printing kind: ' . kind.short .
\ ', number of (top-level) tags: ' . len(curtags))
if empty(curtags)
continue
@@ -2669,17 +2726,23 @@ endfunction
" s:AutoUpdate() {{{2
function! s:AutoUpdate(fname)
call s:LogDebugMessage('AutoUpdate called on ' . a:fname)
" Don't do anything if tagbar is not open or if we're in the tagbar window
let tagbarwinnr = bufwinnr('__Tagbar__')
if tagbarwinnr == -1 || &filetype == 'tagbar'
call s:LogDebugMessage('Tagbar window not open or in Tagbar window')
return
endif
" Only consider the main filetype in cases like 'python.django'
let ftype = get(split(&filetype, '\.'), 0, '')
call s:LogDebugMessage('Vim filetype: ' . &filetype .
\ ', sanitized filetype: ' . ftype)
" Don't do anything if the file isn't supported
if !s:IsValidFile(a:fname, ftype)
call s:LogDebugMessage('Not a valid file, stopping processing')
return
endif
@@ -2688,9 +2751,11 @@ function! s:AutoUpdate(fname)
" if there was an error during the ctags execution
if s:known_files.has(a:fname) && !empty(s:known_files.get(a:fname))
if s:known_files.get(a:fname).mtime != getftime(a:fname)
call s:LogDebugMessage('Filedata outdated, updating ' . a:fname)
call s:ProcessFile(a:fname, ftype)
endif
elseif !s:known_files.has(a:fname)
call s:LogDebugMessage('Unknown file, processing ' . a:fname)
call s:ProcessFile(a:fname, ftype)
endif
@@ -2699,6 +2764,7 @@ function! s:AutoUpdate(fname)
" If we don't have an entry for the file by now something must have gone
" wrong, so don't change the tagbar content
if empty(fileinfo)
call s:LogDebugMessage('fileinfo empty after processing: ' . a:fname)
return
endif
@@ -2708,23 +2774,28 @@ function! s:AutoUpdate(fname)
" Call setCurrent after rendering so RenderContent can check whether the
" same file is redisplayed
if !empty(fileinfo)
call s:LogDebugMessage('Setting current file to ' . a:fname)
call s:known_files.setCurrent(fileinfo)
endif
call s:HighlightTag()
call s:LogDebugMessage('AutoUpdate finished successfully')
endfunction
" s:IsValidFile() {{{2
function! s:IsValidFile(fname, ftype)
if a:fname == '' || a:ftype == ''
call s:LogDebugMessage('Empty filename or type')
return 0
endif
if !filereadable(a:fname)
call s:LogDebugMessage('File not readable')
return 0
endif
if !has_key(s:known_types, a:ftype)
call s:LogDebugMessage('Unsupported filetype: ' . a:ftype)
return 0
endif
@@ -2736,6 +2807,10 @@ endfunction
" properly escaped and converted to the system's encoding
" Optional third parameter is a file name to run ctags on
function! s:EscapeCtagsCmd(ctags_bin, args, ...)
call s:LogDebugMessage('EscapeCtagsCmd called')
call s:LogDebugMessage('ctags_bin: ' . a:ctags_bin)
call s:LogDebugMessage('ctags_args: ' . a:args)
if exists('+shellslash')
let shellslash_save = &shellslash
set noshellslash
@@ -2761,6 +2836,8 @@ function! s:EscapeCtagsCmd(ctags_bin, args, ...)
let ctags_cmd = iconv(ctags_cmd, &encoding, $LANG)
endif
call s:LogDebugMessage('Escaped ctags command: ' . ctags_cmd)
if ctags_cmd == ''
echoerr 'Tagbar: Encoding conversion failed!'
\ 'Please make sure your system is set up correctly'
@@ -2870,6 +2947,38 @@ function! s:CheckMouseClick()
endif
endfunction
" s:DetermineFiletype() {{{2
function! s:DetectFiletype(bufnr)
" Filetype has already been detected for loaded buffers, but not
" necessarily for unloaded ones
let ftype = getbufvar(a:bufnr, '&filetype')
if bufloaded(a:bufnr)
return ftype
endif
if ftype != ''
return ftype
endif
" Unloaded buffer with non-detected filetype, need to detect filetype
" manually
let bufname = bufname(a:bufnr)
let eventignore_save = &eventignore
set eventignore=FileType
let filetype_save = &filetype
exe 'doautocmd filetypedetect BufRead ' . bufname
let ftype = &filetype
let &filetype = filetype_save
let &eventignore = eventignore_save
return ftype
endfunction
" TagbarBalloonExpr() {{{2
function! TagbarBalloonExpr()
let taginfo = s:GetTagInfo(v:beval_lnum, 1)
@@ -2897,6 +3006,44 @@ function! TagbarGenerateStatusline()
return text
endfunction
" Debugging {{{1
" s:StartDebug() {{{2
function! s:StartDebug(filename)
if empty(a:filename)
let s:debug_file = 'tagbardebug.log'
else
let s:debug_file = a:filename
endif
" Empty log file
exe 'redir! > ' . s:debug_file
redir END
" Check whether the log file could be created
if !filewritable(s:debug_file)
echomsg 'Tagbar: Unable to create log file ' . s:debug_file
let s:debug_file = ''
return
endif
let s:debug = 1
endfunction
" s:StopDebug() {{{2
function! s:StopDebug()
let s:debug = 0
let s:debug_file = ''
endfunction
" s:LogDebugMessage() {{{2
function! s:LogDebugMessage(msg)
if s:debug
exe 'redir >> ' . s:debug_file
silent echon strftime('%H:%M:%S') . ': ' . a:msg . "\n"
redir END
endif
endfunction
" Autoload functions {{{1
function! tagbar#ToggleWindow()
call s:ToggleWindow()
@@ -2919,9 +3066,34 @@ function! tagbar#OpenParents()
call s:OpenParents()
endfunction
function! tagbar#StartDebug(...)
let filename = a:0 > 0 ? a:1 : ''
call s:StartDebug(filename)
endfunction
function! tagbar#StopDebug()
call s:StopDebug()
endfunction
function! tagbar#RestoreSession()
call s:RestoreSession()
endfunction
" Automatically open Tagbar if one of the open buffers contains a supported
" file
function! tagbar#autoopen()
call s:Init()
for bufnr in range(1, bufnr('$'))
if buflisted(bufnr)
let ftype = s:DetectFiletype(bufnr)
if s:IsValidFile(bufname(bufnr), ftype)
call s:OpenWindow('')
return
endif
endif
endfor
endfunction
" Modeline {{{1
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1

View File

@@ -3,7 +3,7 @@
Author: Jan Larres <jan@majutsushi.net>
Licence: Vim licence, see |license|
Homepage: http://majutsushi.github.com/tagbar/
Version: 2.2
Version: 2.3
==============================================================================
Contents *tagbar* *tagbar-contents*
@@ -260,6 +260,14 @@ COMMANDS *tagbar-commands*
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.
:TagbarDebug [logfile]
Start debug mode. This will write debug messages to file [logfile] while
using Tagbar. If no argument is given "tagbardebug.log" in the current
directory is used. Note: an existing file will be overwritten!
:TagbarDebugEnd
End debug mode, debug messages will no longer be written to the logfile.
------------------------------------------------------------------------------
KEY MAPPINGS *tagbar-keys*
@@ -413,21 +421,22 @@ Example:
let g:tagbar_foldlevel = 2
<
*g:tagbar_usearrows*
g:tagbar_usearrows~
{Windows only}
Default: 0
*g:tagbar_iconchars*
g:tagbar_iconchars~
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.
Since the display of the icons used to indicate open or closed folds depends
on the actual font used, different characters may be optimal for different
fonts. With this variable you can set the icons to characters of your liking.
The first character in the list specifies the icon to use for a closed fold,
and the second one for an open fold.
Example:
Examples (don't worry if some the characters aren't displayed correctly, just
choose other characters in that case):
>
let g:tagbar_usearrows = 1
let g:tagbar_iconchars = ['▶', '▼'] (default on Linux and Mac OS X)
let g:tagbar_iconchars = ['▾', '▸']
let g:tagbar_iconchars = ['▷', '◢']
let g:tagbar_iconchars = ['+', '-'] (default on Windows)
<
*g:tagbar_autoshowtag*
@@ -528,19 +537,32 @@ 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|).
Since there are several different situations in which you might want to open
Tagbar automatically there is no single option to enable automatic opening.
Instead, autocommands can be used together with a convenience function that
opens Tagbar only if a supported file is open(ed).
Check out |autocmd.txt| if you want it to automatically open in more
If you want to open Tagbar automatically on Vim startup no matter what put
this into your vimrc:
>
autocmd VimEnter * nested :TagbarOpen
<
If you want to open it only if you're opening Vim with a supported file/files
use this instead:
>
autocmd VimEnter * nested :call tagbar#autoopen()
<
For opening Tagbar also if you open a supported file in an already running
Vim:
>
autocmd FileType * nested :call tagbar#autoopen()
<
And if you only want to open Tagbar only for specific filetypes, not for all
of the supported ones:
>
autocmd FileType c,cpp nested :TagbarOpen
<
Check out |autocmd.txt| if you want it to open automatically in more
complicated cases.
==============================================================================
@@ -552,15 +574,11 @@ 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).
Before writing your own extension have a look at the wiki
(https://github.com/majutsushi/tagbar/wiki/Support-for-additional-filetypes)
or try googling for existing ones. If you do end up creating your own
extension please consider adding it to the wiki so that others will be able to
use it, too.
Every type definition in Tagbar is a dictionary with the following keys:
@@ -642,9 +660,9 @@ deffile: The path to a file with additional ctags definitions (see the
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).
set in that case. If it is not in your path you have to set this
key, the rest of the configuration should not be necessary (unless
you want to change something, of course).
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
@@ -821,6 +839,12 @@ ctags manually execute the following command in a terminal:
If you set the |g:tagbar_ctags_bin| variable you probably have to use the same
value here instead of simply "ctags".
If Tagbar doesn't seem to work at all, but you don't get any error messages,
you can use Tagbar's debug mode to try to find the source of the problem (see
|tagbar-commands| on how to invoke it). In that case you should especially pay
attention to the reported file type and the ctags command line in the log
file.
- 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
@@ -874,6 +898,16 @@ value here instead of simply "ctags".
==============================================================================
8. History *tagbar-history*
2.3 (2011-12-24)
- Add a convenience function that allows more flexible ways to
automatically open Tagbar.
- Replace option tagbar_usearrows with tagbar_iconchars to allow custom
characters to be specified. This helps with fonts that don't display the
default characters properly.
- Remove the need to provide the complete jsctags configuration if jsctags
is not found in $PATH, now only the concrete path has to be specified.
- Add debugging functionality.
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

View File

@@ -412,12 +412,12 @@ 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_iconchars tagbar.txt /*g:tagbar_iconchars*
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*
g:vimwiki_auto_checkbox vimwiki.txt /*g:vimwiki_auto_checkbox*

View File

@@ -1,18 +1,12 @@
setlocal cinkeys-=0#
setlocal indentkeys-=0#
setlocal expandtab
setlocal foldlevel=100
setlocal foldmethod=indent
setlocal list
setlocal noautoindent
setlocal shiftwidth=4
setlocal smartindent
setlocal cinwords=if,elif,else,for,while,try,except,finally,def,class,with
setlocal smarttab
setlocal softtabstop=4
setlocal tabstop=4
setlocal textwidth=78
setlocal colorcolumn=+1
set wildignore+=*.pyc

View File

@@ -4,7 +4,7 @@
" Author: Jan Larres <jan@majutsushi.net>
" Licence: Vim licence
" Website: http://majutsushi.github.com/tagbar/
" Version: 2.2
" Version: 2.3
" Note: This plugin was heavily inspired by the 'Taglist' plugin by
" Yegappan Lakshmanan and uses a small amount of code from it.
"
@@ -78,8 +78,13 @@ if !exists('g:tagbar_foldlevel')
let g:tagbar_foldlevel = 99
endif
if !exists('g:tagbar_usearrows')
let g:tagbar_usearrows = 0
if !exists('g:tagbar_iconchars')
if has('multi_byte') && has('unix') && &encoding == 'utf-8' &&
\ (empty(&termencoding) || &termencoding == 'utf-8')
let g:tagbar_iconchars = ['▶', '▼']
else
let g:tagbar_iconchars = ['+', '-']
endif
endif
if !exists('g:tagbar_autoshowtag')
@@ -106,6 +111,8 @@ 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()
command! -nargs=? TagbarDebug call tagbar#StartDebug(<f-args>)
command! -nargs=0 TagbarDebugEnd call tagbar#StopDebug()
" Modeline {{{1
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1

View File

@@ -3,7 +3,7 @@
" Author: Jan Larres <jan@majutsushi.net>
" Licence: Vim licence
" Website: http://majutsushi.github.com/tagbar/
" Version: 2.2
" Version: 2.3
scriptencoding utf-8
@@ -11,35 +11,32 @@ if exists("b:current_syntax")
finish
endif
if has('multi_byte') && has('unix') && &encoding == 'utf-8' &&
\ (empty(&termencoding) || &termencoding == 'utf-8')
syntax match TagbarKind '\([▶▼] \)\@<=[^-+: ]\+[^:]\+$'
syntax match TagbarScope '\([▶▼][-+# ]\)\@<=[^*]\+\(\*\?\(([^)]\+)\)\? :\)\@='
syntax match TagbarFoldIcon '[▶▼]\([-+# ]\)\@='
syntax match TagbarAccessPublic '\([▶▼ ]\)\@<=+\([^-+# ]\)\@='
syntax match TagbarAccessProtected '\([▶▼ ]\)\@<=#\([^-+# ]\)\@='
syntax match TagbarAccessPrivate '\([▶▼ ]\)\@<=-\([^-+# ]\)\@='
elseif has('multi_byte') && (has('win32') || has('win64')) && g:tagbar_usearrows
syntax match TagbarKind '\([▷◢] \)\@<=[^-+: ]\+[^:]\+$'
syntax match TagbarScope '\([▷◢][-+# ]\)\@<=[^*]\+\(\*\?\(([^)]\+)\)\? :\)\@='
syntax match TagbarFoldIcon '[▷◢]\([-+# ]\)\@='
syntax match TagbarAccessPublic '\([▷◢ ]\)\@<=+\([^-+# ]\)\@='
syntax match TagbarAccessProtected '\([▷◢ ]\)\@<=#\([^-+# ]\)\@='
syntax match TagbarAccessPrivate '\([▷◢ ]\)\@<=-\([^-+# ]\)\@='
else
syntax match TagbarKind '\([-+] \)\@<=[^-+: ]\+[^:]\+$'
syntax match TagbarScope '\([-+][-+# ]\)\@<=[^*]\+\(\*\?\(([^)]\+)\)\? :\)\@='
syntax match TagbarFoldIcon '[-+]\([-+# ]\)\@='
syntax match TagbarAccessPublic '\([-+ ]\)\@<=+\([^-+# ]\)\@='
syntax match TagbarAccessProtected '\([-+ ]\)\@<=#\([^-+# ]\)\@='
syntax match TagbarAccessPrivate '\([-+ ]\)\@<=-\([^-+# ]\)\@='
let s:ic = g:tagbar_iconchars[0]
if s:ic =~ '[]^\\-]'
let s:ic = '\' . s:ic
endif
let s:io = g:tagbar_iconchars[1]
if s:io =~ '[]^\\-]'
let s:io = '\' . s:io
endif
let s:pattern = '\([' . s:ic . s:io . '] \)\@<=[^-+: ]\+[^:]\+$'
execute "syntax match TagbarKind '" . s:pattern . "'"
let s:pattern = '\([' . s:ic . s:io . '][-+# ]\)\@<=[^*]\+\(\*\?\(([^)]\+)\)\? :\)\@='
execute "syntax match TagbarScope '" . s:pattern . "'"
let s:pattern = '[' . s:ic . s:io . ']\([-+# ]\)\@='
execute "syntax match TagbarFoldIcon '" . s:pattern . "'"
let s:pattern = '\([' . s:ic . s:io . ' ]\)\@<=+\([^-+# ]\)\@='
execute "syntax match TagbarAccessPublic '" . s:pattern . "'"
let s:pattern = '\([' . s:ic . s:io . ' ]\)\@<=#\([^-+# ]\)\@='
execute "syntax match TagbarAccessProtected '" . s:pattern . "'"
let s:pattern = '\([' . s:ic . s:io . ' ]\)\@<=-\([^-+# ]\)\@='
execute "syntax match TagbarAccessPrivate '" . s:pattern . "'"
unlet s:pattern
syntax match TagbarNestedKind '^\s\+\[[^]]\+\]$'
syntax match TagbarComment '^".*'