feat(emacs): Set nix-mode syntax table

This commit is contained in:
Madeleine Sydney
2025-02-20 17:17:31 -07:00
15 changed files with 180 additions and 61 deletions

View File

@@ -23,7 +23,9 @@
'js-mode)))
:config
(add-hook 'nix-mode-hook #'lsp)
(set-popup-rule! "^\\*nixos-options-doc\\*$" :ttl 0 :quit t)
(set-repl-handler! 'nix-mode #'syd-nix-open-nix-repl))
(set-popup-rule! (rx bol "*nixos-options-doc*" eol) :ttl 0 :quit t)
(set-repl-handler! 'nix-mode #'syd-nix-open-nix-repl)
(dolist (c '(?- ?_))
(modify-syntax-entry c "w" nix-mode-syntax-table)))
(provide 'syd-lang-nix)

View File

@@ -3,6 +3,7 @@
(use-package age
:hook (on-first-file . age-file-enable)
:custom
;; We use rage over age, as the former supports pinentry.
((age-program "rage")
(age-default-identity (expand-file-name "~/private-keys/age/crumb.age"))
(age-default-recipient (expand-file-name "~/public-keys/age/crumb.pub"))))

View File

@@ -23,10 +23,12 @@
"r" `("Revert buffer" . ,#'revert-buffer))
;; Search
(require 'syd-search)
(general-def
:prefix-map 'syd-leader-search-map
"i" `("IMenu" . ,#'consult-imenu)
"b" `("Search buffer" . ,#'syd/search-buffer))
"b" `("Search buffer" . ,#'syd-search-buffer)
"d" `("Search directory" . ,#'syd-search-directory))
;; File
(require 'syd-file)
@@ -35,9 +37,8 @@
"D" `("Delete file" . ,#'syd/delete-this-file)
"R" `("Move file" . ,#'syd/move-this-file)
"C" `("Copy file" . ,#'syd/copy-this-file)
;; "F" `("Find file under here" . ,#'syd/find-file-under-here)
;; "p" `("Find under Emacs config" . ,#'syd/find-file-under-emacs-user-directory)
"P" `("Browse Emacs config" . ,#'syd/find-file-in-emacs-user-directory)
"F" `("Find file in" . ,#'syd-find-file-in)
"P" `("Browse Emacs config" . ,#'syd-switch-to-emacs-user-directory)
"u" `("Find file as root" . ,#'syd/find-file-as-root)
"U" `("Open this file as root" . ,#'syd/open-this-file-as-root)
"y" `("Yank buffer path" . ,#'syd/yank-buffer-path)
@@ -81,6 +82,7 @@
"C" `("Compile project" . ,#'project-compile)
"&" `("Async cmd in project root" . ,#'project-async-shell-command)
"p" `("Switch project" . ,#'project-switch-project))
"." `("Browse project from root" . ,#'project-root-find-file))
(general-def
:prefix-map 'syd-leader-help-package-map
@@ -142,7 +144,9 @@
"s" `("Search" . ,syd-leader-search-map)
"h" `("Help" . ,help-map)
"n" `("Notes" . ,syd-leader-notes-map)
"i" `("Insert" . ,syd-leader-insert-map)))
"i" `("Insert" . ,syd-leader-insert-map)
"," `("Switch buffer in project" . ,#'consult-project-buffer)
"<" `("Switch buffer" . ,#'consult-buffer)))
(syd-keybinds-initialise)

View File

@@ -1,7 +1,5 @@
;;; syd-org.el -*- lexical-binding: t; -*-
(require 'syd-prose)
(with-eval-after-load 'org
(syd-add-hook 'org-tab-first-hook
(defun syd-org-cycle-only-current-subtree-h (&optional arg)
@@ -284,7 +282,7 @@ See https://lists.gnu.org/archive/html/emacs-orgmode/2019-07/msg00081.html."
"|"
"DONE(d)" ; Task successfully completed
"KILL(k)"))) ; Task was cancelled, aborted, or is no longer
; applicable
; applicable
(org-todo-keyword-faces
'(("[-]" . syd-org-todo-active)
("STRT" . syd-org-todo-active)
@@ -306,9 +304,10 @@ See https://lists.gnu.org/archive/html/emacs-orgmode/2019-07/msg00081.html."
;; ol-rmail
;; ol-eww
))
(syd-add-hook 'org-load-hook
(add-hook 'org-load-hook
#'syd-org-init-popup-rules-h)
:config
(require 'syd-prose)
(syd-add-hook 'org-mode-hook
#'org-indent-mode
#'syd-prose-mode)

View File

@@ -2,9 +2,28 @@
(require 'syd-constants)
(use-package project
:custom ((project-list-file (file-name-concat syd-cache-dir
"known-projects"))))
(with-eval-after-load 'project ; Built-in
;; Stay out of my config directory!
(setq project-list-file (file-name-concat syd-cache-dir "known-projects"))
;; For each command in `project-switch-commands' will assign it the key found
;; in `project-prefix-map'. We emulate that behaviour but for our own
;; `syd-leader-project-map'.
(let* ((project-key
(lambda (f)
(key-description
(where-is-internal
f
;; If the keymap is not wrapped in a list,
;; `where-is-internal' will also search the
;; global ;; keymaps
(list syd-leader-project-map)
;; First result only.
t))))
(switch-cmd (lambda (command name &optional key)
(append (list command name)
(list (or key (funcall project-key command)))))))
(add-to-list 'project-switch-commands
(funcall switch-cmd #'project-root-find-file "Browse"))))
;; Projection provides a Projectile-like project management library atop
;; Emacs built-in project.el. It's more lightweight, while still featureful.