Saturday, March 14, 2009

Vim omni completion for CMake

As CMake uses its own language, learning what commands are available can be a bit of a pain. I've written this really basic Vim omni completion plugin that takes some of the effort out of getting to know the API. Install the file to the autoload directory in your .vim directory, i.e in ~/.vim/autoload/, and add the following line to your .vimrc file
  autocmd FileType cmake set omnifunc=cmakecomplete#Complete
Now when you edit a CMakeLists.txt file, it should do omni completion when you summon help with the Ctrl-X Ctrl-O enchantment. Maybe someone will find it useful.

I've only tested this with the latest CMake and Vim versions, it is quite likely that I assume things that do not work in earlier editions of these programs. Patches welcome ;-)

Edit: Updated to add property and module completion