summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkylo252 <[email protected]>2021-08-20 22:59:40 +0200
committerGitHub <[email protected]>2021-08-20 22:59:40 +0200
commit33640834e4b07a8e9c5a6707ec0eadd863011ac0 (patch)
tree338a307a0622ba621561ffd55b61d38fac5febf7
parent7845b671ecb8634684f2d38158938bfe65fc5b31 (diff)
fix: set runtime directories correctly (#1354)
* fix: set runtime directories correctly This also simplifies the way to invoke LunarVim to just be: `nvim -u "$LUNARVIM_RUNTIME_DIR/lvim/init.lua"` Fixes #1352 * use libuv to get homedir path
-rw-r--r--init.lua29
-rwxr-xr-xutils/bin/lvim4
2 files changed, 20 insertions, 13 deletions
diff --git a/init.lua b/init.lua
index 5844d79d..1d6cdc0f 100644
--- a/init.lua
+++ b/init.lua
@@ -1,16 +1,21 @@
-vim.cmd [[
- set packpath-=~/.config/nvim
- set packpath-=~/.config/nvim/after
- set packpath-=~/.local/share/nvim/site
- set packpath^=~/.local/share/lunarvim/site
- set packpath^=~/.config/lvim
+-- {{{ Bootstrap
+local home_dir = vim.loop.os_homedir()
- set runtimepath-=~/.config/nvim
- set runtimepath-=~/.config/nvim/after
- set runtimepath+=~/.config/lvim
- set runtimepath^=~/.local/share/lunarvim/lvim/after
-]]
--- vim.opt.rtp:append() instead of vim.cmd ?
+vim.opt.rtp:append(home_dir .. "/.local/share/lunarvim/lvim")
+
+vim.opt.rtp:remove(home_dir .. "/.config/nvim")
+vim.opt.rtp:remove(home_dir .. "/.config/nvim/after")
+vim.opt.rtp:append(home_dir .. "/.config/lvim")
+vim.opt.rtp:append(home_dir .. "/.config/lvim/after")
+
+vim.opt.rtp:remove(home_dir .. "/.local/share/nvim/site")
+vim.opt.rtp:remove(home_dir .. "/.local/share/nvim/site/after")
+vim.opt.rtp:append(home_dir .. "/.local/share/lunarvim/site")
+vim.opt.rtp:append(home_dir .. "/.local/share/lunarvim/site/after")
+
+-- TODO: we need something like this: vim.opt.packpath = vim.opt.rtp
+vim.cmd [[let &packpath = &runtimepath]]
+-- }}}
local function file_exists(name)
local f = io.open(name, "r")
diff --git a/utils/bin/lvim b/utils/bin/lvim
index b94d544f..c55ddda7 100755
--- a/utils/bin/lvim
+++ b/utils/bin/lvim
@@ -1,3 +1,5 @@
#!/bin/sh
-exec nvim -u ~/.local/share/lunarvim/lvim/init.lua --cmd "set runtimepath+=~/.local/share/lunarvim/lvim" "$@"
+LUNARVIM_RUNTIME_DIR=${LUNARVIM_RUNTIME_DIR:-"$HOME/.local/share/lunarvim"}
+
+exec nvim -u "$LUNARVIM_RUNTIME_DIR"/lvim/init.lua "$@"