]> git.r.bdr.sh - rbdr/dotfiles/blob - vim/plugin/tagbar.vim
a078a18a2fbd5bfca0593cd88b94c7e32bdd657b
[rbdr/dotfiles] / vim / plugin / tagbar.vim
1 " ============================================================================
2 " File: tagbar.vim
3 " Description: List the current file's tags in a sidebar, ordered by class etc
4 " Author: Jan Larres <jan@majutsushi.net>
5 " Licence: Vim licence
6 " Website: http://majutsushi.github.com/tagbar/
7 " Version: 2.3
8 " Note: This plugin was heavily inspired by the 'Taglist' plugin by
9 " Yegappan Lakshmanan and uses a small amount of code from it.
10 "
11 " Original taglist copyright notice:
12 " Permission is hereby granted to use and distribute this code,
13 " with or without modifications, provided that this copyright
14 " notice is copied with it. Like anything else that's free,
15 " taglist.vim is provided *as is* and comes with no warranty of
16 " any kind, either expressed or implied. In no event will the
17 " copyright holder be liable for any damamges resulting from the
18 " use of this software.
19 " ============================================================================
20
21 scriptencoding utf-8
22
23 if &cp || exists('g:loaded_tagbar')
24 finish
25 endif
26
27 " Basic init {{{1
28
29 if v:version < 700
30 echohl WarningMsg
31 echomsg 'Tagbar: Vim version is too old, Tagbar requires at least 7.0'
32 echohl None
33 finish
34 endif
35
36 if v:version == 700 && !has('patch167')
37 echohl WarningMsg
38 echomsg 'Tagbar: Vim versions lower than 7.0.167 have a bug'
39 \ 'that prevents this version of Tagbar from working.'
40 \ 'Please use the alternate version posted on the website.'
41 echohl None
42 finish
43 endif
44
45 if !exists('g:tagbar_left')
46 let g:tagbar_left = 0
47 endif
48
49 if !exists('g:tagbar_width')
50 let g:tagbar_width = 40
51 endif
52
53 if !exists('g:tagbar_autoclose')
54 let g:tagbar_autoclose = 0
55 endif
56
57 if !exists('g:tagbar_autofocus')
58 let g:tagbar_autofocus = 0
59 endif
60
61 if !exists('g:tagbar_sort')
62 let g:tagbar_sort = 1
63 endif
64
65 if !exists('g:tagbar_compact')
66 let g:tagbar_compact = 0
67 endif
68
69 if !exists('g:tagbar_expand')
70 let g:tagbar_expand = 0
71 endif
72
73 if !exists('g:tagbar_singleclick')
74 let g:tagbar_singleclick = 0
75 endif
76
77 if !exists('g:tagbar_foldlevel')
78 let g:tagbar_foldlevel = 99
79 endif
80
81 if !exists('g:tagbar_iconchars')
82 if has('multi_byte') && has('unix') && &encoding == 'utf-8' &&
83 \ (empty(&termencoding) || &termencoding == 'utf-8')
84 let g:tagbar_iconchars = ['▶', '▼']
85 else
86 let g:tagbar_iconchars = ['+', '-']
87 endif
88 endif
89
90 if !exists('g:tagbar_autoshowtag')
91 let g:tagbar_autoshowtag = 0
92 endif
93
94 if !exists('g:tagbar_updateonsave_maxlines')
95 let g:tagbar_updateonsave_maxlines = 5000
96 endif
97
98 if !exists('g:tagbar_systemenc')
99 let g:tagbar_systemenc = &encoding
100 endif
101
102 augroup TagbarSession
103 autocmd!
104 autocmd SessionLoadPost * nested call tagbar#RestoreSession()
105 augroup END
106
107 " Commands {{{1
108 command! -nargs=0 TagbarToggle call tagbar#ToggleWindow()
109 command! -nargs=? TagbarOpen call tagbar#OpenWindow(<f-args>)
110 command! -nargs=0 TagbarOpenAutoClose call tagbar#OpenWindow('fc')
111 command! -nargs=0 TagbarClose call tagbar#CloseWindow()
112 command! -nargs=1 TagbarSetFoldlevel call tagbar#SetFoldLevel(<args>)
113 command! -nargs=0 TagbarShowTag call tagbar#OpenParents()
114 command! -nargs=? TagbarDebug call tagbar#StartDebug(<f-args>)
115 command! -nargs=0 TagbarDebugEnd call tagbar#StopDebug()
116
117 " Modeline {{{1
118 " vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1