created December 12, 2003 · complexity basic · author Benji Fisher · version 5.7
Here is how to make a patch. Make a local backup of the file you are going to change, then edit the file as needed. Next, change to the directory (such as vim74/) containing the src/ source directory. If you are editing one of the help files and do not have the Vim source files, change to your $VIMRUNTIME directory (usually /usr/local/share/vim/vimxx/ on *nix systems). Use the diff program to make the patch like this:
$ diff -u src/eval.c.orig src/eval.c > /tmp/eval.c.diff
The directory and file name for the patches are just suggestions. If you change more than one file, you can concatenate the patches or read the man page for diff to create one big patch.
Vim can automatically create the backup, by setting the 'patchmode' option to the string you want to append to make the backup file's name. Do this before you save for the first time. For example,
You can also easily export a patch from Mercurial or Git, if you get the source that way. Then you don't need to bother making backups. This is normally as easy as running the appropriate diff command and redirecting to a file, for example
hg diff src/eval.c > eval.c.diff.
If you are on a Windows system that does not have the diff program, you may be able to get one from http://gnuwin32.sourceforge.net/. One also ships in the Vim installer but that version adds Windows-style line endings which makes the resulting patch not nice to deal with.
The -c option produces a "context diff". This is fairly easy for both humans and machines to read, and all official patches for Vim are released in this form.
Once you have your patch, you need to submit it. Any changes to help files or C code (.txt, .c, and .h files) should go to the vim-dev mailing list: :help vim-dev See http://www.vim.org/maillist.php#vim-dev
For .vim files in the ftplugin, syntax, indent, etc. directories, you may need to submit to a different location. Feel free to post to vim_dev if you like, but each one of these files includes an official maintainer and his or her contact information at the top of the file. This is the person who will eventually be applying your patch, so be sure to contact them first!
I had real trouble applying big 'cvs diff' patches, and found the following gnu doc tools and doc useful: