Yggdroot / LeaderF

An efficient fuzzy finder that helps to locate files, buffers, mrus, gtags, etc. on the fly for both vim and neovim.
Apache License 2.0
2.14k stars 180 forks source link

Feature request for Preview: toggle auto preview temporarily for the current leaderf buffer #1059

Open ukyouz opened 6 months ago

ukyouz commented 6 months ago

Run :checkhealth for more info

- Output of `:echo has("python")`: 0
- Output of `:echo has("python3")`: 1
- Output of `:echo &pythondll`(only vim, not neovim): 
- Output of `:echo &pythonthreedll`(only vim, not neovim): 
- Output of `:py print(sys.version)`: 3.11.6
- Output of `:py3 print(sys.version)`: 3.11.6
- Output of `:echo g:Lf_Debug_Cmd`: <!-- should only provide this information if it's an issue of :Leaderf file -->
- Output of `:echo g:Lf_FilesFromCache`: <!-- should only provide this information if it's an issue of :Leaderf file -->
- Operating system: <!-- use [x] to select, note: no space in between brackets -->
    - [ ] Linux
    - [ ] Mac OS X
    - [x] Windows
    - [ ] Etc.
- Configurations related to LeaderF in vimrc: 

{ "Yggdroot/LeaderF", init = function() vim.g.Lf_WindowPosition = 'popup' vim.g.Lf_WindowHeight = 0.4 vim.g.Lf_PopupHeight = 0.4 vim.g.Lf_PopupWidth = 0.8 vim.g.Lf_PopupPosition = {1, 0} vim.g.Lf_PopupPreviewPosition = 'bottom' vim.g.Lf_DefaultMode = 'NameOnly' vim.g.Lf_PreviewInPopup = 1 vim.g.LfNormalMap = { = {{"", "j"}, {"", "k"} }, File= {{"", ':exec g:Lf_py "fileExplManager.quit()"'}}, Buffer= {{"", ':exec g:Lf_py "bufExplManager.quit()"'}}, Mru= {{"", ':exec g:Lf_py "mruExplManager.quit()"'}}, Tag= {{"", ':exec g:Lf_py "tagExplManager.quit()"'}}, Gtags= {{"", ':exec g:Lf_py "gtagsExplManager.quit()"'}}, BufTag= {{"", ':exec g:Lf_py "bufTagExplManager.quit()"'}}, Function= {{"", ':exec g:Lf_py "functionExplManager.quit()"'}}, Rg= {{"", ':exec g:Lf_py "rgExplManager.quit()"'}}, Line= {{"", ':exec g:Lf_py "lineExplManager.quit()"'}}, History={{"", ':exec g:Lf_py "historyExplManager.quit()"'}}, Help= {{"", ':exec g:Lf_py "helpExplManager.quit()"'}}, Self= {{"", ':exec g:Lf_py "selfExplManager.quit()"'}}, Colorscheme= {{"", ':exec g:Lf_py "colorschemeExplManager.quit()"'}}, } vim.g.Lf_PreviewScrollStepSize = 10 vim.g.Lf_PreviewResult = { File = 0, Buffer = 0, Mru = 1, Tag = 0, BufTag = 1, Function = 0, Line = 1, Colorscheme = 1, Rg = 0, Gtags = 1, } end, }


### Describe your question, feature request, or bug.
Currently, we can choose whether to auto show preview by the following either way:
- Config `Lf_PreviewResult` in Neovim/Vim files
- Add `--auto-preview` or `--no-auto-preview` for every command

But all these methods required user to decide _**before**_ the leaderf buffer appears. Though it is possible to preview a single item by press `p` in the leaderf buffer, It will be very useful to add a feature, such as keybinding to `P`, to toggle auto-preview.

Let's say, I search some word with Rg, the result may be huge, so I default set to `no-auto-preview`, but after filtering the result, I indeed want to preview everything!

I hope there will be such feature added in the future implant :)
eyalk11 commented 3 months ago

I thought about this too