Mac终端美化(iterm2+zsh+oh-my-zsh+powerlevel10k)
阅读原文时间:2023年07月09日阅读:3

方式一:官网下载

https://iterm2.com/

方式二:百度云下载

链接: https://pan.baidu.com/s/1ZZnTDbVcg4A2NAu0gmBZIg

密码:关注公众号 【点九先生】 回复:iterm2 即可获得

macos下默认已经安装了zsh,可以直接使用

# 终端输入命令,然后输入密码即可将zsh切换成默认shell $ chsh -s /bin/zsh

  • ### 使用 curl

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

  • ### 使用 wget

sh -c “$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)”

方式一:官方下载

https://nerdfonts.com/

找到Downloads,直接下载 Hack 字体,别问我为什么,如果是mac,直接双击安装下载的字体即可安装,然后修改 oh my zsh 的变量文件 ~/.zshrc,修改变量 POWERLEVEL9K_MODE=‘nerdfont-complete’

方式二:百度云下载

链接: https://pan.baidu.com/s/1ZZnTDbVcg4A2NAu0gmBZIg

密码:关注公众号 【点九先生】 回复:iterm2 即可获得

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

注意export ZSH="/Users/dianjiu/.oh-my-zsh"这里用户名dianjiu改成你的用户名

sudo vim ~/.zshrc


# Prompts
POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR='\uE0C0'
#POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR='\uE0C0'
POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR='\uE0C2'
#POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR='\uE0C2'
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir dir_writable vcs virtualenv)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status background_jobs command_execution_time ip)
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
POWERLEVEL9K_SHORTEN_DELIMITER=..
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=$'\n'
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="\uF460%F{073}\uF460%F{109}\uF460%f "
export ZSH="/Users/dianjiu/.oh-my-zsh"
POWERLEVEL9K_MODE='nerdfont-complete'
ZSH_THEME="powerlevel10k/powerlevel10k"
export UPDATE_ZSH_DAYS=13
HIST_STAMPS="yyyy/mm/dd"
plugins=(
    git
    colored-man-pages
    colorize
    github
    brew
    osx
    docker
    docker-compose
    zsh-autosuggestions
    zsh-syntax-highlighting
    autopep8
    python
)
source $ZSH/oh-my-zsh.sh
alias zshconfig="vim ~/.zshrc"
alias vimconfig="vim ~/.vimrc"
alias ansibleconfig="vim ~/.ansible/ansible.cfg"
alias grep='grep --color=auto'


source ~/.zshrc

问题一:下载插件报错

Cloning into 'zsh-syntax-highlighting'... fatal: unable to access 'https://github.com/zsh-users/zsh-syntax-highlighting.git/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443

问题解决

git config --global http.postBuffer 4194304000


sudo git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
Password:
Cloning into 'zsh-syntax-highlighting'... remote: Enumerating objects: 6913, done. remote: Total 6913 (delta 0), reused 0 (delta 0), pack-reused 6913 Receiving objects: 100% (6913/6913), 1.45 MiB | 64.00 KiB/s, done. Resolving deltas: 100% (4675/4675), done.

问题二:vscode终端字体乱码

在setting.json中新增

"terminal.integrated.fontFamily": "Hack Nerd Font",

https://www.jianshu.com/p/609c1f554ee6

https://www.jianshu.com/p/7162c4b7a438

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器