add tmux
parent
01a725fb49
commit
272d89b105
|
@ -0,0 +1,102 @@
|
|||
#########################
|
||||
### TMUX CLI COMMANDS ###
|
||||
#########################
|
||||
|
||||
# Reload tmux configuration tmux source ~/.config/tmux/tmux.conf
|
||||
# Attach to an existing session tmux attach -t session_name
|
||||
# Kill all tmux processes pkill -f tmux
|
||||
# Install specified plugins via TPM prefix + I
|
||||
# Run custom shell script at startup run-shell "~/your/command.sh"
|
||||
# (in tmux.conf)
|
||||
|
||||
|
||||
########################
|
||||
### GENERAL SETTINGS ###
|
||||
########################
|
||||
|
||||
set-option -g default-terminal "screen-256color" # Enable 256 colors in terminal
|
||||
#set -g default-terminal 'tmux-256color'
|
||||
#set -g default-terminal 'xterm-256color'
|
||||
set -ga terminal-overrides ',*:Tc' # Enable TrueColors
|
||||
set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q' # Support cursor shape changes
|
||||
set -g base-index 1 # Start window numbering at 1
|
||||
set -g pane-base-index 1 # Start pane numbering at 1
|
||||
set -g aggressive-resize on # Automatically resize panes on window size change
|
||||
set -g history-limit 10000 # Keep 10,000 lines in scrollback buffer
|
||||
set -g set-titles on # Enable automatic title updates
|
||||
set -g mouse on # Enable mouse support
|
||||
set -g mode-style "fg=black,bg=blue" # Customize text selection colors in copy mode
|
||||
set -g status-position top # Place status bar at top
|
||||
set-environment -g LC_CTYPE "ru_RU.UTF-8" # Set environment encoding for Russian
|
||||
#set -g pane-active-border-style fg=blue # Set active board color: example with bg 'fg=blue,bg=green'
|
||||
#set -s set-clipboard off # Clipboard mode on|off|external
|
||||
#set -g display-time 100 # Set deley after changing focus of pane (def 750 ms)
|
||||
|
||||
## Extra status bar line
|
||||
#setw -g pane-border-status bottom # Border placement
|
||||
#setw -g pane-border-format '─' # Border style
|
||||
|
||||
#########################
|
||||
### MOUSE KEYBINDINGS ###
|
||||
#########################
|
||||
|
||||
# Open a new window with double-click on status bar
|
||||
bind-key -n DoubleClick1Status new-window
|
||||
|
||||
|
||||
|
||||
############################
|
||||
### KEYBOARD KEYBINDINGS ###
|
||||
############################
|
||||
|
||||
bind-key 'v' copy-mode # 'prefix+v' to enable copy mode
|
||||
bind-key -T copy-mode-vi 'v' send -X begin-selection # 'v' to start selecting in copy mode
|
||||
|
||||
|
||||
# Manual save/restore bindings for tmux-resurrect
|
||||
# 'prefix+F5' to save
|
||||
bind-key -T prefix F5 run-shell \
|
||||
'~/.config/tmux/plugins/tmux-resurrect/scripts/save.sh && mv -f $(find ~/.local/share/tmux/resurrect -type f -name "tmux_resurrect_*.txt" -size +0c | sort | tail -1) ~/.local/share/tmux/resurrect/main.txt && tmux display-message "Environment saved manually!"'
|
||||
|
||||
# 'prefix+F6' to load
|
||||
bind-key -T prefix F6 run-shell \
|
||||
'ln -sf ~/.local/share/tmux/resurrect/main.txt ~/.local/share/tmux/resurrect/last && ~/.config/tmux/plugins/tmux-resurrect/scripts/restore.sh'
|
||||
|
||||
####################
|
||||
### PLUGINS LIST ###
|
||||
####################
|
||||
|
||||
# Plugins
|
||||
set -g @plugin 'tmux-plugins/tpm' # Plugins manager
|
||||
set -g @plugin 'tmux-plugins/tmux-sensible' # Optimal tmux default settings
|
||||
set -g @plugin 'arcticicestudio/nord-tmux' # Nord theme for tmux
|
||||
set -g @plugin 'tmux-plugins/tmux-resurrect' # Save and restore tmux env
|
||||
set -g @plugin 'tmux-plugins/tmux-continuum' # Automates save and restore actions of tmux-resurrect
|
||||
|
||||
######################
|
||||
### PLUGINS CONFIG ###
|
||||
######################
|
||||
|
||||
# Configure tmux-resurrect
|
||||
# Cleanup old session files
|
||||
run-shell \
|
||||
'find ~/.local/share/tmux/resurrect/ -type f -name "*.txt" ! -name "main.txt" -mtime +3 -delete'
|
||||
#set -g @resurrect-capture-pane-contents 'on' # Restore previous sessions content
|
||||
set -g @resurrect-strategy-nvim 'session' # Use sessions for restoring Neovim
|
||||
set -g @resurrect-processes 'ssh ranger mc tmux cmatrix ipython' # Processes to restore
|
||||
|
||||
# Configure tmux-continuum
|
||||
set -g @continuum-boot 'on' # Auto-start tmux via systemd
|
||||
set -g @continuum-restore 'on' # Auto-restore tmux sessions
|
||||
set -g @continuum-save-interval '60' # Auto-save every 60 minutes
|
||||
|
||||
# Ensure TPM plugin is installed
|
||||
if "test ! -d ~/.config/tmux/plugins/tpm" \
|
||||
"run 'git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm'"
|
||||
|
||||
# Autoinstall other plugins on new machine
|
||||
run '~/.config/tmux/plugins/tpm/tpm'
|
||||
run '~/.config/tmux/plugins/tpm/bin/install_plugins'
|
||||
|
||||
# Initialize TPM (keep this line at very bottom of tmux.conf)
|
||||
run '~/.config/tmux/plugins/tpm/tpm'
|
Loading…
Reference in New Issue