]> git.rmz.io Git - dotfiles.git/blob - nvim/lua/plugins/productivity.lua
nvim: import neotest setup from lazyvim
[dotfiles.git] / nvim / lua / plugins / productivity.lua
1 -- TODO: finish this
2 -- Create a function that deindents all lines according to the indentation of the first
3 local function d(s)
4 local std = require("std")
5 local _, e = string.find(s, '^%s*')
6 local ss = std.string.split(s, '')
7 local dedent = function(str) return str:sub(e + 1) end
8 return std.functional.map(dedent, std.elems, ss)
9 end
10
11 ---@type LazyPluginSpec
12 return {
13 {
14 "nvim-orgmode/orgmode",
15 opts = {
16 org_agenda_files = { "~/org/**/*.org" },
17 org_default_notes_file = "~/org/refile.org",
18 mappings = {
19 prefix = "go",
20 global = {
21 org_agenda = "goa",
22 org_capture = "goc",
23 },
24 },
25 win_split_mode = function(name)
26 local bufnr = vim.api.nvim_create_buf(false, true)
27 vim.api.nvim_buf_set_name(bufnr, name)
28
29 if name == "orgagenda" then
30 vim.cmd("botright 80vsplit")
31 local win = vim.api.nvim_get_current_win()
32 vim.api.nvim_win_set_buf(win, bufnr)
33 return
34 end
35
36 local fill = 0.8
37 local width = math.floor((vim.o.columns * fill))
38 local height = math.floor((vim.o.lines * fill))
39 local row = math.floor((((vim.o.lines - height) / 2) - 1))
40 local col = math.floor(((vim.o.columns - width) / 2))
41 vim.api.nvim_open_win(bufnr, true, {
42 relative = "editor",
43 width = width,
44 height = height,
45 row = row,
46 col = col,
47 style = "minimal",
48 border = "rounded",
49 })
50 end,
51 org_agenda_span = "week",
52 org_agenda_start_on_weekday = false,
53 org_agenda_start_day = "-2d",
54 org_archive_location = "archive/%s_archive::",
55 org_log_done = 'time',
56 org_log_into_drawer = "LOGBOOK",
57 org_indent_mode = "noindent",
58 org_tags_column = -80, -- flushright
59 org_todo_keywords = { "TODO(t)", "NEXT(n)", "WAITING(w)", "|", "DONE", "CANCELLED" },
60 org_todo_keyword_faces = {
61 TODO = ":foreground #bf616a",
62 NEXT = ":foreground blue",
63 WAITING = ":foreground yellow",
64 CANCELLED = ":foreground grey",
65 },
66 org_capture_templates = {
67 t = {
68 description = "Task",
69 template = "* TODO %?\n:PROPERTIES:\n:CREATED: %U\n:END:",
70 },
71 l = "Log Task",
72 lh = {
73 description = "Log Task",
74 template = [[
75 * DONE %?
76 SCHEDULED: %t
77 ]],
78 },
79 lw = {
80 description = "Log Task (work)",
81 template = [[
82 * DONE %?
83 SCHEDULED: %t
84 ]],
85 target = "~/org/work.org",
86 headline = "Tasks"
87 },
88 j = {
89 description = "Journal",
90 template = "\n*** %u\n**** %U - %?",
91 target = "~/org/journal.org",
92 },
93 m = {
94 description = "Meeting",
95 template = "* Meeting %U\n%?",
96 target = "~/org/work.org",
97 headline = "Meetings",
98 },
99 },
100 },
101 dependencies = {
102 {
103 "nvim-treesitter",
104 opts = function(_, opts)
105 if type(opts.highlight) == "table" then
106 opts.hightlight = vim.tbl_extend("error", opts.highlight, {
107 additional_vim_regex_highlighting = { "org" },
108 })
109 end
110 if type(opts.ensure_installed) == "table" then
111 vim.list_extend(opts.ensure_installed, { "org" })
112 end
113 end,
114 },
115 },
116 init = function()
117 require("orgmode").setup_ts_grammar()
118 end,
119 },
120 }