kevinhwang91 / nvim-ufo

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

Not correctly ignoring files #166

Closed IgberZBN closed 1 year ago

IgberZBN commented 1 year ago

Neovim version (nvim -v | head -n1)

NVIM v0.9.2

Operating system/version

Arch Linux x86_64

How to reproduce the issue

I'm using lazy.nvim (default in nvchad)

plugins.lua

  {
    "kevinhwang91/nvim-ufo",
    dependencies = {
      "kevinhwang91/promise-async",
      {
        "luukvbaal/statuscol.nvim",
        opts = function()
          require("custom.configs.ui.ufo").statuscol()
        end,
      },
    },
    event = "VimEnter",
    config = function()
      require("custom.configs.ui.ufo").ufo()
    end,
  },

ufo.lua

local M = {}

M.statuscol = function()
  local builtin = require "statuscol.builtin"
  require("statuscol").setup {
    relculright = true,
    bt_ignore = {
      "nofile",
      "prompt",
      "terminal",
      "lazy",
    },
    ft_ignore = {
      "NvimTree",
      "dashboard",
      "nvcheatsheet",
      "dapui_watches",
      "dap-repl",
      "dapui_console",
      "dapui_stacks",
      "dapui_breakpoints",
      "dapui_scopes",
      "help",
      "vim",
      "alpha",
      "dashboard",
      "neo-tree",
      "Trouble",
      "noice",
      "lazy",
      "toggleterm",
    },
    segments = {
      { text = { builtin.foldfunc }, click = "v:lua.ScFa" },
      { text = { "%s" }, click = "v:lua.ScSa" },
      { text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" },
    },
  }
end

M.ufo = function()
  local ufo = require "ufo"
  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
  vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
  vim.keymap.set("n", "zR", function()
    ufo.openAllFolds()
  end)
  vim.keymap.set("n", "zM", function()
    ufo.closeAllFolds()
  end)
  require("ufo").setup {
    provider_selector = function(bufnr, filetype, buftype)
      return { "treesitter", "indent" }
    end,
  }
end

return M

Expected behavior

The plugin should be ignoring the buffers and files I defined into ufo.lua

Actual behavior

I put the color red to make it more evident.

The plugin is not ignoring properly, like in the terminal and in the cheatsheet.

image image image

kevinhwang91 commented 1 year ago

can't understand.

IgberZBN commented 1 year ago

can't understand.

The plugin for some reason is being used in buffers and languages ​​that it shouldn't, such as in the terminal, markdown. I don't know if my configuration is correct, but I would like to disable the plugin in these buffers and languages. Is there any configuration within the plugin to achieve this result?

rockyzhang24 commented 1 year ago

This https://github.com/kevinhwang91/nvim-ufo/issues/33 maybe helpful.

kevinhwang91 commented 1 year ago

such as in the terminal,

Never attach a terminal buffer for ufo