HASH dfd4dca67ef3
DATE 2025-04-04
SUBJECT fish: add basic notes function
FILES 2 CHANGED
HASH dfd4dca67ef3
DATE 2025-04-04
SUBJECT fish: add basic notes function
FILES 2 CHANGED
┌─ modules/home/console/shell/fish/functions/default.nix ────────────────────┐
│ diff --git a/modules/home/console/shell/fish/functions/default.nix b/modules/home/ │
│ console/shell/fish/functions/default.nix │
│ index 66e5447..87fd360 100644 │
│ --- a/modules/home/console/shell/fish/functions/default.nix │
│ +++ b/modules/home/console/shell/fish/functions/default.nix │
│ @@ -1,5 +1,6 @@ │
│ { │
│ imports = [ │
│ ./develop.nix │
│ + ./notes.nix │
│ ]; │
│ } │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ ...ll/fish/functions/default.nix ───┐
│ diff --git a/modules/home/console/shell/fish │
│ /functions/default.nix b/modules/home/consol │
│ e/shell/fish/functions/default.nix │
│ index 66e5447..87fd360 100644 │
│ --- a/modules/home/console/shell/fish/functi │
│ ons/default.nix │
│ +++ b/modules/home/console/shell/fish/functi │
│ ons/default.nix │
│ @@ -1,5 +1,6 @@ │
│ { │
│ imports = [ │
│ ./develop.nix │
│ + ./notes.nix │
│ ]; │
│ } │
└──────────────────────────────────────────────┘
┌─ modules/home/console/shell/fish/functions/notes.nix ──────────────────────┐
│ diff --git a/modules/home/console/shell/fish/functions/notes.nix b/modules/home/co │
│ nsole/shell/fish/functions/notes.nix │
│ new file mode 100644 │
│ index 0000000..2eb2305 │
│ --- /dev/null │
│ +++ b/modules/home/console/shell/fish/functions/notes.nix │
│ @@ -0,0 +1,43 @@ │
│ +let │
│ + subcommands = "not __fish_seen_subcommand_from search s daily d backup b"; │
│ +in { │
│ + programs.fish = { │
│ + interactiveShellInit = │
│ + #fish │
│ + '' │
│ + complete -c notes -e │
│ + complete -c notes -f │
│ + complete -c notes -n "${subcommands}" -a "search" -d "Open Neovim with Ob │
│ sidian quick switcher" │
│ + complete -c notes -n "${subcommands}" -a "daily" -d "Open todays daily no │
│ te" │
│ + complete -c notes -n "${subcommands}" -a "backup" -d "Push changes to rem │
│ ote" │
│ + │
│ + complete -c notes -n "__fish_seen_subcommand_from open o" -a "(ls $XDG_NO │
│ TES_DIR/**.md | fzf)" │
│ + ''; │
│ + functions.notes = { │
│ + description = "Access my notes repository"; │
│ + body = │
│ + #fish │
│ + '' │
│ + if test (count $argv) -gt 0 │
│ + switch $argv[1] │
│ + case search s │
│ + cd $XDG_NOTES_DIR │
│ + nvim -c 'ObsidianQuickSwitch' │
│ + case d daily │
│ + cd $XDG_NOTES_DIR │
│ + nvim -c 'ObsidianToday' │
│ + case b backup │
│ + cd $XDG_NOTES_DIR │
│ + git add . │
│ + git commit -m "$(date)" │
│ + git push │
│ + case '*' │
│ + echo "Unknown subcommand: $argv[1]" │
│ + end │
│ + else │
│ + cd $XDG_NOTES_DIR │
│ + end │
│ + ''; │
│ + }; │
│ + }; │
│ +} │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ ...hell/fish/functions/notes.nix ───┐
│ diff --git a/modules/home/console/shell/fish │
│ /functions/notes.nix b/modules/home/console/ │
│ shell/fish/functions/notes.nix │
│ new file mode 100644 │
│ index 0000000..2eb2305 │
│ --- /dev/null │
│ +++ b/modules/home/console/shell/fish/functi │
│ ons/notes.nix │
│ @@ -0,0 +1,43 @@ │
│ +let │
│ + subcommands = "not __fish_seen_subcommand │
│ _from search s daily d backup b"; │
│ +in { │
│ + programs.fish = { │
│ + interactiveShellInit = │
│ + #fish │
│ + '' │
│ + complete -c notes -e │
│ + complete -c notes -f │
│ + complete -c notes -n "${subcommands │
│ }" -a "search" -d "Open Neovim with Obsidian │
│ quick switcher" │
│ + complete -c notes -n "${subcommands │
│ }" -a "daily" -d "Open todays daily note" │
│ + complete -c notes -n "${subcommands │
│ }" -a "backup" -d "Push changes to remote" │
│ + │
│ + complete -c notes -n "__fish_seen_s │
│ ubcommand_from open o" -a "(ls $XDG_NOTES_DI │
│ R/**.md | fzf)" │
│ + ''; │
│ + functions.notes = { │
│ + description = "Access my notes reposi │
│ tory"; │
│ + body = │
│ + #fish │
│ + '' │
│ + if test (count $argv) -gt 0 │
│ + switch $argv[1] │
│ + case search s │
│ + cd $XDG_NOTES_DIR │
│ + nvim -c 'ObsidianQuickSwitc │
│ h' │
│ + case d daily │
│ + cd $XDG_NOTES_DIR │
│ + nvim -c 'ObsidianToday' │
│ + case b backup │
│ + cd $XDG_NOTES_DIR │
│ + git add . │
│ + git commit -m "$(date)" │
│ + git push │
│ + case '*' │
│ + echo "Unknown subcommand: $ │
│ argv[1]" │
│ + end │
│ + else │
│ + cd $XDG_NOTES_DIR │
│ + end │
│ + ''; │
│ + }; │
│ + }; │
│ +} │
└──────────────────────────────────────────────┘
[ BACK TO LOG ]
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET