Skip to content

Commit

Permalink
chore: Remove backward compatibility for Neovim < 0.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kristijanhusak committed Jan 28, 2025
1 parent 271a6fa commit ac78216
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 53 deletions.
2 changes: 1 addition & 1 deletion ftplugin/org.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ vim.bo.modeline = false
vim.opt_local.fillchars:append('fold: ')
vim.opt_local.foldmethod = 'expr'
vim.opt_local.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
if utils.has_version_10() and config.ui.folds.colored then
if config.ui.folds.colored then
vim.opt_local.foldtext = ''
else
vim.opt_local.foldtext = 'v:lua.require("orgmode.org.indent").foldtext()'
Expand Down
6 changes: 0 additions & 6 deletions lua/orgmode/colors/highlighter/foldtext.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ local utils = require('orgmode.utils')
---@class OrgFoldtextHighlighter
---@field highlighter OrgHighlighter
---@field namespace number
---@field enabled number
---@field cache table<number, table<number, OrgFoldtextLineValue>>
local OrgFoldtext = {}

---@param opts { highlighter: OrgHighlighter }
function OrgFoldtext:new(opts)
local data = {
highlighter = opts.highlighter,
enabled = utils.has_version_10(),
cache = setmetatable({}, { __mode = 'k' }),
}
setmetatable(data, self)
Expand All @@ -39,10 +37,6 @@ function OrgFoldtext:_highlight(bufnr, line, value)
end

function OrgFoldtext:on_line(bufnr, line)
if not self.enabled then
return false
end

local is_current_buf = bufnr == vim.api.nvim_get_current_buf()

if not is_current_buf then
Expand Down
37 changes: 0 additions & 37 deletions lua/orgmode/colors/highlights.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,43 +70,6 @@ function M.link_highlights()
['@org.edit_src'] = 'Visual',
}

if not utils.has_version_10() then
links = vim.tbl_extend('force', links, {
['@org.priority.highest'] = 'Error',
['@org.timestamp.active'] = 'PreProc',
['@org.timestamp.inactive'] = 'Comment',
['@org.bullet'] = 'Identifier',
['@org.checkbox'] = 'PreProc',
['@org.checkbox.halfchecked'] = 'PreProc',
['@org.checkbox.checked'] = 'PreProc',
['@org.properties'] = 'Constant',
['@org.properties.name'] = 'Constant',
['@org.drawer'] = 'Constant',
['@org.tag'] = 'Function',
['@org.plan'] = 'Constant',
['@org.comment'] = 'Comment',
['@org.directive'] = 'Comment',
['@org.block'] = 'Comment',
['@org.latex'] = 'Statement',
['@org.latex_env'] = 'Statement',
['@org.hyperlink'] = 'Underlined',
['@org.code'] = 'String',
['@org.code.delimiter'] = 'String',
['@org.verbatim'] = 'String',
['@org.verbatim.delimiter'] = 'String',
['@org.bold'] = { bold = true },
['@org.bold.delimiter'] = { bold = true },
['@org.italic'] = { italic = true },
['@org.italic.delimiter'] = { italic = true },
['@org.strikethrough'] = { strikethrough = true },
['@org.strikethrough.delimiter'] = { strikethrough = true },
['@org.underline'] = { underline = true },
['@org.underline.delimiter'] = { underline = true },
['@org.table.delimiter'] = '@punctuation',
['@org.table.heading'] = '@function',
})
end

for src, def in pairs(links) do
if type(def) == 'table' then
def.default = true
Expand Down
4 changes: 0 additions & 4 deletions lua/orgmode/org/indent.lua
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,6 @@ local function foldtext()
end

local function setup_virtual_indent()
if not utils.has_version_10() then
return
end

local virtualIndent = VirtualIndent:new()

if config.org_startup_indented or vim.b.org_indent_mode then
Expand Down
5 changes: 0 additions & 5 deletions lua/orgmode/utils/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -557,11 +557,6 @@ function utils.edit_file(filename)
}
end

function utils.has_version_10()
local v = vim.version()
return not vim.version.lt({ v.major, v.minor, v.patch }, { 0, 10, 0 })
end

---@generic EntryType : any
---@param entries EntryType[]
---@param check_fn fun(entry: EntryType, index: number): boolean
Expand Down

0 comments on commit ac78216

Please sign in to comment.