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:
parent
a9fc298063
commit
51f81093da
34
init.lua
34
init.lua
@ -16,25 +16,15 @@ local utils = require("utils")
|
||||
local expected_version = "0.10.1"
|
||||
utils.is_compatible_version(expected_version)
|
||||
|
||||
local core_conf_files = {
|
||||
"globals.lua", -- some global settings
|
||||
"options.vim", -- setting options in nvim
|
||||
"custom-autocmd.lua", -- various autocommands
|
||||
"mappings.lua", -- all the user-defined mappings
|
||||
"plugins.vim", -- all the plugins installed and their configurations
|
||||
"colorschemes.lua", -- colorscheme settings
|
||||
}
|
||||
|
||||
local viml_conf_dir = vim.fn.stdpath("config") .. "/viml_conf"
|
||||
-- source all the core config files
|
||||
for _, file_name in ipairs(core_conf_files) do
|
||||
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
|
||||
-- some global settings
|
||||
require("globals")
|
||||
-- setting options in nvim
|
||||
vim.cmd("source 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")
|
||||
-- colorscheme settings
|
||||
require("colorschemes")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user