From a44c17c95a7075ca867d59f50f6518416868e742 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Tue, 8 Nov 2022 12:12:18 +0300 Subject: [PATCH] plugins/ux: add more hotkeys for navigation --- plugins/ux/hop-nvim.lua | 48 +++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/plugins/ux/hop-nvim.lua b/plugins/ux/hop-nvim.lua index 45b10b4..b9128c7 100644 --- a/plugins/ux/hop-nvim.lua +++ b/plugins/ux/hop-nvim.lua @@ -7,35 +7,61 @@ require("hop").setup({}) local hint = require("hop.hint") -vim.keymap.set("", "hf", function() +vim.keymap.set("", "hc", "HopChar1") +vim.keymap.set("", "hlc", function() hop.hint_char1({ direction = hint.HintDirection.AFTER_CURSOR, current_line_only = true, }) end) -vim.keymap.set("", "hF", function() +vim.keymap.set("", "hhc", function() hop.hint_char1({ direction = hint.HintDirection.BEFORE_CURSOR, current_line_only = true, }) end) -vim.keymap.set("", "ht", function() +vim.keymap.set("", "hjc", function() hop.hint_char1({ direction = hint.HintDirection.AFTER_CURSOR, - current_line_only = true, - hint_offset = -1, }) end) -vim.keymap.set("", "hT", function() +vim.keymap.set("", "hkc", function() hop.hint_char1({ direction = hint.HintDirection.BEFORE_CURSOR, - current_line_only = true, - hint_offset = 1, }) end) -vim.keymap.set("", "hc", "HopChar1") vim.keymap.set("", "hw", "HopWord") +vim.keymap.set("", "hjw", function() + hop.hint_words({ + direction = hint.HintDirection.AFTER_CURSOR, + }) +end) +vim.keymap.set("", "hkw", function() + hop.hint_words({ + direction = hint.HintDirection.BEFORE_CURSOR, + }) +end) + vim.keymap.set("", "hp", "HopPattern") -vim.keymap.set("", "hl", "HopLine") -vim.keymap.set("", "hv", "HopVertical") +vim.keymap.set("", "hjp", function() + hop.hint_patterns({ + direction = hint.HintDirection.AFTER_CURSOR, + }) +end) +vim.keymap.set("", "hkp", function() + hop.hint_patterns({ + direction = hint.HintDirection.BEFORE_CURSOR, + }) +end) + +vim.keymap.set("", "hjv", function() + hop.hint_vertical({ + direction = hint.HintDirection.AFTER_CURSOR, + }) +end) +vim.keymap.set("", "hkv", function() + hop.hint_vertical({ + direction = hint.HintDirection.BEFORE_CURSOR, + }) +end)