Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot toggle Tagbar when using netrw #291

Closed
gavinchou opened this issue Sep 19, 2015 · 5 comments
Closed

cannot toggle Tagbar when using netrw #291

gavinchou opened this issue Sep 19, 2015 · 5 comments

Comments

@gavinchou
Copy link

when using netrw to browse a direcotry:

vim /some/path/of/directory

or, in vim

:e /some/path/of/directory

and then open a file and toggle tagbar with

:Tagbar

then, tagbar wont work, tagbar flashes and quits
the problem occurs in the following function (autoload/tagbar.vim),
call s:goto_win(tagbarwinnr, 1)

" s:QuitIfOnlyWindow() {{{2
function! s:QuitIfOnlyWindow() abort
    let tagbarwinnr = bufwinnr('__Tagbar__')
    if tagbarwinnr == -1
        return
    endif

    let curwinnr = winnr()
    let prevwinnr = winnr('#') == 0 ? curwinnr : winnr('#')
    call s:goto_win(tagbarwinnr, 1)

i (temporally) fix it by modifying this function,

" s:QuitIfOnlyWindow() {{{2
function! s:QuitIfOnlyWindow() abort
   if bufwinnr('__Tagbar__') == winnr() && tabpagewinnr(tabpagenr(), '$') == 1
        exe "q"
    endif
    return
endfunc

it seems i fixed, maybe there is a better way?

ps. it seems the logic of the original script is fine, but somehow it is not, lets fix it!

@symbolix
Copy link

symbolix commented Apr 3, 2016

I am also experiencing issues related to loading files through the netrw. Once I select the file to be loaded or switched to, I get the following error:

Error detected while processing function <SNR>102_QuitIfOnlyWindow[28]..<SNR>102_goto_win:
line    8:
E16: Invalid range: 2wincmd w

Is it possible to fix this? I am using VIM 7.4.1553 with netrw v155. netrw is a core component of VIM. This plugin should be compatible with VIM's native file browser.

@qwIvan
Copy link

qwIvan commented Jul 20, 2016

+1

1 similar comment
@ggaaooppeenngg
Copy link

+1

@SoPudge
Copy link

SoPudge commented Sep 17, 2016

i have the same problem

@majutsushi
Copy link
Collaborator

I think this should be fixed now. Sorry for the long delay.
If there's still a problem please reopen this issue.

dev-hann added a commit to dev-hann/tagbar that referenced this issue Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants