터미널에 코드 입력을 자주 많이 하다보면
가끔 꼬일 때가 있어서,
이를 방지하기 위해 터미널 스타일을 변경해보기로 했다.
오늘 사용할 툴은 Starship 이다.
macOS 의 경우, 아래와 같이 설치한다.
vs code 밖에서 터미널을 하나 열고,
루트 디렉터리로 이동.
curl -sS https://starship.rs/install.sh | sh
또는 brew로 설치
brew install starship
windows 및 기타 다른 OS의 경우,
https://starship.rs/guide/#%F0%9F%9A%80-installation 를 참조할 것
나는 zsh를 사용하기 때문에 위와 같은 명령어를 사용하였다.
파일이 열리면 파일의 가장 아랫부분에
eval "$(starship init zsh)"
를 입력한다.
파일을 나온 후,
mkdir -p ~/.config && touch ~/.config/starship.toml
를 작성하여 starship configuration 파일을 만든다.
입맛대로 설정할 수 있으나,
나는 귀찮아서 가이드에 나온대로 넣었다.
sudo vim ~/.config/starship.toml
입력하여 starship configuration 파일을 열어서
# 커스텀포맷- 나는 화려한걸로 하겠음
format = """
[🎉](#9A348E)\
$os\
$username\
[](bg:#DA627D fg:#9A348E)\
$directory\
[](fg:#DA627D bg:#FCA17D)\
$git_branch\
$git_status\
[](fg:#FCA17D bg:#86BBD8)\
$c\
$elixir\
$elm\
$golang\
$haskell\
$java\
$julia\
$nodejs\
$nim\
$rust\
$scala\
[](fg:#86BBD8 bg:#06969A)\
$docker_context\
[](fg:#06969A bg:#33658A)\
$time\
[ ](fg:#33658A)\
"""
[username]
show_always = true
style_user = "bg:#9A348E"
style_root = "bg:#9A348E"
format = '[$user ]($style)'
disabled = false
# An alternative to the username module which displays a symbol that
# represents the current operating system
[os]
style = "bg:#9A348E"
disabled = true # Disabled by default
[directory]
style = "bg:#DA627D"
format = "[ $path ]($style)"
truncation_length = 3
truncation_symbol = "…/"
# Here is how you can shorten some long paths by text replacement
# similar to mapped_locations in Oh My Posh:
[directory.substitutions]
"Documents" = "📝"
"Downloads" = "📥"
"Music" = "🎶"
"Pictures" = "🏞 "
[c]
symbol = "🐙"
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[docker_context]
symbol = "🐳"
style = "bg:#06969A"
format = '[ $symbol $context ]($style) $path'
[elixir]
symbol = "💎"
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[elm]
symbol = "🦞"
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[git_branch]
symbol = "🐣"
style = "bg:#FCA17D"
format = '[ $symbol $branch ]($style)'
[git_status]
style = "bg:#FCA17D"
format = '[$all_status$ahead_behind ]($style)'
[golang]
symbol = " "
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[haskell]
symbol = " "
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[java]
symbol = "👻"
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[nodejs]
symbol = "🤖"
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[nim]
symbol = "♚"
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[rust]
symbol = "R"
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[scala]
symbol = "😀"
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[time]
disabled = false
time_format = "%R" # Hour:Minute Format
style = "bg:#33658A"
format = '[ ♥ $time ]($style)'
# Wait 10 milliseconds for starship to check files under the current directory.
scan_timeout = 10
# Disable the blank line at the start of the prompt
add_newline = false
[cmd_duration]
min_time = 500
format = 'underwent [$duration](bold yellow)'
[git_branch]
symbol = '🌱 '
truncation_length = 10
truncation_symbol = ''
always_show_remote = true
style = 'bold purple'
format = 'on [$symbol$branch(:$remote_branch)]($style)'
이렇게 입력하고 나서 터미널 종료 후 재실행하면,
원하는대로 터미널 스타일이 바뀌어 있을 것이다.
끝!