Ⅰ. 插件描述
Vim plugin for CMake projectsⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'ilyachur/cmake4vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'ilyachur/cmake4vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'ilyachur/cmake4vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/ilyachur/cmake4vim
Ⅳ. 文档说明
# cmake4vim
I created this plugin in order to improve integration CMake to the Vim editor. I tried different plugins for vim which allow to work with cmake but I didn't find the plugin which was satisfied my requrements.
This plugin shows cmake results using quickfix list. If you installed vim-dispatch plugin, it will be use it, this means that if you are using vim with tmux, cmake output will be printed in a separate window.
This plugin allow to specify cmake targets in order to avoid building of all project. If you use CtrlP or FZF you can use them to select cmake target.
If you want to generate a make command from cmake, you can use this plugin to set some flags for the make command (for example -jN and etc).

Installation
You can use VimPlug for installation:
Plug 'ilyachur/cmake4vim'Or Pathogen:
cd ~/.vim/bundle
git clone https://github.com/ilyachur/cmake4vimCommands
The current version of the plugin supports next commands:
:CMakecreates a build directory (if it is necessary) and generates cmake project.:CMakeResetAndReloadremoves cmake cache and re-generates cmake project.:CMakeResetremoves cmake cache (this command removes the cmake build directory).:CMakeCleancleans the project (it is equal of the executionmake clean).:CMakeSelectTargetselects a target for project. You can put target name as a parameter for the command. If you don't put the target name as a parameter, plugin collects targets as a list and you will be able to choose target from this list.:CtrlPCMakeTargetyou can use CtrlP in order to select a target for project.:FZFCMakeSelectTargetyou can use FZF in order to select a target for project.
Variables
Plugin supports special global variables which are allow to change behaviour of commands (you can change them in your .vimrc):
g:cmake_reload_after_saveif this variable is not equal 0, plugin will reload CMake project after saving CMake files. Default is 0.g:cmake_change_build_commandif this variable is not equal 0, plugin will change the make command. Default is 1.g:cmake_build_dirallows to set cmake build directory. Default is 'cmake-build-${g:cmake_build_type}'.g:cmake_build_targetset the target name for build. Default is 'all'.g:make_argumentsallows to set custom parameters for make command. Default is empty. If variable is empty, plugin launchesmakewithout arguments.g:cmake_project_generatorallows to set the project generator for build scripts. Default is empty.g:cmake_install_prefixallows to change-DCMAKE_INSTALL_PREFIX. Default is empty.g:cmake_build_typeallows to change-DCMAKE_BUILD_TYPE. Default is empty. If variable is empty, plugin tries to detect cached build type. And selects 'Release' type if cmake cache doesn't exist.g:cmake_c_compilerallows to change-DCMAKE_C_COMPILER. Default is empty.g:cmake_cxx_compilerallows to change-DCMAKE_CXX_COMPILER. Default is empty.g:cmake_usr_argsallows to set user arguments for cmake. Default is empty.g:cmake_compile_commandsif this variable is not equal 0, plugin will generate compile commands data base. Default is 0.g:cmake_compile_commands_linkset the path for a link on compile_commands.json. Default is empty.
References
Author
Ilya Churaev ilyachur@gmail.com
Licence
GPL-3.0