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

Nothing displayed at the first line after folded #225

Closed nasoundead closed 3 weeks ago

nasoundead commented 3 weeks ago

Neovim version (nvim -v | head -n1)

NVIM 0.10.0

Operating system/version

windows10

How to reproduce the issue

cat mini.lua

-- Use Vim packages install the plugin, also work with some plugins manager such as packer.nvim
vim.o.packpath = '~/.local/share/nvim/site'
vim.cmd('packadd promise-async')
vim.cmd('packadd nvim-ufo')

-- Setting
vim.o.foldcolumn = '1'
vim.o.foldlevel = 99
vim.o.foldlevelstart = -1
vim.o.foldenable = true

local ufo = require('ufo')
ufo.setup()
vim.keymap.set('n', 'zR', ufo.openAllFolds)
vim.keymap.set('n', 'zM', ufo.closeAllFolds)

nvim --clean +'so mini.lua'

1. 2. 3. ...

Expected behavior

The first Line should display

Actual behavior

image First line of folding is disapeared! image

kevinhwang91 commented 3 weeks ago

check out your foldtext

nasoundead commented 3 weeks ago

Could you give more info about foldtext? My config wrong?

kevinhwang91 commented 3 weeks ago

Please use a mini config, foldtext is changed to v:lua.require'ufo.main'.foldtext() that is needed by ufo.

nasoundead commented 3 weeks ago

Already mini config, as below:

ufo.lua

local options = {
    provider_selector = function(bufnr, filetype, buftype)
        return {'treesitter', 'indent'}
    end
}
return options

nvchard init.lua

{
    "kevinhwang91/nvim-ufo",
    dependencies = {{"kevinhwang91/promise-async"}, {
        "luukvbaal/statuscol.nvim",
        opts = function()
            return require "plugins.configs.statuscol"
        end,
        config = function(_, opts)
            require("statuscol").setup(opts)
        end
    }},
    event = "BufRead",
    keys = {{"zR", function()
        require("ufo").openAllFolds()
    end}, {"zM", function()
        require("ufo").closeAllFolds()
    end}, {"K", function()
        local winid = require('ufo').peekFoldedLinesUnderCursor()
        if not winid then
            vim.lsp.buf.hover()
        end
    end}},
    opts = function()
        return require "plugins.configs.ufo"
    end,
    config = function(_, opts)
        vim.o.foldcolumn = '1'
        vim.o.foldlevel = 99
        vim.o.foldlevelstart = 99
        vim.o.foldenable = true
        vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
        require("ufo").setup(opts)
    end
},
kevinhwang91 commented 3 weeks ago

No, follow the issue template and provide reproduce steps.

nasoundead commented 3 weeks ago

Sorry, I can not give more info. This is inevitable.

nasoundead commented 3 weeks ago

I give up

wllenyj commented 3 weeks ago

The same problem for me.