Skip to content

Commit 651078a

Browse files
refactor: Replace .vim files with .lua
Closes #525
1 parent be6811b commit 651078a

File tree

4 files changed

+45
-50
lines changed

4 files changed

+45
-50
lines changed

ftplugin/org.lua

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
if vim.b.did_ftplugin then
2+
return
3+
end
4+
---@diagnostic disable-next-line: inject-field
5+
vim.b.did_ftplugin = true
6+
7+
local config = require('orgmode.config')
8+
9+
config:setup_mappings('org')
10+
config:setup_mappings('text_objects')
11+
config:setup_foldlevel()
12+
13+
vim.bo.modeline = false
14+
vim.opt_local.fillchars:append('fold: ')
15+
vim.opt_local.foldmethod = 'expr'
16+
vim.opt_local.foldexpr = 'nvim_treesitter#foldexpr()'
17+
vim.opt_local.foldtext = 'v:lua.require("orgmode.org.indent").foldtext()'
18+
vim.opt_local.formatexpr = 'v:lua.require("orgmode.org.format")()'
19+
vim.opt_local.omnifunc = 'v:lua.orgmode.omnifunc'
20+
vim.opt_local.commentstring = '# %s'
21+
22+
_G.orgmode.omnifunc = function(findstart, base)
23+
return require('orgmode.org.autocompletion.omni').omnifunc(findstart, base)
24+
end
25+
26+
local abbreviations = {
27+
[':today:'] = "require('orgmode.objects.date').today():to_wrapped_string(true)",
28+
[':now:'] = "require('orgmode.objects.date').now():to_wrapped_string(true)",
29+
[':itoday:'] = "require('orgmode.objects.date').today():to_wrapped_string(false)",
30+
[':inow:'] = "require('orgmode.objects.date').now():to_wrapped_string(false)",
31+
}
32+
33+
for abbrev, cmd in pairs(abbreviations) do
34+
vim.cmd.inoreabbrev(('<silent><buffer> %s <C-R>=luaeval("%s")<CR>'):format(abbrev, cmd))
35+
end

ftplugin/org.vim

Lines changed: 0 additions & 37 deletions
This file was deleted.

indent/org.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
if vim.b.did_indent then
2+
return
3+
end
4+
---@diagnostic disable-next-line: inject-field
5+
vim.b.did_indent = true
6+
7+
vim.bo.indentexpr = 'v:lua.require("orgmode.org.indent").indentexpr()'
8+
vim.bo.lisp = false
9+
vim.bo.smartindent = false
10+
vim.bo.autoindent = true

indent/org.vim

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)