ap / vim-buftabline

Forget Vim tabs – now you can have buffer tabs
http://www.vim.org/scripts/script.php?script_id=5057
MIT License
782 stars 75 forks source link

Don't show vim terminal as buffer tab #83

Closed uestueab closed 2 years ago

uestueab commented 2 years ago

When i open a vim terminal it shows up as a tab. Is it possible to disable that?

ap commented 2 years ago

There is no code to do that but it wouldn’t be hard to implement. But… how does the UX for that work? Do you just keep in the back of your mind that one or more terminal buffers are floating around?

uestueab commented 2 years ago

I ended up doing this: autocmd BufLeave * if &buftype=="terminal" | setlocal nobuflisted | endif

ap commented 2 years ago

Indeed, it’s not hard to implement, one way or another, as I said. I’m just curious about what kind of workflow this makes sense in.

uestueab commented 2 years ago

I have a workflow that opens a terminal, and switches between editor window and terminal window with just one keypress. The code for that is:

fun! TabTogTerm()
    let l:OpenTerm = {x -> x
                \  ? { -> execute('botright 20 split +term') }
                \  : { -> execute('botright term ++rows=20') }
                \ }(has('nvim'))
    let term = gettabvar(tabpagenr(), 'term',
                \ {'main': -1, 'winnr': -1, 'bufnr': -1})
    if ! bufexists(term.bufnr)
        call l:OpenTerm()
        call settabvar(tabpagenr(), 'term',
                    \ {'main': winnr('#'), 'winnr': winnr(), 'bufnr': bufnr()})
        exe 'tnoremap <buffer> <leader>t <cmd>' . t:term.main . ' wincmd w<cr>'
        exe 'tnoremap <buffer> <c-d>     <cmd>wincmd c<cr>'
        setl winheight=15
    else
        if ! len(filter(tabpagebuflist(), {_,x -> x == term.bufnr}))
            exe 'botright 15 split +b\ ' . term.bufnr
        else
            exe term.winnr . ' wincmd w'
        endif
    endif
endfun

I like my buffer tabs to be only files i'm working on. Since the terminal can coexist with the tabs i see no point in having a terminal buffer tab which unnecessarily takes up space. Also its a little annoying when jumping buffers, even with fzf.

ap commented 2 years ago

Neat. I don’t do things for which this would be useful but I can imagine how it could be nice.

Also its a little annoying when jumping buffers, even with fzf.

Yeah, then unsetting buflisted is the best solution. That will make lots of other things behave more usefully for you, not just Buftabline.

Should I consider this issue resolved then?