Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reopen buffer in vim?

Tags:

vim

I had some issues with XPTemplate vim plugin. Sometimes it yields with errors, and makes impossible to edit file. I heal it by doing following steps:

  1. Delete buffer
  2. Find closed file
  3. Open file again

How can I automate this process?

like image 647
Nikolay Fominyh Avatar asked Jun 26 '12 10:06

Nikolay Fominyh


People also ask

How do you open a buffer?

You can enter the buffer number you want to jump/edit and press the Ctrl-W ^ or Ctrl-W Ctrl-^ keys. This will open the specified buffer in a new window.

Where are Vim buffers stored?

For example, when you start VIM without supplying a file for it to open, VIM starts with an empty buffer. If you want to save the changes to that buffer, then you have to tell VIM what file to write those changes to. So again, a buffer resides in memory.

How do I open a new buffer in Neovim?

Create Buffer We can use the: :new , :vnew , :enew commands to create a buffer in a new window or split. To add a file to the buffer list without opening it, we can use the :bad , :badd commands. Another command :balt works just like the :badd command but also sets the alternate file for the current window to the file.

What is current buffer in Vim?

Buffers in vim are the in-memory text of files. Your window is a viewport on a buffer. You can switch between open buffers, this is similar to tabs in other editors. Vim does have a concept of tabs too, but they are slightly different, read more about tabs in the Windows section.


1 Answers

Depending on the situation, a forced reload via :edit! may already be enough. Otherwise, you could try :bdelete | edit #.

I would also inform the plugin author, if you suspect it's due to a bug in the plugin itself.

like image 110
Ingo Karkat Avatar answered Sep 19 '22 12:09

Ingo Karkat