load obsidian.nvim workspaces from .obsidian_vaults file
this decouples the user-specific vaults from the repo the `.obsidian_vaults` file is expected to be in the root of the nvim config
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
spell/
|
||||
.obsidian_vaults
|
||||
|
||||
@@ -41,11 +41,27 @@ return {
|
||||
ui = {
|
||||
enable = false,
|
||||
},
|
||||
workspaces = {
|
||||
{
|
||||
name = "personal",
|
||||
path = "~/obsidian/409",
|
||||
},
|
||||
},
|
||||
workspaces = (function()
|
||||
local vaults = {}
|
||||
|
||||
local vaults_file_path = vim.fn.stdpath("config") .. "/.obsidian_vaults"
|
||||
local vaults_file = io.open(vaults_file_path, "r")
|
||||
|
||||
if vaults_file == nil then
|
||||
return vaults
|
||||
end
|
||||
|
||||
for line in vaults_file:lines() do
|
||||
for vault_name, vault_path in string.gmatch(line, "%s*(%S+)%s*=%s*(.+)%s*") do
|
||||
vaults[#vaults + 1] = {
|
||||
name = vault_name,
|
||||
path = vault_path,
|
||||
}
|
||||
vim.print(vaults[#vaults])
|
||||
end
|
||||
end
|
||||
|
||||
return vaults
|
||||
end)(),
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user