๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ’ป ์ƒ์‚ฐ์„ฑ

Mac์—์„œ ํ„ฐ๋ฏธ๋„ ์„ธํŒ…ํ•˜๊ธฐ (+ ์ปค์Šคํ…€ ํ…Œ๋งˆ ๊ณต์œ )

by ye-ha 2022. 2. 5.

1. vim ์„ธํŒ…

๋Œ€๋ถ€๋ถ„์˜ UNIX, ๊ทธ๋ฆฌ๊ณ  Mac์— ๊ธฐ๋ณธ์ ์œผ๋กœ vi ์—๋””ํ„ฐ๊ฐ€ ์„ค์น˜๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. vim์€ vi์—๋””ํ„ฐ๋ฅผ ํฌํ•จํ•œ ์—…๊ทธ๋ ˆ์ด๋“œ ๋ฒ„์ „์ด๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ๋งˆ์šฐ์Šค๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  ํ‚ค๋ณด๋“œ๋กœ ์ž‘๋™๋˜๊ธฐ ๋•Œ๋ฌธ์— ๋งˆ์šฐ์Šค๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด ์ถ”๊ฐ€ ์„ค์ •์„ ํ•ด์ค˜์•ผ ํ•ฉ๋‹ˆ๋‹ค.

vi ~/.vimrc ๋ฅผ ์ž…๋ ฅํ•ด์„œ ~ (root) / (์— ์žˆ๋Š”) .vimrc ํŒŒ์ผ์„ ์—ฝ๋‹ˆ๋‹ค.
a ๋ฅผ ์ž…๋ ฅํ•˜๋ฉด ์ž…๋ ฅ ๋ชจ๋“œ๋กœ ๋ฐ”๋€๋‹ˆ๋‹ค. ์•„๋ž˜ ํ•ญ๋ชฉ์„ ๋ถ™์—ฌ ๋„ฃ์–ด ์ค๋‹ˆ๋‹ค. ๋งˆ์šฐ์Šค๋‚˜ ์ปค์„œ ๋ผ์ธ ๊ฐ•์กฐ, ์ค„ ๋ฒˆํ˜ธ ํ‘œ์‹œ๋Š” ํ•ญ์ƒ ์ง€์ •ํ•ด์ฃผ๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

set mouse=a       " vim์—์„œ ๋งˆ์šฐ์Šค๋ฅผ ์‚ฌ์šฉ
set cursorline    " ์ปค์„œ๊ฐ€ ์žˆ๋Š” ๋ผ์ธ ๊ฐ•์กฐ
set nu            " ์™ผ์ชฝ์— ์ค„ ๋ฒˆํ˜ธ๋ฅผ ํ‘œ์‹œ
set title         " ํ˜„์žฌ ์—ด๋ฆฐ ํŒŒ์ผ ์ด๋ฆ„์„ ์ฐฝ ํƒ€์ดํ‹€์— ํ‘œ์‹œ
set sc            " ์™„์„ฑ ์ค‘์ธ ๋ช…๋ น์–ด ํ‘œ์‹œ
if has("syntax")  " syntax๊ฐ€ ์žˆ๋Š” ํŒŒ์ผ์—์„œ
    syntax on     " syntax highlighting ๊ธฐ๋Šฅ์„ on
endif
set showmatch     " (), {} match

esc๋ฅผ ๋ˆŒ๋Ÿฌ ์ž…๋ ฅ ๋ชจ๋“œ๋ฅผ ๋‚˜๊ฐ„ ํ›„ :wq ๋ฅผ ์ž…๋ ฅํ•ด ์ €์žฅ(w)ํ•˜๊ณ , ์ข…๋ฃŒ(q)ํ•ฉ๋‹ˆ๋‹ค.

ํ„ฐ๋ฏธ๋„์„ ๊ป๋‹ค ์ผœ๊ฑฐ๋‚˜ source ~/.vimrc ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•˜๋ฉด ์ ์šฉ๋ฉ๋‹ˆ๋‹ค. source๋Š” ํ˜„์žฌ ์‰˜์—์„œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰์‹œํ‚ค๋Š” ๋ช…๋ น์–ด์ž…๋‹ˆ๋‹ค. ์ƒˆ๋กœ์šด ์„ค์ •๊ฐ’์„ ์ ์šฉ์‹œ์ผœ ๋ด…์‹œ๋‹ค.

 


2. iterm ์„ค์น˜

https://iterm2.com/

ํ„ฐ๋ฏธ๋„ ์•ฑ ๋Œ€์‹  ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

 


3. ohmyzsh ์„ค์น˜

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

์นดํƒˆ๋ฆฌ๋‚˜๋ถ€ํ„ฐ ๊ธฐ๋ณธ ์‰˜์ด bash์—์„œ zsh(Z shell)๋กœ ๋ณ€๊ฒฝ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ด์ „ ๋ฒ„์ „์„ ์‚ฌ์šฉํ•˜๊ณ  ๊ณ„์‹œ๋‹ค๋ฉด ์ˆ˜๋™์œผ๋กœ ๋ฐ”๊ฟ”์ค„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ohmyzsh์€ zsh ์„ค์ • ๊ด€๋ฆฌ ํ”„๋ ˆ์ž„์›Œํฌ์ž…๋‹ˆ๋‹ค.

 

3-1. ํ”Œ๋Ÿฌ๊ทธ์ธ ์„ค์น˜

(1) zsh syntax highlighting

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

์ƒ‰์„ ์ž…ํ˜€ highlightingํ•ด์ฃผ๋Š” ํ”Œ๋Ÿฌ๊ทธ์ธ์ž…๋‹ˆ๋‹ค.

์ถœ์ฒ˜: https://github.com/zsh-users/zsh-syntax-highlighting

 

(2) zsh autosuggestions

git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

์ถœ์ฒ˜: https://github.com/zsh-users/zsh-autosuggestions

์ด์ „์— ์ž…๋ ฅํ•œ ์ ์ด ์žˆ๋Š” ๋ช…๋ น์–ด๋ฅผ ํ๋ฆฌ๊ฒŒ ๋„์›Œ์ค๋‹ˆ๋‹ค. ์˜ค๋ฅธ์ชฝ์œผ๋กœ ํ–ฅํ•˜๋Š” ๋ฐฉํ–ฅํ‚ค๋ฅผ ๋ˆŒ๋Ÿฌ ์™„์„ฑ์‹œํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์„ค์น˜๊ฐ€ ๋๋‚ฌ๋‹ค๋ฉด ์•„๋ž˜ ๋‹จ๊ณ„๋กœ ๋„˜์–ด๊ฐ‘๋‹ˆ๋‹ค.

 

3-2. zsh ์„ธํŒ…

vi ~/.zshrc ๋ฅผ ์ž…๋ ฅํ•ด .zshrc ํŒŒ์ผ์„ ์—ด์–ด์ค๋‹ˆ๋‹ค. plugins ํ•ญ๋ชฉ์„ ์ฐพ์Šต๋‹ˆ๋‹ค. ์„ค์น˜ํ•ด์ค€ ๋‘ ํ”Œ๋Ÿฌ๊ทธ์ธ์˜ ์ด๋ฆ„์„ ๋ถ™์—ฌ์ค๋‹ˆ๋‹ค.

plugins=( 
             git
        zsh-autosuggestions
        zsh-syntax-highlighting
 )

git์„ ์„ค์น˜ํ•˜์…จ๋‹ค๋ฉด ์ด๋ฏธ git์ด ํฌํ•จ๋ผ์žˆ์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค. :wq ๋กœ ์ €์žฅ ํ›„ ์ข…๋ฃŒํ•ฉ๋‹ˆ๋‹ค.

source ~/.zshrc ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•˜๊ฑฐ๋‚˜ ํ„ฐ๋ฏธ๋„์„ ๊ป๋‹ค ์ผœ์„œ ์ ์šฉ์‹œํ‚ต๋‹ˆ๋‹ค.

 

3-3. ํ…Œ๋งˆ ์ ์šฉ

์ €๋Š” powerlevel10k ํ…Œ๋งˆ๋ฅผ ์ ์šฉํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ํ…Œ๋งˆ๋ฅผ ์†Œ๊ฐœํ•˜๊ธฐ ์ „์— ์ œ๊ฐ€ ๋งŒ๋“  ์ƒ‰ ์กฐํ•ฉ์„ ๊ณต์œ ํ•ฉ๋‹ˆ๋‹ค.
์•„๋ž˜ ํŒŒ์ผ์„ ๋‹ค์šด๋ฐ›์•„์„œ Preferences > Profiles > ์™ผ์ชฝ ํ•˜๋‹จ Other Actions > Import JSON Profiles ๋กœ ์ ์šฉ์‹œํ‚ค๋ฉด ๋ฉ๋‹ˆ๋‹ค.

yeha_iterm_220205.json
0.01MB
git ์ดˆ๊ธฐ ์„ค์ • ๊ธ€์„ ์˜ฌ๋ฆฌ๊ธฐ ์œ„ํ•ด ์บก์ณํ•ด๋‘์—ˆ๋˜ ํ„ฐ๋ฏธ๋„ ํ™”๋ฉด์ž…๋‹ˆ๋‹ค.
์ด ์„ค์ •๊นŒ์ง€ ํ•ด์ฃผ์…”์•ผ ๋น„์Šทํ•˜๊ฒŒ ๋‚˜์˜ฌ ๊ฑฐ์˜ˆ์š”.

 

 

(1) powerlevel10k ํ…Œ๋งˆ

git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k

์ปค์Šคํ…€ ์„ธํŒ…์„ ์ข‹์•„ํ•ด์„œ ์ด ํ…Œ๋งˆ์— ์ •์ฐฉํ–ˆ์Šต๋‹ˆ๋‹ค. (์ฒ˜์Œ ์„ธํŒ…ํ•  ๋•Œ ๊ต‰์žฅํžˆ ๋งŽ์€ ์„ ํƒ์ง€๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.)

๋‹ค์šด ๋ฐ›์€ ํ›„ vi ~/.zshrc ์ž…๋ ฅํ•œ ํ›„, .zshrc ํŒŒ์ผ ๋‚ด์—์„œ ZSH_THEME ๋ฅผ ์ฐพ์Šต๋‹ˆ๋‹ค.

ZSH_THEME="powerlevel10k/powerlevel10k"

๊ธฐ์กด์˜ ํ…Œ๋งˆ ์ด๋ฆ„์„ ์ง€์šฐ๊ณ  ์œ„ ํ…Œ๋งˆ๋ฅผ ์ถ”๊ฐ€ํ•ด์ฃผ์…”์•ผ ํ•ฉ๋‹ˆ๋‹ค.

์ดˆ๊ธฐ ์„ธํŒ…์ด ๋๋‚œ ํ›„ ํ…Œ๋งˆ ์„ค์ •์ด ๋งˆ์Œ์— ๋“ค์ง€ ์•Š๋Š”๋‹ค๋ฉด, p10k configure ๋ช…๋ น์–ด๋กœ ๋‹ค์‹œ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

(2) ๋‘ฅ๊ทผ๋ชจ๊ผด ํฐํŠธ

์ €๋Š” ๋‘ฅ๊ทผ๋ชจ๊ผด ์„ ์ข‹์•„ํ•ฉ๋‹ˆ๋‹ค. Preferences > Profiles > Text > Font ์—์„œ ์ ์šฉ์‹œํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ํ•œ๊ธ€๋„ ์ž˜ ์จ์ง‘๋‹ˆ๋‹ค.

๋Œ“๊ธ€