Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix this error "E122: Function MyDiff already exists, add ! to replace it" after I source a vimrc file?

Tags:

vim

I use a portable gVim on Windows. This error E122: Function MyDiff already exists, add ! to replace it shows after I source this vimrc file.

I try to fix it by replace function MyDiff() with function MyDiff()! in my vimrc file. The error is gone. But next time I start the gvim application. An error message box shows Error detected while processing vimrc: line x. Maybe I replace wrong thing. Any help will be much appreciated?

like image 845
Zhihau Shiu Avatar asked Sep 26 '16 15:09

Zhihau Shiu


1 Answers

As explained in :help :function you must append a ! to the :function command:

function! MyDiff()
like image 56
romainl Avatar answered Sep 21 '22 18:09

romainl