Course Lessons
Keybindings Baby!
Now to configure Tmux, you'll need a configuration file! This file will live in your home directory at ~/.tmux.conf
Let's go ahead and create that now if you don't have one
nvim ~/.tmux.confOpen a new or existing tmux.conf file
Now we'll be making various updates to this file so it's nice to be able to reload our configuration easily. Let's set that up first.
unbind r
bind r source-file ~/.tmux.confbind "r" to reload our tmux.conf file
If you close and reopen tmux, you can try this out yourself by simply using the default leader key (Ctrl+b) and then the letter r.
Now that we can do that, let's convert our leader key to something more ergonomic. Instead of having to press (Ctrl+b), I use (Ctrl+s). This is partially because I have my Ctrl key where CapsLock typically is.
Let's see how we update the leader key.
# Set the leader key to Ctrl+s
set -g prefix C-sWrite this file with :w and then let's try to reload the configuration.
Press (Ctrl+b) + r to reload the configuration and then follow it up with a vertical split (Ctrl+s) + %.
Great – now we've got something that feels better and a way to make easy updates!
Now the next topic may be controverial. Mouse support! It's not for everyone but for those that want to be able to drag panes around, let's add it.
set -g mouse onTurn mouse support on to drag panes around
This is all fine and good but jumping between panes isn't the same as vim. Let's update the configs to get us speaking the same language.
# LDUR
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -ROnce this file is saved, you can simply reload your tmux.conf file with (Ctrl+s) + r. Now if you open a new pane, you can start navigating between panes just the same as you would line in Neovim.
Vim motions FTW — super easy!
You've completed this lesson!
You completed this lesson less than a minute ago.