mirror of
https://github.com/LazyVim/starter.git
synced 2026-07-25 14:01:03 +00:00
More hop mappings
This commit is contained in:
parent
109311cddf
commit
a4301613f9
1 changed files with 77 additions and 14 deletions
|
|
@ -2,19 +2,82 @@ return {
|
||||||
"smoka7/hop.nvim",
|
"smoka7/hop.nvim",
|
||||||
version = "*",
|
version = "*",
|
||||||
opts = {},
|
opts = {},
|
||||||
config = function()
|
keys = {
|
||||||
local hop = require("hop")
|
|
||||||
hop.setup()
|
|
||||||
vim.api.nvim_set_hl(0, "HopNextKey", { fg = "#ffcc00", bold = true })
|
|
||||||
vim.api.nvim_set_hl(0, "HopNextKey1", { fg = "#ff8800", bold = true })
|
|
||||||
vim.api.nvim_set_hl(0, "HopNextKey2", { fg = "#ff4400" })
|
|
||||||
|
|
||||||
-- Define key mappings similar to EasyMotion
|
-- Define key mappings similar to EasyMotion
|
||||||
vim.keymap.set("n", "<leader><leader>f", function()
|
{
|
||||||
require("hop").hint_char1({
|
"<leader><leader>f",
|
||||||
direction = require("hop.hint").HintDirection.AFTER_CURSOR,
|
function()
|
||||||
current_line_only = false,
|
require("hop").hint_char1({
|
||||||
})
|
direction = require("hop.hint").HintDirection.AFTER_CURSOR,
|
||||||
end, { desc = "Jump to character (EasyMotion-like)" })
|
current_line_only = false,
|
||||||
end,
|
})
|
||||||
|
end,
|
||||||
|
mode = { "n", "x", "o" },
|
||||||
|
desc = "Jump to character (EasyMotion-like)",
|
||||||
|
},
|
||||||
|
-- Define key mappings similar to EasyMotion
|
||||||
|
{
|
||||||
|
"<leader><leader>F",
|
||||||
|
function()
|
||||||
|
require("hop").hint_char1({
|
||||||
|
direction = require("hop.hint").HintDirection.BEFORE_CURSOR,
|
||||||
|
current_line_only = false,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
mode = { "n", "x", "o" },
|
||||||
|
desc = "Jump to character (EasyMotion-like)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"f",
|
||||||
|
function()
|
||||||
|
require("hop").hint_char1({
|
||||||
|
direction = require("hop.hint").HintDirection.AFTER_CURSOR,
|
||||||
|
current_line_only = true,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
mode = { "n", "x", "o" },
|
||||||
|
desc = "Hop forward to char",
|
||||||
|
},
|
||||||
|
|
||||||
|
-- EasyMotion-style `F` search (backward, current line only)
|
||||||
|
{
|
||||||
|
"F",
|
||||||
|
function()
|
||||||
|
require("hop").hint_char1({
|
||||||
|
direction = require("hop.hint").HintDirection.BEFORE_CURSOR,
|
||||||
|
current_line_only = true,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
mode = { "n", "x", "o" },
|
||||||
|
desc = "Hop backward to char",
|
||||||
|
},
|
||||||
|
|
||||||
|
-- `t` behaves like `f` but stops before the target character (forward)
|
||||||
|
{
|
||||||
|
"t",
|
||||||
|
function()
|
||||||
|
require("hop").hint_char1({
|
||||||
|
direction = require("hop.hint").HintDirection.AFTER_CURSOR,
|
||||||
|
current_line_only = true,
|
||||||
|
hint_offset = -1,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
mode = { "n", "x", "o" },
|
||||||
|
desc = "Hop forward before char",
|
||||||
|
},
|
||||||
|
|
||||||
|
-- `T` behaves like `F` but stops before the target character (backward)
|
||||||
|
{
|
||||||
|
"T",
|
||||||
|
function()
|
||||||
|
require("hop").hint_char1({
|
||||||
|
direction = require("hop.hint").HintDirection.BEFORE_CURSOR,
|
||||||
|
current_line_only = true,
|
||||||
|
hint_offset = 1,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
mode = { "n", "x", "o" },
|
||||||
|
desc = "Hop backward before char",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue