自从用了远程开发机,天天和命令行打交道,一套属于自己的 shell 配置已经刻不容缓,否则工作效率太低了。
现在
我自己搞了一个 dotfiles 仓库,专门用来一键初始化机器。
git clone https://github.com/Smith-Cruise/dotfiles.git
然后执行如下命令:
# install prepared software
bash install.sh
# enter zsh shell
zsh
# setup zsh plugins and theme
zsh setup.sh
过去,仅供参考
ZSH
- 安装 zsh:
sudo apt install zsh
- 安装:
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
- 安装主题【可选】:
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
- 启用主题【可选】:设置
.zhsrc
中的ZSH_THEME="powerlevel10k/powerlevel10k"
- 安装 zsh-autosuggestions:
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
- 安装 zsh-syntax-highlighting:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
- 开启插件:编辑
.zshrc
中的plugins=(git extract zsh-autosuggestions zsh-syntax-highlighting)
TMUX
- 安装 oh my tmux:
cd ~
,git clone https://github.com/gpakosz/.tmux.git
,ln -s -f .tmux/.tmux.conf
,cp .tmux/.tmux.conf.local .
- 设置
.tmux.conf.local
中的配置:tmux_conf_new_window_retain_current_path=true
- 不要启用:
set -g mouse on
两个不常用的 tmux 命令
tmux new -s session-name
ctrl + b + ,
tmux rename window
原创文章,作者:Smith,如若转载,请注明出处:https://www.inlighting.org/archives/shell-dev-env