Friday, January 8, 2016

Find adjacent lines starting with same pattern

Hi there

I'm optimising a css file.
I run the file through csscomb to clean it up and i would like to highlight duplicated properties.

ex:

body {
margin: 10px;
padding: 10px;
padding: 20px;
background: #fff;
}

I can find duplicated lines with:
/^\(.*\)\n\1$

I can match and capture the properties on every lines:
\S\{-}:\)

I can match the whole line and capture the properties and value:
\(\S\{-}:\)\(.\{-};\)

But if i try to to apply the pattern on the next line ( \n\1 ) it doesn't match anything:
\(\S\{-}:\)\(.\{-};\)\n\1

Is there a way to do that?

Thanks a lot

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: