-
Notifications
You must be signed in to change notification settings - Fork 5
tmux Notes
π¨ Getting truecolor 24 bit color support working in tmux is a total pain in the ass. The tmux server MUST be restarted when adjusting the below settings. Reloading the configuration is not enough!
Add the below lines to the tmux.conf
file to get truecolor working. π€
set -g default-terminal "xterm-256color"
set-option -ga terminal-overrides ",xterm-256color:Tc"
Neovim will whine π about the terminal being explicitly set to xterm-256color
screen256-color
handles italic font a little better within tmux as opposed to usingxterm-256color
but truecolor support is lost when setting tmuxTERM
toscreen256-color
within tmux.
To get italic font working within tmux, click here
The terminal emulator iTerm etc must be able to support italic font.
To add an italic terminfo entry for a particular user
mkdir ~/.terminfo
Create xterm-256color-italic.terminfo
and put the below contents within it or paste the contents from the system clipboard into the file.
xterm-256color-italic|xterm with 256 colors and italic,
sitm=\E[3m, ritm=\E[23m,
use=xterm-256color,
or
pbpaste > /path/to/xterm-256color-italic.terminfo
Then create a tmux-256color-italic.terminfo
file and put the below contents within it or paste the contents from the system clipboard into the file.
tmux-256color|tmux with 256 colors,
ritm=\E[23m, rmso=\E[27m, sitm=\E[3m, smso=\E[7m, Ms@,
khome=\E[1~, kend=\E[4~,
use=xterm-256color, use=screen-256color,
pbpaste > $dots/terms/tmux/tmux-256color.terminfo
To install the newly created terminfo entries for this particular user.
tic -x -o ~/.terminfo $dots/terms/tmux/xterm-256color-italic.terminfo
tic -x -o ~/.terminfo $dots/terms/tmux/tmux-256color.terminfo
tmux.conf
set -g default-terminal 'tmux-256color'
set -as terminal-overrides ',xterm*:Tc'
And finally for the icing on the π
.vimrc
highlight Comment gui=italic
let &t_8f="\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b="\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors
If working with tmux on a system where tmux has just been installed and getting mouse support going before setting up a $HOME/.tmux.conf then run the below command
:set -g mouse on
To manually reload a tmux configuration file, ie. ~/.tmux.conf
prefix + :
:source-file ~/.tmux.conf
The above command is useful when there is not key binding set for reloading a tmux configuration file.
When using tic
to install custom term entries to get 24 bit truecolor support along with italics working a Linux box, and within tmux the below settings may need to be set.
When opening a
ncurses
based application, ie.mutt
on a Linux box the below error will more than likely be presented when trying to launch mutt.
Error opening terminal: xterm-256color-italic
To resolve the above error message, make sure ncurses-term
has been installed along with xterm
, and then set TERM
to xterm
in a shell configuration file, ie. config.fish
. For reasons I don't understand setting TERM
to xterm
allows mutt
to properly launch within iTerm.app through an ssh session to a Debian box. Β―\(γ)/Β―
tmux is short for terminal multiplexer
-
By default all tmux key bindings will require a prefix key sequence before they are active. The prefix is initially set as control+b
-
tmux can be used for a paired programming session, ie. two people can login to the same tmux session and edit the same files.
To start a new tmux session with a particular name
tmux new-session -s [session_name]
or
tmux new -s [session-name]
π‘ To create a new tmux session in a detached state
tmux new -s [session-name] -d
To list all the tmux commands
tmux list-commands
To list all the current key-bindings
tmux list-keys
To print a list of global options being set in tmux
prefix + : show-options -g
To list available tmux sessions
tmux list-sessions
or
tmux ls
To display a list of sessions known to the local box
The below key-binding works by pressing the prefix key combo, then pressing s
prefix + s
To attach to a tmux session using its name
tmux attach -t [session-name]
To kill a tmux session using its name
tmux kill-session -t [session-name]
To cycle through various pane layouts in tmux
prefix refers to pressing control + whatever key you have assigned ie. in my situation it would be control + s
prefix then spacebar
To detach from a tmux session
prefix + d
To get a list of all keybindings and associated commands that trigger these bindings
prefix + ?
When using the
-r
flag in conjunction with thebind
keyword in the.tmux.conf
file it allows one to repeat a command without having to repeatedly input the prefix
To get scroll back history when using tmux with iTerm2, see π³
To clear scroll back history for a tmux pane
Get into tmux command mode
prefix + :
:clear-history
To move grab a window from a separate session into the current session learn more
# move window from session into current active session
move-window -s $session_name:$window_index
To quickly jump between the previous and next window regardless of the window location within a session.
prefix+L
This will NOT jump between windows within the same session, but rather jump between previous and current window from the current and previous session.
To rename a tmux window
prefix+,
To move the current window to alternate position, ie. move window 10 to window 1 in the index of tmux windows
- Enter into tmux command mode
prefix+:
- Enter the below command
swap-window -t 1
The above command will move the current window to the right one position, and if the current window is the last window in the index of windows, then it will move it to window 1 within the index, and move all other windows accordingly.
To move the current window to the left by 1
:swap-window -t -1
To print a graphical list of available tmux sessions
prefix + s
To move the active window to a different session
:move-window -t [OTHER_SESSION]:
To move a different window from the same session to an alternate session
:move-window -s [CURRENT_SESSION]:[WINDOW] -t [OTHER_SESSION]
To move a pane within a tmux window to the right, learn more
prefix + }
To maximize a pane within a tmux window
prefix + z
To restore the pane to the previous size
prefix + z
To kill a pane within a window
prefix + x
To create a vertical split from the current pane
prefix + %
To create a horizontal split from the current pane
prefix + "
To break the current pane within a window into it's own window
prefix + !
βοΈ A single pane can NOT be broken into it's own window if it is the only pane within it's current window.
To bring the broken pane into the curent window use the below command syntax
:join-pane [session:window:pane]
To manage tmux plugins check out tpm
To manage sessions, windows, panes (including pane layouts), tmux-resurrect
- The first user on the system can start a tmux session
tmux new-session -s apples-and-oranges
- The second user on the system can connect to the existing session
tmux new-session -t apples-and-oranges -s user2session
- QUESTION > is it possible to run the same key binding in all panes within a tmux window?
- REVIEW > se > tmux > complete list of flags
- Read the following article about using shared clipboard to solve issues with cross system copy / paste.
-
figure out starting a interactive fish shell session within tmux, the$fish_users_paths
are duplicating.
If you find any of this info helpful on your journey π click that π βοΈ star button. It sure makes me feel warm and fuzzy π» on the inside.
-
Linux and macOS Operation Notes
- β macOS Op Notes
- π§ Linux Op Notes
- Vim & Neovim Notes
- git Notes
- π fish shell Notes
- ECMAScript Tooling
- π₯§ Raspberry Pi Notes
- asdf version manager Notes
- Bind9 Notes
- Creating a custom motd on Debian Jessie
- ECMAScript Tooling
- Email client Notes
- Email Server Setup Notes Postfix & Dovecot
- Emoji side quest
- fish shell Notes
- π₯ π€ git it got it good Notes
- git Notes
- Graphics and Image Processing Notes
- GUI text editor Notes
- π»π§ Homebrew and Linuxbrew formula Notes
- Linux and macOS Administration Notes
- Linux and macOS Troubleshooting Notes
- MacBook Pro Late 2013 Notes
- Vim & Neovim Notes
- Video Production Notes
- Python Notes
- radare Notes
- Raspberry Pi Notes
- Terminal Emulators
- Tmux Notes
- Web Browser Notes
- Weechat Notes
- Microsoft Windows Notes