Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions cobalt2.zsh-theme
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

CURRENT_BG='NONE'
SEGMENT_SEPARATOR=''
USER_ICON=${COBALT_2_ICON:-'λ'}

# Begin a segment
# Takes two arguments, background and foreground. Both can be omitted,
Expand Down Expand Up @@ -49,7 +50,7 @@ prompt_context() {
local user=`whoami`

if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
prompt_segment black default "%(!.%{%F{yellow}%}.)✝"
prompt_segment black default "%(!.%{%F{yellow}%}.)$USER_ICON"
fi
}

Expand All @@ -71,7 +72,14 @@ prompt_git() {

# Dir: current working directory
prompt_dir() {
prompt_segment blue black '%3~'
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
git_root=${$(git rev-parse --show-toplevel)##*/}
skipped_folders=${$(git rev-parse --show-cdup)%../*}
current_folder=${${$(git rev-parse --show-prefix)%/*}##*/}
prompt_segment magenta black "$git_root/$skipped_folders$current_folder"
else
prompt_segment blue black '%3~'
fi
# prompt_segment blue black "…${PWD: -30}"
}

Expand All @@ -89,12 +97,22 @@ prompt_status() {
[[ -n "$symbols" ]] && prompt_segment black default "$symbols"
}


prompt_kube() {
KUBE_SYMBOL="⎈"
# replace "-pegasus-aks" with empty string
kube_ctx=${$(kubectx -c)##*-}
kube_ns=$(kubens -c)
prompt_segment yellow black "$KUBE_SYMBOL $kube_ctx:$kube_ns"
}

## Main prompt
build_prompt() {
RETVAL=$?
prompt_status
prompt_context
prompt_dir
prompt_kube
prompt_git
prompt_end
}
Expand Down
8 changes: 8 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ Two things for lovers of the [Sublime Text Theme](https://github.com/wesbos/coba

They work well together! You will need to install the patched powerline font as well: <https://github.com/powerline/fonts>

## Customizing the Icon

By default the `✝`-icon will be displayed in the prompt. However, you can customize this by exporting a symbol in `COBALT_2_ICON` like so:

```bash
export COBALT_2_ICON=🦊
```

#### Step-by-step installation
1. Drop the `cobalt2.zsh-theme` file in to the `~/.oh-my-zsh/themes/` directory.
2. Open up your ZSH preferences at `~/.zshrc` and change the theme variable to `ZSH_THEME=cobalt2`.
Expand Down