Add an usage tip stolen from the Consult Wiki
This commit is contained in:
parent
7b2009165b
commit
da468739ff
26
README.org
26
README.org
@ -1561,6 +1561,9 @@ Consult usage tips are:
|
|||||||
consult-mark)}}} or {{{kbd(M-g m)}}}. See [[https://arialdomartini.github.io//emacs-mark-ring][Emacs: Mark Ring]].
|
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
|
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)}}}.
|
{{{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]].
|
||||||
|
|
||||||
#+attr_latex: :booktabs yes :float table
|
#+attr_latex: :booktabs yes :float table
|
||||||
#+caption[Configuration specific key bindings]:
|
#+caption[Configuration specific key bindings]:
|
||||||
@ -1646,6 +1649,29 @@ Consult usage tips are:
|
|||||||
(keymap-global-set "M-y" #'consult-yank-pop))
|
(keymap-global-set "M-y" #'consult-yank-pop))
|
||||||
#+end_src
|
#+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(cue &optional dir default mustmatch init pred)
|
||||||
|
(interactive)
|
||||||
|
(let ((default-directory (or dir default-directory))
|
||||||
|
(minibuffer-completing-file-name t))
|
||||||
|
(consult--read #'read-file-name-internal :state (consult--file-preview)
|
||||||
|
:prompt cue :initial init
|
||||||
|
:require-match mustmatch :predicate pred)))
|
||||||
|
|
||||||
|
(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)]]
|
** [[https://company-mode.github.io/][Company (info)]]
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:CUSTOM_ID: sec:company-setup
|
:CUSTOM_ID: sec:company-setup
|
||||||
|
Loading…
Reference in New Issue
Block a user