IT Repository

MacOS iTerm2 설정하기 본문

환경설정

MacOS iTerm2 설정하기

IT찬니 2020. 4. 20. 22:15
  1. Install brew
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. Configure zsh
    # 1. Install zsh
    brew install zsh
    
    # 2. Install oh-my-zsh
    sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
    
    # 3. Install zsh plugins
    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
    git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
    brew install autojump
    
    # 4. Edit .zshrc
    ZSH_THEME="agnoster" # default: "robbyrussell"
    plugins=(
        git zsh-syntax-highlighting zsh-autosuggestions autojump
    )
    
    # 5. Apply .zshrc
    source ~/.zshrc
  3. Configure iTerm2
    # 1. Install iTerm2
    brew cask install iterm2
    
    # 2. Set ITERM2_CONFIG
    export ITERM2_CONFIG=$HOME/.config
    
    # 3. Configure iTerm2 Color Schemes
    cd $ITERM2_CONFIG
    git clone https://github.com/mbadolato/iTerm2-Color-Schemes.git
    # 1) iTerm2 > Preferences > Profiles > Colors > Color Presets
    # 2) import
    #	- $ITERM2_CONFIG/iTerm2-Color-Schemes/schemes 에서 원하는 테마 선택 (Dracula)
    
    # 4. Configure Powerline Font
    cd $ITERM2_CONFIG
    git clone https://github.com/powerline/fonts.git
    ./fonts/install.sh
    # 1) iTerm2 > Preferences > Profiles > Text > Font
    # 2) Use a different font for non-ASCII text
    #	- Check
    # 3) Non-ASCII Font
    #	- Meslo LG S For Powerline
    
    # 5. Configure iTerm2 Status Bar
    # 1) Preference > Profiles > Session
    # 2) Status bar enabled
    #	- Check
    # 3) Configure Status Bar
    #	- Current directory, Git state, CPU, Memory, Network
  4. Multi-Line Prompt (USE THIS OCCASIONALLY!!!) 
    # 1. Edit Current Using Theme
    # e.g. vim $ZSH/themes/agnoster.zsh-theme
    
    build_prompt() {
      RETVAL=$?
      prompt_status
      prompt_virtualenv
      prompt_aws
      prompt_context
      prompt_dir
      prompt_git
      prompt_bzr
      prompt_hg
      prompt_newline # Newly added function for multi-line prompt
      prompt_end
    }
    
    prompt_newline() {
      if [[ -n $CURRENT_BG ]]
      then
        echo -n "%{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR %(?.%F{$CURRENT_BG}.%F{red})>%f"
      else
        echo -n "%{%k%}"
      fi
      echo -n "%{%f%}"
      CURRENT_BG=''
    }
    
    PROMPT='%{%f%b%k%}$(build_prompt) '

robbyrussell without multi-line 예시

'환경설정' 카테고리의 다른 글

Jenv 설치 및 세팅  (0) 2022.01.23
Pyenv 설치 및 세팅  (0) 2022.01.23
Poetry 설치 및 세팅  (0) 2022.01.23
따라만 하면 되는 Jupyter Lab 설치  (4) 2020.01.23
ipynb 파일을 티스토리에 알맞게 Convert 하기  (0) 2020.01.05
Comments