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 178 forks source link

Pick `bufnr` function, to allow selecting which split to open a selected file in #1036

Open Leandros opened 1 year ago

Leandros commented 1 year ago

Run :checkhealth for more info

- Output of `:echo has("python")`: `0`
- Output of `:echo has("python3")`: `1`
- Output of `:py print(sys.version)`: 

3.7.16 (default, Aug 30 2023, 20:37:53) [GCC 7.3.1 20180712 (Red Hat 7.3.1-15)]

- Output of `:py3 print(sys.version)`: 

3.7.16 (default, Aug 30 2023, 20:37:53) [GCC 7.3.1 20180712 (Red Hat 7.3.1-15)]


- Operating system: <!-- use [x] to select, note: no space in between brackets -->
    - [x] Linux
    - [x] Mac OS X
    - [ ] Windows
    - [ ] Etc.
- Configurations related to LeaderF in vimrc: 

### Describe your question, feature request, or bug.

LeaderF will always open the specified file in the least recently focused buffer (the buffer that you previously edited before triggering leaderf). 

I would like to be able to select which buffer the file is opened in, similar to what I can achieve with `nvim-tree` and `window-picker`:
<img width="961" alt="Screenshot 2023-09-15 at 11 58 33" src="https://github.com/Yggdroot/LeaderF/assets/396475/7e1b3c74-f957-441e-9059-2fd8eedd982b">

The green bars below each split is telling me which key to press to open the file in this split.

As far as I understand, `LeaderF` would need to provide a "callback" that's called before opening the file. The `pick()` function from `window-picker` will return a bufnr in which the new file is opened.
Leandros commented 1 year ago

There is also vim-choosewin: https://github.com/t9md/vim-choosewin

Yggdroot commented 1 year ago

Why not move the cursor to the destination window, then use LeaderF?