summaryrefslogtreecommitdiff
path: root/fnl/config/orgmode.fnl
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2022-12-27 00:58:05 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2022-12-27 00:58:05 +0100
commita37c7f590d8fcec40b86106aa0c36f0771dd8d84 (patch)
treec7e1fbebe1e5e3b33e9be655995e9d9db925dabe /fnl/config/orgmode.fnl
parentfc04483abe73633a012548d56627ad272667af87 (diff)
Revert "Replace orgmode with neorg"
This reverts commit fc04483abe73633a012548d56627ad272667af87.
Diffstat (limited to 'fnl/config/orgmode.fnl')
-rw-r--r--fnl/config/orgmode.fnl47
1 files changed, 47 insertions, 0 deletions
diff --git a/fnl/config/orgmode.fnl b/fnl/config/orgmode.fnl
new file mode 100644
index 0000000..216fe4c
--- /dev/null
+++ b/fnl/config/orgmode.fnl
@@ -0,0 +1,47 @@
+;; Orgmode for nvim.
+(module config.orgmode {autoload {nvim aniseed.nvim util config.util}})
+
+(nvim.ex.set :conceallevel=2)
+(nvim.ex.set :concealcursor=nc)
+
+(def- 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"}})
+
+(defn- create-title [task]
+ (string.format "%s (%s)" task.category task.humanized_duration))
+
+(defn- create-subtitle [task]
+ (string.format "%s %s %s" (string.rep "*" task.level) task.todo
+ task.title))
+
+(defn- get-date [task] (string.format "%s: %s" task.type (task.time:to_string)))
+
+(def- notifications
+ {:reminder_time [0 1 5 10]
+ :repeater_reminder_time [0 1 5 10]
+ :deadline_warning_reminder_time [0]
+ :cron_notifier (fn [tasks]
+ (each [_ task (ipairs tasks)]
+ (let [title (create-title task)
+ sub-title (create-subtitle task)
+ date (get-date task)]
+ (if (vim.fn.executable :notify-send)
+ (vim.loop.spawn :notify-send
+ {:args [:--icon=.local/share/nvim/site/pack/packer/start/orgmode/assets/orgmode_nvim.png
+ (string.format "%s\n%s\n%s"
+ title
+ subtitle
+ date)]})))))})
+
+(def- opts {:org_agenda_files ["~/.local/share/org/**/*"]
+ :org_hide_emphasis_markers true
+ :org_agenda_start_on_weekday false
+ :org_default_notes_file "~/.local/share/org/refile.org"
+ :org_agenda_templates templates
+ : notifications})
+
+(let [orgmode (util.prequire :orgmode)]
+ (orgmode.setup_ts_grammar)
+ (orgmode.setup opts))