[helm] Provide fuzzy matching for Helm-M-x
Following the advice from duianto #13100 we are setting completion-styles for helm-M-x to include the emacs version specific fuzzy strategy as last resort. Before no fuzzy matching occured within command searches.
This commit is contained in:
parent
f9ffb8dc94
commit
c7ed2fc597
|
@ -114,8 +114,8 @@ If DEFAULT-INPUTP is non nil then the current region or symbol at point
|
|||
(interactive)
|
||||
(call-interactively
|
||||
(spacemacs//helm-do-search-find-tool "helm-file-do"
|
||||
dotspacemacs-search-tools
|
||||
default-inputp)))
|
||||
dotspacemacs-search-tools
|
||||
default-inputp)))
|
||||
|
||||
(defun spacemacs/helm-file-smart-do-search-region-or-symbol ()
|
||||
"Search in current file using `dotspacemacs-search-tools' with
|
||||
|
@ -183,8 +183,8 @@ If DEFAULT-INPUTP is non nil then the current region or symbol at point
|
|||
(interactive)
|
||||
(call-interactively
|
||||
(spacemacs//helm-do-search-find-tool "helm-files-do"
|
||||
dotspacemacs-search-tools
|
||||
default-inputp)))
|
||||
dotspacemacs-search-tools
|
||||
default-inputp)))
|
||||
|
||||
(defun spacemacs/helm-files-smart-do-search-region-or-symbol ()
|
||||
"Search in files using `dotspacemacs-search-tools' with default input.
|
||||
|
@ -247,8 +247,8 @@ If DEFAULT-INPUTP is non nil then the current region or symbol at point
|
|||
(interactive)
|
||||
(call-interactively
|
||||
(spacemacs//helm-do-search-find-tool "helm-dir-do"
|
||||
dotspacemacs-search-tools
|
||||
default-inputp)))
|
||||
dotspacemacs-search-tools
|
||||
default-inputp)))
|
||||
|
||||
(defun spacemacs/helm-dir-smart-do-search-region-or-symbol ()
|
||||
"Search in current directory using `dotspacemacs-search-tools'.
|
||||
|
@ -313,8 +313,8 @@ If DEFAULT-INPUTP is non nil then the current region or symbol at point
|
|||
(interactive)
|
||||
(call-interactively
|
||||
(spacemacs//helm-do-search-find-tool "helm-buffers-do"
|
||||
dotspacemacs-search-tools
|
||||
default-inputp)))
|
||||
dotspacemacs-search-tools
|
||||
default-inputp)))
|
||||
|
||||
(defun spacemacs/helm-buffers-smart-do-search-region-or-symbol ()
|
||||
"Search in opened buffers using `dotspacemacs-search-tools' with
|
||||
|
@ -412,8 +412,8 @@ If DEFAULT-INPUTP is non nil then the current region or symbol at point
|
|||
(let ((projectile-require-project-root nil))
|
||||
(call-interactively
|
||||
(spacemacs//helm-do-search-find-tool "helm-project-do"
|
||||
dotspacemacs-search-tools
|
||||
default-inputp))))
|
||||
dotspacemacs-search-tools
|
||||
default-inputp))))
|
||||
|
||||
(defun spacemacs/helm-project-smart-do-search-region-or-symbol ()
|
||||
"Search in current project using `dotspacemacs-search-tools' with
|
||||
|
@ -600,9 +600,9 @@ to buffers)."
|
|||
(with-current-buffer "*helm ag results*"
|
||||
(setq spacemacs--gne-min-line 5
|
||||
spacemacs--gne-max-line (save-excursion
|
||||
(goto-char (point-max))
|
||||
(previous-line)
|
||||
(line-number-at-pos))
|
||||
(goto-char (point-max))
|
||||
(previous-line)
|
||||
(line-number-at-pos))
|
||||
spacemacs--gne-line-func
|
||||
(lambda (c)
|
||||
(helm-ag--find-file-action
|
||||
|
@ -636,3 +636,12 @@ to buffers)."
|
|||
(interactive)
|
||||
(let ((helm-boring-buffer-regexp-list nil))
|
||||
(call-interactively #'helm-buffers-list)))
|
||||
|
||||
;; Command search ---------------------------------------------------------------------
|
||||
|
||||
(defun spacemacs/helm-M-x-fuzzy-matching ()
|
||||
"Helm M-x with fuzzy matching enabled"
|
||||
(interactive)
|
||||
(let ((completion-styles completion-styles))
|
||||
(add-to-list 'completion-styles `,(if (version< emacs-version "27") 'helm-flex 'flex) t)
|
||||
(command-execute 'helm-M-x)))
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
(evil-ex-define-cmd "buffers" 'helm-buffers-list))
|
||||
;; use helm by default for M-x, C-x C-f, and C-x b
|
||||
(unless (configuration-layer/layer-usedp 'smex)
|
||||
(global-set-key (kbd "M-x") 'helm-M-x))
|
||||
(global-set-key (kbd "M-x") 'spacemacs/helm-M-x-fuzzy-matching))
|
||||
(global-set-key (kbd "C-x C-f") 'spacemacs/helm-find-files)
|
||||
(global-set-key (kbd "C-x b") 'helm-buffers-list)
|
||||
;; use helm everywhere
|
||||
|
@ -122,8 +122,8 @@
|
|||
(kbd "C-c C-e") 'spacemacs/helm-find-files-edit)
|
||||
(defun spacemacs//add-action-helm-find-files-edit ()
|
||||
(helm-add-action-to-source
|
||||
"Edit files in dired `C-c C-e'" 'spacemacs//helm-find-files-edit
|
||||
helm-source-find-files))
|
||||
"Edit files in dired `C-c C-e'" 'spacemacs//helm-find-files-edit
|
||||
helm-source-find-files))
|
||||
(add-hook 'helm-find-files-before-init-hook
|
||||
'spacemacs//add-action-helm-find-files-edit))
|
||||
;; Add minibuffer history with `helm-minibuffer-history'
|
||||
|
@ -151,7 +151,7 @@
|
|||
;; to overwrite any key binding
|
||||
(unless (configuration-layer/layer-usedp 'smex)
|
||||
(spacemacs/set-leader-keys
|
||||
dotspacemacs-emacs-command-key 'helm-M-x)))))
|
||||
dotspacemacs-emacs-command-key 'spacemacs/helm-M-x-fuzzy-matching)))))
|
||||
:config
|
||||
(progn
|
||||
(helm-mode)
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
"smst" 'mc/reverse-regions)
|
||||
(setq mc/always-run-for-all t)
|
||||
(with-eval-after-load 'multiple-cursors-core
|
||||
(add-to-list 'mc/cmds-to-run-once 'helm-M-x)
|
||||
(add-to-list 'mc/cmds-to-run-once 'spacemacs/helm-M-x-fuzzy-matching)
|
||||
(add-to-list 'mc/cmds-to-run-once 'counsel-M-x)
|
||||
(add-to-list 'mc/cmds-to-run-once 'spacemacs/default-pop-shell)
|
||||
))))
|
||||
|
|
Loading…
Reference in a new issue