Skip to content

Instantly share code, notes, and snippets.

@steadystatic
Created October 10, 2013 16:52
Show Gist options
  • Select an option

  • Save steadystatic/6921730 to your computer and use it in GitHub Desktop.

Select an option

Save steadystatic/6921730 to your computer and use it in GitHub Desktop.
css update vim function
map <leader>x :call CSSXMLUpdate()<CR>
function! CSSXMLUpdate()
let currentLine = line('.')
let bottomLine = line("$")
while currentLine <= bottomLine
try
let @x = 'jvt,"ayt,llvt,"byt,llvt,"cyt,llvt,"dyt,llvt,"eyt,llvt,"fyt,llvt,"gy0'
let @y = 'l:0
/a
/styleDefault
:s/48px;padding:36px 8px/bpx;padding:cpx dpx/g
'
let @w = '?id="
wwvt""hy'
let @z = ':0
/h
/styleDefault
:s/27px;padding:28px 11px/epx; padding:fpx gpx/g
'
let @s = ':0
h'
:normal @x
:normal @y
sleep 1
let @h = substitute(@h, '.$', 's', '')
:normal @w
:normal @z
let l:MissionSuccess = 1
catch
let l:MissionSuccess = 0
sleep 1
:normal @s
finally
if (l:MissionSuccess == 1)
:w
:normal @s
endif
endtry
endwhile
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment