我有支持Python的Vim 9.0:我已经安装了Python的自动完成和语法检查。下面是我的~/.vimrc文件的内容:
set nocompatible " required
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 'gmarik/Vundle.vim'
" add all your plugins here (note older versions of Vundle
" used Bundle instead of Plugin)
" ...
Plugin 'tmhedberg/SimpylFold'
Plugin 'vim-scripts/indentpython.vim'
Plugin 'vim-syntastic/syntastic'
Plugin 'nvie/vim-flake8'
Plugin 'jnurmine/Zenburn'
Plugin 'altercation/vim-colors-solarized'
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'kien/ctrlp.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
Bundle 'Valloric/YouCompleteMe'
set clipboard=unnamed
set nu
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree
"if has('gui_running')
" set background=dark
" colorscheme solarized
"else
" colorscheme zenburn
"endif
"so ~/.vim/bundle/vim-colors-solarized/autoload/togglebg.vim
let python_highlight_all=1
syntax on
let g:ycm_autoclose_preview_window_after_completion=1
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
set splitbelow
set splitright
"split navigations
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Enable folding
set foldmethod=indent
set foldlevel=99
" Enable folding with the spacebar
nnoremap <space> za
"au BufNewFile,BufRead *.py
" \ setlocal tabstop=4 set softtabstop=4 set shiftwidth=4 set textwidth=79 set expandtab set autoindent set fileformat=unix
au FileType *.js, *.html, *.css
\ setlocal tabstop=2 set softtabstop=2 set shiftwidth=2
"au BufNewFile,BufRead *.js,*.html,*.css,*.vue
"\ set tabstop=2 |
"\ set softtabstop=2 |
"\ set shiftwidth=2
"Flagging Unnecessary Whitespace
highlight BadWhitespace ctermbg=red guibg=darkred
au FileType *.py, *.pyw, *.c, *.h match BadWhitespace /\s\+$/
"au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
set encoding=utf-8
"All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
为了测试Python的支持,我创建了一个简单的脚本,如下图所示。它的两行中有奇怪的警告:[missing-function-docstring]缺少函数或方法docstring。
如何抑制此类错误/警告?
1条答案
按热度按时间xxslljrj1#
没什么好担心的。这是YCM插件的正常行为:
GetDoc子命令:
显示预览窗口,其中填充了有关光标下标识符的快速信息。根据文件类型,这包括以下内容:
因此,当试图执行其
GetDoc
功能以显示光标下函数的信息时,YCM只是告诉您函数testing()
没有与之关联的文档。