GVIM&VIM Applying

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,

Linux Windows
Config File Name .vimrc _vimrc
Plugin Dir Name .vim vimfiles


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.

發佈了20 篇原創文章 · 獲贊 1 · 訪問量 5372
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章