fix folding performance in medium or large sized org files by changing foldmethod

This commit is contained in:
Matt Anderson
2026-08-17 15:53:57 -05:00
parent 642973f70b
commit c8a1e079ce
2 changed files with 35 additions and 18 deletions
+22 -18
View File
@@ -54,13 +54,27 @@ require('lazy').setup({
org_default_notes_file = '~/doc/org/scratch.org', org_default_notes_file = '~/doc/org/scratch.org',
org_startup_indented = true, org_startup_indented = true,
org_deadline_warning_days = 0, org_deadline_warning_days = 0,
ui = {
folds = {
colored = false,
},
},
org_agenda_custom_commands = { org_agenda_custom_commands = {
i = { o = {
description = "Independent", description = "Owned",
types = { types = {
{ {
type = 'agenda', type = 'agenda',
org_agenda_tag_filter_preset = 'independent' org_agenda_tag_filter_preset = 'owned'
}
}
},
a = {
description = "Assigned",
types = {
{
type = 'agenda',
org_agenda_tag_filter_preset = 'assigned'
} }
} }
}, },
@@ -73,30 +87,20 @@ require('lazy').setup({
} }
} }
}, },
w = { h = {
description = "Work", description = "Habits",
types = { types = {
{ {
type = 'agenda', type = 'agenda',
org_agenda_tag_filter_preset = 'work' org_agenda_tag_filter_preset = 'habits'
} }
} }
}, },
m = { l = {
description = "Milestones", description = "Agenda",
types = { types = {
{ {
type = 'agenda', type = 'agenda',
org_agenda_tag_filter_preset = 'milestone'
}
}
},
s = {
description = "Social",
types = {
{
type = 'agenda',
org_agenda_tag_filter_preset = 'social'
} }
} }
}, },
+13
View File
@@ -13,6 +13,19 @@ vim.o.splitright = true
vim.o.maxmempattern = 100000 vim.o.maxmempattern = 100000
vim.g.clipboard = "osc52" vim.g.clipboard = "osc52"
function _G.org_foldexpr()
local stars = vim.fn.getline(vim.v.lnum):match("^(%*+)%s")
return stars and (">" .. #stars) or "="
end
vim.api.nvim_create_autocmd("FileType", {
pattern = "org",
callback = function()
vim.opt_local.foldmethod = "expr"
vim.opt_local.foldexpr = "v:lua.org_foldexpr()"
end,
})
vim.cmd([[ vim.cmd([[
autocmd ColorScheme * highlight Statement cterm=NONE ctermfg=5 autocmd ColorScheme * highlight Statement cterm=NONE ctermfg=5
autocmd ColorScheme * highlight Keyword ctermfg=5 autocmd ColorScheme * highlight Keyword ctermfg=5