From e6f7191cc1a770748805f78766822e603aa18738 Mon Sep 17 00:00:00 2001 From: xero Date: Thu, 1 Jan 2015 21:17:07 -0500 Subject: combine zsh user and root themes and files. install root theme with [sudo stow zsh -t /root] --- zsh-root/.zsh/colored-man-pages.zsh | 8 -- zsh-root/.zsh/functions/chpwd_update_git_vars | 1 - zsh-root/.zsh/functions/precmd_update_git_vars | 4 - zsh-root/.zsh/functions/preexec_update_git_vars | 5 - zsh-root/.zsh/functions/prompt_git_info | 21 --- zsh-root/.zsh/functions/update_current_git_vars | 31 ----- zsh-root/.zshrc | 174 ------------------------ zsh/.zsh/functions/prompt_git_info | 4 +- zsh/.zshrc | 22 ++- 9 files changed, 17 insertions(+), 253 deletions(-) delete mode 100644 zsh-root/.zsh/colored-man-pages.zsh delete mode 100644 zsh-root/.zsh/functions/chpwd_update_git_vars delete mode 100644 zsh-root/.zsh/functions/precmd_update_git_vars delete mode 100644 zsh-root/.zsh/functions/preexec_update_git_vars delete mode 100644 zsh-root/.zsh/functions/prompt_git_info delete mode 100644 zsh-root/.zsh/functions/update_current_git_vars delete mode 100644 zsh-root/.zshrc diff --git a/zsh-root/.zsh/colored-man-pages.zsh b/zsh-root/.zsh/colored-man-pages.zsh deleted file mode 100644 index 6854d97..0000000 --- a/zsh-root/.zsh/colored-man-pages.zsh +++ /dev/null @@ -1,8 +0,0 @@ -#█▓▒░ source: https://github.com/imkira/dotfiles/blob/master/.zsh/colored-man-pages.zsh -export LESS_TERMCAP_mb=$'\E[01;31m' -export LESS_TERMCAP_md=$'\E[01;38;5;74m' -export LESS_TERMCAP_me=$'\E[0m' -export LESS_TERMCAP_se=$'\E[0m' -export LESS_TERMCAP_so=$'\E[38;33;246m' -export LESS_TERMCAP_ue=$'\E[0m' -export LESS_TERMCAP_us=$'\E[04;38;5;146m' diff --git a/zsh-root/.zsh/functions/chpwd_update_git_vars b/zsh-root/.zsh/functions/chpwd_update_git_vars deleted file mode 100644 index 2cc7ffa..0000000 --- a/zsh-root/.zsh/functions/chpwd_update_git_vars +++ /dev/null @@ -1 +0,0 @@ -update_current_git_vars \ No newline at end of file diff --git a/zsh-root/.zsh/functions/precmd_update_git_vars b/zsh-root/.zsh/functions/precmd_update_git_vars deleted file mode 100644 index 7fa32df..0000000 --- a/zsh-root/.zsh/functions/precmd_update_git_vars +++ /dev/null @@ -1,4 +0,0 @@ -if [ -n "$__EXECUTED_GIT_COMMAND" ]; then - update_current_git_vars - unset __EXECUTED_GIT_COMMAND -fi \ No newline at end of file diff --git a/zsh-root/.zsh/functions/preexec_update_git_vars b/zsh-root/.zsh/functions/preexec_update_git_vars deleted file mode 100644 index 998de21..0000000 --- a/zsh-root/.zsh/functions/preexec_update_git_vars +++ /dev/null @@ -1,5 +0,0 @@ -case "$1" in - git*) - __EXECUTED_GIT_COMMAND=1 - ;; -esac \ No newline at end of file diff --git a/zsh-root/.zsh/functions/prompt_git_info b/zsh-root/.zsh/functions/prompt_git_info deleted file mode 100644 index d492ac8..0000000 --- a/zsh-root/.zsh/functions/prompt_git_info +++ /dev/null @@ -1,21 +0,0 @@ -if [ -n "$__CURRENT_GIT_BRANCH" ]; then - local s="%F{cyan}-[%F{white}" - s+="$__CURRENT_GIT_BRANCH" - case "$__CURRENT_GIT_BRANCH_STATUS" in - ahead) - s+="↑" - ;; - diverged) - s+="↕" - ;; - behind) - s+="↓" - ;; - esac - if [ -n "$__CURRENT_GIT_BRANCH_IS_DIRTY" ]; then - s+="⚡" - fi - s+="%F{cyan}]" - - printf "%s%s" $s -fi \ No newline at end of file diff --git a/zsh-root/.zsh/functions/update_current_git_vars b/zsh-root/.zsh/functions/update_current_git_vars deleted file mode 100644 index 716d984..0000000 --- a/zsh-root/.zsh/functions/update_current_git_vars +++ /dev/null @@ -1,31 +0,0 @@ -unset __CURRENT_GIT_BRANCH -unset __CURRENT_GIT_BRANCH_STATUS -unset __CURRENT_GIT_BRANCH_IS_DIRTY - -local st="$(git status 2>/dev/null)" -local st2="$(git log -1 --pretty=%h 2>/dev/null)" - -if [[ -n "$st" ]]; then - local -a arr - arr=(${(f)st}) - - if [[ $arr[1] =~ 'Not currently on any branch.' ]]; then - __CURRENT_GIT_BRANCH="$st2" - else - __CURRENT_GIT_BRANCH="${arr[1][(w)4]}"; - fi - - if [[ $arr[2] =~ 'Your branch is' ]]; then - if [[ $arr[2] =~ 'ahead' ]]; then - __CURRENT_GIT_BRANCH_STATUS='ahead' - elif [[ $arr[2] =~ 'diverged' ]]; then - __CURRENT_GIT_BRANCH_STATUS='diverged' - else - __CURRENT_GIT_BRANCH_STATUS='behind' - fi - fi - - if [[ ! $st =~ 'nothing to commit' ]]; then - __CURRENT_GIT_BRANCH_IS_DIRTY='1' - fi -fi \ No newline at end of file diff --git a/zsh-root/.zshrc b/zsh-root/.zshrc deleted file mode 100644 index a261817..0000000 --- a/zsh-root/.zshrc +++ /dev/null @@ -1,174 +0,0 @@ -# ██ -# ░██ -# ██████ ██████░██ ██████ █████ -# ░░░░██ ██░░░░ ░██████ ░░██░░█ ██░░░██ -# ██ ░░█████ ░██░░░██ ░██ ░ ░██ ░░ -# ██ ░░░░░██░██ ░██ ░██ ░██ ██ -# ██████ ██████ ░██ ░██░███ ░░█████ -# ░░░░░░ ░░░░░░ ░░ ░░ ░░░ ░░░░░ -# -# ▓▓▓▓▓▓▓▓▓▓ -# ░▓ author ▓ xero -# ░▓ code ▓ http://code.xero.nu/dotfiles -# ░▓ mirror ▓ http://git.io/.files -# ░▓▓▓▓▓▓▓▓▓▓ -# ░░░░░░░░░░ -# -# █▓▒░ timestamps -# HIST_STAMPS="mm/dd/yyyy" - -#█▓▒░ exports -export PATH=$HOME/bin:/usr/local/bin:/home/xero/.gem/ruby/2.1.0/bin:$PATH -# export MANPATH="/usr/local/man:$MANPATH" - -#█▓▒░ preferred editor for local and remote sessions -if [[ -n $SSH_CONNECTION ]]; then - export EDITOR='vim' -else - export EDITOR='vim' -fi - -#█▓▒░ aliases -alias ls="ls --color=auto" -alias lsla="ls -la --color=auto" -alias lsls="ls -la --color=auto" -alias lsl="ls -l --color=auto" -alias "cd.."="cd ../" -alias rock="ncmpcpp" -alias mixer="alsamixer" -alias checkrootkits="sudo rkhunter --update; sudo rkhunter --propupd; sudo rkhunter --check" -alias genplaylist="cd ~/music;find . -name '*.mp3' -o -name '*.flac'|sed -e 's%^./%%g' > ~/.config/mpd/playlists/all.m3u;mpd ~/.config/mpd/mpd.conf;mpc clear;mpc load all.m3u;mpc update" -alias matrix="cmatrix -b" -alias pipes="bash ~/code/fun/pipes" -alias pipesx="bash ~/code/fun/pipesx" -alias rain="bash ~/code/fun/rain" -alias screenfetch="~/code/sys/info" -alias hashcompare="bash ~/code/sys/hash-compare " -alias tempwatch="while :; do sensors; sleep 1 && clear; done;" -alias fixcursor="xsetroot -cursor_name left_ptr" -alias img="bash ~/code/sys/img" -alias tmx="~/code/sys/tmx" -alias gitio"~/code/sys/gitio" -alias ascii="figlet -w `tput cols` -f 3d " -dirlist() { - ls -la "$1" && echo -e '' && tree -a "$1" -} -#█▓▒░ debian aliases -#alias sai="sudo apt-get install" -#alias apachereload='sudo /etc/init.d/apache2 restart' -#alias disks="palimpsest" -#alias invert="xcalib -i -a" -#█▓▒░ arch aliases -alias pacman="sudo pacman" -alias apachereload='sudo systemctl restart httpd.service' -alias disks="lsblk -a && echo '' && df -h" #ncdu -#█▓▒░ games -alias doom='gzdoom brutal19.pk3' -alias fez='~/fez/FEZ' - -#█▓▒░ ssh -export SSH_KEY_PATH="~/.ssh/id_rsa" - -#█▓▒░ keybindings -typeset -A key - -key[Home]=${terminfo[khome]} -key[End]=${terminfo[kend]} -key[Insert]=${terminfo[kich1]} -key[Delete]=${terminfo[kdch1]} -key[Up]=${terminfo[kcuu1]} -key[Down]=${terminfo[kcud1]} -key[Left]=${terminfo[kcub1]} -key[Right]=${terminfo[kcuf1]} -key[PageUp]=${terminfo[kpp]} -key[PageDown]=${terminfo[knp]} - -[[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line -[[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line -[[ -n "${key[Insert]}" ]] && bindkey "${key[Insert]}" overwrite-mode -[[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char -[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-history -[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-history -[[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char -[[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char -[[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" beginning-of-buffer-or-history -[[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" end-of-buffer-or-history - -if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then - function zle-line-init () { - printf '%s' "${terminfo[smkx]}" - } - function zle-line-finish () { - printf '%s' "${terminfo[rmkx]}" - } - zle -N zle-line-init - zle -N zle-line-finish -fi - - -#█▓▒░ autocompletion systems -autoload -Uz compinit -compinit - -zstyle ':completion:*' auto-description 'specify: %d' -zstyle ':completion:*' completer _expand _complete _correct _approximate -zstyle ':completion:*' format 'Completing %d' -zstyle ':completion:*' group-name '' -zstyle ':completion:*' menu select=2 eval "$(dircolors -b)" -zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} -zstyle ':completion:*' list-colors '' -zstyle ':completion:*' list-prompt %SAt %p: hit TAB for more, or the character to insert%s -zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*' -zstyle ':completion:*' menu select=long -zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s -zstyle ':completion:*' use-compctl false -zstyle ':completion:*' verbose true - -zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' -zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd' - -#█▓▒░ allow functions in the prompt -setopt PROMPT_SUBST - -#█▓▒░ autoload zsh functions -fpath=(~/.zsh/functions $fpath) -autoload -U ~/.zsh/functions/*(:t) - -#█▓▒░ enable auto-execution of functions -typeset -ga preexec_functions -typeset -ga precmd_functions -typeset -ga chpwd_functions - -#█▓▒░ append git functions needed for prompt. -preexec_functions+='preexec_update_git_vars' -precmd_functions+='precmd_update_git_vars' -chpwd_functions+='chpwd_update_git_vars' - -#█▓▒░ load configs -for config_file (~/.zsh/*.zsh) source $config_file - -#█▓▒░ history -HISTFILE=~/.zhistory -setopt APPEND_HISTORY -HISTSIZE=1200 -SAVEHIST=1000 -setopt HIST_EXPIRE_DUPS_FIRST -setopt EXTENDED_HISTORY -setopt SHARE_HISTORY - -#█▓▒░ custom prompts - -#█▓▒░dual line -PROMPT="%F{cyan}┌[%F{white}%n@%M%F{cyan}]─[%F{red}%~%F{cyan}] -%F{cyan}└─ %F{white}" -#RPROMPT="%F{cyan}[%F{white}%n@%M%F{cyan}]" - -#█▓▒░ ninja -PROMPT="%F{white} ▟▙ %F{red}%~%F{white} -▟▒%F{blue}░░░░░░░%F{white}▜▙▜████████████████████████████████▛ -▜▒%F{blue}░░░░░░░%F{white}▟▛▟▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▛ - ▜▛ - %F{white}" - -#█▓▒░ minial -PROMPT='%F{red}[%F{white}%~%F{red}]$(prompt_git_info)── -%f ' diff --git a/zsh/.zsh/functions/prompt_git_info b/zsh/.zsh/functions/prompt_git_info index d492ac8..d6d3acb 100644 --- a/zsh/.zsh/functions/prompt_git_info +++ b/zsh/.zsh/functions/prompt_git_info @@ -1,5 +1,5 @@ if [ -n "$__CURRENT_GIT_BRANCH" ]; then - local s="%F{cyan}-[%F{white}" + local s="${USER_LEVEL}-[%F{white}" s+="$__CURRENT_GIT_BRANCH" case "$__CURRENT_GIT_BRANCH_STATUS" in ahead) @@ -15,7 +15,7 @@ if [ -n "$__CURRENT_GIT_BRANCH" ]; then if [ -n "$__CURRENT_GIT_BRANCH_IS_DIRTY" ]; then s+="⚡" fi - s+="%F{cyan}]" + s+="${USER_LEVEL}]" printf "%s%s" $s fi \ No newline at end of file diff --git a/zsh/.zshrc b/zsh/.zshrc index 7b454d3..6bba78b 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -127,6 +127,14 @@ zstyle ':completion:*' verbose true zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd' + +#█▓▒░ colors for permissions +if [[ "$EUID" -ne "0" ]] ; then # if user is not root + USER_LEVEL="%F{cyan}" +else # root! + USER_LEVEL="%F{red}" +fi + #█▓▒░ allow functions in the prompt setopt PROMPT_SUBST @@ -159,16 +167,16 @@ setopt SHARE_HISTORY #█▓▒░ custom prompts #█▓▒░dual line -PROMPT="%F{cyan}┌[%F{white}%n@%M%F{cyan}]─[%F{red}%~%F{cyan}] -%F{cyan}└─ %F{white}" -#RPROMPT="%F{cyan}[%F{white}%n@%M%F{cyan}]" +PROMPT="${USER_LEVEL}┌[%F{white}%n@%M${USER_LEVEL}]─[%F{white}%~${USER_LEVEL}] +${USER_LEVEL}└─ %F{white}" +#RPROMPT="${USER_LEVEL}[%F{white}%n@%M${USER_LEVEL}]" #█▓▒░ ninja -PROMPT="%F{white} ▟▙ %F{red}%~%F{white} -▟▒%F{blue}░░░░░░░%F{white}▜▙▜████████████████████████████████▛ -▜▒%F{blue}░░░░░░░%F{white}▟▛▟▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▛ +PROMPT="%F{white} ▟▙ ${USER_LEVEL}%~%F{white} +▟▒${USER_LEVEL}░░░░░░░%F{white}▜▙▜████████████████████████████████▛ +▜▒${USER_LEVEL}░░░░░░░%F{white}▟▛▟▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▛ ▜▛ %F{white}" #█▓▒░ minial -PROMPT='%F{cyan}[%F{white}%~%F{cyan}]$(prompt_git_info)── -%f ' +PROMPT='${USER_LEVEL}[%F{white}%~${USER_LEVEL}]$(prompt_git_info)── -%f ' -- cgit v1.2.1