refactor: Separate file modules by purpose
parent
8b8c66adbf
commit
5a3632d739
|
@ -1,35 +1,6 @@
|
|||
function code-projects
|
||||
string replace '@' '~/projects/code/' $argv[1]
|
||||
end
|
||||
|
||||
function git-root
|
||||
set -l result (git root 2>/dev/null) && \
|
||||
echo $result || echo ""
|
||||
end
|
||||
|
||||
function bookmarks
|
||||
$EDITOR (string replace ':' '~/resources/bookmarks/' $argv[1])
|
||||
end
|
||||
|
||||
function xdg-user-directory
|
||||
switch (string replace '@' '' $argv[1])
|
||||
case "desktop"
|
||||
echo $XDG_DESKTOP_DIR
|
||||
case "documents"
|
||||
echo $XDG_DOCUMENTS_DIR
|
||||
case "downloads"
|
||||
echo $XDG_DOWNLOAD_DIR
|
||||
case "music"
|
||||
echo $XDG_MUSIC_DIR
|
||||
case "pictures"
|
||||
echo $XDG_PICTURES_DIR
|
||||
case "public"
|
||||
echo $XDG_PUBLICSHARE_DIR
|
||||
case "templates"
|
||||
echo $XDG_TEMPLATES_DIR
|
||||
case "videos"
|
||||
echo $XDG_VIDEOS_DIR
|
||||
end
|
||||
string replace '@' '' \
|
||||
(string join '' '$XDG_' (string upper $argv[1]) '_DIR')
|
||||
end
|
||||
|
||||
function bang-bang
|
||||
|
@ -51,11 +22,3 @@ function bang-star
|
|||
set -l arr (string replace -ra '([^\\\ ])( |\n)+' '$1\n' $history[1])
|
||||
echo $arr[..-2]
|
||||
end
|
||||
|
||||
function edit-home
|
||||
echo "~/projects/code/scm/radix/ && $EDITOR home-environments/$(whoami).scm"
|
||||
end
|
||||
|
||||
function edit-system
|
||||
echo "~/projects/code/scm/radix/ && $EDITOR operating-systems/$(hostname).scm"
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(define-module (radix home-environments radio)
|
||||
(define-module (home-environments radio)
|
||||
#|GNU|#
|
||||
#:use-module (gnu)
|
||||
#:use-module ((gnu home) #:select (this-home-environment))
|
||||
|
@ -37,7 +37,7 @@
|
|||
#:use-module (gnu packages suckless)
|
||||
#|T|# #:use-module (gnu packages telegram)
|
||||
#:use-module (gnu packages text-editors)
|
||||
#:use-module (gnu packages tor)
|
||||
#:use-module (gnu packages tor-browsers)
|
||||
#:use-module (gnu packages toys)
|
||||
#|V|# #:use-module (gnu packages version-control)
|
||||
#:use-module (gnu packages video)
|
||||
|
@ -72,16 +72,20 @@
|
|||
#|X|# #:use-module (radix home services xdg)
|
||||
#|Z|# #:use-module (radix home services zathura)
|
||||
|
||||
#|Radix files|#
|
||||
#|A|# #:use-module ((radix files awesome) #:prefix file:awesome-)
|
||||
#|E|# #:use-module ((radix files emacs) #:prefix file:emacs-)
|
||||
#|F|# #:use-module ((radix files fish) #:prefix file:fish-)
|
||||
#|G|# #:use-module ((radix files git) #:prefix file:git-)
|
||||
#|I|# #:use-module ((radix files info) #:prefix file:info-)
|
||||
#|K|# #:use-module ((radix files kakoune) #:prefix file:kak-)
|
||||
#|L|# #:use-module ((radix files lf) #:prefix file:lf-)
|
||||
#|M|# #:use-module ((radix files mpv) #:prefix file:mpv-)
|
||||
#|N|# #:use-module ((radix files newsraft) #:prefix file:newsraft-)
|
||||
#|Radio|#
|
||||
#|S|# #:use-module ((radio fish-abbreviations) #:prefix fish-abbreviations:)
|
||||
|
||||
#|Radio files|#
|
||||
#|A|# #:use-module ((radio files awesome) #:prefix file:awesome-)
|
||||
#|E|# #:use-module ((radio files emacs) #:prefix file:emacs-)
|
||||
#|F|# #:use-module ((radio files fish) #:prefix file:fish-)
|
||||
#|G|# #:use-module ((radio files git) #:prefix file:git-)
|
||||
#|I|# #:use-module ((radio files info) #:prefix file:info-)
|
||||
#|K|# #:use-module ((radio files kakoune) #:prefix file:kak-)
|
||||
#|L|# #:use-module ((radio files lf) #:prefix file:lf-)
|
||||
#|M|# #:use-module ((radio files mpv) #:prefix file:mpv-)
|
||||
#|N|# #:use-module ((radio files newsraft) #:prefix file:newsraft-)
|
||||
|
||||
|
||||
#:export (home-environment))
|
||||
|
||||
|
@ -278,172 +282,15 @@
|
|||
("':e'" . "kak")
|
||||
("':q'" . "exit")))
|
||||
(abbreviations
|
||||
(let ((code-projects "~/projects/code")
|
||||
(code-project-extensions
|
||||
'(c clj cpp el html kak md org pl py scm sh tex zig))
|
||||
(xdg-user-directories
|
||||
'(desktop documents downloads music
|
||||
pictures public templates videos))
|
||||
(bookmarks
|
||||
'(emacs guile guix haunt misc)))
|
||||
(list #|Quick access|#
|
||||
(abbreviation
|
||||
(name "@user-dirs")
|
||||
(position 'anywhere)
|
||||
(pattern
|
||||
(apply format #f "@(~a~@{|~a~})"
|
||||
xdg-user-directories))
|
||||
(expansion (fish-function "xdg-user-directory")))
|
||||
(abbreviation
|
||||
(name "@extension")
|
||||
(position 'anywhere)
|
||||
(pattern
|
||||
(apply format #f "@(~a~@{|~a~})"
|
||||
code-project-extensions))
|
||||
(expansion
|
||||
(fish-function "code-projects")))
|
||||
(abbreviation
|
||||
(name "@punk")
|
||||
(position 'anywhere)
|
||||
(expansion
|
||||
(format #f "~a/cpp/punk"
|
||||
code-projects)))
|
||||
(abbreviation
|
||||
(name "@guix")
|
||||
(position 'anywhere)
|
||||
(expansion
|
||||
(format #f "~a/scm/guix"
|
||||
code-projects)))
|
||||
(abbreviation
|
||||
(name "@radix")
|
||||
(position 'anywhere)
|
||||
(expansion
|
||||
(format #f "~a/scm/radix"
|
||||
code-projects)))
|
||||
(abbreviation
|
||||
(name "@files")
|
||||
(position 'anywhere)
|
||||
(expansion
|
||||
(format #f "~a/scm/radix/files"
|
||||
code-projects)))
|
||||
(abbreviation
|
||||
(name "@modules")
|
||||
(position 'anywhere)
|
||||
(expansion
|
||||
(format #f "~a/scm/radix/modules/radix"
|
||||
code-projects)))
|
||||
(abbreviation
|
||||
(name "@research")
|
||||
(position 'anywhere)
|
||||
(expansion "~/areas/research"))
|
||||
(abbreviation
|
||||
(name "@bookmarks")
|
||||
(position 'anywhere)
|
||||
(expansion "~/resources/bookmarks"))
|
||||
(abbreviation
|
||||
(name "@git-root")
|
||||
(pattern "@git-root")
|
||||
(position 'anywhere)
|
||||
(expansion
|
||||
(fish-function "git-root")))
|
||||
|
||||
#|Quick edit|#
|
||||
(abbreviation
|
||||
(name ":e")
|
||||
(expansion "$EDITOR"))
|
||||
(abbreviation
|
||||
(name ":system")
|
||||
(expansion
|
||||
(fish-function "edit-system")))
|
||||
(abbreviation
|
||||
(name ":home")
|
||||
(expansion
|
||||
(fish-function "edit-home")))
|
||||
(abbreviation
|
||||
(name ":todo")
|
||||
(expansion "~/areas/organization/todo"))
|
||||
(abbreviation
|
||||
(name ":bookmark")
|
||||
(position 'anywhere)
|
||||
(pattern
|
||||
(apply format #f ":(~a~@{|~a~})" bookmarks))
|
||||
(expansion
|
||||
(fish-function "bookmarks")))
|
||||
|
||||
#|Media downloading|#
|
||||
(abbreviation
|
||||
(name "i")
|
||||
(expansion "ipfs get %"))
|
||||
(abbreviation
|
||||
(name "d")
|
||||
(expansion "aria2c -j 10 '%'"))
|
||||
(abbreviation
|
||||
(name "m")
|
||||
(expansion
|
||||
(format #f "yt-dlp --prefer-free-formats ~
|
||||
--extract-audio '%'")))
|
||||
(abbreviation
|
||||
(name "v")
|
||||
(expansion
|
||||
"yt-dlp --prefer-free-formats '%'"))
|
||||
|
||||
#|Command history reuse|#
|
||||
(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")))
|
||||
|
||||
#|Guix reconfiguration|#
|
||||
(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"))
|
||||
|
||||
#|Utils|#
|
||||
(abbreviation
|
||||
(name "zedit")
|
||||
(expansion "zcat % | $EDITOR"))
|
||||
(abbreviation
|
||||
(name "tf")
|
||||
(position 'anywhere)
|
||||
(expansion
|
||||
"setsid -f %>/dev/null 2>&1 & disown"))
|
||||
(abbreviation
|
||||
(name "zxz")
|
||||
(expansion
|
||||
"curl -F file=@% https://0x0.st | xsel -b")))))))
|
||||
`(,@fish-abbreviations:user-dirs
|
||||
,@fish-abbreviations:extensions
|
||||
,@fish-abbreviations:channels
|
||||
,@fish-abbreviations:quick-edit
|
||||
,@fish-abbreviations:bookmarks
|
||||
,@fish-abbreviations:history
|
||||
,@fish-abbreviations:guix
|
||||
,@fish-abbreviations:terminal-emulators
|
||||
,@fish-abbreviations:download/upload))))
|
||||
|
||||
(simple-service 'environment-variables-service
|
||||
home-environment-variables-service-type
|
||||
|
@ -457,8 +304,9 @@
|
|||
("GUILE_WARN_DEPRECATED" . "detailed")
|
||||
("GUILE_HISTORY" . "$XDG_CACHE_HOME/guile/history")
|
||||
("GUILE_LOAD_PATH"
|
||||
. ,(format #f "~a:~a~@{:~a/share/guile/site/3.0~}"
|
||||
. ,(format #f "~a:~a:~a~@{:~a/share/guile/site/3.0~}"
|
||||
"$HOME/areas/code/scm"
|
||||
"$HOME/areas/code/scm/ajatt"
|
||||
"$HOME/areas/code/scm/radix/modules"
|
||||
"$HOME/.guix-home/profile"
|
||||
"$XDG_CONFIG_HOME/guix/current"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(define-module (radix files awesome)
|
||||
(define-module (radio files awesome)
|
||||
#:use-module (gnu)
|
||||
#:export (config theme))
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
(define-module (radix files doas)
|
||||
(define-module (radio files doas)
|
||||
#:use-module (gnu)
|
||||
#:export (completion))
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
(define-module (radix files emacs)
|
||||
(define-module (radio files emacs)
|
||||
#:use-module (gnu)
|
||||
#:export (init theme))
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
(define-module (radix files fish)
|
||||
(define-module (radio files fish)
|
||||
#:use-module (gnu)
|
||||
#:export (functions
|
||||
custom-functions
|
||||
|
@ -9,7 +9,8 @@
|
|||
#:recursive? #t))
|
||||
|
||||
(define custom-functions
|
||||
(local-file "../../../files/fish/functions/fish_custom_functions.fish"))
|
||||
(local-file
|
||||
"../../../files/fish/functions/fish_custom_functions.fish"))
|
||||
|
||||
(define config
|
||||
(local-file "../../../files/fish/conf.d"
|
|
@ -1,4 +1,4 @@
|
|||
(define-module (radix files git)
|
||||
(define-module (radio files git)
|
||||
#:use-module (gnu)
|
||||
#:export (config))
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
(define-module (radix files info)
|
||||
(define-module (radio files info)
|
||||
#:use-module (gnu)
|
||||
#:export (config))
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
(define-module (radix files kakoune)
|
||||
(define-module (radio files kakoune)
|
||||
#:use-module (gnu)
|
||||
#:export (config colorscheme))
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
(define-module (radix files lf)
|
||||
(define-module (radio files lf)
|
||||
#:use-module (gnu)
|
||||
#:export (config))
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
(define-module (radix files mpv)
|
||||
(define-module (radio files mpv)
|
||||
#:use-module (gnu)
|
||||
#:export (config))
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
(define-module (radix files newsraft)
|
||||
(define-module (radio files newsraft)
|
||||
#:use-module (gnu)
|
||||
#:export (config))
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
(define-module (radix files zathura)
|
||||
(define-module (radio files zathura)
|
||||
#:use-module (gnu)
|
||||
#:export (config))
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
(define-module (radio fish-abbreviations)
|
||||
#:use-module (ice-9 curried-definitions)
|
||||
#:use-module (radix home services shells)
|
||||
#:export (user-dirs
|
||||
extensions
|
||||
channels
|
||||
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 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"))))
|
|
@ -1,4 +1,4 @@
|
|||
(define-module (radix operating-systems buer)
|
||||
(define-module (operating-systems buer)
|
||||
#|GNU|#
|
||||
#:use-module (gnu)
|
||||
#:use-module ((gnu system) #:select (operating-system)
|
||||
|
@ -52,9 +52,9 @@
|
|||
#|Radix system|#
|
||||
#|S|# #:use-module (radix system setuid)
|
||||
|
||||
#|Radix files|#
|
||||
#|S|# #:use-module ((radix files substitute-keys) #:prefix public-key:)
|
||||
#|T|# #:use-module ((radix files thinkfan) #:prefix file:thinkfan-)
|
||||
#|Buer files|#
|
||||
#|S|# #:use-module ((buer files substitute-keys) #:prefix public-key:)
|
||||
#|T|# #:use-module ((buer files thinkfan) #:prefix file:thinkfan-)
|
||||
|
||||
#:export (operating-system))
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(define-module (radix files substitute-keys)
|
||||
(define-module (buer files substitute-keys)
|
||||
#:use-module (gnu)
|
||||
#:export (yuria))
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
(define-module (radix files thinkfan)
|
||||
(define-module (buer files thinkfan)
|
||||
#:use-module (gnu)
|
||||
#:export (config))
|
||||
|
Loading…
Reference in New Issue