1
0
Fork 0
mirror of synced 2024-12-25 00:03:20 -05:00

add tagbar(not as a submodule)

This commit is contained in:
Tiande 2016-01-16 21:29:01 +08:00
parent fa1b22fa3d
commit 8093a5d271
6 changed files with 6156 additions and 0 deletions

82
sources_forked/tagbar/LICENSE Executable file
View file

@ -0,0 +1,82 @@
TAGBAR LICENSE
This is the normal Vim license (see ':h license' in Vim) with the necessary
replacements for the project and maintainer information.
I) There are no restrictions on distributing unmodified copies of Tagbar
except that they must include this license text. You can also distribute
unmodified parts of Tagbar, likewise unrestricted except that they must
include this license text. You are also allowed to include executables
that you made from the unmodified Tagbar sources, plus your own usage
examples and scripts.
II) It is allowed to distribute a modified (or extended) version of Tagbar,
including executables and/or source code, when the following four
conditions are met:
1) This license text must be included unmodified.
2) The modified Tagbar must be distributed in one of the following five ways:
a) If you make changes to Tagbar yourself, you must clearly describe in
the distribution how to contact you. When the maintainer asks you
(in any way) for a copy of the modified Tagbar you distributed, you
must make your changes, including source code, available to the
maintainer without fee. The maintainer reserves the right to
include your changes in the official version of Tagbar. What the
maintainer will do with your changes and under what license they
will be distributed is negotiable. If there has been no negotiation
then this license, or a later version, also applies to your changes.
The current maintainer is Jan Larres <jan@majutsushi.net>. If this
changes it will be announced in appropriate places (most likely
majutsushi.github.io/tagbar and/or github.com/majutsushi/tagbar).
When it is completely impossible to contact the maintainer, the
obligation to send him your changes ceases. Once the maintainer has
confirmed that he has received your changes they will not have to be
sent again.
b) If you have received a modified Tagbar that was distributed as
mentioned under a) you are allowed to further distribute it
unmodified, as mentioned at I). If you make additional changes the
text under a) applies to those changes.
c) Provide all the changes, including source code, with every copy of
the modified Tagbar you distribute. This may be done in the form of
a context diff. You can choose what license to use for new code you
add. The changes and their license must not restrict others from
making their own changes to the official version of Tagbar.
d) When you have a modified Tagbar which includes changes as mentioned
under c), you can distribute it without the source code for the
changes if the following three conditions are met:
- The license that applies to the changes permits you to distribute
the changes to the Tagbar maintainer without fee or restriction, and
permits the Tagbar maintainer to include the changes in the official
version of Tagbar without fee or restriction.
- You keep the changes for at least three years after last
distributing the corresponding modified Tagbar. When the
maintainer or someone who you distributed the modified Tagbar to
asks you (in any way) for the changes within this period, you must
make them available to him.
- You clearly describe in the distribution how to contact you. This
contact information must remain valid for at least three years
after last distributing the corresponding modified Tagbar, or as
long as possible.
e) When the GNU General Public License (GPL) applies to the changes,
you can distribute the modified Tagbar under the GNU GPL version 2
or any later version.
3) A message must be added, at least in the documentation, such that the
user of the modified Tagbar is able to see that it was modified. When
distributing as mentioned under 2)e) adding the message is only
required for as far as this does not conflict with the license used for
the changes.
4) The contact information as required under 2)a) and 2)d) must not be
removed or changed, except that the person himself can make
corrections.
III) If you distribute a modified version of Tagbar, you are encouraged to use
the Tagbar license for your changes and make them available to the
maintainer, including the source code. The preferred way to do this is
by e-mail or by uploading the files to a server and e-mailing the URL. If
the number of changes is small (e.g., a modified Makefile) e-mailing a
context diff will do. The e-mail address to be used is
<jan@majutsushi.net>
IV) It is not allowed to remove this license from the distribution of the
Tagbar sources, parts of it or from a modified version. You may use this
license for previous Tagbar releases instead of the license that they
came with, at your option.

89
sources_forked/tagbar/README.md Executable file
View file

@ -0,0 +1,89 @@
# Tagbar: a class outline viewer for Vim
## What Tagbar is
Tagbar is a Vim plugin that provides an easy way to browse the tags of the
current file and get an overview of its structure. It does this by creating a
sidebar that displays the ctags-generated tags of the current file, ordered by
their scope. This means that for example methods in C++ are displayed under
the class they are defined in.
## What Tagbar is not
Tagbar is not a general-purpose tool for managing `tags` files. It only
creates the tags it needs on-the-fly in-memory without creating any files.
`tags` file management is provided by other plugins, like for example
[easytags](https://github.com/xolox/vim-easytags).
## Dependencies
[Vim 7.0](http://www.vim.org/) (But see note below)
[Exuberant ctags 5.5](http://ctags.sourceforge.net/)
## Installation
Extract the archive or clone the repository into a directory in your
`'runtimepath'`, or use a plugin manager of your choice like
[pathogen](https://github.com/tpope/vim-pathogen). Don't forget to run
`:helptags` if your plugin manager doesn't do it for you so you can access the
documentation with `:help tagbar`.
Note: Vim versions < 7.0.167 have a bug that prevents Tagbar from working. If
you are affected by this use this alternate Tagbar download instead:
[zip](https://github.com/majutsushi/tagbar/zipball/70fix). It is on par with
version 2.2 but probably won't be updated after that due to the amount of
changes required.
If the ctags executable is not installed in one of the directories in your
`$PATH` environment variable you have to set the `g:tagbar_ctags_bin`
variable, see the documentation for more info.
## Quickstart
Put something like the following into your ~/.vimrc:
```vim
nmap <F8> :TagbarToggle<CR>
```
If you do this the F8 key will toggle the Tagbar window. You can of course use
any shortcut you want. For more flexible ways to open and close the window
(and the rest of the functionality) see the documentation.
## Support for additional filetypes
For filetypes that are not supported by Exuberant Ctags check out [the
wiki](https://github.com/majutsushi/tagbar/wiki) to see whether other projects
offer support for them and how to use them. Please add any other
projects/configurations that you find or create yourself so that others can
benefit from them, too.
## Note: If the file structure display is wrong
If you notice that there are some errors in the way your file's structure is
displayed in Tagbar, please make sure that the bug is actually in Tagbar
before you report an issue. Since Tagbar uses
[exuberant-ctags](http://ctags.sourceforge.net/) and compatible programs to do
the actual file parsing, it is likely that the bug is actually in the program
responsible for that filetype instead.
There is an example in `:h tagbar-issues` about how to run ctags manually so
you can determine where the bug actually is. If the bug is actually in ctags,
please report it on their website instead, as there is nothing I can do about
it in Tagbar. Thank you!
You can also have a look at [ctags bugs that have previously been filed
against Tagbar](https://github.com/majutsushi/tagbar/issues?labels=ctags-bug&page=1&state=closed).
## Screenshots
![screenshot1](https://i.imgur.com/Sf9Ls2r.png)
![screenshot2](https://i.imgur.com/n4bpPv3.png)
## License
Vim license, see LICENSE
## Maintainer
Jan Larres <[jan@majutsushi.net](mailto:jan@majutsushi.net)>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,146 @@
" ============================================================================
" 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.6.1
" 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
function! s:init_var(var, value) abort
if !exists('g:tagbar_' . a:var)
execute 'let g:tagbar_' . a:var . ' = ' . string(a:value)
endif
endfunction
function! s:setup_options() abort
if !exists('g:tagbar_vertical') || g:tagbar_vertical == 0
let previewwin_pos = 'topleft'
else
let previewwin_pos = 'rightbelow vertical'
endif
let options = [
\ ['autoclose', 0],
\ ['autofocus', 0],
\ ['autopreview', 0],
\ ['autoshowtag', 0],
\ ['compact', 0],
\ ['expand', 0],
\ ['foldlevel', 99],
\ ['hide_nonpublic', 0],
\ ['indent', 2],
\ ['left', 0],
\ ['previewwin_pos', previewwin_pos],
\ ['show_visibility', 1],
\ ['show_linenumbers', 0],
\ ['singleclick', 0],
\ ['sort', 1],
\ ['systemenc', &encoding],
\ ['vertical', 0],
\ ['width', 40],
\ ['zoomwidth', 1],
\ ]
for [opt, val] in options
call s:init_var(opt, val)
endfor
endfunction
call s:setup_options()
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
function! s:setup_keymaps() abort
let keymaps = [
\ ['jump', '<CR>'],
\ ['preview', 'p'],
\ ['previewwin', 'P'],
\ ['nexttag', '<C-N>'],
\ ['prevtag', '<C-P>'],
\ ['showproto', '<Space>'],
\ ['hidenonpublic', 'v'],
\
\ ['openfold', ['+', '<kPlus>', 'zo']],
\ ['closefold', ['-', '<kMinus>', 'zc']],
\ ['togglefold', ['o', 'za']],
\ ['openallfolds', ['*', '<kMultiply>', 'zR']],
\ ['closeallfolds', ['=', 'zM']],
\ ['nextfold', 'zj'],
\ ['prevfold', 'zk'],
\
\ ['togglesort', 's'],
\ ['toggleautoclose', 'c'],
\ ['zoomwin', 'x'],
\ ['close', 'q'],
\ ['help', ['<F1>', '?']],
\ ]
for [map, key] in keymaps
call s:init_var('map_' . map, key)
unlet key
endfor
endfunction
call s:setup_keymaps()
augroup TagbarSession
autocmd!
autocmd SessionLoadPost * nested call tagbar#RestoreSession()
augroup END
" Commands {{{1
command! -nargs=0 Tagbar call tagbar#ToggleWindow()
command! -nargs=0 TagbarToggle call tagbar#ToggleWindow()
command! -nargs=? TagbarOpen call tagbar#OpenWindow(<f-args>)
command! -nargs=0 TagbarOpenAutoClose call tagbar#OpenWindow('fcj')
command! -nargs=0 TagbarClose call tagbar#CloseWindow()
command! -nargs=1 -bang TagbarSetFoldlevel call tagbar#SetFoldLevel(<args>, <bang>0)
command! -nargs=0 TagbarShowTag call tagbar#highlighttag(1, 1)
command! -nargs=? TagbarCurrentTag echo tagbar#currenttag('%s', 'No current tag', <f-args>)
command! -nargs=1 TagbarGetTypeConfig call tagbar#gettypeconfig(<f-args>)
command! -nargs=? TagbarDebug call tagbar#StartDebug(<f-args>)
command! -nargs=0 TagbarDebugEnd call tagbar#StopDebug()
command! -nargs=0 TagbarTogglePause call tagbar#toggle_pause()
" Modeline {{{1
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1

View file

@ -0,0 +1,63 @@
" File: tagbar.vim
" Description: Tagbar syntax settings
" Author: Jan Larres <jan@majutsushi.net>
" Licence: Vim licence
" Website: http://majutsushi.github.com/tagbar/
" Version: 2.6.1
scriptencoding utf-8
if exists("b:current_syntax")
finish
endif
let s:ics = escape(join(g:tagbar_iconchars, ''), ']^\-')
let s:pattern = '\(^[' . s:ics . '] \?\)\@<=[^-+: ]\+[^:]\+$'
execute "syntax match TagbarKind '" . s:pattern . "'"
let s:pattern = '\(\S\@<![' . s:ics . '][-+# ]\?\)\@<=[^*(]\+\(\*\?\(([^)]\+)\)\? :\)\@='
execute "syntax match TagbarScope '" . s:pattern . "'"
let s:pattern = '\S\@<![' . s:ics . ']\([-+# ]\?\)\@='
execute "syntax match TagbarFoldIcon '" . s:pattern . "'"
let s:pattern = '\(\S\@<![' . s:ics . ' ]\)\@<=+\([^-+# ]\)\@='
execute "syntax match TagbarVisibilityPublic '" . s:pattern . "'"
let s:pattern = '\(\S\@<![' . s:ics . ' ]\)\@<=#\([^-+# ]\)\@='
execute "syntax match TagbarVisibilityProtected '" . s:pattern . "'"
let s:pattern = '\(\S\@<![' . s:ics . ' ]\)\@<=-\([^-+# ]\)\@='
execute "syntax match TagbarVisibilityPrivate '" . s:pattern . "'"
unlet s:pattern
syntax match TagbarHelp '^".*' contains=TagbarHelpKey,TagbarHelpTitle
syntax match TagbarHelpKey '" \zs.*\ze:' contained
syntax match TagbarHelpTitle '" \zs-\+ \w\+ -\+' contained
syntax match TagbarNestedKind '^\s\+\[[^]]\+\]$'
syntax match TagbarType ' : \zs.*'
syntax match TagbarSignature '(.*)'
syntax match TagbarPseudoID '\*\ze :'
highlight default link TagbarHelp Comment
highlight default link TagbarHelpKey Identifier
highlight default link TagbarHelpTitle PreProc
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
highlight default link TagbarPseudoID NonText
highlight default link TagbarFoldIcon Statement
highlight default link TagbarHighlight Search
highlight default TagbarAccessPublic guifg=Green ctermfg=Green
highlight default TagbarAccessProtected guifg=Blue ctermfg=Blue
highlight default TagbarAccessPrivate guifg=Red ctermfg=Red
highlight default link TagbarVisibilityPublic TagbarAccessPublic
highlight default link TagbarVisibilityProtected TagbarAccessProtected
highlight default link TagbarVisibilityPrivate TagbarAccessPrivate
let b:current_syntax = "tagbar"
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1