mirror of
https://github.com/softinio/nix-config.git
synced 2025-10-18 11:06:41 -07:00
update tmux config to unify. Add Readme for tmux incl keybind cheatsheet
This commit is contained in:
parent
10ff286bc1
commit
596da8a4a4
3 changed files with 159 additions and 108 deletions
78
programs/tmux/README.md
Normal file
78
programs/tmux/README.md
Normal file
|
@ -0,0 +1,78 @@
|
|||
# Tmux Cheatsheet
|
||||
|
||||
## Prefix Key
|
||||
**Prefix:** `Ctrl-a`
|
||||
|
||||
All commands below require pressing the prefix first, unless otherwise noted.
|
||||
|
||||
## Copy Mode (Vi-style)
|
||||
|
||||
| Key | Action |
|
||||
|-----|--------|
|
||||
| `Esc` or `Ctrl-[` | Enter copy mode |
|
||||
| `v` | Begin selection (in copy mode) |
|
||||
| `y` or `Enter` | Copy selection to macOS clipboard |
|
||||
| `p` | Paste from tmux buffer |
|
||||
|
||||
## Pane Management
|
||||
|
||||
### Creating Panes
|
||||
|
||||
| Key | Action |
|
||||
|-----|--------|
|
||||
| `'` | Split pane horizontally (side by side) |
|
||||
| `-` | Split pane vertically (top/bottom) |
|
||||
|
||||
### Navigating Panes
|
||||
|
||||
| Key | Action |
|
||||
|-----|--------|
|
||||
| `h` | Move to left pane |
|
||||
| `j` | Move to down pane |
|
||||
| `k` | Move to up pane |
|
||||
| `l` | Move to right pane |
|
||||
| `Ctrl-j` | Cycle to next pane |
|
||||
|
||||
### Resizing Panes
|
||||
|
||||
| Key | Action |
|
||||
|-----|--------|
|
||||
| `H` | Resize pane left (10 units) |
|
||||
| `J` | Resize pane down (10 units) |
|
||||
| `K` | Resize pane up (10 units) |
|
||||
| `L` | Resize pane right (10 units) |
|
||||
|
||||
## Window Management
|
||||
|
||||
| Key | Action |
|
||||
|-----|--------|
|
||||
| `Ctrl-h` | Previous window |
|
||||
| `Ctrl-l` | Next window |
|
||||
|
||||
## Session Management (TMS Integration)
|
||||
|
||||
| Key | Action |
|
||||
|-----|--------|
|
||||
| `(` | Previous session (with refresh) |
|
||||
| `)` | Next session (with refresh) |
|
||||
| `Ctrl-o` | Open TMS popup for session switching |
|
||||
|
||||
## Configuration Details
|
||||
|
||||
- **Base Index:** Windows and panes start at 1 (not 0)
|
||||
- **Escape Time:** 10ms (for vim responsiveness)
|
||||
- **History Limit:** 10,000 lines
|
||||
- **Key Mode:** Vi
|
||||
- **Terminal:** xterm-256color
|
||||
- **Mouse:** Disabled
|
||||
- **Repeat Time:** 1000ms for repeatable commands
|
||||
- **Auto-renumber:** Windows are renumbered when one is closed
|
||||
- **Activity Monitoring:** Visual alerts when window has activity
|
||||
|
||||
## Plugins
|
||||
|
||||
- **sensible:** Sensible default settings
|
||||
- **tokyo-night-tmux:** Tokyo Night theme with transparency
|
||||
- **yank:** Better clipboard integration
|
||||
- **resurrect:** Save/restore tmux sessions
|
||||
- **continuum:** Auto-save sessions every 60 minutes
|
|
@ -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"
|
||||
'';
|
||||
}
|
||||
{
|
||||
|
|
|
@ -1,102 +0,0 @@
|
|||
##########################
|
||||
# Configuration
|
||||
###########################
|
||||
|
||||
# use 256 xterm for pretty colors. This enables same colors from iTerm2 within tmux.
|
||||
# This is recommended in neovim :healthcheck
|
||||
# set -g default-terminal "screen-256color"
|
||||
# set -ga terminal-overrides ",xterm-256color:Tc"
|
||||
|
||||
# disable mouse
|
||||
set -g mouse off
|
||||
|
||||
# decrease command delay (increases vim responsiveness)
|
||||
set -sg escape-time 1
|
||||
|
||||
# increase repeat time for repeatable commands
|
||||
set -g repeat-time 1000
|
||||
|
||||
# start pane index at 1 instead of 0
|
||||
setw -g pane-base-index 1
|
||||
|
||||
# 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
|
||||
|
||||
# enable pbcopy and pbpaste
|
||||
# https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/blob/master/README.md
|
||||
# set-option -g default-command "reattach-to-user-namespace -l zsh"
|
||||
|
||||
###########################
|
||||
# Key Bindings
|
||||
###########################
|
||||
|
||||
# Tmux prefix
|
||||
# Current solution is to keep the default
|
||||
# and have term map C-; to C-b. This is the nicest
|
||||
# bind I've found and this is the only way to enable it in tmux
|
||||
# unbind C-b
|
||||
# set -g prefix C-a
|
||||
# bind C-a send-prefix
|
||||
|
||||
# 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: http://goo.gl/2Bfn8
|
||||
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
|
||||
# paste from system clipboard MacOS
|
||||
# bind C-v run \"tmux set-buffer \"$(reattach-to-user-namespace pbpaste)\"; tmux 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 default-command /etc/profiles/per-user/salar/bin/fish
|
Loading…
Add table
Add a link
Reference in a new issue