Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove the fold level numbers in vim?

I'm using NeoVIM, and I set up it to show folds automatically. The trouble is that when there is more than one level of folds, it's going to show numbers at the left. enter image description here

Is there any way to remove them, just look like any other modern editors?

I searched on google, StackOverflow, and checked the vimhelp page. I haven't seen a way for this.

I'm sure that's the default behavior, I can reproduce it on the default vim of codesandbox and without any plugin. Please check this link https://codesandbox.io/s/wizardly-tereshkova-vwh5im?file=/README.md. Here is the screenshot.

enter image description here

like image 804
Stone Sun Avatar asked Oct 17 '25 15:10

Stone Sun


2 Answers

If someone still looks for an asnwer, this configuration in luukvbaal/statuscol.nvim solves the issue. I tested it myself.

{
  'luukvbaal/statuscol.nvim',
  opts = function()
    local builtin = require('statuscol.builtin')
    return {
      setopt = true,
      -- override the default list of segments with:
      -- number-less fold indicator, then signs, then line number & separator
      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',
        },
      },
    }
  end,
}
like image 117
Shalaw Fatah Avatar answered Oct 20 '25 11:10

Shalaw Fatah


As explained in :help fold-foldcolumn, when the value of :help 'foldcolumn is large enough, the fold level is indicated by vertical bars but, when there is not enough room, numbers are used instead. That behavior is not governed by any option so there is nothing you can do about it except rolling up your sleeves and modifying the source code.

That said, the ˇs in your screenshot are clearly not standard `:help 'fillchars', as hinted in the comments, so you should probably take a look at what is redefining those before taking any action.

like image 40
romainl Avatar answered Oct 20 '25 09:10

romainl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!