File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -170,7 +170,7 @@ function M.setup(opts)
170
170
end
171
171
end ,
172
172
})
173
- vim .api .nvim_create_autocmd ({ ' FileChangedShellPost' , ' Syntax ' , ' TextChanged' }, {
173
+ vim .api .nvim_create_autocmd ({ ' FileChangedShellPost' , ' FileType ' , ' TextChanged' }, {
174
174
group = group ,
175
175
callback = function (event )
176
176
vim .schedule (function ()
@@ -179,11 +179,8 @@ function M.setup(opts)
179
179
end ,
180
180
})
181
181
182
- vim .api .nvim_create_user_command (
183
- ' RenderMarkdownToggle' ,
184
- M .toggle ,
185
- { desc = ' Switch between enabling & disabling render markdown plugin' }
186
- )
182
+ local description = ' Switch between enabling & disabling render markdown plugin'
183
+ vim .api .nvim_create_user_command (' RenderMarkdownToggle' , M .toggle , { desc = description })
187
184
end
188
185
189
186
M .toggle = function ()
Original file line number Diff line number Diff line change @@ -28,9 +28,9 @@ M.refresh = function(buf)
28
28
util .set_conceal (buf , state .config .conceal .rendered )
29
29
30
30
-- Make sure injections are processed
31
- vim .treesitter .get_parser (buf ): parse ( true )
32
-
33
- vim . treesitter . get_parser ( buf ) :for_each_tree (function (tree , language_tree )
31
+ local parser = vim .treesitter .get_parser (buf )
32
+ parser : parse ( true )
33
+ parser :for_each_tree (function (tree , language_tree )
34
34
local language = language_tree :lang ()
35
35
logger .debug ({ language = language })
36
36
if language == ' markdown' then
@@ -58,7 +58,7 @@ M.clear_valid = function(buf)
58
58
end
59
59
vim .api .nvim_buf_clear_namespace (buf , M .namespace , 0 , - 1 )
60
60
local win = util .buf_to_win (buf )
61
- if win < 0 then
61
+ if not vim . api . nvim_win_is_valid ( win ) then
62
62
return false
63
63
end
64
64
util .set_conceal (buf , state .config .conceal .default )
You can’t perform that action at this time.
0 commit comments