Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [buffers]

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

1
vote
1answer
48 views

VIM: bufnr(“%”) not matching number from :buffers for NERDTree buffers

I am using NERDTree to open files. If I am on a file path in vim and I hit gf this works fine for files. For folders, gf opens a new NERDTree buffer in this folder which is fine. I can then choose a ...
0
votes
1answer
39 views

In Vim, how to tag/enrich buffers with custom information (that persist naturally)

Gday, I am trying to persist some state about my buffers, specifically terminal buffers, over vim sessions with :mksession through the plugin 'vim-session' by xolox. The goal is to assign labels to ...
0
votes
1answer
26 views

how to create a buffer like a fugitive temporary buffer

When we call :Gdiff on a file, fugitive will create a buffer with a name fugitive:///path/to/file/. The modifiable option is off and readonly option is on. Most importantly, the file does not exist on ...
0
votes
0answers
22 views

How could I rearrange the splitted buffer equally after opening the tagbar

I use thee command :vs to split the buffer vertically into two buffers. Then I use :TagbarToggle to open the tagbar buffer. However, the two splitted buffers no longer have same width with the tagbar ...
0
votes
1answer
30 views

How can I see which buffers are in diff mode?

:ls shows my buffers and lists flags for each buffer, but doesn't list whether &diff is set. Plugins like unite's buffer source just rely on :ls output. Is there an easy way to list and manage ...
3
votes
2answers
60 views

How could I maintain split layout when deleting buffers?

I opened 5 buffers and in one of them I use the command :vs to split the current buffer screen into two. When I use the command <leader>d to close one of the splitted buffers, the consequence is ...
0
votes
0answers
25 views

could I open a terminal in the quickfix window instead of in a buffer?

I could use :ter to create a terminal in the vim window, but it seems to be opened in a buffer, and I could see the title of this terminal buffer if I use air-line. I wonder if I could open the ...
0
votes
0answers
20 views

Lots of NetrwTreeListing in my buffers list

I'm using Netrw plugin to explore files in my Vim. After using it for a while in a single sessions I have literally hundreds of unlisted buffers named NetrwTreeListing <number>. Why is it ...
0
votes
1answer
21 views

How come the splitted window failed to update its shapes along with the whole window

By the normal mode command :vs, I split the current buffer into two equally sized buffers. Then I resize the whole terminal window and only find the left portion of the screen remains the same as ...
1
vote
2answers
203 views

Switching buffers in VI while skipping any terminal in VI 8.1

I am using multiple files within the same tab and when I switch buffers using :bn I reach the terminal, at which point I have to issue the command again to move. Here is the catch, I am using keymaps ...
1
vote
1answer
30 views

How to add files to argument list without adding them to buffer list?

I would like to run some command on each .js file of project. Argument list seems like a perfect usecase for it. :arga **/*.js :argdo 'some_command' The problem is that using :arga **/*.js adds all ....
0
votes
2answers
34 views

Maximizing gVim on Windows 10 while also restoring all open files / tabs

On Windows 10, I installed gVim 8.1, so far I have made the following progress to make it usable for me: I made changes directly to _vimrc file, in spite I know there is also a gVim specific ...
1
vote
0answers
33 views

Strange behaviour when switching buffers in vim (syntax highlighting and keymaps cease to work until .vimrc source)

I have set up the following list of commands to switch buffers: (in a .vim file i source from my .vimrc to keep it organised) ...
0
votes
1answer
30 views

How to open file based on current file path

Is there a way to retrieve the current filepath, modify it, and open the result? To be more specific, let's say I'm editing ./some/file/awesome.controller.ts Then I'd like to automatically open ./...
1
vote
2answers
54 views

Overwrite buffer with system clipboard by ex command

I'm trying to find the right ex command to overwrite the current vim buffer with the system clipboard. The relevant system clipboard register is "+ in this case. My first guess was to use :%+p; i.e. ...
1
vote
0answers
130 views

Why does “E89: No write since last change” error not occur when commands are joined with bar?

I have :set hidden set in my ~/.vimrc. First I did this: vim foo bar :bnEnter ihelloEsc :bpEnter :bd#Enter The :bd# command leads to this error: E89: No write since last change for buffer 2 (add ! ...
8
votes
1answer
134 views

Why does :bd # delete the current buffer when no alternate buffer exists?

Here is how I reproduce the behavior I am observing. First, I enter this command: echo aaaaa > a vim a In Vim, I enter these commands: :ls :e # :echo bufname('#') Here is the output of the ...
0
votes
1answer
58 views

Is it possible to not have the same buffer open in multiple windows?

When we have a buffer open, and we open a new one with :split or :vsplit, if in any opened window we execute :bprev or :bnext, we could have the same buffer open at the same time in both windows. Is ...
0
votes
1answer
85 views

How to make the edit command open the file in the first non NERDTree buffer window

so whenever I open a file be it from using FZF, NERDTree or directly using edit, IF I happen to be in the NERDTree buffer it will open the file in the buffer. How do I make it so that whenever a ...
0
votes
0answers
37 views

How to set system cut-buffer clipboard as default in vim? [duplicate]

I usually want to share my clipboard between vim and other applications (like a web browser) so that I can yank/paste the information easily. So questions, How do I set the default behavior of vim ...
0
votes
0answers
20 views

Automatically write namespaces to new files (PHP)

I'm trying to make my editor work like other IDEs I'm used to. When creating a new file, I want to use the current filename register to find out the proper PSR4 namespace (and maybe parse composer....
2
votes
1answer
29 views

Change the name of a buffer in the background

I know I can use the :file command to change the name of the current buffer. Is there some way to change the name of an arbitrary buffer without switching to that buffer?
4
votes
1answer
201 views

Switch to viewport by name?

Typing :buffers gives a list of loaded buffers. Can I switch to a viewport that views one of those buffers by name? I know that :buffer NAME will load the named buffer in the current viewport. But I ...
2
votes
1answer
51 views

How to see if Vim has a file opened or not, or has a buffer open

Sometimes I want to open vim in preparation of opening a file in the directory tree. So i start it without a file: vim Then I use a map to open NERDTree: :NERDTreeFind<CR> This fails with ...
1
vote
1answer
75 views

Manipulate content of background (non-current) buffers from vimscript

Given some text stored in a variable, is it possible to write this text to an arbitrary buffer in the background? I ask about buffers specifically because I'm aware of writefile(), but I want to write ...
0
votes
1answer
140 views

Change buffer focus on enter?

I set up my .vimrc so that NERDTree automatically shows up on the left when opening vim for editing a file (autocmd VimEnter * NERDTree). This means, that NERDTree is the active buffer instead, and I ...
0
votes
1answer
34 views

How to add a fallback when :b buffer change fails

I have 2 ways to open a file for editing: :b <filename> to switch to an opened buffer -- imagine that I have a lot of folders containing index.html so by using :b I know I am working on the one ...
0
votes
1answer
50 views

How do I open a quickfix result in a new buffer?

When I have the quickfix window open (e.g. from :grep foo<cr>:cw) I can go to the window and hit Enter and it will open the file under the cursor in an existing buffer. Is there a way to open ...
2
votes
0answers
92 views

:q will not let me exit vim [closed]

When using nvi I have a file that I want to exit but everytime I use :q it just opens this thing and I can't exit out of it. Does anyone know what it is and how to get rid of it? Note: this is nvi ...
2
votes
1answer
48 views

How do I jump to the next search result in a different window?

Sometimes I have two windows open and I search for a word that appears in both. Hitting n only cycles through the results in the active window. It'd be really convenient to somehow jump to the next ...
0
votes
0answers
20 views

Nofile buffers that also track `modified` status

I am writing a Vim plugin that loads documents from a database into Vim buffers. I have set up "save" mappings that can write the altered records back to the database. I would like these buffers to ...
0
votes
2answers
154 views

neovim: how to close the terminal buffer by just pressing enter?

NVIM v0.2.2 Build type: Release LuaJIT 2.0.5 Compilation: /usr/local/Homebrew/Library/Homebrew/shims/super/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_MSGPACK_HAS_FLOAT32 -...
0
votes
0answers
52 views

Powerline buffers bar breaks when I switch color schemes

I am using iTerm2's default 'Light Background' terminal profile. I am using the latest version of vim-airline for my powerline bar and whatnot. When I use the :color command, even to "switch" to the ...
0
votes
0answers
49 views

Execute an autocmd inside a particular window split

I am trying to achieve a layout similar to the one below. I can do it manually but I want Vim to start in this layout. There are three screen splits. On the left, NERDTree is displayed. On the top, ...
0
votes
0answers
35 views

How to display a list of buffer in tabline or statusline without messing up with tabs

I am wondering if there is a way that I can have a constant list of opened buffers being displayed somewhere like tabline or statusline? I know vim-airline provides a tabline functionality. But it ...
1
vote
1answer
39 views

How to write a buffer which isn't the current to a temp file?

I would like to write a buffer which isn't the current buffer to a temp file. I have found two ways to do this: (assuming buffer 42 is the one to be written) Either use writefile(): call writefile(...
1
vote
1answer
81 views

Is there a way to lock a buffer from changing?

I have NERDTree open all the time and sometimes I forget I have my cursor in there and I try to switch my main window to another buffer and it switched the NERDTree one, which get super annoying after ...
0
votes
1answer
26 views

Is there a way to change the “current buffer”--the one that gets defined when I use “n” and “N”?

Once in a while I do work on a large number of files (i.e. today it was about 1,700) using a command such as: gvim `find . -name *.cpp` and I use the "n" (no changes) or "wn" (made a change) to go ...
0
votes
1answer
33 views

Don't reset vim tab to the beinning line

I have a question about tabs within vim and I'm using VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jan 17 2018 20:33:56) Included patches: 1-1255 Compiled by _pbuild@amd64.ports.openbsd.org tab ...
2
votes
1answer
63 views

How to execute a bash command from the normal mode and send the output on a different buffer?

I have a bash_file that operates on a latex file to produce a pdf. #!/bin/bash /usr/bin/pandoc/ filein.md -t beamer -o fileout.md ; /usr/bin/pdflatex/ fileother.tex ; /usr/bin/evince fileother.tex ...
1
vote
1answer
58 views

Syntax highlighting gone when using buffer

At work I usually keep only a few files in buffer, typically a Yang file, a Java file, and possibly something like a readme file. In such an environment, the Yang syntax highlighting does not work. ...
1
vote
1answer
188 views

Close multiple buffers interactively

Is there a way to view a list of open buffers and close several buffers without leaving that list? The best I know of for closing multiple buffers is using :ls to get a list of buffers, memorizing ...
0
votes
2answers
58 views

Add new buffer after current one

How can I create a new buffer just after(next to) the one I am on ? Let say I have three buffers opened (1, 2, 3) and I am (my cursor) currently in buffer 1. If I add a new buffer (with :edit for ...
3
votes
1answer
546 views

Copy output of bash command to system clipboard?

If I run: :w !node It will take my current buffer and send it to stdin and run the code in node. If I run: :redir @+ | echo "bob" | redir END It ends up on the system clipboard. But if I want to ...
1
vote
0answers
75 views

vim + jq :: how to format possibly incorrect text in unsaved file [duplicate]

This is very similar to how-to-run-bash-command-over-current-file-and-replace-buffer-with-result But I need to know how I can access current buffer when the file does not exist? i.e. I open vim goto ...
3
votes
2answers
91 views

call function in context of buffer

How can I call a function in vimscript in the context of a specified buffer? For instance, line2byte works for the current buffer. I am implementing a callback, where I receive a buffer number as an ...
0
votes
2answers
197 views

How to go to previous open buffer from vim command line?

I am trying to write vim function which should make window to go to previous open buffer. How can I do it from command line? My first suggest was to find out some CTRL-O command line alternative.
1
vote
1answer
62 views

Set window-local option in every buffer/window

How do you set a window-local option (number) in literally every window/buffer? I was to bind <leader>t to toggle the number option in every buffer, using a global variable g:linum_status as ...
0
votes
1answer
148 views

vim: count how many buffers been modified?

Pursuing a vimscript function or expression that count how many buffers been modified. i.e., how many buffers :bm could switch to, given that option hidden is set. == Edit == In the hope of used ...
4
votes
2answers
137 views

How to escape from file browsing mode?

I just found out that we can use :e . to enter the browsing mode and then can choose file what we like. But I don't know how to get back to already opened file without choosing it again. I tried &...