diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index 13e450c..d835ee9 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -1756,14 +1756,25 @@ function! s:InitWindow(autoclose) abort setlocal nobuflisted setlocal nomodifiable setlocal nolist - setlocal nonumber setlocal nowrap setlocal winfixwidth setlocal textwidth=0 setlocal nospell - if exists('+relativenumber') - setlocal norelativenumber + if g:tagbar_show_linenumbers == 0 + setlocal nonumber + if exists('+relativenumber') + setlocal norelativenumber + endif + elseif g:tagbar_show_linenumbers == 1 + setlocal number + elseif g:tagbar_show_linenumbers == 2 + setlocal relativenumber + else + set number< + if exists('+relativenumber') + set relativenumber< + endif endif setlocal nofoldenable diff --git a/doc/tagbar.txt b/doc/tagbar.txt index dd8455c..aa4605f 100644 --- a/doc/tagbar.txt +++ b/doc/tagbar.txt @@ -470,6 +470,23 @@ Example: let g:tagbar_show_visibility = 0 < + *g:tagbar_show_linenumbers* +g:tagbar_show_linenumbers~ +Default: 0 + +Whether line numbers should be shown in the Tagbar window. + +Possible values are: + 0: Don't show any line numbers. + 1: Show absolute line numbers. + 2: Show relative line numbers. + -1: Use the global line number settings. + +Example: +> + let g:tagbar_show_linenumbers = 2 +< + *g:tagbar_expand* g:tagbar_expand~ Default: 0 diff --git a/plugin/tagbar.vim b/plugin/tagbar.vim index 84dd078..f05a0b9 100644 --- a/plugin/tagbar.vim +++ b/plugin/tagbar.vim @@ -58,6 +58,7 @@ let s:options = [ \ ['indent', 2], \ ['left', 0], \ ['show_visibility', 1], + \ ['show_linenumbers', 0], \ ['singleclick', 0], \ ['sort', 1], \ ['systemenc', &encoding],