Compare commits
No commits in common. "127e2e5aa23a6adf2b257e492db5b75127ce1093" and "0de5db390e4586ace72d5a9ce3f3c5f5c1f10dc7" have entirely different histories.
127e2e5aa2
...
0de5db390e
5 changed files with 19 additions and 82 deletions
32
aliases/apt
32
aliases/apt
|
|
@ -8,27 +8,19 @@ grep -iq 'ID_LIKE=debian' /etc/os-release || \
|
||||||
grep -iq 'NAME=Debian' /etc/os-release || \
|
grep -iq 'NAME=Debian' /etc/os-release || \
|
||||||
return
|
return
|
||||||
|
|
||||||
|
alias xq="apt-cache search"
|
||||||
|
alias xi="sudo apt-get install"
|
||||||
alias xowner="dpkg -S"
|
alias xowner="dpkg -S"
|
||||||
alias xfiles="dpkg -L"
|
alias xfiles="dpkg -L"
|
||||||
|
|
||||||
alias sv="systemctl"
|
alias sv="systemctl"
|
||||||
|
|
||||||
if (( $+commands[nala] )); then
|
xupdate() {
|
||||||
alias xq="nala search"
|
sudo -v
|
||||||
alias xi="sudo nala install"
|
echo "\e[1;32mUpdating package cache...\e[0m"
|
||||||
alias xupdate="sudo nala upgrade"
|
if sudo apt update 2>&1 | grep -q 'apt list --upgradable'; then
|
||||||
else
|
echo "\e[1;92mUpgrades available:\e[0m"
|
||||||
alias xq="apt-cache search"
|
apt list --upgradable
|
||||||
alias xi="sudo apt-get install"
|
echo "\e[1;92mRun upgrades?\e[0m"
|
||||||
|
read -q && sudo apt upgrade -y
|
||||||
xupdate() {
|
fi
|
||||||
sudo -v
|
}
|
||||||
echo "\e[1;32mUpdating package cache...\e[0m"
|
|
||||||
if sudo apt update 2>&1 | grep -q 'apt list --upgradable'; then
|
|
||||||
echo "\e[1;92mUpgrades available:\e[0m"
|
|
||||||
apt list --upgradable
|
|
||||||
echo "\e[1;92mRun upgrades?\e[0m"
|
|
||||||
read -q && sudo apt upgrade -y
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
|
||||||
|
|
@ -392,10 +392,3 @@ if exists gron; then
|
||||||
gron | grep "$@" | gron -u
|
gron | grep "$@" | gron -u
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
autostash() {
|
|
||||||
git stash
|
|
||||||
git "$@"
|
|
||||||
git stash pop
|
|
||||||
}
|
|
||||||
compdef _git autostash
|
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@ defvcsfun gcm "commit" "commit" "commit"
|
||||||
defvcsfun ga "add" "add" "add"
|
defvcsfun ga "add" "add" "add"
|
||||||
defvcsfun gpu "push" "push" "i_am_not_distributed_please_dont_push_me"
|
defvcsfun gpu "push" "push" "i_am_not_distributed_please_dont_push_me"
|
||||||
|
|
||||||
alias gs="git switch"
|
|
||||||
alias gco="git checkout"
|
alias gco="git checkout"
|
||||||
|
alias gca="git commit -a"
|
||||||
alias gap="git add --patch"
|
alias gap="git add --patch"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,64 +1,20 @@
|
||||||
|
|
||||||
PROJECT_ROOT_INDICATORS=(.git .hg package.json build.sbt)
|
|
||||||
|
|
||||||
# These commands find the topmost (i.e. shortest full path) project directory in
|
|
||||||
# the hierarchy of the given directory.
|
|
||||||
# cdup: changes to the match
|
|
||||||
# _cdup: prints the match
|
|
||||||
# _cdup_r: sets ~r as named dir for the match (set up as a chpwd hook)
|
|
||||||
#
|
|
||||||
# args: (cdup|_cdup) [-c] DIR [PROJECT_ROOT_INDICATOR...]
|
|
||||||
# -c / --closest return the nearest project directory, i.e. least steps up,
|
|
||||||
# possibly including the current directory
|
|
||||||
#
|
|
||||||
# DIR is starting point for the search
|
|
||||||
# A PROJECT_ROOT_INDICATOR are files to look for to detect project roots. If
|
|
||||||
# not given, a default list is used. $PROJECT_ROOT_INDICATORS can be used to
|
|
||||||
# override the default globally
|
|
||||||
|
|
||||||
_cdup() {
|
_cdup() {
|
||||||
zparseopts -D -E c=closest -closest=closest
|
|
||||||
local dir=$1; shift
|
local dir=$1; shift
|
||||||
local targets=("$@")
|
local targets=("$@")
|
||||||
local match nextmatch
|
|
||||||
for target in $targets; do
|
for target in $targets; do
|
||||||
if [[ -e $dir/$target ]]; then
|
if [[ -e $dir/$target ]]; then
|
||||||
if [[ $closest ]]; then
|
cd $dir
|
||||||
echo $dir
|
return 0
|
||||||
return
|
|
||||||
else
|
|
||||||
match=$dir
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [[ $dir != "/" ]]; then
|
if [[ $dir == "/" ]]; then return 1
|
||||||
nextmatch=$(_cdup ${dir:h} ${targets[@]})
|
else _cdup ${dir:h} ${targets[@]}
|
||||||
match=${nextmatch:-$match}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $match ]]; then echo $match; return 0;
|
|
||||||
else return 1
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
cdup() {
|
cdup() {
|
||||||
zparseopts -D -E c=closest -closest=closest
|
if [[ ${#@} -gt 0 ]]; then _cdup ${PWD:h} "$@"
|
||||||
local target=$(_cdup $closest ${PWD:h} ${@:-$PROJECT_ROOT_INDICATORS})
|
else _cdup ${PWD:h} .git .hg package.json build.sbt
|
||||||
if [[ $? != 0 ]]; then return 1;
|
|
||||||
else cd $target
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_cdup_r () {
|
|
||||||
_cdup_project_root=$(_cdup ${PWD} ${PROJECT_ROOT_INDICATORS})
|
|
||||||
hash -d r=$_cdup_project_root
|
|
||||||
}
|
|
||||||
|
|
||||||
_prompt_cdup() {
|
|
||||||
[[ -n $_cdup_project_root ]] && echo "project: ${_cdup_project_root:h:t}/${_cdup_project_root:t}"
|
|
||||||
}
|
|
||||||
|
|
||||||
autoload -U add-zsh-hook
|
|
||||||
add-zsh-hook chpwd _cdup_r
|
|
||||||
_cdup_r
|
|
||||||
|
|
|
||||||
4
zshrc
4
zshrc
|
|
@ -128,10 +128,6 @@ if exists mail; then
|
||||||
__chromaz_extra_left+=_prompt_cron_mails
|
__chromaz_extra_left+=_prompt_cron_mails
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if exists _prompt_cdup; then
|
|
||||||
__chromaz_extra_left+=_prompt_cdup
|
|
||||||
fi
|
|
||||||
|
|
||||||
tabs -4
|
tabs -4
|
||||||
#zprof
|
#zprof
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue