Merge branch 'master' into yagebu/option-fixes

This commit is contained in:
James McCoy
2018-03-28 21:52:06 -04:00
953 changed files with 80648 additions and 28569 deletions

View File

@@ -7,6 +7,10 @@ end_of_line = lf
insert_final_newline = true insert_final_newline = true
charset = utf_8 charset = utf_8
[runtime/doc/*.txt]
indent_style = tab
indent_size = 8
[Makefile] [Makefile]
indent_style = tab indent_style = tab
tab_width = 4 tab_width = 4

5
.gitignore vendored
View File

@@ -1,10 +1,10 @@
# Build/deps dir # Build/deps dir
/build/ /build/
/cmake-build-debug/
/dist/ /dist/
/.deps/ /.deps/
/tmp/ /tmp/
*.orig
*.mo *.mo
.*.sw? .*.sw?
*~ *~
@@ -17,6 +17,9 @@ tags
/src/nvim/po/vim.pot /src/nvim/po/vim.pot
/src/nvim/po/*.ck /src/nvim/po/*.ck
# generated by tests with $NVIM_LOG_FILE set.
/.nvimlog
# Files generated by scripts/vim-patch.sh # Files generated by scripts/vim-patch.sh
/.vim-src/ /.vim-src/

View File

@@ -4,13 +4,8 @@ language: c
env: env:
global: global:
# To force rebuilding of third-party dependencies, set this to 'true'. # Set "false" to force rebuild of third-party dependencies.
- BUILD_NVIM_DEPS=false - CACHE_ENABLE=true
# Travis has 1.5 virtual cores according to
# http://docs.travis-ci.com/user/speeding-up-the-build/#Paralellizing-your-build-on-one-VM
- MAKE_CMD="make -j2"
# Update PATH for pip.
- PATH="$(python2.7 -c 'import site; print(site.getuserbase())')/bin:/usr/lib/llvm-symbolizer-4.0/bin:$PATH"
# Build directory for Neovim. # Build directory for Neovim.
- BUILD_DIR="$TRAVIS_BUILD_DIR/build" - BUILD_DIR="$TRAVIS_BUILD_DIR/build"
# Build directory for third-party dependencies. # Build directory for third-party dependencies.
@@ -41,9 +36,7 @@ env:
- UBSAN_OPTIONS="print_stacktrace=1 log_path=$LOG_DIR/ubsan" - UBSAN_OPTIONS="print_stacktrace=1 log_path=$LOG_DIR/ubsan"
# Environment variables for Valgrind. # Environment variables for Valgrind.
- VALGRIND_LOG="$LOG_DIR/valgrind-%p.log" - VALGRIND_LOG="$LOG_DIR/valgrind-%p.log"
# Cache marker for third-party dependencies cache. # If this file exists, the cache is valid (compile was successful).
# If this file exists, we know that the cache contains compiled
# dependencies and we can use it.
- CACHE_MARKER="$HOME/.cache/nvim-deps/.travis_cache_marker" - CACHE_MARKER="$HOME/.cache/nvim-deps/.travis_cache_marker"
# default target name for functional tests # default target name for functional tests
- FUNCTIONALTEST=functionaltest - FUNCTIONALTEST=functionaltest
@@ -51,40 +44,42 @@ env:
jobs: jobs:
include: include:
- stage: sanitizers - stage: normal builds
os: linux os: linux
compiler: clang-4.0 compiler: clang
env: > env: >
CLANG_SANITIZER=ASAN_UBSAN CLANG_SANITIZER=ASAN_UBSAN
CMAKE_FLAGS="$CMAKE_FLAGS -DPREFER_LUA=ON" CMAKE_FLAGS="$CMAKE_FLAGS -DPREFER_LUA=ON"
sudo: true
- os: linux - os: linux
compiler: clang-4.0 compiler: gcc
env: CLANG_SANITIZER=TSAN env: >
- stage: normal builds FUNCTIONALTEST=functionaltest-lua
os: linux CMAKE_FLAGS="$CMAKE_FLAGS -DPREFER_LUA=ON"
compiler: gcc-5 DEPS_CMAKE_FLAGS="$DEPS_CMAKE_FLAGS -DUSE_BUNDLED_LUAJIT=OFF"
env: FUNCTIONALTEST=functionaltest-lua
- os: linux - os: linux
# Travis creates a cache per compiler. # Travis creates a cache per compiler. Set a different value here to
# Set a different value here to store 32-bit # store 32-bit dependencies in a separate cache.
# dependencies in a separate cache. compiler: gcc -m32
compiler: gcc-5 -m32
env: BUILD_32BIT=ON env: BUILD_32BIT=ON
- os: osx - os: osx
compiler: clang compiler: clang
osx_image: xcode7.3 # macOS 10.11 osx_image: xcode7.3 # macOS 10.11
- os: osx - os: osx
compiler: gcc-4.9 compiler: gcc
osx_image: xcode7.3 # macOS 10.11 osx_image: xcode7.3 # macOS 10.11
- stage: lint - os: linux
os: linux
env: CI_TARGET=lint env: CI_TARGET=lint
- stage: coverage - stage: Flaky builds
os: linux os: linux
compiler: gcc-5 compiler: gcc
env: GCOV=gcov-5 CMAKE_FLAGS="$CMAKE_FLAGS -DUSE_GCOV=ON" env: GCOV=gcov CMAKE_FLAGS="$CMAKE_FLAGS -DUSE_GCOV=ON"
- os: linux
compiler: clang
env: CLANG_SANITIZER=TSAN
allow_failures: allow_failures:
- env: GCOV=gcov-5 CMAKE_FLAGS="$CMAKE_FLAGS -DUSE_GCOV=ON" - env: GCOV=gcov CMAKE_FLAGS="$CMAKE_FLAGS -DUSE_GCOV=ON"
- env: CLANG_SANITIZER=TSAN
fast_finish: true fast_finish: true
before_install: ci/before_install.sh before_install: ci/before_install.sh
@@ -96,27 +91,22 @@ after_success: ci/after_success.sh
addons: addons:
apt: apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0
packages: packages:
- autoconf - autoconf
- automake - automake
- apport - apport
- build-essential - build-essential
- clang-4.0 - clang
- cmake - cmake
- cscope - cscope
- g++-5-multilib
- g++-multilib - g++-multilib
- gcc-5-multilib
- gcc-multilib - gcc-multilib
- gdb - gdb
- language-pack-tr - language-pack-tr
- libc6-dev-i386 - libc6-dev-i386
- libtool - libtool
- llvm-4.0-dev
- locales - locales
- ninja-build
- pkg-config - pkg-config
- unzip - unzip
- valgrind - valgrind
@@ -131,6 +121,7 @@ cache:
directories: directories:
- "$HOME/.cache/pip" - "$HOME/.cache/pip"
- "$HOME/.cache/nvim-deps" - "$HOME/.cache/nvim-deps"
- "$HOME/.cache/nvim-deps-downloads"
notifications: notifications:
webhooks: webhooks:

4
BSDmakefile Normal file
View File

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

View File

@@ -12,7 +12,11 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include(PreventInTreeBuilds) include(PreventInTreeBuilds)
# Prefer our bundled versions of dependencies. # Prefer our bundled versions of dependencies.
if(DEFINED ENV{DEPS_BUILD_DIR})
set(DEPS_PREFIX "$ENV{DEPS_BUILD_DIR}/usr" CACHE PATH "Path prefix for finding dependencies")
else()
set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/usr" CACHE PATH "Path prefix for finding dependencies") set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/usr" CACHE PATH "Path prefix for finding dependencies")
endif()
if(CMAKE_CROSSCOMPILING AND NOT UNIX) if(CMAKE_CROSSCOMPILING AND NOT UNIX)
list(INSERT CMAKE_FIND_ROOT_PATH 0 ${DEPS_PREFIX}) list(INSERT CMAKE_FIND_ROOT_PATH 0 ${DEPS_PREFIX})
list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX}/../host/bin) list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX}/../host/bin)
@@ -51,24 +55,24 @@ endif()
# Set default build type. # Set default build type.
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
message(STATUS "CMAKE_BUILD_TYPE not given, defaulting to 'Dev'.") message(STATUS "CMAKE_BUILD_TYPE not given, defaulting to 'Debug'.")
set(CMAKE_BUILD_TYPE "Dev" CACHE STRING "Choose the type of build." FORCE) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build." FORCE)
endif() endif()
# Set available build types for CMake GUIs. # Set available build types for CMake GUIs.
# A different build type can still be set by -DCMAKE_BUILD_TYPE=... # A different build type can still be set by -DCMAKE_BUILD_TYPE=...
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
STRINGS "Debug" "Dev" "Release" "MinSizeRel" "RelWithDebInfo") STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
# If not in a git repo (e.g., a tarball) these tokens define the complete # If not in a git repo (e.g., a tarball) these tokens define the complete
# version string, else they are combined with the result of `git describe`. # version string, else they are combined with the result of `git describe`.
set(NVIM_VERSION_MAJOR 0) set(NVIM_VERSION_MAJOR 0)
set(NVIM_VERSION_MINOR 2) set(NVIM_VERSION_MINOR 2)
set(NVIM_VERSION_PATCH 1) set(NVIM_VERSION_PATCH 3)
set(NVIM_VERSION_PRERELEASE "-dev") # for package maintainers set(NVIM_VERSION_PRERELEASE "-dev") # for package maintainers
# API level # API level
set(NVIM_API_LEVEL 3) # Bump this after any API change. set(NVIM_API_LEVEL 4) # 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 true) set(NVIM_API_PRERELEASE true)
@@ -107,46 +111,23 @@ if(NOT CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES DMIN_LOG_LEVEL)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DMIN_LOG_LEVEL=3") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DMIN_LOG_LEVEL=3")
endif() endif()
# Enable assertions for RelWithDebInfo. if(CMAKE_COMPILER_IS_GNUCC)
check_c_compiler_flag(-Og HAS_OG_FLAG)
else()
set(HAS_OG_FLAG 0)
endif()
#
# Build-type: RelWithDebInfo
#
if(HAS_OG_FLAG)
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -Og -g")
endif()
# We _want_ assertions in RelWithDebInfo build-type.
if(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES DNDEBUG) if(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES DNDEBUG)
string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
endif() endif()
# Set build flags for custom Dev build type.
# -DNDEBUG purposely omitted because we want assertions.
if(MSVC)
SET(CMAKE_C_FLAGS_DEV ""
CACHE STRING "Flags used by the compiler during development (optimized, but with debug info and logging) builds."
FORCE)
else()
if(CMAKE_COMPILER_IS_GNUCC)
check_c_compiler_flag(-Og HAS_OG_FLAG)
else()
set(HAS_OG_FLAG 0)
endif()
if(HAS_OG_FLAG)
set(CMAKE_C_FLAGS_DEV "-Og -g"
CACHE STRING "Flags used by the compiler during development (optimized, but with debug info and logging) builds."
FORCE)
else()
set(CMAKE_C_FLAGS_DEV "-O2 -g"
CACHE STRING "Flags used by the compiler during development (optimized, but with debug info and logging) builds."
FORCE)
endif()
endif()
SET(CMAKE_EXE_LINKER_FLAGS_DEV ""
CACHE STRING "Flags used for linking binaries during development (optimized, but with debug info and logging) builds."
FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS_DEV ""
CACHE STRING "Flags used by the shared libraries linker during development (optimized, but with debug info and logging) builds."
FORCE)
MARK_AS_ADVANCED(
CMAKE_C_FLAGS_DEV
CMAKE_EXE_LINKER_FLAGS_DEV
CMAKE_SHARED_LINKER_FLAGS_DEV)
# Enable -Wconversion. # Enable -Wconversion.
if(NOT MSVC) if(NOT MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion")
@@ -214,9 +195,20 @@ if(CMAKE_EXE_LINKER_FLAGS MATCHES "--sort-common" OR
string(REGEX REPLACE "-Wl($| )" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}") string(REGEX REPLACE "-Wl($| )" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
endif() endif()
check_c_source_compiles("
#include <execinfo.h>
int main(void)
{
void *trace[1];
int trace_size = backtrace(trace, 1);
return 0;
}
" HAVE_EXECINFO_BACKTRACE)
if(MSVC) if(MSVC)
# XXX: /W4 gives too many warnings. #3241 # XXX: /W4 gives too many warnings. #3241
add_definitions(/W3 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE) add_definitions(/W3 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
add_definitions(-DWIN32)
else() else()
add_definitions(-Wall -Wextra -pedantic -Wno-unused-parameter add_definitions(-Wall -Wextra -pedantic -Wno-unused-parameter
-Wstrict-prototypes -std=gnu99) -Wstrict-prototypes -std=gnu99)
@@ -236,6 +228,9 @@ endif()
if(MINGW) if(MINGW)
# Use POSIX compatible stdio in Mingw # Use POSIX compatible stdio in Mingw
add_definitions(-D__USE_MINGW_ANSI_STDIO) add_definitions(-D__USE_MINGW_ANSI_STDIO)
endif()
if(WIN32)
# Windows Vista is the minimum supported version
add_definitions(-D_WIN32_WINNT=0x0600) add_definitions(-D_WIN32_WINNT=0x0600)
endif() endif()
@@ -262,6 +257,18 @@ if(HAS_DIAG_COLOR_FLAG)
add_definitions(-fdiagnostics-color=auto) add_definitions(-fdiagnostics-color=auto)
endif() endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# 1. Array-bounds testing is broken in some GCC versions before 4.8.5.
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56273
# 2. But _Pragma("...ignored") is broken (unresolved) in GCC 5+:
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66099
# So we must disable -Warray-bounds globally for GCC (for kbtree.h, #7083).
check_c_compiler_flag(-Wno-array-bounds HAS_NO_ARRAY_BOUNDS_FLAG)
if(HAS_NO_ARRAY_BOUNDS_FLAG)
add_definitions(-Wno-array-bounds)
endif()
endif()
option(TRAVIS_CI_BUILD "Travis/QuickBuild CI. Extra flags will be set." OFF) option(TRAVIS_CI_BUILD "Travis/QuickBuild CI. Extra flags will be set." OFF)
if(TRAVIS_CI_BUILD) if(TRAVIS_CI_BUILD)
@@ -279,6 +286,8 @@ else()
set(DEBUG 0) set(DEBUG 0)
endif() endif()
option(LOG_LIST_ACTIONS "Add list actions logging" OFF)
add_definitions(-DINCLUDE_GENERATED_DECLARATIONS) add_definitions(-DINCLUDE_GENERATED_DECLARATIONS)
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_NAME STREQUAL "Linux") if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
@@ -338,7 +347,6 @@ main(void)
return MSGPACK_OBJECT_FLOAT32; return MSGPACK_OBJECT_FLOAT32;
} }
" MSGPACK_HAS_FLOAT32) " MSGPACK_HAS_FLOAT32)
if(MSGPACK_HAS_FLOAT32) if(MSGPACK_HAS_FLOAT32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNVIM_MSGPACK_HAS_FLOAT32") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNVIM_MSGPACK_HAS_FLOAT32")
endif() endif()
@@ -349,6 +357,21 @@ if(FEAT_TUI)
find_package(Unibilium REQUIRED) find_package(Unibilium REQUIRED)
include_directories(SYSTEM ${UNIBILIUM_INCLUDE_DIRS}) include_directories(SYSTEM ${UNIBILIUM_INCLUDE_DIRS})
list(APPEND CMAKE_REQUIRED_INCLUDES "${UNIBILIUM_INCLUDE_DIRS}")
list(APPEND CMAKE_REQUIRED_LIBRARIES "${UNIBILIUM_LIBRARIES}")
check_c_source_compiles("
#include <unibilium.h>
int
main(void)
{
return unibi_num_from_var(unibi_var_from_num(0));
}
" UNIBI_HAS_VAR_FROM)
if(UNIBI_HAS_VAR_FROM)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNVIM_UNIBI_HAS_VAR_FROM")
endif()
find_package(LibTermkey REQUIRED) find_package(LibTermkey REQUIRED)
include_directories(SYSTEM ${LIBTERMKEY_INCLUDE_DIRS}) include_directories(SYSTEM ${LIBTERMKEY_INCLUDE_DIRS})
endif() endif()
@@ -356,6 +379,11 @@ endif()
find_package(LibVterm REQUIRED) find_package(LibVterm REQUIRED)
include_directories(SYSTEM ${LIBVTERM_INCLUDE_DIRS}) include_directories(SYSTEM ${LIBVTERM_INCLUDE_DIRS})
if(WIN32)
find_package(Winpty REQUIRED)
include_directories(SYSTEM ${WINPTY_INCLUDE_DIRS})
endif()
option(CLANG_ASAN_UBSAN "Enable Clang address & undefined behavior sanitizer for nvim binary." OFF) option(CLANG_ASAN_UBSAN "Enable Clang address & undefined behavior sanitizer for nvim binary." OFF)
option(CLANG_MSAN "Enable Clang memory sanitizer for nvim binary." OFF) option(CLANG_MSAN "Enable Clang memory sanitizer for nvim binary." OFF)
option(CLANG_TSAN "Enable Clang thread sanitizer for nvim binary." OFF) option(CLANG_TSAN "Enable Clang thread sanitizer for nvim binary." OFF)
@@ -461,20 +489,19 @@ install_helper(
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
# MIN_LOG_LEVEL for log.h # MIN_LOG_LEVEL for log.h
if(DEFINED MIN_LOG_LEVEL) if("${MIN_LOG_LEVEL}" MATCHES "^$")
message(STATUS "MIN_LOG_LEVEL not specified")
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})
endif() endif()
message(STATUS "MIN_LOG_LEVEL set to ${MIN_LOG_LEVEL}") message(STATUS "MIN_LOG_LEVEL set to ${MIN_LOG_LEVEL}")
else()
message(STATUS "MIN_LOG_LEVEL not specified, defaulting to 1 (INFO)")
endif() endif()
# Go down the tree. # Go down the tree.
add_subdirectory(src/nvim) add_subdirectory(src/nvim)
# Read compilation flags from src/nvim, # Read compilation flags from src/nvim, used in config subdirectory below.
# used in config subdirectory below.
include(GetCompileFlags) include(GetCompileFlags)
get_compile_flags(NVIM_VERSION_CFLAGS) get_compile_flags(NVIM_VERSION_CFLAGS)
@@ -489,17 +516,6 @@ if(BUSTED_PRG)
get_property(TEST_INCLUDE_DIRS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} get_property(TEST_INCLUDE_DIRS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
PROPERTY INCLUDE_DIRECTORIES) PROPERTY INCLUDE_DIRECTORIES)
# Set policy CMP0026 to OLD so we avoid CMake warnings on newer
# versions of cmake.
if(POLICY CMP0026)
cmake_policy(SET CMP0026 OLD)
endif()
if(CMAKE_GENERATOR MATCHES "Visual Studio")
set(TEST_LIBNVIM_PATH ${CMAKE_BINARY_DIR}/lib/nvim-test.dll)
else()
get_target_property(TEST_LIBNVIM_PATH nvim-test LOCATION)
endif()
# When running tests from 'ninja' we need to use the # When running tests from 'ninja' we need to use the
# console pool: to do so we need to use the USES_TERMINAL # console pool: to do so we need to use the USES_TERMINAL
# option, but this is only available in CMake 3.2 # option, but this is only available in CMake 3.2
@@ -508,10 +524,6 @@ if(BUSTED_PRG)
list(APPEND TEST_TARGET_ARGS "USES_TERMINAL") list(APPEND TEST_TARGET_ARGS "USES_TERMINAL")
endif() endif()
configure_file(
test/config/paths.lua.in
${CMAKE_BINARY_DIR}/test/config/paths.lua)
set(UNITTEST_PREREQS nvim-test unittest-headers) set(UNITTEST_PREREQS nvim-test unittest-headers)
set(FUNCTIONALTEST_PREREQS nvim printargs-test shell-test) set(FUNCTIONALTEST_PREREQS nvim printargs-test shell-test)
if(NOT WIN32) if(NOT WIN32)
@@ -548,6 +560,32 @@ if(BUSTED_PRG)
message(WARNING "disabling unit tests: no Luajit FFI in ${LUA_PRG}") message(WARNING "disabling unit tests: no Luajit FFI in ${LUA_PRG}")
endif() endif()
if(${CMAKE_VERSION} VERSION_LESS 2.8.12)
if(CMAKE_GENERATOR MATCHES "Visual Studio")
set(TEST_LIBNVIM_PATH ${CMAKE_BINARY_DIR}/lib/nvim-test.dll)
else()
get_target_property(TEST_LIBNVIM_PATH nvim-test LOCATION)
endif()
configure_file(
${CMAKE_SOURCE_DIR}/test/config/paths.lua.in
${CMAKE_BINARY_DIR}/test/config/paths.lua)
else()
# To avoid duplicating paths.lua.in while we still support CMake < 2.8.12,
# use configure_file() to add the generator expression and then generate
# the final file
if(LUA_HAS_FFI)
set(TEST_LIBNVIM_PATH $<TARGET_FILE:nvim-test>)
else()
set(TEST_LIBNVIM_PATH "")
endif()
configure_file(
${CMAKE_SOURCE_DIR}/test/config/paths.lua.in
${CMAKE_BINARY_DIR}/test/config/paths.lua.gen)
file(GENERATE
OUTPUT ${CMAKE_BINARY_DIR}/test/config/paths.lua
INPUT ${CMAKE_BINARY_DIR}/test/config/paths.lua.gen)
endif()
add_custom_target(functionaltest add_custom_target(functionaltest
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
-DBUSTED_PRG=${BUSTED_PRG} -DBUSTED_PRG=${BUSTED_PRG}

View File

@@ -14,7 +14,7 @@ low-risk/isolated tasks:
Developer guidelines Developer guidelines
-------------------- --------------------
- Nvim developers should read `:help dev-help`. - Nvim developers should read `:help dev`.
- External UI developers should read `:help dev-ui`. - External UI developers should read `:help dev-ui`.
Reporting problems Reporting problems
@@ -24,9 +24,10 @@ Reporting problems
- Search [existing issues][github-issues] (including closed!) - Search [existing issues][github-issues] (including closed!)
- Update Neovim to the latest version to see if your problem persists. - Update Neovim to the latest version to see if your problem persists.
- Disable plugins incrementally, to narrow down the cause of the issue. - Disable plugins incrementally, to narrow down the cause of the issue.
- When reporting a crash, include a stacktrace. - When reporting a crash, [include a stacktrace](https://github.com/neovim/neovim/wiki/Development-tips#backtrace-linux).
- [Bisect][git-bisect] to the cause of a regression, if you are able. This is _extremely_ helpful. - [Bisect][git-bisect] to the cause of a regression, if you are able. This is _extremely_ helpful.
- Check `$NVIM_LOG_FILE`, if it exists. - Check `$NVIM_LOG_FILE`, if it exists.
- Include `cmake --system-information` for **build** issues.
Pull requests ("PRs") Pull requests ("PRs")
--------------------- ---------------------
@@ -91,11 +92,12 @@ and [AppVeyor].
- CI builds are compiled with [`-Werror`][gcc-warnings], so compiler warnings - CI builds are compiled with [`-Werror`][gcc-warnings], so compiler warnings
will fail the build. will fail the build.
- If any tests fail, the build will fail. - If any tests fail, the build will fail.
See [Building Neovim#running-tests][wiki-run-tests] to run tests locally. See [test/README.md#running-tests][run-tests] to run tests locally.
Passing locally doesn't guarantee passing the CI build, because of the Passing locally doesn't guarantee passing the CI build, because of the
different compilers and platforms tested against. different compilers and platforms tested against.
- CI runs [ASan] and other analyzers. To run valgrind locally: - CI runs [ASan] and other analyzers.
`VALGRIND=1 make test` - To run valgrind locally: `VALGRIND=1 make test`
- To run Clang ASan/UBSan locally: `CC=clang make CMAKE_FLAGS="-DCLANG_ASAN_UBSAN=ON"`
- The `lint` build ([#3174][3174]) checks modified lines _and their immediate - The `lint` build ([#3174][3174]) checks modified lines _and their immediate
neighbors_. This is to encourage incrementally updating the legacy style to neighbors_. This is to encourage incrementally updating the legacy style to
meet our style guidelines. meet our style guidelines.
@@ -166,7 +168,7 @@ as context, use the `-W` argument as well.
[hygiene]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html [hygiene]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[style-guide]: http://neovim.io/develop/style-guide.xml [style-guide]: http://neovim.io/develop/style-guide.xml
[ASan]: http://clang.llvm.org/docs/AddressSanitizer.html [ASan]: http://clang.llvm.org/docs/AddressSanitizer.html
[wiki-run-tests]: https://github.com/neovim/neovim/wiki/Building-Neovim#running-tests [run-tests]: https://github.com/neovim/neovim/blob/master/test/README.md#running-tests
[wiki-faq]: https://github.com/neovim/neovim/wiki/FAQ [wiki-faq]: https://github.com/neovim/neovim/wiki/FAQ
[review-checklist]: https://github.com/neovim/neovim/wiki/Code-review-checklist [review-checklist]: https://github.com/neovim/neovim/wiki/Code-review-checklist
[3174]: https://github.com/neovim/neovim/issues/3174 [3174]: https://github.com/neovim/neovim/issues/3174

View File

@@ -1,16 +1,19 @@
<!-- Before reporting: search existing issues and check the FAQ. -->
- `nvim --version`: - `nvim --version`:
- Vim (version: ) behaves differently? - Vim (version: ) behaves differently?
- Operating system/version: - Operating system/version:
- Terminal name/version: - Terminal name/version:
- `$TERM`: - `$TERM`:
### Actual behaviour
### Expected behaviour
### Steps to reproduce using `nvim -u NORC` ### Steps to reproduce using `nvim -u NORC`
``` ```
nvim -u NORC nvim -u NORC
``` ```
### Actual behaviour
### Expected behaviour

View File

@@ -1,3 +1,4 @@
THIS_DIR = $(shell pwd)
filter-false = $(strip $(filter-out 0 off OFF false FALSE,$1)) filter-false = $(strip $(filter-out 0 off OFF false FALSE,$1))
filter-true = $(strip $(filter-out 1 on ON true TRUE,$1)) filter-true = $(strip $(filter-out 1 on ON true TRUE,$1))
@@ -8,11 +9,14 @@ CMAKE_PRG ?= $(shell (command -v cmake3 || echo cmake))
CMAKE_BUILD_TYPE ?= Debug CMAKE_BUILD_TYPE ?= Debug
CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
DOC_DOWNLOAD_URL_BASE := https://raw.githubusercontent.com/neovim/doc/gh-pages
CLINT_ERRORS_FILE_PATH := /reports/clint/errors.json
BUILD_TYPE ?= $(shell (type ninja > /dev/null 2>&1 && echo "Ninja") || \ BUILD_TYPE ?= $(shell (type ninja > /dev/null 2>&1 && echo "Ninja") || \
echo "Unix Makefiles") echo "Unix Makefiles")
DEPS_BUILD_DIR ?= .deps
ifneq (1,$(words [$(DEPS_BUILD_DIR)]))
$(error DEPS_BUILD_DIR must not contain whitespace)
endif
ifeq (,$(BUILD_TOOL)) ifeq (,$(BUILD_TOOL))
ifeq (Ninja,$(BUILD_TYPE)) ifeq (Ninja,$(BUILD_TYPE))
@@ -48,7 +52,7 @@ endif
ifneq (,$(findstring functionaltest-lua,$(MAKECMDGOALS))) ifneq (,$(findstring functionaltest-lua,$(MAKECMDGOALS)))
BUNDLED_LUA_CMAKE_FLAG := -DUSE_BUNDLED_LUA=ON BUNDLED_LUA_CMAKE_FLAG := -DUSE_BUNDLED_LUA=ON
$(shell [ -x .deps/usr/bin/lua ] || rm build/.ran-*) $(shell [ -x $(DEPS_BUILD_DIR)/usr/bin/lua ] || rm build/.ran-*)
endif endif
# For use where we want to make sure only a single job is run. This does issue # For use where we want to make sure only a single job is run. This does issue
@@ -68,20 +72,20 @@ cmake:
$(MAKE) build/.ran-cmake $(MAKE) build/.ran-cmake
build/.ran-cmake: | deps build/.ran-cmake: | deps
cd build && $(CMAKE_PRG) -G '$(BUILD_TYPE)' $(CMAKE_FLAGS) $(CMAKE_EXTRA_FLAGS) .. cd build && $(CMAKE_PRG) -G '$(BUILD_TYPE)' $(CMAKE_FLAGS) $(CMAKE_EXTRA_FLAGS) $(THIS_DIR)
touch $@ touch $@
deps: | build/.ran-third-party-cmake deps: | build/.ran-third-party-cmake
ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),) ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),)
+$(BUILD_CMD) -C .deps +$(BUILD_CMD) -C $(DEPS_BUILD_DIR)
endif endif
build/.ran-third-party-cmake: build/.ran-third-party-cmake:
ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),) ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),)
mkdir -p .deps mkdir -p $(DEPS_BUILD_DIR)
cd .deps && \ cd $(DEPS_BUILD_DIR) && \
$(CMAKE_PRG) -G '$(BUILD_TYPE)' $(BUNDLED_CMAKE_FLAG) $(BUNDLED_LUA_CMAKE_FLAG) \ $(CMAKE_PRG) -G '$(BUILD_TYPE)' $(BUNDLED_CMAKE_FLAG) $(BUNDLED_LUA_CMAKE_FLAG) \
$(DEPS_CMAKE_FLAGS) ../third-party $(DEPS_CMAKE_FLAGS) $(THIS_DIR)/third-party
endif endif
mkdir -p build mkdir -p build
touch $@ touch $@
@@ -124,7 +128,7 @@ clean:
$(MAKE) -C runtime/doc clean $(MAKE) -C runtime/doc clean
distclean: clean distclean: clean
rm -rf .deps build rm -rf $(DEPS_BUILD_DIR) build
install: | nvim install: | nvim
+$(BUILD_CMD) -C build install +$(BUILD_CMD) -C build install
@@ -141,6 +145,11 @@ check-single-includes: build/.ran-cmake
appimage: appimage:
bash scripts/genappimage.sh bash scripts/genappimage.sh
# Build an appimage with embedded update information appimage-nightly for
# nightly builds or appimage-latest for a release
appimage-%:
bash scripts/genappimage.sh $*
lint: check-single-includes clint testlint lualint lint: check-single-includes clint testlint lualint
.PHONY: test testlint lualint functionaltest unittest lint clint clean distclean nvim libnvim cmake deps install appimage .PHONY: test testlint lualint functionaltest unittest lint clint clean distclean nvim libnvim cmake deps install appimage

View File

@@ -8,13 +8,13 @@
[![Travis Build Status](https://travis-ci.org/neovim/neovim.svg?branch=master)](https://travis-ci.org/neovim/neovim) [![Travis Build Status](https://travis-ci.org/neovim/neovim.svg?branch=master)](https://travis-ci.org/neovim/neovim)
[![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/urdqjrik5u521fac/branch/master?svg=true)](https://ci.appveyor.com/project/neovim/neovim/branch/master) [![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/urdqjrik5u521fac/branch/master?svg=true)](https://ci.appveyor.com/project/neovim/neovim/branch/master)
[![Coverage Status](https://img.shields.io/coveralls/neovim/neovim.svg)](https://coveralls.io/r/neovim/neovim) [![codecov](https://img.shields.io/codecov/c/github/neovim/neovim.svg)](https://codecov.io/gh/neovim/neovim)
[![Coverity Scan Build](https://scan.coverity.com/projects/2227/badge.svg)](https://scan.coverity.com/projects/2227) [![Coverity Scan Build](https://scan.coverity.com/projects/2227/badge.svg)](https://scan.coverity.com/projects/2227)
[![Clang Scan Build](https://neovim.io/doc/reports/clang/badge.svg)](https://neovim.io/doc/reports/clang) [![Clang Scan Build](https://neovim.io/doc/reports/clang/badge.svg)](https://neovim.io/doc/reports/clang)
[![PVS-studio Check](https://neovim.io/doc/reports/pvs/badge.svg)](https://neovim.io/doc/reports/pvs) [![PVS-studio Check](https://neovim.io/doc/reports/pvs/badge.svg)](https://neovim.io/doc/reports/pvs)
<a href="https://buildd.debian.org/neovim"><img src="https://www.debian.org/logos/openlogo-nd-25.png" width="13" height="15">Debian</a> [![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=2592000)](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/)
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:
@@ -34,6 +34,15 @@ Install from source
make CMAKE_BUILD_TYPE=RelWithDebInfo make CMAKE_BUILD_TYPE=RelWithDebInfo
sudo make install sudo make install
To install to a non-default location, set `CMAKE_INSTALL_PREFIX`:
make CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=/full/path/"
make install
To list all targets:
cmake --build build --target help
See [the wiki](https://github.com/neovim/neovim/wiki/Building-Neovim) for details. See [the wiki](https://github.com/neovim/neovim/wiki/Building-Neovim) for details.
Install from package Install from package
@@ -48,17 +57,24 @@ and [more](https://github.com/neovim/neovim/wiki/Installing-Neovim)!
Project layout Project layout
-------------- --------------
├─ ci/ Build server scripts ├─ ci/ build automation
├─ cmake/ Build scripts ├─ cmake/ build scripts
├─ runtime/ User plugins/docs ├─ runtime/ user plugins/docs
├─ src/ Source code ├─ src/ application source code (see src/nvim/README.md)
├─ third-party/ CMake subproject to build dependencies │ ├─ api/ API subsystem
└─ test/ Test code │ ├─ eval/ VimL subsystem
│ ├─ event/ event-loop subsystem
│ ├─ generators/ code generation (pre-compilation)
│ ├─ lib/ generic data structures
│ ├─ lua/ lua subsystem
│ ├─ msgpack_rpc/ RPC subsystem
│ ├─ os/ low-level platform code
│ └─ tui/ built-in UI
├─ third-party/ cmake subproject to build dependencies
└─ test/ tests (see test/README.md)
- `third-party/` is activated if `USE_BUNDLED_DEPS` is undefined or the - To disable `third-party/` specify `USE_BUNDLED_DEPS=NO` or `USE_BUNDLED=NO`
`USE_BUNDLED` CMake option is true. (CMake option).
- [Source README](src/nvim/README.md)
- [Test README](test/README.md)
Features Features
-------- --------

View File

@@ -1,12 +1,23 @@
version: '{build}' version: '{build}'
environment:
APPVEYOR_CACHE_ENTRY_ZIP_ARGS: "-t7z -m0=lzma -mx=9"
image: Visual Studio 2017
configuration: configuration:
- MSVC_64
- MSVC_32
- MINGW_64 - MINGW_64
- MINGW_32 - MINGW_32
- MINGW_64-gcov
matrix:
allow_failures:
- configuration: MINGW_64-gcov
install: [] install: []
before_build:
- ps: Install-Product node 8
build_script: build_script:
- call ci\build.bat - powershell ci\build.ps1
cache: cache:
- C:\msys64\var\cache\pacman\pkg -> ci\build.bat - C:\msys64\var\cache\pacman\pkg -> ci\build.ps1
- .deps -> third-party\** - .deps -> third-party\**
artifacts: artifacts:
- path: build/Neovim.zip - path: build/Neovim.zip

View File

@@ -0,0 +1,92 @@
-- TODO(jkeyes): remove this and use the upstream version as soon as it is
-- available in a release of busted.
local pretty = require 'pl.pretty'
return function(options)
local busted = require 'busted'
local handler = require 'busted.outputHandlers.base'()
local success = 'ok %u - %s'
local failure = 'not ' .. success
local skip = 'ok %u - # SKIP %s'
local counter = 0
handler.suiteReset = function()
counter = 0
return nil, true
end
handler.suiteEnd = function()
print('1..' .. counter)
io.flush()
return nil, true
end
local function showFailure(t)
local message = t.message
local trace = t.trace or {}
if message == nil then
message = 'Nil error'
elseif type(message) ~= 'string' then
message = pretty.write(message)
end
print(failure:format(counter, t.name))
print('# ' .. t.element.trace.short_src .. ' @ ' .. t.element.trace.currentline)
if t.randomseed then print('# Random seed: ' .. t.randomseed) end
print('# Failure message: ' .. message:gsub('\n', '\n# '))
if options.verbose and trace.traceback then
print('# ' .. trace.traceback:gsub('^\n', '', 1):gsub('\n', '\n# '))
end
end
handler.testStart = function(element, parent)
local trace = element.trace
if options.verbose and trace and trace.short_src then
local fileline = trace.short_src .. ' @ ' .. trace.currentline .. ': '
local testName = fileline .. handler.getFullName(element)
print('# ' .. testName)
end
io.flush()
return nil, true
end
handler.testEnd = function(element, parent, status, trace)
counter = counter + 1
if status == 'success' then
local t = handler.successes[#handler.successes]
print(success:format(counter, t.name))
elseif status == 'pending' then
local t = handler.pendings[#handler.pendings]
print(skip:format(counter, (t.message or t.name)))
elseif status == 'failure' then
showFailure(handler.failures[#handler.failures])
elseif status == 'error' then
showFailure(handler.errors[#handler.errors])
end
io.flush()
return nil, true
end
handler.error = function(element, parent, message, debug)
if element.descriptor ~= 'it' then
counter = counter + 1
showFailure(handler.errors[#handler.errors])
end
io.flush()
return nil, true
end
busted.subscribe({ 'suite', 'reset' }, handler.suiteReset)
busted.subscribe({ 'suite', 'end' }, handler.suiteEnd)
busted.subscribe({ 'test', 'start' }, handler.testStart, { predicate = handler.cancelOnPending })
busted.subscribe({ 'test', 'end' }, handler.testEnd, { predicate = handler.cancelOnPending })
busted.subscribe({ 'error' }, handler.error)
return handler
end

View File

@@ -1,8 +0,0 @@
#!/usr/bin/env bash
set -e
set -o pipefail
if [[ -n "${GCOV}" ]]; then
coveralls --gcov "$(which "${GCOV}")" --encoding iso-8859-1 || echo 'coveralls upload failed.'
fi

View File

@@ -4,16 +4,24 @@ set -e
set -o pipefail set -o pipefail
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/suite.sh" source "${CI_DIR}/common/suite.sh"
# Don't cache pip's log and selfcheck. # Don't cache pip's log and selfcheck.
rm -rf "${HOME}/.cache/pip/log" rm -rf "${HOME}/.cache/pip/log"
rm -f "${HOME}/.cache/pip/selfcheck.json" rm -f "${HOME}/.cache/pip/selfcheck.json"
echo "before_cache.sh: cache size"
du -d 2 "${HOME}/.cache" | sort -n
# Update the third-party dependency cache only if the build was successful. # Update the third-party dependency cache only if the build was successful.
if ended_successfully; then if ended_successfully; then
rm -rf "${HOME}/.cache/nvim-deps" rm -rf "${HOME}/.cache/nvim-deps"
mv "${DEPS_BUILD_DIR}" "${HOME}/.cache/nvim-deps" mv "${DEPS_BUILD_DIR}" "${HOME}/.cache/nvim-deps"
rm -rf "${HOME}/.cache/nvim-deps-downloads"
mv "${DEPS_DOWNLOAD_DIR}" "${HOME}/.cache/nvim-deps-downloads"
touch "${CACHE_MARKER}" touch "${CACHE_MARKER}"
echo "Updated third-party dependencies (timestamp: $(stat -c '%y' "${CACHE_MARKER}"))." echo "Updated third-party dependencies (timestamp: $(_stat "${CACHE_MARKER}"))."
fi fi

View File

@@ -11,15 +11,38 @@ if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
brew update brew update
fi fi
echo "Upgrade Python 2 pip." echo 'python info:'
pip2.7 -q install --user --upgrade pip (
2>&1 python --version || true
2>&1 python2 --version || true
2>&1 python3 --version || true
2>&1 pip --version || true
2>&1 pip2 --version || true
2>&1 pip3 --version || true
echo 'pyenv versions:'
2>&1 pyenv versions || true
) | sed 's/^/ /'
if [[ "${TRAVIS_OS_NAME}" == osx ]]; then if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
echo "Install Python 3." echo "Upgrade Python 3."
brew install python3 brew upgrade python
echo "Upgrade Python 3 pip." echo "Upgrade Python 3 pip."
pip3 -q install --user --upgrade pip pip3 -q install --user --upgrade pip
else else
echo "Upgrade Python 2 pip."
pip2.7 -q install --user --upgrade pip
echo "Upgrade Python 3 pip." echo "Upgrade Python 3 pip."
pip3 -q install --user --upgrade pip # Allow failure. pyenv pip3 on travis is broken:
# https://github.com/travis-ci/travis-ci/issues/8363
pip3 -q install --user --upgrade pip || true
fi fi
echo "Install node (LTS)"
if [[ "${TRAVIS_OS_NAME}" == osx ]] || [ ! -f ~/.nvm/nvm.sh ]; then
curl -o ~/.nvm/nvm.sh https://raw.githubusercontent.com/creationix/nvm/master/nvm.sh
fi
source ~/.nvm/nvm.sh
nvm install --lts
nvm use --lts

View File

@@ -1,54 +0,0 @@
:: These are native MinGW builds, but they use the toolchain inside
:: MSYS2, this allows using all the dependencies and tools available
:: in MSYS2, but we cannot build inside the MSYS2 shell.
echo on
if "%CONFIGURATION%" == "MINGW_32" (
set ARCH=i686
set BITS=32
) else (
set ARCH=x86_64
set BITS=64
)
:: We cannot have sh.exe in the PATH (MinGW)
set PATH=%PATH:C:\Program Files\Git\usr\bin;=%
set PATH=C:\msys64\mingw%BITS%\bin;C:\Windows\System32;C:\Windows;%PATH%
:: The default cpack in the PATH is not CMake
set PATH=C:\Program Files (x86)\CMake\bin\cpack.exe;%PATH%
:: Build third-party dependencies
C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm -Su" || goto :error
C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm --needed -S mingw-w64-%ARCH%-cmake mingw-w64-%ARCH%-perl mingw-w64-%ARCH%-diffutils mingw-w64-%ARCH%-unibilium gperf" || goto :error
:: Setup python (use AppVeyor system python)
C:\Python27\python.exe -m pip install neovim || goto :error
C:\Python35\python.exe -m pip install neovim || goto :error
:: Disambiguate python3
move c:\Python35\python.exe c:\Python35\python3.exe
set PATH=C:\Python35;C:\Python27;%PATH%
:: Sanity check
python -c "import neovim; print(str(neovim))" || goto :error
python3 -c "import neovim; print(str(neovim))" || goto :error
mkdir .deps
cd .deps
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo ..\third-party\ || goto :error
mingw32-make VERBOSE=1 || goto :error
cd ..
:: Build Neovim
mkdir build
cd build
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUSTED_OUTPUT_TYPE=nvim -DGPERF_PRG="C:\msys64\usr\bin\gperf.exe" .. || goto :error
mingw32-make VERBOSE=1 || goto :error
bin\nvim --version || goto :error
:: Functional tests
mingw32-make functionaltest VERBOSE=1 || goto :error
:: Build artifacts
cpack -G ZIP -C RelWithDebInfo
if defined APPVEYOR_REPO_TAG_NAME cpack -G NSIS -C RelWithDebInfo
goto :EOF
:error
exit /b %errorlevel%

123
ci/build.ps1 Normal file
View File

@@ -0,0 +1,123 @@
Set-PSDebug -Trace 1
$env:CONFIGURATION -match '^(?<compiler>\w+)_(?<bits>32|64)(?:-(?<option>\w+))?$'
$compiler = $Matches.compiler
$compileOption = $Matches.option
$bits = $Matches.bits
$cmakeBuildType = 'RelWithDebInfo'
$depsCmakeVars = @{
CMAKE_BUILD_TYPE = $cmakeBuildType;
}
$nvimCmakeVars = @{
CMAKE_BUILD_TYPE = $cmakeBuildType;
BUSTED_OUTPUT_TYPE = 'nvim';
}
function exitIfFailed() {
if ($LastExitCode -ne 0) {
exit $LastExitCode
}
}
if ($compiler -eq 'MINGW') {
if ($bits -eq 32) {
$arch = 'i686'
}
elseif ($bits -eq 64) {
$arch = 'x86_64'
}
if ($compileOption -eq 'gcov') {
$nvimCmakeVars['USE_GCOV'] = 'ON'
$uploadToCodecov = $true
}
# These are native MinGW builds, but they use the toolchain inside
# MSYS2, this allows using all the dependencies and tools available
# in MSYS2, but we cannot build inside the MSYS2 shell.
$cmakeGenerator = 'MinGW Makefiles'
$cmakeGeneratorArgs = 'VERBOSE=1'
# Add MinGW to the PATH
$env:PATH = "C:\msys64\mingw$bits\bin;$env:PATH"
# Build third-party dependencies
C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm -Su" ; exitIfFailed
C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm --needed -S mingw-w64-$arch-cmake mingw-w64-$arch-perl mingw-w64-$arch-diffutils mingw-w64-$arch-unibilium" ; exitIfFailed
}
elseif ($compiler -eq 'MSVC') {
$cmakeGeneratorArgs = '/verbosity:normal'
if ($bits -eq 32) {
$cmakeGenerator = 'Visual Studio 15 2017'
}
elseif ($bits -eq 64) {
$cmakeGenerator = 'Visual Studio 15 2017 Win64'
}
}
# Remove Git Unix utilities from the PATH
$env:PATH = $env:PATH.Replace('C:\Program Files\Git\usr\bin', '')
# Setup python (use AppVeyor system python)
C:\Python27\python.exe -m pip install neovim ; exitIfFailed
C:\Python35\python.exe -m pip install neovim ; exitIfFailed
# Disambiguate python3
move c:\Python35\python.exe c:\Python35\python3.exe
$env:PATH = "C:\Python35;C:\Python27;$env:PATH"
# Sanity check
python -c "import neovim; print(str(neovim))" ; exitIfFailed
python3 -c "import neovim; print(str(neovim))" ; exitIfFailed
$env:PATH = "C:\Ruby24\bin;$env:PATH"
cmd /c gem.cmd install neovim ; exitIfFailed
where.exe neovim-ruby-host.bat ; exitIfFailed
cmd /c npm.cmd install -g neovim ; exitIfFailed
where.exe neovim-node-host.cmd ; exitIfFailed
function convertToCmakeArgs($vars) {
return $vars.GetEnumerator() | foreach { "-D$($_.Key)=$($_.Value)" }
}
mkdir .deps
cd .deps
cmake -G $cmakeGenerator $(convertToCmakeArgs($depsCmakeVars)) ..\third-party\ ; exitIfFailed
cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed
cd ..
# Build Neovim
mkdir build
cd build
cmake -G $cmakeGenerator $(convertToCmakeArgs($nvimCmakeVars)) .. ; exitIfFailed
cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed
bin\nvim --version ; exitIfFailed
# Functional tests
# The $LastExitCode from MSBuild can't be trusted
$failed = $false
# Temporarily turn off tracing to reduce log file output
Set-PSDebug -Off
cmake --build . --config $cmakeBuildType --target functionaltest -- $cmakeGeneratorArgs |
foreach { $failed = $failed -or
$_ -match 'Running functional tests failed with error'; $_ }
Set-PSDebug -Trace 1
if ($failed) {
exit $LastExitCode
}
if ($uploadToCodecov) {
C:\msys64\usr\bin\bash -lc "cd /c/projects/neovim; bash <(curl -s https://codecov.io/bash) -c -F functionaltest || echo 'codecov upload failed.'"
}
# Old tests
$env:PATH += ';C:\msys64\usr\bin'
& "C:\msys64\mingw$bits\bin\mingw32-make.exe" -C $(Convert-Path ..\src\nvim\testdir) VERBOSE=1
if ($uploadToCodecov) {
C:\msys64\usr\bin\bash -lc "cd /c/projects/neovim; bash <(curl -s https://codecov.io/bash) -c -F oldtest || echo 'codecov upload failed.'"
}
# Build artifacts
cpack -G ZIP -C RelWithDebInfo
if ($env:APPVEYOR_REPO_TAG_NAME -ne $null) {
cpack -G NSIS -C RelWithDebInfo
}

View File

@@ -1,5 +1,16 @@
_stat() {
if test "${TRAVIS_OS_NAME}" = osx ; then
stat -f %Sm "${@}"
else
stat -c %y "${@}"
fi
}
top_make() { top_make() {
${MAKE_CMD} "$@" echo '================================================================================'
# Travis has 1.5 virtual cores according to:
# http://docs.travis-ci.com/user/speeding-up-the-build/#Paralellizing-your-build-on-one-VM
ninja "$@"
} }
build_make() { build_make() {
@@ -15,28 +26,21 @@ build_deps() {
DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} -DUSE_BUNDLED_LUA=ON" DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} -DUSE_BUNDLED_LUA=ON"
fi fi
rm -rf "${DEPS_BUILD_DIR}" mkdir -p "${DEPS_BUILD_DIR}"
mkdir -p "${DEPS_DOWNLOAD_DIR}"
# If there is a valid cache and we're not forced to recompile, # Use cached dependencies if $CACHE_MARKER exists.
# use cached third-party dependencies. if test -f "${CACHE_MARKER}" && ! test "${CACHE_ENABLE}" = "false" ; then
if test -f "${CACHE_MARKER}" && test "${BUILD_NVIM_DEPS}" != "true" ; then echo "Using third-party dependencies from Travis cache (last update: $(_stat "${CACHE_MARKER}"))."
local statcmd="stat -c '%y'" cp -r "${HOME}/.cache/nvim-deps" "${DEPS_BUILD_DIR}"
if test "${TRAVIS_OS_NAME}" = osx ; then cp -r "${HOME}/.cache/nvim-deps-downloads" "${DEPS_DOWNLOAD_DIR}"
statcmd="stat -f '%Sm'"
fi
echo "Using third-party dependencies from Travis's cache (last updated: $(${statcmd} "${CACHE_MARKER}"))."
mkdir -p "$(dirname "${DEPS_BUILD_DIR}")"
mv "${HOME}/.cache/nvim-deps" "${DEPS_BUILD_DIR}"
else
mkdir -p "${DEPS_BUILD_DIR}"
fi fi
# Even if we're using cached dependencies, run CMake and make to # Even if we're using cached dependencies, run CMake and make to
# update CMake configuration and update to newer deps versions. # update CMake configuration and update to newer deps versions.
cd "${DEPS_BUILD_DIR}" cd "${DEPS_BUILD_DIR}"
echo "Configuring with '${DEPS_CMAKE_FLAGS}'." echo "Configuring with '${DEPS_CMAKE_FLAGS}'."
CC= cmake ${DEPS_CMAKE_FLAGS} "${TRAVIS_BUILD_DIR}/third-party/" CC= cmake -G Ninja ${DEPS_CMAKE_FLAGS} "${TRAVIS_BUILD_DIR}/third-party/"
if ! top_make; then if ! top_make; then
exit 1 exit 1
@@ -56,7 +60,7 @@ prepare_build() {
mkdir -p "${BUILD_DIR}" mkdir -p "${BUILD_DIR}"
cd "${BUILD_DIR}" cd "${BUILD_DIR}"
echo "Configuring with '${CMAKE_FLAGS} $@'." echo "Configuring with '${CMAKE_FLAGS} $@'."
cmake ${CMAKE_FLAGS} "$@" "${TRAVIS_BUILD_DIR}" cmake -G Ninja ${CMAKE_FLAGS} "$@" "${TRAVIS_BUILD_DIR}"
} }
build_nvim() { build_nvim() {
@@ -71,9 +75,11 @@ build_nvim() {
exit 1 exit 1
fi fi
echo "Building nvim-test." if test "${FUNCTIONALTEST}" != "functionaltest-lua"; then
if ! top_make nvim-test ; then echo "Building nvim-test."
exit 1 if ! top_make nvim-test ; then
exit 1
fi
fi fi
fi fi
@@ -87,3 +93,12 @@ 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

@@ -1,6 +1,15 @@
. "${CI_DIR}/common/build.sh" . "${CI_DIR}/common/build.sh"
. "${CI_DIR}/common/suite.sh" . "${CI_DIR}/common/suite.sh"
submit_coverage() {
if [ -n "${GCOV}" ]; then
if curl --fail --output codecov.bash --silent https://codecov.io/bash; then
bash codecov.bash -c -F "$1" || echo "codecov upload failed."
rm -f codecov.bash
fi
fi
}
print_core() { print_core() {
local app="$1" local app="$1"
local core="$2" local core="$2"
@@ -71,7 +80,9 @@ valgrind_check() {
} }
asan_check() { asan_check() {
check_logs "${1}" "*san.*" if test "${CLANG_SANITIZER}" = "ASAN_UBSAN" ; then
check_logs "${1}" "*san.*" | asan_symbolize
fi
} }
run_unittests() {( run_unittests() {(
@@ -80,6 +91,7 @@ run_unittests() {(
if ! build_make unittest ; then if ! build_make unittest ; then
fail 'unittests' F 'Unit tests failed' fail 'unittests' F 'Unit tests failed'
fi fi
submit_coverage unittest
check_core_dumps "$(which luajit)" check_core_dumps "$(which luajit)"
exit_suite exit_suite
)} )}
@@ -90,6 +102,7 @@ run_functionaltests() {(
if ! build_make ${FUNCTIONALTEST}; then if ! build_make ${FUNCTIONALTEST}; then
fail 'functionaltests' F 'Functional tests failed' fail 'functionaltests' F 'Functional tests failed'
fi fi
submit_coverage functionaltest
asan_check "${LOG_DIR}" asan_check "${LOG_DIR}"
valgrind_check "${LOG_DIR}" valgrind_check "${LOG_DIR}"
check_core_dumps check_core_dumps
@@ -103,6 +116,7 @@ run_oldtests() {(
reset reset
fail 'oldtests' F 'Legacy tests failed' fail 'oldtests' F 'Legacy tests failed'
fi fi
submit_coverage oldtest
asan_check "${LOG_DIR}" asan_check "${LOG_DIR}"
valgrind_check "${LOG_DIR}" valgrind_check "${LOG_DIR}"
check_core_dumps check_core_dumps

View File

@@ -8,16 +8,26 @@ if [[ "${CI_TARGET}" == lint ]]; then
fi fi
if [[ "${TRAVIS_OS_NAME}" == osx ]]; then if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
brew install ninja
brew install gettext brew install gettext
brew reinstall -s libtool brew reinstall -s libtool
fi fi
# Use default CC to avoid compilation problems when installing Python modules.
echo "Install neovim module and coveralls for Python 2."
CC=cc pip2.7 -q install --user --upgrade neovim cpp-coveralls
echo "Install neovim module for Python 3." echo "Install neovim module for Python 3."
CC=cc pip3 -q install --user --upgrade neovim # Allow failure. pyenv pip3 on travis is broken:
# https://github.com/travis-ci/travis-ci/issues/8363
CC=cc pip3 -q install --user --upgrade neovim || true
echo "Install neovim RubyGem." if ! [ "${TRAVIS_OS_NAME}" = osx ] ; then
gem install --no-document --version ">= 0.2.0" neovim # Update PATH for pip.
export PATH="$(python2.7 -c 'import site; print(site.getuserbase())')/bin:$PATH"
# Use default CC to avoid compilation problems when installing Python modules.
echo "Install neovim module for Python 2."
CC=cc pip2.7 -q install --user --upgrade neovim
echo "Install neovim RubyGem."
gem install --no-document --version ">= 0.2.0" neovim
fi
echo "Install neovim npm package"
npm install -g neovim

View File

@@ -10,19 +10,19 @@ source "${CI_DIR}/common/suite.sh"
enter_suite 'clint' enter_suite 'clint'
run_test 'top_make clint-full' clint run_test 'make clint-full' clint
exit_suite --continue exit_suite --continue
enter_suite 'testlint' enter_suite 'testlint'
run_test 'top_make testlint' testlint run_test 'make testlint' testlint
exit_suite --continue exit_suite --continue
enter_suite 'lualint' enter_suite 'lualint'
run_test 'top_make lualint' lualint run_test 'make lualint' lualint
exit_suite --continue exit_suite --continue
@@ -31,7 +31,7 @@ enter_suite single-includes
CLICOLOR_FORCE=1 run_test_wd \ CLICOLOR_FORCE=1 run_test_wd \
--allow-hang \ --allow-hang \
10s \ 10s \
'top_make check-single-includes' \ 'make check-single-includes' \
'csi_clean' \ 'csi_clean' \
single-includes single-includes

View File

@@ -22,7 +22,9 @@ enter_suite tests
if test "$CLANG_SANITIZER" != "TSAN" ; then if test "$CLANG_SANITIZER" != "TSAN" ; then
# Additional threads are only created when the builtin UI starts, which # Additional threads are only created when the builtin UI starts, which
# doesn't happen in the unit/functional tests # doesn't happen in the unit/functional tests
run_test run_unittests if test "${FUNCTIONALTEST}" != "functionaltest-lua"; then
run_test run_unittests
fi
run_test run_functionaltests run_test run_functionaltests
fi fi
run_test run_oldtests run_test run_oldtests

View File

@@ -27,6 +27,9 @@ find_path(JEMALLOC_INCLUDE_DIR jemalloc/jemalloc.h
if(JEMALLOC_USE_STATIC) if(JEMALLOC_USE_STATIC)
list(APPEND JEMALLOC_NAMES list(APPEND JEMALLOC_NAMES
"${CMAKE_STATIC_LIBRARY_PREFIX}jemalloc${CMAKE_STATIC_LIBRARY_SUFFIX}") "${CMAKE_STATIC_LIBRARY_PREFIX}jemalloc${CMAKE_STATIC_LIBRARY_SUFFIX}")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
list(INSERT JEMALLOC_NAMES 0
"${CMAKE_STATIC_LIBRARY_PREFIX}jemalloc${CMAKE_STATIC_LIBRARY_SUFFIX}")
endif() endif()
list(APPEND JEMALLOC_NAMES jemalloc) list(APPEND JEMALLOC_NAMES jemalloc)

View File

@@ -27,7 +27,7 @@ find_path(LibIntl_INCLUDE_DIR
) )
find_library(LibIntl_LIBRARY find_library(LibIntl_LIBRARY
NAMES intl libintl.a NAMES intl libintl
) )
if (LibIntl_INCLUDE_DIR) if (LibIntl_INCLUDE_DIR)
@@ -46,6 +46,7 @@ check_c_source_compiles("
int main(int argc, char** argv) { int main(int argc, char** argv) {
gettext(\"foo\"); gettext(\"foo\");
ngettext(\"foo\", \"bar\", 1);
bindtextdomain(\"foo\", \"bar\"); bindtextdomain(\"foo\", \"bar\");
bind_textdomain_codeset(\"foo\", \"bar\"); bind_textdomain_codeset(\"foo\", \"bar\");
textdomain(\"foo\"); textdomain(\"foo\");

View File

@@ -44,7 +44,7 @@ endif()
if(MSVC) if(MSVC)
# The import library for the msgpack DLL has a different name # The import library for the msgpack DLL has a different name
list(APPEND MSGPACK_NAMES msgpack_import) list(APPEND MSGPACK_NAMES msgpackc_import)
else() else()
list(APPEND MSGPACK_NAMES msgpackc msgpack) list(APPEND MSGPACK_NAMES msgpackc msgpack)
endif() endif()

10
cmake/FindWinpty.cmake Normal file
View File

@@ -0,0 +1,10 @@
include(LibFindMacros)
find_path(WINPTY_INCLUDE_DIR winpty.h)
set(WINPTY_INCLUDE_DIRS ${WINPTY_INCLUDE_DIR})
find_library(WINPTY_LIBRARY winpty)
find_program(WINPTY_AGENT_EXE winpty-agent.exe)
set(WINPTY_LIBRARIES ${WINPTY_LIBRARY})
find_package_handle_standard_args(Winpty DEFAULT_MSG WINPTY_LIBRARY WINPTY_INCLUDE_DIR)

View File

@@ -38,6 +38,7 @@ function(get_compile_flags _compile_flags)
get_directory_property(include_directories_list get_directory_property(include_directories_list
DIRECTORY "src/nvim" DIRECTORY "src/nvim"
INCLUDE_DIRECTORIES) INCLUDE_DIRECTORIES)
list(REMOVE_DUPLICATES include_directories_list)
foreach(include_directory ${include_directories_list}) foreach(include_directory ${include_directories_list})
set(include_directories "${include_directories} -I${include_directory}") set(include_directories "${include_directories} -I${include_directory}")
endforeach() endforeach()

View File

@@ -2,8 +2,8 @@
if(CMAKE_SYSTEM_NAME MATCHES "BSD" AND NOT DEFINED CMAKE_INSTALL_MANDIR) if(CMAKE_SYSTEM_NAME MATCHES "BSD" AND NOT DEFINED CMAKE_INSTALL_MANDIR)
if(DEFINED ENV{MANPREFIX}) if(DEFINED ENV{MANPREFIX})
set(CMAKE_INSTALL_MANDIR "$ENV{MANPREFIX}/man") set(CMAKE_INSTALL_MANDIR "$ENV{MANPREFIX}/man")
else() elseif(CMAKE_INSTALL_PREFIX MATCHES "^/usr/local$")
set(CMAKE_INSTALL_MANDIR "/usr/local/man") set(CMAKE_INSTALL_MANDIR "man")
endif() endif()
endif() endif()

View File

@@ -4,9 +4,8 @@
# Check if a module is available in Lua # Check if a module is available in Lua
function(check_lua_module LUA_PRG_PATH MODULE RESULT_VAR) function(check_lua_module LUA_PRG_PATH MODULE RESULT_VAR)
execute_process(COMMAND ${LUA_PRG_PATH} -e "require('${MODULE}')" execute_process(COMMAND ${LUA_PRG_PATH} -l "${MODULE}" -e ""
RESULT_VARIABLE module_missing RESULT_VARIABLE module_missing)
ERROR_QUIET)
if(module_missing) if(module_missing)
set(${RESULT_VAR} False PARENT_SCOPE) set(${RESULT_VAR} False PARENT_SCOPE)
else() else()

View File

@@ -1,3 +1,6 @@
# Set LC_ALL to meet expectations of some locale-sensitive tests.
set(ENV{LC_ALL} "en_US.UTF-8")
set(ENV{VIMRUNTIME} ${WORKING_DIR}/runtime) set(ENV{VIMRUNTIME} ${WORKING_DIR}/runtime)
set(ENV{NVIM_RPLUGIN_MANIFEST} ${WORKING_DIR}/Xtest_rplugin_manifest) set(ENV{NVIM_RPLUGIN_MANIFEST} ${WORKING_DIR}/Xtest_rplugin_manifest)
set(ENV{XDG_CONFIG_HOME} ${WORKING_DIR}/Xtest_xdg/config) set(ENV{XDG_CONFIG_HOME} ${WORKING_DIR}/Xtest_xdg/config)
@@ -35,7 +38,7 @@ set(ENV{SYSTEM_NAME} ${SYSTEM_NAME})
execute_process( execute_process(
COMMAND ${BUSTED_PRG} ${TEST_TAG} ${TEST_FILTER} -v -o ${BUSTED_OUTPUT_TYPE} COMMAND ${BUSTED_PRG} ${TEST_TAG} ${TEST_FILTER} -v -o ${BUSTED_OUTPUT_TYPE}
--lua=${LUA_PRG} --lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua --lua=${LUA_PRG} --lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua
--lpath=${BUILD_DIR}/?.lua ${TEST_PATH} --lpath=${BUILD_DIR}/?.lua --lpath=?.lua ${TEST_PATH}
WORKING_DIRECTORY ${WORKING_DIR} WORKING_DIRECTORY ${WORKING_DIR}
ERROR_VARIABLE err ERROR_VARIABLE err
RESULT_VARIABLE res RESULT_VARIABLE res

27
codecov.yml Normal file
View File

@@ -0,0 +1,27 @@
codecov:
notify:
require_ci_to_pass: no
ci:
- appveyor
- travis
- !neovim-qb.szakmeister.net
coverage:
precision: 2
round: down
range: "70...100"
status:
project: yes
patch: yes
changes: no
parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no
comment: off

View File

@@ -12,6 +12,11 @@ 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")
# Windows Subsystem for Linux
set(HAVE_WSL 1)
endif()
check_symbol_exists(_NSGetEnviron crt_externs.h HAVE__NSGETENVIRON) check_symbol_exists(_NSGetEnviron crt_externs.h HAVE__NSGETENVIRON)
# Headers # Headers

View File

@@ -48,6 +48,7 @@
#cmakedefine HAVE_UTIME_H #cmakedefine HAVE_UTIME_H
#cmakedefine HAVE_UTIMES #cmakedefine HAVE_UTIMES
#cmakedefine HAVE_WORKING_LIBINTL #cmakedefine HAVE_WORKING_LIBINTL
#cmakedefine HAVE_WSL
#cmakedefine UNIX #cmakedefine UNIX
#cmakedefine USE_FNAME_CASE #cmakedefine USE_FNAME_CASE
#cmakedefine HAVE_SYS_UIO_H #cmakedefine HAVE_SYS_UIO_H
@@ -62,10 +63,13 @@
#ifndef UNIT_TESTING #ifndef UNIT_TESTING
#cmakedefine HAVE_JEMALLOC #cmakedefine HAVE_JEMALLOC
#cmakedefine LOG_LIST_ACTIONS
#endif #endif
#cmakedefine HAVE_BE64TOH #cmakedefine HAVE_BE64TOH
#cmakedefine ORDER_BIG_ENDIAN #cmakedefine ORDER_BIG_ENDIAN
#define ENDIAN_INCLUDE_FILE <@ENDIAN_INCLUDE_FILE@> #define ENDIAN_INCLUDE_FILE <@ENDIAN_INCLUDE_FILE@>
#cmakedefine HAVE_EXECINFO_BACKTRACE
#endif // AUTO_CONFIG_H #endif // AUTO_CONFIG_H

View File

@@ -13,26 +13,21 @@
# Sets the build type; defaults to Debug. Valid values: # Sets the build type; defaults to Debug. Valid values:
# #
# - Debug: Disables optimizations (-O0), enables debug information and logging. # - Debug: Disables optimizations (-O0), enables debug information.
# #
# - Dev: Enables all optimizations that do not interfere with # - RelWithDebInfo: Enables optimizations (-Og or -O2) with debug information.
# debugging (-Og if available, -O2 and -g if not).
# Enables debug information and logging.
#
# - RelWithDebInfo: Enables optimizations (-O2) and debug information.
# Disables logging.
# #
# - MinSizeRel: Enables all -O2 optimization that do not typically # - MinSizeRel: Enables all -O2 optimization that do not typically
# increase code size, and performs further optimizations # increase code size, and performs further optimizations
# designed to reduce code size (-Os). # designed to reduce code size (-Os).
# Disables debug information and logging. # Disables debug information.
# #
# - Release: Same as RelWithDebInfo, but disables debug information. # - Release: Same as RelWithDebInfo, but disables debug information.
# #
# CMAKE_BUILD_TYPE := Debug # CMAKE_BUILD_TYPE := Debug
# The default log level is 1 (INFO) (unless CMAKE_BUILD_TYPE is "Release").
# 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.
# CMAKE_EXTRA_FLAGS += -DMIN_LOG_LEVEL=1 # CMAKE_EXTRA_FLAGS += -DMIN_LOG_LEVEL=1
# By default, nvim uses bundled versions of its required third-party # By default, nvim uses bundled versions of its required third-party

View File

@@ -42,6 +42,7 @@ foreach(PACKAGE ${PACKAGES})
nvim nvim
WORKING_DIRECTORY "${GENERATED_PACKAGE_DIR}/${PACKNAME}" WORKING_DIRECTORY "${GENERATED_PACKAGE_DIR}/${PACKNAME}"
) )
add_dependencies(${PACKNAME}-tags nvim_runtime_deps)
add_custom_command(OUTPUT "${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/tags" add_custom_command(OUTPUT "${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/tags"
DEPENDS DEPENDS
@@ -71,6 +72,7 @@ foreach(DF ${DOCFILES})
endforeach() endforeach()
add_custom_target(helptags add_custom_target(helptags
COMMAND ${CMAKE_COMMAND} -E remove ${GENERATED_RUNTIME_DIR}/doc/*
COMMAND ${CMAKE_COMMAND} -E copy_directory COMMAND ${CMAKE_COMMAND} -E copy_directory
${PROJECT_SOURCE_DIR}/runtime/doc ${GENERATED_RUNTIME_DIR}/doc ${PROJECT_SOURCE_DIR}/runtime/doc ${GENERATED_RUNTIME_DIR}/doc
COMMAND "${PROJECT_BINARY_DIR}/bin/nvim" COMMAND "${PROJECT_BINARY_DIR}/bin/nvim"
@@ -79,6 +81,7 @@ add_custom_target(helptags
nvim nvim
WORKING_DIRECTORY "${GENERATED_RUNTIME_DIR}" WORKING_DIRECTORY "${GENERATED_RUNTIME_DIR}"
) )
add_dependencies(helptags nvim_runtime_deps)
add_custom_command(OUTPUT ${GENERATED_HELP_TAGS} add_custom_command(OUTPUT ${GENERATED_HELP_TAGS}
DEPENDS DEPENDS
@@ -100,20 +103,6 @@ add_custom_target(
${GENERATED_PACKAGE_TAGS} ${GENERATED_PACKAGE_TAGS}
) )
# Optional targets for nvim.desktop file and icon.
find_program(XDG_MENU_PRG xdg-desktop-menu)
find_program(XDG_ICON_PRG xdg-icon-resource)
if(XDG_MENU_PRG)
add_custom_target(desktop-file
COMMAND xdg-desktop-menu install --novendor ${PROJECT_SOURCE_DIR}/runtime/nvim.desktop)
# add_dependencies(runtime desktop-file)
endif()
if(XDG_ICON_PRG)
add_custom_target(desktop-icon
COMMAND xdg-icon-resource install --novendor --size 128 ${PROJECT_SOURCE_DIR}/runtime/nvim.png)
# add_dependencies(runtime desktop-icon)
endif()
# CMake is painful here. It will create the destination using the user's # CMake is painful here. It will create the destination using the user's
# current umask, and we don't want that. And we don't just want to install # current umask, and we don't want that. And we don't just want to install
# the target directory, as it will mess with existing permissions. So this # the target directory, as it will mess with existing permissions. So this
@@ -128,6 +117,16 @@ install_helper(
FILES ${GENERATED_SYN_VIM} FILES ${GENERATED_SYN_VIM}
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/syntax/vim) DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/syntax/vim)
if(NOT APPLE)
install_helper(
FILES ${CMAKE_CURRENT_SOURCE_DIR}/nvim.desktop
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
install_helper(
FILES ${CMAKE_CURRENT_SOURCE_DIR}/nvim.png
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pixmaps)
endif()
file(GLOB_RECURSE RUNTIME_PROGRAMS file(GLOB_RECURSE RUNTIME_PROGRAMS
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
*.awk *.sh *.bat) *.awk *.sh *.bat)
@@ -140,7 +139,8 @@ endforeach()
file(GLOB_RECURSE RUNTIME_FILES file(GLOB_RECURSE RUNTIME_FILES
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
*.vim *.dict *.py *.rb *.ps *.tutor) rgb.txt
*.vim *.lua *.dict *.py *.rb *.ps *.spl *.tutor *.tutor.json)
foreach(F ${RUNTIME_FILES}) foreach(F ${RUNTIME_FILES})
get_filename_component(BASEDIR ${F} PATH) get_filename_component(BASEDIR ${F} PATH)

View File

@@ -591,7 +591,7 @@ function ada#Map_Menu (Text, Keys, Command)
\" :" . a:Command \" :" . a:Command
execute execute
\ "inoremap <buffer>" . \ "inoremap <buffer>" .
\ " <Learder>a" . a:Keys . \ " <Leader>a" . a:Keys .
\" <C-O>:" . a:Command \" <C-O>:" . a:Command
endif endif
return return

View File

@@ -1,24 +1,24 @@
function! s:enhance_syntax() abort function! s:enhance_syntax() abort
syntax case match syntax case match
syntax keyword healthError ERROR syntax keyword healthError ERROR[:]
\ containedin=markdownCodeBlock,mkdListItemLine \ containedin=markdownCodeBlock,mkdListItemLine
highlight link healthError Error highlight default link healthError Error
syntax keyword healthWarning WARNING syntax keyword healthWarning WARNING[:]
\ containedin=markdownCodeBlock,mkdListItemLine \ containedin=markdownCodeBlock,mkdListItemLine
highlight link healthWarning WarningMsg highlight default link healthWarning WarningMsg
syntax keyword healthSuccess SUCCESS syntax keyword healthSuccess OK[:]
\ containedin=markdownCodeBlock,mkdListItemLine \ containedin=markdownCodeBlock,mkdListItemLine
highlight healthSuccess guibg=#5fff00 guifg=#080808 ctermbg=82 ctermfg=232 highlight default healthSuccess guibg=#5fff00 guifg=#080808 ctermbg=82 ctermfg=232
syntax match healthHelp "|.\{-}|" contains=healthBar syntax match healthHelp "|.\{-}|" contains=healthBar
\ containedin=markdownCodeBlock,mkdListItemLine \ containedin=markdownCodeBlock,mkdListItemLine
syntax match healthBar "|" contained conceal syntax match healthBar "|" contained conceal
highlight link healthHelp Identifier highlight default link healthHelp Identifier
" We do not care about markdown syntax errors in :CheckHealth output. " We do not care about markdown syntax errors in :checkhealth output.
highlight! link markdownError Normal highlight! link markdownError Normal
endfunction endfunction
@@ -33,7 +33,8 @@ function! health#check(plugin_names) abort
setlocal wrap breakindent setlocal wrap breakindent
setlocal filetype=markdown setlocal filetype=markdown
setlocal conceallevel=2 concealcursor=nc setlocal conceallevel=2 concealcursor=nc
setlocal keywordprg=:help iskeyword=@,48-57,_,192-255,-,# setlocal keywordprg=:help
let &l:iskeyword='!-~,^*,^|,^",192-255'
call s:enhance_syntax() call s:enhance_syntax()
if empty(healthchecks) if empty(healthchecks)
@@ -89,30 +90,30 @@ endfunction
" Changes ':h clipboard' to ':help |clipboard|'. " Changes ':h clipboard' to ':help |clipboard|'.
function! s:help_to_link(s) abort function! s:help_to_link(s) abort
return substitute(a:s, '\v:h%[elp] ([^|][^"\r\n]+)', ':help |\1|', 'g') return substitute(a:s, '\v:h%[elp] ([^|][^"\r\n ]+)', ':help |\1|', 'g')
endfunction endfunction
" Format a message for a specific report item " Format a message for a specific report item.
" a:1: Optional advice (string or list)
function! s:format_report_message(status, msg, ...) abort " {{{ function! s:format_report_message(status, msg, ...) abort " {{{
let output = ' - ' . a:status . ': ' . s:indent_after_line1(a:msg, 4) let output = ' - ' . a:status . ': ' . s:indent_after_line1(a:msg, 4)
let suggestions = []
" Optional parameters " Optional parameters
if a:0 > 0 if a:0 > 0
let suggestions = type(a:1) == type("") ? [a:1] : a:1 let advice = type(a:1) == type('') ? [a:1] : a:1
if type(suggestions) != type([]) if type(advice) != type([])
echoerr "Expected String or List" throw 'a:1: expected String or List'
endif
" Report each suggestion
if !empty(advice)
let output .= "\n - ADVICE:"
for suggestion in advice
let output .= "\n - " . s:indent_after_line1(suggestion, 10)
endfor
endif endif
endif endif
" Report each suggestion
if len(suggestions) > 0
let output .= "\n - SUGGESTIONS:"
endif
for suggestion in suggestions
let output .= "\n - " . s:indent_after_line1(suggestion, 10)
endfor
return s:help_to_link(output) return s:help_to_link(output)
endfunction " }}} endfunction " }}}
@@ -123,10 +124,11 @@ endfunction " }}}
" Reports a successful healthcheck. " Reports a successful healthcheck.
function! health#report_ok(msg) abort " {{{ function! health#report_ok(msg) abort " {{{
echo s:format_report_message('SUCCESS', a:msg) echo s:format_report_message('OK', a:msg)
endfunction " }}} endfunction " }}}
" Reports a health warning. " Reports a health warning.
" a:1: Optional advice (string or list)
function! health#report_warn(msg, ...) abort " {{{ function! health#report_warn(msg, ...) abort " {{{
if a:0 > 0 if a:0 > 0
echo s:format_report_message('WARNING', a:msg, a:1) echo s:format_report_message('WARNING', a:msg, a:1)
@@ -136,6 +138,7 @@ function! health#report_warn(msg, ...) abort " {{{
endfunction " }}} endfunction " }}}
" Reports a failed healthcheck. " Reports a failed healthcheck.
" a:1: Optional advice (string or list)
function! health#report_error(msg, ...) abort " {{{ function! health#report_error(msg, ...) abort " {{{
if a:0 > 0 if a:0 > 0
echo s:format_report_message('ERROR', a:msg, a:1) echo s:format_report_message('ERROR', a:msg, a:1)
@@ -158,7 +161,10 @@ endfunction
" Translates a list of plugin names to healthcheck function names. " Translates a list of plugin names to healthcheck function names.
function! s:to_fn_names(plugin_names) abort function! s:to_fn_names(plugin_names) abort
let healthchecks = [] let healthchecks = []
for p in a:plugin_names let plugin_names = type('') ==# type(a:plugin_names)
\ ? split(a:plugin_names, '', v:false)
\ : a:plugin_names
for p in plugin_names
call add(healthchecks, 'health#'.p.'#check') call add(healthchecks, 'health#'.p.'#check')
endfor endfor
return healthchecks return healthchecks

View File

@@ -4,13 +4,26 @@ function! s:check_config() abort
let ok = v:true let ok = v:true
call health#report_start('Configuration') call health#report_start('Configuration')
" If $VIM is empty we don't care. Else make sure it is valid.
if !empty($VIM) && !filereadable($VIM.'/runtime/doc/nvim.txt')
let ok = v:false
call health#report_error('$VIM is invalid: '.$VIM)
endif
if exists('$NVIM_TUI_ENABLE_CURSOR_SHAPE') if exists('$NVIM_TUI_ENABLE_CURSOR_SHAPE')
let ok = v:false let ok = v:false
call health#report_warn("$NVIM_TUI_ENABLE_CURSOR_SHAPE is ignored in Nvim 0.2+", call health#report_warn('$NVIM_TUI_ENABLE_CURSOR_SHAPE is ignored in Nvim 0.2+',
\ [ "Use the 'guicursor' option to configure cursor shape. :help 'guicursor'", \ [ "Use the 'guicursor' option to configure cursor shape. :help 'guicursor'",
\ 'https://github.com/neovim/neovim/wiki/Following-HEAD#20170402' ]) \ 'https://github.com/neovim/neovim/wiki/Following-HEAD#20170402' ])
endif endif
if &paste
let ok = v:false
call health#report_error("'paste' is enabled. This option is only for pasting text.\nIt should not be set in your config.",
\ [ 'Remove `set paste` from your init.vim, if applicable.',
\ 'Check `:verbose set paste?` to see if a plugin or script set the option.', ])
endif
if ok if ok
call health#report_ok('no issues found') call health#report_ok('no issues found')
endif endif
@@ -45,7 +58,7 @@ function! s:check_rplugin_manifest() abort
let contents = join(readfile(script)) let contents = join(readfile(script))
if contents =~# '\<\%(from\|import\)\s\+neovim\>' if contents =~# '\<\%(from\|import\)\s\+neovim\>'
if script =~# '[\/]__init__\.py$' if script =~# '[\/]__init__\.py$'
let script = fnamemodify(script, ':h') let script = tr(fnamemodify(script, ':h'), '\', '/')
endif endif
if !has_key(existing_rplugins, script) if !has_key(existing_rplugins, script)
@@ -87,8 +100,8 @@ function! s:check_performance() abort
else else
call health#report_info(buildtype) call health#report_info(buildtype)
call health#report_warn( call health#report_warn(
\ "Non-optimized build-type. Nvim will be slower.", \ 'Non-optimized build-type. Nvim will be slower.',
\ ["Install a different Nvim package, or rebuild with `CMAKE_BUILD_TYPE=RelWithDebInfo`.", \ ['Install a different Nvim package, or rebuild with `CMAKE_BUILD_TYPE=RelWithDebInfo`.',
\ s:suggest_faq]) \ s:suggest_faq])
endif endif
endfunction endfunction
@@ -160,6 +173,11 @@ function! s:check_terminal() abort
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']
if exists('$'.env_var)
call health#report_info(printf("$%s='%s'", env_var, eval('$'.env_var)))
endif
endfor
endfunction endfunction
function! health#nvim#check() abort function! health#nvim#check() abort

View File

@@ -13,6 +13,12 @@ function! s:normalize_path(s) abort
return substitute(substitute(a:s, '\', '/', 'g'), '/\./\|/\+', '/', 'g') return substitute(substitute(a:s, '\', '/', 'g'), '/\./\|/\+', '/', 'g')
endfunction endfunction
" Returns TRUE if `cmd` exits with success, else FALSE.
function! s:cmd_ok(cmd) abort
call system(a:cmd)
return v:shell_error == 0
endfunction
" Simple version comparison. " Simple version comparison.
function! s:version_cmp(a, b) abort function! s:version_cmp(a, b) abort
let a = split(a:a, '\.', 0) let a = split(a:a, '\.', 0)
@@ -120,10 +126,21 @@ endfunction
function! s:check_clipboard() abort function! s:check_clipboard() abort
call health#report_start('Clipboard (optional)') call health#report_start('Clipboard (optional)')
if !empty($TMUX) && executable('tmux') && executable('pbpaste') && !s:cmd_ok('pbpaste')
let tmux_version = matchstr(system('tmux -V'), '\d\+\.\d\+')
call health#report_error('pbcopy does not work with tmux version: '.tmux_version,
\ ['Install tmux 2.6+. https://superuser.com/q/231130',
\ 'or use tmux with reattach-to-user-namespace. https://superuser.com/a/413233'])
endif
let clipboard_tool = provider#clipboard#Executable() let clipboard_tool = provider#clipboard#Executable()
if empty(clipboard_tool) if exists('g:clipboard') && empty(clipboard_tool)
call health#report_error(
\ provider#clipboard#Error(),
\ ["Use the example in :help g:clipboard as a template, or don't set g:clipboard at all."])
elseif empty(clipboard_tool)
call health#report_warn( call health#report_warn(
\ 'No clipboard tool found. Clipboard registers will not work.', \ 'No clipboard tool found. Clipboard registers (`"+` and `"*`) will not work.',
\ [':help clipboard']) \ [':help clipboard'])
else else
call health#report_ok('Clipboard tool found: '. clipboard_tool) call health#report_ok('Clipboard tool found: '. clipboard_tool)
@@ -235,7 +252,7 @@ function! s:check_python(version) abort
let pyname = 'python'.(a:version == 2 ? '' : '3') let pyname = 'python'.(a:version == 2 ? '' : '3')
let pyenv = resolve(exepath('pyenv')) let pyenv = resolve(exepath('pyenv'))
let pyenv_root = exists('$PYENV_ROOT') ? resolve($PYENV_ROOT) : 'n' let pyenv_root = exists('$PYENV_ROOT') ? resolve($PYENV_ROOT) : ''
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 loaded_var = 'g:loaded_'.pyname.'_provider'
@@ -243,8 +260,24 @@ function! s:check_python(version) abort
let python_multiple = [] let python_multiple = []
if exists(loaded_var) && !exists('*provider#'.pyname.'#Call') if exists(loaded_var) && !exists('*provider#'.pyname.'#Call')
call health#report_info('Disabled. '.loaded_var.'='.eval(loaded_var)) call health#report_info('Disabled ('.loaded_var.'='.eval(loaded_var).'). This might be due to some previous error.')
return endif
if !empty(pyenv)
if empty(pyenv_root)
call health#report_info(
\ 'pyenv was found, but $PYENV_ROOT is not set. `pyenv root` will be used.'
\ .' If you run into problems, try setting $PYENV_ROOT explicitly.'
\ )
let pyenv_root = s:trim(s:system([pyenv, 'root']))
endif
if !isdirectory(pyenv_root)
call health#report_error('Invalid pyenv root: '.pyenv_root)
else
call health#report_info(printf('pyenv: %s', pyenv))
call health#report_info(printf('pyenv root: %s', pyenv_root))
endif
endif endif
if exists('g:'.host_prog_var) if exists('g:'.host_prog_var)
@@ -255,9 +288,6 @@ function! s:check_python(version) abort
if empty(pyname) if empty(pyname)
call health#report_warn('No Python interpreter was found with the neovim ' call health#report_warn('No Python interpreter was found with the neovim '
\ . 'module. Using the first available for diagnostics.') \ . 'module. Using the first available for diagnostics.')
if !empty(pythonx_errs)
call health#report_warn(pythonx_errs)
endif
endif endif
if !empty(pyname) if !empty(pyname)
@@ -278,15 +308,6 @@ function! s:check_python(version) abort
endif endif
if !empty(pyenv) if !empty(pyenv)
if empty(pyenv_root)
call health#report_warn(
\ 'pyenv was found, but $PYENV_ROOT is not set.',
\ ['Did you follow the final install instructions?']
\ )
else
call health#report_ok(printf('pyenv found: "%s"', pyenv))
endif
let python_bin = s:trim(s:system([pyenv, 'which', pyname], '', 1)) let python_bin = s:trim(s:system([pyenv, 'which', pyname], '', 1))
if empty(python_bin) if empty(python_bin)
@@ -316,25 +337,24 @@ function! s:check_python(version) abort
if python_bin =~# '\<shims\>' if python_bin =~# '\<shims\>'
call health#report_warn(printf('`%s` appears to be a pyenv shim.', python_bin), [ call health#report_warn(printf('`%s` appears to be a pyenv shim.', python_bin), [
\ 'The `pyenv` executable is not in $PATH,', \ '`pyenv` is not in $PATH, your pyenv installation is broken. '
\ 'Your pyenv installation is broken. You should set ' \ .'Set `g:'.host_prog_var.'` to avoid surprises.',
\ . '`g:'.host_prog_var.'` to avoid surprises.',
\ ]) \ ])
endif endif
endif endif
endif endif
endif endif
if !empty(python_bin) if !empty(python_bin) && !exists('g:'.host_prog_var)
if empty(venv) && !empty(pyenv) && !exists('g:'.host_prog_var) if empty(venv) && !empty(pyenv)
\ && !empty(pyenv_root) && resolve(python_bin) !~# '^'.pyenv_root.'/' \ && !empty(pyenv_root) && resolve(python_bin) !~# '^'.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 Neovim using pyenv, and set `g:%s`. This will avoid '
\ . 'the need to install Neovim''s Python module in each ' \ . 'the need to install the Neovim Python module in each '
\ . 'version/virtualenv.', host_prog_var) \ . 'version/virtualenv.', host_prog_var)
\ ]) \ ])
elseif !empty(venv) && exists('g:'.host_prog_var) elseif !empty(venv)
if !empty(pyenv_root) if !empty(pyenv_root)
let venv_root = pyenv_root let venv_root = pyenv_root
else else
@@ -359,27 +379,16 @@ function! s:check_python(version) abort
let python_bin = '' let python_bin = ''
endif endif
" Check if $VIRTUAL_ENV is active " Check if $VIRTUAL_ENV is valid.
let virtualenv_inactive = 0
if exists('$VIRTUAL_ENV') if exists('$VIRTUAL_ENV')
if !empty(pyenv) if !empty(pyname) && $VIRTUAL_ENV !=# matchstr(exepath(pyname), '^\V'.$VIRTUAL_ENV)
let pyenv_prefix = resolve(s:trim(s:system([pyenv, 'prefix']))) call health#report_warn(
if $VIRTUAL_ENV != pyenv_prefix \ '$VIRTUAL_ENV exists but appears to be inactive. '
let virtualenv_inactive = 1 \ . 'This could lead to unexpected results.',
endif \ [ 'If you are using Zsh, see: http://vi.stackexchange.com/a/7654' ])
elseif !empty(pyname) && exepath(pyname) !~# '^'.$VIRTUAL_ENV.'/'
let virtualenv_inactive = 1
endif endif
endif endif
if virtualenv_inactive
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/5229' ])
endif
" Diagnostic output " Diagnostic output
call health#report_info('Executable: ' . (empty(python_bin) ? 'Not found' : python_bin)) call health#report_info('Executable: ' . (empty(python_bin) ? 'Not found' : python_bin))
if len(python_multiple) if len(python_multiple)
@@ -444,10 +453,11 @@ function! s:check_ruby() abort
let host = provider#ruby#Detect() let host = provider#ruby#Detect()
if empty(host) if empty(host)
call health#report_warn('Missing "neovim" gem.', call health#report_warn('`neovim-ruby-host` not found.',
\ ['Run in shell: gem install neovim', \ ['Run `gem install neovim` to ensure the neovim RubyGem is installed.',
\ 'Is the gem bin directory in $PATH? Check `gem environment`.', \ 'Run `gem environment` to ensure the gem bin directory is in $PATH.',
\ 'If you are using rvm/rbenv/chruby, try "rehashing".']) \ 'If you are using rvm/rbenv/chruby, try "rehashing".',
\ 'See :help g:ruby_host_prog for non-standard gem installations.'])
return return
endif endif
call health#report_info('Host: '. host) call health#report_info('Host: '. host)
@@ -480,9 +490,80 @@ function! s:check_ruby() abort
endif endif
endfunction endfunction
function! s:check_node() abort
call health#report_start('Node.js provider (optional)')
let loaded_var = 'g:loaded_node_provider'
if exists(loaded_var) && !exists('*provider#node#Call')
call health#report_info('Disabled. '.loaded_var.'='.eval(loaded_var))
return
endif
if !executable('node') || !executable('npm')
call health#report_warn(
\ '`node` and `npm` must be in $PATH.',
\ ['Install Node.js and verify that `node` and `npm` commands work.'])
return
endif
let node_v = get(split(s:system('node -v'), "\n"), 0, '')
call health#report_info('Node.js: '. node_v)
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)
" Skip further checks, they are nonsense if nodejs is too old.
return
endif
if !provider#node#can_inspect()
call health#report_warn('node.js on this system does not support --inspect-brk so $NVIM_NODE_HOST_DEBUG is ignored.')
endif
let host = provider#node#Detect()
if empty(host)
call health#report_warn('Missing "neovim" npm package.',
\ ['Run in shell: npm install -g neovim',
\ 'Is the npm bin directory in $PATH?'])
return
endif
call health#report_info('Neovim node.js host: '. host)
let latest_npm_cmd = has('win32') ? 'cmd /c npm info neovim --json' : 'npm info neovim --json'
let latest_npm = s:system(split(latest_npm_cmd))
if s:shell_error || empty(latest_npm)
call health#report_error('Failed to run: '. latest_npm_cmd,
\ ["Make sure you're connected to the internet.",
\ 'Are you behind a firewall or proxy?'])
return
endif
if !empty(latest_npm)
try
let pkg_data = json_decode(latest_npm)
catch /E474/
return 'error: '.latest_npm
endtry
let latest_npm = get(get(pkg_data, 'dist-tags', {}), 'latest', 'unable to parse')
endif
let current_npm_cmd = ['node', host, '--version']
let current_npm = s:system(current_npm_cmd)
if s:shell_error
call health#report_error('Failed to run: '. string(current_npm_cmd),
\ ['Report this issue with the output of: ', string(current_npm_cmd)])
return
endif
if s:version_cmp(current_npm, latest_npm) == -1
call health#report_warn(
\ printf('Package "neovim" is out-of-date. Installed: %s, latest: %s',
\ current_npm, latest_npm),
\ ['Run in shell: npm update neovim'])
else
call health#report_ok('Latest "neovim" npm package is installed: '. current_npm)
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_ruby() call s:check_ruby()
call s:check_node()
endfunction endfunction

View File

@@ -1,7 +1,7 @@
" Vim completion script " Vim completion script
" Language: Java Script " Language: Java Script
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) " Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
" Last Change: 2006 Apr 30 " Last Change: 2017 Mar 04
function! javascriptcomplete#CompleteJS(findstart, base) function! javascriptcomplete#CompleteJS(findstart, base)
if a:findstart if a:findstart
@@ -563,7 +563,7 @@ function! javascriptcomplete#CompleteJS(findstart, base)
for i in arguments for i in arguments
let g:ia = i let g:ia = i
let f_elements = matchlist(i, 'function\s\+\(\k\+\)\s*(\(.\{-}\))') let f_elements = matchlist(i, 'function\s\+\(\k\+\)\s*(\(.\{-}\))')
if len(f_elements) == 3 if len(f_elements) >= 3
let b:js_menuinfo[f_elements[1].'('] = f_elements[2] let b:js_menuinfo[f_elements[1].'('] = f_elements[2]
endif endif
endfor endfor

View File

@@ -65,9 +65,9 @@ function! man#open_page(count, count1, mods, ...) abort
try try
set eventignore+=BufReadCmd set eventignore+=BufReadCmd
if a:mods !~# 'tab' && s:find_man() if a:mods !~# 'tab' && s:find_man()
execute 'silent edit' fnameescape(bufname) execute 'silent keepalt edit' fnameescape(bufname)
else else
execute 'silent' a:mods 'split' fnameescape(bufname) execute 'silent keepalt' a:mods 'split' fnameescape(bufname)
endif endif
finally finally
set eventignore-=BufReadCmd set eventignore-=BufReadCmd
@@ -148,7 +148,8 @@ function! s:get_page(path) abort
let manwidth = empty($MANWIDTH) ? winwidth(0) : $MANWIDTH let manwidth = 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
let cmd = ['env', 'MANPAGER=cat', 'MANWIDTH='.manwidth, 'man'] " Set MAN_KEEP_FORMATTING so Debian man doesn't discard backspaces.
let cmd = ['env', 'MANPAGER=cat', 'MANWIDTH='.manwidth, 'MAN_KEEP_FORMATTING=1', 'man']
return s:system(cmd + (s:localfile_arg ? ['-l', a:path] : [a:path])) return s:system(cmd + (s:localfile_arg ? ['-l', a:path] : [a:path]))
endfunction endfunction
@@ -157,11 +158,10 @@ function! s:put_page(page) abort
setlocal noreadonly setlocal noreadonly
silent keepjumps %delete _ silent keepjumps %delete _
silent put =a:page silent put =a:page
" Remove all backspaced/escape characters.
execute 'silent keeppatterns keepjumps %substitute,.\b\|\e\[\d\+m,,e'.(&gdefault?'':'g')
while getline(1) =~# '^\s*$' while getline(1) =~# '^\s*$'
silent keepjumps 1delete _ silent keepjumps 1delete _
endwhile endwhile
lua require("man").highlight_man_page()
setlocal filetype=man setlocal filetype=man
endfunction endfunction
@@ -299,6 +299,12 @@ endfunction
" see man#extract_sect_and_name_ref on why tolower(sect) " see man#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')
if cmd_offset > 0
" Prune all arguments up to :Man itself. Otherwise modifier commands like
" :tab, :vertical, etc. would lead to a wrong length.
let args = args[cmd_offset:]
endif
let l = len(args) let l = len(args)
if l > 3 if l > 3
return return
@@ -370,13 +376,12 @@ function! s:format_candidate(path, psect) abort
endfunction endfunction
function! man#init_pager() abort function! man#init_pager() abort
" Remove all backspaced/escape characters.
execute 'silent keeppatterns keepjumps %substitute,.\b\|\e\[\d\+m,,e'.(&gdefault?'':'g')
if getline(1) =~# '^\s*$' if getline(1) =~# '^\s*$'
silent keepjumps 1delete _ silent keepjumps 1delete _
else else
keepjumps 1 keepjumps 1
endif endif
lua require("man").highlight_man_page()
" This is not perfect. See `man glDrawArraysInstanced`. Since the title is " This is not perfect. See `man glDrawArraysInstanced`. Since the title is
" all caps it is impossible to tell what the original capitilization was. " all caps it is impossible to tell what the original capitilization was.
let ref = substitute(matchstr(getline(1), '^[^)]\+)'), ' ', '_', 'g') let ref = substitute(matchstr(getline(1), '^[^)]\+)'), ' ', '_', 'g')

View File

@@ -1,6 +1,6 @@
" Vim support file to help with paste mappings and menus " Vim support file to help with paste mappings and menus
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2006 Jun 23 " Last Change: 2017 Aug 30
" Define the string to use for items that are present both in Edit, Popup and " Define the string to use for items that are present both in Edit, Popup and
" Toolbar menu. Also used in mswin.vim and macmap.vim. " Toolbar menu. Also used in mswin.vim and macmap.vim.
@@ -12,7 +12,7 @@
if has("virtualedit") if has("virtualedit")
let paste#paste_cmd = {'n': ":call paste#Paste()<CR>"} let paste#paste_cmd = {'n': ":call paste#Paste()<CR>"}
let paste#paste_cmd['v'] = '"-c<Esc>' . paste#paste_cmd['n'] let paste#paste_cmd['v'] = '"-c<Esc>' . paste#paste_cmd['n']
let paste#paste_cmd['i'] = 'x<BS><Esc>' . paste#paste_cmd['n'] . 'gi' let paste#paste_cmd['i'] = "\<c-\>\<c-o>\"+gP"
func! paste#Paste() func! paste#Paste()
let ove = &ve let ove = &ve

View File

@@ -0,0 +1,21 @@
" Common functions for providers
" Start the provider and perform a 'poll' request
"
" Returns a valid channel on success
function! provider#Poll(argv, orig_name, log_env) abort
let job = {'rpc': v:true, 'stderr_buffered': v:true}
try
let channel_id = jobstart(a:argv, job)
if channel_id > 0 && rpcrequest(channel_id, 'poll') ==# 'ok'
return channel_id
endif
catch
echomsg v:throwpoint
echomsg v:exception
for row in get(job, 'stderr', [])
echomsg row
endfor
endtry
throw remote#host#LoadErrorForHost(a:orig_name, a:log_env)
endfunction

View File

@@ -3,10 +3,11 @@
" available. " available.
let s:copy = {} let s:copy = {}
let s:paste = {} let s:paste = {}
let s:clipboard = {}
" When caching is enabled, store the jobid of the xclip/xsel process keeping " When caching is enabled, store the jobid of the xclip/xsel process keeping
" ownership of the selection, so we know how long the cache is valid. " ownership of the selection, so we know how long the cache is valid.
let s:selection = { 'owner': 0, 'data': [] } let s:selection = { 'owner': 0, 'data': [], 'stderr_buffered': v:true }
function! s:selection.on_exit(jobid, data, event) abort function! s:selection.on_exit(jobid, data, event) abort
" At this point this nvim instance might already have launched " At this point this nvim instance might already have launched
@@ -14,17 +15,22 @@ function! s:selection.on_exit(jobid, data, event) abort
if self.owner == a:jobid if self.owner == a:jobid
let self.owner = 0 let self.owner = 0
endif endif
if a:data != 0
echohl WarningMsg
echomsg 'clipboard: error invoking '.get(self.argv, 0, '?').': '.join(self.stderr)
echohl None
endif
endfunction endfunction
let s:selections = { '*': s:selection, '+': copy(s:selection)} let s:selections = { '*': s:selection, '+': copy(s:selection) }
function! s:try_cmd(cmd, ...) abort function! s:try_cmd(cmd, ...) abort
let argv = split(a:cmd, " ") let argv = split(a:cmd, " ")
let out = a:0 ? systemlist(argv, a:1, 1) : systemlist(argv, [''], 1) let out = systemlist(argv, (a:0 ? a:1 : ['']), 1)
if v:shell_error if v:shell_error
if !exists('s:did_error_try_cmd') if !exists('s:did_error_try_cmd')
echohl WarningMsg echohl WarningMsg
echomsg "clipboard: error: ".(len(out) ? out[0] : '') echomsg "clipboard: error: ".(len(out) ? out[0] : v:shell_error)
echohl None echohl None
let s:did_error_try_cmd = 1 let s:did_error_try_cmd = 1
endif endif
@@ -48,11 +54,17 @@ endfunction
function! provider#clipboard#Executable() abort function! provider#clipboard#Executable() abort
if exists('g:clipboard') if exists('g:clipboard')
if type({}) isnot# type(g:clipboard)
\ || type({}) isnot# type(get(g:clipboard, 'copy', v:null))
\ || type({}) isnot# type(get(g:clipboard, 'paste', v:null))
let s:err = 'clipboard: invalid g:clipboard'
return ''
endif
let s:copy = get(g:clipboard, 'copy', { '+': v:null, '*': v:null }) let s:copy = get(g:clipboard, 'copy', { '+': v:null, '*': v:null })
let s:paste = get(g:clipboard, 'paste', { '+': v:null, '*': v:null }) let s:paste = get(g:clipboard, 'paste', { '+': v:null, '*': v:null })
let s:cache_enabled = get(g:clipboard, 'cache_enabled', 1) let s:cache_enabled = get(g:clipboard, 'cache_enabled', 0)
return get(g:clipboard, 'name', 'g:clipboard') return get(g:clipboard, 'name', 'g:clipboard')
elseif has('mac') && executable('pbcopy') elseif has('mac') && executable('pbpaste') && s:cmd_ok('pbpaste')
let s:copy['+'] = 'pbcopy' let s:copy['+'] = 'pbcopy'
let s:paste['+'] = 'pbpaste' let s:paste['+'] = 'pbpaste'
let s:copy['*'] = s:copy['+'] let s:copy['*'] = s:copy['+']
@@ -97,16 +109,17 @@ function! provider#clipboard#Executable() abort
return 'tmux' return 'tmux'
endif endif
let s:err = 'clipboard: No clipboard tool available. :help clipboard' let s:err = 'clipboard: No clipboard tool. :help clipboard'
return '' return ''
endfunction endfunction
if empty(provider#clipboard#Executable()) if empty(provider#clipboard#Executable())
" provider#clipboard#Call() *must not* be defined if the provider is broken.
" Otherwise eval_has_provider() thinks the clipboard provider is
" functioning, and eval_call_provider() will happily call it.
finish finish
endif endif
let s:clipboard = {}
function! s:clipboard.get(reg) abort function! s:clipboard.get(reg) abort
if s:selections[a:reg].owner > 0 if s:selections[a:reg].owner > 0
return s:selections[a:reg].data return s:selections[a:reg].data
@@ -127,28 +140,40 @@ function! s:clipboard.set(lines, regtype, reg) abort
return 0 return 0
end end
let selection = s:selections[a:reg] if s:selections[a:reg].owner > 0
if selection.owner > 0
" The previous provider instance should exit when the new one takes " The previous provider instance should exit when the new one takes
" ownership, but kill it to be sure we don't fill up the job table. " ownership, but kill it to be sure we don't fill up the job table.
call jobstop(selection.owner) call jobstop(s:selections[a:reg].owner)
end end
let s:selections[a:reg] = copy(s:selection)
let selection = s:selections[a:reg]
let selection.data = [a:lines, a:regtype] let selection.data = [a:lines, a:regtype]
let argv = split(s:copy[a:reg], " ") let argv = split(s:copy[a:reg], " ")
let selection.argv = argv
let selection.detach = s:cache_enabled let selection.detach = s:cache_enabled
let selection.cwd = "/" let selection.cwd = "/"
let jobid = jobstart(argv, selection) let jobid = jobstart(argv, selection)
if jobid <= 0 if jobid > 0
call jobsend(jobid, a:lines)
call jobclose(jobid, 'stdin')
let selection.owner = jobid
else
echohl WarningMsg echohl WarningMsg
echo "clipboard: error when invoking provider" echomsg 'clipboard: failed to execute: '.(s:copy[a:reg])
echohl None echohl None
return 0 return 0
endif endif
call jobsend(jobid, a:lines) return 1
call jobclose(jobid, 'stdin')
let selection.owner = jobid
endfunction endfunction
function! provider#clipboard#Call(method, args) abort function! provider#clipboard#Call(method, args) abort
return call(s:clipboard[a:method],a:args,s:clipboard) if get(s:, 'here', v:false) " Clipboard provider must not recurse. #7184
return 0
endif
let s:here = v:true
try
return call(s:clipboard[a:method],a:args,s:clipboard)
finally
let s:here = v:false
endtry
endfunction endfunction

View File

@@ -0,0 +1,107 @@
if exists('g:loaded_node_provider')
finish
endif
let g:loaded_node_provider = 1
function! s:is_minimum_version(version, min_major, min_minor) abort
if empty(a:version)
let nodejs_version = get(split(system(['node', '-v']), "\n"), 0, '')
if v:shell_error || nodejs_version[0] !=# 'v'
return 0
endif
else
let nodejs_version = a:version
endif
" Remove surrounding junk. Example: 'v4.12.0' => '4.12.0'
let nodejs_version = matchstr(nodejs_version, '\(\d\.\?\)\+')
" [major, minor, patch]
let v_list = split(nodejs_version, '\.')
return len(v_list) == 3
\ && ((str2nr(v_list[0]) > str2nr(a:min_major))
\ || (str2nr(v_list[0]) == str2nr(a:min_major)
\ && str2nr(v_list[1]) >= str2nr(a:min_minor)))
endfunction
" Support for --inspect-brk requires node 6.12+ or 7.6+ or 8+
" Return 1 if it is supported
" Return 0 otherwise
function! provider#node#can_inspect() abort
if !executable('node')
return 0
endif
let ver = get(split(system(['node', '-v']), "\n"), 0, '')
if v:shell_error || ver[0] !=# 'v'
return 0
endif
return (ver[1] ==# '6' && s:is_minimum_version(ver, 6, 12))
\ || s:is_minimum_version(ver, 7, 6)
endfunction
function! provider#node#Detect() abort
if exists('g:node_host_prog')
return g:node_host_prog
endif
let global_modules = get(split(system('npm root -g'), "\n"), 0, '')
if v:shell_error || !isdirectory(global_modules)
return ''
endif
if !s:is_minimum_version(v:null, 6, 0)
return ''
endif
let entry_point = glob(global_modules . '/neovim/bin/cli.js')
if !filereadable(entry_point)
return ''
endif
return entry_point
endfunction
function! provider#node#Prog() abort
return s:prog
endfunction
function! provider#node#Require(host) abort
if s:err != ''
echoerr s:err
return
endif
let args = ['node']
if !empty($NVIM_NODE_HOST_DEBUG) && provider#node#can_inspect()
call add(args, '--inspect-brk')
endif
call add(args, provider#node#Prog())
return provider#Poll(args, a:host.orig_name, '$NVIM_NODE_LOG_FILE')
endfunction
function! provider#node#Call(method, args) abort
if s:err != ''
echoerr s:err
return
endif
if !exists('s:host')
try
let s:host = remote#host#Require('node')
catch
let s:err = v:exception
echohl WarningMsg
echomsg v:exception
echohl None
return
endtry
endif
return call('rpcrequest', insert(insert(a:args, 'node_'.a:method), s:host))
endfunction
let s:err = ''
let s:prog = provider#node#Detect()
if empty(s:prog)
let s:err = 'Cannot find the "neovim" node package. Try :checkhealth'
endif
call remote#host#RegisterPlugin('node-provider', 'node', [])

View File

@@ -11,11 +11,11 @@ let g:loaded_python_provider = 1
let [s:prog, s:err] = provider#pythonx#Detect(2) let [s:prog, s:err] = provider#pythonx#Detect(2)
function! provider#python#Prog() function! provider#python#Prog() abort
return s:prog return s:prog
endfunction endfunction
function! provider#python#Error() function! provider#python#Error() abort
return s:err return s:err
endfunction endfunction
@@ -29,7 +29,7 @@ endif
call remote#host#RegisterClone('legacy-python-provider', 'python') call remote#host#RegisterClone('legacy-python-provider', 'python')
call remote#host#RegisterPlugin('legacy-python-provider', 'script_host.py', []) call remote#host#RegisterPlugin('legacy-python-provider', 'script_host.py', [])
function! provider#python#Call(method, args) function! provider#python#Call(method, args) abort
if s:err != '' if s:err != ''
return return
endif endif

View File

@@ -11,11 +11,11 @@ let g:loaded_python3_provider = 1
let [s:prog, s:err] = provider#pythonx#Detect(3) let [s:prog, s:err] = provider#pythonx#Detect(3)
function! provider#python3#Prog() function! provider#python3#Prog() abort
return s:prog return s:prog
endfunction endfunction
function! provider#python3#Error() function! provider#python3#Error() abort
return s:err return s:err
endfunction endfunction
@@ -29,7 +29,7 @@ endif
call remote#host#RegisterClone('legacy-python3-provider', 'python3') call remote#host#RegisterClone('legacy-python3-provider', 'python3')
call remote#host#RegisterPlugin('legacy-python3-provider', 'script_host.py', []) call remote#host#RegisterPlugin('legacy-python3-provider', 'script_host.py', [])
function! provider#python3#Call(method, args) function! provider#python3#Call(method, args) abort
if s:err != '' if s:err != ''
return return
endif endif

View File

@@ -5,18 +5,6 @@ endif
let s:loaded_pythonx_provider = 1 let s:loaded_pythonx_provider = 1
let s:stderr = {}
let s:job_opts = {'rpc': v:true}
" TODO(bfredl): this logic is common and should be builtin
function! s:job_opts.on_stderr(chan_id, data, event)
let stderr = get(s:stderr, a:chan_id, [''])
let last = remove(stderr, -1)
let a:data[0] = last.a:data[0]
call extend(stderr, a:data)
let s:stderr[a:chan_id] = stderr
endfunction
function! provider#pythonx#Require(host) abort function! provider#pythonx#Require(host) abort
let ver = (a:host.orig_name ==# 'python') ? 2 : 3 let ver = (a:host.orig_name ==# 'python') ? 2 : 3
@@ -30,20 +18,7 @@ function! provider#pythonx#Require(host) abort
call add(args, plugin.path) call add(args, plugin.path)
endfor endfor
try return provider#Poll(args, a:host.orig_name, '$NVIM_PYTHON_LOG_FILE')
let channel_id = jobstart(args, s:job_opts)
if rpcrequest(channel_id, 'poll') ==# 'ok'
return channel_id
endif
catch
echomsg v:throwpoint
echomsg v:exception
for row in get(s:stderr, channel_id, [])
echomsg row
endfor
endtry
throw remote#host#LoadErrorForHost(a:host.orig_name,
\ '$NVIM_PYTHON_LOG_FILE')
endfunction endfunction
function! provider#pythonx#Detect(major_ver) abort function! provider#pythonx#Detect(major_ver) abort

View File

@@ -4,26 +4,15 @@ if exists('g:loaded_ruby_provider')
endif endif
let g:loaded_ruby_provider = 1 let g:loaded_ruby_provider = 1
let s:stderr = {}
let s:job_opts = {'rpc': v:true}
function! s:job_opts.on_stderr(chan_id, data, event)
let stderr = get(s:stderr, a:chan_id, [''])
let last = remove(stderr, -1)
let a:data[0] = last.a:data[0]
call extend(stderr, a:data)
let s:stderr[a:chan_id] = stderr
endfunction
function! provider#ruby#Detect() abort function! provider#ruby#Detect() abort
if exists("g:ruby_host_prog") if exists("g:ruby_host_prog")
return g:ruby_host_prog return g:ruby_host_prog
else else
return exepath('neovim-ruby-host') return has('win32') ? exepath('neovim-ruby-host.bat') : exepath('neovim-ruby-host')
end end
endfunction endfunction
function! provider#ruby#Prog() function! provider#ruby#Prog() abort
return s:prog return s:prog
endfunction endfunction
@@ -35,22 +24,10 @@ function! provider#ruby#Require(host) abort
let prog .= " " . shellescape(plugin.path) let prog .= " " . shellescape(plugin.path)
endfor endfor
try return provider#Poll(prog, a:host.orig_name, '$NVIM_RUBY_LOG_FILE')
let channel_id = jobstart(prog, s:job_opts)
if rpcrequest(channel_id, 'poll') ==# 'ok'
return channel_id
endif
catch
echomsg v:throwpoint
echomsg v:exception
for row in get(s:stderr, channel_id, [])
echomsg row
endfor
endtry
throw remote#host#LoadErrorForHost(a:host.orig_name, '$NVIM_RUBY_LOG_FILE')
endfunction endfunction
function! provider#ruby#Call(method, args) function! provider#ruby#Call(method, args) abort
if s:err != '' if s:err != ''
echoerr s:err echoerr s:err
return return
@@ -75,7 +52,7 @@ let s:prog = provider#ruby#Detect()
let s:plugin_path = expand('<sfile>:p:h') . '/script_host.rb' let s:plugin_path = expand('<sfile>:p:h') . '/script_host.rb'
if empty(s:prog) if empty(s:prog)
let s:err = 'Cannot find the neovim RubyGem. Try :CheckHealth' let s:err = 'Cannot find the neovim RubyGem. Try :checkhealth'
endif endif
call remote#host#RegisterClone('legacy-ruby-provider', 'ruby') call remote#host#RegisterClone('legacy-ruby-provider', 'ruby')

View File

@@ -89,7 +89,8 @@ endfunction
function! remote#define#AutocmdOnHost(host, method, sync, name, opts) function! remote#define#AutocmdOnHost(host, method, sync, name, opts)
let group = s:GetNextAutocmdGroup() let group = s:GetNextAutocmdGroup()
let forward = '"doau '.group.' '.a:name.' ".'.'expand("<amatch>")' let forward = '"doau '.group.' '.a:name.' ".'
\ . 'fnameescape(expand("<amatch>"))'
let a:opts.group = group let a:opts.group = group
let bootstrap_def = s:GetAutocmdPrefix(a:name, a:opts) let bootstrap_def = s:GetAutocmdPrefix(a:name, a:opts)
\ .' call remote#define#AutocmdBootstrap("'.a:host.'"' \ .' call remote#define#AutocmdBootstrap("'.a:host.'"'
@@ -168,14 +169,40 @@ function! remote#define#FunctionOnChannel(channel, method, sync, name, opts)
exe function_def exe function_def
endfunction endfunction
let s:busy = {}
let s:pending_notifications = {}
function! s:GetRpcFunction(sync) function! s:GetRpcFunction(sync)
if a:sync if a:sync ==# 'urgent'
return 'rpcrequest' return 'rpcnotify'
elseif a:sync
return 'remote#define#request'
endif endif
return 'rpcnotify' return 'remote#define#notify'
endfunction endfunction
function! remote#define#notify(chan, ...)
if get(s:busy, a:chan, 0) > 0
let pending = get(s:pending_notifications, a:chan, [])
call add(pending, deepcopy(a:000))
let s:pending_notifications[a:chan] = pending
else
call call('rpcnotify', [a:chan] + a:000)
endif
endfunction
function! remote#define#request(chan, ...)
let s:busy[a:chan] = get(s:busy, a:chan, 0)+1
let val = call('rpcrequest', [a:chan]+a:000)
let s:busy[a:chan] -= 1
if s:busy[a:chan] == 0
for msg in get(s:pending_notifications, a:chan, [])
call call('rpcnotify', [a:chan] + msg)
endfor
let s:pending_notifications[a:chan] = []
endif
return val
endfunction
function! s:GetCommandPrefix(name, opts) function! s:GetCommandPrefix(name, opts)
return 'command!'.s:StringifyOpts(a:opts, ['nargs', 'complete', 'range', return 'command!'.s:StringifyOpts(a:opts, ['nargs', 'complete', 'range',

View File

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

415
runtime/autoload/rust.vim Normal file
View File

@@ -0,0 +1,415 @@
" Author: Kevin Ballard
" Description: Helper functions for Rust commands/mappings
" Last Modified: May 27, 2014
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
" Jump {{{1
function! rust#Jump(mode, function) range
let cnt = v:count1
normal! m'
if a:mode ==# 'v'
norm! gv
endif
let foldenable = &foldenable
set nofoldenable
while cnt > 0
execute "call <SID>Jump_" . a:function . "()"
let cnt = cnt - 1
endwhile
let &foldenable = foldenable
endfunction
function! s:Jump_Back()
call search('{', 'b')
keepjumps normal! w99[{
endfunction
function! s:Jump_Forward()
normal! j0
call search('{', 'b')
keepjumps normal! w99[{%
call search('{')
endfunction
" Run {{{1
function! rust#Run(bang, args)
let args = s:ShellTokenize(a:args)
if a:bang
let idx = index(l:args, '--')
if idx != -1
let rustc_args = idx == 0 ? [] : l:args[:idx-1]
let args = l:args[idx+1:]
else
let rustc_args = l:args
let args = []
endif
else
let rustc_args = []
endif
let b:rust_last_rustc_args = l:rustc_args
let b:rust_last_args = l:args
call s:WithPath(function("s:Run"), rustc_args, args)
endfunction
function! s:Run(dict, rustc_args, args)
let exepath = a:dict.tmpdir.'/'.fnamemodify(a:dict.path, ':t:r')
if has('win32')
let exepath .= '.exe'
endif
let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path)
let rustc_args = [relpath, '-o', exepath] + a:rustc_args
let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc"
let pwd = a:dict.istemp ? a:dict.tmpdir : ''
let output = s:system(pwd, shellescape(rustc) . " " . join(map(rustc_args, 'shellescape(v:val)')))
if output != ''
echohl WarningMsg
echo output
echohl None
endif
if !v:shell_error
exe '!' . shellescape(exepath) . " " . join(map(a:args, 'shellescape(v:val)'))
endif
endfunction
" Expand {{{1
function! rust#Expand(bang, args)
let args = s:ShellTokenize(a:args)
if a:bang && !empty(l:args)
let pretty = remove(l:args, 0)
else
let pretty = "expanded"
endif
call s:WithPath(function("s:Expand"), pretty, args)
endfunction
function! s:Expand(dict, pretty, args)
try
let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc"
if a:pretty =~? '^\%(everybody_loops$\|flowgraph=\)'
let flag = '--xpretty'
else
let flag = '--pretty'
endif
let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path)
let args = [relpath, '-Z', 'unstable-options', l:flag, a:pretty] + a:args
let pwd = a:dict.istemp ? a:dict.tmpdir : ''
let output = s:system(pwd, shellescape(rustc) . " " . join(map(args, 'shellescape(v:val)')))
if v:shell_error
echohl WarningMsg
echo output
echohl None
else
new
silent put =output
1
d
setl filetype=rust
setl buftype=nofile
setl bufhidden=hide
setl noswapfile
" give the buffer a nice name
let suffix = 1
let basename = fnamemodify(a:dict.path, ':t:r')
while 1
let bufname = basename
if suffix > 1 | let bufname .= ' ('.suffix.')' | endif
let bufname .= '.pretty.rs'
if bufexists(bufname)
let suffix += 1
continue
endif
exe 'silent noautocmd keepalt file' fnameescape(bufname)
break
endwhile
endif
endtry
endfunction
function! rust#CompleteExpand(lead, line, pos)
if a:line[: a:pos-1] =~ '^RustExpand!\s*\S*$'
" first argument and it has a !
let list = ["normal", "expanded", "typed", "expanded,identified", "flowgraph=", "everybody_loops"]
if !empty(a:lead)
call filter(list, "v:val[:len(a:lead)-1] == a:lead")
endif
return list
endif
return glob(escape(a:lead, "*?[") . '*', 0, 1)
endfunction
" Emit {{{1
function! rust#Emit(type, args)
let args = s:ShellTokenize(a:args)
call s:WithPath(function("s:Emit"), a:type, args)
endfunction
function! s:Emit(dict, type, args)
try
let output_path = a:dict.tmpdir.'/output'
let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc"
let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path)
let args = [relpath, '--emit', a:type, '-o', output_path] + a:args
let pwd = a:dict.istemp ? a:dict.tmpdir : ''
let output = s:system(pwd, shellescape(rustc) . " " . join(map(args, 'shellescape(v:val)')))
if output != ''
echohl WarningMsg
echo output
echohl None
endif
if !v:shell_error
new
exe 'silent keepalt read' fnameescape(output_path)
1
d
if a:type == "llvm-ir"
setl filetype=llvm
let extension = 'll'
elseif a:type == "asm"
setl filetype=asm
let extension = 's'
endif
setl buftype=nofile
setl bufhidden=hide
setl noswapfile
if exists('l:extension')
" give the buffer a nice name
let suffix = 1
let basename = fnamemodify(a:dict.path, ':t:r')
while 1
let bufname = basename
if suffix > 1 | let bufname .= ' ('.suffix.')' | endif
let bufname .= '.'.extension
if bufexists(bufname)
let suffix += 1
continue
endif
exe 'silent noautocmd keepalt file' fnameescape(bufname)
break
endwhile
endif
endif
endtry
endfunction
" Utility functions {{{1
" Invokes func(dict, ...)
" Where {dict} is a dictionary with the following keys:
" 'path' - The path to the file
" 'tmpdir' - The path to a temporary directory that will be deleted when the
" function returns.
" 'istemp' - 1 if the path is a file inside of {dict.tmpdir} or 0 otherwise.
" If {istemp} is 1 then an additional key is provided:
" 'tmpdir_relpath' - The {path} relative to the {tmpdir}.
"
" {dict.path} may be a path to a file inside of {dict.tmpdir} or it may be the
" existing path of the current buffer. If the path is inside of {dict.tmpdir}
" then it is guaranteed to have a '.rs' extension.
function! s:WithPath(func, ...)
let buf = bufnr('')
let saved = {}
let dict = {}
try
let saved.write = &write
set write
let dict.path = expand('%')
let pathisempty = empty(dict.path)
" Always create a tmpdir in case the wrapped command wants it
let dict.tmpdir = tempname()
call mkdir(dict.tmpdir)
if pathisempty || !saved.write
let dict.istemp = 1
" if we're doing this because of nowrite, preserve the filename
if !pathisempty
let filename = expand('%:t:r').".rs"
else
let filename = 'unnamed.rs'
endif
let dict.tmpdir_relpath = filename
let dict.path = dict.tmpdir.'/'.filename
let saved.mod = &mod
set nomod
silent exe 'keepalt write! ' . fnameescape(dict.path)
if pathisempty
silent keepalt 0file
endif
else
let dict.istemp = 0
update
endif
call call(a:func, [dict] + a:000)
finally
if bufexists(buf)
for [opt, value] in items(saved)
silent call setbufvar(buf, '&'.opt, value)
unlet value " avoid variable type mismatches
endfor
endif
if has_key(dict, 'tmpdir') | silent call s:RmDir(dict.tmpdir) | endif
endtry
endfunction
function! rust#AppendCmdLine(text)
call setcmdpos(getcmdpos())
let cmd = getcmdline() . a:text
return cmd
endfunction
" Tokenize the string according to sh parsing rules
function! s:ShellTokenize(text)
" states:
" 0: start of word
" 1: unquoted
" 2: unquoted backslash
" 3: double-quote
" 4: double-quoted backslash
" 5: single-quote
let l:state = 0
let l:current = ''
let l:args = []
for c in split(a:text, '\zs')
if l:state == 0 || l:state == 1 " unquoted
if l:c ==# ' '
if l:state == 0 | continue | endif
call add(l:args, l:current)
let l:current = ''
let l:state = 0
elseif l:c ==# '\'
let l:state = 2
elseif l:c ==# '"'
let l:state = 3
elseif l:c ==# "'"
let l:state = 5
else
let l:current .= l:c
let l:state = 1
endif
elseif l:state == 2 " unquoted backslash
if l:c !=# "\n" " can it even be \n?
let l:current .= l:c
endif
let l:state = 1
elseif l:state == 3 " double-quote
if l:c ==# '\'
let l:state = 4
elseif l:c ==# '"'
let l:state = 1
else
let l:current .= l:c
endif
elseif l:state == 4 " double-quoted backslash
if stridx('$`"\', l:c) >= 0
let l:current .= l:c
elseif l:c ==# "\n" " is this even possible?
" skip it
else
let l:current .= '\'.l:c
endif
let l:state = 3
elseif l:state == 5 " single-quoted
if l:c == "'"
let l:state = 1
else
let l:current .= l:c
endif
endif
endfor
if l:state != 0
call add(l:args, l:current)
endif
return l:args
endfunction
function! s:RmDir(path)
" sanity check; make sure it's not empty, /, or $HOME
if empty(a:path)
echoerr 'Attempted to delete empty path'
return 0
elseif a:path == '/' || a:path == $HOME
echoerr 'Attempted to delete protected path: ' . a:path
return 0
endif
return system("rm -rf " . shellescape(a:path))
endfunction
" Executes {cmd} with the cwd set to {pwd}, without changing Vim's cwd.
" If {pwd} is the empty string then it doesn't change the cwd.
function! s:system(pwd, cmd)
let cmd = a:cmd
if !empty(a:pwd)
let cmd = 'cd ' . shellescape(a:pwd) . ' && ' . cmd
endif
return system(cmd)
endfunction
" Playpen Support {{{1
" Parts of gist.vim by Yasuhiro Matsumoto <mattn.jp@gmail.com> reused
" gist.vim available under the BSD license, available at
" http://github.com/mattn/gist-vim
function! s:has_webapi()
if !exists("*webapi#http#post")
try
call webapi#http#post()
catch
endtry
endif
return exists("*webapi#http#post")
endfunction
function! rust#Play(count, line1, line2, ...) abort
redraw
let l:rust_playpen_url = get(g:, 'rust_playpen_url', 'https://play.rust-lang.org/')
let l:rust_shortener_url = get(g:, 'rust_shortener_url', 'https://is.gd/')
if !s:has_webapi()
echohl ErrorMsg | echomsg ':RustPlay depends on webapi.vim (https://github.com/mattn/webapi-vim)' | echohl None
return
endif
let bufname = bufname('%')
if a:count < 1
let content = join(getline(a:line1, a:line2), "\n")
else
let save_regcont = @"
let save_regtype = getregtype('"')
silent! normal! gvy
let content = @"
call setreg('"', save_regcont, save_regtype)
endif
let body = l:rust_playpen_url."?code=".webapi#http#encodeURI(content)
if strlen(body) > 5000
echohl ErrorMsg | echomsg 'Buffer too large, max 5000 encoded characters ('.strlen(body).')' | echohl None
return
endif
let payload = "format=simple&url=".webapi#http#encodeURI(body)
let res = webapi#http#post(l:rust_shortener_url.'create.php', payload, {})
let url = res.content
redraw | echomsg 'Done: '.url
endfunction
" }}}1
" vim: set noet sw=8 ts=8:

View File

@@ -0,0 +1,107 @@
" Author: Stephen Sugden <stephen@stephensugden.com>
"
" Adapted from https://github.com/fatih/vim-go
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
if !exists("g:rustfmt_autosave")
let g:rustfmt_autosave = 0
endif
if !exists("g:rustfmt_command")
let g:rustfmt_command = "rustfmt"
endif
if !exists("g:rustfmt_options")
let g:rustfmt_options = ""
endif
if !exists("g:rustfmt_fail_silently")
let g:rustfmt_fail_silently = 0
endif
let s:got_fmt_error = 0
function! s:RustfmtCommandRange(filename, line1, line2)
let l:arg = {"file": shellescape(a:filename), "range": [a:line1, a:line2]}
return printf("%s %s --write-mode=overwrite --file-lines '[%s]'", g:rustfmt_command, g:rustfmt_options, json_encode(l:arg))
endfunction
function! s:RustfmtCommand(filename)
return g:rustfmt_command . " --write-mode=overwrite " . g:rustfmt_options . " " . shellescape(a:filename)
endfunction
function! s:RunRustfmt(command, curw, tmpname)
if exists("*systemlist")
let out = systemlist(a:command)
else
let out = split(system(a:command), '\r\?\n')
endif
if v:shell_error == 0 || v:shell_error == 3
" remove undo point caused via BufWritePre
try | silent undojoin | catch | endtry
" Replace current file with temp file, then reload buffer
call rename(a:tmpname, expand('%'))
silent edit!
let &syntax = &syntax
" only clear location list if it was previously filled to prevent
" clobbering other additions
if s:got_fmt_error
let s:got_fmt_error = 0
call setloclist(0, [])
lwindow
endif
elseif g:rustfmt_fail_silently == 0
" otherwise get the errors and put them in the location list
let errors = []
for line in out
" src/lib.rs:13:5: 13:10 error: expected `,`, or `}`, found `value`
let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\):\s*\(\d\+:\d\+\s*\)\?\s*error: \(.*\)')
if !empty(tokens)
call add(errors, {"filename": @%,
\"lnum": tokens[2],
\"col": tokens[3],
\"text": tokens[5]})
endif
endfor
if empty(errors)
% | " Couldn't detect rustfmt error format, output errors
endif
if !empty(errors)
call setloclist(0, errors, 'r')
echohl Error | echomsg "rustfmt returned error" | echohl None
endif
let s:got_fmt_error = 1
lwindow
" We didn't use the temp file, so clean up
call delete(a:tmpname)
endif
call winrestview(a:curw)
endfunction
function! rustfmt#FormatRange(line1, line2)
let l:curw = winsaveview()
let l:tmpname = expand("%:p:h") . "/." . expand("%:p:t") . ".rustfmt"
call writefile(getline(1, '$'), l:tmpname)
let command = s:RustfmtCommandRange(l:tmpname, a:line1, a:line2)
call s:RunRustfmt(command, l:curw, l:tmpname)
endfunction
function! rustfmt#Format()
let l:curw = winsaveview()
let l:tmpname = expand("%:p:h") . "/." . expand("%:p:t") . ".rustfmt"
call writefile(getline(1, '$'), l:tmpname)
let command = s:RustfmtCommand(l:tmpname)
call s:RunRustfmt(command, l:curw, l:tmpname)
endfunction

View File

@@ -88,8 +88,8 @@ function! spellfile#LoadFile(lang)
endif endif
endif endif
if newbufnr == winbufnr(0) if newbufnr == winbufnr(0)
" We are back the old buffer, remove any (half-finished) download. " We are back to the old buffer, remove any (half-finished) download.
g/^/d_ keeppatterns g/^/d_
else else
let newbufnr = winbufnr(0) let newbufnr = winbufnr(0)
endif endif
@@ -127,7 +127,7 @@ function! spellfile#LoadFile(lang)
exe "write " . dirname . '/' . fname exe "write " . dirname . '/' . fname
" Also download the .sug file. " Also download the .sug file.
g/^/d_ keeppatterns g/^/d_
let fname = substitute(fname, '\.spl$', '.sug', '') let fname = substitute(fname, '\.spl$', '.sug', '')
echo 'Downloading ' . fname . '...' echo 'Downloading ' . fname . '...'
call spellfile#Nread(fname) call spellfile#Nread(fname)
@@ -197,7 +197,7 @@ function! spellfile#WritableSpellDir()
" Always use the $XDG_DATA_HOME/nvim/site directory " Always use the $XDG_DATA_HOME/nvim/site directory
if exists('$XDG_DATA_HOME') if exists('$XDG_DATA_HOME')
return $XDG_DATA_HOME . "/nvim/site/spell" return $XDG_DATA_HOME . "/nvim/site/spell"
else elseif !(has('win32') || has('win64'))
return $HOME . "/.local/share/nvim/site/spell" return $HOME . "/.local/share/nvim/site/spell"
endif endif
for dir in split(&rtp, ',') for dir in split(&rtp, ',')

View File

@@ -2,7 +2,7 @@
" Language: SQL " Language: SQL
" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com> " Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
" Version: 16.0 " Version: 16.0
" Last Change: 2015 Dec 29 " Last Change: 2017 Oct 15
" Homepage: http://www.vim.org/scripts/script.php?script_id=1572 " Homepage: http://www.vim.org/scripts/script.php?script_id=1572
" Usage: For detailed help " Usage: For detailed help
" ":help sql.txt" " ":help sql.txt"

View File

@@ -2,9 +2,6 @@
" Setup: {{{1 " Setup: {{{1
function! tutor#SetupVim() function! tutor#SetupVim()
if &columns < 90
set columns=90
endif
if !exists('g:did_load_ftplugin') || g:did_load_ftplugin != 1 if !exists('g:did_load_ftplugin') || g:did_load_ftplugin != 1
filetype plugin on filetype plugin on
endif endif
@@ -15,30 +12,17 @@ function! tutor#SetupVim()
endif endif
endfunction endfunction
" Mappings: {{{1 " Loads metadata file, if available
function! tutor#LoadMetadata()
function! s:CheckMaps() let b:tutor_metadata = json_decode(join(readfile(expand('%').'.json'), "\n"))
nmap
endfunction endfunction
function! s:MapKeyWithRedirect(key, cmd) " Mappings: {{{1
if maparg(a:key) !=# ''
redir => l:keys
silent call s:CheckMaps()
redir END
let l:key_list = split(l:keys, '\n')
let l:raw_map = filter(copy(l:key_list), "v:val =~# '\\* ".a:key."'") function! tutor#SetNormalMappings()
if len(l:raw_map) == 0 nnoremap <silent> <buffer> <CR> :call tutor#FollowLink(0)<cr>
exe "nnoremap <buffer> <expr> ".a:key." ".a:cmd nnoremap <silent> <buffer> <2-LeftMouse> :call tutor#MouseDoubleClick()<cr>
return nnoremap <buffer> >> :call tutor#InjectCommand()<cr>
endif
let l:map_data = split(l:raw_map[0], '\s*')
exe "nnoremap <buffer> <expr> ".l:map_data[0]." ".a:cmd
else
exe "nnoremap <buffer> <expr> ".a:key." ".a:cmd
endif
endfunction endfunction
function! tutor#MouseDoubleClick() function! tutor#MouseDoubleClick()
@@ -46,7 +30,7 @@ function! tutor#MouseDoubleClick()
normal! zo normal! zo
else else
if match(getline('.'), '^#\{1,} ') > -1 if match(getline('.'), '^#\{1,} ') > -1
normal! zc silent normal! zc
else else
call tutor#FollowLink(0) call tutor#FollowLink(0)
endif endif
@@ -59,114 +43,6 @@ function! tutor#InjectCommand()
redraw | echohl WarningMsg | echon "tutor: ran" | echohl None | echon " " | echohl Statement | echon l:cmd redraw | echohl WarningMsg | echon "tutor: ran" | echohl None | echon " " | echohl Statement | echon l:cmd
endfunction endfunction
function! tutor#SetNormalMappings()
call s:MapKeyWithRedirect('l', 'tutor#ForwardSkipConceal(v:count1)')
call s:MapKeyWithRedirect('h', 'tutor#BackwardSkipConceal(v:count1)')
call s:MapKeyWithRedirect('<right>', 'tutor#ForwardSkipConceal(v:count1)')
call s:MapKeyWithRedirect('<left>', 'tutor#BackwardSkipConceal(v:count1)')
nnoremap <silent> <buffer> <CR> :call tutor#FollowLink(0)<cr>
nnoremap <silent> <buffer> <2-LeftMouse> :call tutor#MouseDoubleClick()<cr>
nnoremap <buffer> >> :call tutor#InjectCommand()<cr>
endfunction
function! tutor#SetSampleTextMappings()
noremap <silent> <buffer> A :if match(getline('.'), '^--->') > -1 \| call search('\s{\@=', 'Wc') \| startinsert \| else \| startinsert! \| endif<cr>
noremap <silent> <buffer> $ :if match(getline('.'), '^--->') > -1 \| call search('.\s{\@=', 'Wc') \| else \| call search('$', 'Wc') \| endif<cr>
onoremap <silent> <buffer> $ :if match(getline('.'), '^--->') > -1 \| call search('.\s{\@=', 'Wc') \| else \| call search('$', 'Wc') \| endif<cr>
noremap <silent> <buffer> ^ :if match(getline('.'), '^--->') > -1 \| call search('\(--->\s\)\@<=.', 'bcW') \| else \| call search('^', 'bcW') \|endif<cr>
onoremap <silent> <buffer> ^ :if match(getline('.'), '^--->') > -1 \| call search('\(--->\s\)\@<=.', 'bcW') \| else \| call search('^', 'bcW') \|endif<cr>
nmap <silent> <buffer> 0 ^<esc>
nmap <silent> <buffer> <Home> ^<esc>
nmap <silent> <buffer> <End> $
imap <silent> <buffer> <Home> <esc>^<esc>:startinsert<cr>
imap <silent> <buffer> <End> <esc>$:startinsert<cr>
noremap <silent> <buffer> I :exe "normal! 0" \| startinsert<cr>
endfunction
" Navigation: {{{1
" taken from http://stackoverflow.com/a/24224578
function! tutor#ForwardSkipConceal(count)
let cnt=a:count
let mvcnt=0
let c=col('.')
let l=line('.')
let lc=col('$')
let line=getline('.')
while cnt
if c>=lc
let mvcnt+=cnt
break
endif
if stridx(&concealcursor, 'n')==-1
let isconcealed=0
else
let [isconcealed, cchar, group] = synconcealed(l, c)
endif
if isconcealed
let cnt-=strchars(cchar)
let oldc=c
let c+=1
while c < lc
let [isconcealed2, cchar2, group2] = synconcealed(l, c)
if !isconcealed2 || cchar2 != cchar
break
endif
let c+= 1
endwhile
let mvcnt+=strchars(line[oldc-1:c-2])
else
let cnt-=1
let mvcnt+=1
let c+=len(matchstr(line[c-1:], '.'))
endif
endwhile
return mvcnt.'l'
endfunction
function! tutor#BackwardSkipConceal(count)
let cnt=a:count
let mvcnt=0
let c=col('.')
let l=line('.')
let lc=0
let line=getline('.')
while cnt
if c<=1
let mvcnt+=cnt
break
endif
if stridx(&concealcursor, 'n')==-1 || c == 0
let isconcealed=0
else
let [isconcealed, cchar, group]=synconcealed(l, c-1)
endif
if isconcealed
let cnt-=strchars(cchar)
let oldc=c
let c-=1
while c>1
let [isconcealed2, cchar2, group2] = synconcealed(l, c-1)
if !isconcealed2 || cchar2 != cchar
break
endif
let c-=1
endwhile
let c = max([c, 1])
let mvcnt+=strchars(line[c-1:oldc-2])
else
let cnt-=1
let mvcnt+=1
let c-=len(matchstr(line[:c-2], '.$'))
endif
endwhile
return mvcnt.'h'
endfunction
" Hypertext: {{{1
function! tutor#FollowLink(force) function! tutor#FollowLink(force)
let l:stack_s = join(map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")'), '') let l:stack_s = join(map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")'), '')
if l:stack_s =~# 'tutorLink' if l:stack_s =~# 'tutorLink'
@@ -209,42 +85,40 @@ function! tutor#InfoText()
return join(l:info_parts, " ") return join(l:info_parts, " ")
endfunction endfunction
" Marks {{{1
function! tutor#PlaceXMarks() " Marks: {{{1
call cursor(1, 1)
let b:tutor_sign_id = 1 function! tutor#ApplyMarks()
while search('^--->', 'W') > 0 hi! link tutorExpect Special
call tutor#CheckText(getline('.')) if exists('b:tutor_metadata') && has_key(b:tutor_metadata, 'expect')
let b:tutor_sign_id+=1 let b:tutor_sign_id = 1
endwhile for expct in keys(b:tutor_metadata['expect'])
call cursor(1, 1) let lnum = eval(expct)
call matchaddpos('tutorExpect', [lnum])
call tutor#CheckLine(lnum)
endfor
endif
endfunction endfunction
function! tutor#CheckText(text) function! tutor#ApplyMarksOnChanged()
if match(a:text, '{expect:ANYTHING}\s*$') == -1 if exists('b:tutor_metadata') && has_key(b:tutor_metadata, 'expect')
if match(getline('.'), '^--->\s*$') > -1 let lnum = line('.')
exe "sign place ".b:tutor_sign_id." line=".line('.')." name=tutorbad buffer=".bufnr('%') if index(keys(b:tutor_metadata['expect']), string(lnum)) > -1
else call tutor#CheckLine(lnum)
if match(getline('.'), '|expect:.\+|') == -1
let l:cur_text = matchstr(a:text, '---> \zs.\{-}\ze {expect:')
let l:expected_text = matchstr(a:text, '{expect:\zs.*\ze}\s*$')
else
let l:cur_text = matchstr(a:text, '---> \zs.\{-}\ze |expect:')
let l:expected_text = matchstr(a:text, '|expect:\zs.*\ze|\s*$')
endif
if l:cur_text ==# l:expected_text
exe "sign place ".b:tutor_sign_id." line=".line('.')." name=tutorok buffer=".bufnr('%')
else
exe "sign place ".b:tutor_sign_id." line=".line('.')." name=tutorbad buffer=".bufnr('%')
endif
endif endif
endif endif
endfunction endfunction
function! tutor#OnTextChanged() function! tutor#CheckLine(line)
let l:text = getline('.') if exists('b:tutor_metadata') && has_key(b:tutor_metadata, 'expect')
if match(l:text, '^--->') > -1 let bufn = bufnr('%')
call tutor#CheckText(l:text) let ctext = getline(a:line)
if b:tutor_metadata['expect'][string(a:line)] == -1 || ctext ==# b:tutor_metadata['expect'][string(a:line)]
exe "sign place ".b:tutor_sign_id." line=".a:line." name=tutorok buffer=".bufn
else
exe "sign place ".b:tutor_sign_id." line=".a:line." name=tutorbad buffer=".bufn
endif
let b:tutor_sign_id+=1
endif endif
endfunction endfunction

View File

@@ -53,7 +53,6 @@
: scriptnames : scriptnames
:endif :endif
:set all :set all
:set termcap
:if has("autocmd") :if has("autocmd")
: au : au
:endif :endif

View File

@@ -1,7 +1,7 @@
" Vim compiler file " Vim compiler file
" Compiler: BDF to PCF Conversion " Compiler: BDF to PCF Conversion
" Maintainer: Nikolai Weibull <now@bitwi.se> " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2006-04-19 " Latest Revision: 2006-04-19
if exists("current_compiler") if exists("current_compiler")
finish finish

View File

@@ -0,0 +1,35 @@
" Vim compiler file
" Compiler: Cargo Compiler
" Maintainer: Damien Radtke <damienradtke@gmail.com>
" Latest Revision: 2014 Sep 24
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
if exists('current_compiler')
finish
endif
runtime compiler/rustc.vim
let current_compiler = "cargo"
let s:save_cpo = &cpo
set cpo&vim
if exists(':CompilerSet') != 2
command -nargs=* CompilerSet setlocal <args>
endif
if exists('g:cargo_makeprg_params')
execute 'CompilerSet makeprg=cargo\ '.escape(g:cargo_makeprg_params, ' \|"').'\ $*'
else
CompilerSet makeprg=cargo\ $*
endif
" Ignore general cargo progress messages
CompilerSet errorformat+=
\%-G%\\s%#Downloading%.%#,
\%-G%\\s%#Compiling%.%#,
\%-G%\\s%#Finished%.%#,
\%-G%\\s%#error:\ Could\ not\ compile\ %.%#,
\%-G%\\s%#To\ learn\ more\\,%.%#
let &cpo = s:save_cpo
unlet s:save_cpo

View File

@@ -1,7 +1,7 @@
" Vim compiler file " Vim compiler file
" Compiler: GNU C Compiler " Compiler: GNU C Compiler
" Maintainer: Nikolai Weibull <now@bitwi.se> " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2010-10-14 " Latest Revision: 2010-10-14
" added line suggested by Anton Lindqvist 2016 Mar 31 " added line suggested by Anton Lindqvist 2016 Mar 31
if exists("current_compiler") if exists("current_compiler")

View File

@@ -1,7 +1,8 @@
" Vim compiler file " Vim compiler file
" Compiler: reStructuredText Documentation Format " Compiler: sphinx >= 1.0.8, http://www.sphinx-doc.org
" Maintainer: Nikolai Weibull <now@bitwi.se> " Description: reStructuredText Documentation Format
" Latest Revision: 2006-04-19 " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2017-03-31
if exists("current_compiler") if exists("current_compiler")
finish finish
@@ -11,12 +12,18 @@ let current_compiler = "rst"
let s:cpo_save = &cpo let s:cpo_save = &cpo
set cpo&vim set cpo&vim
setlocal errorformat= if exists(":CompilerSet") != 2
\%f:%l:\ (%tEBUG/0)\ %m, command -nargs=* CompilerSet setlocal <args>
\%f:%l:\ (%tNFO/1)\ %m, endif
\%f:%l:\ (%tARNING/2)\ %m,
\%f:%l:\ (%tRROR/3)\ %m, CompilerSet errorformat=
\%f:%l:\ (%tEVERE/3)\ %m, \%f\\:%l:\ %tEBUG:\ %m,
\%f\\:%l:\ %tNFO:\ %m,
\%f\\:%l:\ %tARNING:\ %m,
\%f\\:%l:\ %tRROR:\ %m,
\%f\\:%l:\ %tEVERE:\ %m,
\%f\\:%s:\ %tARNING:\ %m,
\%f\\:%s:\ %tRROR:\ %m,
\%D%*\\a[%*\\d]:\ Entering\ directory\ `%f', \%D%*\\a[%*\\d]:\ Entering\ directory\ `%f',
\%X%*\\a[%*\\d]:\ Leaving\ directory\ `%f', \%X%*\\a[%*\\d]:\ Leaving\ directory\ `%f',
\%DMaking\ %*\\a\ in\ %f \%DMaking\ %*\\a\ in\ %f

View File

@@ -0,0 +1,46 @@
" Vim compiler file
" Compiler: Rust Compiler
" Maintainer: Chris Morgan <me@chrismorgan.info>
" Latest Revision: 2013 Jul 12
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
if exists("current_compiler")
finish
endif
let current_compiler = "rustc"
let s:cpo_save = &cpo
set cpo&vim
if exists(":CompilerSet") != 2
command -nargs=* CompilerSet setlocal <args>
endif
if exists("g:rustc_makeprg_no_percent") && g:rustc_makeprg_no_percent != 0
CompilerSet makeprg=rustc
else
CompilerSet makeprg=rustc\ \%
endif
" Old errorformat (before nightly 2016/08/10)
CompilerSet errorformat=
\%f:%l:%c:\ %t%*[^:]:\ %m,
\%f:%l:%c:\ %*\\d:%*\\d\ %t%*[^:]:\ %m,
\%-G%f:%l\ %s,
\%-G%*[\ ]^,
\%-G%*[\ ]^%*[~],
\%-G%*[\ ]...
" New errorformat (after nightly 2016/08/10)
CompilerSet errorformat+=
\%-G,
\%-Gerror:\ aborting\ %.%#,
\%-Gerror:\ Could\ not\ compile\ %.%#,
\%Eerror:\ %m,
\%Eerror[E%n]:\ %m,
\%Wwarning:\ %m,
\%Inote:\ %m,
\%C\ %#-->\ %f:%l:%c
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@@ -7,11 +7,11 @@
Nvim API *API* *api* Nvim API *API* *api*
Nvim exposes a powerful API that can be used by plugins and external processes Nvim exposes a powerful API that can be used by plugins and external processes
via |msgpack-rpc|, Lua and VimL (|eval-api|). via |RPC|, |Lua| and VimL (|eval-api|).
Applications can also embed libnvim to work with the C API directly. Applications can also embed libnvim to work with the C API directly.
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
API Types *api-types* API Types *api-types*
@@ -48,7 +48,8 @@ version.api_compatible API is backwards-compatible with this level
version.api_prerelease Declares the current API level as unstable > version.api_prerelease Declares the current API level as unstable >
(version.api_prerelease && fn.since == version.api_level) (version.api_prerelease && fn.since == version.api_level)
functions API function signatures functions API function signatures
ui_events UI event signatures |rpc-remote-ui| ui_events UI event signatures |ui|
ui_options Supported |ui-options|
{fn}.since API level where function {fn} was introduced {fn}.since API level where function {fn} was introduced
{fn}.deprecated_since API level where function {fn} was deprecated {fn}.deprecated_since API level where function {fn} was deprecated
types Custom handle types defined by Nvim types Custom handle types defined by Nvim
@@ -60,8 +61,7 @@ External programs ("clients") can use the metadata to discover the |rpc-api|.
API contract *api-contract* API contract *api-contract*
The API is made of functions and events. Clients call functions like those The API is made of functions and events. Clients call functions like those
described at |api-global|, and may "attach" in order to receive rich events, described at |api-global|, and may "attach" to receive rich |ui-events|.
described at |rpc-remote-ui|.
As Nvim develops, its API may change only according the following "contract": As Nvim develops, its API may change only according the following "contract":
@@ -135,6 +135,26 @@ nvim_command({command}) *nvim_command()*
Parameters:~ Parameters:~
{command} Ex-command string {command} Ex-command string
nvim_get_hl_by_name({name}, {rgb}) *nvim_get_hl_by_name()*
Gets a highlight definition by name.
Parameters:~
{name} Highlight group name
{rgb} Export RGB colors
Return:~
Highlight definition map
nvim_get_hl_by_id({hl_id}, {rgb}) *nvim_get_hl_by_id()*
Gets a highlight definition by id. |hlID()|
Parameters:~
{hl_id} Highlight id as returned by |hlID()|
{rgb} Export RGB colors
Return:~
Highlight definition map
nvim_feedkeys({keys}, {mode}, {escape_csi}) *nvim_feedkeys()* nvim_feedkeys({keys}, {mode}, {escape_csi}) *nvim_feedkeys()*
Passes input keys to Nvim. On VimL error: Does not fail, but Passes input keys to Nvim. On VimL error: Does not fail, but
updates v:errmsg. updates v:errmsg.
@@ -151,7 +171,11 @@ nvim_input({keys}) *nvim_input()*
Unlike `nvim_feedkeys`, this uses a lower-level input buffer Unlike `nvim_feedkeys`, this uses a lower-level input buffer
and the call is not deferred. This is the most reliable way to and the call is not deferred. This is the most reliable way to
emulate real user input. send real user input.
Note:
|keycodes| like <CR> are translated, so "<" is special. To
input a literal "<", send <LT>.
Attributes:~ Attributes:~
{async} {async}
@@ -165,7 +189,16 @@ nvim_input({keys}) *nvim_input()*
*nvim_replace_termcodes()* *nvim_replace_termcodes()*
nvim_replace_termcodes({str}, {from_part}, {do_lt}, {special}) nvim_replace_termcodes({str}, {from_part}, {do_lt}, {special})
Replaces any terminal codes with the internal representation Replaces terminal codes and |keycodes| (<CR>, <Esc>, ...) in a
string with the internal representation.
Parameters:~
{str} String to be converted.
{from_part} Legacy Vim parameter. Usually true.
{do_lt} Also translate <lt>. Ignored if `special` is
false.
{special} Replace |keycodes|, e.g. <CR> becomes a "\n"
char.
nvim_command_output({str}) *nvim_command_output()* nvim_command_output({str}) *nvim_command_output()*
TODO: Documentation TODO: Documentation
@@ -182,8 +215,10 @@ nvim_eval({expr}) *nvim_eval()*
Evaluation result or expanded object Evaluation result or expanded object
nvim_call_function({fname}, {args}) *nvim_call_function()* nvim_call_function({fname}, {args}) *nvim_call_function()*
Calls a VimL function with the given arguments. On VimL error: Calls a VimL function with the given arguments
Returns a generic error; v:errmsg is not updated.
On VimL error: Returns a generic error; v:errmsg is not
updated.
Parameters:~ Parameters:~
{fname} Function to call {fname} Function to call
@@ -192,7 +227,21 @@ nvim_call_function({fname}, {args}) *nvim_call_function()*
Return:~ Return:~
Result of the function call Result of the function call
nvim_strwidth({str}) *nvim_strwidth()* nvim_execute_lua({code}, {args}) *nvim_execute_lua()*
Execute lua code. Parameters (if any) are available as `...`
inside the chunk. The chunk can return a value.
Only statements are executed. To evaluate an expression,
prefix it with `return`: return my_function(...)
Parameters:~
{code} lua code to execute
{args} Arguments to the code
Return:~
Return value of lua code if present or NIL.
nvim_strwidth({text}) *nvim_strwidth()*
Calculates the number of display cells occupied by `text`. Calculates the number of display cells occupied by `text`.
<Tab> counts as one cell. <Tab> counts as one cell.
@@ -281,20 +330,24 @@ nvim_set_option({name}, {value}) *nvim_set_option()*
{value} New option value {value} New option value
nvim_out_write({str}) *nvim_out_write()* nvim_out_write({str}) *nvim_out_write()*
Writes a message to vim output buffer Writes a message to the Vim output buffer. Does not append
"\n", the message is buffered (won't display) until a linefeed
is written.
Parameters:~ Parameters:~
{str} Message {str} Message
nvim_err_write({str}) *nvim_err_write()* nvim_err_write({str}) *nvim_err_write()*
Writes a message to vim error buffer Writes a message to the Vim error buffer. Does not append
"\n", the message is buffered (won't display) until a linefeed
is written.
Parameters:~ Parameters:~
{str} Message {str} Message
nvim_err_writeln({str}) *nvim_err_writeln()* nvim_err_writeln({str}) *nvim_err_writeln()*
Writes a message to vim error buffer. Appends a linefeed to Writes a message to the Vim error buffer. Appends "\n", so the
ensure all contents are written. buffer is flushed (and displayed).
Parameters:~ Parameters:~
{str} Message {str} Message
@@ -315,7 +368,7 @@ nvim_set_current_buf({buffer}) *nvim_set_current_buf()*
Sets the current buffer Sets the current buffer
Parameters:~ Parameters:~
{id} Buffer handle {buffer} Buffer handle
nvim_list_wins() *nvim_list_wins()* nvim_list_wins() *nvim_list_wins()*
Gets the current list of window handles Gets the current list of window handles
@@ -333,7 +386,7 @@ nvim_set_current_win({window}) *nvim_set_current_win()*
Sets the current window Sets the current window
Parameters:~ Parameters:~
{handle} Window handle {window} Window handle
nvim_list_tabpages() *nvim_list_tabpages()* nvim_list_tabpages() *nvim_list_tabpages()*
Gets the current list of tabpage handles Gets the current list of tabpage handles
@@ -351,7 +404,7 @@ nvim_set_current_tabpage({tabpage}) *nvim_set_current_tabpage()*
Sets the current tabpage Sets the current tabpage
Parameters:~ Parameters:~
{handle} Tabpage handle {tabpage} Tabpage handle
nvim_subscribe({event}) *nvim_subscribe()* nvim_subscribe({event}) *nvim_subscribe()*
Subscribes to event broadcasts Subscribes to event broadcasts
@@ -372,18 +425,32 @@ nvim_get_color_map() *nvim_get_color_map()*
TODO: Documentation TODO: Documentation
nvim_get_mode() *nvim_get_mode()* nvim_get_mode() *nvim_get_mode()*
Gets the current mode. Gets the current mode. |mode()| "blocking" is true if Nvim is
mode: Mode string. |mode()| waiting for input.
blocking: true if Nvim is waiting for input.
Attributes:~
{async}
Return:~ Return:~
Dictionary { "mode": String, "blocking": Boolean } Dictionary { "mode": String, "blocking": Boolean }
Attributes:~
{async}
nvim_get_keymap({mode}) *nvim_get_keymap()*
Gets a list of dictionaries describing global (non-buffer)
mappings. The "buffer" key in the returned dictionary is
always zero.
Parameters:~
{mode} Mode short-name ("n", "i", "v", ...)
Return:~
Array of maparg()-like dictionaries describing mappings
nvim_get_api_info() *nvim_get_api_info()* nvim_get_api_info() *nvim_get_api_info()*
TODO: Documentation Returns a 2-tuple (Array), where item 0 is the current channel
id and item 1 is the |api-metadata| map (Dictionary).
Return:~
2-tuple [{channel-id}, {api-metadata}]
Attributes:~ Attributes:~
{async} {async}
@@ -414,6 +481,132 @@ nvim_call_atomic({calls}) *nvim_call_atomic()*
error ocurred, the values from all preceding calls will error ocurred, the values from all preceding calls will
still be returned. still be returned.
*nvim_parse_expression()*
nvim_parse_expression({expr}, {flags}, {highlight})
Parse a VimL expression
Attributes:~
{async}
Parameters:~
{expr} Expression to parse. Is always treated as a
single line.
{flags} Flags: - "m" if multiple expressions in a
row are allowed (only the first one will be
parsed), - "E" if EOC tokens are not allowed
(determines whether they will stop parsing
process or be recognized as an
operator/space, though also yielding an
error). - "l" when needing to start parsing
with lvalues for ":let" or ":for". Common
flag sets: - "m" to parse like for ":echo". -
"E" to parse like for "<C-r>=". - empty
string for ":call". - "lm" to parse for
":let".
{highlight} If true, return value will also include
"highlight" key containing array of 4-tuples
(arrays) (Integer, Integer, Integer, String),
where first three numbers define the
highlighted region and represent line,
starting column and ending column (latter
exclusive: one should highlight region
[start_col, end_col)).
Return:~
AST: top-level dictionary with these keys: "error":
Dictionary with error, present only if parser saw some
error. Contains the following keys: "message": String,
error message in printf format, translated. Must contain
exactly one "%.*s". "arg": String, error message argument.
"len": Amount of bytes successfully parsed. With flags
equal to "" that should be equal to the length of expr
string. @note: “Sucessfully parsed” here means
“participated in AST creation”, not “till the first
error”. "ast": AST, either nil or a dictionary with these
keys: "type": node type, one of the value names from
ExprASTNodeType stringified without "kExprNode" prefix.
"start": a pair [line, column] describing where node is
“started” where "line" is always 0 (will not be 0 if you
will be using nvim_parse_viml() on e.g. ":let", but that
is not present yet). Both elements are Integers. "len":
“length” of the node. This and "start" are there for
debugging purposes primary (debugging parser and providing
debug information). "children": a list of nodes described
in top/"ast". There always is zero, one or two children,
key will not be present if node has no children. Maximum
number of children may be found in node_maxchildren array.
Local values (present only for certain nodes): "scope": a
single Integer, specifies scope for "Option" and
"PlainIdentifier" nodes. For "Option" it is one of
ExprOptScope values, for "PlainIdentifier" it is one of
ExprVarScope values. "ident": identifier (without scope,
if any), present for "Option", "PlainIdentifier",
"PlainKey" and "Environment" nodes. "name": Integer,
register name (one character) or -1. Only present for
"Register" nodes. "cmp_type": String, comparison type, one
of the value names from ExprComparisonType, stringified
without "kExprCmp" prefix. Only present for "Comparison"
nodes. "ccs_strategy": String, case comparison strategy,
one of the value names from ExprCaseCompareStrategy,
stringified without "kCCStrategy" prefix. Only present for
"Comparison" nodes. "augmentation": String, augmentation
type for "Assignment" nodes. Is either an empty string,
"Add", "Subtract" or "Concat" for "=", "+=", "-=" or ".="
respectively. "invert": Boolean, true if result of
comparison needs to be inverted. Only present for
"Comparison" nodes. "ivalue": Integer, integer value for
"Integer" nodes. "fvalue": Float, floating-point value for
"Float" nodes. "svalue": String, value for
"SingleQuotedString" and "DoubleQuotedString" nodes.
nvim__id({obj}) *nvim__id()*
Returns object given as argument
This API function is used for testing. One should not rely on
its presence in plugins.
Parameters:~
{obj} Object to return.
Return:~
its argument.
nvim__id_array({arr}) *nvim__id_array()*
Returns array given as argument
This API function is used for testing. One should not rely on
its presence in plugins.
Parameters:~
{arr} Array to return.
Return:~
its argument.
nvim__id_dictionary({dct}) *nvim__id_dictionary()*
Returns dictionary given as argument
This API function is used for testing. One should not rely on
its presence in plugins.
Parameters:~
{dct} Dictionary to return.
Return:~
its argument.
nvim__id_float({flt}) *nvim__id_float()*
Returns floating-point value given as argument
This API function is used for testing. One should not rely on
its presence in plugins.
Parameters:~
{flt} Value to return.
Return:~
its argument.
============================================================================== ==============================================================================
Buffer Functions *api-buffer* Buffer Functions *api-buffer*
@@ -492,6 +685,18 @@ nvim_buf_get_changedtick({buffer}) *nvim_buf_get_changedtick()*
Return:~ Return:~
b:changedtickvalue. b:changedtickvalue.
nvim_buf_get_keymap({buffer}, {mode}) *nvim_buf_get_keymap()*
Gets a list of dictionaries describing buffer-local mappings.
The "buffer" key in the returned dictionary reflects the
buffer handle where the mapping is present.
Parameters:~
{mode} Mode short-name ("n", "i", "v", ...)
{buffer} Buffer handle
Return:~
Array of maparg()-like dictionaries describing mappings
nvim_buf_set_var({buffer}, {name}, {value}) *nvim_buf_set_var()* nvim_buf_set_var({buffer}, {name}, {value}) *nvim_buf_set_var()*
Sets a buffer-scoped (b:) variable Sets a buffer-scoped (b:) variable
@@ -567,24 +772,24 @@ nvim_buf_add_highlight({buffer}, {src_id}, {hl_group}, {line},
{col_start}, {col_end}) {col_start}, {col_end})
Adds a highlight to buffer. Adds a highlight to buffer.
This can be used for plugins which dynamically generate Useful for plugins that dynamically generate highlights to a
highlights to a buffer (like a semantic highlighter or buffer (like a semantic highlighter or linter). The function
linter). The function adds a single highlight to a buffer. adds a single highlight to a buffer. Unlike matchaddpos()
Unlike matchaddpos() highlights follow changes to line highlights follow changes to line numbering (as lines are
numbering (as lines are inserted/removed above the highlighted inserted/removed above the highlighted line), like signs and
line), like signs and marks do. marks do.
"src_id" is useful for batch deletion/updating of a set of `src_id` is useful for batch deletion/updating of a set of
highlights. When called with src_id = 0, an unique source id highlights. When called with `src_id = 0`, an unique source id
is generated and returned. Succesive calls can pass in it as is generated and returned. Successive calls can pass that
"src_id" to add new highlights to the same source group. All `src_id` to associate new highlights with the same source
highlights in the same group can then be cleared with group. All highlights in the same group can be cleared with
nvim_buf_clear_highlight. If the highlight never will be `nvim_buf_clear_highlight`. If the highlight never will be
manually deleted pass in -1 for "src_id". manually deleted, pass `src_id = -1`.
If "hl_group" is the empty string no highlight is added, but a If `hl_group` is the empty string no highlight is added, but a
new src_id is still returned. This is useful for an external new `src_id` is still returned. This is useful for an external
plugin to synchrounously request an unique src_id at plugin to synchrounously request an unique `src_id` at
initialization, and later asynchronously add and clear initialization, and later asynchronously add and clear
highlights in response to buffer changes. highlights in response to buffer changes.
@@ -593,10 +798,11 @@ nvim_buf_add_highlight({buffer}, {src_id}, {hl_group}, {line},
{src_id} Source group to use or 0 to use a new group, {src_id} Source group to use or 0 to use a new group,
or -1 for ungrouped highlight or -1 for ungrouped highlight
{hl_group} Name of the highlight group to use {hl_group} Name of the highlight group to use
{line} Line to highlight {line} Line to highlight (zero-indexed)
{col_start} Start of range of columns to highlight {col_start} Start of (byte-indexed) column range to
{col_end} End of range of columns to highlight, or -1 highlight
to highlight to end of line {col_end} End of (byte-indexed) column range to
highlight, or -1 to highlight to end of line
Return:~ Return:~
The src_id that was used The src_id that was used
@@ -830,9 +1036,6 @@ nvim_tabpage_is_valid({tabpage}) *nvim_tabpage_is_valid()*
============================================================================== ==============================================================================
UI Functions *api-ui* UI Functions *api-ui*
remote_ui_disconnect() *remote_ui_disconnect()*
TODO: Documentation
nvim_ui_attach({width}, {height}, {options}) *nvim_ui_attach()* nvim_ui_attach({width}, {height}, {options}) *nvim_ui_attach()*
TODO: Documentation TODO: Documentation

View File

@@ -36,7 +36,7 @@ the user interface remains the standard Vi interface.
Highlights Highlights
---------- ----------
o Editing left-to-right files as in the original VIM hasn't changed. o Editing left-to-right files as in the original Vim hasn't changed.
o Viewing and editing files in right-to-left windows. File o Viewing and editing files in right-to-left windows. File
orientation is per window, so it is possible to view the same orientation is per window, so it is possible to view the same
@@ -46,7 +46,7 @@ o No special terminal with right-to-left capabilities is required.
The right-to-left changes are completely hardware independent. The right-to-left changes are completely hardware independent.
Only Arabic fonts are necessary. Only Arabic fonts are necessary.
o Compatible with the original VIM. Almost all features work in o Compatible with the original Vim. Almost all features work in
right-to-left mode (there are liable to be bugs). right-to-left mode (there are liable to be bugs).
o Changing keyboard mapping and reverse insert modes using a single o Changing keyboard mapping and reverse insert modes using a single
@@ -60,14 +60,14 @@ o While in Arabic mode, numbers are entered from left to right. Upon
o Arabic keymapping on the command line in reverse insert mode. o Arabic keymapping on the command line in reverse insert mode.
o Proper Bidirectional functionality is possible given VIM is o Proper Bidirectional functionality is possible given Vim is
started within a Bidi capable terminal emulator. started within a Bidi capable terminal emulator.
Arabic Fonts *arabicfonts* Arabic Fonts *arabicfonts*
------------ ------------
VIM requires monospaced fonts of which there are many out there. Vim requires monospaced fonts of which there are many out there.
Arabic requires ISO-8859-6 as well as Presentation Form-B fonts Arabic requires ISO-8859-6 as well as Presentation Form-B fonts
(without Form-B, Arabic will _NOT_ be usable). It is highly (without Form-B, Arabic will _NOT_ be usable). It is highly
recommended that users search for so-called 'ISO-10646-1' fonts. recommended that users search for so-called 'ISO-10646-1' fonts.
@@ -90,13 +90,13 @@ o Installation of fonts for X Window systems (Unix/Linux)
Usage Usage
----- -----
Prior to the actual usage of Arabic within VIM, a number of settings Prior to the actual usage of Arabic within Vim, a number of settings
need to be accounted for and invoked. need to be accounted for and invoked.
o Setting the Arabic fonts o Setting the Arabic fonts
+ For VIM GUI set the 'guifont' to your_ARABIC_FONT. This is done + For Vim GUI set the 'guifont' to your_ARABIC_FONT. This is done
by entering the following command in the VIM window. by entering the following command in the Vim window.
> >
:set guifont=your_ARABIC_FONT :set guifont=your_ARABIC_FONT
< <
@@ -109,7 +109,7 @@ o Setting the Arabic fonts
you can include ':set guifont=your_ARABIC_FONT' to your vimrc you can include ':set guifont=your_ARABIC_FONT' to your vimrc
file. file.
+ Under the X Window environment, you can also start VIM with + Under the X Window environment, you can also start Vim with
'-fn your_ARABIC_FONT' option. '-fn your_ARABIC_FONT' option.
o Setting the appropriate character Encoding o Setting the appropriate character Encoding
@@ -131,11 +131,11 @@ o Setting the appropriate character Encoding
o Enable Arabic settings [short-cut] o Enable Arabic settings [short-cut]
In order to simplify and streamline things, you can either invoke In order to simplify and streamline things, you can either invoke
VIM with the command-line option, Vim with the command-line option,
% vim -A my_utf8_arabic_file ... % vim -A my_utf8_arabic_file ...
or enable 'arabic' via the following command within VIM or enable 'arabic' via the following command within Vim
> >
:set arabic :set arabic
< <
@@ -196,7 +196,7 @@ o Enable Arabic settings [short-cut]
+ Arabic deletion of a combined pair character + Arabic deletion of a combined pair character
By default VIM has the 'delcombine' option disabled. This option By default Vim has the 'delcombine' option disabled. This option
allows the deletion of ALEF in a LAM_ALEF (LAA) combined character allows the deletion of ALEF in a LAM_ALEF (LAA) combined character
and still retain the LAM (i.e. it reverts to treating the combined and still retain the LAM (i.e. it reverts to treating the combined
character as its natural two characters form -- this also pertains character as its natural two characters form -- this also pertains
@@ -255,7 +255,7 @@ o Enable Arabic settings [short-cut]
Keymap/Keyboard *arabickeymap* Keymap/Keyboard *arabickeymap*
--------------- ---------------
The character/letter encoding used in VIM is the standard UTF-8. The character/letter encoding used in Vim is the standard UTF-8.
It is widely discouraged that any other encoding be used or even It is widely discouraged that any other encoding be used or even
attempted. attempted.
@@ -288,7 +288,7 @@ o Keyboard
Restrictions Restrictions
------------ ------------
o VIM in its GUI form does not currently support Bi-directionality o Vim in its GUI form does not currently support Bi-directionality
(i.e. the ability to see both Arabic and Latin intermixed within (i.e. the ability to see both Arabic and Latin intermixed within
the same line). the same line).

View File

@@ -8,7 +8,7 @@ Automatic commands *autocommand*
For a basic explanation, see section |40.3| in the user manual. For a basic explanation, see section |40.3| in the user manual.
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Introduction *autocmd-intro* 1. Introduction *autocmd-intro*
@@ -55,7 +55,14 @@ Note: The ":autocmd" command can only be followed by another command when the
'|' appears before {cmd}. This works: > '|' appears before {cmd}. This works: >
:augroup mine | au! BufRead | augroup END :augroup mine | au! BufRead | augroup END
But this sees "augroup" as part of the defined command: > But this sees "augroup" as part of the defined command: >
:augroup mine | au! BufRead * | augroup END
:augroup mine | au BufRead * set tw=70 | augroup END :augroup mine | au BufRead * set tw=70 | augroup END
Instead you can put the group name into the command: >
:au! mine BufRead *
:au mine BufRead * set tw=70
Or use `:execute`: >
:augroup mine | exe "au! BufRead *" | augroup END
:augroup mine | exe "au BufRead * set tw=70" | augroup END
Note that special characters (e.g., "%", "<cword>") in the ":autocmd" Note that special characters (e.g., "%", "<cword>") in the ":autocmd"
arguments are not expanded when the autocommand is defined. These will be arguments are not expanded when the autocommand is defined. These will be
@@ -252,13 +259,12 @@ Name triggered by ~
|BufNew| just after creating a new buffer |BufNew| just after creating a new buffer
|SwapExists| detected an existing swap file |SwapExists| detected an existing swap file
|TermOpen| when a terminal buffer is starting |TermOpen| when a terminal job starts
|TermClose| when a terminal buffer ends |TermClose| when a terminal job ends
Options Options
|FileType| when the 'filetype' option has been set |FileType| when the 'filetype' option has been set
|Syntax| when the 'syntax' option has been set |Syntax| when the 'syntax' option has been set
|TermChanged| after the value of 'term' has changed
|OptionSet| after setting any option |OptionSet| after setting any option
Startup and exit Startup and exit
@@ -303,6 +309,8 @@ Name triggered by ~
|TabNew| when creating a new tab page |TabNew| when creating a new tab page
|TabNewEntered| after entering a new tab page |TabNewEntered| after entering a new tab page
|TabClosed| after closing a tab page |TabClosed| after closing a tab page
|CmdlineEnter| after entering cmdline mode
|CmdlineLeave| before leaving cmdline mode
|CmdwinEnter| after entering the command-line window |CmdwinEnter| after entering the command-line window
|CmdwinLeave| before leaving the command-line window |CmdwinLeave| before leaving the command-line window
@@ -485,6 +493,28 @@ CmdUndefined When a user command is used but it isn't
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
invoke an autoloaded function. See |autoload|. invoke an autoloaded function. See |autoload|.
*CmdlineEnter*
CmdlineEnter After moving the cursor to the command line,
where the user can type a command or search
string.
<afile> is set to a single character,
indicating the type of command-line.
|cmdline-char|
Sets these |v:event| keys:
cmdlevel
cmdtype
*CmdlineLeave*
CmdlineLeave Before leaving the command line.
<afile> is set to a single character,
indicating the type of command-line.
|cmdline-char|
Sets these |v:event| keys:
abort (mutable)
cmdlevel
cmdtype
Note: `abort` can only be changed from false
to true. An autocmd cannot execute an already
aborted 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
@@ -605,7 +635,7 @@ FileChangedShell When Vim notices that the modification time of
|timestamp| |timestamp|
Mostly triggered after executing a shell Mostly triggered after executing a shell
command, but also with a |:checktime| command command, but also with a |:checktime| command
or when Gvim regains input focus. or when gvim regains input focus.
This autocommand is triggered for each changed This autocommand is triggered for each changed
file. It is not used when 'autoread' is set file. It is not used when 'autoread' is set
and the buffer was not changed. If a and the buffer was not changed. If a
@@ -616,7 +646,7 @@ FileChangedShell When Vim notices that the modification time of
to tell Vim what to do next. to tell Vim what to do next.
NOTE: When this autocommand is executed, the NOTE: When this autocommand is executed, the
current buffer "%" may be different from the current buffer "%" may be different from the
buffer that was changed "<afile>". buffer that was changed, which is in "<afile>".
NOTE: The commands must not change the current NOTE: The commands must not change the current
buffer, jump to another buffer or delete a buffer, jump to another buffer or delete a
buffer. *E246* *E811* buffer. *E246* *E811*
@@ -643,7 +673,8 @@ 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> can be used for the name of the file
where this option was set, and <amatch> for where this option was set, and <amatch> for
the new value of 'filetype'. the new value of 'filetype'. Navigating to
another window or buffer is not allowed.
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
@@ -901,26 +932,20 @@ TabEnter Just after entering a tab page. |tab-page|
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 A WinLeave event will have been triggered
first. first.
{Nvim} *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 and before TabEnter.
{Nvim} *TabNewEntered* *TabNewEntered*
TabNewEntered After entering a new tab page. |tab-page| TabNewEntered After entering a new tab page. |tab-page|
After BufEnter. After BufEnter.
{Nvim} *TabClosed* *TabClosed*
TabClosed After closing a tab page. <afile> can be used TabClosed After closing a tab page. <afile> can be used
for the tab page number. for the tab page number.
*TermChanged* *TermClose*
TermChanged After the value of 'term' has changed. Useful TermClose When a |terminal| job ends.
for re-loading the syntax file to update the *TermOpen*
colors, fonts and other terminal-dependent TermOpen When a |terminal| job is starting. Can be
settings. Executed for all loaded buffers. used to configure the terminal buffer.
{Nvim} *TermClose*
TermClose When a terminal buffer ends.
{Nvim} *TermOpen*
TermOpen When a terminal buffer is starting. This can
be used to configure the terminal emulator by
setting buffer variables. |terminal-emulator|
*TermResponse* *TermResponse*
TermResponse After the response to |t_RV| is received from TermResponse After the response to |t_RV| is received from
the terminal. The value of |v:termresponse| the terminal. The value of |v:termresponse|
@@ -967,9 +992,9 @@ VimEnter After doing all the startup stuff, including
VimLeave Before exiting Vim, just after writing the VimLeave Before exiting Vim, just after writing the
.shada file. Executed only once, like .shada file. Executed only once, like
VimLeavePre. VimLeavePre.
To detect an abnormal exit use |v:dying|. < Use |v:dying| to detect an abnormal exit.
When v:dying is 2 or more this event is not Use |v:exiting| to get the exit code.
triggered. Not triggered if |v:dying| is 2 or more.
*VimLeavePre* *VimLeavePre*
VimLeavePre Before exiting Vim, just before writing the VimLeavePre Before exiting Vim, just before writing the
.shada file. This is executed only once, .shada file. This is executed only once,
@@ -977,9 +1002,9 @@ VimLeavePre Before exiting Vim, just before writing the
happens to be the current buffer when exiting. happens to be the current buffer when exiting.
Mostly useful with a "*" pattern. > Mostly useful with a "*" pattern. >
:autocmd VimLeavePre * call CleanupStuff() :autocmd VimLeavePre * call CleanupStuff()
< To detect an abnormal exit use |v:dying|. < Use |v:dying| to detect an abnormal exit.
When v:dying is 2 or more this event is not Use |v:exiting| to get the exit code.
triggered. Not triggered if |v:dying| is 2 or more.
*VimResized* *VimResized*
VimResized After the Vim window was resized, thus 'lines' VimResized After the Vim window was resized, thus 'lines'
and/or 'columns' changed. Not when starting and/or 'columns' changed. Not when starting

View File

@@ -11,7 +11,7 @@ commands with the "." command.
For inserting text see |insert.txt|. For inserting text see |insert.txt|.
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Deleting text *deleting* *E470* 1. Deleting text *deleting* *E470*
@@ -648,6 +648,7 @@ g& Synonym for `:%s//~/&` (repeat last substitute with
*:s_flags* *:s_flags*
The flags that you can use for the substitute commands: The flags that you can use for the substitute commands:
*:&&*
[&] Must be the first one: Keep the flags from the previous substitute [&] Must be the first one: Keep the flags from the previous substitute
command. Examples: > command. Examples: >
:&& :&&
@@ -861,8 +862,7 @@ Exceptions:
Substitute with an expression *sub-replace-expression* Substitute with an expression *sub-replace-expression*
*sub-replace-\=* *s/\=* *sub-replace-\=* *s/\=*
When the substitute string starts with "\=" the remainder is interpreted as an When the substitute string starts with "\=" the remainder is interpreted as an
expression. This does not work recursively: a |substitute()| function inside expression.
the expression cannot use "\=" for the substitute string.
The special meaning for characters as mentioned at |sub-replace-special| does The special meaning for characters as mentioned at |sub-replace-special| does
not apply except for "<CR>". A <NL> character is used as a line break, you not apply except for "<CR>". A <NL> character is used as a line break, you

172
runtime/doc/channel.txt Normal file
View File

@@ -0,0 +1,172 @@
*channel.txt* Nvim
NVIM REFERENCE MANUAL by Thiago de Arruda
Nvim asynchronous IO *channel*
Type |gO| to see the table of contents.
==============================================================================
1. Introduction *channel-intro*
Channels are nvim's way of communicating with external processes.
There are several ways to open a channel:
1. Through stdin/stdout when `nvim` is started with `--headless`, and a startup
script or --cmd command opens the stdio channel using |stdioopen()|.
2. Through stdin, stdout and stderr of a process spawned by |jobstart()|.
3. Through the PTY master end of a PTY opened with
`jobstart(..., {'pty': v:true})` or |termopen()|.
4. By connecting to a TCP/IP socket or named pipe with |sockconnect()|.
5. By another process connecting to a socket listened to by nvim. This only
supports RPC channels, see |rpc-connecting|.
Channels support multiple modes or protocols. In the most basic
mode of operation, raw bytes are read and written to the channel.
The |rpc| protocol, based on the msgpack-rpc standard, enables nvim and the
process at the other end to send remote calls and events to each other.
Additionally, the builtin |terminal-emulator|, is implemented on top of PTY
channels.
==============================================================================
2. Reading and writing raw bytes *channel-bytes*
By default, channels opened by vimscript functions will operate with raw
bytes. Additionally, for a job channel using rpc, bytes can still be
read over its stderr. Similarily, only bytes can be written to nvim's own stderr.
*channel-callback* *buffered*
*E5210* *on_stdout* *on_stderr* *on_stdin* *on_data*
A callback function `on_{stream}` will be invoked with data read from the
channel. By default, the callback will be invoked immediately when data is
available, to facilitate interactive communication. The same callback will
then be invoked with empty data, to indicate that the stream reached EOF.
Alternatively the `{stream}_buffered` option can be set to invoke the callback
only when the underlying stream reaches EOF, and will then be passed in
complete output. This is helpful when only the complete output is useful, and
not partial data. Futhermore if `{stream}_buffered` is set but not a callback,
the data is saved in the options dict, with the stream name as key. For this
to work a new options dict must be used for each opened channel. If a script
uses a global `s:job_opts` dict, it can be copied with |copy()| before supplying
it to |jobstart()|. If a dict is reused, so that the dict key already is
occupied, error `E5210` will be raised.
- The arguments passed to the callback function are:
0: The channel id
1: the raw data read from the channel, formatted as a |readfile()|-style
list. If EOF occured, a single empty string `['']` will be passed in.
Note that the items in this list do not directly correspond to actual
lines in the output. See |channel-lines|
2: Stream name as a string, like `"stdout"`. This is to allow multiple
on_{event} handlers to be implemented by the same function. The available
events depend on how the channel was opened and in what mode/protocol.
*channel-lines*
Note:
stream event handlers may receive partial (incomplete) lines. For a given
invocation of on_stdout etc, `a:data` is not guaranteed to end
with a newline.
- `abcdefg` may arrive as `['abc']`, `['defg']`.
- `abc\nefg` may arrive as `['abc', '']`, `['efg']` or `['abc']`,
`['','efg']`, or even `['ab']`, `['c','efg']`.
If you only are interested in complete output when the process exits,
use buffered mode. Otherwise, an easy way to deal with this:
initialize a list as `['']`, then append to it as follows: >
let s:chunks = ['']
func! s:on_event(job_id, data, event) dict
let s:chunks[-1] .= a:data[0]
call extend(s:chunks, a:data[1:])
endf
<
Additionally, if the callbacks are Dictionary functions, |self| can be used to
refer to the options dictionary containing the callbacks. |Partial|s can also be
used as callbacks.
Data can be sent to the channel using the |chansend()| function. Here is a
simple example, echoing some data through a cat-process:
>
function! s:OnEvent(id, data, event) dict
let str = join(a:data, "\n")
echomsg str
endfunction
let id = jobstart(['cat'], {'on_stdout': function('s:OnEvent') } )
call chansend(id, "hello!")
<
Here is a example of setting a buffer to the result of grep, but only after
all data has been processed:
>
function! s:OnEvent(id, data, event) dict
call nvim_buf_set_lines(2, 0, -1, v:true, a:data)
endfunction
let id = jobstart(['grep', '^[0-9]'], { 'on_stdout': function('s:OnEvent'),
\ 'stdout_buffered':v:true } )
call chansend(id, "stuff\n10 PRINT \"NVIM\"\nxx")
" no output is received, buffer is empty
call chansend(id, "xx\n20 GOTO 10\nzz\n")
call chanclose(id, 'stdin')
" now buffer has result
<
For additional examples with jobs, see |job-control|.
*channel-pty*
A special case is PTY channels opened by `jobstart(..., {'pty': v:true})` .
No preprocessing of ANSI escape sequences is done, these will be sent raw to
the callback. However, change of PTY size can be signaled to the slave using
|jobresize()|. See also |terminal-emulator|.
==============================================================================
3. Communicating using msgpack-rpc *channel-rpc*
When channels are opened with the `rpc` option set to true, the channel can be
used for remote method calls in both directions, see |msgpack-rpc|. Note that
rpc channels are implicitly trusted and the process at the other end can
invoke any |api| function!
==============================================================================
4. Using the stdio channel *channel-stdio*
When invoked normally, nvim will use stdin and stdout to interact with the
user over the terminal interface (TUI). However when invoked with
`--headless`, the TUI is not started and stdin and stdout can be used as a
channel. To open the stdio channel |stdioopen()| must be called during
|startup|, as there later will be no way of invoking a command. As a
convenience, the stdio channel will always have channel id 1.
Here is an example:
>
func! OnEvent(id, data, event)
if a:data == [""]
quit
end
call chansend(a:id, map(a:data, {i,v -> toupper(v)}))
endfunc
call stdioopen({'on_stdin': 'OnEvent'})
<
Put this in `uppercase.vim` and invoke nvim with
>
nvim --headless --cmd "source uppercase.vim"
<
*--embed*
An common use case is another program embedding nvim and communicating with it
over rpc. Therefore, the option `--embed` exists as a shorthand for
`nvim --headless --cmd "call stdioopen({'rpc': v:true})"`
Nvim's stderr is implicitly open as a write-only bytes channel. It will
always have channel id 2, however to be explicit |v:stderr| can be used.
==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl:

View File

@@ -13,7 +13,7 @@ Command-line mode is used to enter Ex commands (":"), search patterns
Basic command line editing is explained in chapter 20 of the user manual Basic command line editing is explained in chapter 20 of the user manual
|usr_20.txt|. |usr_20.txt|.
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Command-line editing *cmdline-editing* 1. Command-line editing *cmdline-editing*
@@ -327,8 +327,11 @@ terminals)
List entries 6 to 12 from the search history: > List entries 6 to 12 from the search history: >
:history / 6,12 :history / 6,12
< <
List the recent five entries from all histories: > List the penultimate entry from all histories: >
:history all -5, :history all -2
<
List the most recent two entries from all histories: >
:history all -2,
:keepp[atterns] {command} *:keepp* *:keeppatterns* :keepp[atterns] {command} *:keepp* *:keeppatterns*
Execute {command}, without adding anything to the search Execute {command}, without adding anything to the search
@@ -358,7 +361,7 @@ These are the commands that can be used:
*c_CTRL-D* *c_CTRL-D*
CTRL-D List names that match the pattern in front of the cursor. CTRL-D List names that match the pattern in front of the cursor.
When showing file names, directories are highlighted (see When showing file names, directories are highlighted (see
'highlight' option). Names where 'suffixes' matches are moved |highlight-groups|). Names where 'suffixes' matches are moved
to the end. to the end.
The 'wildoptions' option can be set to "tagfile" to list the The 'wildoptions' option can be set to "tagfile" to list the
file of matching tags. file of matching tags.
@@ -417,6 +420,9 @@ matches exactly one character.
The 'wildignorecase' option can be set to ignore case in filenames. The 'wildignorecase' option can be set to ignore case in filenames.
The 'wildmenu' option can be set to show the matches just above the command
line.
If you like tcsh's autolist completion, you can use this mapping: If you like tcsh's autolist completion, you can use this mapping:
:cnoremap X <C-L><C-D> :cnoremap X <C-L><C-D>
(Where X is the command key to use, <C-L> is CTRL-L and <C-D> is CTRL-D) (Where X is the command key to use, <C-L> is CTRL-L and <C-D> is CTRL-D)
@@ -775,6 +781,7 @@ Also see |`=|.
*:<cword>* *:<cWORD>* *:<cfile>* *<cfile>* *:<cword>* *:<cWORD>* *:<cfile>* *<cfile>*
*:<sfile>* *<sfile>* *:<afile>* *<afile>* *:<sfile>* *<sfile>* *:<afile>* *<afile>*
*:<abuf>* *<abuf>* *:<amatch>* *<amatch>* *:<abuf>* *<abuf>* *:<amatch>* *<amatch>*
*:<cexpr>* *<cexpr>*
*<slnum>* *E495* *E496* *E497* *E499* *E500* *<slnum>* *E495* *E496* *E497* *E499* *E500*
Note: these are typed literally, they are not special keys! Note: these are typed literally, they are not special keys!
<cword> is replaced with the word under the cursor (like |star|) <cword> is replaced with the word under the cursor (like |star|)
@@ -782,7 +789,8 @@ Note: these are typed literally, they are not special keys!
<cfile> is replaced with the path name under the cursor (like what <cfile> is replaced with the path name under the cursor (like what
|gf| uses) |gf| uses)
<afile> When executing autocommands, is replaced with the file name <afile> When executing autocommands, is replaced with the file name
for a file read or write. of the buffer being manipulated, or the file for a read or
write.
<abuf> When executing autocommands, is replaced with the currently <abuf> When executing autocommands, is replaced with the currently
effective buffer number (for ":r file" and ":so file" it is effective buffer number (for ":r file" and ":so file" it is
the current buffer, the file being read/sourced is not in a the current buffer, the file being read/sourced is not in a
@@ -1080,7 +1088,7 @@ Another example: >
:au CmdwinEnter [/?] startinsert :au CmdwinEnter [/?] startinsert
This will make Vim start in Insert mode in the command-line window. This will make Vim start in Insert mode in the command-line window.
*cmdwin-char* *cmdline-char* *cmdwin-char*
The character used for the pattern indicates the type of command-line: The character used for the pattern indicates the type of command-line:
: normal Ex command : normal Ex command
> debug mode command |debug-mode| > debug mode command |debug-mode|

View File

@@ -9,7 +9,7 @@ Debugging Vim *debug-vim*
This is for debugging Vim itself, when it doesn't work properly. This is for debugging Vim itself, when it doesn't work properly.
For debugging Vim scripts, functions, etc. see |debug-scripts| For debugging Vim scripts, functions, etc. see |debug-scripts|
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================

View File

@@ -37,12 +37,24 @@ Functions ~
*file_readable()* Obsolete name for |filereadable()|. *file_readable()* Obsolete name for |filereadable()|.
*highlight_exists()* Obsolete name for |hlexists()|. *highlight_exists()* Obsolete name for |hlexists()|.
*highlightID()* Obsolete name for |hlID()|. *highlightID()* Obsolete name for |hlID()|.
*jobclose()* Obsolete name for |chanclose()|
*jobsend()* Obsolete name for |chansend()|
*last_buffer_nr()* Obsolete name for bufnr("$"). *last_buffer_nr()* Obsolete name for bufnr("$").
Modifiers ~
*:menu-<special>*
*:menu-special* <> notation is always enabled. |cpo-<|
*:map-<special>*
*:map-special* <> notation is always enabled. |cpo-<|
Options ~ Options ~
*'cscopeverbose'* Enabled by default. Use |:silent| instead.
'gd'
'gdefault' Enables the |:substitute| flag 'g' by default.
*'fe'* 'fenc'+'enc' before Vim 6.0; no longer used. *'fe'* 'fenc'+'enc' before Vim 6.0; no longer used.
*'highlight'* *'hl'* Names of builtin |highlight-groups| cannot be changed.
*'langnoremap'* Deprecated alias to 'nolangremap'. *'langnoremap'* Deprecated alias to 'nolangremap'.
*'vi'* *'vi'*
*'viminfo'* Deprecated alias to 'shada' option. *'viminfo'* Deprecated alias to 'shada' option.
vim:tw=78:ts=8:ft=help:norl: vim:noet:tw=78:ts=8:ft=help:norl:

View File

@@ -11,7 +11,7 @@ Nvim is open source software. Everybody is encouraged to contribute.
See src/nvim/README.md for an overview of the source code. See src/nvim/README.md for an overview of the source code.
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
Design goals *design-goals* Design goals *design-goals*
@@ -63,12 +63,6 @@ NVIM IS... WELL DOCUMENTED *design-documented*
- Documentation should be comprehensive and understandable. Use examples. - Documentation should be comprehensive and understandable. Use examples.
- Don't make the text unnecessarily long. Less documentation means that an - Don't make the text unnecessarily long. Less documentation means that an
item is easier to find. item is easier to find.
- Do not prefix doc-tags with "nvim-". Use |vim_diff.txt| to document
differences from Vim. The {Nvim} annotation is also available
to mark a specific feature. No other distinction is necessary.
- If a feature is removed, delete its doc entry and move its tag to
|vim_diff.txt|.
- Move deprecated features to |deprecated.txt|.
NVIM IS... HIGH SPEED AND SMALL IN SIZE *design-speed-size* NVIM IS... HIGH SPEED AND SMALL IN SIZE *design-speed-size*
@@ -113,7 +107,7 @@ include the kitchen sink... but it's good for plumbing."
============================================================================== ==============================================================================
Developer guidelines *dev-help* Developer guidelines *dev*
JARGON *dev-jargon* JARGON *dev-jargon*
@@ -148,6 +142,8 @@ shell The Vim application. This can cover the whole screen (e.g.,
window View on a buffer. There can be several windows in Vim, window View on a buffer. There can be several windows in Vim,
together with the command line, menubar, toolbar, etc. they together with the command line, menubar, toolbar, etc. they
fit in the shell. fit in the shell.
frame Windows are kept in a tree of frames. Each frame contains
a column, row, or window ("leaf" frame).
PROVIDERS *dev-provider* PROVIDERS *dev-provider*
@@ -192,6 +188,18 @@ defined if a valid external Python host is found. That works well with the
Python host isn't installed then the plugin will "think" it is running in Python host isn't installed then the plugin will "think" it is running in
a Vim compiled without the |+python| feature. a Vim compiled without the |+python| feature.
DOCUMENTATION *dev-doc*
- Do not prefix help tags with "nvim-". Use |vim_diff.txt| to document
differences from Vim; no other distinction is necessary.
- If a Vim feature is removed, delete its help section and move its tag to
|vim_diff.txt|.
- Move deprecated features to |deprecated.txt|.
- Use consistent language.
- "terminal" in a help tag always means "the embedded terminal emulator", not
"the user host terminal".
- Use "tui-" to prefix help tags related to the host terminal, and "TUI"
in prose if possible.
API *dev-api* API *dev-api*
@@ -224,23 +232,47 @@ _not_ a Buffer). The common {action} "list" indicates that it lists all
bufs (plural) in the global context. bufs (plural) in the global context.
API-CLIENT *dev-api-client*
Package Naming ~
API client packages should NOT be named something ambiguous like "neovim" or
"python-client". Use "nvim" as a prefix/suffix to some other identifier
following ecosystem conventions.
For example, Python packages tend to have "py" in the name, so "pynvim" is
a good name: it's idiomatic and unambiguous. If the package is named "neovim",
it confuses users, and complicates documentation and discussions.
Examples of API-client package names:
GOOD: nvim-racket
GOOD: pynvim
BAD: python-client
BAD: neovim
Implementation ~
Consider using libmpack instead of the msgpack.org C/C++ library. libmpack is
small, efficient, and C89-compatible. It can be easily inlined in your
C project source, too. https://github.com/libmpack/libmpack/
EXTERNAL UI *dev-ui* EXTERNAL UI *dev-ui*
Compatibility ~
External UIs should be aware of the |api-contract|. In particular, future External UIs should be aware of the |api-contract|. In particular, future
versions of Nvim may add optional, new items to existing events. The API is versions of Nvim may add new items to existing events. The API is strongly
strongly backwards-compatible, but clients must not break if new fields are backwards-compatible, but clients must not break if new fields are added to
added to existing events. existing events.
External UIs are expected to implement some common features. Common Features ~
External UIs are expected to implement these common features:
- Cursor style (shape, color) should respond to the 'guicursor' properties
delivered with the mode_info_set UI event.
- Send the "super" key (Windows key, Apple key) as a |<D-| chord.
- Users may want to configure UI-specific options. The UI should publish the Implementation ~
|GUIEnter| autocmd after attaching to Nvim: > - UI-related options ('guifont', 'ambiwidth', …) are published in the
doautocmd GUIEnter "option_set" |ui-global| event. The event is triggered when the UI first
- Options can be monitored for changes by the |OptionSet| autocmd. E.g. if the connects to Nvim and whenever an option is changed by the user or a plugin.
user sets the 'guifont' option, this autocmd notifies channel 42: >
autocmd OptionSet guifont call rpcnotify(42, 'option-changed', 'guifont', &guifont)
- cursor-shape change: 'guicursor' properties are sent in the mode_info_set UI
event.
vim:tw=78:ts=8:ft=help:norl: vim:tw=78:ts=8:ft=help:norl:

View File

@@ -10,10 +10,10 @@ eight versions of the same file.
The basics are explained in section |08.7| of the user manual. The basics are explained in section |08.7| of the user manual.
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Starting diff mode 1. Starting diff mode *start-vimdiff*
To start editing in diff mode, run "nvim -d". This starts Nvim as usual, and To start editing in diff mode, run "nvim -d". This starts Nvim as usual, and
additionally sets up for viewing the differences between the arguments. > additionally sets up for viewing the differences between the arguments. >
@@ -214,8 +214,8 @@ The diffs are highlighted with these groups:
(searching from the end of the line). The (searching from the end of the line). The
text in between is highlighted. This means text in between is highlighted. This means
that parts in the middle that are still the that parts in the middle that are still the
same are highlighted anyway. Only "iwhite" of same are highlighted anyway. The 'diffopt'
'diffopt' is used here. flags "iwhite" and "icase" are used here.
|hl-DiffDelete| DiffDelete Deleted lines. Also called filler lines, |hl-DiffDelete| DiffDelete Deleted lines. Also called filler lines,
because they don't really exist in this because they don't really exist in this
buffer. buffer.
@@ -314,7 +314,7 @@ g:diff_translations to zero: >
let g:diff_translations = 0 let g:diff_translations = 0
< <
After setting this variable, Reload the syntax script: > After setting this variable, reload the syntax script: >
set syntax=diff set syntax=diff
< <

View File

@@ -14,7 +14,7 @@ with CTRL-V (see |i_CTRL-V|).
There is a brief introduction on digraphs in the user manual: |24.9| There is a brief introduction on digraphs in the user manual: |24.9|
An alternative is using the 'keymap' option. An alternative is using the 'keymap' option.
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Defining digraphs *digraphs-define* 1. Defining digraphs *digraphs-define*
@@ -143,7 +143,7 @@ a standard meaning:
Two 2 Hook Two 2 Hook
Nine 9 Horn Nine 9 Horn
Equals = Cyrillic (= used as second char) Equals = Cyrillic (= used as second char)
Asterisk * Greek Asterisk * Greek
Percent sign % Greek/Cyrillic special Percent sign % Greek/Cyrillic special
Plus + smalls: Arabic, capitals: Hebrew Plus + smalls: Arabic, capitals: Hebrew
@@ -922,6 +922,7 @@ char digraph hex dec official name ~
† /- 2020 8224 DAGGER † /- 2020 8224 DAGGER
‡ /= 2021 8225 DOUBLE DAGGER ‡ /= 2021 8225 DOUBLE DAGGER
‥ .. 2025 8229 TWO DOT LEADER ‥ .. 2025 8229 TWO DOT LEADER
… ,. 2026 8230 HORIZONTAL ELLIPSIS
‰ %0 2030 8240 PER MILLE SIGN ‰ %0 2030 8240 PER MILLE SIGN
1' 2032 8242 PRIME 1' 2032 8242 PRIME
″ 2' 2033 8243 DOUBLE PRIME ″ 2' 2033 8243 DOUBLE PRIME

View File

@@ -6,7 +6,7 @@
Editing files *edit-files* Editing files *edit-files*
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Introduction *edit-intro* 1. Introduction *edit-intro*
@@ -236,7 +236,7 @@ If you want to keep the changed buffer without saving it, switch on the
*:vie* *:view* *:vie* *:view*
:vie[w][!] [++opt] [+cmd] file :vie[w][!] [++opt] [+cmd] file
When used in Ex mode: Leave |Ex mode|, go back to When used in Ex mode: Leave |Ex-mode|, go back to
Normal mode. Otherwise same as |:edit|, but set Normal mode. Otherwise same as |:edit|, but set
'readonly' option for this buffer. 'readonly' option for this buffer.
@@ -562,16 +562,16 @@ list of the current window.
buffer. buffer.
Also see |++opt| and |+cmd|. Also see |++opt| and |+cmd|.
:[count]arge[dit][!] [++opt] [+cmd] {name} *:arge* *:argedit* :[count]arge[dit][!] [++opt] [+cmd] {name} .. *:arge* *:argedit*
Add {name} to the argument list and edit it. Add {name}s to the argument list and edit it.
When {name} already exists in the argument list, this When {name} already exists in the argument list, this
entry is edited. entry is edited.
This is like using |:argadd| and then |:edit|. This is like using |:argadd| and then |:edit|.
Note that only one file name is allowed, and spaces Spaces in filenames have to be escaped with "\".
inside the file name are allowed, like with |:edit|.
[count] is used like with |:argadd|. [count] is used like with |:argadd|.
[!] is required if the current file cannot be If the current file cannot be |abandon|ed {name}s will
|abandon|ed. still be added to the argument list, but won't be
edited. No check for duplicates is done.
Also see |++opt| and |+cmd|. Also see |++opt| and |+cmd|.
:[count]arga[dd] {name} .. *:arga* *:argadd* *E479* :[count]arga[dd] {name} .. *:arga* *:argadd* *E479*
@@ -901,11 +901,12 @@ WRITING WITH MULTIPLE BUFFERS *buffer-write*
*:wa* *:wall* *:wa* *:wall*
:wa[ll] Write all changed buffers. Buffers without a file :wa[ll] Write all changed buffers. Buffers without a file
name or which are readonly are not written. name cause an error message. Buffers which are
readonly are not written.
:wa[ll]! Write all changed buffers, even the ones that are :wa[ll]! Write all changed buffers, even the ones that are
readonly. Buffers without a file name are not readonly. Buffers without a file name are not
written. written and cause an error message.
Vim will warn you if you try to overwrite a file that has been changed Vim will warn you if you try to overwrite a file that has been changed
@@ -1031,6 +1032,7 @@ The names can be in upper- or lowercase.
window in the current tab page the current tab page is window in the current tab page the current tab page is
closed |tab-page|. closed |tab-page|.
Triggers the |QuitPre| autocommand event. Triggers the |QuitPre| autocommand event.
See |CTRL-W_q| for quitting another window.
:conf[irm] q[uit] Quit, but give prompt when changes have been made, or :conf[irm] q[uit] Quit, but give prompt when changes have been made, or
the last file in the argument list has not been the last file in the argument list has not been
@@ -1264,14 +1266,14 @@ Commands for changing the working directory can be suffixed with a bang "!"
*:lc* *:lcd* *:lc* *:lcd*
:lc[d][!] {path} Like |:cd|, but only set the current directory for the :lc[d][!] {path} Like |:cd|, but only set the current directory for the
current window. The current directory for other current window. The current directory for other
windows or any tabs is not changed. windows or tabs is not changed.
*:lch* *:lchdir* *:lch* *:lchdir*
:lch[dir][!] Same as |:lcd|. :lch[dir][!] Same as |:lcd|.
*:lcd-* *:lcd-*
:lcd[!] - Change to the previous current directory (before the :lcd[!] - Change to the previous current directory (before the
previous ":tcd {path}" command). previous ":lcd {path}" command).
*:pw* *:pwd* *E187* *:pw* *:pwd* *E187*
:pw[d] Print the current directory name. :pw[d] Print the current directory name.
@@ -1363,6 +1365,13 @@ If you want to automatically reload a file when it has been changed outside of
Vim, set the 'autoread' option. This doesn't work at the moment you write the Vim, set the 'autoread' option. This doesn't work at the moment you write the
file though, only when the file wasn't changed inside of Vim. file though, only when the file wasn't changed inside of Vim.
If you do not want to be asked or automatically reload the file, you can use
this: >
set buftype=nofile
Or, when starting gvim from a shell: >
gvim file.log -c "set buftype=nofile"
Note that if a FileChangedShell autocommand is defined you will not get a Note that if a FileChangedShell autocommand is defined you will not get a
warning message or prompt. The autocommand is expected to handle this. warning message or prompt. The autocommand is expected to handle this.
@@ -1533,7 +1542,7 @@ There are three different types of searching:
This searches the same directories, but in a different order. This searches the same directories, but in a different order.
Note that completion for ":find", ":sfind", and ":tabfind" commands do not Note that completion for ":find", ":sfind", and ":tabfind" commands do not
currently work with 'path' items that contain a url or use the double star currently work with 'path' items that contain a URL or use the double star
with depth limiter (/usr/**2) or upward search (;) notations. with depth limiter (/usr/**2) or upward search (;) notations.
vim:tw=78:ts=8:ft=help:norl: vim:tw=78:ts=8:ft=help:norl:

File diff suppressed because it is too large Load Diff

View File

@@ -8,7 +8,7 @@ Filetypes *filetype* *file-type*
Also see |autocmd.txt|. Also see |autocmd.txt|.
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Filetypes *filetypes* *file-types* 1. Filetypes *filetypes* *file-types*
@@ -24,15 +24,13 @@ Each time a new or existing file is edited, Vim will try to recognize the type
of the file and set the 'filetype' option. This will trigger the FileType of the file and set the 'filetype' option. This will trigger the FileType
event, which can be used to set the syntax highlighting, set options, etc. event, which can be used to set the syntax highlighting, set options, etc.
Detail: The ":filetype on" command will load one of these files: Detail: The ":filetype on" command will load this file:
Mac $VIMRUNTIME/filetype.vim $VIMRUNTIME/filetype.vim
MS-DOS $VIMRUNTIME\filetype.vim
Unix $VIMRUNTIME/filetype.vim
This file is a Vim script that defines autocommands for the This file is a Vim script that defines autocommands for the
BufNewFile and BufRead events. If the file type is not found by the BufNewFile and BufRead events. If the file type is not found by the
name, the file $VIMRUNTIME/scripts.vim is used to detect it from the name, the file $VIMRUNTIME/scripts.vim is used to detect it from the
contents of the file. contents of the file.
When the GUI is running or will start soon, the menu.vim script is When the GUI is running or will start soon, the |menu.vim| script is
also sourced. See |'go-M'| about avoiding that. also sourced. See |'go-M'| about avoiding that.
To add your own file types, see |new-filetype| below. To search for help on a To add your own file types, see |new-filetype| below. To search for help on a
@@ -309,12 +307,12 @@ define yourself. There are a few ways to avoid this:
You need to define your own mapping before the plugin is loaded (before You need to define your own mapping before the plugin is loaded (before
editing a file of that type). The plugin will then skip installing the editing a file of that type). The plugin will then skip installing the
default mapping. default mapping.
*no_mail_maps*
3. Disable defining mappings for a specific filetype by setting a variable, 3. Disable defining mappings for a specific filetype by setting a variable,
which contains the name of the filetype. For the "mail" filetype this which contains the name of the filetype. For the "mail" filetype this
would be: > would be: >
:let no_mail_maps = 1 :let no_mail_maps = 1
< *no_plugin_maps*
4. Disable defining mappings for all filetypes by setting a variable: > 4. Disable defining mappings for all filetypes by setting a variable: >
:let no_plugin_maps = 1 :let no_plugin_maps = 1
< <
@@ -540,7 +538,7 @@ K or CTRL-] Jump to the manpage for the <cWORD> under the
cursor. Takes a count for the section. cursor. Takes a count for the section.
CTRL-T Jump back to the location that the manpage was CTRL-T Jump back to the location that the manpage was
opened from. opened from.
META-] Show the manpage outline in the |location-list|. gO Show the manpage outline. |gO|
q :quit if invoked as $MANPAGER, otherwise :close. q :quit if invoked as $MANPAGER, otherwise :close.
Variables: Variables:
@@ -724,6 +722,12 @@ Format description:
not recognized here as well. not recognized here as well.
RUST *ft-rust*
Since the text for this plugin is rather long it has been put in a separate
file: |ft_rust.txt|.
SQL *ft-sql* SQL *ft-sql*
Since the text for this plugin is rather long it has been put in a separate Since the text for this plugin is rather long it has been put in a separate

View File

@@ -9,7 +9,7 @@ Folding *Folding* *folding* *folds*
You can find an introduction on folding in chapter 28 of the user manual. You can find an introduction on folding in chapter 28 of the user manual.
|usr_28.txt| |usr_28.txt|
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Fold methods *fold-methods* 1. Fold methods *fold-methods*
@@ -58,7 +58,7 @@ whichever is lower. These are empty or white lines and lines starting
with a character in 'foldignore'. White space is skipped before checking for with a character in 'foldignore'. White space is skipped before checking for
characters in 'foldignore'. For C use "#" to ignore preprocessor lines. characters in 'foldignore'. For C use "#" to ignore preprocessor lines.
When you want to ignore lines in another way, use the 'expr' method. The When you want to ignore lines in another way, use the "expr" method. The
|indent()| function can be used in 'foldexpr' to get the indent of a line. |indent()| function can be used in 'foldexpr' to get the indent of a line.
@@ -73,7 +73,7 @@ This will call a function to compute the fold level: >
:set foldexpr=MyFoldLevel(v:lnum) :set foldexpr=MyFoldLevel(v:lnum)
This will make a fold out of paragraphs separated by blank lines: > This will make a fold out of paragraphs separated by blank lines: >
:set foldexpr=getline(v:lnum)=~'^\\s*$'&&getline(v:lnum+1)=~'\\S'?'<1':1 :set foldexpr=getline(v:lnum)=~'^\\s*$'&&getline(v:lnum+1)=~'\\S'?'<1':1
this does the same: > This does the same: >
:set foldexpr=getline(v:lnum-1)=~'^\\s*$'&&getline(v:lnum)=~'\\S'?'>1':1 :set foldexpr=getline(v:lnum-1)=~'^\\s*$'&&getline(v:lnum)=~'\\S'?'>1':1
Note that backslashes must be used to escape characters that ":set" handles Note that backslashes must be used to escape characters that ":set" handles
@@ -133,7 +133,7 @@ fold level. But note that foldlevel() may return -1 if the level is not known
yet. And it returns the level at the start of the line, while a fold might yet. And it returns the level at the start of the line, while a fold might
end in that line. end in that line.
It may happened that folds are not updated properly. You can use |zx| or |zX| It may happen that folds are not updated properly. You can use |zx| or |zX|
to force updating folds. to force updating folds.
@@ -197,7 +197,7 @@ and the level given by the marker:
1. If a marker with the same fold level is encountered, the previous fold 1. If a marker with the same fold level is encountered, the previous fold
ends and another fold with the same level starts. ends and another fold with the same level starts.
2. If a marker with a higher fold level is found, a nested fold is started. 2. If a marker with a higher fold level is found, a nested fold is started.
3. if a marker with a lower fold level is found, all folds up to and including 3. If a marker with a lower fold level is found, all folds up to and including
this level end and a fold with the specified level starts. this level end and a fold with the specified level starts.
The number indicates the fold level. A zero cannot be used (a marker with The number indicates the fold level. A zero cannot be used (a marker with

View File

@@ -116,7 +116,7 @@ NOTE: "gnat xref -v" is very tricky to use as it has almost no diagnostic
then "gnat xref -v *.ad?" then "gnat xref -v *.ad?"
4) Project manager support is completely broken - don't even try "gnat xref 4) Project manager support is completely broken - don't even try "gnat xref
-Padacl.gpr". -Padacl.gpr".
5) VIM is faster when the tags file is sorted - use "sort --unique 5) Vim is faster when the tags file is sorted - use "sort --unique
--ignore-case --output=tags tags" . --ignore-case --output=tags tags" .
6) Remember to insert "!_TAG_FILE_SORTED 2 %sort ui" as first line to mark 6) Remember to insert "!_TAG_FILE_SORTED 2 %sort ui" as first line to mark
the file assorted. the file assorted.

237
runtime/doc/ft_rust.txt Normal file
View File

@@ -0,0 +1,237 @@
*ft_rust.txt* Filetype plugin for Rust
==============================================================================
CONTENTS *rust*
1. Introduction |rust-intro|
2. Settings |rust-settings|
3. Commands |rust-commands|
4. Mappings |rust-mappings|
==============================================================================
INTRODUCTION *rust-intro*
This plugin provides syntax and supporting functionality for the Rust
filetype.
==============================================================================
SETTINGS *rust-settings*
This plugin has a few variables you can define in your vimrc that change the
behavior of the plugin.
*g:rustc_path*
g:rustc_path~
Set this option to the path to rustc for use in the |:RustRun| and
|:RustExpand| commands. If unset, "rustc" will be located in $PATH: >
let g:rustc_path = $HOME."/bin/rustc"
<
*g:rustc_makeprg_no_percent*
g:rustc_makeprg_no_percent~
Set this option to 1 to have 'makeprg' default to "rustc" instead of
"rustc %": >
let g:rustc_makeprg_no_percent = 1
<
*g:rust_conceal*
g:rust_conceal~
Set this option to turn on the basic |conceal| support: >
let g:rust_conceal = 1
<
*g:rust_conceal_mod_path*
g:rust_conceal_mod_path~
Set this option to turn on |conceal| for the path connecting token
"::": >
let g:rust_conceal_mod_path = 1
<
*g:rust_conceal_pub*
g:rust_conceal_pub~
Set this option to turn on |conceal| for the "pub" token: >
let g:rust_conceal_pub = 1
<
*g:rust_recommended_style*
g:rust_recommended_style~
Set this option to enable vim indentation and textwidth settings to
conform to style conventions of the rust standard library (i.e. use 4
spaces for indents and sets 'textwidth' to 99). This option is enabled
by default. To disable it: >
let g:rust_recommended_style = 0
<
*g:rust_fold*
g:rust_fold~
Set this option to turn on |folding|: >
let g:rust_fold = 1
<
Value Effect ~
0 No folding
1 Braced blocks are folded. All folds are open by
default.
2 Braced blocks are folded. 'foldlevel' is left at the
global value (all folds are closed by default).
*g:rust_bang_comment_leader*
g:rust_bang_comment_leader~
Set this option to 1 to preserve the leader on multi-line doc comments
using the /*! syntax: >
let g:rust_bang_comment_leader = 1
<
*g:ftplugin_rust_source_path*
g:ftplugin_rust_source_path~
Set this option to a path that should be prepended to 'path' for Rust
source files: >
let g:ftplugin_rust_source_path = $HOME.'/dev/rust'
<
*g:rustfmt_command*
g:rustfmt_command~
Set this option to the name of the 'rustfmt' executable in your $PATH. If
not specified it defaults to 'rustfmt' : >
let g:rustfmt_command = 'rustfmt'
<
*g:rustfmt_autosave*
g:rustfmt_autosave~
Set this option to 1 to run |:RustFmt| automatically when saving a
buffer. If not specified it defaults to 0 : >
let g:rustfmt_autosave = 0
<
*g:rustfmt_fail_silently*
g:rustfmt_fail_silently~
Set this option to 1 to prevent 'rustfmt' from populating the
|location-list| with errors. If not specified it defaults to 0: >
let g:rustfmt_fail_silently = 0
<
*g:rustfmt_options*
g:rustfmt_options~
Set this option to a string of options to pass to 'rustfmt'. The
write-mode is already set to 'overwrite'. If not specified it
defaults to '' : >
let g:rustfmt_options = ''
<
*g:rust_playpen_url*
g:rust_playpen_url~
Set this option to override the URL for the playpen to use: >
let g:rust_playpen_url = 'https://play.rust-lang.org/'
<
*g:rust_shortener_url*
g:rust_shortener_url~
Set this option to override the URL for the URL shortener: >
let g:rust_shortener_url = 'https://is.gd/'
<
==============================================================================
COMMANDS *rust-commands*
:RustRun [args] *:RustRun*
:RustRun! [rustc-args] [--] [args]
Compiles and runs the current file. If it has unsaved changes,
it will be saved first using |:update|. If the current file is
an unnamed buffer, it will be written to a temporary file
first. The compiled binary is always placed in a temporary
directory, but is run from the current directory.
The arguments given to |:RustRun| will be passed to the
compiled binary.
If ! is specified, the arguments are passed to rustc instead.
A "--" argument will separate the rustc arguments from the
arguments passed to the binary.
If |g:rustc_path| is defined, it is used as the path to rustc.
Otherwise it is assumed rustc can be found in $PATH.
:RustExpand [args] *:RustExpand*
:RustExpand! [TYPE] [args]
Expands the current file using --pretty and displays the
results in a new split. If the current file has unsaved
changes, it will be saved first using |:update|. If the
current file is an unnamed buffer, it will be written to a
temporary file first.
The arguments given to |:RustExpand| will be passed to rustc.
This is largely intended for specifying various --cfg
configurations.
If ! is specified, the first argument is the expansion type to
pass to rustc --pretty. Otherwise it will default to
"expanded".
If |g:rustc_path| is defined, it is used as the path to rustc.
Otherwise it is assumed rustc can be found in $PATH.
:RustEmitIr [args] *:RustEmitIr*
Compiles the current file to LLVM IR and displays the results
in a new split. If the current file has unsaved changes, it
will be saved first using |:update|. If the current file is an
unnamed buffer, it will be written to a temporary file first.
The arguments given to |:RustEmitIr| will be passed to rustc.
If |g:rustc_path| is defined, it is used as the path to rustc.
Otherwise it is assumed rustc can be found in $PATH.
:RustEmitAsm [args] *:RustEmitAsm*
Compiles the current file to assembly and displays the results
in a new split. If the current file has unsaved changes, it
will be saved first using |:update|. If the current file is an
unnamed buffer, it will be written to a temporary file first.
The arguments given to |:RustEmitAsm| will be passed to rustc.
If |g:rustc_path| is defined, it is used as the path to rustc.
Otherwise it is assumed rustc can be found in $PATH.
:RustPlay *:RustPlay*
This command will only work if you have web-api.vim installed
(available at https://github.com/mattn/webapi-vim). It sends the
current selection, or if nothing is selected, the entirety of the
current buffer to the Rust playpen, and emits a message with the
shortened URL to the playpen.
|g:rust_playpen_url| is the base URL to the playpen, by default
"https://play.rust-lang.org/".
|g:rust_shortener_url| is the base URL for the shortener, by
default "https://is.gd/"
:RustFmt *:RustFmt*
Runs |g:rustfmt_command| on the current buffer. If
|g:rustfmt_options| is set then those will be passed to the
executable.
If |g:rustfmt_fail_silently| is 0 (the default) then it
will populate the |location-list| with the errors from
|g:rustfmt_command|. If |g:rustfmt_fail_silently| is set to 1
then it will not populate the |location-list|.
:RustFmtRange *:RustFmtRange*
Runs |g:rustfmt_command| with selected range. See
|:RustFmt| for any other information.
==============================================================================
MAPPINGS *rust-mappings*
This plugin defines mappings for |[[| and |]]| to support hanging indents.
It also has a few other mappings:
*rust_<D-r>*
<D-r> Executes |:RustRun| with no arguments.
Note: This binding is only available in MacVim.
*rust_<D-R>*
<D-R> Populates the command line with |:RustRun|! using the
arguments given to the last invocation, but does not
execute it.
Note: This binding is only available in MacVim.
==============================================================================
vim:tw=78:sw=4:noet:ts=8:ft=help:norl:

View File

@@ -6,7 +6,7 @@
Vim's Graphical User Interface *gui* *GUI* Vim's Graphical User Interface *gui* *GUI*
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Starting the GUI *gui-start* *E229* *E233* 1. Starting the GUI *gui-start* *E229* *E233*
@@ -46,7 +46,8 @@ When the GUI starts up initializations are carried out, in this order:
already set. already set.
NOTE: All but the first one are not carried out if Vim was started with NOTE: All but the first one are not carried out if Vim was started with
"-u NONE" and no "-U" argument was given, or when started with "-U NONE". "-u NONE" or "-u DEFAULTS" and no "-U" argument was given, or when started
with "-U NONE".
All this happens AFTER the normal Vim initializations, like reading your All this happens AFTER the normal Vim initializations, like reading your
vimrc file. See |initialization|. vimrc file. See |initialization|.
@@ -382,6 +383,7 @@ menus and menu items. They are most useful for things that you can't remember
what the key sequence was. what the key sequence was.
For creating menus in a different language, see |:menutrans|. For creating menus in a different language, see |:menutrans|.
If you don't want to use menus at all, see |'go-M'|.
*menu.vim* *menu.vim*
The default menus are read from the file "$VIMRUNTIME/menu.vim". See The default menus are read from the file "$VIMRUNTIME/menu.vim". See
@@ -398,7 +400,11 @@ in the menu (which can take a bit of time to load). If you want to have all
filetypes already present at startup, add: > filetypes already present at startup, add: >
:let do_syntax_sel_menu = 1 :let do_syntax_sel_menu = 1
< Note that the menu.vim is sourced when `:syntax on` or `:filetype on` is
executed or after your .vimrc file is sourced. This means that the 'encoding'
option and the language of messages (`:language messages`) must be set before
that (if you want to change them).
*console-menus* *console-menus*
Although this documentation is in the GUI section, you can actually use menus Although this documentation is in the GUI section, you can actually use menus
in console mode too. You will have to load |menu.vim| explicitly then, it is in console mode too. You will have to load |menu.vim| explicitly then, it is
@@ -490,9 +496,6 @@ expression register: >
:amenu Insert.foobar "='foobar'<CR>P :amenu Insert.foobar "='foobar'<CR>P
Note that the '<' and 'k' flags in 'cpoptions' also apply here (when
included they make the <> form and raw key codes not being recognized).
Note that <Esc> in Cmdline mode executes the command, like in a mapping. This Note that <Esc> in Cmdline mode executes the command, like in a mapping. This
is Vi compatible. Use CTRL-C to quit Cmdline mode. is Vi compatible. Use CTRL-C to quit Cmdline mode.
@@ -504,21 +507,13 @@ The ":set ic" will not be echoed when using this menu. Messages from the
executed command are still given though. To shut them up too, add a ":silent" executed command are still given though. To shut them up too, add a ":silent"
in the executed command: > in the executed command: >
:menu <silent> Search.Header :exe ":silent normal /Header\r"<CR> :menu <silent> Search.Header :exe ":silent normal /Header\r"<CR>
"<silent>" may also appear just after "<special>" or "<script>". "<silent>" may also appear just after "<script>".
*:menu-<special>* *:menu-special*
Define a menu with <> notation for special keys, even though the "<" flag
may appear in 'cpoptions'. This is useful if the side effect of setting
'cpoptions' is not desired. Example: >
:menu <special> Search.Header /Header<CR>
"<special>" must appear as the very first argument to the ":menu" command or
just after "<silent>" or "<script>".
*:menu-<script>* *:menu-script* *:menu-<script>* *:menu-script*
The "to" part of the menu will be inspected for mappings. If you don't want The "to" part of the menu will be inspected for mappings. If you don't want
this, use the ":noremenu" command (or the similar one for a specific mode). this, use the ":noremenu" command (or the similar one for a specific mode).
If you do want to use script-local mappings, add "<script>" as the very first If you do want to use script-local mappings, add "<script>" as the very first
argument to the ":menu" command or just after "<silent>" or "<special>". argument to the ":menu" command or just after "<silent>".
*menu-priority* *menu-priority*
You can give a priority to a menu. Menus with a higher priority go more to You can give a priority to a menu. Menus with a higher priority go more to
@@ -659,6 +654,8 @@ nr Name Normal action ~
In the Win32 GUI, starting a menu name with ']' excludes that menu from the In the Win32 GUI, starting a menu name with ']' excludes that menu from the
main menu bar. You must then use the |:popup| command to display it. main menu bar. You must then use the |:popup| command to display it.
When splitting the window the window toolbar is not copied to the new window.
*popup-menu* *popup-menu*
You can define the special menu "PopUp". This is the menu that is displayed You can define the special menu "PopUp". This is the menu that is displayed
when the right mouse button is pressed, if 'mousemodel' is set to popup or when the right mouse button is pressed, if 'mousemodel' is set to popup or

View File

@@ -30,7 +30,7 @@ Get specific help: It is possible to go directly to whatever you want help
help entries for "word". help entries for "word".
Or use ":helpgrep word". |:helpgrep| Or use ":helpgrep word". |:helpgrep|
VIM stands for Vi IMproved. Most of VIM was made by Bram Moolenaar, but only Vim stands for Vi IMproved. Most of Vim was made by Bram Moolenaar, but only
through the help of many others. See |credits|. through the help of many others. See |credits|.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*doc-file-list* *Q_ct* *doc-file-list* *Q_ct*
@@ -93,10 +93,9 @@ General subjects ~
|helphelp.txt| about using the help files |helphelp.txt| about using the help files
|index.txt| alphabetical index of all commands |index.txt| alphabetical index of all commands
|help-tags| all the tags you can jump to (index of tags) |help-tags| all the tags you can jump to (index of tags)
|howto.txt| how to do the most common editing tasks
|tips.txt| various tips on using Vim |tips.txt| various tips on using Vim
|message.txt| (error) messages and explanations |message.txt| (error) messages and explanations
|develop.txt| development of Vim |develop.txt| development of Nvim
|debug.txt| debugging Vim itself |debug.txt| debugging Vim itself
|uganda.txt| Vim distribution conditions and what to do with your money |uganda.txt| Vim distribution conditions and what to do with your money
@@ -134,7 +133,6 @@ Advanced editing ~
Special issues ~ Special issues ~
|print.txt| printing |print.txt| printing
|remote.txt| using Vim as a server or client |remote.txt| using Vim as a server or client
|term.txt| using different terminals and mice
|digraph.txt| list of available digraphs |digraph.txt| list of available digraphs
|mbyte.txt| multi-byte text support |mbyte.txt| multi-byte text support
|mlang.txt| non-English language support |mlang.txt| non-English language support
@@ -143,6 +141,7 @@ Special issues ~
|hebrew.txt| Hebrew language support and editing |hebrew.txt| Hebrew language support and editing
|russian.txt| Russian language support and editing |russian.txt| Russian language support and editing
|ft_ada.txt| Ada (the programming language) support |ft_ada.txt| Ada (the programming language) support
|ft_rust.txt| Filetype plugin for Rust
|ft_sql.txt| about the SQL filetype plugin |ft_sql.txt| about the SQL filetype plugin
|rileft.txt| right-to-left editing mode |rileft.txt| right-to-left editing mode
@@ -163,6 +162,7 @@ Standard plugins ~
|pi_gzip.txt| Reading and writing compressed files |pi_gzip.txt| Reading and writing compressed files
|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
|pi_spec.txt| Filetype plugin to work with rpm spec files
|pi_tar.txt| Tar file explorer |pi_tar.txt| Tar file explorer
|pi_zip.txt| Zip archive explorer |pi_zip.txt| Zip archive explorer

View File

@@ -6,7 +6,7 @@
Help on help files *helphelp* Help on help files *helphelp*
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Help commands *online-help* 1. Help commands *online-help*
@@ -23,7 +23,7 @@ Help on help files *helphelp*
The 'helplang' option is used to select a language, if The 'helplang' option is used to select a language, if
the main help file is available in several languages. the main help file is available in several languages.
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
*{subject}* *E149* *E661* *{subject}* *E149* *E661*
:h[elp] {subject} Like ":help", additionally jump to the tag {subject}. :h[elp] {subject} Like ":help", additionally jump to the tag {subject}.
@@ -140,7 +140,8 @@ Help on help files *helphelp*
already opened, then the location list for that window already opened, then the location list for that window
is used. Otherwise, a new help window is opened and is used. Otherwise, a new help window is opened and
the location list for that window is set. The the location list for that window is set. The
location list for the current window is not changed. location list for the current window is not changed
then.
*:exu* *:exusage* *:exu* *:exusage*
:exu[sage] Show help on Ex commands. Added to simulate the Nvi :exu[sage] Show help on Ex commands. Added to simulate the Nvi
@@ -305,7 +306,7 @@ the applicable Vim version. The last field specifies the last modification
date of the file. Each field is separated by a tab. date of the file. Each field is separated by a tab.
At the bottom of the help file, place a Vim modeline to set the 'textwidth' At the bottom of the help file, place a Vim modeline to set the 'textwidth'
and 'tabstop' options and the 'filetype' to 'help'. Never set a global option and 'tabstop' options and the 'filetype' to "help". Never set a global option
in such a modeline, that can have consequences undesired by whoever reads that in such a modeline, that can have consequences undesired by whoever reads that
help. help.

View File

@@ -1,96 +0,0 @@
*howto.txt* Nvim
VIM REFERENCE MANUAL by Bram Moolenaar
How to ... *howdoi* *how-do-i* *howto* *how-to*
|tutor| get started
|:quit| exit? I'm trapped, help me!
|initialization| initialize Vim
|vimrc-intro| write a Vim script file (vimrc)
|suspend| suspend Vim
|usr_11.txt| recover after a crash
|07.4| keep a backup of my file when writing over it
|usr_07.txt| edit files
|23.4| edit binary files
|usr_24.txt| insert text
|deleting| delete text
|usr_04.txt| change text
|04.5| copy and move text
|usr_25.txt| format text
|30.6| format comments
|30.2| indent C programs
|25.3| automatically set indent
|usr_26.txt| repeat commands
|02.5| undo and redo
|usr_03.txt| move around
|word-motions| word motions
|left-right-motions| left-right motions
|up-down-motions| up-down motions
|object-motions| text-object motions
|various-motions| various motions
|object-select| text-object selection
|'whichwrap'| move over line breaks
|'virtualedit'| move to where there is no text
|usr_27.txt| specify pattern for searches
|tags-and-searches| do tags and special searches
|29.4| search in include'd files used to find
variables, functions, or macros
|K| look up manual for the keyword under cursor
|03.7| scroll
|'sidescroll'| scroll horizontally/sideways
|'scrolloff'| set visible context lines
|mode-switching| change modes
|04.4| use Visual mode
|'insertmode'| start Vim in Insert mode
|40.1| map keys
|24.7| create abbreviations
|ins-expandtab| expand a tab to spaces in Insert mode
|i_CTRL-R| insert contents of a register in Insert mode
|24.3| complete words in Insert mode
|25.1| break a line before it gets too long
|20.1| do command-line editing
|20.3| do command-line completion
|'cmdheight'| increase the height of command-line
|10.3| specify command-line ranges
|40.3| specify commands to be executed automatically
before/after reading/writing entering/leaving a
buffer/window
|'autowrite'| write automatically
|30.1| speedup edit-compile-edit cycle or compile and fix
errors within Vim
|options| set options
|auto-setting| set options automatically
|term-dependent-settings| set options depending on terminal name
|save-settings| save settings
|:quote| comment my .vim files
|'helpheight'| change the default help height
|'highlight'| set various highlighting modes
|'title'| set the window title
|'icon'| set window icon title
|'report'| avoid seeing the change messages on every line
|'shortmess'| avoid |hit-enter| prompts
|mouse-using| use mouse with Vim
|usr_08.txt| manage multiple windows and buffers
|gui.txt| use the gui
|You can't! (yet)| do dishes using Vim
|usr_06.txt| switch on syntax highlighting
|2html.vim| convert a colored file to HTML
|less| use Vim like less or more with syntax highlighting
vim:tw=78:ts=8:ft=help:norl:

View File

@@ -4,42 +4,19 @@
VIM REFERENCE MANUAL by Andy Kahn VIM REFERENCE MANUAL by Andy Kahn
*cscope* *Cscope* *cscope* *Cscope*
This document explains how to use Vim's cscope interface. Cscope is a "code intelligence" tool that helps you navigate C programs. It
can also perform some refactoring tasks, such as renaming a global variable in
all source files. Think of it as "ctags on steroids".
Cscope is a tool like ctags, but think of it as ctags on steroids since it See |cscope-usage| for a quickstart.
does a lot more than what ctags provides. In Vim, jumping to a result from
a cscope query is just like jumping to any tag; it is saved on the tag stack
so that with the right keyboard mappings, you can jump back and forth between
functions as you normally would with |tags|.
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Cscope introduction *cscope-intro* Cscope introduction *cscope-intro*
The following text is taken from a version of the cscope man page:
----- Cscope is designed to answer questions like:
Cscope is an interactive screen-oriented tool that helps you:
Learn how a C program works without endless flipping through a thick
listing.
Locate the section of code to change to fix a bug without having to
learn the entire program.
Examine the effect of a proposed change such as adding a value to an
enum variable.
Verify that a change has been made in all source files such as adding
an argument to an existing function.
Rename a global variable in all source files.
Change a constant to a preprocessor symbol in selected lines of files.
It is designed to answer questions like:
Where is this symbol used? Where is this symbol used?
Where is it defined? Where is it defined?
Where did this variable get its value? Where did this variable get its value?
@@ -51,40 +28,23 @@ The following text is taken from a version of the cscope man page:
Where is this source file in the directory structure? Where is this source file in the directory structure?
What files include this header file? What files include this header file?
Cscope answers these questions from a symbol database that it builds the Cscope answers these questions from a symbol database that it builds the first
first time it is used on the source files. On a subsequent call, cscope time it is used on the source files. On a subsequent call, cscope rebuilds
rebuilds the database only if a source file has changed or the list of the database only if a source file has changed or the list of source files is
source files is different. When the database is rebuilt the data for the different. When the database is rebuilt the data for the unchanged files is
unchanged files is copied from the old database, which makes rebuilding copied from the old database, which makes rebuilding much faster than the
much faster than the initial build. initial build.
-----
When cscope is normally invoked, you will get a full-screen selection
screen allowing you to make a query for one of the above questions.
However, once a match is found to your query and you have entered your
text editor to edit the source file containing match, you cannot simply
jump from tag to tag as you normally would with vi's Ctrl-] or :tag
command.
Vim's cscope interface is done by invoking cscope with its line-oriented
interface, and then parsing the output returned from a query. The end
result is that cscope query results become just like regular tags, so
you can jump to them just like you do with normal tags (Ctrl-] or :tag)
and then go back by popping off the tagstack with Ctrl-T. (Please note
however, that you don't actually jump to a cscope tag simply by doing
Ctrl-] or :tag without remapping these commands or setting an option.
See the remaining sections on how the cscope interface works and for
suggested use.)
See |cscope-usage| to get started.
============================================================================== ==============================================================================
2. Cscope related commands *cscope-commands* Cscope commands *cscope-commands*
*:cscope* *:cs* *:scs* *:scscope* *E259* *E262* *E561* *E560* *:cscope* *:cs* *:scs* *:scscope* *E259* *E262* *E561* *E560*
All cscope commands are accessed through suboptions to the main cscope All cscope commands are accessed through suboptions to the cscope commands.
command ":cscope". The shortest abbreviation is ":cs". The ":scscope" `:cscope` or `:cs` is the main command
command does the same and also splits the window (short: "scs"). `:scscope` or `:scs` does the same and splits the window
`:lcscope` or `:lcs` uses the location list, see |:lcscope|
The available subcommands are: The available subcommands are:
@@ -231,7 +191,7 @@ through your tags file(s).
============================================================================== ==============================================================================
3. Cscope options *cscope-options* Cscope options *cscope-options*
Use the |:set| command to set all cscope options. Ideally, you would do Use the |:set| command to set all cscope options. Ideally, you would do
this in one of your startup files (e.g., vimrc). Some cscope related this in one of your startup files (e.g., vimrc). Some cscope related
@@ -244,7 +204,6 @@ started will have no effect!
:set csprg=/usr/local/bin/cscope :set csprg=/usr/local/bin/cscope
< <
*cscopequickfix* *csqf* *E469* *cscopequickfix* *csqf* *E469*
{not available when compiled without the |+quickfix| feature}
'cscopequickfix' specifies whether to use quickfix window to show cscope 'cscopequickfix' specifies whether to use quickfix window to show cscope
results. This is a list of comma-separated values. Each item consists of results. This is a list of comma-separated values. Each item consists of
|cscope-find| command (s, g, d, c, t, e, f, i or a) and flag (+, - or 0). |cscope-find| command (s, g, d, c, t, e, f, i or a) and flag (+, - or 0).
@@ -259,81 +218,56 @@ seems to be useful: >
If 'cscopetag' is set, the commands ":tag" and CTRL-] as well as "vim -t" If 'cscopetag' is set, the commands ":tag" and CTRL-] as well as "vim -t"
will always use |:cstag| instead of the default :tag behavior. Effectively, will always use |:cstag| instead of the default :tag behavior. Effectively,
by setting 'cst', you will always search your cscope databases as well as by setting 'cst', you will always search your cscope databases as well as
your tag files. The default is off. Examples: > your tag files. The default is off.
:set cst
:set nocst
<
*cscoperelative* *csre* *cscoperelative* *csre*
If 'cscoperelative' is set, then in absence of a prefix given to cscope If 'cscoperelative' is set, then in absence of a prefix given to cscope
(prefix is the argument of -P option of cscope), basename of cscope.out (prefix is the argument of -P option of cscope), basename of cscope.out
location (usually the project root directory) will be used as the prefix location (usually the project root directory) will be used as the prefix
to construct an absolute path. The default is off. Note: This option is to construct an absolute path. The default is off. Note: This option is
only effective when cscope (cscopeprg) is initialized without a prefix only effective when cscope (cscopeprg) is initialized without a prefix
path (-P). Examples: > path (-P).
:set csre
:set nocsre
<
*cscopetagorder* *csto* *cscopetagorder* *csto*
The value of 'csto' determines the order in which |:cstag| performs a search. The value of 'csto' determines the order in which |:cstag| performs a search.
If 'csto' is set to zero, cscope database(s) are searched first, followed If 'csto' is set to zero, cscope database(s) are searched first, followed
by tag file(s) if cscope did not return any matches. If 'csto' is set to by tag file(s) if cscope did not return any matches. If 'csto' is set to
one, tag file(s) are searched before cscope database(s). The default is zero. one, tag file(s) are searched before cscope database(s). The default is zero.
Examples: >
:set csto=0
:set csto=1
<
*cscopeverbose* *csverb*
If 'cscopeverbose' is not set (the default), messages will not be printed
indicating success or failure when adding a cscope database. Ideally, you
should reset this option in your |init.vim| before adding any cscope
databases, and after adding them, set it. From then on, when you add more
databases within Vim, you will get a (hopefully) useful message should the
database fail to be added. Examples: >
:set csverb
:set nocsverb
<
*cscopepathcomp* *cspc* *cscopepathcomp* *cspc*
The value of 'cspc' determines how many components of a file's path to 'cscopepathcomp' determines how many components of a file's path to display.
display. With the default value of zero the entire path will be displayed. With the default value of zero the entire path will be displayed.
The value one will display only the filename with no path. Other values The value one will display only the filename with no path. Other values
display that many components. For example: > display that many components. For example: >
:set cspc=3 :set cscopepathcomp=3
will display the last 3 components of the file's path, including the file will display the last 3 components of the file's path, including the file
name itself. name itself.
============================================================================== ==============================================================================
4. How to use cscope in Vim *cscope-howtouse* Using cscope in Nvim *cscope-usage* *cscope-howtouse*
The first thing you need to do is to build a cscope database for your To get started, build the cscope database in your project root directory: >
source files. For the most basic case, simply do "cscope -b". Please cscope -bcqR
refer to the cscope man page for more details.
Assuming you have a cscope database, you need to "add" the database to Vim. See the cscope manpage for details: >
This establishes a cscope "connection" and makes it available for Vim to use. :Man cscope
You can do this in your vimrc file, or you can do it manually after starting
vim. For example, to add the cscope database "cscope.out", you would do:
:cs add cscope.out By default the cscope database file is named "cscope.out". After building the
database, connect to it from Nvim: >
:cscope add cscope.out
You can double-check the result of this by executing ":cs show". This will That establishes a cscope connection for Nvim to use. You can check the
produce output which looks like this: result with ":cs show". It will show something like:
# pid database name prepend path # pid database name prepend path
0 28806 cscope.out <none> 0 28806 cscope.out <none>
Note:
Because of the Microsoft RTL limitations, Win32 version shows 0 instead
of the real pid.
Once a cscope connection is established, you can make queries to cscope and Once a cscope connection is established, you can make queries to cscope and
the results will be printed to you. Queries are made using the command the results will be printed. Queries are made using the command ":cs find".
":cs find". For example: For example: >
:cs find g ALIGN_SIZE :cs find g ALIGN_SIZE
This can get a little cumbersome since one ends up doing a significant To make this easier you can configure mappings, see |cscope-suggestions|.
amount of typing. Fortunately, there are ways around this by mapping
shortcut keys. See |cscope-suggestions| for suggested usage.
If the results return only one match, you will automatically be taken to it. If the results return only one match, you will automatically be taken to it.
If there is more than one match, you will be given a selection screen to pick If there is more than one match, you will be given a selection screen to pick
@@ -342,39 +276,28 @@ simply hit Ctrl-T to get back to the previous one.
============================================================================== ==============================================================================
5. Limitations *cscope-limitations* Limitations *cscope-limitations*
Cscope support for Vim is only available on systems that support these four
system calls: fork(), pipe(), execl(), waitpid(). This means it is mostly
limited to Unix systems.
Additionally Cscope support works for Win32. For more information and a
cscope version for Win32 see:
http://iamphet.nm.ru/cscope/index.html
Hard-coded limitation: doing a |:tjump| when |:cstag| searches the tag files Hard-coded limitation: doing a |:tjump| when |:cstag| searches the tag files
is not configurable (e.g., you can't do a tselect instead). is not configurable (e.g., you can't do a tselect instead).
==============================================================================
6. Suggested usage *cscope-suggestions*
Put these entries in your vimrc (adjust the pathname accordingly to your ==============================================================================
setup): > Sample config *cscope-suggestions*
Copy this into your init.vim (adjust paths for your system): >
if has("cscope") if has("cscope")
set csprg=/usr/local/bin/cscope set csprg=/usr/local/bin/cscope
set csto=0 set csto=0
set cst set cst
set nocsverb
" add any database in current directory " add any database in current directory
if filereadable("cscope.out") if filereadable("cscope.out")
cs add cscope.out silent cs add cscope.out
" else add database pointed to by environment " else add database pointed to by environment
elseif $CSCOPE_DB != "" elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB silent cs add $CSCOPE_DB
endif endif
set csverb
endif endif
By setting 'cscopetag', we have effectively replaced all instances of the :tag By setting 'cscopetag', we have effectively replaced all instances of the :tag
@@ -446,47 +369,6 @@ Cscope Home Page (http://cscope.sourceforge.net/): >
\:vert scs find d <C-R>=expand("<cword>")<CR><CR> \:vert scs find d <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>a nmap <C-Space><C-Space>a
\:vert scs find a <C-R>=expand("<cword>")<CR><CR> \:vert scs find a <C-R>=expand("<cword>")<CR><CR>
<
==============================================================================
7. Cscope availability and information *cscope-info*
If you do not already have cscope (it did not come with your compiler
license or OS distribution), then you can download it for free from:
http://cscope.sourceforge.net/
This is released by SCO under the BSD license.
If you want a newer version of cscope, you will probably have to buy it.
According to the (old) nvi documentation:
You can buy version 13.3 source with an unrestricted license
for $400 from AT&T Software Solutions by calling +1-800-462-8146.
Also you can download cscope 13.x and mlcscope 14.x (multi-lingual cscope
which supports C, C++, Java, lex, yacc, breakpoint listing, Ingres, and SDL)
from World-Wide Exptools Open Source packages page:
http://www.bell-labs.com/project/wwexptools/packages.html
In Solaris 2.x, if you have the C compiler license, you will also have
cscope. Both are usually located under /opt/SUNWspro/bin
SGI developers can also get it. Search for Cscope on this page:
http://freeware.sgi.com/index-by-alpha.html
https://toolbox.sgi.com/toolbox/utilities/cscope/
The second one is for those who have a password for the SGI toolbox.
There is source to an older version of a cscope clone (called "cs") available
on the net. Due to various reasons, this is not supported with Vim.
The cscope interface/support for Vim was originally written by
Andy Kahn <ackahn@netapp.com>. The original structure (as well as a tiny
bit of code) was adapted from the cscope interface in nvi. Please report
any problems, suggestions, patches, et al., you have for the usage of
cscope within Vim to him.
*cscope-win32*
For a cscope version for Win32 see:
http://code.google.com/p/cscope-win32/
Win32 support was added by Sergey Khorev <sergey.khorev@gmail.com>. Contact
him if you have Win32-specific issues.
vim:tw=78:ts=8:ft=help:norl: vim:tw=78:ts=8:ft=help:norl:

View File

@@ -1,30 +1,30 @@
*if_lua.txt* Nvim *if_lua.txt* Nvim
VIM REFERENCE MANUAL by Luis Carvalho NVIM REFERENCE MANUAL
Lua Interface to Nvim *lua* *Lua* Lua Interface to Nvim *lua* *Lua*
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Importing modules *lua-require* Importing modules *lua-require*
Neovim lua interface automatically adjusts `package.path` and `package.cpath` Nvim automatically adjusts `package.path` and `package.cpath` according to
according to effective &runtimepath value. Adjustment happens after effective 'runtimepath' value. Adjustment happens whenever 'runtimepath' is
'runtimepath' is changed. `package.path` is adjusted by simply appending changed. `package.path` is adjusted by simply appending `/lua/?.lua` and
`/lua/?.lua` and `/lua/?/init.lua` to each directory from 'runtimepath' (`/` `/lua/?/init.lua` to each directory from 'runtimepath' (`/` is actually the
is actually the first character of `package.config`). first character of `package.config`).
Similarly to `package.path`, modified directories from `runtimepath` are also Similarly to `package.path`, modified directories from 'runtimepath' are also
added to `package.cpath`. In this case, instead of appending `/lua/?.lua` and added to `package.cpath`. In this case, instead of appending `/lua/?.lua` and
`/lua/?/init.lua` to each runtimepath, all unique `?`-containing suffixes of `/lua/?/init.lua` to each runtimepath, all unique `?`-containing suffixes of
the existing `package.cpath` are used. Here is an example: the existing `package.cpath` are used. Example:
1. Given that 1. Given that
- 'runtimepath' contains `/foo/bar,/xxx;yyy/baz,/abc`; - 'runtimepath' contains `/foo/bar,/xxx;yyy/baz,/abc`;
- initial (defined at compile time or derived from - initial (defined at compile-time or derived from
`$LUA_CPATH`/`$LUA_INIT`) `package.cpath` contains `$LUA_CPATH`/`$LUA_INIT`) `package.cpath` contains
`./?.so;/def/ghi/a?d/j/g.elf;/def/?.so`. `./?.so;/def/ghi/a?d/j/g.elf;/def/?.so`.
2. It finds `?`-containing suffixes `/?.so`, `/a?d/j/g.elf` and `/?.so`, in 2. It finds `?`-containing suffixes `/?.so`, `/a?d/j/g.elf` and `/?.so`, in
@@ -61,7 +61,7 @@ paths when path is removed from 'runtimepath', adding paths when they are
added and reordering `package.path`/`package.cpath` content if 'runtimepath' added and reordering `package.path`/`package.cpath` content if 'runtimepath'
was reordered. was reordered.
Note 2: even though adjustments happens automatically Neovim does not track Note 2: even though adjustments happens automatically Nvim does not track
current values of `package.path` or `package.cpath`. If you happened to current values of `package.path` or `package.cpath`. If you happened to
delete some paths from there you need to reset 'runtimepath' to make them delete some paths from there you need to reset 'runtimepath' to make them
readded. Just running `let &runtimepath = &runtimepath` should work. readded. Just running `let &runtimepath = &runtimepath` should work.
@@ -72,7 +72,7 @@ badly written plugins using shell which will not work with paths containing
semicolons it is better to not have them in 'runtimepath' at all. semicolons it is better to not have them in 'runtimepath' at all.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
1.1. Example of the plugin which uses lua modules: *lua-require-example* Example of a plugin that uses lua modules *lua-require-example*
The following example plugin adds a command `:MakeCharBlob` which transforms The following example plugin adds a command `:MakeCharBlob` which transforms
current buffer into a long `unsigned char` array. Lua contains transformation current buffer into a long `unsigned char` array. Lua contains transformation
@@ -149,7 +149,7 @@ lua/charblob.lua: >
} }
============================================================================== ==============================================================================
2. Commands *lua-commands* Commands *lua-commands*
*:lua* *:lua*
:[range]lua {chunk} :[range]lua {chunk}
@@ -157,16 +157,19 @@ lua/charblob.lua: >
Examples: Examples:
> >
:lua vim.api.nvim_command('echo "Hello, Neovim!"') :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} :[range]lua << {endmarker}
{script} {script}
{endmarker} {endmarker}
Execute Lua script {script}. Execute Lua script {script}.
Note: This command doesn't work when the Lua
feature wasn't compiled in. To avoid errors, see
|script-here|.
{endmarker} must NOT be preceded by any white space. If {endmarker} is {endmarker} must NOT be preceded by any white space. If {endmarker} is
omitted from after the "<<", a dot '.' must be used after {script}, like omitted from after the "<<", a dot '.' must be used after {script}, like
@@ -186,15 +189,8 @@ Example:
EOF EOF
endfunction endfunction
Note that the variables are prefixed with `local`: they will disappear when Note that the `local` variables will disappear when block finishes. This is
block finishes. This is not the case for globals. not the case for globals.
To see what version of Lua you have: >
:lua print(_VERSION)
If you use LuaJIT you can also use this: >
:lua print(jit.version)
<
*:luado* *:luado*
:[range]luado {body} Execute Lua function "function (line, linenr) {body} :[range]luado {body} Execute Lua function "function (line, linenr) {body}
@@ -230,27 +226,80 @@ 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 :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 interpreter, each chunk has its own scope and so only global variables are
shared between command calls. All Lua default libraries are available. In shared between command calls. All Lua default libraries are available. In
addition, Lua "print" function has its output redirected to the Vim message addition, Lua "print" function has its output redirected to the Nvim message
area, with arguments separated by a white space instead of a tab. area, with arguments separated by a white space instead of a tab.
Lua uses the "vim" module (see |lua-vim|) to issue commands to Neovim Lua uses the "vim" module (see |lua-vim|) to issue commands to Nvim
and manage buffers (|lua-buffer|) and windows (|lua-window|). However, and manage buffers (|lua-buffer|) and windows (|lua-window|). However,
procedures that alter buffer content, open new buffers, and change cursor procedures that alter buffer content, open new buffers, and change cursor
position are restricted when the command is executed in the |sandbox|. position are restricted when the command is executed in the |sandbox|.
============================================================================== ==============================================================================
2. The vim module *lua-vim* The vim module *lua-vim*
Lua interfaces Vim through the "vim" module. Currently it only has `api` Lua interfaces Nvim through the "vim" module. Currently it has the `api`
submodule which is a table with all API functions. Descriptions of these submodule and some Nvim-specific utilities.
functions may be found in |api.txt|.
------------------------------------------------------------------------------
vim.api.* functions
`vim.api` exposes the Nvim |API| as a table of Lua functions. All functions
are available.
For 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.* utility functions
vim.stricmp(a, b) *lua-vim.stricmp*
Function used for case-insensitive string comparison. Takes two
string arguments and returns 0, 1 or -1 if strings are equal, a is
greater then b or a is lesser then b respectively.
vim.type_idx *lua-vim.type_idx*
Type index for use in |lua-special-tables|. Specifying one of the
values from |lua-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 *lua-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 |lua-vim.type_idx| and |lua-special-tbl|.
vim.types *lua-vim.types*
Table with possible values for |lua-vim.type_idx|. Contains two sets
of key-value pairs: first maps possible values for |lua-vim.type_idx|
to human-readable strings, second maps human-readable type names to
values for |lua-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.
============================================================================== ==============================================================================
3. The luaeval function *lua-luaeval* *lua-eval* The luaeval function *lua-luaeval* *lua-eval*
*luaeval()* *luaeval()*
The (dual) equivalent of "vim.eval" for passing Lua values to Vim is The (dual) equivalent of "vim.eval" for passing Lua values to Nvim is
"luaeval". "luaeval" takes an expression string and an optional argument used "luaeval". "luaeval" takes an expression string and an optional argument used
for _A inside expression and returns the result of the expression. It is for _A inside expression and returns the result of the expression. It is
semantically equivalent in Lua to: semantically equivalent in Lua to:
@@ -262,7 +311,7 @@ semantically equivalent in Lua to:
end end
Note that "_A" receives the argument to "luaeval". Lua nils, numbers, strings, Note that "_A" receives the argument to "luaeval". Lua nils, numbers, strings,
tables and booleans are converted to their Vim respective types. An error is tables and booleans are converted to their respective VimL types. An error is
thrown if conversion of any of the remaining Lua types is attempted. thrown if conversion of any of the remaining Lua types is attempted.
Note 2: lua tables are used as both dictionaries and lists, thus making it Note 2: lua tables are used as both dictionaries and lists, thus making it
@@ -278,6 +327,7 @@ between these cases there is the following agreement:
3. Table with string keys, at least one of which contains NUL byte, is also 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 considered to be a dictionary, but this time it is converted to
a |msgpack-special-map|. a |msgpack-special-map|.
*lua-special-tbl*
4. Table with `vim.type_idx` key may be a dictionary, a list or floating-point 4. Table with `vim.type_idx` key may be a dictionary, a list or floating-point
value: value:
- `{[vim.type_idx]=vim.types.float, [vim.val_idx]=1}` is converted to - `{[vim.type_idx]=vim.types.float, [vim.val_idx]=1}` is converted to

View File

@@ -8,7 +8,7 @@ The Python Interface to Vim *python* *Python*
See |provider-python| for more information. {Nvim} See |provider-python| for more information. {Nvim}
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Commands *python-commands* 1. Commands *python-commands*

View File

@@ -10,7 +10,7 @@ The Ruby Interface to Vim *ruby* *Ruby*
The home page for ruby is http://www.ruby-lang.org/. You can find links for The home page for ruby is http://www.ruby-lang.org/. You can find links for
downloading Ruby there. downloading Ruby there.
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Commands *ruby-commands* 1. Commands *ruby-commands*
@@ -63,7 +63,7 @@ To see what version of Ruby you have: >
*:rubyfile* *:rubyf* *:rubyfile* *:rubyf*
:rubyf[ile] {file} Execute the Ruby script in {file}. This is the same as :rubyf[ile] {file} Execute the Ruby script in {file}. This is the same as
":ruby load 'file'", but allows file name completion. `:ruby load 'file'`, but allows file name completion.
Executing Ruby commands is not possible in the |sandbox|. Executing Ruby commands is not possible in the |sandbox|.

View File

@@ -6,7 +6,7 @@
This file is about indenting C programs and other files. This file is about indenting C programs and other files.
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Indenting C style programs *C-indenting* 1. Indenting C style programs *C-indenting*
@@ -320,6 +320,21 @@ The examples below assume a 'shiftwidth' of 4.
{ { { {
void function(); void function(); void function(); void function();
} } } }
<
*cino-E*
EN Indent inside C++ linkage specifications (extern "C" or
extern "C++") N characters extra compared to a normal block.
(default 0).
cino= cino=E-s >
extern "C" { extern "C" {
void function(); void function();
} }
extern "C" extern "C"
{ {
void function(); void function();
} }
< <
*cino-p* *cino-p*
pN Parameter declarations for K&R-style function declarations will pN Parameter declarations for K&R-style function declarations will
@@ -550,7 +565,7 @@ The examples below assume a 'shiftwidth' of 4.
The defaults, spelled out in full, are: The defaults, spelled out in full, are:
cinoptions=>s,e0,n0,f0,{0,}0,^0,L-1,:s,=s,l0,b0,gs,hs,N0,ps,ts,is,+s, cinoptions=>s,e0,n0,f0,{0,}0,^0,L-1,:s,=s,l0,b0,gs,hs,N0,E0,ps,ts,is,+s,
c3,C0,/0,(2s,us,U0,w0,W0,k0,m0,j0,J0,)20,*70,#0 c3,C0,/0,(2s,us,U0,w0,W0,k0,m0,j0,J0,)20,*70,#0
Vim puts a line in column 1 if: Vim puts a line in column 1 if:

View File

@@ -15,7 +15,7 @@ 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|.
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Insert mode *insert-index* 1. Insert mode *insert-index*
@@ -298,10 +298,10 @@ tag char note action in Normal mode ~
|B| B 1 cursor N WORDS backward |B| B 1 cursor N WORDS backward
|C| ["x]C 2 change from the cursor position to the end |C| ["x]C 2 change from the cursor position to the end
of the line, and N-1 more lines [into of the line, and N-1 more lines [into
buffer x]; synonym for "c$" register x]; synonym for "c$"
|D| ["x]D 2 delete the characters under the cursor |D| ["x]D 2 delete the characters under the cursor
until the end of the line and N-1 more until the end of the line and N-1 more
lines [into buffer x]; synonym for "d$" lines [into register x]; synonym for "d$"
|E| E 1 cursor forward to the end of WORD N |E| E 1 cursor forward to the end of WORD N
|F| F{char} 1 cursor to the Nth occurrence of {char} to |F| F{char} 1 cursor to the Nth occurrence of {char} to
the left the left
@@ -318,13 +318,13 @@ tag char note action in Normal mode ~
opposite direction opposite direction
|O| O 2 begin a new line above the cursor and |O| O 2 begin a new line above the cursor and
insert text, repeat N times insert text, repeat N times
|P| ["x]P 2 put the text [from buffer x] before the |P| ["x]P 2 put the text [from register x] before the
cursor N times cursor N times
|Q| Q switch to "Ex" mode |Q| Q switch to "Ex" mode
|R| R 2 enter replace mode: overtype existing |R| R 2 enter replace mode: overtype existing
characters, repeat the entered text N-1 characters, repeat the entered text N-1
times times
|S| ["x]S 2 delete N lines [into buffer x] and start |S| ["x]S 2 delete N lines [into register x] and start
insert; synonym for "cc". insert; synonym for "cc".
|T| T{char} 1 cursor till after Nth occurrence of {char} |T| T{char} 1 cursor till after Nth occurrence of {char}
to the left to the left
@@ -332,8 +332,8 @@ tag char note action in Normal mode ~
|V| V start linewise Visual mode |V| V start linewise Visual mode
|W| W 1 cursor N WORDS forward |W| W 1 cursor N WORDS forward
|X| ["x]X 2 delete N characters before the cursor [into |X| ["x]X 2 delete N characters before the cursor [into
buffer x] register x]
|Y| ["x]Y yank N lines [into buffer x]; synonym for |Y| ["x]Y yank N lines [into register x]; synonym for
"yy" "yy"
|ZZ| ZZ store current file if modified, and exit |ZZ| ZZ store current file if modified, and exit
|ZQ| ZQ exit current file always |ZQ| ZQ exit current file always
@@ -356,12 +356,12 @@ tag char note action in Normal mode ~
|`}| `} 1 cursor to the end of the current paragraph |`}| `} 1 cursor to the end of the current paragraph
|a| a 2 append text after the cursor N times |a| a 2 append text after the cursor N times
|b| b 1 cursor N words backward |b| b 1 cursor N words backward
|c| ["x]c{motion} 2 delete Nmove text [into buffer x] and start |c| ["x]c{motion} 2 delete Nmove text [into register x] and
start insert
|cc| ["x]cc 2 delete N lines [into register x] and start
insert insert
|cc| ["x]cc 2 delete N lines [into buffer x] and start |d| ["x]d{motion} 2 delete Nmove text [into register x]
insert |dd| ["x]dd 2 delete N lines [into register x]
|d| ["x]d{motion} 2 delete Nmove text [into buffer x]
|dd| ["x]dd 2 delete N lines [into buffer x]
|do| do 2 same as ":diffget" |do| do 2 same as ":diffget"
|dp| dp 2 same as ":diffput" |dp| dp 2 same as ":diffput"
|e| e 1 cursor forward to the end of word N |e| e 1 cursor forward to the end of word N
@@ -387,16 +387,16 @@ tag char note action in Normal mode ~
|q?| q? edit ? command-line in command-line window |q?| q? edit ? command-line in command-line window
|r| r{char} 2 replace N chars with {char} |r| r{char} 2 replace N chars with {char}
|s| ["x]s 2 (substitute) delete N characters [into |s| ["x]s 2 (substitute) delete N characters [into
buffer x] and start insert register x] and start insert
|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 characterwise 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 buffer x] cursor [into register x]
|y| ["x]y{motion} yank Nmove text [into buffer x] |y| ["x]y{motion} yank Nmove text [into register x]
|yy| ["x]yy yank N lines [into buffer x] |yy| ["x]yy yank N lines [into register x]
|z| z{char} commands starting with 'z', see |z| below |z| z{char} commands starting with 'z', see |z| below
|{| { 1 cursor N paragraphs backward |{| { 1 cursor N paragraphs backward
|bar| | 1 cursor to column N |bar| | 1 cursor to column N
@@ -993,10 +993,12 @@ tag command action in Command-line editing mode ~
|c_<CR>| <CR> execute entered command |c_<CR>| <CR> execute entered command
|c_CTRL-M| CTRL-M same as <CR> |c_CTRL-M| CTRL-M same as <CR>
|c_CTRL-N| CTRL-N after using 'wildchar' with multiple matches: |c_CTRL-N| CTRL-N after using 'wildchar' with multiple matches:
go to next match, otherwise: same as <Down> go to next match, otherwise: recall older
command-line from history.
CTRL-O not used CTRL-O not used
|c_CTRL-P| CTRL-P after using 'wildchar' with multiple matches: |c_CTRL-P| CTRL-P after using 'wildchar' with multiple matches:
go to previous match, otherwise: same as <Up> go to previous match, otherwise: recall older
command-line from history.
|c_CTRL-Q| CTRL-Q same as CTRL-V, unless it's used for terminal |c_CTRL-Q| CTRL-Q same as CTRL-V, unless it's used for terminal
control flow control flow
|c_CTRL-R| CTRL-R {0-9a-z"%#*:= CTRL-F CTRL-P CTRL-W CTRL-A} |c_CTRL-R| CTRL-R {0-9a-z"%#*:= CTRL-F CTRL-P CTRL-W CTRL-A}
@@ -1540,13 +1542,17 @@ tag command action ~
|:tjump| :tj[ump] like ":tselect", but jump directly when there |:tjump| :tj[ump] like ":tselect", but jump directly when there
is only one match is only one match
|:tlast| :tl[ast] jump to last matching tag |:tlast| :tl[ast] jump to last matching tag
|:tmapclear| :tmapc[lear] remove all mappings for Terminal-Job mode
|:tmap| :tma[p] like ":map" but for Terminal-Job mode
|:tmenu| :tm[enu] define menu tooltip |:tmenu| :tm[enu] define menu tooltip
|:tnext| :tn[ext] jump to next matching tag |:tnext| :tn[ext] jump to next matching tag
|:tnoremap| :tno[remap] like ":noremap" but for Terminal-Job mode
|:topleft| :to[pleft] make split window appear at top or far left |:topleft| :to[pleft] make split window appear at top or far left
|:tprevious| :tp[revious] jump to previous matching tag |:tprevious| :tp[revious] jump to previous matching tag
|:trewind| :tr[ewind] jump to first matching tag |:trewind| :tr[ewind] jump to first matching tag
|:try| :try execute commands, abort on error or exception |:try| :try execute commands, abort on error or exception
|:tselect| :ts[elect] list matching tags and select one |:tselect| :ts[elect] list matching tags and select one
|:tunmap| :tunma[p] like ":unmap" but for Terminal-Job mode
|:tunmenu| :tu[nmenu] remove menu tooltip |:tunmenu| :tu[nmenu] remove menu tooltip
|:undo| :u[ndo] undo last change(s) |:undo| :u[ndo] undo last change(s)
|:undojoin| :undoj[oin] join next change with previous undo block |:undojoin| :undoj[oin] join next change with previous undo block

View File

@@ -16,7 +16,7 @@ user manual |usr_24.txt|.
Also see 'virtualedit', for moving the cursor to positions where there is no Also see 'virtualedit', for moving the cursor to positions where there is no
character. Useful for editing a table. character. Useful for editing a table.
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Special keys *ins-special-keys* 1. Special keys *ins-special-keys*
@@ -146,7 +146,8 @@ CTRL-R CTRL-R {0-9a-z"%#*+/:.-=} *i_CTRL-R_CTRL-R*
CTRL-R CTRL-O {0-9a-z"%#*+/:.-=} *i_CTRL-R_CTRL-O* CTRL-R CTRL-O {0-9a-z"%#*+/:.-=} *i_CTRL-R_CTRL-O*
Insert the contents of a register literally and don't Insert the contents of a register literally and don't
auto-indent. Does the same as pasting with the mouse auto-indent. Does the same as pasting with the mouse
|<MiddleMouse>|. |<MiddleMouse>|. When the register is linewise this will
insert the text above the current line, like with `P`.
Does not replace characters! Does not replace characters!
The '.' register (last inserted text) is still inserted as The '.' register (last inserted text) is still inserted as
typed. typed.
@@ -607,13 +608,13 @@ Completion can be done for:
10. User defined completion |i_CTRL-X_CTRL-U| 10. User defined completion |i_CTRL-X_CTRL-U|
11. omni completion |i_CTRL-X_CTRL-O| 11. omni completion |i_CTRL-X_CTRL-O|
12. Spelling suggestions |i_CTRL-X_s| 12. Spelling suggestions |i_CTRL-X_s|
13. keywords in 'complete' |i_CTRL-N| 13. keywords in 'complete' |i_CTRL-N| |i_CTRL-P|
All these (except 2) are done in CTRL-X mode. This is a sub-mode of Insert All these, except CTRL-N and CTRL-P, are done in CTRL-X mode. This is a
and Replace modes. You enter CTRL-X mode by typing CTRL-X and one of the sub-mode of Insert and Replace modes. You enter CTRL-X mode by typing CTRL-X
CTRL-X commands. You exit CTRL-X mode by typing a key that is not a valid and one of the CTRL-X commands. You exit CTRL-X mode by typing a key that is
CTRL-X mode command. Valid keys are the CTRL-X command itself, CTRL-N (next), not a valid CTRL-X mode command. Valid keys are the CTRL-X command itself,
and CTRL-P (previous). CTRL-N (next), and CTRL-P (previous).
Also see the 'infercase' option if you want to adjust the case of the match. Also see the 'infercase' option if you want to adjust the case of the match.
@@ -1076,8 +1077,10 @@ items:
item with the same word is already present. item with the same word is already present.
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
available in |v:completed_item|
All of these except 'icase', 'dup' and 'empty' must be a string. If an item All of these except "icase", "dup" and "empty" must be a string. If an item
does not meet these requirements then an error message is given and further does not meet these requirements then an error message is given and further
items in the list are not used. You can mix string and Dictionary items in items in the list are not used. You can mix string and Dictionary items in
the returned list. the returned list.
@@ -1169,6 +1172,8 @@ The menu is used when:
The 'pumheight' option can be used to set a maximum height. The default is to The 'pumheight' option can be used to set a maximum height. The default is to
use all space available. use all space available.
The 'pumwidth' option can be used to set a minimum width. The default is 15
characters.
There are three states: There are three states:
1. A complete match has been inserted, e.g., after using CTRL-N or CTRL-P. 1. A complete match has been inserted, e.g., after using CTRL-N or CTRL-P.

View File

@@ -6,7 +6,7 @@
Introduction to Vim *ref* *reference* Introduction to Vim *ref* *reference*
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Introduction *intro* 1. Introduction *intro*
@@ -68,8 +68,8 @@ The Vim pages contain the most recent information about Vim. They also
contain links to the most recent version of Vim. The FAQ is a list of contain links to the most recent version of Vim. The FAQ is a list of
Frequently Asked Questions. Read this if you have problems. Frequently Asked Questions. Read this if you have problems.
VIM home page: http://www.vim.org/ Vim home page: http://www.vim.org/
VIM FAQ: http://vimdoc.sf.net/ Vim FAQ: http://vimdoc.sf.net/
Downloading: ftp://ftp.vim.org/pub/vim/MIRRORS Downloading: ftp://ftp.vim.org/pub/vim/MIRRORS
@@ -120,9 +120,14 @@ Report bugs on GitHub: https://github.com/neovim/neovim/issues
Please be brief; all the time that is spent on answering mail is subtracted Please be brief; all the time that is spent on answering mail is subtracted
from the time that is spent on improving Vim! Always give a reproducible from the time that is spent on improving Vim! Always give a reproducible
example and try to find out which settings or other things influence the example and try to find out which settings or other things trigger the bug.
appearance of the bug. Try different machines, if possible. Send me patches
if you can! Preferably start Vim with: >
vim --clean -u reproduce.vim
Where reproduce.vim is a script that reproduces the problem. Try different
machines, if relevant (is this an MS-Windows specific bug perhaps?).
Send me patches if you can!
It will help to include information about the version of Vim you are using and It will help to include information about the version of Vim you are using and
your setup. You can get the information with this command: > your setup. You can get the information with this command: >
@@ -236,6 +241,10 @@ Vim would never have become what it is now, without the help of these people!
Juergen Weigert Lattice version, AUX improvements, Unix and Juergen Weigert Lattice version, AUX improvements, Unix and
MS-DOS ports, autoconf MS-DOS ports, autoconf
Stefan 'Sec' Zehl Maintainer of vim.org Stefan 'Sec' Zehl Maintainer of vim.org
Yasuhiro Matsumoto many MS-Windows improvements
Ken Takata fixes and features
Kazunobu Kuriyama GTK 3
Christian Brabandt many fixes, features, user support, etc.
I wish to thank all the people that sent me bug reports and suggestions. The I wish to thank all the people that sent me bug reports and suggestions. The
list is too long to mention them all here. Vim would not be the same without list is too long to mention them all here. Vim would not be the same without
@@ -249,8 +258,7 @@ Vi "the original". Without further remarks this is the version
of Vi that appeared in Sun OS 4.x. ":version" returns of Vi that appeared in Sun OS 4.x. ":version" returns
"Version 3.7, 6/7/85". Sometimes other versions are referred "Version 3.7, 6/7/85". Sometimes other versions are referred
to. Only runs under Unix. Source code only available with a to. Only runs under Unix. Source code only available with a
license. More information on Vi can be found through: license.
http://vi-editor.org [doesn't currently work...]
*Nvi* *Nvi*
Nvi The "New" Vi. The version of Vi that comes with BSD 4.4 and FreeBSD. Nvi The "New" Vi. The version of Vi that comes with BSD 4.4 and FreeBSD.
Very good compatibility with the original Vi, with a few extensions. Very good compatibility with the original Vi, with a few extensions.
@@ -374,8 +382,7 @@ CTRL-{char} {char} typed as a control character; that is, typing {char}
*key-notation* *key-codes* *keycodes* *key-notation* *key-codes* *keycodes*
These names for keys are used in the documentation. They can also be used These names for keys are used in the documentation. They can also be used
with the ":map" command (insert the key name by pressing CTRL-K and then the with the ":map" command.
key you want the name for).
notation meaning equivalent decimal value(s) ~ notation meaning equivalent decimal value(s) ~
----------------------------------------------------------------------- -----------------------------------------------------------------------
@@ -442,8 +449,8 @@ available on a few terminals.
Note: There are two codes for the delete key. 127 is the decimal ASCII value Note: There are two codes for the delete key. 127 is the decimal ASCII value
for the delete key, which is always recognized. Some delete keys send another for the delete key, which is always recognized. Some delete keys send another
value, in which case this value is obtained from the termcap entry "kD". Both value, in which case this value is obtained from the |terminfo| entry "key_dc".
values have the same effect. Both values have the same effect.
Note: The keypad keys are used in the same way as the corresponding "normal" Note: The keypad keys are used in the same way as the corresponding "normal"
keys. For example, <kHome> has the same effect as <Home>. If a keypad key keys. For example, <kHome> has the same effect as <Home>. If a keypad key
@@ -715,9 +722,9 @@ special situation. Vim will show only part of the line, around where the
cursor is. There are no special characters shown, so that you can edit all cursor is. There are no special characters shown, so that you can edit all
parts of this line. parts of this line.
The '@' occasion in the 'highlight' option can be used to set special The |hl-NonText| highlight group can be used to set special highlighting
highlighting for the '@' and '~' characters. This makes it possible to for the '@' and '~' characters. This makes it possible to distinguish them
distinguish them from real characters in the buffer. from real characters in the buffer.
The 'showbreak' option contains the string to put in front of wrapped lines. The 'showbreak' option contains the string to put in front of wrapped lines.
@@ -784,10 +791,12 @@ by Vim.
============================================================================== ==============================================================================
8. Definitions *definitions* 8. Definitions *definitions*
buffer Contains lines of text, usually read from a file.
screen The whole area that Vim uses to work in. This can be screen The whole area that Vim uses to work in. This can be
a terminal emulator window. Also called "the Vim a terminal emulator window. Also called "the Vim
window". window".
window A view on a buffer. window A view on a buffer. There can be multiple windows for
one buffer.
A screen contains one or more windows, separated by status lines and with the A screen contains one or more windows, separated by status lines and with the
command line at the bottom. command line at the bottom.

View File

@@ -4,42 +4,33 @@
NVIM REFERENCE MANUAL by Thiago de Arruda NVIM REFERENCE MANUAL by Thiago de Arruda
Nvim's facilities for job control *job-control* Nvim job control *job-control*
Type <M-]> to see the table of contents. Job control is a way to perform multitasking in Nvim, so scripts can spawn and
==============================================================================
1. Introduction *job-control-intro*
Job control is a simple way to perform multitasking in vimscript. Wikipedia
contains a more generic/detailed description:
"Job control in computing refers to the control of multiple tasks or Jobs on a
computer system, ensuring that they each have access to adequate resources to
perform correctly, that competition for limited resources does not cause a
deadlock where two or more jobs are unable to complete, resolving such
situations where they do occur, and terminating jobs that, for any reason, are
not performing as expected."
In a few words: It allows a vimscript programmer to concurrently spawn and
control multiple processes without blocking the current Nvim instance. control multiple processes without blocking the current Nvim instance.
Nvim's job control was designed to be simple and familiar to vimscript Type |gO| to see the table of contents.
programmers, instead of being very powerful but complex. Unlike Vim's
facilities for calling with external commands, job control does not depend on
available shells, instead relying on OS functionality for process management.
Internally, Nvim job control is powered by libuv, which has a nice
cross-platform API for managing processes. See https://github.com/libuv/libuv
for details.
============================================================================== ==============================================================================
2. Usage *job-control-usage* Concepts
Job control is achieved by calling a combination of the |jobstart()|, Job Id *job-id*
|jobsend()| and |jobstop()| functions. Here's an example:
> When a job starts it is assigned a number, unique for the life of the current
function! s:JobHandler(job_id, data, event) dict Nvim session. Functions like |jobstart()| return job ids. Functions like
|jobsend()|, |jobstop()|, |rpcnotify()|, and |rpcrequest()| take job ids.
The job's stdio streams are represented as a |channel|. It is possible to send
and recieve raw bytes, or use |msgpack-rpc|.
==============================================================================
Usage *job-control-usage*
To control jobs, use the "job…" family of functions: |jobstart()|,
|jobsend()|, |jobstop()|.
Example: >
function! s:OnEvent(job_id, data, event) dict
if a:event == 'stdout' if a:event == 'stdout'
let str = self.shell.' stdout: '.join(a:data) let str = self.shell.' stdout: '.join(a:data)
elseif a:event == 'stderr' elseif a:event == 'stderr'
@@ -51,42 +42,36 @@ Job control is achieved by calling a combination of the |jobstart()|,
call append(line('$'), str) call append(line('$'), str)
endfunction endfunction
let s:callbacks = { let s:callbacks = {
\ 'on_stdout': function('s:JobHandler'), \ 'on_stdout': function('s:OnEvent'),
\ 'on_stderr': function('s:JobHandler'), \ 'on_stderr': function('s:OnEvent'),
\ 'on_exit': function('s:JobHandler') \ 'on_exit': function('s:OnEvent')
\ } \ }
let job1 = jobstart(['bash'], extend({'shell': 'shell 1'}, s:callbacks)) let job1 = jobstart(['bash'], extend({'shell': 'shell 1'}, s:callbacks))
let job2 = jobstart(['bash', '-c', 'for i in {1..10}; do echo hello $i!; sleep 1; done'], extend({'shell': 'shell 2'}, s:callbacks)) let job2 = jobstart(['bash', '-c', 'for i in {1..10}; do echo hello $i!; sleep 1; done'], extend({'shell': 'shell 2'}, s:callbacks))
To test the above script, copy it to a file ~/foo.vim and run it: >
nvim -u ~/foo.vim
< <
To test the above, copy it to the file ~/jobcontrol.vim and start with a clean Description of what happens:
nvim instance: - Two bash shells are spawned by |jobstart()| with their stdin/stdout/stderr
> streams connected to nvim.
nvim -u NONE -S ~/jobcontrol.vim - The first shell is idle, waiting to read commands from its stdin.
< - The second shell is started with -c which executes the command (a for-loop
Here's what is happening: printing 0 through 9) and then exits.
- `OnEvent()` callback is passed to |jobstart()| to handle various job
events. It displays stdout/stderr data received from the shells.
- Two bash instances are spawned by |jobstart()| with their stdin/stdout/stderr For |on_stdout| and |on_stderr| see |channel-callback|.
connected to nvim. *on_exit*
- The first shell is idle, waiting to read commands from its stdin. Arguments passed to on_exit callback:
- The second shell is started with the -c argument, causing it to execute a 0: |job-id|
command then exit. In this case, the command is a for loop that will print 0 1: Exit-code of the process.
through 9 then exit. 2: Event type: "exit"
- The `JobHandler()` function is a callback passed to |jobstart()| to handle
various job events. It takes care of displaying stdout/stderr received from
the shells.
*on_stdout* *on_stderr* *on_exit*
- The arguments passed to `JobHandler()` are:
0: The job id
1: If the event is "stdout" or "stderr", a list with lines read from the
corresponding stream. For "exit", it is the status returned by the
program.
2: The event type, which is "stdout", "stderr" or "exit".
Note: Buffered stdout/stderr data which has not been flushed by the sender Note: Buffered stdout/stderr data which has not been flushed by the sender
will not trigger the "stdout" callback (but if the process ends, the will not trigger the on_stdout/on_stderr callback (but if the process
"exit" callback will be triggered). ends, the on_exit callback will be invoked).
For example, "ruby -e" buffers output, so small strings will be For example, "ruby -e" buffers output, so small strings will be
buffered unless "auto-flushing" ($stdout.sync=true) is enabled. > buffered unless "auto-flushing" ($stdout.sync=true) is enabled. >
function! Receive(job_id, data, event) function! Receive(job_id, data, event)
@@ -97,54 +82,64 @@ Here's what is happening:
\ {'on_stdout': 'Receive'}) \ {'on_stdout': 'Receive'})
< https://github.com/neovim/neovim/issues/1592 < https://github.com/neovim/neovim/issues/1592
The options dictionary is passed as the "self" variable to the callback Note 2:
function. Here's a more object-oriented version of the above: Job event handlers may receive partial (incomplete) lines. For a given
> invocation of on_stdout/on_stderr, `a:data` is not guaranteed to end
with a newline.
- `abcdefg` may arrive as `['abc']`, `['defg']`.
- `abc\nefg` may arrive as `['abc', '']`, `['efg']` or `['abc']`,
`['','efg']`, or even `['ab']`, `['c','efg']`.
Easy way to deal with this: initialize a list as `['']`, then append
to it as follows: >
let s:chunks = ['']
func! s:on_stdout(job_id, data, event) dict
let s:chunks[-1] .= a:data[0]
call extend(s:chunks, a:data[1:])
endf
<
The |jobstart-options| dictionary is passed as |self| to the callback.
The above example could be written in this "object-oriented" style: >
let Shell = {} let Shell = {}
function Shell.on_stdout(job_id, data) dict function Shell.on_stdout(_job_id, data, event)
call append(line('$'), self.get_name().' stdout: '.join(a:data)) call append(line('$'),
\ printf('[%s] %s: %s', a:event, self.name, join(a:data[:-2])))
endfunction endfunction
function Shell.on_stderr(job_id, data) dict let Shell.on_stderr = function(Shell.on_stdout)
call append(line('$'), self.get_name().' stderr: '.join(a:data))
function Shell.on_exit(job_id, _data, event)
let msg = printf('job %d ("%s") finished', a:job_id, self.name)
call append(line('$'), printf('[%s] BOOM!', a:event))
call append(line('$'), printf('[%s] %s!', a:event, msg))
endfunction endfunction
function Shell.on_exit(job_id, data) dict function Shell.new(name, cmd)
call append(line('$'), self.get_name().' exited') let object = extend(copy(g:Shell), {'name': a:name})
let object.cmd = ['sh', '-c', a:cmd]
let object.id = jobstart(object.cmd, object)
$
return object
endfunction endfunction
function Shell.get_name() dict let instance = Shell.new('bomb',
return 'shell '.self.name \ 'for i in $(seq 9 -1 1); do echo $i 1>&$((i % 2 + 1)); sleep 1; done')
endfunction <
To send data to the job's stdin, use |chansend()|: >
function Shell.new(name, ...) dict :call chansend(job1, "ls\n")
let instance = extend(copy(g:Shell), {'name': a:name}) :call chansend(job1, "invalid-command\n")
let argv = ['bash'] :call chansend(job1, "exit\n")
if a:0 > 0 <
let argv += ['-c', a:1] A job may be killed with |jobstop()|: >
endif :call jobstop(job1)
let instance.id = jobstart(argv, instance)
return instance
endfunction
let s1 = Shell.new('1')
let s2 = Shell.new('2', 'for i in {1..10}; do echo hello $i!; sleep 1; done')
To send data to the job's stdin, one can use the |jobsend()| function, like
this:
>
:call jobsend(job1, "ls\n")
:call jobsend(job1, "invalid-command\n")
:call jobsend(job1, "exit\n")
< <
A job may be killed at any time with the |jobstop()| function: A job may be killed at any time with the |jobstop()| function:
> >
:call jobstop(job1) :call jobstop(job1)
< <
When |jobstop()| is called, `SIGTERM` will be sent to the job. If a job does Individual streams can be closed without killing the job, see |chanclose()|.
not exit after 2 seconds, `SIGKILL` will be sent.
============================================================================== ==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl: vim:tw=78:ts=8:noet:ft=help:norl:

View File

@@ -9,13 +9,13 @@ Key mapping, abbreviations and user-defined commands.
This subject is introduced in sections |05.3|, |24.7| and |40.1| of the user This subject is introduced in sections |05.3|, |24.7| and |40.1| of the user
manual. manual.
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Key mapping *key-mapping* *mapping* *macro* 1. Key mapping *key-mapping* *mapping* *macro*
Key mapping is used to change the meaning of typed keys. The most common use Key mapping is used to change the meaning of typed keys. The most common use
is to define a sequence commands for a function key. Example: > is to define a sequence of commands for a function key. Example: >
:map <F2> a<C-R>=strftime("%c")<CR><Esc> :map <F2> a<C-R>=strftime("%c")<CR><Esc>
@@ -41,7 +41,7 @@ modes.
:im[ap] {lhs} {rhs} |mapmode-i| *:im* *:imap* :im[ap] {lhs} {rhs} |mapmode-i| *:im* *:imap*
:lm[ap] {lhs} {rhs} |mapmode-l| *:lm* *:lmap* :lm[ap] {lhs} {rhs} |mapmode-l| *:lm* *:lmap*
:cm[ap] {lhs} {rhs} |mapmode-c| *:cm* *:cmap* :cm[ap] {lhs} {rhs} |mapmode-c| *:cm* *:cmap*
:tm[ap] {lhs} {rhs} |mapmode-t| *:tm* *:tmap* :tma[p] {lhs} {rhs} |mapmode-t| *:tma* *:tmap*
Map the key sequence {lhs} to {rhs} for the modes Map the key sequence {lhs} to {rhs} for the modes
where the map command applies. The result, including where the map command applies. The result, including
{rhs}, is then further scanned for mappings. This {rhs}, is then further scanned for mappings. This
@@ -75,7 +75,7 @@ modes.
:iu[nmap] {lhs} |mapmode-i| *:iu* *:iunmap* :iu[nmap] {lhs} |mapmode-i| *:iu* *:iunmap*
:lu[nmap] {lhs} |mapmode-l| *:lu* *:lunmap* :lu[nmap] {lhs} |mapmode-l| *:lu* *:lunmap*
:cu[nmap] {lhs} |mapmode-c| *:cu* *:cunmap* :cu[nmap] {lhs} |mapmode-c| *:cu* *:cunmap*
:tu[nmap] {lhs} |mapmode-t| *:tu* *:tunmap* :tunma[p] {lhs} |mapmode-t| *:tunma* *:tunmap*
Remove the mapping of {lhs} for the modes where the Remove the mapping of {lhs} for the modes where the
map command applies. The mapping may remain defined map command applies. The mapping may remain defined
for other modes where it applies. for other modes where it applies.
@@ -111,7 +111,7 @@ modes.
:im[ap] |mapmode-i| :im[ap] |mapmode-i|
:lm[ap] |mapmode-l| :lm[ap] |mapmode-l|
:cm[ap] |mapmode-c| :cm[ap] |mapmode-c|
:tm[ap] |mapmode-t| :tma[p] |mapmode-t|
List all key mappings for the modes where the map List all key mappings for the modes where the map
command applies. Note that ":map" and ":map!" are command applies. Note that ":map" and ":map!" are
used most often, because they include the other modes. used most often, because they include the other modes.
@@ -126,7 +126,7 @@ modes.
:im[ap] {lhs} |mapmode-i| *:imap_l* :im[ap] {lhs} |mapmode-i| *:imap_l*
:lm[ap] {lhs} |mapmode-l| *:lmap_l* :lm[ap] {lhs} |mapmode-l| *:lmap_l*
:cm[ap] {lhs} |mapmode-c| *:cmap_l* :cm[ap] {lhs} |mapmode-c| *:cmap_l*
:tm[ap] {lhs} |mapmode-t| *:tmap_l* :tma[p] {lhs} |mapmode-t| *:tmap_l*
List the key mappings for the key sequences starting List the key mappings for the key sequences starting
with {lhs} in the modes where the map command applies. with {lhs} in the modes where the map command applies.
@@ -149,7 +149,7 @@ type "a", then "bar" will get inserted.
1.2 SPECIAL ARGUMENTS *:map-arguments* 1.2 SPECIAL ARGUMENTS *:map-arguments*
"<buffer>", "<nowait>", "<silent>", "<special>", "<script>", "<expr>" and "<buffer>", "<nowait>", "<silent>", "<script>", "<expr>" and
"<unique>" can be used in any order. They must appear right after the "<unique>" can be used in any order. They must appear right after the
command, before any other arguments. command, before any other arguments.
@@ -175,7 +175,7 @@ that starts with ",". Then you need to type another character for Vim to know
whether to use the "," mapping or the longer one. To avoid this add the whether to use the "," mapping or the longer one. To avoid this add the
<nowait> argument. Then the mapping will be used when it matches, Vim does <nowait> argument. Then the mapping will be used when it matches, Vim does
not wait for more characters to be typed. However, if the characters were not wait for more characters to be typed. However, if the characters were
already type they are used. already typed they are used.
*:map-<silent>* *:map-silent* *:map-<silent>* *:map-silent*
To define a mapping which will not be echoed on the command line, add To define a mapping which will not be echoed on the command line, add
@@ -189,12 +189,6 @@ Prompts will still be given, e.g., for inputdialog().
Using "<silent>" for an abbreviation is possible, but will cause redrawing of Using "<silent>" for an abbreviation is possible, but will cause redrawing of
the command line to fail. the command line to fail.
*:map-<special>* *:map-special*
Define a mapping with <> notation for special keys, even though the "<" flag
may appear in 'cpoptions'. This is useful if the side effect of setting
'cpoptions' is not desired. Example: >
:map <special> <F12> /Header<CR>
<
*:map-<script>* *:map-script* *:map-<script>* *:map-script*
If the first argument to one of these commands is "<script>" and it is used to If the first argument to one of these commands is "<script>" and it is used to
define a new mapping or abbreviation, the mapping will only remap characters define a new mapping or abbreviation, the mapping will only remap characters
@@ -238,8 +232,10 @@ For this reason the following is blocked:
- Editing another buffer. - Editing another buffer.
- The |:normal| command. - The |:normal| command.
- Moving the cursor is allowed, but it is restored afterwards. - Moving the cursor is allowed, but it is restored afterwards.
- If the cmdline is changed, the old text and cursor position are restored.
If you want the mapping to do any of these let the returned characters do If you want the mapping to do any of these let the returned characters do
that. that. Alternatively use a |<Cmd>| mapping which doesn't have these
restrictions.
You can use getchar(), it consumes typeahead if there is any. E.g., if you You can use getchar(), it consumes typeahead if there is any. E.g., if you
have these mappings: > have these mappings: >
@@ -278,6 +274,29 @@ again for using <expr>. This does work: >
Using 0x80 as a single byte before other text does not work, it will be seen Using 0x80 as a single byte before other text does not work, it will be seen
as a special key. as a special key.
*<Cmd>* *:map-command*
A command mapping is a mapping that directly executes a command. Command
mappings are written by placing a command in between <Cmd> and <CR> in the
rhs of a mapping (in any mode): >
noremap <f3> <Cmd>echo mode(1)<cr>
<
*E5520*
The command must be complete and ended with a <CR>. If the command is
incomplete, an error is raised. |Command-line| mode is never entered.
This is more flexible than using `:<c-u>` in visual and operator pending
mode, or `<c-o>:` in insert mode, as the commands are exectued directly in the
mode, and not normal mode. Also visual mode is not aborted. Commands can be
invoked directly in cmdline mode, which is not simple otherwise (a timer has
to be used). Unlike <expr> mappings, there are not any specific restrictions
what the command can do, except for what is normally possible to do in every
specific mode. The command should be executed the same way as if an
(unrestricted) |autocmd| was invoked or an async event event was processed.
Note: In select mode, |:map| or |:vmap| command mappings will be executed in
visual mode. If a mapping is intended to work in select mode, it is
recomendend to map it using |:smap|, possibly in addition to the same mapping
with |:map| or |:xmap|.
1.3 MAPPING AND MODES *:map-modes* 1.3 MAPPING AND MODES *:map-modes*
*mapmode-nvo* *mapmode-n* *mapmode-v* *mapmode-o* *mapmode-t* *mapmode-nvo* *mapmode-n* *mapmode-v* *mapmode-o* *mapmode-t*
@@ -443,17 +462,15 @@ There are two ways to map a special key:
1. The Vi-compatible method: Map the key code. Often this is a sequence that 1. The Vi-compatible method: Map the key code. Often this is a sequence that
starts with <Esc>. To enter a mapping like this you type ":map " and then starts with <Esc>. To enter a mapping like this you type ":map " and then
you have to type CTRL-V before hitting the function key. Note that when you have to type CTRL-V before hitting the function key. Note that when
the key code for the key is in the termcap, it will automatically be the key code for the key is in the |terminfo| entry, it will automatically
translated into the internal code and become the second way of mapping be translated into the internal code and become the second way of mapping.
(unless the 'k' flag is included in 'cpoptions').
2. The second method is to use the internal code for the function key. To 2. The second method is to use the internal code for the function key. To
enter such a mapping type CTRL-K and then hit the function key, or use enter such a mapping type CTRL-K and then hit the function key, or use
the form "#1", "#2", .. "#9", "#0", "<Up>", "<S-Down>", "<S-F7>", etc. the form "#1", "#2", .. "#9", "#0", "<Up>", "<S-Down>", "<S-F7>", etc.
(see table of keys |key-notation|, all keys from <Up> can be used). The (see table of keys |key-notation|, all keys from <Up> can be used). The
first ten function keys can be defined in two ways: Just the number, like first ten function keys can be defined in two ways: Just the number, like
"#2", and with "<F>", like "<F2>". Both stand for function key 2. "#0" "#2", and with "<F>", like "<F2>". Both stand for function key 2. "#0"
refers to function key 10. The <> form cannot be used when 'cpoptions' refers to function key 10.
includes the '<' flag.
DETAIL: Vim first checks if a sequence from the keyboard is mapped. If it DETAIL: Vim first checks if a sequence from the keyboard is mapped. If it
isn't the terminal key codes are tried. If a terminal code is found it is isn't the terminal key codes are tried. If a terminal code is found it is
@@ -564,16 +581,17 @@ Upper and lowercase differences are ignored.
*map-comments* *map-comments*
It is not possible to put a comment after these commands, because the '"' It is not possible to put a comment after these commands, because the '"'
character is considered to be part of the {lhs} or {rhs}. character is considered to be part of the {lhs} or {rhs}. However, one can
use |", since this starts a new, empty command with a comment.
*map_bar* *map-bar* *map_bar* *map-bar*
Since the '|' character is used to separate a map command from the next Since the '|' character is used to separate a map command from the next
command, you will have to do something special to include a '|' in {rhs}. command, you will have to do something special to include a '|' in {rhs}.
There are three methods: There are three methods:
use works when example ~ use works when example ~
<Bar> '<' is not in 'cpoptions' :map _l :!ls <Bar> more^M <Bar> always :map _l :!ls <Bar> more^M
\| 'b' is not in 'cpoptions' :map _l :!ls \| more^M \| 'b' is not in 'cpoptions' :map _l :!ls \| more^M
^V| always, in Vim and Vi :map _l :!ls ^V| more^M ^V| always :map _l :!ls ^V| more^M
(here ^V stands for CTRL-V; to get one CTRL-V you have to type it twice; you (here ^V stands for CTRL-V; to get one CTRL-V you have to type it twice; you
cannot use the <> notation "<C-V>" here). cannot use the <> notation "<C-V>" here).
@@ -628,8 +646,7 @@ out about, ^D is CTRL-D).
1.8 EXAMPLES *map-examples* 1.8 EXAMPLES *map-examples*
A few examples (given as you type them, for "<CR>" you type four characters; A few examples (as you type them: for "<CR>" you type four characters). >
the '<' flag must not be present in 'cpoptions' for this to work). >
:map <F3> o#include :map <F3> o#include
:map <M-g> /foo<CR>cwbar<Esc> :map <M-g> /foo<CR>cwbar<Esc>
@@ -661,7 +678,7 @@ option). After that it assumes that the 'q' is to be interpreted as such. If
you type slowly, or your system is slow, reset the 'timeout' option. Then you you type slowly, or your system is slow, reset the 'timeout' option. Then you
might want to set the 'ttimeout' option. might want to set the 'ttimeout' option.
*map-precedence* *map-precedence*
Buffer-local mappings (defined using |:map-<buffer>|) take precedence over Buffer-local mappings (defined using |:map-<buffer>|) take precedence over
global mappings. When a buffer-local mapping is the same as a global mapping, global mappings. When a buffer-local mapping is the same as a global mapping,
Vim will use the buffer-local mapping. In addition, Vim will use a complete Vim will use the buffer-local mapping. In addition, Vim will use a complete
@@ -881,7 +898,6 @@ character is mostly ignored otherwise.
It is possible to move the cursor after an abbreviation: > It is possible to move the cursor after an abbreviation: >
:iab if if ()<Left> :iab if if ()<Left>
This does not work if 'cpoptions' includes the '<' flag. |<>|
You can even do more complicated things. For example, to consume the space You can even do more complicated things. For example, to consume the space
typed after an abbreviation: > typed after an abbreviation: >
@@ -1029,8 +1045,7 @@ functions used in one script use the same name as in other scripts. To avoid
this, they can be made local to the script. this, they can be made local to the script.
*<SID>* *<SNR>* *E81* *<SID>* *<SNR>* *E81*
The string "<SID>" can be used in a mapping or menu. This requires that the The string "<SID>" can be used in a mapping or menu.
'<' flag is not present in 'cpoptions'.
When executing the map command, Vim will replace "<SID>" with the special When executing the map command, Vim will replace "<SID>" with the special
key code <SNR>, followed by a number that's unique for the script, and an key code <SNR>, followed by a number that's unique for the script, and an
underscore. Example: > underscore. Example: >
@@ -1213,6 +1228,7 @@ completion can be enabled:
-complete=locale locale names (as output of locale -a) -complete=locale locale names (as output of locale -a)
-complete=mapping mapping name -complete=mapping mapping name
-complete=menu menus -complete=menu menus
-complete=messages |:messages| suboptions
-complete=option options -complete=option options
-complete=packadd optional package |pack-add| names -complete=packadd optional package |pack-add| names
-complete=shellcmd Shell command -complete=shellcmd Shell command

View File

@@ -14,7 +14,7 @@ For an introduction to the most common features, see |usr_45.txt| in the user
manual. manual.
For changing the language of messages and menus see |mlang.txt|. For changing the language of messages and menus see |mlang.txt|.
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
Getting started *mbyte-first* Getting started *mbyte-first*

View File

@@ -8,7 +8,7 @@ This file contains an alphabetical list of messages and error messages that
Vim produces. You can use this if you don't understand what the message Vim produces. You can use this if you don't understand what the message
means. It is not complete though. means. It is not complete though.
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Old messages *:messages* *:mes* *message-history* 1. Old messages *:messages* *:mes* *message-history*
@@ -449,12 +449,6 @@ changed. To avoid the message reset the 'warn' option.
Something inside Vim went wrong and resulted in a NULL pointer. If you know Something inside Vim went wrong and resulted in a NULL pointer. If you know
how to reproduce this problem, please report it. |bugs| how to reproduce this problem, please report it. |bugs|
*E172* >
Only one file name allowed
The ":edit" command only accepts one file name. When you want to specify
several files for editing use ":next" |:next|.
*E41* *E82* *E83* *E342* > *E41* *E82* *E83* *E342* >
Out of memory! Out of memory!
Out of memory! (allocating {number} bytes) Out of memory! (allocating {number} bytes)
@@ -631,6 +625,9 @@ starts. It can be fixed in one of these ways:
- Just write the file again the next day. Or set your clock to the next day, - Just write the file again the next day. Or set your clock to the next day,
write the file twice and set the clock back. write the file twice and set the clock back.
If you get W11 all the time, you may need to disable "Acronis Active
Protection" or register Vim as a trusted service/application.
*W12* > *W12* >
Warning: File "{filename}" has changed and the buffer was changed in Vim as well Warning: File "{filename}" has changed and the buffer was changed in Vim as well
@@ -750,6 +747,13 @@ a user-defined command.
You tried to set an option after startup that only allows changes during You tried to set an option after startup that only allows changes during
startup. startup.
*E943* >
Command table needs to be updated, run 'make cmdidxs'
This can only happen when changing the source code, when adding a command in
src/ex_cmds.h. The lookup table then needs to be updated, by running: >
make cmdidxs
============================================================================== ==============================================================================
3. Messages *messages* 3. Messages *messages*

View File

@@ -11,7 +11,7 @@ multi-byte text see |multibyte|.
The basics are explained in the user manual: |usr_45.txt|. The basics are explained in the user manual: |usr_45.txt|.
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Messages *multilang-messages* 1. Messages *multilang-messages*
@@ -172,6 +172,7 @@ Send an e-mail to the Vim maintainer <maintainer@vim.org>.
special characters like "&" and "<Tab>" need to be special characters like "&" and "<Tab>" need to be
included. Spaces and dots need to be escaped with a included. Spaces and dots need to be escaped with a
backslash, just like in other |:menu| commands. backslash, just like in other |:menu| commands.
Case in {english} is ignored.
See the $VIMRUNTIME/lang directory for examples. See the $VIMRUNTIME/lang directory for examples.

View File

@@ -26,7 +26,7 @@ The 'virtualedit' option can be set to make it possible to move the cursor to
positions where there is no character or within a multi-column character (like positions where there is no character or within a multi-column character (like
a tab). a tab).
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Motions and operators *operator* 1. Motions and operators *operator*
@@ -184,7 +184,7 @@ l or *l*
*$* *<End>* *<kEnd>* *$* *<End>* *<kEnd>*
$ or <End> To the end of the line. When a count is given also go $ or <End> To the end of the line. When a count is given also go
[count - 1] lines downward |inclusive|. [count - 1] lines downward. |inclusive| motion.
In Visual mode the cursor goes to just after the last In Visual mode the cursor goes to just after the last
character in the line. character in the line.
When 'virtualedit' is active, "$" may move the cursor When 'virtualedit' is active, "$" may move the cursor
@@ -886,6 +886,7 @@ was made yet in the current file.
then the position can be near the end of what the then the position can be near the end of what the
command changed. For example when inserting a word, command changed. For example when inserting a word,
the position will be on the last character. the position will be on the last character.
To jump to older changes use |g;|.
*'(* *`(* *'(* *`(*
'( `( To the start of the current sentence, like the |(| '( `( To the start of the current sentence, like the |(|

View File

@@ -1,4 +1,3 @@
*msgpack_rpc.txt* Nvim
NVIM REFERENCE MANUAL by Thiago de Arruda NVIM REFERENCE MANUAL by Thiago de Arruda
@@ -6,7 +5,7 @@
RPC API for Nvim *RPC* *rpc* *msgpack-rpc* RPC API for Nvim *RPC* *rpc* *msgpack-rpc*
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Introduction *rpc-intro* 1. Introduction *rpc-intro*
@@ -61,24 +60,24 @@ To get a formatted dump of the API using python (requires the `pyyaml` and
============================================================================== ==============================================================================
3. Connecting *rpc-connecting* 3. Connecting *rpc-connecting*
There are several ways to open a msgpack-rpc channel to an Nvim instance: See |channel-intro|, for various ways to open a channel. Most of the channel
opening functions take an `rpc` key in the options dictionary, to enable rpc.
1. Through stdin/stdout when `nvim` is started with `--embed`. This is how Additionally, rpc channels can be opened by other processes connecting to
applications can embed Nvim. TCP/IP sockets or named pipes listened to by nvim.
2. Through stdin/stdout of some other process spawned by |jobstart()|. An rpc socket is automatically created with each instance. The socket
Set the "rpc" key to |v:true| in the options dict to use the job's stdin location is stored in |v:servername|. By default this is a named pipe
and stdout as a single msgpack channel that is processed directly by with an automatically generated address. See |XXX|.
Nvim. Then it is not possible to process raw data to or from the
process's stdin and stdout. stderr can still be used, though.
3. Through the socket automatically created with each instance. The socket To make Nvim listen on a TCP/IP socket instead, set the
location is stored in |v:servername|. |$NVIM_LISTEN_ADDRESS| environment variable before starting Nvim: >
4. Through a TCP/IP socket. To make Nvim listen on a TCP/IP socket, set the
|$NVIM_LISTEN_ADDRESS| environment variable before starting Nvim: >
NVIM_LISTEN_ADDRESS=127.0.0.1:6666 nvim NVIM_LISTEN_ADDRESS=127.0.0.1:6666 nvim
< <Also, more sockets and named pipes can be listened on using |serverstart()|.
Note that localhost TCP sockets are generally less secure than named pipes,
and can lead to vunerabilities like remote code execution.
Connecting to the socket is the easiest way a programmer can test the API, Connecting to the socket is the easiest way a programmer can test the API,
which can be done through any msgpack-rpc client library or full-featured which can be done through any msgpack-rpc client library or full-featured
|api-client|. Here's a Ruby script that prints 'hello world!' in the current |api-client|. Here's a Ruby script that prints 'hello world!' in the current
@@ -175,7 +174,7 @@ contains information that makes this task easier (see also |rpc-types|):
even more strongly-typed APIs. even more strongly-typed APIs.
- Functions that are considered to be methods that operate on instances of - Functions that are considered to be methods that operate on instances of
Nvim special types (msgpack EXT) will have the `"method"` attribute set to Nvim special types (msgpack EXT) will have the `"method"` attribute set to
`true`. The reciever type is the type of the first argument. The method `true`. The receiver type is the type of the first argument. The method
names are prefixed with `nvim_` plus a shortened type name, e.g. names are prefixed with `nvim_` plus a shortened type name, e.g.
`nvim_buf_get_lines` represents the `get_lines` method of a Buffer instance. `nvim_buf_get_lines` represents the `get_lines` method of a Buffer instance.
- Global functions have `"method"` set to `false` and are prefixed with just - Global functions have `"method"` set to `false` and are prefixed with just
@@ -243,203 +242,4 @@ Even for statically compiled clients it is good practice to avoid hardcoding
the type codes, because a client may be built against one Nvim version but the type codes, because a client may be built against one Nvim version but
connect to another with different type codes. connect to another with different type codes.
============================================================================== vim:tw=78:ts=8:ft=help:norl:
6. Remote UIs *rpc-remote-ui*
GUIs can be implemented as external processes communicating with Nvim over the
RPC API. The UI model consists of a terminal-like grid with a single,
monospace font size. Some elements (UI "widgets") can be drawn separately from
the grid ("externalized").
After connecting to Nvim (usually a spawned, embedded instance) use the
|nvim_ui_attach| API method to tell Nvim that your program wants to draw the
Nvim screen on a grid of width × height cells. `options` must be
a dictionary with these (optional) keys:
`rgb` Controls what color format to use.
Set to true (default) to use 24-bit rgb
colors.
Set to false to use terminal color codes (at
most 256 different colors).
`ext_popupmenu` Externalize the popupmenu. |ui-ext-popupmenu|
`ext_tabline` Externalize the tabline. |ui-ext-tabline|
Externalized widgets will not be drawn by
Nvim; only high-level data will be published
in new UI event kinds.
Nvim will then send msgpack-rpc notifications, with the method name "redraw"
and a single argument, an array of screen updates (described below). These
should be processed in order. Preferably the user should only be able to see
the screen state after all updates in the same "redraw" event are processed
(not any intermediate state after processing only a part of the array).
Future versions of Nvim may add new update kinds and may append new parameters
to existing update kinds. Clients must be prepared to ignore such extensions
to be forward-compatible. |api-contract|
Screen updates are tuples whose first element is the string name of the update
kind.
["resize", width, height]
The grid is resized to `width` and `height` cells.
["clear"]
Clear the screen.
["eol_clear"]
Clear from the cursor position to the end of the current line.
["cursor_goto", row, col]
Move the cursor to position (row, col). Currently, the same cursor is
used to define the position for text insertion and the visible cursor.
However, only the last cursor position, after processing the entire
array in the "redraw" event, is intended to be a visible cursor
position.
["update_fg", color]
["update_bg", color]
["update_sp", color]
Set the default foreground, background and special colors
respectively.
["highlight_set", attrs]
Set the attributes that the next text put on the screen will have.
`attrs` is a dict with the keys below. Any absent key is reset
to its default value. Color defaults are set by the `update_fg` etc
updates. All boolean keys default to false.
`foreground`: foreground color.
`background`: backround color.
`special`: color to use for underline and undercurl, when present.
`reverse`: reverse video. Foreground and background colors are
switched.
`italic`: italic text.
`bold`: bold text.
`underline`: underlined text. The line has `special` color.
`undercurl`: undercurled text. The curl has `special` color.
["put", text]
The (utf-8 encoded) string `text` is put at the cursor position
(and the cursor is advanced), with the highlights as set by the
last `highlight_set` update.
["set_scroll_region", top, bot, left, right]
Define the scroll region used by `scroll` below.
["scroll", count]
Scroll the text in the scroll region. The diagrams below illustrate
what will happen, depending on the scroll direction. "=" is used to
represent the SR(scroll region) boundaries and "-" the moved rectangles.
Note that dst and src share a common region.
If count is bigger than 0, move a rectangle in the SR up, this can
happen while scrolling down.
>
+-------------------------+
| (clipped above SR) | ^
|=========================| dst_top |
| dst (still in SR) | |
+-------------------------+ src_top |
| src (moved up) and dst | |
|-------------------------| dst_bot |
| src (cleared) | |
+=========================+ src_bot
<
If count is less than zero, move a rectangle in the SR down, this can
happen while scrolling up.
>
+=========================+ src_top
| src (cleared) | |
|------------------------ | dst_top |
| src (moved down) and dst| |
+-------------------------+ src_bot |
| dst (still in SR) | |
|=========================| dst_bot |
| (clipped below SR) | v
+-------------------------+
<
["set_title", title]
["set_icon", icon]
Set the window title, and icon (minimized) window title, respectively.
In windowing systems not distinguishing between the two, "set_icon"
can be ignored.
["mouse_on"]
["mouse_off"]
Tells the client whether mouse support, as determined by |'mouse'|
option, is considered to be active in the current mode. This is mostly
useful for a terminal frontend, or other situations where nvim mouse
would conflict with other usages of the mouse. It is safe for a client
to ignore this and always send mouse events.
["busy_on"]
["busy_off"]
Nvim started or stopped being busy, and possibly not responsible to user
input. This could be indicated to the user by hiding the cursor.
["suspend"]
|:suspend| command or |Ctrl-Z| mapping is used. A terminal client (or other
client where it makes sense) could suspend itself. Other clients can
safely ignore it.
["bell"]
["visual_bell"]
Notify the user with an audible or visual bell, respectively.
["update_menu"]
The menu mappings changed.
["mode_info_set", cursor_style_enabled, mode_info]
`cursor_style_enabled` is a boolean indicating if the UI should set the cursor
style. `mode_info` is a list of mode property maps. The current mode is given
by the `mode_idx` field of the `mode_change` event.
Each mode property map may contain these keys:
KEY DESCRIPTION ~
`cursor_shape`: "block", "horizontal", "vertical"
`cell_percentage`: Cell % occupied by the cursor.
`blinkwait`, `blinkon`, `blinkoff`: See |cursor-blinking|.
`hl_id`: Cursor highlight group.
`hl_lm`: Cursor highlight group if 'langmap' is active.
`short_name`: Mode code name, see 'guicursor'.
`name`: Mode descriptive name.
`mouse_shape`: (To be implemented.)
Some keys are missing in some modes.
["mode_change", mode, mode_idx]
The mode changed. The first parameter `mode` is a string representing the
current mode. `mode_idx` is an index into the array received in the
`mode_info_set` event. UIs should change the cursor style according to the
properties specified in the corresponding item. The set of modes reported will
change in new versions of Nvim, for instance more submodes and temporary
states might be represented as separate modes.
*ui-ext-popupmenu*
["popupmenu_show", items, selected, row, col]
When `popupmenu_external` is set to true, nvim will not draw the
popupmenu on the grid, instead when the popupmenu is to be displayed
this update is sent. `items` is an array of the items to show, the
items are themselves arrays of the form [word, kind, menu, info]
as defined at |complete-items|, except that `word` is replaced by
`abbr` if present. `selected` is the initially selected item, either a
zero-based index into the array of items, or -1 if no item is
selected. `row` and `col` is the anchor position, where the first
character of the completed word will be.
["popupmenu_select", selected]
An item in the currently displayed popupmenu is selected. `selected`
is either a zero-based index into the array of items from the last
`popupmenu_show` event, or -1 if no item is selected.
["popupmenu_hide"]
The popupmenu is hidden.
*ui-ext-tabline*
["tabline_update", curtab, tabs]
Tabline was updated. UIs should present this data in a custom tabline
widget.
curtab: Current Tabpage
tabs: List of Dicts [{ "tab": Tabpage, "name": String }, ...]
==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl:

View File

@@ -6,6 +6,8 @@
Nvim *nvim* *nvim-intro* Nvim *nvim* *nvim-intro*
Nvim is based on Vim by Bram Moolenaar.
If you are new to Vim see |help.txt|, or type ":Tutor". If you are new to Vim see |help.txt|, or type ":Tutor".
If you already use Vim see |nvim-from-vim| for a quickstart. If you already use Vim see |nvim-from-vim| for a quickstart.
@@ -13,7 +15,7 @@ Nvim is emphatically a fork of Vim, not a clone: compatibility with Vim is
maintained where possible. See |vim_diff.txt| for the complete reference of maintained where possible. See |vim_diff.txt| for the complete reference of
differences from Vim. differences from Vim.
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
Transitioning from Vim *nvim-from-vim* Transitioning from Vim *nvim-from-vim*

View File

@@ -10,15 +10,18 @@ Nvim embeds a VT220/xterm terminal emulator based on libvterm. The terminal is
presented as a special buffer type, asynchronously updated from the virtual presented as a special buffer type, asynchronously updated from the virtual
terminal as data is received from the program connected to it. terminal as data is received from the program connected to it.
Terminal buffers behave mostly like normal 'nomodifiable' buffers, except: Terminal buffers behave like normal buffers, except:
- Plugins can set 'modifiable' to modify text, but lines cannot be deleted. - With 'modifiable', lines can be edited but not deleted.
- 'scrollback' controls how many off-screen lines are kept. - 'scrollback' controls how many lines are kept.
- Terminal output is followed if the cursor is on the last line. - Output is followed if the cursor is on the last line.
- 'modified' is the default. You can set 'nomodified' to avoid a warning when
closing the terminal buffer.
- 'bufhidden' defaults to "hide".
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
Spawning *terminal-emulator-spawning* Start *terminal-start*
There are 3 ways to create a terminal buffer: There are 3 ways to create a terminal buffer:
@@ -35,13 +38,12 @@ There are 3 ways to create a terminal buffer:
autocmd VimEnter * nested split term://sh autocmd VimEnter * nested split term://sh
< This is only mentioned for reference; use |:terminal| instead. < This is only mentioned for reference; use |:terminal| instead.
When the terminal spawns the program, the buffer will start to mirror the When the terminal starts, the buffer contents are updated and the buffer is
terminal display and change its name to `term://{cwd}//{pid}:{cmd}`. named in the form of `term://{cwd}//{pid}:{cmd}`. This naming scheme is used
The "term://..." scheme enables |:mksession| to "restore" a terminal buffer by by |:mksession| to restore a terminal buffer (by restarting the {cmd}).
restarting the {cmd} when the session is loaded.
============================================================================== ==============================================================================
Input *terminal-emulator-input* Input *terminal-input*
To send input, enter |Terminal-mode| using any command that would enter "insert To send input, enter |Terminal-mode| using any command that would enter "insert
mode" in a normal buffer, such as |i| or |:startinsert|. In this mode all keys mode" in a normal buffer, such as |i| or |:startinsert|. In this mode all keys
@@ -83,9 +85,9 @@ Mouse input has the following behavior:
the terminal wont lose focus and the hovered window will be scrolled. the terminal wont lose focus and the hovered window will be scrolled.
============================================================================== ==============================================================================
Configuration *terminal-emulator-configuration* Configuration *terminal-configuration*
Options: 'scrollback' Options: 'modified', 'scrollback'
Events: |TermOpen|, |TermClose| Events: |TermOpen|, |TermClose|
Highlight groups: |hl-TermCursor|, |hl-TermCursorNC| Highlight groups: |hl-TermCursor|, |hl-TermCursorNC|
@@ -99,17 +101,15 @@ global configuration.
You can change the defaults with a TermOpen autocommand: > You can change the defaults with a TermOpen autocommand: >
au TermOpen * setlocal list au TermOpen * setlocal list
Terminal colors can be customized with these variables: TERMINAL COLORS ~
- `{g,b}:terminal_color_$NUM`: The terminal color palette, where `$NUM` is the The `{g,b}:terminal_color_$NUM` variables control the terminal color palette,
color index, between 0 and 255 inclusive. This setting only affects UIs with where `$NUM` is the color index between 0 and 255 inclusive. This setting only
RGB capabilities; for normal terminals the color index is simply forwarded. affects UIs with RGB capabilities; for normal terminals the color index is
just forwarded. The variables are read only during |TermOpen|.
The `{g,b}:terminal_color_$NUM` variables are processed only when the terminal
starts (after |TermOpen|).
============================================================================== ==============================================================================
Status Variables *terminal-emulator-status* Status Variables *terminal-status*
Terminal buffers maintain some information about the terminal in buffer-local Terminal buffers maintain some information about the terminal in buffer-local
variables: variables:
@@ -117,8 +117,8 @@ variables:
- *b:term_title* The settable title of the terminal, typically displayed in - *b:term_title* The settable title of the terminal, typically displayed in
the window title or tab title of a graphical terminal emulator. Programs the window title or tab title of a graphical terminal emulator. Programs
running in the terminal can set this title via an escape sequence. running in the terminal can set this title via an escape sequence.
- *b:terminal_job_id* The nvim job ID of the job running in the terminal. See - |'channel'| The nvim channel ID for the underlying PTY.
|job-control| for more information. |chansend()| can be used to send input to the terminal.
- *b:terminal_job_pid* The PID of the top-level process running in the - *b:terminal_job_pid* The PID of the top-level process running in the
terminal. terminal.

View File

@@ -14,7 +14,7 @@ achieve special effects. These options come in three forms:
number has a numeric value number has a numeric value
string has a string value string has a string value
Type <M-]> to see the table of contents. Type |gO| to see the table of contents.
============================================================================== ==============================================================================
1. Setting options *set-option* *E764* 1. Setting options *set-option* *E764*
@@ -22,12 +22,7 @@ achieve special effects. These options come in three forms:
*:se* *:set* *:se* *:set*
:se[t] Show all options that differ from their default value. :se[t] Show all options that differ from their default value.
:se[t] all Show all but terminal options. :se[t] all Show all options.
:se[t] termcap Show all terminal options. Note that in the GUI the
key codes are not shown, because they are generated
internally and can't be changed. Changing the terminal
codes in the GUI is not useful either...
*E518* *E519* *E518* *E519*
:se[t] {option}? Show value of {option}. :se[t] {option}? Show value of {option}.
@@ -192,7 +187,7 @@ opt+=val" the expansion is done before the adding or removing.
Handling of local options *local-options* Handling of local options *local-options*
Some of the options only apply to a window or buffer. Each window or buffer Some of the options only apply to a window or buffer. Each window or buffer
has its own copy of this option, thus can each have their own value. This has its own copy of this option, thus each can have its own value. This
allows you to set 'list' in one window but not in another. And set allows you to set 'list' in one window but not in another. And set
'shiftwidth' to 3 in one buffer and 4 in another. 'shiftwidth' to 3 in one buffer and 4 in another.
@@ -316,7 +311,7 @@ Note: In the future more global options can be made global-local. Using
Setting the filetype Setting the filetype
:setf[iletype] {filetype} *:setf* *:setfiletype* :setf[iletype] [FALLBACK] {filetype} *:setf* *:setfiletype*
Set the 'filetype' option to {filetype}, but only if Set the 'filetype' option to {filetype}, but only if
not done yet in a sequence of (nested) autocommands. not done yet in a sequence of (nested) autocommands.
This is short for: > This is short for: >
@@ -327,6 +322,12 @@ Setting the filetype
setting the 'filetype' option twice, causing different setting the 'filetype' option twice, causing different
settings and syntax files to be loaded. settings and syntax files to be loaded.
When the optional FALLBACK argument is present, a
later :setfiletype command will override the
'filetype'. This is to used for filetype detections
that are just a guess. |did_filetype()| will return
false after this command.
*option-window* *optwin* *option-window* *optwin*
:bro[wse] se[t] *:set-browse* *:browse-set* *:opt* *:options* :bro[wse] se[t] *:set-browse* *:browse-set* *:opt* *:options*
:opt[ions] Open a window for viewing and setting all options. :opt[ions] Open a window for viewing and setting all options.
@@ -353,12 +354,23 @@ On Unix systems the form "${HOME}" can be used too. The name between {} can
contain non-id characters then. Note that if you want to use this for the contain non-id characters then. Note that if you want to use this for the
"gf" command, you need to add the '{' and '}' characters to 'isfname'. "gf" command, you need to add the '{' and '}' characters to 'isfname'.
On MS-Windows, if $HOME is not defined as an environment variable, then
at runtime Vim will set it to the expansion of $HOMEDRIVE$HOMEPATH.
NOTE: expanding environment variables and "~/" is only done with the ":set" NOTE: expanding environment variables and "~/" is only done with the ":set"
command, not when assigning a value to an option with ":let". command, not when assigning a value to an option with ":let".
*$HOME-windows*
On MS-Windows, if $HOME is not defined as an environment variable, then
at runtime Vim will set it to the expansion of $HOMEDRIVE$HOMEPATH.
If $HOMEDRIVE is not set then $USERPROFILE is used.
This expanded value is not exported to the environment, this matters when
running an external command: >
:echo system('set | findstr ^HOME=')
and >
:echo luaeval('os.getenv("HOME")')
should echo nothing (an empty string) despite exists('$HOME') being true.
When setting $HOME to a non-empty string it will be exported to the
subprocesses.
Note the maximum length of an expanded option is limited. How much depends on Note the maximum length of an expanded option is limited. How much depends on
the system, mostly it is something like 256 or 1024 characters. the system, mostly it is something like 256 or 1024 characters.
@@ -716,6 +728,13 @@ A jump table for the options with a short description can be found at |Q_op|.
< Vim will guess the value. In the GUI this should work correctly, < Vim will guess the value. In the GUI this should work correctly,
in other cases Vim might not be able to guess the right value. in other cases Vim might not be able to guess the right value.
When the |t_RB| option is set, Vim will use it to request the background
color from the terminal. If the returned RGB value is dark/light and
'background' is not dark/light, 'background' will be set and the
screen is redrawn. This may have side effects, make t_BG empty in
your .vimrc if you suspect this problem. The response to |t_RB| can
be found in |v:termrbgresp|.
When starting the GUI, the default value for 'background' will be When starting the GUI, the default value for 'background' will be
"light". When the value is not set in the gvimrc, and Vim detects "light". When the value is not set in the gvimrc, and Vim detects
that the background is actually quite dark, 'background' is set to that the background is actually quite dark, 'background' is set to
@@ -964,8 +983,8 @@ A jump table for the options with a short description can be found at |Q_op|.
wildmode More matches in |cmdline-completion| available wildmode More matches in |cmdline-completion| available
(depends on the 'wildmode' setting). (depends on the 'wildmode' setting).
This is most useful, to fine tune when in insert mode the bell should This is most useful to fine tune when in Insert mode the bell should
be rung. For normal mode and ex commands, the bell is often rung to be rung. For Normal mode and Ex commands, the bell is often rung to
indicate that an error occurred. It can be silenced by adding the indicate that an error occurred. It can be silenced by adding the
"error" keyword. "error" keyword.
@@ -1194,6 +1213,12 @@ A jump table for the options with a short description can be found at |Q_op|.
< |Nvi| also has this option, but it only uses the first character. < |Nvi| also has this option, but it only uses the first character.
See |cmdwin|. See |cmdwin|.
*'channel'*
'channel' number (default: 0)
local to buffer
|Channel| connected to the buffer. Currently only used by
|terminal-emulator|. Is 0 if no terminal is open. Cannot be changed.
*'charconvert'* *'ccv'* *E202* *E214* *E513* *'charconvert'* *'ccv'* *E202* *E214* *E513*
'charconvert' 'ccv' string (default "") 'charconvert' 'ccv' string (default "")
global global
@@ -1300,27 +1325,6 @@ A jump table for the options with a short description can be found at |Q_op|.
will additionally copy the text into register will additionally copy the text into register
'*'. See |clipboard|. '*'. See |clipboard|.
*clipboard-autoselect*
autoselect Works like the 'a' flag in 'guioptions': If present,
then whenever Visual mode is started, or the Visual
area extended, Vim tries to become the owner of the
windowing system's global selection or put the
selected text on the clipboard used by the selection
register "*. See |guioptions_a| and |quotestar| for
details. When the GUI is active, the 'a' flag in
'guioptions' is used, when the GUI is not active, this
"autoselect" flag is used.
Also applies to the modeless selection.
*clipboard-autoselectplus*
autoselectplus Like "autoselect" but using the + register instead of
the * register. Compare to the 'P' flag in
'guioptions'.
*clipboard-autoselectml*
autoselectml Like "autoselect", but for the modeless selection
only. Compare to the 'A' flag in 'guioptions'.
*'cmdheight'* *'ch'* *'cmdheight'* *'ch'*
'cmdheight' 'ch' number (default 1) 'cmdheight' 'ch' number (default 1)
global global
@@ -1571,7 +1575,6 @@ A jump table for the options with a short description can be found at |Q_op|.
results in X being mapped to: results in X being mapped to:
'B' included: "\^[" (^[ is a real <Esc>) 'B' included: "\^[" (^[ is a real <Esc>)
'B' excluded: "<Esc>" (5 characters) 'B' excluded: "<Esc>" (5 characters)
('<' excluded in both cases)
*cpo-c* *cpo-c*
c Searching continues at the end of any match at the c Searching continues at the end of any match at the
cursor position, but not further than the start of the cursor position, but not further than the start of the
@@ -1621,15 +1624,6 @@ A jump table for the options with a short description can be found at |Q_op|.
J A |sentence| has to be followed by two spaces after J A |sentence| has to be followed by two spaces after
the '.', '!' or '?'. A <Tab> is not recognized as the '.', '!' or '?'. A <Tab> is not recognized as
white space. white space.
*cpo-k*
k Disable the recognition of raw key codes in
mappings, abbreviations, and the "to" part of menu
commands. For example, if <Key> sends ^[OA (where ^[
is <Esc>), the command ":map X ^[OA" results in X
being mapped to:
'k' included: "^[OA" (3 characters)
'k' excluded: "<Key>" (one key code)
Also see the '<' flag below.
*cpo-K* *cpo-K*
K Don't wait for a key code to complete when it is K Don't wait for a key code to complete when it is
halfway through a mapping. This breaks mapping halfway through a mapping. This breaks mapping
@@ -1763,14 +1757,6 @@ A jump table for the options with a short description can be found at |Q_op|.
+ When included, a ":write file" command will reset the + When included, a ":write file" command will reset the
'modified' flag of the buffer, even though the buffer 'modified' flag of the buffer, even though the buffer
itself may still be different from its file. itself may still be different from its file.
*cpo-<*
< Disable the recognition of special key codes in |<>|
form in mappings, abbreviations, and the "to" part of
menu commands. For example, the command
":map X <Tab>" results in X being mapped to:
'<' included: "<Tab>" (5 characters)
'<' excluded: "^I" (^I is a real <Tab>)
Also see the 'k' flag above.
*cpo->* *cpo->*
> When appending to a register, put a line break before > When appending to a register, put a line break before
the appended text. the appended text.
@@ -1821,12 +1807,6 @@ A jump table for the options with a short description can be found at |Q_op|.
Determines the order in which ":cstag" performs a search. See Determines the order in which ":cstag" performs a search. See
|cscopetagorder|. |cscopetagorder|.
*'cscopeverbose'* *'csverb'*
*'nocscopeverbose'* *'nocsverb'*
'cscopeverbose' 'csverb' boolean (default off)
global
Give messages when adding a cscope database. See |cscopeverbose|.
*'cursorbind'* *'crb'* *'nocursorbind'* *'nocrb'* *'cursorbind'* *'crb'* *'nocursorbind'* *'nocrb'*
'cursorbind' 'crb' boolean (default off) 'cursorbind' 'crb' boolean (default off)
local to window local to window
@@ -2397,7 +2377,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Only normal file name characters can be used, "/\*?[|<>" are illegal. Only normal file name characters can be used, "/\*?[|<>" are illegal.
*'fillchars'* *'fcs'* *'fillchars'* *'fcs'*
'fillchars' 'fcs' string (default "vert:|,fold:-") 'fillchars' 'fcs' string (default "")
global global
{not available when compiled without the |+windows| {not available when compiled without the |+windows|
and |+folding| features} and |+folding| features}
@@ -2407,16 +2387,19 @@ A jump table for the options with a short description can be found at |Q_op|.
item default Used for ~ item default Used for ~
stl:c ' ' or '^' statusline of the current window stl:c ' ' or '^' statusline of the current window
stlnc:c ' ' or '=' statusline of the non-current windows stlnc:c ' ' or '=' statusline of the non-current windows
vert:c '|' vertical separators |:vsplit| vert:c '│' or '|' vertical separators |:vsplit|
fold:c '-' filling 'foldtext' fold:c '·' or '-' filling 'foldtext'
diff:c '-' deleted lines of the 'diff' option diff:c '-' deleted lines of the 'diff' option
Any one that is omitted will fall back to the default. For "stl" and Any one that is omitted will fall back to the default. For "stl" and
"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
single-byte alternatives.
Example: > Example: >
:set fillchars=stl:^,stlnc:=,vert:\|,fold:-,diff:- :set fillchars=stl:^,stlnc:=,vert:,fold:·,diff:-
< This is similar to the default, except that these characters will also < This is similar to the default, except that these characters will also
be used when there is highlighting. be used when there is highlighting.
@@ -2726,6 +2709,10 @@ A jump table for the options with a short description can be found at |Q_op|.
:s///g subst. one subst. all :s///g subst. one subst. all
:s///gg subst. all subst. one :s///gg subst. all subst. one
DEPRECATED: Setting this option may break plugins that are not aware
of this option. Also, many users get confused that adding the /g flag
has the opposite effect of that it normally does.
*'grepformat'* *'gfm'* *'grepformat'* *'gfm'*
'grepformat' 'gfm' string (default "%f:%l:%m,%f:%l%m,%f %l%m") 'grepformat' 'gfm' string (default "%f:%l:%m,%f:%l%m,%f %l%m")
global global
@@ -2756,14 +2743,10 @@ A jump table for the options with a short description can be found at |Q_op|.
*'guicursor'* *'gcr'* *E545* *E546* *E548* *E549* *'guicursor'* *'gcr'* *E545* *E546* *E548* *E549*
'guicursor' 'gcr' string (default "n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20") 'guicursor' 'gcr' string (default "n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20")
global global
Configures the cursor style for each mode. Works in the GUI and some Configures the cursor style for each mode. Works in the GUI and many
terminals. terminals. See |tui-cursor-shape|.
With tmux you might need this in ~/.tmux.conf (see terminal-overrides To disable cursor-styling, reset the option: >
in the tmux(1) manual page): >
set -ga terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q'
< To disable cursor-styling, reset the option: >
:set guicursor= :set guicursor=
< To enable mode shapes, "Cursor" highlight, and blinking: > < To enable mode shapes, "Cursor" highlight, and blinking: >
@@ -2994,7 +2977,7 @@ A jump table for the options with a short description can be found at |Q_op|.
that this flag must be added in the vimrc file, before that this flag must be added in the vimrc file, before
switching on syntax or filetype recognition (when the |gvimrc| switching on syntax or filetype recognition (when the |gvimrc|
file is sourced the system menu has already been loaded; the file is sourced the system menu has already been loaded; the
":syntax on" and ":filetype on" commands load the menu too). `:syntax on` and `:filetype on` commands load the menu too).
*'go-g'* *'go-g'*
'g' Grey menu items: Make menu items that are not active grey. If 'g' Grey menu items: Make menu items that are not active grey. If
'g' is not included inactive menu items are not shown at all. 'g' is not included inactive menu items are not shown at all.
@@ -3044,6 +3027,8 @@ A jump table for the options with a short description can be found at |Q_op|.
The format of this option is like that of 'statusline'. The format of this option is like that of 'statusline'.
'guitabtooltip' is used for the tooltip, see below. 'guitabtooltip' is used for the tooltip, see below.
The expression will be evaluated in the |sandbox| when set from a
modeline, see |sandbox-option|.
Only used when the GUI tab pages line is displayed. 'e' must be Only used when the GUI tab pages line is displayed. 'e' must be
present in 'guioptions'. For the non-GUI tab pages line 'tabline' is present in 'guioptions'. For the non-GUI tab pages line 'tabline' is
@@ -3119,34 +3104,6 @@ A jump table for the options with a short description can be found at |Q_op|.
WARNING: It's easy to forget that you have changes in hidden buffers. WARNING: It's easy to forget that you have changes in hidden buffers.
Think twice when using ":q!" or ":qa!". Think twice when using ":q!" or ":qa!".
*'highlight'* *'hl'*
'highlight' 'hl' Removed. |vim-differences|
global
The builtin |highlight-groups| cannot be changed.
*'hlsearch'* *'hls'* *'nohlsearch'* *'nohls'*
'hlsearch' 'hls' boolean (default on)
global
{not available when compiled without the
|+extra_search| feature}
When there is a previous search pattern, highlight all its matches.
The type of highlighting used can be set with the 'l' occasion in the
'highlight' option. This uses the "Search" highlight group by
default. Note that only the matching text is highlighted, any offsets
are not applied.
See also: 'incsearch' and |:match|.
When you get bored looking at the highlighted matches, you can turn it
off with |:nohlsearch|. This does not change the option value, as
soon as you use a search command, the highlighting comes back.
'redrawtime' specifies the maximum time spent on finding matches.
When the search pattern can match an end-of-line, Vim will try to
highlight all of the matched text. However, this depends on where the
search starts. This will be the first line in the window or the first
line below a closed fold. A match in a previous line which is not
drawn may not continue in a newly drawn line.
You can specify whether the highlight status is restored on startup
with the 'h' flag in 'shada' |shada-h|.
*'history'* *'hi'* *'history'* *'hi'*
'history' 'hi' number (Vim default: 10000, Vi default: 0) 'history' 'hi' number (Vim default: 10000, Vi default: 0)
global global
@@ -3169,6 +3126,27 @@ A jump table for the options with a short description can be found at |Q_op|.
This is useful if you have a non-Hebrew keyboard. This is useful if you have a non-Hebrew keyboard.
See |rileft.txt|. See |rileft.txt|.
*'hlsearch'* *'hls'* *'nohlsearch'* *'nohls'*
'hlsearch' 'hls' boolean (default on)
global
{not available when compiled without the
|+extra_search| feature}
When there is a previous search pattern, highlight all its matches.
The |hl-Search| highlight group determines the highlighting. Note that
only the matching text is highlighted, any offsets are not applied.
See also: 'incsearch' and |:match|.
When you get bored looking at the highlighted matches, you can turn it
off with |:nohlsearch|. This does not change the option value, as
soon as you use a search command, the highlighting comes back.
'redrawtime' specifies the maximum time spent on finding matches.
When the search pattern can match an end-of-line, Vim will try to
highlight all of the matched text. However, this depends on where the
search starts. This will be the first line in the window or the first
line below a closed fold. A match in a previous line which is not
drawn may not continue in a newly drawn line.
You can specify whether the highlight status is restored on startup
with the 'h' flag in 'shada' |shada-h|.
*'icon'* *'noicon'* *'icon'* *'noicon'*
'icon' boolean (default off, on when title can be restored) 'icon' boolean (default off, on when title can be restored)
global global
@@ -3323,8 +3301,18 @@ A jump table for the options with a short description can be found at |Q_op|.
Vim only searches for about half a second. With a complicated Vim only searches for about half a second. With a complicated
pattern and/or a lot of text the match may not be found. This is to pattern and/or a lot of text the match may not be found. This is to
avoid that Vim hangs while you are typing the pattern. avoid that Vim hangs while you are typing the pattern.
The highlighting can be set with the 'i' flag in 'highlight'. The |hl-IncSearch| highlight group determines the highlighting.
See also: 'hlsearch'. When 'hlsearch' is on, all matched strings are highlighted too while typing
a search command. See also: 'hlsearch'.
If you don't want turn 'hlsearch' on, but want to highlight all matches
while searching, you can turn on and off 'hlsearch' with autocmd.
Example: >
augroup vimrc-incsearch-highlight
autocmd!
autocmd CmdlineEnter /,\? :set hlsearch
autocmd CmdlineLeave /,\? :set nohlsearch
augroup END
<
CTRL-L can be used to add one character from after the current match CTRL-L can be used to add one character from after the current match
to the command line. If 'ignorecase' and 'smartcase' are set and the to the command line. If 'ignorecase' and 'smartcase' are set and the
command line has no uppercase characters, the added character is command line has no uppercase characters, the added character is
@@ -3695,7 +3683,7 @@ A jump table for the options with a short description can be found at |Q_op|.
< Minimum value is 2, maximum value is 1000. < Minimum value is 2, maximum value is 1000.
*'linespace'* *'lsp'* *'linespace'* *'lsp'*
'linespace' 'lsp' number (default 0, 1 for Win32 GUI) 'linespace' 'lsp' number (default 0)
global global
{only in the GUI} {only in the GUI}
Number of pixel lines inserted between characters. Useful if the font Number of pixel lines inserted between characters. Useful if the font
@@ -3832,6 +3820,23 @@ A jump table for the options with a short description can be found at |Q_op|.
This option cannot be set from a |modeline| or in the |sandbox|, for This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons. security reasons.
*'makeencoding'* *'menc'*
'makeencoding' 'menc' string (default "")
global or local to buffer |global-local|
{only available when compiled with the |+multi_byte|
feature}
{not in Vi}
Encoding used for reading the output of external commands. When empty,
encoding is not converted.
This is used for `:make`, `:lmake`, `:grep`, `:lgrep`, `:grepadd`,
`:lgrepadd`, `:cfile`, `:cgetfile`, `:caddfile`, `:lfile`, `:lgetfile`,
and `:laddfile`.
This would be mostly useful when you use MS-Windows. If |+iconv| is
enabled and GNU libiconv is used, setting 'makeencoding' to "char" has
the same effect as setting to the system locale encoding. Example: >
:set makeencoding=char " system locale is used
<
*'makeprg'* *'mp'* *'makeprg'* *'mp'*
'makeprg' 'mp' string (default "make") 'makeprg' 'mp' string (default "make")
global or local to buffer |global-local| global or local to buffer |global-local|
@@ -3868,7 +3873,7 @@ A jump table for the options with a short description can be found at |Q_op|.
:au FileType c,cpp,java set mps+==:; :au FileType c,cpp,java set mps+==:;
< For a more advanced way of using "%", see the matchit.vim plugin in < For a more advanced way of using "%", see the matchit.vim plugin in
the $VIMRUNTIME/macros directory. |add-local-help| the $VIMRUNTIME/plugin directory. |add-local-help|
*'matchtime'* *'mat'* *'matchtime'* *'mat'*
'matchtime' 'mat' number (default 5) 'matchtime' 'mat' number (default 5)
@@ -4509,6 +4514,8 @@ A jump table for the options with a short description can be found at |Q_op|.
and |+postscript| features} and |+postscript| features}
Expression used to print the PostScript produced with |:hardcopy|. Expression used to print the PostScript produced with |:hardcopy|.
See |pexpr-option|. See |pexpr-option|.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
*'printfont'* *'pfn'* *'printfont'* *'pfn'*
'printfont' 'pfn' string (default "courier") 'printfont' 'pfn' string (default "courier")
@@ -4816,12 +4823,12 @@ A jump table for the options with a short description can be found at |Q_op|.
height with ":set scroll=0". height with ":set scroll=0".
*'scrollback'* *'scbk'* *'scrollback'* *'scbk'*
'scrollback' 'scbk' number (default: 1000 'scrollback' 'scbk' number (default: 10000
in normal buffers: -1) in normal buffers: -1)
local to buffer local to buffer
Maximum number of lines kept beyond the visible screen. Lines at the Maximum number of lines kept beyond the visible screen. Lines at the
top are deleted if new lines exceed this limit. top are deleted if new lines exceed this limit.
Only in |terminal-emulator| buffers. 'buftype' Only in |terminal| buffers.
-1 means "unlimited" for normal buffers, 100000 otherwise. -1 means "unlimited" for normal buffers, 100000 otherwise.
Minimum is 1. Minimum is 1.
@@ -5153,10 +5160,10 @@ A jump table for the options with a short description can be found at |Q_op|.
security reasons. security reasons.
*'shellcmdflag'* *'shcf'* *'shellcmdflag'* *'shcf'*
'shellcmdflag' 'shcf' string (default: "-c"; Windows: "/c") 'shellcmdflag' 'shcf' string (default: "-c"; Windows: "/s /c")
global global
Flag passed to the shell to execute "!" and ":!" commands; e.g., Flag passed to the shell to execute "!" and ":!" commands; e.g.,
"bash.exe -c ls" or "cmd.exe /c dir". For Windows `bash.exe -c ls` or `cmd.exe /s /c "dir"`. For Windows
systems, the default is set according to the value of 'shell', to systems, the default is set according to the value of 'shell', to
reduce the need to set this option by the user. reduce the need to set this option by the user.
On Unix it can have more than one flag. Each white space separated On Unix it can have more than one flag. Each white space separated
@@ -5277,7 +5284,7 @@ A jump table for the options with a short description can be found at |Q_op|.
to execute most external commands with cmd.exe. to execute most external commands with cmd.exe.
*'shellxquote'* *'sxq'* *'shellxquote'* *'sxq'*
'shellxquote' 'sxq' string (default: "") 'shellxquote' 'sxq' string (default: "", Windows: "\"")
global global
Quoting character(s), put around the command passed to the shell, for Quoting character(s), put around the command passed to the shell, for
the "!" and ":!" commands. Includes the redirection. See the "!" and ":!" commands. Includes the redirection. See
@@ -5369,8 +5376,7 @@ A jump table for the options with a short description can be found at |Q_op|.
< Only printable single-cell characters are allowed, excluding <Tab> and < Only printable single-cell characters are allowed, excluding <Tab> and
comma (in a future version the comma might be used to separate the comma (in a future version the comma might be used to separate the
part that is shown at the end and at the start of a line). part that is shown at the end and at the start of a line).
The characters are highlighted according to the '@' flag in The |hl-NonText| highlight group determines the highlighting.
'highlight'.
Note that tabs after the showbreak will be displayed differently. Note that tabs after the showbreak will be displayed differently.
If you want the 'showbreak' to appear in between line numbers, add the If you want the 'showbreak' to appear in between line numbers, add the
"n" flag to 'cpoptions'. "n" flag to 'cpoptions'.
@@ -5425,10 +5431,7 @@ A jump table for the options with a short description can be found at |Q_op|.
'showmode' 'smd' boolean (Vim default: on, Vi default: off) 'showmode' 'smd' boolean (Vim default: on, Vi default: off)
global global
If in Insert, Replace or Visual mode put a message on the last line. If in Insert, Replace or Visual mode put a message on the last line.
Use the 'M' flag in 'highlight' to set the type of highlighting for The |hl-ModeMsg| highlight group determines the highlighting.
this message.
When |XIM| may be used the message will include "XIM". But this
doesn't mean XIM is really active.
*'showtabline'* *'stal'* *'showtabline'* *'stal'*
'showtabline' 'stal' number (default 1) 'showtabline' 'stal' number (default 1)
@@ -5445,14 +5448,13 @@ A jump table for the options with a short description can be found at |Q_op|.
See |tab-page| for more information about tab pages. See |tab-page| for more information about tab pages.
*'sidescroll'* *'ss'* *'sidescroll'* *'ss'*
'sidescroll' 'ss' number (default 0) 'sidescroll' 'ss' number (default 1)
global global
The minimal number of columns to scroll horizontally. Used only when The minimal number of columns to scroll horizontally. Used only when
the 'wrap' option is off and the cursor is moved off of the screen. the 'wrap' option is off and the cursor is moved off of the screen.
When it is zero the cursor will be put in the middle of the screen. When it is zero the cursor will be put in the middle of the screen.
When using a slow terminal set it to a large number or 0. When using When using a slow terminal set it to a large number or 0. Not used
a fast terminal use a small number or 1. Not used for "zh" and "zl" for "zh" and "zl" commands.
commands.
*'sidescrolloff'* *'siso'* *'sidescrolloff'* *'siso'*
'sidescrolloff' 'siso' number (default 0) 'sidescrolloff' 'siso' number (default 0)
@@ -5691,7 +5693,7 @@ A jump table for the options with a short description can be found at |Q_op|.
word. The expression must evaluate to a List of word. The expression must evaluate to a List of
Lists, each with a suggestion and a score. Lists, each with a suggestion and a score.
Example: Example:
[['the', 33], ['that', 44]] [['the', 33], ['that', 44]] ~
Set 'verbose' and use |z=| to see the scores that the Set 'verbose' and use |z=| to see the scores that the
internal methods use. A lower score is better. internal methods use. A lower score is better.
This may invoke |spellsuggest()| if you temporarily This may invoke |spellsuggest()| if you temporarily
@@ -6217,7 +6219,6 @@ A jump table for the options with a short description can be found at |Q_op|.
When on, uses |highlight-guifg| and |highlight-guibg| attributes in When on, uses |highlight-guifg| and |highlight-guibg| attributes in
the terminal (thus using 24-bit color). Requires a ISO-8613-3 the terminal (thus using 24-bit color). Requires a ISO-8613-3
compatible terminal. compatible terminal.
Must be set at startup (in your |init.vim| or |--cmd|).
*'terse'* *'noterse'* *'terse'* *'noterse'*
'terse' boolean (default off) 'terse' boolean (default off)
@@ -6272,7 +6273,7 @@ A jump table for the options with a short description can be found at |Q_op|.
for any key that can follow <c-f> in a mapping. for any key that can follow <c-f> in a mapping.
*'ttimeout'* *'nottimeout'* *'ttimeout'* *'nottimeout'*
'ttimeout' boolean (default off) 'ttimeout' boolean (default on)
global global
This option and 'ttimeoutlen' determine the behavior when part of a This option and 'ttimeoutlen' determine the behavior when part of a
key code sequence has been received by the terminal UI. For example, key code sequence has been received by the terminal UI. For example,
@@ -6287,18 +6288,18 @@ A jump table for the options with a short description can be found at |Q_op|.
complete. complete.
*'ttimeoutlen'* *'ttm'* *'ttimeoutlen'* *'ttm'*
'ttimeoutlen' 'ttm' number (default -1) 'ttimeoutlen' 'ttm' number (default 50)
global global
The time in milliseconds that is waited for a key code The time in milliseconds that is waited for a key code
sequence to complete. Also used for CTRL-\ CTRL-N and CTRL-\ CTRL-G sequence to complete. Also used for CTRL-\ CTRL-N and CTRL-\ CTRL-G
when part of a command has been typed. when part of a command has been typed.
*'title'* *'notitle'* *'title'* *'notitle'*
'title' boolean (default off, on when title can be restored) 'title' boolean (default off)
global global
When on, the title of the window will be set to the value of When on, the title of the window will be set to the value of
'titlestring' (if it is not empty), or to: 'titlestring' (if it is not empty), or to:
filename [+=-] (path) - VIM filename [+=-] (path) - NVIM
Where: Where:
filename the name of the file being edited filename the name of the file being edited
- indicates the file cannot be modified, 'ma' off - indicates the file cannot be modified, 'ma' off
@@ -6306,7 +6307,7 @@ A jump table for the options with a short description can be found at |Q_op|.
= indicates the file is read-only = indicates the file is read-only
=+ indicates the file is read-only and modified =+ indicates the file is read-only and modified
(path) is the path of the file being edited (path) is the path of the file being edited
- VIM the server name |v:servername| or "VIM" - NVIM the server name |v:servername| or "NVIM"
*'titlelen'* *'titlelen'*
'titlelen' number (default 85) 'titlelen' number (default 85)
@@ -6322,11 +6323,10 @@ A jump table for the options with a short description can be found at |Q_op|.
'titlelen' is also used for the 'titlestring' option. 'titlelen' is also used for the 'titlestring' option.
*'titleold'* *'titleold'*
'titleold' string (default "Thanks for flying Vim") 'titleold' string (default "")
global global
This option will be used for the window title when exiting Vim if the If not empty, this option will be used to set the window title when
original title cannot be restored. Only happens if 'title' is on or exiting. Only if 'title' is enabled.
'titlestring' is not empty.
This option cannot be set from a |modeline| or in the |sandbox|, for This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons. security reasons.
*'titlestring'* *'titlestring'*
@@ -6412,7 +6412,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Save the whole buffer for undo when reloading it. This applies to the Save the whole buffer for undo when reloading it. This applies to the
":e!" command and reloading for when the buffer changed outside of ":e!" command and reloading for when the buffer changed outside of
Vim. |FileChangedShell| Vim. |FileChangedShell|
The save only happens when this options is negative or when the number The save only happens when this option is negative or when the number
of lines is smaller than the value of this option. of lines is smaller than the value of this option.
Set this option to zero to disable undo for a reload. Set this option to zero to disable undo for a reload.
@@ -6450,6 +6450,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Currently, these messages are given: Currently, these messages are given:
>= 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
>= 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.
@@ -6485,7 +6486,7 @@ A jump table for the options with a short description can be found at |Q_op|.
security reasons. security reasons.
*'viewoptions'* *'vop'* *'viewoptions'* *'vop'*
'viewoptions' 'vop' string (default: "folds,options,cursor") 'viewoptions' 'vop' string (default: "folds,options,cursor,curdir")
global global
{not available when compiled without the |+mksession| {not available when compiled without the |+mksession|
feature} feature}
@@ -6493,6 +6494,7 @@ A jump table for the options with a short description can be found at |Q_op|.
list of words. Each word enables saving and restoring something: list of words. Each word enables saving and restoring something:
word save and restore ~ word save and restore ~
cursor cursor position in file and in window cursor cursor position in file and in window
curdir local current directory, if set with |:lcd|
folds manually created folds, opened/closed folds and local folds manually created folds, opened/closed folds and local
fold options fold options
options options and mappings local to a window or buffer (not options options and mappings local to a window or buffer (not
@@ -6775,19 +6777,19 @@ A jump table for the options with a short description can be found at |Q_op|.
*'winhighlight'* *'winhl'* *'winhighlight'* *'winhl'*
'winhighlight' 'winhl' string (default empty) 'winhighlight' 'winhl' string (default empty)
local to window local to window
Window-local highlights. Comma-delimited list of |group-name| pairs Window-local highlights. Comma-delimited list of highlight
"{hl-builtin}:{hl-group},..." where each {hl-builtin} is a group (from |group-name| pairs "{hl-builtin}:{hl},..." where each {hl-builtin} is
|highlight-groups|) to be overridden by {hl-group} in the window where a built-in |highlight-groups| item to be overridden by {hl} group in
this option was set. Only builting ui highlights are supported, not the window. Only built-in |highlight-groups| are supported, not
syntax highlighting. For that purpose, use |:ownsyntax|. syntax highlighting (use |:ownsyntax| for that).
Most highlights occuring within the frame of a window are supported.
Highlights of vertical separators are determined by the window to the Highlights of vertical separators are determined by the window to the
left of the separator. The highlight of a tabpage in |tabline| is left of the separator. The highlight of a tabpage in |tabline| is
determined by the last focused window in the tabpage. Highlights of determined by the last-focused window of the tabpage. Highlights of
the popupmenu are determined by the current window. Highlights in the the popupmenu are determined by the current window. Highlights in the
message area are not overridable. Example for overriding the message area cannot be overridden.
backgrond color: >
Example: show a different color for non-current windows: >
set winhighlight=Normal:MyNormal,NormalNC:MyNormalNC set winhighlight=Normal:MyNormal,NormalNC:MyNormalNC
< <
*'winfixheight'* *'wfh'* *'nowinfixheight'* *'nowfh'* *'winfixheight'* *'wfh'* *'nowinfixheight'* *'nowfh'*
@@ -6920,7 +6922,8 @@ A jump table for the options with a short description can be found at |Q_op|.
'writedelay' 'wd' number (default 0) 'writedelay' 'wd' number (default 0)
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 non-zero, characters are sent to the terminal one by screen. When positive, characters are sent to the UI one by one.
one. For debugging purposes. When negative, all redrawn characters cause a delay, even if the
character already was displayed by the UI. For debugging purposes.
vim:tw=78:ts=8:ft=help:noet:norl: vim:tw=78:ts=8:ft=help:noet:norl:

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