Mac下终端升级(iTem + oh-my-zsh + powerlevel9k)

作为一个一直在路上追求艺术和高效的汉子,为了在使用命令行的过程中让自己更加赏心悦目,我又来折腾我的终端了。

效果图
iTem2Setting00.gif

安装oh-my-zsh

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

但是在我这报错,我就直接将install.sh下载下来,然后sudo sh install.sh进行了安装。
执行完以后如果没有出现什么报错,在Home文件夹下生成了 ~/.oh-my-zsh文件夹就代表成功了。

安装oh-my-zsh的插件

  1. 安装语法高亮插件
    1. git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
    2.安装自动补全插件
    1. git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions

    安装字体

    因为我们要用的主题会用到很多的特殊icon,所以iTerm2 选用的字体必需要支援这种特殊icon font。
    没有安装的话会现在如下这样,遇到icon会变框框问号:
    点击Meslo LG L DZ Regular Nerd Font Complete 下载字体,双击进行安装。

    安装zsh powerlevel9k 主题

    1. git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k

    修改zsh配置

    为了让powerlevel9k主题生效,需要修改~/.zshrc 文件,修改主题为powerlevel9k: ```shell export ZSH=”$HOME/.oh-my-zsh”

ZSH_THEME=”powerlevel9k/powerlevel9k”

Nerd 字体

POWERLEVEL9K_MODE=”nerdfont-complete” POWERLEVEL9K_PROMPT_ON_NEWLINE=true

command line左边想显示的内容:系统icon、用户、写权限、路径、版本控制系统等

POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(os_icon user dir_writable dir vcs)

command line右边想显示的内容:状态、命令执行时间、…、系统时间、已用空间、RAM占用

POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status command_execution_time root_indicator background_jobs time disk_usage ram)

POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX=”%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )”

POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=””

POWERLEVEL9K_USER_ICON=”\uF415” # 

POWERLEVEL9K_ROOT_ICON=”\uF09C”

POWERLEVEL9K_SUDO_ICON=$’\uF09C’ # 

POWERLEVEL9K_TIME_FORMAT=”%D{%H:%M}”

POWERLEVEL9K_VCS_GIT_ICON=’\uF408 ‘

POWERLEVEL9K_VCS_GIT_GITHUB_ICON=’\uF408 ‘

ZSH_DISABLE_COMPFIX=true

ENABLE_CORRECTION=”true” COMPLETION_WAITING_DOTS=”true”

zsh插件

plugins=( git iterm2 macports man osx python composer zsh-syntax-highlighting zsh-autosuggestions )

source $ZSH/oh-my-zsh.sh

alias suroot=’sudo -E -s’

source ~/.bash_profile

if [ -f ~/.bash_profile ]; then . ~/.bash_profile; fi ``` 参考文档
https://wangcong.net/article/iTem2Setting.html

mac美化工具

👍 Starship 链接

配色主题

Iterm2-color-schemes