config/shell: add some simple aliases
This commit is contained in:
parent
afdb845fd1
commit
023d79be53
|
@ -49,6 +49,7 @@ let g:firenvim_config = {
|
||||||
\ '.*stackexchange\.com.*': { 'priority': 9, 'takeover': 'never', },
|
\ '.*stackexchange\.com.*': { 'priority': 9, 'takeover': 'never', },
|
||||||
\ '.*stackoverflow\.com.*': { 'priority': 9, 'takeover': 'never', },
|
\ '.*stackoverflow\.com.*': { 'priority': 9, 'takeover': 'never', },
|
||||||
\ '.*com/questions/[0-9]+/.*': { 'priority': 9, 'takeover': 'never', },
|
\ '.*com/questions/[0-9]+/.*': { 'priority': 9, 'takeover': 'never', },
|
||||||
|
\ '.*com/posts/[0-9]+/.*': { 'priority': 9, 'takeover': 'never', },
|
||||||
\ }
|
\ }
|
||||||
\ }
|
\ }
|
||||||
if exists('g:started_by_firenvim')
|
if exists('g:started_by_firenvim')
|
||||||
|
|
|
@ -16,7 +16,7 @@ alias info='info --vi-keys'
|
||||||
d() {
|
d() {
|
||||||
local query="$(zf "$@")"
|
local query="$(zf "$@")"
|
||||||
# First find out whether there is an obvious match
|
# First find out whether there is an obvious match
|
||||||
# (at least 3 matches & score at least ten times above runner-up or score above 20)
|
# (score at least ten times above runner-up and score above 20)
|
||||||
# If not select with fzf, using locate to find extra options
|
# If not select with fzf, using locate to find extra options
|
||||||
cd "$(if expr "$(echo "$query" | head -1 | cut -d' ' -f2)" \> 20 \& $(echo "$query" | sed 'N;s|/.*\n|> 10 *|;q' | sed 's| */.*||') >/dev/null 2>&1
|
cd "$(if expr "$(echo "$query" | head -1 | cut -d' ' -f2)" \> 20 \& $(echo "$query" | sed 'N;s|/.*\n|> 10 *|;q' | sed 's| */.*||') >/dev/null 2>&1
|
||||||
then echo "$query" | head -1
|
then echo "$query" | head -1
|
||||||
|
@ -28,6 +28,7 @@ di() {
|
||||||
}
|
}
|
||||||
alias c=z
|
alias c=z
|
||||||
alias v=edit
|
alias v=edit
|
||||||
|
alias hx='sudo hexedit --maximize --color'
|
||||||
|
|
||||||
xdh="$XDG_DATA_HOME"
|
xdh="$XDG_DATA_HOME"
|
||||||
xch="$XDG_CONFIG_HOME"
|
xch="$XDG_CONFIG_HOME"
|
||||||
|
@ -64,7 +65,7 @@ wh() {
|
||||||
if expr "$res" : "${@:$#}: aliased to" >/dev/null
|
if expr "$res" : "${@:$#}: aliased to" >/dev/null
|
||||||
then echo "$res" | bat --style=plain --language=sh && wh $(expr "$res" : "${@:$#}: aliased to ${@:$#} " >/dev/null && echo "-p") $(echo "$res" | cut -d' ' -f$(expr 5 '&' "$res" : ".*\(sudo\|noglob\)" '|' 4))
|
then echo "$res" | bat --style=plain --language=sh && wh $(expr "$res" : "${@:$#}: aliased to ${@:$#} " >/dev/null && echo "-p") $(echo "$res" | cut -d' ' -f$(expr 5 '&' "$res" : ".*\(sudo\|noglob\)" '|' 4))
|
||||||
# use command which for other shells
|
# use command which for other shells
|
||||||
else test -r "$res" && b --style=header "$res" || echo "$res" | bat --style=plain --language=sh
|
else test -r "$res" && b --style=header "$res" || echo "$res" | bat --style=plain --language=sh
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
compdef wh=which
|
compdef wh=which
|
||||||
|
@ -320,6 +321,9 @@ mkcd() {
|
||||||
mkdir -p "$1" && cd "$1"
|
mkdir -p "$1" && cd "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
alias move='rsync --recursive --progress --human-readable --remove-source-files'
|
||||||
|
alias rdiff='rsync --recursive --progress --delete --links --dry-run'
|
||||||
|
|
||||||
# mv with automatic sudo if neccessary
|
# mv with automatic sudo if neccessary
|
||||||
smv() {
|
smv() {
|
||||||
test -w "$1" && test -w "$(dirname $2)" && mv "$@" || sudo mv "$@"
|
test -w "$1" && test -w "$(dirname $2)" && mv "$@" || sudo mv "$@"
|
||||||
|
@ -398,8 +402,8 @@ clean() {
|
||||||
|
|
||||||
highlight "c to clean local caches"
|
highlight "c to clean local caches"
|
||||||
if [[ $1 =~ "c" ]]; then
|
if [[ $1 =~ "c" ]]; then
|
||||||
find -name ".gradle" -o -name "generated" -o -name "dist_newstyle" -o -name "cache" -o -name "node_modules" -print -exec rm -r {} +
|
find -name ".gradle" -o -name "generated" -o -name "dist_newstyle" -o -name "cache" -o -name "node_modules" -print -exec rm -r {} + -prune
|
||||||
find -name "*build" -exec rm -rI {} +
|
find -name "*build" -print -exec rm -rI {} + -prune
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$BASH_VERSION"; then
|
if test "$BASH_VERSION"; then
|
||||||
|
|
Loading…
Reference in New Issue