I started to learn how to write vim script in python.
I come across of this tutorial
https://dzone.com/articles/how-write-vim-plugins-python
and my first vim script looks like the following
function! Reddit()
python << EOF
import sys
print sys.executable
print "hello Reddit"
EOF
endfunction
as you can see, the print sys.executable
prints out the python on the system path.
As I use pyenv a lot, how can I set vim to recognize my python according to my working environment?
If you don't mind using Neovim instead of vim, you would be able to select which Python interpreter to use via:
let g:python_host_prog = '/path/to/your/interpreter/python'
let g:python3_host_prog = '/path/to/your/interpreter/python3'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.