feat: add an independent lvim namespace (#1699)

This commit is contained in:
kylo252 2021-10-10 21:07:41 +02:00 committed by GitHub
parent e2c85df440
commit 52b7455741
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23
63 changed files with 392 additions and 256 deletions

View file

@ -3,24 +3,22 @@ if os.getenv "LUNARVIM_RUNTIME_DIR" then
vim.opt.rtp:append(os.getenv "LUNARVIM_RUNTIME_DIR" .. path_sep .. "lvim")
end
require("bootstrap"):init()
require("lvim.bootstrap"):init()
local config = require "config"
-- config:init()
config:load()
require("lvim.config"):load()
local plugins = require "plugins"
require("plugin-loader"):load { plugins, lvim.plugins }
local plugins = require "lvim.plugins"
require("lvim.plugin-loader"):load { plugins, lvim.plugins }
local Log = require "core.log"
local Log = require "lvim.core.log"
Log:debug "Starting LunarVim"
vim.g.colors_name = lvim.colorscheme -- Colorscheme must get called after plugins are loaded or it will break new installs.
vim.cmd("colorscheme " .. lvim.colorscheme)
local commands = require "core.commands"
local commands = require "lvim.core.commands"
commands.load(commands.defaults)
require("keymappings").setup()
require("lvim.keymappings").setup()
require("lsp").setup()
require("lvim.lsp").setup()

View file

@ -1,28 +0,0 @@
local M = {}
local builtins = {
"keymappings",
"core.which-key",
"core.gitsigns",
"core.cmp",
"core.dashboard",
"core.dap",
"core.terminal",
"core.telescope",
"core.treesitter",
"core.nvimtree",
"core.project",
"core.bufferline",
"core.autopairs",
"core.comment",
"core.lualine",
}
function M.config(config)
for _, builtin_path in ipairs(builtins) do
local builtin = require(builtin_path)
builtin.config(config)
end
end
return M

View file

@ -1,7 +1,7 @@
local M = {}
package.loaded["utils.hooks"] = nil
local _, hooks = pcall(require, "utils.hooks")
package.loaded["lvim.utils.hooks"] = nil
local _, hooks = pcall(require, "lvim.utils.hooks")
---Join path segments that were passed as input
---@return string
@ -99,22 +99,25 @@ function M:init()
vim.cmd("set spellfile=" .. join_paths(self.config_dir, "spell", "en.utf-8.add"))
end
vim.fn.mkdir(vim.fn.stdpath "cache", "p")
vim.fn.mkdir(get_cache_dir(), "p")
-- FIXME: currently unreliable in unit-tests
if not os.getenv "LVIM_TEST_ENV" then
require("impatient").setup {
require("lvim.impatient").setup {
path = vim.fn.stdpath "cache" .. "/lvim_cache",
enable_profiling = true,
}
end
local config = require "config"
require("lvim.config"):init {
config_dir = self.config_dir,
}
local config = require "lvim.config"
config:init {
path = join_paths(self.config_dir, "config.lua"),
user_config = join_paths(self.config_dir, "config.lua"),
}
require("plugin-loader"):init {
require("lvim.plugin-loader"):init {
package_root = self.pack_dir,
install_path = self.packer_install_dir,
}
@ -132,7 +135,7 @@ end
local function git_cmd(subcmd)
local Job = require "plenary.job"
local Log = require "core.log"
local Log = require "lvim.core.log"
local args = { "-C", get_install_path() }
vim.list_extend(args, subcmd)
@ -161,7 +164,7 @@ end
---pulls the latest changes from github
function M:update_repo()
local Log = require "core.log"
local Log = require "lvim.core.log"
local sub_commands = {
fetch = { "fetch" },
diff = { "diff", "--quiet", "@{upstream}" },

View file

@ -1,14 +1,9 @@
local home_dir = vim.loop.os_homedir()
local utils = require "utils"
lvim = {
return {
leader = "space",
colorscheme = "onedarker",
line_wrap_cursor_movement = true,
transparent_window = false,
format_on_save = true,
vsnip_dir = utils.join_paths(home_dir, ".config", "snippets"),
database = { save_location = utils.join_paths(home_dir, ".config", "lunarvim_db"), auto_execute = 1 },
keys = {},
builtin = {},

View file

@ -1,29 +1,39 @@
local utils = require "lvim.utils"
local Log = require "lvim.core.log"
local M = {}
local user_config_dir = get_config_dir()
local user_config_file = utils.join_paths(user_config_dir, "config.lua")
-- Fallback config.lua to lv-config.lua
if not utils.is_file(user_config_file) then
local lv_config = utils.join_paths(user_config_dir, "lv-config.lua")
Log:warn(string.format("[%s] not found, falling back to [%s]", user_config_file, lv_config))
user_config_file = lv_config
end
function M:get_user_config_path()
return user_config_file
end
--- Initialize lvim default configuration
-- Define lvim global variable
function M:init(opts)
opts = opts or {}
self.path = opts.path
local utils = require "utils"
require "config.defaults"
-- Fallback config.lua to lv-config.lua
if not utils.is_file(self.path) then
local lv_config = self.path:gsub("config.lua$", "lv-config.lua")
print(self.path, "not found, falling back to", lv_config)
self.path = lv_config
function M:init()
if vim.tbl_isempty(lvim or {}) then
lvim = require "lvim.config.defaults"
local home_dir = vim.loop.os_homedir()
lvim.vsnip_dir = utils.join_paths(home_dir, ".config", "snippets")
lvim.database = { save_location = utils.join_paths(home_dir, ".config", "lunarvim_db"), auto_execute = 1 }
end
local builtins = require "core.builtins"
builtins.config(self)
local builtins = require "lvim.core.builtins"
builtins.config { user_config_file = user_config_file }
local settings = require "config.settings"
local settings = require "lvim.config.settings"
settings.load_options()
local lvim_lsp_config = require "lsp.config"
local lvim_lsp_config = require "lvim.lsp.config"
lvim.lsp = vim.deepcopy(lvim_lsp_config)
local supported_languages = {
@ -121,7 +131,7 @@ function M:init(opts)
"zig",
}
require("lsp.manager").init_defaults(supported_languages)
require("lvim.lsp.manager").init_defaults(supported_languages)
end
local function deprecation_notice()
@ -131,7 +141,7 @@ local function deprecation_notice()
end
for lang, entry in pairs(lvim.lang) do
local deprecated_config = entry["lsp"] or {}
local deprecated_config = entry["lvim.lsp"] or {}
if not vim.tbl_isempty(deprecated_config) then
local msg = string.format(
"Deprecation notice: [lvim.lang.%s.lsp] setting is no longer supported. See https://github.com/LunarVim/LunarVim#breaking-changes",
@ -147,24 +157,46 @@ end
--- Override the configuration with a user provided one
-- @param config_path The path to the configuration overrides
function M:load(config_path)
local autocmds = require "core.autocmds"
config_path = config_path or self.path
local ok, err = pcall(vim.cmd, "luafile " .. config_path)
config_path = config_path or self.get_user_config_path()
local ok, _ = pcall(dofile, config_path)
if not ok then
print("Invalid configuration", config_path)
print(err)
return
Log:warn("Invalid configuration: " .. config_path)
end
deprecation_notice()
self.path = config_path
local autocmds = require "lvim.core.autocmds"
autocmds.define_augroups(lvim.autocommands)
local settings = require "config.settings"
local settings = require "lvim.config.settings"
settings.load_commands()
end
--- Override the configuration with a user provided one
-- @param config_path The path to the configuration overrides
function M:reload()
local lvim_modules = {}
for module, _ in pairs(package.loaded) do
if module:match "lvim" then
package.loaded.module = nil
table.insert(lvim_modules, module)
end
end
M:init()
M:load()
require("lvim.keymappings").setup() -- this should be done before loading the plugins
local plugins = require "lvim.plugins"
utils.toggle_autoformat()
local plugin_loader = require "lvim.plugin-loader"
plugin_loader:cache_reset()
plugin_loader:load { plugins, lvim.plugins }
vim.cmd ":PackerInstall"
vim.cmd ":PackerCompile"
-- vim.cmd ":PackerClean"
require("lvim.lsp").setup()
Log:info "Reloaded configuration"
end
return M

View file

@ -1,5 +1,5 @@
local M = {}
local utils = require "utils"
local utils = require "lvim.utils"
M.load_options = function()
local default_options = {
backup = false, -- creates a backup file

View file

@ -1,12 +1,12 @@
local autocommands = {}
local config = require "config"
local user_config_file = require("lvim.config"):get_user_config_path()
lvim.autocommands = {
_general_settings = {
{
"Filetype",
"*",
"lua require('utils.ft').do_filetype(vim.fn.expand(\"<amatch>\"))",
"lua require('lvim.utils.ft').do_filetype(vim.fn.expand(\"<amatch>\"))",
},
{
"FileType",
@ -43,7 +43,7 @@ lvim.autocommands = {
"*",
"setlocal formatoptions-=c formatoptions-=r formatoptions-=o",
},
{ "BufWritePost", config.path, "lua require('utils').reload_lv_config()" },
{ "BufWritePost", user_config_file, "lua require('lvim.config'):reload()" },
{
"FileType",
"qf",

View file

@ -14,7 +14,7 @@ M.config = function()
end
M.setup = function()
local keymap = require "keymappings"
local keymap = require "lvim.keymappings"
keymap.append_to_defaults(lvim.builtin.bufferline.keymap)
if lvim.builtin.bufferline.on_config_done then

View file

@ -0,0 +1,28 @@
local M = {}
local builtins = {
"lvim.keymappings",
"lvim.core.which-key",
"lvim.core.gitsigns",
"lvim.core.cmp",
"lvim.core.dashboard",
"lvim.core.dap",
"lvim.core.terminal",
"lvim.core.telescope",
"lvim.core.treesitter",
"lvim.core.nvimtree",
"lvim.core.project",
"lvim.core.bufferline",
"lvim.core.autopairs",
"lvim.core.comment",
"lvim.core.lualine",
}
function M.config(config)
for _, builtin_path in ipairs(builtins) do
local builtin = require(builtin_path)
builtin.config(config)
end
end
return M

View file

@ -11,9 +11,9 @@ M.defaults = {
endfunction
]],
-- :LvimInfo
[[ command! LvimInfo lua require('core.info').toggle_popup(vim.bo.filetype) ]],
[[ command! LvimCacheReset lua require('utils.hooks').reset_cache() ]],
[[ command! LvimUpdate lua require('bootstrap').update() ]],
[[ command! LvimInfo lua require('lvim.core.info').toggle_popup(vim.bo.filetype) ]],
[[ command! LvimCacheReset lua require('lvim.utils.hooks').reset_cache() ]],
[[ command! LvimUpdate lua require('lvim.bootstrap').update() ]],
}
M.load = function(commands)

View file

@ -1,5 +1,5 @@
local M = {}
local utils = require "utils"
local utils = require "lvim.utils"
M.config = function(config)
lvim.builtin.dashboard = {
@ -48,7 +48,7 @@ M.config = function(config)
},
e = {
description = { " Configuration " },
command = ":e " .. config.path,
command = ":e " .. config.user_config_file,
},
},
@ -84,10 +84,10 @@ M.setup = function()
table.insert(footer, 3, "v" .. lvim_version)
end
local text = require "interface.text"
local text = require "lvim.interface.text"
vim.g.dashboard_custom_footer = text.align_center({ width = 0 }, footer, 0.49) -- Use 0.49 as  counts for 2 characters
require("core.autocmds").define_augroups {
require("lvim.core.autocmds").define_augroups {
_dashboard = {
-- seems to be nobuflisted that makes my stuff disappear will do more testing
{

View file

@ -10,16 +10,16 @@ local M = {
}
local fmt = string.format
local text = require "interface.text"
local lsp_utils = require "lsp.utils"
local text = require "lvim.interface.text"
local lsp_utils = require "lvim.lsp.utils"
local user_config_file = require("lvim.config"):get_user_config_path()
local function str_list(list)
return fmt("[ %s ]", table.concat(list, ", "))
end
local function get_formatter_suggestion_msg(ft)
local config = require "config"
local null_formatters = require "lsp.null-ls.formatters"
local null_formatters = require "lvim.lsp.null-ls.formatters"
local supported_formatters = null_formatters.list_available(ft)
local section = {
" HINT ",
@ -30,7 +30,7 @@ local function get_formatter_suggestion_msg(ft)
if not vim.tbl_isempty(supported_formatters) then
vim.list_extend(section, {
"* Configured formatter needs to be installed and executable.",
fmt("* Enable installed formatter(s) with following config in %s", config.path),
fmt("* Enable installed formatter(s) with following config in %s", user_config_file),
"",
fmt(" lvim.lang.%s.formatters = { { exe = '%s' } }", ft, table.concat(supported_formatters, "")),
})
@ -40,8 +40,7 @@ local function get_formatter_suggestion_msg(ft)
end
local function get_linter_suggestion_msg(ft)
local config = require "config"
local null_linters = require "lsp.null-ls.linters"
local null_linters = require "lvim.lsp.null-ls.linters"
local supported_linters = null_linters.list_available(ft)
local section = {
" HINT ",
@ -52,7 +51,7 @@ local function get_linter_suggestion_msg(ft)
if not vim.tbl_isempty(supported_linters) then
vim.list_extend(section, {
"* Configured linter needs to be installed and executable.",
fmt("* Enable installed linter(s) with following config in %s", config.path),
fmt("* Enable installed linter(s) with following config in %s", user_config_file),
"",
fmt(" lvim.lang.%s.linters = { { exe = '%s' } }", ft, table.concat(supported_linters, "")),
})
@ -108,8 +107,8 @@ function M.toggle_popup(ft)
table.insert(client_names, client.name)
end
local null_formatters = require "lsp.null-ls.formatters"
local null_linters = require "lsp.null-ls.linters"
local null_formatters = require "lvim.lsp.null-ls.formatters"
local null_linters = require "lvim.lsp.null-ls.linters"
local registered_formatters = null_formatters.list_supported_names(ft)
local registered_linters = null_linters.list_supported_names(ft)
local registered_providers = {}
@ -159,11 +158,11 @@ function M.toggle_popup(ft)
vim.cmd 'let m=matchadd("string", "true")'
vim.cmd 'let m=matchadd("error", "false")'
tbl_set_highlight(registered_providers, "LvimInfoIdentifier")
-- tbl_set_highlight(require("lsp.null-ls.formatters").list_available(ft), "LvimInfoIdentifier")
-- tbl_set_highlight(require("lsp.null-ls.linters").list_available(ft), "LvimInfoIdentifier")
-- tbl_set_highlight(require("lvim.lsp.null-ls.formatters").list_available(ft), "LvimInfoIdentifier")
-- tbl_set_highlight(require("lvim.lsp.null-ls.linters").list_available(ft), "LvimInfoIdentifier")
end
local Popup = require("interface.popup"):new {
local Popup = require("lvim.interface.popup"):new {
win_opts = { number = false },
buf_opts = { modifiable = false, filetype = "lspinfo" },
}

View file

@ -1,5 +1,5 @@
local conditions = require "core.lualine.conditions"
local colors = require "core.lualine.colors"
local conditions = require "lvim.core.lualine.conditions"
local colors = require "lvim.core.lualine.colors"
local function diff_source()
local gitsigns = vim.b.gitsigns_status_dict
@ -46,7 +46,7 @@ return {
},
python_env = {
function()
local utils = require "core.lualine.utils"
local utils = require "lvim.core.lualine.utils"
if vim.bo.filetype == "python" then
local venv = os.getenv "CONDA_DEFAULT_ENV"
if venv then
@ -103,12 +103,12 @@ return {
end
-- add formatter
local formatters = require "lsp.null-ls.formatters"
local formatters = require "lvim.lsp.null-ls.formatters"
local supported_formatters = formatters.list_supported_names(buf_ft)
vim.list_extend(buf_client_names, supported_formatters)
-- add linter
local linters = require "lsp.null-ls.linters"
local linters = require "lvim.lsp.null-ls.linters"
local supported_linters = linters.list_supported_names(buf_ft)
vim.list_extend(buf_client_names, supported_linters)

View file

@ -33,8 +33,8 @@ M.config = function()
end
M.setup = function()
require("core.lualine.styles").update()
require("core.lualine.utils").validate_theme()
require("lvim.core.lualine.styles").update()
require("lvim.core.lualine.utils").validate_theme()
local lualine = require "lualine"
lualine.setup(lvim.builtin.lualine)

View file

@ -1,5 +1,5 @@
local M = {}
local components = require "core.lualine.components"
local components = require "lvim.core.lualine.components"
local styles = {
lvim = nil,
@ -111,7 +111,7 @@ styles.lvim = {
function M.get_style(style)
local style_keys = vim.tbl_keys(styles)
if not vim.tbl_contains(style_keys, style) then
local Log = require "core.log"
local Log = require "lvim.core.log"
Log:error(
"Invalid lualine style",
string.format('"%s"', style),

View file

@ -1,5 +1,5 @@
local M = {}
local Log = require "core.log"
local Log = require "lvim.core.log"
function M.config()
lvim.builtin.nvimtree = {
@ -109,7 +109,7 @@ function M.setup()
open()
end
vim.cmd "au WinClosed * lua require('core.nvimtree').on_close()"
vim.cmd "au WinClosed * lua require('lvim.core.nvimtree').on_close()"
if lvim.builtin.nvimtree.on_config_done then
lvim.builtin.nvimtree.on_config_done(nvim_tree_config)

View file

@ -1,7 +1,5 @@
local M = {}
local utils = require "utils"
function M.config()
-- Define this minimal config so that it's available if telescope is not yet available.
lvim.builtin.telescope = {
@ -92,8 +90,8 @@ function M.find_lunarvim_files(opts)
layout_strategy = "bottom_pane",
prompt_prefix = ">> ",
prompt_title = "~ LunarVim files ~",
cwd = utils.join_paths(get_runtime_dir(), "lvim"),
find_command = { "git", "ls-files" },
cwd = get_runtime_dir(),
search_dirs = { get_runtime_dir() .. "/lvim", lvim.lsp.templates_dir },
}
opts = vim.tbl_deep_extend("force", theme_opts, opts)
require("telescope.builtin").find_files(opts)
@ -107,7 +105,8 @@ function M.grep_lunarvim_files(opts)
layout_strategy = "bottom_pane",
prompt_prefix = ">> ",
prompt_title = "~ search LunarVim ~",
cwd = utils.join_paths(get_runtime_dir(), "lvim"),
cwd = get_runtime_dir(),
search_dirs = { get_runtime_dir() .. "/lvim", lvim.lsp.templates_dir },
}
opts = vim.tbl_deep_extend("force", theme_opts, opts)
require("telescope.builtin").live_grep(opts)

View file

@ -1,5 +1,5 @@
local M = {}
local Log = require "core.log"
local Log = require "lvim.core.log"
M.config = function()
lvim.builtin["terminal"] = {
@ -48,7 +48,7 @@ end
M.setup = function()
local terminal = require "toggleterm"
for _, exec in pairs(lvim.builtin.terminal.execs) do
require("core.terminal").add_exec(exec[1], exec[2], exec[3])
require("lvim.core.terminal").add_exec(exec[1], exec[2], exec[3])
end
terminal.setup(lvim.builtin.terminal)
@ -61,7 +61,7 @@ M.add_exec = function(exec, keymap, name)
vim.api.nvim_set_keymap(
"n",
"<leader>" .. keymap,
"<cmd>lua require('core.terminal')._exec_toggle('" .. exec .. "')<CR>",
"<cmd>lua require('lvim.core.terminal')._exec_toggle('" .. exec .. "')<CR>",
{ noremap = true, silent = true }
)
lvim.builtin.which_key.mappings[keymap] = name

View file

@ -1,5 +1,5 @@
local M = {}
local Log = require "core.log"
local Log = require "lvim.core.log"
M.config = function()
lvim.builtin.treesitter = {

View file

@ -98,7 +98,7 @@ M.config = function()
name = "Packer",
c = { "<cmd>PackerCompile<cr>", "Compile" },
i = { "<cmd>PackerInstall<cr>", "Install" },
r = { "<cmd>lua require('utils').reload_lv_config()<cr>", "Reload" },
r = { "<cmd>lua require('lvim.utils').reload_lv_config()<cr>", "Reload" },
s = { "<cmd>PackerSync<cr>", "Sync" },
S = { "<cmd>PackerStatus<cr>", "Status" },
u = { "<cmd>PackerUpdate<cr>", "Update" },
@ -162,9 +162,9 @@ M.config = function()
l = { "<cmd>lua vim.lsp.codelens.run()<cr>", "CodeLens Action" },
p = {
name = "Peek",
d = { "<cmd>lua require('lsp.peek').Peek('definition')<cr>", "Definition" },
t = { "<cmd>lua require('lsp.peek').Peek('typeDefinition')<cr>", "Type Definition" },
i = { "<cmd>lua require('lsp.peek').Peek('implementation')<cr>", "Implementation" },
d = { "<cmd>lua require('lvim.lsp.peek').Peek('definition')<cr>", "Definition" },
t = { "<cmd>lua require('lvim.lsp.peek').Peek('typeDefinition')<cr>", "Type Definition" },
i = { "<cmd>lua require('lvim.lsp.peek').Peek('implementation')<cr>", "Implementation" },
},
q = { "<cmd>lua vim.lsp.diagnostic.set_loclist()<cr>", "Quickfix" },
r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" },
@ -181,43 +181,46 @@ M.config = function()
"Edit config.lua",
},
f = {
"<cmd>lua require('core.telescope').find_lunarvim_files()<cr>",
"<cmd>lua require('lvim.core.telescope').find_lunarvim_files()<cr>",
"Find LunarVim files",
},
g = {
"<cmd>lua require('core.telescope').grep_lunarvim_files()<cr>",
"<cmd>lua require('lvim.core.telescope').grep_lunarvim_files()<cr>",
"Grep LunarVim files",
},
k = { "<cmd>lua require('keymappings').print()<cr>", "View LunarVim's default keymappings" },
k = { "<cmd>lua require('lvim.keymappings').print()<cr>", "View LunarVim's default keymappings" },
i = {
"<cmd>lua require('core.info').toggle_popup(vim.bo.filetype)<cr>",
"<cmd>lua require('lvim.core.info').toggle_popup(vim.bo.filetype)<cr>",
"Toggle LunarVim Info",
},
I = {
"<cmd>lua require('core.telescope').view_lunarvim_changelog()<cr>",
"<cmd>lua require('lvim.core.telescope').view_lunarvim_changelog()<cr>",
"View LunarVim's changelog",
},
l = {
name = "+logs",
d = {
"<cmd>lua require('core.terminal').toggle_log_view(require('core.log').get_path())<cr>",
"<cmd>lua require('lvim.core.terminal').toggle_log_view(require('lvim.core.log').get_path())<cr>",
"view default log",
},
D = { "<cmd>lua vim.fn.execute('edit ' .. require('core.log').get_path())<cr>", "Open the default logfile" },
l = { "<cmd>lua require('core.terminal').toggle_log_view(vim.lsp.get_log_path())<cr>", "view lsp log" },
D = {
"<cmd>lua vim.fn.execute('edit ' .. require('lvim.core.log').get_path())<cr>",
"Open the default logfile",
},
l = { "<cmd>lua require('lvim.core.terminal').toggle_log_view(vim.lsp.get_log_path())<cr>", "view lsp log" },
L = { "<cmd>lua vim.fn.execute('edit ' .. vim.lsp.get_log_path())<cr>", "Open the LSP logfile" },
n = {
"<cmd>lua require('core.terminal').toggle_log_view(os.getenv('NVIM_LOG_FILE'))<cr>",
"<cmd>lua require('lvim.core.terminal').toggle_log_view(os.getenv('NVIM_LOG_FILE'))<cr>",
"view neovim log",
},
N = { "<cmd>edit $NVIM_LOG_FILE<cr>", "Open the Neovim logfile" },
p = {
"<cmd>lua require('core.terminal').toggle_log_view('packer.nvim')<cr>",
"<cmd>lua require('lvim.core.terminal').toggle_log_view('packer.nvim')<cr>",
"view packer log",
},
P = { "<cmd>exe 'edit '.stdpath('cache').'/packer.nvim.log'<cr>", "Open the Packer logfile" },
},
r = { "<cmd>lua require('utils').reload_lv_config()<cr>", "Reload configurations" },
r = { "<cmd>lua require('lvim.utils').reload_lv_config()<cr>", "Reload configurations" },
u = { "<cmd>LvimUpdate<cr>", "Update LunarVim" },
},
s = {

View file

@ -121,12 +121,12 @@ end
function M.enable_profile()
M.profile = {}
M.print_profile = function()
M.profile["impatient"] = {
M.profile["lvim.impatient"] = {
resolve = 0,
load = impatient_dur,
loader = "standard",
}
require("impatient.profile").print_profile(M.profile)
require("lvim.impatient.profile").print_profile(M.profile)
end
vim.cmd [[command! LuaCacheProfile lua _G.__luacache.print_profile()]]
end

View file

@ -1,5 +1,5 @@
local M = {}
local Log = require "core.log"
local Log = require "lvim.core.log"
local generic_opts_any = { noremap = true, silent = true }

View file

@ -30,9 +30,9 @@ return {
["gr"] = { "<cmd>lua vim.lsp.buf.references()<CR>", "Goto references" },
["gI"] = { "<cmd>lua vim.lsp.buf.implementation()<CR>", "Goto Implementation" },
["gs"] = { "<cmd>lua vim.lsp.buf.signature_help()<CR>", "show signature help" },
["gp"] = { "<cmd>lua require'lsp.peek'.Peek('definition')<CR>", "Peek definition" },
["gp"] = { "<cmd>lua require'lvim.lsp.peek'.Peek('definition')<CR>", "Peek definition" },
["gl"] = {
"<cmd>lua require'lsp.handlers'.show_line_diagnostics()<CR>",
"<cmd>lua require'lvim.lsp.handlers'.show_line_diagnostics()<CR>",
"Show line diagnostics",
},
},

View file

@ -1,6 +1,6 @@
local M = {}
local Log = require "core.log"
local utils = require "utils"
local Log = require "lvim.core.log"
local utils = require "lvim.utils"
local function lsp_highlight_document(client)
if lvim.lsp.document_highlight == false then
@ -149,17 +149,17 @@ function M.setup()
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = sign.name })
end
require("lsp.handlers").setup()
require("lvim.lsp.handlers").setup()
if not utils.is_directory(lvim.lsp.templates_dir) then
require("lsp.templates").generate_templates()
require("lvim.lsp.templates").generate_templates()
end
bootstrap_nlsp { config_home = utils.join_paths(get_config_dir(), "lsp-settings") }
require("lsp.null-ls").setup()
require("lvim.lsp.null-ls").setup()
require("utils").toggle_autoformat()
require("lvim.utils").toggle_autoformat()
end
return M

View file

@ -1,7 +1,7 @@
local M = {}
local Log = require "core.log"
local lsp_utils = require "lsp.utils"
local Log = require "lvim.core.log"
local lsp_utils = require "lvim.lsp.utils"
function M.init_defaults(languages)
for _, entry in ipairs(languages) do
@ -30,12 +30,12 @@ end
---@return table
local function resolve_config(name, user_config)
local config = {
on_attach = require("lsp").common_on_attach,
on_init = require("lsp").common_on_init,
capabilities = require("lsp").common_capabilities(),
on_attach = require("lvim.lsp").common_on_attach,
on_init = require("lvim.lsp").common_on_init,
capabilities = require("lvim.lsp").common_capabilities(),
}
local status_ok, custom_config = pcall(require, "lsp/providers/" .. name)
local status_ok, custom_config = pcall(require, "lvim.lsp/providers/" .. name)
if status_ok then
Log:debug("Using custom configuration for requested server: " .. name)
config = vim.tbl_deep_extend("force", config, custom_config)

View file

@ -1,8 +1,8 @@
local M = {}
local null_ls = require "null-ls"
local services = require "lsp.null-ls.services"
local Log = require "core.log"
local services = require "lvim.lsp.null-ls.services"
local Log = require "lvim.core.log"
function M.list_supported_names(filetype)
local null_ls_methods = require "null-ls.methods"
@ -13,7 +13,7 @@ end
function M.list_available(filetype)
local formatters = {}
local tbl = require "utils.table"
local tbl = require "lvim.utils.table"
for _, provider in pairs(null_ls.builtins.formatting) do
if tbl.contains(provider.filetypes or {}, function(ft)
return ft == "*" or ft == filetype

View file

@ -1,8 +1,8 @@
local M = {}
local Log = require "core.log"
local formatters = require "lsp.null-ls.formatters"
local linters = require "lsp.null-ls.linters"
local Log = require "lvim.core.log"
local formatters = require "lvim.lsp.null-ls.formatters"
local linters = require "lvim.lsp.null-ls.linters"
function M:setup()
local status_ok, null_ls = pcall(require, "null-ls")

View file

@ -1,8 +1,8 @@
local M = {}
local null_ls = require "null-ls"
local services = require "lsp.null-ls.services"
local Log = require "core.log"
local services = require "lvim.lsp.null-ls.services"
local Log = require "lvim.core.log"
function M.list_supported_names(filetype)
local null_ls_methods = require "null-ls.methods"
@ -13,7 +13,7 @@ end
function M.list_available(filetype)
local linters = {}
local tbl = require "utils.table"
local tbl = require "lvim.utils.table"
for _, provider in pairs(null_ls.builtins.diagnostics) do
if tbl.contains(provider.filetypes or {}, function(ft)
return ft == "*" or ft == filetype

View file

@ -2,7 +2,7 @@ local M = {}
local function find_root_dir()
local util = require "lspconfig/util"
local lsp_utils = require "lsp.utils"
local lsp_utils = require "lvim.lsp.utils"
local ts_client = lsp_utils.is_client_active "typescript"
if ts_client then

View file

@ -130,7 +130,7 @@ function M.Peek(what)
M.floating_buf,
"n",
"<CR>",
":lua require('lsp.peek').open_file()<CR>",
":lua require('lvim.lsp.peek').open_file()<CR>",
{ noremap = true, silent = true }
)
else

View file

@ -6,7 +6,7 @@ local opts = {
},
workspace = {
library = {
[require("utils").join_paths(get_runtime_dir(), "lvim", "lua")] = true,
[require("lvim.utils").join_paths(get_runtime_dir(), "lvim", "lua")] = true,
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
},

View file

@ -1,7 +1,7 @@
local opts = {
setup = {
root_dir = function(fname)
local util = require "lspconfig/util"
local util = require "lvim.lspconfig/util"
return util.root_pattern "package.json"(fname) or util.root_pattern "vue.config.js"(fname) or vim.fn.getcwd()
end,
init_options = {

View file

@ -1,8 +1,8 @@
local M = {}
local Log = require "core.log"
local utils = require "utils"
local get_supported_filetypes = require("lsp.utils").get_supported_filetypes
local Log = require "lvim.core.log"
local utils = require "lvim.utils"
local get_supported_filetypes = require("lvim.lsp.utils").get_supported_filetypes
local ftplugin_dir = lvim.lsp.templates_dir
@ -59,7 +59,7 @@ function M.generate_ftplugin(server_name, dir)
for _, filetype in ipairs(filetypes) do
local filename = join_paths(dir, filetype .. ".lua")
local setup_cmd = string.format([[require("lsp.manager").setup(%q)]], server_name)
local setup_cmd = string.format([[require("lvim.lsp.manager").setup(%q)]], server_name)
-- print("using setup_cmd: " .. setup_cmd)
-- overwrite the file completely
utils.write_file(filename, setup_cmd .. "\n", "a")

View file

@ -1,6 +1,6 @@
local M = {}
local tbl = require "utils.table"
local tbl = require "lvim.utils.table"
function M.is_client_active(name)
local clients = vim.lsp.get_active_clients()

View file

@ -1,7 +1,7 @@
local plugin_loader = {}
local utils = require "utils"
local Log = require "core.log"
local utils = require "lvim.utils"
local Log = require "lvim.core.log"
-- we need to reuse this outside of init()
local compile_path = get_config_dir() .. "/plugin/packer_compiled.lua"

View file

@ -15,7 +15,7 @@ return {
{
"nvim-telescope/telescope.nvim",
config = function()
require("core.telescope").setup()
require("lvim.core.telescope").setup()
end,
disable = not lvim.builtin.telescope.active,
},
@ -23,7 +23,7 @@ return {
{
"hrsh7th/nvim-cmp",
config = function()
require("core.cmp").setup()
require("lvim.core.cmp").setup()
end,
requires = {
"L3MON4D3/LuaSnip",
@ -36,7 +36,7 @@ return {
run = function()
-- cmp's config requires cmp to be installed to run the first time
if not lvim.builtin.cmp then
require("core.cmp").config()
require("lvim.core.cmp").config()
end
end,
},
@ -51,7 +51,7 @@ return {
"windwp/nvim-autopairs",
-- event = "InsertEnter",
config = function()
require("core.autopairs").setup()
require("lvim.core.autopairs").setup()
end,
disable = not lvim.builtin.autopairs.active,
},
@ -62,7 +62,7 @@ return {
branch = "0.5-compat",
-- run = ":TSUpdate",
config = function()
require("core.treesitter").setup()
require("lvim.core.treesitter").setup()
end,
},
@ -73,7 +73,7 @@ return {
-- cmd = "NvimTreeToggle",
-- commit = "fd7f60e242205ea9efc9649101c81a07d5f458bb",
config = function()
require("core.nvimtree").setup()
require("lvim.core.nvimtree").setup()
end,
disable = not lvim.builtin.nvimtree.active,
},
@ -82,7 +82,7 @@ return {
"lewis6991/gitsigns.nvim",
config = function()
require("core.gitsigns").setup()
require("lvim.core.gitsigns").setup()
end,
event = "BufRead",
disable = not lvim.builtin.gitsigns.active,
@ -92,7 +92,7 @@ return {
{
"folke/which-key.nvim",
config = function()
require("core.which-key").setup()
require("lvim.core.which-key").setup()
end,
event = "BufWinEnter",
disable = not lvim.builtin.which_key.active,
@ -103,7 +103,7 @@ return {
"terrortylor/nvim-comment",
event = "BufRead",
config = function()
require("core.comment").setup()
require("lvim.core.comment").setup()
end,
disable = not lvim.builtin.comment.active,
},
@ -112,7 +112,7 @@ return {
{
"ahmedkhalf/project.nvim",
config = function()
require("core.project").setup()
require("lvim.core.project").setup()
end,
disable = not lvim.builtin.project.active,
},
@ -126,7 +126,7 @@ return {
"shadmansaleh/lualine.nvim",
-- "Lunarvim/lualine.nvim",
config = function()
require("core.lualine").setup()
require("lvim.core.lualine").setup()
end,
disable = not lvim.builtin.lualine.active,
},
@ -134,7 +134,7 @@ return {
{
"romgrk/barbar.nvim",
config = function()
require("core.bufferline").setup()
require("lvim.core.bufferline").setup()
end,
event = "BufWinEnter",
disable = not lvim.builtin.bufferline.active,
@ -145,7 +145,7 @@ return {
"mfussenegger/nvim-dap",
-- event = "BufWinEnter",
config = function()
require("core.dap").setup()
require("lvim.core.dap").setup()
end,
disable = not lvim.builtin.dap.active,
},
@ -163,7 +163,7 @@ return {
"ChristianChiarulli/dashboard-nvim",
event = "BufWinEnter",
config = function()
require("core.dashboard").setup()
require("lvim.core.dashboard").setup()
end,
disable = not lvim.builtin.dashboard.active,
},
@ -173,7 +173,7 @@ return {
"akinsho/toggleterm.nvim",
event = "BufWinEnter",
config = function()
require("core.terminal").setup()
require("lvim.core.terminal").setup()
end,
disable = not lvim.builtin.terminal.active,
},

View file

@ -1,24 +1,26 @@
local M = {}
local Log = require "core.log"
local Log = require "lvim.core.log"
local in_headless = #vim.api.nvim_list_uis() == 0
function M.run_pre_update()
Log:debug "Starting pre-update hook"
_G.__luacache.clear_cache()
end
---Reset any startup cache files used by Packer and Impatient
---It also forces regenerating any template ftplugin files
---Tip: Useful for clearing any outdated settings
function M.reset_cache()
_G.__luacache.clear_cache()
require("plugin-loader"):cache_reset()
require("lvim.plugin-loader"):cache_reset()
package.loaded["lvim.lsp.templates"] = nil
require("lvim.lsp.templates").generate_templates()
end
function M.run_post_update()
M.reset_cache()
Log:debug "Starting post-update hook"
package.loaded["lsp.templates"] = nil
require("lsp.templates").generate_templates()
M.reset_cache()
if not in_headless then
vim.schedule(function()

View file

@ -1,5 +1,5 @@
local utils = {}
local Log = require "core.log"
local Log = require "lvim.core.log"
local uv = vim.loop
-- recursive Print (structure, limit, separator)
@ -61,7 +61,7 @@ end
-- autoformat
function utils.toggle_autoformat()
if lvim.format_on_save then
require("core.autocmds").define_augroups {
require("lvim.core.autocmds").define_augroups {
autoformat = {
{
"BufWritePre",
@ -83,26 +83,6 @@ function utils.toggle_autoformat()
end
end
function utils.reload_lv_config()
require("core.lualine").config()
local config = require "config"
config:load()
require("keymappings").setup() -- this should be done before loading the plugins
vim.cmd("source " .. utils.join_paths(get_runtime_dir(), "lvim", "lua", "plugins.lua"))
local plugins = require "plugins"
utils.toggle_autoformat()
local plugin_loader = require "plugin-loader"
plugin_loader:cache_reset()
plugin_loader:load { plugins, lvim.plugins }
vim.cmd ":PackerInstall"
vim.cmd ":PackerCompile"
-- vim.cmd ":PackerClean"
require("lsp").setup()
Log:info "Reloaded configuration"
end
function utils.unrequire(m)
package.loaded[m] = nil
_G[m] = nil
@ -147,18 +127,6 @@ function utils.is_directory(path)
return stat and stat.type == "directory" or false
end
function utils.write_file(path, txt, flag)
uv.fs_open(path, flag, 438, function(open_err, fd)
assert(not open_err, open_err)
uv.fs_write(fd, txt, -1, function(write_err)
assert(not write_err, write_err)
uv.fs_close(fd, function(close_err)
assert(not close_err, close_err)
end)
end)
end)
end
utils.join_paths = _G.join_paths
function utils.write_file(path, txt, flag)
@ -215,7 +183,7 @@ function utils.file_contains(file, query)
end
function utils.log_contains(query)
local logfile = require("core.log"):get_path()
local logfile = require("lvim.core.log"):get_path()
local stdout, ret, stderr = utils.search_file(logfile, query)
if ret == 0 then
return true

View file

@ -8,7 +8,7 @@ a.describe("initial start", function()
a.it("shoud be able to detect test environment", function()
assert.truthy(os.getenv "LVIM_TEST_ENV")
assert.falsy(package.loaded["impatient"])
assert.falsy(package.loaded["lvim.impatient"])
end)
a.it("should not be reading default neovim directories in the home directoies", function()

View file

@ -0,0 +1,37 @@
local a = require "plenary.async_lib.tests"
local config = require "lvim.config"
a.describe("config-loader", function()
local user_config_path = config:get_user_config_path()
a.it("should be able to find user-config", function()
assert.equal(user_config_path, get_config_dir() .. "/config.lua")
end)
a.it("should be able to load user-config without errors", function()
config:load(user_config_path)
local errmsg = vim.fn.eval "v:errmsg"
local exception = vim.fn.eval "v:exception"
assert.equal("", errmsg) -- v:errmsg was not updated.
assert.equal("", exception)
end)
a.it("should be able to reload user-config without errors", function()
vim.opt.undodir = "/tmp"
assert.equal(vim.opt.undodir:get()[1], "/tmp")
config:reload()
assert.equal(vim.opt.undodir:get()[1], get_cache_dir() .. "/undo")
end)
a.it("should not get interrupted by errors in user-config", function()
vim.opt.undodir = "/tmp"
assert.equal(vim.opt.undodir:get()[1], "/tmp")
os.execute("echo bad_string_test >> " .. user_config_path)
local error_handler = function(msg)
return msg
end
local err = xpcall(config:reload(), error_handler)
assert.falsy(err)
assert.equal(vim.opt.undodir:get()[1], get_cache_dir() .. "/undo")
end)
end)

View file

@ -1,9 +1,9 @@
local a = require "plenary.async_lib.tests"
local utils = require "utils"
local utils = require "lvim.utils"
lvim.lsp.templates_dir = join_paths(get_runtime_dir(), "lvim", "tests", "artifacts")
a.describe("lsp workflow", function()
local Log = require "core.log"
local Log = require "lvim.core.log"
local logfile = Log:get_path()
a.it("shoud be able to delete ftplugin templates", function()
@ -17,7 +17,7 @@ a.describe("lsp workflow", function()
if utils.is_directory(lvim.lsp.templates_dir) then
assert.equal(vim.fn.delete(lvim.lsp.templates_dir, "rf"), 0)
end
require("lsp").setup()
require("lvim.lsp").setup()
-- we need to delay this check until the generation is completed
vim.schedule(function()
@ -28,15 +28,15 @@ a.describe("lsp workflow", function()
a.it("shoud not attempt to re-generate ftplugin templates", function()
lvim.log.level = "debug"
local plugins = require "plugins"
require("plugin-loader"):load { plugins, lvim.plugins }
local plugins = require "lvim.plugins"
require("lvim.plugin-loader"):load { plugins, lvim.plugins }
if utils.is_file(logfile) then
assert.equal(vim.fn.delete(logfile), 0)
end
assert.True(utils.is_directory(lvim.lsp.templates_dir))
require("lsp").setup()
require("lvim.lsp").setup()
-- we need to delay this check until the log gets populated
vim.schedule(function()
@ -49,7 +49,7 @@ a.describe("lsp workflow", function()
name = "ocamlls",
filetypes = { "ocaml", "reason" },
}
local ocaml_fts = require("lsp.utils").get_supported_filetypes(ocaml.name)
local ocaml_fts = require("lvim.lsp.utils").get_supported_filetypes(ocaml.name)
assert.True(vim.deep_equal(ocaml.filetypes, ocaml_fts))
local tsserver = {
@ -63,17 +63,17 @@ a.describe("lsp workflow", function()
"typescript.tsx",
},
}
local tsserver_fts = require("lsp.utils").get_supported_filetypes(tsserver.name)
local tsserver_fts = require("lvim.lsp.utils").get_supported_filetypes(tsserver.name)
assert.True(vim.deep_equal(tsserver.filetypes, tsserver_fts))
end)
a.it("shoud ignore all javascript servers except tsserver and tailwindcss when generating templates", function()
local test_server = { name = "denols", filetypes = {} }
test_server.filetypes = require("lsp.utils").get_supported_filetypes(test_server.name)
test_server.filetypes = require("lvim.lsp.utils").get_supported_filetypes(test_server.name)
assert.True(vim.tbl_contains(test_server.filetypes, "javascript"))
local is_ignored = require("lsp.templates").is_ignored(test_server.name)
local is_ignored = require("lvim.lsp.templates").is_ignored(test_server.name)
assert.True(is_ignored)
local ts_template = utils.join_paths(lvim.lsp.templates_dir, "typescript.lua")
@ -84,7 +84,7 @@ a.describe("lsp workflow", function()
a.it("shoud not include blacklisted servers in the generated templates", function()
assert.True(utils.is_directory(lvim.lsp.templates_dir))
require("lsp").setup()
require("lvim.lsp").setup()
local blacklisted = { "jedi_language_server", "pylsp", "sqlls", "sqls", "angularls", "ansiblels" }

View file

@ -2,8 +2,4 @@ local path_sep = vim.loop.os_uname().version:match "Windows" and "\\" or "/"
vim.opt.rtp:append(os.getenv "LUNARVIM_RUNTIME_DIR" .. path_sep .. "lvim")
require("bootstrap"):init()
local config = require "config"
-- config:init()
config:load()
require("lvim.bootstrap"):init()

103
tests/minimal_rtp.lua Normal file
View file

@ -0,0 +1,103 @@
vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
local package_root = "/tmp/nvim/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
require("packer").startup {
{
"wbthomason/packer.nvim",
"neovim/nvim-lspconfig",
{
"aserowy/tmux.nvim",
config = function()
require("tmux").setup {
navigation = {
-- cycles to opposite pane while navigating into the border
cycle_navigation = true,
-- enables default keybindings (C-hjkl) for normal mode
enable_default_keybindings = true,
-- prevents unzoom tmux when navigating beyond vim border
persist_zoom = true,
},
resize = {
-- enables default keybindings (A-hjkl) for normal mode
enable_default_keybindings = true,
},
}
end,
},
},
config = {
package_root = package_root,
compile_path = install_path .. "/plugin/packer_compiled.lua",
},
}
end
_G.load_config = function()
vim.lsp.set_log_level "trace"
local nvim_lsp = require "lspconfig"
local on_attach = function(_, bufnr)
local function buf_set_keymap(...)
vim.api.nvim_buf_set_keymap(bufnr, ...)
end
local function buf_set_option(...)
vim.api.nvim_buf_set_option(bufnr, ...)
end
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
-- Mappings.
local opts = { noremap = true, silent = true }
buf_set_keymap("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
buf_set_keymap("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
buf_set_keymap("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
buf_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
buf_set_keymap("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
buf_set_keymap("n", "<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
buf_set_keymap("n", "<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
buf_set_keymap("n", "<space>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", opts)
buf_set_keymap("n", "<space>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
buf_set_keymap("n", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
buf_set_keymap("n", "<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
buf_set_keymap("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
buf_set_keymap("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
buf_set_keymap("n", "<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
buf_set_keymap("n", "<space>li", "<cmd>LspInfo<CR>", opts)
end
-- Add the server that troubles you here
local name = "sumneko_lua"
local sumneko_root_dir = vim.fn.stdpath "data" .. "/lsp_servers/sumneko_lua/extension/server"
local cmd = { sumneko_root_dir .. "/bin/Linux/lua-language-server", "-E", sumneko_root_dir .. "/main.lua" }
if not name then
print "You have not defined a server name, please edit minimal_init.lua"
end
if not nvim_lsp[name].document_config.default_config.cmd and not cmd then
print [[You have not defined a server default cmd for a server
that requires it please edit minimal_init.lua]]
end
nvim_lsp[name].setup {
cmd = cmd,
on_attach = on_attach,
}
print [[You can find your log at $HOME/.cache/nvim/lsp.log. Please paste in a github issue under a details tag as described in the issue template.]]
end
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system { "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path }
load_plugins()
require("packer").sync()
vim.cmd [[autocmd User PackerComplete ++once lua load_config()]]
else
load_plugins()
require("packer").sync()
_G.load_config()
end

View file

@ -1,9 +1,11 @@
local a = require "plenary.async_lib.tests"
a.describe("plugin-loader", function()
local plugins = require "lvim.plugins"
local loader = require "lvim.plugin-loader"
a.it("should be able to load default packages without errors", function()
local plugins = require "plugins"
require("plugin-loader"):load { plugins, lvim.plugins }
loader:load { plugins, lvim.plugins }
-- TODO: maybe there's a way to avoid hard-coding the names of the modules?
local startup_plugins = {
@ -16,10 +18,9 @@ a.describe("plugin-loader", function()
end)
a.it("should be able to load lsp packages without errors", function()
local plugins = require "plugins"
require("plugin-loader"):load { plugins, lvim.plugins }
loader:load { plugins, lvim.plugins }
require("lsp").setup()
require("lvim.lsp").setup()
local lsp_packages = {
"lspconfig",