all repos

init.lua @ 90751b4

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
128
129
130
131
132
133
134
135
136
137
local orgdir = "~/org/"

---@param p string
---@param not_file? boolean
---@return string
local function orgpath(p, not_file)
  return 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

local function find_orgfiles()
  require("telescope.builtin").find_files {
    cwd = orgdir,
    -- stylua: ignore
    find_command = {
      "fd",
      "--type", "f",
      "--exclude", "finance", -- idk why i store my ledger files in the same repo
      "--exclude", "notes",   -- i also store notes here now
      "--exclude", "*.org_archive",
      ".org",
    },
  }
end

---@type LazySpec
return {
  "nvim-orgmode/orgmode",
  ft = "org",
  keys = {
    "<leader>o",
    { "<leader>oo", ("<cmd>e " .. orgpath "refile" .. "<CR>") },
    { "<leader>so", find_orgfiles },
    { "<leader>oc", action "capture.prompt" },
    { "<leader>oa", action "agenda.prompt" },
  },
  dependencies = {
    { "akinsho/org-bullets.nvim", config = true },
    {
      "chipsenkbeil/org-roam.nvim",
      keys = { "<leader>r" },
      ---@module "org-roam"
      ---@type org-roam.config.Data
      opts = {
        directory = orgpath("roam", true),
        org_files = { orgpath "refile" },
        bindings = {
          prefix = "<leader>r",
          find_node = "<prefix>s",
        },
        templates = {
          n = {
            description = "Note",
            template = "%?",
            target = "%<%Y%m%d%H%M%S>-%[slug].org",
          },
          w = {
            description = "Weekly",
            template = "%?",
            target = "%r/weekly/%<%Y-%m-%d %W>.org",
          },
          d = {
            description = "Daily",
            template = "%?",
            target = "%r/daily/%<%Y-%m-%d>.org",
          },
        },
        ---@class org-roam.config.Extensions
        extensions = {
          dailies = {
            bindings = {
              goto_today = "<prefix>t",
            },
          },
        },
      },
    },
    {
      "nvim-cmp",
      ---@module "cmp"
      ---@param opts cmp.ConfigSchema
      opts = function(_, opts)
        table.insert(opts.sources, {
          name = "orgmode",
          group_index = 0,
        })
        table.insert(opts.custom_setups, function(cmp)
          cmp.setup.filetype("org-roam-select", { sources = {} })
        end)
      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 = { "INB(i)", "TODO(t)", "WAIT(w)", "DOING(p)" , "|", "DONE(d)", "KILL(k)",},
    org_hide_emphasis_markers = true,
    org_startup_indented = true,
    org_startup_folded = "content", -- "showeverything"
    mappings = {
      prefix = "<leader>o",
      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 %? :in:",
        target = orgpath "todo",
      },
      i = { description = "Inbox", template = "* %? :in:" },
      w = {
        description = "New vocab",
        template = "* %?",
        headline = "new vocab",
      },
    },
  },
}