Zap broken "lst:find-file-preview"
This commit is contained in:
parent
50b3fe6bf2
commit
fb6889f09d
103
README.org
103
README.org
@ -1429,9 +1429,42 @@ Consult usage tips are:
|
||||
consult-mark)}}} or {{{kbd(M-g m)}}}. See [[https://arialdomartini.github.io//emacs-mark-ring][Emacs: Mark Ring]].
|
||||
2. {{{kbd(M-x consult-org-heading)}}} or {{{kbd(C-c C-h)}}} is an alternative to
|
||||
{{{kbd(M-x org-goto)}}} or {{{kbd(C-c C-j)}}}.
|
||||
3. Listing [[lst:find-file-preview]] uses the internal functions
|
||||
~consult--file-preview~ and ~consult--read~ to visit files with previewing
|
||||
during selection. See: [[https://github.com/minad/consult/wiki][Consult Wiki]].
|
||||
|
||||
#+caption[Bind =consult= commands]:
|
||||
#+caption: Bind =consult= commands.
|
||||
#+name: lst:bind-consult-commands
|
||||
#+begin_src emacs-lisp -n :results silent
|
||||
(when (ensure-package-installation 'consult)
|
||||
;; C-c bindings (current-global-map)
|
||||
(keymap-global-set "C-c h" #'consult-history)
|
||||
(keymap-global-set "C-c m" #'consult-mode-command)
|
||||
;; C-x bindings (ctl-x-map)
|
||||
(keymap-set ctl-x-map "M-:" #'consult-complex-command)
|
||||
(keymap-set ctl-x-map "b" #'consult-buffer)
|
||||
(keymap-set ctl-x-4-map "b" #'consult-buffer-other-window)
|
||||
(keymap-set ctl-x-5-map "b" #'consult-buffer-other-frame)
|
||||
(keymap-set ctl-x-r-map "x" #'consult-register)
|
||||
(keymap-set ctl-x-r-map "b" #'consult-bookmark)
|
||||
;; M-g bindings (goto-map)
|
||||
(keymap-set goto-map "g" #'consult-goto-line)
|
||||
(keymap-set goto-map "M-g" #'consult-goto-line)
|
||||
(keymap-set goto-map "o" #'consult-outline)
|
||||
(keymap-set goto-map "m" #'consult-mark)
|
||||
(keymap-set goto-map "k" #'consult-global-mark)
|
||||
(keymap-set goto-map "i" #'consult-imenu)
|
||||
(keymap-set goto-map "e" #'consult-compile-error)
|
||||
(with-eval-after-load 'org
|
||||
(keymap-set org-mode-map "C-c C-h" #'consult-org-heading))
|
||||
;; M-s bindings (search-map)
|
||||
(keymap-set search-map "g" #'consult-git-grep)
|
||||
(keymap-set search-map "f" #'consult-find)
|
||||
(keymap-set search-map "k" #'consult-keep-lines)
|
||||
(keymap-set search-map "l" #'consult-line)
|
||||
(keymap-set search-map "m" #'consult-multi-occur)
|
||||
(keymap-set search-map "u" #'consult-focus-lines)
|
||||
;; Other bindings (current-global-map)
|
||||
(keymap-global-set "M-y" #'consult-yank-pop))
|
||||
#+end_src
|
||||
|
||||
#+attr_latex: :booktabs yes :float table
|
||||
#+caption[Configuration specific key bindings]:
|
||||
@ -1480,70 +1513,6 @@ Consult usage tips are:
|
||||
| org-store-link | global-map | {{{kbd(C-c l)}}} |
|
||||
|-----------------------------+----------------------+--------------------|
|
||||
|
||||
|
||||
#+caption[Bind =consult= commands]:
|
||||
#+caption: Bind =consult= commands.
|
||||
#+name: lst:bind-consult-commands
|
||||
#+begin_src emacs-lisp -n :results silent
|
||||
(when (ensure-package-installation 'consult)
|
||||
;; C-c bindings (current-global-map)
|
||||
(keymap-global-set "C-c h" #'consult-history)
|
||||
(keymap-global-set "C-c m" #'consult-mode-command)
|
||||
;; C-x bindings (ctl-x-map)
|
||||
(keymap-set ctl-x-map "M-:" #'consult-complex-command)
|
||||
(keymap-set ctl-x-map "b" #'consult-buffer)
|
||||
(keymap-set ctl-x-4-map "b" #'consult-buffer-other-window)
|
||||
(keymap-set ctl-x-5-map "b" #'consult-buffer-other-frame)
|
||||
(keymap-set ctl-x-r-map "x" #'consult-register)
|
||||
(keymap-set ctl-x-r-map "b" #'consult-bookmark)
|
||||
;; M-g bindings (goto-map)
|
||||
(keymap-set goto-map "g" #'consult-goto-line)
|
||||
(keymap-set goto-map "M-g" #'consult-goto-line)
|
||||
(keymap-set goto-map "o" #'consult-outline)
|
||||
(keymap-set goto-map "m" #'consult-mark)
|
||||
(keymap-set goto-map "k" #'consult-global-mark)
|
||||
(keymap-set goto-map "i" #'consult-imenu)
|
||||
(keymap-set goto-map "e" #'consult-compile-error)
|
||||
(with-eval-after-load 'org
|
||||
(keymap-set org-mode-map "C-c C-h" #'consult-org-heading))
|
||||
;; M-s bindings (search-map)
|
||||
(keymap-set search-map "g" #'consult-git-grep)
|
||||
(keymap-set search-map "f" #'consult-find)
|
||||
(keymap-set search-map "k" #'consult-keep-lines)
|
||||
(keymap-set search-map "l" #'consult-line)
|
||||
(keymap-set search-map "m" #'consult-multi-occur)
|
||||
(keymap-set search-map "u" #'consult-focus-lines)
|
||||
;; Other bindings (current-global-map)
|
||||
(keymap-global-set "M-y" #'consult-yank-pop))
|
||||
#+end_src
|
||||
|
||||
#+caption[Implement =find-file= with previewing before selection]:
|
||||
#+caption: Implement =find-file= with previewing before selection.
|
||||
#+name: lst:find-file-preview
|
||||
#+begin_src emacs-lisp -n :results silent
|
||||
(defun consult-find-file-preview
|
||||
(prompt &optional dir _default mustmatch initial predicate)
|
||||
"Helper to implement previewing when calling `find-file'.
|
||||
See `read-file-name' for the meaning of PROMPT, DIR, MUSTMATCH, INITIAL,
|
||||
and PREDICATE."
|
||||
(interactive)
|
||||
(let ((default-directory (or dir default-directory))
|
||||
(minibuffer-completing-file-name t))
|
||||
(consult--read #'read-file-name-internal :state (consult--file-preview)
|
||||
:prompt prompt :initial initial
|
||||
:require-match mustmatch :predicate predicate)))
|
||||
|
||||
(defun toggle-find-file-preview ()
|
||||
"Toggle previewing when calling `find-file'."
|
||||
(interactive)
|
||||
(let ((done "Enabled"))
|
||||
(if (eq read-file-name-function #'read-file-name-default)
|
||||
(setq read-file-name-function #'consult-find-file-preview)
|
||||
(setq read-file-name-function #'read-file-name-default
|
||||
done "Disabled"))
|
||||
(message "%s `find-file' previewing" done)))
|
||||
#+end_src
|
||||
|
||||
** [[https://company-mode.github.io/][Company (info)]]
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: sec:company-setup
|
||||
|
Loading…
Reference in New Issue
Block a user