junegunn / junegunn/fzf.vim

Scrolls wrong window when opening in preview window

Open
#666 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Vim Script
Stars
10.3k
Forks
608
Avg merge
5d 8h
Merged PRs (30d)
2

Description

- Category
- [x] Question
- [x] Bug
- [ ] Suggestion
- OS
- [x] Linux
- [ ] macOS
- [ ] Windows
- [ ] Etc.
- Vim
- [x] Vim
- [ ] Neovim

So I'm trying to add an 'open in preview window option'. I did the following:

```
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit',
\ 'ctrl-p': 'pedit'}
```

This sortof works but when I for instance use `:Tags` and then press `ctrl-p` on the item I want, the preview window is opened to the top of the correct file (but not in the right place) and then the original buffer is scrolled to the position of the tag.

Is there anything I can do to improve this?

Would it need a preview specific option?

I'm assuming the current logic is something like - open the file using the command and then use `G [linenumber]` or something.

Can I get my hands on more of the arguments somehow or add something in to open in preview?

I could maybe swap to the preview window with a function but ideally I'd like the focus to stay in the original window and I believe that would need some sort of hook that got run after the jump to command had been run (eg so I could run `:wincmd p` so similar)

Btw the plugin is excellent! So useful :)

Cheers

Jonny

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.