MacVim + Anaconda Python3 support

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

MacVim + Anaconda Python3 support

Richard Randolph
I’m learning VIM and Python, novice for both. I would like to use VIM as a Python editor and I’d like to run python directly from the VIM editor. I use Anaconda for my python install. I built VIM from source so I could be sure VIM uses Anaconda instead of the system python. After I built VIM it appears to be working and using the Anaconda install but :version shows ‘-python3’ (thought it should be ‘+python3’).  Being a total novice to python, VIM, unix, etc., I’m not sure if I have VIM installed properly.

Also, I was wondering the best way to run python from VIM. Is there a better way than typing ‘:w !python’?

I download the source code from GitHub.
I followed instructions for building on a MAC.
Run `./configure` in the `src/` directory with the flags you want to call
$ cd src
./configure --with-features=huge \
--enable-python3interp=yes \
--with-python3-config-dir=/Applications/Anaconda/anaconda/bin/python \
Now build the project using `make`:
$ make
To install MacVim, type
$ open MacVim/build/Release
and drag the MacVim icon into your `Applications` folder.

However, when I check version I see that I don’t have python3 support.

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Nov 25 2016 07:47:46)
MacOS X (unix) version
Included patches: 1-94
Compiled by xxxxxxxxxxxxx
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl             +find_in_path    -mouse_sysmouse  -tag_any_white
+arabic          +float           +mouse_urxvt     -tcl
+autocmd         +folding         +mouse_xterm     +termguicolors
+balloon_eval    -footer          +multi_byte      +terminfo
+browse          +fork()          +multi_lang      +termresponse
++builtin_terms  +fullscreen      -mzscheme        +textobjects
+byte_offset     -gettext         +netbeans_intg   +timers
+channel         -hangul_input    +num64           +title
+cindent         +iconv           +odbeditor       +toolbar
+clientserver    +insert_expand   +packages        +transparency
+clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        -perl            +vertsplit
+cmdline_hist    +keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       -python          +vreplace
+cscope          +lispindent      -python3         +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con_gui  -lua             +rightleft       +writebackup
+diff            +menu            -ruby            -X11
+digraphs        +mksession       +scrollbind      -xfontset
+dnd             +modify_fname    +signs           +xim
-ebcdic          +mouse           +smartindent     -xpm
+emacs_tags      +mouseshape      +startuptime     -xsmp
+eval            +mouse_dec       +statusline      -xterm_clipboard
+ex_extra        -mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax
+farsi           +mouse_netterm   +tag_binary
+file_in_path    +mouse_sgr       +tag_old_static
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/Applications/"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unk
nown-pragmas -pipe  -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1

Linking: gcc    -o Vim -framework Cocoa -framework Carbon       -lm -lncurses  -
liconv -framework Cocoa  

I can run python from VIM.

print ('Hello World!')
:w !python
Hello World!

And the version does point to the Anaconda install.

import sys
print (sys.version)
:w !python
3.4.5 |Anaconda 2.3.0 (x86_64)| (default, Jul  2 2016, 17:47:57)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)]  

You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit

You received this message because you are subscribed to the Google Groups "vim_mac" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit