Questions tagged [buffers]
The representation of a file loaded into memory. Edits are performed on buffers.
428
questions
0
votes
2
answers
68
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?
...
0
votes
1
answer
32
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/...
1
vote
3
answers
108
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
28
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
32
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
22
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
35
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.
2
votes
0
answers
52
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
0
answers
28
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 ...
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
24
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....
0
votes
0
answers
53
views
How to "keep" Lexplore/Rexplore/Explore position?
When navigating large projects, in IDEs like intellij, I keep opening and closing the navigation/file tree tab and moving around files.
On vim I tried to create a similar functionality, adding to my ~/...
0
votes
2
answers
39
views
Misunderstanding of interaction between local options, moving between windows, and WinLeave, WinEnter, BufLeave, BufEnter events
This what is logged in :messages when I'm printing the value of nu and rnu upon the 4 events WinLeave, WinEnter, BufLeave, BufEnter during the action, done twice, of opening :help and closing it. The ...
1
vote
1
answer
53
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" ...
0
votes
1
answer
34
views
Making certain buffers invisible to commands involving "all" or bufdo
For my projects I generally open several tabs some of which might involve terminals or directory trees or quickfix (since ShellCheck sends its error messages there for instance).
When I want to use ...
2
votes
3
answers
183
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
478
views
How do you use buffers/panes? Possible to move a buffer into another pane?
I recently switched from VsCode and I am quite confused about the window/pane system of neovim.
It seems like these are the only options to actually use panes in neovim:
https://stackoverflow.com/a/...
-1
votes
1
answer
49
views
What is the meaning of command `:4w`?
As title. I just read a post that people accidentally delete(wipeout) their unsaved work by trying the command :4w. A bloody lesson to him, but I also want to prevent this from happening to myself. ...
0
votes
0
answers
24
views
":bufdo cd ~/Some/Folder/Path" doesn't affect all files
I have about 15 files in my buffer list [1]. In my one and only tab, I have three modifiable subwindows, none of which have unsaved changes. I issue :bufdo cd ~/Some/Folder/Path, and Vim lists each ...
1
vote
1
answer
80
views
How does Buffer Explorer Vim Plugin (BufExplorer.vim) determine its colours?
I've customized a colour scheme over the decades. Recently (possibly within the last year), I upgraded BufExplorer and found that it lists all of the buffers in mostly orange or yellow. Orange is my ...
-1
votes
1
answer
43
views
:BufExplorer and its split variants sends me to another tab
If I have BufExplorer open in another tab, any of the following commands will send me to that other tab instead of opening BufExplorer in a new subwindow in the current tab:
:BufExplorer
:...
0
votes
1
answer
29
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 ...
0
votes
2
answers
1k
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 ...
1
vote
1
answer
35
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 ...
1
vote
2
answers
94
views
Navigate arglist via filename?
I like doing things like :b css to jump to the single css file I'm working on.
But of course this only works if I only have 1 css file in a buffer.
I'm under the impression that it is not possible to ...
0
votes
1
answer
324
views
How to get the total lines of a file before it's loaded into a buffer?
As title.
My target is to disable a plugin before it is applied to a buffer that will be loaded with the content of a file.
I can get the file name before it is loaded.
The file to be opened is ...
0
votes
1
answer
270
views
How to grep only the contents of the current file?
I have this alias to grep under the cursor (for the entire project):
" bind K to grep word under cursor
nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR><ENTER>...
1
vote
1
answer
85
views
What happen internally when I set `bufhidden` to `delete`?
As title. Would the buffer I set the option with the value delete really get deleted immediately? If not, when will it be deleted and what is this mechanism? Sorry for maybe a bad question but I'm ...
0
votes
1
answer
71
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 ...
0
votes
2
answers
25
views
Event with the same timing as BufEnter but triggers on vsplit?
As title. I have a pair of autocmds which needs each other:
One on WinLeave, this one is fine since it will be triggered when I call :vsplit.
One on BufEnter, this one is NOT fine for the edge case, ...
1
vote
1
answer
93
views
Short delay in buffer swtich with `nnoremap` binding
I have
nnoremap <C-]> :bn<Enter>
nnoremap <C-[> :bp<Enter>
so that I can use Ctrl + [ and ] to flip between buffers. I'm experiencing an issue where these two shortcuts behave ...
2
votes
1
answer
81
views
What's the benefit of using unlisted buffers?
As title. Which command will make some buffers unlisted and why it is designed to do so? I guess this is related to memory management but I'm not sure about this.
1
vote
1
answer
55
views
What's the benefit(s) of deleting buffers that are not loaded into a window?
As title. Say that I have 20 buffers and only 4 buffers are shown (Assume in my current tab, I only have 4 splits). Since 20 buffers are there and each one is attached with some LSPs, I assume that ...
0
votes
1
answer
28
views
The behavior of bufname is unclear to me
I use NERDTree and try to apply the recipe that ensures no one replaces its buffer.
I do the following:
Start vim
Execute :NERDTreeFocus
Open some file
Execute :q for file buffer
(At this point there ...
1
vote
2
answers
48
views
Set mappings dependent of file type
To execute and debug different kind of programs, I mapped the function keys in the .vimrc-file.
E.g.
" save and execute perl
:noremap <F5> :w<CR>:!./%<CR>
" save and ...
-1
votes
1
answer
104
views
Edit a file in two different terminal windows
It's nice to edit the same file from two different views. I use a vsplit for this, as described here, and it works well.
However, I'd like to have the two views open in different terminal windows, ...
2
votes
0
answers
156
views
CTRL-^ work in Vim but not in Neovim
I'm reading Neovim's usr_07.txt.
When I start Neovim like neovim t1.txt t2.txt t3.txt, and then issue :next, the shortcut CTRL+^ is supposed to bring me to the previous file (i.e., the alternate file)....
1
vote
0
answers
32
views
How to move buffer list from bottom to top of UI?
When I invoke the buffer list (via: :ls), a selection window appears at the bottom of my UI. Is there a way to move this selection window to the top of my UI?
Any suggestions would be welcome.
1
vote
1
answer
367
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
64
views
Trying to get rid of buffers with :%bd fails
I have trouble with buffers in Vim (8.0 on a rhel8 server) apparently. That said ... I was not aware of the exitance of buffers before facing this problem. So as you can see, my expertise in vim is ...
1
vote
1
answer
79
views
Detect line endings in current buffer, substitute all line endings depending on result
In GVIM, I'd like to save the current file with either \r\n or \n line endings. Depending on the opened file, the appropriate line endings should be chosen automatically. I had a look at https://unix....
1
vote
0
answers
57
views
Is there an autocommand event after buffer is deleted?
help BufDelete
BufDelete Before deleting a buffer from the buffer list.
This is close to, but not what I am looking for: After deleting a buffer.
0
votes
0
answers
767
views
Disable TreeSitter highlighting in inactive buffers
How can I disable TreeSitter highlighting in inactive buffers?
I currently have all inactive buffers blurred and their syntax disabled, but I can't figure out how to disable the TreeSitter ...
0
votes
1
answer
64
views
How to create a loaded `nofile` buffer without loading a file?
This script creates a 'nofile' buffer and loads it so it can be edited:
let n = bufadd('foo')
setbufvar(n, '&bt', 'nofile')
bufload(n)
But it has a big problem: The call to bufload will read a ...
2
votes
1
answer
214
views
open several files into same buffer
I have several file paths saved in a register. I would like to open them all into the same new buffer. (as if I ran cat * files | vim - from command line.
As this is part of a plugin, I would like to ...
1
vote
2
answers
54
views
How do I keep the buffer list open for 1 more command?
Is there a way to keep the buffer list open so I can select a buffer?
I.e., I do ls, then the buffer list shows up with the 'enter a command or press enter' prompt - I would like to press, for example,...
1
vote
1
answer
585
views
How to revert to "close file when buffer closes" behavior in Neovim?
The "old" Vim behavior was to close the file when all associated buffers are closed. With the newest version of Neovim, it appears that closing a buffer doesn't actually close the file. As ...
1
vote
0
answers
156
views
How to split view all buffers in vim with equal distribution vertical horizontal
How can I split view all buffers in vim with a distribution between vertical and horizontal? Is there a plugin?
I know how to make all buffers appear in either horizontal or vertical splits:
:ball
:...
2
votes
2
answers
248
views
Opening files in insert mode
How do I make vim open files in insert mode? I've got the line "startinsert" in my .vimrc, and it does what it's supposed to (vim opens in insert mode), but when I open another file it opens ...
0
votes
0
answers
66
views
A counterpart for BufUnload,BufDelete event but gets fired after a buffer is unloaded
I've defined an autocommand that essentially checks for the remaining buffers' filetype, and for now by relying on BufUnload or BufDelete, the unloaded buffer still gets detected as being present at ...