Merge branch 'master' into clean/theme_atomic_and_axin

pull/1783/head
BarbUk 2021-01-14 13:45:31 +01:00 committed by GitHub
commit bd6dbd3edf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 578 additions and 457 deletions

View File

@ -1,131 +1,186 @@
# shellcheck shell=bash
cite 'about-alias'
about-alias 'common git abbreviations'
# Aliases
alias gcl='git clone'
alias ga='git add'
alias grm='git rm'
alias gap='git add -p'
alias gall='git add -A'
alias gf='git fetch --all --prune'
alias gft='git fetch --all --prune --tags'
alias gfv='git fetch --all --prune --verbose'
alias gftv='git fetch --all --prune --tags --verbose'
alias gus='git reset HEAD'
alias gpristine='git reset --hard && git clean -dfx'
alias gclean='git clean -fd'
alias gm="git merge"
alias gmv='git mv'
alias g='git'
alias get='git'
alias gs='git status'
alias gss='git status -s'
alias gsu='git submodule update --init --recursive'
alias gl='git pull'
alias gpl='git pull'
alias glum='git pull upstream master'
alias gpr='git pull --rebase'
alias gpp='git pull && git push'
alias gup='git fetch && git rebase'
alias gp='git push'
alias gpd='git push --delete'
alias gpo='git push origin HEAD'
alias gpu='git push --set-upstream'
alias gpuo='git push --set-upstream origin'
alias gpuoc='git push --set-upstream origin $(git symbolic-ref --short HEAD)'
alias gpom='git push origin master'
alias gr='git remote'
alias grv='git remote -v'
alias gra='git remote add'
alias grb='git rebase'
alias grm='git rebase master'
alias grmi='git rebase master -i'
# add
alias ga='git add'
alias gall='git add -A'
alias gap='git add -p'
# branch
alias gb='git branch'
alias gbD='git branch -D'
alias gba='git branch -a'
alias gbd='git branch -d'
alias gbm='git branch -m'
alias gbt='git branch --track'
alias gdel='git branch -D'
# for-each-ref
alias gbc='git for-each-ref --format="%(authorname) %09 %(if)%(HEAD)%(then)*%(else)%(refname:short)%(end) %09 %(creatordate)" refs/remotes/ --sort=authorname DESC' # FROM https://stackoverflow.com/a/58623139/10362396
# commit
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gcaa='git commit -a --amend -C HEAD' # Add uncommitted and unstaged changes to the last commit
alias gcam='git commit -v -am'
alias gcamd='git commit --amend'
alias gcm='git commit -v -m'
alias gci='git commit --interactive'
alias gcsam='git commit -S -am'
# checkout
alias gcb='git checkout -b'
alias gco='git checkout'
alias gcob='git checkout -b'
alias gcobu='git checkout -b ${USER}/'
alias gcom='git checkout master'
alias gcpd='git checkout master; git pull; git branch -D'
alias gct='git checkout --track'
# clone
alias gcl='git clone'
# clean
alias gclean='git clean -fd'
# cherry-pick
alias gcp='git cherry-pick'
alias gcpx='git cherry-pick -x'
# diff
alias gd='git diff'
alias gds='git diff --staged'
alias gdt='git difftool'
alias gdv='git diff -w "$@" | vim -R -'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gcm='git commit -v -m'
alias gcam="git commit -v -am"
alias gci='git commit --interactive'
alias gcamd='git commit --amend'
alias gb='git branch'
alias gba='git branch -a'
# FROM https://stackoverflow.com/a/58623139/10362396
alias gbc='git for-each-ref --format="%(authorname) %09 %(if)%(HEAD)%(then)*%(else)%(refname:short)%(end) %09 %(creatordate)" refs/remotes/ --sort=authorname DESC'
alias gbt='git branch --track'
alias gbm='git branch -m'
alias gbd='git branch -d'
alias gbD='git branch -D'
alias gcount='git shortlog -sn'
alias gcp='git cherry-pick'
alias gcpx='git cherry-pick -x'
alias gco='git checkout'
alias gcom='git checkout master'
alias gcb='git checkout -b'
alias gcob='git checkout -b'
alias gcobu='git checkout -b ${USER}/'
alias gct='git checkout --track'
alias gcpd='git checkout master; git pull; git branch -D'
# archive
alias gexport='git archive --format zip --output'
alias gdel='git branch -D'
# fetch
alias gf='git fetch --all --prune'
alias gft='git fetch --all --prune --tags'
alias gftv='git fetch --all --prune --tags --verbose'
alias gfv='git fetch --all --prune --verbose'
alias gmu='git fetch origin -v; git fetch upstream -v; git merge upstream/master'
alias gup='git fetch && git rebase'
# log
alias gg='git log --graph --pretty=format:'\''%C(bold)%h%Creset%C(magenta)%d%Creset %s %C(yellow)<%an> %C(cyan)(%cr)%Creset'\'' --abbrev-commit --date=relative'
alias ggf='git log --graph --date=short --pretty=format:'\''%C(auto)%h %Cgreen%an%Creset %Cblue%cd%Creset %C(auto)%d %s'\'''
alias ggs='gg --stat'
alias gll='git log --graph --pretty=oneline --abbrev-commit'
alias gg="git log --graph --pretty=format:'%C(bold)%h%Creset%C(magenta)%d%Creset %s %C(yellow)<%an> %C(cyan)(%cr)%Creset' --abbrev-commit --date=relative"
alias ggf="git log --graph --date=short --pretty=format:'%C(auto)%h %Cgreen%an%Creset %Cblue%cd%Creset %C(auto)%d %s'"
alias ggs="gg --stat"
alias gsh="git show"
alias gsl="git shortlog -sn"
alias gwc="git whatchanged"
alias gt="git tag"
alias gta="git tag -a"
alias gtd="git tag -d"
alias gtl="git tag -l"
alias gpatch="git format-patch -1"
# From http://blogs.atlassian.com/2014/10/advanced-git-aliases/
# Show commits since last pull
alias gnew="git log HEAD@{1}..HEAD@{0}"
# Add uncommitted and unstaged changes to the last commit
alias gcaa="git commit -a --amend -C HEAD"
# Rebase with latest remote master
alias gprom="git fetch origin master && git rebase origin/master && git update-ref refs/heads/master origin/master"
alias gpf="git push --force"
alias gpunch="git push --force-with-lease"
alias ggui="git gui"
alias gcsam="git commit -S -am"
# Stash aliases
alias gst="git stash"
alias gstb="git stash branch"
alias gstd="git stash drop"
alias gstl="git stash list"
# Push introduced in git v2.13.2
alias gstpu="git stash push"
alias gstpum="git stash push -m"
# Save deprecated since git v2.16.0
# - aliases now resolve to push
alias gsts="git stash push"
alias gstsm="git stash push -m"
# Alias gstpo added for symmetry with gstpu (push)
# - gstp remains as alias for pop due to long-standing usage
alias gstpo="git stash pop"
alias gstp="git stash pop"
# Switch aliases - Requires git v2.23+
alias gsw="git switch"
alias gswm="git switch master"
alias gswc="git switch --create"
alias gswt="git switch --track"
# Git home
alias ghm='cd "$(git rev-parse --show-toplevel)"'
alias gnew='git log HEAD@{1}..HEAD@{0}' # Show commits since last pull, see http://blogs.atlassian.com/2014/10/advanced-git-aliases/
alias gwc='git whatchanged'
# ls-files
alias gu='git ls-files . --exclude-standard --others' # Show untracked files
alias glsut='gu'
alias glsum='git diff --name-only --diff-filter=U' # Show unmerged (conflicted) files
# gui
alias ggui='git gui'
# home
alias ghm='cd '\''$(git rev-parse --show-toplevel)'\''' # Git home
# appendage to ghm
if ! _command_exists gh; then
alias gh='ghm'
fi
# Show untracked files
alias gu='git ls-files . --exclude-standard --others'
# Git SVN
alias gsr='git svn rebase'
# merge
alias gm='git merge'
# mv
alias gmv='git mv'
# patch
alias gpatch='git format-patch -1'
# push
alias gp='git push'
alias gpd='git push --delete'
alias gpf='git push --force'
alias gpo='git push origin HEAD'
alias gpom='git push origin master'
alias gpu='git push --set-upstream'
alias gpunch='git push --force-with-lease'
alias gpuo='git push --set-upstream origin'
alias gpuoc='git push --set-upstream origin $(git symbolic-ref --short HEAD)'
# pull
alias gl='git pull'
alias glum='git pull upstream master'
alias gpl='git pull'
alias gpp='git pull && git push'
alias gpr='git pull --rebase'
# remote
alias gr='git remote'
alias gra='git remote add'
alias grv='git remote -v'
# rm
alias grm='git rm'
# rebase
alias grb='git rebase'
alias grm='git rebase master'
alias grmi='git rebase master -i'
alias gprom='git fetch origin master && git rebase origin/master && git update-ref refs/heads/master origin/master' # Rebase with latest remote master
# reset
alias gus='git reset HEAD'
alias gpristine='git reset --hard && git clean -dfx'
# status
alias gs='git status'
alias gss='git status -s'
# shortlog
alias gcount='git shortlog -sn'
alias gsl='git shortlog -sn'
# show
alias gsh='git show'
# svn
alias gsd='git svn dcommit'
alias gsr='git svn rebase' # Git SVN
# stash
alias gst='git stash'
alias gstb='git stash branch'
alias gstd='git stash drop'
alias gstl='git stash list'
alias gstp='git stash pop' # kept due to long-standing usage
alias gstpo='git stash pop' # recommended for it's symmetry with gstpu (push)
## 'stash push' introduced in git v2.13.2
alias gstpu='git stash push'
alias gstpum='git stash push -m'
## 'stash save' deprecated since git v2.16.0, alias is now push
alias gsts='git stash push'
alias gstsm='git stash push -m'
# submodules
alias gsu='git submodule update --init --recursive'
# switch
# these aliases requires git v2.23+
alias gsw='git switch'
alias gswc='git switch --create'
alias gswm='git switch master'
alias gswt='git switch --track'
# tag
alias gt='git tag'
alias gta='git tag -a'
alias gtd='git tag -d'
alias gtl='git tag -l'
case $OSTYPE in
darwin*)
@ -135,3 +190,8 @@ case $OSTYPE in
alias gtls='git tag -l | sort -V'
;;
esac
# functions
function gdv() {
git diff --ignore-all-space "$@" | vim -R -
}

View File

@ -32,6 +32,7 @@ themes/powerline
themes/barbuk
themes/atomic
themes/axin
themes/base.theme.bash
# plugins
#
@ -48,5 +49,7 @@ completion/available/vault.completion.bash
completion/available/sdkman.completion.bash
# aliases
#
aliases/available/dnf.aliases.bash
aliases/available/vim.aliases.bash
aliases/available/git.aliases.bash

View File

@ -59,8 +59,18 @@ _sdkman_candidate_all_versions() {
if [ "$SDKMAN_OFFLINE_MODE" = "true" ]; then
CANDIDATE_VERSIONS=$CANDIDATE_LOCAL_VERSIONS
else
CANDIDATE_ONLINE_VERSIONS="$(__sdkman_list_versions "$1" | grep " " | grep "\." | cut -c 62-)"
CANDIDATE_VERSIONS="$(echo "$CANDIDATE_ONLINE_VERSIONS $CANDIDATE_LOCAL_VERSIONS" | tr ' ' '\n' | sort | uniq -u) "
# sdkman has a specific output format for Java candidate since
# there are multiple vendors and builds.
if [ "$candidate" = "java" ]; then
CANDIDATE_ONLINE_VERSIONS="$(__sdkman_list_versions "$candidate" | grep " " | grep "\." | cut -c 62-)"
else
CANDIDATE_ONLINE_VERSIONS="$(__sdkman_list_versions "$candidate" | grep " " | grep "\." | cut -c 6-)"
fi
# the last grep is used to filter out sdkman flags, such as:
# "+" - local version
# "*" - installed
# ">" - currently in use
CANDIDATE_VERSIONS="$(echo "$CANDIDATE_ONLINE_VERSIONS $CANDIDATE_LOCAL_VERSIONS" | tr ' ' '\n' | grep -v -e '^[[:space:]|\*|\>|\+]*$' | sort | uniq -u) "
fi
}

View File

@ -1,14 +1,48 @@
#!/usr/bin/bash
if command -v vue > /dev/null; then
if _command_exists vue; then
__vuejs_completion() {
local OPTS=("--version --help create add invoke inspect serve build ui init config upgrade info")
COMPREPLY=()
for _opt_ in ${OPTS[@]}; do
if [[ "$_opt_" == "$2"* ]]; then
COMPREPLY+=("$_opt_")
fi
done
local prev=$(_get_pword)
local curr=$(_get_cword)
case $prev in
create)
COMPREPLY=($(compgen -W "-p -d -i -m -r -g -n -f -c -x -b -h --help --preset --default --inilinePreset --packageManager --registry --git --no-git --force --merge --clone --proxy --bare --skipGetStarted" -- "$curr"))
;;
add|invoke)
COMPREPLY=($(compgen -W "--registry -h --help" -- "$curr"))
;;
inspect)
COMPREPLY=($(compgen -W "-v --help --verbose --mode --rule --plugin --plugins --rules" -- "$curr"))
;;
serve)
COMPREPLY=($(compgen -W "-o -h --help --open -c --copy -p --port" -- "$curr"))
;;
build)
COMPREPLY=($(compgen -W "-t --target -n --name -d --dest -h --help" -- "$curr"))
;;
ui)
COMPREPLY=($(compgen -W "-H --host -p --port -D --dev --quiet --headless -h --help" -- "$curr"))
;;
init)
COMPREPLY=($(compgen -W "-c --clone --offline -h --help" -- "$curr"))
;;
config)
COMPREPLY=($(compgen -W "-g --get -s --set -d --delete -e --edit --json -h --help" -- "$curr"))
;;
outdated)
COMPREPLY=($(compgen -W "--next -h --help" -- "$curr"))
;;
upgrade)
COMPREPLY=($(compgen -W "-t --to -f --from -r --registry --all --next -h --help" -- "$curr"))
;;
migrate)
COMPREPLY=($(compgen -W "-f --from -h --help" -- "$curr"))
;;
*)
COMPREPLY=($(compgen -W "-h --help -v --version create add invoke inspect serve build ui init config outdated upgrade migrate info" -- "$curr"))
;;
esac
}
complete -F __vuejs_completion vue

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
# shellcheck shell=bash
CLOCK_CHAR_THEME_PROMPT_PREFIX=''
CLOCK_CHAR_THEME_PROMPT_SUFFIX=''
@ -100,25 +100,39 @@ if [[ -x "$SVN_EXE" ]] ; then
fi
function scm {
if [[ "$SCM_CHECK" = false ]]; then SCM=$SCM_NONE
elif [[ -f .git/HEAD ]] && [[ -x "$GIT_EXE" ]]; then SCM=$SCM_GIT
elif [[ -x "$GIT_EXE" ]] && [[ -n "$(git rev-parse --is-inside-work-tree 2> /dev/null)" ]]; then SCM=$SCM_GIT
elif [[ -x "$P4_EXE" ]] && [[ -n "$(p4 set P4CLIENT 2> /dev/null)" ]]; then SCM=$SCM_P4
elif [[ -d .hg ]] && [[ -x "$HG_EXE" ]]; then SCM=$SCM_HG
elif [[ -x "$HG_EXE" ]] && [[ -n "$(hg root 2> /dev/null)" ]]; then SCM=$SCM_HG
elif [[ -d .svn ]] && [[ -x "$SVN_EXE" ]]; then SCM=$SCM_SVN
elif [[ -x "$SVN_EXE" ]] && [[ -n "$(svn info --show-item wc-root 2>/dev/null)" ]]; then SCM=$SCM_SVN
else SCM=$SCM_NONE
if [[ "$SCM_CHECK" = false ]]; then
SCM=$SCM_NONE
elif [[ -f .git/HEAD ]] && [[ -x "$GIT_EXE" ]]; then
SCM=$SCM_GIT
elif [[ -x "$GIT_EXE" ]] && [[ -n "$(git rev-parse --is-inside-work-tree 2> /dev/null)" ]]; then
SCM=$SCM_GIT
elif [[ -x "$P4_EXE" ]] && [[ -n "$(p4 set P4CLIENT 2> /dev/null)" ]]; then
SCM=$SCM_P4
elif [[ -d .hg ]] && [[ -x "$HG_EXE" ]]; then
SCM=$SCM_HG
elif [[ -x "$HG_EXE" ]] && [[ -n "$(hg root 2> /dev/null)" ]]; then
SCM=$SCM_HG
elif [[ -d .svn ]] && [[ -x "$SVN_EXE" ]]; then
SCM=$SCM_SVN
elif [[ -x "$SVN_EXE" ]] && [[ -n "$(svn info --show-item wc-root 2> /dev/null)" ]]; then
SCM=$SCM_SVN
else
SCM=$SCM_NONE
fi
}
function scm_prompt_char {
if [[ -z $SCM ]]; then scm; fi
if [[ $SCM == $SCM_GIT ]]; then SCM_CHAR=$SCM_GIT_CHAR
elif [[ $SCM == $SCM_P4 ]]; then SCM_CHAR=$SCM_P4_CHAR
elif [[ $SCM == $SCM_HG ]]; then SCM_CHAR=$SCM_HG_CHAR
elif [[ $SCM == $SCM_SVN ]]; then SCM_CHAR=$SCM_SVN_CHAR
else SCM_CHAR=$SCM_NONE_CHAR
if [[ $SCM == "$SCM_GIT" ]]; then
SCM_CHAR=$SCM_GIT_CHAR
elif [[ $SCM == "$SCM_P4" ]]; then
SCM_CHAR=$SCM_P4_CHAR
elif [[ $SCM == "$SCM_HG" ]]; then
SCM_CHAR=$SCM_HG_CHAR
elif [[ $SCM == "$SCM_SVN" ]]; then
SCM_CHAR=$SCM_SVN_CHAR
else
SCM_CHAR=$SCM_NONE_CHAR
fi
}
@ -127,10 +141,10 @@ function scm_prompt_vars {
scm_prompt_char
SCM_DIRTY=0
SCM_STATE=''
[[ $SCM == $SCM_GIT ]] && git_prompt_vars && return
[[ $SCM == $SCM_P4 ]] && p4_prompt_vars && return
[[ $SCM == $SCM_HG ]] && hg_prompt_vars && return
[[ $SCM == $SCM_SVN ]] && svn_prompt_vars && return
[[ $SCM == "$SCM_GIT" ]] && git_prompt_vars && return
[[ $SCM == "$SCM_P4" ]] && p4_prompt_vars && return
[[ $SCM == "$SCM_HG" ]] && hg_prompt_vars && return
[[ $SCM == "$SCM_SVN" ]] && svn_prompt_vars && return
}
function scm_prompt_info {
@ -149,7 +163,7 @@ function scm_prompt_info_common {
SCM_DIRTY=0
SCM_STATE=''
if [[ ${SCM} == ${SCM_GIT} ]]; then
if [[ ${SCM} == "${SCM_GIT}" ]]; then
if [[ ${SCM_GIT_SHOW_MINIMAL_INFO} == true ]]; then
# user requests minimal git status information
git_prompt_minimal_info
@ -161,9 +175,9 @@ function scm_prompt_info_common {
fi
# TODO: consider adding minimal status information for hg and svn
{ [[ ${SCM} == ${SCM_P4} ]] && p4_prompt_info && return; } || true
{ [[ ${SCM} == ${SCM_HG} ]] && hg_prompt_info && return; } || true
{ [[ ${SCM} == ${SCM_SVN} ]] && svn_prompt_info && return; } || true
{ [[ ${SCM} == "${SCM_P4}" ]] && p4_prompt_info && return; } || true
{ [[ ${SCM} == "${SCM_HG}" ]] && hg_prompt_info && return; } || true
{ [[ ${SCM} == "${SCM_SVN}" ]] && svn_prompt_info && return; } || true
}
function terraform_workspace_prompt {
@ -318,7 +332,7 @@ function get_hg_root {
return
fi
CURRENT_DIR=$(dirname $CURRENT_DIR)
CURRENT_DIR=$(dirname "$CURRENT_DIR")
done
}
@ -375,8 +389,8 @@ function rvm_version_prompt {
function rbenv_version_prompt {
if which rbenv &> /dev/null; then
rbenv=$(rbenv version-name) || return
$(rbenv commands | grep -q gemset) && gemset=$(rbenv gemset active 2> /dev/null) && rbenv="$rbenv@${gemset%% *}"
if [ $rbenv != "system" ]; then
$rbenv commands | grep -q gemset && gemset=$(rbenv gemset active 2> /dev/null) && rbenv="$rbenv@${gemset%% *}"
if [ "$rbenv" != "system" ]; then
echo -e "$RBENV_THEME_PROMPT_PREFIX$rbenv$RBENV_THEME_PROMPT_SUFFIX"
fi
fi
@ -396,7 +410,7 @@ function chruby_version_prompt {
ruby_version=$(ruby --version | awk '{print $1, $2;}') || return
if [[ ! $(chruby | grep '\*') ]]; then
if ! chruby | grep -q '\*'; then
ruby_version="${ruby_version} (system)"
fi
echo -e "${CHRUBY_THEME_PROMPT_PREFIX}${ruby_version}${CHRUBY_THEME_PROMPT_SUFFIX}"
@ -415,7 +429,7 @@ function k8s_context_prompt {
function virtualenv_prompt {
if [[ -n "$VIRTUAL_ENV" ]]; then
virtualenv=`basename "$VIRTUAL_ENV"`
virtualenv=$(basename "$VIRTUAL_ENV")
echo -e "$VIRTUALENV_THEME_PROMPT_PREFIX$virtualenv$VIRTUALENV_THEME_PROMPT_SUFFIX"
fi
}
@ -439,7 +453,7 @@ function git_user_info {
# support two or more initials, set by 'git pair' plugin
SCM_CURRENT_USER=$(git config user.initials | sed 's% %+%')
# if `user.initials` weren't set, attempt to extract initials from `user.name`
[[ -z "${SCM_CURRENT_USER}" ]] && SCM_CURRENT_USER=$(printf "%s" $(for word in $(git config user.name | PERLIO=:utf8 perl -pe '$_=lc'); do printf "%s" "${word:0:1}"; done))
[[ -z "${SCM_CURRENT_USER}" ]] && SCM_CURRENT_USER=$(printf "%s" "$(for word in $(git config user.name | PERLIO=:utf8 perl -pe '$_=lc'); do printf "%s" "${word:0:1}"; done)")
[[ -n "${SCM_CURRENT_USER}" ]] && printf "%s" "$SCM_THEME_CURRENT_USER_PREFFIX$SCM_CURRENT_USER$SCM_THEME_CURRENT_USER_SUFFIX"
}
@ -456,7 +470,7 @@ function clock_char {
function clock_prompt {
CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$normal"}
CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-"%H:%M:%S"}
[ -z $THEME_SHOW_CLOCK ] && THEME_SHOW_CLOCK=${THEME_CLOCK_CHECK:-"true"}
[ -z "$THEME_SHOW_CLOCK" ] && THEME_SHOW_CLOCK=${THEME_CLOCK_CHECK:-"true"}
SHOW_CLOCK=$THEME_SHOW_CLOCK
if [[ "${SHOW_CLOCK}" = "true" ]]; then