我的终端配置

2022-12-15

Terminal

由 Item 2 转换为 Wrap 用户了,目前体验非常良好

Font

要求 : 跨平台, 开源, 免费, 美观
  • PowerLine
  • MesloLGM NF

Theme

采用 spaceship 主题, 简洁美观
# 1. 克隆主题仓库
git clone https://github.com/spaceship-prompt/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt" --depth=1

# 2.软连接目录到本地克隆仓库
ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"

# 3. 配置zshrc文件
vim ~/.zshrc # 编辑zshrc文件
ZSH_THEME="spaceship"  #配置zsh主题为spaceship

# 4. 重载zsh配置以生效
source ~/.zshrc

git alias

## git lias
alias gc='git clone'
alias gs='git status'
alias gd='git diff'
alias ga='git add .'
alias gap='git add -p'
alias gcm='git commit -m'
alias gca='git commit --amend'
alias gco='git checkout'
alias gcob='git checkout -b'
alias gcom='git checkout master'
alias gcp='git cherry-pick'
alias gb='git branch'
alias gba='git branch -a'
alias gbd='git branch -d'
alias gbr='git branch -r'
alias gp='git pull'
alias gpr='git pull --rebase'
alias gpu='git push'
alias gpf='git push --force'
alias gpnv='git push --no-verify'
alias gl='git log'
alias glg='git log --graph'
alias grl='git reflog'

## npm scripts
alias dev='npm run dev'
alias start='npm run start'
alias build='npm run build'
alias test='npm run test'
alias deploy='npm run deploy'

.zshrc

还是使用经典的 oh-my-zsh, 有时间也折腾下 fish 等其他方案
# 1.查看当前系统 shell
echo $SHELL

# 2.查看系统安装的 shell
cat /etc/shells

# 3. 安装oh-my-zsh(安装失败请使用魔法 / 或者自行克隆仓库做镜像)
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

# 4. 查看zsh版本,出来即成功
zsh --version

# 5. 切换系统 shell 为 zsh
chsh -s/bin/zsh

# 6. 重载shell配置以生效
source ~/.zshrc