From ce4327e3a9bb56387f85c2cf7636ff8510b5505a Mon Sep 17 00:00:00 2001 From: Aria Date: Wed, 30 May 2018 13:46:09 +1000 Subject: [PATCH 1/3] completion/helm: cleanup and set some more sensible defaults --- modules/completion/helm/config.el | 37 +++++++++++++------------------ 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/modules/completion/helm/config.el b/modules/completion/helm/config.el index 7caa3e8a4..9dac9accf 100644 --- a/modules/completion/helm/config.el +++ b/modules/completion/helm/config.el @@ -38,23 +38,21 @@ (def-package! helm :after helm-mode :init - (setq helm-quick-update t - ;; Speedier without fuzzy matching - helm-mode-fuzzy-match nil - helm-buffers-fuzzy-matching nil - helm-apropos-fuzzy-match nil - helm-M-x-fuzzy-match nil - helm-recentf-fuzzy-match nil - helm-projectile-fuzzy-match nil - ;; Display extraineous helm UI elements - helm-display-header-line nil - helm-ff-auto-update-initial-value nil - helm-find-files-doc-header nil - ;; Don't override evil-ex's completion - helm-mode-handle-completion-in-region nil - helm-candidate-number-limit 50 - ;; Don't wrap item cycling - helm-move-to-line-cycle-in-source t) + (setq + ;; Fuzzy matching is pretty handy! + helm-mode-fuzzy-match t + helm-buffers-fuzzy-matching t + helm-apropos-fuzzy-match t + helm-M-x-fuzzy-match t + helm-recentf-fuzzy-match t + helm-projectile-fuzzy-match t + ;; Display extraineous helm UI elements + helm-display-header-line nil + helm-ff-auto-update-initial-value nil + helm-find-files-doc-header nil + ;; Don't override evil-ex's completion + helm-mode-handle-completion-in-region nil + helm-candidate-number-limit 50) :config (setq projectile-completion-system 'helm) @@ -86,10 +84,7 @@ (let ((bg-color (face-background 'default nil))) `(:background ,bg-color :foreground ,bg-color))) (setq-local cursor-type nil)))) - (add-hook 'helm-minibuffer-set-up-hook #'+helm*hide-minibuffer-maybe) - - ) - + (add-hook 'helm-minibuffer-set-up-hook #'+helm*hide-minibuffer-maybe)) (def-package! helm-locate :defer t From dcd29762e7f6454ecb40163e28f2775544b55147 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 30 May 2018 10:52:44 +0200 Subject: [PATCH 2/3] Gate fuzzy search config behind +fuzzy module flag Fuzzy search, on its own, is inaccurate when individual candidates are long. Helm's non-fuzzy search backend doesn't have this problem. This adds `flx` sorting to fuzzy search to make up for this. --- modules/completion/helm/config.el | 45 ++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/modules/completion/helm/config.el b/modules/completion/helm/config.el index 9dac9accf..928fbee21 100644 --- a/modules/completion/helm/config.el +++ b/modules/completion/helm/config.el @@ -38,21 +38,13 @@ (def-package! helm :after helm-mode :init - (setq - ;; Fuzzy matching is pretty handy! - helm-mode-fuzzy-match t - helm-buffers-fuzzy-matching t - helm-apropos-fuzzy-match t - helm-M-x-fuzzy-match t - helm-recentf-fuzzy-match t - helm-projectile-fuzzy-match t - ;; Display extraineous helm UI elements - helm-display-header-line nil - helm-ff-auto-update-initial-value nil - helm-find-files-doc-header nil - ;; Don't override evil-ex's completion - helm-mode-handle-completion-in-region nil - helm-candidate-number-limit 50) + (setq helm-candidate-number-limit 50 + ;; Display extraineous helm UI elements + helm-display-header-line nil + helm-ff-auto-update-initial-value nil + helm-find-files-doc-header nil + ;; Don't override evil-ex's completion + helm-mode-handle-completion-in-region nil) :config (setq projectile-completion-system 'helm) @@ -86,6 +78,29 @@ (setq-local cursor-type nil)))) (add-hook 'helm-minibuffer-set-up-hook #'+helm*hide-minibuffer-maybe)) + +(def-package! helm-flx + :when (featurep! +fuzzy) + :after helm + :init + (setq helm-candidate-number-limit 40 + helm-M-x-fuzzy-match t + helm-apropos-fuzzy-match t + helm-bookmark-show-location t + helm-buffers-fuzzy-matching t + helm-completion-in-region-fuzzy-match t + helm-file-cache-fuzzy-match t + helm-imenu-fuzzy-match t + helm-locate-fuzzy-match t + helm-flx-for-helm-locate t + helm-mode-fuzzy-match t + helm-projectile-fuzzy-match t + helm-recentf-fuzzy-match t + helm-semantic-fuzzy-match t) + :config + (helm-flx-mode +1)) + + (def-package! helm-locate :defer t :init (defvar helm-generic-files-map (make-sparse-keymap)) From b94f9b269bd55009e6df0161dfb16e011644ecec Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 30 May 2018 10:54:25 +0200 Subject: [PATCH 3/3] Add helm-flx to helm packages --- modules/completion/helm/packages.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/completion/helm/packages.el b/modules/completion/helm/packages.el index b4199e698..deb8465c7 100644 --- a/modules/completion/helm/packages.el +++ b/modules/completion/helm/packages.el @@ -10,3 +10,5 @@ (package! helm-projectile) (package! helm-swoop) (package! wgrep) +(when (featurep! +fuzzy) + (package! helm-flx))