Add fish functions

This commit is contained in:
BuyMyMojo 2025-03-24 04:34:15 +11:00
parent b2a8f9857a
commit 46e6a2d46a
Signed by untrusted user who does not match committer: aria
GPG key ID: 19AB7AA462B8AB3B
9 changed files with 65 additions and 0 deletions

View file

@ -0,0 +1,3 @@
function compress_blueray_anime --description 'Compress an input video file using the values I tested for my Ghost in the Shell blueray files';
ab-av1 encode --input $argv[1] --keyint 240 --scd false --svt film-grain=4 --svt tune=3 --svt smc=0 --preset 4 --crf 14
end

View file

@ -0,0 +1,4 @@
function fetch --wraps='nix-shell -p hyfetch -p fastfetch --run hyfetch' --description 'alias fetch=nix-shell -p hyfetch -p fastfetch --run hyfetch'
nix-shell -p hyfetch -p fastfetch --run hyfetch $argv
end

View file

@ -0,0 +1,7 @@
set -l nix_shell_info (
if test -n "$IN_NIX_SHELL"
echo -n "<nix-shell> "
end
)
echo -n -s "$nix_shell_info ~>"

View file

@ -0,0 +1,32 @@
function fish_right_prompt
set -g __fish_git_prompt_showdirtystate 1
set -g __fish_git_prompt_showuntrackedfiles 1
set -g __fish_git_prompt_showupstream informative
set -g __fish_git_prompt_showcolorhints 1
set -g __fish_git_prompt_use_informative_chars 1
# Unfortunately this only works if we have a sensible locale
string match -qi "*.utf-8" -- $LANG $LC_CTYPE $LC_ALL
and set -g __fish_git_prompt_char_dirtystate \U1F4a9
set -g __fish_git_prompt_char_untrackedfiles "?"
# The git prompt's default format is ' (%s)'.
# We don't want the leading space.
set -l vcs (fish_vcs_prompt '(%s)' 2>/dev/null)
set -l d (set_color brgrey)(date "+%R")(set_color normal)
set -l duration "$cmd_duration$CMD_DURATION"
if test $duration -gt 100
set duration (math $duration / 1000)s
else
set duration
end
set -q VIRTUAL_ENV_DISABLE_PROMPT
or set -g VIRTUAL_ENV_DISABLE_PROMPT true
set -q VIRTUAL_ENV
and set -l venv (string replace -r '.*/' '' -- "$VIRTUAL_ENV")
set_color normal
string join " " -- $venv $duration $vcs $d
end

View file

@ -0,0 +1,4 @@
function jpegopfolder --wraps='find . \\( -iname "*.jpg" -o -iname "*.jpeg" \\) | jpegoptim -p -P --files-stdin -w $(nproc --all)' --description 'alias jpegopfolder find . \\( -iname "*.jpg" -o -iname "*.jpeg" \\) | jpegoptim -p -P --files-stdin -w $(nproc --all)'
find . \( -iname "*.jpg" -o -iname "*.jpeg" \) | jpegoptim -p -P --files-stdin -w $(nproc --all) $argv
end

View file

@ -0,0 +1,4 @@
function oxipng-new --wraps='find . -type f -newermt $(date +%m/%d/%Y) -print0 | xargs -0 oxipng -o max -p' --description 'alias oxipng-new find . -type f -newermt $(date +%m/%d/%Y) -print0 | xargs -0 oxipng -o max -p'
find . -type f -newermt $(date +%m/%d/%Y) -print0 | xargs -0 oxipng -o max -p $argv
end

View file

@ -0,0 +1,3 @@
function render_html --description 'gets content of provided file and renders as if it were html';
cat $argv[1] | lynx --stdin;
end

View file

@ -0,0 +1,4 @@
function save-disk --wraps='dd if=/dev/sr0 | pv -pteabW -s $(lsblk -b --output SIZE -n -d /dev/sr0) | cat >' --description 'alias save-disk=dd if=/dev/sr0 | pv -pteabW -s $(lsblk -b --output SIZE -n -d /dev/sr0) | cat >'
dd if=/dev/sr0 | pv -pteabW -s $(lsblk -b --output SIZE -n -d /dev/sr0) | cat > $argv
end

View file

@ -0,0 +1,4 @@
function yt-dlp-archive --wraps='yt-dlp --write-info-json --write-description --write-thumbnail --write-sub --sub-langs all --output "videos/%(uploader).200B (%(channel_id)s)/%(upload_date)s - %(title).200B - %(id)s.%(ext)s" --cookies-from-browser firefox --format bestvideo+bestaudio/best' --description 'alias yt-dlp-archive=yt-dlp --write-info-json --write-description --write-thumbnail --write-sub --sub-langs all --output "videos/%(uploader).200B (%(channel_id)s)/%(upload_date)s - %(title).200B - %(id)s.%(ext)s" --cookies-from-browser firefox --format bestvideo+bestaudio/best'
yt-dlp --write-info-json --write-description --write-thumbnail --write-sub --sub-langs all --output "%(uploader).200B (%(channel_id)s)/%(upload_date)s - %(title).200B - %(id)s.%(ext)s" --cookies-from-browser firefox --format bestvideo+bestaudio/best $argv
end