首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >带有错误的Vim更新插件

带有错误的Vim更新插件
EN

Stack Overflow用户
提问于 2018-04-12 00:14:03
回答 2查看 2.1K关注 0票数 3

现在,我在Mac中更新了我的.vimrc,但是我有下一个错误:

在处理/User/dmuino/..vimrc时检测到错误:第59行: E319:对不起,此版本中的命令不可用: py << EOF行 60: E492:非编辑器命令:导入os第61行: E492:非编辑器命令:导入sys第62行: E15:无效表达式:os.environ中的“VIRTUAL_ENV”:第117行: E171:缺失:endif

但是我检查了我的.vimrc,但没有发现任何错误,你能帮我吗?我的.vimrc是下一个:

代码语言:javascript
复制
set nocompatible              " required
filetype off                  " required
 set runtimepath+=~/.vim_runtime
 source ~/.vim_runtime/vimrcs/basic.vim
 source ~/.vim_runtime/vimrcs/filetypes.vim
 source ~/.vim_runtime/vimrcs/plugins_config.vim
 source ~/.vim_runtime/vimrcs/extended.vim
 set rtp+=~/.vim/bundle/Vundle.vim
 set splitbelow
 set splitright
 call vundle#begin()
 "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
 " alternatively, pass a path where Vundle should install plugins
 "call vundle#begin('~/some/path/here')

 " let Vundle manage Vundle, required
 Plugin 'gmarik/Vundle.vim'
 Plugin 'tmhedberg/SimpylFold'
 Helptags

 let g:SimplyFold_docstring_preview=1
 " PEP8 indetantion
 au BufNewFile,BufRead *.py
    \ set tabstop=4
    \ set softtabstop=4
    \ set shiftwidth=4
    \ set textwidth=79
    \ set expandtab
    \ set autoindent
    \ set fileformat=unix
 " HTML, JS, CSS indentation
 au BufNewfile,BufRead *.js, *.html, *.css
    \ set tabstop=2
    \ set softtabstop=2
    \ set shiftwidth=2
 "Fix problem indentation PEP8
 Plugin 'vim-scripts/indentpython.vim'
 "Uneccesary whitespace
 au BufRead,BufNewfile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
 " UTF8 support
 set encoding=utf-8
 "Autocomplete
 Bundle 'Valloric/YouCompleteMe'

 let g:ymc_autoclose_preview_window_after_completion=1
 map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>

 " python with virtualenv support

 py << EOF
 import os
 import sys
 if 'VIRTUAL_ENV' in os.environ:
     project_base_dir = os.environ['VIRTUAL_ENV']
     activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
     execfile(activate_this, dict(__file__=activate_this))
 EOF

 " Syntax Checkin/Highlighting
 Plugin 'vim-syntastic/syntastic'
 Plugin 'nvie/vim-flake8'
 let python_highlight_all=1
 syntax on

 "Color Shemes
 Plugin 'jnurmin/Zenburn'
 Plugin 'altercation/vim-colors-solarized'
 if has('gui_running')
     set background=dark
     colorscheme solarized
 else
     colorscheme zenburn
 endif
 call togglebg#map("<F5>")
 "File Browsing
 Plugin 'scrooloose/nerdtree'
 Plugin 'jistr/vim-nerdtree-tabs'
 let NERDTreeIgnore=['\.pyc$','\~$'] "Ignore files in NERDTree

 "SuperSearching
 Plugin 'kien/ctrlp.vim'
 "Line numering
 set nu
 "Git integration
 Plugin 'tpope/vim-fugitive'

 "Powerline
 Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}

 "System clipboard
 set clipboard=unnamed
 "VIM in the shell
 set editing-mode vi

 " add all your plugins here (note older versions of Vundle
 " used Bundle instead of Plugin)

 " ...

 " All of your Plugins must be added before the following line
 call vundle#end()            " required
 filetype plugin indent on    " required

try
source ~/.vim_runtime/my_configs.vim
catch
endtry
EN

回答 2

Stack Overflow用户

发布于 2020-01-24 19:17:47

变化

代码语言:javascript
复制
 " python with virtualenv support

 py << EOF

代码语言:javascript
复制
" python with virtualenv support
py3 3
py3 << EOF
票数 4
EN

Stack Overflow用户

发布于 2018-09-11 11:30:18

错误消息明确指向您的~/.vimrc,在第59行:

代码语言:javascript
复制
" python with virtualenv support

py << EOF
[...]

您的Vim配置假设一个内置支持嵌入式Python解释器(:py命令)的Vim。通过添加防御性检查,可以使~/.vimrc更加健壮。这通常是用exists() (例如if exists(':python') == 2)完成的,但是对于嵌入式解释器来说,检查通常是通过if has('python')完成的。

如果需要定制,则必须使用支持Python内置的Vim版本。如何获得这样的结果在很大程度上取决于您的系统,您安装软件的方式。在最坏的情况下(没有可用的包),您必须安装所有源代码依赖项并自己编译Vim。但我觉得对MacOS X来说,这没必要.

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49786117

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档