开发人员专用。涉及 git、npm、nodejs等多个工具。
安装 zsh
1
2
3
4
| sudo apt update && sudo apt upgrade -y && sudo apt install zsh -y
# 设置默认 Shell(注意:此处不可以用 sudo)
chsh -s $(which zsh)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
插件安装
安装方式:把插件下载到本地的 ~/.oh-my-zsh/custom/plugins 目录。
1
2
3
4
| # 命令提示插件 `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
|
oh-my-zsh 内置了 z 插件。z 是一个文件夹快捷跳转插件,对于曾经跳转过的目录,只需要输入最终目标文件夹名称,就可以快速跳转,避免再输入长串路径,提高切换文件夹的效率。oh-my-zsh 内置了 extract 插件。extract 用于解压任何压缩文件,不必根据压缩文件的后缀名来记忆压缩软件。
启用插件
方式一:修改 ~/.zshrc 中插件列表为
1
| plugins=(git zsh-autosuggestions zsh-syntax-highlighting z extract)
|
方式二:sed 一键替换
1
| sed -i '/^plugins=(/,/)/c\plugins=(git zsh-autosuggestions zsh-syntax-highlighting z extract)' ~/.zshrc
|
开启新的 Shell 或执行 source ~/.zshrc,就可以开始体验插件。
配置主题(可选)
1
| sudo wget -O $ZSH_CUSTOM/themes/haoomz.zsh-theme https://cdn.haoyep.com/gh/leegical/Blog_img/zsh/haoomz.zsh-theme
|
编辑 ~/.zshrc 文件,将 ZSH_THEME 设为 haoomz。当然你也可以设置为其他主题,例如 lukerandall、robbyrussell。
1
2
| # sed 一键替换
sed -i 's/^ZSH_THEME=.*/ZSH_THEME="haoomz"' ~/.zshrc
|
安装 WezTerm
1
2
3
4
5
6
| curl -fsSL https://apt.fury.io/wez/gpg.key | sudo gpg --yes --dearmor -o /usr/share/keyrings/wezterm-fury.gpg
echo 'deb [signed-by=/usr/share/keyrings/wezterm-fury.gpg] https://apt.fury.io/wez/ * *' | sudo tee /etc/apt/sources.list.d/wezterm.list
sudo chmod 644 /usr/share/keyrings/wezterm-fury.gpg
sudo apt update
sudo apt install wezterm
|
前提条件,必须安装 JetBrainsMono Nerd Font 字体
字体安装项目
1
2
3
4
| # 安装 `JetBrainsMono Nerd Font` 字体
curl -OL https://github.com/ryanoasis/nerd-fonts/releases/latest/download/JetBrainsMono.tar.xz
# 下载配置
git clone https://github.com/KevinSilvester/wezterm-config.git ~/.config/wezterm
|
就一点非常重要!!!
- 在 Windows 和 Linux 系统上
- SUPER ⇨ Alt
- SUPER_REV ⇨ Alt + Ctrl
- 所有平台:LEADER ⇨ SUPER_REV + Space
工具一键安装
1
2
3
4
5
6
7
8
9
10
11
12
| # javascript 开发环境
sudo apt install -y nodejs npm git
# pnpm 安装
wget -qO- https://get.pnpm.io/install.sh | sh -
# uv管理工具
curl -LsSf https://astral.sh/uv/install.sh | sh
# nvm版本管理
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash
# bun
curl -fsSL https://bun.com/install | bash
# x-cmd 命令行工具集
eval "$(curl https://get.x-cmd.com)"
|
配置 Git 的用户信息
1
2
| git config --global user.name "xx"
git config --global user.email "xxx@xx.com"
|
配置 npm 镜像源
1
2
3
4
5
6
| # 临时使用淘宝源安装包
npm install react --registry=https://registry.npmmirror.com
# 全局配置镜像源(永久生效)
npm config set registry https://registry.npmmirror.com
# 查看 npm 镜像源
npm config get registry
|
配置 PNPM 镜像源
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
| # 全局配置镜像源(永久生效)
pnpm config set registry https://registry.npmmirror.com
# 查看 npm 镜像源
pnpm config get registry
# 全局bin
pnpm config set global-bin-dir ~/environment/pnpm/bin
# 全局缓存
pnpm config set cache-dir ~/environment/pnpm/cache
# 创建pnpm-state.json文件的目录
pnpm config set state-dir ~/environment/pnpm/state
# 全局安装
pnpm config set global-dir ~/environment/pnpm/global
# 全局仓库路径(类似 .git 仓库)
pnpm config set store-dir ~/environment/pnpm/store
# Node.js 存放位置
pnpm config set pnpm-home ~/environment/pnpm
pnpm config set data-dir ~/environment/pnpm/data
# 启用 `Shell` 自动补全(以 Zsh 为例)
pnpm completion zsh >> ~/.zshrc
# Bash 用户:pnpm completion bash >> ~/.bashrc
# Fish 用户:pnpm completion fish > ~/.config/fish/completions/pnpm.fish
# `pnpm` 存储路径可能积累未使用的依赖,定期清理可释放磁盘空间
# 清理未被引用的包
pnpm store prune
# 查看存储占用
pnpm store status
|
最终效果
