当我一起使用YouCompleteMe和UltiSnips时,我遇到了2个错误:
g:UltiSnipsExpandTrigger
重新映射到几个不同的密钥(c-l,c-j,c-k,c-l,F5),但仍然没有成功。我还没有看到UltiSnips实际上扩展了一个片段。#!
,但如果我打开已保存的python文件,#!将被承认。 也许这两个问题是相关的。
感谢您的时间。
答案 0 :(得分:1)
我有同样的问题让他们两个人一起工作。
这是我的.vimrc
,您可能会找到所需内容:
" ----------------------------------------------------------------------------
" Autocompletion & Snippets Plugins
" ----------------------------------------------------------------------------
if has('nvim')
runtime! python_setup.vim
endif
Plug 'Valloric/YouCompleteMe', { 'do': './install.sh --clang-completer' }
Plug 'SirVer/ultisnips'
Plug 'ladislas/vim-snippets'
" YouCompleteMe setup
let g:ycm_autoclose_preview_window_after_completion = 1
let g:ycm_filetype_blacklist={'unite': 1}
let g:ycm_min_num_of_chars_for_completion = 1
nnoremap <leader>jd :YcmCompleter GoToDefinitionElseDeclaration<CR>
" UltiSnips setup
let g:UltiSnipsExpandTrigger='<c-k>'
let g:UltiSnipsJumpForwardTrigger='<c-k>'
let g:UltiSnipsJumpBackwardTrigger='<c-s-k>'
let g:UltiSnipsSnippetsDir=plugDir.'/vim-snippets/UltiSnips'
希望这有帮助。
答案 1 :(得分:1)
我通过以下配置解决了这个问题:
UltiSnips:
let g:UltiSnipsSnippetsDir = $HOME.'/.vim/UltiSnips/'
let g:UltiSnipsSnippetDirectories=["UltiSnips"]
let g:UltiSnipsExpandTrigger="<c-j>"
let g:UltiSnipsJumpForwardTrigger="<c-j>"
let g:UltiSnipsJumpBackwardTrigger="<c-k>"
let g:UltiSnipsListSnippets="<c-h>"
YCM:
let g:ycm_complete_in_comments = 1
let g:ycm_seed_identifiers_with_syntax = 1
let g:ycm_collect_identifiers_from_comments_and_strings = 1