Not to be outdone by Emacs, Vim can be equally productive in editing
CFEngine files. Here I’ll show you how to set up and get started with the
vim_cf3 plugin can be found at https://github.com/neilhwatson/vim_cf3. Copy the relevant
parts into your $HOME/.vim/ directory:
The file type plugin for file editing: $HOME/.vim/ftplugin/cf3.vim.
The syntax highlighting file: $HOME/.vim/syntax/cf3.vim.
The help file: $HOME/.vim/doc/cf3.txt.
The help directory and its contents: $HOME/.vim/snippets.
Here is a minimum .vimrc to make the plugin work and associate it with filenames ending in .cf:
set smartindent set autoindent syntax on filetype plugin indent on :helptags ~/.vim/doc/ au BufRead,BufNewFile *.cf set ft=cf3 " enable vim_cf3 plugin abbreviations let g:EnableCFE3KeywordAbbreviations=1 fun! Getchar() let c = getchar() if c != 0 let c = nr2char(c) endif return c endfun fun! Eatchar(pat) let c = Getchar() return (c =~ a:pat) ? '' : c endfun
There is a Vim help file that comes with
In command mode,
:help cf3 will call the help. You can
also be more specific (for example,
:help cf3abb) to
call help about abbreviations.
Once the plugin is installed you can begin using it. Edit any exiting or new CFEngine file. The filename must end in .cf in order for the plugin to recognize it (you can also activate the plugin by hand on any file by executing ...