(define-module (radio fish-abbreviations) #:use-module (ice-9 curried-definitions) #:use-module (radix home services shells) #:export (user-dirs extensions channels config quick-edit bookmarks guix history terminal-emulators download/upload)) (define at (symbol-prefix-proc '@)) (define user-dirs (map (lambda (dir) (abbreviation (name (at dir)) (position 'anywhere) (expansion (fish-function "xdg-user-directories")))) '(desktop documents download music pictures publicshare templates videos))) (define extensions (map (lambda (extension) (abbreviation (name (at extension)) (position 'anywhere) (expansion ((symbol-prefix-proc '~/projects/code/) extension)))) '(c clj cpp el html kak md nasm org pl py scm sh tex zig))) (define channels (map (lambda (channel) (abbreviation (name (at channel)) (position 'anywhere) (expansion ((symbol-prefix-proc '~/projects/code/scm/) channel)))) '(ajatt guix radix))) (define (edit . files) (string-join (cons "$EDITOR" (map symbol->string files)))) (define quick-edit (list (abbreviation (name ':e) (expansion (edit))) (abbreviation (name ':system) (expansion (edit '/etc/config.scm))) (abbreviation (name ':home) (expansion (edit '~/.config/guix/home.scm))) (abbreviation (name ':todo) (expansion (edit '~/areas/organization/todo))))) (define bookmarks (map (lambda (bookmark) (abbreviation (name ((symbol-prefix-proc ':) bookmark)) (position 'anywhere) (expansion (edit ((symbol-prefix-proc '~/resources/bookmarks/) bookmark))))) '(emacs guile guix haunt misc))) (define history (list (abbreviation (name '!!) (position 'anywhere) (expansion (fish-function "bang-bang"))) (abbreviation (name '!!:k) (position 'anywhere) (pattern "!!:[0-9]+") (expansion (fish-function "bang-bang-k"))) (abbreviation (name '!$) (position 'anywhere) (expansion (fish-function "bang-dollar"))) (abbreviation (name '!*) (position 'anywhere) (expansion (fish-function "bang-star"))))) (define config (let* ((radix '~/areas/code/scm/radix/) (user (string->symbol (getlogin))) (os (string->symbol (gethostname)))) (list (abbreviation (name (at user)) (position 'anywhere) (expansion (format #f "~a/home-environments/~a" radix user))) (abbreviation (name (at os)) (position 'anywhere) (expansion (format #f "~a/operating-systems/~a" radix os)))))) (define guix (list (abbreviation (name '!dgen) (position 'anywhere) (expansion "guix % delete-generations 2w")) (abbreviation (name '!repair) (expansion "doas guix build --repair")) (abbreviation (name '!pull) (position 'anywhere) (expansion "guix pull")) (abbreviation (name '!home) (expansion "guix home reconfigure ~/.config/guix/home.scm")) (abbreviation (name '!system) (expansion "doas guix system reconfigure /etc/config.scm")))) (define terminal-emulators (list (abbreviation (name 'tf) (position 'anywhere) (expansion "setsid -f %>/dev/null 2>&1 & disown")))) (define download/upload (list (abbreviation (name 'a) (expansion "aria2c -j 10 '%'")) (abbreviation (name 'i) (expansion "ipfs get %")) (abbreviation (name 'm) (expansion "yt-dlp --prefer-free-formats --extract-audio '%'")) (abbreviation (name 'v) (expansion "yt-dlp --prefer-free-formats '%'")) (abbreviation (name 'z) (expansion "curl -F file=@% https://0x0.st | xsel -b"))))