Quantcast
Channel: Bashタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 2802

ターミナルのプロンプトをカスタマイズする

$
0
0

背景

ターミナルのプロンプトですが、デフォルトだと見づらくて使いづらいです。
プロンプトはカスタマイズするとGitブランチ名やGitの進捗表示も行えるのでかなり便利になります。

とはいえ、本腰を入れてカスタマイズ始めると日が暮れちゃうのでstarshipを使います。

ゴール

ScreenShot 2020-06-17 11.49.51.png

現在のシェルを確認

$ echo $SHELL

starshipのインストール

$ brew install starship

zshシェルの場合

$ echo 'eval "$(starship init zsh)"' >> ~/.zprofile
$ exec $SHELL -l

bashシェルの場合

$ echo 'eval "$(starship init bash)"' >> ~/.bashrc
$ exec $SHELL -l

fishシェルの場合

$ echo 'eval "$(starship init fish)"' >> ~/.config/fish/config.fish
$ exec $SHELL -l

starshipの設定ファイルの作成

$ mkdir ~/.config
$ touch ~/.config/starship.toml

starshipの設定ファイル設定例

$ vim ~/.config/starship.toml
add_newline = false

[directory]
truncate_to_repo = false

[git_branch]
symbol = "🌱 "

[time]
disabled = false

その他の詳細な設定は公式に詳しく書かれているのでそちらを参照ください。


Viewing all articles
Browse latest Browse all 2802

Trending Articles