diff options
Diffstat (limited to 'lua')
-rw-r--r-- | lua/lvim/bootstrap.lua | 5 | ||||
-rw-r--r-- | lua/lvim/config/init.lua | 12 | ||||
-rw-r--r-- | lua/lvim/core/builtins/init.lua | 1 | ||||
-rw-r--r-- | lua/lvim/core/notify.lua | 72 | ||||
-rw-r--r-- | lua/lvim/core/nvimtree.lua | 17 | ||||
-rw-r--r-- | lua/lvim/core/telescope.lua | 6 | ||||
-rw-r--r-- | lua/lvim/core/theme.lua | 4 | ||||
-rw-r--r-- | lua/lvim/keymappings.lua | 15 | ||||
-rw-r--r-- | lua/lvim/lsp/config.lua | 2 | ||||
-rw-r--r-- | lua/lvim/plugins.lua | 8 |
10 files changed, 31 insertions, 111 deletions
diff --git a/lua/lvim/bootstrap.lua b/lua/lvim/bootstrap.lua index 5d980498..55a22502 100644 --- a/lua/lvim/bootstrap.lua +++ b/lua/lvim/bootstrap.lua @@ -10,7 +10,6 @@ end 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 @@ -96,9 +95,7 @@ function M:init(base_dir) vim.cmd [[let &packpath = &runtimepath]] end - -- FIXME: currently unreliable in unit-tests - if not in_headless then - _G.PLENARY_DEBUG = false + if not vim.env.LVIM_TEST_ENV then require "lvim.impatient" end diff --git a/lua/lvim/config/init.lua b/lua/lvim/config/init.lua index 59722673..ae5dd601 100644 --- a/lua/lvim/config/init.lua +++ b/lua/lvim/config/init.lua @@ -46,6 +46,11 @@ function M:init() friendly_snippets = true, }, } + + ---@deprecated + lvim.builtin.notify = { + active = false + } end local function handle_deprecated_settings() @@ -93,6 +98,13 @@ local function handle_deprecated_settings() deprecation_notice("lvim.builtin.dashboard", "Use `lvim.builtin.alpha` instead. See LunarVim#1906") end + + -- notify.nvim + if lvim.builtin.notify.active then + deprecation_notice("lvim.builtin.notify", "See LunarVim#3294") + end + + if lvim.autocommands.custom_groups then deprecation_notice( "lvim.autocommands.custom_groups", diff --git a/lua/lvim/core/builtins/init.lua b/lua/lvim/core/builtins/init.lua index 0060c460..4764ff70 100644 --- a/lua/lvim/core/builtins/init.lua +++ b/lua/lvim/core/builtins/init.lua @@ -18,7 +18,6 @@ local builtins = { "lvim.core.bufferline", "lvim.core.autopairs", "lvim.core.comment", - "lvim.core.notify", "lvim.core.lualine", "lvim.core.alpha", "lvim.core.mason", diff --git a/lua/lvim/core/notify.lua b/lua/lvim/core/notify.lua deleted file mode 100644 index b08c45a6..00000000 --- a/lua/lvim/core/notify.lua +++ /dev/null @@ -1,72 +0,0 @@ -local M = {} - -local Log = require "lvim.core.log" - -local defaults = { - active = true, - on_config_done = nil, - opts = { - ---@usage Animation style one of { "fade", "slide", "fade_in_slide_out", "static" } - stages = "slide", - - ---@usage Function called when a new window is opened, use for changing win settings/config - on_open = nil, - - ---@usage Function called when a window is closed - on_close = nil, - - ---@usage timeout for notifications in ms, default 5000 - timeout = 5000, - - -- Render function for notifications. See notify-render() - render = "default", - - ---@usage highlight behind the window for stages that change opacity - background_colour = "Normal", - - ---@usage minimum width for notification windows - minimum_width = 50, - - ---@usage Icons for the different levels - icons = { - ERROR = lvim.icons.diagnostics.Error, - WARN = lvim.icons.diagnostics.Warning, - INFO = lvim.icons.diagnostics.Information, - DEBUG = lvim.icons.diagnostics.Debug, - TRACE = lvim.icons.diagnostics.Trace, - }, - }, -} - -function M.config() - if not lvim.use_icons then - defaults.opts.icons = { - ERROR = "[ERROR]", - WARN = "[WARNING]", - INFO = "[INFO]", - DEBUG = "[DEBUG]", - TRACE = "[TRACE]", - } - end - lvim.builtin.notify = vim.tbl_deep_extend("force", defaults, lvim.builtin.notify or {}) -end - -function M.setup() - if #vim.api.nvim_list_uis() == 0 then - -- no need to configure notifications in headless - return - end - - local opts = lvim.builtin.notify and lvim.builtin.notify.opts or defaults - - local status_ok, notify = pcall(require, "notify") - if not status_ok then - return - end - - notify.setup(opts) - vim.notify = notify - Log:configure_notifications(notify) -end - -return M diff --git a/lua/lvim/core/nvimtree.lua b/lua/lvim/core/nvimtree.lua index 199279a6..d98816f5 100644 --- a/lua/lvim/core/nvimtree.lua +++ b/lua/lvim/core/nvimtree.lua @@ -147,23 +147,6 @@ function M.setup() return end - local status_ok_1, utils = pcall(require, "nvim-tree.utils") - if not status_ok_1 then - return - end - - local function notify_level() - return function(msg) - vim.schedule(function() - vim.api.nvim_echo({ { msg, "WarningMsg" } }, false, {}) - end) - end - end - - utils.notify.warn = notify_level(vim.log.levels.WARN) - utils.notify.error = notify_level(vim.log.levels.ERROR) - utils.notify.info = notify_level(vim.log.levels.INFO) - utils.notify.debug = notify_level(vim.log.levels.DEBUG) if lvim.builtin.nvimtree._setup_called then Log:debug "ignoring repeated setup call for nvim-tree, see kyazdani42/nvim-tree.lua#1308" diff --git a/lua/lvim/core/telescope.lua b/lua/lvim/core/telescope.lua index 77bf552d..0cfe0b23 100644 --- a/lua/lvim/core/telescope.lua +++ b/lua/lvim/core/telescope.lua @@ -164,12 +164,6 @@ function M.setup() end) end - if lvim.builtin.notify.active then - pcall(function() - require("telescope").load_extension "notify" - end) - end - if lvim.builtin.telescope.on_config_done then lvim.builtin.telescope.on_config_done(telescope) end diff --git a/lua/lvim/core/theme.lua b/lua/lvim/core/theme.lua index 0f960d3d..efe2b404 100644 --- a/lua/lvim/core/theme.lua +++ b/lua/lvim/core/theme.lua @@ -99,8 +99,8 @@ M.setup = function() -- ref: https://github.com/neovim/neovim/issues/18201#issuecomment-1104754564 local colors = vim.api.nvim_get_runtime_file(("colors/%s.*"):format(lvim.colorscheme), false) if #colors == 0 then - Log:warn(string.format("Could not find '%s' colorscheme", lvim.colorscheme)) - lvim.colorscheme = "tokyonight" + Log:debug(string.format("Could not find '%s' colorscheme", lvim.colorscheme)) + return end vim.g.colors_name = lvim.colorscheme diff --git a/lua/lvim/keymappings.lua b/lua/lvim/keymappings.lua index 0f3bf6ba..d0d46fd7 100644 --- a/lua/lvim/keymappings.lua +++ b/lua/lvim/keymappings.lua @@ -119,6 +119,21 @@ function M.clear(keymaps) 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 diff --git a/lua/lvim/lsp/config.lua b/lua/lvim/lsp/config.lua index 358e83f8..eeba9fb0 100644 --- a/lua/lvim/lsp/config.lua +++ b/lua/lvim/lsp/config.lua @@ -39,7 +39,7 @@ local skipped_servers = { "vuels", } -local skipped_filetypes = { "markdown", "rst", "plaintext" } +local skipped_filetypes = { "markdown", "rst", "plaintext", "toml" } local join_paths = require("lvim.utils").join_paths diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index db84d878..49b6fc23 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -17,14 +17,6 @@ local core_plugins = { { "folke/tokyonight.nvim", }, - { - "rcarriga/nvim-notify", - config = function() - require("lvim.core.notify").setup() - end, - requires = { "nvim-telescope/telescope.nvim" }, - disable = not lvim.builtin.notify.active or not lvim.builtin.telescope.active, - }, { "Tastyep/structlog.nvim" }, { "nvim-lua/popup.nvim" }, |