dashboard-nvim icon indicating copy to clipboard operation
dashboard-nvim copied to clipboard

Fix position of preview window

Open nnhutan opened this issue 1 year ago • 0 comments

When using the hyper theme with preview config, the logo is shown by the preview command on the preview window is always on the top of the screen. I think the problem is on line 7 of file lua/dashboard/preview.lua:

   local row = math.floor(opt.height / 5)

The position of the preview window seems to be fixed. So my solution is updating the position row of the preview window after rendering all components In lua/dashboard/theme/hyper.lua, line 495. I found:

  local size = math.floor(vim.o.lines / 2)
      - math.ceil(api.nvim_buf_line_count(config.bufnr) / 2)
      - 2
  local fill = utils.generate_empty_table(size)

So I set the value for the row attribute to size to make the preview window to be on the right position as the normal logo(header)

PS: Forgive my poor English.

image

nnhutan avatar Jan 20 '24 03:01 nnhutan