vim+;Windows10&x2B;YouCompleteMe:`1列1 |发出的错误太多,现在停止[致命的错误太多]`
完整的功能似乎运行良好,但语法根本不起作用。 我在Windows 10计算机上运行,正在从事vim+;Windows10&x2B;YouCompleteMe:`1列1 |发出的错误太多,现在停止[致命的错误太多]`,vim,youcompleteme,Vim,Youcompleteme,完整的功能似乎运行良好,但语法根本不起作用。 我在Windows 10计算机上运行,正在从事.c项目。 我试着四处阅读,我安装了clang,我试着安装YCM-Generator(仅供参考:由于某些原因,vim中无法识别:YcmGenerateConfig命令) 如果有帮助(我是新手): 为了安装插件,我刚刚将所有git Repo克隆到~\.vim\bundle文件夹。 我用旧的ctag创建了标签,我喜欢它! 克隆repos后,我安装了clang,因为我不知道那是什么 如果有帮助,这是我的\u v
.c
项目。
我试着四处阅读,我安装了clang
,我试着安装YCM-Generator
(仅供参考:由于某些原因,vim中无法识别:YcmGenerateConfig
命令)
如果有帮助(我是新手):
为了安装插件,我刚刚将所有git Repo克隆到~\.vim\bundle文件夹
。
我用旧的ctag
创建了标签,我喜欢它!
克隆repos后,我安装了clang
,因为我不知道那是什么
如果有帮助,这是我的\u vimrc
set encoding=utf-8
set nu
set tabstop=4 softtabstop=4
set shiftwidth=4
set expandtab
set smartindent
set nobackup
set backspace=indent,eol,start
set nocompatible " required
set clipboard=unnamed
colorscheme industry
" Enable folding
set nofoldenable
set foldmethod=syntax
set foldlevelstart=20
" Enable folding with the spacebar
nnoremap <space> za
" --- VUNDLE PLUGIN STUFF BEGIN --------
filetype off " required
" Vundle plugin manager
"set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
" add all your plugins here (note older versions of Vundle
" used Bundle instead of Plugin)
Plugin 'gmarik/Vundle.vim'
Bundle 'Valloric/YouCompleteMe.vim'
Plugin 'tmhedberg/SimpylFold.vim'
Plugin 'rdnetto/YCM-Generator'
"Plugin 'vim-syntastic/syntastic.vim' " syntax checking. You must have e.g. flake8 for python etc. for making it cool
"Plugin 'vim-syntastic/syntastic.vim' " syntax checking. You must have e.g. flake8 for python etc. for making it cool
"Plugin 'nvie/vim-flake8'
Plugin 'scrooloose/nerdtree.vim'
Plugin 'kien/ctrlp.vim'
Plugin 'lervag/vimtex.vim'
call vundle#end() " required
filetype plugin indent on " required for Vundle
" ---- VUNDLE PLUGIN STUFF END ----------
" Start NERDTree and put the cursor back in the other window.
" autocmd VimEnter * NERDTree | wincmd p
nmap <F6> :NERDTreeToggle<CR>
" --------
" YouCompleteMe stuff
let g:ycm_show_diagnostics_ui = 1 " To disable diagnostics.
let g:ycm_autoclose_preview_window_after_completion=1
let g:ycm_collect_identifiers_from_tags_files = 1
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
let g:ycm_filter_diagnostics = {
\ "c": {
\ "regex": ["boolean", "float32", "sint16","uint32","uint8","sint32","sint8" ],
\ }
\}
" Python with virtualenv support
py << EOF
import os
import sys
if 'VIRTUAL_ENV' in os.environ:
project_base_dir = os.environ['VIRTUAL_ENV']
activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
EOF
" -----------------
let python_highlight_all=1
" Automatically open VimGoodies.txt: failed!
autocmd VimEnter * edit ~/VimGoodies.txt | tabnew
" Search through visual mode
" // for search a partial word
vnoremap // y/\V<C-R>=escape(@",'/\')<CR><CR>
" <C-f> to vimgrep the highlighted text
vnoremap <C-f> "ay:vimgrep <C-r>a ./**/*<CR> <bar> :copen<CR>
syntax on
这也是我的.ycm\u extra\u conf.py
import os.path as p
import subprocess
DIR_OF_THIS_SCRIPT = p.abspath( p.dirname( __file__ ) )
DIR_OF_THIRD_PARTY = p.join( DIR_OF_THIS_SCRIPT, 'third_party' )
def GetStandardLibraryIndexInSysPath( sys_path ):
for index, path in enumerate( sys_path ):
if p.isfile( p.join( path, 'os.py' ) ):
return index
raise RuntimeError( 'Could not find standard library path in Python path.' )
def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
if not working_directory:
return list( flags )
new_flags = []
make_next_absolute = False
path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
for flag in flags:
new_flag = flag
if make_next_absolute:
make_next_absolute = False
if not flag.startswith( '/' ):
new_flag = os.path.join( working_directory, flag )
if new_flag:
new_flags.append( new_flag )
return new_flags
def PythonSysPath( **kwargs ):
sys_path = kwargs[ 'sys_path' ]
dependencies = [ p.join( DIR_OF_THIS_SCRIPT, 'python' ),
p.join( DIR_OF_THIRD_PARTY, 'requests-futures' ),
p.join( DIR_OF_THIRD_PARTY, 'ycmd' ),
p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'idna' ),
p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'chardet' ),
p.join( DIR_OF_THIRD_PARTY,
'requests_deps',
'urllib3',
'src' ),
p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'certifi' ),
p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'requests' ) ]
# The concurrent.futures module is part of the standard library on Python 3.
interpreter_path = kwargs[ 'interpreter_path' ]
major_version = int( subprocess.check_output( [
interpreter_path, '-c', 'import sys; print( sys.version_info[ 0 ] )' ]
).rstrip().decode( 'utf8' ) )
if major_version == 2:
dependencies.append( p.join( DIR_OF_THIRD_PARTY, 'pythonfutures' ) )
sys_path[ 0:0 ] = dependencies
sys_path.insert( GetStandardLibraryIndexInSysPath( sys_path ) + 1,
p.join( DIR_OF_THIRD_PARTY, 'python-future', 'src' ) )
return sys_path
最后,这个项目相当大,有一个根目录,然后是一些文件夹和子文件夹,它们具有不同的组件,具有不同的文件夹结构深度,并且有许多.h
和.c
文件分布在各个文件夹中。
但是,根是常见的。使用插件的问题跟踪程序。
import os.path as p
import subprocess
DIR_OF_THIS_SCRIPT = p.abspath( p.dirname( __file__ ) )
DIR_OF_THIRD_PARTY = p.join( DIR_OF_THIS_SCRIPT, 'third_party' )
def GetStandardLibraryIndexInSysPath( sys_path ):
for index, path in enumerate( sys_path ):
if p.isfile( p.join( path, 'os.py' ) ):
return index
raise RuntimeError( 'Could not find standard library path in Python path.' )
def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
if not working_directory:
return list( flags )
new_flags = []
make_next_absolute = False
path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
for flag in flags:
new_flag = flag
if make_next_absolute:
make_next_absolute = False
if not flag.startswith( '/' ):
new_flag = os.path.join( working_directory, flag )
if new_flag:
new_flags.append( new_flag )
return new_flags
def PythonSysPath( **kwargs ):
sys_path = kwargs[ 'sys_path' ]
dependencies = [ p.join( DIR_OF_THIS_SCRIPT, 'python' ),
p.join( DIR_OF_THIRD_PARTY, 'requests-futures' ),
p.join( DIR_OF_THIRD_PARTY, 'ycmd' ),
p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'idna' ),
p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'chardet' ),
p.join( DIR_OF_THIRD_PARTY,
'requests_deps',
'urllib3',
'src' ),
p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'certifi' ),
p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'requests' ) ]
# The concurrent.futures module is part of the standard library on Python 3.
interpreter_path = kwargs[ 'interpreter_path' ]
major_version = int( subprocess.check_output( [
interpreter_path, '-c', 'import sys; print( sys.version_info[ 0 ] )' ]
).rstrip().decode( 'utf8' ) )
if major_version == 2:
dependencies.append( p.join( DIR_OF_THIRD_PARTY, 'pythonfutures' ) )
sys_path[ 0:0 ] = dependencies
sys_path.insert( GetStandardLibraryIndexInSysPath( sys_path ) + 1,
p.join( DIR_OF_THIRD_PARTY, 'python-future', 'src' ) )
return sys_path