sponsor Vim development Vim logo Vim Book Ad

cobol.zip : COBOL indent plugin:  Understands COBOL's awkward use of columns

 script karma  Rating 29/12, Downloaded by 3740  Comments, bugs, improvements  Vim wiki

created by
Tim Pope
 
script type
indent
 
description
Shipped with Vim as of 7.1

The indent plugin understands the column requirements of COBOL (Area A vs. Area B, comment indicator indented 6 spaces, etc.) and also neatly formats nested blocks and fields.  It works quite well for the code I have used it with; further feedback is appreciated.

The ftplugin is designed to help comply with COBOL's insane column requirements.  <C-T>, <C-D>, and <Tab> are remapped in insert mode to stop in columns 1, 7, 8 (Area A), and 12 (Area B) before switching to the use of shiftwidth/softtabstop.  In normal mode, << and >> are remapped to ignore the first 7 columns, and with Vim 7, < and > serve as more general operator maps (>ap to indent a paragraph).  These two behaviors (insert vs. normal mode) are a bit different but generally what one would expect.

This script works well coupled with vimscript #1654 .
 
install details
Unzip in ~/.vim or ~\vimfiles (Windows).  The filetype is already detected by Vim.

An autocmd similar to the following is recommended for optimal use (place in your vimrc):

autocmd FileType cobol set sw=4 sts=4 et sta tw=72
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
cobol.zip 2.0 2009-12-22 6.0 Tim Pope Distribute indent and ftplugin together
cobol.vim 1.2 2006-11-08 6.0 Tim Pope Indent after ELSE
cobol.vim 1.1 2006-09-13 6.0 Tim Pope Initial upload
ip used for rating: 142.132.191.50

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github