<p>While using Vim (at home and at work), I often find myself doing similar things repeatedly. For example, I may turn a bunch of CSV text into a series of SQL inserts. I've been using Vim for years, but only recently have I tried to seriously think about how I could improve my productivity while using it.</p>

<p>My question is.. Is there a good way (or right way) to store commonly used commands or command sequences? And how is the best way to execute them? It would be nice to be able to use the same script on a live session and also over the command line against some file.</p>

<p>I'm hoping that I can store them in a .vim file so that I can hand them to coworkers (who are not as proficient with vim) for them to use.</p>

You can store your common task macros in .vim files, like
this
for example, and then you can load them with the command
:so file.vim
Here
you can find a bunch of useful macros, also I recommend you to learn well the useful
q
macro recording
command, it's very very powerful...
The macros created with the
q
command are stored in a register, qq stores the macro in the q register, so when you end the recording you can simply paste the macro, with
"qp
and save it, later you can load it by simply yanking the macro into a register i.e.:
"qY
, the macros are only text and remember you can use any register instead of q. There is a Vim Script for storing
q
macros:
marvim : Macro Persistent Storage and Shareable Repository for VIM
Also take a look to the
Vim Scripting Language
.