From 6ff23501a1fd1c75c91dfd99ff5befcfdb02c11d Mon Sep 17 00:00:00 2001 From: Henry Hsieh Date: Fri, 26 Apr 2024 01:12:09 +0800 Subject: [PATCH] feat: make `hl_mode` of hints configurable (#72) * feat: add hl_mode to change highlight of hint char * chore: fix typo in docs --------- Co-authored-by: mohsen --- doc/hop.txt | 9 +++++++++ lua/hop/defaults.lua | 1 + lua/hop/hint.lua | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/doc/hop.txt b/doc/hop.txt index 002cc6d..4d1f4fb 100644 --- a/doc/hop.txt +++ b/doc/hop.txt @@ -874,6 +874,15 @@ below. Defaults:~ `dim_unmatched = true` +`hl_mode` *hop-config-hl_mode* + Highlight mode of the hint chars. Set this option to `combine` will + preserve the background colors of original chars. Set this option to + `replace` will remove the background colors of original chars. It's useful + when the hint chars is not clear on search highlights. + + Defaults:~ + `hl_mode = "combine"` + `direction` *hop-config-direction* Direction in which to hint. See |hop.hint.HintDirection| for further details. diff --git a/lua/hop/defaults.lua b/lua/hop/defaults.lua index f8532e4..033fa13 100644 --- a/lua/hop/defaults.lua +++ b/lua/hop/defaults.lua @@ -18,6 +18,7 @@ M.case_insensitive = true M.create_hl_autocmd = true M.current_line_only = false M.dim_unmatched = true +M.hl_mode = "combine" M.uppercase_labels = false M.multi_windows = false M.windows_list = function () diff --git a/lua/hop/hint.lua b/lua/hop/hint.lua index b1d5d0f..0f221f6 100644 --- a/lua/hop/hint.lua +++ b/lua/hop/hint.lua @@ -202,7 +202,7 @@ function M.set_hint_extmarks(hl_ns, hints, opts) api.nvim_buf_set_extmark(hint.jump_target.buffer, hl_ns, row, col, { virt_text = virt_text, virt_text_pos = opts.hint_type, - hl_mode = 'combine', + hl_mode = opts.hl_mode, priority = M.HintPriority.HINT, }) end