Skip to content

Instantly share code, notes, and snippets.

@nicwest
Created January 4, 2015 22:38
Show Gist options
  • Save nicwest/6d3b5392d5a4e7c6ae83 to your computer and use it in GitHub Desktop.
Save nicwest/6d3b5392d5a4e7c6ae83 to your computer and use it in GitHub Desktop.
if bufexists('DELETEME')
bw! DELETEME
endif
vert new DELETEME
let s:contents = system('curl -si http://google.com')
call append(0, ['WITH WIERD CHARS:', '-----------------', s:contents])
let s:fix_return_newline = substitute(s:contents, '\r\n', "", 'g')
call append('$', ['FIX carrige returns:', '-----------------', s:fix_return_newline, ''])
let s:fix_newlines = substitute(s:fix_return_newline, '\n', "", 'g')
call append('$', ['FIX NEWLINES:', '-----------------', s:fix_newlines, ''])
let s:split_lines = split(s:contents, '\(\n\|\r\n\)')
call append('$', ['SPLIT:', '-----------------'])
call append('$', s:split_lines)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment