From c52d8e2e50d60d89f9a565000767823a603086ad Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Fri, 20 May 2022 17:18:13 +0800 Subject: [PATCH] tmux customization; tpm auto install; zsh key binding for HOME and END; .gitignore .zwc --- .gitignore | 1 + .tmux.conf2 | 37 ++++++++++++++++++++++++++++++++++++- .zshrc2 | 19 +++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..416cfaa --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.zwc diff --git a/.tmux.conf2 b/.tmux.conf2 index 1c4e79b..d78fc6d 100644 --- a/.tmux.conf2 +++ b/.tmux.conf2 @@ -1,4 +1,10 @@ set -g prefix ^a +set -g default-terminal "xterm-256color" + +# plugins +set -g @plugin 'https://hub.fastgit.xyz/thewtex/tmux-mem-cpu-load' +set -g @plugin 'https://hub.fastgit.xyz/tmux-plugins/tmux-resurrect' +run '~/.tmux/plugins/tpm/tpm' # Use Alt-arrow keys to switch panes bind -n M-Left select-pane -L @@ -10,4 +16,33 @@ bind -n M-Down select-pane -D bind -n S-Left previous-window bind -n S-Right next-window -bind-key r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded" +# '-' and '|' to split +bind - split-window -v -c "#{pane_current_path}" +bind | split-window -h -c "#{pane_current_path}" + +# other key bindings +bind r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded" +bind m run 'old=$(tmux show -gv mouse); new="off"; if [ "$old" = "off" ]; then new="on"; fi; tmux set -g mouse $new && tmux display-message toggle\ mouse\ mode\ $new' + +# styles +# status bar +set -g monitor-activity on +set -g bell-action any +set -g status-position top +set -g status-style fg=white,bg=colour241 +set -g status-interval 1 +set -g status-justify centre +set -g status-left-length 23 +set -g status-left "#[fg=#f9f1a5]#(whoami)#[default]@#(hostname | sed 's/-ibd-ink//g')[#S]" +set -g status-right-length 60 +set -g status-right "#[default]#(~/.tmux/plugins/tmux-mem-cpu-load/tmux-mem-cpu-load --averages-count 1 --interval 2)#[default] " +set -ag status-right "#[default]#(uptime | cut -f 4-5 -d ' ' | cut -f 1 -d ',' | sed 's/ //g')" +set -ag status-right " #[fg=white,bg=default]%H:%M:%S" +set -g window-status-style fg=colour248 +set -g window-status-current-style fg=#f9f1a5,bg=colour237 +set -g window-status-activity-style fg=colour237,bg=colour248 +set -g window-status-bell-style fg=colour237,bg=colour214 +# panes and windows +set -g pane-active-border-style fg=brightblue +set -g window-style fg=colour248 +set -g window-active-style fg=white \ No newline at end of file diff --git a/.zshrc2 b/.zshrc2 index bf4144f..cf9da01 100644 --- a/.zshrc2 +++ b/.zshrc2 @@ -61,6 +61,15 @@ antigen theme ${ZSH_THEME:-ys} antigen apply # end of antigen config +# install tmux tpm +TMUX_TPM="$HOME/.tmux/plugins/tpm" +command -v tmux > /dev/null 2>&1 +if [[ $? == 0 && ! -d "$TMUX_TPM" ]]; then + git clone https://hub.fastgit.xyz/tmux-plugins/tpm "$TMUX_TPM" +fi +# end of tpm + + # functions export DOTFILES=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) dfs() @@ -86,3 +95,13 @@ alias "se"='sudo -sE' alias "pbd"='ping baidu.com' alias "p114"='ping 114.114.114.114' alias "p666"='ping6 2001:da8::666' + +# key bindings +bindkey "^b" beginning-of-line +bindkey "^e" end-of-line +bindkey "^[[H" beginning-of-line +bindkey "^[[F" end-of-line +bindkey "^[[1~" beginning-of-line +bindkey "^[[4~" end-of-line +bindkey "^[OH" beginning-of-line +bindkey "^[OF" end-of-line