mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-31 15:19:26 +02:00
refactor: use more flexible paths (#1381)
This commit is contained in:
parent
38b0c3d860
commit
8eed75d67f
15 changed files with 216 additions and 153 deletions
|
@ -1,21 +1,14 @@
|
|||
local home_dir = vim.loop.os_homedir()
|
||||
local M = {
|
||||
path = string.format("%s/.config/lvim/config.lua", home_dir),
|
||||
}
|
||||
local M = {}
|
||||
|
||||
--- Initialize lvim default configuration
|
||||
-- Define lvim global variable
|
||||
function M:init()
|
||||
function M:init(opts)
|
||||
opts = opts or {}
|
||||
self.path = opts.path
|
||||
local utils = require "utils"
|
||||
|
||||
require "config.defaults"
|
||||
|
||||
local builtins = require "core.builtins"
|
||||
builtins.config(self)
|
||||
|
||||
local settings = require "config.settings"
|
||||
settings.load_options()
|
||||
|
||||
-- Fallback config.lua to lv-config.lua
|
||||
if not utils.is_file(self.path) then
|
||||
local lv_config = self.path:gsub("config.lua$", "lv-config.lua")
|
||||
|
@ -23,6 +16,12 @@ function M:init()
|
|||
|
||||
self.path = lv_config
|
||||
end
|
||||
|
||||
local builtins = require "core.builtins"
|
||||
builtins.config(self)
|
||||
|
||||
local settings = require "config.settings"
|
||||
settings.load_options()
|
||||
end
|
||||
|
||||
--- Override the configuration with a user provided one
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue