Dirty fix for omlet vim extension
By gildor on Friday, September 10 2010, 11:17 - Permalink
omlet (or here) is a vim extension for writing OCaml code.
In my opinion, it has a better indentation than the standard OCaml vim support. Unfortunately, it has a cost: the indentation vim code is more complex. And it has a few bugs :-(
The main bug is that it doesn't like unbalanced comment opening "(*" and closing "*)" tags. From time to time, it enters an infinite (or very long) loop when there such a tag left in your file. It can be very far away from the point you are editing.
It isn't too problematic, because unbalanced tags are a syntax error. But the problem is that it matches these tags inside strings also. So whenever you start using regular expression like "(.*)" the whole indentation fails.
But there is a very ugly solution to this problem!
Problematic code:
let parse_rgxp = Pcre.regexp ~flags:[`CASELESS] "^(?<license>[A-Z0-9\\-]*[A-Z0-9]+)\ (?<version>-[0-9\\.]+)?(?<later>\\+)?\ ( *with *(?<exception>.*) *exception)?$"
Solution, add ignore"(*":
let parse_rgxp = ignore "(*"; Pcre.regexp ~flags:[`CASELESS] "^(?<license>[A-Z0-9\\-]*[A-Z0-9]+)\ (?<version>-[0-9\\.]+)?(?<later>\\+)?\ ( *with *(?<exception>.*) *exception)?$"
Very very ugly coder: you balance comment tags in dead code -- very very bad ;-)
ps: another solution when the plugin enters the infinite loop, hit Ctrl-C. This will stop it and let you define your own indentation.