-
Notifications
You must be signed in to change notification settings - Fork 46
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
The real cursor stays in its original position after autojumping #70
Comments
fyi: this is a Neovim issue that will have to be eventually fixed upstream, but I've fixed this for now for people using I hide the cursor whenever some plugin requests input :) |
Is there any update about when this issue will be fixed? I am trying out Also, is there any workaround/patch for now? Or is everybody's |
the fake cursor should be visible though, if you don't see it, set
¯_(ツ)_/¯
Except for downgrading to Nvim 0.8, no there isn't. |
Thanks for sending me to the cursor hack! I put |
For anyone looking to apply the workaround suggested by @folke above, you can hook into luavim.api.nvim_create_autocmd(
"User",
{ callback = function()
vim.cmd.hi("Cursor", "blend=100")
vim.opt.guicursor:append { "a:Cursor/lCursor" }
end,
pattern = "LeapEnter"
}
)
vim.api.nvim_create_autocmd(
"User",
{ callback = function()
vim.cmd.hi("Cursor", "blend=0")
vim.opt.guicursor:remove { "a:Cursor/lCursor" }
end,
pattern = "LeapLeave"
}
)
fennel(vim.api.nvim_create_autocmd
"User"
{ :callback
(fn []
(vim.cmd.hi "Cursor" "blend=100")
(vim.opt.guicursor:append [ "a:Cursor/lCursor" ])
)
:pattern "LeapEnter"
}
)
(vim.api.nvim_create_autocmd
"User"
{ :callback
(fn []
(vim.cmd.hi "Cursor" "blend=0")
(vim.opt.guicursor:remove [ "a:Cursor/lCursor" ])
)
:pattern "LeapLeave"
}
) vimscriptno |
This seems to work fine actually, I wasn't aware of the |
This may be fixed by neovim/neovim#27858... removing the need for the fake cursor?! |
As I understand, the fake cursor that Leap provides will be necessary even after this fix (the real cursor should appear on the command line when leaping), but at least we can get rid of the hide/show hack in our configs. EDIT: No, it indeed seems to solve the fake cursor issue too. |
Does Neovim 0.9.5 incorporate that fix? I am now getting rather strange behavior: sometimes |
I'm not sure I have this hide/show hack active in my configuration anymore. Could I please ask what line of code you are referring to so I can search to see if I have it? (Sorry for my confusion about this.) |
Ah, is it this https://github.com/ggandor/leap.nvim?tab=readme-ov-file#bugs (and associated tweaks)? |
No.
Yes. |
Sorry for the stupid question, but if Neovim 0.9.5 doesn't incorporate the fix, how can I make use of the fix? Should I (as a non-sophisticated user) wait until it is incorporated into the next Neovim release? Or is it easy to update Neovim to this intermediate build? |
Well, the hack should work fine (does it?), so there's no hurry, but otherwise, yeah, you should wait for stable 0.10. Installing a pre-release version is totally straightforward though, just download from https://github.com/neovim/neovim/releases/tag/nightly, and follow the instructions for the given OS (same as for the stable release). |
The hack doesn't seem to work for me. I pasted the version from the Leap readme into The hack here in #70 seems to be equivalent but with different formatting (e.g., uses #143 seems to be an implementation of that same hack that would seem to make it unnecessary for me to put anything into Am I missing something? (Also, is the Neovim release coming out soon? As a novice user, I think I had better wait for a stable build, but if it's going to take a long time, it would be nice to fix this particular problem.) |
I think you should put the scripts in |
Ah, thank you! I have my For reference, the old hack that was interfering was: " hack to make Leap work with current version of nvim (0.8.3). See
" https://github.com/ggandor/leap.nvim/issues/70
" and
" https://github.com/ggandor/leap.nvim/issues/27#issuecomment-1445046929
lua vim.api.nvim_set_hl(0, 'Cursor', { reverse = true }) Thanks again! |
Oops, I wrote too soon. Now, oddly enough, leap and flit work only when the target is a bracket/brace. Other targets (e.g., letters) now behave the way the brackets/braces used to behave. How can I make it work for everything? By the way, to make sure it wasn't a problem with where I put the hack, I have now moved it to -- Nvim-Tree documentation recommends disabling Netr at the very beginning of
-- the init.vim in order to avoid conflicts.
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- HACK from https://github.com/ggandor/leap.nvim?tab=readme-ov-file#bugs
-- to deal with the problem that the cursor disappears when jumping
-- to an open bracket.
-- Hide the (real) cursor when leaping, and restore it afterwards.
vim.api.nvim_create_autocmd('User', { pattern = 'LeapEnter',
callback = function()
vim.cmd.hi('Cursor', 'blend=100')
vim.opt.guicursor:append { 'a:Cursor/lCursor' }
end,
}
)
vim.api.nvim_create_autocmd('User', { pattern = 'LeapLeave',
callback = function()
vim.cmd.hi('Cursor', 'blend=0')
vim.opt.guicursor:remove { 'a:Cursor/lCursor' }
end,
}
)
-- use files in .vim
vim.cmd("set runtimepath^=~/.vim runtimepath+=~/.vim/after")
vim.cmd("let &packpath=&runtimepath")
-- use .vim/vimrc
vim.cmd("source ~/.vim/vimrc") |
It seems to me that in vscode there is still a duplicate cursor even when trying the workaround (I think I tried the one in the readme). |
ggandor/flit.nvim#3
The text was updated successfully, but these errors were encountered: