Code completion and syntax highlighting with VIM

The VIM editor

VIM is a well-known source code editor for programmers.

Automatic code completion and syntax highlighting is supported by fglcomp and fglform compilers, when using VIM.

Important: In order to use Genero code completion with VIM, you need at least VIM version 7 with the Omni Completion feature.

Configuring VIM for Genero BDL

Perform the following steps to enable code-completion for Genero:

  1. Copy Genero VIM plugin files from FGLDIR/vimfiles onto your VIM plugin directory:
    • On Unix platforms, the VIM plugin directory is ~/.vim.
    • On Windows platforms, the VIM plugin directory is %USERPROFILE%\vimfiles.
  2. Add the following lines to your VIM resouces file
    • On Unix plaforms, the VIM resource file is ~/.vimrc.
    • On Windows plafrorms, the VIM resource file is %USERPROFILE%\_vimrc.
    autocmd BufNewFile,BufRead *.per setlocal filetype=per
    syntax on
Alternatively, if you often switch between different versions of Genero BDL, you can reference the Genero VIM files directly without copying them, by adding the following lines to your VIM resource file:
let generofiles=expand($FGLDIR . "/vimfiles")
if isdirectory(generofiles)
   let &rtp=generofiles.','.&rtp
endif
autocmd BufNewFile,BufRead *.per setlocal filetype=per
syntax on
Note: In fact, the .4gl file type "fgl" is usually detected in the default configuration files of VIM (like /usr/share/vim/vim80/filetype.vim). If this file type is not detected by default by your VIM installation, add the next line in your .vimrc file:
autocmd BufNewFile,BufRead *.4gl setlocal filetype=fgl

Using VIM on Microsoft Windows platforms

On Windows platforms, you typically install the GVim (Graphical VIM) software.
Note: Some versions of VIM for Windows may use different configuration files and locations (_vimrc or .vimrc?). Refer to the VIM documentation, to make sure that you use the proper files.
When using the command line version VIM, you may want to add:
color shine

Using code completion with Genero and VIM

First make sure the Genero environment is set (FGLDIR, PATH).

Open a .4gl or .per file, start to edit the file with VIM.

Note: On Windows platforms, if you start GVim from the icon, the Genero environment may not be set. As result fglcomp/fglform cannot be called from VIM. You need to set the Genero BDL environment before starting VIM.

When in insert mode, press CTRL-X + CTRL-O, to get a list of language elements to complete the instruction syntax or expression.

For convenience, TAB can also be used to get the completion list as with the CTRL-X + CTRL-O key combinations. However, TAB will only show the completion list, if the edit cursor in after a keyword: At the beginning of the line, TAB adds indentation characters.

For more details about VIM, see http://www.vim.org.