Skip to content

Instantly share code, notes, and snippets.

@vpetro
Created September 8, 2011 17:02
Show Gist options
  • Save vpetro/1203926 to your computer and use it in GitHub Desktop.
Save vpetro/1203926 to your computer and use it in GitHub Desktop.
function to put function parameters one-per-line.
" NOTES:
" ^M must be replaced with <ctrl-v><ctrl-m>
" ^[ must be replace with <ctl-v><esc>
function! BreakParameters()
" move the start of the line and set a mark 'a'
normal ^ma
" get break the parameters onto their own line
normal f(a^M^[
" replace the commas with linebreaks
:s/\v,[\s\n]?/,^M/g
" reformat the paragraph
normal V`'=
" clean up by deleting the mark
:delmarks a
" turn off the highlighting
:nohl
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment