diff --git a/lua/neorg/modules/core/concealer/module.lua b/lua/neorg/modules/core/concealer/module.lua index 51ac12173..594db075f 100644 --- a/lua/neorg/modules/core/concealer/module.lua +++ b/lua/neorg/modules/core/concealer/module.lua @@ -65,26 +65,6 @@ end --- end utils ---- TODO: Migrate to `vim.version` when `0.10.0` becomes stable -local has_anticonceal = (function() - if not utils.is_minimum_version(0, 10, 0) then - return false - end - - if utils.is_minimum_version(0, 10, 1) then - return true - end - - local full_version = vim.api.nvim_cmd({ cmd = "version" }, { output = true }) - local _, _, sub_version = string.find(full_version, "-(%d+)[+]") - if not sub_version then - return true - end -- no longer a dev version - sub_version = tonumber(sub_version) - return sub_version and sub_version > 575 -end)() -local has_extmark_invalidation = utils.is_minimum_version(0, 10, 0) - local module = modules.create("core.concealer", { "preset_basic", "preset_varied", @@ -138,12 +118,9 @@ local function set_mark(bufid, row_0b, col_0b, text, highlight, ext_opts) cursorline_hl_group = nil, spell = nil, ui_watched = nil, + invalidate = true, } - if has_extmark_invalidation then - opt["invalidate"] = true - end - if ext_opts then table_extend_in_place(opt, ext_opts) end @@ -461,42 +438,6 @@ local superscript_digits = { ---@class core.concealer module.public = { - foldtext = function() - local foldstart = vim.v.foldstart - local line = vim.api.nvim_buf_get_lines(0, foldstart - 1, foldstart, true)[1] - - return lib.match(line, function(lhs, rhs) - return vim.startswith(lhs, rhs) - end)({ - ["@document.meta"] = "Document Metadata", - _ = function() - local line_length = vim.api.nvim_strwidth(line) - - local icon_extmarks = vim.api.nvim_buf_get_extmarks( - 0, - module.private.ns_icon, - { foldstart - 1, 0 }, - { foldstart - 1, line_length }, - { - details = true, - } - ) - - for _, extmark in ipairs(icon_extmarks) do - local extmark_details = extmark[4] - - for _, virt_text in ipairs(extmark_details.virt_text or {}) do - line = vim.fn.strcharpart(line, 0, extmark[3]) - .. virt_text[1] - .. vim.fn.strcharpart(line, extmark[3] + vim.api.nvim_strwidth(virt_text[1])) - end - end - - return line - end, - }) - end, - icon_renderers = { on_left = function(config, bufid, node) if not config.icon then @@ -526,16 +467,11 @@ module.public = { end local text = (" "):rep(len - 1) .. icon - if vim.fn.strcharlen(text) > len and not has_anticonceal then - -- TODO warn neovim version - return - end local _, first_unicode_end = text:find("[%z\1-\127\194-\244][\128-\191]*", len) local highlight = config.highlights and table_get_default_last(config.highlights, len) set_mark(bufid, row_0b, col_0b, text:sub(1, first_unicode_end), highlight) if vim.fn.strcharlen(text) > len then - assert(has_anticonceal) set_mark(bufid, row_0b, col_0b + len, text:sub(first_unicode_end + 1), highlight, { virt_text_pos = "inline", }) @@ -780,8 +716,7 @@ module.config.public = { render = module.public.icon_renderers.multilevel_on_right(false), }, ordered = { - icons = has_anticonceal and { "1.", "A.", "a.", "(1)", "I.", "i." } - or { "⒈", "A", "a", "⑴", "Ⓐ", "ⓐ" }, + icons = { "1.", "A.", "a.", "(1)", "I.", "i." }, nodes = { "ordered_list1_prefix", "ordered_list2_prefix", @@ -1342,8 +1277,7 @@ local function handle_init_event(event) local wo = vim.wo[event.window] wo.foldmethod = "expr" wo.foldexpr = vim.treesitter.foldexpr and "v:lua.vim.treesitter.foldexpr()" or "nvim_treesitter#foldexpr()" - wo.foldtext = utils.is_minimum_version(0, 10, 0) and "" - or "v:lua.require'neorg'.modules.get_module('core.concealer').foldtext()" + wo.foldtext = "" local init_open_folds = module.config.public.init_open_folds local function open_folds() @@ -1483,18 +1417,17 @@ module.load = function() }, }) end) - if utils.is_minimum_version(0, 7, 0) then - vim.api.nvim_create_autocmd("OptionSet", { - pattern = "conceallevel", - callback = function(_ev) ---@diagnostic disable-line -- TODO: type error workaround - local bufid = vim.api.nvim_get_current_buf() - if vim.bo[bufid].ft ~= "norg" then - return - end - mark_all_lines_changed(bufid) - end, - }) - end + + vim.api.nvim_create_autocmd("OptionSet", { + pattern = "conceallevel", + callback = function() + local bufid = vim.api.nvim_get_current_buf() + if vim.bo[bufid].ft ~= "norg" then + return + end + mark_all_lines_changed(bufid) + end, + }) end module.events.subscribed = { diff --git a/lua/neorg/modules/core/latex/renderer/module.lua b/lua/neorg/modules/core/latex/renderer/module.lua index 3b1be15c3..8a7a8b53d 100644 --- a/lua/neorg/modules/core/latex/renderer/module.lua +++ b/lua/neorg/modules/core/latex/renderer/module.lua @@ -25,8 +25,6 @@ local neorg = require("neorg.core") local module = neorg.modules.create("core.latex.renderer") local modules = neorg.modules -assert(vim.re ~= nil, "Neovim 0.10.0+ is required to run the `core.renderer.latex` module!") - module.setup = function() return { requires = { diff --git a/lua/neorg/modules/core/looking-glass/module.lua b/lua/neorg/modules/core/looking-glass/module.lua index ced822206..17e26f9ec 100644 --- a/lua/neorg/modules/core/looking-glass/module.lua +++ b/lua/neorg/modules/core/looking-glass/module.lua @@ -15,18 +15,11 @@ but you may map it yourself via the [`core.keybinds`](@core.keybinds) module. --]] local neorg = require("neorg.core") -local log, modules, utils = neorg.log, neorg.modules, neorg.utils +local modules, utils = neorg.modules, neorg.utils local module = modules.create("core.looking-glass") module.setup = function() - if not utils.is_minimum_version(0, 7, 0) then - log.error("The `looking-glass` module requires Neovim 0.7+! Please upgrade your Neovim installation.") - return { - success = false, - } - end - return { success = true, requires = { diff --git a/lua/neorg/modules/core/tempus/module.lua b/lua/neorg/modules/core/tempus/module.lua index 0769bdcc2..c4415c657 100644 --- a/lua/neorg/modules/core/tempus/module.lua +++ b/lua/neorg/modules/core/tempus/module.lua @@ -14,8 +14,6 @@ local lib, modules, utils = neorg.lib, neorg.modules, neorg.utils local module = modules.create("core.tempus") -assert(vim.re ~= nil, "Neovim 0.10.0+ is required to run the `core.tempus` module! ") - -- NOTE: Maybe encapsulate whole date parser in a single PEG grammar? local _, time_regex = pcall(vim.re.compile, [[{%d%d?} ":" {%d%d} ("." {%d%d?})?]]) diff --git a/lua/neorg/modules/core/text-objects/module.lua b/lua/neorg/modules/core/text-objects/module.lua index 1da5ee159..8bc886b1b 100644 --- a/lua/neorg/modules/core/text-objects/module.lua +++ b/lua/neorg/modules/core/text-objects/module.lua @@ -4,8 +4,6 @@ summary: A Neorg module for moving and selecting elements of the document. --- -**WARNING:** Requires nvim 0.10+ - - Easily move items up and down in the document - Provides text objects for headings, tags, and lists @@ -13,8 +11,6 @@ Users can create keybinds for some or all of the different events this module exposes. Those are: -those events are: - - `core.text-objects.item_up` - Moves the current "item" up - `core.text-objects.item_down` - same but down - `core.text-objects.textobject.heading.outer` @@ -39,20 +35,12 @@ vim.keymap.set({ "o", "x" }, "aH", "(neorg.text-objects.textobject.heading --]] local neorg = require("neorg.core") -local utils, log, modules, lib = neorg.utils, neorg.log, neorg.modules, neorg.lib +local log, modules, lib = neorg.log, neorg.modules, neorg.lib local ts local module = modules.create("core.text-objects") module.setup = function() - if not utils.is_minimum_version(0, 10, 0) then - log.error("This module requires at least Neovim 0.10 to run!") - - return { - success = false, - } - end - return { success = true, requires = { "core.integrations.treesitter" }, diff --git a/lua/neorg/modules/core/todo-introspector/module.lua b/lua/neorg/modules/core/todo-introspector/module.lua index 7d5806356..e513c3a4a 100644 --- a/lua/neorg/modules/core/todo-introspector/module.lua +++ b/lua/neorg/modules/core/todo-introspector/module.lua @@ -1,5 +1,5 @@ local neorg = require("neorg") -local modules, utils = neorg.modules, neorg.utils +local modules = neorg.modules local module = modules.create("core.todo-introspector") @@ -17,7 +17,6 @@ module.config.public = {} module.setup = function() return { - success = utils.is_minimum_version(0, 10, 0), requires = { "core.integrations.treesitter" }, } end