{ config, pkgs, ... }: { 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:#ffffff,bg:#0d0e1c,hl:#ef8386 --color=fg+:#ffffff,bg+:#1d2235,hl+:#ef8386 --color=border:#61647a,header:#88ca9f,gutter:#0d0e1c --color=spinner:#fec43f,info:#00bcff --color=pointer:#feacd0,marker:#ff5f59,prompt:#9ac8e0" command fzf ''; vterm_printf = '' printf "\e]%s\e\\" "$argv" ''; nn = '' # Require a title argument if test (count $argv) -lt 1 echo "Usage: nn \"My Note\"" return 1 end # Join all arguments into single title (preserves spaces inside quotes) set -l title $argv[1] # Timestamp up to minutes, format: YYYY-MM-DD_HH-MM set -l ts (date "+%Y%m%d%H%M") # Normalize title: lowercase, replace spaces with hyphens, remove/replace # characters unsafe for filenames (keep a-z0-9- and replace others with -) set -l slug (string lower -- $title) # Replace any sequence of non-alphanumeric characters with single hyphen set -l slug (echo $slug | sed -E 's/[^a-z0-9]+/-/g' | sed -E 's/^-|-$//g') # Compose filename set -l filename "$ts"_"$slug.md" # Directory for notes (change if you prefer another path) set -l notes_dir ~/notes # Ensure directory exists test -d $notes_dir; or mkdir -p $notes_dir # Full path set -l fullpath "$notes_dir/$filename" # If file doesn't exist, create with timestamp and title at top if not test -f $fullpath # Human-friendly timestamp line (no seconds) set -l display_ts (date "+%Y-%m-%d %H:%M") printf "---\nCREATED_AT: %s\n---\n\n# %s\n\n" "$display_ts" "$title" > $fullpath end # Open file in neovim nvim $fullpath ''; }; interactiveShellInit = '' set hn (prompt_hostname) set fish_cursor_default block blink set -x GPG_TTY (tty) 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 = "nvim +Neogit"; gg = "nvim +Neogit"; g = "git"; frc = "source ~/.config/fish/**/*.fish"; }; }; }