48 lines
946 B
Plaintext
48 lines
946 B
Plaintext
|
# extract the current file with the right command
|
||
|
# (xkcd link: https://xkcd.com/1168/)
|
||
|
cmd extract ${{
|
||
|
set -f
|
||
|
case $f in
|
||
|
*.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf $f;;
|
||
|
*.tar.gz|*.tgz) tar xzvf $f;;
|
||
|
*.tar.xz|*.txz) tar xJvf $f;;
|
||
|
*.zip) unzip $f;;
|
||
|
*.rar) unrar x $f;;
|
||
|
*.7z) 7z x $f;;
|
||
|
esac
|
||
|
}}
|
||
|
|
||
|
# compress current file or selected files with tar and gunzip
|
||
|
cmd tar ${{
|
||
|
set -f
|
||
|
mkdir $1
|
||
|
cp -r $fx $1
|
||
|
tar czf $1.tar.gz $1
|
||
|
rm -rf $1
|
||
|
}}
|
||
|
|
||
|
# compress current file or selected files with zip
|
||
|
cmd zip ${{
|
||
|
set -f
|
||
|
mkdir $1
|
||
|
cp -r $fx $1
|
||
|
zip -r $1.zip $1
|
||
|
rm -rf $1
|
||
|
}}
|
||
|
|
||
|
# zoxide
|
||
|
cmd cd %{{
|
||
|
result="$(zoxide query --exclude $PWD $@ | sed 's/\\/\\\\/g;s/"/\\"/g')"
|
||
|
lf -remote "send $id cd \"$result\""
|
||
|
}}
|
||
|
|
||
|
cmd cdi ${{
|
||
|
result="$(zoxide query -i | sed 's/\\/\\\\/g;s/"/\\"/g')"
|
||
|
lf -remote "send $id cd \"$result\""
|
||
|
}}
|
||
|
|
||
|
cmd on-cd &{{
|
||
|
zoxide add "$PWD"
|
||
|
}}
|
||
|
|