aboutsummaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
Diffstat (limited to '.config')
-rw-r--r--.config/emacs/completion-at-point.el6
-rw-r--r--.config/emacs/completion-sorting.el57
-rw-r--r--.config/emacs/early-init.el6
-rw-r--r--.config/emacs/init.el12
-rw-r--r--.config/emacs/minibuffer.el50
5 files changed, 82 insertions, 49 deletions
diff --git a/.config/emacs/completion-at-point.el b/.config/emacs/completion-at-point.el
index cc8f2d3..daba51f 100644
--- a/.config/emacs/completion-at-point.el
+++ b/.config/emacs/completion-at-point.el
@@ -7,11 +7,7 @@
(setq corfu-preview-current nil)
(setq corfu-min-width 20)
(setq corfu-popupinfo-delay '(1.25 . 0.5))
- (corfu-popupinfo-mode 1)
- ;; Sort by input history (no need to modify `corfu-sort-function').
- (with-eval-after-load 'savehist
- (corfu-history-mode 1)
- (add-to-list 'savehist-additional-variables 'corfu-history)))
+ (corfu-popupinfo-mode 1))
(use-package completion-preview
:diminish
diff --git a/.config/emacs/completion-sorting.el b/.config/emacs/completion-sorting.el
new file mode 100644
index 0000000..c5c714a
--- /dev/null
+++ b/.config/emacs/completion-sorting.el
@@ -0,0 +1,57 @@
+
+;; https://kristofferbalintona.me/articles/complement-corfu-vertico-and-completion-preview-with-prescientel-sorting/
+
+(use-package prescient
+ :ensure t
+ :custom
+ (prescient-aggressive-file-save t)
+ (prescient-sort-length-enable t) ; testing this out
+ (prescient-sort-full-matches-first t)
+ (prescient-history-length 200)
+ (prescient-frequency-decay 0.997)
+ (prescient-frequency-threshold 0.05)
+ :config
+ (prescient-persist-mode 1))
+
+;; Integration with corfu
+(use-package corfu-prescient
+ :ensure t
+ :demand t
+ :after corfu prescient
+ :custom
+ (corfu-prescient-enable-sorting t)
+ (corfu-prescient-override-sorting nil) ; Don't override `display-sort-function'
+ (corfu-prescient-enable-filtering nil) ; We want orderless to do the filtering
+ :config
+ (corfu-prescient-mode 1))
+
+;; Integration with vertico
+(use-package vertico-prescient
+ :ensure t
+ :demand t
+ :after vertico prescient
+ :custom
+ (vertico-prescient-enable-sorting t)
+ (vertico-prescient-override-sorting nil)
+ (vertico-prescient-enable-filtering nil) ; We want orderless to do the filtering
+ :config
+ (vertico-prescient-mode 1))
+
+;; Have `completion-preview-mode' use prescient's sorting algorithm
+(with-eval-after-load 'prescient
+ (setopt completion-preview-sort-function #'prescient-completion-sort))
+
+(add-variable-watcher 'corfu-sort-function
+ (lambda (_symbol newval operation where)
+ "Match the value of `completion-preview-sort-function' to `corfu-sort-function'.
+If `corfu-sort-function' is set buffer-locally, also set
+`completion-preview-sort-function' buffer-locally. Otherwise, change
+the default value of `completion-preview-sort-function' accordingly.
+
+This action only applies when the value of `corfu-sort-function' is
+set (i.e., OPERATION is \\='set). This excludes, e.g., let bindings."
+ (when (equal operation 'set)
+ (if where
+ (with-current-buffer where
+ (setq-local completion-preview-sort-function newval))
+ (setopt completion-preview-sort-function newval)))))
diff --git a/.config/emacs/early-init.el b/.config/emacs/early-init.el
index e5bc600..7238ace 100644
--- a/.config/emacs/early-init.el
+++ b/.config/emacs/early-init.el
@@ -32,6 +32,12 @@
tramp-backup-directory-alist `((".*" . ,backup-dir))
tramp-auto-save-directory auto-saves-dir))
+;; put custom in junk
+(setq custom-file (no-littering-expand-etc-file-name "custom.el"))
+
+;; put lockfiles in nowhere
+(setq create-lockfiles nil)
+
;; improve garbage collection
(defun my-minibuffer-setup-hook ()
(setq gc-cons-threshold most-positive-fixnum))
diff --git a/.config/emacs/init.el b/.config/emacs/init.el
index 43ee683..5b158f0 100644
--- a/.config/emacs/init.el
+++ b/.config/emacs/init.el
@@ -1,6 +1,4 @@
-;; opt out of custom and lockfiles
-(setq custom-file (make-temp-file "emacs-custom-"))
-(setq create-lockfiles nil)
+;; see early-init.el for basic configuration
;; better meta behaviour
(setq inhibit-startup-message t
@@ -9,7 +7,7 @@
enable-recursive-minibuffers t
y-or-n-p t)
-;; set up package managers
+;; set up package manager
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(package-initialize)
@@ -29,6 +27,7 @@
(loadc "text-editing.el")
(loadc "minibuffer.el")
(loadc "completion-at-point.el")
+(loadc "completion-sorting.el")
(loadc "files.el")
(loadc "misc.el")
(loadc "windows.el")
@@ -36,5 +35,6 @@
;; (loadc "evil.el")
;; (loadc "lang.el")
-;; todo: ultra scroll, dumb-jump, scroll-on-jump, hl-line, minions for modeline, terminal, fork theme and make some improvements
-;; skipped: diminish, evil, rainbow delimiters
+;; todo: integrated terminal, org config with modules, full screen popups, shackle
+;; todo styling: minions (modeline collapse), forked theme to enable: hl-line, spacious-padding, pulsar
+
diff --git a/.config/emacs/minibuffer.el b/.config/emacs/minibuffer.el
index 4f753d1..1160447 100644
--- a/.config/emacs/minibuffer.el
+++ b/.config/emacs/minibuffer.el
@@ -1,4 +1,5 @@
-;; better C-g dwim
+;; behaviour improvemnts
+
(defun keyboard-quit-dwim ()
(interactive)
(cond
@@ -12,7 +13,16 @@
(keyboard-quit))))
(define-key global-map (kbd "C-g") #'keyboard-quit-dwim)
-;; ui improvements
+(use-package savehist
+ :hook (after-init . savehist-mode))
+
+(use-package stillness-mode
+ :demand t
+ :vc (:url "https://github.com/neeasade/stillness-mode.el" :rev :newest)
+ :ensure t
+ :hook (after-init . stillness-mode))
+
+;; minad stack
(use-package vertico
:ensure t
@@ -33,45 +43,9 @@
:ensure t
:hook (after-init . marginalia-mode))
-(use-package stillness-mode
- :demand t
- :vc (:url "https://github.com/neeasade/stillness-mode.el" :rev :newest)
- :ensure t
- :hook (after-init . stillness-mode))
-
-;; sorting and history
-
-;; https://kristofferbalintona.me/articles/complement-corfu-vertico-and-completion-preview-with-prescientel-sorting/
-
-(use-package savehist
- :hook (after-init . savehist-mode))
-
(use-package orderless
:ensure t
:config
(setq completion-styles '(orderless basic))
(setq completion-category-defaults nil)
(setq completion-category-overrides nil))
-
-(use-package prescient
- :ensure t
- :custom
- (prescient-aggressive-file-save t)
- (prescient-sort-length-enable t) ; testing this out
- (prescient-sort-full-matches-first t)
- (prescient-history-length 200)
- (prescient-frequency-decay 0.997)
- (prescient-frequency-threshold 0.05)
- :config
- (prescient-persist-mode 1))
-
-(use-package vertico-prescient
- :ensure t
- :demand t
- :after vertico prescient
- :custom
- (vertico-prescient-enable-sorting t)
- (vertico-prescient-override-sorting nil)
- (vertico-prescient-enable-filtering nil) ; We want orderless to do the filtering
- :config
- (vertico-prescient-mode 1))