aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuangxiong Lin <[email protected]>2022-03-18 23:47:59 +0800
committerGuangxiong Lin <[email protected]>2022-03-18 23:47:59 +0800
commit3087e4313adcb141de19c164c49f66d82f551efe (patch)
tree2fc899a4fe45505832863ab918c991b741dd2e1b
parent6db3aaf45a385481944803ccc297a2e29603b3f0 (diff)
downloaddotfiles-3087e4313adcb141de19c164c49f66d82f551efe.tar.gz
dotfiles-3087e4313adcb141de19c164c49f66d82f551efe.tar.bz2
dotfiles-3087e4313adcb141de19c164c49f66d82f551efe.zip
Replace ivy/counsel with vertico/consult (emacs)
-rw-r--r--.emacs.d/.gitignore4
-rw-r--r--.emacs.d/init.el2
-rw-r--r--.emacs.d/lisp/init-ivy.el26
-rw-r--r--.emacs.d/lisp/init-minibuffer.el29
4 files changed, 33 insertions, 28 deletions
diff --git a/.emacs.d/.gitignore b/.emacs.d/.gitignore
index c65df60..d89c469 100644
--- a/.emacs.d/.gitignore
+++ b/.emacs.d/.gitignore
@@ -13,4 +13,6 @@ org-roam.db
pyim
.last-package-update-day
-lisp/init-local.el \ No newline at end of file
+lisp/init-local.el
+history
+projects \ No newline at end of file
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index 11567b0..22c9e7f 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -20,7 +20,7 @@
(require 'init-package)
(require 'init-utils)
(require 'init-evil)
-(require 'init-ivy)
+(require 'init-minibuffer)
(require 'init-company)
(require 'init-flycheck)
(require 'init-org)
diff --git a/.emacs.d/lisp/init-ivy.el b/.emacs.d/lisp/init-ivy.el
deleted file mode 100644
index 07731fa..0000000
--- a/.emacs.d/lisp/init-ivy.el
+++ /dev/null
@@ -1,26 +0,0 @@
-(when (gx/maybe-require-package 'counsel)
- (add-hook 'after-init-hook (lambda () (ivy-mode 1))))
-
-(gx/maybe-require-package 'flx)
-
-(with-eval-after-load 'ivy
- (gx/diminish 'ivy-mode))
-
-(with-eval-after-load 'evil
- (evil-define-key 'normal ivy-mode-map
- (kbd "<leader>fb") 'ivy-switch-buffer
- (kbd "<leader>fm") 'counsel-recentf
- (kbd "<leader>fc") 'counsel-M-x
- (kbd "<leader>fl") 'swiper))
-
-(setq ivy-use-virtual-buffers t)
-(setq ivy-count-format "(%d/%d) ")
-(setq ivy-initial-inputs-alist nil)
-(setq ivy-re-builders-alist
- '((t . ivy--regex-ignore-order)
- (t . ivy--regex-fuzzy)
- (t . ivy--regex-plus)
- (t . regexp-quote)
- (t . ivy-regex)))
-
-(provide 'init-ivy)
diff --git a/.emacs.d/lisp/init-minibuffer.el b/.emacs.d/lisp/init-minibuffer.el
new file mode 100644
index 0000000..5ed684b
--- /dev/null
+++ b/.emacs.d/lisp/init-minibuffer.el
@@ -0,0 +1,29 @@
+(gx/maybe-require-package 'consult)
+
+(when (gx/maybe-require-package 'vertico)
+ (add-hook 'after-init-hook #'vertico-mode))
+
+(setq vertico-resize t
+ vertico-count 20
+ vertico-cycle t)
+
+(defun gx/setup-completion-in-minibuffer ()
+ (setq-local completion-styles '(substring orderless)
+ completion-category-defaults nil
+ completion-category-overrides '((file (styles partial-completion)))))
+
+(when (gx/maybe-require-package 'orderless)
+ (add-hook 'minibuffer-setup-hook #'gx/setup-completion-in-minibuffer))
+
+(with-eval-after-load 'evil
+ (when (gx/maybe-require-package 'consult)
+ (evil-define-key 'normal 'global
+ (kbd "<leader>fb") 'consult-buffer
+ (kbd "<leader>fm") 'consult-recent-file
+ (kbd "<leader>fc") 'execute-extended-command
+ (kbd "<leader>fl") 'consult-line)))
+
+(when (gx/maybe-require-package 'savehist)
+ (add-hook 'after-init-hook #'savehist-mode))
+
+(provide 'init-minibuffer)