summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorchaeing <[email protected]>2021-07-31 11:28:59 -0700
committerGitHub <[email protected]>2021-07-31 14:28:59 -0400
commit213e3961fa637e4dbe4ef1ea5fceadcb372e020e (patch)
treefb5f49fe23e03acef3509b0fe5c5cd906e5ca7aa /init.lua
parent2badb25f361ddeae32fcd482384cccdab96f8e68 (diff)
[Feature] Rename lv-config.lua to config.lua (#1193)
* Rename example config files * Update user config path in installer * Update user config path with a variable * Update default user config file to config.lua * Add fallback to lv-config if config.lua not found * Add global variable USER_CONFIG_PATH
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua24
1 files changed, 22 insertions, 2 deletions
diff --git a/init.lua b/init.lua
index 92ec3d4b..a69fde44 100644
--- a/init.lua
+++ b/init.lua
@@ -11,12 +11,32 @@ vim.cmd [[
set runtimepath^=~/.local/share/lunarvim/lvim/after
]]
-- vim.opt.rtp:append() instead of vim.cmd ?
+
+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
+
require "default-config"
local autocmds = require "core.autocmds"
require("settings").load_options()
-local status_ok, error = pcall(vim.cmd, "luafile ~/.config/lvim/lv-config.lua")
+
+local status_ok, error = pcall(vim.cmd, "luafile " .. USER_CONFIG_PATH)
if not status_ok then
- print "something is wrong with your lv-config"
+ print("something is wrong with your " .. USER_CONFIG_PATH)
print(error)
end
require("settings").load_commands()