-
Notifications
You must be signed in to change notification settings - Fork 139
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 moves back to beginning of line when exiting :FZF popup on Vim 9 (after #209) #224
Comments
@yous thanks for reporting! What is the expected behaviour? What did it used to do that it doesn't any more? Could you provide me the command-line or script you used for Much appreciated! |
The expected behavior is, after I press Esc, the cursor should go back to the previous location. But currently, the cursor goes to the first line after the popup window closed, so screen scrolls to the top. I ran |
Thanks for the details! |
I also have this problem. As a tiny bit more information, it happens on any pop-up specified by |
@yous @midgleyc which Vim and FZF versions? I haven't been able to repro yet. (But I'm using
and fzf 0.44.1. |
I can reproduce in WSL with these versions: $ vim --version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Nov 11 2023 17:59:33)
Included patches: 1-2100 $ fzf --version
0.44.1 (d7d2ac3) |
Also WSL, with:
And the latest versions of fzf.vim, installed through Plug:
|
Thanks for the quick responses! I'll try Vim 9. |
I am able to repro on Vim 9 --- the behaviour is different at e269673^ than at that commit.
Additionally, I see the same difference at 345a5a3. I think I must have accidentally hit rebase-merge on #209 --- sorry! e269673 is part of the feature branch for #209, and is not in the history of Edit I wonder if this is similar to junegunn/fzf#2041. A workaroundjunegunn/fzf.vim#1164 (comment) (don't use popup) fixes the problem for me, but at the cost of a change in UX |
@yous @midgleyc It looks like this might be a Vim bug. Would you be willing to try my MCVE at https://github.com/cxw42/vim9-tabstop-repro-2023-11 and see if you observe the same issue? Instructions in the README. Once I hear back from you, I will report on the Vim issue tracker. Thanks! Summary: It appears Some options include:
|
what is the purpose of the |
I'd suggest to add a condition like this to it to fix it: function! s:SetTabstop(which) abort
let l:tabstop = 8
let l:bufnr = str2nr(expand('<abuf>'))
" skip this event for terminal buffers
if bufname(l:bufnr) =~ '^!\w*sh$'
return
endif |
I can confirm that observed behaviors mentioned in https://github.com/cxw42/vim9-tabstop-repro-2023-11 are reproducible in macOS. $ vim --version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Nov 11 2023 17:59:33)
macOS version - arm64
Included patches: 1-2100 $ fzf --version
0.44.1 (d7d2ac3) Also when I added |
@chrisbra @yous thanks very much!
This seems like either a vim or an fzf bug --- @chrisbra do you have any thoughts on which it might be? Edit Using the repro, when
that is, buffer 2 has just been renamed to
but Oh, I think I see. If I edit an empty file and a nonempty file in a single window, then toggle between them with So I think the desired behaviour would be for fzf to open the popup first, and open the terminal in the popup, rather than the other way around. Does that make sense? Possibly-similar fzf issue: junegunn/fzf.vim#1164 |
It was added in aadfe23 "Reload config on file name changes". It looks from |
Not sure, It may be the normal way how the terminal is started inside the popup. I would rather add the condition to skip the auto command for buffer names starting with ! (indicating a terminal). Or perhaps that auto command should use <buffer> and only trigger for buffers where editorconfig is actually active, instead of for all buffers.
Am 24. November 2023, um 20:37, schrieb Chris White ***@***.***>:
@chrisbra @yous thanks very much!
The terminal seems to be running in the same window as test.c at least temporarily
This seems like either a vim or an fzf bug --- @chrisbra do you have any thoughts on which it might be?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
[ { ***@***.***": "<a href="http://schema.org">http://schema.org</a>", ***@***.***": "EmailMessage", "potentialAction": { ***@***.***": "ViewAction", "target": "<a href="#224 (comment)">https://github.com/editorconfig/editorconfig-vim/issues/224#issuecomment-1826033736</a>", "url": "<a href="#224 (comment)">https://github.com/editorconfig/editorconfig-vim/issues/224#issuecomment-1826033736</a>", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { ***@***.***": "Organization", "name": "GitHub", "url": "<a href="https://github.com">https://github.com</a>" } } ]
|
@chrisbra why does
behave differently from
? ( |
Test results mentioned in <editorconfig/editorconfig-vim#224 (comment)>
:FZF opens a terminal in the same window as the current buffer, and setbufvar(tabstop) affects the cursor position in the current buffer as well as the cursor position in the terminal buffer. To avoid that, don't set tabstop in terminal windows running shells.
One is switching buffers, before setting the option value, the other is just setting the buffer local variable for the current buffer.
Am 24. November 2023, um 21:06, schrieb Chris White ***@***.***>:
@chrisbra why does
call setbufvar(l:abuf, '&tabstop', l:tabstop)
behave differently from
" bufnr() == l:abuf let &l:tabstop = l:tabstop
? (:help eval.txt says that the latter corresponds to :setlocal, so I also tried that, and it does not repro.) I don't understand why "Vim tries to validate the cursor position" when using setbufvar but not when using let &l:/:setlocal. Thanks in advance for any information you can provide!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
[ { ***@***.***": "<a href="http://schema.org">http://schema.org</a>", ***@***.***": "EmailMessage", "potentialAction": { ***@***.***": "ViewAction", "target": "<a href="#224 (comment)">https://github.com/editorconfig/editorconfig-vim/issues/224#issuecomment-1826051347</a>", "url": "<a href="#224 (comment)">https://github.com/editorconfig/editorconfig-vim/issues/224#issuecomment-1826051347</a>", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { ***@***.***": "Organization", "name": "GitHub", "url": "<a href="https://github.com">https://github.com</a>" } } ]
|
:FZF opens a terminal in the same window as the current buffer, and setbufvar(tabstop) affects the cursor position in the current buffer as well as the cursor position in the terminal buffer. To avoid that, don't set tabstop in terminal windows running shells.
I don't see the problem with #229. Thanks! |
:FZF opens a terminal in the same window as the current buffer, and setbufvar(tabstop) affects the cursor position in the current buffer as well as the cursor position in the terminal buffer. To avoid that, don't set tabstop in terminal windows running shells.
I found another problem with #229, .editorconfig:
test.c: #include <stdio.h>
int main() {
} test.vimrc: set nocompatible
call plug#begin()
Plug 'editorconfig/editorconfig-vim'
call plug#end()
autocmd FileType c EditorConfigReload
|
Ah, |
Just wondering if someone can post the fix here for folks. Currently setting up a new laptop with VIM9 and experiencing this problem. Should I paste this into my
|
@misraelson If you clone this repo and add it to the beginning of your runtimepath, I think it will take precedence and you will get the fix. I'm not sure, though, as I haven't migrated to vim9 yet. Any vim9 folks know for sure? I can tell you that pasting |
test.vimrc
:.editorconfig
:test.c
:How to reproduce the problem:
vim -u test.vimrc test.c
:FZF
I couldn't reduce
test.vimrc
further as I don't know much about popup windows. I've also rungit bisect
, and it pointed e269673.Originally posted by @yous in #209 (comment)
The text was updated successfully, but these errors were encountered: