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

5 comments:

  1. Anonymous1:55 am

    ths

    ReplyDelete
  2. Anonymous1:12 pm

    This comment has been removed by a blog administrator.

    ReplyDelete
  3. Great work! Thanks for the helpful script!

    ReplyDelete
  4. I didn't know about this feature. It even displays help about particular macros. Brilliant, thanks!

    ReplyDelete

Note: only a member of this blog may post a comment.