• mac 配置iTerm2和oh-my-zsh主题


    一、安装iTerms2
    chsh -s /bin/zsh
    
    • 1
    二、安装oh-my-zsh
    • 根据官网,使用curl或者wget下载
    # curl 方式
    $ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
    
    # 或 wget 方式
    $ sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 注意:由于“不知名原因”,可能出现无法下载情况,如:installer: Failed to connect to github: Connection refused
    • 直接用git clone下载
    git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
    cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
    
    • 1
    • 2
    三、iTerms2换主题搭色
    • 修改主题,改用agnoster
    # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
    # ZSH_THEME="robbyrussell"
    ZSH_THEME="agnoster"
    
    # Set list of themes to pick from when loading at random
    # Setting this variable when ZSH_THEME=random will cause zsh to load
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    请添加图片描述

    • 使用Dark Backgrounp,修改显示颜色,Blue改成268bd2,Yellow改用b58900,参考Preferences——Profiles——colors——Color Presets——Solarized Dark配色
      请添加图片描述
      请添加图片描述

    • 隐藏用户名和主机名,vim ~/.oh-my-zsh/themes/agnoster.zsh-theme,注释if语句里面哪一行

    ### Prompt components
    # Each component will draw itself, and hide itself if no information needs to be shown
    
    # Context: user@hostname (who am I and where am I)
    prompt_context() {
      if [[ "$USERNAME" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
        # prompt_segment black default "%(!.%{%F{yellow}%}.)%n@%m"
      fi
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    请添加图片描述

    • 修改字体
    git clone https://github.com/powerline/fonts.git --depth=1
    cd fonts
    ./install.sh
    
    • 1
    • 2
    • 3

    请添加图片描述
    在这里插入图片描述

    四、安装插件
    • 安装目录跳转工具(autojump是一个命令行工具,它允许你可以直接跳转到你喜爱的目录,而不受当前所在目录的限制。意思就是可以让你更快地切换目录,而不用频繁地使用cd tab 等命令。)
    brew install autojump
    
    • 1
    • 安装自动补全插件
    cd ~/.oh-my-zsh/custom/plugins
    git clone https://github.com/zsh-users/zsh-autosuggestions.git
    
    • 1
    • 2
    • 安装命令高亮插件
    cd ~/.oh-my-zsh/custom/plugins
    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
    
    • 1
    • 2
    • 加载命令配置
    echo '
    [ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh
    source ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
    source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
    ' >> ~/.zshrc
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 在 ~/.zshrc 中修改 plugins=(git) 为,zsh-syntax-highlighting要放到最后面
    plugins=(
        git
        autojump
        zsh-autosuggestions
        zsh-syntax-highlighting
    )
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    五、参考
  • 相关阅读:
    Git简介
    最长上升子序列及拓展
    线程、线程组、线程池、锁、事务、分布式
    【等级测评师】等级测评师怎么报名?多少分及格?
    6.30模拟赛总结
    WiFi 运动,心跳,跌倒监测 (一)
    C#__资源访问冲突和死锁问题
    20221128-1Spring_day02(资料来自黑马程序)
    RabbitMQ(四):RabbitMQ高级特性
    vue项目因内存溢出启动报错
  • 原文地址:https://blog.csdn.net/tianjiewang/article/details/126842360