处理函数 <SNR>70_SetVals: 时检测到错误,E121:未定义的变量:g:pydiction_location -- 点击选项卡按钮时发生错误
Error detected while processing function <SNR>70_SetVals:, E121: Undefined variable: g:pydiction_location -- error occured when hitting tab button
我正在写一个 python 文件,在 vim 的插入模式下按选项卡时出现此错误。
我是 vim 的新手,我刚刚复制了某人的 vimrc 文件。这是 vimrc 文件
"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()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'Valloric/YouCompleteMe'
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'kien/ctrlp.vim'
Plugin 'tmhedberg/SimpylFold'
Plugin 'nvie/vim-flake8'
Plugin 'vim-scripts/Pydiction'
Plugin 'vim-scripts/indentpython.vim'
Plugin 'scrooloose/syntastic'
Plugin 'altercation/vim-colors-solarized'
Plugin 'jnurmine/Zenburn'
call vundle#end()
filetype plugin indent on
................................
...................................
.....................
let gidentifiers_from_tags_files = 1
let g:ycm_use_ultisnips_completer = 1
let g:ycm_seed_identifiers_with_syntax = 1
let g:ycm_complete_in_comments = 1
let g:ycm_complete_in_strings = 1
let g:ycm_autoclose_preview_window_after_completion=1
let mapleader=" "
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
call togglebg#map("<F5>")
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree
set nu
"python with virtualenv support
py3 << EOF
import os.path
import sys
import vim
if 'VIRTUA_ENV' in os.environ:
project_base_dir = os.environ['VIRTUAL_ENV']
sys.path.insert(0, project_base_dir)
activate_this = os.path.join(project_base_dir,'bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
EOF
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 with the spacebar
nnoremap <space> za
set foldlevel=99
autocmd FileType python set sw=4
autocmd FileType python set ts=4
autocmd FileType python set sts=4
highlight BadWhitespace ctermbg=red guibg=red
au BufRead,BufNewFile *.py,*.pyw match BadWhitespace /^\t\+/
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
au BufRead,BufNewFile *.py,*.pyw, set textwidth=100
au BufNewFile *.py,*.pyw,*.c,*.h set fileformat=unix
set encoding=utf-8
let python_highlight_all=1
syntax on
autocmd FileType python set autoindent
autocmd FileType python set foldmethod=indent
如果您在 vimrc 中看到任何错误,请回答。
前言:
Pydiction 插件自 2014 年以来就没有维护过。YouCompleteMe,如果配置正确,应该能够完成 Pydiction 能够完成的所有工作,并且仍在定期提交。您可能会考虑不使用 Pydiction。
此外,仅仅出于这样的原因,批量复制某人 .vimrc
通常不是一个好主意。并不是说你不能,但如果你这样做,你应该花时间阅读帮助文档,以确保你了解所有内容。
不过,如果你真的想使用Pydiction,解决方法如下:
解决方案:
插件vim-scripts/Pydiction
默认不设置g:pydiction_location
。由于您在默认位置使用 Vundle,因此包含的 complete-dict
应该位于 ~/.vim/bundle/Pydiction/complete-dict
。您需要设置 g:pydiction_location
:
let g:pydiction_location = expand('~/.vim/bundle/Pydiction/complete-dict')
需要扩展才能将 ~
扩展到 /home/<user
。
我正在写一个 python 文件,在 vim 的插入模式下按选项卡时出现此错误。
我是 vim 的新手,我刚刚复制了某人的 vimrc 文件。这是 vimrc 文件
"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()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'Valloric/YouCompleteMe'
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'kien/ctrlp.vim'
Plugin 'tmhedberg/SimpylFold'
Plugin 'nvie/vim-flake8'
Plugin 'vim-scripts/Pydiction'
Plugin 'vim-scripts/indentpython.vim'
Plugin 'scrooloose/syntastic'
Plugin 'altercation/vim-colors-solarized'
Plugin 'jnurmine/Zenburn'
call vundle#end()
filetype plugin indent on
................................ ................................... .....................
let gidentifiers_from_tags_files = 1
let g:ycm_use_ultisnips_completer = 1
let g:ycm_seed_identifiers_with_syntax = 1
let g:ycm_complete_in_comments = 1
let g:ycm_complete_in_strings = 1
let g:ycm_autoclose_preview_window_after_completion=1
let mapleader=" "
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
call togglebg#map("<F5>")
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree
set nu
"python with virtualenv support
py3 << EOF
import os.path
import sys
import vim
if 'VIRTUA_ENV' in os.environ:
project_base_dir = os.environ['VIRTUAL_ENV']
sys.path.insert(0, project_base_dir)
activate_this = os.path.join(project_base_dir,'bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
EOF
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 with the spacebar
nnoremap <space> za
set foldlevel=99
autocmd FileType python set sw=4
autocmd FileType python set ts=4
autocmd FileType python set sts=4
highlight BadWhitespace ctermbg=red guibg=red
au BufRead,BufNewFile *.py,*.pyw match BadWhitespace /^\t\+/
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
au BufRead,BufNewFile *.py,*.pyw, set textwidth=100
au BufNewFile *.py,*.pyw,*.c,*.h set fileformat=unix
set encoding=utf-8
let python_highlight_all=1
syntax on
autocmd FileType python set autoindent
autocmd FileType python set foldmethod=indent
如果您在 vimrc 中看到任何错误,请回答。
前言:
Pydiction 插件自 2014 年以来就没有维护过。YouCompleteMe,如果配置正确,应该能够完成 Pydiction 能够完成的所有工作,并且仍在定期提交。您可能会考虑不使用 Pydiction。
此外,仅仅出于这样的原因,批量复制某人 .vimrc
通常不是一个好主意。并不是说你不能,但如果你这样做,你应该花时间阅读帮助文档,以确保你了解所有内容。
不过,如果你真的想使用Pydiction,解决方法如下:
解决方案:
插件vim-scripts/Pydiction
默认不设置g:pydiction_location
。由于您在默认位置使用 Vundle,因此包含的 complete-dict
应该位于 ~/.vim/bundle/Pydiction/complete-dict
。您需要设置 g:pydiction_location
:
let g:pydiction_location = expand('~/.vim/bundle/Pydiction/complete-dict')
需要扩展才能将 ~
扩展到 /home/<user
。