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

builtin_marks break popups

Open ttytm opened this issue 3 years ago • 5 comments

don't know it this little bug i'm experiencing is due to my config, but I couldn't find a fix on my side for it.

When enabling builtin_marks the . mark is shown in every popup window. The additional width added by the mark results in an inconvient displacement of the contents of popup windows. With builtin_marks enabled: Screenshot from 2022-05-07 20-46-30 Without...: Screenshot from 2022-05-07 20-46-58

ttytm avatar May 07 '22 18:05 ttytm

Can you post your config? Just from your description, this doesn't sound like a bug, as I would expect a built in mark to show up if you have builtin_marks enabled.

chentoast avatar May 09 '22 17:05 chentoast

Thanks for your reply! You mean the marks or for popup config? For marks, it's basically the default config. Currently, without builtin_marks. I probably re-enable them and remove the . mark as I would like to have them as indicators. Is there a way to exclude them from popups?

marks.setup {
  -- whether to map keybinds or not. default true
  default_mappings = false,
  -- which builtin marks to show. default {}
  -- builtin_marks = { ".", "<", ">", "^" },
  -- whether movements cycle back to the beginning/end of buffer. default true
  cyclic = true,
  -- whether the shada file is updated after modifying uppercase marks. default false
  force_write_shada = false,
  -- how often (in ms) to redraw signs/recompute mark positions. 
  -- higher values will have better performance but may cause visual lag, 
  -- while lower values may cause performance penalties. default 150.
  refresh_interval = 150,
  -- sign priorities for each type of mark - builtin marks, uppercase marks, lowercase
  -- marks, and bookmarks.
  -- can be either a table with all/none of the keys, or a single number, in which case
  -- the priority applies to all marks.
  -- default 10.
  sign_priority = { lower=10, upper=15, builtin=8, bookmark=20 },
  -- disables mark tracking for specific filetypes. default {}
  excluded_filetypes = {},
  -- marks.nvim allows you to configure up to 10 bookmark groups, each with its own
  -- sign/virttext. Bookmarks can be used to group together positions and quickly move
  -- across multiple buffers. default sign is '!@#$%^&*()' (from 0 to 9), and
  -- default virt_text is "".
  bookmark_0 = {
    sign = "⚑",
    -- virt_text = "hello world"
  },
  -- mappings = {}
  mappings = {
    -- set_next = "m,",
    -- next = "mj",
    -- prev = "mk",
    -- preview = "mf",
    set_bookmark0 = "m0",
  }
}

ttytm avatar May 09 '22 17:05 ttytm

If you want the . mark to show up in buffers but not in popups, you should probably use the excluded_filetypes keyword to disable mark tracking in those popups. Currently, per-buffer per-mark exclusions are not yet supported by the plugin.

chentoast avatar May 10 '22 19:05 chentoast

Hey thanks for answering.

Found a solution. TL;DR; excluded_filetypes = {''},

backstory: The popups are those that emulate a keyboard triggered LSP hover action. I couldn't think of the filetype which should be excluded to make it just disappear for those hover actions. I thought it's maybe a man-pages specific file type or something. E.g, the screenshots above show a rust file. So I tried disabling them for rust files (just for testing, eventually I wouldn't have wanted them disabled for rust files). Expectedly, that disabled them for rust files but the "hovers" still contained them. Moving on into the popup-buffer and trying to print the filetype :set filetype? prints filetype=. So we don't have a clear filetype here. So I just tried to exclude '' empty filetypes. Worked like a charm, and it keeps working with other know filetypes keep working.

'toggleterm' is another "artificial" filetype that can be disabled in the excluded_filetypes

ttytm avatar May 12 '22 12:05 ttytm

Great! Just keep in mind that excluded_filetypes = {''} will disable tracking for all unnamed buffers, not just lsp popups. In the future, I may add more fine grained control over disabling/enabling marks in specific buffers, but this is probably a decent workaround for now.

chentoast avatar May 13 '22 12:05 chentoast