diff --git a/files/fish/functions/functions.fish b/files/fish/functions/functions.fish index 737b21e..0a0ac9e 100644 --- a/files/fish/functions/functions.fish +++ b/files/fish/functions/functions.fish @@ -5,3 +5,27 @@ end function bookmarks $EDITOR (string replace ':' '~/resources/bookmarks/' $argv[1]) end + +function xdg-base-directory + function aux + fenv "source ~/.config/user-dirs.dirs; echo $argv[1]" 2>/dev/null + end + switch (string replace '@' '' $argv[1]) + case "desktop" + aux '$XDG_DESKTOP_DIR' + case "documents" + aux '$XDG_DOCUMENTS_DIR' + case "downloads" + aux '$XDG_DOWNLOAD_DIR' + case "music" + aux '$XDG_MUSIC_DIR' + case "pictures" + aux '$XDG_PICTURES_DIR' + case "public" + aux '$XDG_PUBLICSHARE_DIR' + case "templates" + aux '$XDG_TEMPLATES_DIR' + case "videos" + aux '$XDG_VIDEOS_DIR' + end +end diff --git a/radio.scm b/radio.scm index 25dd8f0..4047a5a 100644 --- a/radio.scm +++ b/radio.scm @@ -227,13 +227,29 @@ #|Kakoune aliases for the shell|# ("':e'" . "kak") ("':q'" . "exit"))) + (environment-variables + `(("fish_function_path" + . (format #f "$fish_function_path~@{ ~a/functions~}" + "$HOME/.guix-home/profile/share/fish" + "$HOME/.config/fish/functions")))) (abbreviations (let ((code-projects "~/projects/code") (code-project-extensions '(c clj cpp el html kak md org pl py scm sh tex zig)) (bookmarks - '(emacs guile guix haunt misc))) + '(emacs guile guix haunt misc)) + (xdg-user-directories + '(desktop documents downloads + music pictures public templates))) (list #|Quick access|# + (abbreviation + (name "@xdg-base-dir") + (position 'anywhere) + (pattern + (apply format #f "@(~a~@{|~a~})" + xdg-user-directories)) + (expansion + (fish-function "xdg-base-directory"))) (abbreviation (name "@extension") (position 'anywhere)