1

I have opened few files in tab

  vim -p file1 file2 file3

When i have opened a tab contains file1, I open a terminal

:botright terminal

But this terminal is only available for file1 . when I open other tabs file2 and file 3 , the terminal is not shown under. Is there a way to show a terminal under all tabs? (like vscode where terminal is static and we can move between tabs)

2 Answers 2

1

Sadly, no, it is not possible.

If you look at :help windows-intro, the following (among other) is said:

   A buffer is the in-memory text of a file.                                                                                                                                                                       
   A window is a viewport on a buffer.                                                                                                                                                                             
   A tab page is a collection of windows.

There is some hierarchy here between the windows and tabs.

So, to take your view, which (I think) looks like that:

enter image description here

The terminal is in a window and it belongs to the first tab (where foo is currently open).

So having the terminal being independent of the tabs would mean to have a window independent of the tabs, which goes against the above hierarchy.

1
  • Of course, you can open a terminal in each tab, but these would be different terminals, not a single one.
    – padawin
    Nov 10, 2020 at 8:05
3

Is there a reason you open each file in a different tab with -p? The standard way to open multiple files is to open them in different buffers. See this answer for more about buffers vs windows vs tabs.

You can cycle through the buffer displayed in the top window with :bnext and similar. The workflow I would suggest to achieve what you want would be something like:

  1. Open the files you want with vim file1 file2 file3

  2. Open a new terminal below with :terminal

  3. After doing what you want in the terminal, switch to the top window with Ctrl-W k

  4. Make some edits, cycle to the next file with :bnext etc whilst keeping the terminal visible below.

2
  • I can visually see what are all the files are opened if opened in tab. Also i can use {n}gt to go to tab easier. it is more intuitive than buffer for me. Nov 7, 2020 at 16:16
  • 1
    Tab pages are not designed for what you describe (the name "tab pages" can often be a source of confusion; they are best regarded as "preset views"). There are many plugins that can show a list of buffers if you find that useful e.g. vim-bufferline and lightline-bufferline Nov 7, 2020 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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