mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 18:58:12 +00:00
feat(words): add fold_open
and set_jump_point
config options (#31)
## Description Added `fold_open` and `set_jump_point` as config options for `Snacks.words.jump`.
This commit is contained in:
parent
5ccf72e6d0
commit
5dc749b045
2 changed files with 10 additions and 0 deletions
|
@ -13,6 +13,8 @@ Auto-show LSP references and quickly navigate between them
|
|||
debounce = 200, -- time in ms to wait before updating
|
||||
notify_jump = false, -- show a notification when jumping
|
||||
notify_end = true, -- show a notification when reaching the end
|
||||
foldopen = true, -- open folds after jumping
|
||||
jumplist = true, -- set jump point before jumping
|
||||
modes = { "n", "i", "c" }, -- modes to show references
|
||||
}
|
||||
```
|
||||
|
|
|
@ -11,6 +11,8 @@ local defaults = {
|
|||
debounce = 200, -- time in ms to wait before updating
|
||||
notify_jump = false, -- show a notification when jumping
|
||||
notify_end = true, -- show a notification when reaching the end
|
||||
foldopen = true, -- open folds after jumping
|
||||
jumplist = true, -- set jump point before jumping
|
||||
modes = { "n", "i", "c" }, -- modes to show references
|
||||
}
|
||||
|
||||
|
@ -104,10 +106,16 @@ function M.jump(count, cycle)
|
|||
end
|
||||
local target = words[idx]
|
||||
if target then
|
||||
if config.jumplist then
|
||||
vim.cmd.normal({ "m`", bang = true })
|
||||
end
|
||||
vim.api.nvim_win_set_cursor(0, target.from)
|
||||
if config.notify_jump then
|
||||
Snacks.notify.info(("Reference [%d/%d]"):format(idx, #words), { id = "snacks.words.jump", title = "Words" })
|
||||
end
|
||||
if config.foldopen then
|
||||
vim.cmd.normal({ "zv", bang = true })
|
||||
end
|
||||
elseif config.notify_end then
|
||||
Snacks.notify.warn("No more references", { id = "snacks.words.jump", title = "Words" })
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue