博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
gvim work notes.. a few days' work on 64bit vim and plugin compilations
阅读量:6479 次
发布时间:2019-06-23

本文共 6076 字,大约阅读时间需要 20 分钟。

(a 600MB+ sized c/c++ compiler which is capable of hi-light and JB styled completion!! and of-course with VIM efficiency !!)

Till now, several days passed before I started learning to compile a self-designed gvim.. It is no good experience, but full of discoveries.

First of all, I want to point out that all the plugins loaded or wish to be loaded by vim needs to have the same bit-width. That means, using 32 bits of vim requires all its components including its plugins to be 32 bits.

  1. It seems to use 32bit version is recommended on vim's official site, but you know, it feels not quite good when running 32bit apps on 64bit machine. So downloaded two source files from official site, one is runtime binaries, and the other is the source. Unrar these compressed data to one file named 'vim64' is suggested.
  2. To install/compile the souce file, need to install python/python3 (required), something like "nmake -f Make_mvc.mak GUI=yes PYTHON3=path PYTHON3_VER=3X DYNAMIC_PYTHON3=yes MSVCVER=m.n CPU=AMD64/IA64" needs to be run in cmd. If well-configured, gvim/vim is generated in the /src folder, for more, read the Make_*.mak file according to your compiler, if nmake, *=mvc (note to compile linux ver of vim, need to configure && make && make install, where prefix. enable-pythoninterp, enable-luainterp, enable-python3interp, enable-cscope, enable-rubyinterp, enable-perlinterp, enable-python2interp might need to be specified at configure time.) If python/python3 are not installed in ordinary path, specify it by with-python-config-dir/with-pythno3-config-dir=/usr/lib/python3.x/config/ along with the enable options.
    ./configure --prefix=/usr --enable-luainterp --enable-pythoninterp --enable-python3interp --enable-cscope --with-python-config-dir=/usr/lib64/python2.7/config/ --with-python3-config-dir=/usr/lib64/python3.4/config-3.4m/

     

  3. To configure for better experiences in gvim, some plugins are recommended. jiangmiao/auto-pairs, Lokaltog/vim-powerline, xuhdev/SingleCompile, scrooloose/syntastic, Valloric/YouCompleteMe, VundleVim/Vundle.vim, sickill/vim-pasta and so on, might add/delete in the future.

Here's my _vimrc file: (it's only for my own usage, very likely to have flaws.. and it's for Win usage)

 

1 set nocompatible 2 filetype off 3  4 set rtp+=$VIM/vimfiles/bundle/Vundle.vim/ 5 call vundle#rc('$VIM/vimfiles/bundle/') 6  7 Plugin 'VundleVim/Vundle.vim' 8 Plugin 'jiangmiao/auto-pairs' 9 Plugin 'bufexplorer.zip'10 Plugin 'Lokaltog/vim-powerline'11 Plugin 'wesleyche/SrcExpl'12 Plugin 'junegunn/limelight.vim'13 Plugin 'sickill/vim-pasta'14 Plugin 'scrooloose/syntastic'15 Plugin 'xuhdev/SingleCompile'16 Plugin 'Valloric/YouCompleteMe', {
'do':'./install.py'}17 Plugin 'chriskempson/base16-vim'18 19 let c_cpp_comments=020 21 filetype plugin indent on22 23 noremap
k24 noremap
j25 noremap
h26 noremap
l27 28 syntax on29 filetype on30 filetype plugin on31 filetype plugin indent on32 let g:ycm_auto_trigger = 133 let g:ycm_min_num_of_chars_for_completion = 234 let g:ycm_global_ycm_extra_conf = 'E:/vim64/vimfiles/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'35 set t_Co=25636 set backspace=237 set smartindent38 set expandtab39 set tabstop=440 set shiftwidth=441 set smarttab42 set foldenable43 set foldmethod=indent44 set autoread45 set ignorecase46 set smartcase47 48 imap
49 imap
50 imap
51 imap
52 53 set nu54 set laststatus=255 set cmdheight=256 set cursorline57 set nowrap58 colorscheme base16-tomorrow59 set shortmess=atI60 set guioptions-=m61 set guioptions-=T62 set guioptions-=r63 set guioptions-=L64 set encoding=utf-865 set fenc=utf-866 set fileencodings=utf-8,latin-1,ascii,gbk,usc-bom,cp936,Shift-JIS67 set ff=unix68 set fileformats=unix,dos,mac69 70 language messages zh_CN.utf-871 72 nnoremap
:w
73 nnoremap
ESC74 nnoremap
:nohl
75 nnoremap
:SCCompile
76 nnoremap
:SCCompileRun
77 nnoremap
:SCChooseCompiler
78 let g:ycm_min_num_identifier_candidate_chars = 279 let g:ycm_semantic_triggers = {80 \ 'c' : ['->', '.'],81 \ 'objc' : ['->', '.', 're!\[[_a-zA-Z]+\w*\s', 're!^\s*[^\W\d]\w*\s',82 \ 're!\[.*\]\s'],83 \ 'ocaml' : ['.', '#'],84 \ 'cpp,objcpp' : ['->', '.', '::','re!\w+'],85 \ 'perl' : ['->'],86 \ 'php' : ['->', '::'],87 \ 'cs,java,javascript,typescript,d,python,perl6,scala,vb,elixir,go' : ['.'],88 \ 'ruby' : ['.', '::'],89 \ 'lua' : ['.', ':'],90 \ 'erlang' : [':'],91 \ }92 autocmd InsertLeave * :pclose

 

note that some maps of keys might be in collision, use :verbose i/nmap <c-*> to check it out!

It's not a big problem until I came across Valloric/YouCompleteMe.. This plugin needs to be compiled before utilization..

4-step preparations: (Of course, python is previously installed on your machine.. and it's not included in the 4 preparations)

  1. get ycm from git
  2. get cmake
  3. get clang
  4. 7z installed

Notes: to get ycm from git, just use vundle to manage, type :PluginInstall (It might be :BundleInstall or whatever else..), wait till done

to get cmake, download a binary and install it, remember to add its bin path to env-path..

to get clang, download a binary according to system and use 7z to unzip it to $YCM/ycm_temp/llvm_root/

Then we have to build the ycm app:

https://github.com/Valloric/YouCompleteMe#windows

Other systems guides can also be found there...

  1. create folder ycm_build in $YCM
  2. generate makefiles, using cmake -G "Visual Studio m.n Win64" "$YCM/ycm_temp/llvm_root" . "$YCM/third_party/ycmd/cpp" in the created folder
  3. compile with the generated files and .vcxproj, cmake --build . --target ycm_core --config Release -- -j 4 in the same folder

Done.

 

plugin: cscope

Plugin 'brookhoog/cscope.vim'nnoremap 
fa :call CscopeFindInteractive(expand('
'))

are the vim's quirk techniques.

 

reopen file in vim at last closed file location, by:

source /usr/share/vim/vim*/vimrc_example.vimor:source /usr/share/vim/vim*/defaults.vim# in the file contains an intro that explains reopen at last closed location

 

转载于:https://www.cnblogs.com/sansna/p/5474015.html

你可能感兴趣的文章
创建一个多级文件目录
查看>>
Picasa生成图片幻灯片页面图文教程
查看>>
svn status 显示 ~xx
查看>>
常用HiveQL总结
查看>>
[转]使用Visual Studio Code开发Asp.Net Core WebApi学习笔记(三)-- Logger
查看>>
POJ 3311 Hie with the Pie(状压DP + Floyd)
查看>>
Security updates and resources
查看>>
DNS为什么通常都会设置为14.114.114.114
查看>>
Sqoop架构(四)
查看>>
golang copy函数
查看>>
《你有多少问题要请示》精华集粹
查看>>
打印图片
查看>>
SHOW CREATE DATABASE Syntax
查看>>
rsync常见问题及解决办法
查看>>
MySQL日期 专题
查看>>
C#中禁止程序多开
查看>>
分布式缓存Redis使用以及原理
查看>>
Activity竟然有两个onCreate方法,可别用错了
查看>>
Linux经常使用命令(十六) - whereis
查看>>
Linux五种IO模型
查看>>