aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/backport.yml2
-rw-r--r--.github/workflows/release.yml5
-rw-r--r--CMakeLists.txt4
-rw-r--r--MAINTAIN.md3
-rw-r--r--ci/build.ps1292
-rw-r--r--cmake.deps/CMakeLists.txt4
-rw-r--r--cmake.deps/cmake/BuildTreesitterParsers.cmake2
-rw-r--r--runtime/compiler/hare.vim31
-rw-r--r--runtime/doc/api.txt127
-rw-r--r--runtime/doc/autocmd.txt6
-rw-r--r--runtime/doc/builtin.txt59
-rw-r--r--runtime/doc/cmdline.txt2
-rw-r--r--runtime/doc/develop.txt17
-rw-r--r--runtime/doc/diagnostic.txt2
-rw-r--r--runtime/doc/eval.txt19
-rw-r--r--runtime/doc/filetype.txt2
-rw-r--r--runtime/doc/ft_ada.txt32
-rw-r--r--runtime/doc/ft_rust.txt10
-rw-r--r--runtime/doc/ft_sql.txt4
-rw-r--r--runtime/doc/help.txt1
-rw-r--r--runtime/doc/helphelp.txt7
-rw-r--r--runtime/doc/index.txt23
-rw-r--r--runtime/doc/insert.txt9
-rw-r--r--runtime/doc/lsp.txt75
-rw-r--r--runtime/doc/lua.txt32
-rw-r--r--runtime/doc/luaref.txt433
-rw-r--r--runtime/doc/luvref.txt2
-rw-r--r--runtime/doc/map.txt16
-rw-r--r--runtime/doc/mbyte.txt5
-rw-r--r--runtime/doc/motion.txt14
-rw-r--r--runtime/doc/options.txt22
-rw-r--r--runtime/doc/pi_health.txt2
-rw-r--r--runtime/doc/pi_netrw.txt16
-rw-r--r--runtime/doc/print.txt2
-rw-r--r--runtime/doc/provider.txt2
-rw-r--r--runtime/doc/quickfix.txt10
-rw-r--r--runtime/doc/quickref.txt53
-rw-r--r--runtime/doc/repeat.txt5
-rw-r--r--runtime/doc/starting.txt2
-rw-r--r--runtime/doc/syntax.txt26
-rw-r--r--runtime/doc/tabpage.txt2
-rw-r--r--runtime/doc/treesitter.txt16
-rw-r--r--runtime/doc/ui.txt205
-rw-r--r--runtime/doc/userfunc.txt5
-rw-r--r--runtime/doc/usr_22.txt2
-rw-r--r--runtime/doc/usr_41.txt5
-rw-r--r--runtime/doc/usr_45.txt3
-rw-r--r--runtime/doc/vim_diff.txt33
-rw-r--r--runtime/doc/windows.txt13
-rw-r--r--runtime/filetype.lua8
-rw-r--r--runtime/filetype.vim22
-rw-r--r--runtime/ftplugin/chatito.vim15
-rw-r--r--runtime/ftplugin/elixir.vim6
-rw-r--r--runtime/ftplugin/gyp.vim14
-rw-r--r--runtime/ftplugin/hare.vim27
-rw-r--r--runtime/ftplugin/heex.vim16
-rw-r--r--runtime/indent/chatito.vim32
-rw-r--r--runtime/indent/gyp.vim7
-rw-r--r--runtime/indent/hare.vim138
-rw-r--r--runtime/indent/solidity.vim442
-rw-r--r--runtime/indent/vue.vim12
-rw-r--r--runtime/lua/vim/_editor.lua4
-rw-r--r--runtime/lua/vim/filetype.lua9
-rw-r--r--runtime/lua/vim/highlight.lua2
-rw-r--r--runtime/lua/vim/lsp.lua22
-rw-r--r--runtime/lua/vim/lsp/buf.lua14
-rw-r--r--runtime/lua/vim/lsp/handlers.lua2
-rw-r--r--runtime/lua/vim/lsp/rpc.lua2
-rw-r--r--runtime/lua/vim/lsp/util.lua12
-rw-r--r--runtime/lua/vim/shared.lua2
-rw-r--r--runtime/lua/vim/treesitter/query.lua11
-rw-r--r--runtime/queries/help/highlights.scm18
-rw-r--r--runtime/syntax/chatito.vim62
-rw-r--r--runtime/syntax/desktop.vim6
-rw-r--r--runtime/syntax/gyp.vim49
-rw-r--r--runtime/syntax/hare.vim133
-rw-r--r--runtime/syntax/help.vim3
-rw-r--r--runtime/syntax/hlsplaylist.vim120
-rw-r--r--runtime/syntax/plsql.vim68
-rw-r--r--runtime/syntax/solidity.vim173
-rw-r--r--runtime/syntax/vim.vim2
-rw-r--r--scripts/gen_help_html.lua487
-rwxr-xr-xsrc/clint.py2
-rwxr-xr-xsrc/nvim/CMakeLists.txt2
-rw-r--r--src/nvim/api/autocmd.c8
-rw-r--r--src/nvim/api/command.c117
-rw-r--r--src/nvim/api/extmark.c8
-rw-r--r--src/nvim/api/options.c4
-rw-r--r--src/nvim/api/private/helpers.c18
-rw-r--r--src/nvim/api/ui.c4
-rw-r--r--src/nvim/api/vim.c14
-rw-r--r--src/nvim/api/win_config.c2
-rw-r--r--src/nvim/api/window.c4
-rw-r--r--src/nvim/buffer_defs.h2
-rw-r--r--src/nvim/change.c2
-rw-r--r--src/nvim/charset.c2
-rw-r--r--src/nvim/debugger.c2
-rw-r--r--src/nvim/drawscreen.c3
-rw-r--r--src/nvim/eval.c5
-rw-r--r--src/nvim/eval/funcs.c11
-rw-r--r--src/nvim/eval/typval.c4
-rw-r--r--src/nvim/eval/vars.c8
-rw-r--r--src/nvim/ex_docmd.c61
-rw-r--r--src/nvim/ex_getln.c15
-rw-r--r--src/nvim/getchar.c2
-rw-r--r--src/nvim/hashtab.c2
-rw-r--r--src/nvim/highlight_group.c2
-rw-r--r--src/nvim/if_cscope.c2
-rw-r--r--src/nvim/input.c5
-rw-r--r--src/nvim/keycodes.c9
-rw-r--r--src/nvim/lua/executor.c3
-rw-r--r--src/nvim/lua/stdlib.c19
-rw-r--r--src/nvim/lua/treesitter.c2
-rw-r--r--src/nvim/mapping.c2
-rw-r--r--src/nvim/mapping.h2
-rw-r--r--src/nvim/message.c15
-rw-r--r--src/nvim/option.c101
-rw-r--r--src/nvim/option_defs.h37
-rw-r--r--src/nvim/optionstr.c76
-rw-r--r--src/nvim/os/shell.c2
-rw-r--r--src/nvim/path.c2
-rw-r--r--src/nvim/sign.c55
-rw-r--r--src/nvim/spell.c12
-rw-r--r--src/nvim/terminal.c22
-rw-r--r--src/nvim/testdir/test_filetype.vim6
-rw-r--r--src/nvim/testdir/test_messages.vim67
-rw-r--r--src/nvim/textobject.c2
-rw-r--r--src/nvim/tui/input.c4
-rw-r--r--src/nvim/tui/input.h2
-rw-r--r--src/nvim/tui/tui.c8
-rw-r--r--src/nvim/undo.c8
-rw-r--r--src/nvim/window.c4
-rw-r--r--test/functional/api/command_spec.lua37
-rw-r--r--test/functional/api/extmark_spec.lua22
-rw-r--r--test/functional/api/keymap_spec.lua2
-rw-r--r--test/functional/api/vim_spec.lua102
-rw-r--r--test/functional/core/startup_spec.lua4
-rw-r--r--test/functional/ex_cmds/dict_notifications_spec.lua63
-rw-r--r--test/functional/ex_cmds/quit_spec.lua2
-rw-r--r--test/functional/helpers.lua13
-rw-r--r--test/functional/legacy/030_fileformats_spec.lua2
-rw-r--r--test/functional/legacy/055_list_and_dict_types_spec.lua2
-rw-r--r--test/functional/legacy/072_undo_file_spec.lua2
-rw-r--r--test/functional/legacy/083_tag_search_with_file_encoding_spec.lua2
-rw-r--r--test/functional/legacy/autocmd_option_spec.lua6
-rw-r--r--test/functional/legacy/messages_spec.lua152
-rw-r--r--test/functional/lua/api_spec.lua2
-rw-r--r--test/functional/lua/buffer_updates_spec.lua20
-rw-r--r--test/functional/lua/filetype_spec.lua8
-rw-r--r--test/functional/lua/help_spec.lua31
-rw-r--r--test/functional/lua/uri_spec.lua14
-rw-r--r--test/functional/lua/vim_spec.lua24
-rw-r--r--test/functional/options/defaults_spec.lua58
-rw-r--r--test/functional/options/keymap_spec.lua2
-rw-r--r--test/functional/provider/clipboard_spec.lua12
-rw-r--r--test/functional/terminal/helpers.lua4
-rw-r--r--test/functional/terminal/highlight_spec.lua10
-rw-r--r--test/functional/ui/bufhl_spec.lua2
-rw-r--r--test/functional/ui/cmdline_spec.lua240
-rw-r--r--test/functional/ui/decorations_spec.lua104
-rw-r--r--test/functional/ui/float_spec.lua4
-rw-r--r--test/functional/ui/inccommand_spec.lua37
-rw-r--r--test/functional/ui/inccommand_user_spec.lua2
-rw-r--r--test/functional/ui/options_spec.lua2
-rw-r--r--test/functional/ui/screen.lua7
-rw-r--r--test/functional/ui/sign_spec.lua85
-rw-r--r--test/functional/ui/spell_spec.lua94
-rw-r--r--test/functional/vimscript/container_functions_spec.lua2
-rw-r--r--test/functional/vimscript/json_functions_spec.lua2
-rw-r--r--test/functional/vimscript/map_functions_spec.lua9
170 files changed, 4025 insertions, 1536 deletions
diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml
index b5fd22d036..910df32a51 100644
--- a/.github/workflows/backport.yml
+++ b/.github/workflows/backport.yml
@@ -21,7 +21,7 @@ jobs:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Create backport PRs
- uses: zeebe-io/backport-action@v0.0.7
+ uses: zeebe-io/backport-action@v0.0.8
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_workspace: ${{ github.workspace }}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 5e0ea5e5f4..5fc40a2471 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -113,6 +113,11 @@ jobs:
DEPS_CMAKE_FLAGS="$OSX_FLAGS"
make DESTDIR="$GITHUB_WORKSPACE/build/release/nvim-macos" install
cd "$GITHUB_WORKSPACE/build/"
+ # Make sure we build everything for M1 as well
+ for macho in bin/* lib/nvim/parser/*.so
+ do
+ lipo -info "$macho" | grep -q arm64 || exit 1
+ done
cpack -C "$NVIM_BUILD_TYPE"
- uses: actions/upload-artifact@v3
with:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 81a0a2f667..76526d6ccb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -498,11 +498,11 @@ if(FEAT_TUI)
add_definitions(-DNVIM_UNIBI_HAS_VAR_FROM)
endif()
- find_package(LibTermkey 0.18 REQUIRED)
+ find_package(LibTermkey 0.22 REQUIRED)
include_directories(SYSTEM ${LIBTERMKEY_INCLUDE_DIRS})
endif()
-find_package(LIBVTERM 0.1 REQUIRED)
+find_package(LIBVTERM 0.3 REQUIRED)
include_directories(SYSTEM ${LIBVTERM_INCLUDE_DIRS})
option(CLANG_ASAN_UBSAN "Enable Clang address & undefined behavior sanitizer for nvim binary." OFF)
diff --git a/MAINTAIN.md b/MAINTAIN.md
index 9a8531fbd9..36ba07593d 100644
--- a/MAINTAIN.md
+++ b/MAINTAIN.md
@@ -57,8 +57,7 @@ has a major bug:
The neovim repository includes a backport [github action](https://github.com/zeebe-io/backport-action).
In order to trigger the action, a PR must be labeled with a label matching the
-form `backport release-0.X`. Note, the PR must have a description in the issue body,
-or the backport will fail.
+form `backport release-0.X`.
Third-party dependencies
--------------
diff --git a/ci/build.ps1 b/ci/build.ps1
index 6709a9507a..f6ad744fa1 100644
--- a/ci/build.ps1
+++ b/ci/build.ps1
@@ -1,146 +1,146 @@
-[CmdletBinding(DefaultParameterSetName = "Build")]
-param(
- [Parameter(ParameterSetName="Build")][switch]$Build,
- [Parameter(ParameterSetName="BuildDeps")][switch]$BuildDeps,
- [Parameter(ParameterSetName="EnsureTestDeps")][switch]$EnsureTestDeps,
- [Parameter(ParameterSetName="Package")][switch]$Package,
- [Parameter(ParameterSetName="Test")][switch]$Test,
- [Parameter(ParameterSetName="TestOld")][switch]$TestOld
-)
-
-Set-StrictMode -Version Latest
-$ErrorActionPreference = 'Stop'
-$ProgressPreference = 'SilentlyContinue'
-
-$projectDir = [System.IO.Path]::GetFullPath("$(Get-Location)")
-$buildDir = Join-Path -Path $projectDir -ChildPath "build"
-
-# $env:CMAKE_BUILD_TYPE is ignored by cmake when not using ninja
-$cmakeBuildType = $(if ($null -ne $env:CMAKE_BUILD_TYPE) {$env:CMAKE_BUILD_TYPE} else {'RelWithDebInfo'});
-$depsCmakeVars = @{
- CMAKE_BUILD_TYPE=$cmakeBuildType;
-}
-$nvimCmakeVars = @{
- CMAKE_BUILD_TYPE=$cmakeBuildType;
- BUSTED_OUTPUT_TYPE = 'nvim';
- DEPS_PREFIX=$(if ($null -ne $env:DEPS_PREFIX) {$env:DEPS_PREFIX} else {".deps/usr"});
-}
-if ($null -eq $env:DEPS_BUILD_DIR) {
- $env:DEPS_BUILD_DIR = Join-Path -Path $projectDir -ChildPath ".deps"
-}
-$uploadToCodeCov = $false
-
-function exitIfFailed() {
- if ($LastExitCode -ne 0) {
- exit $LastExitCode
- }
-}
-
-function convertToCmakeArgs($vars) {
- return $vars.GetEnumerator() | ForEach-Object { "-D$($_.Key)=$($_.Value)" }
-}
-
-$installationPath = vswhere.exe -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
-if ($installationPath -and (Test-Path "$installationPath\Common7\Tools\vsdevcmd.bat")) {
- & "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -arch=x64 -no_logo && set" | ForEach-Object {
- $name, $value = $_ -split '=', 2
- Set-Content env:\"$name" $value
- }
-}
-
-function BuildDeps {
-
- if (Test-Path -PathType container $env:DEPS_BUILD_DIR) {
- $cachedBuildTypeStr = $(Get-Content $env:DEPS_BUILD_DIR\CMakeCache.txt | Select-String -Pattern "CMAKE_BUILD_TYPE.*=($cmakeBuildType)")
- if (-not $cachedBuildTypeStr) {
- Write-Warning " unable to validate build type from cache dir ${env:DEPS_BUILD_DIR}"
- }
- }
-
- # we currently can't use ninja for cmake.deps, see #19405
- $depsCmakeGenerator = "Visual Studio 16 2019"
- $depsCmakeGeneratorPlf = "x64"
- cmake -S "$projectDir\cmake.deps" -B $env:DEPS_BUILD_DIR -G $depsCmakeGenerator -A $depsCmakeGeneratorPlf $(convertToCmakeArgs($depsCmakeVars)); exitIfFailed
-
- $depsCmakeNativeToolOptions= @('/verbosity:normal', '/m')
- cmake --build $env:DEPS_BUILD_DIR --config $cmakeBuildType -- $depsCmakeNativeToolOptions; exitIfFailed
-}
-
-function Build {
- cmake -S $projectDir -B $buildDir $(convertToCmakeArgs($nvimCmakeVars)) -G Ninja; exitIfFailed
- cmake --build $buildDir --config $cmakeBuildType; exitIfFailed
-}
-
-function EnsureTestDeps {
- & $buildDir\bin\nvim.exe "--version"; exitIfFailed
-
- # Ensure that the "win32" feature is set.
- & $buildDir\bin\nvim -u NONE --headless -c 'exe !has(\"win32\").\"cq\"' ; exitIfFailed
-
- python -m pip install pynvim
- # Sanity check
- python -c "import pynvim; print(str(pynvim))"; exitIfFailed
-
- gem.cmd install --pre neovim
- Get-Command -CommandType Application neovim-ruby-host.bat; exitIfFailed
-
- node --version
- npm.cmd --version
-
- npm.cmd install -g neovim; exitIfFailed
- Get-Command -CommandType Application neovim-node-host.cmd; exitIfFailed
- npm.cmd link neovim
-
- if ($env:USE_LUACOV -eq 1) {
- & $env:DEPS_PREFIX\luarocks\luarocks.bat install cluacov
- }
-}
-
-function Test {
- # Functional tests
- # The $LastExitCode from MSBuild can't be trusted
- $failed = $false
-
- # Run only this test file:
- # $env:TEST_FILE = "test\functional\foo.lua"
- cmake --build $buildDir --target functionaltest 2>&1 |
- ForEach-Object { $failed = $failed -or
- $_ -match 'functional tests failed with error'; $_ }
-
- if ($failed) {
- exit $LastExitCode
- }
-
- if (-not $uploadToCodecov) {
- return
- }
- if ($env:USE_LUACOV -eq 1) {
- & $env:DEPS_PREFIX\bin\luacov.bat
- }
- bash -l /c/projects/neovim/ci/common/submit_coverage.sh functionaltest
-}
-
-function TestOld {
- # Old tests
- # Add MSYS to path, required for e.g. `find` used in test scripts.
- # But would break functionaltests, where its `more` would be used then.
- $OldPath = $env:PATH
- $env:PATH = "C:\msys64\usr\bin;$env:PATH"
- & "C:\msys64\mingw64\bin\mingw32-make.exe" -C $(Convert-Path $projectDir\src\nvim\testdir) VERBOSE=1; exitIfFailed
- $env:PATH = $OldPath
-
- if ($uploadToCodecov) {
- bash -l /c/projects/neovim/ci/common/submit_coverage.sh oldtest
- }
-}
-
-
-function Package {
- cmake -S $projectDir -B $buildDir $(convertToCmakeArgs($nvimCmakeVars)) -G Ninja; exitIfFailed
- cmake --build $buildDir --target package; exitIfFailed
-}
-
-if ($PSCmdlet.ParameterSetName) {
- & (Get-ChildItem "Function:$($PSCmdlet.ParameterSetName)")
- exit
-}
+[CmdletBinding(DefaultParameterSetName = "Build")]
+param(
+ [Parameter(ParameterSetName="Build")][switch]$Build,
+ [Parameter(ParameterSetName="BuildDeps")][switch]$BuildDeps,
+ [Parameter(ParameterSetName="EnsureTestDeps")][switch]$EnsureTestDeps,
+ [Parameter(ParameterSetName="Package")][switch]$Package,
+ [Parameter(ParameterSetName="Test")][switch]$Test,
+ [Parameter(ParameterSetName="TestOld")][switch]$TestOld
+)
+
+Set-StrictMode -Version Latest
+$ErrorActionPreference = 'Stop'
+$ProgressPreference = 'SilentlyContinue'
+
+$projectDir = [System.IO.Path]::GetFullPath("$(Get-Location)")
+$buildDir = Join-Path -Path $projectDir -ChildPath "build"
+
+# $env:CMAKE_BUILD_TYPE is ignored by cmake when not using ninja
+$cmakeBuildType = $(if ($null -ne $env:CMAKE_BUILD_TYPE) {$env:CMAKE_BUILD_TYPE} else {'RelWithDebInfo'});
+$depsCmakeVars = @{
+ CMAKE_BUILD_TYPE=$cmakeBuildType;
+}
+$nvimCmakeVars = @{
+ CMAKE_BUILD_TYPE=$cmakeBuildType;
+ BUSTED_OUTPUT_TYPE = 'nvim';
+ DEPS_PREFIX=$(if ($null -ne $env:DEPS_PREFIX) {$env:DEPS_PREFIX} else {".deps/usr"});
+}
+if ($null -eq $env:DEPS_BUILD_DIR) {
+ $env:DEPS_BUILD_DIR = Join-Path -Path $projectDir -ChildPath ".deps"
+}
+$uploadToCodeCov = $false
+
+function exitIfFailed() {
+ if ($LastExitCode -ne 0) {
+ exit $LastExitCode
+ }
+}
+
+function convertToCmakeArgs($vars) {
+ return $vars.GetEnumerator() | ForEach-Object { "-D$($_.Key)=$($_.Value)" }
+}
+
+$installationPath = vswhere.exe -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
+if ($installationPath -and (Test-Path "$installationPath\Common7\Tools\vsdevcmd.bat")) {
+ & "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -arch=x64 -no_logo && set" | ForEach-Object {
+ $name, $value = $_ -split '=', 2
+ Set-Content env:\"$name" $value
+ }
+}
+
+function BuildDeps {
+
+ if (Test-Path -PathType container $env:DEPS_BUILD_DIR) {
+ $cachedBuildTypeStr = $(Get-Content $env:DEPS_BUILD_DIR\CMakeCache.txt | Select-String -Pattern "CMAKE_BUILD_TYPE.*=($cmakeBuildType)")
+ if (-not $cachedBuildTypeStr) {
+ Write-Warning " unable to validate build type from cache dir ${env:DEPS_BUILD_DIR}"
+ }
+ }
+
+ # we currently can't use ninja for cmake.deps, see #19405
+ $depsCmakeGenerator = "Visual Studio 16 2019"
+ $depsCmakeGeneratorPlf = "x64"
+ cmake -S "$projectDir\cmake.deps" -B $env:DEPS_BUILD_DIR -G $depsCmakeGenerator -A $depsCmakeGeneratorPlf $(convertToCmakeArgs($depsCmakeVars)); exitIfFailed
+
+ $depsCmakeNativeToolOptions= @('/verbosity:normal', '/m')
+ cmake --build $env:DEPS_BUILD_DIR --config $cmakeBuildType -- $depsCmakeNativeToolOptions; exitIfFailed
+}
+
+function Build {
+ cmake -S $projectDir -B $buildDir $(convertToCmakeArgs($nvimCmakeVars)) -G Ninja; exitIfFailed
+ cmake --build $buildDir --config $cmakeBuildType; exitIfFailed
+}
+
+function EnsureTestDeps {
+ & $buildDir\bin\nvim.exe "--version"; exitIfFailed
+
+ # Ensure that the "win32" feature is set.
+ & $buildDir\bin\nvim -u NONE --headless -c 'exe !has(\"win32\").\"cq\"' ; exitIfFailed
+
+ python -m pip install pynvim
+ # Sanity check
+ python -c "import pynvim; print(str(pynvim))"; exitIfFailed
+
+ gem.cmd install --pre neovim
+ Get-Command -CommandType Application neovim-ruby-host.bat; exitIfFailed
+
+ node --version
+ npm.cmd --version
+
+ npm.cmd install -g neovim; exitIfFailed
+ Get-Command -CommandType Application neovim-node-host.cmd; exitIfFailed
+ npm.cmd link neovim
+
+ if ($env:USE_LUACOV -eq 1) {
+ & $env:DEPS_PREFIX\luarocks\luarocks.bat install cluacov
+ }
+}
+
+function Test {
+ # Functional tests
+ # The $LastExitCode from MSBuild can't be trusted
+ $failed = $false
+
+ # Run only this test file:
+ # $env:TEST_FILE = "test\functional\foo.lua"
+ cmake --build $buildDir --target functionaltest 2>&1 |
+ ForEach-Object { $failed = $failed -or
+ $_ -match 'functional tests failed with error'; $_ }
+
+ if ($failed) {
+ exit $LastExitCode
+ }
+
+ if (-not $uploadToCodecov) {
+ return
+ }
+ if ($env:USE_LUACOV -eq 1) {
+ & $env:DEPS_PREFIX\bin\luacov.bat
+ }
+ bash -l /c/projects/neovim/ci/common/submit_coverage.sh functionaltest
+}
+
+function TestOld {
+ # Old tests
+ # Add MSYS to path, required for e.g. `find` used in test scripts.
+ # But would break functionaltests, where its `more` would be used then.
+ $OldPath = $env:PATH
+ $env:PATH = "C:\msys64\usr\bin;$env:PATH"
+ & "C:\msys64\mingw64\bin\mingw32-make.exe" -C $(Convert-Path $projectDir\src\nvim\testdir) VERBOSE=1; exitIfFailed
+ $env:PATH = $OldPath
+
+ if ($uploadToCodecov) {
+ bash -l /c/projects/neovim/ci/common/submit_coverage.sh oldtest
+ }
+}
+
+
+function Package {
+ cmake -S $projectDir -B $buildDir $(convertToCmakeArgs($nvimCmakeVars)) -G Ninja; exitIfFailed
+ cmake --build $buildDir --target package; exitIfFailed
+}
+
+if ($PSCmdlet.ParameterSetName) {
+ & (Get-ChildItem "Function:$($PSCmdlet.ParameterSetName)")
+ exit
+}
diff --git a/cmake.deps/CMakeLists.txt b/cmake.deps/CMakeLists.txt
index 897d056860..643fbc66aa 100644
--- a/cmake.deps/CMakeLists.txt
+++ b/cmake.deps/CMakeLists.txt
@@ -210,8 +210,8 @@ set(TREESITTER_LUA_SHA256 564594fe0ffd2f2fb3578a15019b723e1bc94ac82cb6a0103a6b3b
set(TREESITTER_VIM_URL https://github.com/vigoux/tree-sitter-viml/archive/v0.2.0.tar.gz)
set(TREESITTER_VIM_SHA256 608dcc31a7948cb66ae7f45494620e2e9face1af75598205541f80d782ec4501)
-set(TREESITTER_HELP_URL https://github.com/vigoux/tree-sitter-vimdoc/archive/a2c5c01f797eef67634941630442eea66eb7e1b6.tar.gz)
-set(TREESITTER_HELP_SHA256 b999c145da02652c235d497cb32e72660175d3b9fa129a7a6ba164b60414e73d)
+set(TREESITTER_HELP_URL https://github.com/neovim/tree-sitter-vimdoc/archive/v1.1.0.tar.gz)
+set(TREESITTER_HELP_SHA256 4c0ef80c6dc09acab362478950ec6be58a4ab1cbf2d95754b8fbb566e4c647a1)
set(TREESITTER_URL https://github.com/tree-sitter/tree-sitter/archive/v0.20.7.tar.gz)
set(TREESITTER_SHA256 b355e968ec2d0241bbd96748e00a9038f83968f85d822ecb9940cbe4c42e182e)
diff --git a/cmake.deps/cmake/BuildTreesitterParsers.cmake b/cmake.deps/cmake/BuildTreesitterParsers.cmake
index 25d2fd21a3..e08792f62a 100644
--- a/cmake.deps/cmake/BuildTreesitterParsers.cmake
+++ b/cmake.deps/cmake/BuildTreesitterParsers.cmake
@@ -4,6 +4,8 @@ function(BuildTSParser LANG TS_URL TS_SHA256 TS_CMAKE_FILE)
PREFIX ${DEPS_BUILD_DIR}
URL ${TREESITTER_C_URL}
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/${NAME}
+ CMAKE_CACHE_ARGS
+ -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}
DOWNLOAD_COMMAND ${CMAKE_COMMAND}
-DPREFIX=${DEPS_BUILD_DIR}
-DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/${NAME}
diff --git a/runtime/compiler/hare.vim b/runtime/compiler/hare.vim
new file mode 100644
index 0000000000..c0fa68cc00
--- /dev/null
+++ b/runtime/compiler/hare.vim
@@ -0,0 +1,31 @@
+" Vim compiler file
+" Compiler: Hare Compiler
+" Maintainer: Amelia Clarke <me@rsaihe.dev>
+" Last Change: 2022-09-21
+
+if exists("g:current_compiler")
+ finish
+endif
+let g:current_compiler = "hare"
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+if exists(':CompilerSet') != 2
+ command -nargs=* CompilerSet setlocal <args>
+endif
+
+if filereadable("Makefile") || filereadable("makefile")
+ CompilerSet makeprg=make
+else
+ CompilerSet makeprg=hare\ build
+endif
+
+CompilerSet errorformat=
+ \Error\ %f:%l:%c:\ %m,
+ \Syntax\ error:\ %.%#\ at\ %f:%l:%c\\,\ %m,
+ \%-G%.%#
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+" vim: tabstop=2 shiftwidth=2 expandtab
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index 7e55bb8f4e..d53ca01df0 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -83,6 +83,7 @@ and |rpcnotify()|:
let nvim = jobstart(['nvim', '--embed'], {'rpc': v:true})
echo rpcrequest(nvim, 'nvim_eval', '"Hello " . "world!"')
call jobstop(nvim)
+<
==============================================================================
API Definitions *api-definitions*
@@ -92,7 +93,7 @@ The Nvim C API defines custom types for all function parameters. Some are just
typedefs around C99 standard types, others are Nvim-defined data structures.
Basic types ~
-
+>
API Type C type
------------------------------------------------------------------------
Nil
@@ -103,7 +104,7 @@ Basic types ~
Array
Dictionary (msgpack: map)
Object
-
+<
Note: empty Array is accepted as a valid argument for Dictionary parameter.
Special types (msgpack EXT) ~
@@ -115,13 +116,13 @@ Special types (msgpack EXT) ~
The EXT object data is the (integer) object handle. The EXT type codes given
in the |api-metadata| `types` key are stable: they will not change and are
thus forward-compatible.
-
+>
EXT Type C type Data
------------------------------------------------------------------------
Buffer enum value kObjectTypeBuffer |bufnr()|
Window enum value kObjectTypeWindow |window-ID|
Tabpage enum value kObjectTypeTabpage internal handle
-
+<
*api-indexing*
Most of the API uses 0-based indices, and ranges are end-exclusive. For the
@@ -130,19 +131,19 @@ end of a range, -1 denotes the last line/column.
Exception: the following API functions use "mark-like" indexing (1-based
lines, 0-based columns):
- |nvim_get_mark()|
- |nvim_buf_get_mark()|
- |nvim_buf_set_mark()|
- |nvim_win_get_cursor()|
- |nvim_win_set_cursor()|
+- |nvim_get_mark()|
+- |nvim_buf_get_mark()|
+- |nvim_buf_set_mark()|
+- |nvim_win_get_cursor()|
+- |nvim_win_set_cursor()|
Exception: the following API functions use |extmarks| indexing (0-based
indices, end-inclusive):
- |nvim_buf_del_extmark()|
- |nvim_buf_get_extmark_by_id()|
- |nvim_buf_get_extmarks()|
- |nvim_buf_set_extmark()|
+- |nvim_buf_del_extmark()|
+- |nvim_buf_get_extmark_by_id()|
+- |nvim_buf_get_extmarks()|
+- |nvim_buf_set_extmark()|
*api-fast*
Most API functions are "deferred": they are queued on the main loop and
@@ -162,19 +163,19 @@ and return values.
Nvim exposes its API metadata as a Dictionary with these items:
-version Nvim version, API level/compatibility
-version.api_level API version integer *api-level*
-version.api_compatible API is backwards-compatible with this level
-version.api_prerelease Declares the API as unstable/unreleased >
- (version.api_prerelease && fn.since == version.api_level)
-functions API function signatures, containing |api-types| info
- describing the return value and parameters.
-ui_events |UI| event signatures
-ui_options Supported |ui-option|s
-{fn}.since API level where function {fn} was introduced
-{fn}.deprecated_since API level where function {fn} was deprecated
-types Custom handle types defined by Nvim
-error_types Possible error types returned by API functions
+- version Nvim version, API level/compatibility
+- version.api_level API version integer *api-level*
+- version.api_compatible API is backwards-compatible with this level
+- version.api_prerelease Declares the API as unstable/unreleased
+ `(version.api_prerelease && fn.since == version.api_level)`
+- functions API function signatures, containing |api-types| info
+ describing the return value and parameters.
+- ui_events |UI| event signatures
+- ui_options Supported |ui-option|s
+- {fn}.since API level where function {fn} was introduced
+- {fn}.deprecated_since API level where function {fn} was deprecated
+- types Custom handle types defined by Nvim
+- error_types Possible error types returned by API functions
About the `functions` map:
@@ -345,7 +346,7 @@ LUA ~
In-process Lua plugins can receive buffer updates in the form of Lua
callbacks. These callbacks are called frequently in various contexts;
|textlock| prevents changing buffer contents and window layout (use
-|vim.schedule| to defer such operations to the main loop instead).
+|vim.schedule()| to defer such operations to the main loop instead).
|nvim_buf_attach()| will take keyword args for the callbacks. "on_lines" will
receive parameters ("lines", {buf}, {changedtick}, {firstline}, {lastline},
@@ -989,7 +990,7 @@ nvim_get_proc_children({pid}) *nvim_get_proc_children()*
nvim_get_runtime_file({name}, {all}) *nvim_get_runtime_file()*
Find files in runtime directories
- 'name' can contain wildcards. For example
+ "name" can contain wildcards. For example
nvim_get_runtime_file("colors/*.vim", true) will return all color scheme
files. Always use forward slashes (/) in the search pattern for
subdirectories regardless of platform.
@@ -1164,7 +1165,7 @@ nvim_open_term({buffer}, {opts}) *nvim_open_term()*
terminal mode. Note: keypresses are sent raw as they would
be to the pty master end. For instance, a carriage return
is sent as a "\r", not as a "\n". |textlock| applies. It
- is possible to call |nvim_chan_send| directly in the
+ is possible to call |nvim_chan_send()| directly in the
callback however. ["input", term, bufnr, data]
Return: ~
@@ -1396,15 +1397,15 @@ nvim_set_hl({ns_id}, {name}, {*val}) *nvim_set_hl()*
• link: name of another highlight group to link to, see
|:hi-link|.
• default: Don't override existing definition |:hi-default|
- • ctermfg: Sets foreground of cterm color |highlight-ctermfg|
- • ctermbg: Sets background of cterm color |highlight-ctermbg|
+ • ctermfg: Sets foreground of cterm color |ctermfg|
+ • ctermbg: Sets background of cterm color |ctermbg|
• cterm: cterm attribute map, like |highlight-args|. If not
set, cterm attributes will match those from the attribute
map documented above.
nvim_set_hl_ns({ns_id}) *nvim_set_hl_ns()*
Set active namespace for highlights. This can be set for a single window,
- see |nvim_win_set_hl_ns|.
+ see |nvim_win_set_hl_ns()|.
Parameters: ~
{ns_id} the namespace to use
@@ -1413,7 +1414,7 @@ nvim_set_hl_ns_fast({ns_id}) *nvim_set_hl_ns_fast()*
Set active namespace for highlights while redrawing.
This function meant to be called while redrawing, primarily from
- |nvim_set_decoration_provider| on_win and on_line callbacks, which are
+ |nvim_set_decoration_provider()| on_win and on_line callbacks, which are
allowed to change the namespace during a redraw cycle.
Attributes: ~
@@ -1445,7 +1446,7 @@ nvim_set_keymap({mode}, {lhs}, {rhs}, {*opts}) *nvim_set_keymap()*
{rhs} Right-hand-side |{rhs}| of the mapping.
{opts} Optional parameters map: keys are |:map-arguments|, values are
booleans (default false). Accepts all |:map-arguments| as keys
- excluding |<buffer>| but including |noremap| and "desc".
+ excluding |<buffer>| but including |:noremap| and "desc".
Unknown key is an error. "desc" can be used to give a
description to the mapping. When called from Lua, also accepts
a "callback" key that takes a Lua function to call when the
@@ -1696,7 +1697,13 @@ nvim_cmd({*cmd}, {*opts}) *nvim_cmd()*
of a String. This allows for easier construction and manipulation of an Ex
command. This also allows for things such as having spaces inside a
command argument, expanding filenames in a command that otherwise doesn't
- expand filenames, etc.
+ expand filenames, etc. Command arguments may also be Number, Boolean or
+ String.
+
+ The first argument may also be used instead of count for commands that
+ support it in order to make their usage simpler with |vim.cmd()|. For
+ example, instead of `vim.cmd.bdelete{ count = 2 }`, you may do
+ `vim.cmd.bdelete(2)`.
On execution error: fails with VimL error, updates v:errmsg.
@@ -1804,15 +1811,15 @@ nvim_parse_cmd({str}, {opts}) *nvim_parse_cmd()*
Return: ~
Dictionary containing command information, with these keys:
• cmd: (string) Command name.
- • range: (array) Command <range>. Can have 0-2 elements depending on
- how many items the range contains. Has no elements if command
- doesn't accept a range or if no range was specified, one element if
- only a single range item was specified and two elements if both
- range items were specified.
- • count: (number) Any |<count>| that was supplied to the command. -1
- if command cannot take a count.
- • reg: (number) The optional command |<register>|, if specified. Empty
- string if not specified or if command cannot take a register.
+ • range: (array) (optional) Command range (|<line1>| |<line2>|).
+ Omitted if command doesn't accept a range. Otherwise, has no
+ elements if no range was specified, one element if only a single
+ range item was specified, or two elements if both range items were
+ specified.
+ • count: (number) (optional) Command |<count>|. Omitted if command
+ cannot take a count.
+ • reg: (string) (optional) Command |<register>|. Omitted if command
+ cannot take a register.
• bang: (boolean) Whether command contains a |<bang>| (!) modifier.
• args: (array) Command arguments.
• addr: (string) Value of |:command-addr|. Uses short name.
@@ -1886,7 +1893,7 @@ nvim_get_all_options_info() *nvim_get_all_options_info()*
Gets the option information for all options.
The dictionary has the full option names as keys and option metadata
- dictionaries as detailed at |nvim_get_option_info|.
+ dictionaries as detailed at |nvim_get_option_info()|.
Return: ~
dictionary of all options
@@ -1960,7 +1967,7 @@ nvim_set_option_value({name}, {value}, {*opts})
{name} Option name
{value} New option value
{opts} Optional parameters
- • scope: One of 'global' or 'local'. Analogous to
+ • scope: One of "global" or "local". Analogous to
|:setglobal| and |:setlocal|, respectively.
• win: |window-ID|. Used for setting window local option.
• buf: Buffer number. Used for setting buffer local option.
@@ -2572,11 +2579,11 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {*opts})
• virt_text : virtual text to link to this mark. A list of
[text, highlight] tuples, each representing a text chunk
with specified highlight. `highlight` element can either
- be a a single highlight group, or an array of multiple
+ be a single highlight group, or an array of multiple
highlight groups that will be stacked (highest priority
last). A highlight group can be supplied either as a
string or as an integer, the latter which can be obtained
- using |nvim_get_hl_id_by_name|.
+ using |nvim_get_hl_id_by_name()|.
• virt_text_pos : position of virtual text. Possible values:
• "eol": right after eol character (default)
• "overlay": display over the specified column, without
@@ -2608,7 +2615,7 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {*opts})
• virt_lines_above: place virtual lines above instead.
• virt_lines_leftcol: Place extmarks in the leftmost column
of the window, bypassing sign and number columns.
- • ephemeral : for use with |nvim_set_decoration_provider|
+ • ephemeral : for use with |nvim_set_decoration_provider()|
callbacks. The mark will only be used for the current
redraw cycle, and not be permantently stored in the
buffer.
@@ -2686,7 +2693,7 @@ nvim_set_decoration_provider({ns_id}, {*opts})
triggered during the redraw code.
The expected usage is to set extmarks for the currently redrawn buffer.
- |nvim_buf_set_extmark| can be called to add marks on a per-window or
+ |nvim_buf_set_extmark()| can be called to add marks on a per-window or
per-lines basis. Use the `ephemeral` key to only use the mark for the
current screen redraw (the callback will be called again for the next
redraw ).
@@ -2844,7 +2851,7 @@ nvim_win_hide({window}) *nvim_win_hide()*
Like |:hide| the buffer becomes hidden unless another window is editing
it, or 'bufhidden' is `unload`, `delete` or `wipe` as opposed to |:close|
- or |nvim_win_close|, which will close the buffer.
+ or |nvim_win_close()|, which will close the buffer.
Attributes: ~
not allowed when |textlock| is active
@@ -2890,7 +2897,7 @@ nvim_win_set_hl_ns({window}, {ns_id}) *nvim_win_set_hl_ns()*
Set highlight namespace for a window. This will use highlights defined in
this namespace, but fall back to global highlights (ns=0) when missing.
- This takes predecence over the 'winhighlight' option.
+ This takes precedence over the 'winhighlight' option.
Parameters: ~
{ns_id} the namespace to use
@@ -3012,7 +3019,7 @@ nvim_open_win({buffer}, {enter}, {*config}) *nvim_open_win()*
options. 'signcolumn' is changed to `auto` and
'colorcolumn' is cleared. The end-of-buffer region is
hidden by setting `eob` flag of 'fillchars' to a space
- char, and clearing the |EndOfBuffer| region in
+ char, and clearing the |hl-EndOfBuffer| region in
'winhighlight'.
• border: Style of (optional) window border. This can either
@@ -3148,7 +3155,7 @@ Autocmd Functions *api-autocmd*
nvim_clear_autocmds({*opts}) *nvim_clear_autocmds()*
Clear all autocommands that match the corresponding {opts}. To delete a
- particular autocmd, see |nvim_del_autocmd|.
+ particular autocmd, see |nvim_del_autocmd()|.
Parameters: ~
{opts} Parameters
@@ -3295,7 +3302,7 @@ nvim_del_augroup_by_id({id}) *nvim_del_augroup_by_id()*
To get a group id one can use |nvim_get_autocmds()|.
- NOTE: behavior differs from |augroup-delete|. When deleting a group,
+ NOTE: behavior differs from |:augroup-delete|. When deleting a group,
autocommands contained in this group will also be deleted and cleared.
This group will no longer exist.
@@ -3309,7 +3316,7 @@ nvim_del_augroup_by_id({id}) *nvim_del_augroup_by_id()*
nvim_del_augroup_by_name({name}) *nvim_del_augroup_by_name()*
Delete an autocommand group by name.
- NOTE: behavior differs from |augroup-delete|. When deleting a group,
+ NOTE: behavior differs from |:augroup-delete|. When deleting a group,
autocommands contained in this group will also be deleted and cleared.
This group will no longer exist.
@@ -3317,7 +3324,7 @@ nvim_del_augroup_by_name({name}) *nvim_del_augroup_by_name()*
{name} String The name of the group.
See also: ~
- |autocommand-groups|
+ |autocmd-groups|
nvim_del_autocmd({id}) *nvim_del_autocmd()*
Delete an autocommand by id.
@@ -3435,8 +3442,8 @@ nvim_ui_detach() *nvim_ui_detach()*
*nvim_ui_pum_set_bounds()*
nvim_ui_pum_set_bounds({width}, {height}, {row}, {col})
- Tells Nvim the geometry of the popumenu, to align floating windows with an
- external popup menu.
+ Tells Nvim the geometry of the popupmenu, to align floating windows with
+ an external popup menu.
Note that this method is not to be confused with
|nvim_ui_pum_set_height()|, which sets the number of visible items in the
@@ -3455,7 +3462,7 @@ nvim_ui_pum_set_bounds({width}, {height}, {row}, {col})
{col} Popupmenu height.
nvim_ui_pum_set_height({height}) *nvim_ui_pum_set_height()*
- Tells Nvim the number of elements displaying in the popumenu, to decide
+ Tells Nvim the number of elements displaying in the popupmenu, to decide
<PageUp> and <PageDown> movement.
Attributes: ~
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index e55534b163..97a1bdc134 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -835,13 +835,13 @@ QuitPre When using `:quit`, `:wq` or `:qall`, before
See also |ExitPre|, |WinClosed|.
*RemoteReply*
RemoteReply When a reply from a Vim that functions as
- server was received |server2client()|. The
+ server was received server2client(). The
pattern is matched against the {serverid}.
<amatch> is equal to the {serverid} from which
the reply was sent, and <afile> is the actual
reply string.
Note that even if an autocommand is defined,
- the reply should be read with |remote_read()|
+ the reply should be read with remote_read()
to consume it.
*SearchWrapped*
SearchWrapped After making a search with |n| or |N| if the
@@ -1206,7 +1206,7 @@ still executed.
==============================================================================
7. Buffer-local autocommands *autocmd-buflocal* *autocmd-buffer-local*
- *<buffer=N>* *<buffer=abuf>* *E680*
+ *<buffer>* *<buffer=N>* *<buffer=abuf>* *E680*
Buffer-local autocommands are attached to a specific buffer. They are useful
if the buffer does not have a name and when the name does not match a specific
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index 7b1a50c1fb..4a889c67be 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -1131,13 +1131,14 @@ chdir({dir}) *chdir()*
directory (|:tcd|) then changes the tabpage local
directory.
- Otherwise, changes the global directory.
+ {dir} must be a String.
If successful, returns the previous working directory. Pass
this to another chdir() to restore the directory.
On failure, returns an empty string.
Example: >
let save_dir = chdir(newdir)
- if save_dir
+ if save_dir != ""
" ... do some work
call chdir(save_dir)
endif
@@ -1537,7 +1538,7 @@ cursor({list})
debugbreak({pid}) *debugbreak()*
Specifically used to interrupt a program being debugged. It
will cause process {pid} to get a SIGTRAP. Behavior for other
- processes is undefined. See |terminal-debugger|.
+ processes is undefined. See |terminal-debug|.
{Sends a SIGINT to a process {pid} other than MS-Windows}
Returns |TRUE| if successfully interrupted the program.
@@ -2627,7 +2628,7 @@ get({dict}, {key} [, {default}])
{default} is omitted. Useful example: >
let val = get(g:, 'var_name', 'default')
< This gets the value of g:var_name if it exists, and uses
- 'default' when it does not exist.
+ "default" when it does not exist.
get({func}, {what})
Get item {what} from Funcref {func}. Possible values for
{what} are:
@@ -3034,7 +3035,7 @@ getcurpos([{winid}])
cursor vertically. Also see |getcursorcharpos()| and
|getpos()|.
The first "bufnum" item is always zero. The byte position of
- the cursor is returned in 'col'. To get the character
+ the cursor is returned in "col". To get the character
position, use |getcursorcharpos()|.
The optional {winid} argument can specify the window. It can
@@ -3240,7 +3241,7 @@ getloclist({nr} [, {what}]) *getloclist()*
In addition to the items supported by |getqflist()| in {what},
the following item is supported by |getloclist()|:
- filewinid id of the window used to display files
+ filewinid id of the window used to display files
from the location list. This field is
applicable only when called from a
location list window. See
@@ -3289,18 +3290,18 @@ getmatches([{win}]) *getmatches()*
an empty list is returned.
Example: >
:echo getmatches()
-< [{'group': 'MyGroup1', 'pattern': 'TODO',
- 'priority': 10, 'id': 1}, {'group': 'MyGroup2',
- 'pattern': 'FIXME', 'priority': 10, 'id': 2}] >
+< [{"group": "MyGroup1", "pattern": "TODO",
+ "priority": 10, "id": 1}, {"group": "MyGroup2",
+ "pattern": "FIXME", "priority": 10, "id": 2}] >
:let m = getmatches()
:call clearmatches()
:echo getmatches()
< [] >
:call setmatches(m)
:echo getmatches()
-< [{'group': 'MyGroup1', 'pattern': 'TODO',
- 'priority': 10, 'id': 1}, {'group': 'MyGroup2',
- 'pattern': 'FIXME', 'priority': 10, 'id': 2}] >
+< [{"group": "MyGroup1", "pattern": "TODO",
+ "priority": 10, "id": 1}, {"group": "MyGroup2",
+ "pattern": "FIXME", "priority": 10, "id": 2}] >
:unlet m
<
getmousepos() *getmousepos()*
@@ -3413,7 +3414,7 @@ getqflist([{what}]) *getqflist()*
|quickfix-ID|; zero means the id for the
current list or the list specified by "nr"
idx get information for the quickfix entry at this
- index in the list specified by 'id' or 'nr'.
+ index in the list specified by "id" or "nr".
If set to zero, then uses the current entry.
See |quickfix-index|
items quickfix list entries
@@ -3499,7 +3500,7 @@ getreginfo([{regname}]) *getreginfo()*
Dictionary with the following entries:
regcontents List of lines contained in register
{regname}, like
- |getreg|({regname}, 1, 1).
+ getreg({regname}, 1, 1).
regtype the type of register {regname}, as in
|getregtype()|.
isunnamed Boolean flag, v:true if this register
@@ -4415,7 +4416,7 @@ jobstart({cmd} [, {opts}]) *jobstart()*
killed when Nvim exits. If the process exits
before Nvim, `on_exit` will be invoked.
env: (dict) Map of environment variable name:value
- pairs extending (or replacing with |clear_env|)
+ pairs extending (or replace with "clear_env")
the current environment. |jobstart-env|
height: (number) Height of the `pty` terminal.
|on_exit|: (function) Callback invoked when the job exits.
@@ -5209,12 +5210,12 @@ matchfuzzypos({list}, {str} [, {dict}]) *matchfuzzypos()*
Example: >
:echo matchfuzzypos(['testing'], 'tsg')
-< results in [['testing'], [[0, 2, 6]], [99]] >
+< results in [["testing"], [[0, 2, 6]], [99]] >
:echo matchfuzzypos(['clay', 'lacy'], 'la')
-< results in [['lacy', 'clay'], [[0, 1], [1, 2]], [153, 133]] >
+< results in [["lacy", "clay"], [[0, 1], [1, 2]], [153, 133]] >
:echo [{'text': 'hello', 'id' : 10}]
\ ->matchfuzzypos('ll', {'key' : 'text'})
-< results in [[{'id': 10, 'text': 'hello'}], [[2, 3]], [127]]
+< results in [[{"id": 10, "text": "hello"}], [[2, 3]], [127]]
matchlist({expr}, {pat} [, {start} [, {count}]]) *matchlist()*
Same as |match()|, but return a |List|. The first item in the
@@ -6069,6 +6070,8 @@ rand([{expr}]) *rand()*
*readdir()*
readdir({directory} [, {expr}])
Return a list with file and directory names in {directory}.
+ You can also use |glob()| if you don't need to do complicated
+ things, such as limiting the number of matches.
When {expr} is omitted all entries are included.
When {expr} is given, it is evaluated to check what to do:
@@ -7223,7 +7226,7 @@ setqflist({list} [, {action} [, {what}]]) *setqflist()*
See |quickfix-parse|
id quickfix list identifier |quickfix-ID|
idx index of the current entry in the quickfix
- list specified by 'id' or 'nr'. If set to '$',
+ list specified by "id" or "nr". If set to '$',
then the last entry in the list is set as the
current entry. See |quickfix-index|
items list of quickfix entries. Same as the {list}
@@ -8247,7 +8250,7 @@ synIDattr({synID}, {what} [, {mode}]) *synIDattr()*
"bg" background color (as with "fg")
"font" font name (only available in the GUI)
|highlight-font|
- "sp" special color (as with "fg") |highlight-guisp|
+ "sp" special color (as with "fg") |guisp|
"fg#" like "fg", but for the GUI and the GUI is
running the name in "#RRGGBB" form
"bg#" like "fg#" for "bg"
@@ -8303,12 +8306,12 @@ synconcealed({lnum}, {col}) *synconcealed()*
the text is "123456" and both "23" and "45" are concealed
and replaced by the character "X", then:
call returns ~
- synconcealed(lnum, 1) [0, '', 0]
- synconcealed(lnum, 2) [1, 'X', 1]
- synconcealed(lnum, 3) [1, 'X', 1]
- synconcealed(lnum, 4) [1, 'X', 2]
- synconcealed(lnum, 5) [1, 'X', 2]
- synconcealed(lnum, 6) [0, '', 0]
+ synconcealed(lnum, 1) [0, '', 0]
+ synconcealed(lnum, 2) [1, 'X', 1]
+ synconcealed(lnum, 3) [1, 'X', 1]
+ synconcealed(lnum, 4) [1, 'X', 2]
+ synconcealed(lnum, 5) [1, 'X', 2]
+ synconcealed(lnum, 6) [0, '', 0]
synstack({lnum}, {col}) *synstack()*
@@ -9106,12 +9109,12 @@ winlayout([{tabnr}]) *winlayout()*
returns an empty list.
For a leaf window, it returns:
- ['leaf', {winid}]
+ ["leaf", {winid}]
For horizontally split windows, which form a column, it
returns:
- ['col', [{nested list of windows}]]
+ ["col", [{nested list of windows}]]
For vertically split windows, which form a row, it returns:
- ['row', [{nested list of windows}]]
+ ["row", [{nested list of windows}]]
Example: >
" Only one window in the tab page
diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt
index f19671e713..b1013420fa 100644
--- a/runtime/doc/cmdline.txt
+++ b/runtime/doc/cmdline.txt
@@ -764,7 +764,7 @@ Count and Range *N:*
When giving a count before entering ":", this is translated into:
:.,.+(count - 1)
-In words: The 'count' lines at and after the cursor. Example: To delete
+In words: The "count" lines at and after the cursor. Example: To delete
three lines: >
3:d<CR> is translated into: .,.+2d<CR>
<
diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt
index 4f17e7d34a..ebb0dfeb4e 100644
--- a/runtime/doc/develop.txt
+++ b/runtime/doc/develop.txt
@@ -151,6 +151,23 @@ DOCUMENTATION *dev-doc*
/// @param dirname The path fragment before `pend`
<
+Documentation format ~
+
+For Nvim-owned docs, use the following strict subset of "vimdoc" to ensure
+the help doc renders nicely in other formats (such as HTML:
+https://neovim.io/doc/user ).
+
+Strict "vimdoc" subset:
+
+- Use lists (like this!) prefixed with "-", "*", or "•", for adjacent lines
+ that you don't want auto-wrapped. Lists are always rendered with "flow"
+ (soft-wrapped) layout instead of preformatted (hard-wrapped) layout common
+ in legacy :help docs.
+- Separate blocks (paragraphs) of content by a blank line(s).
+- Do not use indentation in random places—that prevents the page from using
+ "flow" layout. If you need a preformatted section, put it in
+ a |help-codeblock| starting with ">".
+
C docstrings ~
Nvim API documentation lives in the source code, as docstrings (Doxygen
diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt
index 78254c6f2b..ada7b93f7c 100644
--- a/runtime/doc/diagnostic.txt
+++ b/runtime/doc/diagnostic.txt
@@ -296,7 +296,7 @@ EVENTS *diagnostic-events*
*DiagnosticChanged*
DiagnosticChanged After diagnostics have changed. When used from Lua,
- the new diagnostics are passed to the autocmcd
+ the new diagnostics are passed to the autocmd
callback in the "data" table.
Example: >
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 3e068e3b4e..6a9fb6d03c 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -40,7 +40,7 @@ List An ordered sequence of items, see |List| for details.
Dictionary An associative, unordered array: Each entry has a key and a
value. |Dictionary|
Examples:
- {'blue': "#0000ff", 'red': "#ff0000"}
+ {"blue": "#0000ff", "red": "#ff0000"}
#{blue: "#0000ff", red: "#ff0000"}
Blob Binary Large Object. Stores any sequence of bytes. See |Blob|
@@ -457,7 +457,7 @@ String automatically. Thus the String '4' and the number 4 will find the same
entry. Note that the String '04' and the Number 04 are different, since the
Number will be converted to the String '4', leading zeros are dropped. The
empty string can also be used as a key.
- *literal-Dict*
+ *literal-Dict* *#{}*
To avoid having to put quotes around every key the #{} form can be used. This
does require the key to consist only of ASCII letters, digits, '-' and '_'.
Example: >
@@ -681,7 +681,7 @@ similar to -1. >
:let shortblob = myblob[2:2] " Blob with one byte: 0z22
:let otherblob = myblob[:] " make a copy of the Blob
-If the first index is beyond the last byte of the Blob or the second byte is
+If the first index is beyond the last byte of the Blob or the second index is
before the first index, the result is an empty Blob. There is no error
message.
@@ -704,8 +704,8 @@ The length of the replaced bytes must be exactly the same as the value
provided. *E972*
To change part of a blob you can specify the first and last byte to be
-modified. The value must at least have the number of bytes in the range: >
- :let blob[3:5] = [3, 4, 5]
+modified. The value must have the same number of bytes in the range: >
+ :let blob[3:5] = 0z334455
You can also use the functions |add()|, |remove()| and |insert()|.
@@ -1228,7 +1228,10 @@ And NOT: >
\ ->map(mapexpr)
\ ->sort()
\ ->join()
-<
+
+When using the lambda form there must be no white space between the } and the
+(.
+
*expr9*
number
@@ -2528,7 +2531,7 @@ text...
echo 'done'
endif
END
-< Results in: ["if ok", " echo 'done'", "endif"]
+< Results in: `["if ok", " echo 'done'", "endif"]`
The marker must line up with "let" and the indentation
of the first line is removed from all the text lines.
Specifically: all the leading indentation exactly
@@ -4116,7 +4119,7 @@ This example sorts lines with a specific compare function. >
As a one-liner: >
:call setline(1, sort(getline(1, '$'), function("Strcmp")))
-
+<
scanf() replacement ~
*sscanf*
diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt
index 9f8ef248f8..ac54a6b6ca 100644
--- a/runtime/doc/filetype.txt
+++ b/runtime/doc/filetype.txt
@@ -178,7 +178,7 @@ If a file type that you want to use is not detected yet, there are a few ways
to add it. In any way, it's better not to modify the $VIMRUNTIME/filetype.lua
or $VIMRUNTIME/filetype.vim files. They will be overwritten when installing a
new version of Nvim. The following explains the legacy Vim mechanism (enabled
-if |do_legacy_filetype| is set). For Nvim's default mechanism, see
+if |g:do_legacy_filetype| is set). For Nvim's default mechanism, see
|vim.filetype.add()|.
A. If you want to overrule all default file type checks.
diff --git a/runtime/doc/ft_ada.txt b/runtime/doc/ft_ada.txt
index f6dfa708fb..3f002f2df7 100644
--- a/runtime/doc/ft_ada.txt
+++ b/runtime/doc/ft_ada.txt
@@ -288,7 +288,7 @@ g:ada_rainbow_color bool (true when exists)
rainbow_parenthesis for this to work.
*g:ada_folding*
-g:ada_folding set ('sigpft')
+g:ada_folding set ("sigpft")
Use folding for Ada sources.
's': activate syntax folding on load
'p': fold packages
@@ -296,10 +296,10 @@ g:ada_folding set ('sigpft')
't': fold types
'c': fold conditionals
'g': activate gnat pretty print folding on load
- 'i': lone 'is' folded with line above
- 'b': lone 'begin' folded with line above
- 'p': lone 'private' folded with line above
- 'x': lone 'exception' folded with line above
+ 'i': lone "is" folded with line above
+ 'b': lone "begin" folded with line above
+ 'p': lone "private" folded with line above
+ 'x': lone "exception" folded with line above
'i': activate indent folding on load
Note: Syntax folding is in an early (unusable) stage and
@@ -334,10 +334,10 @@ g:ada_omni_with_keywords
completion (|i_CTRL-X_CTRL-U|).
*g:ada_extended_tagging*
-g:ada_extended_tagging enum ('jump', 'list')
+g:ada_extended_tagging enum ("jump", "list")
use extended tagging, two options are available
- 'jump': use tjump to jump.
- 'list': add tags quick fix list.
+ "jump": use tjump to jump.
+ "list": add tags quick fix list.
Normal tagging does not support function or operator
overloading as these features are not available in C and
tagging was originally developed for C.
@@ -359,8 +359,8 @@ g:ada_with_gnat_project_files bool (true when exists)
*g:ada_default_compiler*
g:ada_default_compiler string
- set default compiler. Currently supported are 'gnat' and
- 'decada'.
+ set default compiler. Currently supported are "gnat" and
+ "decada".
An "exists" type is a boolean considered true when the variable is defined and
false when the variable is undefined. The value to which the variable is set
@@ -406,14 +406,14 @@ makes no difference.
g:gnat object
Control object which manages GNAT compiles. The object
is created when the first Ada source code is loaded provided
- that |g:ada_default_compiler| is set to 'gnat'. See
+ that |g:ada_default_compiler| is set to "gnat". See
|gnat_members| for details.
*g:decada*
g:decada object
Control object which manages Dec Ada compiles. The object
is created when the first Ada source code is loaded provided
- that |g:ada_default_compiler| is set to 'decada'. See
+ that |g:ada_default_compiler| is set to "decada". See
|decada_members| for details.
------------------------------------------------------------------------------
@@ -459,11 +459,11 @@ ada#List_Tag([{line}, {col}]) *ada#Listtags()*
ada#Jump_Tag ({ident}, {mode}) *ada#Jump_Tag()*
List all occurrences of the Ada entity under the cursor (or at
given line/column) in the tag jump list. Mode can either be
- 'tjump' or 'stjump'.
+ "tjump" or "stjump".
ada#Create_Tags ({option}) *ada#Create_Tags()*
- Creates tag file using Ctags. The option can either be 'file'
- for the current file, 'dir' for the directory of the current
+ Creates tag file using Ctags. The option can either be "file"
+ for the current file, "dir" for the directory of the current
file or a file name.
gnat#Insert_Tags_Header() *gnat#Insert_Tags_Header()*
@@ -489,7 +489,7 @@ backup.vim
http://www.vim.org/scripts/script.php?script_id=1537
Keeps as many backups as you like so you don't have to.
-rainbow_parenthsis.vim
+rainbow_parenthesis.vim
http://www.vim.org/scripts/script.php?script_id=1561
Very helpful since Ada uses only '(' and ')'.
diff --git a/runtime/doc/ft_rust.txt b/runtime/doc/ft_rust.txt
index 5c8782ec7a..3a0bf2293e 100644
--- a/runtime/doc/ft_rust.txt
+++ b/runtime/doc/ft_rust.txt
@@ -92,8 +92,8 @@ g:ftplugin_rust_source_path~
*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' : >
+ 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*
@@ -104,14 +104,14 @@ g:rustfmt_autosave~
<
*g:rustfmt_fail_silently*
g:rustfmt_fail_silently~
- Set this option to 1 to prevent 'rustfmt' from populating the
+ 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
+ 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 = ''
<
diff --git a/runtime/doc/ft_sql.txt b/runtime/doc/ft_sql.txt
index 335faf266e..03d9082aab 100644
--- a/runtime/doc/ft_sql.txt
+++ b/runtime/doc/ft_sql.txt
@@ -244,7 +244,7 @@ key to complete the optional parameter.
After typing the function name and a space, you can use the completion to
supply a parameter. The function takes the name of the Vim script you want to
source. Using the |cmdline-completion| feature, the SQLSetType function will
-search the |'runtimepath'| for all Vim scripts with a name containing 'sql'.
+search the |'runtimepath'| for all Vim scripts with a name containing "sql".
This takes the guess work out of the spelling of the names. The following are
examples: >
:SQLSetType
@@ -757,7 +757,7 @@ the syntax items for Perl.
Step 2
------
-Manually setting the filetype to 'sql' will also fire the appropriate filetype
+Manually setting the filetype to "sql" will also fire the appropriate filetype
files ftplugin/sql.vim. This file will define a number of buffer specific
maps for SQL completion, see |sql-completion-maps|. Now these maps have
been created and the SQL completion plugin has been initialized. All SQL
diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt
index 34213f7512..a1bedfa500 100644
--- a/runtime/doc/help.txt
+++ b/runtime/doc/help.txt
@@ -98,7 +98,6 @@ General subjects ~
|help.txt| overview and quick reference (this file)
|helphelp.txt| about using the help files
|index.txt| alphabetical index of all commands
-|help-tags| all the tags you can jump to (index of tags)
|tips.txt| various tips on using Vim
|message.txt| (error) messages and explanations
|develop.txt| development of Nvim
diff --git a/runtime/doc/helphelp.txt b/runtime/doc/helphelp.txt
index 569995d319..4758cd37c6 100644
--- a/runtime/doc/helphelp.txt
+++ b/runtime/doc/helphelp.txt
@@ -212,12 +212,6 @@ This is done when viewing the file in Vim, the file itself is not changed. It
is done by going through all help files and obtaining the first line of each
file. The files in $VIMRUNTIME/doc are skipped.
- *help-xterm-window*
-If you want to have the help in another xterm window, you could use this
-command: >
- :!xterm -e vim +help &
-<
-
*:helpt* *:helptags*
*E150* *E151* *E152* *E153* *E154* *E670* *E856*
:helpt[ags] [++t] {dir}
@@ -372,6 +366,7 @@ To separate sections in a help file, place a series of '=' characters in a
line starting from the first column. The section separator line is highlighted
differently.
+ *help-codeblock*
To quote a block of ex-commands verbatim, place a greater than (>) character
at the end of the line before the block and a less than (<) character as the
first non-blank on a line following the block. Any line starting in column 1
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index 7f3ef20762..f9ef99f819 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -13,7 +13,6 @@ to look for deleting something, use: "/delete".
For an overview of options see |option-list|.
For an overview of built-in functions see |functions|.
For a list of Vim variables see |vim-variable|.
-For a complete listing of all help items see |help-tags|.
Type |gO| to see the table of contents.
@@ -61,7 +60,7 @@ tag char action in Insert mode ~
|i_CTRL-Q| CTRL-Q same as CTRL-V, unless used for terminal
control flow
|i_CTRL-SHIFT-Q| CTRL-SHIFT-Q {char}
- like CTRL-Q unless |modifyOtherKeys| is active
+ like CTRL-Q unless |tui-modifyOtherKeys| is active
|i_CTRL-R| CTRL-R {register}
insert the contents of a register
|i_CTRL-R_CTRL-R| CTRL-R CTRL-R {register}
@@ -79,7 +78,7 @@ tag char action in Insert mode ~
line
|i_CTRL-V| CTRL-V {char} insert next non-digit literally
|i_CTRL-SHIFT-V| CTRL-SHIFT-V {char}
- like CTRL-V unless |modifyOtherKeys| is active
+ like CTRL-V unless |tui-modifyOtherKeys| is active
|i_CTRL-V_digit| CTRL-V {number} insert three digit decimal number as a single
byte.
|i_CTRL-W| CTRL-W delete word before the cursor
@@ -454,14 +453,14 @@ tag char note action in Normal mode ~
|<S-Up>| <S-Up> 1 same as CTRL-B
|<Undo>| <Undo> 2 same as "u"
|<Up>| <Up> 1 same as "k"
-|<ScrollWheelDown>| <ScrollWheelDown> move window three lines down
-|<S-ScrollWheelDown>| <S-ScrollWheelDown> move window one page down
-|<ScrollWheelUp>| <ScrollWheelUp> move window three lines up
-|<S-ScrollWheelUp>| <S-ScrollWheelUp> move window one page up
-|<ScrollWheelLeft>| <ScrollWheelLeft> move window six columns left
-|<S-ScrollWheelLeft>| <S-ScrollWheelLeft> move window one page left
-|<ScrollWheelRight>| <ScrollWheelRight> move window six columns right
-|<S-ScrollWheelRight>| <S-ScrollWheelRight> move window one page right
+*<ScrollWheelDown>* <ScrollWheelDown> move window three lines down
+*<S-ScrollWheelDown>* <S-ScrollWheelDown> move window one page down
+*<ScrollWheelUp>* <ScrollWheelUp> move window three lines up
+*<S-ScrollWheelUp>* <S-ScrollWheelUp> move window one page up
+*<ScrollWheelLeft>* <ScrollWheelLeft> move window six columns left
+*<S-ScrollWheelLeft>* <S-ScrollWheelLeft> move window one page left
+*<ScrollWheelRight>* <ScrollWheelRight> move window six columns right
+*<S-ScrollWheelRight>* <S-ScrollWheelRight> move window one page right
==============================================================================
2.1 Text objects *objects*
@@ -700,7 +699,7 @@ tag char note action in Normal mode ~
tag char note action in Normal mode ~
------------------------------------------------------------------------------
-|g_CTRL-A| g CTRL-A dump a memory profile
+g_CTRL-A g CTRL-A dump a memory profile
|g_CTRL-G| g CTRL-G show information about current cursor
position
|g_CTRL-H| g CTRL-H start Select block mode
diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt
index 6b0899334b..63ceab78a8 100644
--- a/runtime/doc/insert.txt
+++ b/runtime/doc/insert.txt
@@ -1126,7 +1126,8 @@ that contains the List. The Dict can have these items:
leading text is changed.
Other items are ignored.
-For acting upon end of completion, see the |CompleteDone| autocommand event.
+For acting upon end of completion, see the |CompleteDonePre| and
+|CompleteDone| autocommand event.
For example, the function can contain this: >
let matches = ... list of words ...
@@ -1519,7 +1520,7 @@ RUBY *ft-ruby-omni*
NOTE: |compl-omni| for Ruby code requires |provider-ruby| to be installed.
Ruby completion will parse your buffer on demand in order to provide a list of
-completions. These completions will be drawn from modules loaded by 'require'
+completions. These completions will be drawn from modules loaded by "require"
and modules defined in the current buffer.
The completions provided by CTRL-X CTRL-O are sensitive to the context:
@@ -1533,7 +1534,7 @@ The completions provided by CTRL-X CTRL-O are sensitive to the context:
3. After '.', '::' or ':' Methods applicable to the object being
dereferenced
- 4. After ':' or ':foo' Symbol name (beginning with 'foo')
+ 4. After ':' or ':foo' Symbol name (beginning with "foo")
Notes:
- Vim will load/evaluate code in order to provide completions. This may
@@ -1759,7 +1760,7 @@ In the example four special elements are visible:
dialect.
2. If the list containing possible values of attributes has one element and
this element is equal to the name of the attribute this attribute will be
- treated as boolean and inserted as 'attrname' and not as 'attrname="'
+ treated as boolean and inserted as "attrname" and not as 'attrname="'
3. "vimxmltaginfo" - a special key with a Dictionary containing tag
names as keys and two element List as values, for additional menu info and
the long description.
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
index 00aaf759e2..26bca21507 100644
--- a/runtime/doc/lsp.txt
+++ b/runtime/doc/lsp.txt
@@ -40,7 +40,7 @@ Follow these steps to get LSP features:
root_dir = vim.fs.dirname(vim.fs.find({'setup.py', 'pyproject.toml'}, { upward = true })[1]),
})
<
- See |vim.lsp.start| for details.
+ See |vim.lsp.start()| for details.
3. Configure keymaps and autocmds to utilize LSP features.
See |lsp-config|.
@@ -48,19 +48,19 @@ Follow these steps to get LSP features:
*lsp-config*
Starting a LSP client will automatically report diagnostics via
-|vim.diagnostic|. Read |vim.diagnostic.config| to learn how to customize the
+|vim.diagnostic|. Read |vim.diagnostic.config()| to learn how to customize the
display.
It also sets some buffer options if the options are otherwise empty and if the
language server supports the functionality.
-- |omnifunc| is set to |vim.lsp.omnifunc|. This allows to trigger completion
- using |i_CTRL-X_CTRL-o|
-- |tagfunc| is set to |vim.lsp.tagfunc|. This enables features like
+- 'omnifunc' is set to |vim.lsp.omnifunc()|. This allows to trigger completion
+ using |i_CTRL-X_CTRL-O|
+- 'tagfunc' is set to |vim.lsp.tagfunc()|. This enables features like
go-to-definition, |:tjump|, and keymaps like |CTRL-]|, |CTRL-W_]|,
|CTRL-W_}| to utilize the language server.
-- |formatexpr| is set to |vim.lsp.formatexpr| if both |formatprg| and
- |formatexpr| are empty. This allows to format lines via |gq| if the language
+- 'formatexpr' is set to |vim.lsp.formatexpr()| if both 'formatprg' and
+ 'formatexpr' are empty. This allows to format lines via |gq| if the language
server supports it.
To use other LSP features like hover, rename, etc. you can setup some
@@ -245,7 +245,7 @@ For |lsp-request|, each |lsp-handler| has this signature: >
Where `err` must be shaped like an RPC error:
`{ code, message, data? }`
- You can use |vim.lsp.rpc_response_error()| to create this object.
+ You can use |vim.lsp.rpc.rpc_response_error()| to create this object.
For |lsp-notification|, each |lsp-handler| has this signature: >
@@ -338,8 +338,8 @@ To configure the behavior of a builtin |lsp-handler|, the convenient method
}
<
Some handlers do not have an explicitly named handler function (such as
- |on_publish_diagnostics()|). To override these, first create a reference
- to the existing handler: >
+ ||vim.lsp.diagnostic.on_publish_diagnostics()|). To override these, first
+ create a reference to the existing handler: >
local on_references = vim.lsp.handlers["textDocument/references"]
vim.lsp.handlers["textDocument/references"] = vim.lsp.with(
@@ -360,7 +360,7 @@ Handlers can be set by:
vim.lsp.handlers["textDocument/definition"] = my_custom_default_definition
<
-- The {handlers} parameter for |vim.lsp.start_client|.
+- The {handlers} parameter for |vim.lsp.start_client()|.
This will set the |lsp-handler| as the default handler for this server.
For example: >
@@ -514,7 +514,7 @@ callback in the "data" table. Example: >
end,
})
<
-In addition, the following |User| |autocommands| are provided:
+Also the following |User| |autocommand|s are provided:
LspProgressUpdate *LspProgressUpdate*
Upon receipt of a progress notification from the server. See
@@ -788,7 +788,8 @@ start({config}, {opts}) *vim.lsp.start()*
})
<
- See |lsp.start_client| for all available options. The most important are:
+ See |vim.lsp.start_client()| for all available options. The most important
+ are:
`name` is an arbitrary name for the LSP client. It should be unique per
language server.
@@ -798,9 +799,9 @@ start({config}, {opts}) *vim.lsp.start()*
constructs like `~` are NOT expanded.
`root_dir` path to the project root. By default this is used to decide if
- an existing client should be re-used. The example above uses |vim.fs.find|
- and |vim.fs.dirname| to detect the root by traversing the file system
- upwards starting from the current directory until either a
+ an existing client should be re-used. The example above uses
+ |vim.fs.find()| and |vim.fs.dirname()| to detect the root by traversing
+ the file system upwards starting from the current directory until either a
`pyproject.toml` or `setup.py` file is found.
`workspace_folders` a list of { uri:string, name: string } tables. The
@@ -812,13 +813,13 @@ start({config}, {opts}) *vim.lsp.start()*
the project folder.
To ensure a language server is only started for languages it can handle,
- make sure to call |vim.lsp.start| within a |FileType| autocmd. Either use
- |:au|, |nvim_create_autocmd()| or put the call in a
+ make sure to call |vim.lsp.start()| within a |FileType| autocmd. Either
+ use |:au|, |nvim_create_autocmd()| or put the call in a
`ftplugin/<filetype_name>.lua` (See |ftplugin-name|)
Parameters: ~
{config} (table) Same configuration as documented in
- |lsp.start_client()|
+ |vim.lsp.start_client()|
{opts} nil|table Optional keyword arguments:
• reuse_client (fun(client: client, config: table): boolean)
Predicate used to decide if a client should be re-used.
@@ -837,15 +838,16 @@ start_client({config}) *vim.lsp.start_client()*
Parameters: ~
{cmd} (table|string|fun(dispatchers: table):table)
- command string or list treated like |jobstart|.
+ command string or list treated like |jobstart()|.
The command must launch the language server
process. `cmd` can also be a function that
creates an RPC client. The function receives a
dispatchers table and must return a table with
the functions `request`, `notify`, `is_closing`
- and `terminate` See |vim.lsp.rpc.request| and
- |vim.lsp.rpc.notify| For TCP there is a built-in
- rpc client factory: |vim.lsp.rpc.connect|
+ and `terminate` See |vim.lsp.rpc.request()| and
+ |vim.lsp.rpc.notify()| For TCP there is a
+ built-in rpc client factory:
+ |vim.lsp.rpc.connect()|
{cmd_cwd} (string, default=|getcwd()|) Directory to launch
the `cmd` process. Not related to `root_dir`.
{cmd_env} (table) Environment flags to pass to the LSP on
@@ -900,7 +902,7 @@ start_client({config}) *vim.lsp.start_client()*
when the client operation throws an error. `code`
is a number describing the error. Other arguments
may be passed depending on the error kind. See
- |vim.lsp.rpc.client_errors| for possible errors.
+ `vim.lsp.rpc.client_errors` for possible errors.
Use `vim.lsp.rpc.client_errors[code]` to get
human-friendly name.
{before_init} Callback with parameters (initialize_params,
@@ -945,9 +947,9 @@ start_client({config}) *vim.lsp.start_client()*
debounce occurs if nil
• exit_timeout (number|boolean, default false):
Milliseconds to wait for server to exit cleanly
- after sending the 'shutdown' request before
+ after sending the "shutdown" request before
sending kill -15. If set to false, nvim exits
- immediately after sending the 'shutdown'
+ immediately after sending the "shutdown"
request to the server.
{root_dir} (string) Directory where the LSP server will base
its workspaceFolders, rootUri, and rootPath on
@@ -1047,7 +1049,7 @@ completion({context}) *vim.lsp.buf.completion()*
character, if applicable)
See also: ~
- |vim.lsp.protocol.constants.CompletionTriggerKind|
+ vim.lsp.protocol.constants.CompletionTriggerKind
declaration({options}) *vim.lsp.buf.declaration()*
Jumps to the declaration of the symbol under the cursor.
@@ -1084,7 +1086,8 @@ document_highlight() *vim.lsp.buf.document_highlight()*
Note: Usage of |vim.lsp.buf.document_highlight()| requires the following
highlight groups to be defined or you won't be able to see the actual
- highlights. |LspReferenceText| |LspReferenceRead| |LspReferenceWrite|
+ highlights. |hl-LspReferenceText| |hl-LspReferenceRead|
+ |hl-LspReferenceWrite|
document_symbol({options}) *vim.lsp.buf.document_symbol()*
Lists all symbols in the current buffer in the quickfix window.
@@ -1193,7 +1196,7 @@ formatting_sync({options}, {timeout_ms})
{timeout_ms} (number) Request timeout
See also: ~
- |vim.lsp.buf.formatting_seq_sync|
+ |vim.lsp.buf.format()|
hover() *vim.lsp.buf.hover()*
Displays hover information about the symbol under the cursor in a floating
@@ -1211,7 +1214,7 @@ implementation({options}) *vim.lsp.buf.implementation()*
incoming_calls() *vim.lsp.buf.incoming_calls()*
Lists all the call sites of the symbol under the cursor in the |quickfix|
window. If the symbol can resolve to multiple items, the user can pick one
- in the |inputlist|.
+ in the |inputlist()|.
list_workspace_folders() *vim.lsp.buf.list_workspace_folders()*
List workspace folders.
@@ -1219,7 +1222,7 @@ list_workspace_folders() *vim.lsp.buf.list_workspace_folders()*
outgoing_calls() *vim.lsp.buf.outgoing_calls()*
Lists all the items that are called by the symbol under the cursor in the
|quickfix| window. If the symbol can resolve to multiple items, the user
- can pick one in the |inputlist|.
+ can pick one in the |inputlist()|.
*vim.lsp.buf.range_code_action()*
range_code_action({context}, {start_pos}, {end_pos})
@@ -1434,7 +1437,7 @@ signature_help({_}, {result}, {ctx}, {config})
{config} (table) Configuration table.
• border: (default=nil)
• Add borders to the floating window
- • See |vim.api.nvim_open_win()|
+ • See |nvim_open_win()|
==============================================================================
@@ -1565,7 +1568,7 @@ get_effective_tabstop({bufnr}) *vim.lsp.util.get_effective_tabstop()*
(number) indentation size
See also: ~
- |shiftwidth|
+ 'shiftwidth'
*vim.lsp.util.jump_to_location()*
jump_to_location({location}, {offset_encoding}, {reuse_win})
@@ -1722,7 +1725,7 @@ open_floating_preview({contents}, {syntax}, {opts})
{contents} (table) of lines to show in window
{syntax} (string) of syntax to set for opened buffer
{opts} (table) with optional fields (additional keys are passed
- on to |vim.api.nvim_open_win()|)
+ on to |nvim_open_win()|)
• height: (number) height of floating window
• width: (number) width of floating window
• wrap: (boolean, default true) wrap long lines
@@ -1859,7 +1862,7 @@ try_trim_markdown_code_blocks({lines})
{lines} (table) list of lines
Return: ~
- (string) filetype or 'markdown' if it was unchanged.
+ (string) filetype or "markdown" if it was unchanged.
==============================================================================
@@ -1964,7 +1967,7 @@ start({cmd}, {cmd_args}, {dispatchers}, {extra_spawn_params})
Starts an LSP server process and create an LSP RPC client object to
interact with it. Communication with the spawned process happens via
stdio. For communication via TCP, spawn a process manually and use
- |vim.lsp.rpc.connect|
+ |vim.lsp.rpc.connect()|
Parameters: ~
{cmd} (string) Command to start the LSP server.
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index 88547edfe5..3026476ab9 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -285,7 +285,7 @@ These commands execute a Lua chunk from either the command line (:lua, :luado)
or a file (:luafile) on the given line [range]. As always in Lua, each chunk
has its own scope (closure), so only global variables are shared between
command calls. The |lua-stdlib| modules, user modules, and anything else on
-|lua-package-path| are available.
+|package.path| are available.
The Lua print() function redirects its output to the Nvim message area, with
arguments separated by " " (space) instead of "\t" (tab).
@@ -617,7 +617,7 @@ A subset of the `vim.*` API is available in threads. This includes:
- `vim.loop` with a separate event loop per thread.
- `vim.mpack` and `vim.json` (useful for serializing messages between threads)
-- `require` in threads can use lua packages from the global |lua-package-path|
+- `require` in threads can use lua packages from the global |package.path|
- `print()` and `vim.inspect`
- `vim.diff`
- most utility functions in `vim.*` for working with pure lua values
@@ -663,7 +663,7 @@ vim.highlight.range({bufnr}, {ns}, {hlgroup}, {start}, {finish}, {opts})
{finish} finish position (tuple {line,col})
{opts} optional parameters:
• `regtype`: type of range (characterwise, linewise,
- or blockwise, see |setreg|), default `'v'`
+ or blockwise, see |setreg()|), default `'v'`
• `inclusive`: range includes end position,
default `false`
• `priority`: priority of highlight, default
@@ -906,7 +906,7 @@ vim.defer_fn({fn}, {timeout}) *vim.defer_fn*
Defers calling {fn} until {timeout} ms passes. Use to do a one-shot timer
that calls {fn}.
- Note: The {fn} is |schedule_wrap|ped automatically, so API functions are
+ Note: The {fn} is |vim.schedule_wrap()|ped automatically, so API functions are
safe to call.
Parameters: ~
@@ -978,6 +978,12 @@ vim.ui_attach({ns}, {options}, {callback}) *vim.ui_attach()*
{callback} receives event name plus additional parameters. See |ui-popupmenu|
and the sections below for event format for respective events.
+ WARNING: This api is considered experimental. Usability will vary for
+ different screen elements. In particular `ext_messages` behavior is subject
+ to further changes and usability improvements. This is expected to be
+ used to handle messages when setting 'cmdheight' to zero (which is
+ likewise experimental).
+
Example (stub for a |ui-popupmenu| implementation): >
ns = vim.api.nvim_create_namespace('my_fancy_pum')
@@ -1160,7 +1166,7 @@ window-scoped options. Note that this must NOT be confused with
global value of a |global-local| option, see |:setglobal|.
vim.o *vim.o*
- Get or set an |option|. Like `:set`. Invalid key is an error.
+ Get or set |options|. Like `:set`. Invalid key is an error.
Note: this works on both buffer-scoped and window-scoped options using the
current buffer and window.
@@ -1171,7 +1177,7 @@ vim.o *vim.o*
print(vim.o.foo) -- error: invalid key
<
vim.go *vim.go*
- Get or set a global |option|. Like `:setglobal`. Invalid key is
+ Get or set global |options|. Like `:setglobal`. Invalid key is
an error.
Note: this is different from |vim.o| because this accesses the global
@@ -1260,7 +1266,7 @@ offers object-oriented method for adding and removing entries.
Note that |vim.opt| returns an `Option` object, not the value of the option,
-which is accessed through |Option:get()|:
+which is accessed through |vim.opt:get()|:
Examples: ~
@@ -1275,8 +1281,8 @@ which is accessed through |Option:get()|:
`vim.pretty_print(vim.opt.wildignore:get())`
-In any of the above examples, to replicate the behavior |setlocal|, use
-`vim.opt_local`. Additionally, to replicate the behavior of |setglobal|, use
+In any of the above examples, to replicate the behavior |:setlocal|, use
+`vim.opt_local`. Additionally, to replicate the behavior of |:setglobal|, use
`vim.opt_global`.
@@ -1406,8 +1412,8 @@ connection_failure_errmsg({consequence})
defer_fn({fn}, {timeout}) *vim.defer_fn()*
Defers calling `fn` until `timeout` ms passes.
- Use to do a one-shot timer that calls `fn` Note: The {fn} is |schedule_wrap|ped automatically, so API functions are
- safe to call.
+ Use to do a one-shot timer that calls `fn` Note: The {fn} is |vim.schedule_wrap()|ped automatically, so API functions
+ are safe to call.
Parameters: ~
{fn} Callback to call once `timeout` expires
@@ -1541,7 +1547,7 @@ region({bufnr}, {pos1}, {pos2}, {regtype}, {inclusive}) *vim.region()*
{bufnr} (number) of buffer
{pos1} (line, column) tuple marking beginning of region
{pos2} (line, column) tuple marking end of region
- {regtype} type of selection (:help setreg)
+ {regtype} type of selection, see |setreg()|
{inclusive} (boolean) indicating whether the selection is
end-inclusive
@@ -1773,7 +1779,7 @@ tbl_deep_extend({behavior}, {...}) *vim.tbl_deep_extend()*
(table) Merged table
See also: ~
- |tbl_extend()|
+ |vim.tbl_extend()|
tbl_extend({behavior}, {...}) *vim.tbl_extend()*
Merges two or more map-like tables.
diff --git a/runtime/doc/luaref.txt b/runtime/doc/luaref.txt
index 9dbd2d4de5..0b04005e1a 100644
--- a/runtime/doc/luaref.txt
+++ b/runtime/doc/luaref.txt
@@ -20,72 +20,7 @@
See |luaref-copyright| for copyright and licenses.
- CONTENTS
- ============
-
- 1 INTRODUCTION........................|luaref-intro|
-
- 2 THE LANGUAGE........................|luaref-language|
- 2.1 Lexical Conventions...............|luaref-langLexConv|
- 2.2 Values and Types..................|luaref-langValTypes|
- 2.2.1 Coercion........................|luaref-langCoercion|
- 2.3 Variables.........................|luaref-langVariables|
- 2.4 Statements........................|luaref-langStats|
- 2.4.1 Chunks..........................|luaref-langChunks|
- 2.4.2 Blocks..........................|luaref-langBlocks|
- 2.4.3 Assignment......................|luaref-langAssign|
- 2.4.4 Control Structures..............|luaref-langContStructs|
- 2.4.5 For Statement...................|luaref-langForStat|
- 2.4.6 Function Calls as Statements....|luaref-langFuncStat|
- 2.4.7 Local Declarations..............|luaref-langLocalDec|
- 2.5 Expressions.......................|luaref-langExpressions|
- 2.5.1 Arithmetic Operators............|luaref-langArithOp|
- 2.5.2 Relational Operators............|luaref-langRelOp|
- 2.5.3 Logical Operators...............|luaref-langLogOp|
- 2.5.4 Concatenation...................|luaref-langConcat|
- 2.5.5 The Length Operator.............|luaref-langLength|
- 2.5.6 Precedence......................|luaref-langPrec|
- 2.5.7 Table Constructors..............|luaref-langTableConst|
- 2.5.8 Function Calls..................|luaref-langFuncCalls|
- 2.5.9 Function Definitions............|luaref-langFuncDefs|
- 2.6 Visibility Rules..................|luaref-langVisibRules|
- 2.7 Error Handling....................|luaref-langError|
- 2.8 Metatables........................|luaref-langMetatables|
- 2.9 Environments......................|luaref-langEnvironments|
- 2.10 Garbage Collection...............|luaref-langGC|
- 2.10.1 Garbage-Collection Metamethods.|luaref-langGCMeta|
- 2.10.2 Weak Tables....................|luaref-langWeaktables|
- 2.11 Coroutines.......................|luaref-langCoro|
-
- 3 THE APPLICATION PROGRAM INTERFACE...|luaref-api|
- 3.1 The Stack.........................|luaref-apiStack|
- 3.2 Stack Size........................|luaref-apiStackSize|
- 3.3 Pseudo-Indices....................|luaref-apiPseudoIndices|
- 3.4 C Closures........................|luaref-apiCClosures|
- 3.5 Registry..........................|luaref-apiRegistry|
- 3.6 Error Handling in C...............|luaref-apiError|
- 3.7 Functions and Types...............|luaref-apiFunctions|
- 3.8 The Debug Interface...............|luaref-apiDebug|
-
- 4 THE AUXILIARY LIBRARY...............|luaref-aux|
- 4.1 Functions and Types...............|luaref-auxFunctions|
-
- 5 STANDARD LIBRARIES..................|luaref-lib|
- 5.1 Basic Functions...................|luaref-libBasic|
- 5.2 Coroutine Manipulation............|luaref-libCoro|
- 5.3 Modules...........................|luaref-libModule|
- 5.4 String Manipulation...............|luaref-libString|
- 5.4.1 Patterns........................|luaref-libStringPat|
- 5.5 Table Manipulation................|luaref-libTable|
- 5.6 Mathematical Functions............|luaref-libMath|
- 5.7 Input and Output Facilities.......|luaref-libIO|
- 5.8 Operating System Facilities.......|luaref-libOS|
- 5.9 The Debug Library.................|luaref-libDebug|
-
- A BIBLIOGRAPHY........................|luaref-bibliography|
- B COPYRIGHT & LICENSES................|luaref-copyright|
- C LUAREF DOC..........................|luaref-doc|
-
+Type |gO| to see the table of contents.
==============================================================================
1 INTRODUCTION *luaref-intro*
@@ -120,7 +55,6 @@ Lua means "moon" in Portuguese and is pronounced LOO-ah.
==============================================================================
2 THE LANGUAGE *luaref-language*
-==============================================================================
This section describes the lexis, the syntax, and the semantics of Lua. In
other words, this section describes which tokens are valid, how they can be
@@ -292,7 +226,7 @@ parameter passing, and function returns always manipulate references to such
values; these operations do not imply any kind of copy.
The library function `type` returns a string describing the type of a given
-value (see |luaref-type|).
+value (see |luaref-type()|).
------------------------------------------------------------------------------
2.2.1 Coercion *luaref-langCoercion*
@@ -303,7 +237,7 @@ string to a number, following the usual conversion rules. Conversely, whenever
a number is used where a string is expected, the number is converted to a
string, in a reasonable format. For complete control of how numbers are
converted to strings, use the `format` function from the string library (see
-|luaref-string.format|).
+|string.format()|).
==============================================================================
2.3 Variables *luaref-langVariables*
@@ -344,7 +278,7 @@ has its own reference to an environment, so that all global variables in this
function will refer to this environment table. When a function is created, it
inherits the environment from the function that created it. To get the
environment table of a Lua function, you call `getfenv` (see
-|luaref-getfenv|). To replace it, you call `setfenv` (see |luaref-setfenv|).
+|lua_getfenv()|). To replace it, you call `setfenv` (see |luaref-setfenv()|).
(You can only manipulate the environment of C functions through the debug
library; see |luaref-libDebug|.)
@@ -515,21 +449,22 @@ through an arithmetic progression. It has the following syntax:
<
The `block` is repeated for `name` starting at the value of the first `exp`, until
it passes the second `exp` by steps of the third `exp`. More precisely,
-a `for` statement like
+a `for` statement like >
- `for var =` `e1, e2, e3` `do` `block` `end`
+ for var = e1, e2, e3 do block end
-is equivalent to the code:
+< is equivalent to the code: >
- `do`
- `local` `var, limit, step` `= tonumber(e1), tonumber(e2), tonumber(e3)`
- `if not (` `var` `and` `limit` `and` `step` `) then error() end`
- `while (` `step` `>0 and` `var` `<=` `limit` `)`
- `or (` `step` `<=0 and` `var` `>=` `limit` `) do`
- `block`
- `var` `=` `var` `+` `step`
- `end`
- `end`
+ do
+ local var, limit, step = tonumber(e1), tonumber(e2), tonumber(e3)
+ if not ( var and limit and step ) then error() end
+ while ( step >0 and var <= limit )
+ or ( step <=0 and var >= limit ) do
+ block
+ var = var + step
+ end
+ end
+<
Note the following:
@@ -555,18 +490,18 @@ A `for` statement like
`for` `var1, ..., varn` `in` `explist` `do` `block` `end`
-is equivalent to the code:
-
- `do`
- `local` `f, s, var` `=` `explist`
- `while true do`
- `local` `var1, ..., varn` `=` `f(s, var)`
- `var` `=` `var1`
- `if` `var` `== nil then break end`
- `block`
- `end`
- `end`
+is equivalent to the code: >
+ do
+ local f, s, var = explist
+ while true do
+ local var1, ..., varn = f(s, var)
+ var = var1
+ if var == nil then break end
+ block
+ end
+ end
+<
Note the following:
- `explist` is evaluated only once. Its results are an iterator function,
@@ -634,7 +569,7 @@ they are explained in |luaref-langFuncDefs|.
Binary operators comprise arithmetic operators (see |luaref-langArithOp|),
relational operators (see |luaref-langRelOp|), logical operators (see
|luaref-langLogOp|), and the concatenation operator (see |luaref-langConcat|).
-Unary operators comprise the unary minus (see |luaref-labgArithOp|), the unary
+Unary operators comprise the unary minus (see |luaref-langArithOp|), the unary
`not` (see |luaref-langLogOp|), and the unary length operator (see
|luaref-langLength|).
@@ -1050,13 +985,13 @@ them share the same `x`.
Because Lua is an embedded extension language, all Lua actions start from
C code in the host program calling a function from the Lua library (see
-|luaref-lua_pcall|). Whenever an error occurs during Lua compilation or
+|lua_pcall()|). Whenever an error occurs during Lua compilation or
execution, control returns to C, which can take appropriate measures (such as
print an error message).
Lua code can explicitly generate an error by calling the `error` function (see
-|luaref-error|). If you need to catch errors in Lua, you can use
-the `pcall` function (see |luaref-pcall|).
+|luaref-error()|). If you need to catch errors in Lua, you can use
+the `pcall` function (see |luaref-pcall()|).
==============================================================================
2.8 Metatables *luaref-metatable* *luaref-langMetatables*
@@ -1074,10 +1009,10 @@ previous example, the event is "add" and the metamethod is the function that
performs the addition.
You can query the metatable of any value through the `getmetatable` function
-(see |luaref-getmetatable|).
+(see |luaref-getmetatable()|).
You can replace the metatable of tables through the `setmetatable` function (see
-|luaref-setmetatable|). You cannot change the metatable of other types from Lua
+|luaref-setmetatable()|). You cannot change the metatable of other types from Lua
(except using the debug library); you must use the C API for that.
Tables and userdata have individual metatables (although multiple tables and
@@ -1385,8 +1320,8 @@ convenience feature for programmers to associate a table to a userdata.
Environments associated with threads are called global environments. They are
used as the default environment for their threads and non-nested functions
-created by the thread (through `loadfile` |luaref-loadfile|, `loadstring`
-|luaref-loadstring| or `load` |luaref-load|) and can be directly accessed by C
+created by the thread (through `loadfile` |luaref-loadfile()|, `loadstring`
+|luaref-loadstring()| or `load` |luaref-load()|) and can be directly accessed by C
code (see |luaref-apiPseudoIndices|).
Environments associated with C functions can be directly accessed by C code
@@ -1399,10 +1334,10 @@ used as the default environment for other Lua functions created by the
function.
You can change the environment of a Lua function or the running thread by
-calling `setfenv` (see |luaref-setenv|). You can get the environment of a Lua
-function or the running thread by calling `getfenv` (see |luaref-getfenv|). To
-manipulate the environment of other objects (userdata, C functions, other
-threads) you must use the C API.
+calling `setfenv`. You can get the environment of a Lua function or the
+running thread by calling `getfenv` (see |lua_getfenv()|). To manipulate the
+environment of other objects (userdata, C functions, other threads) you must
+use the C API.
==============================================================================
2.10 Garbage Collection *luaref-langGC*
@@ -1432,8 +1367,8 @@ collector too slow and may result in the collector never finishing a cycle.
The default, 2, means that the collector runs at "twice" the speed of memory
allocation.
-You can change these numbers by calling `lua_gc` (see |luaref-lua_gc|) in C or
-`collectgarbage` (see |luaref-collectgarbage|) in Lua. Both get percentage
+You can change these numbers by calling `lua_gc` (see |lua_gc()|) in C or
+`collectgarbage` (see |luaref-collectgarbage()|) in Lua. Both get percentage
points as arguments (so an argument of 100 means a real value of 1). With
these functions you can also control the collector directly (e.g., stop and
restart it).
@@ -1496,12 +1431,12 @@ multithread systems, however, a coroutine only suspends its execution by
explicitly calling a yield function.
You create a coroutine with a call to `coroutine.create` (see
-|luaref-coroutine.create|). Its sole argument is a function that is the main
+|coroutine.create()|). Its sole argument is a function that is the main
function of the coroutine. The `create` function only creates a new coroutine
and returns a handle to it (an object of type `thread`); it does not start the
coroutine execution.
-When you first call `coroutine.resume` (see |luaref-coroutine.resume|),
+When you first call `coroutine.resume` (see |coroutine.resume()|),
passing as its first argument the thread returned by `coroutine.create`, the
coroutine starts its execution, at the first line of its main function. Extra
arguments passed to `coroutine.resume` are passed on to the coroutine main
@@ -1516,7 +1451,7 @@ main function. In case of errors, `coroutine.resume` returns `false` plus an
error message.
A coroutine yields by calling `coroutine.yield` (see
-|luaref-coroutine.yield|). When a coroutine yields, the corresponding
+|coroutine.yield()|). When a coroutine yields, the corresponding
`coroutine.resume` returns immediately, even if the yield happens inside
nested function calls (that is, not in the main function, but in a function
directly or indirectly called by the main function). In the case of a yield,
@@ -1526,7 +1461,7 @@ its execution from the point where it yielded, with the call to
`coroutine.yield` returning any extra arguments passed to `coroutine.resume`.
Like `coroutine.create`, the `coroutine.wrap` function (see
-|luaref-coroutine.wrap|) also creates a coroutine, but instead of returning
+|coroutine.wrap()|) also creates a coroutine, but instead of returning
the coroutine itself, it returns a function that, when called, resumes the
coroutine. Any arguments passed to this function go as extra arguments to
`coroutine.resume`. `coroutine.wrap` returns all the values returned by
@@ -1595,7 +1530,7 @@ Whenever Lua calls C, the called function gets a new stack, which is
independent of previous stacks and of stacks of C functions that are still
active. This stack initially contains any arguments to the C function and it
is where the C function pushes its results to be returned to the caller (see
-|luaref-lua_CFunction|).
+|lua_CFunction()|).
*luaref-stackindex*
For convenience, most query operations in the API do not follow a strict stack
@@ -1615,7 +1550,7 @@ if `1 <= abs(index) <= top`).
When you interact with Lua API, you are responsible for ensuring consistency.
In particular, you are responsible for controlling stack overflow. You can
use the function `lua_checkstack` to grow the stack size (see
-|luaref-lua_checkstack|).
+|lua_checkstack()|).
Whenever Lua calls C, it ensures that at least `LUA_MINSTACK` stack positions
are available. `LUA_MINSTACK` is defined as 20, so that usually you do not
@@ -1656,14 +1591,14 @@ global variable, do
When a C function is created, it is possible to associate some values with it,
thus creating a C closure; these values are called upvalues and are accessible
-to the function whenever it is called (see |luaref-lua_pushcclosure|).
+to the function whenever it is called (see |lua_pushcclosure()|).
Whenever a C function is called, its upvalues are located at specific
pseudo-indices. These pseudo-indices are produced by the macro
-`lua_upvalueindex` (see |luaref-lua_upvalueindex|). The first value associated
-with a function is at position `lua_upvalueindex(1)`, and so on. Any access to
-`lua_upvalueindex(` `n` `)`, where `n` is greater than the number of upvalues of
-the current function, produces an acceptable (but invalid) index.
+`lua_upvalueindex`. The first value associated with a function is at position
+`lua_upvalueindex(1)`, and so on. Any access to `lua_upvalueindex(` `n` `)`,
+where `n` is greater than the number of upvalues of the current function,
+produces an acceptable (but invalid) index.
==============================================================================
3.5 Registry *luaref-registry* *luaref-apiRegistry*
@@ -1694,11 +1629,11 @@ Almost any function in the API may raise an error, for instance due to a
memory allocation error. The following functions run in protected mode (that
is, they create a protected environment to run), so they never raise an error:
`lua_newstate`, `lua_close`, `lua_load`, `lua_pcall`, and `lua_cpcall` (see
-|luaref-lua_newstate|, |luaref-lua_close|, |luaref-lua_load|,
-|luaref-lua_pcall|, and |luaref-lua_cpcall|).
+|lua_newstate()|, |lua_close()|, |lua_load()|,
+|lua_pcall()|, and |lua_cpcall()|).
Inside a C function you can raise an error by calling `lua_error` (see
-|luaref-lua_error|).
+|lua_error()|).
==============================================================================
3.7 Functions and Types *luaref-apiFunctions*
@@ -1715,7 +1650,7 @@ lua_Alloc *lua_Alloc()*
The type of the memory-allocation function used by Lua states. The
allocator function must provide a functionality similar to `realloc`,
but not exactly the same. Its arguments are `ud`, an opaque pointer
- passed to `lua_newstate` (see |luaref-lua_newstate|); `ptr`, a pointer
+ passed to `lua_newstate` (see |lua_newstate()|); `ptr`, a pointer
to the block being allocated/reallocated/freed; `osize`, the original
size of the block; `nsize`, the new size of the block. `ptr` is `NULL`
if and only if `osize` is zero. When `nsize` is zero, the allocator
@@ -1729,7 +1664,7 @@ lua_Alloc *lua_Alloc()*
Here is a simple implementation for the allocator function. It is used
in the auxiliary library by `luaL_newstate` (see
- |luaref-luaL_newstate|).
+ |luaL_newstate()|).
>
static void *l_alloc (void *ud, void *ptr, size_t osize,
size_t nsize) {
@@ -1813,7 +1748,7 @@ lua_CFunction *luaref-cfunction* *lua_CFunction()*
following protocol, which defines the way parameters and results are
passed: a C function receives its arguments from Lua in its stack in
direct order (the first argument is pushed first). So, when the
- function starts, `lua_gettop(L)` (see |luaref-lua_gettop|) returns the
+ function starts, `lua_gettop(L)` (see |lua_gettop()|) returns the
number of arguments received by the function. The first argument (if
any) is at index 1 and its last argument is at index `lua_gettop(L)`.
To return values to Lua, a C function just pushes them onto the stack,
@@ -1881,7 +1816,7 @@ lua_cpcall *lua_cpcall()*
Calls the C function `func` in protected mode. `func` starts with only
one element in its stack, a light userdata containing `ud`. In case of
errors, `lua_cpcall` returns the same error codes as `lua_pcall` (see
- |luaref-lua_pcall|), plus the error object on the top of the stack;
+ |lua_pcall()|), plus the error object on the top of the stack;
otherwise, it returns zero, and does not change the stack. All values
returned by `func` are discarded.
@@ -1893,7 +1828,7 @@ lua_createtable *lua_createtable()*
has space pre-allocated for `narr` array elements and `nrec` non-array
elements. This pre-allocation is useful when you know exactly how many
elements the table will have. Otherwise you can use the function
- `lua_newtable` (see |luaref-lua_newtable|).
+ `lua_newtable` (see |lua_newtable()|).
lua_dump *lua_dump()*
>
@@ -1903,7 +1838,7 @@ lua_dump *lua_dump()*
of the stack and produces a binary chunk that, if loaded again,
results in a function equivalent to the one dumped. As it produces
parts of the chunk, `lua_dump` calls function `writer` (see
- |luaref-lua_Writer|) with the given `data` to write them.
+ |lua_Writer()|) with the given `data` to write them.
The value returned is the error code returned by the last call to the
writer; 0 means no errors.
@@ -1925,7 +1860,7 @@ lua_error *lua_error()*
<
Generates a Lua error. The error message (which can actually be a Lua
value of any type) must be on the stack top. This function does a long
- jump, and therefore never returns (see |luaref-luaL_error|).
+ jump, and therefore never returns (see |luaL_error()|).
lua_gc *lua_gc()*
>
@@ -1936,25 +1871,25 @@ lua_gc *lua_gc()*
This function performs several tasks, according to the value of the
parameter `what`:
- `LUA_GCSTOP` stops the garbage collector.
- `LUA_GCRESTART` restarts the garbage collector.
- `LUA_GCCOLLECT` performs a full garbage-collection cycle.
- `LUA_GCCOUNT` returns the current amount of memory (in Kbytes) in
+ - `LUA_GCSTOP` stops the garbage collector.
+ - `LUA_GCRESTART` restarts the garbage collector.
+ - `LUA_GCCOLLECT` performs a full garbage-collection cycle.
+ - `LUA_GCCOUNT` returns the current amount of memory (in Kbytes) in
use by Lua.
- `LUA_GCCOUNTB` returns the remainder of dividing the current
+ - `LUA_GCCOUNTB` returns the remainder of dividing the current
amount of bytes of memory in use by Lua by 1024.
- `LUA_GCSTEP` performs an incremental step of garbage collection.
+ - `LUA_GCSTEP` performs an incremental step of garbage collection.
The step "size" is controlled by `data` (larger
values mean more steps) in a non-specified way. If
you want to control the step size you must
experimentally tune the value of `data`. The
function returns 1 if the step finished a
garbage-collection cycle.
- `LUA_GCSETPAUSE` sets `data` /100 as the new value for the
+ - `LUA_GCSETPAUSE` sets `data` /100 as the new value for the
`pause` of the collector (see |luaref-langGC|).
The function returns the previous value of the
pause.
- `LUA_GCSETSTEPMUL` sets `data` /100 as the new value for the
+ - `LUA_GCSETSTEPMUL`sets `data` /100 as the new value for the
`step` `multiplier` of the collector (see
|luaref-langGC|). The function returns the
previous value of the step multiplier.
@@ -1965,7 +1900,7 @@ lua_getallocf *lua_getallocf()*
<
Returns the memory-allocation function of a given state. If `ud` is
not `NULL`, Lua stores in `*ud` the opaque pointer passed to
- `lua_newstate` (see |luaref-lua_newstate|).
+ `lua_newstate` (see |lua_newstate()|).
lua_getfenv *lua_getfenv()*
>
@@ -2136,10 +2071,10 @@ lua_load *lua_load()*
This function only loads a chunk; it does not run it.
`lua_load` automatically detects whether the chunk is text or binary,
- and loads it accordingly (see program `luac`, |luaref-luac|).
+ and loads it accordingly (see program `luac`).
The `lua_load` function uses a user-supplied `reader` function to read
- the chunk (see |luaref-lua_Reader|). The `data` argument is an opaque
+ the chunk (see |lua_Reader()|). The `data` argument is an opaque
value passed to the reader function.
The `chunkname` argument gives a name to the chunk, which is used for
@@ -2161,14 +2096,14 @@ lua_newtable *lua_newtable()*
<
Creates a new empty table and pushes it onto the stack. It is
equivalent to `lua_createtable(L, 0, 0)` (see
- |luaref-lua_createtable|).
+ |lua_createtable()|).
lua_newthread *lua_newthread()*
>
lua_State *lua_newthread (lua_State *L);
<
Creates a new thread, pushes it on the stack, and returns a pointer to
- a `lua_State` (see |luaref-lua_State|) that represents this new
+ a `lua_State` (see |lua_State()|) that represents this new
thread. The new state returned by this function shares with the
original state all global objects (such as tables), but has an
independent execution stack.
@@ -2218,7 +2153,7 @@ lua_next *lua_next()*
}
<
While traversing a table, do not call `lua_tolstring` (see
- |luaref-lua_tolstring|) directly on a key, unless you know that the
+ |lua_tolstring()|) directly on a key, unless you know that the
key is actually a string. Recall that `lua_tolstring` `changes` the
value at the given index; this confuses the next call to `lua_next`.
@@ -2248,7 +2183,7 @@ lua_pcall *lua_pcall()*
Calls a function in protected mode.
Both `nargs` and `nresults` have the same meaning as in `lua_call`
- (see |luaref-lua_call|). If there are no errors during the call,
+ (see |lua_call()|). If there are no errors during the call,
`lua_pcall` behaves exactly like `lua_call`. However, if there is any
error, `lua_pcall` catches it, pushes a single value on the stack (the
error message), and returns an error code. Like `lua_call`,
@@ -2314,7 +2249,7 @@ lua_pushcfunction *lua_pushcfunction()*
Any function to be registered in Lua must follow the correct protocol
to receive its parameters and return its results (see
- |luaref-lua_CFunction|).
+ |lua_CFunction()|).
`lua_pushcfunction` is defined as a macro:
>
@@ -2408,7 +2343,7 @@ lua_pushvfstring *lua_pushvfstring()*
const char *fmt,
va_list argp);
<
- Equivalent to `lua_pushfstring` (see |luaref-pushfstring|), except
+ Equivalent to `lua_pushfstring` (see |lua_pushfstring()|), except
that it receives a `va_list` instead of a variable number of
arguments.
@@ -2425,7 +2360,7 @@ lua_rawget *lua_rawget()*
>
void lua_rawget (lua_State *L, int index);
<
- Similar to `lua_gettable` (see |luaref-lua_gettable|), but does a raw
+ Similar to `lua_gettable` (see |lua_gettable()|), but does a raw
access (i.e., without metamethods).
lua_rawgeti *lua_rawgeti()*
@@ -2440,7 +2375,7 @@ lua_rawset *lua_rawset()*
>
void lua_rawset (lua_State *L, int index);
<
- Similar to `lua_settable` (see |luaref-lua_settable|), but does a raw
+ Similar to `lua_settable` (see |lua_settable()|), but does a raw
assignment (i.e., without metamethods).
lua_rawseti *lua_rawseti()*
@@ -2459,7 +2394,7 @@ lua_Reader *lua_Reader()*
void *data,
size_t *size);
<
- The reader function used by `lua_load` (see |luaref-lua_load|). Every
+ The reader function used by `lua_load` (see |lua_load()|). Every
time it needs another piece of the chunk, `lua_load` calls the reader,
passing along its `data` parameter. The reader must return a pointer
to a block of memory with a new piece of the chunk and set `size` to
@@ -2504,15 +2439,15 @@ lua_resume *lua_resume()*
Starts and resumes a coroutine in a given thread.
To start a coroutine, you first create a new thread (see
- |luaref-lua_newthread|); then you push onto its stack the main
+ |lua_newthread()|); then you push onto its stack the main
function plus any arguments; then you call `lua_resume` (see
- |luaref-lua_resume|) with `narg` being the number of arguments. This
+ |lua_resume()|) with `narg` being the number of arguments. This
call returns when the coroutine suspends or finishes its execution.
When it returns, the stack contains all values passed to `lua_yield`
- (see |luaref-lua_yield|), or all values returned by the body function.
+ (see |lua_yield()|), or all values returned by the body function.
`lua_resume` returns `LUA_YIELD` if the coroutine yields, 0 if the
coroutine finishes its execution without errors, or an error code in
- case of errors (see |luaref-lua_pcall|). In case of errors, the stack
+ case of errors (see |lua_pcall()|). In case of errors, the stack
is not unwound, so you can use the debug API over it. The error
message is on the top of the stack. To restart a coroutine, you put on
its stack only the values to be passed as results from `lua_yield`,
@@ -2593,7 +2528,7 @@ lua_State *lua_State()*
A pointer to this state must be passed as the first argument to every
function in the library, except to `lua_newstate` (see
- |luaref-lua_newstate|), which creates a Lua state from scratch.
+ |lua_newstate()|), which creates a Lua state from scratch.
lua_status *lua_status()*
>
@@ -2614,7 +2549,7 @@ lua_toboolean *lua_toboolean()*
any Lua value different from `false` and `nil`; otherwise it returns
0. It also returns 0 when called with a non-valid index. (If you want
to accept only actual boolean values, use `lua_isboolean`
- |luaref-lua_isboolean| to test the value's type.)
+ |lua_isboolean()| to test the value's type.)
lua_tocfunction *lua_tocfunction()*
>
@@ -2628,7 +2563,7 @@ lua_tointeger *lua_tointeger()*
lua_Integer lua_tointeger (lua_State *L, int idx);
<
Converts the Lua value at the given acceptable index to the signed
- integral type `lua_Integer` (see |luaref-lua_Integer|). The Lua value
+ integral type `lua_Integer` (see |lua_Integer()|). The Lua value
must be a number or a string convertible to a number (see
|luaref-langCoercion|); otherwise, `lua_tointeger` returns 0.
@@ -2644,7 +2579,7 @@ lua_tolstring *lua_tolstring()*
Lua value must be a string or a number; otherwise, the function
returns `NULL`. If the value is a number, then `lua_tolstring` also
`changes the actual value in the stack to a` `string`. (This change
- confuses `lua_next` |luaref-lua_next| when `lua_tolstring` is applied
+ confuses `lua_next` |lua_next()| when `lua_tolstring` is applied
to keys during a table traversal.)
`lua_tolstring` returns a fully aligned pointer to a string inside the
@@ -2659,7 +2594,7 @@ lua_tonumber *lua_tonumber()*
lua_Number lua_tonumber (lua_State *L, int index);
<
Converts the Lua value at the given acceptable index to the C type
- `lua_Number` (see |luaref-lua_Number|). The Lua value must be a number
+ `lua_Number` (see |lua_Number()|). The Lua value must be a number
or a string convertible to a number (see |luaref-langCoercion|);
otherwise, `lua_tonumber` returns 0.
@@ -2679,7 +2614,7 @@ lua_tostring *lua_tostring()*
>
const char *lua_tostring (lua_State *L, int index);
<
- Equivalent to `lua_tolstring` (see |luaref-lua_tolstring|) with `len`
+ Equivalent to `lua_tolstring` (see |lua_tolstring()|) with `len`
equal to `NULL`.
lua_tothread *lua_tothread()*
@@ -2687,7 +2622,7 @@ lua_tothread *lua_tothread()*
lua_State *lua_tothread (lua_State *L, int index);
<
Converts the value at the given acceptable index to a Lua thread
- (represented as `lua_State*` |luaref-lua_State|). This value must be a
+ (represented as `lua_State*` |lua_State()|). This value must be a
thread; otherwise, the function returns `NULL`.
lua_touserdata *lua_touserdata()*
@@ -2723,7 +2658,7 @@ lua_Writer *lua_Writer()*
size_t sz,
void* ud);
<
- The writer function used by `lua_dump` (see |luaref-lua_dump|). Every
+ The writer function used by `lua_dump` (see |lua_dump()|). Every
time it produces another piece of chunk, `lua_dump` calls the writer,
passing along the buffer to be written (`p`), its size (`sz`), and the
`data` parameter supplied to `lua_dump`.
@@ -2753,7 +2688,7 @@ lua_yield *lua_yield()*
<
When a C function calls `lua_yield` in that way, the running coroutine
suspends its execution, and the call to `lua_resume` (see
- |luaref-lua_resume|) that started this coroutine returns. The
+ |lua_resume()|) that started this coroutine returns. The
parameter `nresults` is the number of values from the stack that are
passed as results to `lua_resume`.
@@ -2782,50 +2717,52 @@ need "inside information" from the interpreter.
lua_Debug *lua_Debug()*
- `typedef struct lua_Debug {`
- `int event;`
- `const char *name; /* (n) */`
- `const char *namewhat; /* (n) */`
- `const char *what; /* (S) */`
- `const char *source; /* (S) */`
- `int currentline; /* (l) */`
- `int nups; /* (u) number of upvalues */`
- `int linedefined; /* (S) */`
- `int lastlinedefined; /* (S) */`
- `char short_src[LUA_IDSIZE]; /* (S) */`
- `/* private part */`
- `other fields`
- `} lua_Debug;`
+>
+ typedef struct lua_Debug {
+ int event;
+ const char *name; /* (n) */
+ const char *namewhat; /* (n) */
+ const char *what; /* (S) */
+ const char *source; /* (S) */
+ int currentline; /* (l) */
+ int nups; /* (u) number of upvalues */
+ int linedefined; /* (S) */
+ int lastlinedefined; /* (S) */
+ char short_src[LUA_IDSIZE]; /* (S) */
+ /* private part */
+ other fields
+ } lua_Debug;
+<
A structure used to carry different pieces of information about an active
-function. `lua_getstack` (see |luaref-lua_getstack|) fills only the private part
+function. `lua_getstack` (see |lua_getstack()|) fills only the private part
of this structure, for later use. To fill the other fields of `lua_Debug` with
-useful information, call `lua_getinfo` (see |luaref-lua_getinfo|).
+useful information, call `lua_getinfo` (see |lua_getinfo()|).
The fields of `lua_Debug` have the following meaning:
- `source` If the function was defined in a string, then `source` is
+- `source` If the function was defined in a string, then `source` is
that string. If the function was defined in a file, then
`source` starts with a `@` followed by the file name.
- `short_src` a "printable" version of `source`, to be used in error messages.
- `linedefined` the line number where the definition of the function starts.
- `lastlinedefined` the line number where the definition of the function ends.
- `what` the string `"Lua"` if the function is a Lua function,
+- `short_src` a "printable" version of `source`, to be used in error messages.
+- `linedefined` the line number where the definition of the function starts.
+- `lastlinedefined` the line number where the definition of the function ends.
+- `what` the string `"Lua"` if the function is a Lua function,
`"C"` if it is a C function, `"main"` if it is the main
part of a chunk, and `"tail"` if it was a function that
did a tail call. In the latter case, Lua has no other
information about the function.
- `currentline` the current line where the given function is executing.
+- `currentline` the current line where the given function is executing.
When no line information is available, `currentline` is
set to -1.
- `name` a reasonable name for the given function. Because
+- `name` a reasonable name for the given function. Because
functions in Lua are first-class values, they do not have
a fixed name: some functions may be the value of multiple
global variables, while others may be stored only in a
table field. The `lua_getinfo` function checks how the
function was called to find a suitable name. If it cannot
find a name, then `name` is set to `NULL`.
- `namewhat` explains the `name` field. The value of `namewhat` can be
+- `namewhat` explains the `name` field. The value of `namewhat` can be
`"global"`, `"local"`, `"method"`, `"field"`,
`"upvalue"`, or `""` (the empty string), according to how
the function was called. (Lua uses the empty string when
@@ -2858,8 +2795,8 @@ lua_getinfo *lua_getinfo()*
To get information about a function invocation, the parameter `ar`
must be a valid activation record that was filled by a previous call
- to `lua_getstack` (see |luaref-lua_getstack|) or given as argument to
- a hook (see |luaref-lua_Hook|).
+ to `lua_getstack` (see |lua_getstack()|) or given as argument to
+ a hook (see |lua_Hook()|).
To get information about a function you push it onto the stack and
start the `what` string with the character `>`. (In that case,
@@ -2896,8 +2833,8 @@ lua_getlocal *lua_getlocal()*
<
Gets information about a local variable of a given activation record.
The parameter `ar` must be a valid activation record that was filled
- by a previous call to `lua_getstack` (see |luaref-lua_getstack|) or
- given as argument to a hook (see |luaref-lua_Hook|). The index `n`
+ by a previous call to `lua_getstack` (see |lua_getstack()|) or
+ given as argument to a hook (see |lua_Hook()|). The index `n`
selects which local variable to inspect (1 is the first parameter or
active local variable, and so on, until the last active local
variable). `lua_getlocal` pushes the variable's value onto the stack
@@ -2916,7 +2853,7 @@ lua_getstack *lua_getstack()*
<
Gets information about the interpreter runtime stack.
- This function fills parts of a `lua_Debug` (see |luaref-lua_Debug|)
+ This function fills parts of a `lua_Debug` (see |lua_Debug()|)
structure with an identification of the `activation record` of the
function executing at a given level. Level 0 is the current running
function, whereas level `n+1` is the function that has called level
@@ -2951,7 +2888,7 @@ lua_Hook *lua_Hook()*
`LUA_HOOKTAILRET`, `LUA_HOOKLINE`, and `LUA_HOOKCOUNT`. Moreover, for
line events, the field `currentline` is also set. To get the value of
any other field in `ar`, the hook must call `lua_getinfo` (see
- |luaref-lua_getinfo|). For return events, `event` may be
+ |lua_getinfo()|). For return events, `event` may be
`LUA_HOOKRET`, the normal value, or `LUA_HOOKTAILRET`. In the latter
case, Lua is simulating a return from a function that did a tail call;
in this case, it is useless to call `lua_getinfo`.
@@ -2996,7 +2933,7 @@ lua_setlocal *lua_setlocal()*
<
Sets the value of a local variable of a given activation record.
Parameters `ar` and `n` are as in `lua_getlocal` (see
- |luaref-lua_getlocal|). `lua_setlocal` assigns the value at the top of
+ |lua_getlocal()|). `lua_setlocal` assigns the value at the top of
the stack to the variable and returns its name. It also pops the value
from the stack.
@@ -3010,7 +2947,7 @@ lua_setupvalue *lua_setupvalue()*
Sets the value of a closure's upvalue. It assigns the value at the top
of the stack to the upvalue and returns its name. It also pops the
value from the stack. Parameters `funcindex` and `n` are as in the
- `lua_getupvalue` (see |luaref-lua_getupvalue|).
+ `lua_getupvalue` (see |lua_getupvalue()|).
Returns `NULL` (and pops nothing) when the index is greater than the
number of upvalues.
@@ -3071,36 +3008,36 @@ luaL_addchar *luaL_addchar()*
>
void luaL_addchar (luaL_Buffer *B, char c);
<
- Adds the character `c` to the buffer `B` (see |luaref-luaL_Buffer|).
+ Adds the character `c` to the buffer `B` (see |luaL_Buffer()|).
luaL_addlstring *luaL_addlstring()*
>
void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l);
<
Adds the string pointed to by `s` with length `l` to the buffer `B`
- (see |luaref-luaL_Buffer|). The string may contain embedded zeros.
+ (see |luaL_Buffer()|). The string may contain embedded zeros.
luaL_addsize *luaL_addsize()*
>
void luaL_addsize (luaL_Buffer *B, size_t n);
<
- Adds to the buffer `B` (see |luaref-luaL_Buffer|) a string of length
+ Adds to the buffer `B` (see |luaL_Buffer()|) a string of length
`n` previously copied to the buffer area (see
- |luaref-luaL_prepbuffer|).
+ |luaL_prepbuffer()|).
luaL_addstring *luaL_addstring()*
>
void luaL_addstring (luaL_Buffer *B, const char *s);
<
Adds the zero-terminated string pointed to by `s` to the buffer `B`
- (see |luaref-luaL_Buffer|). The string may not contain embedded zeros.
+ (see |luaL_Buffer()|). The string may not contain embedded zeros.
luaL_addvalue *luaL_addvalue()*
>
void luaL_addvalue (luaL_Buffer *B);
<
Adds the value at the top of the stack to the buffer `B` (see
- |luaref-luaL_Buffer|). Pops the value.
+ |luaL_Buffer()|). Pops the value.
This is the only function on string buffers that can (and must) be
called with an extra element on the stack, which is the value to be
@@ -3142,11 +3079,11 @@ luaL_Buffer *luaL_Buffer()*
- First you declare a variable `b` of type `luaL_Buffer`.
- Then you initialize it with a call `luaL_buffinit(L, &b)` (see
- |luaref-luaL_buffinit|).
+ |luaL_buffinit()|).
- Then you add string pieces to the buffer calling any of the
`luaL_add*` functions.
- You finish by calling `luaL_pushresult(&b)` (see
- |luaref-luaL_pushresult|). This call leaves the final string on the
+ |luaL_pushresult()|). This call leaves the final string on the
top of the stack.
During its normal operation, a string buffer uses a variable number of
@@ -3156,7 +3093,7 @@ luaL_Buffer *luaL_Buffer()*
that is, when you call a buffer operation, the stack is at the same
level it was immediately after the previous buffer operation. (The
only exception to this rule is `luaL_addvalue`
- |luaref-luaL_addvalue|.) After calling `luaL_pushresult` the stack is
+ |luaL_addvalue()|.) After calling `luaL_pushresult` the stack is
back to its level when the buffer was initialized, plus the final
string on its top.
@@ -3165,7 +3102,7 @@ luaL_buffinit *luaL_buffinit()*
void luaL_buffinit (lua_State *L, luaL_Buffer *B);
<
Initializes a buffer `B`. This function does not allocate any space;
- the buffer must be declared as a variable (see |luaref-luaL_Buffer|).
+ the buffer must be declared as a variable (see |luaL_Buffer()|).
luaL_callmeta *luaL_callmeta()*
>
@@ -3199,7 +3136,7 @@ luaL_checkinteger *luaL_checkinteger()*
lua_Integer luaL_checkinteger (lua_State *L, int narg);
<
Checks whether the function argument `narg` is a number and returns
- this number cast to a `lua_Integer` (see |luaref-lua_Integer|).
+ this number cast to a `lua_Integer` (see |lua_Integer()|).
luaL_checklong *luaL_checklong()*
>
@@ -3220,7 +3157,7 @@ luaL_checknumber *luaL_checknumber()*
lua_Number luaL_checknumber (lua_State *L, int narg);
<
Checks whether the function argument `narg` is a number and returns
- this number (see |luaref-lua_Number|).
+ this number (see |lua_Number()|).
luaL_checkoption *luaL_checkoption()*
>
@@ -3262,14 +3199,14 @@ luaL_checktype *luaL_checktype()*
void luaL_checktype (lua_State *L, int narg, int t);
<
Checks whether the function argument `narg` has type `t` (see
- |luaref-lua_type|).
+ |lua_type()|).
luaL_checkudata *luaL_checkudata()*
>
void *luaL_checkudata (lua_State *L, int narg, const char *tname);
<
Checks whether the function argument `narg` is a userdata of the type
- `tname` (see |luaref-luaL_newmetatable|).
+ `tname` (see |luaL_newmetatable()|).
luaL_dofile *luaL_dofile()*
>
@@ -3297,7 +3234,7 @@ luaL_error *luaL_error()*
<
Raises an error. The error message format is given by `fmt` plus any
extra arguments, following the same rules of `lua_pushfstring` (see
- |luaref-lua_pushfstring|). It also adds at the beginning of the
+ |lua_pushfstring()|). It also adds at the beginning of the
message the file name and the line number where the error occurred, if
this information is available.
@@ -3317,7 +3254,7 @@ luaL_getmetatable *luaL_getmetatable()*
void luaL_getmetatable (lua_State *L, const char *tname);
<
Pushes onto the stack the metatable associated with name `tname` in
- the registry (see |luaref-luaL_newmetatable|).
+ the registry (see |luaL_newmetatable()|).
luaL_gsub *luaL_gsub()*
>
@@ -3338,7 +3275,7 @@ luaL_loadbuffer *luaL_loadbuffer()*
const char *name);
<
Loads a buffer as a Lua chunk. This function uses `lua_load` (see
- |luaref-lua_load|) to load the chunk in the buffer pointed to by
+ |lua_load()|) to load the chunk in the buffer pointed to by
`buff` with size `sz`.
This function returns the same results as `lua_load`. `name` is the
@@ -3349,7 +3286,7 @@ luaL_loadfile *luaL_loadfile()*
int luaL_loadfile (lua_State *L, const char *filename);
<
Loads a file as a Lua chunk. This function uses `lua_load` (see
- |luaref-lua_load|) to load the chunk in the file named `filename`. If
+ |lua_load()|) to load the chunk in the file named `filename`. If
`filename` is `NULL`, then it loads from the standard input. The first
line in the file is ignored if it starts with a `#`.
@@ -3363,7 +3300,7 @@ luaL_loadstring *luaL_loadstring()*
int luaL_loadstring (lua_State *L, const char *s);
<
Loads a string as a Lua chunk. This function uses `lua_load` (see
- |luaref-lua_load|) to load the chunk in the zero-terminated string
+ |lua_load()|) to load the chunk in the zero-terminated string
`s`.
This function returns the same results as `lua_load`.
@@ -3387,9 +3324,9 @@ luaL_newstate *luaL_newstate()*
lua_State *luaL_newstate (void);
<
Creates a new Lua state. It calls `lua_newstate` (see
- |luaref-lua_newstate|) with an allocator based on the standard C
+ |lua_newstate()|) with an allocator based on the standard C
`realloc` function and then sets a panic function (see
- |luaref-lua_atpanic|) that prints an error message to the standard
+ |lua_atpanic()|) that prints an error message to the standard
error output in case of fatal errors.
Returns the new state, or `NULL` if there is a memory allocation
@@ -3417,7 +3354,7 @@ luaL_optinteger *luaL_optinteger()*
lua_Integer d);
<
If the function argument `narg` is a number, returns this number cast
- to a `lua_Integer` (see |luaref-lua_Integer|). If this argument is
+ to a `lua_Integer` (see |lua_Integer()|). If this argument is
absent or is `nil`, returns `d`. Otherwise, raises an error.
luaL_optlong *luaL_optlong()*
@@ -3464,9 +3401,9 @@ luaL_prepbuffer *luaL_prepbuffer()*
char *luaL_prepbuffer (luaL_Buffer *B);
<
Returns an address to a space of size `LUAL_BUFFERSIZE` where you can
- copy a string to be added to buffer `B` (see |luaref-luaL_Buffer|).
+ copy a string to be added to buffer `B` (see |luaL_Buffer()|).
After copying the string into this space you must call `luaL_addsize`
- (see |luaref-luaL_addsize|) with the size of the string to actually
+ (see |luaL_addsize()|) with the size of the string to actually
add it to the buffer.
luaL_pushresult *luaL_pushresult()*
@@ -3486,8 +3423,8 @@ luaL_ref *luaL_ref()*
A reference is a unique integer key. As long as you do not manually
add integer keys into table `t`, `luaL_ref` ensures the uniqueness of
the key it returns. You can retrieve an object referred by reference
- `r` by calling `lua_rawgeti(L, t, r)` (see |luaref-lua_rawgeti|).
- Function `luaL_unref` (see |luaref-luaL_unref|) frees a reference and
+ `r` by calling `lua_rawgeti(L, t, r)` (see |lua_rawgeti()|).
+ Function `luaL_unref` (see |luaL_unref()|) frees a reference and
its associated object.
If the object at the top of the stack is `nil`, `luaL_ref` returns the
@@ -3502,7 +3439,7 @@ luaL_Reg *luaL_Reg()*
} luaL_Reg;
<
Type for arrays of functions to be registered by `luaL_register` (see
- |luaref-luaL_register|). `name` is the function name and `func` is a
+ |luaL_register()|). `name` is the function name and `func` is a
pointer to the function. Any array of `luaL_Reg` must end with a
sentinel entry in which both `name` and `func` are `NULL`.
@@ -3515,7 +3452,7 @@ luaL_register *luaL_register()*
Opens a library.
When called with `libname` equal to `NULL`, it simply registers all
- functions in the list `l` (see |luaref-luaL_Reg|) into the table on
+ functions in the list `l` (see |luaL_Reg()|) into the table on
the top of the stack.
When called with a non-null `libname`, `luaL_register` creates a new
@@ -3543,7 +3480,7 @@ luaL_typerror *luaL_typerror()*
`expected, got` `rt` `)`
where `location` is produced by `luaL_where` (see
- |luaref-luaL_where|), `func` is the name of the current function, and
+ |luaL_where()|), `func` is the name of the current function, and
`rt` is the type name of the actual argument.
luaL_unref *luaL_unref()*
@@ -3551,7 +3488,7 @@ luaL_unref *luaL_unref()*
void luaL_unref (lua_State *L, int t, int ref);
<
Releases reference `ref` from the table at index `t` (see
- |luaref-luaL_ref|). The entry is removed from the table, so that the
+ |luaL_ref()|). The entry is removed from the table, so that the
referred object can be collected. The reference `ref` is also freed to
be used again.
@@ -3601,14 +3538,14 @@ functions as fields of a global table or as methods of its objects.
*luaref-openlibs*
To have access to these libraries, the C host program should call the
`luaL_openlibs` function, which opens all standard libraries (see
-|luaref-luaL_openlibs|). Alternatively, the host program can open the libraries
+|luaL_openlibs()|). Alternatively, the host program can open the libraries
individually by calling `luaopen_base` (for the basic library),
`luaopen_package` (for the package library), `luaopen_string` (for the string
library), `luaopen_table` (for the table library), `luaopen_math` (for the
mathematical library), `luaopen_io` (for the I/O and the Operating System
libraries), and `luaopen_debug` (for the debug library). These functions are
declared in `lualib.h` and should not be called directly: you must call them
-like any other Lua C function, e.g., by using `lua_call` (see |luaref-lua_call|).
+like any other Lua C function, e.g., by using `lua_call` (see |lua_call()|).
==============================================================================
5.1 Basic Functions *luaref-libBasic*
@@ -3700,11 +3637,11 @@ load({func} [, {chunkname}]) *luaref-load()*
information.
loadfile([{filename}]) *luaref-loadfile()*
- Similar to `load` (see |luaref-load|), but gets the chunk from file
+ Similar to `load` (see |luaref-load()|), but gets the chunk from file
{filename} or from the standard input, if no file name is given.
loadstring({string} [, {chunkname}]) *luaref-loadstring()*
- Similar to `load` (see |luaref-load|), but gets the chunk from the
+ Similar to `load` (see |luaref-load()|), but gets the chunk from the
given {string}.
To load and run a given string, use the idiom
@@ -3724,14 +3661,14 @@ next({table} [, {index}]) *luaref-next()*
The order in which the indices are enumerated is not specified, `even
for` `numeric indices`. (To traverse a table in numeric order, use a
- numerical `for` or the `ipairs` |luaref-ipairs| function.)
+ numerical `for` or the `ipairs` |luaref-ipairs()| function.)
The behavior of `next` is `undefined` if, during the traversal, you
assign any value to a non-existent field in the table. You may however
modify existing fields. In particular, you may clear existing fields.
pairs({t}) *luaref-pairs()*
- Returns three values: the `next` |luaref-next| function, the table
+ Returns three values: the `next` |luaref-next()| function, the table
{t}, and `nil`, so that the construction
`for k,v in pairs(t) do` `body` `end`
@@ -3749,10 +3686,10 @@ pcall({f}, {arg1}, {...}) *luaref-pcall()*
print({...}) *luaref-print()*
Receives any number of arguments, and prints their values to `stdout`,
- using the `tostring` |luaref-tostring| function to convert them to
+ using the `tostring` |luaref-tostring()| function to convert them to
strings. `print` is not intended for formatted output, but only as a
quick way to show a value, typically for debugging. For formatted
- output, use `string.format` (see |luaref-string.format|).
+ output, use `string.format` (see |string.format()|).
rawequal({v1}, {v2}) *luaref-rawequal()*
Checks whether {v1} is equal to {v2}, without invoking any metamethod.
@@ -3807,7 +3744,7 @@ tonumber({e} [, {base}]) *luaref-tonumber()*
tostring({e}) *luaref-tostring()*
Receives an argument of any type and converts it to a string in a
reasonable format. For complete control of how numbers are converted,
- use `string.format` (see |luaref-string.format|).
+ use `string.format` (see |string.format()|).
*__tostring*
If the metatable of {e} has a `"__tostring"` field, `tostring` calls
@@ -3836,7 +3773,7 @@ _VERSION *luaref-_VERSION()*
`"Lua 5.1"` .
xpcall({f}, {err}) *luaref-xpcall()*
- This function is similar to `pcall` (see |luaref-pcall|), except that
+ This function is similar to `pcall` (see |luaref-pcall()|), except that
you can set a new error handler.
`xpcall` calls function {f} in protected mode, using {err} as the
@@ -3901,7 +3838,7 @@ coroutine.yield({...}) *coroutine.yield()*
The package library provides basic facilities for loading and building modules
in Lua. It exports two of its functions directly in the global environment:
-`require` and `module` (see |luaref-require| and |luaref-module|). Everything else is
+`require` and `module` (see |luaref-require()| and |luaref-module()|). Everything else is
exported in a table `package`.
module({name} [, {...}]) *luaref-module()*
@@ -3914,7 +3851,7 @@ module({name} [, {...}]) *luaref-module()*
`t._PACKAGE` with the package name (the full module name minus last
component; see below). Finally, `module` sets `t` as the new
environment of the current function and the new value of
- `package.loaded[name]`, so that `require` (see |luaref-require|)
+ `package.loaded[name]`, so that `require` (see |luaref-require()|)
returns `t`.
If {name} is a compound name (that is, one with components separated
@@ -3968,7 +3905,7 @@ require({modname}) *luaref-require()*
If there is any error loading or running the module, or if it cannot
find any loader for the module, then `require` signals an error.
-package.cpath *package.cpath()*
+package.cpath *package.cpath*
The path used by `require` to search for a C loader.
Lua initializes the C path `package.cpath` in the same way it
@@ -3985,7 +3922,7 @@ package.loadlib({libname}, {funcname}) *package.loadlib()*
Dynamically links the host program with the C library {libname}.
Inside this library, looks for a function {funcname} and returns this
function as a C function. (So, {funcname} must follow the protocol
- (see |luaref-lua_CFunction|)).
+ (see |lua_CFunction()|)).
This is a low-level function. It completely bypasses the package and
module system. Unlike `require`, it does not perform any path
@@ -3998,7 +3935,7 @@ package.loadlib({libname}, {funcname}) *package.loadlib()*
available on some platforms (Windows, Linux, Mac OS X, Solaris, BSD,
plus other Unix systems that support the `dlfcn` standard).
-package.path *package.path()*
+package.path *package.path*
The path used by `require` to search for a Lua loader.
At start-up, Lua initializes this variable with the value of the
@@ -4019,7 +3956,7 @@ package.path *package.path()*
order.
package.preload *package.preload()*
- A table to store loaders for specific modules (see |luaref-require|).
+ A table to store loaders for specific modules (see |luaref-require()|).
package.seeall({module}) *package.seeall()*
Sets a metatable for {module} with its `__index` field referring to
@@ -4059,7 +3996,7 @@ string.char({...}) *string.char()*
string.dump({function}) *string.dump()*
Returns a string containing a binary representation of the given
- function, so that a later |luaref-loadstring| on this string returns a
+ function, so that a later |luaref-loadstring()| on this string returns a
copy of the function. {function} must be a Lua function without
upvalues.
@@ -4341,7 +4278,7 @@ table.foreach({table}, {f}) *table.foreach()*
returns a non-`nil` value, then the loop is broken, and this value is
returned as the final value of `table.foreach`.
- See |luaref-next| for extra information about table traversals.
+ See |luaref-next()| for extra information about table traversals.
table.foreachi({table}, {f}) *table.foreachi()*
Executes the given {f} over the numerical indices of {table}. For each
@@ -4658,7 +4595,7 @@ file:setvbuf({mode} [, {size}]) *luaref-file:setvbuf()*
immediately.
`"full"` full buffering; output operation is performed only when
the buffer is full (or when you explicitly `flush` the file
- (see |luaref-io.flush|).
+ (see |io.flush()|).
`"line"` line buffering; output is buffered until a newline is
output or there is any input from some special files (such as
a terminal device).
@@ -4669,7 +4606,7 @@ file:setvbuf({mode} [, {size}]) *luaref-file:setvbuf()*
file:write({...}) *luaref-file:write()*
Writes the value of each of its arguments to `file`. The arguments
must be strings or numbers. To write other values, use `tostring`
- |luaref-tostring| or `string.format` |luaref-string.format| before
+ |luaref-tostring()| or `string.format` |string.format()| before
`write`.
==============================================================================
@@ -4686,7 +4623,7 @@ os.date([{format} [, {time}]]) *os.date()*
according to the given string {format}.
If the {time} argument is present, this is the time to be formatted
- (see the `os.time` function |luaref-os.time| for a description of this
+ (see the `os.time` function |os.time()| for a description of this
value). Otherwise, `date` formats the current time.
If {format} starts with `!`, then the date is formatted in
@@ -4744,7 +4681,7 @@ os.time([{table}]) *os.time()*
representing the date and time specified by the given table. This
table must have fields `year`, `month`, and `day`, and may have fields
`hour`, `min`, `sec`, and `isdst` (for a description of these fields,
- see the `os.date` function |luaref-os.date|).
+ see the `os.date` function |os.date()|).
The returned value is a number, whose meaning depends on your system.
In POSIX, Windows, and some other systems, this number counts the
@@ -4802,7 +4739,7 @@ debug.getinfo([{thread},] {function} [, {what}]) *debug.getinfo()*
functions, then `getinfo` returns `nil`.
The returned table may contain all the fields returned by
- `lua_getinfo` (see |luaref-lua_getinfo|), with the string {what}
+ `lua_getinfo` (see |lua_getinfo()|), with the string {what}
describing which fields to fill in. The default for {what} is to get
all information available, except the table of valid lines. If
present, the option `f` adds a field named `func` with the function
@@ -4821,7 +4758,7 @@ debug.getlocal([{thread},] {level}, {local}) *debug.getlocal()*
last active local variable.) The function returns `nil` if there is no
local variable with the given index, and raises an error when called
with a {level} out of range. (You can call `debug.getinfo`
- |luaref-debug.getinfo| to check whether the level is valid.)
+ |debug.getinfo()| to check whether the level is valid.)
Variable names starting with `(` (open parentheses) represent
internal variables (loop control variables, temporaries, and C
@@ -4953,7 +4890,7 @@ C LUAREF DOC *luarefvim* *luarefvimdoc* *luaref-help* *luaref-d
This is a Vim help file containing a reference for Lua 5.1, and it is -- with
a few exceptions and adaptations -- a copy of the Lua 5.1 Reference Manual
(see |luaref-bibliography|). For usage information, refer to
-|luaref-docUsage|. For copyright information, see |luaref-copyright|.
+|luaref-doc|. For copyright information, see |luaref-copyright|.
The main ideas and concepts on how to implement this reference were taken from
Christian Habermann's CRefVim project
diff --git a/runtime/doc/luvref.txt b/runtime/doc/luvref.txt
index ee45444b42..6b77ee89a8 100644
--- a/runtime/doc/luvref.txt
+++ b/runtime/doc/luvref.txt
@@ -3355,7 +3355,7 @@ uv.getnameinfo({address} [, {callback}]) *uv.getnameinfo()*
- `family`: `string` or `integer` or `nil`
- `callback`: `callable` (async version) or `nil` (sync
version)
- - `err`: `nil` or `sring`
+ - `err`: `nil` or `string`
- `host`: `string` or `nil`
- `service`: `string` or `nil`
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index da6a305e89..cbc92a8cb5 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -1660,7 +1660,8 @@ The valid escape sequences are
If the first two characters of an escape sequence are "q-" (for example,
<q-args>) then the value is quoted in such a way as to make it a valid value
for use in an expression. This uses the argument as one single value.
-When there is no argument <q-args> is an empty string.
+When there is no argument <q-args> is an empty string. See the
+|q-args-example| below.
*<f-args>*
To allow commands to pass their arguments on to a user-defined function, there
is a special form <f-args> ("function args"). This splits the command
@@ -1670,10 +1671,10 @@ See the Mycmd example below. If no arguments are given <f-args> is removed.
To embed whitespace into an argument of <f-args>, prepend a backslash.
<f-args> replaces every pair of backslashes (\\) with one backslash. A
backslash followed by a character other than white space or a backslash
-remains unmodified. Overview:
+remains unmodified. Also see |f-args-example| below. Overview:
command <f-args> ~
- XX ab 'ab'
+ XX ab "ab"
XX a\b 'a\b'
XX a\ b 'a b'
XX a\ b 'a ', 'b'
@@ -1684,7 +1685,8 @@ remains unmodified. Overview:
XX a\\\\b 'a\\b'
XX a\\\\ b 'a\\', 'b'
-Examples >
+
+Examples for user commands: >
" Delete everything after here to the end
:com Ddel +,$d
@@ -1700,7 +1702,8 @@ Examples >
" Count the number of lines in the range
:com! -range -nargs=0 Lines echo <line2> - <line1> + 1 "lines"
- " Call a user function (example of <f-args>)
+< *f-args-example*
+Call a user function (example of <f-args>) >
:com -nargs=* Mycmd call Myfunc(<f-args>)
When executed as: >
@@ -1708,7 +1711,8 @@ When executed as: >
This will invoke: >
:call Myfunc("arg1","arg2")
- :" A more substantial example
+< *q-args-example*
+A more substantial example: >
:function Allargs(command)
: let i = 0
: while i < argc()
diff --git a/runtime/doc/mbyte.txt b/runtime/doc/mbyte.txt
index 2aa49cee1e..7a76c57fc2 100644
--- a/runtime/doc/mbyte.txt
+++ b/runtime/doc/mbyte.txt
@@ -86,9 +86,8 @@ You can also set 'guifont' alone, the Nvim GUI will try to find a matching
INPUT
There are several ways to enter multibyte characters:
-- For X11 XIM can be used. See |XIM|.
-- For MS-Windows IME can be used. See |IME|.
-- For all systems keymaps can be used. See |mbyte-keymap|.
+- Your system IME can be used.
+- Keymaps can be used. See |mbyte-keymap|.
The options 'iminsert', 'imsearch' and 'imcmdline' can be used to choose
the different input methods or disable them temporarily.
diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt
index 511b1bd7b2..8ff4ed4f96 100644
--- a/runtime/doc/motion.txt
+++ b/runtime/doc/motion.txt
@@ -831,12 +831,12 @@ deletes the lines from the cursor position to mark 't'. Hint: Use mark 't' for
Top, 'b' for Bottom, etc.. Lowercase marks are restored when using undo and
redo.
-Uppercase marks 'A to 'Z include the file name.
-You can use them to jump from file to file. You can only use an uppercase
-mark with an operator if the mark is in the current file. The line number of
-the mark remains correct, even if you insert/delete lines or edit another file
-for a moment. When the 'shada' option is not empty, uppercase marks are
-kept in the .shada file. See |shada-file-marks|.
+Uppercase marks 'A to 'Z include the file name. You can use them to jump from
+file to file. You can only use an uppercase mark with an operator if the mark
+is in the current file. The line number of the mark remains correct, even if
+you insert/delete lines or edit another file for a moment. When the 'shada'
+option is not empty, uppercase marks are kept in the .shada file. See
+|shada-file-marks|.
Numbered marks '0 to '9 are quite different. They can not be set directly.
They are only present when using a shada file |shada-file|. Basically '0
@@ -1172,7 +1172,7 @@ g; Go to [count] older position in change list.
(not a motion command)
*g,* *E663*
-g, Go to [count] newer cursor position in change list.
+g, Go to [count] newer position in change list.
Just like |g;| but in the opposite direction.
(not a motion command)
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 14b7eb2d71..836272a60f 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1338,9 +1338,13 @@ A jump table for the options with a short description can be found at |Q_op|.
When 'cmdheight' is zero, there is no command-line unless it is being
used. The command-line will cover the last line of the screen when
- shown. Some informative messages will not be displayed, any other
- messages will cause the |hit-enter| prompt. Expect some other
- unexpected behavior too.
+ shown.
+
+ WARNING: `cmdheight=0` is considered experimental. Expect some
+ unwanted behaviour. Some 'shortmess' flags and similar
+ mechanism might fail to take effect, causing unwanted hit-enter
+ prompts. Some informative messages, both from Nvim itself and
+ plugins, will not be displayed.
*'cmdwinheight'* *'cwh'*
'cmdwinheight' 'cwh' number (default 7)
@@ -5704,7 +5708,7 @@ A jump table for the options with a short description can be found at |Q_op|.
"yes:[1-9]" always, with fixed space for signs up to the given
number (maximum 9), e.g. "yes:3"
"number" display signs in the 'number' column. If the number
- column is not present, then behaves like 'auto'.
+ column is not present, then behaves like "auto".
Note regarding 'orphaned signs': with signcolumn numbers higher than
1, deleting lines will also remove the associated signs automatically,
@@ -6481,7 +6485,7 @@ A jump table for the options with a short description can be found at |Q_op|.
'termguicolors' 'tgc' boolean (default off)
global
Enables 24-bit RGB color in the |TUI|. Uses "gui" |:highlight|
- attributes instead of "cterm" attributes. |highlight-guifg|
+ attributes instead of "cterm" attributes. |guifg|
Requires an ISO-8613-3 compatible terminal.
*'termpastefilter'* *'tpf'*
@@ -6748,11 +6752,11 @@ A jump table for the options with a short description can be found at |Q_op|.
final value applying to all subsequent tabs.
For example, when editing assembly language files where statements
- start in the 8th column and comments in the 40th, it may be useful
+ start in the 9th column and comments in the 41st, it may be useful
to use the following: >
:set varsofttabstop=8,32,8
-< This will set soft tabstops at the 8th and 40th columns, and at every
- 8th column thereafter.
+< This will set soft tabstops with 8 and 8 + 32 spaces, and 8 more
+ for every column thereafter.
Note that the value of |'softtabstop'| will be ignored while
'varsofttabstop' is set.
@@ -7136,7 +7140,7 @@ A jump table for the options with a short description can be found at |Q_op|.
the window.
Note: highlight namespaces take precedence over 'winhighlight'.
- See |nvim_win_set_hl_ns| and |nvim_set_hl|.
+ See |nvim_win_set_hl_ns()| and |nvim_set_hl()|.
Highlights of vertical separators are determined by the window to the
left of the separator. The 'tabline' highlight of a tabpage is
diff --git a/runtime/doc/pi_health.txt b/runtime/doc/pi_health.txt
index cc36e7186c..8a6437fdc8 100644
--- a/runtime/doc/pi_health.txt
+++ b/runtime/doc/pi_health.txt
@@ -75,7 +75,7 @@ vim.health.report_error({msg} [, {advice}]) *vim.health.report_error
Create a healthcheck *health-dev*
Healthchecks are functions that check the user environment, configuration, or
-any other prerequisities that a plugin cares about. Nvim ships with
+any other prerequisites that a plugin cares about. Nvim ships with
healthchecks in:
- $VIMRUNTIME/autoload/health/
- $VIMRUNTIME/lua/vim/lsp/health.lua
diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt
index 1eaa76264f..63d4496dc4 100644
--- a/runtime/doc/pi_netrw.txt
+++ b/runtime/doc/pi_netrw.txt
@@ -2353,7 +2353,7 @@ MARKED FILES: DIFF *netrw-md* {{{2
(See |netrw-mf| and |netrw-mr| for how to mark files)
(uses the global marked file list)
-Use |vimdiff| to visualize difference between selected files (two or
+Use vimdiff to visualize difference between selected files (two or
three may be selected for this). Uses the global marked file list.
MARKED FILES: EDITING *netrw-me* {{{2
@@ -3469,7 +3469,7 @@ Example: Clear netrw's marked file list via a mapping on gu >
*netrw-p4*
P4. I would like long listings to be the default. {{{2
- Put the following statement into your |.vimrc|: >
+ Put the following statement into your |vimrc|: >
let g:netrw_liststyle= 1
<
@@ -3482,7 +3482,7 @@ Example: Clear netrw's marked file list via a mapping on gu >
Does your system's strftime() accept the "%c" to yield dates
such as "Sun Apr 27 11:49:23 1997"? If not, do a
"man strftime" and find out what option should be used. Then
- put it into your |.vimrc|: >
+ put it into your |vimrc|: >
let g:netrw_timefmt= "%X" (where X is the option)
<
@@ -3490,7 +3490,7 @@ Example: Clear netrw's marked file list via a mapping on gu >
P6. I want my current directory to track my browsing. {{{2
How do I do that?
- Put the following line in your |.vimrc|:
+ Put the following line in your |vimrc|:
>
let g:netrw_keepdir= 0
<
@@ -3569,7 +3569,7 @@ Example: Clear netrw's marked file list via a mapping on gu >
http://www.chiark.greenend.org.uk/~sgtatham/putty/0.60/htmldoc/Chapter8.html#pubkey-gettingready
(8.3 Getting ready for public key authentication)
<
- How to use a private key with 'pscp': >
+ How to use a private key with "pscp": >
http://www.chiark.greenend.org.uk/~sgtatham/putty/0.60/htmldoc/Chapter5.html
(5.2.4 Using public key authentication with PSCP)
@@ -3839,7 +3839,7 @@ netrw:
or
http://vim.sourceforge.net/scripts/script.php?script_id=120
- Decho.vim is provided as a "vimball"; see |vimball-intro|. You
+ Decho.vim is provided as a "vimball". You
should edit the Decho.vba.gz file and source it in: >
vim Decho.vba.gz
@@ -3917,7 +3917,7 @@ netrw:
* Installed |g:netrw_clipboard| setting
* Installed option bypass for |'guioptions'|
a/A settings
- * Changed popup_beval() to |popup_atcursor()|
+ * Changed popup_beval() to popup_atcursor()
in netrw#ErrorMsg (lacygoill). Apparently
popup_beval doesn't reliably close the
popup when the mouse is moved.
@@ -3943,7 +3943,7 @@ netrw:
did not restore options correctly that
had a single quote in the option string.
Apr 13, 2020 * implemented error handling via popup
- windows (see |popup_beval()|)
+ windows (see popup_beval())
Apr 30, 2020 * (reported by Manatsu Takahashi) while
using Lexplore, a modified file could
be overwritten. Sol'n: will not overwrite,
diff --git a/runtime/doc/print.txt b/runtime/doc/print.txt
index 924fab175e..0e02c7d42d 100644
--- a/runtime/doc/print.txt
+++ b/runtime/doc/print.txt
@@ -659,7 +659,7 @@ It is possible to achieve a poor man's version of duplex printing using the PS
utility psselect. This utility has options -e and -o for printing just the
even or odd pages of a PS file respectively.
-First generate a PS file with the 'hardcopy' command, then generate new
+First generate a PS file with the ":hardcopy" command, then generate new
files with all the odd and even numbered pages with: >
psselect -o test.ps odd.ps
diff --git a/runtime/doc/provider.txt b/runtime/doc/provider.txt
index 9fd35f19c5..782bd19441 100644
--- a/runtime/doc/provider.txt
+++ b/runtime/doc/provider.txt
@@ -240,7 +240,7 @@ a list of lines and `regtype` is a register type conforming to |setreg()|.
Paste *provider-paste* *paste*
"Paste" is a separate concept from |clipboard|: paste means "dump a bunch of
-text to the editor", whereas clipboard provides features like |quote-+| to get
+text to the editor", whereas clipboard provides features like |quote+| to get
and set the OS clipboard directly. For example, middle-click or CTRL-SHIFT-v
(macOS: CMD-v) in your terminal is "paste", not "clipboard": the terminal
application (Nvim) just gets a stream of text, it does not interact with the
diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt
index dab3bfa280..924a6d4743 100644
--- a/runtime/doc/quickfix.txt
+++ b/runtime/doc/quickfix.txt
@@ -466,7 +466,7 @@ You can parse a list of lines using 'errorformat' without creating or
modifying a quickfix list using the |getqflist()| function. Examples: >
echo getqflist({'lines' : ["F1:10:Line10", "F2:20:Line20"]})
echo getqflist({'lines' : systemlist('grep -Hn quickfix *')})
-This returns a dictionary where the 'items' key contains the list of quickfix
+This returns a dictionary where the "items" key contains the list of quickfix
entries parsed from lines. The following shows how to use a custom
'errorformat' to parse the lines without modifying the 'errorformat' option: >
echo getqflist({'efm' : '%f#%l#%m', 'lines' : ['F1#10#Line']})
@@ -585,7 +585,7 @@ can go back to the unfiltered list using the |:colder|/|:lolder| command.
quickfix command or function, the |b:changedtick|
variable is incremented. You can get the number of
this buffer using the getqflist() and getloclist()
- functions by passing the 'qfbufnr' item. For a
+ functions by passing the "qfbufnr" item. For a
location list, this buffer is wiped out when the
location list is removed.
@@ -916,7 +916,7 @@ To get the number of the current list in the stack: >
screen).
5. The errorfile is read using 'errorformat'.
6. All relevant |QuickFixCmdPost| autocommands are
- executed. See example below.
+ executed. See example below.
7. If [!] is not given the first error is jumped to.
8. The errorfile is deleted.
9. You can now move through the errors with commands
@@ -1939,7 +1939,7 @@ list window is:
The values displayed in each line correspond to the "bufnr", "lnum", "col" and
"text" fields returned by the |getqflist()| function.
-For some quickfix/location lists, the displayed text need to be customized.
+For some quickfix/location lists, the displayed text needs to be customized.
For example, if only the filename is present for a quickfix entry, then the
two "|" field separator characters after the filename are not needed. Another
use case is to customize the path displayed for a filename. By default, the
@@ -1965,7 +1965,7 @@ The function should return a single line of text to display in the quickfix
window for each entry from start_idx to end_idx. The function can obtain
information about the entries using the |getqflist()| function and specifying
the quickfix list identifier "id". For a location list, getloclist() function
-can be used with the 'winid' argument. If an empty list is returned, then the
+can be used with the "winid" argument. If an empty list is returned, then the
default format is used to display all the entries. If an item in the returned
list is an empty string, then the default format is used to display the
corresponding entry.
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
index 9f3993506a..bdb0f7447c 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -3,7 +3,8 @@
VIM REFERENCE MANUAL by Bram Moolenaar
- Quick reference guide
+==============================================================================
+Quick reference guide
*quickref* *Contents*
tag subject tag subject ~
@@ -30,10 +31,10 @@
|Q_fo| Folding
------------------------------------------------------------------------------
-N is used to indicate an optional count that can be given before the command.
-------------------------------------------------------------------------------
*Q_lr* Left-right motions
+N is used to indicate an optional count that can be given before the command.
+
|h| N h left (also: CTRL-H, <BS>, or <Left> key)
|l| N l right (also: <Space> or <Right> key)
|0| 0 to first character in the line (also: <Home> key)
@@ -56,6 +57,7 @@ N is used to indicate an optional count that can be given before the command.
|;| N ; repeat the last "f", "F", "t", or "T" N times
|,| N , repeat the last "f", "F", "t", or "T" N times in
opposite direction
+
------------------------------------------------------------------------------
*Q_ud* Up-down motions
@@ -73,6 +75,7 @@ N is used to indicate an optional count that can be given before the command.
given, otherwise it is the |%| command
|gk| N gk up N screen lines (differs from "k" when line wraps)
|gj| N gj down N screen lines (differs from "j" when line wraps)
+
------------------------------------------------------------------------------
*Q_tm* Text object motions
@@ -105,6 +108,7 @@ N is used to indicate an optional count that can be given before the command.
|]#| N ]# N times forward to unclosed "#else" or "#endif"
|[star| N [* N times back to start of comment "/*"
|]star| N ]* N times forward to end of comment "*/"
+
------------------------------------------------------------------------------
*Q_pa* Pattern searches
@@ -168,6 +172,7 @@ N is used to indicate an optional count that can be given before the command.
b[+num] [num] identical to s[+num] above (mnemonic: begin)
b[-num] [num] identical to s[-num] above (mnemonic: begin)
;{search-command} execute {search-command} next
+
------------------------------------------------------------------------------
*Q_ma* Marks and motions
@@ -188,6 +193,7 @@ N is used to indicate an optional count that can be given before the command.
|CTRL-O| N CTRL-O go to Nth older position in jump list
|CTRL-I| N CTRL-I go to Nth newer position in jump list
|:ju| :ju[mps] print the jump list
+
------------------------------------------------------------------------------
*Q_vm* Various motions
@@ -202,6 +208,7 @@ N is used to indicate an optional count that can be given before the command.
|go| N go go to Nth byte in the buffer
|:go| :[range]go[to] [off] go to [off] byte in the buffer
+
------------------------------------------------------------------------------
*Q_ta* Using tags
@@ -229,6 +236,7 @@ N is used to indicate an optional count that can be given before the command.
|:ptjump| :ptj[ump] like ":tjump" but show tag in preview window
|:pclose| :pc[lose] close tag preview window
|CTRL-W_z| CTRL-W z close tag preview window
+
------------------------------------------------------------------------------
*Q_sc* Scrolling
@@ -247,6 +255,7 @@ These only work when 'wrap' is off:
|zl| N zl scroll screen N characters to the left
|zH| N zH scroll screen half a screenwidth to the right
|zL| N zL scroll screen half a screenwidth to the left
+
------------------------------------------------------------------------------
*Q_in* Inserting text
@@ -263,6 +272,7 @@ These only work when 'wrap' is off:
in Visual block mode:
|v_b_I| I insert the same text in front of all the selected lines
|v_b_A| A append the same text after all the selected lines
+
------------------------------------------------------------------------------
*Q_ai* Insert mode keys
@@ -279,6 +289,7 @@ moving around:
|i_<S-Up>| shift-up/down one screenful backward/forward
|i_<End>| <End> cursor after last character in the line
|i_<Home>| <Home> cursor to first character in the line
+
------------------------------------------------------------------------------
*Q_ss* Special keys in Insert mode
@@ -313,6 +324,7 @@ moving around:
|i_0_CTRL-D| 0 CTRL-D delete all indent in the current line
|i_^_CTRL-D| ^ CTRL-D delete all indent in the current line,
restore indent in next line
+
------------------------------------------------------------------------------
*Q_di* Digraphs
@@ -325,12 +337,14 @@ In Insert or Command-line mode:
enter digraph
|i_digraph| {char1} <BS> {char2}
enter digraph if 'digraph' option set
+
------------------------------------------------------------------------------
*Q_si* Special inserts
|:r| :r [file] insert the contents of [file] below the cursor
|:r!| :r! {command} insert the standard output of {command} below the
cursor
+
------------------------------------------------------------------------------
*Q_de* Deleting text
@@ -346,6 +360,7 @@ In Insert or Command-line mode:
|gJ| N gJ like "J", but without inserting spaces
|v_gJ| {visual}gJ like "{visual}J", but without inserting spaces
|:d| :[range]d [x] delete [range] lines [into register x]
+
------------------------------------------------------------------------------
*Q_cm* Copying and moving text
@@ -363,6 +378,7 @@ In Insert or Command-line mode:
|[p| N [p like P, but adjust indent to current line
|gp| N gp like p, but leave cursor after the new text
|gP| N gP like P, but leave cursor after the new text
+
------------------------------------------------------------------------------
*Q_ch* Changing text
@@ -418,6 +434,7 @@ In Insert or Command-line mode:
left-align the lines in [range] (with [indent])
|:ri| :[range]ri[ght] [width]
right-align the lines in [range]
+
------------------------------------------------------------------------------
*Q_co* Complex changes
@@ -444,6 +461,7 @@ In Insert or Command-line mode:
|:ret| :[range]ret[ab][!] [tabstop]
set 'tabstop' to new value and adjust white space
accordingly
+
------------------------------------------------------------------------------
*Q_vi* Visual mode
@@ -457,6 +475,7 @@ In Insert or Command-line mode:
|v_v| v highlight characters or stop highlighting
|v_V| V highlight linewise or stop highlighting
|v_CTRL-V| CTRL-V highlight blockwise or stop highlighting
+
------------------------------------------------------------------------------
*Q_to* Text objects (only in Visual mode or after an operator)
@@ -509,6 +528,7 @@ In Insert or Command-line mode:
|:sl| :sl[eep] [sec]
don't do anything for [sec] seconds
|gs| N gs goto Sleep for N seconds
+
------------------------------------------------------------------------------
*Q_km* Key mapping
@@ -556,6 +576,7 @@ In Insert or Command-line mode:
like ":mkvimrc", but store current files,
windows, etc. too, to be able to continue
this session later
+
------------------------------------------------------------------------------
*Q_ab* Abbreviations
@@ -570,6 +591,7 @@ In Insert or Command-line mode:
|:abclear| :abc[lear] remove all abbreviations
|:cabclear| :cabc[lear] remove all abbr's for Cmdline mode
|:iabclear| :iabc[lear] remove all abbr's for Insert mode
+
------------------------------------------------------------------------------
*Q_op* Options
@@ -615,10 +637,6 @@ Short explanation of each option: *option-list*
'backupdir' 'bdir' list of directories for the backup file
'backupext' 'bex' extension used for the backup file
'backupskip' 'bsk' no backup for files that match these patterns
-'balloondelay' 'bdlay' delay in mS before a balloon may pop up
-'ballooneval' 'beval' switch on balloon evaluation in the GUI
-'balloonevalterm' 'bevalterm' switch on balloon evaluation in the terminal
-'balloonexpr' 'bexpr' expression to show in balloon
'belloff' 'bo' do not ring the bell for these reasons
'binary' 'bin' read/write/edit file in binary mode
'bomb' prepend a Byte Order Mark to the file
@@ -802,7 +820,6 @@ Short explanation of each option: *option-list*
'patchexpr' 'pex' expression used to patch a file
'patchmode' 'pm' keep the oldest version of a file
'path' 'pa' list of directories searched with "gf" et.al.
-'perldll' name of the Perl dynamic library
'preserveindent' 'pi' preserve the indent structure when reindenting
'previewheight' 'pvh' height of the preview window
'previewpopup' 'pvp' use popup window for preview
@@ -817,8 +834,6 @@ Short explanation of each option: *option-list*
'printoptions' 'popt' controls the format of :hardcopy output
'pumheight' 'ph' maximum height of the popup menu
'pumwidth' 'pw' minimum width of the popup menu
-'pythondll' name of the Python 2 dynamic library
-'pythonthreedll' name of the Python 3 dynamic library
'pyxversion' 'pyx' Python version used for pyx* commands
'quoteescape' 'qe' escape characters used in a string
'readonly' 'ro' disallow writing the buffer
@@ -829,7 +844,6 @@ Short explanation of each option: *option-list*
'revins' 'ri' inserting characters will work backwards
'rightleft' 'rl' window is right-to-left oriented
'rightleftcmd' 'rlc' commands for which editing works right-to-left
-'rubydll' name of the Ruby dynamic library
'ruler' 'ru' show cursor line and column in the status line
'rulerformat' 'ruf' custom format for the ruler
'runtimepath' 'rtp' list of directories used for runtime files
@@ -948,18 +962,21 @@ Short explanation of each option: *option-list*
'writeany' 'wa' write to file with no need for "!" override
'writebackup' 'wb' make a backup before overwriting a file
'writedelay' 'wd' delay this many msec for each char (for debug)
+
------------------------------------------------------------------------------
*Q_ur* Undo/Redo commands
|u| N u undo last N changes
|CTRL-R| N CTRL-R redo last N undone changes
|U| U restore last changed line
+
------------------------------------------------------------------------------
*Q_et* External commands
|:!| :!{command} execute {command} with a shell
|K| K lookup keyword under the cursor with
'keywordprg' program (default: "man")
+
------------------------------------------------------------------------------
*Q_qf* Quickfix commands
@@ -983,6 +1000,7 @@ Short explanation of each option: *option-list*
error
|:grep| :gr[ep] [args] execute 'grepprg' to find matches and jump to
the first one
+
------------------------------------------------------------------------------
*Q_vc* Various commands
@@ -1008,6 +1026,7 @@ Short explanation of each option: *option-list*
unsaved changes or read-only files
|:browse| :browse {command} open/read/write file, using a
file selection dialog
+
------------------------------------------------------------------------------
*Q_ce* Command-line editing
@@ -1054,6 +1073,7 @@ Context-sensitive completion on the command-line:
to next match
|c_CTRL-P| CTRL-P after 'wildchar' with multiple matches: go
to previous match
+
------------------------------------------------------------------------------
*Q_ra* Ex ranges
@@ -1074,6 +1094,7 @@ Context-sensitive completion on the command-line:
(default: 1)
|:range| -[num] subtract [num] from the preceding line
number (default: 1)
+
------------------------------------------------------------------------------
*Q_ex* Special Ex characters
@@ -1106,6 +1127,7 @@ Context-sensitive completion on the command-line:
|::r| :r root (extension removed)
|::e| :e extension
|::s| :s/{pat}/{repl}/ substitute {pat} with {repl}
+
------------------------------------------------------------------------------
*Q_st* Starting Vim
@@ -1142,6 +1164,7 @@ Context-sensitive completion on the command-line:
|--help| --help show list of arguments and exit
|--version| --version show version info and exit
|--| - read file from stdin
+
------------------------------------------------------------------------------
*Q_ed* Editing a file
@@ -1161,6 +1184,7 @@ Context-sensitive completion on the command-line:
position
|:file| :f[ile] {name} set the current file name to {name}
|:files| :files show alternate file names
+
------------------------------------------------------------------------------
*Q_fl* Using the argument list |argument-list|
@@ -1181,6 +1205,7 @@ Context-sensitive completion on the command-line:
|:Next| :N[ext] :sN[ext] edit previous file
|:first| :fir[st] :sfir[st] edit first file
|:last| :la[st] :sla[st] edit last file
+
------------------------------------------------------------------------------
*Q_wq* Writing and quitting
@@ -1218,6 +1243,7 @@ Context-sensitive completion on the command-line:
|:stop| :st[op][!] suspend Vim or start new shell; if 'aw' option
is set and [!] not given write the buffer
|CTRL-Z| CTRL-Z same as ":stop"
+
------------------------------------------------------------------------------
*Q_ac* Automatic Commands
@@ -1249,6 +1275,7 @@ Context-sensitive completion on the command-line:
with {pat}
|:autocmd| :au! {event} {pat} {cmd} remove all autocommands for {event}
with {pat} and enter new one
+
------------------------------------------------------------------------------
*Q_wi* Multi-window commands
@@ -1294,6 +1321,7 @@ Context-sensitive completion on the command-line:
|CTRL-W_>| CTRL-W > increase current window width
|CTRL-W_bar| CTRL-W | set current window width (default:
widest possible)
+
------------------------------------------------------------------------------
*Q_bu* Buffer list commands
@@ -1315,6 +1343,7 @@ Context-sensitive completion on the command-line:
|:bfirst| :bfirst :sbfirst to first arg/buf
|:blast| :blast :sblast to last arg/buf
|:bmodified| :[N]bmod [N] :[N]sbmod [N] to Nth modified buf
+
------------------------------------------------------------------------------
*Q_sy* Syntax Highlighting
@@ -1341,6 +1370,7 @@ Context-sensitive completion on the command-line:
|:filetype| :filetype plugin indent on
switch on file type detection, with
automatic indenting and settings
+
------------------------------------------------------------------------------
*Q_gu* GUI commands
@@ -1353,6 +1383,7 @@ Context-sensitive completion on the command-line:
add toolbar item, giving {rhs}
|:tmenu| :tmenu {mpath} {text} add tooltip to menu {mpath}
|:unmenu| :unmenu {mpath} remove menu {mpath}
+
------------------------------------------------------------------------------
*Q_fo* Folding
diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt
index 508565dea4..b0332269d7 100644
--- a/runtime/doc/repeat.txt
+++ b/runtime/doc/repeat.txt
@@ -83,7 +83,8 @@ pattern and do not match another pattern: >
This first finds all lines containing "found", but only executes {cmd} when
there is no match for "notfound".
-To execute a non-Ex command, you can use the `:normal` command: >
+Any Ex command can be used, see |ex-cmd-index|. To execute a Normal mode
+command, you can use the `:normal` command: >
:g/pat/normal {commands}
Make sure that {commands} ends with a whole command, otherwise Vim will wait
for you to type the rest of the command for each match. The screen will not
@@ -591,7 +592,7 @@ This could be done if some conditions are met. For example, depending on
whether Vim supports a feature or a dependency is missing.
You can also load an optional plugin at startup, by putting this command in
-your |.vimrc|: >
+your |config|: >
:packadd! foodebug
The extra "!" is so that the plugin isn't loaded if Vim was started with
|--noplugin|.
diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt
index d57a85423c..351fe868d9 100644
--- a/runtime/doc/starting.txt
+++ b/runtime/doc/starting.txt
@@ -82,12 +82,10 @@ argument.
--help *-h* *--help* *-?*
-?
-h Give usage (help) message and exit.
- See |info-message| about capturing the text.
--version *-v* *--version*
-v Print version information and exit. Same output as for
|:version| command.
- See |info-message| about capturing the text.
*--clean*
--clean Mimics a fresh install of Nvim:
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index 6fcf292513..8ebe0f3569 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -2057,7 +2057,7 @@ The g:lisp_rainbow option provides 10 levels of individual colorization for
the parentheses and backquoted parentheses. Because of the quantity of
colorization levels, unlike non-rainbow highlighting, the rainbow mode
specifies its highlighting using ctermfg and guifg, thereby bypassing the
-usual colorscheme control using standard highlighting groups. The actual
+usual color scheme control using standard highlighting groups. The actual
highlighting used depends on the dark/bright setting (see |'bg'|).
@@ -2365,7 +2365,7 @@ you set the variable: >
:let papp_include_html=1
-in your startup file it will try to syntax-hilight html code inside phtml
+in your startup file it will try to syntax-highlight html code inside phtml
sections, but this is relatively slow and much too colourful to be able to
edit sensibly. ;)
@@ -3118,7 +3118,7 @@ The default is to use the twice sh_minlines. Set it to a smaller number to
speed up displaying. The disadvantage is that highlight errors may appear.
syntax/sh.vim tries to flag certain problems as errors; usually things like
-extra ']'s, 'done's, 'fi's, etc. If you find the error handling problematic
+unmatched "]", "done", "fi", etc. If you find the error handling problematic
for your purposes, you may suppress such error highlighting by putting
the following line in your .vimrc: >
@@ -4838,7 +4838,7 @@ in their own color.
To customize a color scheme use another name, e.g.
"~/.config/nvim/colors/mine.vim", and use `:runtime` to
- load the original colorscheme: >
+ load the original color scheme: >
runtime colors/evening.vim
hi Statement ctermfg=Blue guifg=Blue
@@ -4846,7 +4846,7 @@ in their own color.
|ColorSchemePre| autocommand event is triggered.
After the color scheme has been loaded the
|ColorScheme| autocommand event is triggered.
- For info about writing a colorscheme file: >
+ For info about writing a color scheme file: >
:edit $VIMRUNTIME/colors/README.txt
:hi[ghlight] List all the current highlight groups that have
@@ -4935,7 +4935,7 @@ cterm={attr-list} *attr-list* *highlight-cterm* *E418*
have the same effect.
"undercurl", "underdouble", "underdotted", and "underdashed" fall back
to "underline" in a terminal that does not support them. The color is
- set using |highlight-guisp|.
+ set using |guisp|.
start={term-list} *highlight-start* *E422*
stop={term-list} *term-list* *highlight-stop*
@@ -4956,8 +4956,8 @@ stop={term-list} *term-list* *highlight-stop*
like "<Esc>" and "<Space>". Example:
start=<Esc>[27h;<Esc>[<Space>r;
-ctermfg={color-nr} *highlight-ctermfg* *E421*
-ctermbg={color-nr} *highlight-ctermbg*
+ctermfg={color-nr} *ctermfg* *E421*
+ctermbg={color-nr} *ctermbg*
The {color-nr} argument is a color number. Its range is zero to
(not including) the number of |tui-colors| available.
The actual color with this number depends on the type of terminal
@@ -5016,7 +5016,7 @@ ctermbg={color-nr} *highlight-ctermbg*
explicitly. This causes the highlight groups that depend on
'background' to change! This means you should set the colors for
Normal first, before setting other colors.
- When a colorscheme is being used, changing 'background' causes it to
+ When a color scheme is being used, changing 'background' causes it to
be reloaded, which may reset all colors (including Normal). First
delete the "g:colors_name" variable when you don't want this.
@@ -5064,9 +5064,9 @@ font={font-name} *highlight-font*
Example: >
:hi comment font='Monospace 10'
-guifg={color-name} *highlight-guifg*
-guibg={color-name} *highlight-guibg*
-guisp={color-name} *highlight-guisp*
+guifg={color-name} *guifg*
+guibg={color-name} *guibg*
+guisp={color-name} *guisp*
These give the foreground (guifg), background (guibg) and special
(guisp) color to use in the GUI. "guisp" is used for various
underlines.
@@ -5123,7 +5123,7 @@ Cursor Character under the cursor.
lCursor Character under the cursor when |language-mapping|
is used (see 'guicursor').
*hl-CursorIM*
-CursorIM Like Cursor, but used when in IME mode. |CursorIM|
+CursorIM Like Cursor, but used when in IME mode. *CursorIM*
*hl-CursorColumn*
CursorColumn Screen-column at the cursor, when 'cursorcolumn' is set.
*hl-CursorLine*
diff --git a/runtime/doc/tabpage.txt b/runtime/doc/tabpage.txt
index 9197710819..49b2773253 100644
--- a/runtime/doc/tabpage.txt
+++ b/runtime/doc/tabpage.txt
@@ -186,8 +186,8 @@ gt *i_CTRL-<PageDown>* *i_<C-PageDown>*
:+2tabnext " go to the two next tab page
:1tabnext " go to the first tab page
:$tabnext " go to the last tab page
- :tabnext # " go to the last accessed tab page
:tabnext $ " as above
+ :tabnext # " go to the last accessed tab page
:tabnext - " go to the previous tab page
:tabnext -1 " as above
:tabnext + " go to the next tab page
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index 3102c6da9a..75395e89ac 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -50,13 +50,13 @@ Whenever you need to access the current syntax tree, parse the buffer: >
tstree = tsparser:parse()
<
-This will return a table of immutable |lua-treesitter-tree|s that represent the
+This will return a table of immutable |treesitter-tree|s that represent the
current state of the buffer. When the plugin wants to access the state after a
(possible) edit it should call `parse()` again. If the buffer wasn't edited,
the same tree will be returned again without extra work. If the buffer was
parsed before, incremental parsing will be done of the changed parts.
-Note: To use the parser directly inside a |nvim_buf_attach/)| Lua callback, you
+Note: To use the parser directly inside a |nvim_buf_attach()| Lua callback, you
must call |get_parser()| before you register your callback. But preferably
parsing shouldn't be done directly in the change callback anyway as they will
be very frequent. Rather a plugin that does any kind of analysis on a tree
@@ -233,7 +233,7 @@ The following predicates are built in:
node's text.
`lua-match?` *treesitter-predicate-lua-match?*
- Match a |lua-pattern| against the text corresponding to a node,
+ Match |lua-patterns| against the text corresponding to a node,
similar to `match?`
`contains?` *treesitter-predicate-contains?*
@@ -394,7 +394,7 @@ still highlighted the same as other operators: >
"!=" @operator (#set! conceal "≠")
<
-Conceals specified in this way respect |conceallevel|.
+Conceals specified in this way respect 'conceallevel'.
*treesitter-highlight-priority*
Treesitter uses |nvim_buf_set_extmark()| to set highlights with a default
@@ -650,7 +650,7 @@ get_query({lang}, {query_name}) *get_query()*
Parameters: ~
{lang} (string) Language to use for the query
- {query_name} (string) Name of the query (e.g. 'highlights')
+ {query_name} (string) Name of the query (e.g. "highlights")
Return: ~
Query Parsed query
@@ -661,7 +661,7 @@ get_query_files({lang}, {query_name}, {is_included})
Parameters: ~
{lang} (string) Language to get query for
- {query_name} (string) Name of the query to load (e.g., 'highlights')
+ {query_name} (string) Name of the query to load (e.g., "highlights")
{is_included} (boolean|nil) Internal parameter, most of the time left
as `nil`
@@ -742,7 +742,7 @@ Query:iter_matches({self}, {node}, {source}, {start}, {stop})
Iterates the matches of self on a given range.
Iterate over all matches within a {node}. The arguments are the same as
- for |query:iter_captures()| but the iterated values are different: an
+ for |Query:iter_captures()| but the iterated values are different: an
(1-based) index of the pattern in the query, a table mapping capture
indices to nodes, and metadata from any directives processing the match.
If the query has more than one pattern, the capture table might be sparse
@@ -780,7 +780,7 @@ set_query({lang}, {query_name}, {text}) *set_query()*
Parameters: ~
{lang} (string) Language to use for the query
- {query_name} (string) Name of the query (e.g., 'highlights')
+ {query_name} (string) Name of the query (e.g., "highlights")
{text} (string) Query text (unparsed).
diff --git a/runtime/doc/ui.txt b/runtime/doc/ui.txt
index 955af84679..7ce6cd251f 100644
--- a/runtime/doc/ui.txt
+++ b/runtime/doc/ui.txt
@@ -23,40 +23,37 @@ screen grid with a size of width × height cells. This is typically done by an
embedder at startup (see |ui-startup|), but UIs can also connect to a running
Nvim instance and invoke nvim_ui_attach(). The `options` parameter is a map
with these (optional) keys:
+
*ui-rgb*
- `rgb` Decides the color format.
- true: (default) 24-bit RGB colors
- false: Terminal colors (8-bit, max 256)
+- `rgb` Decides the color format.
+ - true: (default) 24-bit RGB colors
+ - false: Terminal colors (8-bit, max 256)
*ui-override*
- `override` Decides how UI capabilities are resolved.
- true: Enable requested UI capabilities, even
- if not supported by all connected UIs
- (including |TUI|).
- false: (default) Disable UI capabilities not
- supported by all connected UIs
- (including TUI).
+- `override` Decides how UI capabilities are resolved.
+ - true: Enable requested UI capabilities, even if not
+ supported by all connected UIs (including |TUI|).
+ - false: (default) Disable UI capabilities not
+ supported by all connected UIs (including TUI).
*ui-ext-options*
- `ext_cmdline` Externalize the cmdline. |ui-cmdline|
- `ext_hlstate` Detailed highlight state. |ui-hlstate|
- Sets `ext_linegrid` implicitly.
- `ext_linegrid` Line-based grid events. |ui-linegrid|
- Deactivates |ui-grid-old| implicitly.
- `ext_messages` Externalize messages. |ui-messages|
- Sets `ext_linegrid` and `ext_cmdline` implicitly.
- `ext_multigrid` Per-window grid events. |ui-multigrid|
- Sets `ext_linegrid` implicitly.
- `ext_popupmenu` Externalize |popupmenu-completion| and
- 'wildmenu'. |ui-popupmenu|
- `ext_tabline` Externalize the tabline. |ui-tabline|
- `ext_termcolors` Use external default colors.
- `term_name` Sets the name of the terminal 'term'.
- `term_colors` Sets the number of supported colors 't_Co'.
- `term_background` Sets the default value of 'background'.
- `stdin_fd` Read buffer from `fd` as if it was a stdin pipe
- This option can only used by |--embed| ui,
- see |ui-startup-stdin|.
-
-
+- `ext_cmdline` Externalize the cmdline. |ui-cmdline|
+- `ext_hlstate` Detailed highlight state. |ui-hlstate|
+ Sets `ext_linegrid` implicitly.
+- `ext_linegrid` Line-based grid events. |ui-linegrid|
+ Deactivates |ui-grid-old| implicitly.
+- `ext_messages` Externalize messages. |ui-messages|
+ Sets `ext_linegrid` and `ext_cmdline` implicitly.
+- `ext_multigrid` Per-window grid events. |ui-multigrid|
+ Sets `ext_linegrid` implicitly.
+- `ext_popupmenu` Externalize |popupmenu-completion| and
+ 'wildmenu'. |ui-popupmenu|
+- `ext_tabline` Externalize the tabline. |ui-tabline|
+- `ext_termcolors` Use external default colors.
+- `term_name` Sets the name of the terminal 'term'.
+- `term_colors` Sets the number of supported colors 't_Co'.
+- `term_background` Sets the default value of 'background'.
+- `stdin_fd` Read buffer from `fd` as if it was a stdin pipe
+ This option can only used by |--embed| ui,
+ see |ui-startup-stdin|.
Specifying an unknown option is an error; UIs can check the |api-metadata|
`ui_options` key for supported options.
@@ -164,13 +161,13 @@ Global Events *ui-global*
The following UI events are always emitted, and describe global state of
the editor.
-["set_title", title]
-["set_icon", icon]
+["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.
-["mode_info_set", cursor_style_enabled, mode_info]
+["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`
@@ -197,21 +194,21 @@ the editor.
`hl_id`: Use `attr_id` instead.
`hl_lm`: Use `attr_id_lm` instead.
-["option_set", name, value]
+["option_set", name, value] ~
UI-related option changed, where `name` is one of:
- 'arabicshape'
- 'ambiwidth'
- 'emoji'
- 'guifont'
- 'guifontwide'
- 'linespace'
- 'mousefocus'
- 'mousemoveevent'
- 'pumblend'
- 'showtabline'
- 'termguicolors'
- "ext_*" (all |ui-ext-options|)
+ - 'arabicshape'
+ - 'ambiwidth'
+ - 'emoji'
+ - 'guifont'
+ - 'guifontwide'
+ - 'linespace'
+ - 'mousefocus'
+ - 'mousemoveevent'
+ - 'pumblend'
+ - 'showtabline'
+ - 'termguicolors'
+ - "ext_*" (all |ui-ext-options|)
Triggered when the UI first connects to Nvim, and whenever an option
is changed by the user or a plugin.
@@ -224,7 +221,7 @@ the editor.
however a UI might still use such options when rendering raw text
sent from Nvim, like for |ui-cmdline|.
-["mode_change", mode, mode_idx]
+["mode_change", mode, mode_idx] ~
Editor mode changed. The `mode` parameter is a string representing
the current mode. `mode_idx` is an index into the array emitted in
the `mode_info_set` event. UIs should change the cursor style
@@ -233,30 +230,30 @@ the editor.
instance more submodes and temporary states might be represented as
separate modes.
-["mouse_on"]
-["mouse_off"]
+["mouse_on"] ~
+["mouse_off"] ~
'mouse' was enabled/disabled in the current editor mode. Useful for
a terminal UI, or embedding into an application where Nvim mouse would
conflict with other usages of the mouse. Other UI:s may ignore this event.
-["busy_start"]
-["busy_stop"]
+["busy_start"] ~
+["busy_stop"] ~
Indicates to the UI that it must stop rendering the cursor. This event
is misnamed and does not actually have anything to do with busyness.
-["suspend"]
+["suspend"] ~
|:suspend| command or |CTRL-Z| mapping is used. A terminal client (or
another client where it makes sense) could suspend itself. Other
clients can safely ignore it.
-["update_menu"]
+["update_menu"] ~
The menu mappings changed.
-["bell"]
-["visual_bell"]
+["bell"] ~
+["visual_bell"] ~
Notify the user with an audible or visual bell, respectively.
-["flush"]
+["flush"] ~
Nvim is done redrawing the screen. For an implementation that renders
to an internal buffer, this is the time to display the redrawn parts
to the user.
@@ -279,11 +276,11 @@ be created; to enable per-window grids, activate |ui-multigrid|.
Highlight attribute groups are predefined. UIs should maintain a table to map
numerical highlight ids to the actual attributes.
-["grid_resize", grid, width, height]
+["grid_resize", grid, width, height] ~
Resize a `grid`. If `grid` wasn't seen by the client before, a new grid is
being created with this size.
-["default_colors_set", rgb_fg, rgb_bg, rgb_sp, cterm_fg, cterm_bg]
+["default_colors_set", rgb_fg, rgb_bg, rgb_sp, cterm_fg, cterm_bg] ~
The first three arguments set the default foreground, background and
special colors respectively. `cterm_fg` and `cterm_bg` specifies the
default color codes to use in a 256-color terminal.
@@ -300,7 +297,7 @@ numerical highlight ids to the actual attributes.
screen with changed background color itself.
*ui-event-hl_attr_define*
-["hl_attr_define", id, rgb_attr, cterm_attr, info]
+["hl_attr_define", id, rgb_attr, cterm_attr, info] ~
Add a highlight with `id` to the highlight table, with the
attributes specified by the `rgb_attr` and `cterm_attr` dicts, with the
following (all optional) keys.
@@ -346,7 +343,7 @@ numerical highlight ids to the actual attributes.
`info` is an empty array by default, and will be used by the
|ui-hlstate| extension explained below.
-["hl_group_set", name, hl_id]
+["hl_group_set", name, hl_id] ~
The bulitin highlight group `name` was set to use the attributes `hl_id`
defined by a previous `hl_attr_define` call. This event is not needed
to render the grids which use attribute ids directly, but is useful
@@ -355,7 +352,7 @@ numerical highlight ids to the actual attributes.
use the |hl-Pmenu| family of builtin highlights.
*ui-event-grid_line*
-["grid_line", grid, row, col_start, cells]
+["grid_line", grid, row, col_start, cells] ~
Redraw a continuous part of a `row` on a `grid`, starting at the column
`col_start`. `cells` is an array of arrays each with 1 to 3 items:
`[text(, hl_id, repeat)]` . `text` is the UTF-8 text that should be put in
@@ -374,19 +371,19 @@ numerical highlight ids to the actual attributes.
enough to cover the remaining line, will be sent when the rest of the
line should be cleared.
-["grid_clear", grid]
+["grid_clear", grid] ~
Clear a `grid`.
-["grid_destroy", grid]
+["grid_destroy", grid] ~
`grid` will not be used anymore and the UI can free any data associated
with it.
-["grid_cursor_goto", grid, row, column]
+["grid_cursor_goto", grid, row, column] ~
Makes `grid` the current grid and `row, column` the cursor position on this
grid. This event will be sent at most once in a `redraw` batch and
indicates the visible cursor position.
-["grid_scroll", grid, top, bot, left, right, rows, cols]
+["grid_scroll", grid, top, bot, left, right, rows, cols] ~
Scroll a region of `grid`. This is semantically unrelated to editor
|scrolling|, rather this is an optimized way to say "copy these screen
cells".
@@ -439,30 +436,30 @@ Grid Events (cell-based) *ui-grid-old*
This is the legacy representation of the screen grid, emitted if |ui-linegrid|
is not active. New UIs should implement |ui-linegrid| instead.
-["resize", width, height]
+["resize", width, height] ~
The grid is resized to `width` and `height` cells.
-["clear"]
+["clear"] ~
Clear the grid.
-["eol_clear"]
+["eol_clear"] ~
Clear from the cursor position to the end of the current line.
-["cursor_goto", row, col]
+["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]
+["update_fg", color] ~
+["update_bg", color] ~
+["update_sp", color] ~
Set the default foreground, background and special colors
respectively.
*ui-event-highlight_set*
-["highlight_set", attrs]
+["highlight_set", attrs] ~
Set the attributes that the next text put on the grid 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
@@ -482,18 +479,18 @@ is not active. New UIs should implement |ui-linegrid| instead.
`underdotted`: underdotted text. The dots have `special` color.
`underdashed`: underdashed text. The dashes have `special` color.
-["put", text]
+["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]
+["set_scroll_region", top, bot, left, right] ~
Define the scroll region used by `scroll` below.
Note: ranges are end-inclusive, which is inconsistent with API
conventions.
-["scroll", count]
+["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.
@@ -576,7 +573,7 @@ The multigrid extension gives UIs more control over how windows are displayed:
per-window. Or reserve space around the border of the window for its own
elements, such as scrollbars from the UI toolkit.
- A dedicated grid is used for messages, which may scroll over the window
- area. (Alternatively |ext_messages| can be used).
+ area. (Alternatively |ui-messages| can be used).
By default, the grid size is handled by Nvim and set to the outer grid size
(i.e. the size of the window frame in Nvim) whenever the split is created.
@@ -588,29 +585,29 @@ A window can be hidden and redisplayed without its grid being deallocated.
This can happen multiple times for the same window, for instance when switching
tabs.
-["win_pos", grid, win, start_row, start_col, width, height]
+["win_pos", grid, win, start_row, start_col, width, height] ~
Set the position and size of the grid in Nvim (i.e. the outer grid
size). If the window was previously hidden, it should now be shown
again.
-["win_float_pos", grid, win, anchor, anchor_grid, anchor_row, anchor_col, focusable]
+["win_float_pos", grid, win, anchor, anchor_grid, anchor_row, anchor_col, focusable] ~
Display or reconfigure floating window `win`. The window should be
displayed above another grid `anchor_grid` at the specified position
`anchor_row` and `anchor_col`. For the meaning of `anchor` and more
details of positioning, see |nvim_open_win()|.
-["win_external_pos", grid, win]
+["win_external_pos", grid, win] ~
Display or reconfigure external window `win`. The window should be
displayed as a separate top-level window in the desktop environment,
or something similar.
-["win_hide", grid]
+["win_hide", grid] ~
Stop displaying the window. The window can be shown again later.
-["win_close", grid]
+["win_close", grid] ~
Close the window.
-["msg_set_pos", grid, row, scrolled, sep_char]
+["msg_set_pos", grid, row, scrolled, sep_char] ~
Display messages on `grid`. The grid will be displayed at `row` on the
default grid (grid=1), covering the full column width. `scrolled`
indicates whether the message area has been scrolled to cover other
@@ -618,16 +615,16 @@ tabs.
flag). The Builtin TUI draws a full line filled with `sep_char` and
|hl-MsgSeparator| highlight.
- When |ext_messages| is active, no message grid is used, and this event
+ When |ui-messages| is active, no message grid is used, and this event
will not be sent.
-["win_viewport", grid, win, topline, botline, curline, curcol]
+["win_viewport", grid, win, topline, botline, curline, curcol] ~
Indicates the range of buffer text displayed in the window, as well
as the cursor position in the buffer. All positions are zero-based.
`botline` is set to one more than the line count of the buffer, if
there are filler lines past the end.
-["win_extmark", grid, win, ns_id, mark_id, row, col]
+["win_extmark", grid, win, ns_id, mark_id, row, col] ~
Updates the position of an extmark which is currently visible in a
window. Only emitted if the mark has the `ui_watched` attribute.
@@ -639,7 +636,7 @@ Activated by the `ext_popupmenu` |ui-option|.
This UI extension delegates presentation of the |popupmenu-completion| and
command-line 'wildmenu'.
-["popupmenu_show", items, selected, row, col, grid]
+["popupmenu_show", items, selected, row, col, grid] ~
Show |popupmenu-completion|. `items` is an array of completion items
to show; each item is an array of the form [word, kind, menu, info] as
defined at |complete-items|, except that `word` is replaced by `abbr`
@@ -651,12 +648,12 @@ command-line 'wildmenu'.
set to -1 to indicate the popupmenu should be anchored to the external
cmdline. Then `col` will be a byte position in the cmdline text.
-["popupmenu_select", selected]
+["popupmenu_select", selected] ~
Select an item in the current popupmenu. `selected` is a zero-based
index into the array of items from the last popupmenu_show event, or
-1 if no item is selected.
-["popupmenu_hide"]
+["popupmenu_hide"] ~
Hide the popupmenu.
==============================================================================
@@ -664,7 +661,7 @@ Tabline Events *ui-tabline*
Activated by the `ext_tabline` |ui-option|.
-["tabline_update", curtab, tabs, curbuf, buffers]
+["tabline_update", curtab, tabs, curbuf, buffers] ~
Tabline was updated. UIs should present this data in a custom tabline
widget. Note: options `curbuf` + `buffers` were added in API7.
curtab: Current Tabpage
@@ -680,7 +677,7 @@ Activated by the `ext_cmdline` |ui-option|.
This UI extension delegates presentation of the |cmdline| (except 'wildmenu').
For command-line 'wildmenu' UI events, activate |ui-popupmenu|.
-["cmdline_show", content, pos, firstc, prompt, indent, level]
+["cmdline_show", content, pos, firstc, prompt, indent, level] ~
content: List of [attrs, string]
[[{}, "t"], [attrs, "est"], ...]
@@ -703,10 +700,10 @@ For command-line 'wildmenu' UI events, activate |ui-popupmenu|.
prompt has level 2. A command line invoked from the |cmdline-window|
has a higher level than than the edited command line.
-["cmdline_pos", pos, level]
+["cmdline_pos", pos, level] ~
Change the cursor position in the cmdline.
-["cmdline_special_char", c, shift, level]
+["cmdline_special_char", c, shift, level] ~
Display a special char in the cmdline at the cursor position. This is
typically used to indicate a pending state, e.g. after |c_CTRL-V|. If
`shift` is true the text after the cursor should be shifted, otherwise
@@ -714,10 +711,10 @@ For command-line 'wildmenu' UI events, activate |ui-popupmenu|.
Should be hidden at next cmdline_show.
-["cmdline_hide"]
+["cmdline_hide"] ~
Hide the cmdline.
-["cmdline_block_show", lines]
+["cmdline_block_show", lines] ~
Show a block of context to the current command line. For example if
the user defines a |:function| interactively: >
:function Foo()
@@ -727,10 +724,10 @@ For command-line 'wildmenu' UI events, activate |ui-popupmenu|.
`lines` is a list of lines of highlighted chunks, in the same form as
the "cmdline_show" `contents` parameter.
-["cmdline_block_append", line]
+["cmdline_block_append", line] ~
Append a line at the end of the currently shown block.
-["cmdline_block_hide"]
+["cmdline_block_hide"] ~
Hide the block.
==============================================================================
@@ -747,7 +744,7 @@ Nvim will not allocate screen space for the cmdline or messages, and
'cmdheight' will be forced zero. Cmdline state is emitted as |ui-cmdline|
events, which the UI must handle.
-["msg_show", kind, content, replace_last]
+["msg_show", kind, content, replace_last] ~
Display a message to the user.
kind
@@ -781,25 +778,25 @@ events, which the UI must handle.
true: Replace the message in the most-recent `msg_show` call,
but any other visible message should still remain.
-["msg_clear"]
+["msg_clear"] ~
Clear all messages currently displayed by "msg_show". (Messages sent
by other "msg_" events below will not be affected).
-["msg_showmode", content]
+["msg_showmode", content] ~
Shows 'showmode' and |recording| messages. `content` has the same
format as in "msg_show". This event is sent with empty `content` to
hide the last message.
-["msg_showcmd", content]
+["msg_showcmd", content] ~
Shows 'showcmd' messages. `content` has the same format as in "msg_show".
This event is sent with empty `content` to hide the last message.
-["msg_ruler", content]
+["msg_ruler", content] ~
Used to display 'ruler' when there is no space for the ruler in a
statusline. `content` has the same format as in "msg_show". This event is
sent with empty `content` to hide the last message.
-["msg_history_show", entries]
+["msg_history_show", entries] ~
Sent when |:messages| command is invoked. History is sent as a list of
entries, where each entry is a `[kind, content]` tuple.
diff --git a/runtime/doc/userfunc.txt b/runtime/doc/userfunc.txt
index c015b12c27..5462fa952c 100644
--- a/runtime/doc/userfunc.txt
+++ b/runtime/doc/userfunc.txt
@@ -214,7 +214,7 @@ It is allowed to define another function inside a function body.
You can provide default values for positional named arguments. This makes
them optional for function calls. When a positional argument is not
specified at a call, the default expression is used to initialize it.
-This only works for functions declared with |function|, not for
+This only works for functions declared with `:function`, not for
lambda expressions |expr-lambda|.
Example: >
@@ -422,8 +422,7 @@ Also note that if you have two script files, and one calls a function in the
other and vice versa, before the used function is defined, it won't work.
Avoid using the autoload functionality at the toplevel.
-Hint: If you distribute a bunch of scripts you can pack them together with the
-|vimball| utility. Also read the user manual |distribute-script|.
+Hint: If you distribute a bunch of scripts read |distribute-script|.
vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/usr_22.txt b/runtime/doc/usr_22.txt
index f53d578456..539bda3980 100644
--- a/runtime/doc/usr_22.txt
+++ b/runtime/doc/usr_22.txt
@@ -220,7 +220,7 @@ a tab page share this directory except for windows with a window-local
directory. Any new windows opened in this tab page will use this directory as
the current working directory. Using a `:cd` command in a tab page will not
change the working directory of tab pages which have a tab local directory.
-When the global working directory is changed using the ":cd" command in a tab
+When the global working directory is changed using the `:cd` command in a tab
page, it will also change the current tab page working directory.
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index 1aa9aaa0c4..fb9d59f885 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -1016,6 +1016,7 @@ Testing: *test-functions*
assert_beeps() assert that a command beeps
assert_nobeep() assert that a command does not cause a beep
assert_fails() assert that a command fails
+ assert_report() report a test failure
Timers: *timer-functions*
timer_start() create a timer
@@ -1710,7 +1711,7 @@ There is a little "catch" with comments for some commands. Examples: >
:execute cmd " do it
:!ls *.c " list C files
-The abbreviation 'dev' will be expanded to 'development " shorthand'. The
+The abbreviation "dev" will be expanded to 'development " shorthand'. The
mapping of <F3> will actually be the whole line after the 'o# ....' including
the '" insert include'. The "execute" command will give an error. The "!"
command will send everything after it to the shell, causing an error for an
@@ -1761,7 +1762,7 @@ does not exist as a mapped sequence. An error will be issued, which is very
hard to identify, because the ending whitespace character in ":unmap ,ab " is
not visible.
-And this is the same as what happens when one uses a comment after an 'unmap'
+And this is the same as what happens when one uses a comment after an "unmap"
command: >
:unmap ,ab " comment
diff --git a/runtime/doc/usr_45.txt b/runtime/doc/usr_45.txt
index 3199c4d8ea..0d23ef50fd 100644
--- a/runtime/doc/usr_45.txt
+++ b/runtime/doc/usr_45.txt
@@ -300,8 +300,7 @@ can use digraphs. This was already explained in |24.9|.
keyboard, you will want to use an Input Method (IM). This requires learning
the translation from typed keys to resulting character. When you need an IM
you probably already have one on your system. It should work with Vim like
-with other programs. For details see |mbyte-XIM| for the X Window system and
-|mbyte-IME| for MS-Windows.
+with other programs.
KEYMAPS
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index e254e5edd0..672d064478 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -417,8 +417,8 @@ Normal commands:
Options:
'ttimeout', 'ttimeoutlen' behavior was simplified
- |jumpoptions| "stack" behavior
- |jumpoptions| "view" tries to restore the |mark-view| when moving through
+ 'jumpoptions' "stack" behavior
+ 'jumpoptions' "view" tries to restore the |mark-view| when moving through
the |jumplist|, |changelist|, |alternate-file| or using |mark-motions|.
'shortmess' the "F" flag does not affect output from autocommands
@@ -498,13 +498,16 @@ Working directory (Vim implemented some of these later than Nvim):
==============================================================================
5. Missing legacy features *nvim-features-missing*
-Some legacy Vim features are not implemented:
+Some legacy Vim features are not yet implemented:
-- |if_lua|: Nvim Lua API is not compatible with Vim's "if_lua"
+- *if_lua* : Nvim |Lua| API is not compatible with Vim's "if_lua"
- *if_mzscheme*
-- |if_py|: *python-bindeval* *python-Function* are not supported
+- |if_pyth|: *python-bindeval* *python-Function* are not supported
- *if_tcl*
+*:gui*
+*:gvim*
+
==============================================================================
6. Removed features *nvim-features-removed*
@@ -566,18 +569,18 @@ Highlight groups:
<
Options:
- 'antialias'
+ antialias
*'balloondelay'* *'bdlay'*
*'ballooneval'* *'beval'* *'noballooneval'* *'nobeval'*
*'balloonexpr'* *'bexpr'*
- 'bioskey' (MS-DOS)
- 'conskey' (MS-DOS)
+ bioskey (MS-DOS)
+ conskey (MS-DOS)
*'cp'* *'nocompatible'* *'nocp'* *'compatible'* (Nvim is always "nocompatible".)
'cpoptions' (gjkHw<*- and all POSIX flags were removed)
*'cryptmethod'* *'cm'* *'key'* (Vim encryption implementation)
*'ed'* *'edcompatible'* *'noed'* *'noedcompatible'*
'encoding' ("utf-8" is always used)
- 'esckeys'
+ esckeys
'guioptions' "t" flag was removed
*'guifontset'* *'gfs'* (Use 'guifont' instead.)
*'guipty'* (Nvim uses pipes and PTYs consistently on all platforms.)
@@ -618,18 +621,18 @@ Options:
Nvim always displays up to 6 combining characters. You can still edit
text with more than 6 combining characters, you just can't see them.
Use |g8| or |ga|. See |mbyte-combining|.
- 'maxmem' Nvim delegates memory-management to the OS.
- 'maxmemtot' Nvim delegates memory-management to the OS.
+ *'maxmem'* Nvim delegates memory-management to the OS.
+ *'maxmemtot'* Nvim delegates memory-management to the OS.
*'prompt'* *'noprompt'*
*'remap'* *'noremap'*
*'restorescreen'* *'rs'* *'norestorescreen'* *'nors'*
- 'shelltype'
+ *'shelltype'*
*'shortname'* *'sn'* *'noshortname'* *'nosn'*
*'swapsync'* *'sws'*
*'termencoding'* *'tenc'* (Vim 7.4.852 also removed this for Windows)
*'terse'* *'noterse'* (Add "s" to 'shortmess' instead)
- 'textauto'
- 'textmode'
+ textauto
+ textmode
*'toolbar'* *'tb'*
*'toolbariconsize'* *'tbis'*
*'ttybuiltin'* *'tbi'* *'nottybuiltin'* *'notbi'*
@@ -637,7 +640,7 @@ Options:
*'ttymouse'* *'ttym'*
*'ttyscroll'* *'tsl'*
*'ttytype'* *'tty'*
- 'weirdinvert'
+ weirdinvert
Startup:
--literal (file args are always literal; to expand wildcards on Windows, use
diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt
index 6386e4ace1..45cedd2cd8 100644
--- a/runtime/doc/windows.txt
+++ b/runtime/doc/windows.txt
@@ -119,7 +119,7 @@ windows.
*filler-lines*
The lines after the last buffer line in a window are called filler lines. By
-default, these lines start with a tilde (~) character. The 'eob' item in the
+default, these lines start with a tilde (~) character. The "eob" item in the
'fillchars' option can be used to change this character. By default, these
characters are highlighted as NonText (|hl-NonText|). The EndOfBuffer
highlight group (|hl-EndOfBuffer|) can be used to change the highlighting of
@@ -148,7 +148,7 @@ CTRL-W CTRL-S *CTRL-W_CTRL-S*
Note: CTRL-S does not work on all terminals and might block
further input, use CTRL-Q to get going again.
Also see |++opt| and |+cmd|.
- *E242*
+ *E242* *E1159*
Be careful when splitting a window in an autocommand, it may
mess up the window layout if this happens while making other
window layout changes.
@@ -291,9 +291,8 @@ Closing a window
:{count}q[uit] *:count_quit*
CTRL-W q *CTRL-W_q*
CTRL-W CTRL-Q *CTRL-W_CTRL-Q*
- Without {count}: Quit the current window. If {count} is
- given quit the {count} window
-
+ Without {count}: Quit the current window. If {count} is
+ given quit the {count} window.
*edit-window*
When quitting the last edit window (not counting help or
preview windows), exit Vim.
@@ -352,7 +351,7 @@ CTRL-W CTRL-C *CTRL-W_CTRL-C*
window, but that does not work, because the CTRL-C cancels the
command.
- *:hide*
+ *:hide*
:hid[e]
:{count}hid[e]
Without {count}: Quit the current window, unless it is the
@@ -751,6 +750,7 @@ can also get to them with the buffer list commands, like ":bnext".
the current window.
{cmd} can contain '|' to concatenate several commands.
{cmd} must not open or close windows or reorder them.
+
Also see |:tabdo|, |:argdo|, |:bufdo|, |:cdo|, |:ldo|,
|:cfdo| and |:lfdo|.
@@ -778,6 +778,7 @@ can also get to them with the buffer list commands, like ":bnext".
autocommand event is disabled by adding it to
'eventignore'. This considerably speeds up editing
each buffer.
+
Also see |:tabdo|, |:argdo|, |:windo|, |:cdo|, |:ldo|,
|:cfdo| and |:lfdo|.
diff --git a/runtime/filetype.lua b/runtime/filetype.lua
index c50ba6453d..ee9d5a0a75 100644
--- a/runtime/filetype.lua
+++ b/runtime/filetype.lua
@@ -14,10 +14,14 @@ vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile', 'StdinReadPost' }, {
-- Generic configuration file used as fallback
ft = require('vim.filetype.detect').conf(args.file, args.buf)
if ft then
- vim.api.nvim_cmd({ cmd = 'setf', args = { 'FALLBACK', ft } }, {})
+ vim.api.nvim_buf_call(args.buf, function()
+ vim.api.nvim_cmd({ cmd = 'setf', args = { 'FALLBACK', ft } }, {})
+ end)
end
else
- vim.api.nvim_buf_set_option(args.buf, 'filetype', ft)
+ vim.api.nvim_buf_call(args.buf, function()
+ vim.api.nvim_cmd({ cmd = 'setf', args = { ft } }, {})
+ end)
if on_detect then
on_detect(args.buf)
end
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 11536adf69..475dafb9e9 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2022 Sep 11
+" Last Change: 2022 Sep 27
" Only run this if enabled
if !exists("do_legacy_filetype")
@@ -771,8 +771,8 @@ au BufNewFile,BufRead gitolite.conf setf gitolite
au BufNewFile,BufRead {,.}gitolite.rc,example.gitolite.rc setf perl
" Glimmer-flavored TypeScript and JavaScript
-au BufNewFile,BufRead *.gts setf typescript.glimmer
-au BufNewFile,BufRead *.gjs setf javascript.glimmer
+au BufNewFile,BufRead *.gts setf typescript.glimmer
+au BufNewFile,BufRead *.gjs setf javascript.glimmer
" Gnuplot scripts
au BufNewFile,BufRead *.gpi,.gnuplot setf gnuplot
@@ -803,6 +803,9 @@ au BufNewFile,BufRead */etc/group,*/etc/group-,*/etc/group.edit,*/etc/gshadow,*/
" GTK RC
au BufNewFile,BufRead .gtkrc,gtkrc setf gtkrc
+" GYP
+au BufNewFile,BufRead *.gyp,*.gypi setf gyp
+
" Hack
au BufRead,BufNewFile *.hack,*.hackpartial setf hack
@@ -1027,6 +1030,9 @@ au BufNewFile,BufRead Kconfig,Kconfig.debug setf kconfig
" Lace (ISE)
au BufNewFile,BufRead *.ace,*.ACE setf lace
+" Latexmkrc
+au BufNewFile,BufRead .latexmkrc,latexmkrc setf perl
+
" Latte
au BufNewFile,BufRead *.latte,*.lte setf latte
@@ -1107,6 +1113,9 @@ au BufNewFile,BufRead *.lou,*.lout setf lout
" Lua
au BufNewFile,BufRead *.lua setf lua
+" Luacheck
+au BufNewFile,BufRead .luacheckrc setf lua
+
" Luarocks
au BufNewFile,BufRead *.rockspec setf lua
@@ -2084,7 +2093,7 @@ au BufNewFile,BufReadPost *.tutor setf tutor
" TWIG files
au BufNewFile,BufReadPost *.twig setf twig
-" Typescript or Qt translation file (which is XML)
+" TypeScript or Qt translation file (which is XML)
au BufNewFile,BufReadPost *.ts
\ if getline(1) =~ '<?xml' |
\ setf xml |
@@ -2092,6 +2101,9 @@ au BufNewFile,BufReadPost *.ts
\ setf typescript |
\ endif
+" TypeScript module and common
+au BufNewFile,BufRead *.mts,*.cts setf typescript
+
" TypeScript with React
au BufNewFile,BufRead *.tsx setf typescriptreact
@@ -2283,7 +2295,7 @@ au BufNewFile,BufRead *.fsproj,*.fsproj.user setf xml
au BufNewFile,BufRead *.vbproj,*.vbproj.user setf xml
" Qt Linguist translation source and Qt User Interface Files are XML
-" However, for .ts Typescript is more common.
+" However, for .ts TypeScript is more common.
au BufNewFile,BufRead *.ui setf xml
" TPM's are RDF-based descriptions of TeX packages (Nikolai Weibull)
diff --git a/runtime/ftplugin/chatito.vim b/runtime/ftplugin/chatito.vim
new file mode 100644
index 0000000000..af212e9581
--- /dev/null
+++ b/runtime/ftplugin/chatito.vim
@@ -0,0 +1,15 @@
+" Vim filetype plugin
+" Language: Chatito
+" Maintainer: ObserverOfTime <chronobserver@disroot.org>
+" Last Change: 2022 Sep 19
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setlocal comments=:#,:// commentstring=#\ %s
+" indent of 4 spaces is mandated by the spec
+setlocal expandtab softtabstop=4 shiftwidth=4
+
+let b:undo_ftplugin = 'setl com< cms< et< sts< sw<'
diff --git a/runtime/ftplugin/elixir.vim b/runtime/ftplugin/elixir.vim
index c423c2acb7..50f63673dc 100644
--- a/runtime/ftplugin/elixir.vim
+++ b/runtime/ftplugin/elixir.vim
@@ -1,7 +1,7 @@
" Elixir filetype plugin
" Language: Elixir
" Maintainer: Mitchell Hanberg <vimNOSPAM@mitchellhanberg.com>
-" Last Change: 2022 August 10
+" Last Change: 2022 Sep 20
if exists("b:did_ftplugin")
finish
@@ -23,7 +23,11 @@ if exists('loaded_matchit') && !exists('b:match_words')
\ ',{:},\[:\],(:)'
endif
+setlocal shiftwidth=2 softtabstop=2 expandtab iskeyword+=!,?
+setlocal comments=:#
setlocal commentstring=#\ %s
+let b:undo_ftplugin = 'setlocal sw< sts< et< isk< com< cms<'
+
let &cpo = s:save_cpo
unlet s:save_cpo
diff --git a/runtime/ftplugin/gyp.vim b/runtime/ftplugin/gyp.vim
new file mode 100644
index 0000000000..becfcadb6d
--- /dev/null
+++ b/runtime/ftplugin/gyp.vim
@@ -0,0 +1,14 @@
+" Vim filetype plugin
+" Language: GYP
+" Maintainer: ObserverOfTime <chronobserver@disroot.org>
+" Last Change: 2022 Sep 27
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setlocal formatoptions-=t
+setlocal commentstring=#\ %s comments=b:#,fb:-
+
+let b:undo_ftplugin = 'setlocal fo< cms< com<'
diff --git a/runtime/ftplugin/hare.vim b/runtime/ftplugin/hare.vim
new file mode 100644
index 0000000000..bb10daf38c
--- /dev/null
+++ b/runtime/ftplugin/hare.vim
@@ -0,0 +1,27 @@
+" Vim filetype plugin
+" Language: Hare
+" Maintainer: Amelia Clarke <me@rsaihe.dev>
+" Previous Maintainer: Drew DeVault <sir@cmpwn.com>
+" Last Updated: 2022-09-21
+
+" Only do this when not done yet for this buffer
+if exists('b:did_ftplugin')
+ finish
+endif
+
+" Don't load another plugin for this buffer
+let b:did_ftplugin = 1
+
+setlocal noexpandtab
+setlocal tabstop=8
+setlocal shiftwidth=0
+setlocal softtabstop=0
+setlocal textwidth=80
+setlocal commentstring=//\ %s
+
+" Set 'formatoptions' to break comment lines but not other lines,
+" and insert the comment leader when hitting <CR> or using "o".
+setlocal fo-=t fo+=croql
+
+compiler hare
+" vim: tabstop=2 shiftwidth=2 expandtab
diff --git a/runtime/ftplugin/heex.vim b/runtime/ftplugin/heex.vim
new file mode 100644
index 0000000000..5274d59fbf
--- /dev/null
+++ b/runtime/ftplugin/heex.vim
@@ -0,0 +1,16 @@
+" Elixir filetype plugin
+" Language: HEEx
+" Maintainer: Mitchell Hanberg <vimNOSPAM@mitchellhanberg.com>
+" Last Change: 2022 Sep 21
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
+
+setlocal shiftwidth=2 softtabstop=2 expandtab
+
+setlocal comments=:<%!--
+setlocal commentstring=<%!--\ %s\ --%>
+
+let b:undo_ftplugin = 'set sw< sts< et< com< cms<'
diff --git a/runtime/indent/chatito.vim b/runtime/indent/chatito.vim
new file mode 100644
index 0000000000..1ff5e9e3f1
--- /dev/null
+++ b/runtime/indent/chatito.vim
@@ -0,0 +1,32 @@
+" Vim indent file
+" Language: Chatito
+" Maintainer: ObserverOfTime <chronobserver@disroot.org>
+" Last Change: 2022 Sep 20
+
+if exists('b:did_indent')
+ finish
+endif
+let b:did_indent = 1
+
+setlocal indentexpr=GetChatitoIndent()
+setlocal indentkeys=o,O,*<Return>,0#,!^F
+
+let b:undo_indent = 'setl inde< indk<'
+
+if exists('*GetChatitoIndent')
+ finish
+endif
+
+function GetChatitoIndent()
+ let l:prev = v:lnum - 1
+ if getline(prevnonblank(l:prev)) =~# '^[~%@]\['
+ " shift indent after definitions
+ return shiftwidth()
+ elseif getline(l:prev) !~# '^\s*$'
+ " maintain indent in sentences
+ return indent(l:prev)
+ else
+ " reset indent after a blank line
+ return 0
+ end
+endfunction
diff --git a/runtime/indent/gyp.vim b/runtime/indent/gyp.vim
new file mode 100644
index 0000000000..c3980ac568
--- /dev/null
+++ b/runtime/indent/gyp.vim
@@ -0,0 +1,7 @@
+" Vim indent file
+" Language: GYP
+" Maintainer: ObserverOfTime <chronobserver@disroot.org>
+" Last Change: 2022 Sep 27
+
+" JSON indent works well
+runtime! indent/json.vim
diff --git a/runtime/indent/hare.vim b/runtime/indent/hare.vim
new file mode 100644
index 0000000000..bc4fea4e61
--- /dev/null
+++ b/runtime/indent/hare.vim
@@ -0,0 +1,138 @@
+" Vim indent file
+" Language: Hare
+" Maintainer: Amelia Clarke <me@rsaihe.dev>
+" Last Change: 2022 Sep 22
+
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+if !has("cindent") || !has("eval")
+ finish
+endif
+
+setlocal cindent
+
+" L0 -> don't deindent labels
+" (s -> use one indent after a trailing (
+" m1 -> if ) starts a line, indent it the same as its matching (
+" ks -> add an extra indent to extra lines in an if expression or for expression
+" j1 -> indent code inside {} one level when in parentheses
+" J1 -> see j1
+" *0 -> don't search for unclosed block comments
+" #1 -> don't deindent lines that begin with #
+setlocal cinoptions=L0,(s,m1,ks,j1,J1,*0,#1
+
+" Controls which keys reindent the current line.
+" 0{ -> { at beginning of line
+" 0} -> } at beginning of line
+" 0) -> ) at beginning of line
+" 0] -> ] at beginning of line
+" !^F -> <C-f> (not inserted)
+" o -> <CR> or `o` command
+" O -> `O` command
+" e -> else
+" 0=case -> case
+setlocal indentkeys=0{,0},0),0],!^F,o,O,e,0=case
+
+setlocal cinwords=if,else,for,switch,match
+
+setlocal indentexpr=GetHareIndent()
+
+function! FloorCindent(lnum)
+ return cindent(a:lnum) / shiftwidth() * shiftwidth()
+endfunction
+
+function! GetHareIndent()
+ let line = getline(v:lnum)
+ let prevlnum = prevnonblank(v:lnum - 1)
+ let prevline = getline(prevlnum)
+ let prevprevline = getline(prevnonblank(prevlnum - 1))
+
+ " This is all very hacky and imperfect, but it's tough to do much better when
+ " working with regex-based indenting rules.
+
+ " If the previous line ended with =, indent by one shiftwidth.
+ if prevline =~# '\v\=\s*(//.*)?$'
+ return indent(prevlnum) + shiftwidth()
+ endif
+
+ " If the previous line ended in a semicolon and the line before that ended
+ " with =, deindent by one shiftwidth.
+ if prevline =~# '\v;\s*(//.*)?$' && prevprevline =~# '\v\=\s*(//.*)?$'
+ return indent(prevlnum) - shiftwidth()
+ endif
+
+ " TODO: The following edge-case is still indented incorrectly:
+ " case =>
+ " if (foo) {
+ " bar;
+ " };
+ " | // cursor is incorrectly deindented by one shiftwidth.
+ "
+ " This only happens if the {} block is the first statement in the case body.
+ " If `case` is typed, the case will also be incorrectly deindented by one
+ " shiftwidth. Are you having fun yet?
+
+ " Deindent cases.
+ if line =~# '\v^\s*case'
+ " If the previous line was also a case, don't do any special indenting.
+ if prevline =~# '\v^\s*case'
+ return indent(prevlnum)
+ end
+
+ " If the previous line was a multiline case, deindent by one shiftwidth.
+ if prevline =~# '\v\=\>\s*(//.*)?$'
+ return indent(prevlnum) - shiftwidth()
+ endif
+
+ " If the previous line started a block, deindent by one shiftwidth.
+ " This handles the first case in a switch/match block.
+ if prevline =~# '\v\{\s*(//.*)?$'
+ return FloorCindent(v:lnum) - shiftwidth()
+ end
+
+ " If the previous line ended in a semicolon and the line before that wasn't
+ " a case, deindent by one shiftwidth.
+ if prevline =~# '\v;\s*(//.*)?$' && prevprevline !~# '\v\=\>\s*(//.*)?$'
+ return FloorCindent(v:lnum) - shiftwidth()
+ end
+
+ let l:indent = FloorCindent(v:lnum)
+
+ " If a normal cindent would indent the same amount as the previous line,
+ " deindent by one shiftwidth. This fixes some issues with `case let` blocks.
+ if l:indent == indent(prevlnum)
+ return l:indent - shiftwidth()
+ endif
+
+ " Otherwise, do a normal cindent.
+ return l:indent
+ endif
+
+ " Don't indent an extra shiftwidth for cases which span multiple lines.
+ if prevline =~# '\v\=\>\s*(//.*)?$' && prevline !~# '\v^\s*case\W'
+ return indent(prevlnum)
+ endif
+
+ " Indent the body of a case.
+ " If the previous line ended in a semicolon and the line before that was a
+ " case, don't do any special indenting.
+ if prevline =~# '\v;\s*(//.*)?$' && prevprevline =~# '\v\=\>\s*(//.*)?$' && line !~# '\v^\s*}'
+ return indent(prevlnum)
+ endif
+
+ let l:indent = FloorCindent(v:lnum)
+
+ " If the previous line was a case and a normal cindent wouldn't indent, indent
+ " an extra shiftwidth.
+ if prevline =~# '\v\=\>\s*(//.*)?$' && l:indent == indent(prevlnum)
+ return l:indent + shiftwidth()
+ endif
+
+ " If everything above is false, do a normal cindent.
+ return l:indent
+endfunction
+
+" vim: tabstop=2 shiftwidth=2 expandtab
diff --git a/runtime/indent/solidity.vim b/runtime/indent/solidity.vim
new file mode 100644
index 0000000000..caed726c0a
--- /dev/null
+++ b/runtime/indent/solidity.vim
@@ -0,0 +1,442 @@
+" Vim indent file
+" Language: Solidity
+" Acknowledgement: Based off of vim-javascript
+" Maintainer: Cothi (jiungdev@gmail.com)
+" Original Author: tomlion (https://github.com/tomlion/vim-solidity)
+" Last Changed: 2022 Sep 27
+"
+" 0. Initialization {{{1
+" =================
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+setlocal nosmartindent
+
+" Now, set up our indentation expression and keys that trigger it.
+setlocal indentexpr=GetSolidityIndent()
+setlocal indentkeys=0{,0},0),0],0\,,!^F,o,O,e
+
+" Only define the function once.
+if exists("*GetSolidityIndent")
+ finish
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+" 1. Variables {{{1
+" ============
+
+let s:js_keywords = '^\s*\(break\|case\|catch\|continue\|debugger\|default\|delete\|do\|else\|finally\|for\|function\|if\|in\|instanceof\|new\|return\|switch\|this\|throw\|try\|typeof\|var\|void\|while\|with\)'
+
+" Regex of syntax group names that are or delimit string or are comments.
+let s:syng_strcom = 'string\|regex\|comment\c'
+
+" Regex of syntax group names that are strings.
+let s:syng_string = 'regex\c'
+
+" Regex of syntax group names that are strings or documentation.
+let s:syng_multiline = 'comment\c'
+
+" Regex of syntax group names that are line comment.
+let s:syng_linecom = 'linecomment\c'
+
+" Expression used to check whether we should skip a match with searchpair().
+let s:skip_expr = "synIDattr(synID(line('.'),col('.'),1),'name') =~ '".s:syng_strcom."'"
+
+let s:line_term = '\s*\%(\%(\/\/\).*\)\=$'
+
+" Regex that defines continuation lines, not including (, {, or [.
+let s:continuation_regex = '\%([\\*+/.:]\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)' . s:line_term
+
+" Regex that defines continuation lines.
+" TODO: this needs to deal with if ...: and so on
+let s:msl_regex = '\%([\\*+/.:([]\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)' . s:line_term
+
+let s:one_line_scope_regex = '\<\%(if\|else\|for\|while\)\>[^{;]*' . s:line_term
+
+" Regex that defines blocks.
+let s:block_regex = '\%([{[]\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=' . s:line_term
+
+let s:var_stmt = '^\s*var'
+
+let s:comma_first = '^\s*,'
+let s:comma_last = ',\s*$'
+
+let s:ternary = '^\s\+[?|:]'
+let s:ternary_q = '^\s\+?'
+
+" 2. Auxiliary Functions {{{1
+" ======================
+
+" Check if the character at lnum:col is inside a string, comment, or is ascii.
+function s:IsInStringOrComment(lnum, col)
+ return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_strcom
+endfunction
+
+" Check if the character at lnum:col is inside a string.
+function s:IsInString(lnum, col)
+ return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_string
+endfunction
+
+" Check if the character at lnum:col is inside a multi-line comment.
+function s:IsInMultilineComment(lnum, col)
+ return !s:IsLineComment(a:lnum, a:col) && synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_multiline
+endfunction
+
+" Check if the character at lnum:col is a line comment.
+function s:IsLineComment(lnum, col)
+ return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_linecom
+endfunction
+
+" Find line above 'lnum' that isn't empty, in a comment, or in a string.
+function s:PrevNonBlankNonString(lnum)
+ let in_block = 0
+ let lnum = prevnonblank(a:lnum)
+ while lnum > 0
+ " Go in and out of blocks comments as necessary.
+ " If the line isn't empty (with opt. comment) or in a string, end search.
+ let line = getline(lnum)
+ if line =~ '/\*'
+ if in_block
+ let in_block = 0
+ else
+ break
+ endif
+ elseif !in_block && line =~ '\*/'
+ let in_block = 1
+ elseif !in_block && line !~ '^\s*\%(//\).*$' && !(s:IsInStringOrComment(lnum, 1) && s:IsInStringOrComment(lnum, strlen(line)))
+ break
+ endif
+ let lnum = prevnonblank(lnum - 1)
+ endwhile
+ return lnum
+endfunction
+
+" Find line above 'lnum' that started the continuation 'lnum' may be part of.
+function s:GetMSL(lnum, in_one_line_scope)
+ " Start on the line we're at and use its indent.
+ let msl = a:lnum
+ let lnum = s:PrevNonBlankNonString(a:lnum - 1)
+ while lnum > 0
+ " If we have a continuation line, or we're in a string, use line as MSL.
+ " Otherwise, terminate search as we have found our MSL already.
+ let line = getline(lnum)
+ let col = match(line, s:msl_regex) + 1
+ if (col > 0 && !s:IsInStringOrComment(lnum, col)) || s:IsInString(lnum, strlen(line))
+ let msl = lnum
+ else
+ " Don't use lines that are part of a one line scope as msl unless the
+ " flag in_one_line_scope is set to 1
+ "
+ if a:in_one_line_scope
+ break
+ end
+ let msl_one_line = s:Match(lnum, s:one_line_scope_regex)
+ if msl_one_line == 0
+ break
+ endif
+ endif
+ let lnum = s:PrevNonBlankNonString(lnum - 1)
+ endwhile
+ return msl
+endfunction
+
+function s:RemoveTrailingComments(content)
+ let single = '\/\/\(.*\)\s*$'
+ let multi = '\/\*\(.*\)\*\/\s*$'
+ return substitute(substitute(a:content, single, '', ''), multi, '', '')
+endfunction
+
+" Find if the string is inside var statement (but not the first string)
+function s:InMultiVarStatement(lnum)
+ let lnum = s:PrevNonBlankNonString(a:lnum - 1)
+
+" let type = synIDattr(synID(lnum, indent(lnum) + 1, 0), 'name')
+
+ " loop through previous expressions to find a var statement
+ while lnum > 0
+ let line = getline(lnum)
+
+ " if the line is a js keyword
+ if (line =~ s:js_keywords)
+ " check if the line is a var stmt
+ " if the line has a comma first or comma last then we can assume that we
+ " are in a multiple var statement
+ if (line =~ s:var_stmt)
+ return lnum
+ endif
+
+ " other js keywords, not a var
+ return 0
+ endif
+
+ let lnum = s:PrevNonBlankNonString(lnum - 1)
+ endwhile
+
+ " beginning of program, not a var
+ return 0
+endfunction
+
+" Find line above with beginning of the var statement or returns 0 if it's not
+" this statement
+function s:GetVarIndent(lnum)
+ let lvar = s:InMultiVarStatement(a:lnum)
+ let prev_lnum = s:PrevNonBlankNonString(a:lnum - 1)
+
+ if lvar
+ let line = s:RemoveTrailingComments(getline(prev_lnum))
+
+ " if the previous line doesn't end in a comma, return to regular indent
+ if (line !~ s:comma_last)
+ return indent(prev_lnum) - &sw
+ else
+ return indent(lvar) + &sw
+ endif
+ endif
+
+ return -1
+endfunction
+
+
+" Check if line 'lnum' has more opening brackets than closing ones.
+function s:LineHasOpeningBrackets(lnum)
+ let open_0 = 0
+ let open_2 = 0
+ let open_4 = 0
+ let line = getline(a:lnum)
+ let pos = match(line, '[][(){}]', 0)
+ while pos != -1
+ if !s:IsInStringOrComment(a:lnum, pos + 1)
+ let idx = stridx('(){}[]', line[pos])
+ if idx % 2 == 0
+ let open_{idx} = open_{idx} + 1
+ else
+ let open_{idx - 1} = open_{idx - 1} - 1
+ endif
+ endif
+ let pos = match(line, '[][(){}]', pos + 1)
+ endwhile
+ return (open_0 > 0) . (open_2 > 0) . (open_4 > 0)
+endfunction
+
+function s:Match(lnum, regex)
+ let col = match(getline(a:lnum), a:regex) + 1
+ return col > 0 && !s:IsInStringOrComment(a:lnum, col) ? col : 0
+endfunction
+
+function s:IndentWithContinuation(lnum, ind, width)
+ " Set up variables to use and search for MSL to the previous line.
+ let p_lnum = a:lnum
+ let lnum = s:GetMSL(a:lnum, 1)
+ let line = getline(lnum)
+
+ " If the previous line wasn't a MSL and is continuation return its indent.
+ " TODO: the || s:IsInString() thing worries me a bit.
+ if p_lnum != lnum
+ if s:Match(p_lnum,s:continuation_regex)||s:IsInString(p_lnum,strlen(line))
+ return a:ind
+ endif
+ endif
+
+ " Set up more variables now that we know we aren't continuation bound.
+ let msl_ind = indent(lnum)
+
+ " If the previous line ended with [*+/.-=], start a continuation that
+ " indents an extra level.
+ if s:Match(lnum, s:continuation_regex)
+ if lnum == p_lnum
+ return msl_ind + a:width
+ else
+ return msl_ind
+ endif
+ endif
+
+ return a:ind
+endfunction
+
+function s:InOneLineScope(lnum)
+ let msl = s:GetMSL(a:lnum, 1)
+ if msl > 0 && s:Match(msl, s:one_line_scope_regex)
+ return msl
+ endif
+ return 0
+endfunction
+
+function s:ExitingOneLineScope(lnum)
+ let msl = s:GetMSL(a:lnum, 1)
+ if msl > 0
+ " if the current line is in a one line scope ..
+ if s:Match(msl, s:one_line_scope_regex)
+ return 0
+ else
+ let prev_msl = s:GetMSL(msl - 1, 1)
+ if s:Match(prev_msl, s:one_line_scope_regex)
+ return prev_msl
+ endif
+ endif
+ endif
+ return 0
+endfunction
+
+" 3. GetSolidityIndent Function {{{1
+" =========================
+
+function GetSolidityIndent()
+ " 3.1. Setup {{{2
+ " ----------
+
+ " Set up variables for restoring position in file. Could use v:lnum here.
+ let vcol = col('.')
+
+ " 3.2. Work on the current line {{{2
+ " -----------------------------
+
+ let ind = -1
+ " Get the current line.
+ let line = getline(v:lnum)
+ " previous nonblank line number
+ let prevline = prevnonblank(v:lnum - 1)
+
+ " If we got a closing bracket on an empty line, find its match and indent
+ " according to it. For parentheses we indent to its column - 1, for the
+ " others we indent to the containing line's MSL's level. Return -1 if fail.
+ let col = matchend(line, '^\s*[],})]')
+ if col > 0 && !s:IsInStringOrComment(v:lnum, col)
+ call cursor(v:lnum, col)
+
+ let lvar = s:InMultiVarStatement(v:lnum)
+ if lvar
+ let prevline_contents = s:RemoveTrailingComments(getline(prevline))
+
+ " check for comma first
+ if (line[col - 1] =~ ',')
+ " if the previous line ends in comma or semicolon don't indent
+ if (prevline_contents =~ '[;,]\s*$')
+ return indent(s:GetMSL(line('.'), 0))
+ " get previous line indent, if it's comma first return prevline indent
+ elseif (prevline_contents =~ s:comma_first)
+ return indent(prevline)
+ " otherwise we indent 1 level
+ else
+ return indent(lvar) + &sw
+ endif
+ endif
+ endif
+
+
+ let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2)
+ if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0
+ if line[col-1]==')' && col('.') != col('$') - 1
+ let ind = virtcol('.')-1
+ else
+ let ind = indent(s:GetMSL(line('.'), 0))
+ endif
+ endif
+ return ind
+ endif
+
+ " If the line is comma first, dedent 1 level
+ if (getline(prevline) =~ s:comma_first)
+ return indent(prevline) - &sw
+ endif
+
+ if (line =~ s:ternary)
+ if (getline(prevline) =~ s:ternary_q)
+ return indent(prevline)
+ else
+ return indent(prevline) + &sw
+ endif
+ endif
+
+ " If we are in a multi-line comment, cindent does the right thing.
+ if s:IsInMultilineComment(v:lnum, 1) && !s:IsLineComment(v:lnum, 1)
+ return cindent(v:lnum)
+ endif
+
+ " Check for multiple var assignments
+" let var_indent = s:GetVarIndent(v:lnum)
+" if var_indent >= 0
+" return var_indent
+" endif
+
+ " 3.3. Work on the previous line. {{{2
+ " -------------------------------
+
+ " If the line is empty and the previous nonblank line was a multi-line
+ " comment, use that comment's indent. Deduct one char to account for the
+ " space in ' */'.
+ if line =~ '^\s*$' && s:IsInMultilineComment(prevline, 1)
+ return indent(prevline) - 1
+ endif
+
+ " Find a non-blank, non-multi-line string line above the current line.
+ let lnum = s:PrevNonBlankNonString(v:lnum - 1)
+
+ " If the line is empty and inside a string, use the previous line.
+ if line =~ '^\s*$' && lnum != prevline
+ return indent(prevnonblank(v:lnum))
+ endif
+
+ " At the start of the file use zero indent.
+ if lnum == 0
+ return 0
+ endif
+
+ " Set up variables for current line.
+ let line = getline(lnum)
+ let ind = indent(lnum)
+
+ " If the previous line ended with a block opening, add a level of indent.
+ if s:Match(lnum, s:block_regex)
+ return indent(s:GetMSL(lnum, 0)) + &sw
+ endif
+
+ " If the previous line contained an opening bracket, and we are still in it,
+ " add indent depending on the bracket type.
+ if line =~ '[[({]'
+ let counts = s:LineHasOpeningBrackets(lnum)
+ if counts[0] == '1' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
+ if col('.') + 1 == col('$')
+ return ind + &sw
+ else
+ return virtcol('.')
+ endif
+ elseif counts[1] == '1' || counts[2] == '1'
+ return ind + &sw
+ else
+ call cursor(v:lnum, vcol)
+ end
+ endif
+
+ " 3.4. Work on the MSL line. {{{2
+ " --------------------------
+
+ let ind_con = ind
+ let ind = s:IndentWithContinuation(lnum, ind_con, &sw)
+
+ " }}}2
+ "
+ "
+ let ols = s:InOneLineScope(lnum)
+ if ols > 0
+ let ind = ind + &sw
+ else
+ let ols = s:ExitingOneLineScope(lnum)
+ while ols > 0 && ind > 0
+ let ind = ind - &sw
+ let ols = s:InOneLineScope(ols - 1)
+ endwhile
+ endif
+
+ return ind
+endfunction
+
+" }}}1
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/indent/vue.vim b/runtime/indent/vue.vim
new file mode 100644
index 0000000000..7ff623b3d1
--- /dev/null
+++ b/runtime/indent/vue.vim
@@ -0,0 +1,12 @@
+" Vim indent file placeholder
+" Language: Vue
+" Maintainer: None, please volunteer if you have a real Vue indent script
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+" Html comes closest
+runtime! indent/html.vim
diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua
index b8a7f71145..96a87b8bb9 100644
--- a/runtime/lua/vim/_editor.lua
+++ b/runtime/lua/vim/_editor.lua
@@ -401,7 +401,7 @@ end
---@param bufnr number of buffer
---@param pos1 (line, column) tuple marking beginning of region
---@param pos2 (line, column) tuple marking end of region
----@param regtype type of selection (:help setreg)
+---@param regtype type of selection, see |setreg()|
---@param inclusive boolean indicating whether the selection is end-inclusive
---@return region lua table of the form {linenr = {startcol,endcol}}
function vim.region(bufnr, pos1, pos2, regtype, inclusive)
@@ -448,7 +448,7 @@ end
--- Defers calling `fn` until `timeout` ms passes.
---
--- Use to do a one-shot timer that calls `fn`
---- Note: The {fn} is |schedule_wrap|ped automatically, so API functions are
+--- Note: The {fn} is |vim.schedule_wrap()|ped automatically, so API functions are
--- safe to call.
---@param fn Callback to call once `timeout` expires
---@param timeout Number of milliseconds to wait before calling `fn`
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua
index bd317baae9..b61fc528f5 100644
--- a/runtime/lua/vim/filetype.lua
+++ b/runtime/lua/vim/filetype.lua
@@ -448,6 +448,8 @@ local extension = {
gsp = 'gsp',
gjs = 'javascript.glimmer',
gts = 'typescript.glimmer',
+ gyp = 'gyp',
+ gypi = 'gyp',
hack = 'hack',
hackpartial = 'hack',
haml = 'haml',
@@ -1019,6 +1021,8 @@ local extension = {
ts = function(path, bufnr)
return M.getlines(bufnr, 1):find('<%?xml') and 'xml' or 'typescript'
end,
+ mts = 'typescript',
+ cts = 'typescript',
tsx = 'typescriptreact',
uc = 'uc',
uit = 'uil',
@@ -1451,6 +1455,7 @@ local filename = {
['.sawfishrc'] = 'lisp',
['/etc/login.access'] = 'loginaccess',
['/etc/login.defs'] = 'logindefs',
+ ['.luacheckrc'] = 'lua',
['lynx.cfg'] = 'lynx',
['m3overrides'] = 'm3build',
['m3makefile'] = 'm3build',
@@ -1496,6 +1501,8 @@ local filename = {
['/etc/shadow-'] = 'passwd',
['/etc/shadow'] = 'passwd',
['/etc/passwd.edit'] = 'passwd',
+ ['latexmkrc'] = 'perl',
+ ['.latexmkrc'] = 'perl',
['pf.conf'] = 'pf',
['main.cf'] = 'pfmain',
pinerc = 'pine',
@@ -1727,7 +1734,7 @@ local pattern = {
{ priority = -1 },
},
['[cC]hange[lL]og.*'] = starsetf(function(path, bufnr)
- require('vim.filetype.detect').changelog(bufnr)
+ return require('vim.filetype.detect').changelog(bufnr)
end),
['.*%.%.ch'] = 'chill',
['.*%.cmake%.in'] = 'cmake',
diff --git a/runtime/lua/vim/highlight.lua b/runtime/lua/vim/highlight.lua
index ddd504a0e0..0fde515bd9 100644
--- a/runtime/lua/vim/highlight.lua
+++ b/runtime/lua/vim/highlight.lua
@@ -41,7 +41,7 @@ end
---@param start first position (tuple {line,col})
---@param finish second position (tuple {line,col})
---@param opts table with options:
--- - regtype type of range (:help setreg, default charwise)
+-- - regtype type of range (see |setreg()|, default charwise)
-- - inclusive boolean indicating whether the range is end-inclusive (default false)
-- - priority number indicating priority of highlight (default priorities.user)
function M.range(bufnr, ns, higroup, start, finish, opts)
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index 22933d8143..a64facf214 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -823,7 +823,7 @@ end
--- })
--- </pre>
---
---- See |lsp.start_client| for all available options. The most important are:
+--- See |vim.lsp.start_client()| for all available options. The most important are:
---
--- `name` is an arbitrary name for the LSP client. It should be unique per
--- language server.
@@ -834,7 +834,7 @@ end
---
--- `root_dir` path to the project root.
--- By default this is used to decide if an existing client should be re-used.
---- The example above uses |vim.fs.find| and |vim.fs.dirname| to detect the
+--- The example above uses |vim.fs.find()| and |vim.fs.dirname()| to detect the
--- root by traversing the file system upwards starting
--- from the current directory until either a `pyproject.toml` or `setup.py`
--- file is found.
@@ -849,11 +849,11 @@ end
---
---
--- To ensure a language server is only started for languages it can handle,
---- make sure to call |vim.lsp.start| within a |FileType| autocmd.
+--- make sure to call |vim.lsp.start()| within a |FileType| autocmd.
--- Either use |:au|, |nvim_create_autocmd()| or put the call in a
--- `ftplugin/<filetype_name>.lua` (See |ftplugin-name|)
---
----@param config table Same configuration as documented in |lsp.start_client()|
+---@param config table Same configuration as documented in |vim.lsp.start_client()|
---@param opts nil|table Optional keyword arguments:
--- - reuse_client (fun(client: client, config: table): boolean)
--- Predicate used to decide if a client should be re-used.
@@ -902,12 +902,12 @@ end
---
---
---@param cmd: (table|string|fun(dispatchers: table):table) command string or
---- list treated like |jobstart|. The command must launch the language server
+--- list treated like |jobstart()|. The command must launch the language server
--- process. `cmd` can also be a function that creates an RPC client.
--- The function receives a dispatchers table and must return a table with the
--- functions `request`, `notify`, `is_closing` and `terminate`
---- See |vim.lsp.rpc.request| and |vim.lsp.rpc.notify|
---- For TCP there is a built-in rpc client factory: |vim.lsp.rpc.connect|
+--- See |vim.lsp.rpc.request()| and |vim.lsp.rpc.notify()|
+--- For TCP there is a built-in rpc client factory: |vim.lsp.rpc.connect()|
---
---@param cmd_cwd: (string, default=|getcwd()|) Directory to launch
--- the `cmd` process. Not related to `root_dir`.
@@ -963,7 +963,7 @@ end
---@param on_error Callback with parameters (code, ...), invoked
--- when the client operation throws an error. `code` is a number describing
--- the error. Other arguments may be passed depending on the error kind. See
---- |vim.lsp.rpc.client_errors| for possible errors.
+--- `vim.lsp.rpc.client_errors` for possible errors.
--- Use `vim.lsp.rpc.client_errors[code]` to get human-friendly name.
---
---@param before_init Callback with parameters (initialize_params, config)
@@ -999,8 +999,8 @@ end
--- notifications to the server by the given number in milliseconds. No debounce
--- occurs if nil
--- - exit_timeout (number|boolean, default false): Milliseconds to wait for server to
---- exit cleanly after sending the 'shutdown' request before sending kill -15.
---- If set to false, nvim exits immediately after sending the 'shutdown' request to the server.
+--- exit cleanly after sending the "shutdown" request before sending kill -15.
+--- If set to false, nvim exits immediately after sending the "shutdown" request to the server.
---
---@param root_dir string Directory where the LSP
--- server will base its workspaceFolders, rootUri, and rootPath
@@ -1078,7 +1078,7 @@ function lsp.start_client(config)
---
---@param code (number) Error code
---@param err (...) Other arguments may be passed depending on the error kind
- ---@see |vim.lsp.rpc.client_errors| for possible errors. Use
+ ---@see `vim.lsp.rpc.client_errors` for possible errors. Use
---`vim.lsp.rpc.client_errors[code]` to get a human-friendly name.
function dispatch.on_error(code, err)
local _ = log.error()
diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua
index 8567619228..b9aaacb437 100644
--- a/runtime/lua/vim/lsp/buf.lua
+++ b/runtime/lua/vim/lsp/buf.lua
@@ -111,7 +111,7 @@ end
--- about the context in which a completion was triggered (how it was triggered,
--- and by which trigger character, if applicable)
---
----@see |vim.lsp.protocol.constants.CompletionTriggerKind|
+---@see vim.lsp.protocol.constants.CompletionTriggerKind
function M.completion(context)
local params = util.make_position_params()
params.context = context
@@ -317,7 +317,7 @@ end
---
---@param options table|nil with valid `FormattingOptions` entries
---@param timeout_ms (number) Request timeout
----@see |vim.lsp.buf.formatting_seq_sync|
+---@see |vim.lsp.buf.format()|
function M.formatting_sync(options, timeout_ms)
vim.notify_once(
'vim.lsp.buf.formatting_sync is deprecated. Use vim.lsp.buf.format instead',
@@ -614,14 +614,14 @@ end
--- Lists all the call sites of the symbol under the cursor in the
--- |quickfix| window. If the symbol can resolve to multiple
---- items, the user can pick one in the |inputlist|.
+--- items, the user can pick one in the |inputlist()|.
function M.incoming_calls()
call_hierarchy('callHierarchy/incomingCalls')
end
--- Lists all the items that are called by the symbol under the
--- cursor in the |quickfix| window. If the symbol can resolve to
---- multiple items, the user can pick one in the |inputlist|.
+--- multiple items, the user can pick one in the |inputlist()|.
function M.outgoing_calls()
call_hierarchy('callHierarchy/outgoingCalls')
end
@@ -730,9 +730,9 @@ end
---
--- Note: Usage of |vim.lsp.buf.document_highlight()| requires the following highlight groups
--- to be defined or you won't be able to see the actual highlights.
---- |LspReferenceText|
---- |LspReferenceRead|
---- |LspReferenceWrite|
+--- |hl-LspReferenceText|
+--- |hl-LspReferenceRead|
+--- |hl-LspReferenceWrite|
function M.document_highlight()
local params = util.make_position_params()
request('textDocument/documentHighlight', params)
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index 624436bc9b..a32c59dd17 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -389,7 +389,7 @@ M['textDocument/implementation'] = location_handler
---@param config table Configuration table.
--- - border: (default=nil)
--- - Add borders to the floating window
---- - See |vim.api.nvim_open_win()|
+--- - See |nvim_open_win()|
function M.signature_help(_, result, ctx, config)
config = config or {}
config.focus_id = ctx.method
diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua
index 755c0ffc6f..842a0ce329 100644
--- a/runtime/lua/vim/lsp/rpc.lua
+++ b/runtime/lua/vim/lsp/rpc.lua
@@ -635,7 +635,7 @@ end
--- Starts an LSP server process and create an LSP RPC client object to
--- interact with it. Communication with the spawned process happens via stdio. For
---- communication via TCP, spawn a process manually and use |vim.lsp.rpc.connect|
+--- communication via TCP, spawn a process manually and use |vim.lsp.rpc.connect()|
---
---@param cmd (string) Command to start the LSP server.
---@param cmd_args (table) List of additional string arguments to pass to {cmd}.
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index 64512a9739..88667caf68 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -476,7 +476,7 @@ function M.apply_text_edits(text_edits, bufnr, offset_encoding)
-- If the replacement is over the end of a line (i.e. e.end_col is out of bounds and the
-- replacement text ends with a newline We can likely assume that the replacement is assumed
-- to be meant to replace the newline with another newline and we need to make sure this
- -- doens't add an extra empty line. E.g. when the last line to be replaced contains a '\r'
+ -- doesn't add an extra empty line. E.g. when the last line to be replaced contains a '\r'
-- in the file some servers (clangd on windows) will include that character in the line
-- while nvim_buf_set_text doesn't count it as part of the line.
if
@@ -907,8 +907,8 @@ function M.convert_signature_help_to_markdown_lines(signature_help, ft, triggers
return
end
--The active signature. If omitted or the value lies outside the range of
- --`signatures` the value defaults to zero or is ignored if `signatures.length
- --=== 0`. Whenever possible implementors should make an active decision about
+ --`signatures` the value defaults to zero or is ignored if `signatures.length == 0`.
+ --Whenever possible implementors should make an active decision about
--the active signature and shouldn't rely on a default value.
local contents = {}
local active_hl
@@ -1504,7 +1504,7 @@ end
---
---@param contents table of lines to show in window
---@param syntax string of syntax to set for opened buffer
----@param opts table with optional fields (additional keys are passed on to |vim.api.nvim_open_win()|)
+---@param opts table with optional fields (additional keys are passed on to |nvim_open_win()|)
--- - height: (number) height of floating window
--- - width: (number) width of floating window
--- - wrap: (boolean, default true) wrap long lines
@@ -1819,7 +1819,7 @@ end
--- CAUTION: Modifies the input in-place!
---
---@param lines (table) list of lines
----@returns (string) filetype or 'markdown' if it was unchanged.
+---@returns (string) filetype or "markdown" if it was unchanged.
function M.try_trim_markdown_code_blocks(lines)
local language_id = lines[1]:match('^```(.*)')
if language_id then
@@ -1992,7 +1992,7 @@ function M.make_workspace_params(added, removed)
end
--- Returns indentation size.
---
----@see |shiftwidth|
+---@see 'shiftwidth'
---@param bufnr (number|nil): Buffer handle, defaults to current
---@returns (number) indentation size
function M.get_effective_tabstop(bufnr)
diff --git a/runtime/lua/vim/shared.lua b/runtime/lua/vim/shared.lua
index de5f7240aa..c5c31b6ddf 100644
--- a/runtime/lua/vim/shared.lua
+++ b/runtime/lua/vim/shared.lua
@@ -302,7 +302,7 @@ end
--- Merges recursively two or more map-like tables.
---
----@see |tbl_extend()|
+---@see |vim.tbl_extend()|
---
---@param behavior string Decides what to do if a key is found in more than one map:
--- - "error": raise an error
diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua
index d1dc29969b..7ca7384a88 100644
--- a/runtime/lua/vim/treesitter/query.lua
+++ b/runtime/lua/vim/treesitter/query.lua
@@ -54,7 +54,7 @@ end
--- Gets the list of files used to make up a query
---
---@param lang string Language to get query for
----@param query_name string Name of the query to load (e.g., 'highlights')
+---@param query_name string Name of the query to load (e.g., "highlights")
---@param is_included (boolean|nil) Internal parameter, most of the time left as `nil`
---@return string[] query_files List of files to load for given query and language
function M.get_query_files(lang, query_name, is_included)
@@ -125,11 +125,12 @@ function M.get_query_files(lang, query_name, is_included)
io.close(file)
end
- local query_files = { base_query }
+ local query_files = {}
for _, base_lang in ipairs(base_langs) do
local base_files = M.get_query_files(base_lang, query_name, true)
vim.list_extend(query_files, base_files)
end
+ vim.list_extend(query_files, { base_query })
vim.list_extend(query_files, extensions)
return query_files
@@ -162,7 +163,7 @@ local explicit_queries = setmetatable({}, {
--- set by plugins.
---
---@param lang string Language to use for the query
----@param query_name string Name of the query (e.g., 'highlights')
+---@param query_name string Name of the query (e.g., "highlights")
---@param text string Query text (unparsed).
function M.set_query(lang, query_name, text)
explicit_queries[lang][query_name] = M.parse_query(lang, text)
@@ -171,7 +172,7 @@ end
--- Returns the runtime query {query_name} for {lang}.
---
---@param lang string Language to use for the query
----@param query_name string Name of the query (e.g. 'highlights')
+---@param query_name string Name of the query (e.g. "highlights")
---
---@return Query Parsed query
function M.get_query(lang, query_name)
@@ -596,7 +597,7 @@ end
--- Iterates the matches of self on a given range.
---
--- Iterate over all matches within a {node}. The arguments are the same as
---- for |query:iter_captures()| but the iterated values are different:
+--- for |Query:iter_captures()| but the iterated values are different:
--- an (1-based) index of the pattern in the query, a table mapping
--- capture indices to nodes, and metadata from any directives processing the match.
--- If the query has more than one pattern, the capture table might be sparse
diff --git a/runtime/queries/help/highlights.scm b/runtime/queries/help/highlights.scm
index 41c78a7f1c..6be4e49c81 100644
--- a/runtime/queries/help/highlights.scm
+++ b/runtime/queries/help/highlights.scm
@@ -1,14 +1,16 @@
-(headline) @text.title
+(h1) @text.title
+(h2) @text.title
+(h3) @text.title
(column_heading) @text.title
(tag
"*" @conceal (#set! conceal "")
- name: (_) @label)
-(option
- name: (_) @text.literal)
-(hotlink
+ text: (_) @label)
+(taglink
"|" @conceal (#set! conceal "")
- destination: (_) @text.reference)
-(backtick
+ text: (_) @text.reference)
+(optionlink
+ text: (_) @text.literal)
+(codespan
"`" @conceal (#set! conceal "")
- content: (_) @string)
+ text: (_) @string)
(argument) @parameter
diff --git a/runtime/syntax/chatito.vim b/runtime/syntax/chatito.vim
new file mode 100644
index 0000000000..d89307cf06
--- /dev/null
+++ b/runtime/syntax/chatito.vim
@@ -0,0 +1,62 @@
+" Vim syntax file
+" Language: Chatito
+" Maintainer: ObserverOfTime <chronobserver@disroot.org>
+" Filenames: *.chatito
+" Last Change: 2022 Sep 19
+
+if exists('b:current_syntax')
+ finish
+endif
+
+" Comment
+syn keyword chatitoTodo contained TODO FIXME XXX
+syn match chatitoComment /^#.*/ contains=chatitoTodo,@Spell
+syn match chatitoComment +^//.*+ contains=chatitoTodo,@Spell
+
+" Import
+syn match chatitoImport /^import \+.*$/ transparent contains=chatitoImportKeyword,chatitoImportFile
+syn keyword chatitoImportKeyword import contained nextgroup=chatitoImportFile
+syn match chatitoImportFile /.*$/ contained skipwhite
+
+" Intent
+syn match chatitoIntent /^%\[[^\]?]\+\]\((.\+)\)\=$/ contains=chatitoArgs
+
+" Slot
+syn match chatitoSlot /^@\[[^\]?#]\+\(#[^\]?#]\+\)\=\]\((.\+)\)\=$/ contains=chatitoArgs,chatitoVariation
+syn match chatitoSlot /@\[[^\]?#]\+\(#[^\]?#]\+\)\=?\=\]/ contained contains=chatitoOpt,chatitoVariation
+
+" Alias
+syn match chatitoAlias /^\~\[[^\]?]\+\]\=$/
+syn match chatitoAlias /\~\[[^\]?]\+?\=\]/ contained contains=chatitoOpt
+
+" Probability
+syn match chatitoProbability /\*\[\d\+\(\.\d\+\)\=%\=\]/ contained
+
+" Optional
+syn match chatitoOpt '?' contained
+
+" Arguments
+syn match chatitoArgs /(.\+)/ contained
+
+" Variation
+syn match chatitoVariation /#[^\]?#]\+/ contained
+
+" Value
+syn match chatitoValue /^ \{4\}\zs.\+$/ contains=chatitoProbability,chatitoSlot,chatitoAlias,@Spell
+
+" Errors
+syn match chatitoError /^\t/
+
+hi def link chatitoAlias String
+hi def link chatitoArgs Special
+hi def link chatitoComment Comment
+hi def link chatitoError Error
+hi def link chatitoImportKeyword Include
+hi def link chatitoIntent Statement
+hi def link chatitoOpt SpecialChar
+hi def link chatitoProbability Number
+hi def link chatitoSlot Identifier
+hi def link chatitoTodo Todo
+hi def link chatitoVariation Special
+
+let b:current_syntax = 'chatito'
diff --git a/runtime/syntax/desktop.vim b/runtime/syntax/desktop.vim
index 2c1102238d..461ba855b9 100644
--- a/runtime/syntax/desktop.vim
+++ b/runtime/syntax/desktop.vim
@@ -3,7 +3,7 @@
" Filenames: *.desktop, *.directory
" Maintainer: Eisuke Kawashima ( e.kawaschima+vim AT gmail.com )
" Previous Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
-" Last Change: 2020-06-11
+" Last Change: 2022 Sep 22
" Version Info: desktop.vim 1.5
" References:
" - https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.5.html (2020-04-27)
@@ -60,10 +60,10 @@ syn match dtLocaleSuffix
" Boolean Value {{{2
syn match dtBoolean
- \ /^\%(DBusActivatable\|Hidden\|NoDisplay\|PrefersNonDefaultGPU\|StartupNotify\|Terminal\)\s*=\s*\%(true\|false\)/
+ \ /^\%(DBusActivatable\|Hidden\|NoDisplay\|PrefersNonDefaultGPU\|SingleMainWindow\|StartupNotify\|Terminal\)\s*=\s*\%(true\|false\)/
\ contains=dtBooleanKey,dtDelim,dtBooleanValue transparent
syn keyword dtBooleanKey
- \ DBusActivatable Hidden NoDisplay PrefersNonDefaultGPU StartupNotify Terminal
+ \ DBusActivatable Hidden NoDisplay PrefersNonDefaultGPU SingleMainWindow StartupNotify Terminal
\ contained nextgroup=dtDelim
if s:desktop_enable_kde
diff --git a/runtime/syntax/gyp.vim b/runtime/syntax/gyp.vim
new file mode 100644
index 0000000000..14c07b8726
--- /dev/null
+++ b/runtime/syntax/gyp.vim
@@ -0,0 +1,49 @@
+" Vim syntax file
+" Language: GYP
+" Maintainer: ObserverOfTime <chronobserver@disroot.org>
+" Filenames: *.gyp,*.gypi
+" Last Change: 2022 Sep 27
+
+if !exists('g:main_syntax')
+ if exists('b:current_syntax') && b:current_syntax ==# 'gyp'
+ finish
+ endif
+ let g:main_syntax = 'gyp'
+endif
+
+" Based on JSON syntax
+runtime! syntax/json.vim
+
+" Single quotes are allowed
+syn clear jsonStringSQError
+
+syn match jsonKeywordMatch /'\([^']\|\\\'\)\+'[[:blank:]\r\n]*\:/ contains=jsonKeyword
+if has('conceal') && (!exists('g:vim_json_conceal') || g:vim_json_conceal==1)
+ syn region jsonKeyword matchgroup=jsonQuote start=/'/ end=/'\ze[[:blank:]\r\n]*\:/ concealends contained
+else
+ syn region jsonKeyword matchgroup=jsonQuote start=/'/ end=/'\ze[[:blank:]\r\n]*\:/ contained
+endif
+
+syn match jsonStringMatch /'\([^']\|\\\'\)\+'\ze[[:blank:]\r\n]*[,}\]]/ contains=jsonString
+if has('conceal') && (!exists('g:vim_json_conceal') || g:vim_json_conceal==1)
+ syn region jsonString oneline matchgroup=jsonQuote start=/'/ skip=/\\\\\|\\'/ end=/'/ concealends contains=jsonEscape contained
+else
+ syn region jsonString oneline matchgroup=jsonQuote start=/'/ skip=/\\\\\|\\'/ end=/'/ contains=jsonEscape contained
+endif
+
+" Trailing commas are allowed
+if !exists('g:vim_json_warnings') || g:vim_json_warnings==1
+ syn clear jsonTrailingCommaError
+endif
+
+" Python-style comments are allowed
+syn match jsonComment /#.*$/ contains=jsonTodo,@Spell
+syn keyword jsonTodo FIXME NOTE TODO XXX TBD contained
+
+hi def link jsonComment Comment
+hi def link jsonTodo Todo
+
+let b:current_syntax = 'gyp'
+if g:main_syntax ==# 'gyp'
+ unlet g:main_syntax
+endif
diff --git a/runtime/syntax/hare.vim b/runtime/syntax/hare.vim
new file mode 100644
index 0000000000..07cf33fb11
--- /dev/null
+++ b/runtime/syntax/hare.vim
@@ -0,0 +1,133 @@
+" PRELUDE {{{1
+" Vim syntax file
+" Language: Hare
+" Maintainer: Amelia Clarke <me@rsaihe.dev>
+" Last Change: 2022-09-21
+
+if exists("b:current_syntax")
+ finish
+endif
+let b:current_syntax = "hare"
+
+" SYNTAX {{{1
+syn case match
+
+" KEYWORDS {{{2
+syn keyword hareConditional if else match switch
+syn keyword hareKeyword break continue return yield
+syn keyword hareKeyword defer
+syn keyword hareKeyword fn
+syn keyword hareKeyword let
+syn keyword hareLabel case
+syn keyword hareOperator as is
+syn keyword hareRepeat for
+syn keyword hareStorageClass const def export nullable static
+syn keyword hareStructure enum struct union
+syn keyword hareTypedef type
+
+" C ABI.
+syn keyword hareKeyword vastart vaarg vaend
+
+" BUILTINS {{{2
+syn keyword hareBuiltin abort
+syn keyword hareBuiltin alloc free
+syn keyword hareBuiltin append delete insert
+syn keyword hareBuiltin assert
+syn keyword hareBuiltin len offset
+
+" TYPES {{{2
+syn keyword hareType bool
+syn keyword hareType char str
+syn keyword hareType f32 f64
+syn keyword hareType u8 u16 u32 u64 i8 i16 i32 i64
+syn keyword hareType uint int
+syn keyword hareType rune
+syn keyword hareType uintptr
+syn keyword hareType void
+
+" C ABI.
+syn keyword hareType valist
+
+" LITERALS {{{2
+syn keyword hareBoolean true false
+syn keyword hareNull null
+
+" Number literals.
+syn match hareNumber "\v(\.@1<!|\.\.)\zs<\d+([Ee][+-]?\d+)?(z|[iu](8|16|32|64)?)?>" display
+syn match hareNumber "\v(\.@1<!|\.\.)\zs<0b[01]+(z|[iu](8|16|32|64)?)?>" display
+syn match hareNumber "\v(\.@1<!|\.\.)\zs<0o\o+(z|[iu](8|16|32|64)?)?>" display
+syn match hareNumber "\v(\.@1<!|\.\.)\zs<0x\x+(z|[iu](8|16|32|64)?)?>" display
+
+" Floating-point number literals.
+syn match hareFloat "\v<\d+\.\d+([Ee][+-]?\d+)?(f32|f64)?>" display
+syn match hareFloat "\v<\d+([Ee][+-]?\d+)?(f32|f64)>" display
+
+" String and rune literals.
+syn match hareEscape "\\[\\'"0abfnrtv]" contained display
+syn match hareEscape "\v\\(x\x{2}|u\x{4}|U\x{8})" contained display
+syn match hareFormat "\v\{\d*(\%\d*|(:[ 0+-]?\d*(\.\d+)?[Xbox]?))?}" contained display
+syn match hareFormat "\({{\|}}\)" contained display
+syn region hareRune start="'" end="'\|$" skip="\\'" contains=hareEscape display extend
+syn region hareString start=+"+ end=+"\|$+ skip=+\\"+ contains=hareEscape,hareFormat display extend
+syn region hareString start="`" end="`\|$" contains=hareFormat display
+
+" MISCELLANEOUS {{{2
+syn keyword hareTodo FIXME TODO XXX contained
+
+" Attributes.
+syn match hareAttribute "@[a-z]*"
+
+" Blocks.
+syn region hareBlock start="{" end="}" fold transparent
+
+" Comments.
+syn region hareComment start="//" end="$" contains=hareCommentDoc,hareTodo,@Spell display keepend
+syn region hareCommentDoc start="\[\[" end="]]\|\ze\_s" contained display
+
+" The size keyword can be either a builtin or a type.
+syn match hareBuiltin "\v<size>\ze(\_s*//.*\_$)*\_s*\(" contains=hareComment
+syn match hareType "\v<size>((\_s*//.*\_$)*\_s*\()@!" contains=hareComment
+
+" Trailing whitespace.
+syn match hareSpaceError "\v\s+$" display excludenl
+syn match hareSpaceError "\v\zs +\ze\t" display
+
+" Use statement.
+syn region hareUse start="\v^\s*\zsuse>" end=";" contains=hareComment display
+
+syn match hareErrorAssertion "\v(^([^/]|//@!)*\)\_s*)@<=!\=@!"
+syn match hareQuestionMark "?"
+
+" DEFAULT HIGHLIGHTING {{{1
+hi def link hareAttribute Keyword
+hi def link hareBoolean Boolean
+hi def link hareBuiltin Function
+hi def link hareComment Comment
+hi def link hareCommentDoc SpecialComment
+hi def link hareConditional Conditional
+hi def link hareEscape SpecialChar
+hi def link hareFloat Float
+hi def link hareFormat SpecialChar
+hi def link hareKeyword Keyword
+hi def link hareLabel Label
+hi def link hareNull Constant
+hi def link hareNumber Number
+hi def link hareOperator Operator
+hi def link hareQuestionMark Special
+hi def link hareRepeat Repeat
+hi def link hareRune Character
+hi def link hareStorageClass StorageClass
+hi def link hareString String
+hi def link hareStructure Structure
+hi def link hareTodo Todo
+hi def link hareType Type
+hi def link hareTypedef Typedef
+hi def link hareUse PreProc
+
+hi def link hareSpaceError Error
+autocmd InsertEnter * hi link hareSpaceError NONE
+autocmd InsertLeave * hi link hareSpaceError Error
+
+hi def hareErrorAssertion ctermfg=red cterm=bold guifg=red gui=bold
+
+" vim: tabstop=8 shiftwidth=2 expandtab
diff --git a/runtime/syntax/help.vim b/runtime/syntax/help.vim
index 01915d23d7..5773e94c3e 100644
--- a/runtime/syntax/help.vim
+++ b/runtime/syntax/help.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: Vim help file
" Maintainer: Bram Moolenaar (Bram@vim.org)
-" Last Change: 2021 Jun 13
+" Last Change: 2022 Sep 26
" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
@@ -39,6 +39,7 @@ syn match helpVim "VIM REFERENCE.*"
syn match helpVim "NVIM REFERENCE.*"
syn match helpOption "'[a-z]\{2,\}'"
syn match helpOption "'t_..'"
+syn match helpNormal "'ab'"
syn match helpCommand "`[^` \t]\+`"hs=s+1,he=e-1 contains=helpBacktick
syn match helpCommand "\(^\|[^a-z"[]\)\zs`[^`]\+`\ze\([^a-z\t."']\|$\)"hs=s+1,he=e-1 contains=helpBacktick
syn match helpHeader "\s*\zs.\{-}\ze\s\=\~$" nextgroup=helpIgnore
diff --git a/runtime/syntax/hlsplaylist.vim b/runtime/syntax/hlsplaylist.vim
new file mode 100644
index 0000000000..245eee213b
--- /dev/null
+++ b/runtime/syntax/hlsplaylist.vim
@@ -0,0 +1,120 @@
+" Vim syntax file
+" Language: HLS Playlist
+" Maintainer: Benoît Ryder <benoit@ryder.fr>
+" Latest Revision: 2022-09-23
+
+if exists("b:current_syntax")
+ finish
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+" Comment line
+syn match hlsplaylistComment "^#\(EXT\)\@!.*$"
+" Segment URL
+syn match hlsplaylistUrl "^[^#].*$"
+
+" Unknown tags, assume an attribute list or nothing
+syn match hlsplaylistTagUnknown "^#EXT[^:]*$"
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagUnknown start="^#EXT[^:]*\ze:" end="$" keepend contains=hlsplaylistAttributeList
+
+" Basic Tags
+syn match hlsplaylistTagHeader "^#EXTM3U$"
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagHeader start="^#EXT-X-VERSION\ze:" end="$" keepend contains=hlsplaylistValueInt
+
+" Media or Multivariant Playlist Tags
+syn match hlsplaylistTagHeader "^#EXT-X-INDEPENDENT-SEGMENTS$"
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagDelimiter start="^#EXT-X-START\ze:" end="$" keepend contains=hlsplaylistAttributeList
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagStandard start="^#EXT-X-DEFINE\ze:" end="$" keepend contains=hlsplaylistAttributeList
+
+" Media Playlist Tags
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagHeader start="^#EXT-X-TARGETDURATION\ze:" end="$" keepend contains=hlsplaylistValueFloat
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagHeader start="^#EXT-X-MEDIA-SEQUENCE\ze:" end="$" keepend contains=hlsplaylistValueInt
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagHeader start="^#EXT-X-DISCONTINUITY-SEQUENCE\ze:" end="$" keepend contains=hlsplaylistValueInt
+syn match hlsplaylistTagDelimiter "^#EXT-X-ENDLIST$"
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagHeader start="^#EXT-X-PLAYLIST-TYPE\ze:" end="$" keepend contains=hlsplaylistAttributeEnum
+syn match hlsplaylistTagStandard "^#EXT-X-I-FRAME-ONLY$"
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagHeader start="^#EXT-X-PART-INF\ze:" end="$" keepend contains=hlsplaylistAttributeList
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagHeader start="^#EXT-X-SERVER-CONTROL\ze:" end="$" keepend contains=hlsplaylistAttributeList
+
+" Media Segment Tags
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagStatement start="^#EXTINF\ze:" end="$" keepend contains=hlsplaylistValueFloat,hlsplaylistExtInfDesc
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagStandard start="^#EXT-X-BYTERANGE\ze:" end="$" keepend contains=hlsplaylistValueInt
+syn match hlsplaylistTagDelimiter "^#EXT-X-DISCONTINUITY$"
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagStandard start="^#EXT-X-KEY\ze:" end="$" keepend contains=hlsplaylistAttributeList
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagStandard start="^#EXT-X-MAP\ze:" end="$" keepend contains=hlsplaylistAttributeList
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagStandard start="^#EXT-X-PROGRAM-DATE-TIME\ze:" end="$" keepend contains=hlsplaylistValueDateTime
+syn match hlsplaylistTagDelimiter "^#EXT-X-GAP$"
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagStandard start="^#EXT-X-BITRATE\ze:" end="$" keepend contains=hlsplaylistValueFloat
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagStatement start="^#EXT-X-PART\ze:" end="$" keepend contains=hlsplaylistAttributeList
+
+" Media Metadata Tags
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagStandard start="^#EXT-X-DATERANGE\ze:" end="$" keepend contains=hlsplaylistAttributeList
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagStandard start="^#EXT-X-SKIP\ze:" end="$" keepend contains=hlsplaylistAttributeList
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagStatement start="^#EXT-X-PRELOAD-HINT\ze:" end="$" keepend contains=hlsplaylistAttributeList
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagStatement start="^#EXT-X-RENDITION-REPORT\ze:" end="$" keepend contains=hlsplaylistAttributeList
+
+" Multivariant Playlist Tags
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagStandard start="^#EXT-X-MEDIA\ze:" end="$" keepend contains=hlsplaylistAttributeList
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagStatement start="^#EXT-X-STREAM-INF\ze:" end="$" keepend contains=hlsplaylistAttributeList
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagStatement start="^#EXT-X-I-FRAME-STREAM-INF\ze:" end="$" keepend contains=hlsplaylistAttributeList
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagStandard start="^#EXT-X-SESSION-DATA\ze:" end="$" keepend contains=hlsplaylistAttributeList
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagStandard start="^#EXT-X-SESSION-KEY\ze:" end="$" keepend contains=hlsplaylistAttributeList
+syn region hlsplaylistTagLine matchgroup=hlsplaylistTagStandard start="^#EXT-X-CONTENT-STEERING\ze:" end="$" keepend contains=hlsplaylistAttributeList
+
+" Attributes
+syn region hlsplaylistAttributeList start=":" end="$" keepend contained
+ \ contains=hlsplaylistAttributeName,hlsplaylistAttributeInt,hlsplaylistAttributeHex,hlsplaylistAttributeFloat,hlsplaylistAttributeString,hlsplaylistAttributeEnum,hlsplaylistAttributeResolution,hlsplaylistAttributeUri
+" Common attributes
+syn match hlsplaylistAttributeName "[A-Za-z-]\+\ze=" contained
+syn match hlsplaylistAttributeEnum "=\zs[A-Za-z][A-Za-z0-9-_]*" contained
+syn match hlsplaylistAttributeString +=\zs"[^"]*"+ contained
+syn match hlsplaylistAttributeInt "=\zs\d\+" contained
+syn match hlsplaylistAttributeFloat "=\zs-\?\d*\.\d*" contained
+syn match hlsplaylistAttributeHex "=\zs0[xX]\d*" contained
+syn match hlsplaylistAttributeResolution "=\zs\d\+x\d\+" contained
+" Allow different highligting for URI attributes
+syn region hlsplaylistAttributeUri matchgroup=hlsplaylistAttributeName start="\zsURI\ze" end="\(,\|$\)" contained contains=hlsplaylistUriQuotes
+syn region hlsplaylistUriQuotes matchgroup=hlsplaylistAttributeString start=+"+ end=+"+ keepend contained contains=hlsplaylistUriValue
+syn match hlsplaylistUriValue /[^" ]\+/ contained
+" Individual values
+syn match hlsplaylistValueInt "[0-9]\+" contained
+syn match hlsplaylistValueFloat "\(\d\+\|\d*\.\d*\)" contained
+syn match hlsplaylistExtInfDesc ",\zs.*$" contained
+syn match hlsplaylistValueDateTime "\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d\(\.\d*\)\?\(Z\|\d\d:\?\d\d\)$" contained
+
+
+" Define default highlighting
+
+hi def link hlsplaylistComment Comment
+hi def link hlsplaylistUrl NONE
+
+hi def link hlsplaylistTagHeader Special
+hi def link hlsplaylistTagStandard Define
+hi def link hlsplaylistTagDelimiter Delimiter
+hi def link hlsplaylistTagStatement Statement
+hi def link hlsplaylistTagUnknown Special
+
+hi def link hlsplaylistUriQuotes String
+hi def link hlsplaylistUriValue Underlined
+hi def link hlsplaylistAttributeQuotes String
+hi def link hlsplaylistAttributeName Identifier
+hi def link hlsplaylistAttributeInt Number
+hi def link hlsplaylistAttributeHex Number
+hi def link hlsplaylistAttributeFloat Float
+hi def link hlsplaylistAttributeString String
+hi def link hlsplaylistAttributeEnum Constant
+hi def link hlsplaylistAttributeResolution Constant
+hi def link hlsplaylistValueInt Number
+hi def link hlsplaylistValueFloat Float
+hi def link hlsplaylistExtInfDesc String
+hi def link hlsplaylistValueDateTime Constant
+
+
+let b:current_syntax = "hlsplaylist"
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: sts=2 sw=2 et
diff --git a/runtime/syntax/plsql.vim b/runtime/syntax/plsql.vim
index 21681d59e4..9b4df09ac7 100644
--- a/runtime/syntax/plsql.vim
+++ b/runtime/syntax/plsql.vim
@@ -4,8 +4,11 @@
" Previous Maintainer: Jeff Lanzarotta (jefflanzarotta at yahoo dot com)
" Previous Maintainer: C. Laurence Gonsalves (clgonsal@kami.com)
" URL: https://github.com/lee-lindley/vim_plsql_syntax
-" Last Change: Aug 21, 2022
-" History Lee Lindley (lee dot lindley at gmail dot com)
+" Last Change: Sep 19, 2022
+" History Carsten Czarski (carsten dot czarski at oracle com)
+" add handling for typical SQL*Plus commands (rem, start, host, set, etc)
+" add error highlight for non-breaking space
+" Lee Lindley (lee dot lindley at gmail dot com)
" use get with default 0 instead of exists per Bram suggestion
" make procedure folding optional
" updated to 19c keywords. refined quoting.
@@ -54,8 +57,13 @@ syn case ignore
syn match plsqlGarbage "[^ \t()]"
syn match plsqlIdentifier "[a-z][a-z0-9$_#]*"
+syn match plsqlSqlPlusDefine "&&\?[a-z][a-z0-9$_#]*\.\?"
syn match plsqlHostIdentifier ":[a-z][a-z0-9$_#]*"
+" The Non-Breaking is often accidentally typed (Mac User: Opt+Space, after typing the "|", Opt+7);
+" error highlight for these avoids running into annoying compiler errors.
+syn match plsqlIllegalSpace "[\xa0]"
+
" When wanted, highlight the trailing whitespace.
if get(g:,"plsql_space_errors",0) == 1
if get(g:,"plsql_no_trail_space_error",0) == 0
@@ -79,7 +87,6 @@ syn match plsqlOperator "\<IS\\_s\+\(NOT\_s\+\)\?NULL\>"
"
" conditional compilation Preprocessor directives and sqlplus define sigil
syn match plsqlPseudo "$[$a-z][a-z0-9$_#]*"
-syn match plsqlPseudo "&"
syn match plsqlReserved "\<\(CREATE\|THEN\|UPDATE\|INSERT\|SET\)\>"
syn match plsqlKeyword "\<\(REPLACE\|PACKAGE\|FUNCTION\|PROCEDURE\|TYPE|BODY\|WHEN\|MATCHED\)\>"
@@ -150,7 +157,7 @@ syn keyword plsqlKeyword DATA_SECURITY_REWRITE_LIMIT DATA_VALIDATE DATE_MODE DAY
syn keyword plsqlKeyword DBMS_STATS DBSTR2UTF8 DBTIMEZONE DB_ROLE_CHANGE DB_UNIQUE_NAME DB_VERSION
syn keyword plsqlKeyword DDL DEALLOCATE DEBUG DEBUGGER DECLARE DECODE DECOMPOSE DECOMPRESS DECORRELATE
syn keyword plsqlKeyword DECR DECREMENT DECRYPT DEDUPLICATE DEFAULTS DEFAULT_COLLATION DEFAULT_PDB_HINT
-syn keyword plsqlKeyword DEFERRABLE DEFERRED DEFINE DEFINED DEFINER DEFINITION DEGREE DELAY DELEGATE
+syn keyword plsqlKeyword DEFERRABLE DEFERRED DEFINED DEFINER DEFINITION DEGREE DELAY DELEGATE
syn keyword plsqlKeyword DELETEXML DELETE_ALL DEMAND DENORM_AV DENSE_RANK DENSE_RANKM DEPENDENT DEPTH
syn keyword plsqlKeyword DEQUEUE DEREF DEREF_NO_REWRITE DESCENDANT DESCRIPTION DESTROY DETACHED DETERMINED
syn keyword plsqlKeyword DETERMINES DETERMINISTIC DG_GATHER_STATS DIAGNOSTICS DICTIONARY DIGEST DIMENSION
@@ -189,7 +196,7 @@ syn keyword plsqlKeyword HELP HEXTORAW HEXTOREF HIDDEN HIDE HIERARCHICAL HIERARC
syn keyword plsqlKeyword HIER_CAPTION HIER_CHILDREN HIER_CHILD_COUNT HIER_COLUMN HIER_CONDITION HIER_DEPTH
syn keyword plsqlKeyword HIER_DESCRIPTION HIER_HAS_CHILDREN HIER_LAG HIER_LEAD HIER_LEVEL HIER_MEMBER_NAME
syn keyword plsqlKeyword HIER_MEMBER_UNIQUE_NAME HIER_ORDER HIER_PARENT HIER_WINDOW HIGH HINTSET_BEGIN
-syn keyword plsqlKeyword HINTSET_END HOST HOT HOUR HOURS HTTP HWM_BROKERED HYBRID ID IDENTIFIER IDENTITY
+syn keyword plsqlKeyword HINTSET_END HOT HOUR HOURS HTTP HWM_BROKERED HYBRID ID IDENTIFIER IDENTITY
syn keyword plsqlKeyword IDGENERATORS IDLE IDLE_TIME IGNORE IGNORE_OPTIM_EMBEDDED_HINTS IGNORE_ROW_ON_DUPKEY_INDEX
syn keyword plsqlKeyword IGNORE_WHERE_CLAUSE ILM IMMEDIATE IMMUTABLE IMPACT IMPORT INACTIVE INACTIVE_ACCOUNT_TIME
syn keyword plsqlKeyword INCLUDE INCLUDES INCLUDE_VERSION INCLUDING INCOMING INCR INCREMENT INCREMENTAL
@@ -342,7 +349,7 @@ syn keyword plsqlKeyword SELF SEMIJOIN SEMIJOIN_DRIVER SEMI_TO_INNER SENSITIVE S
syn keyword plsqlKeyword SERIAL SERIALIZABLE SERVERERROR SERVICE SERVICES SERVICE_NAME_CONVERT SESSION
syn keyword plsqlKeyword SESSIONS_PER_USER SESSIONTIMEZONE SESSIONTZNAME SESSION_CACHED_CURSORS SETS
syn keyword plsqlKeyword SETTINGS SET_GBY_PUSHDOWN SET_TO_JOIN SEVERE SHARD SHARDED SHARDS SHARDSPACE
-syn keyword plsqlKeyword SHARD_CHUNK_ID SHARED SHARED_POOL SHARE_OF SHARING SHD$COL$MAP SHELFLIFE SHOW
+syn keyword plsqlKeyword SHARD_CHUNK_ID SHARED SHARED_POOL SHARE_OF SHARING SHD$COL$MAP SHELFLIFE
syn keyword plsqlKeyword SHRINK SHUTDOWN SIBLING SIBLINGS SID SIGN SIGNAL_COMPONENT SIGNAL_FUNCTION
syn keyword plsqlKeyword SIGNATURE SIMPLE SIN SINGLE SINGLETASK SINH SITE SKEWNESS_POP SKEWNESS_SAMP
syn keyword plsqlKeyword SKIP SKIP_EXT_OPTIMIZER SKIP_PROXY SKIP_UNQ_UNUSABLE_IDX SKIP_UNUSABLE_INDEXES
@@ -445,7 +452,7 @@ syn keyword plsqlKeyword VECTOR_READ_TRACE VECTOR_TRANSFORM VECTOR_TRANSFORM_DIM
syn keyword plsqlKeyword VERIFIER VERIFY VERSION VERSIONING VERSIONS VERSIONS_ENDSCN VERSIONS_ENDTIME
syn keyword plsqlKeyword VERSIONS_OPERATION VERSIONS_STARTSCN VERSIONS_STARTTIME VERSIONS_XID VIEWS
syn keyword plsqlKeyword VIOLATION VIRTUAL VISIBILITY VISIBLE VOLUME VSIZE WAIT WALLET WEEK WEEKS WELLFORMED
-syn keyword plsqlKeyword WHENEVER WHITESPACE WIDTH_BUCKET WINDOW WITHIN WITHOUT WITH_EXPRESSION
+syn keyword plsqlKeyword WHITESPACE WIDTH_BUCKET WINDOW WITHIN WITHOUT WITH_EXPRESSION
syn keyword plsqlKeyword WITH_PLSQL WORK WRAPPED WRAPPER WRITE XDB_FASTPATH_INSERT XID XML XML2OBJECT
syn keyword plsqlKeyword XMLATTRIBUTES XMLCAST XMLCDATA XMLCOLATTVAL XMLCOMMENT XMLCONCAT XMLDIFF XMLELEMENT
syn keyword plsqlKeyword XMLEXISTS XMLEXISTS2 XMLFOREST XMLINDEX_REWRITE XMLINDEX_REWRITE_IN_SELECT
@@ -468,13 +475,13 @@ syn keyword plsqlReserved MINUS MODE NOCOMPRESS NOWAIT NUMBER_BASE OCICOLL OCIDA
syn keyword plsqlReserved OCIDURATION OCIINTERVAL OCILOBLOCATOR OCINUMBER OCIRAW OCIREF OCIREFCURSOR
syn keyword plsqlReserved OCIROWID OCISTRING OCITYPE OF ON OPTION ORACLE ORADATA ORDER ORLANY ORLVARY
syn keyword plsqlReserved OUT OVERRIDING PARALLEL_ENABLE PARAMETER PASCAL PCTFREE PIPE PIPELINED POLYMORPHIC
-syn keyword plsqlReserved PRAGMA PRIOR PUBLIC RAISE RECORD RELIES_ON REM RENAME RESOURCE RESULT REVOKE ROWID
+syn keyword plsqlReserved PRAGMA PRIOR PUBLIC RAISE RECORD RELIES_ON RENAME RESOURCE RESULT REVOKE ROWID
syn keyword plsqlReserved SB1 SB2
syn match plsqlReserved "\<SELECT\>"
syn keyword plsqlReserved SEPARATE SHARE SHORT SIZE SIZE_T SPARSE SQLCODE SQLDATA
syn keyword plsqlReserved SQLNAME SQLSTATE STANDARD START STORED STRUCT STYLE SYNONYM TABLE TDO
syn keyword plsqlReserved TRANSACTIONAL TRIGGER UB1 UB4 UNION UNIQUE UNSIGNED UNTRUSTED VALIST
-syn keyword plsqlReserved VALUES VARIABLE VIEW VOID WHERE WITH
+syn keyword plsqlReserved VALUES VIEW VOID WHERE WITH
" PL/SQL and SQL functions.
syn keyword plsqlFunction ABS ACOS ADD_MONTHS APPROX_COUNT APPROX_COUNT_DISTINCT APPROX_COUNT_DISTINCT_AGG
@@ -584,18 +591,18 @@ syn match plsqlEND "\<END\>"
syn match plsqlISAS "\<\(IS\|AS\)\>"
" Various types of comments.
-syntax region plsqlCommentL start="--" skip="\\$" end="$" keepend extend contains=@plsqlCommentGroup,plsqlSpaceError
+syntax region plsqlCommentL start="--" skip="\\$" end="$" keepend extend contains=@plsqlCommentGroup,plsqlSpaceError,plsqlIllegalSpace,plsqlSqlplusDefine
if get(g:,"plsql_fold",0) == 1
syntax region plsqlComment
\ start="/\*" end="\*/"
\ extend
- \ contains=@plsqlCommentGroup,plsqlSpaceError
+ \ contains=@plsqlCommentGroup,plsqlSpaceError,plsqlIllegalSpace,plsqlSqlplusDefine
\ fold
else
syntax region plsqlComment
\ start="/\*" end="\*/"
\ extend
- \ contains=@plsqlCommentGroup,plsqlSpaceError
+ \ contains=@plsqlCommentGroup,plsqlSpaceError,plsqlIllegalSpace,plsqlSqlplusDefine
endif
syn cluster plsqlCommentAll contains=plsqlCommentL,plsqlComment
@@ -618,23 +625,23 @@ syn match plsqlFloatLiteral contained "\.\(\d\+\([eE][+-]\?\d\+\)\?\)[fd]\?"
" double quoted strings in SQL are database object names. Should be a subgroup of Normal.
" We will use Character group as a proxy for that so color can be chosen close to Normal
syn region plsqlQuotedIdentifier matchgroup=plsqlOperator start=+n\?"+ end=+"+ keepend extend
-syn cluster plsqlIdentifiers contains=plsqlIdentifier,plsqlQuotedIdentifier
+syn cluster plsqlIdentifiers contains=plsqlIdentifier,plsqlQuotedIdentifier,plsqlSqlPlusDefine
" quoted string literals
if get(g:,"plsql_fold",0) == 1
- syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?'+ skip=+''+ end=+'+ fold keepend extend
- syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'\z([^[(<{]\)+ end=+\z1'+ fold keepend extend
- syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'<+ end=+>'+ fold keepend extend
- syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'{+ end=+}'+ fold keepend extend
- syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'(+ end=+)'+ fold keepend extend
- syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'\[+ end=+]'+ fold keepend extend
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?'+ skip=+''+ end=+'+ contains=plsqlSqlplusDefine fold keepend extend
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'\z([^[(<{]\)+ end=+\z1'+ contains=plsqlSqlplusDefine fold keepend extend
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'<+ end=+>'+ contains=plsqlSqlplusDefine fold keepend extend
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'{+ end=+}'+ contains=plsqlSqlplusDefine fold keepend extend
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'(+ end=+)'+ contains=plsqlSqlplusDefine fold keepend extend
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'\[+ end=+]'+ contains=plsqlSqlplusDefine fold keepend extend
else
- syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?'+ skip=+''+ end=+'+
- syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'\z([^[(<{]\)+ end=+\z1'+
- syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'<+ end=+>'+
- syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'{+ end=+}'+
- syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'(+ end=+)'+
- syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'\[+ end=+]'+
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?'+ skip=+''+ end=+'+ contains=plsqlSqlplusDefine
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'\z([^[(<{]\)+ end=+\z1'+ contains=plsqlSqlplusDefine
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'<+ end=+>'+ contains=plsqlSqlplusDefine
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'{+ end=+}'+ contains=plsqlSqlplusDefine
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'(+ end=+)'+ contains=plsqlSqlplusDefine
+ syn region plsqlStringLiteral matchgroup=plsqlOperator start=+n\?q'\[+ end=+]'+ contains=plsqlSqlplusDefine
endif
syn keyword plsqlBooleanLiteral TRUE FALSE
@@ -682,6 +689,10 @@ syn match plsqlConditional "\<END\>\_s\+\<IF\>"
syn match plsqlCase "\<END\>\_s\+\<CASE\>"
syn match plsqlCase "\<CASE\>"
+syn region plsqlSqlPlusCommentL start="^\(REM\)\( \|$\)" skip="\\$" end="$" keepend extend contains=@plsqlCommentGroup,plsqlSpaceError,plsqlIllegalSpace
+syn region plsqlSqlPlusCommand start="^\(SET\|DEFINE\|PROMPT\|ACCEPT\|EXEC\|HOST\|SHOW\|VAR\|VARIABLE\|COL\|WHENEVER\|TIMING\)\( \|$\)" skip="\\$" end="$" keepend extend
+syn region plsqlSqlPlusRunFile start="^\(@\|@@\)" skip="\\$" end="$" keepend extend
+
if get(g:,"plsql_fold",0) == 1
setlocal foldmethod=syntax
syn sync fromstart
@@ -826,6 +837,13 @@ hi def link plsqlComment2String String
hi def link plsqlTrigger Function
hi def link plsqlTypeAttribute StorageClass
hi def link plsqlTodo Todo
+
+hi def link plsqlIllegalSpace Error
+hi def link plsqlSqlPlusDefine PreProc
+hi def link plsqlSqlPlusCommand PreProc
+hi def link plsqlSqlPlusRunFile Include
+hi def link plsqlSqlPlusCommentL Comment
+
" to be able to change them after loading, need override whether defined or not
if get(g:,"plsql_legacy_sql_keywords",0) == 1
hi link plsqlSQLKeyword Function
diff --git a/runtime/syntax/solidity.vim b/runtime/syntax/solidity.vim
new file mode 100644
index 0000000000..e552446e10
--- /dev/null
+++ b/runtime/syntax/solidity.vim
@@ -0,0 +1,173 @@
+" Vim syntax file
+" Language: Solidity
+" Maintainer: Cothi (jiungdev@gmail.com)
+" Original Author: tomlion (https://github.com/tomlion/vim-solidity/blob/master/syntax/solidity.vim)
+" Last Changed: 2022 Sep 27
+"
+" Additional contributors:
+" Modified by thesis (https://github.com/thesis/vim-solidity/blob/main/indent/solidity.vim)
+
+if exists("b:current_syntax")
+ finish
+endif
+
+" keyword
+syn keyword solKeyword abstract anonymous as break calldata case catch constant constructor continue default switch revert require
+syn keyword solKeyword ecrecover addmod mulmod keccak256
+syn keyword solKeyword delete do else emit enum external final for function if immutable import in indexed inline
+syn keyword solKeyword interface internal is let match memory modifier new of payable pragma private public pure override virtual
+syn keyword solKeyword relocatable return returns static storage struct throw try type typeof using
+syn keyword solKeyword var view while
+
+syn keyword solConstant true false wei szabo finney ether seconds minutes hours days weeks years now
+syn keyword solConstant abi block blockhash msg tx this super selfdestruct
+
+syn keyword solBuiltinType mapping address bool
+syn keyword solBuiltinType int int8 int16 int24 int32 int40 int48 int56 int64 int72 int80 int88 int96 int104 int112 int120 int128 int136 int144 int152 int160 int168 int178 int184 int192 int200 int208 int216 int224 int232 int240 int248 int256
+syn keyword solBuiltinType uint uint8 uint16 uint24 uint32 uint40 uint48 uint56 uint64 uint72 uint80 uint88 uint96 uint104 uint112 uint120 uint128 uint136 uint144 uint152 uint160 uint168 uint178 uint184 uint192 uint200 uint208 uint216 uint224 uint232 uint240 uint248 uint256
+syn keyword solBuiltinType fixed
+syn keyword solBuiltinType fixed0x8 fixed0x16 fixed0x24 fixed0x32 fixed0x40 fixed0x48 fixed0x56 fixed0x64 fixed0x72 fixed0x80 fixed0x88 fixed0x96 fixed0x104 fixed0x112 fixed0x120 fixed0x128 fixed0x136 fixed0x144 fixed0x152 fixed0x160 fixed0x168 fixed0x178 fixed0x184 fixed0x192 fixed0x200 fixed0x208 fixed0x216 fixed0x224 fixed0x232 fixed0x240 fixed0x248 fixed0x256
+syn keyword solBuiltinType fixed8x8 fixed8x16 fixed8x24 fixed8x32 fixed8x40 fixed8x48 fixed8x56 fixed8x64 fixed8x72 fixed8x80 fixed8x88 fixed8x96 fixed8x104 fixed8x112 fixed8x120 fixed8x128 fixed8x136 fixed8x144 fixed8x152 fixed8x160 fixed8x168 fixed8x178 fixed8x184 fixed8x192 fixed8x200 fixed8x208 fixed8x216 fixed8x224 fixed8x232 fixed8x240 fixed8x248
+syn keyword solBuiltinType fixed16x8 fixed16x16 fixed16x24 fixed16x32 fixed16x40 fixed16x48 fixed16x56 fixed16x64 fixed16x72 fixed16x80 fixed16x88 fixed16x96 fixed16x104 fixed16x112 fixed16x120 fixed16x128 fixed16x136 fixed16x144 fixed16x152 fixed16x160 fixed16x168 fixed16x178 fixed16x184 fixed16x192 fixed16x200 fixed16x208 fixed16x216 fixed16x224 fixed16x232 fixed16x240
+syn keyword solBuiltinType fixed24x8 fixed24x16 fixed24x24 fixed24x32 fixed24x40 fixed24x48 fixed24x56 fixed24x64 fixed24x72 fixed24x80 fixed24x88 fixed24x96 fixed24x104 fixed24x112 fixed24x120 fixed24x128 fixed24x136 fixed24x144 fixed24x152 fixed24x160 fixed24x168 fixed24x178 fixed24x184 fixed24x192 fixed24x200 fixed24x208 fixed24x216 fixed24x224 fixed24x232
+syn keyword solBuiltinType fixed32x8 fixed32x16 fixed32x24 fixed32x32 fixed32x40 fixed32x48 fixed32x56 fixed32x64 fixed32x72 fixed32x80 fixed32x88 fixed32x96 fixed32x104 fixed32x112 fixed32x120 fixed32x128 fixed32x136 fixed32x144 fixed32x152 fixed32x160 fixed32x168 fixed32x178 fixed32x184 fixed32x192 fixed32x200 fixed32x208 fixed32x216 fixed32x224
+syn keyword solBuiltinType fixed40x8 fixed40x16 fixed40x24 fixed40x32 fixed40x40 fixed40x48 fixed40x56 fixed40x64 fixed40x72 fixed40x80 fixed40x88 fixed40x96 fixed40x104 fixed40x112 fixed40x120 fixed40x128 fixed40x136 fixed40x144 fixed40x152 fixed40x160 fixed40x168 fixed40x178 fixed40x184 fixed40x192 fixed40x200 fixed40x208 fixed40x216
+syn keyword solBuiltinType fixed48x8 fixed48x16 fixed48x24 fixed48x32 fixed48x40 fixed48x48 fixed48x56 fixed48x64 fixed48x72 fixed48x80 fixed48x88 fixed48x96 fixed48x104 fixed48x112 fixed48x120 fixed48x128 fixed48x136 fixed48x144 fixed48x152 fixed48x160 fixed48x168 fixed48x178 fixed48x184 fixed48x192 fixed48x200 fixed48x208
+syn keyword solBuiltinType fixed56x8 fixed56x16 fixed56x24 fixed56x32 fixed56x40 fixed56x48 fixed56x56 fixed56x64 fixed56x72 fixed56x80 fixed56x88 fixed56x96 fixed56x104 fixed56x112 fixed56x120 fixed56x128 fixed56x136 fixed56x144 fixed56x152 fixed56x160 fixed56x168 fixed56x178 fixed56x184 fixed56x192 fixed56x200
+syn keyword solBuiltinType fixed64x8 fixed64x16 fixed64x24 fixed64x32 fixed64x40 fixed64x48 fixed64x56 fixed64x64 fixed64x72 fixed64x80 fixed64x88 fixed64x96 fixed64x104 fixed64x112 fixed64x120 fixed64x128 fixed64x136 fixed64x144 fixed64x152 fixed64x160 fixed64x168 fixed64x178 fixed64x184 fixed64x192
+syn keyword solBuiltinType fixed72x8 fixed72x16 fixed72x24 fixed72x32 fixed72x40 fixed72x48 fixed72x56 fixed72x64 fixed72x72 fixed72x80 fixed72x88 fixed72x96 fixed72x104 fixed72x112 fixed72x120 fixed72x128 fixed72x136 fixed72x144 fixed72x152 fixed72x160 fixed72x168 fixed72x178 fixed72x184
+syn keyword solBuiltinType fixed80x8 fixed80x16 fixed80x24 fixed80x32 fixed80x40 fixed80x48 fixed80x56 fixed80x64 fixed80x72 fixed80x80 fixed80x88 fixed80x96 fixed80x104 fixed80x112 fixed80x120 fixed80x128 fixed80x136 fixed80x144 fixed80x152 fixed80x160 fixed80x168 fixed80x178
+syn keyword solBuiltinType fixed88x8 fixed88x16 fixed88x24 fixed88x32 fixed88x40 fixed88x48 fixed88x56 fixed88x64 fixed88x72 fixed88x80 fixed88x88 fixed88x96 fixed88x104 fixed88x112 fixed88x120 fixed88x128 fixed88x136 fixed88x144 fixed88x152 fixed88x160 fixed88x168
+syn keyword solBuiltinType fixed96x8 fixed96x16 fixed96x24 fixed96x32 fixed96x40 fixed96x48 fixed96x56 fixed96x64 fixed96x72 fixed96x80 fixed96x88 fixed96x96 fixed96x104 fixed96x112 fixed96x120 fixed96x128 fixed96x136 fixed96x144 fixed96x152 fixed96x160
+syn keyword solBuiltinType fixed104x8 fixed104x16 fixed104x24 fixed104x32 fixed104x40 fixed104x48 fixed104x56 fixed104x64 fixed104x72 fixed104x80 fixed104x88 fixed104x96 fixed104x104 fixed104x112 fixed104x120 fixed104x128 fixed104x136 fixed104x144 fixed104x152
+syn keyword solBuiltinType fixed112x8 fixed112x16 fixed112x24 fixed112x32 fixed112x40 fixed112x48 fixed112x56 fixed112x64 fixed112x72 fixed112x80 fixed112x88 fixed112x96 fixed112x104 fixed112x112 fixed112x120 fixed112x128 fixed112x136 fixed112x144
+syn keyword solBuiltinType fixed120x8 fixed120x16 fixed120x24 fixed120x32 fixed120x40 fixed120x48 fixed120x56 fixed120x64 fixed120x72 fixed120x80 fixed120x88 fixed120x96 fixed120x104 fixed120x112 fixed120x120 fixed120x128 fixed120x136
+syn keyword solBuiltinType fixed128x8 fixed128x16 fixed128x24 fixed128x32 fixed128x40 fixed128x48 fixed128x56 fixed128x64 fixed128x72 fixed128x80 fixed128x88 fixed128x96 fixed128x104 fixed128x112 fixed128x120 fixed128x128
+syn keyword solBuiltinType fixed136x8 fixed136x16 fixed136x24 fixed136x32 fixed136x40 fixed136x48 fixed136x56 fixed136x64 fixed136x72 fixed136x80 fixed136x88 fixed136x96 fixed136x104 fixed136x112 fixed136x120
+syn keyword solBuiltinType fixed144x8 fixed144x16 fixed144x24 fixed144x32 fixed144x40 fixed144x48 fixed144x56 fixed144x64 fixed144x72 fixed144x80 fixed144x88 fixed144x96 fixed144x104 fixed144x112
+syn keyword solBuiltinType fixed152x8 fixed152x16 fixed152x24 fixed152x32 fixed152x40 fixed152x48 fixed152x56 fixed152x64 fixed152x72 fixed152x80 fixed152x88 fixed152x96 fixed152x104
+syn keyword solBuiltinType fixed160x8 fixed160x16 fixed160x24 fixed160x32 fixed160x40 fixed160x48 fixed160x56 fixed160x64 fixed160x72 fixed160x80 fixed160x88 fixed160x96
+syn keyword solBuiltinType fixed168x8 fixed168x16 fixed168x24 fixed168x32 fixed168x40 fixed168x48 fixed168x56 fixed168x64 fixed168x72 fixed168x80 fixed168x88
+syn keyword solBuiltinType fixed176x8 fixed176x16 fixed176x24 fixed176x32 fixed176x40 fixed176x48 fixed176x56 fixed176x64 fixed176x72 fixed176x80
+syn keyword solBuiltinType fixed184x8 fixed184x16 fixed184x24 fixed184x32 fixed184x40 fixed184x48 fixed184x56 fixed184x64 fixed184x72
+syn keyword solBuiltinType fixed192x8 fixed192x16 fixed192x24 fixed192x32 fixed192x40 fixed192x48 fixed192x56 fixed192x64
+syn keyword solBuiltinType fixed200x8 fixed200x16 fixed200x24 fixed200x32 fixed200x40 fixed200x48 fixed200x56
+syn keyword solBuiltinType fixed208x8 fixed208x16 fixed208x24 fixed208x32 fixed208x40 fixed208x48
+syn keyword solBuiltinType fixed216x8 fixed216x16 fixed216x24 fixed216x32 fixed216x40
+syn keyword solBuiltinType fixed224x8 fixed224x16 fixed224x24 fixed224x32
+syn keyword solBuiltinType fixed232x8 fixed232x16 fixed232x24
+syn keyword solBuiltinType fixed240x8 fixed240x16
+syn keyword solBuiltinType fixed248x8
+syn keyword solBuiltinType ufixed
+syn keyword solBuiltinType ufixed0x8 ufixed0x16 ufixed0x24 ufixed0x32 ufixed0x40 ufixed0x48 ufixed0x56 ufixed0x64 ufixed0x72 ufixed0x80 ufixed0x88 ufixed0x96 ufixed0x104 ufixed0x112 ufixed0x120 ufixed0x128 ufixed0x136 ufixed0x144 ufixed0x152 ufixed0x160 ufixed0x168 ufixed0x178 ufixed0x184 ufixed0x192 ufixed0x200 ufixed0x208 ufixed0x216 ufixed0x224 ufixed0x232 ufixed0x240 ufixed0x248 ufixed0x256
+syn keyword solBuiltinType ufixed8x8 ufixed8x16 ufixed8x24 ufixed8x32 ufixed8x40 ufixed8x48 ufixed8x56 ufixed8x64 ufixed8x72 ufixed8x80 ufixed8x88 ufixed8x96 ufixed8x104 ufixed8x112 ufixed8x120 ufixed8x128 ufixed8x136 ufixed8x144 ufixed8x152 ufixed8x160 ufixed8x168 ufixed8x178 ufixed8x184 ufixed8x192 ufixed8x200 ufixed8x208 ufixed8x216 ufixed8x224 ufixed8x232 ufixed8x240 ufixed8x248
+syn keyword solBuiltinType ufixed16x8 ufixed16x16 ufixed16x24 ufixed16x32 ufixed16x40 ufixed16x48 ufixed16x56 ufixed16x64 ufixed16x72 ufixed16x80 ufixed16x88 ufixed16x96 ufixed16x104 ufixed16x112 ufixed16x120 ufixed16x128 ufixed16x136 ufixed16x144 ufixed16x152 ufixed16x160 ufixed16x168 ufixed16x178 ufixed16x184 ufixed16x192 ufixed16x200 ufixed16x208 ufixed16x216 ufixed16x224 ufixed16x232 ufixed16x240
+syn keyword solBuiltinType ufixed24x8 ufixed24x16 ufixed24x24 ufixed24x32 ufixed24x40 ufixed24x48 ufixed24x56 ufixed24x64 ufixed24x72 ufixed24x80 ufixed24x88 ufixed24x96 ufixed24x104 ufixed24x112 ufixed24x120 ufixed24x128 ufixed24x136 ufixed24x144 ufixed24x152 ufixed24x160 ufixed24x168 ufixed24x178 ufixed24x184 ufixed24x192 ufixed24x200 ufixed24x208 ufixed24x216 ufixed24x224 ufixed24x232
+syn keyword solBuiltinType ufixed32x8 ufixed32x16 ufixed32x24 ufixed32x32 ufixed32x40 ufixed32x48 ufixed32x56 ufixed32x64 ufixed32x72 ufixed32x80 ufixed32x88 ufixed32x96 ufixed32x104 ufixed32x112 ufixed32x120 ufixed32x128 ufixed32x136 ufixed32x144 ufixed32x152 ufixed32x160 ufixed32x168 ufixed32x178 ufixed32x184 ufixed32x192 ufixed32x200 ufixed32x208 ufixed32x216 ufixed32x224
+syn keyword solBuiltinType ufixed40x8 ufixed40x16 ufixed40x24 ufixed40x32 ufixed40x40 ufixed40x48 ufixed40x56 ufixed40x64 ufixed40x72 ufixed40x80 ufixed40x88 ufixed40x96 ufixed40x104 ufixed40x112 ufixed40x120 ufixed40x128 ufixed40x136 ufixed40x144 ufixed40x152 ufixed40x160 ufixed40x168 ufixed40x178 ufixed40x184 ufixed40x192 ufixed40x200 ufixed40x208 ufixed40x216
+syn keyword solBuiltinType ufixed48x8 ufixed48x16 ufixed48x24 ufixed48x32 ufixed48x40 ufixed48x48 ufixed48x56 ufixed48x64 ufixed48x72 ufixed48x80 ufixed48x88 ufixed48x96 ufixed48x104 ufixed48x112 ufixed48x120 ufixed48x128 ufixed48x136 ufixed48x144 ufixed48x152 ufixed48x160 ufixed48x168 ufixed48x178 ufixed48x184 ufixed48x192 ufixed48x200 ufixed48x208
+syn keyword solBuiltinType ufixed56x8 ufixed56x16 ufixed56x24 ufixed56x32 ufixed56x40 ufixed56x48 ufixed56x56 ufixed56x64 ufixed56x72 ufixed56x80 ufixed56x88 ufixed56x96 ufixed56x104 ufixed56x112 ufixed56x120 ufixed56x128 ufixed56x136 ufixed56x144 ufixed56x152 ufixed56x160 ufixed56x168 ufixed56x178 ufixed56x184 ufixed56x192 ufixed56x200
+syn keyword solBuiltinType ufixed64x8 ufixed64x16 ufixed64x24 ufixed64x32 ufixed64x40 ufixed64x48 ufixed64x56 ufixed64x64 ufixed64x72 ufixed64x80 ufixed64x88 ufixed64x96 ufixed64x104 ufixed64x112 ufixed64x120 ufixed64x128 ufixed64x136 ufixed64x144 ufixed64x152 ufixed64x160 ufixed64x168 ufixed64x178 ufixed64x184 ufixed64x192
+syn keyword solBuiltinType ufixed72x8 ufixed72x16 ufixed72x24 ufixed72x32 ufixed72x40 ufixed72x48 ufixed72x56 ufixed72x64 ufixed72x72 ufixed72x80 ufixed72x88 ufixed72x96 ufixed72x104 ufixed72x112 ufixed72x120 ufixed72x128 ufixed72x136 ufixed72x144 ufixed72x152 ufixed72x160 ufixed72x168 ufixed72x178 ufixed72x184
+syn keyword solBuiltinType ufixed80x8 ufixed80x16 ufixed80x24 ufixed80x32 ufixed80x40 ufixed80x48 ufixed80x56 ufixed80x64 ufixed80x72 ufixed80x80 ufixed80x88 ufixed80x96 ufixed80x104 ufixed80x112 ufixed80x120 ufixed80x128 ufixed80x136 ufixed80x144 ufixed80x152 ufixed80x160 ufixed80x168 ufixed80x178
+syn keyword solBuiltinType ufixed88x8 ufixed88x16 ufixed88x24 ufixed88x32 ufixed88x40 ufixed88x48 ufixed88x56 ufixed88x64 ufixed88x72 ufixed88x80 ufixed88x88 ufixed88x96 ufixed88x104 ufixed88x112 ufixed88x120 ufixed88x128 ufixed88x136 ufixed88x144 ufixed88x152 ufixed88x160 ufixed88x168
+syn keyword solBuiltinType ufixed96x8 ufixed96x16 ufixed96x24 ufixed96x32 ufixed96x40 ufixed96x48 ufixed96x56 ufixed96x64 ufixed96x72 ufixed96x80 ufixed96x88 ufixed96x96 ufixed96x104 ufixed96x112 ufixed96x120 ufixed96x128 ufixed96x136 ufixed96x144 ufixed96x152 ufixed96x160
+syn keyword solBuiltinType ufixed104x8 ufixed104x16 ufixed104x24 ufixed104x32 ufixed104x40 ufixed104x48 ufixed104x56 ufixed104x64 ufixed104x72 ufixed104x80 ufixed104x88 ufixed104x96 ufixed104x104 ufixed104x112 ufixed104x120 ufixed104x128 ufixed104x136 ufixed104x144 ufixed104x152
+syn keyword solBuiltinType ufixed112x8 ufixed112x16 ufixed112x24 ufixed112x32 ufixed112x40 ufixed112x48 ufixed112x56 ufixed112x64 ufixed112x72 ufixed112x80 ufixed112x88 ufixed112x96 ufixed112x104 ufixed112x112 ufixed112x120 ufixed112x128 ufixed112x136 ufixed112x144
+syn keyword solBuiltinType ufixed120x8 ufixed120x16 ufixed120x24 ufixed120x32 ufixed120x40 ufixed120x48 ufixed120x56 ufixed120x64 ufixed120x72 ufixed120x80 ufixed120x88 ufixed120x96 ufixed120x104 ufixed120x112 ufixed120x120 ufixed120x128 ufixed120x136
+syn keyword solBuiltinType ufixed128x8 ufixed128x16 ufixed128x24 ufixed128x32 ufixed128x40 ufixed128x48 ufixed128x56 ufixed128x64 ufixed128x72 ufixed128x80 ufixed128x88 ufixed128x96 ufixed128x104 ufixed128x112 ufixed128x120 ufixed128x128
+syn keyword solBuiltinType ufixed136x8 ufixed136x16 ufixed136x24 ufixed136x32 ufixed136x40 ufixed136x48 ufixed136x56 ufixed136x64 ufixed136x72 ufixed136x80 ufixed136x88 ufixed136x96 ufixed136x104 ufixed136x112 ufixed136x120
+syn keyword solBuiltinType ufixed144x8 ufixed144x16 ufixed144x24 ufixed144x32 ufixed144x40 ufixed144x48 ufixed144x56 ufixed144x64 ufixed144x72 ufixed144x80 ufixed144x88 ufixed144x96 ufixed144x104 ufixed144x112
+syn keyword solBuiltinType ufixed152x8 ufixed152x16 ufixed152x24 ufixed152x32 ufixed152x40 ufixed152x48 ufixed152x56 ufixed152x64 ufixed152x72 ufixed152x80 ufixed152x88 ufixed152x96 ufixed152x104
+syn keyword solBuiltinType ufixed160x8 ufixed160x16 ufixed160x24 ufixed160x32 ufixed160x40 ufixed160x48 ufixed160x56 ufixed160x64 ufixed160x72 ufixed160x80 ufixed160x88 ufixed160x96
+syn keyword solBuiltinType ufixed168x8 ufixed168x16 ufixed168x24 ufixed168x32 ufixed168x40 ufixed168x48 ufixed168x56 ufixed168x64 ufixed168x72 ufixed168x80 ufixed168x88
+syn keyword solBuiltinType ufixed176x8 ufixed176x16 ufixed176x24 ufixed176x32 ufixed176x40 ufixed176x48 ufixed176x56 ufixed176x64 ufixed176x72 ufixed176x80
+syn keyword solBuiltinType ufixed184x8 ufixed184x16 ufixed184x24 ufixed184x32 ufixed184x40 ufixed184x48 ufixed184x56 ufixed184x64 ufixed184x72
+syn keyword solBuiltinType ufixed192x8 ufixed192x16 ufixed192x24 ufixed192x32 ufixed192x40 ufixed192x48 ufixed192x56 ufixed192x64
+syn keyword solBuiltinType ufixed200x8 ufixed200x16 ufixed200x24 ufixed200x32 ufixed200x40 ufixed200x48 ufixed200x56
+syn keyword solBuiltinType ufixed208x8 ufixed208x16 ufixed208x24 ufixed208x32 ufixed208x40 ufixed208x48
+syn keyword solBuiltinType ufixed216x8 ufixed216x16 ufixed216x24 ufixed216x32 ufixed216x40
+syn keyword solBuiltinType ufixed224x8 ufixed224x16 ufixed224x24 ufixed224x32
+syn keyword solBuiltinType ufixed232x8 ufixed232x16 ufixed232x24
+syn keyword solBuiltinType ufixed240x8 ufixed240x16
+syn keyword solBuiltinType ufixed248x8
+syn keyword solBuiltinType string string1 string2 string3 string4 string5 string6 string7 string8 string9 string10 string11 string12 string13 string14 string15 string16 string17 string18 string19 string20 string21 string22 string23 string24 string25 string26 string27 string28 string29 string30 string31 string32
+syn keyword solBuiltinType byte bytes bytes1 bytes2 bytes3 bytes4 bytes5 bytes6 bytes7 bytes8 bytes9 bytes10 bytes11 bytes12 bytes13 bytes14 bytes15 bytes16 bytes17 bytes18 bytes19 bytes20 bytes21 bytes22 bytes23 bytes24 bytes25 bytes26 bytes27 bytes28 bytes29 bytes30 bytes31 bytes32
+
+hi def link solKeyword Keyword
+hi def link solConstant Constant
+hi def link solBuiltinType Type
+hi def link solBuiltinFunction Keyword
+
+syn match solOperator /\(!\||\|&\|+\|-\|<\|>\|=\|%\|\/\|*\|\~\|\^\)/
+syn match solNumber /\<-\=\d\+L\=\>\|\<0[xX]\x\+\>/
+syn match solFloat /\<-\=\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/
+
+syn region solString start=+"+ skip=+\\\\\|\\$"\|\\"+ end=+"+
+syn region solString start=+'+ skip=+\\\\\|\\$'\|\\'+ end=+'+
+
+hi def link solOperator Operator
+hi def link solNumber Number
+hi def link solFloat Float
+hi def link solString String
+
+" Function
+syn match solFunction /\<function\>/ nextgroup=solFuncName,solFuncArgs skipwhite
+syn match solFuncName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*/ nextgroup=solFuncArgs skipwhite
+
+syn region solFuncArgs contained matchgroup=solFuncParens start='(' end=')' contains=solFuncArgCommas,solBuiltinType nextgroup=solModifierName,solFuncReturns,solFuncBody keepend skipwhite skipempty
+syn match solModifierName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*/ nextgroup=solModifierArgs,solModifierName skipwhite
+syn region solModifierArgs contained matchgroup=solFuncParens start='(' end=')' contains=solFuncArgCommas nextgroup=solModifierName,solFuncReturns,solFuncBody skipwhite
+syn region solFuncReturns contained matchgroup=solFuncParens nextgroup=solFuncBody start='(' end=')' contains=solFuncArgCommas,solBuiltinType skipwhite
+
+syn match solFuncArgCommas contained ','
+syn region solFuncBody start="{" end="}" fold transparent
+
+hi def link solFunction Type
+hi def link solFuncName Function
+hi def link solModifierName Function
+
+" Yul blocks
+syn match yul /\<assembly\>/ skipwhite skipempty nextgroup=yulBody
+syn region yulBody contained start='{' end='}' fold contains=yulAssemblyOp,solNumber,yulVarDeclaration,solLineComment,solComment skipwhite skipempty
+syn keyword yulAssemblyOp contained stop add sub mul div sdiv mod smod exp not lt gt slt sgt eq iszero and or xor byte shl shr sar addmod mulmod signextend keccak256 pc pop mload mstore mstore8 sload sstore msize gas address balance selfbalance caller callvalue calldataload calldatasize calldatacopy codesize codecopy extcodesize extcodecopy returndatasize returndatacopy extcodehash create create2 call callcode delegatecall staticcall return revert selfdestruct invalid log0 log1 log2 log3 log4 chainid basefee origin gasprice blockhash coinbase timestamp number difficulty gaslimit
+syn keyword yulVarDeclaration contained let
+
+hi def link yul Keyword
+hi def link yulVarDeclaration Keyword
+hi def link yulAssemblyOp Keyword
+
+" Contract
+syn match solContract /\<\%(contract\|library\|interface\)\>/ nextgroup=solContractName skipwhite
+syn match solContractName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*/ nextgroup=solContractParent skipwhite
+syn region solContractParent contained start='is' end='{' contains=solContractName,solContractNoise,solContractCommas skipwhite skipempty
+syn match solContractNoise contained 'is' containedin=solContractParent
+syn match solContractCommas contained ','
+
+hi def link solContract Type
+hi def link solContractName Function
+
+" Event
+syn match solEvent /\<event\>/ nextgroup=solEventName,solEventArgs skipwhite
+syn match solEventName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*/ nextgroup=solEventArgs skipwhite
+syn region solEventArgs contained matchgroup=solFuncParens start='(' end=')' contains=solEventArgCommas,solBuiltinType,solEventArgSpecial skipwhite skipempty
+syn match solEventArgCommas contained ','
+syn match solEventArgSpecial contained 'indexed'
+
+hi def link solEvent Type
+hi def link solEventName Function
+hi def link solEventArgSpecial Label
+
+" Comment
+syn keyword solCommentTodo TODO FIXME XXX TBD contained
+syn match solNatSpec contained /@title\|@author\|@notice\|@dev\|@param\|@inheritdoc\|@return/
+syn region solLineComment start=+\/\/+ end=+$+ contains=solCommentTodo,solNatSpec,@Spell
+syn region solLineComment start=+^\s*\/\/+ skip=+\n\s*\/\/+ end=+$+ contains=solCommentTodo,solNatSpec,@Spell fold
+syn region solComment start="/\*" end="\*/" contains=solCommentTodo,solNatSpec,@Spell fold
+
+hi def link solCommentTodo Todo
+hi def link solNatSpec Label
+hi def link solLineComment Comment
+hi def link solComment Comment
+
+let b:current_syntax = "solidity"
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index d5e138dbc3..cbd793fd3c 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -368,7 +368,7 @@ syn match vimSetMod contained "&vim\=\|[!&?<]\|all&"
" Let: {{{2
" ===
syn keyword vimLet let unl[et] skipwhite nextgroup=vimVar,vimFuncVar,vimLetHereDoc
-VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s\+\%(trim\|eval\>\)\=\s*\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1\s*$'
+VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s\+\%(trim\s\+\)\=\%(eval\s\+\)\=\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1\s*$'
" Abbreviations: {{{2
" =============
diff --git a/scripts/gen_help_html.lua b/scripts/gen_help_html.lua
index d79ece53f3..3334dbabd2 100644
--- a/scripts/gen_help_html.lua
+++ b/scripts/gen_help_html.lua
@@ -1,5 +1,7 @@
-- Converts Vim :help files to HTML. Validates |tag| links and document syntax (parser errors).
--
+-- NOTE: :helptags checks for duplicate tags, whereas this script checks _links_ (to tags).
+--
-- USAGE (GENERATE HTML):
-- 1. Run `make helptags` first; this script depends on vim.fn.taglist().
-- 2. nvim -V1 -es --clean +"lua require('scripts.gen_help_html').gen('./build/runtime/doc/', 'target/dir/')"
@@ -16,42 +18,23 @@
--
-- NOTES:
-- * gen() and validate() are the primary entrypoints. validate() only exists because gen() is too
--- slow (~1 min) to run in per-commit CI.
+-- slow (~1 min) to run in per-commit CI.
-- * visit_node() is the core function used by gen() to traverse the document tree and produce HTML.
-- * visit_validate() is the core function used by validate().
-- * Files in `new_layout` will be generated with a "flow" layout instead of preformatted/fixed-width layout.
---
--- parser bugs:
--- * Should NOT be code_block:
--- tab:xy The 'x' is always used, then 'y' as many times as will
--- fit. Thus "tab:>-" displays:
--- >
--- >-
--- >--
--- etc.
---
--- tab:xyz The 'z' is always used, then 'x' is prepended, and
--- then 'y' is used as many times as will fit. Thus
--- "tab:<->" displays:
--- >
--- <>
--- <->
--- <-->
--- etc.
--- * Should NOT be a "headline". Perhaps a "table" (or just "line").
--- expr5 and expr6 *expr5* *expr6*
--- ---------------
--- expr6 + expr6 Number addition, |List| or |Blob| concatenation *expr-+*
--- expr6 - expr6 Number subtraction *expr--*
--- expr6 . expr6 String concatenation *expr-.*
--- expr6 .. expr6 String concatenation *expr-..*
local tagmap = nil
local helpfiles = nil
-local invalid_tags = {}
+local invalid_links = {}
+local invalid_urls = {}
+local invalid_spelling = {}
+local spell_dict = {
+ Neovim = 'Nvim',
+ NeoVim = 'Nvim',
+ neovim = 'Nvim',
+ lua = 'Lua',
+}
-local commit = '?'
-local api = vim.api
local M = {}
-- These files are generated with "flow" layout (non fixed-width, wrapped text paragraphs).
@@ -60,16 +43,31 @@ local new_layout = {
['api.txt'] = true,
['channel.txt'] = true,
['develop.txt'] = true,
+ ['luaref.txt'] = true,
['nvim.txt'] = true,
['pi_health.txt'] = true,
['provider.txt'] = true,
['ui.txt'] = true,
}
--- TODO: treesitter gets stuck on these files...
-local exclude = {
- ['filetype.txt'] = true,
- ['usr_24.txt'] = true,
+-- TODO: These known invalid |links| require an update to the relevant docs.
+local exclude_invalid = {
+ ["'previewpopup'"] = "quickref.txt",
+ ["'pvp'"] = "quickref.txt",
+ ["'string'"] = "eval.txt",
+ Query = "treesitter.txt",
+ ["eq?"] = "treesitter.txt",
+ ["lsp-request"] = "lsp.txt",
+ matchit = "vim_diff.txt",
+ ["matchit.txt"] = "help.txt",
+ ["set!"] = "treesitter.txt",
+ ["v:_null_blob"] = "builtin.txt",
+ ["v:_null_dict"] = "builtin.txt",
+ ["v:_null_list"] = "builtin.txt",
+ ["v:_null_string"] = "builtin.txt",
+ ["vim.lsp.buf_request()"] = "lsp.txt",
+ ["vim.lsp.util.get_progress_messages()"] = "lsp.txt",
+ ["vim.treesitter.start()"] = "treesitter.txt"
}
local function tofile(fname, text)
@@ -83,10 +81,6 @@ local function tofile(fname, text)
end
local function html_esc(s)
- if s:find('<a class="parse%-error"') then
- -- HACK: don't escape HTML that we generated (for a parsing error).
- return s
- end
return s:gsub(
'&', '&amp;'):gsub(
'<', '&lt;'):gsub(
@@ -140,31 +134,35 @@ local function trim_bullet(s)
return s:gsub('^%s*[-*•]%s', '')
end
-local function startswith_bullet(s)
- return s:find('^%s*[-*•]%s')
+-- Checks if a given line is a "noise" line that doesn't look good in HTML form.
+local function is_noise(line, noise_lines)
+ if (
+ -- First line is always noise.
+ (noise_lines ~= nil and vim.tbl_count(noise_lines) == 0)
+ or line:find('Type .*gO.* to see the table of contents')
+ -- Title line of traditional :help pages.
+ -- Example: "NVIM REFERENCE MANUAL by ..."
+ or line:find([[^%s*N?VIM[ \t]*REFERENCE[ \t]*MANUAL]])
+ -- First line of traditional :help pages.
+ -- Example: "*api.txt* Nvim"
+ or line:find('%s*%*?[a-zA-Z]+%.txt%*?%s+N?[vV]im%s*$')
+ -- modeline
+ -- Example: "vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl:"
+ or line:find('^%s*vi[m]%:.*ft=help')
+ or line:find('^%s*vi[m]%:.*filetype=help')
+ or line:find('[*>]local%-additions[*<]')
+ ) then
+ -- table.insert(stats.noise_lines, getbuflinestr(root, opt.buf, 0))
+ table.insert(noise_lines or {}, line)
+ return true
+ end
+ return false
end
--- Checks if a given line is a "noise" line that doesn't look good in HTML form.
-local function is_noise(line)
- return (
- line:find('Type .*gO.* to see the table of contents')
- -- Title line of traditional :help pages.
- -- Example: "NVIM REFERENCE MANUAL by ..."
- or line:find('^%s*N?VIM REFERENCE MANUAL')
- -- First line of traditional :help pages.
- -- Example: "*api.txt* Nvim"
- or line:find('%s*%*?[a-zA-Z]+%.txt%*?%s+N?[vV]im%s*$')
- -- modeline
- -- Example: "vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl:"
- or line:find('^%s*vi[m]%:.*ft=help')
- or line:find('^%s*vi[m]%:.*filetype=help')
- )
-end
-
--- Creates a github issue URL at vigoux/tree-sitter-vimdoc with prefilled content.
+-- Creates a github issue URL at neovim/tree-sitter-vimdoc with prefilled content.
local function get_bug_url_vimdoc(fname, to_fname, sample_text)
local this_url = string.format('https://neovim.io/doc/user/%s', vim.fs.basename(to_fname))
- local bug_url = ('https://github.com/vigoux/tree-sitter-vimdoc/issues/new?labels=bug&title=parse+error%3A+'
+ local bug_url = ('https://github.com/neovim/tree-sitter-vimdoc/issues/new?labels=bug&title=parse+error%3A+'
..vim.fs.basename(fname)
..'+&body=Found+%60tree-sitter-vimdoc%60+parse+error+at%3A+'
..this_url
@@ -238,24 +236,46 @@ local function getbuflinestr(node, bufnr, offset)
return table.concat(lines, '\n')
end
--- Gets the whitespace just before `node` from the raw buffer text.
--- Needed for preformatted `old` lines.
-local function getws(node, bufnr)
- local line1, c1, line2, _ = node:range()
- local raw = vim.fn.getbufline(bufnr, line1 + 1, line2 + 1)[1]
- local text_before = raw:sub(1, c1)
- local leading_ws = text_before:match('%s+$') or ''
- return leading_ws
+local function get_tagname(node, bufnr)
+ local text = vim.treesitter.get_node_text(node, bufnr)
+ local tag = (node:type() == 'optionlink' or node:parent():type() == 'optionlink') and ("'%s'"):format(text) or text
+ local helpfile = vim.fs.basename(tagmap[tag]) or nil -- "api.txt"
+ local helppage = get_helppage(helpfile) -- "api.html"
+ return helppage, tag
end
-local function get_tagname(node, bufnr, link)
- local node_name = (node.named and node:named()) and node:type() or nil
- local node_text = vim.treesitter.get_node_text(node, bufnr)
- local tag = ((node_name == 'option' and node_text)
- or (link and node_text:gsub('^|', ''):gsub('|$', '') or node_text:gsub('^%*', ''):gsub('%*$', '')))
- local helpfile = tag and vim.fs.basename(tagmap[tag]) or nil -- "api.txt"
- local helppage = get_helppage(helpfile) -- "api.html"
- return helppage, tag
+-- Returns true if the given invalid tagname is a false positive.
+local function ignore_invalid(s)
+ -- Strings like |~/====| appear in various places and the parser thinks they are links, but they
+ -- are just table borders.
+ return not not (s:find('===') or exclude_invalid[s])
+end
+
+local function ignore_parse_error(s)
+ -- Ignore parse errors for unclosed codespan/optionlink/tag.
+ -- This is common in vimdocs and is treated as plaintext by :help.
+ return s:find("^[`'|*]")
+end
+
+local function has_ancestor(node, ancestor_name)
+ local p = node
+ while true do
+ p = p:parent()
+ if not p or p:type() == 'help_file' then
+ break
+ elseif p:type() == ancestor_name then
+ return true
+ end
+ end
+ return false
+end
+
+local function validate_link(node, bufnr, fname)
+ local helppage, tagname = get_tagname(node:child(1), bufnr)
+ if not has_ancestor(node, 'column_heading') and not node:has_error() and not tagmap[tagname] and not ignore_invalid(tagname) then
+ invalid_links[tagname] = vim.fs.basename(fname)
+ end
+ return helppage, tagname
end
-- Traverses the tree at `root` and checks that |tag| links point to valid helptags.
@@ -263,6 +283,10 @@ local function visit_validate(root, level, lang_tree, opt, stats)
level = level or 0
local node_name = (root.named and root:named()) and root:type() or nil
local toplevel = level < 1
+ local function node_text(node)
+ return vim.treesitter.get_node_text(node or root, opt.buf)
+ end
+ local text = trim(node_text())
if root:child_count() > 0 then
for node, _ in root:iter_children() do
@@ -273,14 +297,26 @@ local function visit_validate(root, level, lang_tree, opt, stats)
end
if node_name == 'ERROR' then
- -- Store the raw text to give context to the bug report.
+ if ignore_parse_error(text) then
+ return
+ end
+ -- Store the raw text to give context to the error report.
local sample_text = not toplevel and getbuflinestr(root, opt.buf, 3) or '[top level!]'
table.insert(stats.parse_errors, sample_text)
- elseif node_name == 'hotlink' or node_name == 'option' then
- local _, tagname = get_tagname(root, opt.buf, true)
- if not root:has_error() and not tagmap[tagname] then
- invalid_tags[tagname] = vim.fs.basename(opt.fname)
+ elseif node_name == 'word' or node_name == 'uppercase_name' then
+ if spell_dict[text] then
+ if not invalid_spelling[text] then
+ invalid_spelling[text] = { vim.fs.basename(opt.fname) }
+ else
+ table.insert(invalid_spelling[text], vim.fs.basename(opt.fname))
+ end
+ end
+ elseif node_name == 'url' then
+ if text:find('http%:') then
+ invalid_urls[text] = vim.fs.basename(opt.fname)
end
+ elseif node_name == 'taglink' or node_name == 'optionlink' then
+ local _, _ = validate_link(root, opt.buf, opt.fname)
end
end
@@ -297,19 +333,22 @@ local function visit_node(root, level, lang_tree, headings, opt, stats)
local parent = root:parent() and root:parent():type() or nil
local text = ''
local toplevel = level < 1
- local function node_text()
- return vim.treesitter.get_node_text(root, opt.buf)
+ local function node_text(node)
+ return vim.treesitter.get_node_text(node or root, opt.buf)
+ end
+ -- Gets leading whitespace of the current node.
+ local function ws()
+ return node_text():match('^%s+') or ''
end
- if root:child_count() == 0 then
+ if root:child_count() == 0 or node_name == 'ERROR' then
text = node_text()
else
-- Process children and join them with whitespace.
for node, _ in root:iter_children() do
if node:named() then
local r = visit_node(node, level + 1, lang_tree, headings, opt, stats)
- local ws = r == '' and '' or ((opt.old and (node:type() == 'word' or not node:named())) and getws(node, opt.buf) or ' ')
- text = string.format('%s%s%s', text, ws, r)
+ text = string.format('%s%s', text, r)
end
end
end
@@ -317,86 +356,116 @@ local function visit_node(root, level, lang_tree, headings, opt, stats)
if node_name == 'help_file' then -- root node
return text
+ elseif node_name == 'url' then
+ return ('%s<a href="%s">%s</a>'):format(ws(), trimmed, trimmed)
elseif node_name == 'word' or node_name == 'uppercase_name' then
- if parent == 'headline' then
- -- Start a new heading item, or update the current one.
- local n = (prev == nil or #headings == 0) and #headings + 1 or #headings
- headings[n] = string.format('%s%s', headings[n] and headings[n]..' ' or '', text)
- end
-
return html_esc(text)
- elseif node_name == 'headline' then
- return ('<a name="%s"></a><h2 class="help-heading">%s</h2>\n'):format(to_heading_tag(headings[#headings]), text)
+ elseif node_name == 'h1' or node_name == 'h2' or node_name == 'h3' then
+ if is_noise(text, stats.noise_lines) then
+ return '' -- Discard common "noise" lines.
+ end
+ -- Remove "===" and tags from ToC text.
+ local hname = (node_text():gsub('%-%-%-%-+', ''):gsub('%=%=%=%=+', ''):gsub('%*.*%*', ''))
+ if node_name == 'h1' or #headings == 0 then
+ table.insert(headings, { name = hname, subheadings = {}, })
+ else
+ table.insert(headings[#headings].subheadings, { name = hname, subheadings = {}, })
+ end
+ local el = node_name == 'h1' and 'h2' or 'h3'
+ return ('<a name="%s"></a><%s class="help-heading">%s</%s>\n'):format(to_heading_tag(hname), el, text, el)
elseif node_name == 'column_heading' or node_name == 'column_name' then
- return ('<h4>%s</h4>\n'):format(trimmed)
- elseif node_name == 'line' then
- -- TODO: remove these "sibling inspection" hacks once the parser provides structured info
- -- about paragraphs and listitems: https://github.com/vigoux/tree-sitter-vimdoc/issues/12
- local next_text = root:next_sibling() and vim.treesitter.get_node_text(root:next_sibling(), opt.buf) or ''
- local li = startswith_bullet(text) -- Listitem?
- local next_li = startswith_bullet(next_text) -- Next is listitem?
- -- Close the paragraph/listitem if the next sibling is not a line.
- local close = (next_ ~= 'line' or next_li or is_blank(next_text)) and '</div>\n' or ''
-
- -- HACK: discard common "noise" lines.
- if is_noise(text) then
- table.insert(stats.noise_lines, getbuflinestr(root, opt.buf, 0))
- return (opt.old or prev ~= 'line') and '' or close
+ if root:has_error() then
+ return text
+ end
+ return ('<div class="help-column_heading">%s</div>'):format(trimmed)
+ elseif node_name == 'block' then
+ if is_blank(text) then
+ return ''
end
-
if opt.old then
- -- XXX: Treat old docs as preformatted. Until those docs are "fixed" or we get better info
- -- from tree-sitter-vimdoc, this avoids broken layout for legacy docs.
- return ('<div class="old-help-line">%s</div>\n'):format(text)
+ -- XXX: Treat old docs as preformatted; random indentation is used for layout there.
+ return ('<div class="old-help-para">%s</div>\n'):format(text)
end
-
- if li then
- return string.format('<div class="help-item">%s%s', trim_bullet(expandtabs(text)), close)
+ return string.format('<div class="help-para">\n%s\n</div>\n', text)
+ elseif node_name == 'line' then
+ local sib = root:prev_sibling()
+ local sib_last = sib and sib:named_child(sib:named_child_count() - 1)
+ local in_li = false
+
+ -- XXX: parser bug: (codeblock) without terminating "<" consumes first char of the next (line). Recover it here.
+ local recovered = (sib_last and sib_last:type() == 'codeblock') and node_text(root:prev_sibling()):sub(-1) or ''
+ recovered = recovered == '<' and '' or html_esc(recovered)
+
+ -- XXX: see if we are currently "in" a listitem.
+ while sib ~= nil and not in_li do
+ in_li = (sib:type() == 'line_li')
+ sib = sib:prev_sibling()
end
- if prev ~= 'line' then -- Start a new paragraph.
- return string.format('<div class="help-para">%s%s', expandtabs(text), close)
+
+ -- Close the current listitem.
+ local close = (in_li and next_ ~= 'line') and '</div>' or ''
+
+ if is_blank(text) or is_noise(text, stats.noise_lines) then
+ return close -- Discard common "noise" lines.
end
- -- Continue in the current paragraph/listitem.
- return string.format('%s%s', expandtabs(text), close)
- elseif node_name == 'hotlink' or node_name == 'option' then
- local helppage, tagname = get_tagname(root, opt.buf, true)
- if not root:has_error() and not tagmap[tagname] then
- invalid_tags[tagname] = vim.fs.basename(opt.fname)
+ local div = (root:child(0) and root:child(0):type() == 'column_heading') or close ~= ''
+ return string.format('%s%s%s%s', recovered, div and trim(text) or text, div and '' or '\n', close)
+ elseif node_name == 'line_li' then
+ -- Close the listitem immediately if the next sibling is not a line.
+ local close = (next_ ~= 'line') and '</div>' or ''
+ return string.format('<div class="help-li">%s %s', trim_bullet(text), close)
+ elseif node_name == 'taglink' or node_name == 'optionlink' then
+ if root:has_error() then
+ return text
+ end
+ local helppage, tagname = validate_link(root, opt.buf, opt.fname)
+ return ('%s<a href="%s#%s">%s</a>'):format(ws(), helppage, url_encode(tagname), html_esc(tagname))
+ elseif node_name == 'codespan' then
+ if root:has_error() then
+ return text
end
- return ('<a href="%s#%s">%s</a>'):format(helppage, url_encode(tagname), html_esc(tagname))
- elseif node_name == 'backtick' then
- return ('<code>%s</code>'):format(html_esc(text))
+ return ('%s<code>%s</code>'):format(ws(), text)
elseif node_name == 'argument' then
- return ('<code>{%s}</code>'):format(html_esc(trimmed))
- elseif node_name == 'code_block' then
- return ('<pre>\n%s</pre>\n'):format(html_esc(trim_indent(trim_gt_lt(text))))
+ return ('%s<code>{%s}</code>'):format(ws(), text)
+ elseif node_name == 'codeblock' then
+ return ('<pre>%s</pre>'):format(html_esc(trim_indent(trim_gt_lt(text))))
elseif node_name == 'tag' then -- anchor
- local _, tagname = get_tagname(root, opt.buf, false)
- local s = ('<a name="%s"></a><span class="help-tag">%s</span>'):format(url_encode(tagname), trimmed)
- if parent == 'headline' and prev ~= 'tag' then
+ if root:has_error() then
+ return text
+ end
+ local in_heading = (parent == 'h1' or parent == 'h2')
+ local cssclass = (not in_heading and get_indent(node_text()) > 8) and 'help-tag-right' or 'help-tag'
+ local tagname = node_text(root:child(1))
+ if vim.tbl_count(stats.first_tags) < 2 then
+ -- First 2 tags in the doc will be anchored at the main heading.
+ table.insert(stats.first_tags, tagname)
+ return ''
+ end
+ local s = ('%s<a name="%s"></a><span class="%s">%s</span>'):format(ws(), url_encode(tagname), cssclass, trimmed)
+ if in_heading and prev ~= 'tag' then
-- Start the <span> container for tags in a heading.
-- This makes "justify-content:space-between" right-align the tags.
-- <h2>foo bar<span>tag1 tag2</span></h2>
return string.format('<span class="help-heading-tags">%s', s)
- elseif parent == 'headline' and next_ == nil then
+ elseif in_heading and next_ == nil then
-- End the <span> container for tags in a heading.
return string.format('%s</span>', s)
end
return s
elseif node_name == 'ERROR' then
+ if ignore_parse_error(trimmed) then
+ return text
+ end
+
-- Store the raw text to give context to the bug report.
local sample_text = not toplevel and getbuflinestr(root, opt.buf, 3) or '[top level!]'
table.insert(stats.parse_errors, sample_text)
- if prev == 'ERROR' then
- -- Avoid trashing the text with cascading errors.
- return trimmed, ('parse-error:"%s"'):format(node_text())
- end
- return ('<a class="parse-error" target="_blank" title="Parsing error. Report to tree-sitter-vimdoc..." href="%s">%s</a>'):format(
+ return ('<a class="parse-error" target="_blank" title="Report bug... (parse error)" href="%s">%s</a>'):format(
get_bug_url_vimdoc(opt.fname, opt.to_fname, sample_text), trimmed)
else -- Unknown token.
local sample_text = not toplevel and getbuflinestr(root, opt.buf, 3) or '[top level!]'
- return ('<a class="unknown-token" target="_blank" title="ERROR: unhandled token: %s. Report to neovim/neovim..." href="%s">%s</a>'):format(
+ return ('<a class="unknown-token" target="_blank" title="Report bug... (unhandled token "%s")" href="%s">%s</a>'):format(
node_name, get_bug_url_nvim(opt.fname, opt.to_fname, sample_text, node_name), trimmed), ('unknown-token:"%s"'):format(node_name)
end
end
@@ -407,8 +476,7 @@ local function get_helpfiles(include)
for f, type in vim.fs.dir(dir) do
if (vim.endswith(f, '.txt')
and type == 'file'
- and (not include or vim.tbl_contains(include, f))
- and (not exclude[f])) then
+ and (not include or vim.tbl_contains(include, f))) then
local fullpath = vim.fn.fnamemodify(('%s/%s'):format(dir, f), ':p')
table.insert(rv, fullpath)
end
@@ -431,6 +499,13 @@ local function get_helptags(help_dir)
return m
end
+-- Use the help.so parser defined in the build, not whatever happens to be installed on the system.
+local function ensure_runtimepath()
+ if not vim.o.runtimepath:find('build/lib/nvim/') then
+ vim.cmd[[set runtimepath^=./build/lib/nvim/]]
+ end
+end
+
-- Opens `fname` in a buffer and gets a treesitter parser for the buffer contents.
--
-- @returns lang_tree, bufnr
@@ -438,7 +513,7 @@ local function parse_buf(fname)
local buf
if type(fname) == 'string' then
vim.cmd('split '..vim.fn.fnameescape(fname)) -- Filename.
- buf = api.nvim_get_current_buf()
+ buf = vim.api.nvim_get_current_buf()
else
buf = fname
vim.cmd('sbuffer '..tostring(fname)) -- Buffer number.
@@ -452,10 +527,9 @@ end
-- - checks that |tag| links point to valid helptags.
-- - recursively counts parse errors ("ERROR" nodes)
--
--- @returns { invalid_tags: number, parse_errors: number }
+-- @returns { invalid_links: number, parse_errors: number }
local function validate_one(fname)
local stats = {
- invalid_tags = {},
parse_errors = {},
}
local lang_tree, buf = parse_buf(fname)
@@ -464,10 +538,7 @@ local function validate_one(fname)
end
lang_tree:destroy()
vim.cmd.close()
- return {
- invalid_tags = invalid_tags,
- parse_errors = stats.parse_errors,
- }
+ return stats
end
-- Generates HTML from one :help file `fname` and writes the result to `to_fname`.
@@ -477,13 +548,14 @@ end
-- @param old boolean Preformat paragraphs (for old :help files which are full of arbitrary whitespace)
--
-- @returns html, stats
-local function gen_one(fname, to_fname, old)
+local function gen_one(fname, to_fname, old, commit)
local stats = {
noise_lines = {},
parse_errors = {},
+ first_tags = {}, -- Track the first few tags in doc.
}
local lang_tree, buf = parse_buf(fname)
- local headings = {} -- Headings (for ToC).
+ local headings = {} -- Headings (for ToC). 2-dimensional: h1 contains h2/h3.
local title = to_titlecase(basename_noext(fname))
local html = ([[
@@ -556,7 +628,12 @@ local function gen_one(fname, to_fname, old)
</svg>
]]
- local main = ([[
+ local main = ''
+ for _, tree in ipairs(lang_tree:trees()) do
+ main = main .. (visit_node(tree:root(), 0, tree, headings, { buf = buf, old = old, fname = fname, to_fname = to_fname }, stats))
+ end
+
+ main = ([[
<header class="container">
<nav class="navbar navbar-expand-lg">
<div>
@@ -571,29 +648,37 @@ local function gen_one(fname, to_fname, old)
<div class="container golden-grid help-body">
<div class="col-wide">
- <h1>%s</h1>
+ <a name="%s"></a><a name="%s"></a><h1>%s</h1>
<p>
<i>
- Nvim help pages, updated <a href="https://github.com/neovim/neovim/blob/master/scripts/gen_help_html.lua">automatically</a>
- from <a href="https://github.com/neovim/neovim/blob/master/runtime/doc/%s">source</a>.
- Parsing by <a href="https://github.com/vigoux/tree-sitter-vimdoc">tree-sitter-vimdoc</a>.
+ Nvim <code>:help</code> pages, <a href="https://github.com/neovim/neovim/blob/master/scripts/gen_help_html.lua">generated</a>
+ from <a href="https://github.com/neovim/neovim/blob/master/runtime/doc/%s">source</a>
+ using the <a href="https://github.com/neovim/tree-sitter-vimdoc">tree-sitter-vimdoc</a> parser.
</i>
</p>
- ]]):format(logo_svg, title, vim.fs.basename(fname))
- for _, tree in ipairs(lang_tree:trees()) do
- main = main .. (visit_node(tree:root(), 0, tree, headings, { buf = buf, old = old, fname = fname, to_fname = to_fname }, stats))
- end
- main = main .. '</div>\n'
+ <hr/>
+ %s
+ </div>
+ ]]):format(logo_svg, stats.first_tags[1] or '', stats.first_tags[2] or '', title, vim.fs.basename(fname), main)
local toc = [[
<div class="col-narrow toc">
<div><a href="index.html">Main</a></div>
- <div><a href="vimindex.html">Help index</a></div>
+ <div><a href="vimindex.html">Commands index</a></div>
<div><a href="quickref.html">Quick reference</a></div>
<hr/>
]]
- for _, heading in ipairs(headings) do
- toc = toc .. ('<div><a href="#%s">%s</a></div>\n'):format(to_heading_tag(heading), heading)
+
+ local n = 0 -- Count of all headings + subheadings.
+ for _, h1 in ipairs(headings) do n = n + 1 + #h1.subheadings end
+ for _, h1 in ipairs(headings) do
+ toc = toc .. ('<div class="help-toc-h1"><a href="#%s">%s</a>\n'):format(to_heading_tag(h1.name), h1.name)
+ if n < 30 or #headings < 10 then -- Show subheadings only if there aren't too many.
+ for _, h2 in ipairs(h1.subheadings) do
+ toc = toc .. ('<div class="help-toc-h2"><a href="#%s">%s</a></div>\n'):format(to_heading_tag(h2.name), h2.name)
+ end
+ end
+ toc = toc .. '</div>'
end
toc = toc .. '</div>\n'
@@ -604,7 +689,7 @@ local function gen_one(fname, to_fname, old)
<footer>
<div class="container flex">
<div class="generator-stats">
- Generated on %s from <code>{%s}</code>
+ Generated at %s from <code><a href="https://github.com/neovim/neovim/commit/%s">%s</a></code>
</div>
<div class="generator-stats">
parse_errors: %d %s | <span title="%s">noise_lines: %d</span>
@@ -612,7 +697,7 @@ local function gen_one(fname, to_fname, old)
<div>
</footer>
]]):format(
- os.date('%Y-%m-%d %H:%M:%S'), commit, #stats.parse_errors, bug_link,
+ os.date('%Y-%m-%d %H:%M'), commit, commit:sub(1, 7), #stats.parse_errors, bug_link,
html_esc(table.concat(stats.noise_lines, '\n')), #stats.noise_lines)
html = ('%s%s%s</div>\n%s</body>\n</html>\n'):format(
@@ -624,12 +709,21 @@ end
local function gen_css(fname)
local css = [[
+ :root {
+ --code-color: #008B8B;
+ --tag-color: gray;
+ }
@media (min-width: 40em) {
.toc {
position: fixed;
left: 67%;
}
}
+ @media (prefers-color-scheme: dark) {
+ :root {
+ --code-color: cyan;
+ }
+ }
.toc {
/* max-width: 12rem; */
}
@@ -641,8 +735,19 @@ local function gen_css(fname)
html {
scroll-behavior: auto;
}
- h1, h2, h3, h4 {
+ body {
+ font-size: 18px;
+ line-height: 1.5;
+ }
+ h1, h2, h3, h4, h5 {
font-family: sans-serif;
+ border-bottom: 1px solid #41464bd6; /*rgba(0, 0, 0, .9);*/
+ }
+ h3, h4, h5 {
+ border-bottom-style: dashed;
+ }
+ .help-column_heading {
+ color: var(--code-color);
}
.help-body {
padding-bottom: 2em;
@@ -650,7 +755,8 @@ local function gen_css(fname)
.help-line {
/* font-family: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace; */
}
- .help-item {
+ .help-li {
+ white-space: normal;
display: list-item;
margin-left: 1.5rem; /* padding-left: 1rem; */
}
@@ -658,11 +764,13 @@ local function gen_css(fname)
padding-top: 10px;
padding-bottom: 10px;
}
- .old-help-line {
+ .old-help-para {
+ padding-top: 10px;
+ padding-bottom: 10px;
/* Tabs are used for alignment in old docs, so we must match Vim's 8-char expectation. */
tab-size: 8;
white-space: pre;
- font-size: .875em;
+ font-size: 16px;
font-family: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace;
}
a.help-tag, a.help-tag:focus, a.help-tag:hover {
@@ -670,7 +778,11 @@ local function gen_css(fname)
text-decoration: none;
}
.help-tag {
- color: gray;
+ color: var(--tag-color);
+ }
+ /* Tag pseudo-header common in :help docs. */
+ .help-tag-right {
+ color: var(--tag-color);
}
h1 .help-tag, h2 .help-tag {
font-size: smaller;
@@ -683,7 +795,12 @@ local function gen_css(fname)
}
/* The (right-aligned) "tags" part of a section heading. */
.help-heading-tags {
- margin-left: 10px;
+ margin-right: 10px;
+ }
+ .help-toc-h1 {
+ }
+ .help-toc-h2 {
+ margin-left: 1em;
}
.parse-error {
background-color: red;
@@ -692,15 +809,19 @@ local function gen_css(fname)
color: black;
background-color: yellow;
}
+ code {
+ color: var(--code-color);
+ font-size: 16px;
+ }
pre {
- /* Tabs are used in code_blocks only for indentation, not alignment, so we can aggressively shrink them. */
+ /* Tabs are used in codeblocks only for indentation, not alignment, so we can aggressively shrink them. */
tab-size: 2;
white-space: pre;
+ line-height: 1.3; /* Important for ascii art. */
overflow: visible;
/* font-family: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace; */
- /* font-size: 14px; */
- /* border: 0px; */
- /* margin: 0px; */
+ font-size: 16px;
+ margin-top: 10px;
}
pre:hover,
.help-heading:hover {
@@ -735,12 +856,11 @@ function M._test()
return ok(expected == actual, expected, actual)
end
- eq(119, #helpfiles)
ok(vim.tbl_count(tagmap) > 3000, '>3000', vim.tbl_count(tagmap))
ok(vim.endswith(tagmap['vim.diagnostic.set()'], 'diagnostic.txt'), tagmap['vim.diagnostic.set()'], 'diagnostic.txt')
ok(vim.endswith(tagmap['%:s'], 'cmdline.txt'), tagmap['%:s'], 'cmdline.txt')
ok(is_noise([[vim:tw=78:isk=!-~,^*,^\|,^\":ts=8:noet:ft=help:norl:]]))
- ok(is_noise([[ VIM REFERENCE MANUAL by Abe Lincoln ]]))
+ ok(is_noise([[ NVIM REFERENCE MANUAL by Thiago de Arruda ]]))
ok(not is_noise([[vim:tw=78]]))
eq(0, get_indent('a'))
@@ -763,14 +883,16 @@ end
--- @param include table|nil Process only these filenames. Example: {'api.txt', 'autocmd.txt', 'channel.txt'}
---
--- @returns info dict
-function M.gen(help_dir, to_dir, include)
+function M.gen(help_dir, to_dir, include, commit)
vim.validate{
help_dir={help_dir, function(d) return vim.fn.isdirectory(d) == 1 end, 'valid directory'},
to_dir={to_dir, 's'},
include={include, 't', true},
+ commit={commit, 's', true},
}
local err_count = 0
+ ensure_runtimepath()
tagmap = get_helptags(help_dir)
helpfiles = get_helpfiles(include)
@@ -781,19 +903,19 @@ function M.gen(help_dir, to_dir, include)
for _, f in ipairs(helpfiles) do
local helpfile = vim.fs.basename(f)
local to_fname = ('%s/%s'):format(to_dir, get_helppage(helpfile))
- local html, stats = gen_one(f, to_fname, not new_layout[helpfile])
+ local html, stats = gen_one(f, to_fname, not new_layout[helpfile], commit or '?')
tofile(to_fname, html)
print(('generated (%-4s errors): %-15s => %s'):format(#stats.parse_errors, helpfile, vim.fs.basename(to_fname)))
err_count = err_count + #stats.parse_errors
end
print(('generated %d html pages'):format(#helpfiles))
print(('total errors: %d'):format(err_count))
- print(('invalid tags:\n%s'):format(vim.inspect(invalid_tags)))
+ print(('invalid tags:\n%s'):format(vim.inspect(invalid_links)))
return {
helpfiles = helpfiles,
err_count = err_count,
- invalid_tags = invalid_tags,
+ invalid_links = invalid_links,
}
end
@@ -810,6 +932,7 @@ function M.validate(help_dir, include)
include={include, 't', true},
}
local err_count = 0
+ ensure_runtimepath()
tagmap = get_helptags(help_dir)
helpfiles = get_helpfiles(include)
@@ -821,9 +944,11 @@ function M.validate(help_dir, include)
end
return {
- helpfiles = helpfiles,
+ helpfiles = #helpfiles,
err_count = err_count,
- invalid_tags = invalid_tags,
+ invalid_links = invalid_links,
+ invalid_urls = invalid_urls,
+ invalid_spelling = invalid_spelling,
}
end
diff --git a/src/clint.py b/src/clint.py
index c4ddbf706e..1a355e0218 100755
--- a/src/clint.py
+++ b/src/clint.py
@@ -202,7 +202,7 @@ _ERROR_CATEGORIES = [
'whitespace/cast',
]
-# The default state of the category filter. This is overrided by the --filter=
+# The default state of the category filter. This is overridden by the --filter=
# flag. By default all errors are on, so only add here categories that should be
# off by default (i.e., categories that must be enabled by the --filter= flags).
# All entries here should start with a '-' or '+', as in the --filter= flag.
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index f28b7a7e28..6f5f2b53f6 100755
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -159,7 +159,7 @@ list(REMOVE_ITEM NVIM_SOURCES ${to_remove})
if(NOT MSVC)
# xdiff, mpack, lua-cjson: inlined external project, we don't maintain it. #9306
set_source_files_properties(
- ${EXTERNAL_SOURCES} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-conversion -Wno-missing-noreturn -Wno-missing-format-attribute -Wno-double-promotion")
+ ${EXTERNAL_SOURCES} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-conversion -Wno-missing-noreturn -Wno-missing-format-attribute -Wno-double-promotion -Wno-strict-prototypes")
endif()
if(NOT "${MIN_LOG_LEVEL}" MATCHES "^$")
diff --git a/src/nvim/api/autocmd.c b/src/nvim/api/autocmd.c
index ac4cb953b8..b5c695b9ce 100644
--- a/src/nvim/api/autocmd.c
+++ b/src/nvim/api/autocmd.c
@@ -599,7 +599,7 @@ void nvim_del_autocmd(Integer id, Error *err)
}
/// Clear all autocommands that match the corresponding {opts}. To delete
-/// a particular autocmd, see |nvim_del_autocmd|.
+/// a particular autocmd, see |nvim_del_autocmd()|.
/// @param opts Parameters
/// - event: (string|table)
/// Examples:
@@ -728,7 +728,7 @@ Integer nvim_create_augroup(uint64_t channel_id, String name, Dict(create_augrou
///
/// To get a group id one can use |nvim_get_autocmds()|.
///
-/// NOTE: behavior differs from |augroup-delete|. When deleting a group, autocommands contained in
+/// NOTE: behavior differs from |:augroup-delete|. When deleting a group, autocommands contained in
/// this group will also be deleted and cleared. This group will no longer exist.
/// @param id Integer The id of the group.
/// @see |nvim_del_augroup_by_name()|
@@ -746,10 +746,10 @@ void nvim_del_augroup_by_id(Integer id, Error *err)
/// Delete an autocommand group by name.
///
-/// NOTE: behavior differs from |augroup-delete|. When deleting a group, autocommands contained in
+/// NOTE: behavior differs from |:augroup-delete|. When deleting a group, autocommands contained in
/// this group will also be deleted and cleared. This group will no longer exist.
/// @param name String The name of the group.
-/// @see |autocommand-groups|
+/// @see |autocmd-groups|
void nvim_del_augroup_by_name(String name, Error *err)
FUNC_API_SINCE(9)
{
diff --git a/src/nvim/api/command.c b/src/nvim/api/command.c
index ed0907e8f8..8cd2c0f8b8 100644
--- a/src/nvim/api/command.c
+++ b/src/nvim/api/command.c
@@ -31,14 +31,15 @@
/// @param[out] err Error details, if any.
/// @return Dictionary containing command information, with these keys:
/// - cmd: (string) Command name.
-/// - range: (array) Command <range>. Can have 0-2 elements depending on how many items the
-/// range contains. Has no elements if command doesn't accept a range or if
-/// no range was specified, one element if only a single range item was
-/// specified and two elements if both range items were specified.
-/// - count: (number) Any |<count>| that was supplied to the command. -1 if command cannot
-/// take a count.
-/// - reg: (number) The optional command |<register>|, if specified. Empty string if not
-/// specified or if command cannot take a register.
+/// - range: (array) (optional) Command range (|<line1>| |<line2>|).
+/// Omitted if command doesn't accept a range.
+/// Otherwise, has no elements if no range was specified, one element if
+/// only a single range item was specified, or two elements if both range
+/// items were specified.
+/// - count: (number) (optional) Command |<count>|.
+/// Omitted if command cannot take a count.
+/// - reg: (string) (optional) Command |<register>|.
+/// Omitted if command cannot take a register.
/// - bang: (boolean) Whether command contains a |<bang>| (!) modifier.
/// - args: (array) Command arguments.
/// - addr: (string) Value of |:command-addr|. Uses short name.
@@ -142,15 +143,15 @@ Dictionary nvim_parse_cmd(String str, Dictionary opts, Error *err)
PUT(result, "cmd", CSTR_TO_OBJ((char *)get_command_name(NULL, ea.cmdidx)));
}
- if ((ea.argt & EX_RANGE) && ea.addr_count > 0) {
+ if (ea.argt & EX_RANGE) {
Array range = ARRAY_DICT_INIT;
- if (ea.addr_count > 1) {
- ADD(range, INTEGER_OBJ(ea.line1));
+ if (ea.addr_count > 0) {
+ if (ea.addr_count > 1) {
+ ADD(range, INTEGER_OBJ(ea.line1));
+ }
+ ADD(range, INTEGER_OBJ(ea.line2));
}
- ADD(range, INTEGER_OBJ(ea.line2));
PUT(result, "range", ARRAY_OBJ(range));
- } else {
- PUT(result, "range", ARRAY_OBJ(ARRAY_DICT_INIT));
}
if (ea.argt & EX_COUNT) {
@@ -161,14 +162,12 @@ Dictionary nvim_parse_cmd(String str, Dictionary opts, Error *err)
} else {
PUT(result, "count", INTEGER_OBJ(0));
}
- } else {
- PUT(result, "count", INTEGER_OBJ(-1));
}
- char reg[2];
- reg[0] = (char)ea.regname;
- reg[1] = '\0';
- PUT(result, "reg", CSTR_TO_OBJ(reg));
+ if (ea.argt & EX_REGSTR) {
+ char reg[2] = { (char)ea.regname, NUL };
+ PUT(result, "reg", CSTR_TO_OBJ(reg));
+ }
PUT(result, "bang", BOOLEAN_OBJ(ea.forceit));
PUT(result, "args", ARRAY_OBJ(args));
@@ -285,7 +284,11 @@ end:
/// Unlike |nvim_command()| this command takes a structured Dictionary instead of a String. This
/// allows for easier construction and manipulation of an Ex command. This also allows for things
/// such as having spaces inside a command argument, expanding filenames in a command that otherwise
-/// doesn't expand filenames, etc.
+/// doesn't expand filenames, etc. Command arguments may also be Number, Boolean or String.
+///
+/// The first argument may also be used instead of count for commands that support it in order to
+/// make their usage simpler with |vim.cmd()|. For example, instead of
+/// `vim.cmd.bdelete{ count = 2 }`, you may do `vim.cmd.bdelete(2)`.
///
/// On execution error: fails with VimL error, updates v:errmsg.
///
@@ -310,8 +313,7 @@ String nvim_cmd(uint64_t channel_id, Dict(cmd) *cmd, Dict(cmd_opts) *opts, Error
char *cmdline = NULL;
char *cmdname = NULL;
- ArrayOf(String) args;
- size_t argc = 0;
+ ArrayOf(String) args = ARRAY_DICT_INIT;
String retv = (String)STRING_INIT;
@@ -383,48 +385,70 @@ String nvim_cmd(uint64_t channel_id, Dict(cmd) *cmd, Dict(cmd_opts) *opts, Error
if (cmd->args.type != kObjectTypeArray) {
VALIDATION_ERROR("'args' must be an Array");
}
- // Check if every argument is valid
+
+ // Process all arguments. Convert non-String arguments to String and check if String arguments
+ // have non-whitespace characters.
for (size_t i = 0; i < cmd->args.data.array.size; i++) {
Object elem = cmd->args.data.array.items[i];
- if (elem.type != kObjectTypeString) {
- VALIDATION_ERROR("Command argument must be a String");
- } else if (string_iswhite(elem.data.string)) {
- VALIDATION_ERROR("Command argument must have non-whitespace characters");
+ char *data_str;
+
+ switch (elem.type) {
+ case kObjectTypeBoolean:
+ data_str = xcalloc(2, sizeof(char));
+ data_str[0] = elem.data.boolean ? '1' : '0';
+ data_str[1] = '\0';
+ break;
+ case kObjectTypeBuffer:
+ case kObjectTypeWindow:
+ case kObjectTypeTabpage:
+ case kObjectTypeInteger:
+ data_str = xcalloc(NUMBUFLEN, sizeof(char));
+ snprintf(data_str, NUMBUFLEN, "%" PRId64, elem.data.integer);
+ break;
+ case kObjectTypeString:
+ if (string_iswhite(elem.data.string)) {
+ VALIDATION_ERROR("String command argument must have at least one non-whitespace "
+ "character");
+ }
+ data_str = xstrndup(elem.data.string.data, elem.data.string.size);
+ break;
+ default:
+ VALIDATION_ERROR("Invalid type for command argument");
+ break;
}
+
+ ADD(args, STRING_OBJ(cstr_as_string(data_str)));
}
- argc = cmd->args.data.array.size;
bool argc_valid;
// Check if correct number of arguments is used.
switch (ea.argt & (EX_EXTRA | EX_NOSPC | EX_NEEDARG)) {
case EX_EXTRA | EX_NOSPC | EX_NEEDARG:
- argc_valid = argc == 1;
+ argc_valid = args.size == 1;
break;
case EX_EXTRA | EX_NOSPC:
- argc_valid = argc <= 1;
+ argc_valid = args.size <= 1;
break;
case EX_EXTRA | EX_NEEDARG:
- argc_valid = argc >= 1;
+ argc_valid = args.size >= 1;
break;
case EX_EXTRA:
argc_valid = true;
break;
default:
- argc_valid = argc == 0;
+ argc_valid = args.size == 0;
break;
}
if (!argc_valid) {
VALIDATION_ERROR("Incorrect number of arguments supplied");
}
-
- args = cmd->args.data.array;
}
// Simply pass the first argument (if it exists) as the arg pointer to `set_cmd_addr_type()`
// since it only ever checks the first argument.
- set_cmd_addr_type(&ea, argc > 0 ? args.items[0].data.string.data : NULL);
+ set_cmd_addr_type(&ea, args.size > 0 ? args.items[0].data.string.data : NULL);
if (HAS_KEY(cmd->range)) {
if (!(ea.argt & EX_RANGE)) {
@@ -628,7 +652,7 @@ String nvim_cmd(uint64_t channel_id, Dict(cmd) *cmd, Dict(cmd_opts) *opts, Error
// Finally, build the command line string that will be stored inside ea.cmdlinep.
// This also sets the values of ea.cmd, ea.arg, ea.args and ea.arglens.
- build_cmdline_str(&cmdline, &ea, &cmdinfo, args, argc);
+ build_cmdline_str(&cmdline, &ea, &cmdinfo, args);
ea.cmdlinep = &cmdline;
garray_T capture_local;
@@ -684,6 +708,7 @@ clear_ga:
ga_clear(&capture_local);
}
end:
+ api_free_array(args);
xfree(cmdline);
xfree(cmdname);
xfree(ea.args);
@@ -713,8 +738,9 @@ static bool string_iswhite(String str)
/// Build cmdline string for command, used by `nvim_cmd()`.
static void build_cmdline_str(char **cmdlinep, exarg_T *eap, CmdParseInfo *cmdinfo,
- ArrayOf(String) args, size_t argc)
+ ArrayOf(String) args)
{
+ size_t argc = args.size;
StringBuilder cmdline = KV_INITIAL_VALUE;
kv_resize(cmdline, 32); // Make it big enough to handle most typical commands
@@ -800,7 +826,7 @@ static void build_cmdline_str(char **cmdlinep, exarg_T *eap, CmdParseInfo *cmdin
}
eap->argc = argc;
- eap->arglens = xcalloc(argc, sizeof(size_t));
+ eap->arglens = eap->argc > 0 ? xcalloc(argc, sizeof(size_t)) : NULL;
size_t argstart_idx = cmdline.size;
for (size_t i = 0; i < argc; i++) {
String s = args.items[i].data.string;
@@ -815,7 +841,7 @@ static void build_cmdline_str(char **cmdlinep, exarg_T *eap, CmdParseInfo *cmdin
// Now that all the arguments are appended, use the command index and argument indices to set the
// values of eap->cmd, eap->arg and eap->args.
eap->cmd = cmdline.items + cmdname_idx;
- eap->args = xcalloc(argc, sizeof(char *));
+ eap->args = eap->argc > 0 ? xcalloc(argc, sizeof(char *)) : NULL;
size_t offset = argstart_idx;
for (size_t i = 0; i < argc; i++) {
offset++; // Account for space
@@ -832,13 +858,12 @@ static void build_cmdline_str(char **cmdlinep, exarg_T *eap, CmdParseInfo *cmdin
// Replace, :make and :grep with 'makeprg' and 'grepprg'.
char *p = replace_makeprg(eap, eap->arg, cmdlinep);
if (p != eap->arg) {
- // If replace_makeprg modified the cmdline string, correct the argument pointers.
+ // If replace_makeprg() modified the cmdline string, correct the eap->arg pointer.
eap->arg = p;
- // We can only know the position of the first argument because the argument list can be used
- // multiple times in makeprg / grepprg.
- if (argc >= 1) {
- eap->args[0] = p;
- }
+ // This cannot be a user command, so eap->args will not be used.
+ XFREE_CLEAR(eap->args);
+ XFREE_CLEAR(eap->arglens);
+ eap->argc = 0;
}
}
diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c
index edcea52838..3b1b470629 100644
--- a/src/nvim/api/extmark.c
+++ b/src/nvim/api/extmark.c
@@ -389,11 +389,11 @@ Array nvim_buf_get_extmarks(Buffer buffer, Integer ns_id, Object start, Object e
/// - virt_text : virtual text to link to this mark.
/// A list of [text, highlight] tuples, each representing a
/// text chunk with specified highlight. `highlight` element
-/// can either be a a single highlight group, or an array of
+/// can either be a single highlight group, or an array of
/// multiple highlight groups that will be stacked
/// (highest priority last). A highlight group can be supplied
/// either as a string or as an integer, the latter which
-/// can be obtained using |nvim_get_hl_id_by_name|.
+/// can be obtained using |nvim_get_hl_id_by_name()|.
/// - virt_text_pos : position of virtual text. Possible values:
/// - "eol": right after eol character (default)
/// - "overlay": display over the specified column, without
@@ -430,7 +430,7 @@ Array nvim_buf_get_extmarks(Buffer buffer, Integer ns_id, Object start, Object e
/// column of the window, bypassing
/// sign and number columns.
///
-/// - ephemeral : for use with |nvim_set_decoration_provider|
+/// - ephemeral : for use with |nvim_set_decoration_provider()|
/// callbacks. The mark will only be used for the current
/// redraw cycle, and not be permantently stored in the
/// buffer.
@@ -958,7 +958,7 @@ void nvim_buf_clear_namespace(Buffer buffer, Integer ns_id, Integer line_start,
/// being triggered during the redraw code.
///
/// The expected usage is to set extmarks for the currently
-/// redrawn buffer. |nvim_buf_set_extmark| can be called to add marks
+/// redrawn buffer. |nvim_buf_set_extmark()| can be called to add marks
/// on a per-window or per-lines basis. Use the `ephemeral` key to only
/// use the mark for the current screen redraw (the callback will be called
/// again for the next redraw ).
diff --git a/src/nvim/api/options.c b/src/nvim/api/options.c
index 867584dd71..ec1f19cf6a 100644
--- a/src/nvim/api/options.c
+++ b/src/nvim/api/options.c
@@ -147,7 +147,7 @@ Object nvim_get_option_value(String name, Dict(option) *opts, Error *err)
/// @param name Option name
/// @param value New option value
/// @param opts Optional parameters
-/// - scope: One of 'global' or 'local'. Analogous to
+/// - scope: One of "global" or "local". Analogous to
/// |:setglobal| and |:setlocal|, respectively.
/// - win: |window-ID|. Used for setting window local option.
/// - buf: Buffer number. Used for setting buffer local option.
@@ -202,7 +202,7 @@ void nvim_set_option_value(String name, Object value, Dict(option) *opts, Error
/// Gets the option information for all options.
///
/// The dictionary has the full option names as keys and option metadata
-/// dictionaries as detailed at |nvim_get_option_info|.
+/// dictionaries as detailed at |nvim_get_option_info()|.
///
/// @return dictionary of all options
Dictionary nvim_get_all_options_info(Error *err)
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c
index b888d09343..73b5489d5c 100644
--- a/src/nvim/api/private/helpers.c
+++ b/src/nvim/api/private/helpers.c
@@ -218,6 +218,8 @@ Object dict_set_var(dict_T *dict, String key, Object value, bool del, bool retva
return rv;
}
+ bool watched = tv_dict_is_watched(dict);
+
if (del) {
// Delete the key
if (di == NULL) {
@@ -225,6 +227,10 @@ Object dict_set_var(dict_T *dict, String key, Object value, bool del, bool retva
api_set_error(err, kErrorTypeValidation, "Key not found: %s",
key.data);
} else {
+ // Notify watchers
+ if (watched) {
+ tv_dict_watcher_notify(dict, key.data, NULL, &di->di_tv);
+ }
// Return the old value
if (retval) {
rv = vim_to_object(&di->di_tv);
@@ -241,11 +247,16 @@ Object dict_set_var(dict_T *dict, String key, Object value, bool del, bool retva
return rv;
}
+ typval_T oldtv = TV_INITIAL_VALUE;
+
if (di == NULL) {
// Need to create an entry
di = tv_dict_item_alloc_len(key.data, key.size);
tv_dict_add(dict, di);
} else {
+ if (watched) {
+ tv_copy(&di->di_tv, &oldtv);
+ }
// Return the old value
if (retval) {
rv = vim_to_object(&di->di_tv);
@@ -255,6 +266,13 @@ Object dict_set_var(dict_T *dict, String key, Object value, bool del, bool retva
// Update the value
tv_copy(&tv, &di->di_tv);
+
+ // Notify watchers
+ if (watched) {
+ tv_dict_watcher_notify(dict, key.data, &tv, &oldtv);
+ tv_clear(&oldtv);
+ }
+
// Clear the temporary variable
tv_clear(&tv);
}
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c
index 45c20d07e1..e6d8cb2fdb 100644
--- a/src/nvim/api/ui.c
+++ b/src/nvim/api/ui.c
@@ -453,7 +453,7 @@ void nvim_ui_try_resize_grid(uint64_t channel_id, Integer grid, Integer width, I
}
}
-/// Tells Nvim the number of elements displaying in the popumenu, to decide
+/// Tells Nvim the number of elements displaying in the popupmenu, to decide
/// <PageUp> and <PageDown> movement.
///
/// @param channel_id
@@ -483,7 +483,7 @@ void nvim_ui_pum_set_height(uint64_t channel_id, Integer height, Error *err)
ui->pum_nlines = (int)height;
}
-/// Tells Nvim the geometry of the popumenu, to align floating windows with an
+/// Tells Nvim the geometry of the popupmenu, to align floating windows with an
/// external popup menu.
///
/// Note that this method is not to be confused with |nvim_ui_pum_set_height()|,
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index ad9ed72f43..d65127e406 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -160,8 +160,8 @@ Dictionary nvim__get_hl_defs(Integer ns_id, Arena *arena, Error *err)
/// - nocombine: boolean
/// - link: name of another highlight group to link to, see |:hi-link|.
/// - default: Don't override existing definition |:hi-default|
-/// - ctermfg: Sets foreground of cterm color |highlight-ctermfg|
-/// - ctermbg: Sets background of cterm color |highlight-ctermbg|
+/// - ctermfg: Sets foreground of cterm color |ctermfg|
+/// - ctermbg: Sets background of cterm color |ctermbg|
/// - cterm: cterm attribute map, like |highlight-args|. If not set,
/// cterm attributes will match those from the attribute map
/// documented above.
@@ -185,7 +185,7 @@ void nvim_set_hl(Integer ns_id, String name, Dict(highlight) *val, Error *err)
}
/// Set active namespace for highlights. This can be set for a single window,
-/// see |nvim_win_set_hl_ns|.
+/// see |nvim_win_set_hl_ns()|.
///
/// @param ns_id the namespace to use
/// @param[out] err Error details, if any
@@ -205,7 +205,7 @@ void nvim_set_hl_ns(Integer ns_id, Error *err)
/// Set active namespace for highlights while redrawing.
///
/// This function meant to be called while redrawing, primarily from
-/// |nvim_set_decoration_provider| on_win and on_line callbacks, which
+/// |nvim_set_decoration_provider()| on_win and on_line callbacks, which
/// are allowed to change the namespace during a redraw cycle.
///
/// @param ns_id the namespace to activate
@@ -523,7 +523,7 @@ Array nvim__runtime_inspect(void)
/// Find files in runtime directories
///
-/// 'name' can contain wildcards. For example
+/// "name" can contain wildcards. For example
/// nvim_get_runtime_file("colors/*.vim", true) will return all color
/// scheme files. Always use forward slashes (/) in the search pattern for
/// subdirectories regardless of platform.
@@ -964,7 +964,7 @@ fail:
/// mode. Note: keypresses are sent raw as they would be to the pty
/// master end. For instance, a carriage return is sent
/// as a "\r", not as a "\n". |textlock| applies. It is possible
-/// to call |nvim_chan_send| directly in the callback however.
+/// to call |nvim_chan_send()| directly in the callback however.
/// ["input", term, bufnr, data]
/// @param[out] err Error details, if any
/// @return Channel id, or 0 on error
@@ -1452,7 +1452,7 @@ ArrayOf(Dictionary) nvim_get_keymap(String mode)
/// @param rhs Right-hand-side |{rhs}| of the mapping.
/// @param opts Optional parameters map: keys are |:map-arguments|, values are booleans (default
/// false). Accepts all |:map-arguments| as keys excluding |<buffer>| but including
-/// |noremap| and "desc". Unknown key is an error.
+/// |:noremap| and "desc". Unknown key is an error.
/// "desc" can be used to give a description to the mapping.
/// When called from Lua, also accepts a "callback" key that takes a Lua function to
/// call when the mapping is executed.
diff --git a/src/nvim/api/win_config.c b/src/nvim/api/win_config.c
index 96c560efa1..636b9566ce 100644
--- a/src/nvim/api/win_config.c
+++ b/src/nvim/api/win_config.c
@@ -109,7 +109,7 @@
/// is changed to `auto` and 'colorcolumn' is cleared. The
/// end-of-buffer region is hidden by setting `eob` flag of
/// 'fillchars' to a space char, and clearing the
-/// |EndOfBuffer| region in 'winhighlight'.
+/// |hl-EndOfBuffer| region in 'winhighlight'.
/// - border: Style of (optional) window border. This can either be a string
/// or an array. The string values are
/// - "none": No border (default).
diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c
index 5203003369..aaff00d640 100644
--- a/src/nvim/api/window.c
+++ b/src/nvim/api/window.c
@@ -340,7 +340,7 @@ Boolean nvim_win_is_valid(Window window)
///
/// Like |:hide| the buffer becomes hidden unless another window is editing it,
/// or 'bufhidden' is `unload`, `delete` or `wipe` as opposed to |:close| or
-/// |nvim_win_close|, which will close the buffer.
+/// |nvim_win_close()|, which will close the buffer.
///
/// @param window Window handle, or 0 for current window
/// @param[out] err Error details, if any
@@ -430,7 +430,7 @@ Object nvim_win_call(Window window, LuaRef fun, Error *err)
/// Set highlight namespace for a window. This will use highlights defined in
/// this namespace, but fall back to global highlights (ns=0) when missing.
///
-/// This takes predecence over the 'winhighlight' option.
+/// This takes precedence over the 'winhighlight' option.
///
/// @param ns_id the namespace to use
/// @param[out] err Error details, if any
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h
index c18a8209cf..a8834b85aa 100644
--- a/src/nvim/buffer_defs.h
+++ b/src/nvim/buffer_defs.h
@@ -618,7 +618,7 @@ struct file_buffer {
bool b_u_synced; // entry lists are synced
long b_u_seq_last; // last used undo sequence number
long b_u_save_nr_last; // counter for last file write
- long b_u_seq_cur; // hu_seq of header below which we are now
+ long b_u_seq_cur; // uh_seq of header below which we are now
time_t b_u_time_cur; // uh_time of header below which we are now
long b_u_save_nr_cur; // file write nr after which we are now
diff --git a/src/nvim/change.c b/src/nvim/change.c
index ab550259c8..c9e57ab88f 100644
--- a/src/nvim/change.c
+++ b/src/nvim/change.c
@@ -999,7 +999,7 @@ int copy_indent(int size, char *src)
/// "second_line_indent": indent for after ^^D in Insert mode or if flag
/// OPENLINE_COM_LIST
/// "did_do_comment" is set to true when intentionally putting the comment
-/// leader in fromt of the new line.
+/// leader in front of the new line.
///
/// @param dir FORWARD or BACKWARD
///
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index 0cc2189948..f5db03b0b4 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -650,7 +650,7 @@ static inline unsigned nr2hex(unsigned n)
///
/// @param b
///
-/// @reeturn Number of display cells.
+/// @return Number of display cells.
int byte2cells(int b)
FUNC_ATTR_PURE
{
diff --git a/src/nvim/debugger.c b/src/nvim/debugger.c
index 8adeb19082..3e0cf82740 100644
--- a/src/nvim/debugger.c
+++ b/src/nvim/debugger.c
@@ -128,7 +128,7 @@ void do_debug(char *cmd)
ignore_script = true;
}
- // don't debug any function call, e.g. from an expresion mapping
+ // don't debug any function call, e.g. from an expression mapping
n = debug_break_level;
debug_break_level = -1;
diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c
index c95f3f3550..fdf70a081c 100644
--- a/src/nvim/drawscreen.c
+++ b/src/nvim/drawscreen.c
@@ -1965,7 +1965,8 @@ win_update_start:
if (mid_end >= row) {
lastline = MIN(lastline, mid_start);
}
- if (mod_bot > buf->b_ml.ml_line_count + 1) {
+ // if (mod_bot > buf->b_ml.ml_line_count + 1) {
+ if (mod_bot > buf->b_ml.ml_line_count) {
lastline = 0;
}
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index c2a7b6bba5..6eaf3d1f5e 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -3659,7 +3659,6 @@ static int eval_index(char **arg, typval_T *rettv, int evaluate, int verbose)
int get_option_tv(const char **const arg, typval_T *const rettv, const bool evaluate)
FUNC_ATTR_NONNULL_ARG(1)
{
- bool working = (**arg == '+'); // has("+option")
int opt_flags;
// Isolate the option name and find its value.
@@ -3704,10 +3703,6 @@ int get_option_tv(const char **const arg, typval_T *const rettv, const bool eval
rettv->v_type = VAR_STRING;
rettv->vval.v_string = stringval;
}
- } else if (working && (opt_type == gov_hidden_bool
- || opt_type == gov_hidden_number
- || opt_type == gov_hidden_string)) {
- ret = FAIL;
}
*option_end = c; // put back for error messages
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index 9ba2ce2365..f2ef8e5cdd 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -1938,9 +1938,14 @@ static void f_exists(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
xfree(exp);
}
} else if (*p == '&' || *p == '+') { // Option.
- n = (get_option_tv(&p, NULL, true) == OK);
- if (*skipwhite(p) != NUL) {
- n = false; // Trailing garbage.
+ bool working = (*p == '+'); // whether option needs to be working
+ int opt_flags;
+
+ if (find_option_end(&p, &opt_flags) != NULL) {
+ int opt_idx = findoption(p);
+ n = (opt_idx >= 0 && (!working || get_varp_scope(get_option(opt_idx), opt_flags) != NULL));
+ } else {
+ n = false;
}
} else if (*p == '*') { // Internal or user defined function.
n = function_exists(p + 1, false);
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index f9aed7a966..961c963170 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -1249,14 +1249,12 @@ static void do_sort_uniq(typval_T *argvars, typval_T *rettv, bool sort)
item_compare_func_ptr = item_compare_keeping_zero;
}
- int idx = 0;
for (listitem_T *li = TV_LIST_ITEM_NEXT(l, tv_list_first(l))
; li != NULL;) {
listitem_T *const prev_li = TV_LIST_ITEM_PREV(l, li);
if (item_compare_func_ptr(&prev_li, &li) == 0) {
li = tv_list_item_remove(l, li);
} else {
- idx++;
li = TV_LIST_ITEM_NEXT(l, li);
}
if (info.item_compare_func_err) { // -V547
@@ -1781,7 +1779,7 @@ void tv_dict_watcher_notify(dict_T *const dict, const char *const key, typval_T
tv_dict_add(argv[2].vval.v_dict, v);
}
- if (oldtv) {
+ if (oldtv && oldtv->v_type != VAR_UNKNOWN) {
dictitem_T *const v = tv_dict_item_alloc_len(S_LEN("old"));
tv_copy(oldtv, &v->di_tv);
tv_dict_add(argv[2].vval.v_dict, v);
diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c
index 1c07fc4d45..4d7214205d 100644
--- a/src/nvim/eval/vars.c
+++ b/src/nvim/eval/vars.c
@@ -1348,12 +1348,8 @@ void set_var_const(const char *name, const size_t name_len, typval_T *const tv,
}
if (watched) {
- if (oldtv.v_type == VAR_UNKNOWN) {
- tv_dict_watcher_notify(dict, (char *)v->di_key, &v->di_tv, NULL);
- } else {
- tv_dict_watcher_notify(dict, (char *)v->di_key, &v->di_tv, &oldtv);
- tv_clear(&oldtv);
- }
+ tv_dict_watcher_notify(dict, (char *)v->di_key, &v->di_tv, &oldtv);
+ tv_clear(&oldtv);
}
if (is_const) {
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 085948f7b1..987fb439d7 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -1339,6 +1339,20 @@ static int parse_count(exarg_T *eap, char **errormsg, bool validate)
|| ascii_iswhite(*p))) {
long n = getdigits_long(&eap->arg, false, -1);
eap->arg = skipwhite(eap->arg);
+
+ if (eap->args != NULL) {
+ assert(eap->argc > 0 && eap->arg >= eap->args[0]);
+ // If eap->arg is still pointing to the first argument, just make eap->args[0] point to the
+ // same location. This is needed for usecases like vim.cmd.sleep('10m'). If eap->arg is
+ // pointing outside the first argument, shift arguments by 1.
+ if (eap->arg < eap->args[0] + eap->arglens[0]) {
+ eap->arglens[0] -= (size_t)(eap->arg - eap->args[0]);
+ eap->args[0] = eap->arg;
+ } else {
+ shift_cmd_args(eap);
+ }
+ }
+
if (n <= 0 && (eap->argt & EX_ZEROR) == 0) {
if (errormsg != NULL) {
*errormsg = _(e_zerocount);
@@ -1512,6 +1526,30 @@ end:
return retval;
}
+// Shift Ex-command arguments to the right.
+static void shift_cmd_args(exarg_T *eap)
+{
+ assert(eap->args != NULL && eap->argc > 0);
+
+ char **oldargs = eap->args;
+ size_t *oldarglens = eap->arglens;
+
+ eap->argc--;
+ eap->args = eap->argc > 0 ? xcalloc(eap->argc, sizeof(char *)) : NULL;
+ eap->arglens = eap->argc > 0 ? xcalloc(eap->argc, sizeof(size_t)) : NULL;
+
+ for (size_t i = 0; i < eap->argc; i++) {
+ eap->args[i] = oldargs[i + 1];
+ eap->arglens[i] = oldarglens[i + 1];
+ }
+
+ // If there are no arguments, make eap->arg point to the end of string.
+ eap->arg = (eap->argc > 0 ? eap->args[0] : (oldargs[0] + oldarglens[0]));
+
+ xfree(oldargs);
+ xfree(oldarglens);
+}
+
static int execute_cmd0(int *retv, exarg_T *eap, char **errormsg, bool preview)
{
// If filename expansion is enabled, expand filenames
@@ -1551,15 +1589,7 @@ static int execute_cmd0(int *retv, exarg_T *eap, char **errormsg, bool preview)
eap->args[0] + eap->arglens[0],
(eap->argt & EX_BUFUNL) != 0, false, false);
eap->addr_count = 1;
- // Shift each argument by 1
- for (size_t i = 0; i < eap->argc - 1; i++) {
- eap->args[i] = eap->args[i + 1];
- }
- // Make the last argument point to the NUL terminator at the end of string
- eap->args[eap->argc - 1] = eap->args[eap->argc - 1] + eap->arglens[eap->argc - 1];
- eap->argc -= 1;
-
- eap->arg = eap->args[0];
+ shift_cmd_args(eap);
}
if (eap->line2 < 0) { // failed
return FAIL;
@@ -1658,6 +1688,11 @@ int execute_cmd(exarg_T *eap, CmdParseInfo *cmdinfo, bool preview)
(void)hasFolding(eap->line2, NULL, &eap->line2);
}
+ // Use first argument as count when possible
+ if (parse_count(eap, &errormsg, true) == FAIL) {
+ goto end;
+ }
+
// Execute the command
execute_cmd0(&retv, eap, &errormsg, preview);
@@ -3887,7 +3922,7 @@ static char *repl_cmdline(exarg_T *eap, char *src, size_t srclen, char *repl, ch
} else {
// Otherwise, argument gets shifted alongside the replaced text.
// The amount of the shift is equal to the difference of the old and new string length.
- eap->args[j] = new_cmdline + (eap->args[j] - *cmdlinep) + (len - srclen);
+ eap->args[j] = new_cmdline + ((eap->args[j] - *cmdlinep) + (ptrdiff_t)(len - srclen));
}
}
@@ -5867,7 +5902,7 @@ static void ex_undo(exarg_T *eap)
{
if (eap->addr_count != 1) {
if (eap->forceit) {
- u_undo_and_forget(1); // :undo!
+ u_undo_and_forget(1, true); // :undo!
} else {
u_undo(1); // :undo
}
@@ -5894,7 +5929,7 @@ static void ex_undo(exarg_T *eap)
emsg(_(e_undobang_cannot_redo_or_move_branch));
return;
}
- u_undo_and_forget(count);
+ u_undo_and_forget(count, true);
} else { // :undo 123
undo_time(step, false, false, true);
}
@@ -6088,7 +6123,7 @@ static void ex_redrawstatus(exarg_T *eap)
} else {
status_redraw_curbuf();
}
- if (msg_scrolled && (State & MODE_CMDLINE)) {
+ if (msg_scrolled && !msg_use_msgsep() && (State & MODE_CMDLINE)) {
return; // redraw later
}
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 2d39ced582..4b54b58ac1 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -136,6 +136,7 @@ typedef struct cmdpreview_win_info {
typedef struct cmdpreview_buf_info {
buf_T *buf;
+ bool save_b_u_synced;
time_t save_b_u_time_cur;
long save_b_u_seq_cur;
u_header_T *save_b_u_newhead;
@@ -773,11 +774,11 @@ static uint8_t *command_line_enter(int firstc, long count, int indent, bool init
// Redraw the statusline in case it uses the current mode using the mode()
// function.
- if (!cmd_silent && msg_scrolled == 0) {
+ if (!cmd_silent && (msg_scrolled == 0 || msg_use_msgsep())) {
bool found_one = false;
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
- if (*p_stl != NUL || *wp->w_p_stl != NUL) {
+ if (*p_stl != NUL || *wp->w_p_stl != NUL || *p_wbr != NUL || *wp->w_p_wbr != NUL) {
wp->w_redr_status = true;
found_one = true;
}
@@ -2131,6 +2132,7 @@ static void cmdpreview_prepare(CpInfo *cpinfo)
CpBufInfo cp_bufinfo;
cp_bufinfo.buf = buf;
+ cp_bufinfo.save_b_u_synced = buf->b_u_synced;
cp_bufinfo.save_b_u_time_cur = buf->b_u_time_cur;
cp_bufinfo.save_b_u_seq_cur = buf->b_u_seq_cur;
cp_bufinfo.save_b_u_newhead = buf->b_u_newhead;
@@ -2168,6 +2170,8 @@ static void cmdpreview_prepare(CpInfo *cpinfo)
cmdmod.cmod_split = 0; // Disable :leftabove/botright modifiers
cmdmod.cmod_tab = 0; // Disable :tab modifier
cmdmod.cmod_flags |= CMOD_NOSWAPFILE; // Disable swap for preview buffer
+
+ u_sync(true);
}
// Restore the state of buffers and windows before command preview.
@@ -2190,7 +2194,7 @@ static void cmdpreview_restore_state(CpInfo *cpinfo)
aco_save_T aco;
aucmd_prepbuf(&aco, buf);
// Undo invisibly. This also moves the cursor!
- if (!u_undo_and_forget(count)) {
+ if (!u_undo_and_forget(count, false)) {
abort();
}
aucmd_restbuf(&aco);
@@ -2200,6 +2204,11 @@ static void cmdpreview_restore_state(CpInfo *cpinfo)
buf->b_u_newhead = cp_bufinfo.save_b_u_newhead;
buf->b_u_time_cur = cp_bufinfo.save_b_u_time_cur;
}
+
+ if (buf->b_u_curhead == NULL) {
+ buf->b_u_synced = cp_bufinfo.save_b_u_synced;
+ }
+
if (cp_bufinfo.save_changedtick != buf_get_changedtick(buf)) {
buf_set_changedtick(buf, cp_bufinfo.save_changedtick);
}
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index fd0acce25f..ef66e2d355 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -2104,7 +2104,7 @@ static int handle_mapping(int *keylenp, bool *timedout, int *mapdepth)
} else {
keylen = 0;
}
- if (keylen == 0) { // no simplication has been done
+ if (keylen == 0) { // no simplification has been done
// If there was no mapping at all use the character from the
// typeahead buffer right here.
if (mp == NULL) {
diff --git a/src/nvim/hashtab.c b/src/nvim/hashtab.c
index 3d0ab192b9..32d67621db 100644
--- a/src/nvim/hashtab.c
+++ b/src/nvim/hashtab.c
@@ -265,7 +265,7 @@ void hash_unlock(hashtab_T *ht)
hash_may_resize(ht, 0);
}
-/// Resize hastable (new size can be given or automatically computed).
+/// Resize hashtable (new size can be given or automatically computed).
///
/// @param minitems Minimum number of items the new table should hold.
/// If zero, new size will depend on currently used items:
diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c
index fed39c6ed7..3508560e20 100644
--- a/src/nvim/highlight_group.c
+++ b/src/nvim/highlight_group.c
@@ -2034,7 +2034,7 @@ void highlight_changed(void)
}
}
- // sentinel value. used when no hightlight namespace is active
+ // sentinel value. used when no highlight namespace is active
highlight_attr[HLF_COUNT] = 0;
//
diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c
index a23fa22da2..bc31d702f4 100644
--- a/src/nvim/if_cscope.c
+++ b/src/nvim/if_cscope.c
@@ -649,7 +649,7 @@ static char *cs_create_cmd(char *csoption, char *pattern)
return NULL;
}
- // Skip white space before the patter, except for text and pattern search,
+ // Skip white space before the pattern, except for text and pattern search,
// they may want to use the leading white space.
pat = pattern;
if (search != 4 && search != 6) {
diff --git a/src/nvim/input.c b/src/nvim/input.c
index 0aa9feaca3..681d9d5f9c 100644
--- a/src/nvim/input.c
+++ b/src/nvim/input.c
@@ -83,7 +83,6 @@ int get_keystroke(MultiQueue *events)
int len = 0;
int n;
int save_mapped_ctrl_c = mapped_ctrl_c;
- int waited = 0;
mapped_ctrl_c = 0; // mappings are not used here
for (;;) {
@@ -110,10 +109,8 @@ int get_keystroke(MultiQueue *events)
// Replace zero and K_SPECIAL by a special key code.
n = fix_input_buffer(buf + len, n);
len += n;
- waited = 0;
- } else if (len > 0) {
- waited++; // keep track of the waiting time
}
+
if (n > 0) { // found a termcode: adjust length
len = n;
}
diff --git a/src/nvim/keycodes.c b/src/nvim/keycodes.c
index 9ec37fd564..61dc2ac035 100644
--- a/src/nvim/keycodes.c
+++ b/src/nvim/keycodes.c
@@ -861,10 +861,9 @@ int get_mouse_button(int code, bool *is_click, bool *is_drag)
/// @param[in] from What characters to replace.
/// @param[in] from_len Length of the "from" argument.
/// @param[out] bufp Location where results were saved in case of success (allocated).
-/// if *bufp is non-NULL, it will be used directly. it is
-/// assumed to be 128 bytes long (enough for transcoding LHS
-/// of mapping)
-/// Will be set to NULL in case of failure.
+/// If `*bufp` is non-NULL, it will be used directly,
+/// and is assumed to be 128 bytes long (enough for transcoding LHS of mapping),
+/// and will be set to NULL in case of failure.
/// @param[in] flags REPTERM_FROM_PART see above
/// REPTERM_DO_LT also translate <lt>
/// REPTERM_NO_SPECIAL do not accept <key> notation
@@ -872,7 +871,7 @@ int get_mouse_button(int code, bool *is_click, bool *is_drag)
/// @param[out] did_simplify set when some <C-H> code was simplied, unless it is NULL.
/// @param[in] cpo_flags Relevant flags derived from p_cpo, see CPO_TO_CPO_FLAGS.
///
-/// @return Pointer to an allocated memory, which is also saved to "bufp".
+/// @return The same as what `*bufp` is set to.
char *replace_termcodes(const char *const from, const size_t from_len, char **const bufp,
const int flags, bool *const did_simplify, const int cpo_flags)
FUNC_ATTR_NONNULL_ARG(1, 3)
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index 6063414a02..f3821f149a 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -2036,7 +2036,8 @@ int nlua_do_ucmd(ucmd_T *cmd, exarg_T *eap, bool preview)
}
lua_setfield(lstate, -2, "fargs");
- lua_pushstring(lstate, (const char *)&eap->regname);
+ char reg[2] = { (char)eap->regname, NUL };
+ lua_pushstring(lstate, reg);
lua_setfield(lstate, -2, "reg");
lua_pushinteger(lstate, eap->addr_count);
diff --git a/src/nvim/lua/stdlib.c b/src/nvim/lua/stdlib.c
index 9b1890403e..498f956ed9 100644
--- a/src/nvim/lua/stdlib.c
+++ b/src/nvim/lua/stdlib.c
@@ -369,12 +369,19 @@ int nlua_setvar(lua_State *lstate)
return 0;
}
+ bool watched = tv_dict_is_watched(dict);
+
if (del) {
// Delete the key
if (di == NULL) {
// Doesn't exist, nothing to do
return 0;
} else {
+ // Notify watchers
+ if (watched) {
+ tv_dict_watcher_notify(dict, key.data, NULL, &di->di_tv);
+ }
+
// Delete the entry
tv_dict_item_remove(dict, di);
}
@@ -388,17 +395,29 @@ int nlua_setvar(lua_State *lstate)
return luaL_error(lstate, "Couldn't convert lua value");
}
+ typval_T oldtv = TV_INITIAL_VALUE;
+
if (di == NULL) {
// Need to create an entry
di = tv_dict_item_alloc_len(key.data, key.size);
tv_dict_add(dict, di);
} else {
+ if (watched) {
+ tv_copy(&di->di_tv, &oldtv);
+ }
// Clear the old value
tv_clear(&di->di_tv);
}
// Update the value
tv_copy(&tv, &di->di_tv);
+
+ // Notify watchers
+ if (watched) {
+ tv_dict_watcher_notify(dict, key.data, &tv, &oldtv);
+ tv_clear(&oldtv);
+ }
+
// Clear the temporary variable
tv_clear(&tv);
}
diff --git a/src/nvim/lua/treesitter.c b/src/nvim/lua/treesitter.c
index 64cace9ab4..79b11eca4a 100644
--- a/src/nvim/lua/treesitter.c
+++ b/src/nvim/lua/treesitter.c
@@ -1369,7 +1369,7 @@ static int query_inspect(lua_State *L)
lua_rawseti(L, -2, nextitem++); // [retval, patterns, pat, pred]
}
// last predicate should have ended with TypeDone
- lua_pop(L, 1); // [retval, patters, pat]
+ lua_pop(L, 1); // [retval, patterns, pat]
lua_rawseti(L, -2, (int)i + 1); // [retval, patterns]
}
lua_setfield(L, -2, "patterns"); // [retval]
diff --git a/src/nvim/mapping.c b/src/nvim/mapping.c
index 6267e1c875..001bbf7e48 100644
--- a/src/nvim/mapping.c
+++ b/src/nvim/mapping.c
@@ -890,7 +890,7 @@ theend:
///
/// @param maptype MAPTYPE_MAP for |:map|
/// MAPTYPE_UNMAP for |:unmap|
-/// MAPTYPE_NOREMAP for |noremap|.
+/// MAPTYPE_NOREMAP for |:noremap|.
/// @param arg C-string containing the arguments of the map/abbrev
/// command, i.e. everything except the initial `:[X][nore]map`.
/// - Cannot be a read-only string; it will be modified.
diff --git a/src/nvim/mapping.h b/src/nvim/mapping.h
index 182d1a48cb..156187b5d8 100644
--- a/src/nvim/mapping.h
+++ b/src/nvim/mapping.h
@@ -9,7 +9,7 @@
/// All possible |:map-arguments| usable in a |:map| command.
///
/// The <special> argument has no effect on mappings and is excluded from this
-/// struct declaration. |noremap| is included, since it behaves like a map
+/// struct declaration. |:noremap| is included, since it behaves like a map
/// argument when used in a mapping.
///
/// @see mapblock_T
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 0b9cbfe474..fd20d9dd81 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -1399,12 +1399,15 @@ void msg_start(void)
msg_clr_eos();
}
+ // if cmdheight=0, we need to scroll in the first line of msg_grid upon the screen
+ if (p_ch == 0 && !ui_has(kUIMessages) && !msg_scrolled) {
+ msg_grid_validate();
+ msg_scroll_up(false, true);
+ msg_scrolled++;
+ cmdline_row = Rows - 1;
+ }
+
if (!msg_scroll && full_screen) { // overwrite last message
- if (cmdline_row >= Rows && !ui_has(kUIMessages)) {
- msg_scroll_up(false, true);
- msg_scrolled++;
- cmdline_row = Rows - 1;
- }
msg_row = cmdline_row;
msg_col = cmdmsg_rl ? Columns - 1 : 0;
} else if (msg_didout || (p_ch == 0 && !ui_has(kUIMessages))) { // start message on next line
@@ -2312,7 +2315,7 @@ static void msg_puts_display(const char *str, int maxlen, int attr, int recurse)
if (t_col > 0) {
t_puts(&t_col, t_s, s, attr);
}
- if (p_more && !recurse) {
+ if (p_more && !recurse && !(s == sb_str + 1 && *sb_str == '\n')) {
store_sb_text((char **)&sb_str, (char *)s, attr, &sb_col, false);
}
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 5b67f0e471..e7d0b171f6 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -106,30 +106,6 @@ static char e_number_required_after_equal[]
static char e_preview_window_already_exists[]
= N_("E590: A preview window already exists");
-// The options that are local to a window or buffer have "indir" set to one of
-// these values. Special values:
-// PV_NONE: global option.
-// PV_WIN is added: window-local option
-// PV_BUF is added: buffer-local option
-// PV_BOTH is added: global option which also has a local value.
-#define PV_BOTH 0x1000
-#define PV_WIN 0x2000
-#define PV_BUF 0x4000
-#define PV_MASK 0x0fff
-#define OPT_WIN(x) (idopt_T)(PV_WIN + (int)(x))
-#define OPT_BUF(x) (idopt_T)(PV_BUF + (int)(x))
-#define OPT_BOTH(x) (idopt_T)(PV_BOTH + (int)(x))
-
-// WV_ and BV_ values get typecasted to this for the "indir" field
-typedef enum {
- PV_NONE = 0,
- PV_MAXVAL = 0xffff, // to avoid warnings for value out of range
-} idopt_T;
-
-// Options local to a window have a value local to a buffer and global to all
-// buffers. Indicate this by setting "var" to VAR_WIN.
-#define VAR_WIN ((char_u *)-1)
-
static char *p_term = NULL;
static char *p_ttytype = NULL;
@@ -147,19 +123,6 @@ static long p_tw_nopaste;
static long p_wm_nopaste;
static char *p_vsts_nopaste;
-typedef struct vimoption {
- char *fullname; // full option name
- char *shortname; // permissible abbreviation
- uint32_t flags; // see below
- char_u *var; // global option: pointer to variable;
- // window-local option: VAR_WIN;
- // buffer-local option: global value
- idopt_T indir; // global option: PV_NONE;
- // local option: indirect option index
- char *def_val; // default values for variable (neovim!!)
- LastSet last_set; // script in which the option was last set
-} vimoption_T;
-
// options[] is initialized here.
// The order of the options MUST be alphabetic for ":set all" and findoption().
// All option names MUST start with a lowercase letter (for findoption()).
@@ -3047,47 +3010,10 @@ int get_option_value_strict(char *name, int64_t *numval, char **stringval, int o
return rv;
}
-/// Return the flags for the option at 'opt_idx'.
-uint32_t get_option_flags(int opt_idx)
-{
- return options[opt_idx].flags;
-}
-
-/// Set a flag for the option at 'opt_idx'.
-void set_option_flag(int opt_idx, uint32_t flag)
-{
- options[opt_idx].flags |= flag;
-}
-
-/// Clear a flag for the option at 'opt_idx'.
-void clear_option_flag(int opt_idx, uint32_t flag)
-{
- options[opt_idx].flags &= ~flag;
-}
-
-/// Returns true if the option at 'opt_idx' is a global option
-bool is_global_option(int opt_idx)
-{
- return options[opt_idx].indir == PV_NONE;
-}
-
-/// Returns true if the option at 'opt_idx' is a global option which also has a
-/// local value.
-int is_global_local_option(int opt_idx)
+// Return information for option at 'opt_idx'
+vimoption_T *get_option(int opt_idx)
{
- return options[opt_idx].indir & PV_BOTH;
-}
-
-/// Returns true if the option at 'opt_idx' is a window-local option
-bool is_window_local_option(int opt_idx)
-{
- return options[opt_idx].var == VAR_WIN;
-}
-
-/// Returns true if the option at 'opt_idx' is a hidden option
-bool is_hidden_option(int opt_idx)
-{
- return options[opt_idx].var == NULL;
+ return &options[opt_idx];
}
/// Set the value of an option
@@ -3761,7 +3687,7 @@ void unset_global_local_option(char *name, void *from)
}
/// Get pointer to option variable, depending on local or global scope.
-static char *get_varp_scope(vimoption_T *p, int opt_flags)
+char *get_varp_scope(vimoption_T *p, int opt_flags)
{
if ((opt_flags & OPT_GLOBAL) && p->indir != PV_NONE) {
if (p->var == VAR_WIN) {
@@ -3833,13 +3759,6 @@ static char *get_varp_scope(vimoption_T *p, int opt_flags)
return (char *)get_varp(p);
}
-/// Get pointer to option variable at 'opt_idx', depending on local or global
-/// scope.
-char *get_option_varp_scope(int opt_idx, int opt_flags)
-{
- return get_varp_scope(&(options[opt_idx]), opt_flags);
-}
-
/// Get pointer to option variable.
static char_u *get_varp(vimoption_T *p)
{
@@ -4149,18 +4068,6 @@ static char_u *get_varp(vimoption_T *p)
return (char_u *)&(curbuf->b_p_wm);
}
-/// Return a pointer to the variable for option at 'opt_idx'
-char_u *get_option_var(int opt_idx)
-{
- return options[opt_idx].var;
-}
-
-/// Return the full name of the option at 'opt_idx'
-char *get_option_fullname(int opt_idx)
-{
- return options[opt_idx].fullname;
-}
-
/// Get the value of 'equalprg', either the buffer-local one or the global one.
char_u *get_equalprg(void)
{
diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h
index e8cf338cf1..e27607d7a8 100644
--- a/src/nvim/option_defs.h
+++ b/src/nvim/option_defs.h
@@ -990,4 +990,41 @@ typedef struct {
uint64_t channel_id; /// Only used when script_id is SID_API_CLIENT.
} LastSet;
+// WV_ and BV_ values get typecasted to this for the "indir" field
+typedef enum {
+ PV_NONE = 0,
+ PV_MAXVAL = 0xffff, // to avoid warnings for value out of range
+} idopt_T;
+
+typedef struct vimoption {
+ char *fullname; // full option name
+ char *shortname; // permissible abbreviation
+ uint32_t flags; // see below
+ char_u *var; // global option: pointer to variable;
+ // window-local option: VAR_WIN;
+ // buffer-local option: global value
+ idopt_T indir; // global option: PV_NONE;
+ // local option: indirect option index
+ char *def_val; // default values for variable (neovim!!)
+ LastSet last_set; // script in which the option was last set
+} vimoption_T;
+
+// The options that are local to a window or buffer have "indir" set to one of
+// these values. Special values:
+// PV_NONE: global option.
+// PV_WIN is added: window-local option
+// PV_BUF is added: buffer-local option
+// PV_BOTH is added: global option which also has a local value.
+#define PV_BOTH 0x1000
+#define PV_WIN 0x2000
+#define PV_BUF 0x4000
+#define PV_MASK 0x0fff
+#define OPT_WIN(x) (idopt_T)(PV_WIN + (int)(x))
+#define OPT_BUF(x) (idopt_T)(PV_BUF + (int)(x))
+#define OPT_BOTH(x) (idopt_T)(PV_BOTH + (int)(x))
+
+// Options local to a window have a value local to a buffer and global to all
+// buffers. Indicate this by setting "var" to VAR_WIN.
+#define VAR_WIN ((char_u *)-1)
+
#endif // NVIM_OPTION_DEFS_H
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c
index 7278b1a12d..aff88a755b 100644
--- a/src/nvim/optionstr.c
+++ b/src/nvim/optionstr.c
@@ -178,7 +178,7 @@ void trigger_optionsset_string(int opt_idx, int opt_flags, char *oldval, char *o
set_vim_var_string(VV_OPTION_COMMAND, "modeline", -1);
set_vim_var_string(VV_OPTION_OLDLOCAL, oldval, -1);
}
- apply_autocmds(EVENT_OPTIONSET, get_option_fullname(opt_idx), NULL, false, NULL);
+ apply_autocmds(EVENT_OPTIONSET, get_option(opt_idx)->fullname, NULL, false, NULL);
reset_v_option_vars();
}
}
@@ -280,19 +280,19 @@ void check_string_option(char **pp)
/// Set global value for string option when it's a local option.
///
-/// @param opt_idx option index
+/// @param opt option
/// @param varp pointer to option variable
-static void set_string_option_global(int opt_idx, char **varp)
+static void set_string_option_global(vimoption_T *opt, char **varp)
{
char **p;
// the global value is always allocated
- if (is_window_local_option(opt_idx)) {
+ if (opt->var == VAR_WIN) {
p = (char **)GLOBAL_WO(varp);
} else {
- p = (char **)get_option_var(opt_idx);
+ p = (char **)opt->var;
}
- if (!is_global_option(opt_idx) && p != varp) {
+ if (opt->indir != PV_NONE && p != varp) {
char *s = xstrdup(*varp);
free_string_option(*p);
*p = s;
@@ -324,30 +324,32 @@ void set_string_option_direct(const char *name, int opt_idx, const char *val, in
}
}
- if (is_hidden_option(idx)) { // can't set hidden option
+ vimoption_T *opt = get_option(idx);
+
+ if (opt->var == NULL) { // can't set hidden option
return;
}
- assert((void *)get_option_var(idx) != (void *)&p_shada);
+ assert((void *)opt->var != (void *)&p_shada);
s = xstrdup(val);
{
- varp = (char **)get_option_varp_scope(idx, both ? OPT_LOCAL : opt_flags);
- if ((opt_flags & OPT_FREE) && (get_option_flags(idx) & P_ALLOCED)) {
+ varp = (char **)get_varp_scope(opt, both ? OPT_LOCAL : opt_flags);
+ if ((opt_flags & OPT_FREE) && (opt->flags & P_ALLOCED)) {
free_string_option(*varp);
}
*varp = s;
// For buffer/window local option may also set the global value.
if (both) {
- set_string_option_global(idx, varp);
+ set_string_option_global(opt, varp);
}
- set_option_flag(idx, P_ALLOCED);
+ opt->flags |= P_ALLOCED;
// When setting both values of a global option with a local value,
// make the local value empty, so that the global value is used.
- if (is_global_local_option(idx) && both) {
+ if ((opt->indir & PV_BOTH) && both) {
free_string_option(*varp);
*varp = empty_option;
}
@@ -393,24 +395,24 @@ void set_string_option_direct_in_win(win_T *wp, const char *name, int opt_idx, c
char *set_string_option(const int opt_idx, const char *const value, const int opt_flags)
FUNC_ATTR_NONNULL_ARG(2) FUNC_ATTR_WARN_UNUSED_RESULT
{
- if (is_hidden_option(opt_idx)) { // don't set hidden option
+ vimoption_T *opt = get_option(opt_idx);
+
+ if (opt->var == NULL) { // don't set hidden option
return NULL;
}
char *const s = xstrdup(value);
char **const varp
- = (char **)get_option_varp_scope(opt_idx,
- (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
- ? (is_global_local_option(opt_idx)
- ? OPT_GLOBAL : OPT_LOCAL)
- : opt_flags);
+ = (char **)get_varp_scope(opt, ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
+ ? ((opt->indir & PV_BOTH) ? OPT_GLOBAL : OPT_LOCAL)
+ : opt_flags));
char *const oldval = *varp;
char *oldval_l = NULL;
char *oldval_g = NULL;
if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0) {
- oldval_l = *(char **)get_option_varp_scope(opt_idx, OPT_LOCAL);
- oldval_g = *(char **)get_option_varp_scope(opt_idx, OPT_GLOBAL);
+ oldval_l = *(char **)get_varp_scope(opt, OPT_LOCAL);
+ oldval_g = *(char **)get_varp_scope(opt, OPT_GLOBAL);
}
*varp = s;
@@ -434,8 +436,8 @@ char *set_string_option(const int opt_idx, const char *const value, const int op
trigger_optionsset_string(opt_idx, opt_flags, saved_oldval, saved_oldval_l, saved_oldval_g,
saved_newval);
}
- if (get_option_flags(opt_idx) & P_UI_OPTION) {
- ui_call_option_set(cstr_as_string(get_option_fullname(opt_idx)),
+ if (opt->flags & P_UI_OPTION) {
+ ui_call_option_set(cstr_as_string(opt->fullname),
STRING_OBJ(cstr_as_string(saved_newval)));
}
}
@@ -638,20 +640,21 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
char *errmsg = NULL;
char *s, *p;
int did_chartab = false;
- bool free_oldval = (get_option_flags(opt_idx) & P_ALLOCED);
+ vimoption_T *opt = get_option(opt_idx);
+ bool free_oldval = (opt->flags & P_ALLOCED);
bool value_changed = false;
// Get the global option to compare with, otherwise we would have to check
// two values for all local options.
- char **gvarp = (char **)get_option_varp_scope(opt_idx, OPT_GLOBAL);
+ char **gvarp = (char **)get_varp_scope(opt, OPT_GLOBAL);
// Disallow changing some options from secure mode
if ((secure || sandbox != 0)
- && (get_option_flags(opt_idx) & P_SECURE)) {
+ && (opt->flags & P_SECURE)) {
errmsg = e_secure;
- } else if (((get_option_flags(opt_idx) & P_NFNAME)
+ } else if (((opt->flags & P_NFNAME)
&& strpbrk(*varp, (secure ? "/\\*?[|;&<>\r\n" : "/\\*?[<>\r\n")) != NULL)
- || ((get_option_flags(opt_idx) & P_NDNAME)
+ || ((opt->flags & P_NDNAME)
&& strpbrk(*varp, "*?[|;&<>\r\n") != NULL)) {
// Check for a "normal" directory or file name in some options. Disallow a
// path separator (slash and/or backslash), wildcards and characters that
@@ -986,13 +989,14 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
} else if (varp == &p_shada) { // 'shada'
// TODO(ZyX-I): Remove this code in the future, alongside with &viminfo
// option.
- opt_idx = ((get_option_fullname(opt_idx)[0] == 'v')
+ opt_idx = ((opt->fullname[0] == 'v')
? (shada_idx == -1 ? ((shada_idx = findoption("shada"))) : shada_idx)
: opt_idx);
+ opt = get_option(opt_idx);
// Update free_oldval now that we have the opt_idx for 'shada', otherwise
// there would be a disconnect between the check for P_ALLOCED at the start
// of the function and the set of P_ALLOCED at the end of the function.
- free_oldval = (get_option_flags(opt_idx) & P_ALLOCED);
+ free_oldval = (opt->flags & P_ALLOCED);
for (s = p_shada; *s;) {
// Check it's a valid character
if (vim_strchr("!\"%'/:<@cfhnrs", *s) == NULL) {
@@ -1522,18 +1526,18 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
if (free_oldval) {
free_string_option(oldval);
}
- set_option_flag(opt_idx, P_ALLOCED);
+ opt->flags |= P_ALLOCED;
if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
- && is_global_local_option(opt_idx)) {
+ && (opt->indir & PV_BOTH)) {
// global option with local value set to use global value; free
// the local value and make it empty
- p = get_option_varp_scope(opt_idx, OPT_LOCAL);
+ p = get_varp_scope(opt, OPT_LOCAL);
free_string_option(*(char **)p);
*(char **)p = empty_option;
} else if (!(opt_flags & OPT_LOCAL) && opt_flags != OPT_GLOBAL) {
// May set global value for local option.
- set_string_option_global(opt_idx, varp);
+ set_string_option_global(opt, varp);
}
// Trigger the autocommand only after setting the flags.
@@ -1604,11 +1608,11 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
}
if (curwin->w_curswant != MAXCOL
- && (get_option_flags(opt_idx) & (P_CURSWANT | P_RALL)) != 0) {
+ && (opt->flags & (P_CURSWANT | P_RALL)) != 0) {
curwin->w_set_curswant = true;
}
- check_redraw(get_option_flags(opt_idx));
+ check_redraw(opt->flags);
return errmsg;
}
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c
index 9766c8f3d9..750d2f342f 100644
--- a/src/nvim/os/shell.c
+++ b/src/nvim/os/shell.c
@@ -805,7 +805,7 @@ done:
/// char *output = NULL;
/// size_t nread = 0;
/// char *argv[] = {"ls", "-la", NULL};
-/// int exitcode = os_sytem(argv, NULL, 0, &output, &nread);
+/// int exitcode = os_system(argv, NULL, 0, &output, &nread);
///
/// @param argv The commandline arguments to be passed to the shell. `argv`
/// will be consumed.
diff --git a/src/nvim/path.c b/src/nvim/path.c
index d1a7e14c9f..9295905415 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -575,7 +575,7 @@ bool path_has_exp_wildcard(const char_u *p)
/// @param path The path to search.
/// @param flags Flags for regexp expansion.
/// - EW_ICASE: Ignore case.
-/// - EW_NOERROR: Silence error messeges.
+/// - EW_NOERROR: Silence error messages.
/// - EW_NOTWILD: Add matches literally.
/// @returns the number of matches found.
static size_t path_expand(garray_T *gap, const char_u *path, int flags)
diff --git a/src/nvim/sign.c b/src/nvim/sign.c
index 6f13dd2f06..9c517098b9 100644
--- a/src/nvim/sign.c
+++ b/src/nvim/sign.c
@@ -724,7 +724,27 @@ static void sign_list_placed(buf_T *rbuf, char *sign_group)
}
}
-/// Adjust a placed sign for inserted/deleted lines.
+/// Adjust or delete a placed sign for inserted/deleted lines.
+///
+/// @return the new line number of the sign, or 0 if the sign is in deleted lines.
+static linenr_T sign_adjust_one(const linenr_T se_lnum, linenr_T line1, linenr_T line2,
+ linenr_T amount, linenr_T amount_after)
+{
+ if (se_lnum < line1) {
+ // Ignore changes to lines after the sign
+ return se_lnum;
+ }
+ if (se_lnum > line2) {
+ // Lines inserted or deleted before the sign
+ return se_lnum + amount_after;
+ }
+ if (amount == MAXLNUM) { // sign in deleted lines
+ return 0;
+ }
+ return se_lnum + amount;
+}
+
+/// Adjust placed signs for inserted/deleted lines.
void sign_mark_adjust(linenr_T line1, linenr_T line2, linenr_T amount, linenr_T amount_after)
{
sign_entry_T *sign; // a sign in a b_signlist
@@ -735,9 +755,7 @@ void sign_mark_adjust(linenr_T line1, linenr_T line2, linenr_T amount, linenr_T
int is_fixed = 0;
int signcol = win_signcol_configured(curwin, &is_fixed);
- bool delete = amount == MAXLNUM;
-
- if (delete) {
+ if (amount == MAXLNUM) { // deleting
buf_signcols_del_check(curbuf, line1, line2);
}
@@ -745,11 +763,10 @@ void sign_mark_adjust(linenr_T line1, linenr_T line2, linenr_T amount, linenr_T
for (sign = curbuf->b_signlist; sign != NULL; sign = next) {
next = sign->se_next;
- new_lnum = sign->se_lnum;
- if (sign->se_lnum >= line1 && sign->se_lnum <= line2) {
- if (!delete) {
- new_lnum += amount;
- } else if (!is_fixed || signcol >= 2) {
+
+ new_lnum = sign_adjust_one(sign->se_lnum, line1, line2, amount, amount_after);
+ if (new_lnum == 0) { // sign in deleted lines
+ if (!is_fixed || signcol >= 2) {
*lastp = next;
if (next) {
next->se_prev = last;
@@ -757,19 +774,23 @@ void sign_mark_adjust(linenr_T line1, linenr_T line2, linenr_T amount, linenr_T
xfree(sign);
continue;
}
- } else if (sign->se_lnum > line2) {
- new_lnum += amount_after;
- }
- // If the new sign line number is past the last line in the buffer,
- // then don't adjust the line number. Otherwise, it will always be past
- // the last line and will not be visible.
- if (sign->se_lnum >= line1 && new_lnum <= curbuf->b_ml.ml_line_count) {
- sign->se_lnum = new_lnum;
+ } else {
+ // If the new sign line number is past the last line in the buffer,
+ // then don't adjust the line number. Otherwise, it will always be past
+ // the last line and will not be visible.
+ if (new_lnum <= curbuf->b_ml.ml_line_count) {
+ sign->se_lnum = new_lnum;
+ }
}
last = sign;
lastp = &sign->se_next;
}
+
+ new_lnum = sign_adjust_one(curbuf->b_signcols.sentinel, line1, line2, amount, amount_after);
+ if (new_lnum != 0) {
+ curbuf->b_signcols.sentinel = new_lnum;
+ }
}
/// Find index of a ":sign" subcmd from its name.
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 53fa920358..7d2b58ff46 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -1344,14 +1344,14 @@ size_t spell_move_to(win_T *wp, int dir, bool allwords, bool curline, hlf_T *att
: p - buf) > wp->w_cursor.col)) {
col = (colnr_T)(p - buf);
- bool can_spell = (wp->w_s->b_p_spo_flags & SPO_NPBUFFER) == 0;
+ bool can_spell = decor_spell_nav_col(wp, lnum, &decor_lnum, col, &decor_error);
if (!can_spell) {
- can_spell = decor_spell_nav_col(wp, lnum, &decor_lnum, col, &decor_error);
- }
-
- if (!can_spell && has_syntax) {
- (void)syn_get_id(wp, lnum, col, false, &can_spell, false);
+ if (has_syntax) {
+ (void)syn_get_id(wp, lnum, col, false, &can_spell, false);
+ } else {
+ can_spell = (wp->w_s->b_p_spo_flags & SPO_NPBUFFER) == 0;
+ }
}
if (!can_spell) {
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index 326c868be8..c52586fea2 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -759,6 +759,22 @@ static int get_rgb(VTermState *state, VTermColor color)
return RGB_(color.rgb.red, color.rgb.green, color.rgb.blue);
}
+static int get_underline_hl_flag(VTermScreenCellAttrs attrs)
+{
+ switch (attrs.underline) {
+ case VTERM_UNDERLINE_OFF:
+ return 0;
+ case VTERM_UNDERLINE_SINGLE:
+ return HL_UNDERLINE;
+ case VTERM_UNDERLINE_DOUBLE:
+ return HL_UNDERDOUBLE;
+ case VTERM_UNDERLINE_CURLY:
+ return HL_UNDERCURL;
+ default:
+ return HL_UNDERLINE;
+ }
+}
+
void terminal_get_line_attributes(Terminal *term, win_T *wp, int linenr, int *term_attrs)
{
int height, width;
@@ -795,7 +811,7 @@ void terminal_get_line_attributes(Terminal *term, win_T *wp, int linenr, int *te
int hl_attrs = (cell.attrs.bold ? HL_BOLD : 0)
| (cell.attrs.italic ? HL_ITALIC : 0)
| (cell.attrs.reverse ? HL_INVERSE : 0)
- | (cell.attrs.underline ? HL_UNDERLINE : 0)
+ | get_underline_hl_flag(cell.attrs)
| (cell.attrs.strike ? HL_STRIKETHROUGH: 0)
| ((fg_indexed && !fg_set) ? HL_FG_INDEXED : 0)
| ((bg_indexed && !bg_set) ? HL_BG_INDEXED : 0);
@@ -892,7 +908,6 @@ static int term_settermprop(VTermProp prop, VTermValue *val, void *data)
case VTERM_PROP_TITLE: {
buf_T *buf = handle_get_buffer(term->buf_handle);
-#if VTERM_VERSION_MAJOR > 0 || (VTERM_VERSION_MAJOR == 0 && VTERM_VERSION_MINOR >= 2)
VTermStringFragment frag = val->string;
if (frag.initial && frag.final) {
@@ -917,9 +932,6 @@ static int term_settermprop(VTermProp prop, VTermValue *val, void *data)
xfree(term->title);
term->title = NULL;
}
-#else
- buf_set_term_title(buf, val->string, strlen(val->string));
-#endif
break;
}
diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim
index 4755d39cd3..05aee9b31d 100644
--- a/src/nvim/testdir/test_filetype.vim
+++ b/src/nvim/testdir/test_filetype.vim
@@ -240,6 +240,7 @@ let s:filename_checks = {
\ 'grub': ['/boot/grub/menu.lst', '/boot/grub/grub.conf', '/etc/grub.conf', 'any/boot/grub/grub.conf', 'any/boot/grub/menu.lst', 'any/etc/grub.conf'],
\ 'gsp': ['file.gsp'],
\ 'gtkrc': ['.gtkrc', 'gtkrc', '.gtkrc-file', 'gtkrc-file'],
+ \ 'gyp': ['file.gyp', 'file.gypi'],
\ 'hack': ['file.hack', 'file.hackpartial'],
\ 'haml': ['file.haml'],
\ 'hamster': ['file.hsm'],
@@ -327,7 +328,7 @@ let s:filename_checks = {
\ 'lpc': ['file.lpc', 'file.ulpc'],
\ 'lsl': ['file.lsl'],
\ 'lss': ['file.lss'],
- \ 'lua': ['file.lua', 'file.rockspec', 'file.nse'],
+ \ 'lua': ['file.lua', 'file.rockspec', 'file.nse', '.luacheckrc'],
\ 'lynx': ['lynx.cfg'],
\ 'lyrics': ['file.lrc'],
\ 'm3build': ['m3makefile', 'm3overrides'],
@@ -412,7 +413,7 @@ let s:filename_checks = {
\ 'pccts': ['file.g'],
\ 'pcmk': ['file.pcmk'],
\ 'pdf': ['file.pdf'],
- \ 'perl': ['file.plx', 'file.al', 'file.psgi', 'gitolite.rc', '.gitolite.rc', 'example.gitolite.rc'],
+ \ 'perl': ['file.plx', 'file.al', 'file.psgi', 'gitolite.rc', '.gitolite.rc', 'example.gitolite.rc', '.latexmkrc', 'latexmkrc'],
\ 'pf': ['pf.conf'],
\ 'pfmain': ['main.cf'],
\ 'php': ['file.php', 'file.php9', 'file.phtml', 'file.ctp', 'file.phpt', 'file.theme'],
@@ -582,6 +583,7 @@ let s:filename_checks = {
\ 'tssop': ['file.tssop'],
\ 'tsv': ['file.tsv'],
\ 'twig': ['file.twig'],
+ \ 'typescript': ['file.mts', 'file.cts'],
\ 'typescript.glimmer': ['file.gts'],
\ 'typescriptreact': ['file.tsx'],
\ 'uc': ['file.uc'],
diff --git a/src/nvim/testdir/test_messages.vim b/src/nvim/testdir/test_messages.vim
index 2672fcb69d..42a1fdcfe2 100644
--- a/src/nvim/testdir/test_messages.vim
+++ b/src/nvim/testdir/test_messages.vim
@@ -316,6 +316,66 @@ func Test_message_more()
call StopVimInTerminal(buf)
endfunc
+" Test more-prompt scrollback
+func Test_message_more_scrollback()
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ set t_ut=
+ hi Normal ctermfg=15 ctermbg=0
+ for i in range(100)
+ echo i
+ endfor
+ END
+ call writefile(lines, 'XmoreScrollback', 'D')
+ let buf = RunVimInTerminal('-S XmoreScrollback', {'rows': 10})
+ call VerifyScreenDump(buf, 'Test_more_scrollback_1', {})
+
+ call term_sendkeys(buf, 'f')
+ call TermWait(buf)
+ call term_sendkeys(buf, 'b')
+ call VerifyScreenDump(buf, 'Test_more_scrollback_2', {})
+
+ call term_sendkeys(buf, 'q')
+ call TermWait(buf)
+ call StopVimInTerminal(buf)
+endfunc
+
+" Test verbose message before echo command
+func Test_echo_verbose_system()
+ CheckRunVimInTerminal
+ CheckUnix
+
+ let buf = RunVimInTerminal('', {'rows': 10})
+ call term_sendkeys(buf, ":4 verbose echo system('seq 20')\<CR>")
+ " Note that the screendump is filtered to remove the name of the temp file
+ call VerifyScreenDump(buf, 'Test_verbose_system_1', {})
+
+ " display a page and go back, results in exactly the same view
+ call term_sendkeys(buf, ' ')
+ call TermWait(buf)
+ call term_sendkeys(buf, 'b')
+ call VerifyScreenDump(buf, 'Test_verbose_system_1', {})
+
+ " do the same with 'cmdheight' set to 2
+ call term_sendkeys(buf, 'q')
+ call TermWait(buf)
+ call term_sendkeys(buf, ":set ch=2\<CR>")
+ call TermWait(buf)
+ call term_sendkeys(buf, ":4 verbose echo system('seq 20')\<CR>")
+ call VerifyScreenDump(buf, 'Test_verbose_system_2', {})
+
+ call term_sendkeys(buf, ' ')
+ call TermWait(buf)
+ call term_sendkeys(buf, 'b')
+ call VerifyScreenDump(buf, 'Test_verbose_system_2', {})
+
+ call term_sendkeys(buf, 'q')
+ call TermWait(buf)
+ call StopVimInTerminal(buf)
+endfunc
+
+
func Test_ask_yesno()
CheckRunVimInTerminal
let buf = RunVimInTerminal('', {'rows': 6})
@@ -357,15 +417,14 @@ func Test_quit_long_message()
let content =<< trim END
echom range(9999)->join("\x01")
END
- call writefile(content, 'Xtest_quit_message')
- let buf = RunVimInTerminal('-S Xtest_quit_message', #{rows: 6, wait_for_ruler: 0})
- call WaitForAssert({-> assert_match('^-- More --', term_getline(buf, 6))})
+ call writefile(content, 'Xtest_quit_message', 'D')
+ let buf = RunVimInTerminal('-S Xtest_quit_message', #{rows: 10, wait_for_ruler: 0})
+ call WaitForAssert({-> assert_match('^-- More --', term_getline(buf, 10))})
call term_sendkeys(buf, "q")
call VerifyScreenDump(buf, 'Test_quit_long_message', {})
" clean up
call StopVimInTerminal(buf)
- call delete('Xtest_quit_message')
endfunc
" this was missing a terminating NUL
diff --git a/src/nvim/textobject.c b/src/nvim/textobject.c
index 621efa44cf..e6b330cbf1 100644
--- a/src/nvim/textobject.c
+++ b/src/nvim/textobject.c
@@ -1503,7 +1503,7 @@ bool current_quote(oparg_T *oap, long count, bool include, int quotechar)
bool inside_quotes = false; // Looks like "i'" done before
bool selected_quote = false; // Has quote inside selection
int i;
- bool restore_vis_bef = false; // resotre VIsual on abort
+ bool restore_vis_bef = false; // restore VIsual on abort
// When 'selection' is "exclusive" move the cursor to where it would be
// with 'selection' "inclusive", so that the logic is the same for both.
diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c
index 998e8cfed0..fbeca26274 100644
--- a/src/nvim/tui/input.c
+++ b/src/nvim/tui/input.c
@@ -159,14 +159,10 @@ void tinput_init(TermInput *input, Loop *loop)
term = ""; // termkey_new_abstract assumes non-null (#2745)
}
-#if TERMKEY_VERSION_MAJOR > 0 || TERMKEY_VERSION_MINOR > 18
input->tk = termkey_new_abstract(term,
TERMKEY_FLAG_UTF8 | TERMKEY_FLAG_NOSTART);
termkey_hook_terminfo_getstr(input->tk, input->tk_ti_hook_fn, NULL);
termkey_start(input->tk);
-#else
- input->tk = termkey_new_abstract(term, TERMKEY_FLAG_UTF8);
-#endif
int curflags = termkey_get_canonflags(input->tk);
termkey_set_canonflags(input->tk, curflags | TERMKEY_CANON_DELBS);
diff --git a/src/nvim/tui/input.h b/src/nvim/tui/input.h
index 51df57938c..0b60394850 100644
--- a/src/nvim/tui/input.h
+++ b/src/nvim/tui/input.h
@@ -26,9 +26,7 @@ typedef struct term_input {
ExtkeysType extkeys_type;
long ttimeoutlen;
TermKey *tk;
-#if TERMKEY_VERSION_MAJOR > 0 || TERMKEY_VERSION_MINOR > 18
TermKey_Terminfo_Getstr_Hook *tk_ti_hook_fn; ///< libtermkey terminfo hook
-#endif
TimeWatcher timer_handle;
Loop *loop;
Stream read_stream;
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c
index 4eabecb74a..b483ad3486 100644
--- a/src/nvim/tui/tui.c
+++ b/src/nvim/tui/tui.c
@@ -485,9 +485,7 @@ static void tui_main(UIBridgeData *bridge, UI *ui)
// TODO(bfredl): zero hl is empty, send this explicitly?
kv_push(data->attrs, HLATTRS_INIT);
-#if TERMKEY_VERSION_MAJOR > 0 || TERMKEY_VERSION_MINOR > 18
data->input.tk_ti_hook_fn = tui_tk_ti_getstr;
-#endif
tinput_init(&data->input, &tui_loop);
tui_terminal_start(ui);
@@ -2278,7 +2276,6 @@ static void flush_buf(UI *ui)
data->overflow = false;
}
-#if TERMKEY_VERSION_MAJOR > 0 || TERMKEY_VERSION_MINOR > 18
/// Try to get "kbs" code from stty because "the terminfo kbs entry is extremely
/// unreliable." (Vim, Bash, and tmux also do this.)
///
@@ -2287,14 +2284,14 @@ static void flush_buf(UI *ui)
static const char *tui_get_stty_erase(void)
{
static char stty_erase[2] = { 0 };
-# if defined(HAVE_TERMIOS_H)
+#if defined(HAVE_TERMIOS_H)
struct termios t;
if (tcgetattr(input_global_fd(), &t) != -1) {
stty_erase[0] = (char)t.c_cc[VERASE];
stty_erase[1] = '\0';
DLOG("stty/termios:erase=%s", stty_erase);
}
-# endif
+#endif
return stty_erase;
}
@@ -2328,4 +2325,3 @@ static const char *tui_tk_ti_getstr(const char *name, const char *value, void *d
return value;
}
-#endif
diff --git a/src/nvim/undo.c b/src/nvim/undo.c
index d67863f84f..1a9066d7f1 100644
--- a/src/nvim/undo.c
+++ b/src/nvim/undo.c
@@ -1771,16 +1771,16 @@ void u_redo(int count)
/// Undo and remove the branch from the undo tree.
/// Also moves the cursor (as a "normal" undo would).
-bool u_undo_and_forget(int count)
+///
+/// @param do_buf_event If `true`, send the changedtick with the buffer updates
+bool u_undo_and_forget(int count, bool do_buf_event)
{
if (curbuf->b_u_synced == false) {
u_sync(true);
count = 1;
}
undo_undoes = true;
- u_doit(count, true,
- // Don't send nvim_buf_lines_event for u_undo_and_forget().
- false);
+ u_doit(count, true, do_buf_event);
if (curbuf->b_u_curhead == NULL) {
// nothing was undone.
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 22c1b77570..adcf9cdd56 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -737,7 +737,7 @@ void win_set_minimal_style(win_T *wp)
}
// TODO(bfredl): this could use a highlight namespace directly,
- // and avoid pecularities around window options
+ // and avoid peculiarities around window options
char_u *old = (char_u *)wp->w_p_winhl;
wp->w_p_winhl = ((*old == NUL)
? xstrdup("EndOfBuffer:")
@@ -2239,7 +2239,7 @@ static void win_equal_rec(win_T *next_curwin, bool current, frame_T *topfr, int
// Compute maximum number of windows vertically in this frame.
n = frame_minheight(topfr, NOWIN);
// add one for the bottom window if it doesn't have a statusline or separator
- if (row + height == cmdline_row && p_ls == 0) {
+ if (row + height >= cmdline_row && p_ls == 0) {
extra_sep = STATUS_HEIGHT;
} else if (global_stl_height() > 0) {
extra_sep = 1;
diff --git a/test/functional/api/command_spec.lua b/test/functional/api/command_spec.lua
index 44a19d8348..f19d7a362b 100644
--- a/test/functional/api/command_spec.lua
+++ b/test/functional/api/command_spec.lua
@@ -423,6 +423,7 @@ describe('nvim_create_user_command', function()
nargs = 0,
bang = true,
count = 2,
+ register = true,
})
]]
eq({
@@ -460,6 +461,42 @@ describe('nvim_create_user_command', function()
vim.cmd('CommandWithNoArgs')
return result
]])
+ -- register can be specified
+ eq({
+ args = "",
+ fargs = {},
+ bang = false,
+ line1 = 1,
+ line2 = 1,
+ mods = "",
+ smods = {
+ browse = false,
+ confirm = false,
+ emsg_silent = false,
+ hide = false,
+ horizontal = false,
+ keepalt = false,
+ keepjumps = false,
+ keepmarks = false,
+ keeppatterns = false,
+ lockmarks = false,
+ noautocmd = false,
+ noswapfile = false,
+ sandbox = false,
+ silent = false,
+ split = "",
+ tab = -1,
+ unsilent = false,
+ verbose = -1,
+ vertical = false,
+ },
+ range = 0,
+ count = 2,
+ reg = "+",
+ }, exec_lua [[
+ vim.cmd('CommandWithNoArgs +')
+ return result
+ ]])
end)
diff --git a/test/functional/api/extmark_spec.lua b/test/functional/api/extmark_spec.lua
index bc8d811c6d..00f5b25b8a 100644
--- a/test/functional/api/extmark_spec.lua
+++ b/test/functional/api/extmark_spec.lua
@@ -1046,7 +1046,7 @@ describe('API/extmarks', function()
check_undo_redo(ns, marks[3], 0, 4, 0, 8)
end)
- it('substitions over multiple lines with newline in pattern', function()
+ it('substitutes over multiple lines with newline in pattern', function()
feed('A<cr>67890<cr>xx<esc>')
set_extmark(ns, marks[1], 0, 3)
set_extmark(ns, marks[2], 0, 4)
@@ -1078,7 +1078,7 @@ describe('API/extmarks', function()
check_undo_redo(ns, marks[6], 1, 2, 0, 5)
end)
- it('substitions with multiple newlines in pattern', function()
+ it('substitutes with multiple newlines in pattern', function()
feed('A<cr>67890<cr>xx<esc>')
set_extmark(ns, marks[1], 0, 4)
set_extmark(ns, marks[2], 0, 5)
@@ -1093,7 +1093,7 @@ describe('API/extmarks', function()
check_undo_redo(ns, marks[5], 2, 0, 0, 6)
end)
- it('substitions over multiple lines with replace in substition', function()
+ it('substitutes over multiple lines with replace in substitution', function()
feed('A<cr>67890<cr>xx<esc>')
set_extmark(ns, marks[1], 0, 1)
set_extmark(ns, marks[2], 0, 2)
@@ -1111,7 +1111,7 @@ describe('API/extmarks', function()
eq({1, 3}, get_extmark_by_id(ns, marks[3]))
end)
- it('substitions over multiple lines with replace in substition', function()
+ it('substitutes over multiple lines with replace in substitution', function()
feed('A<cr>x3<cr>xx<esc>')
set_extmark(ns, marks[1], 1, 0)
set_extmark(ns, marks[2], 1, 1)
@@ -1122,7 +1122,7 @@ describe('API/extmarks', function()
check_undo_redo(ns, marks[3], 1, 2, 2, 0)
end)
- it('substitions over multiple lines with replace in substition', function()
+ it('substitutes over multiple lines with replace in substitution', function()
feed('A<cr>x3<cr>xx<esc>')
set_extmark(ns, marks[1], 0, 1)
set_extmark(ns, marks[2], 0, 2)
@@ -1140,7 +1140,7 @@ describe('API/extmarks', function()
check_undo_redo(ns, marks[3], 0, 4, 1, 3)
end)
- it('substitions with newline in match and sub, delta is 0', function()
+ it('substitutes with newline in match and sub, delta is 0', function()
feed('A<cr>67890<cr>xx<esc>')
set_extmark(ns, marks[1], 0, 3)
set_extmark(ns, marks[2], 0, 4)
@@ -1157,7 +1157,7 @@ describe('API/extmarks', function()
check_undo_redo(ns, marks[6], 2, 0, 2, 0)
end)
- it('substitions with newline in match and sub, delta > 0', function()
+ it('substitutes with newline in match and sub, delta > 0', function()
feed('A<cr>67890<cr>xx<esc>')
set_extmark(ns, marks[1], 0, 3)
set_extmark(ns, marks[2], 0, 4)
@@ -1174,7 +1174,7 @@ describe('API/extmarks', function()
check_undo_redo(ns, marks[6], 2, 0, 3, 0)
end)
- it('substitions with newline in match and sub, delta < 0', function()
+ it('substitutes with newline in match and sub, delta < 0', function()
feed('A<cr>67890<cr>xx<cr>xx<esc>')
set_extmark(ns, marks[1], 0, 3)
set_extmark(ns, marks[2], 0, 4)
@@ -1193,7 +1193,7 @@ describe('API/extmarks', function()
check_undo_redo(ns, marks[7], 3, 0, 2, 0)
end)
- it('substitions with backrefs, newline inserted into sub', function()
+ it('substitutes with backrefs, newline inserted into sub', function()
feed('A<cr>67890<cr>xx<cr>xx<esc>')
set_extmark(ns, marks[1], 0, 3)
set_extmark(ns, marks[2], 0, 4)
@@ -1210,7 +1210,7 @@ describe('API/extmarks', function()
check_undo_redo(ns, marks[6], 2, 0, 3, 0)
end)
- it('substitions a ^', function()
+ it('substitutes a ^', function()
set_extmark(ns, marks[1], 0, 0)
set_extmark(ns, marks[2], 0, 1)
feed([[:s:^:x<cr>]])
@@ -1397,7 +1397,7 @@ describe('API/extmarks', function()
eq({{id, 1, 0}}, bufmeths.get_extmarks(buf, ns, 0, -1, {}))
end)
- it('does not crash with append/delete/undo seqence', function()
+ it('does not crash with append/delete/undo sequence', function()
meths.exec([[
let ns = nvim_create_namespace('myplugin')
call nvim_buf_set_extmark(0, ns, 0, 0, {})
diff --git a/test/functional/api/keymap_spec.lua b/test/functional/api/keymap_spec.lua
index fedcbfa76a..30c351b26a 100644
--- a/test/functional/api/keymap_spec.lua
+++ b/test/functional/api/keymap_spec.lua
@@ -885,7 +885,7 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
eq({'<space>'}, meths.buf_get_lines(0, 0, -1, false))
end)
- it('lua expr mapping returning nil is equivalent to returnig an empty string', function()
+ it('lua expr mapping returning nil is equivalent to returning an empty string', function()
exec_lua [[
vim.api.nvim_set_keymap ('i', 'aa', '', {callback = function() return nil end, expr = true })
]]
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua
index 44775ef85c..0b2b371046 100644
--- a/test/functional/api/vim_spec.lua
+++ b/test/functional/api/vim_spec.lua
@@ -1,6 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local lfs = require('lfs')
+local luv = require('luv')
local fmt = string.format
local assert_alive = helpers.assert_alive
@@ -14,6 +15,7 @@ local funcs = helpers.funcs
local iswin = helpers.iswin
local meths = helpers.meths
local matches = helpers.matches
+local pesc = helpers.pesc
local mkdir_p = helpers.mkdir_p
local ok, nvim_async, feed = helpers.ok, helpers.nvim_async, helpers.feed
local is_os = helpers.is_os
@@ -3176,9 +3178,6 @@ describe('API', function()
cmd = 'echo',
args = { 'foo' },
bang = false,
- range = {},
- count = -1,
- reg = '',
addr = 'none',
magic = {
file = false,
@@ -3219,8 +3218,6 @@ describe('API', function()
args = { '/math.random/math.max/' },
bang = false,
range = { 4, 6 },
- count = -1,
- reg = '',
addr = 'line',
magic = {
file = false,
@@ -3262,7 +3259,6 @@ describe('API', function()
bang = false,
range = { 1 },
count = 1,
- reg = '',
addr = 'buf',
magic = {
file = false,
@@ -3303,7 +3299,6 @@ describe('API', function()
args = {},
bang = false,
range = {},
- count = -1,
reg = '+',
addr = 'line',
magic = {
@@ -3338,6 +3333,45 @@ describe('API', function()
vertical = false,
}
}, meths.parse_cmd('put +', {}))
+ eq({
+ cmd = 'put',
+ args = {},
+ bang = false,
+ range = {},
+ reg = '',
+ addr = 'line',
+ magic = {
+ file = false,
+ bar = true
+ },
+ nargs = '0',
+ nextcmd = '',
+ mods = {
+ browse = false,
+ confirm = false,
+ emsg_silent = false,
+ filter = {
+ pattern = "",
+ force = false
+ },
+ hide = false,
+ horizontal = false,
+ keepalt = false,
+ keepjumps = false,
+ keepmarks = false,
+ keeppatterns = false,
+ lockmarks = false,
+ noautocmd = false,
+ noswapfile = false,
+ sandbox = false,
+ silent = false,
+ split = "",
+ tab = -1,
+ unsilent = false,
+ verbose = -1,
+ vertical = false,
+ }
+ }, meths.parse_cmd('put', {}))
end)
it('works with range, count and register', function()
eq({
@@ -3387,8 +3421,6 @@ describe('API', function()
args = {},
bang = true,
range = {},
- count = -1,
- reg = '',
addr = 'line',
magic = {
file = true,
@@ -3429,8 +3461,6 @@ describe('API', function()
args = { 'foo.txt' },
bang = false,
range = {},
- count = -1,
- reg = '',
addr = '?',
magic = {
file = true,
@@ -3469,8 +3499,6 @@ describe('API', function()
args = { 'foo.txt' },
bang = false,
range = {},
- count = -1,
- reg = '',
addr = '?',
magic = {
file = true,
@@ -3512,8 +3540,6 @@ describe('API', function()
args = { 'test', 'it' },
bang = true,
range = { 4, 6 },
- count = -1,
- reg = '',
addr = 'line',
magic = {
file = false,
@@ -3554,8 +3580,6 @@ describe('API', function()
args = { 'a.txt' },
bang = false,
range = {},
- count = -1,
- reg = '',
addr = 'arg',
magic = {
file = true,
@@ -3596,9 +3620,6 @@ describe('API', function()
cmd = 'MyCommand',
args = { 'test it' },
bang = false,
- range = {},
- count = -1,
- reg = '',
addr = 'none',
magic = {
file = false,
@@ -3690,8 +3711,6 @@ describe('API', function()
args = {'x'},
bang = true,
range = {3, 4},
- count = -1,
- reg = '',
addr = 'line',
magic = {
file = false,
@@ -3729,6 +3748,11 @@ describe('API', function()
eq('', funcs.getreg('/'))
eq('', funcs.histget('search'))
end)
+ it('result can be used directly by nvim_cmd #20051', function()
+ eq("foo", meths.cmd(meths.parse_cmd('echo "foo"', {}), { output = true }))
+ meths.cmd(meths.parse_cmd("set cursorline", {}), {})
+ eq(true, meths.get_option_value("cursorline", {}))
+ end)
end)
describe('nvim_cmd', function()
it('works', function ()
@@ -3912,11 +3936,23 @@ describe('API', function()
eq({'aa'}, meths.buf_get_lines(0, 0, 1, false))
assert_alive()
end)
+ it('supports filename expansion', function()
+ meths.cmd({ cmd = 'argadd', args = { '%:p:h:t', '%:p:h:t' } }, {})
+ local arg = funcs.expand('%:p:h:t')
+ eq({ arg, arg }, funcs.argv())
+ end)
it("'make' command works when argument count isn't 1 #19696", function()
command('set makeprg=echo')
- meths.cmd({ cmd = 'make' }, {})
+ command('set shellquote=')
+ matches('^:!echo ',
+ meths.cmd({ cmd = 'make' }, { output = true }))
assert_alive()
- meths.cmd({ cmd = 'make', args = { 'foo', 'bar' } }, {})
+ matches('^:!echo foo bar',
+ meths.cmd({ cmd = 'make', args = { 'foo', 'bar' } }, { output = true }))
+ assert_alive()
+ local arg_pesc = pesc(funcs.expand('%:p:h:t'))
+ matches(('^:!echo %s %s'):format(arg_pesc, arg_pesc),
+ meths.cmd({ cmd = 'make', args = { '%:p:h:t', '%:p:h:t' } }, { output = true }))
assert_alive()
end)
it('doesn\'t display messages when output=true', function()
@@ -3949,5 +3985,23 @@ describe('API', function()
15 |
]]}
end)
+ it('works with non-String args', function()
+ eq('2', meths.cmd({cmd = 'echo', args = {2}}, {output = true}))
+ eq('1', meths.cmd({cmd = 'echo', args = {true}}, {output = true}))
+ end)
+ describe('first argument as count', function()
+ before_each(clear)
+
+ it('works', function()
+ command('vsplit | enew')
+ meths.cmd({cmd = 'bdelete', args = {meths.get_current_buf()}}, {})
+ eq(1, meths.get_current_buf().id)
+ end)
+ it('works with :sleep using milliseconds', function()
+ local start = luv.now()
+ meths.cmd({cmd = 'sleep', args = {'100m'}}, {})
+ ok(luv.now() - start <= 300)
+ end)
+ end)
end)
end)
diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua
index 4f9df4010e..a32c801c97 100644
--- a/test/functional/core/startup_spec.lua
+++ b/test/functional/core/startup_spec.lua
@@ -354,7 +354,9 @@ describe('startup', function()
local function pack_clear(cmd)
-- add packages after config dir in rtp but before config/after
- clear{args={'--cmd', 'set packpath=test/functional/fixtures', '--cmd', 'let paths=split(&rtp, ",")', '--cmd', 'let &rtp = paths[0]..",test/functional/fixtures,test/functional/fixtures/middle,"..join(paths[1:],",")', '--cmd', cmd}, env={XDG_CONFIG_HOME='test/functional/fixtures/'}}
+ clear{args={'--cmd', 'set packpath=test/functional/fixtures', '--cmd', 'let paths=split(&rtp, ",")', '--cmd', 'let &rtp = paths[0]..",test/functional/fixtures,test/functional/fixtures/middle,"..join(paths[1:],",")', '--cmd', cmd}, env={XDG_CONFIG_HOME='test/functional/fixtures/'},
+ args_rm={'runtimepath'},
+ }
end
diff --git a/test/functional/ex_cmds/dict_notifications_spec.lua b/test/functional/ex_cmds/dict_notifications_spec.lua
index 21adcf37da..afa6b519d5 100644
--- a/test/functional/ex_cmds/dict_notifications_spec.lua
+++ b/test/functional/ex_cmds/dict_notifications_spec.lua
@@ -4,6 +4,7 @@ local clear, nvim, source = helpers.clear, helpers.nvim, helpers.source
local insert = helpers.insert
local eq, next_msg = helpers.eq, helpers.next_msg
local exc_exec = helpers.exc_exec
+local exec_lua = helpers.exec_lua
local command = helpers.command
local eval = helpers.eval
@@ -21,6 +22,8 @@ describe('VimL dictionary notifications', function()
-- t:) and a dictionary variable, so we generate them in the following
-- function.
local function gentests(dict_expr, dict_init)
+ local is_g = dict_expr == 'g:'
+
local function update(opval, key)
if not key then
key = 'watched'
@@ -32,6 +35,28 @@ describe('VimL dictionary notifications', function()
end
end
+ local function update_with_api(opval, key)
+ if not key then
+ key = 'watched'
+ end
+ if opval == '' then
+ exec_lua(('vim.api.nvim_del_var(\'%s\')'):format(key))
+ else
+ exec_lua(('vim.api.nvim_set_var(\'%s\', %s)'):format(key, opval))
+ end
+ end
+
+ local function update_with_vim_g(opval, key)
+ if not key then
+ key = 'watched'
+ end
+ if opval == '' then
+ exec_lua(('vim.g.%s = nil'):format(key))
+ else
+ exec_lua(('vim.g.%s %s'):format(key, opval))
+ end
+ end
+
local function verify_echo()
-- helper to verify that no notifications are sent after certain change
-- to a dict
@@ -76,6 +101,18 @@ describe('VimL dictionary notifications', function()
update('', 'watched2')
update('')
verify_echo()
+ if is_g then
+ update_with_api('"test"')
+ update_with_api('"test2"', 'watched2')
+ update_with_api('', 'watched2')
+ update_with_api('')
+ verify_echo()
+ update_with_vim_g('= "test"')
+ update_with_vim_g('= "test2"', 'watched2')
+ update_with_vim_g('', 'watched2')
+ update_with_vim_g('')
+ verify_echo()
+ end
end)
it('is not triggered when unwatched keys are updated', function()
@@ -83,6 +120,16 @@ describe('VimL dictionary notifications', function()
update('.= "noop2"', 'unwatched')
update('', 'unwatched')
verify_echo()
+ if is_g then
+ update_with_api('"noop"', 'unwatched')
+ update_with_api('vim.g.unwatched .. "noop2"', 'unwatched')
+ update_with_api('', 'unwatched')
+ verify_echo()
+ update_with_vim_g('= "noop"', 'unwatched')
+ update_with_vim_g('= vim.g.unwatched .. "noop2"', 'unwatched')
+ update_with_vim_g('', 'unwatched')
+ verify_echo()
+ end
end)
it('is triggered by remove()', function()
@@ -92,6 +139,22 @@ describe('VimL dictionary notifications', function()
verify_value({old = 'test'})
end)
+ if is_g then
+ it('is triggered by remove() when updated with nvim_*_var', function()
+ update_with_api('"test"')
+ verify_value({new = 'test'})
+ nvim('command', 'call remove('..dict_expr..', "watched")')
+ verify_value({old = 'test'})
+ end)
+
+ it('is triggered by remove() when updated with vim.g', function()
+ update_with_vim_g('= "test"')
+ verify_value({new = 'test'})
+ nvim('command', 'call remove('..dict_expr..', "watched")')
+ verify_value({old = 'test'})
+ end)
+ end
+
it('is triggered by extend()', function()
update('= "xtend"')
verify_value({new = 'xtend'})
diff --git a/test/functional/ex_cmds/quit_spec.lua b/test/functional/ex_cmds/quit_spec.lua
index fe138a24c8..3680801dae 100644
--- a/test/functional/ex_cmds/quit_spec.lua
+++ b/test/functional/ex_cmds/quit_spec.lua
@@ -7,7 +7,7 @@ describe(':qa', function()
end)
it('verify #3334', function()
- -- just testing if 'qa' passed as a program argument wont result in memory
+ -- just testing if 'qa' passed as a program argument won't result in memory
-- errors
end)
end)
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index eff54b6d4a..3aec834bea 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -29,6 +29,7 @@ local module = {
}
local start_dir = lfs.currentdir()
+local runtime_set = 'set runtimepath^=./build/lib/nvim/'
module.nvim_prog = (
os.getenv('NVIM_PRG')
or global_helpers.test_build_dir .. '/bin/nvim'
@@ -40,6 +41,8 @@ module.nvim_set = (
..' belloff= wildoptions-=pum joinspaces noshowcmd noruler nomore redrawdebug=invalid')
module.nvim_argv = {
module.nvim_prog, '-u', 'NONE', '-i', 'NONE',
+ -- XXX: find treesitter parsers.
+ '--cmd', runtime_set,
'--cmd', module.nvim_set,
'--cmd', 'mapclear',
'--cmd', 'mapclear!',
@@ -345,14 +348,17 @@ end
-- Removes Nvim startup args from `args` matching items in `args_rm`.
--
--- "-u", "-i", "--cmd" are treated specially: their "values" are also removed.
+-- - Special case: "-u", "-i", "--cmd" are treated specially: their "values" are also removed.
+-- - Special case: "runtimepath" will remove only { '--cmd', 'set runtimepath^=…', }
+--
-- Example:
-- args={'--headless', '-u', 'NONE'}
-- args_rm={'--cmd', '-u'}
-- Result:
-- {'--headless'}
--
--- All cases are removed.
+-- All matching cases are removed.
+--
-- Example:
-- args={'--cmd', 'foo', '-N', '--cmd', 'bar'}
-- args_rm={'--cmd', '-u'}
@@ -373,6 +379,9 @@ local function remove_args(args, args_rm)
last = ''
elseif tbl_contains(args_rm, arg) then
last = arg
+ elseif arg == runtime_set and tbl_contains(args_rm, 'runtimepath') then
+ table.remove(new_args) -- Remove the preceding "--cmd".
+ last = ''
else
table.insert(new_args, arg)
end
diff --git a/test/functional/legacy/030_fileformats_spec.lua b/test/functional/legacy/030_fileformats_spec.lua
index 15dbd05cf5..e88afd9c47 100644
--- a/test/functional/legacy/030_fileformats_spec.lua
+++ b/test/functional/legacy/030_fileformats_spec.lua
@@ -255,7 +255,7 @@ describe('fileformats option', function()
-- Assert buffer contents. This has to be done manually as
-- helpers.expect() calls helpers.dedent() which messes up the white space
- -- and carrige returns.
+ -- and carriage returns.
eq(
'unix\n'..
'unix\n'..
diff --git a/test/functional/legacy/055_list_and_dict_types_spec.lua b/test/functional/legacy/055_list_and_dict_types_spec.lua
index 4d71a526c1..c0ff3ed17a 100644
--- a/test/functional/legacy/055_list_and_dict_types_spec.lua
+++ b/test/functional/legacy/055_list_and_dict_types_spec.lua
@@ -907,7 +907,7 @@ describe('list and dictionary types', function()
feed('o<C-R>=a<CR><esc>')
feed_command('lang C')
feed_command('redir => a')
- -- The test failes if this is not in one line.
+ -- The test fails if this is not in one line.
feed_command("try|foobar|catch|let a = matchstr(v:exception,'^[^ ]*')|endtry")
feed_command('redir END')
feed('o<C-R>=a<CR><esc>')
diff --git a/test/functional/legacy/072_undo_file_spec.lua b/test/functional/legacy/072_undo_file_spec.lua
index b4927e779e..80665027c3 100644
--- a/test/functional/legacy/072_undo_file_spec.lua
+++ b/test/functional/legacy/072_undo_file_spec.lua
@@ -69,7 +69,7 @@ describe('72', function()
feed_command('set undofile ul=100')
feed('uuuuuu:w >>test.out<cr>')
- ---- Open the output to see if it meets the expections
+ ---- Open the output to see if it meets the expectations
feed_command('e! test.out')
-- Assert buffer contents.
diff --git a/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua b/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua
index e94b46ca66..54620c7104 100644
--- a/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua
+++ b/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua
@@ -26,7 +26,7 @@ describe('tag search with !_TAG_FILE_ENCODING', function()
'!_TAG_FILE_ENCODING cp932 //\n' ..
'\130`\130a\130b Xtags2.txt /\130`\130a\130b\n'
)
- -- The last file is very long but repetetive and can be generated on the
+ -- The last file is very long but repetitive and can be generated on the
-- fly.
local text = helpers.dedent([[
!_TAG_FILE_SORTED 1 //
diff --git a/test/functional/legacy/autocmd_option_spec.lua b/test/functional/legacy/autocmd_option_spec.lua
index 5e586d3a6a..e00b468c16 100644
--- a/test/functional/legacy/autocmd_option_spec.lua
+++ b/test/functional/legacy/autocmd_option_spec.lua
@@ -211,7 +211,7 @@ describe('au OptionSet', function()
expected_combination({'backup', 0, 0, '', 1, 'local', 'setlocal'})
end)
- it('should trigger if the current buffer is different from the targetted buffer', function()
+ it('should trigger if the current buffer is different from the targeted buffer', function()
local new_buffer = make_buffer()
local new_bufnr = buf.get_number(new_buffer)
@@ -590,7 +590,7 @@ describe('au OptionSet', function()
expected_combination({'backup', 0, 0, '', 1, 'local', 'setlocal'})
end)
- it('should trigger if the current buffer is different from the targetted buffer', function()
+ it('should trigger if the current buffer is different from the targeted buffer', function()
set_hook('buftype')
local new_buffer = make_buffer()
@@ -616,7 +616,7 @@ describe('au OptionSet', function()
expected_combination({'backup', 0, 0, '', 1, 'local', 'setlocal'})
end)
- it('should not trigger if the current window is different from the targetted window', function()
+ it('should not trigger if the current window is different from the targeted window', function()
set_hook('cursorcolumn')
local new_winnr = get_new_window_number()
diff --git a/test/functional/legacy/messages_spec.lua b/test/functional/legacy/messages_spec.lua
index c76ce62ef0..71a53c8381 100644
--- a/test/functional/legacy/messages_spec.lua
+++ b/test/functional/legacy/messages_spec.lua
@@ -4,6 +4,8 @@ local clear = helpers.clear
local command = helpers.command
local exec = helpers.exec
local feed = helpers.feed
+local meths = helpers.meths
+local nvim_dir = helpers.nvim_dir
before_each(clear)
@@ -49,19 +51,18 @@ describe('messages', function()
describe('more prompt', function()
before_each(function()
+ command('set more')
+ end)
+
+ -- oldtest: Test_message_more()
+ it('works', function()
screen = Screen.new(75, 6)
screen:set_default_attr_ids({
- [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
[1] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg
[2] = {foreground = Screen.colors.Brown}, -- LineNr
- [3] = {foreground = Screen.colors.Blue}, -- SpecialKey
})
screen:attach()
- command('set more')
- end)
- -- oldtest: Test_message_more()
- it('works', function()
command('call setline(1, range(1, 100))')
feed(':%pfoo<C-H><C-H><C-H>#')
@@ -350,16 +351,139 @@ describe('messages', function()
]])
end)
+ -- oldtest: Test_echo_verbose_system()
+ it('verbose message before echo command', function()
+ screen = Screen.new(60, 10)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg
+ })
+ screen:attach()
+
+ command('cd '..nvim_dir)
+ meths.set_option('shell', './shell-test')
+ meths.set_option('shellcmdflag', 'REP 20')
+ meths.set_option('shellxquote', '') -- win: avoid extra quotes
+
+ -- display a page and go back, results in exactly the same view
+ feed([[:4 verbose echo system('foo')<CR>]])
+ screen:expect([[
+ Executing command: "'./shell-test' 'REP' '20' 'foo'" |
+ |
+ 0: foo |
+ 1: foo |
+ 2: foo |
+ 3: foo |
+ 4: foo |
+ 5: foo |
+ 6: foo |
+ {1:-- More --}^ |
+ ]])
+ feed('<Space>')
+ screen:expect([[
+ 7: foo |
+ 8: foo |
+ 9: foo |
+ 10: foo |
+ 11: foo |
+ 12: foo |
+ 13: foo |
+ 14: foo |
+ 15: foo |
+ {1:-- More --}^ |
+ ]])
+ feed('b')
+ screen:expect([[
+ Executing command: "'./shell-test' 'REP' '20' 'foo'" |
+ |
+ 0: foo |
+ 1: foo |
+ 2: foo |
+ 3: foo |
+ 4: foo |
+ 5: foo |
+ 6: foo |
+ {1:-- More --}^ |
+ ]])
+
+ -- do the same with 'cmdheight' set to 2
+ feed('q')
+ command('set ch=2')
+ command('mode') -- FIXME: bottom is invalid after scrolling
+ screen:expect([[
+ ^ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ |
+ ]])
+ feed([[:4 verbose echo system('foo')<CR>]])
+ screen:expect([[
+ Executing command: "'./shell-test' 'REP' '20' 'foo'" |
+ |
+ 0: foo |
+ 1: foo |
+ 2: foo |
+ 3: foo |
+ 4: foo |
+ 5: foo |
+ 6: foo |
+ {1:-- More --}^ |
+ ]])
+ feed('<Space>')
+ screen:expect([[
+ 7: foo |
+ 8: foo |
+ 9: foo |
+ 10: foo |
+ 11: foo |
+ 12: foo |
+ 13: foo |
+ 14: foo |
+ 15: foo |
+ {1:-- More --}^ |
+ ]])
+ feed('b')
+ screen:expect([[
+ Executing command: "'./shell-test' 'REP' '20' 'foo'" |
+ |
+ 0: foo |
+ 1: foo |
+ 2: foo |
+ 3: foo |
+ 4: foo |
+ 5: foo |
+ 6: foo |
+ {1:-- More --}^ |
+ ]])
+ end)
+
-- oldtest: Test_quit_long_message()
it('with control characters can be quit vim-patch:8.2.1844', function()
- screen:try_resize(40, 6)
+ screen = Screen.new(40, 10)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg
+ [2] = {foreground = Screen.colors.Blue}, -- SpecialKey
+ })
+ screen:attach()
+
feed([[:echom range(9999)->join("\x01")<CR>]])
screen:expect([[
- 0{3:^A}1{3:^A}2{3:^A}3{3:^A}4{3:^A}5{3:^A}6{3:^A}7{3:^A}8{3:^A}9{3:^A}10{3:^A}11{3:^A}12|
- {3:^A}13{3:^A}14{3:^A}15{3:^A}16{3:^A}17{3:^A}18{3:^A}19{3:^A}20{3:^A}21{3:^A}22|
- {3:^A}23{3:^A}24{3:^A}25{3:^A}26{3:^A}27{3:^A}28{3:^A}29{3:^A}30{3:^A}31{3:^A}32|
- {3:^A}33{3:^A}34{3:^A}35{3:^A}36{3:^A}37{3:^A}38{3:^A}39{3:^A}40{3:^A}41{3:^A}42|
- {3:^A}43{3:^A}44{3:^A}45{3:^A}46{3:^A}47{3:^A}48{3:^A}49{3:^A}50{3:^A}51{3:^A}52|
+ 0{2:^A}1{2:^A}2{2:^A}3{2:^A}4{2:^A}5{2:^A}6{2:^A}7{2:^A}8{2:^A}9{2:^A}10{2:^A}11{2:^A}12|
+ {2:^A}13{2:^A}14{2:^A}15{2:^A}16{2:^A}17{2:^A}18{2:^A}19{2:^A}20{2:^A}21{2:^A}22|
+ {2:^A}23{2:^A}24{2:^A}25{2:^A}26{2:^A}27{2:^A}28{2:^A}29{2:^A}30{2:^A}31{2:^A}32|
+ {2:^A}33{2:^A}34{2:^A}35{2:^A}36{2:^A}37{2:^A}38{2:^A}39{2:^A}40{2:^A}41{2:^A}42|
+ {2:^A}43{2:^A}44{2:^A}45{2:^A}46{2:^A}47{2:^A}48{2:^A}49{2:^A}50{2:^A}51{2:^A}52|
+ {2:^A}53{2:^A}54{2:^A}55{2:^A}56{2:^A}57{2:^A}58{2:^A}59{2:^A}60{2:^A}61{2:^A}62|
+ {2:^A}63{2:^A}64{2:^A}65{2:^A}66{2:^A}67{2:^A}68{2:^A}69{2:^A}70{2:^A}71{2:^A}72|
+ {2:^A}73{2:^A}74{2:^A}75{2:^A}76{2:^A}77{2:^A}78{2:^A}79{2:^A}80{2:^A}81{2:^A}82|
+ {2:^A}83{2:^A}84{2:^A}85{2:^A}86{2:^A}87{2:^A}88{2:^A}89{2:^A}90{2:^A}91{2:^A}92|
{1:-- More --}^ |
]])
feed('q')
@@ -369,6 +493,10 @@ describe('messages', function()
{0:~ }|
{0:~ }|
{0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
|
]])
end)
diff --git a/test/functional/lua/api_spec.lua b/test/functional/lua/api_spec.lua
index f173a15d32..03832978a4 100644
--- a/test/functional/lua/api_spec.lua
+++ b/test/functional/lua/api_spec.lua
@@ -166,7 +166,7 @@ describe('luaeval(vim.api.…)', function()
eq({v={}}, funcs.luaeval('vim.api.nvim__id_dictionary({v={[vim.type_idx]=vim.types.array, [vim.val_idx]=10, [5]=1, foo=2}})'))
-- If API requests dictionary, then empty table will be the one. This is not
- -- the case normally because empty table is an empty arrray.
+ -- the case normally because empty table is an empty array.
eq({}, funcs.luaeval('vim.api.nvim__id_dictionary({})'))
eq(4, eval([[type(luaeval('vim.api.nvim__id_dictionary({})'))]]))
end)
diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua
index 10de45274c..2fd44b8b5f 100644
--- a/test/functional/lua/buffer_updates_spec.lua
+++ b/test/functional/lua/buffer_updates_spec.lua
@@ -118,6 +118,24 @@ describe('lua buffer event callbacks: on_lines', function()
}
tick = tick + 1
+ tick = tick + 1
+ command('redo')
+ check_events {
+ { "test1", "lines", 1, tick, 3, 5, 4, 32 };
+ { "test2", "lines", 1, tick, 3, 5, 4, 32 };
+ { "test2", "changedtick", 1, tick+1 };
+ }
+ tick = tick + 1
+
+ tick = tick + 1
+ command('undo!')
+ check_events {
+ { "test1", "lines", 1, tick, 3, 4, 5, 13 };
+ { "test2", "lines", 1, tick, 3, 4, 5, 13 };
+ { "test2", "changedtick", 1, tick+1 };
+ }
+ tick = tick + 1
+
-- simulate next callback returning true
exec_lua("test_unreg = 'test1'")
@@ -315,7 +333,7 @@ describe('lua: nvim_buf_attach on_bytes', function()
start_txt = meths.buf_get_lines(0, 0, -1, true)
end
local shadowbytes = table.concat(start_txt, '\n') .. '\n'
- -- TODO: while we are brewing the real strong coffe,
+ -- TODO: while we are brewing the real strong coffee,
-- verify should check buf_get_offset after every check_events
if verify then
local len = meths.buf_get_offset(0, meths.buf_line_count(0))
diff --git a/test/functional/lua/filetype_spec.lua b/test/functional/lua/filetype_spec.lua
index be57b2db31..2a7be53164 100644
--- a/test/functional/lua/filetype_spec.lua
+++ b/test/functional/lua/filetype_spec.lua
@@ -1,6 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
local exec_lua = helpers.exec_lua
local eq = helpers.eq
+local meths = helpers.meths
local clear = helpers.clear
local pathroot = helpers.pathroot
local command = helpers.command
@@ -94,3 +95,10 @@ describe('vim.filetype', function()
]])
end)
end)
+
+describe('filetype.lua', function()
+ it('does not override user autocommands that set filetype #20333', function()
+ clear({args={'--clean', '--cmd', 'autocmd BufRead *.md set filetype=notmarkdown', 'README.md'}})
+ eq('notmarkdown', meths.buf_get_option(0, 'filetype'))
+ end)
+end)
diff --git a/test/functional/lua/help_spec.lua b/test/functional/lua/help_spec.lua
index 266f261ab9..a00aaea9d2 100644
--- a/test/functional/lua/help_spec.lua
+++ b/test/functional/lua/help_spec.lua
@@ -12,29 +12,26 @@ describe(':help docs', function()
before_each(clear)
it('validate', function()
-- If this test fails, try these steps (in order):
- -- 1. Try to fix/cleanup the :help docs, especially Nvim-owned :help docs.
- -- 2. Try to fix the parser: https://github.com/vigoux/tree-sitter-vimdoc
+ -- 1. Fix/cleanup the :help docs.
+ -- 2. Fix the parser: https://github.com/neovim/tree-sitter-vimdoc
-- 3. File a parser bug, and adjust the tolerance of this test in the meantime.
local rv = exec_lua([[return require('scripts.gen_help_html').validate('./build/runtime/doc')]])
+ -- Check that we actually found helpfiles.
+ ok(rv.helpfiles > 100, '>100 :help files', rv.helpfiles)
-- Check that parse errors did not increase wildly.
- -- TODO: yes, there are currently 24k+ parser errors.
- -- WIP: https://github.com/vigoux/tree-sitter-vimdoc/pull/16
- ok(rv.err_count < 24000, '<24000', rv.err_count)
- -- TODO: should be eq(0, …)
- ok(exec_lua('return vim.tbl_count(...)', rv.invalid_tags) < 538, '<538',
- exec_lua('return vim.inspect(...)', rv.invalid_tags))
+ -- TODO: Fix all parse errors in :help files.
+ ok(rv.err_count < 250, '<250 parse errors', rv.err_count)
+ eq({}, rv.invalid_links, exec_lua([[return 'found invalid :help tag links:\n'..vim.inspect(...)]], rv.invalid_links))
end)
it('gen_help_html.lua generates HTML', function()
- -- Test:
- -- 1. Check that parse errors did not increase wildly. Because we explicitly test only a few
- -- :help files, we can be more precise about the tolerances here.
- -- 2. exercise gen_help_html.lua, check that it actually works.
- -- 3. check that its tree-sitter-vimdoc dependency is working.
+ -- 1. Test that gen_help_html.lua actually works.
+ -- 2. Test that parse errors did not increase wildly. Because we explicitly test only a few
+ -- :help files, we can be precise about the tolerances here.
local tmpdir = exec_lua('return vim.fs.dirname(vim.fn.tempname())')
- -- Because gen() is slow (1 min), this test is limited to a few files.
+ -- Because gen() is slow (~30s), this test is limited to a few files.
local rv = exec_lua([[
local to_dir = ...
return require('scripts.gen_help_html').gen(
@@ -46,9 +43,7 @@ describe(':help docs', function()
tmpdir
)
eq(4, #rv.helpfiles)
- ok(rv.err_count < 700, '<700', rv.err_count)
- -- TODO: should be eq(0, …)
- ok(exec_lua('return vim.tbl_count(...)', rv.invalid_tags) <= 32, '<=32',
- exec_lua('return vim.inspect(...)', rv.invalid_tags))
+ ok(rv.err_count <= 6, '<=6 parse errors', rv.err_count)
+ eq({}, rv.invalid_links, exec_lua([[return 'found invalid :help tag links:\n'..vim.inspect(...)]], rv.invalid_links))
end)
end)
diff --git a/test/functional/lua/uri_spec.lua b/test/functional/lua/uri_spec.lua
index 4635f17557..2cb0b26c6d 100644
--- a/test/functional/lua/uri_spec.lua
+++ b/test/functional/lua/uri_spec.lua
@@ -11,7 +11,7 @@ describe('URI methods', function()
describe('file path to uri', function()
describe('encode Unix file path', function()
- it('file path includes only ascii charactors', function()
+ it('file path includes only ascii characters', function()
exec_lua("filepath = '/Foo/Bar/Baz.txt'")
eq('file:///Foo/Bar/Baz.txt', exec_lua("return vim.uri_from_fname(filepath)"))
@@ -23,7 +23,7 @@ describe('URI methods', function()
eq('file:///Foo%20/Bar/Baz.txt', exec_lua("return vim.uri_from_fname(filepath)"))
end)
- it('file path including Unicode charactors', function()
+ it('file path including Unicode characters', function()
exec_lua("filepath = '/xy/åäö/ɧ/汉语/↥/🤦/🦄/å/بِيَّ.txt'")
-- The URI encoding should be case-insensitive
@@ -32,7 +32,7 @@ describe('URI methods', function()
end)
describe('encode Windows filepath', function()
- it('file path includes only ascii charactors', function()
+ it('file path includes only ascii characters', function()
exec_lua([[filepath = 'C:\\Foo\\Bar\\Baz.txt']])
eq('file:///C:/Foo/Bar/Baz.txt', exec_lua("return vim.uri_from_fname(filepath)"))
@@ -44,7 +44,7 @@ describe('URI methods', function()
eq('file:///C:/Foo%20/Bar/Baz.txt', exec_lua("return vim.uri_from_fname(filepath)"))
end)
- it('file path including Unicode charactors', function()
+ it('file path including Unicode characters', function()
exec_lua([[filepath = 'C:\\xy\\åäö\\ɧ\\汉语\\↥\\🤦\\🦄\\å\\بِيَّ.txt']])
eq('file:///C:/xy/%c3%a5%c3%a4%c3%b6/%c9%a7/%e6%b1%89%e8%af%ad/%e2%86%a5/%f0%9f%a4%a6/%f0%9f%a6%84/a%cc%8a/%d8%a8%d9%90%d9%8a%d9%8e%d9%91.txt', exec_lua("return vim.uri_from_fname(filepath)"))
@@ -72,7 +72,7 @@ describe('URI methods', function()
eq('/Foo /Bar/Baz.txt', exec_lua("return vim.uri_to_fname(uri)"))
end)
- it('file path including Unicode charactors', function()
+ it('file path including Unicode characters', function()
local test_case = [[
local uri = 'file:///xy/%C3%A5%C3%A4%C3%B6/%C9%A7/%E6%B1%89%E8%AF%AD/%E2%86%A5/%F0%9F%A4%A6/%F0%9F%A6%84/a%CC%8A/%D8%A8%D9%90%D9%8A%D9%8E%D9%91.txt'
return vim.uri_to_fname(uri)
@@ -83,7 +83,7 @@ describe('URI methods', function()
end)
describe('decode Windows filepath', function()
- it('file path includes only ascii charactors', function()
+ it('file path includes only ascii characters', function()
local test_case = [[
local uri = 'file:///C:/Foo/Bar/Baz.txt'
return vim.uri_to_fname(uri)
@@ -119,7 +119,7 @@ describe('URI methods', function()
eq('C:\\Foo \\Bar\\Baz.txt', exec_lua(test_case))
end)
- it('file path including Unicode charactors', function()
+ it('file path including Unicode characters', function()
local test_case = [[
local uri = 'file:///C:/xy/%C3%A5%C3%A4%C3%B6/%C9%A7/%E6%B1%89%E8%AF%AD/%E2%86%A5/%F0%9F%A4%A6/%F0%9F%A6%84/a%CC%8A/%D8%A8%D9%90%D9%8A%D9%8E%D9%91.txt'
return vim.uri_to_fname(uri)
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua
index 3184f01ef4..6451453ce0 100644
--- a/test/functional/lua/vim_spec.lua
+++ b/test/functional/lua/vim_spec.lua
@@ -905,7 +905,7 @@ describe('lua stdlib', function()
]]))
-- vim.empty_dict() gives new value each time
- -- equality is not overriden (still by ref)
+ -- equality is not overridden (still by ref)
-- non-empty table uses the usual heuristics (ignores the tag)
eq({false, {"foo"}, {namey="bar"}}, exec_lua([[
local aa = vim.empty_dict()
@@ -1390,11 +1390,23 @@ describe('lua stdlib', function()
end)
it('vim.env', function()
- exec_lua [[
- vim.fn.setenv("A", 123)
- ]]
- eq('123', funcs.luaeval "vim.env.A")
- eq(true, funcs.luaeval "vim.env.B == nil")
+ exec_lua([[vim.fn.setenv('A', 123)]])
+ eq('123', funcs.luaeval('vim.env.A'))
+ exec_lua([[vim.env.A = 456]])
+ eq('456', funcs.luaeval('vim.env.A'))
+ exec_lua([[vim.env.A = nil]])
+ eq(NIL, funcs.luaeval('vim.env.A'))
+
+ eq(true, funcs.luaeval('vim.env.B == nil'))
+
+ command([[let $HOME = 'foo']])
+ eq('foo', funcs.expand('~'))
+ eq('foo', funcs.luaeval('vim.env.HOME'))
+ exec_lua([[vim.env.HOME = nil]])
+ eq('foo', funcs.expand('~'))
+ exec_lua([[vim.env.HOME = 'bar']])
+ eq('bar', funcs.expand('~'))
+ eq('bar', funcs.luaeval('vim.env.HOME'))
end)
it('vim.v', function()
diff --git a/test/functional/options/defaults_spec.lua b/test/functional/options/defaults_spec.lua
index 4e2f2ab63e..130ed73c34 100644
--- a/test/functional/options/defaults_spec.lua
+++ b/test/functional/options/defaults_spec.lua
@@ -220,7 +220,9 @@ describe('startup defaults', function()
end)
it("'packpath'", function()
- clear()
+ clear{
+ args_rm={'runtimepath'},
+ }
-- Defaults to &runtimepath.
eq(meths.get_option('runtimepath'), meths.get_option('packpath'))
@@ -332,17 +334,19 @@ describe('XDG defaults', function()
describe('with too long XDG variables', function()
before_each(function()
- clear({env={
- XDG_CONFIG_HOME=(root_path .. ('/x'):rep(4096)),
- XDG_CONFIG_DIRS=(root_path .. ('/a'):rep(2048)
- .. env_sep.. root_path .. ('/b'):rep(2048)
- .. (env_sep .. root_path .. '/c'):rep(512)),
- XDG_DATA_HOME=(root_path .. ('/X'):rep(4096)),
- XDG_RUNTIME_DIR=(root_path .. ('/X'):rep(4096)),
- XDG_STATE_HOME=(root_path .. ('/X'):rep(4096)),
- XDG_DATA_DIRS=(root_path .. ('/A'):rep(2048)
- .. env_sep .. root_path .. ('/B'):rep(2048)
- .. (env_sep .. root_path .. '/C'):rep(512)),
+ clear({
+ args_rm={'runtimepath'},
+ env={
+ XDG_CONFIG_HOME=(root_path .. ('/x'):rep(4096)),
+ XDG_CONFIG_DIRS=(root_path .. ('/a'):rep(2048)
+ .. env_sep.. root_path .. ('/b'):rep(2048)
+ .. (env_sep .. root_path .. '/c'):rep(512)),
+ XDG_DATA_HOME=(root_path .. ('/X'):rep(4096)),
+ XDG_RUNTIME_DIR=(root_path .. ('/X'):rep(4096)),
+ XDG_STATE_HOME=(root_path .. ('/X'):rep(4096)),
+ XDG_DATA_DIRS=(root_path .. ('/A'):rep(2048)
+ .. env_sep .. root_path .. ('/B'):rep(2048)
+ .. (env_sep .. root_path .. '/C'):rep(512)),
}})
end)
@@ -405,13 +409,15 @@ describe('XDG defaults', function()
describe('with XDG variables that can be expanded', function()
before_each(function()
- clear({env={
- XDG_CONFIG_HOME='$XDG_DATA_HOME',
- XDG_CONFIG_DIRS='$XDG_DATA_DIRS',
- XDG_DATA_HOME='$XDG_CONFIG_HOME',
- XDG_RUNTIME_DIR='$XDG_RUNTIME_DIR',
- XDG_STATE_HOME='$XDG_CONFIG_HOME',
- XDG_DATA_DIRS='$XDG_CONFIG_DIRS',
+ clear({
+ args_rm={'runtimepath'},
+ env={
+ XDG_CONFIG_HOME='$XDG_DATA_HOME',
+ XDG_CONFIG_DIRS='$XDG_DATA_DIRS',
+ XDG_DATA_HOME='$XDG_CONFIG_HOME',
+ XDG_RUNTIME_DIR='$XDG_RUNTIME_DIR',
+ XDG_STATE_HOME='$XDG_CONFIG_HOME',
+ XDG_DATA_DIRS='$XDG_CONFIG_DIRS',
}})
end)
@@ -478,12 +484,14 @@ describe('XDG defaults', function()
describe('with commas', function()
before_each(function()
- clear({env={
- XDG_CONFIG_HOME=', , ,',
- XDG_CONFIG_DIRS=',-,-,' .. env_sep .. '-,-,-',
- XDG_DATA_HOME=',=,=,',
- XDG_STATE_HOME=',=,=,',
- XDG_DATA_DIRS=',≡,≡,' .. env_sep .. '≡,≡,≡',
+ clear({
+ args_rm={'runtimepath'},
+ env={
+ XDG_CONFIG_HOME=', , ,',
+ XDG_CONFIG_DIRS=',-,-,' .. env_sep .. '-,-,-',
+ XDG_DATA_HOME=',=,=,',
+ XDG_STATE_HOME=',=,=,',
+ XDG_DATA_DIRS=',≡,≡,' .. env_sep .. '≡,≡,≡',
}})
end)
diff --git a/test/functional/options/keymap_spec.lua b/test/functional/options/keymap_spec.lua
index a814c35a39..4fdc6ef4be 100644
--- a/test/functional/options/keymap_spec.lua
+++ b/test/functional/options/keymap_spec.lua
@@ -184,7 +184,7 @@ describe("'keymap' / :lmap", function()
feed('il<esc>')
expect('alllaaa')
end)
- -- This is a problem introduced when introducting :lmap and macro
+ -- This is a problem introduced when introducing :lmap and macro
-- compatibility. There are no plans to fix this as the complexity involved
-- seems too great.
pending('mappings not applied to macro replay of :lnoremap', function()
diff --git a/test/functional/provider/clipboard_spec.lua b/test/functional/provider/clipboard_spec.lua
index fbaef3ae00..401dc84ccc 100644
--- a/test/functional/provider/clipboard_spec.lua
+++ b/test/functional/provider/clipboard_spec.lua
@@ -310,18 +310,18 @@ describe('clipboard (with fake clipboard.vim)', function()
insert([[
text:
first line
- secound line
+ second line
third line]])
feed('G"+dd"*dddd"+p"*pp')
expect([[
text:
third line
- secound line
+ second line
first line]])
-- linewise selection should be encoded as an extra newline
eq({{'third line', ''}, 'V'}, eval("g:test_clip['+']"))
- eq({{'secound line', ''}, 'V'}, eval("g:test_clip['*']"))
+ eq({{'second line', ''}, 'V'}, eval("g:test_clip['*']"))
end)
it('handles null bytes when pasting and in getreg', function()
@@ -477,7 +477,7 @@ describe('clipboard (with fake clipboard.vim)', function()
expect("indeed star")
end)
- it('unamed operations work even if the provider fails', function()
+ it('unnamed operations work even if the provider fails', function()
insert('the text')
feed('yy')
feed_command("let g:cliperror = 1")
@@ -511,7 +511,7 @@ describe('clipboard (with fake clipboard.vim)', function()
eq('textstar', meths.get_current_line())
end)
- it('Block paste works currectly', function()
+ it('Block paste works correctly', function()
insert([[
aabbcc
ddeeff
@@ -559,7 +559,7 @@ describe('clipboard (with fake clipboard.vim)', function()
eq({{'really unnamed', ''}, 'V'}, eval("g:test_clip['+']"))
eq({{'really unnamed', ''}, 'V'}, eval("g:test_clip['*']"))
- -- unnamedplus takes predecence when pasting
+ -- unnamedplus takes precedence when pasting
eq('+', eval('v:register'))
feed_command("let g:test_clip['+'] = ['the plus','']")
feed_command("let g:test_clip['*'] = ['the star','']")
diff --git a/test/functional/terminal/helpers.lua b/test/functional/terminal/helpers.lua
index bcfd3559e6..d69f3207f1 100644
--- a/test/functional/terminal/helpers.lua
+++ b/test/functional/terminal/helpers.lua
@@ -31,6 +31,8 @@ local function set_bg(num) feed_termcode('[48;5;'..num..'m') end
local function set_bold() feed_termcode('[1m') end
local function set_italic() feed_termcode('[3m') end
local function set_underline() feed_termcode('[4m') end
+local function set_underdouble() feed_termcode('[4:2m') end
+local function set_undercurl() feed_termcode('[4:3m') end
local function set_strikethrough() feed_termcode('[9m') end
local function clear_attrs() feed_termcode('[0;10m') end
-- mouse
@@ -116,6 +118,8 @@ return {
set_bold = set_bold,
set_italic = set_italic,
set_underline = set_underline,
+ set_underdouble = set_underdouble,
+ set_undercurl = set_undercurl,
set_strikethrough = set_strikethrough,
clear_attrs = clear_attrs,
enable_mouse = enable_mouse,
diff --git a/test/functional/terminal/highlight_spec.lua b/test/functional/terminal/highlight_spec.lua
index 28ca07d815..a119d4acd3 100644
--- a/test/functional/terminal/highlight_spec.lua
+++ b/test/functional/terminal/highlight_spec.lua
@@ -26,6 +26,8 @@ describe(':terminal highlight', function()
[9] = {foreground = 130},
[10] = {reverse = true},
[11] = {background = 11},
+ [12] = {bold = true, underdouble = true},
+ [13] = {italic = true, undercurl = true},
})
screen:attach({rgb=false})
command(("enew | call termopen(['%s'])"):format(testprg('tty-test')))
@@ -114,6 +116,14 @@ describe(':terminal highlight', function()
thelpers.set_underline()
thelpers.set_strikethrough()
end)
+ descr('bold and underdouble', 12, function()
+ thelpers.set_bold()
+ thelpers.set_underdouble()
+ end)
+ descr('italics and undercurl', 13, function()
+ thelpers.set_italic()
+ thelpers.set_undercurl()
+ end)
end)
it(':terminal highlight has lower precedence than editor #9964', function()
diff --git a/test/functional/ui/bufhl_spec.lua b/test/functional/ui/bufhl_spec.lua
index 7c0831bd09..46bfae8de2 100644
--- a/test/functional/ui/bufhl_spec.lua
+++ b/test/functional/ui/bufhl_spec.lua
@@ -762,7 +762,7 @@ describe('Buffer highlighting', function()
local s1 = {{'Köttbullar', 'Comment'}, {'Kräuterbutter'}}
local s2 = {{'こんにちは', 'Comment'}}
- -- TODO: only a virtual text from the same ns curretly overrides
+ -- TODO: only a virtual text from the same ns currently overrides
-- an existing virtual text. We might add a prioritation system.
set_virtual_text(id1, 0, s1, {})
eq({{1, 0, 0, {
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index 92eb853686..1528b5307d 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -5,6 +5,7 @@ local source = helpers.source
local command = helpers.command
local assert_alive = helpers.assert_alive
local uname = helpers.uname
+local exec = helpers.exec
local eval = helpers.eval
local eq = helpers.eq
@@ -821,16 +822,27 @@ describe('statusline is redrawn on entering cmdline', function()
]]}
end)
- it('but not with scrolled messages', function()
- command('set statusline=%{mode()}')
- screen:try_resize(35,10)
+ it('with scrolled messages and msgsep', function()
+ screen:try_resize(35,14)
+ exec([[
+ let g:count = 0
+ autocmd CmdlineEnter * let g:count += 1
+ split
+ resize 1
+ setlocal statusline=%{mode()}%{g:count}
+ setlocal winbar=%{mode()}%{g:count}
+ ]])
feed(':echoerr doesnotexist<cr>')
screen:expect{grid=[[
+ {9:c1 }|
+ |
+ {3:c1 }|
|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
+ {1:~ }|
{3: }|
{4:E121: Undefined variable: doesnotex}|
{4:ist} |
@@ -839,8 +851,27 @@ describe('statusline is redrawn on entering cmdline', function()
]]}
feed(':echoerr doesnotexist<cr>')
screen:expect{grid=[[
+ {9:c2 }|
+ |
+ {3:c2 }|
|
{1:~ }|
+ {1:~ }|
+ {3: }|
+ {4:E121: Undefined variable: doesnotex}|
+ {4:ist} |
+ {5:Press ENTER or type command to cont}|
+ {4:E121: Undefined variable: doesnotex}|
+ {4:ist} |
+ {5:Press ENTER or type command to cont}|
+ {5:inue}^ |
+ ]]}
+
+ feed(':echoerr doesnotexist<cr>')
+ screen:expect{grid=[[
+ {9:c3 }|
+ |
+ {3:c3 }|
{3: }|
{4:E121: Undefined variable: doesnotex}|
{4:ist} |
@@ -848,6 +879,63 @@ describe('statusline is redrawn on entering cmdline', function()
{4:E121: Undefined variable: doesnotex}|
{4:ist} |
{5:Press ENTER or type command to cont}|
+ {4:E121: Undefined variable: doesnotex}|
+ {4:ist} |
+ {5:Press ENTER or type command to cont}|
+ {5:inue}^ |
+ ]]}
+
+ feed('<cr>')
+ screen:expect{grid=[[
+ {9:n3 }|
+ ^ |
+ {3:n3 }|
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {2:[No Name] }|
+ |
+ ]]}
+ end)
+
+ it('but not with scrolled messages without msgsep', function()
+ screen:try_resize(35,10)
+ exec([[
+ let g:count = 0
+ autocmd CmdlineEnter * let g:count += 1
+ set display-=msgsep
+ set statusline=%{mode()}%{g:count}
+ ]])
+ feed(':echoerr doesnotexist<cr>')
+ screen:expect{grid=[[
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {3:c1 }|
+ {4:E121: Undefined variable: doesnotex}|
+ {4:ist} |
+ {5:Press ENTER or type command to cont}|
+ {5:inue}^ |
+ ]]}
+ feed(':echoerr doesnotexist<cr>')
+ screen:expect{grid=[[
+ {1:~ }|
+ {1:~ }|
+ {3:c1 }|
+ {4:E121: Undefined variable: doesnotex}|
+ {4:ist} |
+ {5:Press ENTER or type command to cont}|
+ {4:E121: Undefined variable: doesnotex}|
+ {4:ist} |
+ {5:Press ENTER or type command to cont}|
{5:inue}^ |
]]}
@@ -875,7 +963,7 @@ describe('statusline is redrawn on entering cmdline', function()
{1:~ }|
{1:~ }|
{1:~ }|
- {3:n }|
+ {3:n3 }|
|
]]}
end)
@@ -1183,4 +1271,148 @@ describe('cmdheight=0', function()
{1:~ }|
]]}
end)
+
+ it('with silent! at startup', function()
+ clear{args={'-c', 'set cmdheight=0', '-c', 'autocmd VimEnter * silent! call Foo()'}}
+ screen:attach()
+ -- doesn't crash while not displaying silent! error message
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]]}
+ end)
+
+ it('with multigrid', function()
+ clear{args={'--cmd', 'set cmdheight=0'}}
+ screen:attach{ext_multigrid=true}
+ screen:expect{grid=[[
+ ## grid 1
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ ## grid 2
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ ]], win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ }}
+
+ feed '/p'
+ screen:expect{grid=[[
+ ## grid 1
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [2:-------------------------]|
+ [3:-------------------------]|
+ ## grid 2
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ /p^ |
+ ]], win_viewport={
+ [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1};
+ }}
+ end)
+
+ it('winbar is redrawn on entering cmdline and :redrawstatus #20336', function()
+ exec([[
+ set cmdheight=0
+ set winbar=%{mode()}%=:%{getcmdline()}
+ ]])
+ feed(':')
+ screen:expect([[
+ {3:c :}|
+ |
+ {1:~ }|
+ {1:~ }|
+ :^ |
+ ]])
+ feed('echo')
+ -- not redrawn yet
+ screen:expect([[
+ {3:c :}|
+ |
+ {1:~ }|
+ {1:~ }|
+ :echo^ |
+ ]])
+ command('redrawstatus')
+ screen:expect([[
+ {3:c :echo}|
+ |
+ {1:~ }|
+ {1:~ }|
+ :echo^ |
+ ]])
+ end)
+
+ it('window equalization with laststatus=0 #20367', function()
+ screen:try_resize(60, 9)
+ command('set cmdheight=0 laststatus=0')
+ command('vsplit')
+ screen:expect([[
+ ^ │ |
+ {1:~ }│{1:~ }|
+ {1:~ }│{1:~ }|
+ {1:~ }│{1:~ }|
+ {1:~ }│{1:~ }|
+ {1:~ }│{1:~ }|
+ {1:~ }│{1:~ }|
+ {1:~ }│{1:~ }|
+ {1:~ }│{1:~ }|
+ ]])
+ feed(':')
+ command('split')
+ feed('<Esc>')
+ screen:expect([[
+ ^ │ |
+ {1:~ }│{1:~ }|
+ {1:~ }│{1:~ }|
+ {1:~ }│{1:~ }|
+ {2:[No Name] }│{1:~ }|
+ │{1:~ }|
+ {1:~ }│{1:~ }|
+ {1:~ }│{1:~ }|
+ {1:~ }│{1:~ }|
+ ]])
+ command('resize 2')
+ screen:expect([[
+ ^ │ |
+ {1:~ }│{1:~ }|
+ {2:[No Name] }│{1:~ }|
+ │{1:~ }|
+ {1:~ }│{1:~ }|
+ {1:~ }│{1:~ }|
+ {1:~ }│{1:~ }|
+ {1:~ }│{1:~ }|
+ {1:~ }│{1:~ }|
+ ]])
+ feed(':')
+ command('wincmd =')
+ feed('<Esc>')
+ screen:expect([[
+ ^ │ |
+ {1:~ }│{1:~ }|
+ {1:~ }│{1:~ }|
+ {1:~ }│{1:~ }|
+ {2:[No Name] }│{1:~ }|
+ │{1:~ }|
+ {1:~ }│{1:~ }|
+ {1:~ }│{1:~ }|
+ {1:~ }│{1:~ }|
+ ]])
+ end)
end)
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua
index 44b88d702f..0a5eefbf38 100644
--- a/test/functional/ui/decorations_spec.lua
+++ b/test/functional/ui/decorations_spec.lua
@@ -1281,6 +1281,110 @@ if (h->n_buckets < new_n_buckets) { // expand
]]}
end)
+ it('works beyond end of the buffer with virt_lines_above', function()
+ insert(example_text)
+ feed 'G'
+
+ screen:expect{grid=[[
+ if (h->n_buckets < new_n_buckets) { // expand |
+ khkey_t *new_keys = (khkey_t *)krealloc((void *)|
+ h->keys, new_n_buckets * sizeof(khkey_t)); |
+ h->keys = new_keys; |
+ if (kh_is_map && val_size) { |
+ char *new_vals = krealloc( h->vals_buf, new_n_|
+ buckets * val_size); |
+ h->vals_buf = new_vals; |
+ } |
+ ^} |
+ {1:~ }|
+ |
+ ]]}
+
+ local id = meths.buf_set_extmark(0, ns, 8, 0, {
+ virt_lines={{{"Grugg"}}};
+ virt_lines_above = true,
+ })
+
+ screen:expect{grid=[[
+ if (h->n_buckets < new_n_buckets) { // expand |
+ khkey_t *new_keys = (khkey_t *)krealloc((void *)|
+ h->keys, new_n_buckets * sizeof(khkey_t)); |
+ h->keys = new_keys; |
+ if (kh_is_map && val_size) { |
+ char *new_vals = krealloc( h->vals_buf, new_n_|
+ buckets * val_size); |
+ h->vals_buf = new_vals; |
+ } |
+ ^} |
+ Grugg |
+ |
+ ]]}
+
+ feed('dd')
+ screen:expect{grid=[[
+ if (h->n_buckets < new_n_buckets) { // expand |
+ khkey_t *new_keys = (khkey_t *)krealloc((void *)|
+ h->keys, new_n_buckets * sizeof(khkey_t)); |
+ h->keys = new_keys; |
+ if (kh_is_map && val_size) { |
+ char *new_vals = krealloc( h->vals_buf, new_n_|
+ buckets * val_size); |
+ h->vals_buf = new_vals; |
+ ^} |
+ Grugg |
+ {1:~ }|
+ |
+ ]]}
+
+ feed('dk')
+ screen:expect{grid=[[
+ if (h->n_buckets < new_n_buckets) { // expand |
+ khkey_t *new_keys = (khkey_t *)krealloc((void *)|
+ h->keys, new_n_buckets * sizeof(khkey_t)); |
+ h->keys = new_keys; |
+ if (kh_is_map && val_size) { |
+ ^char *new_vals = krealloc( h->vals_buf, new_n_|
+ buckets * val_size); |
+ Grugg |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]]}
+
+ feed('dgg')
+ screen:expect{grid=[[
+ ^ |
+ Grugg |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ --No lines in buffer-- |
+ ]]}
+
+ meths.buf_del_extmark(0, ns, id)
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ --No lines in buffer-- |
+ ]]}
+ end)
+
it('does not cause syntax ml_get error at the end of a buffer #17816', function()
command([[syntax region foo keepend start='^foo' end='^$']])
command('syntax sync minlines=100')
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index 5e819f14a3..1a9a13f7d4 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -569,7 +569,7 @@ describe('float window', function()
end)
end)
- describe('with mulitple tabpages but only one listed buffer,', function()
+ describe('with multiple tabpages but only one listed buffer,', function()
local float_opts = {relative = 'editor', row = 1, col = 1, width = 1, height = 1}
local unlisted_buf, old_buf, old_win
before_each(function()
@@ -2761,7 +2761,7 @@ describe('float window', function()
}, "NW", 2, 1, 32, true }
}}
else
- -- note: appears misalinged due to cursor
+ -- note: appears misaligned due to cursor
screen:expect{grid=[[
^example text that is wider than the window |
{1:some info! } |
diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua
index 49b3c7a655..6fbf9b72c8 100644
--- a/test/functional/ui/inccommand_spec.lua
+++ b/test/functional/ui/inccommand_spec.lua
@@ -3047,6 +3047,43 @@ it(":substitute doesn't crash with inccommand, if undo is empty #12932", functio
assert_alive()
end)
+it(':substitute with inccommand works properly if undo is not synced #20029', function()
+ local screen = Screen.new(30, 6)
+ clear()
+ common_setup(screen, 'nosplit', 'foo\nbar\nbaz')
+ meths.set_keymap('x', '<F2>', '<Esc>`<Oaaaaa asdf<Esc>`>obbbbb asdf<Esc>V`<k:s/asdf/', {})
+ feed('gg0<C-V>lljj<F2>')
+ screen:expect([[
+ aaaaa |
+ foo |
+ bar |
+ baz |
+ bbbbb |
+ :'<,'>s/asdf/^ |
+ ]])
+ feed('hjkl')
+ screen:expect([[
+ aaaaa {12:hjkl} |
+ foo |
+ bar |
+ baz |
+ bbbbb {12:hjkl} |
+ :'<,'>s/asdf/hjkl^ |
+ ]])
+ feed('<CR>')
+ expect([[
+ aaaaa hjkl
+ foo
+ bar
+ baz
+ bbbbb hjkl]])
+ feed('u')
+ expect([[
+ foo
+ bar
+ baz]])
+end)
+
it('long :%s/ with inccommand does not collapse cmdline', function()
local screen = Screen.new(10,5)
clear()
diff --git a/test/functional/ui/inccommand_user_spec.lua b/test/functional/ui/inccommand_user_spec.lua
index 0b25d4f8d2..43e9b94feb 100644
--- a/test/functional/ui/inccommand_user_spec.lua
+++ b/test/functional/ui/inccommand_user_spec.lua
@@ -220,7 +220,7 @@ local setup_replace_cmd = [[
end
-- ":<range>Replace <pat1> <pat2>"
- -- Replaces all occurences of <pat1> in <range> with <pat2>
+ -- Replaces all occurrences of <pat1> in <range> with <pat2>
vim.api.nvim_create_user_command(
'Replace',
replace,
diff --git a/test/functional/ui/options_spec.lua b/test/functional/ui/options_spec.lua
index bd0d2104db..6f9cea8f24 100644
--- a/test/functional/ui/options_spec.lua
+++ b/test/functional/ui/options_spec.lua
@@ -194,7 +194,7 @@ end)
describe('UI can set terminal option', function()
local screen
before_each(function()
- -- by default we implicity "--cmd 'set bg=light'" which ruins everything
+ -- by default we implicitly "--cmd 'set bg=light'" which ruins everything
clear{args_rm={'--cmd'}}
screen = Screen.new(20,5)
end)
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua
index 6ee9e7b393..c44e147c4d 100644
--- a/test/functional/ui/screen.lua
+++ b/test/functional/ui/screen.lua
@@ -519,7 +519,7 @@ function Screen:_wait(check, flags)
end
assert(timeout >= minimal_timeout)
- local did_miminal_timeout = false
+ local did_minimal_timeout = false
local function notification_cb(method, args)
assert(method == 'redraw', string.format(
@@ -536,7 +536,7 @@ function Screen:_wait(check, flags)
if not err then
success_seen = true
- if did_miminal_timeout then
+ if did_minimal_timeout then
self._session:stop()
end
elseif success_seen and #args > 0 then
@@ -558,7 +558,7 @@ function Screen:_wait(check, flags)
end
if not success_seen and not eof then
- did_miminal_timeout = true
+ did_minimal_timeout = true
eof = run_session(self._session, flags.request_cb, notification_cb, nil, timeout-minimal_timeout)
end
@@ -769,6 +769,7 @@ end
function Screen:_handle_grid_cursor_goto(grid, row, col)
self._cursor.grid = grid
+ assert(row >= 0 and col >= 0)
self._cursor.row = row + 1
self._cursor.col = col + 1
end
diff --git a/test/functional/ui/sign_spec.lua b/test/functional/ui/sign_spec.lua
index dbc92ca222..ff3e143126 100644
--- a/test/functional/ui/sign_spec.lua
+++ b/test/functional/ui/sign_spec.lua
@@ -2,6 +2,7 @@ local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed, command = helpers.clear, helpers.feed, helpers.command
local source = helpers.source
+local meths = helpers.meths
describe('Signs', function()
local screen
@@ -592,4 +593,88 @@ describe('Signs', function()
]])
end)
end)
+
+ it('signcolumn width is updated when removing all signs after deleting lines', function()
+ meths.buf_set_lines(0, 0, 1, true, {'a', 'b', 'c', 'd', 'e'})
+ command('sign define piet text=>>')
+ command('sign place 10001 line=1 name=piet')
+ command('sign place 10002 line=5 name=piet')
+ command('2delete')
+ command('sign unplace 10001')
+ screen:expect([[
+ {2: }a |
+ {2: }^c |
+ {2: }d |
+ >>e |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ command('sign unplace 10002')
+ screen:expect([[
+ a |
+ ^c |
+ d |
+ e |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end)
+
+ it('signcolumn width is updated when removing all signs after inserting lines', function()
+ meths.buf_set_lines(0, 0, 1, true, {'a', 'b', 'c', 'd', 'e'})
+ command('sign define piet text=>>')
+ command('sign place 10001 line=1 name=piet')
+ command('sign place 10002 line=5 name=piet')
+ command('copy .')
+ command('sign unplace 10001')
+ screen:expect([[
+ {2: }a |
+ {2: }^a |
+ {2: }b |
+ {2: }c |
+ {2: }d |
+ >>e |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ command('sign unplace 10002')
+ screen:expect([[
+ a |
+ ^a |
+ b |
+ c |
+ d |
+ e |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ end)
end)
diff --git a/test/functional/ui/spell_spec.lua b/test/functional/ui/spell_spec.lua
index de77100cc0..1aa73e7b13 100644
--- a/test/functional/ui/spell_spec.lua
+++ b/test/functional/ui/spell_spec.lua
@@ -19,6 +19,10 @@ describe("'spell'", function()
[0] = {bold=true, foreground=Screen.colors.Blue},
[1] = {special = Screen.colors.Red, undercurl = true},
[2] = {special = Screen.colors.Blue1, undercurl = true},
+ [3] = {foreground = tonumber('0x6a0dad')},
+ [4] = {foreground = Screen.colors.Magenta},
+ [5] = {bold = true, foreground = Screen.colors.SeaGreen},
+ [6] = {foreground = Screen.colors.Red},
})
end)
@@ -68,4 +72,94 @@ describe("'spell'", function()
|
]])
end)
+
+ it('"noplainbuffer" and syntax #20385', function()
+ command('set filetype=c')
+ command('syntax on')
+ command('set spell')
+ insert([[
+ #include <stdbool.h>
+ bool func(void);]])
+ screen:expect([[
+ {3:#include }{4:<stdbool.h>} |
+ {5:bool} func({5:void})^; |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ |
+ ]])
+ feed('[s')
+ screen:expect([[
+ {3:#include }{4:<stdbool.h>} |
+ {5:bool} func({5:void})^; |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {6:search hit TOP, continuing at BOTTOM} |
+ ]])
+ -- "noplainbuffer" shouldn't change spellchecking behavior with syntax enabled
+ command('set spelloptions+=noplainbuffer')
+ screen:expect_unchanged()
+ feed(']s')
+ screen:expect([[
+ {3:#include }{4:<stdbool.h>} |
+ {5:bool} func({5:void})^; |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {6:search hit BOTTOM, continuing at TOP} |
+ ]])
+ -- no spellchecking with "noplainbuffer" and syntax disabled
+ command('syntax off')
+ screen:expect([[
+ #include <stdbool.h> |
+ bool func(void)^; |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {6:search hit BOTTOM, continuing at TOP} |
+ ]])
+ feed('[s')
+ screen:expect([[
+ #include <stdbool.h> |
+ bool func(void)^; |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {6:search hit TOP, continuing at BOTTOM} |
+ ]])
+ -- everything is spellchecked without "noplainbuffer" with syntax disabled
+ command('set spelloptions&')
+ screen:expect([[
+ #include <{1:stdbool}.h> |
+ {1:bool} {1:func}(void)^; |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {6:search hit TOP, continuing at BOTTOM} |
+ ]])
+ feed(']s')
+ screen:expect([[
+ #include <{1:^stdbool}.h> |
+ {1:bool} {1:func}(void); |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {6:search hit BOTTOM, continuing at TOP} |
+ ]])
+ end)
end)
diff --git a/test/functional/vimscript/container_functions_spec.lua b/test/functional/vimscript/container_functions_spec.lua
index 04a3248c49..5bef3fce05 100644
--- a/test/functional/vimscript/container_functions_spec.lua
+++ b/test/functional/vimscript/container_functions_spec.lua
@@ -8,7 +8,7 @@ local clear = helpers.clear
before_each(clear)
describe('extend()', function()
- it('suceeds to extend list with itself', function()
+ it('succeeds to extend list with itself', function()
meths.set_var('l', {1, {}})
eq({1, {}, 1, {}}, eval('extend(l, l)'))
eq({1, {}, 1, {}}, meths.get_var('l'))
diff --git a/test/functional/vimscript/json_functions_spec.lua b/test/functional/vimscript/json_functions_spec.lua
index 5d1597f53d..70d0934756 100644
--- a/test/functional/vimscript/json_functions_spec.lua
+++ b/test/functional/vimscript/json_functions_spec.lua
@@ -343,7 +343,7 @@ describe('json_decode() function', function()
exc_exec('call json_decode("\\t\\"abc\\\\u0000")'))
end)
- it('fails to parse unknown escape sequnces', function()
+ it('fails to parse unknown escape sequences', function()
eq('Vim(call):E474: Unknown escape sequence: \\a"',
exc_exec('call json_decode("\\t\\"\\\\a\\"")'))
end)
diff --git a/test/functional/vimscript/map_functions_spec.lua b/test/functional/vimscript/map_functions_spec.lua
index ed1863754a..8645b1e506 100644
--- a/test/functional/vimscript/map_functions_spec.lua
+++ b/test/functional/vimscript/map_functions_spec.lua
@@ -176,15 +176,12 @@ describe('mapset()', function()
it('can restore mapping description from the dict returned by maparg()', function()
meths.set_keymap('n', 'lhs', 'rhs', {desc = 'map description'})
- eq('\nn lhs rhs\n map description',
- helpers.exec_capture("nmap lhs"))
+ eq('\nn lhs rhs\n map description', exec_capture("nmap lhs"))
local mapargs = funcs.maparg('lhs', 'n', false, true)
meths.set_keymap('n', 'lhs', 'rhs', {desc = 'MAP DESCRIPTION'})
- eq('\nn lhs rhs\n MAP DESCRIPTION',
- helpers.exec_capture("nmap lhs"))
+ eq('\nn lhs rhs\n MAP DESCRIPTION', exec_capture("nmap lhs"))
funcs.mapset('n', false, mapargs)
- eq('\nn lhs rhs\n map description',
- helpers.exec_capture("nmap lhs"))
+ eq('\nn lhs rhs\n map description', exec_capture("nmap lhs"))
end)
it('can restore "replace_keycodes" from the dict returned by maparg()', function()