Questions tagged [buffers]

The representation of a file loaded into memory. Edits are performed on buffers.

This tag is for questions about interacting with Vim's buffers.

From :help windows-intro

A buffer is the in-memory text of a file

...

A buffer is a file loaded into memory for editing. The original file remains unchanged until you write the buffer to the file.

For questions about Vim windows (the "viewport" onto a buffer) see .

Buffers and windows are coupled topics. For more information about both, see :help windows.txt

434 questions
25
votes
2 answers

A built-in way to make Vim open a new buffer with file?

Is there a built-in way to make Vim open a new buffer with file? I want open a file. :enew doesn't take any arguments and opens a blank buffer. :edit closes my existing buffer. Related (about :enew): How do I open a new buffer without opening it…
user4779
17
votes
1 answer

What bad things can happen if I use :bwipeout?

I have just discovered the :bwipeout command, for which the :help states: Like :bdelete, but really delete the buffer. Everything related to the buffer is lost. All marks in this buffer become invalid, option settings are lost, etc. Don't use…
Rich
  • 31,891
  • 3
  • 72
  • 139
16
votes
3 answers

What is a more efficient way to use buffers?

Lately I've been drastically reducing the number of plugins I'm using so I'm looking for answers using only built-in Vim features. I've been noticing a flaw in my workflow when I'm editing a lot of buffers: I am on a buffer and I want to switch to…
statox
  • 49,782
  • 19
  • 148
  • 225
11
votes
1 answer

How to open same file in multiple buffers

Is it possible, in one instance of VIM, to open one file in few buffers and edit them independently?
Ivan
  • 336
  • 4
  • 12
10
votes
1 answer

Multiple buffers, same file, different settings

Is it possible to edit a file under different settings at the same time? More precisely, I'd like to have multiple buffers in the same instance of Vim which have the same content (changing one buffer affects the other buffer's content immediately),…
10
votes
3 answers

Is there a way to list recent buffer history?

I just started using buffers in Vim and I couldn't figure out how to list recent closed buffers. Is there a simple way (like :ls) to list those? Are they actually stored by Vim? Maybe I'm misusing buffers, but what I want to do is to glance at…
José
  • 101
  • 1
  • 6
9
votes
3 answers

Automatically close oldest buffers?

I needed to edit a lot of files recently for a small change in each file. To get to each file, I browsed through NERDtree and opened one file after another. As I opened more and more files, I noticed that my memory usage grew a LOT. Closing vim…
9
votes
2 answers

Force buffers to always open with vertical split

When I open a new buffer I usually just do :vsp something which allows me to open a new buffer with a vertical split. However, when I don't control how the buffer should be opened (e.g. when typing :help) the new buffer is always opened with a…
tjespe
  • 205
  • 1
  • 4
8
votes
1 answer

Improving alternate-file behavior to avoid reopening deleted buffers?

Lured in by the promise of evil-mode, I've been moonlighting in Emacs. It's a wild world with a mix of hairy lose-ends and astoundingly smart features. One feature I really like is a command called bury-buffer, which puts the current buffer way down…
ivan
  • 1,450
  • 1
  • 11
  • 16
8
votes
2 answers

Can I cycle through buffers while skipping ones I've opened?

Let's say I have a vertical split, and four buffers open. I'd like to be able to have one buffer open on the left, and cycle through just the other three on the right. Something like :bnext but skipping open/visible buffers.
Kites
  • 183
  • 3
7
votes
1 answer

What is an abandoned buffer in vim?

I've been using vim for more than 5 years now, and I was surprised when I didn't know what an abandoned buffer was. The closest answer I found was in this SO answer. So is an abandoned buffer one that was loaded but is not displayed any more? What…
stanm
  • 173
  • 4
6
votes
1 answer

Automatic name for new files

For new files, Sublime Text changes the file name to the first line of the file: Is it possible to achieve this on Vim?
adelarsq
  • 604
  • 3
  • 13
6
votes
1 answer

Periodic W11 "File has changed" warnings when reading file

I'm on Archlinux with vim 8.2.2380. Since running updates yesterday, I'm getting W11 warnings periodically just by having a file open in a buffer which has changed on the FS (e.g. when opening log files with vim): W11: Warning: File…
l4mpi
  • 855
  • 7
  • 17
6
votes
1 answer

How to see if Vim has a file opened or not, or has a buffer open

Sometimes I want to open vim in preparation of opening a file in the directory tree. So i start it without a file: vim Then I use a map to open NERDTree: :NERDTreeFind This fails with NERDTree: no file for the current buffer OK so this is…
Steven Lu
  • 2,251
  • 15
  • 26
5
votes
1 answer

How to put the difference of two files in another file

I have two files in two different buffers and I want to get the difference between these two files in another file How can I do this with…
HendrikVIM
  • 73
  • 5
1
2 3 4 5