On my Mac, I use
homebrew for most of my editing.
~|⇒ vim --version VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 20 2012 13:16:02) Compiled by firstname.lastname@example.org Normal version without GUI. Features included (+) or not (-): -arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent -clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments -conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path +find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv +insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent +listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape -mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm -mouse_sysmouse +mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype +path_extra -perl +persistent_undo +postscript +printer -profile +python/dyn -python3 +quickfix +reltime -rightleft +ruby/dyn +scrollbind +signs +smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" user exrc file: "$HOME/.exrc" fall-back for $VIM: "/usr/share/vim" Compilation: gcc -c -I. -D_FORTIFY_SOURCE=0 -Iproto -DHAVE_CONFIG_H -arch i386 -arch x86_64 -g -Os -pipe Linking: gcc -arch i386 -arch x86_64 -o vim -lncurses
However, over the last few days, I am having a weird problem. When I start vim from the command line, I get the following message and vim immediately crashes.
~|⇒ vim test.txt Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/site.py", line 74, in <module> __boot() File "/usr/local/lib/python2.7/site-packages/site.py", line 34, in __boot imp.load_module('site',stream,path,descr) File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 563, in <module> main() File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 545, in main known_paths = addusersitepackages(known_paths) File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 278, in addusersitepackages user_site = getusersitepackages() File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 253, in getusersitepackages user_base = getuserbase() # this will also set USER_BASE File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 243, in getuserbase USER_BASE = get_config_var('userbase') File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 472, in get_config_var return get_config_vars().get(name) File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 405, in get_config_vars import re File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 105, in <module> import sre_compile File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sre_compile.py", line 14, in <module> import sre_parse File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sre_parse.py", line 17, in <module> from sre_constants import * File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sre_constants.py", line 18, in <module> from _sre import MAXREPEAT ImportError: cannot import name MAXREPEAT
But when I start it using the icon in the
Applications menu, it starts up just fine. I tried some variants on this, for example if I do
open Applications/MacVim, this runs perfectly. As far as I understand it, something goes wrong python when I start vim from the command line.
Could someone tell me what is going wrong here and how to fix it. You can find my vimrc files here.
No. This thing is not Vim or MacVim installed with Homebrew: it is the default Vim that comes with Mac OS X.
The default Vim has been sucking in a number of ways for quite a long time, chiefly
-xterm-clipboard, and that's the main reason why people usually install a "proper" Vim. Installing MacVim doesn't replace the default Vim at all so you must do a small bit of tinkering to make the
vim command execute MacVim's bundled CLI executable:
mvim script somewhere in your
Add the line below to your shell's
alias vim='mvim -v'
But you use Homebrew and I have no idea if it does anything with that
mvim script or even if it is installed at all.
If you want to use Homebrew's Vim/MacVim in your shell you basically have two solutions.
Make sure the
vim command points to your fancy Vim. It can be done in a multitude of ways: one way is to add the directory where your Vim is installed to the beginning of your
$PATH, another way is simply to create an alias in your shell's
Reinstall Vim or MacVim via Homebrew with the