preservim / tagbar

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

is there a possibility to change the statusline look? #713

Closed joe23rep closed 3 years ago

joe23rep commented 3 years ago

went threw the help file and found all highlight things i can change but i havent found a way to change the statusbar itself.

im using lightline- is there a way to change what gets displayed and maybe have different bg colors and seperators?

raven42 commented 3 years ago

To integrate with lightline, you will need to update your lightline configuration. I use lightline as well and here is the corresponding section from my .vimrc

    let g:lightline = {
                \ 'active': {
                \   'left': [['mode', 'paste', 'modified'], ['readonly', 'filename'], ['functionName']],
                \   'right': [['lineinfo'], ['percent'], ['fileformat', 'fileencoding', 'filetype']]
                \ },
                                ...
                                \ 'component_function': {
                                ...
                                \   'functionName': 'LightlineFunctionName',
                \ },

    " ---- LightlineFunctionName() {{{2
    function! LightlineFunctionName()
        if !g:have_tagbar || &filetype =~# g:ignored_windows
            return ''
        endif
        return tagbar#currenttag("%s", "", 'f', 'nearest-stl')
    endfunction

Note: The g:have_tagbar and g:ignored_windows variables are specific to my vim implementation and aren't used by either lightline or tagbar. So you can probably leave that bit out.

So this way I can just use the tagbar#currenttag() routine directly and populate the value with that. This is what it looks like for me: image

Note: The cursor was inside of the 'LighlineFunctionName()' routine at the time of this screenshot

If you want to get different colors or separators, that would be part of the lightline configuration again. I have it as a separate part of the lightline so it shows the appropriate separator. This is done by creating the separate lightline 'group' in the 'left' section that only contains the ['functionName'] component.