On 28/01/09 07:37, Tony Mechelynck wrote:
> On 27/01/09 16:48, Teemu Likonen wrote:
>> 703designs (2009-01-27 07:28 -0800) wrote:
>>
>>> I'm working with some CSS formatted
>>>
>>> p
>>> {
>>>       property: values;
>>> }
>>>
>>> What sort of find/replace command should I use to delete the newline
>>> before the brace for all declarations?
>> How about g command?
>>
>>       :%g/^{/normal kJ
>
> or:
>
>       :%s/\_s{/ {/g

Oops!
        :%s/\_s*{/ {/g
or maybe
        :%s/\_s*{\_s*/ {\r/g

The latter replaces "one opening brace surrounded on both sides by any 
number of spaces, tabs and/or linebreaks (zero or more, as many as 
possible)" by one space, one opening brace, and one linebreak, in that 
order. It may be more than you wish, since it will remove indenting on 
the line after the brace.

>
> Note that every brace will be placed at the end of the preceding line
> (or, with this :s statement, at the end of the preceding non-blank
> liine). This usually isn't a problem in CSS style sheets, where normally
> only one level of braces can exist; however, in style sheets meant only
> for Gecko browsers (e.g. chrome/userContent.css in a Firefox profile) a
> second level can be introduced by @-moz-document at-rules, as follows:
>
> @-moz-document domain("example.com") {
> // rules here will only be applied in pages on<something>.example.com
> }
>
> @-moz-document        url("http://www.example.org/blahblah.html";),
>               url-prefix("http://www.example.net/some/path/";)
> {
>     // rules here will be applied to the exact URL
>     // http://www.example.org/blahblah.html
>     // and to any URL starting with http://www.example.net/some/path/
> }
>
>
> Best regards,
> Tony.
-- 
Bare feet magnetize sharp metal objects so they point upward from the
floor -- especially in the dark.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to