nvim-orgmode / orgmode

Orgmode clone written in Lua for Neovim 0.9+.
https://nvim-orgmode.github.io/
MIT License
3.03k stars 134 forks source link

integrate with startup plugin or statusline plugin #611

Closed yimingwangdell closed 8 months ago

yimingwangdell commented 1 year ago

Does this feature exist in Emacs orgmode core?

No

Orgmode link

No response

Feature value

No response

Additional context

if it can display whether I have planned task today when I launch vim, it would be good.

kristijanhusak commented 8 months ago

You can use api for this. This would list headline lines where deadline is today when you open up Neovim:

vim.api.nvim_create_autocmd('VimEnter', {
  pattern = '*',
  callback = function()
    local api = require('orgmode.api')
    local files = api.load()
    local result = {}
    for _, file in ipairs(files) do
      for _, headline in ipairs(file.headlines) do
        if headline.deadline and headline.deadline:is_today() then
          table.insert(result, headline.line)
        end
      end
    end
    vim.print(result)
  end
})

You can play with it to get the results you want.