minimap.vim icon indicating copy to clipboard operation
minimap.vim copied to clipboard

Auto-start doesn't seem to work (LunarVim)

Open haasn opened this issue 2 years ago • 15 comments

Check list

  • [x] I have read through the README (especially F.A.Q section)
  • [x] I have searched through the existing issues

Environment info

  • OS
    • [x] Linux
    • [ ] Mac OS X
    • [ ] Windows
    • [ ] Others:

Version info

NVIM v0.9.0
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc  -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-color=auto -fstack-protector-strong -DUNIT_TESTING -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/usr/include/luajit-5_1-2.1 -I/usr/include -I/usr/include/lua5.1 -I/home/abuild/rpmbuild/BUILD/neovim-0.9.0/build/src/nvim/auto -I/home/abuild/rpmbuild/BUILD/neovim-0.9.0/build/include -I/home/abuild/rpmbuild/BUILD/neovim-0.9.0/build/cmake.config -I/home/abuild/rpmbuild/BUILD/neovim-0.9.0/src -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

Using LunarVim.

Question / Problem and steps to reproduce

  1. Set up as:
  {
    'wfxr/minimap.vim',
    build = "cargo install --locked code-minimap",
    -- cmd = {"Minimap", "MinimapClose", "MinimapToggle", "MinimapRefresh", "MinimapUpdateHighlight"},
    config = function()
        vim.cmd("let g:minimap_width = 10")
        vim.cmd("let g:minimap_auto_start = 1")
        vim.cmd("let g:minimap_auto_start_win_enter = 1")
    end,
  }

(Taken from here) 2. Open any file 3. Observe minimap not showing up automatically. 4. Type :Minimap 5. Minimap shows up as expected

It's not a problem of the config part because changing g:minimap_width = 10 in this example to = 40 makes it work. I also tried moving these vim.cmd commands before the plugin setup part, with no change.

haasn avatar May 21 '23 14:05 haasn

Same problem here, but in Lazyvim

ggteixeira avatar Jun 02 '23 19:06 ggteixeira

I'm not able to reproduce this. Right after opening a file, can you print out the values?

:echom 'g:minimap_width: ' .. g:minimap_width
:echom 'g:minimap_auto_start: ' .. g:minimap_auto_start
:echom 'g:minimap_auto_start_win_enter: ' .. g:minimap_auto_start_win_enter
:mes

I'm not familiar with that method of setting up plugins and config, so I'm wondering if the value is not being set properly during startup.

ZNielsen avatar Jun 02 '23 20:06 ZNielsen

All three give me unknown variable errors.

If I instead put it at the top-level of my vimrc, I get:

g:minimap_width: 10
g:minimap_auto_start: v:true
g:minimap_auto_start_win_enter: v:true

Is it possible that this plugin just does not load correctly when set up via lazyvim?

haasn avatar Jun 02 '23 20:06 haasn

Ah, that's probably it. Right now it's checking for the value of 1 explicitly:

if g:minimap_auto_start == 1

We'll need to update this to do a proper boolean check.

As a workaround, try setting the value to 1 rather than true, does that work?

ZNielsen avatar Jun 02 '23 20:06 ZNielsen

I tried setting it to 1, unfortunately no change.

haasn avatar Jun 03 '23 10:06 haasn

Okay, it seems to work for me now:

vim.g.minimap_width = 10
vim.g.minimap_auto_start = true
vim.g.minimap_auto_start_win_enter = true
table.insert(lvim.plugins, {
    'wfxr/minimap.vim',
    build = "cargo install --locked code-minimap",
})

The problem was a combination of:

  1. config() sets these variables too late
  2. I had the cmds line uncommented at some point, which made lazy nvim only load this plugin when actually running one of those commands

The true/1 distinction is irrelevant, it seems.

Edit: This also works:

table.insert(lvim.plugins, {
    'wfxr/minimap.vim',
    build = "cargo install --locked code-minimap",
    init = function()
        vim.g.minimap_width = 10
        vim.g.minimap_auto_start = 1
        vim.g.minimap_auto_start_win_enter = 1
    end
})

haasn avatar Jun 03 '23 10:06 haasn

I am suffering the same issue not solved using anything mentioned.

When using the workaround @haasn noted I get the minimap showing (great) but without the background highlight (darn).

If the 'cmd = ' line is missing then the highlight background doesn't show.

mclarkson avatar Jun 19 '23 08:06 mclarkson

I use lazy.nvim, this is my config:

return {
    "wfxr/minimap.vim",
    build = "cargo install --locked code-minimap",
    lazy = false,
    cmd = { "Minimap", "MinimapClose", "MinimapToggle", "MinimapRefresh", "MinimapUpdateHighlight" },
    init = function()
        vim.cmd("let g:minimap_width = 10")
        vim.cmd("let g:minimap_auto_start = 1")
        vim.cmd("let g:minimap_auto_start_win_enter = 1")
    end,
    -- config = function()
    --     vim.cmd("let g:minimap_width = 10")
    --     vim.cmd("let g:minimap_auto_start = 1")
    --     vim.cmd("let g:minimap_auto_start_win_enter = 1")
    -- end,
}

the lazy = false is very important.then write your config to init.

Finish this,it will look like normal.

set lazy = false,the plugins will load when you open nvim.

If it still doesn't work, you should check if the build is successful. try code-minimap --version: image

CnsMaple avatar Jun 21 '23 07:06 CnsMaple

For me, in lazyvim, this does open minimap on startup, but, doesn't show the background highlight (or cursor position) in the minimap - and I disabled all other plugins and custom settings:

  {
    'wfxr/minimap.vim',
    build = "cargo install --locked code-minimap",
    cmd = {"Minimap", "MinimapClose", "MinimapToggle", "MinimapRefresh", "MinimapUpdateHighlight"},
    lazy = false,
    init = function()
      vim.cmd("let g:minimap_width = 10")
      vim.cmd("let g:minimap_auto_start = 1")
      vim.cmd("let g:minimap_auto_start_win_enter = 1")
    end,
  },

I also get:

❯ code-minimap --version
code-minimap 0.6.4

mclarkson avatar Jun 21 '23 11:06 mclarkson

I have also encountered this issue, but after deleting it. Use 'cargo install code-minimap' on the terminal to install code-minimap and ensure no errors are reported. Then locate minimap.vim in nvim-data and delete the minimap.vim folder. Re enter nvim, it will be downloaded again, and then it is ready.

You can give it a try. @mclarkson

I am also use lazyvim,and no have any problem.

CnsMaple avatar Jun 21 '23 17:06 CnsMaple

For me, simply put "init" instead of "config" does the job. I'm using LunarVim. Hope it helps someone out there! ;-)

  {
    'wfxr/minimap.vim',
    build = "cargo install --locked code-minimap",
    --cmd = { "Minimap", "MinimapClose", "MinimapToggle", "MinimapRefresh", "MinimapUpdateHighlight" },
    init = function()
      vim.g.minimap_width = 10
      vim.g.minimap_auto_start = true
      vim.g.minimap_auto_start_win_enter = true
      vim.g.minimap_highlight_range = true
      vim.g.minimap_highlight_search = true
    end,
  },

monkeymonk avatar Jul 17 '23 07:07 monkeymonk

After a bit of research, I found that in LunarVim the background highlight disappears after any activity: for example, if you set the option lazy = true and open the minimap with :MinimapToggle, then the highlighting will show up as it should. But after doing :w it disappears.

If you set lazy = false, then some internal activity will occur during startup, and background highlighting will not be displayed.

denius avatar Jul 24 '23 01:07 denius

Okay, it seems to work for me now:

vim.g.minimap_width = 10
vim.g.minimap_auto_start = true
vim.g.minimap_auto_start_win_enter = true
table.insert(lvim.plugins, {
    'wfxr/minimap.vim',
    build = "cargo install --locked code-minimap",
})

The problem was a combination of:

  1. config() sets these variables too late
  2. I had the cmds line uncommented at some point, which made lazy nvim only load this plugin when actually running one of those commands

The true/1 distinction is irrelevant, it seems.

Edit: This also works:

table.insert(lvim.plugins, {
    'wfxr/minimap.vim',
    build = "cargo install --locked code-minimap",
    init = function()
        vim.g.minimap_width = 10
        vim.g.minimap_auto_start = 1
        vim.g.minimap_auto_start_win_enter = 1
    end
})

I have some issue, and I also use lunarVim. This code can fix my problem, I rewrite it from config to init.

liwuhou avatar Sep 10 '23 13:09 liwuhou

Seems to have a lot more to do with LunarVim than this plugin. I'll leave this open in case there is more discussion, but I'm not seeing anything that needs to change in minimap.vim.

ZNielsen avatar Sep 20 '23 23:09 ZNielsen

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 17 '24 10:03 stale[bot]