From c6c190efc22929bde8ffd74ac47e1f672c457dfd Mon Sep 17 00:00:00 2001 From: juancwu <46619361+juancwu@users.noreply.github.com> Date: Sun, 25 Dec 2022 14:27:13 -0500 Subject: [PATCH] add: tmux configurations --- .config/tmux/.gitignore | 1 + .config/tmux/plugin.conf | 11 +++++ .config/tmux/statusline.conf | 33 +++++++++++++ .config/tmux/tmux.conf | 96 ++++++++++++++++++++++++++++++++++++ 4 files changed, 141 insertions(+) create mode 100644 .config/tmux/.gitignore create mode 100644 .config/tmux/plugin.conf create mode 100644 .config/tmux/statusline.conf create mode 100644 .config/tmux/tmux.conf diff --git a/.config/tmux/.gitignore b/.config/tmux/.gitignore new file mode 100644 index 0000000..375a75d --- /dev/null +++ b/.config/tmux/.gitignore @@ -0,0 +1 @@ +/plugins/ diff --git a/.config/tmux/plugin.conf b/.config/tmux/plugin.conf new file mode 100644 index 0000000..bd89a82 --- /dev/null +++ b/.config/tmux/plugin.conf @@ -0,0 +1,11 @@ +set -g @plugin 'tmux-plugins/tpm' + +# restore tmux sessions after system restart +# bindings: +# ctrl-s -> save +# ctrl-r -> restore +set -g @plugin 'tmux-plugins/tmux-resurrect' + +# init tmux plugin manager +run '~/.tmux/plugins/tpm/tpm' + diff --git a/.config/tmux/statusline.conf b/.config/tmux/statusline.conf new file mode 100644 index 0000000..3a929a0 --- /dev/null +++ b/.config/tmux/statusline.conf @@ -0,0 +1,33 @@ +# these configurations are from https://github.com/craftzdog/dotfiles-public/blob/master/.config/tmux/statusline.conf + +# vim: ft=tmux +set -g mode-style "fg=#eee8d5,bg=#073642" + +set -g message-style "fg=#eee8d5,bg=#073642" +set -g message-command-style "fg=#eee8d5,bg=#073642" + +set -g pane-border-style "fg=#073642" +set -g pane-active-border-style "fg=#eee8d5" + +set -g status "on" +set -g status-interval 1 +set -g status-justify "left" + +set -g status-style "fg=#586e75,bg=#073642" + +set -g status-bg "#002b36" + +set -g status-left-length "100" +set -g status-right-length "100" + +set -g status-left-style NONE +set -g status-right-style NONE + +set -g status-left "#[fg=#073642,bg=#eee8d5,bold] #S #[fg=#eee8d5,bg=#93a1a1,nobold,nounderscore,noitalics]#[fg=#15161E,bg=#93a1a1,bold] #(whoami) #[fg=#93a1a1,bg=#002b36]" +set -g status-right "#[fg=#586e75,bg=#002b36,nobold,nounderscore,noitalics]#[fg=#93a1a1,bg=#586e75]#[fg=#657b83,bg=#586e75,nobold,nounderscore,noitalics]#[fg=#93a1a1,bg=#657b83]#[fg=#93a1a1,bg=#657b83,nobold,nounderscore,noitalics]#[fg=#15161E,bg=#93a1a1,bold] #h " + +setw -g window-status-activity-style "underscore,fg=#839496,bg=#002b36" +setw -g window-status-separator "" +setw -g window-status-style "NONE,fg=#839496,bg=#002b36" +setw -g window-status-format '#[fg=#002b36,bg=#002b36]#[default] #I  #{b:pane_current_path} #[fg=#002b36,bg=#002b36,nobold,nounderscore,noitalics]' +setw -g window-status-current-format '#[fg=#002b36,bg=#eee8d5]#[fg=#b58900,bg=#eee8d5] #I #[fg=#eee8d5,bg=#b58900] #{b:pane_current_path} #[fg=#b58900,bg=#002b36,nobold]' diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf new file mode 100644 index 0000000..3adfe9c --- /dev/null +++ b/.config/tmux/tmux.conf @@ -0,0 +1,96 @@ +set -g default-terminal "xterm-256color" +set -ga terminal-overrides ",xterm-256color:Tc" + +# prefix +unbind C-b +set-option -g prefix C-t +set-option -g repeat-time 0 +set-option -g focus-events on + +# remove auto window rename +set-option -g allow-rename off + +## Key bindings + +set-window-option -g mode-keys vi + +# reload tmux config file +bind r source-file ~/.tmux.conf \; display "Reloaded!" + +# open cwd (only for macOS) +bind o run-shell "open #{pane_current_path}" + +# remove all window splits +bind -r e kill-pane -a + +# split window +bind s split-window -h -c "#{pane_current_path}" +bind v split-window -v -c "#{pane_current_path}" + +# unbind default split mappings +unbind '"' +unbind % + +# move around panes +bind -r h select-pane -L +bind -r j select-pane -D +bind -r k select-pane -U +bind -r l select-pane -R + +# resize panes +bind -r + resize-pane -U 5 +bind -r - resize-pane -D 5 +bind -r < resize-pane -L 5 +bind -r > resize-pane -R 5 + +# toggle back and forth between panes +bind -r . select-pane -t ! + +## basic settings +set-option -g status-justify "left" + +set-option -g status-fg cyan +set-option -g status-bg black +set -g pane-active-border-style fg=colour166,bg=default +set -g window-style fg=colour10,bg=default +set -g window-active-style fg=colour12,bg=default +set-option -g history-limit 64096 + +set -sg escape-time 10 + +## Colours + +# default statusbar colours +set-option -g status-style bg=colour235,fg=colour136,default + +# default window title colours +set-window-option -g window-status-style fg=colour244,bg=colour234,dim + +# active window title colours +set-window-option -g window-status-current-style fg=colour166,bg=default,bright + +# pane border +set-option -g pane-border-style fg=colour235 # base02 - solarized dark +set-option -g pane-active-border-style fg=colour136,bg=colour235 + +# message text +set-option -g message-style bg=colour235,fg=colour166 + +# pane number display +set-option -g display-panes-active-colour colour33 # blue +set-option -g display-panes-colour colour166 # orange + +# clock +set-window-option -g clock-mode-colour colour64 # gree + +# allow the title bar to adapt to whatever host you connect to +set -g set-titles on +set -g set-titles-string "#T" + + +## Imports + +source ~/.config/tmux/statusline.conf +source ~/.config/tmux/plugin.conf + +