diff options
author | Matthew Lemon <y@yulqen.org> | 2023-05-01 17:26:25 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2023-05-01 17:26:25 +0100 |
commit | ec6bf998364f50375bd748ab8c61fbc064226e7d (patch) | |
tree | 1d7ce07f52e5c469093c198ea2be523f5b6eb39f /tmux.conf |
Initial commit
Diffstat (limited to 'tmux.conf')
-rw-r--r-- | tmux.conf | 219 |
1 files changed, 219 insertions, 0 deletions
diff --git a/tmux.conf b/tmux.conf new file mode 100644 index 0000000..a7d6c20 --- /dev/null +++ b/tmux.conf @@ -0,0 +1,219 @@ +# I got some additional config in 2022 from https://findelabs.com/post/openbsd-with-tmux/ +# unbind some default keybindings +unbind C-b + +#set-option -sa terminal-features ',screen-256color:RGB' +set-option -g focus-events on + +# set shell +#set -g default-shell '/bin/ksh' + +# command sequence for nested tmux sessions +bind-key a send-prefix + +# set prefix key to ctrl-a +set -g prefix C-a + +set-option -g status-interval 60 + +# lower command delay +set -sg escape-time 1 + +# force tmux to use xterm +#set -g default-terminal "xterm-256color" +#set -g default-terminal "tmux-256color" +set -g default-terminal "screen-256color" + +# set from advice in neovim :checkhealth +#set-option -sa terminal-overrides ',screen-256color:RGB' + +# start first window and pane at 1, not zero +set -g base-index 1 +set -g pane-base-index 1 + +# bind r to reloading the config file +bind r source-file ~/.tmux.conf \; display "Reloaded tmux config file." + +# pass through a ctrl-a if you press it twice +bind C-a send-prefix + +# better mnemonics for splitting panes! +bind | split-window -h +bind - split-window -v + +# vim / xmonad style bindings for pane movement +bind -r h select-pane -L +bind -r j select-pane -D +bind -r k select-pane -U +bind -r l select-pane -R + +# vim / xmonad style bindings for window movement +bind -r C-h select-window -t :- +bind -r C-l select-window -t :+ + +# history limit to 10K lines +set -g history-limit 10000 + +# shift-movement keys will resize panes +bind -r H resize-pane -L 5 +bind -r J resize-pane -D 5 +bind -r K resize-pane -U 5 +bind -r L resize-pane -R 5 + +# make mouse useful in copy mode +set -g mouse on + +# ctl-left/right keys +set-window-option -g xterm-keys on + +# Configure Ctrl+Arrow keys to create and navigate through windows +bind -n C-Left previous-window +bind -n C-Right next-window +bind -n C-Up new-window +bind -n C-Down confirm-before -p "kill-window #P? (y/n)" kill-window + +# Set visual notifications - these are quite nippy +setw -g monitor-activity off +set -g visual-activity off + +# disable mouse support (at least while we're learning) +# setw -g mode-mouse off +# set -g mouse-select-pane off +# set -g mouse-resize-pane off +# set -g mouse-select-window off +# +# copy and paste +unbind p +bind p paste-buffer +#bind -t vi-copy 'v' begin-selection +#bind -t vi-copy 'y' copy-selection +# new copy and paste (needed for st terminal) = https://www.rushiagr.com/blog/2016/06/16/everything-you-need-to-know-about-tmux-copy-pasting-ubuntu/ + +bind-key -T copy-mode-vi v send-keys -X begin-selection +bind-key -T copy-mode-vi y send-keys -X copy-selection +bind-key -T copy-mode-vi r send-keys -X rectangle-toggle + +# also copy to system clipboard +#bind -T vi-copy y copy-pipe "xclip -sel clip -i" + +# enable copy and paste with the mouse! +set -g mouse off + +# geohot colors +set -g status-position bottom +set -g status-bg colour234 +set -g status-fg colour137 +set -g status-style dim +set -g status-left '' +#set -g status-right '#[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M:%S ' +set -g status-right '[#(TZ="Europe/London" date +"%%Y-%%m-%%d %%H:%%M")]' +set -g status-right-length 50 +set -g status-left-length 20 + +setw -g window-status-current-style fg=colour81 +setw -g window-status-current-style bg=colour238 +setw -g window-status-current-style bold +setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F ' + +setw -g window-status-style fg=colour138 +setw -g window-status-style bg=colour235 +setw -g window-status-style none +setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F ' + +setw -g window-status-bell-style bold +setw -g window-status-bell-style fg=colour255 +setw -g window-status-bell-style bg=colour1 + + +# fiddle with colors of status bar +# set color for status bar +#set-option -g status-bg colour240 +#set-option -g status-bg black +#set-option -g status-fg yellow +#set -g status-position bottom +#set -g status-style "bg=colour1" +#set -g status-style "fg=colour137" +##set -g status-fg colour137 +##set -g status-attr dim +##set -g status-left '' +#set -g status-left-length 30 +#set -g status-right '#[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M:%S ' +##set -g status-right-length 5 +##set -g status-left-length 20 + +# show hostname and IP address on the left side of status bar +#set-option -g status-left-length 100 +#set -g status-left ' #( sysctl -n vm.loadavg ) ' - this isn't useful + +# show session name, window, pane number, date and time on right side +set -g status-right-length 100 + +##setw -g window-status-current-bg colour238 +##setw -g window-status-current-style bold +#setw -g window-status-current-format ' #[bg=colour237]#I#[fg=colour250]:#[fg=colour255]#[bg=colour237]#W#[fg=colour50]#F ' +## +#setw -g window-status-style "fg=colour61" +#setw -g window-status-style "bg=colour235" +#setw -g window-status-attr none +#setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F ' +# +#setw -g window-status-bell-attr bold +#setw -g window-status-bell-fg colour255 +#setw -g window-status-bell-bg colour1 +## +## fuck with border colours +#set -g pane-border-fg yellow +#set -g pane-active-border-fg red +# +# +## fiddle with colors of inactive windows +#setw -g window-status-fg cyan + +# vim mode keys +setw -g mode-keys vi + +# battery information in status bar +set -g status-interval 40 +set -g status-right "#[fg=colour155]#(apm -l)%% | #[fg=colour45]%d %b %R" + +# +## Smart pane switching with awareness of Vim splits. +## See: https://github.com/christoomey/vim-tmux-navigator +#is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ +# | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" +#bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' +#bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' +#bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U' +#bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R' +#tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' +#if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ +# "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" +#if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ +# "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'" +# +#bind-key -T copy-mode-vi 'C-h' select-pane -L +#bind-key -T copy-mode-vi 'C-j' select-pane -D +#bind-key -T copy-mode-vi 'C-k' select-pane -U +#bind-key -T copy-mode-vi 'C-l' select-pane -R +#bind-key -T copy-mode-vi 'C-\' select-pane -l +# +# +# try different, vimlike copy-mode +unbind [ +bind Escape copy-mode +unbind p +bind p paste-buffer + + +#List of plugins +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'tmux-plugins/tmux-resurrect' +set -g @plugin 'tmux-plugins/tmux-yank' + +set -g @resurrect-save 'Q' +set -g @resurrect-restore 'R' + +run-shell ~/.tmux-resurrect/resurrect.tmux +# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) +run '~/.tmux/plugins/tpm/tpm' |