Last Updated: February 25, 2016
·
3.862K
· wordofchristian

Fix vim after upgrading to yosemite

After I upgraded to OSX Yosemite vim started behaving strangely. For instance set clipboard=unnamed was no longer working. This is because yosemite came with it's own version of vim compiled without clipboard support.

To fix it, uninstall the system vim:

sudo rm /usr/bin/vim

Then reinstall vim with homebrew

brew install vim

1 Response
Add your response

I wouldn't recommend removing the system vim outright. What I do is detect the most recently modified version of vim and set that to the EDITOR variable (and then alias the vim command to it)

find_vim()
{
 local IFS=$'\n'
 local vim
 for vim in $(whence -ap vim); do
 if [[ -z $BEST_VIM ]] || [[ $vim -nt $BEST_VIM ]]; then
 export BEST_VIM=$vim
 fi
 done
}
find_vim

if [[ -n "$BEST_VIM" ]]; then
 export EDITOR="$BEST_VIM"
fi
over 1 year ago ·