From 039041ea919644aed821c4af5efab3cb4f494cc0 Mon Sep 17 00:00:00 2001 From: Hawtian Wang Date: Wed, 29 Nov 2023 21:30:18 +0800 Subject: [PATCH] feat: try two path --- lua/ht/core/globals.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lua/ht/core/globals.lua b/lua/ht/core/globals.lua index c0b30648..27157942 100644 --- a/lua/ht/core/globals.lua +++ b/lua/ht/core/globals.lua @@ -1,12 +1,21 @@ local M = {} -local default_vault_path = "~/Documents/Main" +local default_vault_path = { + "~/Documents/Main", + "~/Projects/obsidian-data/Main", +} local function resolve_obsidian_vault() if vim.g.obsidian_vault_path then return vim.fn.resolve(vim.fn.expand(vim.g.obsidian_vault_path)) end - return vim.fn.resolve(vim.fn.expand(default_vault_path)) + for _, path in ipairs(default_vault_path) do + local p = vim.fn.resolve(vim.fn.expand(path)) + if vim.fn.isdirectory(p) == 1 then + return p + end + end + return vim.fn.resolve(vim.fn.expand(default_vault_path[1])) end local function resolve_has_obsidian_vault()