Merge remote-tracking branch 'upstream/master' into libcallnr

This commit is contained in:
James McCoy
2020-08-08 08:57:35 -04:00
645 changed files with 84628 additions and 35881 deletions

44
.builds/freebsd.yml Normal file
View File

@@ -0,0 +1,44 @@
image: freebsd/12.x
packages:
- cmake
- gmake
- ninja
- libtool
- sha
- automake
- pkgconf
- unzip
- wget
- gettext
- python
- libffi
sources:
- https://github.com/neovim/neovim
environment:
SOURCEHUT: 1
LANG: en_US.UTF-8
CMAKE_EXTRA_FLAGS: -DTRAVIS_CI_BUILD=ON -DMIN_LOG_LEVEL=3
tasks:
- build-deps: |
cd neovim
gmake deps
- build: |
cd neovim
gmake CMAKE_BUILD_TYPE=Release CMAKE_EXTRA_FLAGS="${CMAKE_EXTRA_FLAGS}" nvim
- functionaltest: |
cd neovim
gmake functionaltest
- unittest: |
cd neovim
gmake unittest
# Unfortunately, oldtest is tanking hard on sourcehut's FreeBSD instance
# and not producing any logs as a result. So don't do this task for now.
# Ref: https://github.com/neovim/neovim/pull/11477#discussion_r352095005.
# - test-oldtest: |
# cd neovim
# gmake oldtest

View File

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

1
.gitattributes vendored
View File

@@ -1 +1,2 @@
*.h linguist-language=C *.h linguist-language=C
src/nvim/testdir/test42.in diff

View File

@@ -0,0 +1,46 @@
---
name: Language server client bug report
about: Report a built-in lsp problem in Nvim
title: ''
labels: bug, lsp
---
<!-- Before reporting: search existing issues and check the FAQ. -->
- `nvim --version`:
- language server name/version:
- Operating system/version:
<details>
<summary>nvim -c ":checkhealth nvim nvim_lsp"</summary>
<!-- Paste the results from `nvim -c ":checkhealth nvim nvim_lsp"` here. -->
</details>
<details>
<summary>lsp.log</summary>
<!--
Please paste the lsp log before and after the problem.
You can set log level like this.
`:lua vim.lsp.set_log_level("debug")`
You can find the location of the log with the following command.
`:lua print(vim.lsp.get_log_path())`
-->
</details>
### Steps to reproduce using `nvim -u NORC`
```
nvim -u NORC
```
### Actual behaviour
### Expected behaviour

5
.gitignore vendored
View File

@@ -10,7 +10,9 @@ compile_commands.json
/dist/ /dist/
/.deps/ /.deps/
/tmp/ /tmp/
/.clangd/
.DS_Store
*.mo *.mo
.*.sw? .*.sw?
*~ *~
@@ -42,6 +44,7 @@ tags
/src/nvim/testdir/valgrind.* /src/nvim/testdir/valgrind.*
/src/nvim/testdir/.gdbinit /src/nvim/testdir/.gdbinit
/runtime/indent/testdir/*.out /runtime/indent/testdir/*.out
+runtime/indent/testdir/*.fail
# Generated by src/nvim/testdir/runnvim.sh. # Generated by src/nvim/testdir/runnvim.sh.
/src/nvim/testdir/*.tlog /src/nvim/testdir/*.tlog
@@ -58,6 +61,8 @@ local.mk
/runtime/doc/*.html /runtime/doc/*.html
/runtime/doc/tags.ref /runtime/doc/tags.ref
/runtime/doc/errors.log /runtime/doc/errors.log
# Don't include the mpack files.
/runtime/doc/*.mpack
# CLion # CLion
/.idea/ /.idea/

View File

@@ -1,7 +1,14 @@
-- vim: ft=lua tw=80 -- vim: ft=lua tw=80
stds.nvim = {
read_globals = { "jit" }
}
std = "lua51+nvim"
-- Ignore W211 (unused variable) with preload files. -- Ignore W211 (unused variable) with preload files.
files["**/preload.lua"] = {ignore = { "211" }} files["**/preload.lua"] = {ignore = { "211" }}
-- Allow vim module to modify itself, but only here.
files["src/nvim/lua/vim.lua"] = {ignore = { "122/vim" }}
-- Don't report unused self arguments of methods. -- Don't report unused self arguments of methods.
self = false self = false

22
.luacov Normal file
View File

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

View File

@@ -4,6 +4,19 @@ language: c
env: env:
global: global:
# Encrypted environment variables, see
# http://docs.travis-ci.com/user/encryption-keys/
#
# SNAP_SECRET_KEY: generated by:
# travis encrypt SNAP_SECRET_KEY=xx --add
# https://github.com/neovim/neovim/pull/11428
# snapcraft key expires after 1 year. Steps to refresh it:
# 1. snapcraft enable-ci travis --refresh
# 2. mv .snapcraft/travis_snapcraft.cfg ci/snap/travis_snapcraft.cfg
# 3. Copy after_success command to ci/snap/deploy.sh from .travis.yml
# 4. Undo changes to .travis.yml
- secure: hd0qn2u8ABbJg5Bx4pBRcUQbKYFmcSHoecyHIPTCnGJT+NI41Bvm/IkN/N5DhBF+LbD3Q2nmR/dzI5H/dqS7RxMFvEx1DuFLendFHHX3MYf0AuKpXYY3gwgMTmqx8p/v6srlU7RBGWNGzHCWqksAem+EIWCe3I7WvfdKo1/DV/Y=
# Set "false" to force rebuild of third-party dependencies. # Set "false" to force rebuild of third-party dependencies.
- CACHE_ENABLE=true - CACHE_ENABLE=true
# Build directory for Neovim. # Build directory for Neovim.
@@ -24,10 +37,6 @@ env:
-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="-DUSE_BUNDLED_GPERF=OFF"
# Additional CMake flags for 32-bit builds.
- CMAKE_FLAGS_32BIT="-DCMAKE_SYSTEM_LIBRARY_PATH=/lib32:/usr/lib32:/usr/local/lib32
-DCMAKE_IGNORE_PATH=/lib:/usr/lib:/usr/local/lib
-DCMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/cmake/i386-linux-gnu.toolchain.cmake"
# Environment variables for Clang sanitizers. # Environment variables for Clang sanitizers.
- 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"
@@ -62,12 +71,12 @@ addons:
- build-essential - build-essential
- clang - clang
- cmake - cmake
- cpanminus
- cscope - cscope
- gcc-multilib - gcc-multilib
- gdb - gdb
- gperf - gperf
- language-pack-tr - language-pack-tr
- libc6-dev-i386
- libtool-bin - libtool-bin
- locales - locales
- ninja-build - ninja-build
@@ -76,10 +85,14 @@ addons:
- valgrind - valgrind
- xclip - xclip
homebrew: homebrew:
update: false update: true
casks:
- powershell
packages: packages:
- ccache - ccache
- cpanminus
- ninja - ninja
- perl
jobs: jobs:
include: include:
@@ -99,14 +112,19 @@ jobs:
- GCOV=gcov-9 - GCOV=gcov-9
- CMAKE_FLAGS="$CMAKE_FLAGS -DUSE_GCOV=ON" - CMAKE_FLAGS="$CMAKE_FLAGS -DUSE_GCOV=ON"
- GCOV_ERROR_FILE="/tmp/libgcov-errors.log" - GCOV_ERROR_FILE="/tmp/libgcov-errors.log"
- USE_LUACOV=1
- BUSTED_ARGS="--coverage"
- *common-job-env - *common-job-env
addons: addons:
apt: apt:
sources: sources:
- sourceline: 'ppa:ubuntu-toolchain-r/test' - sourceline: 'ppa:ubuntu-toolchain-r/test'
- sourceline: 'deb [arch=amd64] https://packages.microsoft.com/ubuntu/16.04/prod xenial main'
key_url: 'https://packages.microsoft.com/keys/microsoft.asc'
packages: packages:
- *common-apt-packages - *common-apt-packages
- gcc-9 - gcc-9
- powershell
- if: branch = master AND commit_message !~ /\[skip.lint\]/ - if: branch = master AND commit_message !~ /\[skip.lint\]/
name: lint name: lint
os: linux os: linux
@@ -136,15 +154,73 @@ jobs:
compiler: gcc compiler: gcc
env: env:
- BUILD_32BIT=ON - BUILD_32BIT=ON
- CMAKE_FLAGS="$CMAKE_FLAGS -m32 -DCMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/cmake/i386-linux-gnu.toolchain.cmake"
- DEPS_CMAKE_FLAGS="$DEPS_CMAKE_FLAGS -m32 -DCMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/cmake/i386-linux-gnu.toolchain.cmake"
# Minimum required CMake. # Minimum required CMake.
- CMAKE_URL=https://cmake.org/files/v2.8/cmake-2.8.12-Linux-i386.sh - CMAKE_URL=https://cmake.org/files/v2.8/cmake-2.8.12-Linux-i386.sh
- *common-job-env - *common-job-env
- name: big-endian
os: linux
arch: s390x
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
addons:
apt:
packages:
- *common-apt-packages
- gettext
- python-pip
- python3-pip
- python-setuptools
- python3-setuptools
- python-dev
- python3-dev
- name: clang-tsan - name: clang-tsan
os: linux os: linux
compiler: clang compiler: clang
env: env:
- CLANG_SANITIZER=TSAN - CLANG_SANITIZER=TSAN
- *common-job-env - *common-job-env
- if: type != pull_request
name: snap
os: linux
env:
- LC_ALL: C.UTF-8
- LANG: C.UTF-8
- SNAPCRAFT_ENABLE_SILENT_REPORT: y
- SNAPCRAFT_ENABLE_DEVELOPER_DEBUG: y
addons:
snaps:
- name: snapcraft
channel: stable
classic: true
- name: http
- name: transfer
- name: lxd
channel: stable
# Override default before_install, before_cache.
before_install: /bin/true
before_cache: /bin/true
install: ci/snap/install.sh
before_script: echo "Building snap..."
script: ci/snap/script.sh
after_success: ci/snap/after_success.sh
deploy:
skip_cleanup: true
provider: script
script: ci/snap/deploy.sh
on:
branch: master
allow_failures:
- env:
- LC_ALL: C.UTF-8
- LANG: C.UTF-8
- SNAPCRAFT_ENABLE_SILENT_REPORT: y
- SNAPCRAFT_ENABLE_DEVELOPER_DEBUG: y
fast_finish: true fast_finish: true
before_install: ci/before_install.sh before_install: ci/before_install.sh

View File

@@ -6,6 +6,13 @@
cmake_minimum_required(VERSION 2.8.12) cmake_minimum_required(VERSION 2.8.12)
project(nvim C) project(nvim C)
if(POLICY CMP0065)
cmake_policy(SET CMP0065 NEW)
endif()
if(POLICY CMP0060)
cmake_policy(SET CMP0060 NEW)
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")
@@ -113,47 +120,32 @@ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
# 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 5)
set(NVIM_VERSION_PATCH 0) set(NVIM_VERSION_PATCH 0)
set(NVIM_VERSION_PRERELEASE "") # for package maintainers set(NVIM_VERSION_PRERELEASE "-dev") # for package maintainers
# API level # API level
set(NVIM_API_LEVEL 6) # Bump this after any API change. set(NVIM_API_LEVEL 7) # 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 true)
file(TO_CMAKE_PATH ${CMAKE_CURRENT_LIST_DIR}/.git FORCED_GIT_DIR)
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC NVIM_VERSION_COMMIT)
if(NVIM_VERSION_COMMIT) # is a git repo
git_describe(NVIM_VERSION_MEDIUM)
# `git describe` annotates the most recent tagged release; for pre-release
# builds we must replace that with the unreleased version.
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+"
"v${NVIM_VERSION_MAJOR}.${NVIM_VERSION_MINOR}.${NVIM_VERSION_PATCH}"
NVIM_VERSION_MEDIUM
${NVIM_VERSION_MEDIUM})
endif()
set(NVIM_VERSION_BUILD_TYPE "${CMAKE_BUILD_TYPE}") set(NVIM_VERSION_BUILD_TYPE "${CMAKE_BUILD_TYPE}")
# NVIM_VERSION_CFLAGS set further below. # NVIM_VERSION_CFLAGS set further below.
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Minimize logging for release-type builds.
if(NOT CMAKE_C_FLAGS_RELEASE MATCHES DMIN_LOG_LEVEL)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DMIN_LOG_LEVEL=3")
endif()
if(NOT CMAKE_C_FLAGS_MINSIZEREL MATCHES DMIN_LOG_LEVEL)
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -DMIN_LOG_LEVEL=3")
endif()
if(NOT CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES DMIN_LOG_LEVEL)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DMIN_LOG_LEVEL=3")
endif()
# Log level (MIN_LOG_LEVEL in log.h) # Log level (MIN_LOG_LEVEL in log.h)
if("${MIN_LOG_LEVEL}" MATCHES "^$") if("${MIN_LOG_LEVEL}" MATCHES "^$")
message(STATUS "MIN_LOG_LEVEL not specified, default is 1 (INFO)") # Minimize logging for release-type builds.
if(CMAKE_BUILD_TYPE STREQUAL "Release"
OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"
OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
message(STATUS "MIN_LOG_LEVEL not specified, default is 3 (ERROR) for release builds")
set(MIN_LOG_LEVEL 3)
else()
message(STATUS "MIN_LOG_LEVEL not specified, default is 1 (INFO)")
set(MIN_LOG_LEVEL 1)
endif()
else() else()
if(NOT MIN_LOG_LEVEL MATCHES "^[0-3]$") if(NOT MIN_LOG_LEVEL MATCHES "^[0-3]$")
message(FATAL_ERROR "invalid MIN_LOG_LEVEL: " ${MIN_LOG_LEVEL}) message(FATAL_ERROR "invalid MIN_LOG_LEVEL: " ${MIN_LOG_LEVEL})
@@ -309,11 +301,18 @@ if(UNIX)
if(HAS_FSTACK_PROTECTOR_STRONG_FLAG) if(HAS_FSTACK_PROTECTOR_STRONG_FLAG)
add_compile_options(-fstack-protector-strong) add_compile_options(-fstack-protector-strong)
link_libraries(-fstack-protector-strong)
elseif(HAS_FSTACK_PROTECTOR_FLAG) elseif(HAS_FSTACK_PROTECTOR_FLAG)
add_compile_options(-fstack-protector --param ssp-buffer-size=4) add_compile_options(-fstack-protector --param ssp-buffer-size=4)
link_libraries(-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") if(CMAKE_GENERATOR MATCHES "Ninja")
@@ -323,10 +322,10 @@ if(HAS_DIAG_COLOR_FLAG)
endif() endif()
endif() endif()
option(TRAVIS_CI_BUILD "Travis/QuickBuild CI, extra flags will be set" OFF) option(TRAVIS_CI_BUILD "Travis/sourcehut 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/sourcehut CI build enabled")
add_compile_options(-Werror) add_compile_options(-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
@@ -454,17 +453,17 @@ 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)
find_package(Iconv REQUIRED)
include_directories(SYSTEM ${Iconv_INCLUDE_DIRS})
endif()
if(ENABLE_LIBINTL) if(ENABLE_LIBINTL)
# LibIntl (not Intl) selects our FindLibIntl.cmake script. #8464 # LibIntl (not Intl) selects our FindLibIntl.cmake script. #8464
find_package(LibIntl REQUIRED) find_package(LibIntl REQUIRED)
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)
@@ -486,18 +485,19 @@ include(LuaHelpers)
set(LUA_DEPENDENCIES lpeg mpack bit) set(LUA_DEPENDENCIES lpeg mpack bit)
if(NOT LUA_PRG) if(NOT LUA_PRG)
foreach(CURRENT_LUA_PRG luajit lua5.1 lua5.2 lua) foreach(CURRENT_LUA_PRG luajit lua5.1 lua5.2 lua)
# If LUA_PRG is set find_program() will not search unset(_CHECK_LUA_PRG CACHE)
unset(LUA_PRG CACHE)
unset(LUA_PRG_WORKS) unset(LUA_PRG_WORKS)
find_program(LUA_PRG ${CURRENT_LUA_PRG}) find_program(_CHECK_LUA_PRG ${CURRENT_LUA_PRG})
if(LUA_PRG) if(_CHECK_LUA_PRG)
check_lua_deps(${LUA_PRG} "${LUA_DEPENDENCIES}" LUA_PRG_WORKS) check_lua_deps(${_CHECK_LUA_PRG} "${LUA_DEPENDENCIES}" LUA_PRG_WORKS)
if(LUA_PRG_WORKS) if(LUA_PRG_WORKS)
set(LUA_PRG "${_CHECK_LUA_PRG}" CACHE FILEPATH "Path to a program.")
break() break()
endif() endif()
endif() endif()
endforeach() endforeach()
unset(_CHECK_LUA_PRG CACHE)
else() else()
check_lua_deps(${LUA_PRG} "${LUA_DEPENDENCIES}" LUA_PRG_WORKS) check_lua_deps(${LUA_PRG} "${LUA_DEPENDENCIES}" LUA_PRG_WORKS)
endif() endif()
@@ -560,10 +560,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 printenv-test printargs-test shell-test streams-test tty-test ${GENERATED_HELP_TAGS})
if(NOT WIN32)
list(APPEND FUNCTIONALTEST_PREREQS tty-test)
endif()
set(BENCHMARK_PREREQS nvim tty-test) set(BENCHMARK_PREREQS nvim tty-test)
# Useful for automated build systems, if they want to manually run the tests. # Useful for automated build systems, if they want to manually run the tests.

View File

@@ -8,7 +8,7 @@ If you want to help but don't know where to start, here are some
low-risk/isolated tasks: low-risk/isolated tasks:
- [Merge a Vim patch]. - [Merge a Vim patch].
- Try a [complexity:low] issue. - Try a [good first issue](../../labels/good%20first%20issue) or [complexity:low] issue.
- Fix bugs found by [Clang](#clang-scan-build), [PVS](#pvs-studio) or - Fix bugs found by [Clang](#clang-scan-build), [PVS](#pvs-studio) or
[Coverity](#coverity). [Coverity](#coverity).
@@ -65,10 +65,11 @@ 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. 1. `[RFC]` is assumed by default, **do not** put "RFC" in the PR title (it adds
- Add `[WIP]` to the PR title if you are _not_ requesting feedback and the work noise to merge commit messages).
is still in flux. 2. Add `[WIP]` to the PR title if you are _not_ requesting feedback and the work
- Add `[RDY]` if you are _done_ and only waiting on merge. is still in flux.
3. Add `[RDY]` to the PR title if you are _done_ and only waiting on merge.
### Commit messages ### Commit messages
@@ -85,7 +86,7 @@ the VCS/git logs more valuable.
### 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], [sourcehut]
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
@@ -100,14 +101,19 @@ and [AppVeyor].
- The [lint](#lint) build checks modified lines _and their immediate - The [lint](#lint) build checks modified lines _and their immediate
neighbors_, to encourage incrementally updating the legacy style to meet our neighbors_, to encourage incrementally updating the legacy style to meet our
[style](#style). (See [#3174][3174] for background.) [style](#style). (See [#3174][3174] for background.)
- [How to investigate QuickBuild failures](https://github.com/neovim/neovim/pull/4718#issuecomment-217631350) - CI for freebsd and openbsd runs on [sourcehut].
- QuickBuild uses this invocation: - To get a backtrace on freebsd (after connecting via ssh):
``` ```sh
mkdir -p build/${params.get("buildType")} \ sudo pkg install tmux # If you want tmux.
&& cd build/${params.get("buildType")} \ lldb build/bin/nvim -c nvim.core
&& cmake -G "Unix Makefiles" -DBUSTED_OUTPUT_TYPE=TAP -DCMAKE_BUILD_TYPE=${params.get("buildType")}
-DTRAVIS_CI_BUILD=ON ../.. && ${node.getAttribute("make", "make")} # To get a full backtrace:
VERBOSE=1 nvim unittest-prereqs functionaltest-prereqs # 1. Rebuild with debug info.
rm -rf nvim.core build
gmake CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_EXTRA_FLAGS="-DTRAVIS_CI_BUILD=ON -DMIN_LOG_LEVEL=3" nvim
# 2. Run the failing test to generate a new core file.
TEST_FILE=test/functional/foo.lua gmake functionaltest
lldb build/bin/nvim -c nvim.core
``` ```
### Clang scan-build ### Clang scan-build
@@ -223,7 +229,7 @@ as context, use the `-W` argument as well.
[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 [sourcehut]: https://builds.sr.ht/~jmk
[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 report]: https://neovim.io/doc/reports/clang/

View File

@@ -58,11 +58,15 @@ endif
BUILD_CMD = $(BUILD_TOOL) BUILD_CMD = $(BUILD_TOOL)
ifneq ($(VERBOSE),) # Only need to handle Ninja here. Make will inherit the VERBOSE variable, and the -j and -n flags.
# Only need to handle Ninja here. Make will inherit the VERBOSE variable. ifeq ($(BUILD_TYPE),Ninja)
ifeq ($(BUILD_TYPE),Ninja) ifneq ($(VERBOSE),)
BUILD_CMD += -v BUILD_CMD += -v
endif endif
BUILD_CMD += $(shell printf '%s' '$(MAKEFLAGS)' | grep -o -- '-j[0-9]\+')
ifeq (n,$(findstring n,$(firstword -$(MAKEFLAGS))))
BUILD_CMD += -n
endif
endif endif
DEPS_CMAKE_FLAGS ?= DEPS_CMAKE_FLAGS ?=
@@ -119,8 +123,13 @@ oldtest: | nvim build/runtime/doc/tags
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)
else else
+$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" NEW_TESTS=$(TEST_FILE) SCRIPTS= $(MAKEOVERRIDES) @# Handle TEST_FILE=test_foo{,.res,.vim}.
+$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" SCRIPTS= $(MAKEOVERRIDES) $(patsubst %.vim,%,$(patsubst %.res,%,$(TEST_FILE)))
endif endif
# Build oldtest by specifying the relative .vim filename.
.PHONY: phony_force
src/nvim/testdir/%.vim: phony_force
+$(SINGLE_MAKE) -C src/nvim/testdir NVIM_PRG="$(realpath build/bin/nvim)" SCRIPTS= $(MAKEOVERRIDES) $(patsubst src/nvim/testdir/%.vim,%,$@)
build/runtime/doc/tags helptags: | nvim build/runtime/doc/tags helptags: | nvim
+$(BUILD_CMD) -C build runtime/doc/tags +$(BUILD_CMD) -C build runtime/doc/tags
@@ -138,6 +147,14 @@ functionaltest-lua: | nvim
lualint: | build/.ran-cmake deps lualint: | build/.ran-cmake deps
$(BUILD_CMD) -C build lualint $(BUILD_CMD) -C build lualint
shlint:
@shellcheck --version | head -n 2
shellcheck scripts/vim-patch.sh
_opt_shlint:
@command -v shellcheck && { $(MAKE) shlint; exit $$?; } \
|| echo "SKIP: shlint (shellcheck not found)"
pylint: pylint:
flake8 contrib/ scripts/ src/ test/ flake8 contrib/ scripts/ src/ test/
@@ -158,6 +175,7 @@ clean:
+test -d build && $(BUILD_CMD) -C build clean || true +test -d build && $(BUILD_CMD) -C build clean || true
$(MAKE) -C src/nvim/testdir clean $(MAKE) -C src/nvim/testdir clean
$(MAKE) -C runtime/doc clean $(MAKE) -C runtime/doc clean
$(MAKE) -C runtime/indent clean
distclean: distclean:
rm -rf $(DEPS_BUILD_DIR) build rm -rf $(DEPS_BUILD_DIR) build
@@ -187,16 +205,16 @@ appimage:
appimage-%: appimage-%:
bash scripts/genappimage.sh $* bash scripts/genappimage.sh $*
lint: check-single-includes clint lualint _opt_pylint lint: check-single-includes clint lualint _opt_pylint _opt_shlint
# Generic pattern rules, allowing for `make build/bin/nvim` etc. # Generic pattern rules, allowing for `make build/bin/nvim` etc.
# Does not work with "Unix Makefiles". # Does not work with "Unix Makefiles".
ifeq ($(BUILD_TYPE),Ninja) ifeq ($(BUILD_TYPE),Ninja)
build/%: build/%: phony_force
$(BUILD_CMD) -C build $(patsubst build/%,%,$@) $(BUILD_CMD) -C build $(patsubst build/%,%,$@)
$(DEPS_BUILD_DIR)/%: $(DEPS_BUILD_DIR)/%: phony_force
$(BUILD_CMD) -C $(DEPS_BUILD_DIR) $(patsubst $(DEPS_BUILD_DIR)/%,%,$@) $(BUILD_CMD) -C $(DEPS_BUILD_DIR) $(patsubst $(DEPS_BUILD_DIR)/%,%,$@)
endif endif
.PHONY: test lualint pylint functionaltest unittest lint clint clean distclean nvim libnvim cmake deps install appimage checkprefix .PHONY: test lualint pylint shlint functionaltest unittest lint clint clean distclean nvim libnvim cmake deps install appimage checkprefix

View File

@@ -1,8 +1,7 @@
[![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-300x87.png)](https://neovim.io)
[Wiki](https://github.com/neovim/neovim/wiki) |
[Documentation](https://neovim.io/doc) | [Documentation](https://neovim.io/doc) |
[Chat/Discussion](https://gitter.im/neovim/neovim) | [Chat](https://gitter.im/neovim/neovim) |
[Twitter](https://twitter.com/Neovim) [Twitter](https://twitter.com/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)
@@ -15,6 +14,7 @@
[![Packages](https://repology.org/badge/tiny-repos/neovim.svg)](https://repology.org/metapackage/neovim) [![Packages](https://repology.org/badge/tiny-repos/neovim.svg)](https://repology.org/metapackage/neovim)
[![Debian CI](https://badges.debian.net/badges/debian/testing/neovim/version.svg)](https://buildd.debian.org/neovim) [![Debian CI](https://badges.debian.net/badges/debian/testing/neovim/version.svg)](https://buildd.debian.org/neovim)
[![Downloads](https://img.shields.io/github/downloads/neovim/neovim/total.svg?maxAge=2592001)](https://github.com/neovim/neovim/releases/) [![Downloads](https://img.shields.io/github/downloads/neovim/neovim/total.svg?maxAge=2592001)](https://github.com/neovim/neovim/releases/)
[![nvim](https://snapcraft.io//nvim/badge.svg)](https://snapcraft.io/nvim)
Neovim is a project that seeks to aggressively refactor Vim in order to: Neovim is a project that seeks to aggressively refactor Vim in order to:
@@ -67,7 +67,7 @@ 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 libutf8proc-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
@@ -113,17 +113,9 @@ Project layout
License License
------- -------
Neovim is licensed under the terms of the Apache 2.0 license, except for Neovim contributions since [b17d96][license-commit] are licensed under the
parts that were contributed under the Vim license. Apache 2.0 license, except for contributions copied from Vim (identified by the
`vim-patch` token). See LICENSE for details.
- Contributions committed before [b17d96][license-commit] remain under the Vim
license.
- Contributions committed after [b17d96][license-commit] are licensed under
Apache 2.0 unless those contributions were copied from Vim (identified in
the commit logs by the `vim-patch` token).
See `LICENSE` for details.
Vim is Charityware. You can use and copy it as much as you like, but you are Vim is Charityware. You can use and copy it as much as you like, but you are
encouraged to make a donation for needy children in Uganda. Please see the encouraged to make a donation for needy children in Uganda. Please see the

View File

@@ -22,9 +22,6 @@ init:
#- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) #- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
matrix: matrix:
fast_finish: true fast_finish: true
install: []
before_build:
- ps: Install-Product node 8
build_script: build_script:
- powershell ci\build.ps1 - powershell ci\build.ps1
after_build: after_build:
@@ -40,6 +37,3 @@ cache:
artifacts: artifacts:
- path: build/Neovim.zip - path: build/Neovim.zip
- path: build/bin/nvim.exe - path: build/bin/nvim.exe
branches:
only:
- master

View File

@@ -3,10 +3,6 @@
set -e set -e
set -o pipefail set -o pipefail
if [[ "${CI_TARGET}" == lint ]]; then
exit
fi
echo 'Python info:' echo 'Python info:'
( (
set -x set -x
@@ -26,7 +22,7 @@ if [[ "${TRAVIS_OS_NAME}" != osx ]] && command -v pyenv; then
echo 'Setting Python versions via pyenv' echo 'Setting Python versions via pyenv'
# Prefer Python 2 over 3 (more conservative). # Prefer Python 2 over 3 (more conservative).
pyenv global 2.7.15:3.7 pyenv global 2.7.15:3.7.1
echo 'Updated Python info:' echo 'Updated Python info:'
( (
@@ -47,12 +43,11 @@ if [[ "${TRAVIS_OS_NAME}" == osx ]] || [ ! -f ~/.nvm/nvm.sh ]; then
fi fi
source ~/.nvm/nvm.sh source ~/.nvm/nvm.sh
nvm install --lts nvm install 10
nvm use --lts
if [[ -n "$CMAKE_URL" ]]; then if [[ -n "$CMAKE_URL" ]]; then
echo "Installing custom CMake: $CMAKE_URL" echo "Installing custom CMake: $CMAKE_URL"
curl --retry 5 --silent --fail -o /tmp/cmake-installer.sh "$CMAKE_URL" curl --retry 5 --silent --show-error --fail -o /tmp/cmake-installer.sh "$CMAKE_URL"
mkdir -p "$HOME/.local/bin" /opt/cmake-custom mkdir -p "$HOME/.local/bin" /opt/cmake-custom
bash /tmp/cmake-installer.sh --prefix=/opt/cmake-custom --skip-license bash /tmp/cmake-installer.sh --prefix=/opt/cmake-custom --skip-license
ln -sfn /opt/cmake-custom/bin/cmake "$HOME/.local/bin/cmake" ln -sfn /opt/cmake-custom/bin/cmake "$HOME/.local/bin/cmake"

View File

@@ -10,6 +10,12 @@ fi
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${CI_DIR}/common/build.sh" source "${CI_DIR}/common/build.sh"
# Enable ipv6 on Travis. ref: a39c8b7ce30d
if ! test "${TRAVIS_OS_NAME}" = osx ; then
echo "before_script.sh: enable ipv6"
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
fi
# Test some of the configuration variables. # Test some of the configuration variables.
if [[ -n "${GCOV}" ]] && [[ ! $(type -P "${GCOV}") ]]; then if [[ -n "${GCOV}" ]] && [[ ! $(type -P "${GCOV}") ]]; then
echo "\$GCOV: '${GCOV}' is not executable." echo "\$GCOV: '${GCOV}' is not executable."
@@ -35,5 +41,10 @@ fi
# Compile dependencies. # Compile dependencies.
build_deps build_deps
# Install cluacov for Lua coverage.
if [[ "$USE_LUACOV" == 1 ]]; then
"${DEPS_BUILD_DIR}/usr/bin/luarocks" install cluacov
fi
rm -rf "${LOG_DIR}" rm -rf "${LOG_DIR}"
mkdir -p "${LOG_DIR}" mkdir -p "${LOG_DIR}"

View File

@@ -1,10 +1,12 @@
$ErrorActionPreference = 'stop' param([switch]$NoTests)
Set-PSDebug -Strict -Trace 1 Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
$isPullRequest = ($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT -ne $null) $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 = if ($Matches -contains 'option') {$Matches.option} else {''}
$bits = $Matches.bits $bits = $Matches.bits
$cmakeBuildType = $(if ($env:CMAKE_BUILD_TYPE -ne $null) {$env:CMAKE_BUILD_TYPE} else {'RelWithDebInfo'}); $cmakeBuildType = $(if ($env:CMAKE_BUILD_TYPE -ne $null) {$env:CMAKE_BUILD_TYPE} else {'RelWithDebInfo'});
$buildDir = [System.IO.Path]::GetFullPath("$(pwd)") $buildDir = [System.IO.Path]::GetFullPath("$(pwd)")
@@ -23,11 +25,33 @@ $uploadToCodeCov = $false
function exitIfFailed() { function exitIfFailed() {
if ($LastExitCode -ne 0) { if ($LastExitCode -ne 0) {
Set-PSDebug -Off
exit $LastExitCode exit $LastExitCode
} }
} }
# https://github.com/lukesampson/scoop#installation
$scoop = (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
& {
Set-StrictMode -Off
Invoke-Expression $scoop
}
scoop install perl
perl --version
cpanm.bat --version
if (-not $NoTests) {
scoop install nodejs-lts
node --version
npm.cmd --version
cpanm.bat -n Neovim::Ext
if ($LastExitCode -ne 0) {
Get-Content -Path "$env:USERPROFILE\.cpanm\build.log"
}
perl -W -e 'use Neovim::Ext; print $Neovim::Ext::VERSION'; exitIfFailed
}
if (-Not (Test-Path -PathType container $env:DEPS_BUILD_DIR)) { if (-Not (Test-Path -PathType container $env:DEPS_BUILD_DIR)) {
write-host "cache dir not found: $($env:DEPS_BUILD_DIR)" write-host "cache dir not found: $($env:DEPS_BUILD_DIR)"
mkdir $env:DEPS_BUILD_DIR mkdir $env:DEPS_BUILD_DIR
@@ -46,13 +70,17 @@ if ($compiler -eq 'MINGW') {
$nvimCmakeVars['USE_GCOV'] = 'ON' $nvimCmakeVars['USE_GCOV'] = 'ON'
$uploadToCodecov = $true $uploadToCodecov = $true
$env:GCOV = "C:\msys64\mingw$bits\bin\gcov" $env:GCOV = "C:\msys64\mingw$bits\bin\gcov"
# Setup/build Lua coverage.
$env:USE_LUACOV = 1
$env:BUSTED_ARGS = "--coverage"
} }
# 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', 'diffutils').ForEach({
"mingw-w64-$arch-$_" "mingw-w64-$arch-$_"
}) })
@@ -76,23 +104,30 @@ elseif ($compiler -eq 'MSVC') {
} }
} }
# Setup python (use AppVeyor system python) if (-not $NoTests) {
C:\Python27\python.exe -m pip install pynvim ; exitIfFailed # Setup python (use AppVeyor system python)
C:\Python35\python.exe -m pip install pynvim ; exitIfFailed C:\Python27\python.exe -m pip install pynvim ; exitIfFailed
# Disambiguate python3 C:\Python35\python.exe -m pip install pynvim ; exitIfFailed
move c:\Python35\python.exe c:\Python35\python3.exe # Disambiguate python3
$env:PATH = "C:\Python35;C:\Python27;$env:PATH" move c:\Python35\python.exe c:\Python35\python3.exe
# Sanity check $env:PATH = "C:\Python35;C:\Python27;$env:PATH"
python -c "import pynvim; print(str(pynvim))" ; exitIfFailed # Sanity check
python3 -c "import pynvim; print(str(pynvim))" ; exitIfFailed python -c "import pynvim; print(str(pynvim))" ; exitIfFailed
python3 -c "import pynvim; print(str(pynvim))" ; exitIfFailed
$env:PATH = "C:\Ruby24\bin;$env:PATH" $env:PATH = "C:\Ruby24\bin;$env:PATH"
gem.cmd install neovim gem.cmd install neovim
Get-Command -CommandType Application neovim-ruby-host.bat Get-Command -CommandType Application neovim-ruby-host.bat
npm.cmd install -g neovim npm.cmd install -g neovim
Get-Command -CommandType Application neovim-node-host.cmd Get-Command -CommandType Application neovim-node-host.cmd
npm.cmd link neovim npm.cmd link neovim
}
if ($compiler -eq 'MSVC') {
# Required for LuaRocks (https://github.com/luarocks/luarocks/issues/1039#issuecomment-507296940).
$env:VCINSTALLDIR = "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/"
}
function convertToCmakeArgs($vars) { function convertToCmakeArgs($vars) {
return $vars.GetEnumerator() | foreach { "-D$($_.Key)=$($_.Value)" } return $vars.GetEnumerator() | foreach { "-D$($_.Key)=$($_.Value)" }
@@ -113,37 +148,42 @@ cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed
# Ensure that the "win32" feature is set. # Ensure that the "win32" feature is set.
.\bin\nvim -u NONE --headless -c 'exe !has(\"win32\").\"cq\"' ; exitIfFailed .\bin\nvim -u NONE --headless -c 'exe !has(\"win32\").\"cq\"' ; exitIfFailed
# Functional tests if ($env:USE_LUACOV -eq 1) {
# The $LastExitCode from MSBuild can't be trusted & $env:DEPS_PREFIX\luarocks\luarocks.bat install cluacov
$failed = $false }
# Temporarily turn off tracing to reduce log file output
Set-PSDebug -Off if (-not $NoTests) {
cmake --build . --config $cmakeBuildType --target functionaltest -- $cmakeGeneratorArgs 2>&1 | # Functional tests
foreach { $failed = $failed -or # The $LastExitCode from MSBuild can't be trusted
$_ -match 'functional tests failed with error'; $_ } $failed = $false
if ($failed) {
# Run only this test file:
# $env:TEST_FILE = "test\functional\foo.lua"
cmake --build . --config $cmakeBuildType --target functionaltest -- $cmakeGeneratorArgs 2>&1 |
foreach { $failed = $failed -or
$_ -match 'functional tests failed with error'; $_ }
if ($uploadToCodecov) { if ($uploadToCodecov) {
if ($env:USE_LUACOV -eq 1) {
& $env:DEPS_PREFIX\bin\luacov.bat
}
bash -l /c/projects/neovim/ci/common/submit_coverage.sh functionaltest bash -l /c/projects/neovim/ci/common/submit_coverage.sh functionaltest
} }
exit $LastExitCode if ($failed) {
} exit $LastExitCode
Set-PSDebug -Strict -Trace 1 }
# Old tests
# Add MSYS to path, required for e.g. `find` used in test scripts.
# But would break functionaltests, where its `more` would be used then.
$OldPath = $env:PATH
$env:PATH = "C:\msys64\usr\bin;$env:PATH"
& "C:\msys64\mingw$bits\bin\mingw32-make.exe" -C $(Convert-Path ..\src\nvim\testdir) VERBOSE=1 ; exitIfFailed
$env:PATH = $OldPath
if ($uploadToCodecov) { if ($uploadToCodecov) {
bash -l /c/projects/neovim/ci/common/submit_coverage.sh functionaltest bash -l /c/projects/neovim/ci/common/submit_coverage.sh oldtest
} }
# Old tests
# Add MSYS to path, required for e.g. `find` used in test scripts.
# But would break functionaltests, where its `more` would be used then.
$OldPath = $env:PATH
$env:PATH = "C:\msys64\usr\bin;$env:PATH"
& "C:\msys64\mingw$bits\bin\mingw32-make.exe" -C $(Convert-Path ..\src\nvim\testdir) VERBOSE=1 ; exitIfFailed
$env:PATH = $OldPath
if ($uploadToCodecov) {
bash -l /c/projects/neovim/ci/common/submit_coverage.sh oldtest
} }
# Build artifacts # Build artifacts

View File

@@ -18,9 +18,6 @@ build_make() {
} }
build_deps() { build_deps() {
if test "${BUILD_32BIT}" = ON ; then
DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} ${CMAKE_FLAGS_32BIT}"
fi
if test "${FUNCTIONALTEST}" = "functionaltest-lua" \ if test "${FUNCTIONALTEST}" = "functionaltest-lua" \
|| test "${CLANG_SANITIZER}" = "ASAN_UBSAN" ; then || test "${CLANG_SANITIZER}" = "ASAN_UBSAN" ; then
DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} -DUSE_BUNDLED_LUA=ON" DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} -DUSE_BUNDLED_LUA=ON"
@@ -53,9 +50,6 @@ prepare_build() {
if test -n "${CLANG_SANITIZER}" ; then if test -n "${CLANG_SANITIZER}" ; then
CMAKE_FLAGS="${CMAKE_FLAGS} -DCLANG_${CLANG_SANITIZER}=ON" CMAKE_FLAGS="${CMAKE_FLAGS} -DCLANG_${CLANG_SANITIZER}=ON"
fi fi
if test "${BUILD_32BIT}" = ON ; then
CMAKE_FLAGS="${CMAKE_FLAGS} ${CMAKE_FLAGS_32BIT}"
fi
mkdir -p "${BUILD_DIR}" mkdir -p "${BUILD_DIR}"
cd "${BUILD_DIR}" cd "${BUILD_DIR}"
@@ -92,12 +86,3 @@ build_nvim() {
cd "${TRAVIS_BUILD_DIR}" cd "${TRAVIS_BUILD_DIR}"
} }
macos_rvm_dance() {
# neovim-ruby gem requires a ruby newer than the macOS default.
source ~/.rvm/scripts/rvm
rvm get stable --auto-dotfiles
rvm reload
rvm use 2.2.5
rvm use
}

View File

@@ -43,3 +43,14 @@ fi
# Cleanup always, especially collected data. # Cleanup always, especially collected data.
find . \( -name '*.gcov' -o -name '*.gcda' \) -ls -delete | wc -l find . \( -name '*.gcov' -o -name '*.gcda' \) -ls -delete | wc -l
rm -f coverage.xml rm -f coverage.xml
# Upload Lua coverage (generated manually on AppVeyor/Windows).
if [ "$USE_LUACOV" = 1 ] && [ "$1" != "oldtest" ]; then
if [ -x "${DEPS_BUILD_DIR}/usr/bin/luacov" ]; then
"${DEPS_BUILD_DIR}/usr/bin/luacov"
fi
if ! "$codecov_sh" -f luacov.report.out -X gcov -X fix -Z -F "lua,${codecov_flags}"; then
echo "codecov upload failed."
fi
rm luacov.stats.out
fi

View File

@@ -4,7 +4,7 @@ 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 python3 -m pip -q install --user --upgrade flake8
exit exit
fi fi
@@ -14,13 +14,18 @@ fi
# Use default CC to avoid compilation problems when installing Python modules. # 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 CC=cc python3 -m pip -q install --user --upgrade pynvim
echo "Install neovim module for Python 2." echo "Install neovim module for Python 2."
CC=cc python2 -m pip -q install --upgrade pynvim CC=cc python2 -m pip -q install --user --upgrade pynvim
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
echo "Install neovim npm package" echo "Install neovim npm package"
source ~/.nvm/nvm.sh
nvm use 10
npm install -g neovim npm install -g neovim
npm link neovim npm link neovim
sudo cpanm -n Neovim::Ext || cat "$HOME/.cpanm/build.log"
perl -W -e 'use Neovim::Ext; print $Neovim::Ext::VERSION'

View File

@@ -20,6 +20,10 @@ enter_suite 'pylint'
run_test 'make pylint' pylint run_test 'make pylint' pylint
exit_suite --continue exit_suite --continue
enter_suite 'shlint'
run_test 'make shlint' shlint
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 \

View File

@@ -17,6 +17,10 @@ build_nvim
exit_suite --continue exit_suite --continue
source ~/.nvm/nvm.sh
nvm use 10
enter_suite tests enter_suite tests
if test "$CLANG_SANITIZER" != "TSAN" ; then if test "$CLANG_SANITIZER" != "TSAN" ; then

14
ci/snap/after_success.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -e
set -o pipefail
RESULT_SNAP=$(find ./ -name "*.snap")
sudo snap install "$RESULT_SNAP" --dangerous --classic
/snap/bin/nvim --version
SHA256=$(sha256sum "$RESULT_SNAP")
echo "SHA256: ${SHA256} ."

21
ci/snap/deploy.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -e
set -o pipefail
# not a tagged release, abort
# [[ "$TRAVIS_TAG" != "$TRAVIS_BRANCH" ]] && exit 0
mkdir -p .snapcraft
# shellcheck disable=SC2154
openssl aes-256-cbc -K "$encrypted_ece1c4844832_key" -iv "$encrypted_ece1c4844832_iv" \
-in ci/snap/travis_snapcraft.cfg -out .snapcraft/snapcraft.cfg -d
SNAP=$(find ./ -name "*.snap")
# TODO(justinmk): This always does `edge` until we enable tagged builds.
if [[ "$SNAP" =~ "dirty" || "$SNAP" =~ "nightly" ]]; then
snapcraft push "$SNAP" --release edge
else
snapcraft push "$SNAP" --release candidate
fi

10
ci/snap/install.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e
set -o pipefail
sudo apt update
sudo /snap/bin/lxd.migrate -yes
sudo /snap/bin/lxd waitready
sudo /snap/bin/lxd init --auto

8
ci/snap/script.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -e
set -o pipefail
mkdir -p "$TRAVIS_BUILD_DIR/snaps-cache"
sudo snapcraft --use-lxd

Binary file not shown.

View File

@@ -38,6 +38,9 @@ endif()
if (LibIntl_LIBRARY) if (LibIntl_LIBRARY)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${LibIntl_LIBRARY}") list(APPEND CMAKE_REQUIRED_LIBRARIES "${LibIntl_LIBRARY}")
endif() endif()
if (MSVC)
list(APPEND CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY})
endif()
check_c_source_compiles(" check_c_source_compiles("
#include <libintl.h> #include <libintl.h>
@@ -48,6 +51,9 @@ 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) if (LibIntl_INCLUDE_DIR)
list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${LibIntl_INCLUDE_DIR}") list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${LibIntl_INCLUDE_DIR}")
endif() endif()

View File

@@ -3,6 +3,13 @@ function(get_compile_flags _compile_flags)
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> <COMPILE_OPTIONS><COMPILE_DEFINITIONS> <INCLUDES>")
# Get C compiler. # Get C compiler.
if(CMAKE_C_COMPILER_ARG1)
string(REPLACE
"<CMAKE_C_COMPILER>"
"<CMAKE_C_COMPILER> ${CMAKE_C_COMPILER_ARG1}"
compile_flags
"${compile_flags}")
endif()
string(REPLACE string(REPLACE
"<CMAKE_C_COMPILER>" "<CMAKE_C_COMPILER>"
"${CMAKE_C_COMPILER}" "${CMAKE_C_COMPILER}"

View File

@@ -1,180 +0,0 @@
# https://github.com/rpavlik/cmake-modules
#
# - Returns a version string from Git
#
# These functions force a re-configure on each git commit so that you can
# trust the values of the variables in your build system.
#
# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
#
# Returns the refspec and sha hash of the current head revision
#
# git_describe(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe on the source tree, and adjusting
# the output so that it tests false if an error occurs.
#
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe --exact-match on the source tree,
# and adjusting the output so that it tests false if there was no exact
# matching tag.
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__get_git_revision_description)
return()
endif()
set(__get_git_revision_description YES)
# We must run the following at "include" time, not at function call time,
# to find the path to this module rather than the path to a calling list file
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
function(get_git_dir _gitdir)
# check FORCED_GIT_DIR first
if(FORCED_GIT_DIR)
set(${_gitdir} ${FORCED_GIT_DIR} PARENT_SCOPE)
return()
endif()
# check GIT_DIR in environment
set(GIT_DIR $ENV{GIT_DIR})
if(NOT GIT_DIR)
set(GIT_PARENT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(GIT_DIR ${GIT_PARENT_DIR}/.git)
endif()
# .git dir not found, search parent directories
while(NOT EXISTS ${GIT_DIR})
set(GIT_PREVIOUS_PARENT ${GIT_PARENT_DIR})
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
return()
endif()
set(GIT_DIR ${GIT_PARENT_DIR}/.git)
endwhile()
# check if this is a submodule
if(NOT IS_DIRECTORY ${GIT_DIR})
file(READ ${GIT_DIR} submodule)
string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
endif()
set(${_gitdir} ${GIT_DIR} PARENT_SCOPE)
endfunction()
function(get_git_head_revision _refspecvar _hashvar)
get_git_dir(GIT_DIR)
if(NOT GIT_DIR)
return()
endif()
set(GIT_DATA ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data)
if(NOT EXISTS ${GIT_DATA})
file(MAKE_DIRECTORY ${GIT_DATA})
endif()
if(NOT EXISTS ${GIT_DIR}/HEAD)
return()
endif()
set(HEAD_FILE ${GIT_DATA}/HEAD)
configure_file(${GIT_DIR}/HEAD ${HEAD_FILE} COPYONLY)
configure_file(${_gitdescmoddir}/GetGitRevisionDescription.cmake.in
${GIT_DATA}/grabRef.cmake
@ONLY)
include(${GIT_DATA}/grabRef.cmake)
set(${_refspecvar} ${HEAD_REF} PARENT_SCOPE)
set(${_hashvar} ${HEAD_HASH} PARENT_SCOPE)
endfunction()
function(git_describe _var)
get_git_dir(GIT_DIR)
if(NOT GIT_DIR)
return()
endif()
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
if(NOT GIT_FOUND)
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
return()
endif()
get_git_head_revision(refspec hash)
if(NOT hash)
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
return()
endif()
execute_process(COMMAND
${GIT_EXECUTABLE}
describe
${hash}
${ARGN}
WORKING_DIRECTORY
${GIT_DIR}
RESULT_VARIABLE
res
OUTPUT_VARIABLE
out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var} ${out} PARENT_SCOPE)
endfunction()
function(git_timestamp _var)
get_git_dir(GIT_DIR)
if(NOT GIT_DIR)
return()
endif()
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
if(NOT GIT_FOUND)
return()
endif()
get_git_head_revision(refspec hash)
if(NOT hash)
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
return()
endif()
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format="%ci" ${hash} ${ARGN}
WORKING_DIRECTORY ${GIT_DIR}
RESULT_VARIABLE res
OUTPUT_VARIABLE out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(res EQUAL 0)
string(REGEX REPLACE "[-\" :]" "" out ${out})
string(SUBSTRING ${out} 0 12 out)
else()
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var} ${out} PARENT_SCOPE)
endfunction()
function(git_get_exact_tag _var)
git_describe(out --exact-match ${ARGN})
set(${_var} ${out} PARENT_SCOPE)
endfunction()

View File

@@ -1,38 +0,0 @@
#
# Internal file for GetGitRevisionDescription.cmake
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
set(HEAD_HASH)
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
if(HEAD_CONTENTS MATCHES "ref")
# named branch
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
elseif(EXISTS "@GIT_DIR@/logs/${HEAD_REF}")
configure_file("@GIT_DIR@/logs/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
set(HEAD_HASH "${HEAD_REF}")
endif()
else()
# detached HEAD
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
endif()
if(NOT HEAD_HASH)
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
string(STRIP "${HEAD_HASH}" HEAD_HASH)
endif()

View File

@@ -25,3 +25,6 @@ coverage:
changes: no changes: no
comment: off comment: off
ignore:
- "src/tree_sitter"

View File

@@ -12,7 +12,7 @@ check_type_size("size_t" SIZEOF_SIZE_T)
check_type_size("long long" SIZEOF_LONG_LONG) check_type_size("long long" SIZEOF_LONG_LONG)
check_type_size("void *" SIZEOF_VOID_PTR) check_type_size("void *" SIZEOF_VOID_PTR)
if (CMAKE_HOST_SYSTEM_VERSION MATCHES ".*-Microsoft") if (CMAKE_HOST_SYSTEM_VERSION MATCHES ".*-(Microsoft|microsoft-standard)")
# Windows Subsystem for Linux # Windows Subsystem for Linux
set(HAVE_WSL 1) set(HAVE_WSL 1)
endif() endif()

View File

@@ -3,5 +3,6 @@
#include "${PROJECT_SOURCE_DIR}/src/nvim/vim.h" #include "${PROJECT_SOURCE_DIR}/src/nvim/vim.h"
char *default_vim_dir = "${CMAKE_INSTALL_FULL_DATAROOTDIR}/nvim"; char *default_vim_dir = "${CMAKE_INSTALL_FULL_DATAROOTDIR}/nvim";
char *default_vimruntime_dir = ""; char *default_vimruntime_dir = "";
char *default_lib_dir = "${CMAKE_INSTALL_FULL_LIBDIR}/nvim";
char_u *compiled_user = (char_u *)"${USERNAME}"; char_u *compiled_user = (char_u *)"${USERNAME}";
char_u *compiled_sys = (char_u *)"${HOSTNAME}"; char_u *compiled_sys = (char_u *)"${HOSTNAME}";

View File

@@ -5,7 +5,11 @@
#define NVIM_VERSION_MINOR @NVIM_VERSION_MINOR@ #define NVIM_VERSION_MINOR @NVIM_VERSION_MINOR@
#define NVIM_VERSION_PATCH @NVIM_VERSION_PATCH@ #define NVIM_VERSION_PATCH @NVIM_VERSION_PATCH@
#define NVIM_VERSION_PRERELEASE "@NVIM_VERSION_PRERELEASE@" #define NVIM_VERSION_PRERELEASE "@NVIM_VERSION_PRERELEASE@"
#cmakedefine NVIM_VERSION_MEDIUM "@NVIM_VERSION_MEDIUM@" #cmakedefine NVIM_VERSION_MEDIUM "@NVIM_VERSION_MEDIUM@"
#ifndef NVIM_VERSION_MEDIUM
# include "auto/versiondef_git.h"
#endif
#define NVIM_API_LEVEL @NVIM_API_LEVEL@ #define NVIM_API_LEVEL @NVIM_API_LEVEL@
#define NVIM_API_LEVEL_COMPAT @NVIM_API_LEVEL_COMPAT@ #define NVIM_API_LEVEL_COMPAT @NVIM_API_LEVEL_COMPAT@

View File

@@ -25,6 +25,12 @@
# #
# CMAKE_BUILD_TYPE := Debug # CMAKE_BUILD_TYPE := Debug
# With non-Debug builds interprocedural optimization (IPO) (which includes
# link-time optimization (LTO)) is enabled by default, which causes the link
# step to take a significant amout of time, which is relevant when building
# often. You can disable it explicitly:
# CMAKE_EXTRA_FLAGS += -DENABLE_LTO=OFF
# Log levels: 0 (DEBUG), 1 (INFO), 2 (WARNING), 3 (ERROR) # Log levels: 0 (DEBUG), 1 (INFO), 2 (WARNING), 3 (ERROR)
# Default is 1 (INFO) unless CMAKE_BUILD_TYPE is Release or RelWithDebInfo. # Default is 1 (INFO) unless CMAKE_BUILD_TYPE is Release or RelWithDebInfo.
# CMAKE_EXTRA_FLAGS += -DMIN_LOG_LEVEL=1 # CMAKE_EXTRA_FLAGS += -DMIN_LOG_LEVEL=1
@@ -42,6 +48,7 @@
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_LUAROCKS=OFF # DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_LUAROCKS=OFF
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_MSGPACK=OFF # DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_MSGPACK=OFF
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_UNIBILIUM=OFF # DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_UNIBILIUM=OFF
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_UTF8PROC=OFF
# #
# Or disable all bundled dependencies at once. # Or disable all bundled dependencies at once.
# #

View File

@@ -378,7 +378,7 @@ See also
System-global System-global
.Nm .Nm
configuration file. configuration file.
.It Pa /usr/local/share/nvim .It Pa $VIM
System-global System-global
.Nm .Nm
runtime directory. runtime directory.

View File

@@ -129,6 +129,25 @@ function! s:check_performance() abort
endif endif
endfunction endfunction
function! s:get_tmux_option(option) abort
let cmd = 'tmux show-option -qvg '.a:option " try global scope
let out = system(cmd)
let val = substitute(out, '\v(\s|\r|\n)', '', 'g')
if v:shell_error
call health#report_error('command failed: '.cmd."\n".out)
return 'error'
elseif empty(val)
let cmd = 'tmux show-option -qvgs '.a:option " try session scope
let out = system(cmd)
let val = substitute(out, '\v(\s|\r|\n)', '', 'g')
if v:shell_error
call health#report_error('command failed: '.cmd."\n".out)
return 'error'
endif
endif
return val
endfunction
function! s:check_tmux() abort function! s:check_tmux() abort
if empty($TMUX) || !executable('tmux') if empty($TMUX) || !executable('tmux')
return return
@@ -136,20 +155,31 @@ function! s:check_tmux() abort
call health#report_start('tmux') call health#report_start('tmux')
" check escape-time " check escape-time
let suggestions = ["Set escape-time in ~/.tmux.conf:\nset-option -sg escape-time 10", let suggestions = ["set escape-time in ~/.tmux.conf:\nset-option -sg escape-time 10",
\ s:suggest_faq] \ s:suggest_faq]
let cmd = 'tmux show-option -qvgs escape-time' let tmux_esc_time = s:get_tmux_option('escape-time')
let out = system(cmd) if tmux_esc_time !=# 'error'
let tmux_esc_time = substitute(out, '\v(\s|\r|\n)', '', 'g') if empty(tmux_esc_time)
if v:shell_error call health#report_error('`escape-time` is not set', suggestions)
call health#report_error('command failed: '.cmd."\n".out) elseif tmux_esc_time > 300
elseif empty(tmux_esc_time) call health#report_error(
call health#report_error('escape-time is not set', suggestions) \ '`escape-time` ('.tmux_esc_time.') is higher than 300ms', suggestions)
elseif tmux_esc_time > 300 else
call health#report_error( call health#report_ok('escape-time: '.tmux_esc_time)
\ 'escape-time ('.tmux_esc_time.') is higher than 300ms', suggestions) endif
else endif
call health#report_ok('escape-time: '.tmux_esc_time.'ms')
" check focus-events
let suggestions = ["(tmux 1.9+ only) Set `focus-events` in ~/.tmux.conf:\nset-option -g focus-events on"]
let tmux_focus_events = s:get_tmux_option('focus-events')
call health#report_info('Checking stuff')
if tmux_focus_events !=# 'error'
if empty(tmux_focus_events) || tmux_focus_events !=# 'on'
call health#report_warn(
\ "`focus-events` is not enabled. |'autoread'| may not work.", suggestions)
else
call health#report_ok('focus-events: '.tmux_focus_events)
endif
endif endif
" check default-terminal and $TERM " check default-terminal and $TERM
@@ -203,9 +233,9 @@ function! s:check_terminal() abort
call health#report_error('command failed: '.cmd."\n".out) call health#report_error('command failed: '.cmd."\n".out)
else else
call health#report_info('key_backspace (kbs) terminfo entry: ' call health#report_info('key_backspace (kbs) terminfo entry: '
\ .(empty(kbs_entry) ? '? (not found)' : kbs_entry)) \ .(empty(kbs_entry) ? '? (not found)' : kbs_entry))
call health#report_info('key_dc (kdch1) terminfo entry: ' call health#report_info('key_dc (kdch1) terminfo entry: '
\ .(empty(kbs_entry) ? '? (not found)' : kdch1_entry)) \ .(empty(kbs_entry) ? '? (not found)' : kdch1_entry))
endif endif
for env_var in ['XTERM_VERSION', 'VTE_VERSION', 'TERM_PROGRAM', 'COLORTERM', 'SSH_TTY'] for env_var in ['XTERM_VERSION', 'VTE_VERSION', 'TERM_PROGRAM', 'COLORTERM', 'SSH_TTY']
if exists('$'.env_var) if exists('$'.env_var)

View File

@@ -38,9 +38,10 @@ endfunction
" Handler for s:system() function. " Handler for s:system() function.
function! s:system_handler(jobid, data, event) dict abort function! s:system_handler(jobid, data, event) dict abort
if a:event ==# 'stderr' if a:event ==# 'stderr'
let self.stderr .= join(a:data, '') if self.add_stderr_to_output
if !self.ignore_stderr
let self.output .= join(a:data, '') let self.output .= join(a:data, '')
else
let self.stderr .= join(a:data, '')
endif endif
elseif a:event ==# 'stdout' elseif a:event ==# 'stdout'
let self.output .= join(a:data, '') let self.output .= join(a:data, '')
@@ -64,7 +65,7 @@ function! s:system(cmd, ...) abort
let stdin = a:0 ? a:1 : '' let stdin = a:0 ? a:1 : ''
let ignore_error = a:0 > 2 ? a:3 : 0 let ignore_error = a:0 > 2 ? a:3 : 0
let opts = { let opts = {
\ 'ignore_stderr': a:0 > 1 ? a:2 : 0, \ 'add_stderr_to_output': a:0 > 1 ? a:2 : 0,
\ 'output': '', \ 'output': '',
\ 'stderr': '', \ 'stderr': '',
\ 'on_stdout': function('s:system_handler'), \ 'on_stdout': function('s:system_handler'),
@@ -89,8 +90,15 @@ function! s:system(cmd, ...) abort
call health#report_error(printf('Command timed out: %s', s:shellify(a:cmd))) call health#report_error(printf('Command timed out: %s', s:shellify(a:cmd)))
call jobstop(jobid) call jobstop(jobid)
elseif s:shell_error != 0 && !ignore_error elseif s:shell_error != 0 && !ignore_error
call health#report_error(printf("Command error (job=%d, exit code %d): `%s` (in %s)\nOutput: %s\nStderr: %s", let emsg = printf("Command error (job=%d, exit code %d): `%s` (in %s)",
\ jobid, s:shell_error, s:shellify(a:cmd), string(getcwd()), opts.output, opts.stderr)) \ jobid, s:shell_error, s:shellify(a:cmd), string(getcwd()))
if !empty(opts.output)
let emsg .= "\noutput: " . opts.output
end
if !empty(opts.stderr)
let emsg .= "\nstderr: " . opts.stderr
end
call health#report_error(emsg)
endif endif
return opts.output return opts.output
@@ -155,7 +163,7 @@ function! s:check_clipboard() abort
endif endif
endfunction endfunction
" Get the latest Neovim Python client (pynvim) version from PyPI. " Get the latest Nvim Python client (pynvim) version from PyPI.
function! s:latest_pypi_version() abort function! s:latest_pypi_version() abort
let pypi_version = 'unable to get pypi response' let pypi_version = 'unable to get pypi response'
let pypi_response = s:download('https://pypi.python.org/pypi/pynvim/json') let pypi_response = s:download('https://pypi.python.org/pypi/pynvim/json')
@@ -172,7 +180,7 @@ endfunction
" Get version information using the specified interpreter. The interpreter is " Get version information using the specified interpreter. The interpreter is
" used directly in case breaking changes were introduced since the last time " used directly in case breaking changes were introduced since the last time
" Neovim's Python client was updated. " Nvim's Python client was updated.
" "
" Returns: [ " Returns: [
" {python executable version}, " {python executable version},
@@ -194,7 +202,8 @@ function! s:version_info(python) abort
let nvim_path = s:trim(s:system([ let nvim_path = s:trim(s:system([
\ a:python, '-c', \ a:python, '-c',
\ 'import sys; sys.path.remove(""); ' . \ 'import sys; ' .
\ 'sys.path = list(filter(lambda x: x != "", sys.path)); ' .
\ 'import neovim; print(neovim.__file__)'])) \ 'import neovim; print(neovim.__file__)']))
if s:shell_error || empty(nvim_path) if s:shell_error || empty(nvim_path)
return [python_version, 'unable to load neovim Python module', pypi_version, return [python_version, 'unable to load neovim Python module', pypi_version,
@@ -215,7 +224,7 @@ function! s:version_info(python) abort
\ 'print("{}.{}.{}{}".format(v.major, v.minor, v.patch, v.prerelease))'], \ 'print("{}.{}.{}{}".format(v.major, v.minor, v.patch, v.prerelease))'],
\ '', 1, 1) \ '', 1, 1)
if empty(nvim_version) if empty(nvim_version)
let nvim_version = 'unable to find neovim Python module version' let nvim_version = 'unable to find pynvim module version'
let base = fnamemodify(nvim_path, ':h') let base = fnamemodify(nvim_path, ':h')
let metas = glob(base.'-*/METADATA', 1, 1) let metas = glob(base.'-*/METADATA', 1, 1)
\ + glob(base.'-*/PKG-INFO', 1, 1) \ + glob(base.'-*/PKG-INFO', 1, 1)
@@ -257,6 +266,22 @@ function! s:check_bin(bin) abort
return 1 return 1
endfunction endfunction
" Check "loaded" var for given a:provider.
" Returns 1 if the caller should return (skip checks).
function! s:disabled_via_loaded_var(provider) abort
let loaded_var = 'g:loaded_'.a:provider.'_provider'
if exists(loaded_var) && !exists('*provider#'.a:provider.'#Call')
let v = eval(loaded_var)
if 0 is v
call health#report_info('Disabled ('.loaded_var.'='.v.').')
return 1
else
call health#report_info('Disabled ('.loaded_var.'='.v.'). This might be due to some previous error.')
endif
endif
return 0
endfunction
function! s:check_python(version) abort function! s:check_python(version) abort
call health#report_start('Python ' . a:version . ' provider (optional)') call health#report_start('Python ' . a:version . ' provider (optional)')
@@ -264,11 +289,10 @@ function! s:check_python(version) abort
let python_exe = '' let python_exe = ''
let venv = exists('$VIRTUAL_ENV') ? resolve($VIRTUAL_ENV) : '' let venv = exists('$VIRTUAL_ENV') ? resolve($VIRTUAL_ENV) : ''
let host_prog_var = pyname.'_host_prog' let host_prog_var = pyname.'_host_prog'
let loaded_var = 'g:loaded_'.pyname.'_provider'
let python_multiple = [] let python_multiple = []
if exists(loaded_var) && !exists('*provider#'.pyname.'#Call') if s:disabled_via_loaded_var(pyname)
call health#report_info('Disabled ('.loaded_var.'='.eval(loaded_var).'). This might be due to some previous error.') return
endif endif
let [pyenv, pyenv_root] = s:check_for_pyenv() let [pyenv, pyenv_root] = s:check_for_pyenv()
@@ -286,7 +310,7 @@ function! s:check_python(version) abort
let python_exe = pyname let python_exe = pyname
endif endif
" No Python executable could `import neovim`. " No Python executable could `import neovim`, or host_prog_var was used.
if !empty(pythonx_errors) if !empty(pythonx_errors)
call health#report_error('Python provider error:', pythonx_errors) call health#report_error('Python provider error:', pythonx_errors)
@@ -339,7 +363,7 @@ function! s:check_python(version) abort
\ && !empty(pyenv_root) && resolve(python_exe) !~# '^'.pyenv_root.'/' \ && !empty(pyenv_root) && resolve(python_exe) !~# '^'.pyenv_root.'/'
call health#report_warn('pyenv is not set up optimally.', [ call health#report_warn('pyenv is not set up optimally.', [
\ printf('Create a virtualenv specifically ' \ printf('Create a virtualenv specifically '
\ . 'for Neovim using pyenv, and set `g:%s`. This will avoid ' \ . 'for Nvim using pyenv, and set `g:%s`. This will avoid '
\ . 'the need to install the pynvim module in each ' \ . 'the need to install the pynvim module in each '
\ . 'version/virtualenv.', host_prog_var) \ . 'version/virtualenv.', host_prog_var)
\ ]) \ ])
@@ -353,7 +377,7 @@ function! s:check_python(version) abort
if resolve(python_exe) !~# '^'.venv_root.'/' if resolve(python_exe) !~# '^'.venv_root.'/'
call health#report_warn('Your virtualenv is not set up optimally.', [ call health#report_warn('Your virtualenv is not set up optimally.', [
\ printf('Create a virtualenv specifically ' \ printf('Create a virtualenv specifically '
\ . 'for Neovim and use `g:%s`. This will avoid ' \ . 'for Nvim and use `g:%s`. This will avoid '
\ . 'the need to install the pynvim module in each ' \ . 'the need to install the pynvim module in each '
\ . 'virtualenv.', host_prog_var) \ . 'virtualenv.', host_prog_var)
\ ]) \ ])
@@ -368,18 +392,6 @@ function! s:check_python(version) abort
let python_exe = '' let python_exe = ''
endif endif
" Check if $VIRTUAL_ENV is valid.
if exists('$VIRTUAL_ENV') && !empty(python_exe)
if $VIRTUAL_ENV ==# matchstr(python_exe, '^\V'.$VIRTUAL_ENV)
call health#report_info('$VIRTUAL_ENV matches executable')
else
call health#report_warn(
\ '$VIRTUAL_ENV exists but appears to be inactive. '
\ . 'This could lead to unexpected results.',
\ [ 'If you are using Zsh, see: http://vi.stackexchange.com/a/7654' ])
endif
endif
" Diagnostic output " Diagnostic output
call health#report_info('Executable: ' . (empty(python_exe) ? 'Not found' : python_exe)) call health#report_info('Executable: ' . (empty(python_exe) ? 'Not found' : python_exe))
if len(python_multiple) if len(python_multiple)
@@ -473,12 +485,83 @@ function! s:check_for_pyenv() abort
return [pyenv_path, pyenv_root] return [pyenv_path, pyenv_root]
endfunction endfunction
" Resolves Python executable path by invoking and checking `sys.executable`.
function! s:python_exepath(invocation) abort
return s:normalize_path(system(a:invocation
\ . ' -c "import sys; sys.stdout.write(sys.executable)"'))
endfunction
" Checks that $VIRTUAL_ENV Python executables are found at front of $PATH in
" Nvim and subshells.
function! s:check_virtualenv() abort
call health#report_start('Python virtualenv')
if !exists('$VIRTUAL_ENV')
call health#report_ok('no $VIRTUAL_ENV')
return
endif
let errors = []
" Keep hints as dict keys in order to discard duplicates.
let hints = {}
" The virtualenv should contain some Python executables, and those
" executables should be first both on Nvim's $PATH and the $PATH of
" subshells launched from Nvim.
let bin_dir = has('win32') ? '/Scripts' : '/bin'
let venv_bins = glob($VIRTUAL_ENV . bin_dir . '/python*', v:true, v:true)
" XXX: Remove irrelevant executables found in bin/.
let venv_bins = filter(venv_bins, 'v:val !~# "python-config"')
if len(venv_bins)
for venv_bin in venv_bins
let venv_bin = s:normalize_path(venv_bin)
let py_bin_basename = fnamemodify(venv_bin, ':t')
let nvim_py_bin = s:python_exepath(exepath(py_bin_basename))
let subshell_py_bin = s:python_exepath(py_bin_basename)
if venv_bin !=# nvim_py_bin
call add(errors, '$PATH yields this '.py_bin_basename.' executable: '.nvim_py_bin)
let hint = '$PATH ambiguities arise if the virtualenv is not '
\.'properly activated prior to launching Nvim. Close Nvim, activate the virtualenv, '
\.'check that invoking Python from the command line launches the correct one, '
\.'then relaunch Nvim.'
let hints[hint] = v:true
endif
if venv_bin !=# subshell_py_bin
call add(errors, '$PATH in subshells yields this '
\.py_bin_basename . ' executable: '.subshell_py_bin)
let hint = '$PATH ambiguities in subshells typically are '
\.'caused by your shell config overriding the $PATH previously set by the '
\.'virtualenv. Either prevent them from doing so, or use this workaround: '
\.'https://vi.stackexchange.com/a/7654'
let hints[hint] = v:true
endif
endfor
else
call add(errors, 'no Python executables found in the virtualenv '.bin_dir.' directory.')
endif
let msg = '$VIRTUAL_ENV is set to: '.$VIRTUAL_ENV
if len(errors)
if len(venv_bins)
let msg .= "\nAnd its ".bin_dir.' directory contains: '
\.join(map(venv_bins, "fnamemodify(v:val, ':t')"), ', ')
endif
let conj = "\nBut "
for error in errors
let msg .= conj.error
let conj = "\nAnd "
endfor
let msg .= "\nSo invoking Python may lead to unexpected results."
call health#report_warn(msg, keys(hints))
else
call health#report_info(msg)
call health#report_info('Python version: '
\.system('python -c "import platform, sys; sys.stdout.write(platform.python_version())"'))
call health#report_ok('$VIRTUAL_ENV provides :!python.')
endif
endfunction
function! s:check_ruby() abort function! s:check_ruby() abort
call health#report_start('Ruby provider (optional)') call health#report_start('Ruby provider (optional)')
let loaded_var = 'g:loaded_ruby_provider' if s:disabled_via_loaded_var('ruby')
if exists(loaded_var) && !exists('*provider#ruby#Call')
call health#report_info('Disabled. '.loaded_var.'='.eval(loaded_var))
return return
endif endif
@@ -501,7 +584,7 @@ function! s:check_ruby() abort
endif endif
call health#report_info('Host: '. host) call health#report_info('Host: '. host)
let latest_gem_cmd = has('win32') ? 'cmd /c gem list -ra ^^neovim$' : 'gem list -ra ^neovim$' let latest_gem_cmd = has('win32') ? 'cmd /c gem list -ra "^^neovim$"' : 'gem list -ra ^neovim$'
let latest_gem = s:system(split(latest_gem_cmd)) let latest_gem = s:system(split(latest_gem_cmd))
if s:shell_error || empty(latest_gem) if s:shell_error || empty(latest_gem)
call health#report_error('Failed to run: '. latest_gem_cmd, call health#report_error('Failed to run: '. latest_gem_cmd,
@@ -509,7 +592,7 @@ function! s:check_ruby() abort
\ 'Are you behind a firewall or proxy?']) \ 'Are you behind a firewall or proxy?'])
return return
endif endif
let latest_gem = get(split(latest_gem, 'neovim (\|, \|)$' ), 1, 'not found') let latest_gem = get(split(latest_gem, 'neovim (\|, \|)$' ), 0, 'not found')
let current_gem_cmd = host .' --version' let current_gem_cmd = host .' --version'
let current_gem = s:system(current_gem_cmd) let current_gem = s:system(current_gem_cmd)
@@ -532,9 +615,7 @@ endfunction
function! s:check_node() abort function! s:check_node() abort
call health#report_start('Node.js provider (optional)') call health#report_start('Node.js provider (optional)')
let loaded_var = 'g:loaded_node_provider' if s:disabled_via_loaded_var('node')
if exists(loaded_var) && !exists('*provider#node#Call')
call health#report_info('Disabled. '.loaded_var.'='.eval(loaded_var))
return return
endif endif
@@ -546,8 +627,8 @@ function! s:check_node() abort
endif endif
let node_v = get(split(s:system('node -v'), "\n"), 0, '') let node_v = get(split(s:system('node -v'), "\n"), 0, '')
call health#report_info('Node.js: '. node_v) call health#report_info('Node.js: '. node_v)
if !s:shell_error && s:version_cmp(node_v[1:], '6.0.0') < 0 if s:shell_error || s:version_cmp(node_v[1:], '6.0.0') < 0
call health#report_warn('Neovim node.js host does not support '.node_v) call health#report_warn('Nvim node.js host does not support '.node_v)
" Skip further checks, they are nonsense if nodejs is too old. " Skip further checks, they are nonsense if nodejs is too old.
return return
endif endif
@@ -562,7 +643,7 @@ function! s:check_node() abort
\ 'Run in shell (if you use yarn): yarn global add neovim']) \ 'Run in shell (if you use yarn): yarn global add neovim'])
return return
endif endif
call health#report_info('Neovim node.js host: '. host) call health#report_info('Nvim node.js host: '. host)
let manager = executable('npm') ? 'npm' : 'yarn' let manager = executable('npm') ? 'npm' : 'yarn'
let latest_npm_cmd = has('win32') ? let latest_npm_cmd = has('win32') ?
@@ -575,14 +656,12 @@ function! s:check_node() abort
\ 'Are you behind a firewall or proxy?']) \ 'Are you behind a firewall or proxy?'])
return return
endif endif
if !empty(latest_npm) try
try let pkg_data = json_decode(latest_npm)
let pkg_data = json_decode(latest_npm) catch /E474/
catch /E474/ return 'error: '.latest_npm
return 'error: '.latest_npm endtry
endtry let latest_npm = get(get(pkg_data, 'dist-tags', {}), 'latest', 'unable to parse')
let latest_npm = get(get(pkg_data, 'dist-tags', {}), 'latest', 'unable to parse')
endif
let current_npm_cmd = ['node', host, '--version'] let current_npm_cmd = ['node', host, '--version']
let current_npm = s:system(current_npm_cmd) let current_npm = s:system(current_npm_cmd)
@@ -603,10 +682,83 @@ function! s:check_node() abort
endif endif
endfunction endfunction
function! s:check_perl() abort
call health#report_start('Perl provider (optional)')
if s:disabled_via_loaded_var('perl')
return
endif
if !executable('perl') || !executable('cpanm')
call health#report_warn(
\ '`perl` and `cpanm` must be in $PATH.',
\ ['Install Perl and cpanminus and verify that `perl` and `cpanm` commands work.'])
return
endif
let perl_v = get(split(s:system(['perl', '-W', '-e', 'print $^V']), "\n"), 0, '')
call health#report_info('Perl: '. perl_v)
if s:shell_error
call health#report_warn('Nvim perl host does not support '.perl_v)
" Skip further checks, they are nonsense if perl is too old.
return
endif
let host = provider#perl#Detect()
if empty(host)
call health#report_warn('Missing "Neovim::Ext" cpan module.',
\ ['Run in shell: cpanm Neovim::Ext'])
return
endif
call health#report_info('Nvim perl host: '. host)
let latest_cpan_cmd = 'cpanm --info -q Neovim::Ext'
let latest_cpan = s:system(latest_cpan_cmd)
if s:shell_error || empty(latest_cpan)
call health#report_error('Failed to run: '. latest_cpan_cmd,
\ ["Make sure you're connected to the internet.",
\ 'Are you behind a firewall or proxy?'])
return
elseif latest_cpan[0] ==# '!'
let cpanm_errs = split(latest_cpan, '!')
if cpanm_errs[0] =~# "Can't write to "
call health#report_warn(cpanm_errs[0], cpanm_errs[1:-2])
" Last line is the package info
let latest_cpan = cpanm_errs[-1]
else
call health#report_error('Unknown warning from command: ' . latest_cpan_cmd, cpanm_errs)
return
endif
endif
let latest_cpan = matchstr(latest_cpan, '\(\.\?\d\)\+')
if empty(latest_cpan)
call health#report_error('Cannot parse version number from cpanm output: ' . latest_cpan)
return
endif
let current_cpan_cmd = [host, '-W', '-MNeovim::Ext', '-e', 'print $Neovim::Ext::VERSION']
let current_cpan = s:system(current_cpan_cmd)
if s:shell_error
call health#report_error('Failed to run: '. string(current_cpan_cmd),
\ ['Report this issue with the output of: ', string(current_cpan_cmd)])
return
endif
if s:version_cmp(current_cpan, latest_cpan) == -1
call health#report_warn(
\ printf('Module "Neovim::Ext" is out-of-date. Installed: %s, latest: %s',
\ current_cpan, latest_cpan),
\ ['Run in shell: cpanm Neovim::Ext'])
else
call health#report_ok('Latest "Neovim::Ext" cpan module is installed: '. current_cpan)
endif
endfunction
function! health#provider#check() abort function! health#provider#check() abort
call s:check_clipboard() call s:check_clipboard()
call s:check_python(2) call s:check_python(2)
call s:check_python(3) call s:check_python(3)
call s:check_virtualenv()
call s:check_ruby() call s:check_ruby()
call s:check_node() call s:check_node()
call s:check_perl()
endfunction endfunction

View File

@@ -1,4 +1,4 @@
" Maintainer: Anmol Sethi <anmol@aubble.com> " Maintainer: Anmol Sethi <hi@nhooyr.io>
if exists('s:loaded_man') if exists('s:loaded_man')
finish finish
@@ -7,22 +7,10 @@ let s:loaded_man = 1
let s:find_arg = '-w' let s:find_arg = '-w'
let s:localfile_arg = v:true " Always use -l if possible. #6683 let s:localfile_arg = v:true " Always use -l if possible. #6683
let s:section_arg = '-s' let s:section_arg = '-S'
function! s:init_section_flag() function! man#init() abort
call system(['env', 'MANPAGER=cat', 'man', s:section_arg, '1', 'man'])
if v:shell_error
let s:section_arg = '-S'
endif
endfunction
function! s:init() abort
call s:init_section_flag()
" TODO(nhooyr): Does `man -l` on SunOS list searched directories?
try try
if !has('win32') && $OSTYPE !~? 'cygwin\|linux' && system('uname -s') =~? 'SunOS' && system('uname -r') =~# '^5'
let s:find_arg = '-l'
endif
" Check for -l support. " Check for -l support.
call s:get_page(s:get_path('', 'man')) call s:get_page(s:get_path('', 'man'))
catch /E145:/ catch /E145:/
@@ -52,51 +40,40 @@ function! man#open_page(count, count1, mods, ...) abort
let ref = a:2.'('.a:1.')' let ref = a:2.'('.a:1.')'
endif endif
try try
let [sect, name] = man#extract_sect_and_name_ref(ref) let [sect, name] = s:extract_sect_and_name_ref(ref)
if a:count ==# a:count1 if a:count ==# a:count1
" v:count defaults to 0 which is a valid section, and v:count1 defaults to " v:count defaults to 0 which is a valid section, and v:count1 defaults to
" 1, also a valid section. If they are equal, count explicitly set. " 1, also a valid section. If they are equal, count explicitly set.
let sect = string(a:count) let sect = string(a:count)
endif endif
let [sect, name, path] = s:verify_exists(sect, name) let path = s:verify_exists(sect, name)
let [sect, name] = s:extract_sect_and_name_path(path)
catch catch
call s:error(v:exception) call s:error(v:exception)
return return
endtry endtry
call s:push_tag() let [l:buf, l:save_tfu] = [bufnr(), &tagfunc]
let bufname = 'man://'.name.(empty(sect)?'':'('.sect.')')
try try
set eventignore+=BufReadCmd set tagfunc=man#goto_tag
let l:target = l:name . '(' . l:sect . ')'
if a:mods !~# 'tab' && s:find_man() if a:mods !~# 'tab' && s:find_man()
execute 'silent keepalt edit' fnameescape(bufname) execute 'silent keepalt tag' l:target
else else
execute 'silent keepalt' a:mods 'split' fnameescape(bufname) execute 'silent keepalt' a:mods 'stag' l:target
endif endif
finally finally
set eventignore-=BufReadCmd call setbufvar(l:buf, '&tagfunc', l:save_tfu)
endtry
try
let page = s:get_page(path)
catch
if a:mods =~# 'tab' || !s:find_man()
" a new window was opened
close
endif
call s:error(v:exception)
return
endtry endtry
let b:man_sect = sect let b:man_sect = sect
call s:put_page(page)
endfunction endfunction
function! man#read_page(ref) abort function! man#read_page(ref) abort
try try
let [sect, name] = man#extract_sect_and_name_ref(a:ref) let [sect, name] = s:extract_sect_and_name_ref(a:ref)
let [sect, name, path] = s:verify_exists(sect, name) let path = s:verify_exists(sect, name)
let [sect, name] = s:extract_sect_and_name_path(path)
let page = s:get_page(path) let page = s:get_page(path)
catch catch
call s:error(v:exception) call s:error(v:exception)
@@ -152,7 +129,7 @@ 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/…. " Soft-wrap: ftplugin/man.vim sets wrap/breakindent/….
" Hard-wrap: driven by `man`. " Hard-wrap: driven by `man`.
let manwidth = !get(g:,'man_hardwrap') ? 999 : (empty($MANWIDTH) ? winwidth(0) : $MANWIDTH) let manwidth = !get(g:, 'man_hardwrap', 1) ? 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.
@@ -163,6 +140,9 @@ endfunction
function! s:put_page(page) abort function! s:put_page(page) abort
setlocal modifiable setlocal modifiable
setlocal noreadonly setlocal noreadonly
setlocal noswapfile
" git-ls-files(1) is all one keyword/tag-target
setlocal iskeyword+=(,)
silent keepjumps %delete _ silent keepjumps %delete _
silent put =a:page silent put =a:page
while getline(1) =~# '^\s*$' while getline(1) =~# '^\s*$'
@@ -204,7 +184,7 @@ endfunction
" attempt to extract the name and sect out of 'name(sect)' " attempt to extract the name and sect out of 'name(sect)'
" otherwise just return the largest string of valid characters in ref " otherwise just return the largest string of valid characters in ref
function! man#extract_sect_and_name_ref(ref) abort function! s:extract_sect_and_name_ref(ref) abort
if a:ref[0] ==# '-' " try ':Man -pandoc' with this disabled. if a:ref[0] ==# '-' " try ':Man -pandoc' with this disabled.
throw 'manpage name cannot start with ''-''' throw 'manpage name cannot start with ''-'''
endif endif
@@ -214,7 +194,7 @@ function! man#extract_sect_and_name_ref(ref) abort
if empty(name) if empty(name)
throw 'manpage reference cannot contain only parentheses' throw 'manpage reference cannot contain only parentheses'
endif endif
return [get(b:, 'man_default_sects', ''), name] return ['', name]
endif endif
let left = split(ref, '(') let left = split(ref, '(')
" see ':Man 3X curses' on why tolower. " see ':Man 3X curses' on why tolower.
@@ -237,42 +217,62 @@ function! s:get_path(sect, name) abort
return substitute(get(split(s:system(['man', s:find_arg, s:section_arg, a:sect, a:name])), 0, ''), '\n\+$', '', '') return substitute(get(split(s:system(['man', s:find_arg, s:section_arg, a:sect, a:name])), 0, ''), '\n\+$', '', '')
endfunction endfunction
" s:verify_exists attempts to find the path to a manpage
" based on the passed section and name.
"
" 1. If the passed section is empty, b:man_default_sects is used.
" 2. If manpage could not be found with the given sect and name,
" then another attempt is made with b:man_default_sects.
" 3. If it still could not be found, then we try again without a section.
" 4. If still not found but $MANSECT is set, then we try again with $MANSECT
" unset.
"
" This function is careful to avoid duplicating a search if a previous
" step has already done it. i.e if we use b:man_default_sects in step 1,
" then we don't do it again in step 2.
function! s:verify_exists(sect, name) abort function! s:verify_exists(sect, name) abort
try let sect = a:sect
let path = s:get_path(a:sect, a:name) if empty(sect)
catch /^command error (/ let sect = get(b:, 'man_default_sects', '')
try
let path = s:get_path(get(b:, 'man_default_sects', ''), a:name)
catch /^command error (/
let path = s:get_path('', a:name)
endtry
endtry
" Extract the section from the path, because sometimes the actual section is
" more specific than what we provided to `man` (try `:Man 3 App::CLI`).
" Also on linux, name seems to be case-insensitive. So for `:Man PRIntf`, we
" still want the name of the buffer to be 'printf'.
return s:extract_sect_and_name_path(path) + [path]
endfunction
let s:tag_stack = []
function! s:push_tag() abort
let s:tag_stack += [{
\ 'buf': bufnr('%'),
\ 'lnum': line('.'),
\ 'col': col('.'),
\ }]
endfunction
function! man#pop_tag() abort
if !empty(s:tag_stack)
let tag = remove(s:tag_stack, -1)
execute 'silent' tag['buf'].'buffer'
call cursor(tag['lnum'], tag['col'])
endif endif
try
return s:get_path(sect, a:name)
catch /^command error (/
endtry
if !empty(get(b:, 'man_default_sects', '')) && sect !=# b:man_default_sects
try
return s:get_path(b:man_default_sects, a:name)
catch /^command error (/
endtry
endif
if !empty(sect)
try
return s:get_path('', a:name)
catch /^command error (/
endtry
endif
if !empty($MANSECT)
try
let MANSECT = $MANSECT
unset $MANSECT
return s:get_path('', a:name)
catch /^command error (/
finally
let $MANSECT = MANSECT
endtry
endif
throw 'no manual entry for ' . a:name
endfunction endfunction
" extracts the name and sect out of 'path/name.sect' " Extracts the name/section from the 'path/name.sect', because sometimes the actual section is
" more specific than what we provided to `man` (try `:Man 3 App::CLI`).
" Also on linux, name seems to be case-insensitive. So for `:Man PRIntf`, we
" still want the name of the buffer to be 'printf'.
function! s:extract_sect_and_name_path(path) abort function! s:extract_sect_and_name_path(path) abort
let tail = fnamemodify(a:path, ':t') let tail = fnamemodify(a:path, ':t')
if a:path =~# '\.\%([glx]z\|bz2\|lzma\|Z\)$' " valid extensions if a:path =~# '\.\%([glx]z\|bz2\|lzma\|Z\)$' " valid extensions
@@ -284,20 +284,16 @@ function! s:extract_sect_and_name_path(path) abort
endfunction endfunction
function! s:find_man() abort function! s:find_man() abort
if &filetype ==# 'man' let l:win = 1
return 1 while l:win <= winnr('$')
elseif winnr('$') ==# 1 let l:buf = winbufnr(l:win)
return 0 if getbufvar(l:buf, '&filetype', '') ==# 'man'
endif execute l:win.'wincmd w'
let thiswin = winnr()
while 1
wincmd w
if &filetype ==# 'man'
return 1 return 1
elseif thiswin ==# winnr()
return 0
endif endif
let l:win += 1
endwhile endwhile
return 0
endfunction endfunction
function! s:error(msg) abort function! s:error(msg) abort
@@ -307,7 +303,7 @@ function! s:error(msg) abort
echohl None echohl None
endfunction endfunction
" see man#extract_sect_and_name_ref on why tolower(sect) " see s:extract_sect_and_name_ref on why tolower(sect)
function! man#complete(arg_lead, cmd_line, cursor_pos) abort function! man#complete(arg_lead, cmd_line, cursor_pos) abort
let args = split(a:cmd_line) let args = split(a:cmd_line)
let cmd_offset = index(args, 'Man') let cmd_offset = index(args, 'Man')
@@ -360,14 +356,35 @@ function! man#complete(arg_lead, cmd_line, cursor_pos) abort
return s:complete(sect, sect, name) return s:complete(sect, sect, name)
endfunction endfunction
function! s:complete(sect, psect, name) abort function! s:get_paths(sect, name, do_fallback) abort
" callers must try-catch this, as some `man` implementations don't support `s:find_arg`
try try
let mandirs = join(split(s:system(['man', s:find_arg]), ':\|\n'), ',') let mandirs = join(split(s:system(['man', s:find_arg]), ':\|\n'), ',')
let paths = globpath(mandirs, 'man?/'.a:name.'*.'.a:sect.'*', 0, 1)
try
" Prioritize the result from verify_exists as it obeys b:man_default_sects.
let first = s:verify_exists(a:sect, a:name)
let paths = filter(paths, 'v:val !=# first')
let paths = [first] + paths
catch
endtry
return paths
catch catch
call s:error(v:exception) if !a:do_fallback
return throw v:exception
endif
" Fallback to a single path, with the page we're trying to find.
try
return [s:verify_exists(a:sect, a:name)]
catch
return []
endtry
endtry endtry
let pages = globpath(mandirs,'man?/'.a:name.'*.'.a:sect.'*', 0, 1) endfunction
function! s:complete(sect, psect, name) abort
let pages = s:get_paths(a:sect, a:name, v:false)
" We remove duplicates in case the same manpage in different languages was found. " We remove duplicates in case the same manpage in different languages was found.
return uniq(sort(map(pages, 's:format_candidate(v:val, a:psect)'), 'i')) return uniq(sort(map(pages, 's:format_candidate(v:val, a:psect)'), 'i'))
endfunction endfunction
@@ -387,6 +404,10 @@ function! s:format_candidate(path, psect) abort
endfunction endfunction
function! man#init_pager() abort function! man#init_pager() abort
" https://github.com/neovim/neovim/issues/6828
let og_modifiable = &modifiable
setlocal modifiable
if getline(1) =~# '^\s*$' if getline(1) =~# '^\s*$'
silent keepjumps 1delete _ silent keepjumps 1delete _
else else
@@ -397,13 +418,40 @@ function! man#init_pager() abort
" know the correct casing, cf. `man glDrawArraysInstanced`). " know the correct casing, cf. `man glDrawArraysInstanced`).
let ref = substitute(matchstr(getline(1), '^[^)]\+)'), ' ', '_', 'g') let ref = substitute(matchstr(getline(1), '^[^)]\+)'), ' ', '_', 'g')
try try
let b:man_sect = man#extract_sect_and_name_ref(ref)[0] let b:man_sect = s:extract_sect_and_name_ref(ref)[0]
catch catch
let b:man_sect = '' let b:man_sect = ''
endtry endtry
if -1 == match(bufname('%'), 'man:\/\/') " Avoid duplicate buffers, E95. if -1 == match(bufname('%'), 'man:\/\/') " Avoid duplicate buffers, E95.
execute 'silent file man://'.tolower(fnameescape(ref)) execute 'silent file man://'.tolower(fnameescape(ref))
endif endif
let &l:modifiable = og_modifiable
endfunction endfunction
call s:init() function! man#goto_tag(pattern, flags, info) abort
let [l:sect, l:name] = s:extract_sect_and_name_ref(a:pattern)
let l:paths = s:get_paths(l:sect, l:name, v:true)
let l:structured = []
for l:path in l:paths
let l:n = s:extract_sect_and_name_path(l:path)[1]
let l:structured += [{ 'name': l:n, 'path': l:path }]
endfor
if &cscopetag
" return only a single entry so we work well with :cstag (#11675)
let l:structured = l:structured[:0]
endif
return map(l:structured, {
\ _, entry -> {
\ 'name': entry.name,
\ 'filename': 'man://' . entry.path,
\ 'cmd': '1'
\ }
\ })
endfunction
call man#init()

View File

@@ -688,10 +688,6 @@ fun! netrw#Explore(indx,dosplit,style,...)
endif endif
" save registers " save registers
if has("clipboard")
sil! let keepregstar = @*
sil! let keepregplus = @+
endif
sil! let keepregslash= @/ sil! let keepregslash= @/
" if dosplit " if dosplit
@@ -915,10 +911,6 @@ fun! netrw#Explore(indx,dosplit,style,...)
" call Decho("..case Nexplore with starpat=".starpat.": (indx=".indx.")",'~'.expand("<slnum>")) " call Decho("..case Nexplore with starpat=".starpat.": (indx=".indx.")",'~'.expand("<slnum>"))
if !exists("w:netrw_explore_list") " sanity check if !exists("w:netrw_explore_list") " sanity check
NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Nexplore or <s-down> improperly; see help for netrw-starstar",40) NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Nexplore or <s-down> improperly; see help for netrw-starstar",40)
if has("clipboard")
sil! let @* = keepregstar
sil! let @+ = keepregplus
endif
sil! let @/ = keepregslash sil! let @/ = keepregslash
" call Dret("netrw#Explore") " call Dret("netrw#Explore")
return return
@@ -940,10 +932,6 @@ fun! netrw#Explore(indx,dosplit,style,...)
" call Decho("case Pexplore with starpat=".starpat.": (indx=".indx.")",'~'.expand("<slnum>")) " call Decho("case Pexplore with starpat=".starpat.": (indx=".indx.")",'~'.expand("<slnum>"))
if !exists("w:netrw_explore_list") " sanity check if !exists("w:netrw_explore_list") " sanity check
NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Pexplore or <s-up> improperly; see help for netrw-starstar",41) NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Pexplore or <s-up> improperly; see help for netrw-starstar",41)
if has("clipboard")
sil! let @* = keepregstar
sil! let @+ = keepregplus
endif
sil! let @/ = keepregslash sil! let @/ = keepregslash
" call Dret("netrw#Explore") " call Dret("netrw#Explore")
return return
@@ -995,10 +983,6 @@ fun! netrw#Explore(indx,dosplit,style,...)
catch /^Vim\%((\a\+)\)\=:E480/ catch /^Vim\%((\a\+)\)\=:E480/
keepalt call netrw#ErrorMsg(s:WARNING,'no files matched pattern<'.pattern.'>',45) keepalt call netrw#ErrorMsg(s:WARNING,'no files matched pattern<'.pattern.'>',45)
if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif
if has("clipboard")
sil! let @* = keepregstar
sil! let @+ = keepregplus
endif
sil! let @/ = keepregslash sil! let @/ = keepregslash
" call Dret("netrw#Explore : no files matched pattern") " call Dret("netrw#Explore : no files matched pattern")
return return
@@ -1031,10 +1015,6 @@ fun! netrw#Explore(indx,dosplit,style,...)
if w:netrw_explore_listlen == 0 || (w:netrw_explore_listlen == 1 && w:netrw_explore_list[0] =~ '\*\*\/') if w:netrw_explore_listlen == 0 || (w:netrw_explore_listlen == 1 && w:netrw_explore_list[0] =~ '\*\*\/')
keepalt NetrwKeepj call netrw#ErrorMsg(s:WARNING,"no files matched",42) keepalt NetrwKeepj call netrw#ErrorMsg(s:WARNING,"no files matched",42)
if has("clipboard")
sil! let @* = keepregstar
sil! let @+ = keepregplus
endif
sil! let @/ = keepregslash sil! let @/ = keepregslash
" call Dret("netrw#Explore : no files matched") " call Dret("netrw#Explore : no files matched")
return return
@@ -1079,10 +1059,6 @@ fun! netrw#Explore(indx,dosplit,style,...)
if !exists("g:netrw_quiet") if !exists("g:netrw_quiet")
keepalt NetrwKeepj call netrw#ErrorMsg(s:WARNING,"your vim needs the +path_extra feature for Exploring with **!",44) keepalt NetrwKeepj call netrw#ErrorMsg(s:WARNING,"your vim needs the +path_extra feature for Exploring with **!",44)
endif endif
if has("clipboard")
sil! let @* = keepregstar
sil! let @+ = keepregplus
endif
sil! let @/ = keepregslash sil! let @/ = keepregslash
" call Dret("netrw#Explore : missing +path_extra") " call Dret("netrw#Explore : missing +path_extra")
return return
@@ -1152,10 +1128,6 @@ fun! netrw#Explore(indx,dosplit,style,...)
" there's no danger of a late FocusGained event on initialization. " there's no danger of a late FocusGained event on initialization.
" Consequently, set s:netrw_events to 2. " Consequently, set s:netrw_events to 2.
let s:netrw_events= 2 let s:netrw_events= 2
if has("clipboard")
sil! let @* = keepregstar
sil! let @+ = keepregplus
endif
sil! let @/ = keepregslash sil! let @/ = keepregslash
" call Dret("netrw#Explore : @/<".@/.">") " call Dret("netrw#Explore : @/<".@/.">")
endfun endfun
@@ -1676,10 +1648,6 @@ fun! s:NetrwOptionsSave(vt)
if g:netrw_keepdir if g:netrw_keepdir
let {a:vt}netrw_dirkeep = getcwd() let {a:vt}netrw_dirkeep = getcwd()
endif endif
if has("clipboard")
sil! let {a:vt}netrw_starkeep = @*
sil! let {a:vt}netrw_pluskeep = @+
endif
sil! let {a:vt}netrw_slashkeep= @/ sil! let {a:vt}netrw_slashkeep= @/
" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>")) " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>"))
@@ -1828,10 +1796,6 @@ fun! s:NetrwOptionsRestore(vt)
unlet {a:vt}netrw_dirkeep unlet {a:vt}netrw_dirkeep
endif endif
endif endif
if has("clipboard")
call s:NetrwRestoreSetting(a:vt."netrw_starkeep","@*")
call s:NetrwRestoreSetting(a:vt."netrw_pluskeep","@+")
endif
call s:NetrwRestoreSetting(a:vt."netrw_slashkeep","@/") call s:NetrwRestoreSetting(a:vt."netrw_slashkeep","@/")
" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("<slnum>")) " call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("<slnum>"))
@@ -5496,6 +5460,11 @@ fun! netrw#CheckIfRemote(...)
else else
let curfile= expand("%") let curfile= expand("%")
endif endif
" Ignore terminal buffers
if &buftype ==# 'terminal'
return 0
endif
" call Decho("curfile<".curfile.">") " call Decho("curfile<".curfile.">")
if curfile =~ '^\a\{3,}://' if curfile =~ '^\a\{3,}://'
" call Dret("netrw#CheckIfRemote 1") " call Dret("netrw#CheckIfRemote 1")
@@ -9559,10 +9528,6 @@ fun! s:NetrwWideListing()
let newcolstart = w:netrw_bannercnt + fpc let newcolstart = w:netrw_bannercnt + fpc
let newcolend = newcolstart + fpc - 1 let newcolend = newcolstart + fpc - 1
" call Decho("bannercnt=".w:netrw_bannercnt." fpl=".w:netrw_fpl." fpc=".fpc." newcol[".newcolstart.",".newcolend."]",'~'.expand("<slnum>")) " call Decho("bannercnt=".w:netrw_bannercnt." fpl=".w:netrw_fpl." fpc=".fpc." newcol[".newcolstart.",".newcolend."]",'~'.expand("<slnum>"))
if has("clipboard")
sil! let keepregstar = @*
sil! let keepregplus = @+
endif
while line("$") >= newcolstart while line("$") >= newcolstart
if newcolend > line("$") | let newcolend= line("$") | endif if newcolend > line("$") | let newcolend= line("$") | endif
let newcolqty= newcolend - newcolstart let newcolqty= newcolend - newcolstart
@@ -9575,10 +9540,6 @@ fun! s:NetrwWideListing()
exe "sil! NetrwKeepj ".newcolstart.','.newcolend.'d _' exe "sil! NetrwKeepj ".newcolstart.','.newcolend.'d _'
exe 'sil! NetrwKeepj '.w:netrw_bannercnt exe 'sil! NetrwKeepj '.w:netrw_bannercnt
endwhile endwhile
if has("clipboard")
sil! let @*= keepregstar
sil! let @+= keepregplus
endif
exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$s/\s\+$//e' exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$s/\s\+$//e'
NetrwKeepj call histdel("/",-1) NetrwKeepj call histdel("/",-1)
exe 'nno <buffer> <silent> w :call search(''^.\\|\s\s\zs\S'',''W'')'."\<cr>" exe 'nno <buffer> <silent> w :call search(''^.\\|\s\s\zs\S'',''W'')'."\<cr>"

View File

@@ -3,8 +3,11 @@
" Start the provider and perform a 'poll' request " Start the provider and perform a 'poll' request
" "
" Returns a valid channel on success " Returns a valid channel on success
function! provider#Poll(argv, orig_name, log_env) abort function! provider#Poll(argv, orig_name, log_env, ...) abort
let job = {'rpc': v:true, 'stderr_buffered': v:true} let job = {'rpc': v:true, 'stderr_buffered': v:true}
if a:0
let job = extend(job, a:1)
endif
try try
let channel_id = jobstart(a:argv, job) let channel_id = jobstart(a:argv, job)
if channel_id > 0 && rpcrequest(channel_id, 'poll') ==# 'ok' if channel_id > 0 && rpcrequest(channel_id, 'poll') ==# 'ok'

View File

@@ -113,8 +113,13 @@ function! provider#clipboard#Executable() abort
let s:paste['*'] = s:paste['+'] let s:paste['*'] = s:paste['+']
return 'doitclient' return 'doitclient'
elseif executable('win32yank.exe') elseif executable('win32yank.exe')
let s:copy['+'] = 'win32yank.exe -i --crlf' if has('wsl') && getftype(exepath('win32yank.exe')) == 'link'
let s:paste['+'] = 'win32yank.exe -o --lf' let win32yank = resolve(exepath('win32yank.exe'))
else
let win32yank = 'win32yank.exe'
endif
let s:copy['+'] = win32yank.' -i --crlf'
let s:paste['+'] = win32yank.' -o --lf'
let s:copy['*'] = s:copy['+'] let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+'] let s:paste['*'] = s:paste['+']
return 'win32yank' return 'win32yank'
@@ -172,6 +177,10 @@ function! s:clipboard.set(lines, regtype, reg) abort
if jobid > 0 if jobid > 0
call jobsend(jobid, a:lines) call jobsend(jobid, a:lines)
call jobclose(jobid, 'stdin') call jobclose(jobid, 'stdin')
" xclip does not close stdout when receiving input via stdin
if argv[0] ==# 'xclip'
call jobclose(jobid, 'stdout')
endif
let selection.owner = jobid let selection.owner = jobid
let ret = 1 let ret = 1
else else

View File

@@ -51,6 +51,9 @@ 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

View File

@@ -0,0 +1,69 @@
if exists('s:loaded_perl_provider')
finish
endif
let s:loaded_perl_provider = 1
function! provider#perl#Detect() abort
" use g:perl_host_prof if set or check if perl is on the path
let prog = exepath(get(g:, 'perl_host_prog', 'perl'))
if empty(prog)
return ''
endif
" if perl is available, make sure the required module is available
call system([prog, '-W', '-MNeovim::Ext', '-e', ''])
return v:shell_error ? '' : prog
endfunction
function! provider#perl#Prog() abort
return s:prog
endfunction
function! provider#perl#Require(host) abort
if s:err != ''
echoerr s:err
return
endif
let prog = provider#perl#Prog()
let args = [s:prog, '-e', 'use Neovim::Ext; start_host();']
" Collect registered perl plugins into args
let perl_plugins = remote#host#PluginsForHost(a:host.name)
for plugin in perl_plugins
call add(args, plugin.path)
endfor
return provider#Poll(args, a:host.orig_name, '$NVIM_PERL_LOG_FILE')
endfunction
function! provider#perl#Call(method, args) abort
if s:err != ''
echoerr s:err
return
endif
if !exists('s:host')
try
let s:host = remote#host#Require('perl')
catch
let s:err = v:exception
echohl WarningMsg
echomsg v:exception
echohl None
return
endtry
endif
return call('rpcrequest', insert(insert(a:args, 'perl_'.a:method), s:host))
endfunction
let s:err = ''
let s:prog = provider#perl#Detect()
let g:loaded_perl_provider = empty(s:prog) ? 1 : 2
if g:loaded_perl_provider != 2
let s:err = 'Cannot find perl or the required perl module'
endif
call remote#host#RegisterPlugin('perl-provider', 'perl', [])

View File

@@ -10,7 +10,8 @@ function! provider#pythonx#Require(host) abort
" Python host arguments " Python host arguments
let prog = (ver == '2' ? provider#python#Prog() : provider#python3#Prog()) let prog = (ver == '2' ? provider#python#Prog() : provider#python3#Prog())
let args = [prog, '-c', 'import sys; sys.path.remove(""); import neovim; neovim.start_host()'] let args = [prog, '-c', 'import sys; sys.path = list(filter(lambda x: x != "", sys.path)); import neovim; neovim.start_host()']
" Collect registered Python plugins into args " Collect registered Python plugins into args
let python_plugins = remote#host#PluginsForHost(a:host.name) let python_plugins = remote#host#PluginsForHost(a:host.name)
@@ -18,7 +19,7 @@ function! provider#pythonx#Require(host) abort
call add(args, plugin.path) call add(args, plugin.path)
endfor endfor
return provider#Poll(args, a:host.orig_name, '$NVIM_PYTHON_LOG_FILE') return provider#Poll(args, a:host.orig_name, '$NVIM_PYTHON_LOG_FILE', {'overlapped': v:true})
endfunction endfunction
function! s:get_python_executable_from_host_var(major_version) abort function! s:get_python_executable_from_host_var(major_version) abort
@@ -28,8 +29,8 @@ endfunction
function! s:get_python_candidates(major_version) abort function! s:get_python_candidates(major_version) abort
return { return {
\ 2: ['python2', 'python2.7', 'python2.6', 'python'], \ 2: ['python2', 'python2.7', 'python2.6', 'python'],
\ 3: ['python3', 'python3.7', 'python3.6', 'python3.5', 'python3.4', 'python3.3', \ 3: ['python3', 'python3.9', 'python3.8', 'python3.7', 'python3.6', 'python3.5',
\ 'python'] \ 'python3.4', 'python3.3', 'python']
\ }[a:major_version] \ }[a:major_version]
endfunction endfunction
@@ -43,7 +44,7 @@ function! provider#pythonx#DetectByModule(module, major_version) abort
let python_exe = s:get_python_executable_from_host_var(a:major_version) let python_exe = s:get_python_executable_from_host_var(a:major_version)
if !empty(python_exe) if !empty(python_exe)
return [python_exe, ''] return [exepath(expand(python_exe)), '']
endif endif
let candidates = s:get_python_candidates(a:major_version) let candidates = s:get_python_candidates(a:major_version)
@@ -66,7 +67,7 @@ endfunction
function! s:import_module(prog, module) abort function! s:import_module(prog, module) abort
let prog_version = system([a:prog, '-c' , printf( let prog_version = system([a:prog, '-c' , printf(
\ 'import sys; ' . \ 'import sys; ' .
\ 'sys.path.remove(""); ' . \ 'sys.path = list(filter(lambda x: x != "", sys.path)); ' .
\ 'sys.stdout.write(str(sys.version_info[0]) + "." + str(sys.version_info[1])); ' . \ 'sys.stdout.write(str(sys.version_info[0]) + "." + str(sys.version_info[1])); ' .
\ 'import pkgutil; ' . \ 'import pkgutil; ' .
\ 'exit(2*int(pkgutil.get_loader("%s") is None))', \ 'exit(2*int(pkgutil.get_loader("%s") is None))',

View File

@@ -24,7 +24,7 @@ function! remote#define#CommandOnHost(host, method, sync, name, opts)
endif endif
if has_key(a:opts, 'nargs') if has_key(a:opts, 'nargs')
call add(forward_args, ' <args>') call add(forward_args, ' " . <q-args> . "')
endif endif
exe s:GetCommandPrefix(a:name, a:opts) exe s:GetCommandPrefix(a:name, a:opts)

View File

@@ -203,3 +203,7 @@ call remote#host#Register('ruby', '*.rb',
" nodejs " nodejs
call remote#host#Register('node', '*', call remote#host#Register('node', '*',
\ function('provider#node#Require')) \ function('provider#node#Require'))
" perl
call remote#host#Register('perl', '*',
\ function('provider#perl#Require'))

View File

@@ -13,6 +13,13 @@ let s:spellfile_URL = '' " Start with nothing so that s:donedict is reset.
" This function is used for the spellfile plugin. " This function is used for the spellfile plugin.
function! spellfile#LoadFile(lang) function! spellfile#LoadFile(lang)
" Check for sandbox/modeline. #11359
try
:!
catch /\<E12\>/
throw 'Cannot download spellfile in sandbox/modeline. Try ":set spell" from the cmdline.'
endtry
" If the netrw plugin isn't loaded we silently skip everything. " If the netrw plugin isn't loaded we silently skip everything.
if !exists(":Nread") if !exists(":Nread")
if &verbose if &verbose

File diff suppressed because it is too large Load Diff

View File

@@ -251,7 +251,6 @@ Name triggered by ~
Buffers Buffers
|BufAdd| just after adding a buffer to the buffer list |BufAdd| just after adding a buffer to the buffer list
|BufCreate| just after adding a buffer to the buffer list
|BufDelete| before deleting a buffer from the buffer list |BufDelete| before deleting a buffer from the buffer list
|BufWipeout| before completely deleting a buffer |BufWipeout| before completely deleting a buffer
@@ -318,6 +317,7 @@ Name triggered by ~
|CursorMoved| the cursor was moved in Normal mode |CursorMoved| the cursor was moved in Normal mode
|CursorMovedI| the cursor was moved in Insert mode |CursorMovedI| the cursor was moved in Insert mode
|WinClosed| after closing a window
|WinNew| after creating a new window |WinNew| after creating a new window
|WinEnter| after entering another window |WinEnter| after entering another window
|WinLeave| before leaving a window |WinLeave| before leaving a window
@@ -358,7 +358,10 @@ Name triggered by ~
|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 |CompleteChanged| after popup menu changed, not fired on popup menu hide
|CompleteDone| after Insert mode completion is done |CompleteDonePre| after Insert mode completion is done, before clearing
info
|CompleteDone| after Insert mode completion is done, after clearing
info
|User| to be used in combination with ":doautocmd" |User| to be used in combination with ":doautocmd"
|Signal| after Nvim receives a signal |Signal| after Nvim receives a signal
@@ -367,32 +370,29 @@ Name triggered by ~
The alphabetical list of autocommand events: *autocmd-events-abc* The alphabetical list of autocommand events: *autocmd-events-abc*
*BufCreate* *BufAdd* *BufAdd*
BufAdd or BufCreate Just after creating a new buffer which is BufAdd Just after creating a new buffer which is
added to the buffer list, or adding a buffer added to the buffer list, or adding a buffer
to the buffer list. to the buffer list, a buffer in the buffer
Also used just after a buffer in the buffer list was renamed.
list has been renamed. Before |BufEnter|.
The BufCreate event is for historic reasons. NOTE: Current buffer "%" may be different from
NOTE: When this autocommand is executed, the the buffer being created "<afile>".
current buffer "%" may be different from the
buffer being created "<afile>".
*BufDelete* *BufDelete*
BufDelete Before deleting a buffer from the buffer list. BufDelete Before deleting a buffer from the buffer list.
The BufUnload may be called first (if the The BufUnload may be called first (if the
buffer was loaded). buffer was loaded).
Also used just before a buffer in the buffer Also used just before a buffer in the buffer
list is renamed. list is renamed.
NOTE: When this autocommand is executed, the NOTE: Current buffer "%" may be different from
current buffer "%" may be different from the the buffer being deleted "<afile>" and "<abuf>".
buffer being deleted "<afile>" and "<abuf>". Do not change to another buffer.
Don't change to another buffer, it will cause
problems.
*BufEnter* *BufEnter*
BufEnter After entering a buffer. Useful for setting BufEnter After entering a buffer. Useful for setting
options for a file type. Also executed when options for a file type. Also executed when
starting to edit a buffer, after the starting to edit a buffer, after the
BufReadPost autocommands. After |BufAdd|.
After |BufReadPost|.
*BufFilePost* *BufFilePost*
BufFilePost After changing the name of the current buffer BufFilePost After changing the name of the current buffer
with the ":file" or ":saveas" command. with the ":file" or ":saveas" command.
@@ -400,27 +400,26 @@ 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 Before a buffer becomes hidden: when there are
when there are no longer windows that show no longer windows that show the buffer, but
the buffer, but the buffer is not unloaded or the buffer is not unloaded or deleted.
deleted. Not used for ":qa" or ":q" when
exiting Vim. Not used for ":qa" or ":q" when exiting Vim.
NOTE: When this autocommand is executed, the NOTE: current buffer "%" may be different from
current buffer "%" may be different from the the buffer being unloaded "<afile>".
buffer being unloaded "<afile>".
*BufLeave* *BufLeave*
BufLeave Before leaving to another buffer. Also when BufLeave Before leaving to another buffer. Also when
leaving or closing the current window and the leaving or closing the current window and the
new current window is not for the same buffer. new current window is not for the same buffer.
Not used for ":qa" or ":q" when exiting Vim. Not used for ":qa" or ":q" when exiting Vim.
*BufNew* *BufNew*
BufNew Just after creating a new buffer. Also used BufNew Just after creating a new buffer. Also used
just after a buffer has been renamed. When just after a buffer has been renamed. When
the buffer is added to the buffer list BufAdd the buffer is added to the buffer list BufAdd
will be triggered too. will be triggered too.
NOTE: When this autocommand is executed, the NOTE: Current buffer "%" may be different from
current buffer "%" may be different from the the buffer being created "<afile>".
buffer being created "<afile>".
*BufNewFile* *BufNewFile*
BufNewFile When starting to edit a file that doesn't BufNewFile When starting to edit a file that doesn't
exist. Can be used to read in a skeleton exist. Can be used to read in a skeleton
@@ -428,16 +427,17 @@ BufNewFile When starting to edit a file that doesn't
*BufRead* *BufReadPost* *BufRead* *BufReadPost*
BufRead or BufReadPost When starting to edit a new buffer, after BufRead or BufReadPost When starting to edit a new buffer, after
reading the file into the buffer, before reading the file into the buffer, before
executing the modelines. See |BufWinEnter| processing modelines. See |BufWinEnter| to do
for when you need to do something after something after processing modelines.
processing the modelines. Also triggered:
This does NOT work for ":r file". Not used - when writing an unnamed buffer such that the
when the file doesn't exist. Also used after buffer gets a name
successfully recovering a file. - after successfully recovering a file
Also triggered for the filetypedetect group - for the "filetypedetect" group when
when executing ":filetype detect" and when executing ":filetype detect"
writing an unnamed buffer in a way that the Not triggered:
buffer gets a name. - for ":r file"
- if the file doesn't exist
*BufReadCmd* *BufReadCmd*
BufReadCmd Before starting to edit a new buffer. Should BufReadCmd Before starting to edit a new buffer. Should
read the file into the buffer. |Cmd-event| read the file into the buffer. |Cmd-event|
@@ -446,41 +446,37 @@ BufReadPre When starting to edit a new buffer, before
reading the file into the buffer. Not used reading the file into the buffer. Not used
if the file doesn't exist. if the file doesn't exist.
*BufUnload* *BufUnload*
BufUnload Before unloading a buffer. This is when the BufUnload Before unloading a buffer, when the text in
text in the buffer is going to be freed. This the buffer is going to be freed.
may be after a BufWritePost and before a After BufWritePost.
BufDelete. Also used for all buffers that are Before BufDelete.
loaded when Vim is going to exit. Triggers for all loaded buffers when Vim is
NOTE: When this autocommand is executed, the going to exit.
current buffer "%" may be different from the NOTE: Current buffer "%" may be different from
buffer being unloaded "<afile>". the buffer being unloaded "<afile>".
Don't change to another buffer or window, it Do not switch buffers or windows!
will cause problems! Not triggered when exiting and v:dying is 2 or
When exiting and v:dying is 2 or more this more.
event is not triggered.
*BufWinEnter* *BufWinEnter*
BufWinEnter After a buffer is displayed in a window. This BufWinEnter After a buffer is displayed in a window. This
can be when the buffer is loaded (after may be when the buffer is loaded (after
processing the modelines) or when a hidden processing modelines) or when a hidden buffer
buffer is displayed in a window (and is no is displayed (and is no longer hidden).
longer hidden).
Does not happen for |:split| without Not triggered for |:split| without arguments,
arguments, since you keep editing the same since the buffer does not change, or :split
buffer, or ":split" with a file that's already with a file already open in a window.
open in a window, because it re-uses an Triggered for ":split" with the name of the
existing buffer. But it does happen for a current buffer, since it reloads that buffer.
":split" with the name of the current buffer,
since it reloads that buffer.
*BufWinLeave* *BufWinLeave*
BufWinLeave Before a buffer is removed from a window. BufWinLeave Before a buffer is removed from a window.
Not when it's still visible in another window. Not when it's still visible in another window.
Also triggered when exiting. It's triggered Also triggered when exiting.
before BufUnload or BufHidden. Before BufUnload, BufHidden.
NOTE: When this autocommand is executed, the NOTE: Current buffer "%" may be different from
current buffer "%" may be different from the the buffer being unloaded "<afile>".
buffer being unloaded "<afile>". Not triggered when exiting and v:dying is 2 or
When exiting and v:dying is 2 or more this more.
event is not triggered.
*BufWipeout* *BufWipeout*
BufWipeout Before completely deleting a buffer. The BufWipeout Before completely deleting a buffer. The
BufUnload and BufDelete events may be called BufUnload and BufDelete events may be called
@@ -488,11 +484,9 @@ BufWipeout Before completely deleting a buffer. The
buffer list). Also used just before a buffer buffer list). Also used just before a buffer
is renamed (also when it's not in the buffer is renamed (also when it's not in the buffer
list). list).
NOTE: When this autocommand is executed, the NOTE: Current buffer "%" may be different from
current buffer "%" may be different from the the buffer being deleted "<afile>".
buffer being deleted "<afile>". Do not change to another buffer.
Don't change to another buffer, it will cause
problems.
*BufWrite* *BufWritePre* *BufWrite* *BufWritePre*
BufWrite or BufWritePre Before writing the whole buffer to a file. BufWrite or BufWritePre Before writing the whole buffer to a file.
*BufWriteCmd* *BufWriteCmd*
@@ -526,7 +520,7 @@ CmdUndefined When a user command is used but it isn't
defined. Useful for defining a command only defined. Useful for defining a command only
when it's used. The pattern is matched when it's used. The pattern is matched
against the command name. Both <amatch> and against the command name. Both <amatch> and
<afile> are set to the name of the command. <afile> expand to the command name.
NOTE: Autocompletion won't work until the NOTE: Autocompletion won't work until the
command is defined. An alternative is to command is defined. An alternative is to
always define the user command and have it always define the user command and have it
@@ -535,12 +529,12 @@ CmdUndefined When a user command is used but it isn't
CmdlineChanged After a change was made to the text inside CmdlineChanged After a change was made to the text inside
command line. Be careful not to mess up the command line. Be careful not to mess up the
command line, it may cause Vim to lock up. command line, it may cause Vim to lock up.
<afile> is set to the |cmdline-char|. <afile> expands to the |cmdline-char|.
*CmdlineEnter* *CmdlineEnter*
CmdlineEnter After entering the command-line (including CmdlineEnter After entering the command-line (including
non-interactive use of ":" in a mapping: use non-interactive use of ":" in a mapping: use
|<Cmd>| instead to avoid this). |<Cmd>| instead to avoid this).
<afile> is set to the |cmdline-char|. <afile> expands to the |cmdline-char|.
Sets these |v:event| keys: Sets these |v:event| keys:
cmdlevel cmdlevel
cmdtype cmdtype
@@ -548,28 +542,26 @@ CmdlineEnter After entering the command-line (including
CmdlineLeave Before leaving the command-line (including CmdlineLeave Before leaving the command-line (including
non-interactive use of ":" in a mapping: use non-interactive use of ":" in a mapping: use
|<Cmd>| instead to avoid this). |<Cmd>| instead to avoid this).
<afile> is set to the |cmdline-char|. <afile> expands to the |cmdline-char|.
Sets these |v:event| keys: Sets these |v:event| keys:
abort (mutable) abort (mutable)
cmdlevel cmdlevel
cmdtype cmdtype
Note: `abort` can only be changed from false Note: `abort` can only be changed from false
to true. An autocmd cannot execute an already to true: cannot execute an already aborted
aborted cmdline by changing it to false. cmdline by changing it to false.
*CmdwinEnter* *CmdwinEnter*
CmdwinEnter After entering the command-line window. CmdwinEnter After entering the command-line window.
Useful for setting options specifically for Useful for setting options specifically for
this special type of window. This is this special type of window.
triggered _instead_ of BufEnter and WinEnter. <afile> expands to a single character,
<afile> is set to a single character,
indicating the type of command-line. indicating the type of command-line.
|cmdwin-char| |cmdwin-char|
*CmdwinLeave* *CmdwinLeave*
CmdwinLeave Before leaving the command-line window. CmdwinLeave Before leaving the command-line window.
Useful to clean up any global setting done Useful to clean up any global setting done
with CmdwinEnter. This is triggered _instead_ with CmdwinEnter.
of BufLeave and WinLeave. <afile> expands to a single character,
<afile> is set to a single character,
indicating the type of command-line. indicating the type of command-line.
|cmdwin-char| |cmdwin-char|
*ColorScheme* *ColorScheme*
@@ -585,18 +577,11 @@ ColorSchemePre Before loading a color scheme. |:colorscheme|
Useful to setup removing things added by a Useful to setup removing things added by a
color scheme, before another one is loaded. color scheme, before another one is loaded.
*CompleteDone*
CompleteDone After Insert mode completion is done. Either
when something was completed or abandoning
completion. |ins-completion|
The |v:completed_item| variable contains the
completed item.
CompleteChanged *CompleteChanged* CompleteChanged *CompleteChanged*
After each time the Insert mode completion After each time the Insert mode completion
menu changed. Not fired on popup menu hide, menu changed. Not fired on popup menu hide,
use |CompleteDone| for that. Never triggered use |CompleteDonePre| or |CompleteDone| for
recursively. that.
Sets these |v:event| keys: Sets these |v:event| keys:
completed_item See |complete-items|. completed_item See |complete-items|.
@@ -607,7 +592,29 @@ CompleteChanged *CompleteChanged*
size total nr of items size total nr of items
scrollbar TRUE if visible scrollbar TRUE if visible
It is not allowed to change the text |textlock|. Non-recursive (event cannot trigger itself).
Cannot change the text. |textlock|
The size and position of the popup are also
available by calling |pum_getpos()|.
*CompleteDonePre*
CompleteDonePre After Insert mode completion is done. Either
when something was completed or abandoning
completion. |ins-completion|
|complete_info()| can be used, the info is
cleared after triggering CompleteDonePre.
The |v:completed_item| variable contains
information about the completed item.
*CompleteDone*
CompleteDone After Insert mode completion is done. Either
when something was completed or abandoning
completion. |ins-completion|
|complete_info()| cannot be used, the info is
cleared before triggering CompleteDone. Use
CompleteDonePre if you need it.
|v:completed_item| gives the completed item.
*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
@@ -637,9 +644,9 @@ CursorHold When the user doesn't press a key for the time
:let &ro = &ro :let &ro = &ro
*CursorHoldI* *CursorHoldI*
CursorHoldI Just like CursorHold, but in Insert mode. CursorHoldI Like CursorHold, but in Insert mode. Not
Not triggered when waiting for another key, triggered when waiting for another key, e.g.
e.g. after CTRL-V, and not when in CTRL-X mode after CTRL-V, and not in CTRL-X mode
|insert_expand|. |insert_expand|.
*CursorMoved* *CursorMoved*
@@ -650,7 +657,7 @@ CursorMoved After the cursor was moved in Normal or Visual
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`. 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.
@@ -668,11 +675,11 @@ DirChanged After the |current-directory| was changed.
Sets these |v:event| keys: Sets these |v:event| keys:
cwd: current working directory cwd: current working directory
scope: "global", "tab", "window" scope: "global", "tab", "window"
Recursion is ignored. Non-recursive (event cannot trigger itself).
*FileAppendCmd* *FileAppendCmd*
FileAppendCmd Before appending to a file. Should do the FileAppendCmd Before appending to a file. Should do the
appending to the file. Use the '[ and '] appending to the file. Use the '[ and ']
marks for the range of lines.|Cmd-event| marks for the range of lines. |Cmd-event|
*FileAppendPost* *FileAppendPost*
FileAppendPost After appending to a file. FileAppendPost After appending to a file.
*FileAppendPre* *FileAppendPre*
@@ -680,19 +687,18 @@ FileAppendPre Before appending to a file. Use the '[ and ']
marks for the range of lines. marks for the range of lines.
*FileChangedRO* *FileChangedRO*
FileChangedRO Before making the first change to a read-only FileChangedRO Before making the first change to a read-only
file. Can be used to check-out the file from file. Can be used to checkout the file from
a source control system. Not triggered when a source control system. Not triggered when
the change was caused by an autocommand. the change was caused by an autocommand.
This event is triggered when making the first Triggered when making the first change in
change in a buffer or the first change after a buffer or the first change after 'readonly'
'readonly' was set, just before the change is was set, just before the change is applied to
applied to the text. the text.
WARNING: If the autocommand moves the cursor WARNING: If the autocommand moves the cursor
the effect of the change is undefined. the effect of the change is undefined.
*E788* *E788*
It is not allowed to change to another buffer Cannot switch buffers. You can reload the
here. You can reload the buffer but not edit buffer but not edit another one.
another one.
*E881* *E881*
If the number of lines changes saving for undo If the number of lines changes saving for undo
may fail and the change will be aborted. may fail and the change will be aborted.
@@ -704,34 +710,28 @@ ExitPre When using `:quit`, `:wq` in a way it makes
cancelled if there is a modified buffer that cancelled if there is a modified buffer that
isn't automatically saved, use |VimLeavePre| isn't automatically saved, use |VimLeavePre|
for really exiting. for really exiting.
See also |QuitPre|, |WinClosed|.
*FileChangedShell* *FileChangedShell*
FileChangedShell When Vim notices that the modification time of FileChangedShell When Vim notices that the modification time of
a file has changed since editing started. a file has changed since editing started.
Also when the file attributes of the file Also when the file attributes of the file
change or when the size of the file changes. change or when the size of the file changes.
|timestamp| |timestamp|
Mostly triggered after executing a shell Triggered for each changed file, after:
command, but also with a |:checktime| command - executing a shell command
or when gvim regains input focus. - |:checktime|
This autocommand is triggered for each changed - |FocusGained|
file. It is not used when 'autoread' is set Not used when 'autoread' is set and the buffer
and the buffer was not changed. If a was not changed. If a FileChangedShell
FileChangedShell autocommand is present the autocommand exists the warning message and
warning message and prompt is not given. prompt is not given.
The |v:fcs_reason| variable is set to indicate |v:fcs_reason| indicates what happened. Set
what happened and |v:fcs_choice| can be used |v:fcs_choice| to control what happens next.
to tell Vim what to do next. NOTE: Current buffer "%" may be different from
NOTE: When this autocommand is executed, the the buffer that was changed "<afile>".
current buffer "%" may be different from the *E246* *E811*
buffer that was changed, which is in "<afile>". Cannot switch, jump to or delete buffers.
NOTE: The commands must not change the current Non-recursive (event cannot trigger itself).
buffer, jump to another buffer or delete a
buffer. *E246* *E811*
NOTE: This event never nests, to avoid an
endless loop. This means that while executing
commands for the FileChangedShell event no
other FileChangedShell event will be
triggered.
*FileChangedShellPost* *FileChangedShellPost*
FileChangedShellPost After handling a file that was changed outside FileChangedShellPost After handling a file that was changed outside
of Vim. Can be used to update the statusline. of Vim. Can be used to update the statusline.
@@ -748,10 +748,10 @@ FileReadPre Before reading a file with a ":read" command.
*FileType* *FileType*
FileType When the 'filetype' option has been set. The FileType When the 'filetype' option has been set. The
pattern is matched against the filetype. pattern is matched against the filetype.
<afile> can be used for the name of the file <afile> is the name of the file where this
where this option was set, and <amatch> for option was set. <amatch> is the new value of
the new value of 'filetype'. Navigating to 'filetype'.
another window or buffer is not allowed. Cannot switch windows or buffers.
See |filetypes|. See |filetypes|.
*FileWriteCmd* *FileWriteCmd*
FileWriteCmd Before writing to a file, when not writing the FileWriteCmd Before writing to a file, when not writing the
@@ -844,11 +844,12 @@ TextYankPost Just after a |yank| or |deleting| command, but not
regcontents regcontents
regname regname
regtype regtype
visual
The `inclusive` flag combined with the |'[| The `inclusive` flag combined with the |'[|
and |']| marks can be used to calculate the and |']| marks can be used to calculate the
precise region of the operation. precise region of the operation.
Recursion is ignored. Non-recursive (event cannot trigger itself).
Cannot change the text. |textlock| Cannot change the text. |textlock|
*InsertEnter* *InsertEnter*
InsertEnter Just before starting Insert mode. Also for InsertEnter Just before starting Insert mode. Also for
@@ -915,8 +916,8 @@ OptionSet After setting an option (except during
always use |:noautocmd| to prevent triggering always use |:noautocmd| to prevent triggering
OptionSet. OptionSet.
Recursion is ignored, thus |:set| in the Non-recursive: |:set| in the autocommand does
autocommand does not trigger OptionSet again. not trigger OptionSet again.
*QuickFixCmdPre* *QuickFixCmdPre*
QuickFixCmdPre Before a quickfix command is run (|:make|, QuickFixCmdPre Before a quickfix command is run (|:make|,
@@ -948,7 +949,7 @@ QuitPre When using `:quit`, `:wq` or `:qall`, before
or quits Vim. Can be used to close any or quits Vim. Can be used to close any
non-essential window if the current window is non-essential window if the current window is
the last ordinary window. the last ordinary window.
Also see |ExitPre|. See also |ExitPre|, ||WinClosed|.
*RemoteReply* *RemoteReply*
RemoteReply When a reply from a Vim that functions as RemoteReply When a reply from a Vim that functions as
server was received |server2client()|. The server was received |server2client()|. The
@@ -1024,33 +1025,32 @@ SwapExists Detected an existing swap file when starting
When set to an empty string the user will be When set to an empty string the user will be
asked, as if there was no SwapExists autocmd. asked, as if there was no SwapExists autocmd.
*E812* *E812*
It is not allowed to change to another buffer, Cannot change to another buffer, change
change a buffer name or change directory the buffer name or change directory.
here.
*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.
<afile> can be used for the name of the file <afile> expands to the name of the file where
where this option was set, and <amatch> for this option was set. <amatch> expands to the
the new value of 'syntax'. new value of 'syntax'.
See |:syn-on|. See |:syn-on|.
*TabEnter* *TabEnter*
TabEnter Just after entering a tab page. |tab-page| TabEnter Just after entering a tab page. |tab-page|
After triggering the WinEnter and before After WinEnter.
triggering the BufEnter event. Before BufEnter.
*TabLeave* *TabLeave*
TabLeave Just before leaving a tab page. |tab-page| TabLeave Just before leaving a tab page. |tab-page|
A WinLeave event will have been triggered After WinLeave.
first.
*TabNew* *TabNew*
TabNew When creating a new tab page. |tab-page| TabNew When creating a new tab page. |tab-page|
After WinEnter and before TabEnter. After WinEnter.
Before TabEnter.
*TabNewEntered* *TabNewEntered*
TabNewEntered After entering a new tab page. |tab-page| TabNewEntered After entering a new tab page. |tab-page|
After BufEnter. After BufEnter.
*TabClosed* *TabClosed*
TabClosed After closing a tab page. <afile> can be used TabClosed After closing a tab page. <afile> expands to
for the tab page number. the tab page number.
*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.
@@ -1066,10 +1066,9 @@ TermClose When a |terminal| job ends.
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|
can be used to do things depending on the can be used to do things depending on the
terminal version. Note that this event may be terminal version. May be triggered halfway
triggered halfway through another event through another event (file I/O, a shell
(especially if file I/O, a shell command, or command, or anything else that takes time).
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 after
@@ -1139,6 +1138,12 @@ VimResized After the Vim window was resized, thus 'lines'
VimResume After Nvim resumes from |suspend| state. VimResume After Nvim resumes from |suspend| state.
*VimSuspend* *VimSuspend*
VimSuspend Before Nvim enters |suspend| state. VimSuspend Before Nvim enters |suspend| state.
*WinClosed*
WinClosed After closing a window. <afile> expands to the
|window-ID|.
After WinLeave.
Non-recursive (event cannot trigger itself).
See also |ExitPre|, |QuitPre|.
*WinEnter* *WinEnter*
WinEnter After entering another window. Not done for WinEnter After entering another window. Not done for
the first window, when Vim has just started. the first window, when Vim has just started.
@@ -1156,11 +1161,11 @@ WinLeave Before leaving a window. If the window to be
executes the BufLeave autocommands before the executes the BufLeave autocommands before the
WinLeave autocommands (but not for ":new"). WinLeave autocommands (but not for ":new").
Not used for ":qa" or ":q" when exiting Vim. Not used for ":qa" or ":q" when exiting Vim.
After WinClosed.
*WinNew* *WinNew*
WinNew When a new window was created. Not done for WinNew When a new window was created. Not done for
the first window, when Vim has just started. the first window, when Vim has just started.
Before a WinEnter event. Before WinEnter.
============================================================================== ==============================================================================
6. Patterns *autocmd-pattern* *{pat}* 6. Patterns *autocmd-pattern* *{pat}*

View File

@@ -90,7 +90,7 @@ start and end of the motion are not in the same line, and there are only
blanks before the start and there are no non-blanks after the end of the blanks before the start and there are no non-blanks after the end of the
motion, the delete becomes linewise. This means that the delete also removes motion, the delete becomes linewise. This means that the delete also removes
the line of blanks that you might expect to remain. Use the |o_v| operator to the line of blanks that you might expect to remain. Use the |o_v| operator to
force the motion to be characterwise. force the motion to be charwise.
Trying to delete an empty region of text (e.g., "d0" in the first column) Trying to delete an empty region of text (e.g., "d0" in the first column)
is an error when 'cpoptions' includes the 'E' flag. is an error when 'cpoptions' includes the 'E' flag.
@@ -1074,7 +1074,7 @@ also use these commands to move text from one file to another, because Vim
preserves all registers when changing buffers (the CTRL-^ command is a quick preserves all registers when changing buffers (the CTRL-^ command is a quick
way to toggle between two files). way to toggle between two files).
*linewise-register* *characterwise-register* *linewise-register* *charwise-register*
You can repeat the put commands with "." (except for :put) and undo them. If You can repeat the put commands with "." (except for :put) and undo them. If
the command that was used to get the text into the register was |linewise|, the command that was used to get the text into the register was |linewise|,
Vim inserts the text below ("p") or above ("P") the line where the cursor is. Vim inserts the text below ("p") or above ("P") the line where the cursor is.
@@ -1116,10 +1116,9 @@ this happen. However, if the width of the block is not a multiple of a <Tab>
width and the text after the inserted block contains <Tab>s, that text may be width and the text after the inserted block contains <Tab>s, that text may be
misaligned. misaligned.
Note that after a characterwise yank command, Vim leaves the cursor on the Note that after a charwise yank command, Vim leaves the cursor on the first
first yanked character that is closest to the start of the buffer. This means yanked character that is closest to the start of the buffer. This means that
that "yl" doesn't move the cursor, but "yh" moves the cursor one character "yl" doesn't move the cursor, but "yh" moves the cursor one character left.
left.
Rationale: In Vi the "y" command followed by a backwards motion would Rationale: In Vi the "y" command followed by a backwards motion would
sometimes not move the cursor to the first yanked character, sometimes not move the cursor to the first yanked character,
because redisplaying was skipped. In Vim it always moves to because redisplaying was skipped. In Vim it always moves to

View File

@@ -1122,11 +1122,9 @@ edited as described in |cmdwin-char|.
AUTOCOMMANDS AUTOCOMMANDS
Two autocommand events are used: |CmdwinEnter| and |CmdwinLeave|. Since this Two autocommand events are used: |CmdwinEnter| and |CmdwinLeave|. You can use
window is of a special type, the WinEnter, WinLeave, BufEnter and BufLeave the Cmdwin events to do settings specifically for the command-line window.
events are not triggered. You can use the Cmdwin events to do settings Be careful not to cause side effects!
specifically for the command-line window. Be careful not to cause side
effects!
Example: > Example: >
:au CmdwinEnter : let b:cpt_save = &cpt | set cpt=. :au CmdwinEnter : let b:cpt_save = &cpt | set cpt=.
:au CmdwinLeave : let &cpt = b:cpt_save :au CmdwinLeave : let &cpt = b:cpt_save

View File

@@ -14,6 +14,8 @@ updated.
API ~ API ~
*nvim_buf_clear_highlight()* Use |nvim_buf_clear_namespace()| instead. *nvim_buf_clear_highlight()* Use |nvim_buf_clear_namespace()| instead.
*nvim_command_output()* Use |nvim_exec()| instead.
*nvim_execute_lua()* Use |nvim_exec_lua()| instead.
Commands ~ Commands ~
*:rv* *:rv*
@@ -26,6 +28,7 @@ Environment Variables ~
$NVIM_LISTEN_ADDRESS is ignored. $NVIM_LISTEN_ADDRESS is ignored.
Events ~ Events ~
*BufCreate* Use |BufAdd| instead.
*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. *GUIEnter* Never fired; use |UIEnter| instead.

View File

@@ -143,6 +143,87 @@ DOCUMENTATION *dev-doc*
/// @param dirname The path fragment before `pend` /// @param dirname The path fragment before `pend`
< <
C docstrings ~
Nvim API documentation lives in the source code, as docstrings (Doxygen
comments) on the function definitions. The |api| :help is generated
from the docstrings defined in src/nvim/api/*.c.
Docstring format:
- Lines start with `///`
- Special tokens start with `@` followed by the token name:
`@note`, `@param`, `@returns`
- Limited markdown is supported.
- List-items start with `-` (useful to nest or "indent")
- Use `<pre>` for code samples.
Example: the help for |nvim_open_win()| is generated from a docstring defined
in src/nvim/api/vim.c like this: >
/// Opens a new window.
/// ...
///
/// Example (Lua): window-relative float
/// <pre>
/// vim.api.nvim_open_win(0, false,
/// {relative='win', row=3, col=3, width=12, height=3})
/// </pre>
///
/// @param buffer Buffer to display
/// @param enter Enter the window
/// @param config Map defining the window configuration. Keys:
/// - relative: Sets the window layout, relative to:
/// - "editor" The global editor grid.
/// - "win" Window given by the `win` field.
/// - "cursor" Cursor position in current window.
/// ...
/// @param[out] err Error details, if any
///
/// @return Window handle, or 0 on error
Lua docstrings ~
*dev-lua-doc*
Lua documentation lives in the source code, as docstrings on the function
definitions. The |lua-vim| :help is generated from the docstrings.
Docstring format:
- Lines in the main description start with `---`
- Special tokens start with `--@` followed by the token name:
`--@see`, `--@param`, `--@returns`
- Limited markdown is supported.
- List-items start with `-` (useful to nest or "indent")
- Use `<pre>` for code samples.
Example: the help for |vim.paste()| is generated from a docstring decorating
vim.paste in src/nvim/lua/vim.lua like this: >
--- Paste handler, invoked by |nvim_paste()| when a conforming UI
--- (such as the |TUI|) pastes text into the editor.
---
--- Example: To remove ANSI color codes when pasting:
--- <pre>
--- vim.paste = (function()
--- local overridden = vim.paste
--- ...
--- end)()
--- </pre>
---
--@see |paste|
---
--@param lines ...
--@param phase ...
--@returns false if client should cancel the paste.
LUA *dev-lua*
- Keep the core Lua modules |lua-stdlib| simple. Avoid elaborate OOP or
pseudo-OOP designs. Plugin authors just want functions to call, they don't
want to learn a big, fancy inheritance hierarchy. So we should avoid complex
objects: tables are usually better.
API *dev-api* API *dev-api*
Use this template to name new API functions: Use this template to name new API functions:
@@ -155,10 +236,11 @@ 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)
set Set a thing (or group of things)
del Delete a thing (or group of things) del Delete a thing (or group of things)
exec Execute code
get Get a thing (or group of things by query)
list Get all things list Get all things
set Set a thing (or group of 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.
@@ -268,8 +350,8 @@ External UIs are expected to implement these common features:
chords (<C-,> <C-Enter> <C-S-x> <D-x>) and patterns ("shift shift") that do chords (<C-,> <C-Enter> <C-S-x> <D-x>) and patterns ("shift shift") that do
not potentially conflict with Nvim defaults, plugins, etc. not potentially conflict with Nvim defaults, plugins, etc.
- Consider the "option_set" |ui-global| event as a hint for other GUI - Consider the "option_set" |ui-global| event as a hint for other GUI
behaviors. UI-related options ('guifont', 'ambiwidth', …) are published in behaviors. Various UI-related options ('guifont', 'ambiwidth', …) are
this event. published in this event. See also "mouse_on", "mouse_off".
vim:tw=78:ts=8:noet:ft=help:norl: vim:tw=78:ts=8:noet:ft=help:norl:

View File

@@ -20,7 +20,9 @@ An alternative is using the 'keymap' option.
1. Defining digraphs *digraphs-define* 1. Defining digraphs *digraphs-define*
*:dig* *:digraphs* *:dig* *:digraphs*
:dig[raphs] show currently defined digraphs. :dig[raphs][!] Show currently defined digraphs.
With [!] headers are used to make it a bit easier to
find a specific character.
*E104* *E39* *E104* *E39*
:dig[raphs] {char1}{char2} {number} ... :dig[raphs] {char1}{char2} {number} ...
Add digraph {char1}{char2} to the list. {number} is Add digraph {char1}{char2} to the list. {number} is

View File

@@ -1265,7 +1265,7 @@ exist, the next-higher scope in the hierarchy applies.
other tabs and windows is not changed. other tabs and windows is not changed.
*:tcd-* *:tcd-*
:tcd[!] - Change to the previous current directory (before the :tc[d][!] - Change to the previous current directory (before the
previous ":tcd {path}" command). previous ":tcd {path}" command).
*:tch* *:tchdir* *:tch* *:tchdir*
@@ -1280,7 +1280,7 @@ exist, the next-higher scope in the hierarchy applies.
:lch[dir][!] Same as |:lcd|. :lch[dir][!] Same as |:lcd|.
*:lcd-* *:lcd-*
:lcd[!] - Change to the previous current directory (before the :lc[d][!] - Change to the previous current directory (before the
previous ":lcd {path}" command). previous ":lcd {path}" command).
*:pw* *:pwd* *E187* *:pw* *:pwd* *E187*

View File

@@ -1217,7 +1217,7 @@ lambda expression *expr-lambda* *lambda*
{args -> expr1} lambda expression {args -> expr1} lambda expression
A lambda expression creates a new unnamed function which returns the result of A lambda expression creates a new unnamed function which returns the result of
evaluating |expr1|. Lambda expressions differ from |user-functions| in evaluating |expr1|. Lambda expressions differ from |user-function|s in
the following ways: the following ways:
1. The body of the lambda expression is an |expr1| and not a sequence of |Ex| 1. The body of the lambda expression is an |expr1| and not a sequence of |Ex|
@@ -1423,6 +1423,10 @@ PREDEFINED VIM VARIABLES *vim-variable* *v:var* *v:*
*E963* *E963*
Some variables can be set by the user, but the type cannot be changed. Some variables can be set by the user, but the type cannot be changed.
*v:argv* *argv-variable*
v:argv The command line arguments Vim was invoked with. This is a
list of strings. The first item is the Vim command.
*v:beval_col* *beval_col-variable* *v:beval_col* *beval_col-variable*
v:beval_col The number of the column, over which the mouse pointer is. v:beval_col The number of the column, over which the mouse pointer is.
This is the byte index in the |v:beval_lnum| line. This is the byte index in the |v:beval_lnum| line.
@@ -1547,10 +1551,12 @@ v:errmsg Last given error message.
:if v:errmsg != "" :if v:errmsg != ""
: ... handle error : ... handle error
< <
*v:errors* *errors-variable* *v:errors* *errors-variable* *assert-return*
v:errors Errors found by assert functions, such as |assert_true()|. v:errors Errors found by assert functions, such as |assert_true()|.
This is a list of strings. This is a list of strings.
The assert functions append an item when an assert fails. The assert functions append an item when an assert fails.
The return value indicates this: a one is returned if an item
was added to v:errors, otherwise zero is returned.
To remove old results make it empty: > To remove old results make it empty: >
:let v:errors = [] :let v:errors = []
< If v:errors is set to anything but a list it is made an empty < If v:errors is set to anything but a list it is made an empty
@@ -1585,6 +1591,8 @@ v:event Dictionary of event data for the current |autocommand|. Valid
operation. operation.
regtype Type of register as returned by regtype Type of register as returned by
|getregtype()|. |getregtype()|.
visual Selection is visual (as opposed to,
e.g., via motion).
completed_item Current selected complete item on completed_item Current selected complete item on
|CompleteChanged|, Is `{}` when no complete |CompleteChanged|, Is `{}` when no complete
item selected. item selected.
@@ -1735,6 +1743,10 @@ v:lnum Line number for the 'foldexpr' |fold-expr|, 'formatexpr' and
expressions is being evaluated. Read-only when in the expressions is being evaluated. Read-only when in the
|sandbox|. |sandbox|.
*v:lua* *lua-variable*
v:lua Prefix for calling Lua functions from expressions.
See |v:lua-call| for more information.
*v:mouse_win* *mouse_win-variable* *v:mouse_win* *mouse_win-variable*
v:mouse_win Window number for a mouse click obtained with |getchar()|. v:mouse_win Window number for a mouse click obtained with |getchar()|.
First window has number 1, like with |winnr()|. The value is First window has number 1, like with |winnr()|. The value is
@@ -1984,9 +1996,12 @@ v:windowid Application-specific window "handle" which may be set by any
|window-ID|. |window-ID|.
============================================================================== ==============================================================================
4. Builtin Functions *functions* 4. Builtin Functions *vim-function* *functions*
See |function-list| for a list grouped by what the function is used for. The Vimscript subsystem (referred to as "eval" internally) provides the
following builtin functions. Scripts can also define |user-function|s.
See |function-list| to browse functions by topic.
(Use CTRL-] on the function name to jump to the full explanation.) (Use CTRL-] on the function name to jump to the full explanation.)
@@ -2004,25 +2019,27 @@ argidx() Number current index in the argument list
arglistid([{winnr} [, {tabnr}]]) Number argument list id arglistid([{winnr} [, {tabnr}]]) Number argument list id
argv({nr} [, {winid}]) String {nr} entry of the argument list argv({nr} [, {winid}]) String {nr} entry of the argument list
argv([-1, {winid}]) List the argument list argv([-1, {winid}]) List the argument list
assert_beeps({cmd}) none assert {cmd} causes a beep
assert_equal({exp}, {act} [, {msg}])
none assert {exp} is equal to {act}
assert_exception({error} [, {msg}])
none assert {error} is in v:exception
assert_fails({cmd} [, {error}]) none assert {cmd} fails
assert_false({actual} [, {msg}])
none assert {actual} is false
assert_inrange({lower}, {upper}, {actual} [, {msg}])
none assert {actual} is inside the range
assert_match({pat}, {text} [, {msg}])
none assert {pat} matches {text}
assert_notequal({exp}, {act} [, {msg}])
none assert {exp} is not equal {act}
assert_notmatch({pat}, {text} [, {msg}])
none assert {pat} not matches {text}
assert_report({msg}) none report a test failure
assert_true({actual} [, {msg}]) none assert {actual} is true
asin({expr}) Float arc sine of {expr} asin({expr}) Float arc sine of {expr}
assert_beeps({cmd}) Number assert {cmd} causes a beep
assert_equal({exp}, {act} [, {msg}])
Number assert {exp} is equal to {act}
assert_equalfile({fname-one}, {fname-two} [, {msg}])
Number assert file contents are equal
assert_exception({error} [, {msg}])
Number assert {error} is in v:exception
assert_fails({cmd} [, {error}]) Number assert {cmd} fails
assert_false({actual} [, {msg}])
Number assert {actual} is false
assert_inrange({lower}, {upper}, {actual} [, {msg}])
Number assert {actual} is inside the range
assert_match({pat}, {text} [, {msg}])
Number assert {pat} matches {text}
assert_notequal({exp}, {act} [, {msg}])
Number assert {exp} is not equal {act}
assert_notmatch({pat}, {text} [, {msg}])
Number assert {pat} not matches {text}
assert_report({msg}) Number report a test failure
assert_true({actual} [, {msg}]) Number assert {actual} is true
atan({expr}) Float arc tangent of {expr} atan({expr}) Float arc tangent of {expr}
atan2({expr}, {expr}) Float arc tangent of {expr1} / {expr2} atan2({expr}, {expr}) Float arc tangent of {expr1} / {expr2}
browse({save}, {title}, {initdir}, {default}) browse({save}, {title}, {initdir}, {default})
@@ -2048,7 +2065,7 @@ chanclose({id}[, {stream}]) Number Closes a channel or one of its streams
chansend({id}, {data}) Number Writes {data} to channel chansend({id}, {data}) Number Writes {data} to channel
char2nr({expr}[, {utf8}]) Number ASCII/UTF8 value of first char in {expr} char2nr({expr}[, {utf8}]) Number ASCII/UTF8 value of first char in {expr}
cindent({lnum}) Number C indent for line {lnum} cindent({lnum}) Number C indent for line {lnum}
clearmatches() none clear all matches clearmatches([{win}]) none clear all matches
col({expr}) Number column nr of cursor or mark col({expr}) Number column nr of cursor or mark
complete({startcol}, {matches}) none set Insert mode completion complete({startcol}, {matches}) none set Insert mode completion
complete_add({expr}) Number add completion match complete_add({expr}) Number add completion match
@@ -2073,6 +2090,7 @@ ctxsize() Number return |context-stack| size
cursor({lnum}, {col} [, {off}]) cursor({lnum}, {col} [, {off}])
Number move cursor to {lnum}, {col}, {off} Number move cursor to {lnum}, {col}, {off}
cursor({list}) Number move cursor to position in {list} cursor({list}) Number move cursor to position in {list}
debugbreak({pid}) Number interrupt process being debugged
deepcopy({expr} [, {noref}]) any make a full copy of {expr} deepcopy({expr} [, {noref}]) any make a full copy of {expr}
delete({fname} [, {flags}]) Number delete the file or directory {fname} delete({fname} [, {flags}]) Number delete the file or directory {fname}
deletebufline({expr}, {first}[, {last}]) deletebufline({expr}, {first}[, {last}])
@@ -2098,6 +2116,7 @@ extend({expr1}, {expr2} [, {expr3}])
exp({expr}) Float exponential of {expr} exp({expr}) Float exponential of {expr}
expand({expr} [, {nosuf} [, {list}]]) expand({expr} [, {nosuf} [, {list}]])
any expand special keywords in {expr} any expand special keywords in {expr}
expandcmd({expr}) String expand {expr} like with `:edit`
feedkeys({string} [, {mode}]) Number add key sequence to typeahead buffer feedkeys({string} [, {mode}]) Number add key sequence to typeahead buffer
filereadable({file}) Number |TRUE| if {file} is a readable file filereadable({file}) Number |TRUE| if {file} is a readable file
filewritable({file}) Number |TRUE| if {file} is a writable file filewritable({file}) Number |TRUE| if {file} is a writable file
@@ -2107,6 +2126,7 @@ finddir({name} [, {path} [, {count}]])
String find directory {name} in {path} String find directory {name} in {path}
findfile({name} [, {path} [, {count}]]) findfile({name} [, {path} [, {count}]])
String find file {name} in {path} String find file {name} in {path}
flatten({list} [, {maxdepth}]) List flatten {list} up to {maxdepth} levels
float2nr({expr}) Number convert Float {expr} to a Number float2nr({expr}) Number convert Float {expr} to a Number
floor({expr}) Float round {expr} down floor({expr}) Float round {expr} down
fmod({expr1}, {expr2}) Float remainder of {expr1} / {expr2} fmod({expr1}, {expr2}) Float remainder of {expr1} / {expr2}
@@ -2154,7 +2174,7 @@ getjumplist([{winnr} [, {tabnr}]])
getline({lnum}) String line {lnum} of current buffer getline({lnum}) String line {lnum} of current buffer
getline({lnum}, {end}) List lines {lnum} to {end} of current buffer getline({lnum}, {end}) List lines {lnum} to {end} of current buffer
getloclist({nr} [, {what}]) List list of location list items getloclist({nr} [, {what}]) List list of location list items
getmatches() List list of current matches getmatches([{win}]) List list of current matches
getpid() Number process ID of Vim getpid() Number process ID of Vim
getpos({expr}) List position of cursor, mark, etc. getpos({expr}) List position of cursor, mark, etc.
getqflist([{what}]) List list of quickfix items getqflist([{what}]) List list of quickfix items
@@ -2228,6 +2248,7 @@ libcallnr({lib}, {func}, {arg}) Number idem, but return a Number
line({expr}) Number line nr of cursor, last line or mark line({expr}) Number line nr of cursor, last line or mark
line2byte({lnum}) Number byte count of line {lnum} line2byte({lnum}) Number byte count of line {lnum}
lispindent({lnum}) Number Lisp indent for line {lnum} lispindent({lnum}) Number Lisp indent for line {lnum}
list2str({list} [, {utf8}]) String turn numbers in {list} into a String
localtime() Number current time localtime() Number current time
log({expr}) Float natural logarithm (base e) of {expr} log({expr}) Float natural logarithm (base e) of {expr}
log10({expr}) Float logarithm of Float {expr} to base 10 log10({expr}) Float logarithm of Float {expr} to base 10
@@ -2245,7 +2266,7 @@ matchadd({group}, {pattern}[, {priority}[, {id}]])
matchaddpos({group}, {list}[, {priority}[, {id}]]) matchaddpos({group}, {list}[, {priority}[, {id}]])
Number highlight positions with {group} Number highlight positions with {group}
matcharg({nr}) List arguments of |:match| matcharg({nr}) List arguments of |:match|
matchdelete({id}) Number delete match identified by {id} matchdelete({id} [, {win}]) Number delete match identified by {id}
matchend({expr}, {pat}[, {start}[, {count}]]) matchend({expr}, {pat}[, {start}[, {count}]])
Number position where {pat} ends in {expr} Number position where {pat} ends in {expr}
matchlist({expr}, {pat}[, {start}[, {count}]]) matchlist({expr}, {pat}[, {start}[, {count}]])
@@ -2269,6 +2290,11 @@ pathshorten({expr}) String shorten directory names in a path
pow({x}, {y}) Float {x} to the power of {y} pow({x}, {y}) Float {x} to the power of {y}
prevnonblank({lnum}) Number line nr of non-blank line <= {lnum} prevnonblank({lnum}) Number line nr of non-blank line <= {lnum}
printf({fmt}, {expr1}...) String format text printf({fmt}, {expr1}...) String format text
prompt_addtext({buf}, {expr}) none add text to a prompt buffer
prompt_setcallback({buf}, {expr}) none set prompt callback function
prompt_setinterrupt({buf}, {text}) none set prompt interrupt function
prompt_setprompt({buf}, {text}) none set prompt text
pum_getpos() Dict position and size of pum if visible
pumvisible() Number whether popup menu is visible pumvisible() Number whether popup menu is visible
pyeval({expr}) any evaluate |Python| expression pyeval({expr}) any evaluate |Python| expression
py3eval({expr}) any evaluate |python3| expression py3eval({expr}) any evaluate |python3| expression
@@ -2278,7 +2304,7 @@ range({expr} [, {max} [, {stride}]])
readdir({dir} [, {expr}]) List file names in {dir} selected by {expr} readdir({dir} [, {expr}]) List file names in {dir} selected by {expr}
readfile({fname} [, {binary} [, {max}]]) readfile({fname} [, {binary} [, {max}]])
List get list of lines from file {fname} List get list of lines from file {fname}
reg_executing() Number get the executing register name reg_executing() String get the executing register name
reg_recording() String get the recording register name reg_recording() String get the recording register name
reltime([{start} [, {end}]]) List get time value reltime([{start} [, {end}]]) List get time value
reltimefloat({time}) Float turn the time value into a Float reltimefloat({time}) Float turn the time value into a Float
@@ -2333,7 +2359,7 @@ setfperm({fname}, {mode} Number set {fname} file permissions to {mode}
setline({lnum}, {line}) Number set line {lnum} to {line} setline({lnum}, {line}) Number set line {lnum} to {line}
setloclist({nr}, {list}[, {action}[, {what}]]) setloclist({nr}, {list}[, {action}[, {what}]])
Number modify location list using {list} Number modify location list using {list}
setmatches({list}) Number restore a list of matches setmatches({list} [, {win}]) Number restore a list of matches
setpos({expr}, {list}) Number set the {expr} position to {list} setpos({expr}, {list}) Number set the {expr} position to {list}
setqflist({list}[, {action}[, {what}]] setqflist({list}[, {action}[, {what}]]
Number modify quickfix list using {list} Number modify quickfix list using {list}
@@ -2377,6 +2403,8 @@ sqrt({expr}) Float square root of {expr}
stdioopen({dict}) Number open stdio in a headless instance. stdioopen({dict}) Number open stdio in a headless instance.
stdpath({what}) String/List returns the standard path(s) for {what} stdpath({what}) String/List returns the standard path(s) for {what}
str2float({expr}) Float convert String to Float str2float({expr}) Float convert String to Float
str2list({expr} [, {utf8}]) List convert each character of {expr} to
ASCII/UTF8 value
str2nr({expr} [, {base}]) Number convert String to Number str2nr({expr} [, {base}]) Number convert String to Number
strchars({expr} [, {skipcc}]) Number character length of the String {expr} strchars({expr} [, {skipcc}]) Number character length of the String {expr}
strcharpart({str}, {start} [, {len}]) strcharpart({str}, {start} [, {len}])
@@ -2508,6 +2536,9 @@ and({expr}, {expr}) *and()*
api_info() *api_info()* api_info() *api_info()*
Returns Dictionary of |api-metadata|. Returns Dictionary of |api-metadata|.
View it in a nice human-readable format: >
:lua print(vim.inspect(vim.fn.api_info()))
append({lnum}, {text}) *append()* append({lnum}, {text}) *append()*
When {text} is a |List|: Append each item of the |List| as a When {text} is a |List|: Append each item of the |List| as a
text line below line {lnum} in the current buffer. text line below line {lnum} in the current buffer.
@@ -2576,16 +2607,18 @@ argv([{nr} [, {winid}])
the whole |arglist| is returned. the whole |arglist| is returned.
The {winid} argument specifies the window ID, see |argc()|. The {winid} argument specifies the window ID, see |argc()|.
For the Vim command line arguments see |v:argv|.
assert_beeps({cmd}) *assert_beeps()* assert_beeps({cmd}) *assert_beeps()*
Run {cmd} and add an error message to |v:errors| if it does Run {cmd} and add an error message to |v:errors| if it does
NOT produce a beep or visual bell. NOT produce a beep or visual bell.
Also see |assert_fails()|. Also see |assert_fails()| and |assert-return|.
*assert_equal()* *assert_equal()*
assert_equal({expected}, {actual}, [, {msg}]) assert_equal({expected}, {actual}, [, {msg}])
When {expected} and {actual} are not equal an error message is When {expected} and {actual} are not equal an error message is
added to |v:errors|. added to |v:errors| and 1 is returned. Otherwise zero is
returned |assert-return|.
There is no automatic conversion, the String "4" is different There is no automatic conversion, the String "4" is different
from the Number 4. And the number 4 is different from the from the Number 4. And the number 4 is different from the
Float 4.0. The value of 'ignorecase' is not used here, case Float 4.0. The value of 'ignorecase' is not used here, case
@@ -2597,9 +2630,17 @@ assert_equal({expected}, {actual}, [, {msg}])
< Will result in a string to be added to |v:errors|: < Will result in a string to be added to |v:errors|:
test.vim line 12: Expected 'foo' but got 'bar' ~ test.vim line 12: Expected 'foo' but got 'bar' ~
*assert_equalfile()*
assert_equalfile({fname-one}, {fname-two} [, {msg}])
When the files {fname-one} and {fname-two} do not contain
exactly the same text an error message is added to |v:errors|.
Also see |assert-return|.
When {fname-one} or {fname-two} does not exist the error will
mention that.
assert_exception({error} [, {msg}]) *assert_exception()* assert_exception({error} [, {msg}]) *assert_exception()*
When v:exception does not contain the string {error} an error When v:exception does not contain the string {error} an error
message is added to |v:errors|. message is added to |v:errors|. Also see |assert-return|.
This can be used to assert that a command throws an exception. This can be used to assert that a command throws an exception.
Using the error number, followed by a colon, avoids problems Using the error number, followed by a colon, avoids problems
with translations: > with translations: >
@@ -2612,7 +2653,7 @@ assert_exception({error} [, {msg}]) *assert_exception()*
assert_fails({cmd} [, {error} [, {msg}]]) *assert_fails()* assert_fails({cmd} [, {error} [, {msg}]]) *assert_fails()*
Run {cmd} and add an error message to |v:errors| if it does Run {cmd} and add an error message to |v:errors| if it does
NOT produce an error. NOT produce an error. Also see |assert-return|.
When {error} is given it must match in |v:errmsg|. When {error} is given it must match in |v:errmsg|.
Note that beeping is not considered an error, and some failing Note that beeping is not considered an error, and some failing
commands only beep. Use |assert_beeps()| for those. commands only beep. Use |assert_beeps()| for those.
@@ -2620,6 +2661,7 @@ assert_fails({cmd} [, {error} [, {msg}]]) *assert_fails()*
assert_false({actual} [, {msg}]) *assert_false()* assert_false({actual} [, {msg}]) *assert_false()*
When {actual} is not false an error message is added to When {actual} is not false an error message is added to
|v:errors|, like with |assert_equal()|. |v:errors|, like with |assert_equal()|.
Also see |assert-return|.
A value is false when it is zero or |v:false|. When "{actual}" A value is false when it is zero or |v:false|. When "{actual}"
is not a number or |v:false| the assert fails. is not a number or |v:false| the assert fails.
When {msg} is omitted an error in the form When {msg} is omitted an error in the form
@@ -2636,7 +2678,7 @@ assert_inrange({lower}, {upper}, {actual} [, {msg}]) *assert_inrange()*
*assert_match()* *assert_match()*
assert_match({pattern}, {actual} [, {msg}]) assert_match({pattern}, {actual} [, {msg}])
When {pattern} does not match {actual} an error message is When {pattern} does not match {actual} an error message is
added to |v:errors|. added to |v:errors|. Also see |assert-return|.
{pattern} is used as with |=~|: The matching is always done {pattern} is used as with |=~|: The matching is always done
like 'magic' was set and 'cpoptions' is empty, no matter what like 'magic' was set and 'cpoptions' is empty, no matter what
@@ -2657,18 +2699,22 @@ assert_match({pattern}, {actual} [, {msg}])
assert_notequal({expected}, {actual} [, {msg}]) assert_notequal({expected}, {actual} [, {msg}])
The opposite of `assert_equal()`: add an error message to The opposite of `assert_equal()`: add an error message to
|v:errors| when {expected} and {actual} are equal. |v:errors| when {expected} and {actual} are equal.
Also see |assert-return|.
*assert_notmatch()* *assert_notmatch()*
assert_notmatch({pattern}, {actual} [, {msg}]) assert_notmatch({pattern}, {actual} [, {msg}])
The opposite of `assert_match()`: add an error message to The opposite of `assert_match()`: add an error message to
|v:errors| when {pattern} matches {actual}. |v:errors| when {pattern} matches {actual}.
Also see |assert-return|.
assert_report({msg}) *assert_report()* assert_report({msg}) *assert_report()*
Report a test failure directly, using {msg}. Report a test failure directly, using {msg}.
Always returns one.
assert_true({actual} [, {msg}]) *assert_true()* assert_true({actual} [, {msg}]) *assert_true()*
When {actual} is not true an error message is added to When {actual} is not true an error message is added to
|v:errors|, like with |assert_equal()|. |v:errors|, like with |assert_equal()|.
Also see |assert-return|.
A value is |TRUE| when it is a non-zero number or |v:true|. A value is |TRUE| when it is a non-zero number or |v:true|.
When {actual} is not a number or |v:true| the assert fails. When {actual} is not a number or |v:true| the assert fails.
When {msg} is omitted an error in the form "Expected True but When {msg} is omitted an error in the form "Expected True but
@@ -2967,9 +3013,11 @@ cindent({lnum}) *cindent()*
When {lnum} is invalid -1 is returned. When {lnum} is invalid -1 is returned.
See |C-indenting|. See |C-indenting|.
clearmatches() *clearmatches()* clearmatches([{win}]) *clearmatches()*
Clears all matches previously defined for the current window Clears all matches previously defined for the current window
by |matchadd()| and the |:match| commands. by |matchadd()| and the |:match| commands.
If {win} is specified, use the window with this number or
window ID instead of the current window.
*col()* *col()*
col({expr}) The result is a Number, which is the byte index of the column col({expr}) The result is a Number, which is the byte index of the column
@@ -3095,6 +3143,10 @@ complete_info([{what}])
the items listed in {what} are returned. Unsupported items in the items listed in {what} are returned. Unsupported items in
{what} are silently ignored. {what} are silently ignored.
To get the position and size of the popup menu, see
|pum_getpos()|. It's also available in |v:event| during the
|CompleteChanged| event.
Examples: > Examples: >
" Get all items " Get all items
call complete_info() call complete_info()
@@ -3525,7 +3577,7 @@ exists({expr}) The result is a Number, which is |TRUE| if {expr} is
string) string)
*funcname built-in function (see |functions|) *funcname built-in function (see |functions|)
or user defined function (see or user defined function (see
|user-functions|). Also works for a |user-function|). Also works for a
variable that is a Funcref. variable that is a Funcref.
varname internal variable (see varname internal variable (see
|internal-variables|). Also works |internal-variables|). Also works
@@ -3604,6 +3656,11 @@ exp({expr}) *exp()*
:echo exp(-1) :echo exp(-1)
< 0.367879 < 0.367879
debugbreak({pid}) *debugbreak()*
Specifically used to interrupt a program being debugged. It
will cause process {pid} to get a SIGTRAP. Behavior for other
processes is undefined. See |terminal-debugger|.
{Sends a SIGINT to a process {pid} other than MS-Windows}
expand({expr} [, {nosuf} [, {list}]]) *expand()* expand({expr} [, {nosuf} [, {list}]]) *expand()*
Expand wildcards and the following special keywords in {expr}. Expand wildcards and the following special keywords in {expr}.
@@ -3687,6 +3744,14 @@ expand({expr} [, {nosuf} [, {list}]]) *expand()*
See |glob()| for finding existing files. See |system()| for See |glob()| for finding existing files. See |system()| for
getting the raw output of an external command. getting the raw output of an external command.
expandcmd({expr}) *expandcmd()*
Expand special items in {expr} like what is done for an Ex
command such as `:edit`. This expands special keywords, like
with |expand()|, and environment variables, anywhere in
{expr}. Returns the expanded string.
Example: >
:echo expandcmd('make %<.o')
<
extend({expr1}, {expr2} [, {expr3}]) *extend()* extend({expr1}, {expr2} [, {expr3}]) *extend()*
{expr1} and {expr2} must be both |Lists| or both {expr1} and {expr2} must be both |Lists| or both
|Dictionaries|. |Dictionaries|.
@@ -3741,6 +3806,8 @@ feedkeys({string} [, {mode}]) *feedkeys()*
and "\..." notation |expr-quote|. For example, and "\..." notation |expr-quote|. For example,
feedkeys("\<CR>") simulates pressing of the <Enter> key. But feedkeys("\<CR>") simulates pressing of the <Enter> key. But
feedkeys('\<CR>') pushes 5 characters. feedkeys('\<CR>') pushes 5 characters.
The |<Ignore>| keycode may be used to exit the
wait-for-character without doing anything.
{mode} is a String, which can contain these character flags: {mode} is a String, which can contain these character flags:
'm' Remap keys. This is default. If {mode} is absent, 'm' Remap keys. This is default. If {mode} is absent,
@@ -3852,6 +3919,25 @@ findfile({name} [, {path} [, {count}]]) *findfile()*
< Searches from the directory of the current file upwards until < Searches from the directory of the current file upwards until
it finds the file "tags.vim". it finds the file "tags.vim".
flatten({list} [, {maxdepth}]) *flatten()*
Flatten {list} up to {maxdepth} levels. Without {maxdepth}
the result is a |List| without nesting, as if {maxdepth} is
a very large number.
The {list} is changed in place, make a copy first if you do
not want that.
*E964*
{maxdepth} means how deep in nested lists changes are made.
{list} is not modified when {maxdepth} is 0.
{maxdepth} must be positive number.
If there is an error the number zero is returned.
Example: >
:echo flatten([1, [2, [3, 4]], 5])
< [1, 2, 3, 4, 5] >
:echo flatten([1, [2, [3, 4]], 5], 1)
< [1, 2, [3, 4], 5]
float2nr({expr}) *float2nr()* float2nr({expr}) *float2nr()*
Convert {expr} to a Number by omitting the part after the Convert {expr} to a Number by omitting the part after the
decimal point. decimal point.
@@ -4107,8 +4193,13 @@ getbufinfo([{dict}])
changed TRUE if the buffer is modified. changed TRUE if the buffer is modified.
changedtick number of changes made to the buffer. changedtick number of changes made to the buffer.
hidden TRUE if the buffer is hidden. hidden TRUE if the buffer is hidden.
lastused timestamp in seconds, like
|localtime()|, when the buffer was
last used.
listed TRUE if the buffer is listed. listed TRUE if the buffer is listed.
lnum current line number in buffer. lnum current line number in buffer.
linecount number of lines in the buffer (only
valid when loaded)
loaded TRUE if the buffer is loaded. loaded TRUE if the buffer is loaded.
name full path to the file in the buffer. name full path to the file in the buffer.
signs list of signs placed in the buffer. signs list of signs placed in the buffer.
@@ -4479,8 +4570,7 @@ getftype({fname}) *getftype()*
systems that support it. On some systems only "dir" and systems that support it. On some systems only "dir" and
"file" are returned. "file" are returned.
*getjumplist()* getjumplist([{winnr} [, {tabnr}]]) *getjumplist()*
getjumplist([{winnr} [, {tabnr}]])
Returns the |jumplist| for the specified window. Returns the |jumplist| for the specified window.
Without arguments use the current window. Without arguments use the current window.
@@ -4505,7 +4595,7 @@ getline({lnum} [, {end}])
from the current buffer. Example: > from the current buffer. Example: >
getline(1) getline(1)
< When {lnum} is a String that doesn't start with a < When {lnum} is a String that doesn't start with a
digit, line() is called to translate the String into a Number. digit, |line()| is called to translate the String into a Number.
To get the line under the cursor: > To get the line under the cursor: >
getline(".") getline(".")
< When {lnum} is smaller than 1 or bigger than the number of < When {lnum} is smaller than 1 or bigger than the number of
@@ -4536,8 +4626,12 @@ getloclist({nr},[, {what}]) *getloclist()*
If the optional {what} dictionary argument is supplied, then If the optional {what} dictionary argument is supplied, then
returns the items listed in {what} as a dictionary. Refer to returns the items listed in {what} as a dictionary. Refer to
|getqflist()| for the supported items in {what}. |getqflist()| for the supported items in {what}.
If {what} contains 'filewinid', then returns the id of the
window used to display files from the location list. This
field is applicable only when called from a location list
window.
getmatches() *getmatches()* getmatches([{win}]) *getmatches()*
Returns a |List| with all matches previously defined for the Returns a |List| with all matches previously defined for the
current window by |matchadd()| and the |:match| commands. current window by |matchadd()| and the |:match| commands.
|getmatches()| is useful in combination with |setmatches()|, |getmatches()| is useful in combination with |setmatches()|,
@@ -4699,7 +4793,7 @@ getreg([{regname} [, 1 [, {list}]]]) *getreg()*
getregtype([{regname}]) *getregtype()* getregtype([{regname}]) *getregtype()*
The result is a String, which is type of register {regname}. The result is a String, which is type of register {regname}.
The value will be one of: The value will be one of:
"v" for |characterwise| text "v" for |charwise| text
"V" for |linewise| text "V" for |linewise| text
"<CTRL-V>{width}" for |blockwise-visual| text "<CTRL-V>{width}" for |blockwise-visual| text
"" for an empty or unknown register "" for an empty or unknown register
@@ -4941,9 +5035,11 @@ has({feature}) Returns 1 if {feature} is supported, 0 otherwise. The
< *feature-list* < *feature-list*
List of supported pseudo-feature names: List of supported pseudo-feature names:
acl |ACL| support acl |ACL| support
bsd BSD system (not macOS, use "mac" for that).
iconv Can use |iconv()| for conversion. iconv Can use |iconv()| for conversion.
+shellslash Can use backslashes in filenames (Windows) +shellslash Can use backslashes in filenames (Windows)
clipboard |clipboard| provider is available. clipboard |clipboard| provider is available.
mac MacOS system.
nvim This is Nvim. nvim This is Nvim.
python2 Legacy Vim |python2| interface. |has-python| python2 Legacy Vim |python2| interface. |has-python|
python3 Legacy Vim |python3| interface. |has-python| python3 Legacy Vim |python3| interface. |has-python|
@@ -4953,6 +5049,7 @@ has({feature}) Returns 1 if {feature} is supported, 0 otherwise. The
unix Unix system. unix Unix system.
*vim_starting* True during |startup|. *vim_starting* True during |startup|.
win32 Windows system (32 or 64 bit). win32 Windows system (32 or 64 bit).
win64 Windows system (64 bit).
wsl WSL (Windows Subsystem for Linux) system wsl WSL (Windows Subsystem for Linux) system
*has-patch* *has-patch*
@@ -5413,32 +5510,46 @@ jobstart({cmd}[, {opts}]) *jobstart()*
*jobstart-options* *jobstart-options*
{opts} is a dictionary with these keys: {opts} is a dictionary with these keys:
|on_stdout|: stdout event handler (function name or |Funcref|) clear_env: (boolean) `env` defines the job environment
stdout_buffered : read stdout in |channel-buffered| mode. exactly, instead of merging current environment.
|on_stderr|: stderr event handler (function name or |Funcref|) cwd: (string, default=|current-directory|) Working
stderr_buffered : read stderr in |channel-buffered| mode. directory of the job.
|on_exit| : exit event handler (function name or |Funcref|) detach: (boolean) Detach the job process: it will not be
cwd : Working directory of the job; defaults to killed when Nvim exits. If the process exits
|current-directory|. before Nvim, `on_exit` will be invoked.
rpc : If set, |msgpack-rpc| will be used to communicate env: (dict) Map of environment variable name:value
with the job over stdin and stdout. "on_stdout" is pairs extending (or replacing if |clear_env|)
then ignored, but "on_stderr" can still be used. the current environment.
pty : If set, the job will be connected to a new pseudo height: (number) Height of the `pty` terminal.
terminal and the job streams are connected to the |on_exit|: (function) Callback invoked when the job exits.
master file descriptor. "on_stderr" is ignored, |on_stdout|: (function) Callback invoked when the job emits
"on_stdout" receives all output. stdout data.
|on_stderr|: (function) Callback invoked when the job emits
width : (pty only) Width of the terminal screen stderr data.
height : (pty only) Height of the terminal screen overlapped: (boolean) Set FILE_FLAG_OVERLAPPED for the
TERM : (pty only) $TERM environment variable standard input/output passed to the child process.
detach : (non-pty only) Detach the job process: it will Normally you do not need to set this.
not be killed when Nvim exits. If the process (Only available on MS-Windows, On other
exits before Nvim, "on_exit" will be invoked. platforms, this option is silently ignored.)
pty: (boolean) Connect the job to a new pseudo
terminal, and its streams to the master file
descriptor. Then `on_stderr` is ignored,
`on_stdout` receives all output.
rpc: (boolean) Use |msgpack-rpc| to communicate with
the job over stdio. Then `on_stdout` is ignored,
but `on_stderr` can still be used.
stderr_buffered: (boolean) Collect data until EOF (stream closed)
before invoking `on_stderr`. |channel-buffered|
stdout_buffered: (boolean) Collect data until EOF (stream
closed) before invoking `on_stdout`. |channel-buffered|
TERM: (string) Sets the `pty` $TERM environment variable.
width: (number) Width of the `pty` terminal.
{opts} is passed as |self| dictionary to the callback; the {opts} is passed as |self| dictionary to the callback; the
caller may set other keys to pass application-specific data. caller may set other keys to pass application-specific data.
Returns: Returns:
- The channel ID on success - |channel-id| on success
- 0 on invalid arguments - 0 on invalid arguments
- -1 if {cmd}[0] is not executable. - -1 if {cmd}[0] is not executable.
See also |job-control|, |channel|, |msgpack-rpc|. See also |job-control|, |channel|, |msgpack-rpc|.
@@ -5450,6 +5561,9 @@ jobstop({id}) *jobstop()*
(if any) will be invoked. (if any) will be invoked.
See |job-control|. See |job-control|.
Returns 1 for valid job id, 0 for invalid id, including jobs have
exited or stopped.
jobwait({jobs}[, {timeout}]) *jobwait()* jobwait({jobs}[, {timeout}]) *jobwait()*
Waits for jobs and their |on_exit| handlers to complete. Waits for jobs and their |on_exit| handlers to complete.
@@ -5622,6 +5736,20 @@ lispindent({lnum}) *lispindent()*
When {lnum} is invalid or Vim was not compiled the When {lnum} is invalid or Vim was not compiled the
|+lispindent| feature, -1 is returned. |+lispindent| feature, -1 is returned.
list2str({list} [, {utf8}]) *list2str()*
Convert each number in {list} to a character string can
concatenate them all. Examples: >
list2str([32]) returns " "
list2str([65, 66, 67]) returns "ABC"
< The same can be done (slowly) with: >
join(map(list, {nr, val -> nr2char(val)}), '')
< |str2list()| does the opposite.
When {utf8} is omitted or zero, the current 'encoding' is used.
With {utf8} is 1, always return utf-8 characters.
With utf-8 composing characters work as expected: >
list2str([97, 769]) returns "á"
<
localtime() *localtime()* localtime() *localtime()*
Return the current time, measured as seconds since 1st Jan Return the current time, measured as seconds since 1st Jan
1970. See also |strftime()| and |getftime()|. 1970. See also |strftime()| and |getftime()|.
@@ -5732,6 +5860,7 @@ maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()*
"rhs" The {rhs} of the mapping as typed. "rhs" The {rhs} of the mapping as typed.
"silent" 1 for a |:map-silent| mapping, else 0. "silent" 1 for a |:map-silent| mapping, else 0.
"noremap" 1 if the {rhs} of the mapping is not remappable. "noremap" 1 if the {rhs} of the mapping is not remappable.
"script" 1 if mapping was defined with <script>.
"expr" 1 for an expression mapping (|:map-<expr>|). "expr" 1 for an expression mapping (|:map-<expr>|).
"buffer" 1 for a buffer local mapping (|:map-local|). "buffer" 1 for a buffer local mapping (|:map-local|).
"mode" Modes for which the mapping is defined. In "mode" Modes for which the mapping is defined. In
@@ -5849,7 +5978,7 @@ matchadd({group}, {pattern}[, {priority}[, {id} [, {dict}]]])
Defines a pattern to be highlighted in the current window (a Defines a pattern to be highlighted in the current window (a
"match"). It will be highlighted with {group}. Returns an "match"). It will be highlighted with {group}. Returns an
identification number (ID), which can be used to delete the identification number (ID), which can be used to delete the
match using |matchdelete()|. match using |matchdelete()|. The ID is bound to the window.
Matching is case sensitive and magic, unless case sensitivity Matching is case sensitive and magic, unless case sensitivity
or magicness are explicitly overridden in {pattern}. The or magicness are explicitly overridden in {pattern}. The
'magic', 'smartcase' and 'ignorecase' options are not used. 'magic', 'smartcase' and 'ignorecase' options are not used.
@@ -5949,11 +6078,13 @@ matcharg({nr}) *matcharg()*
Highlighting matches using the |:match| commands are limited Highlighting matches using the |:match| commands are limited
to three matches. |matchadd()| does not have this limitation. to three matches. |matchadd()| does not have this limitation.
matchdelete({id}) *matchdelete()* *E802* *E803* matchdelete({id} [, {win}) *matchdelete()* *E802* *E803*
Deletes a match with ID {id} previously defined by |matchadd()| Deletes a match with ID {id} previously defined by |matchadd()|
or one of the |:match| commands. Returns 0 if successful, or one of the |:match| commands. Returns 0 if successful,
otherwise -1. See example for |matchadd()|. All matches can otherwise -1. See example for |matchadd()|. All matches can
be deleted in one operation by |clearmatches()|. be deleted in one operation by |clearmatches()|.
If {win} is specified, use the window with this number or
window ID instead of the current window.
matchend({expr}, {pat} [, {start} [, {count}]]) *matchend()* matchend({expr}, {pat} [, {start} [, {count}]]) *matchend()*
Same as |match()|, but return the index of first character Same as |match()|, but return the index of first character
@@ -6103,7 +6234,7 @@ mode([expr]) Return a string that indicates the current mode.
n Normal n Normal
no Operator-pending no Operator-pending
nov Operator-pending (forced characterwise |o_v|) nov Operator-pending (forced charwise |o_v|)
noV Operator-pending (forced linewise |o_V|) noV Operator-pending (forced linewise |o_V|)
noCTRL-V Operator-pending (forced blockwise |o_CTRL-V|) noCTRL-V Operator-pending (forced blockwise |o_CTRL-V|)
niI Normal using |i_CTRL-O| in |Insert-mode| niI Normal using |i_CTRL-O| in |Insert-mode|
@@ -6486,6 +6617,63 @@ printf({fmt}, {expr1} ...) *printf()*
of "%" items. If there are not sufficient or too many of "%" items. If there are not sufficient or too many
arguments an error is given. Up to 18 arguments can be used. arguments an error is given. Up to 18 arguments can be used.
prompt_setcallback({buf}, {expr}) *prompt_setcallback()*
Set prompt callback for buffer {buf} to {expr}. When {expr}
is an empty string the callback is removed. This has only
effect if {buf} has 'buftype' set to "prompt".
The callback is invoked when pressing Enter. The current
buffer will always be the prompt buffer. A new line for a
prompt is added before invoking the callback, thus the prompt
for which the callback was invoked will be in the last but one
line.
If the callback wants to add text to the buffer, it must
insert it above the last line, since that is where the current
prompt is. This can also be done asynchronously.
The callback is invoked with one argument, which is the text
that was entered at the prompt. This can be an empty string
if the user only typed Enter.
Example: >
call prompt_setcallback(bufnr(''), function('s:TextEntered'))
func s:TextEntered(text)
if a:text == 'exit' || a:text == 'quit'
stopinsert
close
else
call append(line('$') - 1, 'Entered: "' . a:text . '"')
" Reset 'modified' to allow the buffer to be closed.
set nomodified
endif
endfunc
prompt_setinterrupt({buf}, {expr}) *prompt_setinterrupt()*
Set a callback for buffer {buf} to {expr}. When {expr} is an
empty string the callback is removed. This has only effect if
{buf} has 'buftype' set to "prompt".
This callback will be invoked when pressing CTRL-C in Insert
mode. Without setting a callback Vim will exit Insert mode,
as in any buffer.
prompt_setprompt({buf}, {text}) *prompt_setprompt()*
Set prompt for buffer {buf} to {text}. You most likely want
{text} to end in a space.
The result is only visible if {buf} has 'buftype' set to
"prompt". Example: >
call prompt_setprompt(bufnr(''), 'command: ')
pum_getpos() *pum_getpos()*
If the popup menu (see |ins-completion-menu|) is not visible,
returns an empty |Dictionary|, otherwise, returns a
|Dictionary| with the following keys:
height nr of items visible
width screen cells
row top screen row (0 first row)
col leftmost screen column (0 first col)
size total nr of items
scrollbar |TRUE| if visible
The values are the same as in |v:event| during |CompleteChanged|.
pumvisible() *pumvisible()* pumvisible() *pumvisible()*
Returns non-zero when the popup menu is visible, zero Returns non-zero when the popup menu is visible, zero
@@ -6537,6 +6725,33 @@ range({expr} [, {max} [, {stride}]]) *range()*
range(2, -2, -1) " [2, 1, 0, -1, -2] range(2, -2, -1) " [2, 1, 0, -1, -2]
range(0) " [] range(0) " []
range(2, 0) " error! range(2, 0) " error!
<
*readdir()*
readdir({directory} [, {expr}])
Return a list with file and directory names in {directory}.
When {expr} is omitted all entries are included.
When {expr} is given, it is evaluated to check what to do:
If {expr} results in -1 then no further entries will
be handled.
If {expr} results in 0 then this entry will not be
added to the list.
If {expr} results in 1 then this entry will be added
to the list.
Each time {expr} is evaluated |v:val| is set to the entry name.
When {expr} is a function the name is passed as the argument.
For example, to get a list of files ending in ".txt": >
readdir(dirname, {n -> n =~ '.txt$'})
< To skip hidden and backup files: >
readdir(dirname, {n -> n !~ '^\.\|\~$'})
< If you want to get a directory tree: >
function! s:tree(dir)
return {a:dir : map(readdir(a:dir),
\ {_, x -> isdirectory(x) ?
\ {x : s:tree(a:dir . '/' . x)} : x})}
endfunction
echo s:tree(".")
< <
*readfile()* *readfile()*
readfile({fname} [, {binary} [, {max}]]) readfile({fname} [, {binary} [, {max}]])
@@ -6569,17 +6784,6 @@ readfile({fname} [, {binary} [, {max}]])
the result is an empty list. the result is an empty list.
Also see |writefile()|. Also see |writefile()|.
*readdir()*
readdir({directory} [, {expr}])
Return a list with file and directory names in {directory}.
You can also use |glob()| if you don't need to do complicated
things, such as limiting the number of matches.
When {expr} is omitted all entries are included.
When {expr} is given, it is evaluated to check what to do:
If {expr} results in -1 then no further entries will
be handled.
reg_executing() *reg_executing()* reg_executing() *reg_executing()*
Returns the single letter name of the register being executed. Returns the single letter name of the register being executed.
Returns an empty string when no register is being executed. Returns an empty string when no register is being executed.
@@ -6640,7 +6844,7 @@ remote_expr({server}, {string} [, {idvar} [, {timeout}]])
between (not at the end), like with join(expr, "\n"). between (not at the end), like with join(expr, "\n").
If {idvar} is present and not empty, it is taken as the name If {idvar} is present and not empty, it is taken as the name
of a variable and a {serverid} for later use with of a variable and a {serverid} for later use with
remote_read() is stored there. |remote_read()| is stored there.
If {timeout} is given the read times out after this many If {timeout} is given the read times out after this many
seconds. Otherwise a timeout of 600 seconds is used. seconds. Otherwise a timeout of 600 seconds is used.
See also |clientserver| |RemoteReply|. See also |clientserver| |RemoteReply|.
@@ -7253,11 +7457,13 @@ setloclist({nr}, {list}[, {action}[, {what}]]) *setloclist()*
only the items listed in {what} are set. Refer to |setqflist()| only the items listed in {what} are set. Refer to |setqflist()|
for the list of supported keys in {what}. for the list of supported keys in {what}.
setmatches({list}) *setmatches()* setmatches({list} [, {win}]) *setmatches()*
Restores a list of matches saved by |getmatches() for the Restores a list of matches saved by |getmatches() for the
current window|. Returns 0 if successful, otherwise -1. All current window|. Returns 0 if successful, otherwise -1. All
current matches are cleared before the list is restored. See current matches are cleared before the list is restored. See
example for |getmatches()|. example for |getmatches()|.
If {win} is specified, use the window with this number or
window ID instead of the current window.
*setpos()* *setpos()*
setpos({expr}, {list}) setpos({expr}, {list})
@@ -7413,7 +7619,7 @@ setreg({regname}, {value} [, {options}])
If {options} contains "a" or {regname} is upper case, If {options} contains "a" or {regname} is upper case,
then the value is appended. then the value is appended.
{options} can also contain a register type specification: {options} can also contain a register type specification:
"c" or "v" |characterwise| mode "c" or "v" |charwise| mode
"l" or "V" |linewise| mode "l" or "V" |linewise| mode
"b" or "<CTRL-V>" |blockwise-visual| mode "b" or "<CTRL-V>" |blockwise-visual| mode
If a number immediately follows "b" or "<CTRL-V>" then this is If a number immediately follows "b" or "<CTRL-V>" then this is
@@ -7482,11 +7688,21 @@ settagstack({nr}, {dict} [, {action}]) *settagstack()*
{nr} can be the window number or the |window-ID|. {nr} can be the window number or the |window-ID|.
For a list of supported items in {dict}, refer to For a list of supported items in {dict}, refer to
|gettagstack()| |gettagstack()|. "curidx" takes effect before changing the tag
stack.
*E962* *E962*
If {action} is not present or is set to 'r', then the tag How the tag stack is modified depends on the {action}
stack is replaced. If {action} is set to 'a', then new entries argument:
from {dict} are pushed onto the tag stack. - If {action} is not present or is set to 'r', then the tag
stack is replaced.
- If {action} is set to 'a', then new entries from {dict} are
pushed (added) onto the tag stack.
- If {action} is set to 't', then all the entries from the
current entry in the tag stack or "curidx" in {dict} are
removed and then new entries are pushed to the stack.
The current index is set to one after the length of the tag
stack after the modification.
Returns zero for success, -1 for failure. Returns zero for success, -1 for failure.
@@ -7660,7 +7876,7 @@ sign_getplaced([{expr} [, {dict}]]) *sign_getplaced()*
priority sign priority priority sign priority
The returned signs in a buffer are ordered by their line The returned signs in a buffer are ordered by their line
number. number and priority.
Returns an empty list on failure or if there are no placed Returns an empty list on failure or if there are no placed
signs. signs.
@@ -8065,6 +8281,18 @@ str2float({expr}) *str2float()*
|substitute()|: > |substitute()|: >
let f = str2float(substitute(text, ',', '', 'g')) let f = str2float(substitute(text, ',', '', 'g'))
str2list({expr} [, {utf8}]) *str2list()*
Return a list containing the number values which represent
each character in String {expr}. Examples: >
str2list(" ") returns [32]
str2list("ABC") returns [65, 66, 67]
< |list2str()| does the opposite.
When {utf8} is omitted or zero, the current 'encoding' is used.
With {utf8} set to 1, always treat the String as utf-8
characters. With utf-8 composing characters are handled
properly: >
str2list("á") returns [97, 769]
str2nr({expr} [, {base}]) *str2nr()* str2nr({expr} [, {base}]) *str2nr()*
Convert string {expr} to a number. Convert string {expr} to a number.
@@ -8535,8 +8763,12 @@ tabpagebuflist([{arg}]) *tabpagebuflist()*
tabpagenr([{arg}]) *tabpagenr()* tabpagenr([{arg}]) *tabpagenr()*
The result is a Number, which is the number of the current The result is a Number, which is the number of the current
tab page. The first tab page has number 1. tab page. The first tab page has number 1.
When the optional argument is "$", the number of the last tab The optional argument {arg} supports the following values:
page is returned (the tab page count). $ the number of the last tab page (the tab page
count).
# the number of the last accessed tab page (where
|g<Tab>| goes to). If there is no previous
tab page, 0 is returned.
The number can be used with the |:tab| command. The number can be used with the |:tab| command.
@@ -9155,7 +9387,7 @@ wordcount() *wordcount()*
(only in Visual mode) (only in Visual mode)
visual_chars Number of chars visually selected visual_chars Number of chars visually selected
(only in Visual mode) (only in Visual mode)
visual_words Number of chars visually selected visual_words Number of words visually selected
(only in Visual mode) (only in Visual mode)
@@ -9222,7 +9454,7 @@ Don't forget that "^" will only match at the first character of the String and
"\n". "\n".
============================================================================== ==============================================================================
5. Defining functions *user-functions* 5. Defining functions *user-function*
New functions can be defined. These can be called just like builtin New functions can be defined. These can be called just like builtin
functions. The function executes a sequence of Ex commands. Normal mode functions. The function executes a sequence of Ex commands. Normal mode
@@ -9680,7 +9912,7 @@ This does NOT work: >
register, "@/" for the search pattern. register, "@/" for the search pattern.
If the result of {expr1} ends in a <CR> or <NL>, the If the result of {expr1} ends in a <CR> or <NL>, the
register will be linewise, otherwise it will be set to register will be linewise, otherwise it will be set to
characterwise. charwise.
This can be used to clear the last search pattern: > This can be used to clear the last search pattern: >
:let @/ = "" :let @/ = ""
< This is different from searching for an empty string, < This is different from searching for an empty string,
@@ -9762,6 +9994,54 @@ This does NOT work: >
Like above, but append/add/subtract the value for each Like above, but append/add/subtract the value for each
|List| item. |List| item.
*:let=<<* *:let-heredoc*
*E990* *E991* *E172* *E221*
:let {var-name} =<< [trim] {marker}
text...
text...
{marker}
Set internal variable {var-name} to a List containing
the lines of text bounded by the string {marker}.
{marker} cannot start with a lower case character.
The last line should end only with the {marker} string
without any other character. Watch out for white
space after {marker}!
Without "trim" any white space characters in the lines
of text are preserved. If "trim" is specified before
{marker}, then indentation is stripped so you can do: >
let text =<< trim END
if ok
echo 'done'
endif
END
< Results in: ["if ok", " echo 'done'", "endif"]
The marker must line up with "let" and the indentation
of the first line is removed from all the text lines.
Specifically: all the leading indentation exactly
matching the leading indentation of the first
non-empty text line is stripped from the input lines.
All leading indentation exactly matching the leading
indentation before `let` is stripped from the line
containing {marker}. Note that the difference between
space and tab matters here.
If {var-name} didn't exist yet, it is created.
Cannot be followed by another command, but can be
followed by a comment.
Examples: >
let var1 =<< END
Sample text 1
Sample text 2
Sample text 3
END
let data =<< trim DATA
1 2 3 4
5 6 7 8
DATA
<
*E121* *E121*
:let {var-name} .. List the value of variable {var-name}. Multiple :let {var-name} .. List the value of variable {var-name}. Multiple
variable names may be given. Special names recognized variable names may be given. Special names recognized
@@ -10157,8 +10437,8 @@ This does NOT work: >
The parsing works slightly different from |:echo|, The parsing works slightly different from |:echo|,
more like |:execute|. All the expressions are first more like |:execute|. All the expressions are first
evaluated and concatenated before echoing anything. evaluated and concatenated before echoing anything.
The expressions must evaluate to a Number or String, a If expressions does not evaluate to a Number or
Dictionary or List causes an error. String, string() is used to turn it into a string.
Uses the highlighting set by the |:echohl| command. Uses the highlighting set by the |:echohl| command.
Example: > Example: >
:echomsg "It's a Zizzer Zazzer Zuzz, as you can plainly see." :echomsg "It's a Zizzer Zazzer Zuzz, as you can plainly see."
@@ -10169,7 +10449,7 @@ This does NOT work: >
message in the |message-history|. When used in a message in the |message-history|. When used in a
script or function the line number will be added. script or function the line number will be added.
Spaces are placed between the arguments as with the Spaces are placed between the arguments as with the
:echo command. When used inside a try conditional, |:echomsg| command. When used inside a try conditional,
the message is raised as an error exception instead the message is raised as an error exception instead
(see |try-echoerr|). (see |try-echoerr|).
Example: > Example: >

View File

@@ -275,7 +275,7 @@ Note that the last one is the value of $VIMRUNTIME which has been expanded.
Note that when using a plugin manager or |packages| many directories will be Note that when using a plugin manager or |packages| many directories will be
added to 'runtimepath'. These plugins each require their own directory, don't added to 'runtimepath'. These plugins each require their own directory, don't
put them directly in ~/.vim/plugin. put them directly in ~/.config/nvim/plugin.
What if it looks like your plugin is not being loaded? You can find out what What if it looks like your plugin is not being loaded? You can find out what
happens when Vim starts up by using the |-V| argument: > happens when Vim starts up by using the |-V| argument: >
@@ -549,7 +549,9 @@ Variables:
*b:man_default_sects* Comma-separated, ordered list of preferred sections. *b:man_default_sects* Comma-separated, ordered list of preferred sections.
For example in C one usually wants section 3 or 2: > For example in C one usually wants section 3 or 2: >
:let b:man_default_sections = '3,2' :let b:man_default_sections = '3,2'
*g:man_hardwrap* Hard-wrap to $MANWIDTH. May improve layout. *g:man_hardwrap* Hard-wrap to $MANWIDTH or window width if $MANWIDTH is
empty. Enabled by default. Set |FALSE| to enable soft
wrapping.
To use Nvim as a manpager: > To use Nvim as a manpager: >
export MANPAGER='nvim +Man!' export MANPAGER='nvim +Man!'
@@ -558,10 +560,13 @@ Note that when running `man` from the shell and with that `MANPAGER` in your
environment, `man` will pre-format the manpage using `groff`. Thus, Neovim environment, `man` will pre-format the manpage using `groff`. Thus, Neovim
will inevitably display the manual page as it was passed to it from stdin. One will inevitably display the manual page as it was passed to it from stdin. One
of the caveats of this is that the width will _always_ be hard-wrapped and not of the caveats of this is that the width will _always_ be hard-wrapped and not
soft wrapped as with `:Man`. You can set in your environment: > soft wrapped as with `g:man_hardwrap=0`. You can set in your environment: >
export MANWIDTH=999 export MANWIDTH=999
So `groff`'s pre-formatting output will be the same as with `:Man` i.e soft-wrapped. So `groff`'s pre-formatting output will be the same as with `g:man_hardwrap=0` i.e soft-wrapped.
To disable bold highlighting: >
:highlight link manBold Normal
PDF *ft-pdf-plugin* PDF *ft-pdf-plugin*

View File

@@ -527,8 +527,7 @@ FOLDCOLUMN *fold-foldcolumn*
'foldcolumn' is a number, which sets the width for a column on the side of the 'foldcolumn' is a number, which sets the width for a column on the side of the
window to indicate folds. When it is zero, there is no foldcolumn. A normal window to indicate folds. When it is zero, there is no foldcolumn. A normal
value is 4 or 5. The minimal useful value is 2, although 1 still provides value is auto:9. The maximum is 9.
some information. The maximum is 12.
An open fold is indicated with a column that has a '-' at the top and '|' An open fold is indicated with a column that has a '-' at the top and '|'
characters below it. This column stops where the open fold stops. When folds characters below it. This column stops where the open fold stops. When folds

View File

@@ -129,6 +129,7 @@ Advanced editing ~
|autocmd.txt| automatically executing commands on an event |autocmd.txt| automatically executing commands on an event
|eval.txt| expression evaluation, conditional commands |eval.txt| expression evaluation, conditional commands
|fold.txt| hide (fold) ranges of lines |fold.txt| hide (fold) ranges of lines
|lua.txt| Lua API
Special issues ~ Special issues ~
|print.txt| printing |print.txt| printing
@@ -136,6 +137,7 @@ Special issues ~
Programming language support ~ Programming language support ~
|indent.txt| automatic indenting for C and other languages |indent.txt| automatic indenting for C and other languages
|lsp.txt| Language Server Protocol (LSP)
|syntax.txt| syntax highlighting |syntax.txt| syntax highlighting
|filetype.txt| settings done specifically for a type of file |filetype.txt| settings done specifically for a type of file
|quickfix.txt| commands for a quick edit-compile-fix cycle |quickfix.txt| commands for a quick edit-compile-fix cycle
@@ -157,7 +159,6 @@ GUI ~
Interfaces ~ Interfaces ~
|if_cscop.txt| using Cscope with Vim |if_cscop.txt| using Cscope with Vim
|if_lua.txt| Lua interface
|if_pyth.txt| Python interface |if_pyth.txt| Python interface
|if_ruby.txt| Ruby interface |if_ruby.txt| Ruby interface
|sign.txt| debugging signs |sign.txt| debugging signs
@@ -169,7 +170,7 @@ Versions ~
Standard plugins ~ Standard plugins ~
|pi_gzip.txt| Reading and writing compressed files |pi_gzip.txt| Reading and writing compressed files
|pi_health.txt| Healthcheck framework |pi_health.txt| Healthcheck framework
|pi_matchit.txt| Extended "%" matching |pi_matchit.txt| Extended |%| matching
|pi_msgpack.txt| msgpack utilities |pi_msgpack.txt| msgpack utilities
|pi_netrw.txt| Reading and writing files over a network |pi_netrw.txt| Reading and writing files over a network
|pi_paren.txt| Highlight matching parens |pi_paren.txt| Highlight matching parens

View File

@@ -1,668 +1,8 @@
*if_lua.txt* Nvim
NVIM REFERENCE MANUAL NVIM REFERENCE MANUAL
Moved to |lua.txt|
Lua engine *lua* *Lua*
Type |gO| to see the table of contents.
============================================================================== ==============================================================================
Introduction *lua-intro* vim:tw=78:ts=8:noet:ft=help:norl:
The Lua 5.1 language is builtin and always available. Try this command to get
an idea of what lurks beneath: >
:lua print(vim.inspect(package.loaded))
Nvim includes a "standard library" |lua-stdlib| for Lua. It complements the
"editor stdlib" (|functions| and Ex commands) and the |API|, all of which can
be used from Lua code.
Module conflicts are resolved by "last wins". For example if both of these
are on 'runtimepath':
runtime/lua/foo.lua
~/.config/nvim/lua/foo.lua
then `require('foo')` loads "~/.config/nvim/lua/foo.lua", and
"runtime/lua/foo.lua" is not used. See |lua-require| to understand how Nvim
finds and loads Lua modules. The conventions are similar to VimL plugins,
with some extra features. See |lua-require-example| for a walkthrough.
==============================================================================
Importing Lua modules *lua-require*
Nvim automatically adjusts `package.path` and `package.cpath` according to
effective 'runtimepath' value. Adjustment happens whenever 'runtimepath' is
changed. `package.path` is adjusted by simply appending `/lua/?.lua` and
`/lua/?/init.lua` to each directory from 'runtimepath' (`/` is actually the
first character of `package.config`).
Similarly to `package.path`, modified directories from 'runtimepath' are also
added to `package.cpath`. In this case, instead of appending `/lua/?.lua` and
`/lua/?/init.lua` to each runtimepath, all unique `?`-containing suffixes of
the existing `package.cpath` are used. Example:
1. Given that
- 'runtimepath' contains `/foo/bar,/xxx;yyy/baz,/abc`;
- initial (defined at compile-time or derived from
`$LUA_CPATH`/`$LUA_INIT`) `package.cpath` contains
`./?.so;/def/ghi/a?d/j/g.elf;/def/?.so`.
2. It finds `?`-containing suffixes `/?.so`, `/a?d/j/g.elf` and `/?.so`, in
order: parts of the path starting from the first path component containing
question mark and preceding path separator.
3. The suffix of `/def/?.so`, namely `/?.so` is not unique, as its the same
as the suffix of the first path from `package.path` (i.e. `./?.so`). Which
leaves `/?.so` and `/a?d/j/g.elf`, in this order.
4. 'runtimepath' has three paths: `/foo/bar`, `/xxx;yyy/baz` and `/abc`. The
second one contains semicolon which is a paths separator so it is out,
leaving only `/foo/bar` and `/abc`, in order.
5. The cartesian product of paths from 4. and suffixes from 3. is taken,
giving four variants. In each variant `/lua` path segment is inserted
between path and suffix, leaving
- `/foo/bar/lua/?.so`
- `/foo/bar/lua/a?d/j/g.elf`
- `/abc/lua/?.so`
- `/abc/lua/a?d/j/g.elf`
6. New paths are prepended to the original `package.cpath`.
The result will look like this:
`/foo/bar,/xxx;yyy/baz,/abc` ('runtimepath')
× `./?.so;/def/ghi/a?d/j/g.elf;/def/?.so` (`package.cpath`)
= `/foo/bar/lua/?.so;/foo/bar/lua/a?d/j/g.elf;/abc/lua/?.so;/abc/lua/a?d/j/g.elf;./?.so;/def/ghi/a?d/j/g.elf;/def/?.so`
Note:
- To track 'runtimepath' updates, paths added at previous update are
remembered and removed at the next update, while all paths derived from the
new 'runtimepath' are prepended as described above. This allows removing
paths when path is removed from 'runtimepath', adding paths when they are
added and reordering `package.path`/`package.cpath` content if 'runtimepath'
was reordered.
- Although adjustments happen automatically, Nvim does not track current
values of `package.path` or `package.cpath`. If you happen to delete some
paths from there you can set 'runtimepath' to trigger an update: >
let &runtimepath = &runtimepath
- Skipping paths from 'runtimepath' which contain semicolons applies both to
`package.path` and `package.cpath`. Given that there are some badly written
plugins using shell which will not work with paths containing semicolons it
is better to not have them in 'runtimepath' at all.
------------------------------------------------------------------------------
LUA PLUGIN EXAMPLE *lua-require-example*
The following example plugin adds a command `:MakeCharBlob` which transforms
current buffer into a long `unsigned char` array. Lua contains transformation
function in a module `lua/charblob.lua` which is imported in
`autoload/charblob.vim` (`require("charblob")`). Example plugin is supposed
to be put into any directory from 'runtimepath', e.g. `~/.config/nvim` (in
this case `lua/charblob.lua` means `~/.config/nvim/lua/charblob.lua`).
autoload/charblob.vim: >
function charblob#encode_buffer()
call setline(1, luaeval(
\ 'require("charblob").encode(unpack(_A))',
\ [getline(1, '$'), &textwidth, ' ']))
endfunction
plugin/charblob.vim: >
if exists('g:charblob_loaded')
finish
endif
let g:charblob_loaded = 1
command MakeCharBlob :call charblob#encode_buffer()
lua/charblob.lua: >
local function charblob_bytes_iter(lines)
local init_s = {
next_line_idx = 1,
next_byte_idx = 1,
lines = lines,
}
local function next(s, _)
if lines[s.next_line_idx] == nil then
return nil
end
if s.next_byte_idx > #(lines[s.next_line_idx]) then
s.next_line_idx = s.next_line_idx + 1
s.next_byte_idx = 1
return ('\n'):byte()
end
local ret = lines[s.next_line_idx]:byte(s.next_byte_idx)
if ret == ('\n'):byte() then
ret = 0 -- See :h NL-used-for-NUL.
end
s.next_byte_idx = s.next_byte_idx + 1
return ret
end
return next, init_s, nil
end
local function charblob_encode(lines, textwidth, indent)
local ret = {
'const unsigned char blob[] = {',
indent,
}
for byte in charblob_bytes_iter(lines) do
-- .- space + number (width 3) + comma
if #(ret[#ret]) + 5 > textwidth then
ret[#ret + 1] = indent
else
ret[#ret] = ret[#ret] .. ' '
end
ret[#ret] = ret[#ret] .. (('%3u,'):format(byte))
end
ret[#ret + 1] = '};'
return ret
end
return {
bytes_iter = charblob_bytes_iter,
encode = charblob_encode,
}
==============================================================================
Commands *lua-commands*
*:lua*
:[range]lua {chunk}
Execute Lua chunk {chunk}.
Examples:
>
:lua vim.api.nvim_command('echo "Hello, Nvim!"')
<
To see the Lua version: >
:lua print(_VERSION)
To see the LuaJIT version: >
:lua print(jit.version)
<
:[range]lua << [endmarker]
{script}
{endmarker}
Execute Lua script {script}. Useful for including Lua
code in Vim scripts.
The {endmarker} must NOT be preceded by any white space.
If [endmarker] is omitted from after the "<<", a dot '.' must be used after
{script}, like for the |:append| and |:insert| commands.
Example:
>
function! CurrentLineInfo()
lua << EOF
local linenr = vim.api.nvim_win_get_cursor(0)[1]
local curline = vim.api.nvim_buf_get_lines(
0, linenr, linenr + 1, false)[1]
print(string.format("Current line [%d] has %d bytes",
linenr, #curline))
EOF
endfunction
Note that the `local` variables will disappear when block finishes. This is
not the case for globals.
*:luado*
:[range]luado {body} Execute Lua function "function (line, linenr) {body}
end" for each line in the [range], with the function
argument being set to the text of each line in turn,
without a trailing <EOL>, and the current line number.
If the value returned by the function is a string it
becomes the text of the line in the current turn. The
default for [range] is the whole file: "1,$".
Examples:
>
:luado return string.format("%s\t%d", line:reverse(), #line)
:lua require"lpeg"
:lua -- balanced parenthesis grammar:
:lua bp = lpeg.P{ "(" * ((1 - lpeg.S"()") + lpeg.V(1))^0 * ")" }
:luado if bp:match(line) then return "-->\t" .. line end
<
*:luafile*
:[range]luafile {file}
Execute Lua script in {file}.
The whole argument is used as a single file name.
Examples:
>
:luafile script.lua
:luafile %
<
All these commands execute a Lua chunk from either the command line (:lua and
:luado) or a file (:luafile) with the given line [range]. Similarly to the Lua
interpreter, each chunk has its own scope and so only global variables are
shared between command calls. All Lua default libraries are available. In
addition, Lua "print" function has its output redirected to the Nvim message
area, with arguments separated by a white space instead of a tab.
Lua uses the "vim" module (see |lua-vim|) to issue commands to Nvim. However,
procedures that alter buffer content, open new buffers, and change cursor
position are restricted when the command is executed in the |sandbox|.
==============================================================================
luaeval() *lua-eval* *luaeval()*
The (dual) equivalent of "vim.eval" for passing Lua values to Nvim is
"luaeval". "luaeval" takes an expression string and an optional argument used
for _A inside expression and returns the result of the expression. It is
semantically equivalent in Lua to:
>
local chunkheader = "local _A = select(1, ...) return "
function luaeval (expstr, arg)
local chunk = assert(loadstring(chunkheader .. expstr, "luaeval"))
return chunk(arg) -- return typval
end
Lua nils, numbers, strings, tables and booleans are converted to their
respective VimL types. An error is thrown if conversion of any other Lua types
is attempted.
The magic global "_A" contains the second argument to luaeval().
Example: >
:echo luaeval('_A[1] + _A[2]', [40, 2])
42
:echo luaeval('string.match(_A, "[a-z]+")', 'XYXfoo123')
foo
Lua tables are used as both dictionaries and lists, so it is impossible to
determine whether empty table is meant to be empty list or empty dictionary.
Additionally lua does not have integer numbers. To distinguish between these
cases there is the following agreement:
0. Empty table is empty list.
1. Table with N incrementally growing integral numbers, starting from 1 and
ending with N is considered to be a list.
2. Table with string keys, none of which contains NUL byte, is considered to
be a dictionary.
3. Table with string keys, at least one of which contains NUL byte, is also
considered to be a dictionary, but this time it is converted to
a |msgpack-special-map|.
*lua-special-tbl*
4. Table with `vim.type_idx` key may be a dictionary, a list or floating-point
value:
- `{[vim.type_idx]=vim.types.float, [vim.val_idx]=1}` is converted to
a floating-point 1.0. Note that by default integral lua numbers are
converted to |Number|s, non-integral are converted to |Float|s. This
variant allows integral |Float|s.
- `{[vim.type_idx]=vim.types.dictionary}` is converted to an empty
dictionary, `{[vim.type_idx]=vim.types.dictionary, [42]=1, a=2}` is
converted to a dictionary `{'a': 42}`: non-string keys are ignored.
Without `vim.type_idx` key tables with keys not fitting in 1., 2. or 3.
are errors.
- `{[vim.type_idx]=vim.types.list}` is converted to an empty list. As well
as `{[vim.type_idx]=vim.types.list, [42]=1}`: integral keys that do not
form a 1-step sequence from 1 to N are ignored, as well as all
non-integral keys.
Examples: >
:echo luaeval('math.pi')
:function Rand(x,y) " random uniform between x and y
: return luaeval('(_A.y-_A.x)*math.random()+_A.x', {'x':a:x,'y':a:y})
: endfunction
:echo Rand(1,10)
Note that currently second argument to `luaeval` undergoes VimL to lua
conversion, so changing containers in lua do not affect values in VimL. Return
value is also always converted. When converting, |msgpack-special-dict|s are
treated specially.
==============================================================================
Lua standard modules *lua-stdlib*
The Nvim Lua "standard library" (stdlib) is the `vim` module, which exposes
various functions and sub-modules. It is always loaded, thus require("vim")
is unnecessary.
You can peek at the module properties: >
:lua print(vim.inspect(vim))
Result is something like this: >
{
_os_proc_children = <function 1>,
_os_proc_info = <function 2>,
...
api = {
nvim__id = <function 5>,
nvim__id_array = <function 6>,
...
},
deepcopy = <function 106>,
gsplit = <function 107>,
...
}
To find documentation on e.g. the "deepcopy" function: >
:help vim.deepcopy
Note that underscore-prefixed functions (e.g. "_os_proc_children") are
internal/private and must not be used by plugins.
------------------------------------------------------------------------------
VIM.API *lua-api*
`vim.api` exposes the full Nvim |API| as a table of Lua functions.
Example: to use the "nvim_get_current_line()" API function, call
"vim.api.nvim_get_current_line()": >
print(tostring(vim.api.nvim_get_current_line()))
------------------------------------------------------------------------------
VIM.LOOP *lua-loop*
`vim.loop` exposes all features of the Nvim event-loop. This is a low-level
API that provides functionality for networking, filesystem, and process
management. Try this command to see available functions: >
:lua print(vim.inspect(vim.loop))
Reference: http://docs.libuv.org
Examples: https://github.com/luvit/luv/tree/master/examples
*E5560* *lua-loop-callbacks*
It is an error to directly invoke `vim.api` functions (except |api-fast|) in
`vim.loop` callbacks. For example, this is an error: >
local timer = vim.loop.new_timer()
timer:start(1000, 0, function()
vim.api.nvim_command('echomsg "test"')
end)
To avoid the error use |vim.schedule_wrap()| to defer the callback: >
local timer = vim.loop.new_timer()
timer:start(1000, 0, vim.schedule_wrap(function()
vim.api.nvim_command('echomsg "test"')
end))
Example: repeating timer
1. Save this code to a file.
2. Execute it with ":luafile %". >
-- Create a timer handle (implementation detail: uv_timer_t).
local timer = vim.loop.new_timer()
local i = 0
-- Waits 1000ms, then repeats every 750ms until timer:close().
timer:start(1000, 750, function()
print('timer invoked! i='..tostring(i))
if i > 4 then
timer:close() -- Always close handles to avoid leaks.
end
i = i + 1
end)
print('sleeping');
Example: TCP echo-server *tcp-server*
1. Save this code to a file.
2. Execute it with ":luafile %".
3. Note the port number.
4. Connect from any TCP client (e.g. "nc 0.0.0.0 36795"): >
local function create_server(host, port, on_connection)
local server = vim.loop.new_tcp()
server:bind(host, port)
server:listen(128, function(err)
assert(not err, err) -- Check for errors.
local sock = vim.loop.new_tcp()
server:accept(sock) -- Accept client connection.
on_connection(sock) -- Start reading messages.
end)
return server
end
local server = create_server('0.0.0.0', 0, function(sock)
sock:read_start(function(err, chunk)
assert(not err, err) -- Check for errors.
if chunk then
sock:write(chunk) -- Echo received messages to the channel.
else -- EOF (stream closed).
sock:close() -- Always close handles to avoid leaks.
end
end)
end)
print('TCP echo-server listening on port: '..server:getsockname().port)
------------------------------------------------------------------------------
VIM *lua-util*
vim.in_fast_event() *vim.in_fast_event()*
Returns true if the code is executing as part of a "fast" event
handler, where most of the API is disabled. These are low-level events
(e.g. |lua-loop-callbacks|) which can be invoked whenever Nvim polls
for input. When this is `false` most API functions are callable (but
may be subject to other restrictions such as |textlock|).
vim.stricmp({a}, {b}) *vim.stricmp()*
Compares strings case-insensitively. Returns 0, 1 or -1 if strings
are equal, {a} is greater than {b} or {a} is lesser than {b},
respectively.
vim.str_utfindex({str}[, {index}]) *vim.str_utfindex()*
Convert byte index to UTF-32 and UTF-16 indicies. If {index} is not
supplied, the length of the string is used. All indicies are zero-based.
Returns two values: the UTF-32 and UTF-16 indicies respectively.
Embedded NUL bytes are treated as terminating the string. Invalid
UTF-8 bytes, and embedded surrogates are counted as one code
point each. An {index} in the middle of a UTF-8 sequence is rounded
upwards to the end of that sequence.
vim.str_byteindex({str}, {index}[, {use_utf16}]) *vim.str_byteindex()*
Convert UTF-32 or UTF-16 {index} to byte index. If {use_utf16} is not
supplied, it defaults to false (use UTF-32). Returns the byte index.
Invalid UTF-8 and NUL is treated like by |vim.str_byteindex()|. An {index}
in the middle of a UTF-16 sequence is rounded upwards to the end of that
sequence.
vim.schedule({callback}) *vim.schedule()*
Schedules {callback} to be invoked soon by the main event-loop. Useful
to avoid |textlock| or other temporary restrictions.
vim.type_idx *vim.type_idx*
Type index for use in |lua-special-tbl|. Specifying one of the
values from |vim.types| allows typing the empty table (it is
unclear whether empty lua table represents empty list or empty array)
and forcing integral numbers to be |Float|. See |lua-special-tbl| for
more details.
vim.val_idx *vim.val_idx*
Value index for tables representing |Float|s. A table representing
floating-point value 1.0 looks like this: >
{
[vim.type_idx] = vim.types.float,
[vim.val_idx] = 1.0,
}
< See also |vim.type_idx| and |lua-special-tbl|.
vim.types *vim.types*
Table with possible values for |vim.type_idx|. Contains two sets
of key-value pairs: first maps possible values for |vim.type_idx|
to human-readable strings, second maps human-readable type names to
values for |vim.type_idx|. Currently contains pairs for `float`,
`array` and `dictionary` types.
Note: one must expect that values corresponding to `vim.types.float`,
`vim.types.array` and `vim.types.dictionary` fall under only two
following assumptions:
1. Value may serve both as a key and as a value in a table. Given the
properties of lua tables this basically means “value is not `nil`”.
2. For each value in `vim.types` table `vim.types[vim.types[value]]`
is the same as `value`.
No other restrictions are put on types, and it is not guaranteed that
values corresponding to `vim.types.float`, `vim.types.array` and
`vim.types.dictionary` will not change or that `vim.types` table will
only contain values for these three types.
==============================================================================
Lua module: vim *lua-vim*
inspect({object}, {options}) *vim.inspect()*
Return a human-readable representation of the given object.
See also: ~
https://github.com/kikito/inspect.lua
https://github.com/mpeterv/vinspect
paste({lines}, {phase}) *vim.paste()*
Paste handler, invoked by |nvim_paste()| when a conforming UI
(such as the |TUI|) pastes text into the editor.
Parameters: ~
{lines} |readfile()|-style list of lines to paste.
|channel-lines|
{phase} -1: "non-streaming" paste: the call contains all
lines. If paste is "streamed", `phase` indicates the stream state:
• 1: starts the paste (exactly once)
• 2: continues the paste (zero or more times)
• 3: ends the paste (exactly once)
Return: ~
false if client should cancel the paste.
See also: ~
|paste|
schedule_wrap({cb}) *vim.schedule_wrap()*
Defers callback `cb` until the Nvim API is safe to call.
See also: ~
|lua-loop-callbacks|
|vim.schedule()|
|vim.in_fast_event()|
deepcopy({orig}) *vim.deepcopy()*
Returns a deep copy of the given object. Non-table objects are
copied as in a typical Lua assignment, whereas table objects
are copied recursively.
Parameters: ~
{orig} Table to copy
Return: ~
New table of copied keys and (nested) values.
gsplit({s}, {sep}, {plain}) *vim.gsplit()*
Splits a string at each instance of a separator.
Parameters: ~
{s} String to split
{sep} Separator string or pattern
{plain} If `true` use `sep` literally (passed to
String.find)
Return: ~
Iterator over the split components
See also: ~
|vim.split()|
https://www.lua.org/pil/20.2.html
http://lua-users.org/wiki/StringLibraryTutorial
split({s}, {sep}, {plain}) *vim.split()*
Splits a string at each instance of a separator.
Examples: >
split(":aa::b:", ":") --> {'','aa','','bb',''}
split("axaby", "ab?") --> {'','x','y'}
split(x*yz*o, "*", true) --> {'x','yz','o'}
<
Parameters: ~
{s} String to split
{sep} Separator string or pattern
{plain} If `true` use `sep` literally (passed to
String.find)
Return: ~
List-like table of the split components.
See also: ~
|vim.gsplit()|
tbl_contains({t}, {value}) *vim.tbl_contains()*
Checks if a list-like (vector) table contains `value` .
Parameters: ~
{t} Table to check
{value} Value to compare
Return: ~
true if `t` contains `value`
tbl_extend({behavior}, {...}) *vim.tbl_extend()*
Merges two or more map-like tables.
Parameters: ~
{behavior} Decides what to do if a key is found in more
than one map:
• "error": raise an error
• "keep": use value from the leftmost map
• "force": use value from the rightmost map
{...} Two or more map-like tables.
See also: ~
|extend()|
tbl_flatten({t}) *vim.tbl_flatten()*
Creates a copy of a list-like table such that any nested
tables are "unrolled" and appended to the result.
Parameters: ~
{t} List-like table
Return: ~
Flattened copy of the given list-like table.
trim({s}) *vim.trim()*
Trim whitespace (Lua pattern "%s") from both sides of a
string.
Parameters: ~
{s} String to trim
Return: ~
String with whitespace removed from its beginning and end
See also: ~
https://www.lua.org/pil/20.2.html
pesc({s}) *vim.pesc()*
Escapes magic chars in a Lua pattern string.
Parameters: ~
{s} String to escape
Return: ~
%-escaped pattern string
See also: ~
https://github.com/rxi/lume
vim:tw=78:ts=8:ft=help:norl:

View File

@@ -10,7 +10,7 @@ short description. The lists are sorted on ASCII value.
Tip: When looking for certain functionality, use a search command. E.g., Tip: When looking for certain functionality, use a search command. E.g.,
to look for deleting something, use: "/delete". to look for deleting something, use: "/delete".
For an overview of options see help.txt |option-list|. For an overview of options see |option-list|.
For an overview of built-in functions see |functions|. For an overview of built-in functions see |functions|.
For a list of Vim variables see |vim-variable|. For a list of Vim variables see |vim-variable|.
For a complete listing of all help items see |help-tags|. For a complete listing of all help items see |help-tags|.
@@ -222,6 +222,8 @@ tag char note action in Normal mode ~
|CTRL-]| CTRL-] :ta to ident under cursor |CTRL-]| CTRL-] :ta to ident under cursor
|CTRL-^| CTRL-^ edit Nth alternate file (equivalent to |CTRL-^| CTRL-^ edit Nth alternate file (equivalent to
":e #N") ":e #N")
|CTRL-<Tab>| CTRL-<Tab> same as `g<Tab>` : go to last accessed tab
page
CTRL-_ not used CTRL-_ not used
|<Space>| <Space> 1 same as "l" |<Space>| <Space> 1 same as "l"
@@ -404,7 +406,7 @@ tag char note action in Normal mode ~
|t| t{char} 1 cursor till before Nth occurrence of {char} |t| t{char} 1 cursor till before Nth occurrence of {char}
to the right to the right
|u| u 2 undo changes |u| u 2 undo changes
|v| v start characterwise Visual mode |v| v start charwise Visual mode
|w| w 1 cursor N words forward |w| w 1 cursor N words forward
|x| ["x]x 2 delete N characters under and after the |x| ["x]x 2 delete N characters under and after the
cursor [into register x] cursor [into register x]
@@ -570,6 +572,8 @@ tag command action in Normal mode ~
following the file name. following the file name.
|CTRL-W_gt| CTRL-W g t same as `gt`: go to next tab page |CTRL-W_gt| CTRL-W g t same as `gt`: go to next tab page
|CTRL-W_gT| CTRL-W g T same as `gT`: go to previous tab page |CTRL-W_gT| CTRL-W g T same as `gT`: go to previous tab page
|CTRL-W_g<Tab>| CTRL-W g <Tab> same as `g<Tab>` : go to last accessed tab
page
|CTRL-W_h| CTRL-W h go to Nth left window (stop at first window) |CTRL-W_h| CTRL-W h go to Nth left window (stop at first window)
|CTRL-W_i| CTRL-W i split window and jump to declaration of |CTRL-W_i| CTRL-W i split window and jump to declaration of
identifier under the cursor identifier under the cursor
@@ -767,6 +771,7 @@ tag char note action in Normal mode ~
|gn| gn 1,2 find the next match with the last used |gn| gn 1,2 find the next match with the last used
search pattern and Visually select it search pattern and Visually select it
|gm| gm 1 go to character at middle of the screenline |gm| gm 1 go to character at middle of the screenline
|gM| gM 1 go to character at middle of the text line
|go| go 1 cursor to byte N in the buffer |go| go 1 cursor to byte N in the buffer
|gp| ["x]gp 2 put the text [from register x] after the |gp| ["x]gp 2 put the text [from register x] after the
cursor N times, leave the cursor after it cursor N times, leave the cursor after it
@@ -787,6 +792,7 @@ tag char note action in Normal mode ~
|g<LeftMouse>| g<LeftMouse> same as <C-LeftMouse> |g<LeftMouse>| g<LeftMouse> same as <C-LeftMouse>
g<MiddleMouse> same as <C-MiddleMouse> g<MiddleMouse> same as <C-MiddleMouse>
|g<RightMouse>| g<RightMouse> same as <C-RightMouse> |g<RightMouse>| g<RightMouse> same as <C-RightMouse>
|g<Tab>| g<Tab> go to last accessed tab page
|g<Up>| g<Up> 1 same as "gk" |g<Up>| g<Up> 1 same as "gk"
============================================================================== ==============================================================================
@@ -865,7 +871,7 @@ These can be used after an operator, but before a {motion} has been entered.
tag char action in Operator-pending mode ~ tag char action in Operator-pending mode ~
----------------------------------------------------------------------- -----------------------------------------------------------------------
|o_v| v force operator to work characterwise |o_v| v force operator to work charwise
|o_V| V force operator to work linewise |o_V| V force operator to work linewise
|o_CTRL-V| CTRL-V force operator to work blockwise |o_CTRL-V| CTRL-V force operator to work blockwise
@@ -977,7 +983,7 @@ tag command note action in Visual mode ~
|v_r| r 2 replace highlighted area with a character |v_r| r 2 replace highlighted area with a character
|v_s| s 2 delete highlighted area and start insert |v_s| s 2 delete highlighted area and start insert
|v_u| u 2 make highlighted area lowercase |v_u| u 2 make highlighted area lowercase
|v_v| v make Visual mode characterwise or stop |v_v| v make Visual mode charwise or stop
Visual mode Visual mode
|v_x| x 2 delete the highlighted area |v_x| x 2 delete the highlighted area
|v_y| y yank the highlighted area |v_y| y yank the highlighted area
@@ -1163,11 +1169,13 @@ tag command action ~
|:cNfile| :cNf[ile] go to last error in previous file |:cNfile| :cNf[ile] go to last error in previous file
|:cabbrev| :ca[bbrev] like ":abbreviate" but for Command-line mode |:cabbrev| :ca[bbrev] like ":abbreviate" but for Command-line mode
|:cabclear| :cabc[lear] clear all abbreviations for Command-line mode |:cabclear| :cabc[lear] clear all abbreviations for Command-line mode
|:cabove| :cabo[ve] go to error above current line
|:caddbuffer| :cad[dbuffer] add errors from buffer |:caddbuffer| :cad[dbuffer] add errors from buffer
|:caddexpr| :cadde[xpr] add errors from expr |:caddexpr| :cadde[xpr] add errors from expr
|:caddfile| :caddf[ile] add error message to current quickfix list |:caddfile| :caddf[ile] add error message to current quickfix list
|:call| :cal[l] call a function |:call| :cal[l] call a function
|:catch| :cat[ch] part of a :try command |:catch| :cat[ch] part of a :try command
|:cbelow| :cbe[low] go to error below current line
|:cbottom| :cbo[ttom] scroll to the bottom of the quickfix window |:cbottom| :cbo[ttom] scroll to the bottom of the quickfix window
|:cbuffer| :cb[uffer] parse error messages and jump to first error |:cbuffer| :cb[uffer] parse error messages and jump to first error
|:cc| :cc go to specific error |:cc| :cc go to specific error
@@ -1324,12 +1332,14 @@ tag command action ~
|:lNext| :lN[ext] go to previous entry in location list |:lNext| :lN[ext] go to previous entry in location list
|:lNfile| :lNf[ile] go to last entry in previous file |:lNfile| :lNf[ile] go to last entry in previous file
|:list| :l[ist] print lines |:list| :l[ist] print lines
|:labove| :lab[ove] go to location above current line
|:laddexpr| :lad[dexpr] add locations from expr |:laddexpr| :lad[dexpr] add locations from expr
|:laddbuffer| :laddb[uffer] add locations from buffer |:laddbuffer| :laddb[uffer] add locations from buffer
|:laddfile| :laddf[ile] add locations to current location list |:laddfile| :laddf[ile] add locations to current location list
|:last| :la[st] go to the last file in the argument list |:last| :la[st] go to the last file in the argument list
|:language| :lan[guage] set the language (locale) |:language| :lan[guage] set the language (locale)
|:later| :lat[er] go to newer change, redo |:later| :lat[er] go to newer change, redo
|:lbelow| :lbe[low] go to location below current line
|:lbottom| :lbo[ttom] scroll to the bottom of the location window |:lbottom| :lbo[ttom] scroll to the bottom of the location window
|:lbuffer| :lb[uffer] parse locations and jump to first location |:lbuffer| :lb[uffer] parse locations and jump to first location
|:lcd| :lc[d] change directory locally |:lcd| :lc[d] change directory locally

View File

@@ -1083,7 +1083,8 @@ items:
empty when non-zero this match will be added even when it is empty when non-zero this match will be added even when it is
an empty string an empty string
user_data custom data which is associated with the item and user_data custom data which is associated with the item and
available in |v:completed_item| available in |v:completed_item|; it can be any type;
defaults to an empty string
All of these except "icase", "equal", "dup" and "empty" must be a string. If All of these except "icase", "equal", "dup" and "empty" must be a string. If
an item does not meet these requirements then an error message is given and an item does not meet these requirements then an error message is given and

View File

@@ -271,7 +271,7 @@ and <> are part of what you type, the context should make this clear.
operator is pending. operator is pending.
- Ex commands can be used to move the cursor. This can be - Ex commands can be used to move the cursor. This can be
used to call a function that does some complicated motion. used to call a function that does some complicated motion.
The motion is always characterwise exclusive, no matter The motion is always charwise exclusive, no matter
what ":" command is used. This means it's impossible to what ":" command is used. This means it's impossible to
include the last character of a line without the line break include the last character of a line without the line break
(unless 'virtualedit' is set). (unless 'virtualedit' is set).
@@ -339,6 +339,8 @@ notation meaning equivalent decimal value(s) ~
<EOL> end-of-line (can be <CR>, <LF> or <CR><LF>, <EOL> end-of-line (can be <CR>, <LF> or <CR><LF>,
depends on system and 'fileformat') *<EOL>* depends on system and 'fileformat') *<EOL>*
<Ignore> cancel wait-for-character *<Ignore>*
<NOP> no-op: do nothing (useful in mappings) *<Nop>*
<Up> cursor-up *cursor-up* *cursor_up* <Up> cursor-up *cursor-up* *cursor_up*
<Down> cursor-down *cursor-down* *cursor_down* <Down> cursor-down *cursor-down* *cursor_down*
@@ -378,11 +380,11 @@ notation meaning equivalent decimal value(s) ~
<kEqual> keypad = *keypad-equal* <kEqual> keypad = *keypad-equal*
<kEnter> keypad Enter *keypad-enter* <kEnter> keypad Enter *keypad-enter*
<k0> - <k9> keypad 0 to 9 *keypad-0* *keypad-9* <k0> - <k9> keypad 0 to 9 *keypad-0* *keypad-9*
<S-...> shift-key *shift* *<S-* <S-> shift-key *shift* *<S-*
<C-...> control-key *control* *ctrl* *<C-* <C-> control-key *control* *ctrl* *<C-*
<M-...> alt-key or meta-key *META* *ALT* *<M-* <M-> alt-key or meta-key *META* *ALT* *<M-*
<A-...> same as <M-...> *<A-* <A-> same as <M-> *<A-*
<D-...> command-key or "super" key *<D-* <D-> command-key or "super" key *<D-*
----------------------------------------------------------------------- -----------------------------------------------------------------------
Note: The shifted cursor keys, the help key, and the undo key are only Note: The shifted cursor keys, the help key, and the undo key are only

1262
runtime/doc/lsp.txt Normal file

File diff suppressed because it is too large Load Diff

1453
runtime/doc/lua.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -522,10 +522,9 @@ single CTRL-V (you have to type CTRL-V two times).
You can create an empty {rhs} by typing nothing after a single CTRL-V (you You can create an empty {rhs} by typing nothing after a single CTRL-V (you
have to type CTRL-V two times). Unfortunately, you cannot do this in a vimrc have to type CTRL-V two times). Unfortunately, you cannot do this in a vimrc
file. file.
*<Nop>* |<Nop>|
An easier way to get a mapping that doesn't produce anything, is to use An easier way to get a mapping that doesn't produce anything, is to use
"<Nop>" for the {rhs}. This only works when the |<>| notation is enabled. "<Nop>" for the {rhs}. For example, to disable function key 8: >
For example, to make sure that function key 8 does nothing at all: >
:map <F8> <Nop> :map <F8> <Nop>
:map! <F8> <Nop> :map! <F8> <Nop>
< <
@@ -786,7 +785,7 @@ g@{motion} Call the function set by the 'operatorfunc' option.
character of the text. character of the text.
The function is called with one String argument: The function is called with one String argument:
"line" {motion} was |linewise| "line" {motion} was |linewise|
"char" {motion} was |characterwise| "char" {motion} was |charwise|
"block" {motion} was |blockwise-visual| "block" {motion} was |blockwise-visual|
Although "block" would rarely appear, since it can Although "block" would rarely appear, since it can
only result from Visual mode where "g@" is not useful. only result from Visual mode where "g@" is not useful.

View File

@@ -69,7 +69,7 @@ See `:messages` above.
LIST OF MESSAGES LIST OF MESSAGES
*E222* *E228* *E232* *E256* *E293* *E298* *E304* *E317* *E222* *E228* *E232* *E256* *E293* *E298* *E304* *E317*
*E318* *E356* *E438* *E439* *E440* *E316* *E320* *E322* *E318* *E356* *E438* *E439* *E440* *E316* *E320* *E322*
*E323* *E341* *E473* *E570* *E685* *E950* > *E323* *E341* *E473* *E570* *E685* *E292* >
Add to read buffer Add to read buffer
makemap: Illegal mode makemap: Illegal mode
Cannot create BalloonEval with both message and callback Cannot create BalloonEval with both message and callback
@@ -556,7 +556,8 @@ allowed for the command that was used.
Vim was not able to create a swap file. You can still edit the file, but if Vim was not able to create a swap file. You can still edit the file, but if
Vim unexpectedly exits the changes will be lost. And Vim may consume a lot of Vim unexpectedly exits the changes will be lost. And Vim may consume a lot of
memory when editing a big file. You may want to change the 'directory' option memory when editing a big file. You may want to change the 'directory' option
to avoid this error. See |swap-file|. to avoid this error. This error is not given when 'directory' is empty. See
|swap-file|.
*E140* > *E140* >
Use ! to write partial buffer Use ! to write partial buffer
@@ -670,21 +671,20 @@ being disabled. Remove the 'C' flag from the 'cpoptions' option to enable it.
*E471* > *E471* >
Argument required Argument required
This happens when an Ex command with mandatory argument(s) was executed, but Ex command was executed without a mandatory argument(s).
no argument has been specified.
*E474* *E475* *E983* > *E474* *E475* *E983* >
Invalid argument Invalid argument
Invalid argument: {arg} Invalid argument: {arg}
Duplicate argument: {arg} Duplicate argument: {arg}
An Ex command or function has been executed, but an invalid argument has been Ex command or function was given an invalid argument. Or |jobstart()| or
specified. |system()| was given a non-executable command.
*E488* > *E488* >
Trailing characters Trailing characters
An argument has been added to an Ex command that does not permit one. An argument was given to an Ex command that does not permit one.
*E477* *E478* > *E477* *E478* >
No ! allowed No ! allowed

View File

@@ -185,8 +185,8 @@ you can do it without restarting Vim: >
:source $VIMRUNTIME/menu.vim :source $VIMRUNTIME/menu.vim
Each part of a menu path is translated separately. The result is that when Each part of a menu path is translated separately. The result is that when
"Help" is translated to "Hilfe" and "Overview" to "<EFBFBD>berblick" then "Help" is translated to "Hilfe" and "Overview" to "Überblick" then
"Help.Overview" will be translated to "Hilfe.<EFBFBD>berblick". "Help.Overview" will be translated to "Hilfe.Überblick".
============================================================================== ==============================================================================
3. Scripts *multilang-scripts* 3. Scripts *multilang-scripts*

View File

@@ -60,11 +60,11 @@ After applying the operator the cursor is mostly left at the start of the text
that was operated upon. For example, "yfe" doesn't move the cursor, but "yFe" that was operated upon. For example, "yfe" doesn't move the cursor, but "yFe"
moves the cursor leftwards to the "e" where the yank started. moves the cursor leftwards to the "e" where the yank started.
*linewise* *characterwise* *linewise* *charwise* *characterwise*
The operator either affects whole lines, or the characters between the start The operator either affects whole lines, or the characters between the start
and end position. Generally, motions that move between lines affect lines and end position. Generally, motions that move between lines affect lines
(are linewise), and motions that move within a line affect characters (are (are linewise), and motions that move within a line affect characters (are
characterwise). However, there are some exceptions. charwise). However, there are some exceptions.
*exclusive* *inclusive* *exclusive* *inclusive*
Character motion is either inclusive or exclusive. When inclusive, the Character motion is either inclusive or exclusive. When inclusive, the
@@ -106,10 +106,10 @@ This cannot be repeated: >
d:if 1<CR> d:if 1<CR>
call search("f")<CR> call search("f")<CR>
endif<CR> endif<CR>
Note that when using ":" any motion becomes characterwise exclusive. Note that when using ":" any motion becomes charwise exclusive.
*forced-motion* *forced-motion*
FORCING A MOTION TO BE LINEWISE, CHARACTERWISE OR BLOCKWISE FORCING A MOTION TO BE LINEWISE, CHARWISE OR BLOCKWISE
When a motion is not of the type you would like to use, you can force another When a motion is not of the type you would like to use, you can force another
type by using "v", "V" or CTRL-V just after the operator. type by using "v", "V" or CTRL-V just after the operator.
@@ -121,22 +121,22 @@ deletes from the cursor position until the character below the cursor >
d<C-V>j d<C-V>j
deletes the character under the cursor and the character below the cursor. > deletes the character under the cursor and the character below the cursor. >
Be careful with forcing a linewise movement to be used characterwise or Be careful with forcing a linewise movement to be used charwise or blockwise,
blockwise, the column may not always be defined. the column may not always be defined.
*o_v* *o_v*
v When used after an operator, before the motion command: Force v When used after an operator, before the motion command: Force
the operator to work characterwise, also when the motion is the operator to work charwise, also when the motion is
linewise. If the motion was linewise, it will become linewise. If the motion was linewise, it will become
|exclusive|. |exclusive|.
If the motion already was characterwise, toggle If the motion already was charwise, toggle
inclusive/exclusive. This can be used to make an exclusive inclusive/exclusive. This can be used to make an exclusive
motion inclusive and an inclusive motion exclusive. motion inclusive and an inclusive motion exclusive.
*o_V* *o_V*
V When used after an operator, before the motion command: Force V When used after an operator, before the motion command: Force
the operator to work linewise, also when the motion is the operator to work linewise, also when the motion is
characterwise. charwise.
*o_CTRL-V* *o_CTRL-V*
CTRL-V When used after an operator, before the motion command: Force CTRL-V When used after an operator, before the motion command: Force
@@ -219,6 +219,12 @@ g^ When lines wrap ('wrap' on): To the first non-blank
gm Like "g0", but half a screenwidth to the right (or as gm Like "g0", but half a screenwidth to the right (or as
much as possible). much as possible).
*gM*
gM Like "g0", but to halfway the text of the line.
With a count: to this percentage of text in the line.
Thus "10gM" is near the start of the text and "90gM"
is near the end of the text.
*g$* *g<End>* *g$* *g<End>*
g$ or g<End> When lines wrap ('wrap' on): To the last character of g$ or g<End> When lines wrap ('wrap' on): To the last character of
the screen line and [count - 1] screen lines downward the screen line and [count - 1] screen lines downward
@@ -412,35 +418,35 @@ between Vi and Vim.
5. Text object motions *object-motions* 5. Text object motions *object-motions*
*(* *(*
( [count] sentences backward. |exclusive| motion. ( [count] |sentence|s backward. |exclusive| motion.
*)* *)*
) [count] sentences forward. |exclusive| motion. ) [count] |sentence|s forward. |exclusive| motion.
*{* *{*
{ [count] paragraphs backward. |exclusive| motion. { [count] |paragraph|s backward. |exclusive| motion.
*}* *}*
} [count] paragraphs forward. |exclusive| motion. } [count] |paragraph|s forward. |exclusive| motion.
*]]* *]]*
]] [count] sections forward or to the next '{' in the ]] [count] |section|s forward or to the next '{' in the
first column. When used after an operator, then also first column. When used after an operator, then also
stops below a '}' in the first column. |exclusive| stops below a '}' in the first column. |exclusive|
Note that |exclusive-linewise| often applies. Note that |exclusive-linewise| often applies.
*][* *][*
][ [count] sections forward or to the next '}' in the ][ [count] |section|s forward or to the next '}' in the
first column. |exclusive| first column. |exclusive|
Note that |exclusive-linewise| often applies. Note that |exclusive-linewise| often applies.
*[[* *[[*
[[ [count] sections backward or to the previous '{' in [[ [count] |section|s backward or to the previous '{' in
the first column. |exclusive| the first column. |exclusive|
Note that |exclusive-linewise| often applies. Note that |exclusive-linewise| often applies.
*[]* *[]*
[] [count] sections backward or to the previous '}' in [] [count] |section|s backward or to the previous '}' in
the first column. |exclusive| the first column. |exclusive|
Note that |exclusive-linewise| often applies. Note that |exclusive-linewise| often applies.
@@ -502,36 +508,36 @@ aw "a word", select [count] words (see |word|).
Leading or trailing white space is included, but not Leading or trailing white space is included, but not
counted. counted.
When used in Visual linewise mode "aw" switches to When used in Visual linewise mode "aw" switches to
Visual characterwise mode. Visual charwise mode.
*v_iw* *iw* *v_iw* *iw*
iw "inner word", select [count] words (see |word|). iw "inner word", select [count] words (see |word|).
White space between words is counted too. White space between words is counted too.
When used in Visual linewise mode "iw" switches to When used in Visual linewise mode "iw" switches to
Visual characterwise mode. Visual charwise mode.
*v_aW* *aW* *v_aW* *aW*
aW "a WORD", select [count] WORDs (see |WORD|). aW "a WORD", select [count] WORDs (see |WORD|).
Leading or trailing white space is included, but not Leading or trailing white space is included, but not
counted. counted.
When used in Visual linewise mode "aW" switches to When used in Visual linewise mode "aW" switches to
Visual characterwise mode. Visual charwise mode.
*v_iW* *iW* *v_iW* *iW*
iW "inner WORD", select [count] WORDs (see |WORD|). iW "inner WORD", select [count] WORDs (see |WORD|).
White space between words is counted too. White space between words is counted too.
When used in Visual linewise mode "iW" switches to When used in Visual linewise mode "iW" switches to
Visual characterwise mode. Visual charwise mode.
*v_as* *as* *v_as* *as*
as "a sentence", select [count] sentences (see as "a sentence", select [count] sentences (see
|sentence|). |sentence|).
When used in Visual mode it is made characterwise. When used in Visual mode it is made charwise.
*v_is* *is* *v_is* *is*
is "inner sentence", select [count] sentences (see is "inner sentence", select [count] sentences (see
|sentence|). |sentence|).
When used in Visual mode it is made characterwise. When used in Visual mode it is made charwise.
*v_ap* *ap* *v_ap* *ap*
ap "a paragraph", select [count] paragraphs (see ap "a paragraph", select [count] paragraphs (see
@@ -552,14 +558,14 @@ a[ "a [] block", select [count] '[' ']' blocks. This
goes backwards to the [count] unclosed '[', and finds goes backwards to the [count] unclosed '[', and finds
the matching ']'. The enclosed text is selected, the matching ']'. The enclosed text is selected,
including the '[' and ']'. including the '[' and ']'.
When used in Visual mode it is made characterwise. When used in Visual mode it is made charwise.
i] *v_i]* *v_i[* *i]* *i[* i] *v_i]* *v_i[* *i]* *i[*
i[ "inner [] block", select [count] '[' ']' blocks. This i[ "inner [] block", select [count] '[' ']' blocks. This
goes backwards to the [count] unclosed '[', and finds goes backwards to the [count] unclosed '[', and finds
the matching ']'. The enclosed text is selected, the matching ']'. The enclosed text is selected,
excluding the '[' and ']'. excluding the '[' and ']'.
When used in Visual mode it is made characterwise. When used in Visual mode it is made charwise.
a) *v_a)* *a)* *a(* a) *v_a)* *a)* *a(*
a( *vab* *v_ab* *v_a(* *ab* a( *vab* *v_ab* *v_a(* *ab*
@@ -567,54 +573,54 @@ ab "a block", select [count] blocks, from "[count] [(" to
the matching ')', including the '(' and ')' (see the matching ')', including the '(' and ')' (see
|[(|). Does not include white space outside of the |[(|). Does not include white space outside of the
parenthesis. parenthesis.
When used in Visual mode it is made characterwise. When used in Visual mode it is made charwise.
i) *v_i)* *i)* *i(* i) *v_i)* *i)* *i(*
i( *vib* *v_ib* *v_i(* *ib* i( *vib* *v_ib* *v_i(* *ib*
ib "inner block", select [count] blocks, from "[count] [(" ib "inner block", select [count] blocks, from "[count] [("
to the matching ')', excluding the '(' and ')' (see to the matching ')', excluding the '(' and ')' (see
|[(|). |[(|).
When used in Visual mode it is made characterwise. When used in Visual mode it is made charwise.
a> *v_a>* *v_a<* *a>* *a<* a> *v_a>* *v_a<* *a>* *a<*
a< "a <> block", select [count] <> blocks, from the a< "a <> block", select [count] <> blocks, from the
[count]'th unmatched '<' backwards to the matching [count]'th unmatched '<' backwards to the matching
'>', including the '<' and '>'. '>', including the '<' and '>'.
When used in Visual mode it is made characterwise. When used in Visual mode it is made charwise.
i> *v_i>* *v_i<* *i>* *i<* i> *v_i>* *v_i<* *i>* *i<*
i< "inner <> block", select [count] <> blocks, from i< "inner <> block", select [count] <> blocks, from
the [count]'th unmatched '<' backwards to the matching the [count]'th unmatched '<' backwards to the matching
'>', excluding the '<' and '>'. '>', excluding the '<' and '>'.
When used in Visual mode it is made characterwise. When used in Visual mode it is made charwise.
*v_at* *at* *v_at* *at*
at "a tag block", select [count] tag blocks, from the at "a tag block", select [count] tag blocks, from the
[count]'th unmatched "<aaa>" backwards to the matching [count]'th unmatched "<aaa>" backwards to the matching
"</aaa>", including the "<aaa>" and "</aaa>". "</aaa>", including the "<aaa>" and "</aaa>".
See |tag-blocks| about the details. See |tag-blocks| about the details.
When used in Visual mode it is made characterwise. When used in Visual mode it is made charwise.
*v_it* *it* *v_it* *it*
it "inner tag block", select [count] tag blocks, from the it "inner tag block", select [count] tag blocks, from the
[count]'th unmatched "<aaa>" backwards to the matching [count]'th unmatched "<aaa>" backwards to the matching
"</aaa>", excluding the "<aaa>" and "</aaa>". "</aaa>", excluding the "<aaa>" and "</aaa>".
See |tag-blocks| about the details. See |tag-blocks| about the details.
When used in Visual mode it is made characterwise. When used in Visual mode it is made charwise.
a} *v_a}* *a}* *a{* a} *v_a}* *a}* *a{*
a{ *v_aB* *v_a{* *aB* a{ *v_aB* *v_a{* *aB*
aB "a Block", select [count] Blocks, from "[count] [{" to aB "a Block", select [count] Blocks, from "[count] [{" to
the matching '}', including the '{' and '}' (see the matching '}', including the '{' and '}' (see
|[{|). |[{|).
When used in Visual mode it is made characterwise. When used in Visual mode it is made charwise.
i} *v_i}* *i}* *i{* i} *v_i}* *i}* *i{*
i{ *v_iB* *v_i{* *iB* i{ *v_iB* *v_i{* *iB*
iB "inner Block", select [count] Blocks, from "[count] [{" iB "inner Block", select [count] Blocks, from "[count] [{"
to the matching '}', excluding the '{' and '}' (see to the matching '}', excluding the '{' and '}' (see
|[{|). |[{|).
When used in Visual mode it is made characterwise. When used in Visual mode it is made charwise.
a" *v_aquote* *aquote* a" *v_aquote* *aquote*
a' *v_a'* *a'* a' *v_a'* *a'*
@@ -628,7 +634,7 @@ a` *v_a`* *a`*
start of the line. start of the line.
Any trailing white space is included, unless there is Any trailing white space is included, unless there is
none, then leading white space is included. none, then leading white space is included.
When used in Visual mode it is made characterwise. When used in Visual mode it is made charwise.
Repeating this object in Visual mode another string is Repeating this object in Visual mode another string is
included. A count is currently not used. included. A count is currently not used.
@@ -1077,6 +1083,60 @@ When you split a window, the jumplist will be copied to the new window.
If you have included the ' item in the 'shada' option the jumplist will be If you have included the ' item in the 'shada' option the jumplist will be
stored in the ShaDa file and restored when starting Vim. stored in the ShaDa file and restored when starting Vim.
*jumplist-stack*
When jumpoptions includes "stack", the jumplist behaves like the history in a
web browser and like the tag stack. When jumping to a new location from the
middle of the jumplist, the locations after the current position will be
discarded.
This behavior corresponds to the following situation in a web browser.
Navigate to first.com, second.com, third.com, fourth.com and then fifth.com.
Then navigate backwards twice so that third.com is displayed. At that point,
the history is:
- first.com
- second.com
- third.com <--
- fourth.com
- fifth.com
Finally, navigate to a different webpage, new.com. The history is
- first.com
- second.com
- third.com
- new.com <--
When the jumpoptions includes "stack", this is the behavior of Nvim as well.
That is, given a jumplist like the following in which CTRL-O has been used to
move back three times to location X
jump line col file/text
2 1260 8 src/nvim/mark.c <-- location X-2
1 685 0 src/nvim/option_defs.h <-- location X-1
> 0 462 36 src/nvim/option_defs.h <-- location X
1 479 39 src/nvim/option_defs.h
2 213 2 src/nvim/mark.c
3 181 0 src/nvim/mark.c
jumping to (new) location Y results in the locations after the current
locations being removed:
jump line col file/text
3 1260 8 src/nvim/mark.c
2 685 0 src/nvim/option_defs.h
1 462 36 src/nvim/option_defs.h <-- location X
>
Then, when yet another location Z is jumped to, the new location Y appears
directly after location X in the jumplist and location X remains in the same
position relative to the locations (X-1, X-2, etc., ...) that had been before it
prior to the original jump from X to Y:
jump line col file/text
4 1260 8 src/nvim/mark.c <-- location X-2
3 685 0 src/nvim/option_defs.h <-- location X-1
2 462 36 src/nvim/option_defs.h <-- location X
1 100 0 src/nvim/option_defs.h <-- location Y
>
CHANGE LIST JUMPS *changelist* *change-list-jumps* *E664* CHANGE LIST JUMPS *changelist* *change-list-jumps* *E664*

View File

@@ -1,7 +1,8 @@
NVIM REFERENCE MANUAL by Thiago de Arruda NVIM REFERENCE MANUAL
This document was merged into |api.txt| and |develop.txt|. This document was merged into |api.txt| and |develop.txt|.
==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl:

View File

@@ -50,6 +50,13 @@ mode" in a normal buffer, such as |i| or |:startinsert|. In this mode all keys
except <C-\><C-N> are sent to the underlying program. Use <C-\><C-N> to return except <C-\><C-N> are sent to the underlying program. Use <C-\><C-N> to return
to normal-mode. |CTRL-\_CTRL-N| to normal-mode. |CTRL-\_CTRL-N|
Terminal-mode forces these local options:
'nocursorline'
'nocursorcolumn'
'scrolloff' = 0
'sidescrolloff' = 0
Terminal-mode has its own |:tnoremap| namespace for mappings, this can be used Terminal-mode has its own |:tnoremap| namespace for mappings, this can be used
to automate any terminal interaction. to automate any terminal interaction.
@@ -307,6 +314,23 @@ Other commands ~
isn't one isn't one
Prompt mode ~
*termdebug-prompt*
When on MS-Windows, gdb will run in a buffer with 'buftype' set to "prompt".
This works slightly differently:
- The gdb window will be in Insert mode while typing commands. Go to Normal
mode with <Esc>, then you can move around in the buffer, copy/paste, etc.
Go back to editing the gdb command with any command that starts Insert mode,
such as `a` or `i`.
- The program being debugged will run in a separate window. On MS-Windows
this is a new console window. On Unix, if the |+terminal| feature is
available a Terminal window will be opened to run the debugged program in.
*termdebug_use_prompt*
Prompt mode can be used even when the |+terminal| feature is present with: >
let g:termdebug_use_prompt = 1
Communication ~ Communication ~
*termdebug-communication* *termdebug-communication*
There is another, hidden, buffer, which is used for Vim to communicate with There is another, hidden, buffer, which is used for Vim to communicate with

View File

@@ -843,6 +843,14 @@ A jump table for the options with a short description can be found at |Q_op|.
name, precede it with a backslash. name, precede it with a backslash.
- To include a comma in a directory name precede it with a backslash. - To include a comma in a directory name precede it with a backslash.
- A directory name may end in an '/'. - A directory name may end in an '/'.
- For Unix and Win32, if a directory ends in two path separators "//",
the swap file name will be built from the complete path to the file
with all path separators changed to percent '%' signs. This will
ensure file name uniqueness in the backup directory.
On Win32, it is also possible to end with "\\". However, When a
separating comma is following, you must use "//", since "\\" will
include the comma in the file name. Therefore it is recommended to
use '//', instead of '\\'.
- Environment variables are expanded |:set_env|. - Environment variables are expanded |:set_env|.
- Careful with '\' characters, type one before a space, type two to - Careful with '\' characters, type one before a space, type two to
get one in the option (see |option-backslash|), for example: > get one in the option (see |option-backslash|), for example: >
@@ -1085,6 +1093,8 @@ A jump table for the options with a short description can be found at |Q_op|.
nowrite buffer will not be written nowrite buffer will not be written
quickfix list of errors |:cwindow| or locations |:lwindow| quickfix list of errors |:cwindow| or locations |:lwindow|
terminal |terminal-emulator| buffer terminal |terminal-emulator| buffer
prompt buffer where only the last line can be edited, meant
to be used by a plugin, see |prompt-buffer|
This option is used together with 'bufhidden' and 'swapfile' to This option is used together with 'bufhidden' and 'swapfile' to
specify special kinds of buffers. See |special-buffers|. specify special kinds of buffers. See |special-buffers|.
@@ -1478,7 +1488,7 @@ A jump table for the options with a short description can be found at |Q_op|.
See 'preserveindent'. See 'preserveindent'.
*'cpoptions'* *'cpo'* *cpo* *'cpoptions'* *'cpo'* *cpo*
'cpoptions' 'cpo' string (Vim default: "aABceFs", 'cpoptions' 'cpo' string (Vim default: "aABceFs_",
Vi default: all flags) Vi default: all flags)
global global
A sequence of single character flags. When a character is present A sequence of single character flags. When a character is present
@@ -1875,7 +1885,7 @@ A jump table for the options with a short description can be found at |Q_op|.
security reasons. security reasons.
*'dip'* *'diffopt'* *'dip'* *'diffopt'*
'diffopt' 'dip' string (default "internal,filler") 'diffopt' 'dip' string (default "internal,filler,closeoff")
global global
Option settings for diff mode. It can consist of the following items. Option settings for diff mode. It can consist of the following items.
All are optional. Items must be separated by a comma. All are optional. Items must be separated by a comma.
@@ -1932,6 +1942,12 @@ A jump table for the options with a short description can be found at |Q_op|.
vertical Start diff mode with vertical splits (unless vertical Start diff mode with vertical splits (unless
explicitly specified otherwise). explicitly specified otherwise).
closeoff When a window is closed where 'diff' is set
and there is only one window remaining in the
same tab page with 'diff' set, execute
`:diffoff` in that window. This undoes a
`:diffsplit` command.
hiddenoff Do not use diff mode for a buffer when it hiddenoff Do not use diff mode for a buffer when it
becomes hidden. becomes hidden.
@@ -1978,7 +1994,7 @@ A jump table for the options with a short description can be found at |Q_op|.
possible. If it is not possible in any directory, but last possible. If it is not possible in any directory, but last
directory listed in the option does not exist, it is created. directory listed in the option does not exist, it is created.
- Empty means that no swap file will be used (recovery is - Empty means that no swap file will be used (recovery is
impossible!). impossible!) and no |E303| error will be given.
- A directory "." means to put the swap file in the same directory as - A directory "." means to put the swap file in the same directory as
the edited file. On Unix, a dot is prepended to the file name, so the edited file. On Unix, a dot is prepended to the file name, so
it doesn't show in a directory listing. On MS-Windows the "hidden" it doesn't show in a directory listing. On MS-Windows the "hidden"
@@ -1986,12 +2002,14 @@ A jump table for the options with a short description can be found at |Q_op|.
- A directory starting with "./" (or ".\" for Windows) means to - A directory starting with "./" (or ".\" for Windows) means to
put the swap file relative to where the edited file is. The leading put the swap file relative to where the edited file is. The leading
"." is replaced with the path name of the edited file. "." is replaced with the path name of the edited file.
- For Unix and Win32, if a directory ends in two path separators "//" - For Unix and Win32, if a directory ends in two path separators "//",
or "\\", the swap file name will be built from the complete path to the swap file name will be built from the complete path to the file
the file with all path separators substituted to percent '%' signs. with all path separators substituted to percent '%' signs. This will
This will ensure file name uniqueness in the preserve directory. ensure file name uniqueness in the preserve directory.
On Win32, when a separating comma is following, you must use "//", On Win32, it is also possible to end with "\\". However, When a
since "\\" will include the comma in the file name. separating comma is following, you must use "//", since "\\" will
include the comma in the file name. Therefore it is recommended to
use '//', instead of '\\'.
- Spaces after the comma are ignored, other spaces are considered part - Spaces after the comma are ignored, other spaces are considered part
of the directory name. To have a space at the start of a directory of the directory name. To have a space at the start of a directory
name, precede it with a backslash. name, precede it with a backslash.
@@ -2242,8 +2260,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'fileformat'* *'ff'* *'fileformat'* *'ff'*
'fileformat' 'ff' string (Windows default: "dos", 'fileformat' 'ff' string (Windows default: "dos",
Unix default: "unix", Unix default: "unix")
Macintosh default: "mac")
local to buffer local to buffer
This gives the <EOL> of the current buffer, which is used for This gives the <EOL> of the current buffer, which is used for
reading/writing the buffer from/to a file: reading/writing the buffer from/to a file:
@@ -2265,7 +2282,6 @@ A jump table for the options with a short description can be found at |Q_op|.
'fileformats' 'ffs' string (default: 'fileformats' 'ffs' string (default:
Vim+Vi Win32: "dos,unix", Vim+Vi Win32: "dos,unix",
Vim Unix: "unix,dos", Vim Unix: "unix,dos",
Vim Mac: "mac,unix,dos",
Vi others: "") Vi others: "")
global global
This gives the end-of-line (<EOL>) formats that will be tried when This gives the end-of-line (<EOL>) formats that will be tried when
@@ -2348,7 +2364,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'fillchars'* *'fcs'* *'fillchars'* *'fcs'*
'fillchars' 'fcs' string (default "") 'fillchars' 'fcs' string (default "")
local to window global or local to window |global-local|
Characters to fill the statuslines and vertical separators. Characters to fill the statuslines and vertical separators.
It is a comma separated list of items: It is a comma separated list of items:
@@ -2357,6 +2373,9 @@ A jump table for the options with a short description can be found at |Q_op|.
stlnc:c ' ' or '=' statusline of the non-current windows stlnc:c ' ' or '=' statusline of the non-current windows
vert:c '│' or '|' vertical separators |:vsplit| vert:c '│' or '|' vertical separators |:vsplit|
fold:c '·' or '-' filling 'foldtext' fold:c '·' or '-' filling 'foldtext'
foldopen:c '-' mark the beginning of a fold
foldclose:c '+' show a closed fold
foldsep:c '│' or '|' open fold middle marker
diff:c '-' deleted lines of the 'diff' option diff:c '-' deleted lines of the 'diff' option
msgsep:c ' ' message separator 'display' msgsep:c ' ' message separator 'display'
eob:c '~' empty lines at the end of a buffer eob:c '~' empty lines at the end of a buffer
@@ -2365,7 +2384,7 @@ A jump table for the options with a short description can be found at |Q_op|.
"stlnc" the space will be used when there is highlighting, '^' or '=' "stlnc" the space will be used when there is highlighting, '^' or '='
otherwise. otherwise.
If 'ambiwidth' is "double" then "vert" and "fold" default to If 'ambiwidth' is "double" then "vert", "foldsep" and "fold" default to
single-byte alternatives. single-byte alternatives.
Example: > Example: >
@@ -2402,11 +2421,14 @@ A jump table for the options with a short description can be found at |Q_op|.
automatically close when moving out of them. automatically close when moving out of them.
*'foldcolumn'* *'fdc'* *'foldcolumn'* *'fdc'*
'foldcolumn' 'fdc' number (default 0) 'foldcolumn' 'fdc' string (default "0")
local to window local to window
When non-zero, a column with the specified width is shown at the side When and how to draw the foldcolumn. Valid values are:
of the window which indicates open and closed folds. The maximum "auto": resize to the maximum amount of folds to display.
value is 12. "auto:[1-9]": resize to accommodate multiple folds up to the
selected level
0: to disable foldcolumn
"[1-9]": to display a fixed number of columns
See |folding|. See |folding|.
*'foldenable'* *'fen'* *'nofoldenable'* *'nofen'* *'foldenable'* *'fen'* *'nofoldenable'* *'nofen'*
@@ -3443,6 +3465,17 @@ A jump table for the options with a short description can be found at |Q_op|.
Unprintable and zero-width Unicode characters are displayed as <xxxx>. Unprintable and zero-width Unicode characters are displayed as <xxxx>.
There is no option to specify these characters. There is no option to specify these characters.
*'jumpoptions'* *'jop'*
'jumpoptions' 'jop' string (default "")
global
List of words that change the behavior of the |jumplist|.
stack Make the jumplist behave like the tagstack or like a
web browser. Relative location of entries in the
jumplist is preserved at the cost of discarding
subsequent entries when navigating backwards in the
jumplist and then jumping to a location.
|jumplist-stack|
*'joinspaces'* *'js'* *'nojoinspaces'* *'nojs'* *'joinspaces'* *'js'* *'nojoinspaces'* *'nojs'*
'joinspaces' 'js' boolean (default on) 'joinspaces' 'js' boolean (default on)
global global
@@ -3657,7 +3690,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'listchars'* *'lcs'* *'listchars'* *'lcs'*
'listchars' 'lcs' string (default: "tab:> ,trail:-,nbsp:+" 'listchars' 'lcs' string (default: "tab:> ,trail:-,nbsp:+"
Vi default: "eol:$") Vi default: "eol:$")
local to window global or local to window |global-local|
Strings to use in 'list' mode and for the |:list| command. It is a Strings to use in 'list' mode and for the |:list| command. It is a
comma separated list of string settings. comma separated list of string settings.
@@ -3698,9 +3731,9 @@ A jump table for the options with a short description can be found at |Q_op|.
off and the line continues beyond the right of the off and the line continues beyond the right of the
screen. screen.
*lcs-precedes* *lcs-precedes*
precedes:c Character to show in the first column, when 'wrap' precedes:c Character to show in the first visible column of the
is off and there is text preceding the character physical line, when there is text preceding the
visible in the first column. character visible in the first column.
*lcs-conceal* *lcs-conceal*
conceal:c Character to show in place of concealed text, when conceal:c Character to show in place of concealed text, when
'conceallevel' is set to 1. A space when omitted. 'conceallevel' is set to 1. A space when omitted.
@@ -3914,6 +3947,8 @@ A jump table for the options with a short description can be found at |Q_op|.
When on allow some options that are an expression to be set in the When on allow some options that are an expression to be set in the
modeline. Check the option for whether it is affected by modeline. Check the option for whether it is affected by
'modelineexpr'. Also see |modeline|. 'modelineexpr'. Also see |modeline|.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
*'modelines'* *'mls'* *'modelines'* *'mls'*
'modelines' 'mls' number (default 5) 'modelines' 'mls' number (default 5)
@@ -4496,13 +4531,6 @@ A jump table for the options with a short description can be found at |Q_op|.
global global
When on a ":" prompt is used in Ex mode. When on a ":" prompt is used in Ex mode.
*'pumheight'* *'ph'*
'pumheight' 'ph' number (default 0)
global
Determines the maximum number of items to show in the popup menu for
Insert mode completion. When zero as much space as available is used.
|ins-completion-menu|.
*'pumblend'* *'pb'* *'pumblend'* *'pb'*
'pumblend' 'pb' number (default 0) 'pumblend' 'pb' number (default 0)
global global
@@ -4519,6 +4547,19 @@ A jump table for the options with a short description can be found at |Q_op|.
< <
UI-dependent. Works best with RGB colors. 'termguicolors' UI-dependent. Works best with RGB colors. 'termguicolors'
*'pumheight'* *'ph'*
'pumheight' 'ph' number (default 0)
global
Maximum number of items to show in the popup menu
(|ins-completion-menu|). Zero means "use available screen space".
*'pumwidth'* *'pw'*
'pumwidth' 'pw' number (default 15)
global
Minimum width for the popup menu (|ins-completion-menu|). If the
cursor column + 'pumwidth' exceeds screen width, the popup menu is
nudged to fit on the screen.
*'pyxversion'* *'pyx'* *'pyxversion'* *'pyx'*
'pyxversion' 'pyx' number (default depends on the build) 'pyxversion' 'pyx' number (default depends on the build)
global global
@@ -4583,6 +4624,16 @@ A jump table for the options with a short description can be found at |Q_op|.
RedrawDebugRecompose guibg=Red redraw generated by the RedrawDebugRecompose guibg=Red redraw generated by the
compositor itself, due to a compositor itself, due to a
grid being moved or deleted. grid being moved or deleted.
nothrottle Turn off throttling of the message grid. This is an
optimization that joins many small scrolls to one
larger scroll when drawing the message area (with
'display' msgsep flag active).
invalid Enable stricter checking (abort) of inconsistencies
of the internal screen state. This is mostly
useful when running nvim inside a debugger (and
the test suite).
nodelta Send all internally redrawn cells to the UI, even if
they are unchanged from the already displayed state.
*'redrawtime'* *'rdt'* *'redrawtime'* *'rdt'*
'redrawtime' 'rdt' number (default 2000) 'redrawtime' 'rdt' number (default 2000)
@@ -4851,13 +4902,17 @@ A jump table for the options with a short description can be found at |Q_op|.
*'scrolloff'* *'so'* *'scrolloff'* *'so'*
'scrolloff' 'so' number (default 0) 'scrolloff' 'so' number (default 0)
global global or local to window |global-local|
Minimal number of screen lines to keep above and below the cursor. Minimal number of screen lines to keep above and below the cursor.
This will make some context visible around where you are working. If This will make some context visible around where you are working. If
you set it to a very large value (999) the cursor line will always be you set it to a very large value (999) the cursor line will always be
in the middle of the window (except at the start or end of the file or in the middle of the window (except at the start or end of the file or
when long lines wrap). when long lines wrap).
For scrolling horizontally see 'sidescrolloff'. After using the local value, go back the global value with one of
these two: >
setlocal scrolloff<
setlocal scrolloff=-1
< For scrolling horizontally see 'sidescrolloff'.
*'scrollopt'* *'sbo'* *'scrollopt'* *'sbo'*
'scrollopt' 'sbo' string (default "ver,jump") 'scrollopt' 'sbo' string (default "ver,jump")
@@ -5158,8 +5213,9 @@ A jump table for the options with a short description can be found at |Q_op|.
Note that such processing is done after |:set| did its own round of Note that such processing is done after |:set| did its own round of
unescaping, so to keep yourself sane use |:let-&| like shown above. unescaping, so to keep yourself sane use |:let-&| like shown above.
*shell-powershell* *shell-powershell*
To use powershell (on Windows): > To use powershell: >
set shell=powershell shellquote=( shellpipe=\| shellxquote= let &shell = has('win32') ? 'powershell' : 'pwsh'
set shellquote= shellpipe=\| shellxquote=
set shellcmdflag=-NoLogo\ -NoProfile\ -ExecutionPolicy\ RemoteSigned\ -Command set shellcmdflag=-NoLogo\ -NoProfile\ -ExecutionPolicy\ RemoteSigned\ -Command
set shellredir=\|\ Out-File\ -Encoding\ UTF8 set shellredir=\|\ Out-File\ -Encoding\ UTF8
@@ -5465,7 +5521,7 @@ A jump table for the options with a short description can be found at |Q_op|.
*'sidescrolloff'* *'siso'* *'sidescrolloff'* *'siso'*
'sidescrolloff' 'siso' number (default 0) 'sidescrolloff' 'siso' number (default 0)
global global or local to window |global-local|
The minimal number of screen columns to keep to the left and to the The minimal number of screen columns to keep to the left and to the
right of the cursor if 'nowrap' is set. Setting this option to a right of the cursor if 'nowrap' is set. Setting this option to a
value greater than 0 while having |'sidescroll'| also at a non-zero value greater than 0 while having |'sidescroll'| also at a non-zero
@@ -5474,7 +5530,11 @@ A jump table for the options with a short description can be found at |Q_op|.
to a large value (like 999) has the effect of keeping the cursor to a large value (like 999) has the effect of keeping the cursor
horizontally centered in the window, as long as one does not come too horizontally centered in the window, as long as one does not come too
close to the beginning of the line. close to the beginning of the line.
After using the local value, go back the global value with one of
these two: >
setlocal sidescrolloff<
setlocal sidescrolloff=-1
<
Example: Try this together with 'sidescroll' and 'listchars' as Example: Try this together with 'sidescroll' and 'listchars' as
in the following example to never allow the cursor to move in the following example to never allow the cursor to move
onto the "extends" character: > onto the "extends" character: >
@@ -5722,7 +5782,7 @@ A jump table for the options with a short description can be found at |Q_op|.
current one. |:vsplit| current one. |:vsplit|
*'startofline'* *'sol'* *'nostartofline'* *'nosol'* *'startofline'* *'sol'* *'nostartofline'* *'nosol'*
'startofline' 'sol' boolean (default on) 'startofline' 'sol' boolean (default off)
global global
When "on" the commands listed below move the cursor to the first When "on" the commands listed below move the cursor to the first
non-blank of the line. When off the cursor is kept in the same column non-blank of the line. When off the cursor is kept in the same column
@@ -5749,7 +5809,9 @@ A jump table for the options with a short description can be found at |Q_op|.
When the option starts with "%!" then it is used as an expression, When the option starts with "%!" then it is used as an expression,
evaluated and the result is used as the option value. Example: > evaluated and the result is used as the option value. Example: >
:set statusline=%!MyStatusLine() :set statusline=%!MyStatusLine()
< The result can contain %{} items that will be evaluated too. < The *g:statusline_winid* variable will be set to the |window-ID| of the
window that the status line belongs to.
The result can contain %{} items that will be evaluated too.
Note that the "%!" expression is evaluated in the context of the Note that the "%!" expression is evaluated in the context of the
current window and buffer, while %{} items are evaluated in the current window and buffer, while %{} items are evaluated in the
context of the window that the statusline belongs to. context of the window that the statusline belongs to.
@@ -5878,13 +5940,15 @@ A jump table for the options with a short description can be found at |Q_op|.
become empty. This will make a group like the following disappear become empty. This will make a group like the following disappear
completely from the statusline when none of the flags are set. > completely from the statusline when none of the flags are set. >
:set statusline=...%(\ [%M%R%H]%)... :set statusline=...%(\ [%M%R%H]%)...
< *g:actual_curbuf* < Beware that an expression is evaluated each and every time the status
Beware that an expression is evaluated each and every time the status line is displayed.
line is displayed. The current buffer and current window will be set *g:actual_curbuf* *g:actual_curwin*
temporarily to that of the window (and buffer) whose statusline is The current buffer and current window will be set temporarily to that
currently being drawn. The expression will evaluate in this context. of the window (and buffer) whose statusline is currently being drawn.
The variable "g:actual_curbuf" is set to the `bufnr()` number of the The expression will evaluate in this context. The variable
real current buffer. "g:actual_curbuf" is set to the `bufnr()` number of the real current
buffer and "g:actual_curwin" to the |window-ID| of the real current
window. These values are strings.
The 'statusline' option will be evaluated in the |sandbox| if set from The 'statusline' option will be evaluated in the |sandbox| if set from
a modeline, see |sandbox-option|. a modeline, see |sandbox-option|.
@@ -5990,6 +6054,8 @@ A jump table for the options with a short description can be found at |Q_op|.
vsplit Just like "split" but split vertically. vsplit Just like "split" but split vertically.
newtab Like "split", but open a new tab page. Overrules newtab Like "split", but open a new tab page. Overrules
"split" when both are present. "split" when both are present.
uselast If included, jump to the previously used window when
jumping to errors with |quickfix| commands.
*'synmaxcol'* *'smc'* *'synmaxcol'* *'smc'*
'synmaxcol' 'smc' number (default 3000) 'synmaxcol' 'smc' number (default 3000)
@@ -6149,6 +6215,14 @@ A jump table for the options with a short description can be found at |Q_op|.
match Match case match Match case
smart Ignore case unless an upper case letter is used smart Ignore case unless an upper case letter is used
*'tagfunc'* *'tfu'*
'tagfunc' 'tfu' string (default: empty)
local to buffer
This option specifies a function to be used to perform tag searches.
The function gets the tag pattern and should return a List of matching
tags. See |tag-function| for an explanation of how to write the
function and an example.
*'taglength'* *'tl'* *'taglength'* *'tl'*
'taglength' 'tl' number (default 0) 'taglength' 'tl' number (default 0)
global global
@@ -6448,9 +6522,11 @@ A jump table for the options with a short description can be found at |Q_op|.
>= 1 When the shada file is read or written. >= 1 When the shada file is read or written.
>= 2 When a file is ":source"'ed. >= 2 When a file is ":source"'ed.
>= 3 UI info, terminal capabilities >= 3 UI info, terminal capabilities
>= 4 Shell commands.
>= 5 Every searched tags file and include file. >= 5 Every searched tags file and include file.
>= 8 Files for which a group of autocommands is executed. >= 8 Files for which a group of autocommands is executed.
>= 9 Every executed autocommand. >= 9 Every executed autocommand.
>= 11 Finding items in a path
>= 12 Every executed function. >= 12 Every executed function.
>= 13 When an exception is thrown, caught, finished, or discarded. >= 13 When an exception is thrown, caught, finished, or discarded.
>= 14 Anything pending in a ":finally" clause. >= 14 Anything pending in a ":finally" clause.
@@ -6620,23 +6696,23 @@ A jump table for the options with a short description can be found at |Q_op|.
*'wildmenu'* *'wmnu'* *'nowildmenu'* *'nowmnu'* *'wildmenu'* *'wmnu'* *'nowildmenu'* *'nowmnu'*
'wildmenu' 'wmnu' boolean (default on) 'wildmenu' 'wmnu' boolean (default on)
global global
When 'wildmenu' is on, command-line completion operates in an enhanced Enables "enhanced mode" of command-line completion. When user hits
mode. On pressing 'wildchar' (usually <Tab>) to invoke completion, <Tab> (or 'wildchar') to invoke completion, the possible matches are
the possible matches are shown just above the command line, with the shown in a menu just above the command-line (see 'wildoptions'), with
first match highlighted (overwriting the status line, if there is the first match highlighted (overwriting the statusline). Keys that
one). Keys that show the previous/next match, such as <Tab> or show the previous/next match (<Tab>/CTRL-P/CTRL-N) highlight the
CTRL-P/CTRL-N, cause the highlight to move to the appropriate match. match.
When 'wildmode' is used, "wildmenu" mode is used where "full" is 'wildmode' must specify "full": "longest" and "list" do not start
specified. "longest" and "list" do not start "wildmenu" mode. 'wildmenu' mode. You can check the current mode with |wildmenumode()|.
You can check the current mode with |wildmenumode()|. The menu is canceled when a key is hit that is not used for selecting
If there are more matches than can fit in the line, a ">" is shown on a completion.
the right and/or a "<" is shown on the left. The status line scrolls
as needed.
The "wildmenu" mode is abandoned when a key is hit that is not used
for selecting a completion.
While the "wildmenu" is active the following keys have special
meanings:
While the menu is active these keys have special meanings:
CTRL-Y - accept the currently selected match and stop
completion.
CTRL-E - end completion, go back to what was there before
selecting a match.
<Left> <Right> - select previous/next match (like CTRL-P/CTRL-N) <Left> <Right> - select previous/next match (like CTRL-P/CTRL-N)
<Down> - in filename/menu name completion: move into a <Down> - in filename/menu name completion: move into a
subdirectory or submenu. subdirectory or submenu.
@@ -6645,15 +6721,12 @@ A jump table for the options with a short description can be found at |Q_op|.
<Up> - in filename/menu name completion: move up into <Up> - in filename/menu name completion: move up into
parent directory or parent menu. parent directory or parent menu.
This makes the menus accessible from the console |console-menus|. If you want <Left> and <Right> to move the cursor instead of selecting
a different match, use this: >
If you prefer the <Left> and <Right> keys to move the cursor instead
of selecting a different match, use this: >
:cnoremap <Left> <Space><BS><Left> :cnoremap <Left> <Space><BS><Left>
:cnoremap <Right> <Space><BS><Right> :cnoremap <Right> <Space><BS><Right>
< <
The "WildMenu" highlighting is used for displaying the current match |hl-WildMenu| highlights the current match.
|hl-WildMenu|.
*'wildmode'* *'wim'* *'wildmode'* *'wim'*
'wildmode' 'wim' string (default: "full") 'wildmode' 'wim' string (default: "full")
@@ -6677,6 +6750,8 @@ A jump table for the options with a short description can be found at |Q_op|.
complete first match. complete first match.
"list:longest" When more than one match, list all matches and "list:longest" When more than one match, list all matches and
complete till longest common string. complete till longest common string.
"list:lastused" When more than one buffer matches, sort buffers
by time last used (other than the current buffer).
When there is only a single match, it is fully completed in all cases. When there is only a single match, it is fully completed in all cases.
Examples: > Examples: >
@@ -6908,7 +6983,6 @@ A jump table for the options with a short description can be found at |Q_op|.
global global
The number of milliseconds to wait for each character sent to the The number of milliseconds to wait for each character sent to the
screen. When positive, characters are sent to the UI one by one. screen. When positive, characters are sent to the UI one by one.
When negative, all redrawn characters cause a delay, even if the See 'redrawdebug' for more options. For debugging purposes.
character already was displayed by the UI. For debugging purposes.
vim:tw=78:ts=8:noet:ft=help:norl: vim:tw=78:ts=8:noet:ft=help:norl:

View File

@@ -1111,6 +1111,9 @@ x A single character, with no special meaning, matches itself
*[:tab:]* [:tab:] the <Tab> character *[:tab:]* [:tab:] the <Tab> character
*[:escape:]* [:escape:] the <Esc> character *[:escape:]* [:escape:] the <Esc> character
*[:backspace:]* [:backspace:] the <BS> character *[:backspace:]* [:backspace:] the <BS> character
*[:ident:]* [:ident:] identifier character (same as "\i")
*[:keyword:]* [:keyword:] keyword character (same as "\k")
*[:fname:]* [:fname:] file name character (same as "\f")
The brackets in character class expressions are additional to the The brackets in character class expressions are additional to the
brackets delimiting a collection. For example, the following is a brackets delimiting a collection. For example, the following is a
plausible pattern for a Unix filename: "[-./[:alnum:]_~]\+" That is, plausible pattern for a Unix filename: "[-./[:alnum:]_~]\+" That is,

View File

@@ -58,12 +58,14 @@ If you run into problems, uninstall _both_ then install "pynvim" again: >
PYTHON PROVIDER CONFIGURATION ~ PYTHON PROVIDER CONFIGURATION ~
*g:python_host_prog* *g:python_host_prog*
Command to start Python 2 (executable, not directory). Setting this makes Command to start Python 2 (executable, not directory). Setting this makes
startup faster. Useful for working with virtualenvs. > startup faster. Useful for working with virtualenvs. Must be set before any
check for has("python2"). >
let g:python_host_prog = '/path/to/python' let g:python_host_prog = '/path/to/python'
< <
*g:python3_host_prog* *g:python3_host_prog*
Command to start Python 3 (executable, not directory). Setting this makes Command to start Python 3 (executable, not directory). Setting this makes
startup faster. Useful for working with virtualenvs. > startup faster. Useful for working with virtualenvs. Must be set before any
check for has("python3"). >
let g:python3_host_prog = '/path/to/python3' let g:python3_host_prog = '/path/to/python3'
< <
*g:loaded_python_provider* *g:loaded_python_provider*
@@ -124,6 +126,31 @@ To use an absolute path (e.g. to an rbenv installation): >
To use the RVM "system" Ruby installation: > To use the RVM "system" Ruby installation: >
let g:ruby_host_prog = 'rvm system do neovim-ruby-host' let g:ruby_host_prog = 'rvm system do neovim-ruby-host'
==============================================================================
Perl integration *provider-perl*
Nvim supports Perl |remote-plugin|s.
https://github.com/jacquesg/p5-Neovim-Ext
PERL QUICKSTART~
To use perl remote-plugins with Nvim, install the "Neovim::Ext" cpan package: >
cpanm -n Neovim::Ext
Run |:checkhealth| to see if your system is up-to-date.
PERL PROVIDER CONFIGURATION~
*g:loaded_perl_provider*
To disable Perl support: >
:let g:loaded_perl_provider = 0
<
*g:perl_host_prog*
Command to start the Perl executable. Must be set before any
check for has("perl"). >
let g:perl_host_prog = '/path/to/perl'
<
============================================================================== ==============================================================================
Node.js integration *provider-nodejs* Node.js integration *provider-nodejs*

View File

@@ -109,6 +109,36 @@ processing a quickfix or location list command, it will be aborted.
list for the current window is used instead of the list for the current window is used instead of the
quickfix list. quickfix list.
*:cabo* *:cabove*
:[count]cabo[ve] Go to the [count] error above the current line in the
current buffer. If [count] is omitted, then 1 is
used. If there are no errors, then an error message
is displayed. Assumes that the entries in a quickfix
list are sorted by their buffer number and line
number. If there are multiple errors on the same line,
then only the first entry is used. If [count] exceeds
the number of entries above the current line, then the
first error in the file is selected.
*:lab* *:labove*
:[count]lab[ove] Same as ":cabove", except the location list for the
current window is used instead of the quickfix list.
*:cbe* *:cbelow*
:[count]cbe[low] Go to the [count] error below the current line in the
current buffer. If [count] is omitted, then 1 is
used. If there are no errors, then an error message
is displayed. Assumes that the entries in a quickfix
list are sorted by their buffer number and line
number. If there are multiple errors on the same
line, then only the first entry is used. If [count]
exceeds the number of entries below the current line,
then the last error in the file is selected.
*:lbe* *:lbelow*
:[count]lbe[low] Same as ":cbelow", except the location list for the
current window is used instead of the quickfix list.
*:cnf* *:cnfile* *:cnf* *:cnfile*
:[count]cnf[ile][!] Display the first error in the [count] next file in :[count]cnf[ile][!] Display the first error in the [count] next file in
the list that includes a file name. If there are no the list that includes a file name. If there are no

View File

@@ -47,6 +47,7 @@ N is used to indicate an optional count that can be given before the command.
|g$| N g$ to last character in screen line (differs from "$" |g$| N g$ to last character in screen line (differs from "$"
when lines wrap) when lines wrap)
|gm| gm to middle of the screen line |gm| gm to middle of the screen line
|gM| gM to middle of the line
|bar| N | to column N (default: 1) |bar| N | to column N (default: 1)
|f| N f{char} to the Nth occurrence of {char} to the right |f| N f{char} to the Nth occurrence of {char} to the right
|F| N F{char} to the Nth occurrence of {char} to the left |F| N F{char} to the Nth occurrence of {char} to the left
@@ -742,6 +743,7 @@ Short explanation of each option: *option-list*
'iskeyword' 'isk' characters included in keywords 'iskeyword' 'isk' characters included in keywords
'isprint' 'isp' printable characters 'isprint' 'isp' printable characters
'joinspaces' 'js' two spaces after a period with a join command 'joinspaces' 'js' two spaces after a period with a join command
'jumpoptions' 'jop' specifies how jumping is done
'keymap' 'kmp' name of a keyboard mapping 'keymap' 'kmp' name of a keyboard mapping
'keymodel' 'km' enable starting/stopping selection with keys 'keymodel' 'km' enable starting/stopping selection with keys
'keywordprg' 'kp' program to use for the "K" command 'keywordprg' 'kp' program to use for the "K" command

View File

@@ -176,9 +176,9 @@ See |sign_place()| for the equivalent Vim script function.
By default, the sign is assigned a default priority of 10. To By default, the sign is assigned a default priority of 10. To
assign a different priority value, use "priority={prio}" to assign a different priority value, use "priority={prio}" to
specify a value. The priority is used to determine the specify a value. The priority is used to determine the sign
highlight group used when multiple signs are placed on the that is displayed when multiple signs are placed on the same
same line. line.
Examples: > Examples: >
:sign place 5 line=3 name=sign1 file=a.py :sign place 5 line=3 name=sign1 file=a.py
@@ -198,7 +198,9 @@ See |sign_place()| for the equivalent Vim script function.
it (e.g., when the debugger has stopped at a breakpoint). it (e.g., when the debugger has stopped at a breakpoint).
The optional "group={group}" attribute can be used before The optional "group={group}" attribute can be used before
"file=" to select a sign in a particular group. "file=" to select a sign in a particular group. The optional
"priority={prio}" attribute can be used to change the priority
of an existing sign.
:sign place {id} name={name} [buffer={nr}] :sign place {id} name={name} [buffer={nr}]
Same, but use buffer {nr}. If the buffer argument is not Same, but use buffer {nr}. If the buffer argument is not

View File

@@ -504,7 +504,7 @@ then Vim will try to guess.
Multiple {inname} arguments can be given to combine Multiple {inname} arguments can be given to combine
regions into one Vim spell file. Example: > regions into one Vim spell file. Example: >
:mkspell ~/.vim/spell/en /tmp/en_US /tmp/en_CA /tmp/en_AU :mkspell ~/.config/nvim/spell/en /tmp/en_US /tmp/en_CA /tmp/en_AU
< This combines the English word lists for US, CA and AU < This combines the English word lists for US, CA and AU
into one en.spl file. into one en.spl file.
Up to eight regions can be combined. *E754* *E755* Up to eight regions can be combined. *E754* *E755*
@@ -888,9 +888,9 @@ when using "cp1250" on Unix.
*spell-LOW* *spell-UPP* *spell-LOW* *spell-UPP*
Three lines in the affix file are needed. Simplistic example: Three lines in the affix file are needed. Simplistic example:
FOL <EFBFBD><EFBFBD><EFBFBD> ~ FOL áëñ ~
LOW <EFBFBD><EFBFBD><EFBFBD> ~ LOW áëñ ~
UPP <EFBFBD><EFBFBD><EFBFBD> ~ UPP ÁËÑ ~
All three lines must have exactly the same number of characters. All three lines must have exactly the same number of characters.
@@ -905,9 +905,9 @@ The "UPP" line specifies the characters with upper-case. That is, a character
is upper-case where it's different from the character at the same position in is upper-case where it's different from the character at the same position in
"FOL". "FOL".
An exception is made for the German sharp s <EFBFBD>. The upper-case version is An exception is made for the German sharp s ß. The upper-case version is
"SS". In the FOL/LOW/UPP lines it should be included, so that it's recognized "SS". In the FOL/LOW/UPP lines it should be included, so that it's recognized
as a word character, but use the <EFBFBD> character in all three. as a word character, but use the ß character in all three.
ASCII characters should be omitted, Vim always handles these in the same way. ASCII characters should be omitted, Vim always handles these in the same way.
When the encoding is UTF-8 no word characters need to be specified. When the encoding is UTF-8 no word characters need to be specified.
@@ -1377,7 +1377,7 @@ suggestions would spend most time trying all kind of weird compound words.
*spell-SYLLABLE* *spell-SYLLABLE*
The SYLLABLE item defines characters or character sequences that are used to The SYLLABLE item defines characters or character sequences that are used to
count the number of syllables in a word. Example: count the number of syllables in a word. Example:
SYLLABLE a<EFBFBD>e<EFBFBD>i<EFBFBD>o<EFBFBD><EFBFBD><EFBFBD>u<EFBFBD><EFBFBD><EFBFBD>y/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui ~ SYLLABLE aáeéiíoóöõuúüûy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui ~
Before the first slash is the set of characters that are counted for one Before the first slash is the set of characters that are counted for one
syllable, also when repeated and mixed, until the next character that is not syllable, also when repeated and mixed, until the next character that is not
@@ -1458,8 +1458,8 @@ alike. This is mostly used for a letter with different accents. This is used
to prefer suggestions with these letters substituted. Example: to prefer suggestions with these letters substituted. Example:
MAP 2 ~ MAP 2 ~
MAP e<EFBFBD><EFBFBD><EFBFBD><EFBFBD> ~ MAP eéëêè ~
MAP u<EFBFBD><EFBFBD><EFBFBD><EFBFBD> ~ MAP uüùúû ~
The first line specifies the number of MAP lines following. Vim ignores the The first line specifies the number of MAP lines following. Vim ignores the
number, but the line must be there. number, but the line must be there.

View File

@@ -90,6 +90,7 @@ argument.
--clean Equivalent to "-u NONE -i NONE": --clean Equivalent to "-u NONE -i NONE":
- Skips initializations from files and environment variables. - Skips initializations from files and environment variables.
- No 'shada' file is read or written. - No 'shada' file is read or written.
- Excludes user directories from 'runtimepath'
*--noplugin* *--noplugin*
--noplugin Skip loading plugins. Resets the 'loadplugins' option. --noplugin Skip loading plugins. Resets the 'loadplugins' option.
@@ -184,12 +185,17 @@ argument.
the 'modifiable' and 'write' options can be set to enable the 'modifiable' and 'write' options can be set to enable
changes and writing. changes and writing.
*-Z* *restricted-mode* *E145* *-Z* *restricted-mode* *E145* *E981*
-Z Restricted mode. All commands that make use of an external -Z Restricted mode. All commands that make use of an external
shell are disabled. This includes suspending with CTRL-Z, shell are disabled. This includes suspending with CTRL-Z,
":sh", filtering, the system() function, backtick expansion, ":sh", filtering, the system() function, backtick expansion
delete(), rename(), mkdir(), writefile(), libcall(), and libcall().
jobstart(), etc. Also disallowed are delete(), rename(), mkdir(), jobstart(),
etc.
Interfaces, such as Python, Ruby and Lua, are also disabled,
since they could be used to execute shell commands.
Note that the user may still find a loophole to execute a
shell command, it has only been made difficult.
-e *-e* *-E* -e *-e* *-E*
-E Start Nvim in Ex mode |gQ|. -E Start Nvim in Ex mode |gQ|.
@@ -1270,7 +1276,7 @@ exactly four MessagePack objects:
Key Type Def Description ~ Key Type Def Description ~
rt UInteger 0 Register type: rt UInteger 0 Register type:
No Description ~ No Description ~
0 |characterwise-register| 0 |charwise-register|
1 |linewise-register| 1 |linewise-register|
2 |blockwise-register| 2 |blockwise-register|
rw UInteger 0 Register width. Only valid rw UInteger 0 Register width. Only valid

View File

@@ -3522,6 +3522,24 @@ DEFINING CASE *:syn-case* *E390*
:sy[ntax] case :sy[ntax] case
Show either "syntax case match" or "syntax case ignore" (translated). Show either "syntax case match" or "syntax case ignore" (translated).
DEFINING FOLDLEVEL *:syn-foldlevel*
:sy[ntax] foldlevel [start | minimum]
This defines how the foldlevel of a line is computed when using
foldmethod=syntax (see |fold-syntax| and |:syn-fold|):
start: Use level of item containing start of line.
minimum: Use lowest local-minimum level of items on line.
The default is 'start'. Use 'minimum' to search a line horizontally
for the lowest level contained on the line that is followed by a
higher level. This produces more natural folds when syntax items
may close and open horizontally within a line.
:sy[ntax] foldlevel
Show either "syntax foldlevel start" or "syntax foldlevel minimum".
SPELL CHECKING *:syn-spell* SPELL CHECKING *:syn-spell*
:sy[ntax] spell [toplevel | notoplevel | default] :sy[ntax] spell [toplevel | notoplevel | default]
@@ -3985,6 +4003,8 @@ This will make each {} block form one fold.
The fold will start on the line where the item starts, and end where the item The fold will start on the line where the item starts, and end where the item
ends. If the start and end are within the same line, there is no fold. ends. If the start and end are within the same line, there is no fold.
The 'foldnestmax' option limits the nesting of syntax folds. The 'foldnestmax' option limits the nesting of syntax folds.
See |:syn-foldlevel| to control how the foldlevel of a line is computed
from its syntax items.
*:syn-contains* *E405* *E406* *E407* *E408* *E409* *:syn-contains* *E405* *E406* *E407* *E408* *E409*
@@ -4647,8 +4667,8 @@ in their own color.
":colorscheme" in a color scheme script. ":colorscheme" in a color scheme script.
To customize a colorscheme use another name, e.g. To customize a colorscheme use another name, e.g.
"~/.vim/colors/mine.vim", and use `:runtime` to load "~/.config/nvim/colors/mine.vim", and use `:runtime` to
the original colorscheme: > load the original colorscheme: >
runtime colors/evening.vim runtime colors/evening.vim
hi Statement ctermfg=Blue guifg=Blue hi Statement ctermfg=Blue guifg=Blue
@@ -4720,18 +4740,19 @@ the same syntax file on all UIs.
*bold* *underline* *undercurl* *bold* *underline* *undercurl*
*inverse* *italic* *standout* *inverse* *italic* *standout*
*strikethrough* *nocombine* *strikethrough*
cterm={attr-list} *attr-list* *highlight-cterm* *E418* cterm={attr-list} *attr-list* *highlight-cterm* *E418*
attr-list is a comma separated list (without spaces) of the attr-list is a comma separated list (without spaces) of the
following items (in any order): following items (in any order):
bold bold
underline underline
undercurl curly underline undercurl curly underline
strikethrough
reverse reverse
inverse same as reverse inverse same as reverse
italic italic
standout standout
strikethrough nocombine override attributes instead of combining them
NONE no attributes used (used to reset it) NONE no attributes used (used to reset it)
Note that "bold" can be used here and by using a bold font. They Note that "bold" can be used here and by using a bold font. They
@@ -4919,6 +4940,8 @@ Conceal placeholder characters substituted for concealed
text (see 'conceallevel') text (see 'conceallevel')
*hl-Cursor* *hl-Cursor*
Cursor character under the cursor Cursor character under the cursor
lCursor the character under the cursor when |language-mapping|
is used (see 'guicursor')
*hl-CursorIM* *hl-CursorIM*
CursorIM like Cursor, but used when in IME mode |CursorIM| CursorIM like Cursor, but used when in IME mode |CursorIM|
*hl-CursorColumn* *hl-CursorColumn*

View File

@@ -190,6 +190,9 @@ gt *i_CTRL-<PageDown>* *i_<C-PageDown>*
{count}<C-PageDown> {count}<C-PageDown>
{count}gt Go to tab page {count}. The first tab page has number one. {count}gt Go to tab page {count}. The first tab page has number one.
CTRL-<Tab> *CTRL-<Tab>*
CTRL-W g<Tab> *g<Tab>* *CTRL-W_g<Tab>*
g<Tab> Go to previous (last accessed) tab page.
:tabp[revious] *:tabp* *:tabprevious* *gT* *:tabN* :tabp[revious] *:tabp* *:tabprevious* *gT* *:tabN*
:tabN[ext] *:tabNext* *CTRL-<PageUp>* :tabN[ext] *:tabNext* *CTRL-<PageUp>*

View File

@@ -838,4 +838,70 @@ Common arguments for the commands above:
< For a ":djump", ":dsplit", ":dlist" and ":dsearch" command the pattern < For a ":djump", ":dsplit", ":dlist" and ":dsearch" command the pattern
is used as a literal string, not as a search pattern. is used as a literal string, not as a search pattern.
==============================================================================
7. Using 'tagfunc' *tag-function*
It is possible to provide Vim with a function which will generate a list of
tags used for commands like |:tag|, |:tselect| and Normal mode tag commands
like |CTRL-]|.
The function used for generating the taglist is specified by setting the
'tagfunc' option. The function will be called with three arguments:
a:pattern The tag identifier used during the tag search.
a:flags List of flags to control the function behavior.
a:info Dict containing the following entries:
buf_ffname Full filename which can be used for priority.
user_data Custom data String, if stored in the tag
stack previously by tagfunc.
Currently two flags may be passed to the tag function:
'c' The function was invoked by a normal command being processed
(mnemonic: the tag function may use the context around the
cursor to perform a better job of generating the tag list.)
'i' In Insert mode, the user was completing a tag (with
|i_CTRL-X_CTRL-]|).
Note that when 'tagfunc' is set, the priority of the tags described in
|tag-priority| does not apply. Instead, the priority is exactly as the
ordering of the elements in the list returned by the function.
*E987*
The function should return a List of Dict entries. Each Dict must at least
include the following entries and each value must be a string:
name Name of the tag.
filename Name of the file where the tag is defined. It is
either relative to the current directory or a full path.
cmd Ex command used to locate the tag in the file. This
can be either an Ex search pattern or a line number.
Note that the format is similar to that of |taglist()|, which makes it possible
to use its output to generate the result.
The following fields are optional:
kind Type of the tag.
user_data String of custom data stored in the tag stack which
can be used to disambiguate tags between operations.
If the function returns |v:null| instead of a List, a standard tag lookup will
be performed instead.
It is not allowed to change the tagstack from inside 'tagfunc'. *E986*
The following is a hypothetical example of a function used for 'tagfunc'. It
uses the output of |taglist()| to generate the result: a list of tags in the
inverse order of file names.
>
function! TagFunc(pattern, flags, info)
function! CompareFilenames(item1, item2)
let f1 = a:item1['filename']
let f2 = a:item2['filename']
return f1 >=# f2 ?
\ -1 : f1 <=# f2 ? 1 : 0
endfunction
let result = taglist(a:pattern)
call sort(result, "CompareFilenames")
return result
endfunc
set tagfunc=TagFunc
<
vim:tw=78:ts=8:noet:ft=help:norl: vim:tw=78:ts=8:noet:ft=help:norl:

View File

@@ -149,6 +149,8 @@ Nvim will adjust the shape of the cursor from a block to a line when in insert
mode (or as specified by the 'guicursor' option), on terminals that support mode (or as specified by the 'guicursor' option), on terminals that support
it. It uses the same |terminfo| extensions that were pioneered by tmux for it. It uses the same |terminfo| extensions that were pioneered by tmux for
this: "Ss" and "Se". this: "Ss" and "Se".
Similarly, if you set the cursor highlight group with blend=100, Nvim hides
the cursor through the "cvvis" and "civis" extensions.
If your terminfo definition is missing them, then Nvim will decide whether to If your terminfo definition is missing them, then Nvim will decide whether to
add them to your terminfo definition, by looking at $TERM and other add them to your terminfo definition, by looking at $TERM and other

View File

@@ -161,7 +161,9 @@ the editor.
`cursor_shape`: "block", "horizontal", "vertical" `cursor_shape`: "block", "horizontal", "vertical"
`cell_percentage`: Cell % occupied by the cursor. `cell_percentage`: Cell % occupied by the cursor.
`blinkwait`, `blinkon`, `blinkoff`: See |cursor-blinking|. `blinkwait`, `blinkon`, `blinkoff`: See |cursor-blinking|.
`attr_id`: Cursor attribute id (defined by `hl_attr_define`) `attr_id`: Cursor attribute id (defined by `hl_attr_define`).
When attr_id is 0, the background and foreground
colors should be swapped.
`attr_id_lm`: Cursor attribute id for when 'langmap' is active. `attr_id_lm`: Cursor attribute id for when 'langmap' is active.
`short_name`: Mode code name, see 'guicursor'. `short_name`: Mode code name, see 'guicursor'.
`name`: Mode descriptive name. `name`: Mode descriptive name.
@@ -201,8 +203,8 @@ the editor.
sent from Nvim, like for |ui-cmdline|. sent from Nvim, like for |ui-cmdline|.
["mode_change", mode, mode_idx] ["mode_change", mode, mode_idx]
The mode changed. The first parameter `mode` is a string representing Editor mode changed. The `mode` parameter is a string representing
the current mode. `mode_idx` is an index into the array received in the current mode. `mode_idx` is an index into the array emitted in
the `mode_info_set` event. UIs should change the cursor style the `mode_info_set` event. UIs should change the cursor style
according to the properties specified in the corresponding item. The according to the properties specified in the corresponding item. The
set of modes reported will change in new versions of Nvim, for set of modes reported will change in new versions of Nvim, for
@@ -211,11 +213,11 @@ the editor.
["mouse_on"] ["mouse_on"]
["mouse_off"] ["mouse_off"]
Tells the client whether mouse support, as determined by |'mouse'| |'mouse'| was enabled/disabled in the current editor mode. Useful for
option, is considered to be active in the current mode. This is mostly a terminal UI, or other situations where Nvim mouse would conflict
useful for a terminal frontend, or other situations where Nvim mouse with other usages of the mouse. UIs may ignore this and always send
would conflict with other usages of the mouse. It is safe for a client mouse input, because 'mouse' decides the behavior of |nvim_input()|
to ignore this and always send mouse events. implicitly.
["busy_start"] ["busy_start"]
["busy_stop"] ["busy_stop"]
@@ -294,7 +296,8 @@ numerical highlight ids to the actual attributes.
`underline`: underlined text. The line has `special` color. `underline`: underlined text. The line has `special` color.
`undercurl`: undercurled text. The curl has `special` color. `undercurl`: undercurled text. The curl has `special` color.
`blend`: Blend level (0-100). Could be used by UIs to support `blend`: Blend level (0-100). Could be used by UIs to support
blending floating windows to the background. blending floating windows to the background or to
signal a transparent cursor.
For absent color keys the default color should be used. Don't store For absent color keys the default color should be used. Don't store
the default value in the table, rather a sentinel value, so that the default value in the table, rather a sentinel value, so that
@@ -591,6 +594,12 @@ tabs.
When |ext_messages| is active, no message grid is used, and this event When |ext_messages| is active, no message grid is used, and this event
will not be sent. will not be sent.
["win_viewport", grid, win, topline, botline, curline, curcol]
Indicates the range of buffer text displayed in the window, as well
as the cursor position in the buffer. All positions are zero-based.
`botline` is set to one more than the line count of the buffer, if
there are filler lines past the end.
============================================================================== ==============================================================================
Popupmenu Events *ui-popupmenu* Popupmenu Events *ui-popupmenu*

View File

@@ -339,21 +339,6 @@ window, move the cursor to the filename and press "O". Double clicking with
the mouse will also do this. the mouse will also do this.
UNIX AND MS-WINDOWS
Some people have to do work on MS-Windows systems one day and on Unix another
day. If you are one of them, consider adding "slash" and "unix" to
'sessionoptions'. The session files will then be written in a format that can
be used on both systems. This is the command to put in your |init.vim| file:
>
:set sessionoptions+=unix,slash
Vim will use the Unix format then, because the MS-Windows Vim can read and
write Unix files, but Unix Vim can't read MS-Windows format session files.
Similarly, MS-Windows Vim understands file names with / to separate names, but
Unix Vim doesn't understand \.
SESSIONS AND SHADA SESSIONS AND SHADA
Sessions store many things, but not the position of marks, contents of Sessions store many things, but not the position of marks, contents of

View File

@@ -346,12 +346,13 @@ scroll:
g0 to first visible character in this line g0 to first visible character in this line
g^ to first non-blank visible character in this line g^ to first non-blank visible character in this line
gm to middle of this line gm to middle of screen line
gM to middle of the text in this line
g$ to last visible character in this line g$ to last visible character in this line
|<-- window -->| |<-- window -->|
some long text, part of which is visible ~ some long text, part of which is visible in one line ~
g0 g^ gm g$ g0 g^ gm gM g$
BREAKING AT WORDS *edit-no-break* BREAKING AT WORDS *edit-no-break*

View File

@@ -578,8 +578,10 @@ used for. You can find an alphabetical list here: |functions|. Use CTRL-] on
the function name to jump to detailed help on it. the function name to jump to detailed help on it.
String manipulation: *string-functions* String manipulation: *string-functions*
nr2char() get a character by its ASCII value nr2char() get a character by its number value
char2nr() get ASCII value of a character list2str() get a character string from a list of numbers
char2nr() get number value of a character
str2list() get list of numbers from a string
str2nr() convert a string to a Number str2nr() convert a string to a Number
str2float() convert a string to a Float str2float() convert a string to a Float
printf() format a string according to % items printf() format a string according to % items
@@ -607,6 +609,7 @@ String manipulation: *string-functions*
strcharpart() get part of a string using char index strcharpart() get part of a string using char index
strgetchar() get character from a string using char index strgetchar() get character from a string using char index
expand() expand special keywords expand() expand special keywords
expandcmd() expand a command like done for `:edit`
iconv() convert text from one encoding to another iconv() convert text from one encoding to another
byteidx() byte index of a character in a string byteidx() byte index of a character in a string
byteidxcomp() like byteidx() but count composing characters byteidxcomp() like byteidx() but count composing characters
@@ -641,6 +644,7 @@ List manipulation: *list-functions*
min() minimum value in a List min() minimum value in a List
count() count number of times a value appears in a List count() count number of times a value appears in a List
repeat() repeat a List multiple times repeat() repeat a List multiple times
flatten() flatten a List
Dictionary manipulation: *dict-functions* Dictionary manipulation: *dict-functions*
get() get an entry without an error for a wrong key get() get an entry without an error for a wrong key

View File

@@ -38,7 +38,7 @@ the differences.
- 'directory' defaults to ~/.local/share/nvim/swap// (|xdg|), auto-created - 'directory' defaults to ~/.local/share/nvim/swap// (|xdg|), auto-created
- 'display' defaults to "lastline,msgsep" - 'display' defaults to "lastline,msgsep"
- 'encoding' is UTF-8 (cf. 'fileencoding' for file-content encoding) - 'encoding' is UTF-8 (cf. 'fileencoding' for file-content encoding)
- 'fillchars' defaults (in effect) to "vert:│,fold:·" - 'fillchars' defaults (in effect) to "vert:│,fold:·,sep:│"
- 'formatoptions' defaults to "tcqj" - 'formatoptions' defaults to "tcqj"
- 'fsync' is disabled - 'fsync' is disabled
- 'history' defaults to 10000 (the maximum) - 'history' defaults to 10000 (the maximum)
@@ -55,6 +55,7 @@ the differences.
- 'showcmd' is enabled - 'showcmd' is enabled
- 'sidescroll' defaults to 1 - 'sidescroll' defaults to 1
- 'smarttab' is enabled - 'smarttab' is enabled
- 'startofline' is disabled
- 'tabpagemax' defaults to 50 - 'tabpagemax' defaults to 50
- 'tags' defaults to "./tags;,tags" - 'tags' defaults to "./tags;,tags"
- 'ttimeoutlen' defaults to 50 - 'ttimeoutlen' defaults to 50
@@ -115,6 +116,10 @@ backwards-compatibility cost. Some examples:
- Directories for 'directory' and 'undodir' are auto-created. - Directories for 'directory' and 'undodir' are auto-created.
- Terminal features such as 'guicursor' are enabled where possible. - Terminal features such as 'guicursor' are enabled where possible.
Some features are built in that otherwise required external plugins:
- Highlighting the yanked region, see |lua-highlight|.
ARCHITECTURE ~ ARCHITECTURE ~
External plugins run in separate processes. |remote-plugin| This improves External plugins run in separate processes. |remote-plugin| This improves
@@ -158,6 +163,7 @@ Events:
|UILeave| |UILeave|
|VimResume| |VimResume|
|VimSuspend| |VimSuspend|
|WinClosed|
Functions: Functions:
|dictwatcheradd()| notifies a callback whenever a |Dict| is modified |dictwatcheradd()| notifies a callback whenever a |Dict| is modified
@@ -168,6 +174,7 @@ Functions:
|system()|, |systemlist()| can run {cmd} directly (without 'shell') |system()|, |systemlist()| can run {cmd} directly (without 'shell')
Highlight groups: Highlight groups:
|highlight-blend| controls blend level for a highlight group
|expr-highlight| highlight groups (prefixed with "Nvim") |expr-highlight| highlight groups (prefixed with "Nvim")
|hl-NormalFloat| highlights floating window |hl-NormalFloat| highlights floating window
|hl-NormalNC| highlights non-current windows |hl-NormalNC| highlights non-current windows
@@ -193,19 +200,21 @@ Normal commands:
"Outline": Type |gO| in |:Man| and |:help| pages to see a document outline. "Outline": Type |gO| in |:Man| and |:help| pages to see a document outline.
Options: Options:
'cpoptions' flags: |cpo-_| 'cpoptions' flags: |cpo-_|
'display' flag `msgsep` to minimize scrolling when showing messages 'display' flags: "msgsep" minimizes scrolling when showing messages
'guicursor' works in the terminal 'guicursor' works in the terminal
'fillchars' local to window. flags: `msgsep` (see 'display' above) and `eob` 'fillchars' flags: "msgsep" (see 'display'), "eob" for |hl-EndOfBuffer|
for |hl-EndOfBuffer| marker marker, "foldopen", "foldsep", "foldclose"
'inccommand' shows interactive results for |:substitute|-like commands 'foldcolumn' supports up to 9 dynamic/fixed columns
'listchars' local to window 'inccommand' shows interactive results for |:substitute|-like commands
'pumblend' pseudo-transparent popupmenu 'listchars' local to window
'pumblend' pseudo-transparent popupmenu
'scrollback' 'scrollback'
'signcolumn' supports up to 9 dynamic/fixed columns 'signcolumn' supports up to 9 dynamic/fixed columns
'statusline' supports unlimited alignment sections 'statusline' supports unlimited alignment sections
'tabline' %@Func@foo%X can call any function on mouse-click 'tabline' %@Func@foo%X can call any function on mouse-click
'wildoptions' `pum` flag to use popupmenu for wildmode completion 'wildoptions' "pum" flag to use popupmenu for wildmode completion
'winblend' pseudo-transparency in floating windows |api-floatwin|
'winhighlight' window-local highlights 'winhighlight' window-local highlights
Signs: Signs:
@@ -267,11 +276,6 @@ are always available and may be used simultaneously. See |provider-python|.
|json_encode()| behaviour slightly changed: now |msgpack-special-dict| values |json_encode()| behaviour slightly changed: now |msgpack-special-dict| values
are accepted, but |v:none| is not. are accepted, but |v:none| is not.
*v:none* variable is absent. In Vim it represents “no value” in “js” strings
like "[,]" parsed as "[v:none]" by |js_decode()|.
*js_encode()* and *js_decode()* functions are also absent.
Viminfo text files were replaced with binary (messagepack) ShaDa files. Viminfo text files were replaced with binary (messagepack) ShaDa files.
Additional differences: Additional differences:
@@ -296,7 +300,7 @@ coerced to strings. See |id()| for more details, currently it uses
|c_CTRL-R| pasting a non-special register into |cmdline| omits the last <CR>. |c_CTRL-R| pasting a non-special register into |cmdline| omits the last <CR>.
Lua interface (|if_lua.txt|): Lua interface (|lua.txt|):
- `:lua print("a\0b")` will print `a^@b`, like with `:echomsg "a\nb"` . In Vim - `:lua print("a\0b")` will print `a^@b`, like with `:echomsg "a\nb"` . In Vim
that prints `a` and `b` on separate lines, exactly like that prints `a` and `b` on separate lines, exactly like
@@ -307,15 +311,15 @@ Lua interface (|if_lua.txt|):
- Lua package.path and package.cpath are automatically updated according to - Lua package.path and package.cpath are automatically updated according to
'runtimepath': |lua-require|. 'runtimepath': |lua-require|.
|input()| and |inputdialog()| support for each others features (return on
cancel and completion respectively) via dictionary argument (replaces all
other arguments if used).
|input()| and |inputdialog()| support user-defined cmdline highlighting.
Commands: Commands:
|:doautocmd| does not warn about "No matching autocommands". |:doautocmd| does not warn about "No matching autocommands".
Functions:
|input()| and |inputdialog()| support for each others features (return on
cancel and completion respectively) via dictionary argument (replaces all
other arguments if used).
|input()| and |inputdialog()| support user-defined cmdline highlighting.
Highlight groups: Highlight groups:
|hl-ColorColumn|, |hl-CursorColumn| are lower priority than most other |hl-ColorColumn|, |hl-CursorColumn| are lower priority than most other
groups groups
@@ -338,6 +342,7 @@ Normal commands:
Options: Options:
'ttimeout', 'ttimeoutlen' behavior was simplified 'ttimeout', 'ttimeoutlen' behavior was simplified
|jumpoptions| "stack" behavior
Shell: Shell:
Shell output (|:!|, |:make|, …) is always routed through the UI, so it Shell output (|:!|, |:make|, …) is always routed through the UI, so it
@@ -399,10 +404,10 @@ VimL (Vim script) compatibility:
Some legacy Vim features are not implemented: Some legacy Vim features are not implemented:
- |if_py|: *python-bindeval* *python-Function* are not supported - |if_lua|: Nvim Lua API is not compatible with Vim's "if_lua"
- |if_lua|: the `vim` object is missing some legacy methods
- *if_perl*
- *if_mzscheme* - *if_mzscheme*
- *if_perl*
- |if_py|: *python-bindeval* *python-Function* are not supported
- *if_tcl* - *if_tcl*
============================================================================== ==============================================================================
@@ -439,6 +444,11 @@ Compile-time features:
Emacs tags support Emacs tags support
X11 integration (see |x11-selection|) X11 integration (see |x11-selection|)
Eval:
*js_encode()*
*js_decode()*
*v:none* (used by Vim to represent JavaScript "undefined"); use |v:null| instead.
Highlight groups: Highlight groups:
*hl-StatusLineTerm* *hl-StatusLineTermNC* are unnecessary because Nvim *hl-StatusLineTerm* *hl-StatusLineTermNC* are unnecessary because Nvim
supports 'winhighlight' window-local highlights. supports 'winhighlight' window-local highlights.
@@ -524,4 +534,4 @@ TUI:
always uses 7-bit control sequences. always uses 7-bit control sequences.
============================================================================== ==============================================================================
vim:tw=78:ts=8:sw=2:noet:ft=help:norl: vim:tw=78:ts=8:sw=2:et:ft=help:norl:

View File

@@ -48,7 +48,7 @@ position.
============================================================================== ==============================================================================
2. Starting and stopping Visual mode *visual-start* 2. Starting and stopping Visual mode *visual-start*
*v* *characterwise-visual* *v* *charwise-visual*
[count]v Start Visual mode per character. [count]v Start Visual mode per character.
With [count] select the same number of characters or With [count] select the same number of characters or
lines as used for the last Visual operation, but at lines as used for the last Visual operation, but at
@@ -74,7 +74,7 @@ position.
If you use <Esc>, click the left mouse button or use any command that If you use <Esc>, click the left mouse button or use any command that
does a jump to another buffer while in Visual mode, the highlighting stops does a jump to another buffer while in Visual mode, the highlighting stops
and no text is affected. Also when you hit "v" in characterwise Visual mode, and no text is affected. Also when you hit "v" in charwise Visual mode,
"CTRL-V" in blockwise Visual mode or "V" in linewise Visual mode. If you hit "CTRL-V" in blockwise Visual mode or "V" in linewise Visual mode. If you hit
CTRL-Z the highlighting stops and the editor is suspended or a new shell is CTRL-Z the highlighting stops and the editor is suspended or a new shell is
started |CTRL-Z|. started |CTRL-Z|.
@@ -477,7 +477,7 @@ Commands in Select mode:
Otherwise, typed characters are handled as in Visual mode. Otherwise, typed characters are handled as in Visual mode.
When using an operator in Select mode, and the selection is linewise, the When using an operator in Select mode, and the selection is linewise, the
selected lines are operated upon, but like in characterwise selection. For selected lines are operated upon, but like in charwise selection. For
example, when a whole line is deleted, it can later be pasted in the middle of example, when a whole line is deleted, it can later be pasted in the middle of
a line. a line.
@@ -510,7 +510,7 @@ gV Avoid the automatic reselection of the Visual area
selection. selection.
*gh* *gh*
gh Start Select mode, characterwise. This is like "v", gh Start Select mode, charwise. This is like "v",
but starts Select mode instead of Visual mode. but starts Select mode instead of Visual mode.
Mnemonic: "get highlighted". Mnemonic: "get highlighted".

View File

@@ -201,9 +201,11 @@ CTRL-W CTRL_N *CTRL-W_CTRL-N*
|:find|. Doesn't split if {file} is not found. |:find|. Doesn't split if {file} is not found.
CTRL-W CTRL-^ *CTRL-W_CTRL-^* *CTRL-W_^* CTRL-W CTRL-^ *CTRL-W_CTRL-^* *CTRL-W_^*
CTRL-W ^ Does ":split #", split window in two and edit alternate file. CTRL-W ^ Split the current window in two and edit the alternate file.
When a count is given, it becomes ":split #N", split window When a count N is given, split the current window and edit
and edit buffer N. buffer N. Similar to ":sp #" and ":sp #N", but it allows the
other buffer to be unnamed. This command matches the behavior
of |CTRL-^|, except that it splits a window first.
CTRL-W ge *CTRL-W_ge* CTRL-W ge *CTRL-W_ge*
Detach the current window as an external window. Detach the current window as an external window.
@@ -1019,6 +1021,9 @@ list of buffers. |unlisted-buffer|
x buffers with a read error x buffers with a read error
% current buffer % current buffer
# alternate buffer # alternate buffer
R terminal buffers with a running job
F terminal buffers with a finished job
t show time last used and sort buffers
Combining flags means they are "and"ed together, e.g.: Combining flags means they are "and"ed together, e.g.:
h+ hidden buffers which are modified h+ hidden buffers which are modified
a+ active buffers which are modified a+ active buffers which are modified

View File

@@ -1,7 +1,7 @@
" Vim support file to detect file types " Vim support file to detect file types
" "
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2019 Aug 26 " Last Change: 2020 Apr 29
" Listen very carefully, I will say this only once " Listen very carefully, I will say this only once
if exists("did_load_filetypes") if exists("did_load_filetypes")
@@ -84,6 +84,9 @@ au BufNewFile,BufRead *.gpr setf ada
" AHDL " AHDL
au BufNewFile,BufRead *.tdf setf ahdl au BufNewFile,BufRead *.tdf setf ahdl
" AIDL
au BufNewFile,BufRead *.aidl setf aidl
" AMPL " AMPL
au BufNewFile,BufRead *.run setf ampl au BufNewFile,BufRead *.run setf ampl
@@ -229,11 +232,14 @@ au BufNewFile,BufRead *.bl setf blank
" Blkid cache file " Blkid cache file
au BufNewFile,BufRead */etc/blkid.tab,*/etc/blkid.tab.old setf xml au BufNewFile,BufRead */etc/blkid.tab,*/etc/blkid.tab.old setf xml
" BSDL
au BufNewFile,BufRead *bsd,*.bsdl setf bsdl
" Bazel (http://bazel.io) " Bazel (http://bazel.io)
autocmd BufRead,BufNewFile *.bzl,WORKSPACE,BUILD.bazel setf bzl autocmd BufRead,BufNewFile *.bzl,WORKSPACE,BUILD.bazel setf bzl
if has("fname_case") if has("fname_case")
" There is another check for BUILD further below. " There is another check for BUILD further below.
autocmd BufRead,BufNewFile BUILD setf bzl autocmd BufRead,BufNewFile BUILD setf bzl
endif endif
" C or lpc " C or lpc
@@ -421,6 +427,9 @@ au BufNewFile,BufRead *.csp,*.fdr setf csp
au BufNewFile,BufRead *.pld setf cupl au BufNewFile,BufRead *.pld setf cupl
au BufNewFile,BufRead *.si setf cuplsim au BufNewFile,BufRead *.si setf cuplsim
" Dart
au BufRead,BufNewfile *.dart,*.drt setf dart
" Debian Control " Debian Control
au BufNewFile,BufRead */debian/control setf debcontrol au BufNewFile,BufRead */debian/control setf debcontrol
au BufNewFile,BufRead control au BufNewFile,BufRead control
@@ -452,7 +461,7 @@ au BufNewFile,BufRead *.desc setf desc
au BufNewFile,BufRead *.d call dist#ft#DtraceCheck() au BufNewFile,BufRead *.d call dist#ft#DtraceCheck()
" Desktop files " Desktop files
au BufNewFile,BufRead *.desktop,.directory setf desktop au BufNewFile,BufRead *.desktop,*.directory setf desktop
" Dict config " Dict config
au BufNewFile,BufRead dict.conf,.dictrc setf dictconf au BufNewFile,BufRead dict.conf,.dictrc setf dictconf
@@ -484,7 +493,7 @@ au BufNewFile,BufRead *.rul
au BufNewFile,BufRead *.com call dist#ft#BindzoneCheck('dcl') au BufNewFile,BufRead *.com call dist#ft#BindzoneCheck('dcl')
" DOT " DOT
au BufNewFile,BufRead *.dot setf dot au BufNewFile,BufRead *.dot,*.gv setf dot
" Dylan - lid files " Dylan - lid files
au BufNewFile,BufRead *.lid setf dylanlid au BufNewFile,BufRead *.lid setf dylanlid
@@ -532,11 +541,14 @@ au BufNewFile,BufRead *.ecd setf ecd
au BufNewFile,BufRead *.e,*.E call dist#ft#FTe() au BufNewFile,BufRead *.e,*.E call dist#ft#FTe()
" Elinks configuration " Elinks configuration
au BufNewFile,BufRead */etc/elinks.conf,*/.elinks/elinks.conf setf elinks au BufNewFile,BufRead elinks.conf setf elinks
" ERicsson LANGuage; Yaws is erlang too " ERicsson LANGuage; Yaws is erlang too
au BufNewFile,BufRead *.erl,*.hrl,*.yaws setf erlang au BufNewFile,BufRead *.erl,*.hrl,*.yaws setf erlang
" Elm
au BufNewFile,BufRead *.elm setf elm
" Elm Filter Rules file " Elm Filter Rules file
au BufNewFile,BufRead filter-rules setf elmfilt au BufNewFile,BufRead filter-rules setf elmfilt
@@ -793,8 +805,8 @@ au BufNewFile,BufRead *.java,*.jav setf java
" JavaCC " JavaCC
au BufNewFile,BufRead *.jj,*.jjt setf javacc au BufNewFile,BufRead *.jj,*.jjt setf javacc
" JavaScript, ECMAScript " JavaScript, ECMAScript, ES module script, CommonJS script
au BufNewFile,BufRead *.js,*.javascript,*.es,*.mjs setf javascript au BufNewFile,BufRead *.js,*.javascript,*.es,*.mjs,*.cjs setf javascript
" JavaScript with React " JavaScript with React
au BufNewFile,BufRead *.jsx setf javascriptreact au BufNewFile,BufRead *.jsx setf javascriptreact
@@ -826,6 +838,9 @@ au BufNewFile,BufRead *.k setf kwt
" Kivy " Kivy
au BufNewFile,BufRead *.kv setf kivy au BufNewFile,BufRead *.kv setf kivy
" Kotlin
au BufNewFile,BufRead *.kt,*.ktm,*.kts setf kotlin
" KDE script " KDE script
au BufNewFile,BufRead *.ks setf kscript au BufNewFile,BufRead *.ks setf kscript
@@ -871,11 +886,12 @@ au BufNewFile,BufRead *.ll setf lifelines
" Lilo: Linux loader " Lilo: Linux loader
au BufNewFile,BufRead lilo.conf setf lilo au BufNewFile,BufRead lilo.conf setf lilo
" Lisp (*.el = ELisp, *.cl = Common Lisp, *.jl = librep Lisp) " Lisp (*.el = ELisp, *.cl = Common Lisp)
" *.jl was removed, it's also used for Julia, better skip than guess wrong.
if has("fname_case") if has("fname_case")
au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,*.L,.emacs,.sawfishrc setf lisp au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.L,.emacs,.sawfishrc setf lisp
else else
au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,.emacs,.sawfishrc setf lisp au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,.emacs,.sawfishrc setf lisp
endif endif
" SBCL implementation of Common Lisp " SBCL implementation of Common Lisp
@@ -975,6 +991,9 @@ au BufNewFile,BufRead hg-editor-*.txt setf hgcommit
" Mercurial config (looks like generic config file) " Mercurial config (looks like generic config file)
au BufNewFile,BufRead *.hgrc,*hgrc setf cfg au BufNewFile,BufRead *.hgrc,*hgrc setf cfg
" Meson Build system config
au BufNewFile,BufRead meson.build,meson_options.txt setf meson
" Messages (logs mostly) " Messages (logs mostly)
au BufNewFile,BufRead */log/{auth,cron,daemon,debug,kern,lpr,mail,messages,news/news,syslog,user}{,.log,.err,.info,.warn,.crit,.notice}{,.[0-9]*,-[0-9]*} setf messages au BufNewFile,BufRead */log/{auth,cron,daemon,debug,kern,lpr,mail,messages,news/news,syslog,user}{,.log,.err,.info,.warn,.crit,.notice}{,.[0-9]*,-[0-9]*} setf messages
@@ -1114,8 +1133,20 @@ au BufNewFile,BufRead *.ora setf ora
" Packet filter conf " Packet filter conf
au BufNewFile,BufRead pf.conf setf pf au BufNewFile,BufRead pf.conf setf pf
" Pacman Config (close enough to dosini)
au BufNewFile,BufRead */etc/pacman.conf setf dosini
" Pacman hooks
au BufNewFile,BufRead *.hook
\ if getline(1) == '[Trigger]' |
\ setf dosini |
\ endif
" Pam conf " Pam conf
au BufNewFile,BufRead */etc/pam.conf setf pamconf au BufNewFile,BufRead */etc/pam.conf setf pamconf
" Pam environment
au BufNewFile,BufRead pam_env.conf,.pam_environment setf pamenv
" PApp " PApp
au BufNewFile,BufRead *.papp,*.pxml,*.pxsl setf papp au BufNewFile,BufRead *.papp,*.pxml,*.pxsl setf papp
@@ -1143,6 +1174,7 @@ else
endif endif
au BufNewFile,BufRead *.plx,*.al,*.psgi setf perl au BufNewFile,BufRead *.plx,*.al,*.psgi setf perl
au BufNewFile,BufRead *.p6,*.pm6,*.pl6 setf perl6 au BufNewFile,BufRead *.p6,*.pm6,*.pl6 setf perl6
au BufNewFile,BufRead *.raku,*.rakumod setf perl6
" Perl, XPM or XPM2 " Perl, XPM or XPM2
au BufNewFile,BufRead *.pm au BufNewFile,BufRead *.pm
@@ -1272,7 +1304,8 @@ au BufNewFile,BufRead *.pyx,*.pxd setf pyrex
" Python, Python Shell Startup and Python Stub Files " Python, Python Shell Startup and Python Stub Files
" Quixote (Python-based web framework) " Quixote (Python-based web framework)
au BufNewFile,BufRead *.py,*.pyw,.pythonstartup,.pythonrc,*.ptl,*.pyi setf python au BufNewFile,BufRead *.py,*.pyw,.pythonstartup,.pythonrc setf python
au BufNewFile,BufRead *.ptl,*.pyi,SConstruct setf python
" Radiance " Radiance
au BufNewFile,BufRead *.rad,*.mat setf radiance au BufNewFile,BufRead *.rad,*.mat setf radiance
@@ -1293,6 +1326,9 @@ au BufNewFile,BufRead *.reg
" Renderman Interface Bytestream " Renderman Interface Bytestream
au BufNewFile,BufRead *.rib setf rib au BufNewFile,BufRead *.rib setf rib
" Rego Policy Language
au BufNewFile,BufRead *.rego setf rego
" Rexx " Rexx
au BufNewFile,BufRead *.rex,*.orx,*.rxo,*.rxj,*.jrexx,*.rexxj,*.rexx,*.testGroup,*.testUnit setf rexx au BufNewFile,BufRead *.rex,*.orx,*.rxo,*.rxj,*.jrexx,*.rexxj,*.rexx,*.testGroup,*.testUnit setf rexx
@@ -1591,10 +1627,12 @@ au BufNewFile,BufRead *.sqlj setf sqlj
au BufNewFile,BufRead *.sqr,*.sqi setf sqr au BufNewFile,BufRead *.sqr,*.sqi setf sqr
" OpenSSH configuration " OpenSSH configuration
au BufNewFile,BufRead ssh_config,*/.ssh/config setf sshconfig au BufNewFile,BufRead ssh_config,*/.ssh/config setf sshconfig
au BufNewFile,BufRead */etc/ssh/ssh_config.d/*.conf setf sshconfig
" OpenSSH server configuration " OpenSSH server configuration
au BufNewFile,BufRead sshd_config setf sshdconfig au BufNewFile,BufRead sshd_config setf sshdconfig
au BufNewFile,BufRead */etc/ssh/sshd_config.d/*.conf setf sshdconfig
" Stata " Stata
au BufNewFile,BufRead *.ado,*.do,*.imata,*.mata setf stata au BufNewFile,BufRead *.ado,*.do,*.imata,*.mata setf stata
@@ -1614,15 +1652,27 @@ au BufNewFile,BufRead *.sml setf sml
" Sratus VOS command macro " Sratus VOS command macro
au BufNewFile,BufRead *.cm setf voscm au BufNewFile,BufRead *.cm setf voscm
" Swift
au BufNewFile,BufRead *.swift setf swift
au BufNewFile,BufRead *.swift.gyb setf swiftgyb
" Swift Intermediate Language
au BufNewFile,BufRead *.sil setf sil
" Sysctl " Sysctl
au BufNewFile,BufRead */etc/sysctl.conf,*/etc/sysctl.d/*.conf setf sysctl au BufNewFile,BufRead */etc/sysctl.conf,*/etc/sysctl.d/*.conf setf sysctl
" Systemd unit files " Systemd unit files
au BufNewFile,BufRead */systemd/*.{automount,mount,path,service,socket,swap,target,timer} setf systemd au BufNewFile,BufRead */systemd/*.{automount,dnssd,link,mount,netdev,network,nspawn,path,service,slice,socket,swap,target,timer} setf systemd
" Systemd overrides " Systemd overrides
au BufNewFile,BufRead /etc/systemd/system/*.d/*.conf setf systemd au BufNewFile,BufRead */etc/systemd/*.conf.d/*.conf setf systemd
au BufNewFile,BufRead */etc/systemd/system/*.d/*.conf setf systemd
au BufNewFile,BufRead */.config/systemd/user/*.d/*.conf setf systemd
" Systemd temp files " Systemd temp files
au BufNewFile,BufRead /etc/systemd/system/*.d/.#* setf systemd au BufNewFile,BufRead */etc/systemd/system/*.d/.#* setf systemd
au BufNewFile,BufRead */etc/systemd/system/.#* setf systemd
au BufNewFile,BufRead */.config/systemd/user/*.d/.#* setf systemd
au BufNewFile,BufRead */.config/systemd/user/.#* setf systemd
" Synopsys Design Constraints " Synopsys Design Constraints
au BufNewFile,BufRead *.sdc setf sdc au BufNewFile,BufRead *.sdc setf sdc
@@ -1753,7 +1803,7 @@ au BufNewFile,BufRead *.va,*.vams setf verilogams
au BufNewFile,BufRead *.sv,*.svh setf systemverilog au BufNewFile,BufRead *.sv,*.svh setf systemverilog
" VHDL " VHDL
au BufNewFile,BufRead *.hdl,*.vhd,*.vhdl,*.vbe,*.vst setf vhdl au BufNewFile,BufRead *.hdl,*.vhd,*.vhdl,*.vbe,*.vst,*.vho setf vhdl
" Vim script " Vim script
au BufNewFile,BufRead *.vim,*.vba,.exrc,_exrc setf vim au BufNewFile,BufRead *.vim,*.vba,.exrc,_exrc setf vim

View File

@@ -1,4 +1,4 @@
" Maintainer: Anmol Sethi <anmol@aubble.com> " Maintainer: Anmol Sethi <hi@nhooyr.io>
" Previous Maintainer: SungHyun Nam <goweol@gmail.com> " Previous Maintainer: SungHyun Nam <goweol@gmail.com>
if exists('b:did_ftplugin') || &filetype !=# 'man' if exists('b:did_ftplugin') || &filetype !=# 'man'
@@ -6,7 +6,7 @@ if exists('b:did_ftplugin') || &filetype !=# 'man'
endif endif
let b:did_ftplugin = 1 let b:did_ftplugin = 1
let s:pager = get(s:, 'pager', 0) || !exists('b:man_sect') let s:pager = !exists('b:man_sect')
if s:pager if s:pager
call man#init_pager() call man#init_pager()
@@ -20,14 +20,13 @@ setlocal wrap breakindent linebreak
setlocal nonumber norelativenumber setlocal nonumber norelativenumber
setlocal foldcolumn=0 colorcolumn=0 nolist nofoldenable setlocal foldcolumn=0 colorcolumn=0 nolist nofoldenable
setlocal tagfunc=man#goto_tag
if !exists('g:no_plugin_maps') && !exists('g:no_man_maps') if !exists('g:no_plugin_maps') && !exists('g:no_man_maps')
nnoremap <silent> <buffer> j gj nnoremap <silent> <buffer> j gj
nnoremap <silent> <buffer> k gk nnoremap <silent> <buffer> k gk
nnoremap <silent> <buffer> gO :call man#show_toc()<CR> nnoremap <silent> <buffer> gO :call man#show_toc()<CR>
nnoremap <silent> <buffer> <C-]> :Man<CR> if s:pager
nnoremap <silent> <buffer> K :Man<CR>
nnoremap <silent> <buffer> <C-T> :call man#pop_tag()<CR>
if 1 == bufnr('%') || s:pager
nnoremap <silent> <buffer> <nowait> q :lclose<CR>:q<CR> nnoremap <silent> <buffer> <nowait> q :lclose<CR>:q<CR>
else else
nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>c nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>c

14
runtime/indent/Makefile Normal file
View File

@@ -0,0 +1,14 @@
# Portable Makefile for running indent tests.
VIM = vim
VIMRUNTIME = ..
# Run the tests that didn't run yet or failed previously.
# If a test succeeds a testdir/*.out file will be written.
# If a test fails a testdir/*.fail file will be written.
test:
VIMRUNTIME=$(VIMRUNTIME) $(VIM) --clean --not-a-term -u testdir/runtest.vim
clean:
rm -f testdir/*.fail testdir/*.out

View File

@@ -43,3 +43,5 @@ running. Add a test if the function exists and use ":finish", like this:
The user may have several options set unlike you, try to write the file such The user may have several options set unlike you, try to write the file such
that it works with any option settings. Also be aware of certain features not that it works with any option settings. Also be aware of certain features not
being compiled in. being compiled in.
To test the indent file, see testdir/README.txt.

View File

@@ -0,0 +1,97 @@
TESTING INDENT SCRIPTS
We'll use FILETYPE for the filetype name here.
FORMAT OF THE FILETYPE.IN FILE
First of all, create a FILETYPE.in file. It should contain:
- A modeline setting the 'filetype' and any other option values.
This must work like a comment for FILETYPE. E.g. for vim:
" vim: set ft=vim sw=4 :
- At least one block of lines to indent, prefixed with START_INDENT and
followed by END_INDENT. These lines must also look like a comment for your
FILETYPE. You would normally leave out all indent, so that the effect of
the indent command results in adding indent. Example:
" START_INDENT
func Some()
let x = 1
endfunc
" END_INDENT
If you just want to test normal indenting with default options, you can make
this a large number of lines. Just add all kinds of language constructs,
nested statements, etc. with valid syntax.
- Optionally, add lines with INDENT_EXE after START_INDENT, followed by a Vim
command. This will be executed before indenting the lines. Example:
" START_INDENT
" INDENT_EXE let g:vim_indent_cont = 6
let cmd =
\ 'some '
\ 'string'
" END_INDENT
Note that the command is not undone, you may need to reverse the effect for
the next block of lines.
- Alternatively to indenting all the lines between START_INDENT and
END_INDENT, use an INDENT_AT line, which specifies a pattern to find the
line to indent. Example:
" START_INDENT
" INDENT_AT this-line
func Some()
let f = x " this-line
endfunc
" END_INDENT
Alternatively you can use INDENT_NEXT to indent the line below the matching
pattern. Keep in mind that quite often it will indent relative to the
matching line:
" START_INDENT
" INDENT_NEXT next-line
func Some()
" next-line
let f = x
endfunc
" END_INDENT
Or use INDENT_PREV to indent the line above the matching pattern:
" START_INDENT
" INDENT_PREV prev-line
func Some()
let f = x
" prev-line
endfunc
" END_INDENT
It's best to keep the whole file valid for FILETYPE, so that syntax
highlighting works normally, and any indenting that depends on the syntax
highlighting also works.
RUNNING THE TEST
Before running the test, create a FILETYPE.ok file. You can leave it empty at
first.
Now run "make test" from the parent directory. After Vim has done the
indenting you will see a FILETYPE.fail file. This contains the actual result
of indenting, and it's different from the FILETYPE.ok file.
Check the contents of the FILETYPE.fail file. If it is perfectly OK, then
rename it to overwrite the FILETYPE.ok file. If you now run "make test" again,
the test will pass and create a FILETYPE.out file, which is identical to the
FILETYPE.ok file. The FILETYPE.fail file will be deleted.
If you try to run "make test" again you will notice that nothing happens,
because the FILETYPE.out file already exists. Delete it, or do "make clean",
so that the text runs again. If you edit the FILETYPE.in file, so that it's
newer than the FILETYPE.out file, the test will also run.

View File

@@ -0,0 +1,133 @@
" Runs all the indent tests for which there is no .out file.
"
" Current directory must be runtime/indent.
" Only do this with the +eval feature
if 1
set nocp
filetype indent on
syn on
set nowrapscan
set report=9999
set modeline
au! SwapExists * call HandleSwapExists()
func HandleSwapExists()
" Ignore finding a swap file for the test input and output, the user might be
" editing them and that's OK.
if expand('<afile>') =~ '.*\.\(in\|out\|fail\|ok\)'
let v:swapchoice = 'e'
endif
endfunc
let failed_count = 0
for fname in glob('testdir/*.in', 1, 1)
let root = substitute(fname, '\.in', '', '')
" Execute the test if the .out file does not exist of when the .in file is
" newer.
let in_time = getftime(fname)
let out_time = getftime(root . '.out')
if out_time < 0 || in_time > out_time
call delete(root . '.fail')
call delete(root . '.out')
set sw& ts& filetype=
exe 'split ' . fname
let did_some = 0
let failed = 0
let end = 1
while 1
" Indent all the lines between "START_INDENT" and "END_INDENT"
exe end
let start = search('\<START_INDENT\>')
let end = search('\<END_INDENT\>')
if start <= 0 || end <= 0 || end <= start
if did_some == 0
call append(0, 'ERROR: START_INDENT and/or END_INDENT not found')
let failed = 1
endif
break
else
let did_some = 1
" Execute all commands marked with INDENT_EXE and find any pattern.
let lnum = start
let pattern = ''
let at = ''
while 1
exe lnum + 1
let lnum_exe = search('\<INDENT_EXE\>')
exe lnum + 1
let indent_at = search('\<INDENT_\(AT\|NEXT\|PREV\)\>')
if lnum_exe > 0 && lnum_exe < end && (indent_at <= 0 || lnum_exe < indent_at)
exe substitute(getline(lnum_exe), '.*INDENT_EXE', '', '')
let lnum = lnum_exe
let start = lnum
elseif indent_at > 0 && indent_at < end
if pattern != ''
call append(indent_at, 'ERROR: duplicate pattern')
let failed = 1
break
endif
let text = getline(indent_at)
let pattern = substitute(text, '.*INDENT_\S*\s*', '', '')
let at = substitute(text, '.*INDENT_\(\S*\).*', '\1', '')
let lnum = indent_at
let start = lnum
else
break
endif
endwhile
exe start + 1
if pattern == ''
exe 'normal =' . (end - 1) . 'G'
else
let lnum = search(pattern)
if lnum <= 0
call append(indent_at, 'ERROR: pattern not found: ' . pattern)
let failed = 1
break
endif
if at == 'AT'
exe lnum
elseif at == 'NEXT'
exe lnum + 1
else
exe lnum - 1
endif
normal ==
endif
endif
endwhile
if !failed
" Check the resulting text equals the .ok file.
if getline(1, '$') != readfile(root . '.ok')
let failed = 1
endif
endif
if failed
let failed_count += 1
exe 'write ' . root . '.fail'
echoerr 'Test ' . fname . ' FAILED!'
else
exe 'write ' . root . '.out'
endif
quit! " close the indented file
endif
endfor
" Matching "if 1" at the start.
endif
if failed_count > 0
" have make report an error
cquit
endif
qall!

View File

@@ -0,0 +1,46 @@
" vim: set ft=vim sw=4 :
" START_INDENT
func Some()
let x = 1
endfunc
let cmd =
\ 'some '
\ 'string'
" END_INDENT
" START_INDENT
" INDENT_EXE let g:vim_indent_cont = 6
let cmd =
\ 'some '
\ 'string'
" END_INDENT
" START_INDENT
" INDENT_EXE unlet g:vim_indent_cont
" INDENT_AT this-line
func Some()
let f = x " this-line
endfunc
" END_INDENT
" START_INDENT
" INDENT_NEXT next-line
func Some()
" next-line
let f = x
endfunc
" END_INDENT
" START_INDENT
" INDENT_PREV prev-line
func Some()
let f = x
" prev-line
endfunc
" END_INDENT

View File

@@ -0,0 +1,46 @@
" vim: set ft=vim sw=4 :
" START_INDENT
func Some()
let x = 1
endfunc
let cmd =
\ 'some '
\ 'string'
" END_INDENT
" START_INDENT
" INDENT_EXE let g:vim_indent_cont = 6
let cmd =
\ 'some '
\ 'string'
" END_INDENT
" START_INDENT
" INDENT_EXE unlet g:vim_indent_cont
" INDENT_AT this-line
func Some()
let f = x " this-line
endfunc
" END_INDENT
" START_INDENT
" INDENT_NEXT next-line
func Some()
" next-line
let f = x
endfunc
" END_INDENT
" START_INDENT
" INDENT_PREV prev-line
func Some()
let f = x
" prev-line
endfunc
" END_INDENT

View File

@@ -64,14 +64,17 @@
" style) is supported. Thanks Miles Wheeler for reporting. " style) is supported. Thanks Miles Wheeler for reporting.
" 2018/02/07 by Yichao Zhou <broken.zhou AT gmail.com> " 2018/02/07 by Yichao Zhou <broken.zhou AT gmail.com>
" (*) Make indentation more smart in the normal mode " (*) Make indentation more smart in the normal mode
" 2020/04/26 by Yichao Zhou <broken.zhou AT gmail.com>
" (*) Fix a bug related to \[ & \]. Thanks Manuel Boni for
" reporting.
" "
" }}} " }}}
" Document: {{{ " Document: {{{
" "
" To set the following options (ok, currently it's just one), add a line like " For proper latex experience, please put
" let g:tex_indent_items = 1 " let g:tex_flavor = "latex"
" to your ~/.vimrc. " into your vimrc.
" "
" * g:tex_indent_brace " * g:tex_indent_brace
" "
@@ -184,13 +187,18 @@ function! GetTeXIndent() " {{{
let line = substitute(getline(lnum), '\s*%.*', '','g') " last line let line = substitute(getline(lnum), '\s*%.*', '','g') " last line
let cline = substitute(getline(v:lnum), '\s*%.*', '', 'g') " current line let cline = substitute(getline(v:lnum), '\s*%.*', '', 'g') " current line
let ccol = 1
while cline[ccol] =~ '\s'
let ccol += 1
endwhile
" We are in verbatim, so do what our user what. " We are in verbatim, so do what our user what.
if synIDattr(synID(v:lnum, indent(v:lnum), 1), "name") == "texZone" if synIDattr(synID(v:lnum, ccol, 1), "name") == "texZone"
if empty(cline) if empty(cline)
return indent(lnum) return indent(lnum)
else else
return indent(v:lnum) return indent(v:lnum)
end endif
endif endif
if lnum == 0 if lnum == 0
@@ -253,13 +261,13 @@ function! GetTeXIndent() " {{{
let stay = 0 let stay = 0
endif endif
if cline =~ '^\s*\\\?[\]}]' && s:CheckPairedIsLastCharacter(v:lnum, indent(v:lnum)) if cline =~ '^\s*\\\?[\]}]' && s:CheckPairedIsLastCharacter(v:lnum, ccol)
let ind -= shiftwidth() let ind -= shiftwidth()
let stay = 0 let stay = 0
endif endif
if line !~ '^\s*\\\?[\]}]' if line !~ '^\s*\\\?[\]}]'
for i in range(indent(lnum)+1, strlen(line)-1) for i in range(1, strlen(line)-1)
let char = line[i] let char = line[i]
if char == ']' || char == '}' if char == ']' || char == '}'
if s:CheckPairedIsLastCharacter(lnum, i) if s:CheckPairedIsLastCharacter(lnum, i)

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