Vim 101: A Gentle Introduction to Macros:



Press qq to start recording and save the macro to register q
Enter some commands
Press q to stop recording
...
To use the macro you've just recorded, type @q.

I keep having to clean up lines of parameters from autogenerated NHibernate SQL to slap into Microsoft SQL Server Management Studio that looks like...

@p1=N'80901',@p2=N'29588',@p3=N'29588',@p4=N'29579',@p5=N'29572',@p6=N'29588',
@p7=N'04032',@p8=N'17033',@p9=N'53202',@p10=N'28736',@p11=N'94110',@p12=N'28736',
@p13=N'89109',@p14=N'06155',@p15=N'10121'

Making a macro for :. s/@p[0-9]\+=N//g is pretty useful.

Labels: ,