jeetsukumaran / vim-buffergator

Vim plugin to list, select and switch between buffers.
498 stars 49 forks source link

Buffergator in 'n'/'N' and second buffer #15

Closed naquad closed 10 years ago

naquad commented 12 years ago

Hi.

Whenever I have 2 buffers in two windows and try to open another buffer via buffergator in 'N'/'n' mode another window is closed :( Doing same in any other mode (with buffergator in split window) doesn't show such issues. Could you please take a look at the issue?

Buffergator: master HEAD VIM: 7.3.600

ghost commented 10 years ago

I had the same problem and I fixed it with the following change in autoload/buffergator.vim:

function! l:catalog_viewer.visit_target(keep_catalog, refocus_catalog, split_cmd) dict range
    let l:jump_to_bufnum = self.get_target_bufnum(v:count)
    if l:jump_to_bufnum == -1
        return 0
    endif
    let l:cur_tab_num = tabpagenr()
    " Fix window close issue when not splitting
    " if !a:keep_catalog
    if (self.split_mode != "buffer" || !empty(a:split_cmd)) && !a:keep_catalog
        call self.close(0)
    endif            
    call self.visit_buffer(l:jump_to_bufnum, a:split_cmd)
    if a:keep_catalog && a:refocus_catalog
        execute("tabnext " . l:cur_tab_num)
        execute(bufwinnr(self.bufnum) . "wincmd w")
    endif
    call s:_buffergator_messenger.send_info(expand(bufname(l:jump_to_bufnum)))
endfunction
jeetsukumaran commented 10 years ago

Thanks. Fixed in latest revision.