Modularizing emacs config
This commit is contained in:
311
home.org
311
home.org
@@ -645,35 +645,14 @@ Actually, nix *really* requires ~bash~. This is a plugin that allows using zsh f
|
|||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
* Emacs
|
* Emacs
|
||||||
:PROPERTIES:
|
|
||||||
:header-args:elisp: :tangle target/emacs.el
|
|
||||||
:header-args:nix: :noweb no-export :noweb-ref emacs_packages
|
|
||||||
:END:
|
|
||||||
|
|
||||||
Emacs is a huge portion of this configuration, so although it's a home-manager "program", I'm
|
Emacs is a huge portion of this configuration, so although it's a home-manager "program", I'm
|
||||||
breaking it out into its own top-level section. Many of the sections here have two code blocks: a
|
breaking it out into its own top-level section. Many of the sections here have two code blocks: a
|
||||||
nix code block listing the emacs packages to include, and an elisp code block to configure them in
|
nix code block listing the emacs packages to include, and an elisp code block to configure them in
|
||||||
emacs.
|
emacs.
|
||||||
|
|
||||||
#+BEGIN_SRC nix :tangle target/emacs.nix :noweb-ref
|
We'll put the actual emacs configs into separate files, rather than into nix string literals. This
|
||||||
{
|
|
||||||
programs.emacs = {
|
|
||||||
enable = true;
|
|
||||||
extraPackages = epkgs: with epkgs; [
|
|
||||||
<<emacs_packages>>
|
|
||||||
];
|
|
||||||
extraConfig = builtins.readFile ./emacs.el;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
We'll put the actual emacs config into a separate file, rather than into a nix string literal. This
|
|
||||||
helps with a few places where nix's string interpolation was causing problems.
|
helps with a few places where nix's string interpolation was causing problems.
|
||||||
|
|
||||||
#+begin_src elisp
|
|
||||||
;;; -*- lexical-binding: t -*-
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Keybindings
|
** Keybindings
|
||||||
These keybindings are scattered throughout this file, I'm collecting them all here to make it easier
|
These keybindings are scattered throughout this file, I'm collecting them all here to make it easier
|
||||||
to track them.
|
to track them.
|
||||||
@@ -697,18 +676,30 @@ to track them.
|
|||||||
| C-c M-g | | [[id:4F426E77-CE03-4BF8-8D1B-7791C7C02B28][Magit file dispatch]] | |
|
| C-c M-g | | [[id:4F426E77-CE03-4BF8-8D1B-7791C7C02B28][Magit file dispatch]] | |
|
||||||
|
|
||||||
** Global Settings
|
** Global Settings
|
||||||
|
:PROPERTIES:
|
||||||
|
:header-args:elisp: :tangle target/emacs-global.el
|
||||||
|
:END:
|
||||||
These are just some general settings that apply everywhere. First, a few packages:
|
These are just some general settings that apply everywhere. First, a few packages:
|
||||||
|
|
||||||
#+BEGIN_SRC nix :noweb-ref emacs_packages
|
#+BEGIN_SRC nix :tangle target/emacs-global.nix
|
||||||
doom-modeline
|
{
|
||||||
ligature
|
programs.emacs = {
|
||||||
mixed-pitch
|
enable = true;
|
||||||
ace-window
|
extraPackages = epkgs: with epkgs; [
|
||||||
|
doom-modeline
|
||||||
|
ligature
|
||||||
|
mixed-pitch
|
||||||
|
ace-window
|
||||||
|
];
|
||||||
|
extraConfig = builtins.readFile ./emacs-global.el;
|
||||||
|
};
|
||||||
|
}
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
Turn off some default settings that I don't find useful.
|
Turn off some default settings that I don't find useful.
|
||||||
|
|
||||||
#+BEGIN_SRC elisp
|
#+BEGIN_SRC elisp
|
||||||
|
;;; -*- lexical-binding: t -*-
|
||||||
(setq inhibit-startup-screen t)
|
(setq inhibit-startup-screen t)
|
||||||
(setq initial-scratch-message nil)
|
(setq initial-scratch-message nil)
|
||||||
(menu-bar-mode -1)
|
(menu-bar-mode -1)
|
||||||
@@ -892,7 +883,7 @@ move backward / forward through history.
|
|||||||
"<right>" #'tab-bar-history-forward))
|
"<right>" #'tab-bar-history-forward))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** Window Placement
|
*** Window Placement
|
||||||
This section contains rules about where ~display-buffer~ should place windows. I guess I'm currently
|
This section contains rules about where ~display-buffer~ should place windows. I guess I'm currently
|
||||||
going for an IDE-style layout, with one main editor window, and auxiliary bottom and right side
|
going for an IDE-style layout, with one main editor window, and auxiliary bottom and right side
|
||||||
windows. I place windows in the bottom or on the right mostly depending on how wide I expect their
|
windows. I place windows in the bottom or on the right mostly depending on how wide I expect their
|
||||||
@@ -947,16 +938,27 @@ content to be.
|
|||||||
window-persistent-parameters))
|
window-persistent-parameters))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
** Editing
|
** Editing
|
||||||
|
:PROPERTIES:
|
||||||
|
:header-args:elisp: :tangle target/emacs-editing.el
|
||||||
|
:END:
|
||||||
|
|
||||||
This configuration affects general text editing, across all modes. First, some packages:
|
This configuration affects general text editing, across all modes. First, some packages:
|
||||||
|
|
||||||
#+BEGIN_SRC nix
|
#+BEGIN_SRC nix :tangle target/emacs-editing.nix
|
||||||
avy
|
{
|
||||||
devil
|
programs.emacs = {
|
||||||
edit-indirect
|
enable = true;
|
||||||
embark
|
extraPackages = epkgs: with epkgs; [
|
||||||
god-mode
|
avy
|
||||||
string-inflection
|
devil
|
||||||
|
edit-indirect
|
||||||
|
embark
|
||||||
|
god-mode
|
||||||
|
string-inflection
|
||||||
|
];
|
||||||
|
extraConfig = builtins.readFile ./emacs-editing.el;
|
||||||
|
};
|
||||||
|
}
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
I find Emacs to be almost unusable on a normal keyboard unless there's some way to avoid all the
|
I find Emacs to be almost unusable on a normal keyboard unless there's some way to avoid all the
|
||||||
@@ -1072,22 +1074,33 @@ Just "silently" wrap when searching at the bottom of a document.
|
|||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** Language Support
|
** Language Support
|
||||||
|
:PROPERTIES:
|
||||||
|
:header-args:elisp: :tangle target/emacs-languages.el
|
||||||
|
:END:
|
||||||
|
|
||||||
#+BEGIN_SRC nix
|
#+BEGIN_SRC nix
|
||||||
consult-eglot
|
{
|
||||||
haskell-ts-mode
|
programs.emacs = {
|
||||||
jenkinsfile-mode
|
enable = true;
|
||||||
lispy
|
extraPackages = epkgs: with epkgs; [
|
||||||
lua-mode
|
consult-eglot
|
||||||
nix-mode
|
haskell-ts-mode
|
||||||
rust-mode
|
jenkinsfile-mode
|
||||||
smartparens
|
lispy
|
||||||
sly
|
lua-mode
|
||||||
sly-macrostep
|
nix-mode
|
||||||
sql-indent
|
rust-mode
|
||||||
tree-sitter
|
smartparens
|
||||||
treesit-grammars.with-all-grammars
|
sly
|
||||||
yaml-pro
|
sly-macrostep
|
||||||
|
sql-indent
|
||||||
|
tree-sitter
|
||||||
|
treesit-grammars.with-all-grammars
|
||||||
|
yaml-pro
|
||||||
|
];
|
||||||
|
extraConfig = builtins.readFile ./emacs-languages.el;
|
||||||
|
};
|
||||||
|
}
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
I had some weird problems with jsx code where the default M-q would just do a text fill rather than
|
I had some weird problems with jsx code where the default M-q would just do a text fill rather than
|
||||||
@@ -1296,9 +1309,20 @@ available? It seems to work for now anyway...
|
|||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** Envrc
|
** Envrc
|
||||||
|
:PROPERTIES:
|
||||||
|
:header-args:elisp: :tangle target/emacs-envrc.el
|
||||||
|
:END:
|
||||||
|
|
||||||
#+BEGIN_SRC nix
|
#+BEGIN_SRC nix :tangle target/emacs-envrc.nix
|
||||||
envrc
|
{
|
||||||
|
programs.emacs = {
|
||||||
|
enable = true;
|
||||||
|
extraPackages = epkgs: with epkgs; [
|
||||||
|
envrc
|
||||||
|
];
|
||||||
|
extraConfig = builtins.readFile ./emacs-envrc.el;
|
||||||
|
};
|
||||||
|
}
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+BEGIN_SRC elisp
|
#+BEGIN_SRC elisp
|
||||||
@@ -1309,13 +1333,24 @@ available? It seems to work for now anyway...
|
|||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** Magit
|
** Magit
|
||||||
|
:PROPERTIES:
|
||||||
|
:header-args:elisp: :tangle target/emacs-magit.el
|
||||||
|
:END:
|
||||||
|
|
||||||
#+BEGIN_SRC nix
|
#+BEGIN_SRC nix :tangle target/emacs-magit.nix
|
||||||
consult-gh
|
{
|
||||||
diff-hl
|
programs.emacs = {
|
||||||
forge
|
enable = true;
|
||||||
git-timemachine
|
extraPackages = epkgs: with epkgs; [
|
||||||
magit
|
consult-gh
|
||||||
|
diff-hl
|
||||||
|
forge
|
||||||
|
git-timemachine
|
||||||
|
magit
|
||||||
|
];
|
||||||
|
extraConfig = builtins.readFile ./emacs-magit.el;
|
||||||
|
};
|
||||||
|
}
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+BEGIN_SRC elisp
|
#+BEGIN_SRC elisp
|
||||||
@@ -1350,15 +1385,26 @@ available? It seems to work for now anyway...
|
|||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** Vertico
|
** Vertico
|
||||||
|
:PROPERTIES:
|
||||||
|
:header-args:elisp: :tangle target/emacs-vertico.el
|
||||||
|
:END:
|
||||||
|
|
||||||
#+BEGIN_SRC nix
|
#+BEGIN_SRC nix :tangle target/emacs-vertico.nix
|
||||||
cape
|
{
|
||||||
consult
|
programs.emacs = {
|
||||||
corfu
|
enable = true;
|
||||||
embark-consult
|
extraPackages = epkgs: with epkgs; [
|
||||||
marginalia
|
cape
|
||||||
orderless
|
consult
|
||||||
vertico
|
corfu
|
||||||
|
embark-consult
|
||||||
|
marginalia
|
||||||
|
orderless
|
||||||
|
vertico
|
||||||
|
];
|
||||||
|
extraConfig = builtins.readFile ./emacs-vertico.el;
|
||||||
|
};
|
||||||
|
}
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+BEGIN_SRC elisp
|
#+BEGIN_SRC elisp
|
||||||
@@ -1464,14 +1510,25 @@ available? It seems to work for now anyway...
|
|||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** Org
|
** Org
|
||||||
|
:PROPERTIES:
|
||||||
|
:header-args:elisp: :tangle target/emacs-org.el
|
||||||
|
:END:
|
||||||
|
|
||||||
#+BEGIN_SRC nix
|
#+BEGIN_SRC nix :tangle target/emacs-org.nix
|
||||||
org-modern
|
{
|
||||||
org-present
|
programs.emacs = {
|
||||||
org-roam
|
enable = true;
|
||||||
ox-slack
|
extraPackages = epkgs: with epkgs; [
|
||||||
verb
|
org-modern
|
||||||
visual-fill-column
|
org-present
|
||||||
|
org-roam
|
||||||
|
ox-slack
|
||||||
|
verb
|
||||||
|
visual-fill-column
|
||||||
|
];
|
||||||
|
extraConfig = builtins.readFile ./emacs-org.el;
|
||||||
|
};
|
||||||
|
}
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+BEGIN_SRC elisp
|
#+BEGIN_SRC elisp
|
||||||
@@ -1602,9 +1659,20 @@ available? It seems to work for now anyway...
|
|||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** Terminal
|
** Terminal
|
||||||
|
:PROPERTIES:
|
||||||
|
:header-args:elisp: :tangle target/emacs-terminal.el
|
||||||
|
:END:
|
||||||
|
|
||||||
#+BEGIN_SRC nix
|
#+BEGIN_SRC nix :tangle target/emacs-terminal.nix
|
||||||
eat
|
{
|
||||||
|
programs.emacs = {
|
||||||
|
enable = true;
|
||||||
|
extraPackages = epkgs: with epkgs; [
|
||||||
|
eat
|
||||||
|
];
|
||||||
|
extraConfig = builtins.readFile ./emacs-terminal.el;
|
||||||
|
};
|
||||||
|
}
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+BEGIN_SRC elisp
|
#+BEGIN_SRC elisp
|
||||||
@@ -1614,9 +1682,20 @@ available? It seems to work for now anyway...
|
|||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** Slack
|
** Slack
|
||||||
|
:PROPERTIES:
|
||||||
|
:header-args:elisp: :tangle target/emacs-slack.el
|
||||||
|
:END:
|
||||||
|
|
||||||
#+BEGIN_SRC nix
|
#+BEGIN_SRC nix
|
||||||
slack
|
{
|
||||||
|
programs.emacs = {
|
||||||
|
enable = true;
|
||||||
|
extraPackages = epkgs: with epkgs; [
|
||||||
|
slack
|
||||||
|
];
|
||||||
|
extraConfig = builtins.readFile ./emacs-slack.el;
|
||||||
|
}
|
||||||
|
}
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+BEGIN_SRC elisp
|
#+BEGIN_SRC elisp
|
||||||
@@ -1634,9 +1713,20 @@ available? It seems to work for now anyway...
|
|||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** Kubernetes
|
** Kubernetes
|
||||||
|
:PROPERTIES:
|
||||||
|
:header-args:elisp: :tangle target/emacs-kubernetes.el
|
||||||
|
:END:
|
||||||
|
|
||||||
#+BEGIN_SRC nix
|
#+BEGIN_SRC nix :tangle target/emacs-kubernetes.nix
|
||||||
kubed
|
{
|
||||||
|
programs.emacs = {
|
||||||
|
enable = true;
|
||||||
|
extraPackages = epkgs: with epkgs; [
|
||||||
|
kubed
|
||||||
|
];
|
||||||
|
extraConfig = builtins.readFile ./emacs-kubernetes.el;
|
||||||
|
};
|
||||||
|
}
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+BEGIN_SRC elisp
|
#+BEGIN_SRC elisp
|
||||||
@@ -1647,14 +1737,32 @@ available? It seems to work for now anyway...
|
|||||||
|
|
||||||
** Ledger
|
** Ledger
|
||||||
|
|
||||||
#+BEGIN_SRC nix
|
#+BEGIN_SRC nix :tangle target/emacs-ledger.el
|
||||||
ledger-mode
|
{
|
||||||
|
programs.emacs = {
|
||||||
|
enable = true;
|
||||||
|
extraPackages = epkgs: with epkgs; [
|
||||||
|
ledger-mode
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** Age
|
** Age
|
||||||
|
:PROPERTIES:
|
||||||
|
:header-args:elisp: :tangle target/emacs-age.el
|
||||||
|
:END:
|
||||||
|
|
||||||
#+BEGIN_SRC nix
|
#+BEGIN_SRC nix :tangle target/emacs-age.nix
|
||||||
age
|
{
|
||||||
|
programs.emacs = {
|
||||||
|
enable = true;
|
||||||
|
extraPackages = epkgs: with epkgs; [
|
||||||
|
age
|
||||||
|
];
|
||||||
|
extraConfig = builtins.readFile ./emacs-age.el;
|
||||||
|
};
|
||||||
|
}
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+BEGIN_SRC elisp
|
#+BEGIN_SRC elisp
|
||||||
@@ -1667,29 +1775,6 @@ age
|
|||||||
(age-file-enable))
|
(age-file-enable))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** Snippets
|
|
||||||
|
|
||||||
#+BEGIN_SRC nix
|
|
||||||
yasnippet
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
#+BEGIN_SRC elisp
|
|
||||||
(yas-global-mode)
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
*** Org Mode
|
|
||||||
|
|
||||||
#+BEGIN_SRC snippet :tangle target/snippets/org-mode/src
|
|
||||||
# name: SRC block
|
|
||||||
# key: src
|
|
||||||
# expand-env: ((yas-indent-line 'fixed))
|
|
||||||
# --
|
|
||||||
|
|
||||||
,#+BEGIN_SRC ${1:elisp}
|
|
||||||
$0
|
|
||||||
,#+END_SRC
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
* Theme
|
* Theme
|
||||||
I like Catppuccin Frappe as my theme. Let's use it in as many places as we can.
|
I like Catppuccin Frappe as my theme. Let's use it in as many places as we can.
|
||||||
|
|
||||||
@@ -1780,11 +1865,23 @@ I like Catppuccin Frappe as my theme. Let's use it in as many places as we can.
|
|||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** Emacs
|
** Emacs
|
||||||
#+BEGIN_SRC nix :noweb-ref "emacs_packages"
|
:PROPERTIES:
|
||||||
catppuccin-theme
|
:header-args:elisp: :tangle target/emacs-theme.el
|
||||||
|
:END:
|
||||||
|
|
||||||
|
#+BEGIN_SRC nix :tangle target/emacs-theme.nix
|
||||||
|
{
|
||||||
|
programs.emacs = {
|
||||||
|
enable = true;
|
||||||
|
extraPackages = epkgs: with epkgs; [
|
||||||
|
catppuccin-theme
|
||||||
|
];
|
||||||
|
extraConfig = builtins.readFile ./emacs-theme.el;
|
||||||
|
};
|
||||||
|
}
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+BEGIN_SRC elisp :tangle target/emacs.el
|
#+BEGIN_SRC elisp
|
||||||
(use-package catppuccin-theme
|
(use-package catppuccin-theme
|
||||||
:custom
|
:custom
|
||||||
(catppuccin-flavor 'frappe)
|
(catppuccin-flavor 'frappe)
|
||||||
|
|||||||
Reference in New Issue
Block a user