I just changed my shell to ZSH. However, when I tried to edit a .py file in vim I got a strange error:

"test.py" [New File] Error detected while processing /usr/local/share/vim/vim73/ftplugin/python.vim: line 21: E492: Not an editor command: def)') line 22: E492: Not an editor command: def)') line 23: E492: Not an editor command: def)') line
24: E492: Not an editor command: def)') line 42: E10: \ should be followed by /, ? or &

However, if I comment out

filetype indent plugin on

in my .vimrc the message goes away, unfortunately so does my smart indentation. Does anyone know why vim would be effected by a change in shell? Or have a workaround?

2 Answers 2


Vim wouldn't be affected by your change in shell. If you changed your login shell to zsh, then your ~/.profile and /etc/profile aren't read any more; it's possible that vim was relying on an environment variable defined in one of these files, or that you have two version of Vim on your system and your PATH is now different so you're running a different version of Vim.

You can make ~/.zprofile execute ~/.profile. Zsh's syntax isn't completely compatible with sh, so you need to put zsh in compatibility mode.

read_profiles () {
  emulate -LR sh
  if [ -r /etc/profile ]; then . /etc/profile; fi
  if [ -r ~/.profile ]; then . ~/.profile; fi
  • This was in fact the issue, an old version of vim leftover from who knows when was taking precedence over a newer version of vim.
    – user10667
    Commented Sep 18, 2011 at 23:37

I don't think its zsh put rather your plugin. It looks like your missing something from the beginning of line 21. Try pulling down python.vim again and see if that clears your issue.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .