Skip to content

Commit e10504b

Browse files
Move fold settings to ftplugin and add check if ftplugin and indent are already loaded.
1 parent c857768 commit e10504b

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

ftplugin/org.vim

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1+
if exists('b:did_indent')
2+
finish
3+
endif
4+
let b:did_indent = 1
5+
16
lua require('orgmode.config'):setup_mappings('org')
27
function OrgmodeOmni(findstart, base)
38
return luaeval('require("orgmode.org.autocompletion.omni")(_A[1], _A[2])', [a:findstart, a:base])
49
endfunction
510

11+
setlocal foldmethod=expr
12+
setlocal foldexpr=OrgmodeFoldExpr()
13+
setlocal foldtext=OrgmodeFoldText()
14+
setlocal foldlevel=0
615
setlocal omnifunc=OrgmodeOmni
716
setlocal commentstring=#\ %s
817
inoreabbrev <silent><buffer> :today: <<C-R>=luaeval("require('orgmode.objects.date').today():to_string()")<CR>>

indent/org.vim

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
if exists('b:did_ftplugin')
2+
finish
3+
endif
4+
let b:did_ftplugin = 1
5+
16
function! OrgmodeFoldExpr()
27
return luaeval('require("orgmode.org.indent").foldexpr()')
38
endfunction
@@ -10,11 +15,7 @@ function! OrgmodeFoldText()
1015
return luaeval('require("orgmode.org.indent").foldtext()')
1116
endfunction
1217

13-
setlocal foldmethod=expr
14-
setlocal foldexpr=OrgmodeFoldExpr()
15-
setlocal foldtext=OrgmodeFoldText()
1618
setlocal indentexpr=OrgmodeIndentExpr()
17-
setlocal foldlevel=0
1819
setlocal nolisp
1920
setlocal nosmartindent
2021
setlocal autoindent

0 commit comments

Comments
 (0)