From f0699c52ac9d0e28288f8af4b69f2ca3acb37041 Mon Sep 17 00:00:00 2001 From: QQ Date: Mon, 9 Oct 2023 16:48:02 +0800 Subject: [PATCH] dasdas --- lua/G.lua | 3 ++- lua/normal/plugsettings/hop.lua | 47 +++++++++++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/lua/G.lua b/lua/G.lua index 1614fe8..b6f3297 100644 --- a/lua/G.lua +++ b/lua/G.lua @@ -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 diff --git a/lua/normal/plugsettings/hop.lua b/lua/normal/plugsettings/hop.lua index 6ba914f..d5974e7 100644 --- a/lua/normal/plugsettings/hop.lua +++ b/lua/normal/plugsettings/hop.lua @@ -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", "f", ":HopChar1MW", {noremap = true}}, {"n", "F", ":HopChar2MW", {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 }