[mini.diff] signs are not returned in sign_getplaced? #789
-
I'm trying to build a custom This is how I'm quickly testing this :echo sign_getplaced(bufname(), {'group': '*', 'lnum': v:lnum}) So how can I get signs added by |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Signs in 'mini.diff' are placed with extmarks (which are usually more efficient). The supposed way to retrieve them is with So the suggested way would be to get all signs and filter later by vim.api.nvim_buf_get_extmarks(0, -1, { vim.v.lnum - 1, 0}, { vim.v.lnum - 1, -1}, { type = 'sign', details = true }) The better approach would be to get namespace id of 'mini.diff', but it is not guaranteed to not break. However, for personal usage it might be fine. Currently namespace name is -- Evaluate somewhere only once
local diff_ns_id = vim.api.nvim_get_namespaces().MiniDiffViz
-- Get signs only from 'mini.diff'
vim.api.nvim_buf_get_extmarks(0, diff_ns_id, { vim.v.lnum - 1, 0}, { vim.v.lnum - 1, -1}, { type = 'sign', details = true }) For completeness, there is also |
Beta Was this translation helpful? Give feedback.
Signs in 'mini.diff' are placed with extmarks (which are usually more efficient). The supposed way to retrieve them is with
nvim_buf_get_extmarks()
. Since neovim/neovim#25724 (i.e. on current Nightly) old style signs can also be retrieved this way. And this also seems to be a preferred way to do this task by 'statuscolumn' author.So the suggested way would be to get all signs and filter later by
sign_hl_group
:The better approach would be to get namespace id of 'mini.diff', but it is not guaranteed to not break. However, for personal usage it might be fine. Currently names…