Skip to content

Commit fe3eaaf

Browse files
feat!: Update minimum Neovim version to 0.9+
1 parent f8f1466 commit fe3eaaf

File tree

12 files changed

+19
-67
lines changed

12 files changed

+19
-67
lines changed

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<a href="/LICENSE">![License](https://img.shields.io/badge/license-MIT-brightgreen?style=flat-square)</a><a href="https://ko-fi.com/kristijanhusak"> ![Kofi](https://img.shields.io/badge/support-kofi-00b9fe?style=flat-square&logo=kofi)</a><a href="https://matrix.to/#/#neovim-orgmode:matrix.org"> ![Chat](https://img.shields.io/matrix/neovim-orgmode:matrix.org?logo=matrix&server_fqdn=matrix.org&style=flat-square)</a>
99

1010

11-
Orgmode clone written in Lua for Neovim 0.8+
11+
Orgmode clone written in Lua for Neovim 0.9+
1212

1313
[Setup](#setup)[Docs](/DOCS.md)[Showcase](#showcase)[Treesitter](#treesitter-info)[Troubleshoot](#troubleshoot)[Plugins](#plugins)[Contributing](CONTRIBUTING.md)[Kudos](#thanks-to)
1414

@@ -19,7 +19,7 @@
1919

2020
### Requirements
2121

22-
* Neovim 0.8.0 or later
22+
* Neovim 0.9.0 or later
2323
* [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
2424

2525
### Installation
@@ -219,8 +219,6 @@ Highlights are experimental and partially supported.
219219
* Allows for easier hacking (custom motions that can work with TS nodes, etc.)
220220

221221
### Known highlighting issues and limitations
222-
* Performance issues. This is generally an issue in Neovim that should be resolved before 0.6 release (https://github.com/neovim/neovim/issues/14762, https://github.com/neovim/neovim/issues/14762)
223-
* Anything that requires concealing ([org_hide_emphasis_markers](/DOCS.md#org_hide_emphasis_markers), links concealing) is not (yet) supported in TS highlighter
224222
* LaTex is still highlighted through syntax file
225223

226224
### Improvements over Vim's syntax highlighting

lua/orgmode/colors/highlights.lua

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ function M.link_ts_highlights()
3232
}
3333

3434
for src, def in pairs(links) do
35-
if vim.fn.has('nvim-0.8') > 0 then
36-
vim.cmd(string.format([[hi link @%s %s]], src, src))
37-
end
35+
vim.cmd(string.format([[hi link @%s %s]], src, src))
3836
vim.cmd(string.format([[hi def link %s %s]], src, def))
3937
end
4038
end
@@ -81,9 +79,7 @@ function M.define_org_todo_keyword_colors(do_syn_match)
8179
)
8280
)
8381
vim.cmd('hi default link OrgTODO OrgTODO_builtin')
84-
if vim.fn.has('nvim-0.8') > 0 then
85-
vim.cmd('hi link @OrgTODO OrgTODO')
86-
end
82+
vim.cmd('hi link @OrgTODO OrgTODO')
8783
vim.cmd(
8884
string.format(
8985
'hi OrgDONE_builtin guifg=%s ctermfg=%s gui=bold cterm=bold',
@@ -92,9 +88,7 @@ function M.define_org_todo_keyword_colors(do_syn_match)
9288
)
9389
)
9490
vim.cmd('hi default link OrgDONE OrgDONE_builtin')
95-
if vim.fn.has('nvim-0.8') > 0 then
96-
vim.cmd('hi link @OrgDONE OrgDONE')
97-
end
91+
vim.cmd('hi link @OrgDONE OrgDONE')
9892
return M.parse_todo_keyword_faces(do_syn_match)
9993
end
10094

@@ -202,9 +196,7 @@ function M.parse_todo_keyword_faces(do_syn_match)
202196
vim.cmd(string.format([[syn match %s "\<%s\>" contained]], hl_name, name))
203197
end
204198
vim.cmd(string.format('hi %s %s', hl_name, hl))
205-
if vim.fn.has('nvim-0.8') > 0 then
206-
vim.cmd(string.format([[hi link @%s %s]], hl_name, hl_name))
207-
end
199+
vim.cmd(string.format([[hi link @%s %s]], hl_name, hl_name))
208200
result[name] = hl_name
209201
end
210202
end

lua/orgmode/colors/markup_highlighter.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
local ts = require('orgmode.treesitter.compat')
21
local config = require('orgmode.config')
32
local ts_utils = require('nvim-treesitter.ts_utils')
43
local query = nil
@@ -216,7 +215,7 @@ local function load_deps()
216215
if query then
217216
return
218217
end
219-
query = ts.get_query('org', 'markup')
218+
query = vim.treesitter.query.get('org', 'markup')
220219
vim.treesitter.query.add_predicate('org-is-valid-markup-range?', is_valid_markup_range)
221220
vim.treesitter.query.add_predicate('org-is-valid-hyperlink-range?', is_valid_hyperlink_range)
222221
vim.treesitter.query.add_predicate('org-is-valid-latex-range?', is_valid_latex_range)

lua/orgmode/colors/todo_highlighter.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
local ts = require('orgmode.treesitter.compat')
21
local config = require('orgmode.config')
32
local highlights = require('orgmode.colors.highlights')
43
local tree_utils = require('orgmode.utils.treesitter')
54
local utils = require('orgmode.utils')
65

76
local function add_todo_keyword_highlights()
8-
local query_files = ts.get_query_files('org', 'highlights')
7+
local query_files = vim.treesitter.query.get_files('org', 'highlights')
98
if not query_files or #query_files == 0 then
109
return
1110
end
@@ -55,7 +54,7 @@ local function add_todo_keyword_highlights()
5554
for _, v in ipairs(lines) do
5655
table.insert(all_lines, v)
5756
end
58-
ts.set_query('org', 'highlights', table.concat(all_lines, '\n'))
57+
vim.treesitter.query.set('org', 'highlights', table.concat(all_lines, '\n'))
5958
if vim.bo.filetype == 'org' then
6059
tree_utils.restart_highlights()
6160
end

lua/orgmode/org/indent.lua

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
local ts = require('orgmode.treesitter.compat')
21
local config = require('orgmode.config')
32
local ts_utils = require('nvim-treesitter.ts_utils')
43
local query = nil
@@ -26,7 +25,7 @@ local get_matches = ts_utils.memoize_by_buf_tick(function(bufnr)
2625
}
2726

2827
if type == 'headline' then
29-
opts.stars = ts.get_node_text(node:field('stars')[1], bufnr):len()
28+
opts.stars = vim.treesitter.get_node_text(node:field('stars')[1], bufnr):len()
3029
opts.indent = opts.indent + opts.stars + 1
3130
matches[range.start.line + 1] = opts
3231
end
@@ -53,7 +52,7 @@ local get_matches = ts_utils.memoize_by_buf_tick(function(bufnr)
5352
end
5453
if parent then
5554
local headline = parent:named_child('headline')
56-
local stars = ts.get_node_text(headline:field('stars')[1], bufnr):len()
55+
local stars = vim.treesitter.get_node_text(headline:field('stars')[1], bufnr):len()
5756
opts.indent = stars + 1
5857
for i = range.start.line, range['end'].line - 1 do
5958
matches[i + 1] = opts
@@ -68,7 +67,7 @@ end)
6867

6968
local prev_section = nil
7069
local function foldexpr()
71-
query = query or ts.get_query('org', 'org_indent')
70+
query = query or vim.treesitter.query.get('org', 'org_indent')
7271
local matches = get_matches(0)
7372
local match = matches[vim.v.lnum]
7473
local next_match = matches[vim.v.lnum + 1]
@@ -115,7 +114,7 @@ end
115114

116115
local function indentexpr()
117116
local noindent_mode = config.org_indent_mode == 'noindent'
118-
query = query or ts.get_query('org', 'org_indent')
117+
query = query or vim.treesitter.query.get('org', 'org_indent')
119118

120119
local prev_linenr = vim.fn.prevnonblank(vim.v.lnum - 1)
121120

lua/orgmode/org/mappings.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ local constants = require('orgmode.utils.constants')
1111
local ts_utils = require('nvim-treesitter.ts_utils')
1212
local utils = require('orgmode.utils')
1313
local ts_org = require('orgmode.treesitter')
14-
local ts = require('orgmode.treesitter.compat')
1514
local ts_table = require('orgmode.treesitter.table')
1615
local EventManager = require('orgmode.events')
1716
local Promise = require('orgmode.utils.promise')
@@ -613,7 +612,7 @@ function OrgMappings:handle_return(suffix)
613612
local counter = 1
614613
while next_sibling do
615614
local bullet = next_sibling:child(0)
616-
local text = ts.get_node_text(bullet, 0)
615+
local text = vim.treesitter.get_node_text(bullet, 0)
617616
local new_text = tostring(tonumber(text:match('%d+')) + 1) .. closer
618617

619618
if counter == 1 then

lua/orgmode/treesitter/compat.lua

Lines changed: 0 additions & 31 deletions
This file was deleted.

lua/orgmode/treesitter/headline.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ local tree_utils = require('orgmode.utils.treesitter')
44
local Date = require('orgmode.objects.date')
55
local Range = require('orgmode.parser.range')
66
local config = require('orgmode.config')
7-
local ts = require('orgmode.treesitter.compat')
7+
local ts = vim.treesitter
88

99
---@class Headline
1010
---@field headline userdata

lua/orgmode/treesitter/listitem.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
local ts_utils = require('nvim-treesitter.ts_utils')
22
local tree_utils = require('orgmode.utils.treesitter')
3-
local ts = require('orgmode.treesitter.compat')
3+
local ts = vim.treesitter
44
local Headline = require('orgmode.treesitter.headline')
55

66
---@class Listitem

lua/orgmode/treesitter/table.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ local ts_utils = require('orgmode.utils.treesitter')
22
local Table = require('orgmode.parser.table')
33
local utils = require('orgmode.utils')
44
local config = require('orgmode.config')
5-
local ts = require('orgmode.treesitter.compat')
65

76
---@class TsTable
87
---@field node userdata
@@ -54,7 +53,7 @@ function TsTable:_parse_data()
5453
local cell_val = ''
5554
local cell_content = cell:field('contents')
5655
if cell_content and #cell_content > 0 then
57-
cell_val = ts.get_node_text(cell_content[1], 0)
56+
cell_val = vim.treesitter.get_node_text(cell_content[1], 0)
5857
end
5958
table.insert(row_data, cell_val)
6059
end

0 commit comments

Comments
 (0)