This seems to be a mismatch in behavior between Vim and Neovim.

In Vim, when in visual selection mode, * and # work as expected: they jump forward / backward to the next occurrence of the word under the cursor while preserving visual select. As a result the selection gets extended to the cursor position after the jump.

Neovim however aborts visual select mode and instead searches for the next occurrence of the selected text. This is quite irritating as when in visual select mode, all other movements expand the selection and */# are the odd ones out. (Even g*/g# work like they should Neovim, but the functionality is of course not the same as */#.) This is wildly inconsistent and I strongly prefer Vim’s behavior. */# is one of the main ways I move around in files and I expect it to behave the same regardless of what mode I’m in.

Is there a way to make Neovim behave like Vim here?

  • Possibly :xnoremap * <cmd>*? Let me know if this works
    – D. Ben Knoble
    May 6, 2023 at 18:06


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.