1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

restructure init.lua

This commit is contained in:
jdhao 2024-08-31 21:24:54 +02:00
parent a9fc298063
commit 51f81093da

View File

@ -16,25 +16,15 @@ local utils = require("utils")
local expected_version = "0.10.1" local expected_version = "0.10.1"
utils.is_compatible_version(expected_version) utils.is_compatible_version(expected_version)
local core_conf_files = { -- some global settings
"globals.lua", -- some global settings require("globals")
"options.vim", -- setting options in nvim -- setting options in nvim
"custom-autocmd.lua", -- various autocommands vim.cmd("source viml_conf/options.vim")
"mappings.lua", -- all the user-defined mappings -- various autocommands
"plugins.vim", -- all the plugins installed and their configurations require("custom-autocmd")
"colorschemes.lua", -- colorscheme settings -- all the user-defined mappings
} require("mappings")
-- all the plugins installed and their configurations
local viml_conf_dir = vim.fn.stdpath("config") .. "/viml_conf" vim.cmd("source viml_conf/plugins.vim")
-- source all the core config files -- colorscheme settings
for _, file_name in ipairs(core_conf_files) do require("colorschemes")
if vim.endswith(file_name, 'vim') then
local path = string.format("%s/%s", viml_conf_dir, file_name)
local source_cmd = "source " .. path
vim.cmd(source_cmd)
else
local module_name, _ = string.gsub(file_name, "%.lua", "")
package.loaded[module_name] = nil
require(module_name)
end
end