fixe conflicts

This commit is contained in:
Ghasem Shirazi 2025-02-19 10:00:16 -08:00
commit 50ab12636f
4 changed files with 571 additions and 40 deletions

193
dotfiles/.zshrc Normal file
View file

@ -0,0 +1,193 @@
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
export DOTFILES=$HOME/.dotfiles
#:/usr/local/src:/go
# echo WELCOME!
# If you come from bash you might have to change your $PATH.
export PATH=/usr/local/sbin:$HOME/bin:/usr/local/bin:$PATH
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
export PATH=$GOPATH/bin:$PATH
export PATH=/usr/local/opt/gettext/bin:$PATH
export PATH=/usr/local/opt/bison/bin:$PATH
export PATH=$PATH:$DOTFILES/bin
export PATH=$PATH:$HOME/.iterm2
export GIT_SRCDIR=$GOPATH/src/github.com
mkdir -p ${GIT_SRCDIR}
export LDFLAGS="-L/usr/local/opt/bison/lib"
export CC=clang
if test "$(uname)" = "Darwin"; then
/bin/launchctl setenv LIBRARY_PATH /usr/local/lib
/bin/launchctl setenv CPATH /usr/local/include
fi
if [ -f $HOME/.zshrc.private ]; then . $HOME/.zshrc.private; fi
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
#ZSH_THEME="robbyrussell"
ZSH_THEME="agnoster"
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
export UPDATE_ZSH_DAYS=14
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
DISABLE_UNTRACKED_FILES_DIRTY="false"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# iterm2 for Mac OS
source $DOTFILES/zsh/.iterm2_shell_integration.zsh
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to $ZSH/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
#plugins=(git zsh-git-prompt zsh-completions fasd systemd zsh-syntax-highlighting zsh-git-prompt)
plugins=(git git-extras git-prompt docker docker-compose docker-machine helm zsh-kubectl-prompt)
source ~/.zsh-other-plugins/fsh/fast-syntax-highlighting.plugin.zsh
# The following lines were added by compinstall
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
zstyle ':completion:*' max-errors 3
zstyle ':completion:*' prompt 'e%e'
zstyle ':completion:*' squeeze-slashes true
zstyle :compinstall filename '$HOME/.zshrc'
autoload -Uz compinit
zmodload -i zsh/complist
rm -f ~/.zcompdump
compinit
# End of lines added by compinstall
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=100000
SAVEHIST=100000
setopt appendhistory autocd notify
bindkey -e
# End of lines configured by zsh-newuser-install
source $ZSH/oh-my-zsh.sh
# User configuration
for file in $DOTFILES/zsh/zsh_helpers/*.sh; do
source $file
done
# bindkey
bindkey "kD" delete-char
bindkey "^?" backward-delete-char
bindkey "\033[1~" beginning-of-line
bindkey "\033[4~" end-of-line
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
#lesspipe
export LESSOPEN="|/usr/local/bin/lesspipe.sh %s" LESS_ADVANCED_PREPROCESSOR=1
# ssh
export SSH_KEY_PATH="~/.ssh/id_rsa"
# github pat
export GITHUB_PAT=$(cat $HOME/.git/.pat)
# Perforce
# export P4CLIENT=$(hostname)
# export P4USER=$USER
#export P4PORT=$(cat ~/.p4/.port)
export PATH=/sbin:/bin:${PATH}:${HOME}/bin/p4v-2021.1.2085655/bin:/import/tools/qa/bin:/import/tools/lab/bin:/import/lab/bin
# export EDITOR=vim
export ASLAN_INSTALL_ROOT=${HOME}/work/builds/nios/nios-8.6
export PRODUCT_TARBALL_DIR=${HOME}/work/builds/nios
export LIBVIRT_DEFAULT_URI=qemu:///system
export PERL5LIB=/import/tools/qa/tools/bin
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
alias fn='find / 2>/dev/null -name '
alias t='top'
alias vb='virtualbox'
alias vm='VBoxManage'
alias vmls='VBoxManage list vms'
alias vmclo='VBoxManage clonevm' ## <UUID> --name "Ubuntu 18.04 C"
alias vmreg='VBoxManage registervm' ## ~/VirtualBox\ VMs/Ubuntu\ 18.04\ C/Ubuntu\ 18.04\ C.vbox
alias grep='grep --color=auto'
alias gck='git checkout'
alias sublime='/Applications/Sublime\ Text.app/Contents/MacOS/sublime_text'
alias sl='sublime 2>/dev/null'
alias eclipse='~/eclipse/cpp-2018-09/eclipse/eclipse'
alias ec='eclipse 2>/dev/null'
alias ff='firefox 2>/dev/null'
alias ge='gedit 2>/dev/null'
# alias edit='atom'
alias ez="edit ~/.zshrc"
alias ezo="edit ~/.oh-my-zsh"
alias zz='. ~/.zshrc'
# alias ifconfig='/sbin/ifconfig'
source $DOTFILES/k8s/kubectl_helpers.sh
source $DOTFILES/aws/aws_helpers.sh
source $DOTFILES/tsh/tsh.zsh
source $DOTFILES/py/py_helpers.sh
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/gshirazi/Downloads/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/gshirazi/Downloads/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/gshirazi/Downloads/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/gshirazi/Downloads/google-cloud-sdk/completion.zsh.inc'; fi
# The next line enables brew installed site-functions completions
if [ -d '/usr/local/share/zsh/site-functions' ]; then for f in /usr/local/share/zsh/site-functions; do . $f; done; fi

View file

@ -47,6 +47,286 @@ function git_main_branch() {
return 1
}
#
# Aliases
# (sorted alphabetically)
#
alias g='git'
alias ga='git add'
alias gaa='git add --all'
alias gapa='git add --patch'
alias gau='git add --update'
alias gav='git add --verbose'
alias gap='git apply'
alias gapt='git apply --3way'
alias gb='git branch'
alias gba='git branch -a'
alias gbd='git branch -d'
alias gbda='git branch --no-color --merged | command grep -vE "^(\+|\*|\s*($(git_main_branch)|development|develop|devel|dev)\s*$)" | command xargs -n 1 git branch -d'
alias gbD='git branch -D'
alias gbl='git blame -b -w'
alias gbnm='git branch --no-merged'
alias gbr='git branch --remote'
alias gbs='git bisect'
alias gbsb='git bisect bad'
alias gbsg='git bisect good'
alias gbsr='git bisect reset'
alias gbss='git bisect start'
alias gc='git commit -v'
alias gc!='git commit -v --amend'
alias gcn!='git commit -v --no-edit --amend'
alias gca='git commit -v -a'
alias gca!='git commit -v -a --amend'
alias gcan!='git commit -v -a --no-edit --amend'
alias gcans!='git commit -v -a -s --no-edit --amend'
alias gcam='git commit -a -m'
alias gcsm='git commit -s -m'
alias gck='git checkout'
alias gcas='git commit -a -s'
alias gcasm='git commit -a -s -m'
alias gcb='git checkout -b'
alias gckb='git checkout -b'
alias gcf='git config --list'
alias gcl='git clone --recurse-submodules'
alias gclean='git clean -fd'
alias gpristine='git reset --hard && git clean -dfx'
alias gcm='git checkout master'
alias gckm='git checkout $(git_main_branch)'
alias gcd='git checkout develop'
alias gcmsg='git commit -m'
alias gco='git checkout'
alias gcount='git shortlog -sn'
alias gcp='git cherry-pick'
alias gcpa='git cherry-pick --abort'
alias gcpc='git cherry-pick --continue'
alias gcs='git commit -S'
compdef _git gck=git-checkout
alias gd='git diff'
alias gdca='git diff --cached'
alias gdcw='git diff --cached --word-diff'
alias gdct='git describe --tags $(git rev-list --tags --max-count=1)'
alias gds='git diff --staged'
alias gdt='git diff-tree --no-commit-id --name-only -r'
alias gdw='git diff --word-diff'
function gdnolock() {
git diff "$@" ":(exclude)package-lock.json" ":(exclude)*.lock"
}
compdef _git gdnolock=git-diff
function gdv() { git diff -w "$@" | view - }
compdef _git gdv=git-diff
alias gf='git fetch'
alias gfp='git fetch --prune'
# --jobs=<n> was added in git 2.8
is-at-least 2.8 "$git_version" \
&& alias gfa='git fetch --all --prune --jobs=10' \
|| alias gfa='git fetch --all --prune'
alias gfpa='gfa'
alias gfo='git fetch origin'
alias gfg='git ls-files | grep'
alias gg='git gui citool &'
alias gga='git gui citool --amend'
function ggf() {
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
git push --force origin "${b:=$1}"
}
compdef _git ggf=git-checkout
function ggfl() {
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
git push --force-with-lease origin "${b:=$1}"
}
compdef _git ggfl=git-checkout
function ggl() {
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
git pull origin "${*}"
else
[[ "$#" == 0 ]] && local b="$(git_current_branch)"
git pull origin "${b:=$1}"
fi
}
compdef _git ggl=git-checkout
function ggp() {
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
git push origin "${*}"
else
[[ "$#" == 0 ]] && local b="$(git_current_branch)"
git push origin "${b:=$1}"
fi
}
compdef _git ggp=git-checkout
function ggpnp() {
if [[ "$#" == 0 ]]; then
ggl && ggp
else
ggl "${*}" && ggp "${*}"
fi
}
compdef _git ggpnp=git-checkout
function ggu() {
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
git pull --rebase origin "${b:=$1}"
}
compdef _git ggu=git-checkout
alias ggpur='ggu'
alias ggpull='git pull origin "$(git_current_branch)"'
alias ggpush='git push origin "$(git_current_branch)"'
alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)'
alias gpsup='git push --set-upstream origin $(git_current_branch)'
alias ghh='git help'
alias gignore='git update-index --assume-unchanged'
alias gignored='git ls-files -v | grep "^[[:lower:]]"'
alias git-svn-dcommit-push='git svn dcommit && git push github $(git_main_branch):svntrunk'
alias gk='\gitk --all --branches'
alias gke='\gitk --all $(git log -g --pretty=%h)'
alias gp='git pull'
alias gl='git pull'
alias glt='git pull --tags'
alias glg='git log --stat'
alias glgp='git log --stat -p'
alias glgg='git log --graph'
alias glgga='git log --graph --decorate --all'
alias glgm='git log --graph --max-count=10'
alias glo='git log --oneline --decorate'
alias glol="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'"
alias glols="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --stat"
alias glod="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'"
alias glods="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short"
alias glola="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all"
alias glog='git log --oneline --decorate --graph'
alias gloga='git log --oneline --decorate --graph --all'
alias glp="_git_log_prettily"
alias glpn='git --no-pager log --pretty=oneline -n'
alias g1='git --no-pager log --pretty=oneline -n 1'
alias g3='git --no-pager log --pretty=oneline -n 3'
alias glpn5='git --no-pager log --pretty=oneline -n 5'
alias g5='glpn5'
alias g8='git --no-pager log --pretty=oneline -n 8'
compdef _git glp=git-log
alias gm='git merge'
alias gmom='git merge origin/$(git_main_branch)'
alias gmt='git mergetool --no-prompt'
alias gmtvim='git mergetool --no-prompt --tool=vimdiff'
alias gmum='git merge upstream/$(git_main_branch)'
alias gma='git merge --abort'
alias gps='git push'
alias gpsd='git push --dry-run'
alias gpsdr='git push --dry-run'
alias gpsoat='git push origin --all && git push origin --tags'
# compdef _git gpsoat=git-push
alias gbr='git rev-parse --abbrev-ref HEAD'
alias gpsu='git push -u origin $(gbr)'
alias gpsup='git push upstream'
alias gpsv='git push -v'
alias gpsfff='git push --force'
#alias gp='git push'
#alias gpd='git push --dry-run'
#alias gpf='git push --force-with-lease'
#alias gpf!='git push --force'
#alias gpoat='git push origin --all && git push origin --tags'
#alias gpu='git push upstream'
#alias gpv='git push -v'
alias gr='git remote'
alias gra='git remote add'
alias grb='git rebase'
alias grba='git rebase --abort'
alias grbc='git rebase --continue'
alias grbd='git rebase develop'
alias grbi='git rebase -i'
alias grbm='git rebase $(git_main_branch)'
alias grbo='git rebase --onto'
alias grbs='git rebase --skip'
alias grev='git revert'
alias grh='git reset'
alias grhh='git reset --hard'
alias groh='git reset origin/$(git_current_branch) --hard'
alias grm='git rm'
alias grmc='git rm --cached'
alias grmv='git remote rename'
alias grrm='git remote remove'
alias grs='git restore'
alias grset='git remote set-url'
alias grss='git restore --source'
alias grst='git restore --staged'
alias grt='cd "$(git rev-parse --show-toplevel || echo .)"'
alias gru='git reset --'
alias grup='git remote update'
alias grv='git remote -v'
alias gsb='git status -sb'
alias gsd='git svn dcommit'
alias gsh='git show'
alias gsi='git submodule init'
alias gsps='git show --pretty=short --show-signature'
alias gsr='git svn rebase'
alias gss='git status -s'
alias gst='git status'
# use the default stash push on git 2.13 and newer
is-at-least 2.13 "$git_version" \
&& alias gsta='git stash push' \
|| alias gsta='git stash save'
alias gstaa='git stash apply'
alias gstc='git stash clear'
alias gstd='git stash drop'
alias gstl='git --no-pager stash list'
alias gstp='git stash pop'
alias gsts='git stash show --text'
alias gstu='gsta --include-untracked'
alias gstall='git stash --all'
alias gsu='git submodule update'
alias gsw='git switch'
alias gswc='git switch -c'
alias gts='git tag -s'
alias gtv='git tag | sort -V'
alias gtl='gtl(){ git tag --sort=-v:refname -n -l "${1}*" }; noglob gtl'
alias gunignore='git update-index --no-assume-unchanged'
alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1'
alias gup='git pull --rebase'
alias gupv='git pull --rebase -v'
alias gupa='git pull --rebase --autostash'
alias gupav='git pull --rebase --autostash -v'
alias glum='git pull upstream $(git_main_branch)'
alias gwch='git whatchanged -p --abbrev-commit --pretty=medium'
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]"'
alias gam='git am'
alias gamc='git am --continue'
alias gams='git am --skip'
alias gama='git am --abort'
alias gamscp='git am --show-current-patch'
function grename() {
if [[ -z "$1" || -z "$2" ]]; then
echo "Usage: $0 old_branch new_branch"

82
themes/agnoster.zsh-theme Normal file → Executable file
View file

@ -117,7 +117,9 @@ esac
# what font the user is viewing this source code in. Do not replace the
# escape sequence with a single literal character.
# Do not change this! Do not make it '\u2b80'; that is the old, wrong code point.
SEGMENT_SEPARATOR=$'\ue0b0'
# SEGMENT_SEPARATOR=$'\ue0b0'
SEGMENT_SEPARATOR=$'\u2656'
SEGMENT_SEPARATOR_MID=''
}
# Begin a segment
@ -128,7 +130,7 @@ prompt_segment() {
[[ -n $1 ]] && bg="%K{$1}" || bg="%k"
[[ -n $2 ]] && fg="%F{$2}" || fg="%f"
if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then
echo -n " %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} "
echo -n " %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR_MID%{$fg%} "
else
echo -n "%{$bg%}%{$fg%} "
fi
@ -139,9 +141,9 @@ prompt_segment() {
# End the prompt, closing any open segments
prompt_end() {
if [[ -n $CURRENT_BG ]]; then
echo -n " %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR"
echo -n " \n%{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR"
else
echo -n "%{%k%}"
echo -n "\n%{%k%}"
fi
echo -n "%{%f%}"
CURRENT_BG=''
@ -186,8 +188,17 @@ prompt_git() {
local PL_BRANCH_CHAR
() {
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
PL_BRANCH_CHAR=$'\ue0a0' # 
#PL_BRANCH_CHAR=$'\ue0a0' # 
PL_BRANCH_CHAR=$'\u2693' # anchor
}
if [[ ! -z "${USE_ZSH_GIT_PROMPT}" ]]; then
# just use zsh-git-prompt with our segment coloring
prompt_segment yellow red
echo -n ${PL_BRANCH_CHAR} $(git_super_status)
return
fi
local ref dirty mode repo_path
if [[ "$(command git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]]; then
@ -199,7 +210,8 @@ prompt_git() {
if [[ -n $dirty ]]; then
prompt_segment "$AGNOSTER_GIT_DIRTY_BG" "$AGNOSTER_GIT_DIRTY_FG"
else
prompt_segment "$AGNOSTER_GIT_CLEAN_BG" "$AGNOSTER_GIT_CLEAN_FG"
# prompt_segment "$AGNOSTER_GIT_CLEAN_BG" "$AGNOSTER_GIT_CLEAN_FG"
prompt_segment yellow red
fi
if [[ $AGNOSTER_GIT_BRANCH_STATUS == 'true' ]]; then
@ -213,14 +225,15 @@ prompt_git() {
elif [[ -n "$behind" ]]; then
PL_BRANCH_CHAR=$'\u21b0'
fi
prompt_segment yellow red
fi
if [[ -e "${repo_path}/BISECT_LOG" ]]; then
mode=" <B>"
mode+=" <B>"
elif [[ -e "${repo_path}/MERGE_HEAD" ]]; then
mode=" >M<"
mode+=" >M<"
elif [[ -e "${repo_path}/rebase" || -e "${repo_path}/rebase-apply" || -e "${repo_path}/rebase-merge" || -e "${repo_path}/../.dotest" ]]; then
mode=" >R>"
mode+=" >R\u2225"
fi
setopt promptsubst
@ -234,11 +247,18 @@ prompt_git() {
zstyle ':vcs_info:*' formats ' %u%c'
zstyle ':vcs_info:*' actionformats ' %u%c'
vcs_info
echo -n "${${ref:gs/%/%%}/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}"
[[ $AGNOSTER_GIT_INLINE == 'true' ]] && prompt_git_relative
# echo -n "${${ref:gs/%/%%}/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}"
# [[ $AGNOSTER_GIT_INLINE == 'true' ]] && prompt_git_relative
echo -n "${ref/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}"
fi
}
prompt_kubectl() {
prompt_segment magenta blue
echo -n ${ZSH_KUBECTL_PROMPT}
}
prompt_bzr() {
(( $+commands[bzr] )) || return
@ -304,12 +324,15 @@ prompt_hg() {
# Dir: current working directory
prompt_dir() {
if [[ $AGNOSTER_GIT_INLINE == 'true' ]] && $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
# Git repo and inline path enabled, hence only show the git root
prompt_segment "$AGNOSTER_DIR_BG" "$AGNOSTER_DIR_FG" "$(git_toplevel | sed "s:^$HOME:~:")"
else
prompt_segment "$AGNOSTER_DIR_BG" "$AGNOSTER_DIR_FG" '%~'
fi
# if [[ $AGNOSTER_GIT_INLINE == 'true' ]] && $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
# # Git repo and inline path enabled, hence only show the git root
# prompt_segment "$AGNOSTER_DIR_BG" "$AGNOSTER_DIR_FG" "$(git_toplevel | sed "s:^$HOME:~:")"
# else
# prompt_segment "$AGNOSTER_DIR_BG" "$AGNOSTER_DIR_FG" '%~'
# fi
# prompt_segment blue black '%~'
prompt_segment grey cyan '%3~'
}
# Virtualenv: current working virtualenv
@ -323,16 +346,26 @@ prompt_virtualenv() {
# - was there an error
# - am I root
# - are there background jobs?
# - time
prompt_status() {
local -a symbols
if [[ $AGNOSTER_STATUS_RETVAL_NUMERIC == 'true' ]]; then
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{$AGNOSTER_STATUS_RETVAL_FG}%}$RETVAL"
# if [[ $AGNOSTER_STATUS_RETVAL_NUMERIC == 'true' ]]; then
# [[ $RETVAL -ne 0 ]] && symbols+="%{%F{$AGNOSTER_STATUS_RETVAL_FG}%}$RETVAL"
# else
# [[ $RETVAL -ne 0 ]] && symbols+="%{%F{$AGNOSTER_STATUS_RETVAL_FG}%}✘"
# fi
# [[ $UID -eq 0 ]] && symbols+="%{%F{$AGNOSTER_STATUS_ROOT_FG}%}⚡"
# [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{$AGNOSTER_STATUS_JOB_FG}%}⚙"
symbols=()
if [[ $RETVAL -ne 0 ]]; then
symbols+="%{%F{red}%}($RETVAL)✘"
else
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{$AGNOSTER_STATUS_RETVAL_FG}%}✘"
symbols+="%{%F{green}%}✓"
fi
[[ $UID -eq 0 ]] && symbols+="%{%F{$AGNOSTER_STATUS_ROOT_FG}%}⚡"
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{$AGNOSTER_STATUS_JOB_FG}%}⚙"
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙"
symbols+="%{%F{white}[%T]%}"
[[ -n "$symbols" ]] && prompt_segment "$AGNOSTER_STATUS_BG" "$AGNOSTER_STATUS_FG" "$symbols"
}
@ -356,9 +389,10 @@ build_prompt() {
prompt_status
prompt_virtualenv
prompt_aws
prompt_context
# prompt_context
prompt_dir
prompt_git
# prompt_git
prompt_kubectl
prompt_bzr
prompt_hg
prompt_end

View file

@ -302,22 +302,30 @@ setup_ohmyzsh() {
exit 1
fi
# Manual clone with git config options to support git < v1.7.2
git init --quiet "$ZSH" && cd "$ZSH" \
&& git config core.eol lf \
&& git config core.autocrlf false \
&& git config fsck.zeroPaddedFilemode ignore \
&& git config fetch.fsck.zeroPaddedFilemode ignore \
&& git config receive.fsck.zeroPaddedFilemode ignore \
&& git config oh-my-zsh.remote origin \
&& git config oh-my-zsh.branch "$BRANCH" \
&& git remote add origin "$REMOTE" \
&& git fetch --depth=1 origin \
&& git checkout -b "$BRANCH" "origin/$BRANCH" || {
[ ! -d "$ZSH" ] || {
cd -
rm -rf "$ZSH" 2>/dev/null
}
# git init --quiet "$ZSH" && cd "$ZSH" \
# && git config core.eol lf \
# && git config core.autocrlf false \
# && git config fsck.zeroPaddedFilemode ignore \
# && git config fetch.fsck.zeroPaddedFilemode ignore \
# && git config receive.fsck.zeroPaddedFilemode ignore \
# && git config oh-my-zsh.remote origin \
# && git config oh-my-zsh.branch "$BRANCH" \
# && git remote add origin "$REMOTE" \
# && git fetch --depth=1 origin \
# && git checkout -b "$BRANCH" "origin/$BRANCH" || {
# [ ! -d "$ZSH" ] || {
# cd -
# rm -rf "$ZSH" 2>/dev/null
# }
git clone -c core.eol=lf -c core.autocrlf=false \
-c fsck.zeroPaddedFilemode=ignore \
-c fetch.fsck.zeroPaddedFilemode=ignore \
-c receive.fsck.zeroPaddedFilemode=ignore \
"$REMOTE" "$ZSH" && \
pushd $ZSH && git checkout $BRANCH && popd || {
fmt_error "git clone of oh-my-zsh repo failed"
exit 1
}
@ -357,7 +365,11 @@ setup_zshrc() {
mv "$zdot/.zshrc" "$OLD_ZSHRC"
fi
echo "${FMT_GREEN}Using the Oh My Zsh template file and adding it to $zdot/.zshrc.${FMT_RESET}"
# echo "${FMT_GREEN}Using the Oh My Zsh template file and adding it to $zdot/.zshrc.${FMT_RESET}"
ln -s ${ZSH}/dotfiles/.zshrc ~/.zshrc
return
echo "${GREEN}Using the Oh My Zsh template file and adding it to ~/.zshrc.${RESET}"
# Modify $ZSH variable in .zshrc directory to use the literal $ZDOTDIR or $HOME
omz="$ZSH"
@ -488,6 +500,17 @@ print_success() {
printf '%s\n' $FMT_RESET
}
dl_custom_plugins() {
git clone https://github.com/zdharma/fast-syntax-highlighting.git \
${ZSH}/custom/plugins/fast-syntax-highlighting
git clone https://github.com/ghasemnaddaf/zsh-git-prompt --branch plugin \
${ZSH}/custom/plugins/zsh-git-prompt
git clone https://github.com/superbrothers/zsh-kubectl-prompt.git \
${ZSH}/custom/plugins/zsh-kubectl-prompt
}
main() {
# Run as unattended if stdin is not a tty
if [ ! -t 0 ]; then
@ -542,6 +565,7 @@ EOF
setup_ohmyzsh
setup_zshrc
setup_shell
dl_custom_plugins
print_success