Skip to main content

Questions tagged [buffers]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
41 views

Get an exact copy of the buffer as it appears in the window

Main Question For a plugin I'm developing, I want to show a floating window somewhere within the buffer view, but want to work out exactly which rows and columns in the window are already taken up by ...
2 votes
1 answer
1k views

How can I detect whether an unlisted buffer contains a new file or an existing file?

Upon opening a new file in an active buffer in the current window, the message line at the very bottom of the screen shows "%f" [New File]. How does Vim know that the buffer contains a new file, ...
2 votes
3 answers
284 views

Open all files listed in current buffer

I have a file/buffer that contains multiple file names with line numbers. Example: Declaration of x fileA.h +3 Usage of x fileB.c +10 I can open a file with the cursor in the given line ...
1 vote
1 answer
55 views

Unloaded buffers and the :ls! command

I ran :ls! (having only a vague memory of the command and not really knowing what I was going to see) and saw a short list of files (maybe 5 or 6) with 'u' in the gutter. Apart from one of the files, ...
1 vote
1 answer
526 views

Last buffer order

I usually open files one in a single vim application. Occasionally, I open multiple files at once to fix some mistakes in batch, for example, after static analyzer. If I was edited files in the ...
0 votes
1 answer
79 views

E194: No alternate file name to substitute for '#'

I have a problem with adding a keymap to delete all my buffers. Namely, I used the following map in my init.vim file (source): nnoremap <leader>B :%bd|e#|bd#<CR> And I get the following ...
1 vote
1 answer
43 views

How to let buffer show relative path when splitting?

It seems to be a vanilla-vim issue as the same behaviour also appears when I'm in vim -u NONE. Basically if you open a file, for example vim src/vector.h, and then split it with :bel vsp %:p:h/vector....
0 votes
2 answers
2k views

Setup Telescope to save and close all buffers, when opening a new file

I'm following a Neovim tutorial on LaraCasts from Jess Archer, setting up Neovim. I've used Vim for a while, but I'm new with Neovim. You can see Jess Archers dotfiles here: Jess Archers Dotfiles. I ...
0 votes
1 answer
205 views

Vim - mapping a text string to specific buffer

I like to know how I can connect/map a specific string to a desired buffer. Let's say I have the following text files: file1: Dog Cat file2: Milk Now, the 2 files are located at different dirs, and ...
1 vote
1 answer
83 views

How to restrict tab-completion to the file name when opening a buffer

I know that I can do: :b home<tab> and vim will autocomplete to all buffers with the word "home" in them. My problem is that this includes all buffers that have "home" ...
1 vote
1 answer
400 views

Exclude current vim buffer from buffer list

I am creating a plugin in vim that involves having a sidebar, within which you can switch between several different buffers with different functions. I am wondering how to hide these buffers from the ...
0 votes
1 answer
225 views

Useful script to manage buffer and window?

I want to create a vertical split from current buffer for reference another file/the same file. After I've done with this split I don't want to see this buffer-for-reference in the split, but: If ...
9 votes
2 answers
1k views

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 :...
1 vote
2 answers
39 views

Cannot go back to previous window of an opened one using bf, especially when having 2 or more windows open at the same time

I opened 3 files by: vim compile.f rtl.f tb.f -O I navigate to a window of interest, which is rtl.f, press gf to open file below cursor and bf to go back rtl.f window. After pressing gf, the window ...
5 votes
2 answers
595 views

Open new file while keeping the focus on the current buffer

Is it possible to open a new file with :edit or :tabnew but without jumping to that new buffer?
2 votes
1 answer
234 views

Session - start with buffer 1

Note: Possible fixed bug. See comments. A somewhat minor nuisance, but as the pedantic for these things :P When saving and opening a Session file the Session.vim file does: badd +1 file1 badd +1 ...
1 vote
2 answers
51 views

Check if there are non-empty or named buffers open

When closing Neovim, I'd like to store the session, but only if there are any files open. If I only have the dashboard open, or an empty unsaved buffer, I want to skip this step. So, I need a way to ...
9 votes
2 answers
1k views

Limit buffer list to current tab

Is there a way to list the buffers specific to the tab that is open currently in vim or macvim?
0 votes
0 answers
110 views

How to "keep" Lexplore/Rexplore/Explore "memory" when toggling it?

Is there a way to keep Explore state? for example, If I open vim at ~/project, open :Lexplore, and navigate in the explore window to ~/project/a/b/c/1.txt. next time I open :Lex i would want to see ...
0 votes
1 answer
31 views

Why does :bd closes tabs instead of buffers?

I am using Neovide and I just don't understand. Maybe I am missing something about buffers? I just want to get rid of annoying empty buffers or old buffers that I don't use anymore. Only in the ...
0 votes
2 answers
154 views

Call range argument to execute in python terminal embeded in Vim

Initial window: My expectation: to copy whole or a part of python code in the right window into the left window's python terminal and execute. My .vimrc setting: function! CopyPasteBuffer() ...
0 votes
1 answer
445 views

How to tag/enrich buffers with custom information (that persist naturally)?

I am trying to persist some state about my buffers, specifically terminal buffers, over vim sessions with :mksession through the plugin vim-session by Xolox. The goal is to assign labels to the ...
2 votes
1 answer
822 views

When I use the yank command in Vim, is the text saved into a buffer that is not visible to the user?

I understand the concept of a buffer. It is the text that's saved from a file that we edit inside of Vim. When I use the yy command, where exactly does Vim save this information to? In any other ...
1 vote
1 answer
388 views

Bufferline in Nvim: auto-close or hide [No Name] buffer when other buffers are open?

I'm using Bufferline with Neovim to show my open buffers at the top of the nvim window. I'd rather not see the 'No Name' buffer if I don't have to. I understand that nvim must always have a buffer ...
0 votes
1 answer
64 views

How do I create key mappings for Windows and/or nano Shortcuts?

Having used text editors (mainly Notepad/++) and some IDEs on MS Windows, I've become familiar with their Alt and Ctrl shortcuts to the point that I use them automatically. Having used nano on a GNU/...
0 votes
2 answers
46 views

Why does the :ls command not display :help buffers?

When I use :ls in Vim, I can see the list of open buffers. But when I open a buffer for documentation, for example :h help, I cannot see an entry for it in the :ls list, even if I open it by :tab h ...
2 votes
3 answers
65 views

Join two buffers into a single buffer

I'm looking for a way to: combine two buffers into single buffer using columns [1, winwidth] from left buffer and columns [1, eol] from right buffer. close buffer 2 so left with same contents in ...
24 votes
6 answers
22k views

What is a scratch window?

Sometimes I see a window open with name scratch. I know it is some kind of temporary buffer/window. How can I create one? :h scratch returns nothing.
2 votes
1 answer
142 views

E93: More than one match when <C-d> shows only one match

When jumping between buffers in Vim, most the time things work quite smoothly. I like to jump to buffers by writing :b something1*something2, checking if the match is unique by invoking C-d, and if so ...
0 votes
1 answer
98 views

Read viminfo when argc() > 0

Does Vim read the viminfo when called with a file argument? How can I force Vim to restore the buffer list in that case? Use case & context What I want is: When called as vi: enable read/write ...
3 votes
1 answer
1k views

Toggle fzf.vim if already open

I am trying to write a vim function to toggle the fzf window if it is already open using fzf.vim. The use case is if I am in the :Buffers view and I want to change to the :Files view if I try to ...
1 vote
2 answers
42 views

Neovim doesn't open previously unopen file in horizontal split

In classic Vi/Vim when I opened a previously unopened file with ctrlp, NERDTree, etc. and the current file/buffer was unsaved, it would open the new file in a horizontal split. After switching to ...
1 vote
1 answer
40 views

Move between buffers of a certain filetype

scenario: I have a bunch of programs that generate output, the programs and output are open in buffers and the programs are one filetype eg .r and the output is another filetype eg .txt I want to ...
0 votes
3 answers
7k views

navigate the buffer list

I've been looking for years for a way to quickly select a buffer from the buffer list. scenario: open the buffer list with :ls select the desired buffer with arrows or whatever open said buffer ...
0 votes
1 answer
39 views

Select a buffer to open in vertical split

Often I want to view two files at once. I switch between the buffers I want to view, so I want a simple key to do so. I would like to have keymaps that let me: Select a buffer from the open buffer ...
7 votes
1 answer
754 views

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 ...
5 votes
3 answers
2k views

Vim sometimes displays full path of file instead of just the filename?

This may seem a little nit-picky, but I like using the wildmenu to switch between buffers: I do :b and then hit tab until I get to the file I want. The problem is that sometimes, vim shows the entire ...
89 votes
9 answers
79k views

Fastest way to switch to a buffer in Vim?

One way to select a buffer in Vim could be to browse the buffers list, using standard commands as :ls, or with some external plugin / vimscript code to browse a list in a window. Let's say I want to ...
0 votes
1 answer
38 views

How to search hidden buffer during insert-mode completion?

I am trying to write a completion function which has as its source a 386k line (CSS) file. Initially I read the file into a list with readfile() and used a for loop to iterate over each line, matching ...
33 votes
8 answers
30k views

How to go to previous open buffer from Vim command line?

I am trying to write a Vim function which should make the window go to the previous open buffer. How can I do it from the command line? My first idea was to find out some Ctrl-O command line ...
0 votes
2 answers
249 views

How to exclude a specific buffer from the BufEnter autocmd group?

I want to load a plugin when I enter a buffer, so I set this event to BufEnter. But when I start neovim, the plugin loads at the dashboard buffer. I want to exclude that buffer. How can I do it? ...
1 vote
3 answers
338 views

How to force Vim to delete all the [No Name] buffers?

I often use Vim to manipulate clipboard data. I create a new buffer :enew Paste the data in it Modify the data Yank it :%y At the end of my day, I end up with several [No Name] buffers. I want to ...
2 votes
1 answer
42 views

Configure buffer display name to show directory when buffer name is short

I don't normally set autochdir, but I'm trying it out and seeing what kind of small frustrations I encounter as a way of learning more about vim. For the purposes of this question, my .vimrc is the ...
1 vote
0 answers
45 views

Run macros in background while doing something else

I have a macro that calls APIs to fetch data based on information in a buffer. Is it possible to have the macro continue execution while I move to another window and work on other buffers?
0 votes
0 answers
24 views

How do I instruct plugin BufExplorer to open a buffer in an existing window?

How do I instruct Vim plugin BufExplorer to open a buffer in a specific existing window rather than open the buffer in a new horizontal (key f or F) or vertical (key v or V) window?
0 votes
0 answers
40 views

How can I stop Vim from quitting when the last buffer is a `:help` buffer?

I think there is an option that governs this behavior, but I cannot find it.
0 votes
0 answers
51 views

Buffers not close automatically by Vimspector

I have been using Vimspector for debugging Python but like 8-10 months now, the Python terminal buffer that is opened by Vimspector when the debugger runs, is not automatically closed when the ...
2 votes
4 answers
617 views

vim : how to set current buffer to a string using `:python`

As example, my current buffer contains below lines di=01;34 ln=01;36 mh=00 pi=40;33 I want to join all lines with :, and set entire buffer to the joined string. How to achieve that, using :python ...
0 votes
0 answers
17 views

Is there a way to mark all buffers as "visited"? [duplicate]

I recognize that this is a very minor problem, but I thought I'd ask anyway. I mainly use Neovim, but to keep things simple, I'm going to be referring to and testing with vanilla Vim 9.0. The "...
0 votes
1 answer
28 views

How do I get the first column of the current buffer after scrolling horizontally?

In the normal case, the first column is 1. But after a command like z10l to scroll rightward now the first column visible is 11 instead of 1. How do I get this 11? My trying: I found that vim.fn....

1
2 3 4 5
9