Reputation: 8119
I would like to know if it is possible to highlight double sentences on a line using vim (highlighting as after doing a search).
example:
This is my first line. This is my first line.
this is my second line this is my second line
"more text" this is my third line "more text" this is my third line "more text" this is my third line
highlight all double sentences --> output: (highlighting in bold):
This is my first line. "more text" This is my first line.
this is my second line this is my second line
"more text" this is my third line "more text" this is my third line "more text" this is my third line
highlight all but first double --> output: (highlighting in bold)
This is my first line. "more text" This is my first line.
this is my second line this is my second line
"more text" this is my third line "more text" this is my third line "more text" this is my third line
a double sentence is a piece of text with 2 or more similar words in the same sequence.
Upvotes: 0
Views: 166
Reputation: 21
To highlight all double sentences you can use
/This is my first line\|this is my second line\|this is my third line
I dont know how to highlight all but first double
Upvotes: 1
Reputation: 172648
The Vim tip Highlight doubled word errors in text has a regular expression that does this for duplicate words; you can maybe extend this to capture whole sentences.
But I doubt that you can come up with one that covers all your requirements, is still somewhat maintainable, and doesn't drag down Vim's performance. (But let that be a challenge to you and others!)
Upvotes: 1