From a3d1e01bcd3eb11b9c474a0e7ca87030f13b23b9 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Sat, 11 May 2024 22:47:24 +0200 Subject: Fix orgmode --- fnl/plugins/orgmode.fnl | 48 +++++++++++++++++++++--------------------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/fnl/plugins/orgmode.fnl b/fnl/plugins/orgmode.fnl index e89039b..835becf 100644 --- a/fnl/plugins/orgmode.fnl +++ b/fnl/plugins/orgmode.fnl @@ -2,12 +2,16 @@ (local icons (require :settings.icons)) -(local keys [{1 :ga 2 :OrgAgendaPrompt :desc "Open agenda prompt"} - {1 :gc 2 :OrgCapturePrompt :desc "Open capture prompt"} - {1 :go +(local keys [{1 :oa + 2 :OrgAgendaPrompt + :desc "Open agenda prompt"} + {1 :oc + 2 :OrgCapturePrompt + :desc "Open capture prompt"} + {1 :of 2 ":Telescope find_files theme=dropdown cwd=~/.local/share/org" :desc "Find org file"} - {1 :gm + {1 :oh 2 "Telescope orgmode search_headings theme=dropdown" :desc "Search headings"}]) @@ -29,8 +33,8 @@ (tset vim.opt_local :foldenable false) (tset vim.opt_local :foldlevelstart 0) (tset vim.opt_local :foldlevel 0) - (tset vim.opt_local :conceallevel 2) - (tset vim.opt.local :concealcursor :nc))}]]) + (tset vim.opt_local :concealcursor :nc) + (tset vim.opt_local :conceallevel 2))}]]) (fn init [] (let [cmds (require :util.cmds)] @@ -38,34 +42,18 @@ (cmds.create-auto-cmds auto-cmds))) (local templates - {:t {:description :Task :template "* TODO %?\n %u\n DEADLINE: %T\n"} + {:t {:description :Todo :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 org-opts - {:org_agenda_files ["~/.local/share/org/**/*"] + {:org_agenda_files "~/.local/share/org/**/*" + :org_default_notes_file "~/.local/share/org/refile.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}} + :org_capture_templates templates :mappings {:org {:org_cycle : :org_global_cycle :}}}) (local bullets-opts @@ -81,7 +69,12 @@ "@org.checkbox.checked"] :todo [" " "@org.checkbox.checked"]}}}) -(local roam-opts {:directory "~/.local/share/org"}) +(local roam-templates + {:n {:description :node + :template "#+category: %^{type}\n#+filetags: %^{tags}\n#+date: %u\n\n* %?" + :target "%<%Y%m%d%H%M%S>-%[slug].org"}}) + +(local roam-opts {:directory "~/.local/share/org" :templates roam-templates}) (fn config [] (let [orgmode (require :orgmode) @@ -92,6 +85,7 @@ (bullets.setup bullets-opts))) {1 :nvim-orgmode/orgmode + :event :VeryLazy :dependencies [:akinsho/org-bullets.nvim :chipsenkbeil/org-roam.nvim] :ft [:org :orgagenda] : config -- cgit v1.2.3-70-g09d2