Skip to content

Switch Hop.nvim visual mode keymaps from v to x to prevent snippet/selection conflicts #1629

@std-enigma

Description

@std-enigma

Checklist

  • I have searched through the AstroNvim documentation
  • I have searched through the existing issues of this project
  • I have searched the existing issues of plugins related to this issue
  • I can replicate the bug with the minimal repro.lua provided below

Neovim version (nvim -v)

0.11.3 release

Operating system/version

Arch Linux

Terminal/GUI

kitty

Describe the bug

The current astrocommunity hop.nvim configuration uses v mode mappings for visual selections.

This has two major problems:

  1. Snippet placeholder conflicts
    Many snippet engines (e.g., LuaSnip, Ultisnips) temporarily place you in characterwise visual mode to select active placeholders.
    With mappings in v mode, pressing s while editing a placeholder triggers Hop instead of replacing the selection as intended.
    This breaks common workflows (e.g., typing s to change text in a selected placeholder) and forces you to hit <Esc> and re-enter the operation manually.

  2. Limited visual mode coverage
    v mode mappings apply only to characterwise visual mode, not to visual block mode (Ctrl-v).
    As a result, block selections currently do not get the same Hop functionality.


Additional note

The current configuration also passes an extend_visual option to hop.nvim, but this option does not exist in Hop and is silently ignored.
This means there is no actual “extend selection” behavior happening; the parameter should be removed.


Steps to Reproduce

  1. Install the hop.nvim community pack
  2. Use a snippet that has text place holder like fromim shortcut for python
  3. You are in visual mode so try to type anything that start with 's' or 'S'
  4. You will be able to see how it affects your workflow

Expected behavior

Use x mode mappings instead of v mode.
This applies mappings to both visual and visual block modes, and it avoids hijacking snippet placeholders because x mode is only active during visual selections explicitly initiated by the user.

Switching to x mode restores expected editing behavior, removes snippet conflicts, and broadens support to all visual modes.

Screenshots

Below is a demonstration of this problem
https://github.com/user-attachments/assets/7b994f86-2b02-44a3-82c8-e09df636ae31

Additional Context

No response

Minimal configuration

-- save as repro.lua
-- run with nvim -u repro.lua
-- DO NOT change the paths
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "runtime", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  -- stylua: ignore
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)

-- install plugins
local plugins = {
  { "AstroNvim/AstroNvim", import = "astronvim.plugins" },
  { "AstroNvim/astrocommunity" },
  { import = "astrocommunity.motion.hop-nvim" },


  -- add any other plugins/customizations here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

-- add anything else here (autocommands, vim.filetype, etc.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions