Hacker News new | ask | show | jobs
by herewulf 1094 days ago
I used to use splits as some of the sibling comments describe. This was helped by bindings for C-j and C-k that would maximize the split when moved to (vertically). So, I had a stack of splits and I would rearrange them for relevance to each other as needed for faster switching. But it was still tedious going up and down the stack sometimes.

Then I discovered buffers which was life changing. Suddenly I could manageably switch between 10s of files and never really worry too much about closing them. Sessions are helpful too for truly long running editing and maintaining a "workspace".

The buffer pro tips are:

- Use :set hidden

- ^ to switch to last buffer

- Switch buffers with :ls which will stay visible after typing :b and you can switch by number, or you can switch by name with tab completion (even by going straight to :b). So, I can switch to IWouldRatherBeWritingSomethingElse.java with ":b IWo<TAB>".

There are plugins to make switching even easier with fuzzy finding and whatnot but the above is all vanilla vim so you can do all this on some random cloud host anytime. I can't recommend a plugin because before really settling on one, I switched my serious development to Doom Emacs which has very similar buffer semantics and switching bells and whistles.

Check out Drew Neil's awesome Vimcasts to see buffers in action. http://vimcasts.org/episodes/working-with-buffers/

1 comments

Thank you, this is helpful!
You're welcome!

One small correction: Switching to the last buffer is actually C-6 not ^ (ctrl + 6 rather than shift + 6). I realized that when actually sitting at a computer whereas my comment was typed on mobile. Whoops. It's all muscle memory by now!