Skip to content

Commit

Permalink
tmux - template
Browse files Browse the repository at this point in the history
  • Loading branch information
shellshock1953 committed Oct 8, 2023
1 parent 5434819 commit 8659143
Show file tree
Hide file tree
Showing 3 changed files with 152 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tmux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push:
branches: [master]
paths:
- 'defaults/main/main/tmux.yml'
- 'defaults/main/tmux.yml'
- 'tasks/**'
- 'molecule/tmux/**'
pull_request:
Expand Down
7 changes: 4 additions & 3 deletions defaults/main/tmux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ role_component:
brew:
- tmux
configs:
pre: []
templates: []
post: []
templates:
main:
template: tmux.conf
dest: ~/.tmux.conf
147 changes: 147 additions & 0 deletions templates/tmux.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# TMUX main config file
#
# made by shellshock
# shellshock1953 at gmail com
# 2016
#

# Continium
set -g @continuum-restore 'on'

# Vim Autoread file
set -g focus-events on
set -g @resurrect-strategy-vim 'session'

# map CAPS to CTRL, enable default prefix to CTRL+a
set -g mouse on
set -g prefix C-a

# vi-like
set-window-option -g mode-keys vi

# map CTRL+b enable/disable statusbar
unbind C-b
bind b set-option status

# history limit
set -g history-limit 5000

# delay (required)
set -sg escape-time 1

# enable indexing from 1
set -g base-index 1
setw -g pane-base-index 1

# disable autorename
set-option -g allow-rename off
setw -g monitor-activity on
setw -g window-status-activity-fg colour30

# reload TMUX conf with CTRL+r
bind r source-file ~/.tmux.conf \; display "__>r370ad3D 1!!"

# split windows by "|" and "-"
bind | split-window -h
bind - split-window -v

# vi-like moves
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+

# vi-like pane resizing
bind -r H resize-pane -L 2
bind -r J resize-pane -D 2
bind -r K resize-pane -U 2
bind -r L resize-pane -R 2

# vi-like copy
#bind -t vi-copy 'v' begin-selection
#bind -t vi-copy 'y' copy-selection

# COLORS
set -g default-terminal "screen-256color"
# statusbar
set -g status-fg colour38
set -g status-bg colour233
# windows list
#setw -g window-status-fg colour38
#setw -g window-status-bg colour233
#setw -g window-status-attr default
# active window
#setw -g window-status-current-fg colour233
#setw -g window-status-current-bg colour38
#setw -g window-status-current-attr bright
# windows selector
#set pane-border-fg colour243
#set pane-border-bg colour234
#set pane-active-border-fg colour197
#set pane-active-border-bg colour234
# messages
set -g message-fg colour37
set -g message-bg colour233
set -g status-interval 1
set -g status-justify centre
# clock
set-window-option -g clock-mode-colour colour37
bind t new-window "pkill -1 gotty ; gotty --reconnect --reconnect-time=1 tmux a -t `tmux display-message -p '#S'`"

# statusbar config
# enable/disable statusbar
bind S set-window-option synchronize-panes
# update time
set -g status-interval 5
# left
set -g status-left "#{?pane_synchronized,#[fg=colour233]#[bg=colour37]>> SYNC ,}#[fg=colour30,bg=default] #S #(/home/shellshock/bin/check_ping.sh)"
# right
set -g status-right "#[fg=colour36]#(cat /proc/loadavg | cut -d' ' -f3)#{?pane_synchronized,#[fg=colour233]#[bg=colour37] SYNC <<,}"


# VIM COPY
set -g mouse on
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
bind -n C-WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M
bind -T copy-mode-vi C-WheelUpPane send-keys -X halfpage-up
bind -T copy-mode-vi C-WheelDownPane send-keys -X halfpage-down
bind -T copy-mode-emacs C-WheelUpPane send-keys -X halfpage-up
bind -T copy-mode-emacs C-WheelDownPane send-keys -X halfpage-down

# To copy, left click and drag to highlight text in yellow,
# once you release left click yellow text will disappear and will automatically be available in clibboard
# # Use vim keybindings in copy mode
setw -g mode-keys vi
# 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"
# VIM COPY

# Powerline
set-option -g status on
set-option -g status-interval 2
set-option -g status-justify "centre"
set-option -g status-left-length 60
set-option -g status-right-length 90
set-option -g status-left "#(~/tmux-powerline/powerline.sh left)"
set-option -g status-right "#(~/tmux-powerline/powerline.sh right)"
#set-window-option -g window-status-current-format "#[fg=colour45, bg=colour232] #I ⮁ #[fg=colour240, bg=colour245]#W"
# run-shell "powerline-daemon -q"
# source "/usr/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf"
# setw -g aggressive-resize off

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-yank'
# set -g @plugin 'thewtex/tmux-mem-cpu-load'


# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

0 comments on commit 8659143

Please sign in to comment.