junegunn / junegunn/fzf.vim

tagpreview.sh - preview not centering with error

Open
#1,477 2 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

- [x] I have fzf 0.30.0 or above
- [x] I have read through https://github.com/junegunn/fzf.vim/blob/master/README.md
- [x] I have read through https://github.com/junegunn/fzf/blob/master/README-VIM.md
- [x] I have read through the manual page of fzf (`man fzf`)
- [x] I have searched through the existing issues

When using `:Tags`, the preview window does not display the correct line number, but displays the below error.

![image](https://github.com/junegunn/fzf.vim/assets/627654/dd5ce59b-c101-4469-8b7d-2faac4fbc644)

Seems that the below snippet in `tagpreview.sh` is the cause:
```sh
CENTER="$("${VIMNAME}" -i NONE -u NONE -e -m -s "${FILE}" \
-c "set nomagic" \
-c "${EXCMD}" \
-c 'let l=line(".") | new | put =l | print | qa!')" || return
```

A simple replace with the below works for me, but I am wondering the implications of this. Ie, just take the line number we already get passed in via `EXCMD` and use that for the center.
```sh
CENTER=$(echo "${EXCMD}" | awk -F ' ' '{print $1}')
```

I can stick a PR in for this if it looks fine

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.