I currently run a series of commands on any file I am working on to compress the lines. That series is -G:aPRESS ENTER KEY.:g/^./ .,/^$/-1 joinSo I press S-g, S-:, a, enter, ., then run that regular expression. This joins my lines.function! CrunchLines()exec Gexec :exec  aexec return.:g/^./ .,/^$/-1 joinendfucom! CRUNCH call CrunchLines()How do you just run vim commands inside of a function?
How to convert series of commands into a Vim Function?
vimscript;vimrc
If you want to run a command from a vim function you can do so with the normal command : normal! dd This act as dd in normal mode.The ! prevent using user mapping, to you get the basic vim functionalities.Now to compress your file you can go to the last line with G and then joins every lines with your expression.So the function could be :function! Crunch() abort  normal! G  g/^./ .,/^$/-1 joinendfunctionYou can also use the J key that joins the lines like so : function! Crunch() abort  normal! ggVGJendfunctionDecomposing : gg  : go to first lineV   : start a visual line selectionG   : go to last lineJ   : join the selection