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 on UNIX-like platforms

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

  1. Copy $FGLDIR/lib/fglcomplete.vim into the ~/.vim/autoload directory.
  2. Copy $FGLDIR/lib/fgl.vim into the ~/.vim/syntax directory.
  3. Copy $FGLDIR/lib/per.vim into the ~/.vim/syntax directory.
  4. Add the following lines to your VIM resouces file (~/.vimrc file):
    autocmd Filetype fgl setlocal omnifunc=fglcomplete#Complete
    autocmd Filetype per setlocal omnifunc=fglcomplete#Complete
    syntax on
    au BufNewFile,BufRead *.per setlocal filetype=per 

You are ready.

Configuring VIM files 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.

Perform the following steps to enable code completion for Genero:

  1. Copy %FGLDIR%\lib\fglcomplete.vim into the %USERPROFILE%\vimfiles\autoload directory.
  2. Copy %FGLDIR%\lib\fgl.vim into the %USERPROFILE%\vimfiles\syntax directory.
  3. Copy %FGLDIR%\lib\per.vim into the %USERPROFILE%\vimfiles\syntax directory.
  4. Add the following lines to your VIM resouces file (%USERPROFILE%\_vimrc file):
    autocmd Filetype fgl setlocal omnifunc=fglcomplete#Complete
    autocmd Filetype per setlocal omnifunc=fglcomplete#Complete
    syntax on
    au BufNewFile,BufRead *.per setlocal filetype=per
    When using the command line version VIM, you may want to add:
    color shine

You are ready.

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.