Skip to content

Commit 9b412b3

Browse files
Call omnifunc through vim function and luaeval.
1 parent e49da78 commit 9b412b3

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

ftplugin/org.vim

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
lua require('orgmode.config'):setup_mappings('org')
2-
setlocal omnifunc=v:lua.orgmode.omni
2+
function OrgmodeOmni(findstart, base)
3+
return luaeval('require("orgmode.org.autocompletion").omni(_A[1], _A[2])', [a:findstart, a:base])
4+
endfunction
5+
6+
setlocal omnifunc=OrgmodeOmni
37
setlocal commentstring=#\ %s
48
inoreabbrev <silent><buffer> :today: <<C-R>=luaeval("require('orgmode.objects.date').today():to_string()")<CR>>
59
inoreabbrev <silent><buffer> :now: <<C-R>=luaeval("require('orgmode.objects.date').now():to_string()")<CR>>

lua/orgmode/init.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ function Org:init()
2828
capture = self.capture,
2929
agenda = self.agenda,
3030
})
31-
_G.orgmode.omni = require('orgmode.org.autocompletion').omni
3231
self.initialized = true
3332
end
3433

0 commit comments

Comments
 (0)