Files
nixos/home/config/nvim/lua/vimwiki.lua
2025-08-15 17:44:24 -04:00

110 lines
3.7 KiB
Lua

local vim = vim
local opt = vim.opt
-- opt.wildmenu = true
-- vim.g.netrw_keepdir = 0
-- vim.treesitter.language.register("markdown", "vimwiki")
-- vim.g.vimwiki_folding = 'expr'
-- vim.g.vimwiki_header_type = "="
-- vim.api.nvim_create_autocmd({ "BufWritePost" }, {
-- pattern = "*.wiki", -- Adjust this pattern if your Vimwiki files have a different extension
-- callback = function()
-- vim.cmd("TWSyncTasks")
-- end,
-- })
-- Autocommand to trigger LuaSnip snippet expansion for new diary files
vim.api.nvim_create_autocmd("BufNewFile", {
pattern = "diary/*.wiki", -- Adjust this path to match your diary directory
callback = function()
-- Expand the 'diary_template' snippet automatically
ls.snip_expand(ls.snippets.diary_template[1])
end,
})
vim.g.vimwiki_automatic_nested_syntaxes = 1
vim.g.vimwiki_list = {
{
name = "Personal Wiki",
path = '/home/th3r00t/wiki/',
path_html = '/home/th3r00t/wiki/html/',
syntax = 'default',
ext = '.wiki',
diary_rel_path = 'diary/',
diary_index = "diary_index",
auto_tags = 1,
auto_toc = 1,
auto_export = 1,
template_path = "/home/th3r00t/wiki/templates/",
template_default = "def_template",
template_ext = "html",
css_name = "main.css",
maxhi = 1, -- BUG: Can be a source of lag.
diary_caption_level = 1,
bullet_types = { "-", "*", "#", "" },
cycle_bullets = 1,
generated_links_caption = 1,
listsyms = '✗○◐●✓',
-- listsym_rejected = '✗',
auto_diary_index = 1,
auto_generate_links = 1,
auto_generate_tags = 1,
exclude_files = { "**/README.md" },
rss_name = "feed.rss",
base_url = "https://th3r00t.net",
}
}
vim.g.vimwiki_syntax_plugins = {
codeblock = {
["```lua"] = { parser = "lua" },
["```python"] = { parser = "python" },
["```javascript"] = { parser = "javascript" },
["```bash"] = { parser = "bash" },
["```html"] = { parser = "html" },
["```css"] = { parser = "css" },
["```c"] = { parser = "c" },
["```zig"] = { parser = "zig" },
},
}
vim.g.vimwiki_toc_header = "Navigation"
vim.g.vimwiki_toc_header_level = 2
vim.g.vimwiki_hl_cb_checked = 1
vim.g.vimwiki_global_ext = 1
vim.g.vimwiki_auto_chdir = 1
vim.g.wimwiki_markdown_link_ext = 1
-- vim.g.vimwiki_folding = 'list'
vim.g.vimwiki_folding = 'expr'
vim.g.vimwiki_use_calendar = 1
vim.api.nvim_set_keymap('n', '<Leader>ww', '<Cmd>VimwikiIndex<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<Leader>wt', '<Cmd>VimwikiTabIndex<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<Leader>ws', '<Cmd>VimwikiUISelect<CR>', { noremap = true, silent = true })
local function setup_vimwiki_highlights()
-- Define color scheme mappings
local colors = {
header1 = "#81a1c1", -- Tokyo Night blue
header2 = "#88c0d0", -- Tokyo Night light blue
header3 = "#8fbcbb", -- Tokyo Night greenish blue
bold = "#eceff4", -- Tokyo Night bright white
italic = "#5e81ac", -- Tokyo Night dark blue
link = "#b48ead", -- Tokyo Night purple
list = "#d08770", -- Tokyo Night orange
}
-- Apply highlights for vimwiki syntax elements
vim.api.nvim_set_hl(0, "VimwikiHeader1", { fg = colors.header1, bold = true })
vim.api.nvim_set_hl(0, "VimwikiHeader2", { fg = colors.header2, bold = true })
vim.api.nvim_set_hl(0, "VimwikiHeader3", { fg = colors.header3, bold = true })
vim.api.nvim_set_hl(0, "VimwikiBold", { fg = colors.bold, bold = true })
vim.api.nvim_set_hl(0, "VimwikiItalic", { fg = colors.italic, italic = true })
vim.api.nvim_set_hl(0, "VimwikiLink", { fg = colors.link, underline = true })
vim.api.nvim_set_hl(0, "VimwikiList", { fg = colors.list })
end
setup_vimwiki_highlights()
-- Define the Lua function for generating the diary template
--
vim.pack.add({
{ src = "https://github.com/vimwiki/vimwiki", opt = true },
})
vim.cmd.packadd("vimwiki")