From 81f64ed32eb229ffe22cec030ab0126b981ab9aa Mon Sep 17 00:00:00 2001 From: jdhao Date: Mon, 2 Sep 2024 22:18:18 +0200 Subject: [PATCH] Use absolute path for viml config Full path should be used to load viml config, otherwise, when we open nvim in other directories, we see errors that the viml config can not be found. --- init.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 377d9fb..77e5c42 100644 --- a/init.lua +++ b/init.lua @@ -16,15 +16,18 @@ local utils = require("utils") local expected_version = "0.10.1" utils.is_compatible_version(expected_version) +local config_dir = vim.fn.stdpath("config") +---@cast config_dir string + -- some global settings require("globals") -- setting options in nvim -vim.cmd("source viml_conf/options.vim") +vim.cmd("source " .. vim.fs.joinpath(config_dir, "viml_conf/options.vim")) -- various autocommands require("custom-autocmd") -- all the user-defined mappings require("mappings") -- all the plugins installed and their configurations -vim.cmd("source viml_conf/plugins.vim") +vim.cmd("source ".. vim.fs.joinpath(config_dir, "viml_conf/plugins.vim")) -- colorscheme settings require("colorschemes")