kassio/neoterm

Option to ignore neoterm buffers in the buffer list

Closed this issue · 4 comments

Is your feature request related to a problem? Please describe.
When switching buffers (using :bn and :bp) neoterm buffers are listed as well.

Describe the solution you'd like
An option to ignore neoterm buffers in the bufferlist or a way to identify neoterm buffer so that they can be excluded in a custom PrevBuffer or NextBuffer function.

Describe alternatives you've considered
I already tried something like:

function! PrevBufferTab()
  bprev
  if &buftype == 'terminal'
    bprev
  endif
endfunction
function! NextBufferTab()
  bnext
  if &buftype == 'terminal'
    bnext
  endif
endfunction

but this will only work if there is just one terminal open. On more then one the workaround does not work.

Thanks for the great plugin!

BTW, if you are using airline, you can use

nmap <leader>j <Plug>AirlineSelectPrevTab
nmap <leader>k <Plug>AirlineSelectNextTab

It ignores terminal buffers by default.

Thanks for the hint, that actually works but for some reason AirlineSelectPrevTab switches to "search mode" after one second or so, but this might be an airline bug (or some incompatible settings in my vimrc).

So, I think this is already solved with the Airline functions, right? Gonna close it, if you need anything else, please re-open this issue.

I found this issue searching for a similar request, posting my solution for posterity. I prefer my neoterm buffers to not be saved by session or scrolled to by bnext/in the buffer list.
The correct solution is to delist them.
lua vim.api.nvim_create_autocmd("FileType", {pattern="neoterm", command="setlocal nobuflisted"})