From 00b895d9e9577f084cf577a07f9d6d6e1f7a4cac Mon Sep 17 00:00:00 2001 From: Luc Sinet Date: Wed, 25 Aug 2021 07:47:48 +0200 Subject: [Feature] Encapsulate config logic (#1338) * Define core/builtins, streamline status_color interface * Encapsulate configuration in its own module * Add fallback to lv-config.lua * Rectify settings loading order to allow overriding vim options * Move default-config into config/ module * replace uv.fs_stat with utils.is_file --- init.lua | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index 1d6cdc0f..9724c2cc 100644 --- a/init.lua +++ b/init.lua @@ -17,34 +17,11 @@ vim.opt.rtp:append(home_dir .. "/.local/share/lunarvim/site/after") vim.cmd [[let &packpath = &runtimepath]] -- }}} -local function file_exists(name) - local f = io.open(name, "r") - if f ~= nil then - io.close(f) - return true - else - return false - end -end - -local lvim_path = os.getenv "HOME" .. "/.config/lvim/" -USER_CONFIG_PATH = lvim_path .. "config.lua" -local config_exist = file_exists(USER_CONFIG_PATH) -if not config_exist then - USER_CONFIG_PATH = lvim_path .. "lv-config.lua" - print "Rename ~/.config/lvim/lv-config.lua to config.lua" -end +local config = require "config" +config:init() +config:load() -require "default-config" local autocmds = require "core.autocmds" -require("settings").load_options() - -local status_ok, error = pcall(vim.cmd, "luafile " .. USER_CONFIG_PATH) -if not status_ok then - print("something is wrong with your " .. USER_CONFIG_PATH) - print(error) -end -require("settings").load_commands() autocmds.define_augroups(lvim.autocommands) local plugins = require "plugins" -- cgit v1.2.3