HiColumn is leaky
Closed this issue · 10 comments
HiColumn
leaves trailing highlighting on other buffers.
Seems to be something to do with csv#HiCol
in csv.vim/autoload/csv.vim.
Tested in a stripped down Vim
configuration with only this plugin.
In another affected buffer, these don't clear the errant highlighting: :colo default
, :2mat none
. The only thing I can do is return to the buffer of the csv file and either :HiColumn!
or :CSVInit
, then return to the buffer of the other filetype.
what do you mean with leaky
? I don't think the csv plugin uses highlight matches, but perhaps this is just hls
highlighting that persists? Does :nohls
fix it` Can you show a screen shot?
:nohls
was such an obvious first thing to try I'd forgotten to mention that it also doesn't remove the leaked highlighting.
I ran again my stripped down vim configuration to grab some screen shots and noticed that the highlighting from :HiColumn
even leaks into Netrw
- image here.
hm, you seem to be changing the buffer in the window and the :HiColumn
hightlighting isn't cleared then. Does :call clearmatches()
does fix it?
Yes, I see that the leak is limited to the window that :HiColumn
was called from.
In my workflows I often switch buffers within a window so now I've implemented in my vimrc:
inoremap <s-f7> :call clearmatches()<cr>
nnoremap <s-f7> :call clearmatches()<cr>
- which allows me to clear the leaked highlighting from any other affected buffer.
that is actually puzzling, because :HiColumn
highlighting should be removed, once you change editing another buffer in the current window:
Lines 230 to 257 in 15ff93e
So can you check when your csv buffer is loaded, that there exists a corresponding autocommand?
:au BufWinLeave
For me it certainly clears the highlighting when switching to another buffer.
Please provide a reproducible example how this happens? Also please specify what version you are using
In my $vimfiles/pack/packs-cp/opt/csv.vim
,
$ git rev-parse --short HEAD
15ff93e
Just re-tested like this:
- I made a directory
~/.vimtest
and from in theremkdir -p pack/packs-cp/opt
into which I clonedcsv.vim
- I created a
vimrc.vim
containing these statements:
set runtimepath=~/.vimtest,/usr/share/vim/vimfiles,/usr/share/vim/vim90,/usr/share/vim/vimfiles/after
source $VIMRUNTIME/defaults.vim
packadd csv.vim
- and I created
test.csv
containing these two lines:
header1,header2,header3
data1,data2,data3
- still in directory
~/.vimtest
,vim -u ~/.vimtest/vimrc.vim test.csv
- in that testing version of
Vim
, I:HiColumn
, which works, thene .
to openNetrw
showing the leaked highlighting.
- could there be something in $VIMRUNTIME/defaults.vim
that conflicts with your plugin?
Well, can you please update to ba2c5ff and can you show the
:au BufWinLeave
when in a csv file?
Oh wait a second, you don't have a automatic highlighting setup? That might be the reason then.
Updated to 4fd8834, thanks.
:Bufferize au BufWinLeave
gets me (relevant stuff):
--- Autocommands ---
...
CSV_HI2 BufWinLeave
<buffer=2>
sil! HiColumn!
call csv#RemoveAutoHighlight()
call csv#RemoveAutoHighlight()
...
CSV_HI2 BufWinLeave
<buffer=2>
call csv#RemoveAutoHighlight()
With your updated code I'm getting no more leaking of highlighting to other buffers, thanks.
A couple of points:
- It'd be nice if when we return to the
*.csv
the column highlighting was still there. - Highlight column automatically (
let g:csv_highlight_column = 'y'
)- I've not been using because, with my choice of colorscheme ,vim-colors-tomorrow, your column highlighting makes the cursor invisible. (This isn't an issue with jellybeans.vim colorscheme, which I prefer in
nvim
within mytmux
.) - The column highlighting is lost when the buffer in the window has been changed.
- I've not been using because, with my choice of colorscheme ,vim-colors-tomorrow, your column highlighting makes the cursor invisible. (This isn't an issue with jellybeans.vim colorscheme, which I prefer in
you know, you can define your own highlighting.