Compare commits

..

5 Commits

Author SHA1 Message Date
7d6aa82b69 NVIM v0.4.2
This is a "stub" release to fix release automation.

Release notes: e2cc5fe09d

FIXES:

6c65f8f182 CI/AppVeyor: revert whitelist
2019-09-15 19:36:35 -07:00
6c65f8f182 CI/AppVeyor: revert whitelist
revert 6b028ec5f2 #10746

This seems to skip tags also, which breaks our release automation.
From the AppVeyor logs:

    2019-09-15 17:25:00.232 Warning Commit "1f76c4af" of branch "master" skipped as commit message contains either "[skip ci]" or "[ci skip]" or "[skip appveyor]"
    2019-09-15 17:20:24.152 Warning Commit "baa5263b" skipped as branch "stable" is not in white-list
    2019-09-15 17:20:03.163 Warning Commit "6cb5ffc0" skipped as branch "release-0.4" is not in white-list
    2019-09-15 17:20:02.977 Warning Commit "baa5263b" skipped as branch "v0.4.1" is not in white-list
    2019-09-15 16:35:38.810 Warning Commit "31956372" of branch "master" skipped as commit message contains either "[skip ci]" or "[ci skip]" or "[skip appveyor]"
    2019-09-15 16:28:35.237 Warning Commit "e2cc5fe0" skipped as branch "stable" is not in white-list
    2019-09-15 16:28:17.814 Information Build version 31489 created
    2019-09-15 16:28:16.364 Warning Commit "e2cc5fe0" skipped as branch "v0.4.0" is not in white-list
2019-09-15 17:39:07 -07:00
6cb5ffc075 version bump 2019-09-15 17:12:50 -07:00
baa5263b56 NVIM v0.4.1
FIXES:

2abdb89522 fix failed release: regenerate the *.mpack file
2019-09-15 17:11:39 -07:00
2abdb89522 fix failed release: regenerate the *.mpack file
Set NVIM_API_PRERELEASE=true to regenerate the *.mpack file, because it
was generated from an old binary accidentally, which caused the release
to fail:

    test/functional\api\version_spec.lua:133: Expected objects to be the same.
    Passed in:
    (table: 0x0c6175a8) {
      [method] = false
      [name] = 'nvim_get_context'
     *[parameters] = {
       *[1] = {
         *[1] = 'Dictionary'
          [2] = '' } }
      [return_type] = 'Dictionary'
      [since] = 6 }
    Expected:
    (table: 0x0c6cd2d0) {
      [method] = false
      [name] = 'nvim_get_context'
     *[parameters] = {
       *[1] = {
         *[1] = 'Array'
          [2] = '' } }
      [return_type] = 'Dictionary'
      [since] = 6 }
    stack traceback:
        test/functional\api\version_spec.lua:133: in function <test/functional\api\version_spec.lua:122>
2019-09-15 17:10:16 -07:00
3572 changed files with 432375 additions and 927203 deletions

41
.builds/openbsd.yml Normal file
View File

@ -0,0 +1,41 @@
# sourcehut CI: https://builds.sr.ht/~jmk/neovim
image: openbsd/6.5
packages:
- autoconf-2.69p2
- automake-1.15.1
- cmake
- gettext-0.19.8.1p3
- gettext-tools-0.19.8.1
- gmake
- libtool
- ninja-1.8.2p0
- unzip-6.0p11
sources:
- https://github.com/neovim/neovim
tasks:
- build: |
export AUTOCONF_VERSION=2.69
export AUTOMAKE_VERSION=1.15
cd neovim
mkdir .deps
cd .deps
cmake -G Ninja ../third-party/
cmake --build . --config Debug
cd ..
mkdir build
cd build
cmake -G Ninja -DMIN_LOG_LEVEL=3 ..
cmake --build . --config Debug
./bin/nvim --version
- test: |
export LC_CTYPE=en_US.UTF-8
# functional tests
cd neovim/build
# cmake --build . --config Debug --target functionaltest
# oldtests
cd ..
gmake oldtest

View File

@ -1,27 +0,0 @@
env:
CIRRUS_CLONE_DEPTH: '2'
LANG: en_US.UTF-8
freebsd_task:
name: FreeBSD
only_if: $BRANCH != "master"
freebsd_instance:
image_family: freebsd-14-2
timeout_in: 30m
install_script:
- pkg install -y cmake gmake ninja unzip wget gettext python git
build_deps_script:
- gmake deps
build_script:
- gmake CMAKE_EXTRA_FLAGS="-DCI_BUILD=ON" nvim
workaround_script:
# Run tests as user "cirrus" instead of root. This is required for the
# permission-related tests to work correctly.
- pw useradd cirrus -m
- chown -R cirrus:cirrus .
functionaltest_script:
- sudo -u cirrus gmake functionaltest
unittest_script:
- sudo -u cirrus gmake unittest
oldtest_script:
- sudo -u cirrus gmake oldtest

View File

@ -1,11 +1,11 @@
BasedOnStyle: Google
Language: Cpp
ColumnLimit: 100
ColumnLimit: 80
IndentWidth: 2
TabWidth: 8
TabWidth: 2
UseTab: Never
IndentCaseLabels: false
BreakBeforeBraces: Custom
IndentCaseLabels: true
BreakBeforeBraces: Linux
AlignEscapedNewlinesLeft: false
AllowShortFunctionsOnASingleLine: false
AlignTrailingComments: true
@ -14,54 +14,7 @@ PenaltyReturnTypeOnItsOwnLine: 200
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
BinPackParameters: true
BinPackParameters: false
BreakBeforeBinaryOperators: true
BreakBeforeTernaryOperators: true
ContinuationIndentWidth: 2
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: No
AlwaysBreakTemplateDeclarations: No
AlignEscapedNewlines: DontAlign
BinPackArguments: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
PointerAlignment: Right
SortIncludes: true
Cpp11BracedListStyle: false
IncludeCategories:
- Regex: '<[/[:alnum:].]+>'
Priority: 0
- Regex: '^"(nvim|vim)/'
Priority: 1
SortPriority: 1
CaseSensitive: false
AlignConsecutiveMacros: AcrossEmptyLines
IndentPPDirectives: AfterHash
SpaceBeforeParens: ControlStatementsExceptControlMacros
PPIndentWidth: 1
ForEachMacros:
- FOR_ALL_AUEVENTS
- FOR_ALL_AUPATS_IN_EVENT
- FOR_ALL_BUFFERS
- FOR_ALL_BUFFERS_BACKWARDS
- FOR_ALL_FRAMES
- FOR_ALL_QFL_ITEMS
- FOR_ALL_SIGNS_IN_BUF
- FOR_ALL_TABS
- FOR_ALL_TAB_WINDOWS
- FOR_ALL_WINDOWS_IN_TAB
- RBUFFER_EACH
- RBUFFER_EACH_REVERSE
- RBUFFER_UNTIL_EMPTY
- RBUFFER_UNTIL_FULL
- kl_iter
ContinuationIndentWidth: 4

View File

@ -1,81 +0,0 @@
WarningsAsErrors: '*,-clang-diagnostic-unused-function'
Checks: >
Enable all warnings by default. This ensures we don't miss new and useful
warnings when a new version of clang-tidy is dropped.
IMPORTANT
clang-tidy doesn't support comments but we can simulate comments by just
writing text directly here. These are then interpreted as warnings and will
be dropped. As long as you start every sentence with a capital letter and
don't use commas in your "comments" you should be fine,
*,
Untriaged warnings. Please categorize them accordingly if you find a relevant
section for it,
-bugprone-assignment-in-if-condition,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-multi-level-implicit-pointer-conversion,
-bugprone-not-null-terminated-result,
-bugprone-suspicious-memory-comparison,
-bugprone-switch-missing-default-case,
-bugprone-tagged-union-member-count,
-cert-env33-c,
-cert-err33-c,
-cert-err34-c,
-concurrency-mt-unsafe,
-cppcoreguidelines-narrowing-conversions,
Warnings that may be useful, but are too inconsistent to enable by default
May yield useful results with some manual triaging,
-bugprone-branch-clone,
-bugprone-macro-parentheses,
-bugprone-sizeof-expression,
-hicpp-multiway-paths-covered,
-hicpp-signed-bitwise,
-misc-unused-parameters,
-modernize-macro-to-enum,
-readability-avoid-nested-conditional-operator,
-readability-else-after-return,
-readability-enum-initial-value,
-readability-function-size,
-readability-isolate-declaration,
Warnings that are rarely useful,
-altera-*, Checks related to OpenCL programming for FPGAs. Not relevant,
-android-*,
-bugprone-easily-swappable-parameters,
-bugprone-inc-dec-in-conditions,
-bugprone-swapped-arguments,
-clang-analyzer-*, Already covered by the cmake target "clang-analyzer",
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-init-variables,
-llvm-header-guard, We use #pragma once,
-llvmlibc-restrict-system-libc-headers, We want to use glibc,
-misc-include-cleaner, Looks useful but redundant with IWYU. We may replace IWYU with this one day,
-misc-misplaced-const,
-misc-no-recursion,
-performance-no-int-to-ptr,
-readability-function-cognitive-complexity,
-readability-identifier-length,
-readability-magic-numbers,
-readability-math-missing-parentheses,
-readability-redundant-declaration, Conflicts with our header generation scripts,
-readability-suspicious-call-argument,
Aliases. These are just duplicates of other warnings and should always be ignored,
-bugprone-narrowing-conversions,
-cert-arr39-c,
-cert-dcl37-c,
-cert-dcl51-cpp,
-cert-exp42-c,
-cert-flp37-c,
-cert-int09-c,
-cert-msc24-c,
-cert-msc33-c,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-macro-to-enum,
-google-readability-braces-around-statements,
-google-readability-function-size,
-hicpp-braces-around-statements,
-hicpp-function-size,
-llvm-else-after-return,

View File

@ -1,4 +0,0 @@
CompileFlags:
CompilationDatabase: build/ # Search build/ directory for compile_commands.json
Diagnostics:
UnusedIncludes: None

View File

@ -6,16 +6,8 @@ indent_size = 2
tab_width = 8
end_of_line = lf
insert_final_newline = true
charset = utf-8
[*.{c,h,in,lua}]
max_line_length = 100
[src/nvim/{eval,vvars}.lua]
max_line_length = 68
[*.py]
indent_size = 4
[{Makefile,**/Makefile,*.mk,runtime/doc/*.txt}]
[{Makefile,**/Makefile,runtime/doc/*.txt}]
indent_style = tab
indent_size = 8

View File

@ -1,14 +0,0 @@
{
"diagnostics" : {
"disable" : [
"unnecessary-if"
]
},
"codeAction": {
"insertSpace": true
},
"strict": {
"typeCall": true,
"arrayIndex": true
}
}

2
.flake8 Normal file
View File

@ -0,0 +1,2 @@
[flake8]
max-line-length = 88

View File

@ -1,86 +0,0 @@
# To use this file (requires git 2.23):
# git config blame.ignoreRevsFile .git-blame-ignore-revs
# eval.c: factor out eval/funcs.c #11828
# - This is a move/rename. git 2.33 doesn't know how to ignore it.
# It is here anyway, (1) in case git improves later, and (2) to
# save you the trouble of attempting this.
6c5bbf07d988ef55e5e8ba8d70b62c1f0885261b
# symbol renames
6186df3562e33e92f04ed8c850204ceabc4746e1
# style (uncrustify, etc.)
2d240024acbd68c2d3f82bc72cb12b1a4928c6bf
61178778230e609d68b271ffd53ffd993cd23c42
15af08ad176339d1f269ce264bb0efea283c9536
47f99d66440ae8be26b34531989ac61edc1ad9fe
1e49a1c888a3d9a581f4aa409a26ada3ac2417cb
3b3dbcf7b7ba5466e6ab643e256f2374b520a6b2
e8067d1490a31ff76143d576dc9948b4f09c6c55
d5b66e88601b4d2fde5d905f9d12847126ba4449
07715044887d82f74254e64c4c32fa49b0501bea
6ed43f8f1caad702f9590d174c5ec142f3d85b18
0a83017fe95df0290adb98ec6bf457b96a3fab17
867e8885991ae450019c18aa5e42546bd4b62c2c
1f49268c46fcbe65f7e2e2cb620e6f51c059cf9e
51a98aa0c2fe3231a0ffc8a78189bc6fafd6abf6
853346a94d6aa78c97314a3b217fb5a5408a47f1
30fefee684e641a0c6867446c6de30efa2f0a126
f4ca3a29ddcb0c98e8e09c45a6342af709f8cc45
48e67b229415b4e2b3315bd00b817e5f9ab970c8
7a26eb8a567cbc831d4f629f9eccb767a44436b8
2f9b9e61d7417183f2d9f36d804247c0926be9d4
c0767bd4f3ce7b34bb77da0657c49ba10ba1b32e
d90fb1c0bfc1e64c783c385a79e7de87013dadba
9c268263b1792d00b3ffdfd7495af2575862656e
8c74c895b300bcee5fa937a2329d1d4756567b42
40be47e0faef7aa015eb4ba44ceb1ee1a03e97cf
4472c56d54f447040f6e8610b261b7efa0d04eb6
a68faed02dc8e37b8f10da14dc02e33e6ed93947
725cbe7d414f609e769081276f2a034e32a4337b
7e3bdc75e44b9139d8afaea4381b53ae78b15746
4ba12b3dda34472c193c9fa8ffd7d3bd5b6c04d6
849f104c2789c884428fd45501912c6591a78e12
38dd53c525054daf83dba27d7d46e90e8b41fa50
6059784770c4c88fb6fe528b9f7634192fa1164e
ee031eb5256bb83e0d6add2bae6fd943a4186ffe
69e11b58b4db0952f11a5ff85aa7150b5f5b8db8
271bb32855853b011fceaf0ad2f829bce66b2a19
aefdc6783cb77f09786542c90901a9e7120bea42
aa4f9c5341f5280f16cce0630ea54b84eef717b3
0adc66171a355a12494d87ebb767d509540c7ef9
93f24403f8cc760ff47979c596976b53a8b16358
1ffd527c837fb2465c9659273bbe5447a1352db2
2498e9feb025361576603a0101c86393d211e31e
0b3ae64480ea28bb57783c2269a61f0a60ffc55e
0fc8597f011e0927e529abd11bf0ddd8d0d1eaab
6ff245732a5a8ab821598a38fb0c5805e6bd3779
abf758a2977c4e6cab4dfa217f56da853d85851c
cb84f5ee530f0f32b92bed5b4ad41344e8b551aa
f98b8d2d44d289263b1a3b33b6a7f20644ef671c
544ef994df72c3cbe0dca6b856ce2dcbc5169767
45fe4d11add933df76a2ea4bf52ce8904f4a778b
517f0cc634b985057da5b95cf4ad659ee456a77e
04f2f864e270e772c6326cefdf24947f0130e492
# typos
d238b8f6003d34cae7f65ff7585b48a2cd9449fb
4547137aaff32b20172870a549d3a28a3c7adf1c
08616571f47cc367a5fe59b52295708b9fda3b09
09c6ce8c4e4c6415cca9b834539ed0df461373f6
0b0c4f7dfa4a9a564cbf44262d4bea9bdefe2dc9
4a96e7809f4d9f6ce21869817eb95ff6dcaa1693
61205c1defb64ac5466496b5451e4a7f3171e21e
64116d78502e0ca611e13adf9323ef2d3fe708c2
abc087f4c65ca547cae58518b42aee82ff4a07f6
b8dcbcc732baf84fc48d6b272c3ade0bcb129b3b
c815aadfccd6bada47ecfb09fe188ee7f7c5caf3
caa6992a1071a2ac373bec21085685da4a1790d6
df646572c53f55268a5dbb61628d7c3b302d5663
e63e5d1dbd3dd4711efa0ecf9e844ff308b370a6
eb123b565e201418dd135d2602dc20eea3cead39
ff20d40321399fa187bd350f9619cf6418d7eb6e
# generated docs
ea333badd24f691c753d8048f911d1db349bc2cd

19
.gitattributes vendored Normal file → Executable file
View File

@ -1,18 +1 @@
*.h.in linguist-language=C
*.c.in linguist-language=C
*CMakeLists.txt linguist-language=CMake
runtime/doc/* linguist-documentation
runtime/doc/builtin.txt linguist-generated
runtime/lua/vim/_meta/vimfn.lua linguist-generated
runtime/lua/vim/_meta/vvars.lua linguist-generated
runtime/lua/vim/_meta/api.lua linguist-generated
runtime/lua/vim/_meta/api_keysets.lua linguist-generated
runtime/lua/vim/_meta/options.lua linguist-generated
src/xdiff/** linguist-vendored
src/cjson/** linguist-vendored
src/unicode/** linguist-vendored
.github/ export-ignore
*.h linguist-language=C

3
.github/FUNDING.yml vendored
View File

@ -1,2 +1 @@
github: neovim
open_collective: neovim
custom: https://salt.bountysource.com/teams/neovim

29
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,29 @@
---
name: Bug report
about: Report a problem in Nvim
title: ''
labels: bug
---
<!-- Before reporting: search existing issues and check the FAQ. -->
- `nvim --version`:
- `vim -u DEFAULTS` (version: ) behaves differently?
- Operating system/version:
- Terminal name/version:
- `$TERM`:
### Steps to reproduce using `nvim -u NORC`
```
nvim -u NORC
# Alternative for shell-related problems:
# env -i TERM=ansi-256color "$(which nvim)"
```
### Actual behaviour
### Expected behaviour

View File

@ -1,82 +0,0 @@
name: Bug Report
description: Report a problem in Nvim
type: 'bug'
body:
- type: markdown
attributes:
value: |
*Before reporting:*
- Confirm the problem is reproducible on [**master**](https://github.com/neovim/neovim/releases/nightly) or [**latest stable**](https://github.com/neovim/neovim/releases/stable) release
- Run `make distclean` when encountering build issues
- Search [existing issues](https://github.com/neovim/neovim/issues?q=is%3Aissue+is%3Aopen+label%3Abug,bug-crash) (including [closed](https://github.com/neovim/neovim/issues?q=is%3Aissue+is%3Aclosed+label%3Abug%2Cbug-crash))
- Read the [FAQ](https://neovim.io/doc/user/faq.html) and ["Reporting Problems" in CONTRIBUTING.md](https://github.com/neovim/neovim/blob/master/CONTRIBUTING.md#reporting-problems).
Usage or "How to" questions belong on [stackoverflow](https://vi.stackexchange.com/) and will be closed.
- type: textarea
attributes:
label: "Problem"
description: "Describe the current behavior. May include logs, images, or videos."
validations:
required: true
- type: textarea
attributes:
label: "Steps to reproduce"
description: |
- For build failures: list the exact steps including CMake flags (if any).
- If the bug pertains to crashing (or segfault), please include a [stacktrace](https://neovim.io/doc/user/dev_tools.html#dev-tools-backtrace).
- For startup or shell-related problems: try `env -i TERM=ansi-256color "$(which nvim)"`.
- Use the provided [minimal reproduction template](https://github.com/neovim/neovim/blob/master/contrib/minimal.lua) to create a minimal configuration. After you fill it out with necessary information, run with `nvim --clean -u minimal.lua`.
- Please do **not** include a package manager in the reproduction steps.
placeholder: |
nvim --clean
:edit foo
yiwp
validations:
required: true
- type: textarea
attributes:
label: "Expected behavior"
description: "Describe the behavior you expect."
validations:
required: true
- type: input
attributes:
label: "Nvim version (nvim -v)"
placeholder: "0.6.0 commit db1b0ee3b30f"
validations:
required: true
- type: input
attributes:
label: "Vim (not Nvim) behaves the same?"
description: "Does `vim -u DEFAULTS` have the same issue? Note the exact Vim version (`8.x.yyyy`)."
placeholder: "no, vim 7.3.432"
validations:
required: true
- type: input
attributes:
label: "Operating system/version"
placeholder: "macOS 11.5"
validations:
required: true
- type: input
attributes:
label: "Terminal name/version"
placeholder: "xterm 3.1"
validations:
required: true
- type: input
attributes:
label: "$TERM environment variable"
placeholder: "xterm-256color"
validations:
required: true
- type: input
attributes:
label: "Installation"
description: "How did you install neovim: build from repo / system package manager / appimage / homebrew / snap / chocolatey / other (describe)?"
placeholder: "Arch User Repository (AUR)"
validations:
required: true

View File

@ -1,5 +0,0 @@
blank_issues_enabled: false
contact_links:
- name: Question
url: https://github.com/neovim/neovim/discussions
about: Ask about configuration and usage of Nvim

View File

@ -0,0 +1,27 @@
---
name: Feature request
about: Request an enhancement for Nvim
title: ''
labels: enhancement
---
<!-- Before reporting: search existing issues and check the FAQ. -->
- `nvim --version`:
- `vim -u DEFAULTS` (version: ) behaves differently?
- Operating system/version:
- Terminal name/version:
- `$TERM`:
### Steps to reproduce using `nvim -u NORC`
```
nvim -u NORC
```
### Actual behaviour
### Expected behaviour

View File

@ -1,24 +0,0 @@
name: Feature request
description: Request an enhancement for Nvim
type: 'enhancement'
body:
- type: markdown
attributes:
value: |
Before requesting: search [existing feature requests](https://github.com/neovim/neovim/labels/enhancement) and check the [FAQ](https://neovim.io/doc/user/faq.html).
- type: textarea
attributes:
label: "Problem"
description: "Describe the problem to be solved. Include references to other projects (Vim, Emacs, etc.) if relevant."
placeholder: "No smurf icons available. Smurfs are useful because ..."
validations:
required: true
- type: textarea
attributes:
label: "Expected behavior"
description: "Describe what the new feature or behavior would look like. How does it solve the problem? Is it worth the cost?"
validations:
required: true

View File

@ -1,88 +0,0 @@
name: Language server (LSP) client bug
description: Report an issue with Nvim LSP
title: "LSP: "
type: bug
labels: [lsp]
body:
- type: markdown
attributes:
value: |
_Before reporting:_ search [existing issues](https://github.com/neovim/neovim/issues?q=is%3Aissue+is%3Aopen+label%3Abug) and check the [FAQ](https://neovim.io/doc/user/faq.html). Usage questions or "Why isn't X language server/feature working?" belong on [stackoverflow](https://vi.stackexchange.com/) and will be closed.
- type: textarea
attributes:
label: "Problem"
description: "Describe the bug caused by the Nvim LSP client."
validations:
required: true
- type: textarea
attributes:
label: 'Steps to reproduce using "nvim -u minimal_init.lua"'
description: |
- Create a minimal_init.lua using vim.lsp.start:
```lua
--- CHANGE THESE
local pattern = 'the-filetype'
local cmd = {'name-of-language-server-executable'}
-- Add files/folders here that indicate the root of a project
local root_markers = {'.git', '.editorconfig'}
-- Change to table with settings if required
local settings = vim.empty_dict()
vim.api.nvim_create_autocmd('FileType', {
pattern = pattern,
callback = function(args)
local match = vim.fs.find(root_markers, { path = args.file, upward = true })[1]
local root_dir = match and vim.fn.fnamemodify(match, ':p:h') or nil
vim.lsp.start({
name = 'bugged-ls',
cmd = cmd,
root_dir = root_dir,
settings = settings
})
end
})
```
See `:h lsp-quickstart` and `:h vim.lsp.start` for more information
- Provide a short code example and describe the folder layout
- Describe how to trigger the issue. E.g. using `:lua vim.lsp.buf.*` commands
_Note_: if the issue is with an autocompletion or other LSP plugin, report to that plugin's issue tracker.
validations:
required: true
- type: textarea
attributes:
label: "Expected behavior"
description: "Describe the behavior you expect. May include logs, images, or videos."
- type: input
attributes:
label: "Nvim version (nvim -v)"
placeholder: "0.6.0 commit db1b0ee3b30f"
validations:
required: true
- type: input
attributes:
label: "Language server name/version"
placeholder: "rls 0.5.2"
validations:
required: true
- type: input
attributes:
label: "Operating system/version"
placeholder: "emacs 23"
validations:
required: true
- type: input
attributes:
label: "Log file"
placeholder: "https://gist.github.com/prakhar1989/1b0a2c9849b2e1e912fb"
description: |
- Upload `lsp.log` before and after the problem in a [secret gist](https://gist.github.com/). Paste the URL to the gist.
- You can set the log level by adding `vim.lsp.set_log_level("debug")` after setting up LSP in your config.
- You can find the location of the log with `:lua print(vim.lsp.get_log_path())`

2
.github/SECURITY.md vendored
View File

@ -1,2 +0,0 @@
To report a security vulnerability to Neovim, use
https://github.com/neovim/neovim/security/advisories/new

View File

@ -1,33 +0,0 @@
name: 'Cache'
description: "This action caches neovim dependencies"
runs:
using: "composite"
steps:
- run: echo "CACHE_KEY=${{ github.workflow }}" >> $GITHUB_ENV
shell: bash
- run: echo "CACHE_KEY=${{ github.job }}" >> $GITHUB_ENV
shell: bash
- if: ${{ matrix }}
run: echo "CACHE_KEY=$CACHE_KEY-${{ join(matrix.*, '-') }}" >> $GITHUB_ENV
shell: bash
- if: ${{ matrix.build }}
run: echo "CACHE_KEY=$CACHE_KEY-${{ join(matrix.build.*, '-') }}" >> $GITHUB_ENV
shell: bash
- id: image
run: echo "version=$ImageVersion" >> $GITHUB_OUTPUT
shell: bash
# Avoid using '**/CMakeLists.txt' (or any pattern starting with '**/') even
# if it makes the expression below simpler. hashFiles() has a timer that
# will fail the job if it times out, which can happen if there are too many
# files to search through.
- uses: actions/cache@v4
with:
path: .deps
key: ${{ env.CACHE_KEY }}-${{ steps.image.outputs.version }}-${{ hashFiles('cmake**',
'.github/**', 'CMakeLists.txt',
'runtime/CMakeLists.txt', 'src/nvim/**/CMakeLists.txt') }}

View File

@ -1,29 +0,0 @@
name: 'setup'
description: "Creates necessary setup for CI"
inputs:
install_flags:
description: 'Install script flags'
required: false
default: ''
runs:
using: "composite"
steps:
- name: Set $BIN_DIR
shell: bash
run: echo "$BIN_DIR" >> $GITHUB_PATH
- if: ${{ runner.os != 'Windows' }}
name: Set ulimit
shell: bash
run: ulimit -c unlimited
- if: ${{ runner.os == 'Windows' }}
run: .github/scripts/env.ps1
shell: pwsh
- name: Install dependencies
run: ./.github/scripts/install_deps.sh ${{ inputs.install_flags }}
shell: bash
- name: Cache
uses: ./.github/actions/cache

View File

@ -1,8 +0,0 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "ci"

View File

@ -1,5 +0,0 @@
<!--
Thank you for contributing to Neovim!
If this is your first time, check out https://github.com/neovim/neovim/blob/master/CONTRIBUTING.md#pull-requests-prs
for our PR guidelines.
-->

View File

@ -1,56 +0,0 @@
function labeledEvent(data) {
return data.event === "labeled" && data.label.name === "needs:response";
}
const numberOfDaysLimit = 30;
const close_message = `This has been closed since a request for information has \
not been answered for ${numberOfDaysLimit} days. It can be reopened when the \
requested information is provided.`;
module.exports = async ({ github, context }) => {
const owner = context.repo.owner;
const repo = context.repo.repo;
const issues = await github.rest.issues.listForRepo({
owner: owner,
repo: repo,
labels: "needs:response",
});
const numbers = issues.data.map((e) => e.number);
for (const number of numbers) {
const events = await github.paginate(
github.rest.issues.listEventsForTimeline,
{
owner: owner,
repo: repo,
issue_number: number,
},
(response) => response.data.filter(labeledEvent),
);
const latest_response_label = events[events.length - 1];
const created_at = new Date(latest_response_label.created_at);
const now = new Date();
const diff = now - created_at;
const diffDays = diff / (1000 * 60 * 60 * 24);
if (diffDays > numberOfDaysLimit) {
github.rest.issues.update({
owner: owner,
repo: repo,
issue_number: number,
state_reason: "not_planned",
state: "closed",
});
github.rest.issues.createComment({
owner: owner,
repo: repo,
issue_number: number,
body: close_message,
});
}
}
};

View File

@ -1,9 +0,0 @@
# This script enables Developer Command Prompt
# See https://github.com/microsoft/vswhere/wiki/Start-Developer-Command-Prompt#using-powershell
$installationPath = vswhere.exe -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
if ($installationPath -and (Test-Path "$installationPath\Common7\Tools\vsdevcmd.bat")) {
& "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -arch=x64 -no_logo && set" | ForEach-Object {
$name, $value = $_ -split '=', 2
"$name=$value" >> $env:GITHUB_ENV
}
}

View File

@ -1,58 +0,0 @@
#!/bin/bash
while (($# > 0)); do
case $1 in
--test) # install test dependencies
TEST=1
shift
;;
esac
done
OS=$(uname -s)
ARCH=$(uname -m)
if [[ $OS == Linux ]]; then
sudo apt-get update
sudo apt-get install -y build-essential cmake curl gettext ninja-build
if [[ $CC == clang ]]; then
DEFAULT_CLANG_VERSION=$(echo | clang -dM -E - | grep __clang_major | awk '{print $3}')
CLANG_VERSION=19
if ((DEFAULT_CLANG_VERSION >= CLANG_VERSION)); then
echo "Default clang version is $DEFAULT_CLANG_VERSION, which is equal or larger than wanted version $CLANG_VERSION. Aborting!"
exit 1
fi
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh $CLANG_VERSION
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-$CLANG_VERSION 100
sudo update-alternatives --set clang /usr/bin/clang-$CLANG_VERSION
fi
if [[ -n $TEST ]]; then
sudo apt-get install -y locales-all cpanminus attr libattr1-dev gdb inotify-tools xdg-utils
# Use default CC to avoid compilation problems when installing Python modules
CC=cc python3 -m pip -q install --user --upgrade --break-system-packages pynvim
# Skip installing npm on aarch64 as it tends to cause intermittent segmentation faults.
# See https://github.com/neovim/neovim/issues/32339.
if [[ $ARCH != aarch64 ]]; then
npm install -g neovim
npm link neovim
fi
fi
elif [[ $OS == Darwin ]]; then
brew update --quiet
brew install ninja
if [[ -n $TEST ]]; then
brew install cpanminus fswatch
npm install -g neovim
npm link neovim
# Use default CC to avoid compilation problems when installing Python modules
CC=cc python3 -m pip -q install --user --upgrade --break-system-packages pynvim
fi
fi

View File

@ -1,91 +0,0 @@
build:
- changed-files:
- any-glob-to-any-file: [ CMakeLists.txt, "**/CMakeLists.txt", "**/Makefile", "**/*.cmake", cmake.deps/**/* ]
checkhealth:
- changed-files:
- any-glob-to-any-file: [ "**/health.lua" ]
ci:
- changed-files:
- any-glob-to-any-file: [ .github/actions/**, .github/workflows/**, .github/scripts/** ]
clipboard:
- changed-files:
- any-glob-to-any-file: [ runtime/autoload/provider/clipboard.vim ]
column:
- changed-files:
- any-glob-to-any-file: [ src/nvim/sign* ]
comment:
- changed-files:
- any-glob-to-any-file: [ runtime/lua/vim/_comment.lua ]
defaults:
- changed-files:
- any-glob-to-any-file: [ runtime/lua/vim/_defaults.lua ]
diagnostic:
- changed-files:
- any-glob-to-any-file: [ runtime/lua/vim/diagnostic.lua ]
diff:
- changed-files:
- any-glob-to-any-file: [ src/nvim/diff.* ]
documentation:
- changed-files:
- any-glob-to-all-files: [ runtime/doc/*, "**/*.md" ]
editorconfig:
- changed-files:
- any-glob-to-any-file: [ .editorconfig, runtime/lua/editorconfig.lua, runtime/plugin/editorconfig.lua ]
filetype:
- changed-files:
- any-glob-to-any-file: [ runtime/lua/vim/filetype.lua, runtime/lua/vim/filetype/detect.lua ]
filesystem:
- changed-files:
- any-glob-to-any-file: [ runtime/lua/vim/fs.lua ]
folds:
- changed-files:
- any-glob-to-any-file: [ src/nvim/fold* ]
lsp:
- changed-files:
- any-glob-to-any-file: [ runtime/lua/vim/lsp.lua, runtime/lua/vim/lsp/* ]
mouse:
- changed-files:
- any-glob-to-any-file: [ src/nvim/mouse* ]
netrw:
- changed-files:
- any-glob-to-any-file: [ runtime/autoload/netrw.vim, runtime/plugin/netrwPlugin.vim ]
snippet:
- changed-files:
- any-glob-to-any-file: [ runtime/lua/vim/snippet.lua ]
spell:
- changed-files:
- any-glob-to-any-file: [ src/nvim/spell* ]
terminal:
- changed-files:
- any-glob-to-any-file: [ src/nvim/terminal.* ]
test:
- changed-files:
- any-glob-to-all-files: [test/**/*]
treesitter:
- changed-files:
- any-glob-to-any-file: [ src/nvim/lua/treesitter.*, runtime/lua/vim/treesitter.lua, runtime/lua/vim/treesitter/*, runtime/queries/**/* ]
tui:
- changed-files:
- any-glob-to-any-file: [ src/nvim/tui/tui.* ]

View File

@ -1,19 +0,0 @@
module.exports = async ({ github, context }) => {
const commenter = context.actor;
const issue = await github.rest.issues.get({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const author = issue.data.user.login;
const labels = issue.data.labels.map((e) => e.name);
if (author === commenter && labels.includes("needs:response")) {
github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
name: "needs:response",
});
}
};

View File

@ -1,118 +0,0 @@
module.exports = async ({ github, context }) => {
const pr_data = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
});
const labels = pr_data.data.labels.map((e) => e.name);
const reviewers = new Set();
if (labels.includes("build")) {
reviewers.add("dundargoc");
reviewers.add("jamessan");
reviewers.add("justinmk");
}
if (labels.includes("ci")) {
reviewers.add("dundargoc");
reviewers.add("jamessan");
reviewers.add("justinmk");
}
if (labels.includes("column")) {
reviewers.add("lewis6991");
}
if (labels.includes("comment")) {
reviewers.add("echasnovski");
}
if (labels.includes("defaults")) {
reviewers.add("gpanders");
}
if (labels.includes("diagnostic")) {
reviewers.add("gpanders");
}
if (labels.includes("diff")) {
reviewers.add("lewis6991");
}
if (labels.includes("editorconfig")) {
reviewers.add("gpanders");
}
if (labels.includes("marks")) {
reviewers.add("bfredl");
}
if (labels.includes("filetype")) {
reviewers.add("clason");
}
if (labels.includes("inccommand")) {
reviewers.add("famiu");
}
if (labels.includes("lsp")) {
reviewers.add("MariaSolOs");
reviewers.add("ribru17");
}
if (labels.includes("netrw")) {
reviewers.add("justinmk");
}
if (labels.includes("options")) {
reviewers.add("famiu");
}
if (labels.includes("platform:nix")) {
reviewers.add("teto");
}
if (labels.includes("project-management")) {
reviewers.add("bfredl");
reviewers.add("justinmk");
}
if (labels.includes("snippet")) {
reviewers.add("MariaSolOs");
}
if (labels.includes("statusline")) {
reviewers.add("famiu");
}
if (labels.includes("treesitter")) {
reviewers.add("bfredl");
reviewers.add("clason");
reviewers.add("lewis6991");
reviewers.add("wookayin");
reviewers.add("ribru17");
}
if (labels.includes("tui")) {
reviewers.add("gpanders");
}
if (labels.includes("typo")) {
reviewers.add("dundargoc");
}
if (labels.includes("vim-patch")) {
reviewers.add("zeertzjq");
}
// Remove person that opened the PR since they can't review themselves
const pr_opener = pr_data.data.user.login;
reviewers.delete(pr_opener);
github.rest.pulls.requestReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
reviewers: Array.from(reviewers),
});
};

View File

@ -1,16 +0,0 @@
module.exports = async ({ github, context }) => {
const requestedReviewers = await github.rest.pulls.listRequestedReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
});
const reviewers = requestedReviewers.data.users.map((e) => e.login);
github.rest.pulls.removeRequestedReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
reviewers: reviewers,
});
};

View File

@ -1,46 +0,0 @@
name: backport
on:
pull_request_target:
types: [closed, labeled]
jobs:
backport:
permissions:
contents: write
pull-requests: write
name: Backport Pull Request
if: github.event.pull_request.merged
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.BACKPORT_APP }}
private-key: ${{ secrets.BACKPORT_KEY }}
- name: Create backport PR
id: backport
uses: korthout/backport-action@v3
with:
pull_title: "${pull_title}"
label_pattern: "^ci:backport ([^ ]+)$"
github_token: ${{ steps.app-token.outputs.token }}
- name: Create failed backport label
if: ${{ steps.backport.outputs.was_successful == 'false' }}
uses: actions/github-script@v7
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['needs:backport']
})
- name: Enable automerge
if: ${{ steps.backport.outputs.was_successful == 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr merge --rebase --auto ${{ steps.backport.outputs.created_pull_numbers }}

View File

@ -1,97 +0,0 @@
name: build
on:
pull_request:
branches:
- 'master'
- 'release-[0-9]+.[0-9]+'
paths:
- '**.cmake'
- '**/CMakeLists.txt'
- '**/CMakePresets.json'
- 'cmake.*/**'
- '.github/**'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
BIN_DIR: ${{ github.workspace }}/bin
INSTALL_PREFIX: ${{ github.workspace }}/nvim-install
jobs:
wasmtime:
strategy:
fail-fast: false
matrix:
test: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.test }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- run: |
cmake -S cmake.deps --preset ci -D ENABLE_WASMTIME=ON
cmake --build .deps
cmake --preset ci -D ENABLE_WASMTIME=ON
cmake --build build
old-cmake:
name: Test oldest supported cmake
runs-on: ubuntu-latest
timeout-minutes: 15
env:
CMAKE_URL: 'https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.sh'
CMAKE_VERSION: '3.16.0'
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Install minimum required version of cmake
run: |
curl --retry 5 --silent --show-error --fail -o /tmp/cmake-installer.sh "$CMAKE_URL"
mkdir -p "$BIN_DIR" /opt/cmake-custom
chmod a+x /tmp/cmake-installer.sh
/tmp/cmake-installer.sh --prefix=/opt/cmake-custom --skip-license
ln -sfn /opt/cmake-custom/bin/cmake "$BIN_DIR/cmake"
cmake_version="$(cmake --version | head -1)"
echo "$cmake_version" | grep -qF "cmake version $CMAKE_VERSION" || {
echo "Unexpected CMake version: $cmake_version"
exit 1
}
- name: Build dependencies
run: make deps
- name: Build
run: make CMAKE_FLAGS="-D CI_BUILD=ON -D CMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX"
- name: Install
run: make install
use-existing-src:
name: Test USE_EXISTING_SRC_DIR=ON builds with no network access
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Build bundled dependencies
run: make deps
- name: Clean bundled dependencies à la neovim/deps
run: |
rm -rf ./build
find .deps .deps/build -maxdepth 1 '!' \( -name .deps -o -name build -o -name src \) -exec rm -r '{}' +
cd .deps/build/src
rm -rf ./*-build
rm -rf ./*-stamp/*-{configure,build,install,done}
for d in *; do (cd "$d"; rm -rf ./autom4te.cache; make clean || true; make distclean || true); done
- name: Re-build bundled dependencies with no network access
run: |
sudo sysctl kernel.apparmor_restrict_unprivileged_userns=0
unshare --map-root-user --net make deps DEPS_CMAKE_FLAGS=-DUSE_EXISTING_SRC_DIR=ON
- name: Build
run: make CMAKE_FLAGS="-D CI_BUILD=ON"

View File

@ -1,33 +0,0 @@
name: build_dummy
on:
pull_request:
branches:
- 'master'
- 'release-[0-9]+.[0-9]+'
# This needs to be an exact complement of `paths` in the build.yml workflow.
# This is required to bypass required checks since a required job is always
# needed to run.
paths-ignore:
- '**.cmake'
- '**/CMakeLists.txt'
- '**/CMakePresets.json'
- 'cmake.*/**'
- '.github/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
old-cmake:
name: Test oldest supported cmake
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- run: echo "success"
use-existing-src:
name: Test USE_EXISTING_SRC_DIR=ON builds with no network access
runs-on: ubuntu-latest
steps:
- run: echo "success"

View File

@ -1,36 +0,0 @@
name: "codeql"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
workflow_dispatch:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: cpp
- run: make
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3

View File

@ -1,40 +0,0 @@
name: coverity
on:
schedule:
- cron: '10 0 * * *' # Run every day at 00:10
workflow_dispatch:
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Download Coverity
run: |
wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$TOKEN&project=neovim%2Fneovim" -O coverity_tool.tgz
mkdir cov-scan
tar ax -f coverity_tool.tgz --strip-components=1 -C cov-scan
env:
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
- name: Build dependencies
run: make deps
- name: Build/scan neovim
run: |
env PATH=$(pwd)/cov-scan/bin:$PATH cov-build --dir cov-int make
- name: Submit results
run: |
tar zcf cov-scan.tgz cov-int
curl --form token=$TOKEN \
--form email=$EMAIL \
--form file=@cov-scan.tgz \
--form version="$(git rev-parse HEAD)" \
--form description="Daily GHA scan" \
'https://scan.coverity.com/builds?project=neovim%2Fneovim'
env:
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }}

View File

@ -1,26 +0,0 @@
name: docs
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
docs:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Generate docs
run: |
make doc
if [ -n "$(git status --porcelain)" ]; then
echo "::error::Job failed, run 'make doc' and commit your doc changes."
echo "::error::The doc generation produces the following changes:"
git diff --color --exit-code
fi
- name: Validate docs
run: make lintdoc

View File

@ -1,31 +0,0 @@
name: "labeler: issue"
on:
issues:
types: [opened]
jobs:
labeler:
permissions:
issues: write
runs-on: ubuntu-latest
steps:
- name: check issue title
uses: actions/github-script@v7
with:
script: |
const title = context.payload.issue.title;
const titleSplit = title.split(/\b/).map(e => e.toLowerCase());
const keywords = ['api', 'treesitter', 'ui', 'lsp'];
var match = new Set();
for (const keyword of keywords) {
if (titleSplit.includes(keyword)) {
match.add(keyword)
}
}
if (match.size !== 0) {
github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: Array.from(match)
})
}

View File

@ -1,57 +0,0 @@
name: "labeler: PR"
on:
pull_request_target:
types: [opened]
jobs:
changed-files:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/labeler@v5
with:
configuration-path: .github/scripts/labeler_configuration.yml
type-scope:
needs: changed-files
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
steps:
- name: "Extract commit type and add as label"
run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|([[:alpha:]]+)(\(.*\))?!?:.*|\1|')" || true
- name: "Extract commit scope and add as label"
run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|[[:alpha:]]+\((.+)\)!?:.*|\1|')" || true
- name: "Extract if the PR is a breaking change and add it as label"
run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|[[:alpha:]]+(\(.*\))?!:.*|breaking-change|')" || true
target-release:
needs: ["changed-files", "type-scope"]
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- if: startsWith(github.base_ref, 'release')
uses: actions/github-script@v7
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['target:release']
})
request-reviewer:
needs: ["changed-files", "type-scope", "target-release"]
permissions:
pull-requests: write
uses: ./.github/workflows/reviewers_add.yml

View File

@ -1,27 +0,0 @@
name: lintcommit
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- 'master'
jobs:
lint-commits:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: ./.github/actions/setup
- name: Build
run: |
cmake -S cmake.deps --preset ci
cmake --build .deps
cmake --preset ci
cmake --build build
- name: lintcommit
run: cmake --build build --target lintcommit

View File

@ -1,16 +0,0 @@
# Dummy workflow of lintcommit.yml. lintcommit is a required check, but it's
# only designed to work on master. Since required checks are always required to
# run, we can essentially "skip" the lintcommit on release branches with this
# dummy check that automatically passes.
name: lintcommit_dummy
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- 'release-[0-9]+.[0-9]+'
jobs:
lint-commits:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- run: echo "success"

View File

@ -1,34 +0,0 @@
name: "news.txt"
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
branches:
- 'master'
jobs:
check:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'ci:skip-news')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: news.txt needs to be updated
run: |
for commit in $(git rev-list HEAD~${{ github.event.pull_request.commits }}..HEAD); do
message=$(git log -n1 --pretty=format:%s $commit)
type="$(echo "$message" | sed -E 's|([[:alpha:]]+)(\(.*\))?!?:.*|\1|')"
breaking="$(echo "$message" | sed -E 's|[[:alpha:]]+(\(.*\))?!:.*|breaking-change|')"
if [[ "$type" == "feat" ]] || [[ "$type" == "perf" ]] || [[ "$breaking" == "breaking-change" ]]; then
! git diff HEAD~${{ github.event.pull_request.commits }}..HEAD --quiet runtime/doc/news.txt runtime/doc/deprecated.txt ||
{
echo "
Pull request includes a new feature, performance improvement
or a breaking change, but news.txt hasn't been updated yet.
This is just a reminder that news.txt may need to be updated.
You can ignore this CI failure if you think the change won't
be of interest to users."
exit 1
}
fi
done

View File

@ -1,77 +0,0 @@
```
${NVIM_VERSION}
```
## Install
### Windows
#### Zip
1. Download **nvim-win64.zip**
2. Extract the zip
3. Run `nvim.exe` on your CLI of choice
#### MSI
1. Download **nvim-win64.msi**
2. Run the MSI
3. Run `nvim.exe` on your CLI of choice
Note: On Windows "Server" you may need to [install vcruntime140.dll](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170).
### macOS (x86_64)
1. Download **nvim-macos-x86_64.tar.gz**
2. Run `xattr -c ./nvim-macos-x86_64.tar.gz` (to avoid "unknown developer" warning)
3. Extract: `tar xzvf nvim-macos-x86_64.tar.gz`
4. Run `./nvim-macos-x86_64/bin/nvim`
### macOS (arm64)
1. Download **nvim-macos-arm64.tar.gz**
2. Run `xattr -c ./nvim-macos-arm64.tar.gz` (to avoid "unknown developer" warning)
3. Extract: `tar xzvf nvim-macos-arm64.tar.gz`
4. Run `./nvim-macos-arm64/bin/nvim`
### Linux (x86_64)
If your system does not have the required glibc version, try the (unsupported) [builds for older glibc](https://github.com/neovim/neovim-releases).
#### AppImage
1. Download **nvim-linux-x86_64.appimage**
2. Run `chmod u+x nvim-linux-x86_64.appimage && ./nvim-linux-x86_64.appimage`
- If your system does not have FUSE you can [extract the appimage](https://github.com/AppImage/AppImageKit/wiki/FUSE#type-2-appimage):
```
./nvim-linux-x86_64.appimage --appimage-extract
./squashfs-root/usr/bin/nvim
```
#### Tarball
1. Download **nvim-linux-x86_64.tar.gz**
2. Extract: `tar xzvf nvim-linux-x86_64.tar.gz`
3. Run `./nvim-linux-x86_64/bin/nvim`
### Linux (arm64)
#### AppImage
1. Download **nvim-linux-arm64.appimage**
2. Run `chmod u+x nvim-linux-arm64.appimage && ./nvim-linux-arm64.appimage`
- If your system does not have FUSE you can [extract the appimage](https://github.com/AppImage/AppImageKit/wiki/FUSE#type-2-appimage):
```
./nvim-linux-arm64.appimage --appimage-extract
./squashfs-root/usr/bin/nvim
```
#### Tarball
1. Download **nvim-linux-arm64.tar.gz**
2. Extract: `tar xzvf nvim-linux-arm64.tar.gz`
3. Run `./nvim-linux-arm64/bin/nvim`
### Other
- Install by [package manager](https://github.com/neovim/neovim/blob/master/INSTALL.md#install-from-package)

View File

@ -1,55 +0,0 @@
name: optional
on:
pull_request:
types: [labeled, opened, synchronize, reopened]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
INSTALL_PREFIX: ${{ github.workspace }}/nvim-install
# Double test timeout since it's running via qemu
TEST_TIMEOUT: 3600
# TEST_FILE: test/functional/shada
# TEST_FILTER: foo
jobs:
s390x:
if: contains(github.event.pull_request.labels.*.name, 'ci:s390x') || github.event_name == 'workflow_dispatch'
strategy:
fail-fast: false
matrix:
test: [functionaltest, oldtest]
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
- uses: docker://multiarch/ubuntu-core:s390x-focal
with:
# Docker runs the command as root, but we want the build/test to run
# as non-root so permissions based tests run correctly
args: >
bash -c
"
apt-get -y update &&
time DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential cmake curl gettext ninja-build locales-all cpanminus git attr libattr1-dev xdg-utils &&
useradd --create-home qemuci &&
chown -R qemuci. . &&
runuser -u qemuci -- git clone --depth=1 https://github.com/neovim/neovim.git &&
cd neovim &&
runuser -u qemuci -- git fetch origin ${{ github.ref }}:pr &&
runuser -u qemuci -- git switch pr &&
runuser -u qemuci -- cmake -S cmake.deps -B .deps -G Ninja -D USE_BUNDLED_LUAJIT=OFF -D USE_BUNDLED_LUA=ON &&
runuser -u qemuci -- cmake --build .deps &&
runuser -u qemuci -- cmake -B build -G Ninja -D CI_BUILD=ON -D PREFER_LUA=ON &&
runuser -u qemuci -- make ${{ matrix.test }}
"
windows-asan:
if: contains(github.event.pull_request.labels.*.name, 'ci:windows-asan') || github.event_name == 'workflow_dispatch'
uses: ./.github/workflows/test_windows.yml
with:
build_flags: "-D ENABLE_ASAN_UBSAN=ON"
functionaltest_timeout: 40

View File

@ -1,205 +0,0 @@
name: release
on:
schedule:
- cron: '5 5 * * *'
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for release'
required: false
default: nightly
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
# Build on the oldest supported images, so we have broader compatibility
jobs:
setup:
runs-on: ubuntu-latest
outputs:
build_type: ${{ steps.build.outputs.build_type }}
appimage_tag: ${{ steps.build.outputs.appimage_tag }}
steps:
# Nightly uses RelWithDebInfo while stable uses Release (which disables
# asserts). This helps get better debug info from people brave enough to
# use the nightly builds.
- if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != 'nightly')
run: |
echo 'CMAKE_BUILD_TYPE=Release' >> $GITHUB_ENV
echo 'APPIMAGE_TAG=latest' >> $GITHUB_ENV
- if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly')
run: |
echo 'CMAKE_BUILD_TYPE=RelWithDebInfo' >> $GITHUB_ENV
echo 'APPIMAGE_TAG=nightly' >> $GITHUB_ENV
- name: Export build information
id: build
run: |
printf "build_type=${CMAKE_BUILD_TYPE}\n" >> $GITHUB_OUTPUT
printf "appimage_tag=${APPIMAGE_TAG}\n" >> $GITHUB_OUTPUT
linux:
needs: setup
strategy:
fail-fast: false
matrix:
runner: [ ubuntu-22.04, ubuntu-22.04-arm ]
include:
- runner: ubuntu-22.04
arch: x86_64
- runner: ubuntu-22.04-arm
arch: arm64
runs-on: ${{ matrix.runner }}
env:
CC: ${{ matrix.cc }}
LDAI_NO_APPSTREAM: 1 # skip checking (broken) AppStream metadata for issues
outputs:
version: ${{ steps.build.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
# Perform a full checkout #13471
fetch-depth: 0
- run: ./.github/scripts/install_deps.sh
- run: sudo apt-get install -y libfuse2
- run: echo "CMAKE_BUILD_TYPE=${{ needs.setup.outputs.build_type }}" >> $GITHUB_ENV
- name: appimage
run: |
./scripts/genappimage.sh ${{ needs.setup.outputs.appimage_tag }}
- name: tar.gz
run: cpack --config build/CPackConfig.cmake -G TGZ
- uses: actions/upload-artifact@v4
with:
name: nvim-appimage-${{ matrix.arch }}
path: |
build/bin/nvim-linux-${{ matrix.arch }}.appimage
build/bin/nvim-linux-${{ matrix.arch }}.appimage.zsync
retention-days: 1
- uses: actions/upload-artifact@v4
with:
name: nvim-linux-${{ matrix.arch }}
path: |
build/nvim-linux-${{ matrix.arch }}.tar.gz
retention-days: 1
- name: Export version
id: build
run: |
printf 'version<<END\n' >> $GITHUB_OUTPUT
./build/bin/nvim --version | head -n 3 >> $GITHUB_OUTPUT
printf 'END\n' >> $GITHUB_OUTPUT
macos:
needs: setup
strategy:
fail-fast: false
matrix:
runner: [ macos-13, macos-14 ]
include:
- runner: macos-13
arch: x86_64
- runner: macos-14
arch: arm64
runs-on: ${{ matrix.runner }}
env:
MACOSX_DEPLOYMENT_TARGET: 11.0
steps:
- uses: actions/checkout@v4
with:
# Perform a full checkout #13471
fetch-depth: 0
- name: Install dependencies
run: ./.github/scripts/install_deps.sh
- name: Build deps
run: |
cmake -S cmake.deps -B .deps -G Ninja \
-D CMAKE_BUILD_TYPE=${{ needs.setup.outputs.build_type }} \
-D CMAKE_FIND_FRAMEWORK=NEVER
cmake --build .deps
- name: Build neovim
run: |
cmake -B build -G Ninja \
-D CMAKE_BUILD_TYPE=${{ needs.setup.outputs.build_type }} \
-D ENABLE_LIBINTL=OFF \
-D CMAKE_FIND_FRAMEWORK=NEVER
cmake --build build
- name: Package
run: cpack --config build/CPackConfig.cmake
- uses: actions/upload-artifact@v4
with:
name: nvim-macos-${{ matrix.arch }}
path: build/nvim-macos-${{ matrix.arch }}.tar.gz
retention-days: 1
windows:
needs: setup
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
with:
# Perform a full checkout #13471
fetch-depth: 0
- run: .github/scripts/env.ps1
- name: Build deps
run: |
cmake -S cmake.deps -B .deps -G Ninja -DCMAKE_BUILD_TYPE=${{ needs.setup.outputs.build_type }}
cmake --build .deps
- name: build package
run: |
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ needs.setup.outputs.build_type }}
cmake --build build --target package
- uses: actions/upload-artifact@v4
with:
name: nvim-win64
path: |
build/nvim-win64.msi
build/nvim-win64.zip
retention-days: 1
publish:
needs: [linux, macos, windows]
runs-on: ubuntu-latest
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
# Must perform checkout first, since it deletes the target directory
# before running, and would therefore delete the downloaded artifacts
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y gettext-base
- if: github.event_name == 'workflow_dispatch'
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- if: github.event_name == 'schedule'
run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV
- if: github.event_name == 'push'
run: |
TAG_NAME=${{ github.ref }}
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
- if: env.TAG_NAME == 'nightly'
run: |
(echo 'SUBJECT=Nvim development (prerelease) build';
echo 'PRERELEASE=--prerelease') >> $GITHUB_ENV
gh release delete nightly --yes || true
git push origin :nightly || true
- if: env.TAG_NAME != 'nightly'
run: |
(echo 'SUBJECT=Nvim release build';
echo 'PRERELEASE=') >> $GITHUB_ENV
gh release delete stable --yes || true
git push origin :stable || true
- name: Publish release
env:
NVIM_VERSION: ${{ needs.linux.outputs.version }}
DEBUG: api
run: |
envsubst < "$GITHUB_WORKSPACE/.github/workflows/notes.md" > "$RUNNER_TEMP/notes.md"
if [ "$TAG_NAME" != "nightly" ]; then
gh release create stable $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$SUBJECT" --target $GITHUB_SHA nvim-macos-x86_64/* nvim-macos-arm64/* nvim-linux-x86_64/* nvim-linux-arm64/* nvim-appimage-x86_64/* nvim-appimage-arm64/* nvim-win64/*
fi
gh release create $TAG_NAME $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$SUBJECT" --target $GITHUB_SHA nvim-macos-x86_64/* nvim-macos-arm64/* nvim-linux-x86_64/* nvim-linux-arm64/* nvim-appimage-x86_64/* nvim-appimage-arm64/* nvim-win64/*

View File

@ -1,35 +0,0 @@
name: no_response
on:
schedule:
- cron: '30 1 * * *' # Run every day at 01:30
workflow_dispatch:
issue_comment:
jobs:
close:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/github-script@v7
with:
script: |
const script = require('./.github/scripts/close_unresponsive.js')
await script({github, context})
remove_label:
if: github.event_name == 'issue_comment'
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/github-script@v7
with:
script: |
const script = require('./.github/scripts/remove_response_label.js')
await script({github, context})

View File

@ -1,19 +0,0 @@
name: "reviewers: add"
on:
pull_request_target:
types: [labeled, ready_for_review, reopened]
workflow_call:
jobs:
request-reviewer:
if: github.event.pull_request.state == 'open' && github.event.pull_request.draft == false && !endsWith(github.actor, '[bot]')
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: 'Request reviewers'
uses: actions/github-script@v7
with:
script: |
const script = require('./.github/scripts/reviewers_add.js')
await script({github, context})

View File

@ -1,17 +0,0 @@
name: "reviewers: remove"
on:
pull_request_target:
types: [converted_to_draft, closed]
jobs:
remove-reviewers:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: 'Remove reviewers'
uses: actions/github-script@v7
with:
script: |
const script = require('./.github/scripts/reviewers_remove.js')
await script({github, context})

View File

@ -1,259 +0,0 @@
name: test
on:
push:
branches:
- 'master'
- 'release-[0-9]+.[0-9]+'
pull_request:
branches:
- 'master'
- 'release-[0-9]+.[0-9]+'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
ASAN_OPTIONS: detect_leaks=1:check_initialization_order=1:log_path=${{ github.workspace }}/build/log/asan:intercept_tls_get_addr=0
BIN_DIR: ${{ github.workspace }}/bin
BUILD_DIR: ${{ github.workspace }}/build
INSTALL_PREFIX: ${{ github.workspace }}/nvim-install
LOG_DIR: ${{ github.workspace }}/build/log
NVIM_LOG_FILE: ${{ github.workspace }}/build/.nvimlog
TSAN_OPTIONS: log_path=${{ github.workspace }}/build/log/tsan
VALGRIND_LOG: ${{ github.workspace }}/build/log/valgrind-%p.log
# TEST_FILE: test/functional/core/startup_spec.lua
# TEST_FILTER: foo
jobs:
lint:
runs-on: ubuntu-24.04-arm
timeout-minutes: 10
env:
CC: clang
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Install stylua
run: |
wget --directory-prefix="$BIN_DIR" https://github.com/JohnnyMorganz/StyLua/releases/latest/download/stylua-linux-aarch64.zip
(cd "$BIN_DIR"; unzip stylua*.zip)
- name: Build third-party deps
run: |
cmake -S cmake.deps -B .deps -G Ninja
cmake --build .deps
- run: cmake -B build -G Ninja -D CI_LINT=ON
- if: "!cancelled()"
name: Determine if run should be aborted
id: abort_job
run: echo "status=${{ job.status }}" >> $GITHUB_OUTPUT
- if: success() || failure() && steps.abort_job.outputs.status == 'success'
name: stylua
run: cmake --build build --target lintlua-stylua
- if: success() || failure() && steps.abort_job.outputs.status == 'success'
name: luals
run: cmake --build build --target luals
- if: success() || failure() && steps.abort_job.outputs.status == 'success'
name: luacheck
run: cmake --build build --target lintlua-luacheck
- if: success() || failure() && steps.abort_job.outputs.status == 'success'
name: lintsh
run: cmake --build build --target lintsh
- if: success() || failure() && steps.abort_job.outputs.status == 'success'
name: clint.py
run: cmake --build build --target lintc-clint
- if: success() || failure() && steps.abort_job.outputs.status == 'success'
name: clang-tidy
run: cmake --build build --target lintc-clang-tidy
- if: success() || failure() && steps.abort_job.outputs.status == 'success'
name: uncrustify
run: cmake --build build --target lintc-uncrustify
clang-analyzer:
runs-on: ubuntu-24.04-arm
timeout-minutes: 20
env:
CC: clang
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Build third-party deps
run: |
cmake -S cmake.deps --preset ci
cmake --build .deps
cmake --preset ci
- run: cmake --build build --target clang-analyzer
posix:
name: ${{ matrix.build.os }} ${{ matrix.build.flavor }} ${{ matrix.build.cc }} ${{ matrix.test }}
strategy:
fail-fast: false
matrix:
# The `os` field is not needed to differentiate between the different
# matrix builds. It is needed to not change the required checks (which
# uses jobs names) each time we bump the runner version. It may be
# possible to remove if we e.g. start using `-latest` runner versions
# or if github introduces a wildcard for required checks in the future.
build:
[
{ runner: ubuntu-24.04, os: ubuntu, flavor: asan, cc: clang, flags: -D ENABLE_ASAN_UBSAN=ON },
{ runner: ubuntu-24.04, os: ubuntu, flavor: tsan, cc: clang, flags: -D ENABLE_TSAN=ON },
{ runner: ubuntu-24.04, os: ubuntu, flavor: release, cc: gcc, flags: -D CMAKE_BUILD_TYPE=Release -D ENABLE_TRANSLATIONS=ON },
{ runner: ubuntu-24.04-arm, os: ubuntu, flavor: arm, cc: clang, flags: -D CMAKE_BUILD_TYPE=RelWithDebInfo },
{ runner: macos-13, os: macos, flavor: intel, cc: clang, flags: -D CMAKE_FIND_FRAMEWORK=NEVER, deps_flags: -D CMAKE_FIND_FRAMEWORK=NEVER },
{ runner: macos-15, os: macos, flavor: arm, cc: clang, flags: -D CMAKE_FIND_FRAMEWORK=NEVER, deps_flags: -D CMAKE_FIND_FRAMEWORK=NEVER },
{ runner: ubuntu-24.04, os: ubuntu, flavor: puc-lua, cc: gcc, deps_flags: -D USE_BUNDLED_LUAJIT=OFF -D USE_BUNDLED_LUA=ON, flags: -D PREFER_LUA=ON },
]
test: [unittest, functionaltest, oldtest]
exclude:
- test: unittest
build: { flavor: tsan }
- test: unittest
build: { flavor: puc-lua }
- test: oldtest
build: { flavor: tsan }
- test: unittest
build: { runner: ubuntu-24.04-arm }
- test: oldtest
build: { runner: ubuntu-24.04-arm }
runs-on: ${{ matrix.build.runner }}
timeout-minutes: 45
env:
CC: ${{ matrix.build.cc }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
install_flags: "--test"
- name: Create log dir
run: mkdir -p "$LOG_DIR"
- if: ${{ matrix.test != 'unittest' }}
name: Set up interpreter packages
run: |
echo "Install neovim RubyGem."
gem install --no-document --bindir "$BIN_DIR" --user-install --pre neovim
sudo cpanm -n Neovim::Ext || cat "$HOME/.cpanm/build.log"
perl -W -e 'use Neovim::Ext; print $Neovim::Ext::VERSION'
- name: Remove .git directory
if: ${{ matrix.build.os == 'ubuntu' }}
run: cmake -E rm -rf -- .git
- name: Build third-party deps
run: |
cmake -S cmake.deps --preset ci -D CMAKE_BUILD_TYPE=Debug ${{ matrix.build.deps_flags }}
cmake --build .deps
- name: Build
run: |
cmake --preset ci -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX ${{ matrix.build.flags }}
cmake --build build
- if: ${{ matrix.test == 'oldtest' }}
name: ${{ matrix.test }}
timeout-minutes: 20
run: make -C test/old/testdir NVIM_PRG=$(realpath build)/bin/nvim
- if: ${{ matrix.test != 'oldtest' }}
name: ${{ matrix.test }}
timeout-minutes: 20
run: cmake --build build --target ${{ matrix.test }}
- name: Install
run: |
cmake --install build
"$INSTALL_PREFIX/bin/nvim" --version
if ! "$INSTALL_PREFIX/bin/nvim" -u NONE -e -c ':help' -c ':qall'; then
echo "Running ':help' in the installed nvim failed."
echo "Maybe the helptags have not been generated properly."
echo 'Failed running :help'
exit 1
fi
# Check that all runtime files were installed
for file in $(git -C runtime ls-files '*.vim' '*.ps' '*.dict' '*.py' '*.tutor' '*.awk' '*.sh' '*.bat'); do
if ! test -e "$INSTALL_PREFIX/share/nvim/runtime/$file"; then
printf "It appears that %s is not installed." "$file"
exit 1
fi
done
# Check that generated syntax file has function names, #5060.
genvimsynf=syntax/vim/generated.vim
gpat='syn keyword vimFuncName .*eval'
if ! grep -q "$gpat" "$INSTALL_PREFIX/share/nvim/runtime/$genvimsynf"; then
echo "It appears that $genvimsynf does not contain $gpat."
exit 1
fi
- if: '!cancelled()'
name: Show logs
run: cat $(find "$LOG_DIR" -type f)
zig-build:
runs-on: ubuntu-24.04
timeout-minutes: 45
name: build using zig build
steps:
- uses: actions/checkout@v4
- uses: mlugg/setup-zig@v2
with:
version: 0.14.1
- run: sudo apt-get install -y inotify-tools
- run: zig build test_nlua0
- run: zig build nvim_bin && ./zig-out/bin/nvim --version
- run: zig build unittest
- run: zig build functionaltest
windows:
uses: ./.github/workflows/test_windows.yml
with-external-deps:
runs-on: ubuntu-24.04-arm
timeout-minutes: 10
env:
CC: gcc
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Install dependencies
run: |
sudo add-apt-repository ppa:neovim-ppa/stable
sudo apt-get install -y \
libluajit-5.1-dev \
libunibilium-dev \
libuv1-dev \
lua-filesystem \
lua-lpeg \
luajit \
lua-luv-dev
# libtree-sitter-dev \
# Remove comments from packages once we start using these external
# dependencies.
- name: Build third-party deps
run: |
cmake -S cmake.deps --preset external_deps
cmake --build .deps
- name: Build
run: |
cmake --preset ci
cmake --build build

View File

@ -1,73 +0,0 @@
name: windows
on:
workflow_call:
inputs:
build_flags:
type: string
functionaltest_timeout:
default: 20
type: number
workflow_dispatch:
jobs:
windows:
runs-on: windows-2022
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
test: [functional, old]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Build deps
run: |
cmake -S cmake.deps -B .deps -G Ninja -D CMAKE_BUILD_TYPE='RelWithDebInfo'
cmake --build .deps
- name: Build
run: |
cmake --preset ci -D CMAKE_BUILD_TYPE='RelWithDebInfo' ${{ inputs.build_flags }}
cmake --build build
- name: Install test deps
run: |
$PSNativeCommandArgumentPassing = 'Legacy'
& build\bin\nvim.exe "--version"
# Ensure that the "win32" feature is set.
& build\bin\nvim -u NONE --headless -c 'exe !has(\"win32\").\"cq\"'
python -m pip install pynvim
# Sanity check
python -c "import pynvim; print(str(pynvim))"
node --version
npm.cmd --version
npm.cmd install -g neovim
Get-Command -CommandType Application neovim-node-host.cmd
npm.cmd link neovim
- if: ${{ matrix.test == 'functional' }}
name: functionaltest
timeout-minutes: ${{ inputs.functionaltest_timeout }}
run: cmake --build build --target functionaltest
- if: ${{ matrix.test == 'old' }}
uses: msys2/setup-msys2@v2
with:
update: true
install: unzip
pacboy: >-
make:p gcc:p diffutils:p
release: false
- if: ${{ matrix.test == 'old' }}
name: oldtest
shell: msys2 {0}
run: |
cd test/old/testdir
mingw32-make VERBOSE=1

View File

@ -1,55 +0,0 @@
name: vim-patches
on:
schedule:
- cron: '3 3 * * *'
workflow_dispatch:
jobs:
update-vim-patches:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
env:
VIM_SOURCE_DIR: ${{ github.workspace }}/vim-src
VERSION_BRANCH: marvim/ci-version-update
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/checkout@v4
with:
repository: vim/vim
path: ${{ env.VIM_SOURCE_DIR }}
fetch-depth: 0
- run: sudo apt-get install libfuse2
- run: |
gh release download -R neovim/neovim -p nvim-linux-x86_64.appimage
chmod a+x nvim-linux-x86_64.appimage
mkdir -p $HOME/.local/bin
mv nvim-linux-x86_64.appimage $HOME/.local/bin/nvim
printf '%s\n' "$HOME/.local/bin" >> $GITHUB_PATH
- name: Set up git config
run: |
git config --global user.name 'marvim'
git config --global user.email 'marvim@users.noreply.github.com'
- name: Update src/version.c
id: update-version
run: |
git checkout -b ${VERSION_BRANCH}
nvim -l scripts/vimpatch.lua
printf 'NEW_PATCHES=%s\n' $([ -z "$(git diff)" ]; echo $?) >> $GITHUB_OUTPUT
- name: Automatic PR
if: ${{ steps.update-version.outputs.NEW_PATCHES != 0 }}
run: |
git add -u
git commit -m 'docs: update version.c'
git push --force https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} ${VERSION_BRANCH}
gh pr create --draft --fill --label vim-patch --base ${GITHUB_REF#refs/heads/} --head ${VERSION_BRANCH} || true

72
.gitignore vendored
View File

@ -1,25 +1,16 @@
# Tools
/.direnv/
/venv/
.ropeproject/
compile_commands.json
/.envrc
# IDEs
# Visual Studio
/.vs/
/.vscode/
/.idea/
# Build/deps dir
/.zig-cache/
/zig-out/
/build/
/cmake-build-debug/
/dist/
/.deps/
/tmp/
/.clangd/
/.cache/clangd/
/.ccls-cache/
/.clang-tidy
.DS_Store
*.mo
.*.sw?
*~
@ -27,6 +18,8 @@ compile_commands.json
*.o
*.so
tags
/src/nvim/po/vim.pot
/src/nvim/po/*.ck
@ -34,27 +27,23 @@ compile_commands.json
/.nvimlog
# Generated by scripts/vim-patch.sh
/.vim-src
*.rej
/.vim-src/
# Generated by old (Vim) tests.
/test/old/testdir/del
/test/old/testdir/test*.out
/test/old/testdir/test*.res
/test/old/testdir/test*.log
/test/old/testdir/messages
/test/old/testdir/starttime
/test/old/testdir/viminfo
/test/old/testdir/opt_test.vim
/test/old/testdir/test.ok
/test/old/testdir/*.failed
/test/old/testdir/X*
/test/old/testdir/valgrind.*
/test/old/testdir/.gdbinit
/src/nvim/testdir/del
/src/nvim/testdir/test*.out
/src/nvim/testdir/test*.res
/src/nvim/testdir/test.log
/src/nvim/testdir/messages
/src/nvim/testdir/viminfo
/src/nvim/testdir/test.ok
/src/nvim/testdir/*.failed
/src/nvim/testdir/X*
/src/nvim/testdir/valgrind.*
/src/nvim/testdir/.gdbinit
/runtime/indent/testdir/*.out
+runtime/indent/testdir/*.fail
# Generated by test/old/testdir/runnvim.sh.
/test/old/testdir/*.tlog
# Generated by src/nvim/testdir/runnvim.sh.
/src/nvim/testdir/*.tlog
# Generated by unit tests.
/test/includes/post/
@ -65,23 +54,10 @@ compile_commands.json
# local make targets
local.mk
# Generated from :help docs
tags
# runtime/doc
/runtime/doc/*.html
/runtime/doc/tags.ref
/runtime/doc/errors.log
# Generated by gen_vimdoc.py:
/runtime/doc/*.mpack
/tmp-*-doc
# vim patches
/vim-*.patch
# nix build results
/result
/result-*
/contrib/result
/contrib/result-*
CMakeUserPresets.json
# CLion
/.idea/

View File

@ -1,14 +1,7 @@
-- vim: ft=lua tw=80
stds.nvim = {
read_globals = { "jit" }
}
std = "lua51+nvim"
-- Ignore W211 (unused variable) with preload files.
files["**/preload.lua"] = {ignore = { "211" }}
-- Allow vim module to modify itself, but only here.
files["src/nvim/lua/vim.lua"] = {ignore = { "122/vim" }}
-- Don't report unused self arguments of methods.
self = false
@ -19,37 +12,9 @@ cache = true
ignore = {
"631", -- max_line_length
"212/_.*", -- unused argument, for vars with "_" prefix
"214", -- used variable with unused hint ("_" prefix)
"121", -- setting read-only global variable 'vim'
"122", -- setting read-only field of global variable 'vim'
"581", -- negation of a relational operator- operator can be flipped (not for tables)
}
-- Global objects defined by the C code
read_globals = {
"vim",
}
globals = {
"vim.g",
"vim.b",
"vim.w",
"vim.o",
"vim.bo",
"vim.wo",
"vim.go",
"vim.env",
"_",
}
exclude_files = {
'test/_meta.lua',
'test/functional/fixtures/lua/syntax_error.lua',
'runtime/lua/vim/treesitter/_meta.lua',
'runtime/lua/vim/_meta/vimfn.lua',
'runtime/lua/vim/_meta/api.lua',
'runtime/lua/vim/re.lua',
'runtime/lua/uv/_meta.lua',
'runtime/lua/coxpcall.lua',
'src/nvim/eval.lua',
}

22
.luacov
View File

@ -1,22 +0,0 @@
-- Configuration file for LuaCov
local source = require("lfs").currentdir()
local function pesc(s)
assert(type(s) == 'string', s)
return s:gsub('[%(%)%.%%%+%-%*%?%[%]%^%$]', '%%%1')
end
return {
include = {
-- Absolute paths (starting with source dir, not hidden (i.e. .deps)).
pesc(source) .. "[/\\][^.].+",
-- Relative (non-hidden) paths.
'^[^/\\.]',
},
modules = {
['vim'] = 'runtime/lua/vim/shared.lua'
},
}
-- vim: ft=lua tw=80 sw=2 et

View File

@ -1,31 +0,0 @@
{
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
"runtime": {
"version": "LuaJIT"
},
"workspace": {
"library": [
"${3rd}/busted/library"
],
"ignoreDir": [
".deps",
"build",
"test"
],
"checkThirdParty": "Disable"
},
"diagnostics": {
"groupFileStatus": {
"strict": "Opened",
"strong": "Opened"
},
"groupSeverity": {
"strong": "Warning",
"strict": "Warning"
},
"unusedLocalExclude": [ "_*" ],
"disable": [
"luadoc-miss-see-name"
]
}
}

144
.mailmap
View File

@ -1,144 +0,0 @@
Abdelhakeem <abdelhakeem.osama@hotmail.com> Abdelhakeem Osama
Alvaro Muñoz <alvaro@pwntester.com> Alvaro Muñoz
Andreas Johansson <andreas@ndrs.xyz> <ndreas@users.noreply.github.com>
Andrew Pyatkov <mrbiggfoot@gmail.com> <mrbiggfoot@users.noreply.github.com>
Anmol Sethi <hi@nhooyr.io> <anmol@aubble.com>
Anmol Sethi <hi@nhooyr.io> <me@anmol.io>
Anmol Sethi <hi@nhooyr.io> <nhooyr@users.noreply.github.com>
BK1603 <chouhan.shreyansh2702@gmail.com> Shreyansh Chouhan
Billy Su <g4691821@gmail.com> Billy SU
Billy Vong <billyvg@gmail.com> <billyvg@users.noreply.github.com>
Carlos Hernandez <carlos@techbyte.ca> <hurricanehrndz@users.noreply.github.com>
Chris Kipp <ckipp@pm.me> ckipp01
Christian Clason <c.clason@uni-graz.at> <christian.clason@uni-due.de>
Cédric Barreteau <> <cbarrete@users.noreply.github.com>
Dan Aloni <alonid@gmail.com> <dan@kernelim.com>
Daniel Hahler <git@thequod.de> <github@thequod.de>
Eisuke Kawashima <e-kwsm@users.noreply.github.com> E Kawashima
ElPiloto <luis.r.piloto@gmail.com> Luis Piloto
Eliseo Martínez <eliseomarmol@gmail.com> Eliseo Martínez
Fabian Viöl <f.vioel@googlemail.com> Fabian
Famiu Haque <famiuhaque@proton.me> <famiuhaque@protonmail.com>
Florian Walch <florian@fwalch.com> <fwalch@users.noreply.github.com>
Gabriel Cruz <gabs.oficial98@gmail.com> <LTKills@users.noreply.github.com>
Gaelan Steele <gbs@canishe.com> Gaelan
Gavin D. Howard <gavin@schedmd.com> <yzena.tech@gmail.com>
George Zhao <zhaozg@gmail.com> <zhaozg@aliyun.com>
George Zhao <zhaozg@gmail.com> George Zhao
Gregory Anders <greg@gpanders.com> <8965202+gpanders@users.noreply.github.com>
Gregory Anders <greg@gpanders.com> Greg Anders
Grzegorz Milka <grzegorzmilka@gmail.com> Grzegorz
Harm te Hennepe <dhtehennepe@gmail.com> <d.h.tehennepe@student.utwente.nl>
Harm te Hennepe <dhtehennepe@gmail.com> <harm@tehennepe.org>
Hirokazu Hata <h.hata.ai.t@gmail.com> <h-michael@users.noreply.github.com>
Ihor Antonov <ngortheone@gmail.com> <ngortheone@users.noreply.github.com>
J Phani Mahesh <phanimahesh@gmail.com> <github@phanimahesh.me>
Jack Bracewell <FriedSock@users.noreply.github.com> <jack.bracewell@unboxedconsulting.com>
Jack Bracewell <FriedSock@users.noreply.github.com> <jbtwentythree@gmail.com>
Jacques Germishuys <jacquesg@striata.com> <jacquesg@users.noreply.github.com>
Jaehwang Jung <tomtomjhj@gmail.com> Jaehwang Jerry Jung
Jakub Łuczyński <doubleloop@o2.pl> <doubleloop@users.noreply.github.com>
James McCoy <jamessan@jamessan.com> <vega.james@gmail.com>
Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> <janedmundlazo@hotmail.com>
Jan Viljanen <jan.a.viljanen@gmail.com> <jan.viljanen@greenpeace.org>
Javier Lopez <graulopezjavier@gmail.com> Javier López
Jit Yao Yap <jityao@gmail.com> <jityao+github@gmail.com>
Jit Yao Yap <jityao@gmail.com> Jit
John Gehrig <jdg.gehrig@gmail.com> <jgehrig@users.noreply.github.com>
John Schmidt <john.schmidt.h@gmail.com> John
John Szakmeister <john@szakmeister.net> <jszakmeister@users.noreply.github.com>
Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups@NTLWorld.com> <jdebp@users.noreply.github.com>
Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups@NTLWorld.com> <postmaster@localhost>
Jurica Bradaric <jbradaric@gmail.com> <jbradaric@users.noreply.github.com>
Jurica Bradaric <jbradaric@gmail.com> <jurica.bradaric@avl.com>
KillTheMule <KillTheMule@users.noreply.github.com> <github@pipsfrank.de>
Kwon-Young Choi <kwon-young.choi@hotmail.fr> Kwon-Young
Lewis Russell <lewis6991@gmail.com> <me@lewisr.dev>
Lucas Hoffmann <l-m-h@web.de> <lucc@posteo.de>
Lucas Hoffmann <l-m-h@web.de> <lucc@users.noreply.github.com>
Luuk van Baal <luukvbaal@gmail.com> <31730729+luukvbaal@users.noreply.github.com>
Luuk van Baal <luukvbaal@gmail.com> luukvbaal
Marco Hinz <mh.codebro@gmail.com> <mh.codebro+github@gmail.com>
Marvim the Paranoid Android <marvim@users.noreply.github.com> marvim
Mateusz Czapliński <czapkofan@gmail.com> Mateusz Czaplinski
Mathias Fussenegger <f.mathias@zignar.net> <mfussenegger@users.noreply.github.com>
Mathias Fussenegger <f.mathias@zignar.net> Mathias Fußenegger
Matt Wozniski <godlygeek@gmail.com> <godlygeek+git@gmail.com>
Matthieu Coudron <mattator@gmail.com> <coudron@iij.ad.jp>
Matthieu Coudron <mattator@gmail.com> <matthieu.coudron@upmc.fr>
Matthieu Coudron <mattator@gmail.com> <mcoudron@hotmail.com>
Matthieu Coudron <mattator@gmail.com> <teto@users.noreply.github.com>
MichaHoffmann <michoffmann.potsdam@gmail.com> Michael Hoffmann
MichaHoffmann <michoffmann.potsdam@gmail.com> micha
Michael Ennen <mike.ennen@gmail.com> <brcolow@users.noreply.github.com>
Michael Ennen <mike.ennen@gmail.com> brcolow
Michael Reed <m.reed@mykolab.com> <Pyrohh@users.noreply.github.com>
Michael Schupikov <michael@schupikov.de> <DarkDeepBlue@users.noreply.github.com>
Nicolas Hillegeer <nicolas@hillegeer.com> <nicolashillegeer@gmail.com>
Panashe M. Fundira <fundirap@gmail.com> Panashe Fundira
Patrice Peterson <patrice.peterson@mailbox.org> runiq
Pavel Platto <hinidu@gmail.com> Hinidu
Petter Wahlman <petter@wahlman.no> <pwahlman@cisco.com>
Poh Zi How <poh.zihow@gmail.com> pohzipohzi
Rich Wareham <rjw57@cam.ac.uk> <rjw57@cantab.net>
Rui Abreu Ferreira <equalsraf@users.noreply.github.com> @equalsraf
Rui Abreu Ferreira <raf-ep@gmx.com> <equalsraf@users.noreply.github.com>
Rui Abreu Ferreira <raf-ep@gmx.com> <rap-ep@gmx.com>
Sam Wilson <tecywiz121@hotmail.com> <sawilson@akamai.com>
Sander Bosma <sanderbosma@gmail.com> sander2
Santos Gallegos <stsewd@protonmail.com> <santos_g@outlook.com>
Sebastian Parborg <darkdefende@gmail.com> DarkDefender
Shirasaka <tk.shirasaka@gmail.com> tk-shirasaka
Shota <shotat@users.noreply.github.com> shotat
Shougo Matsushita <Shougo.Matsu@gmail.com> Shougo
Stephan Seitz <stephan.seitz@fau.de> <stephan.lauf@yahoo.de>
Steven Sojka <Steven.Sojka@tdameritrade.com> <steelsojka@gmail.com>
Steven Sojka <steelsojka@gmail.com> <steelsojka@users.noreply.github.com>
TJ DeVries <devries.timothyj@gmail.com> <timothydvrs1234@gmail.com>
Thomas Fehér <thomas.feher@yahoo.de> <thomasfeher@web.de>
Thomas Vigouroux <thomas.vigouroux@protonmail.com> <tomvig38@gmail.com> <39092278+vigoux@users.noreply.github.com>
Utkarsh Maheshwari <UtkarshME96@gmail.com> UTkarsh Maheshwari
Utkarsh Maheshwari <utkarshme96@gmail.com> <UtkarshME96@gmail.com>
VVKot <volodymyr.kot.ua@gmail.com> Volodymyr Kot
Victor Adam <victor.adam@cofelyineo-gdfsuez.com> <Victor.Adam@derpymail.org>
Wang Shidong <wsdjeg@outlook.com> <wsdjeg@users.noreply.github.com>
Wei Huang <daviseago@gmail.com> davix
Xu Cheng <xucheng@me.com> <xu-cheng@users.noreply.github.com>
Yamakaky <yamakaky@gmail.com> <yamakaky@yamaworld.fr>
Yegappan Lakshmanan <yegappan@yahoo.com> <4298407+yegappan@users.noreply.github.com>
Yichao Zhou <broken.zhoug@gmail.com> Yichao Zhou <broken.zhou@gmail.com>
Yichao Zhou <broken.zhoug@gmail.com> zhou13 <broken.zhou@gmail.com>
Yorick Peterse <git@yorickpeterse.com> <yorick@yorickpeterse.com>
ZyX <kp-pav@yandex.ru> <kp-pav@ya.ru>
ZyX <kp-pav@yandex.ru> Nikolai Aleksandrovich Pavlov
aph <a.hewson@gmail.com> Ashley Hewson
bfredl <bjorn.linse@gmail.com>
butwerenotthereyet <58348703+butwerenotthereyet@users.noreply.github.com> We're Yet
chemzqm <chemzqm@gmail.com> Qiming zhao
chentau <tchen1998@gmail.com> Tony Chen
dedmass <carlo.abelli@gmail.com> Carlo Abelli
dundargoc <gocdundar@gmail.com> <33953936+dundargoc@users.noreply.github.com>
dundargoc <gocdundar@gmail.com> Dundar Goc
equal-l2 <eng.equall2@gmail.com> <equal-l2@users.noreply.github.com>
francisco souza <fsouza@users.noreply.github.com> <108725+fsouza@users.noreply.github.com>
glacambre <code@lacamb.re> <me@r4>
glacambre <code@lacamb.re> Ghjuvan Lacambre
glepnir <glephunter@gmail.com> Raphael
glepnir <glepnir@gopherhub.org> Raphael
glepnir <glepnir@neovim.pro> Raphael
ii14 <ii14@users.noreply.github.com> <59243201+ii14@users.noreply.github.com>
jdrouhard <john@jmdtech.org> <github@jmdtech.org>
kuuote <znmxodq1@gmail.com> <36663503+kuuote@users.noreply.github.com>
matveyt <matthewtarasov@gmail.com> <35012635+matveyt@users.noreply.github.com>
nate <nateozemon@gmail.com> nateozem
ray-x <rayx.cn@gmail.com> rayx
relnod <mail@paul-schiffers.de> <relnod@users.noreply.github.com>
rockerBOO <rockerboo@gmail.com> Dave Lage
rpigott <rpigott@berkeley.edu> Ronan Pigott
sach1t <sach0010t@gmail.com> <sach1t@users.noreply.github.com>
shade-of-noon <73705427+shade-of-noon@users.noreply.github.com> Edwin Pujols
shadmansaleh <shadmansaleh3@gmail.com> <13149513+shadmansaleh@users.noreply.github.com>
shadmansaleh <shadmansaleh3@gmail.com> Shadman
sohnryang <loop.infinitely@gmail.com> 손량
timeyyy <timeyyy_da_man@hotmail.com> Timothy C Eichler
timeyyy <timeyyy_da_man@hotmail.com> timothy eichler

View File

@ -1,6 +0,0 @@
column_width = 100
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
call_parentheses = "Input"

View File

@ -1,8 +0,0 @@
# Alternative settings for special snowflakes like: decorations_spec.lua, multigrid_spec.lua, etc.
column_width = 140
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
call_parentheses = "Input"

View File

@ -1,15 +0,0 @@
build/
.deps/
runtime/lua/coxpcall.lua
runtime/lua/uv/_meta.lua
runtime/lua/vim/_meta
runtime/lua/vim/re.lua
# These are formatted explicitly by the "formatlua2" build task.
test/functional/ui/decorations_spec.lua
test/functional/ui/float_spec.lua
test/functional/ui/multigrid_spec.lua
test/functional/fixtures/lua/syntax_error.lua
test/functional/legacy/030_fileformats_spec.lua
test/functional/legacy/044_099_regexp_multibyte_magic_spec.lua
test/functional/legacy/093_mksession_cursor_cols_latin1_spec.lua

173
.travis.yml Normal file
View File

@ -0,0 +1,173 @@
dist: xenial
language: c
env:
global:
# Set "false" to force rebuild of third-party dependencies.
- CACHE_ENABLE=true
# Build directory for Neovim.
- BUILD_DIR="$TRAVIS_BUILD_DIR/build"
# Build directory for third-party dependencies.
- DEPS_BUILD_DIR="$HOME/nvim-deps"
# Install directory for Neovim.
- INSTALL_PREFIX="$HOME/nvim-install"
# Log directory for Clang sanitizers and Valgrind.
- LOG_DIR="$BUILD_DIR/log"
# Nvim log file.
- NVIM_LOG_FILE="$BUILD_DIR/.nvimlog"
# Default CMake flags.
- CMAKE_FLAGS="-DTRAVIS_CI_BUILD=ON
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX
-DBUSTED_OUTPUT_TYPE=nvim
-DDEPS_PREFIX=$DEPS_BUILD_DIR/usr
-DMIN_LOG_LEVEL=3"
- DEPS_CMAKE_FLAGS="-DUSE_BUNDLED_GPERF=OFF"
# Additional CMake flags for 32-bit builds.
- CMAKE_FLAGS_32BIT="-DCMAKE_SYSTEM_LIBRARY_PATH=/lib32:/usr/lib32:/usr/local/lib32
-DCMAKE_IGNORE_PATH=/lib:/usr/lib:/usr/local/lib
-DCMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/cmake/i386-linux-gnu.toolchain.cmake"
# Environment variables for Clang sanitizers.
- ASAN_OPTIONS="detect_leaks=1:check_initialization_order=1:log_path=$LOG_DIR/asan"
- TSAN_OPTIONS="log_path=$LOG_DIR/tsan"
- UBSAN_OPTIONS="print_stacktrace=1 log_path=$LOG_DIR/ubsan"
# Environment variables for Valgrind.
- VALGRIND_LOG="$LOG_DIR/valgrind-%p.log"
- CACHE_NVIM_DEPS_DIR="$HOME/.cache/nvim-deps"
# If this file exists, the cache is valid (compile was successful).
- CACHE_MARKER="$CACHE_NVIM_DEPS_DIR/.travis_cache_marker"
# default target name for functional tests
- FUNCTIONALTEST=functionaltest
- CI_TARGET=tests
# Environment variables for ccache
- CCACHE_COMPRESS=1
- CCACHE_SLOPPINESS=time_macros,file_macro
- CCACHE_BASEDIR="$TRAVIS_BUILD_DIR"
# Default since 3.3, but Travis (Xenial) has 3.2.4; required with newer gcc/clang.
- CCACHE_CPP2=1
anchors:
envs: &common-job-env
# Do not fall back to cache for "master" for PR on "release" branch:
# adds the target branch to the cache key.
FOR_TRAVIS_CACHE=v1-$TRAVIS_BRANCH
addons:
apt:
packages: &common-apt-packages
- apport
- autoconf
- automake
- build-essential
- clang
- cmake
- cscope
- gcc-multilib
- gdb
- gperf
- language-pack-tr
- libc6-dev-i386
- libtool-bin
- locales
- ninja-build
- pkg-config
- unzip
- valgrind
- xclip
homebrew:
update: false
packages:
- ccache
- ninja
jobs:
include:
- stage: baseline
name: clang-asan
os: linux
compiler: clang
# Use Lua so that ASAN can test our embedded Lua support. 8fec4d53d0f6
env:
- CLANG_SANITIZER=ASAN_UBSAN
- CMAKE_FLAGS="$CMAKE_FLAGS -DPREFER_LUA=ON"
- *common-job-env
- name: gcc-coverage (gcc 9)
os: linux
compiler: gcc-9
env:
- GCOV=gcov-9
- CMAKE_FLAGS="$CMAKE_FLAGS -DUSE_GCOV=ON"
- GCOV_ERROR_FILE="/tmp/libgcov-errors.log"
- *common-job-env
addons:
apt:
sources:
- sourceline: 'ppa:ubuntu-toolchain-r/test'
packages:
- *common-apt-packages
- gcc-9
- if: branch = master AND commit_message !~ /\[skip.lint\]/
name: lint
os: linux
env:
- CI_TARGET=lint
- *common-job-env
- stage: second stage
name: "macOS: clang"
os: osx
compiler: clang
osx_image: xcode10.2 # macOS 10.14
env:
- *common-job-env
- name: gcc-functionaltest-lua
os: linux
compiler: gcc
env:
- FUNCTIONALTEST=functionaltest-lua
- CMAKE_FLAGS="$CMAKE_FLAGS -DPREFER_LUA=ON"
- DEPS_CMAKE_FLAGS="$DEPS_CMAKE_FLAGS -DUSE_BUNDLED_LUAJIT=OFF"
- *common-job-env
- name: gcc-32bit
os: linux
# Travis creates a cache per compiler. Set a different value here to
# store 32-bit dependencies in a separate cache.
compiler: gcc
env:
- BUILD_32BIT=ON
# Minimum required CMake.
- CMAKE_URL=https://cmake.org/files/v2.8/cmake-2.8.12-Linux-i386.sh
- *common-job-env
- name: clang-tsan
os: linux
compiler: clang
env:
- CLANG_SANITIZER=TSAN
- *common-job-env
fast_finish: true
before_install: ci/before_install.sh
install: ci/install.sh
before_script: ci/before_script.sh
script: ci/script.sh
before_cache: ci/before_cache.sh
branches:
only:
- master
- /^release-\d+\.\d+$/
cache:
apt: true
ccache: true
directories:
- "$CACHE_NVIM_DEPS_DIR"
git:
quiet: true
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/b5c38c99f9677aa3d031

View File

@ -1,122 +1,8 @@
*credits.txt* Nvim
# Bountysource Backers
Thank you to everyone who backed our [Bountysource fundraiser](https://www.bountysource.com/teams/neovim/fundraiser)!
NVIM REFERENCE MANUAL
==============================================================================
Credits *credits*
Most of Vim was written by Bram Moolenaar <Bram@vim.org> |Bram-Moolenaar|.
Parts of the documentation come from several Vi manuals, written by:
W.N. Joy
Alan P.W. Hewett
Mark Horton
The Vim editor is based on Stevie and includes (ideas from) other software,
worked on by the people mentioned here. Other people helped by sending me
patches, suggestions and giving feedback about what is good and bad in Vim.
Vim would never have become what it is now, without the help of these people!
Ron Aaron Win32 GUI changes
Mohsin Ahmed encryption
Zoltan Arpadffy work on VMS port
Tony Andrews Stevie
Gert van Antwerpen changes for DJGPP on MS-DOS
Berkeley DB(3) ideas for swap file implementation
Keith Bostic Nvi
Walter Briscoe Makefile updates, various patches
Ralf Brown SPAWNO library for MS-DOS
Robert Colon many useful remarks
Marcin Dalecki GTK+ GUI port, toolbar icons, gettext()
Kayhan Demirel sent me news in Uganda
Chris & John Downey xvi (ideas for multi-windows version)
Henk Elbers first VMS port
Daniel Elstner GTK+ 2 port
Eric Fischer Mac port, 'cindent', and other improvements
Benji Fisher Answering lots of user questions
Bill Foster Athena GUI port (later removed)
Google Let Bram work on Vim one day a week
Loic Grenie xvim (ideas for multi windows version)
Sven Guckes Vim promoter and previous WWW page maintainer
Darren Hiebert Exuberant ctags
Jason Hildebrand GTK+ 2 port
Bruce Hunsaker improvements for VMS port
Andy Kahn Cscope support, GTK+ GUI port
Oezguer Kesim Maintainer of Vim Mailing Lists
Axel Kielhorn work on the Macintosh port
Steve Kirkendall Elvis
Roger Knobbe original port to Windows NT
Sergey Laskavy Vim's help from Moscow
Felix von Leitner Previous maintainer of Vim Mailing Lists
David Leonard Port of Python extensions to Unix
Avner Lottem Edit in right-to-left windows
Flemming Madsen X11 client-server, various features and patches
Tony Mechelynck answers many user questions
Paul Moore Python interface extensions, many patches
Katsuhito Nagano Work on multibyte versions
Sung-Hyun Nam Work on multibyte versions
Vince Negri Win32 GUI and generic console enhancements
Steve Oualline Author of the first Vim book |frombook|
Dominique Pelle Valgrind reports and many fixes
A.Politz Many bug reports and some fixes
George V. Reilly Win32 port, Win32 GUI start-off
Stephen Riehm bug collector
Stefan Roemer various patches and help to users
Ralf Schandl IBM OS/390 port
Olaf Seibert DICE and BeBox version, regexp improvements
Mortaza Shiran Farsi patches
Peter da Silva termlib
Paul Slootman OS/2 port
Henry Spencer regular expressions
Dany St-Amant Macintosh port
Tim Thompson Stevie
G. R. (Fred) Walter Stevie
Sven Verdoolaege Perl interface
Robert Webb Command-line completion, GUI versions, and
lots of patches
Ingo Wilken Tcl interface
Mike Williams PostScript printing
Juergen Weigert Lattice version, AUX improvements, Unix and
MS-DOS ports, autoconf
Stefan 'Sec' Zehl Maintainer of vim.org
Yasuhiro Matsumoto many MS-Windows improvements
Ken Takata fixes and features
Kazunobu Kuriyama GTK 3
Christian Brabandt many fixes, features, user support, etc.
Yegappan Lakshmanan many quickfix features
I wish to thank all the people that sent me bug reports and suggestions. The
list is too long to mention them all here. Vim would not be the same without
the ideas from all these people: They keep Vim alive!
*love* *peace* *friendship* *gross-national-happiness*
Documentation may refer to other versions of Vi:
*Vi* *vi*
Vi "the original". Without further remarks this is the version
of Vi that appeared in Sun OS 4.x. ":version" returns
"Version 3.7, 6/7/85". Source code only available with a license.
*Nvi*
Nvi The "New" Vi. The version of Vi that comes with BSD 4.4 and FreeBSD.
Very good compatibility with the original Vi, with a few extensions.
The version used is 1.79. ":version" returns "Version 1.79
(10/23/96)". Source code is freely available.
*Elvis*
Elvis Another Vi clone, made by Steve Kirkendall. Very compact but isn't
as flexible as Vim. Source code is freely available.
Vim Nvim is based on Vim. https://www.vim.org/
==============================================================================
Neovim fundraiser backers *backers.txt*
Thank you to everyone who backed the original Neovim Fundraiser.
LIST OF BACKERS
### Your name and URL in BACKERS.md.
- [Bob Breznak](http://brez.io)
- [Tim Uruski](http://timuruski.net)
@ -337,7 +223,7 @@ LIST OF BACKERS
- BenBergman
- Bengt Lüers
- Benjamin Bryant
- Bèr "berkes" Kessels
- Bèr 'berkes' Kessels
- Bernd Homuth
- Bheesham Persaud
- Bilal Quadri
@ -573,7 +459,7 @@ LIST OF BACKERS
- Matthias Lehmann
- Maximilian Gerlach
- Meryn Stol
- Michael "manveru" Fellinger
- Michael 'manveru' Fellinger
- Michael "beefsack" Alexander
- Michael Iles
- Michael Irwin/mdi
@ -755,9 +641,6 @@ LIST OF BACKERS
- Ziling Zhao
- Zsolt Botykai
ANONYMOUS SUPPORTERS
### Anonymous Supporters
There were also 307 other people who didn't claim any level of reward but
contributed to the fundraiser. Thank you all for the support!
vim:tw=78:ts=8:et:ft=help:norl:
There were also 307 other people who didn't claim any level of reward but contributed to the fundraiser. Thank you all for the support!

View File

@ -1,4 +1,4 @@
.DONE:
@echo "Use GNU Make (gmake) to build neovim"
@echo "Please use GNU Make (gmake) to build neovim"
.DEFAULT:
@echo "Use GNU Make (gmake) to build neovim"
@echo "Please use GNU Make (gmake) to build neovim"

480
BUILD.md
View File

@ -1,480 +0,0 @@
- **IMPORTANT**: Before upgrading to a new version, **always check for [breaking changes](https://neovim.io/doc/user/news.html#news-breaking).**
## Quick start
1. Install [build prerequisites](#build-prerequisites) on your system
2. `git clone https://github.com/neovim/neovim`
3. `cd neovim`
- If you want the **stable release**, also run `git checkout stable`.
4. `make CMAKE_BUILD_TYPE=RelWithDebInfo`
- If you want to install to a custom location, set `CMAKE_INSTALL_PREFIX`. See also [INSTALL.md](./INSTALL.md#install-from-source).
- On BSD, use `gmake` instead of `make`.
- To build on Windows, see the [Building on Windows](#building-on-windows) section. _MSVC (Visual Studio) is recommended._
5. `sudo make install`
- Default install location is `/usr/local`
- On Debian/Ubuntu, instead of `sudo make install`, you can try `cd build && cpack -G DEB && sudo dpkg -i nvim-linux-<arch>.deb` (with `<arch>` either `x86_64` or `arm64`) to build DEB-package and install it. This helps ensure clean removal of installed files. Note: This is an unsupported, "best-effort" feature of the Nvim build.
**Notes**:
- From the repository's root directory, running `make` will download and build all the needed dependencies and put the `nvim` executable in `build/bin`.
- Third-party dependencies (libuv, LuaJIT, etc.) are downloaded automatically to `.deps/`. See the [FAQ](https://neovim.io/doc/user/faq.html#faq-build) if you have issues.
- After building, you can run the `nvim` executable without installing it by running `VIMRUNTIME=runtime ./build/bin/nvim`.
- If you plan to develop Neovim, install [Ninja](https://ninja-build.org/) for faster builds. It will automatically be used.
- Install [ccache](https://ccache.dev/) for faster rebuilds of Neovim. It's used by default. To disable it, use `CCACHE_DISABLE=true make`.
## Running tests
See [test/README.md](https://github.com/neovim/neovim/blob/master/test/README.md).
## Building
First make sure you installed the [build prerequisites](#build-prerequisites). Now that you have the dependencies, you can try other build targets explained below.
The _build type_ determines the level of used compiler optimizations and debug information:
- `Release`: Full compiler optimizations and no debug information. Expect the best performance from this build type. Often used by package maintainers.
- `Debug`: Full debug information; few optimizations. Use this for development to get meaningful output from debuggers like GDB or LLDB. This is the default if `CMAKE_BUILD_TYPE` is not specified.
- `RelWithDebInfo` ("Release With Debug Info"): Enables many optimizations and adds enough debug info so that when Neovim ever crashes, you can still get a backtrace.
So, for a release build, just use:
```
make CMAKE_BUILD_TYPE=Release
```
(Do not add a `-j` flag if `ninja` is installed! The build will be in parallel automatically.)
Afterwards, the `nvim` executable can be found in `build/bin`. To verify the build type after compilation, run:
```sh
./build/bin/nvim --version | grep ^Build
```
To install the executable to a certain location, use:
```
make CMAKE_INSTALL_PREFIX=$HOME/local/nvim install
```
CMake, our main build system, caches a lot of things in `build/CMakeCache.txt`. If you ever want to change `CMAKE_BUILD_TYPE` or `CMAKE_INSTALL_PREFIX`, run `rm -rf build` first. This is also required when rebuilding after a Git commit adds or removes files (including from `runtime`) — when in doubt, run `make distclean` (which is basically a shortcut for `rm -rf build .deps`).
By default (`USE_BUNDLED=1`), Neovim downloads and statically links its needed dependencies. In order to be able to use a debugger on these libraries, you might want to compile them with debug information as well:
<!-- THIS CAUSES SCREEN INTERFERENCE
```
make distclean
VERBOSE=1 DEBUG=1 make deps
```
-->
```
make distclean
make deps
```
## Building on Windows
### Windows / MSVC
**MSVC (Visual Studio) is the recommended way to build on Windows.** These steps were confirmed as of 2023.
1. Install [Visual Studio](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community) (2017 or later) with the _Desktop development with C++_ workload.
- On 32-bit Windows, you will need [this workaround](https://developercommunity.visualstudio.com/content/problem/212989/ninja-binary-format.html).
2. Open the Neovim project folder.
- Visual Studio should detect the cmake files and automatically start building...
3. Choose the `nvim.exe (bin\nvim.exe)` target and hit F5.
- If the build fails, it may be because Visual Studio started the build with `x64-{Debug,Release}` before you switched the configuration to `x86-Release`.
- Right-click _CMakeLists.txt → Delete Cache_.
- Right-click _CMakeLists.txt → Generate Cache_.
- If you see an "access violation" from `ntdll`, you can ignore it and continue.
4. If you see an error like `uv.dll not found`, try the `nvim.exe (Install)` target. Then switch back to `nvim.exe (bin\nvim.exe)`.
### Windows / MSVC PowerShell
To build from the command line (i.e. invoke the `cmake` commands yourself),
1. Ensure you have the Visual Studio environment variables, using any of the following:
- Using the [Visual Studio Developer Command Prompt or Visual Studio Developer PowerShell](https://learn.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell?view=vs-2022)
- Invoking `Import-VisualStudioVars` in PowerShell from [this PowerShell module](https://github.com/Pscx/Pscx)
- Invoking `VsDevCmd.bat` in Command Prompt
```
VsDevCmd.bat -arch=x64
```
This is to make sure that `luarocks` finds the Visual Studio installation, and doesn't fall back to MinGW with errors like:
```
'mingw32-gcc' is not recognized as an internal or external command
```
2. From the "Developer PowerShell" or "Developer Command Prompt":
```
cmake -S cmake.deps -B .deps -G Ninja -D CMAKE_BUILD_TYPE=Release
cmake --build .deps --config Release
cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=Release
cmake --build build --config Release
```
- Omit `--config Release` if you want a debug build.
- Omit `-G Ninja` to use the "Visual Studio" generator.
### Windows / CLion
1. Install [CLion](https://www.jetbrains.com/clion/).
2. Open the Neovim project in CLion.
3. Select _Build → Build All in 'Release'_.
### Windows / Cygwin
Install all dependencies the normal way, then build Neovim the normal way for a random CMake application (i.e. do not use the `Makefile` that automatically downloads and builds "bundled" dependencies).
The `cygport` repo contains Cygport files (e.g. `APKBUILD`, `PKGBUILD`) for all the dependencies not available in the Cygwin distribution, and describes any special commands or arguments needed to build. The Cygport definitions also try to describe the required dependencies for each one. Unless custom commands are provided, Cygport just calls `autogen`/`cmake`, `make`, `make install`, etc. in a clean and consistent way.
https://github.com/cascent/neovim-cygwin was built on Cygwin 2.9.0. Newer `libuv` should require slightly less patching. Some SSP stuff changed in Cygwin 2.10.0, so that might change things too when building Neovim.
### Windows / MSYS2 / MinGW
1. From the MSYS2 shell, install these packages:
```
pacman -S \
mingw-w64-ucrt-x86_64-gcc \
mingw-w64-x86_64-{cmake,make,ninja,diffutils}
```
2. From the Windows Command Prompt (`cmd.exe`), set up the `PATH` and build.
```cmd
set PATH=c:\msys64\ucrt64\bin;c:\msys64\usr\bin;%PATH%
```
3. You have two options:
- Build using `cmake` and `Ninja` generator:
```cmd
cmake -S cmake.deps -B .deps -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build .deps
cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build
```
If you cannot install neovim with `ninja install` due to permission restriction, you can install neovim in a directory you have write access to.
```cmd
cmake -S cmake.deps -B .deps -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build .deps
cmake -B build -G Ninja -D CMAKE_INSTALL_PREFIX=C:\nvim -D CMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build
```
- Or, alternatively, you can use `mingw32-make`:
```cmd
mingw32-make deps
mingw32-make CMAKE_BUILD_TYPE=RelWithDebInfo
:: Or you can do the previous command specifying a custom prefix
:: (Default is C:\Program Files (x86)\nvim)
:: mingw32-make CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_INSTALL_PREFIX=C:\nvim
mingw32-make install
```
## Localization
### Localization build
A normal build will create `.mo` files in `build/src/nvim/po`.
* If you see `msgfmt: command not found`, you need to install [`gettext`](http://en.wikipedia.org/wiki/Gettext). On most systems, the package is just called `gettext`.
### Localization check
To check the translations for `$LANG`, run `make -C build check-po-$LANG`. Examples:
```
cmake --build build --target check-po-de
cmake --build build --target check-po-pt_BR
```
- `check-po-$LANG` generates a detailed report in `./build/src/nvim/po/check-${LANG}.log`. (The report is generated by `nvim`, not by `msgfmt`.)
### Localization update
To update the `src/nvim/po/$LANG.po` file with the latest strings, run the following:
```
cmake --build build --target update-po-$LANG
```
- **Note**: Run `src/nvim/po/cleanup.vim` after updating.
## Compiler options
To see the chain of includes, use the `-H` option ([#918](https://github.com/neovim/neovim/issues/918)):
```sh
echo '#include "./src/nvim/buffer.h"' | \
> clang -I.deps/usr/include -Isrc -std=c99 -P -E -H - 2>&1 >/dev/null | \
> grep -v /usr/
```
- `grep -v /usr/` is used to filter out system header files.
- `-save-temps` can be added as well to see expanded macros or commented assembly.
## Custom Makefile
You can customize the build process locally by creating a `local.mk`, which is referenced at the top of the main `Makefile`. It's listed in `.gitignore`, so it can be used across branches. **A new target in `local.mk` overrides the default make-target.**
Here's a sample `local.mk` which adds a target to force a rebuild but *does not* override the default-target:
```make
all:
rebuild:
rm -rf build
make
```
## Third-party dependencies
Reference the [Debian package](https://packages.debian.org/sid/source/neovim) (or alternatively, the [Homebrew formula](https://github.com/Homebrew/homebrew-core/blob/master/Formula/n/neovim.rb)) for the precise list of dependencies/versions.
To build the bundled dependencies using CMake:
```sh
cmake -S cmake.deps -B .deps -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build .deps
```
By default the libraries and headers are placed in `.deps/usr`. Now you can build Neovim:
```sh
cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build
```
### How to build without "bundled" dependencies
1. Manually install the dependencies:
- libuv libluv libutf8proc luajit lua-lpeg tree-sitter tree-sitter-c tree-sitter-lua tree-sitter-markdown tree-sitter-query tree-sitter-vim tree-sitter-vimdoc unibilium
2. Run CMake:
```sh
cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build
```
If all the dependencies are not available in the package, you can use only some of the bundled dependencies as follows (example of using `ninja`):
```sh
cmake -S cmake.deps -B .deps -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo -DUSE_BUNDLED=OFF -DUSE_BUNDLED_TS=ON
cmake --build .deps
cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build
```
3. Run `make`, `ninja`, or whatever build tool you told CMake to generate.
- Using `ninja` is strongly recommended.
4. If treesitter parsers are not bundled, they need to be available in a `parser/` runtime directory (e.g. `/usr/share/nvim/runtime/parser/`).
### How to build static binary (on Linux)
1. Use a linux distribution which uses musl C. We will use Alpine Linux but any distro with musl should work. (glibc does not support static linking)
2. Run make passing the `STATIC_BUILD` variable: `make CMAKE_EXTRA_FLAGS="-DSTATIC_BUILD=1"`
In case you are not using Alpine Linux you can use a container to do the build the binary:
```bash
podman run \
--rm \
-it \
-v "$PWD:/workdir" \
-w /workdir \
alpine:latest \
bash -c 'apk add build-base cmake coreutils curl gettext-tiny-dev && make CMAKE_EXTRA_FLAGS="-DSTATIC_BUILD=1"'
```
The resulting binary in `build/bin/nvim` will have all the dependencies statically linked:
```
build/bin/nvim: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, BuildID[sha1]=b93fa8e678d508ac0a76a2e3da20b119105f1b2d, with debug_info, not stripped
```
#### Debian 10 (Buster) example:
```sh
sudo apt install luajit libluajit-5.1-dev lua-lpeg libunibilium-dev
cmake -S cmake.deps -B .deps -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo -DUSE_BUNDLED=OFF -DUSE_BUNDLED_LIBUV=ON -DUSE_BUNDLED_LUV=ON -DUSE_BUNDLED_TS=ON -DUSE_BUNDLED_UTF8PROC=ON
cmake --build .deps
cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build
```
#### Example of using a Makefile
- Example of using a package with all dependencies:
```
make USE_BUNDLED=OFF
```
- Example of using a package with some dependencies:
```
make BUNDLED_CMAKE_FLAG="-DUSE_BUNDLED=OFF -DUSE_BUNDLED_LUV=ON -DUSE_BUNDLED_TS=ON -DUSE_BUNDLED_LIBUV=ON"
```
## Build prerequisites
General requirements (see [#1469](https://github.com/neovim/neovim/issues/1469#issuecomment-63058312)):
- Clang or GCC version 4.9+
- CMake version 3.16+, built with TLS/SSL support
- Optional: Get the latest CMake from https://cmake.org/download/
- Provides a shell script which works on most Linux systems. After running it, ensure the resulting `cmake` binary is in your $PATH so the the Nvim build will find it.
Platform-specific requirements are listed below.
### Ubuntu / Debian
```sh
sudo apt-get install ninja-build gettext cmake curl build-essential
```
### RHEL / Fedora
```
sudo dnf -y install ninja-build cmake gcc make gettext curl glibc-gconv-extra
```
### openSUSE
```
sudo zypper install ninja cmake gcc-c++ gettext-tools curl
```
### Arch Linux
```
sudo pacman -S base-devel cmake ninja curl
```
### Alpine Linux
```
apk add build-base cmake coreutils curl gettext-tiny-dev
```
### Void Linux
```
xbps-install base-devel cmake curl git
```
### NixOS / Nix
Starting from NixOS 18.03, the Neovim binary resides in the `neovim-unwrapped` Nix package (the `neovim` package being just a wrapper to setup runtime options like Ruby/Python support):
```sh
cd path/to/neovim/src
```
Drop into `nix-shell` to pull in the Neovim dependencies:
```
nix-shell '<nixpkgs>' -A neovim-unwrapped
```
Configure and build:
```sh
rm -rf build && cmakeConfigurePhase
buildPhase
```
Tests are not available by default, because of some unfixed failures. You can enable them via adding this package in your overlay:
```
neovim-dev = (super.pkgs.neovim-unwrapped.override {
doCheck=true;
}).overrideAttrs(oa:{
cmakeBuildType="debug";
nativeBuildInputs = oa.nativeBuildInputs ++ [ self.pkgs.valgrind ];
shellHook = ''
export NVIM_PYTHON_LOG_LEVEL=DEBUG
export NVIM_LOG_FILE=/tmp/log
export VALGRIND_LOG="$PWD/valgrind.log"
'';
});
```
and replacing `neovim-unwrapped` with `neovim-dev`:
```
nix-shell '<nixpkgs>' -A neovim-dev
```
A flake for Neovim is hosted at [nix-community/neovim-nightly-overlay](https://github.com/nix-community/neovim-nightly-overlay/), with 3 packages:
- `neovim` to run the nightly
- `neovim-debug` to run the package with debug symbols
- `neovim-developer` to get all the tools to develop on `neovim`
Thus you can run Neovim nightly with `nix run github:nix-community/neovim-nightly-overlay`.
Similarly to develop on Neovim: `nix run github:nix-community/neovim-nightly-overlay#neovim-developer`.
To use a specific version of Neovim, you can pass `--override-input neovim-src .` to use your current directory,
or a specific SHA1 like `--override-input neovim-src github:neovim/neovim/89dc8f8f4e754e70cbe1624f030fb61bded41bc2`.
### FreeBSD
```
sudo pkg install cmake gmake sha wget gettext curl
```
If you get an error regarding a `sha256sum` mismatch, where the actual SHA-256 hash is `e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`, then this is your issue (that's the `sha256sum` of an empty file).
### OpenBSD
```sh
doas pkg_add gmake cmake curl gettext-tools
```
Build can sometimes fail when using the top level `Makefile`, apparently due to some third-party component (see [#2445-comment](https://github.com/neovim/neovim/issues/2445#issuecomment-108124236)). The following instructions use CMake:
```sh
mkdir .deps
cd .deps
cmake ../cmake.deps/
gmake
cd ..
mkdir build
cd build
cmake ..
gmake
```
### macOS
#### macOS / Homebrew
1. Install Xcode Command Line Tools: `xcode-select --install`
2. Install [Homebrew](http://brew.sh)
3. Install Neovim build dependencies:
```
brew install ninja cmake gettext curl
```
- **Note**: If you see Wget certificate errors (for older macOS versions less than 10.10):
```sh
brew install curl-ca-bundle
echo CA_CERTIFICATE=$(brew --prefix curl-ca-bundle)/share/ca-bundle.crt >> ~/.wgetrc
```
- **Note**: If you see `'stdio.h' file not found`, try the following:
```
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
```
#### macOS / MacPorts
1. Install Xcode Command Line Tools: `xcode-select --install`
2. Install [MacPorts](http://www.macports.org)
3. Install Neovim build dependencies:
```
sudo port install ninja cmake gettext
```
- **Note**: If you see Wget certificate errors (for older macOS versions less than 10.10):
```sh
sudo port install curl-ca-bundle
echo CA_CERTIFICATE=/opt/local/share/curl/curl-ca-bundle.crt >> ~/.wgetrc
```
- **Note**: If you see `'stdio.h' file not found`, try the following:
```
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
```
#### Building for older macOS versions
From a newer macOS version, to build for older macOS versions, you will have to set the macOS deployment target:
```
make CMAKE_BUILD_TYPE=Release MACOSX_DEPLOYMENT_TARGET=10.13 DEPS_CMAKE_FLAGS="-DCMAKE_CXX_COMPILER=$(xcrun -find c++)"
```
Note that the C++ compiler is explicitly set so that it can be found when the deployment target is set.

View File

@ -1,73 +1,18 @@
# CMAKE REFERENCE
# - intro: https://codingnest.com/basic-cmake/
# - best practices (3.0+): https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1
# - pitfalls: https://izzys.casa/2019/02/everything-you-never-wanted-to-know-about-cmake/
# - troubleshooting:
# - variable_watch https://cmake.org/cmake/help/latest/command/variable_watch.html
# - verbose output: cmake --build build --verbose
# Version should match the tested CMAKE_URL in .github/workflows/build.yml.
cmake_minimum_required(VERSION 3.16)
# intro: https://codingnest.com/basic-cmake/
# best practices (3.0+): https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1
# Version should match the tested CMAKE_URL in .travis.yml.
cmake_minimum_required(VERSION 2.8.12)
project(nvim C)
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()
if(XCODE)
message(FATAL_ERROR [[Xcode generator is not supported. Use "Ninja" or "Unix Makefiles" instead]])
endif()
# Point CMake at any custom modules we may ship
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include(CheckCCompilerFlag)
include(CheckCSourceCompiles)
include(CheckLibraryExists)
include(ExternalProject)
include(FindPackageHandleStandardArgs)
include(GNUInstallDirs)
include(Deps)
include(Find)
include(InstallHelpers)
# We don't support building in-tree.
include(PreventInTreeBuilds)
include(Util)
if(NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
# Auto-create a .gitignore in the specified "build" directory.
file(GENERATE OUTPUT .gitignore CONTENT "*")
endif()
#-------------------------------------------------------------------------------
# User settings
#-------------------------------------------------------------------------------
set(DEPS_IGNORE_SHA FALSE)
#-------------------------------------------------------------------------------
# Variables
#-------------------------------------------------------------------------------
set(FUNCS_DATA ${PROJECT_BINARY_DIR}/funcs_data.mpack)
set(TOUCHES_DIR ${PROJECT_BINARY_DIR}/touches)
set(VTERM_TEST_FILE ${PROJECT_BINARY_DIR}/test/vterm_test_output)
file(GLOB DOCFILES CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/runtime/doc/*.txt)
if(NOT CI_BUILD)
set(CMAKE_INSTALL_MESSAGE NEVER)
endif()
if(${CMAKE_VERSION} VERSION_LESS 3.20)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
endif()
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.26)
set(COPY_DIRECTORY copy_directory_if_different)
else()
set(COPY_DIRECTORY copy_directory)
endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Prefer our bundled versions of dependencies.
if(DEFINED ENV{DEPS_BUILD_DIR})
@ -84,16 +29,16 @@ else()
file(MAKE_DIRECTORY ${DEPS_BUILD_DIR})
execute_process(
COMMAND ${CMAKE_COMMAND} -G ${CMAKE_GENERATOR}
-D CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-D CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-D CMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-D CMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-D CMAKE_C_FLAGS_DEBUG=${CMAKE_C_FLAGS_DEBUG}
-D CMAKE_C_FLAGS_MINSIZEREL=${CMAKE_C_FLAGS_MINSIZEREL}
-D CMAKE_C_FLAGS_RELWITHDEBINFO=${CMAKE_C_FLAGS_RELWITHDEBINFO}
-D CMAKE_C_FLAGS_RELEASE=${CMAKE_C_FLAGS_RELEASE}
-D CMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
${PROJECT_SOURCE_DIR}/cmake.deps
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_C_FLAGS_DEBUG=${CMAKE_C_FLAGS_DEBUG}
-DCMAKE_C_FLAGS_MINSIZEREL=${CMAKE_C_FLAGS_MINSIZEREL}
-DCMAKE_C_FLAGS_RELWITHDEBINFO=${CMAKE_C_FLAGS_RELWITHDEBINFO}
-DCMAKE_C_FLAGS_RELEASE=${CMAKE_C_FLAGS_RELEASE}
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
${PROJECT_SOURCE_DIR}/third-party
WORKING_DIRECTORY ${DEPS_BUILD_DIR})
execute_process(
COMMAND ${CMAKE_COMMAND} --build ${DEPS_BUILD_DIR}
@ -102,25 +47,41 @@ else()
endif()
endif()
list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX})
if(CMAKE_CROSSCOMPILING AND NOT UNIX)
list(INSERT CMAKE_FIND_ROOT_PATH 0 ${DEPS_PREFIX})
list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX}/../host/bin)
else()
list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX})
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${DEPS_PREFIX}/lib/pkgconfig")
endif()
if(APPLE)
# If the macOS deployment target is not set manually (via $MACOSX_DEPLOYMENT_TARGET),
# fall back to local system version. Needs to be done both here and in cmake.deps.
if(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
execute_process(COMMAND sw_vers -productVersion
OUTPUT_VARIABLE MACOS_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "${MACOS_VERSION}")
# used for check_c_compiler_flag
include(CheckCCompilerFlag)
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# CMake tries to treat /sw and /opt/local as extension of the system path, but
# that doesn't really work out very well. Once you have a dependency that
# resides there and have to add it as an include directory, then any other
# dependency that could be satisfied from there must be--otherwise you can end
# up with conflicting versions. So, let's make them more of a priority having
# them be included as one of the first places to look for dependencies.
list(APPEND CMAKE_PREFIX_PATH /sw /opt/local)
# Work around some old, broken detection by CMake for knowing when to use the
# isystem flag. Apple's compilers have supported this for quite some time
# now.
if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
endif()
message(STATUS "Using deployment target ${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif()
if(WIN32 OR APPLE)
# Handle case-insensitive filenames for Windows and Mac.
set(CASE_INSENSITIVE_FILENAME TRUE)
if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# Enable fixing case-insensitive filenames for Windows and Mac.
set(USE_FNAME_CASE TRUE)
endif()
option(ENABLE_LIBINTL "enable libintl" ON)
option(ENABLE_LIBICONV "enable libiconv" ON)
if (MINGW)
# Disable LTO by default as it may not compile
# See https://github.com/Alexpux/MINGW-packages/issues/3516
@ -129,49 +90,386 @@ if (MINGW)
else()
option(ENABLE_LTO "enable link time optimization" ON)
endif()
option(ENABLE_LIBINTL "enable libintl" ON)
option(ENABLE_WASMTIME "enable wasmtime" OFF)
message(STATUS "CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
set_default_buildtype(Debug)
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(NOT isMultiConfig)
# Unlike build dependencies in cmake.deps, we want dev dependencies such as
# Uncrustify to always be built with Release.
list(APPEND DEPS_CMAKE_ARGS -D CMAKE_BUILD_TYPE=Release)
# Build type.
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "CMAKE_BUILD_TYPE not specified, default is 'Debug'")
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build" FORCE)
else()
message(STATUS "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
endif()
if(CMAKE_BUILD_TYPE MATCHES Debug)
set(DEBUG 1)
else()
set(DEBUG 0)
endif()
# Set available build types for CMake GUIs.
# Other build types can still be set by -DCMAKE_BUILD_TYPE=...
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
# If not in a git repo (e.g., a tarball) these tokens define the complete
# version string, else they are combined with the result of `git describe`.
set(NVIM_VERSION_MAJOR 0)
set(NVIM_VERSION_MINOR 12)
set(NVIM_VERSION_PATCH 0)
set(NVIM_VERSION_PRERELEASE "-dev") # for package maintainers
set(NVIM_VERSION_MINOR 4)
set(NVIM_VERSION_PATCH 2)
set(NVIM_VERSION_PRERELEASE "") # for package maintainers
# API level
set(NVIM_API_LEVEL 14) # Bump this after any API/stdlib change.
set(NVIM_API_LEVEL 6) # Bump this after any API change.
set(NVIM_API_LEVEL_COMPAT 0) # Adjust this after a _breaking_ API change.
set(NVIM_API_PRERELEASE true)
set(NVIM_API_PRERELEASE false)
file(TO_CMAKE_PATH ${CMAKE_CURRENT_LIST_DIR}/.git FORCED_GIT_DIR)
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC NVIM_VERSION_COMMIT)
if(NVIM_VERSION_COMMIT) # is a git repo
git_describe(NVIM_VERSION_MEDIUM)
# `git describe` annotates the most recent tagged release; for pre-release
# builds we must replace that with the unreleased version.
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+"
"v${NVIM_VERSION_MAJOR}.${NVIM_VERSION_MINOR}.${NVIM_VERSION_PATCH}"
NVIM_VERSION_MEDIUM
${NVIM_VERSION_MEDIUM})
endif()
set(NVIM_VERSION_BUILD_TYPE "${CMAKE_BUILD_TYPE}")
# NVIM_VERSION_CFLAGS set further below.
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Minimize logging for release-type builds.
if(NOT CMAKE_C_FLAGS_RELEASE MATCHES DMIN_LOG_LEVEL)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DMIN_LOG_LEVEL=3")
endif()
if(NOT CMAKE_C_FLAGS_MINSIZEREL MATCHES DMIN_LOG_LEVEL)
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -DMIN_LOG_LEVEL=3")
endif()
if(NOT CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES DMIN_LOG_LEVEL)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DMIN_LOG_LEVEL=3")
endif()
# Log level (MIN_LOG_LEVEL in log.h)
if("${MIN_LOG_LEVEL}" MATCHES "^$")
message(STATUS "MIN_LOG_LEVEL not specified, default is 1 (INFO)")
else()
if(NOT MIN_LOG_LEVEL MATCHES "^[0-3]$")
message(FATAL_ERROR "invalid MIN_LOG_LEVEL: " ${MIN_LOG_LEVEL})
endif()
message(STATUS "MIN_LOG_LEVEL=${MIN_LOG_LEVEL}")
endif()
# Default to -O2 on release builds.
if(CMAKE_C_FLAGS_RELEASE MATCHES "-O3")
message(STATUS "Replacing -O3 in CMAKE_C_FLAGS_RELEASE with -O2")
string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
endif()
if(CMAKE_COMPILER_IS_GNUCC)
check_c_compiler_flag(-Og HAS_OG_FLAG)
else()
set(HAS_OG_FLAG 0)
endif()
#
# Build-type: RelWithDebInfo
#
if(HAS_OG_FLAG)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -Og -g")
endif()
# We _want_ assertions in RelWithDebInfo build-type.
if(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES DNDEBUG)
string(REPLACE "-DNDEBUG" "-DRELDEBUG" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
string(REPLACE "/DNDEBUG" "/DRELDEBUG" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
string(REPLACE " " " " CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") # Remove duplicate whitespace
string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
endif()
option(ENABLE_ASAN_UBSAN "Enable Clang address & undefined behavior sanitizer for nvim binary." OFF)
option(ENABLE_MSAN "Enable Clang memory sanitizer for nvim binary." OFF)
# TSAN exists to test Luv threads.
option(ENABLE_TSAN "Enable Clang thread sanitizer for nvim binary." OFF)
# gcc 4.0+ sets _FORTIFY_SOURCE=2 automatically. This currently
# does not work with Neovim due to some uses of dynamically-sized structures.
# https://github.com/neovim/neovim/issues/223
include(CheckCSourceCompiles)
if((ENABLE_ASAN_UBSAN AND ENABLE_MSAN)
OR (ENABLE_ASAN_UBSAN AND ENABLE_TSAN)
OR (ENABLE_MSAN AND ENABLE_TSAN))
# Include the build type's default flags in the check for _FORTIFY_SOURCE,
# otherwise we may incorrectly identify the level as acceptable and find out
# later that it was not when optimizations were enabled. CFLAGS is applied
# even though you don't see it in CMAKE_REQUIRED_FLAGS.
set(INIT_FLAGS_NAME CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE})
string(TOUPPER ${INIT_FLAGS_NAME} INIT_FLAGS_NAME)
if(${INIT_FLAGS_NAME})
set(CMAKE_REQUIRED_FLAGS "${${INIT_FLAGS_NAME}}")
endif()
# Include <string.h> because some toolchains define _FORTIFY_SOURCE=2 in
# internal header files, which should in turn be #included by <string.h>.
check_c_source_compiles("
#include <string.h>
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 1
#error \"_FORTIFY_SOURCE > 1\"
#endif
int
main(void)
{
return 0;
}
" HAS_ACCEPTABLE_FORTIFY)
if(NOT HAS_ACCEPTABLE_FORTIFY)
message(STATUS "Unsupported _FORTIFY_SOURCE found, forcing _FORTIFY_SOURCE=1")
# Extract possible prefix to _FORTIFY_SOURCE (e.g. -Wp,-D_FORTIFY_SOURCE).
STRING(REGEX MATCH "[^\ ]+-D_FORTIFY_SOURCE" _FORTIFY_SOURCE_PREFIX "${CMAKE_C_FLAGS}")
STRING(REPLACE "-D_FORTIFY_SOURCE" "" _FORTIFY_SOURCE_PREFIX "${_FORTIFY_SOURCE_PREFIX}" )
if(NOT _FORTIFY_SOURCE_PREFIX STREQUAL "")
message(STATUS "Detected _FORTIFY_SOURCE Prefix=${_FORTIFY_SOURCE_PREFIX}")
endif()
# -U in add_definitions doesn't end up in the correct spot, so we add it to
# the flags variable instead.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_FORTIFY_SOURCE_PREFIX}-U_FORTIFY_SOURCE ${_FORTIFY_SOURCE_PREFIX}-D_FORTIFY_SOURCE=1")
endif()
# Remove --sort-common from linker flags, as this seems to cause bugs (see #2641, #3374).
# TODO: Figure out the root cause.
if(CMAKE_EXE_LINKER_FLAGS MATCHES "--sort-common" OR
CMAKE_SHARED_LINKER_FLAGS MATCHES "--sort-common" OR
CMAKE_MODULE_LINKER_FLAGS MATCHES "--sort-common")
message(STATUS "Removing --sort-common from linker flags")
string(REGEX REPLACE ",--sort-common(=[^,]+)?" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
string(REGEX REPLACE ",--sort-common(=[^,]+)?" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
string(REGEX REPLACE ",--sort-common(=[^,]+)?" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
# If no linker flags remain for a -Wl argument, remove it.
# '-Wl$' will match LDFLAGS="-Wl,--sort-common",
# '-Wl ' will match LDFLAGS="-Wl,--sort-common -Wl,..."
string(REGEX REPLACE "-Wl($| )" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
string(REGEX REPLACE "-Wl($| )" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
string(REGEX REPLACE "-Wl($| )" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
endif()
check_c_source_compiles("
#include <execinfo.h>
int main(void)
{
void *trace[1];
backtrace(trace, 1);
return 0;
}
" HAVE_EXECINFO_BACKTRACE)
check_c_source_compiles("
int main(void)
{
int a = 42;
__builtin_add_overflow(a, a, &a);
__builtin_sub_overflow(a, a, &a);
return 0;
}
" HAVE_BUILTIN_ADD_OVERFLOW)
if(MSVC)
# XXX: /W4 gives too many warnings. #3241
add_compile_options(/W3)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
add_definitions(-DWIN32)
else()
add_compile_options(-Wall -Wextra -pedantic -Wno-unused-parameter
-Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion
-Wmissing-prototypes)
check_c_compiler_flag(-Wimplicit-fallthrough HAS_WIMPLICIT_FALLTHROUGH_FLAG)
if(HAS_WIMPLICIT_FALLTHROUGH_FLAG)
add_compile_options(-Wimplicit-fallthrough)
endif()
# On FreeBSD 64 math.h uses unguarded C11 extension, which taints clang
# 3.4.1 used there.
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND CMAKE_C_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wno-c11-extensions)
endif()
endif()
if(MINGW)
# Use POSIX compatible stdio in Mingw
add_definitions(-D__USE_MINGW_ANSI_STDIO)
endif()
if(WIN32)
# Windows Vista is the minimum supported version
add_definitions(-D_WIN32_WINNT=0x0600)
endif()
# OpenBSD's GCC (4.2.1) doesn't have -Wvla
check_c_compiler_flag(-Wvla HAS_WVLA_FLAG)
if(HAS_WVLA_FLAG)
add_compile_options(-Wvla)
endif()
if(UNIX)
# -fstack-protector breaks non Unix builds even in Mingw-w64
check_c_compiler_flag(-fstack-protector-strong HAS_FSTACK_PROTECTOR_STRONG_FLAG)
check_c_compiler_flag(-fstack-protector HAS_FSTACK_PROTECTOR_FLAG)
if(HAS_FSTACK_PROTECTOR_STRONG_FLAG)
add_compile_options(-fstack-protector-strong)
elseif(HAS_FSTACK_PROTECTOR_FLAG)
add_compile_options(-fstack-protector --param ssp-buffer-size=4)
endif()
endif()
check_c_compiler_flag(-fdiagnostics-color=auto HAS_DIAG_COLOR_FLAG)
if(HAS_DIAG_COLOR_FLAG)
if(CMAKE_GENERATOR MATCHES "Ninja")
add_compile_options(-fdiagnostics-color=always)
else()
add_compile_options(-fdiagnostics-color=auto)
endif()
endif()
option(TRAVIS_CI_BUILD "Travis/QuickBuild CI, extra flags will be set" OFF)
if(TRAVIS_CI_BUILD)
message(STATUS "Travis/QuickBuild CI build enabled")
add_compile_options(-Werror)
if(DEFINED ENV{BUILD_32BIT})
# Get some test coverage for unsigned char
add_compile_options(-funsigned-char)
endif()
endif()
option(LOG_LIST_ACTIONS "Add list actions logging" OFF)
add_definitions(-DINCLUDE_GENERATED_DECLARATIONS)
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
set(NO_UNDEFINED "-Wl,--no-undefined -lsocket")
elseif(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(NO_UNDEFINED "-Wl,--no-undefined")
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${NO_UNDEFINED}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${NO_UNDEFINED}")
# For O_CLOEXEC, O_DIRECTORY, and O_NOFOLLOW flags on older systems
# (pre POSIX.1-2008: glibc 2.11 and earlier). #4042
# For ptsname(). #6743
add_definitions(-D_GNU_SOURCE)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
# Required for luajit.
set(CMAKE_EXE_LINKER_FLAGS
"${CMAKE_EXE_LINKER_FLAGS} -pagezero_size 10000 -image_base 100000000")
set(CMAKE_SHARED_LINKER_FLAGS
"${CMAKE_SHARED_LINKER_FLAGS} -image_base 100000000")
set(CMAKE_MODULE_LINKER_FLAGS
"${CMAKE_MODULE_LINKER_FLAGS} -image_base 100000000")
endif()
include_directories("${PROJECT_BINARY_DIR}/config")
include_directories("${PROJECT_SOURCE_DIR}/src")
find_package(LibUV 1.28.0 REQUIRED)
include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS})
find_package(Msgpack 1.0.0 REQUIRED)
include_directories(SYSTEM ${MSGPACK_INCLUDE_DIRS})
find_package(LibLUV 1.30.0 REQUIRED)
include_directories(SYSTEM ${LIBLUV_INCLUDE_DIRS})
# Note: The test lib requires LuaJIT; it will be skipped if LuaJIT is missing.
option(PREFER_LUA "Prefer Lua over LuaJIT in the nvim executable." OFF)
if(PREFER_LUA)
find_package(Lua 5.1 REQUIRED)
set(LUA_PREFERRED_INCLUDE_DIRS ${LUA_INCLUDE_DIR})
set(LUA_PREFERRED_LIBRARIES ${LUA_LIBRARIES})
# Passive (not REQUIRED): if LUAJIT_FOUND is not set, nvim-test is skipped.
find_package(LuaJit)
else()
find_package(LuaJit REQUIRED)
set(LUA_PREFERRED_INCLUDE_DIRS ${LUAJIT_INCLUDE_DIRS})
set(LUA_PREFERRED_LIBRARIES ${LUAJIT_LIBRARIES})
endif()
list(APPEND CMAKE_REQUIRED_INCLUDES "${MSGPACK_INCLUDE_DIRS}")
check_c_source_compiles("
#include <msgpack.h>
int
main(void)
{
return MSGPACK_OBJECT_FLOAT32;
}
" MSGPACK_HAS_FLOAT32)
list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${MSGPACK_INCLUDE_DIRS}")
if(MSGPACK_HAS_FLOAT32)
add_definitions(-DNVIM_MSGPACK_HAS_FLOAT32)
endif()
option(FEAT_TUI "Enable the Terminal UI" ON)
if(FEAT_TUI)
find_package(UNIBILIUM 2.0 REQUIRED)
include_directories(SYSTEM ${UNIBILIUM_INCLUDE_DIRS})
list(APPEND CMAKE_REQUIRED_INCLUDES "${UNIBILIUM_INCLUDE_DIRS}")
list(APPEND CMAKE_REQUIRED_LIBRARIES "${UNIBILIUM_LIBRARIES}")
check_c_source_compiles("
#include <unibilium.h>
int
main(void)
{
return unibi_num_from_var(unibi_var_from_num(0));
}
" UNIBI_HAS_VAR_FROM)
list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${UNIBILIUM_INCLUDE_DIRS}")
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${UNIBILIUM_LIBRARIES}")
if(UNIBI_HAS_VAR_FROM)
add_definitions(-DNVIM_UNIBI_HAS_VAR_FROM)
endif()
find_package(LibTermkey 0.18 REQUIRED)
include_directories(SYSTEM ${LIBTERMKEY_INCLUDE_DIRS})
endif()
find_package(LIBVTERM 0.1 REQUIRED)
include_directories(SYSTEM ${LIBVTERM_INCLUDE_DIRS})
if(WIN32)
find_package(Winpty 0.4.3 REQUIRED)
include_directories(SYSTEM ${WINPTY_INCLUDE_DIRS})
endif()
option(CLANG_ASAN_UBSAN "Enable Clang address & undefined behavior sanitizer for nvim binary." OFF)
option(CLANG_MSAN "Enable Clang memory sanitizer for nvim binary." OFF)
option(CLANG_TSAN "Enable Clang thread sanitizer for nvim binary." OFF)
if((CLANG_ASAN_UBSAN AND CLANG_MSAN)
OR (CLANG_ASAN_UBSAN AND CLANG_TSAN)
OR (CLANG_MSAN AND CLANG_TSAN))
message(FATAL_ERROR "Sanitizers cannot be enabled simultaneously")
endif()
if((CLANG_ASAN_UBSAN OR CLANG_MSAN OR CLANG_TSAN) AND NOT CMAKE_C_COMPILER_ID MATCHES "Clang")
message(FATAL_ERROR "Sanitizers are only supported for Clang")
endif()
if(ENABLE_LIBINTL)
# LibIntl (not Intl) selects our FindLibIntl.cmake script. #8464
find_package(LibIntl REQUIRED)
include_directories(SYSTEM ${LibIntl_INCLUDE_DIRS})
endif()
if(ENABLE_LIBICONV)
find_package(Iconv REQUIRED)
include_directories(SYSTEM ${Iconv_INCLUDE_DIRS})
endif()
# Determine platform's threading library. Set CMAKE_THREAD_PREFER_PTHREAD
# explicitly to indicate a strong preference for pthread.
set(CMAKE_THREAD_PREFER_PTHREAD ON)
find_package(Threads REQUIRED)
# Place targets in bin/ or lib/ for all build configurations
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
@ -183,198 +481,199 @@ foreach(CFGNAME ${CMAKE_CONFIGURATION_TYPES})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFGNAME} ${CMAKE_BINARY_DIR}/lib)
endforeach()
if(NOT PREFER_LUA)
find_program(LUA_PRG NAMES luajit)
endif()
find_program(LUA_PRG NAMES lua5.1 lua5.2 lua)
mark_as_advanced(LUA_PRG)
# Find Lua interpreter
include(LuaHelpers)
set(LUA_DEPENDENCIES lpeg mpack bit)
if(NOT LUA_PRG)
message(FATAL_ERROR "Failed to find a Lua 5.1-compatible interpreter")
endif()
message(STATUS "Using Lua interpreter: ${LUA_PRG}")
foreach(CURRENT_LUA_PRG luajit lua5.1 lua5.2 lua)
# If LUA_PRG is set find_program() will not search
unset(LUA_PRG CACHE)
unset(LUA_PRG_WORKS)
find_program(LUA_PRG ${CURRENT_LUA_PRG})
# Some of the code generation still relies on stable table ordering in order to
# produce reproducible output - specifically the msgpack'ed data in
# funcs_metadata.generated.h and ui_events_metadata.generated.h. This should
# ideally be fixed in the generators, but until then as a workaround you may provide
# a specific lua implementation that provides the needed stability by setting LUA_GEN_PRG:
if(NOT LUA_GEN_PRG)
set(LUA_GEN_PRG "${LUA_PRG}" CACHE FILEPATH "Path to the lua used for code generation.")
endif()
mark_as_advanced(LUA_GEN_PRG)
message(STATUS "Using Lua interpreter for code generation: ${LUA_GEN_PRG}")
option(COMPILE_LUA "Pre-compile Lua sources into bytecode (for sources that are included in the binary)" ON)
if(COMPILE_LUA AND NOT WIN32)
if(PREFER_LUA)
foreach(CURRENT_LUAC_PRG luac5.1 luac)
find_program(_CHECK_LUAC_PRG ${CURRENT_LUAC_PRG})
if(_CHECK_LUAC_PRG)
set(LUAC_PRG "${_CHECK_LUAC_PRG} -s -o - %s" CACHE STRING "Format for compiling to Lua bytecode")
if(LUA_PRG)
check_lua_deps(${LUA_PRG} "${LUA_DEPENDENCIES}" LUA_PRG_WORKS)
if(LUA_PRG_WORKS)
break()
endif()
endforeach()
elseif(LUA_PRG MATCHES "luajit")
check_lua_module(${LUA_PRG} "jit.bcsave" LUAJIT_HAS_JIT_BCSAVE)
if(LUAJIT_HAS_JIT_BCSAVE)
set(LUAC_PRG "${LUA_PRG} -b -s %s -" CACHE STRING "Format for compiling to Lua bytecode")
endif()
endif()
endif()
mark_as_advanced(LUAC_PRG)
if(LUAC_PRG)
message(STATUS "Using Lua compiler: ${LUAC_PRG}")
endforeach()
else()
check_lua_deps(${LUA_PRG} "${LUA_DEPENDENCIES}" LUA_PRG_WORKS)
endif()
# Lint
option(CI_LINT "Abort if lint programs not found" OFF)
if(CI_LINT)
set(LINT_REQUIRED "REQUIRED")
if(NOT LUA_PRG_WORKS)
message(FATAL_ERROR "Failed to find a Lua 5.1-compatible interpreter")
endif()
find_program(SHELLCHECK_PRG shellcheck ${LINT_REQUIRED})
mark_as_advanced(SHELLCHECK_PRG)
find_program(STYLUA_PRG stylua ${LINT_REQUIRED})
mark_as_advanced(STYLUA_PRG)
set(STYLUA_DIRS runtime scripts src test contrib)
message(STATUS "Using Lua interpreter: ${LUA_PRG}")
add_glob_target(
TARGET lintlua-luacheck
COMMAND $<TARGET_FILE:nvim_bin>
FLAGS -ll ${PROJECT_SOURCE_DIR}/test/lua_runner.lua ${CMAKE_BINARY_DIR}/usr/share/lua/5.1 luacheck -q
GLOB_DIRS runtime scripts src test
GLOB_PAT *.lua
TOUCH_STRATEGY PER_DIR)
add_dependencies(lintlua-luacheck lua_dev_deps)
# Setup busted.
find_program(BUSTED_PRG NAMES busted busted.bat)
find_program(BUSTED_LUA_PRG busted-lua)
if(NOT BUSTED_OUTPUT_TYPE)
set(BUSTED_OUTPUT_TYPE "nvim")
endif()
add_glob_target(
TARGET lintlua-stylua
COMMAND ${STYLUA_PRG}
FLAGS --color=always --check --respect-ignores
GLOB_DIRS ${STYLUA_DIRS}
GLOB_PAT *.lua
TOUCH_STRATEGY PER_DIR)
# Special handling of some files (which are ignored in .styluaignore).
# Workaround because stylua doesn't(?) support file-specific settings.
add_custom_target(lintlua-stylua2
COMMAND ${STYLUA_PRG} --config-path "${PROJECT_SOURCE_DIR}/.stylua2.toml"
--color=always --check
"${PROJECT_SOURCE_DIR}/test/functional/ui/decorations_spec.lua"
"${PROJECT_SOURCE_DIR}/test/functional/ui/float_spec.lua"
"${PROJECT_SOURCE_DIR}/test/functional/ui/multigrid_spec.lua"
)
add_dependencies(lintlua-stylua lintlua-stylua2)
find_program(LUACHECK_PRG luacheck)
find_program(FLAKE8_PRG flake8)
find_program(GPERF_PRG gperf)
add_custom_target(lintlua)
add_dependencies(lintlua lintlua-luacheck lintlua-stylua)
add_glob_target(
TARGET lintsh
COMMAND ${SHELLCHECK_PRG}
FLAGS -x -a
GLOB_DIRS scripts
GLOB_PAT *.sh
TOUCH_STRATEGY PER_DIR)
add_custom_target(lintcommit
COMMAND $<TARGET_FILE:nvim_bin> --clean -l ${PROJECT_SOURCE_DIR}/scripts/lintcommit.lua main)
add_dependencies(lintcommit nvim_bin)
add_custom_target(lint)
add_dependencies(lint lintc lintlua lintsh)
# Format
add_glob_target(
TARGET formatlua
COMMAND ${STYLUA_PRG}
FLAGS --respect-ignores
GLOB_DIRS ${STYLUA_DIRS}
GLOB_PAT *.lua
TOUCH_STRATEGY PER_DIR)
# Special handling of some files (which are ignored in .styluaignore).
# Workaround because stylua doesn't(?) support file-specific settings.
add_custom_target(formatlua2
COMMAND ${STYLUA_PRG} --config-path "${PROJECT_SOURCE_DIR}/.stylua2.toml"
"${PROJECT_SOURCE_DIR}/test/functional/ui/decorations_spec.lua"
"${PROJECT_SOURCE_DIR}/test/functional/ui/float_spec.lua"
"${PROJECT_SOURCE_DIR}/test/functional/ui/multigrid_spec.lua"
)
add_dependencies(formatlua formatlua2)
add_custom_target(format)
add_dependencies(format formatc formatlua)
include(InstallHelpers)
file(GLOB MANPAGES
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
man/nvim.1)
install_helper(
FILES ${CMAKE_SOURCE_DIR}/src/man/nvim.1
FILES ${MANPAGES}
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
add_custom_target(nvim ALL)
add_dependencies(nvim nvim_bin nvim_runtime_deps nvim_runtime)
#
# Go down the tree.
#
add_subdirectory(src/nvim)
add_subdirectory(cmake.config)
get_directory_property(NVIM_VERSION_CFLAGS DIRECTORY src/nvim DEFINITION NVIM_VERSION_CFLAGS)
add_subdirectory(test/includes)
add_subdirectory(config)
add_subdirectory(test/functional/fixtures) # compile test programs
add_subdirectory(runtime)
add_subdirectory(test)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/UninstallHelper.cmake)
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(cmake.packaging)
get_directory_property(GENERATED_HELP_TAGS DIRECTORY runtime DEFINITION GENERATED_HELP_TAGS)
if(WIN32)
install_helper(
FILES ${DEPS_PREFIX}/share/nvim-qt/runtime/plugin/nvim_gui_shim.vim
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim-qt/runtime/plugin)
endif()
get_externalproject_options(uncrustify ${DEPS_IGNORE_SHA})
ExternalProject_Add(uncrustify
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/uncrustify
CMAKE_ARGS ${DEPS_CMAKE_ARGS}
-D CMAKE_RUNTIME_OUTPUT_DIRECTORY=${DEPS_BIN_DIR}
-D CMAKE_SKIP_RPATH=true
EXCLUDE_FROM_ALL TRUE
${EXTERNALPROJECT_OPTIONS})
# Setup some test-related bits. We do this after going down the tree because we
# need some of the targets.
if(BUSTED_PRG)
get_property(TEST_INCLUDE_DIRS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
PROPERTY INCLUDE_DIRECTORIES)
option(USE_BUNDLED_BUSTED "Use bundled busted" ON)
if(USE_BUNDLED_BUSTED)
get_externalproject_options(lua_dev_deps ${DEPS_IGNORE_SHA})
ExternalProject_Add(lua_dev_deps
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/lua_dev_deps
SOURCE_DIR ${DEPS_SHARE_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
EXCLUDE_FROM_ALL TRUE
${EXTERNALPROJECT_OPTIONS})
# When running tests from 'ninja' we need to use the
# console pool: to do so we need to use the USES_TERMINAL
# option, but this is only available in CMake 3.2
set(TEST_TARGET_ARGS)
if(NOT (${CMAKE_VERSION} VERSION_LESS 3.2.0))
list(APPEND TEST_TARGET_ARGS "USES_TERMINAL")
endif()
set(UNITTEST_PREREQS nvim-test unittest-headers)
set(FUNCTIONALTEST_PREREQS nvim printargs-test shell-test streams-test ${GENERATED_HELP_TAGS})
if(NOT WIN32)
list(APPEND FUNCTIONALTEST_PREREQS tty-test)
endif()
set(BENCHMARK_PREREQS nvim tty-test)
# Useful for automated build systems, if they want to manually run the tests.
add_custom_target(unittest-prereqs
DEPENDS ${UNITTEST_PREREQS})
set_target_properties(unittest-prereqs PROPERTIES FOLDER test)
add_custom_target(functionaltest-prereqs
DEPENDS ${FUNCTIONALTEST_PREREQS})
add_custom_target(benchmark-prereqs
DEPENDS ${BENCHMARK_PREREQS})
check_lua_module(${LUA_PRG} "ffi" LUA_HAS_FFI)
if(LUA_HAS_FFI)
add_custom_target(unittest
COMMAND ${CMAKE_COMMAND}
-DBUSTED_PRG=${BUSTED_PRG}
-DLUA_PRG=${LUA_PRG}
-DWORKING_DIR=${CMAKE_CURRENT_SOURCE_DIR}
-DBUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
-DBUILD_DIR=${CMAKE_BINARY_DIR}
-DTEST_TYPE=unit
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
DEPENDS ${UNITTEST_PREREQS}
${TEST_TARGET_ARGS})
set_target_properties(unittest PROPERTIES FOLDER test)
else()
message(WARNING "disabling unit tests: no Luajit FFI in ${LUA_PRG}")
endif()
if(LUA_HAS_FFI)
set(TEST_LIBNVIM_PATH $<TARGET_FILE:nvim-test>)
else()
set(TEST_LIBNVIM_PATH "")
endif()
configure_file(
${CMAKE_SOURCE_DIR}/test/config/paths.lua.in
${CMAKE_BINARY_DIR}/test/config/paths.lua.gen)
file(GENERATE
OUTPUT ${CMAKE_BINARY_DIR}/test/config/paths.lua
INPUT ${CMAKE_BINARY_DIR}/test/config/paths.lua.gen)
add_custom_target(functionaltest
COMMAND ${CMAKE_COMMAND}
-DBUSTED_PRG=${BUSTED_PRG}
-DLUA_PRG=${LUA_PRG}
-DNVIM_PRG=$<TARGET_FILE:nvim>
-DWORKING_DIR=${CMAKE_CURRENT_SOURCE_DIR}
-DBUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
-DBUILD_DIR=${CMAKE_BINARY_DIR}
-DTEST_TYPE=functional
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
DEPENDS ${FUNCTIONALTEST_PREREQS}
${TEST_TARGET_ARGS})
set_target_properties(functionaltest functionaltest-prereqs
PROPERTIES FOLDER test)
add_custom_target(benchmark
COMMAND ${CMAKE_COMMAND}
-DBUSTED_PRG=${BUSTED_PRG}
-DLUA_PRG=${LUA_PRG}
-DNVIM_PRG=$<TARGET_FILE:nvim>
-DWORKING_DIR=${CMAKE_CURRENT_SOURCE_DIR}
-DBUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
-DBUILD_DIR=${CMAKE_BINARY_DIR}
-DTEST_TYPE=benchmark
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
DEPENDS ${BENCHMARK_PREREQS}
${TEST_TARGET_ARGS})
set_target_properties(benchmark benchmark-prereqs PROPERTIES FOLDER test)
endif()
if(BUSTED_LUA_PRG)
add_custom_target(functionaltest-lua
COMMAND ${CMAKE_COMMAND}
-DBUSTED_PRG=${BUSTED_LUA_PRG}
-DLUA_PRG=${LUA_PRG}
-DNVIM_PRG=$<TARGET_FILE:nvim>
-DWORKING_DIR=${CMAKE_CURRENT_SOURCE_DIR}
-DBUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
-DBUILD_DIR=${CMAKE_BINARY_DIR}
-DTEST_TYPE=functional
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
DEPENDS ${FUNCTIONALTEST_PREREQS}
${TEST_TARGET_ARGS})
set_target_properties(functionaltest-lua PROPERTIES FOLDER test)
endif()
if(LUACHECK_PRG)
add_custom_target(lualint
COMMAND ${LUACHECK_PRG} -q runtime/ src/ test/
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
else()
add_custom_target(lua_dev_deps)
add_custom_target(lualint false
COMMENT "lualint: LUACHECK_PRG not defined")
endif()
if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm|aarch")
set(LUALS_ARCH arm64)
else()
set(LUALS_ARCH x64)
endif()
set(LUALS_VERSION 3.15.0)
set(LUALS "lua-language-server-${LUALS_VERSION}-${CMAKE_SYSTEM_NAME}-${LUALS_ARCH}")
set(LUALS_TARBALL ${LUALS}.tar.gz)
set(LUALS_URL https://github.com/LuaLS/lua-language-server/releases/download/${LUALS_VERSION}/${LUALS_TARBALL})
ExternalProject_Add(download_luals
URL ${LUALS_URL}
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/luals
SOURCE_DIR ${DEPS_BIN_DIR}/luals
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
EXCLUDE_FROM_ALL TRUE
DOWNLOAD_NO_PROGRESS TRUE
CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS})
file(GLOB_RECURSE LUAFILES runtime/*.lua)
add_target(luals
COMMAND ${DEPS_BIN_DIR}/luals/bin/lua-language-server
--configpath=${PROJECT_SOURCE_DIR}/.luarc.json
--check=${PROJECT_SOURCE_DIR}/runtime
--checklevel=Hint
DEPENDS ${LUAFILES}
CUSTOM_COMMAND_ARGS USES_TERMINAL)
add_dependencies(luals download_luals)
set(CPACK_PACKAGE_NAME "Neovim")
set(CPACK_PACKAGE_VENDOR "neovim.io")
set(CPACK_PACKAGE_VERSION ${NVIM_VERSION_MEDIUM})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "Neovim")
# Set toplevel directory/installer name as Neovim
set(CPACK_PACKAGE_FILE_NAME "Neovim")
set(CPACK_TOPLEVEL_TAG "Neovim")
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
set(CPACK_NSIS_MODIFY_PATH ON)
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
include(CPack)

View File

@ -1,54 +0,0 @@
{
"version": 3,
"configurePresets": [
{
"name": "base",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build",
"hidden": true
},
{
"name": "default",
"displayName": "RelWithDebInfo",
"description": "Enables optimizations with debug information",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
},
"inherits": ["base"]
},
{
"name": "debug",
"displayName": "Debug",
"description": "No optimizations, enables debug information",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
},
"inherits": ["base"]
},
{
"name": "release",
"displayName": "Release",
"description": "Optimized for performance, disables debug information",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
},
"inherits": ["base"]
},
{
"name": "iwyu",
"displayName": "IWYU",
"description": "Run include-what-you-use",
"cacheVariables": {
"ENABLE_IWYU": "ON"
},
"inherits": ["base"]
},
{
"name": "ci",
"cacheVariables": {
"CI_BUILD": "ON"
},
"inherits": ["base"]
}
]
}

View File

@ -7,13 +7,10 @@ Getting started
If you want to help but don't know where to start, here are some
low-risk/isolated tasks:
- [Merge a Vim patch].
- Try a [complexity:low] issue.
- Fix bugs found by [Coverity](#coverity).
- [Merge a Vim patch] (requires strong familiarity with Vim)
- NOTE: read the above link before sending improvements to "runtime files" (anything in `runtime/`).
- Vimscript and documentation files are (mostly) maintained by [Vim], not Nvim.
- Nvim's [filetype detection](https://github.com/neovim/neovim/blob/master/runtime/lua/vim/filetype.lua) behavior matches Vim, so changes to filetype detection should be submitted to [Vim] first.
- Lua files are maintained by Nvim.
- Fix bugs found by [Clang](#clang-scan-build), [PVS](#pvs-studio) or
[Coverity](#coverity).
Reporting problems
------------------
@ -21,147 +18,143 @@ Reporting problems
- [Check the FAQ][wiki-faq].
- [Search existing issues][github-issues] (including closed!)
- Update Neovim to the latest version to see if your problem persists.
- Try to reproduce with `nvim --clean` ("factory defaults").
- If a specific configuration or plugin is necessary to recreate the problem, use the minimal template in `contrib/minimal.lua` with `nvim --clean -u contrib/minimal.lua` after making the necessary changes.
- [Bisect](https://neovim.io/doc/user/starting.html#bisect) your config: disable plugins incrementally, to narrow down the cause of the issue.
- [Bisect][git-bisect] Neovim's source code to find the cause of a regression, if you can. This is _extremely_ helpful.
- When reporting a crash, [include a stacktrace](https://neovim.io/doc/user/dev_tools.html#dev-tools-backtrace).
- Use [ASAN/UBSAN](#sanitizers-asan-and-ubsan) to get detailed errors for segfaults and undefined behavior.
- Check the logs. `:edit $NVIM_LOG_FILE`
- Disable plugins incrementally, to narrow down the cause of the issue.
- When reporting a crash, [include a stacktrace](https://github.com/neovim/neovim/wiki/FAQ#backtrace-linux).
- [Bisect][git-bisect] to the cause of a regression, if you are able. This is _extremely_ helpful.
- Check `$NVIM_LOG_FILE`, if it exists.
- Include `cmake --system-information` for build-related issues.
Developer guidelines
--------------------
- Read [:help dev](https://neovim.io/doc/user/develop.html#dev) and [:help dev-doc][dev-doc-guide] if you are working on Nvim core.
- Read [:help dev-ui](https://neovim.io/doc/user/develop.html#dev-ui) if you are developing a UI.
- Read [:help dev-api-client](https://neovim.io/doc/user/develop.html#dev-api-client) if you are developing an API client.
- Install `ninja` for faster builds of Nvim.
```bash
- Nvim contributors should read `:help dev`.
- External UI developers should read `:help dev-ui`.
- API client developers should read `:help dev-api-client`.
- Nvim developers are _strongly encouraged_ to install `ninja` for faster builds.
```
sudo apt-get install ninja-build
make distclean
make # Nvim build system uses ninja automatically, if available.
```
- Install `ccache` or `sccache` for faster rebuilds of Nvim. Nvim will use one
of these automatically if it's found. To disable caching use:
```bash
cmake -B build -D CACHE_PRG=OFF
```
Pull requests (PRs)
---------------------
- To avoid duplicate work, create a draft pull request.
- Your PR must include [test coverage][run-tests].
- To avoid duplicate work, create a `[WIP]` pull request as soon as possible.
- Your PR must include **test coverage.** See [test/README.md][run-tests].
- Avoid cosmetic changes to unrelated files in the same commit.
- Use a [feature branch][git-feature-branch] instead of the master branch.
- Use a _rebase workflow_ for all PRs.
- After addressing review comments, it's fine to force-push.
- Use a **rebase workflow** for small PRs.
- After addressing review comments, it's fine to rebase and force-push.
- Use a **merge workflow** for big, high-risk PRs.
- Merge `master` into your PR when there are conflicts or when master
introduces breaking changes.
- Use the `ri` git alias:
```
[alias]
ri = "!sh -c 't=\"${1:-master}\"; s=\"${2:-HEAD}\"; mb=\"$(git merge-base \"$t\" \"$s\")\"; if test \"x$mb\" = x ; then o=\"$t\"; else lm=\"$(git log -n1 --merges \"$t..$s\" --pretty=%H)\"; if test \"x$lm\" = x ; then o=\"$mb\"; else o=\"$lm\"; fi; fi; test $# -gt 0 && shift; test $# -gt 0 && shift; git rebase --interactive \"$o\" \"$@\"'"
```
This avoids unnecessary rebases yet still allows you to combine related
commits, separate monolithic commits, etc.
- Do not edit commits that come before the merge commit.
- During a squash/fixup, use `exec make -C build unittest` between each
pick/edit/reword.
### Merging to master
### Stages: WIP, RFC, RDY
For maintainers: when a PR is ready to merge to master,
Pull requests have three stages: `[WIP]` (Work In Progress), `[RFC]` (Request
For Comment) and `[RDY]` (Ready).
- prefer _Squash Merge_ for "single-commit PRs" (when the PR has only one meaningful commit).
- prefer _Merge_ for "multi-commit PRs" (when the PR has multiple meaningful commits).
### Stages: Draft and Ready for review
Pull requests have two stages: Draft and Ready for review.
1. [Create a Draft PR][pr-draft] while you are _not_ requesting feedback as
you are still working on the PR.
- You can skip this if your PR is ready for review.
2. [Change your PR to ready][pr-ready] when the PR is ready for review.
- You can convert back to Draft at any time.
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.
- `[RFC]` is assumed by default, i.e. you are requesting a review.
- Add `[WIP]` to the PR title if you are _not_ requesting feedback and the work
is still in flux.
- Add `[RDY]` if you are _done_ and only waiting on merge.
### Commit messages
Follow the [conventional commits guidelines][conventional_commits] to *make reviews easier* and to make
the VCS/git logs more valuable (try `make lintcommit`). The structure of a commit message is:
Follow [commit message hygiene][hygiene] to *make reviews easier* and to make
the VCS/git logs more valuable.
type(scope): subject
Problem:
...
Solution:
...
- Commit message **subject** (you can **ignore this for "fixup" commits** or any commits you expect to be squashed):
- Prefix with a [_type_](https://github.com/commitizen/conventional-commit-types/blob/master/index.json):
- `build ci docs feat fix perf refactor revert test vim-patch`
- Append an optional `(scope)` such as `(lsp)`, `(treesitter)`, `(float)`, …
- Use the _imperative voice_: "Fix bug" rather than "Fixed bug" or "Fixes bug."
- Keep it short (under 72 characters).
- Commit message **body** (detail):
- Concisely describe the Problem/Solution in the commit **body**. [Describing the problem](https://lamport.azurewebsites.net/pubs/state-the-problem.pdf)
_independently of the solution_ often leads to a better understanding for you, reviewers, and future readers.
```
Problem:
Solution:
```
- Indicate breaking API changes with "!" after the type, and a "BREAKING CHANGE" footer. Example:
```
refactor(provider)!: drop support for Python 2
BREAKING CHANGE: refactor to use Python 3 features since Python 2 is no longer supported.
```
- Try to keep the first line under 72 characters.
- **Prefix the commit subject with a _scope_:** `doc:`, `test:`, `foo.c:`,
`runtime:`, ...
- Subject line for commits with only style/lint changes can be a single
word: `style` or `lint`.
- A blank line must separate the subject from the description.
- Use the _imperative voice_: "Fix bug" rather than "Fixed bug" or "Fixes bug."
### Automated builds (CI)
Each pull request must pass the automated builds on [Cirrus CI] and [GitHub Actions].
Each pull request must pass the automated builds on [Travis CI], [QuickBuild]
and [AppVeyor].
- CI builds are compiled with [`-Werror`][gcc-warnings], so compiler warnings
will fail the build.
- If any tests fail, the build will fail. See [test/README.md#running-tests][run-tests] to run tests locally.
- If any tests fail, the build will fail.
See [test/README.md#running-tests][run-tests] to run tests locally.
Passing locally doesn't guarantee passing the CI build, because of the
different compilers and platforms tested against.
- CI runs [ASan] and other analyzers.
- To run valgrind locally: `VALGRIND=1 make test`
- To run ASan/UBSan locally: `CC=clang make CMAKE_FLAGS="-DENABLE_ASAN_UBSAN=ON"`.
Note that MSVC requires Release or RelWithDebInfo build type to work properly.
- The [lint](#lint) build checks that the code is formatted correctly and
passes various linter checks.
- CI for FreeBSD runs on [Cirrus CI].
- To see CI results faster in your PR, you can temporarily set `TEST_FILE` in
[test.yml](https://github.com/neovim/neovim/blob/ad8e0cfc1dfd937c2577dc032e524c799a772693/.github/workflows/test.yml#L26).
- To run Clang ASan/UBSan locally: `CC=clang make CMAKE_FLAGS="-DCLANG_ASAN_UBSAN=ON"`
- The [lint](#lint) build checks modified lines _and their immediate
neighbors_, to encourage incrementally updating the legacy style to meet our
[style](#style). (See [#3174][3174] for background.)
- [How to investigate QuickBuild failures](https://github.com/neovim/neovim/pull/4718#issuecomment-217631350)
- QuickBuild uses this invocation:
```
mkdir -p build/${params.get("buildType")} \
&& cd build/${params.get("buildType")} \
&& cmake -G "Unix Makefiles" -DBUSTED_OUTPUT_TYPE=TAP -DCMAKE_BUILD_TYPE=${params.get("buildType")}
-DTRAVIS_CI_BUILD=ON ../.. && ${node.getAttribute("make", "make")}
VERBOSE=1 nvim unittest-prereqs functionaltest-prereqs
```
### Clang scan-build
View the [Clang report] to see potential bugs found by the Clang
[scan-build](https://clang-analyzer.llvm.org/scan-build.html) analyzer.
- Search the Neovim commit history to find examples:
```
git log --oneline --no-merges --grep clang
```
- To verify a fix locally, run `scan-build` like this:
```
rm -rf build/
scan-build --use-analyzer=/usr/bin/clang make
```
### PVS-Studio
View the [PVS report](https://neovim.io/doc/reports/pvs/PVS-studio.html.d/) to
see potential bugs found by [PVS Studio](https://www.viva64.com/en/pvs-studio/).
- Use this format for commit messages (where `{id}` is the PVS warning-id)):
```
PVS/V{id}: {description}
```
- Search the Neovim commit history to find examples:
```
git log --oneline --no-merges --grep PVS
```
- Try `./scripts/pvscheck.sh` to run PVS locally.
### Coverity
Coverity runs against the master build. To view the defects you must
[request access](https://scan.coverity.com/projects/neovim-neovim) (Coverity
does not have a "public" view), then you will be approved as soon as
a maintainer sees the email.
[Coverity](https://scan.coverity.com/projects/neovim-neovim) runs against the
master build. To view the defects, just request access; you will be approved.
- Use this format for commit messages (where `{id}` is the CID (Coverity ID);
([example](https://github.com/neovim/neovim/pull/804))):
```
fix(coverity/{id}): {description}
coverity/{id}: {description}
```
- Search the Neovim commit history to find examples:
```bash
```
git log --oneline --no-merges --grep coverity
```
### Sanitizers (ASAN and UBSAN)
ASAN/UBSAN can be used to detect memory errors and other common forms of undefined behavior at runtime in debug builds.
- To build Neovim with sanitizers enabled, use
```
rm -rf build && CMAKE_EXTRA_FLAGS="-DCMAKE_C_COMPILER=clang -DENABLE_ASAN_UBSAN=1" make
```
- When running Neovim, use
```
ASAN_OPTIONS=log_path=/tmp/nvim_asan nvim args...
```
- If Neovim exits unexpectedly, check `/tmp/nvim_asan.{PID}` (or your preferred `log_path`) for log files with error messages.
Coding
------
@ -170,204 +163,69 @@ Coding
You can run the linter locally by:
```bash
make lint
```
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
### Style
- You can format files by using:
```bash
make format # or formatc, formatlua
```
This will format changed Lua and C files with all appropriate flags set.
- Style rules are (mostly) defined by `src/uncrustify.cfg` which tries to match
the [style-guide]. To use the Nvim `gq` command with `uncrustify`:
```vim
if !empty(findfile('src/uncrustify.cfg', ';'))
setlocal formatprg=uncrustify\ -q\ -l\ C\ -c\ src/uncrustify.cfg\ --no-backup
endif
```
- There is also `.clang-format` which has drifted from the [style-guide], but
is available for reference. To use the Nvim `gq` command with `clang-format`:
```vim
if !empty(findfile('.clang-format', ';'))
setlocal formatprg=clang-format\ -style=file
endif
```
The repo includes a `.clang-format` config file which (mostly) matches the
[style-guide]. You can use `clang-format` to format code with the `gq`
operator in Nvim:
if !empty(findfile('.clang-format', ';'))
setlocal formatprg=clang-format\ -style=file
endif
### Navigate
- Set `blame.ignoreRevsFile` to ignore [noisy commits](https://github.com/neovim/neovim/commit/2d240024acbd68c2d3f82bc72cb12b1a4928c6bf) in git blame:
```bash
git config blame.ignoreRevsFile .git-blame-ignore-revs
```
- Recommendation is to use **[clangd]**.
Can use the maintained config in [nvim-lspconfig/clangd].
- Use **[universal-ctags](https://github.com/universal-ctags/ctags).**
("Exuberant ctags", the typical `ctags` binary provided by your distro, is
unmaintained and won't recognize many function signatures in Neovim source.)
- Explore the source code [on the web](https://sourcegraph.com/github.com/neovim/neovim).
### Includes
For managing includes in C files, use [include-what-you-use].
- [Install include-what-you-use][include-what-you-use-install]
- To see which includes needs fixing use the cmake preset `iwyu`:
```bash
cmake --preset iwyu
cmake --build build
```
- There's also a make target that automatically fixes the suggestions from
IWYU:
```bash
make iwyu
```
See [#549][549] for more details.
### Lua runtime files
Most of the Lua core [`runtime/`](./runtime) modules are precompiled to
bytecode, so changes to those files won't get used unless you rebuild Nvim or
by passing `--luamod-dev` and `$VIMRUNTIME`. For example, try adding a function
to `runtime/lua/vim/_editor.lua` then:
```bash
VIMRUNTIME=./runtime ./build/bin/nvim --luamod-dev
```
Documentation
-------------
Read [:help dev-doc][dev-doc-guide] to understand the expected documentation style and conventions.
### Generating :help
Many `:help` docs are autogenerated from (C or Lua) docstrings. To generate the documentation run:
```bash
make doc
```
To validate the documentation files, run:
```bash
make lintdoc
```
If you need to modify or debug the documentation flow, these are the main files:
- `./src/gen/gen_vimdoc.lua`:
Main doc generator. Parses C and Lua files to render vimdoc files.
- `./src/gen/luacats_parser.lua`:
Documentation parser for Lua files.
- `./src/gen/cdoc_parser.lua`:
Documentation parser for C files.
- `./src/gen/luacats_grammar.lua`:
Lpeg grammar for LuaCATS
- `./src/gen/cdoc_grammar.lua`:
Lpeg grammar for C doc comments
- `./src/gen/gen_eval_files.lua`:
Generates documentation and Lua type files from metadata files:
```
runtime/lua/vim/* => runtime/doc/lua.txt
runtime/lua/vim/* => runtime/doc/lua.txt
runtime/lua/vim/lsp/ => runtime/doc/lsp.txt
src/nvim/api/* => runtime/doc/api.txt
src/nvim/eval.lua => runtime/doc/vimfn.txt
src/nvim/options.lua => runtime/doc/options.txt
```
- `./scripts/lintdoc.lua`: Validation and linting of documentation files.
### Lua docstrings
Use [LuaLS] annotations in Lua docstrings to annotate parameter types, return
types, etc. See [:help dev-lua-doc][dev-lua-doc].
- The template for function documentation is:
```lua
--- {Brief}
---
--- {Long explanation}
---
--- @param arg1 type {description}
--- @param arg2 type {description}
--- ...
---
--- @return type {description}
```
- If possible, 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, add `@nodoc`.
- If the function is internal or otherwise non-public add `@private`.
- Private functions usually should be underscore-prefixed (named "_foo", not "foo"). Prefixing with an underscore implies `@nodoc`.
- Mark deprecated functions with `@deprecated`.
Third-party dependencies
------------------------
To build Nvim using a different commit of a dependency change the appropriate
URL in `cmake.deps/deps.txt`. For example, to use a different version of luajit
replace the value in `LUAJIT_URL` with the wanted commit hash:
```bash
LUAJIT_URL https://github.com/LuaJIT/LuaJIT/archive/<sha>.tar.gz
```
Set `DEPS_IGNORE_SHA` to `TRUE` in `cmake.deps/CMakeLists.txt` to skip hash
check from cmake.
Alternatively, you may point the URL as a local path where the repository is.
This is convenient when bisecting a problem in a dependency with `git bisect`.
This may require running `make distclean` between each build. Hash checking is
always skipped in this case regardless of `DEPS_IGNORE_SHA`.
```bash
LUAJIT_URL /home/user/luajit
```
Reviewing
---------
To help review pull requests, start with [this checklist][review-checklist].
Reviewing can be done on GitHub, but you may find it easier to do locally.
Using [GitHub CLI][gh], you can create a new branch with the contents of a pull
Using [`hub`][hub], you can create a new branch with the contents of a pull
request, e.g. [#1820][1820]:
```bash
gh pr checkout https://github.com/neovim/neovim/pull/1820
```
hub checkout https://github.com/neovim/neovim/pull/1820
Use [`git log -p master..FETCH_HEAD`][git-history-filtering] 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.
[549]: https://github.com/neovim/neovim/issues/549
[1820]: https://github.com/neovim/neovim/pull/1820
[3174]: https://github.com/neovim/neovim/issues/3174
[ASan]: http://clang.llvm.org/docs/AddressSanitizer.html
[Cirrus CI]: https://cirrus-ci.com/github/neovim/neovim
[Clang report]: https://neovim.io/doc/reports/clang/
[GitHub Actions]: https://github.com/neovim/neovim/actions
[Vim]: https://github.com/vim/vim
[clangd]: https://clangd.llvm.org
[Merge a Vim patch]: https://neovim.io/doc/user/dev_vimpatch.html
[complexity:low]: https://github.com/neovim/neovim/issues?q=is%3Aopen+is%3Aissue+label%3Acomplexity%3Alow
[conventional_commits]: https://www.conventionalcommits.org
[dev-doc-guide]: https://neovim.io/doc/user/develop.html#dev-doc
[dev-lua-doc]: https://neovim.io/doc/user/develop.html#dev-lua-doc
[LuaLS]: https://luals.github.io/wiki/annotations/
[gcc-warnings]: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
[gh]: https://cli.github.com/
[git-bisect]: http://git-scm.com/book/en/v2/Git-Tools-Debugging-with-Git
[git-feature-branch]: https://www.atlassian.com/git/tutorials/comparing-workflows
[git-history-filtering]: https://www.atlassian.com/git/tutorials/git-log/filtering-the-commit-history
[git-history-rewriting]: http://git-scm.com/book/en/v2/Git-Tools-Rewriting-History
[git-rebasing]: http://git-scm.com/book/en/v2/Git-Branching-Rebasing
[github-issues]: https://github.com/neovim/neovim/issues
[include-what-you-use-install]: https://github.com/include-what-you-use/include-what-you-use#how-to-install
[include-what-you-use]: https://github.com/include-what-you-use/include-what-you-use#using-with-cmake
[lua-language-server]: https://github.com/sumneko/lua-language-server/
[nvim-lspconfig/clangd]: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#clangd
[pr-draft]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request
[pr-ready]: https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request
[1820]: https://github.com/neovim/neovim/pull/1820
[hub]: https://hub.github.com/
[hygiene]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[style-guide]: http://neovim.io/develop/style-guide.xml
[ASan]: http://clang.llvm.org/docs/AddressSanitizer.html
[run-tests]: https://github.com/neovim/neovim/blob/master/test/README.md#running-tests
[style-guide]: https://neovim.io/doc/user/dev_style.html#dev-style
[wiki-faq]: https://neovim.io/doc/user/faq.html
[wiki-faq]: https://github.com/neovim/neovim/wiki/FAQ
[review-checklist]: https://github.com/neovim/neovim/wiki/Code-review-checklist
[3174]: https://github.com/neovim/neovim/issues/3174
[Travis CI]: https://travis-ci.org/neovim/neovim
[QuickBuild]: http://neovim-qb.szakmeister.net/dashboard
[AppVeyor]: https://ci.appveyor.com/project/neovim/neovim
[Merge a Vim patch]: https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-Vim
[Clang report]: https://neovim.io/doc/reports/clang/
[complexity:low]: https://github.com/neovim/neovim/issues?q=is%3Aopen+is%3Aissue+label%3Acomplexity%3Alow
[master error list]: https://raw.githubusercontent.com/neovim/doc/gh-pages/reports/clint/errors.json

View File

@ -1,426 +0,0 @@
You can install Neovim from [download](#install-from-download), [package](#install-from-package), or [source](#install-from-source) in just a few seconds.
---
- To start Neovim, run `nvim` (not `neovim`).
- [Discover plugins](https://github.com/neovim/neovim/wiki/Related-projects#plugins).
- Before upgrading to a new version, **check [Breaking Changes](https://neovim.io/doc/user/news.html#news-breaking).**
- For config (vimrc) see [the FAQ](https://neovim.io/doc/user/faq.html#faq-general).
---
Install from download
=====================
Downloads are available on the [Releases](https://github.com/neovim/neovim/releases) page.
* Latest [stable release](https://github.com/neovim/neovim/releases/latest)
* [macOS x86_64](https://github.com/neovim/neovim/releases/latest/download/nvim-macos-x86_64.tar.gz)
* [macOS arm64](https://github.com/neovim/neovim/releases/latest/download/nvim-macos-arm64.tar.gz)
* [Linux x86_64](https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz)
* [Linux arm64](https://github.com/neovim/neovim/releases/latest/download/nvim-linux-arm64.tar.gz)
* [Windows](https://github.com/neovim/neovim/releases/latest/download/nvim-win64.msi)
* Latest [development prerelease](https://github.com/neovim/neovim/releases/nightly)
Install from package
====================
Packages are listed below. (You can also [build Neovim from source](#install-from-source).)
## Windows
Windows 8+ is required. Windows 7 or older is not supported.
### [Winget](https://docs.microsoft.com/en-us/windows/package-manager/winget/)
- **Release:** `winget install Neovim.Neovim`
### [Chocolatey](https://chocolatey.org)
- **Latest Release:** `choco install neovim` (use -y for automatically skipping confirmation messages)
- **Development (pre-release):** `choco install neovim --pre`
### [Scoop](https://scoop.sh/)
```
scoop bucket add main
scoop install neovim
```
- **Release:** `scoop install neovim`
Several Neovim GUIs are available from scoop (extras): [scoop.sh/#/apps?q=neovim](https://scoop.sh/#/apps?q=neovim)
### Pre-built archives
0. If you are missing `VCRUNTIME140.dll`, install the [Visual Studio 2015 C++ redistributable](https://support.microsoft.com/en-us/kb/2977003) (choose x86_64 or x86 depending on your system).
1. Choose a package (**nvim-winXX.zip**) from the [releases page](https://github.com/neovim/neovim/releases).
2. Unzip the package. Any location is fine, administrator privileges are _not_ required.
- `$VIMRUNTIME` will be set to that location automatically.
3. Run `nvim.exe` from a terminal.
**Optional** steps:
- Add the `bin` folder (e.g. `C:\Program Files\nvim\bin`) to your PATH.
- This makes it easy to run `nvim` from anywhere.
- If `:set spell` does not work, create the `%LOCALAPPDATA%/nvim-data/site/spell` folder.
You can then copy your spell files over (for English, located
[here](https://github.com/vim/vim/blob/master/runtime/spell/en.utf-8.spl) and
[here](https://github.com/vim/vim/blob/master/runtime/spell/en.utf-8.sug));
- For Python plugins you need the `pynvim` module. "Virtual envs" are recommended. After activating the virtual env do `pip install pynvim` (in *both*). Edit your `init.vim` so that it contains the path to the env's Python executable:
```vim
let g:python3_host_prog='C:/Users/foo/Envs/neovim3/Scripts/python.exe'
```
- Run `:checkhealth` and read `:help provider-python`.
- **init.vim ("vimrc"):** If you already have Vim installed you can copy `%userprofile%\_vimrc` to `%userprofile%\AppData\Local\nvim\init.vim` to use your Vim config with Neovim.
## macOS / OS X
### Pre-built archives
The [Releases](https://github.com/neovim/neovim/releases) page provides pre-built binaries for macOS 10.15+.
For x86_64:
curl -LO https://github.com/neovim/neovim/releases/download/nightly/nvim-macos-x86_64.tar.gz
tar xzf nvim-macos-x86_64.tar.gz
./nvim-macos-x86_64/bin/nvim
For arm64:
curl -LO https://github.com/neovim/neovim/releases/download/nightly/nvim-macos-arm64.tar.gz
tar xzf nvim-macos-arm64.tar.gz
./nvim-macos-arm64/bin/nvim
### [Homebrew](https://brew.sh) on macOS or Linux
brew install neovim
### [MacPorts](https://www.macports.org/)
sudo port selfupdate
sudo port install neovim
## Linux
### Pre-built archives
The [Releases](https://github.com/neovim/neovim/releases) page provides pre-built binaries for Linux systems.
```sh
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz
sudo rm -rf /opt/nvim
sudo tar -C /opt -xzf nvim-linux-x86_64.tar.gz
```
Then add this to your shell config (`~/.bashrc`, `~/.zshrc`, ...):
export PATH="$PATH:/opt/nvim-linux-x86_64/bin"
### AppImage ("universal" Linux package)
The [Releases](https://github.com/neovim/neovim/releases) page provides an [AppImage](https://appimage.org) that runs on most Linux systems. No installation is needed, just download `nvim-linux-x86_64.appimage` and run it. (It might not work if your Linux distribution is more than 4 years old.) The following instructions assume an `x86_64` architecture; on ARM Linux replace with `arm64`.
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.appimage
chmod u+x nvim-linux-x86_64.appimage
./nvim-linux-x86_64.appimage
To expose nvim globally:
mkdir -p /opt/nvim
mv nvim-linux-x86_64.appimage /opt/nvim/nvim
And the following line to your shell config (`~/.bashrc`, `~/.zshrc`, ...):
export PATH="$PATH:/opt/nvim/"
If the `./nvim-linux-x86_64.appimage` command fails, try:
```sh
./nvim-linux-x86_64.appimage --appimage-extract
./squashfs-root/AppRun --version
# Optional: exposing nvim globally.
sudo mv squashfs-root /
sudo ln -s /squashfs-root/AppRun /usr/bin/nvim
nvim
```
### Arch Linux
Neovim can be installed from the community repository:
sudo pacman -S neovim
Alternatively, Neovim can be also installed using the PKGBUILD [`neovim-git`](https://aur.archlinux.org/packages/neovim-git), available on the [AUR](https://wiki.archlinux.org/index.php/Arch_User_Repository).
Alternatively, Neovim Nightly builds can be also installed using the PKGBUILD [`neovim-nightly-bin`](https://aur.archlinux.org/packages/neovim-nightly-bin), available on the [AUR](https://wiki.archlinux.org/index.php/Arch_User_Repository).
The Python module is available from the community repository:
sudo pacman -S python-pynvim
Ruby modules (currently only supported in `neovim-git`) are available from the AUR as [`ruby-neovim`](https://aur.archlinux.org/packages/ruby-neovim).
### CentOS 8 / RHEL 8
Neovim is available through [EPEL (Extra Packages for Enterprise Linux)](https://fedoraproject.org/wiki/EPEL)
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
yum install -y neovim python3-neovim
### Clear Linux OS
Neovim is available through the [neovim bundle](https://github.com/clearlinux/clr-bundles/blob/master/bundles/neovim)
sudo swupd bundle-add neovim
Python (`:python`) support is available if the [python-basic bundle](https://github.com/clearlinux/clr-bundles/blob/master/bundles/python-basic) is installed.
sudo swupd bundle-add python-basic
### Debian
Neovim is in [Debian](https://packages.debian.org/search?keywords=neovim).
sudo apt-get install neovim
Python (`:python`) support is installable via the package manager on Debian unstable.
sudo apt-get install python3-neovim
### Exherbo Linux
Exhereses for scm and released versions are currently available in repository `::medvid`. Python client (with GTK+ GUI included) and Qt5 GUI are also available as suggestions:
cave resolve app-editors/neovim --take dev-python/neovim-python --take app-editors/neovim-qt
### Fedora
Neovim is in [Fedora](https://src.fedoraproject.org/rpms/neovim) starting with Fedora 25:
sudo dnf install -y neovim python3-neovim
You can also get nightly builds of git master from the [Copr automated build system](https://copr.fedoraproject.org/coprs/agriffis/neovim-nightly/):
dnf copr enable agriffis/neovim-nightly
dnf install -y neovim python3-neovim
See the [blog post](https://arongriffis.com/2019-03-02-neovim-nightly-builds) for information on how these are built.
### Flatpak
You can find Neovim on [Flathub](https://flathub.org/apps/details/io.neovim.nvim). Providing you have Flatpak [set up](https://flatpak.org/setup/):
flatpak install flathub io.neovim.nvim
flatpak run io.neovim.nvim
You can add `/var/lib/flatpak/exports/bin` (or `~/.local/share/flatpak/exports/bin` if you used `--user`) to the `$PATH` and run it with `io.neovim.nvim`.
Note that Flatpak'ed Neovim will look for `init.vim` in `~/.var/app/io.neovim.nvim/config/nvim` instead of `~/.config/nvim`.
### Gentoo Linux
An ebuild is available in Gentoo's official portage repository:
emerge -a app-editors/neovim
### GNU Guix
Neovim can be installed with:
guix install neovim
### GoboLinux
Neovim can be installed with:
sudo -H Compile NeoVim
### Nix / NixOS
Neovim can be installed with:
nix-env -iA nixpkgs.neovim
Or alternatively, if you use flakes:
nix profile install nixpkgs#neovim
### Mageia 7
urpmi neovim
To install the Python modules:
urpmi python3-pynvim
### makedeb Package Repository (MPR)
Neovim is available inside the [MPR](https://mpr.makedeb.org/packages/neovim). You can install it with:
git clone https://mpr.makedeb.org/neovim
cd neovim/
makedeb -si
### OpenSUSE
Neovim can be installed with:
sudo zypper in neovim
To install the Python modules:
sudo zypper in python-neovim python3-neovim
### PLD Linux
Neovim is in [PLD Linux](https://github.com/pld-linux/neovim):
poldek -u neovim
poldek -u python-neovim python3-neovim
poldek -u python-neovim-gui python3-neovim-gui
### Slackware
See [neovim on SlackBuilds](https://slackbuilds.org/apps/neovim/).
### Source Mage
Neovim can be installed using the Sorcery package manager:
cast neovim
### Solus
Neovim can be installed using the default package manager in Solus (eopkg):
sudo eopkg install neovim
### Snap
Neovim nightly and stable are available on the [snap store](https://snapcraft.io/nvim).
**Stable Builds**
```sh
sudo snap install nvim --classic
```
**Nightly Builds**
```sh
sudo snap install --edge nvim --classic
```
### Ubuntu
As in Debian, Neovim is in [Ubuntu](https://packages.ubuntu.com/search?keywords=neovim).
sudo apt install neovim
Python (`:python`) support seems to be automatically installed
sudo apt install python3-neovim
Neovim has been added to a "Personal Package Archive" (PPA). This allows you to install it with `apt-get`. Follow the links to the PPAs to see which versions of Ubuntu are currently available via the PPA. Choose **stable** or **unstable**:
- [https://launchpad.net/~neovim-ppa/+archive/ubuntu/**stable**](https://launchpad.net/~neovim-ppa/+archive/ubuntu/stable)
- [https://launchpad.net/~neovim-ppa/+archive/ubuntu/**unstable**](https://launchpad.net/~neovim-ppa/+archive/ubuntu/unstable)
**Important:** The Neovim team does not maintain the PPA packages. For problems or questions about the PPA specifically contact https://launchpad.net/~neovim-ppa.
To be able to use **add-apt-repository** you may need to install software-properties-common:
sudo apt-get install software-properties-common
If you're using an older version Ubuntu you must use:
sudo apt-get install python-software-properties
Run the following commands:
sudo add-apt-repository ppa:neovim-ppa/stable
sudo apt-get update
sudo apt-get install neovim
Prerequisites for the Python modules:
sudo apt-get install python-dev python-pip python3-dev python3-pip
If you're using an older version Ubuntu you must use:
sudo apt-get install python-dev python-pip python3-dev
sudo apt-get install python3-setuptools
sudo easy_install3 pip
### Void-Linux
Neovim can be installed using the xbps package manager
sudo xbps-install -S neovim
### Alpine Linux
Neovim can be installed using the apk package manager
sudo apk add neovim
## BSD
### FreeBSD
Neovim can be installed using [`pkg(8)`](https://www.freebsd.org/cgi/man.cgi?query=pkg&sektion=8&n=1):
pkg install neovim
or [from the ports tree](https://www.freshports.org/editors/neovim/):
cd /usr/ports/editors/neovim/ && make install clean
To install the pynvim Python modules using [`pkg(8)`](https://www.freebsd.org/cgi/man.cgi?query=pkg&sektion=8&n=1) run:
pkg install py36-pynvim
### OpenBSD
Neovim can be installed using [`pkg_add(1)`](https://man.openbsd.org/pkg_add):
pkg_add neovim
or [from the ports tree](https://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/editors/neovim/):
cd /usr/ports/editors/neovim/ && make install
## Android
[Termux](https://github.com/termux/termux-app) offers a Neovim package.
Install from source
===================
If a package is not provided for your platform, you can build Neovim from source. See [BUILD.md](./BUILD.md) for details. If you have the [prerequisites](./BUILD.md#build-prerequisites) then building is easy:
make CMAKE_BUILD_TYPE=Release
sudo make install
For Unix-like systems this installs Neovim to `/usr/local`, while for Windows to `C:\Program Files`. Note, however, that this can complicate uninstallation. The following example avoids this by isolating an installation under `$HOME/neovim`:
rm -r build/ # clear the CMake cache
make CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=$HOME/neovim"
make install
export PATH="$HOME/neovim/bin:$PATH"
## Uninstall
There is a CMake target to _uninstall_ after `make install`:
```sh
sudo cmake --build build/ --target uninstall
```
Alternatively, just delete the `CMAKE_INSTALL_PREFIX` artifacts:
```sh
sudo rm /usr/local/bin/nvim
sudo rm -r /usr/local/share/nvim/
```

View File

@ -8,7 +8,7 @@ Neovim's license follows:
====
Apache License
Version 2.0, January 2004
https://www.apache.org/licenses/
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
@ -189,18 +189,8 @@ contributed under the Vim license and (2) externally maintained libraries.
The externally maintained libraries used by Neovim are:
- Klib: a Generic Library in C. MIT/X11 license.
- Lua: MIT license
- LuaJIT: a Just-In-Time Compiler for Lua. Copyright Mike Pall. MIT license.
- Luv: Apache 2.0 license
- libmpack: MIT license
- libtermkey: MIT license
- libuv. Copyright Joyent, Inc. and other Node contributors. Node.js license.
- libvterm: MIT license
- lua-cjson: MIT license
- lua-compat: MIT license
- tree-sitter: MIT license
- unibilium: LGPL v3
- xdiff: LGPL v2
- LuaJIT: a Just-In-Time Compiler for Lua. Copyright Mike Pall. MIT license.
====
@ -233,8 +223,8 @@ II) It is allowed to distribute a modified (or extended) version of Vim,
maintainer will do with your changes and under what license they
will be distributed is negotiable. If there has been no negotiation
then this license, or a later version, also applies to your changes.
The current maintainers are listed here: https://github.com/orgs/vim/people.
If this changes it will be announced in appropriate places (most likely
The current maintainer is Bram Moolenaar <Bram@vim.org>. If this
changes it will be announced in appropriate places (most likely
vim.sf.net, www.vim.org and/or comp.editors). When it is completely
impossible to contact the maintainer, the obligation to send him
your changes ceases. Once the maintainer has confirmed that he has
@ -289,8 +279,3 @@ IV) It is not allowed to remove this license from the distribution of the Vim
license for previous Vim releases instead of the license that they came
with, at your option.
====
In addition, different license conditions may apply to some runtime files
included with Vim; these will be specified in the header of each respective
file.

View File

@ -10,30 +10,31 @@ General guidelines
* Write down what was decided
* Constraints are good
* Use automation to solve problems
* Never break the API... but sometimes break the UI
* Never break the API
Issue triage
------------
Ticket triage
-------------
In practice we haven't found a way to forecast more precisely than "next" and
"after next". So there are usually one or two (at most) planned milestones:
In practice we haven't found a meaningful way to forecast more precisely than
"next" and "after next". That means there are usually one or two (at most)
planned milestones:
* Next bugfix-release (1.0.x)
* Next feature-release (1.x.0)
- Next bugfix-release (1.0.x)
- Next feature-release (1.x.0)
The forecasting problem might be solved with an explicit priority system (like
Vim's todo.txt). Meanwhile the Neovim priority system is defined by:
Bram's todo.txt). Meanwhile the Neovim priority system is defined by:
* PRs nearing completion.
* Issue labels. E.g. the `has:plan` label increases the ticket's priority merely
- PRs nearing completion (RDY).
- Issue labels. E.g. the `+plan` label increases the ticket's priority merely
for having a plan written down: it is _closer to completion_ than tickets
without a plan.
* Comment activity or new information.
- Comment activity or new information.
Anything that isn't in the next milestone, and doesn't have a finished PR—is
Anything that isn't in the next milestone, and doesn't have a RDY PR ... is
just not something you care very much about, by construction. Post-release you
can review open issues, but chances are your next milestone is already getting
full... :)
full :)
Release policy
--------------
@ -50,197 +51,13 @@ has a major bug:
1. Fix the bug on `master`.
2. Cherry-pick the fix to `release-x.y`.
3. Cut a release from `release-x.y`.
* Run `./scripts/release.sh` (requires [git cliff](https://github.com/orhun/git-cliff))
* The [CI job](https://github.com/neovim/neovim/blob/3d45706478cd030c3ee05b4f336164bb96138095/.github/workflows/release.yml#L11-L13)
will update the release assets and [force-push to the "stable" tag](https://github.com/neovim/neovim/blob/cdd87222c86c5b2274a13d36f23de0637462e317/.github/workflows/release.yml#L229).
### Release automation
Neovim automation includes a [backport bot](https://github.com/korthout/backport-action).
Trigger the action by labeling a PR with `ci:backport release-x.y`. See `.github/workflows/backport.yml`.
Deprecating and removing features
---------------------------------
Neovim inherits many features and design decisions from Vim, not all of which
align with the goals of this project. It is sometimes desired or necessary to
remove existing features, or refactor parts of the code that would change
user's workflow. In these cases, a deprecation policy is needed to properly
inform users of the change.
When a (non-experimental) feature is slated to be removed it should:
1. Be _soft_ deprecated in the _next_ release
- Use of the deprecated feature will still work.
- This means deprecating via documentation and annotation (`@deprecated`).
- Include a note in `deprecated.txt`.
- For Lua features, use `vim.deprecate()`. The specified version is the
current minor version + 2. For example, if the current version is
`v0.10.0-dev-1957+gd676746c33` then use `0.12`.
- For Vimscript features, use `v:lua.vim.deprecate()`. Use the same version
as described for Lua features.
- `vim.deprecate(…, 'x.y.z')` where major version `x` is greater than the
current Nvim major version, is always treated as _soft_ deprecation.
2. Be _hard_ deprecated in a release following the release in which it was soft deprecated.
- Use of the deprecated feature will still work but should issue a warning.
- Features implemented in C will need bespoke implementations to communicate
to users that the feature is deprecated.
3. Be removed in a release following the release in which it was hard deprecated
- Usually this will be the next release, but it may be a later release if
a longer deprecation cycle is desired
- If possible, keep the feature as a stub (e.g. function API) and issue an
error when it is accessed.
Example:
Deprecation Removal
┆ ┆ ┆
┆ Soft ┆ Hard ┆
┆ Deprecation ┆ Deprecation ┆
┆ Period ┆ Period ┆
────────────────────────────────────────────────────────────
Version: 0.10 0.11 0.12
────────────────────────────────────────────────────────────
Old code Old code Old code
+ +
New code New code New code
Feature removals which may benefit from community input or further discussion
should also have a tracking issue (which should be linked to in the release
notes).
Exceptions to this policy may be made (for experimental subsystems or when
there is broad consensus among maintainers). The rationale for the exception
should be stated explicitly and publicly.
Third-party dependencies
------------------------
For some dependencies we maintain temporary "forks", which are simply private
branches with a few extra patches, while we wait for the upstream project to
merge the patches. This is done instead of maintaining the patches as (fragile)
CMake `PATCH_COMMAND` steps.
These "bundled" dependencies can be updated by bumping their versions in `cmake.deps/deps.txt`.
Some can be auto-bumped by `scripts/bump_deps.lua`.
* [LuaJIT](https://github.com/LuaJIT/LuaJIT)
* [Lua](https://www.lua.org/download.html)
* [Luv](https://github.com/luvit/luv)
* When bumping, also sync
- [our bundled meta file](https://github.com/neovim/neovim/blob/master/runtime/lua/uv/_meta.lua) with [the upstream meta file](https://github.com/luvit/luv/blob/master/docs/meta.lua);
- [our bundled documentation](https://github.com/neovim/neovim/blob/master/runtime/doc/luvref.txt) with [the upstream documentation](https://github.com/luvit/luv/blob/master/docs/docs.md).
* [gettext](https://ftp.gnu.org/pub/gnu/gettext/)
* [libiconv](https://ftp.gnu.org/pub/gnu/libiconv)
* [libuv](https://github.com/libuv/libuv)
* [lua-compat](https://github.com/keplerproject/lua-compat-5.3)
* [tree-sitter](https://github.com/tree-sitter/tree-sitter)
* [unibilium](https://github.com/neovim/unibilium)
* The original project [was abandoned](https://github.com/neovim/neovim/issues/10302), so the [neovim/unibilium](https://github.com/neovim/unibilium) fork is considered "upstream" and is maintained on the `master` branch.
* [treesitter parsers](https://github.com/neovim/neovim/blob/7e97c773e3ba78fcddbb2a0b9b0d572c8210c83e/cmake.deps/deps.txt#L47-L62)
### Vendored dependencies
These dependencies are "vendored" (inlined), we must update the sources manually:
* `src/mpack/`: [libmpack](https://github.com/libmpack/libmpack)
* send improvements upstream!
* `src/mpack/lmpack.c`: [libmpack-lua](https://github.com/libmpack/libmpack-lua)
* send improvements upstream!
* `src/xdiff/`: [xdiff](https://github.com/git/git/tree/master/xdiff)
* `src/cjson/`: [lua-cjson](https://github.com/openresty/lua-cjson)
* `src/klib/`: [Klib](https://github.com/attractivechaos/klib)
* `runtime/lua/vim/inspect.lua`: [inspect.lua](https://github.com/kikito/inspect.lua)
* `src/nvim/tui/terminfo_defs.h`: terminfo definitions
* Run `scripts/update_terminfo.sh` to update these definitions.
* `runtime/lua/vim/lsp/_meta/protocol.lua`: LSP specification
* Run `src/gen/gen_lsp.lua` to update.
* `runtime/lua/vim/_meta/lpeg.lua`: LPeg definitions.
* Refer to [`LuaCATS/lpeg`](https://github.com/LuaCATS/lpeg) for updates.
* Update the git SHA revision from which the documentation was taken.
* `runtime/lua/vim/re.lua`: LPeg regex module.
* Vendored from LPeg. Needs to be updated when LPeg is updated.
* `runtime/lua/vim/_meta/re.lua`: docs for LPeg regex module.
* Needs to be updated when LPeg is updated.
* `src/bit.c`: only for PUC lua: port of `require'bit'` from luajit https://bitop.luajit.org/
* `runtime/lua/coxpcall.lua`: coxpcall (only needed for PUC lua, builtin to luajit)
Other dependencies
--------------------------
* GitHub users:
* https://github.com/marvim
* https://github.com/nvim-winget
* Org secrets/tokens:
* `CODECOV_TOKEN`
* `BACKPORT_KEY`
* Org/repo variables:
* `BACKPORT_APP`
* Domain names (held in https://namecheap.com):
* neovim.org
* neovim.io
* packspec.org
* pkgjson.org
* DNS for the above domains is managed in https://cloudflare.com (not the domain registrar)
Refactoring
-----------
### Frozen legacy modules
Refactoring Vim structurally and aesthetically is an important goal of Neovim.
But there are some modules that should not be changed significantly, because
they are maintained by Vim, at present. Until someone takes "ownership" of
these modules, the cost of any significant changes (including style or
structural changes that re-arrange the code) to these modules outweighs the
benefit. The modules are:
- `regexp.c`
- `indent_c.c`
Automation (CI)
---------------
### Backup
Discussions from issues and PRs are backed up here:
https://github.com/neovim/neovim-backup
### Development guidelines
* CI and automation jobs are primarily driven by GitHub Actions.
* Avoid macOS if an Ubuntu or a Windows runner can be used instead. This is
because macOS runners have [tighter restrictions on the number of concurrent
jobs](https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration#usage-limits).
* Runner versions:
* For special-purpose jobs where the runner version doesn't really matter,
prefer `-latest` tags so we don't need to manually bump the versions. An
example of a special-purpose workflow is `labeler_pr.yml`.
* For our testing job `test.yml`, prefer to use the latest version
explicitly. Avoid using the `-latest` tags here as it makes it difficult
to determine from an unrelated PR if a failure is due to the PR itself or
due to GitHub bumping the `-latest` tag without our knowledge. There's
also a high risk that automatically bumping the CI versions will fail due
to manual work being required from experience.
* For our release job, which is `release.yml`, prefer to use the oldest
stable (i.e. non-deprecated) versions available. The reason is that we're
trying to produce images that work in the broadest number of environments,
and therefore want to use older releases.
### Special labels
Some github labels are used to trigger certain jobs:
* `ci:backport release-x.y` - backport to branch `release-x.y`
* `ci:s390x` - enable s390x CI
* `ci:skip-news` - skip news.yml workflows
* `ci:windows-asan` - test windows with ASAN enabled
* `needs:response` - close PR after a certain amount of time if author doesn't
respond
- Run `./scripts/release.sh`
- Update (force-push) the remote `stable` tag.
- The [nightly job](https://github.com/neovim/bot-ci/blob/master/ci/nightly.sh)
will update the release assets based on the `stable` tag.
See also
--------
* https://github.com/neovim/neovim/issues/862
* https://github.com/git/git/blob/master/Documentation/howto/maintain-git.adoc
- https://github.com/neovim/neovim/issues/862
- https://github.com/git/git/blob/master/Documentation/howto/maintain-git.txt

204
Makefile
View File

@ -1,38 +1,4 @@
ifeq ($(OS),Windows_NT)
ifeq '$(findstring ;,$(PATH))' ';'
UNIX_LIKE := FALSE
else
UNIX_LIKE := TRUE
endif
else
UNIX_LIKE := TRUE
endif
ifeq ($(UNIX_LIKE),FALSE)
SHELL := powershell.exe
.SHELLFLAGS := -NoProfile -NoLogo
MKDIR := @$$null = new-item -itemtype directory -force
TOUCH := @$$null = new-item -force
RM := remove-item -force
CMAKE := cmake
CMAKE_GENERATOR := Ninja
define rmdir
if (Test-Path $1) { remove-item -recurse $1 }
endef
else
MKDIR := mkdir -p
TOUCH := touch
RM := rm -rf
CMAKE := $(shell (command -v cmake3 || command -v cmake || echo cmake))
CMAKE_GENERATOR ?= "$(shell (command -v ninja > /dev/null 2>&1 && echo "Ninja") || echo "Unix Makefiles")"
define rmdir
rm -rf $1
endef
endif
MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
MAKEFILE_DIR := $(dir $(MAKEFILE_PATH))
THIS_DIR = $(shell pwd)
filter-false = $(strip $(filter-out 0 off OFF false FALSE,$1))
filter-true = $(strip $(filter-out 1 on ON true TRUE,$1))
@ -41,10 +7,11 @@ filter-true = $(strip $(filter-out 1 on ON true TRUE,$1))
all: nvim
CMAKE_PRG ?= $(shell (command -v cmake3 || echo cmake))
CMAKE_BUILD_TYPE ?= Debug
CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
# Extra CMake flags which extend the default set
CMAKE_EXTRA_FLAGS ?=
NVIM_PRG := $(MAKEFILE_DIR)/build/bin/nvim
# CMAKE_INSTALL_PREFIX
# - May be passed directly or as part of CMAKE_EXTRA_FLAGS.
@ -58,7 +25,7 @@ override CMAKE_EXTRA_FLAGS += -DCMAKE_INSTALL_PREFIX=$(CMAKE_INSTALL_PREFIX)
checkprefix:
@if [ -f build/.ran-cmake ]; then \
cached_prefix=$(shell $(CMAKE) -L -N build | 2>/dev/null grep 'CMAKE_INSTALL_PREFIX' | cut -d '=' -f2); \
cached_prefix=$(shell $(CMAKE_PRG) -L -N build | 2>/dev/null grep 'CMAKE_INSTALL_PREFIX' | cut -d '=' -f2); \
if ! [ "$(CMAKE_INSTALL_PREFIX)" = "$$cached_prefix" ]; then \
printf "Re-running CMake: CMAKE_INSTALL_PREFIX '$(CMAKE_INSTALL_PREFIX)' does not match cached value '%s'.\n" "$$cached_prefix"; \
$(RM) build/.ran-cmake; \
@ -68,13 +35,39 @@ else
checkprefix: ;
endif
DEPS_BUILD_DIR ?= ".deps"
BUILD_TYPE ?= $(shell (type ninja > /dev/null 2>&1 && echo "Ninja") || \
echo "Unix Makefiles")
DEPS_BUILD_DIR ?= .deps
ifneq (1,$(words [$(DEPS_BUILD_DIR)]))
$(error DEPS_BUILD_DIR must not contain whitespace)
endif
ifeq (,$(BUILD_TOOL))
ifeq (Ninja,$(BUILD_TYPE))
ifneq ($(shell $(CMAKE_PRG) --help 2>/dev/null | grep Ninja),)
BUILD_TOOL := ninja
else
# User's version of CMake doesn't support Ninja
BUILD_TOOL = $(MAKE)
BUILD_TYPE := Unix Makefiles
endif
else
BUILD_TOOL = $(MAKE)
endif
endif
BUILD_CMD = $(BUILD_TOOL)
ifneq ($(VERBOSE),)
# Only need to handle Ninja here. Make will inherit the VERBOSE variable.
ifeq ($(BUILD_TYPE),Ninja)
BUILD_CMD += -v
endif
endif
DEPS_CMAKE_FLAGS ?=
USE_BUNDLED ?=
# Back-compat: USE_BUNDLED_DEPS was the old name.
USE_BUNDLED ?= $(USE_BUNDLED_DEPS)
ifneq (,$(USE_BUNDLED))
BUNDLED_CMAKE_FLAG := -DUSE_BUNDLED=$(USE_BUNDLED)
@ -82,7 +75,7 @@ endif
ifneq (,$(findstring functionaltest-lua,$(MAKECMDGOALS)))
BUNDLED_LUA_CMAKE_FLAG := -DUSE_BUNDLED_LUA=ON
$(shell [ -x $(DEPS_BUILD_DIR)/usr/bin/lua ] || $(RM) build/.ran-*)
$(shell [ -x $(DEPS_BUILD_DIR)/usr/bin/lua ] || rm build/.ran-*)
endif
# For use where we want to make sure only a single job is run. This does issue
@ -90,87 +83,100 @@ endif
SINGLE_MAKE = export MAKEFLAGS= ; $(MAKE)
nvim: build/.ran-cmake deps
$(CMAKE) --build build
+$(BUILD_CMD) -C build
libnvim: build/.ran-cmake deps
$(CMAKE) --build build --target libnvim
+$(BUILD_CMD) -C build libnvim
cmake:
$(TOUCH) CMakeLists.txt
touch CMakeLists.txt
$(MAKE) build/.ran-cmake
build/.ran-cmake: | deps
$(CMAKE) -B build -G $(CMAKE_GENERATOR) $(CMAKE_FLAGS) $(CMAKE_EXTRA_FLAGS) $(MAKEFILE_DIR)
$(TOUCH) $@
cd build && $(CMAKE_PRG) -G '$(BUILD_TYPE)' $(CMAKE_FLAGS) $(CMAKE_EXTRA_FLAGS) $(THIS_DIR)
touch $@
deps: | build/.ran-deps-cmake
deps: | build/.ran-third-party-cmake
ifeq ($(call filter-true,$(USE_BUNDLED)),)
$(CMAKE) --build $(DEPS_BUILD_DIR)
+$(BUILD_CMD) -C $(DEPS_BUILD_DIR)
endif
ifeq ($(call filter-true,$(USE_BUNDLED)),)
$(DEPS_BUILD_DIR):
$(MKDIR) $@
build/.ran-deps-cmake:: $(DEPS_BUILD_DIR)
$(CMAKE) -S $(MAKEFILE_DIR)/cmake.deps -B $(DEPS_BUILD_DIR) -G $(CMAKE_GENERATOR) $(BUNDLED_CMAKE_FLAG) $(BUNDLED_LUA_CMAKE_FLAG) $(DEPS_CMAKE_FLAGS)
mkdir -p "$@"
build/.ran-third-party-cmake:: $(DEPS_BUILD_DIR)
cd $(DEPS_BUILD_DIR) && \
$(CMAKE_PRG) -G '$(BUILD_TYPE)' $(BUNDLED_CMAKE_FLAG) $(BUNDLED_LUA_CMAKE_FLAG) \
$(DEPS_CMAKE_FLAGS) $(THIS_DIR)/third-party
endif
build/.ran-deps-cmake::
$(MKDIR) build
$(TOUCH) "$@"
build/.ran-third-party-cmake::
mkdir -p build
touch $@
# TODO: cmake 3.2+ add_custom_target() has a USES_TERMINAL flag.
oldtest: | nvim
$(SINGLE_MAKE) -C test/old/testdir clean
oldtest: | nvim build/runtime/doc/tags
+$(SINGLE_MAKE) -C src/nvim/testdir clean
ifeq ($(strip $(TEST_FILE)),)
$(SINGLE_MAKE) -C test/old/testdir NVIM_PRG=$(NVIM_PRG) $(MAKEOVERRIDES)
+$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" $(MAKEOVERRIDES)
else
@# Handle TEST_FILE=test_foo{,.res,.vim}.
$(SINGLE_MAKE) -C test/old/testdir NVIM_PRG=$(NVIM_PRG) SCRIPTS= $(MAKEOVERRIDES) $(patsubst %.vim,%,$(patsubst %.res,%,$(TEST_FILE)))
+$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" NEW_TESTS=$(TEST_FILE) SCRIPTS= $(MAKEOVERRIDES)
endif
# Build oldtest by specifying the relative .vim filename.
.PHONY: phony_force
test/old/testdir/%.vim: phony_force nvim
$(SINGLE_MAKE) -C test/old/testdir NVIM_PRG=$(NVIM_PRG) SCRIPTS= $(MAKEOVERRIDES) $(patsubst test/old/testdir/%.vim,%,$@)
build/runtime/doc/tags helptags: | nvim
+$(BUILD_CMD) -C build runtime/doc/tags
# Builds help HTML _and_ checks for invalid help tags.
helphtml: | nvim build/runtime/doc/tags
+$(BUILD_CMD) -C build doc_html
functionaltest: | nvim
+$(BUILD_CMD) -C build functionaltest
functionaltest-lua: | nvim
$(CMAKE) --build build --target functionaltest
+$(BUILD_CMD) -C build functionaltest-lua
FORMAT=formatc formatlua format
LINT=lintlua lintsh lintc clang-analyzer lintcommit lintdoc lint luals
TEST=functionaltest unittest
generated-sources benchmark $(FORMAT) $(LINT) $(TEST) doc: | build/.ran-cmake
$(CMAKE) --build build --target $@
lualint: | build/.ran-cmake deps
$(BUILD_CMD) -C build lualint
test: $(TEST)
pylint:
flake8 contrib/ scripts/ src/ test/
# iwyu-fix-includes can be downloaded from
# https://github.com/include-what-you-use/include-what-you-use/blob/master/fix_includes.py.
# Create a iwyu-fix-includes shell script in your $PATH that invokes the python script.
iwyu: build/.ran-cmake
$(CMAKE) --preset iwyu
$(CMAKE) --build build > build/iwyu.log
iwyu-fix-includes --only_re="src/nvim" --ignore_re="(src/nvim/eval/encode.c\
|src/nvim/auto/\
|src/nvim/os/lang.c\
|src/nvim/map.c\
)" --nosafe_headers < build/iwyu.log
$(CMAKE) -B build -U ENABLE_IWYU
$(CMAKE) --build build
# Run pylint only if flake8 is installed.
_opt_pylint:
@command -v flake8 && { $(MAKE) pylint; exit $$?; } \
|| echo "SKIP: pylint (flake8 not found)"
unittest: | nvim
+$(BUILD_CMD) -C build unittest
benchmark: | nvim
+$(BUILD_CMD) -C build benchmark
test: functionaltest unittest
clean:
ifneq ($(wildcard build),)
$(CMAKE) --build build --target clean
endif
$(MAKE) -C test/old/testdir clean
$(MAKE) -C runtime/indent clean
+test -d build && $(BUILD_CMD) -C build clean || true
$(MAKE) -C src/nvim/testdir clean
$(MAKE) -C runtime/doc clean
distclean:
$(call rmdir, $(DEPS_BUILD_DIR))
$(call rmdir, build)
rm -rf $(DEPS_BUILD_DIR) build
$(MAKE) clean
install: checkprefix nvim
$(CMAKE) --install build
+$(BUILD_CMD) -C build install
clint: build/.ran-cmake
+$(BUILD_CMD) -C build clint
clint-full: build/.ran-cmake
+$(BUILD_CMD) -C build clint-full
check-single-includes: build/.ran-cmake
+$(BUILD_CMD) -C build check-single-includes
generated-sources: build/.ran-cmake
+$(BUILD_CMD) -C build generated-sources
appimage:
bash scripts/genappimage.sh
@ -181,10 +187,16 @@ appimage:
appimage-%:
bash scripts/genappimage.sh $*
.PHONY: test clean distclean nvim libnvim cmake deps install appimage checkprefix benchmark $(FORMAT) $(LINT) $(TEST)
lint: check-single-includes clint lualint _opt_pylint
.PHONY: emmylua-check
emmylua-check:
-emmylua_check runtime/lua \
--config .luarc.json \
--config .emmyrc.json
# Generic pattern rules, allowing for `make build/bin/nvim` etc.
# Does not work with "Unix Makefiles".
ifeq ($(BUILD_TYPE),Ninja)
build/%:
$(BUILD_CMD) -C build $(patsubst build/%,%,$@)
$(DEPS_BUILD_DIR)/%:
$(BUILD_CMD) -C $(DEPS_BUILD_DIR) $(patsubst $(DEPS_BUILD_DIR)/%,%,$@)
endif
.PHONY: test lualint pylint functionaltest unittest lint clint clean distclean nvim libnvim cmake deps install appimage checkprefix

View File

@ -1,21 +1,27 @@
<h1 align="center">
<img src="https://raw.githubusercontent.com/neovim/neovim.github.io/master/logos/neovim-logo-300x87.png" alt="Neovim">
[![Neovim](https://raw.githubusercontent.com/neovim/neovim.github.io/master/logos/neovim-logo-300x87.png)](https://neovim.io)
<a href="https://neovim.io/doc/">Documentation</a> |
<a href="https://app.element.io/#/room/#neovim:matrix.org">Chat</a>
</h1>
[Wiki](https://github.com/neovim/neovim/wiki) |
[Documentation](https://neovim.io/doc) |
[Chat/Discussion](https://gitter.im/neovim/neovim) |
[Twitter](https://twitter.com/Neovim)
[![Travis build status](https://travis-ci.org/neovim/neovim.svg?branch=master)](https://travis-ci.org/neovim/neovim)
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/urdqjrik5u521fac/branch/master?svg=true)](https://ci.appveyor.com/project/neovim/neovim/branch/master)
[![Codecov coverage](https://img.shields.io/codecov/c/github/neovim/neovim.svg)](https://codecov.io/gh/neovim/neovim)
[![Coverity Scan analysis](https://scan.coverity.com/projects/2227/badge.svg)](https://scan.coverity.com/projects/2227)
[![Clang analysis](https://neovim.io/doc/reports/clang/badge.svg)](https://neovim.io/doc/reports/clang)
[![PVS-Studio analysis](https://neovim.io/doc/reports/pvs/badge.svg)](https://neovim.io/doc/reports/pvs/PVS-studio.html.d)
[![Packages](https://repology.org/badge/tiny-repos/neovim.svg)](https://repology.org/metapackage/neovim)
[![Debian CI](https://badges.debian.net/badges/debian/testing/neovim/version.svg)](https://buildd.debian.org/neovim)
[![Downloads](https://img.shields.io/github/downloads/neovim/neovim/total.svg?maxAge=2592001)](https://github.com/neovim/neovim/releases/)
Neovim is a project that seeks to aggressively refactor [Vim](https://www.vim.org/) in order to:
Neovim is a project that seeks to aggressively refactor Vim in order to:
- Simplify maintenance and encourage [contributions](CONTRIBUTING.md)
- Split the work between multiple developers
- Enable [advanced UIs] without modifications to the core
- Maximize [extensibility](https://neovim.io/doc/user/ui.html)
- Maximize [extensibility](https://github.com/neovim/neovim/wiki/Plugin-UI-architecture)
See the [Introduction](https://github.com/neovim/neovim/wiki/Introduction) wiki page and [Roadmap]
for more information.
@ -25,15 +31,15 @@ Features
- Modern [GUIs](https://github.com/neovim/neovim/wiki/Related-projects#gui)
- [API access](https://github.com/neovim/neovim/wiki/Related-projects#api-clients)
from any language including C/C++, C#, Clojure, D, Elixir, Go, Haskell, Java/Kotlin,
from any language including C/C++, C#, Clojure, D, Elixir, Go, Haskell, Java,
JavaScript/Node.js, Julia, Lisp, Lua, Perl, Python, Racket, Ruby, Rust
- Embedded, scriptable [terminal emulator](https://neovim.io/doc/user/terminal.html)
- Embedded, scriptable [terminal emulator](https://neovim.io/doc/user/nvim_terminal_emulator.html)
- Asynchronous [job control](https://github.com/neovim/neovim/pull/2247)
- [Shared data (shada)](https://github.com/neovim/neovim/pull/2506) among multiple editor instances
- [XDG base directories](https://github.com/neovim/neovim/pull/3470) support
- Compatible with most Vim plugins, including Ruby and Python plugins
See [`:help nvim-features`][nvim-features] for the full list, and [`:help news`][nvim-news] for noteworthy changes in the latest version!
See [`:help nvim-features`][nvim-features] for the full list!
Install from package
--------------------
@ -41,30 +47,45 @@ Install from package
Pre-built packages for Windows, macOS, and Linux are found on the
[Releases](https://github.com/neovim/neovim/releases/) page.
[Managed packages] are in [Homebrew], [Debian], [Ubuntu], [Fedora], [Arch Linux], [Void Linux], [Gentoo], and more!
[Managed packages] are in Homebrew, [Debian], [Ubuntu], [Fedora], [Arch Linux],
[Gentoo], and more!
Install from source
-------------------
See [BUILD.md](./BUILD.md) and [supported platforms](https://neovim.io/doc/user/support.html#supported-platforms) for details.
The build is CMake-based, but a Makefile is provided as a convenience.
After installing the dependencies, run the following command.
make CMAKE_BUILD_TYPE=RelWithDebInfo
sudo make install
To install to a non-default location:
make CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_INSTALL_PREFIX=/full/path/
make CMAKE_INSTALL_PREFIX=/full/path/
make install
CMake hints for inspecting the build:
To skip bundled (`third-party/*`) dependencies:
1. Install the dependencies using a package manager.
```
sudo apt install gperf luajit luarocks libuv1-dev libluajit-5.1-dev libunibilium-dev libmsgpack-dev libtermkey-dev libvterm-dev
sudo luarocks build mpack
sudo luarocks build lpeg
sudo luarocks build inspect
```
2. Build with `USE_BUNDLED=OFF`:
```
make CMAKE_BUILD_TYPE=RelWithDebInfo USE_BUNDLED=OFF
sudo make install
```
To inspect the build, these CMake features are useful:
- `cmake --build build --target help` lists all build targets.
- `build/CMakeCache.txt` (or `cmake -LAH build/`) contains the resolved values of all CMake variables.
- `build/compile_commands.json` shows the full compiler invocations for each translation unit.
See the [Building Neovim](https://github.com/neovim/neovim/wiki/Building-Neovim) wiki page for details.
Transitioning from Vim
--------------------
@ -73,13 +94,12 @@ See [`:help nvim-from-vim`](https://neovim.io/doc/user/nvim.html#nvim-from-vim)
Project layout
--------------
├─ cmake/ CMake utils
├─ cmake.config/ CMake defines
├─ cmake.deps/ subproject to fetch and build dependencies (optional)
├─ runtime/ plugins and docs
├─ ci/ build automation
├─ cmake/ build scripts
├─ runtime/ user plugins/docs
├─ src/nvim/ application source code (see src/nvim/README.md)
│ ├─ api/ API subsystem
│ ├─ eval/ Vimscript subsystem
│ ├─ eval/ VimL subsystem
│ ├─ event/ event-loop subsystem
│ ├─ generators/ code generation (pre-compilation)
│ ├─ lib/ generic data structures
@ -87,38 +107,44 @@ Project layout
│ ├─ msgpack_rpc/ RPC subsystem
│ ├─ os/ low-level platform code
│ └─ tui/ built-in UI
├─ third-party/ CMake subproject to build dependencies
└─ test/ tests (see test/README.md)
License
-------
Neovim contributions since [b17d96][license-commit] are licensed under the
Apache 2.0 license, except for contributions copied from Vim (identified by the
`vim-patch` token). See LICENSE for details.
Neovim is licensed under the terms of the Apache 2.0 license, except for
parts that were contributed under the Vim license.
- Contributions committed before [b17d96][license-commit] remain under the Vim
license.
- Contributions committed after [b17d96][license-commit] are licensed under
Apache 2.0 unless those contributions were copied from Vim (identified in
the commit logs by the `vim-patch` token).
See `LICENSE` for details.
Vim is Charityware. You can use and copy it as much as you like, but you are
encouraged to make a donation for needy children in Uganda. Please see the
kcc section of the vim docs or visit the ICCF web site, available at these URLs:
https://iccf-holland.org/
https://www.vim.org/iccf/
https://www.iccf.nl/
http://iccf-holland.org/
http://www.vim.org/iccf/
http://www.iccf.nl/
You can also sponsor the development of Vim. Vim sponsors can vote for
features. The money goes to Uganda anyway.
[license-commit]: https://github.com/neovim/neovim/commit/b17d9691a24099c9210289f16afb1a498a89d803
[nvim-features]: https://neovim.io/doc/user/vim_diff.html#nvim-features
[nvim-news]: https://neovim.io/doc/user/news.html
[Roadmap]: https://neovim.io/roadmap/
[advanced UIs]: https://github.com/neovim/neovim/wiki/Related-projects#gui
[Managed packages]: ./INSTALL.md#install-from-package
[Managed packages]: https://github.com/neovim/neovim/wiki/Installing-Neovim#install-from-package
[Debian]: https://packages.debian.org/testing/neovim
[Ubuntu]: https://packages.ubuntu.com/search?keywords=neovim
[Fedora]: https://packages.fedoraproject.org/pkgs/neovim/neovim/
[Ubuntu]: http://packages.ubuntu.com/search?keywords=neovim
[Fedora]: https://apps.fedoraproject.org/packages/neovim
[Arch Linux]: https://www.archlinux.org/packages/?q=neovim
[Void Linux]: https://voidlinux.org/packages/?arch=x86_64&q=neovim
[Gentoo]: https://packages.gentoo.org/packages/app-editors/neovim
[Homebrew]: https://formulae.brew.sh/formula/neovim
<!-- vim: set tw=80: -->

42
appveyor.yml Normal file
View File

@ -0,0 +1,42 @@
version: '{build}'
environment:
APPVEYOR_CACHE_ENTRY_ZIP_ARGS: "-t7z -m0=lzma -mx=9"
DEPS_BUILD_DIR: "C:/projects/nvim-deps"
DEPS_PREFIX: "C:/projects/nvim-deps/usr"
# Silence/redirect errors due to missing locking support (via libgcov).
GCOV_ERROR_FILE: "$(TEMP)/libgcov-errors.log"
image: Visual Studio 2017
configuration:
- MINGW_64-gcov
- MINGW_32
- MSVC_64
- MSVC_32
init:
- ps: |
# Pull requests: skip some build configurations to save time.
if ($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT -and $env:CONFIGURATION -match '^(MSVC_64|MINGW_32)$') {
$env:APPVEYOR_CACHE_SKIP_SAVE = "true"
Exit-AppVeyorBuild
}
# RDP
#- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
matrix:
fast_finish: true
install: []
before_build:
- ps: Install-Product node 8
build_script:
- powershell ci\build.ps1
after_build:
- ps: |
if (Test-Path $env:GCOV_ERROR_FILE) {
Get-Content $env:GCOV_ERROR_FILE -Head 10
Get-Content $env:GCOV_ERROR_FILE -Tail 10
} else {
write-host "no GCOV_ERROR_FILE"
}
cache:
- C:\projects\nvim-deps -> third-party\**
artifacts:
- path: build/Neovim.zip
- path: build/bin/nvim.exe

446
build.zig
View File

@ -1,446 +0,0 @@
const std = @import("std");
const LazyPath = std.Build.LazyPath;
const build_lua = @import("src/build_lua.zig");
const gen = @import("src/gen/gen_steps.zig");
const runtime = @import("runtime/gen_runtime.zig");
const tests = @import("test/run_tests.zig");
const version = struct {
const major = 0;
const minor = 12;
const patch = 0;
const prerelease = "-dev";
const api_level = 14;
const api_level_compat = 0;
const api_prerelease = true;
};
// TODO(bfredl): this is for an upstream issue
pub fn lazyArtifact(d: *std.Build.Dependency, name: []const u8) ?*std.Build.Step.Compile {
var found: ?*std.Build.Step.Compile = null;
for (d.builder.install_tls.step.dependencies.items) |dep_step| {
const inst = dep_step.cast(std.Build.Step.InstallArtifact) orelse continue;
if (std.mem.eql(u8, inst.artifact.name, name)) {
if (found != null) std.debug.panic("artifact name '{s}' is ambiguous", .{name});
found = inst.artifact;
}
}
return found;
}
pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const t = target.result;
const os_tag = t.os.tag;
const is_windows = (os_tag == .windows);
const is_linux = (os_tag == .linux);
const is_darwin = os_tag.isDarwin();
const modern_unix = is_darwin or os_tag.isBSD() or is_linux;
const cross_compiling = b.option(bool, "cross", "cross compile") orelse false;
// TODO(bfredl): option to set nlua0 target explicitly when cross compiling?
const target_host = if (cross_compiling) b.graph.host else target;
const optimize_host = .ReleaseSafe;
// puc lua 5.1 is not ReleaseSafe "safe"
const optimize_lua = if (optimize == .Debug or optimize == .ReleaseSafe) .ReleaseSmall else optimize;
const arch = t.cpu.arch;
const default_luajit = (is_linux and arch == .x86_64) or (is_darwin and arch == .aarch64);
const use_luajit = b.option(bool, "luajit", "use luajit") orelse default_luajit;
const host_use_luajit = if (cross_compiling) false else use_luajit;
const E = enum { luajit, lua51 };
const ziglua = b.dependency("lua_wrapper", .{
.target = target,
.optimize = optimize_lua,
.lang = if (use_luajit) E.luajit else E.lua51,
.shared = false,
});
const ziglua_host = if (cross_compiling) b.dependency("lua_wrapper", .{
.target = target_host,
.optimize = optimize_lua,
.lang = if (host_use_luajit) E.luajit else E.lua51,
.shared = false,
}) else ziglua;
const lpeg = b.dependency("lpeg", .{});
const iconv_apple = if (cross_compiling and is_darwin) b.lazyDependency("iconv_apple", .{ .target = target, .optimize = optimize }) else null;
// this is currently not necessary, as ziglua currently doesn't use lazy dependencies
// to circumvent ziglua.artifact() failing in a bad way.
// const lua = lazyArtifact(ziglua, "lua") orelse return;
const lua = ziglua.artifact("lua");
const libuv_dep = b.dependency("libuv", .{ .target = target, .optimize = optimize });
const libuv = libuv_dep.artifact("uv");
const libluv = try build_lua.build_libluv(b, target, optimize, lua, libuv);
const utf8proc = b.dependency("utf8proc", .{ .target = target, .optimize = optimize });
const unibilium = b.dependency("unibilium", .{ .target = target, .optimize = optimize });
// TODO(bfredl): fix upstream bugs with UBSAN
const treesitter = b.dependency("treesitter", .{ .target = target, .optimize = .ReleaseFast });
const nlua0 = build_lua.build_nlua0(b, target_host, optimize_host, host_use_luajit, ziglua_host, lpeg);
// usual caveat emptor: might need to force a rebuild if the only change is
// addition of new .c files, as those are not seen by any hash
const subdirs = [_][]const u8{
"", // src/nvim itself
"os/",
"api/",
"api/private/",
"msgpack_rpc/",
"tui/",
"tui/termkey/",
"event/",
"eval/",
"lib/",
"lua/",
"viml/",
"viml/parser/",
"vterm/",
};
// source names _relative_ src/nvim/, not including other src/ subdircs
var nvim_sources = try std.ArrayList(gen.SourceItem).initCapacity(b.allocator, 100);
var nvim_headers = try std.ArrayList([]u8).initCapacity(b.allocator, 100);
// both source headers and the {module}.h.generated.h files
var api_headers = try std.ArrayList(std.Build.LazyPath).initCapacity(b.allocator, 10);
// TODO(bfredl): these should just become subdirs..
const windows_only = [_][]const u8{ "pty_proc_win.c", "pty_proc_win.h", "pty_conpty_win.c", "pty_conpty_win.h", "os_win_console.c", "win_defs.h" };
const unix_only = [_][]const u8{ "unix_defs.h", "pty_proc_unix.c", "pty_proc_unix.h" };
const exclude_list = if (is_windows) &unix_only else &windows_only;
const src_dir = b.build_root.handle;
for (subdirs) |s| {
var dir = try src_dir.openDir(b.fmt("src/nvim/{s}", .{s}), .{ .iterate = true });
defer dir.close();
var it = dir.iterateAssumeFirstIteration();
const api_export = std.mem.eql(u8, s, "api/");
const os_check = std.mem.eql(u8, s, "os/");
entries: while (try it.next()) |entry| {
if (entry.name.len < 3) continue;
if (entry.name[0] < 'a' or entry.name[0] > 'z') continue;
if (os_check) {
for (exclude_list) |name| {
if (std.mem.eql(u8, name, entry.name)) {
continue :entries;
}
}
}
if (std.mem.eql(u8, ".c", entry.name[entry.name.len - 2 ..])) {
try nvim_sources.append(.{ .name = b.fmt("{s}{s}", .{ s, entry.name }), .api_export = api_export });
}
if (std.mem.eql(u8, ".h", entry.name[entry.name.len - 2 ..])) {
try nvim_headers.append(b.fmt("{s}{s}", .{ s, entry.name }));
if (api_export and !std.mem.eql(u8, "ui_events.in.h", entry.name)) {
try api_headers.append(b.path(b.fmt("src/nvim/{s}{s}", .{ s, entry.name })));
}
}
}
}
const support_unittests = use_luajit;
const gen_config = b.addWriteFiles();
const version_lua = gen_config.add("nvim_version.lua", lua_version_info(b));
var config_str = b.fmt("zig build -Doptimize={s}", .{@tagName(optimize)});
if (cross_compiling) {
config_str = b.fmt("{s} -Dcross -Dtarget={s} (host: {s})", .{ config_str, try t.linuxTriple(b.allocator), try b.graph.host.result.linuxTriple(b.allocator) });
}
const versiondef_step = b.addConfigHeader(.{ .style = .{ .cmake = b.path("cmake.config/versiondef.h.in") } }, .{
.NVIM_VERSION_MAJOR = version.major,
.NVIM_VERSION_MINOR = version.minor,
.NVIM_VERSION_PATCH = version.patch,
.NVIM_VERSION_PRERELEASE = version.prerelease,
.NVIM_VERSION_MEDIUM = "",
.VERSION_STRING = "TODO", // TODO(bfredl): not sure what to put here. summary already in "config_str"
.CONFIG = config_str,
});
_ = gen_config.addCopyFile(versiondef_step.getOutput(), "auto/versiondef.h"); // run_preprocessor() workaronnd
const ptrwidth = t.ptrBitWidth() / 8;
const sysconfig_step = b.addConfigHeader(.{ .style = .{ .cmake = b.path("cmake.config/config.h.in") } }, .{
.SIZEOF_INT = t.cTypeByteSize(.int),
.SIZEOF_INTMAX_T = t.cTypeByteSize(.longlong), // TODO
.SIZEOF_LONG = t.cTypeByteSize(.long),
.SIZEOF_SIZE_T = ptrwidth,
.SIZEOF_VOID_PTR = ptrwidth,
.PROJECT_NAME = "nvim",
.HAVE__NSGETENVIRON = is_darwin,
.HAVE_FD_CLOEXEC = modern_unix,
.HAVE_FSEEKO = modern_unix,
.HAVE_LANGINFO_H = modern_unix,
.HAVE_NL_LANGINFO_CODESET = modern_unix,
.HAVE_NL_MSG_CAT_CNTR = t.isGnuLibC(),
.HAVE_PWD_FUNCS = modern_unix,
.HAVE_READLINK = modern_unix,
.HAVE_STRNLEN = modern_unix,
.HAVE_STRCASECMP = modern_unix,
.HAVE_STRINGS_H = modern_unix,
.HAVE_STRNCASECMP = modern_unix,
.HAVE_STRPTIME = modern_unix,
.HAVE_XATTR = is_linux,
.HAVE_SYS_SDT_H = false,
.HAVE_SYS_UTSNAME_H = modern_unix,
.HAVE_SYS_WAIT_H = false, // unused
.HAVE_TERMIOS_H = modern_unix,
.HAVE_WORKING_LIBINTL = t.isGnuLibC(),
.UNIX = modern_unix,
.CASE_INSENSITIVE_FILENAME = is_darwin or is_windows,
.HAVE_SYS_UIO_H = modern_unix,
.HAVE_READV = modern_unix,
.HAVE_DIRFD_AND_FLOCK = modern_unix,
.HAVE_FORKPTY = modern_unix and !is_darwin, // also on Darwin but we lack the headers :(
.HAVE_BE64TOH = modern_unix and !is_darwin,
.ORDER_BIG_ENDIAN = t.cpu.arch.endian() == .big,
.ENDIAN_INCLUDE_FILE = "endian.h",
.HAVE_EXECINFO_BACKTRACE = modern_unix and !t.isMuslLibC(),
.HAVE_BUILTIN_ADD_OVERFLOW = true,
.HAVE_WIMPLICIT_FALLTHROUGH_FLAG = true,
.HAVE_BITSCANFORWARD64 = null,
.VTERM_TEST_FILE = "test/vterm_test_output", // TODO(bfredl): revisit when porting libvterm tests
});
_ = gen_config.addCopyFile(sysconfig_step.getOutput(), "auto/config.h"); // run_preprocessor() workaronnd
_ = gen_config.add("auto/pathdef.h", b.fmt(
\\char *default_vim_dir = "/usr/local/share/nvim";
\\char *default_vimruntime_dir = "";
\\char *default_lib_dir = "/usr/local/lib/nvim";
, .{}));
// TODO(bfredl): include git version when available
const medium = b.fmt("v{}.{}.{}{s}+zig", .{ version.major, version.minor, version.patch, version.prerelease });
const versiondef_git = gen_config.add("auto/versiondef_git.h", b.fmt(
\\#define NVIM_VERSION_MEDIUM "{s}"
\\#define NVIM_VERSION_BUILD "???"
\\
, .{medium}));
// TODO(zig): using getEmittedIncludeTree() is ugly af. we want run_preprocessor()
// to use the std.build.Module include_path thing
const include_path = [_]LazyPath{
b.path("src/"),
gen_config.getDirectory(),
lua.getEmittedIncludeTree(),
libuv.getEmittedIncludeTree(),
libluv.getEmittedIncludeTree(),
utf8proc.artifact("utf8proc").getEmittedIncludeTree(),
unibilium.artifact("unibilium").getEmittedIncludeTree(),
treesitter.artifact("tree-sitter").getEmittedIncludeTree(),
};
const gen_headers, const funcs_data = try gen.nvim_gen_sources(b, nlua0, &nvim_sources, &nvim_headers, &api_headers, &include_path, target, versiondef_git, version_lua);
const test_config_step = b.addWriteFiles();
_ = test_config_step.add("test/cmakeconfig/paths.lua", try test_config(b));
const test_gen_step = b.step("gen_headers", "debug: output generated headers");
const config_install = b.addInstallDirectory(.{ .source_dir = gen_config.getDirectory(), .install_dir = .prefix, .install_subdir = "config/" });
test_gen_step.dependOn(&config_install.step);
test_gen_step.dependOn(&b.addInstallDirectory(.{ .source_dir = gen_headers.getDirectory(), .install_dir = .prefix, .install_subdir = "headers/" }).step);
const nvim_exe = b.addExecutable(.{
.name = "nvim",
.target = target,
.optimize = optimize,
});
nvim_exe.rdynamic = true; // -E
nvim_exe.linkLibrary(lua);
nvim_exe.linkLibrary(libuv);
nvim_exe.linkLibrary(libluv);
if (iconv_apple) |iconv| {
nvim_exe.linkLibrary(iconv.artifact("iconv"));
}
nvim_exe.linkLibrary(utf8proc.artifact("utf8proc"));
nvim_exe.linkLibrary(unibilium.artifact("unibilium"));
nvim_exe.linkLibrary(treesitter.artifact("tree-sitter"));
nvim_exe.addIncludePath(b.path("src"));
nvim_exe.addIncludePath(gen_config.getDirectory());
nvim_exe.addIncludePath(gen_headers.getDirectory());
build_lua.add_lua_modules(nvim_exe.root_module, lpeg, use_luajit, false);
var unit_test_sources = try std.ArrayList([]u8).initCapacity(b.allocator, 10);
if (support_unittests) {
var unit_test_fixtures = try src_dir.openDir("test/unit/fixtures/", .{ .iterate = true });
defer unit_test_fixtures.close();
var it = unit_test_fixtures.iterateAssumeFirstIteration();
while (try it.next()) |entry| {
if (entry.name.len < 3) continue;
if (std.mem.eql(u8, ".c", entry.name[entry.name.len - 2 ..])) {
try unit_test_sources.append(b.fmt("test/unit/fixtures/{s}", .{entry.name}));
}
}
}
const src_paths = try b.allocator.alloc([]u8, nvim_sources.items.len + unit_test_sources.items.len);
for (nvim_sources.items, 0..) |s, i| {
src_paths[i] = b.fmt("src/nvim/{s}", .{s.name});
}
@memcpy(src_paths[nvim_sources.items.len..], unit_test_sources.items);
const flags = [_][]const u8{
"-std=gnu99",
"-DINCLUDE_GENERATED_DECLARATIONS",
"-DZIG_BUILD",
"-D_GNU_SOURCE",
if (support_unittests) "-DUNIT_TESTING" else "",
if (use_luajit) "" else "-DNVIM_VENDOR_BIT",
};
nvim_exe.addCSourceFiles(.{ .files = src_paths, .flags = &flags });
nvim_exe.addCSourceFiles(.{ .files = &.{
"src/xdiff/xdiffi.c",
"src/xdiff/xemit.c",
"src/xdiff/xhistogram.c",
"src/xdiff/xpatience.c",
"src/xdiff/xprepare.c",
"src/xdiff/xutils.c",
"src/cjson/lua_cjson.c",
"src/cjson/fpconv.c",
"src/cjson/strbuf.c",
}, .flags = &flags });
const nvim_exe_step = b.step("nvim_bin", "only the binary (not a fully working install!)");
const nvim_exe_install = b.addInstallArtifact(nvim_exe, .{});
nvim_exe_step.dependOn(&nvim_exe_install.step);
const gen_runtime = try runtime.nvim_gen_runtime(b, nlua0, nvim_exe, funcs_data);
const runtime_install = b.addInstallDirectory(.{ .source_dir = gen_runtime.getDirectory(), .install_dir = .prefix, .install_subdir = "runtime/" });
const nvim = b.step("nvim", "build the editor");
nvim.dependOn(&nvim_exe_install.step);
nvim.dependOn(&runtime_install.step);
const lua_dev_deps = b.dependency("lua_dev_deps", .{});
const test_deps = b.step("test_deps", "test prerequisites");
test_deps.dependOn(&nvim_exe_install.step);
test_deps.dependOn(&runtime_install.step);
test_deps.dependOn(test_fixture(b, "shell-test", null, target, optimize));
test_deps.dependOn(test_fixture(b, "tty-test", libuv, target, optimize));
test_deps.dependOn(test_fixture(b, "pwsh-test", null, target, optimize));
test_deps.dependOn(test_fixture(b, "printargs-test", null, target, optimize));
test_deps.dependOn(test_fixture(b, "printenv-test", null, target, optimize));
test_deps.dependOn(test_fixture(b, "streams-test", libuv, target, optimize));
const parser_c = b.dependency("treesitter_c", .{ .target = target, .optimize = optimize });
test_deps.dependOn(add_ts_parser(b, "c", parser_c.path("."), false, target, optimize));
const parser_markdown = b.dependency("treesitter_markdown", .{ .target = target, .optimize = optimize });
test_deps.dependOn(add_ts_parser(b, "markdown", parser_markdown.path("tree-sitter-markdown/"), true, target, optimize));
test_deps.dependOn(add_ts_parser(b, "markdown_inline", parser_markdown.path("tree-sitter-markdown-inline/"), true, target, optimize));
const parser_vim = b.dependency("treesitter_vim", .{ .target = target, .optimize = optimize });
test_deps.dependOn(add_ts_parser(b, "vim", parser_vim.path("."), true, target, optimize));
const parser_vimdoc = b.dependency("treesitter_vimdoc", .{ .target = target, .optimize = optimize });
test_deps.dependOn(add_ts_parser(b, "vimdoc", parser_vimdoc.path("."), false, target, optimize));
const parser_lua = b.dependency("treesitter_lua", .{ .target = target, .optimize = optimize });
test_deps.dependOn(add_ts_parser(b, "lua", parser_lua.path("."), true, target, optimize));
const parser_query = b.dependency("treesitter_query", .{ .target = target, .optimize = optimize });
test_deps.dependOn(add_ts_parser(b, "query", parser_query.path("."), false, target, optimize));
const unit_headers: ?[]const LazyPath = if (support_unittests) &(include_path ++ .{gen_headers.getDirectory()}) else null;
try tests.test_steps(b, nvim_exe, test_deps, lua_dev_deps.path("."), test_config_step.getDirectory(), unit_headers);
}
pub fn test_fixture(
b: *std.Build,
name: []const u8,
libuv: ?*std.Build.Step.Compile,
target: std.Build.ResolvedTarget,
optimize: std.builtin.OptimizeMode,
) *std.Build.Step {
const fixture = b.addExecutable(.{
.name = name,
.target = target,
.optimize = optimize,
});
const source = if (std.mem.eql(u8, name, "pwsh-test")) "shell-test" else name;
fixture.addCSourceFile(.{ .file = b.path(b.fmt("./test/functional/fixtures/{s}.c", .{source})) });
fixture.linkLibC();
if (libuv) |uv| fixture.linkLibrary(uv);
return &b.addInstallArtifact(fixture, .{}).step;
}
pub fn add_ts_parser(
b: *std.Build,
name: []const u8,
parser_dir: LazyPath,
scanner: bool,
target: std.Build.ResolvedTarget,
optimize: std.builtin.OptimizeMode,
) *std.Build.Step {
const parser = b.addLibrary(.{
.name = name,
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
.linkage = .dynamic,
});
parser.addCSourceFile(.{ .file = parser_dir.path(b, "src/parser.c") });
if (scanner) parser.addCSourceFile(.{ .file = parser_dir.path(b, "src/scanner.c") });
parser.addIncludePath(parser_dir.path(b, "src"));
parser.linkLibC();
const parser_install = b.addInstallArtifact(parser, .{ .dest_sub_path = b.fmt("parser/{s}.so", .{name}) });
return &parser_install.step;
}
pub fn lua_version_info(b: *std.Build) []u8 {
const v = version;
return b.fmt(
\\return {{
\\ {{"major", {}}},
\\ {{"minor", {}}},
\\ {{"patch", {}}},
\\ {{"prerelease", {}}},
\\ {{"api_level", {}}},
\\ {{"api_compatible", {}}},
\\ {{"api_prerelease", {}}},
\\}}
, .{ v.major, v.minor, v.patch, v.prerelease.len > 0, v.api_level, v.api_level_compat, v.api_prerelease });
}
pub fn test_config(b: *std.Build) ![]u8 {
var buf: [std.fs.max_path_bytes]u8 = undefined;
const src_path = try b.build_root.handle.realpath(".", &buf);
// we don't use test/cmakeconfig/paths.lua.in because it contains cmake specific logic
return b.fmt(
\\local M = {{}}
\\
\\M.apple_sysroot = ""
\\M.translations_enabled = "$ENABLE_TRANSLATIONS" == "ON"
\\M.is_asan = "$ENABLE_ASAN_UBSAN" == "ON"
\\M.is_zig_build = true
\\M.vterm_test_file = "test/vterm_test_output"
\\M.test_build_dir = "{[bin_dir]s}" -- bull
\\M.test_source_path = "{[src_path]s}"
\\M.test_lua_prg = ""
\\M.test_luajit_prg = ""
\\ -- include path passed on the cmdline, see test/lua_runner.lua
\\M.include_paths = _G.c_include_path or {{}}
\\
\\return M
, .{ .bin_dir = b.install_path, .src_path = src_path });
}

View File

@ -1,65 +0,0 @@
.{
.name = .neovim,
.fingerprint = 0x66eb090879307a38,
.version = "0.12.0",
.minimum_zig_version = "0.14.0",
.dependencies = .{
.lua_wrapper = .{
.url = "git+https://github.com/natecraddock/ziglua#7bfb3c2b87220cdc89ef01cc99a200dad7a28e50",
.hash = "lua_wrapper-0.1.0-OyMC27fOBAAU3E2ueB-EWGSgsuCFQZL83pT0nQJ1ufOI",
},
.lpeg = .{
.url = "https://github.com/neovim/deps/raw/d495ee6f79e7962a53ad79670cb92488abe0b9b4/opt/lpeg-1.1.0.tar.gz",
.hash = "N-V-__8AAMnaAwCEutreuREG3QayBVEZqUTDQFY1Nsrv2OIt",
},
.luv = .{
.url = "git+https://github.com/luvit/luv?ref=1.51.0-1#4c9fbc6cf6f3338bb0e0426710cf885ee557b540",
.hash = "N-V-__8AAMlNDwCY07jUoMiq3iORXdZy0uFWKiHsy8MaDBJA",
},
.lua_compat53 = .{
.url = "https://github.com/lunarmodules/lua-compat-5.3/archive/v0.13.tar.gz",
.hash = "N-V-__8AADi-AwDnVoXwDCQvv2wcYOmN0bJLqZ44J3lwoQY2",
},
.treesitter = .{
.url = "git+https://github.com/tree-sitter/tree-sitter?ref=v0.25.8#854f527f6ef9fdf563efb13d016e52df3ee6c45c",
.hash = "tree_sitter-0.26.0-Tw2sR8u8CwBPBvzDbE0Ggokap5sll_qol0WSVuwjdOfC",
},
.libuv = .{ .path = "./deps/libuv" },
.utf8proc = .{ .path = "./deps/utf8proc/" },
.unibilium = .{ .path = "./deps/unibilium/" },
.iconv_apple = .{ .path = "./deps/iconv_apple/", .lazy = true },
.lua_dev_deps = .{
.url = "https://github.com/neovim/deps/raw/06ef2b58b0876f8de1a3f5a710473dcd7afff251/opt/lua-dev-deps.tar.gz",
.hash = "N-V-__8AAGevEQCHAkCozca5AIdN9DFc3Luf3g3r2AcbyOrm",
},
.treesitter_c = .{
.url = "git+https://github.com/tree-sitter/tree-sitter-c?ref=v0.24.1#7fa1be1b694b6e763686793d97da01f36a0e5c12",
.hash = "N-V-__8AANxPSABzw3WBTSH_YkwaGAfrK6PBqAMqQedkDDim",
},
.treesitter_markdown = .{
.url = "git+https://github.com/tree-sitter-grammars/tree-sitter-markdown?ref=v0.5.0#afaa4138517363362f54c89330c9d79391e81168",
.hash = "N-V-__8AAIIZUwD3CGdyI2DiHu7Suj2jIF_EAVlM6REFGwju",
},
.treesitter_lua = .{
.url = "git+https://github.com/tree-sitter-grammars/tree-sitter-lua?ref=v0.4.0#4569d1c361129e71a205b94a05e158bd71b1709f",
.hash = "N-V-__8AAEF5CABqSL9zqc03aQsT6Nni54ZCcL98pnuDL2D3",
},
.treesitter_vim = .{
.url = "git+https://github.com/tree-sitter-grammars/tree-sitter-vim?ref=v0.7.0#3dd4747082d1b717b8978211c06ef7b6cd16125b",
.hash = "N-V-__8AAMArVAB4uo2wg2XRs8HBviQ4Pq366cC_iRolX4Vc",
},
.treesitter_vimdoc = .{
.url = "git+https://github.com/neovim/tree-sitter-vimdoc?ref=v4.0.0#9f6191a98702edc1084245abd5523279d4b681fb",
.hash = "N-V-__8AAI4YCgD7OqxCEAmz2RqT_ohl6eA4F0fGMtLIe7nb",
},
.treesitter_query = .{
.url = "git+https://github.com/tree-sitter-grammars/tree-sitter-query?ref=v0.6.2#8a43889f89fd0667289936341bff3a77bafade17",
.hash = "N-V-__8AAARLBACBLGiXGFTijEzLv8AwiqT_kJpmVjir1BgX",
},
},
.paths = .{
// TODO(bfredl): explicitly list the subdirs which actually are used
"",
},
}

27
ci/before_cache.sh Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -e
set -o pipefail
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${CI_DIR}/common/build.sh"
source "${CI_DIR}/common/suite.sh"
echo "before_cache.sh: cache size"
du -chd 1 "${HOME}/.cache" | sort -rh | head -20
echo "before_cache.sh: ccache stats"
ccache -s 2>/dev/null || true
# Do not keep ccache stats (uploaded to cache otherwise; reset initially anyway).
find "${HOME}/.ccache" -name stats -delete
# Update the third-party dependency cache only if the build was successful.
if ended_successfully; then
# Do not cache downloads. They should not be needed with up-to-date deps.
rm -rf "${DEPS_BUILD_DIR}/build/downloads"
rm -rf "${CACHE_NVIM_DEPS_DIR}"
mv "${DEPS_BUILD_DIR}" "${CACHE_NVIM_DEPS_DIR}"
touch "${CACHE_MARKER}"
echo "Updated third-party dependencies (timestamp: $(_stat "${CACHE_MARKER}"))."
fi

64
ci/before_install.sh Executable file
View File

@ -0,0 +1,64 @@
#!/usr/bin/env bash
set -e
set -o pipefail
if [[ "${CI_TARGET}" == lint ]]; then
exit
fi
echo 'Python info:'
(
set -x
python3 --version
python2 --version
python --version
pip3 --version
pip2 --version
pip --version
pyenv --version
pyenv versions
) 2>&1 | sed 's/^/ /' || true
# Use pyenv, but not for OSX on Travis, where it only has the "system" version.
if [[ "${TRAVIS_OS_NAME}" != osx ]] && command -v pyenv; then
echo 'Setting Python versions via pyenv'
# Prefer Python 2 over 3 (more conservative).
pyenv global 2.7.15:3.7
echo 'Updated Python info:'
(
set -x
python3 --version
python2 --version
python --version
python3 -m pip --version
python2 -m pip --version
) 2>&1 | sed 's/^/ /'
fi
echo "Install node (LTS)"
if [[ "${TRAVIS_OS_NAME}" == osx ]] || [ ! -f ~/.nvm/nvm.sh ]; then
curl -o ~/.nvm/nvm.sh https://raw.githubusercontent.com/creationix/nvm/master/nvm.sh
fi
source ~/.nvm/nvm.sh
nvm install --lts
nvm use --lts
if [[ -n "$CMAKE_URL" ]]; then
echo "Installing custom CMake: $CMAKE_URL"
curl --retry 5 --silent --fail -o /tmp/cmake-installer.sh "$CMAKE_URL"
mkdir -p "$HOME/.local/bin" /opt/cmake-custom
bash /tmp/cmake-installer.sh --prefix=/opt/cmake-custom --skip-license
ln -sfn /opt/cmake-custom/bin/cmake "$HOME/.local/bin/cmake"
cmake_version="$(cmake --version)"
echo "$cmake_version" | grep -qF '2.8.12' || {
echo "Unexpected CMake version: $cmake_version"
exit 1
}
fi

39
ci/before_script.sh Executable file
View File

@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -e
set -o pipefail
if [[ "${CI_TARGET}" == lint ]]; then
exit
fi
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${CI_DIR}/common/build.sh"
# Test some of the configuration variables.
if [[ -n "${GCOV}" ]] && [[ ! $(type -P "${GCOV}") ]]; then
echo "\$GCOV: '${GCOV}' is not executable."
exit 1
fi
if [[ -n "${LLVM_SYMBOLIZER}" ]] && [[ ! $(type -P "${LLVM_SYMBOLIZER}") ]]; then
echo "\$LLVM_SYMBOLIZER: '${LLVM_SYMBOLIZER}' is not executable."
exit 1
fi
echo "before_script.sh: ccache stats (will be cleared)"
ccache -s
# Reset ccache stats for real results in before_cache.
ccache --zero-stats
if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
# Adds user to a dummy group.
# That allows to test changing the group of the file by `os_fchown`.
sudo dscl . -create /Groups/chown_test
sudo dscl . -append /Groups/chown_test GroupMembership "${USER}"
fi
# Compile dependencies.
build_deps
rm -rf "${LOG_DIR}"
mkdir -p "${LOG_DIR}"

153
ci/build.ps1 Normal file
View File

@ -0,0 +1,153 @@
$ErrorActionPreference = 'stop'
Set-PSDebug -Strict -Trace 1
$isPullRequest = ($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT -ne $null)
$env:CONFIGURATION -match '^(?<compiler>\w+)_(?<bits>32|64)(?:-(?<option>\w+))?$'
$compiler = $Matches.compiler
$compileOption = $Matches.option
$bits = $Matches.bits
$cmakeBuildType = $(if ($env:CMAKE_BUILD_TYPE -ne $null) {$env:CMAKE_BUILD_TYPE} else {'RelWithDebInfo'});
$buildDir = [System.IO.Path]::GetFullPath("$(pwd)")
$depsCmakeVars = @{
CMAKE_BUILD_TYPE = $cmakeBuildType;
}
$nvimCmakeVars = @{
CMAKE_BUILD_TYPE = $cmakeBuildType;
BUSTED_OUTPUT_TYPE = 'nvim';
DEPS_PREFIX=$(if ($env:DEPS_PREFIX -ne $null) {$env:DEPS_PREFIX} else {".deps/usr"});
}
if ($env:DEPS_BUILD_DIR -eq $null) {
$env:DEPS_BUILD_DIR = ".deps";
}
$uploadToCodeCov = $false
function exitIfFailed() {
if ($LastExitCode -ne 0) {
Set-PSDebug -Off
exit $LastExitCode
}
}
if (-Not (Test-Path -PathType container $env:DEPS_BUILD_DIR)) {
write-host "cache dir not found: $($env:DEPS_BUILD_DIR)"
mkdir $env:DEPS_BUILD_DIR
} else {
write-host "cache dir $($env:DEPS_BUILD_DIR) size: $(Get-ChildItem $env:DEPS_BUILD_DIR -recurse | Measure-Object -property length -sum | Select -expand sum)"
}
if ($compiler -eq 'MINGW') {
if ($bits -eq 32) {
$arch = 'i686'
}
elseif ($bits -eq 64) {
$arch = 'x86_64'
}
if ($compileOption -eq 'gcov') {
$nvimCmakeVars['USE_GCOV'] = 'ON'
$uploadToCodecov = $true
$env:GCOV = "C:\msys64\mingw$bits\bin\gcov"
}
# These are native MinGW builds, but they use the toolchain inside
# MSYS2, this allows using all the dependencies and tools available
# in MSYS2, but we cannot build inside the MSYS2 shell.
$cmakeGenerator = 'Ninja'
$cmakeGeneratorArgs = '-v'
$mingwPackages = @('ninja', 'cmake', 'perl', 'diffutils').ForEach({
"mingw-w64-$arch-$_"
})
# Add MinGW to the PATH
$env:PATH = "C:\msys64\mingw$bits\bin;$env:PATH"
# Avoid pacman "warning" which causes non-zero return code. https://github.com/open62541/open62541/issues/2068
& C:\msys64\usr\bin\mkdir -p /var/cache/pacman/pkg
# Build third-party dependencies
C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm -Su" ; exitIfFailed
C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm --needed -S $mingwPackages" ; exitIfFailed
}
elseif ($compiler -eq 'MSVC') {
$cmakeGeneratorArgs = '/verbosity:normal'
if ($bits -eq 32) {
$cmakeGenerator = 'Visual Studio 15 2017'
}
elseif ($bits -eq 64) {
$cmakeGenerator = 'Visual Studio 15 2017 Win64'
}
}
# Setup python (use AppVeyor system python)
C:\Python27\python.exe -m pip install pynvim ; exitIfFailed
C:\Python35\python.exe -m pip install pynvim ; exitIfFailed
# Disambiguate python3
move c:\Python35\python.exe c:\Python35\python3.exe
$env:PATH = "C:\Python35;C:\Python27;$env:PATH"
# Sanity check
python -c "import pynvim; print(str(pynvim))" ; exitIfFailed
python3 -c "import pynvim; print(str(pynvim))" ; exitIfFailed
$env:PATH = "C:\Ruby24\bin;$env:PATH"
gem.cmd install neovim
Get-Command -CommandType Application neovim-ruby-host.bat
npm.cmd install -g neovim
Get-Command -CommandType Application neovim-node-host.cmd
npm.cmd link neovim
function convertToCmakeArgs($vars) {
return $vars.GetEnumerator() | foreach { "-D$($_.Key)=$($_.Value)" }
}
cd $env:DEPS_BUILD_DIR
cmake -G $cmakeGenerator $(convertToCmakeArgs($depsCmakeVars)) "$buildDir/third-party/" ; exitIfFailed
cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed
cd $buildDir
# Build Neovim
mkdir build
cd build
cmake -G $cmakeGenerator $(convertToCmakeArgs($nvimCmakeVars)) .. ; exitIfFailed
cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed
.\bin\nvim --version ; exitIfFailed
# Ensure that the "win32" feature is set.
.\bin\nvim -u NONE --headless -c 'exe !has(\"win32\").\"cq\"' ; exitIfFailed
# Functional tests
# The $LastExitCode from MSBuild can't be trusted
$failed = $false
# Temporarily turn off tracing to reduce log file output
Set-PSDebug -Off
cmake --build . --config $cmakeBuildType --target functionaltest -- $cmakeGeneratorArgs 2>&1 |
foreach { $failed = $failed -or
$_ -match 'functional tests failed with error'; $_ }
if ($failed) {
if ($uploadToCodecov) {
bash -l /c/projects/neovim/ci/common/submit_coverage.sh functionaltest
}
exit $LastExitCode
}
Set-PSDebug -Strict -Trace 1
if ($uploadToCodecov) {
bash -l /c/projects/neovim/ci/common/submit_coverage.sh functionaltest
}
# Old tests
# Add MSYS to path, required for e.g. `find` used in test scripts.
# But would break functionaltests, where its `more` would be used then.
$OldPath = $env:PATH
$env:PATH = "C:\msys64\usr\bin;$env:PATH"
& "C:\msys64\mingw$bits\bin\mingw32-make.exe" -C $(Convert-Path ..\src\nvim\testdir) VERBOSE=1 ; exitIfFailed
$env:PATH = $OldPath
if ($uploadToCodecov) {
bash -l /c/projects/neovim/ci/common/submit_coverage.sh oldtest
}
# Build artifacts
cpack -G ZIP -C RelWithDebInfo
if ($env:APPVEYOR_REPO_TAG_NAME -ne $null) {
cpack -G NSIS -C RelWithDebInfo
}

103
ci/common/build.sh Normal file
View File

@ -0,0 +1,103 @@
_stat() {
if test "${TRAVIS_OS_NAME}" = osx ; then
stat -f %Sm "${@}"
else
stat -c %y "${@}"
fi
}
top_make() {
printf '%78s\n' | tr ' ' '='
# Travis has 1.5 virtual cores according to:
# http://docs.travis-ci.com/user/speeding-up-the-build/#Paralellizing-your-build-on-one-VM
ninja "$@"
}
build_make() {
top_make -C "${BUILD_DIR}" "$@"
}
build_deps() {
if test "${BUILD_32BIT}" = ON ; then
DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} ${CMAKE_FLAGS_32BIT}"
fi
if test "${FUNCTIONALTEST}" = "functionaltest-lua" \
|| test "${CLANG_SANITIZER}" = "ASAN_UBSAN" ; then
DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} -DUSE_BUNDLED_LUA=ON"
fi
mkdir -p "${DEPS_BUILD_DIR}"
# Use cached dependencies if $CACHE_MARKER exists.
if test "${CACHE_ENABLE}" = "false" ; then
export CCACHE_RECACHE=1
elif test -f "${CACHE_MARKER}" ; then
echo "Using third-party dependencies from Travis cache (last update: $(_stat "${CACHE_MARKER}"))."
cp -a "${CACHE_NVIM_DEPS_DIR}"/. "${DEPS_BUILD_DIR}"
fi
# Even if we're using cached dependencies, run CMake and make to
# update CMake configuration and update to newer deps versions.
cd "${DEPS_BUILD_DIR}"
echo "Configuring with '${DEPS_CMAKE_FLAGS}'."
CC= cmake -G Ninja ${DEPS_CMAKE_FLAGS} "${TRAVIS_BUILD_DIR}/third-party/"
if ! top_make; then
exit 1
fi
cd "${TRAVIS_BUILD_DIR}"
}
prepare_build() {
if test -n "${CLANG_SANITIZER}" ; then
CMAKE_FLAGS="${CMAKE_FLAGS} -DCLANG_${CLANG_SANITIZER}=ON"
fi
if test "${BUILD_32BIT}" = ON ; then
CMAKE_FLAGS="${CMAKE_FLAGS} ${CMAKE_FLAGS_32BIT}"
fi
mkdir -p "${BUILD_DIR}"
cd "${BUILD_DIR}"
echo "Configuring with '${CMAKE_FLAGS} $@'."
cmake -G Ninja ${CMAKE_FLAGS} "$@" "${TRAVIS_BUILD_DIR}"
}
build_nvim() {
echo "Building nvim."
if ! top_make nvim ; then
exit 1
fi
if test "$CLANG_SANITIZER" != "TSAN" ; then
echo "Building libnvim."
if ! top_make libnvim ; then
exit 1
fi
if test "${FUNCTIONALTEST}" != "functionaltest-lua"; then
echo "Building nvim-test."
if ! top_make nvim-test ; then
exit 1
fi
fi
fi
# Invoke nvim to trigger *San early.
if ! (bin/nvim --version && bin/nvim -u NONE -e -cq | cat -vet) ; then
check_sanitizer "${LOG_DIR}"
exit 1
fi
check_sanitizer "${LOG_DIR}"
cd "${TRAVIS_BUILD_DIR}"
}
macos_rvm_dance() {
# neovim-ruby gem requires a ruby newer than the macOS default.
source ~/.rvm/scripts/rvm
rvm get stable --auto-dotfiles
rvm reload
rvm use 2.2.5
rvm use
}

45
ci/common/submit_coverage.sh Executable file
View File

@ -0,0 +1,45 @@
#!/bin/sh
# Collect and submit coverage reports.
#
# Args:
# $1: Flag(s) for codecov, separated by comma.
set -ex
# Change to grandparent dir (POSIXly).
CDPATH='' cd -P -- "$(dirname -- "$0")/../.." || exit
echo "=== running submit_coverage in $PWD: $* ==="
"$GCOV" --version
# Download/install codecov-bash and gcovr once.
codecov_sh="${TEMP:-/tmp}/codecov.bash"
if ! [ -f "$codecov_sh" ]; then
curl --retry 5 --silent --fail -o "$codecov_sh" https://codecov.io/bash
chmod +x "$codecov_sh"
python3 -m pip install --quiet --user gcovr
fi
(
cd build
python3 -m gcovr --branches --exclude-unreachable-branches --print-summary -j 2 --exclude '.*/auto/.*' --root .. --delete -o ../coverage.xml --xml
)
# Upload to codecov.
# -X gcov: disable gcov, done manually above.
# -X fix: disable fixing of reports (not necessary, rather slow)
# -Z: exit non-zero on failure
# -F: flag(s)
# NOTE: ignoring flags for now, since this causes timeouts on codecov.io then,
# which they know about for about a year already...
# Flags must match pattern ^[\w\,]+$ ("," as separator).
codecov_flags="$(uname -s),${1}"
codecov_flags=$(echo "$codecov_flags" | sed 's/[^,_a-zA-Z0-9]/_/g')
if ! "$codecov_sh" -f coverage.xml -X gcov -X fix -Z -F "${codecov_flags}"; then
echo "codecov upload failed."
fi
# Cleanup always, especially collected data.
find . \( -name '*.gcov' -o -name '*.gcda' \) -ls -delete | wc -l
rm -f coverage.xml

193
ci/common/suite.sh Normal file
View File

@ -0,0 +1,193 @@
# HACK: get newline for use in strings given that "\n" and $'' do not work.
NL="$(printf '\nE')"
NL="${NL%E}"
FAIL_SUMMARY=""
# Test success marker. If END_MARKER file exists, we know that all tests
# finished. If FAIL_SUMMARY_FILE exists we know that some tests failed, this
# file will contain information about failed tests. Build is considered
# successful if tests ended without any of them failing.
END_MARKER="$BUILD_DIR/.tests_finished"
FAIL_SUMMARY_FILE="$BUILD_DIR/.test_errors"
ANSI_CLEAR="\033[0K"
travis_fold() {
local action="$1"
local name="$2"
name="$(echo -n "$name" | tr '\n\0' '--' | sed 's/[^A-Za-z0-9]\{1,\}/-/g')"
name="$(echo -n "$name" | sed 's/-$//')"
echo -en "travis_fold:${action}:${name}\r${ANSI_CLEAR}"
}
if test "$TRAVIS" != "true" ; then
travis_fold() {
return 0
}
fi
enter_suite() {
set +x
FAILED=0
rm -f "${END_MARKER}"
local suite_name="$1"
export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE}/$suite_name"
travis_fold start "${NVIM_TEST_CURRENT_SUITE}"
set -x
}
exit_suite() {
set +x
if test $FAILED -ne 0 ; then
echo "Suite ${NVIM_TEST_CURRENT_SUITE} failed, summary:"
echo "${FAIL_SUMMARY}"
else
travis_fold end "${NVIM_TEST_CURRENT_SUITE}"
fi
export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE%/*}"
if test "$1" != "--continue" ; then
exit $FAILED
else
local saved_failed=$FAILED
FAILED=0
return $saved_failed
fi
}
fail() {
local test_name="$1"
local fail_char="$2"
local message="$3"
: ${fail_char:=F}
: ${message:=Test $test_name failed}
local full_msg="$fail_char $NVIM_TEST_CURRENT_SUITE|$test_name :: $message"
FAIL_SUMMARY="${FAIL_SUMMARY}${NL}${full_msg}"
echo "${full_msg}" >> "${FAIL_SUMMARY_FILE}"
echo "Failed: $full_msg"
FAILED=1
}
run_test() {
local cmd="$1"
test $# -gt 0 && shift
local test_name="$1"
: ${test_name:=$cmd}
test $# -gt 0 && shift
if ! eval "$cmd" ; then
fail "${test_name}" "$@"
fi
}
run_test_wd() {
local hang_ok=
if test "$1" = "--allow-hang" ; then
hang_ok=1
shift
fi
local timeout="$1"
test $# -gt 0 && shift
local cmd="$1"
test $# -gt 0 && shift
local restart_cmd="$1"
: ${restart_cmd:=true}
test $# -gt 0 && shift
local test_name="$1"
: ${test_name:=$cmd}
test $# -gt 0 && shift
local output_file="$(mktemp)"
local status_file="$(mktemp)"
local sid_file="$(mktemp)"
local restarts=5
local prev_tmpsize=-1
while test $restarts -gt 0 ; do
: > "$status_file"
: > "$sid_file"
setsid \
env \
output_file="$output_file" \
status_file="$status_file" \
sid_file="$sid_file" \
cmd="$cmd" \
CI_DIR="$CI_DIR" \
sh -c '
. "${CI_DIR}/common/test.sh"
ps -o sid= > "$sid_file"
(
ret=0
if ! eval "$cmd" 2>&1 ; then
ret=1
fi
echo "$ret" > "$status_file"
) | tee -a "$output_file"
'
while test "$(stat -c "%s" "$status_file")" -eq 0 ; do
prev_tmpsize=$tmpsize
sleep $timeout
tmpsize="$(stat -c "%s" "$output_file")"
if test $tempsize -eq $prev_temsize ; then
# no output, assuming either hang or exit
break
fi
done
restarts=$(( restarts - 1 ))
if test "$(stat -c "%s" "$status_file")" -eq 0 ; then
# Status file not updated, assuming hang
# SID not known, this should not ever happen
if test "$(stat -c "%s" "$sid_file")" -eq 0 ; then
fail "$test_name" E "Shell did not run"
break
fi
# Kill all processes which belong to one session: should get rid of test
# processes as well as sh itself.
pkill -KILL -s$(cat "$sid_file")
if test $restarts -eq 0 ; then
if test -z "$hang_ok" ; then
fail "$test_name" E "Test hang up"
fi
else
echo "Test ${test_name} hang up, restarting"
eval "$restart_cmd"
fi
else
local new_failed="$(cat "$status_file")"
if test "$new_failed" != "0" ; then
fail "$test_name" F "Test failed in run_test_wd"
fi
break
fi
done
rm -f "$output_file"
rm -f "$status_file"
rm -f "$sid_file"
}
ended_successfully() {
if test -f "${FAIL_SUMMARY_FILE}" ; then
echo 'Test failed, complete summary:'
cat "${FAIL_SUMMARY_FILE}"
return 1
fi
if ! test -f "${END_MARKER}" ; then
echo 'ended_successfully called before end marker was touched'
return 1
fi
return 0
}
end_tests() {
touch "${END_MARKER}"
ended_successfully
}

189
ci/common/test.sh Normal file
View File

@ -0,0 +1,189 @@
. "${CI_DIR}/common/build.sh"
. "${CI_DIR}/common/suite.sh"
submit_coverage() {
if [ -n "${GCOV}" ]; then
"${CI_DIR}/common/submit_coverage.sh" "$@" || echo 'codecov upload failed.'
fi
}
print_core() {
local app="$1"
local core="$2"
if test "$app" = quiet ; then
echo "Found core $core"
return 0
fi
echo "======= Core file $core ======="
if test "${TRAVIS_OS_NAME}" = osx ; then
lldb -Q -o "bt all" -f "${app}" -c "${core}"
else
gdb -n -batch -ex 'thread apply all bt full' "${app}" -c "${core}"
fi
}
check_core_dumps() {
local del=
if test "$1" = "--delete" ; then
del=1
shift
fi
local app="${1:-${BUILD_DIR}/bin/nvim}"
local cores
if test "${TRAVIS_OS_NAME}" = osx ; then
cores="$(find /cores/ -type f -print)"
local _sudo='sudo'
else
cores="$(find ./ -type f -name 'core.*' -print)"
local _sudo=
fi
if test -z "${cores}" ; then
return
fi
local core
for core in $cores; do
if test "$del" = "1" ; then
print_core "$app" "$core" >&2
"$_sudo" rm "$core"
else
print_core "$app" "$core"
fi
done
if test "$app" != quiet ; then
fail 'cores' E 'Core dumps found'
fi
}
check_logs() {
# Iterate through each log to remove an useless warning.
for log in $(find "${1}" -type f -name "${2}"); do
sed -i "${log}" \
-e '/Warning: noted but unhandled ioctl/d' \
-e '/could cause spurious value errors to appear/d' \
-e '/See README_MISSING_SYSCALL_OR_IOCTL for guidance/d'
done
# Now do it again, but only consider files with size > 0.
local err=""
for log in $(find "${1}" -type f -name "${2}" -size +0); do
cat "${log}"
err=1
rm "${log}"
done
if test -n "${err}" ; then
fail 'logs' E 'Runtime errors detected.'
fi
}
valgrind_check() {
check_logs "${1}" "valgrind-*"
}
check_sanitizer() {
if test -n "${CLANG_SANITIZER}"; then
check_logs "${1}" "*san.*"
fi
}
run_unittests() {(
enter_suite unittests
ulimit -c unlimited || true
if ! build_make unittest ; then
fail 'unittests' F 'Unit tests failed'
fi
submit_coverage unittest
check_core_dumps "$(command -v luajit)"
exit_suite
)}
run_functionaltests() {(
enter_suite functionaltests
ulimit -c unlimited || true
if ! build_make ${FUNCTIONALTEST}; then
fail 'functionaltests' F 'Functional tests failed'
fi
submit_coverage functionaltest
check_sanitizer "${LOG_DIR}"
valgrind_check "${LOG_DIR}"
check_core_dumps
exit_suite
)}
run_oldtests() {(
enter_suite oldtests
ulimit -c unlimited || true
if ! make oldtest; then
reset
fail 'oldtests' F 'Legacy tests failed'
fi
submit_coverage oldtest
check_sanitizer "${LOG_DIR}"
valgrind_check "${LOG_DIR}"
check_core_dumps
exit_suite
)}
check_runtime_files() {(
set +x
local test_name="$1" ; shift
local message="$1" ; shift
local tst="$1" ; shift
cd runtime
for file in $(git ls-files "$@") ; do
# Check that test is not trying to work with files with spaces/etc
# Prefer failing the build over using more robust construct because files
# with IFS are not welcome.
if ! test -e "$file" ; then
fail "$test_name" E \
"It appears that $file is only a part of the file name"
fi
if ! test "$tst" "$INSTALL_PREFIX/share/nvim/runtime/$file" ; then
fail "$test_name" F "$(printf "$message" "$file")"
fi
done
)}
install_nvim() {(
enter_suite 'install_nvim'
if ! build_make install ; then
fail 'install' E 'make install failed'
exit_suite
fi
"${INSTALL_PREFIX}/bin/nvim" --version
if ! "${INSTALL_PREFIX}/bin/nvim" -u NONE -e -c ':help' -c ':qall' ; then
echo "Running ':help' in the installed nvim failed."
echo "Maybe the helptags have not been generated properly."
fail 'help' F 'Failed running :help'
fi
# Check that all runtime files were installed
check_runtime_files \
'runtime-install' \
'It appears that %s is not installed.' \
-e \
'*.vim' '*.ps' '*.dict' '*.py' '*.tutor'
# Check that some runtime files are installed and are executables
check_runtime_files \
'not-exe' \
'It appears that %s is not installed or is not executable.' \
-x \
'*.awk' '*.sh' '*.bat'
# Check that generated syntax file has function names, #5060.
local genvimsynf=syntax/vim/generated.vim
local gpat='syn keyword vimFuncName .*eval'
if ! grep -q "$gpat" "${INSTALL_PREFIX}/share/nvim/runtime/$genvimsynf" ; then
fail 'funcnames' F "It appears that $genvimsynf does not contain $gpat."
fi
exit_suite
)}
csi_clean() {
find "${BUILD_DIR}/bin" -name 'test-includes-*' -delete
find "${BUILD_DIR}" -name '*test-include*.o' -delete
}

26
ci/install.sh Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -e
set -o pipefail
if [[ "${CI_TARGET}" == lint ]]; then
python -m pip -q install --user --upgrade flake8
exit
fi
if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
export PATH="/usr/local/opt/ccache/libexec:$PATH"
fi
# Use default CC to avoid compilation problems when installing Python modules.
echo "Install neovim module for Python 3."
CC=cc python3 -m pip -q install --upgrade pynvim
echo "Install neovim module for Python 2."
CC=cc python2 -m pip -q install --upgrade pynvim
echo "Install neovim RubyGem."
gem install --no-document --version ">= 0.8.0" neovim
echo "Install neovim npm package"
npm install -g neovim
npm link neovim

32
ci/run_lint.sh Executable file
View File

@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -e
set -o pipefail
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${CI_DIR}/common/build.sh"
source "${CI_DIR}/common/suite.sh"
enter_suite 'clint'
run_test 'make clint-full' clint
exit_suite --continue
enter_suite 'lualint'
run_test 'make lualint' lualint
exit_suite --continue
enter_suite 'pylint'
run_test 'make pylint' pylint
exit_suite --continue
enter_suite single-includes
CLICOLOR_FORCE=1 run_test_wd \
--allow-hang \
10s \
'make check-single-includes' \
'csi_clean' \
single-includes
exit_suite --continue
end_tests

36
ci/run_tests.sh Executable file
View File

@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -e
set -o pipefail
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${CI_DIR}/common/build.sh"
source "${CI_DIR}/common/test.sh"
source "${CI_DIR}/common/suite.sh"
enter_suite build
check_core_dumps --delete quiet
prepare_build
build_nvim
exit_suite --continue
enter_suite tests
if test "$CLANG_SANITIZER" != "TSAN" ; then
# Additional threads are only created when the builtin UI starts, which
# doesn't happen in the unit/functional tests
if test "${FUNCTIONALTEST}" != "functionaltest-lua"; then
run_test run_unittests
fi
run_test run_functionaltests
fi
run_test run_oldtests
run_test install_nvim
exit_suite --continue
end_tests

19
ci/script.sh Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -e
set -o pipefail
# This will pass the environment variables down to a bash process which runs
# as $USER, while retaining the environment variables defined and belonging
# to secondary groups given above in usermod.
if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
sudo -E su "${USER}" -c "ci/run_${CI_TARGET}.sh"
else
ci/run_${CI_TARGET}.sh
fi
if [[ -s "${GCOV_ERROR_FILE}" ]]; then
echo '=== Unexpected gcov errors: ==='
cat "${GCOV_ERROR_FILE}"
exit 1
fi

View File

@ -1,197 +0,0 @@
include(CheckTypeSize)
include(CheckSymbolExists)
include(CheckFunctionExists)
include(CheckIncludeFiles)
include(CheckCSourceRuns)
include(CheckCSourceCompiles)
include(TestBigEndian)
check_c_source_compiles("
#include <execinfo.h>
int main(void)
{
void *trace[1];
backtrace(trace, 1);
return 0;
}
" HAVE_EXECINFO_BACKTRACE)
check_c_source_compiles("
int main(void)
{
int a = 42;
__builtin_add_overflow(a, a, &a);
__builtin_sub_overflow(a, a, &a);
return 0;
}
" HAVE_BUILTIN_ADD_OVERFLOW)
check_type_size("int" SIZEOF_INT LANGUAGE C)
check_type_size("long" SIZEOF_LONG LANGUAGE C)
check_type_size("intmax_t" SIZEOF_INTMAX_T LANGUAGE C)
check_type_size("size_t" SIZEOF_SIZE_T LANGUAGE C)
check_type_size("void *" SIZEOF_VOID_PTR LANGUAGE C)
check_symbol_exists(_NSGetEnviron crt_externs.h HAVE__NSGETENVIRON)
# Headers
check_include_files(langinfo.h HAVE_LANGINFO_H)
check_include_files(strings.h HAVE_STRINGS_H)
check_include_files(sys/utsname.h HAVE_SYS_UTSNAME_H)
check_include_files(termios.h HAVE_TERMIOS_H)
check_include_files(sys/uio.h HAVE_SYS_UIO_H)
check_include_files(sys/sdt.h HAVE_SYS_SDT_H)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
check_include_files(sys/xattr.h HAVE_XATTR)
endif()
# Functions
check_function_exists(fseeko HAVE_FSEEKO)
check_function_exists(readv HAVE_READV)
check_function_exists(readlink HAVE_READLINK)
check_function_exists(strnlen HAVE_STRNLEN)
check_function_exists(strcasecmp HAVE_STRCASECMP)
check_function_exists(strncasecmp HAVE_STRNCASECMP)
check_function_exists(strptime HAVE_STRPTIME)
check_c_source_compiles("
#include <sys/types.h>
#include <dirent.h>
#include <sys/file.h>
int main(void)
{
DIR *dir = opendir(\"dirname\");
dirfd(dir);
flock(10, LOCK_SH);
return 0;
}
" HAVE_DIRFD_AND_FLOCK)
check_c_source_compiles("
#include <pwd.h>
int main(void)
{
getpwent();
getpwuid(0);
getpwnam(\"root\");
return 0;
}
" HAVE_PWD_FUNCS)
check_c_source_compiles("
#include <intrin.h>
int main(void)
{
unsigned long index;
unsigned char mask = 0x8000;
_BitScanForward64(&index, mask);
return 0;
}
" HAVE_BITSCANFORWARD64)
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
check_c_source_compiles("
#include <termios.h>
int
main(void)
{
return forkpty(0, NULL, NULL, NULL);
}
" HAVE_FORKPTY)
else()
set(HAVE_FORKPTY 1)
endif()
# Symbols
check_symbol_exists(FD_CLOEXEC "fcntl.h" HAVE_FD_CLOEXEC)
if(HAVE_LANGINFO_H)
check_symbol_exists(CODESET "langinfo.h" HAVE_NL_LANGINFO_CODESET)
endif()
check_include_files("endian.h" HAVE_ENDIAN_H)
set(ENDIAN_INCLUDE_FILE "endian.h")
if(NOT HAVE_ENDIAN_H)
check_include_files("sys/endian.h" HAVE_SYS_ENDIAN_H)
if (HAVE_SYS_ENDIAN_H)
set(ENDIAN_INCLUDE_FILE "sys/endian.h")
endif()
endif()
set(SI "#include <stdint.h>\n")
set(MS "int main(int argc,char**argv)\n{\n uint64_t i=0x0102030405060708ULL;")
set(ME "}")
check_c_source_compiles("
#define _BSD_SOURCE 1
#define _DEFAULT_SOURCE 1
${SI}
#include <${ENDIAN_INCLUDE_FILE}>
#ifndef be64toh
# error No be64toh macros
#endif
${MS}
uint64_t j = be64toh(i);
return (j == 0); // j must not be zero
${ME}"
HAVE_BE64TOH_MACROS)
if(NOT "${HAVE_BE64TOH_MACROS}")
check_function_exists(be64toh HAVE_BE64TOH_FUNC)
endif()
if("${HAVE_BE64TOH_MACROS}" OR "${HAVE_BE64TOH_FUNC}")
set(HAVE_BE64TOH 1)
endif()
test_big_endian(ORDER_BIG_ENDIAN)
configure_file (
"${PROJECT_SOURCE_DIR}/cmake.config/config.h.in"
"${PROJECT_BINARY_DIR}/cmake.config/auto/config.h"
)
set(VERSION_STRING "${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} ")
foreach(BUILD_TYPE Debug Release RelWithDebInfo MinSizeRel)
string(TOUPPER ${BUILD_TYPE} BUILD_TYPE_UPPER)
set(GEN_CONFIG "$<CONFIG:${BUILD_TYPE}>")
set(GEN_RHS "${CMAKE_C_FLAGS_${BUILD_TYPE_UPPER}} ")
string(APPEND VERSION_STRING "$<${GEN_CONFIG}:${GEN_RHS}>")
set(GEN_RHS "$<$<BOOL:$<TARGET_PROPERTY:nvim_bin,INTERPROCEDURAL_OPTIMIZATION_${BUILD_TYPE_UPPER}>>:${CMAKE_C_COMPILE_OPTIONS_IPO}>")
string(APPEND VERSION_STRING "$<${GEN_CONFIG}:${GEN_RHS}>")
endforeach()
string(APPEND VERSION_STRING " ")
function(append_target_expression)
cmake_parse_arguments(ARG
""
"PREFIX;PROPERTY"
""
${ARGN})
set(TARGET_EXPRESSION "$<TARGET_PROPERTY:nvim_bin,${ARG_PROPERTY}>")
set(TARGET_EXPRESSION "$<REMOVE_DUPLICATES:${TARGET_EXPRESSION}>")
set(TARGET_EXPRESSION "${ARG_PREFIX}$<JOIN:${TARGET_EXPRESSION}, ${ARG_PREFIX}>")
set(VERSION_STRING "${VERSION_STRING} ${TARGET_EXPRESSION} " PARENT_SCOPE)
endfunction()
append_target_expression(PROPERTY COMPILE_OPTIONS)
append_target_expression(PROPERTY LINK_OPTIONS)
append_target_expression(PREFIX "-D" PROPERTY COMPILE_DEFINITIONS)
append_target_expression(PREFIX "-I" PROPERTY INCLUDE_DIRECTORIES)
string(REPLACE ";" " " VERSION_STRING "${VERSION_STRING}")
string(REPLACE " " " " VERSION_STRING "${VERSION_STRING}")
configure_file(versiondef.h.in auto/versiondef.h.gen)
file(GENERATE
OUTPUT "${PROJECT_BINARY_DIR}/cmake.config/auto/versiondef-$<CONFIG>.h"
INPUT "${PROJECT_BINARY_DIR}/cmake.config/auto/versiondef.h.gen")
configure_file (
"${PROJECT_SOURCE_DIR}/cmake.config/pathdef.h.in"
"${PROJECT_BINARY_DIR}/cmake.config/auto/pathdef.h"
ESCAPE_QUOTES)

File diff suppressed because it is too large Load Diff

View File

@ -1,30 +0,0 @@
[
{ ref: "c99.imp" },
{ ref: "posix.imp" },
{ symbol: [ "FUNC_ATTR_ALLOC_ALIGN", private, '"nvim/func_attr.h"', public ] },
{ symbol: [ "FUNC_ATTR_ALLOC_SIZE", private, '"nvim/func_attr.h"', public ] },
{ symbol: [ "FUNC_ATTR_ALLOC_SIZE_PROD", private, '"nvim/func_attr.h"', public ] },
{ symbol: [ "FUNC_ATTR_ALWAYS_INLINE", private, '"nvim/func_attr.h"', public ] },
{ symbol: [ "FUNC_ATTR_CONST", private, '"nvim/func_attr.h"', public ] },
{ symbol: [ "FUNC_ATTR_MALLOC", private, '"nvim/func_attr.h"', public ] },
{ symbol: [ "FUNC_ATTR_NONNULL_ALL", private, '"nvim/func_attr.h"', public ] },
{ symbol: [ "FUNC_ATTR_NONNULL_ARG", private, '"nvim/func_attr.h"', public ] },
{ symbol: [ "FUNC_ATTR_NONNULL_RET", private, '"nvim/func_attr.h"', public ] },
{ symbol: [ "FUNC_ATTR_NORETURN", private, '"nvim/func_attr.h"', public ] },
{ symbol: [ "FUNC_ATTR_NO_SANITIZE_ADDRESS", private, '"nvim/func_attr.h"', public ] },
{ symbol: [ "FUNC_ATTR_NO_SANITIZE_UNDEFINED", private, '"nvim/func_attr.h"', public ] },
{ symbol: [ "FUNC_ATTR_PRINTF", private, '"nvim/func_attr.h"', public ] },
{ symbol: [ "FUNC_ATTR_PURE", private, '"nvim/func_attr.h"', public ] },
{ symbol: [ "FUNC_ATTR_UNUSED", private, '"nvim/func_attr.h"', public ] },
{ symbol: [ "FUNC_ATTR_WARN_UNUSED_RESULT", private, '"nvim/func_attr.h"', public ] },
{ symbol: [ "MAX", private, '"nvim/macros_defs.h"', public ] },
{ symbol: [ "MIN", private, '"nvim/macros_defs.h"', public ] },
{ symbol: [ "extern_proc", private, '<uv.h>', public ] },
{ symbol: [ "iovec", private, '<sys/uio.h>', public ] },
{ symbol: [ "ssize_t", private, '<uv.h>', public ] },
{ include: [ '<uv/unix.h>', private, '<uv.h>', public ] },
]
# vim: set ft=toml:

View File

@ -1,33 +0,0 @@
[
{ include: [ "<arm/limits.h>", private, "<limits.h>", public ] },
{ include: [ "<asm/ioctls.h>", private, "<bits/ioctls.h>", private ] },
{ include: [ "<bits/termios-c_lflag.h>", private, "<termios.h>", public ] },
{ include: [ "<bits/termios-struct.h>", private, "<termios.h>", public ] },
{ include: [ "<sys/errno.h>", private, "<errno.h>", public ] },
{ include: [ "<sys/fcntl.h>", private, "<fcntl.h>", public ] },
{ include: [ "<sys/signal.h>", private, "<signal.h>", public ] },
{ include: [ "<sys/termios.h>", private, "<termios.h>", public ] },
{ include: [ '<asm/errno-base.h>', private, '<errno.h>', public ] },
{ include: [ '<asm/errno.h>', private, '<errno.h>', public ] },
{ include: [ '<bits/termios-c_cc.h>', private, '<termios.h>', public ] },
{ include: [ '<bits/termios-c_cflag.h>', private, '<termios.h>', public ] },
{ include: [ '<bits/termios-c_iflag.h>', private, '<termios.h>', public ] },
{ include: [ '<bits/termios-c_oflag.h>', private, '<termios.h>', public ] },
{ include: [ '<sys/ttycom.h>', private, '<sys/ioctl.h>', public ] },
{ include: [ '<sys/unistd.h>', private, '<unistd.h>', private ] },
{ symbol: ["SOCK_STREAM", private, "<sys/socket.h>", public ] },
{ symbol: ["SSIZE_MAX", private, "<limits.h>", public ] },
{ symbol: ["S_IREAD", private, "<sys/stat.h>", public ] },
{ symbol: ["S_IWRITE", private, "<sys/stat.h>", public ] },
{ symbol: ["_POSIX_VDISABLE", private, "<unistd.h>", private ] },
{ symbol: ["flock", private, "<sys/file.h>", public ] },
{ symbol: ["iovec", private, "<sys/uio.h>", public ] },
{ symbol: ["mode_t", private, "<sys/types.h>", public ] },
{ symbol: ["ntohs", private, "<arpa/inet.h>", public ] },
{ symbol: ["pthread_sigmask", private, "<signal.h>", public ] },
{ symbol: ["sigset_t", private, "<signal.h>", public ] },
{ symbol: ["uid_t", private, "<sys/types.h>", public ] },
]
# vim: set ft=toml:

View File

@ -1,3 +0,0 @@
char *default_vim_dir = "${CMAKE_INSTALL_FULL_DATAROOTDIR}/nvim";
char *default_vimruntime_dir = "";
char *default_lib_dir = "${CMAKE_INSTALL_FULL_LIBDIR}/nvim";

View File

@ -1,163 +0,0 @@
# This is not meant to be included by the top-level.
cmake_minimum_required(VERSION 3.16)
project(NVIM_DEPS C)
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()
# Point CMake at any custom modules we may ship
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" "${PROJECT_SOURCE_DIR}/../cmake")
include(CheckCCompilerFlag)
include(ExternalProject)
include(FindPackageHandleStandardArgs)
include(Deps)
include(Find)
include(Util)
#-------------------------------------------------------------------------------
# User settings
#-------------------------------------------------------------------------------
set(DEPS_IGNORE_SHA FALSE)
# Options
option(USE_BUNDLED "Use bundled dependencies." ON)
option(USE_BUNDLED_LIBUV "Use the bundled libuv." ${USE_BUNDLED})
option(USE_BUNDLED_LPEG "Use the bundled lpeg." ${USE_BUNDLED})
# PUC Lua is only used for tests, unless explicitly requested.
option(USE_BUNDLED_LUA "Use the bundled version of lua." OFF)
option(USE_BUNDLED_LUAJIT "Use the bundled version of luajit." ${USE_BUNDLED})
option(USE_BUNDLED_LUV "Use the bundled version of luv." ${USE_BUNDLED})
option(USE_BUNDLED_TS "Use the bundled treesitter runtime." ${USE_BUNDLED})
option(USE_BUNDLED_TS_PARSERS "Use the bundled treesitter parsers." ${USE_BUNDLED})
option(USE_BUNDLED_UNIBILIUM "Use the bundled unibilium." ${USE_BUNDLED})
option(USE_BUNDLED_UTF8PROC "Use the bundled utf8proc library." ${USE_BUNDLED})
if(USE_BUNDLED AND MSVC)
option(USE_BUNDLED_GETTEXT "Use the bundled version of gettext." ON)
option(USE_BUNDLED_LIBICONV "Use the bundled version of libiconv." ON)
else()
option(USE_BUNDLED_GETTEXT "Use the bundled version of gettext." OFF)
option(USE_BUNDLED_LIBICONV "Use the bundled version of libiconv." OFF)
endif()
option(ENABLE_WASMTIME "Use treesitter with wasmtime support." OFF)
if(ENABLE_WASMTIME)
if(USE_BUNDLED)
option(USE_BUNDLED_WASMTIME "Use the bundled wasmtime." ON)
else()
option(USE_BUNDLED_WASMTIME "Use the bundled wasmtime." OFF)
endif()
endif()
if(NOT ENABLE_WASMTIME AND USE_BUNDLED_WASMTIME)
message(FATAL_ERROR "ENABLE_WASMTIME is set to OFF while USE_BUNDLED_WASMTIME is set to ON.\
You need set ENABLE_WASMTIME to ON if you want to use wasmtime.")
endif()
option(USE_EXISTING_SRC_DIR "Skip download of deps sources in case of existing source directory." OFF)
set_default_buildtype(Release)
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(NOT isMultiConfig)
list(APPEND DEPS_CMAKE_ARGS -D CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
endif()
set(DEFAULT_MAKE_CFLAGS CFLAGS+=-g)
check_c_compiler_flag(-Og HAS_OG_FLAG)
if(HAS_OG_FLAG)
set(DEFAULT_MAKE_CFLAGS CFLAGS+=-Og ${DEFAULT_MAKE_CFLAGS})
endif()
set(DEPS_INCLUDE_FLAGS "-I${DEPS_INSTALL_DIR}/include -I${DEPS_INSTALL_DIR}/include/luajit-2.1")
# If the macOS deployment target is not set manually (via $MACOSX_DEPLOYMENT_TARGET),
# fall back to local system version. Needs to be done here and in top-level CMakeLists.txt.
if(APPLE)
if(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
execute_process(COMMAND sw_vers -productVersion
OUTPUT_VARIABLE MACOS_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "${MACOS_VERSION}")
endif()
message(STATUS "Using deployment target ${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif()
if(USE_BUNDLED_LUAJIT)
set(LUA_ENGINE LuaJit)
elseif(USE_BUNDLED_LUA)
set(LUA_ENGINE Lua)
else()
find_package(Luajit)
find_package(Lua 5.1 EXACT)
if(LUAJIT_FOUND)
set(LUA_ENGINE LuaJit)
string(APPEND DEPS_INCLUDE_FLAGS " -I${LUAJIT_INCLUDE_DIR}")
elseif(LUA_FOUND)
set(LUA_ENGINE Lua)
string(APPEND DEPS_INCLUDE_FLAGS " -I${LUA_INCLUDE_DIR}")
else()
message(FATAL_ERROR "Could not find system lua or luajit")
endif()
endif()
if(USE_BUNDLED_UNIBILIUM)
include(BuildUnibilium)
endif()
if(USE_BUNDLED_LIBUV)
include(BuildLibuv)
endif()
if(USE_BUNDLED_LUAJIT)
include(BuildLuajit)
endif()
if(USE_BUNDLED_LUA)
include(BuildLua)
endif()
if(USE_BUNDLED_LUV)
include(BuildLuv)
endif()
if(USE_BUNDLED_LPEG)
include(BuildLpeg)
endif()
if(USE_BUNDLED_GETTEXT)
include(BuildGettext)
endif()
if(USE_BUNDLED_LIBICONV)
include(BuildLibiconv)
endif()
if(USE_BUNDLED_TS_PARSERS)
include(BuildTreesitterParsers)
endif()
if(USE_BUNDLED_WASMTIME)
include(BuildWasmtime)
endif()
if(USE_BUNDLED_TS)
include(BuildTreesitter)
endif()
if(USE_BUNDLED_UTF8PROC)
include(BuildUTF8proc)
endif()
if(WIN32)
include(GetBinaryDeps)
GetExecutable(TARGET xxd)
GetBinaryDep(TARGET win32yank_X86_64
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy win32yank.exe ${DEPS_BIN_DIR})
endif()

View File

@ -1,26 +0,0 @@
{
"version": 3,
"configurePresets": [
{
"name": "base",
"generator": "Ninja",
"binaryDir": "${sourceDir}/../.deps",
"hidden": true
},
{
"name": "ci",
"inherits": ["base"]
},
{
"name": "external_deps",
"description": "Build neovim with external deps on ubuntu",
"cacheVariables": {
"USE_BUNDLED":"OFF",
"USE_BUNDLED_TS":"ON",
"USE_BUNDLED_UTF8PROC":"ON",
"ENABLE_WASMTIME":"OFF"
},
"inherits": ["base"]
}
]
}

View File

@ -1,18 +0,0 @@
if(MSVC)
get_externalproject_options(gettext ${DEPS_IGNORE_SHA})
ExternalProject_Add(gettext
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/gettext
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/cmake/GettextCMakeLists.txt
${DEPS_BUILD_DIR}/src/gettext/CMakeLists.txt
CMAKE_ARGS ${DEPS_CMAKE_ARGS}
-D LIBICONV_INCLUDE_DIRS=${DEPS_INSTALL_DIR}/include
-D LIBICONV_LIBRARIES=${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}libcharset${CMAKE_STATIC_LIBRARY_SUFFIX}$<SEMICOLON>${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}libiconv${CMAKE_STATIC_LIBRARY_SUFFIX}
${EXTERNALPROJECT_OPTIONS})
else()
message(FATAL_ERROR "Trying to build gettext in an unsupported system ${CMAKE_SYSTEM_NAME}/${CMAKE_C_COMPILER_ID}")
endif()
if(USE_BUNDLED_LIBICONV)
add_dependencies(gettext libiconv)
endif()

View File

@ -1,12 +0,0 @@
if(MSVC)
get_externalproject_options(libiconv ${DEPS_IGNORE_SHA})
ExternalProject_Add(libiconv
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libiconv
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/cmake/LibiconvCMakeLists.txt
${DEPS_BUILD_DIR}/src/libiconv/CMakeLists.txt
CMAKE_ARGS ${DEPS_CMAKE_ARGS}
${EXTERNALPROJECT_OPTIONS})
else()
message(FATAL_ERROR "Trying to build libiconv in an unsupported system ${CMAKE_SYSTEM_NAME}/${CMAKE_C_COMPILER_ID}")
endif()

View File

@ -1,9 +0,0 @@
get_externalproject_options(libuv ${DEPS_IGNORE_SHA})
ExternalProject_Add(libuv
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libuv
CMAKE_ARGS ${DEPS_CMAKE_ARGS}
-D CMAKE_INSTALL_LIBDIR=lib
-D BUILD_TESTING=OFF
-D LIBUV_BUILD_SHARED=OFF
-D UV_LINT_W4=OFF
${EXTERNALPROJECT_OPTIONS})

View File

@ -1,14 +0,0 @@
get_externalproject_options(lpeg ${DEPS_IGNORE_SHA})
ExternalProject_Add(lpeg
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/lpeg
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/cmake/LpegCMakeLists.txt
${DEPS_BUILD_DIR}/src/lpeg/CMakeLists.txt
CMAKE_ARGS ${DEPS_CMAKE_ARGS} -DCMAKE_C_FLAGS=${DEPS_INCLUDE_FLAGS}
${EXTERNALPROJECT_OPTIONS})
if(USE_BUNDLED_LUAJIT)
add_dependencies(lpeg luajit)
elseif(USE_BUNDLED_LUA)
add_dependencies(lpeg lua)
endif()

View File

@ -1,50 +0,0 @@
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(LUA_TARGET linux)
elseif(APPLE)
set(LUA_TARGET macosx)
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
set(LUA_TARGET freebsd)
elseif(CMAKE_SYSTEM_NAME MATCHES "BSD")
set(LUA_TARGET bsd)
elseif(CMAKE_SYSTEM_NAME MATCHES "^MINGW")
set(LUA_TARGET mingw)
else()
if(UNIX)
set(LUA_TARGET posix)
else()
set(LUA_TARGET generic)
endif()
endif()
set(LUA_CFLAGS "-O2 -g3 -fPIC")
set(LUA_LDFLAGS "")
if(ENABLE_ASAN_UBSAN)
set(LUA_CFLAGS "${LUA_CFLAGS} -fsanitize=address")
set(LUA_CFLAGS "${LUA_CFLAGS} -fno-omit-frame-pointer")
set(LUA_CFLAGS "${LUA_CFLAGS} -fno-optimize-sibling-calls")
set(LUA_LDFLAGS "${LUA_LDFLAGS} -fsanitize=address")
endif()
set(LUA_CONFIGURE_COMMAND
sed -e "/^CC/s@gcc@${CMAKE_C_COMPILER}@"
-e "/^CFLAGS/s@-O2@${LUA_CFLAGS}@"
-e "/^MYLDFLAGS/s@$@${LUA_LDFLAGS}@"
-e "s@-lreadline@@g"
-e "s@-lhistory@@g"
-e "s@-lncurses@@g"
-i ${DEPS_BUILD_DIR}/src/lua/src/Makefile &&
sed -e "/#define LUA_USE_READLINE/d"
-e "s@\\(#define LUA_ROOT[ ]*\"\\)/usr/local@\\1${DEPS_INSTALL_DIR}@"
-i ${DEPS_BUILD_DIR}/src/lua/src/luaconf.h)
set(LUA_INSTALL_TOP_ARG "INSTALL_TOP=${DEPS_INSTALL_DIR}")
get_externalproject_options(lua ${DEPS_IGNORE_SHA})
ExternalProject_Add(lua
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/lua
CONFIGURE_COMMAND "${LUA_CONFIGURE_COMMAND}"
BUILD_IN_SOURCE 1
BUILD_COMMAND ${MAKE_PRG} ${LUA_INSTALL_TOP_ARG} ${LUA_TARGET}
INSTALL_COMMAND ${MAKE_PRG} ${LUA_INSTALL_TOP_ARG} install
${EXTERNALPROJECT_OPTIONS})

View File

@ -1,94 +0,0 @@
function(BuildLuajit)
cmake_parse_arguments(_luajit
""
""
"CONFIGURE_COMMAND;BUILD_COMMAND;INSTALL_COMMAND;DEPENDS"
${ARGN})
get_externalproject_options(luajit ${DEPS_IGNORE_SHA})
ExternalProject_Add(luajit
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/luajit
CONFIGURE_COMMAND "${_luajit_CONFIGURE_COMMAND}"
BUILD_IN_SOURCE 1
BUILD_COMMAND "${_luajit_BUILD_COMMAND}"
INSTALL_COMMAND "${_luajit_INSTALL_COMMAND}"
DEPENDS "${_luajit_DEPENDS}"
${EXTERNALPROJECT_OPTIONS})
endfunction()
check_c_compiler_flag(-fno-stack-check HAS_NO_STACK_CHECK)
if(APPLE AND HAS_NO_STACK_CHECK)
set(NO_STACK_CHECK "CFLAGS+=-fno-stack-check")
else()
set(NO_STACK_CHECK "")
endif()
if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
set(AMD64_ABI "LDFLAGS=-lpthread -lc++abi")
else()
set(AMD64_ABI "")
endif()
set(BUILDCMD_UNIX ${MAKE_PRG} -j CFLAGS=-fPIC
CFLAGS+=-DLUA_USE_APICHECK
CFLAGS+=-funwind-tables
${NO_STACK_CHECK}
${AMD64_ABI}
CCDEBUG+=-g
Q=)
# Setting MACOSX_DEPLOYMENT_TARGET is mandatory for LuaJIT; use version set by
# cmake.deps/CMakeLists.txt (either environment variable or current system version).
if(APPLE)
set(DEPLOYMENT_TARGET "MACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif()
if(UNIX)
BuildLuajit(INSTALL_COMMAND ${BUILDCMD_UNIX}
CC=${DEPS_C_COMPILER} PREFIX=${DEPS_INSTALL_DIR}
${DEPLOYMENT_TARGET} install)
elseif(MINGW)
if(CMAKE_GENERATOR MATCHES "Ninja")
set(LUAJIT_MAKE_PRG ${MAKE_PRG})
else()
set(LUAJIT_MAKE_PRG ${CMAKE_MAKE_PROGRAM})
endif()
BuildLuajit(BUILD_COMMAND ${LUAJIT_MAKE_PRG} CC=${DEPS_C_COMPILER}
PREFIX=${DEPS_INSTALL_DIR}
CFLAGS+=-DLUA_USE_APICHECK
CFLAGS+=-funwind-tables
CCDEBUG+=-g
BUILDMODE=static
# Build a DLL too
COMMAND ${LUAJIT_MAKE_PRG} CC=${DEPS_C_COMPILER} BUILDMODE=dynamic
INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BIN_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${DEPS_BUILD_DIR}/src/luajit/src/luajit.exe ${DEPS_BIN_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${DEPS_BUILD_DIR}/src/luajit/src/lua51.dll ${DEPS_BIN_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_LIB_DIR}
# Luarocks searches for lua51.dll in lib
COMMAND ${CMAKE_COMMAND} -E copy ${DEPS_BUILD_DIR}/src/luajit/src/lua51.dll ${DEPS_LIB_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${DEPS_BUILD_DIR}/src/luajit/src/libluajit.a ${DEPS_LIB_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_INSTALL_DIR}/include/luajit-2.1
COMMAND ${CMAKE_COMMAND} -DFROM_GLOB=${DEPS_BUILD_DIR}/src/luajit/src/*.h -DTO=${DEPS_INSTALL_DIR}/include/luajit-2.1 -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/CopyFilesGlob.cmake
COMMAND ${CMAKE_COMMAND} -E copy_directory ${DEPS_BUILD_DIR}/src/luajit/src/jit ${DEPS_INSTALL_DIR}/share/luajit-2.1/jit
)
elseif(MSVC)
BuildLuajit(
BUILD_COMMAND ${CMAKE_COMMAND} -E chdir ${DEPS_BUILD_DIR}/src/luajit/src ${DEPS_BUILD_DIR}/src/luajit/src/msvcbuild.bat
INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_BIN_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${DEPS_BUILD_DIR}/src/luajit/src/luajit.exe ${DEPS_BIN_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${DEPS_BUILD_DIR}/src/luajit/src/lua51.dll ${DEPS_BIN_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_LIB_DIR}
# Luarocks searches for lua51.lib
COMMAND ${CMAKE_COMMAND} -E copy ${DEPS_BUILD_DIR}/src/luajit/src/lua51.lib ${DEPS_LIB_DIR}/lua51.lib
# Luv searches for luajit.lib
COMMAND ${CMAKE_COMMAND} -E copy ${DEPS_BUILD_DIR}/src/luajit/src/lua51.lib ${DEPS_LIB_DIR}/luajit.lib
COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_INSTALL_DIR}/include/luajit-2.1
COMMAND ${CMAKE_COMMAND} -DFROM_GLOB=${DEPS_BUILD_DIR}/src/luajit/src/*.h -DTO=${DEPS_INSTALL_DIR}/include/luajit-2.1 -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/CopyFilesGlob.cmake
COMMAND ${CMAKE_COMMAND} -E copy_directory ${DEPS_BUILD_DIR}/src/luajit/src/jit ${DEPS_INSTALL_DIR}/share/luajit-2.1/jit
)
else()
message(FATAL_ERROR "Trying to build luajit in an unsupported system ${CMAKE_SYSTEM_NAME}/${CMAKE_C_COMPILER_ID}")
endif()

View File

@ -1,43 +0,0 @@
set(LUV_CMAKE_ARGS
-D LUA_BUILD_TYPE=System
-D LUA_COMPAT53_DIR=${DEPS_BUILD_DIR}/src/lua_compat53
-D WITH_SHARED_LIBUV=ON
-D BUILD_STATIC_LIBS=ON
-D BUILD_MODULE=OFF)
list(APPEND LUV_CMAKE_ARGS -D WITH_LUA_ENGINE=${LUA_ENGINE})
if(USE_BUNDLED_LIBUV)
list(APPEND LUV_CMAKE_ARGS -D CMAKE_PREFIX_PATH=${DEPS_INSTALL_DIR})
endif()
list(APPEND LUV_CMAKE_ARGS "-DCMAKE_C_FLAGS:STRING=${DEPS_INCLUDE_FLAGS} -w")
if(CMAKE_GENERATOR MATCHES "Unix Makefiles" AND
(CMAKE_SYSTEM_NAME MATCHES ".*BSD" OR CMAKE_SYSTEM_NAME MATCHES "DragonFly"))
list(APPEND LUV_CMAKE_ARGS -D CMAKE_MAKE_PROGRAM=gmake)
endif()
get_externalproject_options(lua_compat53 ${DEPS_IGNORE_SHA})
ExternalProject_Add(lua_compat53
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/lua_compat53
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
${EXTERNALPROJECT_OPTIONS})
get_externalproject_options(luv ${DEPS_IGNORE_SHA})
ExternalProject_Add(luv
DEPENDS lua_compat53
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/luv
SOURCE_DIR ${DEPS_BUILD_DIR}/src/luv
CMAKE_ARGS ${DEPS_CMAKE_ARGS} ${LUV_CMAKE_ARGS}
${EXTERNALPROJECT_OPTIONS})
if(USE_BUNDLED_LUAJIT)
add_dependencies(luv luajit)
elseif(USE_BUNDLED_LUA)
add_dependencies(luv lua)
endif()
if(USE_BUNDLED_LIBUV)
add_dependencies(luv libuv)
endif()

View File

@ -1,14 +0,0 @@
if(ENABLE_WASMTIME)
set(TREESITTER_ARGS -D TREE_SITTER_FEATURE_WASM=ON)
endif()
get_externalproject_options(treesitter ${DEPS_IGNORE_SHA})
ExternalProject_Add(treesitter
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/treesitter
SOURCE_SUBDIR lib
CMAKE_ARGS ${DEPS_CMAKE_ARGS} ${TREESITTER_ARGS}
${EXTERNALPROJECT_OPTIONS})
if(USE_BUNDLED_WASMTIME)
add_dependencies(treesitter wasmtime)
endif()

View File

@ -1,34 +0,0 @@
# Helper function to download treesitter parsers
#
# Single value arguments:
# LANG - Parser language
# CMAKE_FILE - Cmake file to build the parser with. Defaults to
# TreesitterParserCMakeLists.txt.
function(BuildTSParser)
cmake_parse_arguments(TS
""
"LANG;CMAKE_FILE"
""
${ARGN})
if(NOT TS_CMAKE_FILE)
set(TS_CMAKE_FILE TreesitterParserCMakeLists.txt)
endif()
set(NAME treesitter_${TS_LANG})
get_externalproject_options(${NAME} ${DEPS_IGNORE_SHA})
ExternalProject_Add(${NAME}
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/${NAME}
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/cmake/${TS_CMAKE_FILE}
${DEPS_BUILD_DIR}/src/${NAME}/CMakeLists.txt
CMAKE_ARGS ${DEPS_CMAKE_ARGS}
-D PARSERLANG=${TS_LANG}
${EXTERNALPROJECT_OPTIONS})
endfunction()
foreach(lang c lua vim vimdoc query)
BuildTSParser(LANG ${lang})
endforeach()
BuildTSParser(LANG markdown CMAKE_FILE MarkdownParserCMakeLists.txt)

Some files were not shown because too many files have changed in this diff Show More