diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index ca0fdd0..5736eb7 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -954,10 +954,19 @@ function! s:InitWindow(autoclose) abort " Window-local options setlocal nolist - setlocal nowrap setlocal winfixwidth setlocal nospell + if g:tagbar_wrap == 0 + setlocal nowrap + else + setlocal wrap + if exists('+linebreak') + setlocal breakindent + setlocal breakindentopt=shift:4 + endif + endif + if g:tagbar_show_linenumbers == 0 setlocal nonumber if exists('+relativenumber') diff --git a/doc/tagbar.txt b/doc/tagbar.txt index 757c9f3..8ace2d5 100644 --- a/doc/tagbar.txt +++ b/doc/tagbar.txt @@ -882,6 +882,22 @@ Example: > let g:tagbar_use_cache = 0 < + *g:tagbar_wrap* +g:tagbar_wrap~ +Default: 0 + +If set to non-zero, this will enable line wrapping on the tagbar window. This +option will use the built-in |wrap| vim option on the tagbar window to +enable line wrapping. This also will use the |breakindent| and +|breakindentopt| options in vim to set the indentation of the wrapped lines. + +Note: This requires VIM to be compiled with the |+linebreak| option for the +wrap intentation to function. + +Example: +> + let g:tagbar_wrap = 1 +> ------------------------------------------------------------------------------ HIGHLIGHT COLOURS *tagbar-highlight* diff --git a/plugin/tagbar.vim b/plugin/tagbar.vim index 7fb69a3..58d53a8 100644 --- a/plugin/tagbar.vim +++ b/plugin/tagbar.vim @@ -109,6 +109,7 @@ function! s:setup_options() abort \ ['zoomwidth', 1], \ ['silent', 0], \ ['use_cache', 1], + \ ['wrap', 0], \ ] for [opt, val] in options