I want to write a vim script to do the following:
if I have the following in my Java code,
Z z = obj1.foo().bar().foo1().bar1()
it should be replaced by
if(obj1 != null) {
T1 o1 = obj1.foo();
if(o1 != null) {
T2 o2 = o1.bar();
if(o2!=null) {
T3 o3 = o2.foo1();
if(o3 != null) {
z = o3.bar1();
}
else
z = null;
}
else
z = null;
}
else
z = null;
}
else
z = null
I want to write a vi command that takes as arguments a comma-separated list of Types T1,T2 ... and so on to give me this big thing.
How do I learn about vimscripting?