0

Opening a file with vi nicely highlights its contents.

Nicely Highlighted Image

However, I want to view the file with all lines containing clock_gettime hidden. By using the global command :g!/clock_gettime I get the required output but it loses all syntax highlighting.

Not Highlighted Image

Is there a way to view only a set of lines matching (or not matching) the given expression in a way that all visible content is also properly highlighted?

1 Answer 1

2

If it's only a matter of viewing those lines with highlighting, you could do :g/clock_gettime/d

This will actually delete the lines in your editor. When you're done viewing, just do :q! so you won't actually delete the lines from the file.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .