5 ms·
To all the vim people I have one question: how do you deal with multiple buffers? I'm so attached to the emacs way of buffer handling that I just can't get com
by adestefan 15y ago
To all the vim people I have one question: how do you deal with multiple buffers?
I'm so attached to the emacs way of buffer handling that I just can't get comfortable with vim. It's really the one thing that I just don't get in vim.
- gbog 15y agoI have F5 bound to :bn , it let me roll buffers, then I use :bd to remove a buffer. I open new files with :Explore.
- adestefan 15y agoThe problem I have it that C-x-b defaults to jumping back to the previous buffer. So I can just bang C-x-b<RET> and be back to where I was before. I can't find the same thing with vim. It's a very rare use case for me to want to roll through all the open buffers.
- mcantor 15y agoYou can use :ls to view all buffers, and if you do :b and start typing the filename of a buffer, you can get completion suggestions with tab, or just hit enter to jump to the first file that matches what you've typed so far. Use Ctrl-6 (also referred to as Ctrl-^, C-6 or C-^) to swap between your current buffer and the "alternate" buffer, which is usually the last buffer you were looking at. Use Ctrl-o and Ctrl-i to track up and down the "jump list". C-o is another good way to get back to the buffer you were just looking at, like C-6.
- iron_ball 15y agoThere is also a wealth of plugins for buffer switching; I like FuzzyFinder's :FufBuffer command. Invoke it and the most recent buffer will be at the top, so you can hit enter immediately.
- mcantor 15y agoI never really saw the utility of the plugins. The functionality you described in your post, for example, is already implemented by C-6.
- mcantor 15y agoI map H and L to custom functions that navigate to the next or previous tab or buffer, depending on what's open. https://github.com/mcantor/dotfiles/blob/master/vim/.vimrc#L289 https://github.com/mcantor/dotfiles/blob/master/vim/.vimrc#L...
- faboo 15y agoI find these two options a must (they're in my .vimrc): set hidden set switchbuf=useopen Beyond that I just use the basic commands to navigate buffers: :ls, :b, :bl, and ctrl-^ Ctrl-^ (switch to the "alternate" (previous) file) is the one a I use the most really. Especially since windows each have their own alternate file. Generally, I find remembering buffer numbers in a long-running session no more difficult than remembering inventory letters in Angband ;-)