Questions tagged [buffers]

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

Filter by
Sorted by
Tagged with
0
votes
2answers
44 views

Where are buffer level variables stored in Vim? And how to get their RAM / storage usage?

Where does Vim store b: buffer level variables / dictionaries? RAM or some kind of file on a disk? If it stores it in RAM, how to get an estimate of RAM / storage used by a particular variable / ...
1
vote
1answer
28 views

Can you turn a popup into a regular buffer?

I have a popup / floating window open which is normally used for temporary jobs, like searching the code or opening a quick REPL. Is it possible to turn that into a regular buffer? While I have it ...
0
votes
1answer
35 views

Useful script to manage buffer and window?

Given the scenario: 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 ...
2
votes
1answer
27 views

Prevent cycling / wrapping to first buffer after last

I have opened multiple buffers and I cycle between them using :bn and :bp. How can I prevent vim from cycling to the first buffer when using :bn on the last buffer / cycling to the last buffer when ...
1
vote
2answers
98 views

Limit `:bufdo` to only visible/active buffers

Working on a larger project, I tend to switch from topic to topic using git. Some times I want to run a command on all the buffers that are related to the topic at hand. I can do a :bufdo, but this ...
1
vote
1answer
16 views

Search multiple buffers without replacing

Opening all 49 files in my working folder in separate buffers, I wanted to see if there were any em dashes. I typed :bufdo /— and vim immediately went to work, processing a page of buffers at a time. ...
1
vote
1answer
34 views

Vimtex: `latexmk` compiler gives “no file name specified” error even after a new buffer is written to a file

When I open a new instance of vim without any 'filename' argument and write some LaTeX code, I cannot just compile it to pdf with latexmk, because it needs a file to compile from. However, even after ...
0
votes
1answer
30 views

How to implement an autocommand that deletes a buffer when it's being hidden and when it hasn't been modified in the last N seconds?

I'm trying to implement a simple autocommand, which deletes a buffer when it's hidden, with a condition that the file hasn't been modified in the last N seconds. I have the following code in ~/.vim/...
2
votes
1answer
24 views

Buffers that are neither active nor hidden

Both :ls and :buffers display a list with buffer information, giving indicators for each buffer. For example, # means the alternate buffer, and % means the current buffer. The meaning of each ...
1
vote
1answer
27 views

Forcing integrated terminal to scroll down after relayed command

I have a plugin which integrates a terminal that I can send commands through using a custom command I made. The only issue I'm having is that sometimes after the terminal gets clogged, it tends not to ...
0
votes
2answers
33 views

Automatically resize window based on filetype

I have a nifty autocommand in my vimrc that automatically maximizes any :help window: augroup LargeHelpWindow autocmd! autocmd BufWinEnter * if &l:buftype ==# 'help' | wincmd _ | endif ...
0
votes
2answers
43 views

Append a line after matched multiline pattern

i want to run this global command : /3)\(.*\n\?.*\)\{1,10\};;/ which matches multlines. I want to append a line after the matched block(of lines) across multiple buffers. I don't know where to begin ...
0
votes
2answers
21 views

Reloading buffers silently after an executed script changes the underlying files directly

I'm wrapping a command line script in a function and then in a command, which supplies this script with 2 arguments: nnoremap <leader>G :BxSedRi 'src/', 's/\<<C-r><C-w>\> ...
0
votes
1answer
37 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() ...
1
vote
1answer
38 views

Copy lines and execute in terminal window

Edit a python file with vim adddf.py, and type vert term and python3, there are two windows in vim. cat adddf.py def add_df(df,number): import re new_df = pd.DataFrame() nrow = df.shape[0] ...
2
votes
1answer
22 views

Options readonly vs nowrite

Apologies if this is duplicate. I have searched and haven't found any related questions. What is the difference between the options readonly and nowrite? The reference manual says: readonly: If on, ...
1
vote
1answer
34 views

W11: File has changed since editing started

When a file is changed (e.g. by checking out another git branch), and i reload it with :bufdo e, I get the message W11: Warning: File "foo.bar" has changed since editing started See ":...
2
votes
1answer
54 views

Mapping specific for diff mode and vimdiff

My idea is that whenever &diff is true for a buffer, I would like some mappings to be active when that buffer is the current buffer. The following attempt works for when I open a session in diff ...
0
votes
1answer
45 views

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 ...
0
votes
0answers
33 views

Print command output on terminal on vim exit

I am trying to run shellcheck upon exiting vim, however I do not get the output of the command I run. I've tested running something like touch foo instead, and I managed to see the file being created, ...
0
votes
0answers
44 views

Delete buffer only when a specific buffer is deleted

I've configured Vim to look like this: +------------------------------------+ | N | Code | | E | | | R | | | D |...
2
votes
1answer
53 views

When opening an existing session and an existing file at the same time, the focus goes to the last opened file in the session

When doing this: vim -S Session.vim OTHER_FILE The shown buffer contains the last opened file in the Session.vim and not the file OTHER_FILE. I find this behavior a bit disturbing, I would have ...
0
votes
2answers
42 views

vim command line option to quit buffer if empty?

I have a few shell scripts where I find files and open them in vim, with the filenames being stored in shell variables that are passed to vim. Since I don't want to start a vim session unless at least ...
4
votes
1answer
156 views

How to navigate vim buffers using quickfix list?

I am trying to come up with a way to populate the vim quickfix window with the output from :ls I tried some variants like cexpr ":execute ls" but it doesn't work. Can someone please help me ...
2
votes
2answers
43 views

Get first and last visible line from other buffer than current

I know that I can get the first and last visible lines in the current buffer by using line('w0') and line('w$'), but is there a way to do it for other buffers that are visible but not active as well? ...
0
votes
1answer
55 views

Save all changed and unchanged buffers then exit

The command :wqa does not work with new files. For example, if you create some empty files and save them with :wqa, you will not find these files after you quit vim. They are not saved at all. The ...
0
votes
1answer
42 views

Unclosed expression sequence error when setting statusline?

I am trying to display the number of loaded buffers on my statusline using: ... set statusline += %{len(getbufinfo({"buflisted":1}))} ... The error I get is : E540: Unclosed expression ...
2
votes
2answers
55 views

Buffer scope variable not exists when run autocmd BufUnload

Describe the issue I use a vim plugin that when use Vim to open a ipynb (python notebook) file, will call system function to use jupytext create corresponding python file to enable use like, YCM to ...
3
votes
1answer
55 views

add buffer to vim from the shell command line

I am currently trying to externally add a new buffer to a vim instance from the command line. That means I have already opened vim and I modify the files of interest to me. Then I want to go back to ...
1
vote
1answer
34 views

How to recursively open all files except ones in hidden directories from within vim?

In my python project root folder, there are multiple directories, some of which contain hidden sub-directories specifying python virtual environments. I want to open all my python files recursively ...
0
votes
1answer
27 views

Running Vim in shell script opens rest of shell script in a buffer

I've got Vim starting in a shell script to install some plugins. I'm using nvim --headless +PlugInstall +qall, but when Vim opens, it has the rest of the shell script (cd $HOME/.config/coc/extensions &...
0
votes
1answer
49 views

Show buffer title at top of window instead of bottom

By default vim shows the filename of the current buffer (or whatever status line you have specified) at the bottom of each split window. Is there any way to change it so that it displays at the top of ...
0
votes
0answers
27 views

Starting an interpreter and dumping the output to a new buffer

I am working on some Python code, and I would like to call an IPython interpreter from within a script. I have no problem doing this, however, I would then like to dump all of the output from both the ...
0
votes
0answers
19 views

running job disconnects from buffer

I'm trying to implement tail -f buffer via job_start. It works well unless I switch to other buffer (:bn). When I return to tail-buffer, it's empty. let job = job_start(['tail', '-f', 'some_log_file'],...
0
votes
1answer
55 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
0answers
58 views

How to set statusline for specific buffer

I want to use netrwm instead of nerdtree. I have my own statusline but I don't want it to be displayed in netrw. Nerdtree had it's own option for it (let NERDTreeStatusline="") which made it ...
0
votes
1answer
30 views

Open previous non-deleted buffer

I often use :b# to switch back to the previous buffer. I also often delete buffers that I don't need anymore. However, if you delete a buffer, doing :b# opens that deleted buffer back up. Is there a ...
2
votes
1answer
268 views

Using Vim with Vifm

When I open a file in Vifm and edit it with Vim is it possible to tab back to Vifm without closing the file? Or is it possible to use Vifm inside Vim to open files?
3
votes
3answers
449 views

How to list open buffers simplified

I'd like to use ls command to show opened buffers. I'd like to make the output of this command as simple as possible. I'd like to see only the buffers' names, numbers and status (#,%,+,..). I don't ...
2
votes
2answers
448 views

Efficient way of cleaning up the buffer list

Very often, after days and days of coding, opening vim -S session everytime, I end up with a fair long buffer list that I want to clean. Therefore I use :ls to list all buffers, and then :bdelete ...
1
vote
1answer
81 views

Pipe :Ag output to a new buffer

I'd like to search for a regex using Ag. This results in more than 1000 findings. I'd like to save these findings in a buffer to be able to go through them slowly
2
votes
1answer
37 views

Command to load buffer but not make it current

I can list buffers with :ls and see their load state. I can load all the buffers using :bufdo e and a specific buffer using a range, for instance to load only buffer 2 :2bufdo e, however this makes ...
3
votes
1answer
48 views

bufnr return unexpected number

from neovim help: bufnr([{expr} [, {create}]]) The result is the number of a buffer, as it is displayed by the ":ls" command. For the use of {expr}, see |bufname()| But it ...
-1
votes
1answer
212 views

Close a “No Name” buffer opened with :e

How do I close a "No Name" which was opened with :e .. (explorer mode)? I tried Ctrl-^ and :bd!, but the buffer is still there.
1
vote
2answers
51 views

How to properly catch errors when running scripts on buffers?

I am trying to write a function to lint buffers in neovim. It seems that the usual recommendation for achieving such a thing is to run the command over the entire range (ie %!lint). This is however, ...
1
vote
0answers
17 views

vim - :b partial match mid filename even when matches start of filename

In vim, if I have 3 buffers open: test_io io_fsm test_mux I want to get to test_io by typing :b io Vim won't list test_io (iterating using tab) as it prefers io_fsm instead. If I type :b fsm it ...
2
votes
2answers
102 views

How to open two new empty buffers in two separate windows?

This is a follow-up question from this Question and Answer. Is it possible, and if so how, to open two (or more) new empty buffers in Vim (without associating them to a file), such that they both take ...
0
votes
0answers
62 views

How to hide a buffer thru vimscript, with buffer number or buffer name

I'm trying to make a plugin that hide and show a terminal window on the bottom of the window, but i can't find a reliable way to hide a specific buffer, i tried using hide but you only can hide by ...
2
votes
1answer
74 views

Use cases of “:rewind”? How does it differ from “:b1”?

After reading :help :rewind :rew[ind] [++opt] [+cmd] Start editing the first file in the argument list. This fails when changes have been made and Vim does not want to |abandon| the ...
3
votes
1answer
61 views

How to make gf behave like :drop

When I'm in a python file and I go to the imports, put the cursor on one of them, and type gf, it opens the corresponding file in a new buffer in the same window, even if the file is already open in ...

1
2 3 4 5
7