Last active
June 13, 2025 12:06
-
-
Save vebbis321/41b91b56787ea3ad8f75853a7e9cb408 to your computer and use it in GitHub Desktop.
Enable harper for only certain paths
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root_dir = function(bufnr, on_dir) | |
local fname = vim.api.nvim_buf_get_name(bufnr) | |
local path = vim.loop.fs_realpath(fname) | |
if not path then | |
return nil | |
end | |
local allowed_dirs = { | |
vim.loop.fs_realpath(vim.fn.expand("~/wiki/math")), | |
vim.loop.fs_realpath(vim.fn.expand("~/wiki/physics")), | |
vim.loop.fs_realpath(vim.fn.expand("~/wiki/programming")), | |
} | |
for _, dir in ipairs(allowed_dirs) do | |
if dir and path:sub(1, #dir) == dir then | |
on_dir(dir) | |
end | |
end | |
end, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment