Skip to content

Commit b8bf0be

Browse files
committed
folding: remove fold gutter column and related config
1 parent d245c0a commit b8bf0be

1 file changed

Lines changed: 7 additions & 26 deletions

File tree

after/plugin/options.lua

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,27 @@ vim.opt.guicursor = table.concat({
1515
'r-cr-o:hor20-blinkwait700-blinkoff200-blinkon800',
1616
}, ',')
1717

18-
-- Folding — treesitter-based, with modern open/close icons in the gutter
18+
-- Folding — treesitter-based, no gutter column
1919
vim.o.foldmethod = 'expr'
2020
vim.o.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
2121
vim.o.foldenable = true
22-
vim.o.foldcolumn = '3' -- wide enough to show fold tree without digit fallback
22+
vim.o.foldcolumn = '0'
2323
vim.o.foldlevel = 99 -- default: open everything (overridden per filetype)
2424
vim.o.foldlevelstart = 99 -- same for new buffers
25-
vim.opt.fillchars:append({
26-
foldopen = vim.fn.nr2char(0xf078), -- nf-fa-chevron-down (open fold)
27-
foldclose = vim.fn.nr2char(0xf054), -- nf-fa-chevron-right (closed fold)
28-
foldsep = '',
29-
fold = ' ',
30-
})
3125

32-
-- Per-filetype fold overrides. Filetypes with deep nesting need a wider
33-
-- foldcolumn to avoid digit fallback; foldminlines avoids noisy short folds.
34-
---@type table<string, { foldcolumn?: string, foldminlines?: integer }>
26+
-- Per-filetype fold overrides.
27+
---@type table<string, { foldminlines?: integer }>
3528
local fold_ft = {
36-
php = { foldcolumn = '5' },
37-
typescript = { foldcolumn = '5' },
38-
javascript = { foldcolumn = '5' },
39-
lua = { foldcolumn = '4' },
40-
sh = { foldminlines = 10 },
41-
bash = { foldminlines = 10 },
29+
sh = { foldminlines = 10 },
30+
bash = { foldminlines = 10 },
4231
}
43-
local fold_ft_defaults = { foldcolumn = '3', foldminlines = 10 }
32+
local fold_ft_defaults = { foldminlines = 1 }
4433

4534
-- Treesitter attaches asynchronously on FileType. vim.schedule defers until
4635
-- after attachment, then resets foldmethod to force fold recomputation.
4736
vim.api.nvim_create_autocmd('FileType', {
4837
callback = function(args)
4938
local cfg = vim.tbl_extend('force', fold_ft_defaults, fold_ft[args.match] or {})
50-
vim.opt_local.foldcolumn = cfg.foldcolumn
5139
vim.opt_local.foldminlines = cfg.foldminlines
5240
vim.schedule(function()
5341
if pcall(vim.treesitter.get_parser, 0) then
@@ -57,13 +45,6 @@ vim.api.nvim_create_autocmd('FileType', {
5745
end,
5846
})
5947

60-
-- Match fold column markers to line number colour.
61-
local function link_foldcolumn()
62-
vim.api.nvim_set_hl(0, 'FoldColumn', { link = 'LineNr' })
63-
end
64-
link_foldcolumn()
65-
vim.api.nvim_create_autocmd('ColorScheme', { callback = link_foldcolumn })
66-
6748
-- When nvim is invoked with +N (e.g. nvim file.txt +1234), open the fold at
6849
-- the cursor so the target line is immediately visible. VimEnter fires after
6950
-- the +line command has positioned the cursor, so zv ("view cursor line")

0 commit comments

Comments
 (0)