hop.nvim
hop.nvim copied to clipboard
Inconsistent HopChar1 behavior in operator-pending mode
The HopChar1 command and its variants have inconsistent behavior in the operator-pending mode, depending on whether you are hopping to the last character on the line or not.
To Reproduce Minimal reproducible config:
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)
local plugins = {
{ "smoka7/hop.nvim",
version = "*",
config = function()
require("hop").setup {}
vim.keymap.set({ "n", "v", "o" }, "f", function()
vim.cmd "HopChar1CurrentLine"
end, { silent = true })
end,
},
}
require("lazy").setup(plugins,{})
For what it's worth, the behavior is exactly the same if instead of nvim.cmd "HopChar1CurrentLine"
I use:
require"hop".hint_char1 {
current_line_only = true,
}
Steps to reproduce:
- Before each step below have only
somefn(arg);
in the current line, making sure;
is the last character on the line, enter normal mode, and go to the start of the line. - Type
df)
-
somefn(arg)
gets deleted, and;
remains
-
- Type
df;
-
somefn(arg)
gets deleted, and;
remains again - what should get deleted is
somefn(arg);
, and what should remain is an empty line
-
- Type
yf)o<ESC>p
-
somefn(arg)
gets pasted to the next line
-
- Type
yf;o<ESC>p
-
somefn(arg)
gets pasted to the next line again - what should get pasted is
somefn(arg);
-
However, the command works as expected in normal and visual mode.
-
f)
hops to the)
character, andf;
hops to the last character;
-
vf)
selects to the)
character,vf;
selects to the last character;
Expected behavior In the operator-pending mode the command HopChar1 should have identical behavior when you hop to the last character in the line as when you hop to any other character in it.
Screenshots I could attach screenshots if you wish, they would picture the same situation illustrated in the "To Reproduce:" section.
Version:
- Nvim version: v0.10.1
- hop.nvim version: v2.7.1