0

My problem is similar to, if not same as, this issues. But I can't follow what they're talking about.

The following steps are necessary to reproduce my problems:

:sp
:term
:wincmd w
:wincmd o
:ls

And you'll see that the terminal buffer has disappeared. Any idea why it happens and how to keep the terminal buffer present/alive in the buffer list even after it has been hidden?

Edit I know about :set hidden. But I don't like how it hides buffers yet to be written to disks. I want to use autocmd to modify the neovim terminal buffer so that it can't be hidden at all.

1

Put the following in ~/.config/nvim/init.vim:

augroup custom_term
    autocmd!
    autocmd TermOpen * setlocal bufhidden=hide
augroup END

I don't know if it's enough, but it is working for now. Check the part with bufhidden=hide, this makes only the terminal buffer hidden when not loaded on any split/window. I don't know if I have to change any other options like :h buflisted or :h buftype and thus leaving this post open for anyone to comment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.