3 ms·
Makes it easier to sort in Vim; 'ggVG!sort' will sort your css alphabetically: .bar .apple {...} .foo .apple {...} .foo .banana {...} .foo .cherry {...} (I
by earnubs 16y ago
Makes it easier to sort in Vim; 'ggVG!sort' will sort your css alphabetically:
.bar .apple {...}
.foo .apple {...}
.foo .banana {...}
.foo .cherry {...}
(I also have a wee script that sorts the declarations alphabetically too.)
I prefer the style, I find it much easier to write, edit and maintain.
- mattwdelong 16y agoWould you mind sharing this script with HN'ers?
- earnubs 16y ago#!/usr/bin/perl -w use strict; # from selected block in vim: !scriptname.pl while (defined(my $line = <STDIN>)) { $line =~ m/^(.*)\{(.*)\}/; my $element = $1; my @list = split /;/, $2; @list = join ';', sort { $a cmp $b } @list; print STDOUT "$element" . "{@list}\n"; }