개발 환경 초기 세팅 - zsh편

두비두밥·2023년 2월 19일
0

개발 환경 세팅

목록 보기
2/2
post-thumbnail

👊 설치 리스트

  • iterm2
  • zsh
  • ohmyzsh

iterm2 설치

https://iterm2.com/downloads.html

zsh 설치

  1. sudo apt-get install zsh 로 zsh 설치
  2. chsh -s /usr/bin/zsh 로 기본 셸을 zsh로 바꾸기
  3. which zsh로 /usr/bin/zsh 나오는지 확인

ohmyzsh

  1. curl 설치가 안된 경우 우선 입력 >> sudo apt-get install curl
  2. sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" 입력
  3. vi ~/.zshrc 입력하여 테마 변경
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
// *********************
ZSH_THEME="agnoster" // 이거 바꿔주기
// *********************


# Set list of themes to pick from when loading at random
// 아래 생략

👊 터미널 꾸미기

폰트 변경

  1. 바탕화면이나 util 폴더 따로 생성 후
    git clone https://github.com/powerline/fonts.git 입력
  2. cd fonts
  3. ./install.sh
  4. 터미널 설정으로 들어가서 폰트를 Ubuntu Mono derivative Powerline Regular 로 변경

이모티콘, 이름 추가

  1. open ~/.zshrc 입력
  2. 열린 메모장에서 제일 하단에 아래 코드 입력

// 윗줄 생략
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

// *********************
prompt_context() {
  if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
    prompt_segment black default "%(!.%{%F{yellow}%}.)$USER"
  fi
}

prompt_context() { 
  # Custom (Random emoji) 
  emojis=("🐿" "🤍" "💛" "🐰" "🐥" "🦋" "🌈" "🍻" "🚀" "🍒" "🌙")
  RAND_EMOJI_N=$(( $RANDOM % ${#emojis[@]} + 1)) 
  prompt_segment black default "subin ${emojis[$RAND_EMOJI_N]} " 
}
// ********************* 이렇게 두문단 추가하기

👊 VsCode 연동

보통 이렇게 했을때 VsCode 터미널을 키면 바로 연동이 된다. 그러나..! 나는 연동이 되지 않았다..

원인은 mac의 나라는 관리자 계정을 연습용으로 두개 생성했는데 이 과정에서 권한 관련 에러가 생긴것이 아닐까 추측된다.

나는 에러메세지를 무시하는 방법으로 문제를 해결하였다.
vi ~/.zshrc
ZSH_DISABLE_COMPFIX = “true”를 입력해준다.

# Add wisely, as too many plugins slow down shell startup.
plugins=(git)

ZSH_DISABLE_COMPFIX="true" // source oh-my-zsh.sh 실행전 자동으로 에러메세지 무시

source $ZSH/oh-my-zsh.sh

# User configuration

출처

http://programmingskills.net/oh-my-zsh-%EA%B3%BC-agnoster-%ED%85%8C%EB%A7%88-%ED%8F%B0%ED%8A%B8-%EA%B9%A8%EC%A7%90-%EC%97%86%EC%9D%B4-%EC%82%AC%EC%9A%A9%ED%95%98%EB%8A%94-%EB%B2%95/

https://heoseongh.github.io/linux/zsh-compinit/

profile
나는야 개자이너 될거야! (짝)

0개의 댓글