@@ -13,35 +13,55 @@ local function add_todo_keyword_highlights()
13
13
end
14
14
local todo_keywords = config :get_todo_keywords ()
15
15
local faces = highlights .parse_todo_keyword_faces ()
16
- utils .readfile (
17
- query_files [1 ],
18
- vim .schedule_wrap (function (err , lines )
19
- if err then
20
- return
21
- end
22
- local todo_type = table.concat (
23
- vim .tbl_map (function (word )
24
- return string.format (' "%s"' , word )
25
- end , todo_keywords .TODO ),
26
- ' '
16
+ local all_lines = {}
17
+ for i , _ in pairs (query_files ) do
18
+ if i ~= # query_files then
19
+ utils .readfile (
20
+ query_files [i ],
21
+ vim .schedule_wrap (function (err , lines )
22
+ if err then
23
+ return
24
+ end
25
+ for _ , v in ipairs (lines ) do
26
+ table.insert (all_lines , v )
27
+ end
28
+ end )
27
29
)
28
- local done_type = table.concat (
29
- vim .tbl_map (function (word )
30
- return string.format (' "%s"' , word )
31
- end , todo_keywords .DONE ),
32
- ' '
30
+ else
31
+ utils .readfile (
32
+ query_files [i ],
33
+ vim .schedule_wrap (function (err , lines )
34
+ if err then
35
+ return
36
+ end
37
+ local todo_type = table.concat (
38
+ vim .tbl_map (function (word )
39
+ return string.format (' "%s"' , word )
40
+ end , todo_keywords .TODO ),
41
+ ' '
42
+ )
43
+ local done_type = table.concat (
44
+ vim .tbl_map (function (word )
45
+ return string.format (' "%s"' , word )
46
+ end , todo_keywords .DONE ),
47
+ ' '
48
+ )
49
+ table.insert (lines , string.format ([[ (item . (expr) @OrgTODO (#any-of? @OrgTODO %s))]] , todo_type ))
50
+ table.insert (lines , string.format ([[ (item . (expr) @OrgDONE (#any-of? @OrgDONE %s))]] , done_type ))
51
+ for face_name , face_hl in pairs (faces ) do
52
+ table.insert (lines , string.format ([[ (item . (expr) @%s (#eq? @%s %s))]] , face_hl , face_hl , face_name ))
53
+ end
54
+ for _ , v in ipairs (lines ) do
55
+ table.insert (all_lines , v )
56
+ end
57
+ vim .treesitter .set_query (' org' , ' highlights' , table.concat (all_lines , ' \n ' ))
58
+ if vim .bo .filetype == ' org' then
59
+ vim .cmd ([[ filetype detect]] )
60
+ end
61
+ end )
33
62
)
34
- table.insert (lines , string.format ([[ (item . (expr) @OrgTODO (#any-of? @OrgTODO %s))]] , todo_type ))
35
- table.insert (lines , string.format ([[ (item . (expr) @OrgDONE (#any-of? @OrgDONE %s))]] , done_type ))
36
- for face_name , face_hl in pairs (faces ) do
37
- table.insert (lines , string.format ([[ (item . (expr) @%s (#eq? @%s %s))]] , face_hl , face_hl , face_name ))
38
- end
39
- vim .treesitter .set_query (' org' , ' highlights' , table.concat (lines , ' \n ' ))
40
- if vim .bo .filetype == ' org' then
41
- vim .cmd ([[ filetype detect]] )
42
- end
43
- end )
44
- )
63
+ end
64
+ end
45
65
end
46
66
47
67
return {
0 commit comments