blob: 0be49c70d7500dd8521e64f701e6029247124ba2 (
plain)
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
|
;; Orgmode for nvim.
(local icons (require :settings.icons))
(local keys [{1 :ga 2 :<cmd>OrgAgendaPrompt<cr> :desc "Open agenda prompt"}
{1 :gc 2 :<cmd>OrgCapturePrompt<cr> :desc "Open capture prompt"}
{1 :go
2 ":Telescope find_files theme=dropdown cwd=~/.local/share/org<CR>"
:desc "Find org file"}
{1 :gm
2 "<cmd>Telescope orgmode search_headings theme=dropdown<cr>"
:desc "Search headings"}])
(local user-cmds [[:OrgAgendaPrompt
(lambda []
(let [orgmode (require :orgmode)]
(orgmode.action :agenda.prompt)))
{:nargs 0}]
[:OrgCapturePrompt
(lambda []
(let [orgmode (require :orgmode)]
(orgmode.action :capture.prompt)))
{:nargs 0}]])
(local auto-cmds
[[:FileType
{:pattern :org
:callback (fn []
(tset vim.opt_local :foldenable false)
(tset vim.opt_local :foldlevelstart 0)
(tset vim.opt_local :foldlevel 0)
(tset vim.opt_local :conceallevel 2))}]])
(fn init []
(let [cmds (require :util.cmds)]
(cmds.create-user-cmds user-cmds)
(cmds.create-auto-cmds auto-cmds)))
(local templates
{:t {:description :Task :template "* TODO %?\n %u\n DEADLINE: %T\n"}
:m {:description :Meeting :template "* Meeting %?"}
:n {:description :Note :template "* NOTE %? :NOTE:\n %u\n"}})
(lambda handler [data]
(let [options {}
options-by-label {}]
(each [_ item (ipairs data.items)]
(when (and item.key (not= (item.label:lower) :quit))
(table.insert options item.label)
(tset options-by-label item.label item)))
(vim.ui.select options {:prompt data.prompt}
(fn [choice]
(if choice
(do
(local option (. options-by-label choice))
(when option.action
(option.action))))))))
(local opts
{:org_agenda_files ["~/.local/share/org/**/*"]
:org_hide_emphasis_markers true
:org_agenda_start_on_weekday false
:org_startup_indented true
:org_log_into_drawer :LOGBOOK
:org_default_notes_file "~/.local/share/org/refile.org"
:org_agenda_templates templates
:ui {:menu {: handler}}
:mappings {:org {:org_cycle :<c-e> :org_global_cycle :<s-e>}}})
(fn config []
(let [orgmode (require :orgmode)
bullets (require :org-bullets)]
(orgmode.setup_ts_grammar)
(orgmode.setup opts)
(bullets.setup {:concealcursor true
:symbols {:list (. icons :line)
:headlines [(. icons :orb)
(. icons :filled-orb)
(. icons :pentagon)
(. icons :filled-pentagon)]
:checkboxes {:half [(. icons :line)
"@org.checkbox.halfchecked"]
:done [(. icons :checkmark)
"@org.checkbox.checked"]
:todo [" " "@org.checkbox.checked"]}}})))
{1 :nvim-orgmode/orgmode
:dependencies :akinsho/org-bullets.nvim
:ft [:org :orgagenda]
: config
: init
: keys}
|