0

I installed vim in CentOS 6.3.
It has python 2.6 by default, and it is under /usr/lib. When I try to install vim following this link: https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source

It doesn't support both python and python 3.

Because it seemed like the page link assumes you have python 2.7, I downloaded python 2.7. Still no success.

I ran yum install python-devel. Still no success.

But also, I noticed that when I call:

make VIMRUNTIMEDIR=/usr/share/vim/vim74

I get:

link.sh: $LINK_AS_NEEDED set to 'yes': invoking linker directly. gcc -L. -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib64/perl5/CORE -L/usr/local/lib -Wl,--as-needed -o vim objects/buffer.o objects/blowfish.o objects/charset.o objects/crypt.o objects/crypt_zip.o objects/diff.o objects/digraph.o objects/edit.o objects/eval.o objects/ex_cmds.o objects/ex_cmds2.o objects/ex_docmd.o objects/ex_eval.o objects/ex_getln.o objects/fileio.o objects/fold.o objects/getchar.o objects/hardcopy.o objects/hashtab.o objects/if_cscope.o objects/if_xcmdsrv.o objects/mark.o objects/memline.o objects/menu.o objects/message.o objects/misc1.o objects/misc2.o objects/move.o objects/mbyte.o objects/normal.o objects/ops.o objects/option.o objects/os_unix.o objects/pathdef.o objects/popupmnu.o objects/quickfix.o objects/regexp.o objects/screen.o objects/search.o objects/sha256.o objects/spell.o objects/syntax.o objects/tag.o objects/term.o objects/ui.o objects/undo.o objects/version.o objects/window.o objects/if_lua.o objects/if_perl.o objects/if_perlsfio.o objects/if_python.o objects/if_ruby.o objects/netbeans.o objects/channel.o objects/json.o objects/main.o objects/memfile.o -lm -ltinfo -lnsl -lselinux -L/usr/lib -llua -Wl,-E -Wl,-rpath,/usr/lib64/perl5/CORE -fstack-protector -L/usr/lib64/perl5/CORE -lperl -lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc -L/usr/lib64/python2.6/config -lpython2.6 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -lruby -lpthread -lrt -ldl -lcrypt -lm

It seemed to look into /usr/lib64/python2.6, not /usr/lib/python2.6. So just in case, I created a symlink to /usr/lib64/python2.6 and /usr/lib64/python2.7. Still no success.

Where should I go from here?

10
  • Compiling vim from source seems to be an overkill. In CentOS the package vi is installed by default, what you're looking for is probably vim-enhanced. Commented May 19, 2016 at 11:58
  • Bye the way what do you mean with vim "support" Python? Syntax highlight? Commented May 19, 2016 at 11:59
  • @jotrocken No + in front of python when I call "vim --version" Commented May 20, 2016 at 0:15
  • AFAIK the support indicated by + just allows you to run the python interpreter from within vim as :python <sys.args>. Not sure if that is worth the compilation hassle. In my Ubuntu I don't have the + either, but syntax highlight works just fine. To run a python command, just use Ctrl+Z, run the command and fg to come back later, or declare an alias in your .vimrc. Commented May 23, 2016 at 9:39
  • Otherwise, what were the arguments you passed to ./configure? Make sure to have --enable-pythoninterp and --with-python-config-dir with correct arguments. Commented May 23, 2016 at 9:41

3 Answers 3

1

You don't need to compile vim yourself to get syntax highlight.

From what we found out in the comments, it looks as if your installation is incomplete. To get Python syntax highlight in vim, try a clean installation via the package manager of CentOS:

yum install vim-X11 vim-common vim-enhanced vim-minimal 

Then enable syntax highlight by either typing :syntax on inside vim or adding the following line to the file .vimrc in your home directory (the latter makes it permanent):

syntax on

See this page for an example .vimrc.

Sign up to request clarification or add additional context in comments.

4 Comments

Since I failed to install vim with syntax highlight from source, I have already tried downloading that way. Currently version is yum installed version. However, I get "Error detected while processing /etc/vimrc: line 50: E484: Can't open file /usr/share/vim/vim74/syntax/syntax.vim"
If I call that I get "Setting up Install Process Package 2:vim-X11-7.4.629-5.el6.x86_64 already installed and latest version Package 2:vim-common-7.4.629-5.el6.x86_64 already installed and latest version Package 2:vim-enhanced-7.4.629-5.el6.x86_64 already installed and latest version Package 2:vim-minimal-7.4.629-5.el6.x86_64 already installed and latest version Nothing to do" So it is indeed installed
Strange. 1) According to distrowatch.com CentOS 6.3 comes with a vim version less than 7.4. Try to remove what is left of your self-compiled installation, then try again. 2) Try yum reinstall [...] instead of install. 3) Maybe the file is in a different location: Do a find /usr/ -name "syntax.vim" and create a symlink to the result with ln -s [result of find] /usr/share/vim/vim74/syntax/syntax.vim. The latter command requires root access and maybe you have to create the directory first with mkdir -p /usr/share/vim/vim74/syntax/.
I've already done a find to look for syntax.vim. It doesn't exist. And vim version is 7.4.629. Somehow it thinks vim is full installed despite missing syntax folder. Anyway, I actually solved it by transferring all the syntax files from a working vim, and it seems to be fine now.
1

In my case, this is caused by the legacy files in the last build.

Everything works well after I clean these files.

make distclean

./configure *** (parameters) ***

make

make install

Comments

0

If you are using vim to edit, but having difficulty running the file afterwards by doing "$ python foobar.py", then you probably want to specify the python version at the top of the file as follows:

#!/usr/bin/python3

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.