Last active
December 12, 2015 07:19
-
-
Save yuya-matsushima/4735680 to your computer and use it in GitHub Desktop.
sass書く時に":"の後にスペースがないとエラーするみたいなので、保存時に矯正するようにした
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test.sass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! SassCorrect() | |
let s:cursor = getpos(".") | |
%s/\(\S\+\):\s\+\(.\+$\)/\1:\2/e | |
%s/\([^\s\t:]\+\):\(\/\/\|link\|visited\|active\|hover\|focus\|lang\|before\|after\|first\-line\|first\-letter\|first\-child\|last\-child\|target\|enabled\|disabled\|checked\|indeterminate\|root\|nth\-child\(.\+\)\|nth\-last\-child\(.\+\)\|nth\-of\-type\(.\+\)\|nth\-last\-of\-type\(.\+\)\|first\-of\-type\|last-of\-type\|only\-child\|empty\|-moz-any-link\|default\|root\|contains\(\)\|not\(\)\)\@!/\1: \2/e | |
call setpos(".", s:cursor) | |
endfunction | |
au BufWritePre *.scss,*.sass call SassCorrect() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@charset "utf-8" | |
/* Sass Test File for SassCorrect.vim | |
* | |
* SassCorrect.vim の動作確認用テストSassファイル | |
* 保存処理を行った際に正しいsyntaxが得られれば問題ない(はず | |
*/ | |
@import url(http://www.e2esound.com/font-data) | |
@import url(https://www.e2esound.com/font-data) | |
@import url(//www.e2esound.com/font-data) | |
#test | |
.url | |
background:url(http://www.e2esound.com/test_image.jpg) | |
background: url(http://www.e2esound.com/test_image.jpg) | |
a | |
&:link | |
color:blue | |
color: blue | |
&:visited | |
color:orange | |
color: orange | |
&:hover | |
text-decoration: underline | |
text-decoration:underline | |
&:focus | |
color:red | |
color: red | |
span | |
&:before | |
content:"$" | |
content: "^" | |
&:after | |
content:"$" | |
content: "$" | |
div:first-line | |
text-decoration:underline | |
text-decoration: underline | |
p:first-letter | |
font-size:2em | |
font-size: 2em | |
ul | |
li | |
&:first-child | |
color:red | |
color: red | |
&:last-child | |
color:green | |
color: green | |
p:target | |
background:red | |
background: red | |
input | |
&:enabled | |
border-color:black | |
border-color: black | |
&:disabled | |
border-color:white | |
border-color: white | |
&:checked | |
border-color:red | |
border-color: red | |
font: | |
family:hiragino | |
family: hiragino | |
weight:bold | |
weight: bold |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment