Skip to content

Instantly share code, notes, and snippets.

@sanmiguel
Created May 15, 2014 17:59
Show Gist options
  • Select an option

  • Save sanmiguel/2907c719c1f970a82da3 to your computer and use it in GitHub Desktop.

Select an option

Save sanmiguel/2907c719c1f970a82da3 to your computer and use it in GitHub Desktop.
function! s:CleanExport(start)
let end = search(']', 'W')
let pos = getpos('.')
call search(',', 'bW', a:start)
if pos != getpos('.')
s/\_\s*,\_\s*\([^]]\+\)\_\s*/]).\r-export([\1/
call s:CleanExport(a:start)
endif
endfunction
function! TidyExports()
call cursor(1, 1)
let limit = search('^-export(\_[^)]\+,', 'cW')
if limit != 0
silent s/-export(\_\s*\[\_\s*/-export([/
call s:CleanExport(limit)
call TidyExports()
endif
endfunction
@sanmiguel
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment