1

As you already know I have vim problems. I usually use python 3 with pymode enabled. Today I wanted to add a nice autocompletion for python to my vim and the things became messy. I wanted to install [YouCompleteMe][1] with pathogen, and I saw that requires vim to be installed with python2 support.But pymode needs python3 support (or at least I need it with python3 support) After a lot of googling I precompiled and installed both python versions with --enable-shared configuration and vim with both supports(python/dyn and python3/dyn)

The problem is that vim doesn't load python3 when needed.

I'm working on a project in python 3 and I tried adding this to the end of file:

import site
print(site.getsitepackages())

The output is:

['/usr/lib/python2.7/site-packages', '/usr/lib/site-python']

And if i type this as vim's command :

:py3 import site; print(site.getsitepackages())

The output is:

['/usr/lib/python3.4/site-packages', '/usr/lib/site-python']

I still haven't try to install YouCompleteMe...

My question is: how can I tell vim to use python3 by default instead of python2 ? (without recomiling it with only python3 support)

dreftymac
  • 31,404
  • 26
  • 119
  • 182
dragonator
  • 137
  • 5
  • 14
  • 1
    `vim` uses the system default `python` which in many cases is `python2.7`. Depending on your system you can either go for changing this default [e.g.](http://askubuntu.com/questions/103469/how-do-i-change-my-pythonpath-to-make-3-2-my-default-python-instead-of-2-7-2) to whatever you want or else you can change it [temporarily](http://stackoverflow.com/questions/1108974/switch-versions-of-python) – DOOM May 10 '14 at 03:55
  • Can't I just tell vim to use other version? I see that changing this for the whole system can be dangerous... – dragonator May 10 '14 at 09:13
  • Also I'm on Arch Linux and as I know the dafault python is python3.x.If I check by typing `python` it starts `python 2.x`, but if I type `/usr/bin/python` it starts `python 3.x`...I'm confused... – dragonator May 10 '14 at 09:26

1 Answers1

0

Vim and its plugins are not pre-compiled objects files but are rather callable scripts which often simplify by not specifying version to be used.

If

$ python
  Python 2.7.3 (default, Feb 27 2014, 19:58:35)

then vim is using python 2.7. Changing default python is not a good idea. As i mentioned in my comment .. u should look at temporary option. One of the simplest option (bash-shell):

$ alias python='python3.2'
$ python
  Python 3.2.3 (default, Feb 21 2014, 00:48:19) 
  [GCC 4.6.3] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
DOOM
  • 1,170
  • 6
  • 20