-
Notifications
You must be signed in to change notification settings - Fork 30
/
obsidian.nix
120 lines (105 loc) · 3.91 KB
/
obsidian.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
{ lib, ... }: {
plugins.obsidian = {
enable = lib.mkDefault false;
settings = {
completion = {
min_chars = 2;
nvim_cmp = true;
};
new_notes_location = "current_dir";
workspaces = [
{
name = "work";
path = "~/obsidian/work";
}
{
name = "home";
path = "~/obsidian/home";
}
];
daily_notes = {
template = "~/obsidian/templates/daily_note_template.md";
folder = "~/obsidian/work/daily_notes";
};
mappings = {
gf = {
action = "require('obsidian').util.gf_passthrough";
opts = {
noremap = false;
expr = true;
buffer = true;
};
};
"<leader>ch" = {
action = "require('obsidian').util.toggle_checkbox";
opts.buffer = true;
};
};
templates = {
subdir = "~/obsidian/templates";
substitutions = {
monday.__raw = ''
function()
-- Get the current date
local currentDate = os.date("*t")
-- Calculate the difference in days to the first day of the week (Monday)
local diff = (currentDate.wday + 5) % 7
-- Subtract the difference to get the date of the first day of the week
currentDate.day = currentDate.day - diff
-- Return the date of the first day of the week
return os.date("%Y-%m-%d", os.time(currentDate))
end
'';
tuesday.__raw = ''
function()
-- Get the current date
local currentDate = os.date("*t")
-- Calculate the difference in days to the first day of the week (Monday)
local diff = (currentDate.wday + 4) % 7
-- Subtract the difference to get the date of the first day of the week
currentDate.day = currentDate.day - diff
-- Return the date of the first day of the week
return os.date("%Y-%m-%d", os.time(currentDate))
end
'';
wednesday.__raw = ''
function()
-- Get the current date
local currentDate = os.date("*t")
-- Calculate the difference in days to the first day of the week (Monday)
local diff = (currentDate.wday + 3) % 7
-- Subtract the difference to get the date of the first day of the week
currentDate.day = currentDate.day - diff
-- Return the date of the first day of the week
return os.date("%Y-%m-%d", os.time(currentDate))
end
'';
thursday.__raw = ''
function()
-- Get the current date
local currentDate = os.date("*t")
-- Calculate the difference in days to the first day of the week (Monday)
local diff = (currentDate.wday + 2) % 7
-- Subtract the difference to get the date of the first day of the week
currentDate.day = currentDate.day - diff
-- Return the date of the first day of the week
return os.date("%Y-%m-%d", os.time(currentDate))
end
'';
friday.__raw = ''
function()
-- Get the current date
local currentDate = os.date("*t")
-- Calculate the difference in days to the first day of the week (Monday)
local diff = (currentDate.wday + 1) % 7
-- Subtract the difference to get the date of the first day of the week
currentDate.day = currentDate.day - diff
-- Return the date of the first day of the week
return os.date("%Y-%m-%d", os.time(currentDate))
end
'';
};
};
};
};
}