Config: load all org-mode files in config directory
Add all config files to refile targets without being in agenda-files Move completion configs (vertico, corfu, etc...) into own file (from ide)
This commit is contained in:
parent
d8993960a6
commit
29bdd978bf
147
config/completion.org
Normal file
147
config/completion.org
Normal file
|
@ -0,0 +1,147 @@
|
|||
#+title: Completion
|
||||
#+author: Evie Litherland-Smith
|
||||
* Vertico
|
||||
#+begin_src emacs-lisp
|
||||
(use-package vertico
|
||||
:ensure t
|
||||
:diminish
|
||||
:custom
|
||||
(vertico-cycle t)
|
||||
:init
|
||||
(vertico-mode)
|
||||
:config
|
||||
(require 'vertico-directory))
|
||||
#+end_src
|
||||
|
||||
* Marginalia
|
||||
#+begin_src emacs-lisp
|
||||
(use-package marginalia
|
||||
:ensure t
|
||||
:diminish
|
||||
:custom
|
||||
(marginalia-annotators '(marginalia-annotators-heavy
|
||||
marginalia-annotators-light
|
||||
nil))
|
||||
:config (marginalia-mode +1))
|
||||
#+end_src
|
||||
|
||||
* Orderless
|
||||
#+begin_src emacs-lisp
|
||||
(use-package orderless
|
||||
:ensure t
|
||||
:diminish
|
||||
:custom
|
||||
(completion-styles '(orderless basic))
|
||||
(completion-category-defaults nil)
|
||||
(completion-category-overrides '((file (styles . (partial-completion))))))
|
||||
#+end_src
|
||||
|
||||
* Corfu and Cape
|
||||
#+begin_src emacs-lisp
|
||||
(use-package corfu
|
||||
:ensure t
|
||||
:diminish
|
||||
:demand
|
||||
:custom
|
||||
(corfu-cycle t)
|
||||
(corfu-auto t)
|
||||
(corfu-auto-delay 0.2)
|
||||
(corfu-auto-prefix 2)
|
||||
(corfu-quit-no-match 'separator)
|
||||
(corfu-quit-at-boundary 'separator)
|
||||
(corfu-preview-current nil)
|
||||
(corfu-preselect 'directory)
|
||||
:bind ( :map corfu-map
|
||||
("M-SPC" . corfu-insert-separator)
|
||||
("RET" . nil)
|
||||
("TAB" . corfu-insert)
|
||||
([tab] . corfu-insert))
|
||||
:init
|
||||
(global-corfu-mode +1)
|
||||
(corfu-history-mode +1)
|
||||
:config
|
||||
(when (require 'corfu-popupinfo nil :noerror)
|
||||
(corfu-popupinfo-mode +1)
|
||||
(keymap-set corfu-map "M-p" #'corfu-popupinfo-scroll-down)
|
||||
(keymap-set corfu-map "M-n" #'corfu-popupinfo-scroll-up)
|
||||
(keymap-set corfu-map "M-d" #'corfu-popupinfo-toggle))
|
||||
|
||||
(defun corfu-enable-always-in-minibuffer ()
|
||||
"Enable Corfu in the minibuffer if Vertico is not active."
|
||||
(unless (or (bound-and-true-p vertico--input)
|
||||
(eq (current-local-map) read-passwd-map))
|
||||
(setq-local corfu-echo-delay nil ;; Disable automatic echo and popup
|
||||
corfu-auto nil ;; Enable/disable auto completion
|
||||
corfu-popupinfo-delay nil)
|
||||
(corfu-mode +1)))
|
||||
(add-hook 'minibuffer-setup-hook #'corfu-enable-always-in-minibuffer 1)
|
||||
|
||||
(defun my/local-corfu-no-auto () (setq-local corfu-auto nil))
|
||||
(with-eval-after-load 'eshell (add-hook 'eshell-mode-hook 'my/local-corfu-no-auto))
|
||||
(with-eval-after-load 'shell (add-hook 'shell-mode-hook 'my/local-corfu-no-auto))
|
||||
(with-eval-after-load 'gud (add-hook 'gud-mode-hook 'my/local-corfu-no-auto)))
|
||||
|
||||
(require 'corfu)
|
||||
|
||||
(use-package cape
|
||||
:ensure t
|
||||
:diminish
|
||||
:demand
|
||||
:init
|
||||
(add-to-list 'completion-at-point-functions #'cape-emoji)
|
||||
(add-to-list 'completion-at-point-functions #'cape-file)
|
||||
(add-to-list 'completion-at-point-functions #'cape-dabbrev)
|
||||
:custom
|
||||
(cape-dabbrev-min-length (+ corfu-auto-prefix 1)))
|
||||
|
||||
(require 'cape)
|
||||
#+end_src
|
||||
|
||||
* Consult
|
||||
#+begin_src emacs-lisp
|
||||
(use-package consult
|
||||
:ensure t
|
||||
:diminish
|
||||
:bind (("<remap> <imenu>" . consult-imenu)
|
||||
("<remap> <switch-to-buffer>" . consult-buffer)
|
||||
("<remap> <project-switch-to-buffer>" . consult-project-buffer)
|
||||
("<remap> <org-goto>" . consult-org-heading)
|
||||
("C-c s l" . consult-line)
|
||||
("C-c s r" . consult-recent-file)
|
||||
("C-c s f" . consult-fd)
|
||||
("C-c s g" . consult-ripgrep)
|
||||
("C-c s e" . consult-flymake)
|
||||
("C-c s j" . consult-imenu)
|
||||
("C-c s i" . consult-info)
|
||||
:map minibuffer-local-map
|
||||
("C-r" . consult-history))
|
||||
:config (setq completion-in-region-function #'consult-completion-in-region))
|
||||
|
||||
(use-package consult-eglot
|
||||
:ensure t
|
||||
:diminish
|
||||
:after (consult eglot)
|
||||
:bind (("C-c s s" . consult-eglot-symbols)))
|
||||
|
||||
(use-package consult-yasnippet
|
||||
:ensure t
|
||||
:diminish
|
||||
:after (consult yasnippet)
|
||||
:bind (("C-c s y" . consult-yasnippet)))
|
||||
#+end_src
|
||||
|
||||
* Embark
|
||||
#+begin_src emacs-lisp
|
||||
(use-package embark
|
||||
:ensure t
|
||||
:diminish
|
||||
:bind (("<remap> <describe-bindings>" . embark-bindings)
|
||||
("C-." . embark-act))
|
||||
:config (setq prefix-help-command #'embark-prefix-help-command))
|
||||
|
||||
(use-package embark-consult
|
||||
:ensure t
|
||||
:diminish
|
||||
:after (embark consult)
|
||||
:hook (embark-collect-mode . consult-preview-at-point-mode))
|
||||
#+end_src
|
145
config/ide.org
145
config/ide.org
|
@ -212,152 +212,7 @@ Set treesit to fontify all elements, default was 3 (out of 4)
|
|||
("\\`\\(?:sourcehut:\\|sh:\\)\\([^:]+\\)\\'" "git.sr.ht" "sourcehut.user")
|
||||
("\\`\\(?:gitea:\\|gt:\\)\\([^:]+\\)\\'" "git.xenia.me.uk" "gitea.user"))))
|
||||
#+end_src
|
||||
* Completion
|
||||
** Vertico
|
||||
#+begin_src emacs-lisp
|
||||
(use-package vertico
|
||||
:ensure t
|
||||
:diminish
|
||||
:custom
|
||||
(vertico-cycle t)
|
||||
:init
|
||||
(vertico-mode)
|
||||
:config
|
||||
(require 'vertico-directory))
|
||||
#+end_src
|
||||
|
||||
** Marginalia
|
||||
#+begin_src emacs-lisp
|
||||
(use-package marginalia
|
||||
:ensure t
|
||||
:diminish
|
||||
:custom
|
||||
(marginalia-annotators '(marginalia-annotators-heavy
|
||||
marginalia-annotators-light
|
||||
nil))
|
||||
:config (marginalia-mode +1))
|
||||
#+end_src
|
||||
|
||||
** Orderless
|
||||
#+begin_src emacs-lisp
|
||||
(use-package orderless
|
||||
:ensure t
|
||||
:diminish
|
||||
:custom
|
||||
(completion-styles '(orderless basic))
|
||||
(completion-category-defaults nil)
|
||||
(completion-category-overrides '((file (styles . (partial-completion))))))
|
||||
#+end_src
|
||||
|
||||
** Corfu and Cape
|
||||
#+begin_src emacs-lisp
|
||||
(use-package corfu
|
||||
:ensure t
|
||||
:diminish
|
||||
:demand
|
||||
:custom
|
||||
(corfu-cycle t)
|
||||
(corfu-auto t)
|
||||
(corfu-auto-delay 0.2)
|
||||
(corfu-auto-prefix 2)
|
||||
(corfu-quit-no-match 'separator)
|
||||
(corfu-quit-at-boundary 'separator)
|
||||
(corfu-preview-current nil)
|
||||
(corfu-preselect 'directory)
|
||||
:bind ( :map corfu-map
|
||||
("M-SPC" . corfu-insert-separator)
|
||||
("RET" . nil)
|
||||
("TAB" . corfu-insert)
|
||||
([tab] . corfu-insert))
|
||||
:init
|
||||
(global-corfu-mode +1)
|
||||
(corfu-history-mode +1)
|
||||
:config
|
||||
(when (require 'corfu-popupinfo nil :noerror)
|
||||
(corfu-popupinfo-mode +1)
|
||||
(keymap-set corfu-map "M-p" #'corfu-popupinfo-scroll-down)
|
||||
(keymap-set corfu-map "M-n" #'corfu-popupinfo-scroll-up)
|
||||
(keymap-set corfu-map "M-d" #'corfu-popupinfo-toggle))
|
||||
|
||||
(defun corfu-enable-always-in-minibuffer ()
|
||||
"Enable Corfu in the minibuffer if Vertico is not active."
|
||||
(unless (or (bound-and-true-p vertico--input)
|
||||
(eq (current-local-map) read-passwd-map))
|
||||
(setq-local corfu-echo-delay nil ;; Disable automatic echo and popup
|
||||
corfu-auto nil ;; Enable/disable auto completion
|
||||
corfu-popupinfo-delay nil)
|
||||
(corfu-mode +1)))
|
||||
(add-hook 'minibuffer-setup-hook #'corfu-enable-always-in-minibuffer 1)
|
||||
|
||||
(defun my/local-corfu-no-auto () (setq-local corfu-auto nil))
|
||||
(with-eval-after-load 'eshell (add-hook 'eshell-mode-hook 'my/local-corfu-no-auto))
|
||||
(with-eval-after-load 'shell (add-hook 'shell-mode-hook 'my/local-corfu-no-auto))
|
||||
(with-eval-after-load 'gud (add-hook 'gud-mode-hook 'my/local-corfu-no-auto)))
|
||||
|
||||
(require 'corfu)
|
||||
|
||||
(use-package cape
|
||||
:ensure t
|
||||
:diminish
|
||||
:demand
|
||||
:init
|
||||
(add-to-list 'completion-at-point-functions #'cape-emoji)
|
||||
(add-to-list 'completion-at-point-functions #'cape-file)
|
||||
(add-to-list 'completion-at-point-functions #'cape-dabbrev)
|
||||
:custom
|
||||
(cape-dabbrev-min-length (+ corfu-auto-prefix 1)))
|
||||
|
||||
(require 'cape)
|
||||
#+end_src
|
||||
|
||||
** Consult
|
||||
#+begin_src emacs-lisp
|
||||
(use-package consult
|
||||
:ensure t
|
||||
:diminish
|
||||
:bind (("<remap> <imenu>" . consult-imenu)
|
||||
("<remap> <switch-to-buffer>" . consult-buffer)
|
||||
("<remap> <project-switch-to-buffer>" . consult-project-buffer)
|
||||
("<remap> <org-goto>" . consult-org-heading)
|
||||
("C-c s l" . consult-line)
|
||||
("C-c s r" . consult-recent-file)
|
||||
("C-c s f" . consult-fd)
|
||||
("C-c s g" . consult-ripgrep)
|
||||
("C-c s e" . consult-flymake)
|
||||
("C-c s j" . consult-imenu)
|
||||
("C-c s i" . consult-info)
|
||||
:map minibuffer-local-map
|
||||
("C-r" . consult-history))
|
||||
:config (setq completion-in-region-function #'consult-completion-in-region))
|
||||
|
||||
(use-package consult-eglot
|
||||
:ensure t
|
||||
:diminish
|
||||
:after (consult eglot)
|
||||
:bind (("C-c s s" . consult-eglot-symbols)))
|
||||
|
||||
(use-package consult-yasnippet
|
||||
:ensure t
|
||||
:diminish
|
||||
:after (consult yasnippet)
|
||||
:bind (("C-c s y" . consult-yasnippet)))
|
||||
#+end_src
|
||||
|
||||
** Embark
|
||||
#+begin_src emacs-lisp
|
||||
(use-package embark
|
||||
:ensure t
|
||||
:diminish
|
||||
:bind (("<remap> <describe-bindings>" . embark-bindings)
|
||||
("C-." . embark-act))
|
||||
:config (setq prefix-help-command #'embark-prefix-help-command))
|
||||
|
||||
(use-package embark-consult
|
||||
:ensure t
|
||||
:diminish
|
||||
:after (embark consult)
|
||||
:hook (embark-collect-mode . consult-preview-at-point-mode))
|
||||
#+end_src
|
||||
* Snippets
|
||||
#+begin_src emacs-lisp
|
||||
(use-package yasnippet-snippets :ensure t)
|
||||
|
|
|
@ -21,10 +21,6 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
|
|||
org-refile-use-outline-path 'file
|
||||
org-refile-targets '((nil . (:maxlevel . 2))))
|
||||
|
||||
;; Add emacs config files to `org-file-targets'
|
||||
;; Need to make this a bit more flexible at some point
|
||||
;; (add-to-list 'org-refile-targets (list ((locate-user-emacs-file "crafted.org") . (:maxlevel . 1))) t)
|
||||
|
||||
;; Visually indent org-mode files to a given header level
|
||||
(add-hook 'org-mode-hook #'org-indent-mode)
|
||||
|
||||
|
@ -168,6 +164,13 @@ Better syncing to mobile, for use with [[https://github.com/orgzly-revived/orgzl
|
|||
(org-noter-prefer-root-as-file-level nil))
|
||||
#+end_src
|
||||
|
||||
* Refile to config
|
||||
#+begin_src emacs-lisp
|
||||
;; Add emacs config files to `org-file-targets'
|
||||
(dolist (fname my/config-files)
|
||||
(add-to-list 'org-refile-targets (cons fname '(:maxlevel . 2)) t))
|
||||
#+end_src
|
||||
|
||||
* citar
|
||||
#+begin_src emacs-lisp :results output silent
|
||||
(use-package citar
|
||||
|
|
19
init.el
19
init.el
|
@ -5,20 +5,11 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(dolist
|
||||
(fname '(
|
||||
"config/defaults.org" ;Common defaults that don't really sit anywhere else
|
||||
"config/ui.org" ;Theme and associated setups
|
||||
"config/ide.org" ;Setup to be an integrated development environment
|
||||
"config/tramp.org" ;Setup for remote editing using `tramp'
|
||||
"config/writing.org" ;Setup for writing documents
|
||||
"config/org-mode.org" ;Setup for writing `org-mode' documents specifically
|
||||
"config/pass.org" ;password-store integration
|
||||
"config/internet.org" ;Email and feed reader config
|
||||
"config/media.org" ;Music player using `emms'
|
||||
))
|
||||
(org-babel-load-file
|
||||
(locate-user-emacs-file fname)))
|
||||
(defvar my/config-files () "List of literate config files to load.")
|
||||
|
||||
(setq my/config-files (directory-files (locate-user-emacs-file "config") t ".org"))
|
||||
|
||||
(dolist (fname my/config-files) (org-babel-load-file fname))
|
||||
|
||||
(provide 'init)
|
||||
;;; init.el ends here
|
||||
|
|
Loading…
Reference in a new issue