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

Add convenience function for automatically opening Tagbar

This commit is contained in:
Jan Larres
2011-12-21 19:28:34 +13:00
parent a93bd87715
commit 9a2cf9756f
2 changed files with 74 additions and 13 deletions

View File

@@ -536,19 +536,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.
==============================================================================