Sorry if the question looks dumb, is it possible to set the config file of minimap in lua ?

I test the following, but the plugin is not found (the package command works wheel eg. Minimap or MinimapClose).

the error

plugin/minimap.lua:4: module 'minimap' not found

plugin file

local status, packer = pcall(require, 'packer')

if (not status) then
  print('🔥 Packer is not installed')

vim.cmd [[packadd packer.nvim]]

    ... other plugins
    use {'wfxr/minimap.vim', as = 'minimap'}

and my config file for minimap

local status, minimap = pcall(require, 'minimap')
if (not status) then return end

  config = function ()
    vim.g.minimap_width = 10
    vim.g.minimap_auto_start = 1
    vim.g.minimap_auto_start_win_enter = 1
  • minimap.vim is not a lua module/plugin so you cannot require it.
    – unrealapex
    Commented Dec 14, 2022 at 0:01

1 Answer 1


The error you are receiving is caused by you attempting to call the setup function of a Vimscript plugin. Remember that Vimscript plugins do not need a setup() function and not all Lua plugins need them either. In your case, you would need to define your global variables before the plugin is loaded:

run this before Packer loads your plugin:

vim.g.minimap_width = 10
vim.g.minimap_auto_start = 1
vim.g.minimap_auto_start_win_enter = 1

Plugin Spec:

use {
  as = 'minimap',
  • 1
    there is no way to put this configuration in another .lua file?
    – Hadock
    Commented Dec 14, 2022 at 10:17
  • It is possible, but the standard for Packer is putting configurations in the config function. It would be more ideal to put very large configurations in a separate file.
    – unrealapex
    Commented Dec 15, 2022 at 5:30
  • @Hadock looking back at this, I forgot that you need to define globals before the plugin is loaded. I will edit my answer to reflect this. I had not seen your edit to the question.
    – unrealapex
    Commented Mar 10, 2023 at 6:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.