目的:达到我自己自定义安装插件的目的

安装YCM(YouCompleteMe)自动补全神器之前的准备

先安装编译环境:

1
2
sudo apt-get install build-essential cmake
sudo apt-get install python-dev

在安装之前运行一下命令(后续会知道它的用途):

1
vim .vimrc.before.local

在里面写入如下代码(是我自己的配置):

1
let g:spf13_bundle_groups=['general''writing''programming',  'python''misc''youcompleteme', ]

上面代码会在安装spf13的时候默认根据配置去安装插件。最下面会解释为何要如此配置。

安装git软件(如果你没有安装的话,用来克隆spf13项目):

1
sudo apt-get install git

切换到$HOME目录,然后运行:

1
2
cd $HOME
git clone https://github.com/spf13/spf13-vim.git

克隆好项目后,HOME目录中就会有一个名为“spf13-vim”的文件夹进入这个文件夹,并运行

1
./bootstrap.sh

就会按照自己的配置进行安装了。

YCM编译安装:在全部插件安装完成后(下载YCM的时,可能需要点时间),然后在进行编译安装:

  1. 在编译安装YCM之前,需要Clang和LLVM这个环境进行编译。我们建立一个目录用来存放临时编译的文件,(安装YCM的东东全部在建立的目录下进行执行,执行命令)有两种方式进行安装:第一,使用官方源进行安装

  2. 1
    mkdir ycm_build
  3. 1
    cd ycm_build
  4. apt-get install clang llvm

    第二种,去clang的官方地址上去进行下载并进行安装,编译安装可参考http://howiefh.github.io/2015/05/22/vim-install-youcompleteme-plugin/

    zhongcq博客

http://zuyunfei.com/2013/05/16/killer-plugin-of-vim-youcompleteme/

  1. 我这里只介绍通过官方源进行安装的(因为简单快捷):

  2. 确认安装的包完整性:

  3. 1
    cd ~/.vim/bundle/YoucompleteMe
  4. 1
    git submodule update --init --recursive
  5. 我们需要找到libclang.so的路径在哪里,一般是在/usr/目录下使用一下命令查找

  6. 1
    find /usr/ -name "libclang.so*"

    我查找到的目录为:

    /usr/lib/llvm-3.5/lib/libclang.so.1

  7. 通过官方的知道得知需要运行一下命令

    参考官方解释:

  8. cmake -G "<generator>" . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp

    For those who want to use the system version of boost, you would pass -DUSE_SYSTEM_BOOST=ON to cmake. This may be necessary on some systems where the bundled version of boost doesn't compile out of the box.

  9. 根据官方的解释,我们执行如下语句:

  10. 1
    cmake -G "Unix Makefiles" -DEXTERNAL_LIBCLANG_PATH=/usr/lib/llvm-3.5/lib/libclang.so.1 ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp

然后:

Now that configuration files have been generated, compile the libraries using this command:

cmake --build . --target ycm_support_libs --config Release

直接执行如上语句

cmake --build . --target ycm_support_libs --config Release

使用NeoCompleteEnable出现的如下问题

我使用的是tty1这种终端;

安装完成后发现不能自动提示,在命令模式“:”下输入“NeoCompleteEnable”发现不能启动提示

1
2
3
It requires Vim 7.3.885 or later with Lua support ("+lua")

按照github上的方法安装vim-nox、vim-athena就可以解决问题{传送门}(https://github.com/spf13/spf13-vim/issues/773):(一般只需安装vim-nox[此为脚本语言的支持])

1
2
sudo apt-get install vim-nox
sudo apt-get install vim-athena

自动补全不能只能提示(针对NeoComplete插件)

在使用过程中,自动提示的东西不能显示,还是那种插件形式的。

解决方法{传送门}(https://github.com/spf13/spf13-vim/issues/819):

在.vimrc.loacl中添加如下代码:

1
inoremap <expr><CR> neosnippet#expandable() ? neosnippet#mappings#expand_or_jump_impl() : pumvisible() ? neocomplete#close_popup() : "\<CR>"

 

 

不显示配色效果:

在.vimrc.loacl中添加如下代码【可参考(http://www.cnblogs.com/keepHack/archive/2012/04/09/2439361.html)】:

1
set t_Co=256

 

spf13-vim作者的github中有个这样的文件.vimrc.bundles有着下面这段代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
" In your .vimrc.before.local file
" list only the plugin groups you will use
    if !exists('g:spf13_bundle_groups')
        let g:spf13_bundle_groups=['general''writing''neocomplete''programming''php''ruby''python''javascript''html''misc',]
    endif
 
    " To override all the included bundles, add the following to your
    " .vimrc.bundles.local file:
    "   let g:override_spf13_bundles = 1
    if !exists("g:override_spf13_bundles")
 
    " General {
        if count(g:spf13_bundle_groups, 'general')
            Bundle 'scrooloose/nerdtree'
            Bundle 'altercation/vim-colors-solarized'
            Bundle 'spf13/vim-colors'
            Bundle 'tpope/vim-surround'
            Bundle 'tpope/vim-repeat'
            Bundle 'jiangmiao/auto-pairs'
            Bundle 'ctrlpvim/ctrlp.vim'
            Bundle 'tacahiroy/ctrlp-funky'
            Bundle 'kristijanhusak/vim-multiple-cursors'
            Bundle 'vim-scripts/sessionman.vim'
            Bundle 'matchit.zip'
            if (has("python") || has("python3")) && exists('g:spf13_use_powerline') && !exists('g:spf13_use_old_powerline')
                Bundle 'Lokaltog/powerline', {'rtp':'/powerline/bindings/vim'}
            elseif exists('g:spf13_use_powerline') && exists('g:spf13_use_old_powerline')
                Bundle 'Lokaltog/vim-powerline'
            else
                Bundle 'bling/vim-airline'
            endif
            Bundle 'powerline/fonts'
            Bundle 'bling/vim-bufferline'
            Bundle 'Lokaltog/vim-easymotion'
            Bundle 'jistr/vim-nerdtree-tabs'
            Bundle 'flazz/vim-colorschemes'
            Bundle 'mbbill/undotree'
            Bundle 'nathanaelkane/vim-indent-guides'
            if !exists('g:spf13_no_views')
                Bundle 'vim-scripts/restore_view.vim'
            endif
            Bundle 'mhinz/vim-signify'
            Bundle 'tpope/vim-abolish.git'
            Bundle 'osyo-manga/vim-over'
            Bundle 'kana/vim-textobj-user'
            Bundle 'kana/vim-textobj-indent'
            Bundle 'gcmt/wildfire.vim'
        endif
    " }

这段代码中有下面这段:

1
2
3
4
5
" In your .vimrc.before.local file
" list only the plugin groups you will use
    if !exists('g:spf13_bundle_groups')
        let g:spf13_bundle_groups=['general''writing''neocomplete''programming''php''ruby''python''javascript''html''misc',]
    endif

前面两句是注释,说:在.vimrc.before.local这个文件中列出了你将要使用的插件,下面那句代码意思就是如果不存在设置,那么就会默认使用下面的插件:

1
'general''writing''neocomplete''programming''php''ruby''python''javascript''html''misc'

下面这段(我只截取的部分)是说明,如果spf_bundle_groups包含了general就安装下面的插件

1
2
3
4
5
6
" General {
        if count(g:spf13_bundle_groups, 'general')
            Bundle 'scrooloose/nerdtree'
            Bundle 'altercation/vim-colors-solarized'
            Bundle 'spf13/vim-colors'
            ……………………………………
1
<br>

以下所有的设置都在.vimrc.local中:

设置颜色:set t_Co=256才能正确的显示配色的效果

参考网站:http://harrycode.logdown.com/posts/197145-simple-steps-to-build-cool-vim-development-environment

http://twocucao.xyz/2015/03/01/%E7%BC%96%E8%BE%91%E5%99%A8Vim/

http://www.cnblogs.com/274914765qq/p/4439189.html

https://github.com/Valloric/YouCompleteMe#c-family-semantic-completion-engine-usage

http://www.cnblogs.com/keepHack/archive/2012/04/09/2439361.html

可参考:http://blog.jobbole.com/58978/

可参考:k-vim进行自己的配置设置

后续遇到的问题,会继续添加

使用vim配置方案spf13中碰到的一些问题的更多相关文章

  1. 简洁vim配置方案Janus(1)

    最近不想在编辑器上花太多的精力,所以找到个不错的解决方案. 在不懂vim配置的前提下也能用的很开心. 1,下载安装Janus(https://github.com/carlhuda/janus) 安装 ...

  2. Github上star和fork比较高的vim配置方案

    https://github.com/amix/vimrchttps://github.com/humiaozuzu/dot-vimrchttps://github.com/spf13/spf13-v ...

  3. 配置使用ldap中碰到的各种问题 --- 吐血

    1.   LDAP Result Code 50 "Insufficient Access Rights" : 权限的问题: 解决: 使用docker部署吧, 看我其他的博客

  4. gVim 配置方案 采用Vundle管理插件

    在Linux下配置vim非常简单,尤其是采用Vundle来管理插件,使得一切用起来得心应手. Maple大神在github上公布了自己的vim配置方案,相当方便好用.详见 https://github ...

  5. Vim常用命令及配置方案

    Vim常用命令及配置方案   几句话 很久之前就接触到vim,初学那阵觉得vim很酷炫,但确实对新手不是很友好.我也就简单看了下基本操作就上手了,但又不是长期在vim下工作,这就导致了每一次重新使用v ...

  6. web.config中sessionState节点的配置方案

    web.config中sessionState节点的配置方案 web.config关于sessionState节点的配置方案,sessionState有五种模式:Custom,off,inProc,S ...

  7. Nginx+Php中限制站点目录防止跨站的配置方案记录

    Nginx+Php中限制站点目录防止跨站的配置方案记录(使用open_basedir)-------------------方法1)在Nginx配置文件中加入: 1 fastcgi_param  PH ...

  8. Vim配置(python版)

    由于马上将用到django框架,需要有一个好的ide来coding,之前做C的开发时候体会到了vim的强大,所以编写python也决定采用vim. PS:除了vim,一般浏览代码多用atom和subl ...

  9. acm的ubuntu (ubuntu16.04 安装指南,chrome安装,vim配置,git设置和github,装QQ)

    日常手贱把ubuntu14.04更新到了16.04,然后就game over了.mdzz,不然泥萌也看不到这篇博客了=.= 然后花了些时间重装了一个16.04版的,原来那个14.04的用可以用,就是动 ...

随机推荐

  1. 谈一谈struts2和springmvc的拦截器

    最近涉及到了两个项目,都需要考虑全局的拦截器,其功能就是判断session的登陆状态,如果session信息完好,可以从中取得相应的信息,则放行,否则拦截,进入重定向的uri. 既然是全局的拦截器,其 ...

  2. WebService和AngularJS实现模糊过滤查询

    WebService和AngularJS实现模糊过滤查询   [概要] 网上看到一个不错的帖子,用WebService获取json,然后在前端使用AngularJs进行过滤搜索,看完文章后,按自己的想 ...

  3. C# 学习笔记2 C#底层的一些命令运行

    C#在DCP中运行的方法: 1.转到相应的目录 cd d:\1 2.输入csc /target:exe 2.cs 或者 csc /t:exe 2.cs 或者 csc 2.cs 在里边引用外部程序集的方 ...

  4. C# 各种相对路径

               //获取当前可执行的exe的文件名             string str1 = Process.GetCurrentProcess().MainModule.FileNa ...

  5. 基于byte[]的HTTP协议头分析代码

    smark 专注于高并发网络和大型网站架规划设计,提供.NET平台下高吞吐的网络通讯应用技术咨询和支持 基于byte[]的HTTP协议头分析代码 最近需要为组件实现一个HTTP的扩展包,所以简单地实现 ...

  6. 2013集训.DAY1.A

    发现自己漏整理了一套,现在附上T1:primenumT2:sendroseT4:warfare除了第一题以外,其余的两题由于当时太弱什么都不会,所以用来学习....T2 SPFA T4 最大生成树

  7. c# 自定义多选下拉列表2

    以下为工作中遇到的,备注一下 先需要几个辅助类 #region GripBounds using System.Drawing; internal struct GripBounds { ; ; pu ...

  8. .Net 异步随手记(二)

    Task.ContinueWith 这货,和 await 一样有“陷阱”.^^,因为写 ContinueWith 不能直观如人的“过程性”思维,写在 ContinueWith 括号里的部分不一定只在发 ...

  9. [置顶] 学习JDK源码:可进一步优化的代码

    1.参数化类型的构造函数比较啰嗦 new HashMap<String, List<String>>() 如果你调用参数化类的构造函数,那么很不幸,你必须要指定类型参数,即便上 ...

  10. IP选路

    IP选路 1.概述      路由算法是用于获取路由表中的路由项目.它是路由选择协议的核心. 2.路由算法的分类      从路由算法能否随网络的通信量或拓扑自适应的进行调整变化来分,可以分为两类. ...