From 24a4944aa16d2185611889ba87396cc9551e6a17 Mon Sep 17 00:00:00 2001 From: jay Date: Sat, 27 Nov 2021 01:21:10 +0800 Subject: [PATCH] update --- .dotter/global.toml | 12 ++-- tmux | 157 ++++++++++++++++++++++++++++++++++++++++++++ zprofile | 13 ++++ 3 files changed, 174 insertions(+), 8 deletions(-) create mode 100644 tmux diff --git a/.dotter/global.toml b/.dotter/global.toml index 45b0e09..004091f 100644 --- a/.dotter/global.toml +++ b/.dotter/global.toml @@ -6,6 +6,10 @@ depends = [] [default.files] [default.variables] +# linter can be "standard" or "eslint" +js_linter = "\"standard\"" +# fixer can be "standard" or "prettier" +js_fixer = "\"standard\"" [zsh.files] zshrc = "~/.zshrc" @@ -23,16 +27,8 @@ ctags = "~/.ctags" vimrc = "~/.vimrc" [vim.variables] -# linter can be "standard" or "eslint" -js_linter = "\"standard\"" -# fixer can be "standard" or "prettier" -js_fixer = "\"standard\"" [nvim.files] nvim = "~/.config/nvim" [nvim.variables] -# linter can be "standard" or "eslint" -js_linter = "\"standard\"" -# fixer can be "standard" or "prettier" -js_fixer = "\"standard\"" diff --git a/tmux b/tmux new file mode 100644 index 0000000..295472c --- /dev/null +++ b/tmux @@ -0,0 +1,157 @@ +# ============================= + +run-shell "tmux setenv -g TMUX_VERSION $(tmux -V | sed 's/[^0-9.]//g')" +run-shell "tmux setenv -g TMUX_VERSION_29 $(awk 'BEGIN {print (\"'$(tmux -V | sed 's/[^0-9.]//g')'\" >= 2.9)}')" + +# ----------------------------- +# Global settings +# ----------------------------- +set -g default-terminal xterm-256color +set-option -ga terminal-overrides ",*256col*:Tc" + +# scrollback buffer n lines +set -g history-limit 10000 + +# listen for activity on all windows +set -g bell-action any + +# start window indexing at 1 window so the 1 is easier to reach +set -g base-index 1 + +# tell tmux to use 256 colour terminal +set -g default-terminal "screen-256color" + +# xterm-style function key sequences +setw -g xterm-keys on + +# control automatic window renaming +setw -g automatic-rename off + +# enable wm window titles +set -g set-titles on + +# remove key press delay +set -sg escape-time 0 + +# ----------------------------- +# Key bindings +# ----------------------------- +unbind-key C-v + +# Create window +bind-key C-n new-window +# use C-n to create new windows because C-c is to interrupt + +# split windows (create pane) +bind-key _ split-window -v -c '#{pane_current_path}' +bind-key | split-window -h -c '#{pane_current_path}' + +# kill current pane when the inner process is unable to exit for whatever reason +# bind-key q confirm-before kill-pane + +# or Ctrl- or Ctrl- +# k --- previous pane +# h l --- previous window / next window +# j --- next pane + +# navigate windows +unbind-key l +bind-key h select-window -t :- +bind-key C-h select-window -t :- +bind-key -n C-h select-window -t :- +bind-key l select-window -t :+ +bind-key C-l select-window -t :+ +bind-key -n C-l select-window -t :+ + +# navigate panes +bind-key j select-pane -t :.- +bind-key C-j select-pane -t :.- +bind-key -n C-j select-pane -t :.- +bind-key k select-pane -t :.+ +bind-key C-k select-pane -t :.+ +bind-key -n C-k select-pane -t :.+ + +# Copy-mode (vi-mode) +# + +# vi-style controls for copy mode +setw -g mode-keys vi + +# C-v (the original '[' is still availible) to enter vi-mode +bind-key [ copy-mode + +# select and copy like vi in vi-mode +bind-key -T copy-mode-vi v send -X begin-selection +bind-key -T copy-mode-vi y send -X copy-selection +# if encounter incompatible with send-keys/send -X, use lagacy setting: +# bind-key -t vi-copy 'v' begin-selection +# bind-key -t vi-copy 'y' copy-selection + +# enable navigation in vi mode +bind-key -T copy-mode-vi C-h select-window -t :- +bind-key -T copy-mode-vi C-l select-window -t :+ +bind-key -T copy-mode-vi C-j select-pane -t :.- +bind-key -T copy-mode-vi C-k select-pane -t :.+ + +# reload settings +bind-key R source-file ~/.tmux.conf + +# ----------------------------- +# Statusbar settings +# ----------------------------- + +# use vi-style key bindings in the status line +set -g status-keys vi + +# amount of time for which status line messages and other indicators +# are displayed. time is in milliseconds. +set -g display-time 2000 + +# default statusbar colors +if-shell -b '[ "$TMUX_VERSION_29" = 0 ]' \ + "set -g status-fg white \ + set -g status-bg default \ + set -g status-attr default" +if-shell -b '[ "$TMUX_VERSION_29" = 1 ]' \ + "set -g status-style fg=white,bg=default" + +# default window title colors +if-shell -b '[ "$TMUX_VERSION_29" = 0 ]' \ + "setw -g window-status-fg white \ + setw -g window-status-bg default \ + setw -g window-status-attr dim" +if-shell -b '[ "$TMUX_VERSION_29" = 1 ]' \ + "set -g window-status-style fg=white,bg=default,dim" + +# active window title colors +if-shell -b '[ "$TMUX_VERSION_29" = 0 ]' \ + "setw -g window-status-current-fg cyan \ + setw -g window-status-current-bg default \ + setw -g window-status-current-attr bright \ + setw -g window-status-current-attr underscore" +if-shell -b '[ "$TMUX_VERSION_29" = 1 ]' \ + "set -g window-status-current-style fg=cyan,bg=default,bright,underscore" + +# command/message line colors +if-shell -b '[ "$TMUX_VERSION_29" = 0 ]' \ + "set -g message-fg white \ + set -g message-bg black \ + set -g message-attr bright" +if-shell -b '[ "$TMUX_VERSION_29" = 1 ]' \ + "set -g message-style fg=white,bg=black,bright" + +# what to be displayed on the right status +set -g status-interval 1 +set -g status-right ' } %Y-%m-%d %H:%M:%S' +set -g status-right-length 60 + +# what to be displayed on the left status +set -g status-left-length 30 +set-option -g status-left "#[fg=green]#(echo $USER)#[default].#[fg=blue]#h#[default] { " + +# ----------------------------- +# Platform fix +# ----------------------------- + +if-shell "hash reattach-to-user-namespace 2> /dev/null" 'set-option -g default-command "reattach-to-user-namespace bash"' + diff --git a/zprofile b/zprofile index 02c3d09..25970b3 100644 --- a/zprofile +++ b/zprofile @@ -22,3 +22,16 @@ else start_agent; fi +export GOPATH="$HOME/go" +export GOROOT="$HOME/apps/go" +export NODE_ROOT="$HOME/apps/node" + +export PATH="$GOPATH/bin:$GOROOT/bin:$NODE_ROOT/bin:$PATH" + +if [ -f "$HOME/.cargo/env" ]; then + . "$HOME/.cargo/env" +fi + +if [ -d "$HOME/bin" ]; then + export PATH="$HOME/bin:$PATH" +fi