aboutsummaryrefslogtreecommitdiff
path: root/.emacs.d
diff options
context:
space:
mode:
authorRaúl Benencia <id@rbenencia.name>2023-08-02 21:45:59 -0700
committerRaúl Benencia <id@rbenencia.name>2023-08-02 21:56:03 -0700
commit3e1a1df0be897f440b8f1f663b290913c72ee36a (patch)
tree491129d9f21a68e52e6d8549e9327f796c1e2814 /.emacs.d
parent64ae130fec7996bfd128a326c56224ea584d9a62 (diff)
emacs: move consult code to rul-completion
Diffstat (limited to '.emacs.d')
-rw-r--r--.emacs.d/init.el2
-rw-r--r--.emacs.d/rul-init.d/staging.el120
-rw-r--r--.emacs.d/rul-init.d/vterm.el2
-rw-r--r--.emacs.d/rul-lisp/packages/rul-completion.el74
4 files changed, 75 insertions, 123 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index d3c8a19..9eb2faf 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -184,8 +184,6 @@
(load-file "~/.emacs.d/rul-init.d/writeroom.el")
(load-file "~/.emacs.d/rul-init.d/vterm.el")
-(load-file "~/.emacs.d/rul-init.d/staging.el")
-
(when-let* ((file (locate-user-emacs-file "rul-post-init.el"))
((file-exists-p file)))
(load-file file))
diff --git a/.emacs.d/rul-init.d/staging.el b/.emacs.d/rul-init.d/staging.el
deleted file mode 100644
index 06433cf..0000000
--- a/.emacs.d/rul-init.d/staging.el
+++ /dev/null
@@ -1,120 +0,0 @@
-;; Debian packages: elpa-consult elpa-orderless elpa-vertico elpa-marginalia
-
-(use-package consult
- ;; Replace bindings. Lazily loaded due by `use-package'.
- :bind (;; C-c bindings in `mode-specific-map'
- ("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)
- ([remap Info-search] . consult-info)
- ;; C-x bindings in `ctl-x-map'
- ("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
- ("C-x b" . consult-buffer) ;; orig. switch-to-buffer
- ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
- ("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
- ("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
- ("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer
- ;; Custom M-# bindings for fast register access
- ("M-#" . consult-register-load)
- ("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
- ("C-M-#" . consult-register)
- ;; Other custom bindings
- ("M-y" . consult-yank-pop) ;; orig. yank-pop
- ;; M-g bindings in `goto-map'
- ("M-g e" . consult-compile-error)
- ("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
- ("M-g g" . consult-goto-line) ;; orig. goto-line
- ("M-g M-g" . consult-goto-line) ;; orig. goto-line
- ("M-g o" . consult-outline) ;; Alternative: consult-org-heading
- ("M-g m" . consult-mark)
- ("M-g k" . consult-global-mark)
- ("M-g i" . consult-imenu)
- ("M-g I" . consult-imenu-multi)
- ;; M-s bindings in `search-map'
- ("M-s d" . consult-find)
- ("M-s D" . 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)
- ;; Isearch integration
- ("M-s e" . consult-isearch-history)
- :map isearch-mode-map
- ("M-e" . consult-isearch-history) ;; orig. isearch-edit-string
- ("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string
- ("M-s l" . consult-line) ;; needed by consult-line to detect isearch
- ("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch
- ;; Minibuffer history
- :map minibuffer-local-map
- ("M-s" . consult-history) ;; orig. next-matching-history-element
- ("M-r" . consult-history)) ;; orig. previous-matching-history-element
-
- ;; Enable automatic preview at point in the *Completions* buffer. This is
- ;; relevant when you use the default completion UI.
- :hook (completion-list-mode . consult-preview-at-point-mode)
-
- ;; The :init configuration is always executed (Not lazy)
- :init
-
- ;; Optionally configure the register formatting. This improves the register
- ;; preview for `consult-register', `consult-register-load',
- ;; `consult-register-store' and the Emacs built-ins.
- (setq register-preview-delay 0.5
- register-preview-function #'consult-register-format)
-
- ;; Optionally tweak the register preview window.
- ;; This adds thin lines, sorting and hides the mode line of the window.
- (advice-add #'register-preview :override #'consult-register-window)
-
- ;; Use Consult to select xref locations with preview
- (setq xref-show-xrefs-function #'consult-xref
- xref-show-definitions-function #'consult-xref)
-
- ;; Configure other variables and modes in the :config section,
- ;; after lazily loading the package.
- :config
-
- ;; Optionally configure preview. The default value
- ;; is 'any, such that any key triggers the preview.
- ;; (setq consult-preview-key 'any)
- ;; (setq consult-preview-key "M-.")
- ;; (setq consult-preview-key '("S-<down>" "S-<up>"))
- ;; For some commands and buffer sources it is useful to configure the
- ;; :preview-key on a per-command basis using the `consult-customize' macro.
- (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 "M-."
- :preview-key '(:debounce 0.4 any))
-
- ;; Optionally configure the narrowing key.
- ;; Both < and C-+ work reasonably well.
- (setq consult-narrow-key "<") ;; "C-+"
-
- ;; Optionally make narrowing help available in the minibuffer.
- ;; You may want to use `embark-prefix-help-command' or which-key instead.
- ;; (define-key consult-narrow-map (vconcat consult-narrow-key "?") #'consult-narrow-help)
-
- ;; By default `consult-project-function' uses `project-root' from project.el.
- ;; Optionally configure a different project root function.
- ;;;; 1. project.el (the default)
- ;; (setq consult-project-function #'consult--default-project--function)
- ;;;; 2. vc.el (vc-root-dir)
- ;; (setq consult-project-function (lambda (_) (vc-root-dir)))
- ;;;; 3. locate-dominating-file
- ;; (setq consult-project-function (lambda (_) (locate-dominating-file "." ".git")))
- ;;;; 4. projectile.el (projectile-project-root)
- ;; (autoload 'projectile-project-root "projectile")
- ;; (setq consult-project-function (lambda (_) (projectile-project-root)))
- ;;;; 5. No project support
- ;; (setq consult-project-function nil)
-)
-
diff --git a/.emacs.d/rul-init.d/vterm.el b/.emacs.d/rul-init.d/vterm.el
index 887c24d..1292569 100644
--- a/.emacs.d/rul-init.d/vterm.el
+++ b/.emacs.d/rul-init.d/vterm.el
@@ -1,5 +1,5 @@
(use-package multi-vterm
-:ensure t
+:after (consult)
:config
(setq vterm-source
diff --git a/.emacs.d/rul-lisp/packages/rul-completion.el b/.emacs.d/rul-lisp/packages/rul-completion.el
index 39b886c..8803fc0 100644
--- a/.emacs.d/rul-lisp/packages/rul-completion.el
+++ b/.emacs.d/rul-lisp/packages/rul-completion.el
@@ -44,4 +44,78 @@
(setq completion-ignore-case t)
+(use-package consult
+ :ensure t
+ ;; Replace bindings. Lazily loaded due by `use-package'.
+ :bind (;; C-c bindings in `mode-specific-map'
+ ("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)
+ ([remap Info-search] . consult-info)
+
+ ;; C-x bindings in `ctl-x-map'
+ ("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
+ ("C-x b" . consult-buffer) ;; orig. switch-to-buffer
+ ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
+ ("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
+ ("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
+ ("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer
+
+ ;; Custom M-# bindings for fast register access
+ ("M-#" . consult-register-load)
+ ("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
+ ("C-M-#" . consult-register)
+
+ ;; Other custom bindings
+ ("M-y" . consult-yank-pop) ;; orig. yank-pop
+
+ ;; M-g bindings in `goto-map'
+ ("M-g e" . consult-compile-error)
+ ("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
+ ("M-g g" . consult-goto-line) ;; orig. goto-line
+ ("M-g M-g" . consult-goto-line) ;; orig. goto-line
+ ("M-g o" . consult-outline) ;; Alternative: consult-org-heading
+ ("M-g m" . consult-mark)
+ ("M-g k" . consult-global-mark)
+ ("M-g i" . consult-imenu)
+ ("M-g I" . consult-imenu-multi)
+
+ ;; M-s bindings in `search-map'
+ ("M-s d" . consult-find)
+ ("M-s D" . 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)
+
+ ;; Isearch integration
+ ("M-s e" . consult-isearch-history)
+
+ :map isearch-mode-map
+ ("M-e" . consult-isearch-history) ;; orig. isearch-edit-string
+ ("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string
+ ("M-s l" . consult-line) ;; needed by consult-line to detect isearch
+ ("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch
+
+ ;; Minibuffer history
+ :map minibuffer-local-map
+ ("M-s" . consult-history) ;; orig. next-matching-history-element
+ ("M-r" . consult-history)) ;; orig. previous-matching-history-element
+
+ :init
+ (setq xref-show-xrefs-function #'consult-xref)
+ (setq xref-show-definitions-function #'consult-xref)
+ (add-hook 'completion-list-mode-hook #'consult-preview-at-point-mode)
+
+ :config
+ (setq consult-preview-key 'any)
+ (setq consult-narrow-key "<")
+)
+
+
(provide 'rul-completion)
nihil fit ex nihilo