From ce7fdad6980da2d2d623f635fcf0fa1f547119a3 Mon Sep 17 00:00:00 2001
From: Gustaf Rydholm <gustaf.rydholm@gmail.com>
Date: Mon, 21 Mar 2022 18:54:19 +0100
Subject: build: add orgmode

---
 lua/config/init.lua       |  1 +
 lua/config/orgmode.lua    | 12 ++++++++++++
 lua/config/treesitter.lua |  6 +++---
 3 files changed, 16 insertions(+), 3 deletions(-)
 create mode 100644 lua/config/orgmode.lua

(limited to 'lua/config')

diff --git a/lua/config/init.lua b/lua/config/init.lua
index e2d0d27..0bd4360 100644
--- a/lua/config/init.lua
+++ b/lua/config/init.lua
@@ -20,3 +20,4 @@ require "config.hop"
 require "config.zen"
 require "config.spectre"
 require "config.colorizer"
+require "config.orgmode"
diff --git a/lua/config/orgmode.lua b/lua/config/orgmode.lua
new file mode 100644
index 0000000..82dac48
--- /dev/null
+++ b/lua/config/orgmode.lua
@@ -0,0 +1,12 @@
+local status_ok, orgmode = pcall(require, "orgmode")
+if not status_ok then
+  return
+end
+
+-- Load custom tree-sitter grammar for org filetype
+orgmode.setup_ts_grammar()
+
+orgmode.setup {
+  org_agenda_files = { "~/.local/share/org/**/*" },
+  org_default_notes_file = "~/.local/share/org/refile.org",
+}
diff --git a/lua/config/treesitter.lua b/lua/config/treesitter.lua
index 277d286..475eeee 100644
--- a/lua/config/treesitter.lua
+++ b/lua/config/treesitter.lua
@@ -7,7 +7,7 @@ if not status_ok then
 end
 
 treesitter.setup {
-  ensure_installed = "maintained",
+  ensure_installed = { "maintained", "org" },
   sync_install = false,
   ignore_install = { "" }, -- List of parsers to ignore installing
   autopairs = {
@@ -15,8 +15,8 @@ treesitter.setup {
   },
   highlight = {
     enable = true, -- false will disable the whole extension
-    disable = { "" }, -- list of language that will be disabled
-    additional_vim_regex_highlighting = true,
+    disable = { "org" }, -- list of language that will be disabled
+    additional_vim_regex_highlighting = { "org" }, -- Required since TS highlighter doesn't support all syntax features (conceal)
   },
   context_commentstring = {
     enable = true,
-- 
cgit v1.2.3-70-g09d2