You are not logged in.
I am trying to program with Python 3 and use the omnicompletion features of vim but I cannot even get a python 3 interpreter to work from within vim or gvim.
:python import sys; print(sys.executable)
/usr/bin/python2.7
and
:python3
E319: Sorry, the command is not available in this version
It looks as though vim needs compiled with python 3 support? I'm seeing in --version that it was passed the -python3 switch (as opposed to +python3)
I'm curious- since Python 3 has been the default python in Arch Linux for a while now- when will Python 3 support be included in the standard vim package?
Thanks!
-David
Last edited by davisd (2012-01-20 19:54:16)
Offline
I'm not sure, but http://projects.archlinux.org/svntogit/ … ckages/vim
cd "${srcdir}"/gvim-build
./configure --prefix=/usr --localstatedir=/var/lib/vim \
--with-features=big --with-compiledby=ArchLinux \
--enable-gpm --enable-acl --with-x=yes \
--enable-gui=gtk2 --enable-multibyte --enable-cscope \
--enable-netbeans --enable-perlinterp --enable-pythoninterp \
--disable-python3interp --enable-rubyinterp --enable-luainterp
means there's no python3 support.
https://bugs.archlinux.org/task/25529 on the other hand suggests it's fixed.
Offline
Ok, I requested a re-open on that ticket... Strange that it was reported fixed 4 months ago, I wonder if it was fixed and reverted.
Thanks!
-David
Offline
Enabled here: http://projects.archlinux.org/svntogit/ … 44832310d7
Disabled here: http://projects.archlinux.org/svntogit/ … e4f133fba3
It's one way to "Clean up configure options" ;-)
Offline
Ok, I found this from a few days ago: https://bugs.archlinux.org/task/27527
It looks like the package maintainer, Eric who "Doesnt use vim and doesn't really care" decided to yank vim support for Python 3.
Apparently there was a conflict between Python 2 and Python 3 in VIM and yanking Python 3 support looked like the solution.
It looks like it was a toss-up and they chose Python 2 support over Python 3 because it has more libraries.
I'll play with ABS and see what I can do.
-David
Offline
Do you need python2 and python3 in one package?
Offline
I suppose not. Most of my projects are Python 2 but I'm transitioning to Python 3. I don't think I'll be working with both interpreters at once.
Offline
https://bugs.archlinux.org/task/25529
A Project Manager has denied the request pending for the following task:
FS#25529 - [gvim] compiled with -python3?
User who did this - Jan de Groot (JGC)Reason for denial:
Enabling both python2 and python3 interpreter is not an option.
Offline
Maybe you can just create python3-enabled vim package that conflicts with the stock one and install it when you are working with pythno3?
Offline
I got that working yesterday, but it's not optimal.
I'm going to play more with the ABS. This looks like a good opportunity for me to learn more about it.
My plan is to update the PKGBUILD for the current gvim package- and create a gvim-python3 package with a different installation prefix - /usr/local/ or even /opt/gvim-python3/
When I need to run for python3, I'll just use /opt/gvim-python3/bin/vim
I need to use gvim as a base.
Does that sound like a good solution or am I not considering something? I don't have experience with abs...
Thanks for the help, karol!
-David
Offline
Yup, that should work too and is more flexible than what I was suggesting.
I was thinking about just the '--enable-pythoninterp' and '--enable-python3interp'. One package would be for python2, the other for python3 and you would install one and remove the other when you would need to switch python interpreters ;P
Offline
Ok, if anyone else is using vim or gvim with Python 3- here's a new PKGBUILD!
I'm just learning abs and I'm sure it's not perfect, but it should work fine until the next version and the source links break!
Make sure you have installed and refreshed abs and do:
$ cp -r /var/abs/extra/vim /var/abs/local/vim-python3
Replace /var/abs/local/vim-python3/PKGBUILD with:
pkgbase=vim
pkgname=('vim-python3' 'gvim-python3' 'vim-runtime-python3')
_pkgprefix=('/opt/vim-python3')
_srcpkgname=('vim')
_topver=7.3
_patchlevel=401
__hgrev=0dabc2ce136c
_versiondir="vim${_topver//./}"
pkgver=${_topver}.${_patchlevel}
pkgrel=1
arch=('i686' 'x86_64')
license=('custom:vim')
url="http://www.vim.org"
makedepends=('gpm' 'python' 'ruby' 'libxt' 'desktop-file-utils' 'gtk2' 'lua')
source=(ftp://ftp.archlinux.org/other/vim/$_srcpkgname-${pkgver}.tar.xz{,.sig}
pythoncomplete.vim::http://www.vim.org/scripts/download_script.php\?src_id=10872
archlinux.vim gvim.desktop)
sha1sums=('99498cb48c0c720ae9972a6cd33d4926bdf733b7'
'ad14ce56f99ae1a86c96c5a5d0f44e48ad18a00e'
'4d9dcfb32874aa5467e6f06e418aeb4e675daaf2'
'25dd3c2ce436e73a367c8f73b68f7f6889682437'
'4a579cf66590d711f49c5dfb4a25e5df116ff7ba')
build() {
cd "${srcdir}"
cp -a ${_srcpkgname}-${pkgver} vim-build
# define the place for the global (g)vimrc file (set to /etc/vimrc)
sed -i 's|^.*\(#define SYS_.*VIMRC_FILE.*"\) .*$|\1|' \
vim-build/src/feature.h
sed -i 's|^.*\(#define VIMRC_FILE.*"\) .*$|\1|' \
vim-build/src/feature.h
(cd vim-build/src && autoconf)
cp -a vim-build gvim-build
cd "${srcdir}"/vim-build
./configure --prefix=${_pkgprefix} --localstatedir=/var/lib/vim \
--with-features=big --with-compiledby=ArchLinux \
--enable-gpm --enable-acl --with-x=no \
--disable-gui --enable-multibyte --enable-cscope \
--disable-netbeans --enable-perlinterp --disable-pythoninterp \
--enable-python3interp --disable-rubyinterp --disable-luainterp
make
cd "${srcdir}"/gvim-build
./configure --prefix=${_pkgprefix} --localstatedir=/var/lib/vim \
--with-features=big --with-compiledby=ArchLinux \
--enable-gpm --enable-acl --with-x=yes \
--enable-gui=gtk2 --enable-multibyte --enable-cscope \
--enable-netbeans --enable-perlinterp --disable-pythoninterp \
--enable-python3interp --enable-rubyinterp --enable-luainterp
make
}
package_vim-python3() {
pkgdesc='Python 3 enabled Vi Improved, a highly configurable, improved version of the vi text editor'
depends=("vim-runtime-python3=${pkgver}-${pkgrel}" 'gpm')
conflicts=('gvim-python3')
cd "${srcdir}"/vim-build
make -j1 VIMRCLOC=/etc DESTDIR="${pkgdir}" install
# provided by (n)vi in core
rm "${pkgdir}"${_pkgprefix}/bin/{ex,view}
# delete some manpages
find "${pkgdir}"${_pkgprefix}/share/man -type d -name 'man1' 2>/dev/null | \
while read _mandir; do
cd ${_mandir}
rm -f ex.1 view.1 # provided by (n)vi
rm -f evim.1 # this does not make sense if we have no GUI
done
# Runtime provided by runtime package
rm -r "${pkgdir}"${_pkgprefix}/share/vim
# license
install -Dm644 "${srcdir}"/vim-${pkgver}/runtime/doc/uganda.txt \
"${pkgdir}"${_pkgprefix}/share/licenses/${pkgname}/license.txt
# executables
mkdir -p "${pkgdir}"/usr/local/bin
ln -s ${_pkgprefix}/bin/vim \
"${pkgdir}"/usr/local/bin/vim-python3
}
package_gvim-python3() {
pkgdesc='Python 3 enabled Vi Improved, a highly configurable, improved version of the vi text editor (with advanced features, such as a GUI)'
depends=("vim-runtime-python3=${pkgver}-${pkgrel}" 'gpm' 'ruby' 'libxt'
'desktop-file-utils' 'gtk2' 'lua' 'python')
provides=("vim-python3=${pkgver}-${pkgrel}")
conflicts=('vim-python3')
install=gvim.install
cd "${srcdir}"/gvim-build
make -j1 VIMRCLOC=/etc DESTDIR="${pkgdir}" install
# delete some manpages
find "${pkgdir}"${_pkgprefix}/share/man -type d -name 'man1' 2>/dev/null | \
while read _mandir; do
cd ${_mandir}
rm -f ex.1 view.1 # provided by (n)vi
done
# Move the runtime for later packaging
mv "${pkgdir}"${_pkgprefix}/share/vim "${srcdir}"/runtime-install
# freedesktop links
install -Dm644 "${srcdir}"/gvim.desktop \
"${pkgdir}"/opt/vim-python3/share/applications/gvim.desktop
install -Dm644 runtime/vim48x48.png "${pkgdir}"${_pkgprefix}/share/pixmaps/gvim.png
# license
install -Dm644 "${srcdir}"/vim-${pkgver}/runtime/doc/uganda.txt \
"${pkgdir}"${_pkgprefix}/share/licenses/${pkgname}/license.txt
# executables
mkdir -p "${pkgdir}"/usr/local/bin
ln -s ${_pkgprefix}/bin/vim \
"${pkgdir}"/usr/local/bin/vim-python3
ln -s ${_pkgprefix}/bin/gvim \
"${pkgdir}"/usr/local/bin/gvim-python3
}
package_vim-runtime-python3() {
pkgdesc='Python 3 enabled runtime for vim and gvim'
depends=('perl' 'gawk' "vim-runtime=${pkgver}-${pkgrel}")
# Install the runtime split from gvim
install -dm755 "${pkgdir}"${_pkgprefix}/share
mv "${srcdir}"/runtime-install "${pkgdir}"${_pkgprefix}/share/vim
# Don't forget logtalk.dict
install -Dm644 "${srcdir}"/gvim-build/runtime/ftplugin/logtalk.dict \
"${pkgdir}"${_pkgprefix}/share/vim/${_versiondir}/ftplugin/logtalk.dict
# fix FS#17216
sed -i 's|messages,/var|messages,/var/log/messages.log,/var|' \
"${pkgdir}"${_pkgprefix}/share/vim/${_versiondir}/filetype.vim
sed -i 's|messages,/var|messages,/var/log/messages.log,/var|' \
"${pkgdir}"${_pkgprefix}/share/vim/${_versiondir}/filetype.vim
# fix Python filetype to use Python 3 complete function
sed -i 's/pythoncomplete#Complete/python3complete#Complete/' \
"${pkgdir}"${_pkgprefix}/share/vim/${_versiondir}/ftplugin/python.vim
# patch filetype.vim for better handling of pacman related files
sed -i "s/rpmsave/pacsave/;s/rpmnew/pacnew/;s/,\*\.ebuild/\0,PKGBUILD*,*.install/" \
"${pkgdir}"${_pkgprefix}/share/vim/${_versiondir}/filetype.vim
sed -i "/find the end/,+3{s/changelog_date_entry_search/changelog_date_end_entry_search/}" \
"${pkgdir}"${_pkgprefix}/share/vim/${_versiondir}/ftplugin/changelog.vim
# make Aaron happy
install -Dm644 "${srcdir}"/pythoncomplete.vim \
"${pkgdir}"${_pkgprefix}/share/vim/${_versiondir}/autoload/pythoncomplete.vim
# rc files
install -Dm644 "${srcdir}"/archlinux.vim \
"${pkgdir}"${_pkgprefix}/share/vim/vimfiles/archlinux.vim
# rgb.txt file
install -Dm644 "${srcdir}"/vim-${pkgver}/runtime/rgb.txt \
"${pkgdir}"${_pkgprefix}/share/vim/${_versiondir}/rgb.txt
# license
install -dm755 "${pkgdir}"${_pkgprefix}/share/licenses/vim-runtime
ln -s ${_pkgprefix}/share/vim/${_versiondir}/doc/uganda.txt \
"${pkgdir}"${_pkgprefix}/share/licenses/vim-runtime/license.txt
}
$ mkdir ~/abs/
$ cp -r /var/abs/local/vim-python3 ~/abs/
$ cd ~/abs/vim-python3
$ makepkg
...and pacman -U what you want.
It installs to /opt/vim-python3
vim-python3 and gvim-python3 symlinks are installed in /usr/local/bin/
-David
Offline
Why not
$ mkdir ~/abs/
$ cp -r /var/abs/extra/vim ~/abs/vim-python3
$ cd ~/abs/vim-python3
<edit PKGBUILD>
$ makepkg
I know this is unimportant but I don't get why do you copy it to /var/abs/local/vim-python3 first ;P
Offline
I was trying to keep /var/abs/local/vim-python3 clean and was building in ~/abs/vim-python3.
On my system, I'll probably toss ~/abs at some point but keep the /var/abs/local
But you're right, that probably doesn't matter to anyone else
-David
Offline
OK, I get that different versions of python don't mix, but why is it that support for python2 (and ruby and lua) are enabled only for gvim?? Some of us are actually quite content with using only command line vim Is there some rationale behind this, or is it a bug? (or a whim?)
Offline
OK, I get that different versions of python don't mix, but why is it that support for python2 (and ruby and lua) are enabled only for gvim?? Some of us are actually quite content with using only command line vim Is there some rationale behind this, or is it a bug? (or a whim?)
gvim package provides a vim binary. vim package is meant to be light and gvim package is meant to be full-featured.
Last edited by karol (2012-03-20 23:00:40)
Offline
OK, that clears it. Thanks for the (prompt!) reply!
Offline
Hi fellow Archers!
I too wandered in looking for python 3 support. It's disappointing that official repos gvim builds with python 2 as Arch is on the forefront of bleeding edge adoption usually. I've modified the official PKGBUILD to build with python 3 support and uploaded to AUR for the people who are still alive . https://aur.archlinux.org/packages.php?ID=61870. It should be working fine since I basically just changed some build flags, but if there's bugs, feel free to holler.
EDIT: I've also taken the time to fix ropemode/ropevim for Python 3. Python3ers, rejoice! /shameless plug
Last edited by darkfeline (2012-08-09 22:04:38)
Offline