all repos

init.lua @ 29fd4de

my nvim config

init.lua/lua/plugins/orgmode.lua(view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
local u = require "core.utils"
local orgdir = "~/org/"

---@param p string
---@param not_file? boolean
---@return string
local function orgpath(p, not_file)
  return vim.fs.joinpath(orgdir, p) .. (not not_file and ".org" or "")
end

---@param act string
---@param opts? {}
local function action(act, opts)
  return function()
    return require("orgmode").action(act, opts or {})
  end
end

-- remove ugly background for folded text
local group = u.augroup "orgmode"
local pattern = { "*.org", "*.org_archive" }
u.aucmd({ "BufEnter", "BufWinEnter" }, {
  command = "highlight Folded guibg=NONE",
  pattern = pattern,
  group = group,
})

u.aucmd({ "BufLeave", "BufWinLeave" }, {
  command = "highlight Folded guibg=#3b4261", -- the color from tokyonight
  pattern = pattern,
  group = group,
})

---@type LazySpec
return {
  "nvim-orgmode/orgmode",
  ft = "org",
  cmd = "Org",
  keys = {
    "<leader>o",
    { "<leader>oo", ("<cmd>e " .. orgpath "refile" .. "<CR>") },
    { "<leader>oc", action "capture.prompt" },
    { "<leader>oa", action "agenda.prompt" },
  },
  dependencies = {
    { "akinsho/org-bullets.nvim", config = true },
    {
      "nvim-cmp",
      ---@module "cmp"
      ---@param opts cmp.ConfigSchema
      opts = function(_, opts)
        table.insert(opts.sources, {
          name = "orgmode",
          group_index = 0,
        })
      end,
    },
  },
  ---@module "orgmode"
  ---@type OrgConfigOpts
  ---@diagnostic disable-next-line: missing-fields
  opts = {
    org_default_notes_file = orgpath "refile",
    org_agenda_files = orgpath("**/*", true),
    -- stylua: ignore
    org_todo_keywords = { "TODO(t)", "INB", "DOING(p)" , "|", "DONE(d)", "KILL(k)",},
    org_hide_emphasis_markers = true,
    org_startup_indented = true,
    org_startup_folded = "content",
    org_ellipsis = "\t\t[ยทยทยท]",
    org_priority_highest = "A",
    org_priority_lowest = "D",
    org_priority_default = "D",
    mappings = {
      prefix = "<leader>o",
      agenda = {
        org_agenda_filter = "<leader>/",
      },
      org = {
        org_open_at_point = "<CR>",
        org_return = nil,
        org_export = nil,
      },
      global = {
        org_agenda = nil,
        org_capture = nil,
      },
    },
    org_capture_templates = {
      t = {
        description = "Task",
        template = "* TODO %?",
        target = orgpath "personal",
      },
      i = { description = "Inbox", template = "* %?" },
      w = {
        description = "New vocab",
        template = "* %?",
        headline = "new vocab",
      },
    },
    org_agenda_custom_commands = {
      p = {
        description = "Personal",
        types = {
          {
            type = "tags_todo",
            match = "-goals-prj",
            org_agenda_overriding_header = "Personal todos",
            org_agenda_files = { orgpath "todo", orgpath "personal" },
            org_agenda_sorting_strategy = { "priority-down", "todo-state-down" },
          },
        },
      },
      n = {
        description = "Next action",
        types = {
          {
            type = "tags_todo",
            match = "next",
            org_agenda_overriding_header = "Next action",
          },
        },
      },
    },
  },
}