Lots of config
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
# Use neovim for vim if present
|
||||
[ -x "$(command -v nvim)" ] && alias vim="nvim" vimdiff="nvim -d"
|
||||
|
||||
@@ -14,6 +13,13 @@ done
|
||||
|
||||
# Verbosity and settings that you pretty much just always are going to want.
|
||||
alias \
|
||||
...="cd .." \
|
||||
...="cd ../.." \
|
||||
....="cd ../../.." \
|
||||
.....="cd ../../../.." \
|
||||
df="df -h" \
|
||||
du="du -h" \
|
||||
free="free -m" \
|
||||
cp="cp -iv" \
|
||||
mv="mv -iv" \
|
||||
rm="rm -vI" \
|
||||
@@ -25,45 +31,41 @@ alias \
|
||||
tmux="tmux -f ~/.config/tmux/tmux.conf" \
|
||||
aider="aider --config ~/.config/aider/aider.yaml"
|
||||
|
||||
alias ff="fzf --preview 'bat --style=numbers --color=always {}'"
|
||||
alias eff='$EDITOR "$(ff)"'
|
||||
|
||||
if command -v eza &> /dev/null; then
|
||||
alias ls='eza -lh --group-directories-first --icons=auto'
|
||||
alias lsa='ls -a'
|
||||
alias lt='eza --tree --level=2 --long --icons --git'
|
||||
alias lta='lt -a'
|
||||
fi
|
||||
|
||||
if command -v zoxide &> /dev/null; then
|
||||
alias cd="zd"
|
||||
zd() {
|
||||
if (( $# == 0 )); then
|
||||
builtin cd ~ || return
|
||||
elif [[ -d $1 ]]; then
|
||||
builtin cd "$1" || return
|
||||
else
|
||||
if ! z "$@"; then
|
||||
echo "Error: Directory not found"
|
||||
return 1
|
||||
fi
|
||||
|
||||
printf "\U000F17A9 "
|
||||
pwd
|
||||
fi
|
||||
|
||||
if [[ -n $TMUX ]]; then
|
||||
tmux rename-window "$(basename "$PWD")"
|
||||
fi
|
||||
}
|
||||
fi
|
||||
|
||||
# Colorize commands when possible.
|
||||
alias \
|
||||
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"
|
||||
@@ -73,7 +75,6 @@ alias \
|
||||
ka="killall" \
|
||||
YT="youtube-viewer" \
|
||||
sdn="sudo shutdown -h now" \
|
||||
e="$EDITOR" \
|
||||
v="$EDITOR" \
|
||||
cl="clear" \
|
||||
p="sudo pacman" \
|
||||
@@ -112,15 +113,19 @@ alias \
|
||||
enr="trans en:ro -j -- " \
|
||||
enri="trans en:ro -i"
|
||||
|
||||
alias d='docker'
|
||||
alias dc='docker compose'
|
||||
alias t='tmux attach || tmux new -s Work'
|
||||
e() { if [ "$#" -eq 0 ]; then command nvim . ; else command nvim "$@"; fi; }
|
||||
|
||||
open() (
|
||||
xdg-open "$@" >/dev/null 2>&1 &
|
||||
)
|
||||
|
||||
function tf() {
|
||||
php artisan test --filter="$*"
|
||||
}
|
||||
|
||||
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}
|
||||
@@ -246,7 +251,6 @@ alias \
|
||||
|
||||
|
||||
alias \
|
||||
docker-compose="podman-compose" \
|
||||
cat="bat" \
|
||||
ls="eza --icons=always" \
|
||||
fullClean="nix-collect-garbage --delete-old; sudo nix-collect-garbage -d; sudo /run/current-system/bin/switch-to-configuration boot" \
|
||||
|
||||
Reference in New Issue
Block a user