What are the benefits of using vim buffers over separate instances in several terminals?

I've been using vim for quite some time, but at the same time I've been using tiled window manager (dwm/xmonad), which means that if I wanted to open a new file I would just launch a new terminal and start a new vim instance.

The same could be said for tmux + vim situation (which is probably much more common).

As I have very little experience with them, the only benefit I can see of using vim buffers is sharing registers so I can yank a piece of text and paste it elsewhere; but I can do that with "+ even across terminals.

Similarly it gives me another level of customization of the layout (vim buffers in vim windows in vim tabs in tmux panes in dwm tiles)… but if the layout is pretty much equivalent at each layer, this would be a neutral benefit.

Are there any other benefits I should be aware of?

closed as too broad by muru, GAD3R, Archemar, Eric Renouf, X Tian Jan 6 '17 at 14:05

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • bufdo might be one of them – iruvar Jun 5 '16 at 14:22
  • Sharing completions - vi.stackexchange.com/questions/7899/… – JigglyNaga Jun 6 '16 at 11:29
  • when no x server is running, using "+ can become trickier. Tmux has its own clipboard with copy pasting, but it will not work well when copying from ncurse based applications. Anyway, sometimes, vim splits will appear like for the quickfix window, so you'll have to use them. – Vincent Nivoliers Jun 16 '16 at 11:53
  • 1
    Think of Vim buffers as of tabs in a browser. Some people (including myself) are using Vim as a main editor for coding. In that case, you want to have all files for a given project open in the same instance. It's easier to navigate, to jump between them etc. If you are using additional plugins everything works nicely together (sidebar, fuzzy find, completion, alternate file and much more). Opening new Vim for opening a new file is like starting a new instance of an IDE to edit another source file. – pbogut Dec 12 '16 at 18:40
  • You may be interested in Why do Vim experts prefer buffers over tabs? – Wildcard Jan 6 '17 at 4:37

This is an old question, but still trying to answer this one. The buffers are a native vim feature and so provides better integration with vim compared to tmux/dwm. I am also well versed with twm and dwm.

I use buffers with 10-20 files in the buffers. I cannot imagine opening all the 10 files in dwm and then cycling through the terminals to find the files I am interested in. If the file is in buffer I can use vim buffer search to quickly find the file. Also buffer provides other benefits as listed.

  • copy/paste between buffers
  • executing a single command on all the buffers.
  • Opening buffers in windows if needed for quick preview
  • switching quickly between buffers using vim buffer search :b {pattern}
  • switching to the alternate buffer using vim shortcut key C-^
  • changing buffer to a tab by opening it a window and then changing that window to a tab.
  • Deleting a buffer if I do not need it using :bdel
  • Switching to a buffer using number. Good for going to the first file using :b1
  • Operating on a range of buffer using b m,n option

One of the workflow in dwm I love is monocle i.e a single window. Using vim buffers is like that monocole mode. Anytime I want to move to a different file I just do a partial search for that file and jump to it.

I am a big fan of dwm. Multiple windows are fine sometime. But most of the time I will just stick with two windows one for VIM and other for command line. I will generally create a lot of temporary windows to run one or two command, but then I will kill them. The reason I do this is that my brain cannot remember all these n number of windows and so I have switched to just two windows for my coding needs.

Not the answer you're looking for? Browse other questions tagged or ask your own question.