106
votes
Accepted
Open filename under cursor like gf, but in a new tab (or split)?
EDIT: Suggest nicely symmetric mappings for the vertical split case, since Vim by default has two mappings for the horizontal split case.
There are several ways to edit the "file under cursor", and ...
33
votes
How do you open a new buffer in the current window?
The answer is to use :ene[w]
Hah I should have looked at the help before!
My first instinct was to try :e without any arguments.
I looked at the help for this and a bit further down is
:ene[w] ...
23
votes
Accepted
How do I reorder open tabs?
You can use the tabmove command. (:help tabmove will tell you all you need to know)
The command takes two kind of parameters:
A sign (+ or -) followed by a number:
:tabmove +2 will move your tab of ...
17
votes
What is the difference between a tab, viewport, window, split and buffer?
A buffer is the in-memory text of a file. It may differ from the saved version of the file.
A window is a view of a buffer. You can have two (or more) windows editing different parts of the same ...
16
votes
Accepted
Move existing window to existing tab
Though there are commands to move existing windows around in the current tab page (i.e. affect the window layout by rotating, resizing, and moving), there are no commands to move a window to another ...
15
votes
What can I do with more tabs than fit in one (airline) tab-line?
This is an inherent issue with the tab metaphor and every solution introduces more problems:
multiple lines are harder to parse and take up too much space,
tab groups make it impossible to see what's ...
14
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 ...
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 ...
12
votes
Accepted
How can I open multiple tabs at once?
Given the problems & complexity in my other answer using the "built-in" way by modifying the argument list, I've added by own small function to do this:
" Open multiple tabs at once
fun! ...
12
votes
How can I open multiple tabs at once?
As far as I know, the only built-in way to do this is:
:args *.vim
:tab all
First, the :args will replace the argument list. The argument list lists the files you opened Vim with; so vim file1 file2 ...
12
votes
Accepted
how to close tab and remove this file from buffers
:bd will do that.
From the documentation:
:[N]bd[elete][!] *:bd* *:bdel* *:bdelete* *E516*
:bd[elete][!] [N]
Unload buffer [N] (default: current buffer) and delete it from
...
11
votes
Open filename under cursor like gf, but in a new tab (or split)?
You can use bindings for this:
opening in a new window (split):
nnoremap gf <C-W>f
vnoremap gf <C-W>f
opening in a new tab:
nnoremap gf <C-W>gf
vnoremap gf <C-W>gf
also you ...
11
votes
How can I open a buffer in a new tab leaving the current window and buffer intact?
:tab split will create a new tab displaying the current buffer, since :tab modifies any command that would normally create a split to instead create a tab page.
If you want to override <C-w>T ...
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 ...
9
votes
How to bind a set of buffers to a tab?
Mhh, i did not find any plugin out there, but you could write it yourself. You need to learn vimscript for this. I just implemented the functionality that you can switch between buffers in a tab (no ...
8
votes
Moving a visual range to a new tabpage?
Persisted
If you intend to persist the selected lines under a new filename (and it's complete lines), you can do:
:'<,'>w new-name | '<,'>delete _ | tabedit #
The '<,'> range is ...
8
votes
Accepted
How do I make opening new tabs the default?
After some experimentation I've found this to be the best way; it should behave the same as vim -p:
augroup open-tabs
au!
au VimEnter * ++nested if !&diff | tab all | tabfirst | endif
...
8
votes
Accepted
How do I open a file to view in a new tab?
:tab <cmd> opens a tab where a <cmd> would have opened a window. :view doesn't open a window, so :tab view doesn't open a tab :-) See :help :tab.
However, we also have the :sview command, ...
8
votes
Reopen the most recently closed buffer
You can try CTRL-O, this will go to last cursor posision in jump list, even for closed buffers. This will even work from fresh vim instance, so you can open last file with that.
8
votes
Accepted
Reopen the most recently closed buffer
I played around with this a bit and the following seems to work for the cases I tested, including closing a window split and a tab with one window using :q.
augroup bufclosetrack
au!
autocmd ...
8
votes
Accepted
Spread already open files into split view
Here are a bunch of helpful commands for you:
To open every buffer in a horizontal split:
:sball
To open every buffer in a vertical split:
:vert sball
You can do the same thing with tabs, e.g, to ...
7
votes
How can I open a buffer in a new tab leaving the current window and buffer intact?
After some research I found a solution.
If you are focused on the buffer/window:
:tabe %
This opens the current buffer in new tab and leaves the current window intact.
why does it leave the old ...
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 ...
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 {...
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' ...
6
votes
What can I do with more tabs than fit in one (airline) tab-line?
Vim provides 3 concepts for working with multiple files:
Buffers: one for each file you've opened.
Windows/Splits: view multiple things at the same time.
Tabs: For multiple sets of windows. Useful ...
6
votes
Accepted
Duplicate tab with windows
You can use :mksession with a specialized 'sessionoptions' to make this easier.
:set sessionoptions=blank,help,folds,winsize,localoptions
:mksession
:tabnew
:source Session.vim
Using this technique ...
6
votes
How to bind a set of buffers to a tab?
Buffers are global and there's nothing you can do about that except writing your own abstraction layer on top of tab pages, windows and buffers. philolo1's answer shows a reasonable approach to the ...
6
votes
Accepted
How do I open multiple files from find each in a separate tab in vim?
vim -p `find . -name '*.txt'`
Putting the find command between backticks executes find before running the full command and the results replace what's between the backticks. So before running the ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
tabbed-user-interface × 103vim-windows × 17
buffers × 16
split × 9
multiple-files × 8
vimrc × 6
key-bindings × 6
neovim × 5
command-line × 5
gvim × 5
macvim × 5
autocmd × 3
plugin-nerdtree × 3
invocation × 3
vimscript × 2
terminal × 2
colorscheme × 2
terminal-buffer × 2
navigation × 2
window-management × 2
load × 2
autocompletion × 1
external-command × 1
folding × 1
filetype × 1