> Is it possible to use predefined variables in command-line mode
> searching in vim?
> Example:
> we have some text like " bla-bla bar"
>
> :let a="foo"
> :%s/bar/$a/g
>
> Result:
> " bla-bla foo"
Interactively you can use "Ctrl-r =" and then type any expression to be
evaluated. Type "a" and then Enter to have variable "a" evaluated, like
this:
:%s/bar/<Ctrl-r>=a<Enter>/g
Here <Ctrl-r> and <Enter> mean that you really press those keys.
You can also use :execute command to evaluate expressions and have the
result of evaluation become the command to run, like:
execute '%s/var/' . a . '/g'
See the list guidelines:
http://groups.google.com/group/vim_use/web/vim-information
In normal mode (after pressing Esc), type the following:
:echo<space><ctrl-r>=2+3<enter><enter>
The "=2+3" is replaced with "5". You could also have entered
"=x" where x is a variable.
John