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)
170170 end
171171 end ,
172172 })
173- vim .api .nvim_create_autocmd ({ ' FileChangedShellPost' , ' Syntax ' , ' TextChanged' }, {
173+ vim .api .nvim_create_autocmd ({ ' FileChangedShellPost' , ' FileType ' , ' TextChanged' }, {
174174 group = group ,
175175 callback = function (event )
176176 vim .schedule (function ()
@@ -179,11 +179,8 @@ function M.setup(opts)
179179 end ,
180180 })
181181
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 })
187184end
188185
189186M .toggle = function ()
Original file line number Diff line number Diff line change @@ -28,9 +28,9 @@ M.refresh = function(buf)
2828 util .set_conceal (buf , state .config .conceal .rendered )
2929
3030 -- 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 )
3434 local language = language_tree :lang ()
3535 logger .debug ({ language = language })
3636 if language == ' markdown' then
@@ -58,7 +58,7 @@ M.clear_valid = function(buf)
5858 end
5959 vim .api .nvim_buf_clear_namespace (buf , M .namespace , 0 , - 1 )
6060 local win = util .buf_to_win (buf )
61- if win < 0 then
61+ if not vim . api . nvim_win_is_valid ( win ) then
6262 return false
6363 end
6464 util .set_conceal (buf , state .config .conceal .default )
You can’t perform that action at this time.
0 commit comments