diff options
author | kylo252 <[email protected]> | 2021-09-13 11:28:15 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2021-09-13 11:28:15 +0200 |
commit | 8eed75d67f9cbcefb91c4cb5aac0ffd013be25cc (patch) | |
tree | cba9d98b4b3c6559dc2bd17f1fb557cb88f5387f /lua/utils/init.lua | |
parent | 38b0c3d860d10515002fdb27db7e1187ce110b1d (diff) |
refactor: use more flexible paths (#1381)
Diffstat (limited to 'lua/utils/init.lua')
-rw-r--r-- | lua/utils/init.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lua/utils/init.lua b/lua/utils/init.lua index 8ea842ca..095390b1 100644 --- a/lua/utils/init.lua +++ b/lua/utils/init.lua @@ -90,7 +90,7 @@ function utils.reload_lv_config() config:load() require("keymappings").setup() -- this should be done before loading the plugins - vim.cmd "source ~/.local/share/lunarvim/lvim/lua/plugins.lua" + vim.cmd("source " .. utils.join_paths(get_runtime_dir(), "lvim", "lua", "plugins.lua")) local plugins = require "plugins" local plugin_loader = require("plugin-loader").init() utils.toggle_autoformat() @@ -127,6 +127,12 @@ function utils.is_file(filename) return stat and stat.type == "file" or false end +function utils.join_paths(...) + local path_sep = vim.loop.os_uname().version:match "Windows" and "\\" or "/" + local result = table.concat(vim.tbl_flatten { ... }, path_sep):gsub(path_sep .. "+", path_sep) + return result +end + return utils -- TODO: find a new home for these autocommands |