minad / consult

:mag: consult.el - Consulting completing-read
GNU General Public License v3.0
1.14k stars 99 forks source link

[Q] preview for consult-find and consult-dir #837

Closed mhlr closed 9 months ago

mhlr commented 9 months ago

Is there a way to enable preview for consult-file and/or consult-dir? I have previews working for other functions like consult-grep, but not for consult-file and consult-dir. It would be great to see the beginning of a file when looking among similarly name files.

minad commented 9 months ago

For consult-find and consult-fd you can set the :state argument as follows:

(consult-customize consult-find consult-fd :state (consult--file-preview))

For consult-dir set the :state field to consult--file-state and set the :action field to nil, but I haven't tried this.