Hello!
The complete feature appears to work well, but the syntax does not work at all. I am running on a Windows 10 machine and I am working on a .c project. I tried to read around, I installed clang, I tried to install YCM-Generator (fyi: the :YcmGenerateConfig command is not recognized within vim for some reasons).
If it may help (I am newbie):
To install plugins I just I cloned all git repos into ~\.vim\bundle folder. I have created tags with the old ctags - and I love it! I installed clang after I cloned the repos because I didn't know what was that.
If it may help, here is my _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
Output of :YcmDebugInfo
Printing YouCompleteMe debug information...
-- Resolve completions: Up front
-- Client logfile: C:\Users\MyName\AppData\Local\Temp\ycm_g_c7w1d2.log
-- Server Python interpreter: C:\Program Files (x86)\Python37-32\python.exe
-- Server Python version: 3.7.1
-- Server has Clang support compiled in: False
-- Clang version: None
-- No extra configuration file found
-- Server process ID: 20240
-- Server logfiles:
and here it is also my .ycm_extra_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
Finally, the project is fairly large with a root and then a number of folders and subfolders with different components with different folder structure depths and many .h and .c files spread around. But yet, the root is common.
Many thanks!
/Ubaldo