update tmux config to unify. Add Readme for tmux incl keybind cheatsheet

This commit is contained in:
Salar Rahmanian 2025-10-07 23:25:39 -07:00
parent 10ff286bc1
commit 596da8a4a4
3 changed files with 159 additions and 108 deletions

View file

@ -1,12 +1,92 @@
{ pkgs, ... }:
let
tmuxConfig = builtins.readFile ./tmux.conf;
tmuxConfig = ''
# disable mouse
set -g mouse off
# increase repeat time for repeatable commands
set -g repeat-time 1000
# highlight window when it has new activity
setw -g monitor-activity on
set -g visual-activity on
# re-number windows when one is closed
set -g renumber-windows on
###########################
# Key Bindings
###########################
# Copy vim style
# create 'v' alias for selecting text
bind Escape copy-mode
bind C-[ copy-mode
bind -T copy-mode-vi 'v' send -X begin-selection
# copy with 'enter' or 'y' and send to mac os clipboard
unbind -T copy-mode-vi Enter
bind -T copy-mode-vi Enter send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
bind -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
# paste
bind p paste-buffer
# panes: window splitting
unbind %
bind "'" split-window -h
unbind '"'
bind - split-window -v
# Switch panes with hjkl
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Quick window selection
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# resize panes
bind -r H resize-pane -L 10
bind -r J resize-pane -D 10
bind -r K resize-pane -U 10
bind -r L resize-pane -R 10
# Quickly switch panes
unbind ^J
bind ^J select-pane -t :.+
############################
## Status Bar
############################
# enable UTF-8 support in status bar
set -gq status-utf8 on
# center the status bar
set -g status-justify centre
# show session, window, pane in left status bar
set -g status-left-length 40
set -g status-left '#[fg=green] #S #[fg=yellow]#I/#[fg=cyan]#P '
# update status bar info
set -g status-interval 60
set -g status-right " #(tms sessions)"
bind -r '(' switch-client -p\; refresh-client -S
bind -r ')' switch-client -n\; refresh-client -S
bind C-o display-popup -E "tms"
set -g default-command /etc/profiles/per-user/salar/bin/fish
'';
in
{
programs.tmux = {
enable = true;
baseIndex = 1;
resizeAmount = 10;
escapeTime = 10;
historyLimit = 10000;
keyMode = "vi";
@ -30,11 +110,6 @@ in
# No extra spaces between icons
set -g @tokyo-night-tmux_window_tidy_icons 0
set -g status-right " #(tms sessions)"
bind -r '(' switch-client -p\; refresh-client -S
bind -r ')' switch-client -n\; refresh-client -S
bind C-o display-popup -E "tms"
'';
}
{