我使用vundle安装了YouCompleteMe.然后安装所有插件并使用安装YCM
./install.sh --clang-completer
Run Code Online (Sandbox Code Playgroud)
这就是我的vimrc的样子:
syntax on
set expandtab
set cindent
set tabstop=4
retab
set shiftwidth=4
set hlsearch
set paste
set ic
set number
colorscheme molokai
set t_Co=256
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-repeat'
Plugin 'kien/ctrlp.vim'
Plugin 'sjl/gundo.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'scrooloose/syntastic'
Plugin 'Valloric/ListToggle'
call vundle#end() " required
filetype plugin indent on
"options for syntastic"
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_python_checkers=['pep8', 'pylint', 'python']
let g:syntastic_enable_signs=1
let g:syntastic_auto_loc_list=1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 1
let g:syntastic_error_symbol = "X"
let g:syntastic_style_error_symbol = ">"
let g:syntastic_warning_symbol = "!"
let g:syntastic_style_warning_symbol = ">"
let g:syntastic_echo_current_error=1
let g:syntastic_enable_balloons = 1
let g:syntastic_auto_jump=1
"Gundo options"
nnoremap <F5> :GundoToggle<CR>
"CtrlP options"
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
"Powerline stuff"
python from powerline.vim import setup as powerline_setup
python powerline_setup()
python del powerline_setup
set laststatus=2
Run Code Online (Sandbox Code Playgroud)
YCM有效但我无法使用TAB切换建议,仅使用向下和向上箭头并使用回车接受.
为什么会这样?另一个程序是否使用TAB键?
非常感谢您的帮助
Ing*_*kat 15
通过配置set paste,您可以有效地禁用所有映射和缩写.
当您在终端Vim中实际粘贴文本时,您只需要该设置!最好将其绑定到密钥.由于在设置选项时无法使用映射,因此Vim为此提供了一个特殊选项:
:set pastetoggle=<F10>
Run Code Online (Sandbox Code Playgroud)
由于它~/.vimrc是在Vim启动时开始的(当传递给它的文件尚未加载时),它 retab是无效的; 放下它.如果你真的想要为打开的文件自动重新定位,你必须使用:autocmd BufRead * retab它,但我建议不要这样做.
问题是由于.vimrc中的"set paste"行
所以,我删除它,当我想在vim中粘贴大块代码时,我只写:set paste启用它或:set nopaste禁用它.此切换也可以映射到f10或任何键.