(iTerm2) - 配置主题、插件

最终效果

效果

Vim 操作

// 编辑
vim ~/.zshrc
// 立即生效
source ~/.zshrc

1.安装 iTerm2

iTerm2 官网

2.安装 Oh My Zsh

a.安装

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

// 如果安装失败,可以使用 gitee 的地址
sh -c "$(curl -fsSL https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh)"

b.基本配置

// 复制 vim 配置模版
cp /usr/share/vim/vimrc ~/.vimrc  

// 开启语法高亮
echo 'syntax on' >> ~/.vimrc  

// 开启行号显示
echo 'set nu!' >> ~/.vimrc  

3.设置主题

a.编辑 .zshrc 文件

vim ~/.zshrc

b.把 ZSH_THEME 的值改为 "agnoster"

4.安装 Powerline 字体

a.安装

// 将 Powerline 字体文件下载到「下载」文件夹中
cd ~/Downloads && git clone https://github.com/powerline/fonts.git  

// 安装所有 Powerline 字体
cd fonts && ./install.sh  

// 删除下载的字体文件
cd && rm -rf ~/Downloads/fonts  

b.配置字体 DejaVu Sans Mono for Powerline,如图

image.png

5.去除路径前缀

a.编辑配置文件 agnoster.zsh-theme

vim ~/.oh-my-zsh/themes/agnoster.zsh-theme

b.修改内容

// 注释这一行代码,或者改为你想要的格式
// prompt_segment black default "%(!.%{%F{yellow}%}.)%n@%m" 

// 原代码
# Context: user@hostname (who am I and where am I)
prompt_context() {
  if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
    prompt_segment black default "%(!.%{%F{yellow}%}.)%n@%m"
  fi
}

// 改为
# Context: user@hostname (who am I and where am I)
prompt_context() {
  if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
    #prompt_segment black default "%(!.%{%F{yellow}%}.)%n@%m"
  fi
}

6.沉浸式体验

a.修改主题为Minimal,如图

image.png

7.添加常用插件

a.添加插件 zsh-autosuggestions

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

b.添加插件 zsh-syntax-highlighting

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

c.配置使用的插件

plugins=(git z zsh-autosuggestions zsh-syntax-highlighting)

a.编辑配置文件 .zshrc

vim ~/.zshrc

b.修改为

plugins=(git z zsh-autosuggestions zsh-syntax-highlighting)

c.如图

image.png

8.Complete

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 一、iTerm2简介 iTerm 2 is a terminal emulator for Mac OS X th...
    ouisun阅读 19,788评论 1 58
  • 下载iTerm2 iTerm2 检查电脑shell是否是zsh 如果你的输出不是-zsh,需要手动切换一下 安装o...
    二斤寂寞阅读 8,303评论 0 4
  • 使用了半年Mac OS 自带的终端,用起来虽然有些不太方便,始终想换个终端的念头。今天看到同事使用了iTerm2,...
    青灯无味阅读 2,732评论 0 1
  • 1.对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引。 2....
    慕容小伟阅读 617评论 0 1
  • 找一个角落,把自己放在那里晒太阳。我要吸足日光,然后在夜晚温暖你的手掌。 你冰冷的手触到我的肌肤,你说我温暖的像阳...
    深鸿阅读 205评论 0 0