various additions from sim laptop
This commit is contained in:
parent
912a3282c5
commit
21e41141ef
13 changed files with 645 additions and 28 deletions
13
aliases/apt
13
aliases/apt
|
|
@ -9,7 +9,18 @@ grep -iq 'ID_LIKE=debian' /etc/os-release || \
|
|||
return
|
||||
|
||||
alias xq="apt-cache search"
|
||||
alias xi="apt-get install"
|
||||
alias xi="sudo apt-get install"
|
||||
alias xowner="dpkg -S"
|
||||
alias xfiles="dpkg -L"
|
||||
alias sv="systemctl"
|
||||
|
||||
xupdate() {
|
||||
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
|
||||
}
|
||||
|
|
|
|||
6
aliases/devel
Normal file
6
aliases/devel
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
ignore() {
|
||||
printf "%s\n" $@ >> .gitignore
|
||||
git add .gitignore
|
||||
}
|
||||
noglob ignore
|
||||
|
|
@ -20,6 +20,8 @@ alias d="dragon-drop -a -x -T"
|
|||
if ! command -v fd >/dev/null; then
|
||||
if command -v fdfind >/dev/null; then
|
||||
alias fd="fdfind"
|
||||
autoload -Uz _fd
|
||||
compdef _fd fdfind
|
||||
else
|
||||
fd() {
|
||||
if [[ "$1" =~ "^-" ]]; then
|
||||
|
|
@ -145,7 +147,6 @@ send-subvolume() { btrfs property set $1 ro true; btrfs send -v $1 | pv | nc -c
|
|||
#################################################################################
|
||||
# filename manipulation
|
||||
##############################################################################{{{
|
||||
alias cleanspaces="renamexm -s/\ /_/g -R"
|
||||
|
||||
# prefix all given files with first argument to this function
|
||||
prefix() {
|
||||
|
|
@ -280,17 +281,8 @@ alias -s log=vimpager
|
|||
# various small scripts
|
||||
##############################################################################{{{
|
||||
|
||||
urlencode() {
|
||||
local input
|
||||
setopt extendedglob
|
||||
if [ -n "$1" ]; then
|
||||
input="$*"
|
||||
else
|
||||
input=$(</dev/stdin)
|
||||
fi
|
||||
# by jkramer, source: http://stackoverflow.com/a/187853/928769
|
||||
echo "${${(j: :)input}//(#b)(?)/%$[[##16]##${match[1]}]}"
|
||||
}
|
||||
alias urldecode="python3 -c 'import sys; from urllib import parse; print(parse.unquote_plus(sys.stdin.read().strip()))'"
|
||||
alias urlencode="python3 -c 'import sys; from urllib import parse; print(parse.quote_plus(sys.stdin.read().strip()))'"
|
||||
|
||||
#}}}
|
||||
|
||||
|
|
@ -392,3 +384,11 @@ fi
|
|||
duplicates() {
|
||||
sort | uniq -c | grep -v '^\s*1'
|
||||
}
|
||||
|
||||
alias rg="RIPGREP_CONFIG_PATH=$XDG_CONFIG_HOME/ripgreprc rg"
|
||||
|
||||
if exists gron; then
|
||||
jgrep() {
|
||||
gron | grep "$@" | gron -u
|
||||
}
|
||||
fi
|
||||
|
|
|
|||
13
aliases/git
13
aliases/git
|
|
@ -88,3 +88,16 @@ gclone() {
|
|||
|
||||
git clone $url "$@"
|
||||
}
|
||||
|
||||
gwt() {
|
||||
local current_tree line prefix
|
||||
typeset -A trees
|
||||
prefix=$(git rev-parse --show-prefix)
|
||||
git worktree list --porcelain | while read line; do
|
||||
if [[ $line = worktree* ]]; then current_tree=${line##worktree }
|
||||
elif [[ $line = branch* ]]; then trees[${line##branch refs/heads/}]=$current_tree
|
||||
fi
|
||||
done
|
||||
local target=$(for k v in ${(kv)trees}; do echo "$k $v"; done | column -t | fzf ${1:+-q} ${1} -1| awk '{print $2}')
|
||||
[[ -n $target ]] && cd $target/$prefix
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue