VIM无法补全错误记录

按照教程进行安装

1. 安装 vundle

# vundle是vim的包管理器,十分好用
[email protected]: ~$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
[email protected]: ~$ vim ~/.vimrc

写入:

" description: configuration of vim
" author: phillee
" date:    2019-06-04
" email: [email protected]

set nocompatible            " be iMproved, required
filetype off                " required

" set the runtime path to include Vundle and initialize
set runtimepath+=/home/cv/.vim/bundle/Vundle.vim
set runtimepath+=/home/cv/.vim/bundle/ctrlp.vim
set runtimepath+=/home/cv/.vim/bundle/ultisnips

call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
" call vundle#begin(‘~/some/path/here‘)

" let Vundle manage Vundle, required
Plugin ‘VundleVim/Vundle.vim‘
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.

" plugin on GitHub repo
Plugin ‘tpope/vim-fugitive‘
Plugin ‘Valloric/YouCompleteMe‘
Plugin ‘vim-syntastic/syntastic‘
Plugin ‘nvie/vim-flake8‘

" " Track the engine
Plugin ‘SirVer/ultisnips‘

" Snippets are separated from the engine.
Plugin ‘honza/vim-snippets‘

" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin ‘L9‘
" Git plugin not hosted on GitHub
" Plugin ‘git://git.wincent.com/command-t.git‘

" git repos on your local machine(i.e. when working on your own plugin)
" Plugin ‘file://home/gmarik/path/to/plugin‘

" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
" Plugin ‘rstacruz/sparkup‘, {‘rtp‘: ‘vim/‘}

" Install L9 and avoid a Naming conflict if you‘ve already install a different version somewhere else.
" Plugin ‘ascenator/L9‘, {‘name‘: ‘newL9‘}

" Define bundles via GitHub repo
Bundle ‘scrooloose/nerdtree‘

" All of your Plugins must be added before the following line
call vundle#end()

filetype plugin indent on

" To ignore plugin indent changes, instead use:
" filetype plugin on

" Brief help
" :PluginList                - lists configured plugins
" :PluginInstall            - installs plugins; append ‘!‘ to update or just :PluginUpdate
" :PluginSearch foo            - searches for foo; append ‘!‘ to refresh local cache
" :PluginClean                - confirms removal of unused plugins; append ‘!‘ to auto-approve removal

" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

set number
set numberwidth=5

set tabstop=4
set background=dark
set showcmd
set encoding=utf-8

" Default conf file path
let g:ycm_global_ycm_extra_conf=‘~/.vim/.ycm_extra_conf.py‘
" No query for loading ycm_extra_conf.py configuration when vim is opened
let g:ycm_confirm_extra_conf=0

let g:ycm_use_clangd=0

set completeopt=longest,menu

" path of python Interpreter
let g:ycm_path_to_python_interpreter=‘/usr/bin/python‘
" Enable complete syntax
let g:ycm_seed_identifiers_with_syntax=1

" Enable or not complete even in the comments
let g:ycm_complete_in_comments=1
let g:ycm_collect_identifiers_from_comments_and_strings=0
let g:ycm_collect_identifiers_from_tags_files=1
let g:ycm_min_num_of_chars_for_completion=2
let g:ycm_autoclose_preview_window_after_completion=1
let g:ycm_cache_omnifunc=0
let g:ycm_complete_in_strings=1

let python_highlight_all=1
syntax on
au BufNewFile,BufRead *.py
    \ set tabstop=4    |
    \ set softtabstop=4    |
    \ set shiftwidth=4    |
    \ set textwidth=79    |
    \ set expandtab    |
    \ set autoindent    |
    \ set fileformat=unix

"Autoclose preview window when leave the insert mode
autocmd InsertLeave * if pumvisible()==0|pclose|endif

"The user-defined action of the direction keys"
inoremap <expr> <Down>    pumvisible()?‘\<C-n>‘:‘\<Down>‘
inoremap <expr> <Up>    pumvisible()?‘\<C-p>‘:‘\<Up>‘
inoremap <expr> <PageDown>    pumvisible()?‘\<PageDown>\<C-p>\<C-n>‘:‘\<PageDown>‘
inoremap <expr> <PageUp>    pumvisible()?‘\<PageUp>\<C-p>\<C-n>‘:‘\<PageUp>‘

" NERDTree config
map <F2> :NERDTreeToggle<CR>
autocmd vimenter * NERDTree
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif

" This command is to open NERDTree automatically when vim starts up on opening
" a directory.
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe ‘NERDTree‘ argv()[0] | wincmd p | ene | endif 

" This command is to close vim if the only window left open is a NERDTree.
autocmd bufenter * if(winnr("$")==1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
let g:NERDTreeDirArrowExpandable = ‘~‘
let g:NERDTreeDirArrowCollapsible = ‘~‘

" UltiSnips - Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<c-j>"
let g:UltiSnipsListSnippets="<c-h>"
let g:UltiSnipsJumpForwardTrigger="<c-j>"
let g:UltiSnipsJumpBackwardTrigger="<c-k>"
let g:UltiSnipsSnippetDirectories=[‘/home/cv/.vim/bundle/ultisnips/mysnippets/‘]

" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"

.vimrc

2. 然后安装各种插件

有些插件需要先去 GitHub 上克隆到本地。

打开 vim ,在命令模式下键入下面的插件安装指令,等待完成。

[email protected]: ~$ vim
:PluginInstall

3. 试验一下效果

再次打开 vim ,结果最下面有提示

the ycmd server SHUT DOWN (restart with ‘:YcmRestartServer‘). Unexpected error while ...M core library. Type ‘:YcmToggleLogs ycmd_41013_stderr_cys4wh16.log‘ to check the logs.

根据提示键入 :YcmToggleLogs ycmd_41013_stderr_cys4wh16.log

# /tmp/ycmd_41013_stderr_cys4wh16.log
Traceback (most recent call last):
  File "/home/cv/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/utils.py", line 637, in ImportAndCheckCore
    ycm_core = ImportCore()
  File "/home/cv/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/utils.py", line 628, in ImportCore
    import ycm_core as ycm_core
ImportError: /home/cv/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_core.so: undefined symbol: clang_getCompletionFixIt

原来是 clang_getCompletionFixIt 未定义,怎么办呢?

Valloric/YouCompleteMe主页查看了一下,找到了一些线索

根据指示运行 install.sh (因为 install.py 和 install.sh 运行效果一样,当然也可以使用 [email protected]: ~$ python install.py )

[email protected]: ~$ ~/.vim/bundle/YouCompleteMe/install.sh

#!/bin/sh

echo "WARNING: this script is deprecated. Use the install.py script instead." 1>&2

SCRIPT_DIR=$(dirname $0 || exit $?)

command_exists() {
  command -v "$1" >/dev/null 2>&1 ;
}

PYTHON_BINARY=python
if command_exists python2; then
  PYTHON_BINARY=python2
fi

$PYTHON_BINARY "$SCRIPT_DIR/install.py" "[email protected]" || exit $?

install.sh

然后就ok了,现在补全功能可以用了。

原文地址:https://www.cnblogs.com/phillee/p/11050079.html

时间: 2024-10-13 14:59:26

VIM无法补全错误记录的相关文章

Windows 10环境安装VIM代码补全插件YouCompleteMe

Windows 10环境安装VIM代码补全插件YouCompleteMe 折腾一周也没搞定Windows下安装VIM代码补全插件YouCompleteMe,今天在家折腾一天总算搞定了.关键问题是在于Python环境:必须确保环境变量Path里只有一个python.exe. ycmd是client-server架构.ycmd本身是server,可以为多种客户端所用,如VIM/YouComplete,emacs/emacs-ycmd等.服务端有不同引擎,如clang补全c-familiy语言,其他引

史上最强大的 Vim 代码补全引擎:YouCompleteMe

引言 自己之前Vim的代码补全插件都是使用 ctags + autotag + taglist + omnicppcompele 的组合,而且很多时候都没有提示或提示补全,而且每次打开一个新文件文件都需要创建一个 ctag 标签库,代码补全才能正能工作,十分的繁琐蛋疼.当时我就在想,既然源代码都有了,难道就没有一个 Vim 插件能的通过已有的源代码,实时构建语法书来提供代码补全提示吗?通过一番搜索,终于发现了她--YouCompleteMe,看了介绍,我开始迫不及待的试用了,顿时感觉从小米加步枪

Vim自动补全神器–YouCompleteMe

YouCompleteMe的特别之处 基于语义补全 总所周知,Vim是一款文本编辑器.也就是说,其最基础的工作就是编辑文本,而不管该文本的内容是什么.在Vim被程序员所使用后,其慢慢的被肩负了与IDE一样的工作,文本自动补全(ie.acp,omnicppcompleter),代码检查(Syntastic)等等工作. 针对文本自动补全这个功能来说,主要有两种实现方式. 基于文本 我们常用的omnicppcompleter,acp,vim自带的c-x, c-n的实现方式就是基于文本.更通俗的说法,其

Vim自动补全插件----YouCompleteMe安装与配置

Vim自动补全插件----YouCompleteMe安装与配置 使用Vim编写程序少不了使用自动补全插件,在Linux下有没有类似VS中的Visual Assist X这么方便快捷的补全插件呢?以前用的是neocomplcache+code_complete+omnicppcomplete,但效果还是不是很好.看到有YCM后前面的插件可以说拜拜了. YouCompleteMe:一个随键而全的.支持模糊搜索的.高速补全的插件.YCM 由 google 公司搜索项目组的软件工程师 Strahinja

【转】Vim自动补全插件----YouCompleteMe安装与配置

原文网址:http://www.cnblogs.com/zhongcq/p/3630047.html 使用Vim编写程序少不了使用自动补全插件,在Linux下有没有类似VS中的Visual Assist X这么方便快捷的补全插件呢?以前用的是neocomplcache+code_complete+omnicppcomplete,但效果还是不是很好.看到有YCM后前面的插件可以说拜拜了. YouCompleteMe:一个随键而全的.支持模糊搜索的.高速补全的插件.YCM 由 google 公司搜索

vim c++补全

弄了个vim对c++的补全,主要参考自: http://vim.wikia.com/wiki/C%2B%2B_code_completion 首先确定vim编辑.cc或者.cpp文件时当前自动补全函数,在命令模式下输入 :set omnifunc? 如果得到的结果为:omnifunc=ccomplete#Complete,说明有必要进行以下的操作以实现针对c++的自动补全 1 首先安装OmniCppComplete,参见: http://www.vim.org/scripts/script.ph

ROS学习之 tab补全错误

ROS tab补全错误: [rospack] Warning: error while crawling /home/XXX: boost::filesystem::status: Permission denied: "/home/dereck/.gvfs" #umount /home/useraccount/.gvfs #rm -rf .gvfs/

python vim自动补全

1.下载插件包 https://github.com/vim-scripts/Pydiction ##################### 包括三个文件 python_pydiction.vim #vim插件 complete-dict #python关键字和模块列表, pydiction.py  #python脚本,可以添加更多的模块 2.配置 #1.查看家目录下是否有.vim目录,若没有则创建. mkdir  -p  ~/.vim/after/ftplugin/pydiction #2.把

VIM自动补全插件 - YouCompleteMe--&quot;大神级vim补全插件&quot;

VIM自动补全插件 - YouCompleteMe 序言 vim 之所以被称为编辑器之神多半归功于其丰富的可DIY的灵活插件功能,( 例如vim下的这款神级般的代码补全插件YouCompleteMe), 使用VIM的用户也多半感觉 IDE开发工具不够轻便,且IDE往往只支持特定的几种语言或者特定系统平台,多数人用来用去,还是觉得VIM最顺手,用起来最舒心. 下面这个VIM的自动补全插件——YouCompleteMe,为我们弥补了vim不能自动补全的缺憾.YCM不仅仅对C族语言的支持非常好,而且它