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.
精彩评论