How to write patches for Vim

Embed Size (px)

Citation preview

How to write patches for Vim
Be a patch meister

VimConf 2013 2013-11-16 K.Takata

Profile

Name: K.Takata

Twitter: @k_takata

GitHub: k-takata

Bitbucket: k_takata

Web: http://homepage3.nifty.com/k-takata/

Maintainer of Onigmo (The regex engine of Ruby 2.0)

Author of bregonig.dll (Regex DLL used by Sakura Editor, etc.)

Vimmer level: Beginner
I sometimes use cursor keys :-)

Merged patches: About 75 patches (since 7.3.668)

K.T

Contents

How to write patchesTools

Join the communities

Get the latest source code

Explore the Vim's source code

Write patches

Share your patches

Categories of my patches

My favorite patchesMerged patches

Undergoing patches

Tools

Version Control System (VCS):Mercurial (hg) and Mercurial Queues (MQ)

Compiler:Windows:MSVC, MinGW (BCC doesn't seem to work)

Linux, MacOS X and other OS:GCC, Clang

Editor: Vim, of cause ;-)

Other utilities: ctags, etc.

Join the communities

vim_dev: Vim developers maillisthttps://groups.google.com/forum/#!forum/vim_dev

vim-jp: Japanese Vim communityTop page: http://vim-jp.org/Issue tracker: https://github.com/vim-jp/issues/issuesIf you post an issue, you will be automatically added as a member in a few days.

For Japanese people, maybe it's better to discuss
with vim-jp members before sending your patch to
vim_dev.

Get the latest source code

Vim from Mercurial:http://www.vim.org/mercurial.php

Build on Windows and Linux (Japanese):http://vim-jp.org/docs/build_windows_msvc.htmlhttp://vim-jp.org/docs/build_windows_mingw.htmlhttp://vim-jp.org/docs/build_linux.html(Please someone write a page for MacOS X.)

$ hg clone https://vim.googlecode.com/hg/ vim

Explore the Vim's source code

Read src/README.txt first:buffer.c manipulating buffers (loaded files)eval.c expression evaluation (Vim script)fileio.c reading and writing filesmbyte.c multi-byte character handlingoption.coptionsscreen.c updating the windows

gui*.c GUIif_*.c interface to other languages (python, etc.) and toolsos_*.c OS depended codesproto/*.proprototypes generated by cproto

Explore the Vim's source code

Use tag jump with Exuberant Ctags:

Open a source file with Vim and move the cursor to a symbol, then type Ctrl-].For detail:

If you install Emacs on Ubuntu, ctags may become a symlink to etags. To fix this, use the following command:

A menu will be shown, then select ctags-exuberant.

$ cd src$ ctags -R

:help tag:help window-tag:help -t

$ sudo update-alternatives --config ctags

Write patches

You should see:

After writing comments or documents, use spell checker:

For detail:

Japanese translation of spell.txt is undergoing.Please join: https://github.com/vim-jp/vimdoc-ja

Please also check: How to write patches (Japanese):http://vim-jp.org/docs/how_to_write_patches.html

:help coding-style:help development

:help spell

:set spell

Share your patches

If you want to share your series of patches with other people, use Bitbucket.

K.Takata's patch queue for Vim:https://bitbucket.org/k_takata/vim-ktakata-mq

To get the latest source code and patches when they are updated:

$ hg qclone https://vim.googlecode.com/hg/ \ -p https://bitbucket.org/k_takata/vim-ktakata-mq vim$ cd vim$ hg qpush -a$ make

$ hg qpop -a && hg pull -u && hg pull -u --mq \ && hg qpush -a

?

Categories of my patches

OS: Windows, Linux, All Platforms

Mutlibyte support

Build system

Fix typos in comments or documents

Language interface (Python, Perl, Ruby, etc.)

Tests

Runtime files (e.g. less.vim)

> Any kind of patch is welcome!