开发者

Vim, css clean key map convert to function

I got this map for formating css into a one liner.

map <silent> <leader>cssclean :%s@\v/\*([^*]\|[\r\n]\|(\*+([^*/]\|[\r\n])))*\*+/@@g<Bar>:call CssPretty()<Bar> :%le<Bar>:%s/{\_.\{-}}/\=substitute(submatch(0), '\n', '', 'g')/<Bar>:nohl<cr>Gdd

This 开发者_StackOverflow社区map requires CssPretty.

Now I want to call this like :call CssClean() . I tried putting this one by reading this vim tip, but it didn't work.


What was the code of that function?

function CssClean()
    %s@\v/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/@@g
    call CssPretty()
    %le
    %s/{\_.\{-}}/\=substitute(submatch(0), '\n', '', 'g')/
    nohl
    normal! Gdd
endfunction

should work fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜