ターミナル魚のプロンプトが空です

ターミナル魚のプロンプトが空です

そのため、フィッシュシェルターミナルのプロンプトを変更しようとしていますが、複雑すぎる項目(色の変更やプロンプトの再配置に加えて)を変更するたびに空白として表示されます。

私はアーチLinuxを使用しています。

私は多くの端末エミュレータを使ってみました。シロアリ、猫、konsole、シンプルターミナル、rxvt-u、用語。通常の端末エミュレータでは、期待されるプロンプトは表示されません。

ただし、Visual Studio Codeにはターミナルエミュレータと呼ばれる効果的なツールがあります。

私はできるだけ多くのランダムなプロンプトを試しましたが、Visual Studio Codeを除くすべての場所ですべて空白に見えます。

端末プロンプトを期待しているように見えるようにする方法をご存知ですか?

簡単に言えば、

ここに画像の説明を入力してください。

いつこんな姿になるのか

ここに画像の説明を入力してください。

ここに内容があります~/.config/fish/functions/fish_prompt.fish

# name: sashimi
function fish_prompt
  set -l last_status $status
  set -l cyan (set_color -o cyan)
  set -l yellow (set_color -o yellow)
  set -g red (set_color -o red)
  set -g blue (set_color -o blue)
  set -l green (set_color -o green)
  set -g normal (set_color normal)

  set -l ahead (_git_ahead)
  set -g whitespace ' '

  if test $last_status = 0
    set initial_indicator "$green◆"
    set status_indicator "$normal❯$cyan❯$green❯"
  else
    set initial_indicator "$red✖ $last_status"
    set status_indicator "$red❯$red❯$red❯"
  end
  set -l cwd $cyan(basename (prompt_pwd))

  if [ (_git_branch_name) ]

    if test (_git_branch_name) = 'master'
      set -l git_branch (_git_branch_name)
      set git_info "$normal git:($red$git_branch$normal)"
    else
      set -l git_branch (_git_branch_name)
      set git_info "$normal git:($blue$git_branch$normal)"
    end

    if [ (_is_git_dirty) ]
      set -l dirty "$yellow ✗"
      set git_info "$git_info$dirty"
    end
  end

  # Notify if a command took more than 5 minutes
  if [ "$CMD_DURATION" -gt 300000 ]
    echo The last command took (math "$CMD_DURATION/1000") seconds.
  end

  echo -n -s $initial_indicator $whitespace $cwd $git_info $whitespace $ahead $status_indicator $whitespace
end

function _git_ahead
  set -l commits (command git rev-list --left-right '@{upstream}...HEAD' ^/dev/null)
  if [ $status != 0 ]
    return
  end
  set -l behind (count (for arg in $commits; echo $arg; end | grep '^<'))
  set -l ahead  (count (for arg in $commits; echo $arg; end | grep -v '^<'))
  switch "$ahead $behind"
    case ''     # no upstream
    case '0 0'  # equal to upstream
      return
    case '* 0'  # ahead of upstream
      echo "$blue↑$normal_c$ahead$whitespace"
    case '0 *'  # behind upstream
      echo "$red↓$normal_c$behind$whitespace"
    case '*'    # diverged from upstream
      echo "$blue↑$normal$ahead $red↓$normal_c$behind$whitespace"
  end
end

function _git_branch_name
  echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
end

function _is_git_dirty
  echo (command git status -s --ignore-submodules=dirty ^/dev/null)
end

ベストアンサー1

これは、Unicodeをサポートしていないロケールで非ASCII文字を使用して発生するFishのバグです。

UTF-8を処理できるロケールに設定します(つまり、デフォルトの「C」ではありません)。

おすすめ記事