From 7cea1859d427a553e6195fba9fc19e56f3fd26ea Mon Sep 17 00:00:00 2001 From: jao Date: Mon, 26 Sep 2022 04:26:01 +0100 Subject: pulsar tweaks --- custom/jao-custom-completion.el | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'custom') diff --git a/custom/jao-custom-completion.el b/custom/jao-custom-completion.el index 0f8b854..3d9c543 100644 --- a/custom/jao-custom-completion.el +++ b/custom/jao-custom-completion.el @@ -1,15 +1,5 @@ ;; -*- lexical-binding: t; -*- -;;; imenu -(use-package imenu - :init (setq org-imenu-depth 7) - :config - (defun jao-imenu-hook () - (cond ((derived-mode-p 'org-mode) (org-reveal t)) - (outline-minor-mode (outline-show-entry)) - ((derived-mode-p 'outline-mode) (outline-show-entry)))) - (add-hook 'imenu-after-jump-hook #'jao-imenu-hook)) - ;;; completion styles ;;;; completion configuration (setq tab-always-indent 'complete @@ -76,21 +66,31 @@ ;;; vertico (use-package vertico :ensure t + :init + (defvar jao-vertico-reverse t) + (setq vertico-count 20 vertico-cycle t vertico-resize t - org-refile-use-outline-path t) + vertico-multiform-categories nil + vertico-buffer-display-action + `(display-buffer-below-selected (window-height . 0.5))) + + (dolist (c '(completion-at-point complete-symbol indent-for-tab-command)) + (add-to-list 'vertico-multiform-commands + `(,c buffer (vertico-resize) (jao-vertico-reverse)))) :config - (defun jao-vertico--display-candidates (lines) - (move-overlay vertico--candidates-ov (point-min) (point-min)) - (overlay-put vertico--candidates-ov 'after-string (apply #'concat lines)) - (vertico--resize-window (length lines))) + (defun jao-vertico--display (fun lines) + (if (not jao-vertico-reverse) + (funcall fun lines) + (move-overlay vertico--candidates-ov (point-min) (point-min)) + (overlay-put vertico--candidates-ov 'after-string (apply #'concat lines)) + (vertico--resize-window (length lines)))) - (advice-add 'vertico--display-candidates - :override #'jao-vertico--display-candidates)) + (advice-add 'vertico--display-candidates :around #'jao-vertico--display)) (use-package vertico-directory :after vertico @@ -132,9 +132,10 @@ :init (fset 'multi-occur #'consult-multi-occur) + (setq org-refile-use-outline-path t + org-imenu-depth 7) :config - (defun jao-consult--completion-in-region (&rest args) (apply (if (and (not (bound-and-true-p corfu-mode)) (not (bound-and-true-p company-mode)) -- cgit v1.2.3