[CLUE-Tech] One for the ViM gurus

Keith Hellman khellman at mcprogramming.com
Fri Jul 2 23:26:14 MDT 2004


I cannot offer an actual script or macro, but here is how I would write
one...

1.  write a shell wrapper 'round vim that will open the two commandline
argument filenames in two windows, and perform the initial regular
expression search in each.  You can tell vim to record a macro file from
the command line, so although it may sound like a lot, it *should* be
straighforward to do.
2.  mark the beginning and end of the interesting lines in window 1 as
'a' and 'b', the range in window 2 as 'c' and 'd' (:help mark).
optionally, you could set 'a' and 'c' at the end of step one...
3.  record a script that will cut window 1 (a-b) to the one register,
window 2 (c-d) to another register.  go to marks 'a' & 'c' and paste the
contents of the appropriate register.
4.  map the invokation of the macro in step 3 to a keystroke (:help map)

I would hope most of this can be done by simply recording the correct
keystrokes to macros and a little editting of these command lists.  I
rarely script vim this much (well, actually I do but I use the python
interface), certainly not in vim's scripting language.

HTH, but it's probably stuff you had already figured out.

-- 
Keith Hellman                             #include <disclaimer.h>
khellman at mcprogramming.com                from disclaimer import standard
public key @ www.mcprogramming.com

Experience is a harsh teacher.  She gives the test before you learn the
lesson.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://cluedenver.org/pipermail/clue-tech/attachments/20040702/cb4ec6fe/attachment.bin


More information about the clue-tech mailing list