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
32 views

VI - Insert buffer before

I've recently begun using buffers, rather than tabs, to sort files in vi. My question is, can I create a buffer such that, instead of getting this: [:enew] [:ls] 1 main.c 2 foo.txt 3 [No Name] I got ...
0
votes
1answer
11 views

Sort quickfix entries by most relevant files?

I have a project that has a lot of warnings. I'm wondering (until I fix all the errors) how I can make my quickfix results more relevant? My compiler script uses %t so it can differentiate errors from ...
0
votes
0answers
9 views

GoToDefinition used to show result in a split window, but now uses buffer

I have this mapping in my .vimrc: nnoremap gd :YcmCompleter GoToDefinitionElseDeclaration nnoremap gf :tab split \| YcmCompleter GoToDefinition<CR> When I press gd, it writes the command :...
1
vote
3answers
193 views

Can I open a file using the index shown by “:scriptnames”?

I am wondering how to open a file or load it into a buffer using the index shown by :scriptnames? 23: /usr/share/vim/vim80/plugin/tarPlugin.vim 24: /usr/share/vim/vim80/plugin/tohtml.vim 25: /usr/...
1
vote
1answer
39 views

Character level buffer modification

It is possible to modify buffer at the line granularity. E.g. :py3 vim.current.buffer[0] = "abc". But it deletes the attached marks even if a single character is replaced. Is it possible to ...
0
votes
0answers
15 views

How can I track the event of opening a file in netrw in an autocommand?

I'm trying to solve this problem by creating an autocommand which will track when a new buffer is opened through netrw, and will then immediately close netrw once the buffer is closed. How can I track ...
1
vote
1answer
32 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
47 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
32 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
27 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
65 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
50 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
59 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
28 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
31 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
26 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
51 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
62 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
51 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
46 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
133 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
18 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
45 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
36 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/...
3
votes
1answer
37 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
29 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
37 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
23 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
42 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
26 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
86 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
70 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 ...
1
vote
1answer
98 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
51 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
46 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
57 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
51 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
208 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
54 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
123 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
52 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
66 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
77 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
49 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
33 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
82 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 ...

1
2 3 4 5
8