aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.emacs.d/lisp/init-minibuffer.el46
-rw-r--r--.emacs.d/lisp/init-projectile.el6
2 files changed, 47 insertions, 5 deletions
diff --git a/.emacs.d/lisp/init-minibuffer.el b/.emacs.d/lisp/init-minibuffer.el
index a0a5c98..83a2498 100644
--- a/.emacs.d/lisp/init-minibuffer.el
+++ b/.emacs.d/lisp/init-minibuffer.el
@@ -1,3 +1,5 @@
+;; -*- lexical-binding: t -*-
+
(gx/maybe-require-package 'consult)
(when (gx/maybe-require-package 'vertico)
@@ -8,6 +10,22 @@
vertico-cycle t)
(when (gx/maybe-require-package 'orderless)
+ (setq orderless-matching-styles '(orderless-literal orderless-regexp))
+
+ (defun gx/orderless-without-if-bang (pattern _index _total)
+ (cond
+ ((equal "!" pattern)
+ '(orderless-literal . ""))
+ ((string-prefix-p "!" pattern)
+ `(orderless-without-literal . ,(substring pattern 1)))))
+
+ (defun gx/orderless-flex-if-twiddle (pattern _index _total)
+ (when (string-suffix-p "~" pattern)
+ `(orderless-flex . ,(substring pattern 0 -1))))
+
+ (setq orderless-style-dispatchers '(gx/orderless-without-if-bang
+ gx/orderless-flex-if-twiddle))
+
(defun gx/setup-completion-in-minibuffer ()
(setq-local completion-styles '(substring orderless)
completion-category-defaults nil
@@ -21,10 +39,36 @@
(kbd "<leader>fm") 'consult-recent-file
(kbd "<leader>fc") 'execute-extended-command
(kbd "<leader>fl") 'consult-line
- (kbd "<leader>fs") 'consult-imenu)
+ (kbd "<leader>fs") 'consult-imenu
+ (kbd "<leader>fa") 'consult-org-agenda)
(evil-define-key 'normal 'eglot--managed-mode
(kbd "<leader>fS") 'consult-eglot-symbols)))
+(when (executable-find "rg")
+ (setq affe-grep-command
+ "rg --null --line-buffered --color=never --max-columns=1000 \
+--path-separator / -v ^$ \
+--smart-case --no-heading --line-number --hidden --glob !.git ."))
+
+(when (executable-find "fd")
+ (setq affe-find-command
+ "fd --type f --hidden --follow --exclude .git"))
+
+(when (gx/maybe-require-package 'affe)
+ (with-eval-after-load 'evil
+ (evil-define-key 'normal 'global
+ (kbd "<leader>ff") 'affe-find
+ (kbd "<leader>fr") 'affe-grep))
+ (with-eval-after-load 'orderless
+ (defun gx/affe-orderless-regexp-compiler (input _type _ignorecase)
+ (setq input (orderless-pattern-compiler input))
+ (cons input (lambda (str) (orderless--highlight input str))))
+ (setq affe-regexp-compiler #'gx/affe-orderless-regexp-compiler))
+ (with-eval-after-load 'consult
+ (consult-customize
+ affe-grep affe-find
+ :preview-key (kbd "C-c C-p"))))
+
(setq consult-preview-key (kbd "C-c C-p"))
(when (gx/maybe-require-package 'savehist)
diff --git a/.emacs.d/lisp/init-projectile.el b/.emacs.d/lisp/init-projectile.el
index 08c1124..4169387 100644
--- a/.emacs.d/lisp/init-projectile.el
+++ b/.emacs.d/lisp/init-projectile.el
@@ -1,5 +1,5 @@
(when (gx/maybe-require-package 'projectile)
- (add-hook 'after-init-hook (lambda () (projectile-mode 1))))
+ (add-hook 'after-init-hook #'projectile-mode))
(with-eval-after-load 'projectile
(gx/diminish 'projectile-mode))
@@ -9,8 +9,6 @@
(with-eval-after-load 'evil
(evil-define-key 'normal projectile-mode-map
- (kbd "<leader>fp") 'projectile-switch-project
- (kbd "<leader>ff") 'projectile-find-file
- (kbd "<leader>fr") 'projectile-ripgrep))
+ (kbd "<leader>fp") 'projectile-switch-project))
(provide 'init-projectile)