Skip to main content
16 votes
Accepted

Duplicate buffer into new tab instead of moving it

I'm not sure but you could try :tab split (or the shorter version :tab sp). The :split command should duplicate the viewport displaying a.txt, while the :tab modifier should move this viewport into a ...
user9433424's user avatar
  • 6,198
13 votes

Open multiple files in tabs from Explore mode

From :h netrw-t: BROWSING WITH A NEW TAB netrw-t Normally one enters a file or directory using the <cr>. The "t" map allows one to open a new window holding the new directory ...
statox's user avatar
  • 50.6k
11 votes
Accepted

Is it possible to open a tab in a window and not a window in a tab?

From :h tab-page-intro: A tab page holds one or more windows. You can easily switch between tab pages, so that you have several collections of windows to work on different things. Usually ...
statox's user avatar
  • 50.6k
7 votes
Accepted

Is there a way to move n tabs forward?

As far as I'm aware, there is no default way to do this. I looked into the ex command tabnext, which accepts a count, but functions exactly the same as gt (that is, it moves to tab page {count}, not {...
DJMcMayhem's user avatar
  • 17.9k
7 votes

Is it possible to open a tab in a window and not a window in a tab?

No you can't, here's why: Vim use multiple concepts to handle text files: Buffer: An in-memory version of a file. Editing a file will in fact edit the buffer before writing (i.e. saving) anything to ...
nobe4's user avatar
  • 16.3k
7 votes
Accepted

How can I make sure all buffers end up as tab or force remaining buffers into tabs?

The documentation for this feature can be found at :help -p: Open N tab pages. If [N] is not given, one tab page is opened for every file given as argument. The maximum is set with 'tabpagemax' ...
Rich's user avatar
  • 32.6k
6 votes

Limit buffer list to current tab

The following code will give you the file names for the current tab (if the buffer in a window is connected to a file): " Get the buffer numbers of all windows on the current tab let buffers = ...
Jürgen Krämer's user avatar
6 votes
Accepted

How to create a new tab or window from a buffer?

Create a new window from a buffer: :sb<N>(horizontally) or :vert sb<N>(vertically). Create a new tab from a buffer: :tab sb<N> or create a new window and then press <C-W&...
sdp's user avatar
  • 491
6 votes
Accepted

Cannot switch tabs when in terminal tab

(This answer pertains to neovim specifically. If you find anything conflicting with vim, let me know and I'll edit the answer.) :h term operates in a separate mode: the terminal model. It's somewhat ...
3N4N's user avatar
  • 5,934
5 votes

Move existing window to existing tab

The two commands defined below move all buffers from the right hand tab to the current tab and then close the right hand tab. Mtabsp moves them by splitting horizontally and Mtabvsp splits vertically. ...
evpo's user avatar
  • 151
5 votes

How to change color of tabs in the tab-bar in gvim?

You can remove the e flag from the 'guioptions' option, this way the tab line matches the general colorscheme. set guioptions-=e Then use the :highlight command's GUI options, e.g.: hi TabLine guifg=#...
Alvaro9366's user avatar
5 votes

Navigate to tag in a new tab if not already opened, like `tab drop`?

Put this in your vimrc: map <C-]> :TabExpand 1<CR> command -nargs=1 TabExpand call HandleTabTagExpand( <f-args> ) let s:commentchar = """ function HandleTabTagExpand(tagnumber) ...
Tim's user avatar
  • 436
5 votes

Retitling tab labels

You can use the 'tabline' setting for this. Here's an example adapted from :help setting-tabline: set tabline=%!MyTabLine() " Set the entire tabline function! MyTabLine() let s = '' for i in ...
Martin Tournoij's user avatar
5 votes
Accepted

How to not close MacVim after the last tab is closed?

You seem to be looking for MacVim Preferences, and they are under the MenuBar entitled "MacVim". MacVim -> Preferences -> General There you'll find settings for what to do on startup, and after the ...
jubilatious1's user avatar
5 votes

How to create a new tab or window from a buffer?

While editing command line a "special" #n (see :h cmdline-special) is replaced with the n-th buffer name. Hence, all of the following work in Vim (:h 42): :edit #42 :split #42 :tabedit #42 And so on....
Matt's user avatar
  • 21.6k
5 votes

How to return from tab page mode to the normal one?

You can use the :tabonly command, to close all other tabpages at once. Note: technically you will still have a single tabpage open, even if the tablabel does not show up.
Christian Brabandt's user avatar
4 votes
Accepted

Open multiple files in tabs from Explore mode

Let's Vim do it for you. You can put the following code at the end of your vimrc file: function! NetrwOpenMultiTab(current_line,...) range " Get the number of lines. let n_lines = a:lastline -...
Jair López's user avatar
  • 1,854
4 votes
Accepted

Rather than tabnext and tabprevious can I get a list of tabs and select the one to switch to?

To expand on @Tumbler41's comment about :tabs, it shows you a list of tabs like :ls shows you buffers. But, there isn't a command to go directly to a tab from this list like using :b after :ls. You ...
Tommy A's user avatar
  • 6,810
4 votes
Accepted

`gt` is not consistent with `gT` (and many other commands) when `{count}` is prepended

I can't really explain why it works like this, my best guess is that you more often need to go a tab by its index rather than going 3 tabs forwards. However, if you really don't like how Vim works and ...
statox's user avatar
  • 50.6k
4 votes
Accepted

Shell running inside vim windows

You need Vim 8.1, then you can use the following command: :below terminal ++rows=10 Normally a terminal is opened above the current window, but with below it is opened at the bottom. And in this ...
Ralf's user avatar
  • 9,417
4 votes
Accepted

Why are split and tab navigations distinct?

Tab navigation is one dimensional, so it has commands which mirror similar commands, :bn, :cp, etc. Window navigation is two dimensional, so it has commands that align with the two dimensional normal ...
Rich's user avatar
  • 32.6k
4 votes
Accepted

What is the X that appears on the top right corner when multiple tabs are open?

Allows you to close a tab with a mouse. (You'll probably need to enable mouse support enabled)
110100100's user avatar
4 votes

How to achieve a vertical split with tabs on left?

Each tab takes the full screen. But each tab can be split in Windows both vertically and horizontally using the commands: :vsplit :split To achieve the layout you want I would use one tab and three ...
Vivian De Smedt's user avatar
3 votes
Accepted

Print full filename in tabs when using terminal Vim

For the terminal, you want to check the 'tabline' option. For the gui version, check the 'guitablabel' setting. Since you seem to be using a terminal vim, here is what I would do: The help page for '...
Christian Brabandt's user avatar
3 votes
Accepted

Empty first tab lost when using sessions

This is indeed a bug in Vim. I filed a GitHub issue, and someone on the vim-dev mailing list addressed it. Here's a patch that fixes it in Vim 8.0.52: diff --git a/src/ex_docmd.c b/src/ex_docmd.c ...
Jim Stewart's user avatar
3 votes
Accepted

How to change color of tabs in the tab-bar in gvim?

The colors of the tabs follow the general color scheme configured on your system. The tabs should look similar to tabs in other programs. Try changing the GTK theme on your system, for example using ...
Marijn van Vliet's user avatar
3 votes

Duplicate buffer into new tab instead of moving it

I've mostly been avoiding tabs because of this problem, but now I have a function that has the tab duplication behavior I want. I've tested it, but haven't started using it in earnest. There may be ...
Greg Nisbet's user avatar
  • 1,899
3 votes

Move existing window to existing tab

If it's a file buffer (won't work for scratch buffers etc.), you can: :let @f=@%ENTER — in the source window; This replaces contents of regular register f with contents of special register %, ...
akavel's user avatar
  • 131
3 votes
Accepted

How can I make Neovim return to the tab that was active before running `:Git diff`?

This patch on fugitive fixes this issue (and here's the PR). It looks like I was running an old version of fugitive. Upgrading to the latest fugitive fixed this issue for me.
nelstrom's user avatar
  • 289
3 votes
Accepted

Open new file as tab on current vim instance through double-click

You could try the command gvim --remote-tab-silent %F. Thunar should substitute %F with the paths of all selected files. --remote-tab-silent is a variant of --remote. For more info about it, see :h --...
user852573's user avatar
  • 1,023

Only top scored, non community-wiki answers of a minimum length are eligible