-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathconfig.lua
More file actions
47 lines (40 loc) · 1.23 KB
/
config.lua
File metadata and controls
47 lines (40 loc) · 1.23 KB
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
-- Config options to keep init clean.
local M = {}
local is_windows = vim.uv.os_uname().sysname == "Windows_NT"
local is_android = vim.fn.isdirectory('/data') == 1
---Parse user options, or set the defaults
---@param opts table A table with options to set.
M.set = function(opts)
-- Setup options
M.html_output = opts.html_output or nil
M.hide_toolbar = opts.hide_toolbar or false
M.grace_period = opts.grace_period or 3600000 -- 60min
M.markmap_cmd = opts.markmap_cmd or nil
-- Set defaults: M.html_output
if M.html_output == nil then
if is_windows then
M.html_output = vim.uv.os_getenv("TEMP") .. "\\" .. "markmap.html"
elseif is_android then
M.html_output = "/data/data/com.termux/files/usr/tmp/markmap.html"
else -- unix
M.html_output = "/tmp/markmap.html"
end
end
-- Set defaults: M.hide_toolbar
if M.hide_toolbar == true then
M.hide_toolbar = "--no-toolbar"
else
M.hide_toolbar = nil
end
-- Set defaults: M.markmap_cmd
if M.markmap_cmd == nil then
if is_windows then
M.markmap_cmd = "markmap.cmd" -- windows requires this special command.
else
M.markmap_cmd = "markmap"
end
end
-- Expose config globally
vim.g.markmap_config = M
end
return M