SlideShare a Scribd company logo
1 of 21
How to write patches for Vim
– Be a patch meister –

VimConf 2013
2013-11-16 K.Takata

1
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

K.T

I sometimes use cursor keys :-)
●

Merged patches: About 75 patches (since 7.3.668)
2
Contents
●

How to write patches
–
–

Join the communities

–

Get the latest source code

–

Explore the Vim's source code

–

Write patches

–

Share your patches

–
●

Tools

Categories of my patches

My favorite patches
–

Merged patches

–

Undergoing patches
3
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.
4
Join the communities
●

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

●

vim-jp: Japanese Vim community
Top page: http://vim-jp.org/
Issue tracker: https://github.com/vim-jp/issues/issues
–

If 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.
5
Get the latest source code
●

Vim from Mercurial:
http://www.vim.org/mercurial.php
$ hg clone https://vim.googlecode.com/hg/ vim

●

Build on Windows and Linux (Japanese):
http://vim-jp.org/docs/build_windows_msvc.html
http://vim-jp.org/docs/build_windows_mingw.html
http://vim-jp.org/docs/build_linux.html
(Please someone write a page for MacOS X.)
6
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 files

mbyte.c

multi-byte character handling

option.c options
screen.c

updating the windows

gui*.c

GUI

if_*.c

interface to other languages (python, etc.) and tools

os_*.c

OS depended codes

proto/*.pro

prototypes generated by cproto
7
Explore the Vim's source code
●

Use tag jump with Exuberant Ctags:
$ cd src
$ ctags -R

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

If you install Emacs on Ubuntu, ctags may become a symlink to
etags. To fix this, use the following command:
$ sudo update-alternatives --config ctags

A menu will be shown, then select ctags-exuberant.
8
Write patches
You should see:
:help coding-style
:help development

After writing comments or documents, use spell checker:
:set spell

For detail:
:help spell
●

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
9
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

?

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

To get the latest source code and patches when they are
updated:
$ hg qpop -a && hg pull -u && hg pull -u --mq 
&& hg qpush -a
10
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! <
11
My favorite patches
●

Part 1: Merged patches
–
–

symlinkfix

–
●

Cygwin clipboard
spelllang-cjk

Part 2: Undergoing patches
–

DirectWrite

–

breakindent

12
Cygwin clipboard (7.3.836)

https://groups.google.com/d/topic/vim_dev/UpMljHBa77w/discussio
Authors: Frodak Baksik, Anton Sharonov and K.Takata
Platform: Cygwin
The first version backs to 2007.
Cygwin Vim didn't support Win32 clipboard. You had to install
the fakeclip plugin by Kana Natsuno.
Now you can use Win32 clipboard without any plugins.

13
symlinkfix (7.3.1182)
https://github.com/vim-jp/issues/issues/241
Authors: David Pope and K.Takata
Platform: Windows
Windows Vista and later support symlinks but Vim didn't support
them when :set backup backupcopy=auto. (Symlinks became
normal files after editing.)
The original patch didn't support multibyte filenames, so I fixed it.
This was my first patch for the main part of Vim. (I already sent some
patches for runtime files.) It took about a year to be merged.
This patch had a bug and the fix was merged as 7.3.1210.
It took only 15 minutes!!!
14
7.4.088 (spelllang-cjk)
https://github.com/vim-jp/issues/issues/476
Author: K.Takata
Platform: All
This patch was merged this week!
When :set spelllang=en,cjk, CJK
characters are excluded from spell checking.

15
7.4.088 (spelllang-cjk)
:set spelllang=en

:set spelllang=en,cjk

16
DirectWrite
https://github.com/vim-jp/issues/issues/262
https://github.com/vim-jp/issues/issues/337
Authors: MURAOKA Taro and K.Takata
Platform: Windows
Better text rendering using DirectWrite.
:set renderoptions=type:directx
17
breakindent
https://github.com/vim-jp/issues/issues/114
https://retracile.net/wiki/VimBreakIndent
Authors: Many authors
Platform: All
When :set breakindent, every wrapped line will continue
visually indented.
The first patch was written by Václav Šmilauer in 2004.
I updated the patch for 7.4, and also fixed one FIXME.
TODO:
–

There are still some FIXMEs in screen.c.

–

No test case.
18
breakindent

Off

On

19
Conclusions
●

Build your own Vim.

●

Any kind of patch is welcome. Don't be afraid.

●

Find your favorite patch and improve it.

20
Enjoy Vimming!

21

More Related Content

What's hot

PHP QA Tools
PHP QA ToolsPHP QA Tools
PHP QA Toolsrjsmelo
 
Docker and Running multiple versions of PHP @ CareerZoo Dublin
Docker and Running multiple versions of PHP @ CareerZoo DublinDocker and Running multiple versions of PHP @ CareerZoo Dublin
Docker and Running multiple versions of PHP @ CareerZoo Dublinrjsmelo
 
Pharo 7.0 and 8.0 alpha
Pharo 7.0 and 8.0 alphaPharo 7.0 and 8.0 alpha
Pharo 7.0 and 8.0 alphaPharo
 
Install Qt/Qt Quick for Android devices
Install Qt/Qt Quick for Android devicesInstall Qt/Qt Quick for Android devices
Install Qt/Qt Quick for Android devicesPaolo Sereno
 
about Debian "squeeze" @201002 OSC Tokyospring
about Debian "squeeze" @201002 OSC Tokyospringabout Debian "squeeze" @201002 OSC Tokyospring
about Debian "squeeze" @201002 OSC TokyospringHideki Yamane
 
KDE Plasma Develop Intro
KDE Plasma Develop IntroKDE Plasma Develop Intro
KDE Plasma Develop Introcsslayer
 
EuroBSDCon 2021 - (auto)Installing BSD Systems
EuroBSDCon 2021 - (auto)Installing BSD SystemsEuroBSDCon 2021 - (auto)Installing BSD Systems
EuroBSDCon 2021 - (auto)Installing BSD SystemsVinícius Zavam
 
Porting the drm/kms graphic drivers to DragonFlyBSD by Francois Tigeot
Porting the drm/kms graphic drivers to DragonFlyBSD by Francois TigeotPorting the drm/kms graphic drivers to DragonFlyBSD by Francois Tigeot
Porting the drm/kms graphic drivers to DragonFlyBSD by Francois Tigeoteurobsdcon
 
GIT_GITHUB_2016_06_17
GIT_GITHUB_2016_06_17GIT_GITHUB_2016_06_17
GIT_GITHUB_2016_06_17siva ram
 
Python_Session
Python_SessionPython_Session
Python_Sessionsiva ram
 
第32回PHP勉強会 LT 極めてない! Git
第32回PHP勉強会 LT 極めてない! Git第32回PHP勉強会 LT 極めてない! Git
第32回PHP勉強会 LT 極めてない! Gitkunit
 
openSUSE tools on Debian
openSUSE tools on DebianopenSUSE tools on Debian
openSUSE tools on DebianHideki Yamane
 
FFmpeg - the universal multimedia toolkit
FFmpeg - the universal multimedia toolkitFFmpeg - the universal multimedia toolkit
FFmpeg - the universal multimedia toolkitStefano Sabatini
 
What's missing from upstream kernel containers?
What's missing from upstream kernel containers?What's missing from upstream kernel containers?
What's missing from upstream kernel containers?Kirill Kolyshkin
 
Not so brief history of Linux Containers
Not so brief history of Linux ContainersNot so brief history of Linux Containers
Not so brief history of Linux ContainersKirill Kolyshkin
 
tDiary開発環境!VMWarePlayer編
tDiary開発環境!VMWarePlayer編tDiary開発環境!VMWarePlayer編
tDiary開発環境!VMWarePlayer編freedomcat
 

What's hot (19)

PHP QA Tools
PHP QA ToolsPHP QA Tools
PHP QA Tools
 
Docker and Running multiple versions of PHP @ CareerZoo Dublin
Docker and Running multiple versions of PHP @ CareerZoo DublinDocker and Running multiple versions of PHP @ CareerZoo Dublin
Docker and Running multiple versions of PHP @ CareerZoo Dublin
 
Pharo 7.0 and 8.0 alpha
Pharo 7.0 and 8.0 alphaPharo 7.0 and 8.0 alpha
Pharo 7.0 and 8.0 alpha
 
Install Qt/Qt Quick for Android devices
Install Qt/Qt Quick for Android devicesInstall Qt/Qt Quick for Android devices
Install Qt/Qt Quick for Android devices
 
Vim
VimVim
Vim
 
about Debian "squeeze" @201002 OSC Tokyospring
about Debian "squeeze" @201002 OSC Tokyospringabout Debian "squeeze" @201002 OSC Tokyospring
about Debian "squeeze" @201002 OSC Tokyospring
 
Comparing C and Go
Comparing C and GoComparing C and Go
Comparing C and Go
 
KDE Plasma Develop Intro
KDE Plasma Develop IntroKDE Plasma Develop Intro
KDE Plasma Develop Intro
 
EuroBSDCon 2021 - (auto)Installing BSD Systems
EuroBSDCon 2021 - (auto)Installing BSD SystemsEuroBSDCon 2021 - (auto)Installing BSD Systems
EuroBSDCon 2021 - (auto)Installing BSD Systems
 
Porting the drm/kms graphic drivers to DragonFlyBSD by Francois Tigeot
Porting the drm/kms graphic drivers to DragonFlyBSD by Francois TigeotPorting the drm/kms graphic drivers to DragonFlyBSD by Francois Tigeot
Porting the drm/kms graphic drivers to DragonFlyBSD by Francois Tigeot
 
GIT_GITHUB_2016_06_17
GIT_GITHUB_2016_06_17GIT_GITHUB_2016_06_17
GIT_GITHUB_2016_06_17
 
SCM Boot Camp
SCM Boot CampSCM Boot Camp
SCM Boot Camp
 
Python_Session
Python_SessionPython_Session
Python_Session
 
第32回PHP勉強会 LT 極めてない! Git
第32回PHP勉強会 LT 極めてない! Git第32回PHP勉強会 LT 極めてない! Git
第32回PHP勉強会 LT 極めてない! Git
 
openSUSE tools on Debian
openSUSE tools on DebianopenSUSE tools on Debian
openSUSE tools on Debian
 
FFmpeg - the universal multimedia toolkit
FFmpeg - the universal multimedia toolkitFFmpeg - the universal multimedia toolkit
FFmpeg - the universal multimedia toolkit
 
What's missing from upstream kernel containers?
What's missing from upstream kernel containers?What's missing from upstream kernel containers?
What's missing from upstream kernel containers?
 
Not so brief history of Linux Containers
Not so brief history of Linux ContainersNot so brief history of Linux Containers
Not so brief history of Linux Containers
 
tDiary開発環境!VMWarePlayer編
tDiary開発環境!VMWarePlayer編tDiary開発環境!VMWarePlayer編
tDiary開発環境!VMWarePlayer編
 

Similar to How to Write Patches for Vim and Become a Patch Meister

Openstack contribution process
Openstack contribution processOpenstack contribution process
Openstack contribution processSyed Armani
 
OpenStack Contribution Process
OpenStack Contribution ProcessOpenStack Contribution Process
OpenStack Contribution Processopenstackindia
 
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)Alexandre Gouaillard
 
Intro to Kernel Debugging - Just make the crashing stop!
Intro to Kernel Debugging - Just make the crashing stop!Intro to Kernel Debugging - Just make the crashing stop!
Intro to Kernel Debugging - Just make the crashing stop!All Things Open
 
Helpful pre commit hooks for Python and Django
Helpful pre commit hooks for Python and DjangoHelpful pre commit hooks for Python and Django
Helpful pre commit hooks for Python and Djangoroskakori
 
Life of a Chromium Developer
Life of a Chromium DeveloperLife of a Chromium Developer
Life of a Chromium Developermpaproductions
 
Embedding Qt
Embedding QtEmbedding Qt
Embedding QtFSCONS
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with serverEugene Yokota
 
Os dev tool box
Os dev tool boxOs dev tool box
Os dev tool boxbpowell29a
 
Module 4_WorkinUnixLinuxCommandAndKeepDoing
Module 4_WorkinUnixLinuxCommandAndKeepDoingModule 4_WorkinUnixLinuxCommandAndKeepDoing
Module 4_WorkinUnixLinuxCommandAndKeepDoingalhassanjawad1
 
Lessons Learned: Using Concourse In Production
Lessons Learned: Using Concourse In ProductionLessons Learned: Using Concourse In Production
Lessons Learned: Using Concourse In ProductionShingo Omura
 
LMG Lightning Talks - SFO17-205
LMG Lightning Talks - SFO17-205LMG Lightning Talks - SFO17-205
LMG Lightning Talks - SFO17-205Linaro
 
Let's talk about neovim
Let's talk about neovimLet's talk about neovim
Let's talk about neovimShougo
 
Rejekts 24 EU No GitOps Pain, No Platform Gain
Rejekts 24 EU No GitOps Pain, No Platform GainRejekts 24 EU No GitOps Pain, No Platform Gain
Rejekts 24 EU No GitOps Pain, No Platform GainŁukasz Piątkowski
 
.NET Applications & Cloud Meetup at 7 Peaks
.NET Applications & Cloud Meetup at 7 Peaks.NET Applications & Cloud Meetup at 7 Peaks
.NET Applications & Cloud Meetup at 7 PeaksSeven Peaks Speaks
 
Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Henry Schreiner
 
3DC Intro to Git Workshop
3DC Intro to Git Workshop3DC Intro to Git Workshop
3DC Intro to Git WorkshopBeckhamWee
 
Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...
Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...
Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...OpenShift Origin
 
LinuxKit Deep Dive
LinuxKit Deep DiveLinuxKit Deep Dive
LinuxKit Deep DiveDocker, Inc.
 

Similar to How to Write Patches for Vim and Become a Patch Meister (20)

Openstack contribution process
Openstack contribution processOpenstack contribution process
Openstack contribution process
 
OpenStack Contribution Process
OpenStack Contribution ProcessOpenStack Contribution Process
OpenStack Contribution Process
 
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
 
Git Basics
Git BasicsGit Basics
Git Basics
 
Intro to Kernel Debugging - Just make the crashing stop!
Intro to Kernel Debugging - Just make the crashing stop!Intro to Kernel Debugging - Just make the crashing stop!
Intro to Kernel Debugging - Just make the crashing stop!
 
Helpful pre commit hooks for Python and Django
Helpful pre commit hooks for Python and DjangoHelpful pre commit hooks for Python and Django
Helpful pre commit hooks for Python and Django
 
Life of a Chromium Developer
Life of a Chromium DeveloperLife of a Chromium Developer
Life of a Chromium Developer
 
Embedding Qt
Embedding QtEmbedding Qt
Embedding Qt
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with server
 
Os dev tool box
Os dev tool boxOs dev tool box
Os dev tool box
 
Module 4_WorkinUnixLinuxCommandAndKeepDoing
Module 4_WorkinUnixLinuxCommandAndKeepDoingModule 4_WorkinUnixLinuxCommandAndKeepDoing
Module 4_WorkinUnixLinuxCommandAndKeepDoing
 
Lessons Learned: Using Concourse In Production
Lessons Learned: Using Concourse In ProductionLessons Learned: Using Concourse In Production
Lessons Learned: Using Concourse In Production
 
LMG Lightning Talks - SFO17-205
LMG Lightning Talks - SFO17-205LMG Lightning Talks - SFO17-205
LMG Lightning Talks - SFO17-205
 
Let's talk about neovim
Let's talk about neovimLet's talk about neovim
Let's talk about neovim
 
Rejekts 24 EU No GitOps Pain, No Platform Gain
Rejekts 24 EU No GitOps Pain, No Platform GainRejekts 24 EU No GitOps Pain, No Platform Gain
Rejekts 24 EU No GitOps Pain, No Platform Gain
 
.NET Applications & Cloud Meetup at 7 Peaks
.NET Applications & Cloud Meetup at 7 Peaks.NET Applications & Cloud Meetup at 7 Peaks
.NET Applications & Cloud Meetup at 7 Peaks
 
Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024
 
3DC Intro to Git Workshop
3DC Intro to Git Workshop3DC Intro to Git Workshop
3DC Intro to Git Workshop
 
Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...
Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...
Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...
 
LinuxKit Deep Dive
LinuxKit Deep DiveLinuxKit Deep Dive
LinuxKit Deep Dive
 

Recently uploaded

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 

Recently uploaded (20)

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

How to Write Patches for Vim and Become a Patch Meister

  • 1. How to write patches for Vim – Be a patch meister – VimConf 2013 2013-11-16 K.Takata 1
  • 2. 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 K.T I sometimes use cursor keys :-) ● Merged patches: About 75 patches (since 7.3.668) 2
  • 3. Contents ● How to write patches – – Join the communities – Get the latest source code – Explore the Vim's source code – Write patches – Share your patches – ● Tools Categories of my patches My favorite patches – Merged patches – Undergoing patches 3
  • 4. 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. 4
  • 5. Join the communities ● vim_dev: Vim developers maillist https://groups.google.com/forum/#!forum/vim_dev ● vim-jp: Japanese Vim community Top page: http://vim-jp.org/ Issue tracker: https://github.com/vim-jp/issues/issues – If 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. 5
  • 6. Get the latest source code ● Vim from Mercurial: http://www.vim.org/mercurial.php $ hg clone https://vim.googlecode.com/hg/ vim ● Build on Windows and Linux (Japanese): http://vim-jp.org/docs/build_windows_msvc.html http://vim-jp.org/docs/build_windows_mingw.html http://vim-jp.org/docs/build_linux.html (Please someone write a page for MacOS X.) 6
  • 7. 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 files mbyte.c multi-byte character handling option.c options screen.c updating the windows gui*.c GUI if_*.c interface to other languages (python, etc.) and tools os_*.c OS depended codes proto/*.pro prototypes generated by cproto 7
  • 8. Explore the Vim's source code ● Use tag jump with Exuberant Ctags: $ cd src $ ctags -R Open a source file with Vim and move the cursor to a symbol, then type Ctrl-]. For detail: :help tag :help window-tag :help -t ● If you install Emacs on Ubuntu, ctags may become a symlink to etags. To fix this, use the following command: $ sudo update-alternatives --config ctags A menu will be shown, then select ctags-exuberant. 8
  • 9. Write patches You should see: :help coding-style :help development After writing comments or documents, use spell checker: :set spell For detail: :help spell ● 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 9
  • 10. 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 ? $ hg qclone https://vim.googlecode.com/hg/ -p https://bitbucket.org/k_takata/vim-ktakata-mq vim $ cd vim $ hg qpush -a $ make ● To get the latest source code and patches when they are updated: $ hg qpop -a && hg pull -u && hg pull -u --mq && hg qpush -a 10
  • 11. 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! < 11
  • 12. My favorite patches ● Part 1: Merged patches – – symlinkfix – ● Cygwin clipboard spelllang-cjk Part 2: Undergoing patches – DirectWrite – breakindent 12
  • 13. Cygwin clipboard (7.3.836) https://groups.google.com/d/topic/vim_dev/UpMljHBa77w/discussio Authors: Frodak Baksik, Anton Sharonov and K.Takata Platform: Cygwin The first version backs to 2007. Cygwin Vim didn't support Win32 clipboard. You had to install the fakeclip plugin by Kana Natsuno. Now you can use Win32 clipboard without any plugins. 13
  • 14. symlinkfix (7.3.1182) https://github.com/vim-jp/issues/issues/241 Authors: David Pope and K.Takata Platform: Windows Windows Vista and later support symlinks but Vim didn't support them when :set backup backupcopy=auto. (Symlinks became normal files after editing.) The original patch didn't support multibyte filenames, so I fixed it. This was my first patch for the main part of Vim. (I already sent some patches for runtime files.) It took about a year to be merged. This patch had a bug and the fix was merged as 7.3.1210. It took only 15 minutes!!! 14
  • 15. 7.4.088 (spelllang-cjk) https://github.com/vim-jp/issues/issues/476 Author: K.Takata Platform: All This patch was merged this week! When :set spelllang=en,cjk, CJK characters are excluded from spell checking. 15
  • 17. DirectWrite https://github.com/vim-jp/issues/issues/262 https://github.com/vim-jp/issues/issues/337 Authors: MURAOKA Taro and K.Takata Platform: Windows Better text rendering using DirectWrite. :set renderoptions=type:directx 17
  • 18. breakindent https://github.com/vim-jp/issues/issues/114 https://retracile.net/wiki/VimBreakIndent Authors: Many authors Platform: All When :set breakindent, every wrapped line will continue visually indented. The first patch was written by Václav Šmilauer in 2004. I updated the patch for 7.4, and also fixed one FIXME. TODO: – There are still some FIXMEs in screen.c. – No test case. 18
  • 20. Conclusions ● Build your own Vim. ● Any kind of patch is welcome. Don't be afraid. ● Find your favorite patch and improve it. 20