Tips, tricks, help, and general discussion about the text editor Vim.
What's your workflow for editing multiple files? Buffers or tabs?
Hey folks,
Do all of you out there use buffers or tabs for editing multiple files?
I've been using vim for 4 years but have never gotten into using multiple vim buffers - I just open multiple tabs and keep things at 1 buffer / tab. I also didn't really see any usability advantage of buffers, felt that they were more difficult to manage than tabs, and was frustrated that people online seemed to be adding stuff to their configs to make buffers behave just like tabs would anywas.
I recently started a new .vimrc and am trying out a buffer-based workflow - I've found myself gravitating towards keeping more files open at a time in the projects I'm working on and doing the one buffer per tab thing becomes a PITA when switching between lots and lots of files.
What's your multi-file editing workflow? I'd love to hear about your setups.




Just lost my very long comment from my habit of hitting "Esc" after long paragraphs. Let's try this again...
I love buffers, and use them for all editing. To open multiple files, just chain the calls:
> gvim test.py test2.pyor splat them> gvim *.py.Once open, move back and forth using the
:bcommands::bnand:bpmove to the next and previous buffers,:bwfully closes the buffer (like clicking the exit button on the window),:b FILENAME(or FI<Tab> with tab completion) will select the buffer with that name, and:lswill list all buffers currently open.:b Nwhere N is the buffer's number in the:lsalso opens that buffer.This makes for easy splitting as well:
<Ctrl>wvsplits the window into left and right halves (vertical split),<Ctrl>wssplits into top and bottom (horizontal split), and these buffer windows can be nested arbitrarily. Moving between them is easy:<Ctrl>w+ [hjkl] (<Ctrl>wh, for example) moves the cursor and focus to the buffer in the "logical" direction.<Ctrl>w=will make the buffer split even for the size/shape of the window, which is great.I know there's other stuff related to buffers that I love, but I can't remember them right now.
Hi, I've been using buffers only.
This post gave me some insight:
vim buffers vs tabs
This howto helped me a lot with buffers:
buffer FAQ
AFAIK, the buffer concept came before the tab concept.
HTH