Compare commits

..

42 Commits

Author SHA1 Message Date
Justin M. Keyes
edad360800 NVIM v0.3.8
FIXES:

5b47e4dc38 #10341 security: 'modeline', 'modelineexpr'
e4ecb70d08 #10345 Disallow API calls in the sandbox.
2019-07-03 03:11:42 +02:00
Justin M. Keyes
e4ecb70d08 Merge #10345 from bfredl/apisandbox-0.3
eval/api: don't allow the API to be called in the sandbox.
2019-06-27 00:13:18 +02:00
Björn Linse
413b313ad2 eval/api: don't allow the API to be called in the sandbox.
Identifying and maintaining a "secure" subset of the API would be too
much busywork. So just disable the entire thing.
2019-06-26 21:04:20 +02:00
Justin M. Keyes
5b47e4dc38 Merge #10341 from jamessan/modeline-backports
Modeline fix backports
2019-06-26 21:02:24 +02:00
James McCoy
959ff84e04 vim-patch:8.1.1401: misspelled mkspellmem as makespellmem
Problem:    Misspelled mkspellmem as makespellmem.
Solution:   Drop duplicate help entry, fix test. (Naruhiko Nishino, Ken
            Takata, closes vim/vim#4437)
076073950c
2019-06-26 00:15:41 -04:00
James McCoy
13f3a21226 vim-patch:8.1.1382: error when editing test file
Problem:    Error when editing test file.
Solution:   Remove part of modeline.
3020a87cb1
2019-06-26 00:15:23 -04:00
James McCoy
1bb1b5087e vim-patch:8.1.1368: modeline test fails with python but without pythonhome
Problem:    Modeline test fails with python but without pythonhome.
Solution:   Correct test argument.
e09244ee35
2019-06-26 00:15:16 -04:00
James McCoy
536e9320a0 vim-patch:8.1.1367: can set 'modelineexpr' in modeline
Problem:    can set 'modelineexpr' in modeline.
Solution:   Add P_SECURE flag.
7e800c6047
2019-06-26 00:15:06 -04:00
James McCoy
3bd532ad15 vim-patch:8.1.1366: using expressions in a modeline is unsafe
Problem:    Using expressions in a modeline is unsafe.
Solution:   Disallow using expressions in a modeline, unless the
            'modelineexpr' option is set.  Update help, add more tests.
110289e781
2019-06-26 00:14:33 -04:00
Jan Edmund Lazo
2c5eede368 vim-patch:8.1.0547: modeline test with keymap still fails
Problem:    Modeline test with keymap still fails.
Solution:   Check that the keymap feature is available for the failure assert.
3067a4dd0d
2019-06-26 00:14:29 -04:00
Jan Edmund Lazo
9ab48aac20 vim-patch:8.1.0546: modeline test with keymap fails
Problem:    Modeline test with keymap fails.
Solution:   Check that the keymap feature is available.
4ace6ab7e7
2019-06-26 00:14:25 -04:00
Jan Edmund Lazo
5cca6f61bb vim-patch:8.1.0506: modeline test fails when run by root
Problem:    Modeline test fails when run by root.
Solution:   Set 'modeline' for the test. (James McCoy, closes vim/vim#3592)
9691f82f86

N/A patches:

vim-patch:8.1.0208: file left behind after running individual test
2019-06-26 00:14:20 -04:00
Jan Edmund Lazo
6683cb60b8 vim-patch:8.1.0206: duplicate test function name
Problem:    Duplicate test function name.
Solution:   Rename both functions.
cd96eef3a8
2019-06-26 00:14:16 -04:00
Jan Edmund Lazo
a72c05a6f6 vim-patch:8.1.0205: invalid memory access with invalid modeline
Problem:    Invalid memory access with invalid modeline.
Solution:   Pass pointer limit. Add a test. (closes vim/vim#3241)
9cf4b5005f
2019-06-26 00:14:00 -04:00
Jan Edmund Lazo
ad8bba10c4 vim-patch:8.1.1046: the "secure" variable is used inconsistently
Problem:    the "secure" variable is used inconsistently. (Justin M. Keyes)
Solution:   Set it to one instead of incrementing.
82b033eff8
2019-06-26 00:13:54 -04:00
Jan Edmund Lazo
9dca0b27df vim-patch:8.1.0613: when executing an insecure function the secure flag is stuck
Problem:    When executing an insecure function the secure flag is stuck.
            (Gabriel Barta)
Solution:   Restore "secure" instead of decrementing it. (closes vim/vim#3705)
48f377a476
2019-06-26 00:13:48 -04:00
Abdelhakeem
0ec8da4387 fixup: use vim_snprintf, ASCII_ISALNUM
ASCII_ISALNUM is part of vim-patch:8.1.0540
2019-06-26 00:13:27 -04:00
Abdelhakeem
1d3a1b55d1 vim-patch:8.1.0544: setting 'filetype' in a modeline causes an error
Problem:    Setting 'filetype' in a modeline causes an error (Hirohito
            Higashi).
Solution:   Don't add the P_INSECURE flag when setting 'filetype' from a
            modeline.  Also for 'syntax'.
916a818cea
2019-06-25 22:28:41 -04:00
Abdelhakeem
7ddb102292 vim-patch:8.1.0540: may evaluate insecure value when appending to option
Problem:    May evaluate insecure value when appending to option.
Solution:   Set the secure flag when changing an option that was previously
            set insecurely.  Also allow numbers for the characters from
            'spelllang' that are used for LANG.vim.
247bb7e43b
2019-06-25 22:28:41 -04:00
Abdelhakeem
adff3f4dee vim-patch:8.1.0539: cannot build without the sandbox
Problem:    Cannot build without the sandbox.
Solution:   Set the secure option instead of using the sandbox.  Also restrict
            the characters from 'spelllang' that are used for LANG.vim.
            (suggested by Yasuhiro Matsumoto)
82e8c92ebe
2019-06-25 22:28:41 -04:00
Jan Edmund Lazo
fee1880ea7 vim-patch:8.1.0538: evaluating a modeline might invoke using a shell command
Problem:    Evaluating a modeline might invoke using a shell command. (Paul
            Huber)
Solution:   Set the sandbox flag when setting options from a modeline.
5958f95a40
2019-06-25 22:28:41 -04:00
Jan Edmund Lazo
f514b7fbbc vim-patch:8.1.0189: function defined in sandbox not tested
Problem:    Function defined in sandbox not tested.
Solution:   Add a text.
d90a144eda
2019-06-25 22:28:41 -04:00
Jan Edmund Lazo
c202e4a868 vim-patch:8.1.0177: defining function in sandbox is inconsistent
Problem:    Defining function in sandbox is inconsistent, cannot use :function
            but can define a lambda.
Solution:   Allow defining a function in the sandbox, but also use the sandbox
            when executing it. (closes vim/vim#3182)
93343725b5
2019-06-25 22:28:31 -04:00
Justin M. Keyes
154765e4bf version bump 2019-05-29 10:58:40 +02:00
Justin M. Keyes
ede21f9518 NVIM v0.3.7
OTHER:
361d4be588 dist: update nvim.png
2019-05-29 10:57:53 +02:00
Justin M. Keyes
361d4be588 dist: update nvim.png
fix appimage failure:

    -- Deploying icons --
    Deploying icon /home/travis/build/neovim/bot-ci/build/neovim/runtime/nvim.png
    WARNING: x and y resolution of icon are not equal: /home/travis/build/neovim/bot-ci/build/neovim/runtime/nvim.png
    ERROR: Icon /home/travis/build/neovim/bot-ci/build/neovim/runtime/nvim.png has invalid x resolution: 104
    ERROR: Valid resolutions for icons are: 8x8, 16x16, ...
    Failed to deploy icon: /home/travis/build/neovim/bot-ci/build/neovim/runtime/nvim.png
    mv: cannot stat '/home/travis/build/neovim/bot-ci/build/neovim/build/nvim.appimage*': No such file or directory

ref https://github.com/neovim/bot-ci/issues/144
2019-05-29 01:29:24 +02:00
Justin M. Keyes
bd4bb61f35 version bump 2019-05-29 00:35:51 +02:00
Justin M. Keyes
8a6bb66e80 NVIM v0.3.6
FIXES:
4553fc5e6c #10082 vim-patch:8.1.1365: :source should check sandbox

OTHER:
877d539904 #10027 genappimage.sh: migrate to linuxdeploy
2019-05-29 00:34:46 +02:00
Justin M. Keyes
4553fc5e6c vim-patch:8.1.1365: :source should check sandbox #10082
Problem:    Source command doesn't check for the sandbox. (Armin Razmjou)
Solution:   Check for the sandbox when sourcing a file.
5357552140
2019-05-29 00:33:22 +02:00
Douglas 'dopessoa' Pessoa
877d539904 genappimage.sh: migrate to linuxdeploy #10027
generate_type2_appimage is unmaintained, and lacks a way to rename the appimage file.

fix #9893
2019-05-18 21:34:37 +02:00
Justin M. Keyes
60c3c92db1 release.sh 2019-04-28 22:19:18 +02:00
Justin M. Keyes
d7cf93ce34 version bump 2019-04-28 22:12:54 +02:00
Justin M. Keyes
1060bfd033 NVIM v0.3.5
Maintenance release to fix issues found in v0.3.4.

FIXES:

f891131c6b #9894 options: properly reset directories on 'autochdir'
9a5488c2a6 Remove MSVC optimization workaround for SHM_ALL
1793ba8176 Make SHM_ALL to a variable instead of a compound literal #define
947069ba14 doc: mention "pynvim" module rename
46c7e12f27 #9629 screen: don't crash when drawing popupmenu with 'rightleft' option
f1843c0035 vim-patch:8.1.0677: look-behind match may use the wrong line number
1204421888 #8325 :terminal : set topline based on window height
aaa8c3d711 #9504 :recover : Fix crash on non-existent *.swp
2019-04-28 22:10:12 +02:00
Marco Hinz
f891131c6b options: properly reset directories on 'autochdir' (#9894)
Fixes https://github.com/neovim/neovim/issues/9892
2019-04-15 21:04:16 +02:00
James McCoy
9a5488c2a6 Remove MSVC optimization workaround for SHM_ALL 2019-04-12 02:44:35 +02:00
James McCoy
1793ba8176 Make SHM_ALL to a variable instead of a compound literal #define
gcc-9 has [improved compliance] with the C spec for lifetime of compound
literals, tying their lifetime to block scope instead of function scope.
This makes the behavior comparable to all other automatic variables.

Using the SHM_ALL #define instantiated a compound literal local to an if
clause and assigned the address to a "char_u *".  Since the pointer was
then being used outside of the if clause, it was using an invalid
address.

[improved compliance]: https://gcc.gnu.org/gcc-9/porting_to.html#complit

Closes #9855
2019-04-12 02:43:59 +02:00
Justin M. Keyes
947069ba14 doc: mention "pynvim" module rename
closes #9764
2019-03-26 23:07:04 +01:00
Björn Linse
46c7e12f27 Merge pull request #9629 from bfredl/pumfix
screen: don't crash when drawing popupmenu with 'rightleft' option
2019-02-19 19:30:35 +01:00
Björn Linse
b98be54148 screen: don't crash when drawing popupmenu with 'rightleft' option 2019-02-19 17:46:21 +01:00
Jan Edmund Lazo
f1843c0035 vim-patch:8.1.0677: look-behind match may use the wrong line number
crash reported in #9584

Problem:    Look-behind match may use the wrong line number. (Dominique Pelle)
Solution:   Use the line number in regsave instead of the one in behind_pos,
            we may be looking at the previous line. (closes vim/vim#3749)
866f355814
2019-02-07 22:43:38 +01:00
Justin M. Keyes
1204421888 :terminal : set topline based on window height #8325 2019-02-06 04:12:14 +01:00
raffitz
aaa8c3d711 :recover : Fix crash on non-existent *.swp #9504
Reverts d2944e6a29. mf_open() _can_ fail if the file does not exist.

closes #9503
closes #9504
2019-01-15 00:49:11 +01:00
840 changed files with 34993 additions and 81113 deletions

View File

@@ -1,41 +0,0 @@
# sourcehut CI: https://builds.sr.ht/~jmk/neovim
image: openbsd/6.7
packages:
- autoconf-2.69p2
- automake-1.15.1
- cmake
- gettext-runtime-0.20.1p1
- gettext-tools-0.20.1p3
- gmake
- libtool
- ninja-1.10.0
- unzip-6.0p13
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

@@ -3,7 +3,6 @@ root = true
[*] [*]
indent_style = space indent_style = space
indent_size = 2 indent_size = 2
tab_width = 8
end_of_line = lf end_of_line = lf
insert_final_newline = true insert_final_newline = true
charset = utf-8 charset = utf-8

View File

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

1
.gitattributes vendored
View File

@@ -1 +0,0 @@
*.h linguist-language=C

1
.github/FUNDING.yml vendored
View File

@@ -1 +0,0 @@
custom: https://salt.bountysource.com/teams/neovim

View File

@@ -1,29 +0,0 @@
---
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

11
.gitignore vendored
View File

@@ -1,6 +1,5 @@
# Tools # Tools
.ropeproject/ .ropeproject/
compile_commands.json
# Visual Studio # Visual Studio
/.vs/ /.vs/
@@ -41,15 +40,12 @@ tags
/src/nvim/testdir/X* /src/nvim/testdir/X*
/src/nvim/testdir/valgrind.* /src/nvim/testdir/valgrind.*
/src/nvim/testdir/.gdbinit /src/nvim/testdir/.gdbinit
/runtime/indent/testdir/*.out
# Generated by src/nvim/testdir/runnvim.sh.
/src/nvim/testdir/*.tlog
# Generated by unit tests. # Generated by unit tests.
/test/includes/post/ /test/includes/post/
# Generated by luacheck during `make lualint' # Generated by luacheck during `make testlint'
.luacheckcache /test/.luacheckcache
# local make targets # local make targets
local.mk local.mk
@@ -58,6 +54,3 @@ local.mk
/runtime/doc/*.html /runtime/doc/*.html
/runtime/doc/tags.ref /runtime/doc/tags.ref
/runtime/doc/errors.log /runtime/doc/errors.log
# CLion
/.idea/

View File

@@ -1,20 +0,0 @@
-- vim: ft=lua tw=80
-- Ignore W211 (unused variable) with preload files.
files["**/preload.lua"] = {ignore = { "211" }}
-- Don't report unused self arguments of methods.
self = false
-- Rerun tests only if their modification time changed.
cache = true
ignore = {
"631", -- max_line_length
"212/_.*", -- unused argument, for vars with "_" prefix
}
-- Global objects defined by the C code
read_globals = {
"vim",
}

View File

@@ -10,6 +10,8 @@ env:
- BUILD_DIR="$TRAVIS_BUILD_DIR/build" - BUILD_DIR="$TRAVIS_BUILD_DIR/build"
# Build directory for third-party dependencies. # Build directory for third-party dependencies.
- DEPS_BUILD_DIR="$HOME/nvim-deps" - DEPS_BUILD_DIR="$HOME/nvim-deps"
# Directory where third-party dependency sources are downloaded to.
- DEPS_DOWNLOAD_DIR="$TRAVIS_BUILD_DIR/deps-downloads"
# Install directory for Neovim. # Install directory for Neovim.
- INSTALL_PREFIX="$HOME/nvim-install" - INSTALL_PREFIX="$HOME/nvim-install"
# Log directory for Clang sanitizers and Valgrind. # Log directory for Clang sanitizers and Valgrind.
@@ -23,7 +25,7 @@ env:
-DBUSTED_OUTPUT_TYPE=nvim -DBUSTED_OUTPUT_TYPE=nvim
-DDEPS_PREFIX=$DEPS_BUILD_DIR/usr -DDEPS_PREFIX=$DEPS_BUILD_DIR/usr
-DMIN_LOG_LEVEL=3" -DMIN_LOG_LEVEL=3"
- DEPS_CMAKE_FLAGS="-DUSE_BUNDLED_GPERF=OFF" - DEPS_CMAKE_FLAGS="-DDEPS_DOWNLOAD_DIR:PATH=$DEPS_DOWNLOAD_DIR -DUSE_BUNDLED_GPERF=OFF"
# Additional CMake flags for 32-bit builds. # Additional CMake flags for 32-bit builds.
- CMAKE_FLAGS_32BIT="-DCMAKE_SYSTEM_LIBRARY_PATH=/lib32:/usr/lib32:/usr/local/lib32 - CMAKE_FLAGS_32BIT="-DCMAKE_SYSTEM_LIBRARY_PATH=/lib32:/usr/lib32:/usr/local/lib32
-DCMAKE_IGNORE_PATH=/lib:/usr/lib:/usr/local/lib -DCMAKE_IGNORE_PATH=/lib:/usr/lib:/usr/local/lib
@@ -32,11 +34,11 @@ env:
- ASAN_OPTIONS="detect_leaks=1:check_initialization_order=1:log_path=$LOG_DIR/asan" - ASAN_OPTIONS="detect_leaks=1:check_initialization_order=1:log_path=$LOG_DIR/asan"
- TSAN_OPTIONS="log_path=$LOG_DIR/tsan" - TSAN_OPTIONS="log_path=$LOG_DIR/tsan"
- UBSAN_OPTIONS="print_stacktrace=1 log_path=$LOG_DIR/ubsan" - UBSAN_OPTIONS="print_stacktrace=1 log_path=$LOG_DIR/ubsan"
- ASAN_SYMBOLIZE=asan_symbolize
# Environment variables for Valgrind. # Environment variables for Valgrind.
- VALGRIND_LOG="$LOG_DIR/valgrind-%p.log" - 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). # If this file exists, the cache is valid (compile was successful).
- CACHE_MARKER="$CACHE_NVIM_DEPS_DIR/.travis_cache_marker" - CACHE_MARKER="$HOME/.cache/nvim-deps/.travis_cache_marker"
# default target name for functional tests # default target name for functional tests
- FUNCTIONALTEST=functionaltest - FUNCTIONALTEST=functionaltest
- CI_TARGET=tests - CI_TARGET=tests
@@ -44,25 +46,66 @@ env:
- CCACHE_COMPRESS=1 - CCACHE_COMPRESS=1
- CCACHE_SLOPPINESS=time_macros,file_macro - CCACHE_SLOPPINESS=time_macros,file_macro
- CCACHE_BASEDIR="$TRAVIS_BUILD_DIR" - 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: jobs:
envs: &common-job-env include:
# Do not fall back to cache for "master" for PR on "release" branch: - stage: normal builds
# adds the target branch to the cache key. os: linux
FOR_TRAVIS_CACHE=v1-$TRAVIS_BRANCH compiler: clang-4.0
# Use Lua so that ASAN can test our embedded Lua support. 8fec4d53d0f6
env: >
CLANG_SANITIZER=ASAN_UBSAN
CMAKE_FLAGS="$CMAKE_FLAGS -DPREFER_LUA=ON"
ASAN_SYMBOLIZE=asan_symbolize-4.0
- 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"
- 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
- os: osx
compiler: clang
osx_image: xcode9.4 # macOS 10.13
- os: osx
compiler: gcc
osx_image: xcode9.4 # macOS 10.13
- if: branch = master
os: linux
env: CI_TARGET=lint
- stage: Flaky builds
os: linux
compiler: gcc
env: GCOV=gcov CMAKE_FLAGS="$CMAKE_FLAGS -DUSE_GCOV=ON"
- os: linux
compiler: clang
env: CLANG_SANITIZER=TSAN
allow_failures:
- env: GCOV=gcov CMAKE_FLAGS="$CMAKE_FLAGS -DUSE_GCOV=ON"
- env: CLANG_SANITIZER=TSAN
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
addons: addons:
apt: apt:
packages: &common-apt-packages packages:
- apport - apport
- autoconf - autoconf
- automake - automake
- build-essential - build-essential
- clang - clang-4.0
- cmake - cmake
- cscope - cscope
- g++-multilib
- gcc-multilib - gcc-multilib
- gdb - gdb
- gperf - gperf
@@ -81,78 +124,6 @@ addons:
- ccache - ccache
- ninja - 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: branches:
only: only:
- master - master
@@ -162,10 +133,9 @@ cache:
apt: true apt: true
ccache: true ccache: true
directories: directories:
- "$CACHE_NVIM_DEPS_DIR" - "$HOME/.cache/pip"
- "$HOME/.cache/nvim-deps"
git: - "$HOME/.cache/nvim-deps-downloads"
quiet: true
notifications: notifications:
webhooks: webhooks:

View File

@@ -2,10 +2,16 @@
# intro: https://codingnest.com/basic-cmake/ # intro: https://codingnest.com/basic-cmake/
# best practices (3.0+): https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1 # 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) cmake_minimum_required(VERSION 2.8.12)
project(nvim C) project(nvim C)
if(POLICY CMP0059)
# Needed for use of DEFINITIONS variable, which is used to collect the
# compilation flags for reporting in "nvim --version"
# https://github.com/neovim/neovim/pull/8558#issuecomment-398033140
cmake_policy(SET CMP0059 OLD)
endif()
# Point CMake at any custom modules we may ship # Point CMake at any custom modules we may ship
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
@@ -91,34 +97,26 @@ else()
option(ENABLE_LTO "enable link time optimization" ON) option(ENABLE_LTO "enable link time optimization" ON)
endif() endif()
message(STATUS "CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}") # Set default build type.
# Build type.
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
message(STATUS "CMAKE_BUILD_TYPE not specified, default is 'Debug'") message(STATUS "CMAKE_BUILD_TYPE not given, defaulting to 'Debug'")
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build" FORCE) 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() endif()
# Set available build types for CMake GUIs. # Set available build types for CMake GUIs.
# Other build types can still be set by -DCMAKE_BUILD_TYPE=... # A different build type can still be set by -DCMAKE_BUILD_TYPE=...
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
# If not in a git repo (e.g., a tarball) these tokens define the complete # 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`. # version string, else they are combined with the result of `git describe`.
set(NVIM_VERSION_MAJOR 0) set(NVIM_VERSION_MAJOR 0)
set(NVIM_VERSION_MINOR 4) set(NVIM_VERSION_MINOR 3)
set(NVIM_VERSION_PATCH 5) set(NVIM_VERSION_PATCH 8)
set(NVIM_VERSION_PRERELEASE "-dev") # for package maintainers set(NVIM_VERSION_PRERELEASE "") # for package maintainers
# API level # API level
set(NVIM_API_LEVEL 6) # Bump this after any API change. set(NVIM_API_LEVEL 5) # Bump this after any API change.
set(NVIM_API_LEVEL_COMPAT 0) # Adjust this after a _breaking_ API change. set(NVIM_API_LEVEL_COMPAT 0) # Adjust this after a _breaking_ API change.
set(NVIM_API_PRERELEASE false) set(NVIM_API_PRERELEASE false)
@@ -140,6 +138,12 @@ set(NVIM_VERSION_BUILD_TYPE "${CMAKE_BUILD_TYPE}")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# 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()
# Minimize logging for release-type builds. # Minimize logging for release-type builds.
if(NOT CMAKE_C_FLAGS_RELEASE MATCHES DMIN_LOG_LEVEL) if(NOT CMAKE_C_FLAGS_RELEASE MATCHES DMIN_LOG_LEVEL)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DMIN_LOG_LEVEL=3") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DMIN_LOG_LEVEL=3")
@@ -151,22 +155,6 @@ if(NOT CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES DMIN_LOG_LEVEL)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DMIN_LOG_LEVEL=3") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DMIN_LOG_LEVEL=3")
endif() 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) if(CMAKE_COMPILER_IS_GNUCC)
check_c_compiler_flag(-Og HAS_OG_FLAG) check_c_compiler_flag(-Og HAS_OG_FLAG)
else() else()
@@ -184,6 +172,11 @@ if(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES DNDEBUG)
string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
endif() endif()
# Enable -Wconversion.
if(NOT MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion")
endif()
# gcc 4.0+ sets _FORTIFY_SOURCE=2 automatically. This currently # gcc 4.0+ sets _FORTIFY_SOURCE=2 automatically. This currently
# does not work with Neovim due to some uses of dynamically-sized structures. # does not work with Neovim due to some uses of dynamically-sized structures.
# https://github.com/neovim/neovim/issues/223 # https://github.com/neovim/neovim/issues/223
@@ -250,40 +243,28 @@ check_c_source_compiles("
int main(void) int main(void)
{ {
void *trace[1]; void *trace[1];
backtrace(trace, 1); int trace_size = backtrace(trace, 1);
return 0; return 0;
} }
" HAVE_EXECINFO_BACKTRACE) " 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) if(MSVC)
# XXX: /W4 gives too many warnings. #3241 # XXX: /W4 gives too many warnings. #3241
add_compile_options(/W3) add_definitions(/W3 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
add_definitions(-DWIN32) add_definitions(-DWIN32)
else() else()
add_compile_options(-Wall -Wextra -pedantic -Wno-unused-parameter add_definitions(-Wall -Wextra -pedantic -Wno-unused-parameter
-Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wstrict-prototypes -std=gnu99)
-Wmissing-prototypes)
check_c_compiler_flag(-Wimplicit-fallthrough HAS_WIMPLICIT_FALLTHROUGH_FLAG) check_c_compiler_flag(-Wimplicit-fallthrough HAS_WIMPLICIT_FALLTHROUGH_FLAG)
if(HAS_WIMPLICIT_FALLTHROUGH_FLAG) if(HAS_WIMPLICIT_FALLTHROUGH_FLAG)
add_compile_options(-Wimplicit-fallthrough) add_definitions(-Wimplicit-fallthrough)
endif() endif()
# On FreeBSD 64 math.h uses unguarded C11 extension, which taints clang # On FreeBSD 64 math.h uses unguarded C11 extension, which taints clang
# 3.4.1 used there. # 3.4.1 used there.
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND CMAKE_C_COMPILER_ID MATCHES "Clang") if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND CMAKE_C_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wno-c11-extensions) add_definitions(-Wno-c11-extensions)
endif() endif()
endif() endif()
@@ -299,7 +280,7 @@ endif()
# OpenBSD's GCC (4.2.1) doesn't have -Wvla # OpenBSD's GCC (4.2.1) doesn't have -Wvla
check_c_compiler_flag(-Wvla HAS_WVLA_FLAG) check_c_compiler_flag(-Wvla HAS_WVLA_FLAG)
if(HAS_WVLA_FLAG) if(HAS_WVLA_FLAG)
add_compile_options(-Wvla) add_definitions(-Wvla)
endif() endif()
if(UNIX) if(UNIX)
@@ -308,23 +289,26 @@ if(UNIX)
check_c_compiler_flag(-fstack-protector HAS_FSTACK_PROTECTOR_FLAG) check_c_compiler_flag(-fstack-protector HAS_FSTACK_PROTECTOR_FLAG)
if(HAS_FSTACK_PROTECTOR_STRONG_FLAG) if(HAS_FSTACK_PROTECTOR_STRONG_FLAG)
add_compile_options(-fstack-protector-strong) add_definitions(-fstack-protector-strong)
elseif(HAS_FSTACK_PROTECTOR_FLAG) elseif(HAS_FSTACK_PROTECTOR_FLAG)
add_compile_options(-fstack-protector --param ssp-buffer-size=4) add_definitions(-fstack-protector --param ssp-buffer-size=4)
endif() endif()
endif() endif()
check_c_compiler_flag(-fno-common HAVE_FNO_COMMON)
if (HAVE_FNO_COMMON)
add_compile_options(-fno-common)
endif()
check_c_compiler_flag(-fdiagnostics-color=auto HAS_DIAG_COLOR_FLAG) check_c_compiler_flag(-fdiagnostics-color=auto HAS_DIAG_COLOR_FLAG)
if(HAS_DIAG_COLOR_FLAG) if(HAS_DIAG_COLOR_FLAG)
if(CMAKE_GENERATOR MATCHES "Ninja") add_definitions(-fdiagnostics-color=auto)
add_compile_options(-fdiagnostics-color=always) endif()
else()
add_compile_options(-fdiagnostics-color=auto) if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
# 1. Array-bounds testing is broken in some GCC versions before 4.8.5.
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56273
# 2. But _Pragma("...ignored") is broken (unresolved) in GCC 5+:
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66099
# So we must disable -Warray-bounds globally for GCC (for kbtree.h, #7083).
check_c_compiler_flag(-Wno-array-bounds HAS_NO_ARRAY_BOUNDS_FLAG)
if(HAS_NO_ARRAY_BOUNDS_FLAG)
add_definitions(-Wno-array-bounds)
endif() endif()
endif() endif()
@@ -332,13 +316,19 @@ option(TRAVIS_CI_BUILD "Travis/QuickBuild CI, extra flags will be set" OFF)
if(TRAVIS_CI_BUILD) if(TRAVIS_CI_BUILD)
message(STATUS "Travis/QuickBuild CI build enabled") message(STATUS "Travis/QuickBuild CI build enabled")
add_compile_options(-Werror) add_definitions(-Werror)
if(DEFINED ENV{BUILD_32BIT}) if(DEFINED ENV{BUILD_32BIT})
# Get some test coverage for unsigned char # Get some test coverage for unsigned char
add_compile_options(-funsigned-char) add_definitions(-funsigned-char)
endif() endif()
endif() endif()
if(CMAKE_BUILD_TYPE MATCHES Debug)
set(DEBUG 1)
else()
set(DEBUG 0)
endif()
option(LOG_LIST_ACTIONS "Add list actions logging" OFF) option(LOG_LIST_ACTIONS "Add list actions logging" OFF)
add_definitions(-DINCLUDE_GENERATED_DECLARATIONS) add_definitions(-DINCLUDE_GENERATED_DECLARATIONS)
@@ -371,15 +361,12 @@ endif()
include_directories("${PROJECT_BINARY_DIR}/config") include_directories("${PROJECT_BINARY_DIR}/config")
include_directories("${PROJECT_SOURCE_DIR}/src") include_directories("${PROJECT_SOURCE_DIR}/src")
find_package(LibUV 1.28.0 REQUIRED) find_package(LibUV REQUIRED)
include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS}) include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS})
find_package(Msgpack 1.0.0 REQUIRED) find_package(Msgpack 1.0.0 REQUIRED)
include_directories(SYSTEM ${MSGPACK_INCLUDE_DIRS}) 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. # 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) option(PREFER_LUA "Prefer Lua over LuaJIT in the nvim executable." OFF)
@@ -405,7 +392,7 @@ main(void)
return MSGPACK_OBJECT_FLOAT32; return MSGPACK_OBJECT_FLOAT32;
} }
" MSGPACK_HAS_FLOAT32) " MSGPACK_HAS_FLOAT32)
list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${MSGPACK_INCLUDE_DIRS}") unset(CMAKE_REQUIRED_LIBRARIES)
if(MSGPACK_HAS_FLOAT32) if(MSGPACK_HAS_FLOAT32)
add_definitions(-DNVIM_MSGPACK_HAS_FLOAT32) add_definitions(-DNVIM_MSGPACK_HAS_FLOAT32)
endif() endif()
@@ -413,7 +400,7 @@ endif()
option(FEAT_TUI "Enable the Terminal UI" ON) option(FEAT_TUI "Enable the Terminal UI" ON)
if(FEAT_TUI) if(FEAT_TUI)
find_package(UNIBILIUM 2.0 REQUIRED) find_package(Unibilium REQUIRED)
include_directories(SYSTEM ${UNIBILIUM_INCLUDE_DIRS}) include_directories(SYSTEM ${UNIBILIUM_INCLUDE_DIRS})
list(APPEND CMAKE_REQUIRED_INCLUDES "${UNIBILIUM_INCLUDE_DIRS}") list(APPEND CMAKE_REQUIRED_INCLUDES "${UNIBILIUM_INCLUDE_DIRS}")
@@ -427,8 +414,8 @@ if(FEAT_TUI)
return unibi_num_from_var(unibi_var_from_num(0)); return unibi_num_from_var(unibi_var_from_num(0));
} }
" UNIBI_HAS_VAR_FROM) " UNIBI_HAS_VAR_FROM)
list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${UNIBILIUM_INCLUDE_DIRS}") unset(CMAKE_REQUIRED_INCLUDES)
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${UNIBILIUM_LIBRARIES}") unset(CMAKE_REQUIRED_LIBRARIES)
if(UNIBI_HAS_VAR_FROM) if(UNIBI_HAS_VAR_FROM)
add_definitions(-DNVIM_UNIBI_HAS_VAR_FROM) add_definitions(-DNVIM_UNIBI_HAS_VAR_FROM)
endif() endif()
@@ -437,7 +424,7 @@ if(FEAT_TUI)
include_directories(SYSTEM ${LIBTERMKEY_INCLUDE_DIRS}) include_directories(SYSTEM ${LIBTERMKEY_INCLUDE_DIRS})
endif() endif()
find_package(LIBVTERM 0.1 REQUIRED) find_package(LibVterm REQUIRED)
include_directories(SYSTEM ${LIBVTERM_INCLUDE_DIRS}) include_directories(SYSTEM ${LIBVTERM_INCLUDE_DIRS})
if(WIN32) if(WIN32)
@@ -459,9 +446,20 @@ if((CLANG_ASAN_UBSAN OR CLANG_MSAN OR CLANG_TSAN) AND NOT CMAKE_C_COMPILER_ID MA
message(FATAL_ERROR "Sanitizers are only supported for Clang") message(FATAL_ERROR "Sanitizers are only supported for Clang")
endif() endif()
if(ENABLE_LIBICONV) if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD|FreeBSD|Windows") # see #5318
find_package(Iconv REQUIRED) message(STATUS "skipping jemalloc on this system: ${CMAKE_SYSTEM_NAME}")
include_directories(SYSTEM ${Iconv_INCLUDE_DIRS}) option(ENABLE_JEMALLOC "enable jemalloc" OFF)
else()
option(ENABLE_JEMALLOC "enable jemalloc" ON)
endif()
if(ENABLE_JEMALLOC)
if(CLANG_ASAN_UBSAN OR CLANG_MSAN OR CLANG_TSAN)
message(STATUS "Sanitizers enabled; disabling jemalloc")
else()
find_package(JeMalloc REQUIRED)
include_directories(SYSTEM ${JEMALLOC_INCLUDE_DIRS})
endif()
endif() endif()
if(ENABLE_LIBINTL) if(ENABLE_LIBINTL)
@@ -470,6 +468,11 @@ if(ENABLE_LIBINTL)
include_directories(SYSTEM ${LibIntl_INCLUDE_DIRS}) include_directories(SYSTEM ${LibIntl_INCLUDE_DIRS})
endif() 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 # Determine platform's threading library. Set CMAKE_THREAD_PREFER_PTHREAD
# explicitly to indicate a strong preference for pthread. # explicitly to indicate a strong preference for pthread.
set(CMAKE_THREAD_PREFER_PTHREAD ON) set(CMAKE_THREAD_PREFER_PTHREAD ON)
@@ -521,7 +524,6 @@ if(NOT BUSTED_OUTPUT_TYPE)
endif() endif()
find_program(LUACHECK_PRG luacheck) find_program(LUACHECK_PRG luacheck)
find_program(FLAKE8_PRG flake8)
find_program(GPERF_PRG gperf) find_program(GPERF_PRG gperf)
include(InstallHelpers) include(InstallHelpers)
@@ -533,17 +535,27 @@ install_helper(
FILES ${MANPAGES} FILES ${MANPAGES}
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
# # MIN_LOG_LEVEL for log.h
if("${MIN_LOG_LEVEL}" MATCHES "^$")
message(STATUS "MIN_LOG_LEVEL not specified")
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 set to ${MIN_LOG_LEVEL}")
endif()
# Go down the tree. # Go down the tree.
#
add_subdirectory(src/nvim) add_subdirectory(src/nvim)
get_directory_property(NVIM_VERSION_CFLAGS DIRECTORY src/nvim DEFINITION NVIM_VERSION_CFLAGS) # Read compilation flags from src/nvim, used in config subdirectory below.
include(GetCompileFlags)
get_compile_flags(NVIM_VERSION_CFLAGS)
add_subdirectory(test/includes) add_subdirectory(test/includes)
add_subdirectory(config) add_subdirectory(config)
add_subdirectory(test/functional/fixtures) # compile test programs add_subdirectory(test/functional/fixtures) # compile test programs
add_subdirectory(runtime) add_subdirectory(runtime)
get_directory_property(GENERATED_HELP_TAGS DIRECTORY runtime DEFINITION GENERATED_HELP_TAGS)
if(WIN32) if(WIN32)
install_helper( install_helper(
FILES ${DEPS_PREFIX}/share/nvim-qt/runtime/plugin/nvim_gui_shim.vim FILES ${DEPS_PREFIX}/share/nvim-qt/runtime/plugin/nvim_gui_shim.vim
@@ -565,7 +577,7 @@ if(BUSTED_PRG)
endif() endif()
set(UNITTEST_PREREQS nvim-test unittest-headers) set(UNITTEST_PREREQS nvim-test unittest-headers)
set(FUNCTIONALTEST_PREREQS nvim printargs-test shell-test streams-test ${GENERATED_HELP_TAGS}) set(FUNCTIONALTEST_PREREQS nvim printargs-test shell-test)
if(NOT WIN32) if(NOT WIN32)
list(APPEND FUNCTIONALTEST_PREREQS tty-test) list(APPEND FUNCTIONALTEST_PREREQS tty-test)
endif() endif()
@@ -593,6 +605,7 @@ if(BUSTED_PRG)
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test -DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
-DBUILD_DIR=${CMAKE_BINARY_DIR} -DBUILD_DIR=${CMAKE_BINARY_DIR}
-DTEST_TYPE=unit -DTEST_TYPE=unit
-DSYSTEM_NAME=${CMAKE_SYSTEM_NAME}
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
DEPENDS ${UNITTEST_PREREQS} DEPENDS ${UNITTEST_PREREQS}
${TEST_TARGET_ARGS}) ${TEST_TARGET_ARGS})
@@ -623,6 +636,7 @@ if(BUSTED_PRG)
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test -DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
-DBUILD_DIR=${CMAKE_BINARY_DIR} -DBUILD_DIR=${CMAKE_BINARY_DIR}
-DTEST_TYPE=functional -DTEST_TYPE=functional
-DSYSTEM_NAME=${CMAKE_SYSTEM_NAME}
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
DEPENDS ${FUNCTIONALTEST_PREREQS} DEPENDS ${FUNCTIONALTEST_PREREQS}
${TEST_TARGET_ARGS}) ${TEST_TARGET_ARGS})
@@ -639,6 +653,7 @@ if(BUSTED_PRG)
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test -DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
-DBUILD_DIR=${CMAKE_BINARY_DIR} -DBUILD_DIR=${CMAKE_BINARY_DIR}
-DTEST_TYPE=benchmark -DTEST_TYPE=benchmark
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
DEPENDS ${BENCHMARK_PREREQS} DEPENDS ${BENCHMARK_PREREQS}
${TEST_TARGET_ARGS}) ${TEST_TARGET_ARGS})
@@ -656,6 +671,7 @@ if(BUSTED_LUA_PRG)
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test -DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
-DBUILD_DIR=${CMAKE_BINARY_DIR} -DBUILD_DIR=${CMAKE_BINARY_DIR}
-DTEST_TYPE=functional -DTEST_TYPE=functional
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake -P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
DEPENDS ${FUNCTIONALTEST_PREREQS} DEPENDS ${FUNCTIONALTEST_PREREQS}
${TEST_TARGET_ARGS}) ${TEST_TARGET_ARGS})
@@ -663,12 +679,40 @@ if(BUSTED_LUA_PRG)
endif() endif()
if(LUACHECK_PRG) if(LUACHECK_PRG)
add_custom_target(lualint add_custom_target(testlint
COMMAND ${LUACHECK_PRG} -q runtime/ src/ test/ COMMAND ${CMAKE_COMMAND}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) -DLUACHECK_PRG=${LUACHECK_PRG}
else() -DLUAFILES_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
add_custom_target(lualint false -DIGNORE_PATTERN="*/preload.lua"
COMMENT "lualint: LUACHECK_PRG not defined") -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
-P ${PROJECT_SOURCE_DIR}/cmake/RunLuacheck.cmake)
add_custom_target(
lintbuiltinlua
COMMAND
${CMAKE_COMMAND}
-DLUACHECK_PRG=${LUACHECK_PRG}
-DLUAFILES_DIR=${CMAKE_CURRENT_SOURCE_DIR}/src/nvim/lua
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
-DREAD_GLOBALS=vim
-P ${PROJECT_SOURCE_DIR}/cmake/RunLuacheck.cmake
)
add_custom_target(
lintruntimelua
COMMAND
${CMAKE_COMMAND}
-DLUACHECK_PRG=${LUACHECK_PRG}
-DLUAFILES_DIR=${CMAKE_CURRENT_SOURCE_DIR}/runtime/lua
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
-DREAD_GLOBALS=vim
-P ${PROJECT_SOURCE_DIR}/cmake/RunLuacheck.cmake
)
# TODO(ZyX-I): Run linter for all lua code in src
add_custom_target(
lualint
DEPENDS lintruntimelua
DEPENDS lintbuiltinlua
)
endif() endif()
set(CPACK_PACKAGE_NAME "Neovim") set(CPACK_PACKAGE_NAME "Neovim")

View File

@@ -1,5 +1,4 @@
Contributing to Neovim # Contributing to Neovim
======================
Getting started Getting started
--------------- ---------------
@@ -9,25 +8,13 @@ low-risk/isolated tasks:
- [Merge a Vim patch]. - [Merge a Vim patch].
- Try a [complexity:low] issue. - Try a [complexity:low] issue.
- Fix bugs found by [Clang](#clang-scan-build), [PVS](#pvs-studio) or - Fix bugs found by [clang scan-build](#clang-scan-build),
[Coverity](#coverity). [coverity](#coverity), and [PVS](#pvs-studio).
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.
- 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 Developer guidelines
-------------------- --------------------
- Nvim contributors should read `:help dev`. - Nvim contributors should read `:help dev` (especially `:help dev-api`).
- External UI developers should read `:help dev-ui`. - External UI developers should read `:help dev-ui`.
- API client developers should read `:help dev-api-client`. - API client developers should read `:help dev-api-client`.
- Nvim developers are _strongly encouraged_ to install `ninja` for faster builds. - Nvim developers are _strongly encouraged_ to install `ninja` for faster builds.
@@ -37,11 +24,22 @@ Developer guidelines
make # Nvim build system uses ninja automatically, if available. make # Nvim build system uses ninja automatically, if available.
``` ```
Pull requests (PRs) 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.
- Disable plugins incrementally, to narrow down the cause of the issue.
- When reporting a crash, [include a stacktrace](https://github.com/neovim/neovim/wiki/Development-tips#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** issues.
Pull requests ("PRs")
--------------------- ---------------------
- To avoid duplicate work, create a `[WIP]` pull request as soon as possible. - 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. - Avoid cosmetic changes to unrelated files in the same commit.
- Use a [feature branch][git-feature-branch] instead of the master branch. - Use a [feature branch][git-feature-branch] instead of the master branch.
- Use a **rebase workflow** for small PRs. - Use a **rebase workflow** for small PRs.
@@ -65,10 +63,20 @@ Pull requests (PRs)
Pull requests have three stages: `[WIP]` (Work In Progress), `[RFC]` (Request Pull requests have three stages: `[WIP]` (Work In Progress), `[RFC]` (Request
For Comment) and `[RDY]` (Ready). For Comment) and `[RDY]` (Ready).
- `[RFC]` is assumed by default, i.e. you are requesting a review. - Untagged PRs are assumed to be `[RFC]`, i.e. you are requesting a review.
- Add `[WIP]` to the PR title if you are _not_ requesting feedback and the work - Prepend `[WIP]` to the PR title if you are _not_ requesting feedback and the
is still in flux. work is still in flux.
- Add `[RDY]` if you are _done_ and only waiting on merge. - Prepend `[RDY]` to the PR title if you are _done_ with the PR and are only
waiting on it to be merged.
For example, a typical workflow is:
1. You open a `[WIP]` PR where the work is _not_ ready for feedback, you just want to
let others know what you are doing.
2. Once the PR is ready for review, you replace `[WIP]` in the title with `[RFC]`.
You may add fix up commits to address issues that come up during review.
3. Once the PR is ready for merging, you rebase/squash your work appropriately and
then replace `[RFC]` in the title with `[RDY]`.
### Commit messages ### Commit messages
@@ -78,14 +86,14 @@ the VCS/git logs more valuable.
- Try to keep the first line under 72 characters. - Try to keep the first line under 72 characters.
- **Prefix the commit subject with a _scope_:** `doc:`, `test:`, `foo.c:`, - **Prefix the commit subject with a _scope_:** `doc:`, `test:`, `foo.c:`,
`runtime:`, ... `runtime:`, ...
- Subject line for commits with only style/lint changes can be a single - For commits that contain only style/lint changes, a single-word subject
word: `style` or `lint`. line is preferred: `style` or `lint`.
- A blank line must separate the subject from the description. - A blank line must separate the subject from the description.
- Use the _imperative voice_: "Fix bug" rather than "Fixed bug" or "Fixes bug." - Use the _imperative voice_: "Fix bug" rather than "Fixed bug" or "Fixes bug."
### Automated builds (CI) ### Automated builds (CI)
Each pull request must pass the automated builds on [Travis CI], [QuickBuild] Each pull request must pass the automated builds on [travis CI], [quickbuild]
and [AppVeyor]. and [AppVeyor].
- CI builds are compiled with [`-Werror`][gcc-warnings], so compiler warnings - CI builds are compiled with [`-Werror`][gcc-warnings], so compiler warnings
@@ -97,98 +105,47 @@ and [AppVeyor].
- CI runs [ASan] and other analyzers. - CI runs [ASan] and other analyzers.
- To run valgrind locally: `VALGRIND=1 make test` - To run valgrind locally: `VALGRIND=1 make test`
- To run Clang ASan/UBSan locally: `CC=clang make CMAKE_FLAGS="-DCLANG_ASAN_UBSAN=ON"` - 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 - The `lint` build ([#3174][3174]) checks modified lines _and their immediate
neighbors_, to encourage incrementally updating the legacy style to meet our neighbors_. This is to encourage incrementally updating the legacy style to
[style](#style). (See [#3174][3174] for background.) meet our style guidelines.
- A single word (`lint` or `style`) is sufficient as the subject line of
a commit that contains only style changes.
- [How to investigate QuickBuild failures](https://github.com/neovim/neovim/pull/4718#issuecomment-217631350) - [How to investigate QuickBuild failures](https://github.com/neovim/neovim/pull/4718#issuecomment-217631350)
- QuickBuild uses this invocation:
``` QuickBuild uses this invocation:
mkdir -p build/${params.get("buildType")} \ mkdir -p build/${params.get("buildType")} \
&& cd build/${params.get("buildType")} \ && cd build/${params.get("buildType")} \
&& cmake -G "Unix Makefiles" -DBUSTED_OUTPUT_TYPE=TAP -DCMAKE_BUILD_TYPE=${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")} -DTRAVIS_CI_BUILD=ON ../.. && ${node.getAttribute("make", "make")}
VERBOSE=1 nvim unittest-prereqs functionaltest-prereqs VERBOSE=1 nvim unittest-prereqs functionaltest-prereqs
```
### Clang scan-build ### Clang scan-build
View the [Clang report] to see potential bugs found by the Clang The auto-generated [clang-scan] report presents walk-throughs of bugs found by
[scan-build](https://clang-analyzer.llvm.org/scan-build.html) analyzer. Clang's [scan-build](https://clang-analyzer.llvm.org/scan-build.html) static
analyzer. To verify a fix locally, run `scan-build` like this:
- 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/ rm -rf build/
scan-build --use-analyzer=/usr/bin/clang make 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
[Coverity](https://scan.coverity.com/projects/neovim-neovim) runs against the [Coverity](https://scan.coverity.com/projects/neovim-neovim) runs against the
master build. To view the defects, just request access; you will be approved. 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); Use this commit-message format for coverity fixes:
([example](https://github.com/neovim/neovim/pull/804))):
```
coverity/{id}: {description}
```
- Search the Neovim commit history to find examples:
```
git log --oneline --no-merges --grep coverity
```
coverity/<id>: <description of what fixed the defect>
Coding where `<id>` is the Coverity ID (CID). For example see [#804](https://github.com/neovim/neovim/pull/804).
------
### Lint ### PVS-Studio
You can run the linter locally by:
make lint
The lint step downloads the [master error list] and excludes them, so only lint
errors related to the local changes are reported.
You can lint a single file (but this will _not_ exclude legacy errors):
./src/clint.py src/nvim/ops.c
### Style
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
- 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).
View the [PVS analysis report](https://neovim.io/doc/reports/pvs/) to see bugs
found by [PVS Studio](https://www.viva64.com/en/pvs-studio/).
You can run `scripts/pvscheck.sh` locally to run PVS on your machine.
Reviewing Reviewing
--------- ---------
@@ -222,10 +179,9 @@ as context, use the `-W` argument as well.
[wiki-faq]: https://github.com/neovim/neovim/wiki/FAQ [wiki-faq]: https://github.com/neovim/neovim/wiki/FAQ
[review-checklist]: https://github.com/neovim/neovim/wiki/Code-review-checklist [review-checklist]: https://github.com/neovim/neovim/wiki/Code-review-checklist
[3174]: https://github.com/neovim/neovim/issues/3174 [3174]: https://github.com/neovim/neovim/issues/3174
[Travis CI]: https://travis-ci.org/neovim/neovim [travis CI]: https://travis-ci.org/neovim/neovim
[QuickBuild]: http://neovim-qb.szakmeister.net/dashboard [quickbuild]: http://neovim-qb.szakmeister.net/dashboard
[AppVeyor]: https://ci.appveyor.com/project/neovim/neovim [AppVeyor]: https://ci.appveyor.com/project/neovim/neovim
[Merge a Vim patch]: https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-Vim [Merge a Vim patch]: https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-Vim
[Clang report]: https://neovim.io/doc/reports/clang/ [clang-scan]: https://neovim.io/doc/reports/clang/
[complexity:low]: https://github.com/neovim/neovim/issues?q=is%3Aopen+is%3Aissue+label%3Acomplexity%3Alow [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,15 +1,7 @@
---
name: Feature request
about: Request an enhancement for Nvim
title: ''
labels: enhancement
---
<!-- Before reporting: search existing issues and check the FAQ. --> <!-- Before reporting: search existing issues and check the FAQ. -->
- `nvim --version`: - `nvim --version`:
- `vim -u DEFAULTS` (version: ) behaves differently? - Vim (version: ) behaves differently?
- Operating system/version: - Operating system/version:
- Terminal name/version: - Terminal name/version:
- `$TERM`: - `$TERM`:

View File

@@ -3,16 +3,9 @@ Maintaining the Neovim project
Notes on maintaining the Neovim project. Notes on maintaining the Neovim project.
General guidelines See also: https://github.com/git/git/blob/master/Documentation/howto/maintain-git.txt
------------------
* Decide by cost-benefit Ticket Triage
* Write down what was decided
* Constraints are good
* Use automation to solve problems
* Never break the API
Ticket triage
------------- -------------
In practice we haven't found a meaningful way to forecast more precisely than In practice we haven't found a meaningful way to forecast more precisely than
@@ -26,9 +19,9 @@ The forecasting problem might be solved with an explicit priority system (like
Bram'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 (RDY). - PRs nearing completion (RDY).
- Issue labels. E.g. the `+plan` label increases the ticket's priority merely - Issue labels. E.g. the +plan label increases the ticket's priority merely for
for having a plan written down: it is _closer to completion_ than tickets having a plan written down: it is _closer to completion_ than tickets without
without a plan. 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 RDY PR ... is Anything that isn't in the next milestone, and doesn't have a RDY PR ... is
@@ -36,28 +29,20 @@ 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 can review open issues, but chances are your next milestone is already getting
full :) full :)
Release policy Release Policy
-------------- --------------
Release "often", but not "early". The goal is "early and often".
The (unreleased) `master` branch is the "early" channel; it should not be Up to now we use only one branch, the `master` branch.
released if it's not stable. High-risk changes may be merged to `master` if
the next release is not imminent.
For maintenance releases, create a `release-x.y` branch. If the current release - If `master` is unstable we don't release.
has a major bug: - If the last release has a major bug, we:
1. Fix the bug on `master`.
2. Disable or remove any known risks present on `master`.
3. Cut a release from `master`.
1. Fix the bug on `master`. This is a bit silly, but it works ok. And it keeps `master` from biting off
2. Cherry-pick the fix to `release-x.y`. more feature-creep than it can chew.
3. Cut a release from `release-x.y`.
- 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 See also: https://github.com/neovim/neovim/issues/862
--------
- https://github.com/neovim/neovim/issues/862
- https://github.com/git/git/blob/master/Documentation/howto/maintain-git.txt

View File

@@ -5,39 +5,15 @@ filter-true = $(strip $(filter-out 1 on ON true TRUE,$1))
# See contrib/local.mk.example # See contrib/local.mk.example
-include local.mk -include local.mk
all: nvim
CMAKE_PRG ?= $(shell (command -v cmake3 || echo cmake)) CMAKE_PRG ?= $(shell (command -v cmake3 || echo cmake))
CMAKE_BUILD_TYPE ?= Debug CMAKE_BUILD_TYPE ?= Debug
CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
# Extra CMake flags which extend the default set
CMAKE_EXTRA_FLAGS ?=
# CMAKE_INSTALL_PREFIX
# - May be passed directly or as part of CMAKE_EXTRA_FLAGS.
# - `checkprefix` target checks that it matches the CMake-cached value. #9615
ifneq (,$(CMAKE_INSTALL_PREFIX)$(CMAKE_EXTRA_FLAGS))
CMAKE_INSTALL_PREFIX := $(shell echo $(CMAKE_EXTRA_FLAGS) | 2>/dev/null \
grep -o 'CMAKE_INSTALL_PREFIX=[^ ]\+' | cut -d '=' -f2)
endif
ifneq (,$(CMAKE_INSTALL_PREFIX))
override CMAKE_EXTRA_FLAGS += -DCMAKE_INSTALL_PREFIX=$(CMAKE_INSTALL_PREFIX)
checkprefix:
@if [ -f build/.ran-cmake ]; then \
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; \
fi \
fi
else
checkprefix: ;
endif
BUILD_TYPE ?= $(shell (type ninja > /dev/null 2>&1 && echo "Ninja") || \ BUILD_TYPE ?= $(shell (type ninja > /dev/null 2>&1 && echo "Ninja") || \
echo "Unix Makefiles") echo "Unix Makefiles")
DEPS_BUILD_DIR ?= .deps DEPS_BUILD_DIR ?= .deps
ifneq (1,$(words [$(DEPS_BUILD_DIR)])) ifneq (1,$(words [$(DEPS_BUILD_DIR)]))
$(error DEPS_BUILD_DIR must not contain whitespace) $(error DEPS_BUILD_DIR must not contain whitespace)
endif endif
@@ -56,15 +32,17 @@ ifeq (,$(BUILD_TOOL))
endif endif
endif endif
BUILD_CMD = $(BUILD_TOOL)
ifneq ($(VERBOSE),) ifneq ($(VERBOSE),)
# Only need to handle Ninja here. Make will inherit the VERBOSE variable. # Only need to handle Ninja here. Make will inherit the VERBOSE variable.
ifeq ($(BUILD_TYPE),Ninja) ifeq ($(BUILD_TYPE),Ninja)
BUILD_CMD += -v VERBOSE_FLAG := -v
endif endif
endif endif
BUILD_CMD = $(BUILD_TOOL) $(VERBOSE_FLAG)
# Extra CMake flags which extend the default set
CMAKE_EXTRA_FLAGS ?=
DEPS_CMAKE_FLAGS ?= DEPS_CMAKE_FLAGS ?=
# Back-compat: USE_BUNDLED_DEPS was the old name. # Back-compat: USE_BUNDLED_DEPS was the old name.
USE_BUNDLED ?= $(USE_BUNDLED_DEPS) USE_BUNDLED ?= $(USE_BUNDLED_DEPS)
@@ -82,6 +60,8 @@ endif
# a warning, but we need to keep SCRIPTS argument. # a warning, but we need to keep SCRIPTS argument.
SINGLE_MAKE = export MAKEFLAGS= ; $(MAKE) SINGLE_MAKE = export MAKEFLAGS= ; $(MAKE)
all: nvim
nvim: build/.ran-cmake deps nvim: build/.ran-cmake deps
+$(BUILD_CMD) -C build +$(BUILD_CMD) -C build
@@ -101,20 +81,18 @@ ifeq ($(call filter-true,$(USE_BUNDLED)),)
+$(BUILD_CMD) -C $(DEPS_BUILD_DIR) +$(BUILD_CMD) -C $(DEPS_BUILD_DIR)
endif endif
build/.ran-third-party-cmake:
ifeq ($(call filter-true,$(USE_BUNDLED)),) ifeq ($(call filter-true,$(USE_BUNDLED)),)
$(DEPS_BUILD_DIR): mkdir -p $(DEPS_BUILD_DIR)
mkdir -p "$@"
build/.ran-third-party-cmake:: $(DEPS_BUILD_DIR)
cd $(DEPS_BUILD_DIR) && \ cd $(DEPS_BUILD_DIR) && \
$(CMAKE_PRG) -G '$(BUILD_TYPE)' $(BUNDLED_CMAKE_FLAG) $(BUNDLED_LUA_CMAKE_FLAG) \ $(CMAKE_PRG) -G '$(BUILD_TYPE)' $(BUNDLED_CMAKE_FLAG) $(BUNDLED_LUA_CMAKE_FLAG) \
$(DEPS_CMAKE_FLAGS) $(THIS_DIR)/third-party $(DEPS_CMAKE_FLAGS) $(THIS_DIR)/third-party
endif endif
build/.ran-third-party-cmake::
mkdir -p build mkdir -p build
touch $@ touch $@
# TODO: cmake 3.2+ add_custom_target() has a USES_TERMINAL flag. # TODO: cmake 3.2+ add_custom_target() has a USES_TERMINAL flag.
oldtest: | nvim build/runtime/doc/tags oldtest: | nvim helptags
+$(SINGLE_MAKE) -C src/nvim/testdir clean +$(SINGLE_MAKE) -C src/nvim/testdir clean
ifeq ($(strip $(TEST_FILE)),) ifeq ($(strip $(TEST_FILE)),)
+$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" $(MAKEOVERRIDES) +$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" $(MAKEOVERRIDES)
@@ -122,11 +100,11 @@ else
+$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" NEW_TESTS=$(TEST_FILE) SCRIPTS= $(MAKEOVERRIDES) +$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" NEW_TESTS=$(TEST_FILE) SCRIPTS= $(MAKEOVERRIDES)
endif endif
build/runtime/doc/tags helptags: | nvim helptags: | nvim
+$(BUILD_CMD) -C build runtime/doc/tags +$(BUILD_CMD) -C build helptags
# Builds help HTML _and_ checks for invalid help tags. # Builds help HTML _and_ checks for invalid help tags.
helphtml: | nvim build/runtime/doc/tags helphtml: | nvim helptags
+$(BUILD_CMD) -C build doc_html +$(BUILD_CMD) -C build doc_html
functionaltest: | nvim functionaltest: | nvim
@@ -135,17 +113,12 @@ functionaltest: | nvim
functionaltest-lua: | nvim functionaltest-lua: | nvim
+$(BUILD_CMD) -C build functionaltest-lua +$(BUILD_CMD) -C build functionaltest-lua
testlint: | build/.ran-cmake deps
$(BUILD_CMD) -C build testlint
lualint: | build/.ran-cmake deps lualint: | build/.ran-cmake deps
$(BUILD_CMD) -C build lualint $(BUILD_CMD) -C build lualint
pylint:
flake8 contrib/ scripts/ src/ test/
# Run pylint only if flake8 is installed.
_opt_pylint:
@command -v flake8 && { $(MAKE) pylint; exit $$?; } \
|| echo "SKIP: pylint (flake8 not found)"
unittest: | nvim unittest: | nvim
+$(BUILD_CMD) -C build unittest +$(BUILD_CMD) -C build unittest
@@ -159,11 +132,10 @@ clean:
$(MAKE) -C src/nvim/testdir clean $(MAKE) -C src/nvim/testdir clean
$(MAKE) -C runtime/doc clean $(MAKE) -C runtime/doc clean
distclean: distclean: clean
rm -rf $(DEPS_BUILD_DIR) build rm -rf $(DEPS_BUILD_DIR) build
$(MAKE) clean
install: checkprefix nvim install: | nvim
+$(BUILD_CMD) -C build install +$(BUILD_CMD) -C build install
clint: build/.ran-cmake clint: build/.ran-cmake
@@ -181,22 +153,11 @@ generated-sources: build/.ran-cmake
appimage: appimage:
bash scripts/genappimage.sh bash scripts/genappimage.sh
# Build an appimage with embedded update information. # Build an appimage with embedded update information appimage-nightly for
# appimage-nightly: for nightly builds # nightly builds or appimage-latest for a release
# appimage-latest: for a release
appimage-%: appimage-%:
bash scripts/genappimage.sh $* bash scripts/genappimage.sh $*
lint: check-single-includes clint lualint _opt_pylint lint: check-single-includes clint testlint lualint
# Generic pattern rules, allowing for `make build/bin/nvim` etc. .PHONY: test testlint lualint functionaltest unittest lint clint clean distclean nvim libnvim cmake deps install appimage
# 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,9 +1,10 @@
[![Neovim](https://raw.githubusercontent.com/neovim/neovim.github.io/master/logos/neovim-logo-300x87.png)](https://neovim.io) [![Neovim](https://raw.githubusercontent.com/neovim/neovim.github.io/master/logos/neovim-logo-600x173.png)](https://neovim.io)
[Wiki](https://github.com/neovim/neovim/wiki) | [Wiki](https://github.com/neovim/neovim/wiki) |
[Documentation](https://neovim.io/doc) | [Documentation](https://neovim.io/doc) |
[Chat/Discussion](https://gitter.im/neovim/neovim) | [Twitter](https://twitter.com/Neovim) |
[Twitter](https://twitter.com/Neovim) [Community](https://neovim.io/community/) |
[Gitter **Chat**](https://gitter.im/neovim/neovim)
[![Travis build status](https://travis-ci.org/neovim/neovim.svg?branch=master)](https://travis-ci.org/neovim/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) [![AppVeyor build status](https://ci.appveyor.com/api/projects/status/urdqjrik5u521fac/branch/master?svg=true)](https://ci.appveyor.com/project/neovim/neovim/branch/master)
@@ -26,13 +27,15 @@ Neovim is a project that seeks to aggressively refactor Vim in order to:
See the [Introduction](https://github.com/neovim/neovim/wiki/Introduction) wiki page and [Roadmap] See the [Introduction](https://github.com/neovim/neovim/wiki/Introduction) wiki page and [Roadmap]
for more information. for more information.
[![Throughput Graph](https://graphs.waffle.io/neovim/neovim/throughput.svg)](https://waffle.io/neovim/neovim/metrics)
Features Features
-------- --------
- Modern [GUIs](https://github.com/neovim/neovim/wiki/Related-projects#gui) - Modern [GUIs](https://github.com/neovim/neovim/wiki/Related-projects#gui)
- [API access](https://github.com/neovim/neovim/wiki/Related-projects#api-clients) - [API](https://github.com/neovim/neovim/wiki/Related-projects#api-clients)
from any language including C/C++, C#, Clojure, D, Elixir, Go, Haskell, Java, access from any language including Clojure, Lisp, Go, Haskell, Lua,
JavaScript/Node.js, Julia, Lisp, Lua, Perl, Python, Racket, Ruby, Rust JavaScript, Perl, Python, Ruby, and Rust
- Embedded, scriptable [terminal emulator](https://neovim.io/doc/user/nvim_terminal_emulator.html) - Embedded, scriptable [terminal emulator](https://neovim.io/doc/user/nvim_terminal_emulator.html)
- Asynchronous [job control](https://github.com/neovim/neovim/pull/2247) - Asynchronous [job control](https://github.com/neovim/neovim/pull/2247)
- [Shared data (shada)](https://github.com/neovim/neovim/pull/2506) among multiple editor instances - [Shared data (shada)](https://github.com/neovim/neovim/pull/2506) among multiple editor instances
@@ -47,27 +50,25 @@ Install from package
Pre-built packages for Windows, macOS, and Linux are found on the Pre-built packages for Windows, macOS, and Linux are found on the
[Releases](https://github.com/neovim/neovim/releases/) page. [Releases](https://github.com/neovim/neovim/releases/) page.
[Managed packages] are in Homebrew, [Debian], [Ubuntu], [Fedora], [Arch Linux], Managed packages are in [Homebrew], [Debian], [Ubuntu], [Fedora], [Arch Linux], [Gentoo],
[Gentoo], and more! and [more](https://github.com/neovim/neovim/wiki/Installing-Neovim)!
Install from source Install from source
------------------- -------------------
The build is CMake-based, but a Makefile is provided as a convenience.
make CMAKE_BUILD_TYPE=RelWithDebInfo make CMAKE_BUILD_TYPE=RelWithDebInfo
sudo make install sudo make install
To install to a non-default location: To install to a non-default location, set `CMAKE_INSTALL_PREFIX`:
make CMAKE_INSTALL_PREFIX=/full/path/ make CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=/full/path/"
make install make install
To skip bundled (`third-party/*`) dependencies: To skip bundled (`third-party/*`) dependencies:
1. Install the dependencies using a package manager. 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 apt install gperf luajit luarocks libuv1-dev libluajit-5.1-dev libunibilium-dev libmsgpack-dev libtermkey-dev libvterm-dev libjemalloc-dev
sudo luarocks build mpack sudo luarocks build mpack
sudo luarocks build lpeg sudo luarocks build lpeg
sudo luarocks build inspect sudo luarocks build inspect
@@ -78,10 +79,17 @@ To skip bundled (`third-party/*`) dependencies:
sudo make install sudo make install
``` ```
To inspect the build, these CMake features are useful: CMake features:
- `cmake --build build --target help` lists all build targets. - List all build targets:
- `build/CMakeCache.txt` (or `cmake -LAH build/`) contains the resolved values of all CMake variables. ```
cmake --build build --target help
```
- Print all variable definitions:
```
cmake -LAH
```
- `build/CMakeCache.txt` contains the resolved values of all CMake variables.
- `build/compile_commands.json` shows the full compiler invocations for each translation unit. - `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. See the [Building Neovim](https://github.com/neovim/neovim/wiki/Building-Neovim) wiki page for details.
@@ -140,7 +148,7 @@ See `LICENSE` for details.
[nvim-features]: https://neovim.io/doc/user/vim_diff.html#nvim-features [nvim-features]: https://neovim.io/doc/user/vim_diff.html#nvim-features
[Roadmap]: https://neovim.io/roadmap/ [Roadmap]: https://neovim.io/roadmap/
[advanced UIs]: https://github.com/neovim/neovim/wiki/Related-projects#gui [advanced UIs]: https://github.com/neovim/neovim/wiki/Related-projects#gui
[Managed packages]: https://github.com/neovim/neovim/wiki/Installing-Neovim#install-from-package [Homebrew]: https://github.com/neovim/homebrew-neovim#installation
[Debian]: https://packages.debian.org/testing/neovim [Debian]: https://packages.debian.org/testing/neovim
[Ubuntu]: http://packages.ubuntu.com/search?keywords=neovim [Ubuntu]: http://packages.ubuntu.com/search?keywords=neovim
[Fedora]: https://apps.fedoraproject.org/packages/neovim [Fedora]: https://apps.fedoraproject.org/packages/neovim

View File

@@ -1,42 +1,25 @@
version: '{build}' version: '{build}'
environment: environment:
APPVEYOR_CACHE_ENTRY_ZIP_ARGS: "-t7z -m0=lzma -mx=9" 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 image: Visual Studio 2017
configuration: configuration:
- MINGW_64-gcov
- MINGW_32
- MSVC_64 - MSVC_64
- MSVC_32 - MSVC_32
init: - MINGW_64
- ps: | - MINGW_32
# Pull requests: skip some build configurations to save time. - MINGW_64-gcov
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: matrix:
fast_finish: true allow_failures:
- configuration: MINGW_64-gcov
install: [] install: []
before_build: before_build:
- ps: Install-Product node 8 - ps: Install-Product node 8
build_script: build_script:
- powershell ci\build.ps1 - 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: cache:
- C:\projects\nvim-deps -> third-party\** - C:\msys64\var\cache\pacman\pkg -> ci\build.ps1
- .deps -> ci\build.ps1
- .deps -> third-party\**
artifacts: artifacts:
- path: build/Neovim.zip - path: build/Neovim.zip
- path: build/bin/nvim.exe - path: build/bin/nvim.exe

View File

@@ -0,0 +1,94 @@
-- TODO(jkeyes): Use the upstream version when busted releases it. (But how to
-- inject our call to global_helpers.read_nvim_log() ?)
local pretty = require 'pl.pretty'
local global_helpers = require('test.helpers')
return function(options)
local busted = require 'busted'
local handler = require 'busted.outputHandlers.base'()
local success = 'ok %u - %s'
local failure = 'not ' .. success
local skip = 'ok %u - # SKIP %s'
local counter = 0
handler.suiteReset = function()
counter = 0
return nil, true
end
handler.suiteEnd = function()
io.write(global_helpers.read_nvim_log())
print('1..' .. counter)
io.flush()
return nil, true
end
local function showFailure(t)
local message = t.message
local trace = t.trace or {}
if message == nil then
message = 'Nil error'
elseif type(message) ~= 'string' then
message = pretty.write(message)
end
print(failure:format(counter, t.name))
print('# ' .. t.element.trace.short_src .. ' @ ' .. t.element.trace.currentline)
if t.randomseed then print('# Random seed: ' .. t.randomseed) end
print('# Failure message: ' .. message:gsub('\n', '\n# '))
if options.verbose and trace.traceback then
print('# ' .. trace.traceback:gsub('^\n', '', 1):gsub('\n', '\n# '))
end
end
handler.testStart = function(element, parent)
local trace = element.trace
if options.verbose and trace and trace.short_src then
local fileline = trace.short_src .. ' @ ' .. trace.currentline .. ': '
local testName = fileline .. handler.getFullName(element)
print('# ' .. testName)
end
io.flush()
return nil, true
end
handler.testEnd = function(element, parent, status, trace)
counter = counter + 1
if status == 'success' then
local t = handler.successes[#handler.successes]
print(success:format(counter, t.name))
elseif status == 'pending' then
local t = handler.pendings[#handler.pendings]
print(skip:format(counter, (t.message or t.name)))
elseif status == 'failure' then
showFailure(handler.failures[#handler.failures])
elseif status == 'error' then
showFailure(handler.errors[#handler.errors])
end
io.flush()
return nil, true
end
handler.error = function(element, parent, message, debug)
if element.descriptor ~= 'it' then
counter = counter + 1
showFailure(handler.errors[#handler.errors])
end
io.flush()
return nil, true
end
busted.subscribe({ 'suite', 'reset' }, handler.suiteReset)
busted.subscribe({ 'suite', 'end' }, handler.suiteEnd)
busted.subscribe({ 'test', 'start' }, handler.testStart, { predicate = handler.cancelOnPending })
busted.subscribe({ 'test', 'end' }, handler.testEnd, { predicate = handler.cancelOnPending })
busted.subscribe({ 'error' }, handler.error)
return handler
end

View File

@@ -1,4 +1,6 @@
local s = require 'say'
local pretty = require 'pl.pretty' local pretty = require 'pl.pretty'
local term = require 'term'
local global_helpers = require('test.helpers') local global_helpers = require('test.helpers')
local colors local colors
@@ -63,6 +65,8 @@ return function(options)
}, },
} }
c = nil
local fileCount = 0 local fileCount = 0
local fileTestCount = 0 local fileTestCount = 0
local testCount = 0 local testCount = 0
@@ -72,6 +76,7 @@ return function(options)
local errorCount = 0 local errorCount = 0
local pendingDescription = function(pending) local pendingDescription = function(pending)
local name = pending.name
local string = '' local string = ''
if type(pending.message) == 'string' then if type(pending.message) == 'string' then
@@ -170,7 +175,7 @@ return function(options)
return nil, true return nil, true
end end
handler.suiteStart = function(_suite, count, total, randomseed) handler.suiteStart = function(suite, count, total, randomseed)
if total > 1 then if total > 1 then
io.write(repeatSuiteString:format(count, total)) io.write(repeatSuiteString:format(count, total))
end end
@@ -191,7 +196,7 @@ return function(options)
end end
end end
handler.suiteEnd = function(suite, _count, _total) handler.suiteEnd = function(suite, count, total)
local elapsedTime_ms = getElapsedTime(suite) local elapsedTime_ms = getElapsedTime(suite)
local tests = (testCount == 1 and 'test' or 'tests') local tests = (testCount == 1 and 'test' or 'tests')
local files = (fileCount == 1 and 'file' or 'files') local files = (fileCount == 1 and 'file' or 'files')
@@ -220,14 +225,14 @@ return function(options)
return nil, true return nil, true
end end
handler.testStart = function(element, _parent) handler.testStart = function(element, parent)
io.write(runString:format(handler.getFullName(element))) io.write(runString:format(handler.getFullName(element)))
io.flush() io.flush()
return nil, true return nil, true
end end
handler.testEnd = function(element, _parent, status, _debug) handler.testEnd = function(element, parent, status, debug)
local elapsedTime_ms = getElapsedTime(element) local elapsedTime_ms = getElapsedTime(element)
local string local string
@@ -258,7 +263,7 @@ return function(options)
return nil, true return nil, true
end end
handler.testFailure = function(_element, _parent, _message, _debug) handler.testFailure = function(element, parent, message, debug)
io.write(failureString) io.write(failureString)
io.flush() io.flush()
@@ -267,7 +272,7 @@ return function(options)
return nil, true return nil, true
end end
handler.testError = function(_element, _parent, _message, _debug) handler.testError = function(element, parent, message, debug)
io.write(errorString) io.write(errorString)
io.flush() io.flush()
@@ -276,7 +281,7 @@ return function(options)
return nil, true return nil, true
end end
handler.error = function(element, _parent, _message, _debug) handler.error = function(element, parent, message, debug)
if element.descriptor ~= 'it' then if element.descriptor ~= 'it' then
io.write(failureDescription(handler.errors[#handler.errors])) io.write(failureDescription(handler.errors[#handler.errors]))
io.flush() io.flush()

View File

@@ -7,20 +7,23 @@ CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${CI_DIR}/common/build.sh" source "${CI_DIR}/common/build.sh"
source "${CI_DIR}/common/suite.sh" source "${CI_DIR}/common/suite.sh"
# Don't cache pip's log and selfcheck.
rm -rf "${HOME}/.cache/pip/log"
rm -f "${HOME}/.cache/pip/selfcheck.json"
echo "before_cache.sh: cache size" echo "before_cache.sh: cache size"
du -chd 1 "${HOME}/.cache" | sort -rh | head -20 du -d 2 "${HOME}/.cache" | sort -n
echo "before_cache.sh: ccache stats" echo "before_cache.sh: ccache stats"
ccache -s 2>/dev/null || true 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. # Update the third-party dependency cache only if the build was successful.
if ended_successfully; then if ended_successfully; then
# Do not cache downloads. They should not be needed with up-to-date deps. rm -rf "${HOME}/.cache/nvim-deps"
rm -rf "${DEPS_BUILD_DIR}/build/downloads" mv "${DEPS_BUILD_DIR}" "${HOME}/.cache/nvim-deps"
rm -rf "${CACHE_NVIM_DEPS_DIR}"
mv "${DEPS_BUILD_DIR}" "${CACHE_NVIM_DEPS_DIR}" rm -rf "${HOME}/.cache/nvim-deps-downloads"
mv "${DEPS_DOWNLOAD_DIR}" "${HOME}/.cache/nvim-deps-downloads"
touch "${CACHE_MARKER}" touch "${CACHE_MARKER}"
echo "Updated third-party dependencies (timestamp: $(_stat "${CACHE_MARKER}"))." echo "Updated third-party dependencies (timestamp: $(_stat "${CACHE_MARKER}"))."

View File

@@ -7,37 +7,28 @@ if [[ "${CI_TARGET}" == lint ]]; then
exit exit
fi fi
echo 'Python info:' echo 'python info:'
( (
set -x 2>&1 python --version || true
python3 --version 2>&1 python2 --version || true
python2 --version 2>&1 python3 --version || true
python --version 2>&1 pip --version || true
pip3 --version 2>&1 pip2 --version || true
pip2 --version 2>&1 pip3 --version || true
pip --version echo 'pyenv versions:'
2>&1 pyenv versions || true
) | sed 's/^/ /'
pyenv --version if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
pyenv versions echo "Upgrade Python 3 pip"
) 2>&1 | sed 's/^/ /' || true python3 -m pip -q install --user --upgrade pip
else
# Use pyenv, but not for OSX on Travis, where it only has the "system" version. echo "Upgrade Python 2 pip"
if [[ "${TRAVIS_OS_NAME}" != osx ]] && command -v pyenv; then python2.7 -m pip -q install --user --upgrade pip
echo 'Setting Python versions via pyenv' echo "Upgrade Python 3 pip"
# Allow failure. pyenv pip3 on travis is broken:
# Prefer Python 2 over 3 (more conservative). # https://github.com/travis-ci/travis-ci/issues/8363
pyenv global 2.7.15:3.7.1 python3 -m pip -q install --user --upgrade pip || true
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 fi
echo "Install node (LTS)" echo "Install node (LTS)"
@@ -49,16 +40,3 @@ fi
source ~/.nvm/nvm.sh source ~/.nvm/nvm.sh
nvm install --lts nvm install --lts
nvm use --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

View File

@@ -20,10 +20,8 @@ if [[ -n "${LLVM_SYMBOLIZER}" ]] && [[ ! $(type -P "${LLVM_SYMBOLIZER}") ]]; the
exit 1 exit 1
fi fi
echo "before_script.sh: ccache stats (will be cleared)" # Show ccache stats so we can compare in before_cache
ccache -s ccache -s 2>/dev/null || true
# Reset ccache stats for real results in before_cache.
ccache --zero-stats
if [[ "${TRAVIS_OS_NAME}" == osx ]]; then if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
# Adds user to a dummy group. # Adds user to a dummy group.

View File

@@ -1,26 +1,25 @@
$ErrorActionPreference = 'stop' $ErrorActionPreference = 'stop'
Set-PSDebug -Strict -Trace 1 Set-PSDebug -Strict -Trace 1
$isPullRequest = ($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT -ne $null)
$env:CONFIGURATION -match '^(?<compiler>\w+)_(?<bits>32|64)(?:-(?<option>\w+))?$' $env:CONFIGURATION -match '^(?<compiler>\w+)_(?<bits>32|64)(?:-(?<option>\w+))?$'
$compiler = $Matches.compiler $compiler = $Matches.compiler
$compileOption = $Matches.option $compileOption = $Matches.option
$bits = $Matches.bits $bits = $Matches.bits
$cmakeBuildType = $(if ($env:CMAKE_BUILD_TYPE -ne $null) {$env:CMAKE_BUILD_TYPE} else {'RelWithDebInfo'}); $cmakeBuildType = 'RelWithDebInfo'
$buildDir = [System.IO.Path]::GetFullPath("$(pwd)")
$depsCmakeVars = @{ $depsCmakeVars = @{
CMAKE_BUILD_TYPE = $cmakeBuildType; CMAKE_BUILD_TYPE = $cmakeBuildType;
} }
$nvimCmakeVars = @{ $nvimCmakeVars = @{
CMAKE_BUILD_TYPE = $cmakeBuildType; CMAKE_BUILD_TYPE = $cmakeBuildType;
BUSTED_OUTPUT_TYPE = 'nvim'; 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 $uploadToCodeCov = $false
# For pull requests, skip some build configurations to save time.
if ($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT -and $env:CONFIGURATION -match '^(MSVC_64|MINGW_32|MINGW_64-gcov)$') {
exit 0
}
function exitIfFailed() { function exitIfFailed() {
if ($LastExitCode -ne 0) { if ($LastExitCode -ne 0) {
Set-PSDebug -Off Set-PSDebug -Off
@@ -28,13 +27,6 @@ function exitIfFailed() {
} }
} }
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 ($compiler -eq 'MINGW') {
if ($bits -eq 32) { if ($bits -eq 32) {
$arch = 'i686' $arch = 'i686'
@@ -45,14 +37,13 @@ if ($compiler -eq 'MINGW') {
if ($compileOption -eq 'gcov') { if ($compileOption -eq 'gcov') {
$nvimCmakeVars['USE_GCOV'] = 'ON' $nvimCmakeVars['USE_GCOV'] = 'ON'
$uploadToCodecov = $true $uploadToCodecov = $true
$env:GCOV = "C:\msys64\mingw$bits\bin\gcov"
} }
# These are native MinGW builds, but they use the toolchain inside # These are native MinGW builds, but they use the toolchain inside
# MSYS2, this allows using all the dependencies and tools available # MSYS2, this allows using all the dependencies and tools available
# in MSYS2, but we cannot build inside the MSYS2 shell. # in MSYS2, but we cannot build inside the MSYS2 shell.
$cmakeGenerator = 'Ninja' $cmakeGenerator = 'Ninja'
$cmakeGeneratorArgs = '-v' $cmakeGeneratorArgs = '-v'
$mingwPackages = @('ninja', 'cmake', 'perl', 'diffutils').ForEach({ $mingwPackages = @('ninja', 'cmake', 'perl', 'diffutils', 'unibilium').ForEach({
"mingw-w64-$arch-$_" "mingw-w64-$arch-$_"
}) })
@@ -98,20 +89,20 @@ function convertToCmakeArgs($vars) {
return $vars.GetEnumerator() | foreach { "-D$($_.Key)=$($_.Value)" } return $vars.GetEnumerator() | foreach { "-D$($_.Key)=$($_.Value)" }
} }
cd $env:DEPS_BUILD_DIR if (-Not (Test-Path -PathType container .deps)) {
cmake -G $cmakeGenerator $(convertToCmakeArgs($depsCmakeVars)) "$buildDir/third-party/" ; exitIfFailed mkdir .deps
}
cd .deps
cmake -G $cmakeGenerator $(convertToCmakeArgs($depsCmakeVars)) ..\third-party\ ; exitIfFailed
cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed
cd $buildDir cd ..
# Build Neovim # Build Neovim
mkdir build mkdir build
cd build cd build
cmake -G $cmakeGenerator $(convertToCmakeArgs($nvimCmakeVars)) .. ; exitIfFailed cmake -G $cmakeGenerator $(convertToCmakeArgs($nvimCmakeVars)) .. ; exitIfFailed
cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed
.\bin\nvim --version ; 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 # Functional tests
# The $LastExitCode from MSBuild can't be trusted # The $LastExitCode from MSBuild can't be trusted
@@ -122,28 +113,21 @@ cmake --build . --config $cmakeBuildType --target functionaltest -- $cmakeGenera
foreach { $failed = $failed -or foreach { $failed = $failed -or
$_ -match 'functional tests failed with error'; $_ } $_ -match 'functional tests failed with error'; $_ }
if ($failed) { if ($failed) {
if ($uploadToCodecov) {
bash -l /c/projects/neovim/ci/common/submit_coverage.sh functionaltest
}
exit $LastExitCode exit $LastExitCode
} }
Set-PSDebug -Strict -Trace 1 Set-PSDebug -Strict -Trace 1
if ($uploadToCodecov) { if ($uploadToCodecov) {
bash -l /c/projects/neovim/ci/common/submit_coverage.sh functionaltest C:\msys64\usr\bin\bash -lc "cd /c/projects/neovim; bash <(curl -s https://codecov.io/bash) -c -F functionaltest || echo 'codecov upload failed.'"
} }
# Old tests # 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" $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 & "C:\msys64\mingw$bits\bin\mingw32-make.exe" -C $(Convert-Path ..\src\nvim\testdir) VERBOSE=1
$env:PATH = $OldPath
if ($uploadToCodecov) { if ($uploadToCodecov) {
bash -l /c/projects/neovim/ci/common/submit_coverage.sh oldtest C:\msys64\usr\bin\bash -lc "cd /c/projects/neovim; bash <(curl -s https://codecov.io/bash) -c -F oldtest || echo 'codecov upload failed.'"
} }
# Build artifacts # Build artifacts

View File

@@ -27,13 +27,15 @@ build_deps() {
fi fi
mkdir -p "${DEPS_BUILD_DIR}" mkdir -p "${DEPS_BUILD_DIR}"
mkdir -p "${DEPS_DOWNLOAD_DIR}"
# Use cached dependencies if $CACHE_MARKER exists. # Use cached dependencies if $CACHE_MARKER exists.
if test "${CACHE_ENABLE}" = "false" ; then if test "${CACHE_ENABLE}" = "false" ; then
export CCACHE_RECACHE=1 export CCACHE_RECACHE=1
elif test -f "${CACHE_MARKER}" ; then elif test -f "${CACHE_MARKER}" ; then
echo "Using third-party dependencies from Travis cache (last update: $(_stat "${CACHE_MARKER}"))." echo "Using third-party dependencies from Travis cache (last update: $(_stat "${CACHE_MARKER}"))."
cp -a "${CACHE_NVIM_DEPS_DIR}"/. "${DEPS_BUILD_DIR}" cp -r "${HOME}/.cache/nvim-deps"/. "${DEPS_BUILD_DIR}"
cp -r "${HOME}/.cache/nvim-deps-downloads"/. "${DEPS_DOWNLOAD_DIR}"
fi fi
# Even if we're using cached dependencies, run CMake and make to # Even if we're using cached dependencies, run CMake and make to
@@ -84,11 +86,12 @@ build_nvim() {
fi fi
# Invoke nvim to trigger *San early. # Invoke nvim to trigger *San early.
if ! (bin/nvim --version && bin/nvim -u NONE -e -cq | cat -vet) ; then if ! (bin/nvim --version && bin/nvim -u NONE -e -c ':qall') ; then
check_sanitizer "${LOG_DIR}" asan_check "${LOG_DIR}"
exit 1 exit 1
fi fi
check_sanitizer "${LOG_DIR}" asan_check "${LOG_DIR}"
cd "${TRAVIS_BUILD_DIR}" cd "${TRAVIS_BUILD_DIR}"
} }

View File

@@ -1,45 +0,0 @@
#!/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

View File

@@ -39,11 +39,10 @@ enter_suite() {
exit_suite() { exit_suite() {
set +x set +x
travis_fold end "${NVIM_TEST_CURRENT_SUITE}"
if test $FAILED -ne 0 ; then if test $FAILED -ne 0 ; then
echo "Suite ${NVIM_TEST_CURRENT_SUITE} failed, summary:" echo "Suite ${NVIM_TEST_CURRENT_SUITE} failed, summary:"
echo "${FAIL_SUMMARY}" echo "${FAIL_SUMMARY}"
else
travis_fold end "${NVIM_TEST_CURRENT_SUITE}"
fi fi
export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE%/*}" export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE%/*}"
if test "$1" != "--continue" ; then if test "$1" != "--continue" ; then

View File

@@ -3,7 +3,10 @@
submit_coverage() { submit_coverage() {
if [ -n "${GCOV}" ]; then if [ -n "${GCOV}" ]; then
"${CI_DIR}/common/submit_coverage.sh" "$@" || echo 'codecov upload failed.' if curl --fail --output codecov.bash --silent https://codecov.io/bash; then
bash codecov.bash -c -F "$1" || echo "codecov upload failed."
rm -f codecov.bash
fi
fi fi
} }
@@ -29,12 +32,11 @@ check_core_dumps() {
shift shift
fi fi
local app="${1:-${BUILD_DIR}/bin/nvim}" local app="${1:-${BUILD_DIR}/bin/nvim}"
local cores
if test "${TRAVIS_OS_NAME}" = osx ; then if test "${TRAVIS_OS_NAME}" = osx ; then
cores="$(find /cores/ -type f -print)" local cores="$(find /cores/ -type f -print)"
local _sudo='sudo' local _sudo='sudo'
else else
cores="$(find ./ -type f -name 'core.*' -print)" local cores="$(find ./ -type f -name 'core.*' -print)"
local _sudo= local _sudo=
fi fi
@@ -69,7 +71,6 @@ check_logs() {
for log in $(find "${1}" -type f -name "${2}" -size +0); do for log in $(find "${1}" -type f -name "${2}" -size +0); do
cat "${log}" cat "${log}"
err=1 err=1
rm "${log}"
done done
if test -n "${err}" ; then if test -n "${err}" ; then
fail 'logs' E 'Runtime errors detected.' fail 'logs' E 'Runtime errors detected.'
@@ -80,9 +81,9 @@ valgrind_check() {
check_logs "${1}" "valgrind-*" check_logs "${1}" "valgrind-*"
} }
check_sanitizer() { asan_check() {
if test -n "${CLANG_SANITIZER}"; then if test "${CLANG_SANITIZER}" = "ASAN_UBSAN" ; then
check_logs "${1}" "*san.*" check_logs "${1}" "*san.*" | $ASAN_SYMBOLIZE
fi fi
} }
@@ -93,7 +94,7 @@ run_unittests() {(
fail 'unittests' F 'Unit tests failed' fail 'unittests' F 'Unit tests failed'
fi fi
submit_coverage unittest submit_coverage unittest
check_core_dumps "$(command -v luajit)" check_core_dumps "$(which luajit)"
exit_suite exit_suite
)} )}
@@ -104,7 +105,7 @@ run_functionaltests() {(
fail 'functionaltests' F 'Functional tests failed' fail 'functionaltests' F 'Functional tests failed'
fi fi
submit_coverage functionaltest submit_coverage functionaltest
check_sanitizer "${LOG_DIR}" asan_check "${LOG_DIR}"
valgrind_check "${LOG_DIR}" valgrind_check "${LOG_DIR}"
check_core_dumps check_core_dumps
exit_suite exit_suite
@@ -113,12 +114,12 @@ run_functionaltests() {(
run_oldtests() {( run_oldtests() {(
enter_suite oldtests enter_suite oldtests
ulimit -c unlimited || true ulimit -c unlimited || true
if ! make oldtest; then if ! make -C "${TRAVIS_BUILD_DIR}/src/nvim/testdir"; then
reset reset
fail 'oldtests' F 'Legacy tests failed' fail 'oldtests' F 'Legacy tests failed'
fi fi
submit_coverage oldtest submit_coverage oldtest
check_sanitizer "${LOG_DIR}" asan_check "${LOG_DIR}"
valgrind_check "${LOG_DIR}" valgrind_check "${LOG_DIR}"
check_core_dumps check_core_dumps
exit_suite exit_suite

View File

@@ -4,7 +4,6 @@ set -e
set -o pipefail set -o pipefail
if [[ "${CI_TARGET}" == lint ]]; then if [[ "${CI_TARGET}" == lint ]]; then
python -m pip -q install --user --upgrade flake8
exit exit
fi fi
@@ -12,11 +11,18 @@ if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
export PATH="/usr/local/opt/ccache/libexec:$PATH" export PATH="/usr/local/opt/ccache/libexec:$PATH"
fi fi
# Use default CC to avoid compilation problems when installing Python modules.
echo "Install neovim module for Python 3." echo "Install neovim module for Python 3."
CC=cc python3 -m pip -q install --upgrade pynvim # Allow failure. pyenv pip3 on travis is broken:
echo "Install neovim module for Python 2." # https://github.com/travis-ci/travis-ci/issues/8363
CC=cc python2 -m pip -q install --upgrade pynvim CC=cc python3 -m pip -q install --user --upgrade neovim || true
if ! [ "${TRAVIS_OS_NAME}" = osx ] ; then
# Update PATH for pip.
export PATH="$(python2.7 -c 'import site; print(site.getuserbase())')/bin:$PATH"
# Use default CC to avoid compilation problems when installing Python modules.
echo "Install neovim module for Python 2."
CC=cc python2.7 -m pip -q install --user --upgrade neovim
fi
echo "Install neovim RubyGem." echo "Install neovim RubyGem."
gem install --no-document --version ">= 0.8.0" neovim gem install --no-document --version ">= 0.8.0" neovim

View File

@@ -9,24 +9,32 @@ source "${CI_DIR}/common/build.sh"
source "${CI_DIR}/common/suite.sh" source "${CI_DIR}/common/suite.sh"
enter_suite 'clint' enter_suite 'clint'
run_test 'make clint-full' clint run_test 'make clint-full' clint
exit_suite --continue
enter_suite 'testlint'
run_test 'make testlint' testlint
exit_suite --continue exit_suite --continue
enter_suite 'lualint' enter_suite 'lualint'
run_test 'make lualint' lualint
exit_suite --continue
enter_suite 'pylint' run_test 'make lualint' lualint
run_test 'make pylint' pylint
exit_suite --continue exit_suite --continue
enter_suite single-includes enter_suite single-includes
CLICOLOR_FORCE=1 run_test_wd \ CLICOLOR_FORCE=1 run_test_wd \
--allow-hang \ --allow-hang \
10s \ 10s \
'make check-single-includes' \ 'make check-single-includes' \
'csi_clean' \ 'csi_clean' \
single-includes single-includes
exit_suite --continue exit_suite --continue
end_tests end_tests

View File

@@ -11,9 +11,3 @@ if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
else else
ci/run_${CI_TARGET}.sh ci/run_${CI_TARGET}.sh
fi fi
if [[ -s "${GCOV_ERROR_FILE}" ]]; then
echo '=== Unexpected gcov errors: ==='
cat "${GCOV_ERROR_FILE}"
exit 1
fi

50
cmake/FindJeMalloc.cmake Normal file
View File

@@ -0,0 +1,50 @@
# - Try to find jemalloc
# Once done this will define
# JEMALLOC_FOUND - System has jemalloc
# JEMALLOC_INCLUDE_DIRS - The jemalloc include directories
# JEMALLOC_LIBRARIES - The libraries needed to use jemalloc
if(NOT USE_BUNDLED_JEMALLOC)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(PC_JEMALLOC QUIET jemalloc)
endif()
else()
set(PC_JEMALLOC_INCLUDEDIR)
set(PC_JEMALLOC_INCLUDE_DIRS)
set(PC_JEMALLOC_LIBDIR)
set(PC_JEMALLOC_LIBRARY_DIRS)
set(LIMIT_SEARCH NO_DEFAULT_PATH)
endif()
set(JEMALLOC_DEFINITIONS ${PC_JEMALLOC_CFLAGS_OTHER})
find_path(JEMALLOC_INCLUDE_DIR jemalloc/jemalloc.h
PATHS ${PC_JEMALLOC_INCLUDEDIR} ${PC_JEMALLOC_INCLUDE_DIRS}
${LIMIT_SEARCH})
# If we're asked to use static linkage, add libjemalloc.a as a preferred library name.
if(JEMALLOC_USE_STATIC)
list(APPEND JEMALLOC_NAMES
"${CMAKE_STATIC_LIBRARY_PREFIX}jemalloc${CMAKE_STATIC_LIBRARY_SUFFIX}")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
list(INSERT JEMALLOC_NAMES 0
"${CMAKE_STATIC_LIBRARY_PREFIX}jemalloc${CMAKE_STATIC_LIBRARY_SUFFIX}")
endif()
list(APPEND JEMALLOC_NAMES jemalloc)
find_library(JEMALLOC_LIBRARY NAMES ${JEMALLOC_NAMES}
HINTS ${PC_JEMALLOC_LIBDIR} ${PC_JEMALLOC_LIBRARY_DIRS}
${LIMIT_SEARCH})
set(JEMALLOC_LIBRARIES ${JEMALLOC_LIBRARY})
set(JEMALLOC_INCLUDE_DIRS ${JEMALLOC_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set JEMALLOC_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(JeMalloc DEFAULT_MSG
JEMALLOC_LIBRARY JEMALLOC_INCLUDE_DIR)
mark_as_advanced(JEMALLOC_INCLUDE_DIR JEMALLOC_LIBRARY)

View File

@@ -1,10 +0,0 @@
# - Try to find libvterm
# Once done this will define
# LIBVTERM_FOUND - System has libvterm
# LIBVTERM_INCLUDE_DIRS - The libvterm include directories
# LIBVTERM_LIBRARIES - The libraries needed to use libvterm
include(LibFindMacros)
libfind_pkg_detect(LIBVTERM vterm FIND_PATH vterm.h FIND_LIBRARY vterm)
libfind_process(LIBVTERM REQUIRED)

View File

@@ -31,16 +31,15 @@ find_library(LibIntl_LIBRARY
) )
if (LibIntl_INCLUDE_DIR) if (LibIntl_INCLUDE_DIR)
list(APPEND CMAKE_REQUIRED_INCLUDES "${LibIntl_INCLUDE_DIR}") set(CMAKE_REQUIRED_INCLUDES "${LibIntl_INCLUDE_DIR}")
endif() endif()
# On some systems (linux+glibc) libintl is passively available. # On some systems (linux+glibc) libintl is passively available.
# So only specify the library if one was found. # So only specify the library if one was found.
if (LibIntl_LIBRARY) if (LibIntl_LIBRARY)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${LibIntl_LIBRARY}") set(CMAKE_REQUIRED_LIBRARIES "${LibIntl_LIBRARY}")
endif()
if (MSVC)
list(APPEND CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY})
endif() endif()
check_c_source_compiles(" check_c_source_compiles("
#include <libintl.h> #include <libintl.h>
@@ -51,15 +50,6 @@ int main(int argc, char** argv) {
bind_textdomain_codeset(\"foo\", \"bar\"); bind_textdomain_codeset(\"foo\", \"bar\");
textdomain(\"foo\"); textdomain(\"foo\");
}" HAVE_WORKING_LIBINTL) }" HAVE_WORKING_LIBINTL)
if (MSVC)
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY})
endif()
if (LibIntl_INCLUDE_DIR)
list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${LibIntl_INCLUDE_DIR}")
endif()
if (LibIntl_LIBRARY)
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${LibIntl_LIBRARY}")
endif()
if (HAVE_WORKING_LIBINTL) if (HAVE_WORKING_LIBINTL)
# On some systems (linux+glibc) libintl is passively available. # On some systems (linux+glibc) libintl is passively available.
@@ -68,7 +58,6 @@ if (HAVE_WORKING_LIBINTL)
if(LibIntl_FIND_REQUIRED) if(LibIntl_FIND_REQUIRED)
unset(LibIntl_FIND_REQUIRED) unset(LibIntl_FIND_REQUIRED)
endif() endif()
set(LibIntl_FIND_QUIETLY ON)
check_variable_exists(_nl_msg_cat_cntr HAVE_NL_MSG_CAT_CNTR) check_variable_exists(_nl_msg_cat_cntr HAVE_NL_MSG_CAT_CNTR)
endif() endif()

View File

@@ -1,32 +0,0 @@
# - Try to find luv
# Once done this will define
# LIBLUV_FOUND - System has libluv
# LIBLUV_INCLUDE_DIRS - The libluv include directories
# LIBLUV_LIBRARIES - The libraries needed to use libluv
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(PC_LIBLUV QUIET luv)
endif()
set(LIBLUV_DEFINITIONS ${PC_LIBLUV_CFLAGS_OTHER})
find_path(LIBLUV_INCLUDE_DIR luv/luv.h
PATHS ${PC_LIBLUV_INCLUDEDIR} ${PC_LIBLUV_INCLUDE_DIRS})
# Explicitly look for luv.so. #10407
list(APPEND LIBLUV_NAMES luv luv${CMAKE_SHARED_LIBRARY_SUFFIX})
find_library(LIBLUV_LIBRARY NAMES ${LIBLUV_NAMES}
HINTS ${PC_LIBLUV_LIBDIR} ${PC_LIBLUV_LIBRARY_DIRS})
set(LIBLUV_LIBRARIES ${LIBLUV_LIBRARY})
set(LIBLUV_INCLUDE_DIRS ${LIBLUV_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBLUV_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(LibLUV DEFAULT_MSG
LIBLUV_LIBRARY LIBLUV_INCLUDE_DIR)
mark_as_advanced(LIBLUV_INCLUDE_DIR LIBLUV_LIBRARY)

View File

@@ -4,20 +4,36 @@
# LIBTERMKEY_INCLUDE_DIRS - The libtermkey include directories # LIBTERMKEY_INCLUDE_DIRS - The libtermkey include directories
# LIBTERMKEY_LIBRARIES - The libraries needed to use libtermkey # LIBTERMKEY_LIBRARIES - The libraries needed to use libtermkey
find_package(PkgConfig) if(NOT USE_BUNDLED_LIBTERMKEY)
if (PKG_CONFIG_FOUND) find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(PC_LIBTERMKEY QUIET termkey) pkg_check_modules(PC_LIBTERMKEY QUIET termkey)
endif()
else()
set(PC_LIBTERMKEY_INCLUDEDIR)
set(PC_LIBTERMKEY_INCLUDE_DIRS)
set(PC_LIBTERMKEY_LIBDIR)
set(PC_LIBTERMKEY_LIBRARY_DIRS)
set(LIMIT_SEARCH NO_DEFAULT_PATH)
endif() endif()
set(LIBTERMKEY_DEFINITIONS ${PC_LIBTERMKEY_CFLAGS_OTHER}) set(LIBTERMKEY_DEFINITIONS ${PC_LIBTERMKEY_CFLAGS_OTHER})
find_path(LIBTERMKEY_INCLUDE_DIR termkey.h find_path(LIBTERMKEY_INCLUDE_DIR termkey.h
PATHS ${PC_LIBTERMKEY_INCLUDEDIR} ${PC_LIBTERMKEY_INCLUDE_DIRS}) PATHS ${PC_LIBTERMKEY_INCLUDEDIR} ${PC_LIBTERMKEY_INCLUDE_DIRS}
${LIMIT_SEARCH})
# If we're asked to use static linkage, add libuv.a as a preferred library name.
if(LIBTERMKEY_USE_STATIC)
list(APPEND LIBTERMKEY_NAMES
"${CMAKE_STATIC_LIBRARY_PREFIX}termkey${CMAKE_STATIC_LIBRARY_SUFFIX}")
endif()
list(APPEND LIBTERMKEY_NAMES termkey) list(APPEND LIBTERMKEY_NAMES termkey)
find_library(LIBTERMKEY_LIBRARY NAMES ${LIBTERMKEY_NAMES} find_library(LIBTERMKEY_LIBRARY NAMES ${LIBTERMKEY_NAMES}
HINTS ${PC_LIBTERMKEY_LIBDIR} ${PC_LIBTERMKEY_LIBRARY_DIRS}) HINTS ${PC_LIBTERMKEY_LIBDIR} ${PC_LIBTERMKEY_LIBRARY_DIRS}
${LIMIT_SEARCH})
set(LIBTERMKEY_LIBRARIES ${LIBTERMKEY_LIBRARY}) set(LIBTERMKEY_LIBRARIES ${LIBTERMKEY_LIBRARY})
set(LIBTERMKEY_INCLUDE_DIRS ${LIBTERMKEY_INCLUDE_DIR}) set(LIBTERMKEY_INCLUDE_DIRS ${LIBTERMKEY_INCLUDE_DIR})

View File

@@ -4,19 +4,38 @@
# LIBUV_FOUND - system has libuv # LIBUV_FOUND - system has libuv
# LIBUV_INCLUDE_DIRS - the libuv include directories # LIBUV_INCLUDE_DIRS - the libuv include directories
# LIBUV_LIBRARIES - link these to use libuv # LIBUV_LIBRARIES - link these to use libuv
#
# Set the LIBUV_USE_STATIC variable to specify if static libraries should
# be preferred to shared ones.
find_package(PkgConfig) if(NOT USE_BUNDLED_LIBUV)
if (PKG_CONFIG_FOUND) find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(PC_LIBUV QUIET libuv) pkg_check_modules(PC_LIBUV QUIET libuv)
endif()
else()
set(PC_LIBUV_INCLUDEDIR)
set(PC_LIBUV_INCLUDE_DIRS)
set(PC_LIBUV_LIBDIR)
set(PC_LIBUV_LIBRARY_DIRS)
set(LIMIT_SEARCH NO_DEFAULT_PATH)
endif() endif()
find_path(LIBUV_INCLUDE_DIR uv.h find_path(LIBUV_INCLUDE_DIR uv.h
HINTS ${PC_LIBUV_INCLUDEDIR} ${PC_LIBUV_INCLUDE_DIRS}) HINTS ${PC_LIBUV_INCLUDEDIR} ${PC_LIBUV_INCLUDE_DIRS}
${LIMIT_SEARCH})
# If we're asked to use static linkage, add libuv.a as a preferred library name.
if(LIBUV_USE_STATIC)
list(APPEND LIBUV_NAMES
"${CMAKE_STATIC_LIBRARY_PREFIX}uv${CMAKE_STATIC_LIBRARY_SUFFIX}")
endif(LIBUV_USE_STATIC)
list(APPEND LIBUV_NAMES uv) list(APPEND LIBUV_NAMES uv)
find_library(LIBUV_LIBRARY NAMES ${LIBUV_NAMES} find_library(LIBUV_LIBRARY NAMES ${LIBUV_NAMES}
HINTS ${PC_LIBUV_LIBDIR} ${PC_LIBUV_LIBRARY_DIRS}) HINTS ${PC_LIBUV_LIBDIR} ${PC_LIBUV_LIBRARY_DIRS}
${LIMIT_SEARCH})
mark_as_advanced(LIBUV_INCLUDE_DIR LIBUV_LIBRARY) mark_as_advanced(LIBUV_INCLUDE_DIR LIBUV_LIBRARY)

47
cmake/FindLibVterm.cmake Normal file
View File

@@ -0,0 +1,47 @@
# - Try to find libvterm
# Once done this will define
# LIBVTERM_FOUND - System has libvterm
# LIBVTERM_INCLUDE_DIRS - The libvterm include directories
# LIBVTERM_LIBRARIES - The libraries needed to use libvterm
if(NOT USE_BUNDLED_LIBVTERM)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(PC_LIBVTERM QUIET vterm)
endif()
else()
set(PC_LIBVTERM_INCLUDEDIR)
set(PC_LIBVTERM_INCLUDE_DIRS)
set(PC_LIBVTERM_LIBDIR)
set(PC_LIBVTERM_LIBRARY_DIRS)
set(LIMIT_SEARCH NO_DEFAULT_PATH)
endif()
set(LIBVTERM_DEFINITIONS ${PC_LIBVTERM_CFLAGS_OTHER})
find_path(LIBVTERM_INCLUDE_DIR vterm.h
PATHS ${PC_LIBVTERM_INCLUDEDIR} ${PC_LIBVTERM_INCLUDE_DIRS}
${LIMIT_SEARCH})
# If we're asked to use static linkage, add libuv.a as a preferred library name.
if(LIBVTERM_USE_STATIC)
list(APPEND LIBVTERM_NAMES
"${CMAKE_STATIC_LIBRARY_PREFIX}vterm${CMAKE_STATIC_LIBRARY_SUFFIX}")
endif()
list(APPEND LIBVTERM_NAMES vterm)
find_library(LIBVTERM_LIBRARY NAMES ${LIBVTERM_NAMES}
HINTS ${PC_LIBVTERM_LIBDIR} ${PC_LIBVTERM_LIBRARY_DIRS}
${LIMIT_SEARCH})
set(LIBVTERM_LIBRARIES ${LIBVTERM_LIBRARY})
set(LIBVTERM_INCLUDE_DIRS ${LIBVTERM_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBVTERM_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(LibVterm DEFAULT_MSG
LIBVTERM_LIBRARY LIBVTERM_INCLUDE_DIR)
mark_as_advanced(LIBVTERM_INCLUDE_DIR LIBVTERM_LIBRARY)

View File

@@ -4,16 +4,32 @@
# LUAJIT_INCLUDE_DIRS - The luajit include directories # LUAJIT_INCLUDE_DIRS - The luajit include directories
# LUAJIT_LIBRARIES - The libraries needed to use luajit # LUAJIT_LIBRARIES - The libraries needed to use luajit
find_package(PkgConfig) if(NOT USE_BUNDLED_LUAJIT)
if (PKG_CONFIG_FOUND) find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(PC_LUAJIT QUIET luajit) pkg_check_modules(PC_LUAJIT QUIET luajit)
endif()
else()
set(PC_LUAJIT_INCLUDEDIR)
set(PC_LUAJIT_INCLUDE_DIRS)
set(PC_LUAJIT_LIBDIR)
set(PC_LUAJIT_LIBRARY_DIRS)
set(LIMIT_SEARCH NO_DEFAULT_PATH)
endif() endif()
set(LUAJIT_DEFINITIONS ${PC_LUAJIT_CFLAGS_OTHER}) set(LUAJIT_DEFINITIONS ${PC_LUAJIT_CFLAGS_OTHER})
find_path(LUAJIT_INCLUDE_DIR luajit.h find_path(LUAJIT_INCLUDE_DIR luajit.h
PATHS ${PC_LUAJIT_INCLUDEDIR} ${PC_LUAJIT_INCLUDE_DIRS} PATHS ${PC_LUAJIT_INCLUDEDIR} ${PC_LUAJIT_INCLUDE_DIRS}
PATH_SUFFIXES luajit-2.0 luajit-2.1) PATH_SUFFIXES luajit-2.0
${LIMIT_SEARCH})
# If we're asked to use static linkage, add libluajit-5.1.a as a preferred
# library name.
if(LUAJIT_USE_STATIC)
list(APPEND LUAJIT_NAMES
"${CMAKE_STATIC_LIBRARY_PREFIX}luajit-5.1${CMAKE_STATIC_LIBRARY_SUFFIX}")
endif()
if(MSVC) if(MSVC)
list(APPEND LUAJIT_NAMES lua51) list(APPEND LUAJIT_NAMES lua51)
@@ -24,7 +40,8 @@ else()
endif() endif()
find_library(LUAJIT_LIBRARY NAMES ${LUAJIT_NAMES} find_library(LUAJIT_LIBRARY NAMES ${LUAJIT_NAMES}
PATHS ${PC_LUAJIT_LIBDIR} ${PC_LUAJIT_LIBRARY_DIRS}) PATHS ${PC_LUAJIT_LIBDIR} ${PC_LUAJIT_LIBRARY_DIRS}
${LIMIT_SEARCH})
set(LUAJIT_LIBRARIES ${LUAJIT_LIBRARY}) set(LUAJIT_LIBRARIES ${LUAJIT_LIBRARY})
set(LUAJIT_INCLUDE_DIRS ${LUAJIT_INCLUDE_DIR}) set(LUAJIT_INCLUDE_DIRS ${LUAJIT_INCLUDE_DIR})

View File

@@ -4,17 +4,26 @@
# MSGPACK_INCLUDE_DIRS - The msgpack include directories # MSGPACK_INCLUDE_DIRS - The msgpack include directories
# MSGPACK_LIBRARIES - The libraries needed to use msgpack # MSGPACK_LIBRARIES - The libraries needed to use msgpack
find_package(PkgConfig) if(NOT USE_BUNDLED_MSGPACK)
if (PKG_CONFIG_FOUND) find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_search_module(PC_MSGPACK QUIET pkg_search_module(PC_MSGPACK QUIET
msgpackc>=${Msgpack_FIND_VERSION} msgpackc>=${Msgpack_FIND_VERSION}
msgpack>=${Msgpack_FIND_VERSION}) msgpack>=${Msgpack_FIND_VERSION})
endif()
else()
set(PC_MSGPACK_INCLUDEDIR)
set(PC_MSGPACK_INCLUDE_DIRS)
set(PC_MSGPACK_LIBDIR)
set(PC_MSGPACK_LIBRARY_DIRS)
set(LIMIT_SEARCH NO_DEFAULT_PATH)
endif() endif()
set(MSGPACK_DEFINITIONS ${PC_MSGPACK_CFLAGS_OTHER}) set(MSGPACK_DEFINITIONS ${PC_MSGPACK_CFLAGS_OTHER})
find_path(MSGPACK_INCLUDE_DIR msgpack/version_master.h find_path(MSGPACK_INCLUDE_DIR msgpack/version_master.h
HINTS ${PC_MSGPACK_INCLUDEDIR} ${PC_MSGPACK_INCLUDE_DIRS}) HINTS ${PC_MSGPACK_INCLUDEDIR} ${PC_MSGPACK_INCLUDE_DIRS}
${LIMIT_SEARCH})
if(MSGPACK_INCLUDE_DIR) if(MSGPACK_INCLUDE_DIR)
file(READ ${MSGPACK_INCLUDE_DIR}/msgpack/version_master.h msgpack_version_h) file(READ ${MSGPACK_INCLUDE_DIR}/msgpack/version_master.h msgpack_version_h)
@@ -26,6 +35,13 @@ else()
set(MSGPACK_VERSION_STRING) set(MSGPACK_VERSION_STRING)
endif() endif()
# If we're asked to use static linkage, add libmsgpack{,c}.a as a preferred library name.
if(MSGPACK_USE_STATIC)
list(APPEND MSGPACK_NAMES
"${CMAKE_STATIC_LIBRARY_PREFIX}msgpackc${CMAKE_STATIC_LIBRARY_SUFFIX}"
"${CMAKE_STATIC_LIBRARY_PREFIX}msgpack${CMAKE_STATIC_LIBRARY_SUFFIX}")
endif()
if(MSVC) if(MSVC)
# The import library for the msgpack DLL has a different name # The import library for the msgpack DLL has a different name
list(APPEND MSGPACK_NAMES msgpackc_import) list(APPEND MSGPACK_NAMES msgpackc_import)
@@ -37,7 +53,8 @@ find_library(MSGPACK_LIBRARY NAMES ${MSGPACK_NAMES}
# Check each directory for all names to avoid using headers/libraries from # Check each directory for all names to avoid using headers/libraries from
# different places. # different places.
NAMES_PER_DIR NAMES_PER_DIR
HINTS ${PC_MSGPACK_LIBDIR} ${PC_MSGPACK_LIBRARY_DIRS}) HINTS ${PC_MSGPACK_LIBDIR} ${PC_MSGPACK_LIBRARY_DIRS}
${LIMIT_SEARCH})
mark_as_advanced(MSGPACK_INCLUDE_DIR MSGPACK_LIBRARY) mark_as_advanced(MSGPACK_INCLUDE_DIR MSGPACK_LIBRARY)

View File

@@ -1,12 +0,0 @@
# - Try to find unibilium
# Once done this will define
# UNIBILIUM_FOUND - System has unibilium
# UNIBILIUM_INCLUDE_DIRS - The unibilium include directories
# UNIBILIUM_LIBRARIES - The libraries needed to use unibilium
include(LibFindMacros)
libfind_pkg_detect(UNIBILIUM unibilium
FIND_PATH unibilium.h
FIND_LIBRARY unibilium)
libfind_process(UNIBILIUM)

47
cmake/FindUnibilium.cmake Normal file
View File

@@ -0,0 +1,47 @@
# - Try to find unibilium
# Once done this will define
# UNIBILIUM_FOUND - System has unibilium
# UNIBILIUM_INCLUDE_DIRS - The unibilium include directories
# UNIBILIUM_LIBRARIES - The libraries needed to use unibilium
if(NOT USE_BUNDLED_UNIBILIUM)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(PC_UNIBILIUM QUIET unibilium)
endif()
else()
set(PC_UNIBILIUM_INCLUDEDIR)
set(PC_UNIBILIUM_INCLUDE_DIRS)
set(PC_UNIBILIUM_LIBDIR)
set(PC_UNIBILIUM_LIBRARY_DIRS)
set(LIMIT_SEARCH NO_DEFAULT_PATH)
endif()
set(UNIBILIUM_DEFINITIONS ${PC_UNIBILIUM_CFLAGS_OTHER})
find_path(UNIBILIUM_INCLUDE_DIR unibilium.h
PATHS ${PC_UNIBILIUM_INCLUDEDIR} ${PC_UNIBILIUM_INCLUDE_DIRS}
${LIMIT_SEARCH})
# If we're asked to use static linkage, add libunibilium.a as a preferred library name.
if(UNIBILIUM_USE_STATIC)
list(APPEND UNIBILIUM_NAMES
"${CMAKE_STATIC_LIBRARY_PREFIX}unibilium${CMAKE_STATIC_LIBRARY_SUFFIX}")
endif()
list(APPEND UNIBILIUM_NAMES unibilium)
find_library(UNIBILIUM_LIBRARY NAMES ${UNIBILIUM_NAMES}
HINTS ${PC_UNIBILIUM_LIBDIR} ${PC_UNIBILIUM_LIBRARY_DIRS}
${LIMIT_SEARCH})
set(UNIBILIUM_LIBRARIES ${UNIBILIUM_LIBRARY})
set(UNIBILIUM_INCLUDE_DIRS ${UNIBILIUM_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set UNIBILIUM_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(unibilium DEFAULT_MSG
UNIBILIUM_LIBRARY UNIBILIUM_INCLUDE_DIR)
mark_as_advanced(UNIBILIUM_INCLUDE_DIR UNIBILIUM_LIBRARY)

View File

@@ -0,0 +1,39 @@
if(DEFINED ENV{DESTDIR})
file(TO_CMAKE_PATH
$ENV{DESTDIR}/@CMAKE_INSTALL_FULL_DATADIR@/nvim/runtime/doc
HELPTAGS_WORKING_DIRECTORY)
else()
file(TO_CMAKE_PATH
@CMAKE_INSTALL_FULL_DATADIR@/nvim/runtime/doc
HELPTAGS_WORKING_DIRECTORY)
endif()
message(STATUS "Generating helptags in ${HELPTAGS_WORKING_DIRECTORY}")
if(EXISTS ${HELPTAGS_WORKING_DIRECTORY}/)
message(STATUS "${HELPTAGS_WORKING_DIRECTORY} already exists")
# If the doc directory already exists, helptags could fail due to duplicate
# tags. Tell the user to remove the directory and try again.
set(TROUBLESHOOTING "\nRemove \"${HELPTAGS_WORKING_DIRECTORY}\" and try again.")
endif()
# Workaround for hanging "yes | nvim -c 'helptags ++t .'"
# and therefore hanging "yes | make install":
# Set INPUT_FILE to an empty file, causing execute_process
# to disregard other standard input (such as "yes |").
set(EMPTY_FILE ${CMAKE_CURRENT_BINARY_DIR}/.GenerateHelptags)
file(WRITE ${EMPTY_FILE} "")
execute_process(
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/nvim
-u NONE
-es
-c "helptags ++t ."
-c quit
WORKING_DIRECTORY ${HELPTAGS_WORKING_DIRECTORY}
INPUT_FILE ${EMPTY_FILE}
OUTPUT_VARIABLE err
ERROR_VARIABLE err
RESULT_VARIABLE res)
if(NOT res EQUAL 0)
message(FATAL_ERROR "Generating helptags failed: ${err} - ${res}${TROUBLESHOOTING}")
endif()

View File

@@ -1,6 +1,6 @@
function(get_compile_flags _compile_flags) function(get_compile_flags _compile_flags)
# Create template akin to CMAKE_C_COMPILE_OBJECT. # Create template akin to CMAKE_C_COMPILE_OBJECT.
set(compile_flags "<CMAKE_C_COMPILER> <CFLAGS> <BUILD_TYPE_CFLAGS> <COMPILE_OPTIONS><COMPILE_DEFINITIONS> <INCLUDES>") set(compile_flags "<CMAKE_C_COMPILER> <CFLAGS> <BUILD_TYPE_CFLAGS> <DEFINITIONS> <INCLUDES>")
# Get C compiler. # Get C compiler.
string(REPLACE string(REPLACE
@@ -9,36 +9,13 @@ function(get_compile_flags _compile_flags)
compile_flags compile_flags
"${compile_flags}") "${compile_flags}")
# Get flags set by add_definitions(). # Get flags set by add_definition().
get_property(compile_definitions DIRECTORY PROPERTY COMPILE_DEFINITIONS) get_directory_property(definitions
get_target_property(compile_definitions_target nvim COMPILE_DEFINITIONS) DIRECTORY "src/nvim"
if(compile_definitions_target) DEFINITIONS)
list(APPEND compile_definitions ${compile_definitions_target})
list(REMOVE_DUPLICATES compile_definitions)
endif()
# NOTE: list(JOIN) requires CMake 3.12, string(CONCAT) requires CMake 3.
string(REPLACE ";" " -D" compile_definitions "${compile_definitions}")
if(compile_definitions)
set(compile_definitions " -D${compile_definitions}")
endif()
string(REPLACE string(REPLACE
"<COMPILE_DEFINITIONS>" "<DEFINITIONS>"
"${compile_definitions}" "${definitions}"
compile_flags
"${compile_flags}")
# Get flags set by add_compile_options().
get_property(compile_options DIRECTORY PROPERTY COMPILE_OPTIONS)
get_target_property(compile_options_target nvim COMPILE_OPTIONS)
if(compile_options_target)
list(APPEND compile_options ${compile_options_target})
list(REMOVE_DUPLICATES compile_options)
endif()
# NOTE: list(JOIN) requires CMake 3.12.
string(REPLACE ";" " " compile_options "${compile_options}")
string(REPLACE
"<COMPILE_OPTIONS>"
"${compile_options}"
compile_flags compile_flags
"${compile_flags}") "${compile_flags}")
@@ -58,7 +35,9 @@ function(get_compile_flags _compile_flags)
"${compile_flags}") "${compile_flags}")
# Get include directories. # Get include directories.
get_property(include_directories_list DIRECTORY PROPERTY INCLUDE_DIRECTORIES) get_directory_property(include_directories_list
DIRECTORY "src/nvim"
INCLUDE_DIRECTORIES)
list(REMOVE_DUPLICATES include_directories_list) list(REMOVE_DUPLICATES include_directories_list)
foreach(include_directory ${include_directories_list}) foreach(include_directory ${include_directories_list})
set(include_directories "${include_directories} -I${include_directory}") set(include_directories "${include_directories} -I${include_directory}")

View File

@@ -1,101 +1,46 @@
# Version 2.2 # Version 1.0 (2013-04-12)
# Public Domain, originally written by Lasse Kärkkäinen <tronic> # Public Domain, originally written by Lasse Kärkkäinen <tronic@zi.fi>
# Maintained at https://github.com/Tronic/cmake-modules # Published at http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries
# Please send your improvements as pull requests on Github.
# Find another package and make it a dependency of the current package. # If you improve the script, please modify the forementioned wiki page because
# This also automatically forwards the "REQUIRED" argument. # I no longer maintain my scripts (hosted as static files at zi.fi). Feel free
# Usage: libfind_package(<prefix> <another package> [extra args to find_package]) # to remove this entire header if you use real version control instead.
macro (libfind_package PREFIX PKG)
set(${PREFIX}_args ${PKG} ${ARGN}) # Changelog:
# 2013-04-12 Added version number (1.0) and this header, no other changes
# 2009-10-08 Originally published
# Works the same as find_package, but forwards the "REQUIRED" and "QUIET" arguments
# used for the current package. For this to work, the first parameter must be the
# prefix of the current package, then the prefix of the new package etc, which are
# passed to find_package.
macro (libfind_package PREFIX)
set (LIBFIND_PACKAGE_ARGS ${ARGN})
if (${PREFIX}_FIND_QUIETLY)
set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} QUIET)
endif (${PREFIX}_FIND_QUIETLY)
if (${PREFIX}_FIND_REQUIRED) if (${PREFIX}_FIND_REQUIRED)
set(${PREFIX}_args ${${PREFIX}_args} REQUIRED) set (LIBFIND_PACKAGE_ARGS ${LIBFIND_PACKAGE_ARGS} REQUIRED)
endif() endif (${PREFIX}_FIND_REQUIRED)
find_package(${${PREFIX}_args}) find_package(${LIBFIND_PACKAGE_ARGS})
set(${PREFIX}_DEPENDENCIES ${${PREFIX}_DEPENDENCIES};${PKG}) endmacro (libfind_package)
unset(${PREFIX}_args)
endmacro()
# A simple wrapper to make pkg-config searches a bit easier. # CMake developers made the UsePkgConfig system deprecated in the same release (2.6)
# Works the same as CMake's internal pkg_check_modules but is always quiet. # where they added pkg_check_modules. Consequently I need to support both in my scripts
macro (libfind_pkg_check_modules) # to avoid those deprecated warnings. Here's a helper that does just that.
find_package(PkgConfig QUIET) # Works identically to pkg_check_modules, except that no checks are needed prior to use.
macro (libfind_pkg_check_modules PREFIX PKGNAME)
if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
include(UsePkgConfig)
pkgconfig(${PKGNAME} ${PREFIX}_INCLUDE_DIRS ${PREFIX}_LIBRARY_DIRS ${PREFIX}_LDFLAGS ${PREFIX}_CFLAGS)
else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND) if (PKG_CONFIG_FOUND)
pkg_check_modules(${ARGN} QUIET) pkg_check_modules(${PREFIX} ${PKGNAME})
endif() endif (PKG_CONFIG_FOUND)
endmacro() endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
endmacro (libfind_pkg_check_modules)
# Avoid useless copy&pasta by doing what most simple libraries do anyway:
# pkg-config, find headers, find library.
# Usage: libfind_pkg_detect(<prefix> <pkg-config args> FIND_PATH <name> [other args] FIND_LIBRARY <name> [other args])
# E.g. libfind_pkg_detect(SDL2 sdl2 FIND_PATH SDL.h PATH_SUFFIXES SDL2 FIND_LIBRARY SDL2)
function (libfind_pkg_detect PREFIX)
# Parse arguments
set(argname pkgargs)
foreach (i ${ARGN})
if ("${i}" STREQUAL "FIND_PATH")
set(argname pathargs)
elseif ("${i}" STREQUAL "FIND_LIBRARY")
set(argname libraryargs)
else()
set(${argname} ${${argname}} ${i})
endif()
endforeach()
if (NOT pkgargs)
message(FATAL_ERROR "libfind_pkg_detect requires at least a pkg_config package name to be passed.")
endif()
# Find library
libfind_pkg_check_modules(${PREFIX}_PKGCONF ${pkgargs})
if (pathargs)
find_path(${PREFIX}_INCLUDE_DIR NAMES ${pathargs} HINTS ${${PREFIX}_PKGCONF_INCLUDE_DIRS})
endif()
if (libraryargs)
find_library(${PREFIX}_LIBRARY NAMES ${libraryargs} HINTS ${${PREFIX}_PKGCONF_LIBRARY_DIRS})
endif()
# Read pkg-config version
if (${PREFIX}_PKGCONF_VERSION)
set(${PREFIX}_VERSION ${${PREFIX}_PKGCONF_VERSION} PARENT_SCOPE)
endif()
endfunction()
# Extracts a version #define from a version.h file, output stored to <PREFIX>_VERSION.
# Usage: libfind_version_header(Foobar foobar/version.h FOOBAR_VERSION_STR)
# Fourth argument "QUIET" may be used for silently testing different define names.
# This function does nothing if the version variable is already defined.
function (libfind_version_header PREFIX VERSION_H DEFINE_NAME)
# Skip processing if we already have a version or if the include dir was not found
if (${PREFIX}_VERSION OR NOT ${PREFIX}_INCLUDE_DIR)
return()
endif()
set(quiet ${${PREFIX}_FIND_QUIETLY})
# Process optional arguments
foreach(arg ${ARGN})
if (arg STREQUAL "QUIET")
set(quiet TRUE)
else()
message(AUTHOR_WARNING "Unknown argument ${arg} to libfind_version_header ignored.")
endif()
endforeach()
# Read the header and parse for version number
set(filename "${${PREFIX}_INCLUDE_DIR}/${VERSION_H}")
if (NOT EXISTS ${filename})
if (NOT quiet)
message(AUTHOR_WARNING "Unable to find ${${PREFIX}_INCLUDE_DIR}/${VERSION_H}")
endif()
return()
endif()
file(READ "${filename}" header)
string(REGEX REPLACE ".*#[ \t]*define[ \t]*${DEFINE_NAME}[ \t]*\"([^\n]*)\".*" "\\1" match "${header}")
# No regex match?
if (match STREQUAL header)
if (NOT quiet)
message(AUTHOR_WARNING "Unable to find \#define ${DEFINE_NAME} \"<version>\" from ${${PREFIX}_INCLUDE_DIR}/${VERSION_H}")
endif()
return()
endif()
# Export the version string
set(${PREFIX}_VERSION "${match}" PARENT_SCOPE)
endfunction()
# Do the final processing once the paths have been detected. # Do the final processing once the paths have been detected.
# If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain # If include dirs are needed, ${PREFIX}_PROCESS_INCLUDES should be set to contain
@@ -103,167 +48,65 @@ endfunction()
# Ditto for ${PREFIX}_PROCESS_LIBS and library files. # Ditto for ${PREFIX}_PROCESS_LIBS and library files.
# Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES. # Will set ${PREFIX}_FOUND, ${PREFIX}_INCLUDE_DIRS and ${PREFIX}_LIBRARIES.
# Also handles errors in case library detection was required, etc. # Also handles errors in case library detection was required, etc.
function (libfind_process PREFIX) macro (libfind_process PREFIX)
# Skip processing if already processed during this configuration run # Skip processing if already processed during this run
if (${PREFIX}_FOUND) if (NOT ${PREFIX}_FOUND)
return() # Start with the assumption that the library was found
endif() set (${PREFIX}_FOUND TRUE)
set(found TRUE) # Start with the assumption that the package was found # Process all includes and set _FOUND to false if any are missing
foreach (i ${${PREFIX}_PROCESS_INCLUDES})
# Did we find any files? Did we miss includes? These are for formatting better error messages. if (${i})
set(some_files FALSE) set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIRS} ${${i}})
set(missing_headers FALSE)
# Shorthands for some variables that we need often
set(quiet ${${PREFIX}_FIND_QUIETLY})
set(required ${${PREFIX}_FIND_REQUIRED})
set(exactver ${${PREFIX}_FIND_VERSION_EXACT})
set(findver "${${PREFIX}_FIND_VERSION}")
set(version "${${PREFIX}_VERSION}")
# Lists of config option names (all, includes, libs)
unset(configopts)
set(includeopts ${${PREFIX}_PROCESS_INCLUDES})
set(libraryopts ${${PREFIX}_PROCESS_LIBS})
# Process deps to add to
foreach (i ${PREFIX} ${${PREFIX}_DEPENDENCIES})
if (DEFINED ${i}_INCLUDE_OPTS OR DEFINED ${i}_LIBRARY_OPTS)
# The package seems to export option lists that we can use, woohoo!
list(APPEND includeopts ${${i}_INCLUDE_OPTS})
list(APPEND libraryopts ${${i}_LIBRARY_OPTS})
else()
# If plural forms don't exist or they equal singular forms
if ((NOT DEFINED ${i}_INCLUDE_DIRS AND NOT DEFINED ${i}_LIBRARIES) OR
(${i}_INCLUDE_DIR STREQUAL ${i}_INCLUDE_DIRS AND ${i}_LIBRARY STREQUAL ${i}_LIBRARIES))
# Singular forms can be used
if (DEFINED ${i}_INCLUDE_DIR)
list(APPEND includeopts ${i}_INCLUDE_DIR)
endif()
if (DEFINED ${i}_LIBRARY)
list(APPEND libraryopts ${i}_LIBRARY)
endif()
else()
# Oh no, we don't know the option names
message(FATAL_ERROR "We couldn't determine config variable names for ${i} includes and libs. Aieeh!")
endif()
endif()
endforeach()
if (includeopts)
list(REMOVE_DUPLICATES includeopts)
endif()
if (libraryopts)
list(REMOVE_DUPLICATES libraryopts)
endif()
string(REGEX REPLACE ".*[ ;]([^ ;]*(_INCLUDE_DIRS|_LIBRARIES))" "\\1" tmp "${includeopts} ${libraryopts}")
if (NOT tmp STREQUAL "${includeopts} ${libraryopts}")
message(AUTHOR_WARNING "Plural form ${tmp} found in config options of ${PREFIX}. This works as before but is now deprecated. Please only use singular forms INCLUDE_DIR and LIBRARY, and update your find scripts for LibFindMacros > 2.0 automatic dependency system (most often you can simply remove the PROCESS variables entirely).")
endif()
# Include/library names separated by spaces (notice: not CMake lists)
unset(includes)
unset(libs)
# Process all includes and set found false if any are missing
foreach (i ${includeopts})
list(APPEND configopts ${i})
if (NOT "${${i}}" STREQUAL "${i}-NOTFOUND")
list(APPEND includes "${${i}}")
else()
set(found FALSE)
set(missing_headers TRUE)
endif()
endforeach()
# Process all libraries and set found false if any are missing
foreach (i ${libraryopts})
list(APPEND configopts ${i})
if (NOT "${${i}}" STREQUAL "${i}-NOTFOUND")
list(APPEND libs "${${i}}")
else()
set (found FALSE)
endif()
endforeach()
# Version checks
if (found AND findver)
if (NOT version)
message(WARNING "The find module for ${PREFIX} does not provide version information, so we'll just assume that it is OK. Please fix the module or remove package version requirements to get rid of this warning.")
elseif (version VERSION_LESS findver OR (exactver AND NOT version VERSION_EQUAL findver))
set(found FALSE)
set(version_unsuitable TRUE)
endif()
endif()
# If all-OK, hide all config options, export variables, print status and exit
if (found)
foreach (i ${configopts})
mark_as_advanced(${i}) mark_as_advanced(${i})
endforeach() else (${i})
if (NOT quiet) set (${PREFIX}_FOUND FALSE)
message(STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}") endif (${i})
if (LIBFIND_DEBUG) endforeach (i)
message(STATUS " ${PREFIX}_DEPENDENCIES=${${PREFIX}_DEPENDENCIES}")
message(STATUS " ${PREFIX}_INCLUDE_OPTS=${includeopts}")
message(STATUS " ${PREFIX}_INCLUDE_DIRS=${includes}")
message(STATUS " ${PREFIX}_LIBRARY_OPTS=${libraryopts}")
message(STATUS " ${PREFIX}_LIBRARIES=${libs}")
endif()
endif()
set (${PREFIX}_INCLUDE_OPTS ${includeopts} PARENT_SCOPE)
set (${PREFIX}_LIBRARY_OPTS ${libraryopts} PARENT_SCOPE)
set (${PREFIX}_INCLUDE_DIRS ${includes} PARENT_SCOPE)
set (${PREFIX}_LIBRARIES ${libs} PARENT_SCOPE)
set (${PREFIX}_FOUND TRUE PARENT_SCOPE)
return()
endif()
# Format messages for debug info and the type of error # Process all libraries and set _FOUND to false if any are missing
set(vars "Relevant CMake configuration variables:\n") foreach (i ${${PREFIX}_PROCESS_LIBS})
foreach (i ${configopts}) if (${i})
mark_as_advanced(CLEAR ${i}) set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARIES} ${${i}})
set(val ${${i}}) mark_as_advanced(${i})
if ("${val}" STREQUAL "${i}-NOTFOUND") else (${i})
set (val "<not found>") set (${PREFIX}_FOUND FALSE)
elseif (val AND NOT EXISTS ${val}) endif (${i})
set (val "${val} (does not exist)") endforeach (i)
else()
set(some_files TRUE) # Print message and/or exit on fatal error
endif() if (${PREFIX}_FOUND)
set(vars "${vars} ${i}=${val}\n") if (NOT ${PREFIX}_FIND_QUIETLY)
endforeach() message (STATUS "Found ${PREFIX} ${${PREFIX}_VERSION}")
set(vars "${vars}You may use CMake GUI, cmake -D or ccmake to modify the values. Delete CMakeCache.txt to discard all values and force full re-detection if necessary.\n") endif (NOT ${PREFIX}_FIND_QUIETLY)
if (version_unsuitable) else (${PREFIX}_FOUND)
set(msg "${PREFIX} ${${PREFIX}_VERSION} was found but") if (${PREFIX}_FIND_REQUIRED)
if (exactver) foreach (i ${${PREFIX}_PROCESS_INCLUDES} ${${PREFIX}_PROCESS_LIBS})
set(msg "${msg} only version ${findver} is acceptable.") message("${i}=${${i}}")
else() endforeach (i)
set(msg "${msg} version ${findver} is the minimum requirement.") message (FATAL_ERROR "Required library ${PREFIX} NOT FOUND.\nInstall the library (dev version) and try again. If the library is already installed, use ccmake to set the missing variables manually.")
endif() endif (${PREFIX}_FIND_REQUIRED)
else() endif (${PREFIX}_FOUND)
if (missing_headers) endif (NOT ${PREFIX}_FOUND)
set(msg "We could not find development headers for ${PREFIX}. Do you have the necessary dev package installed?") endmacro (libfind_process)
elseif (some_files)
set(msg "We only found some files of ${PREFIX}, not all of them. Perhaps your installation is incomplete or maybe we just didn't look in the right place?") macro(libfind_library PREFIX basename)
if(findver) set(TMP "")
set(msg "${msg} This could also be caused by incompatible version (if it helps, at least ${PREFIX} ${findver} should work).") if(MSVC80)
endif() set(TMP -vc80)
else() endif(MSVC80)
set(msg "We were unable to find package ${PREFIX}.") if(MSVC90)
endif() set(TMP -vc90)
endif() endif(MSVC90)
set(${PREFIX}_LIBNAMES ${basename}${TMP})
if(${ARGC} GREATER 2)
set(${PREFIX}_LIBNAMES ${basename}${TMP}-${ARGV2})
string(REGEX REPLACE "\\." "_" TMP ${${PREFIX}_LIBNAMES})
set(${PREFIX}_LIBNAMES ${${PREFIX}_LIBNAMES} ${TMP})
endif(${ARGC} GREATER 2)
find_library(${PREFIX}_LIBRARY
NAMES ${${PREFIX}_LIBNAMES}
PATHS ${${PREFIX}_PKGCONF_LIBRARY_DIRS}
)
endmacro(libfind_library)
# Fatal error out if REQUIRED
if (required)
set(msg "REQUIRED PACKAGE NOT FOUND\n${msg} This package is REQUIRED and you need to install it or adjust CMake configuration in order to continue building ${CMAKE_PROJECT_NAME}.")
message(FATAL_ERROR "${msg}\n${vars}")
endif()
# Otherwise just print a nasty warning
if (NOT quiet)
message(WARNING "WARNING: MISSING PACKAGE\n${msg} This package is NOT REQUIRED and you may ignore this warning but by doing so you may miss some functionality of ${CMAKE_PROJECT_NAME}. \n${vars}")
endif()
endfunction()

22
cmake/RunLuacheck.cmake Normal file
View File

@@ -0,0 +1,22 @@
set(LUACHECK_ARGS -q "${LUAFILES_DIR}")
if(DEFINED IGNORE_PATTERN)
list(APPEND LUACHECK_ARGS --exclude-files "${LUAFILES_DIR}/${IGNORE_PATTERN}")
endif()
if(DEFINED CHECK_PATTERN)
list(APPEND LUACHECK_ARGS --include-files "${LUAFILES_DIR}/${CHECK_PATTERN}")
endif()
if(DEFINED READ_GLOBALS)
list(APPEND LUACHECK_ARGS --read-globals "${READ_GLOBALS}")
endif()
execute_process(
COMMAND "${LUACHECK_PRG}" ${LUACHECK_ARGS}
WORKING_DIRECTORY "${LUAFILES_DIR}"
ERROR_VARIABLE err
RESULT_VARIABLE res
)
if(NOT res EQUAL 0)
message(STATUS "Output to stderr:\n${err}")
message(FATAL_ERROR "Linting tests failed with error: ${res}")
endif()

View File

@@ -1,18 +1,13 @@
# Set LC_ALL to meet expectations of some locale-sensitive tests. # Set LC_ALL to meet expectations of some locale-sensitive tests.
set(ENV{LC_ALL} "en_US.UTF-8") set(ENV{LC_ALL} "en_US.UTF-8")
if(POLICY CMP0012)
# Handle CI=true, without dev warnings.
cmake_policy(SET CMP0012 NEW)
endif()
set(ENV{VIMRUNTIME} ${WORKING_DIR}/runtime) set(ENV{VIMRUNTIME} ${WORKING_DIR}/runtime)
set(ENV{NVIM_RPLUGIN_MANIFEST} ${BUILD_DIR}/Xtest_rplugin_manifest) set(ENV{NVIM_RPLUGIN_MANIFEST} ${WORKING_DIR}/Xtest_rplugin_manifest)
set(ENV{XDG_CONFIG_HOME} ${BUILD_DIR}/Xtest_xdg/config) set(ENV{XDG_CONFIG_HOME} ${WORKING_DIR}/Xtest_xdg/config)
set(ENV{XDG_DATA_HOME} ${BUILD_DIR}/Xtest_xdg/share) set(ENV{XDG_DATA_HOME} ${WORKING_DIR}/Xtest_xdg/share)
if(NOT DEFINED ENV{NVIM_LOG_FILE}) if(NOT DEFINED ENV{NVIM_LOG_FILE})
set(ENV{NVIM_LOG_FILE} ${BUILD_DIR}/.nvimlog) set(ENV{NVIM_LOG_FILE} ${WORKING_DIR}/.nvimlog)
endif() endif()
if(NVIM_PRG) if(NVIM_PRG)
@@ -25,62 +20,38 @@ else()
set(TEST_PATH "${TEST_DIR}/${TEST_TYPE}") set(TEST_PATH "${TEST_DIR}/${TEST_TYPE}")
endif() endif()
# Force $TEST_PATH to workdir-relative path ("test/…").
if(IS_ABSOLUTE ${TEST_PATH})
file(RELATIVE_PATH TEST_PATH "${WORKING_DIR}" "${TEST_PATH}")
endif()
if(BUSTED_OUTPUT_TYPE STREQUAL junit) if(BUSTED_OUTPUT_TYPE STREQUAL junit)
set(EXTRA_ARGS OUTPUT_FILE ${BUILD_DIR}/${TEST_TYPE}test-junit.xml) set(EXTRA_ARGS OUTPUT_FILE ${BUILD_DIR}/${TEST_TYPE}test-junit.xml)
endif() endif()
set(BUSTED_ARGS $ENV{BUSTED_ARGS})
separate_arguments(BUSTED_ARGS)
if(DEFINED ENV{TEST_TAG} AND NOT "$ENV{TEST_TAG}" STREQUAL "") if(DEFINED ENV{TEST_TAG} AND NOT "$ENV{TEST_TAG}" STREQUAL "")
list(APPEND BUSTED_ARGS --tags $ENV{TEST_TAG}) set(TEST_TAG "--tags=$ENV{TEST_TAG}")
endif() endif()
if(DEFINED ENV{TEST_FILTER} AND NOT "$ENV{TEST_FILTER}" STREQUAL "") if(DEFINED ENV{TEST_FILTER} AND NOT "$ENV{TEST_FILTER}" STREQUAL "")
list(APPEND BUSTED_ARGS --filter $ENV{TEST_FILTER}) set(TEST_FILTER "--filter=$ENV{TEST_FILTER}")
endif() endif()
# TMPDIR: use relative test path (for parallel test runs / isolation). execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${WORKING_DIR}/Xtest-tmpdir)
set(ENV{TMPDIR} "${BUILD_DIR}/Xtest_tmpdir/${TEST_PATH}") set(ENV{TMPDIR} ${WORKING_DIR}/Xtest-tmpdir)
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory $ENV{TMPDIR}) set(ENV{SYSTEM_NAME} ${SYSTEM_NAME})
set(ENV{SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_NAME}) # used by test/helpers.lua.
execute_process( execute_process(
COMMAND ${BUSTED_PRG} -v -o test.busted.outputHandlers.${BUSTED_OUTPUT_TYPE} COMMAND ${BUSTED_PRG} ${TEST_TAG} ${TEST_FILTER} -v -o ${BUSTED_OUTPUT_TYPE}
--lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua --lua=${LUA_PRG} --lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua
--lpath=${BUILD_DIR}/?.lua --lpath=${BUILD_DIR}/?.lua
--lpath=${WORKING_DIR}/runtime/lua/?.lua --lpath=${WORKING_DIR}/runtime/lua/?.lua
--lpath=?.lua --lpath=?.lua
${BUSTED_ARGS}
${TEST_PATH} ${TEST_PATH}
WORKING_DIRECTORY ${WORKING_DIR} WORKING_DIRECTORY ${WORKING_DIR}
ERROR_VARIABLE err ERROR_VARIABLE err
RESULT_VARIABLE res RESULT_VARIABLE res
${EXTRA_ARGS}) ${EXTRA_ARGS})
file(GLOB RM_FILES ${BUILD_DIR}/Xtest_*) file(REMOVE ${WORKING_DIR}/Xtest_rplugin_manifest)
file(REMOVE_RECURSE ${RM_FILES}) file(REMOVE_RECURSE ${WORKING_DIR}/Xtest_xdg)
file(REMOVE_RECURSE ${WORKING_DIR}/Xtest-tmpdir)
if(NOT res EQUAL 0) if(NOT res EQUAL 0)
message(STATUS "Tests exited non-zero: ${res}")
if("${err}" STREQUAL "")
message(STATUS "No output to stderr.")
else()
message(STATUS "Output to stderr:\n${err}") message(STATUS "Output to stderr:\n${err}")
endif()
# Dump the logfile on CI (if not displayed and moved already).
if($ENV{CI})
if(EXISTS $ENV{NVIM_LOG_FILE} AND NOT EXISTS $ENV{NVIM_LOG_FILE}.displayed)
file(READ $ENV{NVIM_LOG_FILE} out)
message(STATUS "$NVIM_LOG_FILE: $ENV{NVIM_LOG_FILE}\n${out}")
endif()
endif()
message(FATAL_ERROR "${TEST_TYPE} tests failed with error: ${res}") message(FATAL_ERROR "${TEST_TYPE} tests failed with error: ${res}")
endif() endif()

View File

@@ -0,0 +1,53 @@
#
# Mingw-w64 cross compiler toolchain
#
# - The usual CMAKE variables will point to the cross compiler
# - HOST_EXE_LINKER, HOST_C_COMPILER, HOST_EXE_LINKER_FLAGS,
# HOST_C_FLAGS point to a host compiler
#
set(MINGW_TRIPLET i686-w64-mingw32)
# For x86_64 use
#set(MINGW_TRIPLET x86_64-w64-mingw32)
# The location of your toolchain sys-root
set(MINGW_PREFIX_PATH /opt/mingw32/${MINGW_TRIPLET}/)
# or sometimes like this
#set(MINGW_PREFIX_PATH /usr/${MINGW_TRIPLET}/sys-root)
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Windows)
# which compilers to use for C and C++
set(CMAKE_C_COMPILER ${MINGW_TRIPLET}-gcc)
set(CMAKE_CXX_COMPILER ${MINGW_TRIPLET}-g++)
set(CMAKE_RC_COMPILER ${MINGW_TRIPLET}-windres)
set(CMAKE_C_COMPILER ${MINGW_TRIPLET}-gcc)
set(CMAKE_CXX_COMPILER ${MINGW_TRIPLET}-g++)
set(CMAKE_RC_COMPILER ${MINGW_TRIPLET}-windres)
# Where is the target environment located
set(CMAKE_FIND_ROOT_PATH "${MINGW_PREFIX_PATH}/mingw")
# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CROSS_TARGET ${MINGW_TRIPLET})
# We need a host compiler too - assuming mildly sane Unix
# defaults here
set(HOST_C_COMPILER cc)
set(HOST_EXE_LINKER ld)
if (MINGW_TRIPLET MATCHES "^x86_64")
set(HOST_C_FLAGS)
set(HOST_EXE_LINKER_FLAGS)
else()
# In 32 bits systems have the HOST compiler generate 32 bits binaries
set(HOST_C_FLAGS -m32)
set(HOST_EXE_LINKER_FLAGS -m32)
endif()

View File

@@ -1,6 +1,3 @@
# To validate:
# cat codecov.yml | curl --data-binary @- https://codecov.io/validate
codecov: codecov:
notify: notify:
require_ci_to_pass: no require_ci_to_pass: no
@@ -15,13 +12,18 @@ coverage:
range: "70...100" range: "70...100"
status: status:
project: project: yes
default:
threshold: 1
patch: patch:
default: default:
threshold: 1 threshold: 1
only_pulls: true
changes: no changes: no
parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no
comment: off comment: off

View File

@@ -20,6 +20,7 @@ endif()
check_symbol_exists(_NSGetEnviron crt_externs.h HAVE__NSGETENVIRON) check_symbol_exists(_NSGetEnviron crt_externs.h HAVE__NSGETENVIRON)
# Headers # Headers
check_include_files(iconv.h HAVE_ICONV_H)
check_include_files(langinfo.h HAVE_LANGINFO_H) check_include_files(langinfo.h HAVE_LANGINFO_H)
check_include_files(locale.h HAVE_LOCALE_H) check_include_files(locale.h HAVE_LOCALE_H)
check_include_files(pwd.h HAVE_PWD_H) check_include_files(pwd.h HAVE_PWD_H)
@@ -31,6 +32,7 @@ if(NOT HAVE_SYS_WAIT_H AND UNIX)
endif() endif()
check_include_files(sys/utsname.h HAVE_SYS_UTSNAME_H) check_include_files(sys/utsname.h HAVE_SYS_UTSNAME_H)
check_include_files(termios.h HAVE_TERMIOS_H) check_include_files(termios.h HAVE_TERMIOS_H)
check_include_files(utime.h HAVE_UTIME_H)
check_include_files(sys/uio.h HAVE_SYS_UIO_H) check_include_files(sys/uio.h HAVE_SYS_UIO_H)
# Functions # Functions
@@ -38,19 +40,35 @@ check_function_exists(fseeko HAVE_FSEEKO)
check_function_exists(getpwent HAVE_GETPWENT) check_function_exists(getpwent HAVE_GETPWENT)
check_function_exists(getpwnam HAVE_GETPWNAM) check_function_exists(getpwnam HAVE_GETPWNAM)
check_function_exists(getpwuid HAVE_GETPWUID) check_function_exists(getpwuid HAVE_GETPWUID)
check_function_exists(uv_translate_sys_error HAVE_UV_TRANSLATE_SYS_ERROR)
check_function_exists(readv HAVE_READV) check_function_exists(readv HAVE_READV)
if(Iconv_FOUND) if(Iconv_FOUND)
set(HAVE_ICONV 1) set(HAVE_ICONV 1)
endif() endif()
if(JEMALLOC_FOUND)
set(HAVE_JEMALLOC 1)
endif()
check_function_exists(_putenv_s HAVE_PUTENV_S)
if(WIN32 AND NOT HAVE_PUTENV_S)
message(SEND_ERROR "_putenv_s() function not found on your system.")
endif()
check_function_exists(opendir HAVE_OPENDIR) check_function_exists(opendir HAVE_OPENDIR)
check_function_exists(readlink HAVE_READLINK) check_function_exists(readlink HAVE_READLINK)
check_function_exists(setenv HAVE_SETENV)
if(UNIX AND NOT HAVE_SETENV)
message(SEND_ERROR "setenv() function not found on your system.")
endif()
check_function_exists(unsetenv HAVE_UNSETENV)
check_function_exists(setpgid HAVE_SETPGID) check_function_exists(setpgid HAVE_SETPGID)
check_function_exists(setsid HAVE_SETSID) check_function_exists(setsid HAVE_SETSID)
check_function_exists(sigaction HAVE_SIGACTION) check_function_exists(sigaction HAVE_SIGACTION)
check_function_exists(strcasecmp HAVE_STRCASECMP) check_function_exists(strcasecmp HAVE_STRCASECMP)
check_function_exists(strncasecmp HAVE_STRNCASECMP) check_function_exists(strncasecmp HAVE_STRNCASECMP)
check_function_exists(utime HAVE_UTIME)
check_function_exists(utimes HAVE_UTIMES)
# Symbols # Symbols
check_symbol_exists(FD_CLOEXEC "fcntl.h" HAVE_FD_CLOEXEC) check_symbol_exists(FD_CLOEXEC "fcntl.h" HAVE_FD_CLOEXEC)

View File

@@ -13,6 +13,7 @@
#endif #endif
#define PROJECT_NAME "@PROJECT_NAME@" #define PROJECT_NAME "@PROJECT_NAME@"
#define LOCALE_INSTALL_DIR "@CMAKE_INSTALL_FULL_LOCALEDIR@"
#cmakedefine HAVE__NSGETENVIRON #cmakedefine HAVE__NSGETENVIRON
#cmakedefine HAVE_FD_CLOEXEC #cmakedefine HAVE_FD_CLOEXEC
@@ -21,12 +22,19 @@
#cmakedefine HAVE_GETPWNAM #cmakedefine HAVE_GETPWNAM
#cmakedefine HAVE_GETPWUID #cmakedefine HAVE_GETPWUID
#cmakedefine HAVE_ICONV #cmakedefine HAVE_ICONV
#cmakedefine HAVE_ICONV_H
#cmakedefine HAVE_LANGINFO_H #cmakedefine HAVE_LANGINFO_H
#cmakedefine HAVE_LOCALE_H #cmakedefine HAVE_LOCALE_H
#cmakedefine HAVE_NL_LANGINFO_CODESET #cmakedefine HAVE_NL_LANGINFO_CODESET
#cmakedefine HAVE_NL_MSG_CAT_CNTR #cmakedefine HAVE_NL_MSG_CAT_CNTR
#cmakedefine HAVE_PUTENV_S
#cmakedefine HAVE_PWD_H #cmakedefine HAVE_PWD_H
#cmakedefine HAVE_READLINK #cmakedefine HAVE_READLINK
#cmakedefine HAVE_UV_TRANSLATE_SYS_ERROR
// TODO: add proper cmake check
// #define HAVE_SELINUX 1
#cmakedefine HAVE_SETENV
#cmakedefine HAVE_UNSETENV
#cmakedefine HAVE_SETPGID #cmakedefine HAVE_SETPGID
#cmakedefine HAVE_SETSID #cmakedefine HAVE_SETSID
#cmakedefine HAVE_SIGACTION #cmakedefine HAVE_SIGACTION
@@ -36,6 +44,9 @@
#cmakedefine HAVE_SYS_UTSNAME_H #cmakedefine HAVE_SYS_UTSNAME_H
#cmakedefine HAVE_SYS_WAIT_H #cmakedefine HAVE_SYS_WAIT_H
#cmakedefine HAVE_TERMIOS_H #cmakedefine HAVE_TERMIOS_H
#cmakedefine HAVE_UTIME
#cmakedefine HAVE_UTIME_H
#cmakedefine HAVE_UTIMES
#cmakedefine HAVE_WORKING_LIBINTL #cmakedefine HAVE_WORKING_LIBINTL
#cmakedefine HAVE_WSL #cmakedefine HAVE_WSL
#cmakedefine UNIX #cmakedefine UNIX
@@ -51,6 +62,7 @@
#cmakedefine FEAT_TUI #cmakedefine FEAT_TUI
#ifndef UNIT_TESTING #ifndef UNIT_TESTING
#cmakedefine HAVE_JEMALLOC
#cmakedefine LOG_LIST_ACTIONS #cmakedefine LOG_LIST_ACTIONS
#endif #endif
@@ -59,6 +71,5 @@
#define ENDIAN_INCLUDE_FILE <@ENDIAN_INCLUDE_FILE@> #define ENDIAN_INCLUDE_FILE <@ENDIAN_INCLUDE_FILE@>
#cmakedefine HAVE_EXECINFO_BACKTRACE #cmakedefine HAVE_EXECINFO_BACKTRACE
#cmakedefine HAVE_BUILTIN_ADD_OVERFLOW
#endif // AUTO_CONFIG_H #endif // AUTO_CONFIG_H

View File

@@ -7,8 +7,9 @@
# These CFLAGS can be used in addition to those specified in CMakeLists.txt: # These CFLAGS can be used in addition to those specified in CMakeLists.txt:
# CMAKE_EXTRA_FLAGS="-DCMAKE_C_FLAGS=-ftrapv -Wlogical-op" # CMAKE_EXTRA_FLAGS="-DCMAKE_C_FLAGS=-ftrapv -Wlogical-op"
# To turn compiler warnings into errors: # By default, the jemalloc family of memory allocation functions are used.
# CMAKE_EXTRA_FLAGS += "-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -Werror" # Uncomment the following to instead use libc memory allocation functions.
# CMAKE_EXTRA_FLAGS += -DENABLE_JEMALLOC=OFF
# Sets the build type; defaults to Debug. Valid values: # Sets the build type; defaults to Debug. Valid values:
# #
@@ -35,6 +36,7 @@
# them. # them.
# #
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_BUSTED=OFF # DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_BUSTED=OFF
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_JEMALLOC=OFF
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_LIBTERMKEY=OFF # DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_LIBTERMKEY=OFF
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_LIBUV=OFF # DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_LIBUV=OFF
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_LIBVTERM=OFF # DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_LIBVTERM=OFF
@@ -47,6 +49,18 @@
# #
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED=OFF # DEPS_CMAKE_FLAGS += -DUSE_BUNDLED=OFF
# By default, bundled libraries are statically linked to nvim.
# This has no effect for non-bundled deps, which are always dynamically linked.
# Uncomment these entries to instead use dynamic linking.
#
# CMAKE_EXTRA_FLAGS += -DLIBTERMKEY_USE_STATIC=OFF
# CMAKE_EXTRA_FLAGS += -DLIBUNIBILIUM_USE_STATIC=OFF
# CMAKE_EXTRA_FLAGS += -DLIBUV_USE_STATIC=OFF
# CMAKE_EXTRA_FLAGS += -DLIBVTERM_USE_STATIC=OFF
# CMAKE_EXTRA_FLAGS += -DLUAJIT_USE_STATIC=OFF
# CMAKE_EXTRA_FLAGS += -DMSGPACK_USE_STATIC=OFF
#
#
# .DEFAULT_GOAL := nvim # .DEFAULT_GOAL := nvim
# #
# Run doxygen over the source code. # Run doxygen over the source code.

View File

@@ -56,7 +56,6 @@ Reads text from standard input until
.Dv EOF , .Dv EOF ,
then opens a buffer with that text. then opens a buffer with that text.
User input is read from standard error, which should be a terminal. User input is read from standard error, which should be a terminal.
.El
.Sh OPTIONS .Sh OPTIONS
.Bl -tag -width Fl .Bl -tag -width Fl
.It Fl t Ar tag .It Fl t Ar tag
@@ -89,14 +88,10 @@ Ex mode, reading stdin as Ex commands.
Ex mode, reading stdin as text. Ex mode, reading stdin as text.
.Ic :help Ex-mode .Ic :help Ex-mode
.It Fl es .It Fl es
Silent (non-interactive) Ex mode, reading stdin as Ex commands. Silent/batch mode, reading stdin as Ex commands.
Useful for scripting because it does NOT start a UI, unlike
.Fl e .
.Ic :help silent-mode .Ic :help silent-mode
.It Fl \&Es .It Fl \&Es
Silent (non-interactive) Ex mode, reading stdin as text. Silent/batch mode, reading stdin as text.
Useful for scripting because it does NOT start a UI, unlike
.Fl E .
.Ic :help silent-mode .Ic :help silent-mode
.It Fl d .It Fl d
Diff mode. Diff mode.
@@ -203,8 +198,6 @@ do not read or write a ShaDa file.
Skip loading plugins. Skip loading plugins.
Implied by Implied by
.Cm -u NONE . .Cm -u NONE .
.It Fl -clean
Skip loading plugins and shada (viminfo) file.
.It Fl o Ns Op Ar N .It Fl o Ns Op Ar N
Open Open
.Ar N .Ar N

View File

@@ -29,16 +29,21 @@ foreach(PACKAGE ${PACKAGES})
file(GLOB "${PACKNAME}_DOC_FILES" ${PACKAGE}/doc/*.txt) file(GLOB "${PACKNAME}_DOC_FILES" ${PACKAGE}/doc/*.txt)
if(${PACKNAME}_DOC_FILES) if(${PACKNAME}_DOC_FILES)
file(MAKE_DIRECTORY ${GENERATED_PACKAGE_DIR}/${PACKNAME}) file(MAKE_DIRECTORY ${GENERATED_PACKAGE_DIR}/${PACKNAME})
add_custom_command(OUTPUT "${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/tags" add_custom_target("${PACKNAME}-tags"
COMMAND ${CMAKE_COMMAND} -E copy_directory COMMAND ${CMAKE_COMMAND} -E copy_directory
${PACKAGE} ${GENERATED_PACKAGE_DIR}/${PACKNAME} ${PACKAGE} ${GENERATED_PACKAGE_DIR}/${PACKNAME}
COMMAND "${PROJECT_BINARY_DIR}/bin/nvim" COMMAND "${PROJECT_BINARY_DIR}/bin/nvim"
-u NONE -i NONE -e --headless -c "helptags doc" -c quit -u NONE -i NONE -e --headless -c "helptags doc" -c quit
DEPENDS DEPENDS
nvim nvim
nvim_runtime_deps
WORKING_DIRECTORY "${GENERATED_PACKAGE_DIR}/${PACKNAME}" WORKING_DIRECTORY "${GENERATED_PACKAGE_DIR}/${PACKNAME}"
) )
add_dependencies(${PACKNAME}-tags nvim_runtime_deps)
add_custom_command(OUTPUT "${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/tags"
DEPENDS
"${PACKNAME}-tags"
)
set("${PACKNAME}_DOC_NAMES") set("${PACKNAME}_DOC_NAMES")
foreach(DF "${${PACKNAME}_DOC_FILES}") foreach(DF "${${PACKNAME}_DOC_FILES}")
@@ -62,7 +67,7 @@ foreach(DF ${DOCFILES})
list(APPEND BUILDDOCFILES ${GENERATED_RUNTIME_DIR}/doc/${F}) list(APPEND BUILDDOCFILES ${GENERATED_RUNTIME_DIR}/doc/${F})
endforeach() endforeach()
add_custom_command(OUTPUT ${GENERATED_HELP_TAGS} add_custom_target(helptags
COMMAND ${CMAKE_COMMAND} -E remove doc/* COMMAND ${CMAKE_COMMAND} -E remove doc/*
COMMAND ${CMAKE_COMMAND} -E copy_directory COMMAND ${CMAKE_COMMAND} -E copy_directory
${PROJECT_SOURCE_DIR}/runtime/doc doc ${PROJECT_SOURCE_DIR}/runtime/doc doc
@@ -70,15 +75,19 @@ add_custom_command(OUTPUT ${GENERATED_HELP_TAGS}
-u NONE -i NONE -e --headless -c "helptags ++t doc" -c quit -u NONE -i NONE -e --headless -c "helptags ++t doc" -c quit
DEPENDS DEPENDS
nvim nvim
nvim_runtime_deps
WORKING_DIRECTORY "${GENERATED_RUNTIME_DIR}" WORKING_DIRECTORY "${GENERATED_RUNTIME_DIR}"
) )
add_dependencies(helptags nvim_runtime_deps)
add_custom_command(OUTPUT ${GENERATED_HELP_TAGS}
DEPENDS
helptags
)
add_custom_target(doc_html add_custom_target(doc_html
COMMAND make html COMMAND make html
DEPENDS DEPENDS
${GENERATED_HELP_TAGS} helptags
WORKING_DIRECTORY "${GENERATED_RUNTIME_DIR}/doc" WORKING_DIRECTORY "${GENERATED_RUNTIME_DIR}/doc"
) )

View File

@@ -1,12 +1,8 @@
" Author: Antony Lee <anntzer.lee@gmail.com> " Author: Antony Lee <anntzer.lee@gmail.com>
" Description: Helper functions for reStructuredText syntax folding " Description: Helper functions for reStructuredText syntax folding
" Last Modified: 2018-12-29 " Last Modified: 2018-01-07
function s:CacheRstFold() function s:CacheRstFold()
if !g:rst_fold_enabled
return
endif
let closure = {'header_types': {}, 'max_level': 0, 'levels': {}} let closure = {'header_types': {}, 'max_level': 0, 'levels': {}}
function closure.Process(match) dict function closure.Process(match) dict
let curline = getcurpos()[1] let curline = getcurpos()[1]
@@ -24,18 +20,12 @@ function s:CacheRstFold()
let self.levels[curline] = self.header_types[key] let self.levels[curline] = self.header_types[key]
endfunction endfunction
let save_cursor = getcurpos() let save_cursor = getcurpos()
let save_mark = getpos("'[")
silent keeppatterns %s/\v^%(%(([=`:.'"~^_*+#-])\1+\n)?.{1,2}\n([=`:.'"~^_*+#-])\2+)|%(%(([=`:.''"~^_*+#-])\3{2,}\n)?.{3,}\n([=`:.''"~^_*+#-])\4{2,})$/\=closure.Process(submatch(0))/gn silent keeppatterns %s/\v^%(%(([=`:.'"~^_*+#-])\1+\n)?.{1,2}\n([=`:.'"~^_*+#-])\2+)|%(%(([=`:.''"~^_*+#-])\3{2,}\n)?.{3,}\n([=`:.''"~^_*+#-])\4{2,})$/\=closure.Process(submatch(0))/gn
call setpos('.', save_cursor) call setpos('.', save_cursor)
call setpos("'[", save_mark)
let b:RstFoldCache = closure.levels let b:RstFoldCache = closure.levels
endfunction endfunction
function RstFold#GetRstFold() function RstFold#GetRstFold()
if !g:rst_fold_enabled
return
endif
if !has_key(b:, 'RstFoldCache') if !has_key(b:, 'RstFoldCache')
call s:CacheRstFold() call s:CacheRstFold()
endif endif
@@ -47,10 +37,6 @@ function RstFold#GetRstFold()
endfunction endfunction
function RstFold#GetRstFoldText() function RstFold#GetRstFoldText()
if !g:rst_fold_enabled
return
endif
if !has_key(b:, 'RstFoldCache') if !has_key(b:, 'RstFoldCache')
call s:CacheRstFold() call s:CacheRstFold()
endif endif

View File

@@ -1,7 +1,7 @@
" Vim functions for file type detection " Vim functions for file type detection
" "
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2019 Mar 08 " Last Change: 2017 Dec 05
" These functions are moved here from runtime/filetype.vim to make startup " These functions are moved here from runtime/filetype.vim to make startup
" faster. " faster.
@@ -126,7 +126,7 @@ endfunc
" This function checks if one of the first ten lines start with a '@'. In " This function checks if one of the first ten lines start with a '@'. In
" that case it is probably a change file. " that case it is probably a change file.
" If the first line starts with # or ! it's probably a ch file. " If the first line starts with # or ! it's probably a ch file.
" If a line has "main", "include", "//" or "/*" it's probably ch. " If a line has "main", "include", "//" ir "/*" it's probably ch.
" Otherwise CHILL is assumed. " Otherwise CHILL is assumed.
func dist#ft#FTchange() func dist#ft#FTchange()
let lnum = 1 let lnum = 1
@@ -197,7 +197,7 @@ func dist#ft#FTe()
exe 'setf ' . g:filetype_euphoria exe 'setf ' . g:filetype_euphoria
else else
let n = 1 let n = 1
while n < 100 && n <= line("$") while n < 100 && n < line("$")
if getline(n) =~ "^\\s*\\(<'\\|'>\\)\\s*$" if getline(n) =~ "^\\s*\\(<'\\|'>\\)\\s*$"
setf specman setf specman
return return
@@ -211,7 +211,7 @@ endfunc
" Distinguish between HTML, XHTML and Django " Distinguish between HTML, XHTML and Django
func dist#ft#FThtml() func dist#ft#FThtml()
let n = 1 let n = 1
while n < 10 && n <= line("$") while n < 10 && n < line("$")
if getline(n) =~ '\<DTD\s\+XHTML\s' if getline(n) =~ '\<DTD\s\+XHTML\s'
setf xhtml setf xhtml
return return
@@ -222,13 +222,13 @@ func dist#ft#FThtml()
endif endif
let n = n + 1 let n = n + 1
endwhile endwhile
setf FALLBACK html setf html
endfunc endfunc
" Distinguish between standard IDL and MS-IDL " Distinguish between standard IDL and MS-IDL
func dist#ft#FTidl() func dist#ft#FTidl()
let n = 1 let n = 1
while n < 50 && n <= line("$") while n < 50 && n < line("$")
if getline(n) =~ '^\s*import\s\+"\(unknwn\|objidl\)\.idl"' if getline(n) =~ '^\s*import\s\+"\(unknwn\|objidl\)\.idl"'
setf msidl setf msidl
return return
@@ -484,10 +484,6 @@ endfunc
" Called from filetype.vim and scripts.vim. " Called from filetype.vim and scripts.vim.
func dist#ft#SetFileTypeSH(name) func dist#ft#SetFileTypeSH(name)
if did_filetype()
" Filetype was already detected
return
endif
if expand("<amatch>") =~ g:ft_ignore_pat if expand("<amatch>") =~ g:ft_ignore_pat
return return
endif endif
@@ -535,10 +531,6 @@ endfunc
" as used for Tcl. " as used for Tcl.
" Also called from scripts.vim, thus can't be local to this script. " Also called from scripts.vim, thus can't be local to this script.
func dist#ft#SetFileTypeShell(name) func dist#ft#SetFileTypeShell(name)
if did_filetype()
" Filetype was already detected
return
endif
if expand("<amatch>") =~ g:ft_ignore_pat if expand("<amatch>") =~ g:ft_ignore_pat
return return
endif endif
@@ -559,10 +551,6 @@ func dist#ft#SetFileTypeShell(name)
endfunc endfunc
func dist#ft#CSH() func dist#ft#CSH()
if did_filetype()
" Filetype was already detected
return
endif
if exists("g:filetype_csh") if exists("g:filetype_csh")
call dist#ft#SetFileTypeShell(g:filetype_csh) call dist#ft#SetFileTypeShell(g:filetype_csh)
elseif &shell =~ "tcsh" elseif &shell =~ "tcsh"
@@ -699,7 +687,7 @@ endfunc
func dist#ft#FTxml() func dist#ft#FTxml()
let n = 1 let n = 1
while n < 100 && n <= line("$") while n < 100 && n < line("$")
let line = getline(n) let line = getline(n)
" DocBook 4 or DocBook 5. " DocBook 4 or DocBook 5.
let is_docbook4 = line =~ '<!DOCTYPE.*DocBook' let is_docbook4 = line =~ '<!DOCTYPE.*DocBook'
@@ -725,7 +713,7 @@ endfunc
func dist#ft#FTy() func dist#ft#FTy()
let n = 1 let n = 1
while n < 100 && n <= line("$") while n < 100 && n < line("$")
let line = getline(n) let line = getline(n)
if line =~ '^\s*%' if line =~ '^\s*%'
setf yacc setf yacc

View File

@@ -30,7 +30,7 @@ function! health#check(plugin_names) abort
\ : s:to_fn_names(a:plugin_names) \ : s:to_fn_names(a:plugin_names)
tabnew tabnew
setlocal wrap breakindent linebreak setlocal wrap breakindent
setlocal filetype=markdown setlocal filetype=markdown
setlocal conceallevel=2 concealcursor=nc setlocal conceallevel=2 concealcursor=nc
setlocal keywordprg=:help setlocal keywordprg=:help

View File

@@ -8,7 +8,7 @@ function! s:check_config() abort
if !filereadable(vimrc) if !filereadable(vimrc)
let ok = v:false let ok = v:false
let has_vim = filereadable(expand('~/.vimrc')) let has_vim = filereadable(expand('~/.vimrc'))
call health#report_warn((-1 == getfsize(vimrc) ? 'Missing' : 'Unreadable').' user config file: '.vimrc, call health#report_warn('Missing user config file: '.vimrc,
\[ has_vim ? ':help nvim-from-vim' : ':help init.vim' ]) \[ has_vim ? ':help nvim-from-vim' : ':help init.vim' ])
endif endif
@@ -25,15 +25,6 @@ function! s:check_config() abort
\ 'https://github.com/neovim/neovim/wiki/Following-HEAD#20170402' ]) \ 'https://github.com/neovim/neovim/wiki/Following-HEAD#20170402' ])
endif endif
if v:ctype ==# 'C'
let ok = v:false
call health#report_error('Locale does not support UTF-8. Unicode characters may not display correctly.'
\ .printf("\n$LANG=%s $LC_ALL=%s $LC_CTYPE=%s", $LANG, $LC_ALL, $LC_CTYPE),
\ [ 'If using tmux, try the -u option.',
\ 'Ensure that your terminal/shell/tmux/etc inherits the environment, or set $LANG explicitly.' ,
\ 'Configure your system locale.' ])
endif
if &paste if &paste
let ok = v:false let ok = v:false
call health#report_error("'paste' is enabled. This option is only for pasting text.\nIt should not be set in your config.", call health#report_error("'paste' is enabled. This option is only for pasting text.\nIt should not be set in your config.",
@@ -41,12 +32,6 @@ function! s:check_config() abort
\ 'Check `:verbose set paste?` to see if a plugin or script set the option.', ]) \ 'Check `:verbose set paste?` to see if a plugin or script set the option.', ])
endif endif
let shadafile = (empty(&shadafile) || &shadafile ==# 'NONE') ? stdpath('data').'/shada/main.shada' : &shadafile
if !empty(shadafile) && (!filereadable(shadafile) || !filewritable(shadafile))
let ok = v:false
call health#report_error('shada file is not '.(filereadable(shadafile) ? 'writeable' : 'readable').":\n".shadafile)
endif
if ok if ok
call health#report_ok('no issues found') call health#report_ok('no issues found')
endif endif
@@ -123,7 +108,7 @@ function! s:check_performance() abort
else else
call health#report_info(buildtype) call health#report_info(buildtype)
call health#report_warn( call health#report_warn(
\ 'Non-optimized '.(has('debug')?'(DEBUG) ':'').'build. Nvim will be slower.', \ 'Non-optimized build-type. Nvim will be slower.',
\ ['Install a different Nvim package, or rebuild with `CMAKE_BUILD_TYPE=RelWithDebInfo`.', \ ['Install a different Nvim package, or rebuild with `CMAKE_BUILD_TYPE=RelWithDebInfo`.',
\ s:suggest_faq]) \ s:suggest_faq])
endif endif
@@ -176,17 +161,6 @@ function! s:check_tmux() abort
\ ["Set default-terminal in ~/.tmux.conf:\nset-option -g default-terminal \"screen-256color\"", \ ["Set default-terminal in ~/.tmux.conf:\nset-option -g default-terminal \"screen-256color\"",
\ s:suggest_faq]) \ s:suggest_faq])
endif endif
" check for RGB capabilities
let info = system('tmux server-info')
let has_tc = stridx(info, " Tc: (flag) true") != -1
let has_rgb = stridx(info, " RGB: (flag) true") != -1
if !has_tc && !has_rgb
call health#report_warn(
\ "Neither Tc nor RGB capability set. True colors are disabled. |'termguicolors'| won't work properly.",
\ ["Put this in your ~/.tmux.conf and replace XXX by your $TERM outside of tmux:\nset-option -sa terminal-overrides ',XXX:RGB'",
\ "For older tmux versions use this instead:\nset-option -ga terminal-overrides ',XXX:Tc'"])
endif
endfunction endfunction
function! s:check_terminal() abort function! s:check_terminal() abort

View File

@@ -106,8 +106,7 @@ endfunction
" Fetch the contents of a URL. " Fetch the contents of a URL.
function! s:download(url) abort function! s:download(url) abort
let has_curl = executable('curl') if executable('curl')
if has_curl && system(['curl', '-V']) =~# 'Protocols:.*https'
let rv = s:system(['curl', '-sL', a:url], '', 1, 1) let rv = s:system(['curl', '-sL', a:url], '', 1, 1)
return s:shell_error ? 'curl error with '.a:url.': '.s:shell_error : rv return s:shell_error ? 'curl error with '.a:url.': '.s:shell_error : rv
elseif executable('python') elseif executable('python')
@@ -125,9 +124,7 @@ function! s:download(url) abort
\ ? 'python urllib.request error: '.s:shell_error \ ? 'python urllib.request error: '.s:shell_error
\ : rv \ : rv
endif endif
return 'missing `curl` ' return 'missing `curl` and `python`, cannot make pypi request'
\ .(has_curl ? '(with HTTPS support) ' : '')
\ .'and `python`, cannot make web request'
endfunction endfunction
" Check for clipboard tools. " Check for clipboard tools.
@@ -564,10 +561,7 @@ function! s:check_node() abort
endif endif
call health#report_info('Neovim node.js host: '. host) call health#report_info('Neovim node.js host: '. host)
let manager = executable('npm') ? 'npm' : 'yarn' let latest_npm_cmd = has('win32') ? 'cmd /c npm info neovim --json' : 'npm info neovim --json'
let latest_npm_cmd = has('win32') ?
\ 'cmd /c '. manager .' info neovim --json' :
\ manager .' info neovim --json'
let latest_npm = s:system(split(latest_npm_cmd)) let latest_npm = s:system(split(latest_npm_cmd))
if s:shell_error || empty(latest_npm) if s:shell_error || empty(latest_npm)
call health#report_error('Failed to run: '. latest_npm_cmd, call health#report_error('Failed to run: '. latest_npm_cmd,
@@ -596,8 +590,7 @@ function! s:check_node() abort
call health#report_warn( call health#report_warn(
\ printf('Package "neovim" is out-of-date. Installed: %s, latest: %s', \ printf('Package "neovim" is out-of-date. Installed: %s, latest: %s',
\ current_npm, latest_npm), \ current_npm, latest_npm),
\ ['Run in shell: npm install -g neovim', \ ['Run in shell: npm install -g neovim'])
\ 'Run in shell (if you use yarn): yarn global add neovim'])
else else
call health#report_ok('Latest "neovim" npm/yarn package is installed: '. current_npm) call health#report_ok('Latest "neovim" npm/yarn package is installed: '. current_npm)
endif endif

View File

@@ -150,9 +150,8 @@ endfunction
function! s:get_page(path) abort function! s:get_page(path) abort
" Disable hard-wrap by using a big $MANWIDTH (max 1000 on some systems #9065). " Disable hard-wrap by using a big $MANWIDTH (max 1000 on some systems #9065).
" Soft-wrap: ftplugin/man.vim sets wrap/breakindent/…. " We use soft wrap: ftplugin/man.vim sets wrap/breakindent/….
" Hard-wrap: driven by `man`. let manwidth = 999
let manwidth = !get(g:,'man_hardwrap') ? 999 : (empty($MANWIDTH) ? winwidth(0) : $MANWIDTH)
" Force MANPAGER=cat to ensure Vim is not recursively invoked (by man-db). " Force MANPAGER=cat to ensure Vim is not recursively invoked (by man-db).
" http://comments.gmane.org/gmane.editors.vim.devel/29085 " http://comments.gmane.org/gmane.editors.vim.devel/29085
" Set MAN_KEEP_FORMATTING so Debian man doesn't discard backspaces. " Set MAN_KEEP_FORMATTING so Debian man doesn't discard backspaces.

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
" netrwSettings.vim: makes netrw settings simpler " netrwSettings.vim: makes netrw settings simpler
" Date: Nov 09, 2016 " Date: Dec 30, 2014
" Maintainer: Charles E Campbell <drchipNOSPAM at campbellfamily dot biz> " Maintainer: Charles E Campbell <drchipNOSPAM at campbellfamily dot biz>
" Version: 16 " Version: 15
" Copyright: Copyright (C) 1999-2007 Charles E. Campbell {{{1 " Copyright: Copyright (C) 1999-2007 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code, " Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright " with or without modifications, provided that this copyright
@@ -19,7 +19,7 @@
if exists("g:loaded_netrwSettings") || &cp if exists("g:loaded_netrwSettings") || &cp
finish finish
endif endif
let g:loaded_netrwSettings = "v16" let g:loaded_netrwSettings = "v15"
if v:version < 700 if v:version < 700
echohl WarningMsg echohl WarningMsg
echo "***warning*** this version of netrwSettings needs vim 7.0" echo "***warning*** this version of netrwSettings needs vim 7.0"
@@ -154,13 +154,9 @@ fun! netrwSettings#NetrwSettings()
put = 'let g:netrw_list_hide = '.g:netrw_list_hide put = 'let g:netrw_list_hide = '.g:netrw_list_hide
put = 'let g:netrw_liststyle = '.g:netrw_liststyle put = 'let g:netrw_liststyle = '.g:netrw_liststyle
put = 'let g:netrw_localcopycmd = '.g:netrw_localcopycmd put = 'let g:netrw_localcopycmd = '.g:netrw_localcopycmd
put = 'let g:netrw_localcopycmdopt = '.g:netrw_localcopycmdopt
put = 'let g:netrw_localmkdir = '.g:netrw_localmkdir put = 'let g:netrw_localmkdir = '.g:netrw_localmkdir
put = 'let g:netrw_localmkdiropt = '.g:netrw_localmkdiropt
put = 'let g:netrw_localmovecmd = '.g:netrw_localmovecmd put = 'let g:netrw_localmovecmd = '.g:netrw_localmovecmd
put = 'let g:netrw_localmovecmdopt = '.g:netrw_localmovecmdopt
put = 'let g:netrw_localrmdir = '.g:netrw_localrmdir put = 'let g:netrw_localrmdir = '.g:netrw_localrmdir
put = 'let g:netrw_localrmdiropt = '.g:netrw_localrmdiropt
put = 'let g:netrw_maxfilenamelen = '.g:netrw_maxfilenamelen put = 'let g:netrw_maxfilenamelen = '.g:netrw_maxfilenamelen
put = 'let g:netrw_menu = '.g:netrw_menu put = 'let g:netrw_menu = '.g:netrw_menu
put = 'let g:netrw_mousemaps = '.g:netrw_mousemaps put = 'let g:netrw_mousemaps = '.g:netrw_mousemaps

View File

@@ -1,15 +1,20 @@
" Vim support file to help with paste mappings and menus " Vim support file to help with paste mappings and menus
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2019 Jan 27 " Last Change: 2017 Aug 30
" Define the string to use for items that are present both in Edit, Popup and " Define the string to use for items that are present both in Edit, Popup and
" Toolbar menu. Also used in mswin.vim and macmap.vim. " Toolbar menu. Also used in mswin.vim and macmap.vim.
let paste#paste_cmd = {'n': ":call paste#Paste()<CR>"} " Pasting blockwise and linewise selections is not possible in Insert and
let paste#paste_cmd['v'] = '"-c<Esc>' . paste#paste_cmd['n'] " Visual mode without the +virtualedit feature. They are pasted as if they
let paste#paste_cmd['i'] = "\<c-\>\<c-o>\"+gP" " were characterwise instead. Add to that some tricks to leave the cursor in
" the right position, also for "gi".
if has("virtualedit")
let paste#paste_cmd = {'n': ":call paste#Paste()<CR>"}
let paste#paste_cmd['v'] = '"-c<Esc>' . paste#paste_cmd['n']
let paste#paste_cmd['i'] = "\<c-\>\<c-o>\"+gP"
func! paste#Paste() func! paste#Paste()
let ove = &ve let ove = &ve
set ve=all set ve=all
normal! `^ normal! `^
@@ -22,4 +27,9 @@ func! paste#Paste()
normal! l normal! l
endif endif
let &ve = ove let &ve = ove
endfunc endfunc
else
let paste#paste_cmd = {'n': "\"=@+.'xy'<CR>gPFx\"_2x"}
let paste#paste_cmd['v'] = '"-c<Esc>gix<Esc>' . paste#paste_cmd['n'] . '"_x'
let paste#paste_cmd['i'] = 'x<Esc>' . paste#paste_cmd['n'] . '"_s'
endif

View File

@@ -1,16 +1,6 @@
" The clipboard provider uses shell commands to communicate with the clipboard. " The clipboard provider uses shell commands to communicate with the clipboard.
" The provider function will only be registered if a supported command is " The provider function will only be registered if a supported command is
" available. " available.
if exists('g:loaded_clipboard_provider')
finish
endif
" Default to 1. provider#clipboard#Executable() may set 2.
" To force a reload:
" :unlet g:loaded_clipboard_provider
" :runtime autoload/provider/clipboard.vim
let g:loaded_clipboard_provider = 1
let s:copy = {} let s:copy = {}
let s:paste = {} let s:paste = {}
let s:clipboard = {} let s:clipboard = {}
@@ -75,7 +65,7 @@ function! provider#clipboard#Executable() abort
let s:paste = get(g:clipboard, 'paste', { '+': v:null, '*': v:null }) let s:paste = get(g:clipboard, 'paste', { '+': v:null, '*': v:null })
let s:cache_enabled = get(g:clipboard, 'cache_enabled', 0) let s:cache_enabled = get(g:clipboard, 'cache_enabled', 0)
return get(g:clipboard, 'name', 'g:clipboard') return get(g:clipboard, 'name', 'g:clipboard')
elseif has('mac') elseif has('mac') && executable('pbpaste') && s:cmd_ok('pbpaste')
let s:copy['+'] = 'pbcopy' let s:copy['+'] = 'pbcopy'
let s:paste['+'] = 'pbpaste' let s:paste['+'] = 'pbpaste'
let s:copy['*'] = s:copy['+'] let s:copy['*'] = s:copy['+']
@@ -83,9 +73,9 @@ function! provider#clipboard#Executable() abort
let s:cache_enabled = 0 let s:cache_enabled = 0
return 'pbcopy' return 'pbcopy'
elseif exists('$WAYLAND_DISPLAY') && executable('wl-copy') && executable('wl-paste') elseif exists('$WAYLAND_DISPLAY') && executable('wl-copy') && executable('wl-paste')
let s:copy['+'] = 'wl-copy --foreground --type text/plain' let s:copy['+'] = 'wl-copy --foreground'
let s:paste['+'] = 'wl-paste --no-newline' let s:paste['+'] = 'wl-paste --no-newline'
let s:copy['*'] = 'wl-copy --foreground --primary --type text/plain' let s:copy['*'] = 'wl-copy --foreground --primary'
let s:paste['*'] = 'wl-paste --no-newline --primary' let s:paste['*'] = 'wl-paste --no-newline --primary'
return 'wl-copy' return 'wl-copy'
elseif exists('$DISPLAY') && executable('xclip') elseif exists('$DISPLAY') && executable('xclip')
@@ -130,6 +120,13 @@ function! provider#clipboard#Executable() abort
return '' return ''
endfunction endfunction
if empty(provider#clipboard#Executable())
" provider#clipboard#Call() *must not* be defined if the provider is broken.
" Otherwise eval_has_provider() thinks the clipboard provider is
" functioning, and eval_call_provider() will happily call it.
finish
endif
function! s:clipboard.get(reg) abort function! s:clipboard.get(reg) abort
if type(s:paste[a:reg]) == v:t_func if type(s:paste[a:reg]) == v:t_func
return s:paste[a:reg]() return s:paste[a:reg]()
@@ -159,7 +156,9 @@ function! s:clipboard.set(lines, regtype, reg) abort
end end
if s:selections[a:reg].owner > 0 if s:selections[a:reg].owner > 0
let prev_job = s:selections[a:reg].owner " The previous provider instance should exit when the new one takes
" ownership, but kill it to be sure we don't fill up the job table.
call jobstop(s:selections[a:reg].owner)
end end
let s:selections[a:reg] = copy(s:selection) let s:selections[a:reg] = copy(s:selection)
let selection = s:selections[a:reg] let selection = s:selections[a:reg]
@@ -173,23 +172,13 @@ function! s:clipboard.set(lines, regtype, reg) abort
call jobsend(jobid, a:lines) call jobsend(jobid, a:lines)
call jobclose(jobid, 'stdin') call jobclose(jobid, 'stdin')
let selection.owner = jobid let selection.owner = jobid
let ret = 1
else else
echohl WarningMsg echohl WarningMsg
echomsg 'clipboard: failed to execute: '.(s:copy[a:reg]) echomsg 'clipboard: failed to execute: '.(s:copy[a:reg])
echohl None echohl None
let ret = 1 return 0
endif endif
return 1
" The previous provider instance should exit when the new one takes
" ownership, but kill it to be sure we don't fill up the job table.
if exists('prev_job')
call timer_start(1000, {... ->
\ jobwait([prev_job], 0)[0] == -1
\ && jobstop(prev_job)})
endif
return ret
endfunction endfunction
function! provider#clipboard#Call(method, args) abort function! provider#clipboard#Call(method, args) abort
@@ -203,6 +192,3 @@ function! provider#clipboard#Call(method, args) abort
let s:here = v:false let s:here = v:false
endtry endtry
endfunction endfunction
" eval_has_provider() decides based on this variable.
let g:loaded_clipboard_provider = empty(provider#clipboard#Executable()) ? 1 : 2

View File

@@ -51,9 +51,6 @@ function! provider#node#Detect() abort
if exists('g:node_host_prog') if exists('g:node_host_prog')
return expand(g:node_host_prog) return expand(g:node_host_prog)
endif endif
if !executable('node')
return ''
endif
if !s:is_minimum_version(v:null, 6, 0) if !s:is_minimum_version(v:null, 6, 0)
return '' return ''
endif endif
@@ -143,9 +140,8 @@ endfunction
let s:err = '' let s:err = ''
let s:prog = provider#node#Detect() let s:prog = provider#node#Detect()
let g:loaded_node_provider = empty(s:prog) ? 1 : 2
if g:loaded_node_provider != 2 if empty(s:prog)
let s:err = 'Cannot find the "neovim" node package. Try :checkhealth' let s:err = 'Cannot find the "neovim" node package. Try :checkhealth'
endif endif

View File

@@ -7,8 +7,9 @@
if exists('g:loaded_python_provider') if exists('g:loaded_python_provider')
finish finish
endif endif
let g:loaded_python_provider = 1
let [s:prog, s:err] = provider#pythonx#Detect(2) let [s:prog, s:err] = provider#pythonx#Detect(2)
let g:loaded_python_provider = empty(s:prog) ? 1 : 2
function! provider#python#Prog() abort function! provider#python#Prog() abort
return s:prog return s:prog
@@ -18,6 +19,11 @@ function! provider#python#Error() abort
return s:err return s:err
endfunction endfunction
if s:prog == ''
" Detection failed
finish
endif
" The Python provider plugin will run in a separate instance of the Python " The Python provider plugin will run in a separate instance of the Python
" host. " host.
call remote#host#RegisterClone('legacy-python-provider', 'python') call remote#host#RegisterClone('legacy-python-provider', 'python')

View File

@@ -7,8 +7,9 @@
if exists('g:loaded_python3_provider') if exists('g:loaded_python3_provider')
finish finish
endif endif
let g:loaded_python3_provider = 1
let [s:prog, s:err] = provider#pythonx#Detect(3) let [s:prog, s:err] = provider#pythonx#Detect(3)
let g:loaded_python3_provider = empty(s:prog) ? 1 : 2
function! provider#python3#Prog() abort function! provider#python3#Prog() abort
return s:prog return s:prog
@@ -18,6 +19,11 @@ function! provider#python3#Error() abort
return s:err return s:err
endfunction endfunction
if s:prog == ''
" Detection failed
finish
endif
" The Python3 provider plugin will run in a separate instance of the Python3 " The Python3 provider plugin will run in a separate instance of the Python3
" host. " host.
call remote#host#RegisterClone('legacy-python3-provider', 'python3') call remote#host#RegisterClone('legacy-python3-provider', 'python3')

View File

@@ -62,9 +62,8 @@ endfunction
let s:err = '' let s:err = ''
let s:prog = s:detect() let s:prog = s:detect()
let s:plugin_path = expand('<sfile>:p:h') . '/script_host.rb' let s:plugin_path = expand('<sfile>:p:h') . '/script_host.rb'
let g:loaded_ruby_provider = empty(s:prog) ? 1 : 2
if g:loaded_ruby_provider != 2 if empty(s:prog)
let s:err = 'Cannot find the neovim RubyGem. Try :checkhealth' let s:err = 'Cannot find the neovim RubyGem. Try :checkhealth'
endif endif

View File

@@ -44,7 +44,7 @@
" "
if !has('python3') if !has('python3')
echo 'Error: Requires python3 + pynvim. :help provider-python' echo "Error: Required vim compiled with +python3"
finish finish
endif endif

View File

@@ -42,7 +42,7 @@
" "
if !has('python') if !has('python')
echo 'Error: Requires python + pynvim. :help provider-python' echo "Error: Required vim compiled with +python"
finish finish
endif endif

View File

@@ -147,7 +147,7 @@ function! s:RegistrationCommands(host) abort
\ a:host, string(map(registered, "fnamemodify(v:val, ':t')"))) \ a:host, string(map(registered, "fnamemodify(v:val, ':t')")))
" Delete the temporary host clone " Delete the temporary host clone
call jobstop(s:hosts[host_id].channel) call rpcstop(s:hosts[host_id].channel)
call remove(s:hosts, host_id) call remove(s:hosts, host_id)
call remove(s:plugins_for_host, host_id) call remove(s:plugins_for_host, host_id)
return lines return lines

View File

@@ -3,7 +3,7 @@
" Maintainer: Mark Guzman <segfault@hasno.info> " Maintainer: Mark Guzman <segfault@hasno.info>
" URL: https://github.com/vim-ruby/vim-ruby " URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com> " Release Coordinator: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2019 Jan 06 " Maintainer Version: 0.8.1
" ---------------------------------------------------------------------------- " ----------------------------------------------------------------------------
" "
" Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com) " Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com)
@@ -103,7 +103,7 @@ function! s:GetBufferRubyEntity( name, type, ... )
endif endif
let curpos = getpos(".") let curpos = getpos(".")
let [enum,ecol] = searchpairpos( crex, '', '\(end\|}\)', 'W' ) let [enum,ecol] = searchpairpos( crex, '', '\(end\|}\)', 'wr' )
call cursor(lastpos[1], lastpos[2]) call cursor(lastpos[1], lastpos[2])
if lnum > enum if lnum > enum
@@ -253,27 +253,15 @@ class VimRubyCompletion
# {{{ buffer analysis magic # {{{ buffer analysis magic
def load_requires def load_requires
custom_paths = VIM::evaluate("get(g:, 'rubycomplete_load_paths', [])")
if !custom_paths.empty?
$LOAD_PATH.concat(custom_paths).uniq!
end
buf = VIM::Buffer.current buf = VIM::Buffer.current
enum = buf.line_number enum = buf.line_number
nums = Range.new( 1, enum ) nums = Range.new( 1, enum )
nums.each do |x| nums.each do |x|
ln = buf[x] ln = buf[x]
begin begin
if /.*require_relative\s*(.*)$/.match( ln ) eval( "require %s" % $1 ) if /.*require\s*(.*)$/.match( ln )
eval( "require %s" % File.expand_path($1) ) rescue Exception
elsif /.*require\s*(["'].*?["'])/.match( ln ) #ignore?
eval( "require %s" % $1 )
end
rescue Exception => e
dprint e.inspect
end end
end end
end end
@@ -356,13 +344,8 @@ class VimRubyCompletion
if x != cur_line if x != cur_line
next if x == 0 next if x == 0
ln = buf[x] ln = buf[x]
is_const = false if /^\s*(module|class|def|include)\s+/.match(ln)
if /^\s*(module|class|def|include)\s+/.match(ln) || is_const = /^\s*?[A-Z]([A-z]|[1-9])*\s*?[|]{0,2}=\s*?.+\s*?/.match(ln) clscnt += 1 if $1 == "class"
clscnt += 1 if /class|module/.match($1)
# We must make sure to load each constant only once to avoid errors
if is_const
ln.gsub!(/\s*?[|]{0,2}=\s*?/, '||=')
end
#dprint "\$1$1 #dprint "\$1$1
classdef += "%s\n" % ln classdef += "%s\n" % ln
classdef += "end\n" if /def\s+/.match(ln) classdef += "end\n" if /def\s+/.match(ln)
@@ -440,6 +423,7 @@ class VimRubyCompletion
return get_buffer_entity_list( "class" ) return get_buffer_entity_list( "class" )
end end
def load_rails def load_rails
allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails") allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails")
return if allow_rails.to_i.zero? return if allow_rails.to_i.zero?
@@ -545,6 +529,7 @@ class VimRubyCompletion
ret += ActiveRecord::ConnectionAdapters::SchemaStatements.methods ret += ActiveRecord::ConnectionAdapters::SchemaStatements.methods
end end
return ret return ret
end end
@@ -602,15 +587,13 @@ class VimRubyCompletion
# {{{ main completion code # {{{ main completion code
def self.preload_rails def self.preload_rails
a = VimRubyCompletion.new a = VimRubyCompletion.new
if VIM::evaluate("has('nvim')") == 0 require 'Thread'
require 'thread'
Thread.new(a) do |b| Thread.new(a) do |b|
begin begin
b.load_rails b.load_rails
rescue rescue
end end
end end
end
a.load_rails a.load_rails
rescue rescue
end end
@@ -630,6 +613,7 @@ class VimRubyCompletion
want_gems = VIM::evaluate("get(g:, 'rubycomplete_load_gemfile')") want_gems = VIM::evaluate("get(g:, 'rubycomplete_load_gemfile')")
load_gems unless want_gems.to_i.zero? load_gems unless want_gems.to_i.zero?
input = VIM::Buffer.current.line input = VIM::Buffer.current.line
cpos = VIM::Window.current.cursor[1] - 1 cpos = VIM::Window.current.cursor[1] - 1
input = input[0..cpos] input = input[0..cpos]
@@ -682,7 +666,6 @@ class VimRubyCompletion
message = Regexp.quote($4) message = Regexp.quote($4)
dprint "const or cls 2 [recv: \'%s\', msg: \'%s\']" % [ receiver, message ] dprint "const or cls 2 [recv: \'%s\', msg: \'%s\']" % [ receiver, message ]
load_buffer_class( receiver ) load_buffer_class( receiver )
load_buffer_module( receiver )
begin begin
classes = eval("#{receiver}.constants") classes = eval("#{receiver}.constants")
#methods = eval("#{receiver}.methods") #methods = eval("#{receiver}.methods")
@@ -803,6 +786,7 @@ class VimRubyCompletion
methods += Kernel.public_methods methods += Kernel.public_methods
end end
include_object = VIM::evaluate("exists('g:rubycomplete_include_object') && g:rubycomplete_include_object") include_object = VIM::evaluate("exists('g:rubycomplete_include_object') && g:rubycomplete_include_object")
methods = clean_sel( methods, message ) methods = clean_sel( methods, message )
methods = (methods-Object.instance_methods) if include_object == "0" methods = (methods-Object.instance_methods) if include_object == "0"
@@ -845,4 +829,5 @@ let s:rubycomplete_rails_loaded = 0
call s:DefRuby() call s:DefRuby()
"}}} ruby-side code "}}} ruby-side code
" vim:tw=78:sw=4:ts=8:et:fdm=marker:ft=vim:norl: " vim:tw=78:sw=4:ts=8:et:fdm=marker:ft=vim:norl:

View File

@@ -195,6 +195,16 @@ function! spellfile#GetDirChoices()
endfunc endfunc
function! spellfile#WritableSpellDir() function! spellfile#WritableSpellDir()
" Always use the $XDG_DATA_HOME//site directory " Always use the $XDG_DATA_HOME/nvim/site directory
return stdpath('data').'/site/spell' if exists('$XDG_DATA_HOME')
return $XDG_DATA_HOME . "/nvim/site/spell"
elseif !(has('win32') || has('win64'))
return $HOME . "/.local/share/nvim/site/spell"
endif
for dir in split(&rtp, ',')
if filewritable(dir) == 2
return dir . "/spell"
endif
endfor
return ''
endfunction endfunction

View File

@@ -2,7 +2,7 @@
" Language: All languages, uses existing syntax highlighting rules " Language: All languages, uses existing syntax highlighting rules
" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com> " Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
" Version: 13.0 " Version: 13.0
" Last Change: 2019 Aug 08 " Last Change: 2013 May 14
" Usage: For detailed help, ":help ft-syntax-omni" " Usage: For detailed help, ":help ft-syntax-omni"
" History " History
@@ -597,7 +597,7 @@ function! s:SyntaxCSyntaxGroupItems( group_name, syntax_full )
" Remove all non-word characters " Remove all non-word characters
" let syn_list = substitute( syn_list, '\<match /\zs.\{-}\<\W\+\>.\{-}\ze\/ ', "", 'g' ) " let syn_list = substitute( syn_list, '\<match /\zs.\{-}\<\W\+\>.\{-}\ze\/ ', "", 'g' )
" let syn_list = substitute( syn_list, '\%(\<match \/[^/]\{-}\)\@<=\W\+\ze.\{-}\/ ', ' ', 'g' ) " let syn_list = substitute( syn_list, '\%(\<match \/[^/]\{-}\)\@<=\W\+\ze.\{-}\/ ', ' ', 'g' )
" Do this by using the outer substitute() call to gather all " Do this by using the outer substitue() call to gather all
" text between the match /.../ tags. " text between the match /.../ tags.
" The inner substitute() call operates on the text selected " The inner substitute() call operates on the text selected
" and replaces all non-word characters. " and replaces all non-word characters.

View File

@@ -1,6 +1,6 @@
" Vim autoload file for the tohtml plugin. " Vim autoload file for the tohtml plugin.
" Maintainer: Ben Fritz <fritzophrenic@gmail.com> " Maintainer: Ben Fritz <fritzophrenic@gmail.com>
" Last Change: 2018 Nov 11 " Last Change: 2013 Sep 03
" "
" Additional contributors: " Additional contributors:
" "
@@ -544,16 +544,12 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
" add required javascript in reverse order so we can just call append again " add required javascript in reverse order so we can just call append again
" and again without adjusting {{{ " and again without adjusting {{{
let s:uses_script = s:settings.dynamic_folds || s:settings.line_ids || !empty(s:settings.prevent_copy) " insert script closing tag
" insert script closing tag if needed
if s:uses_script
call append(style_start, [ call append(style_start, [
\ '', \ '',
\ s:settings.use_xhtml ? '//]]>' : '-->', \ s:settings.use_xhtml ? '//]]>' : '-->',
\ "</script>" \ "</script>"
\ ]) \ ])
endif
" insert script which corrects the size of small input elements in " insert script which corrects the size of small input elements in
" prevent_copy mode. See 2html.vim for details on why this is needed and how " prevent_copy mode. See 2html.vim for details on why this is needed and how
@@ -579,10 +575,9 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
\ '}' \ '}'
\ ]) \ ])
endif endif
"
" insert javascript to get IDs from line numbers, and to open a fold before " insert javascript to get IDs from line numbers, and to open a fold before
" jumping to any lines contained therein " jumping to any lines contained therein
if s:settings.line_ids
call append(style_start, [ call append(style_start, [
\ " /* Always jump to new location even if the line was hidden inside a fold, or", \ " /* Always jump to new location even if the line was hidden inside a fold, or",
\ " * we corrected the raw number to a line ID.", \ " * we corrected the raw number to a line ID.",
@@ -596,7 +591,6 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
\ " window.onhashchange = JumpToLine;", \ " window.onhashchange = JumpToLine;",
\ "}" \ "}"
\ ]) \ ])
if s:settings.dynamic_folds if s:settings.dynamic_folds
call append(style_start, [ call append(style_start, [
\ "", \ "",
@@ -613,9 +607,6 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
\ " }", \ " }",
\ ]) \ ])
endif endif
endif
if s:settings.line_ids
call append(style_start, [ call append(style_start, [
\ "", \ "",
\ "/* function to open any folds containing a jumped-to line before jumping to it */", \ "/* function to open any folds containing a jumped-to line before jumping to it */",
@@ -631,9 +622,8 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
\ " if (lineNum.indexOf('W') == -1) {", \ " if (lineNum.indexOf('W') == -1) {",
\ " lineNum = 'W1'+lineNum;", \ " lineNum = 'W1'+lineNum;",
\ " }", \ " }",
\ " var lineElem = document.getElementById(lineNum);" \ " lineElem = document.getElementById(lineNum);"
\ ]) \ ])
endif
" Insert javascript to toggle matching folds open and closed in all windows, " Insert javascript to toggle matching folds open and closed in all windows,
" if dynamic folding is active. " if dynamic folding is active.
@@ -658,13 +648,11 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{
\ ]) \ ])
endif endif
if s:uses_script
" insert script tag; javascript is always needed for the line number " insert script tag; javascript is always needed for the line number
" normalization for URL hashes " normalization for URL hashes
call append(style_start, [ call append(style_start, [
\ "<script type='text/javascript'>", \ "<script type='text/javascript'>",
\ s:settings.use_xhtml ? '//<![CDATA[' : "<!--"]) \ s:settings.use_xhtml ? '//<![CDATA[' : "<!--"])
endif
" Insert styles from all the generated html documents and additional styles " Insert styles from all the generated html documents and additional styles
" for the table-based layout of the side-by-side diff. The diff should take " for the table-based layout of the side-by-side diff. The diff should take
@@ -779,7 +767,7 @@ func! tohtml#GetUserSettings() "{{{
if user_settings.no_pre == 0 if user_settings.no_pre == 0
call tohtml#GetOption(user_settings, call tohtml#GetOption(user_settings,
\ 'expand_tabs', \ 'expand_tabs',
\ &expandtab || &ts != 8 || (exists("+vts") && &vts != '') || user_settings.number_lines || \ &expandtab || &ts != 8 || user_settings.number_lines ||
\ (user_settings.dynamic_folds && !user_settings.no_foldcolumn)) \ (user_settings.dynamic_folds && !user_settings.no_foldcolumn))
else else
let user_settings.expand_tabs = 1 let user_settings.expand_tabs = 1

View File

@@ -1,5 +1,5 @@
" Vim plugin for formatting XML " Vim plugin for formatting XML
" Last Change: Thu, 07 Dec 2018 " Last Change: Thu, 22 May 2018 21:26:55 +0100
" Version: 0.1 " Version: 0.1
" Author: Christian Brabandt <cb@256bit.org> " Author: Christian Brabandt <cb@256bit.org>
" Repository: https://github.com/chrisbra/vim-xml-ftplugin " Repository: https://github.com/chrisbra/vim-xml-ftplugin
@@ -85,11 +85,7 @@ func! s:Trim(item)
endfunc endfunc
" Check if tag is a new opening tag <tag> {{{1 " Check if tag is a new opening tag <tag> {{{1
func! s:StartTag(tag) func! s:StartTag(tag)
let is_comment = s:IsComment(a:tag) return a:tag =~? '^\s*<[^/?]'
return a:tag =~? '^\s*<[^/?]' && !is_comment
endfunc
func! s:IsComment(tag)
return a:tag =~? '<!--'
endfunc endfunc
" Remove one level of indentation {{{1 " Remove one level of indentation {{{1
func! s:DecreaseIndent() func! s:DecreaseIndent()

View File

@@ -2,7 +2,7 @@
:" information about the environment of a possible bug in Vim. :" information about the environment of a possible bug in Vim.
:" :"
:" Maintainer: Bram Moolenaar <Bram@vim.org> :" Maintainer: Bram Moolenaar <Bram@vim.org>
:" Last change: 2019 Jan 27 :" Last change: 2005 Jun 12
:" :"
:" To use inside Vim: :" To use inside Vim:
:" :so $VIMRUNTIME/bugreport.vim :" :so $VIMRUNTIME/bugreport.vim

View File

@@ -1,8 +1,8 @@
" Vim compiler file " Vim compiler file
" Compiler: Microsoft Visual Studio C# " Compiler: Microsoft Visual Studio C#
" Maintainer: Yichao Zhou (broken.zhou@gmail.com) " Maintainer: Zhou YiChao (broken.zhou@gmail.com)
" Previous Maintainer: Joseph H. Yao (hyao@sina.com) " Previous Maintainer: Joseph H. Yao (hyao@sina.com)
" Last Change: Jul 22, 2019 " Last Change: 2012 Apr 30
if exists("current_compiler") if exists("current_compiler")
finish finish
@@ -20,7 +20,7 @@ CompilerSet errorformat+=%f(%l\\,%v):\ %t%*[^:]:\ %m,
\%trror%*[^:]:\ %m, \%trror%*[^:]:\ %m,
\%tarning%*[^:]:\ %m \%tarning%*[^:]:\ %m
CompilerSet makeprg=csc\ %:S CompilerSet makeprg=csc\ %
let &cpo = s:keepcpo let &cpo = s:keepcpo
unlet s:keepcpo unlet s:keepcpo

View File

@@ -1,13 +1,13 @@
" Vim compiler file " Vim compiler file
" Compiler: Erlang " Compiler: Erlang
" Maintainer: Dmitry Vasiliev <dima at hlabs dot org> " Maintainer: Dmitry Vasiliev <dima at hlabs dot org>
" Last Change: 2019 Jul 23 " Last Change: 2012-02-13
if exists("current_compiler") if exists("current_compiler")
finish finish
endif endif
let current_compiler = "erlang" let current_compiler = "erlang"
CompilerSet makeprg=erlc\ -Wall\ %:S CompilerSet makeprg=erlc\ -Wall\ %
CompilerSet errorformat=%f:%l:\ %m CompilerSet errorformat=%f:%l:\ %m

View File

@@ -3,7 +3,6 @@
" Maintainer: Doug Kearns <dougkearns@gmail.com> " Maintainer: Doug Kearns <dougkearns@gmail.com>
" URL: https://github.com/vim-ruby/vim-ruby " URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com> " Release Coordinator: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2018 Jan 25
if exists("current_compiler") if exists("current_compiler")
finish finish
@@ -29,8 +28,8 @@ CompilerSet errorformat=
\%W%f:%l:\ warning:\ %m, \%W%f:%l:\ warning:\ %m,
\%E%f:%l:in\ %*[^:]:\ %m, \%E%f:%l:in\ %*[^:]:\ %m,
\%E%f:%l:\ %m, \%E%f:%l:\ %m,
\%-C%\t%\\d%#:%#\ %#from\ %f:%l:in\ %.%#, \%-C%\tfrom\ %f:%l:in\ %.%#,
\%-Z%\t%\\d%#:%#\ %#from\ %f:%l, \%-Z%\tfrom\ %f:%l,
\%-Z%p^, \%-Z%p^,
\%-G%.%# \%-G%.%#

View File

@@ -22,7 +22,7 @@ CompilerSet errorformat=
\%-Z%p%^%.%#, \%-Z%p%^%.%#,
\%-G%.%#, \%-G%.%#,
" Compiler call " Compiler call
CompilerSet makeprg=df\ /nologo\ /noobj\ /c\ %:S CompilerSet makeprg=df\ /nologo\ /noobj\ /c\ %
" Visual fortran defaults to printing output on stderr " Visual fortran defaults to printing output on stderr
" Adjust option shellpipe accordingly " Adjust option shellpipe accordingly

View File

@@ -2,8 +2,6 @@
" Compiler: GNU C Compiler " Compiler: GNU C Compiler
" Previous Maintainer: Nikolai Weibull <now@bitwi.se> " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2010-10-14 " Latest Revision: 2010-10-14
" changed pattern for entering/leaving directories
" by Daniel Hahler, 2019 Jul 12
" added line suggested by Anton Lindqvist 2016 Mar 31 " added line suggested by Anton Lindqvist 2016 Mar 31
if exists("current_compiler") if exists("current_compiler")
@@ -29,10 +27,10 @@ CompilerSet errorformat=
\%f:%l:\ %m, \%f:%l:\ %m,
\%f:\\(%*[^\\)]\\):\ %m, \%f:\\(%*[^\\)]\\):\ %m,
\\"%f\"\\,\ line\ %l%*\\D%c%*[^\ ]\ %m, \\"%f\"\\,\ line\ %l%*\\D%c%*[^\ ]\ %m,
\%D%*\\a[%*\\d]:\ Entering\ directory\ %*[`']%f', \%D%*\\a[%*\\d]:\ Entering\ directory\ [`']%f',
\%X%*\\a[%*\\d]:\ Leaving\ directory\ %*[`']%f', \%X%*\\a[%*\\d]:\ Leaving\ directory\ [`']%f',
\%D%*\\a:\ Entering\ directory\ %*[`']%f', \%D%*\\a:\ Entering\ directory\ [`']%f',
\%X%*\\a:\ Leaving\ directory\ %*[`']%f', \%X%*\\a:\ Leaving\ directory\ [`']%f',
\%DMaking\ %*\\a\ in\ %f \%DMaking\ %*\\a\ in\ %f
if exists('g:compiler_gcc_ignore_unmatched_lines') if exists('g:compiler_gcc_ignore_unmatched_lines')

View File

@@ -1,7 +1,7 @@
" Vim Compiler File " Vim Compiler File
" Compiler: Jikes " Compiler: Jikes
" Maintainer: Dan Sharp <dwsharp at hotmail dot com> " Maintainer: Dan Sharp <dwsharp at hotmail dot com>
" Last Change: 2019 Jul 23 " Last Change: 20 Jan 2009
" URL: http://dwsharp.users.sourceforge.net/vim/compiler " URL: http://dwsharp.users.sourceforge.net/vim/compiler
if exists("current_compiler") if exists("current_compiler")
@@ -14,5 +14,5 @@ if exists(":CompilerSet") != 2 " older Vim always used :setlocal
endif endif
" Jikes defaults to printing output on stderr " Jikes defaults to printing output on stderr
CompilerSet makeprg=jikes\ -Xstdout\ +E\ \"%:S\" CompilerSet makeprg=jikes\ -Xstdout\ +E\ \"%\"
CompilerSet errorformat=%f:%l:%v:%*\\d:%*\\d:%*\\s%m CompilerSet errorformat=%f:%l:%v:%*\\d:%*\\d:%*\\s%m

View File

@@ -1,11 +1,7 @@
" Vim Compiler File " Vim Compiler File
" Compiler: ocaml " Compiler: ocaml
" Maintainer: Markus Mottl <markus.mottl@gmail.com> " Maintainer: See ftplugin/ocaml.vim (?)
" URL: https://github.com/rgrinberg/vim-ocaml " Last Change: June 2013 by Marc Weber
" Last Change:
" 2017 Nov 26 - Improved error format (Markus Mottl)
" 2013 Aug 27 - Added a new OCaml error format (Markus Mottl)
" 2013 Jun 30 - Initial version (Marc Weber)
" "
" Marc Weber's comments: " Marc Weber's comments:
" Setting makeprg doesn't make sense, because there is ocamlc, ocamlopt, " Setting makeprg doesn't make sense, because there is ocamlc, ocamlopt,
@@ -21,6 +17,7 @@
" "
" So having it here makes people opt-in " So having it here makes people opt-in
if exists("current_compiler") if exists("current_compiler")
finish finish
endif endif
@@ -31,7 +28,6 @@ set cpo&vim
CompilerSet errorformat = CompilerSet errorformat =
\%EFile\ \"%f\"\\,\ line\ %l\\,\ characters\ %c-%*\\d:, \%EFile\ \"%f\"\\,\ line\ %l\\,\ characters\ %c-%*\\d:,
\%EFile\ \"%f\"\\,\ line\ %l\\,\ characters\ %c-%*\\d\ %.%#,
\%EFile\ \"%f\"\\,\ line\ %l\\,\ character\ %c:%m, \%EFile\ \"%f\"\\,\ line\ %l\\,\ character\ %c:%m,
\%+EReference\ to\ unbound\ regexp\ name\ %m, \%+EReference\ to\ unbound\ regexp\ name\ %m,
\%Eocamlyacc:\ e\ -\ line\ %l\ of\ \"%f\"\\,\ %m, \%Eocamlyacc:\ e\ -\ line\ %l\ of\ \"%f\"\\,\ %m,
@@ -42,12 +38,6 @@ CompilerSet errorformat =
\%X%*\\a[%*\\d]:\ Leaving\ directory\ `%f', \%X%*\\a[%*\\d]:\ Leaving\ directory\ `%f',
\%D%*\\a:\ Entering\ directory\ `%f', \%D%*\\a:\ Entering\ directory\ `%f',
\%X%*\\a:\ Leaving\ directory\ `%f', \%X%*\\a:\ Leaving\ directory\ `%f',
\%D%*\\a[%*\\d]:\ Entering\ directory\ '%f',
\%X%*\\a[%*\\d]:\ Leaving\ directory\ '%f',
\%D%*\\a:\ Entering\ directory\ '%f',
\%X%*\\a:\ Leaving\ directory\ '%f',
\%DEntering\ directory\ '%f',
\%XLeaving\ directory\ '%f',
\%DMaking\ %*\\a\ in\ %f \%DMaking\ %*\\a\ in\ %f
let &cpo = s:cpo_save let &cpo = s:cpo_save

View File

@@ -1,7 +1,7 @@
" Vim compiler file " Vim compiler file
" Compiler: onsgmls " Compiler: onsgmls
" Maintainer: Robert Rowsome <rowsome@wam.umd.edu> " Maintainer: Robert Rowsome <rowsome@wam.umd.edu>
" Last Change: 2019 Jul 23 " Last Change: 2004 Mar 27
if exists("current_compiler") if exists("current_compiler")
finish finish
@@ -15,7 +15,7 @@ endif
let s:cpo_save = &cpo let s:cpo_save = &cpo
set cpo-=C set cpo-=C
CompilerSet makeprg=onsgmls\ -s\ %:S CompilerSet makeprg=onsgmls\ -s\ %
CompilerSet errorformat=onsgmls:%f:%l:%c:%t:%m, CompilerSet errorformat=onsgmls:%f:%l:%c:%t:%m,
\onsgmls:%f:%l:%c:%m \onsgmls:%f:%l:%c:%m

View File

@@ -1,7 +1,7 @@
" Vim Compiler File " Vim Compiler File
" Compiler: Perl syntax checks (perl -Wc) " Compiler: Perl syntax checks (perl -Wc)
" Maintainer: Christian J. Robinson <heptite@gmail.com> " Maintainer: Christian J. Robinson <heptite@gmail.com>
" Last Change: 2019 Jul 22 " Last Change: 2006 Aug 13
if exists("current_compiler") if exists("current_compiler")
finish finish
@@ -27,7 +27,7 @@ else
let s:taintopt = '' let s:taintopt = ''
endif endif
exe 'CompilerSet makeprg=perl\ -' . s:warnopt . s:taintopt . 'c\ %:S' exe 'CompilerSet makeprg=perl\ -' . s:warnopt . s:taintopt . 'c\ %'
CompilerSet errorformat= CompilerSet errorformat=
\%-G%.%#had\ compilation\ errors., \%-G%.%#had\ compilation\ errors.,

View File

@@ -3,7 +3,6 @@
" Maintainer: Tim Pope <vimNOSPAM@tpope.org> " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" URL: https://github.com/vim-ruby/vim-ruby " URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com> " Release Coordinator: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2018 Mar 02
if exists("current_compiler") if exists("current_compiler")
finish finish
@@ -21,12 +20,12 @@ CompilerSet makeprg=rake
CompilerSet errorformat= CompilerSet errorformat=
\%D(in\ %f), \%D(in\ %f),
\%\\s%#%\\d%#:%#\ %#from\ %f:%l:%m, \%\\s%#from\ %f:%l:%m,
\%\\s%#%\\d%#:%#\ %#from\ %f:%l:, \%\\s%#from\ %f:%l:,
\%\\s%##\ %f:%l:%m%\\&%.%#%\\D:%\\d%\\+:%.%#, \%\\s%##\ %f:%l:%m,
\%\\s%##\ %f:%l%\\&%.%#%\\D:%\\d%\\+, \%\\s%##\ %f:%l,
\%\\s%#[%f:%l:\ %#%m%\\&%.%#%\\D:%\\d%\\+:%.%#, \%\\s%#[%f:%l:\ %#%m,
\%\\s%#%f:%l:\ %#%m%\\&%.%#%\\D:%\\d%\\+:%.%#, \%\\s%#%f:%l:\ %#%m,
\%\\s%#%f:%l:, \%\\s%#%f:%l:,
\%m\ [%f:%l]:, \%m\ [%f:%l]:,
\%+Erake\ aborted!, \%+Erake\ aborted!,

View File

@@ -3,7 +3,6 @@
" Maintainer: Tim Pope <vimNOSPAM@tpope.org> " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" URL: https://github.com/vim-ruby/vim-ruby " URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com> " Release Coordinator: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2018 Aug 07
if exists("current_compiler") if exists("current_compiler")
finish finish
@@ -24,8 +23,7 @@ CompilerSet errorformat=
\%E%.%#:in\ `load':\ %f:%l:%m, \%E%.%#:in\ `load':\ %f:%l:%m,
\%E%f:%l:in\ `%*[^']':\ %m, \%E%f:%l:in\ `%*[^']':\ %m,
\%-Z\ \ \ \ \ %\\+\#\ %f:%l:%.%#, \%-Z\ \ \ \ \ %\\+\#\ %f:%l:%.%#,
\%E\ \ \ \ \ Failure/Error:\ %m, \%E\ \ %\\d%\\+)%.%#,
\%E\ \ \ \ \ Failure/Error:,
\%C\ \ \ \ \ %m, \%C\ \ \ \ \ %m,
\%C%\\s%#, \%C%\\s%#,
\%-G%.%# \%-G%.%#

View File

@@ -4,7 +4,7 @@
" Maintainer: Tim Pope <vimNOSPAM@tpope.org> " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" URL: https://github.com/vim-ruby/vim-ruby " URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com> " Release Coordinator: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2019 Jan 06 " ----------------------------------------------------------------------------
if exists("current_compiler") if exists("current_compiler")
finish finish
@@ -21,21 +21,21 @@ set cpo-=C
" default settings runs script normally " default settings runs script normally
" add '-c' switch to run syntax check only: " add '-c' switch to run syntax check only:
" "
" CompilerSet makeprg=ruby\ -c " CompilerSet makeprg=ruby\ -wc\ $*
" "
" or add '-c' at :make command line: " or add '-c' at :make command line:
" "
" :make -c %<CR> " :make -c %<CR>
" "
CompilerSet makeprg=ruby CompilerSet makeprg=ruby\ -w\ $*
CompilerSet errorformat= CompilerSet errorformat=
\%+E%f:%l:\ parse\ error, \%+E%f:%l:\ parse\ error,
\%W%f:%l:\ warning:\ %m, \%W%f:%l:\ warning:\ %m,
\%E%f:%l:in\ %*[^:]:\ %m, \%E%f:%l:in\ %*[^:]:\ %m,
\%E%f:%l:\ %m, \%E%f:%l:\ %m,
\%-C%\t%\\d%#:%#\ %#from\ %f:%l:in\ %.%#, \%-C%\tfrom\ %f:%l:in\ %.%#,
\%-Z%\t%\\d%#:%#\ %#from\ %f:%l, \%-Z%\tfrom\ %f:%l,
\%-Z%p^, \%-Z%p^,
\%-G%.%# \%-G%.%#

View File

@@ -3,7 +3,6 @@
" Maintainer: Doug Kearns <dougkearns@gmail.com> " Maintainer: Doug Kearns <dougkearns@gmail.com>
" URL: https://github.com/vim-ruby/vim-ruby " URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com> " Release Coordinator: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2014 Mar 23
if exists("current_compiler") if exists("current_compiler")
finish finish

View File

@@ -19,7 +19,7 @@ endif
if exists("g:rustc_makeprg_no_percent") && g:rustc_makeprg_no_percent != 0 if exists("g:rustc_makeprg_no_percent") && g:rustc_makeprg_no_percent != 0
CompilerSet makeprg=rustc CompilerSet makeprg=rustc
else else
CompilerSet makeprg=rustc\ \%:S CompilerSet makeprg=rustc\ \%
endif endif
" Old errorformat (before nightly 2016/08/10) " Old errorformat (before nightly 2016/08/10)

View File

@@ -2,7 +2,7 @@
" Compiler: splint/lclint (C source code checker) " Compiler: splint/lclint (C source code checker)
" Maintainer: Ralf Wildenhues <Ralf.Wildenhues@gmx.de> " Maintainer: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
" Splint Home: http://www.splint.org/ " Splint Home: http://www.splint.org/
" Last Change: 2019 Jul 23 " Last Change: 2005 Apr 21
" $Revision: 1.3 $ " $Revision: 1.3 $
if exists("current_compiler") if exists("current_compiler")
@@ -19,7 +19,7 @@ set cpo-=C
" adapt this if you want to check more than one file at a time. " adapt this if you want to check more than one file at a time.
" put command line options in .splintrc or ~/.splintrc " put command line options in .splintrc or ~/.splintrc
CompilerSet makeprg=splint\ %:S CompilerSet makeprg=splint\ %
" Note: when using the new array bounds checking flags: Each warning " Note: when using the new array bounds checking flags: Each warning
" usually has several lines and several references to source code mostly " usually has several lines and several references to source code mostly

View File

@@ -1,7 +1,7 @@
" Vim Compiler File " Vim Compiler File
" Compiler: xmlwf " Compiler: xmlwf
" Maintainer: Robert Rowsome <rowsome@wam.umd.edu> " Maintainer: Robert Rowsome <rowsome@wam.umd.edu>
" Last Change: 2019 Jul 23 " Last Change: 2004 Mar 27
if exists("current_compiler") if exists("current_compiler")
finish finish
@@ -15,7 +15,7 @@ if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args> command -nargs=* CompilerSet setlocal <args>
endif endif
CompilerSet makeprg=xmlwf\ %:S CompilerSet makeprg=xmlwf\ %
CompilerSet errorformat=%f:%l%c:%m CompilerSet errorformat=%f:%l%c:%m

File diff suppressed because it is too large Load Diff

View File

@@ -40,18 +40,15 @@ effects. Be careful not to destroy your text.
2. Defining autocommands *autocmd-define* 2. Defining autocommands *autocmd-define*
*:au* *:autocmd* *:au* *:autocmd*
:au[tocmd] [group] {event} {pat} [++once] [++nested] {cmd} :au[tocmd] [group] {event} {pat} [nested] {cmd}
Add {cmd} to the list of commands that Vim will Add {cmd} to the list of commands that Vim will
execute automatically on {event} for a file matching execute automatically on {event} for a file matching
{pat} |autocmd-pattern|. {pat} |autocmd-patterns|.
Note: A quote character is seen as argument to the Note: A quote character is seen as argument to the
:autocmd and won't start a comment. :autocmd and won't start a comment.
Nvim always adds {cmd} after existing autocommands so Vim always adds the {cmd} after existing autocommands,
they execute in the order in which they were defined. so that the autocommands execute in the order in which
See |autocmd-nested| for [++nested]. they were given. See |autocmd-nested| for [nested].
*autocmd-once*
If [++once] is supplied the command is executed once,
then removed ("one shot").
The special pattern <buffer> or <buffer=N> defines a buffer-local autocommand. The special pattern <buffer> or <buffer=N> defines a buffer-local autocommand.
See |autocmd-buflocal|. See |autocmd-buflocal|.
@@ -119,11 +116,10 @@ prompt. When one command outputs two messages this can happen anyway.
============================================================================== ==============================================================================
3. Removing autocommands *autocmd-remove* 3. Removing autocommands *autocmd-remove*
:au[tocmd]! [group] {event} {pat} [++once] [++nested] {cmd} :au[tocmd]! [group] {event} {pat} [nested] {cmd}
Remove all autocommands associated with {event} and Remove all autocommands associated with {event} and
{pat}, and add the command {cmd}. {pat}, and add the command {cmd}. See
See |autocmd-once| for [++once]. |autocmd-nested| for [nested].
See |autocmd-nested| for [++nested].
:au[tocmd]! [group] {event} {pat} :au[tocmd]! [group] {event} {pat}
Remove all autocommands associated with {event} and Remove all autocommands associated with {event} and
@@ -268,10 +264,8 @@ Name triggered by ~
|BufNew| just after creating a new buffer |BufNew| just after creating a new buffer
|SwapExists| detected an existing swap file |SwapExists| detected an existing swap file
|TermOpen| starting a terminal job |TermOpen| when a terminal job starts
|TermEnter| entering Terminal-mode |TermClose| when a terminal job ends
|TermLeave| leaving Terminal-mode
|TermClose| stopping a terminal job
|ChanOpen| after a channel opened |ChanOpen| after a channel opened
|ChanInfo| after a channel has its state changed |ChanInfo| after a channel has its state changed
@@ -282,8 +276,8 @@ Name triggered by ~
Startup and exit Startup and exit
|VimEnter| after doing all the startup stuff |VimEnter| after doing all the startup stuff
|UIEnter| after a UI attaches |GUIEnter| after starting the GUI successfully
|UILeave| after a UI detaches |GUIFailed| after starting the GUI failed
|TermResponse| after the terminal response to t_RV is received |TermResponse| after the terminal response to t_RV is received
|QuitPre| when using `:quit`, before deciding whether to exit |QuitPre| when using `:quit`, before deciding whether to exit
|ExitPre| when using a command that may make Vim exit |ExitPre| when using a command that may make Vim exit
@@ -307,7 +301,6 @@ Name triggered by ~
|FuncUndefined| a user function is used but it isn't defined |FuncUndefined| a user function is used but it isn't defined
|SpellFileMissing| a spell file is used but it can't be found |SpellFileMissing| a spell file is used but it can't be found
|SourcePre| before sourcing a Vim script |SourcePre| before sourcing a Vim script
|SourcePost| after sourcing a Vim script
|SourceCmd| before sourcing a Vim script |Cmd-event| |SourceCmd| before sourcing a Vim script |Cmd-event|
|VimResized| after the Vim window size changed |VimResized| after the Vim window size changed
@@ -357,12 +350,9 @@ Name triggered by ~
|SessionLoadPost| after loading a session file |SessionLoadPost| after loading a session file
|MenuPopup| just before showing the popup menu |MenuPopup| just before showing the popup menu
|CompleteChanged| after popup menu changed, not fired on popup menu hide
|CompleteDone| after Insert mode completion is done |CompleteDone| after Insert mode completion is done
|User| to be used in combination with ":doautocmd" |User| to be used in combination with ":doautocmd"
|Signal| after Nvim receives a signal
The alphabetical list of autocommand events: *autocmd-events-abc* The alphabetical list of autocommand events: *autocmd-events-abc*
@@ -400,8 +390,8 @@ BufFilePost After changing the name of the current buffer
BufFilePre Before changing the name of the current buffer BufFilePre Before changing the name of the current buffer
with the ":file" or ":saveas" command. with the ":file" or ":saveas" command.
*BufHidden* *BufHidden*
BufHidden Just before a buffer becomes hidden. That is, BufHidden Just after a buffer has become hidden. That
when there are no longer windows that show is, when there are no longer windows that show
the buffer, but the buffer is not unloaded or the buffer, but the buffer is not unloaded or
deleted. Not used for ":qa" or ":q" when deleted. Not used for ":qa" or ":q" when
exiting Vim. exiting Vim.
@@ -592,23 +582,6 @@ CompleteDone After Insert mode completion is done. Either
The |v:completed_item| variable contains the The |v:completed_item| variable contains the
completed item. completed item.
CompleteChanged *CompleteChanged*
After each time the Insert mode completion
menu changed. Not fired on popup menu hide,
use |CompleteDone| for that. Never triggered
recursively.
Sets these |v:event| keys:
completed_item See |complete-items|.
height nr of items visible
width screen cells
row top screen row
col leftmost screen column
size total nr of items
scrollbar TRUE if visible
It is not allowed to change the text |textlock|.
*CursorHold* *CursorHold*
CursorHold When the user doesn't press a key for the time CursorHold When the user doesn't press a key for the time
specified with 'updatetime'. Not re-triggered specified with 'updatetime'. Not re-triggered
@@ -644,13 +617,11 @@ CursorHoldI Just like CursorHold, but in Insert mode.
*CursorMoved* *CursorMoved*
CursorMoved After the cursor was moved in Normal or Visual CursorMoved After the cursor was moved in Normal or Visual
mode or to another window. Also when the text mode. Also when the text of the cursor line
of the cursor line has been changed, e.g. with has been changed, e.g., with "x", "rx" or "p".
"x", "rx" or "p".
Not triggered when there is typeahead or when Not triggered when there is typeahead or when
an operator is pending. an operator is pending.
For an example see |match-parens|. For an example see |match-parens|.
Note: Cannot be skipped with `:noautocmd`.
Careful: This is triggered very often, don't Careful: This is triggered very often, don't
do anything that the user does not expect or do anything that the user does not expect or
that is slow. that is slow.
@@ -780,14 +751,13 @@ FilterReadPre Before reading a file from a filter command.
Not triggered when 'shelltemp' is off. Not triggered when 'shelltemp' is off.
*FilterWritePost* *FilterWritePost*
FilterWritePost After writing a file for a filter command or FilterWritePost After writing a file for a filter command or
making a diff with an external diff (see making a diff.
DiffUpdated for internal diff).
Vim checks the pattern against the name of Vim checks the pattern against the name of
the current buffer as with FilterWritePre. the current buffer as with FilterWritePre.
Not triggered when 'shelltemp' is off. Not triggered when 'shelltemp' is off.
*FilterWritePre* *FilterWritePre*
FilterWritePre Before writing a file for a filter command or FilterWritePre Before writing a file for a filter command or
making a diff with an external diff. making a diff.
Vim checks the pattern against the name of Vim checks the pattern against the name of
the current buffer, not the name of the the current buffer, not the name of the
temporary file that is the output of the temporary file that is the output of the
@@ -807,17 +777,19 @@ FuncUndefined When a user function is used but it isn't
NOTE: When writing Vim scripts a better NOTE: When writing Vim scripts a better
alternative is to use an autoloaded function. alternative is to use an autoloaded function.
See |autoload-functions|. See |autoload-functions|.
*UIEnter* *GUIEnter*
UIEnter After a UI connects via |nvim_ui_attach()|, GUIEnter After starting the GUI successfully, and after
after VimEnter. Can be used for GUI-specific opening the window. It is triggered before
configuration. VimEnter when using gvim. Can be used to
Sets these |v:event| keys: position the window from a gvimrc file: >
chan :autocmd GUIEnter * winpos 100 50
*UILeave* < *GUIFailed*
UILeave After a UI disconnects from Nvim. GUIFailed After starting the GUI failed. Vim may
Sets these |v:event| keys: continue to run in the terminal, if possible
chan (only on Unix and alikes, when connecting the
*InsertChange* X server fails). You may want to quit Vim: >
:autocmd GUIFailed * qall
< *InsertChange*
InsertChange When typing <Insert> while in Insert or InsertChange When typing <Insert> while in Insert or
Replace mode. The |v:insertmode| variable Replace mode. The |v:insertmode| variable
indicates the new mode. indicates the new mode.
@@ -831,25 +803,20 @@ InsertCharPre When a character is typed in Insert mode,
a different character. When |v:char| is set a different character. When |v:char| is set
to more than one character this text is to more than one character this text is
inserted literally. inserted literally.
It is not allowed to change the text |textlock|.
Cannot change the text. |textlock| The event is not triggered when 'paste' is
Not triggered when 'paste' is set. set.
*TextYankPost* *TextYankPost*
TextYankPost Just after a |yank| or |deleting| command, but not TextYankPost Just after a |yank| or |deleting| command, but not
if the black hole register |quote_| is used nor if the black hole register |quote_| is used nor
for |setreg()|. Pattern must be *. for |setreg()|. Pattern must be *.
Sets these |v:event| keys: Sets these |v:event| keys:
inclusive
operator operator
regcontents regcontents
regname regname
regtype regtype
The `inclusive` flag combined with the |'[|
and |']| marks can be used to calculate the
precise region of the operation.
Recursion is ignored. Recursion is ignored.
Cannot change the text. |textlock| It is not allowed to change the text |textlock|.
*InsertEnter* *InsertEnter*
InsertEnter Just before starting Insert mode. Also for InsertEnter Just before starting Insert mode. Also for
Replace mode and Virtual Replace mode. The Replace mode and Virtual Replace mode. The
@@ -875,48 +842,27 @@ MenuPopup Just before showing the popup menu (under the
i Insert i Insert
c Command line c Command line
*OptionSet* *OptionSet*
OptionSet After setting an option (except during OptionSet After setting an option. The pattern is
|startup|). The |autocmd-pattern| is matched matched against the long option name.
against the long option name. |<amatch>| The |v:option_old| variable indicates the
old option value, |v:option_new| variable
indicates the newly set value, the
|v:option_type| variable indicates whether
it's global or local scoped and |<amatch>|
indicates what option has been set. indicates what option has been set.
|v:option_type| indicates whether it's global
or local scoped.
|v:option_command| indicates what type of
set/let command was used (follow the tag to
see the table).
|v:option_new| indicates the newly set value.
|v:option_oldlocal| has the old local value.
|v:option_oldglobal| has the old global value.
|v:option_old| indicates the old option value.
|v:option_oldlocal| is only set when |:set|
or |:setlocal| or a |modeline| was used to set
the option. Similarly |v:option_oldglobal| is
only set when |:set| or |:setglobal| was used.
Note that when setting a |global-local| string
option with |:set|, then |v:option_old| is the
old global value. However, for all other kinds
of options (local string options, global-local
number options, ...) it is the old local
value.
OptionSet is not triggered on startup and for
the 'key' option for obvious reasons.
Usage example: Check for the existence of the Usage example: Check for the existence of the
directory in the 'backupdir' and 'undodir' directory in the 'backupdir' and 'undodir'
options, create the directory if it doesn't options, create the directory if it doesn't
exist yet. exist yet.
Note: Do not reset the same option during this Note: It's a bad idea to reset an option
autocommand, that may break plugins. You can during this autocommand, this may break a
always use |:noautocmd| to prevent triggering plugin. You can always use `:noa` to prevent
OptionSet. triggering this autocommand.
Recursion is ignored, thus |:set| in the When using |:set| in the autocommand the event
autocommand does not trigger OptionSet again. is not triggered again.
*QuickFixCmdPre* *QuickFixCmdPre*
QuickFixCmdPre Before a quickfix command is run (|:make|, QuickFixCmdPre Before a quickfix command is run (|:make|,
@@ -968,24 +914,13 @@ ShellCmdPost After executing a shell command with |:!cmd|,
any changed files. any changed files.
For non-blocking shell commands, see For non-blocking shell commands, see
|job-control|. |job-control|.
*Signal* *ShellFilterPost*
Signal After Nvim receives a signal. The pattern is
matched against the signal name. Only
"SIGUSR1" is supported. Example: >
autocmd Signal SIGUSR1 call some#func()
< *ShellFilterPost*
ShellFilterPost After executing a shell command with ShellFilterPost After executing a shell command with
":{range}!cmd", ":w !cmd" or ":r !cmd". ":{range}!cmd", ":w !cmd" or ":r !cmd".
Can be used to check for any changed files. Can be used to check for any changed files.
*SourcePre* *SourcePre*
SourcePre Before sourcing a Vim script. |:source| SourcePre Before sourcing a Vim script. |:source|
<afile> is the name of the file being sourced. <afile> is the name of the file being sourced.
*SourcePost*
SourcePost After sourcing a Vim script. |:source|
<afile> is the name of the file being sourced.
Not triggered when sourcing was interrupted.
Also triggered after a SourceCmd autocommand
was triggered.
*SourceCmd* *SourceCmd*
SourceCmd When sourcing a Vim script. |:source| SourceCmd When sourcing a Vim script. |:source|
<afile> is the name of the file being sourced. <afile> is the name of the file being sourced.
@@ -1027,6 +962,7 @@ SwapExists Detected an existing swap file when starting
It is not allowed to change to another buffer, It is not allowed to change to another buffer,
change a buffer name or change directory change a buffer name or change directory
here. here.
{only available with the +eval feature}
*Syntax* *Syntax*
Syntax When the 'syntax' option has been set. The Syntax When the 'syntax' option has been set. The
pattern is matched against the syntax name. pattern is matched against the syntax name.
@@ -1051,17 +987,11 @@ TabNewEntered After entering a new tab page. |tab-page|
*TabClosed* *TabClosed*
TabClosed After closing a tab page. <afile> can be used TabClosed After closing a tab page. <afile> can be used
for the tab page number. for the tab page number.
*TermClose*
TermClose When a |terminal| job ends.
*TermOpen* *TermOpen*
TermOpen When a |terminal| job is starting. Can be TermOpen When a |terminal| job is starting. Can be
used to configure the terminal buffer. used to configure the terminal buffer.
*TermEnter*
TermEnter After entering |Terminal-mode|.
After TermOpen.
*TermLeave*
TermLeave After leaving |Terminal-mode|.
After TermClose.
*TermClose*
TermClose When a |terminal| job ends.
*TermResponse* *TermResponse*
TermResponse After the response to t_RV is received from TermResponse After the response to t_RV is received from
the terminal. The value of |v:termresponse| the terminal. The value of |v:termresponse|
@@ -1072,13 +1002,10 @@ TermResponse After the response to t_RV is received from
anything else that takes time is involved). anything else that takes time is involved).
*TextChanged* *TextChanged*
TextChanged After a change was made to the text in the TextChanged After a change was made to the text in the
current buffer in Normal mode. That is after current buffer in Normal mode. That is when
|b:changedtick| has changed (also when that |b:changedtick| has changed.
happened before the TextChanged autocommand
was defined).
Not triggered when there is typeahead or when Not triggered when there is typeahead or when
an operator is pending. an operator is pending.
Note: Cannot be skipped with `:noautocmd`.
Careful: This is triggered very often, don't Careful: This is triggered very often, don't
do anything that the user does not expect or do anything that the user does not expect or
that is slow. that is slow.
@@ -1093,12 +1020,14 @@ TextChangedP After a change was made to the text in the
popup menu is visible. Otherwise the same as popup menu is visible. Otherwise the same as
TextChanged. TextChanged.
*User* *User*
User Not executed automatically. Use |:doautocmd| User Never executed automatically. To be used for
to trigger this, typically for "custom events" autocommands that are only executed with
in a plugin. Example: > ":doautocmd".
:autocmd User MyPlugin echom 'got MyPlugin event' Note that when `:doautocmd User MyEvent` is
:doautocmd User MyPlugin used while there are no matching autocommands,
< *UserGettingBored* you will get an error. If you don't want
that, define a dummy autocommand yourself.
*UserGettingBored*
UserGettingBored When the user presses the same key 42 times. UserGettingBored When the user presses the same key 42 times.
Just kidding! :-) Just kidding! :-)
*VimEnter* *VimEnter*
@@ -1163,7 +1092,7 @@ WinNew When a new window was created. Not done for
Before a WinEnter event. Before a WinEnter event.
============================================================================== ==============================================================================
6. Patterns *autocmd-pattern* *{pat}* 6. Patterns *autocmd-patterns* *{pat}*
The {pat} argument can be a comma separated list. This works as if the The {pat} argument can be a comma separated list. This works as if the
command was given with each pattern separately. Thus this command: > command was given with each pattern separately. Thus this command: >
@@ -1376,7 +1305,7 @@ have changed autocommands, or when Vim has executed the wrong autocommands
Note that the 'eventignore' option applies here too. Events listed in this Note that the 'eventignore' option applies here too. Events listed in this
option will not cause any commands to be executed. option will not cause any commands to be executed.
*:do* *:doau* *:doaut* *:doautocmd* *E217* *:do* *:doau* *:doautocmd* *E217*
:do[autocmd] [<nomodeline>] [group] {event} [fname] :do[autocmd] [<nomodeline>] [group] {event} [fname]
Apply the autocommands matching [fname] (default: Apply the autocommands matching [fname] (default:
current file name) for {event} to the current buffer. current file name) for {event} to the current buffer.
@@ -1388,22 +1317,24 @@ option will not cause any commands to be executed.
another extension. Example: > another extension. Example: >
:au BufEnter *.cpp so ~/.config/nvim/init_cpp.vim :au BufEnter *.cpp so ~/.config/nvim/init_cpp.vim
:au BufEnter *.cpp doau BufEnter x.c :au BufEnter *.cpp doau BufEnter x.c
< Be careful to avoid endless loops. |autocmd-nested| < Be careful to avoid endless loops. See
|autocmd-nested|.
When the [group] argument is not given, Vim executes When the [group] argument is not given, Vim executes
the autocommands for all groups. When the [group] the autocommands for all groups. When the [group]
argument is included, Vim executes only the matching argument is included, Vim executes only the matching
autocommands for that group. Undefined group is an autocommands for that group. Note: if you use an
error. undefined group name, Vim gives you an error message.
*<nomodeline>* *<nomodeline>*
After applying the autocommands the modelines are After applying the autocommands the modelines are
processed, so that their settings overrule the processed, so that their settings overrule the
settings from autocommands when editing a file. This settings from autocommands, like what happens when
is skipped if <nomodeline> is specified. You probably editing a file. This is skipped when the <nomodeline>
want to use <nomodeline> for events not used when argument is present. You probably want to use
loading a buffer, such as |User|. <nomodeline> for events that are not used when loading
Modelines are also skipped when no matching a buffer, such as |User|.
autocommands were executed. Processing modelines is also skipped when no
matching autocommands were executed.
*:doautoa* *:doautoall* *:doautoa* *:doautoall*
:doautoa[ll] [<nomodeline>] [group] {event} [fname] :doautoa[ll] [<nomodeline>] [group] {event} [fname]
@@ -1500,11 +1431,11 @@ If you want the buffer to be unmodified after changing it, reset the
instead of ":q!". instead of ":q!".
*autocmd-nested* *E218* *autocmd-nested* *E218*
By default, autocommands do not nest. For example, if you use ":e" or ":w" in By default, autocommands do not nest. If you use ":e" or ":w" in an
an autocommand, Vim does not execute the BufRead and BufWrite autocommands for autocommand, Vim does not execute the BufRead and BufWrite autocommands for
those commands. If you do want this, use the "++nested" flag for those those commands. If you do want this, use the "nested" flag for those commands
commands in which you want nesting. For example: > in which you want nesting. For example: >
:autocmd FileChangedShell *.c ++nested e! :autocmd FileChangedShell *.c nested e!
The nesting is limited to 10 levels to get out of recursive loops. The nesting is limited to 10 levels to get out of recursive loops.
It's possible to use the ":au" command in an autocommand. This can be a It's possible to use the ":au" command in an autocommand. This can be a
@@ -1647,8 +1578,5 @@ following command. Example: >
This will write the file without triggering the autocommands defined by the This will write the file without triggering the autocommands defined by the
gzip plugin. gzip plugin.
Note that some autocommands are not triggered right away, but only later.
This specifically applies to |CursorMoved| and |TextChanged|.
vim:tw=78:ts=8:noet:ft=help:norl: vim:tw=78:ts=8:noet:ft=help:norl:

View File

@@ -162,6 +162,8 @@ gR Enter Virtual Replace mode: Each character you type
<Tab> may replace several characters at once. <Tab> may replace several characters at once.
Repeat the entered text [count]-1 times. See Repeat the entered text [count]-1 times. See
|Virtual-Replace-mode| for more details. |Virtual-Replace-mode| for more details.
{not available when compiled without the |+vreplace|
feature}
*c* *c*
["x]c{motion} Delete {motion} text [into register x] and start ["x]c{motion} Delete {motion} text [into register x] and start
@@ -280,11 +282,14 @@ gr{char} Replace the virtual characters under the cursor with
space. See |gR| and |Virtual-Replace-mode| for more space. See |gR| and |Virtual-Replace-mode| for more
details. As with |r| a count may be given. details. As with |r| a count may be given.
{char} can be entered like with |r|. {char} can be entered like with |r|.
{not available when compiled without the |+vreplace|
feature}
*digraph-arg* *digraph-arg*
The argument for Normal mode commands like |r| and |t| is a single character. The argument for Normal mode commands like |r| and |t| is a single character.
When 'cpo' doesn't contain the 'D' flag, this character can also be entered When 'cpo' doesn't contain the 'D' flag, this character can also be entered
like |digraphs|. First type CTRL-K and then the two digraph characters. like |digraphs|. First type CTRL-K and then the two digraph characters.
{not available when compiled without the |+digraphs| feature}
*case* *case*
The following commands change the case of letters. The currently active The following commands change the case of letters. The currently active
@@ -595,11 +600,11 @@ Directory for temporary files is created in the first suitable directory of:
For the {pattern} see |pattern|. For the {pattern} see |pattern|.
{string} can be a literal string, or something {string} can be a literal string, or something
special; see |sub-replace-special|. special; see |sub-replace-special|.
*E939*
When [range] and [count] are omitted, replace in the When [range] and [count] are omitted, replace in the
current line only. When [count] is given, replace in current line only. When [count] is given, replace in
[count] lines, starting with the last line in [range]. [count] lines, starting with the last line in [range].
When [range] is omitted start in the current line. When [range] is omitted start in the current line.
*E939*
[count] must be a positive number. Also see [count] must be a positive number. Also see
|cmdline-ranges|. |cmdline-ranges|.
@@ -795,7 +800,7 @@ the |substitute()| function with the following exceptions:
- magic is always set without regard to 'magic'. - magic is always set without regard to 'magic'.
- A ~ inserts a tilde literally. - A ~ inserts a tilde literally.
- <CR> and \r inserts a carriage-return (CTRL-M). - <CR> and \r inserts a carriage-return (CTRL-M).
- \<CR> does not have a special meaning. It's just one of \x. - \<CR> does not have a special meaning. it's just one of \x.
Examples: > Examples: >
:s/a\|b/xxx\0xxx/g modifies "a b" to "xxxaxxx xxxbxxx" :s/a\|b/xxx\0xxx/g modifies "a b" to "xxxaxxx xxxbxxx"
@@ -881,9 +886,9 @@ When the result is a |List| then the items are joined with separating line
breaks. Thus each item becomes a line, except that they can contain line breaks. Thus each item becomes a line, except that they can contain line
breaks themselves. breaks themselves.
The |submatch()| function can be used to obtain matched text. The whole The whole matched text can be accessed with "submatch(0)". The text matched
matched text can be accessed with "submatch(0)". The text matched with the with the first pair of () with "submatch(1)". Likewise for further
first pair of () with "submatch(1)". Likewise for further sub-matches in (). sub-matches in ().
Be careful: The separation character must not appear in the expression! Be careful: The separation character must not appear in the expression!
Consider using a character like "@" or ":". There is no problem if the result Consider using a character like "@" or ":". There is no problem if the result
@@ -934,6 +939,8 @@ This replaces each 'E' character with a euro sign. Read more in |<Char->|.
this (that's a good habit anyway). this (that's a good habit anyway).
`:retab!` may also change a sequence of spaces by `:retab!` may also change a sequence of spaces by
<Tab> characters, which can mess up a printf(). <Tab> characters, which can mess up a printf().
Not available when |+ex_extra| feature was disabled at
compile time.
*retab-example* *retab-example*
Example for using autocommands and ":retab" to edit a file which is stored Example for using autocommands and ":retab" to edit a file which is stored
@@ -1132,9 +1139,9 @@ There are ten types of registers: *registers* *E354*
2. 10 numbered registers "0 to "9 2. 10 numbered registers "0 to "9
3. The small delete register "- 3. The small delete register "-
4. 26 named registers "a to "z or "A to "Z 4. 26 named registers "a to "z or "A to "Z
5. Three read-only registers ":, "., "% 5. three read-only registers ":, "., "%
6. Alternate buffer register "# 6. alternate buffer register "#
7. The expression register "= 7. the expression register "=
8. The selection registers "* and "+ 8. The selection registers "* and "+
9. The black hole register "_ 9. The black hole register "_
10. Last search pattern register "/ 10. Last search pattern register "/
@@ -1284,15 +1291,21 @@ The next three commands always work on whole lines.
:[range]ce[nter] [width] *:ce* *:center* :[range]ce[nter] [width] *:ce* *:center*
Center lines in [range] between [width] columns Center lines in [range] between [width] columns
(default 'textwidth' or 80 when 'textwidth' is 0). (default 'textwidth' or 80 when 'textwidth' is 0).
Not available when |+ex_extra| feature was disabled at
compile time.
:[range]ri[ght] [width] *:ri* *:right* :[range]ri[ght] [width] *:ri* *:right*
Right-align lines in [range] at [width] columns Right-align lines in [range] at [width] columns
(default 'textwidth' or 80 when 'textwidth' is 0). (default 'textwidth' or 80 when 'textwidth' is 0).
Not available when |+ex_extra| feature was disabled at
compile time.
*:le* *:left* *:le* *:left*
:[range]le[ft] [indent] :[range]le[ft] [indent]
Left-align lines in [range]. Sets the indent in the Left-align lines in [range]. Sets the indent in the
lines to [indent] (default 0). lines to [indent] (default 0).
Not available when |+ex_extra| feature was disabled at
compile time.
*gq* *gq*
gq{motion} Format the lines that {motion} moves over. gq{motion} Format the lines that {motion} moves over.
@@ -1622,17 +1635,6 @@ j Where it makes sense, remove a comment leader when joining lines. For
// in the list ~ // in the list ~
Becomes: Becomes:
int i; // the index in the list ~ int i; // the index in the list ~
p Don't break lines at single spaces that follow periods. This is
intended to complement 'joinspaces' and |cpo-J|, for prose with
sentences separated by two spaces. For example, with 'textwidth' set
to 28: >
Surely you're joking, Mr. Feynman!
< Becomes: >
Surely you're joking,
Mr. Feynman!
< Instead of: >
Surely you're joking, Mr.
Feynman!
With 't' and 'c' you can specify when Vim performs auto-wrapping: With 't' and 'c' you can specify when Vim performs auto-wrapping:

View File

@@ -30,7 +30,7 @@ There are several ways to open a channel:
Channels support multiple modes or protocols. In the most basic Channels support multiple modes or protocols. In the most basic
mode of operation, raw bytes are read and written to the channel. mode of operation, raw bytes are read and written to the channel.
The |RPC| protocol, based on the msgpack-rpc standard, enables nvim and the The |rpc| protocol, based on the msgpack-rpc standard, enables nvim and the
process at the other end to send remote calls and events to each other. process at the other end to send remote calls and events to each other.
The builtin |terminal-emulator| is also implemented on top of PTY channels. The builtin |terminal-emulator| is also implemented on top of PTY channels.
@@ -43,66 +43,63 @@ functions like |chansend()| consume channel ids.
============================================================================== ==============================================================================
2. Reading and writing raw bytes *channel-bytes* 2. Reading and writing raw bytes *channel-bytes*
Channels opened by Vimscript functions operate with raw bytes by default. For By default, channels opened by vimscript functions will operate with raw
a job channel using RPC, bytes can still be read over its stderr. Similarily, bytes. Additionally, for a job channel using rpc, bytes can still be
only bytes can be written to Nvim's own stderr. read over its stderr. Similarily, only bytes can be written to nvim's own stderr.
*channel-callback* *channel-callback* *buffered*
on_stdout({chan-id}, {data}, {name}) *on_stdout* *E5210* *on_stdout* *on_stderr* *on_stdin* *on_data*
on_stderr({chan-id}, {data}, {name}) *on_stderr* It is possible to register callback functions when a channel receives data by
on_stdin({chan-id}, {data}, {name}) *on_stdin* passing the `on_stdout`, `on_stderr`, `on_stdin` options on creation. Sockets
on_data({chan-id}, {data}, {name}) *on_data* may specify an `on_data` callback instead. Each callback function will be
Scripts can react to channel activity (received data) via callback invoked with data read from the channel. By default, the callback will be
functions assigned to the `on_stdout`, `on_stderr`, `on_stdin`, or invoked immediately when data is available, to facilitate interactive
`on_data` option keys. Callbacks should be fast: avoid potentially communication. The same callback will then be invoked with empty data, to
slow/expensive work. indicate that the stream reached EOF. Alternatively the `stdout_buffered`,
`stderr_buffered`, `stdin_buffered`, `data_buffered` options can be set to
invoke the corresponding callback only when the underlying stream reaches EOF.
The callback will then be passed complete output. This is helpful when only
the complete output is useful, and not partial data. Futhermore if the stream
is set to be buffered, but the callback is not set, the data is saved in the
options dict, with the stream name as key. For this to work a new options dict
must be used for each opened channel. If a script uses a global `s:job_opts`
dict, it can be copied with |copy()| before supplying it to |jobstart()|. If a
dict is reused, so that the dict key already is occupied, error `E5210` will
be raised.
Parameters: ~ - The arguments passed to the callback function are:
{chan-id} Channel handle. |channel-id|
{data} Raw data (|readfile()|-style list of strings) read from
the channel. EOF is a single-item list: `['']`. First and
last items may be partial lines! |channel-lines|
{name} Stream name (string) like "stdout", so the same function
can handle multiple streams. Event names depend on how the
channel was opened and in what mode/protocol.
*channel-buffered* 0: |channel-id|
The callback is invoked immediately as data is available, where 1: Raw data read from the channel, formatted as a |readfile()|-style
a single-item list `['']` indicates EOF (stream closed). Alternatively list. If EOF occured, a single empty string `['']` will be passed in.
set the `stdout_buffered`, `stderr_buffered`, `stdin_buffered`, or Note that the items in this list do not directly correspond to actual
`data_buffered` option keys to invoke the callback only after all output lines in the output. See |channel-lines|
was gathered and the stream was closed. 2: Stream name as a string, like `"stdout"`. This is to allow multiple
*E5210* stream handlers to be implemented by the same function. The available
If a buffering mode is used without a callback, the data is saved in the events depend on how the channel was opened and in what mode/protocol.
stream {name} key of the options dict. It is an error if the key exists.
*channel-lines* *channel-lines*
Stream event handlers receive data as it becomes available from the OS, Note:
thus the first and last items in the {data} list may be partial lines. stream event handlers may receive partial (incomplete) lines. For a given
Empty string completes the previous partial line. Examples (not including invocation of on_stdout etc, `a:data` is not guaranteed to end
the final `['']` emitted at EOF): with a newline.
- `foobar` may arrive as `['fo'], ['obar']` - `abcdefg` may arrive as `['abc']`, `['defg']`.
- `foo\nbar` may arrive as - `abc\nefg` may arrive as `['abc', '']`, `['efg']` or `['abc']`,
`['foo','bar']` `['','efg']`, or even `['ab']`, `['c','efg']`.
or `['foo',''], ['bar']`
or `['foo'], ['','bar']` If you only are interested in complete output when the process exits,
or `['fo'], ['o','bar']` use buffered mode. Otherwise, an easy way to deal with this:
There are two ways to deal with this: initialize a list as `['']`, then append to it as follows: >
1. To wait for the entire output, use |channel-buffered| mode. let s:chunks = ['']
2. To read line-by-line, use the following code: >
let s:lines = ['']
func! s:on_event(job_id, data, event) dict func! s:on_event(job_id, data, event) dict
let eof = (a:data == ['']) let s:chunks[-1] .= a:data[0]
" Complete the previous line. call extend(s:chunks, a:data[1:])
let s:lines[-1] .= a:data[0]
" Append (last item may be a partial line, until EOF).
call extend(s:lines, a:data[1:])
endf endf
< <
If the callback functions are |Dictionary-function|s, |self| refers to the Additionally, if the callbacks are Dictionary functions, |self| can be used to
options dictionary containing the callbacks. |Partial|s can also be used as refer to the options dictionary containing the callbacks. |Partial|s can also be
callbacks. used as callbacks.
Data can be sent to the channel using the |chansend()| function. Here is a Data can be sent to the channel using the |chansend()| function. Here is a
simple example, echoing some data through a cat-process: simple example, echoing some data through a cat-process:

View File

@@ -250,13 +250,20 @@ CTRL-A command-line completion (see |cmdline-completion|)
CTRL-L command-line completion (see |cmdline-completion|) CTRL-L command-line completion (see |cmdline-completion|)
*c_CTRL-_* *c_CTRL-_*
CTRL-_ Switch between Hebrew and English keyboard mode, which is CTRL-_ a - switch between Hebrew and English keyboard mode, which is
private to the command-line and not related to hkmap. private to the command-line and not related to hkmap.
This is useful when Hebrew text entry is required in the This is useful when Hebrew text entry is required in the
command-line, searches, abbreviations, etc. Applies only if command-line, searches, abbreviations, etc. Applies only if
the 'allowrevins' option is set. the 'allowrevins' option is set.
See |rileft.txt|. See |rileft.txt|.
b - switch between Farsi and English keyboard mode, which is
private to the command-line and not related to fkmap. In
Farsi keyboard mode the characters are inserted in reverse
insert manner. This is useful when Farsi text entry is
required in the command-line, searches, abbreviations, etc.
See |farsi.txt|.
*c_CTRL-^* *c_CTRL-^*
CTRL-^ Toggle the use of language |:lmap| mappings and/or Input CTRL-^ Toggle the use of language |:lmap| mappings and/or Input
Method. Method.
@@ -416,10 +423,6 @@ a previous version <Esc> was used). In the pattern standard wildcards '*' and
'?' are accepted when matching file names. '*' matches any string, '?' '?' are accepted when matching file names. '*' matches any string, '?'
matches exactly one character. matches exactly one character.
When repeating 'wildchar' or CTRL-N you cycle through the matches, eventually
ending up back to what was typed. If the first match is not what you wanted,
you can use <S-Tab> or CTRL-P to go straight back to what you typed.
The 'wildignorecase' option can be set to ignore case in filenames. The 'wildignorecase' option can be set to ignore case in filenames.
The 'wildmenu' option can be set to show the matches just above the command The 'wildmenu' option can be set to show the matches just above the command
@@ -499,6 +502,7 @@ that see the '"' as part of their argument:
:autocmd :autocmd
:bufdo :bufdo
:cexpr (and the like) :cexpr (and the like)
:call
:cdo (and the like) :cdo (and the like)
:command :command
:cscope (and the like) :cscope (and the like)
@@ -660,7 +664,7 @@ commands ":write" and ":global" have the whole file (1,$) as default.
If more line specifiers are given than required for the command, the first If more line specifiers are given than required for the command, the first
one(s) will be ignored. one(s) will be ignored.
Line numbers may be specified with: *:range* *{address}* Line numbers may be specified with: *:range* *E14* *{address}*
{number} an absolute line number {number} an absolute line number
. the current line *:.* . the current line *:.*
$ the last line in the file *:$* $ the last line in the file *:$*
@@ -792,6 +796,7 @@ function |expand()|.
#<n (where n is a number > 0) is replaced with old *:_#<* *c_#<* #<n (where n is a number > 0) is replaced with old *:_#<* *c_#<*
file name n. See |:oldfiles| or |v:oldfiles| to get the file name n. See |:oldfiles| or |v:oldfiles| to get the
number. *E809* number. *E809*
{only when compiled with the |+eval| and |+shada| features}
Note that these, except "#<n", give the file name as it was typed. If an Note that these, except "#<n", give the file name as it was typed. If an
absolute path is needed (when using the file name from a different directory), absolute path is needed (when using the file name from a different directory),
@@ -816,12 +821,11 @@ it, no matter how many backslashes.
\\# \# \\# \#
Also see |`=|. Also see |`=|.
*:<cword>* *<cword>* *:<cWORD>* *<cWORD>* *:<cword>* *:<cWORD>* *:<cfile>* *<cfile>*
*:<cexpr>* *<cexpr>* *:<cfile>* *<cfile>* *:<sfile>* *<sfile>* *:<afile>* *<afile>*
*:<afile>* *<afile>* *:<abuf>* *<abuf>* *:<abuf>* *<abuf>* *:<amatch>* *<amatch>*
*:<amatch>* *<amatch>* *:<cexpr>* *<cexpr>*
*:<sfile>* *<sfile>* *:<slnum>* *<slnum>* *<slnum>* *E495* *E496* *E497* *E499* *E500*
*:<sflnum>* *<sflnum>* *E499* *E500*
Note: these are typed literally, they are not special keys! Note: these are typed literally, they are not special keys!
<cword> is replaced with the word under the cursor (like |star|) <cword> is replaced with the word under the cursor (like |star|)
<cWORD> is replaced with the WORD under the cursor (see |WORD|) <cWORD> is replaced with the WORD under the cursor (see |WORD|)
@@ -834,16 +838,15 @@ Note: these are typed literally, they are not special keys!
|gf| uses) |gf| uses)
<afile> When executing autocommands, is replaced with the file name <afile> When executing autocommands, is replaced with the file name
of the buffer being manipulated, or the file for a read or of the buffer being manipulated, or the file for a read or
write. *E495* write.
<abuf> When executing autocommands, is replaced with the currently <abuf> When executing autocommands, is replaced with the currently
effective buffer number (for ":r file" and ":so file" it is effective buffer number (for ":r file" and ":so file" it is
the current buffer, the file being read/sourced is not in a the current buffer, the file being read/sourced is not in a
buffer). *E496* buffer).
<amatch> When executing autocommands, is replaced with the match for <amatch> When executing autocommands, is replaced with the match for
which this autocommand was executed. *E497* which this autocommand was executed. It differs from
It differs from <afile> only when the file name isn't used <afile> only when the file name isn't used to match with
to match with (for FileType, Syntax and SpellFileMissing (for FileType, Syntax and SpellFileMissing events).
events).
<sfile> When executing a ":source" command, is replaced with the <sfile> When executing a ":source" command, is replaced with the
file name of the sourced file. *E498* file name of the sourced file. *E498*
When executing a function, is replaced with: When executing a function, is replaced with:
@@ -856,15 +859,14 @@ Note: these are typed literally, they are not special keys!
line number. *E842* line number. *E842*
When executing a function it's the line number relative to When executing a function it's the line number relative to
the start of the function. the start of the function.
<sflnum> When executing a script, is replaced with the line number.
It differs from <slnum> in that <sflnum> is replaced with
the script line number in any situation. *E961*
*filename-modifiers* *filename-modifiers*
*:_%:* *::8* *::p* *::.* *::~* *::h* *::t* *::r* *::e* *::s* *::gs* *::S* *:_%:* *::8* *::p* *::.* *::~* *::h* *::t* *::r* *::e* *::s* *::gs* *::S*
*%:8* *%:p* *%:.* *%:~* *%:h* *%:t* *%:r* *%:e* *%:s* *%:gs* *%:S* *%:8* *%:p* *%:.* *%:~* *%:h* *%:t* *%:r* *%:e* *%:s* *%:gs* *%:S*
The file name modifiers can be used after "%", "#", "#n", "<cfile>", "<sfile>", The file name modifiers can be used after "%", "#", "#n", "<cfile>", "<sfile>",
"<afile>" or "<abuf>". They are also used with the |fnamemodify()| function. "<afile>" or "<abuf>". They are also used with the |fnamemodify()| function.
These are not available when Vim has been compiled without the |+modify_fname|
feature.
These modifiers can be given, in this order: These modifiers can be given, in this order:
:p Make file name a full path. Must be the first modifier. Also :p Make file name a full path. Must be the first modifier. Also
changes "~/" (and "~user/" for Unix) to the path for the home changes "~/" (and "~user/" for Unix) to the path for the home
@@ -1107,8 +1109,8 @@ in the command-line window, like this: >
Note that hitting <Tab> in Normal mode will do completion on the next Note that hitting <Tab> in Normal mode will do completion on the next
character. That way it works at the end of the line. character. That way it works at the end of the line.
If you don't want these mappings, disable them with: > If you don't want these mappings, disable them with: >
au CmdwinEnter [:>] iunmap <buffer> <Tab> au CmdwinEnter [:>] iunmap <Tab>
au CmdwinEnter [:>] nunmap <buffer> <Tab> au CmdwinEnter [:>] nunmap <Tab>
You could put these lines in your vimrc file. You could put these lines in your vimrc file.
While in the command-line window you cannot use the mouse to put the cursor in While in the command-line window you cannot use the mouse to put the cursor in

View File

@@ -76,10 +76,15 @@ matches the EXE (same date).
If you built the executable yourself with the Microsoft Visual C++ compiler, If you built the executable yourself with the Microsoft Visual C++ compiler,
then the PDB was built with the EXE. then the PDB was built with the EXE.
Alternatively, if you have the source files, you can import Make_ivc.mak into
Visual Studio as a workspace. Then select a debug configuration, build and
you can do all kinds of debugging (set breakpoints, watch variables, etc.).
If you have Visual Studio, use that instead of the VC Toolkit and WinDbg. If you have Visual Studio, use that instead of the VC Toolkit and WinDbg.
For other compilers, you should always use the corresponding debugger: gdb For other compilers, you should always use the corresponding debugger: TD for
(see above |debug-gcc|) for the Cygwin and MinGW compilers. a Vim executable compiled with the Borland compiler; gdb (see above
|debug-gcc|) for the Cygwin and MinGW compilers.
*debug-vs2005* *debug-vs2005*
@@ -107,7 +112,7 @@ line numbers. Double-click one of the lines and the Find Source dialog will
appear. Navigate to the directory where the Vim source is (if you have it.) appear. Navigate to the directory where the Vim source is (if you have it.)
If you don't know how to debug this any further, follow the instructions If you don't know how to debug this any further, follow the instructions
at ":help bug-report". Paste the call stack into the bug report. at ":help bug-reports". Paste the call stack into the bug report.
If you have a non-free version of Visual Studio, you can save a minidump via If you have a non-free version of Visual Studio, you can save a minidump via
the Debug menu and send it with the bug report. A minidump is a small file the Debug menu and send it with the bug report. A minidump is a small file

View File

@@ -12,9 +12,6 @@ updated.
============================================================================== ==============================================================================
API ~
*nvim_buf_clear_highlight()* Use |nvim_buf_clear_namespace()| instead.
Commands ~ Commands ~
*:rv* *:rv*
*:rviminfo* Deprecated alias to |:rshada| command. *:rviminfo* Deprecated alias to |:rshada| command.
@@ -28,8 +25,6 @@ Environment Variables ~
Events ~ Events ~
*EncodingChanged* Never fired; 'encoding' is always "utf-8". *EncodingChanged* Never fired; 'encoding' is always "utf-8".
*FileEncoding* Never fired; equivalent to |EncodingChanged|. *FileEncoding* Never fired; equivalent to |EncodingChanged|.
*GUIEnter* Never fired; use |UIEnter| instead.
*GUIFailed* Never fired.
Keycodes ~ Keycodes ~
*<MouseDown>* Use <ScrollWheelUp> instead. *<MouseDown>* Use <ScrollWheelUp> instead.
@@ -46,11 +41,6 @@ Functions ~
*jobclose()* Obsolete name for |chanclose()| *jobclose()* Obsolete name for |chanclose()|
*jobsend()* Obsolete name for |chansend()| *jobsend()* Obsolete name for |chansend()|
*last_buffer_nr()* Obsolete name for bufnr("$"). *last_buffer_nr()* Obsolete name for bufnr("$").
*rpcstop()* Deprecated. Instead use |jobstop()| to stop any job,
or chanclose(id, "rpc") to close RPC communication
without stopping the job. Use chanclose(id) to close
any socket.
Modifiers ~ Modifiers ~
*cpo-<* *cpo-<*
@@ -65,10 +55,6 @@ Normal commands ~
Options ~ Options ~
*'cscopeverbose'* Enabled by default. Use |:silent| instead. *'cscopeverbose'* Enabled by default. Use |:silent| instead.
*'exrc'* *'ex'* Security risk: downloaded files could include
a malicious .nvimrc or .exrc file. See 'secure'.
Recommended alternative: define an autocommand in your
|vimrc| to set options for a matching directory.
'gd' 'gd'
'gdefault' Enables the |:substitute| flag 'g' by default. 'gdefault' Enables the |:substitute| flag 'g' by default.
*'fe'* 'fenc'+'enc' before Vim 6.0; no longer used. *'fe'* 'fenc'+'enc' before Vim 6.0; no longer used.
@@ -76,14 +62,6 @@ Options ~
*'langnoremap'* Deprecated alias to 'nolangremap'. *'langnoremap'* Deprecated alias to 'nolangremap'.
*'vi'* *'vi'*
*'viminfo'* Deprecated alias to 'shada' option. *'viminfo'* Deprecated alias to 'shada' option.
*'viminfofile'* Deprecated alias to 'shadafile' option.
UI extensions~
*ui-wildmenu* Use |ui-cmdline| with |ui-popupmenu| instead. Enabled
by the `ext_wildmenu` |ui-option|. Emits these events:
["wildmenu_show", items]
["wildmenu_select", selected]
["wildmenu_hide"]
Variables~ Variables~
*b:terminal_job_pid* PID of the top-level process in a |:terminal|. *b:terminal_job_pid* PID of the top-level process in a |:terminal|.

View File

@@ -4,7 +4,7 @@
NVIM REFERENCE MANUAL NVIM REFERENCE MANUAL
Development of Nvim *development* *dev* Development of Nvim *development*
This reference describes design constraints and guidelines, for developing This reference describes design constraints and guidelines, for developing
Nvim applications or Nvim itself. Nvim applications or Nvim itself.
@@ -79,16 +79,17 @@ include the kitchen sink... but it's good for plumbing."
============================================================================== ==============================================================================
Developer guidelines *dev-guidelines* Developer guidelines *dev*
PROVIDERS *dev-provider* PROVIDERS *dev-provider*
A primary goal of Nvim is to allow extension of the editor without special A goal of Nvim is to allow extension of the editor without special knowledge
knowledge in the core. Some core functions are delegated to "providers" in the core. But some Vim components are too tightly coupled; in those cases
implemented as external scripts. a "provider" hook is exposed.
Examples: Consider two examples of integration with external systems that are
implemented in Vim and are now decoupled from Nvim core as providers:
1. In the Vim source code, clipboard logic accounts for more than 1k lines of 1. In the Vim source code, clipboard logic accounts for more than 1k lines of
C source code (ui.c), to perform two tasks that are now accomplished with C source code (ui.c), to perform two tasks that are now accomplished with
@@ -100,28 +101,29 @@ Examples:
scripting is performed by an external host process implemented in ~2k lines scripting is performed by an external host process implemented in ~2k lines
of Python. of Python.
The provider framework invokes VimL from C. It is composed of two functions Ideally we could implement Python and clipboard integration in pure vimscript
in eval.c: and without touching the C code. But this is infeasible without compromising
backwards compatibility with Vim; that's where providers help.
- eval_call_provider(name, method, arguments): calls provider#{name}#Call The provider framework helps call vimscript from C. It is composed of two
functions in eval.c:
- eval_call_provider(name, method, arguments): calls provider#(name)#Call
with the method and arguments. with the method and arguments.
- eval_has_provider(name): Checks the `g:loaded_{name}_provider` variable - eval_has_provider(name): Checks if a provider is implemented. Returns true
which must be set to 2 by the provider script to indicate that it is if the provider#(name)#Call function is implemented. Called by |has()|
"enabled and working". Called by |has()| to check if features are available. (vimscript) to check if features are available.
The provider#(name)#Call function implements integration with an external
system, because shell commands and |RPC| clients are easier to work with in
vimscript.
For example, the Python provider is implemented by the For example, the Python provider is implemented by the
"autoload/provider/python.vim" script, which sets `g:loaded_python_provider` autoload/provider/python.vim script; the provider#python#Call function is only
to 2 only if a valid external Python host is found. Then `has("python")` defined if a valid external Python host is found. That works well with the
reflects whether Python support is working. `has('python')` expression (normally used by Python plugins) because if the
Python host isn't installed then the plugin will "think" it is running in
*provider-reload* a Vim compiled without the |+python| feature.
Sometimes a GUI or other application may want to force a provider to
"reload". To reload a provider, undefine its "loaded" flag, then use
|:runtime| to reload it: >
:unlet g:loaded_clipboard_provider
:runtime autoload/provider/clipboard.vim
DOCUMENTATION *dev-doc* DOCUMENTATION *dev-doc*
@@ -155,55 +157,37 @@ with a {thing} that groups functions under a common concept).
Use existing common {action} names if possible: Use existing common {action} names if possible:
add Append to, or insert into, a collection add Append to, or insert into, a collection
get Get a thing (or group of things by query) get Get a thing (or subset of things by some query)
set Set a thing (or group of things) set Set a thing
del Delete a thing (or group of things) del Delete a thing (or group of things)
list Get all things list Get all things
Use consistent names for {thing} in all API functions. E.g. a buffer is called Use consistent names for {thing} in all API functions. E.g. a buffer is called
"buf" everywhere, not "buffer" in some places and "buf" in others. "buf" everywhere, not "buffer" in some places and "buf" in others.
Example: Example: `nvim_get_current_line` acts on the global editor state; the common
`nvim_get_current_line` acts on the global editor state; the common {action} "get" is used but {thing} is omitted.
{action} "get" is used but {thing} is omitted.
Example: Example: `nvim_buf_add_highlight` acts on a `Buffer` object (the first
`nvim_buf_add_highlight` acts on a `Buffer` object (the first parameter) parameter) and uses the common {action} "add".
and uses the common {action} "add".
Example: Example: `nvim_list_bufs` operates in a global context (first parameter is
`nvim_list_bufs` operates in a global context (first parameter is not _not_ a Buffer). The common {action} "list" indicates that it lists all
a Buffer). The common {action} "list" indicates that it lists all bufs bufs (plural) in the global context.
(plural) in the global context.
Use this template to name new API events: Use this template to name new API events:
nvim_{thing}_{event}_event nvim_{thing}_{event}_event
Example: Example: `nvim_buf_changedtick_event`.
`nvim_buf_changedtick_event`
API-CLIENT *dev-api-client* API-CLIENT *dev-api-client*
*api-client*
API clients wrap the Nvim |API| to provide idiomatic "SDKs" for their
respective platforms (see |jargon|). You can build a new API client for your
favorite platform or programming language.
List of API clients:
https://github.com/neovim/neovim/wiki/Related-projects#api-clients
*pynvim*
The Python client is the reference implementation for API clients.
https://github.com/neovim/pynvim
Standard Features ~ Standard Features ~
- API clients exist to hide msgpack-rpc details. The wrappers can be
automatically generated by reading the |api-metadata| from Nvim. |api-mapping|
- Clients should call |nvim_set_client_info()| after connecting, so users and - Clients should call |nvim_set_client_info()| after connecting, so users and
plugins can detect the client by handling the |ChanInfo| event. This avoids plugins can detect the client by handling the |ChanInfo| event. This
the need for special variables or other client hints. avoids the need for special variables or other client hints.
- Clients should handle |nvim_error_event| notifications, which will be sent - Clients should handle |nvim_error_event| notifications, which will be sent
if an async request to nvim was rejected or caused an error. if an async request to nvim was rejected or caused an error.
@@ -223,28 +207,12 @@ Examples of API-client package names:
BAD: python-client BAD: python-client
BAD: neovim BAD: neovim
API client implementation guidelines ~ Implementation ~
- Separate the transport layer from the rest of the library. |rpc-connecting|
- Use a MessagePack library that implements at least version 5 of the
MessagePack spec, which supports the BIN and EXT types used by Nvim.
- Use a single-threaded event loop library/pattern.
- Use a fiber/coroutine library for the language being used for implementing
a client. These greatly simplify concurrency and allow the library to
expose a blocking API on top of a non-blocking event loop without the
complexity that comes with preemptive multitasking.
- Don't assume anything about the order of responses to RPC requests.
- Clients should expect requests, which must be handled immediately because
Nvim is blocked while waiting for the client response.
- Clients should expect notifications, but these can be handled "ASAP" (rather
than immediately) because they won't block Nvim.
- For C/C++ projects, consider libmpack instead of the msgpack.org library.
https://github.com/libmpack/libmpack/
libmpack is small (no dependencies, can inline into your C/C++ project) and
efficient (no allocations). It also implements msgpack-RPC, the protocol
required by Nvim.
https://github.com/msgpack-rpc/msgpack-rpc
Consider using libmpack instead of the msgpack.org C/C++ library. libmpack is
small (can be inlined into your C/C++ project) and efficient (no allocations).
It also implements msgpack-RPC.
https://github.com/libmpack/libmpack/
EXTERNAL UI *dev-ui* EXTERNAL UI *dev-ui*

View File

@@ -175,7 +175,7 @@ hidden buffers. You can use ":hide" to close a window without unloading the
buffer. If you don't want a buffer to remain used for the diff do ":set buffer. If you don't want a buffer to remain used for the diff do ":set
nodiff" before hiding it. nodiff" before hiding it.
*:dif* *:diff* *:diffupdate* *:dif* *:diffupdate*
:dif[fupdate][!] Update the diff highlighting and folds. :dif[fupdate][!] Update the diff highlighting and folds.
Vim attempts to keep the differences updated when you make changes to the Vim attempts to keep the differences updated when you make changes to the
@@ -325,7 +325,7 @@ After setting this variable, reload the syntax script: >
FINDING THE DIFFERENCES *diff-diffexpr* FINDING THE DIFFERENCES *diff-diffexpr*
The 'diffexpr' option can be set to use something else than the standard The 'diffexpr' option can be set to use something else than the standard
"diff" program to compare two files and find the differences. *E959* "diff" program to compare two files and find the differences.
When 'diffexpr' is empty, Vim uses this command to find the differences When 'diffexpr' is empty, Vim uses this command to find the differences
between file1 and file2: > between file1 and file2: >

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