Terminal Workflow

This is a post about my workflow when editing files in the terminal.

When editing files quickly I usually resort to vim. It requires a lot of muscle memory but hey, one needs to train their reptile brain, right.

Tmux config

So I use tmux and vim so you need those two installed. My tmux config is really simple. I changed the leader key to ctrl+q for easy reach on my keyboard. I used to have ctrl+a but that conflicted with my habit to use that keyboard combo to go to the beginning of a command.

Create or edit ~/.tmux.conf and add this:

1set-option -g prefix C-q
2set -g mouse off
4set -g status-bg black
5set -g status-fg white


First start tmux and then split the screen horizontally. Then decrease the size of the lower screen.

2ctrl+q "
3ctrl+q  arrow down #hold ctrl+q while pressing arrow down key

You will end up with something like this:

Then in the upper half of the screen I open the files I want to work with

1vim -O file1 file2

Then you will end up with something like this:

As you can see you can edit files in the upper part of the screen and issue commands in the lower part.

Some basic commands

If you want to open another buffer (aka file in vim) you can do:

1ctrl+p #assuming you have that installed in vim, else use :e

Then you can just choose which buffer you want to display with :bd, :bn and so on. If you want to delete a buffer then just type :bd

Command What it does
:bn Display next buffer
:bp Display previous buffer
:bd Delete buffer
:ls List buffers

And some other useful navigation commands. It might take some practice because you need to memorize two sets of commands. But the reward is big, I promise.

Command What it does
u Undo
ctrl+r Redo
ctrl+ww Navigate to buffer
:vsplit Split vertically
ctrl + w _ Set height of split to max
ctrl + w | Set width of split to max

Here some tmux commands:

Command What it does
ctrl+q arrows Navigate windows (tmux)
ctrl+q % Split vertically (tmux)
ctrl+q " Split horizontally (tmux)
ctrl+q z Toggle window full screen (nice one!)