If you want to help but don't know where to start, here are some low-risk/isolated tasks:
runtime/
).nvim --clean
("factory defaults").:edit $NVIM_LOG_FILE
cmake --system-information
for build-related issues.ninja
for faster builds of Nvim.
sudo apt-get install ninja-build
make distclean
make # Nvim build system uses ninja automatically, if available.
master
into your PR when there are conflicts or when master
introduces breaking changes.For maintainers: when a PR is ready to merge to master,
Pull requests have two stages: Draft and Ready for review.
Do not add labels like [RFC]
or [WIP]
in the title to indicate the
state of your PR: this just adds noise. Non-Draft PRs are assumed to be open
for comments; if you want feedback from specific people, @
-mention them in
a comment.
Follow the conventional commits guidelines to make reviews easier and to make the VCS/git logs more valuable. The general structure of a commit message is:
<type>([optional scope]): <description>
[optional body]
[optional footer(s)]
build
, ci
, docs
, feat
, fix
, perf
, refactor
, revert
, test
, vim-patch
, dist
(lsp)
, (treesitter)
, (float)
, …Breaking API changes must be indicated by
BREAKING CHANGE: refactor to use Python 3 features since Python 2 is no longer supported. ```
Each pull request must pass the automated builds on Cirrus CI and GitHub Actions.
-Werror
, so compiler warnings
will fail the build.VALGRIND=1 make test
CC=clang make CMAKE_FLAGS="-DCLANG_ASAN_UBSAN=ON"
View the Clang report to see potential bugs found by the Clang scan-build analyzer.
git log --oneline --no-merges --grep clang
scan-build
like this:
rm -rf build/
scan-build --use-analyzer=/usr/bin/clang make
View the PVS report to see potential bugs found by PVS Studio.
{id}
is the PVS warning-id)):
fix(PVS/V{id}): {description}
git log --oneline --no-merges --grep PVS
./scripts/pvscheck.sh
to run PVS locally.Coverity runs against the master build. To view the defects, just request access; you will be approved.
{id}
is the CID (Coverity ID);
(example)):
fix(coverity/{id}): {description}
git log --oneline --no-merges --grep coverity
ASAN/UBSAN can be used to detect memory errors and other common forms of undefined behavior at runtime in debug builds.
rm -rf build && CMAKE_EXTRA_FLAGS="-DCMAKE_C_COMPILER=clang -DCLANG_ASAN_UBSAN=1" make
UBSAN_OPTIONS=print_stacktrace=1 ASAN_OPTIONS=log_path=/tmp/nvim_asan nvim args...
/tmp/nvim_asan.{PID}
(or your preferred log_path
) for log files with error messages.You can run the linter locally by:
make lint
The lint step downloads the master error list and excludes them, so only lint errors related to the local changes are reported.
You can lint a single file (but this will not exclude legacy errors):
./src/clint.py src/nvim/ops.c
make format
This will format changed Lua and C files with all appropriate flags set.src/uncrustify.cfg
which tries to match
the style-guide. To use the Nvim gq
command with uncrustify
:
if !empty(findfile('src/uncrustify.cfg', ';'))
setlocal formatprg=uncrustify\ -q\ -l\ C\ -c\ src/uncrustify.cfg\ --no-backup
endif
The required version of uncrustify
is specified in uncrustify.cfg
..clang-format
which has drifted from the style-guide, but
is available for reference. To use the Nvim gq
command with clang-format
:
if !empty(findfile('.clang-format', ';'))
setlocal formatprg=clang-format\ -style=file
endif
Set blame.ignoreRevsFile
to ignore noise commits in git blame:
git config blame.ignoreRevsFile .git-blame-ignore-revs
Recommendation is to use clangd. Can use the maintained config in nvim-lspconfig/clangd.
Explore the source code on the web.
If using lua-language-server, symlink contrib/luarc.json
into the
project root:
$ ln -s contrib/luarc.json .luarc.json
For managing includes in C files, use include-what-you-use.
make CMAKE_EXTRA_FLAGS=-DCMAKE_C_INCLUDE_WHAT_YOU_USE=include-what-you-use | tee iwyu.txt
See #549 for more details.
Many parts of the :help
documentation are autogenerated from C or Lua docstrings using the ./scripts/gen_vimdoc.py
script.
You can filter the regeneration based on the target (api, lua, or lsp), or the file you changed, that need a doc refresh using ./scripts/gen_vimdoc.py -t <target>
.
Lua documentation uses a subset of EmmyLua annotations. A rough outline of a function documentation is
--- {Brief}
---
--- {Long explanation}
---
---@param arg1 type {description}
---@param arg2 type {description}
{...}
---
---@return type {description}
If possible, always add type information (table
, string
, number
, ...). Multiple valid types are separated by a bar (string|table
). Indicate optional parameters via type|nil
.
If a function in your Lua module should not be documented (e.g. internal function or local function), you should set the doc comment to:
---@private
Mark functions that are deprecated as
---@deprecated
To help review pull requests, start with this checklist.
Reviewing can be done on GitHub, but you may find it easier to do locally. Using GitHub CLI, you can create a new branch with the contents of a pull request, e.g. #1820:
gh pr checkout https://github.com/neovim/neovim/pull/1820
Use git log -p master..FETCH_HEAD
to list all
commits in the feature branch which aren't in the master
branch; -p
shows each commit's diff. To show the whole surrounding function of a change
as context, use the -W
argument as well.