plugins.nvim-ufo.settings

Options provided to the require('ufo').setup function.

Type: attribute set of anything

Default: { }

Example:

{
  fold_virt_text_handler = ''
    function(virtText, lnum, endLnum, width, truncate)
      local newVirtText = {}
      local suffix = ('  %d '):format(endLnum - lnum)
      local sufWidth = vim.fn.strdisplaywidth(suffix)
      local targetWidth = width - sufWidth
      local curWidth = 0
      for _, chunk in ipairs(virtText) do
        local chunkText = chunk[1]
        local chunkWidth = vim.fn.strdisplaywidth(chunkText)
        if targetWidth > curWidth + chunkWidth then
          table.insert(newVirtText, chunk)
        else
          chunkText = truncate(chunkText, targetWidth - curWidth)
          local hlGroup = chunk[2]
          table.insert(newVirtText, {chunkText, hlGroup})
          chunkWidth = vim.fn.strdisplaywidth(chunkText)
          -- str width returned from truncate() may less than 2nd argument, need padding
          if curWidth + chunkWidth < targetWidth then
            suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth)
          end
          break
        end
        curWidth = curWidth + chunkWidth
      end
      table.insert(newVirtText, {suffix, 'MoreMsg'})
      return newVirtText
    end
  '';
  provider_selector = ''
    function(bufnr, filetype, buftype)
      local ftMap = {
        vim = "indent",
        python = {"indent"},
        git = ""
      }
    
     return ftMap[filetype]
    end
  '';
}

Declared by:

plugins.nvim-ufo.settings.enable_get_fold_virt_text

Enable a function with lnum as a parameter to capture the virtual text for the folded lines and export the function to get_fold_virt_text field of ctx table as 6th parameter in fold_virt_text_handler

Type: null or boolean or raw lua code

Default: null

Plugin default: false

Declared by:

plugins.nvim-ufo.settings.close_fold_kinds_for_ft

After the buffer is displayed (opened for the first time), close the folds whose range with kind field is included in this option. For now, ‘lsp’ provider’s standardized kinds are ‘comment’, ‘imports’ and ‘region’, run UfoInspect for details if your provider has extended the kinds.

Type: null or (attribute set of (anything or raw lua code))

Default: null

Plugin default:

{
  default = { };
}

Declared by:

plugins.nvim-ufo.settings.fold_virt_text_handler

A lua function to customize fold virtual text.

Type: null or lua function string

Default: null

Plugin default: null

Declared by:

plugins.nvim-ufo.settings.open_fold_hl_timeout

Time in millisecond between the range to be highlgihted and to be cleared while opening the folded line, 0 value will disable the highlight.

Type: null or unsigned integer, meaning >=0, or raw lua code

Default: null

Plugin default: 400

Declared by:

plugins.nvim-ufo.settings.provider_selector

A lua function as a selector for fold providers.

Type: null or lua function string

Default: null

Plugin default: null

Declared by: