2015-12-28 37 views
0

這個圖片我的問題看起來像如何強制YouCompleteMe完成代碼,特別是剪輯完成?

https://cloud.githubusercontent.com/assets/13230384/12019443/3981e0f6-adab-11e5-85a7-c0ec84b1e63a.png

這是我的.vimrc

"========================== 
"vundle 
set nocompatible " be iMproved 
filetype off " required! 
" set the runtime path to include Vundle and initialize 
set rtp+=~/.vim/bundle/Vundle.vim 
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 
"====================== 
" For GitHub repos, you specify plugins using the 'user/repository' format 
Plugin 'Valloric/YouCompleteMe' 
Plugin 'scrooloose/syntastic' 
Plugin 'bling/vim-airline' 
Plugin 'SirVer/ultisnips' 
Plugin 'edsono/vim-matchit' 
Plugin 'elzr/vim-json' 
Plugin 'honza/vim-snippets' 
Plugin 'justinmk/vim-sneak' 
Plugin 'kien/ctrlp.vim' 
Plugin 'ludovicchabant/vim-lawrencium' 
Plugin 'majutsushi/tagbar' 
Plugin 'mhinz/vim-signify' 
Plugin 'plasticboy/vim-markdown' 
Plugin 'scrooloose/nerdcommenter' 
Plugin 'sjl/gundo.vim' 
Plugin 'tpope/vim-fugitive' 
Plugin 'tpope/vim-sleuth' 
Plugin 'tpope/vim-serround' 
Plugin 'tyru/open-browser.vim' 
Plugin 'vim-scripts/a.vim' 

"color schemes 
Plugin 'tomasr/molokai' 
Plugin 'flazz/vim-colorschemes' 

"======================== 
" All of your Plugins must be added before the following line 
"====================== 
call vundle#end() " required 
filetype plugin indent on " required 
" 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 
" see :h vundle for more details or wiki for FAQ 
" Put your non-Plugin stuff after this line 
"==================================== 

let mapleader=";" 
set incsearch 
set ignorecase 
set wildmenu 
set laststatus=2 
set ruler 
set number 
syntax enable 
syntax on 
filetype indent on 
set expandtab 
set tabstop=4 
set shiftwidth=4 
set softtabstop=4 
set foldmethod=syntax 
set nofoldenable 
set nowrap 

"=========================== 
"colorscheme 
set t_Co=256 
set background=dark 
"colorscheme solarized 
colorscheme molokai 
""colorscheme 

"============================= 
" the ycm_extra_conf.py 
let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py' 
let g:UltiSnipsSnippetDirectories=["mysnippets"] 

"================= 
"complete in comment 
let g:ycm_complete_in_comments=1 
"enable cpptags 
let g:ycm_collect_identifiers_from_tags_files=1 
"include stdcpp tags 
set tags+=/data/misc/software/misc./vim/stdcpp.tags 
"disable preview  
set completeopt-=preview 

nnoremap <leader>gl :YcmCompleter GoToDeclaration 
nnoremap <leader>gf :YcmCompleter GoToDefinition 
nnoremap <leader>gg :YcmCompleter GoToDefinitionElseDeclaration" 

" YouCompleteMe 
let g:ycm_key_list_previous_completion=['<Up>'] 

"" Ultisnips 
let g:UltiSnipsExpandTrigger="<c-tab>" 
let g:UltiSnipsListSnippets="<c-s-tab>" 

結果顯示:在這張照片我的 「FO」 攻絲後。然後,我可以做的是點擊「Tab」從一個選項移動到另一個,問題是我應該點擊什麼來擴展補充「剪輯」一個([選項卡]不能接受完成,因爲什麼valloric said in user guide)? 另一個問題是爲什麼我不能讓你完成一個功能,一個班級?在這種情況下,我想我可以完成一個func「fopen」。 是否發生了一些碰撞,因爲這裏有很多插件?

回答

1

設置此變量的東西適合你的口味:

let g:UltiSnipsExpandTrigger="<c-space>" 
let g:UltiSnipsJumpForwardTrigger="<c-j>" 
let g:UltiSnipsJumpBackwardTrigger="<c-k>" 

閱讀youcompleteme幫助,特別是關於語義觸發器:

:help ycm_semantic_triggers 
+0

您好,我只是設置這個「讓G:ycm_key_invoke_completion =' '「&」g:UltiSnipsExpandTrigger =「」「如果我希望YCM爲我完成函數原型,該怎麼辦?這可以做到嗎? –