Intel Mac Setting

iTerm2 Setting

2023. 10. 10. 22:08

https://iterm2.com/

 

iTerm2 - macOS Terminal Replacement

iTerm2 by George Nachman. Website by Matthew Freeman, George Nachman, and James A. Rosen. Website updated and optimized by HexBrain

iterm2.com

 

catalina 에서는 기본으로 zsh 를 사용한다.
Oh-my-zsh 설치해보자

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

 

~/.zshrc 파일 열기

ls -al

vi .zshrc

아래 링크에서 테마를 확인하자
https://github.com/ohmyzsh/ohmyzsh/wiki/Themes

 

Themes

🙃 A delightful community-driven (with 2,100+ contributors) framework for managing your zsh configuration. Includes 300+ optional plugins (rails, git, macOS, hub, docker, homebrew, node, php, pyth...

github.com

 

 ~/.oh-my-zsh/custom/plugins 여기에서 해야한다.

3.Zsh-autosuggestions and Zsh-syntax-highlighting

1)Zsh-autosuggestions

Clone the Zsh-autosuggestions repo

git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
 

Source the script in your .zshrc

echo 'source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh'>>~/.zshrc
 

 

2)Zsh-syntax-highlighting

Clone the Zsh-syntax-highlighting repo

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
 

Source the script in your .zshrc

echo 'source ./zsh-syntax-highlighting/zsh-syntax-highlighting.zsh'>>~/.zshrc

 

3)Powerlevel10K 설치

git clone https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k

 

source ~/powerlevel10k/powerlevel10k.zsh-theme

 

4) agnoster theme 설정

cd ~/.oh-my-zsh/themes/

 

vi agnoster.zsh-theme

 

# Dir: current working directory
prompt_dir() {
  prompt_segment blue $CURRENT_FG '%~'
}
prompt_dir() {
  prompt_segment 39d $CURRENT_FG '%~'
}

 

 

vi ~/.oh-my-zsh/themes/agnoster.zsh-theme

build_prompt() 안에 prompt_newline을 prompt_hg와 promt_end사이에 넣어준다.

prompt_newline() {
  if [[ -n $CURRENT_BG ]]; then
    echo -n "%{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR
%{%k%F{blue}%}$SEGMENT_SEPARATOR"
  else
    echo -n "%{%k%}"
  fi

  echo -n "%{%f%}"
  CURRENT_BG=''
}

함수 추가

vi .zshrc

prompt_context() { 
  # Custom (Random emoji) 
  emojis=("⚡️" "🔥" "🇰" "👑" "😎" "🐸" "🐵" "🦄" "🌈" "🍻" "🚀" "💡" "🎉" "🔑" "🚦" "🌙")
  RAND_EMOJI_N=$(( $RANDOM % ${#emojis[@]} + 1)) 
  prompt_segment black default "{하고싶은이름} ${emojis[$RAND_EMOJI_N]} " 
}

 

 

  • 상태바 활성: Preferences > Profiles > Session > Status bar enabled
  • 상태바 위치 설정: Preferences > Appearance > Status bar location