Home Explore Blog CI



neovim

1st chunk of `runtime/doc/dev_vimpatch.txt`
61b79ede7a27b8f8061386b89dd2ab730f1b866571b7ce120000000100000fb3
*dev_vimpatch.txt*          Nvim

                            NVIM REFERENCE MANUAL

Merging patches from Vim                                    *dev-vimpatch*


Nvim was forked from Vim 7.4.160; it is kept up-to-date with relevant Vim
patches in order to avoid duplicate work. Run `vim-patch.sh`
https://github.com/neovim/neovim/blob/master/scripts/vim-patch.sh to see the
status of Vim patches:
>bash
    ./scripts/vim-patch.sh -l
<
Everyone is welcome to |dev-vimpatch-pull-requests| for relevant Vim
patches, but some types of patches are |dev-vimpatch-not-applicable|.
See |dev-vimpatch-quickstart| to get started immediately.


                                         Type |gO| to see the table of contents.

==============================================================================
QUICKSTART                                        *dev-vimpatch-quickstart*

1. Pull the Nvim source:
>bash
    git clone https://github.com/neovim/neovim.git
<
2. Run `./scripts/vim-patch.sh -l` to see the list of missing Vim patches.

3. Choose a patch from the list (usually the oldest one), e.g. `8.0.0123`.

   - Check for open vim-patch PRs
     https://github.com/neovim/neovim/pulls?q=is%3Apr+is%3Aopen+label%3Avim-patch.

4. Run `./scripts/vim-patch.sh -p 8.0.0123`

5. Follow the instructions given by the script.

NOTES ~

- It's strongly recommended to work on the oldest missing patch, because
  later patches might depend on the changes.
- Use `git log --grep` or `git log -G` to search the Nvim/Vim source history
  (even deleted code). E.g. to find `reset_option_was_set`: >bash

    git log -p -G reset_option_was_set
<
- Pass `git log` options like `--grep` and `-G` to `./scripts/vim-patch.sh -L`
  to filter unmerged Vim patches E.g. to find `+quickfix` patches: >bash

    ./scripts/vim-patch.sh -L --grep quickfix -- src
<
==============================================================================
PULL REQUESTS                                  *dev-vimpatch-pull-requests*

Note: vim-patch.sh automates these steps for you. Use it!

- Install `gh` (https://cli.github.com/) if you want to use `vim-patch.sh` to
  create PRs automatically
- The pull request title should include `vim-patch:8.x.xxxx` (no whitespace)
- The commit message
  https://github.com/neovim/neovim/commit/4ccf1125ff569eccfc34abc4ad794044c5ab7455
  should include:
    - A token indicating the Vim patch number, formatted as follows:
      `vim-patch:8.0.0123` (no whitespace)
    - A URL pointing to the Vim commit:
      https://github.com/vim/vim/commit/c8020ee825b9d9196b1329c0e097424576fc9b3a
    - The original Vim commit message, including author

Reviewers: hint for reviewing `runtime/` patches
https://github.com/neovim/neovim/pull/1744#issuecomment-68202876

==============================================================================
NA (NOT APPLICABLE) PATCHES                    *dev-vimpatch-not-applicable*

Many Vim patches are not applicable to Nvim. If you find NA patches, visit an
open "version.c: update" pull request
https://github.com/neovim/neovim/pulls?q=is%3Apr+author%3Aapp%2Fgithub-actions+version.c+is%3Aopen
and mention the NA patches in a comment (please edit/update one comment,
rather than adding a new comment for each patch).

If there are no open `version.c: update` pull requests, include NA patches in
a commit message in the following format:
>
    vim-patch:<version-or-commit>
    vim-patch:<version-or-commit>
    ...
<
where `<version-or-commit>` is a valid Vim version (like `8.0.0123`) or
commit-id (SHA). Each patch is on a separate line.

It is preferred to include NA patches by squashing it in applicable Vim
patches, especially if the Vim patches are related. First line of the commit
message should be from the applicable Vim patch.
>
    ./scripts/vim-patch -p <na-patch>
    ./scripts/vim-patch -p <na-patch>
    ...
    ./scripts/vim-patch -P <patch>
    git rebase -i master
<
Example:
https://github.com/neovim/neovim/commit/00f60c2ce78fc1280e93d5a36bc7b2267d5f4ac6

Title: Merging Patches from Vim to Nvim
Summary
This section of the Nvim reference manual explains how to merge relevant patches from Vim into Nvim to avoid duplicating work. It provides a quickstart guide, explains how to create pull requests for Vim patches, and describes how to handle patches that are not applicable to Nvim. The `vim-patch.sh` script is a key tool for automating these tasks.