使用vim配置方案spf13中碰到的一些问题

发布时间:2020-07-29 12:04:39 作者:狼本善
来源:网络 阅读:15797

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


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

先安装编译环境:

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



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

vim .vimrc.before.local

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

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

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


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

sudo apt-get install git

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

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

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

./bootstrap.sh

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



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

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

  2. mkdir ycm_build
  3. 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. cd ~/.vim/bundle/YoucompleteMe
  4. git submodule update --init --recursive
  5. 我们需要找到libclang.so的路径在哪里,一般是在/usr/目录下使用一下命令查找

  6. 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. 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”发现不能启动提示

“
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[此为脚本语言的支持])

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

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

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

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

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

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)】:

set t_Co=256



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


" 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
    " }


这段代码中有下面这段:

" 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这个文件中列出了你将要使用的插件,下面那句代码意思就是如果不存在设置,那么就会默认使用下面的插件:

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

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

" General {
        if count(g:spf13_bundle_groups, 'general')
            Bundle 'scrooloose/nerdtree'
            Bundle 'altercation/vim-colors-solarized'
            Bundle 'spf13/vim-colors'
            ……………………………………

以下所有的设置都在.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进行自己的配置设置


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

推荐阅读:
  1. vim的使用
  2. 我的VIM -- vimrc配置

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

spf13使用 vim配置

上一篇:raid10和raid5性能有什么区别

下一篇:python如何利用Excel读取和存储测试数据完成接口自动化

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》