preservim / tagbar

Vim plugin that displays tags in a window, ordered by scope
https://preservim.github.io/tagbar
Other
6.1k stars 485 forks source link

Weird "[Order]" string #796

Closed sicr0 closed 2 years ago

sicr0 commented 2 years ago

I have this function to make some filenames prettier. For some reason when Tagbar is open and I'm on the file editing it appears this weird string in the filename. Anybody knows from where it comes from so that I can fix it?

  function! LightlineFilename()
    return expand('%:t') =~# '__Tagbar__' ? ' ' : '' .
      \ expand('%:t') =~# 'NERD_tree' ? ' ' : '' .
      \ (strlen(&filetype) ? WebDevIconsGetFileTypeSymbol() . ' ' : '') .
      \ (expand('%:t') != '' ? expand('%:t') : '[No name]') .
      \ (&readonly ? '  ' : '') .
      \ (getbufvar(bufnr('%'), '&mod') ? '  ' : '')
  endfunction

This is the icon that substitutes the "__Tagbar__.1" filename (bottom right) when the cursor is on NerdTree, and it behaves as intended: Screenshot_20211028_154155

This is when the cursor is on the file open, now on Tagbar appears "[Order] .vimrc": Screenshot_20211028_154158

raven42 commented 2 years ago

By default, tagbar has a status line output that will override the default (or in this case the lightline config). This will update the status line of the tagbar window when the cursor is in the file buffer. The [Order] is coming from the g:tagbar_sort configuration. The tagbar status line shows the sort method, so it would be either [Order] or [Name] depending on that configuration.

To disable the tagbar status line, you can use this so it always uses the lightline definition.

let g:tagbar_no_status_line = 1
sicr0 commented 2 years ago

Thanks for the help!