Skip to main content
8 votes
Accepted

Creating a hidden buffer

I'm not aware that you can create a hidden unnamed buffer. But you can create a hidden (even unlisted) buffer with some fancy name and use that. In VimScript: let g:myscratch = bufnr("my-fancy-...
Ralf's user avatar
  • 9,277
6 votes
Accepted

Buffers that are neither active nor hidden

You'll find more details under :h active-buffer and the sections that follow... *active-buffer* active: The buffer is displayed in a window. If there is a file for this ...
B Layer's user avatar
  • 20k
5 votes

Move to window if specified buffer is opened

With vim only There's a few options to make navigation between files less tedious in vanilla vim. First, you need set switchbuf=useopen in your vimrc (:h 'switchbuf') to reuse a split (if it exists, ...
Biggybi's user avatar
  • 2,770
4 votes
Accepted

Buffers are left even when `nohidden` is set

The 'hidden' setting The 'hidden'/'nohidden' setting tells Vim what to do about buffers that are "abandoned". 'hidden' means an abandoned buffer becomes hidden (similar :hide). 'nohidden' (the ...
Peter Rincker's user avatar
4 votes
Accepted

Move to window if specified buffer is opened

Use :h :wincmd to manipulate window in script, it follow the same rule as :h CTRL-W . e.g. If you want to jump to window 3, you can do it by 3<c-w><c-w> in normal mode, or :3wincmd w in ...
dedowsdi's user avatar
  • 6,268
4 votes
Accepted

open several files into same buffer

The :read command reads a file into the current buffer; although it only works for one file. You'll need to add a new command which calls :read in a loop: command! -nargs=+ -complete=file Read ...
Martin Tournoij's user avatar
3 votes
Accepted

Make vim remember the fileformat of a buffer (round 2)

You can add an autocmd to have Vim execute :e ++ff=dos every time this particular file is read or reloaded. Assuming the path to the file, after resolving symbolic links, is ~/VendorApp/DataCamp/...
filbranden's user avatar
  • 29k
3 votes
Accepted

Buffer scope variable not exists when run autocmd BufUnload

As you can see in :help BufUnload: NOTE: When this autocommand is executed, the current buffer % may be different from the buffer being unloaded <afile>. So you should use getbufvar() to ...
filbranden's user avatar
  • 29k
3 votes
Accepted

vim :make :cwindow, I need error length character limit larger than 1000

As of 7.4.1802, Vim is supposed to quickfix lines up to 4096 bytes long instead of truncating them.
jamessan's user avatar
  • 11.1k
2 votes
Accepted

Open a second file and quit the previously opened one without saving

You want to add the following line to your vimrc: set hidden From :h 'hidden': 'hidden' 'hid' boolean (default off) global {not in Vi} When off a buffer is unloaded ...
statox's user avatar
  • 50.1k
2 votes
Accepted

Command to load buffer but not make it current

You want bufload() and maybe bufadd(). Usage example: call bufadd('someName')->bufload() The patch 8.1.1610 is required.
user938271's user avatar
  • 5,987
1 vote

How to remember all buffer settings without "hidden"?

That's "Window", not "sub-window". Also, as long as the buffer is in the buffer list it will keep all its buffer-local options, including comments, textwidth, tabstop, shiftwidth, ...
romainl's user avatar
  • 41.2k
1 vote

How to search hidden buffer during insert-mode completion?

I sped this up by pre-converting the CSS file to JSON. Vim is fast at reading and decoding JSON: let css = readfile('myfile.json')->join('')->json_decode() To search for keys matching a prefix,...
Andy Stewart's user avatar
  • 1,359
1 vote
Accepted

What's the benefit(s) of deleting buffers that are not loaded into a window?

Maybe what you're seeing might be the buffers used to display completion popup. Buffers don't take up a lot of resources and depending on your lsp client it might use these as cached responses from ...
dza's user avatar
  • 231
1 vote

Can you make it so that :e hides the current buffer but that :e! discards it?

There's fundamental misunderstanding here: in Vim (the most of) options are consulted by specific events, not by specific commands that may trigger such events. That is, say, "hidden" is ...
Matt's user avatar
  • 20.8k
1 vote

Can you make it so that :e hides the current buffer but that :e! discards it?

Possibly I’m misunderstanding you, but I’m going to ignore most of your question and focus on this part which I think describes your main goal? I open a new buffer, play with it for a bit, and then ...
Rich's user avatar
  • 32.2k
1 vote

Buffer scope variable not exists when run autocmd BufUnload

The current buffer and file is behind <afile>, not %
Luc Hermitte's user avatar
  • 17.5k
1 vote

How to show the name of a help buffer in the tabline of the airline?

:help opens an unlisted buffer (:help unlisted-buffer) You can make the buffer listed (shown in :buffers) with the command :setlocal buflisted Now you will find the buffer in the list that :buffers ...
guntbert's user avatar
  • 1,245
1 vote

Everytime I call :Explore netrw creates a new unlisted buffer

Netrw already includes code that attempts to reuse buffers but, as you have discovered, this code currently appears not to handle tree listings and ends up creating many buffers. So the first thing ...
Rich's user avatar
  • 32.2k
1 vote

Hide terminal buffer from buffer list

This seems to get me what I want. I think neoterm relies on the terminal buffer being in the buffer list. I just made my buffer tab cycle key mapping check to see if the new buffer that was cycled to ...
Josh Lawrence's user avatar

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