How can I make an ideal comparator in LTspice?
First create a B-source

Then set the value of the B-source to an expression like below:



Now B1 is the comparator with 1V/0V output.

Another example function can be something like: 

V{if(V(Vref)>0.2, cos(12*time),cos(36*time))}

I don't know how it can be done by using VCVS.