Update .config/nvim/lazy-lock.json
Update .config/nvim/lua/config/20_keymaps.lua Update .config/nvim/lua/plugin/03_treesitter.lua Update .config/nvim/lua/plugin/05_fzf.lua Update .config/nvim/lua/plugin/10_hop.lua Update .config/nvim/lua/plugin/35_yanky.lua
This commit is contained in:
parent
4d2c3675d9
commit
98f4fd1cbc
6 changed files with 50 additions and 44 deletions
|
|
@ -4,13 +4,11 @@ return {
|
|||
version = "*",
|
||||
config = function()
|
||||
local hop = require("hop")
|
||||
|
||||
hop.setup({
|
||||
keys = "etovxqpdygfblzhckisuran",
|
||||
jump_on_sole_occurrence = true,
|
||||
})
|
||||
|
||||
-- Runs vim cmds ... if in visual mode
|
||||
local function run_if_visual(...)
|
||||
local function if_visual(...)
|
||||
local mode = vim.fn.mode()
|
||||
if mode == "v" then
|
||||
for _, cmd in ipairs({ ... }) do
|
||||
|
|
@ -19,26 +17,22 @@ return {
|
|||
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")
|
||||
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")
|
||||
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" }, "gt", "<cmd>HopNodes<CR>", { desc = "hop to ts" })
|
||||
vim.keymap.set({ "n", "x", "o" }, "gp", hop_pattern_smart, { desc = "hop to pattern" })
|
||||
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,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue