did you mean to say a different script needs to be invoked when securedshell is opened via vi, then in that case, provide a custom script like yourVi and link to the actual vi.
Your question is not clear..
I think,this approach might help you. You can write a script which will keep on check whether any file opened thru vi. This can be checked thru ps command. If it is opened, then you need to take actions whatever you need.