I agree completely with PxT.
If you are actually interested in the "vi" source code then
you can download the tarball at...
http://www.bostic.com/vi/
You also mention mouse trapping, etc. so I'm also
thinking you're looking for a "graphical" editor.
In general, "vi" is text based however, X windows can be
used to set various "vi modes" based on mouse button
clicks, etc. This may not be what you are looking for.
There are also other "variants" of vi that are more
graphically oriented but I don't use any of them.