• +43 660 1453541
  • contact@germaniumhq.com

Terminal, Byobu and Vim: A Match Made in Heaven


Terminal, Byobu and Vim: A Match Made in Heaven

When I had to choose a text editor, four years back it took me about a month to come up with a decision. I wanted to know what is the best text editor, that I am going to use for the rest of my life. This was no trivial undertaking. In the end, I had to choose between Sublime and Vim.

Vim won.

Vim won owing to multiple factors: terminal support, UltiSnips, and configuration that can be checked in. Today, as the title implies, we are looking at the terminal support.

Revisiting this decision, I still consider it one of the best tooling decisions in my development career. To explain, this is how my terminal looks right now, as I write this article:

terminal

Yes, I am writing this article in Vim (neovim to be exact).

Why am I ecstatic about it? Well, because everything plays really well together.

There are two tabs at the top. This is how I organize my server connections. Each tab is a unique server connection. This is the functionality provided by Terminal. What’s beautiful, is that using <ctrl-PGUP> and <ctrl-PGDOWN> allows me to quickly switch between the different sessions.

There are multiple sessions managed by byobu at the bottom of the window. Switching among them is possible using <alt+LEFT> or <alt-RIGHT>, or <ctrl-A> followed by the session number. Usually, I like to keep the session 0 for the root access if I am doing some administrative work. If splits are present, switching is possible using <shift-LEFT/RIGHT>, or <shift-UP/DOWN>.

And in vim itself, if multiple files are opened in split views, it’s again possible to switch among them using either <ctrl-w> followed by the arrow key, or simply: <ctrl-LEFT/RIGHT/UP/DOWN>.

But if you’re paying attention you noticed that none of these keys overlap. That’s by default.

So you are able to manage multiple servers with a single connection per server, each connection having multiple shells through byobu (tmux), with each shell in turn capable of editing multiple files via Vim. And you switch between all these views from the keyboard only.

Most of the time what I like is to split the current view, in the left panel to edit sources, and in the right panel use some sort of watcher.

And that’s not really possible without Terminal, Byobu, and Vim.