Questions tagged [buffers]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
95 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
32 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
409 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
625 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
612 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
102 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
40 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
57 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
314 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
64 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 ...
3
votes
2answers
141 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
70 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
84 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
69 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
vote
1answer
41 views

Buffer opened when compiling succeeds

I am writing a vim plugin for the fortran filetype. In an autoload script, I have done: " File Name: autoload/makes.vim let s:Compiler = get(g:, "fortran_compiler", "gfortran"...
2
votes
1answer
28 views

Execute autocommand only if buffer contains a pattern

Concrete example: When using React with Styled Components, I want to load the CSS snippets file. I could achieve this with: autocmd FileType javascript,typescript :UltiSnipsAddFiletypes css However, ...
0
votes
1answer
39 views

Refreshing vim file from within a function

I am trying to do a shortcut to resave a file with cmd-S. And if the file is of type vim, it will also re-source %. Here is what I have: function SaveFile() w if &filetype ==? 'vim' ...
0
votes
2answers
69 views

Define a new ex command active only in specific filetype (C++)

I would like to define a new command for C++ files/buffers (ft=cpp). I shall explain the requirements through the example below. The newly defined command :stripdbg should strip the surrounding dbg() ...
0
votes
0answers
47 views

NERDTree causes Vim exiting when open two buffers on same window

Here is what is happening: I open one file, either with o in NERDTree or with :edit file_a. I open another file, again with o in NERDTree or with :edit file_b, and the file opens at the same window ...
1
vote
1answer
154 views

open file in an hidden buffer

I want to open a file invisibly such that I can operate using normal (programmatic) commands on it. How can it be achieved? Preferably, it should be hidden from the beginning. Thanks
2
votes
2answers
396 views

Run autocmd when creating/deleting a buffer

I have two functions tex#PDFOpen() and tex#PDFClose() to automatically open and close the pdf file created by a TeX document. The way I assign them to autocommands is via the following autogroup in ~/....
1
vote
2answers
396 views

How to set read only for only one buffer

I'm using vim with some plugins, such as Nerdtree, YCM, to build an coding environment. Now I want to achieve this: When I execute the command vim, a file containing some ASCII image, will be loaded ...
1
vote
1answer
277 views

Get current buffer (content) size in vim script

I'm using nvim v0.4.3 and am trying to apply some of the tricks + alpha (e.g. disabling substitution preview) to make editing large files faster. I want to do that even to unnamed buffers (i.e. ...
0
votes
1answer
29 views

Need for 'buffer' when setting FileType

What would be the difference between these two commands? autocmd FileType python nnoremap <buffer> <localleader>d ihello! And: autocmd FileType python nnoremap <localleader>d ...
2
votes
1answer
553 views

Vimscript: How to check if a buffer is modified

Given a buffer number i, I want to check if the buffer has been modified after the last save. How do I do that in vimscript? I tried to use getbufvar() like the following: if getbufvar(i, "&...
0
votes
1answer
31 views

Cycling between tabs and buffers

I want to set up some mapping that: if there are multiple open tabs, then goes to the next tab, like :gt otherwise it cycles through the open buffers, like :bn How do I go about doing this?
1
vote
1answer
97 views

How to make autowrite apply to :make but not to :buffer?

I have set autowrite so that :make automatically saved the file before running the build command. But now I'm increasingly using :buffer to switch between buffers, and have now noticed that it ...
2
votes
2answers
77 views

Plugin to edit whole datasets/projects

I'm using vim all the time for text editing these days, and have a particular use case: editing a dataset using successive commands. The main problem, as often, is fixing things, ideally rather ...
3
votes
2answers
342 views

How to split view multiple buffers in vim

Working with big projects, I often find myself needing to view/edit several files at once. If I have multiple buffers open, is there a way to split the window to view multiple files in one command? E....
1
vote
3answers
272 views

How can I “reload” a buffer that was previously unloaded using `:bd`, such that it will re-appear in `:ls`?

Suppose I have unloaded a buffer and deleted it from the buffer list using :bd. Now, it won't show in the buffer list (:ls) anymore, unless ! is specified in the command: :ls! How can I add the ...
1
vote
2answers
45 views

Close buffer in the other instance

When a file is being opened neovim warns that swap file already exists, at which point you can't safely open a file without first closing it in the other instance. I frequently have many projects ...
2
votes
1answer
48 views

Having current filename in the command line

Some time ago I completely got rid of the status line. Vertical space is a scarcity in the modern HD world. The only thing I missed from it is an ability to see what file I'm working with. So I'm ...
2
votes
2answers
94 views

Move to window if specified buffer is opened

I am currently trying to write myself a function the will let me show or hide (toggle) the :terminal window. The only way to hide it, as far as I currently know, is to just navigate to that window and ...
1
vote
0answers
69 views

Using fzf inside vim with double star completion

I wonder if it is possible to use fzf inside vim the same way it can be used on the command line. So, on the command line I can do vim file** and it will use fzf to search 'file'. I wonder if this is ...
0
votes
0answers
35 views

Is it possible to make some animation in vim

This issue may be a kind of nonsense but I still want to know if it is possible to make some dynamic stuff in vim 7 or vim 8. For example, load a file and make if move from left to right (just like ...
1
vote
2answers
176 views

How to clear all contents of a file

To clear a file I find myself doing something like: 1G 1000cc (or some large number) Is there a simpler way to do this for clearing a file? On a normal text editor I normally would do Cmd-A and then ...
0
votes
1answer
32 views

How to display MiniBufExpl window on the top

instead of the default display of the MiniBufExpl window on the bottom, I would like to have it on the top, is this possible?
1
vote
1answer
39 views

How to open a new window and edit it in an automated fashion?

Consider the following function function! Exp() call feedkeys(":new ~/.vimrc\<CR>") call search('F') endfunction My expectation from Exp() was that if I call Exp() then 1) I see my ...
0
votes
0answers
49 views

How to reload vim buffer

I built a cpp environment with YCM, EasyGrep and some other plugins. With YCM, I can jump to declaration/definition, with EasyGrep, I can grep a keyword easily. But I found something weird: Saying ...
1
vote
1answer
401 views

Commands to write text to a buffer

I'm writing a plugin that often needs to write text to specific buffers. My current solution is to make the script execute normal commands that open a split with the buffer, write the text and then ...
1
vote
2answers
356 views

How to close the netrw buffer/window from any other window

I would like to have the behavior where I can run :Vex<CR> when pressing <Tab> in normal mode: nnoremap <Tab> :Vex<CR> ... to open the netrw file tree window and then I would ...
2
votes
1answer
20 views

Can't exit buffer using leader mapping - 'cannot make changes'

I have a leader key set up, and a mapping that allows me to exit windows without typing :: let mapleader = 'f' map <leader>q = :q<CR> Today I installed MattesGroeger/vim-bookmarks using ...
0
votes
1answer
69 views

Updating buffer content from another buffer

I want to update one buffer content from another buffer periodically, for this I need to delete all lines from the target buffer firstly, then to write new lines to it. The number of lines are varying,...
2
votes
1answer
68 views

Saving setting to buffer

Is there a way to save the value of a setting to a buffer or a file? For example, when I type :set guifont It displays the setting I want to use but as soon as I start typing in the buffer it ...
1
vote
1answer
113 views

Buffer list per window

How could I get something like a buffer/argument list or a filter for individual windows, with a chosen subset of the buffers? So I could have a window just for header files in C (files ending in .h)...
2
votes
2answers
565 views

How to create a new tab or window from a buffer?

I have several open buffers and want to open a buffer in :ls in a new tab or window. I have found a way to do accomplish this, either by first executing tabnew or C-w v and then selecting the buffer ...
6
votes
1answer
107 views

How can I view the name of the swapfile being used for the current buffer?

Let's say I recovered a bunch of swapfiles in quick succession: gvim -r .swv gvim -r .swu gvim -r .swt And then cycled through them all a few times before finding that one of them was nonsense. I ...
2
votes
1answer
83 views

Auto updating for file content similar to tail -f

Is it possible to setup vim for auto updating on changing of file content? I think about working with logs that can extend if new event happened. What I expect is that vim will spot a file change and ...
1
vote
2answers
69 views

`a` append to buffer commands

Similar question, yet not duplicate of: How can I reload all buffers at once? If :wa writes all, would not :ea be expected to reload all? How could one script :ea to behave this way? What are the ...

1
2
3 4 5
8