feat: Org-roam

- Sets some basic keybinds.
- Sets up a temporary Syncthing config on the Nix end.
  - This ought to be replaced with a nicer system at some point.
This commit is contained in:
Madeleine Sydney
2025-02-13 14:17:16 -07:00
parent e1709b2969
commit 273d4995a7
6 changed files with 95 additions and 14 deletions

View File

@@ -179,6 +179,22 @@ sydnix-cli is a command-line utility written in Clojure wrapping various sydnix-
** Emacs from scratch
*** TODO Completions w/ [[https://github.com/minad/corfu][Corfu]]
*** TODO Overlay org-mode links with the domain name
For some websites, abbreviations are welcome. e.g. a link to Wikipedia could appear as
Article^W
(where the «^W» is a superscript W)
*** TODO [[https://github.com/awth13/org-appear][Hide Org-mode markup only when not editing]]
*** TODO [[https://github.com/io12/org-fragtog][Preview LaTeX fragments in Org-mode when not editing]]
*** TODO Show jj commit name in modeline
*** TODO Block escaping with ~jk~ whilst recording a macro
*** TODO Many editing commands should re-indent after use
@@ -476,6 +492,10 @@ read-only buffers.
** TODO Securely store credentials for glab/gh CLIs
** TODO Syncthing module shouldn't expose ~devices~
Define ~services.syncthing.settings.devices~ as constant. Folders can still list devices by name, but not ID.
** TODO Dotfiles
- [[https://rgoulter.com/blog/posts/programming/2022-02-20-using-home-manager-to-manage-symlinks-to-dotfiles.html][link]]

View File

@@ -1,5 +1,7 @@
{ config, lib, pkgs, ... }:
# TODO: This is a Deertopia module. Move to nixos/deertopia/syncthing.nix.
let cfg = config.sydnix.syncthing;
in {
options = {

View File

@@ -2,9 +2,6 @@
let mutableSymlink = config.lib.file.mkOutOfStoreSymlink;
in {
home.file."org".source =
mutableSymlink "~/Dropbox/org";
# TODO: Move to programs/age.nix.
xdg.configFile."sops/age/keys.txt".source =
mutableSymlink "/persist/vault/${config.home.username}/keys/melbourne";
@@ -17,6 +14,7 @@ in {
"Documents"
"Videos"
"src"
"org"
".ssh"
{
directory = ".local/share/Steam";
@@ -26,4 +24,23 @@ in {
];
};
# TODO: sydnix.syncthing module
services.syncthing = {
enable = true;
settings = {
overrideDevices = true;
overrideFolders = true;
devices = {
"guix-rebound".id =
"Q5B6LIV-5HQMWWV-XFQL5IT-PHP7PVE-XFWUVHK-F6WJ42C-OPMR4M7-GFNK3AG";
};
folders = {
"org" = {
path = "~/org";
devices = [ "guix-rebound" ];
ignorePerms = true;
};
};
};
};
}

View File

@@ -86,6 +86,9 @@
"F" #'describe-face
"'" #'describe-char)
(general-def
:prefix-map 'syd-leader-notes-map)
(general-def
:keymaps '(evil-ex-completion-map minibuffer-local-map minibuffer-mode-map
read--expression-map)
@@ -123,7 +126,8 @@
"w" `("Window" . ,syd-leader-window-map)
"f" `("File" . ,syd-leader-file-map)
"s" `("Search" . ,syd-leader-search-map)
"h" `("Help" . ,help-map)))
"h" `("Help" . ,help-map)
"n" `("Notes" . ,syd-leader-notes-map)))
(syd-keybinds-initialise)

View File

@@ -28,17 +28,16 @@
(get-current-persp)
nil)))))
(defun syd-org--restart-mode-before-indirect-buffer-a (&optional buffer _)
(syd-defadvice syd-org--restart-mode-before-indirect-buffer-a (&optional buffer _)
"Restart `org-mode' in buffers in which the mode has been deferred (see
`syd-org-defer-mode-in-agenda-buffers-h') before they become the base buffer for an
indirect org-cpature buffer. This ensures that the buffer is fully functional
not only when the *user* visits it, but also when org-capture interacts with it
via an indirect buffer."
:before #'org-capture-get-indirect-buffer
(with-current-buffer (or buffer (current-buffer))
(when (memq #'syd-org--restart-mode-h on-switch-buffer-hook)
(syd-org--restart-mode-h))))
(advice-add #'org-capture-get-indirect-buffer
:before #'syd-org--restart-mode-before-indirect-buffer-a)
(defvar recentf-exclude)
@@ -100,7 +99,6 @@ See https://lists.gnu.org/archive/html/emacs-orgmode/2019-07/msg00081.html."
:major-modes t
:prefix syd-localleader-key
:non-normal-prefix syd-alt-localleader-key
"m" `("Org-roam" . ,org-roam-mode-map)
"." #'consult-org-heading
"/" #'consult-org-agenda
"@" #'org-cite-insert
@@ -118,7 +116,12 @@ See https://lists.gnu.org/archive/html/emacs-orgmode/2019-07/msg00081.html."
org-list org-pcomplete org-src org-footnote org-macro ob org org-agenda
org-capture
:custom ((org-startup-folded 'content)
(org-directory "~/org"))
(org-directory "~/org")
;; Stay out of my config dir!
(org-id-locations-file (file-name-concat syd-cache-dir
"org-id-locations"))
;; New headings should be inserted /after/ the heading's contents.
(org-insert-heading-respect-content t))
:preface
;; Speed up initialisation by disabling modules we don't need.
(defvar org-modules
@@ -140,8 +143,25 @@ See https://lists.gnu.org/archive/html/emacs-orgmode/2019-07/msg00081.html."
(syd-org-init-faces)
(syd-org-init-keybinds))
;; Unlike those appearing in `syd-org--init-roam-keybinds', these should be
;; available even outside of Org-mode.
(general-def
:prefix-map 'syd-leader-notes-roam-map
"f" #'org-roam-node-find)
(defun syd-org--init-roam-keybinds ()
)
(general-def
:prefix-map 'syd-org-roam-mode-map)
(general-def
:prefix-map 'syd-leader-notes-map
"r" `("Org-roam" . ,syd-leader-notes-roam-map))
(general-define-key
:keymaps 'org-mode-map
:states '(normal visual motion emacs insert)
:major-modes t
:prefix syd-localleader-key
:non-normal-prefix syd-alt-localleader-key
"m" `("Org-roam" . ,syd-org-roam-mode-map)))
(use-package org-roam
:hook (org-load . syd-org-init-roam-h)
@@ -177,5 +197,25 @@ In case of failure, fail gracefully."
(advice-remove 'org-roam-db-query #'syd-org-roam-try-init-db-a)
(org-roam-db-sync)))
(use-package evil-org
:hook ((org-mode . evil-org-mode)
(org-capture-mode . evil-insert-state)
(doom-docs-org-mode . evil-org-mode))
:init
(defvar evil-org-retain-visual-state-on-shift t)
(defvar evil-org-special-o/O '(table-row))
(defvar evil-org-use-additional-insert t))
;; (use-package evil-org-agenda
;; :hook (org-agenda-mode . evil-org-agenda-mode)
;; :config
;; (evil-org-agenda-set-keys)
;; ;; Stay away from my leader key!
;; (evil-define-key* 'motion evil-org-agenda-mode-map
;; (kbd syd-leader-key) nil))
(use-package hide-mode-line
:hook (org-mode-hook . hide-mode-line-mode))
(provide 'syd-org)
;;; syd-org.el ends here

View File

@@ -1,2 +0,0 @@
;;; -*- lisp-data -*-
(("/persist/dots/"))