Questions tagged [buffers]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
24 views

Vim splits the window horizontally whenever i switch between buffers if i didn't get the data written to the disk first

I currently use ctrlp to navigate between buffers in vim , but whenever i try to switch to another buffer it automatically splits the current window horizontally into the two windows . In order to ...
1
vote
0answers
46 views

How to sort the list of buffers

How to sort the list of buffers Vim displays on entering :b <Tab> by most recent? I'm used to the Spacemacs ordering, which displays buffer filenames in separate rows (vertically) in the order ...
0
votes
1answer
31 views

Automatically save deleted lines to a new file?

I have a to do list that I manage in vim. I want to keep track of things I remove from the list. After I type dd to delete a line, I want to write this line to a different file. I only want this ...
0
votes
0answers
22 views

Display all the buffers in all the open vim Windows?

There's this really great feature in Firefox, where you can search all the open tabs by typing % and then typing what open tab you are searching for. Is it possible to do something similar to this ...
2
votes
2answers
63 views

Making functions react to keypress

Im very new to vim scripting. I have the following script in my .vimrc: If there is no user input aka I press <CR> => go to recent buffer If input is 'd' => delete all buffers except for ...
0
votes
0answers
34 views

What's the best way to auto hide a custom bufferline when there is only one buffer listed?

this is gonna be a lengthy question. I'm developing a neovim bufferline plugin which shows a list of all the buffers in the tabline. I'm trying to implement a auto-hide feature, where the bufferline ...
1
vote
2answers
58 views

Open buffer without loading ftplugins

I have huge file and quite slow plugin (loaded by vim-plug) for corresponding filetype. I want following: Plugin is loaded by default Option to fast open this file without loading plugin. Something ...
0
votes
0answers
27 views

Measurement/ tracking the time for editing a file (overall and statistics)

I use vim for coding and also for writing scientific articles and book chapters. It would be very interesting to know the time I spent on a file. For example how many hours or minutes the buffer was ...
0
votes
1answer
27 views

Select buffer from list of buffers filtered by a partial name match?

Let's say I entered a folder with many files and I opened them with vim *. I know that if I want to list all the files inside the buffer I can use the command :ls, and then I can navigate those files ...
1
vote
1answer
29 views

Why does Vim load buffers from old session when new one is started?

The situation is this: I have 2 sessions: s1.vim and s2.vim. First one was saved with files A, B, C in buffers list. Second one was saved with file A. Next I start vim: vim -S s1.vim. :ls shows A, B, ...
1
vote
1answer
29 views

Is there any way of editing multiple files in a buffer at once?

Let's say I have 10 files inside a folder and I open them all with vim *. All those files will be opened in the buffer. Many times when I want to edit all of them at once, I create a small macro that ...
0
votes
1answer
25 views

How to avoid :bnext cycling back to the first buffer? [duplicate]

I like using Vim for presentations, and I use :bnext and :bprev to switch between buffers, where each buffer contains the data for a slide. One annoyance however is that :bnext on the last buffer (...
0
votes
2answers
49 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
46 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
47 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
45 views

Prevent cycling / wrapping to first buffer after last

I have opened multiple buffers and I cycle between them using :bnext and :bprevious. How can I prevent vim from cycling to the first buffer when using :bnext on the last buffer / cycling to the last ...
1
vote
2answers
123 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
17 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
40 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
33 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
29 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
28 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
35 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
48 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
39 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
42 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
24 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
62 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
59 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
83 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
38 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
45 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
55 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
47 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
187 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
48 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
99 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
50 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
60 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
69 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
39 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
31 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
68 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
29 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
61 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
85 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
31 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
370 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?

1
2 3 4 5
8