| 5 | |
| 6 | |
| 7 | :fu FuncHaikuCheck() |
| 8 | call matchadd('Search', '\%>80v.\+', -1) " line with more than 80 chars |
| 9 | call matchadd('Search', '0\s* \s*', -1) " probably wrong indenting |
| 10 | call matchadd('Search', '\(for\|if\|select\|while\)(', -1) |
| 11 | "keyword without space after it |
| 12 | call matchadd('Search', '[a-zA-Z0-9][,=>+\-*;][a-zA-Z0-9]', -1) |
| 13 | "operator without space around it (without false positive on |
| 14 | "templated<type>) |
| 15 | call matchadd('Search', '^[^#].*[^<][a-zA-Z0-9]*/[a-zA-Z0-9]', -1) |
| 16 | "operator without space around it (without false positive on |
| 17 | "#include <dir/file.h>) |
| 18 | call matchadd('Search', '^[^/]\{2}.*[^*][=/+\- ]$', -1) |
| 19 | "operator at end of line (without false positives on /* and */, nor |
| 20 | "char*\nClass::method()) |
| 21 | call matchadd('Search', '\s$', -1) "Spaces at end of line |
| 22 | call matchadd('Search', ',\S', -1) " Missing space after comma |
| 23 | :endfu |
| 24 | }}} |
| 25 | |
| 26 | == Calling the scrip == |
| 27 | |
| 28 | The obvious way to enable the script is to do it by hand : |
| 29 | {{{ |
| 30 | :call FuncHaikuCheck() |
| 31 | }}} |
| 32 | |
| 33 | It is also possible to make it run on every opened file (this is a bit annoying when using vim for something else than Haiku or C++ files) |
| 34 | {{{ |
8 | | |
9 | | :fu FuncHaikuCheck() |
10 | | call matchadd('Search', '\%>80v.\+', -1) " line with more than 80 chars |
11 | | call matchadd('Search', ' ', -1) " probably wrong indenting |
12 | | call matchadd('Search', '\(for\|if\|select\|while\)(', -1) "keyword without space after it |
13 | | call matchadd('Search', '[a-zA-Z0-9][,=>/+\-*;][a-zA-Z0-9]', -1) "operator without space around it (without template_d<t_ype>) |
14 | | call matchadd('Search', '[^*][=/+\- ]$', -1) "operator at end of line (without false positives on char*\nclass::method(), /* and */) |
15 | | :endfu |