步骤
安装 iTerm2
brew 安装
brew install iTerm2
设置 iTerm2 主题
第一步,下载主题,在上面的主题配置网站,打开之后在右上角下载安装包,也可以克隆GitHub上的项目:
git clone https://github.com/mbadolato/iTerm2-Color-Schemes.git
第二步,Iterm2 -> Preference -> Profiles -> Color -> Color Presets -> import,导入主题文件之后记得要选择,然后重启iterm2。
安装 Oh My Zsh
- 1、使用wget安装:
sh -c "$(wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
- 2、使用curl安装:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
- 3、手动安装:
# 从git上把oh-my-zsh clone下来到根目录下
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
# 再在根目录下copy一份.zshrc配置
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
安装 Oh My Zsh 的 powerlevel10k 主题
- 该主体非 Oh My Zsh 自带,需下载主题
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
- 打开
~/.zshrc,设置ZSH_THEME="powerlevel10k/powerlevel10k",之后进入 iTerm2 会自动配置 - 想要重新配置:
p10k configure
安装 Oh My Zsh 插件
- tab 补全: zsh-completions
类似于 IDE 中的补全。
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions
- 历史命令提示: zsh-autosuggestions
是一个命令提示插件,当你输入命令时,会自动推测你可能需要输入的命令,按下右键可以快速采用建议。
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
- shell 高亮增强: 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中添加如下:
plugins=(
git
zsh-completions
zsh-autosuggestions
zsh-syntax-highlighting
)
安装 tmux
brew 安装
brew install tmux
总结
iTerm2 快捷键
- 窗口:
- 左右分割:command + D
- 上下分割:command + shift + D
- 全屏切换:command + enter
- 在最近使用的两个标签页之间切换:command + [ 和 command + ]
- 切换到指定位置的屏幕:command + alt + 方向键
- 文本编辑:
- 到行首:control + A
- 到行尾:control + E
- 清除当前行:control + U
- 清屏:command + R(等于 control + L)
- 上一条命令:ctrl + P
- 搜索命令历史:ctrl + R
- 特殊功能:
- 选择即复制 + 鼠标中键粘贴
- command + shift + H 会列出剪切板历史
- 输入开头命令后 按
command+;会自动列出输入过的命令
tmux 最小工作流
- 新建会话
tmux new -s my_session或tmux。 - 在 Tmux 窗口运行所需的程序。
- 按下快捷键
Ctrl+b d将会话分离。 - 下次使用时,重新连接到会话
tmux attach -t my_session或tmux attach -t 0。
关闭 Oh My Zsh
把 ~/.zshrc 中多余的东西删掉
参考资料
安装
优先看:
- iterm2 + oh my zsh + tmux 配置及使用
- oh-my-zsh 安装使用
- zsh 安装与配置,使用 oh-my-zsh 美化终端
- powerlevel10k 一步步带你安装
- zsh 美化: 安装 powerlevel10k 与必备插件
- Tmux 使用教程
不重要:
- iTerm2 安装配置使用指南——保姆级
- Mac终端利器:Homebrew + iTerm2 + Oh My Zsh 教程
- 报错经验
- powerlevel10k github 地址
- Mac完美终端(iterm2 + oh my zash + tmux+ControlMaster)
主题预览
-
iTerm2
- https://iterm2colorschemes.com/
- https://github.com/mbadolato/iTerm2-Color-Schemes
- https://sspai.com/post/53008
-
Oh My Zsh
- https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
- https://www.slant.co/topics/7553/~theme-for-oh-my-zsh
1467

被折叠的 条评论
为什么被折叠?



