fish - ubuntu 更改 shell theme

git clone https://github.com/b-ryan/powerline-shell
cd powerline-shell
python3 setup.py install

Bash

.bashrc

function _update_ps1() {
    PS1=$(powerline-shell $?)
}

if [[ $TERM != linux && ! $PROMPT_COMMAND =~ _update_ps1 ]]; then
    PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi

Fish

~/.config/fish/config.fish

function fish_prompt
    powerline-shell --shell bare $status
end

ZSH

.zshrc

function powerline_precmd() {
    PS1="$(powerline-shell --shell zsh $?)"
}

function install_powerline_precmd() {
  for s in "${precmd_functions[@]}"; do
    if [ "$s" = "powerline_precmd" ]; then
      return
    fi
  done
  precmd_functions+=(powerline_precmd)
}

if [ "$TERM" != "linux" ]; then
    install_powerline_precmd
fi

Customization

mkdir -p ~/.config/powerline-shell && \
powerline-shell --generate-config > ~/.config/powerline-shell/config.json
{
    "segments":[
	"newline",
	"virtual_env",
	"username",
	"hostname",
	"ssh",
        "cwd",
	"git",
	"hg",
	"jobs",
	"newline",
	"root"
    ],
    "mode": "patched",
    "cwd": {
        "max_depth": 7,
	"max_dir_size": 1,
	"full_cwd": true
    },
    "theme": "/home/g/workspace/xyzla.com/learn/github/powerline-shell/powerline_shell/themes/gruvbox.py",
    "vcs": {
        "show_symbol": true
    }
}

https://github.com/b-ryan/powerline-shell lovemecomputer /_powerline-shell-configs.md