diff options
author | Tharre <tharre3@gmail.com> | 2018-08-12 00:05:51 +0200 |
---|---|---|
committer | Tharre <tharre3@gmail.com> | 2018-08-12 01:17:13 +0200 |
commit | 8fc802bb7843ce0e32661cfa23f8947dc3ddea68 (patch) | |
tree | 10ef02a948bb83b4ddc6e497fc7bd38d92c1314e /.zsh | |
parent | be230463de9cbb87115589192a3da3223f172a20 (diff) | |
download | dotfiles-8fc802bb7843ce0e32661cfa23f8947dc3ddea68.tar.gz dotfiles-8fc802bb7843ce0e32661cfa23f8947dc3ddea68.tar.xz dotfiles-8fc802bb7843ce0e32661cfa23f8947dc3ddea68.zip |
zsh: replace oh-my-zsh with vanilla zsh configs
oh-my-zsh introduces *a lot* of bloat, but I've barely been using any of
it these past years. Just picking the options I use makes zsh easier to
work with and debug (and hopefully faster).
Diffstat (limited to '.zsh')
-rw-r--r-- | .zsh/prompt_custom_setup | 30 | ||||
m--------- | .zsh/zsh-completions | 0 |
2 files changed, 30 insertions, 0 deletions
diff --git a/.zsh/prompt_custom_setup b/.zsh/prompt_custom_setup new file mode 100644 index 0000000..1fd02c4 --- /dev/null +++ b/.zsh/prompt_custom_setup @@ -0,0 +1,30 @@ +# my custom zsh theme +# requires `setopt PROMPT_SUBST` + + +# prefix hostname if ssh session was detected +function prompt_print_hostname() { + if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_CONNECTION" ] || [ -n "$SSH_TTY" ]; then + printf "%s" "%F{red}[%m]%f " + fi +} + +function git_prompt_parse_dirty() { + local FLAGS=("--porcelain" "--ignore-submodules=dirty") + local STATUS=$(command git status $FLAGS | tail -n1) + if [[ -n $STATUS ]]; then + printf "%s" "%F{214}*%f" + fi +} + +function git_prompt_info() { + local ref + ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ + ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0 + + printf "%s" "%F{075} (${ref#refs/heads/}$(git_prompt_parse_dirty)%F{075})%f" +} + +PS1='$(prompt_print_hostname)%F{032}%(8~"[..]/")%7~$(git_prompt_info) %F{105}%1(j.[%j] .)%(!.#.$)%f ' +PS2='%F{red}\ %f' +RPS1="%(?..%F{red}:%?%f)" diff --git a/.zsh/zsh-completions b/.zsh/zsh-completions new file mode 160000 +Subproject df7e44c685c9a60d83a3760aa373d3864779aee |