LoginSignup
1
2

More than 3 years have passed since last update.

fishでPowerlineをwsl2上で設定する方法,

Posted at

fish install

まずはfishをinstallする.ubuntuなら,

sudo apt upgrade 
sudo apt update
sudo apt install fish

次にinstallしたらfishのパスを確認し,デフォルトのシェルに変更する.

which fish
chsh -s /user/bin/fish

設定ファイルなどは以下のディレクトリにある.

.config/fish

パッケージマネージャのinstall

fishermanの場合

curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish

プラグインpeco と zを入れてる.

fisher install oh-my-fish/plugin-peco
fisher install jethrokuan/z
~/.config/fish/config.fish
# ---
# peco
# ---
function fish_user_key_bindings
    bind \cr peco_select_history
end

Powerlineのプラグインを入れてみる.

fisher add oh-my-fish/theme-bobthefish

これを入れるとコンソールの見た目が変わる.ところが,文字化けが発生するためPwerline-fontsをインストールする必要がある.

任意の場所でフォントをインストールする.

git clone https://github.com/powerline/fonts.git
cd fonts
./install.sh
cd ../
rm -r ./fonts

(注意)
これでフォントが設定できるになるはずだが,うまくいかないならgit-hubに公開されているPowerline-fontをダウンロードして右クリでインストールすれば,おなじみのWSLフォント設定画面から設定できます.Notoなど様々なフォントがある.

ブランチを表示させる設定を明示する.

~/.config/fish/config.fish
set -g theme_display_git_master_branch yes

を追記して,fishを再起動させる,

そのほかにも

# ----------
# bobthefish config
# ----------
set -g fish_prompt_pwd_dir_length 0  # ディレクトリ省略しない
set -g theme_newline_cursor yes  # プロンプトを改行した先に設ける
set -g theme_display_git_master_branch yes  # git の branch 名を表示
set -g theme_color_scheme dracula
set -g theme_display_date no  # 時刻を表示しないように設定
set -g theme_display_cmd_duration no  # コマンド実行時間の非表示

参考

以下のサイトを参考にしました.

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2