Adding aliases and stuff
This commit is contained in:
@@ -26,7 +26,42 @@ alias \
|
||||
|
||||
# Colorize commands when possible.
|
||||
alias \
|
||||
ls="ls -hN --color=auto --group-directories-first" \
|
||||
ls="ls -hAN --color=auto --group-directories-first"\
|
||||
li="ls -AhgGFt --group-directories-first --time=atime --color=auto --time-style=long-iso \
|
||||
| sed 's/^[^ ][^ ]* *[^ ][^ ]* //' \
|
||||
| awk '\
|
||||
/^total/ { next }\
|
||||
{\
|
||||
filename = \$NF;\
|
||||
icon = \"📄\";\
|
||||
if (filename ~ /\/$/) {\
|
||||
icon = \"📁\";\
|
||||
} else if (filename ~ /\*$/) {\
|
||||
icon = \"⚙️ \";\
|
||||
} else if (filename ~ /@$/) {\
|
||||
icon = \"🔗\";\
|
||||
} else {\
|
||||
ext = tolower(cleanName);\
|
||||
if (ext ~ /\./) {\
|
||||
sub(/^.*\./, \"\", ext);\
|
||||
} else {\
|
||||
ext = \"\";\
|
||||
}\
|
||||
if (ext ~ /^(jpg|jpeg|png|gif)$/) {\
|
||||
icon = \"🖼\";\
|
||||
} else if (ext ~ /^(mp3|wav|flac)$/) {\
|
||||
icon = \"🎵\";\
|
||||
} else if (ext ~ /^(pdf)$/) {\
|
||||
icon = \"📕\";\
|
||||
} else if (ext ~ /^(txt|md)$/) {\
|
||||
icon = \"📝\";\
|
||||
} else if (ext ~ /^(js|py|sh|c|cpp|java)$/) {\
|
||||
icon = \"⚡\";\
|
||||
}\
|
||||
}\
|
||||
print icon \" \" \$0;\
|
||||
}\
|
||||
'" \
|
||||
grep="grep --color=auto" \
|
||||
diff="diff --color=auto" \
|
||||
ccat="highlight --out-format=ansi"
|
||||
@@ -41,18 +76,22 @@ alias \
|
||||
cl="clear" \
|
||||
p="sudo pacman" \
|
||||
z="zathura" \
|
||||
ll="ls -l" \
|
||||
la="ls -al" \
|
||||
ll="ls -AhlFt --group-directories-first --time=atime --color=auto --time-style=long-iso" \
|
||||
ag="alias | grep" \
|
||||
lc="clone_from_labs" \
|
||||
gc="clone_from_github" \
|
||||
dgit="git --git-dir ~/.config/dotfiles/.git --work-tree=$HOME" \
|
||||
.z="source ~/.config/shell/profile" \
|
||||
.a="source ~/.config/shell/aliasrc" \
|
||||
testmic="arecord -vv -f dat /dev/null"
|
||||
|
||||
# Dev
|
||||
alias \
|
||||
sail='[ -f sail ] && sh sail || sh vendor/bin/sail'
|
||||
yi="yarn install"
|
||||
y="yarn"
|
||||
ci="composer install"
|
||||
c="composer"
|
||||
|
||||
# Translating
|
||||
alias \
|
||||
@@ -61,13 +100,43 @@ alias \
|
||||
enr="trans en:ro -j -- " \
|
||||
enri="trans en:ro -i"
|
||||
|
||||
function cdj() {
|
||||
dir=$1
|
||||
cd $1 2>/dev/null || autojump $1
|
||||
}
|
||||
|
||||
function dut() {
|
||||
threshold=${1:-5}
|
||||
sudo du -hax -t"${threshold}G" /* --exclude=/{proc,sys,dev,run}
|
||||
}
|
||||
|
||||
function gh() {
|
||||
local -a commands=(
|
||||
"Recover deleted file: git checkout HEAD~1 -- <file>"
|
||||
"Revert previous commit keeping changes: git revert --no-commit HEAD~1"
|
||||
"Undo merge/pull that caused conflicts: git revert -m 1 HEAD~1"
|
||||
"Abort rebase: git rebase --abort"
|
||||
"Unstage a file: git restore --staged <file>"
|
||||
"Undo a pushed commit: git reset --hard HEAD~1 && git push --force"
|
||||
)
|
||||
|
||||
echo "Git First-Aid:"
|
||||
echo "--------------------------------"
|
||||
|
||||
for i in {1..${#commands[@]}}; do
|
||||
echo "$i) ${commands[$i]}"
|
||||
done
|
||||
|
||||
echo "--------------------------------"
|
||||
}
|
||||
|
||||
# Clone from labs
|
||||
function clone_from_labs() {
|
||||
function cll() {
|
||||
git clone "git@labs.scarif.space:chris/$1" "${@:2}"
|
||||
}
|
||||
|
||||
# Clone from github
|
||||
function clone_from_github() {
|
||||
function clg() {
|
||||
git clone "https://github.com/$1" "${@:2}"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user