121 lines
3.4 KiB
Nix
121 lines
3.4 KiB
Nix
{
|
|
programs.fish = {
|
|
enable = true;
|
|
|
|
functions = {
|
|
dbui = ''
|
|
nvim +"DBUI"
|
|
'';
|
|
ff = ''
|
|
bash ${./ff.bash}
|
|
'';
|
|
envsource = ''
|
|
for line in (cat $argv | grep -v '^#')
|
|
set item (string split -m 1 '=' $line)
|
|
set -gx $item[1] $item[2]
|
|
end
|
|
'';
|
|
fish_greeting = "fortune -a";
|
|
resize_images = ''
|
|
# Resize all JPG images in the current directory and its subdirectories
|
|
# Usage: resize_images [percentage]
|
|
# Example: resize_images 20 - resizes all images to 20% of original size
|
|
# If no percentage is provided, defaults to 40%
|
|
|
|
set -l percentage $argv[1]
|
|
if test -z "$percentage"
|
|
set percentage 40
|
|
end
|
|
|
|
for img in (find . -type f -name "*.JPG")
|
|
set original_size (stat -f %z "$img")
|
|
magick convert "$img" -resize "$percentage%" "$img"
|
|
set new_size (stat -f %z "$img")
|
|
echo "Processed $img"
|
|
echo "Original size: $original_size bytes"
|
|
echo "New size: $new_size bytes"
|
|
echo "---"
|
|
end
|
|
'';
|
|
localip = "ifconfig | grep \"inet \" | grep -v 127.0.0.1 | awk '{print $2}' | head -n 1";
|
|
publicip = "curl -4 ifconfig.me";
|
|
fzf = ''
|
|
set -Ux FZF_DEFAULT_OPTS "
|
|
--color=fg:#908caa,bg:#191724,hl:#ebbcba
|
|
--color=fg+:#e0def4,bg+:#26233a,hl+:#ebbcba
|
|
--color=border:#403d52,header:#31748f,gutter:#191724
|
|
--color=spinner:#f6c177,info:#9ccfd8
|
|
--color=pointer:#c4a7e7,marker:#eb6f92,prompt:#908caa"
|
|
|
|
command fzf
|
|
'';
|
|
vterm_printf = ''
|
|
printf "\e]%s\e\\" "$argv"
|
|
'';
|
|
setup_gpg = ''
|
|
set -x GPG_TTY (tty)
|
|
|
|
if not test -d $HOME/.gnupg
|
|
mkdir -p $HOME/.gnupg
|
|
chmod 700 $HOME/.gnupg
|
|
end
|
|
|
|
set pinentry_line "pinentry-program "(which pinentry-mac)
|
|
if test -f $HOME/.gnupg/gpg-agent.conf
|
|
if not grep -Fxq $pinentry_line $HOME/.gnupg/gpg-agent.conf
|
|
echo $pinentry_line >> $HOME/.gnupg/gpg-agent.conf
|
|
end
|
|
else
|
|
echo $pinentry_line > $HOME/.gnupg/gpg-agent.conf
|
|
end
|
|
|
|
if pgrep gpg-agent > /dev/null
|
|
killall gpg-agent
|
|
end
|
|
|
|
echo "gpg + pinentry-mac installed and configured."
|
|
'';
|
|
};
|
|
|
|
interactiveShellInit = ''
|
|
fish_config theme choose "Rosé Pine"
|
|
|
|
set hn (prompt_hostname)
|
|
set fish_cursor_default block blink
|
|
|
|
set -x GPG_TTY (tty)
|
|
|
|
if test "$INSIDE_EMACS" != "vterm"
|
|
set fish_cursor_insert line blink
|
|
set fish_cursor_replace_one underscore blink
|
|
set fish_cursor_visual block
|
|
set fish_vi_force_cursor 1
|
|
fish_vi_key_bindings
|
|
end
|
|
|
|
fish_add_path /run/current-system/sw/bin
|
|
fish_add_path /opt/homebrew/bin
|
|
|
|
envsource ~/.env
|
|
|
|
zoxide init fish | source
|
|
fnm env --use-on-cd --shell fish | source
|
|
|
|
if test -d (brew --prefix)"/share/fish/completions"
|
|
set -p fish_complete_path (brew --prefix)/share/fish/completions
|
|
end
|
|
|
|
if test -d (brew --prefix)"/share/fish/vendor_completions.d"
|
|
set -p fish_complete_path (brew --prefix)/share/fish/vendor_completions.d
|
|
end
|
|
'';
|
|
|
|
shellAbbrs = {
|
|
lg = "lazygit";
|
|
g = "git";
|
|
frc = "source ~/.config/fish/**/*.fish";
|
|
};
|
|
};
|
|
|
|
home.file.".config/fish/themes".source = ./themes;
|
|
}
|