Homelab Troubleshooting

Tips on running a Linux server and docker.

User Tools

Site Tools


tmux

tmux configuration

tmux.conf
# Source the theme first
# source-file "${HOME}/git/tmux-themepack/powerline/block/cyan.tmuxtheme"
set -g set-titles on
# Set the terminal colors to 256
set -g default-terminal "screen-256color"
# set -g default-terminal "rxvt-256color"
# set -g default-terminal "tmux-256color"
# set -g default-command
 
# mouse control
set -g mouse on
# set status-keys vi
# set status-position bottom
# Set zsh as the default shell
# set -g default-shell /usr/bin/zsh
 
# lower command delay
set -sg escape-time 1
 
# Windows and panes start from #1
set -g base-index 1
set -g pane-base-index 1
# set -g renumber-windows on
 
# Change prefix key from Ctrl+b to Ctrl+A
unbind C-b
set -g prefix C-a
# Have ctrl-a a send ctrl-a to the app
bind-key a send-prefix
# Stop space from messing the layout
unbind Space
# Disabling the arrow keys
unbind C-Left
unbind C-Right
unbind C-Down
unbind C-Up
unbind M-Left
unbind M-Right
unbind M-Down
unbind M-Up
# Splitting panes
unbind '"'
unbind %
bind | split-window -h
bind - split-window -v
 
# Make popup window with remind quick inside
# bind C-r popup -w 90 "remind -s+1 /home/alexk7110/.reminders/reminders.rem"
# Save pane contents to file
bind C-s capture-pane \; save-buffer /home/alexk7110/tmux_pane_saved.txt \; display-message "Pane has been saved !"
# Choose buffer while pasting
bind v choose-buffer
# Ctrl+PgUp copy mode
bind -n C-PageUp copy-mode
 
# Increase length of history buffer
set-option -g history-limit 9999
 
# Monitor activity
setw -g monitor-activity on
set -g visual-activity on
 
# UTF8 fix for Arch at work (not needed after all)
# set -g utf8 on
 
# Vim cursor movement on copy mode
setw -g mode-keys vi
 
# Default display time of messages
set-option -g display-time 1000
# Display panes time
set-option -g display-panes-time 5000
# Reload config with C-a+r
bind r source-file ~/.tmux.conf \; display-message "Config reloaded!"
# bind r new-window -n 'rng' 'cd && ranger && tmux kill-window'
 
# Get all urls from pane and open them in urlview in a new window
bind u capture-pane \; save-buffer /tmp/tmux-buffer \; new-window -n "urlview" '$SHELL -c "urlview < /tmp/tmux-buffer"'
# Select panes using Alt+hjkl without a prefix
bind -n M-h select-pane -L
bind -n M-j select-pane -D
bind -n M-k select-pane -U
bind -n M-l select-pane -R
# Select panes using prefix+hjk
bind -r h select-pane -L
bind -r l select-pane -R
bind -r k select-pane -U
bind -r j select-pane -D
# Resize panes 5 blocks using Alt-hjkl
bind -r M-h resize-pane -L 5
bind -r M-l resize-pane -R 5
bind -r M-k resize-pane -U 5
bind -r M-j resize-pane -D 5
# Resize panes using C-hjkl
bind -r C-h resize-pane -L
bind -r C-l resize-pane -R
bind -r C-k resize-pane -U
bind -r C-j resize-pane -D
# Select panes using Alt+ Arrow Keys
#bind -n M-Left select-pane -L
#bind -n M-Right select-pane -R
#bind -n M-Up select-pane -U
#bind -n M-Down select-pane -D
 
# Select previous and next windows with HL
bind -r H select-window -p
bind -r L select-window -n
 
## Create new window and name it
bind-key C command-prompt -p "Name of new window: " "new-window -n '%%'"
#
# SPECIAL Shortcuts
# Ctrl+\ open new window for bookmark surfing
# bind C-\ new-window -n bookmarks -c $HOME \; \
#    send-keys 'fzf-surfraw | awk '{print $2}' | xargs w3m && tmux kill-window' 'Enter'
 
# tmux 2.4 or higher examples =====================
# bind-key -T copy-mode-vi 'o' send-keys -X copy-selection \; new-window -n google \; send-keys -t google 'sr google "$(tmux show-buffer)" && tmux kill-window' 'Enter'
# bind-key -T copy-mode-vi 'i' send-keys -X copy-selection \; new-window -n imagegoogle \; send-keys -t imagegoogle 'sr imagesgoogle "$(tmux show-buffer)" && tmux kill-window' 'Enter'
# bind-key -T copy-mode-vi 'p' send-keys -X copy-selection \; new-window -n wikipedia \; send-keys -t wikipedia 'sr wikipedia "$(tmux show-buffer)" && tmux kill-window' 'Enter'
# bind-key -T copy-mode-vi 'u' send-keys -X copy-selection \; new-window -n youtube \; send-keys -t youtube 'mpsyt /"$(tmux show-buffer)" && tmux kill-window' 'Enter'
bind-key -T copy-mode-vi 'O' send-keys -X copy-selection \; new-window -n w3m \; send-keys -t w3m 'w3m "$(tmux show-buffer)" && tmux kill-window' 'Enter'
 
# translate, dictionary, text to speech
# bind-key -T copy-mode-vi 't' send-keys -X copy-selection \; new-window -n translate \; send-keys -t translate 'translate-shell es "$(tmux show-buffer)" | w3m && tmux kill-window' 'Enter'
# bind-key -T copy-mode-vi 'd' send-keys -X copy-selection \; new-window -n dict \; send-keys -t dict 'translate-shell -d "$(tmux show-buffer)" | w3m && tmux kill-window' 'Enter'
# bind-key -T copy-mode-vi 's' send-keys -X copy-selection \; new-window -n speak \; send-keys -t speak 'translate-shell -brief "$(tmux show-buffer)" -play && tmux kill-window' 'Enter'
tmux.txt · Last modified: 2021/11/06 10:57 by alexk7110