Isrothy / neominimap.nvim

Yet another minimap plugin for Neovim
MIT License
155 stars 3 forks source link

Prevent miminap from refreshing on neovim enter #157

Closed JoseConseco closed 2 weeks ago

JoseConseco commented 2 weeks ago

Is your feature request related to a problem? Please describe. I often jump from neovim, to blender - to test out my script. I noticed neominimap is refreshing itself each time when I jump to neovim, even if nothing was changed in active buffer. And since I have more than 1.5k of lines, it makes neovim lag for 1-2 seconds.

Describe the solution you'd like Do not referesh minimap when jumping back into neovim from other apps.

Isrothy commented 2 weeks ago

Could you please enable detailed logging so I can better understand what’s triggering the refresh? You can do this by adding the following to your configuration:

vim.g.neominimap = {
    log_level = vim.log.levels.TRACE
}

This will generate a log file. After reproducing the issue, please share the log with me so I can investigate further. Thank you!

Isrothy commented 2 weeks ago

To better understand and address the issue, could you please provide a minimal configuration that reliably reproduces this problem? This will help us investigate the cause and ensure that the solution works for your specific setup.

JoseConseco commented 2 weeks ago

THis is log for me switching focus to nvim from other app, (no code edited, no buffer changes, no edits, just jumping back to neovim from blender):

[2024-08-27 12:42:02] [TRACE] Refreshing minimap for buffer 48.
[2024-08-27 12:42:02] [TRACE] Attempting to refresh minimap for buffer 48
[2024-08-27 12:42:02] [TRACE] Buffer 48 should not generate minimap due to its type nofile
[2024-08-27 12:42:02] [TRACE] Minimap buffer refreshed for buffer 48.
[2024-08-27 12:42:02] [TRACE] Refreshing minimap for buffer 49.
[2024-08-27 12:42:02] [TRACE] Attempting to refresh minimap for buffer 49
[2024-08-27 12:42:02] [TRACE] Buffer 49 should not generate minimap due to its type nofile
[2024-08-27 12:42:02] [TRACE] Minimap buffer refreshed for buffer 49.
[2024-08-27 12:42:02] [TRACE] WinClosed event triggered for window 1035.
[2024-08-27 12:42:02] [TRACE] BufUnload event triggered for buffer 48.
[2024-08-27 12:42:02] [TRACE] WinClosed event triggered for window 1036.
[2024-08-27 12:42:02] [TRACE] BufUnload event triggered for buffer 49.
[2024-08-27 12:42:02] [TRACE] Updating search status for buffer 1.
[2024-08-27 12:42:02] [TRACE] Search status updated for buffer 1.
[2024-08-27 12:42:02] [TRACE] Refreshing minimap window for window ID: 1036.
[2024-08-27 12:42:02] [TRACE] Refreshing minimap for window 1036
[2024-08-27 12:42:02] [TRACE] Window 1036 is not valid or should not be shown
[2024-08-27 12:42:02] [TRACE] Minimap window refreshed for window 1036.
[2024-08-27 12:42:02] [TRACE] Refreshing minimap for window 1035.
[2024-08-27 12:42:02] [TRACE] Refreshing minimap for window 1035
[2024-08-27 12:42:02] [TRACE] Window 1035 is not valid or should not be shown
[2024-08-27 12:42:02] [TRACE] Minimap window refreshed for window 1035.
[2024-08-27 12:42:02] [TRACE] Wiping out minimap for buffer 48.
[2024-08-27 12:42:02] [WARN] Buffer 48 is not valid. Skipping deletion of minimap.
[2024-08-27 12:42:02] [TRACE] Minimap buffer wiped out for buffer 48.
[2024-08-27 12:42:02] [TRACE] Refreshing minimap for window 1036.
[2024-08-27 12:42:02] [TRACE] Refreshing minimap for window 1036
[2024-08-27 12:42:02] [TRACE] Window 1036 is not valid or should not be shown
[2024-08-27 12:42:02] [TRACE] Minimap window refreshed for window 1036.
[2024-08-27 12:42:02] [TRACE] Wiping out minimap for buffer 49.
[2024-08-27 12:42:02] [WARN] Buffer 49 is not valid. Skipping deletion of minimap.
[2024-08-27 12:42:02] [TRACE] Minimap buffer wiped out for buffer 49.
[2024-08-27 12:42:02] [TRACE] Generating search for buffer 1
[2024-08-27 12:42:02] [TRACE] Applying annotation for minimap buffer 11 with namespace 77, mode: sign
[2024-08-27 12:42:02] [TRACE] Annotation for minimap buffer 11 with namespace 77 applied successfully
[2024-08-27 12:42:02] [TRACE] Search for buffer 1 generated successfully
[2024-08-27 12:42:02] [TRACE] CursorMoved event triggered.
[2024-08-27 12:42:02] [TRACE] Window ID: 1000
[2024-08-27 12:42:02] [TRACE] Resettting cursor line for window 1000.
[2024-08-27 12:42:02] [TRACE] Resetting cursor line for minimap of window 1000
[2024-08-27 12:42:02] [TRACE] Syncing minimap with source
[2024-08-27 12:42:02] [TRACE] Minimap synced with source
[2024-08-27 12:42:02] [TRACE] Cursor line reset for minimap of window 1000
[2024-08-27 12:42:02] [TRACE] Cursor line reset for window 1000.
[2024-08-27 12:42:03] [TRACE] CursorMoved event triggered.
[2024-08-27 12:42:03] [TRACE] Window ID: 1000
[2024-08-27 12:42:03] [TRACE] Resettting cursor line for window 1000.
[2024-08-27 12:42:03] [TRACE] Resetting cursor line for minimap of window 1000
[2024-08-27 12:42:03] [TRACE] Syncing minimap with source
[2024-08-27 12:42:03] [TRACE] Minimap synced with source
[2024-08-27 12:42:03] [TRACE] Cursor line reset for minimap of window 1000
[2024-08-27 12:42:03] [TRACE] Cursor line reset for window 1000.

I can see some UI flickering in corner minimap characters are flashing, thus I'm pretty sure the lag is due to minimap refresing. I'm not sure if neovim has event for 'NvimEnter' - where u could skip refreshing buffers...

Config

{
    "Isrothy/neominimap.nvim",
    version = "v3.*.*",
    enabled = true,
    lazy = false, -- NOTE: NO NEED to Lazy load
    init = function()
      -- The following options are recommended when layout == "float"
      vim.opt.wrap = false
      vim.opt.sidescrolloff = 36 -- Set a large value

      --- Put your configuration here
      ---@type Neominimap.UserConfig
      vim.g.neominimap = {
        auto_enable = true,
        log_level = vim.log.levels.TRACE,

        layout = "float",
        float = { z_index = 10 },
        diagnostic = {
          enabled = false,
        },
        git = {
          enabled = true,
          mode = "line",
        },
        search = {
          enabled = true,
          mode = "sign",
        },
        win_filter = function(winid)
          return winid == vim.api.nvim_get_current_win()
        end,
      }
      -- link NeominimapGitAddLine highlight to DiffAdd
      vim.api.nvim_set_hl(0, "NeominimapGitAddLine", { link = "DiffAdd" })
      vim.api.nvim_set_hl(0, "NeominimapGitChangeLine", { link = "DiffChange" })
      vim.api.nvim_set_hl(0, "NeominimapGitDeleteLine", { link = "DiffDelete" })
    end,
  }
Isrothy commented 2 weeks ago

From the log, it looks like this might not be due to a single plugin. Could you provide a minimal Neovim configuration that replicates the issue? This would help narrow down whether it’s the plugin or a combination of settings that’s causing the problem.

JoseConseco commented 2 weeks ago

For now I will close this, since my config is complicated (too many plugins lol) , and I do not want spend hour or two on debuging this. will reopen this, when I find more time. Thanks for your support!