diff options
author | chaeing <[email protected]> | 2021-07-31 11:28:59 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2021-07-31 14:28:59 -0400 |
commit | 213e3961fa637e4dbe4ef1ea5fceadcb372e020e (patch) | |
tree | fb5f49fe23e03acef3509b0fe5c5cd906e5ca7aa /init.lua | |
parent | 2badb25f361ddeae32fcd482384cccdab96f8e68 (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.lua | 24 |
1 files changed, 22 insertions, 2 deletions
@@ -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() |