Multiplexing the terminal, huh? Tmux is a simple yet powerful way to work with multiple terminal based programs simultaniously. With Tmux one can ditch the mouse and use keyboard shortcuts to split panes and navigate between tabs of terminal workspaces making anyone a multitasking terminal master.
Tmux was installed in Part 1 of this guide and its dotfile config can be modified with NeoVim like so
Bah! This article starts with a fix?
On later versions of OSX accessing the system clipboard from within tmux became problematic. This command resolves that issue utilizing the
reattach-to-user-namespace tool already installed in
The obvious way to multitask is with tabs. It’s a great place to get started. These keybindings will make working with them more intuitive.
Ctrl tto open new tab
Ctrl Tto open new tab in same directory
Ctrl wto close a pane (and tab if only one pane)
A single tab can be split into multiple panes. Mastering panes not only makes the user look like a total terminal professional but can really boost efficiency. Combined with NeoVim this is as close as it gets to having your terminal act like the best parts of an IDE.
A small tweak on the community “standard” pane splitting hotkeys.
Ctrl b \to open new vertical split
Ctrl b |to open new vertical split in current directory
Ctrl b -to open new horizontal split
Ctrl b _to open new horizontal split in current directory
Unlike in previous parts of this series there isn’t much to extend in terms of functionality for Tmux. However, to get the most out of Tmux it’s ideal to install some well defined community made configurations.
Adding a plugin manager to Tmux is as easy as installing tpm (Tmux Package Manager) via the Terminal. This can be done with git subtrees so that when these dotfiles are cloned to other machines in the future tpm is ready to go.
With tpm installed we can now initialize it in our Tmux Config.
Ctrl b I will install any newly added plugins. A prompt will appear at the top of the terminal to show installation progress.
This corrects rendering NeoVim in color through Tmux, removes the escape key delay, configures utf8, and more.
Splitting and removing panes is easy, but what about moving between them? What if there are NeoVim panes open as well as Tmux panes?
With this simple plugin this new concern is no longer. Moving between NeoVim and Tmux panes now use the same shortcuts.
Ctrl h, j, k, or lto switch to split left, down, up, right
Much like vim-airline, this will give out lower tmux statusbar that powerline look. I’ve chosen gray but there are other options.
Part 5 will cover configuring iTerm2.A Modern Terminal Workflow — Part 5 / 5