通过Homebrew在Python和Python3支持下安装Vim

编程入门 行业动态 更新时间:2024-10-25 02:22:21
本文介绍了通过Homebrew在Python和Python3支持下安装Vim的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在Vim中启用Python自动补全功能,所以也许这不是问题.这是我观察到的:

I would like to enable Python auto-completion in Vim so maybe this is a non-issue. This is what I've observed:

首先,虚拟环境提供了能够按项目分配口译员的能力.可以同时使用Python 2.x和Python 3.x的假设.

First, Virtual Environments provides the ability to assign an interpreter on a per-project basis. The assumption being both Python 2.x AND Python 3.x could potentially be used.

我已经安装了python 2.x和python3-没问题.

通过Homebrew安装Vim时,无论发生什么情况,都仅在以下一种编译方式中支持编译器:

While installing Vim via Homebrew, no matter what happens only support support for one interpreter is compiled in:

/usr/local/bin/vim --version ...

  • + python3 -python或
  • -python3 + python
  • Q:出于实现python自动完成的目的:

    Q: for the purposes of achieving python auto-completion:

  • 这是一个真正的问题吗?
  • 如果是,那有什么解决方案?
  • 推荐答案

    同时编译或使用'dynamic'编译的Vim仅在Windows版本上可用.Mac/* nix/etc只能使用一个版本的Python.

    Vim compiled with both, or with 'dynamic' is only available on Windows versions. Mac/*nix/etc can only use one version of Python.

    解决这个问题的方法是编译两个不同的vim,每个Python版本一个,然后在我的.vimrc中创建一个版本检查以使其与它们中的两个兼容.

    My way around this was to compile two different vims, one with each Python version, and then create a version check in my .vimrc to be co-compatible with the two of them.

    if has('python') let g:jedi#force_py_version = 2 let g:syntastic_python_python_exec = 'python2' let g:pymode_python = 'python2' elseif has('python3') let g:jedi#force_py_version = 3 let g:syntastic_python_python_exec = 'python3' let g:pymode_python = 'python3' else let g:loaded_jedi = 1 endif

    当然可以使用您已安装的任何特定于python的插件或功能对其进行修改.

    Modifying this with whatever python-specific plugins or function you have installed, of course.

更多推荐

通过Homebrew在Python和Python3支持下安装Vim

本文发布于:2023-07-03 21:58:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1012556.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:支持下   Python   Homebrew   Vim

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!