fast, as-you-type, fuzzy-search code completion engine for Vim.
At a very high level:
- Make sure that MacPorts
pythonare found before the OS X versions. This requires updating your
pythonis symlinked to the correct version.
python35in this case.
vimis compiled with Python support. MacPorts does not do this by default.
- Install YouCompleteMe.
Detailed instructions provided in the following sections.
My setup at time of writing this post:
- OS X 10.14.2
- MacPorts 2.5.4
- YouCompleteMe commit 7997fc5
- Vim 8.1
- Python 3.7.1 (this should work with 2.7)
In order for this to work the MacPorts
bin directory has to be high up on
PATH list. The
PATH needs to be updated with something like this:
This will allow for the MacPorts versions of
python to be found
before the locally installed OS X versions are. There are various ways of
doing this, I personally maintain my
PATH environment variable in
~/.profile with a block like this in it:
# PATH variable for use with MacPorts. if [ -f "/opt/local/bin/port" ] ; then export PATH=/opt/local/libexec/gnubin:/opt/local/bin:/opt/local/sbin:$PATH export MANPATH=/opt/local/share/man:$MANPATH fi
For more on configuring environment variables refer to MacPorts and the Shell.
The key takeaway here is using
port select to maintain the symlinks pointing
the actual versions of
python being used.
$ sudo port install python37 py37-pip py37-gnureadline $ sudo port select --set python python37 $ sudo port select --set python3 python37 $ sudo port select --set pip pip37
In this case executing
python3 point to the
pip is symlinked similarly.
If you are not familiar with
port select, try
port help select and
port select --summary. The latter will provide a list of all MacPorts
vim does not come with Python support by default. This is
simple to remedy using MacPorts variants. Just reinstall Vim with:
$ sudo port install vim +python37 +huge
To get a full list of features that
vim is compiled with execute
$ cd ~/.vim/bundle $ git clone https://github.com/Valloric/YouCompleteMe.git $ cd ~/.vim/bundle/YouCompleteMe/ $ git submodule update --init --recursive
Now to install the compiled components of YouCompleteMe. The installation is
install.py, and not
install.sh. The latter is being deprecated
and defaults to a Python 2.x installation:
$ ./install.py --clang-completer
This post is an elaboration on the following. I found them while trying to figure out how to get YouCompleteMe working on my configuration. Moving to MacVim was not really an option for me:
These may be helpful as well:
- YouCompleteMe - "YouCompleteMe is a fast, as-you-type, fuzzy-search code completion engine for Vim. It has several completion engines."
- MacPorts - "The MacPorts Project is an open-source community initiative to design an easy-to-use system for compiling, installing, and upgrading either command-line, X11 or Aqua based open-source software on the Mac operating system."
- Vim - "Vim is a highly configurable text editor built to make creating and changing any kind of text very efficient. It is included as "vi" with most UNIX systems and with Apple OS X."
- MacVim - "Vim - the text editor - for Mac OS X."