diff --git a/.config/nvim/lua/config/autocmds.lua b/.config/nvim/lua/config/autocmds.lua index 27e9e06..8261668 100644 --- a/.config/nvim/lua/config/autocmds.lua +++ b/.config/nvim/lua/config/autocmds.lua @@ -1,3 +1,11 @@ -- Autocmds are automatically loaded on the VeryLazy event -- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua -- Add any additional autocmds here + +--- test blinry's wiki setup +vim.api.nvim_create_autocmd({ "bufnewfile", "bufread" }, { + pattern = os.getenv("HOME") .. "/Documents/wiki/*", + callback = function() + vim.bo.filetype = "hiswiki" + end, +}) diff --git a/.config/nvim/syntax/hiswiki.lua b/.config/nvim/syntax/hiswiki.lua new file mode 100644 index 0000000..259a4bb --- /dev/null +++ b/.config/nvim/syntax/hiswiki.lua @@ -0,0 +1,13 @@ +-- Link the 'hiswikiLink' highlight group to the existing 'Underlined' group. +vim.api.nvim_set_hl(0, "hiswikiLink", { link = "Underlined" }) + +-- Remove all existing hiswikiLink syntax matches. +vim.cmd("syntax clear hiswikiLink") + +-- Find the directory of the current file. +local base_dir = vim.fn.expand("%:h") + +-- Loop through all files in the directory, and add a syntax match for each one. +for _, file in ipairs(vim.fn.readdir(base_dir)) do + vim.cmd("syntax match hiswikiLink /\\c\\V\\<" .. vim.fn.escape(file, "/\\") .. "/") +end