<snip>
> I think what I'd do is run a little magic over file2.txt to turn
> it into vim commands that can then be executed:
>
> " edit file2.txt
> :e file2.txt
>
> " convert the one-per-line replacements
> " to commands that search for the next
> " instance of "MODULEX" and replace it
> " with the item from file2.txt
> :%s@.*@:-/MODULEX/s//&
>
> " yank the entire file/script
> " into the scratch register
> :%y
>
> " split a window to open file1.txt to modify
> :sp file1.txt
>
> " execute the script as a macro
> " (note this is normal-mode
> " not an Ex command)
> @"
>
> Odd things may happen if
> - you have entries in file2.txt that are replacement metachars
> such as "\1", "&" or "/"
>
> - your replacements include the value "MODULEX" which then may
> get subsequently replaced.
>
> Hope that helps you out,
>
> -tim
Tim,
I would like to have a better understanding of the line
> :%s@.*@:-/MODULEX/s//&
The two appearances of the @ symbol is puzzling me. Is this something
to do with a search range for the substitute command, or executing a
macro, or what?!
Thanks very much in advance,
John
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment