Navigate Vim With Windows, Tabs and Buffers

05/18/20191 Min Read — In DevTools, Vim

First of all, prefer buffers over tabs. Josh Davis wrote a comprehensive blog post which explains why: Vim Tab Madness. Buffers vs Tabs.

I followed Josh's Solution #1 and added support for visualizing opened buffers with lightline-bufferline and added a key mapping for closing a buffer and moving to the previous buffer:

" Close the current buffer and move to the previous one
" This replicates the idea of closing a tab
nmap <leader>bq :bp <BAR> bd #<CR>

I also use Tim Pope's vim-unimpaired which already ships with shortcuts to move between buffers with [b and ]b.

Another useful plugin can be Chris Toomey's Vim Tmux Navigator.
My command shell runs per default inside of Tmux with st via sterminal, so these key bindings are useful for using Vim and the shell.

And Windows?

Sometimes I like to open two windows. For example, my command line window where npm/yarn runs, and an editor window. Per default, split windows have the same size.

You can resize them with CTRL+W.

[count]<C-w>> increases the width of the current window by count.

You could check the Upcase tutorial on Vim for all sorts of commands.

Further Reading