kevinhwang91 / nvim-ufo

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

Lazyvim installation instruction #191

Closed mbaneshi closed 6 months ago

mbaneshi commented 6 months ago

Feature description

Would you please add lazyvim installation and configuration instructions in readme?

Describe the solution you'd like

Although Packer and LazyVim are relatively similar, but it is hard for newbies to adopt them

So it will be benefitial do so . Thanks in advanced .

Additional context

https://www.lazyvim.org/

dwarfman78 commented 6 months ago

Do you have any configuration to share ?

mbaneshi commented 6 months ago

What do you mean? Regarding this repo , no I have no chance to utilizing it sincelI have no config yet.

It should be mentioned, I used LazyVim as package manager , and my folding do not work for unknown reason , I want to use this package because I guess problem is about default configuration, it always pop up error now. Reading help I find some default relayed to my error , I hope this helps me resolving issue.

wookayin commented 6 months ago

First of all, https://github.com/LazyVim/LazyVim is not a package manager but a neovim distro. https://github.com/folke/lazy.nvim is the package manager you'd probably talking about (which LazyVim is also based on).

If you read the README of lazy.nvim, installation instruction would be just straightforward: just add this to your plugin spec:

  {
    'kevinhwang91/nvim-ufo',
    dependencies = { 'kevinhwang91/promise-async' },
--    event = 'VeryLazy',   -- You can make it lazy-loaded via VeryLazy, but comment out if thing doesn't work
    init = function()
      vim.o.foldlevel = 99
      vim.o.foldlevelstart = 99
    end,
    config = function()
      require('ufo').setup {
        -- your config goes here
        -- open_fold_hl_timeout = ...,
        -- provider_selector = function(bufnr, filetype)
        --  ...
        -- end,
      }
    end,
  }
mbaneshi commented 6 months ago

Thank you @wookayin , I really appreciated. Would you please provide default configuration as well . I mean some useful sane default,just copy paste and ready to go . The big problem reside beneath this comment in snippets. Unfortunately I can't go by myself yet.

wookayin commented 6 months ago

Default configuration is just nothing, no config, and it should work. The above snippet is already a working solution (remove unused some comments). Just replace with:

require('ufo').setup {
}
mbaneshi commented 6 months ago

It works , thank you all of you . ❤️❤️❤️

ycp101 commented 5 months ago

Thank you @wookayin , I really appreciated. Would you please provide default configuration as well . I mean some useful sane default,just copy paste and ready to go . The big problem reside beneath this comment in snippets. Unfortunately I can't go by myself yet.

Yes, that's what I thought before using Vims..... After a couple of years, my skills same as before... It just take so many hours to configure new things because I have to find codes from the web. It took about 6 hours this time. I should move back to VSCode. Thanks, sheykail](https://codeberg.org/sheykail/my-lazyvim/src/branch/master/lua/plugins/fold.lua)

return { "kevinhwang91/nvim-ufo", dependencies = { "kevinhwang91/promise-async" }, event = "BufRead", opts = {}, config = function() -- Fold options vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]] vim.o.foldcolumn = "1" -- '0' is not bad vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value vim.o.foldlevelstart = 99 vim.o.foldenable = true require("ufo").setup() end, -- init = function() -- -- Using ufo provider need remap zR and zM. If Neovim is 0.6.1, remap yourself -- vim.keymap.set("n", "zR", function() -- require("ufo").openAllFolds() -- end) -- vim.keymap.set("n", "zM", function() -- require("ufo").closeAllFolds() -- end) -- end, }