GVIM&VIM Applying

本文介绍如何在Windows环境下安装配置Vim及其插件管理器Vundle,并详细讲解了YouCompleteMe插件的安装与编译过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Prerequisites

In my win64-x64 system,the prepared softwares are
  • vim_8.0_x64 (pre_built) (view via :version)
  • python_2.7.10_x64 (have Python headers installed)
  • cmake_3.6.3_x64 (added in PATH environment variable and its use is generating required makefiles)
  • visual studio 2015 community with c++ runtime lib
  • 7-zip

Vundle

It is short for vim bundle, that is one of vim plugin manager.

Its features include:
  • trace and configure your pulgins in vim configuration file
  • install,update and clean plugins (clean will clean up plugins you comment out from plugin directory)
  • search vim scripts
  • automatically manage runtime path of vim scripts and regenerate help tags
Its installation needs following environment:
  • git (git clone)
  • curl (search)

Note: different files name on windows from linux. take console vim config as an example,

LinuxWindows
Config File Name.vimrc_vimrc
Plugin Dir Name.vimvimfiles


at basic of above knowledge, start installing by execute

git clone https://github.com/VundleVim/Vundle.vim.git %USERPROFILE%/.vim/bundle/Vundle.vim

where “%USERPROFILE%” refers to current pc user profile or home directory, here same with “%HOME%”.

Its simple configuration

mainly for build plugins block, then convenient to play its role in feature. take gvim config as an example, basic structure as follows,

filetype off 
set rtp+=%USERPROFILE%/vimfiles/plugin/Vundle.vim
call vundle#begin('%USERPROFILE%/vimfiles/plugin/')
Plugin '***'
Plugin '***'
call vundle#end()
filetype plugin indent on

YouCompleteMe

Softwares referred by first part serve to this part , whose difficulty lies in build/compile for its source code.

YCM install by Vundle
add "Plugin 'Valloric/YouCompleteMe' " into vim config file
:PluginInstall or :PluginUpdate if already exists
YCM build

This part is mainly for compiling YCM and generate ycm core library (ycm_core.pyd) which default supports python smart completer and reside in YouCompleteMe\third_party\ycmd.
It is c++ engine that YCM use to get fast completions.

Matters:

  • architecture of VIM keeps consistent with that of Python, like both are x64 and VIM supports python_2 or python_3 (py3 preferred officially).
  • YCM offically supports VC/generator below,
    MSVC 12 for visual studio 2013
    MSVC 14 for visual studio 2015
    MSVC 15 for visual studio 2017

Here, compiling YCM without semantic support for c-family languages(c,c++ and objective-c/c++),

cd %USERPROFILE%/vimfiles/plugin/YouCompleteMe
python install.py (if using python launcher, py -2 install.py), where msvc option in the script selects 15.0 as default

Above directly generating target library.
Besides, through compiling, there exists pthread.h not found and a dozen of warnings on datatype conversion, however both are ignored as the former is confirmed not an issue on windows by top two official contributor
If failed, also you can,

cd %USERPROFILE%
mkdir ycm_build
cd ycm_build
# bellow,not care about semantic support for c-family languages and 
# <generator> can be "visual studio 14 Win64" for x64 architecture.
cmake -G "<generator>" . %USERPROFILE%/vimfiles/plugin/YouCompleteMe/third_party/ycmd/cpp

After configuration files have been generated, compile the libraries by

#--config Release is specific for windows
cmake --build . --target ycm_core --config Release

nerdtree

IMPORTANT PART!
it presents fs to you in the form of tree.
some features are listed below,

  • files and directories are displayed in a hierarchical tree structure
  • multiple types of nodes can be highlighted
  • customisable mappings are provided
  • files and dirs can be bookmarked
  • tree nodes navigation can be done with mouse
  • position and size of tree window can be customised

the plugin depends on Vundle and VIM configuration seriously.
As for my local example in windows 7, vim determine dir structure like
%HOME%\vimfiles\bundle\ as plugin dir of Vundle, while Vundle plugin config block should be placed in _vimrc file. As for gui-specific startup commands or some that can be executed after loading&execute cmds/instructions in _vimrc files, only can be placed in _gvimrc file. For example, statements/ex/cmds on messy code on menu font.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值