Update .config/nvim/init.lua

Update .config/nvim/lazy-lock.json
Update .config/nvim/lua/plugin/10_hop.lua
Add .config/nvim/lua/plugin/11_eyeliner.lua
This commit is contained in:
Lewis Wynne 2025-11-03 14:19:42 +00:00
parent d41eaefa7c
commit b0e03a69ed
4 changed files with 54 additions and 12 deletions

View file

@ -2,16 +2,44 @@ return {
{
"smoka7/hop.nvim",
version = "*",
opts = {
keys = "etovxqpdygfblzhckisuran",
},
-- stylua: ignore
keys = {
{ "gw", "<cmd>HopWordMW<CR>", mode = { "n", "x", "o" }, desc = "hop to word" },
{ "gc", "<cmd>HopChar1MW<CR>", mode = { "n", "x", "o" }, desc = "hop to char" },
{ "gl", "<cmd>HopLineStartMW<CR>", mode = { "n", "x", "o" }, desc = "hop to word" },
{ "gn", "<cmd>HopNodes<CR>", mode = { "n", "x", "o" }, desc = "hop nodes" },
{ "gp", "<cmd>HopPatternMW<CR>", mode = { "n", "x", "o" }, desc = "hop to pattern" },
},
config = function()
local hop = require("hop")
hop.setup({
keys = "etovxqpdygfblzhckisuran",
})
-- Runs vim cmds ... if in visual mode
local function run_if_visual(...)
local mode = vim.fn.mode()
if mode == "v" then
for _, cmd in ipairs({ ... }) do
vim.cmd(cmd)
end
end
end
-- HopWordMW, and include whole word if in visual mode.
local function hop_word_smart()
---@diagnostic disable-next-line: missing-fields
hop.hint_words({ multi_windows = true })
run_if_visual("normal! iw")
end
-- HopPatternMW, and include whole word if in visual mode.
local function hop_pattern_smart()
---@diagnostic disable-next-line: missing-fields
hop.hint_patterns({ multi_windows = true })
run_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" }, "gl", "<cmd>HopChar1MW<CR>", { desc = "hop to char" })
vim.keymap.set({ "n", "x", "o" }, "g:", "<cmd>HopLineStartMW<CR>", { desc = "hop to line" })
vim.keymap.set({ "n", "x", "o" }, "gn", "<cmd>HopNodes<CR>", { desc = "hop nodes" })
vim.keymap.set({ "n", "x", "o" }, "gp", hop_pattern_smart, { desc = "hop to pattern" })
-- stylua: ignore end
end,
},
}

View file

@ -0,0 +1,11 @@
return {
{
"jinh0/eyeliner.nvim",
opts = {
highlight_on_key = true,
dim = true,
max_length = 9000,
default_keymaps = true,
},
},
}