cmake.vim


Ⅰ. 插件描述

:hammer: CMake functionality within Vim.

Ⅱ. 基本信息

创建日期:  2013-06-28
使用用户:  33
Github星:  79
插件作者:  Jacky Alciné

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'jalcine/cmake-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'jalcine/cmake-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'jalcine/cmake-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/jalcine/cmake.vim

Ⅳ. 文档说明

Stories in Ready)

CMake Interoperability in Vim

Searching For a Maintainer

This project is not being actively maintained by Jacky Alcine. If
you'd like to contribute to improve this project, please submit pull requests
(Jacky is still reviewing them) and over time, the most active contributor
can take the reigns.

cmake.vim 0.5.5 is a Vim plugin that aims to bind CMake
within Vim for your CMake-based projects. This project has not reached a 1.0.0
release and thus isn't fully ready for production.

Installing

I recommending using Vundle to install plugins. The line necessary
to add this plugin is as follows:

Bundle 'jalcine/cmake.vim'

Alternatively Plug:

Plug 'jalcine/cmake.vim'

Releases are made on Vim.org's scripts as well on patch-level releases.

Requirements

cmake.vim is a pure Vimscript plugin, thus requiring nothing but Vim
itself being over version 7.3 or greater. Patches to support older versions of
Vim are greatly appreciated!

Getting Started

After you installed the plugin, just cd into the directory where the
top-level CMakeLists.txt can be found and run:

" Create a new binary directory for your clean project.
:CMakeCreateBuild <build-dir-name>

" Build all of the targets.
:CMakeBuild

" Clean up bad builds.
:CMakeClean

cmake.vim does not bind to any keys by default. Check :h cmake for more
information.

Add the following to your .vimrc if you haven't already.
You will be able to type :CMake<tab> to discover available commands.

set wildmenu
set wildmode=longest:full,full " Display Vim command mode autocompletion list

Commands

cmake.vim defines a few methods for generic interaction with CMake. Check
out :help cmake-methods for more information.

Options

In order for CMake to operate, it has to know where the build directory is

  1. This is done automatically by the plugin but it does need help in the
  2. that you happen to build your CMake project in a sub-directory. Check

out :help cmake-options for more information.

Testing

The test suite is written using RSpec and Vimrunner. The following would do a
full unit test of the entire system:

bundle install && rake

The project uses Guard as well for automated tests. Be sure to check out the
submodules as well to test if external plugins like [syntastic][] and
YouCompleteMe work as expected.

Known Edgecases

  1. If you use a header file as the source file, the plugin only knows of the
    source files (which sometimes are generated) and doesn't update the
    b:cmake_target variable correctly.

License

This code is released and available under the MIT license. Multiply and be
fruitful.

Similar Projects

There's a few other projects out there that aim to achieve the same goal as
cmake.vim. Feel free to send a PR if you want your project listed here.

Author

I'm Jacky Alcine and I like code. A lot. I also chat a lot like a
firehose so follow with caution!

添加新评论