marks.nvim
marks.nvim copied to clipboard
Provide APIs to explicitly enable and disable signs not just toggle them
Can you provide the following explicit APIs?
MarksDisableSigns
MarksDisableAllSigns
MarksEnableSigns
MarksEnableAllSigns
I need these APIs for my distraction-free settings.
Also, MarksToggleSigns will be a lot more useful if there's an API to check if signs are active or not. At the moment, I have to unreliably track and guess whether signs are active or not.
I agree. I wrote a helper function to do this (only works on a single buffer at a time):
local function marks_set_buf_state(bufnr, state)
local marks = require'marks'
if bufnr == 0 then
bufnr = vim.api.nvim_get_current_buf()
end
marks.mark_state.opt.buf_signs[bufnr] = state
marks.bookmark_state.opt.buf_signs[bufnr] = state
marks.refresh(true)
end
-- usage:
marks_set_buf_state(0, true) -- enable marks for current buf
marks_set_buf_state(13, false) -- disable marks for buffer 13