From 550630d8d3fb0d1c2b73dcd9690f0296eae01e30 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Fri, 6 Sep 2024 23:20:29 +0200 Subject: nvim: Add a plugin to hide zero-width spaces --- .config/nvim/plugin/zwspace.vim | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .config/nvim/plugin/zwspace.vim (limited to '.config/nvim/plugin') diff --git a/.config/nvim/plugin/zwspace.vim b/.config/nvim/plugin/zwspace.vim new file mode 100644 index 0000000..2333bdb --- /dev/null +++ b/.config/nvim/plugin/zwspace.vim @@ -0,0 +1,21 @@ +if &cp || exists('g:loaded_zwspace') + finish +endif +let g:loaded_zwspace = v:true + +function s:ConcealZWSpaces() + if exists('w:zwspaces') + for i in w:zwspaces + call matchdelete(i) + endfor + unlet w:zwspaces + endif + let w:zwspaces = [ + \ matchadd('Conceal', "\u200B"), + \ matchadd('Conceal', "\u200C"), + \ matchadd('Conceal', "\u200D"), + \ matchadd('Conceal', "\uFEFF"), + \ ] +endfunction + +autocmd BufEnter * call ConcealZWSpaces() -- cgit v1.2.3