feat: Move and goto_location simultaneously, and highlight

See readme changes
This commit is contained in:
hedy
2023-11-02 21:37:40 +08:00
parent fe98a8cf8a
commit e3d622445e
4 changed files with 50 additions and 10 deletions

View File

@@ -47,6 +47,8 @@ M.defaults = {
fold_all = 'W',
unfold_all = 'E',
fold_reset = 'R',
down_and_goto = '<C-j>',
up_and_goto = '<C-k>',
},
lsp_blacklist = {},
symbol_blacklist = {},

View File

@@ -110,4 +110,17 @@ M.merge_items_rec = function(new_node, old_node, index, parent)
end
end
M.flash_highlight = function(winnr, lnum, durationMs, hl_group)
hl_group = hl_group or "Visual"
if durationMs == true or durationMs == 1 then
durationMs = 300
end
local bufnr = vim.api.nvim_win_get_buf(winnr)
local ns = vim.api.nvim_buf_add_highlight(bufnr, 0, hl_group, lnum - 1, 0, -1)
local remove_highlight = function()
pcall(vim.api.nvim_buf_clear_namespace, bufnr, ns, 0, -1)
end
vim.defer_fn(remove_highlight, durationMs)
end
return M