run zshrc through shfmt, comment prompt line
This commit is contained in:
parent
4adde9d9f4
commit
427c7b3cf2
@ -25,7 +25,7 @@ export HISTSIZE=999999999
|
||||
export SAVEHIST=$HISTSIZE
|
||||
|
||||
# * * * * * * * * *
|
||||
## Shell Options *
|
||||
# Shell Options *
|
||||
# * * * * * * * * *
|
||||
|
||||
# Setting options
|
||||
@ -52,7 +52,7 @@ bindkey '^n' history-search-forward
|
||||
bindkey ' ' magic-space
|
||||
|
||||
# * * * * * *
|
||||
## Aliases *
|
||||
# Aliases *
|
||||
# * * * * * *
|
||||
|
||||
# core utils
|
||||
@ -72,7 +72,7 @@ alias pathls='printf "%b\n" "${PATH//:/\\n}"'
|
||||
|
||||
# git - vim - tmux
|
||||
alias g="git"
|
||||
alias groot="cd $(git rev-parse --show-toplevel 2> /dev/null || echo -n ".")"
|
||||
alias groot="cd $(git rev-parse --show-toplevel 2>/dev/null || echo -n ".")"
|
||||
alias v="$EDITOR"
|
||||
alias vi="$EDITOR"
|
||||
alias tmls="tmux ls"
|
||||
@ -102,17 +102,10 @@ touchx() { touch "$@" && chmod +x "$@"; }
|
||||
|
||||
# git
|
||||
lazygit() {
|
||||
git commit -a -m "$*" && git push;
|
||||
git commit -a -m "$*" && git push
|
||||
}
|
||||
lg() {
|
||||
lazygit "$*";
|
||||
}
|
||||
|
||||
# vim
|
||||
swp_vimrc(){
|
||||
mv ~/.vim/vimrc ~/.vim/vimrc.swp
|
||||
mv ~/.vim/vimrc.min ~/.vim/vimrc
|
||||
mv ~/.vim/vimrc.swp ~/.vim/vimrc.min
|
||||
lazygit "$*"
|
||||
}
|
||||
|
||||
# tmux
|
||||
@ -135,7 +128,7 @@ tma() {
|
||||
}
|
||||
|
||||
# misc functions
|
||||
colordump(){
|
||||
colordump() {
|
||||
for i in $(seq 0 255); do printf "$(tput setaf $i)$i "; done
|
||||
}
|
||||
|
||||
@ -148,18 +141,20 @@ extract() {
|
||||
return 1
|
||||
else
|
||||
for n in "$@"; do
|
||||
if [ -f "$n" ] ; then
|
||||
if [ -f "$n" ]; then
|
||||
case "${n%,}" in
|
||||
*.tar.bz2|*.tar.gz|*.tar.xz|*.tbz2|*.tgz|*.txz|*.tar)
|
||||
tar xvf "$n" ;;
|
||||
*.tar.bz2 | *.tar.gz | *.tar.xz | *.tbz2 | *.tgz | *.txz | *.tar)
|
||||
tar xvf "$n"
|
||||
;;
|
||||
*.lzma) unlzma ./"$n" ;;
|
||||
*.bz2) bunzip2 ./"$n" ;;
|
||||
*.rar) unrar x -ad ./"$n" ;;
|
||||
*.gz) gunzip ./"$n" ;;
|
||||
*.zip) unzip ./"$n" ;;
|
||||
*.z) uncompress ./"$n" ;;
|
||||
*.7z|*.arj|*.cab|*.chm|*.deb|*.dmg|*.iso|*.lzh|*.msi|*.rpm|*.udf|*.wim|*.xar)
|
||||
7z x ./"$n" ;;
|
||||
*.7z | *.arj | *.cab | *.chm | *.deb | *.dmg | *.iso | *.lzh | *.msi | *.rpm | *.udf | *.wim | *.xar)
|
||||
7z x ./"$n"
|
||||
;;
|
||||
*.xz) unxz ./"$n" ;;
|
||||
*.exe) cabextract ./"$n" ;;
|
||||
*)
|
||||
@ -177,7 +172,7 @@ extract() {
|
||||
|
||||
bkup() {
|
||||
if [ -f "$1" ]; then
|
||||
cp "${1}" "${1}.bkup.$(date +'%F.%R')";
|
||||
cp "${1}" "${1}.bkup.$(date +'%F.%R')"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -199,7 +194,7 @@ datauri() {
|
||||
}
|
||||
|
||||
# grep with color into less
|
||||
grepless(){
|
||||
grepless() {
|
||||
grep -ir --color=always "$*" --exclude-dir=".git" --exclude-dir="node_modules" . | less -RX
|
||||
}
|
||||
|
||||
@ -220,8 +215,8 @@ watip() {
|
||||
# PROMPT='%n@%m %~ %# '
|
||||
|
||||
git_prompt() {
|
||||
BRANCH=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/*\(.*\)/\1/')
|
||||
STATUS="$(git status 2> /dev/null)"
|
||||
BRANCH=$(git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/*\(.*\)/\1/')
|
||||
STATUS="$(git status 2>/dev/null)"
|
||||
|
||||
if [[ "$?" -ne 0 ]]; then
|
||||
return
|
||||
@ -230,27 +225,27 @@ git_prompt() {
|
||||
if [ ! -z $BRANCH ]; then
|
||||
printf "%s" "%F{reset}%F{yellow}$BRANCH"
|
||||
printf "%s" "%F{reset}["
|
||||
if echo "${STATUS}" | grep -c "nothing to commit" &> /dev/null; then printf "%s" "%F{blue}="; fi
|
||||
if echo "${STATUS}" | grep -c "renamed:" &> /dev/null; then printf "%s" "%F{red}%"; fi
|
||||
if echo "${STATUS}" | grep -c "deleted:" &> /dev/null; then printf "%s" "%F{red}-"; fi
|
||||
if echo "${STATUS}" | grep -c "new file:" &> /dev/null; then printf "%s" "%F{green}+"; fi
|
||||
if echo "${STATUS}" | grep -c "branch is ahead:" &> /dev/null; then printf "%s" "%F{yellow}>"; fi
|
||||
if echo "${STATUS}" | grep -c "branch is behind" &> /dev/null; then printf "%s" "%F{yellow}<"; fi
|
||||
if echo "${STATUS}" | grep -c "Untracked files:" &> /dev/null; then printf "%s" "%F{yellow}?"; fi
|
||||
if echo "${STATUS}" | grep -c "Changes not staged for commit:" &> /dev/null; then printf "%s" "%F{red}*"; fi
|
||||
if echo "${STATUS}" | grep -c "Changes to be committed:" &> /dev/null; then printf "%s" "%F{green}="; fi
|
||||
if echo "${STATUS}" | grep -c "nothing to commit" &>/dev/null; then printf "%s" "%F{blue}="; fi
|
||||
if echo "${STATUS}" | grep -c "renamed:" &>/dev/null; then printf "%s" "%F{red}%"; fi
|
||||
if echo "${STATUS}" | grep -c "deleted:" &>/dev/null; then printf "%s" "%F{red}-"; fi
|
||||
if echo "${STATUS}" | grep -c "new file:" &>/dev/null; then printf "%s" "%F{green}+"; fi
|
||||
if echo "${STATUS}" | grep -c "branch is ahead:" &>/dev/null; then printf "%s" "%F{yellow}>"; fi
|
||||
if echo "${STATUS}" | grep -c "branch is behind" &>/dev/null; then printf "%s" "%F{yellow}<"; fi
|
||||
if echo "${STATUS}" | grep -c "Untracked files:" &>/dev/null; then printf "%s" "%F{yellow}?"; fi
|
||||
if echo "${STATUS}" | grep -c "Changes not staged for commit:" &>/dev/null; then printf "%s" "%F{red}*"; fi
|
||||
if echo "${STATUS}" | grep -c "Changes to be committed:" &>/dev/null; then printf "%s" "%F{green}="; fi
|
||||
printf "%s" "%F{reset}]"
|
||||
fi
|
||||
}
|
||||
PROMPT='%F{blue}%~$(git_prompt) %F{yellow}%# %F{reset}'
|
||||
# PROMPT='%F{blue}%~$(git_prompt) %F{green}%# %F{reset}'
|
||||
|
||||
# * * * * * * * * * * * * * * * * * * *
|
||||
# Language Specific Version Managers *
|
||||
# * * * * * * * * * * * * * * * * * * *
|
||||
|
||||
# rbenv (ruby)
|
||||
src_rbenv(){
|
||||
if command -v ruby > /dev/null && command -v gem > /dev/null; then
|
||||
src_rbenv() {
|
||||
if command -v ruby >/dev/null && command -v gem >/dev/null; then
|
||||
path+=("$(ruby -r rubygems -e 'puts Gem.user_dir')/bin")
|
||||
# rbenv shim
|
||||
if [ -d "$HOME/.rbenv/bin" ]; then
|
||||
@ -261,7 +256,7 @@ src_rbenv(){
|
||||
}
|
||||
|
||||
# nvm (node)
|
||||
src_nvm(){
|
||||
src_nvm() {
|
||||
if [ -d "$HOME/.nvm" ]; then
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
@ -274,7 +269,7 @@ src_pyenv() {
|
||||
if [ -d "$HOME/.pyenv" ]; then
|
||||
export PYENV_ROOT="$HOME/.pyenv"
|
||||
path+=("$PYENV_ROOT/bin")
|
||||
command -v pyenv > /dev/null && eval "$(pyenv init -)"
|
||||
command -v pyenv >/dev/null && eval "$(pyenv init -)"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -294,21 +289,20 @@ src_rust() {
|
||||
}
|
||||
|
||||
# ruby
|
||||
if command -v rbenv > /dev/null; then
|
||||
if command -v rbenv >/dev/null; then
|
||||
src_rbenv
|
||||
fi
|
||||
|
||||
# go
|
||||
if command -v go > /dev/null; then
|
||||
if command -v go >/dev/null; then
|
||||
src_go
|
||||
fi
|
||||
|
||||
# rust
|
||||
if command -v cargo > /dev/null; then
|
||||
if command -v cargo >/dev/null; then
|
||||
src_rust
|
||||
fi
|
||||
|
||||
|
||||
# * * * * * * * * * * * *
|
||||
# MISC $PATH Additions *
|
||||
# * * * * * * * * * * * *
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user