diff --git a/.zshrc b/.zshrc index de31ad2..e26a336 100644 --- a/.zshrc +++ b/.zshrc @@ -25,7 +25,7 @@ eval "$(rbenv init -)" export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH" # Path to your oh-my-zsh installation. -export ZSH=$HOME/.oh-my-zsh +# export ZSH=$HOME/.oh-my-zsh # Set name of the theme to load. Optionally, if you set this to "random" # it'll load a random theme each time that oh-my-zsh is loaded. @@ -147,3 +147,8 @@ alias tmux="tmux -2" transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; } + +if [[ -f ~/.zshrc.local ]]; then + source $HOME/.zshrc.local +fi + diff --git a/.zshrc.local b/.zshrc.local new file mode 100644 index 0000000..9c8f8a7 --- /dev/null +++ b/.zshrc.local @@ -0,0 +1 @@ +# custom alias and othet local config diff --git a/README.md b/README.md index e5fa00a..51b9af2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ vim, zsh, tmux 相关的配置 +## Overview +使用 [antigen](https://gtk.pw/antigen) 来管理 zsh 插件 + vundle 相关配置在 vundle_vimrc 中,用 vundle 管理插件,插件列表`:PluginList`查看 python 相关配置在 python_vimrc 中 @@ -47,4 +50,23 @@ with yum: Plugin 'tpope/vim-surround' Plugin 'git://git.wincent.com/command-t.git' +## Tmux +Tmux 配置參考了 [gpakosz](https://github.com/gpakosz/.tmux) 的大部分配置。Tmux 的基础部分可以参考[这篇](http://einverne.github.io/post/2017/07/tmux-introduction.html) 文章。 + +需要满足 + +- `tmux >= 2.1` +- 在 tmux 运行的环境中,`$TERM` 需要设置为 `xterm-256color` + +功能 + +- 在保留`C-b` 的前提下,`C-a` 作为第二选择 +- `prefix + |` 开启垂直分割的新 panel, `prefix + -` 水平分割 +- `C-hjkl` 直接在多 panel 中跳转 + +使用 Tmux Plugin Manager 管理,默认有如下插件 + + set -g @plugin 'tmux-plugins/tpm' + set -g @plugin 'tmux-plugins/tmux-sensible' + set -g @plugin 'tmux-plugins/tmux-yank' diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index fabe5b5..b62aa9c 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -1,3 +1,4 @@ +# https://github.com/gpakosz/.tmux # ---- general ---------------------------------------------------- set -g default-terminal "screen-256color" # colors! setw -g xterm-keys on @@ -8,12 +9,15 @@ set -s focus-events on #unbind ^b # unbind defaul prefix Control+b #set -g prefix 'C-\' # bind new prefix Control+a #bind-key 'C-\' send-prefix -#set -g prefix2 C-a -#bind C-a send-prefix -2 +set -g prefix2 C-a +bind C-a send-prefix -2 set -q -g status-utf8 on setw -q -g utf8 on +# edit configuration +bind e new-window -n '~/.tmux.conf.local' "sh -c '\${EDITOR:-vim} ~/.tmux.conf.local && tmux source ~/.tmux.conf && tmux display \"~/.tmux.conf sourced\"'" + bind r source-file ~/.tmux.conf \; display-message "tmux config reloaded" # create new short cut to reload tmux.conf set -g history-limit 5000 # boost history @@ -31,6 +35,12 @@ setw -g automatic-rename on # rename window to reflect current program set -g renumber-windows on # renumber windows when a window is closed set -g set-titles on +set -g set-titles-string '#h ❐ #S ● #I #W' + +set -g display-panes-time 800 # slightly longer pane indicators display time +set -g display-time 1000 # slightly longer status messages display time + +set -g status-interval 10 # redraw status line every 10 seconds # 监视窗口信息,如有内容变动,进行提示 set -g monitor-activity on @@ -137,6 +147,8 @@ setw -g window-status-fg cyan setw -g window-status-bg colour234 setw -g window-status-attr dim +# user defined +if '[ -f ~/.tmux.conf.local ]' 'source ~/.tmux.conf.local' # automatic install tpm if "test ! -d ~/.tmux/plugins/tpm" \