Skip to main content
1 of 3
Mr.Wizard
  • 273.1k
  • 34
  • 595
  • 1.4k

I'll assume that you want to echo any literal Set operation that occurs in input, even if it is not on a line by itself.

This may work for you:

$Pre =
 Function[
   main,
   Unevaluated[main] /. Set -> Function[, Print@HoldForm[# = #2]; # = #2, HoldFirst],
   HoldAll
 ];

Now:

{a = 2 + 2, b = 10/2, c = Sqrt[9]};

a = 4

b = 5

c = 3

{a, b, c}
{4, 5, 3}
Mr.Wizard
  • 273.1k
  • 34
  • 595
  • 1.4k