diff --git a/layers/+completion/compleseus/README.org b/layers/+completion/compleseus/README.org index f94ea57d9..cbd132eab 100644 --- a/layers/+completion/compleseus/README.org +++ b/layers/+completion/compleseus/README.org @@ -1,4 +1,4 @@ -#+TITLE: compleseus layer +#+TITLE: Compleseus layer #+TAGS: completion|layer @@ -44,7 +44,7 @@ like below to use =selectrum= as opposed to the default of =vertico=: * Key bindings -| Key binding | Description | -|-------------+---------------| -| ~M-o~ | embark-action | -| ~C-r~ | history | +| Key binding | Description | +|-------------+-------------------| +| ~M-o~ | embark-action | +| ~C-r~ | history | diff --git a/layers/+completion/compleseus/funcs.el b/layers/+completion/compleseus/funcs.el index d31bbeada..7501db8a2 100644 --- a/layers/+completion/compleseus/funcs.el +++ b/layers/+completion/compleseus/funcs.el @@ -96,6 +96,15 @@ (interactive) (spacemacs/compleseus-search nil (projectile-project-root))) +(defun spacemacs/compleseus-search-from (input) + "Embark action to start ripgrep search from candidate's directory." + (interactive "s") + (message "The first input %s." input) + (let ((dir (if (file-directory-p input) + input + (file-name-directory input)))) + (consult-ripgrep dir))) + (defun spacemacs/compleseus-find-file () "This solves the problem: Binding a key to: `find-file' calls: `ido-find-file'" @@ -118,13 +127,13 @@ Binding a key to: `find-file' calls: `ido-find-file'" (embark-dwim))))) (defun spacemacs/next-candidate-preview (&optional n) - "Go forward N candidates and preivew" + "Go forward N candidates and preview" (interactive) (vertico-next (or n 1)) (spacemacs/embark-preview)) (defun spacemacs/previous-candidate-preview (&optional n) - "Go backward N candidates and preivew" + "Go backward N candidates and preview" (interactive) (selec-previous (or n 1)) (spacemacs/embark-preview)) @@ -132,13 +141,13 @@ Binding a key to: `find-file' calls: `ido-find-file'" ;; selectrum (defun spacemacs/selectrum-next-candidate-preview (&optional n) - "Go forward N candidates and preivew" + "Go forward N candidates and preview" (interactive) (selectrum-next-candidate (or n 1)) (spacemacs/embark-preview)) (defun spacemacs/selectrum-previous-candidate-preview (&optional n) - "Go backward N candidates and preivew" + "Go backward N candidates and preview" (interactive) (selectrum-previous-candidate (or n 1)) (spacemacs/embark-preview)) diff --git a/layers/+completion/compleseus/packages.el b/layers/+completion/compleseus/packages.el index 4ad5a0783..441ffc3bb 100644 --- a/layers/+completion/compleseus/packages.el +++ b/layers/+completion/compleseus/packages.el @@ -26,6 +26,9 @@ marginalia (compleseus-spacemacs-help :location local) consult + ;; remove recipe when available on Melpa (should be soon) + (consult-yasnippet :location (recipe :fetcher github + :repo "mohkale/consult-yasnippet")) embark embark-consult orderless @@ -135,6 +138,7 @@ "bB" #'consult-buffer "fb" #'consult-bookmark "ff" #'spacemacs/compleseus-find-file + "fL" #'consult-locate "fr" #'consult-recent-file "hda" #'consult-apropos "jm" #'consult-mark @@ -214,6 +218,13 @@ ;; (setq consult-project-root-function (lambda () (locate-dominating-file "." ".git"))) )) +(defun compleseus/init-consult-yasnippet () + (use-package consult-yasnippet + :defer t + :init + (spacemacs/set-leader-keys + "is" 'consult-yasnippet))) + (defun compleseus/init-embark () (use-package embark :bind @@ -227,6 +238,7 @@ (setq prefix-help-command #'embark-prefix-help-command) :config + (define-key embark-file-map "s" 'spacemacs/compleseus-search-from) ;; Hide the mode line of the Embark live/completions buffers ;; (add-to-list 'display-buffer-alist ;; '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*" @@ -298,7 +310,9 @@ (define-key vertico-map (kbd "C-k") #'vertico-previous) (define-key vertico-map (kbd "C-M-k") #'spacemacs/previous-candidate-preview) (define-key vertico-map (kbd "C-S-k") #'vertico-previous-group) - (define-key vertico-map (kbd "C-r") 'consult-history))) + (define-key vertico-map (kbd "C-r") 'consult-history) + (define-key vertico-map (kbd "C-h") 'backward-kill-word) + (define-key vertico-map "?" #'minibuffer-completion-help))) (defun compleseus/init-vertico-repeat () (use-package vertico-repeat diff --git a/layers/+tools/fasd/packages.el b/layers/+tools/fasd/packages.el index ee2dd241a..0802678ba 100644 --- a/layers/+tools/fasd/packages.el +++ b/layers/+tools/fasd/packages.el @@ -53,7 +53,11 @@ ("s" ivy-search-from-action "search-from")))) ;; we will fall back to using the default completing-read function, which is helm once helm is loaded. - (setq fasd-completing-read-function 'nil)))) + (setq fasd-completing-read-function 'nil)) + :config + (with-eval-after-load 'marginalia + (add-to-list 'marginalia-prompt-categories '("\\" . file))))) + (defun fasd/init-helm-fasd () "initializes fasd-emacs and adds a key binding to `SPC f z'"