From 108102ca2ba159d4f7ecb0a7a99f5af7953ff0b5 Mon Sep 17 00:00:00 2001 From: acicchetti Date: Thu, 14 Mar 2019 13:05:31 -0400 Subject: [PATCH] Removed spaceship prompt, added powerlevel10k --- zsh/zshrc | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/zsh/zshrc b/zsh/zshrc index 98fcdd9..7e3a477 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -47,9 +47,43 @@ antigen bundle zsh-users/zsh-syntax-highlighting antigen bundle zsh-users/zsh-completions antigen bundle asdf -antigen theme https://github.com/denysdovhan/spaceship-prompt spaceship +antigen theme romkatv/powerlevel10k powerlevel10k antigen apply + + +# custom functions for powerlevel9k +POWERLEVEL9K_ELIXIR_ICON=$'🥃' +prompt_asdf_elixir() { + if [ $commands[asdf] ]; then + ELIXIR_ICON=$'🥃' + local asdf_global_conf="$HOME/.tool-versions" + local version_regex="s/^\([.0-9]*\).*/\1/p" + local config_regex="s/.*(set by \(.*\))/\1/p" + + local elixir_current="$(asdf current elixir)" + local elixir_current_version="$(echo $elixir_current | sed -n $version_regex)" + local elixir_current_conf="$(echo $elixir_current | sed -n $config_regex)" + + local erlang_current="$(asdf current erlang)" + local erlang_current_version="$(echo $erlang_current | sed -n $version_regex)" + local erlang_current_conf="$(echo $erlang_current | sed -n $config_regex)" + if [[ "${asdf_global_conf}" != "${elixir_current_conf}" || "${asdf_global_conf}" != "${erlang_current_conf}" ]]; then + echo -n "🥃 $elixir_current_version (on Erlang $erlang_current_version)" + fi +fi +} +POWERLEVEL9K_CUSTOM_ASDF_ELIXIR="prompt_asdf_elixir" + +export POWERLEVEL9K_IGNORE_TERM_COLORS=true +export POWERLEVEL9K_PROMPT_ON_NEWLINE=true +export POWERLEVEL9K_PROMPT_ADD_NEWLINE=true +export POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir dir_writable vcs custom_asdf_elixir) +export POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(virtualenv command_execution_time) +export VIRTUAL_ENV_DISABLE_PROMPT=1 + + + alias 'onedrive-journal'="journalctl --user-unit onedrive -f" alias exa="exa -l --git" @@ -72,7 +106,7 @@ else touch $HOME/.zshsrc fi -export TERM="tmux-256color" +# export TERM="tmux-256color" export SHELL="/bin/zsh" # asdf . $HOME/.asdf/asdf.sh