mirror of
https://github.com/neovim/neovim.git
synced 2024-09-17 20:58:20 -04:00
Compare commits
123 Commits
f7d08562c6
...
72f0808079
Author | SHA1 | Date | |
---|---|---|---|
|
72f0808079 | ||
|
3b54adc6c6 | ||
|
325d349f9d | ||
|
5191a11d66 | ||
|
90585e47fe | ||
|
f2173b1aa2 | ||
|
67d6b6f27e | ||
|
8512f669f0 | ||
|
755512ed60 | ||
|
4c23b83456 | ||
|
5284a2a793 | ||
|
b9b408a56c | ||
|
8654a97006 | ||
|
057314345a | ||
|
deac7df80a | ||
|
ae917dbd06 | ||
|
c65153893a | ||
|
f6cc0394ae | ||
|
f347c292d1 | ||
|
48c14d3544 | ||
|
5931f780e0 | ||
|
98ba65b8be | ||
|
f9bf64d746 | ||
|
a30afeeb85 | ||
|
7b680e0ca9 | ||
|
8501fe621a | ||
|
a5bd6665b0 | ||
|
4ac733f6ef | ||
|
c1a4b8680b | ||
|
f6579a4db1 | ||
|
608ef83fc6 | ||
|
57db94235c | ||
|
cdab8c8ebb | ||
|
830cf054bc | ||
|
def6111118 | ||
|
237d2aef4d | ||
|
15bfdf73ea | ||
|
f289161c3c | ||
|
4b98d38870 | ||
|
4c5bce9cb4 | ||
|
5d7853f229 | ||
|
f279d1ae33 | ||
|
9ddfcb64bf | ||
|
8e81212e15 | ||
|
648d6426c8 | ||
|
f0334c2c71 | ||
|
c8e3618e0e | ||
|
ed832b9ddf | ||
|
8a2aec9974 | ||
|
3a88113246 | ||
|
08153ddd1c | ||
|
003b8a251d | ||
|
0cfbc6eaff | ||
|
95b65a7554 | ||
|
e37404f7fe | ||
|
b40ec083ae | ||
|
d338ec9cb2 | ||
|
5ddf2ab768 | ||
|
3d1110674e | ||
|
738a84de09 | ||
|
439d031742 | ||
|
c81cb02dd6 | ||
|
fa99afe35e | ||
|
9570ad24f5 | ||
|
d60c753cff | ||
|
e36e68d35c | ||
|
f4d823b123 | ||
|
76aa3e52be | ||
|
f9108378b7 | ||
|
975aeee537 | ||
|
882a450a29 | ||
|
220b8aa6fe | ||
|
51088b67cb | ||
|
34ded4d97b | ||
|
b6e350a6b4 | ||
|
7b7c95dac9 | ||
|
45e76acaa0 | ||
|
fdd3a9cdf7 | ||
|
d1d7d54680 | ||
|
ceddaedfad | ||
|
ea2d949351 | ||
|
ae9674704a | ||
|
96128a5076 | ||
|
137f98cf64 | ||
|
ef8067a19d | ||
|
60ea046741 | ||
|
50a576ba57 | ||
|
a8fc799e8b | ||
|
13c739a664 | ||
|
bcae8be91f | ||
|
61e9137394 | ||
|
6913c5e1d9 | ||
|
318c0415d5 | ||
|
97f8d1de1c | ||
|
9b983e5f6c | ||
|
195eca94d4 | ||
|
9762c5e340 | ||
|
808d73b5df | ||
|
bfa365a872 | ||
|
f046c3eca6 | ||
|
751ab0e4ca | ||
|
5f81c36934 | ||
|
ea2998fec9 | ||
|
6f167fcae9 | ||
|
4ee65484b1 | ||
|
e1937286f0 | ||
|
26be6446e5 | ||
|
a6c4487e8b | ||
|
53af02adba | ||
|
55dc482e75 | ||
|
42ed0ffad9 | ||
|
5f95f1249f | ||
|
cfdf68a7ac | ||
|
4353996d0f | ||
|
862679c70f | ||
|
9a3c8f64a7 | ||
|
59baa5e8a1 | ||
|
176bfea135 | ||
|
7588ff2d89 | ||
|
6c2186a998 | ||
|
0346666f71 | ||
|
cd05a72fec | ||
|
7ee02ad56e |
18
.github/workflows/backport.yml
vendored
18
.github/workflows/backport.yml
vendored
@ -26,3 +26,21 @@ jobs:
|
||||
pull_title: "${pull_title}"
|
||||
label_pattern: "^ci:backport ([^ ]+)$"
|
||||
github_token: ${{ steps.app-token.outputs.token }}
|
||||
|
||||
- name: Create failed backport label
|
||||
if: ${{ steps.backport.outputs.was_successful == 'false' }}
|
||||
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: ['needs:backport']
|
||||
})
|
||||
|
||||
- name: Enable automerge
|
||||
if: ${{ steps.backport.outputs.was_successful == 'true' }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: gh pr merge --rebase --auto ${{ steps.backport.outputs.created_pull_numbers }}
|
||||
|
6
.github/workflows/optional.yml
vendored
6
.github/workflows/optional.yml
vendored
@ -11,7 +11,7 @@ concurrency:
|
||||
env:
|
||||
INSTALL_PREFIX: ${{ github.workspace }}/nvim-install
|
||||
# Double test timeout since it's running via qemu
|
||||
TEST_TIMEOUT: 2400
|
||||
TEST_TIMEOUT: 3600
|
||||
# TEST_FILE: test/functional/shada
|
||||
# TEST_FILTER: foo
|
||||
|
||||
@ -23,7 +23,7 @@ jobs:
|
||||
matrix:
|
||||
test: [functionaltest, oldtest]
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
timeout-minutes: 90
|
||||
steps:
|
||||
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
||||
- uses: docker://multiarch/ubuntu-core:s390x-focal
|
||||
@ -34,7 +34,7 @@ jobs:
|
||||
bash -c
|
||||
"
|
||||
apt-get -y update &&
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential cmake curl gettext ninja-build locales-all cpanminus git attr libattr1-dev &&
|
||||
time DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential cmake curl gettext ninja-build locales-all cpanminus git attr libattr1-dev xdg-utils &&
|
||||
useradd --create-home qemuci &&
|
||||
chown -R qemuci. . &&
|
||||
runuser -u qemuci -- git clone --depth=1 https://github.com/neovim/neovim.git &&
|
||||
|
2
.github/workflows/reviewers_add.yml
vendored
2
.github/workflows/reviewers_add.yml
vendored
@ -5,7 +5,7 @@ on:
|
||||
workflow_call:
|
||||
jobs:
|
||||
request-reviewer:
|
||||
if: github.event.pull_request.state == 'open' && github.event.pull_request.draft == false
|
||||
if: github.event.pull_request.state == 'open' && github.event.pull_request.draft == false && !endsWith(github.actor, '[bot]')
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
|
@ -112,7 +112,7 @@ sudo rm -rf /opt/nvim
|
||||
sudo tar -C /opt -xzf nvim-linux64.tar.gz
|
||||
```
|
||||
|
||||
Then add this to your shell config (`~/.bashrc`, `~/. zshrc`, ...):
|
||||
Then add this to your shell config (`~/.bashrc`, `~/.zshrc`, ...):
|
||||
|
||||
export PATH="$PATH:/opt/nvim-linux64/bin"
|
||||
|
||||
@ -129,7 +129,7 @@ To expose nvim globally:
|
||||
mkdir -p /opt/nvim
|
||||
mv nvim.appimage /opt/nvim/nvim
|
||||
|
||||
And the following line to your shell config (`~/.bashrc`, `~/. zshrc`, ...):
|
||||
And the following line to your shell config (`~/.bashrc`, `~/.zshrc`, ...):
|
||||
|
||||
export PATH="$PATH:/opt/nvim/"
|
||||
|
||||
|
12
MAINTAIN.md
12
MAINTAIN.md
@ -160,7 +160,6 @@ These dependencies are "vendored" (inlined), we must update the sources manually
|
||||
* Needs to be updated when LPeg is updated.
|
||||
* `src/bit.c`: only for PUC lua: port of `require'bit'` from luajit https://bitop.luajit.org/
|
||||
* `runtime/lua/coxpcall.lua`: coxpcall (only needed for PUC lua, builtin to luajit)
|
||||
* `src/termkey`: [libtermkey](https://github.com/neovim/libtermkey)
|
||||
|
||||
Other dependencies
|
||||
--------------------------
|
||||
@ -170,6 +169,9 @@ Other dependencies
|
||||
* https://github.com/nvim-winget
|
||||
* Org secrets/tokens:
|
||||
* `CODECOV_TOKEN`
|
||||
* `BACKPORT_KEY`
|
||||
* Org/repo variables:
|
||||
* `BACKPORT_APP`
|
||||
* Domain names (held in https://namecheap.com):
|
||||
* neovim.org
|
||||
* neovim.io
|
||||
@ -185,10 +187,10 @@ Refactoring
|
||||
|
||||
Refactoring Vim structurally and aesthetically is an important goal of Neovim.
|
||||
But there are some modules that should not be changed significantly, because
|
||||
they are maintained Vim, at present. Until someone takes "ownership" of these
|
||||
modules, the cost of any significant changes (including style or structural
|
||||
changes that re-arrange the code) to these modules outweighs the benefit. The
|
||||
modules are:
|
||||
they are maintained by Vim, at present. Until someone takes "ownership" of
|
||||
these modules, the cost of any significant changes (including style or
|
||||
structural changes that re-arrange the code) to these modules outweighs the
|
||||
benefit. The modules are:
|
||||
|
||||
- `regexp.c`
|
||||
- `indent_c.c`
|
||||
|
69
Makefile
69
Makefile
@ -1,3 +1,25 @@
|
||||
ifeq ($(OS),Windows_NT)
|
||||
SHELL := powershell.exe
|
||||
.SHELLFLAGS := -NoProfile -NoLogo
|
||||
MKDIR := @$$null = new-item -itemtype directory -force
|
||||
TOUCH := @$$null = new-item -force
|
||||
RM := remove-item -force
|
||||
CMAKE := cmake
|
||||
CMAKE_GENERATOR := Ninja
|
||||
define rmdir
|
||||
if (Test-Path $1) { remove-item -recurse $1 }
|
||||
endef
|
||||
else
|
||||
MKDIR := mkdir -p
|
||||
TOUCH := touch
|
||||
RM := rm -rf
|
||||
CMAKE := $(shell (command -v cmake3 || echo cmake))
|
||||
CMAKE_GENERATOR ?= "$(shell (command -v ninja > /dev/null 2>&1 && echo "Ninja") || echo "Unix Makefiles")"
|
||||
define rmdir
|
||||
rm -rf $1
|
||||
endef
|
||||
endif
|
||||
|
||||
MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||
MAKEFILE_DIR := $(dir $(MAKEFILE_PATH))
|
||||
|
||||
@ -9,7 +31,6 @@ filter-true = $(strip $(filter-out 1 on ON true TRUE,$1))
|
||||
|
||||
all: nvim
|
||||
|
||||
CMAKE ?= $(shell (command -v cmake3 || echo cmake))
|
||||
CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
|
||||
# Extra CMake flags which extend the default set
|
||||
CMAKE_EXTRA_FLAGS ?=
|
||||
@ -37,21 +58,11 @@ else
|
||||
checkprefix: ;
|
||||
endif
|
||||
|
||||
CMAKE_GENERATOR ?= $(shell (command -v ninja > /dev/null 2>&1 && echo "Ninja") || \
|
||||
echo "Unix Makefiles")
|
||||
DEPS_BUILD_DIR ?= .deps
|
||||
DEPS_BUILD_DIR ?= ".deps"
|
||||
ifneq (1,$(words [$(DEPS_BUILD_DIR)]))
|
||||
$(error DEPS_BUILD_DIR must not contain whitespace)
|
||||
endif
|
||||
|
||||
ifeq (,$(BUILD_TOOL))
|
||||
ifeq (Ninja,$(CMAKE_GENERATOR))
|
||||
BUILD_TOOL = ninja
|
||||
else
|
||||
BUILD_TOOL = $(MAKE)
|
||||
endif
|
||||
endif
|
||||
|
||||
DEPS_CMAKE_FLAGS ?=
|
||||
USE_BUNDLED ?=
|
||||
|
||||
@ -61,7 +72,7 @@ endif
|
||||
|
||||
ifneq (,$(findstring functionaltest-lua,$(MAKECMDGOALS)))
|
||||
BUNDLED_LUA_CMAKE_FLAG := -DUSE_BUNDLED_LUA=ON
|
||||
$(shell [ -x $(DEPS_BUILD_DIR)/usr/bin/lua ] || rm build/.ran-*)
|
||||
$(shell [ -x $(DEPS_BUILD_DIR)/usr/bin/lua ] || $(RM) build/.ran-*)
|
||||
endif
|
||||
|
||||
# For use where we want to make sure only a single job is run. This does issue
|
||||
@ -69,34 +80,33 @@ endif
|
||||
SINGLE_MAKE = export MAKEFLAGS= ; $(MAKE)
|
||||
|
||||
nvim: build/.ran-cmake deps
|
||||
$(BUILD_TOOL) -C build
|
||||
$(CMAKE) --build build
|
||||
|
||||
libnvim: build/.ran-cmake deps
|
||||
$(BUILD_TOOL) -C build libnvim
|
||||
$(CMAKE) --build build --target libnvim
|
||||
|
||||
cmake:
|
||||
touch CMakeLists.txt
|
||||
$(TOUCH) CMakeLists.txt
|
||||
$(MAKE) build/.ran-cmake
|
||||
|
||||
build/.ran-cmake: | deps
|
||||
$(CMAKE) -B build -G '$(CMAKE_GENERATOR)' $(CMAKE_FLAGS) $(CMAKE_EXTRA_FLAGS) $(MAKEFILE_DIR)
|
||||
touch $@
|
||||
$(CMAKE) -B build -G $(CMAKE_GENERATOR) $(CMAKE_FLAGS) $(CMAKE_EXTRA_FLAGS) $(MAKEFILE_DIR)
|
||||
$(TOUCH) $@
|
||||
|
||||
deps: | build/.ran-deps-cmake
|
||||
ifeq ($(call filter-true,$(USE_BUNDLED)),)
|
||||
$(BUILD_TOOL) -C $(DEPS_BUILD_DIR)
|
||||
$(CMAKE) --build $(DEPS_BUILD_DIR)
|
||||
endif
|
||||
|
||||
ifeq ($(call filter-true,$(USE_BUNDLED)),)
|
||||
$(DEPS_BUILD_DIR):
|
||||
mkdir -p "$@"
|
||||
$(MKDIR) $@
|
||||
build/.ran-deps-cmake:: $(DEPS_BUILD_DIR)
|
||||
$(CMAKE) -S $(MAKEFILE_DIR)/cmake.deps -B $(DEPS_BUILD_DIR) -G '$(CMAKE_GENERATOR)' \
|
||||
$(BUNDLED_CMAKE_FLAG) $(BUNDLED_LUA_CMAKE_FLAG) $(DEPS_CMAKE_FLAGS)
|
||||
$(CMAKE) -S $(MAKEFILE_DIR)/cmake.deps -B $(DEPS_BUILD_DIR) -G $(CMAKE_GENERATOR) $(BUNDLED_CMAKE_FLAG) $(BUNDLED_LUA_CMAKE_FLAG) $(DEPS_CMAKE_FLAGS)
|
||||
endif
|
||||
build/.ran-deps-cmake::
|
||||
mkdir -p build
|
||||
touch $@
|
||||
$(MKDIR) build
|
||||
$(TOUCH) "$@"
|
||||
|
||||
# TODO: cmake 3.2+ add_custom_target() has a USES_TERMINAL flag.
|
||||
oldtest: | nvim
|
||||
@ -113,7 +123,7 @@ test/old/testdir/%.vim: phony_force nvim
|
||||
$(SINGLE_MAKE) -C test/old/testdir NVIM_PRG=$(NVIM_PRG) SCRIPTS= $(MAKEOVERRIDES) $(patsubst test/old/testdir/%.vim,%,$@)
|
||||
|
||||
functionaltest-lua: | nvim
|
||||
$(BUILD_TOOL) -C build functionaltest
|
||||
$(CMAKE) --build build --target functionaltest
|
||||
|
||||
FORMAT=formatc formatlua format
|
||||
LINT=lintlua lintsh lintc clang-analyzer lintcommit lintdoc lint
|
||||
@ -135,16 +145,19 @@ iwyu: build/.ran-cmake
|
||||
$(CMAKE) --build build
|
||||
|
||||
clean:
|
||||
test -d build && $(BUILD_TOOL) -C build clean || true
|
||||
ifneq ($(wildcard build),)
|
||||
$(CMAKE) --build build --target clean
|
||||
endif
|
||||
$(MAKE) -C test/old/testdir clean
|
||||
$(MAKE) -C runtime/indent clean
|
||||
|
||||
distclean:
|
||||
rm -rf $(DEPS_BUILD_DIR) build
|
||||
$(call rmdir, $(DEPS_BUILD_DIR))
|
||||
$(call rmdir, build)
|
||||
$(MAKE) clean
|
||||
|
||||
install: checkprefix nvim
|
||||
$(BUILD_TOOL) -C build install
|
||||
$(CMAKE) --install build
|
||||
|
||||
appimage:
|
||||
bash scripts/genappimage.sh
|
||||
|
@ -1,5 +1,5 @@
|
||||
LIBUV_URL https://github.com/libuv/libuv/archive/v1.48.0.tar.gz
|
||||
LIBUV_SHA256 8c253adb0f800926a6cbd1c6576abae0bc8eb86a4f891049b72f9e5b7dc58f33
|
||||
LIBUV_URL https://github.com/libuv/libuv/archive/0a00e80c3686b93eccb9a801954e86bd7d7fe6ab.tar.gz
|
||||
LIBUV_SHA256 8d240ad56f779ebca94a249b2a2c71725d89182e732cf53c1f6d85098cc9bcb3
|
||||
|
||||
LUAJIT_URL https://github.com/LuaJIT/LuaJIT/archive/f725e44cda8f359869bf8f92ce71787ddca45618.tar.gz
|
||||
LUAJIT_SHA256 2b5514bd6a6573cb6111b43d013e952cbaf46762d14ebe26c872ddb80b5a84e0
|
||||
@ -7,8 +7,8 @@ LUAJIT_SHA256 2b5514bd6a6573cb6111b43d013e952cbaf46762d14ebe26c872ddb80b5a84e0
|
||||
LUA_URL https://www.lua.org/ftp/lua-5.1.5.tar.gz
|
||||
LUA_SHA256 2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333
|
||||
|
||||
UNIBILIUM_URL https://github.com/neovim/unibilium/archive/d72c3598e7ac5d1ebf86ee268b8b4ed95c0fa628.tar.gz
|
||||
UNIBILIUM_SHA256 9c4747c862ab5e3076dcf8fa8f0ea7a6b50f20ec5905618b9536655596797487
|
||||
UNIBILIUM_URL https://github.com/neovim/unibilium/archive/v2.1.2.tar.gz
|
||||
UNIBILIUM_SHA256 370ecb07fbbc20d91d1b350c55f1c806b06bf86797e164081ccc977fc9b3af7a
|
||||
|
||||
LUV_URL https://github.com/luvit/luv/releases/download/1.48.0-2/luv-1.48.0-2.tar.gz
|
||||
LUV_SHA256 2c3a1ddfebb4f6550293a40ee789f7122e97647eede51511f57203de48c03b7a
|
||||
@ -35,21 +35,21 @@ GETTEXT_SHA256 66415634c6e8c3fa8b71362879ec7575e27da43da562c798a8a2f223e6e47f5c
|
||||
LIBICONV_URL https://github.com/neovim/deps/raw/b9bf36eb31f27e8136d907da38fa23518927737e/opt/libiconv-1.17.tar.gz
|
||||
LIBICONV_SHA256 8f74213b56238c85a50a5329f77e06198771e70dd9a739779f4c02f65d971313
|
||||
|
||||
UTF8PROC_URL https://github.com/JuliaStrings/utf8proc/archive/v2.9.0.tar.gz
|
||||
UTF8PROC_SHA256 18c1626e9fc5a2e192311e36b3010bfc698078f692888940f1fa150547abb0c1
|
||||
UTF8PROC_URL https://github.com/JuliaStrings/utf8proc/archive/3de4596fbe28956855df2ecb3c11c0bbc3535838.tar.gz
|
||||
UTF8PROC_SHA256 fb4a16bb659b58afb7f921fcc8928d0b3c1fcab135366c8a4f9ca7de1b1cfada
|
||||
|
||||
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_C_URL https://github.com/tree-sitter/tree-sitter-c/archive/v0.23.0.tar.gz
|
||||
TREESITTER_C_SHA256 ee58c925e2e507c23d735aad46bf7fb0af31ca06d6f4f41bc008216d9232b0cb
|
||||
TREESITTER_LUA_URL https://github.com/tree-sitter-grammars/tree-sitter-lua/archive/v0.2.0.tar.gz
|
||||
TREESITTER_LUA_SHA256 6c41227cd0a59047b19d31f0031d4d901f08bfd78d6fc7f55c89e5b8374c794e
|
||||
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/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_MARKDOWN_URL https://github.com/tree-sitter-grammars/tree-sitter-markdown/archive/v0.3.2.tar.gz
|
||||
TREESITTER_MARKDOWN_SHA256 5dac48a6d971eb545aab665d59a18180d21963afc781bbf40f9077c06cb82ae5
|
||||
TREESITTER_URL https://github.com/tree-sitter/tree-sitter/archive/v0.23.0.tar.gz
|
||||
TREESITTER_SHA256 6403b361b0014999e96f61b9c84d6950d42f0c7d6e806be79382e0232e48a11b
|
||||
|
||||
|
@ -50,6 +50,7 @@
|
||||
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_TS=OFF
|
||||
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_TS_PARSERS=OFF
|
||||
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_UNIBILIUM=OFF
|
||||
# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_UTF8PROC=OFF
|
||||
#
|
||||
# Or disable all bundled dependencies at once.
|
||||
#
|
||||
|
40
runtime/autoload/hcl.vim
Normal file
40
runtime/autoload/hcl.vim
Normal file
@ -0,0 +1,40 @@
|
||||
" Language: HCL
|
||||
" Maintainer: Gregory Anders
|
||||
" Last Change: 2024-09-03
|
||||
" Based on: https://github.com/hashivim/vim-terraform
|
||||
|
||||
function! hcl#indentexpr(lnum)
|
||||
" Beginning of the file should have no indent
|
||||
if a:lnum == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
" Usual case is to continue at the same indent as the previous non-blank line.
|
||||
let prevlnum = prevnonblank(a:lnum-1)
|
||||
let thisindent = indent(prevlnum)
|
||||
|
||||
" If that previous line is a non-comment ending in [ { (, increase the
|
||||
" indent level.
|
||||
let prevline = getline(prevlnum)
|
||||
if prevline !~# '^\s*\(#\|//\)' && prevline =~# '[\[{\(]\s*$'
|
||||
let thisindent += &shiftwidth
|
||||
endif
|
||||
|
||||
" If the current line ends a block, decrease the indent level.
|
||||
let thisline = getline(a:lnum)
|
||||
if thisline =~# '^\s*[\)}\]]'
|
||||
let thisindent -= &shiftwidth
|
||||
endif
|
||||
|
||||
" If the previous line starts a block comment /*, increase by one
|
||||
if prevline =~# '/\*'
|
||||
let thisindent += 1
|
||||
endif
|
||||
|
||||
" If the previous line ends a block comment */, decrease by one
|
||||
if prevline =~# '\*/'
|
||||
let thisindent -= 1
|
||||
endif
|
||||
|
||||
return thisindent
|
||||
endfunction
|
@ -140,6 +140,18 @@ function! provider#clipboard#Executable() abort
|
||||
let s:copy['*'] = s:copy['+']
|
||||
let s:paste['*'] = s:paste['+']
|
||||
return 'win32yank'
|
||||
elseif executable('putclip') && executable('getclip')
|
||||
let s:copy['+'] = ['putclip']
|
||||
let s:paste['+'] = ['getclip']
|
||||
let s:copy['*'] = s:copy['+']
|
||||
let s:paste['*'] = s:paste['+']
|
||||
return 'putclip'
|
||||
elseif executable('clip') && executable('powershell')
|
||||
let s:copy['+'] = ['clip']
|
||||
let s:paste['+'] = ['powershell', '-NoProfile', '-NoLogo', '-Command', 'Get-Clipboard']
|
||||
let s:copy['*'] = s:copy['+']
|
||||
let s:paste['*'] = s:paste['+']
|
||||
return 'clip'
|
||||
elseif executable('termux-clipboard-set')
|
||||
let s:copy['+'] = ['termux-clipboard-set']
|
||||
let s:paste['+'] = ['termux-clipboard-get']
|
||||
|
@ -4,6 +4,8 @@ They are used with the ":compiler" command.
|
||||
These scripts usually set options, for example 'errorformat'.
|
||||
See ":help write-compiler-plugin".
|
||||
|
||||
To undo the effect of a compiler plugin, use the make compiler plugin.
|
||||
|
||||
If you want to write your own compiler plugin, have a look at the other files
|
||||
for how to do it, the format is simple.
|
||||
|
||||
|
45
runtime/compiler/groff.vim
Normal file
45
runtime/compiler/groff.vim
Normal file
@ -0,0 +1,45 @@
|
||||
" Vim compiler file
|
||||
" Compiler: Groff
|
||||
" Maintainer: Konfekt
|
||||
" Last Change: 2024 Sep 8
|
||||
"
|
||||
" Expects output file extension, say `:make html` or `:make pdf`.
|
||||
" Supported devices as of Sept 2024 are: (x)html, pdf, ps, dvi, lj4, lbp ...
|
||||
" Adjust command-line flags, language, encoding by buffer-local/global variables
|
||||
" groff_compiler_args, groff_compiler_lang, and groff_compiler_encoding,
|
||||
" which default to '', &spelllang and 'utf8'.
|
||||
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:keepcpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let current_compiler = 'groff'
|
||||
|
||||
silent! function s:groff_compiler_lang()
|
||||
let lang = get(b:, 'groff_compiler_lang',
|
||||
\ &spell ? matchstr(&spelllang, '^\a\a') : '')
|
||||
if lang ==# 'en' | let lang = '' | endif
|
||||
return empty(lang) ? '' : '-m'..lang
|
||||
endfunction
|
||||
|
||||
" Requires output format (= device) to be set by user after :make.
|
||||
execute 'CompilerSet makeprg=groff'..escape(
|
||||
\ ' '..s:groff_compiler_lang()..
|
||||
\ ' -K'..get(b:, 'groff_compiler_encoding', get(g:, 'groff_compiler_encoding', 'utf8'))..
|
||||
\ ' '..get(b:, 'groff_compiler_args', get(g:, 'groff_compiler_args', ''))..
|
||||
\ ' -mom -T$* -- %:S > %:r:S.$*', ' ')
|
||||
" From Gavin Freeborn's https://github.com/Gavinok/vim-troff under Vim License
|
||||
" https://github.com/Gavinok/vim-troff/blob/91017b1423caa80aba541c997909a4f810edd275/compiler/troff.vim#L39
|
||||
CompilerSet errorformat=%o:<standard\ input>\ (%f):%l:%m,
|
||||
\%o:\ <standard\ input>\ (%f):%l:%m,
|
||||
\%o:%f:%l:%m,
|
||||
\%o:\ %f:%l:%m,
|
||||
\%f:%l:\ macro\ %trror:%m,
|
||||
\%f:%l:%m,
|
||||
\%W%tarning:\ file\ '%f'\\,\ around\ line\ %l:,%Z%m
|
||||
|
||||
let &cpo = s:keepcpo
|
||||
unlet s:keepcpo
|
13
runtime/compiler/make.vim
Normal file
13
runtime/compiler/make.vim
Normal file
@ -0,0 +1,13 @@
|
||||
" Vim compiler plugin
|
||||
"
|
||||
" Maintainer: The Vim Project <https://github.com/vim/vim>
|
||||
" Last Change: 2024 Sep 10
|
||||
" Original Author: Konfekt
|
||||
"
|
||||
" This compiler plugin is used to reset previously set compiler options.
|
||||
|
||||
if exists("g:current_compiler") | unlet g:current_compiler | endif
|
||||
if exists("b:current_compiler") | unlet b:current_compiler | endif
|
||||
|
||||
CompilerSet makeprg&
|
||||
CompilerSet errorformat&
|
@ -1,10 +1,12 @@
|
||||
" Vim compiler file
|
||||
" Compiler: Pandoc
|
||||
" Maintainer: Konfekt
|
||||
" Last Change: 2024 Aug 20
|
||||
" Last Change: 2024 Sep 8
|
||||
"
|
||||
" Expects output file extension, say `:make html` or `:make pdf`.
|
||||
" Passes additional arguments to pandoc, say `:make html --self-contained`.
|
||||
" Adjust command-line flags by buffer-local/global variable
|
||||
" b/g:pandoc_compiler_args which defaults to empty.
|
||||
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
@ -40,18 +42,21 @@ silent! function s:PandocFiletype(filetype) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let b:pandoc_compiler_from = get(b:, 'pandoc_compiler_from', s:PandocFiletype(&filetype))
|
||||
let b:pandoc_compiler_lang = get(b:, 'pandoc_compiler_lang', &spell ? matchstr(&spelllang, '^\a\a') : '')
|
||||
silent! function s:PandocLang()
|
||||
let lang = get(b:, 'pandoc_compiler_lang',
|
||||
\ &spell ? matchstr(&spelllang, '^\a\a') : '')
|
||||
if lang ==# 'en' | let lang = '' | endif
|
||||
return empty(lang) ? '' : '--metadata lang='..lang
|
||||
endfunction
|
||||
|
||||
execute 'CompilerSet makeprg=pandoc'..escape(
|
||||
\ ' --standalone' .
|
||||
\ (b:pandoc_compiler_from ==# 'markdown' && (getline(1) =~# '^%\s\+\S\+' || (search('^title:\s+\S+', 'cnw') > 0)) ?
|
||||
\ '' : ' --metadata title=%:t:r:S') .
|
||||
\ (empty(b:pandoc_compiler_lang) ?
|
||||
\ '' : ' --metadata lang='..b:pandoc_compiler_lang) .
|
||||
\ ' --from='..b:pandoc_compiler_from .
|
||||
\ ' '..get(b:, 'pandoc_compiler_args', get(g:, 'pandoc_compiler_args', '')) .
|
||||
\ ' --output %:r:S.$* -- %:S', ' ')
|
||||
\ ' --standalone'..
|
||||
\ (s:PandocFiletype(&filetype) ==# 'markdown' && (getline(1) =~# '^%\s\+\S\+' || (search('^title:\s+\S+', 'cnw') > 0)) ?
|
||||
\ '' : ' --metadata title=%:t:r:S')..
|
||||
\ ' '..s:PandocLang()..
|
||||
\ ' --from='..s:PandocFiletype(&filetype)..
|
||||
\ ' '..get(b:, 'pandoc_compiler_args', get(g:, 'pandoc_compiler_args', ''))..
|
||||
\ ' --output %:r:S.$* -- %:S', ' ')
|
||||
CompilerSet errorformat=\"%f\",\ line\ %l:\ %m
|
||||
|
||||
let &cpo = s:keepcpo
|
||||
|
6
runtime/doc/builtin.txt
generated
6
runtime/doc/builtin.txt
generated
@ -1263,7 +1263,7 @@ executable({expr}) *executable()*
|
||||
On MS-Windows the ".exe", ".bat", etc. can optionally be
|
||||
included. Then the extensions in $PATHEXT are tried. Thus if
|
||||
"foo.exe" does not exist, "foo.exe.bat" can be found. If
|
||||
$PATHEXT is not set then ".exe;.com;.bat;.cmd" is used. A dot
|
||||
$PATHEXT is not set then ".com;.exe;.bat;.cmd" is used. A dot
|
||||
by itself can be used in $PATHEXT to try using the name
|
||||
without an extension. When 'shell' looks like a Unix shell,
|
||||
then the name is also tried without adding an extension.
|
||||
@ -4361,6 +4361,7 @@ maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()*
|
||||
"lhsrawalt" The {lhs} of the mapping as raw bytes, alternate
|
||||
form, only present when it differs from "lhsraw"
|
||||
"rhs" The {rhs} of the mapping as typed.
|
||||
"callback" Lua function, if RHS was defined as such.
|
||||
"silent" 1 for a |:map-silent| mapping, else 0.
|
||||
"noremap" 1 if the {rhs} of the mapping is not remappable.
|
||||
"script" 1 if mapping was defined with <script>.
|
||||
@ -6200,6 +6201,9 @@ search({pattern} [, {flags} [, {stopline} [, {timeout} [, {skip}]]]]) *search()*
|
||||
The value must not be negative. A zero value is like not
|
||||
giving the argument.
|
||||
|
||||
Note: the timeout is only considered when searching, not
|
||||
while evaluating the {skip} expression.
|
||||
|
||||
If the {skip} expression is given it is evaluated with the
|
||||
cursor positioned on the start of a match. If it evaluates to
|
||||
non-zero this match is skipped. This can be used, for
|
||||
|
@ -138,15 +138,15 @@ DOCUMENTATION *dev-doc*
|
||||
- Write docstrings (as opposed to inline comments) with present tense ("Gets"),
|
||||
not imperative ("Get"). This tends to reduce ambiguity and improve clarity
|
||||
by describing "What" instead of "How". >
|
||||
GOOD:
|
||||
✅ OK:
|
||||
/// Gets a highlight definition.
|
||||
BAD:
|
||||
❌ NO:
|
||||
/// Get a highlight definition.
|
||||
- Avoid starting docstrings with "The" or "A" unless needed to avoid
|
||||
ambiguity. This is a visual aid and reduces noise. >
|
||||
GOOD:
|
||||
✅ OK:
|
||||
/// @param dirname Path fragment before `pend`
|
||||
BAD:
|
||||
❌ NO:
|
||||
/// @param dirname The path fragment before `pend`
|
||||
- Vim differences:
|
||||
- Do not prefix help tags with "nvim-". Use |vim_diff.txt| to catalog
|
||||
@ -329,13 +329,20 @@ Where possible, these patterns apply to _both_ Lua and the API:
|
||||
- When accepting a buffer id, etc., 0 means "current buffer", nil means "all
|
||||
buffers". Likewise for window id, tabpage id, etc.
|
||||
- Examples: |vim.lsp.codelens.clear()| |vim.diagnostic.enable()|
|
||||
- Any function signature that accepts a callback function should define the
|
||||
callback as the LAST parameter, if possible. This improves readability of
|
||||
calls by placing the less "noisy" arguments near the start. >
|
||||
GOOD:
|
||||
filter(table, opts, function() … end)
|
||||
BAD:
|
||||
filter(function() … end, table, opts)
|
||||
- Any function signature that accepts a callback (example: |table.foreach()|)
|
||||
should place it as the LAST parameter (after opts), if possible (or ALWAYS
|
||||
for "continuation callbacks"—functions called exactly once).
|
||||
- Improves readability by placing the less "noisy" arguments near the start.
|
||||
- Consistent with luv.
|
||||
- Useful for future async lib which transforms functions of the form
|
||||
`function(<args>, cb(<ret)>))` => `function(<args>) -> <ret>`.
|
||||
- Example: >lua
|
||||
-- ✅ OK:
|
||||
filter(…, opts, function() … end)
|
||||
-- ❌ NO:
|
||||
filter(function() … end, …, opts)
|
||||
-- ❌ NO:
|
||||
filter(…, function() … end, opts)
|
||||
- "Enable" ("toggle") interface and behavior:
|
||||
- `enable(…, nil)` and `enable(…, {buf=nil})` are synonyms and control the
|
||||
the "global" enablement of a feature.
|
||||
@ -566,10 +573,10 @@ a good name: it's idiomatic and unambiguous. If the package is named "neovim",
|
||||
it confuses users, and complicates documentation and discussions.
|
||||
|
||||
Examples of API-client package names:
|
||||
- GOOD: nvim-racket
|
||||
- GOOD: pynvim
|
||||
- BAD: python-client
|
||||
- BAD: neovim_
|
||||
- ✅ OK: nvim-racket
|
||||
- ✅ OK: pynvim
|
||||
- ❌ NO: python-client
|
||||
- ❌ NO: neovim_
|
||||
|
||||
API client implementation guidelines ~
|
||||
|
||||
|
@ -444,6 +444,10 @@ when the right mouse button is pressed, if 'mousemodel' is set to popup or
|
||||
popup_setpos.
|
||||
|
||||
The default "PopUp" menu is: >vim
|
||||
anoremenu PopUp.Go\ to\ definition <Cmd>lua vim.lsp.buf.definition()<CR>
|
||||
amenu PopUp.Open\ in\ web\ browser gx
|
||||
anoremenu PopUp.Inspect <Cmd>Inspect<CR>
|
||||
anoremenu PopUp.-1- <Nop>
|
||||
vnoremenu PopUp.Cut "+x
|
||||
vnoremenu PopUp.Copy "+y
|
||||
anoremenu PopUp.Paste "+gP
|
||||
@ -452,8 +456,7 @@ The default "PopUp" menu is: >vim
|
||||
nnoremenu PopUp.Select\ All ggVG
|
||||
vnoremenu PopUp.Select\ All gg0oG$
|
||||
inoremenu PopUp.Select\ All <C-Home><C-O>VG
|
||||
anoremenu PopUp.Inspect <Cmd>Inspect<CR>
|
||||
anoremenu PopUp.-1- <Nop>
|
||||
anoremenu PopUp.-2- <Nop>
|
||||
anoremenu PopUp.How-to\ disable\ mouse <Cmd>help disable-mouse<CR>
|
||||
<
|
||||
|
||||
|
@ -7,10 +7,10 @@
|
||||
Type |gO| to see the table of contents.
|
||||
|
||||
==============================================================================
|
||||
Checkhealth *health*
|
||||
Checkhealth *vim.health* *health*
|
||||
|
||||
|
||||
health.vim is a minimal framework to help users troubleshoot configuration and
|
||||
vim.health is a minimal framework to help users troubleshoot configuration and
|
||||
any other environment conditions that a plugin might care about. Nvim ships
|
||||
with healthchecks for configuration, performance, python support, ruby
|
||||
support, clipboard support, and more.
|
||||
@ -49,7 +49,7 @@ Commands *health-commands*
|
||||
:checkhealth vim*
|
||||
<
|
||||
|
||||
Create a healthcheck *health-dev* *vim.health*
|
||||
Create a healthcheck *health-dev*
|
||||
|
||||
Healthchecks are functions that check the user environment, configuration, or
|
||||
any other prerequisites that a plugin cares about. Nvim ships with
|
||||
|
@ -765,7 +765,7 @@ formatexpr({opts}) *vim.lsp.formatexpr()*
|
||||
function.
|
||||
|
||||
Currently only supports a single client. This can be set via
|
||||
`setlocal formatexpr=v:lua.vim.lsp.formatexpr()` but will typically or in
|
||||
`setlocal formatexpr=v:lua.vim.lsp.formatexpr()` or (more typically) in
|
||||
`on_attach` via
|
||||
`vim.bo[bufnr].formatexpr = 'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})'`.
|
||||
|
||||
@ -1639,8 +1639,7 @@ Lua module: vim.lsp.completion *lsp-completion*
|
||||
Fields: ~
|
||||
• {autotrigger}? (`boolean`) Whether to trigger completion
|
||||
automatically. Default: false
|
||||
• {convert}? (`fun(item: lsp.CompletionItem): table`) An optional
|
||||
function used to customize the transformation of an
|
||||
• {convert}? (`fun(item: lsp.CompletionItem): table`) Transforms an
|
||||
LSP CompletionItem to |complete-items|.
|
||||
|
||||
|
||||
|
@ -352,16 +352,14 @@ Example: >vim
|
||||
<
|
||||
*lua-table-ambiguous*
|
||||
Lua tables are used as both dictionaries and lists, so it is impossible to
|
||||
determine whether empty table is meant to be empty list or empty dictionary.
|
||||
Additionally Lua does not have integer numbers. To distinguish between these
|
||||
cases there is the following agreement:
|
||||
decide whether empty table is a list or a dict. Also Lua does not have integer
|
||||
numbers. To disambiguate these cases, we define:
|
||||
*lua-list*
|
||||
0. Empty table is empty list.
|
||||
1. Table with N consecutive integer indices starting from 1 and ending with
|
||||
N is considered a list. See also |list-iterator|.
|
||||
0. Empty table is a list. Use |vim.empty_dict()| to represent empty dict.
|
||||
1. Table with N consecutive (no `nil` values, aka "holes") integer keys 1…N is
|
||||
a list. See also |list-iterator|.
|
||||
*lua-dict*
|
||||
2. Table with string keys, none of which contains NUL byte, is considered to
|
||||
be a dictionary.
|
||||
2. Table with string keys, none of which contains NUL byte, is a dict.
|
||||
3. Table with string keys, at least one of which contains NUL byte, is also
|
||||
considered to be a dictionary, but this time it is converted to
|
||||
a |msgpack-special-map|.
|
||||
@ -2232,6 +2230,12 @@ vim.tbl_count({t}) *vim.tbl_count()*
|
||||
vim.tbl_deep_extend({behavior}, {...}) *vim.tbl_deep_extend()*
|
||||
Merges recursively two or more tables.
|
||||
|
||||
Only values that are empty tables or tables that are not |lua-list|s
|
||||
(indexed by consecutive integers starting from 1) are merged recursively.
|
||||
This is useful for merging nested tables like default and user
|
||||
configurations where lists should be treated as literals (i.e., are
|
||||
overwritten instead of merged).
|
||||
|
||||
Parameters: ~
|
||||
• {behavior} (`'error'|'keep'|'force'`) Decides what to do if a key is
|
||||
found in more than one map:
|
||||
@ -2674,7 +2678,7 @@ vim.filetype.add({filetypes}) *vim.filetype.add()*
|
||||
['.*/etc/foo/.*%.conf'] = { 'dosini', { priority = 10 } },
|
||||
-- A pattern containing an environment variable
|
||||
['${XDG_CONFIG_HOME}/foo/git'] = 'git',
|
||||
['README.(%a+)$'] = function(path, bufnr, ext)
|
||||
['.*README.(%a+)'] = function(path, bufnr, ext)
|
||||
if ext == 'md' then
|
||||
return 'markdown'
|
||||
elseif ext == 'rst' then
|
||||
@ -3839,10 +3843,12 @@ argument into an *Iter* object with methods (such as |Iter:filter()| and
|
||||
chained to create iterator "pipelines": the output of each pipeline stage is
|
||||
input to the next stage. The first stage depends on the type passed to
|
||||
`vim.iter()`:
|
||||
• List tables (arrays, |lua-list|) yield only the value of each element.
|
||||
• Holes (nil values) are allowed.
|
||||
• Lists or arrays (|lua-list|) yield only the value of each element.
|
||||
• Holes (nil values) are allowed (but discarded).
|
||||
• Use pairs() to treat array/list tables as dicts (preserve holes and
|
||||
non-contiguous integer keys): `vim.iter(pairs(…))`.
|
||||
• Use |Iter:enumerate()| to also pass the index to the next stage.
|
||||
• Or initialize with ipairs(): `vim.iter(ipairs(…))`.
|
||||
• Or initialize with ipairs(): `vim.iter(ipairs(…))`.
|
||||
• Non-list tables (|lua-dict|) yield both the key and value of each element.
|
||||
• Function |iterator|s yield all values returned by the underlying function.
|
||||
• Tables with a |__call()| metamethod are treated as function iterators.
|
||||
|
@ -1381,10 +1381,12 @@ completion can be enabled:
|
||||
|
||||
-complete=arglist file names in argument list
|
||||
-complete=augroup autocmd groups
|
||||
-complete=breakpoint |:breakadd| suboptions
|
||||
-complete=buffer buffer names
|
||||
-complete=color color schemes
|
||||
-complete=command Ex command (and arguments)
|
||||
-complete=compiler compilers
|
||||
-complete=diff_buffer diff buffer names
|
||||
-complete=dir directory names
|
||||
-complete=dir_in_path directory names in |'cdpath'|
|
||||
-complete=environment environment variable names
|
||||
@ -1396,7 +1398,7 @@ completion can be enabled:
|
||||
-complete=function function name
|
||||
-complete=help help subjects
|
||||
-complete=highlight highlight groups
|
||||
-complete=history :history suboptions
|
||||
-complete=history |:history| suboptions
|
||||
-complete=keymap keyboard mappings
|
||||
-complete=locale locale names (as output of locale -a)
|
||||
-complete=lua Lua expression |:lua|
|
||||
@ -1406,6 +1408,8 @@ completion can be enabled:
|
||||
-complete=messages |:messages| suboptions
|
||||
-complete=option options
|
||||
-complete=packadd optional package |pack-add| names
|
||||
-complete=runtime file and directory names in |'runtimepath'|
|
||||
-complete=scriptnames sourced script names
|
||||
-complete=shellcmd Shell command
|
||||
-complete=sign |:sign| suboptions
|
||||
-complete=syntax syntax file names |'syntax'|
|
||||
|
@ -646,6 +646,12 @@ widespread as file format.
|
||||
A composing or combining character is used to change the meaning of the
|
||||
character before it. The combining characters are drawn on top of the
|
||||
preceding character.
|
||||
|
||||
Nvim largely follows the definition of extended grapheme clusters in UAX#29
|
||||
in the Unicode standard, with some modifications: An ascii char will always
|
||||
start a new cluster. In addition 'arabicshape' enables the combining of some
|
||||
arabic letters, when they are shaped to be displayed together in a single cell.
|
||||
|
||||
Too big combined characters cannot be displayed, but they can still be
|
||||
inspected using the |g8| and |ga| commands described below.
|
||||
When editing text a composing character is mostly considered part of the
|
||||
|
@ -355,11 +355,11 @@ gg Goto line [count], default first line, on the first
|
||||
See also 'startofline' option.
|
||||
|
||||
:[range]go[to] [count] *:go* *:goto* *go*
|
||||
[count]go Go to [count] byte in the buffer. Default [count] is
|
||||
one, start of the file. When giving [range], the
|
||||
last number in it used as the byte count. End-of-line
|
||||
characters are counted depending on the current
|
||||
'fileformat' setting.
|
||||
[count]go Go to [count] byte in the buffer. |exclusive| motion.
|
||||
Default [count] is one, start of the file. When
|
||||
giving [range], the last number in it used as the byte
|
||||
count. End-of-line characters are counted depending
|
||||
on the current 'fileformat' setting.
|
||||
Also see the |line2byte()| function, and the 'o'
|
||||
option in 'statusline'.
|
||||
|
||||
|
@ -53,21 +53,14 @@ EDITOR
|
||||
documented and skips help buffers if run from a non-help buffer, otherwise
|
||||
it moves to another help buffer.
|
||||
|
||||
VIM SCRIPT
|
||||
|
||||
• |v:msgpack_types| has the type "binary" removed. |msgpackparse()| no longer
|
||||
treats BIN, STR and FIXSTR as separate types. Any of these is returned as a
|
||||
string if possible, or a |blob| if the value contained embedded NUL:s.
|
||||
|
||||
EVENTS
|
||||
|
||||
• TODO
|
||||
|
||||
LSP
|
||||
|
||||
• Add convert field in |vim.lsp.completion.BufferOpts| of
|
||||
|vim.lsp.completion.enable()| an optional function used to customize the
|
||||
transformation of an Lsp CompletionItem to |complete-items|.
|
||||
• |vim.lsp.completion.enable()| gained the `convert` callback which enables
|
||||
customizing the transformation of an LSP CompletionItem to |complete-items|.
|
||||
• |vim.lsp.diagnostic.from()| can be used to convert a list of
|
||||
|vim.Diagnostic| objects into their LSP diagnostic representation.
|
||||
|
||||
@ -89,12 +82,22 @@ PLUGINS
|
||||
|
||||
TREESITTER
|
||||
|
||||
• TODO
|
||||
• |Query:iter_matches()| correctly returns all matching nodes in a match
|
||||
instead of only the last node. This means that the returned table maps
|
||||
capture IDs to a list of nodes that need to be iterated over. For
|
||||
backwards compatibility, an option `all=false` (only return the last
|
||||
matching node) is provided that will be removed in a future release.
|
||||
|
||||
TUI
|
||||
|
||||
• TODO
|
||||
|
||||
VIMSCRIPT
|
||||
|
||||
• |v:msgpack_types| has the type "binary" removed. |msgpackparse()| no longer
|
||||
treats BIN, STR and FIXSTR as separate types. Any of these is returned as a
|
||||
string if possible, or a |blob| if the value contained embedded NUL:s.
|
||||
|
||||
==============================================================================
|
||||
NEW FEATURES *news-features*
|
||||
|
||||
@ -111,6 +114,10 @@ DEFAULTS
|
||||
• |grr| in Normal mode maps to |vim.lsp.buf.references()|
|
||||
• |gra| in Normal and Visual mode maps to |vim.lsp.buf.code_action()|
|
||||
• CTRL-S in Insert mode maps to |vim.lsp.buf.signature_help()|
|
||||
• Mouse |popup-menu| includes an "Open in web browser" item when you right-click
|
||||
on a URL.
|
||||
• Mouse |popup-menu| includes a "Go to definition" item when LSP is active
|
||||
in the buffer.
|
||||
|
||||
• Snippet:
|
||||
• `<Tab>` in Insert and Select mode maps to `vim.snippet.jump({ direction = 1 })`
|
||||
@ -159,7 +166,8 @@ PLUGINS
|
||||
|
||||
STARTUP
|
||||
|
||||
• TODO
|
||||
• Nvim will fail if the |--listen| or |$NVIM_LISTEN_ADDRESS| address is
|
||||
invalid, instead of silently skipping an invalid address.
|
||||
|
||||
TERMINAL
|
||||
|
||||
@ -181,7 +189,8 @@ TREESITTER
|
||||
|
||||
TUI
|
||||
|
||||
• TODO
|
||||
• |log| messages written by the builtin UI client (TUI, |--remote-ui|) are
|
||||
now prefixed with "ui" instead of "?".
|
||||
|
||||
UI
|
||||
|
||||
@ -200,6 +209,12 @@ These existing features changed their behavior.
|
||||
top lines are calculated using screen line numbers which take virtual lines
|
||||
into account.
|
||||
|
||||
• The implementation of grapheme clusters (or combining chars |mbyte-combining|)
|
||||
was upgraded to closely follow extended grapheme clusters as defined by UAX#29
|
||||
in the unicode standard. Noteworthily, this enables proper display of many
|
||||
more emoji characters than before, including those encoded with multiple
|
||||
emoji codepoints combined with ZWJ (zero width joiner) codepoints.
|
||||
|
||||
==============================================================================
|
||||
REMOVED FEATURES *news-removed*
|
||||
|
||||
|
@ -1129,9 +1129,9 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
list:{n} Adds an additional indent for lines that match a
|
||||
numbered or bulleted list (using the
|
||||
'formatlistpat' setting).
|
||||
list:-1 Uses the length of a match with 'formatlistpat'
|
||||
for indentation.
|
||||
(default: 0)
|
||||
list:-1 Uses the width of a match with 'formatlistpat' for
|
||||
indentation.
|
||||
column:{n} Indent at column {n}. Will overrule the other
|
||||
sub-options. Note: an additional indent may be
|
||||
added for the 'showbreak' setting.
|
||||
@ -2217,9 +2217,12 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
global
|
||||
When on all Unicode emoji characters are considered to be full width.
|
||||
This excludes "text emoji" characters, which are normally displayed as
|
||||
single width. Unfortunately there is no good specification for this
|
||||
and it has been determined on trial-and-error basis. Use the
|
||||
|setcellwidths()| function to change the behavior.
|
||||
single width. However, such "text emoji" are treated as full-width
|
||||
emoji if they are followed by the U+FE0F variant selector.
|
||||
|
||||
Unfortunately there is no good specification for this and it has been
|
||||
determined on trial-and-error basis. Use the |setcellwidths()|
|
||||
function to change the behavior.
|
||||
|
||||
*'encoding'* *'enc'*
|
||||
'encoding' 'enc' string (default "utf-8")
|
||||
@ -6710,7 +6713,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
global
|
||||
When on, the title of the window will be set to the value of
|
||||
'titlestring' (if it is not empty), or to:
|
||||
filename [+=-] (path) - NVIM
|
||||
filename [+=-] (path) - Nvim
|
||||
Where:
|
||||
filename the name of the file being edited
|
||||
- indicates the file cannot be modified, 'ma' off
|
||||
@ -6718,7 +6721,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
= indicates the file is read-only
|
||||
=+ indicates the file is read-only and modified
|
||||
(path) is the path of the file being edited
|
||||
- NVIM the server name |v:servername| or "NVIM"
|
||||
- Nvim the server name |v:servername| or "Nvim"
|
||||
|
||||
*'titlelen'*
|
||||
'titlelen' number (default 85)
|
||||
|
@ -194,6 +194,8 @@ registers. Nvim looks for these clipboard tools, in order of priority:
|
||||
- lemonade (for SSH) https://github.com/pocke/lemonade
|
||||
- doitclient (for SSH) https://www.chiark.greenend.org.uk/~sgtatham/doit/
|
||||
- win32yank (Windows)
|
||||
- putclip, getclip (Windows) https://cygwin.com/packages/summary/cygutils.html
|
||||
- clip, powershell (Windows) https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/clip
|
||||
- termux (via termux-clipboard-set, termux-clipboard-set)
|
||||
- tmux (if $TMUX is set)
|
||||
|
||||
@ -248,8 +250,8 @@ For Windows WSL, try this g:clipboard definition:
|
||||
\ '*': 'clip.exe',
|
||||
\ },
|
||||
\ 'paste': {
|
||||
\ '+': 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
|
||||
\ '*': 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
|
||||
\ '+': 'powershell.exe -NoLogo -NoProfile -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
|
||||
\ '*': 'powershell.exe -NoLogo -NoProfile -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
|
||||
\ },
|
||||
\ 'cache_enabled': 0,
|
||||
\ }
|
||||
|
@ -1262,6 +1262,7 @@ not "b:current_compiler". What the command actually does is the following:
|
||||
|
||||
For writing a compiler plugin, see |write-compiler-plugin|.
|
||||
|
||||
Use the |compiler-make| plugin to undo the effect of a compiler plugin.
|
||||
|
||||
DOTNET *compiler-dotnet*
|
||||
|
||||
@ -1277,7 +1278,6 @@ Example: limit output to only display errors, and suppress the project name: >
|
||||
let dotnet_show_project_file = v:false
|
||||
compiler dotnet
|
||||
<
|
||||
|
||||
GCC *quickfix-gcc* *compiler-gcc*
|
||||
|
||||
There's one variable you can set for the GCC compiler:
|
||||
@ -1294,6 +1294,24 @@ Commonly used compiler options can be added to 'makeprg' by setting the
|
||||
g:javac_makeprg_params variable. For example: >
|
||||
let g:javac_makeprg_params = "-Xlint:all -encoding utf-8"
|
||||
<
|
||||
GNU MAKE *compiler-make*
|
||||
|
||||
Since the default make program is "make", the compiler plugin for make,
|
||||
:compiler make, will reset the 'makeprg' and 'errorformat' option to
|
||||
the default values and unlet any variables that may have been set by a
|
||||
previous compiler plugin.
|
||||
|
||||
GROFF *quickfix-groff* *compiler-groff*
|
||||
|
||||
The GROFF compiler plugin uses the mom macro set (documented in the groff_mom
|
||||
manpage) as input and expects that the output file type extension is passed to
|
||||
make, say :make html or :make pdf.
|
||||
|
||||
Additional arguments can be passed to groff by setting them in
|
||||
`b:groff_compiler_args` or `g:groff_compiler_args`. The `language` argument
|
||||
passed to groff is set using 'spelllang'; it can be overridden by setting
|
||||
`b:groff_compiler_lang`. The default enconding is `UTF-8` and can be changed
|
||||
by setting `b:groff_compiler_encoding` or `g:groff_compiler_encoding`.
|
||||
|
||||
PANDOC *quickfix-pandoc* *compiler-pandoc*
|
||||
|
||||
@ -1307,8 +1325,7 @@ Additional arguments can be passed to pandoc:
|
||||
|
||||
The `--from` argument is an educated guess using the buffer file type;
|
||||
it can be overridden by setting `b:pandoc_compiler_from`.
|
||||
Likewise the `--metadata lang` argument is set using `&spelllang`;
|
||||
it can be overridden by setting `b:pandoc_compiler_lang`.
|
||||
The `--metadata lang` argument is set using 'spelllang';
|
||||
If `--from=markdown` is assumed and no title set in a title header or
|
||||
YAML block, then the filename (without extension) is used as the title.
|
||||
|
||||
|
@ -152,8 +152,7 @@ add a few items or change the highlighting, follow these steps:
|
||||
1. Create your user directory from 'runtimepath', see above.
|
||||
|
||||
2. Create a directory in there called "after/syntax". For Unix: >
|
||||
mkdir ~/.config/nvim/after
|
||||
mkdir ~/.config/nvim/after/syntax
|
||||
mkdir -p ~/.config/nvim/after/syntax
|
||||
|
||||
3. Write a Vim script that contains the commands you want to use. For
|
||||
example, to change the colors for the C syntax: >
|
||||
|
@ -22,11 +22,9 @@ search for in the `parser` runtime directory.
|
||||
|
||||
Nvim includes these parsers:
|
||||
|
||||
- Bash
|
||||
- C
|
||||
- Lua
|
||||
- Markdown
|
||||
- Python
|
||||
- Vimscript
|
||||
- Vimdoc
|
||||
- Treesitter query files |ft-query-plugin|
|
||||
@ -550,9 +548,9 @@ the exact definition):
|
||||
@keyword.coroutine keywords related to coroutines (e.g. `go` in Go, `async/await` in Python)
|
||||
@keyword.function keywords that define a function (e.g. `func` in Go, `def` in Python)
|
||||
@keyword.operator operators that are English words (e.g. `and`, `or`)
|
||||
@keyword.import keywords for including modules (e.g. `import`, `from` in Python)
|
||||
@keyword.type keywords defining composite types (e.g. `struct`, `enum`)
|
||||
@keyword.modifier keywords defining type modifiers (e.g. `const`, `static`, `public`)
|
||||
@keyword.import keywords for including or exporting modules (e.g. `import`, `from` in Python)
|
||||
@keyword.type keywords describing namespaces and composite types (e.g. `struct`, `enum`)
|
||||
@keyword.modifier keywords modifying other constructs (e.g. `const`, `static`, `public`)
|
||||
@keyword.repeat keywords related to loops (e.g. `for`, `while`)
|
||||
@keyword.return keywords like `return` and `yield`
|
||||
@keyword.debug keywords related to debugging
|
||||
@ -608,7 +606,7 @@ the exact definition):
|
||||
@diff.delta changed text (for diff files)
|
||||
|
||||
@tag XML-style tag names (e.g. in XML, HTML, etc.)
|
||||
@tag.builtin XML-style tag names (e.g. HTML5 tags)
|
||||
@tag.builtin builtin tag names (e.g. HTML5 tags)
|
||||
@tag.attribute XML-style tag attributes
|
||||
@tag.delimiter XML-style tag delimiters
|
||||
|
||||
@ -1025,7 +1023,7 @@ add_directive({name}, {handler}, {opts})
|
||||
|
||||
Parameters: ~
|
||||
• {name} (`string`) Name of the directive, without leading #
|
||||
• {handler} (`fun(match: table<integer,TSNode[]>, pattern: integer, source: integer|string, predicate: any[], metadata: table)`)
|
||||
• {handler} (`fun(match: table<integer,TSNode[]>, pattern: integer, source: integer|string, predicate: any[], metadata: vim.treesitter.query.TSMetadata)`)
|
||||
• match: A table mapping capture IDs to a list of captured
|
||||
nodes
|
||||
• pattern: the index of the matching pattern in the query
|
||||
@ -1038,9 +1036,8 @@ add_directive({name}, {handler}, {opts})
|
||||
the same name
|
||||
• {all}? (`boolean`) Use the correct implementation of the
|
||||
match table where capture IDs map to a list of nodes
|
||||
instead of a single node. Defaults to false (for backward
|
||||
compatibility). This option will eventually become the
|
||||
default and removed.
|
||||
instead of a single node. Defaults to true. This option
|
||||
will be removed in a future release.
|
||||
|
||||
*vim.treesitter.query.add_predicate()*
|
||||
add_predicate({name}, {handler}, {opts})
|
||||
@ -1048,17 +1045,16 @@ add_predicate({name}, {handler}, {opts})
|
||||
|
||||
Parameters: ~
|
||||
• {name} (`string`) Name of the predicate, without leading #
|
||||
• {handler} (`fun(match: table<integer,TSNode[]>, pattern: integer, source: integer|string, predicate: any[], metadata: table)`)
|
||||
• {handler} (`fun(match: table<integer,TSNode[]>, pattern: integer, source: integer|string, predicate: any[], metadata: vim.treesitter.query.TSMetadata)`)
|
||||
• see |vim.treesitter.query.add_directive()| for argument
|
||||
meanings
|
||||
• {opts} (`table`) A table with the following fields:
|
||||
• {opts} (`table?`) A table with the following fields:
|
||||
• {force}? (`boolean`) Override an existing predicate of
|
||||
the same name
|
||||
• {all}? (`boolean`) Use the correct implementation of the
|
||||
match table where capture IDs map to a list of nodes
|
||||
instead of a single node. Defaults to false (for backward
|
||||
compatibility). This option will eventually become the
|
||||
default and removed.
|
||||
instead of a single node. Defaults to true. This option
|
||||
will be removed in a future release.
|
||||
|
||||
edit({lang}) *vim.treesitter.query.edit()*
|
||||
Opens a live editor to query the buffer you started from.
|
||||
@ -1218,14 +1214,8 @@ Query:iter_matches({node}, {source}, {start}, {stop}, {opts})
|
||||
indices to a list of nodes, and metadata from any directives processing
|
||||
the match.
|
||||
|
||||
WARNING: Set `all=true` to ensure all matching nodes in a match are
|
||||
returned, otherwise only the last node in a match is returned, breaking
|
||||
captures involving quantifiers such as `(comment)+ @comment`. The default
|
||||
option `all=false` is only provided for backward compatibility and will be
|
||||
removed after Nvim 0.10.
|
||||
|
||||
Example: >lua
|
||||
for pattern, match, metadata in cquery:iter_matches(tree:root(), bufnr, 0, -1, { all = true }) do
|
||||
for pattern, match, metadata in cquery:iter_matches(tree:root(), bufnr, 0, -1) do
|
||||
for id, nodes in pairs(match) do
|
||||
local name = query.captures[id]
|
||||
for _, node in ipairs(nodes) do
|
||||
@ -1250,16 +1240,15 @@ Query:iter_matches({node}, {source}, {start}, {stop}, {opts})
|
||||
start depth for each match. This is used to prevent
|
||||
traversing too deep into a tree.
|
||||
• match_limit (integer) Set the maximum number of
|
||||
in-progress matches (Default: 256).
|
||||
• all (boolean) When set, the returned match table maps
|
||||
capture IDs to a list of nodes. Older versions of
|
||||
iter_matches incorrectly mapped capture IDs to a single
|
||||
node, which is incorrect behavior. This option will
|
||||
eventually become the default and removed.
|
||||
in-progress matches (Default: 256). all (boolean) When
|
||||
`false` (default `true`), the returned table maps capture
|
||||
IDs to a single (last) node instead of the full list of
|
||||
matching nodes. This option is only for backward
|
||||
compatibility and will be removed in a future release.
|
||||
|
||||
Return: ~
|
||||
(`fun(): integer, table<integer, TSNode[]>, table`) pattern id, match,
|
||||
metadata
|
||||
(`fun(): integer, table<integer, TSNode[]>, vim.treesitter.query.TSMetadata`)
|
||||
pattern id, match, metadata
|
||||
|
||||
set({lang}, {query_name}, {text}) *vim.treesitter.query.set()*
|
||||
Sets the runtime query named {query_name} for {lang}
|
||||
|
@ -106,23 +106,28 @@ standard actions ("Cut", "Copy", "Paste", …). Mouse is NOT enabled in
|
||||
|command-mode| or the |more-prompt|, so you can temporarily disable it just by
|
||||
typing ":".
|
||||
|
||||
If you don't like this you can disable the mouse in your |config| using any of
|
||||
the following:
|
||||
Or you can disable the popup-menu using any of the following:
|
||||
- Disable mouse completely by unsetting the 'mouse' option: >vim
|
||||
set mouse=
|
||||
- Pressing <RightMouse> extends selection instead of showing popup-menu: >vim
|
||||
- Change the 'mousemodel', so <RightMouse> extends selection instead of
|
||||
showing the popup-menu: >vim
|
||||
set mousemodel=extend
|
||||
- Pressing <A-LeftMouse> releases mouse until the cursor moves: >vim
|
||||
- Map <A-LeftMouse> so that it temporarily disables mouse until the cursor
|
||||
moves: >vim
|
||||
nnoremap <A-LeftMouse> <Cmd>
|
||||
\ set mouse=<Bar>
|
||||
\ echo 'mouse OFF until next cursor-move'<Bar>
|
||||
\ autocmd CursorMoved * ++once set mouse&<Bar>
|
||||
\ echo 'mouse ON'<CR>
|
||||
<
|
||||
To remove the "How-to disable mouse" menu item and the separator above it: >vim
|
||||
To remove the default popup-menu without disabling mouse: >vim
|
||||
aunmenu PopUp
|
||||
autocmd! nvim_popupmenu
|
||||
|
||||
To remove only the "How-to disable mouse" menu item (and its separator): >vim
|
||||
aunmenu PopUp.How-to\ disable\ mouse
|
||||
aunmenu PopUp.-1-
|
||||
<
|
||||
aunmenu PopUp.-2-
|
||||
|
||||
DEFAULT MAPPINGS
|
||||
*default-mappings*
|
||||
Nvim creates the following default mappings at |startup|. You can disable any
|
||||
|
@ -53,11 +53,17 @@ active yes yes 'a'
|
||||
hidden no yes 'h'
|
||||
inactive no no ' '
|
||||
|
||||
Note: All CTRL-W commands can also be executed with |:wincmd|, for those
|
||||
places where a Normal mode command can't be used or is inconvenient.
|
||||
*buffer-reuse*
|
||||
Each buffer has a unique number and the number will not change within a Vim
|
||||
session. The |bufnr()| and |bufname()| functions can be used to convert
|
||||
between a buffer name and the buffer number. There is one exception: if a new
|
||||
empty buffer is created and it is not modified, the buffer will be re-used
|
||||
when loading another file into that buffer. This also means the buffer number
|
||||
will not change.
|
||||
|
||||
The main Vim window can hold several split windows. There are also tab pages
|
||||
|tab-page|, each of which can hold multiple windows.
|
||||
|
||||
*window-ID* *winid* *windowid*
|
||||
Each window has a unique identifier called the window ID. This identifier
|
||||
will not change within a Vim session. The |win_getid()| and |win_id2tabwin()|
|
||||
@ -69,9 +75,6 @@ across tabs. For most functions that take a window ID or a window number, the
|
||||
window number only applies to the current tab, while the window ID can refer
|
||||
to a window in any tab.
|
||||
|
||||
Each buffer has a unique number and the number will not change within a Vim
|
||||
session. The |bufnr()| and |bufname()| functions can be used to convert
|
||||
between a buffer name and the buffer number.
|
||||
|
||||
==============================================================================
|
||||
2. Starting Vim *windows-starting*
|
||||
@ -468,6 +471,10 @@ These commands can also be executed with ":wincmd":
|
||||
:exe nr .. "wincmd w"
|
||||
< This goes to window "nr".
|
||||
|
||||
Note: All CTRL-W commands can also be executed with |:wincmd|, for those
|
||||
places where a Normal mode command can't be used or is inconvenient (e.g.
|
||||
in a browser-based terminal).
|
||||
|
||||
==============================================================================
|
||||
5. Moving windows around *window-moving*
|
||||
|
||||
|
3
runtime/ftplugin/dot.lua
Normal file
3
runtime/ftplugin/dot.lua
Normal file
@ -0,0 +1,3 @@
|
||||
vim.bo.commentstring = '// %s'
|
||||
|
||||
vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<'
|
3
runtime/ftplugin/faust.lua
Normal file
3
runtime/ftplugin/faust.lua
Normal file
@ -0,0 +1,3 @@
|
||||
vim.bo.commentstring = '// %s'
|
||||
|
||||
vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<'
|
10
runtime/ftplugin/hcl.vim
Normal file
10
runtime/ftplugin/hcl.vim
Normal file
@ -0,0 +1,10 @@
|
||||
" Vim filetype plugin
|
||||
" Language: HCL
|
||||
" Maintainer: Gregory Anders
|
||||
" Last Change: 2024-09-03
|
||||
|
||||
if exists('b:did_ftplugin')
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! ftplugin/terraform.vim
|
13
runtime/ftplugin/nu.vim
Normal file
13
runtime/ftplugin/nu.vim
Normal file
@ -0,0 +1,13 @@
|
||||
" Vim filetype plugin
|
||||
" Language: Nu
|
||||
" Maintainer: Marc Jakobi <marc@jakobi.dev>
|
||||
" Last Change: 2024 Aug 31
|
||||
|
||||
if exists('b:did_ftplugin')
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
setlocal commentstring=#\ %s
|
||||
|
||||
let b:undo_ftplugin = 'setl com<'
|
@ -2,8 +2,9 @@
|
||||
" Filename: spec.vim
|
||||
" Maintainer: Igor Gnatenko i.gnatenko.brain@gmail.com
|
||||
" Former Maintainer: Gustavo Niemeyer <niemeyer@conectiva.com> (until March 2014)
|
||||
" Last Change: Mon Jun 01 21:15 MSK 2015 Igor Gnatenko
|
||||
" Update by Zdenek Dohnal, 2022 May 17
|
||||
" Last Change: 2015 Jun 01
|
||||
" Update by Zdenek Dohnal, 2022 May 17
|
||||
" 2024 Sep 10 by Vim Project: add epoch support for spec changelog, #15537
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
@ -66,9 +67,11 @@ if !exists("*s:SpecChangelog")
|
||||
endif
|
||||
let line = 0
|
||||
let name = ""
|
||||
let epoch = ""
|
||||
let ver = ""
|
||||
let rel = ""
|
||||
let nameline = -1
|
||||
let epochline = -1
|
||||
let verline = -1
|
||||
let relline = -1
|
||||
let chgline = -1
|
||||
@ -77,6 +80,9 @@ if !exists("*s:SpecChangelog")
|
||||
if name == "" && linestr =~? '^Name:'
|
||||
let nameline = line
|
||||
let name = substitute(strpart(linestr,5), '^[ ]*\([^ ]\+\)[ ]*$','\1','')
|
||||
elseif epoch == "" && linestr =~? '^Epoch:'
|
||||
let epochline = line
|
||||
let epoch = substitute(strpart(linestr,6), '^[ ]*\([^ ]\+\)[ ]*$','\1','')
|
||||
elseif ver == "" && linestr =~? '^Version:'
|
||||
let verline = line
|
||||
let ver = substitute(strpart(linestr,8), '^[ ]*\([^ ]\+\)[ ]*$','\1','')
|
||||
@ -93,6 +99,7 @@ if !exists("*s:SpecChangelog")
|
||||
if nameline != -1 && verline != -1 && relline != -1
|
||||
let include_release_info = exists("g:spec_chglog_release_info")
|
||||
let name = s:ParseRpmVars(name, nameline)
|
||||
let epoch = s:ParseRpmVars(epoch, epochline)
|
||||
let ver = s:ParseRpmVars(ver, verline)
|
||||
let rel = s:ParseRpmVars(rel, relline)
|
||||
else
|
||||
@ -117,6 +124,9 @@ if !exists("*s:SpecChangelog")
|
||||
if chgline != -1
|
||||
let tmptime = v:lc_time
|
||||
language time C
|
||||
if strlen(epoch)
|
||||
let ver = epoch.":".ver
|
||||
endif
|
||||
let parsed_format = "* ".strftime(format)." - ".ver."-".rel
|
||||
execute "language time" tmptime
|
||||
let release_info = "+ ".name."-".ver."-".rel
|
||||
|
3
runtime/ftplugin/stata.lua
Normal file
3
runtime/ftplugin/stata.lua
Normal file
@ -0,0 +1,3 @@
|
||||
vim.bo.commentstring = '// %s'
|
||||
|
||||
vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<'
|
3
runtime/ftplugin/supercollider.lua
Normal file
3
runtime/ftplugin/supercollider.lua
Normal file
@ -0,0 +1,3 @@
|
||||
vim.bo.commentstring = '// %s'
|
||||
|
||||
vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<'
|
3
runtime/ftplugin/swift.lua
Normal file
3
runtime/ftplugin/swift.lua
Normal file
@ -0,0 +1,3 @@
|
||||
vim.bo.commentstring = '// %s'
|
||||
|
||||
vim.b.undo_ftplugin = vim.b.undo_ftplugin .. ' | setl commentstring<'
|
16
runtime/indent/hcl.vim
Normal file
16
runtime/indent/hcl.vim
Normal file
@ -0,0 +1,16 @@
|
||||
" Vim indent file
|
||||
" Language: HCL
|
||||
" Maintainer: Gregory Anders
|
||||
" Upstream: https://github.com/hashivim/vim-terraform
|
||||
" Last Change: 2024-09-03
|
||||
|
||||
if exists('b:did_indent')
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal autoindent shiftwidth=2 tabstop=2 softtabstop=2 expandtab
|
||||
setlocal indentexpr=hcl#indentexpr(v:lnum)
|
||||
setlocal indentkeys+=<:>,0=},0=)
|
||||
|
||||
let b:undo_indent = 'setlocal ai< sw< ts< sts< et< inde< indk<'
|
11
runtime/indent/terraform.vim
Normal file
11
runtime/indent/terraform.vim
Normal file
@ -0,0 +1,11 @@
|
||||
" Vim indent file
|
||||
" Language: Terraform
|
||||
" Maintainer: Gregory Anders
|
||||
" Upstream: https://github.com/hashivim/vim-terraform
|
||||
" Last Change: 2024-09-03
|
||||
|
||||
if exists('b:did_indent')
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! indent/hcl.vim
|
@ -723,7 +723,7 @@ function M.open_page(count, smods, args)
|
||||
end
|
||||
|
||||
sect, name = extract_sect_and_name_path(path)
|
||||
local buf = fn.bufnr()
|
||||
local buf = api.nvim_get_current_buf()
|
||||
local save_tfu = vim.bo[buf].tagfunc
|
||||
vim.bo[buf].tagfunc = "v:lua.require'man'.goto_tag"
|
||||
|
||||
@ -739,7 +739,9 @@ function M.open_page(count, smods, args)
|
||||
end
|
||||
end)
|
||||
|
||||
vim.bo[buf].tagfunc = save_tfu
|
||||
if api.nvim_buf_is_valid(buf) then
|
||||
vim.bo[buf].tagfunc = save_tfu
|
||||
end
|
||||
|
||||
if not ok then
|
||||
error(ret)
|
||||
|
@ -1003,6 +1003,7 @@ local function extend_style(out, state)
|
||||
--TODO(altermo) use local namespace (instead of global 0)
|
||||
local fg = vim.fn.synIDattr(hlid, 'fg#')
|
||||
local bg = vim.fn.synIDattr(hlid, 'bg#')
|
||||
local sp = vim.fn.synIDattr(hlid, 'sp#')
|
||||
local decor_line = {}
|
||||
if vim.fn.synIDattr(hlid, 'underline') ~= '' then
|
||||
table.insert(decor_line, 'underline')
|
||||
@ -1020,6 +1021,8 @@ local function extend_style(out, state)
|
||||
['font-weight'] = vim.fn.synIDattr(hlid, 'bold') ~= '' and 'bold' or nil,
|
||||
['text-decoration-line'] = not vim.tbl_isempty(decor_line) and table.concat(decor_line, ' ')
|
||||
or nil,
|
||||
-- TODO(ribru17): fallback to displayed text color if sp not set
|
||||
['text-decoration-color'] = sp ~= '' and cterm_to_hex(sp) or nil,
|
||||
--TODO(altermo) if strikethrough and undercurl then the strikethrough becomes wavy
|
||||
['text-decoration-style'] = vim.fn.synIDattr(hlid, 'undercurl') ~= '' and 'wavy' or nil,
|
||||
}
|
||||
@ -1290,9 +1293,25 @@ local function opt_to_global_state(opt, title)
|
||||
local fonts = {}
|
||||
if opt.font then
|
||||
fonts = type(opt.font) == 'string' and { opt.font } or opt.font --[[@as (string[])]]
|
||||
for i, v in pairs(fonts) do
|
||||
fonts[i] = ('"%s"'):format(v)
|
||||
end
|
||||
elseif vim.o.guifont:match('^[^:]+') then
|
||||
table.insert(fonts, vim.o.guifont:match('^[^:]+'))
|
||||
-- Example:
|
||||
-- Input: "Font,Escape\,comma, Ignore space after comma"
|
||||
-- Output: { "Font","Escape,comma","Ignore space after comma" }
|
||||
local prev = ''
|
||||
for name in vim.gsplit(vim.o.guifont:match('^[^:]+'), ',', { trimempty = true }) do
|
||||
if vim.endswith(name, '\\') then
|
||||
prev = prev .. vim.trim(name:sub(1, -2) .. ',')
|
||||
elseif vim.trim(name) ~= '' then
|
||||
table.insert(fonts, ('"%s%s"'):format(prev, vim.trim(name)))
|
||||
prev = ''
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Generic family names (monospace here) must not be quoted
|
||||
-- because the browser recognizes them as font families.
|
||||
table.insert(fonts, 'monospace')
|
||||
--- @type vim.tohtml.state.global
|
||||
local state = {
|
||||
|
@ -9,8 +9,8 @@
|
||||
local function get_commentstring(ref_position)
|
||||
local buf_cs = vim.bo.commentstring
|
||||
|
||||
local has_ts_parser, ts_parser = pcall(vim.treesitter.get_parser)
|
||||
if not has_ts_parser then
|
||||
local ts_parser = vim.treesitter._get_parser()
|
||||
if not ts_parser then
|
||||
return buf_cs
|
||||
end
|
||||
|
||||
|
@ -113,9 +113,11 @@ do
|
||||
local gx_desc =
|
||||
'Opens filepath or URI under cursor with the system handler (file explorer, web browser, …)'
|
||||
vim.keymap.set({ 'n' }, 'gx', function()
|
||||
local err = do_open(require('vim.ui')._get_url())
|
||||
if err then
|
||||
vim.notify(err, vim.log.levels.ERROR)
|
||||
for _, url in ipairs(require('vim.ui')._get_urls()) do
|
||||
local err = do_open(url)
|
||||
if err then
|
||||
vim.notify(err, vim.log.levels.ERROR)
|
||||
end
|
||||
end
|
||||
end, { desc = gx_desc })
|
||||
vim.keymap.set({ 'x' }, 'gx', function()
|
||||
@ -211,8 +213,11 @@ end
|
||||
--- Default menus
|
||||
do
|
||||
--- Right click popup menu
|
||||
-- TODO VimScript, no l10n
|
||||
vim.cmd([[
|
||||
anoremenu PopUp.Go\ to\ definition <Cmd>lua vim.lsp.buf.definition()<CR>
|
||||
amenu PopUp.Open\ in\ web\ browser gx
|
||||
anoremenu PopUp.Inspect <Cmd>Inspect<CR>
|
||||
anoremenu PopUp.-1- <Nop>
|
||||
vnoremenu PopUp.Cut "+x
|
||||
vnoremenu PopUp.Copy "+y
|
||||
anoremenu PopUp.Paste "+gP
|
||||
@ -221,10 +226,36 @@ do
|
||||
nnoremenu PopUp.Select\ All ggVG
|
||||
vnoremenu PopUp.Select\ All gg0oG$
|
||||
inoremenu PopUp.Select\ All <C-Home><C-O>VG
|
||||
anoremenu PopUp.Inspect <Cmd>Inspect<CR>
|
||||
anoremenu PopUp.-1- <Nop>
|
||||
anoremenu PopUp.-2- <Nop>
|
||||
anoremenu PopUp.How-to\ disable\ mouse <Cmd>help disable-mouse<CR>
|
||||
]])
|
||||
|
||||
local function enable_ctx_menu(ctx)
|
||||
vim.cmd([[
|
||||
amenu disable PopUp.Go\ to\ definition
|
||||
amenu disable PopUp.Open\ in\ web\ browser
|
||||
]])
|
||||
|
||||
if ctx == 'url' then
|
||||
vim.cmd([[amenu enable PopUp.Open\ in\ web\ browser]])
|
||||
elseif ctx == 'lsp' then
|
||||
vim.cmd([[anoremenu enable PopUp.Go\ to\ definition]])
|
||||
end
|
||||
end
|
||||
|
||||
local nvim_popupmenu_augroup = vim.api.nvim_create_augroup('nvim_popupmenu', {})
|
||||
vim.api.nvim_create_autocmd('MenuPopup', {
|
||||
pattern = '*',
|
||||
group = nvim_popupmenu_augroup,
|
||||
desc = 'Mouse popup menu',
|
||||
-- nested = true,
|
||||
callback = function()
|
||||
local urls = require('vim.ui')._get_urls()
|
||||
local url = vim.startswith(urls[1], 'http')
|
||||
local ctx = url and 'url' or (vim.lsp.get_clients({ bufnr = 0 })[1] and 'lsp' or nil)
|
||||
enable_ctx_menu(ctx)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
--- Default autocommands. See |default-autocmds|
|
||||
|
@ -1,17 +1,19 @@
|
||||
-- Nvim-Lua stdlib: the `vim` module (:help lua-stdlib)
|
||||
--
|
||||
-- Lua code lives in one of three places:
|
||||
-- 1. runtime/lua/vim/ (the runtime): For "nice to have" features, e.g. the
|
||||
-- `inspect` and `lpeg` modules.
|
||||
-- 2. runtime/lua/vim/shared.lua: pure Lua functions which always
|
||||
-- are available. Used in the test runner, as well as worker threads
|
||||
-- and processes launched from Nvim.
|
||||
-- 3. runtime/lua/vim/_editor.lua: Code which directly interacts with
|
||||
-- the Nvim editor state. Only available in the main thread.
|
||||
-- Lua code lives in one of four places:
|
||||
-- 1. Plugins! Not everything needs to live on "vim.*". Plugins are the correct model for
|
||||
-- non-essential features which the user may want to disable or replace with a third-party
|
||||
-- plugin. Examples: "editorconfig", "comment".
|
||||
-- - "opt-out": runtime/plugin/*.lua
|
||||
-- - "opt-in": runtime/pack/dist/opt/
|
||||
-- 2. runtime/lua/vim/ (the runtime): Lazy-loaded modules. Examples: `inspect`, `lpeg`.
|
||||
-- 3. runtime/lua/vim/shared.lua: pure Lua functions which always are available. Used in the test
|
||||
-- runner, as well as worker threads and processes launched from Nvim.
|
||||
-- 4. runtime/lua/vim/_editor.lua: Eager-loaded code which directly interacts with the Nvim
|
||||
-- editor state. Only available in the main thread.
|
||||
--
|
||||
-- Guideline: "If in doubt, put it in the runtime".
|
||||
--
|
||||
-- Most functions should live directly in `vim.`, not in submodules.
|
||||
-- The top level "vim.*" namespace is for fundamental Lua and editor features. Use submodules for
|
||||
-- everything else (but avoid excessive "nesting"), or plugins (see above).
|
||||
--
|
||||
-- Compatibility with Vim's `if_lua` is explicitly a non-goal.
|
||||
--
|
||||
@ -19,9 +21,7 @@
|
||||
-- - https://github.com/luafun/luafun
|
||||
-- - https://github.com/rxi/lume
|
||||
-- - http://leafo.net/lapis/reference/utilities.html
|
||||
-- - https://github.com/torch/paths
|
||||
-- - https://github.com/bakpakin/Fennel (pretty print, repl)
|
||||
-- - https://github.com/howl-editor/howl/tree/master/lib/howl/util
|
||||
|
||||
-- These are for loading runtime modules lazily since they aren't available in
|
||||
-- the nvim binary as specified in executor.c
|
||||
|
@ -23,7 +23,7 @@ error('Cannot require a meta file')
|
||||
--- @field conceal? boolean
|
||||
--- @field spell? boolean
|
||||
--- @field ui_watched? boolean
|
||||
--- @field url? boolean
|
||||
--- @field url? string
|
||||
--- @field hl_mode? string
|
||||
---
|
||||
--- @field virt_text? [string, string][]
|
||||
|
17
runtime/lua/vim/_meta/options.lua
generated
17
runtime/lua/vim/_meta/options.lua
generated
@ -558,9 +558,9 @@ vim.wo.bri = vim.wo.breakindent
|
||||
--- list:{n} Adds an additional indent for lines that match a
|
||||
--- numbered or bulleted list (using the
|
||||
--- 'formatlistpat' setting).
|
||||
--- list:-1 Uses the length of a match with 'formatlistpat'
|
||||
--- for indentation.
|
||||
--- (default: 0)
|
||||
--- list:-1 Uses the width of a match with 'formatlistpat' for
|
||||
--- indentation.
|
||||
--- column:{n} Indent at column {n}. Will overrule the other
|
||||
--- sub-options. Note: an additional indent may be
|
||||
--- added for the 'showbreak' setting.
|
||||
@ -1829,9 +1829,12 @@ vim.go.ead = vim.go.eadirection
|
||||
|
||||
--- When on all Unicode emoji characters are considered to be full width.
|
||||
--- This excludes "text emoji" characters, which are normally displayed as
|
||||
--- single width. Unfortunately there is no good specification for this
|
||||
--- and it has been determined on trial-and-error basis. Use the
|
||||
--- `setcellwidths()` function to change the behavior.
|
||||
--- single width. However, such "text emoji" are treated as full-width
|
||||
--- emoji if they are followed by the U+FE0F variant selector.
|
||||
---
|
||||
--- Unfortunately there is no good specification for this and it has been
|
||||
--- determined on trial-and-error basis. Use the `setcellwidths()`
|
||||
--- function to change the behavior.
|
||||
---
|
||||
--- @type boolean
|
||||
vim.o.emoji = true
|
||||
@ -7252,7 +7255,7 @@ vim.go.tm = vim.go.timeoutlen
|
||||
|
||||
--- When on, the title of the window will be set to the value of
|
||||
--- 'titlestring' (if it is not empty), or to:
|
||||
--- filename [+=-] (path) - NVIM
|
||||
--- filename [+=-] (path) - Nvim
|
||||
--- Where:
|
||||
--- filename the name of the file being edited
|
||||
--- - indicates the file cannot be modified, 'ma' off
|
||||
@ -7260,7 +7263,7 @@ vim.go.tm = vim.go.timeoutlen
|
||||
--- = indicates the file is read-only
|
||||
--- =+ indicates the file is read-only and modified
|
||||
--- (path) is the path of the file being edited
|
||||
--- - NVIM the server name `v:servername` or "NVIM"
|
||||
--- - Nvim the server name `v:servername` or "Nvim"
|
||||
---
|
||||
--- @type boolean
|
||||
vim.o.title = false
|
||||
|
8
runtime/lua/vim/_meta/vimfn.lua
generated
8
runtime/lua/vim/_meta/vimfn.lua
generated
@ -1593,7 +1593,7 @@ function vim.fn.eventhandler() end
|
||||
--- On MS-Windows the ".exe", ".bat", etc. can optionally be
|
||||
--- included. Then the extensions in $PATHEXT are tried. Thus if
|
||||
--- "foo.exe" does not exist, "foo.exe.bat" can be found. If
|
||||
--- $PATHEXT is not set then ".exe;.com;.bat;.cmd" is used. A dot
|
||||
--- $PATHEXT is not set then ".com;.exe;.bat;.cmd" is used. A dot
|
||||
--- by itself can be used in $PATHEXT to try using the name
|
||||
--- without an extension. When 'shell' looks like a Unix shell,
|
||||
--- then the name is also tried without adding an extension.
|
||||
@ -2861,7 +2861,7 @@ function vim.fn.getcharpos(expr) end
|
||||
--- nnoremap <expr> , getcharsearch().forward ? ',' : ';'
|
||||
--- <Also see |setcharsearch()|.
|
||||
---
|
||||
--- @return table[]
|
||||
--- @return table
|
||||
function vim.fn.getcharsearch() end
|
||||
|
||||
--- Get a single character from the user or input stream as a
|
||||
@ -5262,6 +5262,7 @@ function vim.fn.map(expr1, expr2) end
|
||||
--- "lhsrawalt" The {lhs} of the mapping as raw bytes, alternate
|
||||
--- form, only present when it differs from "lhsraw"
|
||||
--- "rhs" The {rhs} of the mapping as typed.
|
||||
--- "callback" Lua function, if RHS was defined as such.
|
||||
--- "silent" 1 for a |:map-silent| mapping, else 0.
|
||||
--- "noremap" 1 if the {rhs} of the mapping is not remappable.
|
||||
--- "script" 1 if mapping was defined with <script>.
|
||||
@ -7420,6 +7421,9 @@ function vim.fn.screenstring(row, col) end
|
||||
--- The value must not be negative. A zero value is like not
|
||||
--- giving the argument.
|
||||
---
|
||||
--- Note: the timeout is only considered when searching, not
|
||||
--- while evaluating the {skip} expression.
|
||||
---
|
||||
--- If the {skip} expression is given it is evaluated with the
|
||||
--- cursor positioned on the start of a match. If it evaluates to
|
||||
--- non-zero this match is skipped. This can be used, for
|
||||
|
@ -1164,6 +1164,7 @@ local extension = {
|
||||
svelte = 'svelte',
|
||||
svg = 'svg',
|
||||
swift = 'swift',
|
||||
swiftinterface = 'swift',
|
||||
swig = 'swig',
|
||||
swg = 'swig',
|
||||
sys = detect.sys,
|
||||
@ -2518,7 +2519,7 @@ end
|
||||
--- ['.*/etc/foo/.*%.conf'] = { 'dosini', { priority = 10 } },
|
||||
--- -- A pattern containing an environment variable
|
||||
--- ['${XDG_CONFIG_HOME}/foo/git'] = 'git',
|
||||
--- ['README.(%a+)$'] = function(path, bufnr, ext)
|
||||
--- ['.*README.(%a+)'] = function(path, bufnr, ext)
|
||||
--- if ext == 'md' then
|
||||
--- return 'markdown'
|
||||
--- elseif ext == 'rst' then
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- @brief
|
||||
---<pre>help
|
||||
--- health.vim is a minimal framework to help users troubleshoot configuration and
|
||||
--- vim.health is a minimal framework to help users troubleshoot configuration and
|
||||
--- any other environment conditions that a plugin might care about. Nvim ships
|
||||
--- with healthchecks for configuration, performance, python support, ruby
|
||||
--- support, clipboard support, and more.
|
||||
@ -39,7 +39,7 @@
|
||||
--- :checkhealth vim*
|
||||
--- <
|
||||
---
|
||||
--- Create a healthcheck *health-dev* *vim.health*
|
||||
--- Create a healthcheck *health-dev*
|
||||
---
|
||||
--- Healthchecks are functions that check the user environment, configuration, or
|
||||
--- any other prerequisites that a plugin cares about. Nvim ships with
|
||||
@ -285,8 +285,8 @@ local path2name = function(path)
|
||||
-- Remove everything up to the last /lua/ folder
|
||||
path = path:gsub('^.*/lua/', '')
|
||||
|
||||
-- Remove the filename (health.lua)
|
||||
path = vim.fs.dirname(path)
|
||||
-- Remove the filename (health.lua) or (health/init.lua)
|
||||
path = vim.fs.dirname(path:gsub('/init%.lua$', ''))
|
||||
|
||||
-- Change slashes to dots
|
||||
path = path:gsub('/', '.')
|
||||
|
@ -6,10 +6,12 @@
|
||||
--- of each pipeline stage is input to the next stage. The first stage depends on the type passed to
|
||||
--- `vim.iter()`:
|
||||
---
|
||||
--- - List tables (arrays, |lua-list|) yield only the value of each element.
|
||||
--- - Holes (nil values) are allowed.
|
||||
--- - Lists or arrays (|lua-list|) yield only the value of each element.
|
||||
--- - Holes (nil values) are allowed (but discarded).
|
||||
--- - Use pairs() to treat array/list tables as dicts (preserve holes and non-contiguous integer
|
||||
--- keys): `vim.iter(pairs(…))`.
|
||||
--- - Use |Iter:enumerate()| to also pass the index to the next stage.
|
||||
--- - Or initialize with ipairs(): `vim.iter(ipairs(…))`.
|
||||
--- - Or initialize with ipairs(): `vim.iter(ipairs(…))`.
|
||||
--- - Non-list tables (|lua-dict|) yield both the key and value of each element.
|
||||
--- - Function |iterator|s yield all values returned by the underlying function.
|
||||
--- - Tables with a |__call()| metamethod are treated as function iterators.
|
||||
@ -1034,7 +1036,7 @@ function Iter.new(src, ...)
|
||||
if type(k) ~= 'number' or k <= 0 or math.floor(k) ~= k then
|
||||
return Iter.new(pairs(src))
|
||||
end
|
||||
t[#t + 1] = v
|
||||
t[#t + 1] = v -- Coerce to list-like table.
|
||||
end
|
||||
return ArrayIter.new(t)
|
||||
end
|
||||
|
@ -1031,7 +1031,7 @@ end
|
||||
--- Provides an interface between the built-in client and a `formatexpr` function.
|
||||
---
|
||||
--- Currently only supports a single client. This can be set via
|
||||
--- `setlocal formatexpr=v:lua.vim.lsp.formatexpr()` but will typically or in `on_attach`
|
||||
--- `setlocal formatexpr=v:lua.vim.lsp.formatexpr()` or (more typically) in `on_attach`
|
||||
--- via `vim.bo[bufnr].formatexpr = 'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})'`.
|
||||
---
|
||||
---@param opts? vim.lsp.formatexpr.Opts
|
||||
|
@ -447,11 +447,9 @@ function M.document_symbol(opts)
|
||||
request_with_opts(ms.textDocument_documentSymbol, params, opts)
|
||||
end
|
||||
|
||||
--- @param call_hierarchy_items lsp.CallHierarchyItem[]?
|
||||
--- @param call_hierarchy_items lsp.CallHierarchyItem[]
|
||||
--- @return lsp.CallHierarchyItem?
|
||||
local function pick_call_hierarchy_item(call_hierarchy_items)
|
||||
if not call_hierarchy_items then
|
||||
return
|
||||
end
|
||||
if #call_hierarchy_items == 1 then
|
||||
return call_hierarchy_items[1]
|
||||
end
|
||||
@ -476,7 +474,7 @@ local function call_hierarchy(method)
|
||||
vim.notify(err.message, vim.log.levels.WARN)
|
||||
return
|
||||
end
|
||||
if not result then
|
||||
if not result or vim.tbl_isempty(result) then
|
||||
vim.notify('No item resolved', vim.log.levels.WARN)
|
||||
return
|
||||
end
|
||||
|
@ -238,7 +238,7 @@ function M._lsp_to_complete_items(result, prefix, client_id)
|
||||
|
||||
---@type fun(item: lsp.CompletionItem):boolean
|
||||
local matches
|
||||
if prefix == '' then
|
||||
if not prefix:find('%w') then
|
||||
matches = function(_)
|
||||
return true
|
||||
end
|
||||
@ -597,7 +597,7 @@ end
|
||||
|
||||
--- @class vim.lsp.completion.BufferOpts
|
||||
--- @field autotrigger? boolean Whether to trigger completion automatically. Default: false
|
||||
--- @field convert? fun(item: lsp.CompletionItem): table An optional function used to customize the transformation of an LSP CompletionItem to |complete-items|.
|
||||
--- @field convert? fun(item: lsp.CompletionItem): table Transforms an LSP CompletionItem to |complete-items|.
|
||||
|
||||
---@param client_id integer
|
||||
---@param bufnr integer
|
||||
|
@ -43,17 +43,16 @@ function M.on_inlayhint(err, result, ctx, _)
|
||||
return
|
||||
end
|
||||
local bufnr = assert(ctx.bufnr)
|
||||
if util.buf_versions[bufnr] ~= ctx.version then
|
||||
if
|
||||
util.buf_versions[bufnr] ~= ctx.version
|
||||
or not result
|
||||
or not api.nvim_buf_is_loaded(bufnr)
|
||||
or not bufstates[bufnr].enabled
|
||||
then
|
||||
return
|
||||
end
|
||||
local client_id = ctx.client_id
|
||||
if not result then
|
||||
return
|
||||
end
|
||||
local bufstate = bufstates[bufnr]
|
||||
if not bufstate.enabled then
|
||||
return
|
||||
end
|
||||
if not (bufstate.client_hints and bufstate.version) then
|
||||
bufstate.client_hints = vim.defaulttable()
|
||||
bufstate.version = ctx.version
|
||||
@ -77,12 +76,7 @@ function M.on_inlayhint(err, result, ctx, _)
|
||||
local col = position.character
|
||||
if col > 0 then
|
||||
local line = lines[position.line + 1] or ''
|
||||
local ok, convert_result
|
||||
ok, convert_result = pcall(util._str_byteindex_enc, line, col, client.offset_encoding)
|
||||
if ok then
|
||||
return convert_result
|
||||
end
|
||||
return math.min(#line, col)
|
||||
return util._str_byteindex_enc(line, col, client.offset_encoding)
|
||||
end
|
||||
return col
|
||||
end
|
||||
|
@ -703,7 +703,9 @@ function M.connect(host_or_path, port)
|
||||
if port == nil then
|
||||
handle:connect(host_or_path, on_connect)
|
||||
else
|
||||
handle:connect(host_or_path, port, on_connect)
|
||||
local info = uv.getaddrinfo(host_or_path, nil)
|
||||
local resolved_host = info and info[1] and info[1].addr or host_or_path
|
||||
handle:connect(resolved_host, port, on_connect)
|
||||
end
|
||||
|
||||
return public_client(client)
|
||||
|
@ -140,12 +140,7 @@ local function tokens_to_ranges(data, bufnr, client, request)
|
||||
local function _get_byte_pos(col)
|
||||
if col > 0 then
|
||||
local buf_line = lines[line + 1] or ''
|
||||
local ok, result
|
||||
ok, result = pcall(util._str_byteindex_enc, buf_line, col, client.offset_encoding)
|
||||
if ok then
|
||||
return result
|
||||
end
|
||||
return math.min(#buf_line, col)
|
||||
return util._str_byteindex_enc(buf_line, col, client.offset_encoding)
|
||||
end
|
||||
return col
|
||||
end
|
||||
|
@ -119,6 +119,7 @@ end
|
||||
---@param encoding string|nil utf-8|utf-16|utf-32|nil defaults to utf-16
|
||||
---@return integer `encoding` index of `index` in `line`
|
||||
function M._str_utfindex_enc(line, index, encoding)
|
||||
local len32, len16 = vim.str_utfindex(line)
|
||||
if not encoding then
|
||||
encoding = 'utf-16'
|
||||
end
|
||||
@ -129,9 +130,15 @@ function M._str_utfindex_enc(line, index, encoding)
|
||||
return #line
|
||||
end
|
||||
elseif encoding == 'utf-16' then
|
||||
if not index or index > len16 then
|
||||
return len16
|
||||
end
|
||||
local _, col16 = vim.str_utfindex(line, index)
|
||||
return col16
|
||||
elseif encoding == 'utf-32' then
|
||||
if not index or index > len32 then
|
||||
return len32
|
||||
end
|
||||
local col32, _ = vim.str_utfindex(line, index)
|
||||
return col32
|
||||
else
|
||||
@ -147,6 +154,12 @@ end
|
||||
---@param encoding string utf-8|utf-16|utf-32| defaults to utf-16
|
||||
---@return integer byte (utf-8) index of `encoding` index `index` in `line`
|
||||
function M._str_byteindex_enc(line, index, encoding)
|
||||
local len = #line
|
||||
if index > len then
|
||||
-- LSP spec: if character > line length, default to the line length.
|
||||
-- https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#position
|
||||
return len
|
||||
end
|
||||
if not encoding then
|
||||
encoding = 'utf-16'
|
||||
end
|
||||
@ -154,7 +167,7 @@ function M._str_byteindex_enc(line, index, encoding)
|
||||
if index then
|
||||
return index
|
||||
else
|
||||
return #line
|
||||
return len
|
||||
end
|
||||
elseif encoding == 'utf-16' then
|
||||
return vim.str_byteindex(line, index, true)
|
||||
@ -165,9 +178,6 @@ function M._str_byteindex_enc(line, index, encoding)
|
||||
end
|
||||
end
|
||||
|
||||
local _str_utfindex_enc = M._str_utfindex_enc
|
||||
local _str_byteindex_enc = M._str_byteindex_enc
|
||||
|
||||
--- Replaces text in a range with new text.
|
||||
---
|
||||
--- CAUTION: Changes in-place!
|
||||
@ -334,12 +344,7 @@ local function get_line_byte_from_position(bufnr, position, offset_encoding)
|
||||
-- character
|
||||
if col > 0 then
|
||||
local line = get_line(bufnr, position.line) or ''
|
||||
local ok, result
|
||||
ok, result = pcall(_str_byteindex_enc, line, col, offset_encoding)
|
||||
if ok then
|
||||
return result
|
||||
end
|
||||
return math.min(#line, col)
|
||||
return M._str_byteindex_enc(line, col, offset_encoding or 'utf-16')
|
||||
end
|
||||
return col
|
||||
end
|
||||
@ -436,14 +441,15 @@ function M.apply_text_edits(text_edits, bufnr, offset_encoding)
|
||||
e.end_col = last_line_len
|
||||
has_eol_text_edit = true
|
||||
else
|
||||
-- If the replacement is over the end of a line (i.e. e.end_col is out of bounds and the
|
||||
-- If the replacement is over the end of a line (i.e. e.end_col is equal to the line length and the
|
||||
-- replacement text ends with a newline We can likely assume that the replacement is assumed
|
||||
-- to be meant to replace the newline with another newline and we need to make sure this
|
||||
-- doesn't add an extra empty line. E.g. when the last line to be replaced contains a '\r'
|
||||
-- in the file some servers (clangd on windows) will include that character in the line
|
||||
-- while nvim_buf_set_text doesn't count it as part of the line.
|
||||
if
|
||||
e.end_col > last_line_len
|
||||
e.end_col >= last_line_len
|
||||
and text_edit.range['end'].character > e.end_col
|
||||
and #text_edit.newText > 0
|
||||
and string.sub(text_edit.newText, -1) == '\n'
|
||||
then
|
||||
@ -1795,8 +1801,10 @@ function M.locations_to_items(locations, offset_encoding)
|
||||
local row = pos.line
|
||||
local end_row = end_pos.line
|
||||
local line = lines[row] or ''
|
||||
local end_line = lines[end_row] or ''
|
||||
local col = M._str_byteindex_enc(line, pos.character, offset_encoding)
|
||||
local end_col = M._str_byteindex_enc(lines[end_row] or '', end_pos.character, offset_encoding)
|
||||
local end_col = M._str_byteindex_enc(end_line, end_pos.character, offset_encoding)
|
||||
|
||||
table.insert(items, {
|
||||
filename = filename,
|
||||
lnum = row + 1,
|
||||
@ -1925,7 +1933,7 @@ local function make_position_param(window, offset_encoding)
|
||||
return { line = 0, character = 0 }
|
||||
end
|
||||
|
||||
col = _str_utfindex_enc(line, col, offset_encoding)
|
||||
col = M._str_utfindex_enc(line, col, offset_encoding)
|
||||
|
||||
return { line = row, character = col }
|
||||
end
|
||||
@ -2107,11 +2115,7 @@ function M.character_offset(buf, row, col, offset_encoding)
|
||||
)
|
||||
offset_encoding = vim.lsp.get_clients({ bufnr = buf })[1].offset_encoding
|
||||
end
|
||||
-- If the col is past the EOL, use the line length.
|
||||
if col > #line then
|
||||
return _str_utfindex_enc(line, nil, offset_encoding)
|
||||
end
|
||||
return _str_utfindex_enc(line, col, offset_encoding)
|
||||
return M._str_utfindex_enc(line, col, offset_encoding)
|
||||
end
|
||||
|
||||
--- Helper function to return nested values in language server settings
|
||||
|
@ -354,37 +354,28 @@ function vim.tbl_isempty(t)
|
||||
return next(t) == nil
|
||||
end
|
||||
|
||||
--- We only merge empty tables or tables that are not an array (indexed by integers)
|
||||
--- We only merge empty tables or tables that are not list-like (indexed by consecutive integers
|
||||
--- starting from 1)
|
||||
local function can_merge(v)
|
||||
return type(v) == 'table' and (vim.tbl_isempty(v) or not vim.isarray(v))
|
||||
return type(v) == 'table' and (vim.tbl_isempty(v) or not vim.islist(v))
|
||||
end
|
||||
|
||||
local function tbl_extend(behavior, deep_extend, ...)
|
||||
if behavior ~= 'error' and behavior ~= 'keep' and behavior ~= 'force' then
|
||||
error('invalid "behavior": ' .. tostring(behavior))
|
||||
end
|
||||
|
||||
if select('#', ...) < 2 then
|
||||
error(
|
||||
'wrong number of arguments (given '
|
||||
.. tostring(1 + select('#', ...))
|
||||
.. ', expected at least 3)'
|
||||
)
|
||||
end
|
||||
|
||||
--- Recursive worker for tbl_extend
|
||||
--- @param behavior 'error'|'keep'|'force'
|
||||
--- @param deep_extend boolean
|
||||
--- @param ... table<any,any>
|
||||
local function tbl_extend_rec(behavior, deep_extend, ...)
|
||||
local ret = {} --- @type table<any,any>
|
||||
if vim._empty_dict_mt ~= nil and getmetatable(select(1, ...)) == vim._empty_dict_mt then
|
||||
ret = vim.empty_dict()
|
||||
end
|
||||
|
||||
for i = 1, select('#', ...) do
|
||||
local tbl = select(i, ...)
|
||||
vim.validate('after the second argument', tbl, 'table')
|
||||
--- @cast tbl table<any,any>
|
||||
local tbl = select(i, ...) --[[@as table<any,any>]]
|
||||
if tbl then
|
||||
for k, v in pairs(tbl) do
|
||||
if deep_extend and can_merge(v) and can_merge(ret[k]) then
|
||||
ret[k] = tbl_extend(behavior, true, ret[k], v)
|
||||
ret[k] = tbl_extend_rec(behavior, true, ret[k], v)
|
||||
elseif behavior ~= 'force' and ret[k] ~= nil then
|
||||
if behavior == 'error' then
|
||||
error('key found in more than one map: ' .. k)
|
||||
@ -395,9 +386,31 @@ local function tbl_extend(behavior, deep_extend, ...)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
--- @param behavior 'error'|'keep'|'force'
|
||||
--- @param deep_extend boolean
|
||||
--- @param ... table<any,any>
|
||||
local function tbl_extend(behavior, deep_extend, ...)
|
||||
if behavior ~= 'error' and behavior ~= 'keep' and behavior ~= 'force' then
|
||||
error('invalid "behavior": ' .. tostring(behavior))
|
||||
end
|
||||
|
||||
local nargs = select('#', ...)
|
||||
|
||||
if nargs < 2 then
|
||||
error(('wrong number of arguments (given %d, expected at least 3)'):format(1 + nargs))
|
||||
end
|
||||
|
||||
for i = 1, nargs do
|
||||
vim.validate('after the second argument', select(i, ...), 'table')
|
||||
end
|
||||
|
||||
return tbl_extend_rec(behavior, deep_extend, ...)
|
||||
end
|
||||
|
||||
--- Merges two or more tables.
|
||||
---
|
||||
---@see |extend()|
|
||||
@ -414,6 +427,11 @@ end
|
||||
|
||||
--- Merges recursively two or more tables.
|
||||
---
|
||||
--- Only values that are empty tables or tables that are not |lua-list|s (indexed by consecutive
|
||||
--- integers starting from 1) are merged recursively. This is useful for merging nested tables
|
||||
--- like default and user configurations where lists should be treated as literals (i.e., are
|
||||
--- overwritten instead of merged).
|
||||
---
|
||||
---@see |vim.tbl_extend()|
|
||||
---
|
||||
---@generic T1: table
|
||||
|
@ -74,14 +74,14 @@ end
|
||||
|
||||
--- Returns the parser for a specific buffer and attaches it to the buffer
|
||||
---
|
||||
--- If needed, this will create the parser.
|
||||
--- If needed, this will create the parser. If no parser can be found or created, returns `nil`.
|
||||
---
|
||||
---@param bufnr (integer|nil) Buffer the parser should be tied to (default: current buffer)
|
||||
---@param lang (string|nil) Language of this parser (default: from buffer filetype)
|
||||
---@param opts (table|nil) Options to pass to the created language tree
|
||||
---
|
||||
---@return vim.treesitter.LanguageTree object to use for parsing
|
||||
function M.get_parser(bufnr, lang, opts)
|
||||
---@return vim.treesitter.LanguageTree? object to use for parsing, or `nil` if not found
|
||||
function M._get_parser(bufnr, lang, opts)
|
||||
opts = opts or {}
|
||||
|
||||
if bufnr == nil or bufnr == 0 then
|
||||
@ -94,18 +94,14 @@ function M.get_parser(bufnr, lang, opts)
|
||||
|
||||
if not valid_lang(lang) then
|
||||
if not parsers[bufnr] then
|
||||
error(
|
||||
string.format(
|
||||
'There is no parser available for buffer %d and one could not be'
|
||||
.. ' created because lang could not be determined. Either pass lang'
|
||||
.. ' or set the buffer filetype',
|
||||
bufnr
|
||||
)
|
||||
)
|
||||
return nil
|
||||
end
|
||||
elseif parsers[bufnr] == nil or parsers[bufnr]:lang() ~= lang then
|
||||
assert(lang, 'lang should be valid')
|
||||
parsers[bufnr] = M._create_parser(bufnr, lang, opts)
|
||||
local parser = vim.F.npcall(M._create_parser, bufnr, lang, opts)
|
||||
if not parser then
|
||||
return nil
|
||||
end
|
||||
parsers[bufnr] = parser
|
||||
end
|
||||
|
||||
parsers[bufnr]:register_cbs(opts.buf_attach_cbs)
|
||||
@ -113,6 +109,29 @@ function M.get_parser(bufnr, lang, opts)
|
||||
return parsers[bufnr]
|
||||
end
|
||||
|
||||
--- Returns the parser for a specific buffer and attaches it to the buffer
|
||||
---
|
||||
--- If needed, this will create the parser.
|
||||
---
|
||||
---@param bufnr (integer|nil) Buffer the parser should be tied to (default: current buffer)
|
||||
---@param lang (string|nil) Language of this parser (default: from buffer filetype)
|
||||
---@param opts (table|nil) Options to pass to the created language tree
|
||||
---
|
||||
---@return vim.treesitter.LanguageTree object to use for parsing
|
||||
function M.get_parser(bufnr, lang, opts)
|
||||
-- TODO(ribru17): Remove _get_parser and move that logic back here once the breaking function
|
||||
-- signature change is acceptable.
|
||||
local parser = M._get_parser(bufnr, lang, opts)
|
||||
if not parser then
|
||||
vim.notify_once(
|
||||
'WARNING: vim.treesitter.get_parser will return nil instead of raising an error in Neovim 0.12',
|
||||
vim.log.levels.WARN
|
||||
)
|
||||
error('Parser not found.')
|
||||
end
|
||||
return parser
|
||||
end
|
||||
|
||||
--- Returns a string parser
|
||||
---
|
||||
---@param str string Text to parse
|
||||
@ -386,7 +405,7 @@ function M.get_node(opts)
|
||||
|
||||
local ts_range = { row, col, row, col }
|
||||
|
||||
local root_lang_tree = M.get_parser(bufnr, opts.lang)
|
||||
local root_lang_tree = M._get_parser(bufnr, opts.lang)
|
||||
if not root_lang_tree then
|
||||
return
|
||||
end
|
||||
@ -419,7 +438,11 @@ end
|
||||
---@param lang (string|nil) Language of the parser (default: from buffer filetype)
|
||||
function M.start(bufnr, lang)
|
||||
bufnr = bufnr or api.nvim_get_current_buf()
|
||||
local parser = M.get_parser(bufnr, lang)
|
||||
local parser = M._get_parser(bufnr, lang)
|
||||
if not parser then
|
||||
vim.notify('No parser for the given buffer.', vim.log.levels.WARN)
|
||||
return
|
||||
end
|
||||
M.highlighter.new(parser)
|
||||
end
|
||||
|
||||
|
@ -114,7 +114,7 @@ local function compute_folds_levels(bufnr, info, srow, erow, parse_injections)
|
||||
srow = srow or 0
|
||||
erow = erow or api.nvim_buf_line_count(bufnr)
|
||||
|
||||
local parser = ts.get_parser(bufnr)
|
||||
local parser = assert(ts._get_parser(bufnr))
|
||||
|
||||
parser:parse(parse_injections and { srow, erow } or nil)
|
||||
|
||||
@ -131,9 +131,7 @@ local function compute_folds_levels(bufnr, info, srow, erow, parse_injections)
|
||||
|
||||
-- Collect folds starting from srow - 1, because we should first subtract the folds that end at
|
||||
-- srow - 1 from the level of srow - 1 to get accurate level of srow.
|
||||
for _, match, metadata in
|
||||
query:iter_matches(tree:root(), bufnr, math.max(srow - 1, 0), erow, { all = true })
|
||||
do
|
||||
for _, match, metadata in query:iter_matches(tree:root(), bufnr, math.max(srow - 1, 0), erow) do
|
||||
for id, nodes in pairs(match) do
|
||||
if query.captures[id] == 'fold' then
|
||||
local range = ts.get_range(nodes[1], bufnr, metadata[id])
|
||||
@ -394,7 +392,7 @@ function M.foldexpr(lnum)
|
||||
lnum = lnum or vim.v.lnum
|
||||
local bufnr = api.nvim_get_current_buf()
|
||||
|
||||
local parser = vim.F.npcall(ts.get_parser, bufnr)
|
||||
local parser = ts._get_parser(bufnr)
|
||||
if not parser then
|
||||
return '0'
|
||||
end
|
||||
|
@ -172,11 +172,11 @@ function M.lint(buf, opts)
|
||||
--- @type (table|nil)
|
||||
local parser_info = vim.F.npcall(vim.treesitter.language.inspect, lang)
|
||||
|
||||
local parser = vim.treesitter.get_parser(buf)
|
||||
local parser = assert(vim.treesitter._get_parser(buf), 'query parser not found.')
|
||||
parser:parse()
|
||||
parser:for_each_tree(function(tree, ltree)
|
||||
if ltree:lang() == 'query' then
|
||||
for _, match, _ in query:iter_matches(tree:root(), buf, 0, -1, { all = true }) do
|
||||
for _, match, _ in query:iter_matches(tree:root(), buf, 0, -1) do
|
||||
local lang_context = {
|
||||
lang = lang,
|
||||
parser_info = parser_info,
|
||||
|
@ -76,10 +76,9 @@ end
|
||||
---
|
||||
---@package
|
||||
function TSTreeView:new(bufnr, lang)
|
||||
local ok, parser = pcall(vim.treesitter.get_parser, bufnr or 0, lang)
|
||||
if not ok then
|
||||
local err = parser --[[ @as string ]]
|
||||
return nil, 'No parser available for the given buffer:\n' .. err
|
||||
local parser = vim.treesitter._get_parser(bufnr or 0, lang)
|
||||
if not parser then
|
||||
return nil, 'No parser available for the given buffer.'
|
||||
end
|
||||
|
||||
-- For each child tree (injected language), find the root of the tree and locate the node within
|
||||
@ -539,7 +538,7 @@ local edit_ns = api.nvim_create_namespace('treesitter/dev-edit')
|
||||
local function update_editor_highlights(query_win, base_win, lang)
|
||||
local base_buf = api.nvim_win_get_buf(base_win)
|
||||
local query_buf = api.nvim_win_get_buf(query_win)
|
||||
local parser = vim.treesitter.get_parser(base_buf, lang)
|
||||
local parser = assert(vim.treesitter._get_parser(base_buf, lang))
|
||||
api.nvim_buf_clear_namespace(base_buf, edit_ns, 0, -1)
|
||||
local query_content = table.concat(api.nvim_buf_get_lines(query_buf, 0, -1, false), '\n')
|
||||
|
||||
@ -596,8 +595,8 @@ function M.edit_query(lang)
|
||||
end
|
||||
vim.cmd(cmd)
|
||||
|
||||
local ok, parser = pcall(vim.treesitter.get_parser, buf, lang)
|
||||
if not ok then
|
||||
local parser = vim.treesitter._get_parser(buf, lang)
|
||||
if not parser then
|
||||
return nil, 'No parser available for the given buffer'
|
||||
end
|
||||
lang = parser:lang()
|
||||
|
@ -833,13 +833,7 @@ function LanguageTree:_get_injections()
|
||||
local start_line, _, end_line, _ = root_node:range()
|
||||
|
||||
for pattern, match, metadata in
|
||||
self._injection_query:iter_matches(
|
||||
root_node,
|
||||
self._source,
|
||||
start_line,
|
||||
end_line + 1,
|
||||
{ all = true }
|
||||
)
|
||||
self._injection_query:iter_matches(root_node, self._source, start_line, end_line + 1)
|
||||
do
|
||||
local lang, combined, ranges = self:_get_injection(match, metadata)
|
||||
if lang then
|
||||
|
@ -487,8 +487,8 @@ predicate_handlers['any-vim-match?'] = predicate_handlers['any-match?']
|
||||
---@class vim.treesitter.query.TSMetadata
|
||||
---@field range? Range
|
||||
---@field conceal? string
|
||||
---@field [integer] vim.treesitter.query.TSMetadata
|
||||
---@field [string] integer|string
|
||||
---@field [integer]? vim.treesitter.query.TSMetadata
|
||||
---@field [string]? integer|string
|
||||
|
||||
---@alias TSDirective fun(match: table<integer,TSNode[]>, _, _, predicate: (string|integer)[], metadata: vim.treesitter.query.TSMetadata)
|
||||
|
||||
@ -620,16 +620,16 @@ local directive_handlers = {
|
||||
--- @field force? boolean
|
||||
---
|
||||
--- Use the correct implementation of the match table where capture IDs map to
|
||||
--- a list of nodes instead of a single node. Defaults to false (for backward
|
||||
--- compatibility). This option will eventually become the default and removed.
|
||||
--- a list of nodes instead of a single node. Defaults to true. This option will
|
||||
--- be removed in a future release.
|
||||
--- @field all? boolean
|
||||
|
||||
--- Adds a new predicate to be used in queries
|
||||
---
|
||||
---@param name string Name of the predicate, without leading #
|
||||
---@param handler fun(match: table<integer,TSNode[]>, pattern: integer, source: integer|string, predicate: any[], metadata: table)
|
||||
---@param handler fun(match: table<integer,TSNode[]>, pattern: integer, source: integer|string, predicate: any[], metadata: vim.treesitter.query.TSMetadata)
|
||||
--- - see |vim.treesitter.query.add_directive()| for argument meanings
|
||||
---@param opts vim.treesitter.query.add_predicate.Opts
|
||||
---@param opts? vim.treesitter.query.add_predicate.Opts
|
||||
function M.add_predicate(name, handler, opts)
|
||||
-- Backward compatibility: old signature had "force" as boolean argument
|
||||
if type(opts) == 'boolean' then
|
||||
@ -642,7 +642,7 @@ function M.add_predicate(name, handler, opts)
|
||||
error(string.format('Overriding existing predicate %s', name))
|
||||
end
|
||||
|
||||
if opts.all then
|
||||
if opts.all ~= false then
|
||||
predicate_handlers[name] = handler
|
||||
else
|
||||
--- @param match table<integer, TSNode[]>
|
||||
@ -667,7 +667,7 @@ end
|
||||
--- metadata table `metadata[capture_id].key = value`
|
||||
---
|
||||
---@param name string Name of the directive, without leading #
|
||||
---@param handler fun(match: table<integer,TSNode[]>, pattern: integer, source: integer|string, predicate: any[], metadata: table)
|
||||
---@param handler fun(match: table<integer,TSNode[]>, pattern: integer, source: integer|string, predicate: any[], metadata: vim.treesitter.query.TSMetadata)
|
||||
--- - match: A table mapping capture IDs to a list of captured nodes
|
||||
--- - pattern: the index of the matching pattern in the query file
|
||||
--- - predicate: list of strings containing the full directive being called, e.g.
|
||||
@ -894,16 +894,10 @@ end
|
||||
--- index of the pattern in the query, a table mapping capture indices to a list
|
||||
--- of nodes, and metadata from any directives processing the match.
|
||||
---
|
||||
--- WARNING: Set `all=true` to ensure all matching nodes in a match are
|
||||
--- returned, otherwise only the last node in a match is returned, breaking captures
|
||||
--- involving quantifiers such as `(comment)+ @comment`. The default option
|
||||
--- `all=false` is only provided for backward compatibility and will be removed
|
||||
--- after Nvim 0.10.
|
||||
---
|
||||
--- Example:
|
||||
---
|
||||
--- ```lua
|
||||
--- for pattern, match, metadata in cquery:iter_matches(tree:root(), bufnr, 0, -1, { all = true }) do
|
||||
--- for pattern, match, metadata in cquery:iter_matches(tree:root(), bufnr, 0, -1) do
|
||||
--- for id, nodes in pairs(match) do
|
||||
--- local name = query.captures[id]
|
||||
--- for _, node in ipairs(nodes) do
|
||||
@ -925,11 +919,11 @@ end
|
||||
--- - max_start_depth (integer) if non-zero, sets the maximum start depth
|
||||
--- for each match. This is used to prevent traversing too deep into a tree.
|
||||
--- - match_limit (integer) Set the maximum number of in-progress matches (Default: 256).
|
||||
--- - all (boolean) When set, the returned match table maps capture IDs to a list of nodes.
|
||||
--- Older versions of iter_matches incorrectly mapped capture IDs to a single node, which is
|
||||
--- incorrect behavior. This option will eventually become the default and removed.
|
||||
--- - all (boolean) When `false` (default `true`), the returned table maps capture IDs to a single
|
||||
--- (last) node instead of the full list of matching nodes. This option is only for backward
|
||||
--- compatibility and will be removed in a future release.
|
||||
---
|
||||
---@return (fun(): integer, table<integer, TSNode[]>, table): pattern id, match, metadata
|
||||
---@return (fun(): integer, table<integer, TSNode[]>, vim.treesitter.query.TSMetadata): pattern id, match, metadata
|
||||
function Query:iter_matches(node, source, start, stop, opts)
|
||||
opts = opts or {}
|
||||
opts.match_limit = opts.match_limit or 256
|
||||
@ -960,10 +954,10 @@ function Query:iter_matches(node, source, start, stop, opts)
|
||||
|
||||
local captures = match:captures()
|
||||
|
||||
if not opts.all then
|
||||
if opts.all == false then
|
||||
-- Convert the match table into the old buggy version for backward
|
||||
-- compatibility. This is slow. Plugin authors, if you're reading this, set the "all"
|
||||
-- option!
|
||||
-- compatibility. This is slow, but we only do it when the caller explicitly opted into it by
|
||||
-- setting `all` to `false`.
|
||||
local old_match = {} ---@type table<integer, TSNode>
|
||||
for k, v in pairs(captures or {}) do
|
||||
old_match[k] = v[#v]
|
||||
|
@ -152,14 +152,14 @@ function M.open(path)
|
||||
else
|
||||
return nil, 'vim.ui.open: rundll32 not found'
|
||||
end
|
||||
elseif vim.fn.executable('wslview') == 1 then
|
||||
cmd = { 'wslview', path }
|
||||
elseif vim.fn.executable('explorer.exe') == 1 then
|
||||
cmd = { 'explorer.exe', path }
|
||||
elseif vim.fn.executable('xdg-open') == 1 then
|
||||
cmd = { 'xdg-open', path }
|
||||
opts.stdout = false
|
||||
opts.stderr = false
|
||||
elseif vim.fn.executable('wslview') == 1 then
|
||||
cmd = { 'wslview', path }
|
||||
elseif vim.fn.executable('explorer.exe') == 1 then
|
||||
cmd = { 'explorer.exe', path }
|
||||
else
|
||||
return nil, 'vim.ui.open: no handler found (tried: wslview, explorer.exe, xdg-open)'
|
||||
end
|
||||
@ -167,29 +167,64 @@ function M.open(path)
|
||||
return vim.system(cmd, opts), nil
|
||||
end
|
||||
|
||||
--- Gets the URL at cursor, if any.
|
||||
function M._get_url()
|
||||
if vim.bo.filetype == 'markdown' then
|
||||
local range = vim.api.nvim_win_get_cursor(0)
|
||||
vim.treesitter.get_parser():parse(range)
|
||||
-- marking the node as `markdown_inline` is required. Setting it to `markdown` does not
|
||||
-- work.
|
||||
local current_node = vim.treesitter.get_node { lang = 'markdown_inline' }
|
||||
while current_node do
|
||||
local type = current_node:type()
|
||||
if type == 'inline_link' or type == 'image' then
|
||||
local child = assert(current_node:named_child(1))
|
||||
return vim.treesitter.get_node_text(child, 0)
|
||||
end
|
||||
current_node = current_node:parent()
|
||||
--- Returns all URLs at cursor, if any.
|
||||
--- @return string[]
|
||||
function M._get_urls()
|
||||
local urls = {} ---@type string[]
|
||||
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local cursor = vim.api.nvim_win_get_cursor(0)
|
||||
local row = cursor[1] - 1
|
||||
local col = cursor[2]
|
||||
local extmarks = vim.api.nvim_buf_get_extmarks(bufnr, -1, { row, col }, { row, col }, {
|
||||
details = true,
|
||||
type = 'highlight',
|
||||
overlap = true,
|
||||
})
|
||||
for _, v in ipairs(extmarks) do
|
||||
local details = v[4]
|
||||
if details and details.url then
|
||||
urls[#urls + 1] = details.url
|
||||
end
|
||||
end
|
||||
|
||||
local url = vim._with({ go = { isfname = vim.o.isfname .. ',@-@' } }, function()
|
||||
return vim.fn.expand('<cfile>')
|
||||
end)
|
||||
local highlighter = vim.treesitter.highlighter.active[bufnr]
|
||||
if highlighter then
|
||||
local range = { row, col, row, col }
|
||||
local ltree = highlighter.tree:language_for_range(range)
|
||||
local lang = ltree:lang()
|
||||
local query = vim.treesitter.query.get(lang, 'highlights')
|
||||
if query then
|
||||
local tree = assert(ltree:tree_for_range(range))
|
||||
for _, match, metadata in query:iter_matches(tree:root(), bufnr, row, row + 1) do
|
||||
for id, nodes in pairs(match) do
|
||||
for _, node in ipairs(nodes) do
|
||||
if vim.treesitter.node_contains(node, range) then
|
||||
local url = metadata[id] and metadata[id].url
|
||||
if url and match[url] then
|
||||
for _, n in ipairs(match[url]) do
|
||||
urls[#urls + 1] =
|
||||
vim.treesitter.get_node_text(n, bufnr, { metadata = metadata[url] })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return url
|
||||
if #urls == 0 then
|
||||
-- If all else fails, use the filename under the cursor
|
||||
table.insert(
|
||||
urls,
|
||||
vim._with({ go = { isfname = vim.o.isfname .. ',@-@' } }, function()
|
||||
return vim.fn.expand('<cfile>')
|
||||
end)
|
||||
)
|
||||
end
|
||||
|
||||
return urls
|
||||
end
|
||||
|
||||
return M
|
||||
|
@ -33,7 +33,7 @@ end
|
||||
--- Show a table of contents for the help buffer in a loclist
|
||||
function M.show_toc()
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local parser = vim.treesitter.get_parser(bufnr, 'vimdoc')
|
||||
local parser = assert(vim.treesitter._get_parser(bufnr, 'vimdoc'), 'vimdoc parser not found.')
|
||||
local query = vim.treesitter.query.parse(
|
||||
parser:lang(),
|
||||
[[
|
||||
|
@ -4,6 +4,7 @@ GenericName=Text Editor
|
||||
GenericName[ckb]=دەستکاریکەری دەق
|
||||
GenericName[de]=Texteditor
|
||||
GenericName[fr]=Éditeur de texte
|
||||
GenericName[pl]=Edytor tekstu
|
||||
GenericName[ru]=Текстовый редактор
|
||||
GenericName[sr]=Едитор текст
|
||||
GenericName[tr]=Metin Düzenleyici
|
||||
|
@ -45,6 +45,11 @@
|
||||
(link_destination) @_url
|
||||
(#set! @_label url @_url))
|
||||
|
||||
(image
|
||||
(image_description) @_label
|
||||
(link_destination) @_url
|
||||
(#set! @_label url @_url))
|
||||
|
||||
; Conceal image links
|
||||
(image
|
||||
[
|
||||
|
@ -33,7 +33,10 @@
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
":" @punctuation.delimiter
|
||||
[
|
||||
":"
|
||||
"/"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"@"
|
||||
|
@ -1,12 +1,12 @@
|
||||
" Vim syntax file
|
||||
" Language: Configuration File (ini file) for MSDOS/MS Windows
|
||||
" Version: 2.3
|
||||
" Version: 2.4
|
||||
" Original Author: Sean M. McKee <mckee@misslink.net>
|
||||
" Previous Maintainer: Nima Talebi <nima@it.net.au>
|
||||
" Current Maintainer: Hong Xu <hong@topbug.net>
|
||||
" Homepage: http://www.vim.org/scripts/script.php?script_id=3747
|
||||
" Repository: https://github.com/xuhdev/syntax-dosini.vim
|
||||
" Last Change: 2023 Aug 20
|
||||
" Last Change: 2024 Sept 08
|
||||
|
||||
|
||||
" quit when a syntax file was already loaded
|
||||
@ -27,7 +27,7 @@ syn match dosiniNumber "=\zs\s*\d\+\s*$"
|
||||
syn match dosiniNumber "=\zs\s*\d*\.\d\+\s*$"
|
||||
syn match dosiniNumber "=\zs\s*\d\+e[+-]\=\d\+\s*$"
|
||||
syn region dosiniHeader start="^\s*\[" end="\]"
|
||||
syn match dosiniComment "^[#;].*$"
|
||||
syn match dosiniComment "^[#;].*$" contains=@Spell
|
||||
syn region dosiniSection start="\s*\[.*\]" end="\ze\s*\[.*\]" fold
|
||||
\ contains=dosiniLabel,dosiniValue,dosiniNumber,dosiniHeader,dosiniComment
|
||||
|
||||
|
66
runtime/syntax/hcl.vim
Normal file
66
runtime/syntax/hcl.vim
Normal file
@ -0,0 +1,66 @@
|
||||
" Vim syntax file
|
||||
" Language: HCL
|
||||
" Maintainer: Gregory Anders
|
||||
" Upstream: https://github.com/hashivim/vim-terraform
|
||||
" Last Change: 2024-09-03
|
||||
|
||||
if exists('b:current_syntax')
|
||||
finish
|
||||
endif
|
||||
|
||||
syn iskeyword a-z,A-Z,48-57,_,-
|
||||
|
||||
syn case match
|
||||
|
||||
" A block is introduced by a type, some number of labels - which are either
|
||||
" strings or identifiers - and an opening curly brace. Match the type.
|
||||
syn match hclBlockType /^\s*\zs\K\k*\ze\s\+\(\("\K\k*"\|\K\k*\)\s\+\)*{/
|
||||
|
||||
" An attribute name is an identifier followed by an equals sign.
|
||||
syn match hclAttributeAssignment /\(\K\k*\.\)*\K\k*\s\+=\s/ contains=hclAttributeName
|
||||
syn match hclAttributeName /\<\K\k*\>/ contained
|
||||
|
||||
syn keyword hclValueBool true false
|
||||
|
||||
syn keyword hclTodo contained TODO FIXME XXX BUG
|
||||
syn region hclComment start="/\*" end="\*/" contains=hclTodo,@Spell
|
||||
syn region hclComment start="#" end="$" contains=hclTodo,@Spell
|
||||
syn region hclComment start="//" end="$" contains=hclTodo,@Spell
|
||||
|
||||
""" misc.
|
||||
syn match hclValueDec "\<[0-9]\+\([kKmMgG]b\?\)\?\>"
|
||||
syn match hclValueHexaDec "\<0x[0-9a-f]\+\([kKmMgG]b\?\)\?\>"
|
||||
syn match hclBraces "[\[\]]"
|
||||
|
||||
""" skip \" and \\ in strings.
|
||||
syn region hclValueString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=hclStringInterp
|
||||
syn region hclStringInterp matchgroup=hclBraces start=/\(^\|[^$]\)\$\zs{/ end=/}/ contained contains=ALLBUT,hclAttributeName
|
||||
syn region hclHereDocText start=/<<-\?\z([a-z0-9A-Z]\+\)/ end=/^\s*\z1/ contains=hclStringInterp
|
||||
|
||||
"" Functions.
|
||||
syn match hclFunction "[a-z0-9]\+(\@="
|
||||
|
||||
""" HCL2
|
||||
syn keyword hclRepeat for in
|
||||
syn keyword hclConditional if
|
||||
syn keyword hclValueNull null
|
||||
|
||||
" enable block folding
|
||||
syn region hclBlockBody matchgroup=hclBraces start="{" end="}" fold transparent
|
||||
|
||||
hi def link hclComment Comment
|
||||
hi def link hclTodo Todo
|
||||
hi def link hclBraces Delimiter
|
||||
hi def link hclAttributeName Identifier
|
||||
hi def link hclBlockType Type
|
||||
hi def link hclValueBool Boolean
|
||||
hi def link hclValueDec Number
|
||||
hi def link hclValueHexaDec Number
|
||||
hi def link hclValueString String
|
||||
hi def link hclHereDocText String
|
||||
hi def link hclFunction Function
|
||||
hi def link hclRepeat Repeat
|
||||
hi def link hclConditional Conditional
|
||||
hi def link hclValueNull Constant
|
||||
|
||||
let b:current_syntax = 'hcl'
|
File diff suppressed because one or more lines are too long
@ -1,7 +1,8 @@
|
||||
" Interactive Data Language syntax file (IDL, too [:-)]
|
||||
" Maintainer: Aleksandar Jelenak <ajelenak AT yahoo.com>
|
||||
" Last change: 2011 Apr 11
|
||||
" Created by: Hermann Rochholz <Hermann.Rochholz AT gmx.de>
|
||||
" Created By: Hermann Rochholz <Hermann.Rochholz AT gmx.de>
|
||||
" Last Change: 2011 Apr 11
|
||||
" 2024 Sep 10 by Vim Project: update syntax script, #15419
|
||||
|
||||
" Remove any old syntax stuff hanging around
|
||||
" quit when a syntax file was already loaded
|
||||
@ -16,7 +17,7 @@ syn match idlangStatement "^\s*function\s"
|
||||
syn keyword idlangStatement return continue mod do break
|
||||
syn keyword idlangStatement compile_opt forward_function goto
|
||||
syn keyword idlangStatement begin common end of
|
||||
syn keyword idlangStatement inherits on_ioerror begin
|
||||
syn keyword idlangStatement inherits on_error on_ioerror begin
|
||||
|
||||
syn keyword idlangConditional if else then for while case switch
|
||||
syn keyword idlangConditional endcase endelse endfor endswitch
|
||||
@ -82,7 +83,7 @@ syn keyword idlangRoutine CALL_EXTERNAL CALL_FUNCTION CALL_METHOD
|
||||
syn keyword idlangRoutine CALL_PROCEDURE CATCH CD CEIL CHEBYSHEV CHECK_MATH
|
||||
syn keyword idlangRoutine CHISQR_CVF CHISQR_PDF CHOLDC CHOLSOL CINDGEN
|
||||
syn keyword idlangRoutine CIR_3PNT CLOSE CLUST_WTS CLUSTER COLOR_CONVERT
|
||||
syn keyword idlangRoutine COLOR_QUAN COLORMAP_APPLICABLE COMFIT COMMON
|
||||
syn keyword idlangRoutine COLOR_QUAN COLORMAP_APPLICABLE COMFIT
|
||||
syn keyword idlangRoutine COMPLEX COMPLEXARR COMPLEXROUND
|
||||
syn keyword idlangRoutine COMPUTE_MESH_NORMALS COND CONGRID CONJ
|
||||
syn keyword idlangRoutine CONSTRAINED_MIN CONTOUR CONVERT_COORD CONVOL
|
||||
@ -98,7 +99,7 @@ syn keyword idlangRoutine CW_PALETTE_EDITOR_GET CW_PALETTE_EDITOR_SET
|
||||
syn keyword idlangRoutine CW_PDMENU CW_RGBSLIDER CW_TMPL CW_ZOOM DBLARR
|
||||
syn keyword idlangRoutine DCINDGEN DCOMPLEX DCOMPLEXARR DEFINE_KEY DEFROI
|
||||
syn keyword idlangRoutine DEFSYSV DELETE_SYMBOL DELLOG DELVAR DERIV DERIVSIG
|
||||
syn keyword idlangRoutine DETERM DEVICE DFPMIN DIALOG_MESSAGE
|
||||
syn keyword idlangRoutine DETERM DEVICE DFPMIN DIAG_MATRIX DIALOG_MESSAGE
|
||||
syn keyword idlangRoutine DIALOG_PICKFILE DIALOG_PRINTERSETUP
|
||||
syn keyword idlangRoutine DIALOG_PRINTJOB DIALOG_READ_IMAGE
|
||||
syn keyword idlangRoutine DIALOG_WRITE_IMAGE DIGITAL_FILTER DILATE DINDGEN
|
||||
@ -155,7 +156,7 @@ syn keyword idlangRoutine MPEG_PUT MPEG_SAVE MSG_CAT_CLOSE MSG_CAT_COMPILE
|
||||
syn keyword idlangRoutine MSG_CAT_OPEN MULTI N_ELEMENTS N_PARAMS N_TAGS
|
||||
syn keyword idlangRoutine NEWTON NORM OBJ_CLASS OBJ_DESTROY OBJ_ISA OBJ_NEW
|
||||
syn keyword idlangRoutine OBJ_VALID OBJARR ON_ERROR ON_IOERROR ONLINE_HELP
|
||||
syn keyword idlangRoutine OPEN OPENR OPENW OPLOT OPLOTERR P_CORRELATE
|
||||
syn keyword idlangRoutine OPEN OPENR OPENW OPENU OPLOT OPLOTERR P_CORRELATE
|
||||
syn keyword idlangRoutine PARTICLE_TRACE PCOMP PLOT PLOT_3DBOX PLOT_FIELD
|
||||
syn keyword idlangRoutine PLOTERR PLOTS PNT_LINE POINT_LUN POLAR_CONTOUR
|
||||
syn keyword idlangRoutine POLAR_SURFACE POLY POLY_2D POLY_AREA POLY_FIT
|
||||
|
@ -3,7 +3,7 @@
|
||||
" Maintainer: Aliaksei Budavei <0x000c70 AT gmail DOT com>
|
||||
" Former Maintainer: Claudio Fleiner <claudio@fleiner.com>
|
||||
" Repository: https://github.com/zzzyxwvut/java-vim.git
|
||||
" Last Change: 2024 Aug 26
|
||||
" Last Change: 2024 Sep 10
|
||||
|
||||
" Please check :help java.vim for comments on some of the options available.
|
||||
|
||||
@ -157,13 +157,20 @@ endif
|
||||
" testing in a project without attendant confusion for IDEs, with the
|
||||
" ".java\=" extension used for a production version and an arbitrary
|
||||
" extension used for a testing version.
|
||||
if fnamemodify(bufname("%"), ":t") =~ '^module-info\%(\.class\>\)\@!'
|
||||
if fnamemodify(bufname("%"), ":t") =~ '^module-info\>\%(\.class\>\)\@!'
|
||||
syn keyword javaModuleStorageClass module transitive
|
||||
syn keyword javaModuleStmt open requires exports opens uses provides
|
||||
syn keyword javaModuleExternal to with
|
||||
hi def link javaModuleStorageClass StorageClass
|
||||
hi def link javaModuleStmt Statement
|
||||
hi def link javaModuleExternal Include
|
||||
|
||||
if !exists("g:java_ignore_javadoc") && g:main_syntax != 'jsp'
|
||||
syn match javaDocProvidesTag contained "@provides\_s\+\S\+" contains=javaDocParam
|
||||
syn match javaDocUsesTag contained "@uses\_s\+\S\+" contains=javaDocParam
|
||||
hi def link javaDocProvidesTag Special
|
||||
hi def link javaDocUsesTag Special
|
||||
endif
|
||||
endif
|
||||
|
||||
" Fancy parameterised types (JLS-17, §4.5).
|
||||
@ -335,29 +342,99 @@ if !exists("g:java_ignore_javadoc") && g:main_syntax != 'jsp'
|
||||
call s:ReportOnce(v:exception)
|
||||
endtry
|
||||
|
||||
syn region javaDocComment start="/\*\*" end="\*/" keepend contains=javaCommentTitle,@javaHtml,javaDocTags,javaDocSeeTag,javaDocCodeTag,javaDocSnippetTag,javaTodo,javaCommentError,javaSpaceError,@Spell fold
|
||||
exec 'syn region javaCommentTitle contained matchgroup=javaDocComment start="/\*\*" matchgroup=javaCommentTitle end="\.$" end="\.[ \t\r]\@=" end="\%(^\s*\**\s*\)\@' . s:ff.Peek('80', '') . '<=@"me=s-2,he=s-1 end="\*/"me=s-1,he=s-1 contains=@javaHtml,javaCommentStar,javaTodo,javaCommentError,javaSpaceError,@Spell,javaDocTags,javaDocSeeTag,javaDocCodeTag,javaDocSnippetTag'
|
||||
syn region javaCommentTitle contained matchgroup=javaDocComment start="/\*\*\s*\r\=\n\=\s*\**\s*\%({@return\>\)\@=" matchgroup=javaCommentTitle end="}\%(\s*\.*\)*" contains=@javaHtml,javaCommentStar,javaTodo,javaCommentError,javaSpaceError,@Spell,javaDocTags,javaDocSeeTag,javaDocCodeTag,javaDocSnippetTag
|
||||
syn region javaDocTags contained start="{@\%(li\%(teral\|nk\%(plain\)\=\)\|inherit[Dd]oc\|doc[rR]oot\|value\)\>" end="}"
|
||||
syn match javaDocTags contained "@\%(param\|exception\|throws\|since\)\s\+\S\+" contains=javaDocParam
|
||||
syn match javaDocParam contained "\s\S\+"
|
||||
syn match javaDocTags contained "@\%(version\|author\|return\|deprecated\|serial\%(Field\|Data\)\=\)\>"
|
||||
syn region javaDocSeeTag contained matchgroup=javaDocTags start="@see\s\+" matchgroup=NONE end="\_."re=e-1 contains=javaDocSeeTagParam
|
||||
syn match javaDocSeeTagParam contained @"\_[^"]\+"\|<a\s\+\_.\{-}</a>\|\%(\k\|\.\)*\%(#\k\+\%((\_[^)]*)\)\=\)\=@ contains=@javaHtml extend
|
||||
syn region javaDocComment start="/\*\*" end="\*/" keepend contains=javaCommentTitle,@javaHtml,@javaDocTags,javaTodo,javaCommentError,javaSpaceError,@Spell fold
|
||||
exec 'syn region javaCommentTitle contained matchgroup=javaDocComment start="/\*\*" matchgroup=javaCommentTitle end="\.$" end="\.[ \t\r]\@=" end="\%(^\s*\**\s*\)\@' . s:ff.Peek('80', '') . '<=@"me=s-2,he=s-1 end="\*/"me=s-1,he=s-1 contains=@javaHtml,javaCommentStar,javaTodo,javaCommentError,javaSpaceError,@Spell,@javaDocTags'
|
||||
syn region javaCommentTitle contained matchgroup=javaDocComment start="/\*\*\s*\r\=\n\=\s*\**\s*\%({@return\>\)\@=" matchgroup=javaCommentTitle end="}\%(\s*\.*\)*" contains=@javaHtml,javaCommentStar,javaTodo,javaCommentError,javaSpaceError,@Spell,@javaDocTags,javaTitleSkipBlock
|
||||
syn region javaCommentTitle contained matchgroup=javaDocComment start="/\*\*\s*\r\=\n\=\s*\**\s*\%({@summary\>\)\@=" matchgroup=javaCommentTitle end="}" contains=@javaHtml,javaCommentStar,javaTodo,javaCommentError,javaSpaceError,@Spell,@javaDocTags,javaTitleSkipBlock
|
||||
" The members of javaDocTags are sub-grouped according to the Java
|
||||
" version of their introduction, and sub-group members in turn are
|
||||
" arranged in alphabetical order, so that future newer members can
|
||||
" be pre-sorted and appended without disturbing the current member
|
||||
" placement.
|
||||
" Since they only have significance in javaCommentTitle, neither
|
||||
" javaDocSummaryTag nor javaDocReturnTitleTag are defined.
|
||||
syn cluster javaDocTags contains=javaDocAuthorTag,javaDocDeprecatedTag,javaDocExceptionTag,javaDocParamTag,javaDocReturnTag,javaDocSeeTag,javaDocVersionTag,javaDocSinceTag,javaDocLinkTag,javaDocSerialTag,javaDocSerialDataTag,javaDocSerialFieldTag,javaDocThrowsTag,javaDocDocRootTag,javaDocInheritDocTag,javaDocLinkplainTag,javaDocValueTag,javaDocCodeTag,javaDocLiteralTag,javaDocHiddenTag,javaDocIndexTag,javaDocProvidesTag,javaDocUsesTag,javaDocSystemPropertyTag,javaDocSnippetTag,javaDocSpecTag
|
||||
|
||||
" Anticipate non-standard inline tags in {@return} and {@summary}.
|
||||
syn region javaTitleSkipBlock contained transparent start="{\%(@\%(return\|summary\)\>\)\@!" end="}"
|
||||
syn match javaDocDocRootTag contained "{@docRoot}"
|
||||
syn match javaDocInheritDocTag contained "{@inheritDoc}"
|
||||
syn region javaIndexSkipBlock contained transparent start="{\%(@index\>\)\@!" end="}" contains=javaIndexSkipBlock,javaDocIndexTag
|
||||
syn region javaDocIndexTag contained start="{@index\>" end="}" contains=javaDocIndexTag,javaIndexSkipBlock
|
||||
syn region javaLinkSkipBlock contained transparent start="{\%(@link\>\)\@!" end="}" contains=javaLinkSkipBlock,javaDocLinkTag
|
||||
syn region javaDocLinkTag contained start="{@link\>" end="}" contains=javaDocLinkTag,javaLinkSkipBlock
|
||||
syn region javaLinkplainSkipBlock contained transparent start="{\%(@linkplain\>\)\@!" end="}" contains=javaLinkplainSkipBlock,javaDocLinkplainTag
|
||||
syn region javaDocLinkplainTag contained start="{@linkplain\>" end="}" contains=javaDocLinkplainTag,javaLinkplainSkipBlock
|
||||
syn region javaLiteralSkipBlock contained transparent start="{\%(@literal\>\)\@!" end="}" contains=javaLiteralSkipBlock,javaDocLiteralTag
|
||||
syn region javaDocLiteralTag contained start="{@literal\>" end="}" contains=javaDocLiteralTag,javaLiteralSkipBlock
|
||||
syn region javaSystemPropertySkipBlock contained transparent start="{\%(@systemProperty\>\)\@!" end="}" contains=javaSystemPropertySkipBlock,javaDocSystemPropertyTag
|
||||
syn region javaDocSystemPropertyTag contained start="{@systemProperty\>" end="}" contains=javaDocSystemPropertyTag,javaSystemPropertySkipBlock
|
||||
syn region javaValueSkipBlock contained transparent start="{\%(@value\>\)\@!" end="}" contains=javaValueSkipBlock,javaDocValueTag
|
||||
syn region javaDocValueTag contained start="{@value\>" end="}" contains=javaDocValueTag,javaValueSkipBlock
|
||||
|
||||
syn match javaDocParam contained "\s\zs\S\+"
|
||||
syn match javaDocExceptionTag contained "@exception\s\+\S\+" contains=javaDocParam
|
||||
syn match javaDocParamTag contained "@param\s\+\S\+" contains=javaDocParam
|
||||
syn match javaDocSinceTag contained "@since\s\+\S\+" contains=javaDocParam
|
||||
syn match javaDocThrowsTag contained "@throws\s\+\S\+" contains=javaDocParam
|
||||
syn match javaDocSpecTag contained "@spec\_s\+\S\+\ze\_s\+\S\+" contains=javaDocParam
|
||||
|
||||
syn match javaDocAuthorTag contained "@author\>"
|
||||
syn match javaDocDeprecatedTag contained "@deprecated\>"
|
||||
syn match javaDocHiddenTag contained "@hidden\>"
|
||||
syn match javaDocReturnTag contained "@return\>"
|
||||
syn match javaDocSerialTag contained "@serial\>"
|
||||
syn match javaDocSerialDataTag contained "@serialData\>"
|
||||
syn match javaDocSerialFieldTag contained "@serialField\>"
|
||||
syn match javaDocVersionTag contained "@version\>"
|
||||
|
||||
syn match javaDocSeeTag contained "@see\>" nextgroup=javaDocSeeTag1,javaDocSeeTag2,javaDocSeeTag3,javaDocSeeTagStar skipwhite skipempty
|
||||
syn match javaDocSeeTagStar contained "^\s*\*\+\%(\s*{\=@\|/\|$\)\@!" nextgroup=javaDocSeeTag1,javaDocSeeTag2,javaDocSeeTag3 skipwhite skipempty
|
||||
syn match javaDocSeeTag1 contained @"\_[^"]\+"@
|
||||
syn match javaDocSeeTag2 contained @<a\s\+\_.\{-}</a>@ contains=@javaHtml extend
|
||||
syn match javaDocSeeTag3 contained @["< \t]\@!\%(\k\|[/.]\)*\%(##\=\k\+\%((\_[^)]*)\)\=\)\=@ nextgroup=javaDocSeeTag3Label skipwhite skipempty
|
||||
syn match javaDocSeeTag3Label contained @\k\%(\k\+\s*\)*$@
|
||||
|
||||
syn region javaCodeSkipBlock contained transparent start="{\%(@code\>\)\@!" end="}" contains=javaCodeSkipBlock,javaDocCodeTag
|
||||
syn region javaDocCodeTag contained start="{@code\>" end="}" contains=javaDocCodeTag,javaCodeSkipBlock
|
||||
|
||||
exec 'syn region javaDocSnippetTagAttr contained transparent matchgroup=javaHtmlArg start=/\<\%(class\|file\|id\|lang\|region\)\%(\s*=\)\@=/ matchgroup=javaHtmlString end=/:$/ end=/\%(=\s*\)\@' . s:ff.Peek('80', '') . '<=\%("[^"]\+"\|' . "\x27[^\x27]\\+\x27" . '\|\%([.\\/-]\|\k\)\+\)/ nextgroup=javaDocSnippetTagAttr skipwhite skipnl'
|
||||
syn region javaSnippetSkipBlock contained transparent start="{\%(@snippet\>\)\@!" end="}" contains=javaSnippetSkipBlock,javaDocSnippetTag,javaCommentMarkupTag
|
||||
syn region javaDocSnippetTag contained start="{@snippet\>" end="}" contains=javaDocSnippetTag,javaSnippetSkipBlock,javaDocSnippetTagAttr,javaCommentMarkupTag
|
||||
|
||||
syntax case match
|
||||
hi def link javaDocComment Comment
|
||||
hi def link javaDocSeeTagStar javaDocComment
|
||||
hi def link javaCommentTitle SpecialComment
|
||||
hi def link javaDocTags Special
|
||||
hi def link javaDocCodeTag Special
|
||||
hi def link javaDocSnippetTag Special
|
||||
hi def link javaDocSeeTagParam Function
|
||||
hi def link javaDocParam Function
|
||||
|
||||
hi def link javaDocAuthorTag Special
|
||||
hi def link javaDocCodeTag Special
|
||||
hi def link javaDocDeprecatedTag Special
|
||||
hi def link javaDocDocRootTag Special
|
||||
hi def link javaDocExceptionTag Special
|
||||
hi def link javaDocHiddenTag Special
|
||||
hi def link javaDocIndexTag Special
|
||||
hi def link javaDocInheritDocTag Special
|
||||
hi def link javaDocLinkTag Special
|
||||
hi def link javaDocLinkplainTag Special
|
||||
hi def link javaDocLiteralTag Special
|
||||
hi def link javaDocParamTag Special
|
||||
hi def link javaDocReturnTag Special
|
||||
hi def link javaDocSeeTag Special
|
||||
hi def link javaDocSeeTag1 String
|
||||
hi def link javaDocSeeTag2 Special
|
||||
hi def link javaDocSeeTag3 Function
|
||||
hi def link javaDocSerialTag Special
|
||||
hi def link javaDocSerialDataTag Special
|
||||
hi def link javaDocSerialFieldTag Special
|
||||
hi def link javaDocSinceTag Special
|
||||
hi def link javaDocSnippetTag Special
|
||||
hi def link javaDocSpecTag Special
|
||||
hi def link javaDocSystemPropertyTag Special
|
||||
hi def link javaDocThrowsTag Special
|
||||
hi def link javaDocValueTag Special
|
||||
hi def link javaDocVersionTag Special
|
||||
endif
|
||||
|
||||
" match the special comment /**/
|
||||
|
@ -4,6 +4,7 @@
|
||||
" Maintainer: Igor Gnatenko i.gnatenko.brain@gmail.com
|
||||
" Former Maintainer: Donovan Rebbechi elflord@panix.com (until March 2014)
|
||||
" Last Change: 2020 May 25
|
||||
" 2024 Sep 10 by Vim Project: add file triggers support, #15569
|
||||
|
||||
" quit when a syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
@ -111,7 +112,7 @@ syn region specDescriptionArea matchgroup=specSection start='^%description' end=
|
||||
syn region specPackageArea matchgroup=specSection start='^%package' end='^%'me=e-1 contains=specPackageOpts,specPreAmble,specComment
|
||||
|
||||
"%% Scripts Section %%
|
||||
syn region specScriptArea matchgroup=specSection start='^%\(prep\|generate_buildrequires\|conf\|build\|install\|clean\|check\|pre\|postun\|preun\|post\|posttrans\)\>' skip='^%{\|^%\(define\|patch\d*\|configure\|GNUconfigure\|setup\|autosetup\|autopatch\|find_lang\|make_build\|makeinstall\|make_install\)\>' end='^%'me=e-1 contains=specSpecialVariables,specVariables,@specCommands,specVariables,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,shComment,shIf,specSpecialChar,specMacroIdentifier,specSectionMacroArea,specSectionMacroBracketArea,shOperator,shQuote1,shQuote2
|
||||
syn region specScriptArea matchgroup=specSection start='^%\(prep\|generate_buildrequires\|conf\|build\|install\|clean\|check\|pre\|postun\|preun\|post\|posttrans\|filetriggerin\|filetriggerun\|filetriggerpostun\|transfiletriggerin\|transfiletriggerun\|transfiletriggerpostun\)\>' skip='^%{\|^%\(define\|patch\d*\|configure\|GNUconfigure\|setup\|autosetup\|autopatch\|find_lang\|make_build\|makeinstall\|make_install\)\>' end='^%'me=e-1 contains=specSpecialVariables,specVariables,@specCommands,specVariables,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,shComment,shIf,specSpecialChar,specMacroIdentifier,specSectionMacroArea,specSectionMacroBracketArea,shOperator,shQuote1,shQuote2
|
||||
|
||||
"%% Changelog Section %%
|
||||
syn region specChangelogArea matchgroup=specSection start='^%changelog' end='^%'me=e-1 contains=specEmail,specURL,specWeekday,specMonth,specNumber,specComment,specLicense
|
||||
|
@ -2,9 +2,10 @@
|
||||
" Language: sudoers(5) configuration files
|
||||
" Maintainer: Eisuke Kawashima ( e.kawaschima+vim AT gmail.com )
|
||||
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Latest Revision: 2021 Mar 15
|
||||
" Latest Revision: 2024 Sep 02
|
||||
" Recent Changes: Support for #include and #includedir.
|
||||
" Added many new options (Samuel D. Leslie)
|
||||
" Update allowed Tag_Spec Runas_Spec syntax items
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
@ -22,7 +23,7 @@ syn match sudoersUserSpec '^' nextgroup=@sudoersUserInSpec skipwhite
|
||||
|
||||
syn match sudoersSpecEquals contained '=' nextgroup=@sudoersCmndSpecList skipwhite
|
||||
|
||||
syn cluster sudoersCmndSpecList contains=sudoersUserRunasBegin,sudoersPASSWD,@sudoersCmndInSpec
|
||||
syn cluster sudoersCmndSpecList contains=sudoersUserRunasBegin,sudoersTagSpec,@sudoersCmndInSpec
|
||||
|
||||
syn keyword sudoersTodo contained TODO FIXME XXX NOTE
|
||||
|
||||
@ -92,10 +93,11 @@ syn cluster sudoersUserList contains=sudoersUserListComma,sudoersUserLis
|
||||
syn match sudoersUserSpecComma contained ',' nextgroup=@sudoersUserInSpec skipwhite skipnl
|
||||
syn cluster sudoersUserSpec contains=sudoersUserSpecComma,@sudoersHostInSpec
|
||||
|
||||
syn match sudoersUserRunasBegin contained '(' nextgroup=@sudoersUserInRunas skipwhite skipnl
|
||||
syn match sudoersUserRunasBegin contained '(' nextgroup=@sudoersUserInRunas,sudoersUserRunasColon skipwhite skipnl
|
||||
syn match sudoersUserRunasComma contained ',' nextgroup=@sudoersUserInRunas skipwhite skipnl
|
||||
syn match sudoersUserRunasEnd contained ')' nextgroup=sudoersPASSWD,@sudoersCmndInSpec skipwhite skipnl
|
||||
syn cluster sudoersUserRunas contains=sudoersUserRunasComma,@sudoersUserInRunas,sudoersUserRunasEnd
|
||||
syn match sudoersUserRunasColon contained ':' nextgroup=@sudoersUserInRunas skipwhite skipnl
|
||||
syn match sudoersUserRunasEnd contained ')' nextgroup=sudoersTagSpec,@sudoersCmndInSpec skipwhite skipnl
|
||||
syn cluster sudoersUserRunas contains=sudoersUserRunasComma,sudoersUserRunasColon,@sudoersUserInRunas,sudoersUserRunasEnd
|
||||
|
||||
|
||||
syn match sudoersHostAliasEquals contained '=' nextgroup=@sudoersHostInList skipwhite skipnl
|
||||
@ -291,7 +293,7 @@ syn region sudoersStringValue contained start=+"+ skip=+\\"+ end=+"+ nextgroup
|
||||
syn match sudoersListValue contained '[^[:space:],:=\\]*\%(\\[[:space:],:=\\][^[:space:],:=\\]*\)*' nextgroup=sudoersParameterListComma skipwhite skipnl
|
||||
syn region sudoersListValue contained start=+"+ skip=+\\"+ end=+"+ nextgroup=sudoersParameterListComma skipwhite skipnl
|
||||
|
||||
syn match sudoersPASSWD contained '\%(NO\)\=PASSWD:' nextgroup=@sudoersCmndInSpec skipwhite
|
||||
syn match sudoersTagSpec contained '\%(NO\)\=\%(EXEC\|FOLLOW\|LOG_\%(INPUT\|OUTPUT\)\|MAIL\|INTERCEPT\|PASSWD\|SETENV\):' nextgroup=sudoersTagSpec,@sudoersCmndInSpec skipwhite
|
||||
|
||||
hi def link sudoersSpecEquals Operator
|
||||
hi def link sudoersTodo Todo
|
||||
@ -345,6 +347,7 @@ hi def link sudoersUserListColon Delimiter
|
||||
hi def link sudoersUserSpecComma Delimiter
|
||||
hi def link sudoersUserRunasBegin Delimiter
|
||||
hi def link sudoersUserRunasComma Delimiter
|
||||
hi def link sudoersUserRunasColon Delimiter
|
||||
hi def link sudoersUserRunasEnd Delimiter
|
||||
hi def link sudoersHostAliasEquals Operator
|
||||
hi def link sudoersHostListComma Delimiter
|
||||
@ -381,7 +384,7 @@ hi def link sudoersListParameterEquals Operator
|
||||
hi def link sudoersIntegerValue Number
|
||||
hi def link sudoersStringValue String
|
||||
hi def link sudoersListValue String
|
||||
hi def link sudoersPASSWD Special
|
||||
hi def link sudoersTagSpec Special
|
||||
hi def link sudoersInclude Statement
|
||||
|
||||
let b:current_syntax = "sudoers"
|
||||
|
17
runtime/syntax/terraform.vim
Normal file
17
runtime/syntax/terraform.vim
Normal file
@ -0,0 +1,17 @@
|
||||
" Vim syntax file
|
||||
" Language: Terraform
|
||||
" Maintainer: Gregory Anders
|
||||
" Upstream: https://github.com/hashivim/vim-terraform
|
||||
" Last Change: 2024-09-03
|
||||
|
||||
if exists('b:current_syntax')
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! syntax/hcl.vim
|
||||
|
||||
syn keyword terraType string bool number object tuple list map set any
|
||||
|
||||
hi def link terraType Type
|
||||
|
||||
let b:current_syntax = 'terraform'
|
@ -1,5 +1,5 @@
|
||||
" Language: tmux(1) configuration file
|
||||
" Version: 3.4 (git-171004df)
|
||||
" Version: 3.4 (git-3d8ead8a)
|
||||
" URL: https://github.com/ericpruitt/tmux.vim/
|
||||
" Maintainer: Eric Pruitt <eric.pruitt@gmail.com>
|
||||
" License: 2-Clause BSD (http://opensource.org/licenses/BSD-2-Clause)
|
||||
@ -37,7 +37,7 @@ syn match tmuxInvalidVariableExpansion /\${[^}]*$/ display
|
||||
syn match tmuxInvalidVariableExpansion /\${[^A-Za-z_][^}]*}/ display
|
||||
syn match tmuxInvalidVariableExpansion /\$[^A-Za-z_{ \t]/ display
|
||||
" Contains invalid character.
|
||||
syn match tmuxInvalidVariableExpansion /\${[^}]*[^A-Za-z0-9_][^}]*}/ display
|
||||
syn match tmuxInvalidVariableExpansion /\${[^}]*[^A-Za-z0-9_}][^}]*}/ display
|
||||
|
||||
syn region tmuxComment start=/#/ skip=/\\\@<!\\$/ end=/$/ contains=tmuxTodo,@Spell
|
||||
|
||||
|
@ -177,10 +177,11 @@ syn match vimNumber '\%(^\|\A\)\zs#\x\{6}' skipwhite nextgroup=vimGlobal,vimSub
|
||||
syn case match
|
||||
|
||||
" All vimCommands are contained by vimIsCommand. {{{2
|
||||
syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimCall,vimCatch,vimConst,vimDef,@vimEcho,vimEnddef,vimEndfunction,vimExecute,vimIsCommand,vimExtCmd,vimFor,vimFunction,vimGlobal,vimHighlight,vimLet,vimLoadkeymap,vimMap,vimMark,vimMatch,vimNotFunc,vimNorm,vimSet,vimSleep,vimSyntax,vimThrow,vimUnlet,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate,@vim9CmdList
|
||||
syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimCall,vimCatch,vimConst,vimDef,vimDelcommand,@vimEcho,vimEnddef,vimEndfunction,vimExecute,vimIsCommand,vimExtCmd,vimFor,vimFunction,vimGlobal,vimHighlight,vimLet,vimLoadkeymap,vimMap,vimMark,vimMatch,vimNotFunc,vimNorm,vimSet,vimSleep,vimSyntax,vimThrow,vimUnlet,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate,@vim9CmdList
|
||||
syn cluster vim9CmdList contains=vim9Const,vim9Final,vim9For,vim9Var
|
||||
syn match vimCmdSep "[:|]\+" skipwhite nextgroup=@vimCmdList,vimSubst1
|
||||
syn match vimIsCommand "\<\%(\h\w*\|[23]mat\%[ch]\)\>" contains=vimCommand
|
||||
syn match vimBang contained "!"
|
||||
syn match vimVar contained "\<\h[a-zA-Z0-9#_]*\>"
|
||||
syn match vimVar "\<[bwglstav]:\h[a-zA-Z0-9#_]*\>"
|
||||
syn match vimVar "\s\zs&\%([lg]:\)\=\a\+\>"
|
||||
@ -353,33 +354,46 @@ syn match vimSpecFileMod "\(:[phtre]\)\+" contained
|
||||
" User-Specified Commands: {{{2
|
||||
" =======================
|
||||
syn cluster vimUserCmdList contains=@vimCmdList,vimCmplxRepeat,@vimComment,vimCtrlChar,vimEscapeBrace,vimFunc,vimNotation,vimNumber,vimOper,vimRegister,vimSpecFile,vimString,vimSubst,vimSubstRep,vimSubstRange
|
||||
syn keyword vimUserCommand contained com[mand]
|
||||
syn match vimUserCmdName contained "\<\u\w*\>" nextgroup=vimUserCmdBlock skipwhite
|
||||
syn match vimUserCmd "\<com\%[mand]!\=\>.*$" contains=vimUserAttrb,vimUserAttrbError,vimUserCommand,@vimUserCmdList,vimComFilter,vimCmdBlock,vimUserCmdName
|
||||
syn match vimUserAttrbError contained "-\a\+\ze\s"
|
||||
syn match vimUserAttrb contained "-nargs=[01*?+]" contains=vimUserAttrbKey,vimOper
|
||||
syn match vimUserAttrb contained "-complete=" contains=vimUserAttrbKey,vimOper nextgroup=vimUserAttrbCmplt,vimUserCmdError
|
||||
syn match vimUserAttrb contained "-range\(=%\|=\d\+\)\=" contains=vimNumber,vimOper,vimUserAttrbKey
|
||||
syn match vimUserAttrb contained "-count\(=\d\+\)\=" contains=vimNumber,vimOper,vimUserAttrbKey
|
||||
syn match vimUserAttrb contained "-bang\>" contains=vimOper,vimUserAttrbKey
|
||||
syn match vimUserAttrb contained "-bar\>" contains=vimOper,vimUserAttrbKey
|
||||
syn match vimUserAttrb contained "-buffer\>" contains=vimOper,vimUserAttrbKey
|
||||
syn match vimUserAttrb contained "-register\>" contains=vimOper,vimUserAttrbKey
|
||||
syn keyword vimUserCmdKey contained com[mand]
|
||||
syn match vimUserCmdName contained "\<\u[[:alnum:]]*\>" skipwhite nextgroup=vimUserCmdBlock
|
||||
syn match vimUserCmd "\<com\%[mand]\>!\=.*$" contains=vimUserCmdKey,vimBang,vimUserCmdAttr,vimUserCmdAttrError,vimUserCmdName,@vimUserCmdList,vimComFilter
|
||||
syn match vimUserCmdAttrError contained "-\a\+\ze\%(\s\|=\)"
|
||||
syn match vimUserCmdAttr contained "-addr=" contains=vimUserCmdAttrKey nextgroup=vimUserCmdAttrAddr
|
||||
syn match vimUserCmdAttr contained "-bang\>" contains=vimUserCmdAttrKey
|
||||
syn match vimUserCmdAttr contained "-bar\>" contains=vimUserCmdAttrKey
|
||||
syn match vimUserCmdAttr contained "-buffer\>" contains=vimUserCmdAttrKey
|
||||
syn match vimUserCmdAttr contained "-complete=" contains=vimUserCmdAttrKey nextgroup=vimUserCmdAttrCmplt,vimUserCmdError
|
||||
syn match vimUserCmdAttr contained "-count\>" contains=vimUserCmdAttrKey
|
||||
syn match vimUserCmdAttr contained "-count=" contains=vimUserCmdAttrKey nextgroup=vimNumber
|
||||
syn match vimUserCmdAttr contained "-keepscript\>" contains=vimUserCmdAttrKey
|
||||
syn match vimUserCmdAttr contained "-nargs=" contains=vimUserCmdAttrKey nextgroup=vimUserCmdAttrNargs
|
||||
syn match vimUserCmdAttr contained "-range\>" contains=vimUserCmdAttrKey
|
||||
syn match vimUserCmdAttr contained "-range=" contains=vimUserCmdAttrKey nextgroup=vimNumber,vimUserCmdAttrRange
|
||||
syn match vimUserCmdAttr contained "-register\>" contains=vimUserCmdAttrKey
|
||||
|
||||
syn match vimUserCmdAttrNargs contained "[01*?+]"
|
||||
syn match vimUserCmdAttrRange contained "%"
|
||||
|
||||
if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_nousercmderror")
|
||||
syn match vimUserCmdError contained "\S\+\>"
|
||||
endif
|
||||
syn case ignore
|
||||
syn keyword vimUserAttrbKey contained bar ban[g] cou[nt] ra[nge] com[plete] n[args] re[gister]
|
||||
" GEN_SYN_VIM: vimUserAttrbCmplt, START_STR='syn keyword vimUserAttrbCmplt contained', END_STR=''
|
||||
syn keyword vimUserAttrbCmplt contained arglist augroup behave breakpoint buffer color command compiler cscope diff_buffer dir dir_in_path environment event expression file file_in_path filetype function help highlight history keymap locale mapclear mapping menu messages option packadd runtime scriptnames shellcmd sign syntax syntime tag tag_listfiles user var
|
||||
syn keyword vimUserAttrbCmplt contained custom customlist nextgroup=vimUserAttrbCmpltFunc,vimUserCmdError
|
||||
syn match vimUserAttrbCmpltFunc contained ",\%([sS]:\|<[sS][iI][dD]>\)\=\%(\h\w*\%([.#]\h\w*\)\+\|\h\w*\)"hs=s+1 nextgroup=vimUserCmdError
|
||||
|
||||
syn case ignore
|
||||
syn keyword vimUserCmdAttrKey contained a[ddr] ban[g] bar bu[ffer] com[plete] cou[nt] k[eepscript] n[args] ra[nge] re[gister]
|
||||
" GEN_SYN_VIM: vimUserCmdAttrCmplt, START_STR='syn keyword vimUserCmdAttrCmplt contained', END_STR=''
|
||||
syn keyword vimUserCmdAttrCmplt contained arglist augroup behave breakpoint buffer color command compiler cscope diff_buffer dir dir_in_path environment event expression file file_in_path filetype function help highlight history keymap locale mapclear mapping menu messages option packadd runtime scriptnames shellcmd sign syntax syntime tag tag_listfiles user var
|
||||
syn keyword vimUserCmdAttrCmplt contained custom customlist nextgroup=vimUserCmdAttrCmpltFunc,vimUserCmdError
|
||||
syn match vimUserCmdAttrCmpltFunc contained ",\%([sS]:\|<[sS][iI][dD]>\)\=\%(\h\w*\%([.#]\h\w*\)\+\|\h\w*\)"hs=s+1 nextgroup=vimUserCmdError
|
||||
" GEN_SYN_VIM: vimUserCmdAttrAddr, START_STR='syn keyword vimUserCmdAttrAddr contained', END_STR=''
|
||||
syn keyword vimUserCmdAttrAddr contained arguments arg buffers buf lines line loaded_buffers load other quickfix qf tabs tab windows win
|
||||
syn match vimUserCmdAttrAddr contained "?"
|
||||
syn case match
|
||||
syn match vimUserAttrbCmplt contained "custom,\u\w*"
|
||||
|
||||
syn region vimUserCmdBlock contained matchgroup=vimSep start="{" end="}" contains=@vimDefBodyList
|
||||
|
||||
syn match vimDelcommand "\<delc\%[ommand]\>" skipwhite nextgroup=vimDelcommandAttr
|
||||
syn match vimDelcommandAttr contained "-buffer\>"
|
||||
|
||||
" Lower Priority Comments: after some vim commands... {{{2
|
||||
" =======================
|
||||
if get(g:, "vimsyn_comment_strings", 1)
|
||||
@ -470,8 +484,8 @@ syn match vimString "[^(,]'[^']\{-}\zs'"
|
||||
|
||||
" Marks, Registers, Addresses, Filters: {{{2
|
||||
syn match vimMark "'[a-zA-Z0-9]\ze[-+,!]" nextgroup=vimFilter,vimMarkNumber,vimSubst1
|
||||
syn match vimMark "'[<>]\ze[-+,!]" nextgroup=vimFilter,vimMarkNumber,vimSubst1
|
||||
syn match vimMark ",\zs'[<>]\ze" nextgroup=vimFilter,vimMarkNumber,vimSubst1
|
||||
syn match vimMark "'[[\]{}()<>]\ze[-+,!]" nextgroup=vimFilter,vimMarkNumber,vimSubst1
|
||||
syn match vimMark ",\zs'[[\]{}()<>]\ze" nextgroup=vimFilter,vimMarkNumber,vimSubst1
|
||||
syn match vimMark "[!,:]\zs'[a-zA-Z0-9]" nextgroup=vimFilter,vimMarkNumber,vimSubst1
|
||||
syn match vimMark "\<norm\%[al]\s\zs'[a-zA-Z0-9]" nextgroup=vimFilter,vimMarkNumber,vimSubst1
|
||||
syn match vimMarkNumber "[-+]\d\+" contained contains=vimOper nextgroup=vimSubst1
|
||||
@ -1162,6 +1176,8 @@ if !exists("skip_vim_syntax_inits")
|
||||
hi def link vimDefComment vim9Comment
|
||||
hi def link vimDefKey vimCommand
|
||||
hi def link vimDefParam vimVar
|
||||
hi def link vimDelcommand vimCommand
|
||||
hi def link vimDelcommandAttr vimUserCmdAttr
|
||||
hi def link vimEcho vimCommand
|
||||
hi def link vimEchohlNone vimGroup
|
||||
hi def link vimEchohl vimCommand
|
||||
@ -1319,13 +1335,15 @@ if !exists("skip_vim_syntax_inits")
|
||||
hi def link vimUnlet vimCommand
|
||||
hi def link vimUnletBang vimBang
|
||||
hi def link vimUnmap vimMap
|
||||
hi def link vimUserAttrbCmpltFunc Special
|
||||
hi def link vimUserAttrbCmplt vimSpecial
|
||||
hi def link vimUserAttrbKey vimOption
|
||||
hi def link vimUserAttrb vimSpecial
|
||||
hi def link vimUserAttrbError Error
|
||||
hi def link vimUserCmdAttrAddr vimSpecial
|
||||
hi def link vimUserCmdAttrCmplt vimSpecial
|
||||
hi def link vimUserCmdAttrNargs vimSpecial
|
||||
hi def link vimUserCmdAttrRange vimSpecial
|
||||
hi def link vimUserCmdAttrKey vimUserCmdAttr
|
||||
hi def link vimUserCmdAttr Special
|
||||
hi def link vimUserCmdAttrError Error
|
||||
hi def link vimUserCmdError Error
|
||||
hi def link vimUserCommand vimCommand
|
||||
hi def link vimUserCmdKey vimCommand
|
||||
hi def link vimUserFunc Normal
|
||||
hi def link vimVar Identifier
|
||||
hi def link vimWarn WarningMsg
|
||||
|
@ -81,6 +81,14 @@ local function get_dependency(dependency_name)
|
||||
repo = 'luvit/luv',
|
||||
symbol = 'LUV',
|
||||
},
|
||||
['unibilium'] = {
|
||||
repo = 'neovim/unibilium',
|
||||
symbol = 'UNIBILIUM',
|
||||
},
|
||||
['utf8proc'] = {
|
||||
repo = 'JuliaStrings/utf8proc',
|
||||
symbol = 'UTF8PROC',
|
||||
},
|
||||
['tree-sitter'] = {
|
||||
repo = 'tree-sitter/tree-sitter',
|
||||
symbol = 'TREESITTER',
|
||||
@ -90,11 +98,11 @@ local function get_dependency(dependency_name)
|
||||
symbol = 'TREESITTER_C',
|
||||
},
|
||||
['tree-sitter-lua'] = {
|
||||
repo = 'MunifTanjim/tree-sitter-lua',
|
||||
repo = 'tree-sitter-grammars/tree-sitter-lua',
|
||||
symbol = 'TREESITTER_LUA',
|
||||
},
|
||||
['tree-sitter-vim'] = {
|
||||
repo = 'neovim/tree-sitter-vim',
|
||||
repo = 'tree-sitter-grammars/tree-sitter-vim',
|
||||
symbol = 'TREESITTER_VIM',
|
||||
},
|
||||
['tree-sitter-vimdoc'] = {
|
||||
@ -102,9 +110,21 @@ local function get_dependency(dependency_name)
|
||||
symbol = 'TREESITTER_VIMDOC',
|
||||
},
|
||||
['tree-sitter-query'] = {
|
||||
repo = 'nvim-treesitter/tree-sitter-query',
|
||||
repo = 'tree-sitter-grammars/tree-sitter-query',
|
||||
symbol = 'TREESITTER_QUERY',
|
||||
},
|
||||
['tree-sitter-markdown'] = {
|
||||
repo = 'tree-sitter-grammars/tree-sitter-markdown',
|
||||
symbol = 'TREESITTER_MARKDOWN',
|
||||
},
|
||||
['wasmtime'] = {
|
||||
repo = 'bytecodealliance/wasmtime',
|
||||
symbol = 'WASMTIME',
|
||||
},
|
||||
['uncrustify'] = {
|
||||
repo = 'uncrustify/uncrustify',
|
||||
symbol = 'UNCRUSTIFY',
|
||||
},
|
||||
}
|
||||
local dependency = dependency_table[dependency_name]
|
||||
if dependency == nil then
|
||||
|
@ -786,7 +786,7 @@ local function parse_buf(fname, parser_path)
|
||||
if parser_path then
|
||||
vim.treesitter.language.add('vimdoc', { path = parser_path })
|
||||
end
|
||||
local lang_tree = vim.treesitter.get_parser(buf)
|
||||
local lang_tree = assert(vim.treesitter._get_parser(buf), 'vimdoc parser not found.')
|
||||
return lang_tree, buf
|
||||
end
|
||||
|
||||
|
@ -373,8 +373,8 @@ local config = {
|
||||
section_fmt = function(_name)
|
||||
return 'Checkhealth'
|
||||
end,
|
||||
helptag_fmt = function(name)
|
||||
return name:lower()
|
||||
helptag_fmt = function()
|
||||
return 'vim.health* *health' -- HACK
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
@ -54,8 +54,6 @@ if(ENABLE_WASMTIME)
|
||||
target_compile_definitions(nvim_bin PRIVATE HAVE_WASMTIME)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(main_lib INTERFACE HAVE_UNIBILIUM)
|
||||
|
||||
# The unit test lib requires LuaJIT; it will be skipped if LuaJIT is missing.
|
||||
option(PREFER_LUA "Prefer Lua over LuaJIT in the nvim executable." OFF)
|
||||
if(PREFER_LUA)
|
||||
@ -153,7 +151,7 @@ if(UNIX)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
target_compile_definitions(main_lib INTERFACE _WIN32_WINNT=0x0602 MSWIN)
|
||||
target_compile_definitions(main_lib INTERFACE _WIN32_WINNT=0x0602 MSWIN WIN32_LEAN_AND_MEAN)
|
||||
target_link_libraries(main_lib INTERFACE netapi32)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
target_link_libraries(nvim_bin PRIVATE "-framework CoreServices")
|
||||
@ -301,7 +299,6 @@ set(GENERATOR_DIR ${CMAKE_CURRENT_LIST_DIR}/generators)
|
||||
set(GEN_EVAL_TOUCH ${TOUCHES_DIR}/gen_doc_eval)
|
||||
set(LUAJIT_RUNTIME_DIR ${DEPS_PREFIX}/share/luajit-2.1/jit)
|
||||
set(NVIM_RUNTIME_DIR ${PROJECT_SOURCE_DIR}/runtime)
|
||||
set(UNICODE_DIR ${PROJECT_SOURCE_DIR}/src/unicode)
|
||||
|
||||
# GENERATOR_DIR
|
||||
set(API_DISPATCH_GENERATOR ${GENERATOR_DIR}/gen_api_dispatch.lua)
|
||||
@ -316,7 +313,6 @@ set(GENERATOR_PRELOAD ${GENERATOR_DIR}/preload.lua)
|
||||
set(HEADER_GENERATOR ${GENERATOR_DIR}/gen_declarations.lua)
|
||||
set(OPTIONS_ENUM_GENERATOR ${GENERATOR_DIR}/gen_options_enum.lua)
|
||||
set(OPTIONS_GENERATOR ${GENERATOR_DIR}/gen_options.lua)
|
||||
set(UNICODE_TABLES_GENERATOR ${GENERATOR_DIR}/gen_unicode_tables.lua)
|
||||
|
||||
# GENERATED_DIR and GENERATED_INCLUDES_DIR
|
||||
set(GENERATED_API_DISPATCH ${GENERATED_DIR}/api/private/dispatch_wrappers.generated.h)
|
||||
@ -333,7 +329,6 @@ set(GENERATED_OPTIONS_MAP ${GENERATED_DIR}/options_map.generated.h)
|
||||
set(GENERATED_UI_EVENTS_CALL ${GENERATED_DIR}/ui_events_call.generated.h)
|
||||
set(GENERATED_UI_EVENTS_CLIENT ${GENERATED_DIR}/ui_events_client.generated.h)
|
||||
set(GENERATED_UI_EVENTS_REMOTE ${GENERATED_DIR}/ui_events_remote.generated.h)
|
||||
set(GENERATED_UNICODE_TABLES ${GENERATED_DIR}/unicode_tables.generated.h)
|
||||
set(LUA_API_C_BINDINGS ${GENERATED_DIR}/lua_api_c_bindings.generated.h)
|
||||
set(VIM_MODULE_FILE ${GENERATED_DIR}/lua/vim_module.generated.h)
|
||||
|
||||
@ -350,7 +345,6 @@ set(LUA_LOADER_MODULE_SOURCE ${NVIM_RUNTIME_DIR}/lua/vim/loader.lua)
|
||||
set(LUA_OPTIONS_MODULE_SOURCE ${NVIM_RUNTIME_DIR}/lua/vim/_options.lua)
|
||||
set(LUA_SHARED_MODULE_SOURCE ${NVIM_RUNTIME_DIR}/lua/vim/shared.lua)
|
||||
|
||||
file(GLOB UNICODE_FILES CONFIGURE_DEPENDS ${UNICODE_DIR}/*.txt)
|
||||
file(GLOB API_HEADERS CONFIGURE_DEPENDS api/*.h)
|
||||
list(REMOVE_ITEM API_HEADERS ${CMAKE_CURRENT_LIST_DIR}/api/ui_events.in.h)
|
||||
file(GLOB MSGPACK_RPC_HEADERS CONFIGURE_DEPENDS msgpack_rpc/*.h)
|
||||
@ -370,8 +364,8 @@ file(MAKE_DIRECTORY ${TOUCHES_DIR} ${GENERATED_DIR} ${GENERATED_INCLUDES_DIR})
|
||||
|
||||
file(GLOB NVIM_SOURCES CONFIGURE_DEPENDS *.c)
|
||||
file(GLOB NVIM_HEADERS CONFIGURE_DEPENDS *.h)
|
||||
file(GLOB EXTERNAL_SOURCES CONFIGURE_DEPENDS ../xdiff/*.c ../mpack/*.c ../cjson/*.c ../klib/*.c ../termkey/*.c ../vterm/*.c)
|
||||
file(GLOB EXTERNAL_HEADERS CONFIGURE_DEPENDS ../xdiff/*.h ../mpack/*.h ../cjson/*.h ../klib/*.h ../termkey/*.h ../vterm/*.h)
|
||||
file(GLOB EXTERNAL_SOURCES CONFIGURE_DEPENDS ../xdiff/*.c ../mpack/*.c ../cjson/*.c ../klib/*.c ../vterm/*.c)
|
||||
file(GLOB EXTERNAL_HEADERS CONFIGURE_DEPENDS ../xdiff/*.h ../mpack/*.h ../cjson/*.h ../klib/*.h ../vterm/*.h)
|
||||
|
||||
file(GLOB NLUA0_SOURCES CONFIGURE_DEPENDS ../mpack/*.c)
|
||||
|
||||
@ -382,6 +376,15 @@ if(PREFER_LUA)
|
||||
target_compile_definitions(main_lib INTERFACE NVIM_VENDOR_BIT)
|
||||
endif()
|
||||
|
||||
# Inlined external projects, we don't maintain it. #9306
|
||||
if(MSVC)
|
||||
set_source_files_properties(
|
||||
${EXTERNAL_SOURCES} PROPERTIES COMPILE_OPTIONS "-wd4090;-wd4244;-wd4267")
|
||||
else()
|
||||
set_source_files_properties(
|
||||
${EXTERNAL_SOURCES} PROPERTIES COMPILE_OPTIONS "-Wno-conversion;-Wno-missing-noreturn;-Wno-missing-format-attribute;-Wno-double-promotion;-Wno-strict-prototypes;-Wno-misleading-indentation;-Wno-sign-compare;-Wno-implicit-fallthrough;-Wno-missing-prototypes;-Wno-missing-field-initializers")
|
||||
endif()
|
||||
|
||||
list(APPEND NLUA0_SOURCES ${PROJECT_SOURCE_DIR}/src/nlua0.c)
|
||||
|
||||
foreach(subdir
|
||||
@ -390,6 +393,7 @@ foreach(subdir
|
||||
api/private
|
||||
msgpack_rpc
|
||||
tui
|
||||
tui/termkey
|
||||
event
|
||||
eval
|
||||
lua
|
||||
@ -411,49 +415,36 @@ endforeach()
|
||||
list(SORT NVIM_SOURCES)
|
||||
list(SORT NVIM_HEADERS)
|
||||
|
||||
list(APPEND LINT_NVIM_SOURCES ${NVIM_SOURCES} ${NVIM_HEADERS})
|
||||
|
||||
foreach(sfile ${NVIM_SOURCES})
|
||||
get_filename_component(f ${sfile} NAME)
|
||||
if(WIN32 AND ${f} MATCHES "^(pty_process_unix.c)$")
|
||||
list(APPEND to_remove ${sfile})
|
||||
list(REMOVE_ITEM NVIM_SOURCES ${sfile})
|
||||
endif()
|
||||
if(NOT WIN32 AND ${f} MATCHES "^(pty_process_win.c)$")
|
||||
list(APPEND to_remove ${sfile})
|
||||
list(REMOVE_ITEM NVIM_SOURCES ${sfile})
|
||||
endif()
|
||||
if(NOT WIN32 AND ${f} MATCHES "^(pty_conpty_win.c)$")
|
||||
list(APPEND to_remove ${sfile})
|
||||
list(REMOVE_ITEM NVIM_SOURCES ${sfile})
|
||||
endif()
|
||||
if(NOT WIN32 AND ${f} MATCHES "^(os_win_console.c)$")
|
||||
list(APPEND to_remove ${sfile})
|
||||
list(REMOVE_ITEM NVIM_SOURCES ${sfile})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
list(REMOVE_ITEM NVIM_SOURCES ${to_remove})
|
||||
|
||||
foreach(hfile ${NVIM_HEADERS})
|
||||
get_filename_component(f ${hfile} NAME)
|
||||
if(WIN32 AND ${f} MATCHES "^(unix_defs.h)$")
|
||||
list(APPEND to_remove_h ${hfile})
|
||||
list(REMOVE_ITEM NVIM_HEADERS ${hfile})
|
||||
endif()
|
||||
if(WIN32 AND ${f} MATCHES "^(pty_process_unix.h)$")
|
||||
list(APPEND to_remove_h ${hfile})
|
||||
list(REMOVE_ITEM NVIM_HEADERS ${hfile})
|
||||
endif()
|
||||
if(NOT WIN32 AND ${f} MATCHES "^(win_defs.h)$")
|
||||
list(APPEND to_remove_h ${hfile})
|
||||
list(REMOVE_ITEM NVIM_HEADERS ${hfile})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
list(REMOVE_ITEM NVIM_HEADERS ${to_remove_h})
|
||||
|
||||
# xdiff, mpack, lua-cjson, termkey: inlined external project, we don't maintain it. #9306
|
||||
if(MSVC)
|
||||
set_source_files_properties(
|
||||
${EXTERNAL_SOURCES} PROPERTIES COMPILE_OPTIONS "-wd4090;-wd4244;-wd4267")
|
||||
else()
|
||||
set_source_files_properties(
|
||||
${EXTERNAL_SOURCES} PROPERTIES COMPILE_OPTIONS "-Wno-conversion;-Wno-missing-noreturn;-Wno-missing-format-attribute;-Wno-double-promotion;-Wno-strict-prototypes;-Wno-misleading-indentation;-Wno-sign-compare;-Wno-implicit-fallthrough;-Wno-missing-prototypes;-Wno-missing-field-initializers")
|
||||
endif()
|
||||
list(APPEND LINT_NVIM_SOURCES ${NVIM_SOURCES} ${NVIM_HEADERS})
|
||||
|
||||
# Log level (NVIM_LOG_DEBUG in log.h)
|
||||
if(CI_BUILD)
|
||||
@ -587,15 +578,6 @@ foreach(sfile ${NVIM_SOURCES}
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
add_custom_command(OUTPUT ${GENERATED_UNICODE_TABLES}
|
||||
COMMAND ${LUA_PRG} ${UNICODE_TABLES_GENERATOR}
|
||||
${UNICODE_DIR}
|
||||
${GENERATED_UNICODE_TABLES}
|
||||
DEPENDS
|
||||
${UNICODE_TABLES_GENERATOR}
|
||||
${UNICODE_FILES}
|
||||
)
|
||||
|
||||
set(NVIM_VERSION_LUA ${PROJECT_BINARY_DIR}/nvim_version.lua)
|
||||
configure_file(${GENERATOR_DIR}/nvim_version.lua.in ${NVIM_VERSION_LUA})
|
||||
|
||||
@ -687,7 +669,6 @@ list(APPEND NVIM_GENERATED_FOR_SOURCES
|
||||
"${GENERATED_EVENTS_NAMES_MAP}"
|
||||
"${GENERATED_OPTIONS}"
|
||||
"${GENERATED_OPTIONS_MAP}"
|
||||
"${GENERATED_UNICODE_TABLES}"
|
||||
"${VIM_MODULE_FILE}"
|
||||
"${PROJECT_BINARY_DIR}/cmake.config/auto/pathdef.h"
|
||||
)
|
||||
@ -863,7 +844,7 @@ endif()
|
||||
add_glob_target(
|
||||
TARGET lintc-clang-tidy
|
||||
COMMAND ${CLANG_TIDY_PRG}
|
||||
FILES ${NVIM_SOURCES} ${NVIM_HEADERS}
|
||||
FILES ${LINT_NVIM_SOURCES}
|
||||
FLAGS --quiet
|
||||
EXCLUDE ${EXCLUDE_CLANG_TIDY})
|
||||
|
||||
@ -876,7 +857,7 @@ endif()
|
||||
add_glob_target(
|
||||
TARGET clang-analyzer
|
||||
COMMAND ${CLANG_TIDY_PRG}
|
||||
FILES ${NVIM_SOURCES} ${NVIM_HEADERS}
|
||||
FILES ${LINT_NVIM_SOURCES}
|
||||
FLAGS --quiet
|
||||
--checks='
|
||||
-*,
|
||||
@ -919,13 +900,13 @@ add_glob_target(
|
||||
TARGET lintc-uncrustify
|
||||
COMMAND ${UNCRUSTIFY_PRG}
|
||||
FLAGS -c ${UNCRUSTIFY_CONFIG} -q --check
|
||||
FILES ${LINT_NVIM_SOURCES})
|
||||
FILES ${NVIM_SOURCES} ${NVIM_HEADERS})
|
||||
|
||||
add_glob_target(
|
||||
TARGET formatc
|
||||
COMMAND ${UNCRUSTIFY_PRG}
|
||||
FLAGS -c ${UNCRUSTIFY_CONFIG} --replace --no-backup
|
||||
FILES ${LINT_NVIM_SOURCES})
|
||||
FILES ${NVIM_SOURCES} ${NVIM_HEADERS})
|
||||
|
||||
add_dependencies(lintc-uncrustify uncrustify_update_config)
|
||||
add_dependencies(formatc uncrustify_update_config)
|
||||
|
@ -571,7 +571,7 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
|
||||
String c = opts->conceal;
|
||||
if (c.size > 0) {
|
||||
int ch;
|
||||
hl.conceal_char = utfc_ptr2schar_len(c.data, (int)c.size, &ch);
|
||||
hl.conceal_char = utfc_ptr2schar(c.data, &ch);
|
||||
if (!hl.conceal_char || !vim_isprintc(ch)) {
|
||||
api_set_error(err, kErrorTypeValidation, "conceal char has to be printable");
|
||||
goto error;
|
||||
|
@ -528,21 +528,15 @@ String buf_get_text(buf_T *buf, int64_t lnum, int64_t start_col, int64_t end_col
|
||||
start_col = start_col < 0 ? line_length + start_col + 1 : start_col;
|
||||
end_col = end_col < 0 ? line_length + end_col + 1 : end_col;
|
||||
|
||||
if (start_col >= MAXCOL || end_col >= MAXCOL) {
|
||||
api_set_error(err, kErrorTypeValidation, "Column index is too high");
|
||||
return rv;
|
||||
}
|
||||
start_col = MIN(MAX(0, start_col), line_length);
|
||||
end_col = MIN(MAX(0, end_col), line_length);
|
||||
|
||||
if (start_col > end_col) {
|
||||
api_set_error(err, kErrorTypeValidation, "start_col must be less than end_col");
|
||||
api_set_error(err, kErrorTypeValidation, "start_col must be less than or equal to end_col");
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (start_col >= line_length) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
return cstrn_as_string(&bufstr[start_col], (size_t)(end_col - start_col));
|
||||
return cbuf_as_string(bufstr + start_col, (size_t)(end_col - start_col));
|
||||
}
|
||||
|
||||
void api_free_string(String value)
|
||||
|
@ -93,15 +93,15 @@ void remote_ui_free_all_mem(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/// Wait until ui has connected on stdio channel if only_stdio
|
||||
/// is true, otherwise any channel.
|
||||
/// Wait until UI has connected.
|
||||
///
|
||||
/// @param only_stdio UI is expected to connect on stdio.
|
||||
void remote_ui_wait_for_attach(bool only_stdio)
|
||||
{
|
||||
if (only_stdio) {
|
||||
Channel *channel = find_channel(CHAN_STDIO);
|
||||
if (!channel) {
|
||||
// this function should only be called in --embed mode, stdio channel
|
||||
// can be assumed.
|
||||
// `only_stdio` implies --embed mode, thus stdio channel can be assumed.
|
||||
abort();
|
||||
}
|
||||
|
||||
@ -847,7 +847,7 @@ void remote_ui_raw_line(RemoteUI *ui, Integer grid, Integer row, Integer startco
|
||||
char sc_buf[MAX_SCHAR_SIZE];
|
||||
schar_get(sc_buf, chunk[i]);
|
||||
remote_ui_put(ui, sc_buf);
|
||||
if (utf_ambiguous_width(utf_ptr2char(sc_buf))) {
|
||||
if (utf_ambiguous_width(sc_buf)) {
|
||||
ui->client_col = -1; // force cursor update
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "nvim/cursor.h"
|
||||
#include "nvim/decoration.h"
|
||||
#include "nvim/drawscreen.h"
|
||||
#include "nvim/edit.h"
|
||||
#include "nvim/errors.h"
|
||||
#include "nvim/eval.h"
|
||||
#include "nvim/eval/typval.h"
|
||||
|
@ -3338,7 +3338,7 @@ void maketitle(void)
|
||||
|
||||
#define SPACE_FOR_FNAME (sizeof(buf) - 100)
|
||||
#define SPACE_FOR_DIR (sizeof(buf) - 20)
|
||||
#define SPACE_FOR_ARGNR (sizeof(buf) - 10) // At least room for " - NVIM".
|
||||
#define SPACE_FOR_ARGNR (sizeof(buf) - 10) // At least room for " - Nvim".
|
||||
char *buf_p = buf;
|
||||
if (curbuf->b_fname == NULL) {
|
||||
const size_t size = xstrlcpy(buf_p, _("[No Name]"),
|
||||
@ -3412,7 +3412,7 @@ void maketitle(void)
|
||||
|
||||
append_arg_number(curwin, buf_p, (int)(SPACE_FOR_ARGNR - (size_t)(buf_p - buf)));
|
||||
|
||||
xstrlcat(buf_p, " - NVIM", (sizeof(buf) - (size_t)(buf_p - buf)));
|
||||
xstrlcat(buf_p, " - Nvim", (sizeof(buf) - (size_t)(buf_p - buf)));
|
||||
|
||||
if (maxlen > 0) {
|
||||
// Make it shorter by removing a bit in the middle.
|
||||
|
@ -167,6 +167,13 @@ void changed_internal(buf_T *buf)
|
||||
static void changed_lines_invalidate_win(win_T *wp, linenr_T lnum, colnr_T col, linenr_T lnume,
|
||||
linenr_T xtra)
|
||||
{
|
||||
// If lines haven been inserted/deleted and the buffer has virt_lines,
|
||||
// invalidate the line after the changed lines as some virt_lines may
|
||||
// now be drawn above a different line.
|
||||
if (xtra != 0 && buf_meta_total(wp->w_buffer, kMTMetaLines) > 0) {
|
||||
lnume++;
|
||||
}
|
||||
|
||||
// If the changed line is in a range of previously folded lines,
|
||||
// compare with the first line in that range.
|
||||
if (wp->w_cursor.lnum <= lnum) {
|
||||
@ -195,12 +202,7 @@ static void changed_lines_invalidate_win(win_T *wp, linenr_T lnum, colnr_T col,
|
||||
if (wp->w_lines[i].wl_lnum >= lnum) {
|
||||
// Do not change wl_lnum at index zero, it is used to compare with w_topline.
|
||||
// Invalidate it instead.
|
||||
// If lines haven been inserted/deleted and the buffer has virt_lines,
|
||||
// invalidate the line after the changed lines as some virt_lines may
|
||||
// now be drawn above a different line.
|
||||
if (i == 0 || wp->w_lines[i].wl_lnum < lnume
|
||||
|| (xtra != 0 && wp->w_lines[i].wl_lnum == lnume
|
||||
&& buf_meta_total(wp->w_buffer, kMTMetaLines) > 0)) {
|
||||
if (i == 0 || wp->w_lines[i].wl_lnum < lnume) {
|
||||
// line included in change
|
||||
wp->w_lines[i].wl_valid = false;
|
||||
} else if (xtra != 0) {
|
||||
@ -503,6 +505,10 @@ void deleted_lines(linenr_T lnum, linenr_T count)
|
||||
/// be triggered to display the cursor.
|
||||
void deleted_lines_mark(linenr_T lnum, int count)
|
||||
{
|
||||
u_header_T *uhp = u_force_get_undo_header(curbuf);
|
||||
extmark_undo_vec_t *uvp = uhp ? &uhp->uh_extmark : NULL;
|
||||
size_t prev_uvp_size = uvp ? kv_size(*uvp) : 0;
|
||||
|
||||
bool made_empty = (count > 0) && curbuf->b_ml.ml_flags & ML_EMPTY;
|
||||
|
||||
mark_adjust(lnum, (linenr_T)(lnum + count - 1), MAXLNUM, -(linenr_T)count, kExtmarkNOOP);
|
||||
@ -510,6 +516,10 @@ void deleted_lines_mark(linenr_T lnum, int count)
|
||||
extmark_adjust(curbuf, lnum, (linenr_T)(lnum + count - 1), MAXLNUM,
|
||||
-(linenr_T)count + (made_empty ? 1 : 0), kExtmarkUndo);
|
||||
changed_lines(curbuf, lnum, 0, lnum + (linenr_T)count, (linenr_T)(-count), true);
|
||||
|
||||
if (uvp) {
|
||||
extmark_redraw_after_delete(uvp, prev_uvp_size);
|
||||
}
|
||||
}
|
||||
|
||||
/// Marks the area to be redrawn after a change.
|
||||
@ -521,6 +531,13 @@ void deleted_lines_mark(linenr_T lnum, int count)
|
||||
/// @param xtra number of extra lines (negative when deleting)
|
||||
void changed_lines_redraw_buf(buf_T *buf, linenr_T lnum, linenr_T lnume, linenr_T xtra)
|
||||
{
|
||||
// If lines haven been inserted/deleted and the buffer has virt_lines,
|
||||
// mark the line after the changed lines to be redrawn as some virt_lines may
|
||||
// now be drawn above a different line.
|
||||
if (xtra != 0 && buf_meta_total(buf, kMTMetaLines) > 0) {
|
||||
lnume++;
|
||||
}
|
||||
|
||||
if (buf->b_mod_set) {
|
||||
// find the maximum area that must be redisplayed
|
||||
buf->b_mod_top = MIN(buf->b_mod_top, lnum);
|
||||
@ -756,10 +773,8 @@ void ins_char_bytes(char *buf, size_t charlen)
|
||||
// put back when BS is used. The bytes of a multi-byte character are
|
||||
// done the other way around, so that the first byte is popped off
|
||||
// first (it tells the byte length of the character).
|
||||
replace_push(NUL);
|
||||
for (size_t i = 0; i < oldlen; i++) {
|
||||
i += (size_t)replace_push_mb(oldp + col + i) - 1;
|
||||
}
|
||||
replace_push_nul();
|
||||
replace_push(oldp + col, oldlen);
|
||||
}
|
||||
|
||||
char *newp = xmalloc(linelen + newlen - oldlen);
|
||||
@ -896,14 +911,15 @@ int del_bytes(colnr_T count, bool fixpos_arg, bool use_delcombine)
|
||||
// delete the last combining character.
|
||||
if (p_deco && use_delcombine && utfc_ptr2len(oldp + col) >= count) {
|
||||
char *p0 = oldp + col;
|
||||
if (utf_composinglike(p0, p0 + utf_ptr2len(p0))) {
|
||||
GraphemeState state = GRAPHEME_STATE_INIT;
|
||||
if (utf_composinglike(p0, p0 + utf_ptr2len(p0), &state)) {
|
||||
// Find the last composing char, there can be several.
|
||||
int n = col;
|
||||
do {
|
||||
col = n;
|
||||
count = utf_ptr2len(oldp + n);
|
||||
n += count;
|
||||
} while (utf_composinglike(oldp + col, oldp + n));
|
||||
} while (utf_composinglike(oldp + col, oldp + n, &state));
|
||||
fixpos = false;
|
||||
}
|
||||
}
|
||||
@ -1136,12 +1152,10 @@ bool open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
|
||||
// on the line onto the replace stack. We'll push any other characters
|
||||
// that might be replaced at the start of the next line (due to
|
||||
// autoindent etc) a bit later.
|
||||
replace_push(NUL); // Call twice because BS over NL expects it
|
||||
replace_push(NUL);
|
||||
replace_push_nul(); // Call twice because BS over NL expects it
|
||||
replace_push_nul();
|
||||
p = saved_line + curwin->w_cursor.col;
|
||||
while (*p != NUL) {
|
||||
p += replace_push_mb(p);
|
||||
}
|
||||
replace_push(p, strlen(p));
|
||||
saved_line[curwin->w_cursor.col] = NUL;
|
||||
}
|
||||
|
||||
@ -1690,13 +1704,13 @@ bool open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
|
||||
// stack, preceded by a NUL, so they can be put back when a BS is
|
||||
// entered.
|
||||
if (REPLACE_NORMAL(State)) {
|
||||
replace_push(NUL); // end of extra blanks
|
||||
replace_push_nul(); // end of extra blanks
|
||||
}
|
||||
if (curbuf->b_p_ai || (flags & OPENLINE_DELSPACES)) {
|
||||
while ((*p_extra == ' ' || *p_extra == '\t')
|
||||
&& !utf_iscomposing(utf_ptr2char(p_extra + 1))) {
|
||||
&& !utf_iscomposing_first(utf_ptr2char(p_extra + 1))) {
|
||||
if (REPLACE_NORMAL(State)) {
|
||||
replace_push(*p_extra);
|
||||
replace_push(p_extra, 1); // always ascii, len = 1
|
||||
}
|
||||
p_extra++;
|
||||
less_cols_off++;
|
||||
@ -1793,7 +1807,7 @@ bool open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
|
||||
// must be a NUL on the replace stack, for when it is deleted with BS
|
||||
if (REPLACE_NORMAL(State)) {
|
||||
for (colnr_T n = 0; n < curwin->w_cursor.col; n++) {
|
||||
replace_push(NUL);
|
||||
replace_push_nul();
|
||||
}
|
||||
}
|
||||
newcol += curwin->w_cursor.col;
|
||||
@ -1807,7 +1821,7 @@ bool open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
|
||||
// must be a NUL on the replace stack, for when it is deleted with BS.
|
||||
if (REPLACE_NORMAL(State)) {
|
||||
while (lead_len-- > 0) {
|
||||
replace_push(NUL);
|
||||
replace_push_nul();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,6 @@ void decor_redraw(buf_T *buf, int row1, int row2, int col1, DecorInline decor)
|
||||
linenr_T vt_lnum = row1 + 1 + below;
|
||||
redraw_buf_line_later(buf, vt_lnum, true);
|
||||
if (vt->flags & kVTIsLines || vt->pos == kVPosInline) {
|
||||
// changed_lines_redraw_buf(buf, vt_lnum, vt_lnum + 1, 0);
|
||||
colnr_T vt_col = vt->flags & kVTIsLines ? 0 : col1;
|
||||
changed_lines_invalidate_buf(buf, vt_lnum, vt_col, vt_lnum + 1, 0);
|
||||
}
|
||||
|
@ -1865,7 +1865,7 @@ static void printdigraph(const digr_T *dp, result_T *previous)
|
||||
p = buf;
|
||||
|
||||
// add a space to draw a composing char on
|
||||
if (utf_iscomposing(dp->result)) {
|
||||
if (utf_iscomposing_first(dp->result)) {
|
||||
*p++ = ' ';
|
||||
}
|
||||
p += utf_char2bytes(dp->result, p);
|
||||
|
@ -170,28 +170,26 @@ static void margin_columns_win(win_T *wp, int *left_col, int *right_col)
|
||||
// cache previous calculations depending on w_virtcol
|
||||
static int saved_w_virtcol;
|
||||
static win_T *prev_wp;
|
||||
static int prev_width1;
|
||||
static int prev_width2;
|
||||
static int prev_left_col;
|
||||
static int prev_right_col;
|
||||
static int prev_col_off;
|
||||
|
||||
int cur_col_off = win_col_off(wp);
|
||||
int width1;
|
||||
int width2;
|
||||
int width1 = wp->w_width_inner - cur_col_off;
|
||||
int width2 = width1 + win_col_off2(wp);
|
||||
|
||||
if (saved_w_virtcol == wp->w_virtcol && prev_wp == wp
|
||||
&& prev_col_off == cur_col_off) {
|
||||
&& prev_width1 == width1 && prev_width2 == width2) {
|
||||
*right_col = prev_right_col;
|
||||
*left_col = prev_left_col;
|
||||
return;
|
||||
}
|
||||
|
||||
width1 = wp->w_width_inner - cur_col_off;
|
||||
width2 = width1 + win_col_off2(wp);
|
||||
|
||||
*left_col = 0;
|
||||
*right_col = width1;
|
||||
|
||||
if (wp->w_virtcol >= (colnr_T)width1) {
|
||||
if (wp->w_virtcol >= (colnr_T)width1 && width2 > 0) {
|
||||
*right_col = width1 + ((wp->w_virtcol - width1) / width2 + 1) * width2;
|
||||
}
|
||||
if (wp->w_virtcol >= (colnr_T)width1 && width2 > 0) {
|
||||
@ -202,8 +200,9 @@ static void margin_columns_win(win_T *wp, int *left_col, int *right_col)
|
||||
prev_left_col = *left_col;
|
||||
prev_right_col = *right_col;
|
||||
prev_wp = wp;
|
||||
prev_width1 = width1;
|
||||
prev_width2 = width2;
|
||||
saved_w_virtcol = wp->w_virtcol;
|
||||
prev_col_off = cur_col_off;
|
||||
}
|
||||
|
||||
/// Put a single char from an UTF-8 buffer into a line buffer.
|
||||
@ -1826,7 +1825,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
|
||||
|
||||
// If a double-width char doesn't fit display a '>' in the last column.
|
||||
// Don't advance the pointer but put the character at the start of the next line.
|
||||
if (wlv.col >= grid->cols - 1 && utf_char2cells(mb_c) == 2) {
|
||||
if (wlv.col >= grid->cols - 1 && schar_cells(mb_schar) == 2) {
|
||||
mb_c = '>';
|
||||
mb_l = 1;
|
||||
(void)mb_l;
|
||||
@ -1922,7 +1921,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
|
||||
// If a double-width char doesn't fit display a '>' in the
|
||||
// last column; the character is displayed at the start of the
|
||||
// next line.
|
||||
if (wlv.col >= grid->cols - 1 && utf_char2cells(mb_c) == 2) {
|
||||
if (wlv.col >= grid->cols - 1 && schar_cells(mb_schar) == 2) {
|
||||
mb_schar = schar_from_ascii('>');
|
||||
mb_c = '>';
|
||||
mb_l = 1;
|
||||
@ -2393,6 +2392,12 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
|
||||
|| (decor_conceal && decor_state.conceal_char)
|
||||
|| wp->w_p_cole == 1)
|
||||
&& wp->w_p_cole != 3) {
|
||||
if (schar_cells(mb_schar) > 1) {
|
||||
// When the first char to be concealed is double-width,
|
||||
// need to advance one more virtual column.
|
||||
wlv.n_extra++;
|
||||
}
|
||||
|
||||
// First time at this concealed item: display one
|
||||
// character.
|
||||
if (has_match_conc && match_conc) {
|
||||
@ -2410,12 +2415,6 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
|
||||
mb_schar = schar_from_ascii(' ');
|
||||
}
|
||||
|
||||
if (utf_char2cells(mb_c) > 1) {
|
||||
// When the first char to be concealed is double-width,
|
||||
// need to advance one more virtual column.
|
||||
wlv.n_extra++;
|
||||
}
|
||||
|
||||
mb_c = schar_get_first_codepoint(mb_schar);
|
||||
|
||||
prev_syntax_id = syntax_seqnr;
|
||||
@ -2484,7 +2483,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
|
||||
&& mb_schar != NUL) {
|
||||
mb_schar = wp->w_p_lcs_chars.prec;
|
||||
lcs_prec_todo = NUL;
|
||||
if (utf_char2cells(mb_c) > 1) {
|
||||
if (schar_cells(mb_schar) > 1) {
|
||||
// Double-width character being overwritten by the "precedes"
|
||||
// character, need to fill up half the character.
|
||||
wlv.sc_extra = schar_from_ascii(MB_FILLER_CHAR);
|
||||
@ -2725,7 +2724,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
|
||||
|
||||
linebuf_vcol[wlv.off] = wlv.vcol;
|
||||
|
||||
if (utf_char2cells(mb_c) > 1) {
|
||||
if (schar_cells(mb_schar) > 1) {
|
||||
// Need to fill two screen columns.
|
||||
wlv.off++;
|
||||
wlv.col++;
|
||||
@ -2744,7 +2743,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
|
||||
wlv.off++;
|
||||
wlv.col++;
|
||||
} else if (wp->w_p_cole > 0 && is_concealing) {
|
||||
bool concealed_wide = utf_char2cells(mb_c) > 1;
|
||||
bool concealed_wide = schar_cells(mb_schar) > 1;
|
||||
|
||||
wlv.skip_cells--;
|
||||
wlv.vcol_off_co++;
|
||||
|
@ -2453,10 +2453,12 @@ redr_statuscol:
|
||||
recursive = true;
|
||||
curwin->w_valid &= ~VALID_TOPLINE;
|
||||
update_topline(curwin); // may invalidate w_botline again
|
||||
// New redraw either due to updated topline or reset skipcol.
|
||||
if (must_redraw != 0) {
|
||||
// Don't update for changes in buffer again.
|
||||
int mod_set = curbuf->b_mod_set;
|
||||
curbuf->b_mod_set = false;
|
||||
curs_columns(curwin, true);
|
||||
win_update(curwin);
|
||||
must_redraw = 0;
|
||||
curbuf->b_mod_set = mod_set;
|
||||
|
188
src/nvim/edit.c
188
src/nvim/edit.c
@ -136,6 +136,8 @@ static TriState dont_sync_undo = kFalse; // CTRL-G U prevents syncing undo
|
||||
|
||||
static linenr_T o_lnum = 0;
|
||||
|
||||
static kvec_t(char) replace_stack = KV_INITIAL_VALUE;
|
||||
|
||||
static void insert_enter(InsertState *s)
|
||||
{
|
||||
s->did_backspace = true;
|
||||
@ -464,7 +466,8 @@ static int insert_check(VimState *state)
|
||||
&& !curwin->w_p_sms
|
||||
&& !s->did_backspace
|
||||
&& curwin->w_topline == s->old_topline
|
||||
&& curwin->w_topfill == s->old_topfill) {
|
||||
&& curwin->w_topfill == s->old_topfill
|
||||
&& s->count <= 1) {
|
||||
s->mincol = curwin->w_wcol;
|
||||
validate_cursor_col(curwin);
|
||||
|
||||
@ -486,11 +489,15 @@ static int insert_check(VimState *state)
|
||||
}
|
||||
|
||||
// May need to adjust w_topline to show the cursor.
|
||||
update_topline(curwin);
|
||||
if (s->count <= 1) {
|
||||
update_topline(curwin);
|
||||
}
|
||||
|
||||
s->did_backspace = false;
|
||||
|
||||
validate_cursor(curwin); // may set must_redraw
|
||||
if (s->count <= 1) {
|
||||
validate_cursor(curwin); // may set must_redraw
|
||||
}
|
||||
|
||||
// Redraw the display when no characters are waiting.
|
||||
// Also shows mode, ruler and positions cursor.
|
||||
@ -504,7 +511,9 @@ static int insert_check(VimState *state)
|
||||
do_check_cursorbind();
|
||||
}
|
||||
|
||||
update_curswant();
|
||||
if (s->count <= 1) {
|
||||
update_curswant();
|
||||
}
|
||||
s->old_topline = curwin->w_topline;
|
||||
s->old_topfill = curwin->w_topfill;
|
||||
|
||||
@ -1611,9 +1620,8 @@ void undisplay_dollar(void)
|
||||
/// type == INDENT_SET set indent to "amount"
|
||||
///
|
||||
/// @param round if true, round the indent to 'shiftwidth' (only with _INC and _Dec).
|
||||
/// @param replaced replaced character, put on replace stack
|
||||
/// @param call_changed_bytes call changed_bytes()
|
||||
void change_indent(int type, int amount, int round, int replaced, bool call_changed_bytes)
|
||||
void change_indent(int type, int amount, int round, bool call_changed_bytes)
|
||||
{
|
||||
int insstart_less; // reduction for Insstart.col
|
||||
colnr_T orig_col = 0; // init for GCC
|
||||
@ -1760,12 +1768,8 @@ void change_indent(int type, int amount, int round, int replaced, bool call_chan
|
||||
replace_join(0); // remove a NUL from the replace stack
|
||||
start_col--;
|
||||
}
|
||||
while (start_col < (int)curwin->w_cursor.col || replaced) {
|
||||
replace_push(NUL);
|
||||
if (replaced) {
|
||||
replace_push(replaced);
|
||||
replaced = NUL;
|
||||
}
|
||||
while (start_col < (int)curwin->w_cursor.col) {
|
||||
replace_push_nul();
|
||||
start_col++;
|
||||
}
|
||||
}
|
||||
@ -2318,7 +2322,7 @@ int stop_arrow(void)
|
||||
static void stop_insert(pos_T *end_insert_pos, int esc, int nomove)
|
||||
{
|
||||
stop_redo_ins();
|
||||
replace_flush(); // abandon replace stack
|
||||
kv_destroy(replace_stack); // abandon replace stack (reinitializes)
|
||||
|
||||
// Save the inserted text for later redo with ^@ and CTRL-A.
|
||||
// Don't do it when "restart_edit" was set and nothing was inserted,
|
||||
@ -2795,55 +2799,51 @@ static bool echeck_abbr(int c)
|
||||
// that the NL replaced. The extra one stores the characters after the cursor
|
||||
// that were deleted (always white space).
|
||||
|
||||
static uint8_t *replace_stack = NULL;
|
||||
static ssize_t replace_stack_nr = 0; // next entry in replace stack
|
||||
static ssize_t replace_stack_len = 0; // max. number of entries
|
||||
|
||||
/// Push character that is replaced onto the replace stack.
|
||||
///
|
||||
/// replace_offset is normally 0, in which case replace_push will add a new
|
||||
/// character at the end of the stack. If replace_offset is not 0, that many
|
||||
/// characters will be left on the stack above the newly inserted character.
|
||||
///
|
||||
/// @param c character that is replaced (NUL is none)
|
||||
void replace_push(int c)
|
||||
/// @param str character that is replaced (NUL is none)
|
||||
/// @param len length of character in bytes
|
||||
void replace_push(char *str, size_t len)
|
||||
{
|
||||
if (replace_stack_nr < replace_offset) { // nothing to do
|
||||
// TODO(bfredl): replace_offset is suss af, if we don't need it, this
|
||||
// function is just kv_concat() :p
|
||||
if (kv_size(replace_stack) < (size_t)replace_offset) { // nothing to do
|
||||
return;
|
||||
}
|
||||
|
||||
if (replace_stack_len <= replace_stack_nr) {
|
||||
replace_stack_len += 50;
|
||||
replace_stack = xrealloc(replace_stack, (size_t)replace_stack_len);
|
||||
}
|
||||
uint8_t *p = replace_stack + replace_stack_nr - replace_offset;
|
||||
kv_ensure_space(replace_stack, len);
|
||||
|
||||
char *p = replace_stack.items + kv_size(replace_stack) - replace_offset;
|
||||
if (replace_offset) {
|
||||
memmove(p + 1, p, (size_t)replace_offset);
|
||||
memmove(p + len, p, (size_t)replace_offset);
|
||||
}
|
||||
*p = (uint8_t)c;
|
||||
replace_stack_nr++;
|
||||
memcpy(p, str, len);
|
||||
kv_size(replace_stack) += len;
|
||||
}
|
||||
|
||||
/// Push a character onto the replace stack. Handles a multi-byte character in
|
||||
/// reverse byte order, so that the first byte is popped off first.
|
||||
///
|
||||
/// @return the number of bytes done (includes composing characters).
|
||||
int replace_push_mb(char *p)
|
||||
/// push NUL as separator between entries in the stack
|
||||
void replace_push_nul(void)
|
||||
{
|
||||
int l = utfc_ptr2len(p);
|
||||
|
||||
for (int j = l - 1; j >= 0; j--) {
|
||||
replace_push(p[j]);
|
||||
}
|
||||
return l;
|
||||
replace_push("", 1);
|
||||
}
|
||||
|
||||
/// Pop one item from the replace stack.
|
||||
/// Check top of replace stack, pop it if it was NUL
|
||||
///
|
||||
/// @return -1 if stack is empty, replaced character or NUL otherwise
|
||||
static int replace_pop(void)
|
||||
/// when a non-NUL byte is found, use mb_replace_pop_ins() to
|
||||
/// pop one complete multibyte character.
|
||||
///
|
||||
/// @return -1 if stack is empty, last byte of char or NUL otherwise
|
||||
static int replace_pop_if_nul(void)
|
||||
{
|
||||
return (replace_stack_nr == 0) ? -1 : (int)replace_stack[--replace_stack_nr];
|
||||
int ch = (kv_size(replace_stack)) ? (uint8_t)kv_A(replace_stack, kv_size(replace_stack) - 1) : -1;
|
||||
if (ch == NUL) {
|
||||
kv_size(replace_stack)--;
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
|
||||
/// Join the top two items on the replace stack. This removes to "off"'th NUL
|
||||
@ -2852,11 +2852,11 @@ static int replace_pop(void)
|
||||
/// @param off offset for which NUL to remove
|
||||
static void replace_join(int off)
|
||||
{
|
||||
for (ssize_t i = replace_stack_nr; --i >= 0;) {
|
||||
if (replace_stack[i] == NUL && off-- <= 0) {
|
||||
replace_stack_nr--;
|
||||
memmove(replace_stack + i, replace_stack + i + 1,
|
||||
(size_t)(replace_stack_nr - i));
|
||||
for (ssize_t i = (ssize_t)kv_size(replace_stack); --i >= 0;) {
|
||||
if (kv_A(replace_stack, i) == NUL && off-- <= 0) {
|
||||
kv_size(replace_stack)--;
|
||||
memmove(&kv_A(replace_stack, i), &kv_A(replace_stack, i + 1),
|
||||
(kv_size(replace_stack) - (size_t)i));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -2866,70 +2866,25 @@ static void replace_join(int off)
|
||||
/// before the cursor. Can only be used in MODE_REPLACE or MODE_VREPLACE state.
|
||||
static void replace_pop_ins(void)
|
||||
{
|
||||
int cc;
|
||||
int oldState = State;
|
||||
|
||||
State = MODE_NORMAL; // don't want MODE_REPLACE here
|
||||
while ((cc = replace_pop()) > 0) {
|
||||
mb_replace_pop_ins(cc);
|
||||
while ((replace_pop_if_nul()) > 0) {
|
||||
mb_replace_pop_ins();
|
||||
dec_cursor();
|
||||
}
|
||||
State = oldState;
|
||||
}
|
||||
|
||||
// Insert bytes popped from the replace stack. "cc" is the first byte. If it
|
||||
// indicates a multi-byte char, pop the other bytes too.
|
||||
static void mb_replace_pop_ins(int cc)
|
||||
/// Insert multibyte char popped from the replace stack.
|
||||
///
|
||||
/// caller must already have checked the top of the stack is not NUL!!
|
||||
static void mb_replace_pop_ins(void)
|
||||
{
|
||||
int n;
|
||||
uint8_t buf[MB_MAXBYTES + 1];
|
||||
|
||||
if ((n = MB_BYTE2LEN(cc)) > 1) {
|
||||
buf[0] = (uint8_t)cc;
|
||||
for (int i = 1; i < n; i++) {
|
||||
buf[i] = (uint8_t)replace_pop();
|
||||
}
|
||||
ins_bytes_len((char *)buf, (size_t)n);
|
||||
} else {
|
||||
ins_char(cc);
|
||||
}
|
||||
|
||||
// Handle composing chars.
|
||||
while (true) {
|
||||
int c = replace_pop();
|
||||
if (c == -1) { // stack empty
|
||||
break;
|
||||
}
|
||||
if ((n = MB_BYTE2LEN(c)) == 1) {
|
||||
// Not a multi-byte char, put it back.
|
||||
replace_push(c);
|
||||
break;
|
||||
}
|
||||
|
||||
buf[0] = (uint8_t)c;
|
||||
assert(n > 1);
|
||||
for (int i = 1; i < n; i++) {
|
||||
buf[i] = (uint8_t)replace_pop();
|
||||
}
|
||||
if (utf_iscomposing(utf_ptr2char((char *)buf))) {
|
||||
ins_bytes_len((char *)buf, (size_t)n);
|
||||
} else {
|
||||
// Not a composing char, put it back.
|
||||
for (int i = n - 1; i >= 0; i--) {
|
||||
replace_push(buf[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// make the replace stack empty
|
||||
// (called when exiting replace mode)
|
||||
static void replace_flush(void)
|
||||
{
|
||||
XFREE_CLEAR(replace_stack);
|
||||
replace_stack_len = 0;
|
||||
replace_stack_nr = 0;
|
||||
int len = utf_head_off(&kv_A(replace_stack, 0),
|
||||
&kv_A(replace_stack, kv_size(replace_stack) - 1)) + 1;
|
||||
kv_size(replace_stack) -= (size_t)len;
|
||||
ins_bytes_len(&kv_A(replace_stack, kv_size(replace_stack)), (size_t)len);
|
||||
}
|
||||
|
||||
// Handle doing a BS for one character.
|
||||
@ -2944,7 +2899,7 @@ static void replace_do_bs(int limit_col)
|
||||
colnr_T start_vcol;
|
||||
const int l_State = State;
|
||||
|
||||
int cc = replace_pop();
|
||||
int cc = replace_pop_if_nul();
|
||||
if (cc > 0) {
|
||||
int orig_len = 0;
|
||||
int orig_vcols = 0;
|
||||
@ -2958,7 +2913,6 @@ static void replace_do_bs(int limit_col)
|
||||
if (l_State & VREPLACE_FLAG) {
|
||||
orig_len = get_cursor_pos_len();
|
||||
}
|
||||
replace_push(cc);
|
||||
replace_pop_ins();
|
||||
|
||||
if (l_State & VREPLACE_FLAG) {
|
||||
@ -3617,9 +3571,9 @@ static void ins_shift(int c, int lastc)
|
||||
if (lastc == '^') {
|
||||
old_indent = get_indent(); // remember curr. indent
|
||||
}
|
||||
change_indent(INDENT_SET, 0, true, 0, true);
|
||||
change_indent(INDENT_SET, 0, true, true);
|
||||
} else {
|
||||
change_indent(c == Ctrl_D ? INDENT_DEC : INDENT_INC, 0, true, 0, true);
|
||||
change_indent(c == Ctrl_D ? INDENT_DEC : INDENT_INC, 0, true, true);
|
||||
}
|
||||
|
||||
if (did_ai && *skipwhite(get_cursor_line_ptr()) != NUL) {
|
||||
@ -3738,7 +3692,7 @@ static bool ins_bs(int c, int mode, int *inserted_space_p)
|
||||
// cc >= 0: NL was replaced, put original characters back
|
||||
cc = -1;
|
||||
if (State & REPLACE_FLAG) {
|
||||
cc = replace_pop(); // returns -1 if NL was inserted
|
||||
cc = replace_pop_if_nul(); // returns -1 if NL was inserted
|
||||
}
|
||||
// In replace mode, in the line we started replacing, we only move the
|
||||
// cursor.
|
||||
@ -3784,9 +3738,9 @@ static bool ins_bs(int c, int mode, int *inserted_space_p)
|
||||
// restore characters (blanks) deleted after cursor
|
||||
while (cc > 0) {
|
||||
colnr_T save_col = curwin->w_cursor.col;
|
||||
mb_replace_pop_ins(cc);
|
||||
mb_replace_pop_ins();
|
||||
curwin->w_cursor.col = save_col;
|
||||
cc = replace_pop();
|
||||
cc = replace_pop_if_nul();
|
||||
}
|
||||
// restore the characters that NL replaced
|
||||
replace_pop_ins();
|
||||
@ -3843,7 +3797,7 @@ static bool ins_bs(int c, int mode, int *inserted_space_p)
|
||||
space_sci = sci;
|
||||
space_vcol = vcol;
|
||||
}
|
||||
vcol += charsize_nowrap(curbuf, use_ts, vcol, sci.chr.value);
|
||||
vcol += charsize_nowrap(curbuf, sci.ptr, use_ts, vcol, sci.chr.value);
|
||||
sci = utfc_next(sci);
|
||||
prev_space = cur_space;
|
||||
}
|
||||
@ -3859,7 +3813,7 @@ static bool ins_bs(int c, int mode, int *inserted_space_p)
|
||||
// Find the position to stop backspacing.
|
||||
// Use charsize_nowrap() so that virtual text and wrapping are ignored.
|
||||
while (true) {
|
||||
int size = charsize_nowrap(curbuf, use_ts, space_vcol, space_sci.chr.value);
|
||||
int size = charsize_nowrap(curbuf, space_sci.ptr, use_ts, space_vcol, space_sci.chr.value);
|
||||
if (space_vcol + size > want_vcol) {
|
||||
break;
|
||||
}
|
||||
@ -3895,7 +3849,7 @@ static bool ins_bs(int c, int mode, int *inserted_space_p)
|
||||
} else {
|
||||
ins_str(" ");
|
||||
if ((State & REPLACE_FLAG)) {
|
||||
replace_push(NUL);
|
||||
replace_push_nul();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3930,7 +3884,7 @@ static bool ins_bs(int c, int mode, int *inserted_space_p)
|
||||
bool has_composing = false;
|
||||
if (p_deco) {
|
||||
char *p0 = get_cursor_pos_ptr();
|
||||
has_composing = utf_composinglike(p0, p0 + utf_ptr2len(p0));
|
||||
has_composing = utf_composinglike(p0, p0 + utf_ptr2len(p0), NULL);
|
||||
}
|
||||
del_char(false);
|
||||
// If there are combining characters and 'delcombine' is set
|
||||
@ -4305,7 +4259,7 @@ static bool ins_tab(void)
|
||||
} else {
|
||||
ins_str(" ");
|
||||
if (State & REPLACE_FLAG) { // no char replaced
|
||||
replace_push(NUL);
|
||||
replace_push_nul();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4472,7 +4426,7 @@ bool ins_eol(int c)
|
||||
// character under the cursor. Only push a NUL on the replace stack,
|
||||
// nothing to put back when the NL is deleted.
|
||||
if ((State & REPLACE_FLAG) && !(State & VREPLACE_FLAG)) {
|
||||
replace_push(NUL);
|
||||
replace_push_nul();
|
||||
}
|
||||
|
||||
// In MODE_VREPLACE state, a NL replaces the rest of the line, and starts
|
||||
@ -4673,7 +4627,7 @@ static void ins_try_si(int c)
|
||||
i = get_indent();
|
||||
curwin->w_cursor = old_pos;
|
||||
if (State & VREPLACE_FLAG) {
|
||||
change_indent(INDENT_SET, i, false, NUL, true);
|
||||
change_indent(INDENT_SET, i, false, true);
|
||||
} else {
|
||||
set_indent(i, SIN_CHANGED);
|
||||
}
|
||||
|
@ -2066,7 +2066,7 @@ M.funcs = {
|
||||
On MS-Windows the ".exe", ".bat", etc. can optionally be
|
||||
included. Then the extensions in $PATHEXT are tried. Thus if
|
||||
"foo.exe" does not exist, "foo.exe.bat" can be found. If
|
||||
$PATHEXT is not set then ".exe;.com;.bat;.cmd" is used. A dot
|
||||
$PATHEXT is not set then ".com;.exe;.bat;.cmd" is used. A dot
|
||||
by itself can be used in $PATHEXT to try using the name
|
||||
without an extension. When 'shell' looks like a Unix shell,
|
||||
then the name is also tried without adding an extension.
|
||||
@ -3564,7 +3564,7 @@ M.funcs = {
|
||||
]=],
|
||||
name = 'getcharsearch',
|
||||
params = {},
|
||||
returns = 'table[]',
|
||||
returns = 'table',
|
||||
signature = 'getcharsearch()',
|
||||
},
|
||||
getcharstr = {
|
||||
@ -6442,6 +6442,7 @@ M.funcs = {
|
||||
"lhsrawalt" The {lhs} of the mapping as raw bytes, alternate
|
||||
form, only present when it differs from "lhsraw"
|
||||
"rhs" The {rhs} of the mapping as typed.
|
||||
"callback" Lua function, if RHS was defined as such.
|
||||
"silent" 1 for a |:map-silent| mapping, else 0.
|
||||
"noremap" 1 if the {rhs} of the mapping is not remappable.
|
||||
"script" 1 if mapping was defined with <script>.
|
||||
@ -8926,6 +8927,9 @@ M.funcs = {
|
||||
The value must not be negative. A zero value is like not
|
||||
giving the argument.
|
||||
|
||||
Note: the timeout is only considered when searching, not
|
||||
while evaluating the {skip} expression.
|
||||
|
||||
If the {skip} expression is given it is evaluated with the
|
||||
cursor positioned on the start of a match. If it evaluates to
|
||||
non-zero this match is skipped. This can be used, for
|
||||
|
@ -7641,7 +7641,7 @@ static void get_xdg_var_list(const XDGVarType xdg, typval_T *rettv)
|
||||
return;
|
||||
}
|
||||
const void *iter = NULL;
|
||||
const char *appname = get_appname();
|
||||
const char *appname = get_appname(false);
|
||||
do {
|
||||
size_t dir_len;
|
||||
const char *dir;
|
||||
|
@ -16,15 +16,14 @@ struct loop {
|
||||
uv_loop_t uv;
|
||||
MultiQueue *events;
|
||||
MultiQueue *thread_events;
|
||||
// Immediate events:
|
||||
// "Processed after exiting uv_run() (to avoid recursion), but before
|
||||
// returning from loop_poll_events()." 502aee690c98
|
||||
// Practical consequence (for main_loop): these events are processed by
|
||||
// state_enter()..os_inchar()
|
||||
// whereas "regular" events (main_loop.events) are processed by
|
||||
// state_enter()..VimState.execute()
|
||||
// But state_enter()..os_inchar() can be "too early" if you want the event
|
||||
// to trigger UI updates and other user-activity-related side-effects.
|
||||
// Immediate events.
|
||||
// - "Processed after exiting `uv_run()` (to avoid recursion), but before returning from
|
||||
// `loop_poll_events()`." 502aee690c98
|
||||
// - Practical consequence (for `main_loop`):
|
||||
// - these are processed by `state_enter()..input_get()` whereas "regular" events
|
||||
// (`main_loop.events`) are processed by `state_enter()..VimState.execute()`
|
||||
// - `state_enter()..input_get()` can be "too early" if you want the event to trigger UI
|
||||
// updates and other user-activity-related side-effects.
|
||||
MultiQueue *fast_events;
|
||||
|
||||
// used by process/job-control subsystem
|
||||
|
@ -94,14 +94,17 @@ void stream_init(Loop *loop, Stream *stream, int fd, uv_stream_t *uvstream)
|
||||
stream->events = NULL;
|
||||
}
|
||||
|
||||
void stream_close(Stream *stream, stream_close_cb on_stream_close, void *data, bool rstream)
|
||||
void stream_may_close(Stream *stream, bool rstream)
|
||||
FUNC_ATTR_NONNULL_ARG(1)
|
||||
{
|
||||
if (stream->closed) {
|
||||
return;
|
||||
}
|
||||
assert(!stream->closed);
|
||||
DLOG("closing Stream: %p", (void *)stream);
|
||||
stream->closed = true;
|
||||
stream->close_cb = on_stream_close;
|
||||
stream->close_cb_data = data;
|
||||
stream->close_cb = NULL;
|
||||
stream->close_cb_data = NULL;
|
||||
|
||||
#ifdef MSWIN
|
||||
if (UV_TTY == uv_guess_handle(stream->fd)) {
|
||||
@ -115,13 +118,6 @@ void stream_close(Stream *stream, stream_close_cb on_stream_close, void *data, b
|
||||
}
|
||||
}
|
||||
|
||||
void stream_may_close(Stream *stream, bool rstream)
|
||||
{
|
||||
if (!stream->closed) {
|
||||
stream_close(stream, NULL, NULL, rstream);
|
||||
}
|
||||
}
|
||||
|
||||
void stream_close_handle(Stream *stream, bool rstream)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user