feat: out with the org, in with the el

This commit is contained in:
Artur Manuel 2024-10-04 21:44:24 +01:00
commit 2aa6d7eacd
2 changed files with 15 additions and 55 deletions

181
emacs/config.el Normal file
View file

@ -0,0 +1,181 @@
(use-package emacs
:init
(defun crm-indicator (args)
(cons (format "[CRM%s] %s"
(replace-regexp-in-string
"\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" ""
crm-separator)
(car args))
(cdr args)))
(advice-add #'completing-read-multiple :filter-args #'crm-indicator)
(setq minibuffer-prompt-properties
'(read-only t cursor-intangible t face minibuffer-prompt))
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
:config
(setq inhibit-startup-screen t
initial-scratch-message nil
enable-recursive-minibuffers t
read-extended-command-predicate #'command-completion-default-include-p
tab-always-indent 'complete)
(setq-default mode-line-format nil)
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
:hook ((prog-mode . display-line-numbers-mode)
(text-mode . display-line-numbers-mode)))
(use-package spacious-padding
:ensure t
:init
(spacious-padding-mode))
(use-package nano-modeline
:ensure t
:hook ((prog-mode . nano-modeline-prog-mode)
(text-mode . nano-modeline-text-mode)
(org-mode . nano-modeline-org-mode)
(org-capture-mode . nano-modeline-org-capture-mode)
(org-agenda-mode . nano-modeline-org-agenda-mode)))
(use-package vertico
:ensure t
:init
(vertico-mode)
:config
(setq vertico-scroll-margin 0
vertico-count 8
vertico-resize nil
vertico-cycle t))
(use-package orderless
:ensure t
:custom
(completion-styles '(orderless basic))
(completion-category-defaults nil)
(completion-category-overrides '((file (styles partial-completion)))))
(use-package corfu
:ensure t
:config
(setq corfu-cycle t
corfu-auto t
corfu-scroll-margin 4)
:hook (prog-mode . corfu-mode)
:init
(global-corfu-mode))
(use-package consult
:ensure t
:bind (("C-c M-x" . consult-mode-command)
("C-c h" . consult-history)
("C-c k" . consult-kmacro)
("C-c m" . consult-man)
("C-c i" . consult-info)
("C-x M-:" . consult-complex-command)
("C-x b" . consult-buffer)
("C-x 4 b" . consult-buffer-other-window)
("C-x 5 b" . consult-buffer-other-frame)
("C-x t b" . consult-buffer-other-tab)
("C-x r b" . consult-bookmark)
("C-x p b" . consult-project-buffer)
("M-#" . consult-register-load)
("M-'" . consult-register-store)
("C-M-#" . consult-register)
("M-y" . consult-yank-pop)
("M-g e" . consult-compile-error)
("M-g f" . consult-flymake)
("M-g g" . consult-goto-line)
("M-g M-g" . consult-goto-line)
("M-g o" . consult-outline)
("M-g m" . consult-mark)
("M-g k" . consult-global-mark)
("M-g i" . consult-imenu)
("M-g I" . consult-imenu-multi)
("M-s d" . consult-find)
("M-s c" . consult-locate)
("M-s g" . consult-grep)
("M-s G" . consult-git-grep)
("M-s r" . consult-ripgrep)
("M-s l" . consult-line)
("M-s L" . consult-line-multi)
("M-s k" . consult-keep-lines)
("M-s u" . consult-focus-lines)
("M-s e" . consult-isearch-history)
:map isearch-mode-map
("M-e" . consult-isearch-history)
("M-s e" . consult-isearch-history)
("M-s l" . consult-line)
("M-s L" . consult-line-multi)
:map minibuffer-local-map
("M-s" . consult-history)
("M-r" . consult-history))
:hook (completion-list-mode . consult-preview-at-point-mode)
:init
(setq register-preview-delay 0.5
register-preview-function #'consult-register-format)
(advice-add #'register-preview :override #'consult-register-window)
(setq xref-show-xrefs-function #'consult-xref
xref-show-definitions-function #'consult-xref)
:config
(consult-customize
consult-theme :preview-key '(:debounce 0.2 any)
consult-ripgrep consult-git-grep consult-grep
consult-bookmark consult-recent-file consult-xref
consult--source-bookmark consult--source-file-register
consult--source-recent-file consult--source-project-recent-file
:preview-key '(:debounce 0.4 any))
(setq consult-narrow-key "C-+"))
(use-package marginalia
:ensure t
:bind (:map minibuffer-local-map
("M-A" . marginalia-cycle))
:init
(marginalia-mode))
(use-package savehist
:init
(savehist-mode))
(use-package embark
:ensure t
:bind
(("C-." . embark-act)
("C-;" . embark-dwim)
("C-h B" . embark-bindings))
:init
(setq prefix-help-command #'embark-prefix-help-command)
(add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target)
(setq eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly)
:config
(add-to-list 'display-buffer-alist
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
nil
(window-parameters (mode-line-format . none))))
(setq embark-indicators
'(embark-minimal-indicator
embark-highlight-indicator
embark-isearch-highlight-indicator)))
(use-package which-key
:ensure t
:init (which-key-mode))
(use-package embark-consult
:ensure t
:hook
(embark-collect-mode . consult-preview-at-point-mode))
(use-package consult-dir
:ensure t
:bind (("C-x C-d" . consult-dir)
:map minibuffer-local-completion-map
("C-x C-d" . consult-dir)
("C-x C-j" . consult-dir-jump-file)))
(use-package base16-theme
:ensure t
:config
(load-theme 'base16-oxocarbon-dark t))
(provide 'config)

View file

@ -18,59 +18,23 @@ in
package = emacs;
defaultInitFile = true;
alwaysEnsure = true;
alwaysTangle = true;
config = ./config.org;
config = ./config.el;
extraEmacsPackages =
e:
builtins.attrValues {
inherit (e)
nix-mode
vertico
orderless
marginalia
embark
consult
embark-consult
consult-dir
doom-modeline
flycheck
which-key
lsp-mode
lsp-ui
lsp-pyright
treemacs
lsp-treemacs
consult-lsp
treemacs-icons-dired
treemacs-nerd-icons
nerd-icons
all-the-icons
projectile
treemacs-projectile
magit
treemacs-magit
rustic
haskell-mode
envrc
ccls
org-roam
spacious-padding
mood-line
ement
autothemer
geiser-guile
lsp-haskell
catppuccin-theme
zig-mode
nano-modeline
orderless
corfu
which-key
marginalia
vertico
consult
embark
embark-consult
base16-theme
;
treesit-grammars = e.treesit-grammars.with-all-grammars;
inherit (pkgs) python3;
# oxocarbon-theme = mkEmacsPackage e "oxocarbon-theme" "0.1.0" (pkgs.fetchurl {
# url = "https://raw.githubusercontent.com/konrad1977/emacs/main/themes/oxocarbon-theme.el";
# hash = "sha256-jD4DYc7aePuAF3m323YAi7jzE6ZpsSWb/zdmEgjFCns=";
# }) [ e.autothemer ];
};
override = _: prev: { use-package = prev.emacs; };
};