-
-
Notifications
You must be signed in to change notification settings - Fork 583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cursor jumps to start of vim buffer (if fugitive and projectionist installed) #1164
Comments
Thanks for finding out that fugitive and projectionist are the cause of this. I'm having the same issue and I also have both those plugins installed. And, indeed, it only happens when both plugins are enabled. My environment: Linux and macOS, Vim 8.2.2035 (self-compiled) and using ZSH + tmux as a shell (but it also happens in a plain I think it started after fzf switched to using a popup window. Everything works fine in fzf v0.22.0 but no longer in v0.23.0 |
I am having the same issue, but just when projectionist is enabled. Fugitive doesn't seem to cause any issues for me. |
I noticed this when trying out the FZF layout as |
Sounds like this may be the same issue, and one step closer to the root cause: vim/vim#5820 |
Thanks @edgarjs – moving it to I added |
Without this, I was getting problems with the vim popup window scrolling to the top using fzf. Absolute wizard responsible for figuring this out: junegunn/fzf.vim#1164
Wow, great job figuring that out. I just removed |
Vim patch 8.2.0413 enables BufFilePre and BufFilePost autocmds for terminal buffers. This causes the cursor to jump to the start of the current buffer when projectionist is enabled and a terminal popup window is created, for example by either the FZF.vim or vim-floaterm plugins. Terminal popup windows are created by starting a hidden terminal buffer and then creating a popup to show that terminal buffer. Projectionist's BufFilePost autocmd is now triggered for these hidden terminal buffers, and somewhere along the line this causes the cursor to jump to the top. I'm not sure exactly what causes this cursor jump, but one workaround is to add a condition to the autocmd to only call ProjectionistDetect if the autocmd file name refers to a file that actually exists/isreadable. This seems reasonable to me, so this commit just adds that condition. More information: vim/vim#5820 junegunn/fzf.vim#1164 tpope#155
Vim patch 8.2.0413 enables BufFilePre and BufFilePost autocmds for terminal buffers. This causes the cursor to jump to the start of the current buffer when projectionist is enabled and a terminal popup window is created, for example by either the FZF.vim or vim-floaterm plugins. Terminal popup windows are created by starting a hidden terminal buffer and then creating a popup to show that terminal buffer. Projectionist's BufFilePost autocmd is now triggered for these hidden terminal buffers, and somewhere along the line this causes the cursor to jump to the top. I'm not sure exactly what causes this cursor jump, but one workaround is to add a condition to the autocmd to only call ProjectionistDetect if the autocmd file name refers to a file that actually exists/isreadable. This seems reasonable to me, so this commit just adds that condition. More information: vim/vim#5820 junegunn/fzf.vim#1164 tpope#155
It looks like the underlying Vim issue has just been closed by this patch 👏: (I haven't confirmed the behaviour yet.) |
@edwardsnjd I've just tested the latest vim from github and it does fix this problem :-) |
Vim patch 8.2.0413 enables BufFilePre and BufFilePost autocmds for terminal buffers and also introduces a minor bug affecting nested autocmds, which causes the cursor to jump to the start of the current buffer when projectionist is enabled and a terminal popup window is created, for example by either the FZF.vim or vim-floaterm plugins. More information: vim/vim#5820 junegunn/fzf.vim#1164 tpope#155 Though this bug has now been fixed in vim, it may take a while to make its way though to package repositories and onto peoples' machines, so this commit works around the issue for now by simply avoiding calling ProjectionistDetect for terminal buffers. It does this by checking that the autocmd file name refers to a file that actually exists rather than checking that the &buftype is "terminal" because the &buftype has not been set to "terminal" at the time the BufFilePost autocmd is triggered.
Workaround for terminal popup cursor jump issue, cursor jumps to start of buffer when using FZF.vim with a terminal popup window (the default). More information: vim/vim#5820 junegunn/fzf.vim#1164 tpope/vim-projectionist#155
I can second @mmrwoods that after updating vim ( |
man fzf
)Problem / Steps to reproduce
Thanks for this great tool! This issue seems to be an interaction between
fzf.vim
,vim-fugitive
andvim-projectionist
. I am posting the issue here first because it is triggered when running a fzf command. I'll cross-post it to those other projects if this doesn't jump out as an issue with fzf.Problem
fzf.vim
commands work as expected but when the fzf window is closed, the cursor in the buffer has jumped to the top. This only happens if thevim-fugitive
andvim-projectionist
vim plugins are also installed and enabled.Steps
vim-plug
vim-fugitive
,vim-projectionist
,fzf
andfzf.vim
plugins (see below for a minimal.vimrc
to repro):Maps
(or any of the other built in fzf commands) to open a fzf windowCtrl-c
)Expected: The cursor is where you left it.
Actual: The cursor is at the start of the buffer.
(The following screen capture shows the issue, then how disabling one of the
tpope
plugins seems to fix the issue.)Environment
Minimal
.vimrc
:Vim version
Similar issues
These issues seemed similar but didn't describe my issue:
The text was updated successfully, but these errors were encountered: