about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--init.el96
1 files changed, 68 insertions, 28 deletions
diff --git a/init.el b/init.el index 400dfca..5d0bc1b 100644 --- a/init.el +++ b/init.el
@@ -489,37 +489,77 @@ call `zzz-to-char'."
489 489
490;;;;; Consult 490;;;;; Consult
491(setup (:straight consult) 491(setup (:straight consult)
492
493 ;; "Sensible" functions
494 (defun consult-sensible-grep ()
495 "Perform `consult-git-grep' if in a git project, otherwise `consult-ripgrep'
496if ripgrep is installed, otherwise `consult-grep'."
497 (interactive "P")
498 (cond ((= (vc-backend buffer-file-name) "Git")
499 (call-interactively #'consult-git-grep))
500 ((exectuable-find "rg")
501 (call-interactively #'consult-ripgrep))
502 (t (call-interactively #'consult-grep))))
503 (defun consult-sensible-find ()
504 "Peform `consult-locate' if locate is installed, otehrwise `consult-find'."
505 (interactive "P")
506 (cond ((executable-find "locate") (call-interactively #'consult-locate))
507 (t (call-interactively #'consult-find))))
508
509 ;; Bindings
492 (:global 510 (:global
493 ;; C-c bindings (`mode-specific-map') 511 ;; C-c bindings (`mode-specific-map')
494 "C-c h" consult-history 512 "C-c h" consult-history
495 "C-c m" consult-mode-command 513 "C-c m" consult-mode-command
496 ;; C-x bindings (`ctl-x-map') 514 "C-c b" consult-bookmark
497 "C-x M-:" consult-complex-command 515 "C-c k" consult-kmacro
498 "C-x b" consult-buffer 516 ;; C-x bindings (`ctl-x-map')
499 "C-x 4 b" consult-buffer-other-window 517 "C-x M-:" consult-complex-command
500 "C-x 5 b" consult-buffer-other-frame 518 "C-x b" consult-buffer
501 "C-x r x" consult-register 519 "C-x 4 b" consult-buffer-other-window
502 "C-x r b" consult-bookmark 520 "C-x 5 b" consult-buffer-other-frame
503 ;; M-g bindings (`goto-map') 521 ;; Custom M-# bindings for fast register access
504 "M-g o" consult-outline 522 "M-#" consult-register-load
505 "M-g m" consult-mark 523 "M-'" consult-register-store
506 "M-g k" consult-global-mark 524 "C-M-#" consult-register
507 "M-g i" consult-imenu 525 ;; M-g bindings (`goto-map')
508 "M-g e" consult-error 526 "M-g e" consult-compile-error
509 ;; M-s bindings (`search-map') 527 "M-g g" consult-goto-line
510 "M-s g" consult-grep ; alts: consult-git-grep, consult-ripgrep 528 "M-g M-g" consult-goto-line
511 "M-s f" consult-find ; alts: consult-locate 529 "M-g o" consult-outline
512 "M-s l" consult-line 530 "M-g m" consult-mark
513 "M-s m" consult-multi-occur 531 "M-g k" consult-global-mark
514 "M-s k" consult-keep-lines 532 "M-g i" consult-imenu
515 "M-s u" consult-focus-lines 533 "M-g I" consult-project-imenu
516 ;; Other bindings 534 ;; M-s bindings (`search-map')
517 "M-y" consult-yank-pop 535 "M-s g" consult-sensible-grep
518 "<f1> a" consult-apropos 536 "M-s f" consult-sensible-find
519 "C-h a" consult-apropos) 537 "M-s l" consult-line
538 "M-s m" consult-multi-occur
539 "M-s k" consult-keep-lines
540 "M-s u" consult-focus-lines
541 ;; Other bindings
542 "M-y" consult-yank-pop
543 "<help> a" consult-apropos
544 ;; Isearch integration
545 "M-s e" consult-isearch)
546 (:with-map isearch-mode-map
547 (:bind "M-e" consult-isearch
548 "M-s e" consult-isearch
549 "M-s l" consult-line))
550
551 ;; Registers
520 (autoload 'consult-register-preview "consult") 552 (autoload 'consult-register-preview "consult")
521 (:option register-preview-delay 0 553 (:option register-preview-delay 0
522 register-preview-function #'consult-register-preview)) 554 register-preview-function #'consult-register-format)
555 (:advise register-preview :override #'consult-register-window)
556
557 ;; Xref
558 (:option xref-show-xrefs-function #'consult-xref
559 xref-show-definitions-function #'consult-xref)
560
561 ;; Projects
562 (:option consult-project-root-function #'vc-root-dir))
523 563
524;;;;; Marginalia 564;;;;; Marginalia
525(setup (:straight marginalia) 565(setup (:straight marginalia)