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

Make neovim's `foldline` look like the github web code editor #216

Closed daUnknownCoder closed 2 months ago

daUnknownCoder commented 2 months ago

Neovim version (nvim -v | head -n1)

NVIM v0.9.5

Operating system/version

6.8.5-arch1-1

How to reproduce the issue

Not a bug, but a help request...

Is this possible?

Expected behavior

current config:

return {
  "kevinhwang91/nvim-ufo",
  event = { "BufReadPost", "BufNewFile" },
  lazy = true,
  keys = {
    { "zU", "<cmd>lua require('ufo').openAllFolds()<CR>", desc = "Open all folds" },
    { "zu", "<cmd>lua require('ufo').closeAllFolds()<CR>", desc = "Close all folds" },
    { "zp", "<cmd>lua require('ufo').peekFoldedLinesUnderCursor()<CR>", desc = "Peek fold under cursor" },
  },
  dependencies = {
    { "kevinhwang91/promise-async" },
    {
      "luukvbaal/statuscol.nvim",
      config = function()
        local builtin = require("statuscol.builtin")
        require("statuscol").setup({
          relculright = true,
          ft_ignore = {
            "man",
            "starter",
            "TelescopePrompt",
            "dapui_scopes",
            "dapui_breakpoints",
            "dapui_stacks",
            "dapui_watches",
            "dashboard",
            "NvimTree",
          },
          segments = {
            -- Diagnostics
            {
              sign = { name = { "Diagnostic" }, maxwidth = 2, auto = false },
              click = "v:lua.ScSa",
            },

            -- Folds
            {
              text = { builtin.foldfunc },
            },

            -- Relative Line Numbers
            {
              text = { builtin.lnumfunc },
              condition = { true, builtin.not_empty },
            },

            -- Gitsigns
            {
              sign = {
                namespace = { "gitsigns" },
                maxwidth = 1,
                colwidth = 1,
                wrap = true,
              },
            },
          },
        })
      end,
    },
  },
  config = function()
    local ufo_status_ok, ufo = pcall(require, "ufo")
    if not ufo_status_ok then
      print("ufo not found!")
    end

    vim.opt.signcolumn = "yes"
    vim.o.foldcolumn = "1"
    vim.o.foldlevel = 99
    vim.o.foldlevelstart = 99
    vim.o.foldenable = true
    vim.o.fillchars = [[eob: ,fold: ,foldopen:▼,foldsep: ,foldclose:►]]
    ufo.setup({
      provider_selector = function()
        return { "treesitter", "indent" }
      end,
    })
  end,
}

Actual behavior

image vs image

check luukvbaal/statuscol.nvim#122

kevinhwang91 commented 2 months ago

Customize your statuscolumn.