diff options
Diffstat (limited to 'lua/config/init.lua')
-rw-r--r-- | lua/config/init.lua | 141 |
1 files changed, 131 insertions, 10 deletions
diff --git a/lua/config/init.lua b/lua/config/init.lua index 332460d3..411f7a93 100644 --- a/lua/config/init.lua +++ b/lua/config/init.lua @@ -1,27 +1,146 @@ -local home_dir = vim.loop.os_homedir() -local M = { - path = string.format("%s/.config/lvim/config.lua", home_dir), -} +local M = {} --- Initialize lvim default configuration -- Define lvim global variable -function M:init() +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 + end + local builtins = require "core.builtins" builtins.config(self) local settings = require "config.settings" settings.load_options() - -- 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) + local lvim_lsp_config = require "lsp.config" + lvim.lsp = vim.deepcopy(lvim_lsp_config) - self.path = lv_config + local supported_languages = { + "asm", + "bash", + "beancount", + "bibtex", + "bicep", + "c", + "c_sharp", + "clojure", + "cmake", + "comment", + "commonlisp", + "cpp", + "crystal", + "cs", + "css", + "cuda", + "d", + "dart", + "dockerfile", + "dot", + "elixir", + "elm", + "emmet", + "erlang", + "fennel", + "fish", + "fortran", + "gdscript", + "glimmer", + "go", + "gomod", + "graphql", + "haskell", + "hcl", + "heex", + "html", + "java", + "javascript", + "javascriptreact", + "jsdoc", + "json", + "json5", + "jsonc", + "julia", + "kotlin", + "latex", + "ledger", + "less", + "lua", + "markdown", + "nginx", + "nix", + "ocaml", + "ocaml_interface", + "perl", + "php", + "pioasm", + "ps1", + "puppet", + "python", + "ql", + "query", + "r", + "regex", + "rst", + "ruby", + "rust", + "scala", + "scss", + "sh", + "solidity", + "sparql", + "sql", + "supercollider", + "surface", + "svelte", + "swift", + "tailwindcss", + "terraform", + "tex", + "tlaplus", + "toml", + "tsx", + "turtle", + "typescript", + "typescriptreact", + "verilog", + "vim", + "vue", + "yaml", + "yang", + "zig", + } + + require("lsp.manager").init_defaults(supported_languages) +end + +local function deprecation_notice() + local in_headless = #vim.api.nvim_list_uis() == 0 + if in_headless then + return + end + + for lang, entry in pairs(lvim.lang) do + local deprecated_config = entry["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", + lang + ) + vim.schedule(function() + vim.notify(msg, vim.log.levels.WARN) + end) + end end end @@ -38,6 +157,8 @@ function M:load(config_path) return end + deprecation_notice() + self.path = config_path autocmds.define_augroups(lvim.autocommands) |