|
| 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 |
0 commit comments