[Info-vax] cobol.vim for VIM

Hein RMS van den Heuvel heinvandenheuvel at gmail.com
Thu Mar 5 14:30:49 EST 2009


Years ago "Mark Vilstrup Svanesteen" wrote..
-----------------------------------------------------
Date: May 3 2005, 7:55 am
Subject: cobol.vim for VIM
To: comp.os.vms

Hi,

I downloaded VIM6.3, but it seems impossible to get it to display
COBOL-code
correctly. I've been googling all day, but I can't find anything that
really
works.
VIM places red lines all over my COBOL-code. If I try:

:hi error none

, the red lines disappear allright, but now words are only partly
colored.
This happens every 6. line I believe.

I've also tried putting:

let cobol_legacy_code=1
and
unlet cobol_legacy_code

in my .vimrc and .gvimrc - files.

Maybe its in my .vimrc-files
---------------------------------------------------

But I could not reply to that, hence a new topic.

I just tried VIM (7.0 + syntax 7.2) on COBOL and the color
highlighting was very ugly to begin with. The cobol syntax really
wants the 'ANSII' style layout where the columns matter a lot and a
space is a space, not a tab. Not the largely free-format we VMS folks
are used to.

I could make it 'almost bareable' with a quick HACK.
I do not claim to understand this, and the solution is by no means
complete or perfect,  but it is a lot better than it was.
Basically replaced the markers for 4 - 6 space by 1 or 2 [spaces OR
tab]

-------
syn match   cobolMarker     "^\%([       ]\{,1\}[^       ]\)\@=.\{,2}"
nextgroup=@cobolStart
syn match   cobolSpace      "^[  ]"  nextgroup=@cobolStart
syn match   cobolAreaA      "[   ]\{1\}"  contained
nextgroup=@cobolAreaA, at cobolAreaAB
syn match   cobolAreaB      "[   ]\{2,\}\|- *" contained
nextgroup=@cobolAreaB, at cobolAreaAB
syn match   cobolComment    "[/*C].*$" contained
-------
The pieces of string above looking like "[  ]" contain not two spaces,
but a space and a tab.

But... it still is a mess. Specifically the KEYWORDS defined with
CONTAINING are recognized in any piece of string, and not only when
started and ended on some word boundary.

So take  piece of code like; PERFORM 41000_CLOSE_ALL_FILES ...
There 41000 is highlighted in RED (constant !?), CLOSE and ALL in
YELLOW (keywords) and FILES in white for simple variable name. Yuck!

If anyone has tweaked a COBOL.VIM for use with OpenVMS Cobol, then I'd
love to try it!

Regards,

Hein.





More information about the Info-vax mailing list