summaryrefslogtreecommitdiff
path: root/fnl/plugins/editor/orgmode.fnl
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2023-09-23 22:05:37 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2023-09-23 22:05:37 +0200
commitd474c779523c512e3bc91bc5ce7bc87cafc6372b (patch)
tree3c50cc5bf8fb55167150c76171f54590babf7118 /fnl/plugins/editor/orgmode.fnl
parent6dcd88cde5825573a3732e8b18f7d663ca47495b (diff)
Move user and auto cmds to plugins
Diffstat (limited to 'fnl/plugins/editor/orgmode.fnl')
-rw-r--r--fnl/plugins/editor/orgmode.fnl32
1 files changed, 28 insertions, 4 deletions
diff --git a/fnl/plugins/editor/orgmode.fnl b/fnl/plugins/editor/orgmode.fnl
index bb67b88..5324b8d 100644
--- a/fnl/plugins/editor/orgmode.fnl
+++ b/fnl/plugins/editor/orgmode.fnl
@@ -1,5 +1,28 @@
;; Orgmode for nvim.
+(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 :conceallevel 2)
+ (tset vim.opt_local :concealcursor :nc))}]])
+
+(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 %?"}
@@ -11,14 +34,15 @@
:org_default_notes_file "~/.local/share/org/refile.org"
:org_agenda_templates templates})
-(fn setup []
- (let [orgmode (require :orgmode)]
+(fn config []
+ (let [orgmode (require :orgmode)
+ cmds (require :util.cmds)]
(orgmode.setup_ts_grammar)
(orgmode.setup opts)))
{1 :nvim-orgmode/orgmode
- :config (fn []
- (setup))
+ : config
+ : init
:event :BufReadPost
:keys [{1 :ga 2 :<cmd>OrgAgendaPrompt<cr> :desc "Open agenda prompt"}
{1 :gc 2 :<cmd>OrgCapturePrompt<cr> :desc "Open capture prompt"}