Turned off find file with consult
This commit is contained in:
parent
4d13ce9abb
commit
f71c36a25d
1 changed files with 127 additions and 127 deletions
254
config.org
254
config.org
|
|
@ -1727,144 +1727,144 @@ one, an error is signaled."
|
||||||
#+end_src
|
#+end_src
|
||||||
** Consult
|
** Consult
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
;; Example configuration for Consult
|
;; Example configuration for Consult
|
||||||
(use-package consult
|
(use-package consult
|
||||||
:ensure t
|
:ensure t
|
||||||
;; Replace bindings. Lazily loaded by `use-package'.
|
;; Replace bindings. Lazily loaded by `use-package'.
|
||||||
:bind (;; C-c bindings in `mode-specific-map'
|
:bind (;; C-c bindings in `mode-specific-map'
|
||||||
("C-c M-x" . consult-mode-command)
|
("C-c M-x" . consult-mode-command)
|
||||||
("C-c h" . consult-history)
|
("C-c h" . consult-history)
|
||||||
("C-c k" . consult-kmacro)
|
("C-c k" . consult-kmacro)
|
||||||
("C-c m" . consult-man)
|
("C-c m" . consult-man)
|
||||||
("C-c i" . consult-info)
|
("C-c i" . consult-info)
|
||||||
([remap Info-search] . consult-info)
|
([remap Info-search] . consult-info)
|
||||||
;; C-x bindings in `ctl-x-map'
|
;; C-x bindings in `ctl-x-map'
|
||||||
("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
|
("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
|
||||||
("C-x b" . consult-buffer) ;; orig. switch-to-buffer
|
("C-x b" . consult-buffer) ;; orig. switch-to-buffer
|
||||||
("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
|
("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
|
||||||
("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
|
("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
|
||||||
("C-x t b" . consult-buffer-other-tab) ;; orig. switch-to-buffer-other-tab
|
("C-x t b" . consult-buffer-other-tab) ;; orig. switch-to-buffer-other-tab
|
||||||
("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
|
("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
|
||||||
("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer
|
("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer
|
||||||
;; Custom M-# bindings for fast register access
|
;; Custom M-# bindings for fast register access
|
||||||
("M-#" . consult-register-load)
|
("M-#" . consult-register-load)
|
||||||
("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
|
("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
|
||||||
("C-M-#" . consult-register)
|
("C-M-#" . consult-register)
|
||||||
;; Other custom bindings
|
;; Other custom bindings
|
||||||
("M-y" . consult-yank-pop) ;; orig. yank-pop
|
("M-y" . consult-yank-pop) ;; orig. yank-pop
|
||||||
;; M-g bindings in `goto-map'
|
;; M-g bindings in `goto-map'
|
||||||
("M-g e" . consult-compile-error)
|
("M-g e" . consult-compile-error)
|
||||||
("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
|
("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
|
||||||
("M-g g" . consult-goto-line) ;; orig. goto-line
|
("M-g g" . consult-goto-line) ;; orig. goto-line
|
||||||
("M-g M-g" . consult-goto-line) ;; orig. goto-line
|
("M-g M-g" . consult-goto-line) ;; orig. goto-line
|
||||||
("M-g o" . consult-outline) ;; Alternative: consult-org-heading
|
("M-g o" . consult-outline) ;; Alternative: consult-org-heading
|
||||||
("M-g m" . consult-mark)
|
("M-g m" . consult-mark)
|
||||||
("M-g k" . consult-global-mark)
|
("M-g k" . consult-global-mark)
|
||||||
("M-g i" . consult-imenu)
|
("M-g i" . consult-imenu)
|
||||||
("M-g I" . consult-imenu-multi)
|
("M-g I" . consult-imenu-multi)
|
||||||
;; M-s bindings in `search-map'
|
;; M-s bindings in `search-map'
|
||||||
("M-s d" . consult-find) ;; Alternative: consult-fd
|
("M-s d" . consult-find) ;; Alternative: consult-fd
|
||||||
("M-s c" . consult-locate)
|
("M-s c" . consult-locate)
|
||||||
("M-s g" . consult-grep)
|
("M-s g" . consult-grep)
|
||||||
("M-s G" . consult-git-grep)
|
("M-s G" . consult-git-grep)
|
||||||
("M-s r" . consult-ripgrep)
|
("M-s r" . consult-ripgrep)
|
||||||
("M-s l" . consult-line)
|
("M-s l" . consult-line)
|
||||||
("M-s L" . consult-line-multi)
|
("M-s L" . consult-line-multi)
|
||||||
("M-s k" . consult-keep-lines)
|
("M-s k" . consult-keep-lines)
|
||||||
("M-s u" . consult-focus-lines)
|
("M-s u" . consult-focus-lines)
|
||||||
;; Isearch integration
|
;; Isearch integration
|
||||||
("M-s e" . consult-isearch-history)
|
("M-s e" . consult-isearch-history)
|
||||||
:map isearch-mode-map
|
:map isearch-mode-map
|
||||||
("M-e" . consult-isearch-history) ;; orig. isearch-edit-string
|
("M-e" . consult-isearch-history) ;; orig. isearch-edit-string
|
||||||
("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string
|
("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string
|
||||||
("M-s l" . consult-line) ;; needed by consult-line to detect isearch
|
("M-s l" . consult-line) ;; needed by consult-line to detect isearch
|
||||||
("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch
|
("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch
|
||||||
;; Minibuffer history
|
;; Minibuffer history
|
||||||
:map minibuffer-local-map
|
:map minibuffer-local-map
|
||||||
("M-s" . consult-history) ;; orig. next-matching-history-element
|
("M-s" . consult-history) ;; orig. next-matching-history-element
|
||||||
("M-r" . consult-history)) ;; orig. previous-matching-history-element
|
("M-r" . consult-history)) ;; orig. previous-matching-history-element
|
||||||
|
|
||||||
;; Enable automatic preview at point in the *Completions* buffer. This is
|
;; Enable automatic preview at point in the *Completions* buffer. This is
|
||||||
;; relevant when you use the default completion UI.
|
;; relevant when you use the default completion UI.
|
||||||
:hook (completion-list-mode . consult-preview-at-point-mode)
|
:hook (completion-list-mode . consult-preview-at-point-mode)
|
||||||
|
|
||||||
;; The :init configuration is always executed (Not lazy)
|
;; The :init configuration is always executed (Not lazy)
|
||||||
:init
|
:init
|
||||||
|
|
||||||
;; Tweak the register preview for `consult-register-load',
|
;; Tweak the register preview for `consult-register-load',
|
||||||
;; `consult-register-store' and the built-in commands. This improves the
|
;; `consult-register-store' and the built-in commands. This improves the
|
||||||
;; register formatting, adds thin separator lines, register sorting and hides
|
;; register formatting, adds thin separator lines, register sorting and hides
|
||||||
;; the window mode line.
|
;; the window mode line.
|
||||||
(advice-add #'register-preview :override #'consult-register-window)
|
(advice-add #'register-preview :override #'consult-register-window)
|
||||||
(setq register-preview-delay 0.5)
|
(setq register-preview-delay 0.5)
|
||||||
|
|
||||||
;; Use Consult to select xref locations with preview
|
;; Use Consult to select xref locations with preview
|
||||||
(setq xref-show-xrefs-function #'consult-xref
|
(setq xref-show-xrefs-function #'consult-xref
|
||||||
xref-show-definitions-function #'consult-xref)
|
xref-show-definitions-function #'consult-xref)
|
||||||
|
|
||||||
;; Configure other variables and modes in the :config section,
|
;; Configure other variables and modes in the :config section,
|
||||||
;; after lazily loading the package.
|
;; after lazily loading the package.
|
||||||
:config
|
:config
|
||||||
|
|
||||||
;; Optionally configure preview. The default value
|
;; Optionally configure preview. The default value
|
||||||
;; is 'any, such that any key triggers the preview.
|
;; is 'any, such that any key triggers the preview.
|
||||||
;; (setq consult-preview-key 'any)
|
;; (setq consult-preview-key 'any)
|
||||||
;; (setq consult-preview-key "M-.")
|
;; (setq consult-preview-key "M-.")
|
||||||
;; (setq consult-preview-key '("S-<down>" "S-<up>"))
|
;; (setq consult-preview-key '("S-<down>" "S-<up>"))
|
||||||
;; For some commands and buffer sources it is useful to configure the
|
;; For some commands and buffer sources it is useful to configure the
|
||||||
;; :preview-key on a per-command basis using the `consult-customize' macro.
|
;; :preview-key on a per-command basis using the `consult-customize' macro.
|
||||||
(consult-customize
|
(consult-customize
|
||||||
consult-theme :preview-key '(:debounce 0.2 any)
|
consult-theme :preview-key '(:debounce 0.2 any)
|
||||||
consult-ripgrep consult-git-grep consult-grep consult-man
|
consult-ripgrep consult-git-grep consult-grep consult-man
|
||||||
consult-bookmark consult-recent-file consult-xref
|
consult-bookmark consult-recent-file consult-xref
|
||||||
consult--source-bookmark consult--source-file-register
|
consult--source-bookmark consult--source-file-register
|
||||||
consult--source-recent-file consult--source-project-recent-file
|
consult--source-recent-file consult--source-project-recent-file
|
||||||
;; :preview-key "M-."
|
;; :preview-key "M-."
|
||||||
:preview-key '(:debounce 0.4 any))
|
:preview-key '(:debounce 0.4 any))
|
||||||
|
|
||||||
;; Optionally configure the narrowing key.
|
;; Optionally configure the narrowing key.
|
||||||
;; Both < and C-+ work reasonably well.
|
;; Both < and C-+ work reasonably well.
|
||||||
(setq consult-narrow-key "<") ;; "C-+"
|
(setq consult-narrow-key "<") ;; "C-+"
|
||||||
|
|
||||||
;; Optionally make narrowing help available in the minibuffer.
|
;; Optionally make narrowing help available in the minibuffer.
|
||||||
;; You may want to use `embark-prefix-help-command' or which-key instead.
|
;; You may want to use `embark-prefix-help-command' or which-key instead.
|
||||||
;; (keymap-set consult-narrow-map (concat consult-narrow-key " ?") #'consult-narrow-help)
|
;; (keymap-set consult-narrow-map (concat consult-narrow-key " ?") #'consult-narrow-help)
|
||||||
)
|
)
|
||||||
(require 'consult)
|
(require 'consult)
|
||||||
(setq read-file-name-function #'consult-find-file-with-preview)
|
;;(setq read-file-name-function #'consult-find-file-with-preview)
|
||||||
|
|
||||||
;;Previewing files in find-file
|
;;Previewing files in find-file
|
||||||
(defun consult-find-file-with-preview (prompt &optional dir default mustmatch initial pred)
|
(defun consult-find-file-with-preview (prompt &optional dir default mustmatch initial pred)
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((default-directory (or dir default-directory))
|
(let ((default-directory (expand-file-name (or dir default-directory)))
|
||||||
(minibuffer-completing-file-name t))
|
(minibuffer-completing-file-name t))
|
||||||
(consult--read #'read-file-name-internal :state (consult--file-preview)
|
(consult--read #'read-file-name-internal :state (consult--file-preview)
|
||||||
:prompt prompt
|
:prompt prompt
|
||||||
:initial initial
|
:initial initial
|
||||||
:require-match mustmatch
|
:require-match mustmatch
|
||||||
:predicate pred)))
|
:predicate pred)))
|
||||||
|
|
||||||
;;Previewing files for project-find-file
|
;;Previewing files for project-find-file
|
||||||
(setq project-read-file-name-function #'consult-project-find-file-with-preview)
|
(setq project-read-file-name-function #'consult-project-find-file-with-preview)
|
||||||
|
|
||||||
(defun consult-project-find-file-with-preview (prompt all-files &optional pred hist _mb)
|
(defun consult-project-find-file-with-preview (prompt all-files &optional pred hist _mb)
|
||||||
(let ((prompt (if (and all-files
|
(let ((prompt (if (and all-files
|
||||||
(file-name-absolute-p (car all-files)))
|
(file-name-absolute-p (car all-files)))
|
||||||
prompt
|
prompt
|
||||||
( concat prompt
|
( concat prompt
|
||||||
( format " in %s"
|
( format " in %s"
|
||||||
(consult--fast-abbreviate-file-name default-directory)))))
|
(consult--fast-abbreviate-file-name default-directory)))))
|
||||||
(minibuffer-completing-file-name t))
|
(minibuffer-completing-file-name t))
|
||||||
(consult--read (mapcar
|
(consult--read (mapcar
|
||||||
(lambda (file)
|
(lambda (file)
|
||||||
(file-relative-name file))
|
(file-relative-name file))
|
||||||
all-files)
|
all-files)
|
||||||
:state (consult--file-preview)
|
:state (consult--file-preview)
|
||||||
:prompt (concat prompt ": ")
|
:prompt (concat prompt ": ")
|
||||||
:require-match t
|
:require-match t
|
||||||
:history hist
|
:history hist
|
||||||
:category 'file
|
:category 'file
|
||||||
:predicate pred)))
|
:predicate pred)))
|
||||||
#+end_src
|
#+end_src
|
||||||
** Fido-mode
|
** Fido-mode
|
||||||
Enables fido completion in emacs. It's actually cool, but...
|
Enables fido completion in emacs. It's actually cool, but...
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue