If you’re a programmer like myself who has taken college courses or picked up the trade through books and online resources, you may have come across a terminal-based text editor called vim. And you may have heard of tmux, which is a terminal program that produces virtualized consoles in useful formats.
This article is for the beginner. For the beginner who’s been using Sublime or Notepad++ and wants to make the first step to change.
Why you should try the combination of the two?
Tmux provides the virtual consoles to split and provide windows for movement around terminal UNIX systems. Vim has many keyboard shortcuts that speed development. Assuming that you have both Tmux and Vim, here are some commands to get started.
Tmux
To initiate Tmux on your machine, you must type in tmux. By default, machines will not have Tmux. You will need to install it.
tmux

After you have initiated Tmux, all commands and shortcuts with Tmux are triggered by pressing Ctrl-b
and another command.
Ctrl-b
Tmux Windows
Windows are very useful. Think of windows as alternative tabs that can be switched through Tmux shortcuts. Press Ctrl-b
and quickly press another one of these commands.
| Ctrl-b, then press c new window Ctrl-b, then press w list windows Ctrl-b, then press f find window Ctrl-b, then press , name window Ctrl-b, then press & kill window |
| Ctrl-b, then press n switch to next window Ctrl-b, then press p switch to previous window |
I use windows all the time. Create windows if you want easy tabs that can be switched through shortcuts. I enter Tmux, create one window to edit files and another window to run the file. Because I use git, I like to have a third window for pushing files onto Github.
Type in exit
to delete windows.
I use vim for editing the first window.

| Ctrl-b, then press c to create another window |
I typically use a second window for running the file or going into other directories and editing files.

| Ctrl-b, then press c to create a third window |
Lastly, I use one window for using git.

| Ctrl-b, press n or p to switch between these windows |
Tmux Panes
Panes can be thought as sections of the terminal window. You can set up vertical and horizontal splits with panes. Panes on Tmux are used more for having one bird’s eye view of the directory structure in one pane while editing files in the other pane.
| Ctrl-b, then press % vertical split Ctrl-b, then press " horizontal split |

You can use Ctrl-b
with the directionals to switch between panes.
| Ctrl-b, then press left to move to the left pane Ctrl-b, then press up to move to the upper pane Ctrl-b, then press down to move to the downward pane Ctrl-b, then press right to move to the right pane |
I don’t usually use the Tmux panes when working with Vim. I normally only use Tmux windows, and in each of those windows, I tend to split with Vim panes instead. Vim panes allow you to copy and paste easily to other Vim panes.
Vim
Vim is a powerful customizable terminal text editor. It’s especially great for editing text on remote machines. Let’s go over the basic commands to edit in Vim.
vim filename
| i to go into insert mode to insert words ESC to quit modes (insert is a mode) :w to save :q to quit :wq to save and quit :x to save and quit |
Vim Panes
When I use Vim, I use other shortcuts for traversing through the files that we won’t get in this article. We’re talking about workflow. I use :vsplit filename
to open another one of my files on a separate screen.
:vsplit filename.txt


| Ctrl-w, then press h or left to move to the left screen Ctrl-w, then press j or up to move to the upper screen Ctrl-w, then press k or down to move to the downward screen Ctrl-w, then press l or right to move to the right screen |
Alternatively, Vim uses Ctrl-w
as it’s shortcut trigger key for splitting windows.
| Ctrl-w, then press v to split vertically Ctrl-w, then press s to split horizontally |
Copying and pasting with Vim
To copy and paste within vim, you need to enter Visual mode or Visual Line mode.
| v to enter Visual mode Shift+v to enter Visual Line mode |
Visual modes are used for manipulating the file in a number of ways such as copying and pasting. Once in Visual mode, you can copy, paste, and delete across panes, which comes to be really useful for editing multiple files.
| y is to copy d is to cut p is to paste |
The difference between Visual Line mode and Visual mode is that line mode manipulates lines while visual mode manipulates characters one at a time. I can copy across Vim panes:

Working with both
Vim has many more shortcuts for moving around the text editor, but as for my workflow with Vim, I normally use Tmux for windows, switching between instances of vim running. I use Tmux normally to hold other windows where I can move around directories or use other programs like git. Try the two together and see what fits right for you.