aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/zsh/prompt.zsh
diff options
context:
space:
mode:
authorcbreton <c.breton@fullsave.com>2019-10-10 09:14:24 +0200
committercbreton <c.breton@fullsave.com>2019-10-10 09:14:24 +0200
commitd7a3c56269db8e2066412da2d7b3808e531b480c (patch)
treef9a5af2ff0b005b452c13f74ae88c88a670994c8 /dotfiles/zsh/prompt.zsh
parente0bf2ecad97b5771784c5a2fb144144245e2e93c (diff)
downloaddotfiles_dotdrop-d7a3c56269db8e2066412da2d7b3808e531b480c.tar.xz
dotfiles_dotdrop-d7a3c56269db8e2066412da2d7b3808e531b480c.zip
Rename some dotfile and add a binding for search in history
Diffstat (limited to 'dotfiles/zsh/prompt.zsh')
-rw-r--r--dotfiles/zsh/prompt.zsh118
1 files changed, 0 insertions, 118 deletions
diff --git a/dotfiles/zsh/prompt.zsh b/dotfiles/zsh/prompt.zsh
deleted file mode 100644
index 9c5fce6..0000000
--- a/dotfiles/zsh/prompt.zsh
+++ /dev/null
@@ -1,118 +0,0 @@
-# ██
-# ░██
-# ██████ ██████░██
-# ░░░░██ ██░░░░ ░██████
-# ██ ░░█████ ░██░░░██
-# ██ ░░░░░██░██ ░██
-# ██████ ██████ ░██ ░██
-# ░░░░░░ ░░░░░░ ░░ ░░
-#
-# ▓▓▓▓▓▓▓▓▓▓
-# ░▓ author ▓ xero <x@xero.nu>
-# ░▓ code ▓ http://code.xero.nu/dotfiles
-# ░▓ mirror ▓ http://git.io/.files
-# ░▓▓▓▓▓▓▓▓▓▓
-# ░░░░░░░░░░
-autoload -U compinit colors zcalc
-compinit -d
-colors
-
-ICO_DIRTY="⚡"
-#ICO_DIRTY="↯"
-#ICO_DIRTY="*"
-ICO_AHEAD="↑"
-#ICO_AHEAD="🠙"
-#ICO_AHEAD="▲"
-ICO_BEHIND="↓"
-#ICO_BEHIND="🠛"
-#ICO_BEHIND="▼"
-ICO_DIVERGED="⥮"
-COLOR_ROOT="%{$fg_bold[red]%}"
-COLOR_USER="%F{white}"
-COLOR_NORMAL="%F{white}"
-PROMPT_STYLE="classic"
-# Modify the colors and symbols in these variables as desired.
-GIT_PROMPT_SYMBOL="%{$fg[blue]%}±" # plus/minus - clean repo
-GIT_PROMPT_PREFIX="%{$fg[green]%} %{$reset_color%}"
-GIT_PROMPT_SUFFIX="%{$fg[green]%}%{$reset_color%}"
-GIT_PROMPT_AHEAD="%{$fg[red]%}ANUM%{$reset_color%}" # A"NUM" - ahead by "NUM" commits
-GIT_PROMPT_BEHIND="%{$fg[white]%}BNUM%{$reset_color%}" # B"NUM" - behind by "NUM" commits
-GIT_PROMPT_MERGING="%{$fg_bold[magenta]%}⚡%{$reset_color%}" # lightning bolt - merge conflict
-GIT_PROMPT_UNTRACKED="%{$fg_bold[red]%}●%{$reset_color%}" # red circle - untracked files
-GIT_PROMPT_MODIFIED="%{$fg_bold[yellow]%}●%{$reset_color%}" # yellow circle - tracked files modified
-GIT_PROMPT_STAGED="%{$fg_bold[green]%}●%{$reset_color%}" # green circle - staged changes present = ready for "git push"
-
-parse_git_branch() {
- # Show Git branch/tag, or name-rev if on detached head
- ( git symbolic-ref -q HEAD || git name-rev --name-only --no-undefined --always HEAD ) 2> /dev/null
-}
-
-parse_git_state() {
- # Show different symbols as appropriate for various Git repository states
- # Compose this value via multiple conditional appends.
- local GIT_STATE=""
- local NUM_AHEAD="$(git log --oneline @{u}.. 2> /dev/null | wc -l | tr -d ' ')"
- if [ "$NUM_AHEAD" -gt 0 ]; then
- GIT_STATE=$GIT_STATE${GIT_PROMPT_AHEAD//NUM/$NUM_AHEAD}
- fi
- local NUM_BEHIND="$(git log --oneline ..@{u} 2> /dev/null | wc -l | tr -d ' ')"
- if [ "$NUM_BEHIND" -gt 0 ]; then
- GIT_STATE=$GIT_STATE${GIT_PROMPT_BEHIND//NUM/$NUM_BEHIND}
- fi
- local GIT_DIR="$(git rev-parse --git-dir 2> /dev/null)"
- if [ -n $GIT_DIR ] && test -r $GIT_DIR/MERGE_HEAD; then
- GIT_STATE=$GIT_STATE$GIT_PROMPT_MERGING
- fi
- if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
- GIT_STATE=$GIT_STATE$GIT_PROMPT_UNTRACKED
- fi
- if ! git diff --quiet 2> /dev/null; then
- GIT_STATE=$GIT_STATE$GIT_PROMPT_MODIFIED
- fi
- if ! git diff --cached --quiet 2> /dev/null; then
- GIT_STATE=$GIT_STATE$GIT_PROMPT_STAGED
- fi
- if [[ -n $GIT_STATE ]]; then
- echo "$GIT_PROMPT_PREFIX$GIT_STATE$GIT_PROMPT_SUFFIX"
- fi
-}
-
-
-#█▓▒░ allow functions in the prompt
-setopt PROMPT_SUBST
-autoload -Uz colors && colors
-
-#█▓▒░ colors for permissions
-if [[ "$EUID" -ne "0" ]]
-then # if user is not root
- USER_LEVEL="${COLOR_USER}"
-else # root!
- USER_LEVEL="${COLOR_ROOT}"
-fi
-
-git_prompt_string() {
- local git_where="$(parse_git_branch)"
-
- # If inside a Git repository, print its branch and state
- [ -n "$git_where" ] && echo "[$GIT_PROMPT_SYMBOL$(parse_git_state)$GIT_PROMPT_PREFIX%{$fg[yellow]%}${git_where#(refs/heads/|tags/)}$GIT_PROMPT_SUFFIX%F{white}]─"
-
- # If not inside the Git repo, print exit codes of last command (only if it failed)
- #[ ! -n "$git_where" ] && echo "%{$fg[red]%}%(?..%?)"
-}
-
-
-function error() {
- echo "%(?..[$fg[red]%?%F{white}]─)"
-}
-
-function host() {
- if [[ -n $SSH_CONNECTION ]]; then
- echo "%{$fg_bold[red]%}!$reset_color%F{white}$HOST"
- else
- echo "$HOST"
- fi
-}
-
-PROMPT='%F{white}┌─[${USER_LEVEL}$USER$reset_color%F{white}@$(host)]─$(git_prompt_string)$(error)[%~]
-└─ - %f'
-setfont lat0-08