mirror of
https://github.com/LunarVim/LunarVim.git
synced 2024-09-20 10:35:08 +02:00
Decoupling config from nvim (#1038)
This commit is contained in:
parent
acb6a7a2ce
commit
d02265175f
13 changed files with 63 additions and 39 deletions
14
init.lua
14
init.lua
|
@ -1,5 +1,17 @@
|
|||
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
|
||||
|
||||
set runtimepath-=~/.config/nvim
|
||||
set runtimepath-=~/.config/nvim/after
|
||||
set runtimepath^=~/.config/lvim
|
||||
]]
|
||||
-- vim.opt.rtp:append() instead of vim.cmd ?
|
||||
require "default-config"
|
||||
local status_ok, error = pcall(vim.cmd, "luafile " .. CONFIG_PATH .. "/lv-config.lua")
|
||||
local status_ok, error = pcall(vim.cmd, "luafile ~/.config/lvim/lv-config.lua")
|
||||
if not status_ok then
|
||||
print "something is wrong with your lv-config"
|
||||
print(error)
|
||||
|
|
|
@ -43,7 +43,8 @@ M.config = function()
|
|||
},
|
||||
d = {
|
||||
description = { " Settings " },
|
||||
command = ":e " .. CONFIG_PATH .. "/lv-config.lua",
|
||||
-- command = ":e " .. CONFIG_PATH .. "/lv-config.lua",
|
||||
command = ":e ~/.config/lvim/lv-config.lua",
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -67,8 +68,8 @@ M.setup = function()
|
|||
-- command = "Telescope find_files cwd=" .. CONFIG_PATH,
|
||||
-- },
|
||||
-- e = {description = {' Marks '}, command = 'Telescope marks'}
|
||||
vim.cmd "let g:dashboard_session_directory = $HOME..'/.config/nvim/.sessions'"
|
||||
vim.cmd "let packages = len(globpath('~/.local/share/nvim/site/pack/packer/start', '*', 0, 1))"
|
||||
vim.cmd 'let g:dashboard_session_directory = "~/.config/lvim/.sessions"'
|
||||
vim.cmd "let packages = len(globpath('~/.local/share/lunarvim/site/pack/packer/start', '*', 0, 1))"
|
||||
|
||||
vim.api.nvim_exec(
|
||||
[[
|
||||
|
|
|
@ -281,7 +281,7 @@ table.insert(gls.right, {
|
|||
condition = condition.hide_in_width,
|
||||
separator = " ",
|
||||
separator_highlight = { "NONE", colors.alt_bg },
|
||||
highlight = { colors.alt_bg, colors.alt_bg },
|
||||
highlight = { colors.grey, colors.alt_bg },
|
||||
},
|
||||
})
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ local M = {}
|
|||
M.setup = function()
|
||||
if O.lint_on_save then
|
||||
require("lv-utils").define_augroups {
|
||||
autolint = {
|
||||
autolint_on_save = {
|
||||
{
|
||||
"BufWritePost",
|
||||
"<buffer>",
|
||||
|
|
|
@ -64,7 +64,7 @@ M.config = function()
|
|||
["w"] = { "<cmd>w!<CR>", "Save" },
|
||||
["q"] = { "<cmd>q!<CR>", "Quit" },
|
||||
["/"] = { "<cmd>CommentToggle<CR>", "Comment" },
|
||||
["c"] = { "<cmd>BufferClose<CR>", "Close Buffer" },
|
||||
["c"] = { "<cmd>BufferClose!<CR>", "Close Buffer" },
|
||||
["e"] = { "<cmd>lua require'core.nvimtree'.toggle_tree()<CR>", "Explorer" },
|
||||
["f"] = { "<cmd>Telescope find_files<CR>", "Find File" },
|
||||
["h"] = { '<cmd>let @/=""<CR>', "No Highlight" },
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
CONFIG_PATH = vim.fn.stdpath "config"
|
||||
CONFIG_PATH = os.getenv "HOME" .. "/.local/share/lunarvim/lvim"
|
||||
DATA_PATH = vim.fn.stdpath "data"
|
||||
CACHE_PATH = vim.fn.stdpath "cache"
|
||||
TERMINAL = vim.fn.expand "$TERMINAL"
|
||||
|
@ -13,7 +13,7 @@ O = {
|
|||
transparent_window = false,
|
||||
format_on_save = true,
|
||||
lint_on_save = true,
|
||||
vsnip_dir = vim.fn.stdpath "config" .. "/snippets",
|
||||
vsnip_dir = os.getenv "HOME" .. "/.config/snippets",
|
||||
|
||||
default_options = {
|
||||
backup = false, -- creates a backup file
|
||||
|
|
|
@ -58,7 +58,8 @@ M.lsp = function()
|
|||
else
|
||||
print "Unsupported system"
|
||||
end
|
||||
JAVA_LS_EXECUTABLE = CONFIG_PATH .. "/utils/bin/jdtls"
|
||||
|
||||
JAVA_LS_EXECUTABLE = os.getenv "HOME" .. "/.local/share/lunarvim/lvim/utils/bin/jdtls"
|
||||
|
||||
require("jdtls").start_or_attach {
|
||||
on_attach = require("lsp").common_on_attach,
|
||||
|
|
|
@ -59,11 +59,12 @@ M.lsp = function()
|
|||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = { "vim" },
|
||||
globals = { "vim", "O" },
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = {
|
||||
[vim.fn.expand "~/.local/share/lunarvim/lvim/lua"] = true,
|
||||
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
|
||||
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
|
||||
},
|
||||
|
|
|
@ -57,11 +57,13 @@ function lv_utils.generate_settings()
|
|||
end
|
||||
|
||||
function lv_utils.reload_lv_config()
|
||||
vim.cmd "source ~/.config/nvim/lua/keymappings.lua"
|
||||
vim.cmd "source ~/.config/nvim/lv-config.lua"
|
||||
vim.cmd "source ~/.config/nvim/lua/plugins.lua"
|
||||
vim.cmd "source ~/.config/nvim/lua/settings.lua"
|
||||
vim.cmd "source ~/.config/nvim/lua/core/formatter.lua"
|
||||
vim.cmd "source ~/.config/lvim/lv-config.lua"
|
||||
vim.cmd "source ~/.local/share/lunarvim/lvim/lua/plugins.lua"
|
||||
local plugins = require "plugins"
|
||||
local plugin_loader = require("plugin-loader").init()
|
||||
plugin_loader:load { plugins, O.user_plugins }
|
||||
vim.cmd "source ~/.local/share/lunarvim/lvim/lua/settings.lua"
|
||||
vim.cmd "source ~/.local/share/lunarvim/lvim/lua/core/formatter.lua"
|
||||
vim.cmd ":PackerCompile"
|
||||
vim.cmd ":PackerInstall"
|
||||
-- vim.cmd ":PackerClean"
|
||||
|
|
|
@ -4,7 +4,7 @@ function plugin_loader:init()
|
|||
local execute = vim.api.nvim_command
|
||||
local fn = vim.fn
|
||||
|
||||
local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim"
|
||||
local install_path = "~/.local/share/lunarvim/site/pack/packer/start/packer.nvim"
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
execute("!git clone https://github.com/wbthomason/packer.nvim " .. install_path)
|
||||
execute "packadd packer.nvim"
|
||||
|
@ -15,12 +15,15 @@ function plugin_loader:init()
|
|||
return
|
||||
end
|
||||
|
||||
local util = require "packer.util"
|
||||
|
||||
packer.init {
|
||||
-- package_root = require("packer.util").join_paths(vim.fn.stdpath "data", "lvim", "pack"),
|
||||
package_root = util.join_paths "~/.local/share/lunarvim/site/pack/",
|
||||
compile_path = util.join_paths("~/.config/lvim", "plugin", "packer_compiled.lua"),
|
||||
git = { clone_timeout = 300 },
|
||||
display = {
|
||||
open_fn = function()
|
||||
return require("packer.util").float { border = "single" }
|
||||
return util.float { border = "single" }
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -40,16 +40,16 @@ fi
|
|||
|
||||
# JAR="$HOME/.config/nvim/.language-servers/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository/plugins/org.eclipse.equinox.launcher_*.jar"
|
||||
JAR="$HOME/.local/share/nvim/lspinstall/java/plugins/org.eclipse.equinox.launcher_*.jar"
|
||||
GRADLE_HOME="$HOME/gradle" "$JAVACMD" \
|
||||
GRADLE_HOME=$HOME/gradle "$JAVACMD" \
|
||||
-Declipse.application=org.eclipse.jdt.ls.core.id1 \
|
||||
-Dosgi.bundles.defaultStartLevel=4 \
|
||||
-Declipse.product=org.eclipse.jdt.ls.core.product \
|
||||
-Dlog.protocol=true \
|
||||
-Dlog.level=ALL \
|
||||
-javaagent:"$HOME/.local/share/nvim/lspinstall/java/lombok.jar" \
|
||||
-javaagent:$HOME/.local/share/nvim/lspinstall/java/lombok.jar \
|
||||
-Xms1g \
|
||||
-Xmx2G \
|
||||
-jar "$JAR" \
|
||||
-jar $(echo "$JAR") \
|
||||
-configuration "$CONFIG" \
|
||||
-data "${1:-$HOME/workspace}" \
|
||||
--add-modules=ALL-SYSTEM \
|
||||
|
|
3
utils/bin/lvim
Executable file
3
utils/bin/lvim
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
nvim -u ~/.local/share/lunarvim/lvim/init.lua --cmd "set runtimepath+=~/.local/share/lunarvim/lvim" "$@"
|
|
@ -15,9 +15,9 @@ installnodeubuntu() {
|
|||
sudo apt install npm
|
||||
}
|
||||
|
||||
moveoldnvim() {
|
||||
moveoldlvim() {
|
||||
echo "Not installing LunarVim"
|
||||
echo "Please move your ~/.config/nvim folder before installing"
|
||||
echo "Please move your ~/.local/share/lunarvim folder before installing"
|
||||
exit
|
||||
}
|
||||
|
||||
|
@ -96,25 +96,27 @@ installpynvim() {
|
|||
}
|
||||
|
||||
installpacker() {
|
||||
git clone https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim
|
||||
git clone https://github.com/wbthomason/packer.nvim ~/.local/share/lunarvim/site/pack/packer/start/packer.nvim
|
||||
}
|
||||
|
||||
cloneconfig() {
|
||||
echo "Cloning LunarVim configuration"
|
||||
git clone --branch "$LVBRANCH" https://github.com/ChristianChiarulli/lunarvim.git ~/.config/nvim
|
||||
cp "$HOME/.config/nvim/utils/installer/lv-config.example-no-ts.lua" "$HOME/.config/nvim/lv-config.lua"
|
||||
nvim --headless \
|
||||
git clone --branch "$LVBRANCH" https://github.com/ChristianChiarulli/lunarvim.git ~/.local/share/lunarvim/lvim
|
||||
mkdir -p "$HOME/.config/lvim"
|
||||
sudo cp "$HOME/.local/share/lunarvim/lvim/utils/bin/lvim" "/usr/local/bin"
|
||||
cp "$HOME/.local/share/lunarvim/lvim/utils/installer/lv-config.example-no-ts.lua" "$HOME/.config/lvim/lv-config.lua"
|
||||
|
||||
nvim -u ~/.local/share/lunarvim/lvim/init.lua --cmd "set runtimepath+=~/.local/share/lunarvim/lvim" --headless \
|
||||
+'autocmd User PackerComplete sleep 100m | qall' \
|
||||
+PackerInstall
|
||||
|
||||
nvim --headless \
|
||||
nvim -u ~/.local/share/lunarvim/lvim/init.lua --cmd "set runtimepath+=~/.local/share/lunarvim/lvim" --headless \
|
||||
+'autocmd User PackerComplete sleep 100m | qall' \
|
||||
+PackerSync
|
||||
|
||||
printf "\nCompile Complete\n"
|
||||
rm "$HOME/.config/nvim/lv-config.lua"
|
||||
cp "$HOME/.config/nvim/utils/installer/lv-config.example.lua" "$HOME/.config/nvim/lv-config.lua"
|
||||
# nvim --headless -cq ':silent TSUpdate' -cq ':qall' >/dev/null 2>&1
|
||||
rm "$HOME/.config/lvim/lv-config.lua"
|
||||
cp "$HOME/.local/share/lunarvim/lvim/utils/installer/lv-config.example.lua" "$HOME/.config/lvim/lv-config.lua"
|
||||
}
|
||||
|
||||
asktoinstallnode() {
|
||||
|
@ -176,15 +178,14 @@ echo 'Installing LunarVim'
|
|||
|
||||
case "$@" in
|
||||
*--overwrite*)
|
||||
echo '!!Warning!! -> Removing all nvim related config because of the --overwrite flag'
|
||||
rm -rf "$HOME/.config/nvim"
|
||||
echo '!!Warning!! -> Removing all lunarvim related config because of the --overwrite flag'
|
||||
rm -rf "$HOME/.local/share/lunarvim"
|
||||
rm -rf "$HOME/.cache/nvim"
|
||||
rm -rf "$HOME/.local/share/nvim/site/pack/packer"
|
||||
;;
|
||||
esac
|
||||
|
||||
# move old nvim directory if it exists
|
||||
[ -d "$HOME/.config/nvim" ] && moveoldnvim
|
||||
# move old lvim directory if it exists
|
||||
[ -d "$HOME/.local/share/lunarvim" ] && moveoldlvim
|
||||
|
||||
# install pip
|
||||
(command -v pip3 >/dev/null && echo "pip installed, moving on...") || asktoinstallpip
|
||||
|
@ -195,13 +196,13 @@ esac
|
|||
# install pynvim
|
||||
(pip3 list | grep pynvim >/dev/null && echo "pynvim installed, moving on...") || installpynvim
|
||||
|
||||
if [ -e "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim" ]; then
|
||||
if [ -e "$HOME/.local/share/lunarvim/site/pack/packer/start/packer.nvim" ]; then
|
||||
echo 'packer already installed'
|
||||
else
|
||||
installpacker
|
||||
fi
|
||||
|
||||
if [ -e "$HOME/.config/nvim/init.lua" ]; then
|
||||
if [ -e "$HOME/.local/share/lunarvim/lvim/init.lua" ]; then
|
||||
echo 'LunarVim already installed'
|
||||
else
|
||||
# clone config down
|
||||
|
|
Loading…
Reference in a new issue