wip
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
/users/crumb/programs/emacs/eln-cache
|
||||
/users/crumb/programs/emacs/auto-save-list
|
||||
.direnv
|
||||
result
|
||||
|
||||
12
README.org
12
README.org
@@ -3,6 +3,18 @@
|
||||
|
||||
Hello! These are my dotfiles for all my software and Nix machines. My TODO lists and READMEs tend to share a file, so I've moved it out of version-control. A link will be here soon enough.
|
||||
|
||||
* Overview
|
||||
|
||||
** Modules
|
||||
|
||||
Nix modules are Sydnix's primary mode of organisation. The modules in this repository are categorised by the scope of their applicability, be it user-specific, machine-specific, Sydnix-specific, or releasable. These sum of these categories resembles a hierarchy wherein modules become less generally-applicable as they build off one another. This all goes to say, in a very roundabout fashion, that we are using the [[https://www.nayuki.io/pe/designing-better-file-organization-around-tags-not-hierarchies][accursed]] hierarchical file-system as god intended:
|
||||
|
||||
#+begin_example
|
||||
«TODO: Annotated diagram explaining the structore of modules/»
|
||||
#+end_example
|
||||
|
||||
User modules may be configurations using a host-specific module, which itself may be a configuration of a Sydnix-specific module.
|
||||
|
||||
# Local Variables:
|
||||
# jinx-local-words: "dotfiles"
|
||||
# End:
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { nixpkgs, ... }@inputs:
|
||||
outputs = { self, nixpkgs, ... }@inputs:
|
||||
# TODO: Move to utils.nix.
|
||||
let list-nix-directory = dir:
|
||||
builtins.attrNames
|
||||
@@ -53,6 +53,9 @@
|
||||
nixosConfigurations = import ./outputs/nixosConfigurations.nix inputs;
|
||||
|
||||
homeConfigurations = import ./outputs/homeConfigurations.nix inputs;
|
||||
|
||||
packages.x86_64-linux.live-minimal =
|
||||
self.nixosConfigurations.live-minimal.config.system.build.isoImage;
|
||||
};
|
||||
|
||||
nixConfig = {
|
||||
|
||||
104
hosts/live-minimal/configuration.nix
Normal file
104
hosts/live-minimal/configuration.nix
Normal file
@@ -0,0 +1,104 @@
|
||||
{ config, pkgs, lib, disko, sydnix-cli, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix")
|
||||
|
||||
# Provide an initial copy of the NixOS channel so that the user
|
||||
# doesn't need to run "nix-channel --update" first.
|
||||
(modulesPath + "/installer/cd-dvd/channel.nix")
|
||||
];
|
||||
|
||||
time.timeZone = "America/Denver";
|
||||
|
||||
console = {
|
||||
font = "Lat2-Terminus16";
|
||||
# keyMap = "us";
|
||||
useXkbConfig = true; # use xkb.options in tty.
|
||||
};
|
||||
|
||||
services.xserver.xkb.layout = "us";
|
||||
services.xserver.xkb.options = "ctrl:swapcaps";
|
||||
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
settings.PermitRootLogin = "yes";
|
||||
settings.X11Forwarding = true;
|
||||
};
|
||||
|
||||
users.users.nixos = {
|
||||
uid = 1000;
|
||||
isNormalUser = true;
|
||||
openssh.authorizedKeys.keyFiles = [
|
||||
../../public-keys/ssh/crumb-at-guix-rebound.pub
|
||||
../../public-keys/ssh/crumb-at-nixos-testbed.pub
|
||||
../../public-keys/ssh/crumble-at-fruitbook.pub
|
||||
../../public-keys/ssh/lain-at-deertopia.pub
|
||||
];
|
||||
password = "pswd";
|
||||
initialHashedPassword = lib.mkForce null;
|
||||
initialPassword = lib.mkForce null;
|
||||
hashedPassword = lib.mkForce null;
|
||||
};
|
||||
|
||||
users.users.root = {
|
||||
password = "pswd";
|
||||
initialHashedPassword = lib.mkForce null;
|
||||
initialPassword = lib.mkForce null;
|
||||
hashedPassword = lib.mkForce null;
|
||||
};
|
||||
|
||||
environment.systemPackages =
|
||||
let
|
||||
my-vimrc =
|
||||
pkgs.writeTextFile {
|
||||
name = "vimrc";
|
||||
text = ''
|
||||
imap jk <ESC>
|
||||
xmap JK <ESC>
|
||||
set number
|
||||
set relativenumber
|
||||
let mapleader=" "
|
||||
nmap <Leader>w <C-w>
|
||||
set splitright
|
||||
'';
|
||||
};
|
||||
|
||||
my-neovim =
|
||||
pkgs.symlinkJoin {
|
||||
name = "neovim";
|
||||
paths = [ pkgs.neovim ];
|
||||
buildInputs = [ pkgs.makeWrapper ];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/nvim \
|
||||
--add-flags "-u ${my-vimrc}"
|
||||
# Symlink {v,vi,vim} to nvim.
|
||||
for i in {v,vi,vim}; do
|
||||
ln -s $out/bin/nvim $out/bin/$i
|
||||
done
|
||||
'';
|
||||
};
|
||||
in [ my-neovim ];
|
||||
|
||||
# This option defines the first version of NixOS you have installed on this
|
||||
# particular machine, and is used to maintain compatibility with application
|
||||
# data (e.g. databases) created on older NixOS versions.
|
||||
#
|
||||
# Most users should NEVER change this value after the initial install, for any
|
||||
# reason, even if you've upgraded your system to a new NixOS release.
|
||||
#
|
||||
# This value does NOT affect the Nixpkgs version your packages and OS are
|
||||
# pulled from, so changing it will NOT upgrade your system - see
|
||||
# https://nixos.org/manual/nixos/stable/#sec-upgrading for how to actually do
|
||||
# that.
|
||||
#
|
||||
# This value being lower than the current NixOS release does NOT mean your
|
||||
# system is out of date, out of support, or vulnerable.
|
||||
#
|
||||
# Do NOT change this value unless you have manually inspected all the changes
|
||||
# it would make to your configuration, and migrated your data accordingly.
|
||||
#
|
||||
# For more information, see `man configuration.nix` or
|
||||
# https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
|
||||
system.stateVersion = "24.05"; # Did you read the comment?
|
||||
}
|
||||
1
hosts/live-minimal/system.nix
Normal file
1
hosts/live-minimal/system.nix
Normal file
@@ -0,0 +1 @@
|
||||
"x86_64-linux"
|
||||
@@ -5,15 +5,11 @@
|
||||
./disko-config.nix
|
||||
];
|
||||
|
||||
# TODO: Remove; this is temporary!
|
||||
networking.firewall.allowedTCPPorts = [ 8080 ];
|
||||
|
||||
sydnix = {
|
||||
filesystemType = "btrfs";
|
||||
|
||||
tailscale.enable = true;
|
||||
|
||||
dropbox.enable = true;
|
||||
dropbox.enable = false;
|
||||
|
||||
users.users = [
|
||||
"crumb"
|
||||
@@ -71,7 +67,7 @@
|
||||
services.desktopManager.plasma6.enable = true;
|
||||
|
||||
services.xserver.xkb.layout = "us";
|
||||
services.xserver.xkb.options = "caps:escape";
|
||||
services.xserver.xkb.options = "ctrl:swapcaps";
|
||||
|
||||
environment.systemPackages = [
|
||||
pkgs.neovim
|
||||
|
||||
@@ -61,16 +61,16 @@ to a pop up buffer."
|
||||
:force-popup current-prefix-arg))
|
||||
|
||||
(dolist (m '(emacs-lisp-mode lisp-data-mode))
|
||||
(set-repl-handler! 'emacs-lisp-mode
|
||||
(set-repl-handler! m
|
||||
#'syd/open-emacs-lisp-repl)
|
||||
(set-eval-handler! 'emacs-lisp-mode
|
||||
(set-eval-handler! m
|
||||
#'syd-emacs-lisp-eval))
|
||||
|
||||
(syd-add-hook '(emacs-lisp-mode-hook lisp-data-mode)
|
||||
(syd-add-hook '(emacs-lisp-mode-hook lisp-data-mode-hook)
|
||||
#'syd-lisp-mode)
|
||||
|
||||
;; DEPRECATED: Remove once syd-strategies is working.
|
||||
(syd-add-hook '(emacs-lisp-mode-hook help-mode-hook lisp-data-mode)
|
||||
(syd-add-hook '(emacs-lisp-mode-hook help-mode-hook lisp-data-mode-hook)
|
||||
(defun syd-emacs-set-handlers-h ()
|
||||
(setq-local syd-lookup-documentation-handlers
|
||||
(list #'syd-emacs-lisp-lookup-documentation))))
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
(use-package lsp-haskell
|
||||
:defer t
|
||||
:init
|
||||
(add-hook 'haskell-mode-local-vars-hook #'lsp 'append)
|
||||
(add-hook 'haskell-literate-mode-local-vars-hook #'lsp 'append))
|
||||
(add-hook 'haskell-mode-hook #'lsp 'append)
|
||||
(add-hook 'haskell-literate-mode-hook #'lsp 'append))
|
||||
|
||||
(provide 'syd-lang-haskell)
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
;;; syd-lang-idris2.el -*- lexical-binding: t; -*-
|
||||
|
||||
(require 'syd-handle-repl)
|
||||
(require 'syd-handle-lookup)
|
||||
|
||||
(defun syd-idris2-open-repl ()
|
||||
(interactive)
|
||||
(idris2-repl-buffer))
|
||||
|
||||
(use-package idris2-mode
|
||||
:mode "\\.idr\\'"
|
||||
:straight (:type git
|
||||
:host github
|
||||
:repo "idris-community/idris2-mode")
|
||||
:config
|
||||
;; Fixes lag when editing idris code with Evil. See
|
||||
;; https://github.com/idris-community/idris2-mode?tab=readme-ov-file#doom-emacs
|
||||
(syd-defadvice syd-idris2--fix-evil-motion-range (fn &rest args)
|
||||
"Like `evil-motion-range', but override field-beginning for performance.
|
||||
See `https://github.com/ProofGeneral/PG/issues/427'."
|
||||
:around #'evil-motion-range
|
||||
(cl-letf (((symbol-function 'field-beginning)
|
||||
(lambda (&rest args) 1)))
|
||||
(apply fn args)))
|
||||
|
||||
(add-hook 'idris2-mode-hook #'lsp)
|
||||
|
||||
(general-define-key
|
||||
:keymaps 'idris2-mode-map
|
||||
:states '(normal visual motion emacs insert)
|
||||
:major-modes t
|
||||
:prefix syd-localleader-key
|
||||
:non-normal-prefix syd-alt-localleader-key
|
||||
"l" #'idris2-load-file)
|
||||
|
||||
(set-repl-handler! 'idris2-mode
|
||||
#'syd-idris2-open-repl)
|
||||
|
||||
(set-popup-rules!
|
||||
`((,(rx bol "*idris2-notes*" eol)
|
||||
:ttl nil)
|
||||
(,(rx bol "*idris2-holes" eol)
|
||||
:ttl nil :quit t :vslot -5 :height 7))))
|
||||
|
||||
(provide 'syd-lang-idris2)
|
||||
@@ -204,3 +204,215 @@
|
||||
(syd-eshell--init-ui-hacks))
|
||||
|
||||
(provide 'syd-eshell)
|
||||
;;; syd-eshell.el -*- lexical-binding: t; -*-
|
||||
|
||||
(require 'ring)
|
||||
(require 'cl-lib)
|
||||
|
||||
(defvar eshell-buffer-name "*eshell*")
|
||||
|
||||
(defvar syd-eshell-buffers (make-ring 25)
|
||||
"List of open eshell buffers.")
|
||||
|
||||
(defun syd-eshell-buffers ()
|
||||
"TODO"
|
||||
(ring-elements syd-eshell-buffers))
|
||||
|
||||
;;;###autoload
|
||||
(defun syd-eshell-run-command (command &optional buffer)
|
||||
"TODO"
|
||||
(let ((buffer
|
||||
(or buffer
|
||||
(if (eq major-mode 'eshell-mode)
|
||||
(current-buffer)
|
||||
(cl-find-if #'buffer-live-p (syd-eshell-buffers))))))
|
||||
(unless buffer
|
||||
(user-error "No living eshell buffers available"))
|
||||
(unless (buffer-live-p buffer)
|
||||
(user-error "Cannot operate on a dead buffer"))
|
||||
(with-current-buffer buffer
|
||||
(goto-char eshell-last-output-end)
|
||||
(goto-char (line-end-position))
|
||||
(insert command)
|
||||
(eshell-send-input nil t))))
|
||||
|
||||
;;;###autoload
|
||||
(defun syd-eshell/toggle (arg &optional command)
|
||||
"Toggle eshell popup window."
|
||||
(interactive "P")
|
||||
(let ((eshell-buffer
|
||||
(get-buffer-create
|
||||
(format "*eshell-popup:%s*"
|
||||
(if (bound-and-true-p persp-mode)
|
||||
(safe-persp-name (get-current-persp))
|
||||
"main"))))
|
||||
confirm-kill-processes
|
||||
current-prefix-arg)
|
||||
(when arg
|
||||
(when-let* ((win (get-buffer-window eshell-buffer)))
|
||||
(delete-window win))
|
||||
(when (buffer-live-p eshell-buffer)
|
||||
(with-current-buffer eshell-buffer
|
||||
(fundamental-mode)
|
||||
(erase-buffer))))
|
||||
(if-let* ((win (get-buffer-window eshell-buffer)))
|
||||
(let (confirm-kill-processes)
|
||||
(delete-window win)
|
||||
(ignore-errors (kill-buffer eshell-buffer)))
|
||||
(with-current-buffer eshell-buffer
|
||||
(syd-mark-buffer-as-real)
|
||||
(if (eq major-mode 'eshell-mode)
|
||||
(run-hooks 'eshell-mode-hook)
|
||||
(eshell-mode))
|
||||
(when command
|
||||
(syd-eshell-run-command command eshell-buffer)))
|
||||
(pop-to-buffer eshell-buffer)
|
||||
(when (bound-and-true-p evil-mode)
|
||||
(call-interactively #'evil-append-line)))))
|
||||
|
||||
(defun syd-eshell (&optional arg)
|
||||
(interactive "P")
|
||||
(eshell (or arg t)))
|
||||
|
||||
(defun syd-eshell-adapt-bash-aliases ()
|
||||
"Very sloppily convert aliases defined in Bash to an Eshell alias file."
|
||||
(interactive)
|
||||
(save-window-excursion
|
||||
(let ((err-buf (generate-new-buffer "*adapt-bash-aliases-err*"))
|
||||
(result-buf (generate-new-buffer "*adapted-bash-aliases*")))
|
||||
(with-current-buffer result-buf
|
||||
(insert "# Automatically generated by syd-eshell-adapt-bash-aliases\n"))
|
||||
(with-temp-buffer
|
||||
;; Aliases are only loaded when bash is in interactive mode.
|
||||
(shell-command "bash -ic alias" (current-buffer) err-buf)
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward
|
||||
(rx bol "alias " (group (+ alphanumeric)) "='"
|
||||
(group (* (not ?\'))) "'")
|
||||
nil t)
|
||||
(let ((eshell-alias (format "alias %s %s $*\n"
|
||||
(match-string 1)
|
||||
(match-string 2))))
|
||||
(with-current-buffer result-buf
|
||||
(insert eshell-alias)))))
|
||||
(unless (= 0 (buffer-size err-buf))
|
||||
(message "Some errors occured whilst fetching Bash's aliases:")
|
||||
(message (with-current-buffer err-buf (buffer-string))))
|
||||
(kill-buffer err-buf)
|
||||
result-buf)))
|
||||
|
||||
(defun syd-eshell-C-d ()
|
||||
"Imitate the typical 'C-d' behaviour in other shells. Quits Eshell when the input is empty."
|
||||
(interactive)
|
||||
(when (and (eolp) (looking-back eshell-prompt-regexp nil))
|
||||
(eshell-life-is-too-much)))
|
||||
|
||||
(defun syd-eshell--init-ui-hacks ()
|
||||
(defun syd-eshell-remove-fringes-h ()
|
||||
(set-window-fringes nil 0 0)
|
||||
(set-window-margins nil 1 nil))
|
||||
(defun syd-eshell-enable-text-wrapping-h ()
|
||||
(visual-line-mode +1)
|
||||
(set-display-table-slot standard-display-table 0 ?\ ))
|
||||
(add-hook 'eshell-mode-hook #'syd-eshell-remove-fringes-h)
|
||||
(add-hook 'eshell-mode-hook #'syd-eshell-enable-text-wrapping-h)
|
||||
|
||||
(with-eval-after-load 'hide-mode-line
|
||||
(add-hook 'eshell-mode-hook #'hide-mode-line-mode))
|
||||
|
||||
;; Remove hscroll-margin in shells, otherwise you get jumpiness when the
|
||||
;; cursor comes close to the left/right edges of the window.
|
||||
(defun syd-eshell-disable-hscroll-margin ()
|
||||
(setq hscroll-margin 0))
|
||||
(add-hook 'eshell-mode-hook #'syd-eshell-disable-hscroll-margin))
|
||||
|
||||
(use-package shrink-path
|
||||
:defer t)
|
||||
|
||||
(defface syd-eshell-local-name '((t (:inherit font-lock-constant-face)))
|
||||
"Face used by the Eshell prompt for the CWD's non-TRAMP part. See
|
||||
`syd-eshell--prompt-fn'"
|
||||
:group 'eshell)
|
||||
|
||||
(defface syd-eshell-tramp-prefix '((t (:inherit font-lock-comment-face)))
|
||||
"Face used by the Eshell prompt for the CWD's TRAMP prefix. See
|
||||
`syd-eshell--prompt-fn'."
|
||||
:group 'eshell)
|
||||
|
||||
(defun syd-eshell--prompt-fn ()
|
||||
"See `eshell-prompt-function'."
|
||||
(require 'shrink-path)
|
||||
(require 'syd-file)
|
||||
(-let (((tramp-prefix . local-name) (syd-split-tramp-file-name (eshell/pwd))))
|
||||
(concat (unless (bobp) "\n")
|
||||
(when tramp-prefix
|
||||
(propertize tramp-prefix 'face 'syd-eshell-tramp-prefix))
|
||||
(propertize (if (equal local-name "~")
|
||||
local-name
|
||||
(abbreviate-file-name (shrink-path-file local-name)))
|
||||
'face 'syd-eshell-local-name)
|
||||
(propertize " $"
|
||||
'face (if (zerop eshell-last-command-status)
|
||||
'success
|
||||
'error))
|
||||
" ")))
|
||||
|
||||
(defvar syd-eshell--prompt-regexp (rx bol (* (not (any "\n$"))) " $ "))
|
||||
|
||||
(set-popup-rule! "^\\*eshell-popup"
|
||||
:vslot -5 :size 13 :select t :modeline nil :quit nil :ttl nil)
|
||||
|
||||
(use-package eshell
|
||||
:init
|
||||
(defvar syd-eshell-data-dir (file-name-concat syd-data-dir
|
||||
"eshell"))
|
||||
(make-directory syd-eshell-data-dir t)
|
||||
:custom
|
||||
((eshell-banner-message
|
||||
'(format "🦌 %s %s }:3\n"
|
||||
(propertize (format " %s " (string-trim (buffer-name)))
|
||||
'face 'mode-line-highlight)
|
||||
(propertize (current-time-string)
|
||||
'face 'font-lock-keyword-face)))
|
||||
(eshell-scroll-to-bottom-on-input 'all)
|
||||
(eshell-scroll-to-bottom-on-output nil)
|
||||
(eshell-kill-processes-on-exit t)
|
||||
(eshell-hist-ignoredups t)
|
||||
(eshell-glob-case-insensitive t)
|
||||
(eshell-error-if-no-glob t)
|
||||
(eshell-history-file-name (file-name-concat
|
||||
syd-eshell-data-dir "history"))
|
||||
(eshell-last-dir-ring-file-name (file-name-concat
|
||||
syd-eshell-data-dir "lastdir"))
|
||||
(eshell-prompt-function #'syd-eshell--prompt-fn)
|
||||
(eshell-prompt-regexp syd-eshell--prompt-regexp))
|
||||
:general
|
||||
(:keymaps 'syd-leader-open-map
|
||||
"e" #'syd-eshell/toggle
|
||||
"E" #'syd-eshell)
|
||||
(:keymaps 'eshell-mode-map
|
||||
:states 'insert
|
||||
"C-d" #'syd-eshell-C-d)
|
||||
(:keymaps 'eshell-mode-map
|
||||
:states 'motion
|
||||
"[ [" #'eshell-previous-prompt
|
||||
"] ]" #'eshell-next-prompt)
|
||||
(:keymaps 'eshell-mode-map
|
||||
:states '(normal insert)
|
||||
"C-j" #'eshell-next-matching-input-from-input
|
||||
"C-k" #'eshell-previous-matching-input-from-input
|
||||
"C-s" #'consult-history)
|
||||
:config
|
||||
;; When cd'd into a TRAMP remote, automatically expand '/' to the TRAMP
|
||||
;; notation referring to the remote's root.
|
||||
(add-to-list 'eshell-modules-list 'eshell-elecslash)
|
||||
|
||||
(require 'syd-buffers)
|
||||
|
||||
(add-hook 'eshell-mode-hook #'syd-mark-buffer-as-real)
|
||||
|
||||
;; UI enhancements.
|
||||
(syd-eshell--init-ui-hacks))
|
||||
|
||||
(provide 'syd-eshell)
|
||||
|
||||
|
||||
@@ -7,5 +7,6 @@
|
||||
(require 'syd-lang-nix)
|
||||
(require 'syd-lang-haskell)
|
||||
(require 'syd-lang-sql)
|
||||
(require 'syd-lang-idris2)
|
||||
|
||||
(provide 'syd-lang)
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
;;; Directory Local Variables -*- no-byte-compile: t -*-
|
||||
;;; For more information see (info "(emacs) Directory Variables")
|
||||
|
||||
((nil . ((projection-commands-run-command . "cabal run"))))
|
||||
3
modules/home/users/crumb/emacs/project-skeletons/haskell-flake/.gitignore
vendored
Normal file
3
modules/home/users/crumb/emacs/project-skeletons/haskell-flake/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
.direnv/
|
||||
result
|
||||
dist-newstyle/
|
||||
@@ -1,24 +1,23 @@
|
||||
cabal-version: 3.0
|
||||
name: __PROJECT-NAME__
|
||||
version: 0.1.0.0
|
||||
synopsis: __DESCRIPTION__
|
||||
description: __DESCRIPTION__
|
||||
synopsis: __PROJECT-NAME__
|
||||
description: __PROJECT-NAME__
|
||||
license: GPL-3.0-only
|
||||
license-file: LICENSE
|
||||
author: __USER-NAME__
|
||||
maintainer: __USER-MAIL-ADDRESS__
|
||||
|
||||
-- copyright:
|
||||
category: Language
|
||||
maintainer: __USER-EMAIL__
|
||||
category: Application
|
||||
build-type: Simple
|
||||
extra-doc-files:
|
||||
|
||||
common common
|
||||
ghc-options: -Wno-typed-holes -fdefer-typed-holes
|
||||
ghc-options: -Wno-typed-holes -fdefer-typed-holes -threaded -fdefer-type-errors
|
||||
|
||||
default-extensions:
|
||||
BlockArguments
|
||||
DataKinds
|
||||
DuplicateRecordFields
|
||||
DeriveDataTypeable
|
||||
DeriveGeneric
|
||||
DeriveTraversable
|
||||
@@ -43,8 +42,11 @@ common common
|
||||
library
|
||||
import: common
|
||||
|
||||
-- cabal-fmt: expand sydml/src/ -Main
|
||||
ghc-options: -fplugin=Effectful.Plugin
|
||||
|
||||
-- cabal-fmt: expand src/ -Main
|
||||
exposed-modules:
|
||||
__PROJECT-NAME__
|
||||
|
||||
default-language: GHC2021
|
||||
|
||||
@@ -53,11 +55,22 @@ library
|
||||
, containers
|
||||
, hashable
|
||||
, mtl
|
||||
, transformers
|
||||
, lens
|
||||
, generic-lens
|
||||
, pretty-simple
|
||||
, text >=2.0 && <2.2
|
||||
, transformers
|
||||
, unordered-containers
|
||||
, effectful
|
||||
, effectful-plugin
|
||||
|
||||
hs-source-dirs: src
|
||||
|
||||
-- executable __PROJECT-NAME__
|
||||
-- import: common
|
||||
-- main-is: Main.hs
|
||||
-- default-language: GHC2021
|
||||
-- hs-source-dirs: app
|
||||
-- build-depends:
|
||||
-- , base ^>=4.19.1.0
|
||||
-- , __PROJECT-NAME__
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
hpkgs.fourmolu
|
||||
hpkgs.haskell-language-server
|
||||
hpkgs.cabal-install
|
||||
hpkgs.hasktags
|
||||
];
|
||||
withHoogle = true;
|
||||
};
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
module __PROJECT-NAME__ where
|
||||
@@ -1,8 +1,8 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
let
|
||||
cfg = config.sydnix.users.crumb.nvim;
|
||||
in {
|
||||
in {
|
||||
options.sydnix.users.crumb.nvim.enable =
|
||||
lib.mkEnableOption "Neovim, à la crumb";
|
||||
config = lib.mkIf cfg.enable (
|
||||
@@ -15,6 +15,9 @@ in {
|
||||
xmap JK <ESC>
|
||||
set number
|
||||
set relativenumber
|
||||
let mapleader=" "
|
||||
nmap <Leader>w <C-w>
|
||||
set splitright
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -35,5 +38,5 @@ in {
|
||||
in {
|
||||
home.packages = [ my-neovim ];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
2
result
2
result
@@ -1 +1 @@
|
||||
/nix/store/2wnp36rrm6wmxm5kky7c63ify9wppshg-nixos-minimal-25.05.20250202.8532db2-x86_64-linux.iso
|
||||
/nix/store/pg4zdcr9ylpydl15k3h78crp84gifzvq-nixos-minimal-25.05.20250202.8532db2-x86_64-linux.iso
|
||||
@@ -1,42 +0,0 @@
|
||||
;;; syd-lang-agda.el -*- lexical-binding: t; -*-
|
||||
|
||||
(with-eval-after-load 'agda2
|
||||
(general-define-key
|
||||
:keymaps 'agda2-mode-map
|
||||
:states '(normal visual motion emacs insert)
|
||||
:major-modes t
|
||||
:prefix syd-localleader-key
|
||||
:non-normal-prefix syd-alt-localleader-key
|
||||
"?" #'agda2-show-goals
|
||||
"." #'agda2-goal-and-context-and-inferred
|
||||
"," #'agda2-goal-and-context
|
||||
"=" #'agda2-show-constraints
|
||||
"SPC" #'agda2-give
|
||||
"a" #'agda2-mimer-maybe-all
|
||||
"b" #'agda2-previous-goal
|
||||
"c" #'agda2-make-case
|
||||
"d" #'agda2-infer-type-maybe-toplevel
|
||||
"e" #'agda2-show-context
|
||||
"f" #'agda2-next-goal
|
||||
"gG" #'agda2-go-back
|
||||
"h" #'agda2-helper-function-type
|
||||
"l" #'agda2-load
|
||||
"n" #'agda2-compute-normalised-maybe-toplevel
|
||||
"p" #'agda2-module-contents-maybe-toplevel
|
||||
"r" #'agda2-refine
|
||||
"s" #'agda2-solveAll
|
||||
"t" #'agda2-goal-type
|
||||
"w" #'agda2-why-in-scope-maybe-toplevel
|
||||
"x c" #'agda2-compile
|
||||
"x d" #'agda2-remove-annotations
|
||||
"x h" #'agda2-display-implicit-arguments
|
||||
"x q" #'agda2-quit
|
||||
"x r" #'agda2-restart)
|
||||
(general-def
|
||||
:keymaps 'agda2-mode-map
|
||||
:states '(motion normal)
|
||||
"[ n" #'agda2-previous-goal
|
||||
"] n" #'agda2-next-goal)
|
||||
(setq agda2-fontset-name "JuliaMono"))
|
||||
|
||||
(provide 'syd-lang-agda)
|
||||
@@ -1,105 +0,0 @@
|
||||
;;; emacs-lisp.el -*- lexical-binding: t; -*-
|
||||
|
||||
(require 'syd-handle-repl)
|
||||
(require 'syd-handle-lookup)
|
||||
(require 'syd-handle-eval)
|
||||
(require 'syd-lisp-lib)
|
||||
;; (require 'handle)
|
||||
|
||||
;; Don't `use-package' `ielm', since it's loaded by Emacs. You'll get weird
|
||||
;; autoload errors if you do.
|
||||
;; https://www.reddit.com/r/emacs/comments/q7fjbi/comment/lml127d
|
||||
(use-package emacs
|
||||
:custom ((ielm-history-file-name ; Stay out of my config dir!
|
||||
(file-name-concat syd-cache-dir "ielm-history.eld"))))
|
||||
|
||||
;;;###autoload
|
||||
(defun syd/open-emacs-lisp-repl ()
|
||||
(interactive)
|
||||
(pop-to-buffer
|
||||
(or (get-buffer "*ielm*")
|
||||
(progn (ielm) ; Creates the *ielm* buffer.
|
||||
(let ((b (get-buffer "*ielm*")))
|
||||
;; We leave it to the enclosing `pop-to-buffer' to display the
|
||||
;; buffer.
|
||||
(bury-buffer b)
|
||||
b)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun syd-emacs-lisp-lookup-documentation (identifier)
|
||||
"Lookup IDENTIFIER with `describe-symbol'"
|
||||
;; HACK: Much to my frustration, `describe-symbol' has no defined return
|
||||
;; value. To test if the call was successful or not, we check if any window
|
||||
;; is displaying the help buffer. This breaks if
|
||||
;; `syd-emacs-lisp-lookup-documentation' is called while the help buffer is
|
||||
;; already open.
|
||||
(describe-symbol (intern identifier))
|
||||
(let ((buffer (get-buffer (help-buffer))))
|
||||
(and (get-buffer-window-list buffer)
|
||||
buffer)))
|
||||
|
||||
;;;###autoload
|
||||
(defun syd-emacs-lisp-eval (beg end)
|
||||
"Evaluate a region and print it to the echo area (if one line long), otherwise
|
||||
to a pop up buffer."
|
||||
(syd-eval-display-results
|
||||
(string-trim-right
|
||||
(let ((buffer (generate-new-buffer " *eval-output*"))
|
||||
(debug-on-error t))
|
||||
(unwind-protect
|
||||
(condition-case-unless-debug e
|
||||
(progn (eval-region beg end buffer load-read-function)
|
||||
(with-current-buffer buffer
|
||||
(let ((pp-max-width nil))
|
||||
(require 'pp)
|
||||
(pp-buffer)
|
||||
(replace-regexp-in-string
|
||||
"\\\\n" "\n" (string-trim-left (buffer-string))))))
|
||||
(error (format "ERROR: %s" e)))
|
||||
(kill-buffer buffer))))
|
||||
:source-buffer (current-buffer)
|
||||
:force-popup current-prefix-arg))
|
||||
|
||||
(dolist (m '(emacs-lisp-mode lisp-data-mode))
|
||||
(set-repl-handler! 'emacs-lisp-mode
|
||||
#'syd/open-emacs-lisp-repl)
|
||||
(set-eval-handler! 'emacs-lisp-mode
|
||||
#'syd-emacs-lisp-eval))
|
||||
|
||||
(syd-add-hook '(emacs-lisp-mode-hook lisp-data-mode)
|
||||
#'syd-lisp-mode)
|
||||
|
||||
;; DEPRECATED: Remove once syd-strategies is working.
|
||||
(syd-add-hook '(emacs-lisp-mode-hook help-mode-hook lisp-data-mode)
|
||||
(defun syd-emacs-set-handlers-h ()
|
||||
(setq-local syd-lookup-documentation-handlers
|
||||
(list #'syd-emacs-lisp-lookup-documentation))))
|
||||
|
||||
;; Semantic highlighting for Elisp.
|
||||
(use-package highlight-defined
|
||||
:hook (emacs-lisp-mode-hook . highlight-defined-mode))
|
||||
|
||||
;; Automatically and inteligently expand abbreviations. E.g. `wcb` will be
|
||||
;; expanded to `(with-current-buffer)`, but only where it makes sense for a
|
||||
;; function/macro call to be.
|
||||
(use-package sotlisp
|
||||
:straight (:host github
|
||||
:repo "Malabarba/speed-of-thought-lisp")
|
||||
:hook (emacs-lisp-mode . speed-of-thought-mode))
|
||||
|
||||
;; Give different pairs of delimiters different colours.
|
||||
(use-package rainbow-delimiters
|
||||
:hook (emacs-lisp-mode . rainbow-delimiters-mode))
|
||||
|
||||
(use-package macrostep
|
||||
:commands (macrostep-expand)
|
||||
:init
|
||||
(general-define-key
|
||||
:keymaps 'emacs-lisp-mode-map
|
||||
:states '(normal visual motion emacs insert)
|
||||
:major-modes t
|
||||
:prefix syd-localleader-key
|
||||
:non-normal-prefix syd-alt-localleader-key
|
||||
"m" #'macrostep-expand))
|
||||
|
||||
(provide 'syd-lang-emacs-lisp)
|
||||
@@ -1,73 +0,0 @@
|
||||
;;; syd-dired.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defun syd-dired-here ()
|
||||
(interactive)
|
||||
(dired default-directory))
|
||||
|
||||
(use-package dired
|
||||
;; Built-in to Emacs.
|
||||
:straight nil
|
||||
:general
|
||||
(:keymaps 'syd-leader-open-map
|
||||
"-" #'syd-dired-here)
|
||||
(:keymaps 'syd-leader-project-map
|
||||
"-" #'project-dired)
|
||||
(:keymaps 'dired-mode-map
|
||||
:states '(normal motion)
|
||||
"g r" #'revert-buffer)
|
||||
:commands dired-jump
|
||||
:custom (;; When there are other Dired windows open, suggest them as targets
|
||||
;; for renaming/copying.
|
||||
(dired-dwim-target t)
|
||||
;; Don't prompt to revert, just do it.
|
||||
(dired-auto-revert-buffer #'dired-buffer-stale-p)
|
||||
(dired-listing-switches
|
||||
(mapconcat
|
||||
#'identity
|
||||
'("-l" ; Mandatory!
|
||||
"--almost-all" ; Show hidden files; omit '.' and '..'.
|
||||
"--human-readable" ; Display sizes in human-readable units.
|
||||
"--time-style=+") ; Omit times/dates.
|
||||
" "))
|
||||
;; Always copy recursively
|
||||
(dired-recursive-copies 'always)
|
||||
;; Prompt for confirmation for each top-level directory being
|
||||
;; deleted.
|
||||
(dired-recursive-deletes 'top)
|
||||
(dired-create-destination-dirs 'ask)
|
||||
(dired-create-destination-dirs-on-trailing-dirsep t)
|
||||
;; Where to store image caches
|
||||
(image-dired-dir (concat syd-cache-dir "image-dired/"))
|
||||
(image-dired-db-file (concat image-dired-dir "db.el"))
|
||||
(image-dired-gallery-dir (concat image-dired-dir "gallery/"))
|
||||
(image-dired-temp-image-file (concat image-dired-dir "temp-image"))
|
||||
(image-dired-temp-rotate-image-file (concat image-dired-dir "temp-rotate-image"))
|
||||
;; Increase thumbnail sizes.
|
||||
(image-dired-thumb-size 150))
|
||||
:config
|
||||
(set-popup-rule! "^\\*image-dired"
|
||||
:slot 20 :size 0.8 :select t :quit nil :ttl 0)
|
||||
|
||||
;; On ESC, abort `wdired-mode' (will prompt)
|
||||
(syd-add-hook 'syd-escape-hook
|
||||
(defun syd-dired--wdired-exit-h ()
|
||||
(when (eq major-mode 'wdired-mode)
|
||||
(wdired-exit)
|
||||
t))))
|
||||
|
||||
(use-package diredfl
|
||||
:hook ((dired-mode . diredfl-mode)
|
||||
(dirvish-directory-view-mode . diredfl-mode)))
|
||||
|
||||
(use-package dirvish
|
||||
:after dired
|
||||
:custom ((dirvish-cache-dir (file-name-concat syd-cache-dir "dirvish/"))
|
||||
(dirvish-reuse-session 'open)
|
||||
(dirvish-default-layout '(0 0.4 0.6))
|
||||
(dirvish-hide-details '(dirvish dirvish-fd dirvish-side)))
|
||||
:config
|
||||
;; Fix random void-variable errors.
|
||||
(require 'autorevert)
|
||||
(dirvish-override-dired-mode 1))
|
||||
|
||||
(provide 'syd-dired)
|
||||
@@ -1,11 +0,0 @@
|
||||
(add-to-list 'load-path
|
||||
(file-name-concat user-emacs-directory "modules" "lang"))
|
||||
|
||||
(require 'syd-lang-agda)
|
||||
(require 'syd-lang-emacs-lisp)
|
||||
(require 'syd-lang-clojure)
|
||||
(require 'syd-lang-nix)
|
||||
(require 'syd-lang-haskell)
|
||||
(require 'syd-lang-sql)
|
||||
|
||||
(provide 'syd-lang)
|
||||
@@ -1,536 +0,0 @@
|
||||
;;; syd-org.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; Optional Org-mode dependency used for highlighting source code in HTML
|
||||
;; exports.
|
||||
(use-package htmlize)
|
||||
|
||||
(with-eval-after-load 'org
|
||||
(syd-add-hook 'org-tab-first-hook
|
||||
(defun syd-org-cycle-only-current-subtree-h (&optional arg)
|
||||
"Toggle the local fold at the point, and no deeper.
|
||||
`org-cycle's standard behavior is to cycle between three levels: collapsed,
|
||||
subtree and whole document. This is slow, especially in larger org buffer. Most
|
||||
of the time I just want to peek into the current subtree -- at most, expand
|
||||
*only* the current subtree.
|
||||
|
||||
All my (performant) foldings needs are met between this and `org-show-subtree'
|
||||
(on zO for evil users), and `org-cycle' on shift-TAB if I need it."
|
||||
(interactive "P")
|
||||
(unless (or (eq this-command 'org-shifttab)
|
||||
(and (bound-and-true-p org-cdlatex-mode)
|
||||
(or (org-inside-LaTeX-fragment-p)
|
||||
(org-inside-latex-macro-p))))
|
||||
(save-excursion
|
||||
(org-beginning-of-line)
|
||||
(let (invisible-p)
|
||||
(when (and (org-at-heading-p)
|
||||
(or org-cycle-open-archived-trees
|
||||
(not (member org-archive-tag (org-get-tags))))
|
||||
(or (not arg)
|
||||
(setq invisible-p
|
||||
(memq (get-char-property (line-end-position)
|
||||
'invisible)
|
||||
'(outline org-fold-outline)))))
|
||||
(unless invisible-p
|
||||
(setq org-cycle-subtree-status 'subtree))
|
||||
(org-cycle-internal-local)
|
||||
t)))))))
|
||||
|
||||
(defun syd-org--init-hacks-h ()
|
||||
;; Open file links in current window, rather than new ones
|
||||
(setf (alist-get 'file org-link-frame-setup) #'find-file)
|
||||
;; Open directory links in dired
|
||||
(add-to-list 'org-file-apps '(directory . emacs))
|
||||
(add-to-list 'org-file-apps '(remote . emacs))
|
||||
|
||||
(defun syd-org--restart-mode-h ()
|
||||
"Restart `org-mode', but only once."
|
||||
(syd-quietly (org-mode-restart))
|
||||
(setq org-agenda-new-buffers
|
||||
(delq (current-buffer)
|
||||
org-agenda-new-buffers))
|
||||
(run-hooks 'find-file-hook))
|
||||
|
||||
(syd-add-hook 'org-agenda-finalize-hook
|
||||
(defun syd-org-exclude-agenda-buffers-from-workspace-h ()
|
||||
"Don't associate temporary agenda buffers with current workspace."
|
||||
(when (and org-agenda-new-buffers
|
||||
(bound-and-true-p persp-mode)
|
||||
(not org-agenda-sticky))
|
||||
(let (persp-autokill-buffer-on-remove)
|
||||
(persp-remove-buffer org-agenda-new-buffers
|
||||
(get-current-persp)
|
||||
nil)))))
|
||||
|
||||
(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))))
|
||||
|
||||
(defvar recentf-exclude)
|
||||
|
||||
(syd-defadvice syd-org--optimise-backgrounded-agenda-buffers-a (fn file)
|
||||
"Disable `org-mode's startup processes for temporary agenda buffers.
|
||||
|
||||
Prevents recentf pollution as well. However, if the user tries to visit one of
|
||||
these buffers they'll see a gimped, half-broken org buffer, so to avoid that,
|
||||
install a hook to restart `org-mode' when they're switched to so they can grow
|
||||
up to be fully-fledged org-mode buffers."
|
||||
:around #'org-get-agenda-file-buffer
|
||||
(if-let* ((buf (org-find-base-buffer-visiting file)))
|
||||
buf
|
||||
(let ((recentf-exclude '(always))
|
||||
;; (doom-inhibit-large-file-detection t)
|
||||
;; (doom-inhibit-local-var-hooks t)
|
||||
(org-inhibit-startup t)
|
||||
vc-handled-backends
|
||||
enable-local-variables
|
||||
find-file-hook)
|
||||
(when-let ((buf (delay-mode-hooks (funcall fn file))))
|
||||
(with-current-buffer buf
|
||||
(add-hook 'on-switch-buffer-hook #'syd-org--restart-mode-h
|
||||
nil 'local))
|
||||
buf))))
|
||||
|
||||
(syd-defadvice syd-org--fix-inconsistent-uuidgen-case-a (uuid)
|
||||
"Ensure uuidgen is always lowercase (consistent) regardless of system.
|
||||
See https://lists.gnu.org/archive/html/emacs-orgmode/2019-07/msg00081.html."
|
||||
:filter-return #'org-id-new
|
||||
(if (eq org-id-method 'uuid)
|
||||
(downcase uuid)
|
||||
uuid)))
|
||||
|
||||
(defun syd-org-init-theme ()
|
||||
(require 'syd-kanagawa)
|
||||
(let* ((hl `(:weight bold))
|
||||
(fg (lambda (c) `(:foreground ,(syd-kanagawa-get c))))
|
||||
(bg (lambda (c) `(:background ,(syd-kanagawa-get c))))
|
||||
(block-delim `(:foreground unspecified
|
||||
:inherit font-lock-comment-face
|
||||
:extend t
|
||||
,@(funcall bg 'sumi-ink-0)
|
||||
:height 0.75))
|
||||
(keyword '(:background unspecified :foreground unspecified
|
||||
:inherit (fixed-pitch font-lock-comment-face)
|
||||
:height 0.9)))
|
||||
(setq org-src-block-faces
|
||||
`(("jupyter-apl" syd-apl)))
|
||||
(custom-theme-set-faces
|
||||
'user
|
||||
`(org-document-title ((t (,@hl :height 1.60))))
|
||||
`(org-document-info ((t (,@hl :height 1.0))))
|
||||
`(org-document-info-keyword ((t ,keyword)))
|
||||
`(org-meta-line ((t ,keyword)))
|
||||
`(org-level-1 ((t (,@hl :height 1.40 ,@(funcall fg 'oni-violet)))))
|
||||
`(org-level-2 ((t (,@hl :height 1.35 ,@(funcall fg 'crystal-blue)))))
|
||||
`(org-level-3 ((t (,@hl :height 1.30 ,@(funcall fg 'spring-violet-2)))))
|
||||
`(org-level-4 ((t (,@hl :height 1.25 ,@(funcall fg 'light-blue)))))
|
||||
`(org-level-5 ((t (,@hl :height 1.20 ,@(funcall fg 'wave-aqua-2)))))
|
||||
`(org-level-6 ((t (,@hl :height 1.15 ,@(funcall fg 'spring-green)))))
|
||||
`(org-level-7 ((t (,@hl :height 1.10 ,@(funcall fg 'boat-yellow-1)))))
|
||||
`(org-level-8 ((t (,@hl :height 1.05 ,@(funcall fg 'boat-yellow-2)))))
|
||||
`(org-block-begin-line ((t ,block-delim)))
|
||||
`(org-block-end-line ((t ,block-delim)))
|
||||
'(org-ellipsis ((t (:height 1.0))))
|
||||
;; It is important that the `org-indent' face uses a fixed-pitch font, lest
|
||||
;; e.g. multi-line bullets appear misaligned.
|
||||
'(org-indent ((t (:inherit (org-hide syd-alt-fixed-pitch)))))
|
||||
;; Must be fixed-pitch; `[ ]` and `[X]' should be the same width.
|
||||
'(org-checkbox ((t (:inherit fixed-pitch))))
|
||||
`(org-drawer ((t ,block-delim)))
|
||||
'(org-property-value ((t (:inherit fixed-pitch))))
|
||||
'(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch)))))
|
||||
`(org-block ((t (:inherit fixed-pitch
|
||||
,@(funcall bg 'sumi-ink-2)))))
|
||||
'(org-code ((t (:inherit (shadow fixed-pitch))))))))
|
||||
|
||||
(evil-define-command syd-org-yank-link (register)
|
||||
(interactive "<x>")
|
||||
(if-let* ((url (thing-at-point 'url)))
|
||||
(progn (evil-set-register (or register ?\") url)
|
||||
(message "Yanked link: %s" url))
|
||||
(message "No URL at point")))
|
||||
|
||||
(defun syd-org-init-keybinds ()
|
||||
(general-def
|
||||
:keymaps 'org-mode-map
|
||||
:states '(insert emacs)
|
||||
[tab] #'org-cycle
|
||||
[C-M-return] #'org-insert-subheading)
|
||||
(general-def
|
||||
:prefix-map 'syd-org-mode-links-map
|
||||
"l" #'org-insert-link
|
||||
"y" #'syd-org-yank-link)
|
||||
(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
|
||||
"." #'consult-org-heading
|
||||
"/" #'consult-org-agenda
|
||||
"@" #'org-cite-insert
|
||||
"e" #'org-export-dispatch
|
||||
"f" #'org-footnote-action
|
||||
"h" #'org-toggle-heading
|
||||
"i" #'org-toggle-item
|
||||
"I" #'org-id-get-create
|
||||
"k" #'org-babel-remove-result
|
||||
"l" `("Links" . ,syd-org-mode-links-map)
|
||||
"t" #'org-todo
|
||||
"L" #'org-latex-preview
|
||||
"s t" #'org-set-tags-command
|
||||
"s p" #'org-set-property
|
||||
"s d" #'org-deadline
|
||||
"s s" #'org-schedule
|
||||
"d t" #'org-timestamp
|
||||
"d T" #'org-timestamp-inactive
|
||||
"x" #'org-toggle-checkbox)
|
||||
(general-define-key
|
||||
:keymaps 'org-agenda-mode-map
|
||||
:states '(normal visual motion emacs insert)
|
||||
:major-modes t
|
||||
:prefix syd-localleader-key
|
||||
:non-normal-prefix syd-alt-localleader-key
|
||||
"t" #'org-agenda-todo
|
||||
"r" #'org-agenda-refile
|
||||
"q" #'org-agenda-set-tags
|
||||
"p p" #'org-agenda-priority
|
||||
"p u" #'org-agenda-priority-up
|
||||
"p d" #'org-agenda-priority-down
|
||||
"p k" #'org-agenda-priority-up
|
||||
"p j" #'org-agenda-priority-down
|
||||
"d d" #'org-agenda-deadline
|
||||
"d s" #'org-agenda-schedule))
|
||||
|
||||
(defun syd-org-init-popup-rules-h ()
|
||||
(set-popup-rules!
|
||||
'(("^\\*Org Links" :slot -1 :vslot -1 :size 2 :ttl 0)
|
||||
("^ ?\\*\\(?:Agenda Com\\|Calendar\\|Org Export Dispatcher\\)"
|
||||
:slot -1 :vslot -1 :size #'+popup-shrink-to-fit :ttl 0)
|
||||
("^\\*Org \\(?:Select\\|Attach\\|Table Edit\\)" :slot -1 :vslot -2 :ttl 0 :size 0.25)
|
||||
("^\\*Edit Formulas\\*$" :slot -1 :vslot -2 :ttl 0 :size 0.25)
|
||||
("^\\*Org Agenda" :ignore t)
|
||||
("^\\*Org Src" :size 0.42 :quit nil :select t :autosave t :modeline t :ttl nil)
|
||||
("^\\*Org-Babel")
|
||||
("^\\*Capture\\*$\\|CAPTURE-.*$" :size 0.42 :quit nil :select t :autosave ignore))))
|
||||
|
||||
(defun syd-org-init-appearance-h ()
|
||||
;; Larger LaTeX previews.
|
||||
(plist-put org-format-latex-options :scale 1.4))
|
||||
|
||||
(defun syd-org-init-agenda-h ()
|
||||
(setq
|
||||
;; The lengths of these leaders take account for our added
|
||||
;; `syd-org--agenda-repeater'.
|
||||
org-agenda-scheduled-leaders '("Sched" "S.%2dx")
|
||||
org-agenda-deadline-leaders '("Deadl" "In%2dd" "D.%2dx")
|
||||
org-agenda-timerange-leaders '("" ; Range within a single day.
|
||||
"%2d/%2d") ; Range spanning many days.
|
||||
;; Hide "upcoming deadlines" until the scheduled date.
|
||||
org-agenda-skip-deadline-prewarning-if-scheduled 'pre-scheduled
|
||||
;; Hide completed tasks.
|
||||
org-agenda-skip-scheduled-if-done t)
|
||||
|
||||
;; Show the repeater (the repeat interval, e.g. +1d) in repeating agenda
|
||||
;; entries.
|
||||
(defun syd-org--agenda-repeater ()
|
||||
"The repeater information (e.g. +1w) in the agenda."
|
||||
(let ((pom (org-get-at-bol 'org-marker)))
|
||||
(if (or (org-get-scheduled-time pom) (org-get-deadline-time pom))
|
||||
(format "%5s: " (or (org-get-repeat) ""))
|
||||
"┄┄┄┄┄┄┄┄┄┄┄┄")))
|
||||
|
||||
;; Add `syd-org--agenda-repeater' to the agenda prefix.
|
||||
(setcdr (assoc 'agenda org-agenda-prefix-format)
|
||||
" %i %-12:c%?-12t%s%(syd-org--agenda-repeater)")
|
||||
|
||||
(setq org-agenda-custom-commands
|
||||
'(("k" "My agenda for today"
|
||||
((agenda
|
||||
""
|
||||
((org-agenda-span 1)
|
||||
(org-deadline-warning-days 0)))
|
||||
(agenda
|
||||
""
|
||||
((org-agenda-span 7)
|
||||
(org-agenda-start-day "+1d")
|
||||
(org-deadline-warning-days 0)
|
||||
(org-agenda-time-grid nil)
|
||||
(org-agenda-entry-types '(:deadline))
|
||||
(org-agenda-overriding-header "Upcoming deadlines"))))))))
|
||||
|
||||
(defvar syd-org-default-css "
|
||||
<style>
|
||||
html
|
||||
{ height: 100%;
|
||||
}
|
||||
|
||||
body
|
||||
{ height: 100%
|
||||
; padding: 0 10px
|
||||
; line-height: 1.6
|
||||
; font-size: 18px
|
||||
; margin: 40px auto
|
||||
; max-width: 650px
|
||||
; color: #444
|
||||
}
|
||||
|
||||
h1, h2, h3
|
||||
{ line-height: 1.2
|
||||
}
|
||||
|
||||
pre
|
||||
{ line-height: normal
|
||||
}
|
||||
|
||||
.org-svg
|
||||
{ max-height: 100%
|
||||
; max-width: 100%
|
||||
}
|
||||
|
||||
.figure img
|
||||
{ max-height: 100%
|
||||
; max-width: 100%
|
||||
}
|
||||
</style>"
|
||||
"A default style for Org HTML exports.")
|
||||
|
||||
(use-package org
|
||||
:defer-incrementally
|
||||
calendar find-func format-spec org-macs org-compat org-faces org-entities
|
||||
org-list org-pcomplete org-src org-footnote org-macro ob org org-agenda
|
||||
org-capture
|
||||
:init
|
||||
;; HACK: Face specs fed directly to `org-todo-keyword-faces' don't respect
|
||||
;; underlying faces like the `org-todo' face does, so we define our own
|
||||
;; intermediary faces that extend from org-todo.
|
||||
(with-no-warnings
|
||||
(custom-declare-face 'syd-org-todo-active
|
||||
'((t (:inherit (bold font-lock-constant-face org-todo)))) "")
|
||||
(custom-declare-face 'syd-org-todo-project
|
||||
'((t (:inherit (bold font-lock-doc-face org-todo)))) "")
|
||||
(custom-declare-face 'syd-org-todo-onhold
|
||||
'((t (:inherit (bold warning org-todo)))) "")
|
||||
(custom-declare-face 'syd-org-todo-cancel
|
||||
'((t (:inherit (bold error org-todo)))) ""))
|
||||
:custom ((org-startup-folded 'content)
|
||||
(org-directory "~/org")
|
||||
;; Let the agenda be comfortably mutable by storing the list of
|
||||
;; agenda files in a file.
|
||||
(org-agenda-files "~/org/agenda-files")
|
||||
(org-agenda-deadline-faces '((1.001 . error)
|
||||
(1.0 . org-warning)
|
||||
(0.5 . org-upcoming-deadline)
|
||||
(0.0 . org-upcoming-distant-deadline)))
|
||||
(org-agenda-window-setup 'current-window)
|
||||
(org-refile-use-outline-path t)
|
||||
(org-tag-persistent-alist `(("orgmode" . ?o)
|
||||
("hrt" . ?h)))
|
||||
(org-agenda-skip-unavailable-files t)
|
||||
;; Shift the agenda to show the previous 3 days and the next 7 days
|
||||
;; for better context on your week. The past is less important than
|
||||
;; the future.
|
||||
(org-agenda-span 10)
|
||||
(org-agenda-start-on-weekday nil)
|
||||
(org-agenda-start-day "-3d")
|
||||
;; Optimize `org-agenda' by inhibiting extra work while opening
|
||||
;; agenda buffers in the background. They'll be "restarted" if the
|
||||
;; user switches to them anyway (see
|
||||
;; `syd-org-exclude-agenda-buffers-from-workspace-h')
|
||||
(org-agenda-inhibit-startup t)
|
||||
;; Upon finishing a task, leave a timestamp.
|
||||
(org-log-done 'time)
|
||||
(org-indirect-buffer-display 'current-window)
|
||||
;; Force a TeX-like syntax for {sub,super}-scripts. x^{blah blah}
|
||||
(org-use-sub-superscripts '{})
|
||||
(org-fontify-quote-and-verse-blocks t)
|
||||
(org-enforce-todo-dependencies t)
|
||||
(org-image-actual-width nil)
|
||||
(org-imenu-depth 6)
|
||||
;; Include some sane default CSS declarations when exporting to HTML.
|
||||
(org-html-head syd-org-default-css)
|
||||
;; Don't right-align tags.
|
||||
(org-tags-column 0)
|
||||
(org-priority-faces '((?A . error)
|
||||
(?B . warning)
|
||||
(?C . success)))
|
||||
;; 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)
|
||||
;; Hide markup syntax and leave the markup.
|
||||
(org-hide-emphasis-markers t)
|
||||
(org-ellipsis " […]")
|
||||
(org-todo-keywords
|
||||
'((sequence
|
||||
"TODO(t)" ; A task that needs doing & is ready to do
|
||||
"PROJ(p)" ; A project, which usually contains other tasks
|
||||
"STRT(s)" ; A task that is in progress
|
||||
"WAIT(w)" ; Something external is holding up this task
|
||||
"HOLD(h)" ; This task is paused/on hold because of me
|
||||
"IDEA(i)" ; An unconfirmed and unapproved task or notion
|
||||
"|"
|
||||
"DONE(d)" ; Task successfully completed
|
||||
"KILL(k)"))) ; Task was cancelled, aborted, or is no longer
|
||||
; applicable
|
||||
(org-todo-keyword-faces
|
||||
'(("[-]" . syd-org-todo-active)
|
||||
("STRT" . syd-org-todo-active)
|
||||
("WAIT" . syd-org-todo-onhold)
|
||||
("HOLD" . syd-org-todo-onhold)
|
||||
("PROJ" . syd-org-todo-project)
|
||||
("KILL" . syd-org-todo-cancel))))
|
||||
:preface
|
||||
;; Speed up initialisation by disabling modules we don't need.
|
||||
(defvar org-modules
|
||||
'(;; ol-w3m
|
||||
;; ol-bbdb
|
||||
ol-bibtex
|
||||
;; ol-docview
|
||||
;; ol-gnus
|
||||
;; ol-info
|
||||
;; ol-irc
|
||||
;; ol-mhe
|
||||
;; ol-rmail
|
||||
;; ol-eww
|
||||
))
|
||||
(syd-add-hook 'org-load-hook
|
||||
#'syd-org-init-popup-rules-h
|
||||
#'syd-org-init-appearance-h)
|
||||
(with-eval-after-load 'org-agenda
|
||||
(syd-org-init-agenda-h))
|
||||
:config
|
||||
(require 'syd-prose)
|
||||
(syd-add-hook 'org-mode-hook
|
||||
#'org-indent-mode
|
||||
#'syd-prose-mode)
|
||||
(syd-org-init-theme)
|
||||
(syd-org-init-keybinds))
|
||||
|
||||
(use-package org-appear
|
||||
:hook (org-mode . org-appear-mode)
|
||||
:custom (org-appear-autoemphasis t))
|
||||
|
||||
;; 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
|
||||
"d t" #'org-roam-dailies-capture-today
|
||||
"d T" #'org-roam-dailies-goto-today)
|
||||
|
||||
(general-def
|
||||
:keymaps 'syd-leader-open-map
|
||||
"A" #'org-agenda)
|
||||
|
||||
(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))
|
||||
;; Rebind Imenu keybind to `consult-org-heading'. It's similar enough in
|
||||
;; appearance and functionality, but more reliable and "correct."
|
||||
;; REVIEW: Perhaps it would be best to implement `imenu-create-index-function'
|
||||
;; using `consult-org-heading'?
|
||||
(general-def
|
||||
:keymaps 'org-mode-map
|
||||
[remap consult-imenu] #'consult-org-heading
|
||||
[remap imenu] #'consult-org-heading)
|
||||
(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)
|
||||
:commands (org-roam-buffer-toggle-display
|
||||
org-roam-dailies-capture-today
|
||||
org-roam-dailies-goto-date
|
||||
org-roam-dailies-goto-today
|
||||
org-roam-dailies-goto-tomorrow
|
||||
org-roam-dailies-goto-yesterday)
|
||||
:init (progn (syd-org--init-roam-keybinds)
|
||||
(syd-load-packages-incrementally
|
||||
'(ansi-color dash f rx seq magit-section emacsql)))
|
||||
:custom ((org-roam-directory org-directory)
|
||||
(org-roam-db-location (file-name-concat syd-data-dir
|
||||
"org-roam.db"))
|
||||
;; Make org-roam buffer sticky; i.e. don't replace it when opening a
|
||||
;; file with an *-other-window command.
|
||||
(org-roam-buffer-window-parameters '((no-delete-other-windows . t)))
|
||||
(org-roam-completion-everywhere t)
|
||||
(org-roam-dailies-capture-templates
|
||||
`(("d" "default" entry "* %?\n%U"
|
||||
:target (file+head "%<%Y-%m-%d>.org" "#+title: %<%Y-%m-%d>")
|
||||
:empty-lines 1))))
|
||||
:config
|
||||
(defun syd-org-init-roam-h ()
|
||||
"Setup `org-roam' but don't immediately initialize its database. Instead,
|
||||
initialize it when it will be actually needed."
|
||||
(cl-letf (((symbol-function #'org-roam-db-sync) #'ignore))
|
||||
(org-roam-db-autosync-enable)))
|
||||
|
||||
(syd-org--init-roam-keybinds)
|
||||
|
||||
(syd-defadvice syd-org-roam-try-init-db-a (&rest _)
|
||||
"Try to initialize org-roam database at the last possible safe moment.
|
||||
In case of failure, fail gracefully."
|
||||
:before #'org-roam-db-query
|
||||
(message "Initializing org-roam database...")
|
||||
(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))
|
||||
:straight (:type git :host github :repo "doomelpa/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)
|
||||
:config
|
||||
(add-hook 'evil-org-mode-hook #'evil-normalize-keymaps)
|
||||
(evil-org-set-key-theme))
|
||||
|
||||
(use-package evil-org-agenda
|
||||
:hook (org-agenda-mode . evil-org-agenda-mode)
|
||||
:straight nil
|
||||
: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 . hide-mode-line-mode))
|
||||
|
||||
(use-package org-superstar
|
||||
:hook (org-mode . org-superstar-mode)
|
||||
:custom ((org-superstar-headline-bullets-list '(9675))
|
||||
(org-superstar-item-bullet-alist '((?- . ?•)
|
||||
(?+ . ?➤)
|
||||
(?* . ?⋆))))
|
||||
:config
|
||||
;; Stars should use fixed-pitch font to align w/ `org-indent'.
|
||||
(custom-theme-set-faces
|
||||
'user
|
||||
`(org-superstar-header-bullet ((t (:font ,syd-alt-fixed-pitch-font))))
|
||||
`(org-superstar-item ((t (:font ,syd-alt-fixed-pitch-font))))))
|
||||
|
||||
(use-package org-fragtog
|
||||
:hook (org-mode . org-fragtog-mode))
|
||||
|
||||
(provide 'syd-org)
|
||||
;;; syd-org.el ends here
|
||||
Reference in New Issue
Block a user