2023-04-14 18:39:19 +02:00
|
|
|
;;; init-minibuffer.el --- Ayuditas y autocompletado del minibufer -*- lexical-binding: t -*-
|
2022-06-01 15:18:06 +02:00
|
|
|
|
|
|
|
;; Author: kj <webmaster@outcontrol.net>
|
|
|
|
;; URL: https://git.kj2.me/kj/confi-emacs-actual
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
2023-04-14 18:39:19 +02:00
|
|
|
;; Aquí se encuentran todos los paquetes que tienen como
|
|
|
|
;; objetivo mejorar el minibuffer de Emacs.
|
2022-06-01 15:18:06 +02:00
|
|
|
|
2023-04-14 18:39:19 +02:00
|
|
|
;;; Code:
|
2022-06-01 15:18:06 +02:00
|
|
|
|
2023-04-14 18:39:19 +02:00
|
|
|
;; Autocompletado y sugerencias para el minibuffer
|
2022-06-01 15:18:06 +02:00
|
|
|
(use-package counsel
|
|
|
|
:defer t
|
|
|
|
:straight t
|
|
|
|
:diminish ivy-mode counsel-mode
|
2023-04-14 18:39:19 +02:00
|
|
|
:bind (("C-s" . swiper-isearch)
|
|
|
|
("C-r" . counsel-rg)
|
|
|
|
("M-x" . counsel-M-x)
|
|
|
|
("<menu>" . counsel-M-x)
|
2022-06-01 15:18:06 +02:00
|
|
|
|
2023-04-14 00:30:48 +02:00
|
|
|
;; ("C-c C-r" . ivy-resume)
|
|
|
|
;; ("C-c v p" . ivy-push-view)
|
|
|
|
;; ("C-c v o" . ivy-pop-view)
|
|
|
|
;; ("C-c v ." . ivy-switch-view)
|
2022-06-01 15:18:06 +02:00
|
|
|
|
|
|
|
:map counsel-mode-map
|
|
|
|
([remap swiper] . counsel-grep-or-swiper)
|
|
|
|
([remap swiper-backward] . counsel-grep-or-swiper-backward)
|
|
|
|
([remap dired] . counsel-dired)
|
|
|
|
([remap set-variable] . counsel-set-variable)
|
|
|
|
([remap insert-char] . counsel-unicode-char)
|
|
|
|
([remap recentf-open-files] . counsel-recentf)
|
|
|
|
([remap org-capture] . counsel-org-capture)
|
2022-06-30 02:52:39 +02:00
|
|
|
([remap jump-to-register] . counsel-register)
|
2022-06-01 15:18:06 +02:00
|
|
|
|
|
|
|
:map ivy-minibuffer-map
|
|
|
|
("C-w" . ivy-yank-word)
|
|
|
|
("<tab>" . ivy-partial)
|
|
|
|
("<escape>" . minibuffer-keyboard-quit)
|
|
|
|
|
|
|
|
:map counsel-find-file-map
|
|
|
|
("C-h" . counsel-up-directory)
|
|
|
|
|
|
|
|
:map swiper-map
|
|
|
|
("M-%" . swiper-query-replace)
|
2022-08-22 05:29:55 +02:00
|
|
|
)
|
2022-06-01 15:18:06 +02:00
|
|
|
|
|
|
|
:hook ((after-init . ivy-mode)
|
|
|
|
(ivy-mode . counsel-mode))
|
|
|
|
:init
|
|
|
|
(setq enable-recursive-minibuffers t) ; Allow commands in minibuffers
|
|
|
|
|
|
|
|
(setq ivy-height 12
|
|
|
|
ivy-use-selectable-prompt t
|
|
|
|
ivy-use-virtual-buffers t ; Enable bookmarks and recentf
|
|
|
|
ivy-fixed-height-minibuffer t
|
|
|
|
ivy-count-format "(%d/%d) "
|
|
|
|
ivy-on-del-error-function #'ignore
|
|
|
|
ivy-initial-inputs-alist nil)
|
|
|
|
|
|
|
|
;; Use orderless regex strategy
|
|
|
|
(setq ivy-re-builders-alist '((t . ivy--regex-ignore-order)))
|
|
|
|
|
|
|
|
;; Set minibuffer height for different commands
|
|
|
|
(setq ivy-height-alist '((counsel-evil-registers . 5)
|
|
|
|
(counsel-yank-pop . 8)
|
|
|
|
(counsel-git-log . 4)
|
|
|
|
(swiper . 15)
|
|
|
|
(counsel-projectile-ag . 15)
|
|
|
|
(counsel-projectile-rg . 15)))
|
|
|
|
|
|
|
|
|
|
|
|
(setq swiper-action-recenter t)
|
|
|
|
|
|
|
|
(setq counsel-find-file-at-point t
|
|
|
|
counsel-preselect-current-file t
|
|
|
|
counsel-yank-pop-separator "\n────────\n")
|
|
|
|
(add-hook 'counsel-grep-post-action-hook #'recenter)
|
|
|
|
|
|
|
|
;; Use the faster search tools
|
|
|
|
(when (executable-find "rg")
|
|
|
|
(setq counsel-grep-base-command "rg -S --no-heading --line-number --color never '%s' '%s'"))
|
|
|
|
(when (executable-find "fd")
|
|
|
|
(setq counsel-fzf-cmd
|
|
|
|
"fd --type f --hidden --follow --exclude .git --color never '%s'"))
|
|
|
|
|
2022-08-22 05:29:55 +02:00
|
|
|
)
|
2022-06-01 15:18:06 +02:00
|
|
|
|
2023-04-14 18:39:19 +02:00
|
|
|
;; Integración entre projectile y counsel
|
2022-06-01 15:18:06 +02:00
|
|
|
(use-package counsel-projectile
|
|
|
|
:defer t
|
|
|
|
:straight t
|
|
|
|
:bind*
|
|
|
|
("C-x p" . counsel-projectile)
|
|
|
|
:hook (counsel-mode . counsel-projectile-mode)
|
|
|
|
:init (setq counsel-projectile-grep-initial-input '(ivy-thing-at-point)))
|
|
|
|
|
2023-04-14 18:39:19 +02:00
|
|
|
;; Autocompletado, sugerencias y menú de búsqueda mejorados (este paquete incluye counsel y swiper)
|
2022-06-01 15:18:06 +02:00
|
|
|
(use-package ivy
|
|
|
|
:defer t
|
|
|
|
:straight t
|
|
|
|
:hook (after-init . ivy-mode)
|
|
|
|
:config
|
|
|
|
(setq ivy-use-virtual-buffers nil))
|
|
|
|
|
2023-04-14 18:39:19 +02:00
|
|
|
;; Ivy pero con más detalles en pantalla
|
2022-06-01 15:18:06 +02:00
|
|
|
(use-package ivy-rich
|
|
|
|
:defer t
|
|
|
|
:straight t
|
|
|
|
:ensure t
|
|
|
|
:hook ((counsel-projectile-mode . ivy-rich-mode) ; MUST after `counsel-projectile'
|
|
|
|
(ivy-rich-mode . ivy-rich-project-root-cache-mode)
|
|
|
|
(ivy-rich-mode . (lambda ()
|
|
|
|
"Use abbreviate in `ivy-rich-mode'."
|
|
|
|
(setq ivy-virtual-abbreviate
|
|
|
|
(or (and ivy-rich-mode 'abbreviate) 'name)))))
|
|
|
|
:init
|
|
|
|
;; For better performance
|
|
|
|
(setq ivy-rich-parse-remote-buffer nil))
|
|
|
|
|
2023-06-23 11:34:43 +02:00
|
|
|
;; nerd-icons en ivy
|
|
|
|
(use-package nerd-icons-ivy-rich
|
2022-06-01 15:18:06 +02:00
|
|
|
:defer t
|
|
|
|
:straight t
|
|
|
|
:ensure t
|
2023-06-23 11:34:43 +02:00
|
|
|
:hook (after-init . nerd-icons-ivy-rich-mode))
|
|
|
|
|
|
|
|
;; nerd-icons en ibuffer
|
|
|
|
(use-package nerd-icons-ibuffer
|
|
|
|
:straight t
|
|
|
|
:defer t
|
|
|
|
:hook (ibuffer-mode . nerd-icons-ibuffer-mode))
|
2022-06-01 15:18:06 +02:00
|
|
|
|
2023-04-14 21:43:55 +02:00
|
|
|
;; Ordenar los comandos usados en M-x (por uso y luego alfabéticamente)
|
|
|
|
(use-package smex
|
|
|
|
:straight t
|
|
|
|
:defer t
|
|
|
|
:after (counsel))
|
2022-06-01 15:18:06 +02:00
|
|
|
|
2023-04-14 18:39:19 +02:00
|
|
|
(provide 'init-minibuffer)
|
|
|
|
;;; init-minibuffer.el ends here
|