kevinhwang91 / nvim-ufo

Not UFO in the sky, but an ultra fold in Neovim.
BSD 3-Clause "New" or "Revised" License
2.23k stars 44 forks source link

module 'ufo' not found #56

Closed hronro closed 2 years ago

hronro commented 2 years ago

Neovim version (nvim -v | head -n1)

NVIM v0.7.2

Operating system/version

Arch Linux

How to reproduce the issue

cat mini.lua

vim.o.packpath = '~/.local/share/nvim/site'
require'packer'.startup(function()
  use {
    'kevinhwang91/nvim-ufo',
    requires = 'kevinhwang91/promise-async',
    setup = function ()
      vim.o.foldcolumn = '1'
      vim.o.foldlevel = 99
      vim.o.foldlevelstart = -1
      vim.o.foldenable = true

      vim.keymap.set('n', 'zR', require'ufo'.openAllFolds)
      vim.keymap.set('n', 'zM', require'ufo'.closeAllFolds)
    end,
    config = function ()
      require'ufo'.setup({
        provider_selector = function (bufnr, filetype, buftype)
            return {'treesitter', 'indent'}
        end
      })
    end,
  }
end

nvim --clean -u mini.lua

Expected behavior

Should works

Actual behavior

Got error:

module 'ufo' not found
hronro commented 2 years ago

I noticed the package is called kevinhwang91/nvim-ufo, however in the README, the example code uses require('ufo'). The file in the repo (https://github.com/kevinhwang91/nvim-ufo/blob/main/lua/ufo.lua) is also named as ufo.

kevinhwang91 commented 2 years ago

May packer.nvim issue. PackerSync before PackerUpdate

hronro commented 2 years ago

@kevinhwang91 I do use PackerSync instead of PackerUpdate.

hronro commented 2 years ago

Should I use require'ufo'.openAllFolds or require'nvim-ufo'.openAllFolds?

kevinhwang91 commented 2 years ago

Sorry, It's PackerCompile not PackerSync.

hronro commented 2 years ago

@kevinhwang91

Same.

And AFAIN, PackerCompile basically equals to PackerCompile + PackerUpdate.

hronro commented 2 years ago

@kevinhwang91 Would you mind reopen the issue, since using PackerCompile and PackerUpdate didn't fix the issue.

kevinhwang91 commented 2 years ago

Not ufo issue, please :h :packadd

soifou commented 2 years ago

@hronro the ufo lua module is not yet available in Packer setup() but it is in config(), so you have 2 choices : either you move both of the keymaps to your config() or add module = "ufo" in your Packer spec.