File tree Expand file tree Collapse file tree 4 files changed +26
-1
lines changed Expand file tree Collapse file tree 4 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -153,6 +153,15 @@ Applies to:
153
153
- agenda window
154
154
- capture window
155
155
156
+ #### ** org_startup_folded**
157
+ * type* : ` string ` <br />
158
+ * default value* : ` overview ` <br />
159
+ How many headings and other foldable items should be shown when an org file is opened.<br />
160
+ Available options:
161
+ * ` overview ` - Only show top level elements (default)
162
+ * ` content ` - Only show the first two levels
163
+ * ` showeverything ` - A double line box
164
+ * ` inherit ` - Use the fold level set in Neovim's global ` foldlevel ` option
156
165
157
166
#### ** org_todo_keyword_faces**
158
167
* type* : ` table<string, string> ` <br />
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ let b:did_ftplugin = 1
5
5
6
6
lua require (' orgmode.config' ): setup_mappings (' org' )
7
7
lua require (' orgmode.config' ): setup_mappings (' text_objects' )
8
+ lua require (' orgmode.config' ): setup_foldlevel ()
8
9
9
10
function ! OrgmodeFoldText ()
10
11
return luaeval (' require("orgmode.org.indent").foldtext()' )
@@ -24,7 +25,6 @@ setlocal foldmethod=expr
24
25
setlocal foldexpr = nvim_treesitter#foldexpr ()
25
26
setlocal foldtext = OrgmodeFoldText ()
26
27
setlocal formatexpr = OrgmodeFormatExpr ()
27
- setlocal foldlevel = 0
28
28
setlocal omnifunc = OrgmodeOmni
29
29
setlocal commentstring = #\ % s
30
30
inoreabbrev <silent><buffer> :today: <C-R> = luaeval (" require('orgmode.objects.date').today():to_wrapped_string(true)" )<CR>
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ local DefaultConfig = {
16
16
template = ' * TODO %?\n %u' ,
17
17
},
18
18
},
19
+ org_startup_folded = ' overview' ,
19
20
org_agenda_skip_scheduled_if_done = false ,
20
21
org_agenda_skip_deadline_if_done = false ,
21
22
org_agenda_text_search_extra_files = {},
Original file line number Diff line number Diff line change @@ -292,6 +292,21 @@ function Config:setup_mappings(category, buffer)
292
292
end
293
293
end
294
294
295
+ --- Setup the foldlevel for a given org file
296
+ function Config :setup_foldlevel ()
297
+ if self .org_startup_folded == ' overview' then
298
+ vim .opt_local .foldlevel = 0
299
+ elseif self .org_startup_folded == ' content' then
300
+ vim .opt_local .foldlevel = 1
301
+ elseif self .org_startup_folded == ' showeverything' then
302
+ vim .opt_local .foldlevel = 99
303
+ elseif self .org_startup_folded ~= ' inherit' then
304
+ utils .echo_warning (" Invalid option passed for 'org_startup_folded'!" )
305
+ self .opts .org_startup_folded = ' overview'
306
+ self :setup_foldlevel ()
307
+ end
308
+ end
309
+
295
310
--- @return string | nil
296
311
function Config :parse_archive_location (file , archive_loc )
297
312
if self :is_archive_file (file ) then
You can’t perform that action at this time.
0 commit comments