chore: add fish abbreviations for xdg-user-dirs navigation

pull/1/head
anemofilia 2023-10-23 23:32:00 -03:00
parent 17c7c9b717
commit 212e19f1c7
No known key found for this signature in database
GPG Key ID: 1F2E76ACE3F531C8
2 changed files with 41 additions and 1 deletions

View File

@ -5,3 +5,27 @@ end
function bookmarks function bookmarks
$EDITOR (string replace ':' '~/resources/bookmarks/' $argv[1]) $EDITOR (string replace ':' '~/resources/bookmarks/' $argv[1])
end 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

View File

@ -227,13 +227,29 @@
#|Kakoune aliases for the shell|# #|Kakoune aliases for the shell|#
("':e'" . "kak") ("':e'" . "kak")
("':q'" . "exit"))) ("':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 (abbreviations
(let ((code-projects "~/projects/code") (let ((code-projects "~/projects/code")
(code-project-extensions (code-project-extensions
'(c clj cpp el html kak md org pl py scm sh tex zig)) '(c clj cpp el html kak md org pl py scm sh tex zig))
(bookmarks (bookmarks
'(emacs guile guix haunt misc))) '(emacs guile guix haunt misc))
(xdg-user-directories
'(desktop documents downloads
music pictures public templates)))
(list #|Quick access|# (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 (abbreviation
(name "@extension") (name "@extension")
(position 'anywhere) (position 'anywhere)