使用vim配置方案spf13中碰到的一些問題-創(chuàng)新互聯(lián)

目的:達到我自己自定義安裝插件的目的

創(chuàng)新互聯(lián)建站-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價比大安市網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式大安市網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋大安市地區(qū)。費用合理售后完善,十載實體公司更值得信賴。

安裝YCM(YouCompleteMe)自動補全神器之前的準(zhǔn)備

先安裝編譯環(huán)境:

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

在安裝之前運行一下命令(后續(xù)會知道它的用途):

vim .vimrc.before.local

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

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

上面代碼會在安裝spf13的時候默認根據(jù)配置去安裝插件。最下面會解釋為何要如此配置。

安裝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這個環(huán)境進行編譯。我們建立一個目錄用來存放臨時編譯的文件,(安裝YCM的東東全部在建立的目錄下進行執(zhí)行,執(zhí)行命令)有兩種方式進行安裝:第一,使用官方源進行安裝

  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. 根據(jù)官方的解釋,我們執(zhí)行如下語句:

  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

直接執(zhí)行如上語句

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

使用NeoCompleteEnable出現(xiàn)的如下問題

我使用的是tty1這種終端;

安裝完成后發(fā)現(xiàn)不能自動提示,在命令模式“:”下輸入“NeoCompleteEnable”發(fā)現(xiàn)不能啟動提示

“
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這個文件中列出了你將要使用的插件,下面那句代碼意思就是如果不存在設(shè)置,那么就會默認使用下面的插件:

'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'
            ……………………………………

以下所有的設(shè)置都在.vimrc.local中:

設(shè)置顏色:set t_Co=256才能正確的顯示配色的效果

參考網(wǎng)站: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進行自己的配置設(shè)置

后續(xù)遇到的問題,會繼續(xù)添加

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。

標(biāo)題名稱:使用vim配置方案spf13中碰到的一些問題-創(chuàng)新互聯(lián)
本文URL:http://muchs.cn/article12/coeedc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計、網(wǎng)站排名、品牌網(wǎng)站設(shè)計、動態(tài)網(wǎng)站、服務(wù)器托管、關(guān)鍵詞優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

手機網(wǎng)站建設(shè)