52 lines
1.3 KiB
Bash
52 lines
1.3 KiB
Bash
source $HOME/.common.sh
|
|
|
|
command_exists exa && alias ls="exa"
|
|
command_exists garbage && alias rm="garbage put"
|
|
|
|
alias remind="printf '\a'"
|
|
alias cm="chezmoi"
|
|
alias kill-gpg-agent="gpgconf --kill gpg-agent"
|
|
alias dcompose="docker-compose"
|
|
alias ytmp3="youtube-dl --extract-audio --audio-format mp3 --embed-thumbnail --add-metadata"
|
|
|
|
function nixdev() {
|
|
DIR=$(pwd)
|
|
while [ ! -f "$DIR/flake.nix" ]; do
|
|
DIR=$(dirname $DIR)
|
|
if [[ "$DIR" == "/" ]]; then break; fi
|
|
done
|
|
nix develop "$DIR#$1" -c zsh
|
|
}
|
|
|
|
function ced() {
|
|
# if the file doesn't exist, prompt to make a new one
|
|
if [ ! -f "$1" ]; then
|
|
read "?$1 doesn't exist.. create file? [yN] " yn
|
|
case $yn in
|
|
[Yy]* )
|
|
echo "creating new file"
|
|
install -D /dev/null $1
|
|
echo "\n" > $1
|
|
chezmoi add $1;;
|
|
* )
|
|
echo "nah"
|
|
return;;
|
|
esac
|
|
# if the file exists but not in chezmoi
|
|
else
|
|
chezmoi source-path $1 > /dev/null
|
|
result=$?
|
|
if [ $result -ne 0 ]; then
|
|
echo "file doesn't exist in chezmoi.. adding"
|
|
chezmoi add $1
|
|
fi
|
|
fi
|
|
|
|
chezmoi edit $1
|
|
echo "applying changes..."
|
|
chezmoi apply
|
|
}
|
|
|
|
cpush() {
|
|
chezmoi git add . -- -A && chezmoi git commit -- -m "update" && chezmoi git push
|
|
}
|