# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)

try:
	import vim
except ImportError:
	vim = object()

from powerline.segments.vim import window_cached


@window_cached
def current_tag(pl, flags='s'):
	'''Return tag that is near the cursor.

	:param str flags:
		Specifies additional properties of the displayed tag.  
		Supported values:

		* s - display complete signature
		* f - display the full hierarchy of the tag
		* p - display the raw prototype

		More info at `official doc
		<https://github.com/majutsushi/tagbar/blob/master/doc/tagbar.txt>`_
		(search for 'tagbar#currenttag').
	'''
	if not int(vim.eval('exists(":Tagbar")')):
		return
	return vim.eval('tagbar#currenttag("%s", "", "{0}")'.format(flags))

@@ -381,12 +381,8 @@
 ag. 
- %0A%09%09
 Supp
@@ -395,16 +395,16 @@
 values:%0A
+
 %0A%09%09* s -
@@ -524,18 +524,22 @@
 re info 
-at
+in the
  %60offici
@@ -548,12 +548,91 @@
  doc
-%0A%09%09%3C
+umentation%60_ (search for %0A%09%09%E2%80%9Ctagbar#currenttag%E2%80%9D).%0A%0A%09%09.. _%60official documentation%60: 
 http
@@ -694,47 +694,8 @@
 .txt
-%3E%60_%0A%09%09(search for 'tagbar#currenttag').
 %0A%09''

Improve documentation