I'm configuring my scripts to work with terminal in VIM and have a question regarding
:h special-buffers. Among mentioned kinds there were the following:
unlisted The buffer is not in the buffer list. It is not used for
normal editing, but to show a help file, remember a file name
or marks. The ":bdelete" command will also set this option,
thus it doesn't completely delete the buffer. Settings: >
terminal A terminal window buffer, see |terminal|. The contents cannot
be read or changed until the job ends.
Currently I create a terminal buffer with the function
execute "terminal ++hidden"
then stores the
bufnr of the terminal and use it throughout the session.
The problem is when switching between buffers containing code to be displayed in some window with
:bnext it sometimes displays the terminal in the window. This is because the terminal appears in the buffer list:
So I considered making this buffer with
:setlocal nobuflisted, but it looks hacky since now the terminal buffer has two kinds:
unlisted as I show above.
What is the preferred way to achieve switching between buffers corresponding to regular opened files?