Permalink
Browse files

Create temporary fix for Tagbar segment

This update adds a wrapper function that checks if Tagbar is loaded
before trying to call `tagbar#currenttag()`. Unfortunately this only
works *after* Tagbar has been opened, so the Tagbar/current tag segment
will be empty until Tagbar has been opened for the first time.

Refs #152.
Refs majutsushi/tagbar#77.
  • Loading branch information...
Lokaltog authored and mhinton committed Jun 22, 2012
1 parent 3d031d1 commit 99ffaf03cdb028ca9aa564725a23337a1837af5c
Showing with 11 additions and 0 deletions.
  1. +11 −0 autoload/Powerline/Functions/tagbar.vim
@@ -0,0 +1,11 @@
+function! Powerline#Functions#tagbar#GetTag() " {{{
+ " Wrapper function that checks if Tagbar is loaded to avoid errors when
+ " Tagbar is loaded after Powerline
+ let ret = ''
+
+ if exists('g:loaded_tagbar') && g:loaded_tagbar == 1
+ let ret = tagbar#currenttag('%s', '')
+ endif
+
+ return ret
+endfunction " }}}

0 comments on commit 99ffaf0

Please sign in to comment.