marks.nvim icon indicating copy to clipboard operation
marks.nvim copied to clipboard

Provide APIs to explicitly enable and disable signs not just toggle them

Open mystilleef opened this issue 4 years ago • 1 comments

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.

mystilleef avatar Nov 08 '21 06:11 mystilleef

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

b0o avatar Mar 05 '22 10:03 b0o