mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
Compare commits
169 Commits
b032c2b53f
...
v0.10.1
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7e194f0d0c | ||
![]() |
70f7708cdf | ||
![]() |
0d293e4315 | ||
![]() |
ffc457a1dc | ||
![]() |
575136c178 | ||
![]() |
f77db12995 | ||
![]() |
18a9ae169e | ||
![]() |
804a94d300 | ||
![]() |
0389472961 | ||
![]() |
9fd6664ba7 | ||
![]() |
5cdf0c22bd | ||
![]() |
4150e5e6fd | ||
![]() |
8c88f402e1 | ||
![]() |
3d319092d5 | ||
![]() |
6527f5e2d2 | ||
![]() |
ad55ec350c | ||
![]() |
125b253e7b | ||
![]() |
b01202df15 | ||
![]() |
d6437e2ca5 | ||
![]() |
97be9d8563 | ||
![]() |
2fb69ccaf7 | ||
![]() |
0e81c62405 | ||
![]() |
68513c2a89 | ||
![]() |
eb53aba5af | ||
![]() |
e13f03af85 | ||
![]() |
24fa65a500 | ||
![]() |
b94b341ef2 | ||
![]() |
410f43c0ae | ||
![]() |
677eb23c38 | ||
![]() |
a03cc83bfb | ||
![]() |
a333847f6b | ||
![]() |
6136326d63 | ||
![]() |
7400f9dfe5 | ||
![]() |
2ae8bb7b96 | ||
![]() |
19787d6057 | ||
![]() |
f654a30093 | ||
![]() |
29fd7432fd | ||
![]() |
b2587a0665 | ||
![]() |
891cc78179 | ||
![]() |
94aacc2695 | ||
![]() |
ceb82a9396 | ||
![]() |
bddbbd874c | ||
![]() |
576363a0fb | ||
![]() |
c467bfeb93 | ||
![]() |
4ce293c2c3 | ||
![]() |
fde5718e62 | ||
![]() |
a430944ea7 | ||
![]() |
7c055bd74b | ||
![]() |
113e5a91de | ||
![]() |
07de890de6 | ||
![]() |
ae9aa58f9c | ||
![]() |
7582d4a7b5 | ||
![]() |
8c00651131 | ||
![]() |
ba90b54301 | ||
![]() |
46d2906332 | ||
![]() |
978b63a9f1 | ||
![]() |
cb9ccedf04 | ||
![]() |
33121f1eae | ||
![]() |
24ee2e7c74 | ||
![]() |
8fe17036ba | ||
![]() |
63ff7338ea | ||
![]() |
f39fb4c11e | ||
![]() |
b397b5672c | ||
![]() |
bc1e168e49 | ||
![]() |
c35e040b7e | ||
![]() |
ab2d243fd0 | ||
![]() |
5cad641848 | ||
![]() |
f89d4ee6ce | ||
![]() |
d6a73d7314 | ||
![]() |
2d7aab623e | ||
![]() |
28a5923aea | ||
![]() |
65776124b1 | ||
![]() |
2845d05569 | ||
![]() |
356ddb1305 | ||
![]() |
803cc08c17 | ||
![]() |
91e337a477 | ||
![]() |
f76d0dc91e | ||
![]() |
35f6425207 | ||
![]() |
9c6efd0a65 | ||
![]() |
259a620eb8 | ||
![]() |
3b8d0721af | ||
![]() |
eadc4e03a2 | ||
![]() |
17fe405adc | ||
![]() |
f82d7b8200 | ||
![]() |
b16fe558ae | ||
![]() |
34cc49bd72 | ||
![]() |
ad82e11eb7 | ||
![]() |
db65017e60 | ||
![]() |
2eafe248c4 | ||
![]() |
3725db69ef | ||
![]() |
9f2aec2629 | ||
![]() |
f7d8650616 | ||
![]() |
446b05f85a | ||
![]() |
891b235df0 | ||
![]() |
1ab52dff9a | ||
![]() |
0827279ff5 | ||
![]() |
77b0970cda | ||
![]() |
643d6af451 | ||
![]() |
4d9114d3ab | ||
![]() |
a784b901be | ||
![]() |
0608444447 | ||
![]() |
981548b7f7 | ||
![]() |
728f6c7c83 | ||
![]() |
18a36d3d9f | ||
![]() |
8a8c3ed4dc | ||
![]() |
aa1321801d | ||
![]() |
0ee3147bc7 | ||
![]() |
46c2962b3a | ||
![]() |
b6b2272573 | ||
![]() |
dfff482efe | ||
![]() |
8dece36427 | ||
![]() |
7055cd1238 | ||
![]() |
f1fba12803 | ||
![]() |
1fe1f8556e | ||
![]() |
94d8f6bde8 | ||
![]() |
f03348472d | ||
![]() |
571e54e12c | ||
![]() |
704d33634e | ||
![]() |
4c53b9c0a1 | ||
![]() |
df6ce8377f | ||
![]() |
58e1ef2f65 | ||
![]() |
c3aef56199 | ||
![]() |
d8ff216040 | ||
![]() |
89fa1ee822 | ||
![]() |
88cd7a6cdd | ||
![]() |
fdf769fa86 | ||
![]() |
b36458b363 | ||
![]() |
b98aa783f3 | ||
![]() |
039121f5a3 | ||
![]() |
e98637e8c0 | ||
![]() |
b9e540cc70 | ||
![]() |
b322c3560b | ||
![]() |
8d1467ce9a | ||
![]() |
5d9f2d7ecc | ||
![]() |
565fccbeeb | ||
![]() |
3a354bfcaa | ||
![]() |
bec397edda | ||
![]() |
4efca7cda5 | ||
![]() |
84d7bfcf16 | ||
![]() |
777e15fa61 | ||
![]() |
ebc6c38cde | ||
![]() |
bf16fe3f01 | ||
![]() |
28f03205be | ||
![]() |
7e878da7dd | ||
![]() |
21b21b94e6 | ||
![]() |
e1b6187801 | ||
![]() |
bdd5871dc5 | ||
![]() |
10a16c1311 | ||
![]() |
3a727beafd | ||
![]() |
efe8a0a520 | ||
![]() |
4f0c4c3921 | ||
![]() |
4e9864147a | ||
![]() |
89f29fcc92 | ||
![]() |
671073e714 | ||
![]() |
dffadc392e | ||
![]() |
1e62f8e15c | ||
![]() |
8e239ed9ea | ||
![]() |
6a1c0e9574 | ||
![]() |
d6756fc0a5 | ||
![]() |
c6ebb931d9 | ||
![]() |
9c91233a38 | ||
![]() |
81560bbdbf | ||
![]() |
9a2760a01f | ||
![]() |
5eaae797af | ||
![]() |
ea6b2b78bd | ||
![]() |
0cf7e2570c | ||
![]() |
902980edb9 | ||
![]() |
6802db7aa1 | ||
![]() |
d90ee70897 |
26
.github/workflows/backport.yml
vendored
26
.github/workflows/backport.yml
vendored
@@ -12,25 +12,17 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/create-github-app-token@v1
|
||||
id: app-token
|
||||
with:
|
||||
app-id: ${{ vars.BACKPORT_APP }}
|
||||
private-key: ${{ secrets.BACKPORT_KEY }}
|
||||
|
||||
- name: Create backport PR
|
||||
id: backport
|
||||
uses: korthout/backport-action@v2
|
||||
uses: korthout/backport-action@v3
|
||||
with:
|
||||
pull_title: "${pull_title}"
|
||||
label_pattern: "^ci:backport ([^ ]+)$"
|
||||
# https://github.com/korthout/backport-action/pull/399
|
||||
experimental: >
|
||||
{
|
||||
"detect_merge_method": true
|
||||
}
|
||||
|
||||
- if: ${{steps.backport.outputs.was_successful == 'true'}}
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
github.rest.issues.addLabels({
|
||||
issue_number: ${{steps.backport.outputs.created_pull_numbers}},
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
labels: ['backport']
|
||||
})
|
||||
github_token: ${{ steps.app-token.outputs.token }}
|
||||
|
33
.github/workflows/build_dummy.yml
vendored
Normal file
33
.github/workflows/build_dummy.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
name: build_dummy
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- 'master'
|
||||
- 'release-[0-9]+.[0-9]+'
|
||||
# This needs to be an exact complement of `paths` in the build.yml workflow.
|
||||
# This is required to bypass required checks since a required job is always
|
||||
# needed to run.
|
||||
paths-ignore:
|
||||
- '**.cmake'
|
||||
- '**/CMakeLists.txt'
|
||||
- '**/CMakePresets.json'
|
||||
- 'cmake.*/**'
|
||||
- '.github/**'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
old-cmake:
|
||||
name: Test oldest supported cmake
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- run: echo "success"
|
||||
|
||||
use-existing-src:
|
||||
name: Test USE_EXISTING_SRC_DIR=ON builds with no network access
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "success"
|
7
.github/workflows/docs.yml
vendored
7
.github/workflows/docs.yml
vendored
@@ -2,13 +2,6 @@ name: docs
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
paths:
|
||||
- 'src/nvim/api/*.[ch]'
|
||||
- 'src/nvim/eval.lua'
|
||||
- 'runtime/lua/**.lua'
|
||||
- 'runtime/doc/**'
|
||||
- 'scripts/gen_vimdoc.py'
|
||||
- 'scripts/gen_help_html.lua'
|
||||
jobs:
|
||||
docs:
|
||||
runs-on: ubuntu-latest
|
||||
|
19
.github/workflows/labeler_pr.yml
vendored
19
.github/workflows/labeler_pr.yml
vendored
@@ -33,8 +33,25 @@ jobs:
|
||||
- name: "Extract if the PR is a breaking change and add it as label"
|
||||
run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|[[:alpha:]]+(\(.*\))?!:.*|breaking-change|')" || true
|
||||
|
||||
request-reviewer:
|
||||
target-release:
|
||||
needs: ["changed-files", "type-scope"]
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- if: startsWith(github.base_ref, 'release')
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
github.rest.issues.addLabels({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
labels: ['target:release']
|
||||
})
|
||||
|
||||
request-reviewer:
|
||||
needs: ["changed-files", "type-scope", "target-release"]
|
||||
permissions:
|
||||
pull-requests: write
|
||||
uses: ./.github/workflows/reviewers_add.yml
|
||||
|
2
.github/workflows/lintcommit.yml
vendored
2
.github/workflows/lintcommit.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: "lintcommit"
|
||||
name: lintcommit
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
|
16
.github/workflows/lintcommit_dummy.yml
vendored
Normal file
16
.github/workflows/lintcommit_dummy.yml
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
# Dummy workflow of lintcommit.yml. lintcommit is a required check, but it's
|
||||
# only designed to work on master. Since required checks are always required to
|
||||
# run, we can essentially "skip" the lintcommit on release branches with this
|
||||
# dummy check that automatically passes.
|
||||
name: lintcommit_dummy
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
branches:
|
||||
- 'release-[0-9]+.[0-9]+'
|
||||
jobs:
|
||||
lint-commits:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.pull_request.draft == false
|
||||
steps:
|
||||
- run: echo "success"
|
21
.github/workflows/test.yml
vendored
21
.github/workflows/test.yml
vendored
@@ -8,8 +8,6 @@ on:
|
||||
branches:
|
||||
- 'master'
|
||||
- 'release-[0-9]+.[0-9]+'
|
||||
paths-ignore:
|
||||
- 'contrib/**'
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
@@ -95,18 +93,23 @@ jobs:
|
||||
- run: cmake --build build --target clang-analyzer
|
||||
|
||||
posix:
|
||||
name: ${{ matrix.build.runner }} ${{ matrix.build.flavor }} ${{ matrix.build.cc }} ${{ matrix.test }}
|
||||
name: ${{ matrix.build.os }} ${{ matrix.build.flavor }} ${{ matrix.build.cc }} ${{ matrix.test }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# The `os` field is not needed to differentiate between the different
|
||||
# matrix builds. It is needed to not change the required checks (which
|
||||
# uses jobs names) each time we bump the runner version. It may be
|
||||
# possible to remove if we e.g. start using `-latest` runner versions
|
||||
# or if github introduces a wildcard for required checks in the future.
|
||||
build:
|
||||
[
|
||||
{ runner: ubuntu-22.04, flavor: asan, cc: clang, flags: -D ENABLE_ASAN_UBSAN=ON },
|
||||
{ runner: ubuntu-22.04, flavor: tsan, cc: clang, flags: -D ENABLE_TSAN=ON },
|
||||
{ runner: ubuntu-22.04, cc: gcc },
|
||||
{ runner: macos-12, cc: clang, flags: -D CMAKE_FIND_FRAMEWORK=NEVER, deps_flags: -D CMAKE_FIND_FRAMEWORK=NEVER },
|
||||
{ runner: macos-14, cc: clang, flags: -D CMAKE_FIND_FRAMEWORK=NEVER, deps_flags: -D CMAKE_FIND_FRAMEWORK=NEVER },
|
||||
{ runner: ubuntu-22.04, flavor: puc-lua, cc: gcc, deps_flags: -D USE_BUNDLED_LUAJIT=OFF -D USE_BUNDLED_LUA=ON, flags: -D PREFER_LUA=ON },
|
||||
{ runner: ubuntu-22.04, os: ubuntu, flavor: asan, cc: clang, flags: -D ENABLE_ASAN_UBSAN=ON },
|
||||
{ runner: ubuntu-22.04, os: ubuntu, flavor: tsan, cc: clang, flags: -D ENABLE_TSAN=ON },
|
||||
{ runner: ubuntu-22.04, os: ubuntu, cc: gcc },
|
||||
{ runner: macos-12, os: macos, flavor: 12, cc: clang, flags: -D CMAKE_FIND_FRAMEWORK=NEVER, deps_flags: -D CMAKE_FIND_FRAMEWORK=NEVER },
|
||||
{ runner: macos-14, os: macos, cc: clang, flags: -D CMAKE_FIND_FRAMEWORK=NEVER, deps_flags: -D CMAKE_FIND_FRAMEWORK=NEVER },
|
||||
{ runner: ubuntu-22.04, os: ubuntu, flavor: puc-lua, cc: gcc, deps_flags: -D USE_BUNDLED_LUAJIT=OFF -D USE_BUNDLED_LUA=ON, flags: -D PREFER_LUA=ON },
|
||||
]
|
||||
test: [unittest, functionaltest, oldtest]
|
||||
exclude:
|
||||
|
2
BUILD.md
2
BUILD.md
@@ -240,7 +240,7 @@ cmake --build build
|
||||
### How to build without "bundled" dependencies
|
||||
|
||||
1. Manually install the dependencies:
|
||||
- libuv libluv libvterm luajit lua-lpeg lua-mpack msgpack-c tree-sitter tree-sitter-bash tree-sitter-c tree-sitter-lua tree-sitter-markdown tree-sitter-python tree-sitter-query tree-sitter-vim tree-sitter-vimdoc unibilium
|
||||
- libuv libluv libvterm luajit lua-lpeg lua-mpack msgpack-c tree-sitter tree-sitter-c tree-sitter-lua tree-sitter-markdown tree-sitter-query tree-sitter-vim tree-sitter-vimdoc unibilium
|
||||
2. Run CMake:
|
||||
```sh
|
||||
cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo
|
||||
|
@@ -39,6 +39,12 @@ include(InstallHelpers)
|
||||
include(PreventInTreeBuilds)
|
||||
include(Util)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# User settings
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
set(DEPS_IGNORE_SHA FALSE)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Variables
|
||||
#-------------------------------------------------------------------------------
|
||||
@@ -47,9 +53,6 @@ set(TOUCHES_DIR ${PROJECT_BINARY_DIR}/touches)
|
||||
|
||||
file(GLOB DOCFILES CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/runtime/doc/*.txt)
|
||||
|
||||
set_directory_properties(PROPERTIES
|
||||
EP_PREFIX "${DEPS_BUILD_DIR}")
|
||||
|
||||
if(NOT CI_BUILD)
|
||||
set(CMAKE_INSTALL_MESSAGE NEVER)
|
||||
endif()
|
||||
@@ -142,7 +145,7 @@ endif()
|
||||
# version string, else they are combined with the result of `git describe`.
|
||||
set(NVIM_VERSION_MAJOR 0)
|
||||
set(NVIM_VERSION_MINOR 10)
|
||||
set(NVIM_VERSION_PATCH 0)
|
||||
set(NVIM_VERSION_PATCH 1)
|
||||
set(NVIM_VERSION_PRERELEASE "") # for package maintainers
|
||||
|
||||
# API level
|
||||
@@ -241,7 +244,7 @@ add_glob_target(
|
||||
GLOB_DIRS runtime scripts src test
|
||||
GLOB_PAT *.lua
|
||||
TOUCH_STRATEGY PER_DIR)
|
||||
add_dependencies(lintlua-luacheck lua-dev-deps)
|
||||
add_dependencies(lintlua-luacheck lua_dev_deps)
|
||||
|
||||
add_glob_target(
|
||||
TARGET lintlua-stylua
|
||||
@@ -300,26 +303,24 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
add_subdirectory(cmake.packaging)
|
||||
endif()
|
||||
|
||||
get_externalproject_options(uncrustify ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(uncrustify
|
||||
URL https://github.com/uncrustify/uncrustify/archive/uncrustify-0.79.0.tar.gz
|
||||
URL_HASH SHA256=e7afaeabf636b7f0ce4e3e9747b95f7bd939613a8db49579755dddf44fedca5f
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/uncrustify
|
||||
CMAKE_ARGS ${DEPS_CMAKE_ARGS}
|
||||
EXCLUDE_FROM_ALL TRUE
|
||||
DOWNLOAD_NO_PROGRESS TRUE)
|
||||
${EXTERNALPROJECT_OPTIONS})
|
||||
|
||||
option(USE_BUNDLED_BUSTED "Use bundled busted" ON)
|
||||
if(USE_BUNDLED_BUSTED)
|
||||
ExternalProject_Add(lua-dev-deps
|
||||
URL https://github.com/neovim/deps/raw/5a1f71cceb24990a0b15fd9a472a5f549f019248/opt/lua-dev-deps.tar.gz
|
||||
URL_HASH SHA256=27db2495f5eddc7fc191701ec9b291486853530c6125609d3197d03481e8d5a2
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/lua-dev-deps
|
||||
get_externalproject_options(lua_dev_deps ${DEPS_IGNORE_SHA})
|
||||
ExternalProject_Add(lua_dev_deps
|
||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/lua_dev_deps
|
||||
SOURCE_DIR ${DEPS_SHARE_DIR}
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
EXCLUDE_FROM_ALL TRUE
|
||||
DOWNLOAD_NO_PROGRESS TRUE)
|
||||
${EXTERNALPROJECT_OPTIONS})
|
||||
else()
|
||||
add_custom_target(lua-dev-deps)
|
||||
add_custom_target(lua_dev_deps)
|
||||
endif()
|
||||
|
@@ -55,12 +55,12 @@ Several Neovim GUIs are available from scoop (extras): [scoop.sh/#/apps?q=neovim
|
||||
1. Choose a package (**nvim-winXX.zip**) from the [releases page](https://github.com/neovim/neovim/releases).
|
||||
2. Unzip the package. Any location is fine, administrator privileges are _not_ required.
|
||||
- `$VIMRUNTIME` will be set to that location automatically.
|
||||
3. Double-click `nvim-qt.exe`.
|
||||
3. Run `nvim.exe` from a terminal.
|
||||
|
||||
**Optional** steps:
|
||||
|
||||
- Add the `bin` folder (e.g. `C:\Program Files\nvim\bin`) to your PATH.
|
||||
- This makes it easy to run `nvim` and `nvim-qt` from anywhere.
|
||||
- This makes it easy to run `nvim` from anywhere.
|
||||
- If `:set spell` does not work, create the `C:/Users/foo/AppData/Local/nvim/site/spell` folder.
|
||||
You can then copy your spell files over (for English, located
|
||||
[here](https://github.com/vim/vim/blob/master/runtime/spell/en.utf-8.spl) and
|
||||
|
@@ -74,25 +74,6 @@ if(APPLE)
|
||||
message(STATUS "Using deployment target ${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||
endif()
|
||||
|
||||
set_directory_properties(PROPERTIES
|
||||
EP_PREFIX "${DEPS_BUILD_DIR}"
|
||||
CMAKE_CONFIGURE_DEPENDS deps.txt)
|
||||
|
||||
file(READ deps.txt DEPENDENCIES)
|
||||
STRING(REGEX REPLACE "\n" ";" DEPENDENCIES "${DEPENDENCIES}")
|
||||
foreach(dep ${DEPENDENCIES})
|
||||
STRING(REGEX REPLACE " " ";" dep "${dep}")
|
||||
list(GET dep 0 name)
|
||||
list(GET dep 1 value)
|
||||
if(NOT ${name})
|
||||
# _URL variables must NOT be set when USE_EXISTING_SRC_DIR is set,
|
||||
# otherwise ExternalProject will try to re-download the sources.
|
||||
if(NOT USE_EXISTING_SRC_DIR)
|
||||
set(${name} ${value})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(USE_BUNDLED_LUAJIT)
|
||||
set(LUA_ENGINE LuaJit)
|
||||
elseif(USE_BUNDLED_LUA)
|
||||
|
@@ -28,7 +28,7 @@ function(BuildTSParser)
|
||||
${EXTERNALPROJECT_OPTIONS})
|
||||
endfunction()
|
||||
|
||||
foreach(lang c lua vim vimdoc query python bash)
|
||||
foreach(lang c lua vim vimdoc query)
|
||||
BuildTSParser(LANG ${lang})
|
||||
endforeach()
|
||||
BuildTSParser(LANG markdown CMAKE_FILE MarkdownParserCMakeLists.txt)
|
||||
|
@@ -41,21 +41,22 @@ GETTEXT_SHA256 66415634c6e8c3fa8b71362879ec7575e27da43da562c798a8a2f223e6e47f5c
|
||||
LIBICONV_URL https://github.com/neovim/deps/raw/b9bf36eb31f27e8136d907da38fa23518927737e/opt/libiconv-1.17.tar.gz
|
||||
LIBICONV_SHA256 8f74213b56238c85a50a5329f77e06198771e70dd9a739779f4c02f65d971313
|
||||
|
||||
TREESITTER_C_URL https://github.com/tree-sitter/tree-sitter-c/archive/v0.21.0.tar.gz
|
||||
TREESITTER_C_SHA256 6f0f5d1b71cf8ffd8a37fb638c6022fa1245bd630150b538547d52128ce0ea7e
|
||||
TREESITTER_C_URL https://github.com/tree-sitter/tree-sitter-c/archive/v0.21.3.tar.gz
|
||||
TREESITTER_C_SHA256 75a3780df6114cd37496761c4a7c9fd900c78bee3a2707f590d78c0ca3a24368
|
||||
TREESITTER_LUA_URL https://github.com/tree-sitter-grammars/tree-sitter-lua/archive/v0.1.0.tar.gz
|
||||
TREESITTER_LUA_SHA256 230cfcbfa74ed1f7b8149e9a1f34c2efc4c589a71fe0f5dc8560622f8020d722
|
||||
TREESITTER_VIM_URL https://github.com/neovim/tree-sitter-vim/archive/v0.4.0.tar.gz
|
||||
TREESITTER_VIM_SHA256 9f856f8b4a10ab43348550fa2d3cb2846ae3d8e60f45887200549c051c66f9d5
|
||||
TREESITTER_VIMDOC_URL https://github.com/neovim/tree-sitter-vimdoc/archive/v2.5.1.tar.gz
|
||||
TREESITTER_VIMDOC_SHA256 063645096504b21603585507c41c6d8718ff3c11b2150c5bfc31e8f3ee9afea3
|
||||
TREESITTER_QUERY_URL https://github.com/tree-sitter-grammars/tree-sitter-query/archive/v0.3.0.tar.gz
|
||||
TREESITTER_QUERY_SHA256 f878ff37abcb83250e31a6569e997546f3dbab74dcb26683cb2d613f7568cfc0
|
||||
TREESITTER_PYTHON_URL https://github.com/tree-sitter/tree-sitter-python/archive/v0.21.0.tar.gz
|
||||
TREESITTER_PYTHON_SHA256 720304a603271fa89e4430a14d6a81a023d6d7d1171b1533e49c0ab44f1e1c13
|
||||
TREESITTER_BASH_URL https://github.com/tree-sitter/tree-sitter-bash/archive/v0.21.0.tar.gz
|
||||
TREESITTER_BASH_SHA256 f0515efda839cfede851adb24ac154227fbc0dfb60c6c11595ecfa9087d43ceb
|
||||
TREESITTER_VIMDOC_URL https://github.com/neovim/tree-sitter-vimdoc/archive/v3.0.0.tar.gz
|
||||
TREESITTER_VIMDOC_SHA256 a639bf92bf57bfa1cdc90ca16af27bfaf26a9779064776dd4be34c1ef1453f6c
|
||||
TREESITTER_QUERY_URL https://github.com/tree-sitter-grammars/tree-sitter-query/archive/v0.4.0.tar.gz
|
||||
TREESITTER_QUERY_SHA256 d3a423ab66dc62b2969625e280116678a8a22582b5ff087795222108db2f6a6e
|
||||
TREESITTER_MARKDOWN_URL https://github.com/MDeiml/tree-sitter-markdown/archive/v0.2.3.tar.gz
|
||||
TREESITTER_MARKDOWN_SHA256 4909d6023643f1afc3ab219585d4035b7403f3a17849782ab803c5f73c8a31d5
|
||||
TREESITTER_URL https://github.com/tree-sitter/tree-sitter/archive/v0.22.6.tar.gz
|
||||
TREESITTER_SHA256 e2b687f74358ab6404730b7fb1a1ced7ddb3780202d37595ecd7b20a8f41861f
|
||||
|
||||
UNCRUSTIFY_URL https://github.com/uncrustify/uncrustify/archive/uncrustify-0.79.0.tar.gz
|
||||
UNCRUSTIFY_SHA256 e7afaeabf636b7f0ce4e3e9747b95f7bd939613a8db49579755dddf44fedca5f
|
||||
LUA_DEV_DEPS_URL https://github.com/neovim/deps/raw/5a1f71cceb24990a0b15fd9a472a5f549f019248/opt/lua-dev-deps.tar.gz
|
||||
LUA_DEV_DEPS_SHA256 27db2495f5eddc7fc191701ec9b291486853530c6125609d3197d03481e8d5a2
|
||||
|
@@ -6,7 +6,7 @@
|
||||
Name='PATH'
|
||||
Action='set'
|
||||
Permanent='no'
|
||||
System='no'
|
||||
System='yes'
|
||||
Part='last'
|
||||
Value='[INSTALL_ROOT]bin'
|
||||
/>
|
||||
|
@@ -58,6 +58,32 @@ if(CMAKE_OSX_SYSROOT)
|
||||
set(DEPS_C_COMPILER "${DEPS_C_COMPILER} -isysroot${CMAKE_OSX_SYSROOT}")
|
||||
endif()
|
||||
|
||||
get_filename_component(rootdir ${PROJECT_SOURCE_DIR} NAME)
|
||||
if(${rootdir} MATCHES "cmake.deps")
|
||||
set(depsfile ${PROJECT_SOURCE_DIR}/deps.txt)
|
||||
else()
|
||||
set(depsfile ${PROJECT_SOURCE_DIR}/cmake.deps/deps.txt)
|
||||
endif()
|
||||
|
||||
set_directory_properties(PROPERTIES
|
||||
EP_PREFIX "${DEPS_BUILD_DIR}"
|
||||
CMAKE_CONFIGURE_DEPENDS ${depsfile})
|
||||
|
||||
file(READ ${depsfile} DEPENDENCIES)
|
||||
STRING(REGEX REPLACE "\n" ";" DEPENDENCIES "${DEPENDENCIES}")
|
||||
foreach(dep ${DEPENDENCIES})
|
||||
STRING(REGEX REPLACE " " ";" dep "${dep}")
|
||||
list(GET dep 0 name)
|
||||
list(GET dep 1 value)
|
||||
if(NOT ${name})
|
||||
# _URL variables must NOT be set when USE_EXISTING_SRC_DIR is set,
|
||||
# otherwise ExternalProject will try to re-download the sources.
|
||||
if(NOT USE_EXISTING_SRC_DIR)
|
||||
set(${name} ${value})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
function(get_externalproject_options name DEPS_IGNORE_SHA)
|
||||
string(TOUPPER ${name} name_allcaps)
|
||||
set(url ${${name_allcaps}_URL})
|
||||
|
@@ -2820,7 +2820,7 @@ nvim_set_decoration_provider({ns_id}, {opts})
|
||||
Note: this function should not be called often. Rather, the callbacks
|
||||
themselves can be used to throttle unneeded callbacks. the `on_start`
|
||||
callback can return `false` to disable the provider until the next redraw.
|
||||
Similarly, return `false` in `on_win` will skip the `on_lines` calls for
|
||||
Similarly, return `false` in `on_win` will skip the `on_line` calls for
|
||||
that window (but any extmarks set in `on_win` will still be used). A
|
||||
plugin managing multiple sources of decoration should ideally only set one
|
||||
provider, and merge the sources internally. You can use multiple `ns_id`
|
||||
@@ -2829,10 +2829,10 @@ nvim_set_decoration_provider({ns_id}, {opts})
|
||||
Note: doing anything other than setting extmarks is considered
|
||||
experimental. Doing things like changing options are not explicitly
|
||||
forbidden, but is likely to have unexpected consequences (such as 100% CPU
|
||||
consumption). doing `vim.rpcnotify` should be OK, but `vim.rpcrequest` is
|
||||
consumption). Doing `vim.rpcnotify` should be OK, but `vim.rpcrequest` is
|
||||
quite dubious for the moment.
|
||||
|
||||
Note: It is not allowed to remove or update extmarks in 'on_line'
|
||||
Note: It is not allowed to remove or update extmarks in `on_line`
|
||||
callbacks.
|
||||
|
||||
Attributes: ~
|
||||
|
40
runtime/doc/builtin.txt
generated
40
runtime/doc/builtin.txt
generated
@@ -2963,8 +2963,8 @@ getregion({pos1}, {pos2} [, {opts}]) *getregion()*
|
||||
difference if the buffer is displayed in a window with
|
||||
different 'virtualedit' or 'list' values.
|
||||
|
||||
Examples: >
|
||||
:xnoremap <CR>
|
||||
Examples: >vim
|
||||
xnoremap <CR>
|
||||
\ <Cmd>echom getregion(
|
||||
\ getpos('v'), getpos('.'), #{ type: mode() })<CR>
|
||||
<
|
||||
@@ -3507,7 +3507,7 @@ id({expr}) *id()*
|
||||
Note that `v:_null_string`, `v:_null_list`, `v:_null_dict` and
|
||||
`v:_null_blob` have the same `id()` with different types
|
||||
because they are internally represented as NULL pointers.
|
||||
`id()` returns a hexadecimal representanion of the pointers to
|
||||
`id()` returns a hexadecimal representation of the pointers to
|
||||
the containers (i.e. like `0x994a40`), same as `printf("%p",
|
||||
{expr})`, but it is advised against counting on the exact
|
||||
format of the return value.
|
||||
@@ -4597,19 +4597,19 @@ matchbufline({buf}, {pat}, {lnum}, {end}, [, {dict}]) *matchbufline()*
|
||||
|
||||
Examples: >vim
|
||||
" Assuming line 3 in buffer 5 contains "a"
|
||||
:echo matchbufline(5, '\<\k\+\>', 3, 3)
|
||||
[{'lnum': 3, 'byteidx': 0, 'text': 'a'}]
|
||||
echo matchbufline(5, '\<\k\+\>', 3, 3)
|
||||
< `[{'lnum': 3, 'byteidx': 0, 'text': 'a'}]` >vim
|
||||
" Assuming line 4 in buffer 10 contains "tik tok"
|
||||
:echo matchbufline(10, '\<\k\+\>', 1, 4)
|
||||
[{'lnum': 4, 'byteidx': 0, 'text': 'tik'}, {'lnum': 4, 'byteidx': 4, 'text': 'tok'}]
|
||||
<
|
||||
echo matchbufline(10, '\<\k\+\>', 1, 4)
|
||||
< `[{'lnum': 4, 'byteidx': 0, 'text': 'tik'}, {'lnum': 4, 'byteidx': 4, 'text': 'tok'}]`
|
||||
|
||||
If {submatch} is present and is v:true, then submatches like
|
||||
"\1", "\2", etc. are also returned. Example: >vim
|
||||
" Assuming line 2 in buffer 2 contains "acd"
|
||||
:echo matchbufline(2, '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2, 2
|
||||
echo matchbufline(2, '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2, 2
|
||||
\ {'submatches': v:true})
|
||||
[{'lnum': 2, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]
|
||||
< The "submatches" List always contains 9 items. If a submatch
|
||||
< `[{'lnum': 2, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]`
|
||||
The "submatches" List always contains 9 items. If a submatch
|
||||
is not found, then an empty string is returned for that
|
||||
submatch.
|
||||
|
||||
@@ -4769,17 +4769,17 @@ matchstrlist({list}, {pat} [, {dict}]) *matchstrlist()*
|
||||
option settings on the pattern.
|
||||
|
||||
Example: >vim
|
||||
:echo matchstrlist(['tik tok'], '\<\k\+\>')
|
||||
[{'idx': 0, 'byteidx': 0, 'text': 'tik'}, {'idx': 0, 'byteidx': 4, 'text': 'tok'}]
|
||||
:echo matchstrlist(['a', 'b'], '\<\k\+\>')
|
||||
[{'idx': 0, 'byteidx': 0, 'text': 'a'}, {'idx': 1, 'byteidx': 0, 'text': 'b'}]
|
||||
<
|
||||
echo matchstrlist(['tik tok'], '\<\k\+\>')
|
||||
< `[{'idx': 0, 'byteidx': 0, 'text': 'tik'}, {'idx': 0, 'byteidx': 4, 'text': 'tok'}]` >vim
|
||||
echo matchstrlist(['a', 'b'], '\<\k\+\>')
|
||||
< `[{'idx': 0, 'byteidx': 0, 'text': 'a'}, {'idx': 1, 'byteidx': 0, 'text': 'b'}]`
|
||||
|
||||
If "submatches" is present and is v:true, then submatches like
|
||||
"\1", "\2", etc. are also returned. Example: >vim
|
||||
:echo matchstrlist(['acd'], '\(a\)\?\(b\)\?\(c\)\?\(.*\)',
|
||||
echo matchstrlist(['acd'], '\(a\)\?\(b\)\?\(c\)\?\(.*\)',
|
||||
\ #{submatches: v:true})
|
||||
[{'idx': 0, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]
|
||||
< The "submatches" List always contains 9 items. If a submatch
|
||||
< `[{'idx': 0, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]`
|
||||
The "submatches" List always contains 9 items. If a submatch
|
||||
is not found, then an empty string is returned for that
|
||||
submatch.
|
||||
|
||||
@@ -6007,7 +6007,7 @@ screencol() *screencol()*
|
||||
the following mappings: >vim
|
||||
nnoremap <expr> GG ":echom " .. screencol() .. "\n"
|
||||
nnoremap <silent> GG :echom screencol()<CR>
|
||||
noremap GG <Cmd>echom screencol()<Cr>
|
||||
noremap GG <Cmd>echom screencol()<CR>
|
||||
<
|
||||
|
||||
screenpos({winid}, {lnum}, {col}) *screenpos()*
|
||||
|
@@ -1623,7 +1623,7 @@ There are three different types of searching:
|
||||
stop-directories are appended to the path (for the 'path' option) or to
|
||||
the filename (for the 'tags' option) with a ';'. If you want several
|
||||
stop-directories separate them with ';'. If you want no stop-directory
|
||||
("search upward till the root directory) just use ';'. >
|
||||
("search upward till the root directory") just use ';'. >
|
||||
/usr/include/sys;/usr
|
||||
< will search in: >
|
||||
/usr/include/sys
|
||||
@@ -1636,7 +1636,7 @@ There are three different types of searching:
|
||||
|
||||
If Vim's current path is /u/user_x/work/release and you do >
|
||||
:set path=include;/u/user_x
|
||||
< and then search for a file with |gf| the file is searched in: >
|
||||
< and then search for a file with |gf| the file is searched in: >
|
||||
/u/user_x/work/release/include
|
||||
/u/user_x/work/include
|
||||
/u/user_x/include
|
||||
@@ -1648,7 +1648,7 @@ There are three different types of searching:
|
||||
3) Combined up/downward search:
|
||||
If Vim's current path is /u/user_x/work/release and you do >
|
||||
set path=**;/u/user_x
|
||||
< and then search for a file with |gf| the file is searched in: >
|
||||
< and then search for a file with |gf| the file is searched in: >
|
||||
/u/user_x/work/release/**
|
||||
/u/user_x/work/**
|
||||
/u/user_x/**
|
||||
@@ -1660,10 +1660,10 @@ There are three different types of searching:
|
||||
|
||||
In the above example you might want to set path to: >
|
||||
:set path=**,/u/user_x/**
|
||||
< This searches:
|
||||
/u/user_x/work/release/** ~
|
||||
/u/user_x/** ~
|
||||
This searches the same directories, but in a different order.
|
||||
< This searches: >
|
||||
/u/user_x/work/release/**
|
||||
/u/user_x/**
|
||||
< This searches the same directories, but in a different order.
|
||||
|
||||
Note that completion for ":find", ":sfind", and ":tabfind" commands do not
|
||||
currently work with 'path' items that contain a URL or use the double star
|
||||
|
@@ -293,7 +293,7 @@ loaded by Vim: >
|
||||
ftplugin/sql.vim
|
||||
syntax/sqlinformix.vim
|
||||
indent/sql.vim
|
||||
>
|
||||
<
|
||||
Notice indent/sqlinformix.sql was not loaded. There is no indent file
|
||||
for Informix, Vim loads the default files if the specified files does not
|
||||
exist.
|
||||
@@ -349,7 +349,7 @@ The defaults static maps are: >
|
||||
The use of "<C-C>" can be user chosen by using the following in your |init.vim|
|
||||
as it may not work properly on all platforms: >
|
||||
let g:ftplugin_sql_omni_key = '<C-C>'
|
||||
>
|
||||
<
|
||||
The static maps (which are based on the syntax highlight groups) follow this
|
||||
format: >
|
||||
imap <buffer> <C-C>k <C-\><C-O>:call sqlcomplete#Map('sqlKeyword')<CR><C-X><C-O>
|
||||
@@ -664,7 +664,7 @@ your |init.vim|: >
|
||||
filetype is changed temporarily to SQL, the sqlcompletion plugin
|
||||
will cache the syntax groups listed in the List specified in this
|
||||
option.
|
||||
>
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
4.5 SQL Maps *sql-completion-maps*
|
||||
|
@@ -366,7 +366,7 @@ tag char note action in Normal mode ~
|
||||
or start of putted text
|
||||
|`]| `] 1 cursor to the end of last operated text or
|
||||
end of putted text
|
||||
|``| `` 1 cursor to the position before latest jump
|
||||
|``| "``" 1 cursor to the position before latest jump
|
||||
|`{| `{ 1 cursor to the start of the current paragraph
|
||||
|`}| `} 1 cursor to the end of the current paragraph
|
||||
|a| a 2 append text after the cursor N times
|
||||
@@ -397,7 +397,7 @@ tag char note action in Normal mode ~
|
||||
|q| q{0-9a-zA-Z"} record typed characters into named register
|
||||
{0-9a-zA-Z"} (uppercase to append)
|
||||
|q| q (while recording) stops recording
|
||||
|Q| Q replay last recorded macro
|
||||
|Q| Q 2 replay last recorded register
|
||||
|q:| q: edit : command-line in command-line window
|
||||
|q/| q/ edit / command-line in command-line window
|
||||
|q?| q? edit ? command-line in command-line window
|
||||
@@ -736,7 +736,7 @@ tag char note action in Normal mode ~
|
||||
search pattern and Visually select it
|
||||
|gP| ["x]gP 2 put the text [from register x] before the
|
||||
cursor N times, leave the cursor after it
|
||||
|gQ| gQ switch to "Ex" mode with Vim editing
|
||||
|gQ| gQ switch to "Ex" mode with Vim editing
|
||||
|gR| gR 2 enter Virtual Replace mode
|
||||
|gT| gT go to the previous tab page
|
||||
|gU| gU{motion} 2 make Nmove text uppercase
|
||||
@@ -923,7 +923,6 @@ tag command note action in Visual mode ~
|
||||
|v_O| O move horizontally to other corner of area
|
||||
|v_P| P replace highlighted area with register
|
||||
contents; registers are unchanged
|
||||
Q does not start Ex mode
|
||||
|v_R| R 2 delete the highlighted lines and start
|
||||
insert
|
||||
|v_S| S 2 delete the highlighted lines and start
|
||||
@@ -1136,7 +1135,7 @@ tag command action ~
|
||||
|:!!| :!! repeat last ":!" command
|
||||
|:#| :# same as ":number"
|
||||
|:&| :& repeat last ":substitute"
|
||||
|:star| :* use the last Visual area, like :'<,'>
|
||||
|:star| :* use the last Visual area, like ":'<,'>"
|
||||
|:<| :< shift lines one 'shiftwidth' left
|
||||
|:=| := print the last line number
|
||||
|:>| :> shift lines one 'shiftwidth' right
|
||||
|
@@ -1927,11 +1927,6 @@ These two commands will keep on asking for lines, until you type a line
|
||||
containing only a ".". Watch out for lines starting with a backslash, see
|
||||
|line-continuation|.
|
||||
|
||||
When in Ex mode (see |-e|) a backslash at the end of the line can be used to
|
||||
insert a NUL character. To be able to have a line ending in a backslash use
|
||||
two backslashes. This means that the number of backslashes is halved, but
|
||||
only at the end of the line.
|
||||
|
||||
NOTE: These commands cannot be used with |:global| or |:vglobal|.
|
||||
":append" and ":insert" don't work properly in between ":if" and
|
||||
":endif", ":for" and ":endfor", ":while" and ":endwhile".
|
||||
|
@@ -12,7 +12,7 @@ enhanced LSP tools.
|
||||
|
||||
https://microsoft.github.io/language-server-protocol/
|
||||
|
||||
LSP facilitates features like go-to-definition, find-references, hover,
|
||||
LSP facilitates features like go-to-definition, find references, hover,
|
||||
completion, rename, format, refactor, etc., using semantic whole-project
|
||||
analysis (unlike |ctags|).
|
||||
|
||||
@@ -25,26 +25,36 @@ Nvim provides an LSP client, but the servers are provided by third parties.
|
||||
Follow these steps to get LSP features:
|
||||
|
||||
1. Install language servers using your package manager or by following the
|
||||
upstream installation instruction. You can find language servers here:
|
||||
upstream installation instructions. You can find language servers here:
|
||||
https://microsoft.github.io/language-server-protocol/implementors/servers/
|
||||
|
||||
2. Configure the LSP client per language server. See |vim.lsp.start()| or use
|
||||
this minimal example as a guide: >lua
|
||||
2. Use |vim.lsp.start()| to start the LSP server (or attach to an existing
|
||||
one) when a file is opened. Example: >lua
|
||||
-- Create an event handler for the FileType autocommand
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
-- This handler will fire when the buffer's 'filetype' is "python"
|
||||
pattern = 'python',
|
||||
callback = function(ev)
|
||||
vim.lsp.start({
|
||||
name = 'my-server-name',
|
||||
cmd = {'name-of-language-server-executable', '--option', 'arg1', 'arg2'},
|
||||
|
||||
vim.lsp.start({
|
||||
name = 'my-server-name',
|
||||
cmd = {'name-of-language-server-executable'},
|
||||
root_dir = vim.fs.root(0, {'setup.py', 'pyproject.toml'}),
|
||||
-- Set the "root directory" to the parent directory of the file in the
|
||||
-- current buffer (`ev.buf`) that contains either a "setup.py" or a
|
||||
-- "pyproject.toml" file. Files that share a root directory will reuse
|
||||
-- the connection to the same LSP server.
|
||||
root_dir = vim.fs.root(ev.buf, {'setup.py', 'pyproject.toml'}),
|
||||
})
|
||||
end,
|
||||
})
|
||||
<
|
||||
3. Check that the server attached to the buffer: >
|
||||
:lua =vim.lsp.get_clients()
|
||||
3. Check that the buffer is attached to the server: >vim
|
||||
:checkhealth lsp
|
||||
|
||||
4. Configure keymaps and autocmds to use LSP features. See |lsp-config|.
|
||||
4. (Optional) Configure keymaps and autocommands to use LSP features. |lsp-config|
|
||||
|
||||
*lsp-config*
|
||||
*lsp-defaults*
|
||||
When the LSP client starts it enables diagnostics |vim.diagnostic| (see
|
||||
When the Nvim LSP client starts it enables diagnostics |vim.diagnostic| (see
|
||||
|vim.diagnostic.config()| to customize). It also sets various default options,
|
||||
listed below, if (1) the language server supports the functionality and (2)
|
||||
the options are empty or were set by the builtin runtime (ftplugin) files. The
|
||||
@@ -57,12 +67,13 @@ options are not restored when the LSP client is stopped or detached.
|
||||
|CTRL-W_}| to utilize the language server.
|
||||
- 'formatexpr' is set to |vim.lsp.formatexpr()|, so you can format lines via
|
||||
|gq| if the language server supports it.
|
||||
- To opt out of this use |gw| instead of gq, or set 'formatexpr' on LspAttach.
|
||||
- To opt out of this use |gw| instead of gq, or clear 'formatexpr' on |LspAttach|.
|
||||
- |K| is mapped to |vim.lsp.buf.hover()| unless |'keywordprg'| is customized or
|
||||
a custom keymap for `K` exists.
|
||||
|
||||
*lsp-defaults-disable*
|
||||
To override the above defaults, set or unset the options on |LspAttach|: >lua
|
||||
To override or delete any of the above defaults, set or unset the options on
|
||||
|LspAttach|: >lua
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
callback = function(ev)
|
||||
@@ -71,7 +82,8 @@ To override the above defaults, set or unset the options on |LspAttach|: >lua
|
||||
vim.keymap.del('n', 'K', { buffer = ev.buf })
|
||||
end,
|
||||
})
|
||||
|
||||
<
|
||||
*lsp-config*
|
||||
To use other LSP features, set keymaps on |LspAttach|. Not all language
|
||||
servers provide the same capabilities. To ensure you only set keymaps if the
|
||||
language server supports a feature, guard keymaps behind capability checks.
|
||||
@@ -201,26 +213,26 @@ Each response handler has this signature: >
|
||||
function(err, result, ctx, config)
|
||||
<
|
||||
Parameters: ~
|
||||
- {err} (table|nil) Error info dict, or `nil` if the request
|
||||
completed.
|
||||
- {result} (Result | Params | nil) `result` key of the |lsp-response| or
|
||||
`nil` if the request failed.
|
||||
- {ctx} (table) Table of calling state associated with the
|
||||
handler, with these keys:
|
||||
- {method} (string) |lsp-method| name.
|
||||
- {client_id} (number) |vim.lsp.Client| identifier.
|
||||
- {bufnr} (Buffer) Buffer handle.
|
||||
- {params} (table|nil) Request parameters table.
|
||||
- {version} (number) Document version at time of
|
||||
request. Handlers can compare this to the
|
||||
current document version to check if the
|
||||
response is "stale". See also |b:changedtick|.
|
||||
- {config} (table) Handler-defined configuration table, which allows
|
||||
users to customize handler behavior.
|
||||
For an example, see:
|
||||
|vim.lsp.diagnostic.on_publish_diagnostics()|
|
||||
To configure a particular |lsp-handler|, see:
|
||||
|lsp-handler-configuration|
|
||||
• {err} (`table|nil`) Error info dict, or `nil` if the request
|
||||
completed.
|
||||
• {result} (`Result|Params|nil`) `result` key of the |lsp-response| or
|
||||
`nil` if the request failed.
|
||||
• {ctx} (`table`) Table of calling state associated with the
|
||||
handler, with these keys:
|
||||
• {method} (`string`) |lsp-method| name.
|
||||
• {client_id} (`number`) |vim.lsp.Client| identifier.
|
||||
• {bufnr} (`Buffer`) Buffer handle.
|
||||
• {params} (`table|nil`) Request parameters table.
|
||||
• {version} (`number`) Document version at time of
|
||||
request. Handlers can compare this to the
|
||||
current document version to check if the
|
||||
response is "stale". See also |b:changedtick|.
|
||||
• {config} (`table`) Handler-defined configuration table, which allows
|
||||
users to customize handler behavior.
|
||||
For an example, see:
|
||||
|vim.lsp.diagnostic.on_publish_diagnostics()|
|
||||
To configure a particular |lsp-handler|, see:
|
||||
|lsp-handler-configuration|
|
||||
|
||||
Returns: ~
|
||||
Two values `result, err` where `err` is shaped like an RPC error: >
|
||||
@@ -977,7 +989,7 @@ Lua module: vim.lsp.client *lsp-client*
|
||||
if the client supports workspace folders. It
|
||||
can be `null` if the client supports workspace
|
||||
folders but none are configured.
|
||||
• {root_dir} (`string`)
|
||||
• {root_dir} (`string?`)
|
||||
• {attached_buffers} (`table<integer,true>`)
|
||||
• {commands} (`table<string,fun(command: lsp.Command, ctx: table)>`)
|
||||
Table of command name to function which is
|
||||
@@ -1634,7 +1646,7 @@ is_enabled({filter}) *vim.lsp.inlay_hint.is_enabled()*
|
||||
Query whether inlay hint is enabled in the {filter}ed scope
|
||||
|
||||
Parameters: ~
|
||||
• {filter} (`table`) Optional filters |kwargs|, or `nil` for all.
|
||||
• {filter} (`table?`) Optional filters |kwargs|, or `nil` for all.
|
||||
• {bufnr} (`integer?`) Buffer number, or 0 for current
|
||||
buffer, or nil for all.
|
||||
|
||||
|
@@ -3012,7 +3012,10 @@ vim.fs.parents({start}) *vim.fs.parents()*
|
||||
|
||||
vim.fs.root({source}, {marker}) *vim.fs.root()*
|
||||
Find the first parent directory containing a specific "marker", relative
|
||||
to a buffer's directory.
|
||||
to a file path or buffer.
|
||||
|
||||
If the buffer is unnamed (has no backing file) or has a non-empty
|
||||
'buftype' then the search begins from Nvim's |current-directory|.
|
||||
|
||||
Example: >lua
|
||||
-- Find the root of a Python project, starting from file 'main.py'
|
||||
@@ -3029,7 +3032,8 @@ vim.fs.root({source}, {marker}) *vim.fs.root()*
|
||||
|
||||
Parameters: ~
|
||||
• {source} (`integer|string`) Buffer number (0 for current buffer) or
|
||||
file path to begin the search from.
|
||||
file path (absolute or relative to the |current-directory|)
|
||||
to begin the search from.
|
||||
• {marker} (`string|string[]|fun(name: string, path: string): boolean`)
|
||||
A marker, or list of markers, to search for. If a function,
|
||||
the function is called for each evaluated item and should
|
||||
@@ -3085,7 +3089,7 @@ In addition, its regex-like interface is available as |vim.re|
|
||||
|
||||
|
||||
|
||||
Pattern:match({subject}, {init}) *Pattern:match()*
|
||||
Pattern:match({subject}, {init}, {...}) *Pattern:match()*
|
||||
Matches the given `pattern` against the `subject` string. If the match
|
||||
succeeds, returns the index in the subject of the first character after
|
||||
the match, or the captured values (if the pattern captured any value). An
|
||||
@@ -3108,9 +3112,10 @@ Pattern:match({subject}, {init}) *Pattern:match()*
|
||||
Parameters: ~
|
||||
• {subject} (`string`)
|
||||
• {init} (`integer?`)
|
||||
• {...} (`any`)
|
||||
|
||||
Return: ~
|
||||
(`integer|vim.lpeg.Capture?`)
|
||||
(`any`) ...
|
||||
|
||||
vim.lpeg.B({pattern}) *vim.lpeg.B()*
|
||||
Returns a pattern that matches only if the input string at the current
|
||||
@@ -3120,7 +3125,7 @@ vim.lpeg.B({pattern}) *vim.lpeg.B()*
|
||||
or failure.
|
||||
|
||||
Parameters: ~
|
||||
• {pattern} (`vim.lpeg.Pattern`)
|
||||
• {pattern} (`vim.lpeg.Pattern|string|integer|boolean|table`)
|
||||
|
||||
Return: ~
|
||||
(`vim.lpeg.Pattern`)
|
||||
@@ -3144,7 +3149,7 @@ vim.lpeg.C({patt}) *vim.lpeg.C()*
|
||||
<
|
||||
|
||||
Parameters: ~
|
||||
• {patt} (`vim.lpeg.Pattern`)
|
||||
• {patt} (`vim.lpeg.Pattern|string|integer|boolean|table|function`)
|
||||
|
||||
Return: ~
|
||||
(`vim.lpeg.Capture`)
|
||||
@@ -3195,11 +3200,11 @@ vim.lpeg.Cf({patt}, {func}) *vim.lpeg.Cf()*
|
||||
This capture assumes that `patt` should produce at least one capture with
|
||||
at least one value (of any type), which becomes the initial value of an
|
||||
accumulator. (If you need a specific initial value, you may prefix a
|
||||
constant captureto `patt`.) For each subsequent capture, LPeg calls `func`
|
||||
with this accumulator as the first argument and all values produced by the
|
||||
capture as extra arguments; the first result from this call becomes the
|
||||
new value for the accumulator. The final value of the accumulator becomes
|
||||
the captured value.
|
||||
constant capture to `patt`.) For each subsequent capture, LPeg calls
|
||||
`func` with this accumulator as the first argument and all values produced
|
||||
by the capture as extra arguments; the first result from this call becomes
|
||||
the new value for the accumulator. The final value of the accumulator
|
||||
becomes the captured value.
|
||||
|
||||
Example: >lua
|
||||
local number = lpeg.R('09') ^ 1 / tonumber
|
||||
@@ -3210,7 +3215,7 @@ vim.lpeg.Cf({patt}, {func}) *vim.lpeg.Cf()*
|
||||
<
|
||||
|
||||
Parameters: ~
|
||||
• {patt} (`vim.lpeg.Pattern`)
|
||||
• {patt} (`vim.lpeg.Pattern|string|integer|boolean|table|function`)
|
||||
• {func} (`fun(acc, newvalue)`)
|
||||
|
||||
Return: ~
|
||||
@@ -3222,7 +3227,7 @@ vim.lpeg.Cg({patt}, {name}) *vim.lpeg.Cg()*
|
||||
with the given name (which can be any non-nil Lua value).
|
||||
|
||||
Parameters: ~
|
||||
• {patt} (`vim.lpeg.Pattern`)
|
||||
• {patt} (`vim.lpeg.Pattern|string|integer|boolean|table|function`)
|
||||
• {name} (`string?`)
|
||||
|
||||
Return: ~
|
||||
@@ -3245,8 +3250,9 @@ vim.lpeg.Cmt({patt}, {fn}) *vim.lpeg.Cmt()*
|
||||
function become the values produced by the capture.
|
||||
|
||||
Parameters: ~
|
||||
• {patt} (`vim.lpeg.Pattern`)
|
||||
• {fn} (`function`)
|
||||
• {patt} (`vim.lpeg.Pattern|string|integer|boolean|table|function`)
|
||||
• {fn} (`fun(s: string, i: integer, ...: any)`) (position:
|
||||
boolean|integer, ...: any)
|
||||
|
||||
Return: ~
|
||||
(`vim.lpeg.Capture`)
|
||||
@@ -3285,7 +3291,7 @@ vim.lpeg.Cs({patt}) *vim.lpeg.Cs()*
|
||||
<
|
||||
|
||||
Parameters: ~
|
||||
• {patt} (`vim.lpeg.Pattern`)
|
||||
• {patt} (`vim.lpeg.Pattern|string|integer|boolean|table|function`)
|
||||
|
||||
Return: ~
|
||||
(`vim.lpeg.Capture`)
|
||||
@@ -3298,7 +3304,7 @@ vim.lpeg.Ct({patt}) *vim.lpeg.Ct()*
|
||||
the group name as its key. The captured value is only the table.
|
||||
|
||||
Parameters: ~
|
||||
• {patt} (`vim.lpeg.Pattern|''`)
|
||||
• {patt} (`vim.lpeg.Pattern|string|integer|boolean|table|function`)
|
||||
|
||||
Return: ~
|
||||
(`vim.lpeg.Capture`)
|
||||
@@ -3333,7 +3339,7 @@ vim.lpeg.locale({tab}) *vim.lpeg.locale()*
|
||||
Return: ~
|
||||
(`vim.lpeg.Locale`)
|
||||
|
||||
vim.lpeg.match({pattern}, {subject}, {init}) *vim.lpeg.match()*
|
||||
vim.lpeg.match({pattern}, {subject}, {init}, {...}) *vim.lpeg.match()*
|
||||
Matches the given `pattern` against the `subject` string. If the match
|
||||
succeeds, returns the index in the subject of the first character after
|
||||
the match, or the captured values (if the pattern captured any value). An
|
||||
@@ -3354,12 +3360,13 @@ vim.lpeg.match({pattern}, {subject}, {init}) *vim.lpeg.match()*
|
||||
<
|
||||
|
||||
Parameters: ~
|
||||
• {pattern} (`vim.lpeg.Pattern`)
|
||||
• {pattern} (`vim.lpeg.Pattern|string|integer|boolean|table|function`)
|
||||
• {subject} (`string`)
|
||||
• {init} (`integer?`)
|
||||
• {...} (`any`)
|
||||
|
||||
Return: ~
|
||||
(`integer|vim.lpeg.Capture?`)
|
||||
(`any`) ...
|
||||
|
||||
vim.lpeg.P({value}) *vim.lpeg.P()*
|
||||
Converts the given value into a proper pattern. The following rules are
|
||||
@@ -3453,7 +3460,7 @@ vim.lpeg.V({v}) *vim.lpeg.V()*
|
||||
<
|
||||
|
||||
Parameters: ~
|
||||
• {v} (`string|integer`)
|
||||
• {v} (`boolean|string|number|function|table|thread|userdata|lightuserdata`)
|
||||
|
||||
Return: ~
|
||||
(`vim.lpeg.Pattern`)
|
||||
@@ -4385,8 +4392,9 @@ vim.text.hexdecode({enc}) *vim.text.hexdecode()*
|
||||
Parameters: ~
|
||||
• {enc} (`string`) String to decode
|
||||
|
||||
Return: ~
|
||||
(`string`) Decoded string
|
||||
Return (multiple): ~
|
||||
(`string?`) Decoded string
|
||||
(`string?`) Error message, if any
|
||||
|
||||
vim.text.hexencode({str}) *vim.text.hexencode()*
|
||||
Hex encode a string.
|
||||
@@ -4402,7 +4410,7 @@ vim.text.hexencode({str}) *vim.text.hexencode()*
|
||||
Lua module: tohtml *vim.tohtml*
|
||||
|
||||
|
||||
:TOhtml {file} *:TOhtml*
|
||||
:[range]TOhtml {file} *:TOhtml*
|
||||
Converts the buffer shown in the current window to HTML, opens the generated
|
||||
HTML in a new split window, and saves its contents to {file}. If {file} is not
|
||||
given, a temporary file (created by |tempname()|) is used.
|
||||
@@ -4424,6 +4432,8 @@ tohtml.tohtml({winid}, {opt}) *tohtml.tohtml.tohtml()*
|
||||
• {width}? (`integer`, default: 'textwidth' if non-zero or
|
||||
window width otherwise) Width used for items which are
|
||||
either right aligned or repeat a character infinitely.
|
||||
• {range}? (`integer[]`, default: entire buffer) Range of
|
||||
rows to use.
|
||||
|
||||
Return: ~
|
||||
(`string[]`)
|
||||
|
@@ -349,8 +349,8 @@ The following new features were added.
|
||||
|default-autocmds|
|
||||
|
||||
• Treesitter:
|
||||
• Bundled parsers and queries (highlight, folds) for Markdown, Python, and
|
||||
Bash.
|
||||
• Bundled parsers and queries (highlight, folds) for Markdown (used for LSP
|
||||
hover).
|
||||
• |:InspectTree| shows root nodes.
|
||||
• |:InspectTree| now supports |folding|.
|
||||
• |:InspectTree| shows node ranges in 0-based instead of 1-based indexing.
|
||||
|
@@ -1092,7 +1092,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
applying 'breakindent', even if the resulting
|
||||
text should normally be narrower. This prevents
|
||||
text indented almost to the right window border
|
||||
occupying lot of vertical space when broken.
|
||||
occupying lots of vertical space when broken.
|
||||
(default: 20)
|
||||
shift:{n} After applying 'breakindent', the wrapped line's
|
||||
beginning will be shifted by the given number of
|
||||
@@ -3439,7 +3439,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
in Insert mode as specified with the 'indentkeys' option.
|
||||
When this option is not empty, it overrules the 'cindent' and
|
||||
'smartindent' indenting. When 'lisp' is set, this option is
|
||||
is only used when 'lispoptions' contains "expr:1".
|
||||
only used when 'lispoptions' contains "expr:1".
|
||||
The expression is evaluated with |v:lnum| set to the line number for
|
||||
which the indent is to be computed. The cursor is also in this line
|
||||
when the expression is evaluated (but it may be moved around).
|
||||
@@ -3688,7 +3688,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
part can be in one of two forms:
|
||||
1. A list of pairs. Each pair is a "from" character immediately
|
||||
followed by the "to" character. Examples: "aA", "aAbBcC".
|
||||
2. A list of "from" characters, a semi-colon and a list of "to"
|
||||
2. A list of "from" characters, a semicolon and a list of "to"
|
||||
characters. Example: "abc;ABC"
|
||||
Example: "aA,fgh;FGH,cCdDeE"
|
||||
Special characters need to be preceded with a backslash. These are
|
||||
@@ -3756,7 +3756,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
update use |:redraw|.
|
||||
This may occasionally cause display errors. It is only meant to be set
|
||||
temporarily when performing an operation where redrawing may cause
|
||||
flickering or cause a slow down.
|
||||
flickering or cause a slowdown.
|
||||
|
||||
*'linebreak'* *'lbr'* *'nolinebreak'* *'nolbr'*
|
||||
'linebreak' 'lbr' boolean (default off)
|
||||
@@ -3834,6 +3834,9 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
between tabs and spaces and for trailing blanks. Further changed by
|
||||
the 'listchars' option.
|
||||
|
||||
When 'listchars' does not contain "tab" field, tabs are shown as "^I"
|
||||
or "<09>", like how unprintable characters are displayed.
|
||||
|
||||
The cursor is displayed at the start of the space a Tab character
|
||||
occupies, not at the end as usual in Normal mode. To get this cursor
|
||||
position while displaying Tabs with spaces, use: >vim
|
||||
@@ -4582,7 +4585,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
set path+=
|
||||
< To use an environment variable, you probably need to replace the
|
||||
separator. Here is an example to append $INCL, in which directory
|
||||
names are separated with a semi-colon: >vim
|
||||
names are separated with a semicolon: >vim
|
||||
let &path = &path .. "," .. substitute($INCL, ';', ',', 'g')
|
||||
< Replace the ';' with a ':' or whatever separator is used. Note that
|
||||
this doesn't work when $INCL contains a comma or white space.
|
||||
@@ -5442,7 +5445,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
'shortmess' 'shm' string (default "ltToOCF")
|
||||
global
|
||||
This option helps to avoid all the |hit-enter| prompts caused by file
|
||||
messages, for example with CTRL-G, and to avoid some other messages.
|
||||
messages, for example with CTRL-G, and to avoid some other messages.
|
||||
It is a list of flags:
|
||||
flag meaning when present ~
|
||||
l use "999L, 888B" instead of "999 lines, 888 bytes" *shm-l*
|
||||
@@ -5847,7 +5850,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
minus two.
|
||||
|
||||
timeout:{millisec} Limit the time searching for suggestions to
|
||||
{millisec} milli seconds. Applies to the following
|
||||
{millisec} milliseconds. Applies to the following
|
||||
methods. When omitted the limit is 5000. When
|
||||
negative there is no limit.
|
||||
|
||||
|
@@ -4986,7 +4986,6 @@ IncSearch 'incsearch' highlighting; also used for the text replaced with
|
||||
":s///c".
|
||||
*hl-Substitute*
|
||||
Substitute |:substitute| replacement text highlighting.
|
||||
|
||||
*hl-LineNr*
|
||||
LineNr Line number for ":number" and ":#" commands, and when 'number'
|
||||
or 'relativenumber' option is set.
|
||||
@@ -5006,7 +5005,6 @@ CursorLineSign Like SignColumn when 'cursorline' is set for the cursor line.
|
||||
*hl-MatchParen*
|
||||
MatchParen Character under the cursor or just before it, if it
|
||||
is a paired bracket, and its match. |pi_paren.txt|
|
||||
|
||||
*hl-ModeMsg*
|
||||
ModeMsg 'showmode' message (e.g., "-- INSERT --").
|
||||
*hl-MsgArea*
|
||||
@@ -5052,7 +5050,7 @@ PmenuThumb Popup menu: Thumb of the scrollbar.
|
||||
Question |hit-enter| prompt and yes/no questions.
|
||||
*hl-QuickFixLine*
|
||||
QuickFixLine Current |quickfix| item in the quickfix window. Combined with
|
||||
|hl-CursorLine| when the cursor is there.
|
||||
|hl-CursorLine| when the cursor is there.
|
||||
*hl-Search*
|
||||
Search Last search pattern highlighting (see 'hlsearch').
|
||||
Also used for similar items that need to stand out.
|
||||
|
@@ -22,9 +22,11 @@ search for in the `parser` runtime directory.
|
||||
|
||||
Nvim includes these parsers:
|
||||
|
||||
- Bash
|
||||
- C
|
||||
- Lua
|
||||
- Markdown
|
||||
- Python
|
||||
- Vimscript
|
||||
- Vimdoc
|
||||
- Treesitter query files |ft-query-plugin|
|
||||
|
@@ -87,7 +87,7 @@ The ":tags" command shows the list of tags that you traversed through:
|
||||
1 1 write_line 8 write_block.c ~
|
||||
2 1 write_char 7 write_line.c ~
|
||||
> ~
|
||||
>
|
||||
<
|
||||
Now to go back. The CTRL-T command goes to the preceding tag. In the example
|
||||
above you get back to the "write_line" function, in the call to "write_char".
|
||||
This command takes a count argument that indicates how many tags to jump
|
||||
|
@@ -209,7 +209,7 @@ gx Opens the current filepath or URL (decided by
|
||||
This implies that an insert command must be completed
|
||||
(to start Insert mode, see |:startinsert|). A ":"
|
||||
command must be completed as well. And you can't use
|
||||
"Q" or "gQ" to start Ex mode.
|
||||
"gQ" to start Ex mode.
|
||||
|
||||
The display is not updated while ":normal" is busy.
|
||||
|
||||
@@ -579,6 +579,10 @@ Acting on multiple lines behaves as follows:
|
||||
transformed to empty comments (e.g. `/**/`). Comment markers are aligned to
|
||||
the least indented line.
|
||||
|
||||
Matching 'commentstring' does not account for whitespace in comment markers.
|
||||
Removing comment markers is first attempted exactly, with fallback to using
|
||||
markers trimmed from whitespace.
|
||||
|
||||
If the filetype of the buffer is associated with a language for which a
|
||||
|treesitter| parser is installed, then |vim.filetype.get_option()| is called
|
||||
to look up the value of 'commentstring' corresponding to the cursor position.
|
||||
|
@@ -10,7 +10,8 @@ if exists("b:did_ftplugin")
|
||||
endif
|
||||
|
||||
" Behaves mostly just like C
|
||||
runtime! ftplugin/c.{vim,lua} ftplugin/c_*.{vim,lua} ftplugin/c/*.{vim,lua}
|
||||
" XXX: "[.]" in the first pattern makes it a wildcard on Windows
|
||||
runtime! ftplugin/c[.]{vim,lua} ftplugin/c_*.{vim,lua} ftplugin/c/*.{vim,lua}
|
||||
|
||||
" C++ uses templates with <things>
|
||||
" Disabled, because it gives an error for typing an unmatched ">".
|
||||
|
1
runtime/ftplugin/glsl.lua
Normal file
1
runtime/ftplugin/glsl.lua
Normal file
@@ -0,0 +1 @@
|
||||
vim.bo.commentstring = '// %s'
|
@@ -50,11 +50,11 @@ local function check_config()
|
||||
|
||||
local init_lua = vim.fn.stdpath('config') .. '/init.lua'
|
||||
local init_vim = vim.fn.stdpath('config') .. '/init.vim'
|
||||
local vimrc = vim.env.MYVIMRC and vim.fn.expand(vim.env.MYVIMRC) or init_lua
|
||||
local vimrc = vim.env.MYVIMRC and vim.fs.normalize(vim.env.MYVIMRC) or init_lua
|
||||
|
||||
if vim.fn.filereadable(vimrc) == 0 and vim.fn.filereadable(init_vim) == 0 then
|
||||
ok = false
|
||||
local has_vim = vim.fn.filereadable(vim.fn.expand('~/.vimrc')) == 1
|
||||
local has_vim = vim.fn.filereadable(vim.fs.normalize('~/.vimrc')) == 1
|
||||
health.warn(
|
||||
('%s user config file: %s'):format(
|
||||
-1 == vim.fn.getfsize(vimrc) and 'Missing' or 'Unreadable',
|
||||
@@ -114,7 +114,7 @@ local function check_config()
|
||||
)
|
||||
shadafile = (
|
||||
vim.o.shadafile == ''
|
||||
and (shadafile == '' and vim.fn.stdpath('state') .. '/shada/main.shada' or vim.fn.expand(
|
||||
and (shadafile == '' and vim.fn.stdpath('state') .. '/shada/main.shada' or vim.fs.normalize(
|
||||
shadafile
|
||||
))
|
||||
or (vim.o.shadafile == 'NONE' and '' or vim.o.shadafile)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
local health = vim.health
|
||||
local iswin = vim.loop.os_uname().sysname == 'Windows_NT'
|
||||
local iswin = vim.uv.os_uname().sysname == 'Windows_NT'
|
||||
|
||||
local M = {}
|
||||
|
||||
@@ -7,7 +7,7 @@ local function is(path, ty)
|
||||
if not path then
|
||||
return false
|
||||
end
|
||||
local stat = vim.loop.fs_stat(path)
|
||||
local stat = vim.uv.fs_stat(path)
|
||||
if not stat then
|
||||
return false
|
||||
end
|
||||
@@ -77,12 +77,14 @@ local function download(url)
|
||||
return out
|
||||
end
|
||||
elseif vim.fn.executable('python') == 1 then
|
||||
local script = "try:\n\
|
||||
from urllib.request import urlopen\n\
|
||||
except ImportError:\n\
|
||||
from urllib2 import urlopen\n\
|
||||
response = urlopen('" .. url .. "')\n\
|
||||
print(response.read().decode('utf8'))\n"
|
||||
local script = ([[
|
||||
try:
|
||||
from urllib.request import urlopen
|
||||
except ImportError:
|
||||
from urllib2 import urlopen
|
||||
response = urlopen('%s')
|
||||
print(response.read().decode('utf8'))
|
||||
]]):format(url)
|
||||
local out, rc = health.system({ 'python', '-c', script })
|
||||
if out == '' and rc ~= 0 then
|
||||
return 'python urllib.request error: ' .. rc
|
||||
|
@@ -19,8 +19,7 @@ function M.check()
|
||||
end
|
||||
health.info('Ruby: ' .. health.system({ 'ruby', '-v' }))
|
||||
|
||||
local ruby_detect_table = vim.provider.ruby.detect()
|
||||
local host = ruby_detect_table[1]
|
||||
local host, _ = vim.provider.ruby.detect()
|
||||
if (not host) or host:find('^%s*$') then
|
||||
health.warn('`neovim-ruby-host` not found.', {
|
||||
'Run `gem install neovim` to ensure the neovim RubyGem is installed.',
|
||||
|
@@ -1,6 +1,6 @@
|
||||
--- @brief
|
||||
---<pre>help
|
||||
---:TOhtml {file} *:TOhtml*
|
||||
---:[range]TOhtml {file} *:TOhtml*
|
||||
---Converts the buffer shown in the current window to HTML, opens the generated
|
||||
---HTML in a new split window, and saves its contents to {file}. If {file} is not
|
||||
---given, a temporary file (created by |tempname()|) is used.
|
||||
@@ -40,7 +40,8 @@
|
||||
--- @field winid integer
|
||||
--- @field bufnr integer
|
||||
--- @field width integer
|
||||
--- @field buflen integer
|
||||
--- @field start integer
|
||||
--- @field end_ integer
|
||||
|
||||
--- @class (private) vim.tohtml.styletable
|
||||
--- @field [integer] vim.tohtml.line (integer: (1-index, exclusive))
|
||||
@@ -57,6 +58,26 @@
|
||||
--- @field [3] any[][] virt_text
|
||||
--- @field [4] any[][] overlay_text
|
||||
|
||||
--- @type string[]
|
||||
local notifications = {}
|
||||
|
||||
---@param msg string
|
||||
local function notify(msg)
|
||||
if #notifications == 0 then
|
||||
vim.schedule(function()
|
||||
if #notifications > 1 then
|
||||
vim.notify(
|
||||
('TOhtml: %s (+ %d more warnings)'):format(notifications[1], tostring(#notifications - 1))
|
||||
)
|
||||
elseif #notifications == 1 then
|
||||
vim.notify('TOhtml: ' .. notifications[1])
|
||||
end
|
||||
notifications = {}
|
||||
end)
|
||||
end
|
||||
table.insert(notifications, msg)
|
||||
end
|
||||
|
||||
local HIDE_ID = -1
|
||||
-- stylua: ignore start
|
||||
local cterm_8_to_hex={
|
||||
@@ -168,6 +189,8 @@ local background_color_cache = nil
|
||||
--- @type string?
|
||||
local foreground_color_cache = nil
|
||||
|
||||
local len = vim.api.nvim_strwidth
|
||||
|
||||
--- @see https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
|
||||
--- @param color "background"|"foreground"|integer
|
||||
--- @return string?
|
||||
@@ -215,7 +238,7 @@ local function cterm_to_hex(colorstr)
|
||||
if hex then
|
||||
cterm_color_cache[color] = hex
|
||||
else
|
||||
vim.notify_once("Info(TOhtml): Couldn't get terminal colors, using fallback")
|
||||
notify("Couldn't get terminal colors, using fallback")
|
||||
local t_Co = tonumber(vim.api.nvim_eval('&t_Co'))
|
||||
if t_Co <= 8 then
|
||||
cterm_color_cache = cterm_8_to_hex
|
||||
@@ -241,7 +264,7 @@ local function get_background_color()
|
||||
end
|
||||
local hex = try_query_terminal_color('background')
|
||||
if not hex or not hex:match('#%x%x%x%x%x%x') then
|
||||
vim.notify_once("Info(TOhtml): Couldn't get terminal background colors, using fallback")
|
||||
notify("Couldn't get terminal background colors, using fallback")
|
||||
hex = vim.o.background == 'light' and '#ffffff' or '#000000'
|
||||
end
|
||||
background_color_cache = hex
|
||||
@@ -259,7 +282,7 @@ local function get_foreground_color()
|
||||
end
|
||||
local hex = try_query_terminal_color('foreground')
|
||||
if not hex or not hex:match('#%x%x%x%x%x%x') then
|
||||
vim.notify_once("Info(TOhtml): Couldn't get terminal foreground colors, using fallback")
|
||||
notify("Couldn't get terminal foreground colors, using fallback")
|
||||
hex = vim.o.background == 'light' and '#000000' or '#ffffff'
|
||||
end
|
||||
foreground_color_cache = hex
|
||||
@@ -292,9 +315,12 @@ local function style_line_insert_virt_text(style_line, col, val)
|
||||
end
|
||||
|
||||
--- @param state vim.tohtml.state
|
||||
--- @param hl string|integer|nil
|
||||
--- @param hl string|integer|string[]|integer[]?
|
||||
--- @return nil|integer
|
||||
local function register_hl(state, hl)
|
||||
if type(hl) == 'table' then
|
||||
hl = hl[#hl]
|
||||
end
|
||||
if type(hl) == 'nil' then
|
||||
return
|
||||
elseif type(hl) == 'string' then
|
||||
@@ -370,7 +396,7 @@ end
|
||||
|
||||
--- @param state vim.tohtml.state
|
||||
local function styletable_syntax(state)
|
||||
for row = 1, state.buflen do
|
||||
for row = state.start, state.end_ do
|
||||
local prev_id = 0
|
||||
local prev_col = nil
|
||||
for col = 1, #vim.fn.getline(row) + 1 do
|
||||
@@ -390,7 +416,7 @@ end
|
||||
--- @param state vim.tohtml.state
|
||||
local function styletable_diff(state)
|
||||
local styletable = state.style
|
||||
for row = 1, state.buflen do
|
||||
for row = state.start, state.end_ do
|
||||
local style_line = styletable[row]
|
||||
local filler = vim.fn.diff_filler(row)
|
||||
if filler ~= 0 then
|
||||
@@ -400,7 +426,7 @@ local function styletable_diff(state)
|
||||
{ { fill:rep(state.width), register_hl(state, 'DiffDelete') } }
|
||||
)
|
||||
end
|
||||
if row == state.buflen + 1 then
|
||||
if row == state.end_ + 1 then
|
||||
break
|
||||
end
|
||||
local prev_id = 0
|
||||
@@ -442,7 +468,9 @@ local function styletable_treesitter(state)
|
||||
if not query then
|
||||
return
|
||||
end
|
||||
for capture, node, metadata in query:iter_captures(root, buf_highlighter.bufnr, 0, state.buflen) do
|
||||
for capture, node, metadata in
|
||||
query:iter_captures(root, buf_highlighter.bufnr, state.start - 1, state.end_)
|
||||
do
|
||||
local srow, scol, erow, ecol = node:range()
|
||||
--- @diagnostic disable-next-line: invisible
|
||||
local c = q._query.captures[capture]
|
||||
@@ -467,7 +495,7 @@ local function _styletable_extmarks_highlight(state, extmark, namespaces)
|
||||
---TODO(altermo) LSP semantic tokens (and some other extmarks) are only
|
||||
---generated in visible lines, and not in the whole buffer.
|
||||
if (namespaces[extmark[4].ns_id] or ''):find('vim_lsp_semantic_tokens') then
|
||||
vim.notify_once('Info(TOhtml): lsp semantic tokens are not supported, HTML may be incorrect')
|
||||
notify('lsp semantic tokens are not supported, HTML may be incorrect')
|
||||
return
|
||||
end
|
||||
local srow, scol, erow, ecol =
|
||||
@@ -481,17 +509,27 @@ end
|
||||
|
||||
--- @param state vim.tohtml.state
|
||||
--- @param extmark {[1]:integer,[2]:integer,[3]:integer,[4]:vim.api.keyset.set_extmark|any}
|
||||
local function _styletable_extmarks_virt_text(state, extmark)
|
||||
--- @param namespaces table<integer,string>
|
||||
local function _styletable_extmarks_virt_text(state, extmark, namespaces)
|
||||
if not extmark[4].virt_text then
|
||||
return
|
||||
end
|
||||
---TODO(altermo) LSP semantic tokens (and some other extmarks) are only
|
||||
---generated in visible lines, and not in the whole buffer.
|
||||
if (namespaces[extmark[4].ns_id] or ''):find('vim_lsp_inlayhint') then
|
||||
notify('lsp inlay hints are not supported, HTML may be incorrect')
|
||||
return
|
||||
end
|
||||
local styletable = state.style
|
||||
--- @type integer,integer
|
||||
local row, col = extmark[2], extmark[3]
|
||||
if
|
||||
extmark[4].virt_text_pos == 'inline'
|
||||
or extmark[4].virt_text_pos == 'eol'
|
||||
or extmark[4].virt_text_pos == 'overlay'
|
||||
row < vim.api.nvim_buf_line_count(state.bufnr)
|
||||
and (
|
||||
extmark[4].virt_text_pos == 'inline'
|
||||
or extmark[4].virt_text_pos == 'eol'
|
||||
or extmark[4].virt_text_pos == 'overlay'
|
||||
)
|
||||
then
|
||||
if extmark[4].virt_text_pos == 'eol' then
|
||||
style_line_insert_virt_text(styletable[row + 1], #vim.fn.getline(row + 1) + 1, { ' ' })
|
||||
@@ -510,7 +548,7 @@ local function _styletable_extmarks_virt_text(state, extmark)
|
||||
else
|
||||
style_line_insert_virt_text(styletable[row + 1], col + 1, { i[1], hlid })
|
||||
end
|
||||
virt_text_len = virt_text_len + #i[1]
|
||||
virt_text_len = virt_text_len + len(i[1])
|
||||
end
|
||||
if extmark[4].virt_text_pos == 'overlay' then
|
||||
styletable_insert_range(state, row + 1, col + 1, row + 1, col + virt_text_len + 1, HIDE_ID)
|
||||
@@ -521,11 +559,9 @@ local function _styletable_extmarks_virt_text(state, extmark)
|
||||
hl_mode = 'blend',
|
||||
hl_group = 'combine',
|
||||
}
|
||||
for opt, val in ipairs(not_supported) do
|
||||
for opt, val in pairs(not_supported) do
|
||||
if extmark[4][opt] == val then
|
||||
vim.notify_once(
|
||||
('Info(TOhtml): extmark.%s="%s" is not supported, HTML may be incorrect'):format(opt, val)
|
||||
)
|
||||
notify(('extmark.%s="%s" is not supported, HTML may be incorrect'):format(opt, val))
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -586,7 +622,7 @@ local function styletable_extmarks(state)
|
||||
_styletable_extmarks_conceal(state, v)
|
||||
end
|
||||
for _, v in ipairs(extmarks) do
|
||||
_styletable_extmarks_virt_text(state, v)
|
||||
_styletable_extmarks_virt_text(state, v, namespaces)
|
||||
end
|
||||
for _, v in ipairs(extmarks) do
|
||||
_styletable_extmarks_virt_lines(state, v)
|
||||
@@ -597,7 +633,7 @@ end
|
||||
local function styletable_folds(state)
|
||||
local styletable = state.style
|
||||
local has_folded = false
|
||||
for row = 1, state.buflen do
|
||||
for row = state.start, state.end_ do
|
||||
if vim.fn.foldclosed(row) > 0 then
|
||||
has_folded = true
|
||||
styletable[row].hide = true
|
||||
@@ -611,9 +647,7 @@ local function styletable_folds(state)
|
||||
end
|
||||
end
|
||||
if has_folded and type(({ pcall(vim.api.nvim_eval, vim.o.foldtext) })[2]) == 'table' then
|
||||
vim.notify_once(
|
||||
'Info(TOhtml): foldtext returning a table is half supported, HTML may be incorrect'
|
||||
)
|
||||
notify('foldtext returning a table with highlights is not supported, HTML may be incorrect')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -621,7 +655,7 @@ end
|
||||
local function styletable_conceal(state)
|
||||
local bufnr = state.bufnr
|
||||
vim.api.nvim_buf_call(bufnr, function()
|
||||
for row = 1, state.buflen do
|
||||
for row = state.start, state.end_ do
|
||||
--- @type table<integer,{[1]:integer,[2]:integer,[3]:string}>
|
||||
local conceals = {}
|
||||
local line_len_exclusive = #vim.fn.getline(row) + 1
|
||||
@@ -739,7 +773,7 @@ local function styletable_statuscolumn(state)
|
||||
local max = tonumber(foldcolumn:match('^%w-:(%d)')) or 1
|
||||
local maxfold = 0
|
||||
vim.api.nvim_buf_call(state.bufnr, function()
|
||||
for row = 1, vim.api.nvim_buf_line_count(state.bufnr) do
|
||||
for row = state.start, state.end_ do
|
||||
local foldlevel = vim.fn.foldlevel(row)
|
||||
if foldlevel > maxfold then
|
||||
maxfold = foldlevel
|
||||
@@ -754,12 +788,12 @@ local function styletable_statuscolumn(state)
|
||||
|
||||
--- @type table<integer,any>
|
||||
local statuses = {}
|
||||
for row = 1, state.buflen do
|
||||
for row = state.start, state.end_ do
|
||||
local status = vim.api.nvim_eval_statusline(
|
||||
statuscolumn,
|
||||
{ winid = state.winid, use_statuscol_lnum = row, highlights = true }
|
||||
)
|
||||
local width = vim.api.nvim_strwidth(status.str)
|
||||
local width = len(status.str)
|
||||
if width > minwidth then
|
||||
minwidth = width
|
||||
end
|
||||
@@ -774,7 +808,7 @@ local function styletable_statuscolumn(state)
|
||||
for k, v in ipairs(hls) do
|
||||
local text = str:sub(v.start + 1, hls[k + 1] and hls[k + 1].start or nil)
|
||||
if k == #hls then
|
||||
text = text .. (' '):rep(minwidth - vim.api.nvim_strwidth(str))
|
||||
text = text .. (' '):rep(minwidth - len(str))
|
||||
end
|
||||
if text ~= '' then
|
||||
local hlid = register_hl(state, v.group)
|
||||
@@ -794,7 +828,6 @@ local function styletable_listchars(state)
|
||||
local function utf8_sub(str, i, j)
|
||||
return vim.fn.strcharpart(str, i - 1, j and j - i + 1 or nil)
|
||||
end
|
||||
local len = vim.api.nvim_strwidth
|
||||
--- @type table<string,string>
|
||||
local listchars = vim.opt_local.listchars:get()
|
||||
local ids = setmetatable({}, {
|
||||
@@ -805,7 +838,7 @@ local function styletable_listchars(state)
|
||||
})
|
||||
|
||||
if listchars.eol then
|
||||
for row = 1, state.buflen do
|
||||
for row = state.start, state.end_ do
|
||||
local style_line = state.style[row]
|
||||
style_line_insert_overlay_char(
|
||||
style_line,
|
||||
@@ -1099,16 +1132,22 @@ end
|
||||
local function extend_pre(out, state)
|
||||
local styletable = state.style
|
||||
table.insert(out, '<pre>')
|
||||
local out_start = #out
|
||||
local hide_count = 0
|
||||
--- @type integer[]
|
||||
local stack = {}
|
||||
|
||||
local before = ''
|
||||
local after = ''
|
||||
local function loop(row)
|
||||
local inside = row <= state.end_ and row >= state.start
|
||||
local style_line = styletable[row]
|
||||
if style_line.hide and (styletable[row - 1] or {}).hide then
|
||||
return
|
||||
end
|
||||
_extend_virt_lines(out, state, row)
|
||||
if inside then
|
||||
_extend_virt_lines(out, state, row)
|
||||
end
|
||||
--Possible improvement (altermo):
|
||||
--Instead of looping over all the buffer characters per line,
|
||||
--why not loop over all the style_line cells,
|
||||
@@ -1118,8 +1157,16 @@ local function extend_pre(out, state)
|
||||
end
|
||||
local line = vim.api.nvim_buf_get_lines(state.bufnr, row - 1, row, false)[1] or ''
|
||||
local s = ''
|
||||
s = s .. _pre_text_to_html(state, row)
|
||||
for col = 1, #line + 1 do
|
||||
if inside then
|
||||
s = s .. _pre_text_to_html(state, row)
|
||||
end
|
||||
local true_line_len = #line + 1
|
||||
for k in pairs(style_line) do
|
||||
if type(k) == 'number' and k > true_line_len then
|
||||
true_line_len = k
|
||||
end
|
||||
end
|
||||
for col = 1, true_line_len do
|
||||
local cell = style_line[col]
|
||||
--- @type table?
|
||||
local char
|
||||
@@ -1159,18 +1206,18 @@ local function extend_pre(out, state)
|
||||
end
|
||||
end
|
||||
|
||||
if cell[3] then
|
||||
if cell[3] and inside then
|
||||
s = s .. _virt_text_to_html(state, cell)
|
||||
end
|
||||
|
||||
char = cell[4][#cell[4]]
|
||||
end
|
||||
|
||||
if col == #line + 1 and not char then
|
||||
if col == true_line_len and not char then
|
||||
break
|
||||
end
|
||||
|
||||
if hide_count == 0 then
|
||||
if hide_count == 0 and inside then
|
||||
s = s
|
||||
.. _char_to_html(
|
||||
state,
|
||||
@@ -1179,12 +1226,20 @@ local function extend_pre(out, state)
|
||||
)
|
||||
end
|
||||
end
|
||||
table.insert(out, s)
|
||||
if row > state.end_ + 1 then
|
||||
after = after .. s
|
||||
elseif row < state.start then
|
||||
before = s .. before
|
||||
else
|
||||
table.insert(out, s)
|
||||
end
|
||||
end
|
||||
|
||||
for row = 1, state.buflen + 1 do
|
||||
for row = 1, vim.api.nvim_buf_line_count(state.bufnr) + 1 do
|
||||
loop(row)
|
||||
end
|
||||
out[out_start] = out[out_start] .. before
|
||||
out[#out] = out[#out] .. after
|
||||
assert(#stack == 0, 'an open HTML tag was never closed')
|
||||
table.insert(out, '</pre>')
|
||||
end
|
||||
@@ -1216,6 +1271,7 @@ local function global_state_to_state(winid, global_state)
|
||||
if not width or width < 1 then
|
||||
width = vim.api.nvim_win_get_width(winid)
|
||||
end
|
||||
local range = opt.range or { 1, vim.api.nvim_buf_line_count(bufnr) }
|
||||
local state = setmetatable({
|
||||
winid = winid == 0 and vim.api.nvim_get_current_win() or winid,
|
||||
opt = vim.wo[winid],
|
||||
@@ -1223,7 +1279,8 @@ local function global_state_to_state(winid, global_state)
|
||||
bufnr = bufnr,
|
||||
tabstop = (' '):rep(vim.bo[bufnr].tabstop),
|
||||
width = width,
|
||||
buflen = vim.api.nvim_buf_line_count(bufnr),
|
||||
start = range[1],
|
||||
end_ = range[2],
|
||||
}, { __index = global_state })
|
||||
return state --[[@as vim.tohtml.state]]
|
||||
end
|
||||
@@ -1282,35 +1339,22 @@ local function state_generate_style(state)
|
||||
end)
|
||||
end
|
||||
|
||||
--- @param winid integer[]|integer
|
||||
--- @param winid integer
|
||||
--- @param opt? vim.tohtml.opt
|
||||
--- @return string[]
|
||||
local function win_to_html(winid, opt)
|
||||
if type(winid) == 'number' then
|
||||
winid = { winid }
|
||||
end
|
||||
--- @cast winid integer[]
|
||||
assert(#winid > 0, 'no window specified')
|
||||
opt = opt or {}
|
||||
local title = table.concat(
|
||||
vim.tbl_map(vim.api.nvim_buf_get_name, vim.tbl_map(vim.api.nvim_win_get_buf, winid)),
|
||||
','
|
||||
)
|
||||
local title = vim.api.nvim_buf_get_name(vim.api.nvim_win_get_buf(winid))
|
||||
|
||||
local global_state = opt_to_global_state(opt, title)
|
||||
--- @type vim.tohtml.state[]
|
||||
local states = {}
|
||||
for _, i in ipairs(winid) do
|
||||
local state = global_state_to_state(i, global_state)
|
||||
state_generate_style(state)
|
||||
table.insert(states, state)
|
||||
end
|
||||
local state = global_state_to_state(winid, global_state)
|
||||
state_generate_style(state)
|
||||
|
||||
local html = {}
|
||||
extend_html(html, function()
|
||||
extend_head(html, global_state)
|
||||
extend_body(html, function()
|
||||
for _, state in ipairs(states) do
|
||||
extend_pre(html, state)
|
||||
end
|
||||
extend_pre(html, state)
|
||||
end)
|
||||
end)
|
||||
return html
|
||||
@@ -1337,6 +1381,10 @@ local M = {}
|
||||
--- infinitely.
|
||||
--- (default: 'textwidth' if non-zero or window width otherwise)
|
||||
--- @field width? integer
|
||||
---
|
||||
--- Range of rows to use.
|
||||
--- (default: entire buffer)
|
||||
--- @field range? integer[]
|
||||
|
||||
--- Converts the buffer shown in the window {winid} to HTML and returns the output as a list of string.
|
||||
--- @param winid? integer Window to convert (defaults to current window)
|
||||
|
@@ -77,14 +77,11 @@ local function make_comment_check(parts)
|
||||
local l_esc, r_esc = vim.pesc(parts.left), vim.pesc(parts.right)
|
||||
|
||||
-- Commented line has the following structure:
|
||||
-- <possible whitespace> <left> <anything> <right> <possible whitespace>
|
||||
local nonblank_regex = '^%s-' .. l_esc .. '.*' .. r_esc .. '%s-$'
|
||||
|
||||
-- Commented blank line can have any amount of whitespace around parts
|
||||
local blank_regex = '^%s-' .. vim.trim(l_esc) .. '%s*' .. vim.trim(r_esc) .. '%s-$'
|
||||
-- <whitespace> <trimmed left> <anything> <trimmed right> <whitespace>
|
||||
local regex = '^%s-' .. vim.trim(l_esc) .. '.*' .. vim.trim(r_esc) .. '%s-$'
|
||||
|
||||
return function(line)
|
||||
return line:find(nonblank_regex) ~= nil or line:find(blank_regex) ~= nil
|
||||
return line:find(regex) ~= nil
|
||||
end
|
||||
end
|
||||
|
||||
@@ -153,14 +150,14 @@ end
|
||||
---@return fun(line: string): string
|
||||
local function make_uncomment_function(parts)
|
||||
local l_esc, r_esc = vim.pesc(parts.left), vim.pesc(parts.right)
|
||||
local nonblank_regex = '^(%s*)' .. l_esc .. '(.*)' .. r_esc .. '(%s-)$'
|
||||
local blank_regex = '^(%s*)' .. vim.trim(l_esc) .. '(%s*)' .. vim.trim(r_esc) .. '(%s-)$'
|
||||
local regex = '^(%s*)' .. l_esc .. '(.*)' .. r_esc .. '(%s-)$'
|
||||
local regex_trimmed = '^(%s*)' .. vim.trim(l_esc) .. '(.*)' .. vim.trim(r_esc) .. '(%s-)$'
|
||||
|
||||
return function(line)
|
||||
-- Try both non-blank and blank regexes
|
||||
local indent, new_line, trail = line:match(nonblank_regex)
|
||||
-- Try regex with exact comment parts first, fall back to trimmed parts
|
||||
local indent, new_line, trail = line:match(regex)
|
||||
if new_line == nil then
|
||||
indent, new_line, trail = line:match(blank_regex)
|
||||
indent, new_line, trail = line:match(regex_trimmed)
|
||||
end
|
||||
|
||||
-- Return original if line is not commented
|
||||
|
@@ -85,13 +85,13 @@ do
|
||||
vim.keymap.set(
|
||||
'x',
|
||||
'Q',
|
||||
"mode() == 'V' ? ':normal! @<C-R>=reg_recorded()<CR><CR>' : 'Q'",
|
||||
"mode() ==# 'V' ? ':normal! @<C-R>=reg_recorded()<CR><CR>' : 'Q'",
|
||||
{ silent = true, expr = true, desc = ':help v_Q-default' }
|
||||
)
|
||||
vim.keymap.set(
|
||||
'x',
|
||||
'@',
|
||||
"mode() == 'V' ? ':normal! @'.getcharstr().'<CR>' : '@'",
|
||||
"mode() ==# 'V' ? ':normal! @'.getcharstr().'<CR>' : '@'",
|
||||
{ silent = true, expr = true, desc = ':help v_@-default' }
|
||||
)
|
||||
|
||||
@@ -266,7 +266,10 @@ do
|
||||
return
|
||||
end
|
||||
vim.v.swapchoice = 'e' -- Choose "(E)dit".
|
||||
vim.notify(('W325: Ignoring swapfile from Nvim process %d'):format(info.pid))
|
||||
vim.notify(
|
||||
('W325: Ignoring swapfile from Nvim process %d'):format(info.pid),
|
||||
vim.log.levels.WARN
|
||||
)
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -431,10 +434,14 @@ do
|
||||
--- response indicates that it does support truecolor enable 'termguicolors',
|
||||
--- but only if the user has not already disabled it.
|
||||
do
|
||||
if tty.rgb then
|
||||
-- The TUI was able to determine truecolor support
|
||||
local colorterm = os.getenv('COLORTERM')
|
||||
if tty.rgb or colorterm == 'truecolor' or colorterm == '24bit' then
|
||||
-- The TUI was able to determine truecolor support or $COLORTERM explicitly indicates
|
||||
-- truecolor support
|
||||
setoption('termguicolors', true)
|
||||
else
|
||||
elseif colorterm == nil or colorterm == '' then
|
||||
-- Neither the TUI nor $COLORTERM indicate that truecolor is supported, so query the
|
||||
-- terminal
|
||||
local caps = {} ---@type table<string, boolean>
|
||||
require('vim.termcap').query({ 'Tc', 'RGB', 'setrgbf', 'setrgbb' }, function(cap, found)
|
||||
if not found then
|
||||
|
6
runtime/lua/vim/_meta/api.lua
generated
6
runtime/lua/vim/_meta/api.lua
generated
@@ -1921,7 +1921,7 @@ function vim.api.nvim_set_current_win(window) end
|
||||
--- Note: this function should not be called often. Rather, the callbacks
|
||||
--- themselves can be used to throttle unneeded callbacks. the `on_start`
|
||||
--- callback can return `false` to disable the provider until the next redraw.
|
||||
--- Similarly, return `false` in `on_win` will skip the `on_lines` calls for
|
||||
--- Similarly, return `false` in `on_win` will skip the `on_line` calls for
|
||||
--- that window (but any extmarks set in `on_win` will still be used). A
|
||||
--- plugin managing multiple sources of decoration should ideally only set one
|
||||
--- provider, and merge the sources internally. You can use multiple `ns_id`
|
||||
@@ -1930,10 +1930,10 @@ function vim.api.nvim_set_current_win(window) end
|
||||
--- Note: doing anything other than setting extmarks is considered
|
||||
--- experimental. Doing things like changing options are not explicitly
|
||||
--- forbidden, but is likely to have unexpected consequences (such as 100% CPU
|
||||
--- consumption). doing `vim.rpcnotify` should be OK, but `vim.rpcrequest` is
|
||||
--- consumption). Doing `vim.rpcnotify` should be OK, but `vim.rpcrequest` is
|
||||
--- quite dubious for the moment.
|
||||
---
|
||||
--- Note: It is not allowed to remove or update extmarks in 'on_line'
|
||||
--- Note: It is not allowed to remove or update extmarks in `on_line`
|
||||
--- callbacks.
|
||||
---
|
||||
--- @param ns_id integer Namespace id from `nvim_create_namespace()`
|
||||
|
@@ -2,7 +2,7 @@
|
||||
error('Cannot require a meta file')
|
||||
|
||||
-- These types were taken from https://github.com/LuaCATS/lpeg
|
||||
-- (based on revision e6789e28e5b91a4a277a2a03081d708c403a3e34)
|
||||
-- (based on revision 33f4ff5343a64cf613a0634d70092fbc2b64291b)
|
||||
-- with types being renamed to include the vim namespace and with some descriptions made less verbose.
|
||||
|
||||
--- @brief <pre>help
|
||||
@@ -22,17 +22,18 @@ vim.lpeg = {}
|
||||
|
||||
--- @nodoc
|
||||
--- @class vim.lpeg.Pattern
|
||||
--- @operator len: vim.lpeg.Pattern
|
||||
--- @operator unm: vim.lpeg.Pattern
|
||||
--- @operator add(vim.lpeg.Pattern): vim.lpeg.Pattern
|
||||
--- @operator sub(vim.lpeg.Pattern): vim.lpeg.Pattern
|
||||
--- @operator mul(vim.lpeg.Pattern): vim.lpeg.Pattern
|
||||
--- @operator mul(vim.lpeg.Capture): vim.lpeg.Pattern
|
||||
--- @operator div(string): vim.lpeg.Capture
|
||||
--- @operator div(number): vim.lpeg.Capture
|
||||
--- @operator div(integer): vim.lpeg.Capture
|
||||
--- @operator div(table): vim.lpeg.Capture
|
||||
--- @operator div(function): vim.lpeg.Capture
|
||||
--- @operator pow(number): vim.lpeg.Pattern
|
||||
--- @operator mod(function): nil
|
||||
--- @operator pow(integer): vim.lpeg.Pattern
|
||||
--- @operator mod(function): vim.lpeg.Capture
|
||||
local Pattern = {}
|
||||
|
||||
--- @alias vim.lpeg.Capture vim.lpeg.Pattern
|
||||
@@ -55,11 +56,12 @@ local Pattern = {}
|
||||
--- assert(pattern:match('1 hello') == nil)
|
||||
--- ```
|
||||
---
|
||||
--- @param pattern vim.lpeg.Pattern
|
||||
--- @param pattern vim.lpeg.Pattern|string|integer|boolean|table|function
|
||||
--- @param subject string
|
||||
--- @param init? integer
|
||||
--- @return integer|vim.lpeg.Capture|nil
|
||||
function vim.lpeg.match(pattern, subject, init) end
|
||||
--- @param ... any
|
||||
--- @return any ...
|
||||
function vim.lpeg.match(pattern, subject, init, ...) end
|
||||
|
||||
--- Matches the given `pattern` against the `subject` string. If the match succeeds, returns the
|
||||
--- index in the subject of the first character after the match, or the captured values (if the
|
||||
@@ -81,8 +83,9 @@ function vim.lpeg.match(pattern, subject, init) end
|
||||
---
|
||||
--- @param subject string
|
||||
--- @param init? integer
|
||||
--- @return integer|vim.lpeg.Capture|nil
|
||||
function Pattern:match(subject, init) end
|
||||
--- @param ... any
|
||||
--- @return any ...
|
||||
function Pattern:match(subject, init, ...) end
|
||||
|
||||
--- Returns the string `"pattern"` if the given value is a pattern, otherwise `nil`.
|
||||
---
|
||||
@@ -123,7 +126,7 @@ function vim.lpeg.P(value) end
|
||||
--- Pattern `patt` must match only strings with some fixed length, and it cannot contain captures.
|
||||
--- Like the `and` predicate, this pattern never consumes any input, independently of success or failure.
|
||||
---
|
||||
--- @param pattern vim.lpeg.Pattern
|
||||
--- @param pattern vim.lpeg.Pattern|string|integer|boolean|table
|
||||
--- @return vim.lpeg.Pattern
|
||||
function vim.lpeg.B(pattern) end
|
||||
|
||||
@@ -163,7 +166,7 @@ function vim.lpeg.S(string) end
|
||||
--- assert(b:match('(') == nil)
|
||||
--- ```
|
||||
---
|
||||
--- @param v string|integer
|
||||
--- @param v boolean|string|number|function|table|thread|userdata|lightuserdata
|
||||
--- @return vim.lpeg.Pattern
|
||||
function vim.lpeg.V(v) end
|
||||
|
||||
@@ -227,7 +230,7 @@ function vim.lpeg.locale(tab) end
|
||||
--- assert(c == 'c')
|
||||
--- ```
|
||||
---
|
||||
--- @param patt vim.lpeg.Pattern
|
||||
--- @param patt vim.lpeg.Pattern|string|integer|boolean|table|function
|
||||
--- @return vim.lpeg.Capture
|
||||
function vim.lpeg.C(patt) end
|
||||
|
||||
@@ -258,7 +261,7 @@ function vim.lpeg.Cc(...) end
|
||||
--- `func(...func(func(C1, C2), C3)...,Cn)`, that is, it will fold (or accumulate, or reduce) the captures from
|
||||
--- `patt` using function `func`. This capture assumes that `patt` should produce at least one capture with at
|
||||
--- least one value (of any type), which becomes the initial value of an accumulator. (If you need a specific
|
||||
--- initial value, you may prefix a constant captureto `patt`.) For each subsequent capture, LPeg calls `func`
|
||||
--- initial value, you may prefix a constant capture to `patt`.) For each subsequent capture, LPeg calls `func`
|
||||
--- with this accumulator as the first argument and all values produced by the capture as extra arguments;
|
||||
--- the first result from this call becomes the new value for the accumulator. The final value of the accumulator
|
||||
--- becomes the captured value.
|
||||
@@ -273,7 +276,7 @@ function vim.lpeg.Cc(...) end
|
||||
--- assert(sum:match('10,30,43') == 83)
|
||||
--- ```
|
||||
---
|
||||
--- @param patt vim.lpeg.Pattern
|
||||
--- @param patt vim.lpeg.Pattern|string|integer|boolean|table|function
|
||||
--- @param func fun(acc, newvalue)
|
||||
--- @return vim.lpeg.Capture
|
||||
function vim.lpeg.Cf(patt, func) end
|
||||
@@ -282,7 +285,7 @@ function vim.lpeg.Cf(patt, func) end
|
||||
--- The group may be anonymous (if no name is given) or named with the given name (which
|
||||
--- can be any non-nil Lua value).
|
||||
---
|
||||
--- @param patt vim.lpeg.Pattern
|
||||
--- @param patt vim.lpeg.Pattern|string|integer|boolean|table|function
|
||||
--- @param name? string
|
||||
--- @return vim.lpeg.Capture
|
||||
function vim.lpeg.Cg(patt, name) end
|
||||
@@ -320,7 +323,7 @@ function vim.lpeg.Cp() end
|
||||
--- assert(gsub('Hello, xxx!', 'xxx', 'World') == 'Hello, World!')
|
||||
--- ```
|
||||
---
|
||||
--- @param patt vim.lpeg.Pattern
|
||||
--- @param patt vim.lpeg.Pattern|string|integer|boolean|table|function
|
||||
--- @return vim.lpeg.Capture
|
||||
function vim.lpeg.Cs(patt) end
|
||||
|
||||
@@ -329,7 +332,7 @@ function vim.lpeg.Cs(patt) end
|
||||
--- Moreover, for each named capture group created by `patt`, the first value of the group is put into
|
||||
--- the table with the group name as its key. The captured value is only the table.
|
||||
---
|
||||
--- @param patt vim.lpeg.Pattern|''
|
||||
--- @param patt vim.lpeg.Pattern|string|integer|boolean|table|function
|
||||
--- @return vim.lpeg.Capture
|
||||
function vim.lpeg.Ct(patt) end
|
||||
|
||||
@@ -343,7 +346,7 @@ function vim.lpeg.Ct(patt) end
|
||||
--- (so, to return true is equivalent to return `i`). If the call returns `false`, `nil`, or no value, the match fails.
|
||||
--- Any extra values returned by the function become the values produced by the capture.
|
||||
---
|
||||
--- @param patt vim.lpeg.Pattern
|
||||
--- @param fn function
|
||||
--- @param patt vim.lpeg.Pattern|string|integer|boolean|table|function
|
||||
--- @param fn fun(s: string, i: integer, ...: any): (position: boolean|integer, ...: any)
|
||||
--- @return vim.lpeg.Capture
|
||||
function vim.lpeg.Cmt(patt, fn) end
|
||||
|
17
runtime/lua/vim/_meta/options.lua
generated
17
runtime/lua/vim/_meta/options.lua
generated
@@ -544,7 +544,7 @@ vim.wo.bri = vim.wo.breakindent
|
||||
--- applying 'breakindent', even if the resulting
|
||||
--- text should normally be narrower. This prevents
|
||||
--- text indented almost to the right window border
|
||||
--- occupying lot of vertical space when broken.
|
||||
--- occupying lots of vertical space when broken.
|
||||
--- (default: 20)
|
||||
--- shift:{n} After applying 'breakindent', the wrapped line's
|
||||
--- beginning will be shifted by the given number of
|
||||
@@ -3330,7 +3330,7 @@ vim.go.is = vim.go.incsearch
|
||||
--- in Insert mode as specified with the 'indentkeys' option.
|
||||
--- When this option is not empty, it overrules the 'cindent' and
|
||||
--- 'smartindent' indenting. When 'lisp' is set, this option is
|
||||
--- is only used when 'lispoptions' contains "expr:1".
|
||||
--- only used when 'lispoptions' contains "expr:1".
|
||||
--- The expression is evaluated with `v:lnum` set to the line number for
|
||||
--- which the indent is to be computed. The cursor is also in this line
|
||||
--- when the expression is evaluated (but it may be moved around).
|
||||
@@ -3628,7 +3628,7 @@ vim.go.kp = vim.go.keywordprg
|
||||
--- part can be in one of two forms:
|
||||
--- 1. A list of pairs. Each pair is a "from" character immediately
|
||||
--- followed by the "to" character. Examples: "aA", "aAbBcC".
|
||||
--- 2. A list of "from" characters, a semi-colon and a list of "to"
|
||||
--- 2. A list of "from" characters, a semicolon and a list of "to"
|
||||
--- characters. Example: "abc;ABC"
|
||||
--- Example: "aA,fgh;FGH,cCdDeE"
|
||||
--- Special characters need to be preceded with a backslash. These are
|
||||
@@ -3720,7 +3720,7 @@ vim.go.ls = vim.go.laststatus
|
||||
--- update use `:redraw`.
|
||||
--- This may occasionally cause display errors. It is only meant to be set
|
||||
--- temporarily when performing an operation where redrawing may cause
|
||||
--- flickering or cause a slow down.
|
||||
--- flickering or cause a slowdown.
|
||||
---
|
||||
--- @type boolean
|
||||
vim.o.lazyredraw = false
|
||||
@@ -3820,6 +3820,9 @@ vim.go.lw = vim.go.lispwords
|
||||
--- between tabs and spaces and for trailing blanks. Further changed by
|
||||
--- the 'listchars' option.
|
||||
---
|
||||
--- When 'listchars' does not contain "tab" field, tabs are shown as "^I"
|
||||
--- or "<09>", like how unprintable characters are displayed.
|
||||
---
|
||||
--- The cursor is displayed at the start of the space a Tab character
|
||||
--- occupies, not at the end as usual in Normal mode. To get this cursor
|
||||
--- position while displaying Tabs with spaces, use:
|
||||
@@ -4757,7 +4760,7 @@ vim.go.pm = vim.go.patchmode
|
||||
--- ```
|
||||
--- To use an environment variable, you probably need to replace the
|
||||
--- separator. Here is an example to append $INCL, in which directory
|
||||
--- names are separated with a semi-colon:
|
||||
--- names are separated with a semicolon:
|
||||
---
|
||||
--- ```vim
|
||||
--- let &path = &path .. "," .. substitute($INCL, ';', ',', 'g')
|
||||
@@ -5764,7 +5767,7 @@ vim.bo.shiftwidth = vim.o.shiftwidth
|
||||
vim.bo.sw = vim.bo.shiftwidth
|
||||
|
||||
--- This option helps to avoid all the `hit-enter` prompts caused by file
|
||||
--- messages, for example with CTRL-G, and to avoid some other messages.
|
||||
--- messages, for example with CTRL-G, and to avoid some other messages.
|
||||
--- It is a list of flags:
|
||||
--- flag meaning when present ~
|
||||
--- l use "999L, 888B" instead of "999 lines, 888 bytes" *shm-l*
|
||||
@@ -6249,7 +6252,7 @@ vim.bo.spo = vim.bo.spelloptions
|
||||
--- minus two.
|
||||
---
|
||||
--- timeout:{millisec} Limit the time searching for suggestions to
|
||||
--- {millisec} milli seconds. Applies to the following
|
||||
--- {millisec} milliseconds. Applies to the following
|
||||
--- methods. When omitted the limit is 5000. When
|
||||
--- negative there is no limit.
|
||||
---
|
||||
|
40
runtime/lua/vim/_meta/vimfn.lua
generated
40
runtime/lua/vim/_meta/vimfn.lua
generated
@@ -3569,8 +3569,8 @@ function vim.fn.getreginfo(regname) end
|
||||
--- difference if the buffer is displayed in a window with
|
||||
--- different 'virtualedit' or 'list' values.
|
||||
---
|
||||
--- Examples: >
|
||||
--- :xnoremap <CR>
|
||||
--- Examples: >vim
|
||||
--- xnoremap <CR>
|
||||
--- \ <Cmd>echom getregion(
|
||||
--- \ getpos('v'), getpos('.'), #{ type: mode() })<CR>
|
||||
--- <
|
||||
@@ -4233,7 +4233,7 @@ function vim.fn.iconv(string, from, to) end
|
||||
--- Note that `v:_null_string`, `v:_null_list`, `v:_null_dict` and
|
||||
--- `v:_null_blob` have the same `id()` with different types
|
||||
--- because they are internally represented as NULL pointers.
|
||||
--- `id()` returns a hexadecimal representanion of the pointers to
|
||||
--- `id()` returns a hexadecimal representation of the pointers to
|
||||
--- the containers (i.e. like `0x994a40`), same as `printf("%p",
|
||||
--- {expr})`, but it is advised against counting on the exact
|
||||
--- format of the return value.
|
||||
@@ -5538,19 +5538,19 @@ function vim.fn.matcharg(nr) end
|
||||
---
|
||||
--- Examples: >vim
|
||||
--- " Assuming line 3 in buffer 5 contains "a"
|
||||
--- :echo matchbufline(5, '\<\k\+\>', 3, 3)
|
||||
--- [{'lnum': 3, 'byteidx': 0, 'text': 'a'}]
|
||||
--- echo matchbufline(5, '\<\k\+\>', 3, 3)
|
||||
--- < `[{'lnum': 3, 'byteidx': 0, 'text': 'a'}]` >vim
|
||||
--- " Assuming line 4 in buffer 10 contains "tik tok"
|
||||
--- :echo matchbufline(10, '\<\k\+\>', 1, 4)
|
||||
--- [{'lnum': 4, 'byteidx': 0, 'text': 'tik'}, {'lnum': 4, 'byteidx': 4, 'text': 'tok'}]
|
||||
--- <
|
||||
--- echo matchbufline(10, '\<\k\+\>', 1, 4)
|
||||
--- < `[{'lnum': 4, 'byteidx': 0, 'text': 'tik'}, {'lnum': 4, 'byteidx': 4, 'text': 'tok'}]`
|
||||
---
|
||||
--- If {submatch} is present and is v:true, then submatches like
|
||||
--- "\1", "\2", etc. are also returned. Example: >vim
|
||||
--- " Assuming line 2 in buffer 2 contains "acd"
|
||||
--- :echo matchbufline(2, '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2, 2
|
||||
--- echo matchbufline(2, '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2, 2
|
||||
--- \ {'submatches': v:true})
|
||||
--- [{'lnum': 2, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]
|
||||
--- <The "submatches" List always contains 9 items. If a submatch
|
||||
--- < `[{'lnum': 2, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]`
|
||||
--- The "submatches" List always contains 9 items. If a submatch
|
||||
--- is not found, then an empty string is returned for that
|
||||
--- submatch.
|
||||
---
|
||||
@@ -5749,17 +5749,17 @@ function vim.fn.matchstr(expr, pat, start, count) end
|
||||
--- option settings on the pattern.
|
||||
---
|
||||
--- Example: >vim
|
||||
--- :echo matchstrlist(['tik tok'], '\<\k\+\>')
|
||||
--- [{'idx': 0, 'byteidx': 0, 'text': 'tik'}, {'idx': 0, 'byteidx': 4, 'text': 'tok'}]
|
||||
--- :echo matchstrlist(['a', 'b'], '\<\k\+\>')
|
||||
--- [{'idx': 0, 'byteidx': 0, 'text': 'a'}, {'idx': 1, 'byteidx': 0, 'text': 'b'}]
|
||||
--- <
|
||||
--- echo matchstrlist(['tik tok'], '\<\k\+\>')
|
||||
--- < `[{'idx': 0, 'byteidx': 0, 'text': 'tik'}, {'idx': 0, 'byteidx': 4, 'text': 'tok'}]` >vim
|
||||
--- echo matchstrlist(['a', 'b'], '\<\k\+\>')
|
||||
--- < `[{'idx': 0, 'byteidx': 0, 'text': 'a'}, {'idx': 1, 'byteidx': 0, 'text': 'b'}]`
|
||||
---
|
||||
--- If "submatches" is present and is v:true, then submatches like
|
||||
--- "\1", "\2", etc. are also returned. Example: >vim
|
||||
--- :echo matchstrlist(['acd'], '\(a\)\?\(b\)\?\(c\)\?\(.*\)',
|
||||
--- echo matchstrlist(['acd'], '\(a\)\?\(b\)\?\(c\)\?\(.*\)',
|
||||
--- \ #{submatches: v:true})
|
||||
--- [{'idx': 0, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]
|
||||
--- <The "submatches" List always contains 9 items. If a submatch
|
||||
--- < `[{'idx': 0, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]`
|
||||
--- The "submatches" List always contains 9 items. If a submatch
|
||||
--- is not found, then an empty string is returned for that
|
||||
--- submatch.
|
||||
---
|
||||
@@ -7199,7 +7199,7 @@ function vim.fn.screenchars(row, col) end
|
||||
--- the following mappings: >vim
|
||||
--- nnoremap <expr> GG ":echom " .. screencol() .. "\n"
|
||||
--- nnoremap <silent> GG :echom screencol()<CR>
|
||||
--- noremap GG <Cmd>echom screencol()<Cr>
|
||||
--- noremap GG <Cmd>echom screencol()<CR>
|
||||
--- <
|
||||
---
|
||||
--- @return any
|
||||
|
@@ -594,7 +594,7 @@ function M.frm(_, bufnr)
|
||||
end
|
||||
|
||||
--- @type vim.filetype.mapfn
|
||||
function M.fvwm_1(_, _)
|
||||
function M.fvwm_v1(_, _)
|
||||
return 'fvwm', function(bufnr)
|
||||
vim.b[bufnr].fvwm_version = 1
|
||||
end
|
||||
@@ -1331,7 +1331,7 @@ end
|
||||
function M.sgml(_, bufnr)
|
||||
local lines = table.concat(getlines(bufnr, 1, 5))
|
||||
if lines:find('linuxdoc') then
|
||||
return 'smgllnx'
|
||||
return 'sgmllnx'
|
||||
elseif lines:find('<!DOCTYPE.*DocBook') then
|
||||
return 'docbk',
|
||||
function(b)
|
||||
|
@@ -328,8 +328,11 @@ function M.find(names, opts)
|
||||
return matches
|
||||
end
|
||||
|
||||
--- Find the first parent directory containing a specific "marker", relative to a buffer's
|
||||
--- directory.
|
||||
--- Find the first parent directory containing a specific "marker", relative to a file path or
|
||||
--- buffer.
|
||||
---
|
||||
--- If the buffer is unnamed (has no backing file) or has a non-empty 'buftype' then the search
|
||||
--- begins from Nvim's |current-directory|.
|
||||
---
|
||||
--- Example:
|
||||
---
|
||||
@@ -346,13 +349,13 @@ end
|
||||
--- end)
|
||||
--- ```
|
||||
---
|
||||
--- @param source integer|string Buffer number (0 for current buffer) or file path to begin the
|
||||
--- search from.
|
||||
--- @param source integer|string Buffer number (0 for current buffer) or file path (absolute or
|
||||
--- relative to the |current-directory|) to begin the search from.
|
||||
--- @param marker (string|string[]|fun(name: string, path: string): boolean) A marker, or list
|
||||
--- of markers, to search for. If a function, the function is called for each
|
||||
--- evaluated item and should return true if {name} and {path} are a match.
|
||||
--- @return string? # Directory path containing one of the given markers, or nil if no directory was
|
||||
--- found.
|
||||
--- found.
|
||||
function M.root(source, marker)
|
||||
assert(source, 'missing required argument: source')
|
||||
assert(marker, 'missing required argument: marker')
|
||||
@@ -361,14 +364,18 @@ function M.root(source, marker)
|
||||
if type(source) == 'string' then
|
||||
path = source
|
||||
elseif type(source) == 'number' then
|
||||
path = vim.api.nvim_buf_get_name(source)
|
||||
if vim.bo[source].buftype ~= '' then
|
||||
path = assert(vim.uv.cwd())
|
||||
else
|
||||
path = vim.api.nvim_buf_get_name(source)
|
||||
end
|
||||
else
|
||||
error('invalid type for argument "source": expected string or buffer number')
|
||||
end
|
||||
|
||||
local paths = M.find(marker, {
|
||||
upward = true,
|
||||
path = path,
|
||||
path = vim.fn.fnamemodify(path, ':p:h'),
|
||||
})
|
||||
|
||||
if #paths == 0 then
|
||||
|
@@ -306,7 +306,7 @@ function M.system(cmd, args)
|
||||
|
||||
if jobid < 1 then
|
||||
local message =
|
||||
string.format('Command error (job=%d): %s (in %s)', jobid, shellify(cmd), vim.loop.cwd())
|
||||
string.format('Command error (job=%d): %s (in %s)', jobid, shellify(cmd), vim.uv.cwd())
|
||||
error(message)
|
||||
return opts.output, 1
|
||||
end
|
||||
@@ -325,7 +325,7 @@ function M.system(cmd, args)
|
||||
jobid,
|
||||
shell_error_code,
|
||||
shellify(cmd),
|
||||
vim.loop.cwd()
|
||||
vim.uv.cwd()
|
||||
)
|
||||
if opts.output:find('%S') then
|
||||
emsg = string.format('%s\noutput: %s', emsg, opts.output)
|
||||
|
@@ -64,6 +64,8 @@ lsp._request_name_to_capability = {
|
||||
[ms.textDocument_inlayHint] = { 'inlayHintProvider' },
|
||||
[ms.textDocument_diagnostic] = { 'diagnosticProvider' },
|
||||
[ms.inlayHint_resolve] = { 'inlayHintProvider', 'resolveProvider' },
|
||||
[ms.textDocument_documentLink] = { 'documentLinkProvider' },
|
||||
[ms.documentLink_resolve] = { 'documentLinkProvider', 'resolveProvider' },
|
||||
}
|
||||
|
||||
-- TODO improve handling of scratch buffers with LSP attached.
|
||||
@@ -373,7 +375,7 @@ local function reset_defaults(bufnr)
|
||||
end
|
||||
api.nvim_buf_call(bufnr, function()
|
||||
local keymap = vim.fn.maparg('K', 'n', false, true)
|
||||
if keymap and keymap.callback == vim.lsp.buf.hover then
|
||||
if keymap and keymap.callback == vim.lsp.buf.hover and keymap.buffer == 1 then
|
||||
vim.keymap.del('n', 'K', { buffer = bufnr })
|
||||
end
|
||||
end)
|
||||
@@ -385,8 +387,8 @@ end
|
||||
local function on_client_exit(code, signal, client_id)
|
||||
local client = all_clients[client_id]
|
||||
|
||||
for bufnr in pairs(client.attached_buffers) do
|
||||
vim.schedule(function()
|
||||
vim.schedule(function()
|
||||
for bufnr in pairs(client.attached_buffers) do
|
||||
if client and client.attached_buffers[bufnr] then
|
||||
api.nvim_exec_autocmds('LspDetach', {
|
||||
buffer = bufnr,
|
||||
@@ -395,15 +397,16 @@ local function on_client_exit(code, signal, client_id)
|
||||
})
|
||||
end
|
||||
|
||||
local namespace = vim.lsp.diagnostic.get_namespace(client_id)
|
||||
vim.diagnostic.reset(namespace, bufnr)
|
||||
client.attached_buffers[bufnr] = nil
|
||||
|
||||
if #lsp.get_clients({ bufnr = bufnr, _uninitialized = true }) == 0 then
|
||||
reset_defaults(bufnr)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
local namespace = vim.lsp.diagnostic.get_namespace(client_id)
|
||||
vim.diagnostic.reset(namespace)
|
||||
end)
|
||||
|
||||
local name = client.name or 'unknown'
|
||||
|
||||
@@ -495,6 +498,29 @@ local function text_document_did_save_handler(bufnr)
|
||||
end
|
||||
end
|
||||
|
||||
---@param bufnr integer resolved buffer
|
||||
---@param client vim.lsp.Client
|
||||
local function buf_detach_client(bufnr, client)
|
||||
api.nvim_exec_autocmds('LspDetach', {
|
||||
buffer = bufnr,
|
||||
modeline = false,
|
||||
data = { client_id = client.id },
|
||||
})
|
||||
|
||||
changetracking.reset_buf(client, bufnr)
|
||||
|
||||
if vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'openClose') then
|
||||
local uri = vim.uri_from_bufnr(bufnr)
|
||||
local params = { textDocument = { uri = uri } }
|
||||
client.notify(ms.textDocument_didClose, params)
|
||||
end
|
||||
|
||||
client.attached_buffers[bufnr] = nil
|
||||
|
||||
local namespace = lsp.diagnostic.get_namespace(client.id)
|
||||
vim.diagnostic.reset(namespace, bufnr)
|
||||
end
|
||||
|
||||
--- @type table<integer,true>
|
||||
local attached_buffers = {}
|
||||
|
||||
@@ -547,36 +573,34 @@ local function buf_attach(bufnr)
|
||||
api.nvim_buf_attach(bufnr, false, {
|
||||
on_lines = function(_, _, changedtick, firstline, lastline, new_lastline)
|
||||
if #lsp.get_clients({ bufnr = bufnr }) == 0 then
|
||||
return true -- detach
|
||||
-- detach if there are no clients
|
||||
return #lsp.get_clients({ bufnr = bufnr, _uninitialized = true }) == 0
|
||||
end
|
||||
util.buf_versions[bufnr] = changedtick
|
||||
changetracking.send_changes(bufnr, firstline, lastline, new_lastline)
|
||||
end,
|
||||
|
||||
on_reload = function()
|
||||
local clients = lsp.get_clients({ bufnr = bufnr })
|
||||
local params = { textDocument = { uri = uri } }
|
||||
for _, client in ipairs(lsp.get_clients({ bufnr = bufnr })) do
|
||||
for _, client in ipairs(clients) do
|
||||
changetracking.reset_buf(client, bufnr)
|
||||
if vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'openClose') then
|
||||
client.notify(ms.textDocument_didClose, params)
|
||||
end
|
||||
end
|
||||
for _, client in ipairs(clients) do
|
||||
client:_text_document_did_open_handler(bufnr)
|
||||
end
|
||||
end,
|
||||
|
||||
on_detach = function()
|
||||
local params = { textDocument = { uri = uri } }
|
||||
for _, client in ipairs(lsp.get_clients({ bufnr = bufnr })) do
|
||||
changetracking.reset_buf(client, bufnr)
|
||||
if vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'openClose') then
|
||||
client.notify(ms.textDocument_didClose, params)
|
||||
end
|
||||
local clients = lsp.get_clients({ bufnr = bufnr, _uninitialized = true })
|
||||
for _, client in ipairs(clients) do
|
||||
buf_detach_client(bufnr, client)
|
||||
end
|
||||
for _, client in ipairs(all_clients) do
|
||||
client.attached_buffers[bufnr] = nil
|
||||
end
|
||||
util.buf_versions[bufnr] = nil
|
||||
attached_buffers[bufnr] = nil
|
||||
util.buf_versions[bufnr] = nil
|
||||
end,
|
||||
|
||||
-- TODO if we know all of the potential clients ahead of time, then we
|
||||
@@ -650,27 +674,9 @@ function lsp.buf_detach_client(bufnr, client_id)
|
||||
)
|
||||
)
|
||||
return
|
||||
else
|
||||
buf_detach_client(bufnr, client)
|
||||
end
|
||||
|
||||
api.nvim_exec_autocmds('LspDetach', {
|
||||
buffer = bufnr,
|
||||
modeline = false,
|
||||
data = { client_id = client_id },
|
||||
})
|
||||
|
||||
changetracking.reset_buf(client, bufnr)
|
||||
|
||||
if vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'openClose') then
|
||||
local uri = vim.uri_from_bufnr(bufnr)
|
||||
local params = { textDocument = { uri = uri } }
|
||||
client.notify(ms.textDocument_didClose, params)
|
||||
end
|
||||
|
||||
client.attached_buffers[bufnr] = nil
|
||||
util.buf_versions[bufnr] = nil
|
||||
|
||||
local namespace = lsp.diagnostic.get_namespace(client_id)
|
||||
vim.diagnostic.reset(namespace, bufnr)
|
||||
end
|
||||
|
||||
--- Checks if a buffer is attached for a particular client.
|
||||
@@ -844,17 +850,20 @@ api.nvim_create_autocmd('VimLeavePre', {
|
||||
---@param params table|nil Parameters to send to the server
|
||||
---@param handler? lsp.Handler See |lsp-handler|
|
||||
--- If nil, follows resolution strategy defined in |lsp-handler-configuration|
|
||||
---
|
||||
---@param on_unsupported? fun()
|
||||
--- The function to call when the buffer has no clients that support the given method.
|
||||
--- Defaults to an `ERROR` level notification.
|
||||
---@return table<integer, integer> client_request_ids Map of client-id:request-id pairs
|
||||
---for all successful requests.
|
||||
---@return function _cancel_all_requests Function which can be used to
|
||||
---cancel all the requests. You could instead
|
||||
---iterate all clients and call their `cancel_request()` methods.
|
||||
function lsp.buf_request(bufnr, method, params, handler)
|
||||
function lsp.buf_request(bufnr, method, params, handler, on_unsupported)
|
||||
validate({
|
||||
bufnr = { bufnr, 'n', true },
|
||||
method = { method, 's' },
|
||||
handler = { handler, 'f', true },
|
||||
on_unsupported = { on_unsupported, 'f', true },
|
||||
})
|
||||
|
||||
bufnr = resolve_bufnr(bufnr)
|
||||
@@ -876,7 +885,11 @@ function lsp.buf_request(bufnr, method, params, handler)
|
||||
|
||||
-- if has client but no clients support the given method, notify the user
|
||||
if next(clients) and not method_supported then
|
||||
vim.notify(lsp._unsupported_method(method), vim.log.levels.ERROR)
|
||||
if on_unsupported == nil then
|
||||
vim.notify(lsp._unsupported_method(method), vim.log.levels.ERROR)
|
||||
else
|
||||
on_unsupported()
|
||||
end
|
||||
vim.cmd.redraw()
|
||||
return {}, function() end
|
||||
end
|
||||
|
@@ -182,7 +182,7 @@ local validate = vim.validate
|
||||
--- It can be `null` if the client supports workspace folders but none are
|
||||
--- configured.
|
||||
--- @field workspace_folders lsp.WorkspaceFolder[]?
|
||||
--- @field root_dir string
|
||||
--- @field root_dir string?
|
||||
---
|
||||
--- @field attached_buffers table<integer,true>
|
||||
---
|
||||
@@ -470,7 +470,6 @@ function Client.create(config)
|
||||
_on_exit_cbs = ensure_list(config.on_exit),
|
||||
_on_attach_cbs = ensure_list(config.on_attach),
|
||||
_on_error_cb = config.on_error,
|
||||
_root_dir = config.root_dir,
|
||||
_trace = get_trace(config.trace),
|
||||
|
||||
--- Contains $/progress report messages.
|
||||
@@ -612,7 +611,10 @@ function Client:initialize()
|
||||
self:_run_callbacks(self._on_init_cbs, lsp.client_errors.ON_INIT_CALLBACK_ERROR, self, result)
|
||||
|
||||
for buf in pairs(reattach_bufs) do
|
||||
self:_on_attach(buf)
|
||||
-- The buffer may have been detached in the on_init callback.
|
||||
if self.attached_buffers[buf] then
|
||||
self:_on_attach(buf)
|
||||
end
|
||||
end
|
||||
|
||||
log.info(
|
||||
|
@@ -164,7 +164,7 @@ function M.display(lenses, bufnr, client_id)
|
||||
return a.range.start.character < b.range.start.character
|
||||
end)
|
||||
for j, lens in ipairs(line_lenses) do
|
||||
local text = lens.command and lens.command.title or 'Unresolved lens ...'
|
||||
local text = (lens.command and lens.command.title or 'Unresolved lens ...'):gsub('%s+', ' ')
|
||||
table.insert(chunks, { text, 'LspCodeLens' })
|
||||
if j < num_line_lenses then
|
||||
table.insert(chunks, { ' | ', 'LspCodeLensSeparator' })
|
||||
@@ -307,7 +307,13 @@ function M.refresh(opts)
|
||||
}
|
||||
active_refreshes[buf] = true
|
||||
|
||||
local request_ids = vim.lsp.buf_request(buf, ms.textDocument_codeLens, params, M.on_codelens)
|
||||
local request_ids = vim.lsp.buf_request(
|
||||
buf,
|
||||
ms.textDocument_codeLens,
|
||||
params,
|
||||
M.on_codelens,
|
||||
function() end
|
||||
)
|
||||
if vim.tbl_isempty(request_ids) then
|
||||
active_refreshes[buf] = nil
|
||||
end
|
||||
|
@@ -33,16 +33,25 @@ local function check_active_clients()
|
||||
local clients = vim.lsp.get_clients()
|
||||
if next(clients) then
|
||||
for _, client in pairs(clients) do
|
||||
local attached_to = table.concat(vim.tbl_keys(client.attached_buffers or {}), ',')
|
||||
report_info(
|
||||
local cmd ---@type string
|
||||
if type(client.config.cmd) == 'table' then
|
||||
cmd = table.concat(client.config.cmd --[[@as table]], ' ')
|
||||
elseif type(client.config.cmd) == 'function' then
|
||||
cmd = tostring(client.config.cmd)
|
||||
end
|
||||
report_info(table.concat({
|
||||
string.format('%s (id: %d)', client.name, client.id),
|
||||
string.format(
|
||||
'%s (id=%s, root_dir=%s, attached_to=[%s])',
|
||||
client.name,
|
||||
client.id,
|
||||
vim.fn.fnamemodify(client.root_dir, ':~'),
|
||||
attached_to
|
||||
)
|
||||
)
|
||||
' Root directory: %s',
|
||||
client.root_dir and vim.fn.fnamemodify(client.root_dir, ':~') or nil
|
||||
),
|
||||
string.format(' Command: %s', cmd),
|
||||
string.format(' Settings: %s', vim.inspect(client.settings, { newline = '\n ' })),
|
||||
string.format(
|
||||
' Attached buffers: %s',
|
||||
vim.iter(pairs(client.attached_buffers)):map(tostring):join(', ')
|
||||
),
|
||||
}, '\n'))
|
||||
end
|
||||
else
|
||||
report_info('No active clients')
|
||||
@@ -50,7 +59,7 @@ local function check_active_clients()
|
||||
end
|
||||
|
||||
local function check_watcher()
|
||||
vim.health.start('vim.lsp: File watcher')
|
||||
vim.health.start('vim.lsp: File Watcher')
|
||||
|
||||
-- Only run the check if file watching has been enabled by a client.
|
||||
local clients = vim.lsp.get_clients()
|
||||
@@ -94,11 +103,68 @@ local function check_watcher()
|
||||
end
|
||||
end
|
||||
|
||||
local function check_position_encodings()
|
||||
vim.health.start('vim.lsp: Position Encodings')
|
||||
local clients = vim.lsp.get_clients()
|
||||
if next(clients) then
|
||||
local position_encodings = {} ---@type table<integer, table<string, integer[]>>
|
||||
for _, client in pairs(clients) do
|
||||
for bufnr in pairs(client.attached_buffers) do
|
||||
if not position_encodings[bufnr] then
|
||||
position_encodings[bufnr] = {}
|
||||
end
|
||||
if not position_encodings[bufnr][client.offset_encoding] then
|
||||
position_encodings[bufnr][client.offset_encoding] = {}
|
||||
end
|
||||
table.insert(position_encodings[bufnr][client.offset_encoding], client.id)
|
||||
end
|
||||
end
|
||||
|
||||
-- Check if any buffers are attached to multiple clients with different position encodings
|
||||
local buffers = {} ---@type integer[]
|
||||
for bufnr, encodings in pairs(position_encodings) do
|
||||
local list = {} ---@type string[]
|
||||
for k in pairs(encodings) do
|
||||
list[#list + 1] = k
|
||||
end
|
||||
|
||||
if #list > 1 then
|
||||
buffers[#buffers + 1] = bufnr
|
||||
end
|
||||
end
|
||||
|
||||
if #buffers > 0 then
|
||||
local lines =
|
||||
{ 'Found buffers attached to multiple clients with different position encodings.' }
|
||||
for _, bufnr in ipairs(buffers) do
|
||||
local encodings = position_encodings[bufnr]
|
||||
local parts = {}
|
||||
for encoding, client_ids in pairs(encodings) do
|
||||
table.insert(
|
||||
parts,
|
||||
string.format('%s (client id(s): %s)', encoding:upper(), table.concat(client_ids, ', '))
|
||||
)
|
||||
end
|
||||
table.insert(lines, string.format('- Buffer %d: %s', bufnr, table.concat(parts, ', ')))
|
||||
end
|
||||
report_warn(
|
||||
table.concat(lines, '\n'),
|
||||
'Use the positionEncodings client capability to ensure all clients use the same position encoding'
|
||||
)
|
||||
else
|
||||
report_info('No buffers contain mixed position encodings')
|
||||
end
|
||||
else
|
||||
report_info('No active clients')
|
||||
end
|
||||
end
|
||||
|
||||
--- Performs a healthcheck for LSP
|
||||
function M.check()
|
||||
check_log()
|
||||
check_active_clients()
|
||||
check_watcher()
|
||||
check_position_encodings()
|
||||
end
|
||||
|
||||
return M
|
||||
|
@@ -336,6 +336,8 @@ api.nvim_set_decoration_provider(namespace, {
|
||||
for lnum = topline, botline do
|
||||
if bufstate.applied[lnum] ~= bufstate.version then
|
||||
api.nvim_buf_clear_namespace(bufnr, namespace, lnum, lnum + 1)
|
||||
|
||||
local hint_virtual_texts = {} --- @type table<integer, [string, string?][]>
|
||||
for _, lnum_hints in pairs(client_hints) do
|
||||
local hints = lnum_hints[lnum] or {}
|
||||
for _, hint in pairs(hints) do
|
||||
@@ -348,7 +350,7 @@ api.nvim_set_decoration_provider(namespace, {
|
||||
text = text .. part.value
|
||||
end
|
||||
end
|
||||
local vt = {} --- @type {[1]: string, [2]: string?}[]
|
||||
local vt = hint_virtual_texts[hint.position.character] or {}
|
||||
if hint.paddingLeft then
|
||||
vt[#vt + 1] = { ' ' }
|
||||
end
|
||||
@@ -356,13 +358,18 @@ api.nvim_set_decoration_provider(namespace, {
|
||||
if hint.paddingRight then
|
||||
vt[#vt + 1] = { ' ' }
|
||||
end
|
||||
api.nvim_buf_set_extmark(bufnr, namespace, lnum, hint.position.character, {
|
||||
virt_text_pos = 'inline',
|
||||
ephemeral = false,
|
||||
virt_text = vt,
|
||||
})
|
||||
hint_virtual_texts[hint.position.character] = vt
|
||||
end
|
||||
end
|
||||
|
||||
for pos, vt in pairs(hint_virtual_texts) do
|
||||
api.nvim_buf_set_extmark(bufnr, namespace, lnum, pos, {
|
||||
virt_text_pos = 'inline',
|
||||
ephemeral = false,
|
||||
virt_text = vt,
|
||||
})
|
||||
end
|
||||
|
||||
bufstate.applied[lnum] = bufstate.version
|
||||
end
|
||||
end
|
||||
@@ -370,7 +377,7 @@ api.nvim_set_decoration_provider(namespace, {
|
||||
})
|
||||
|
||||
--- Query whether inlay hint is enabled in the {filter}ed scope
|
||||
--- @param filter vim.lsp.inlay_hint.enable.Filter
|
||||
--- @param filter? vim.lsp.inlay_hint.enable.Filter
|
||||
--- @return boolean
|
||||
--- @since 12
|
||||
function M.is_enabled(filter)
|
||||
|
@@ -197,12 +197,6 @@ function STHighlighter.new(bufnr)
|
||||
highlighter:send_request()
|
||||
end
|
||||
end,
|
||||
on_detach = function(_, buf)
|
||||
local highlighter = STHighlighter.active[buf]
|
||||
if highlighter then
|
||||
highlighter:destroy()
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
api.nvim_create_autocmd({ 'BufWinEnter', 'InsertLeave' }, {
|
||||
|
@@ -315,7 +315,7 @@ local function select_tabstop(tabstop)
|
||||
move_cursor_to(range[1] + 1, range[2] + 1)
|
||||
feedkeys('v')
|
||||
move_cursor_to(range[3] + 1, range[4])
|
||||
feedkeys('o<c-g>')
|
||||
feedkeys('o<c-g><c-r>_')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -395,6 +395,15 @@ local function setup_autocmds(bufnr)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('BufLeave', {
|
||||
group = snippet_group,
|
||||
desc = 'Stop the snippet session when leaving the buffer',
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
M.stop()
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
--- Expands the given snippet text.
|
||||
@@ -444,7 +453,7 @@ function M.expand(input)
|
||||
local snippet_lines = text_to_lines(snippet_text)
|
||||
-- Get the base indentation based on the current line and the last line of the snippet.
|
||||
if #snippet_lines > 0 then
|
||||
base_indent = base_indent .. (snippet_lines[#snippet_lines]:match('(^%s*)%S') or '') --- @type string
|
||||
base_indent = base_indent .. (snippet_lines[#snippet_lines]:match('(^%s+)%S') or '') --- @type string
|
||||
end
|
||||
|
||||
local shiftwidth = vim.fn.shiftwidth()
|
||||
|
@@ -18,15 +18,19 @@ end
|
||||
--- Hex decode a string.
|
||||
---
|
||||
--- @param enc string String to decode
|
||||
--- @return string : Decoded string
|
||||
--- @return string? : Decoded string
|
||||
--- @return string? : Error message, if any
|
||||
function M.hexdecode(enc)
|
||||
assert(#enc % 2 == 0, 'string must have an even number of hex characters')
|
||||
if #enc % 2 ~= 0 then
|
||||
return nil, 'string must have an even number of hex characters'
|
||||
end
|
||||
|
||||
local str = {} ---@type string[]
|
||||
for i = 1, #enc, 2 do
|
||||
local n = assert(tonumber(enc:sub(i, i + 1), 16))
|
||||
str[#str + 1] = string.char(n)
|
||||
end
|
||||
return table.concat(str)
|
||||
return table.concat(str), nil
|
||||
end
|
||||
|
||||
return M
|
||||
|
@@ -40,7 +40,8 @@ end
|
||||
local function guess_query_lang(buf)
|
||||
local filename = api.nvim_buf_get_name(buf)
|
||||
if filename ~= '' then
|
||||
return vim.F.npcall(vim.fn.fnamemodify, filename, ':p:h:t')
|
||||
local resolved_filename = vim.F.npcall(vim.fn.fnamemodify, filename, ':p:h:t')
|
||||
return resolved_filename and vim.treesitter.language.get_lang(resolved_filename) or nil
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -220,14 +220,13 @@ function TSTreeView:draw(bufnr)
|
||||
|
||||
local text ---@type string
|
||||
if item.node:named() then
|
||||
if item.field then
|
||||
text = string.format('%s: (%s', item.field, item.node:type())
|
||||
else
|
||||
text = string.format('(%s', item.node:type())
|
||||
end
|
||||
text = string.format('(%s', item.node:type())
|
||||
else
|
||||
text = string.format('%q', item.node:type()):gsub('\n', 'n')
|
||||
end
|
||||
if item.field then
|
||||
text = string.format('%s: %s', item.field, text)
|
||||
end
|
||||
|
||||
local next = self:get(i + 1)
|
||||
if not next or next.depth <= item.depth then
|
||||
|
@@ -139,8 +139,11 @@ function TSHighlighter.new(tree, opts)
|
||||
-- but use synload.vim rather than syntax.vim to not enable
|
||||
-- syntax FileType autocmds. Later on we should integrate with the
|
||||
-- `:syntax` and `set syntax=...` machinery properly.
|
||||
-- Still need to ensure that syntaxset augroup exists, so that calling :destroy()
|
||||
-- immediately afterwards will not error.
|
||||
if vim.g.syntax_on ~= 1 then
|
||||
vim.cmd.runtime({ 'syntax/synload.vim', bang = true })
|
||||
vim.api.nvim_create_augroup('syntaxset', { clear = false })
|
||||
end
|
||||
|
||||
api.nvim_buf_call(self.bufnr, function()
|
||||
@@ -377,11 +380,15 @@ function TSHighlighter._on_spell_nav(_, _, buf, srow, _, erow, _)
|
||||
return
|
||||
end
|
||||
|
||||
-- Do not affect potentially populated highlight state. Here we just want a temporary
|
||||
-- empty state so the C code can detect whether the region should be spell checked.
|
||||
local highlight_states = self._highlight_states
|
||||
self:prepare_highlight_states(srow, erow)
|
||||
|
||||
for row = srow, erow do
|
||||
on_line_impl(self, buf, row, true)
|
||||
end
|
||||
self._highlight_states = highlight_states
|
||||
end
|
||||
|
||||
---@private
|
||||
|
@@ -136,7 +136,7 @@ function M.open(path)
|
||||
})
|
||||
local is_uri = path:match('%w+:')
|
||||
if not is_uri then
|
||||
path = vim.fn.expand(path)
|
||||
path = vim.fs.normalize(path)
|
||||
end
|
||||
|
||||
local cmd --- @type string[]
|
||||
|
@@ -26,6 +26,7 @@
|
||||
</screenshots>
|
||||
|
||||
<releases>
|
||||
<release date="2024-07-24" version="0.10.1"/>
|
||||
<release date="2024-05-16" version="0.10.0"/>
|
||||
<release date="2023-12-30" version="0.9.5"/>
|
||||
<release date="2023-10-09" version="0.9.4"/>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
" Vim plugin for showing matching parens
|
||||
" Maintainer: The Vim Project <https://github.com/vim/vim>
|
||||
" Last Change: 2023 Oct 20
|
||||
" Last Change: 2024 May 18
|
||||
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
|
||||
" Exit quickly when:
|
||||
@@ -218,7 +218,7 @@ command NoMatchParen call s:NoMatchParen()
|
||||
|
||||
func s:NoMatchParen()
|
||||
let w = winnr()
|
||||
noau windo silent! call matchdelete(3)
|
||||
noau windo call s:Remove_Matches()
|
||||
unlet! g:loaded_matchparen
|
||||
exe "noau ". w . "wincmd w"
|
||||
au! matchparen
|
||||
|
@@ -5,8 +5,8 @@ vim.g.loaded_2html_plugin = true
|
||||
|
||||
vim.api.nvim_create_user_command('TOhtml', function(args)
|
||||
local outfile = args.args ~= '' and args.args or vim.fn.tempname() .. '.html'
|
||||
local html = require('tohtml').tohtml()
|
||||
local html = require('tohtml').tohtml(0, { range = { args.line1, args.line2 } })
|
||||
vim.fn.writefile(html, outfile)
|
||||
vim.cmd.split(outfile)
|
||||
vim.bo.filetype = 'html'
|
||||
end, { bar = true, nargs = '?' })
|
||||
end, { bar = true, nargs = '?', range = '%' })
|
||||
|
@@ -1,9 +0,0 @@
|
||||
[
|
||||
(function_definition)
|
||||
(if_statement)
|
||||
(case_statement)
|
||||
(for_statement)
|
||||
(while_statement)
|
||||
(c_style_for_statement)
|
||||
(heredoc_redirect)
|
||||
] @fold
|
@@ -1,232 +0,0 @@
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"{"
|
||||
"}"
|
||||
"["
|
||||
"]"
|
||||
"[["
|
||||
"]]"
|
||||
"(("
|
||||
"))"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
";"
|
||||
";;"
|
||||
";&"
|
||||
";;&"
|
||||
"&"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
">"
|
||||
">>"
|
||||
"<"
|
||||
"<<"
|
||||
"&&"
|
||||
"|"
|
||||
"|&"
|
||||
"||"
|
||||
"="
|
||||
"+="
|
||||
"=~"
|
||||
"=="
|
||||
"!="
|
||||
"&>"
|
||||
"&>>"
|
||||
"<&"
|
||||
">&"
|
||||
">|"
|
||||
"<&-"
|
||||
">&-"
|
||||
"<<-"
|
||||
"<<<"
|
||||
".."
|
||||
"!"
|
||||
] @operator
|
||||
|
||||
; Do *not* spell check strings since they typically have some sort of
|
||||
; interpolation in them, or, are typically used for things like filenames, URLs,
|
||||
; flags and file content.
|
||||
[
|
||||
(string)
|
||||
(raw_string)
|
||||
(ansi_c_string)
|
||||
(heredoc_body)
|
||||
] @string
|
||||
|
||||
[
|
||||
(heredoc_start)
|
||||
(heredoc_end)
|
||||
] @label
|
||||
|
||||
(variable_assignment
|
||||
(word) @string)
|
||||
|
||||
(command
|
||||
argument: "$" @string) ; bare dollar
|
||||
|
||||
(concatenation
|
||||
(word) @string)
|
||||
|
||||
[
|
||||
"if"
|
||||
"then"
|
||||
"else"
|
||||
"elif"
|
||||
"fi"
|
||||
"case"
|
||||
"in"
|
||||
"esac"
|
||||
] @keyword.conditional
|
||||
|
||||
[
|
||||
"for"
|
||||
"do"
|
||||
"done"
|
||||
"select"
|
||||
"until"
|
||||
"while"
|
||||
] @keyword.repeat
|
||||
|
||||
[
|
||||
"declare"
|
||||
"typeset"
|
||||
"export"
|
||||
"readonly"
|
||||
"local"
|
||||
"unset"
|
||||
"unsetenv"
|
||||
] @keyword
|
||||
|
||||
"function" @keyword.function
|
||||
|
||||
(special_variable_name) @constant
|
||||
|
||||
; trap -l
|
||||
((word) @constant.builtin
|
||||
(#any-of? @constant.builtin
|
||||
"SIGHUP" "SIGINT" "SIGQUIT" "SIGILL" "SIGTRAP" "SIGABRT" "SIGBUS" "SIGFPE" "SIGKILL" "SIGUSR1"
|
||||
"SIGSEGV" "SIGUSR2" "SIGPIPE" "SIGALRM" "SIGTERM" "SIGSTKFLT" "SIGCHLD" "SIGCONT" "SIGSTOP"
|
||||
"SIGTSTP" "SIGTTIN" "SIGTTOU" "SIGURG" "SIGXCPU" "SIGXFSZ" "SIGVTALRM" "SIGPROF" "SIGWINCH"
|
||||
"SIGIO" "SIGPWR" "SIGSYS" "SIGRTMIN" "SIGRTMIN+1" "SIGRTMIN+2" "SIGRTMIN+3" "SIGRTMIN+4"
|
||||
"SIGRTMIN+5" "SIGRTMIN+6" "SIGRTMIN+7" "SIGRTMIN+8" "SIGRTMIN+9" "SIGRTMIN+10" "SIGRTMIN+11"
|
||||
"SIGRTMIN+12" "SIGRTMIN+13" "SIGRTMIN+14" "SIGRTMIN+15" "SIGRTMAX-14" "SIGRTMAX-13"
|
||||
"SIGRTMAX-12" "SIGRTMAX-11" "SIGRTMAX-10" "SIGRTMAX-9" "SIGRTMAX-8" "SIGRTMAX-7" "SIGRTMAX-6"
|
||||
"SIGRTMAX-5" "SIGRTMAX-4" "SIGRTMAX-3" "SIGRTMAX-2" "SIGRTMAX-1" "SIGRTMAX"))
|
||||
|
||||
((word) @boolean
|
||||
(#any-of? @boolean "true" "false"))
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
(test_operator) @operator
|
||||
|
||||
(command_substitution
|
||||
"$(" @punctuation.special
|
||||
")" @punctuation.special)
|
||||
|
||||
(process_substitution
|
||||
[
|
||||
"<("
|
||||
">("
|
||||
] @punctuation.special
|
||||
")" @punctuation.special)
|
||||
|
||||
(arithmetic_expansion
|
||||
[
|
||||
"$(("
|
||||
"(("
|
||||
] @punctuation.special
|
||||
"))" @punctuation.special)
|
||||
|
||||
(arithmetic_expansion
|
||||
"," @punctuation.delimiter)
|
||||
|
||||
(ternary_expression
|
||||
[
|
||||
"?"
|
||||
":"
|
||||
] @keyword.conditional.ternary)
|
||||
|
||||
(binary_expression
|
||||
operator: _ @operator)
|
||||
|
||||
(unary_expression
|
||||
operator: _ @operator)
|
||||
|
||||
(postfix_expression
|
||||
operator: _ @operator)
|
||||
|
||||
(function_definition
|
||||
name: (word) @function)
|
||||
|
||||
(command_name
|
||||
(word) @function.call)
|
||||
|
||||
(command_name
|
||||
(word) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
"alias" "bg" "bind" "break" "builtin" "caller" "cd" "command" "compgen" "complete" "compopt"
|
||||
"continue" "coproc" "dirs" "disown" "echo" "enable" "eval" "exec" "exit" "fc" "fg" "getopts"
|
||||
"hash" "help" "history" "jobs" "kill" "let" "logout" "mapfile" "popd" "printf" "pushd" "pwd"
|
||||
"read" "readarray" "return" "set" "shift" "shopt" "source" "suspend" "test" "time" "times"
|
||||
"trap" "type" "typeset" "ulimit" "umask" "unalias" "wait"))
|
||||
|
||||
(command
|
||||
argument: [
|
||||
(word) @variable.parameter
|
||||
(concatenation
|
||||
(word) @variable.parameter)
|
||||
])
|
||||
|
||||
(number) @number
|
||||
|
||||
((word) @number
|
||||
(#lua-match? @number "^[0-9]+$"))
|
||||
|
||||
(file_redirect
|
||||
destination: (word) @variable.parameter)
|
||||
|
||||
(file_descriptor) @operator
|
||||
|
||||
(simple_expansion
|
||||
"$" @punctuation.special) @none
|
||||
|
||||
(expansion
|
||||
"${" @punctuation.special
|
||||
"}" @punctuation.special) @none
|
||||
|
||||
(expansion
|
||||
operator: _ @punctuation.special)
|
||||
|
||||
(expansion
|
||||
"@"
|
||||
.
|
||||
operator: _ @character.special)
|
||||
|
||||
((expansion
|
||||
(subscript
|
||||
index: (word) @character.special))
|
||||
(#any-of? @character.special "@" "*"))
|
||||
|
||||
"``" @punctuation.special
|
||||
|
||||
(variable_name) @variable
|
||||
|
||||
((variable_name) @constant
|
||||
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||
|
||||
(case_item
|
||||
value: (word) @variable.parameter)
|
||||
|
||||
[
|
||||
(regex)
|
||||
(extglob_pattern)
|
||||
] @string.regexp
|
||||
|
||||
((program
|
||||
.
|
||||
(comment) @keyword.directive @nospell)
|
||||
(#lua-match? @keyword.directive "^#!/"))
|
@@ -1,3 +0,0 @@
|
||||
(heredoc_redirect
|
||||
(heredoc_body) @injection.content
|
||||
(heredoc_end) @injection.language)
|
@@ -1,28 +0,0 @@
|
||||
[
|
||||
(function_definition)
|
||||
(class_definition)
|
||||
(while_statement)
|
||||
(for_statement)
|
||||
(if_statement)
|
||||
(with_statement)
|
||||
(try_statement)
|
||||
(match_statement)
|
||||
(import_from_statement)
|
||||
(parameters)
|
||||
(argument_list)
|
||||
(parenthesized_expression)
|
||||
(generator_expression)
|
||||
(list_comprehension)
|
||||
(set_comprehension)
|
||||
(dictionary_comprehension)
|
||||
(tuple)
|
||||
(list)
|
||||
(set)
|
||||
(dictionary)
|
||||
(string)
|
||||
] @fold
|
||||
|
||||
[
|
||||
(import_statement)
|
||||
(import_from_statement)
|
||||
]+ @fold
|
@@ -1,457 +0,0 @@
|
||||
; From tree-sitter-python licensed under MIT License
|
||||
; Copyright (c) 2016 Max Brunsfeld
|
||||
; Variables
|
||||
(identifier) @variable
|
||||
|
||||
; Reset highlighting in f-string interpolations
|
||||
(interpolation) @none
|
||||
|
||||
; Identifier naming conventions
|
||||
((identifier) @type
|
||||
(#lua-match? @type "^[A-Z].*[a-z]"))
|
||||
|
||||
((identifier) @constant
|
||||
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||
|
||||
((identifier) @constant.builtin
|
||||
(#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$"))
|
||||
|
||||
((identifier) @constant.builtin
|
||||
(#any-of? @constant.builtin
|
||||
; https://docs.python.org/3/library/constants.html
|
||||
"NotImplemented" "Ellipsis" "quit" "exit" "copyright" "credits" "license"))
|
||||
|
||||
"_" @constant.builtin ; match wildcard
|
||||
|
||||
((attribute
|
||||
attribute: (identifier) @variable.member)
|
||||
(#lua-match? @variable.member "^[%l_].*$"))
|
||||
|
||||
((assignment
|
||||
left: (identifier) @type.definition
|
||||
(type
|
||||
(identifier) @_annotation))
|
||||
(#eq? @_annotation "TypeAlias"))
|
||||
|
||||
((assignment
|
||||
left: (identifier) @type.definition
|
||||
right: (call
|
||||
function: (identifier) @_func))
|
||||
(#any-of? @_func "TypeVar" "NewType"))
|
||||
|
||||
; Function calls
|
||||
(call
|
||||
function: (identifier) @function.call)
|
||||
|
||||
(call
|
||||
function: (attribute
|
||||
attribute: (identifier) @function.method.call))
|
||||
|
||||
((call
|
||||
function: (identifier) @constructor)
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
((call
|
||||
function: (attribute
|
||||
attribute: (identifier) @constructor))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
; Decorators
|
||||
((decorator
|
||||
"@" @attribute)
|
||||
(#set! "priority" 101))
|
||||
|
||||
(decorator
|
||||
(identifier) @attribute)
|
||||
|
||||
(decorator
|
||||
(attribute
|
||||
attribute: (identifier) @attribute))
|
||||
|
||||
(decorator
|
||||
(call
|
||||
(identifier) @attribute))
|
||||
|
||||
(decorator
|
||||
(call
|
||||
(attribute
|
||||
attribute: (identifier) @attribute)))
|
||||
|
||||
((decorator
|
||||
(identifier) @attribute.builtin)
|
||||
(#any-of? @attribute.builtin "classmethod" "property" "staticmethod"))
|
||||
|
||||
; Builtin functions
|
||||
((call
|
||||
function: (identifier) @function.builtin)
|
||||
(#any-of? @function.builtin
|
||||
"abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr"
|
||||
"classmethod" "compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec"
|
||||
"filter" "float" "format" "frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id"
|
||||
"input" "int" "isinstance" "issubclass" "iter" "len" "list" "locals" "map" "max" "memoryview"
|
||||
"min" "next" "object" "oct" "open" "ord" "pow" "print" "property" "range" "repr" "reversed"
|
||||
"round" "set" "setattr" "slice" "sorted" "staticmethod" "str" "sum" "super" "tuple" "type"
|
||||
"vars" "zip" "__import__"))
|
||||
|
||||
; Function definitions
|
||||
(function_definition
|
||||
name: (identifier) @function)
|
||||
|
||||
(type
|
||||
(identifier) @type)
|
||||
|
||||
(type
|
||||
(subscript
|
||||
(identifier) @type)) ; type subscript: Tuple[int]
|
||||
|
||||
((call
|
||||
function: (identifier) @_isinstance
|
||||
arguments: (argument_list
|
||||
(_)
|
||||
(identifier) @type))
|
||||
(#eq? @_isinstance "isinstance"))
|
||||
|
||||
; Normal parameters
|
||||
(parameters
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
; Lambda parameters
|
||||
(lambda_parameters
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
(lambda_parameters
|
||||
(tuple_pattern
|
||||
(identifier) @variable.parameter))
|
||||
|
||||
; Default parameters
|
||||
(keyword_argument
|
||||
name: (identifier) @variable.parameter)
|
||||
|
||||
; Naming parameters on call-site
|
||||
(default_parameter
|
||||
name: (identifier) @variable.parameter)
|
||||
|
||||
(typed_parameter
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
(typed_default_parameter
|
||||
name: (identifier) @variable.parameter)
|
||||
|
||||
; Variadic parameters *args, **kwargs
|
||||
(parameters
|
||||
(list_splat_pattern ; *args
|
||||
(identifier) @variable.parameter))
|
||||
|
||||
(parameters
|
||||
(dictionary_splat_pattern ; **kwargs
|
||||
(identifier) @variable.parameter))
|
||||
|
||||
; Typed variadic parameters
|
||||
(parameters
|
||||
(typed_parameter
|
||||
(list_splat_pattern ; *args: type
|
||||
(identifier) @variable.parameter)))
|
||||
|
||||
(parameters
|
||||
(typed_parameter
|
||||
(dictionary_splat_pattern ; *kwargs: type
|
||||
(identifier) @variable.parameter)))
|
||||
|
||||
; Lambda parameters
|
||||
(lambda_parameters
|
||||
(list_splat_pattern
|
||||
(identifier) @variable.parameter))
|
||||
|
||||
(lambda_parameters
|
||||
(dictionary_splat_pattern
|
||||
(identifier) @variable.parameter))
|
||||
|
||||
; Literals
|
||||
(none) @constant.builtin
|
||||
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
] @boolean
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#eq? @variable.builtin "self"))
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#eq? @variable.builtin "cls"))
|
||||
|
||||
(integer) @number
|
||||
|
||||
(float) @number.float
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
((module
|
||||
.
|
||||
(comment) @keyword.directive @nospell)
|
||||
(#lua-match? @keyword.directive "^#!/"))
|
||||
|
||||
(string) @string
|
||||
|
||||
[
|
||||
(escape_sequence)
|
||||
(escape_interpolation)
|
||||
] @string.escape
|
||||
|
||||
; doc-strings
|
||||
(module
|
||||
.
|
||||
(comment)*
|
||||
.
|
||||
(expression_statement
|
||||
(string) @string.documentation))
|
||||
|
||||
(class_definition
|
||||
body: (block
|
||||
.
|
||||
(expression_statement
|
||||
(string) @string.documentation)))
|
||||
|
||||
(function_definition
|
||||
body: (block
|
||||
.
|
||||
(expression_statement
|
||||
(string) @string.documentation)))
|
||||
|
||||
(module
|
||||
.
|
||||
(comment)*
|
||||
.
|
||||
(expression_statement
|
||||
(string
|
||||
(string_content) @spell)))
|
||||
|
||||
(class_definition
|
||||
body: (block
|
||||
.
|
||||
(expression_statement
|
||||
(string
|
||||
(string_content) @spell))))
|
||||
|
||||
(function_definition
|
||||
body: (block
|
||||
.
|
||||
(expression_statement
|
||||
(string
|
||||
(string_content) @spell))))
|
||||
|
||||
; Tokens
|
||||
[
|
||||
"-"
|
||||
"-="
|
||||
":="
|
||||
"!="
|
||||
"*"
|
||||
"**"
|
||||
"**="
|
||||
"*="
|
||||
"/"
|
||||
"//"
|
||||
"//="
|
||||
"/="
|
||||
"&"
|
||||
"&="
|
||||
"%"
|
||||
"%="
|
||||
"^"
|
||||
"^="
|
||||
"+"
|
||||
"+="
|
||||
"<"
|
||||
"<<"
|
||||
"<<="
|
||||
"<="
|
||||
"<>"
|
||||
"="
|
||||
"=="
|
||||
">"
|
||||
">="
|
||||
">>"
|
||||
">>="
|
||||
"@"
|
||||
"@="
|
||||
"|"
|
||||
"|="
|
||||
"~"
|
||||
"->"
|
||||
] @operator
|
||||
|
||||
; Keywords
|
||||
[
|
||||
"and"
|
||||
"in"
|
||||
"is"
|
||||
"not"
|
||||
"or"
|
||||
"is not"
|
||||
"not in"
|
||||
"del"
|
||||
] @keyword.operator
|
||||
|
||||
[
|
||||
"def"
|
||||
"lambda"
|
||||
] @keyword.function
|
||||
|
||||
[
|
||||
"assert"
|
||||
"exec"
|
||||
"global"
|
||||
"nonlocal"
|
||||
"pass"
|
||||
"print"
|
||||
"with"
|
||||
"as"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"type"
|
||||
"class"
|
||||
] @keyword.type
|
||||
|
||||
[
|
||||
"async"
|
||||
"await"
|
||||
] @keyword.coroutine
|
||||
|
||||
[
|
||||
"return"
|
||||
"yield"
|
||||
] @keyword.return
|
||||
|
||||
(yield
|
||||
"from" @keyword.return)
|
||||
|
||||
(future_import_statement
|
||||
"from" @keyword.import
|
||||
"__future__" @constant.builtin)
|
||||
|
||||
(import_from_statement
|
||||
"from" @keyword.import)
|
||||
|
||||
"import" @keyword.import
|
||||
|
||||
(aliased_import
|
||||
"as" @keyword.import)
|
||||
|
||||
[
|
||||
"if"
|
||||
"elif"
|
||||
"else"
|
||||
"match"
|
||||
"case"
|
||||
] @keyword.conditional
|
||||
|
||||
[
|
||||
"for"
|
||||
"while"
|
||||
"break"
|
||||
"continue"
|
||||
] @keyword.repeat
|
||||
|
||||
[
|
||||
"try"
|
||||
"except"
|
||||
"except*"
|
||||
"raise"
|
||||
"finally"
|
||||
] @keyword.exception
|
||||
|
||||
(raise_statement
|
||||
"from" @keyword.exception)
|
||||
|
||||
(try_statement
|
||||
(else_clause
|
||||
"else" @keyword.exception))
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
(interpolation
|
||||
"{" @punctuation.special
|
||||
"}" @punctuation.special)
|
||||
|
||||
(type_conversion) @function.macro
|
||||
|
||||
[
|
||||
","
|
||||
"."
|
||||
":"
|
||||
";"
|
||||
(ellipsis)
|
||||
] @punctuation.delimiter
|
||||
|
||||
; Class definitions
|
||||
(class_definition
|
||||
name: (identifier) @type)
|
||||
|
||||
(class_definition
|
||||
body: (block
|
||||
(function_definition
|
||||
name: (identifier) @function.method)))
|
||||
|
||||
(class_definition
|
||||
superclasses: (argument_list
|
||||
(identifier) @type))
|
||||
|
||||
((class_definition
|
||||
body: (block
|
||||
(expression_statement
|
||||
(assignment
|
||||
left: (identifier) @variable.member))))
|
||||
(#lua-match? @variable.member "^[%l_].*$"))
|
||||
|
||||
((class_definition
|
||||
body: (block
|
||||
(expression_statement
|
||||
(assignment
|
||||
left: (_
|
||||
(identifier) @variable.member)))))
|
||||
(#lua-match? @variable.member "^[%l_].*$"))
|
||||
|
||||
((class_definition
|
||||
(block
|
||||
(function_definition
|
||||
name: (identifier) @constructor)))
|
||||
(#any-of? @constructor "__new__" "__init__"))
|
||||
|
||||
((identifier) @type.builtin
|
||||
(#any-of? @type.builtin
|
||||
; https://docs.python.org/3/library/exceptions.html
|
||||
"BaseException" "Exception" "ArithmeticError" "BufferError" "LookupError" "AssertionError"
|
||||
"AttributeError" "EOFError" "FloatingPointError" "GeneratorExit" "ImportError"
|
||||
"ModuleNotFoundError" "IndexError" "KeyError" "KeyboardInterrupt" "MemoryError" "NameError"
|
||||
"NotImplementedError" "OSError" "OverflowError" "RecursionError" "ReferenceError" "RuntimeError"
|
||||
"StopIteration" "StopAsyncIteration" "SyntaxError" "IndentationError" "TabError" "SystemError"
|
||||
"SystemExit" "TypeError" "UnboundLocalError" "UnicodeError" "UnicodeEncodeError"
|
||||
"UnicodeDecodeError" "UnicodeTranslateError" "ValueError" "ZeroDivisionError" "EnvironmentError"
|
||||
"IOError" "WindowsError" "BlockingIOError" "ChildProcessError" "ConnectionError"
|
||||
"BrokenPipeError" "ConnectionAbortedError" "ConnectionRefusedError" "ConnectionResetError"
|
||||
"FileExistsError" "FileNotFoundError" "InterruptedError" "IsADirectoryError"
|
||||
"NotADirectoryError" "PermissionError" "ProcessLookupError" "TimeoutError" "Warning"
|
||||
"UserWarning" "DeprecationWarning" "PendingDeprecationWarning" "SyntaxWarning" "RuntimeWarning"
|
||||
"FutureWarning" "ImportWarning" "UnicodeWarning" "BytesWarning" "ResourceWarning"
|
||||
; https://docs.python.org/3/library/stdtypes.html
|
||||
"bool" "int" "float" "complex" "list" "tuple" "range" "str" "bytes" "bytearray" "memoryview"
|
||||
"set" "frozenset" "dict" "type" "object"))
|
||||
|
||||
; Regex from the `re` module
|
||||
(call
|
||||
function: (attribute
|
||||
object: (identifier) @_re)
|
||||
arguments: (argument_list
|
||||
.
|
||||
(string
|
||||
(string_content) @string.regexp))
|
||||
(#eq? @_re "re"))
|
@@ -5,9 +5,6 @@
|
||||
(capture
|
||||
(identifier) @type)
|
||||
|
||||
(anonymous_node
|
||||
(identifier) @string)
|
||||
|
||||
(predicate
|
||||
name: (identifier) @function.call)
|
||||
|
||||
|
@@ -1,13 +1,19 @@
|
||||
(h1) @markup.heading.1
|
||||
(h1
|
||||
(delimiter) @markup.heading.1
|
||||
(heading) @markup.heading.1)
|
||||
|
||||
(h2) @markup.heading.2
|
||||
(h2
|
||||
(delimiter) @markup.heading.2
|
||||
(heading) @markup.heading.2)
|
||||
|
||||
(h3) @markup.heading.3
|
||||
|
||||
(column_heading) @markup.heading.4
|
||||
(h3
|
||||
(heading) @markup.heading.3)
|
||||
|
||||
(column_heading
|
||||
"~" @markup.heading.4
|
||||
(heading) @markup.heading.4)
|
||||
|
||||
(column_heading
|
||||
(delimiter) @markup.heading.4
|
||||
(#set! conceal ""))
|
||||
|
||||
(tag
|
||||
|
@@ -4,17 +4,7 @@
|
||||
" Filenames: *.styl, *.stylus
|
||||
" Based On: Tim Pope (sass.vim)
|
||||
" Created: Dec 14, 2011
|
||||
" Modified: Apr 29, 2024
|
||||
|
||||
if main_syntax == "css"
|
||||
syn sync minlines=10
|
||||
endif
|
||||
|
||||
" let b:current_syntax = "css"
|
||||
"
|
||||
if main_syntax == 'css'
|
||||
unlet main_syntax
|
||||
endif
|
||||
" Modified: May 28, 2024
|
||||
|
||||
syn case ignore
|
||||
|
||||
|
@@ -158,6 +158,9 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
# ENABLE_EXPORTS is set to true. See
|
||||
# https://github.com/neovim/neovim/issues/25295
|
||||
target_link_options(nvim_bin PRIVATE "-Wl,-export_dynamic")
|
||||
# Apple Clang 16's new deduplication pass leads to lock-up on start
|
||||
# TODO(clason): verify that problem remains after release or remove
|
||||
target_link_options(nvim_bin PRIVATE "-Wl,-no_deduplicate")
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
|
||||
target_link_libraries(main_lib INTERFACE pthread c++abi)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
|
||||
@@ -477,7 +480,6 @@ endif()
|
||||
if(MSVC)
|
||||
list(APPEND gen_cflags -wd4003)
|
||||
endif()
|
||||
list(APPEND gen_cflags -O2)
|
||||
|
||||
set(NVIM_VERSION_GIT_H ${PROJECT_BINARY_DIR}/cmake.config/auto/versiondef_git.h)
|
||||
add_custom_target(update_version_stamp
|
||||
|
@@ -1011,7 +1011,7 @@ void nvim_buf_clear_namespace(Buffer buffer, Integer ns_id, Integer line_start,
|
||||
/// Note: this function should not be called often. Rather, the callbacks
|
||||
/// themselves can be used to throttle unneeded callbacks. the `on_start`
|
||||
/// callback can return `false` to disable the provider until the next redraw.
|
||||
/// Similarly, return `false` in `on_win` will skip the `on_lines` calls
|
||||
/// Similarly, return `false` in `on_win` will skip the `on_line` calls
|
||||
/// for that window (but any extmarks set in `on_win` will still be used).
|
||||
/// A plugin managing multiple sources of decoration should ideally only set
|
||||
/// one provider, and merge the sources internally. You can use multiple `ns_id`
|
||||
@@ -1020,10 +1020,10 @@ void nvim_buf_clear_namespace(Buffer buffer, Integer ns_id, Integer line_start,
|
||||
/// Note: doing anything other than setting extmarks is considered experimental.
|
||||
/// Doing things like changing options are not explicitly forbidden, but is
|
||||
/// likely to have unexpected consequences (such as 100% CPU consumption).
|
||||
/// doing `vim.rpcnotify` should be OK, but `vim.rpcrequest` is quite dubious
|
||||
/// Doing `vim.rpcnotify` should be OK, but `vim.rpcrequest` is quite dubious
|
||||
/// for the moment.
|
||||
///
|
||||
/// Note: It is not allowed to remove or update extmarks in 'on_line' callbacks.
|
||||
/// Note: It is not allowed to remove or update extmarks in `on_line` callbacks.
|
||||
///
|
||||
/// @param ns_id Namespace id from |nvim_create_namespace()|
|
||||
/// @param opts Table of callbacks:
|
||||
|
@@ -778,16 +778,26 @@ void remote_ui_raw_line(RemoteUI *ui, Integer grid, Integer row, Integer startco
|
||||
for (size_t i = 0; i < ncells; i++) {
|
||||
repeat++;
|
||||
if (i == ncells - 1 || attrs[i] != attrs[i + 1] || chunk[i] != chunk[i + 1]) {
|
||||
if (UI_BUF_SIZE - BUF_POS(ui) < 2 * (1 + 2 + MAX_SCHAR_SIZE + 5 + 5) + 1
|
||||
if (
|
||||
// Close to overflowing the redraw buffer. Finish this event, flush,
|
||||
// and start a new "grid_line" event at the current position.
|
||||
// For simplicity leave place for the final "clear" element as well,
|
||||
// hence the factor of 2 in the check.
|
||||
UI_BUF_SIZE - BUF_POS(ui) < 2 * (1 + 2 + MAX_SCHAR_SIZE + 5 + 5) + 1
|
||||
// Also if there is a lot of packed cells, pass them off to the UI to
|
||||
// let it start processing them.
|
||||
|| ui->ncells_pending >= 500) {
|
||||
// close to overflowing the redraw buffer. finish this event,
|
||||
// flush, and start a new "grid_line" event at the current position.
|
||||
// For simplicity leave place for the final "clear" element
|
||||
// as well, hence the factor of 2 in the check.
|
||||
// Also if there is a lot of packed cells, pass them of to the UI to
|
||||
// let it start processing them
|
||||
// If the last chunk was all spaces, add an empty clearing chunk,
|
||||
// so it's clear that the last chunk wasn't a clearing chunk.
|
||||
if (was_space) {
|
||||
nelem++;
|
||||
ui->ncells_pending += 1;
|
||||
mpack_array(buf, 3);
|
||||
mpack_str_small(buf, S_LEN(" "));
|
||||
mpack_uint(buf, (uint32_t)clearattr);
|
||||
mpack_uint(buf, 0);
|
||||
}
|
||||
mpack_w2(&lenpos, nelem);
|
||||
|
||||
// We only ever set the wrap field on the final "grid_line" event for the line.
|
||||
mpack_bool(buf, false);
|
||||
ui_flush_buf(ui);
|
||||
|
@@ -2384,8 +2384,8 @@ void nvim__redraw(Dict(redraw) *opts, Error *err)
|
||||
}
|
||||
}
|
||||
|
||||
int count = (win != NULL) + (buf != NULL);
|
||||
VALIDATE(popcount(opts->is_set__redraw_) > count, "%s", "at least one action required", {
|
||||
unsigned count = (win != NULL) + (buf != NULL);
|
||||
VALIDATE(xpopcount(opts->is_set__redraw_) > count, "%s", "at least one action required", {
|
||||
return;
|
||||
});
|
||||
|
||||
@@ -2422,10 +2422,6 @@ void nvim__redraw(Dict(redraw) *opts, Error *err)
|
||||
redraw_buf_range_later(rbuf, first, last);
|
||||
}
|
||||
|
||||
if (opts->cursor) {
|
||||
setcursor_mayforce(win ? win : curwin, true);
|
||||
}
|
||||
|
||||
bool flush = opts->flush;
|
||||
if (opts->tabline) {
|
||||
// Flush later in case tabline was just hidden or shown for the first time.
|
||||
@@ -2452,11 +2448,22 @@ void nvim__redraw(Dict(redraw) *opts, Error *err)
|
||||
}
|
||||
}
|
||||
|
||||
// Flush pending screen updates if "flush" or "clear" is true, or when
|
||||
// redrawing a status component may have changed the grid dimensions.
|
||||
win_T *cwin = win ? win : curwin;
|
||||
// Allow moving cursor to recently opened window and make sure it is drawn #28868.
|
||||
if (opts->cursor && (!cwin->w_grid.target || !cwin->w_grid.target->valid)) {
|
||||
flush = true;
|
||||
}
|
||||
|
||||
// Redraw pending screen updates when explicitly requested or when determined
|
||||
// that it is necessary to properly draw other requested components.
|
||||
if (flush && !cmdpreview) {
|
||||
update_screen();
|
||||
}
|
||||
|
||||
if (opts->cursor) {
|
||||
setcursor_mayforce(cwin, true);
|
||||
}
|
||||
|
||||
ui_flush();
|
||||
|
||||
RedrawingDisabled = save_rd;
|
||||
|
@@ -3242,6 +3242,7 @@ static int ExpandUserLua(expand_T *xp, int *num_file, char ***file)
|
||||
/// Adds matches to `ga`.
|
||||
/// If "dirs" is true only expand directory names.
|
||||
void globpath(char *path, char *file, garray_T *ga, int expand_options, bool dirs)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
expand_T xpc;
|
||||
ExpandInit(&xpc);
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include "nvim/drawscreen.h"
|
||||
#include "nvim/extmark.h"
|
||||
#include "nvim/fold.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/grid.h"
|
||||
#include "nvim/grid_defs.h"
|
||||
#include "nvim/highlight.h"
|
||||
@@ -30,9 +31,6 @@
|
||||
# include "decoration.c.generated.h"
|
||||
#endif
|
||||
|
||||
// TODO(bfredl): These should maybe be per-buffer, so that all resources
|
||||
// associated with a buffer can be freed when the buffer is unloaded.
|
||||
kvec_t(DecorSignHighlight) decor_items = KV_INITIAL_VALUE;
|
||||
uint32_t decor_freelist = UINT32_MAX;
|
||||
|
||||
// Decorations might be requested to be deleted in a callback in the middle of redrawing.
|
||||
@@ -184,6 +182,21 @@ void buf_put_decor(buf_T *buf, DecorInline decor, int row, int row2)
|
||||
}
|
||||
}
|
||||
|
||||
/// When displaying signs in the 'number' column, if the width of the number
|
||||
/// column is less than 2, then force recomputing the width after placing or
|
||||
/// unplacing the first sign in "buf".
|
||||
static void may_force_numberwidth_recompute(buf_T *buf, bool unplace)
|
||||
{
|
||||
FOR_ALL_TAB_WINDOWS(tp, wp) {
|
||||
if (wp->w_buffer == buf
|
||||
&& wp->w_minscwidth == SCL_NUM
|
||||
&& (wp->w_p_nu || wp->w_p_rnu)
|
||||
&& (unplace || wp->w_nrwidth_width < 2)) {
|
||||
wp->w_nrwidth_line_count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int sign_add_id = 0;
|
||||
void buf_put_decor_sh(buf_T *buf, DecorSignHighlight *sh, int row1, int row2)
|
||||
{
|
||||
@@ -191,6 +204,7 @@ void buf_put_decor_sh(buf_T *buf, DecorSignHighlight *sh, int row1, int row2)
|
||||
sh->sign_add_id = sign_add_id++;
|
||||
if (sh->text[0]) {
|
||||
buf_signcols_count_range(buf, row1, row2, 1, kFalse);
|
||||
may_force_numberwidth_recompute(buf, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -218,6 +232,7 @@ void buf_remove_decor_sh(buf_T *buf, int row1, int row2, DecorSignHighlight *sh)
|
||||
if (buf_meta_total(buf, kMTMetaSignText)) {
|
||||
buf_signcols_count_range(buf, row1, row2, -1, kFalse);
|
||||
} else {
|
||||
may_force_numberwidth_recompute(buf, true);
|
||||
buf->b_signcols.resized = true;
|
||||
buf->b_signcols.max = buf->b_signcols.count[0] = 0;
|
||||
}
|
||||
@@ -274,7 +289,7 @@ static void decor_free_inner(DecorVirtText *vt, uint32_t first_idx)
|
||||
while (idx != DECOR_ID_INVALID) {
|
||||
DecorSignHighlight *sh = &kv_A(decor_items, idx);
|
||||
if (sh->flags & kSHIsSign) {
|
||||
xfree(sh->sign_name);
|
||||
XFREE_CLEAR(sh->sign_name);
|
||||
}
|
||||
sh->flags = 0;
|
||||
if (sh->url != NULL) {
|
||||
|
@@ -77,6 +77,9 @@ typedef struct {
|
||||
} DecorState;
|
||||
|
||||
EXTERN DecorState decor_state INIT( = { 0 });
|
||||
// TODO(bfredl): These should maybe be per-buffer, so that all resources
|
||||
// associated with a buffer can be freed when the buffer is unloaded.
|
||||
EXTERN kvec_t(DecorSignHighlight) decor_items INIT( = KV_INITIAL_VALUE);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "decoration.h.generated.h"
|
||||
|
@@ -212,9 +212,7 @@ void diff_buf_add(buf_T *buf)
|
||||
semsg(_("E96: Cannot diff more than %" PRId64 " buffers"), (int64_t)DB_COUNT);
|
||||
}
|
||||
|
||||
///
|
||||
/// Remove all buffers to make diffs for.
|
||||
///
|
||||
static void diff_buf_clear(void)
|
||||
{
|
||||
for (int i = 0; i < DB_COUNT; i++) {
|
||||
@@ -366,7 +364,6 @@ static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1, linenr_T
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Check for these situations:
|
||||
// 1 2 3
|
||||
// 1 2 3
|
||||
@@ -834,7 +831,6 @@ static int diff_write(buf_T *buf, diffin_T *din)
|
||||
return r;
|
||||
}
|
||||
|
||||
///
|
||||
/// Update the diffs for all buffers involved.
|
||||
///
|
||||
/// @param dio
|
||||
@@ -908,20 +904,16 @@ theend:
|
||||
xfree(dio->dio_diff.dout_fname);
|
||||
}
|
||||
|
||||
///
|
||||
/// Return true if the options are set to use the internal diff library.
|
||||
/// Note that if the internal diff failed for one of the buffers, the external
|
||||
/// diff will be used anyway.
|
||||
///
|
||||
int diff_internal(void)
|
||||
FUNC_ATTR_PURE
|
||||
{
|
||||
return (diff_flags & DIFF_INTERNAL) != 0 && *p_dex == NUL;
|
||||
}
|
||||
|
||||
///
|
||||
/// Return true if the internal diff failed for one of the diff buffers.
|
||||
///
|
||||
static int diff_internal_failed(void)
|
||||
{
|
||||
// Only need to do something when there is another buffer.
|
||||
@@ -1002,11 +994,9 @@ theend:
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Do a quick test if "diff" really works. Otherwise it looks like there
|
||||
/// are no differences. Can't use the return value, it's non-zero when
|
||||
/// there are differences.
|
||||
///
|
||||
static int check_external_diff(diffio_T *diffio)
|
||||
{
|
||||
// May try twice, first with "-a" and then without.
|
||||
@@ -1090,9 +1080,7 @@ static int check_external_diff(diffio_T *diffio)
|
||||
return OK;
|
||||
}
|
||||
|
||||
///
|
||||
/// Invoke the xdiff function.
|
||||
///
|
||||
static int diff_file_internal(diffio_T *diffio)
|
||||
{
|
||||
xpparam_t param;
|
||||
@@ -1812,9 +1800,7 @@ void diff_clear(tabpage_T *tp)
|
||||
tp->tp_first_diff = NULL;
|
||||
}
|
||||
|
||||
///
|
||||
/// return true if the options are set to use diff linematch
|
||||
///
|
||||
/// Return true if the options are set to use diff linematch.
|
||||
bool diff_linematch(diff_T *dp)
|
||||
{
|
||||
if (!(diff_flags & DIFF_LINEMATCH)) {
|
||||
|
@@ -465,6 +465,7 @@ static void draw_sign(bool nrcol, win_T *wp, winlinevars_T *wlv, int sign_idx, i
|
||||
int fill = nrcol ? number_width(wp) + 1 : SIGN_WIDTH;
|
||||
draw_col_fill(wlv, schar_from_ascii(' '), fill, attr);
|
||||
int sign_pos = wlv->off - SIGN_WIDTH - (int)nrcol;
|
||||
assert(sign_pos >= 0);
|
||||
linebuf_char[sign_pos] = sattr.text[0];
|
||||
linebuf_char[sign_pos + 1] = sattr.text[1];
|
||||
} else {
|
||||
@@ -1551,7 +1552,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
|
||||
|
||||
// When only updating the columns and that's done, stop here.
|
||||
if (col_rows > 0) {
|
||||
wlv_put_linebuf(wp, &wlv, wlv.off, false, bg_attr, 0);
|
||||
wlv_put_linebuf(wp, &wlv, MIN(wlv.off, grid->cols), false, bg_attr, 0);
|
||||
// Need to update more screen lines if:
|
||||
// - 'statuscolumn' needs to be drawn, or
|
||||
// - LineNrAbove or LineNrBelow is used, or
|
||||
@@ -1596,6 +1597,10 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
|
||||
// hide virt_text on text hidden by 'nowrap' or 'smoothscroll'
|
||||
decor_redraw_col(wp, (colnr_T)(ptr - line) - 1, wlv.off, true, &decor_state);
|
||||
}
|
||||
if (wlv.col >= grid->cols) {
|
||||
wlv.col = wlv.off = grid->cols;
|
||||
goto end_check;
|
||||
}
|
||||
}
|
||||
|
||||
if (cul_screenline && wlv.filler_todo <= 0
|
||||
@@ -2650,13 +2655,6 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
|
||||
conceal_cursor_used = conceal_cursor_line(curwin);
|
||||
}
|
||||
|
||||
// When the window is too narrow draw all "@" lines.
|
||||
if (leftcols_width >= wp->w_grid.cols && is_wrapped) {
|
||||
win_draw_end(wp, schar_from_ascii('@'), true, wlv.row, wp->w_grid.rows, HLF_AT);
|
||||
set_empty_rows(wp, wlv.row);
|
||||
wlv.row = endrow;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2844,10 +2842,12 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
|
||||
}
|
||||
}
|
||||
|
||||
end_check:
|
||||
// At end of screen line and there is more to come: Display the line
|
||||
// so far. If there is no more to display it is caught above.
|
||||
if (wlv.col >= grid->cols && (!has_foldtext || virt_line_offset >= 0)
|
||||
&& (*ptr != NUL
|
||||
&& (wlv.col <= leftcols_width
|
||||
|| *ptr != NUL
|
||||
|| wlv.filler_todo > 0
|
||||
|| (wp->w_p_list && wp->w_p_lcs_chars.eol != NUL && lcs_eol_todo)
|
||||
|| (wlv.n_extra != 0 && (wlv.sc_extra != NUL || *wlv.p_extra != NUL))
|
||||
|
@@ -927,13 +927,7 @@ int showmode(void)
|
||||
msg_ext_clear(true);
|
||||
}
|
||||
|
||||
// Don't make non-flushed message part of the showmode and reset global
|
||||
// variables before flushing to to avoid recursiveness.
|
||||
bool draw_mode = redraw_mode;
|
||||
bool clear_cmd = clear_cmdline;
|
||||
redraw_cmdline = false;
|
||||
redraw_mode = false;
|
||||
clear_cmdline = false;
|
||||
// Don't make non-flushed message part of the showmode.
|
||||
msg_ext_ui_flush();
|
||||
|
||||
msg_grid_validate();
|
||||
@@ -956,8 +950,8 @@ int showmode(void)
|
||||
msg_check_for_delay(false);
|
||||
|
||||
// if the cmdline is more than one line high, erase top lines
|
||||
bool need_clear = clear_cmd;
|
||||
if (clear_cmd && cmdline_row < Rows - 1) {
|
||||
bool need_clear = clear_cmdline;
|
||||
if (clear_cmdline && cmdline_row < Rows - 1) {
|
||||
msg_clr_cmdline(); // will reset clear_cmdline
|
||||
}
|
||||
|
||||
@@ -1079,7 +1073,7 @@ int showmode(void)
|
||||
}
|
||||
|
||||
mode_displayed = true;
|
||||
if (need_clear || clear_cmd || draw_mode) {
|
||||
if (need_clear || clear_cmdline || redraw_mode) {
|
||||
msg_clr_eos();
|
||||
}
|
||||
msg_didout = false; // overwrite this message
|
||||
@@ -1088,10 +1082,10 @@ int showmode(void)
|
||||
msg_no_more = false;
|
||||
lines_left = save_lines_left;
|
||||
need_wait_return = nwr_save; // never ask for hit-return for this
|
||||
} else if (clear_cmd && msg_silent == 0) {
|
||||
} else if (clear_cmdline && msg_silent == 0) {
|
||||
// Clear the whole command line. Will reset "clear_cmdline".
|
||||
msg_clr_cmdline();
|
||||
} else if (draw_mode) {
|
||||
} else if (redraw_mode) {
|
||||
msg_pos_mode();
|
||||
msg_clr_eos();
|
||||
}
|
||||
@@ -1114,6 +1108,10 @@ int showmode(void)
|
||||
grid_line_flush();
|
||||
}
|
||||
|
||||
redraw_cmdline = false;
|
||||
redraw_mode = false;
|
||||
clear_cmdline = false;
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
@@ -1544,6 +1542,7 @@ static void win_update(win_T *wp)
|
||||
// Force redraw when width of 'number' or 'relativenumber' column changes.
|
||||
if (wp->w_nrwidth != nrwidth_new) {
|
||||
type = UPD_NOT_VALID;
|
||||
changed_line_abv_curs_win(wp);
|
||||
wp->w_nrwidth = nrwidth_new;
|
||||
} else {
|
||||
// Set mod_top to the first line that needs displaying because of
|
||||
|
@@ -2025,7 +2025,6 @@ static void insert_special(int c, int allow_modmask, int ctrlv)
|
||||
// '0' and '^' are special, because they can be followed by CTRL-D.
|
||||
#define ISSPECIAL(c) ((c) < ' ' || (c) >= DEL || (c) == '0' || (c) == '^')
|
||||
|
||||
///
|
||||
/// "flags": INSCHAR_FORMAT - force formatting
|
||||
/// INSCHAR_CTRLV - char typed just after CTRL-V
|
||||
/// INSCHAR_NO_FEX - don't use 'formatexpr'
|
||||
@@ -4419,18 +4418,30 @@ static bool ins_tab(void)
|
||||
// Delete following spaces.
|
||||
int i = cursor->col - fpos.col;
|
||||
if (i > 0) {
|
||||
STRMOVE(ptr, ptr + i);
|
||||
if (!(State & VREPLACE_FLAG)) {
|
||||
char *newp = xmalloc((size_t)(curbuf->b_ml.ml_line_len - i));
|
||||
ptrdiff_t col = ptr - curbuf->b_ml.ml_line_ptr;
|
||||
if (col > 0) {
|
||||
memmove(newp, ptr - col, (size_t)col);
|
||||
}
|
||||
memmove(newp + col, ptr + i, (size_t)(curbuf->b_ml.ml_line_len - col - i));
|
||||
if (curbuf->b_ml.ml_flags & (ML_LINE_DIRTY | ML_ALLOCATED)) {
|
||||
xfree(curbuf->b_ml.ml_line_ptr);
|
||||
}
|
||||
curbuf->b_ml.ml_line_ptr = newp;
|
||||
curbuf->b_ml.ml_line_len -= i;
|
||||
curbuf->b_ml.ml_flags = (curbuf->b_ml.ml_flags | ML_LINE_DIRTY) & ~ML_EMPTY;
|
||||
inserted_bytes(fpos.lnum, change_col,
|
||||
cursor->col - change_col, fpos.col - change_col);
|
||||
} else {
|
||||
STRMOVE(ptr, ptr + i);
|
||||
}
|
||||
// correct replace stack.
|
||||
if ((State & REPLACE_FLAG) && !(State & VREPLACE_FLAG)) {
|
||||
for (temp = i; --temp >= 0;) {
|
||||
replace_join(repl_off);
|
||||
}
|
||||
}
|
||||
if (!(State & VREPLACE_FLAG)) {
|
||||
curbuf->b_ml.ml_line_len -= i;
|
||||
inserted_bytes(fpos.lnum, change_col,
|
||||
cursor->col - change_col, fpos.col - change_col);
|
||||
}
|
||||
}
|
||||
cursor->col -= i;
|
||||
|
||||
|
@@ -4403,8 +4403,8 @@ M.funcs = {
|
||||
difference if the buffer is displayed in a window with
|
||||
different 'virtualedit' or 'list' values.
|
||||
|
||||
Examples: >
|
||||
:xnoremap <CR>
|
||||
Examples: >vim
|
||||
xnoremap <CR>
|
||||
\ <Cmd>echom getregion(
|
||||
\ getpos('v'), getpos('.'), #{ type: mode() })<CR>
|
||||
<
|
||||
@@ -5203,7 +5203,7 @@ M.funcs = {
|
||||
Note that `v:_null_string`, `v:_null_list`, `v:_null_dict` and
|
||||
`v:_null_blob` have the same `id()` with different types
|
||||
because they are internally represented as NULL pointers.
|
||||
`id()` returns a hexadecimal representanion of the pointers to
|
||||
`id()` returns a hexadecimal representation of the pointers to
|
||||
the containers (i.e. like `0x994a40`), same as `printf("%p",
|
||||
{expr})`, but it is advised against counting on the exact
|
||||
format of the return value.
|
||||
@@ -6752,19 +6752,19 @@ M.funcs = {
|
||||
|
||||
Examples: >vim
|
||||
" Assuming line 3 in buffer 5 contains "a"
|
||||
:echo matchbufline(5, '\<\k\+\>', 3, 3)
|
||||
[{'lnum': 3, 'byteidx': 0, 'text': 'a'}]
|
||||
echo matchbufline(5, '\<\k\+\>', 3, 3)
|
||||
< `[{'lnum': 3, 'byteidx': 0, 'text': 'a'}]` >vim
|
||||
" Assuming line 4 in buffer 10 contains "tik tok"
|
||||
:echo matchbufline(10, '\<\k\+\>', 1, 4)
|
||||
[{'lnum': 4, 'byteidx': 0, 'text': 'tik'}, {'lnum': 4, 'byteidx': 4, 'text': 'tok'}]
|
||||
<
|
||||
echo matchbufline(10, '\<\k\+\>', 1, 4)
|
||||
< `[{'lnum': 4, 'byteidx': 0, 'text': 'tik'}, {'lnum': 4, 'byteidx': 4, 'text': 'tok'}]`
|
||||
|
||||
If {submatch} is present and is v:true, then submatches like
|
||||
"\1", "\2", etc. are also returned. Example: >vim
|
||||
" Assuming line 2 in buffer 2 contains "acd"
|
||||
:echo matchbufline(2, '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2, 2
|
||||
echo matchbufline(2, '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2, 2
|
||||
\ {'submatches': v:true})
|
||||
[{'lnum': 2, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]
|
||||
<The "submatches" List always contains 9 items. If a submatch
|
||||
< `[{'lnum': 2, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]`
|
||||
The "submatches" List always contains 9 items. If a submatch
|
||||
is not found, then an empty string is returned for that
|
||||
submatch.
|
||||
]=],
|
||||
@@ -6984,17 +6984,17 @@ M.funcs = {
|
||||
option settings on the pattern.
|
||||
|
||||
Example: >vim
|
||||
:echo matchstrlist(['tik tok'], '\<\k\+\>')
|
||||
[{'idx': 0, 'byteidx': 0, 'text': 'tik'}, {'idx': 0, 'byteidx': 4, 'text': 'tok'}]
|
||||
:echo matchstrlist(['a', 'b'], '\<\k\+\>')
|
||||
[{'idx': 0, 'byteidx': 0, 'text': 'a'}, {'idx': 1, 'byteidx': 0, 'text': 'b'}]
|
||||
<
|
||||
echo matchstrlist(['tik tok'], '\<\k\+\>')
|
||||
< `[{'idx': 0, 'byteidx': 0, 'text': 'tik'}, {'idx': 0, 'byteidx': 4, 'text': 'tok'}]` >vim
|
||||
echo matchstrlist(['a', 'b'], '\<\k\+\>')
|
||||
< `[{'idx': 0, 'byteidx': 0, 'text': 'a'}, {'idx': 1, 'byteidx': 0, 'text': 'b'}]`
|
||||
|
||||
If "submatches" is present and is v:true, then submatches like
|
||||
"\1", "\2", etc. are also returned. Example: >vim
|
||||
:echo matchstrlist(['acd'], '\(a\)\?\(b\)\?\(c\)\?\(.*\)',
|
||||
echo matchstrlist(['acd'], '\(a\)\?\(b\)\?\(c\)\?\(.*\)',
|
||||
\ #{submatches: v:true})
|
||||
[{'idx': 0, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]
|
||||
<The "submatches" List always contains 9 items. If a submatch
|
||||
< `[{'idx': 0, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]`
|
||||
The "submatches" List always contains 9 items. If a submatch
|
||||
is not found, then an empty string is returned for that
|
||||
submatch.
|
||||
]=],
|
||||
@@ -8674,7 +8674,7 @@ M.funcs = {
|
||||
the following mappings: >vim
|
||||
nnoremap <expr> GG ":echom " .. screencol() .. "\n"
|
||||
nnoremap <silent> GG :echom screencol()<CR>
|
||||
noremap GG <Cmd>echom screencol()<Cr>
|
||||
noremap GG <Cmd>echom screencol()<CR>
|
||||
<
|
||||
]=],
|
||||
name = 'screencol',
|
||||
|
@@ -6479,7 +6479,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
char *v = os_resolve_shortcut(fname);
|
||||
if (v == NULL) {
|
||||
if (os_is_reparse_point_include(fname)) {
|
||||
v = os_realpath(fname, v);
|
||||
v = os_realpath(fname, NULL, MAXPATHL + 1);
|
||||
}
|
||||
}
|
||||
rettv->vval.v_string = (v == NULL ? xstrdup(fname) : v);
|
||||
@@ -6631,7 +6631,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
xfree(buf);
|
||||
}
|
||||
# else
|
||||
char *v = os_realpath(fname, NULL);
|
||||
char *v = os_realpath(fname, NULL, MAXPATHL + 1);
|
||||
rettv->vval.v_string = v == NULL ? xstrdup(fname) : v;
|
||||
# endif
|
||||
#endif
|
||||
|
@@ -2531,6 +2531,10 @@ static bool cmdpreview_may_show(CommandLineState *s)
|
||||
goto end;
|
||||
}
|
||||
|
||||
// Flush now: external cmdline may itself wish to update the screen which is
|
||||
// currently disallowed during cmdpreview(no longer needed in case that changes).
|
||||
cmdline_ui_flush();
|
||||
|
||||
// Swap invalid command range if needed
|
||||
if ((ea.argt & EX_RANGE) && ea.line1 > ea.line2) {
|
||||
linenr_T lnum = ea.line1;
|
||||
@@ -3449,11 +3453,9 @@ void cmdline_screen_cleared(void)
|
||||
/// called by ui_flush, do what redraws necessary to keep cmdline updated.
|
||||
void cmdline_ui_flush(void)
|
||||
{
|
||||
static bool flushing = false;
|
||||
if (!ui_has(kUICmdline) || flushing) {
|
||||
if (!ui_has(kUICmdline)) {
|
||||
return;
|
||||
}
|
||||
flushing = true;
|
||||
int level = ccline.level;
|
||||
CmdlineInfo *line = &ccline;
|
||||
while (level > 0 && line) {
|
||||
@@ -3468,7 +3470,6 @@ void cmdline_ui_flush(void)
|
||||
}
|
||||
line = line->prev_ccline;
|
||||
}
|
||||
flushing = false;
|
||||
}
|
||||
|
||||
// Put a character on the command line. Shifts the following text to the
|
||||
@@ -4069,18 +4070,22 @@ static char *get_cmdline_completion(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
set_expand_context(p->xpc);
|
||||
if (p->xpc->xp_context == EXPAND_UNSUCCESSFUL) {
|
||||
int xp_context = p->xpc->xp_context;
|
||||
if (xp_context == EXPAND_NOTHING) {
|
||||
set_expand_context(p->xpc);
|
||||
xp_context = p->xpc->xp_context;
|
||||
p->xpc->xp_context = EXPAND_NOTHING;
|
||||
}
|
||||
if (xp_context == EXPAND_UNSUCCESSFUL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *cmd_compl = get_user_cmd_complete(p->xpc, p->xpc->xp_context);
|
||||
char *cmd_compl = get_user_cmd_complete(NULL, xp_context);
|
||||
if (cmd_compl == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (p->xpc->xp_context == EXPAND_USER_LIST
|
||||
|| p->xpc->xp_context == EXPAND_USER_DEFINED) {
|
||||
if (xp_context == EXPAND_USER_LIST || xp_context == EXPAND_USER_DEFINED) {
|
||||
size_t buflen = strlen(cmd_compl) + strlen(p->xpc->xp_arg) + 2;
|
||||
char *buffer = xmalloc(buflen);
|
||||
snprintf(buffer, buflen, "%s,%s", cmd_compl, p->xpc->xp_arg);
|
||||
|
@@ -116,9 +116,10 @@ static void extmark_setraw(buf_T *buf, uint64_t mark, int row, colnr_T col, bool
|
||||
{
|
||||
MarkTreeIter itr[1] = { 0 };
|
||||
MTKey key = marktree_lookup(buf->b_marktree, mark, itr);
|
||||
if (key.pos.row < 0 || (key.pos.row == row && key.pos.col == col)) {
|
||||
return;
|
||||
}
|
||||
bool move = key.pos.row >= 0 && (key.pos.row != row || key.pos.col != col);
|
||||
// Already valid keys were being revalidated, presumably when encountering a
|
||||
// SavePos from a modified mark. Avoid adding that to the decor again.
|
||||
invalid = invalid && mt_invalid(key);
|
||||
|
||||
// Only the position before undo needs to be redrawn here,
|
||||
// as the position after undo should be marked as changed.
|
||||
@@ -130,19 +131,21 @@ static void extmark_setraw(buf_T *buf, uint64_t mark, int row, colnr_T col, bool
|
||||
int row2 = 0;
|
||||
if (invalid) {
|
||||
mt_itr_rawkey(itr).flags &= (uint16_t) ~MT_FLAG_INVALID;
|
||||
} else if (key.flags & MT_FLAG_DECOR_SIGNTEXT && buf->b_signcols.autom) {
|
||||
} else if (move && key.flags & MT_FLAG_DECOR_SIGNTEXT && buf->b_signcols.autom) {
|
||||
MTPos end = marktree_get_altpos(buf->b_marktree, key, NULL);
|
||||
row1 = MIN(end.row, MIN(key.pos.row, row));
|
||||
row2 = MAX(end.row, MAX(key.pos.row, row));
|
||||
buf_signcols_count_range(buf, row1, row2, 0, kTrue);
|
||||
}
|
||||
|
||||
marktree_move(buf->b_marktree, itr, row, col);
|
||||
if (move) {
|
||||
marktree_move(buf->b_marktree, itr, row, col);
|
||||
}
|
||||
|
||||
if (invalid) {
|
||||
MTPos end = marktree_get_altpos(buf->b_marktree, key, NULL);
|
||||
buf_put_decor(buf, mt_decor(key), row, end.row);
|
||||
} else if (key.flags & MT_FLAG_DECOR_SIGNTEXT && buf->b_signcols.autom) {
|
||||
row2 = mt_paired(key) ? marktree_get_altpos(buf->b_marktree, key, NULL).row : row;
|
||||
buf_put_decor(buf, mt_decor(key), row, row2);
|
||||
} else if (move && key.flags & MT_FLAG_DECOR_SIGNTEXT && buf->b_signcols.autom) {
|
||||
buf_signcols_count_range(buf, row1, row2, 0, kNone);
|
||||
}
|
||||
}
|
||||
|
@@ -349,23 +349,24 @@ void *vim_findfile_init(char *path, char *filename, char *stopdirs, int level, i
|
||||
search_ctx->ffsc_stopdirs_v = xmalloc(sizeof(char *));
|
||||
|
||||
do {
|
||||
char *helper;
|
||||
void *ptr;
|
||||
|
||||
helper = walker;
|
||||
ptr = xrealloc(search_ctx->ffsc_stopdirs_v,
|
||||
(dircount + 1) * sizeof(char *));
|
||||
char *helper = walker;
|
||||
void *ptr = xrealloc(search_ctx->ffsc_stopdirs_v,
|
||||
(dircount + 1) * sizeof(char *));
|
||||
search_ctx->ffsc_stopdirs_v = ptr;
|
||||
walker = vim_strchr(walker, ';');
|
||||
if (walker) {
|
||||
assert(walker - helper >= 0);
|
||||
search_ctx->ffsc_stopdirs_v[dircount - 1] = xstrnsave(helper, (size_t)(walker - helper));
|
||||
walker++;
|
||||
assert(!walker || walker - helper >= 0);
|
||||
size_t len = walker ? (size_t)(walker - helper) : strlen(helper);
|
||||
// "" means ascent till top of directory tree.
|
||||
if (*helper != NUL && !vim_isAbsName(helper) && len + 1 < MAXPATHL) {
|
||||
// Make the stop dir an absolute path name.
|
||||
xmemcpyz(ff_expand_buffer, helper, len);
|
||||
search_ctx->ffsc_stopdirs_v[dircount - 1] = FullName_save(helper, len);
|
||||
} else {
|
||||
// this might be "", which means ascent till top of directory tree.
|
||||
search_ctx->ffsc_stopdirs_v[dircount - 1] = xstrdup(helper);
|
||||
search_ctx->ffsc_stopdirs_v[dircount - 1] = xmemdupz(helper, len);
|
||||
}
|
||||
if (walker) {
|
||||
walker++;
|
||||
}
|
||||
|
||||
dircount++;
|
||||
} while (walker != NULL);
|
||||
search_ctx->ffsc_stopdirs_v[dircount - 1] = NULL;
|
||||
@@ -880,11 +881,12 @@ char *vim_findfile(void *search_ctx_arg)
|
||||
if (search_ctx->ffsc_start_dir
|
||||
&& search_ctx->ffsc_stopdirs_v != NULL && !got_int) {
|
||||
ff_stack_T *sptr;
|
||||
// path_end may point to the NUL or the previous path separator
|
||||
ptrdiff_t plen = (path_end - search_ctx->ffsc_start_dir) + (*path_end != NUL);
|
||||
|
||||
// is the last starting directory in the stop list?
|
||||
if (ff_path_in_stoplist(search_ctx->ffsc_start_dir,
|
||||
(int)(path_end - search_ctx->ffsc_start_dir),
|
||||
search_ctx->ffsc_stopdirs_v)) {
|
||||
(size_t)plen, search_ctx->ffsc_stopdirs_v)) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1219,7 +1221,7 @@ static void ff_clear(ff_search_ctx_T *search_ctx)
|
||||
/// check if the given path is in the stopdirs
|
||||
///
|
||||
/// @return true if yes else false
|
||||
static bool ff_path_in_stoplist(char *path, int path_len, char **stopdirs_v)
|
||||
static bool ff_path_in_stoplist(char *path, size_t path_len, char **stopdirs_v)
|
||||
{
|
||||
// eat up trailing path separators, except the first
|
||||
while (path_len > 1 && vim_ispathsep(path[path_len - 1])) {
|
||||
@@ -1232,20 +1234,16 @@ static bool ff_path_in_stoplist(char *path, int path_len, char **stopdirs_v)
|
||||
}
|
||||
|
||||
for (int i = 0; stopdirs_v[i] != NULL; i++) {
|
||||
if ((int)strlen(stopdirs_v[i]) > path_len) {
|
||||
// match for parent directory. So '/home' also matches
|
||||
// '/home/rks'. Check for PATHSEP in stopdirs_v[i], else
|
||||
// '/home/r' would also match '/home/rks'
|
||||
if (path_fnamencmp(stopdirs_v[i], path, (size_t)path_len) == 0
|
||||
&& vim_ispathsep(stopdirs_v[i][path_len])) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (path_fnamecmp(stopdirs_v[i], path) == 0) {
|
||||
return true;
|
||||
}
|
||||
// match for parent directory. So '/home' also matches
|
||||
// '/home/rks'. Check for PATHSEP in stopdirs_v[i], else
|
||||
// '/home/r' would also match '/home/rks'
|
||||
if (path_fnamencmp(stopdirs_v[i], path, path_len) == 0
|
||||
&& (strlen(stopdirs_v[i]) <= path_len
|
||||
|| vim_ispathsep(stopdirs_v[i][path_len]))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -260,7 +260,11 @@ fixdict(1 + #version)
|
||||
for _, item in ipairs(version) do
|
||||
-- NB: all items are mandatory. But any error will be less confusing
|
||||
-- with placeholder vim.NIL (than invalid mpack data)
|
||||
put(item[1], item[2] or vim.NIL)
|
||||
local val = item[2]
|
||||
if val == nil then
|
||||
val = vim.NIL
|
||||
end
|
||||
put(item[1], val)
|
||||
end
|
||||
put('build', version_build)
|
||||
|
||||
|
@@ -128,8 +128,16 @@ for i = 1, #events do
|
||||
write_signature(call_output, ev, '')
|
||||
call_output:write('\n{\n')
|
||||
if ev.remote_only then
|
||||
-- Lua callbacks may emit other events or the same event again. Avoid the latter
|
||||
-- by adding a recursion guard to each generated function that may call a Lua callback.
|
||||
call_output:write(' static bool entered = false;\n')
|
||||
call_output:write(' if (entered) {\n')
|
||||
call_output:write(' return;\n')
|
||||
call_output:write(' }\n')
|
||||
call_output:write(' entered = true;\n')
|
||||
write_arglist(call_output, ev)
|
||||
call_output:write(' ui_call_event("' .. ev.name .. '", ' .. args .. ');\n')
|
||||
call_output:write(' entered = false;\n')
|
||||
elseif ev.compositor_impl then
|
||||
call_output:write(' ui_comp_' .. ev.name)
|
||||
write_signature(call_output, ev, '', true)
|
||||
|
@@ -2,7 +2,7 @@ return {
|
||||
{"major", ${NVIM_VERSION_MAJOR}},
|
||||
{"minor", ${NVIM_VERSION_MINOR}},
|
||||
{"patch", ${NVIM_VERSION_PATCH}},
|
||||
{"prerelease", "$NVIM_VERSION_PRERELEASE" ~= ""},
|
||||
{"prerelease", "${NVIM_VERSION_PRERELEASE}" ~= ""},
|
||||
{"api_level", ${NVIM_API_LEVEL}},
|
||||
{"api_compatible", ${NVIM_API_LEVEL_COMPAT}},
|
||||
{"api_prerelease", ${NVIM_API_PRERELEASE}},
|
||||
|
@@ -104,10 +104,10 @@ static buffheader_T readbuf1 = { { NULL, { NUL } }, NULL, 0, 0 };
|
||||
static buffheader_T readbuf2 = { { NULL, { NUL } }, NULL, 0, 0 };
|
||||
|
||||
/// Buffer used to store typed characters for vim.on_key().
|
||||
static kvec_withinit_t(char, MAXMAPLEN) on_key_buf = KVI_INITIAL_VALUE(on_key_buf);
|
||||
static kvec_withinit_t(char, MAXMAPLEN + 1) on_key_buf = KVI_INITIAL_VALUE(on_key_buf);
|
||||
|
||||
/// Number of following bytes that should not be stored for vim.on_key().
|
||||
static size_t no_on_key_len = 0;
|
||||
static size_t on_key_ignore_len = 0;
|
||||
|
||||
static int typeahead_char = 0; ///< typeahead char that's not flushed
|
||||
|
||||
@@ -1009,18 +1009,18 @@ int ins_typebuf(char *str, int noremap, int offset, bool nottyped, bool silent)
|
||||
/// Uses cmd_silent, KeyTyped and KeyNoremap to restore the flags belonging to
|
||||
/// the char.
|
||||
///
|
||||
/// @param no_on_key don't store these bytes for vim.on_key()
|
||||
/// @param on_key_ignore don't store these bytes for vim.on_key()
|
||||
///
|
||||
/// @return the length of what was inserted
|
||||
int ins_char_typebuf(int c, int modifiers, bool no_on_key)
|
||||
int ins_char_typebuf(int c, int modifiers, bool on_key_ignore)
|
||||
{
|
||||
char buf[MB_MAXBYTES * 3 + 4];
|
||||
unsigned len = special_to_buf(c, modifiers, true, buf);
|
||||
assert(len < sizeof(buf));
|
||||
buf[len] = NUL;
|
||||
ins_typebuf(buf, KeyNoremap, 0, !KeyTyped, cmd_silent);
|
||||
if (KeyTyped && no_on_key) {
|
||||
no_on_key_len += len;
|
||||
if (KeyTyped && on_key_ignore) {
|
||||
on_key_ignore_len += len;
|
||||
}
|
||||
return (int)len;
|
||||
}
|
||||
@@ -1188,22 +1188,21 @@ static void gotchars(const uint8_t *chars, size_t len)
|
||||
updatescript(state.buf[i]);
|
||||
}
|
||||
|
||||
state.buf[state.buflen] = NUL;
|
||||
if (state.buflen > on_key_ignore_len) {
|
||||
kvi_concat_len(on_key_buf, (char *)state.buf + on_key_ignore_len,
|
||||
state.buflen - on_key_ignore_len);
|
||||
on_key_ignore_len = 0;
|
||||
} else {
|
||||
on_key_ignore_len -= state.buflen;
|
||||
}
|
||||
|
||||
if (reg_recording != 0) {
|
||||
state.buf[state.buflen] = NUL;
|
||||
add_buff(&recordbuff, (char *)state.buf, (ptrdiff_t)state.buflen);
|
||||
// remember how many chars were last recorded
|
||||
last_recorded_len += state.buflen;
|
||||
}
|
||||
|
||||
if (state.buflen > no_on_key_len) {
|
||||
vim_unescape_ks((char *)state.buf + no_on_key_len);
|
||||
kvi_concat(on_key_buf, (char *)state.buf + no_on_key_len);
|
||||
no_on_key_len = 0;
|
||||
} else {
|
||||
no_on_key_len -= state.buflen;
|
||||
}
|
||||
|
||||
state.buflen = 0;
|
||||
}
|
||||
|
||||
@@ -1221,7 +1220,7 @@ static void gotchars(const uint8_t *chars, size_t len)
|
||||
void gotchars_ignore(void)
|
||||
{
|
||||
uint8_t nop_buf[3] = { K_SPECIAL, KS_EXTRA, KE_IGNORE };
|
||||
no_on_key_len += 3;
|
||||
on_key_ignore_len += 3;
|
||||
gotchars(nop_buf, 3);
|
||||
}
|
||||
|
||||
@@ -1634,8 +1633,52 @@ int vgetc(void)
|
||||
c = TO_SPECIAL(c2, c);
|
||||
}
|
||||
|
||||
// a keypad or special function key was not mapped, use it like
|
||||
// its ASCII equivalent
|
||||
// For a multi-byte character get all the bytes and return the
|
||||
// converted character.
|
||||
// Note: This will loop until enough bytes are received!
|
||||
int n;
|
||||
if ((n = MB_BYTE2LEN_CHECK(c)) > 1) {
|
||||
no_mapping++;
|
||||
buf[0] = (uint8_t)c;
|
||||
for (int i = 1; i < n; i++) {
|
||||
buf[i] = (uint8_t)vgetorpeek(true);
|
||||
if (buf[i] == K_SPECIAL) {
|
||||
// Must be a K_SPECIAL - KS_SPECIAL - KE_FILLER sequence,
|
||||
// which represents a K_SPECIAL (0x80).
|
||||
vgetorpeek(true); // skip KS_SPECIAL
|
||||
vgetorpeek(true); // skip KE_FILLER
|
||||
}
|
||||
}
|
||||
no_mapping--;
|
||||
c = utf_ptr2char((char *)buf);
|
||||
}
|
||||
|
||||
// If mappings are enabled (i.e., not i_CTRL-V) and the user directly typed
|
||||
// something with MOD_MASK_ALT (<M-/<A- modifier) that was not mapped, interpret
|
||||
// <M-x> as <Esc>x rather than as an unbound <M-x> keypress. #8213
|
||||
// In Terminal mode, however, this is not desirable. #16202 #16220
|
||||
// Also do not do this for mouse keys, as terminals encode mouse events as
|
||||
// CSI sequences, and MOD_MASK_ALT has a meaning even for unmapped mouse keys.
|
||||
if (!no_mapping && KeyTyped && mod_mask == MOD_MASK_ALT
|
||||
&& !(State & MODE_TERMINAL) && !is_mouse_key(c)) {
|
||||
mod_mask = 0;
|
||||
int len = ins_char_typebuf(c, 0, false);
|
||||
ins_char_typebuf(ESC, 0, false);
|
||||
int old_len = len + 3; // K_SPECIAL KS_MODIFIER MOD_MASK_ALT takes 3 more bytes
|
||||
ungetchars(old_len);
|
||||
if (on_key_buf.size >= (size_t)old_len) {
|
||||
on_key_buf.size -= (size_t)old_len;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (vgetc_char == 0) {
|
||||
vgetc_mod_mask = mod_mask;
|
||||
vgetc_char = c;
|
||||
}
|
||||
|
||||
// A keypad or special function key was not mapped, use it like
|
||||
// its ASCII equivalent.
|
||||
switch (c) {
|
||||
case K_KPLUS:
|
||||
c = '+'; break;
|
||||
@@ -1713,50 +1756,6 @@ int vgetc(void)
|
||||
c = K_RIGHT; break;
|
||||
}
|
||||
|
||||
// For a multi-byte character get all the bytes and return the
|
||||
// converted character.
|
||||
// Note: This will loop until enough bytes are received!
|
||||
int n;
|
||||
if ((n = MB_BYTE2LEN_CHECK(c)) > 1) {
|
||||
no_mapping++;
|
||||
buf[0] = (uint8_t)c;
|
||||
for (int i = 1; i < n; i++) {
|
||||
buf[i] = (uint8_t)vgetorpeek(true);
|
||||
if (buf[i] == K_SPECIAL) {
|
||||
// Must be a K_SPECIAL - KS_SPECIAL - KE_FILLER sequence,
|
||||
// which represents a K_SPECIAL (0x80).
|
||||
vgetorpeek(true); // skip KS_SPECIAL
|
||||
vgetorpeek(true); // skip KE_FILLER
|
||||
}
|
||||
}
|
||||
no_mapping--;
|
||||
c = utf_ptr2char((char *)buf);
|
||||
}
|
||||
|
||||
if (vgetc_char == 0) {
|
||||
vgetc_mod_mask = mod_mask;
|
||||
vgetc_char = c;
|
||||
}
|
||||
|
||||
// If mappings are enabled (i.e., not i_CTRL-V) and the user directly typed something with
|
||||
// MOD_MASK_ALT (<M-/<A- modifier) that was not mapped, interpret <M-x> as <Esc>x rather
|
||||
// than as an unbound <M-x> keypress. #8213
|
||||
// In Terminal mode, however, this is not desirable. #16202 #16220
|
||||
// Also do not do this for mouse keys, as terminals encode mouse events as CSI sequences, and
|
||||
// MOD_MASK_ALT has a meaning even for unmapped mouse keys.
|
||||
if (!no_mapping && KeyTyped && mod_mask == MOD_MASK_ALT && !(State & MODE_TERMINAL)
|
||||
&& !is_mouse_key(c)) {
|
||||
mod_mask = 0;
|
||||
int len = ins_char_typebuf(c, 0, false);
|
||||
ins_char_typebuf(ESC, 0, false);
|
||||
int old_len = len + 3; // K_SPECIAL KS_MODIFIER MOD_MASK_ALT takes 3 more bytes
|
||||
ungetchars(old_len);
|
||||
if (on_key_buf.size >= (size_t)old_len) {
|
||||
on_key_buf.size -= (size_t)old_len;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1769,7 +1768,8 @@ int vgetc(void)
|
||||
may_garbage_collect = false;
|
||||
|
||||
// Execute Lua on_key callbacks.
|
||||
nlua_execute_on_key(c, on_key_buf.items, on_key_buf.size);
|
||||
kvi_push(on_key_buf, NUL);
|
||||
nlua_execute_on_key(c, on_key_buf.items);
|
||||
kvi_destroy(on_key_buf);
|
||||
kvi_init(on_key_buf);
|
||||
|
||||
|
@@ -106,7 +106,8 @@ EXTERN int Columns INIT( = DFLT_COLS); // nr of columns in the screen
|
||||
// held down based on the MOD_MASK_* symbols that are read first.
|
||||
EXTERN int mod_mask INIT( = 0); // current key modifiers
|
||||
|
||||
// The value of "mod_mask" and the unmodified character before calling merge_modifiers().
|
||||
// The value of "mod_mask" and the unmodified character in vgetc() after it has
|
||||
// called vgetorpeek() enough times.
|
||||
EXTERN int vgetc_mod_mask INIT( = 0);
|
||||
EXTERN int vgetc_char INIT( = 0);
|
||||
|
||||
@@ -146,8 +147,7 @@ EXTERN hlf_T edit_submode_highl; // highl. method for extra info
|
||||
EXTERN bool cmdmsg_rl INIT( = false); // cmdline is drawn right to left
|
||||
EXTERN int msg_col;
|
||||
EXTERN int msg_row;
|
||||
EXTERN int msg_scrolled; // Number of screen lines that windows have
|
||||
// scrolled because of printing messages.
|
||||
EXTERN int msg_scrolled; ///< Number of screen lines that messages have scrolled.
|
||||
// when true don't set need_wait_return in msg_puts_attr()
|
||||
// when msg_scrolled is non-zero
|
||||
EXTERN bool msg_scrolled_ign INIT( = false);
|
||||
|
@@ -369,7 +369,7 @@ static const char *highlight_init_light[] = {
|
||||
"SpellLocal guisp=NvimDarkGreen gui=undercurl cterm=undercurl",
|
||||
"SpellRare guisp=NvimDarkCyan gui=undercurl cterm=undercurl",
|
||||
"StatusLine guifg=NvimLightGrey3 guibg=NvimDarkGrey3 cterm=reverse",
|
||||
"StatusLineNC guifg=NvimDarkGrey3 guibg=NvimLightGrey3 cterm=bold",
|
||||
"StatusLineNC guifg=NvimDarkGrey3 guibg=NvimLightGrey3 cterm=bold,underline",
|
||||
"Title guifg=NvimDarkGrey2 gui=bold cterm=bold",
|
||||
"Visual guibg=NvimLightGrey4 ctermfg=15 ctermbg=0",
|
||||
"WarningMsg guifg=NvimDarkYellow ctermfg=3",
|
||||
@@ -454,7 +454,7 @@ static const char *highlight_init_dark[] = {
|
||||
"SpellLocal guisp=NvimLightGreen gui=undercurl cterm=undercurl",
|
||||
"SpellRare guisp=NvimLightCyan gui=undercurl cterm=undercurl",
|
||||
"StatusLine guifg=NvimDarkGrey3 guibg=NvimLightGrey3 cterm=reverse",
|
||||
"StatusLineNC guifg=NvimLightGrey3 guibg=NvimDarkGrey3 cterm=bold",
|
||||
"StatusLineNC guifg=NvimLightGrey3 guibg=NvimDarkGrey3 cterm=bold,underline",
|
||||
"Title guifg=NvimLightGrey2 gui=bold cterm=bold",
|
||||
"Visual guibg=NvimDarkGrey4 ctermfg=0 ctermbg=15",
|
||||
"WarningMsg guifg=NvimLightYellow ctermfg=11",
|
||||
@@ -2268,7 +2268,6 @@ void highlight_changed(void)
|
||||
// sentinel value. used when no highlight namespace is active
|
||||
highlight_attr[HLF_COUNT] = 0;
|
||||
|
||||
//
|
||||
// Setup the user highlights
|
||||
//
|
||||
// Temporarily utilize 10 more hl entries:
|
||||
|
@@ -3419,9 +3419,7 @@ term_again:
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Skip preprocessor directives and blank lines.
|
||||
//
|
||||
if (cin_ispreproc_cont(&l, &curwin->w_cursor.lnum, &amount)) {
|
||||
continue;
|
||||
}
|
||||
|
@@ -121,7 +121,7 @@ static char *ctrl_x_msgs[] = {
|
||||
N_(" Command-line completion (^V^N^P)"),
|
||||
N_(" User defined completion (^U^N^P)"),
|
||||
N_(" Omni completion (^O^N^P)"),
|
||||
N_(" Spelling suggestion (s^N^P)"),
|
||||
N_(" Spelling suggestion (^S^N^P)"),
|
||||
N_(" Keyword Local completion (^N^P)"),
|
||||
NULL, // CTRL_X_EVAL doesn't use msg.
|
||||
N_(" Command-line completion (^V^N^P)"),
|
||||
|
@@ -2053,10 +2053,11 @@ char *nlua_register_table_as_callable(const typval_T *const arg)
|
||||
return name;
|
||||
}
|
||||
|
||||
void nlua_execute_on_key(int c, char *typed_buf, size_t typed_len)
|
||||
void nlua_execute_on_key(int c, char *typed_buf)
|
||||
{
|
||||
char buf[MB_MAXBYTES * 3 + 4];
|
||||
size_t buf_len = special_to_buf(c, mod_mask, false, buf);
|
||||
vim_unescape_ks(typed_buf);
|
||||
|
||||
lua_State *const lstate = global_lstate;
|
||||
|
||||
@@ -2075,7 +2076,7 @@ void nlua_execute_on_key(int c, char *typed_buf, size_t typed_len)
|
||||
lua_pushlstring(lstate, buf, buf_len);
|
||||
|
||||
// [ vim, vim._on_key, buf, typed_buf ]
|
||||
lua_pushlstring(lstate, typed_buf, typed_len);
|
||||
lua_pushstring(lstate, typed_buf);
|
||||
|
||||
int save_got_int = got_int;
|
||||
got_int = false; // avoid interrupts when the key typed is Ctrl-C
|
||||
|
@@ -545,10 +545,8 @@ int main(int argc, char **argv)
|
||||
|
||||
no_wait_return = true;
|
||||
|
||||
//
|
||||
// Create the requested number of windows and edit buffers in them.
|
||||
// Also does recovery if "recoverymode" set.
|
||||
//
|
||||
create_windows(¶ms);
|
||||
TIME_MSG("opening buffers");
|
||||
|
||||
|
@@ -78,13 +78,15 @@ int xctz(uint64_t x)
|
||||
}
|
||||
|
||||
/// Count number of set bits in bit field.
|
||||
int popcount(uint64_t x)
|
||||
unsigned xpopcount(uint64_t x)
|
||||
{
|
||||
// Use compiler builtin if possible.
|
||||
#if defined(__clang__) || defined(__GNUC__)
|
||||
return __builtin_popcountll(x);
|
||||
#if defined(__NetBSD__)
|
||||
return popcount64(x);
|
||||
#elif defined(__clang__) || defined(__GNUC__)
|
||||
return (unsigned)__builtin_popcountll(x);
|
||||
#else
|
||||
int count = 0;
|
||||
unsigned count = 0;
|
||||
for (; x != 0; x >>= 1) {
|
||||
if (x & 1) {
|
||||
count++;
|
||||
|
@@ -688,6 +688,9 @@ popupexit:
|
||||
if (in_statuscol && wp->w_p_rl) {
|
||||
click_col = wp->w_width_inner - click_col - 1;
|
||||
}
|
||||
if (in_statuscol && click_col >= (int)wp->w_statuscol_click_defs_size) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (click_defs != NULL) {
|
||||
switch (click_defs[click_col].type) {
|
||||
|
@@ -1579,8 +1579,20 @@ void adjust_skipcol(void)
|
||||
redraw_later(curwin, UPD_NOT_VALID);
|
||||
return; // don't scroll in the other direction now
|
||||
}
|
||||
colnr_T col = curwin->w_virtcol - curwin->w_skipcol + scrolloff_cols;
|
||||
int row = 0;
|
||||
colnr_T col = curwin->w_virtcol + scrolloff_cols;
|
||||
|
||||
// Avoid adjusting for 'scrolloff' beyond the text line height.
|
||||
if (scrolloff_cols > 0) {
|
||||
int size = win_linetabsize(curwin, curwin->w_topline,
|
||||
ml_get(curwin->w_topline), (colnr_T)MAXCOL);
|
||||
size = width1 + width2 * ((size - width1 + width2 - 1) / width2);
|
||||
while (col > size) {
|
||||
col -= width2;
|
||||
}
|
||||
}
|
||||
col -= curwin->w_skipcol;
|
||||
|
||||
if (col >= width1) {
|
||||
col -= width1;
|
||||
row++;
|
||||
@@ -2114,7 +2126,10 @@ void scroll_cursor_bot(win_T *wp, int min_scroll, bool set_topbot)
|
||||
wp->w_valid |= VALID_TOPLINE;
|
||||
wp->w_viewport_invalid = true;
|
||||
|
||||
cursor_correct_sms(wp);
|
||||
// Make sure cursor is still visible after adjusting skipcol for "zb".
|
||||
if (set_topbot) {
|
||||
cursor_correct_sms(wp);
|
||||
}
|
||||
}
|
||||
|
||||
/// Recompute topline to put the cursor halfway across the window
|
||||
@@ -2473,7 +2488,7 @@ int pagescroll(Direction dir, int count, bool half)
|
||||
int curscount = count;
|
||||
// Adjust count so as to not reveal end of buffer lines.
|
||||
if (dir == FORWARD
|
||||
&& (curwin->w_topline + curwin->w_height + count > buflen || hasAnyFolding(curwin))) {
|
||||
&& (curwin->w_topline + curwin->w_height_inner + count > buflen || hasAnyFolding(curwin))) {
|
||||
int n = plines_correct_topline(curwin, curwin->w_topline, NULL, false, NULL);
|
||||
if (n - count < curwin->w_height_inner && curwin->w_topline < buflen) {
|
||||
n += plines_m_win(curwin, curwin->w_topline + 1, buflen, curwin->w_height_inner + count);
|
||||
@@ -2505,9 +2520,11 @@ int pagescroll(Direction dir, int count, bool half)
|
||||
? MAX(1, (int)p_window - 2) : get_scroll_overlap(dir));
|
||||
nochange = scroll_with_sms(dir, count, &count);
|
||||
|
||||
// Place cursor at top or bottom of window.
|
||||
validate_botline(curwin);
|
||||
curwin->w_cursor.lnum = (dir == FORWARD ? curwin->w_topline : curwin->w_botline - 1);
|
||||
if (!nochange) {
|
||||
// Place cursor at top or bottom of window.
|
||||
validate_botline(curwin);
|
||||
curwin->w_cursor.lnum = (dir == FORWARD ? curwin->w_topline : curwin->w_botline - 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (get_scrolloff_value(curwin) > 0) {
|
||||
|
@@ -1659,7 +1659,6 @@ size_t find_ident_at_pos(win_T *wp, linenr_T lnum, colnr_T startcol, char **text
|
||||
// When starting on a ']' count it, so that we include the '['.
|
||||
bn = ptr[col] == ']';
|
||||
|
||||
//
|
||||
// 2. Back up to start of identifier/text.
|
||||
//
|
||||
// Remember class of character under cursor.
|
||||
|
@@ -747,7 +747,7 @@ return {
|
||||
applying 'breakindent', even if the resulting
|
||||
text should normally be narrower. This prevents
|
||||
text indented almost to the right window border
|
||||
occupying lot of vertical space when broken.
|
||||
occupying lots of vertical space when broken.
|
||||
(default: 20)
|
||||
shift:{n} After applying 'breakindent', the wrapped line's
|
||||
beginning will be shifted by the given number of
|
||||
@@ -4221,7 +4221,7 @@ return {
|
||||
in Insert mode as specified with the 'indentkeys' option.
|
||||
When this option is not empty, it overrules the 'cindent' and
|
||||
'smartindent' indenting. When 'lisp' is set, this option is
|
||||
is only used when 'lispoptions' contains "expr:1".
|
||||
only used when 'lispoptions' contains "expr:1".
|
||||
The expression is evaluated with |v:lnum| set to the line number for
|
||||
which the indent is to be computed. The cursor is also in this line
|
||||
when the expression is evaluated (but it may be moved around).
|
||||
@@ -4612,7 +4612,7 @@ return {
|
||||
part can be in one of two forms:
|
||||
1. A list of pairs. Each pair is a "from" character immediately
|
||||
followed by the "to" character. Examples: "aA", "aAbBcC".
|
||||
2. A list of "from" characters, a semi-colon and a list of "to"
|
||||
2. A list of "from" characters, a semicolon and a list of "to"
|
||||
characters. Example: "abc;ABC"
|
||||
Example: "aA,fgh;FGH,cCdDeE"
|
||||
Special characters need to be preceded with a backslash. These are
|
||||
@@ -4725,7 +4725,7 @@ return {
|
||||
update use |:redraw|.
|
||||
This may occasionally cause display errors. It is only meant to be set
|
||||
temporarily when performing an operation where redrawing may cause
|
||||
flickering or cause a slow down.
|
||||
flickering or cause a slowdown.
|
||||
]=],
|
||||
full_name = 'lazyredraw',
|
||||
scope = { 'global' },
|
||||
@@ -4868,6 +4868,9 @@ return {
|
||||
between tabs and spaces and for trailing blanks. Further changed by
|
||||
the 'listchars' option.
|
||||
|
||||
When 'listchars' does not contain "tab" field, tabs are shown as "^I"
|
||||
or "<09>", like how unprintable characters are displayed.
|
||||
|
||||
The cursor is displayed at the start of the space a Tab character
|
||||
occupies, not at the end as usual in Normal mode. To get this cursor
|
||||
position while displaying Tabs with spaces, use: >vim
|
||||
@@ -5984,7 +5987,7 @@ return {
|
||||
set path+=
|
||||
< To use an environment variable, you probably need to replace the
|
||||
separator. Here is an example to append $INCL, in which directory
|
||||
names are separated with a semi-colon: >vim
|
||||
names are separated with a semicolon: >vim
|
||||
let &path = &path .. "," .. substitute($INCL, ';', ',', 'g')
|
||||
< Replace the ';' with a ':' or whatever separator is used. Note that
|
||||
this doesn't work when $INCL contains a comma or white space.
|
||||
@@ -7300,7 +7303,7 @@ return {
|
||||
defaults = { if_true = 'ltToOCF' },
|
||||
desc = [=[
|
||||
This option helps to avoid all the |hit-enter| prompts caused by file
|
||||
messages, for example with CTRL-G, and to avoid some other messages.
|
||||
messages, for example with CTRL-G, and to avoid some other messages.
|
||||
It is a list of flags:
|
||||
flag meaning when present ~
|
||||
l use "999L, 888B" instead of "999 lines, 888 bytes" *shm-l*
|
||||
@@ -7889,7 +7892,7 @@ return {
|
||||
minus two.
|
||||
|
||||
timeout:{millisec} Limit the time searching for suggestions to
|
||||
{millisec} milli seconds. Applies to the following
|
||||
{millisec} milliseconds. Applies to the following
|
||||
methods. When omitted the limit is 5000. When
|
||||
negative there is no limit.
|
||||
|
||||
@@ -9837,7 +9840,6 @@ return {
|
||||
]=],
|
||||
full_name = 'winfixbuf',
|
||||
pv_name = 'p_wfb',
|
||||
redraw = { 'current_window' },
|
||||
scope = { 'window' },
|
||||
short_desc = N_('pin a window to a specific buffer'),
|
||||
type = 'boolean',
|
||||
|
@@ -474,17 +474,9 @@ void init_homedir(void)
|
||||
var = os_homedir();
|
||||
}
|
||||
|
||||
if (var != NULL) {
|
||||
// Change to the directory and get the actual path. This resolves
|
||||
// links. Don't do it when we can't return.
|
||||
if (os_dirname(os_buf, MAXPATHL) == OK && os_chdir(os_buf) == 0) {
|
||||
if (!os_chdir(var) && os_dirname(IObuff, IOSIZE) == OK) {
|
||||
var = IObuff;
|
||||
}
|
||||
if (os_chdir(os_buf) != 0) {
|
||||
emsg(_(e_prev_dir));
|
||||
}
|
||||
}
|
||||
// Get the actual path. This resolves links.
|
||||
if (var != NULL && os_realpath(var, IObuff, IOSIZE) != NULL) {
|
||||
var = IObuff;
|
||||
}
|
||||
|
||||
// Fall back to current working directory if home is not found
|
||||
|
@@ -1320,22 +1320,22 @@ bool os_fileid_equal_fileinfo(const FileID *file_id, const FileInfo *file_info)
|
||||
/// Return the canonicalized absolute pathname.
|
||||
///
|
||||
/// @param[in] name Filename to be canonicalized.
|
||||
/// @param[out] buf Buffer to store the canonicalized values. A minimum length
|
||||
// of MAXPATHL+1 is required. If it is NULL, memory is
|
||||
// allocated. In that case, the caller should deallocate this
|
||||
// buffer.
|
||||
/// @param[out] buf Buffer to store the canonicalized values.
|
||||
/// If it is NULL, memory is allocated. In that case, the caller
|
||||
/// should deallocate this buffer.
|
||||
/// @param[in] len The length of the buffer.
|
||||
///
|
||||
/// @return pointer to the buf on success, or NULL.
|
||||
char *os_realpath(const char *name, char *buf)
|
||||
char *os_realpath(const char *name, char *buf, size_t len)
|
||||
FUNC_ATTR_NONNULL_ARG(1)
|
||||
{
|
||||
uv_fs_t request;
|
||||
int result = uv_fs_realpath(NULL, &request, name, NULL);
|
||||
if (result == kLibuvSuccess) {
|
||||
if (buf == NULL) {
|
||||
buf = xmallocz(MAXPATHL);
|
||||
buf = xmalloc(len);
|
||||
}
|
||||
xstrlcpy(buf, request.ptr, MAXPATHL + 1);
|
||||
xstrlcpy(buf, request.ptr, len);
|
||||
}
|
||||
uv_fs_req_cleanup(&request);
|
||||
return result == kLibuvSuccess ? buf : NULL;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user