Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Disable foldcolumn of statuscol #1464

Closed
3 tasks done
hungvx-dev opened this issue May 9, 2024 · 2 comments
Closed
3 tasks done

BUG: Disable foldcolumn of statuscol #1464

hungvx-dev opened this issue May 9, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@hungvx-dev
Copy link

hungvx-dev commented May 9, 2024

Did you check docs and existing issues?

  • I have read all the docs.
  • I have searched the existing issues.
  • I have searched the existing discussions.

Neovim Version (nvim -v)

0.9.5

Operating System / Version

MacOS 14.4.1

Describe the Bug

I want to disable foldcolumn when use: https://github.com/luukvbaal/statuscol.nvim, https://github.com/kevinhwang91/nvim-ufo for setting statuscolumn.

I had ingored neo-tree at statuscol config. But not working

{
    ft_ignore = { "neo-tree" },
   ....
}

Screenshots, Traceback

image

Steps to Reproduce

  1. Open neo-tree
  2. Open any filetype

Expected Behavior

Disable fold in neo-tree

Your Configuration

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  -- add any other plugins here
}

local neotree_config = {
  "nvim-neo-tree/neo-tree.nvim",
  dependencies = { "MunifTanjim/nui.nvim", "nvim-tree/nvim-web-devicons", "nvim-lua/plenary.nvim" },
  cmd = { "Neotree" },
  keys = {
    { "<Leader>e", "<Cmd>Neotree<CR>" }, -- change or remove this line if relevant.
  },
  opts = {
    sources = { "filesystem", "buffers", "git_status", "document_symbols" },
    open_files_do_not_replace_types = { "terminal", "Trouble", "qf", "Outline" },
    close_if_last_window = false,
    popup_border_style = "rounded",
    enable_git_status = true,
    enable_diagnostics = true,
    nesting_rules = {
      [""] = { "" },
    },
    default_component_configs = {
      indent = {
        with_expanders = nil,
        expander_collapsed = HVIM.icons.UI.Direction.Angle.Right,
        expander_expanded = HVIM.icons.UI.Direction.Angle.Down,
      },
      icon = {
        folder_closed = HVIM.icons.UI.Folder.Close,
        folder_open = HVIM.icons.UI.Folder.Open,
        folder_empty = HVIM.icons.UI.Folder.Empty,
        folder_empty_open = HVIM.icons.UI.Folder.EmptyOpen,
      },
      modified = {
        symbol = HVIM.icons.Git.LineModified,
      },
      git_status = {
        symbols = {
          -- Change type
          added = HVIM.icons.Git.LineAdded,
          modified = HVIM.icons.Git.LineModified,
          deleted = HVIM.icons.Git.LineRemoved,
          renamed = HVIM.icons.Git.LineRename,
          -- Status type
          untracked = HVIM.icons.Git.FileUntracked,
          ignored = HVIM.icons.Git.FileIgnored,
          unstaged = HVIM.icons.Git.FileUnstaged,
          staged = HVIM.icons.Git.FileStaged,
          conflict = HVIM.icons.Git.FileUnmerged,
        },
      },
    },
    commands = {
      copy_selector_path = function(state)
        local node = state.tree:get_node()
        local filepath = node:get_id()
        local filename = node.name
        local modify = vim.fn.fnamemodify

        local vals = {
          ["1"] = modify(filepath, ":."),
          ["2"] = filename,
          ["3"] = modify(filepath, ":~"),
          ["4"] = filepath,
        }

        local options = vim.tbl_filter(function(val)
          return vals[val] ~= ""
        end, vim.tbl_keys(vals))
        if vim.tbl_isempty(options) then
          vim.notify("No values to copy", vim.log.levels.WARN)
          return
        end
        table.sort(options)
        vim.ui.select(options, {
          prompt = "Choose to copy to clipboard:",
          format_item = function(item)
            return ("%s: %s"):format(item, vals[item])
          end,
        }, function(choice)
          local result = vals[choice]
          if result then
            vim.notify(("Copied: `%s`"):format(result))
            vim.fn.setreg("+", result)
          end
        end)
      end,
    },
    filesystem = {
      follow_current_file = {
        enabled = true,
        leave_dirs_open = true,
      },
      group_empty_dirs = false,
      use_libuv_file_watcher = true,
      filtered_items = {
        never_show = {
          ".DS_Store",
        },
      },
      window = {
        mapping_options = {
          noremap = true,
          nowait = true,
        },
        mappings = {
          -- ["<space>"] = "none",
          ["A"] = "command_b",
          ["Y"] = "copy_selector_path",
          ["<C-x>"] = "split_with_window_picker",
          ["<C-v>"] = "vsplit_with_window_picker",
          ["o"] = { "open", nowait = true },
        },
      },
      fuzzy_finder_mappings = {
        ["<C-j>"] = "move_cursor_down",
        ["<C-k>"] = "move_cursor_up",
      },
    },
    buffers = {
      follow_current_file = {
        enabled = true,
        leave_dirs_open = true,
      },
      group_empty_dirs = false,
      show_unloaded = true,
      window = {
        mappings = {
          ["."] = "set_root",
          ["<bs>"] = "navigate_up",
        },
      },
    },
    window = {
      position = "right",
      width = 40,
      mappings = {},
    },
  },
}

table.insert(plugins, neotree_config)
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

-- For statuscol ---------
local M = {}

function M.setup()
  local present, statuscol = pcall(require, "statuscol")
  if not present then
    return
  end
  local builtin = require("statuscol.builtin")
  M.opts = {
    ft_ignore = { "neo-tree" },
    bt_ignore = { "terminal" },
    segments = {
      { text = { builtin.foldfunc }, click = "v:lua.ScFa" },
      { text = { "%s" }, click = "v:lua.ScSa" },
      {
        text = { "", builtin.lnumfunc, " " },
        condition = { true, builtin.not_empty },
        click = "v:lua.ScLa",
      },
    },
  }

  statuscol.setup(M.opts)
end

return M
@hungvx-dev hungvx-dev added the bug Something isn't working label May 9, 2024
@hungvx-dev hungvx-dev changed the title BUG: Disable statuscol BUG: Disable foldcolumn of statuscol May 9, 2024
@lucasquin
Copy link

{
    ft_ignore = { "neo-tree", "neotree" },
   ....
}

Works for me

@hungvx-dev
Copy link
Author

I found the solution by following kevinhwang91/nvim-ufo#33 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants