1
0
mirror of https://github.com/gryf/tagbar.git synced 2025-12-17 11:30:28 +01:00

move basic init & autocmd back to plugin/

This commit is contained in:
Kien N
2011-07-03 16:14:56 +07:00
parent 49ad69c41a
commit 4920be4438
2 changed files with 101 additions and 95 deletions

View File

@@ -22,97 +22,6 @@
" 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
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_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_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,8 +45,6 @@ let s:access_symbols = {
\ 'private' : '-'
\ }
autocmd SessionLoadPost * nested call s:RestoreSession()
" s:InitTypes() {{{2
function! s:InitTypes()
let s:known_types = {}
@@ -2862,13 +2769,17 @@ function! tagbar#CloseWindow()
call s:CloseWindow()
endfunction
function! tagbar#SetFoldLevel()
call s:SetFoldLevel(<args>)
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

View File

@@ -26,6 +26,101 @@ if &cp || exists('g:loaded_tagbar')
finish
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
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_systemenc')
let g:tagbar_systemenc = &encoding
endif
autocmd SessionLoadPost * nested call tagbar#RestoreSession()
" Commands {{{1
command! -nargs=0 TagbarToggle call tagbar#ToggleWindow()
command! -nargs=0 TagbarOpen call tagbar#OpenWindow(0)