diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2021-09-16 12:00:13 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-16 12:00:13 -0700 |
| commit | 7d67bd58655052103f3891122f0e6fe30ae1f829 (patch) | |
| tree | 778b8b9ebdf8cec2d90c77eece08abdad94329c8 /runtime/lua/vim/highlight.lua | |
| parent | 942b16adf7312c243fb27e579fa5da794fa0f502 (diff) | |
| parent | 2132c063af3adf1d612359e0ed42c7cbd8b4290c (diff) | |
| download | rneovim-7d67bd58655052103f3891122f0e6fe30ae1f829.tar.gz rneovim-7d67bd58655052103f3891122f0e6fe30ae1f829.tar.bz2 rneovim-7d67bd58655052103f3891122f0e6fe30ae1f829.zip | |
Merge #15677 release-0.5: backports
Diffstat (limited to 'runtime/lua/vim/highlight.lua')
| -rw-r--r-- | runtime/lua/vim/highlight.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/runtime/lua/vim/highlight.lua b/runtime/lua/vim/highlight.lua index 0012dce081..ef44383f59 100644 --- a/runtime/lua/vim/highlight.lua +++ b/runtime/lua/vim/highlight.lua @@ -85,7 +85,11 @@ function highlight.on_yank(opts) highlight.range(bufnr, yank_ns, higroup, pos1, pos2, event.regtype, event.inclusive) vim.defer_fn( - function() api.nvim_buf_clear_namespace(bufnr, yank_ns, 0, -1) end, + function() + if api.nvim_buf_is_valid(bufnr) then + api.nvim_buf_clear_namespace(bufnr, yank_ns, 0, -1) + end + end, timeout ) end |