File tree Expand file tree Collapse file tree 1 file changed +15
-14
lines changed
lua/tiny-inline-diagnostic Expand file tree Collapse file tree 1 file changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -199,23 +199,24 @@ end
199
199
local function setup_mode_change_autocmds (autocmd_ns , event )
200
200
vim .api .nvim_create_autocmd (" ModeChanged" , {
201
201
group = autocmd_ns ,
202
- pattern = { " *:[vV\x16 is]*" },
203
202
callback = function ()
204
- if vim .api .nvim_buf_is_valid ( event . buf ) then
205
- disable ()
206
- extmarks . clear ( event . buf )
207
- else
208
- detach_buffer ( event . buf )
209
- end
210
- end ,
211
- })
203
+ local mode = vim .api .nvim_get_mode (). mode
204
+
205
+ local disabled_mode = {
206
+ " i " ,
207
+ " v " ,
208
+ " V " ,
209
+ " " ,
210
+ }
212
211
213
- vim .api .nvim_create_autocmd (" ModeChanged" , {
214
- group = autocmd_ns ,
215
- pattern = " [vV\x16 i]*:*" ,
216
- callback = function ()
217
212
if vim .api .nvim_buf_is_valid (event .buf ) then
218
- enable ()
213
+ if vim .tbl_contains (disabled_mode , mode ) then
214
+ disable ()
215
+ else
216
+ enable ()
217
+ end
218
+
219
+ extmarks .clear (event .buf )
219
220
else
220
221
detach_buffer (event .buf )
221
222
end
You can’t perform that action at this time.
0 commit comments