From 627fdd60493860c9c5194d8ec0a70ec5aaa45bf8 Mon Sep 17 00:00:00 2001 From: Chase Colman <5411+chase@users.noreply.github.com> Date: Thu, 11 Nov 2021 04:45:52 +0800 Subject: fix(keymap): unset on reload, load correct order, add unset default (#1942) fix(keymap): don't unset default keymaps on reload unless set to false fix(keymaps): prevent accessing undefined default mode fix(keymap): use unadapted mode for default check fix(keymap): apply initial lvim.keys --- lua/lvim/config/init.lua | 10 +++++++--- lua/lvim/keymappings.lua | 26 ++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/lua/lvim/config/init.lua b/lua/lvim/config/init.lua index c932c456..20bc4c81 100644 --- a/lua/lvim/config/init.lua +++ b/lua/lvim/config/init.lua @@ -26,15 +26,14 @@ function M:init() lvim.database = { save_location = utils.join_paths(home_dir, ".config", "lunarvim_db"), auto_execute = 1 } end + lvim.keys = apply_defaults(lvim.keys, require("lvim.keymappings").get_defaults()) + local builtins = require "lvim.core.builtins" builtins.config { user_config_file = user_config_file } local settings = require "lvim.config.settings" settings.load_options() - local default_keymaps = require("lvim.keymappings").get_defaults() - lvim.keys = apply_defaults(lvim.keys, default_keymaps) - local autocmds = require "lvim.core.autocmds" lvim.autocommands = apply_defaults(lvim.autocommands, autocmds.load_augroups()) @@ -89,6 +88,9 @@ function M:load(config_path) autocmds.define_augroups(lvim.autocommands) vim.g.mapleader = (lvim.leader == "space" and " ") or lvim.leader + + local default_keymaps = require("lvim.keymappings").get_defaults() + lvim.keys = apply_defaults(lvim.keys, default_keymaps) require("lvim.keymappings").load(lvim.keys) local settings = require "lvim.config.settings" @@ -98,6 +100,8 @@ end --- Override the configuration with a user provided one -- @param config_path The path to the configuration overrides function M:reload() + require("lvim.keymappings").clear(lvim.keys) + local lvim_modules = {} for module, _ in pairs(package.loaded) do if module:match "lvim.core" then diff --git a/lua/lvim/keymappings.lua b/lua/lvim/keymappings.lua index a57b2d36..b05d1754 100644 --- a/lua/lvim/keymappings.lua +++ b/lua/lvim/keymappings.lua @@ -24,13 +24,31 @@ local mode_adapters = { -- Append key mappings to lunarvim's defaults for a given mode -- @param keymaps The table of key mappings containing a list per mode (normal_mode, insert_mode, ..) function M.append_to_defaults(keymaps) + local default = M.get_defaults() + lvim.keys = lvim.keys or default for mode, mappings in pairs(keymaps) do - for k, v in ipairs(mappings) do + lvim.keys[mode] = lvim.keys[mode] or default[mode] + for k, v in pairs(mappings) do lvim.keys[mode][k] = v end end end +-- Unsets all keybindings defined in keymaps +-- @param keymaps The table of key mappings containing a list per mode (normal_mode, insert_mode, ..) +function M.clear(keymaps) + local default = M.get_defaults() + for mode, mappings in pairs(keymaps) do + local translated_mode = mode_adapters[mode] and mode_adapters[mode] or mode + for key, _ in pairs(mappings) do + -- some plugins may override default bindings that the user hasn't manually overriden + if default[mode][key] ~= nil or (default[translated_mode] ~= nil and default[translated_mode][key] ~= nil) then + pcall(vim.api.nvim_del_keymap, translated_mode, key) + end + end + end +end + -- Set key mappings individually -- @param mode The keymap mode, can be one of the keys of mode_adapters -- @param key The key of keymap @@ -41,7 +59,11 @@ function M.set_keymaps(mode, key, val) opt = val[2] val = val[1] end - vim.api.nvim_set_keymap(mode, key, val, opt) + if val then + vim.api.nvim_set_keymap(mode, key, val, opt) + else + pcall(vim.api.nvim_del_keymap, mode, key) + end end -- Load key mappings for a given mode -- cgit v1.2.3 From 888b1fee214d4102dd0d2b86ef3e74c3a89626cb Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Thu, 11 Nov 2021 22:32:14 -0500 Subject: feat: auto resize for more consistent UI behavior --- lua/lvim/core/nvimtree.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lvim/core/nvimtree.lua b/lua/lvim/core/nvimtree.lua index d9e6fb5d..893ddffc 100644 --- a/lua/lvim/core/nvimtree.lua +++ b/lua/lvim/core/nvimtree.lua @@ -24,7 +24,7 @@ function M.config() view = { width = 30, side = "left", - auto_resize = false, + auto_resize = true, mappings = { custom_only = false, }, -- cgit v1.2.3 From b0a9ee720a64f4ec1563e7358d58506a714d39fe Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sun, 14 Nov 2021 13:44:00 +0100 Subject: refactor: more configurable format-on-save (#1937) --- lua/lvim/config/defaults.lua | 7 +++++- lua/lvim/config/init.lua | 5 ++-- lua/lvim/core/autocmds.lua | 55 ++++++++++++++++++++++++++++++++++++++++++++ lua/lvim/core/commands.lua | 1 + lua/lvim/lsp/init.lua | 2 +- lua/lvim/utils/init.lua | 26 --------------------- 6 files changed, 66 insertions(+), 30 deletions(-) diff --git a/lua/lvim/config/defaults.lua b/lua/lvim/config/defaults.lua index a20e34e1..a5c81a01 100644 --- a/lua/lvim/config/defaults.lua +++ b/lua/lvim/config/defaults.lua @@ -3,7 +3,12 @@ return { colorscheme = "onedarker", line_wrap_cursor_movement = true, transparent_window = false, - format_on_save = true, + format_on_save = { + ---@usage pattern string pattern used for the autocommand (Default: '*') + pattern = "*", + ---@usage timeout number timeout in ms for the format request (Default: 1000) + timeout = 1000, + }, keys = {}, builtin = {}, diff --git a/lua/lvim/config/init.lua b/lua/lvim/config/init.lua index 20bc4c81..8359ff18 100644 --- a/lua/lvim/config/init.lua +++ b/lua/lvim/config/init.lua @@ -20,7 +20,7 @@ end -- Define lvim global variable function M:init() if vim.tbl_isempty(lvim or {}) then - lvim = require "lvim.config.defaults" + lvim = vim.deepcopy(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 } @@ -114,7 +114,8 @@ function M:reload() M:load() local plugins = require "lvim.plugins" - utils.toggle_autoformat() + local autocmds = require "lvim.core.autocmds" + autocmds.configure_format_on_save() local plugin_loader = require "lvim.plugin-loader" plugin_loader.cache_clear() plugin_loader.load { plugins, lvim.plugins } diff --git a/lua/lvim/core/autocmds.lua b/lua/lvim/core/autocmds.lua index 569622be..664c1662 100644 --- a/lua/lvim/core/autocmds.lua +++ b/lua/lvim/core/autocmds.lua @@ -1,4 +1,5 @@ local M = {} +local Log = require "lvim.core.log" --- Load the default set of autogroups and autocommands. function M.load_augroups() @@ -58,6 +59,60 @@ function M.load_augroups() } end +local get_format_on_save_opts = function() + local defaults = require("lvim.config.defaults").format_on_save + -- accept a basic boolean `lvim.format_on_save=true` + if type(lvim.format_on_save) ~= "table" then + return defaults + end + + return { + pattern = lvim.format_on_save.pattern or defaults.pattern, + timeout = lvim.format_on_save.timeout or defaults.timeout, + } +end + +function M.enable_format_on_save(opts) + local fmd_cmd = string.format(":silent lua vim.lsp.buf.formatting_sync({}, %s)", opts.timeout_ms) + M.define_augroups { + format_on_save = { { "BufWritePre", opts.pattern, fmd_cmd } }, + } + Log:debug "enabled format-on-save" +end + +function M.disable_format_on_save() + M.remove_augroup "format_on_save" + Log:debug "disabled format-on-save" +end + +function M.configure_format_on_save() + if lvim.format_on_save then + if vim.fn.exists "#format_on_save#BufWritePre" == 1 then + M.remove_augroup "format_on_save" + Log:debug "reloading format-on-save configuration" + end + local opts = get_format_on_save_opts() + M.enable_format_on_save(opts) + else + M.disable_format_on_save() + end +end + +function M.toggle_format_on_save() + if vim.fn.exists "#format_on_save#BufWritePre" == 0 then + local opts = get_format_on_save_opts() + M.enable_format_on_save(opts) + else + M.disable_format_on_save() + end +end + +function M.remove_augroup(name) + if vim.fn.exists("#" .. name) == 1 then + vim.cmd("au! " .. name) + end +end + function M.define_augroups(definitions) -- {{{1 -- Create autocommand groups based on the passed definitions -- diff --git a/lua/lvim/core/commands.lua b/lua/lvim/core/commands.lua index 61148889..a9dd51c0 100644 --- a/lua/lvim/core/commands.lua +++ b/lua/lvim/core/commands.lua @@ -16,6 +16,7 @@ M.defaults = { [[ command! LvimUpdate lua require('lvim.bootstrap').update() ]], [[ command! LvimSyncCorePlugins lua require('lvim.plugin-loader'):sync_core_plugins() ]], [[ command! LvimReload lua require('lvim.config'):reload() ]], + [[ command! LvimToggleFormatOnSave lua require('lvim.core.autocmds').toggle_format_on_save() ]], } M.load = function(commands) diff --git a/lua/lvim/lsp/init.lua b/lua/lvim/lsp/init.lua index d00f75c6..9764950d 100644 --- a/lua/lvim/lsp/init.lua +++ b/lua/lvim/lsp/init.lua @@ -171,7 +171,7 @@ function M.setup() require("lvim.lsp.null-ls").setup() - require("lvim.utils").toggle_autoformat() + require("lvim.core.autocmds").configure_format_on_save() end return M diff --git a/lua/lvim/utils/init.lua b/lua/lvim/utils/init.lua index cebbe75c..bf04e149 100644 --- a/lua/lvim/utils/init.lua +++ b/lua/lvim/utils/init.lua @@ -1,5 +1,4 @@ local utils = {} -local Log = require "lvim.core.log" local uv = vim.loop -- recursive Print (structure, limit, separator) @@ -58,31 +57,6 @@ function utils.generate_settings() io.close(file) end --- autoformat -function utils.toggle_autoformat() - if lvim.format_on_save then - require("lvim.core.autocmds").define_augroups { - autoformat = { - { - "BufWritePre", - "*", - ":silent lua vim.lsp.buf.formatting_sync()", - }, - }, - } - Log:debug "Format on save active" - end - - if not lvim.format_on_save then - vim.cmd [[ - if exists('#autoformat#BufWritePre') - :autocmd! autoformat - endif - ]] - Log:debug "Format on save off" - end -end - function utils.unrequire(m) package.loaded[m] = nil _G[m] = nil -- cgit v1.2.3 From a9bf545e0fc76882d99a3539f317155ce6c76d35 Mon Sep 17 00:00:00 2001 From: Lee Marlow Date: Sun, 14 Nov 2021 06:00:59 -0700 Subject: Bugfix: allow LunarVim changelog to work outside the lvim directory (#1952) --- lua/lvim/core/telescope/custom-finders.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lua/lvim/core/telescope/custom-finders.lua b/lua/lvim/core/telescope/custom-finders.lua index c3347fd0..68fd0b07 100644 --- a/lua/lvim/core/telescope/custom-finders.lua +++ b/lua/lvim/core/telescope/custom-finders.lua @@ -40,7 +40,7 @@ function M.grep_lunarvim_files(opts) end function M.view_lunarvim_changelog() - local opts = {} + local opts = { cwd = get_lvim_base_dir() } opts.entry_maker = make_entry.gen_from_git_commits(opts) pickers.new(opts, { @@ -52,8 +52,6 @@ function M.view_lunarvim_changelog() "log", "--pretty=oneline", "--abbrev-commit", - "--", - ".", }, opts ), -- cgit v1.2.3 From ffcaae6c32fb10c7716dde2593e30bdf044719db Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Mon, 15 Nov 2021 09:20:45 +0100 Subject: fix: use an indepdent shadafile from neovim (#1910) --- lua/lvim/bootstrap.lua | 4 ++-- lua/lvim/config/settings.lua | 2 ++ lua/lvim/core/log.lua | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lua/lvim/bootstrap.lua b/lua/lvim/bootstrap.lua index 74a9bf45..051f7698 100644 --- a/lua/lvim/bootstrap.lua +++ b/lua/lvim/bootstrap.lua @@ -46,7 +46,7 @@ end function M:init(base_dir) self.runtime_dir = get_runtime_dir() self.config_dir = get_config_dir() - self.cache_path = get_cache_dir() + self.cache_dir = get_cache_dir() self.pack_dir = join_paths(self.runtime_dir, "site", "pack") self.packer_install_dir = join_paths(self.runtime_dir, "site", "pack", "packer", "start", "packer.nvim") self.packer_cache_path = join_paths(self.config_dir, "plugin", "packer_compiled.lua") @@ -80,7 +80,7 @@ function M:init(base_dir) if not os.getenv "LVIM_TEST_ENV" then _G.PLENARY_DEBUG = false require("lvim.impatient").setup { - path = vim.fn.stdpath "cache" .. "/lvim_cache", + path = join_paths(self.cache_dir, "lvim_cache"), enable_profiling = true, } end diff --git a/lua/lvim/config/settings.lua b/lua/lvim/config/settings.lua index 8db43904..048d4058 100644 --- a/lua/lvim/config/settings.lua +++ b/lua/lvim/config/settings.lua @@ -51,6 +51,8 @@ M.load_options = function() vim.opt.shortmess:append "c" + vim.opt.shadafile = utils.join_paths(get_cache_dir(), "lvim.shada") + for k, v in pairs(default_options) do vim.opt[k] = v end diff --git a/lua/lvim/core/log.lua b/lua/lvim/core/log.lua index 9950af28..f51b8af6 100644 --- a/lua/lvim/core/log.lua +++ b/lua/lvim/core/log.lua @@ -1,6 +1,6 @@ local Log = {} -local logfile = string.format("%s/%s.log", vim.fn.stdpath "cache", "lvim") +local logfile = string.format("%s/%s.log", get_cache_dir(), "lvim") Log.levels = { TRACE = 1, -- cgit v1.2.3 From cad6355929d71ae8a34e36f635a59479c6d81b85 Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Tue, 16 Nov 2021 13:35:17 +0330 Subject: fix: packersync issue when you have large number of plugins (#1922) --- lua/lvim/plugin-loader.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lvim/plugin-loader.lua b/lua/lvim/plugin-loader.lua index c4bd7373..ab7613c8 100644 --- a/lua/lvim/plugin-loader.lua +++ b/lua/lvim/plugin-loader.lua @@ -23,6 +23,7 @@ function plugin_loader.init(opts) compile_path = compile_path, log = { level = "warn" }, git = { clone_timeout = 300 }, + max_jobs = 50, display = { open_fn = function() return require("packer.util").float { border = "rounded" } -- cgit v1.2.3 From abc9f2764d3c4500a3c95e162d72e38c7e473f33 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Tue, 16 Nov 2021 14:55:45 +0000 Subject: feat: support new null-ls (#1955) --- lua/lvim/core/info.lua | 1 + lua/lvim/lsp/config.lua | 1 + lua/lvim/lsp/null-ls/formatters.lua | 29 ++++++++++++++++++----------- lua/lvim/lsp/null-ls/init.lua | 2 +- lua/lvim/lsp/null-ls/linters.lua | 24 ++++++++++++++++-------- lua/lvim/lsp/null-ls/services.lua | 14 ++++++-------- lua/lvim/plugins.lua | 7 +++++-- 7 files changed, 48 insertions(+), 30 deletions(-) diff --git a/lua/lvim/core/info.lua b/lua/lvim/core/info.lua index fc87691e..8d33fe5e 100644 --- a/lua/lvim/core/info.lua +++ b/lua/lvim/core/info.lua @@ -20,6 +20,7 @@ end local function make_formatters_info(ft) local null_formatters = require "lvim.lsp.null-ls.formatters" local registered_formatters = null_formatters.list_registered_providers(ft) + -- print("reg", vim.inspect(registered_formatters)) local supported_formatters = null_formatters.list_available(ft) local section = { "Formatters info", diff --git a/lua/lvim/lsp/config.lua b/lua/lvim/lsp/config.lua index ce7ed891..9a2f17df 100644 --- a/lua/lvim/lsp/config.lua +++ b/lua/lvim/lsp/config.lua @@ -40,6 +40,7 @@ return { }, null_ls = { setup = {}, + config = {}, }, override = { "angularls", diff --git a/lua/lvim/lsp/null-ls/formatters.lua b/lua/lvim/lsp/null-ls/formatters.lua index 20939039..96012f21 100644 --- a/lua/lvim/lsp/null-ls/formatters.lua +++ b/lua/lvim/lsp/null-ls/formatters.lua @@ -4,6 +4,8 @@ local null_ls = require "null-ls" local services = require "lvim.lsp.null-ls.services" local Log = require "lvim.core.log" +local is_registered = require("null-ls.sources").is_registered + function M.list_registered_providers(filetype) local null_ls_methods = require "null-ls.methods" local formatter_method = null_ls_methods.internal["FORMATTING"] @@ -30,24 +32,29 @@ function M.list_configured(formatter_configs) local formatters, errors = {}, {} for _, fmt_config in ipairs(formatter_configs) do - local formatter_name = fmt_config.exe:gsub("-", "_") - local formatter = null_ls.builtins.formatting[formatter_name] + local name = fmt_config.exe:gsub("-", "_") + local formatter = null_ls.builtins.formatting[name] if not formatter then Log:error("Not a valid formatter: " .. fmt_config.exe) - errors[fmt_config.exe] = {} -- Add data here when necessary + errors[name] = {} -- Add data here when necessary + elseif is_registered(fmt_config.exe) then + Log:trace "Skipping registering the source more than once" else local formatter_cmd = services.find_command(formatter._opts.command) if not formatter_cmd then Log:warn("Not found: " .. formatter._opts.command) - errors[fmt_config.exe] = {} -- Add data here when necessary + errors[name] = {} -- Add data here when necessary else Log:debug("Using formatter: " .. formatter_cmd) - formatters[fmt_config.exe] = formatter.with { - command = formatter_cmd, - extra_args = fmt_config.args, - filetypes = fmt_config.filetypes, - } + table.insert( + formatters, + formatter.with { + command = formatter_cmd, + extra_args = fmt_config.args, + filetypes = fmt_config.filetypes, + } + ) end end end @@ -60,8 +67,8 @@ function M.setup(formatter_configs) return end - local formatters_by_ft = M.list_configured(formatter_configs) - null_ls.register { sources = formatters_by_ft.supported } + local formatters = M.list_configured(formatter_configs) + null_ls.register { sources = formatters.supported } end return M diff --git a/lua/lvim/lsp/null-ls/init.lua b/lua/lvim/lsp/null-ls/init.lua index 5e8c6b11..f5e820e8 100644 --- a/lua/lvim/lsp/null-ls/init.lua +++ b/lua/lvim/lsp/null-ls/init.lua @@ -9,7 +9,7 @@ function M:setup() return end - null_ls.config() + null_ls.config(lvim.lsp.null_ls.config) local default_opts = require("lvim.lsp").get_common_opts() if vim.tbl_isempty(lvim.lsp.null_ls.setup or {}) then diff --git a/lua/lvim/lsp/null-ls/linters.lua b/lua/lvim/lsp/null-ls/linters.lua index ced4bf34..efc3ffad 100644 --- a/lua/lvim/lsp/null-ls/linters.lua +++ b/lua/lvim/lsp/null-ls/linters.lua @@ -4,6 +4,8 @@ local null_ls = require "null-ls" local services = require "lvim.lsp.null-ls.services" local Log = require "lvim.core.log" +local is_registered = require("null-ls.sources").is_registered + function M.list_registered_providers(filetype) local null_ls_methods = require "null-ls.methods" local linter_method = null_ls_methods.internal["DIAGNOSTICS"] @@ -21,6 +23,7 @@ function M.list_available(filetype) table.insert(linters, provider.name) end end + table.sort(linters) return linters end @@ -29,24 +32,29 @@ function M.list_configured(linter_configs) local linters, errors = {}, {} for _, lnt_config in pairs(linter_configs) do - local linter_name = lnt_config.exe:gsub("-", "_") - local linter = null_ls.builtins.diagnostics[linter_name] + local name = lnt_config.exe:gsub("-", "_") + local linter = null_ls.builtins.diagnostics[name] if not linter then Log:error("Not a valid linter: " .. lnt_config.exe) errors[lnt_config.exe] = {} -- Add data here when necessary + elseif is_registered(lnt_config.exe) then + Log:trace "Skipping registering the source more than once" else local linter_cmd = services.find_command(linter._opts.command) if not linter_cmd then Log:warn("Not found: " .. linter._opts.command) - errors[lnt_config.exe] = {} -- Add data here when necessary + errors[name] = {} -- Add data here when necessary else Log:debug("Using linter: " .. linter_cmd) - linters[lnt_config.exe] = linter.with { - command = linter_cmd, - extra_args = lnt_config.args, - filetypes = lnt_config.filetypes, - } + table.insert( + linters, + linter.with { + command = linter_cmd, + extra_args = lnt_config.args, + filetypes = lnt_config.filetypes, + } + ) end end end diff --git a/lua/lvim/lsp/null-ls/services.lua b/lua/lvim/lsp/null-ls/services.lua index 9cb29f49..9151cc39 100644 --- a/lua/lvim/lsp/null-ls/services.lua +++ b/lua/lvim/lsp/null-ls/services.lua @@ -46,15 +46,13 @@ function M.find_command(command) end function M.list_registered_providers_names(filetype) - local u = require "null-ls.utils" - local c = require "null-ls.config" + local s = require "null-ls.sources" + local available_sources = s.get_available(filetype) local registered = {} - for method, source in pairs(c.get()._methods) do - for name, filetypes in pairs(source) do - if u.filetype_matches(filetypes, filetype) then - registered[method] = registered[method] or {} - table.insert(registered[method], name) - end + for _, source in ipairs(available_sources) do + for method in pairs(source.methods) do + registered[method] = registered[method] or {} + table.insert(registered[method], source.name) end end return registered diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 77ed1ebf..8af96e6e 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -2,7 +2,7 @@ local commit = { packer = "7f62848f3a92eac61ae61def5f59ddb5e2cc6823", lsp_config = "903a1fbca91b74e6fbc905366ce38364b9d7ba98", nlsp_settings = "29f49afe27b43126d45a05baf3161a28b929f2f1", - null_ls = "3bf64acca268f3d7e0455501b82cf3f02f38c292", + null_ls = "cf2bc3185af066cb25f1bf6faa99727e2c47ef77", fix_cursor_hold = "0e4e22d21975da60b0fd2d302285b3b603f9f71e", lsp_installer = "37d9326f4ca4093b04eabdb697fec3764e226f88", nvim_notify = "ee79a5e2f8bde0ebdf99880a98d1312da83a3caa", @@ -40,7 +40,10 @@ return { { "wbthomason/packer.nvim", commit = commit.packer }, { "neovim/nvim-lspconfig", commit = commit.lsp_config }, { "tamago324/nlsp-settings.nvim", commit = commit.nlsp_settings }, - { "jose-elias-alvarez/null-ls.nvim", commit = commit.null_ls }, + { + "jose-elias-alvarez/null-ls.nvim", + commit = commit.null_ls, + }, { "antoinemadec/FixCursorHold.nvim", commit = commit.fix_cursor_hold }, -- Needed while issue https://github.com/neovim/neovim/issues/12587 is still open { "williamboman/nvim-lsp-installer", -- cgit v1.2.3 From b3538b63ce7626f269455881c7d659926ad4ee85 Mon Sep 17 00:00:00 2001 From: Xavier Young <45989017+younger-1@users.noreply.github.com> Date: Wed, 17 Nov 2021 01:49:27 +0800 Subject: fix(lualine): change `fg` of section `a` in onedarker (#1909) --- lua/lualine/themes/onedarker.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/lualine/themes/onedarker.lua b/lua/lualine/themes/onedarker.lua index 396657bb..85904eeb 100644 --- a/lua/lualine/themes/onedarker.lua +++ b/lua/lualine/themes/onedarker.lua @@ -19,14 +19,14 @@ local colors = { -- LuaFormatter on return { normal = { - a = { fg = colors.fg, bg = colors.blue, gui = "bold" }, + a = { fg = colors.gray2, bg = colors.blue, gui = "bold" }, b = { fg = colors.fg, bg = colors.bg }, c = { fg = colors.fg, bg = colors.bg }, }, - insert = { a = { fg = colors.fg, bg = colors.green, gui = "bold" } }, - visual = { a = { fg = colors.fg, bg = colors.purple, gui = "bold" } }, - command = { a = { fg = colors.fg, bg = colors.yellow, gui = "bold" } }, - replace = { a = { fg = colors.fg, bg = colors.red1, gui = "bold" } }, + insert = { a = { fg = colors.gray2, bg = colors.green, gui = "bold" } }, + visual = { a = { fg = colors.gray2, bg = colors.purple, gui = "bold" } }, + command = { a = { fg = colors.gray2, bg = colors.yellow, gui = "bold" } }, + replace = { a = { fg = colors.gray2, bg = colors.red1, gui = "bold" } }, inactive = { a = { fg = colors.gray1, bg = colors.bg, gui = "bold" }, b = { fg = colors.gray1, bg = colors.bg }, -- cgit v1.2.3 From da7ff0a87aec87592a9ef2905eea60fddcf2d2fb Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Tue, 16 Nov 2021 13:55:57 -0500 Subject: feat: Empty for empty buffers instead of Buffer <#> --- lua/lvim/core/bufferline.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lvim/core/bufferline.lua b/lua/lvim/core/bufferline.lua index ae6542d1..74d84af4 100644 --- a/lua/lvim/core/bufferline.lua +++ b/lua/lvim/core/bufferline.lua @@ -1,6 +1,7 @@ local M = {} M.config = function() + vim.g.bufferline = { no_name_title = "Empty" } lvim.builtin.bufferline = { active = true, on_config_done = nil, -- cgit v1.2.3 From 5a310a29cfa24e82c4b0925c1877ecc6a4f628d4 Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Tue, 16 Nov 2021 17:33:43 -0500 Subject: fix: no idea why this breaks barbar --- lua/lvim/core/bufferline.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/lvim/core/bufferline.lua b/lua/lvim/core/bufferline.lua index 74d84af4..ae6542d1 100644 --- a/lua/lvim/core/bufferline.lua +++ b/lua/lvim/core/bufferline.lua @@ -1,7 +1,6 @@ local M = {} M.config = function() - vim.g.bufferline = { no_name_title = "Empty" } lvim.builtin.bufferline = { active = true, on_config_done = nil, -- cgit v1.2.3 From 16fd37c8bf5d9f352ea16ad18d3ca327977e205a Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Thu, 18 Nov 2021 02:56:48 -0500 Subject: fix: lsp root can get very annoying when working with multiple languages. User is still able to turn it on. --- lua/lvim/core/project.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/lvim/core/project.lua b/lua/lvim/core/project.lua index e7527440..485137b7 100644 --- a/lua/lvim/core/project.lua +++ b/lua/lvim/core/project.lua @@ -18,7 +18,8 @@ function M.config() --- **"pattern"** uses vim-rooter like glob pattern matching. Here --- order matters: if one is not detected, the other is used as fallback. You --- can also delete or rearangne the detection methods. - detection_methods = { "lsp", "pattern" }, + -- detection_methods = { "lsp", "pattern" }, -- NOTE: lsp detection will get annoying with multiple langs in one project + detection_methods = { "pattern" }, ---@usage patterns used to detect root dir, when **"pattern"** is in detection_methods patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json" }, -- cgit v1.2.3 From c26ac5364f2bb04b7428105db39c12c6549d5dfb Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Thu, 18 Nov 2021 16:04:34 +0100 Subject: refactor: load the default keymaps once (#1965) --- lua/lvim/config/init.lua | 6 +- lua/lvim/core/bufferline.lua | 8 +- lua/lvim/core/dashboard.lua | 3 +- lua/lvim/core/nvimtree.lua | 3 +- lua/lvim/core/which-key.lua | 2 +- lua/lvim/keymappings.lua | 218 +++++++++++++++++++++---------------------- 6 files changed, 114 insertions(+), 126 deletions(-) diff --git a/lua/lvim/config/init.lua b/lua/lvim/config/init.lua index 8359ff18..a3c5af24 100644 --- a/lua/lvim/config/init.lua +++ b/lua/lvim/config/init.lua @@ -26,7 +26,7 @@ function M:init() lvim.database = { save_location = utils.join_paths(home_dir, ".config", "lunarvim_db"), auto_execute = 1 } end - lvim.keys = apply_defaults(lvim.keys, require("lvim.keymappings").get_defaults()) + require("lvim.keymappings").load_defaults() local builtins = require "lvim.core.builtins" builtins.config { user_config_file = user_config_file } @@ -89,8 +89,6 @@ function M:load(config_path) vim.g.mapleader = (lvim.leader == "space" and " ") or lvim.leader - local default_keymaps = require("lvim.keymappings").get_defaults() - lvim.keys = apply_defaults(lvim.keys, default_keymaps) require("lvim.keymappings").load(lvim.keys) local settings = require "lvim.config.settings" @@ -100,8 +98,6 @@ end --- Override the configuration with a user provided one -- @param config_path The path to the configuration overrides function M:reload() - require("lvim.keymappings").clear(lvim.keys) - local lvim_modules = {} for module, _ in pairs(package.loaded) do if module:match "lvim.core" then diff --git a/lua/lvim/core/bufferline.lua b/lua/lvim/core/bufferline.lua index ae6542d1..4f7493d6 100644 --- a/lua/lvim/core/bufferline.lua +++ b/lua/lvim/core/bufferline.lua @@ -5,17 +5,13 @@ M.config = function() active = true, on_config_done = nil, keymap = { - normal_mode = { - [""] = ":BufferNext", - [""] = ":BufferPrevious", - }, + normal_mode = {}, }, } end M.setup = function() - local keymap = require "lvim.keymappings" - keymap.append_to_defaults(lvim.builtin.bufferline.keymap) + require("lvim.keymappings").load(lvim.builtin.bufferline.keymap) if lvim.builtin.bufferline.on_config_done then lvim.builtin.bufferline.on_config_done() diff --git a/lua/lvim/core/dashboard.lua b/lua/lvim/core/dashboard.lua index 11053796..22e5c9b6 100644 --- a/lua/lvim/core/dashboard.lua +++ b/lua/lvim/core/dashboard.lua @@ -58,6 +58,7 @@ M.config = function(config) footer = { "lunarvim.org" }, } + lvim.builtin.which_key.mappings[";"] = { "Dashboard", "Dashboard" } end M.setup = function() @@ -69,8 +70,6 @@ M.setup = function() vim.g.dashboard_custom_section = lvim.builtin.dashboard.custom_section - lvim.builtin.which_key.mappings[";"] = { "Dashboard", "Dashboard" } - vim.g.dashboard_session_directory = lvim.builtin.dashboard.session_directory local lvim_site = "lunarvim.org" diff --git a/lua/lvim/core/nvimtree.lua b/lua/lvim/core/nvimtree.lua index 893ddffc..08a73cdb 100644 --- a/lua/lvim/core/nvimtree.lua +++ b/lua/lvim/core/nvimtree.lua @@ -65,6 +65,7 @@ function M.config() }, }, } + lvim.builtin.which_key.mappings["e"] = { "NvimTreeToggle", "Explorer" } end function M.setup() @@ -98,8 +99,6 @@ function M.setup() } end - lvim.builtin.which_key.mappings["e"] = { "NvimTreeToggle", "Explorer" } - local tree_view = require "nvim-tree.view" -- Add nvim_tree open callback diff --git a/lua/lvim/core/which-key.lua b/lua/lvim/core/which-key.lua index 254f2ec2..7bb0f00e 100644 --- a/lua/lvim/core/which-key.lua +++ b/lua/lvim/core/which-key.lua @@ -188,7 +188,7 @@ M.config = function() "lua require('lvim.core.telescope.custom-finders').grep_lunarvim_files()", "Grep LunarVim files", }, - k = { "lua require('lvim.keymappings').print()", "View LunarVim's default keymappings" }, + k = { "Telescope keymaps", "View LunarVim's keymappings" }, i = { "lua require('lvim.core.info').toggle_popup(vim.bo.filetype)", "Toggle LunarVim Info", diff --git a/lua/lvim/keymappings.lua b/lua/lvim/keymappings.lua index b05d1754..d0763ca1 100644 --- a/lua/lvim/keymappings.lua +++ b/lua/lvim/keymappings.lua @@ -21,15 +21,107 @@ local mode_adapters = { command_mode = "c", } +local defaults = { + ---@usage change or add keymappings for insert mode + insert_mode = { + -- 'jk' for quitting insert mode + ["jk"] = "", + -- 'kj' for quitting insert mode + ["kj"] = "", + -- 'jj' for quitting insert mode + ["jj"] = "", + -- Move current line / block with Alt-j/k ala vscode. + [""] = ":m .+1==gi", + -- Move current line / block with Alt-j/k ala vscode. + [""] = ":m .-2==gi", + -- navigation + [""] = "k", + [""] = "j", + [""] = "h", + [""] = "l", + }, + + ---@usage change or add keymappings for normal mode + normal_mode = { + -- Better window movement + [""] = "h", + [""] = "j", + [""] = "k", + [""] = "l", + + -- Resize with arrows + [""] = ":resize -2", + [""] = ":resize +2", + [""] = ":vertical resize -2", + [""] = ":vertical resize +2", + + -- Tab switch buffer + [""] = ":BufferNext", + [""] = ":BufferPrevious", + + -- Move current line / block with Alt-j/k a la vscode. + [""] = ":m .+1==", + [""] = ":m .-2==", + + -- QuickFix + ["]q"] = ":cnext", + ["[q"] = ":cprev", + [""] = ":call QuickFixToggle()", + }, + + ---@usage change or add keymappings for terminal mode + term_mode = { + -- Terminal window navigation + [""] = "h", + [""] = "j", + [""] = "k", + [""] = "l", + }, + + ---@usage change or add keymappings for visual mode + visual_mode = { + -- Better indenting + ["<"] = ""] = ">gv", + + -- ["p"] = '"0p', + -- ["P"] = '"0P', + }, + + ---@usage change or add keymappings for visual block mode + visual_block_mode = { + -- Move selected line / block of text in visual mode + ["K"] = ":move '<-2gv-gv", + ["J"] = ":move '>+1gv-gv", + + -- Move current line / block with Alt-j/k ala vscode. + [""] = ":m '>+1gv-gv", + [""] = ":m '<-2gv-gv", + }, + + ---@usage change or add keymappings for command mode + command_mode = { + -- navigate tab completion with and + -- runs conditionally + [""] = { 'pumvisible() ? "\\" : "\\"', { expr = true, noremap = true } }, + [""] = { 'pumvisible() ? "\\" : "\\"', { expr = true, noremap = true } }, + }, +} + +if vim.fn.has "mac" == 1 then + defaults.normal_mode[""] = defaults.normal_mode[""] + defaults.normal_mode[""] = defaults.normal_mode[""] + defaults.normal_mode[""] = defaults.normal_mode[""] + defaults.normal_mode[""] = defaults.normal_mode[""] + Log:debug "Activated mac keymappings" +end + -- Append key mappings to lunarvim's defaults for a given mode -- @param keymaps The table of key mappings containing a list per mode (normal_mode, insert_mode, ..) function M.append_to_defaults(keymaps) - local default = M.get_defaults() - lvim.keys = lvim.keys or default for mode, mappings in pairs(keymaps) do - lvim.keys[mode] = lvim.keys[mode] or default[mode] for k, v in pairs(mappings) do - lvim.keys[mode][k] = v + defaults[mode][k] = v end end end @@ -39,7 +131,7 @@ end function M.clear(keymaps) local default = M.get_defaults() for mode, mappings in pairs(keymaps) do - local translated_mode = mode_adapters[mode] and mode_adapters[mode] or mode + local translated_mode = mode_adapters[mode] or mode for key, _ in pairs(mappings) do -- some plugins may override default bindings that the user hasn't manually overriden if default[mode][key] ~= nil or (default[translated_mode] ~= nil and default[translated_mode][key] ~= nil) then @@ -54,7 +146,7 @@ end -- @param key The key of keymap -- @param val Can be form as a mapping or tuple of mapping and user defined opt function M.set_keymaps(mode, key, val) - local opt = generic_opts[mode] and generic_opts[mode] or generic_opts_any + local opt = generic_opts[mode] or generic_opts_any if type(val) == "table" then opt = val[2] val = val[1] @@ -70,7 +162,7 @@ end -- @param mode The keymap mode, can be one of the keys of mode_adapters -- @param keymaps The list of key mappings function M.load_mode(mode, keymaps) - mode = mode_adapters[mode] and mode_adapters[mode] or mode + mode = mode_adapters[mode] or mode for k, v in pairs(keymaps) do M.set_keymaps(mode, k, v) end @@ -85,112 +177,18 @@ function M.load(keymaps) end end -function M.get_defaults() - local keys = { - ---@usage change or add keymappings for insert mode - insert_mode = { - -- 'jk' for quitting insert mode - ["jk"] = "", - -- 'kj' for quitting insert mode - ["kj"] = "", - -- 'jj' for quitting insert mode - ["jj"] = "", - -- Move current line / block with Alt-j/k ala vscode. - [""] = ":m .+1==gi", - -- Move current line / block with Alt-j/k ala vscode. - [""] = ":m .-2==gi", - -- navigation - [""] = "k", - [""] = "j", - [""] = "h", - [""] = "l", - }, - - ---@usage change or add keymappings for normal mode - normal_mode = { - -- Better window movement - [""] = "h", - [""] = "j", - [""] = "k", - [""] = "l", - - -- Resize with arrows - [""] = ":resize -2", - [""] = ":resize +2", - [""] = ":vertical resize -2", - [""] = ":vertical resize +2", - - -- Tab switch buffer - [""] = ":BufferNext", - [""] = ":BufferPrevious", - - -- Move current line / block with Alt-j/k a la vscode. - [""] = ":m .+1==", - [""] = ":m .-2==", - - -- QuickFix - ["]q"] = ":cnext", - ["[q"] = ":cprev", - [""] = ":call QuickFixToggle()", - }, - - ---@usage change or add keymappings for terminal mode - term_mode = { - -- Terminal window navigation - [""] = "h", - [""] = "j", - [""] = "k", - [""] = "l", - }, - - ---@usage change or add keymappings for visual mode - visual_mode = { - -- Better indenting - ["<"] = ""] = ">gv", - - -- ["p"] = '"0p', - -- ["P"] = '"0P', - }, - - ---@usage change or add keymappings for visual block mode - visual_block_mode = { - -- Move selected line / block of text in visual mode - ["K"] = ":move '<-2gv-gv", - ["J"] = ":move '>+1gv-gv", - - -- Move current line / block with Alt-j/k ala vscode. - [""] = ":m '>+1gv-gv", - [""] = ":m '<-2gv-gv", - }, - - ---@usage change or add keymappings for command mode - command_mode = { - -- navigate tab completion with and - -- runs conditionally - [""] = { 'pumvisible() ? "\\" : "\\"', { expr = true, noremap = true } }, - [""] = { 'pumvisible() ? "\\" : "\\"', { expr = true, noremap = true } }, - }, - } - - if vim.fn.has "mac" == 1 then - keys.normal_mode[""] = keys.normal_mode[""] - keys.normal_mode[""] = keys.normal_mode[""] - keys.normal_mode[""] = keys.normal_mode[""] - keys.normal_mode[""] = keys.normal_mode[""] - Log:debug "Activated mac keymappings" +-- Load the default keymappings +function M.load_defaults() + M.load(M.get_defaults()) + lvim.keys = {} + for idx, _ in pairs(defaults) do + lvim.keys[idx] = {} end - - return keys end -function M.print(mode) - print "List of LunarVim's default keymappings (not including which-key)" - if mode then - print(vim.inspect(lvim.keys[mode])) - else - print(vim.inspect(lvim.keys)) - end +-- Get the default keymappings +function M.get_defaults() + return defaults end return M -- cgit v1.2.3 From d046b43acb1247bebf3ef38367ff3372f5169d5e Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Thu, 18 Nov 2021 23:01:09 -0500 Subject: fix: update jdtls script --- utils/bin/jdtls | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/bin/jdtls b/utils/bin/jdtls index adfd5e20..a8821580 100755 --- a/utils/bin/jdtls +++ b/utils/bin/jdtls @@ -9,10 +9,10 @@ case Darwin in Linux) - CONFIG="$HOME/.local/share/nvim/lspinstall/java/config_linux" + CONFIG="$HOME/.local/share/nvim/lsp_servers/jdtls/config_linux" ;; Darwin) - CONFIG="$HOME/.local/share/nvim/lspinstall/java/config_mac" + CONFIG="$HOME/.local/share/nvim/lsp_servers/jdtls/config_mac" ;; esac @@ -39,14 +39,14 @@ location of your Java installation." 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" +JAR="$HOME/.local/share/nvim/lsp_servers/jdtls/plugins/org.eclipse.equinox.launcher_*.jar" 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/lsp_servers/jdtls/lombok.jar \ -Xms1g \ -Xmx2G \ -jar $(echo "$JAR") \ -- cgit v1.2.3 From fe99ee6e42ddec225c46a9d1fcda5c5d76396601 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Fri, 19 Nov 2021 08:20:49 +0100 Subject: fix(windows): autocmd requires forward slashes (#1967) --- lua/lvim/core/autocmds.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/lvim/core/autocmds.lua b/lua/lvim/core/autocmds.lua index 664c1662..d982b151 100644 --- a/lua/lvim/core/autocmds.lua +++ b/lua/lvim/core/autocmds.lua @@ -3,7 +3,12 @@ local Log = require "lvim.core.log" --- Load the default set of autogroups and autocommands. function M.load_augroups() - local user_config_file = vim.fn.resolve(require("lvim.config"):get_user_config_path()) + local user_config_file = require("lvim.config"):get_user_config_path() + + if vim.loop.os_uname().version:match "Windows" then + -- autocmds require forward slashes even on windows + user_config_file = vim.fn.resolve(user_config_file:gsub("\\", "/")) + end return { _general_settings = { -- cgit v1.2.3 From 5663c925ebef0d48732e8794c2335c118ee61e55 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sat, 20 Nov 2021 14:22:04 +0100 Subject: fix(windows): remove redundant `resolve` call (#1974) --- lua/lvim/core/autocmds.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lvim/core/autocmds.lua b/lua/lvim/core/autocmds.lua index d982b151..e4577e63 100644 --- a/lua/lvim/core/autocmds.lua +++ b/lua/lvim/core/autocmds.lua @@ -7,7 +7,7 @@ function M.load_augroups() if vim.loop.os_uname().version:match "Windows" then -- autocmds require forward slashes even on windows - user_config_file = vim.fn.resolve(user_config_file:gsub("\\", "/")) + user_config_file = user_config_file:gsub("\\", "/") end return { -- cgit v1.2.3 From 109c766809760f7a9aba5dfb467d8299d2996de0 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sun, 21 Nov 2021 12:29:07 +0100 Subject: fix(null-ls): allow the same linter and formatter (#1968) --- lua/lvim/lsp/null-ls/formatters.lua | 8 +++++++- lua/lvim/lsp/null-ls/linters.lua | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lua/lvim/lsp/null-ls/formatters.lua b/lua/lvim/lsp/null-ls/formatters.lua index 96012f21..b2e191c5 100644 --- a/lua/lvim/lsp/null-ls/formatters.lua +++ b/lua/lvim/lsp/null-ls/formatters.lua @@ -4,7 +4,13 @@ local null_ls = require "null-ls" local services = require "lvim.lsp.null-ls.services" local Log = require "lvim.core.log" -local is_registered = require("null-ls.sources").is_registered +local is_registered = function(name) + local query = { + name = name, + method = require("null-ls").methods.FORMATTING, + } + return require("null-ls.sources").is_registered(query) +end function M.list_registered_providers(filetype) local null_ls_methods = require "null-ls.methods" diff --git a/lua/lvim/lsp/null-ls/linters.lua b/lua/lvim/lsp/null-ls/linters.lua index efc3ffad..6a793d26 100644 --- a/lua/lvim/lsp/null-ls/linters.lua +++ b/lua/lvim/lsp/null-ls/linters.lua @@ -4,7 +4,13 @@ local null_ls = require "null-ls" local services = require "lvim.lsp.null-ls.services" local Log = require "lvim.core.log" -local is_registered = require("null-ls.sources").is_registered +local is_registered = function(name) + local query = { + name = name, + method = require("null-ls").methods.DIAGNOSTICS, + } + return require("null-ls.sources").is_registered(query) +end function M.list_registered_providers(filetype) local null_ls_methods = require "null-ls.methods" -- cgit v1.2.3 From 07bcae45fd54ef9b8c2e663dd414b3384435ebe9 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Mon, 22 Nov 2021 08:32:40 +0100 Subject: fix(lsp): avoid installing an overridden server (#1981) --- lua/lvim/lsp/manager.lua | 50 +++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/lua/lvim/lsp/manager.lua b/lua/lvim/lsp/manager.lua index dbb7b87f..ca4dc285 100644 --- a/lua/lvim/lsp/manager.lua +++ b/lua/lvim/lsp/manager.lua @@ -54,39 +54,41 @@ function M.setup(server_name, user_config) if lvim_lsp_utils.is_client_active(server_name) then return end - local servers = require "nvim-lsp-installer.servers" local config = resolve_config(server_name, user_config) + + local servers = require "nvim-lsp-installer.servers" local server_available, requested_server = servers.get_server(server_name) - if server_available then - local install_notification = false - - if not requested_server:is_installed() then - if lvim.lsp.automatic_servers_installation then - Log:debug "Automatic server installation detected" - requested_server:install() - install_notification = true - else - Log:debug(requested_server.name .. " is not managed by the automatic installer") - end - end + local is_overridden = vim.tbl_contains(lvim.lsp.override, server_name) - requested_server:on_ready(function() - if install_notification then - vim.notify(string.format("Installation complete for [%s] server", requested_server.name), vim.log.levels.INFO) - end - install_notification = false - requested_server:setup(config) - end) - else - -- since it may not be installed, don't attempt to configure the LSP unless there is a custom provider - local has_custom_provider, _ = pcall(require, "lvim/lsp/providers/" .. server_name) - if has_custom_provider then + if not server_available or is_overridden then + pcall(function() require("lspconfig")[server_name].setup(config) buf_try_add(server_name) + end) + return + end + + local install_notification = false + + if not requested_server:is_installed() then + if lvim.lsp.automatic_servers_installation then + Log:debug "Automatic server installation detected" + requested_server:install() + install_notification = true + else + Log:debug(requested_server.name .. " is not managed by the automatic installer") end end + + requested_server:on_ready(function() + if install_notification then + vim.notify(string.format("Installation complete for [%s] server", requested_server.name), vim.log.levels.INFO) + end + install_notification = false + requested_server:setup(config) + end) end return M -- cgit v1.2.3 From f3d7a94d8cb85a7c03eace8576ad7f9125147384 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Mon, 22 Nov 2021 15:14:18 -0500 Subject: feat: improved LSP grouping in lualine --- lua/lvim/core/lualine/components.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/lvim/core/lualine/components.lua b/lua/lvim/core/lualine/components.lua index 9366df56..c0482c02 100644 --- a/lua/lvim/core/lualine/components.lua +++ b/lua/lvim/core/lualine/components.lua @@ -112,9 +112,9 @@ return { local supported_linters = linters.list_registered_providers(buf_ft) vim.list_extend(buf_client_names, supported_linters) - return table.concat(buf_client_names, ", ") + return "[" .. table.concat(buf_client_names, ", ") .. "]" end, - icon = " ", + -- icon = " ", color = { gui = "bold" }, cond = conditions.hide_in_width, }, -- cgit v1.2.3 From 044b53a6fed7ed2c477870883857a9742a2e1b98 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Mon, 22 Nov 2021 15:16:05 -0500 Subject: feat: decrease hide in width limit for lualine --- lua/lvim/core/lualine/conditions.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lvim/core/lualine/conditions.lua b/lua/lvim/core/lualine/conditions.lua index 3ee4fbb8..6e120b26 100644 --- a/lua/lvim/core/lualine/conditions.lua +++ b/lua/lvim/core/lualine/conditions.lua @@ -1,4 +1,4 @@ -local window_width_limit = 80 +local window_width_limit = 70 local conditions = { buffer_not_empty = function() -- cgit v1.2.3 From 24be0ef1ef36b8cc725655e920104e9676b72f25 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sat, 27 Nov 2021 15:22:43 +0100 Subject: chore: bump core-plugins version (#1989) --- lua/lvim/core/nvimtree.lua | 4 +-- lua/lvim/plugin-loader.lua | 17 +++++++++-- lua/lvim/plugins.lua | 76 +++++++++++++++++++++++----------------------- lua/lvim/utils/init.lua | 32 +++++++++++++++++-- utils/installer/install.sh | 19 ++---------- 5 files changed, 86 insertions(+), 62 deletions(-) diff --git a/lua/lvim/core/nvimtree.lua b/lua/lvim/core/nvimtree.lua index 08a73cdb..1fc93aea 100644 --- a/lua/lvim/core/nvimtree.lua +++ b/lua/lvim/core/nvimtree.lua @@ -29,6 +29,8 @@ function M.config() custom_only = false, }, }, + hide_dotfiles = false, + ignore = { ".git", "node_modules", ".cache" }, }, show_icons = { git = 1, @@ -37,9 +39,7 @@ function M.config() folder_arrows = 1, tree_width = 30, }, - ignore = { ".git", "node_modules", ".cache" }, quit_on_open = 0, - hide_dotfiles = 1, git_hl = 1, root_folder_modifier = ":t", allow_resize = 1, diff --git a/lua/lvim/plugin-loader.lua b/lua/lvim/plugin-loader.lua index ab7613c8..1ad4266b 100644 --- a/lua/lvim/plugin-loader.lua +++ b/lua/lvim/plugin-loader.lua @@ -1,12 +1,12 @@ local plugin_loader = {} +local in_headless = #vim.api.nvim_list_uis() == 0 + 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" -local _, packer = pcall(require, "packer") - function plugin_loader.init(opts) opts = opts or {} @@ -18,10 +18,16 @@ function plugin_loader.init(opts) vim.cmd "packadd packer.nvim" end + local log_level = in_headless and "debug" or "warn" + if lvim.log and lvim.log.level then + log_level = lvim.log.level + end + + local _, packer = pcall(require, "packer") packer.init { package_root = package_root, compile_path = compile_path, - log = { level = "warn" }, + log = { level = log_level }, git = { clone_timeout = 300 }, max_jobs = 50, display = { @@ -59,6 +65,11 @@ end function plugin_loader.load(configurations) Log:debug "loading plugins configuration" + local packer_available, packer = pcall(require, "packer") + if not packer_available then + Log:warn "skipping loading plugins until Packer is installed" + return + end local status_ok, _ = xpcall(function() packer.startup(function(use) for _, plugins in ipairs(configurations) do diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 8af96e6e..6a131390 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -1,53 +1,53 @@ local commit = { - packer = "7f62848f3a92eac61ae61def5f59ddb5e2cc6823", - lsp_config = "903a1fbca91b74e6fbc905366ce38364b9d7ba98", - nlsp_settings = "29f49afe27b43126d45a05baf3161a28b929f2f1", - null_ls = "cf2bc3185af066cb25f1bf6faa99727e2c47ef77", - fix_cursor_hold = "0e4e22d21975da60b0fd2d302285b3b603f9f71e", - lsp_installer = "37d9326f4ca4093b04eabdb697fec3764e226f88", - nvim_notify = "ee79a5e2f8bde0ebdf99880a98d1312da83a3caa", - structlog = "6f1403a192791ff1fa7ac845a73de9e860f781f1", - popup = "f91d80973f80025d4ed00380f2e06c669dfda49d", - plenary = "96e821e8001c21bc904d3c15aa96a70c11462c5f", - telescope = "078a48db9e0720b07bfcb8b59342c5305a1d1fdc", - telescope_fzf_native = "59e38e1661ffdd586cb7fc22ca0b5a05c7caf988", - nvim_cmp = "ca6386854982199a532150cf3bd711395475ebd2", - friendly_snippets = "94f1d917435c71bc6494d257afa90d4c9449aed2", - autopairs = "f858ab38b532715dbaf7b2773727f8622ba04322", - treesitter = "47cfda2c6711077625c90902d7722238a8294982", - context_commentstring = "159c5b9a2cdb8a8fe342078b7ac8139de76bad62", - nvim_tree = "f92b7e7627c5a36f4af6814c408211539882c4f3", - gitsigns = "61a81b0c003de3e12555a5626d66fb6a060d8aca", - which_key = "d3032b6d3e0adb667975170f626cb693bfc66baa", - comment = "620445b87a0d1640fac6991f9c3338af8dec1884", - project = "3a1f75b18f214064515ffba48d1eb7403364cc6a", - nvim_web_devicons = "ee101462d127ed6a5561ce9ce92bfded87d7d478", - lualine = "3f5cdc51a08c437c7705e283eebd4cf9fbb18f80", barbar = "6e638309efcad2f308eb9c5eaccf6f62b794bbab", - dap = "dd778f65dc95323f781f291fb7c5bf3c17d057b1", - dap_install = "dd09e9dd3a6e29f02ac171515b8a089fb82bb425", - toggleterm = "5f9ba91157a25be5ee7395fbc11b1a8f25938365", - luasnip = "bab7cc2c32fba00776d2f2fc4704bed4eee2d082", + cmp_buffer = "a706dc69c49110038fe570e5c9c33d6d4f67015b", cmp_luasnip = "16832bb50e760223a403ffa3042859845dd9ef9d", - cmp_buffer = "d1ca295ce584ec80763a6dc043080874b57ccffc", - cmp_nvim_lsp = "accbe6d97548d8d3471c04d512d36fa61d0e4be8", - cmp_path = "97661b00232a2fe145fe48e295875bc3299ed1f7", + cmp_nvim_lsp = "134117299ff9e34adde30a735cd8ca9cf8f3db81", cmp_nvim_lua = "d276254e7198ab7d00f117e88e223b4bd8c02d21", + cmp_path = "81518cf6ae29f5f0c79cd47770ae90ff5225ee13", + comment = "a6e1c127fa7f19ec4e3edbffab1aacb2852b6db3", + dapinstall = "dd09e9dd3a6e29f02ac171515b8a089fb82bb425", + fixcursorhold = "0e4e22d21975da60b0fd2d302285b3b603f9f71e", + friendly_snippets = "0806607c4c49b6823cf4155cf0c30bc28934dea2", + gitsigns = "95845ef39ce0a98f68cdfdcf7dd586c5e965acc7", + lualine = "cf75e1af5a1cafaa0866cf8a11632f48b430115d", + luasnip = "f400b978b1dbca96e9e190b7009c415c09b8924c", + nlsp_settings = "1e75ac7733f6492b501a7594870cf75c4ee23e81", + null_ls = "b07ce47f02c7b12ad65bfb4da215c6380228a959", + nvim_autopairs = "fba2503bd8cd0d8861054523aae39c4ac0680c07", + nvim_cmp = "ca6386854982199a532150cf3bd711395475ebd2", + nvim_dap = "4e8bb7ca12dc8ca6f7a500cbb4ecea185665c7f1", + nvim_lsp_installer = "52183c68baf9019c8241b1abf33ba0b6594ab3c8", + nvim_lspconfig = "b53f89c16bcc8052aa56d3a903fcad3aaa774041", + nvim_notify = "54375b724637eb6f29085c582318ae1fd042e717", + nvim_tree = "5d8453dfbd34ab00cb3e8ce39660f9a54cdd35f3", + nvim_treesitter = "47cfda2c6711077625c90902d7722238a8294982", + nvim_ts_context_commentstring = "9f5e422e1030e7073e593ad32c5354aa0bcb0176", + nvim_web_devicons = "8df4988ecf8599fc1f8f387bbf2eae790e4c5ffb", + packer = "7f62848f3a92eac61ae61def5f59ddb5e2cc6823", + plenary = "1c31adb35fcebe921f65e5c6ff6d5481fa5fa5ac", + popup = "b7404d35d5d3548a82149238289fa71f7f6de4ac", + project = "71d0e23dcfc43cfd6bb2a97dc5a7de1ab47a6538", + structlog = "6f1403a192791ff1fa7ac845a73de9e860f781f1", + telescope = "b415e862bf248d66c40e242de4a0c76c68e278f1", + telescope_fzf_native = "b8662b076175e75e6497c59f3e2799b879d7b954", + toggleterm = "265bbff68fbb8b2a5fb011272ec469850254ec9f", + which_key = "d3032b6d3e0adb667975170f626cb693bfc66baa", } return { -- Packer can manage itself as an optional plugin { "wbthomason/packer.nvim", commit = commit.packer }, - { "neovim/nvim-lspconfig", commit = commit.lsp_config }, + { "neovim/nvim-lspconfig", commit = commit.nvim_lspconfig }, { "tamago324/nlsp-settings.nvim", commit = commit.nlsp_settings }, { "jose-elias-alvarez/null-ls.nvim", commit = commit.null_ls, }, - { "antoinemadec/FixCursorHold.nvim", commit = commit.fix_cursor_hold }, -- Needed while issue https://github.com/neovim/neovim/issues/12587 is still open + { "antoinemadec/FixCursorHold.nvim", commit = commit.fixcursorhold }, -- Needed while issue https://github.com/neovim/neovim/issues/12587 is still open { "williamboman/nvim-lsp-installer", - commit = commit.lsp_installer, + commit = commit.nvim_lsp_installer, }, { "rcarriga/nvim-notify", @@ -121,7 +121,7 @@ return { -- Autopairs { "windwp/nvim-autopairs", - commit = commit.autopairs, + commit = commit.nvim_autopairs, -- event = "InsertEnter", config = function() require("lvim.core.autopairs").setup() @@ -141,7 +141,7 @@ return { }, { "JoosepAlviste/nvim-ts-context-commentstring", - commit = commit.context_commentstring, + commit = commit.nvim_ts_context_commentstring, event = "BufReadPost", }, @@ -228,7 +228,7 @@ return { -- Debugging { "mfussenegger/nvim-dap", - commit = commit.dap, + commit = commit.nvim_dap, -- event = "BufWinEnter", config = function() require("lvim.core.dap").setup() @@ -239,7 +239,7 @@ return { -- Debugger management { "Pocco81/DAPInstall.nvim", - commit = commit.dap_install, + commit = commit.dapinstall, -- event = "BufWinEnter", -- event = "BufRead", disable = not lvim.builtin.dap.active, diff --git a/lua/lvim/utils/init.lua b/lua/lvim/utils/init.lua index bf04e149..d7affd4b 100644 --- a/lua/lvim/utils/init.lua +++ b/lua/lvim/utils/init.lua @@ -174,6 +174,34 @@ function utils.log_contains(query) return false end -return utils +function utils.generate_plugins_sha(output) + local list = {} + output = output or "commits.lua" + + local function git_cmd(args) + local Job = require "plenary.job" + local stderr = {} + local stdout, ret = Job + :new({ + command = "git", + args = args, + on_stderr = function(_, data) + table.insert(stderr, data) + end, + }) + :sync() + return ret, stdout + end --- TODO: find a new home for these autocommands + for name, plugin in pairs(_G.packer_plugins) do + local retval, latest_sha = git_cmd { "-C", plugin.path, "rev-parse", "@{-1}" } + if retval == 0 then + -- replace dashes, remove postfixes and use lowercase + local normalize_name = (name:gsub("-", "_"):gsub("%.%S+", "")):lower() + list[normalize_name] = latest_sha[1] + end + end + utils.write_file(output, "local commits = " .. vim.inspect(list), "w") +end + +return utils diff --git a/utils/installer/install.sh b/utils/installer/install.sh index e7631999..b6b7bc31 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -14,7 +14,6 @@ declare -r LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$XDG_DATA_HOME/lunarvi declare -r LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/lvim"}" # TODO: Use a dedicated cache directory #1256 declare -r LUNARVIM_CACHE_DIR="$XDG_CACHE_HOME/nvim" -declare -r LUNARVIM_PACK_DIR="$LUNARVIM_RUNTIME_DIR/site/pack" declare BASEDIR BASEDIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" @@ -114,8 +113,6 @@ function main() { done fi - install_packer - if [ -e "$LUNARVIM_RUNTIME_DIR/lvim/init.lua" ]; then update_lvim else @@ -280,18 +277,6 @@ function backup_old_config() { echo "Backup operation complete" } -function install_packer() { - if [ -e "$LUNARVIM_PACK_DIR/packer/start/packer.nvim" ]; then - msg "Packer already installed" - else - if ! git clone --depth 1 "https://github.com/wbthomason/packer.nvim" \ - "$LUNARVIM_PACK_DIR/packer/start/packer.nvim"; then - msg "Failed to clone Packer. Installation failed." - exit 1 - fi - fi -} - function clone_lvim() { msg "Cloning LunarVim configuration" if ! git clone --branch "$LV_BRANCH" \ @@ -351,10 +336,10 @@ function setup_lvim() { setup_shim - echo "Preparing Packer setup" - cp "$LUNARVIM_RUNTIME_DIR/lvim/utils/installer/config.example.lua" "$LUNARVIM_CONFIG_DIR/config.lua" + echo "Preparing Packer setup" + "$INSTALL_PREFIX/bin/lvim" --headless \ -c 'autocmd User PackerComplete quitall' \ -c 'PackerSync' -- cgit v1.2.3 From 5c0ccff78f199c46aea47fa756e7c748477e5c65 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sun, 28 Nov 2021 16:52:56 +0100 Subject: fix: correct order for cmp's setup (#1999) --- lua/lvim/bootstrap.lua | 3 ++- lua/lvim/core/cmp.lua | 3 +-- lua/lvim/plugins.lua | 32 +++++++++++++++++++------------- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/lua/lvim/bootstrap.lua b/lua/lvim/bootstrap.lua index 051f7698..7545b3be 100644 --- a/lua/lvim/bootstrap.lua +++ b/lua/lvim/bootstrap.lua @@ -2,6 +2,7 @@ local M = {} local uv = vim.loop local path_sep = uv.os_uname().version:match "Windows" and "\\" or "/" +local in_headless = #vim.api.nvim_list_uis() == 0 ---Join path segments that were passed as input ---@return string @@ -77,7 +78,7 @@ function M:init(base_dir) vim.fn.mkdir(get_cache_dir(), "p") -- FIXME: currently unreliable in unit-tests - if not os.getenv "LVIM_TEST_ENV" then + if not in_headless then _G.PLENARY_DEBUG = false require("lvim.impatient").setup { path = join_paths(self.cache_dir, "lvim_cache"), diff --git a/lua/lvim/core/cmp.lua b/lua/lvim/core/cmp.lua index 89159ebb..afad3ead 100644 --- a/lua/lvim/core/cmp.lua +++ b/lua/lvim/core/cmp.lua @@ -301,8 +301,7 @@ M.config = function() } end -M.setup = function() - require("luasnip/loaders/from_vscode").lazy_load() +function M.setup() require("cmp").setup(lvim.builtin.cmp) end diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 6a131390..6d59926e 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -15,7 +15,7 @@ local commit = { nlsp_settings = "1e75ac7733f6492b501a7594870cf75c4ee23e81", null_ls = "b07ce47f02c7b12ad65bfb4da215c6380228a959", nvim_autopairs = "fba2503bd8cd0d8861054523aae39c4ac0680c07", - nvim_cmp = "ca6386854982199a532150cf3bd711395475ebd2", + nvim_cmp = "092fb66b6ddb4b12b9b542d105d7af40e4fbd9f2", nvim_dap = "4e8bb7ca12dc8ca6f7a500cbb4ecea185665c7f1", nvim_lsp_installer = "52183c68baf9019c8241b1abf33ba0b6594ab3c8", nvim_lspconfig = "b53f89c16bcc8052aa56d3a903fcad3aaa774041", @@ -78,44 +78,50 @@ return { "hrsh7th/nvim-cmp", commit = commit.nvim_cmp, config = function() - require("lvim.core.cmp").setup() - end, - run = function() - -- cmp's config requires cmp to be installed to run the first time - if not lvim.builtin.cmp then - require("lvim.core.cmp").config() + if lvim.builtin.cmp then + require("lvim.core.cmp").setup() end end, + requires = { + "L3MON4D3/LuaSnip", + "rafamadriz/friendly-snippets", + }, + module = "cmp", }, { "rafamadriz/friendly-snippets", commit = commit.friendly_snippets, - -- event = "InsertCharPre", - -- disable = not lvim.builtin.compe.active, }, { "L3MON4D3/LuaSnip", + config = function() + require("luasnip/loaders/from_vscode").lazy_load() + end, commit = commit.luasnip, }, + { + "hrsh7th/cmp-nvim-lsp", + commit = commit.cmp_nvim_lsp, + }, { "saadparwaiz1/cmp_luasnip", commit = commit.cmp_luasnip, + after = "cmp", }, { "hrsh7th/cmp-buffer", commit = commit.cmp_buffer, - }, - { - "hrsh7th/cmp-nvim-lsp", - commit = commit.cmp_nvim_lsp, + after = "cmp", }, { "hrsh7th/cmp-path", commit = commit.cmp_path, + after = "cmp", }, { "hrsh7th/cmp-nvim-lua", commit = commit.cmp_nvim_lua, + after = "cmp", }, -- Autopairs -- cgit v1.2.3 From 3a2367b7065f617cf47278912475a517981ec248 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sun, 28 Nov 2021 21:54:45 +0100 Subject: fix(cmp): revert broken sequential loading (#2002) --- lua/lvim/plugins.lua | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 6d59926e..14691272 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -86,7 +86,6 @@ return { "L3MON4D3/LuaSnip", "rafamadriz/friendly-snippets", }, - module = "cmp", }, { "rafamadriz/friendly-snippets", @@ -106,22 +105,18 @@ return { { "saadparwaiz1/cmp_luasnip", commit = commit.cmp_luasnip, - after = "cmp", }, { "hrsh7th/cmp-buffer", commit = commit.cmp_buffer, - after = "cmp", }, { "hrsh7th/cmp-path", commit = commit.cmp_path, - after = "cmp", }, { "hrsh7th/cmp-nvim-lua", commit = commit.cmp_nvim_lua, - after = "cmp", }, -- Autopairs -- cgit v1.2.3 From 8641c38c862d3e9818791673a9366831b81ff603 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Mon, 29 Nov 2021 09:12:13 +0100 Subject: fix(nvimtree): update settings (#2001) --- lua/lvim/core/nvimtree.lua | 43 ++++++++++++++++++++++++++++++++++++------- lua/lvim/core/which-key.lua | 2 +- lua/lvim/plugins.lua | 18 +++++++++--------- lua/lvim/utils/init.lua | 10 +++++++--- 4 files changed, 53 insertions(+), 20 deletions(-) diff --git a/lua/lvim/core/nvimtree.lua b/lua/lvim/core/nvimtree.lua index 1fc93aea..7be9c421 100644 --- a/lua/lvim/core/nvimtree.lua +++ b/lua/lvim/core/nvimtree.lua @@ -6,12 +6,22 @@ function M.config() active = true, on_config_done = nil, setup = { + disable_netrw = true, + hijack_netrw = true, open_on_setup = false, - auto_close = true, - open_on_tab = false, - update_focused_file = { + ignore_ft_on_setup = { + "startify", + "dashboard", + "alpha", + }, + update_to_buf_dir = { enable = true, + auto_open = true, }, + auto_close = true, + open_on_tab = false, + hijack_cursor = false, + update_cwd = false, diagnostics = { enable = true, icons = { @@ -21,16 +31,36 @@ function M.config() error = "", }, }, + update_focused_file = { + enable = true, + update_cwd = true, + ignore_list = {}, + }, + system_open = { + cmd = nil, + args = {}, + }, + git = { + enable = true, + ignore = true, + timeout = 200, + }, view = { width = 30, + height = 30, side = "left", auto_resize = true, + number = false, + relativenumber = false, mappings = { custom_only = false, + list = {}, }, }, - hide_dotfiles = false, - ignore = { ".git", "node_modules", ".cache" }, + filters = { + dotfiles = false, + custom = { ".git", "node_modules", ".cache" }, + }, }, show_icons = { git = 1, @@ -41,9 +71,8 @@ function M.config() }, quit_on_open = 0, git_hl = 1, + disable_window_picker = 0, root_folder_modifier = ":t", - allow_resize = 1, - auto_ignore_ft = { "startify", "dashboard" }, icons = { default = "", symlink = "", diff --git a/lua/lvim/core/which-key.lua b/lua/lvim/core/which-key.lua index 7bb0f00e..88af028f 100644 --- a/lua/lvim/core/which-key.lua +++ b/lua/lvim/core/which-key.lua @@ -61,7 +61,7 @@ M.config = function() -- NOTE: Prefer using : over as the latter avoids going back in normal-mode. -- see https://neovim.io/doc/user/map.html#:map-cmd vmappings = { - ["/"] = { "lua ___comment_gc(vim.fn.visualmode())", "Comment" }, + ["/"] = { "lua require('Comment.api').gc(vim.fn.visualmode())", "Comment" }, }, mappings = { ["w"] = { "w!", "Save" }, diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 14691272..5b3701c3 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -4,24 +4,24 @@ local commit = { cmp_luasnip = "16832bb50e760223a403ffa3042859845dd9ef9d", cmp_nvim_lsp = "134117299ff9e34adde30a735cd8ca9cf8f3db81", cmp_nvim_lua = "d276254e7198ab7d00f117e88e223b4bd8c02d21", - cmp_path = "81518cf6ae29f5f0c79cd47770ae90ff5225ee13", + cmp_path = "4fe14cf56288200614950fe57525ac6340f49d5a", comment = "a6e1c127fa7f19ec4e3edbffab1aacb2852b6db3", dapinstall = "dd09e9dd3a6e29f02ac171515b8a089fb82bb425", fixcursorhold = "0e4e22d21975da60b0fd2d302285b3b603f9f71e", friendly_snippets = "0806607c4c49b6823cf4155cf0c30bc28934dea2", gitsigns = "95845ef39ce0a98f68cdfdcf7dd586c5e965acc7", - lualine = "cf75e1af5a1cafaa0866cf8a11632f48b430115d", - luasnip = "f400b978b1dbca96e9e190b7009c415c09b8924c", + lualine = "1ae4f0aa74f0b34222c5ef3281b34602a76b2b00", + luasnip = "e63b58600f91681f744fc180ae13ce2800b5e29a", nlsp_settings = "1e75ac7733f6492b501a7594870cf75c4ee23e81", null_ls = "b07ce47f02c7b12ad65bfb4da215c6380228a959", nvim_autopairs = "fba2503bd8cd0d8861054523aae39c4ac0680c07", nvim_cmp = "092fb66b6ddb4b12b9b542d105d7af40e4fbd9f2", nvim_dap = "4e8bb7ca12dc8ca6f7a500cbb4ecea185665c7f1", - nvim_lsp_installer = "52183c68baf9019c8241b1abf33ba0b6594ab3c8", - nvim_lspconfig = "b53f89c16bcc8052aa56d3a903fcad3aaa774041", - nvim_notify = "54375b724637eb6f29085c582318ae1fd042e717", - nvim_tree = "5d8453dfbd34ab00cb3e8ce39660f9a54cdd35f3", - nvim_treesitter = "47cfda2c6711077625c90902d7722238a8294982", + nvim_lsp_installer = "f5734a4a64d0c220e59ee53b80756224e93a0236", + nvim_lspconfig = "d9aa848da3905e0f8153e546d7b630d3d13e0435", + nvim_notify = "9ac4202ed3c5afa92498b83dd28dcde19576ab1f", + nvim_tree = "e842f088847c98da59e14eb543bde11c45c87ef7", + nvim_treesitter = "678a7857911f20cc9445aa13d28c454ae72483f5", nvim_ts_context_commentstring = "9f5e422e1030e7073e593ad32c5354aa0bcb0176", nvim_web_devicons = "8df4988ecf8599fc1f8f387bbf2eae790e4c5ffb", packer = "7f62848f3a92eac61ae61def5f59ddb5e2cc6823", @@ -29,7 +29,7 @@ local commit = { popup = "b7404d35d5d3548a82149238289fa71f7f6de4ac", project = "71d0e23dcfc43cfd6bb2a97dc5a7de1ab47a6538", structlog = "6f1403a192791ff1fa7ac845a73de9e860f781f1", - telescope = "b415e862bf248d66c40e242de4a0c76c68e278f1", + telescope = "ed4adba6d0083a14cabf5837f2511b2617a45593", telescope_fzf_native = "b8662b076175e75e6497c59f3e2799b879d7b954", toggleterm = "265bbff68fbb8b2a5fb011272ec469850254ec9f", which_key = "d3032b6d3e0adb667975170f626cb693bfc66baa", diff --git a/lua/lvim/utils/init.lua b/lua/lvim/utils/init.lua index d7affd4b..8c0ad036 100644 --- a/lua/lvim/utils/init.lua +++ b/lua/lvim/utils/init.lua @@ -193,12 +193,16 @@ function utils.generate_plugins_sha(output) return ret, stdout end - for name, plugin in pairs(_G.packer_plugins) do - local retval, latest_sha = git_cmd { "-C", plugin.path, "rev-parse", "@{-1}" } + local core_plugins = require "lvim.plugins" + for _, plugin in pairs(core_plugins) do + local name = plugin[1]:match "/(%S*)" + local url = "https://github.com/" .. plugin[1] + print("checking: " .. name .. ", at: " .. url) + local retval, latest_sha = git_cmd { "ls-remote", url, "origin", "HEAD" } if retval == 0 then -- replace dashes, remove postfixes and use lowercase local normalize_name = (name:gsub("-", "_"):gsub("%.%S+", "")):lower() - list[normalize_name] = latest_sha[1] + list[normalize_name] = latest_sha[1]:gsub("\tHEAD", "") end end utils.write_file(output, "local commits = " .. vim.inspect(list), "w") -- cgit v1.2.3 From 708fdd2980a7e42e2e67c5824f718a4ae9a9f0b4 Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Wed, 1 Dec 2021 18:44:41 +0330 Subject: fix: dont close if next char is a close pair and no pairs in same line (#2017) --- lua/lvim/core/autopairs.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/lvim/core/autopairs.lua b/lua/lvim/core/autopairs.lua index 51649790..a4585e08 100644 --- a/lua/lvim/core/autopairs.lua +++ b/lua/lvim/core/autopairs.lua @@ -9,6 +9,7 @@ function M.config() all = "(", tex = "{", }, + enable_check_bracket_line = false, ---@usage check treesitter check_ts = true, ts_config = { @@ -26,6 +27,7 @@ M.setup = function() autopairs.setup { check_ts = lvim.builtin.autopairs.check_ts, + enable_check_bracket_line = lvim.builtin.autopairs.enable_check_bracket_line, ts_config = lvim.builtin.autopairs.ts_config, } -- cgit v1.2.3 From 3cae67b08b387964582b83fc28af7270cc326773 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Wed, 1 Dec 2021 19:02:06 +0100 Subject: chore: bump core-plugins' version (#2018) --- lua/lvim/lsp/config.lua | 1 + lua/lvim/plugins.lua | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lua/lvim/lsp/config.lua b/lua/lvim/lsp/config.lua index 9a2f17df..18f1218d 100644 --- a/lua/lvim/lsp/config.lua +++ b/lua/lvim/lsp/config.lua @@ -45,6 +45,7 @@ return { override = { "angularls", "ansiblels", + "csharp_ls", "denols", "ember", "emmet_ls", diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 5b3701c3..936533d5 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -4,32 +4,32 @@ local commit = { cmp_luasnip = "16832bb50e760223a403ffa3042859845dd9ef9d", cmp_nvim_lsp = "134117299ff9e34adde30a735cd8ca9cf8f3db81", cmp_nvim_lua = "d276254e7198ab7d00f117e88e223b4bd8c02d21", - cmp_path = "4fe14cf56288200614950fe57525ac6340f49d5a", + cmp_path = "e30d3fdee650a07330654efab1951b2f1b91435e", comment = "a6e1c127fa7f19ec4e3edbffab1aacb2852b6db3", dapinstall = "dd09e9dd3a6e29f02ac171515b8a089fb82bb425", fixcursorhold = "0e4e22d21975da60b0fd2d302285b3b603f9f71e", - friendly_snippets = "0806607c4c49b6823cf4155cf0c30bc28934dea2", - gitsigns = "95845ef39ce0a98f68cdfdcf7dd586c5e965acc7", + friendly_snippets = "e3506d575e120253b4aa47ec2100786fd1e9c38d", + gitsigns = "9678750f209671551c335c4f22658a6554c2f439", lualine = "1ae4f0aa74f0b34222c5ef3281b34602a76b2b00", - luasnip = "e63b58600f91681f744fc180ae13ce2800b5e29a", - nlsp_settings = "1e75ac7733f6492b501a7594870cf75c4ee23e81", - null_ls = "b07ce47f02c7b12ad65bfb4da215c6380228a959", + luasnip = "7fc3cc24f3c1f1a43e861f589ca48ff3dff0b213", + nlsp_settings = "199bc1b2859206488423b676da4a7d010b1a3373", + null_ls = "128b8d85506e44f1e7e0f4acd9f2ba02fc7cee05", nvim_autopairs = "fba2503bd8cd0d8861054523aae39c4ac0680c07", - nvim_cmp = "092fb66b6ddb4b12b9b542d105d7af40e4fbd9f2", + nvim_cmp = "d17d41bdbd4731759d1b3d368204dc18ce3c84f3", nvim_dap = "4e8bb7ca12dc8ca6f7a500cbb4ecea185665c7f1", - nvim_lsp_installer = "f5734a4a64d0c220e59ee53b80756224e93a0236", - nvim_lspconfig = "d9aa848da3905e0f8153e546d7b630d3d13e0435", - nvim_notify = "9ac4202ed3c5afa92498b83dd28dcde19576ab1f", + nvim_lsp_installer = "a4016db22296e4eefbcda2e8b94de74db2d7cb65", + nvim_lspconfig = "5b8624c1bcd332e9fd7ae33a2ca910adb31a7ae7", + nvim_notify = "36012703049bc7be9d4de97cb96c6d17ccf978cd", nvim_tree = "e842f088847c98da59e14eb543bde11c45c87ef7", - nvim_treesitter = "678a7857911f20cc9445aa13d28c454ae72483f5", + nvim_treesitter = "8d1547f0bcd0831876678eeb238c3ba9a528189b", nvim_ts_context_commentstring = "9f5e422e1030e7073e593ad32c5354aa0bcb0176", nvim_web_devicons = "8df4988ecf8599fc1f8f387bbf2eae790e4c5ffb", - packer = "7f62848f3a92eac61ae61def5f59ddb5e2cc6823", + packer = "db3c3e3379613443d94e677a6ac3f61278e36e47", plenary = "1c31adb35fcebe921f65e5c6ff6d5481fa5fa5ac", popup = "b7404d35d5d3548a82149238289fa71f7f6de4ac", project = "71d0e23dcfc43cfd6bb2a97dc5a7de1ab47a6538", structlog = "6f1403a192791ff1fa7ac845a73de9e860f781f1", - telescope = "ed4adba6d0083a14cabf5837f2511b2617a45593", + telescope = "ef245548a858690fa8f2db1f1a0eaf41b93a6ef6", telescope_fzf_native = "b8662b076175e75e6497c59f3e2799b879d7b954", toggleterm = "265bbff68fbb8b2a5fb011272ec469850254ec9f", which_key = "d3032b6d3e0adb667975170f626cb693bfc66baa", -- cgit v1.2.3 From e0336ed029f8368fb1c7a0240f93af1ccf409ffd Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Wed, 1 Dec 2021 21:24:48 +0100 Subject: fix: more accessible changelog (#2019) --- lua/lvim/bootstrap.lua | 17 +++++++++++++++-- lua/lvim/core/commands.lua | 1 + lua/lvim/core/dashboard.lua | 2 +- lua/lvim/core/telescope/custom-finders.lua | 21 ++++++++++++++------- 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/lua/lvim/bootstrap.lua b/lua/lvim/bootstrap.lua index 7545b3be..44705a53 100644 --- a/lua/lvim/bootstrap.lua +++ b/lua/lvim/bootstrap.lua @@ -175,10 +175,23 @@ end function M:get_version(type) type = type or "" local opts = { cwd = get_lvim_base_dir() } - local status_ok, results = git_cmd({ "describe", "--tags" }, opts) + + local _, branch = git_cmd({ "branch", "--show-current" }, opts) + + local is_on_master = branch == "master" + if not is_on_master then + local log_status_ok, log_results = git_cmd({ "log", "--pretty=format:%h", "-1" }, opts) + local abbrev_version = log_results[1] or "" + if not log_status_ok or string.match(abbrev_version, "%d") == nil then + return nil + end + return "dev-" .. abbrev_version + end + + local tag_status_ok, results = git_cmd({ "describe", "--tags" }, opts) local lvim_full_ver = results[1] or "" - if not status_ok or string.match(lvim_full_ver, "%d") == nil then + if not tag_status_ok or string.match(lvim_full_ver, "%d") == nil then return nil end if type == "short" then diff --git a/lua/lvim/core/commands.lua b/lua/lvim/core/commands.lua index a9dd51c0..6997795d 100644 --- a/lua/lvim/core/commands.lua +++ b/lua/lvim/core/commands.lua @@ -17,6 +17,7 @@ M.defaults = { [[ command! LvimSyncCorePlugins lua require('lvim.plugin-loader'):sync_core_plugins() ]], [[ command! LvimReload lua require('lvim.config'):reload() ]], [[ command! LvimToggleFormatOnSave lua require('lvim.core.autocmds').toggle_format_on_save() ]], + [[ command! LvimVersion lua require('lvim.core.telescope.custom-finders').view_lunarvim_changelog() ]], } M.load = function(commands) diff --git a/lua/lvim/core/dashboard.lua b/lua/lvim/core/dashboard.lua index 22e5c9b6..0f62d973 100644 --- a/lua/lvim/core/dashboard.lua +++ b/lua/lvim/core/dashboard.lua @@ -84,7 +84,7 @@ M.setup = function() if lvim_version then table.insert(footer, 2, "") - table.insert(footer, 3, "v" .. lvim_version) + table.insert(footer, 2, lvim_version) end local text = require "lvim.interface.text" diff --git a/lua/lvim/core/telescope/custom-finders.lua b/lua/lvim/core/telescope/custom-finders.lua index 68fd0b07..5ce1485c 100644 --- a/lua/lvim/core/telescope/custom-finders.lua +++ b/lua/lvim/core/telescope/custom-finders.lua @@ -39,12 +39,22 @@ function M.grep_lunarvim_files(opts) builtin.live_grep(opts) end +local copy_to_clipboard_action = function(prompt_bufnr) + local _, action_state = pcall(require, "telescope.actions.state") + local entry = action_state.get_selected_entry() + local version = entry.value + vim.fn.setreg("+", version) + vim.fn.setreg('"', version) + vim.notify("Copied " .. version .. " to clipboard", vim.log.levels.INFO) + actions.close(prompt_bufnr) +end + function M.view_lunarvim_changelog() - local opts = { cwd = get_lvim_base_dir() } + local opts = themes.get_ivy { cwd = get_lvim_base_dir() } opts.entry_maker = make_entry.gen_from_git_commits(opts) pickers.new(opts, { - prompt_title = "LunarVim changelog", + prompt_title = "~ LunarVim Changelog ~", finder = finders.new_oneshot_job( vim.tbl_flatten { @@ -56,16 +66,13 @@ function M.view_lunarvim_changelog() opts ), previewer = { - previewers.git_commit_diff_to_parent.new(opts), - previewers.git_commit_diff_to_head.new(opts), previewers.git_commit_diff_as_was.new(opts), - previewers.git_commit_message.new(opts), }, --TODO: consider opening a diff view when pressing enter attach_mappings = function(_, map) - map("i", "", actions._close) - map("n", "", actions._close) + map("i", "", copy_to_clipboard_action) + map("n", "", copy_to_clipboard_action) map("i", "", actions._close) map("n", "", actions._close) map("n", "q", actions._close) -- cgit v1.2.3 From 77bf0e3ea8caf18dcb687ab432eee94c14fd5b08 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Thu, 2 Dec 2021 09:27:39 +0100 Subject: feat: add support for fsharp (#2021) Co-authored-by: grenaad Co-authored-by: grenaad --- ftdetect/fsautocomplete.lua | 3 +++ lua/lvim/config/supported_languages.lua | 1 + 2 files changed, 4 insertions(+) create mode 100644 ftdetect/fsautocomplete.lua diff --git a/ftdetect/fsautocomplete.lua b/ftdetect/fsautocomplete.lua new file mode 100644 index 00000000..0b71987e --- /dev/null +++ b/ftdetect/fsautocomplete.lua @@ -0,0 +1,3 @@ +vim.cmd [[ + au BufNewFile,BufRead *.fs,*.fsx,*.fsi set filetype=fsharp +]] diff --git a/lua/lvim/config/supported_languages.lua b/lua/lvim/config/supported_languages.lua index db28df12..ce5bc0db 100644 --- a/lua/lvim/config/supported_languages.lua +++ b/lua/lvim/config/supported_languages.lua @@ -26,6 +26,7 @@ return { "fennel", "fish", "fortran", + "fsharp", "gdscript", "glimmer", "go", -- cgit v1.2.3 From 79d673edbc177ce3550d906bb921cb78189a60c8 Mon Sep 17 00:00:00 2001 From: Spaxly <68564017+Spaxly@users.noreply.github.com> Date: Thu, 2 Dec 2021 09:17:23 +0000 Subject: feat: add some messages in uninstall.sh (#1945) Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com> --- utils/installer/uninstall.sh | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/utils/installer/uninstall.sh b/utils/installer/uninstall.sh index 31007984..236d657f 100755 --- a/utils/installer/uninstall.sh +++ b/utils/installer/uninstall.sh @@ -13,8 +13,6 @@ declare -r LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/lvim"}" # TODO: Use a dedicated cache directory #1256 declare -r LUNARVIM_CACHE_DIR="$XDG_CACHE_HOME/nvim" -LVIM_BIN="$(which lvim 2>/dev/null)" - declare -a __lvim_dirs=( "$LUNARVIM_CONFIG_DIR" "$LUNARVIM_RUNTIME_DIR" @@ -44,15 +42,33 @@ function parse_arguments() { done } -function main() { - parse_arguments "$@" +function remove_lvim_dirs() { for dir in "${__lvim_dirs[@]}"; do rm -rf "$dir" if [ "$ARGS_REMOVE_BACKUPS" -eq 1 ]; then rm -rf "$dir.bak" fi done - rm -f "$LVIM_BIN" +} + +function remove_lvim_bin() { + local legacy_bin="/usr/local/bin/lvim " + if [ -x "$legacy_bin" ]; then + echo "Error! Unable to remove $legacy_bin without elevation. Please remove manually." + exit 1 + fi + + lvim_bin="$(command -v lvim 2>/dev/null)" + rm -f "$lvim_bin" +} + +function main() { + parse_arguments "$@" + echo "Removing LunarVim binary..." + remove_lvim_bin + echo "Removing LunarVim directories..." + remove_lvim_dirs + echo "Uninstalled LunarVim!" } main "$@" -- cgit v1.2.3 From a3243b29ef27cb102bbb896358a2f7cde899b579 Mon Sep 17 00:00:00 2001 From: Sean Reifschneider Date: Thu, 2 Dec 2021 02:27:22 -0700 Subject: Fix example of unmapping an lvim default (#1949) --- utils/installer/config.example.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/installer/config.example.lua b/utils/installer/config.example.lua index 8f124ad3..03906ada 100644 --- a/utils/installer/config.example.lua +++ b/utils/installer/config.example.lua @@ -18,7 +18,7 @@ lvim.leader = "space" -- add your own keymapping lvim.keys.normal_mode[""] = ":w" -- unmap a default keymapping --- lvim.keys.normal_mode[""] = "" +-- lvim.keys.normal_mode[""] = false -- edit a default keymapping -- lvim.keys.normal_mode[""] = ":q" -- cgit v1.2.3 From f3cd608d174e6dc2b8cdbdcbad6c7b7eedb6668a Mon Sep 17 00:00:00 2001 From: Jieru Mei Date: Thu, 2 Dec 2021 04:31:45 -0500 Subject: feat: null-ls code_actions interface (#2008) --- lua/lvim/core/info.lua | 23 ++++++++++ lua/lvim/lsp/null-ls/code_actions.lua | 81 +++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 lua/lvim/lsp/null-ls/code_actions.lua diff --git a/lua/lvim/core/info.lua b/lua/lvim/core/info.lua index 8d33fe5e..df7b7061 100644 --- a/lua/lvim/core/info.lua +++ b/lua/lvim/core/info.lua @@ -35,6 +35,23 @@ local function make_formatters_info(ft) return section end +local function make_code_actions_info(ft) + local null_actions = require "lvim.lsp.null-ls.code_actions" + local registered_actions = null_actions.list_registered_providers(ft) + local supported_actions = null_actions.list_available(ft) + local section = { + "Code actions info", + fmt( + "* Active: %s%s", + table.concat(registered_actions, "  , "), + vim.tbl_count(registered_actions) > 0 and "  " or "" + ), + fmt("* Supported: %s", str_list(supported_actions)), + } + + return section +end + local function make_linters_info(ft) local null_linters = require "lvim.lsp.null-ls.linters" local supported_linters = null_linters.list_available(ft) @@ -121,6 +138,8 @@ function M.toggle_popup(ft) local linters_info = make_linters_info(ft) + local code_actions_info = make_code_actions_info(ft) + local content_provider = function(popup) local content = {} @@ -137,6 +156,8 @@ function M.toggle_popup(ft) formatters_info, { "" }, linters_info, + { "" }, + code_actions_info, } do vim.list_extend(content, section) end @@ -151,6 +172,7 @@ function M.toggle_popup(ft) vim.cmd [[let m=matchadd("LvimInfoHeader", "Language Server Protocol (LSP) info")]] vim.cmd [[let m=matchadd("LvimInfoHeader", "Formatters info")]] vim.cmd [[let m=matchadd("LvimInfoHeader", "Linters info")]] + vim.cmd [[let m=matchadd("LvimInfoHeader", "Code actions info")]] vim.cmd('let m=matchadd("LvimInfoIdentifier", " ' .. ft .. '$")') vim.cmd 'let m=matchadd("string", "true")' vim.cmd 'let m=matchadd("string", "active")' @@ -160,6 +182,7 @@ function M.toggle_popup(ft) -- tbl_set_highlight(registered_providers, "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") + tbl_set_highlight(require("lvim.lsp.null-ls.code_actions").list_available(ft), "LvimInfoIdentifier") end local Popup = require("lvim.interface.popup"):new { diff --git a/lua/lvim/lsp/null-ls/code_actions.lua b/lua/lvim/lsp/null-ls/code_actions.lua new file mode 100644 index 00000000..ff59fabf --- /dev/null +++ b/lua/lvim/lsp/null-ls/code_actions.lua @@ -0,0 +1,81 @@ +local M = {} + +local null_ls = require "null-ls" +local services = require "lvim.lsp.null-ls.services" +local Log = require "lvim.core.log" + +local METHOD = null_ls.methods.CODE_ACTION + +local is_registered = function(name) + local query = { + name = name, + method = METHOD, + } + return require("null-ls.sources").is_registered(query) +end + +function M.list_registered_providers(filetype) + local registered_providers = services.list_registered_providers_names(filetype) + return registered_providers[METHOD] or {} +end + +function M.list_available(filetype) + local availables = require("null-ls.sources").get_available(filetype, METHOD) + local actors = vim.tbl_map(function(src) + return src.name + end, availables) + table.sort(actors) + return actors +end + +function M.list_configured(actions_configs) + local actors, errors = {}, {} + + for _, config in ipairs(actions_configs) do + vim.validate { + ["config.name"] = { config.name, "string" }, + } + + local name = config.name:gsub("-", "_") + local actor = null_ls.builtins.code_actions[name] + + if not actor then + Log:error("Not a valid code_actions: " .. config.name) + errors[name] = {} -- Add data here when necessary + elseif is_registered(config.name) then + Log:trace "Skipping registering the source more than once" + else + local command + if actor._opts.command then + command = services.find_command(actor._opts.command) + end + if not command and actor._opts.command ~= nil then + Log:warn("Not found: " .. actor._opts.command) + errors[name] = {} -- Add data here when necessary + else + Log:debug("Using code_actions: " .. (command or config.name)) + table.insert( + actors, + actor.with { + command = command, -- could be nil + extra_args = config.args, + filetypes = config.filetypes, + } + ) + end + end + end + + return { supported = actors, unsupported = errors } +end + +function M.setup(actions_configs) + if vim.tbl_isempty(actions_configs) then + return + end + + local actions = M.list_configured(actions_configs) + null_ls.register { sources = actions.supported } +end + +return M -- cgit v1.2.3 From b6d1aa8a314f849e4e98e9fb541e6ea403e01b6f Mon Sep 17 00:00:00 2001 From: Jieru Mei Date: Thu, 2 Dec 2021 11:46:50 -0500 Subject: fix: better default, ignore `.git` in `live_grep` (#2020) --- lua/lvim/core/telescope.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lvim/core/telescope.lua b/lua/lvim/core/telescope.lua index 147c056c..44aed88b 100644 --- a/lua/lvim/core/telescope.lua +++ b/lua/lvim/core/telescope.lua @@ -37,6 +37,7 @@ function M.config() "--column", "--smart-case", "--hidden", + "--glob=!.git/", }, mappings = { i = { -- cgit v1.2.3 From fe95dffe41455139898f2125b176a76a97331c95 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Fri, 3 Dec 2021 18:56:31 +0100 Subject: fix: no restart required when changing colorscheme (#2026) --- init.lua | 3 --- lua/lvim/plugin-loader.lua | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 3a1457e1..cd7c6598 100644 --- a/init.lua +++ b/init.lua @@ -15,9 +15,6 @@ require("lvim.plugin-loader").load { plugins, lvim.plugins } 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 "lvim.core.commands" commands.load(commands.defaults) diff --git a/lua/lvim/plugin-loader.lua b/lua/lvim/plugin-loader.lua index 1ad4266b..5bde8b1b 100644 --- a/lua/lvim/plugin-loader.lua +++ b/lua/lvim/plugin-loader.lua @@ -83,6 +83,10 @@ function plugin_loader.load(configurations) Log:warn "problems detected while loading plugins' configurations" Log:trace(debug.traceback()) end + + -- Colorscheme must get called after plugins are loaded or it will break new installs. + vim.g.colors_name = lvim.colorscheme + vim.cmd("colorscheme " .. lvim.colorscheme) end function plugin_loader.get_core_plugins() -- cgit v1.2.3 From e292d665f161ee58477a5c1011313ef10a7fef8e Mon Sep 17 00:00:00 2001 From: xeluxee <88047141+xeluxee@users.noreply.github.com> Date: Fri, 3 Dec 2021 18:57:43 +0100 Subject: fix(nvimtree): restore default mappings + make them customizable (#2007) --- lua/lvim/core/nvimtree.lua | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/lua/lvim/core/nvimtree.lua b/lua/lvim/core/nvimtree.lua index 7be9c421..05945059 100644 --- a/lua/lvim/core/nvimtree.lua +++ b/lua/lvim/core/nvimtree.lua @@ -103,10 +103,9 @@ function M.setup() Log:error "Failed to load nvim-tree.config" return end - local g = vim.g for opt, val in pairs(lvim.builtin.nvimtree) do - g["nvim_tree_" .. opt] = val + vim.g["nvim_tree_" .. opt] = val end -- Implicitly update nvim-tree when project module is active @@ -118,19 +117,21 @@ function M.setup() vim.g.netrw_banner = false end + -- Add useful keymaps local tree_cb = nvim_tree_config.nvim_tree_callback - - if not lvim.builtin.nvimtree.setup.view.mappings.list then + if #lvim.builtin.nvimtree.setup.view.mappings.list == 0 then lvim.builtin.nvimtree.setup.view.mappings.list = { { key = { "l", "", "o" }, cb = tree_cb "edit" }, { key = "h", cb = tree_cb "close_node" }, { key = "v", cb = tree_cb "vsplit" }, + { key = "C", cb = tree_cb "cd" }, + { key = "gtf", cb = "lua require'lvim.core.nvimtree'.start_telescope('find_files')" }, + { key = "gtg", cb = "lua require'lvim.core.nvimtree'.start_telescope('live_grep')" }, } end - local tree_view = require "nvim-tree.view" - -- Add nvim_tree open callback + local tree_view = require "nvim-tree.view" local open = tree_view.open tree_view.open = function() M.on_open() @@ -166,4 +167,12 @@ function M.change_tree_dir(dir) end end +function M.start_telescope(telescope_mode) + local node = require("nvim-tree.lib").get_node_at_cursor() + local abspath = node.link_to or node.absolute_path + local is_folder = node.has_children and true + local basedir = is_folder and abspath or vim.fn.fnamemodify(abspath, ":h") + vim.api.nvim_command("Telescope " .. telescope_mode .. " cwd=" .. basedir) +end + return M -- cgit v1.2.3 From 7b753ea627db4b1c205dc3f123fbfc23cb619fdd Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sat, 4 Dec 2021 13:58:45 +0100 Subject: fix(autopairs): add missing configuration entries (#2030) --- lua/lvim/core/autopairs.lua | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/lua/lvim/core/autopairs.lua b/lua/lvim/core/autopairs.lua index a4585e08..365d00d5 100644 --- a/lua/lvim/core/autopairs.lua +++ b/lua/lvim/core/autopairs.lua @@ -4,19 +4,45 @@ function M.config() lvim.builtin.autopairs = { active = true, on_config_done = nil, - ---@usage -- modifies the function or method delimiter by filetypes + ---@usage modifies the function or method delimiter by filetypes map_char = { all = "(", tex = "{", }, + ---@usage check bracket in same line enable_check_bracket_line = false, ---@usage check treesitter check_ts = true, ts_config = { - lua = { "string" }, - javascript = { "template_string" }, + lua = { "string", "source" }, + javascript = { "string", "template_string" }, java = false, }, + disable_filetype = { "TelescopePrompt", "spectre_panel" }, + ignored_next_char = string.gsub([[ [%w%%%'%[%"%.] ]], "%s+", ""), + enable_moveright = true, + ---@usage disable when recording or executing a macro + disable_in_macro = false, + ---@usage add bracket pairs after quote + enable_afterquote = true, + ---@usage map the key + map_bs = true, + ---@usage map to delete a pair if possible + map_c_w = false, + ---@usage disable when insert after visual block mode + disable_in_visualblock = false, + ---@usage change default fast_wrap + fast_wrap = { + map = "", + chars = { "{", "[", "(", '"', "'" }, + pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), + offset = 0, -- Offset from pattern match + end_key = "$", + keys = "qwertyuiopzxcvbnmasdfghjkl", + check_comma = true, + highlight = "Search", + highlight_grey = "Comment", + }, } end @@ -29,10 +55,17 @@ M.setup = function() check_ts = lvim.builtin.autopairs.check_ts, enable_check_bracket_line = lvim.builtin.autopairs.enable_check_bracket_line, ts_config = lvim.builtin.autopairs.ts_config, + disable_filetype = lvim.builtin.autopairs.disable_filetype, + disable_in_macro = lvim.builtin.autopairs.disable_in_macro, + ignored_next_char = lvim.builtin.autopairs.ignored_next_char, + enable_moveright = lvim.builtin.autopairs.enable_moveright, + enable_afterquote = lvim.builtin.autopairs.enable_afterquote, + map_c_w = lvim.builtin.autopairs.map_c_w, + map_bs = lvim.builtin.autopairs.map_bs, + disable_in_visualblock = lvim.builtin.autopairs.disable_in_visualblock, + fast_wrap = lvim.builtin.autopairs.fast_wrap, } - -- vim.g.completion_confirm_key = "" - autopairs.add_rule(Rule("$$", "$$", "tex")) autopairs.add_rules { Rule("$", "$", { "tex", "latex" }) -- don't add a pair if the next character is % -- cgit v1.2.3 From ef5ca00df50b7d7ece7a794bcfe8a3bd7d37720d Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sat, 4 Dec 2021 14:02:47 +0100 Subject: chore: bump core-plugins version (#2031) --- Makefile | 7 ++++++- lua/lvim/plugins.lua | 26 +++++++++++++------------- lua/lvim/utils/init.lua | 2 +- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 8efa4f4d..61d59d22 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,12 @@ install-neovim-binary: bash ./utils/installer/install-neovim-from-release uninstall: - @echo TODO: this is currently not supported + @echo Starting LunarVim Uninstaller + bash ./utils/installer/uninstall.sh + +generate_plugins_sha: + @echo generating core-plugins latest SHA list + lvim --headless -c 'lua require("lvim.utils").generate_plugins_sha("latest-sha.lua")' -c 'qall' lint: lint-lua lint-sh diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 936533d5..a7d6c810 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -4,32 +4,32 @@ local commit = { cmp_luasnip = "16832bb50e760223a403ffa3042859845dd9ef9d", cmp_nvim_lsp = "134117299ff9e34adde30a735cd8ca9cf8f3db81", cmp_nvim_lua = "d276254e7198ab7d00f117e88e223b4bd8c02d21", - cmp_path = "e30d3fdee650a07330654efab1951b2f1b91435e", + cmp_path = "d83839ae510d18530c6d36b662a9e806d4dceb73", comment = "a6e1c127fa7f19ec4e3edbffab1aacb2852b6db3", dapinstall = "dd09e9dd3a6e29f02ac171515b8a089fb82bb425", fixcursorhold = "0e4e22d21975da60b0fd2d302285b3b603f9f71e", friendly_snippets = "e3506d575e120253b4aa47ec2100786fd1e9c38d", - gitsigns = "9678750f209671551c335c4f22658a6554c2f439", + gitsigns = "119ebde2de917399aa89ad3664000a0e1750895a", lualine = "1ae4f0aa74f0b34222c5ef3281b34602a76b2b00", - luasnip = "7fc3cc24f3c1f1a43e861f589ca48ff3dff0b213", + luasnip = "4191d3e475b65407b8ccf47e4dcbf38552fdbb2d", nlsp_settings = "199bc1b2859206488423b676da4a7d010b1a3373", - null_ls = "128b8d85506e44f1e7e0f4acd9f2ba02fc7cee05", - nvim_autopairs = "fba2503bd8cd0d8861054523aae39c4ac0680c07", - nvim_cmp = "d17d41bdbd4731759d1b3d368204dc18ce3c84f3", - nvim_dap = "4e8bb7ca12dc8ca6f7a500cbb4ecea185665c7f1", - nvim_lsp_installer = "a4016db22296e4eefbcda2e8b94de74db2d7cb65", - nvim_lspconfig = "5b8624c1bcd332e9fd7ae33a2ca910adb31a7ae7", - nvim_notify = "36012703049bc7be9d4de97cb96c6d17ccf978cd", + null_ls = "73420db2b58408a60a19024be3c14b0eba8413fe", + nvim_autopairs = "18fe311bb967d16ddf2cc28e7e71f234c37d3e26", + nvim_cmp = "d12ba90da372bfe5d9a103546ce1553341a2daff", + nvim_dap = "ce4e56f76598881d020e68037ae91310ea8b9d54", + nvim_lsp_installer = "4df84d7d3e8bcc9b98a1436b6b4155b3a727d41d", + nvim_lspconfig = "382712c4ecba5816f398379dd9d8c8200b025ca3", + nvim_notify = "3f7af5878a890503f9efb7de9f2a0b3f895ad518", nvim_tree = "e842f088847c98da59e14eb543bde11c45c87ef7", - nvim_treesitter = "8d1547f0bcd0831876678eeb238c3ba9a528189b", + nvim_treesitter = "d6a0a26b8563409d4660def7320a4f4bc23954df", nvim_ts_context_commentstring = "9f5e422e1030e7073e593ad32c5354aa0bcb0176", nvim_web_devicons = "8df4988ecf8599fc1f8f387bbf2eae790e4c5ffb", - packer = "db3c3e3379613443d94e677a6ac3f61278e36e47", + packer = "851c62c5ecd3b5adc91665feda8f977e104162a5", plenary = "1c31adb35fcebe921f65e5c6ff6d5481fa5fa5ac", popup = "b7404d35d5d3548a82149238289fa71f7f6de4ac", project = "71d0e23dcfc43cfd6bb2a97dc5a7de1ab47a6538", structlog = "6f1403a192791ff1fa7ac845a73de9e860f781f1", - telescope = "ef245548a858690fa8f2db1f1a0eaf41b93a6ef6", + telescope = "27294d73e4562cbc83c9c488b4618f012deade7e", telescope_fzf_native = "b8662b076175e75e6497c59f3e2799b879d7b954", toggleterm = "265bbff68fbb8b2a5fb011272ec469850254ec9f", which_key = "d3032b6d3e0adb667975170f626cb693bfc66baa", diff --git a/lua/lvim/utils/init.lua b/lua/lvim/utils/init.lua index 8c0ad036..cafcf506 100644 --- a/lua/lvim/utils/init.lua +++ b/lua/lvim/utils/init.lua @@ -205,7 +205,7 @@ function utils.generate_plugins_sha(output) list[normalize_name] = latest_sha[1]:gsub("\tHEAD", "") end end - utils.write_file(output, "local commits = " .. vim.inspect(list), "w") + utils.write_file(output, "local commit = " .. vim.inspect(list), "w") end return utils -- cgit v1.2.3 From 02a1e769be9139dfe7294d24b7be2d09bb30b77f Mon Sep 17 00:00:00 2001 From: xeluxee <88047141+xeluxee@users.noreply.github.com> Date: Sat, 4 Dec 2021 16:57:41 +0100 Subject: fix(nvimtree): handle paths containing spaces (#2027) --- lua/lvim/core/nvimtree.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/lvim/core/nvimtree.lua b/lua/lvim/core/nvimtree.lua index 05945059..cb91e344 100644 --- a/lua/lvim/core/nvimtree.lua +++ b/lua/lvim/core/nvimtree.lua @@ -170,9 +170,11 @@ end function M.start_telescope(telescope_mode) local node = require("nvim-tree.lib").get_node_at_cursor() local abspath = node.link_to or node.absolute_path - local is_folder = node.has_children and true + local is_folder = node.open ~= nil local basedir = is_folder and abspath or vim.fn.fnamemodify(abspath, ":h") - vim.api.nvim_command("Telescope " .. telescope_mode .. " cwd=" .. basedir) + require("telescope.builtin")[telescope_mode] { + cwd = basedir, + } end return M -- cgit v1.2.3 From 38a172434027c9ac2a71cd658803ec3f7a39ab09 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Mon, 6 Dec 2021 07:30:29 +0100 Subject: feat(terminal): lazygit can now be toggled (#2039) * feat(terminal): lazygit can now be toggled - remove `hidden` parameter so it can be persistent - map keybinding for both normal and term modes - a default shell is now always reachable with `` in a split - add an addition keybinding `` for `lazygit` since it's hard to hit `gg` within the `timeoutlen` < 300ms * revert(terminal): use float direction by default --- lua/lvim/core/terminal.lua | 80 ++++++++++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 28 deletions(-) diff --git a/lua/lvim/core/terminal.lua b/lua/lvim/core/terminal.lua index aa6989ec..61c0acd0 100644 --- a/lua/lvim/core/terminal.lua +++ b/lua/lvim/core/terminal.lua @@ -40,53 +40,77 @@ M.config = function() -- lvim.builtin.terminal.execs = {{}} to overwrite -- lvim.builtin.terminal.execs[#lvim.builtin.terminal.execs+1] = {"gdb", "tg", "GNU Debugger"} execs = { - { "lazygit", "gg", "LazyGit" }, + -- TODO: this should probably be removed since it's hard to hit gg within the timeoutlen + { "lazygit", "gg", "LazyGit", "float" }, + { "lazygit", "", "LazyGit", "float" }, }, } end M.setup = function() local terminal = require "toggleterm" - for _, exec in pairs(lvim.builtin.terminal.execs) do - require("lvim.core.terminal").add_exec(exec[1], exec[2], exec[3]) - end terminal.setup(lvim.builtin.terminal) - if lvim.builtin.terminal.on_config_done then - lvim.builtin.terminal.on_config_done(terminal) - end -end + -- setup the default terminal so it's always reachable + local default_term_opts = { + cmd = lvim.builtin.terminal.shell, + keymap = lvim.builtin.terminal.open_mapping, + label = "Toggle terminal", + count = 1, + direction = lvim.builtin.terminal.direction, + size = lvim.builtin.terminal.size, + } + M.add_exec(default_term_opts) -M.add_exec = function(exec, keymap, name) - vim.api.nvim_set_keymap( - "n", - "" .. keymap, - "lua require('lvim.core.terminal')._exec_toggle('" .. exec .. "')", - { noremap = true, silent = true } - ) - lvim.builtin.which_key.mappings[keymap] = name -end + for i, exec in pairs(lvim.builtin.terminal.execs) do + local opts = { + cmd = exec[1], + keymap = exec[2], + label = exec[3], + count = i + 1, + direction = exec[4] or lvim.builtin.terminal.direction, + size = lvim.builtin.terminal.size, + } -M._split = function(inputstr, sep) - if sep == nil then - sep = "%s" + M.add_exec(opts) end - local t = {} - for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do - table.insert(t, str) + + if lvim.builtin.terminal.on_config_done then + lvim.builtin.terminal.on_config_done(terminal) end - return t end -M._exec_toggle = function(exec) - local binary = M._split(exec)[1] +M.add_exec = function(opts) + local binary = opts.cmd:match "(%S+)" if vim.fn.executable(binary) ~= 1 then Log:error("Unable to run executable " .. binary .. ". Please make sure it is installed properly.") return end + + local exec_func = string.format( + "lua require('lvim.core.terminal')._exec_toggle({ cmd = '%s', count = %d, direction = '%s'})", + opts.cmd, + opts.count, + opts.direction + ) + + require("lvim.keymappings").load { + normal_mode = { [opts.keymap] = exec_func }, + term_mode = { [opts.keymap] = exec_func }, + } + + local wk_status_ok, wk = pcall(require, "whichkey") + if not wk_status_ok then + return + end + wk.register({ [opts.keymap] = { opts.label } }, { mode = "n" }) + wk.register({ [opts.keymap] = { opts.label } }, { mode = "t" }) +end + +M._exec_toggle = function(opts) local Terminal = require("toggleterm.terminal").Terminal - local exec_term = Terminal:new { cmd = exec, hidden = true } - exec_term:toggle() + local term = Terminal:new { cmd = opts.cmd, count = opts.count, direction = opts.direction } + term:toggle(lvim.builtin.terminal.size, opts.direction) end ---Toggles a log viewer according to log.viewer.layout_config -- cgit v1.2.3 From 6770808bec1ffcada425ae514747f9380e3d3b8d Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Mon, 6 Dec 2021 17:04:46 +0100 Subject: feat: full compatibility with neovim v0.6 (#2037) --- lua/lvim/lsp/config.lua | 23 ++++++++++++--- lua/lvim/lsp/handlers.lua | 70 +++++++++++++--------------------------------- lua/lvim/lsp/init.lua | 12 ++++---- lua/lvim/plugins.lua | 2 +- lua/lvim/utils/hooks.lua | 11 ++++++-- utils/installer/install.sh | 12 ++++++++ 6 files changed, 67 insertions(+), 63 deletions(-) diff --git a/lua/lvim/lsp/config.lua b/lua/lvim/lsp/config.lua index 18f1218d..a990f8c7 100644 --- a/lua/lvim/lsp/config.lua +++ b/lua/lvim/lsp/config.lua @@ -4,16 +4,31 @@ return { signs = { active = true, values = { - { name = "LspDiagnosticsSignError", text = "" }, - { name = "LspDiagnosticsSignWarning", text = "" }, - { name = "LspDiagnosticsSignHint", text = "" }, - { name = "LspDiagnosticsSignInformation", text = "" }, + { name = "DiagnosticSignError", text = "" }, + { name = "DiagnosticSignWarn", text = "" }, + { name = "DiagnosticSignHint", text = "" }, + { name = "DiagnosticSignInfo", text = "" }, }, }, virtual_text = true, update_in_insert = false, underline = true, severity_sort = true, + float = { + focusable = false, + style = "minimal", + border = "rounded", + source = "always", + header = "", + prefix = "", + format = function(d) + local t = vim.deepcopy(d) + if d.code then + t.message = string.format("%s [%s]", t.message, t.code):gsub("1. ", "") + end + return t.message + end, + }, }, document_highlight = true, code_lens_refresh = true, diff --git a/lua/lvim/lsp/handlers.lua b/lua/lvim/lsp/handlers.lua index 27ce8589..45f73e91 100644 --- a/lua/lvim/lsp/handlers.lua +++ b/lua/lvim/lsp/handlers.lua @@ -9,42 +9,10 @@ function M.setup() underline = lvim.lsp.diagnostics.underline, update_in_insert = lvim.lsp.diagnostics.update_in_insert, severity_sort = lvim.lsp.diagnostics.severity_sort, + float = lvim.lsp.diagnostics.float, } - if vim.fn.has "nvim-0.5.1" > 0 then - vim.lsp.handlers["textDocument/publishDiagnostics"] = function(_, result, ctx, _) - local uri = result.uri - local bufnr = vim.uri_to_bufnr(uri) - if not bufnr then - return - end - - local diagnostics = result.diagnostics - local ok, vim_diag = pcall(require, "vim.diagnostic") - if ok then - -- FIX: why can't we just use vim.diagnostic.get(buf_id)? - config.signs = true - for i, diagnostic in ipairs(diagnostics) do - local rng = diagnostic.range - diagnostics[i].lnum = rng["start"].line - diagnostics[i].end_lnum = rng["end"].line - diagnostics[i].col = rng["start"].character - diagnostics[i].end_col = rng["end"].character - end - local namespace = vim.lsp.diagnostic.get_namespace(ctx.client_id) - - vim_diag.set(namespace, bufnr, diagnostics, config) - if not vim.api.nvim_buf_is_loaded(bufnr) then - return - end - vim_diag.show(namespace, bufnr, diagnostics, config) - else - vim.lsp.diagnostic.save(diagnostics, bufnr, ctx.client_id) - if not vim.api.nvim_buf_is_loaded(bufnr) then - return - end - vim.lsp.diagnostic.display(diagnostics, bufnr, ctx.client_id, config) - end - end + if vim.fn.has "nvim-0.6" == 1 then + vim.diagnostic.config(config) else vim.lsp.handlers["textDocument/publishDiagnostics"] = function(_, _, params, client_id, _) local uri = params.uri @@ -60,27 +28,29 @@ function M.setup() end vim.lsp.diagnostic.display(diagnostics, bufnr, client_id, config) end - end - - vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { - border = lvim.lsp.popup_border, - }) - vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { - border = lvim.lsp.popup_border, - }) -end + vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { + border = lvim.lsp.popup_border, + }) -local function split_by_chunk(text, chunkSize) - local s = {} - for i = 1, #text, chunkSize do - s[#s + 1] = text:sub(i, i + chunkSize - 1) + vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { + border = lvim.lsp.popup_border, + }) end - return s end function M.show_line_diagnostics() - -- TODO: replace all this with vim.diagnostic.show_position_diagnostics() + if vim.fn.has "nvim-0.6" == 1 then + return vim.diagnostic.open_float(0, { scope = "line" }) + end + + local function split_by_chunk(text, chunkSize) + local s = {} + for i = 1, #text, chunkSize do + s[#s + 1] = text:sub(i, i + chunkSize - 1) + end + return s + end local diagnostics = vim.lsp.diagnostic.get_line_diagnostics() local severity_highlight = { "LspDiagnosticsFloatingError", diff --git a/lua/lvim/lsp/init.lua b/lua/lvim/lsp/init.lua index 9764950d..68a64d6c 100644 --- a/lua/lvim/lsp/init.lua +++ b/lua/lvim/lsp/init.lua @@ -137,10 +137,10 @@ function M.get_common_opts() end local LSP_DEPRECATED_SIGN_MAP = { - ["LspDiagnosticsSignError"] = "DiagnosticSignError", - ["LspDiagnosticsSignWarning"] = "DiagnosticSignWarn", - ["LspDiagnosticsSignHint"] = "DiagnosticSignHint", - ["LspDiagnosticsSignInformation"] = "DiagnosticSignInfo", + ["DiagnosticSignError"] = "LspDiagnosticsSignError", + ["DiagnosticSignWarn"] = "LspDiagnosticsSignWarning", + ["DiagnosticSignHint"] = "LspDiagnosticsSignHint", + ["DiagnosticSignInfo"] = "LspDiagnosticsSignInformation", } function M.setup() @@ -151,11 +151,11 @@ function M.setup() return end - local is_neovim_nightly = vim.fn.has "nvim-0.5.1" > 0 + local is_neovim_5 = vim.fn.has "nvim-0.6" ~= 1 for _, sign in ipairs(lvim.lsp.diagnostics.signs.values) do local lsp_sign_name = LSP_DEPRECATED_SIGN_MAP[sign.name] - if is_neovim_nightly and lsp_sign_name then + if is_neovim_5 and lsp_sign_name then vim.fn.sign_define(lsp_sign_name, { texthl = lsp_sign_name, text = sign.text, numhl = lsp_sign_name }) end vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = sign.name }) diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index a7d6c810..8b968a07 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -134,7 +134,7 @@ return { { "nvim-treesitter/nvim-treesitter", commit = commit.treesitter, - branch = "0.5-compat", + branch = vim.fn.has "nvim-0.6" == 1 and "master" or "0.5-compat", -- run = ":TSUpdate", config = function() require("lvim.core.treesitter").setup() diff --git a/lua/lvim/utils/hooks.lua b/lua/lvim/utils/hooks.lua index 0fe4a7fd..1d265482 100644 --- a/lua/lvim/utils/hooks.lua +++ b/lua/lvim/utils/hooks.lua @@ -7,7 +7,9 @@ local in_headless = #vim.api.nvim_list_uis() == 0 function M.run_pre_update() Log:debug "Starting pre-update hook" _G.__luacache.clear_cache() - vim.cmd "LspStop" + if package.loaded["lspconfig"] then + vim.cmd [[ LspStop ]] + end end ---Reset any startup cache files used by Packer and Impatient @@ -34,9 +36,14 @@ function M.run_post_update() if not in_headless then vim.schedule(function() + if package.loaded["nvim-treesitter"] then + vim.cmd [[ TSUpdateSync ]] + end -- TODO: add a changelog vim.notify("Update complete", vim.log.levels.INFO) - vim.cmd "LspRestart" + if package.loaded["lspconfig"] then + vim.cmd [[ LspRestart ]] + end end) end end diff --git a/utils/installer/install.sh b/utils/installer/install.sh index b6b7bc31..88c3e550 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -174,6 +174,17 @@ function print_missing_dep_msg() { fi } +function check_neovim_min_version() { + # TODO: consider locking the requirement to 0.6+ + local verify_version_cmd='if !has("nvim-0.5.1") | cquit | else | quit | endif' + + # exit with an error if min_version not found + if ! nvim --headless -u NONE -c "$verify_version_cmd"; then + echo "[ERROR]: LunarVim requires at least Neovim v0.5.1 or higher" + exit 1 + fi +} + function check_system_deps() { if ! command -v git &>/dev/null; then print_missing_dep_msg "git" @@ -183,6 +194,7 @@ function check_system_deps() { print_missing_dep_msg "neovim" exit 1 fi + check_neovim_min_version } function __install_nodejs_deps_npm() { -- cgit v1.2.3 From 6505826f0bb8da045a91b579714df911bbca55b0 Mon Sep 17 00:00:00 2001 From: Xavier Young <45989017+younger-1@users.noreply.github.com> Date: Wed, 8 Dec 2021 13:05:15 +0800 Subject: fix(plugins): typo of pin commit of `treesitter` (#2046) --- lua/lvim/plugins.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 8b968a07..0e51eba1 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -133,7 +133,7 @@ return { -- Treesitter { "nvim-treesitter/nvim-treesitter", - commit = commit.treesitter, + commit = commit.nvim_treesitter, branch = vim.fn.has "nvim-0.6" == 1 and "master" or "0.5-compat", -- run = ":TSUpdate", config = function() -- cgit v1.2.3 From e4752692e5f547ef9780161a3ecfc4c3b4552cc5 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Wed, 8 Dec 2021 08:15:56 +0100 Subject: fix(lsp): prevent repeated setup call (#2048) Check if the manager `autocomd` has already been configured, since some servers can take a while to initialize. --- lua/lvim/lsp/manager.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lua/lvim/lsp/manager.lua b/lua/lvim/lsp/manager.lua index ca4dc285..7a35f1ff 100644 --- a/lua/lvim/lsp/manager.lua +++ b/lua/lvim/lsp/manager.lua @@ -45,13 +45,28 @@ local function buf_try_add(server_name, bufnr) require("lspconfig")[server_name].manager.try_add_wrapper(bufnr) end +-- check if the manager autocomd has already been configured since some servers can take a while to initialize +-- this helps guarding against a data-race condition where a server can get configured twice +-- which seems to occur only when attaching to single-files +local function client_is_configured(server_name, ft) + ft = ft or vim.bo.filetype + local active_autocmds = vim.split(vim.fn.execute("autocmd FileType " .. ft), "\n") + for _, result in ipairs(active_autocmds) do + if result:match(server_name) then + return true + end + end + return false +end + ---Setup a language server by providing a name ---@param server_name string name of the language server ---@param user_config table [optional] when available it will take predence over any default configurations function M.setup(server_name, user_config) vim.validate { name = { server_name, "string" } } - if lvim_lsp_utils.is_client_active(server_name) then + if lvim_lsp_utils.is_client_active(server_name) or client_is_configured(server_name) then + Log:debug(string.format("[%q] is already configured. Ignoring repeated setup call.", server_name)) return end -- cgit v1.2.3 From c43ee9aa3a6353e74d577cb79e60c5c885bc02f5 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Wed, 8 Dec 2021 09:01:33 +0100 Subject: fix: no longer treat lazygit missing as an error (#2051) --- lua/lvim/core/terminal.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lvim/core/terminal.lua b/lua/lvim/core/terminal.lua index 61c0acd0..20485cda 100644 --- a/lua/lvim/core/terminal.lua +++ b/lua/lvim/core/terminal.lua @@ -83,7 +83,7 @@ end M.add_exec = function(opts) local binary = opts.cmd:match "(%S+)" if vim.fn.executable(binary) ~= 1 then - Log:error("Unable to run executable " .. binary .. ". Please make sure it is installed properly.") + Log:debug("Skipping configuring executable " .. binary .. ". Please make sure it is installed properly.") return end -- cgit v1.2.3 From 68cdb62f87543d5420e70c241ebd5942ed9c7b0e Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Thu, 9 Dec 2021 11:51:37 +0100 Subject: fix(bootstrap): remove hard-coded spellfile option (#2061) --- lua/lvim/bootstrap.lua | 3 -- lua/lvim/config/settings.lua | 1 + utils/installer/install.ps1 | 80 ++++++++++++++++++++++++-------------------- utils/installer/install.sh | 26 +++++++++----- 4 files changed, 62 insertions(+), 48 deletions(-) diff --git a/lua/lvim/bootstrap.lua b/lua/lvim/bootstrap.lua index 44705a53..702dfae1 100644 --- a/lua/lvim/bootstrap.lua +++ b/lua/lvim/bootstrap.lua @@ -72,11 +72,8 @@ function M:init(base_dir) -- TODO: we need something like this: vim.opt.packpath = vim.opt.rtp vim.cmd [[let &packpath = &runtimepath]] - vim.cmd("set spellfile=" .. join_paths(self.config_dir, "spell", "en.utf-8.add")) end - vim.fn.mkdir(get_cache_dir(), "p") - -- FIXME: currently unreliable in unit-tests if not in_headless then _G.PLENARY_DEBUG = false diff --git a/lua/lvim/config/settings.lua b/lua/lvim/config/settings.lua index 048d4058..d784ce60 100644 --- a/lua/lvim/config/settings.lua +++ b/lua/lvim/config/settings.lua @@ -43,6 +43,7 @@ M.load_options = function() wrap = false, -- display lines as one long line spell = false, spelllang = "en", + spellfile = utils.join_paths(get_config_dir(), "spell", "en.utf-8.add"), scrolloff = 8, -- is one of my fav sidescrolloff = 8, } diff --git a/utils/installer/install.ps1 b/utils/installer/install.ps1 index c46bbfc2..0823032a 100644 --- a/utils/installer/install.ps1 +++ b/utils/installer/install.ps1 @@ -64,20 +64,8 @@ function main($cliargs) { backup_old_config __add_separator "80" - - if ($cliargs.Contains("--overwrite")) { - Write-Output "!!Warning!! -> Removing all lunarvim related config because of the --overwrite flag" - $answer = Read-Host "Would you like to continue? [y]es or [n]o " - if ("$answer" -ne "y" -and "$answer" -ne "Y") { - exit 1 - } - - foreach ($dir in $__lvim_dirs) { - if (Test-Path "$dir") { - Remove-Item -Force -Recurse "$dir" - } - } - } + + verify_lvim_dirs if (Test-Path "$env:LUNARVIM_RUNTIME_DIR\site\pack\packer\start\packer.nvim") { Write-Output "Packer already installed" @@ -153,7 +141,7 @@ function check_system_deps() { function install_nodejs_deps() { try { check_system_dep "node" - Invoke-Command npm install -g neovim tree-sitter-cli -ErrorAction Break + Invoke-Command npm install -g neovim tree-sitter-cli -ErrorAction Break } catch { print_missing_dep_msg "$dep" @@ -211,6 +199,29 @@ function setup_shim() { Copy-Item "$env:LUNARVIM_RUNTIME_DIR\lvim\utils\bin\lvim.ps1" -Destination "$INSTALL_PREFIX\bin\lvim.ps1" -Force } +function verify_lvim_dirs() { + if ($cliargs.Contains("--overwrite")) { + Write-Output "!!Warning!! -> Removing all lunarvim related config because of the --overwrite flag" + $answer = Read-Host "Would you like to continue? [y]es or [n]o " + if ("$answer" -ne "y" -and "$answer" -ne "Y") { + exit 1 + } + + foreach ($dir in $__lvim_dirs) { + if (Test-Path "$dir") { + Remove-Item -Force -Recurse "$dir" + } + } + } + + foreach ($dir in $__lvim_dirs) { + if ((Test-Path "$dir") -eq $false) { + New-Item "$dir" -ItemType Directory + } + } + +} + function setup_lvim() { Write-Output "Installing LunarVim shim" @@ -218,30 +229,26 @@ function setup_lvim() { Write-Output "Preparing Packer setup" - if ((Test-Path "$env:LUNARVIM_CONFIG_DIR") -eq $false) { - New-Item "$env:LUNARVIM_CONFIG_DIR" -ItemType Directory - } - if (Test-Path "$env:LUNARVIM_CONFIG_DIR\config.lua") { Remove-Item -Force "$env:LUNARVIM_CONFIG_DIR\config.lua" } Out-File -FilePath "$env:LUNARVIM_CONFIG_DIR\config.lua" - Write-Output "Packer setup complete" + Write-Output "Packer setup complete" - __add_separator "80" + __add_separator "80" - Copy-Item "$env:LUNARVIM_RUNTIME_DIR\lvim\utils\installer\config.example.lua" "$env:LUNARVIM_CONFIG_DIR\config.lua" + Copy-Item "$env:LUNARVIM_RUNTIME_DIR\lvim\utils\installer\config.example.lua" "$env:LUNARVIM_CONFIG_DIR\config.lua" - $answer = Read-Host $(` - "Would you like to create an alias inside your Powershell profile?`n" +` - "(This enables you to start lvim with the command 'lvim') [y]es or [n]o (default: no)" ) - if ("$answer" -eq "y" -and "$answer" -eq "Y") { - create_alias - } + $answer = Read-Host $(` + "Would you like to create an alias inside your Powershell profile?`n" + ` + "(This enables you to start lvim with the command 'lvim') [y]es or [n]o (default: no)" ) + if ("$answer" -eq "y" -and "$answer" -eq "Y") { + create_alias + } - __add_separator "80" + __add_separator "80" Write-Output "Thank you for installing LunarVim!!" Write-Output "You can start it by running: $INSTALL_PREFIX\bin\lvim.ps1" @@ -267,15 +274,16 @@ function __add_separator($div_width) { } function create_alias { - if($null -eq $(Get-Alias | Select-String "lvim")){ - Add-Content -Path $PROFILE -Value $(-join @('Set-Alias lvim "', "$INSTALL_PREFIX", '\bin\lvim.ps1"')) + if ($null -eq $(Get-Alias | Select-String "lvim")) { + Add-Content -Path $PROFILE -Value $( -join @('Set-Alias lvim "', "$INSTALL_PREFIX", '\bin\lvim.ps1"')) - Write-Output "" - Write-Host 'To use the new alias in this window reload your profile with ". $PROFILE".' -ForegroundColor Yellow + Write-Output "" + Write-Host 'To use the new alias in this window reload your profile with ". $PROFILE".' -ForegroundColor Yellow - }else { - Write-Output "Alias is already set and will not be reset." - } + } + else { + Write-Output "Alias is already set and will not be reset." + } } main "$args" diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 88c3e550..722144e3 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -107,11 +107,7 @@ function main() { msg "Backing up old LunarVim configuration" backup_old_config - if [ "$ARGS_OVERWRITE" -eq 1 ]; then - for dir in "${__lvim_dirs[@]}"; do - [ -d "$dir" ] && rm -rf "$dir" - done - fi + verify_lvim_dirs if [ -e "$LUNARVIM_RUNTIME_DIR/lvim/init.lua" ]; then update_lvim @@ -262,11 +258,24 @@ function install_rust_deps() { echo "All Rust dependencies are successfully installed" } +function verify_lvim_dirs() { + if [ "$ARGS_OVERWRITE" -eq 1 ]; then + for dir in "${__lvim_dirs[@]}"; do + [ -d "$dir" ] && rm -rf "$dir" + done + fi + + for dir in "${__lvim_dirs[@]}"; do + mkdir -p "$dir" + done +} + function backup_old_config() { for dir in "${__lvim_dirs[@]}"; do - # we create an empty folder for subsequent commands \ - # that require an existing directory - mkdir -p "$dir" "$dir.bak" + if [ ! -d "$dir" ]; then + continue + fi + mkdir -p "$dir.bak" touch "$dir/ignore" if command -v rsync &>/dev/null; then rsync --archive -hh --partial --progress --cvs-exclude \ @@ -307,7 +316,6 @@ function link_local_lvim() { rm -rf "$LUNARVIM_RUNTIME_DIR/lvim" fi - mkdir -p "$LUNARVIM_RUNTIME_DIR" echo " - $BASEDIR -> $LUNARVIM_RUNTIME_DIR/lvim" ln -s -f "$BASEDIR" "$LUNARVIM_RUNTIME_DIR/lvim" } -- cgit v1.2.3 From 307db8936b291b82124f05bdcfeb85be5464f21d Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Thu, 9 Dec 2021 17:08:53 +0100 Subject: feat: multiple enhancements to lvim-reload (#2054) --- lua/lvim/config/init.lua | 22 +++++++------------- lua/lvim/lsp/utils.lua | 7 +++---- lua/lvim/plugin-loader.lua | 17 +++++++++++++++- lua/lvim/utils/hooks.lua | 50 +++++++++++++++++++++++++++++++++++----------- 4 files changed, 64 insertions(+), 32 deletions(-) diff --git a/lua/lvim/config/init.lua b/lua/lvim/config/init.lua index a3c5af24..fba6213d 100644 --- a/lua/lvim/config/init.lua +++ b/lua/lvim/config/init.lua @@ -98,28 +98,20 @@ 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.core" then - package.loaded[module] = nil - table.insert(lvim_modules, module) - end - end + package.loaded["lvim.utils.hooks"] = nil + local _, hooks = pcall(require, "lvim.utils.hooks") + hooks.run_pre_reload() M:init() M:load() + require("lvim.core.autocmds").configure_format_on_save() + local plugins = require "lvim.plugins" - local autocmds = require "lvim.core.autocmds" - autocmds.configure_format_on_save() local plugin_loader = require "lvim.plugin-loader" - plugin_loader.cache_clear() + plugin_loader.load { plugins, lvim.plugins } - vim.cmd ":PackerInstall" - vim.cmd ":PackerCompile" - -- vim.cmd ":PackerClean" - require("lvim.lsp").setup() - Log:info "Reloaded configuration" + hooks.run_post_reload() end return M diff --git a/lua/lvim/lsp/utils.lua b/lua/lvim/lsp/utils.lua index 7cc8f54f..7659972e 100644 --- a/lua/lvim/lsp/utils.lua +++ b/lua/lvim/lsp/utils.lua @@ -22,11 +22,12 @@ function M.get_active_clients_by_ft(filetype) end function M.get_client_capabilities(client_id) + local client if not client_id then local buf_clients = vim.lsp.buf_get_clients() - for _, buf_client in ipairs(buf_clients) do + for _, buf_client in pairs(buf_clients) do if buf_client.name ~= "null-ls" then - client_id = buf_client.id + client = buf_client break end end @@ -36,8 +37,6 @@ function M.get_client_capabilities(client_id) return end - local client = vim.lsp.get_client_by_id(tonumber(client_id)) - local enabled_caps = {} for capability, status in pairs(client.resolved_capabilities) do if status == true then diff --git a/lua/lvim/plugin-loader.lua b/lua/lvim/plugin-loader.lua index 5bde8b1b..c5220d59 100644 --- a/lua/lvim/plugin-loader.lua +++ b/lua/lvim/plugin-loader.lua @@ -28,7 +28,13 @@ function plugin_loader.init(opts) package_root = package_root, compile_path = compile_path, log = { level = log_level }, - git = { clone_timeout = 300 }, + git = { + clone_timeout = 300, + subcommands = { + -- this is more efficient than what Packer is using + fetch = "fetch --no-tags --no-recurse-submodules --update-shallow --progress", + }, + }, max_jobs = 50, display = { open_fn = function() @@ -36,6 +42,8 @@ function plugin_loader.init(opts) end, }, } + + vim.cmd [[autocmd User PackerComplete lua require('lvim.utils.hooks').run_on_packer_complete()]] end -- packer expects a space separated list @@ -104,4 +112,11 @@ function plugin_loader.sync_core_plugins() pcall_packer_command("sync", core_plugins) end +function plugin_loader.ensure_installed() + plugin_loader.cache_clear() + local all_plugins = _G.packer_plugins or plugin_loader.get_core_plugins() + Log:trace(string.format("Syncing core plugins: [%q]", table.concat(all_plugins, ", "))) + pcall_packer_command("install", all_plugins) +end + return plugin_loader diff --git a/lua/lvim/utils/hooks.lua b/lua/lvim/utils/hooks.lua index 1d265482..9b02b958 100644 --- a/lua/lvim/utils/hooks.lua +++ b/lua/lvim/utils/hooks.lua @@ -1,38 +1,64 @@ local M = {} -local plugin_loader = require "lvim.plugin-loader" 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() if package.loaded["lspconfig"] then vim.cmd [[ LspStop ]] end end +function M.run_pre_reload() + Log:debug "Starting pre-reload hook" + if package.loaded["lspconfig"] then + vim.cmd [[ LspStop ]] + end +end + +function M.run_on_packer_complete() + require("lvim.plugin-loader").recompile() + -- forcefully activate nvim-web-devicons + require("nvim-web-devicons").set_up_highlights() + Log:info "Reloaded configuration" +end + +function M.run_post_reload() + Log:debug "Starting post-reload hook" + if package.loaded["lspconfig"] then + vim.cmd [[ LspRestart ]] + end + + M.reset_cache() + require("lvim.plugin-loader").ensure_installed() +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("lvim.plugin-loader").recompile() - package.loaded["lvim.lsp.templates"] = nil - - Log:debug "Re-generatring ftplugin template files" + local impatient = _G.__luacache + if impatient then + impatient.clear_cache() + end + local lvim_modules = {} + for module, _ in pairs(package.loaded) do + if module:match "lvim.core" or module:match "lvim.lsp" then + package.loaded[module] = nil + table.insert(lvim_modules, module) + end + end + Log:trace(string.format("Cache invalidated for core modules: { %s }", table.concat(lvim_modules, ", "))) require("lvim.lsp.templates").generate_templates() end function M.run_post_update() Log:debug "Starting post-update hook" - - Log:debug "Re-generatring ftplugin template files" - package.loaded["lvim.lsp.templates"] = nil - require("lvim.lsp.templates").generate_templates() + M.reset_cache() Log:debug "Updating core plugins" - plugin_loader:sync_core_plugins() + require("lvim.plugin-loader").ensure_installed() if not in_headless then vim.schedule(function() -- cgit v1.2.3 From cbb94752aef70e69e4df7b5ad270e33a7722a00c Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Sat, 11 Dec 2021 12:16:36 +0330 Subject: feat: bump plugin versions (#2064) Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com> --- lua/lvim/core/lualine/components.lua | 2 +- lua/lvim/lsp/config.lua | 3 +++ lua/lvim/plugins.lua | 42 ++++++++++++++++++------------------ 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/lua/lvim/core/lualine/components.lua b/lua/lvim/core/lualine/components.lua index c0482c02..9cf67616 100644 --- a/lua/lvim/core/lualine/components.lua +++ b/lua/lvim/core/lualine/components.lua @@ -65,7 +65,7 @@ return { }, diagnostics = { "diagnostics", - sources = { "nvim_lsp" }, + sources = { "nvim_diagnostic" }, symbols = { error = " ", warn = " ", info = " ", hint = " " }, color = {}, cond = conditions.hide_in_width, diff --git a/lua/lvim/lsp/config.lua b/lua/lvim/lsp/config.lua index a990f8c7..d4e2a741 100644 --- a/lua/lvim/lsp/config.lua +++ b/lua/lvim/lsp/config.lua @@ -60,6 +60,7 @@ return { override = { "angularls", "ansiblels", + "ccls", "csharp_ls", "denols", "ember", @@ -71,10 +72,12 @@ return { "ltex", "phpactor", "pylsp", + "quick_lint_js", "rome", "sorbet", "sqlls", "sqls", + "spectral", "stylelint_lsp", "tailwindcss", "tflint", diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 0e51eba1..39760397 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -1,38 +1,38 @@ local commit = { barbar = "6e638309efcad2f308eb9c5eaccf6f62b794bbab", - cmp_buffer = "a706dc69c49110038fe570e5c9c33d6d4f67015b", - cmp_luasnip = "16832bb50e760223a403ffa3042859845dd9ef9d", + cmp_buffer = "a0fe52489ff6e235d62407f8fa72aef80222040a", + cmp_luasnip = "75bf6434f175206cd219f9d2bbcae154a009346c", cmp_nvim_lsp = "134117299ff9e34adde30a735cd8ca9cf8f3db81", cmp_nvim_lua = "d276254e7198ab7d00f117e88e223b4bd8c02d21", cmp_path = "d83839ae510d18530c6d36b662a9e806d4dceb73", - comment = "a6e1c127fa7f19ec4e3edbffab1aacb2852b6db3", + comment = "58d489fb7f18c3652adf7e8e1fff9d3281a8fc6a", dapinstall = "dd09e9dd3a6e29f02ac171515b8a089fb82bb425", fixcursorhold = "0e4e22d21975da60b0fd2d302285b3b603f9f71e", - friendly_snippets = "e3506d575e120253b4aa47ec2100786fd1e9c38d", - gitsigns = "119ebde2de917399aa89ad3664000a0e1750895a", - lualine = "1ae4f0aa74f0b34222c5ef3281b34602a76b2b00", - luasnip = "4191d3e475b65407b8ccf47e4dcbf38552fdbb2d", - nlsp_settings = "199bc1b2859206488423b676da4a7d010b1a3373", - null_ls = "73420db2b58408a60a19024be3c14b0eba8413fe", - nvim_autopairs = "18fe311bb967d16ddf2cc28e7e71f234c37d3e26", - nvim_cmp = "d12ba90da372bfe5d9a103546ce1553341a2daff", - nvim_dap = "ce4e56f76598881d020e68037ae91310ea8b9d54", - nvim_lsp_installer = "4df84d7d3e8bcc9b98a1436b6b4155b3a727d41d", - nvim_lspconfig = "382712c4ecba5816f398379dd9d8c8200b025ca3", - nvim_notify = "3f7af5878a890503f9efb7de9f2a0b3f895ad518", - nvim_tree = "e842f088847c98da59e14eb543bde11c45c87ef7", - nvim_treesitter = "d6a0a26b8563409d4660def7320a4f4bc23954df", + friendly_snippets = "4a9516c116f8d3a5766fcb8ac91b176979612d5d", + gitsigns = "aaf680472187798d5945e39179b540bd3bf80341", + lualine = "5596c2a25a49ca235613c804169b9063e20b05f5", + luasnip = "577045e9adf325e58f690f4d4b4a293f3dcec1b3", + nlsp_settings = "599edc32707f53bd9b0739879f013b3bf162ea4e", + null_ls = "fb9e2a64ae8e43c2255025064cfee37dc7d6a752", + nvim_autopairs = "04cd1779f81e9d50d5a116c5dccd054b275bd191", + nvim_cmp = "af07ff9b7973e95eff9e0275e13fe0350281208b", + nvim_dap = "3b3027e0ca98775000e1ba727d8f292e821f9f03", + nvim_lsp_installer = "fcd5d79a7f4966645e9d2f512b85b72f7de0dde2", + nvim_lspconfig = "e6d95863a336b7e52c92b38c62aa60b469254d14", + nvim_notify = "ef027e34b618eac42fb0111c1db670ba01793039", + nvim_tree = "2e33b1654384921ec1cc9656a2018744f3f1ce81", + nvim_treesitter = "1d66657e6d0f1f8f79ddc48ff1dac9788694cc2d", nvim_ts_context_commentstring = "9f5e422e1030e7073e593ad32c5354aa0bcb0176", - nvim_web_devicons = "8df4988ecf8599fc1f8f387bbf2eae790e4c5ffb", + nvim_web_devicons = "344331467509802e1af200f08ec3da278be5cbba", packer = "851c62c5ecd3b5adc91665feda8f977e104162a5", - plenary = "1c31adb35fcebe921f65e5c6ff6d5481fa5fa5ac", + plenary = "e6267f79481064eee53950571f53cbaafb08417d", popup = "b7404d35d5d3548a82149238289fa71f7f6de4ac", project = "71d0e23dcfc43cfd6bb2a97dc5a7de1ab47a6538", structlog = "6f1403a192791ff1fa7ac845a73de9e860f781f1", - telescope = "27294d73e4562cbc83c9c488b4618f012deade7e", + telescope = "80cdb00b221f69348afc4fb4b701f51eb8dd3120", -- see telescope.nvim#1549 telescope_fzf_native = "b8662b076175e75e6497c59f3e2799b879d7b954", toggleterm = "265bbff68fbb8b2a5fb011272ec469850254ec9f", - which_key = "d3032b6d3e0adb667975170f626cb693bfc66baa", + which_key = "0fd9de78fe09215e1b7c6173ff1b0b90c8ed6ec4", } return { -- cgit v1.2.3 From abf127db83794569af204c017c0e003a5e9e63c9 Mon Sep 17 00:00:00 2001 From: Chase Colman Date: Sat, 11 Dec 2021 16:57:52 +0800 Subject: fix(terminal): allow disabling the open binding for toggleterm --- lua/lvim/core/terminal.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/lvim/core/terminal.lua b/lua/lvim/core/terminal.lua index 20485cda..7eb343ce 100644 --- a/lua/lvim/core/terminal.lua +++ b/lua/lvim/core/terminal.lua @@ -60,7 +60,9 @@ M.setup = function() direction = lvim.builtin.terminal.direction, size = lvim.builtin.terminal.size, } - M.add_exec(default_term_opts) + if lvim.builtin.terminal.open_mapping then + M.add_exec(default_term_opts) + end for i, exec in pairs(lvim.builtin.terminal.execs) do local opts = { -- cgit v1.2.3 From 872061e179a9e887a0bf8da5d0f2b2f57df1fc66 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sat, 11 Dec 2021 19:52:34 +0100 Subject: fix(installer): better handling of existing files (#2066) --- utils/installer/install.sh | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 722144e3..66205b10 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -12,6 +12,8 @@ declare -r XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-"$HOME/.config"}" declare -r LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$XDG_DATA_HOME/lunarvim"}" declare -r LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/lvim"}" +declare -r LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-"$LUNARVIM_RUNTIME_DIR/lvim"}" + # TODO: Use a dedicated cache directory #1256 declare -r LUNARVIM_CACHE_DIR="$XDG_CACHE_HOME/nvim" @@ -109,17 +111,16 @@ function main() { verify_lvim_dirs - if [ -e "$LUNARVIM_RUNTIME_DIR/lvim/init.lua" ]; then - update_lvim + if [ "$ARGS_LOCAL" -eq 1 ]; then + link_local_lvim + elif [ -e "$LUNARVIM_BASE_DIR/init.lua" ]; then + validate_lunarvim_files else - if [ "$ARGS_LOCAL" -eq 1 ]; then - link_local_lvim - else - clone_lvim - fi - setup_lvim + clone_lvim fi + setup_lvim + msg "Thank you for installing LunarVim!!" echo "You can start it by running: $INSTALL_PREFIX/bin/lvim" echo "Do not forget to use a font with glyphs (icons) support [https://github.com/ryanoasis/nerd-fonts]" @@ -181,6 +182,15 @@ function check_neovim_min_version() { fi } +function validate_lunarvim_files() { + local verify_version_cmd='if v:errmsg != "" | cquit | else | quit | endif' + if ! "$INSTALL_PREFIX/bin/lvim" --headless -c 'LvimUpdate' -c "$verify_version_cmd" &>/dev/null; then + msg "Removing old installation files" + rm -rf "$LUNARVIM_BASE_DIR" + clone_lvim + fi +} + function check_system_deps() { if ! command -v git &>/dev/null; then print_missing_dep_msg "git" @@ -301,7 +311,7 @@ function backup_old_config() { function clone_lvim() { msg "Cloning LunarVim configuration" if ! git clone --branch "$LV_BRANCH" \ - --depth 1 "https://github.com/${LV_REMOTE}" "$LUNARVIM_RUNTIME_DIR/lvim"; then + --depth 1 "https://github.com/${LV_REMOTE}" "$LUNARVIM_BASE_DIR"; then echo "Failed to clone repository. Installation failed." exit 1 fi @@ -311,13 +321,13 @@ function link_local_lvim() { echo "Linking local LunarVim repo" # Detect whether it's a symlink or a folder - if [ -d "$LUNARVIM_RUNTIME_DIR/lvim" ]; then + if [ -d "$LUNARVIM_BASE_DIR" ]; then echo "Removing old installation files" - rm -rf "$LUNARVIM_RUNTIME_DIR/lvim" + rm -rf "$LUNARVIM_BASE_DIR" fi - echo " - $BASEDIR -> $LUNARVIM_RUNTIME_DIR/lvim" - ln -s -f "$BASEDIR" "$LUNARVIM_RUNTIME_DIR/lvim" + echo " - $BASEDIR -> $LUNARVIM_BASE_DIR" + ln -s -f "$BASEDIR" "$LUNARVIM_BASE_DIR" } function setup_shim() { @@ -356,7 +366,7 @@ function setup_lvim() { setup_shim - cp "$LUNARVIM_RUNTIME_DIR/lvim/utils/installer/config.example.lua" "$LUNARVIM_CONFIG_DIR/config.lua" + cp "$LUNARVIM_BASE_DIR/utils/installer/config.example.lua" "$LUNARVIM_CONFIG_DIR/config.lua" echo "Preparing Packer setup" @@ -367,10 +377,6 @@ function setup_lvim() { echo "Packer setup complete" } -function update_lvim() { - "$INSTALL_PREFIX/bin/lvim" --headless +'LvimUpdate' +q -} - function print_logo() { cat <<'EOF' -- cgit v1.2.3 From f7d883b6b92d66c222fd0d4e3d398c1f4fcea882 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sat, 11 Dec 2021 20:08:25 +0100 Subject: feat(installer): nicer rsync output (#2067) --- utils/installer/install.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 66205b10..d420baed 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -106,14 +106,13 @@ function main() { [ "$answer" != "${answer#[Yy]}" ] && install_rust_deps fi - msg "Backing up old LunarVim configuration" backup_old_config verify_lvim_dirs if [ "$ARGS_LOCAL" -eq 1 ]; then link_local_lvim - elif [ -e "$LUNARVIM_BASE_DIR/init.lua" ]; then + elif [ -d "$LUNARVIM_BASE_DIR" ]; then validate_lunarvim_files else clone_lvim @@ -287,9 +286,9 @@ function backup_old_config() { fi mkdir -p "$dir.bak" touch "$dir/ignore" + msg "Backing up old $dir to $dir.bak" if command -v rsync &>/dev/null; then - rsync --archive -hh --partial --progress --cvs-exclude \ - --modify-window=1 "$dir"/ "$dir.bak" + rsync --archive -hh --stats --partial --cvs-exclude "$dir"/ "$dir.bak" else OS="$(uname -s)" case "$OS" in @@ -305,7 +304,7 @@ function backup_old_config() { esac fi done - echo "Backup operation complete" + msg "Backup operation complete" } function clone_lvim() { -- cgit v1.2.3 From 162ed3417244e2e9a46c3d09e3dbe52392cf31ba Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sat, 11 Dec 2021 20:21:42 +0100 Subject: ci: add git-cliff integration --- .github/workflows/changelog.yml | 22 ++++++++++++ .github/workflows/cliff.toml | 79 +++++++++++++++++++++++++++++++++++++++++ CHANGELOG.md | 71 ++++++++++++++++++++++++++++++++++++ 3 files changed, 172 insertions(+) create mode 100644 .github/workflows/changelog.yml create mode 100644 .github/workflows/cliff.toml create mode 100644 CHANGELOG.md diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml new file mode 100644 index 00000000..74b20dc7 --- /dev/null +++ b/.github/workflows/changelog.yml @@ -0,0 +1,22 @@ +name: changelog +on: release + +jobs: + changelog-gen: + name: Generate changelog + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - uses: orhun/git-cliff-action@v1 + with: + config: cliff.toml + args: -vv --latest --strip header -c .github/workflows/cliff.toml + env: + OUTPUT: CHANGELOG.md + + - name: Print the changelog + run: cat "${{ steps.git-cliff.outputs.changelog }}" diff --git a/.github/workflows/cliff.toml b/.github/workflows/cliff.toml new file mode 100644 index 00000000..83c010b6 --- /dev/null +++ b/.github/workflows/cliff.toml @@ -0,0 +1,79 @@ +# configuration file for git-cliff (0.1.0) + +[changelog] +# changelog header +header = """ +# Changelog\n +All notable changes to this project will be documented in this file.\n +""" +# template for the changelog body +# https://tera.netlify.app/docs/#introduction +body = """ +{% if version %}\ + ## [{{ version | trim_start_matches(pat="v") }}] +{% else %}\ + ## [unreleased] +{% endif %}\ +{% for group, commits in commits | group_by(attribute="group") %} + ### {{ group | upper_first }} + {% for commit in commits + | filter(attribute="scope") + | sort(attribute="scope") %} + - _({{commit.scope}})_ {{ commit.message | upper_first }} + {%- if commit.breaking %} + {% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}} + {%- endif -%} + {%- endfor %} + {% for commit in commits %} + {%- if commit.scope -%} + {% else -%} + - {{ commit.message | upper_first }} + {% if commit.breaking -%} + {% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}} + {% endif -%} + {% endif -%} + {% endfor -%} + {% raw %}{% endraw %}\ +{% endfor %}\n +""" +# remove the leading and trailing whitespaces from the template +trim = true +# changelog footer +footer = """ + +""" + +[git] +# allow only conventional commits +# https://www.conventionalcommits.org +conventional_commits = true +# filter out the commits that are not conventional +filter_unconventional = true +# regex for parsing and grouping commits +commit_parsers = [ + { message = "^build", group = " Packaging"}, + { message = "^feat", group = " Features"}, + { message = "(^bug|^Bug|^fix)", group = " Bugfix"}, + { message = "^refactor", group = " Refactor"}, + { message = "^chore", group = " Miscellaneous Tasks"}, + { message = "^doc", group = " Documentation"}, + { message = "^revert", group = " Revert"}, + { message = "^perf", group = " Performance"}, + { message = "^test", group = " Testing"}, + { message = "^ci", group = "CI", skip = true}, +] +# filter out the commits that are not matched by commit parsers +filter_commits = false +# glob pattern for matching git tags +tag_pattern = "v[0-9]*" +# regex for skipping tags +skip_tags = "v0.1.0-beta.1" +# regex for ignoring tags +ignore_tags = "" +# sort the tags topologically +topo_order = false +# sort the commits inside sections by oldest/newest order +sort_commits = "oldest" + +[features] +preserve_order = ["serde_json/preserve_order"] diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..7490eb9b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,71 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +## [1.0.0-rc] + +### Features + +- _(installer)_ Nicer rsync output (#2067) +- _(terminal)_ Lazygit can now be toggled (#2039) +- Add lualine config for darkplus +- Last updates before 1.0.0 (#1953) +- Support new null-ls (#1955) +- Empty for empty buffers instead of Buffer <#> +- Improved LSP grouping in lualine +- Decrease hide in width limit for lualine +- Add support for fsharp (#2021) +- Add some messages in uninstall.sh (#1945) +- Null-ls code_actions interface (#2008) +- Full compatibility with neovim v0.6 (#2037) +- Multiple enhancements to lvim-reload (#2054) +- Bump plugin versions (#2064) + +### Bugfix + +- _(autopairs)_ Add missing configuration entries (#2030) +- _(bootstrap)_ Remove hard-coded spellfile option (#2061) +- _(cmp)_ Revert broken sequential loading (#2002) +- _(installer)_ Better handling of existing files (#2066) +- _(lsp)_ Avoid installing an overridden server (#1981) +- _(lsp)_ Prevent repeated setup call (#2048) +- _(lualine)_ Change `fg` of section `a` in onedarker (#1909) +- _(null-ls)_ Allow the same linter and formatter (#1968) +- _(nvimtree)_ Update settings (#2001) +- _(nvimtree)_ Restore default mappings + make them customizable (#2007) +- _(nvimtree)_ Handle paths containing spaces (#2027) +- _(plugins)_ Typo of pin commit of `treesitter` (#2046) +- _(terminal)_ Allow disabling the open binding for toggleterm +- _(windows)_ Autocmd requires forward slashes (#1967) +- _(windows)_ Remove redundant `resolve` call (#1974) +- Bump nvim-tree version +- Formatting +- Remove duplicate lint messages +- Allow LunarVim changelog to work outside the lvim directory (#1952) +- Use an indepdent shadafile from neovim (#1910) +- Packersync issue when you have large number of plugins (#1922) +- No idea why this breaks barbar +- Lsp root can get very annoying when working with multiple languages. User is still able to turn it on. +- Update jdtls script +- Correct order for cmp's setup (#1999) +- Dont close if next char is a close pair and no pairs in same line (#2017) +- More accessible changelog (#2019) +- Better default, ignore `.git` in `live_grep` (#2020) +- No restart required when changing colorscheme (#2026) +- No longer treat lazygit missing as an error (#2051) + +### Refactor + +- Deprecate lvim.lang.FOO (#1913) (#1914) +- More configurable format-on-save (#1937) +- Load the default keymaps once (#1965) + +### Miscellaneous Tasks + +- Pin cmp related plugins (#1917) +- Update lsp installer (#1930) +- Bump core-plugins version (#1989) +- Bump core-plugins' version (#2018) +- Bump core-plugins version (#2031) + + -- cgit v1.2.3 From 53bb4effbc645ed75fc13f38b4e4f58db8d4ebe1 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sat, 11 Dec 2021 21:19:20 +0100 Subject: chore(terminal): avoid problematic layzgit mapping (#2068) --- lua/lvim/core/terminal.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lua/lvim/core/terminal.lua b/lua/lvim/core/terminal.lua index 7eb343ce..c5d1ea04 100644 --- a/lua/lvim/core/terminal.lua +++ b/lua/lvim/core/terminal.lua @@ -40,9 +40,8 @@ M.config = function() -- lvim.builtin.terminal.execs = {{}} to overwrite -- lvim.builtin.terminal.execs[#lvim.builtin.terminal.execs+1] = {"gdb", "tg", "GNU Debugger"} execs = { - -- TODO: this should probably be removed since it's hard to hit gg within the timeoutlen { "lazygit", "gg", "LazyGit", "float" }, - { "lazygit", "", "LazyGit", "float" }, + { "lazygit", "", "LazyGit", "float" }, }, } end -- cgit v1.2.3 From 8ffbe596c0c1d3a03bf2913538c156210211a37c Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sun, 12 Dec 2021 19:43:35 +0100 Subject: fix(lsp): correct client_id parsing in lvim-info (#2071) --- lua/lvim/lsp/utils.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/lvim/lsp/utils.lua b/lua/lvim/lsp/utils.lua index 7659972e..df3846ce 100644 --- a/lua/lvim/lsp/utils.lua +++ b/lua/lvim/lsp/utils.lua @@ -31,8 +31,10 @@ function M.get_client_capabilities(client_id) break end end + else + client = vim.lsp.get_client_by_id(tonumber(client_id)) end - if not client_id then + if not client then error "Unable to determine client_id" return end -- cgit v1.2.3 From ab7a175bff611fc126ceb694d140233af7e40b33 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sun, 12 Dec 2021 19:48:27 +0100 Subject: chore: update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7490eb9b..6c3cbb06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ All notable changes to this project will be documented in this file. - _(installer)_ Better handling of existing files (#2066) - _(lsp)_ Avoid installing an overridden server (#1981) - _(lsp)_ Prevent repeated setup call (#2048) +- _(lsp)_ Correct client_id parsing in lvim-info (#2071) - _(lualine)_ Change `fg` of section `a` in onedarker (#1909) - _(null-ls)_ Allow the same linter and formatter (#1968) - _(nvimtree)_ Update settings (#2001) @@ -62,6 +63,7 @@ All notable changes to this project will be documented in this file. ### Miscellaneous Tasks +- _(terminal)_ Avoid problematic layzgit mapping (#2068) - Pin cmp related plugins (#1917) - Update lsp installer (#1930) - Bump core-plugins version (#1989) -- cgit v1.2.3 From be4b025f92652ac6cc46b9c3f00ab527a6ece6fc Mon Sep 17 00:00:00 2001 From: edag94 Date: Mon, 13 Dec 2021 11:33:18 -0500 Subject: feat: update lsp-installer and lspconfig hashes to enable solidity_ls language server (#2072) Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com> --- lua/lvim/lsp/config.lua | 1 + lua/lvim/plugins.lua | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/lvim/lsp/config.lua b/lua/lvim/lsp/config.lua index d4e2a741..1fbaf3a9 100644 --- a/lua/lvim/lsp/config.lua +++ b/lua/lvim/lsp/config.lua @@ -77,6 +77,7 @@ return { "sorbet", "sqlls", "sqls", + "solang", "spectral", "stylelint_lsp", "tailwindcss", diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 39760397..8ef72bda 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -17,8 +17,8 @@ local commit = { nvim_autopairs = "04cd1779f81e9d50d5a116c5dccd054b275bd191", nvim_cmp = "af07ff9b7973e95eff9e0275e13fe0350281208b", nvim_dap = "3b3027e0ca98775000e1ba727d8f292e821f9f03", - nvim_lsp_installer = "fcd5d79a7f4966645e9d2f512b85b72f7de0dde2", - nvim_lspconfig = "e6d95863a336b7e52c92b38c62aa60b469254d14", + nvim_lsp_installer = "d7b10b13d72d4bf8f7b34779ddc3514bcc26b0f2", + nvim_lspconfig = "2293320aa824e25327c5a10675ae091d1ff83fbc", nvim_notify = "ef027e34b618eac42fb0111c1db670ba01793039", nvim_tree = "2e33b1654384921ec1cc9656a2018744f3f1ce81", nvim_treesitter = "1d66657e6d0f1f8f79ddc48ff1dac9788694cc2d", -- cgit v1.2.3 From 683a89b543567ab2ddab1e8a2b1fe6c97f323e03 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Mon, 13 Dec 2021 17:34:22 +0100 Subject: fix(lsp): allow overriding servers with custom providers (#2070) --- lua/lvim/lsp/templates.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lua/lvim/lsp/templates.lua b/lua/lvim/lsp/templates.lua index 33c75a6e..3478f4fb 100644 --- a/lua/lvim/lsp/templates.lua +++ b/lua/lvim/lsp/templates.lua @@ -19,8 +19,7 @@ end ---@param server_name string name of a valid language server, e.g. pyright, gopls, tsserver, etc. ---@param dir string the full path to the desired directory function M.generate_ftplugin(server_name, dir) - local has_custom_provider, _ = pcall(require, "lvim/lsp/providers/" .. server_name) - if vim.tbl_contains(lvim.lsp.override, server_name) and not has_custom_provider then + if vim.tbl_contains(lvim.lsp.override, server_name) then return end -- cgit v1.2.3 From b09ada89402e668ea1636bdbf671a89330199717 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Mon, 13 Dec 2021 17:40:24 +0100 Subject: ci: tweak git-cliff's settings to ignore chores --- .github/workflows/cliff.toml | 12 ++++++------ .github/workflows/commitlint.yml | 7 ++++++- CHANGELOG.md | 11 ++--------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/.github/workflows/cliff.toml b/.github/workflows/cliff.toml index 83c010b6..372ecf3f 100644 --- a/.github/workflows/cliff.toml +++ b/.github/workflows/cliff.toml @@ -55,12 +55,12 @@ commit_parsers = [ { message = "^feat", group = " Features"}, { message = "(^bug|^Bug|^fix)", group = " Bugfix"}, { message = "^refactor", group = " Refactor"}, - { message = "^chore", group = " Miscellaneous Tasks"}, - { message = "^doc", group = " Documentation"}, - { message = "^revert", group = " Revert"}, - { message = "^perf", group = " Performance"}, - { message = "^test", group = " Testing"}, - { message = "^ci", group = "CI", skip = true}, + { message = "^doc", group = " Documentation"}, + { message = "^revert", group = " Revert"}, + { message = "^perf", group = " Performance"}, + { message = "^chore", group = " Miscellaneous Tasks", skip = true}, + { message = "^ci", group = " Miscellaneous Tasks", skip = true}, + { message = "^test", group = " Miscellaneous Tasks", skip = true}, ] # filter out the commits that are not matched by commit parsers filter_commits = false diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index 93c776e3..1bae3a10 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -1,5 +1,9 @@ name: "Commit Linter" -on: pull_request +on: + pull_request: + branches: + - "rolling" + jobs: lint-commits: runs-on: ubuntu-latest @@ -13,3 +17,4 @@ jobs: with: configFile: .github/workflows/commitlint.config.js helpURL: https://github.com/LunarVim/LunarVim/blob/rolling/CONTRIBUTING.md#commit-messages + firstParent: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c3cbb06..f318882d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ All notable changes to this project will be documented in this file. - Full compatibility with neovim v0.6 (#2037) - Multiple enhancements to lvim-reload (#2054) - Bump plugin versions (#2064) +- Update lsp-installer and lspconfig hashes to enable solidity_ls language server (#2072) ### Bugfix @@ -30,6 +31,7 @@ All notable changes to this project will be documented in this file. - _(lsp)_ Avoid installing an overridden server (#1981) - _(lsp)_ Prevent repeated setup call (#2048) - _(lsp)_ Correct client_id parsing in lvim-info (#2071) +- _(lsp)_ Allow overriding servers with custom providers (#2070) - _(lualine)_ Change `fg` of section `a` in onedarker (#1909) - _(null-ls)_ Allow the same linter and formatter (#1968) - _(nvimtree)_ Update settings (#2001) @@ -61,13 +63,4 @@ All notable changes to this project will be documented in this file. - More configurable format-on-save (#1937) - Load the default keymaps once (#1965) -### Miscellaneous Tasks - -- _(terminal)_ Avoid problematic layzgit mapping (#2068) -- Pin cmp related plugins (#1917) -- Update lsp installer (#1930) -- Bump core-plugins version (#1989) -- Bump core-plugins' version (#2018) -- Bump core-plugins version (#2031) - -- cgit v1.2.3