Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
3 of 6 tasks
haasn opened this issue May 21, 2023 · 15 comments
Closed
3 of 6 tasks

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

haasn opened this issue May 21, 2023 · 15 comments
Labels
invalid This doesn't seem right wontfix This will not be worked on

Comments

@haasn
Copy link

haasn commented May 21, 2023

Check list

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

Environment info

  • OS
    • 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 haasn changed the title Auto-start doesn't seem to work Auto-start doesn't seem to work (LunarVim) May 21, 2023
@ggteixeira
Copy link

Same problem here, but in Lazyvim

@ZNielsen
Copy link
Collaborator

ZNielsen commented Jun 2, 2023

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.

@haasn
Copy link
Author

haasn commented Jun 2, 2023

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?

@ZNielsen
Copy link
Collaborator

ZNielsen commented Jun 2, 2023

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?

@haasn
Copy link
Author

haasn commented Jun 3, 2023

I tried setting it to 1, unfortunately no change.

@haasn
Copy link
Author

haasn commented Jun 3, 2023

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
})

@mclarkson
Copy link

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.

@CnsMaple
Copy link

CnsMaple commented Jun 21, 2023

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

@mclarkson
Copy link

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

@CnsMaple
Copy link

CnsMaple commented Jun 21, 2023

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.

@monkeymonk
Copy link

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,
  },

@denius
Copy link

denius commented Jul 24, 2023

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.

@liwuhou
Copy link

liwuhou commented Sep 10, 2023

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.

@ZNielsen ZNielsen added invalid This doesn't seem right wontfix This will not be worked on labels Sep 20, 2023
@ZNielsen
Copy link
Collaborator

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.

Copy link

stale bot commented Mar 17, 2024

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 stale bot added the stale label Mar 17, 2024
@ZNielsen ZNielsen removed the stale label Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

8 participants