准备工作:

1,安装iterm2和git

2,安装ohmysh

#!/bin/sh

sudo apt-get install git zsh

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

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

sed -i -- 's/ZSH_THEME="robbyrussell"/POWERLEVEL9K_CUSTOM_LIVE="echo -n \\"\\uf525 LIVE \\uf525\\""\nPOWERLEVEL9K_CUSTOM_LIVE_BACKGROUND="red"\nPOWERLEVEL9K_CUSTOM_LIVE_FOREGROUND="white"\nPOWERLEVEL9K_MODE="nerdfont-complete"\nPOWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_live host dir vcs)\nPOWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs load ram disk_usage time)\nZSH_THEME="powerlevel9k\/powerlevel9k"\nDEFAULT_USER=roamsys\n/g' ~/.zshrc

git clone https://github.com/zsh-users/zsh-autosuggestions.git ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting

sed -i -- 's/^plugins=(/plugins=(\n  zsh-autosuggestions\n  zsh-syntax-highlighting\n/g' ~/.zshrc

3,下载配置文件

git clone https://github.com/chongqiangchen/iterm-config.git ${ZSH_CUSTOM:-~}

4,下载 awesome-terminal-fonts

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

第一步:

1、打开准备工作中的第二步下载的文件夹

2、打开Iterm2 -> Preference -> Profiles -> Color -> Color Presets -> import

导入material-design-colors.itermcolors文件,并选择

注意,这边还需要一点改变: Color中一栏选择为ANSI Colors的black颜色改为4b585e,后面配置需要这个颜色。

3、安装iterm-config文件夹中的.ttf两个字体

4、打开Iterm2 -> Preference -> Profiles -> Text 按照图中的设置

注意,如果需要透明度或者背景可以在Iterm2 -> Preference -> Profiles -> Window中进行调节设置

第二步:

1、进入zshrc

cd
vi .zshrc

2、配置zshrc

确认一下配置是否存在,不存在或不一样请加入这些或更改:

source ~/awesome-terminal-fonts/build/*.sh
source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

POWERLEVEL9K_MODE='nerdfont-complete'

ZSH_THEME="powerlevel9k/powerlevel9k"

source $ZSH/oh-my-zsh.sh

引入powerlevel9k的设置:

POWERLEVEL9K_OS_ICON_BACKGROUND='black'

POWERLEVEL9K_CONTEXT_TEMPLATE='%n'
POWERLEVEL9K_CONTEXT_DEFAULT_BACKGROUND='black'
POWERLEVEL9K_CONTEXT_DEFAULT_FOREGROUND='white'
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX='\u256D\u2500'
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="%F{014}\u2570%F{cyan}>%F{073}>%F{101}>%f "
POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='yellow'
POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND='yellow'
POWERLEVEL9K_VCS_UNTRACKED_ICON='?'

POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(os_icon context dir vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status time ip background_jobs)

POWERLEVEL9K_SHORTEN_DIR_LENGTH=2

POWERLEVEL9K_TIME_FORMAT="%D{%H:%M}"
POWERLEVEL9K_TIME_BACKGROUND='white'
POWERLEVEL9K_HOME_ICON=''
POWERLEVEL9K_HOME_SUB_ICON=''
POWERLEVEL9K_FOLDER_ICON=''
POWERLEVEL9K_STATUS_VERBOSE=true
POWERLEVEL9K_STATUS_CROSS=true

3、结束,重新开启终端便可以看到新的界面。

 

注以上配置大部分来自于https://zhuanlan.zhihu.com/p/75798519;由于其配置对于小白来讲还不够详细,再次我做优化教程调整,并以发布,

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐