Skip to content
This repository was archived by the owner on Feb 17, 2026. It is now read-only.

Latest commit

 

History

History
232 lines (181 loc) · 6.78 KB

File metadata and controls

232 lines (181 loc) · 6.78 KB

Tmux

Install

Tmux

Arch Linux

tmux latest noaur
urlview-xdg-git latest

TPM - Tmux Plugin Manager

It can be installed from AUR too, but as it manages plugins, it seems to me better for it to manage itself.

I’m using standard XDG dir structure.

git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm

Key bindings

Main prefix is Ctrl+A so every other keybinding need prefix first:

Windows and panes

I’m using classic Vim like keys. I switched to tmux-pain-control which you can check for all keybindings.

Split window horizontally
-Split window vertically
hSwitch to pane: left
lSwitch to pane: right
jSwitch to pane: down
kSwitch to pane: up
HMove pane to far left
LMove pane to far right
JMove pane to far down
KMove pane to far up
Alt+jNext window
Alt+kPrevious window
wSwitch between windows with preview

Sessions

sList of sessions

Clipboard

EscSwitch to copy-mode
FSwitch to copy-mode with jump plugin
yYank in copy-mode

Other goodies

uList all URLs in buffer

Tmux management

RReload Tmux config
IInstall plugins
UUpdate plugins

Configure

Prefix key

set -g prefix C-a

Status bar

#set -g status-right ''
set -g status-right '#h (#(uname -r))'

# Terminal emulator window title
set -g set-titles on
#set -g set-titles-string '#(id -un)@#H [#S:#I.#P #W]'
set -g set-titles-string '#H [#S:#I.#P #W]'

setw -g window-status-current-format "#I:#W#F"
setw -g window-status-format "#I:#T"

Config

# Change prefix key to Ctrl+a
unbind C-b
set -g prefix C-a

# Last active window
unbind l

# Copy mode
unbind [
bind Escape copy-mode

# Use Vi mode
setw -g mode-keys vi

# More straight forward key bindings for splitting
unbind %
bind | split-window -h
unbind '"'
bind - split-window -v
bind v split-window -v

# use the vim motion keys to move between panes
bind j select-pane -D
bind k select-pane -U
bind h select-pane -R
bind l select-pane -L

# move pane to the far right/left/bottom/top
bind H splitw -fhb \; swapp -t ! \; killp -t !
bind L splitw -fh  \; swapp -t ! \; killp -t !
bind J splitw -fv  \; swapp -t ! \; killp -t !
bind K splitw -fvb \; swapp -t ! \; killp -t !

bind -n M-k previous-window
bind -n M-j next-window

bind -n M-left previous-window
bind -n M-right next-window
bind -n M-h previous-window
bind -n M-l next-window

# Notifying if other windows has activities
setw -g monitor-activity on
set -g visual-activity on

# Clock
setw -g clock-mode-style 24

set -g base-index 1

#bind -n F8 command-prompt
# quick view of processes
bind '~' split-window "exec htop"

# http://unix.stackexchange.com/questions/26548/write-all-tmux-scrollback-to-a-file
bind-key P command-prompt -p 'save history to filename:' -I '~/tmux.history' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer'

# udržuje aktuální proměnnou při attachnutí sessiony
set-option -g update-environment "SUDO_USER"

set -g default-terminal "screen-256color"

#setw -g window-status-current-format "#(hostname) #I:#W#F"
#setw -g window-status-format "#(hostname) #I:#W#F"
#set -g terminal-overrides 'xterm*:smcup@:rmcup@'

# join pane vertically or horizontally with menu
bind-key          S choose-window "join-pane -v -s "%%""
bind-key          V choose-window "join-pane -h -s "%%""

Plugins

Plugin manager :)

set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'seebi/tmux-colors-solarized'

# necessary plugins
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-pain-control'

Plugins in evaluation

Sessionist

This should allow me to easily manage sessions

M-CUpdate current path
$Rename current session
gGo to session
CCreate new session by name
XKill current session without detaching tmux
SSwitches to the last session
@Promote current pane to session
Ctrl-@Promote current window to session
mMark pane
Join currently marked pane to current session/window and switch to it
t-- horizontally
t∣- vertically
t@- fullscreen
bind M-C attach-session -c "#{pane_current_path}"

set -g @plugin 'tmux-plugins/tmux-sessionist'

More

set -g @plugin 'tmux-plugins/tmux-sessionist'
set -g @plugin 'tmux-plugins/tmux-urlview'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'schasse/tmux-jump'
set -g @jump-key 'F'

Logging

PStart/stop logging in the current pane
Alt-pScreen capture
Alt+PSave complete pane history
set -g @plugin 'tmux-plugins/tmux-logging'

Tmux resurrect & Tmux continuum

Beware: because of continuum plugin autosaving, this plugin should be last one before TPM initialization.

Ctrl-sSave
Ctrl-rRestore
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# set -g @continuum-restore 'on'

Initialize plugin manager

This should be latest line in config file.

run '~/.config/tmux/plugins/tpm/tpm'