Update .config/nvim/lazy-lock.json

Update .config/nvim/lua/plugin/10_hop.lua
This commit is contained in:
Lewis Wynne 2025-11-16 18:26:41 +00:00
parent 42883224bc
commit d1b453c3ed
2 changed files with 33 additions and 27 deletions

View file

@ -11,13 +11,13 @@
"img-clip.nvim": { "branch": "main", "commit": "e7e29f0d07110405adecd576b602306a7edd507a" },
"lazy.nvim": { "branch": "main", "commit": "db067881fff0fd4be8c00e5bde7492e0e1c77a2f" },
"lazydev.nvim": { "branch": "main", "commit": "371cd7434cbf95606f1969c2c744da31b77fcfa6" },
"leap.nvim": { "branch": "main", "commit": "1fc7f38b69cc4644505e3ff74ba69b1682a85dd9" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "d7b5feb6e769e995f7fcf44d92f49f811c51d10c" },
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
"mini.diff": { "branch": "main", "commit": "98fc732d5835eb7b6539f43534399b07b17f4e28" },
"mini.icons": { "branch": "main", "commit": "284798619aed9f4c1ac1b9417b9a5e3b4b85ef3a" },
"mini.pairs": { "branch": "main", "commit": "b9aada8c0e59f2b938e98fbf4eae0799eba96ad9" },
"mini.snippets": { "branch": "main", "commit": "7610dc3aaf7fb09b9cc428273a8ba15ef8aef495" },
"multicursor.nvim": { "branch": "1.0", "commit": "0c6ceae228bf209e8b8717df9de500770c4e7022" },
"neoscroll.nvim": { "branch": "master", "commit": "f957373912e88579e26fdaea4735450ff2ef5c9c" },
"nvim-colorizer.lua": { "branch": "master", "commit": "81e676d3203c9eb6e4c0ccf1eba1679296ef923f" },
"nvim-lspconfig": { "branch": "master", "commit": "a89bfcfd0e44f898341ac8a80ba83ccf6218bef3" },

View file

@ -1,39 +1,45 @@
return {
{
"smoka7/hop.nvim",
version = "*",
"ggandor/leap.nvim",
config = function()
local hop = require("hop")
hop.setup({
jump_on_sole_occurrence = true,
require("leap").opts.preview = function(ch0, ch1, ch2)
return not (
ch1:match("%s")
or (ch0:match("%a") and ch1:match("%a") and ch2:match("%a"))
)
end
-- hop label at start of word, rather than the end
require("leap").opts.on_beacons = function(targets, _, _)
for _, t in ipairs(targets) do
if t.label and t.beacon then
t.beacon[1] = 0
end
end
end
-- gray out backdrop when selecting
vim.api.nvim_set_hl(0, "LeapBackdrop", { link = "Comment" })
require("leap").opts.equivalence_classes = {
" \t\r\n",
"([{",
")]}",
"'\"`",
}
vim.keymap.set({ "n", "x", "o" }, "s", function()
require("leap").leap({ target_windows = vim.api.nvim_list_wins() })
if vim.fn.mode() == "v" then
vim.cmd("normal! iw")
end
end)
vim.keymap.set({ "n", "o" }, "gs", function()
require("leap.remote").action({
input = vim.fn.mode(true):match("o") and "" or "v",
})
local function if_visual(...)
local mode = vim.fn.mode()
if mode == "v" then
for _, cmd in ipairs({ ... }) do
vim.cmd(cmd)
end
end
end
local function hop_word_smart()
---@diagnostic disable-next-line: missing-fields
hop.hint_words({ multi_windows = true })
if_visual("normal! iw")
end
local function hop_pattern_smart()
---@diagnostic disable-next-line: missing-fields
hop.hint_char2({ multi_windows = true })
if_visual("normal! iw")
end
-- stylua: ignore start
vim.keymap.set({ "n", "x", "o" }, "gw", hop_word_smart, { desc = "hop to word" })
vim.keymap.set({ "n", "x", "o" }, "gt", "<cmd>HopNodes<CR>", { desc = "hop to ts" })
vim.keymap.set({ "n", "x", "o" }, "s", hop_pattern_smart, { desc = "hop to pattern" })
-- stylua: ignore end
end)
end,
},
}