nvim-ufo icon indicating copy to clipboard operation
nvim-ufo copied to clipboard

Don't fold when file is short

Open Rizhiy opened this issue 5 months ago • 1 comments

Feature description

Disable folding if the file is less than X lines long.

Describe the solution you'd like

I used to have the following code when I was using built-in folding, to disable folding for short files:

local autocmd = vim.api.nvim_create_autocmd
autocmd({ "BufReadPost" }, {
    callback = function(_)
        if vim.api.nvim_buf_line_count(0) > 70 then
            vim.opt.foldlevel = 1
        else
            vim.opt.foldlevel = 10
        end
    end,
})

Is it possible to accomplish the same with ufo?

If not, that would be a nice feature to have.

Additional context

Not much point folding parts, if the whole file already fits on the screen.

Rizhiy avatar Jan 19 '24 03:01 Rizhiy