From a062199c9f6fee36e081d8b45c7c3f1829cb518e Mon Sep 17 00:00:00 2001 From: miguel Date: Wed, 16 Jun 2021 13:35:43 +0200 Subject: tmux.conf and other things --- tmux/.tmux.conf | 119 ----------------------------------------------------- tmux/tmux.conf | 46 +++++++++++++++++++++ tmux/tmux.conf.old | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 165 insertions(+), 119 deletions(-) delete mode 100644 tmux/.tmux.conf create mode 100644 tmux/tmux.conf create mode 100644 tmux/tmux.conf.old (limited to 'tmux') diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf deleted file mode 100644 index 39178cc..0000000 --- a/tmux/.tmux.conf +++ /dev/null @@ -1,119 +0,0 @@ -# show status bar when we have multiple windows -# https://www.reddit.com/r/tmux/comments/6lwb07/is_it_possible_to_hide_the_status_bar_in_only_a/ -#if -F "#{==:#{session_windows},1}" "set -g status off" "set -g status on" -#set-hook -g window-linked 'if -F "#{==:#{session_windows},1}" "set -g status off" "set -g status on"' -#set-hook -g window-unlinked 'if -F "#{==:#{session_windows},1}" "set -g status off" "set -g status on"' -#set-hook -g window-linked 'set -g status on' -bind-key 'b' set -g status on -bind-key 'B' set -g status off -set -g status on - -# set window title -set -g set-titles on -#set -g set-titles-string "~ H:#H h:#h D:#D P:#P T:#T S:#S F:#F I:#I W:#W ~" -set -g set-titles-string "#W" - -# hide status bar -# set -g status off - -# remap prefix to Control + a -set -g prefix C-a - -# bind 'C-a C-a' to type 'C-a' -bind C-a send-prefix -bind C-b send-prefix -unbind C-b - -# vi mode -set-window-option -g mode-keys vi - -# terminal -# set -g default-terminal "tmux-256color" # this makes problems in mc -#set -g default-terminal "xterm-256color" -set -g default-terminal "screen-256color" -set -g base-index 1 # ADDED AT WORK - -# escape timeout -set -s escape-time 0 - -# copy and paste -bind-key -t vi-copy 'v' begin-selection -bind-key -t vi-copy 'y' copy-pipe "xclip > /dev/null" -bind-key 'P' run "xclip -o | tmux load-buffer - ; tmux paste-buffer" - -# reload config file (change file location to your the tmux.conf you want to use) -bind r source-file ~/.tmux.conf - -# switch panes using Alt-arrow without prefix -bind -n M-Left select-pane -L -bind -n M-Right select-pane -R -bind -n M-Up select-pane -U -bind -n M-Down select-pane -D - -# Enable mouse control (clickable windows, panes, resizable panes) - -if-shell -b '[ "$(echo "$TMUX_VERSION < 2.1" | bc)" = 1 ]' " \ - set -g mouse-select-window on; \ - set -g mouse-select-pane on; \ - set -g mouse-resize-pane on" - -if-shell -b '[ "$(echo "$TMUX_VERSION >= 2.1" | bc)" = 1 ]' "set -g mouse on" - -# don't rename windows automatically -set-option -g allow-rename off - -bind | split-window -h - - -###################### -### DESIGN CHANGES ### -###################### - -# loud or quiet? -set-option -g visual-activity off -set-option -g visual-bell off -set-option -g visual-silence off -set-window-option -g monitor-activity off -set-option -g bell-action none - -# modes -setw -g clock-mode-colour colour3 -setw -g mode-attr bold -setw -g mode-fg colour7 -setw -g mode-bg colour4 - -# panes -set -g pane-border-bg colour0 -set -g pane-border-fg colour10 -set -g pane-active-border-bg colour0 -set -g pane-active-border-fg colour4 - -# statusbar -set -g status-position bottom -set -g status-justify left -set -g status-bg colour10 -set -g status-fg colour0 -set -g status-attr dim -set -g status-left '' -set -g status-right '' -set -g status-right-length 50 -set -g status-left-length 20 - -setw -g window-status-current-fg colour10 -setw -g window-status-current-bg colour4 -setw -g window-status-current-attr bold -setw -g window-status-current-format ' #I#[fg=colour249]:#[fg=colour255]#W#[fg=colour249]#F ' - -setw -g window-status-fg colour0 -setw -g window-status-bg colour10 -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 colour2 -setw -g window-status-bell-bg colour1 - -# messages -set -g message-attr bold -set -g message-fg colour4 -set -g message-bg colour0 diff --git a/tmux/tmux.conf b/tmux/tmux.conf new file mode 100644 index 0000000..9ad72fc --- /dev/null +++ b/tmux/tmux.conf @@ -0,0 +1,46 @@ +set-option -g base-index 1 +set-option -g default-terminal "screen-256color" +set-option -g display-panes-time 2000 +set-option -g escape-time 10 +set-option -g mode-keys vi +set-option -g mouse +set-option -g pane-base-index 1 +set-option -g pane-border-status top +set-option -g renumber-windows on +set-option -g status-interval 5 +set-option -g status-keys vi +set-option -g status-left ' ' +set-option -g status-position bottom +set-option -g status-right ' #h #[fg=black]#[bg=#556677]#[bg=black]#[fg=#556677]#(uptime | sed "s/,[^:]*//")#[default]' + +set-option -g status-style fg=#ffffff,bg=#556677 +set-option -g window-status-style fg=#ffffff,bg=#333333 +set-option -g window-status-current-style fg=#ffffff,bg=#55aa55 +set-option -g window-status-bell-style fg=#ffffff,bg=#ee3322 +set-option -g window-status-separator " " +set-option -g window-status-format "#[fg=#556677]#[default] #I  #W #[fg=#556677]#[reverse]" +set-option -g window-status-current-format "#[fg=#556677]#[default] #I  #W #[fg=#556677]#[reverse]" + +set-option -g pane-border-format "#P #T" +set-option -g pane-active-border-style fg=#ffffff +set-option -g pane-border-style fg=#556677 + +# 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 diff --git a/tmux/tmux.conf.old b/tmux/tmux.conf.old new file mode 100644 index 0000000..39178cc --- /dev/null +++ b/tmux/tmux.conf.old @@ -0,0 +1,119 @@ +# show status bar when we have multiple windows +# https://www.reddit.com/r/tmux/comments/6lwb07/is_it_possible_to_hide_the_status_bar_in_only_a/ +#if -F "#{==:#{session_windows},1}" "set -g status off" "set -g status on" +#set-hook -g window-linked 'if -F "#{==:#{session_windows},1}" "set -g status off" "set -g status on"' +#set-hook -g window-unlinked 'if -F "#{==:#{session_windows},1}" "set -g status off" "set -g status on"' +#set-hook -g window-linked 'set -g status on' +bind-key 'b' set -g status on +bind-key 'B' set -g status off +set -g status on + +# set window title +set -g set-titles on +#set -g set-titles-string "~ H:#H h:#h D:#D P:#P T:#T S:#S F:#F I:#I W:#W ~" +set -g set-titles-string "#W" + +# hide status bar +# set -g status off + +# remap prefix to Control + a +set -g prefix C-a + +# bind 'C-a C-a' to type 'C-a' +bind C-a send-prefix +bind C-b send-prefix +unbind C-b + +# vi mode +set-window-option -g mode-keys vi + +# terminal +# set -g default-terminal "tmux-256color" # this makes problems in mc +#set -g default-terminal "xterm-256color" +set -g default-terminal "screen-256color" +set -g base-index 1 # ADDED AT WORK + +# escape timeout +set -s escape-time 0 + +# copy and paste +bind-key -t vi-copy 'v' begin-selection +bind-key -t vi-copy 'y' copy-pipe "xclip > /dev/null" +bind-key 'P' run "xclip -o | tmux load-buffer - ; tmux paste-buffer" + +# reload config file (change file location to your the tmux.conf you want to use) +bind r source-file ~/.tmux.conf + +# switch panes using Alt-arrow without prefix +bind -n M-Left select-pane -L +bind -n M-Right select-pane -R +bind -n M-Up select-pane -U +bind -n M-Down select-pane -D + +# Enable mouse control (clickable windows, panes, resizable panes) + +if-shell -b '[ "$(echo "$TMUX_VERSION < 2.1" | bc)" = 1 ]' " \ + set -g mouse-select-window on; \ + set -g mouse-select-pane on; \ + set -g mouse-resize-pane on" + +if-shell -b '[ "$(echo "$TMUX_VERSION >= 2.1" | bc)" = 1 ]' "set -g mouse on" + +# don't rename windows automatically +set-option -g allow-rename off + +bind | split-window -h + + +###################### +### DESIGN CHANGES ### +###################### + +# loud or quiet? +set-option -g visual-activity off +set-option -g visual-bell off +set-option -g visual-silence off +set-window-option -g monitor-activity off +set-option -g bell-action none + +# modes +setw -g clock-mode-colour colour3 +setw -g mode-attr bold +setw -g mode-fg colour7 +setw -g mode-bg colour4 + +# panes +set -g pane-border-bg colour0 +set -g pane-border-fg colour10 +set -g pane-active-border-bg colour0 +set -g pane-active-border-fg colour4 + +# statusbar +set -g status-position bottom +set -g status-justify left +set -g status-bg colour10 +set -g status-fg colour0 +set -g status-attr dim +set -g status-left '' +set -g status-right '' +set -g status-right-length 50 +set -g status-left-length 20 + +setw -g window-status-current-fg colour10 +setw -g window-status-current-bg colour4 +setw -g window-status-current-attr bold +setw -g window-status-current-format ' #I#[fg=colour249]:#[fg=colour255]#W#[fg=colour249]#F ' + +setw -g window-status-fg colour0 +setw -g window-status-bg colour10 +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 colour2 +setw -g window-status-bell-bg colour1 + +# messages +set -g message-attr bold +set -g message-fg colour4 +set -g message-bg colour0 -- cgit v1.2.3