mirror of
https://github.com/preservim/tagbar.git
synced 2024-11-26 02:13:44 +08:00
Move some tests to autoload
This commit is contained in:
parent
4920be4438
commit
96d0050ea4
|
@ -18,10 +18,53 @@
|
|||
" use of this software.
|
||||
" ============================================================================
|
||||
|
||||
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'
|
||||
elseif executable('exuberant-ctags')
|
||||
let g:tagbar_ctags_bin = 'exuberant-ctags'
|
||||
elseif executable('exctags')
|
||||
let g:tagbar_ctags_bin = 'exctags'
|
||||
elseif executable('ctags')
|
||||
let g:tagbar_ctags_bin = 'ctags'
|
||||
elseif executable('ctags.exe')
|
||||
let g:tagbar_ctags_bin = 'ctags.exe'
|
||||
elseif executable('tags')
|
||||
let g:tagbar_ctags_bin = 'tags'
|
||||
else
|
||||
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
|
||||
|
||||
redir => s:ftype_out
|
||||
silent filetype
|
||||
redir END
|
||||
if s:ftype_out !~# 'detection:ON'
|
||||
echomsg 'Tagbar: Filetype detection is turned off, skipping plugin'
|
||||
unlet s:ftype_out
|
||||
finish
|
||||
endif
|
||||
unlet s:ftype_out
|
||||
|
||||
if has('multi_byte') && has('unix') && &encoding == 'utf-8' &&
|
||||
\ (empty(&termencoding) || &termencoding == 'utf-8')
|
||||
let s:icon_closed = '▶'
|
||||
|
@ -45,6 +88,8 @@ let s:access_symbols = {
|
|||
\ 'private' : '-'
|
||||
\ }
|
||||
|
||||
let g:loaded_tagbar = 1
|
||||
|
||||
" s:InitTypes() {{{2
|
||||
function! s:InitTypes()
|
||||
let s:known_types = {}
|
||||
|
@ -2782,4 +2827,4 @@ function! tagbar#RestoreSession()
|
|||
endfunction
|
||||
|
||||
" Modeline {{{1
|
||||
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1
|
||||
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1
|
||||
|
|
|
@ -18,9 +18,7 @@
|
|||
" use of this software.
|
||||
" ============================================================================
|
||||
|
||||
if has('multi_byte')
|
||||
scriptencoding utf-8
|
||||
endif
|
||||
scriptencoding utf-8
|
||||
|
||||
if &cp || exists('g:loaded_tagbar')
|
||||
finish
|
||||
|
@ -28,49 +26,6 @@ endif
|
|||
|
||||
" Basic init {{{1
|
||||
|
||||
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'
|
||||
elseif executable('exuberant-ctags')
|
||||
let g:tagbar_ctags_bin = 'exuberant-ctags'
|
||||
elseif executable('exctags')
|
||||
let g:tagbar_ctags_bin = 'exctags'
|
||||
elseif executable('ctags')
|
||||
let g:tagbar_ctags_bin = 'ctags'
|
||||
elseif executable('ctags.exe')
|
||||
let g:tagbar_ctags_bin = 'ctags.exe'
|
||||
elseif executable('tags')
|
||||
let g:tagbar_ctags_bin = 'tags'
|
||||
else
|
||||
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
|
||||
|
||||
redir => s:ftype_out
|
||||
silent filetype
|
||||
redir END
|
||||
if s:ftype_out !~# 'detection:ON'
|
||||
echomsg 'Tagbar: Filetype detection is turned off, skipping plugin'
|
||||
unlet s:ftype_out
|
||||
finish
|
||||
endif
|
||||
unlet s:ftype_out
|
||||
|
||||
let g:loaded_tagbar = 1
|
||||
|
||||
if !exists('g:tagbar_left')
|
||||
let g:tagbar_left = 0
|
||||
endif
|
||||
|
@ -119,7 +74,10 @@ if !exists('g:tagbar_systemenc')
|
|||
let g:tagbar_systemenc = &encoding
|
||||
endif
|
||||
|
||||
autocmd SessionLoadPost * nested call tagbar#RestoreSession()
|
||||
augroup TagbarSession
|
||||
autocmd!
|
||||
autocmd SessionLoadPost * nested call tagbar#RestoreSession()
|
||||
augroup END
|
||||
|
||||
" Commands {{{1
|
||||
command! -nargs=0 TagbarToggle call tagbar#ToggleWindow()
|
||||
|
@ -130,4 +88,4 @@ 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
|
||||
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1
|
||||
|
|
|
@ -5,9 +5,7 @@
|
|||
" Website: http://majutsushi.github.com/tagbar/
|
||||
" Version: 2.1
|
||||
|
||||
if has('multi_byte')
|
||||
scriptencoding utf-8
|
||||
endif
|
||||
scriptencoding utf-8
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
|
@ -62,3 +60,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
|
||||
|
|
Loading…
Reference in New Issue
Block a user