iTerm2 + ZSH 簡風設定

LoadChange發表於2018-06-25

iTerm2 + ZSH 簡風設定

iTerm2 + ZSH 簡風設定

iTerm2 設定

  1. iTerm2 => Make iTerm2 Default Term

  2. iTerm2 => Preferences => Profiles

    General

     Working Directory => Reuse previous session's directory
    複製程式碼

    Color

     Color Presets... => Solarized Dark
    複製程式碼

    Text

     Change Font => Meslo LG M Regular for Powerline
     (下載地址:https://github.com/powerline/fonts/blob/master/Meslo%20Slashed/Meslo%20LG%20M%20Regular%20for%20Powerline.ttf)
    複製程式碼

zsh 安裝設定

  1. 安裝Homebrew
     ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 
    複製程式碼
  2. 安裝zsh
     brew install zsh 
    複製程式碼
  3. 安裝autojump
     brew install autojump
     // zshrc新增
     [[ -s $(brew --prefix)/etc/profile.d/autojump.sh ]] && . $(brew --prefix)/etc/profile.d/autojump.sh
     // 生效配置
     source ~/.zshrc
    複製程式碼
  4. 安裝thefuck
     brew install thefuck
    複製程式碼
  5. 安裝 zsh-syntax-highlighting
     brew install zsh-syntax-highlighting
     // 配置.zshrc檔案,插入一行。
     source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
     // 生效配置
     source ~/.zshrc
    複製程式碼
  6. plugins
     git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
     // 修改zshrc
     plugins=(git)  => plugins=(zsh-autosuggestions git)
    複製程式碼

.zshrc檔案的變化

export PATH=$HOME/bin:/usr/local/bin:$PATH
source ~/.bash_profile
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

eval $(thefuck --alias)
ZSH_THEME="agnoster"


plugins=(zsh-autosuggestions git)

alias cls='clear'
alias ll='ls -l'
alias la='ls -a'
alias vi='vim'
alias javac="javac -J-Dfile.encoding=utf8"
alias grep="grep --color=auto"
alias -s js=vi
alias -s c=vi
alias -s java=vi
alias -s txt=vi
alias -s gz='tar -xzvf'
alias -s tgz='tar -xzvf'
alias -s zip='unzip'
alias -s bz2='tar -xjvf'

[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh

複製程式碼

到這裡就差不多能用了,但是呢,這個常長長的計算機名看著真是不舒服,去掉!!

修改游標前的計算機名

  1. cd ~/.oh-my-zsh/themes
  2. vim agnoster.zsh-theme,搜到 USER@%m 這裡的%m就是機器名,刪。我是前端改成@fe

相關文章