This commit is contained in:
QQ 2023-10-09 16:48:02 +08:00
parent 149e2a93c5
commit f0699c52ac
2 changed files with 47 additions and 3 deletions

View File

@ -13,7 +13,8 @@ G.cgp = vim.nvim_create_augroup
function G.map(maps)
for _,map in pairs(maps) do
G.api.nvim_set_keymap(map[1], map[2], map[3], map[4])
vim.keymap.set(map[1], map[2], map[3], map[4])
--G.api.nvim_set_keymap(map[1], map[2], map[3], map[4])
end
end

View File

@ -1,12 +1,55 @@
return {
"phaazon/hop.nvim",
branch = "v2",
cmd = {
"HopChar1MW",
"HopChar2MW",
},
keys = {
"f","F","t","T"
},
lazy = true,
config = function ()
require("hop").setup{keys = 'etovxqpdygfblzhckisuran'}
require("hop").setup{keys = 'asdfghjkl;'}
local hop = require('hop')
local directions = require('hop.hint').HintDirection
G.map({
{"n", "<leader>f", ":HopChar1MW<CR>", {noremap = true}},
{"n", "<leader>F", ":HopChar2MW<CR>", {noremap = true}},
{"n", "f",
function ()
hop.hint_char1({
direction = directions.AFTER_CURSOR,
current_line_only = true
})
end, {noremap = true}
},
{"n", "F",
function ()
hop.hint_char1({
direction = directions.BEFORE_CURSOR,
current_line_only = true
})
end, {noremap = true}
},
{"n", "t",
function ()
hop.hint_char1({
direction = directions.AFTER_CURSOR,
current_line_only = true,
hint_offset = -1
})
end, {noremap = true}
},
{"n", "T",
function ()
hop.hint_char1({
direction = directions.BEFORE_CURSOR,
current_line_only = true,
hint_offset = -1
})
end, {noremap = true}
},
})
end
}