all repos

init.lua @ b0be624

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
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 },
    {
      "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 = { "TODO(t)", "INB(i)", "DOING(I)", "SCHEDULED(s)", "|", "DONE(d)", "CANCEL(c)",},
    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 = "* INB %?",
        target = orgpath "todo",
      },
      i = { description = "Inbox", template = "* INB %?" },
      w = {
        description = "New vocab",
        template = "* %?",
        headline = "new vocab",
      },
    },
  },
}