mgedmin / coverage-highlight.vim

Vim plugin to highlight Python source code lines that lack test coverage
MIT License
56 stars 5 forks source link

Add command to highlight all open files #5

Closed merwok closed 7 years ago

merwok commented 7 years ago

I often find myself with a couple related files open, let’s say utils, views and test_views. When I run coverage by itself, I can see the lines missing in all three files.

Would you add a command like ShowHighlightAll to all buffers?

mgedmin commented 7 years ago

Would :windo HighlightCoverage suffice?

merwok commented 7 years ago

I’m not exactly sure what a window is for vim; I know about tabs, splits and buffers.

I tried :bufdo HighlightCoverage yesterday with two files opened in splits but that’s not good since it uses :bufnext which loads the next buffer in the current split, so that messes up all your layout.

mgedmin commented 7 years ago

A "window" is the official vim term for a split. :windo would highlight all the currently visible files for you.

I'm not sure why :bufdo opened new splits -- did you have unsaved changes and 'hidden' disabled?

Anyway, the idea of adding signs to all the files mentioned in a coverage report is starting to grow on me.

merwok commented 7 years ago

I’m not saying that bufdo opened new splits, but that it changed the file loaded in my current split. Ideally I’m looking for a way to run a command in each open window in-place, so that I can continue working.

mgedmin commented 7 years ago

I’m not saying that bufdo opened new splits, but that it changed the file loaded in my current split.

Ah, yes, it does that. Unfortunately.

Ideally I’m looking for a way to run a command in each open window in-place, so that I can continue working.

:windo is exactly what you're looking for then.

mgedmin commented 7 years ago

Anyway, the idea of adding signs to all the files mentioned in a coverage report is starting to grow on me.

I've implemented a :HighlightCoverageForAll that does this.

(Note that due to a Vim limitation it only highlights files that are already loaded into buffers.)

merwok commented 7 years ago

That seems perfect! I can decide to open two files or twenty, then ask to see their coverage.