tmux rotate-window
Rotate window is the main way that I navigated tmux before I learned select-pane. It allows you to change your focused pane, or rotate the position of the panes easily.
Default keybindings
...
All posts with the tag "tmux"
Rotate window is the main way that I navigated tmux before I learned select-pane. It allows you to change your focused pane, or rotate the position of the panes easily.
Default keybindings
...
When you get many splits going in tmux sometimes its time for a new layout. There are four layout strategies that I use, main-vertical, main-horizontal, even-vertical, even-horizontal. Almost always I am useing the main ones with mod plus a or mod plus shift a keybindings.
# Select Layouts #――――――――――――――――― bind -n M-a select-layout main-vertical bind -n M-A select-layout main-horizontal bind -n M-E select-layout even-vertical bind -n M-V select-layout even-horizontal
...
Resizing panes in tmux can be quite difficult in default tmux, I use a set of keybingings to help resize panes in the rare occasions that I do need just a bit more space. I set the keybinding to the same as my split navigation bindings but shifted. They are very vim like (h,j,k,l).
# resize panes #――――――――――――――――――――――――――――― bind -n M-H resize-pane -L 2 bind -n M-L resize-pane -R 2 bind -n M-K resize-pane -U 2 bind -n M-J resize-pane -D 2
Most often when I need to resize panes I just grab the edge of the pane with my mouse. Yes the mouse, its not that often that I actually need to change the size of a pane.
...
Choose tree is a powerful tmux utility that provides a graphical interface to preview all sessions, windows, and panes, move between them kill them, move them and much more.
The default keybinding
...
The prefix key is an essential part of tmux, by default all of tmux’s key-bindings sit behind a prefix. This prefix is very similar to vim’s leader key. It is common for folks to change the default C-b (control b) to C-a or if they are a vim user something to match their vim leader key.
set -g prefix C-Space bind Space send-prefix
A few of the essential default key-bindings.
...
splitting panes is a core feature of tmux. It allows us to split the terminal vertically or horizontally into new panes.
bind -n M-s split-window -c '#{pane_current_path}' bind -n M-v split-window -h -c '#{pane_current_path}' bind -n M-X kill-pane
🗒️ note that ‘#{pane_current_path}‘will keep the split in the same directory as it’s parent, without this it will default to your home directory.
...
An ultimate productivity key-binding in tmux is one to switch to the last session. I use this to quickly get between sessions really quick. Often I am working and need to lookup a quick note, or copy something into my notes, then get back to where I was quickly.
bind -n M-b switch-client -l
I think of this hub and spoke model, and use last-session to quickly drive it.
...
Tmux popups are actually floating windows that you can drag around the screen. They always open in the middle (by default) when you open them, no matter where you leave them.
Here are a couple of keybindings I use to open up popup windows.
...
Tmux-popups are a great feature that is relatively new to tmux, many repos such as the standard ubuntu repos do not have it. Popups came in 3.2a, if your package manager does not have it, you can follow the tmux’s install instructions to build from source.
# open a popup scratchpad bind -n M-g display-popup -E "tmux new-session -A -s scratch"
...
These are the notes that I used as I set up my first ever ubuntu desktop.
sudo apt install gnome-tweaks
I ran this, but have no idea if it had any effect as the theme did not show up until I relogged.
gsettings set org.gnome.desktop.wm.preferences theme Nordic
What I think actuagnome terminal showing scrollbar in tmuxlly worked was
...
In 2021 I changed the way I navigate between tmux sessions big time. Now I can create, kill, switch with ease, and generally keep work separated into logical groups.
Since making this post, I have made ~20 other posts in short form that all have a YouTube video to go along with them you can find them all on my tmux-playlist.
I took Chris’s tmux course in December 2020 and it was fantastic. Even as a seasoned tmux user, I learned quite a bit. Before the course, I was proficient in navigating within each of my tmux sessions but rarely started more than one session. A few months later, I have adopted a lot of what I learned from Chris and made it my own.
...
I do much of my work from tmux, I love it so much that I want to setup some functionality that puts me in tmux even if I didn’t ask for it.
Bash function to check if the shell is in a tmux session.
in_tmux () { if [ -n "$TMUX" ]; then return 0 else return 1 fi }
I often open up vim to do some quite edits, but before I know it I have several splits open and I need access to another shell utility, but I forgot to start in tmux. This function makes sure tht I start in tmux everytime.
...
This is how I script a tmux layout
Throw that mouse Away its time to setup some keyboard shortcuts.
These sortcuts were the baseline for switching from tmux/vim to vscode. Most folks posts I was able to find gave great tips on replacing vim, but very few have focused on the hackability of tmux. tmux allows me to rapidly fire up a workspace, create new windows and splits. Then When I switch tasks I can leave that workspace open and and jump right back in later exactly where I left off. There is nothing quite like it. The shortcuts listed here make the transition a bit better. The worst thing I found when using vscode at first was no way to switch between the terminal and editor without the mouse. This first set of keybindings solve that issue.
The worst thing I found when using vscode at first was no way to switch between the terminal and editor without the mouse.
...