dotfiles/tmux/tmux.conf

150 lines
5.8 KiB
Plaintext
Raw Normal View History

2022-03-16 00:38:47 +01:00
2022-10-09 23:55:25 +02:00
######################################################################
# Tmux Configuration File (~/.tmux.conf) #
######################################################################
# Config for Tmux multiplexer (requires version >= v2.4) #
# Sets preferences, keybindings and configures plugins #
2022-10-22 17:35:33 +02:00
# Tmux needs to be re-sourced or killed for changes to work #
2022-10-09 23:55:25 +02:00
# For docs and more info, see: https://github.com/lissy93/dotfiles #
# #
# Licensed under MIT (C) Alicia Sykes 2022 <https://aliciasykes.com> #
######################################################################
######################################################################
# Basics #
######################################################################
2022-08-29 00:15:04 +02:00
2022-10-10 23:23:36 +02:00
# Set Tmux prefix keys (Ctrl+B or `)
set-option -g prefix C-b
set-option -g prefix2 `
2022-03-16 00:38:47 +01:00
# Use vim keybindings in copy mode
setw -g mode-keys vi
2022-10-09 23:55:25 +02:00
# Allow mouse support
set -g mouse on
# Use wider color pallete
set -g default-terminal screen-256color
# Set bigger history limit
set -g history-limit 20000
# Set Esc delay after prefix
set -sg escape-time 20
# Keep Tmux alive when the initial command is finished
set -g remain-on-exit off
# Sets parent terminal title, same as current Tmux window
set -g set-titles on
set -g set-titles-string "#I:#W"
2022-03-16 00:38:47 +01:00
# Update default binding of `Enter` to also use copy-pipe
unbind -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -selection c"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"
2022-10-09 23:55:25 +02:00
######################################################################
# Navigation #
######################################################################
2022-03-16 00:38:47 +01:00
# Allow Alt+Arrow to switch pains
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
2022-10-09 23:55:25 +02:00
# Split window horizontally (h) / veritcally (v)
bind v split-window -v
bind h split-window -h
2022-03-16 00:38:47 +01:00
# Activity Monitoring (for when something happens in another pain)
set -g monitor-activity on
set -g visual-activity on
2022-10-22 17:35:33 +02:00
######################################################################
# Pop-Up Menus #
######################################################################
# Prefix + Ctrl J shows a session list popup selector with fzf
bind C-j display-popup -E "tmux list-sessions | sed -E 's/:.*$//' | grep -v \"^$(tmux display-message -p '#S')\$\" | fzf --reverse | xargs tmux switch-client -t"
# Show htop on Prefix + Ctrl H
bind C-h display-popup -E "htop"
2022-10-09 23:55:25 +02:00
2022-10-27 21:36:23 +02:00
######################################################################
# Status Bar #
######################################################################
set -g status-bg colour0
set -g status-fg colour7
2022-10-09 23:55:25 +02:00
######################################################################
# Plugin Imports and Configurations #
######################################################################
2022-03-16 00:38:47 +01:00
2022-08-29 00:15:04 +02:00
# Set install location for plugins
set-environment -g TMUX_PLUGIN_MANAGER_PATH "${XDG_DATA_HOME}/tmux/plugins"
2022-03-16 00:38:47 +01:00
# Install productivity plugins
set -g @plugin 'tmux-plugins/tmux-sessionist' # Easily manage sessions
set -g @plugin 'tmux-plugins/tmux-continuum' # Contineous saves environment for next time
set -g @plugin 'tmux-plugins/tmux-resurrect' # Restart previous environment on launch
set -g @plugin 'tmux-plugins/tmux-sidebar' # Shows file tree on the left, `tab`
set -g @plugin 'tmux-plugins/tmux-open' # Opens highlighted addresses / files: `o`
set -g @plugin 'jaclu/tmux-menus' # Context menus for common tasks: `#`
set -g @plugin 'laktak/extrakto' # Clipboard copy and output completions
set -g @plugin 'tmux-plugins/tmux-yank' # Save text to system clipboard
# Install status bar plugins
set -g @plugin 'xamut/tmux-weather'
set -g @plugin 'tmux-plugins/tmux-cpu'
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'MunifTanjim/tmux-mode-indicator'
set -g @plugin 'tmux-plugins/tmux-online-status'
set -g @plugin 'kristijanhusak/tmux-simple-git-status'
# Set status line content
set -g status-interval 2
set -g status-right-length 180
set -g status-right '#{tmux_mode_indicator} Online: #{online_status} | #{weather} | %a %d/%m/%Y %H:%M | #{battery_icon_status} #{battery_percentage}'
set -g status-left-length 180
2022-10-27 21:36:23 +02:00
set -g status-left "CPU: #{cpu_fg_color}#{cpu_percentage} #{cpu_temp_icon} #{cpu_temp}#{cpu_temp_format}#[default] | MEM: #{ram_fg_color}#{ram_percentage} #[default]| #{simple_git_status}"
2022-03-16 00:38:47 +01:00
# More plugin options
set -g @menus_trigger '#'
2022-10-27 21:36:23 +02:00
set-option -g @tmux-weather-location "London"
set -g @cpu_low_bg_color "#[bg=0]"
set -g @cpu_low_fg_color "#[fg=3]"
set -g @cpu_medium_bg_color "#[bg=0]"
set -g @cpu_medium_fg_color "#[fg=3]"
set -g @cpu_high_bg_color "#[bg=0]"
set -g @cpu_high_fg_color "#[fg=1]"
2022-03-16 00:38:47 +01:00
set -g @cpu_temp_format "%0.1f°"
set -g @cpu_temp_low_icon "❄️"
set -g @cpu_temp_medium_icon "🌡️"
set -g @cpu_temp_high_icon "🔥"
2022-10-27 21:36:23 +02:00
set -g @cpu_temp_low_bg_color "#[bg=0]"
set -g @cpu_temp_low_fg_color "#[fg=20]"
set -g @cpu_temp_medium_bg_color "#[bg=0]"
set -g @cpu_temp_medium_fg_color "#[fg=11]"
set -g @cpu_temp_high_bg_color "#[bg=0]"
set -g @cpu_temp_high_fg_color "#[fg=9]"
set -g @ram_low_bg_color "#[bg=0]"
set -g @ram_low_fg_color "#[fg=2]"
set -g @ram_medium_bg_color "#[bg=0]"
set -g @ram_medium_fg_color "#[fg=3]"
set -g @ram_high_bg_color "#[bg=0]"
set -g @ram_high_fg_color "#[fg=2]"
2022-03-16 00:38:47 +01:00
# Import TPM
2022-08-29 00:15:04 +02:00
run "${XDG_DATA_HOME}/tmux/plugins/tpm/tpm"