aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/CMakeLists.txt38
-rw-r--r--runtime/autoload/modula2.vim31
-rw-r--r--runtime/autoload/netrw.vim132
-rw-r--r--runtime/autoload/netrwFileHandlers.vim3
-rw-r--r--runtime/autoload/netrwSettings.vim3
-rw-r--r--runtime/autoload/provider/perl.vim80
-rw-r--r--runtime/autoload/provider/python3.vim44
-rw-r--r--runtime/autoload/provider/pythonx.vim112
-rw-r--r--runtime/autoload/provider/ruby.vim67
-rw-r--r--runtime/autoload/remote/host.vim6
-rw-r--r--runtime/autoload/rubycomplete.vim7
-rw-r--r--runtime/autoload/tar.vim39
-rw-r--r--runtime/autoload/tohtml.vim951
-rw-r--r--runtime/autoload/userreg.vim7
-rw-r--r--runtime/autoload/zip.vim3
-rw-r--r--runtime/colors/blue.vim25
-rw-r--r--runtime/colors/darkblue.vim17
-rw-r--r--runtime/colors/default.vim15
-rw-r--r--runtime/colors/delek.vim9
-rw-r--r--runtime/colors/desert.vim9
-rw-r--r--runtime/colors/elflord.vim9
-rw-r--r--runtime/colors/evening.vim21
-rw-r--r--runtime/colors/habamax.vim29
-rw-r--r--runtime/colors/industry.vim9
-rw-r--r--runtime/colors/koehler.vim9
-rw-r--r--runtime/colors/lunaperche.vim96
-rw-r--r--runtime/colors/morning.vim9
-rw-r--r--runtime/colors/murphy.vim11
-rw-r--r--runtime/colors/pablo.vim9
-rw-r--r--runtime/colors/peachpuff.vim9
-rw-r--r--runtime/colors/quiet.vim9
-rw-r--r--runtime/colors/retrobox.vim41
-rw-r--r--runtime/colors/ron.vim9
-rw-r--r--runtime/colors/shine.vim9
-rw-r--r--runtime/colors/slate.vim9
-rw-r--r--runtime/colors/sorbet.vim9
-rw-r--r--runtime/colors/torte.vim9
-rw-r--r--runtime/colors/vim.lua285
-rw-r--r--runtime/colors/wildcharm.vim125
-rw-r--r--runtime/colors/zaibatsu.vim9
-rw-r--r--runtime/colors/zellner.vim9
-rw-r--r--runtime/compiler/gm2.vim26
-rw-r--r--runtime/doc/api.txt495
-rw-r--r--runtime/doc/autocmd.txt16
-rw-r--r--runtime/doc/backers.txt656
-rw-r--r--runtime/doc/builtin.txt213
-rw-r--r--runtime/doc/change.txt11
-rw-r--r--runtime/doc/cmdline.txt5
-rw-r--r--runtime/doc/deprecated.txt11
-rw-r--r--runtime/doc/dev_style.txt125
-rw-r--r--runtime/doc/dev_theme.txt121
-rw-r--r--runtime/doc/dev_tools.txt192
-rw-r--r--runtime/doc/dev_vimpatch.txt303
-rw-r--r--runtime/doc/develop.txt45
-rw-r--r--runtime/doc/diagnostic.txt609
-rw-r--r--runtime/doc/editing.txt5
-rw-r--r--runtime/doc/editorconfig.txt2
-rw-r--r--runtime/doc/eval.txt667
-rw-r--r--runtime/doc/faq.txt485
-rw-r--r--runtime/doc/filetype.txt33
-rw-r--r--runtime/doc/ft_ada.txt2
-rw-r--r--runtime/doc/ft_sql.txt2
-rw-r--r--runtime/doc/help.txt5
-rw-r--r--runtime/doc/indent.txt59
-rw-r--r--runtime/doc/index.txt2
-rw-r--r--runtime/doc/insert.txt4
-rw-r--r--runtime/doc/intro.txt3
-rw-r--r--runtime/doc/lsp.txt1322
-rw-r--r--runtime/doc/lua-guide.txt2
-rw-r--r--runtime/doc/lua.txt1859
-rw-r--r--runtime/doc/luaref.txt4
-rw-r--r--runtime/doc/luvref.txt58
-rw-r--r--runtime/doc/map.txt10
-rw-r--r--runtime/doc/message.txt2
-rw-r--r--runtime/doc/motion.txt22
-rw-r--r--runtime/doc/news.txt243
-rw-r--r--runtime/doc/nvim_terminal_emulator.txt27
-rw-r--r--runtime/doc/options.txt685
-rw-r--r--runtime/doc/pi_netrw.txt41
-rw-r--r--runtime/doc/quickfix.txt10
-rw-r--r--runtime/doc/quickref.txt10
-rw-r--r--runtime/doc/recover.txt8
-rw-r--r--runtime/doc/repeat.txt18
-rw-r--r--runtime/doc/syntax.txt773
-rw-r--r--runtime/doc/treesitter.txt726
-rw-r--r--runtime/doc/ui.txt20
-rw-r--r--runtime/doc/usr_41.txt6
-rw-r--r--runtime/doc/vim_diff.txt24
-rw-r--r--runtime/doc/visual.txt14
-rw-r--r--runtime/doc/vvars.txt735
-rw-r--r--runtime/doc/windows.txt7
-rw-r--r--runtime/ftplugin/aap.vim9
-rw-r--r--runtime/ftplugin/abap.vim15
-rw-r--r--runtime/ftplugin/abaqus.vim9
-rw-r--r--runtime/ftplugin/ant.vim15
-rw-r--r--runtime/ftplugin/asciidoc.vim67
-rw-r--r--runtime/ftplugin/aspvbs.vim15
-rw-r--r--runtime/ftplugin/awk.vim14
-rw-r--r--runtime/ftplugin/basic.vim10
-rw-r--r--runtime/ftplugin/c.vim32
-rw-r--r--runtime/ftplugin/clojure.vim9
-rw-r--r--runtime/ftplugin/cobol.vim9
-rw-r--r--runtime/ftplugin/config.vim15
-rw-r--r--runtime/ftplugin/cpp.vim3
-rw-r--r--runtime/ftplugin/cs.vim11
-rw-r--r--runtime/ftplugin/csh.vim10
-rw-r--r--runtime/ftplugin/diff.vim9
-rw-r--r--runtime/ftplugin/dosbatch.vim12
-rw-r--r--runtime/ftplugin/dtd.vim15
-rw-r--r--runtime/ftplugin/eiffel.vim10
-rw-r--r--runtime/ftplugin/elixir.vim10
-rw-r--r--runtime/ftplugin/erlang.vim18
-rw-r--r--runtime/ftplugin/eruby.vim11
-rw-r--r--runtime/ftplugin/expect.vim10
-rw-r--r--runtime/ftplugin/falcon.vim13
-rw-r--r--runtime/ftplugin/forth.vim9
-rw-r--r--runtime/ftplugin/fortran.vim36
-rw-r--r--runtime/ftplugin/fpcmake.vim12
-rw-r--r--runtime/ftplugin/freebasic.vim10
-rw-r--r--runtime/ftplugin/gdscript.vim68
-rw-r--r--runtime/ftplugin/gdshader.vim13
-rw-r--r--runtime/ftplugin/git.vim15
-rw-r--r--runtime/ftplugin/gitcommit.vim15
-rw-r--r--runtime/ftplugin/haml.vim15
-rw-r--r--runtime/ftplugin/help.lua29
-rw-r--r--runtime/ftplugin/help.vim4
-rw-r--r--runtime/ftplugin/html.vim12
-rw-r--r--runtime/ftplugin/hurl.vim11
-rw-r--r--runtime/ftplugin/icon.vim16
-rw-r--r--runtime/ftplugin/ishd.vim10
-rw-r--r--runtime/ftplugin/j.vim7
-rw-r--r--runtime/ftplugin/java.vim15
-rw-r--r--runtime/ftplugin/javascript.vim8
-rw-r--r--runtime/ftplugin/json5.vim10
-rw-r--r--runtime/ftplugin/jsp.vim15
-rw-r--r--runtime/ftplugin/kotlin.vim10
-rw-r--r--runtime/ftplugin/kwt.vim15
-rw-r--r--runtime/ftplugin/logtalk.dict19
-rw-r--r--runtime/ftplugin/lua.lua2
-rw-r--r--runtime/ftplugin/lua.vim10
-rw-r--r--runtime/ftplugin/lynx.vim10
-rw-r--r--runtime/ftplugin/m3build.vim10
-rw-r--r--runtime/ftplugin/m3quake.vim10
-rw-r--r--runtime/ftplugin/markdown.vim4
-rw-r--r--runtime/ftplugin/meson.vim9
-rw-r--r--runtime/ftplugin/modula2.vim43
-rw-r--r--runtime/ftplugin/modula3.vim10
-rw-r--r--runtime/ftplugin/msmessages.vim13
-rw-r--r--runtime/ftplugin/occam.vim17
-rw-r--r--runtime/ftplugin/octave.vim10
-rw-r--r--runtime/ftplugin/odin.vim26
-rw-r--r--runtime/ftplugin/pascal.vim10
-rw-r--r--runtime/ftplugin/perl.vim9
-rw-r--r--runtime/ftplugin/php.vim10
-rw-r--r--runtime/ftplugin/pod.vim10
-rw-r--r--runtime/ftplugin/poke.vim16
-rw-r--r--runtime/ftplugin/postscr.vim15
-rw-r--r--runtime/ftplugin/ps1.vim13
-rw-r--r--runtime/ftplugin/ps1xml.vim13
-rw-r--r--runtime/ftplugin/pyrex.vim13
-rw-r--r--runtime/ftplugin/python.vim9
-rw-r--r--runtime/ftplugin/qf.vim23
-rw-r--r--runtime/ftplugin/qml.vim12
-rw-r--r--runtime/ftplugin/query.lua2
-rw-r--r--runtime/ftplugin/r.vim17
-rw-r--r--runtime/ftplugin/racket.vim9
-rw-r--r--runtime/ftplugin/readline.vim10
-rw-r--r--runtime/ftplugin/registry.vim15
-rw-r--r--runtime/ftplugin/rhelp.vim17
-rw-r--r--runtime/ftplugin/rmd.vim17
-rw-r--r--runtime/ftplugin/rnoweb.vim17
-rw-r--r--runtime/ftplugin/routeros.vim9
-rw-r--r--runtime/ftplugin/rrst.vim17
-rw-r--r--runtime/ftplugin/ruby.vim53
-rw-r--r--runtime/ftplugin/sass.vim7
-rw-r--r--runtime/ftplugin/sbt.vim3
-rw-r--r--runtime/ftplugin/sed.vim10
-rw-r--r--runtime/ftplugin/sgml.vim15
-rw-r--r--runtime/ftplugin/sh.vim16
-rw-r--r--runtime/ftplugin/solution.vim10
-rw-r--r--runtime/ftplugin/sql.vim13
-rw-r--r--runtime/ftplugin/svg.vim15
-rw-r--r--runtime/ftplugin/tcl.vim13
-rw-r--r--runtime/ftplugin/tcsh.vim10
-rw-r--r--runtime/ftplugin/tidy.vim16
-rw-r--r--runtime/ftplugin/typescript.vim15
-rw-r--r--runtime/ftplugin/vb.vim10
-rw-r--r--runtime/ftplugin/verilog.vim13
-rw-r--r--runtime/ftplugin/vhdl.vim14
-rw-r--r--runtime/ftplugin/vim.vim13
-rw-r--r--runtime/ftplugin/wget.vim10
-rw-r--r--runtime/ftplugin/wget2.vim10
-rw-r--r--runtime/ftplugin/xhtml.vim15
-rw-r--r--runtime/ftplugin/xml.vim9
-rw-r--r--runtime/ftplugin/xsd.vim15
-rw-r--r--runtime/ftplugin/xslt.vim2
-rw-r--r--runtime/indent/cmake.vim49
-rw-r--r--runtime/indent/cucumber.vim77
-rw-r--r--runtime/indent/fortran.vim24
-rw-r--r--runtime/indent/gdscript.vim154
-rw-r--r--runtime/indent/odin.vim124
-rw-r--r--runtime/indent/qml.vim6
-rw-r--r--runtime/indent/query.lua2
-rw-r--r--runtime/indent/r.vim81
-rw-r--r--runtime/indent/racket.vim17
-rw-r--r--runtime/indent/rhelp.vim8
-rw-r--r--runtime/indent/rmd.vim8
-rw-r--r--runtime/indent/rnoweb.vim8
-rw-r--r--runtime/indent/rrst.vim8
-rw-r--r--runtime/indent/sass.vim6
-rw-r--r--runtime/indent/yaml.vim7
-rw-r--r--runtime/lua/man.lua2
-rw-r--r--runtime/lua/nvim/health.lua47
-rw-r--r--runtime/lua/provider/clipboard/health.lua40
-rw-r--r--runtime/lua/provider/health.lua916
-rw-r--r--runtime/lua/provider/node/health.lua105
-rw-r--r--runtime/lua/provider/perl/health.lua90
-rw-r--r--runtime/lua/provider/python/health.lua500
-rw-r--r--runtime/lua/provider/ruby/health.lua71
-rw-r--r--runtime/lua/tohtml.lua1349
-rw-r--r--runtime/lua/vim/F.lua5
-rw-r--r--runtime/lua/vim/_defaults.lua386
-rw-r--r--runtime/lua/vim/_editor.lua135
-rw-r--r--runtime/lua/vim/_init_packages.lua10
-rw-r--r--runtime/lua/vim/_inspector.lua35
-rw-r--r--runtime/lua/vim/_meta.lua4
-rw-r--r--runtime/lua/vim/_meta/api.lua1021
-rw-r--r--runtime/lua/vim/_meta/api_keysets.lua101
-rw-r--r--runtime/lua/vim/_meta/api_keysets_extra.lua167
-rw-r--r--runtime/lua/vim/_meta/builtin.lua133
-rw-r--r--runtime/lua/vim/_meta/builtin_types.lua6
-rw-r--r--runtime/lua/vim/_meta/json.lua2
-rw-r--r--runtime/lua/vim/_meta/lpeg.lua103
-rw-r--r--runtime/lua/vim/_meta/misc.lua3
-rw-r--r--runtime/lua/vim/_meta/mpack.lua5
-rw-r--r--runtime/lua/vim/_meta/options.lua736
-rw-r--r--runtime/lua/vim/_meta/re.lua54
-rw-r--r--runtime/lua/vim/_meta/regex.lua3
-rw-r--r--runtime/lua/vim/_meta/vimfn.lua268
-rw-r--r--runtime/lua/vim/_meta/vvars.lua779
-rw-r--r--runtime/lua/vim/_options.lua433
-rw-r--r--runtime/lua/vim/_system.lua12
-rw-r--r--runtime/lua/vim/_watch.lua304
-rw-r--r--runtime/lua/vim/diagnostic.lua1010
-rw-r--r--runtime/lua/vim/filetype.lua54
-rw-r--r--runtime/lua/vim/filetype/detect.lua78
-rw-r--r--runtime/lua/vim/fs.lua74
-rw-r--r--runtime/lua/vim/glob.lua84
-rw-r--r--runtime/lua/vim/health.lua235
-rw-r--r--runtime/lua/vim/highlight.lua37
-rw-r--r--runtime/lua/vim/iter.lua274
-rw-r--r--runtime/lua/vim/keymap.lua4
-rw-r--r--runtime/lua/vim/loader.lua90
-rw-r--r--runtime/lua/vim/lsp.lua1769
-rw-r--r--runtime/lua/vim/lsp/_changetracking.lua373
-rw-r--r--runtime/lua/vim/lsp/_completion.lua52
-rw-r--r--runtime/lua/vim/lsp/_dynamic.lua31
-rw-r--r--runtime/lua/vim/lsp/_meta.lua10
-rw-r--r--runtime/lua/vim/lsp/_meta/protocol.lua1320
-rw-r--r--runtime/lua/vim/lsp/_tagfunc.lua (renamed from runtime/lua/vim/lsp/tagfunc.lua)0
-rw-r--r--runtime/lua/vim/lsp/_watchfiles.lua118
-rw-r--r--runtime/lua/vim/lsp/buf.lua279
-rw-r--r--runtime/lua/vim/lsp/client.lua1056
-rw-r--r--runtime/lua/vim/lsp/codelens.lua45
-rw-r--r--runtime/lua/vim/lsp/diagnostic.lua208
-rw-r--r--runtime/lua/vim/lsp/handlers.lua212
-rw-r--r--runtime/lua/vim/lsp/health.lua46
-rw-r--r--runtime/lua/vim/lsp/inlay_hint.lua72
-rw-r--r--runtime/lua/vim/lsp/log.lua214
-rw-r--r--runtime/lua/vim/lsp/protocol.lua150
-rw-r--r--runtime/lua/vim/lsp/rpc.lua456
-rw-r--r--runtime/lua/vim/lsp/semantic_tokens.lua90
-rw-r--r--runtime/lua/vim/lsp/sync.lua57
-rw-r--r--runtime/lua/vim/lsp/util.lua274
-rw-r--r--runtime/lua/vim/provider.lua7
-rw-r--r--runtime/lua/vim/provider/perl.lua66
-rw-r--r--runtime/lua/vim/provider/python.lua150
-rw-r--r--runtime/lua/vim/provider/ruby.lua61
-rw-r--r--runtime/lua/vim/re.lua1
-rw-r--r--runtime/lua/vim/secure.lua25
-rw-r--r--runtime/lua/vim/shared.lua330
-rw-r--r--runtime/lua/vim/snippet.lua49
-rw-r--r--runtime/lua/vim/termcap.lua59
-rw-r--r--runtime/lua/vim/text.lua2
-rw-r--r--runtime/lua/vim/treesitter.lua164
-rw-r--r--runtime/lua/vim/treesitter/_fold.lua300
-rw-r--r--runtime/lua/vim/treesitter/_meta.lua28
-rw-r--r--runtime/lua/vim/treesitter/_query_linter.lua46
-rw-r--r--runtime/lua/vim/treesitter/dev.lua228
-rw-r--r--runtime/lua/vim/treesitter/health.lua2
-rw-r--r--runtime/lua/vim/treesitter/highlighter.lua194
-rw-r--r--runtime/lua/vim/treesitter/language.lua40
-rw-r--r--runtime/lua/vim/treesitter/languagetree.lua95
-rw-r--r--runtime/lua/vim/treesitter/query.lua602
-rw-r--r--runtime/lua/vim/ui.lua17
-rw-r--r--runtime/lua/vim/ui/clipboard/osc52.lua4
-rw-r--r--runtime/lua/vim/uri.lua19
-rw-r--r--runtime/lua/vim/userreg.lua51
-rw-r--r--runtime/lua/vim/version.lua101
-rw-r--r--runtime/lua/vim/vimhelp.lua36
-rw-r--r--runtime/macros/less.vim232
-rw-r--r--runtime/makemenu.vim6
-rw-r--r--runtime/mswin.vim23
-rw-r--r--runtime/nvim.appdata.xml2
-rw-r--r--runtime/pack/dist/opt/justify/plugin/justify.vim2
-rw-r--r--runtime/pack/dist/opt/termdebug/plugin/termdebug.vim176
-rw-r--r--runtime/plugin/netrwPlugin.vim3
-rw-r--r--runtime/plugin/osc52.lua18
-rw-r--r--runtime/plugin/tarPlugin.vim2
-rw-r--r--runtime/plugin/tohtml.lua12
-rw-r--r--runtime/plugin/tohtml.vim254
-rw-r--r--runtime/plugin/userreg.vim1
-rw-r--r--runtime/plugin/zipPlugin.vim3
-rw-r--r--runtime/queries/bash/folds.scm1
-rw-r--r--runtime/queries/bash/highlights.scm250
-rw-r--r--runtime/queries/c/folds.scm32
-rw-r--r--runtime/queries/c/highlights.scm182
-rw-r--r--runtime/queries/c/injections.scm23
-rw-r--r--runtime/queries/lua/folds.scm18
-rw-r--r--runtime/queries/lua/highlights.scm254
-rw-r--r--runtime/queries/lua/injections.scm119
-rw-r--r--runtime/queries/markdown/folds.scm16
-rw-r--r--runtime/queries/markdown/highlights.scm130
-rw-r--r--runtime/queries/markdown/injections.scm28
-rw-r--r--runtime/queries/markdown_inline/highlights.scm100
-rw-r--r--runtime/queries/markdown_inline/injections.scm9
-rw-r--r--runtime/queries/python/folds.scm5
-rw-r--r--runtime/queries/python/highlights.scm346
-rw-r--r--runtime/queries/query/highlights.scm79
-rw-r--r--runtime/queries/vim/folds.scm4
-rw-r--r--runtime/queries/vim/highlights.scm254
-rw-r--r--runtime/queries/vim/injections.scm64
-rw-r--r--runtime/queries/vimdoc/highlights.scm67
-rw-r--r--runtime/queries/vimdoc/injections.scm2
-rw-r--r--runtime/synmenu.vim49
-rw-r--r--runtime/syntax/2html.vim2068
-rw-r--r--runtime/syntax/8th.vim683
-rw-r--r--runtime/syntax/amiga.vim5
-rw-r--r--runtime/syntax/ant.vim94
-rw-r--r--runtime/syntax/c.vim12
-rw-r--r--runtime/syntax/chuck.vim187
-rw-r--r--runtime/syntax/cmake.vim4713
-rw-r--r--runtime/syntax/cpp.vim3
-rw-r--r--runtime/syntax/csh.vim5
-rw-r--r--runtime/syntax/css.vim19
-rw-r--r--runtime/syntax/cucumber.vim146
-rw-r--r--runtime/syntax/dcl.vim5
-rw-r--r--runtime/syntax/deb822sources.vim24
-rw-r--r--runtime/syntax/debcontrol.vim4
-rw-r--r--runtime/syntax/debsources.vim9
-rw-r--r--runtime/syntax/diff.vim6
-rw-r--r--runtime/syntax/dosbatch.vim31
-rw-r--r--runtime/syntax/elmfilt.vim5
-rw-r--r--runtime/syntax/exports.vim5
-rw-r--r--runtime/syntax/fortran.vim656
-rw-r--r--runtime/syntax/git.vim4
-rw-r--r--runtime/syntax/gitcommit.vim8
-rw-r--r--runtime/syntax/go.vim20
-rw-r--r--runtime/syntax/gpg.vim21
-rw-r--r--runtime/syntax/help.vim7
-rw-r--r--runtime/syntax/html.vim90
-rw-r--r--runtime/syntax/i3config.vim8
-rw-r--r--runtime/syntax/java.vim99
-rw-r--r--runtime/syntax/json5.vim9
-rw-r--r--runtime/syntax/lex.vim6
-rw-r--r--runtime/syntax/lisp.vim6
-rw-r--r--runtime/syntax/logtalk.vim51
-rw-r--r--runtime/syntax/mail.vim19
-rw-r--r--runtime/syntax/maple.vim6
-rw-r--r--runtime/syntax/masm.vim16
-rw-r--r--runtime/syntax/mermaid.vim52
-rw-r--r--runtime/syntax/modula2.vim71
-rw-r--r--runtime/syntax/modula2/opt/iso.vim380
-rw-r--r--runtime/syntax/modula2/opt/pim.vim377
-rw-r--r--runtime/syntax/modula2/opt/r10.vim452
-rw-r--r--runtime/syntax/netrw.vim6
-rw-r--r--runtime/syntax/odin.vim109
-rw-r--r--runtime/syntax/pacmanlog.vim41
-rw-r--r--runtime/syntax/qf.vim6
-rw-r--r--runtime/syntax/quarto.vim8
-rw-r--r--runtime/syntax/query.lua2
-rw-r--r--runtime/syntax/r.vim20
-rw-r--r--runtime/syntax/racket.vim9
-rw-r--r--runtime/syntax/rhelp.vim10
-rw-r--r--runtime/syntax/rmd.vim56
-rw-r--r--runtime/syntax/rpcgen.vim6
-rw-r--r--runtime/syntax/sh.vim50
-rw-r--r--runtime/syntax/shared/debversions.vim6
-rw-r--r--runtime/syntax/sm.vim6
-rw-r--r--runtime/syntax/spec.vim2
-rw-r--r--runtime/syntax/squirrel.vim3
-rw-r--r--runtime/syntax/swayconfig.vim12
-rw-r--r--runtime/syntax/tags.vim6
-rw-r--r--runtime/syntax/tex.vim6
-rw-r--r--runtime/syntax/tmux.vim160
-rw-r--r--runtime/syntax/vim.vim337
-rw-r--r--runtime/syntax/xmath.vim6
-rw-r--r--runtime/syntax/xxd.vim6
-rw-r--r--runtime/syntax/yacc.vim5
-rw-r--r--runtime/tutor/en/vim-01-beginner.tutor10
-rw-r--r--runtime/tutor/ja/vim-01-beginner.tutor995
-rw-r--r--runtime/tutor/ja/vim-01-beginner.tutor.json44
402 files changed, 32280 insertions, 17192 deletions
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt
index 0077604141..c171fab9e9 100644
--- a/runtime/CMakeLists.txt
+++ b/runtime/CMakeLists.txt
@@ -1,12 +1,10 @@
-set(SYN_VIM_GENERATOR ${PROJECT_SOURCE_DIR}/src/nvim/generators/gen_vimvim.lua)
set(GENERATED_RUNTIME_DIR ${PROJECT_BINARY_DIR}/runtime)
-set(GENERATED_SYN_VIM ${GENERATED_RUNTIME_DIR}/syntax/vim/generated.vim)
+
set(GENERATED_HELP_TAGS ${GENERATED_RUNTIME_DIR}/doc/tags)
set(GENERATED_PACKAGE_DIR ${GENERATED_RUNTIME_DIR}/pack/dist/opt)
-set(FUNCS_DATA ${PROJECT_BINARY_DIR}/funcs_data.mpack)
+set(GENERATED_SYN_VIM ${GENERATED_RUNTIME_DIR}/syntax/vim/generated.vim)
+set(SYN_VIM_GENERATOR ${PROJECT_SOURCE_DIR}/src/nvim/generators/gen_vimvim.lua)
-file(MAKE_DIRECTORY ${GENERATED_RUNTIME_DIR})
-file(MAKE_DIRECTORY ${GENERATED_RUNTIME_DIR}/syntax)
file(MAKE_DIRECTORY ${GENERATED_RUNTIME_DIR}/syntax/vim)
get_directory_property(LUA_GEN DIRECTORY ${PROJECT_SOURCE_DIR}/src/nvim DEFINITION LUA_GEN)
@@ -24,21 +22,21 @@ add_custom_command(OUTPUT ${GENERATED_SYN_VIM}
${FUNCS_DATA}
)
-glob_wrapper(PACKAGES ${PROJECT_SOURCE_DIR}/runtime/pack/dist/opt/*)
+file(GLOB PACKAGES CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/runtime/pack/dist/opt/*)
set(GENERATED_PACKAGE_TAGS)
foreach(PACKAGE ${PACKAGES})
get_filename_component(PACKNAME ${PACKAGE} NAME)
- glob_wrapper("${PACKNAME}_DOC_FILES" ${PACKAGE}/doc/*.txt)
+ file(GLOB "${PACKNAME}_DOC_FILES" CONFIGURE_DEPENDS ${PACKAGE}/doc/*.txt)
if(${PACKNAME}_DOC_FILES)
file(MAKE_DIRECTORY ${GENERATED_PACKAGE_DIR}/${PACKNAME})
add_custom_command(OUTPUT "${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/tags"
COMMAND ${CMAKE_COMMAND} -E copy_directory
${PACKAGE} ${GENERATED_PACKAGE_DIR}/${PACKNAME}
- COMMAND "${PROJECT_BINARY_DIR}/bin/nvim"
+ COMMAND $<TARGET_FILE:nvim_bin>
-u NONE -i NONE -e --headless -c "helptags doc" -c quit
DEPENDS
- nvim
+ nvim_bin
nvim_runtime_deps
WORKING_DIRECTORY "${GENERATED_PACKAGE_DIR}/${PACKNAME}"
)
@@ -57,8 +55,6 @@ foreach(PACKAGE ${PACKAGES})
endif()
endforeach()
-glob_wrapper(DOCFILES ${PROJECT_SOURCE_DIR}/runtime/doc/*.txt)
-
set(BUILDDOCFILES)
foreach(DF ${DOCFILES})
get_filename_component(F ${DF} NAME)
@@ -69,26 +65,16 @@ add_custom_command(OUTPUT ${GENERATED_HELP_TAGS}
COMMAND ${CMAKE_COMMAND} -E remove_directory doc
COMMAND ${CMAKE_COMMAND} -E copy_directory
${PROJECT_SOURCE_DIR}/runtime/doc doc
- COMMAND "${PROJECT_BINARY_DIR}/bin/nvim"
+ COMMAND $<TARGET_FILE:nvim_bin>
-u NONE -i NONE -e --headless -c "helptags ++t doc" -c quit
DEPENDS
- nvim
+ nvim_bin
nvim_runtime_deps
WORKING_DIRECTORY "${GENERATED_RUNTIME_DIR}"
)
-
-# TODO: This doesn't work. wait for "nvim -l" to land?
-add_custom_target(doc_html
- COMMAND "${PROJECT_BINARY_DIR}/bin/nvim"
- -V1 -es --clean -c "lua require('scripts.gen_help_html').gen('./build/runtime/doc', './build/doc_html', nil, 'todo_commit_id')" -c "0cq"
- DEPENDS
- ${GENERATED_HELP_TAGS}
- WORKING_DIRECTORY "${GENERATED_RUNTIME_DIR}/doc"
-)
-
add_custom_target(
- runtime ALL
+ nvim_runtime
DEPENDS
${GENERATED_SYN_VIM}
${GENERATED_HELP_TAGS}
@@ -119,11 +105,11 @@ install_helper(
FILES ${CMAKE_CURRENT_SOURCE_DIR}/nvim.png
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps)
-glob_wrapper(RUNTIME_ROOT_FILES *.vim *.lua *.ico)
+file(GLOB RUNTIME_ROOT_FILES CONFIGURE_DEPENDS *.vim *.lua *.ico)
install_helper(FILES ${RUNTIME_ROOT_FILES}
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/)
-glob_wrapper(RUNTIME_DIRS */)
+file(GLOB RUNTIME_DIRS CONFIGURE_DEPENDS */)
foreach(D ${RUNTIME_DIRS})
if(IS_DIRECTORY ${D})
install_helper(DIRECTORY ${D}
diff --git a/runtime/autoload/modula2.vim b/runtime/autoload/modula2.vim
new file mode 100644
index 0000000000..284dc2768f
--- /dev/null
+++ b/runtime/autoload/modula2.vim
@@ -0,0 +1,31 @@
+" Vim filetype plugin file
+" Language: Modula-2
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2024 Jan 04
+
+" Dialect can be one of pim, iso, r10
+function modula2#GetDialect() abort
+
+ if exists("b:modula2.dialect")
+ return b:modula2.dialect
+ endif
+
+ if exists("g:modula2_default_dialect")
+ let dialect = g:modula2_default_dialect
+ else
+ let dialect = "pim"
+ endif
+
+ return dialect
+endfunction
+
+function modula2#SetDialect(dialect, extension = "") abort
+ if exists("b:modula2")
+ unlockvar! b:modula2
+ endif
+
+ let b:modula2 = #{ dialect: a:dialect, extension: a:extension }
+ lockvar! b:modula2
+endfunction
+
+" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:
diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim
index b8092ebeeb..fa08bb3848 100644
--- a/runtime/autoload/netrw.vim
+++ b/runtime/autoload/netrw.vim
@@ -1,11 +1,14 @@
" netrw.vim: Handles file transfer and remote directory listing across
" AUTOLOAD SECTION
-" Date: May 03, 2023
+" Maintainer: This runtime file is looking for a new maintainer.
+" Date: May 03, 2023
" Version: 173a
" Last Change:
" 2023 Nov 21 by Vim Project: ignore wildignore when expanding $COMSPEC (v173a)
" 2023 Nov 22 by Vim Project: fix handling of very long filename on longlist style (v173a)
-" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
+" 2024 Feb 19 by Vim Project: (announce adoption)
+" 2024 Feb 29 by Vim Project: handle symlinks in tree mode correctly
+" Former Maintainer: Charles E Campbell
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
" Copyright: Copyright (C) 2016 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
@@ -1973,7 +1976,7 @@ fun! NetrwStatusLine()
if !exists("w:netrw_explore_bufnr") || w:netrw_explore_bufnr != bufnr("%") || !exists("w:netrw_explore_line") || w:netrw_explore_line != line(".") || !exists("w:netrw_explore_list")
" restore user's status line
- let &stl = s:netrw_users_stl
+ let &l:stl = s:netrw_users_stl
let &laststatus = s:netrw_users_ls
if exists("w:netrw_explore_bufnr")|unlet w:netrw_explore_bufnr|endif
if exists("w:netrw_explore_line") |unlet w:netrw_explore_line |endif
@@ -2074,9 +2077,9 @@ fun! netrw#NetRead(mode,...)
let wholechoice = wholechoice . " " . choice
let ichoice = ichoice + 1
if ichoice > a:0
- if !exists("g:netrw_quiet")
- call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",3)
- endif
+ if !exists("g:netrw_quiet")
+ call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",3)
+ endif
" call Dret("netrw#NetRead :2 getcwd<".getcwd().">")
return
endif
@@ -2497,9 +2500,9 @@ fun! netrw#NetWrite(...) range
let wholechoice= wholechoice . " " . choice
let ichoice = ichoice + 1
if choice > a:0
- if !exists("g:netrw_quiet")
- call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",13)
- endif
+ if !exists("g:netrw_quiet")
+ call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",13)
+ endif
" call Dret("netrw#NetWrite")
return
endif
@@ -2770,7 +2773,7 @@ fun! netrw#NetWrite(...) range
if a:firstline == 1 && a:lastline == line("$")
" restore modifiability; usually equivalent to set nomod
- let &mod= mod
+ let &l:mod= mod
" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
elseif !exists("leavemod")
" indicate that the buffer has not been modified since last written
@@ -2959,7 +2962,7 @@ fun! s:NetrwGetFile(readcmd, tfile, method)
setl isk-=/
filetype detect
" call Decho("..local filetype<".&ft."> for buf#".bufnr()."<".bufname().">")
- let &isk= iskkeep
+ let &l:isk= iskkeep
" call Dredir("ls!","NetrwGetFile (renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">)")
let line1 = 1
let line2 = line("$")
@@ -4956,12 +4959,12 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
if g:netrw_chgwin >= 1
" call Decho("edit-a-file: changing window to #".g:netrw_chgwin.": (due to g:netrw_chgwin)",'~'.expand("<slnum>"))
if winnr("$")+1 == g:netrw_chgwin
- " if g:netrw_chgwin is set to one more than the last window, then
- " vertically split the last window to make that window available.
- let curwin= winnr()
- exe "NetrwKeepj keepalt ".winnr("$")."wincmd w"
- vs
- exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd ".curwin
+ " if g:netrw_chgwin is set to one more than the last window, then
+ " vertically split the last window to make that window available.
+ let curwin= winnr()
+ exe "NetrwKeepj keepalt ".winnr("$")."wincmd w"
+ vs
+ exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd ".curwin
endif
exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd w"
endif
@@ -5268,7 +5271,8 @@ fun! s:NetrwBrowseUpDir(islocal)
endif
call s:RestorePosn(s:netrw_posn)
let curdir= substitute(curdir,'^.*[\/]','','')
- call search('\<'.curdir.'/','wc')
+ let curdir= '\<'. escape(curdir, '~'). '/'
+ call search(curdir,'wc')
endif
" call Dret("s:NetrwBrowseUpDir")
endfun
@@ -6069,7 +6073,7 @@ fun! s:NetrwServerEdit(islocal,fname)
" used something like <cr>.
" call Decho("user must have closed server AND did not use ctrl-r",'~'.expand("<slnum>"))
if exists("g:netrw_browse_split")
- unlet g:netrw_browse_split
+ unlet g:netrw_browse_split
endif
let g:netrw_browse_split= 0
if exists("s:netrw_browse_split_".winnr())
@@ -6103,7 +6107,7 @@ fun! s:NetrwServerEdit(islocal,fname)
if !ctrlr
" call Decho("server<".g:netrw_servername."> not available and ctrl-r not used",'~'.expand("<slnum>"))
if exists("g:netrw_browse_split")
- unlet g:netrw_browse_split
+ unlet g:netrw_browse_split
endif
let g:netrw_browse_split= 0
call s:NetrwBrowse(islocal,s:NetrwBrowseChgDir(islocal,a:fname))
@@ -6619,14 +6623,14 @@ fun! s:NetrwMaps(islocal)
nmap <buffer> <2-leftmouse> <Plug>Netrw2Leftmouse
imap <buffer> <leftmouse> <Plug>ILeftmouse
imap <buffer> <middlemouse> <Plug>IMiddlemouse
- nno <buffer> <silent> <Plug>NetrwLeftmouse <leftmouse>:call <SID>NetrwLeftmouse(1)<cr>
- nno <buffer> <silent> <Plug>NetrwCLeftmouse <leftmouse>:call <SID>NetrwCLeftmouse(1)<cr>
- nno <buffer> <silent> <Plug>NetrwMiddlemouse <leftmouse>:call <SID>NetrwPrevWinOpen(1)<cr>
- nno <buffer> <silent> <Plug>NetrwSLeftmouse <leftmouse>:call <SID>NetrwSLeftmouse(1)<cr>
- nno <buffer> <silent> <Plug>NetrwSLeftdrag <leftmouse>:call <SID>NetrwSLeftdrag(1)<cr>
+ nno <buffer> <silent> <Plug>NetrwLeftmouse :exec "norm! \<lt>leftmouse>"<bar>call <SID>NetrwLeftmouse(1)<cr>
+ nno <buffer> <silent> <Plug>NetrwCLeftmouse :exec "norm! \<lt>leftmouse>"<bar>call <SID>NetrwCLeftmouse(1)<cr>
+ nno <buffer> <silent> <Plug>NetrwMiddlemouse :exec "norm! \<lt>leftmouse>"<bar>call <SID>NetrwPrevWinOpen(1)<cr>
+ nno <buffer> <silent> <Plug>NetrwSLeftmouse :exec "norm! \<lt>leftmouse>"<bar>call <SID>NetrwSLeftmouse(1)<cr>
+ nno <buffer> <silent> <Plug>NetrwSLeftdrag :exec "norm! \<lt>leftmouse>"<bar>call <SID>NetrwSLeftdrag(1)<cr>
nmap <buffer> <silent> <Plug>Netrw2Leftmouse -
- exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
- exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
+ exe 'nnoremap <buffer> <silent> <rightmouse> :exec "norm! \<lt>leftmouse>"<bar>call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
+ exe 'vnoremap <buffer> <silent> <rightmouse> :exec "norm! \<lt>leftmouse>"<bar>call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
endif
exe 'nnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
exe 'nnoremap <buffer> <silent> <nowait> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
@@ -6719,22 +6723,22 @@ fun! s:NetrwMaps(islocal)
nnoremap <buffer> <silent> <Plug>NetrwRefresh :call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr>
if g:netrw_mousemaps == 1
nmap <buffer> <leftmouse> <Plug>NetrwLeftmouse
- nno <buffer> <silent> <Plug>NetrwLeftmouse <leftmouse>:call <SID>NetrwLeftmouse(0)<cr>
+ nno <buffer> <silent> <Plug>NetrwLeftmouse :exec "norm! \<lt>leftmouse>"<bar>call <SID>NetrwLeftmouse(0)<cr>
nmap <buffer> <c-leftmouse> <Plug>NetrwCLeftmouse
- nno <buffer> <silent> <Plug>NetrwCLeftmouse <leftmouse>:call <SID>NetrwCLeftmouse(0)<cr>
+ nno <buffer> <silent> <Plug>NetrwCLeftmouse :exec "norm! \<lt>leftmouse>"<bar>call <SID>NetrwCLeftmouse(0)<cr>
nmap <buffer> <s-leftmouse> <Plug>NetrwSLeftmouse
- nno <buffer> <silent> <Plug>NetrwSLeftmouse <leftmouse>:call <SID>NetrwSLeftmouse(0)<cr>
+ nno <buffer> <silent> <Plug>NetrwSLeftmouse :exec "norm! \<lt>leftmouse>"<bar>call <SID>NetrwSLeftmouse(0)<cr>
nmap <buffer> <s-leftdrag> <Plug>NetrwSLeftdrag
- nno <buffer> <silent> <Plug>NetrwSLeftdrag <leftmouse>:call <SID>NetrwSLeftdrag(0)<cr>
+ nno <buffer> <silent> <Plug>NetrwSLeftdrag :exec "norm! \<lt>leftmouse>"<bar>call <SID>NetrwSLeftdrag(0)<cr>
nmap <middlemouse> <Plug>NetrwMiddlemouse
- nno <buffer> <silent> <middlemouse> <Plug>NetrwMiddlemouse <leftmouse>:call <SID>NetrwPrevWinOpen(0)<cr>
+ nno <buffer> <silent> <middlemouse> <Plug>NetrwMiddlemouse :exec "norm! \<lt>leftmouse>"<bar>call <SID>NetrwPrevWinOpen(0)<cr>
nmap <buffer> <2-leftmouse> <Plug>Netrw2Leftmouse
nmap <buffer> <silent> <Plug>Netrw2Leftmouse -
imap <buffer> <leftmouse> <Plug>ILeftmouse
imap <buffer> <middlemouse> <Plug>IMiddlemouse
imap <buffer> <s-leftmouse> <Plug>ISLeftmouse
- exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
- exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
+ exe 'nnoremap <buffer> <silent> <rightmouse> :exec "norm! \<lt>leftmouse>"<bar>call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
+ exe 'vnoremap <buffer> <silent> <rightmouse> :exec "norm! \<lt>leftmouse>"<bar>call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
endif
exe 'nnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
exe 'nnoremap <buffer> <silent> <nowait> d :call <SID>NetrwMakeDir("'.mapsafeusermach.'")<cr>'
@@ -7445,7 +7449,7 @@ fun! s:NetrwMarkFileExe(islocal,enbloc)
for fname in s:netrwmarkfilelist_{curbufnr}
if a:islocal
if g:netrw_keepdir
- let fname= s:ShellEscape(netrw#WinPath(s:ComposePath(curdir,fname)))
+ let fname= s:ShellEscape(netrw#WinPath(s:ComposePath(curdir,fname)))
endif
else
let fname= s:ShellEscape(netrw#WinPath(b:netrw_curdir.fname))
@@ -7801,7 +7805,7 @@ fun! s:NetrwMarkFileMove(islocal)
let movecmd = netrw#WinPath(movecmd).movecmdargs
" call Decho("windows exception: movecmd<".movecmd."> (#1: had a space)",'~'.expand("<slnum>"))
else
- let movecmd = netrw#WinPath(movecmd)
+ let movecmd = netrw#WinPath(g:netrw_localmovecmd)
" call Decho("windows exception: movecmd<".movecmd."> (#2: no space)",'~'.expand("<slnum>"))
endif
else
@@ -7815,10 +7819,6 @@ fun! s:NetrwMarkFileMove(islocal)
endif
if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16"))
let fname= substitute(fname,'/','\\','g')
- if g:netrw_keepdir
- " Jul 19, 2022: fixing file move when g:netrw_keepdir is 1
- let fname= b:netrw_curdir."\\".fname
- endif
endif
" call Decho("system(".movecmd." ".s:ShellEscape(fname)." ".tgt.")",'~'.expand("<slnum>"))
let ret= system(movecmd.g:netrw_localmovecmdopt." ".s:ShellEscape(fname)." ".tgt)
@@ -9377,7 +9377,7 @@ fun! s:NetrwTreeDir(islocal)
" call Decho("treedir<".treedir.">",'~'.expand("<slnum>"))
elseif curline =~ '@$'
" call Decho("handle symbolic link from current line",'~'.expand("<slnum>"))
- let treedir= resolve(substitute(substitute(getline('.'),'@.*$','','e'),'^|*\s*','','e'))
+ let potentialdir= resolve(substitute(substitute(getline('.'),'@.*$','','e'),'^|*\s*','','e'))
" call Decho("treedir<".treedir.">",'~'.expand("<slnum>"))
else
" call Decho("do not extract tree subdirectory from current line and set treedir to empty",'~'.expand("<slnum>"))
@@ -9402,7 +9402,6 @@ fun! s:NetrwTreeDir(islocal)
" call Decho("COMBAK#23 : mod=".&mod." win#".winnr())
" call Decho("islocal=".a:islocal." curline<".curline.">",'~'.expand("<slnum>"))
- let potentialdir= s:NetrwFile(substitute(curline,'^'.s:treedepthstring.'\+ \(.*\)@$','\1',''))
" call Decho("potentialdir<".potentialdir."> isdir=".isdirectory(potentialdir),'~'.expand("<slnum>"))
" call Decho("COMBAK#24 : mod=".&mod." win#".winnr())
@@ -9415,8 +9414,15 @@ fun! s:NetrwTreeDir(islocal)
" " call Decho("newdir <".newdir.">",'~'.expand("<slnum>"))
" else
" call Decho("apply NetrwTreePath to treetop<".w:netrw_treetop.">",'~'.expand("<slnum>"))
- let treedir = s:NetrwTreePath(w:netrw_treetop)
-" endif
+ if a:islocal && curline =~ '@$'
+ if isdirectory(s:NetrwFile(potentialdir))
+ let treedir = w:netrw_treetop.'/'.potentialdir.'/'
+ let w:netrw_treetop = treedir
+ endif
+ else
+ let potentialdir= s:NetrwFile(substitute(curline,'^'.s:treedepthstring.'\+ \(.*\)@$','\1',''))
+ let treedir = s:NetrwTreePath(w:netrw_treetop)
+ endif
endif
" call Decho("COMBAK#25 : mod=".&mod." win#".winnr())
@@ -10104,7 +10110,7 @@ fun! s:SetupNetrwStatusLine(statline)
" set up status line (may use User9 highlighting)
" insure that windows have a statusline
" make sure statusline is displayed
- let &stl=a:statline
+ let &l:stl=a:statline
setl laststatus=2
" call Decho("stl=".&stl,'~'.expand("<slnum>"))
redraw
@@ -10220,7 +10226,7 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd)
setl ff=unix
" restore settings
- let &ff= ffkeep
+ let &l:ff= ffkeep
" call Dret("NetrwRemoteFtpCmd")
return
@@ -10257,7 +10263,7 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd)
endif
" restore settings " {{{3
- let &ff= ffkeep
+ let &l:ff= ffkeep
" call Dret("NetrwRemoteFtpCmd")
endfun
@@ -10270,7 +10276,7 @@ fun! s:NetrwRemoteListing()
let w:netrw_bannercnt= s:bannercnt
endif
if !exists("w:netrw_bannercnt") && exists("b:bannercnt")
- let w:netrw_bannercnt= s:bannercnt
+ let w:netrw_bannercnt= b:bannercnt
endif
call s:RemotePathAnalysis(b:netrw_curdir)
@@ -10561,7 +10567,7 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all)
NetrwKeepj call netrw#ErrorMsg(s:ERROR,"for some reason b:netrw_curdir doesn't exist!",53)
let ok="q"
else
- let remotedir= substitute(b:netrw_curdir,'^.*//[^/]\+/\(.*\)$','\1','')
+ let remotedir= substitute(b:netrw_curdir,'^.\{-}//[^/]\+/\(.*\)$','\1','')
" call Decho("netrw_rm_cmd<".netrw_rm_cmd.">",'~'.expand("<slnum>"))
" call Decho("remotedir<".remotedir.">",'~'.expand("<slnum>"))
" call Decho("rmfile<".a:rmfile.">",'~'.expand("<slnum>"))
@@ -10574,7 +10580,7 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all)
let ret= system(netrw_rm_cmd)
if v:shell_error != 0
if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && !g:netrw_keepdir
- call netrw#ErrorMsg(s:ERROR,"remove failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-cd)",102)
+ call netrw#ErrorMsg(s:ERROR,"remove failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-cd)",102)
else
call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60)
endif
@@ -10852,6 +10858,10 @@ fun! s:LocalBrowseRefresh()
" call Dret("s:LocalBrowseRefresh : don't refresh when focus not on netrw window")
return
endif
+ if !empty(getcmdwintype())
+ " cannot move away from cmdline window, see :h E11
+ return
+ endif
if exists("s:netrw_events") && s:netrw_events == 1
" s:LocalFastBrowser gets called (indirectly) from a
let s:netrw_events= 2
@@ -11078,16 +11088,16 @@ fun! s:LocalListing()
" call Decho("pfile <".pfile.">",'~'.expand("<slnum>"))
if w:netrw_liststyle == s:LONGLIST
- let longfile= printf("%-".g:netrw_maxfilenamelen."S",pfile)
- let sz = getfsize(filename)
- let szlen = 15 - (strdisplaywidth(longfile) - g:netrw_maxfilenamelen)
- let szlen = (szlen > 0) ? szlen : 0
+ let longfile = printf("%-".g:netrw_maxfilenamelen."S",pfile)
+ let sz = getfsize(filename)
+ let szlen = 15 - (strdisplaywidth(longfile) - g:netrw_maxfilenamelen)
+ let szlen = (szlen > 0) ? szlen : 0
if g:netrw_sizestyle =~# "[hH]"
let sz= s:NetrwHumanReadable(sz)
endif
let fsz = printf("%".szlen."S",sz)
- let pfile = longfile." ".fsz." ".strftime(g:netrw_timefmt,getftime(filename))
+ let pfile= longfile." ".fsz." ".strftime(g:netrw_timefmt,getftime(filename))
" call Decho("longlist support: sz=".sz." fsz=".fsz,'~'.expand("<slnum>"))
endif
@@ -11164,6 +11174,10 @@ endfun
fun! s:NetrwLocalRename(path) range
" call Dfunc("NetrwLocalRename(path<".a:path.">)")
+ if !exists("w:netrw_bannercnt")
+ let w:netrw_bannercnt= b:netrw_bannercnt
+ endif
+
" preparation for removing multiple files/directories
let ykeep = @@
let ctr = a:firstline
@@ -11265,6 +11279,10 @@ fun! s:NetrwLocalRm(path) range
" call Dfunc("s:NetrwLocalRm(path<".a:path.">)")
" call Decho("firstline=".a:firstline." lastline=".a:lastline,'~'.expand("<slnum>"))
+ if !exists("w:netrw_bannercnt")
+ let w:netrw_bannercnt= b:netrw_bannercnt
+ endif
+
" preparation for removing multiple files/directories
let ykeep = @@
let ret = 0
@@ -11464,7 +11482,7 @@ endfun
" netrw#RFC2396: converts %xx into characters {{{2
fun! netrw#RFC2396(fname)
" call Dfunc("netrw#RFC2396(fname<".a:fname.">)")
- let fname = escape(substitute(a:fname,'%\(\x\x\)','\=nr2char("0x".submatch(1))','ge')," \t")
+ let fname = escape(substitute(a:fname,'%\(\x\x\)','\=printf("%c","0x".submatch(1))','ge')," \t")
" call Dret("netrw#RFC2396 ".fname)
return fname
endfun
@@ -12099,7 +12117,7 @@ fun! s:NetrwLcd(newdir)
if (has("win32") || has("win95") || has("win64") || has("win16")) && !g:netrw_cygwin
if a:newdir =~ '^\\\\\w\+' || a:newdir =~ '^//\w\+'
let dirname = '\'
- exe 'NetrwKeepj sil lcd '.fnameescape(dirname)
+ exe 'NetrwKeepj sil lcd '.fnameescape(dirname)
endif
endif
catch /^Vim\%((\a\+)\)\=:E472/
diff --git a/runtime/autoload/netrwFileHandlers.vim b/runtime/autoload/netrwFileHandlers.vim
index d07235c107..2b6f8f7a0f 100644
--- a/runtime/autoload/netrwFileHandlers.vim
+++ b/runtime/autoload/netrwFileHandlers.vim
@@ -1,6 +1,7 @@
" netrwFileHandlers: contains various extension-based file handlers for
" netrw's browsers' x command ("eXecute launcher")
-" Author: Charles E. Campbell
+" Maintainer: This runtime file is looking for a new maintainer.
+" Original Author: Charles E. Campbell
" Date: Sep 18, 2020
" Version: 11
" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1
diff --git a/runtime/autoload/netrwSettings.vim b/runtime/autoload/netrwSettings.vim
index d65f83144e..5525c0d035 100644
--- a/runtime/autoload/netrwSettings.vim
+++ b/runtime/autoload/netrwSettings.vim
@@ -1,6 +1,7 @@
" netrwSettings.vim: makes netrw settings simpler
" Date: Nov 15, 2021
-" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Charles E Campbell
" Version: 18
" Copyright: Copyright (C) 1999-2007 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
diff --git a/runtime/autoload/provider/perl.vim b/runtime/autoload/provider/perl.vim
index 24f2b018bb..b439f751ae 100644
--- a/runtime/autoload/provider/perl.vim
+++ b/runtime/autoload/provider/perl.vim
@@ -1,83 +1,15 @@
-if exists('s:loaded_perl_provider')
+if exists('g:loaded_perl_provider')
finish
endif
-let s:loaded_perl_provider = 1
-
-function! provider#perl#Detect() abort
- " use g:perl_host_prog if set or check if perl is on the path
- let prog = exepath(get(g:, 'perl_host_prog', 'perl'))
- if empty(prog)
- return ['', '']
- endif
-
- " if perl is available, make sure we have 5.22+
- call system([prog, '-e', 'use v5.22'])
- if v:shell_error
- return ['', 'Perl version is too old, 5.22+ required']
- endif
-
- " if perl is available, make sure the required module is available
- call system([prog, '-W', '-MNeovim::Ext', '-e', ''])
- if v:shell_error
- return ['', '"Neovim::Ext" cpan module is not installed']
- endif
-
- return [prog, '']
-endfunction
-
-function! provider#perl#Prog() abort
- return s:prog
+function! provider#perl#Call(method, args) abort
+ return v:lua.vim.provider.perl.call(a:method, a:args)
endfunction
function! provider#perl#Require(host) abort
- if s:err != ''
- echoerr s:err
- return
- endif
-
- let prog = provider#perl#Prog()
- let args = [s:prog, '-e', 'use Neovim::Ext; start_host();']
-
- " Collect registered perl plugins into args
- let perl_plugins = remote#host#PluginsForHost(a:host.name)
- for plugin in perl_plugins
- call add(args, plugin.path)
- endfor
-
- return provider#Poll(args, a:host.orig_name, '$NVIM_PERL_LOG_FILE')
+ return v:lua.vim.provider.perl.require(a:host, s:prog)
endfunction
-function! provider#perl#Call(method, args) abort
- if s:err != ''
- echoerr s:err
- return
- endif
-
- if !exists('s:host')
- try
- let s:host = remote#host#Require('legacy-perl-provider')
- catch
- let s:err = v:exception
- echohl WarningMsg
- echomsg v:exception
- echohl None
- return
- endtry
- endif
- return call('rpcrequest', insert(insert(a:args, 'perl_'.a:method), s:host))
-endfunction
-
-let [s:prog, s:err] = provider#perl#Detect()
+let s:prog = v:lua.vim.provider.perl.detect()
let g:loaded_perl_provider = empty(s:prog) ? 1 : 2
-
-if g:loaded_perl_provider != 2
- let s:err = 'Cannot find perl or the required perl module'
-endif
-
-
-" The perl provider plugin will run in a separate instance of the perl
-" host.
-call remote#host#RegisterClone('legacy-perl-provider', 'perl')
-call remote#host#RegisterPlugin('legacy-perl-provider', 'ScriptHost.pm', [])
-
+call v:lua.require'vim.provider.perl'.start()
diff --git a/runtime/autoload/provider/python3.vim b/runtime/autoload/provider/python3.vim
index 38ef0cccfc..43c14122d0 100644
--- a/runtime/autoload/provider/python3.vim
+++ b/runtime/autoload/provider/python3.vim
@@ -1,45 +1,15 @@
-" The Python3 provider uses a Python3 host to emulate an environment for running
-" python3 plugins. :help provider
-"
-" Associating the plugin with the Python3 host is the first step because
-" plugins will be passed as command-line arguments
-
if exists('g:loaded_python3_provider')
finish
endif
-let [s:prog, s:err] = provider#pythonx#Detect(3)
-let g:loaded_python3_provider = empty(s:prog) ? 1 : 2
-function! provider#python3#Prog() abort
- return s:prog
+function! provider#python3#Call(method, args) abort
+ return v:lua.vim.provider.python.call(a:method, a:args)
endfunction
-function! provider#python3#Error() abort
- return s:err
+function! provider#python3#Require(host) abort
+ return v:lua.vim.provider.python.require(a:host)
endfunction
-" The Python3 provider plugin will run in a separate instance of the Python3
-" host.
-call remote#host#RegisterClone('legacy-python3-provider', 'python3')
-call remote#host#RegisterPlugin('legacy-python3-provider', 'script_host.py', [])
-
-function! provider#python3#Call(method, args) abort
- if s:err != ''
- return
- endif
- if !exists('s:host')
- let s:rpcrequest = function('rpcrequest')
-
- " Ensure that we can load the Python3 host before bootstrapping
- try
- let s:host = remote#host#Require('legacy-python3-provider')
- catch
- let s:err = v:exception
- echohl WarningMsg
- echomsg v:exception
- echohl None
- return
- endtry
- endif
- return call(s:rpcrequest, insert(insert(a:args, 'python_'.a:method), s:host))
-endfunction
+let s:prog = v:lua.vim.provider.python.detect_by_module('neovim')
+let g:loaded_python3_provider = empty(s:prog) ? 1 : 2
+call v:lua.require'vim.provider.python'.start()
diff --git a/runtime/autoload/provider/pythonx.vim b/runtime/autoload/provider/pythonx.vim
deleted file mode 100644
index 48b96c699a..0000000000
--- a/runtime/autoload/provider/pythonx.vim
+++ /dev/null
@@ -1,112 +0,0 @@
-" The Python provider helper
-if exists('s:loaded_pythonx_provider')
- finish
-endif
-
-let s:loaded_pythonx_provider = 1
-
-function! provider#pythonx#Require(host) abort
- " Python host arguments
- let prog = provider#python3#Prog()
- let args = [prog, '-c', 'import sys; sys.path = [p for p in sys.path if p != ""]; import neovim; neovim.start_host()']
-
-
- " Collect registered Python plugins into args
- let python_plugins = remote#host#PluginsForHost(a:host.name)
- for plugin in python_plugins
- call add(args, plugin.path)
- endfor
-
- return provider#Poll(args, a:host.orig_name, '$NVIM_PYTHON_LOG_FILE', {'overlapped': v:true})
-endfunction
-
-function! s:get_python_executable_from_host_var(major_version) abort
- return expand(get(g:, 'python'.(a:major_version == 3 ? '3' : execute("throw 'unsupported'")).'_host_prog', ''), v:true)
-endfunction
-
-function! s:get_python_candidates(major_version) abort
- return {
- \ 3: ['python3', 'python3.12', 'python3.11', 'python3.10', 'python3.9', 'python3.8', 'python3.7', 'python']
- \ }[a:major_version]
-endfunction
-
-" Returns [path_to_python_executable, error_message]
-function! provider#pythonx#Detect(major_version) abort
- return provider#pythonx#DetectByModule('neovim', a:major_version)
-endfunction
-
-" Returns [path_to_python_executable, error_message]
-function! provider#pythonx#DetectByModule(module, major_version) abort
- let python_exe = s:get_python_executable_from_host_var(a:major_version)
-
- if !empty(python_exe)
- return [exepath(expand(python_exe, v:true)), '']
- endif
-
- let candidates = s:get_python_candidates(a:major_version)
- let errors = []
-
- for exe in candidates
- let [result, error] = provider#pythonx#CheckForModule(exe, a:module, a:major_version)
- if result
- return [exe, error]
- endif
- " Accumulate errors in case we don't find any suitable Python executable.
- call add(errors, error)
- endfor
-
- " No suitable Python executable found.
- return ['', 'Could not load Python '.a:major_version.":\n".join(errors, "\n")]
-endfunction
-
-" Returns array: [prog_exitcode, prog_version]
-function! s:import_module(prog, module) abort
- let prog_version = system([a:prog, '-W', 'ignore', '-c', printf(
- \ 'import sys, importlib.util; ' .
- \ 'sys.path = [p for p in sys.path if p != ""]; ' .
- \ 'sys.stdout.write(str(sys.version_info[0]) + "." + str(sys.version_info[1])); ' .
- \ 'sys.exit(2 * int(importlib.util.find_spec("%s") is None))',
- \ a:module)])
- return [v:shell_error, prog_version]
-endfunction
-
-" Returns array: [was_success, error_message]
-function! provider#pythonx#CheckForModule(prog, module, major_version) abort
- let prog_path = exepath(a:prog)
- if prog_path ==# ''
- return [0, a:prog . ' not found in search path or not executable.']
- endif
-
- let min_version = '3.7'
-
- " Try to load module, and output Python version.
- " Exit codes:
- " 0 module can be loaded.
- " 2 module cannot be loaded.
- " Otherwise something else went wrong (e.g. 1 or 127).
- let [prog_exitcode, prog_version] = s:import_module(a:prog, a:module)
-
- if prog_exitcode == 2 || prog_exitcode == 0
- " Check version only for expected return codes.
- if prog_version !~ '^' . a:major_version
- return [0, prog_path . ' is Python ' . prog_version . ' and cannot provide Python '
- \ . a:major_version . '.']
- elseif prog_version =~ '^' . a:major_version && str2nr(prog_version[2:]) < str2nr(min_version[2:])
- return [0, prog_path . ' is Python ' . prog_version . ' and cannot provide Python >= '
- \ . min_version . '.']
- endif
- endif
-
- if prog_exitcode == 2
- return [0, prog_path.' does not have the "' . a:module . '" module.']
- elseif prog_exitcode == 127
- " This can happen with pyenv's shims.
- return [0, prog_path . ' does not exist: ' . prog_version]
- elseif prog_exitcode
- return [0, 'Checking ' . prog_path . ' caused an unknown error. '
- \ . '(' . prog_exitcode . ', output: ' . prog_version . ')'
- \ . ' Report this at https://github.com/neovim/neovim']
- endif
-
- return [1, '']
-endfunction
diff --git a/runtime/autoload/provider/ruby.vim b/runtime/autoload/provider/ruby.vim
index 1428fab1cc..07b4aca23f 100644
--- a/runtime/autoload/provider/ruby.vim
+++ b/runtime/autoload/provider/ruby.vim
@@ -1,73 +1,16 @@
-" The Ruby provider helper
if exists('g:loaded_ruby_provider')
finish
endif
-let g:loaded_ruby_provider = 1
-
-function! provider#ruby#Detect() abort
- let e = empty(s:prog) ? 'missing ruby or ruby-host' : ''
- return [s:prog, e]
-endfunction
-
-function! provider#ruby#Prog() abort
- return s:prog
-endfunction
function! provider#ruby#Require(host) abort
- let prog = provider#ruby#Prog()
- let ruby_plugins = remote#host#PluginsForHost(a:host.name)
-
- for plugin in ruby_plugins
- let prog .= " " . shellescape(plugin.path)
- endfor
-
- return provider#Poll(prog, a:host.orig_name, '$NVIM_RUBY_LOG_FILE')
+ return v:lua.vim.provider.ruby.require(a:host)
endfunction
function! provider#ruby#Call(method, args) abort
- if s:err != ''
- echoerr s:err
- return
- endif
-
- if !exists('s:host')
- try
- let s:host = remote#host#Require('legacy-ruby-provider')
- catch
- let s:err = v:exception
- echohl WarningMsg
- echomsg v:exception
- echohl None
- return
- endtry
- endif
- return call('rpcrequest', insert(insert(a:args, 'ruby_'.a:method), s:host))
+ return v:lua.vim.provider.ruby.call(a:method, a:args)
endfunction
-function! s:detect()
- if exists("g:ruby_host_prog")
- return expand(g:ruby_host_prog, v:true)
- elseif has('win32')
- return exepath('neovim-ruby-host.bat')
- else
- let p = exepath('neovim-ruby-host')
- if empty(p)
- return ''
- endif
- " neovim-ruby-host could be an rbenv shim for another Ruby version.
- call system(p)
- return v:shell_error ? '' : p
- end
-endfunction
-
-let s:err = ''
-let s:prog = s:detect()
-let s:plugin_path = expand('<sfile>:p:h') . '/script_host.rb'
+let s:prog = v:lua.vim.provider.ruby.detect()
let g:loaded_ruby_provider = empty(s:prog) ? 1 : 2
-
-if g:loaded_ruby_provider != 2
- let s:err = 'Cannot find the neovim RubyGem. Try :checkhealth'
-endif
-
-call remote#host#RegisterClone('legacy-ruby-provider', 'ruby')
-call remote#host#RegisterPlugin('legacy-ruby-provider', s:plugin_path, [])
+let s:plugin_path = expand('<sfile>:p:h') . '/script_host.rb'
+call v:lua.require'vim.provider.ruby'.start(s:plugin_path)
diff --git a/runtime/autoload/remote/host.vim b/runtime/autoload/remote/host.vim
index 884b478f19..0032a4b71e 100644
--- a/runtime/autoload/remote/host.vim
+++ b/runtime/autoload/remote/host.vim
@@ -190,11 +190,9 @@ endfunction
" Registration of standard hosts
-" Python/Python3
-call remote#host#Register('python', '*',
- \ function('provider#pythonx#Require'))
+" Python3
call remote#host#Register('python3', '*',
- \ function('provider#pythonx#Require'))
+ \ function('provider#python3#Require'))
" Ruby
call remote#host#Register('ruby', '*.rb',
diff --git a/runtime/autoload/rubycomplete.vim b/runtime/autoload/rubycomplete.vim
index 3677b25aeb..6ead0fd837 100644
--- a/runtime/autoload/rubycomplete.vim
+++ b/runtime/autoload/rubycomplete.vim
@@ -2,8 +2,7 @@
" Language: Ruby
" Maintainer: Mark Guzman <segfault@hasno.info>
" URL: https://github.com/vim-ruby/vim-ruby
-" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2020 Apr 12
+" Last Change: 2023 Dec 31
" ----------------------------------------------------------------------------
"
" Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com)
@@ -490,7 +489,7 @@ class VimRubyCompletion
trail = "%s%s" % [ dir, sub ]
tcfg = "%sconfig" % trail
- if File.exists?( tcfg )
+ if File.exist?( tcfg )
rails_base = trail
break
end
@@ -503,7 +502,7 @@ class VimRubyCompletion
bootfile = rails_base + "config/boot.rb"
envfile = rails_base + "config/environment.rb"
- if File.exists?( bootfile ) && File.exists?( envfile )
+ if File.exist?( bootfile ) && File.exist?( envfile )
begin
require bootfile
require envfile
diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim
index e242fe98e3..f2a74db5ed 100644
--- a/runtime/autoload/tar.vim
+++ b/runtime/autoload/tar.vim
@@ -2,7 +2,8 @@
" AUTOLOAD PORTION
" Date: Nov 14, 2023
" Version: 32b (with modifications from the Vim Project)
-" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Charles E Campbell
" License: Vim License (see vim's :help license)
"
" Contains many ideas from Michael Toren's <tar.vim>
@@ -163,9 +164,9 @@ fun! tar#Browse(tarfile)
" call Decho("1: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
- elseif tarfile =~# '\.\(tgz\)$' || tarfile =~# '\.\(tbz\)$' || tarfile =~# '\.\(txz\)$' || tarfile =~# '\.\(tzs\)$'
+ elseif tarfile =~# '\.\(tgz\)$' || tarfile =~# '\.\(tbz\)$' || tarfile =~# '\.\(txz\)$' || tarfile =~# '\.\(tzst\)$'
if has("unix") && executable("file")
- let filekind= system("file ".shellescape(tarfile,1)) =~ "bzip2"
+ let filekind= system("file ".shellescape(tarfile,1))
else
let filekind= ""
endif
@@ -192,7 +193,7 @@ fun! tar#Browse(tarfile)
elseif tarfile =~# '\.\(xz\|txz\)$'
" call Decho("3: exe silent r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
exe "sil! r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
- elseif tarfile =~# '\.\(zst\|tzs\)$'
+ elseif tarfile =~# '\.\(zst\|tzst\)$'
exe "sil! r! zstd --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
else
if tarfile =~ '^\s*-'
@@ -230,7 +231,7 @@ fun! tar#Browse(tarfile)
" set up maps supported for tar
setlocal noma nomod ro
noremap <silent> <buffer> <cr> :call <SID>TarBrowseSelect()<cr>
- noremap <silent> <buffer> x :call tar#Extract()<cr>
+ noremap <silent> <buffer> x :call tar#Extract()<cr>
if &mouse != ""
noremap <silent> <buffer> <leftmouse> <leftmouse>:call <SID>TarBrowseSelect()<cr>
endif
@@ -468,9 +469,9 @@ fun! tar#Write(fname)
let compress= "xz -- ".shellescape(tarfile,0)
" call Decho("compress<".compress.">")
elseif tarfile =~# '\.zst'
- call system("zstd --decompress -- ".shellescape(tarfile,0))
+ call system("zstd --decompress --rm -- ".shellescape(tarfile,0))
let tarfile = substitute(tarfile,'\.zst','','e')
- let compress= "zstd -- ".shellescape(tarfile,0)
+ let compress= "zstd --rm -- ".shellescape(tarfile,0)
elseif tarfile =~# '\.lzma'
call system("lzma -d -- ".shellescape(tarfile,0))
let tarfile = substitute(tarfile,'\.lzma','','e')
@@ -486,7 +487,7 @@ fun! tar#Write(fname)
else
" call Decho("tarfile<".tarfile."> fname<".fname.">")
-
+
if fname =~ '/'
let dirpath = substitute(fname,'/[^/]\+$','','e')
if has("win32unix") && executable("cygpath")
@@ -502,7 +503,7 @@ fun! tar#Write(fname)
let tarfile = substitute(tarfile, '-', './-', '')
endif
" call Decho("tarfile<".tarfile."> fname<".fname.">")
-
+
if exists("g:tar_secure")
let tar_secure= " -- "
else
@@ -512,7 +513,7 @@ fun! tar#Write(fname)
if has("win32unix") && executable("cygpath")
let tarfile = substitute(system("cygpath ".shellescape(tarfile,0)),'\n','','e')
endif
-
+
" delete old file from tarfile
" call Decho("system(".g:tar_cmd." ".g:tar_delfile." ".shellescape(tarfile,0)." -- ".shellescape(fname,0).")")
call system(g:tar_cmd." ".g:tar_delfile." ".shellescape(tarfile,0).tar_secure.shellescape(fname,0))
@@ -521,8 +522,8 @@ fun! tar#Write(fname)
" call Decho("***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname))
echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname) | echohl None
else
-
- " update tarfile with new file
+
+ " update tarfile with new file
" call Decho(g:tar_cmd." -".g:tar_writeoptions." ".shellescape(tarfile,0).tar_secure.shellescape(fname,0))
call system(g:tar_cmd." -".g:tar_writeoptions." ".shellescape(tarfile,0).tar_secure.shellescape(fname,0))
if v:shell_error != 0
@@ -555,7 +556,7 @@ fun! tar#Write(fname)
unlet s:tblfile_{winnr()}
endif
endif
-
+
" cleanup and restore current directory
cd ..
call s:Rmdir("_ZIPVIM_")
@@ -696,13 +697,13 @@ fun! tar#Extract()
echo "***note*** successfully extracted ".fname
endif
- elseif filereadable(tarbase.".tzs")
+ elseif filereadable(tarbase.".tzst")
let extractcmd= substitute(extractcmd,"-","--zstd","")
-" call Decho("system(".extractcmd." ".shellescape(tarbase).".tzs ".shellescape(fname).")")
- call system(extractcmd." ".shellescape(tarbase).".txz ".shellescape(fname))
+" call Decho("system(".extractcmd." ".shellescape(tarbase).".tzst ".shellescape(fname).")")
+ call system(extractcmd." ".shellescape(tarbase).".tzst ".shellescape(fname))
if v:shell_error != 0
- echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tzs ".fname.": failed!" | echohl NONE
-" call Decho("***error*** ".extractcmd." ".tarbase.".tzs ".fname.": failed!")
+ echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tzst ".fname.": failed!" | echohl NONE
+" call Decho("***error*** ".extractcmd." ".tarbase.".tzst ".fname.": failed!")
else
echo "***note*** successfully extracted ".fname
endif
@@ -710,7 +711,7 @@ fun! tar#Extract()
elseif filereadable(tarbase.".tar.zst")
let extractcmd= substitute(extractcmd,"-","--zstd","")
" call Decho("system(".extractcmd." ".shellescape(tarbase).".tar.zst ".shellescape(fname).")")
- call system(extractcmd." ".shellescape(tarbase).".tar.xz ".shellescape(fname))
+ call system(extractcmd." ".shellescape(tarbase).".tar.zst ".shellescape(fname))
if v:shell_error != 0
echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tar.zst ".fname.": failed!" | echohl NONE
" call Decho("***error*** ".extractcmd." ".tarbase.".tar.zst ".fname.": failed!")
diff --git a/runtime/autoload/tohtml.vim b/runtime/autoload/tohtml.vim
deleted file mode 100644
index b1693efc5d..0000000000
--- a/runtime/autoload/tohtml.vim
+++ /dev/null
@@ -1,951 +0,0 @@
-" Vim autoload file for the tohtml plugin.
-" Maintainer: Ben Fritz <fritzophrenic@gmail.com>
-" Last Change: 2023 Sep 03
-"
-" Additional contributors:
-"
-" Original by Bram Moolenaar <Bram@vim.org>
-" Diff2HTML() added by Christian Brabandt <cb@256bit.org>
-"
-" See Mercurial change logs for more!
-
-" this file uses line continuations
-let s:cpo_sav = &cpo
-set cpo&vim
-
-" Automatically find charsets from all encodings supported natively by Vim. With
-" the 8bit- and 2byte- prefixes, Vim can actually support more encodings than
-" this. Let the user specify these however since they won't be supported on
-" every system.
-"
-" Note, not all of Vim's supported encodings have a charset to use.
-"
-" Names in this list are from:
-" http://www.iana.org/assignments/character-sets
-" g:tohtml#encoding_to_charset: {{{
-let g:tohtml#encoding_to_charset = {
- \ 'latin1' : 'ISO-8859-1',
- \ 'iso-8859-2' : 'ISO-8859-2',
- \ 'iso-8859-3' : 'ISO-8859-3',
- \ 'iso-8859-4' : 'ISO-8859-4',
- \ 'iso-8859-5' : 'ISO-8859-5',
- \ 'iso-8859-6' : 'ISO-8859-6',
- \ 'iso-8859-7' : 'ISO-8859-7',
- \ 'iso-8859-8' : 'ISO-8859-8',
- \ 'iso-8859-9' : 'ISO-8859-9',
- \ 'iso-8859-10' : '',
- \ 'iso-8859-13' : 'ISO-8859-13',
- \ 'iso-8859-14' : '',
- \ 'iso-8859-15' : 'ISO-8859-15',
- \ 'koi8-r' : 'KOI8-R',
- \ 'koi8-u' : 'KOI8-U',
- \ 'macroman' : 'macintosh',
- \ 'cp437' : '',
- \ 'cp775' : '',
- \ 'cp850' : '',
- \ 'cp852' : '',
- \ 'cp855' : '',
- \ 'cp857' : '',
- \ 'cp860' : '',
- \ 'cp861' : '',
- \ 'cp862' : '',
- \ 'cp863' : '',
- \ 'cp865' : '',
- \ 'cp866' : 'IBM866',
- \ 'cp869' : '',
- \ 'cp874' : '',
- \ 'cp1250' : 'windows-1250',
- \ 'cp1251' : 'windows-1251',
- \ 'cp1253' : 'windows-1253',
- \ 'cp1254' : 'windows-1254',
- \ 'cp1255' : 'windows-1255',
- \ 'cp1256' : 'windows-1256',
- \ 'cp1257' : 'windows-1257',
- \ 'cp1258' : 'windows-1258',
- \ 'euc-jp' : 'EUC-JP',
- \ 'sjis' : 'Shift_JIS',
- \ 'cp932' : 'Shift_JIS',
- \ 'cp949' : '',
- \ 'euc-kr' : 'EUC-KR',
- \ 'cp936' : 'GBK',
- \ 'euc-cn' : 'GB2312',
- \ 'big5' : 'Big5',
- \ 'cp950' : 'Big5',
- \ 'utf-8' : 'UTF-8',
- \ 'ucs-2' : 'UTF-8',
- \ 'ucs-2le' : 'UTF-8',
- \ 'utf-16' : 'UTF-8',
- \ 'utf-16le' : 'UTF-8',
- \ 'ucs-4' : 'UTF-8',
- \ 'ucs-4le' : 'UTF-8',
- \ }
-lockvar g:tohtml#encoding_to_charset
-" Notes:
-" 1. All UCS/UTF are converted to UTF-8 because it is much better supported
-" 2. Any blank spaces are there because Vim supports it but at least one major
-" web browser does not according to http://wiki.whatwg.org/wiki/Web_Encodings.
-" }}}
-
-" Only automatically find encodings supported natively by Vim, let the user
-" specify the encoding if it's not natively supported. This function is only
-" used when the user specifies the charset, they better know what they are
-" doing!
-"
-" Names in this list are from:
-" http://www.iana.org/assignments/character-sets
-" g:tohtml#charset_to_encoding: {{{
-let g:tohtml#charset_to_encoding = {
- \ 'iso_8859-1:1987' : 'latin1',
- \ 'iso-ir-100' : 'latin1',
- \ 'iso_8859-1' : 'latin1',
- \ 'iso-8859-1' : 'latin1',
- \ 'latin1' : 'latin1',
- \ 'l1' : 'latin1',
- \ 'ibm819' : 'latin1',
- \ 'cp819' : 'latin1',
- \ 'csisolatin1' : 'latin1',
- \ 'iso_8859-2:1987' : 'iso-8859-2',
- \ 'iso-ir-101' : 'iso-8859-2',
- \ 'iso_8859-2' : 'iso-8859-2',
- \ 'iso-8859-2' : 'iso-8859-2',
- \ 'latin2' : 'iso-8859-2',
- \ 'l2' : 'iso-8859-2',
- \ 'csisolatin2' : 'iso-8859-2',
- \ 'iso_8859-3:1988' : 'iso-8859-3',
- \ 'iso-ir-109' : 'iso-8859-3',
- \ 'iso_8859-3' : 'iso-8859-3',
- \ 'iso-8859-3' : 'iso-8859-3',
- \ 'latin3' : 'iso-8859-3',
- \ 'l3' : 'iso-8859-3',
- \ 'csisolatin3' : 'iso-8859-3',
- \ 'iso_8859-4:1988' : 'iso-8859-4',
- \ 'iso-ir-110' : 'iso-8859-4',
- \ 'iso_8859-4' : 'iso-8859-4',
- \ 'iso-8859-4' : 'iso-8859-4',
- \ 'latin4' : 'iso-8859-4',
- \ 'l4' : 'iso-8859-4',
- \ 'csisolatin4' : 'iso-8859-4',
- \ 'iso_8859-5:1988' : 'iso-8859-5',
- \ 'iso-ir-144' : 'iso-8859-5',
- \ 'iso_8859-5' : 'iso-8859-5',
- \ 'iso-8859-5' : 'iso-8859-5',
- \ 'cyrillic' : 'iso-8859-5',
- \ 'csisolatincyrillic' : 'iso-8859-5',
- \ 'iso_8859-6:1987' : 'iso-8859-6',
- \ 'iso-ir-127' : 'iso-8859-6',
- \ 'iso_8859-6' : 'iso-8859-6',
- \ 'iso-8859-6' : 'iso-8859-6',
- \ 'ecma-114' : 'iso-8859-6',
- \ 'asmo-708' : 'iso-8859-6',
- \ 'arabic' : 'iso-8859-6',
- \ 'csisolatinarabic' : 'iso-8859-6',
- \ 'iso_8859-7:1987' : 'iso-8859-7',
- \ 'iso-ir-126' : 'iso-8859-7',
- \ 'iso_8859-7' : 'iso-8859-7',
- \ 'iso-8859-7' : 'iso-8859-7',
- \ 'elot_928' : 'iso-8859-7',
- \ 'ecma-118' : 'iso-8859-7',
- \ 'greek' : 'iso-8859-7',
- \ 'greek8' : 'iso-8859-7',
- \ 'csisolatingreek' : 'iso-8859-7',
- \ 'iso_8859-8:1988' : 'iso-8859-8',
- \ 'iso-ir-138' : 'iso-8859-8',
- \ 'iso_8859-8' : 'iso-8859-8',
- \ 'iso-8859-8' : 'iso-8859-8',
- \ 'hebrew' : 'iso-8859-8',
- \ 'csisolatinhebrew' : 'iso-8859-8',
- \ 'iso_8859-9:1989' : 'iso-8859-9',
- \ 'iso-ir-148' : 'iso-8859-9',
- \ 'iso_8859-9' : 'iso-8859-9',
- \ 'iso-8859-9' : 'iso-8859-9',
- \ 'latin5' : 'iso-8859-9',
- \ 'l5' : 'iso-8859-9',
- \ 'csisolatin5' : 'iso-8859-9',
- \ 'iso-8859-10' : 'iso-8859-10',
- \ 'iso-ir-157' : 'iso-8859-10',
- \ 'l6' : 'iso-8859-10',
- \ 'iso_8859-10:1992' : 'iso-8859-10',
- \ 'csisolatin6' : 'iso-8859-10',
- \ 'latin6' : 'iso-8859-10',
- \ 'iso-8859-13' : 'iso-8859-13',
- \ 'iso-8859-14' : 'iso-8859-14',
- \ 'iso-ir-199' : 'iso-8859-14',
- \ 'iso_8859-14:1998' : 'iso-8859-14',
- \ 'iso_8859-14' : 'iso-8859-14',
- \ 'latin8' : 'iso-8859-14',
- \ 'iso-celtic' : 'iso-8859-14',
- \ 'l8' : 'iso-8859-14',
- \ 'iso-8859-15' : 'iso-8859-15',
- \ 'iso_8859-15' : 'iso-8859-15',
- \ 'latin-9' : 'iso-8859-15',
- \ 'koi8-r' : 'koi8-r',
- \ 'cskoi8r' : 'koi8-r',
- \ 'koi8-u' : 'koi8-u',
- \ 'macintosh' : 'macroman',
- \ 'mac' : 'macroman',
- \ 'csmacintosh' : 'macroman',
- \ 'ibm437' : 'cp437',
- \ 'cp437' : 'cp437',
- \ '437' : 'cp437',
- \ 'cspc8codepage437' : 'cp437',
- \ 'ibm775' : 'cp775',
- \ 'cp775' : 'cp775',
- \ 'cspc775baltic' : 'cp775',
- \ 'ibm850' : 'cp850',
- \ 'cp850' : 'cp850',
- \ '850' : 'cp850',
- \ 'cspc850multilingual' : 'cp850',
- \ 'ibm852' : 'cp852',
- \ 'cp852' : 'cp852',
- \ '852' : 'cp852',
- \ 'cspcp852' : 'cp852',
- \ 'ibm855' : 'cp855',
- \ 'cp855' : 'cp855',
- \ '855' : 'cp855',
- \ 'csibm855' : 'cp855',
- \ 'ibm857' : 'cp857',
- \ 'cp857' : 'cp857',
- \ '857' : 'cp857',
- \ 'csibm857' : 'cp857',
- \ 'ibm860' : 'cp860',
- \ 'cp860' : 'cp860',
- \ '860' : 'cp860',
- \ 'csibm860' : 'cp860',
- \ 'ibm861' : 'cp861',
- \ 'cp861' : 'cp861',
- \ '861' : 'cp861',
- \ 'cp-is' : 'cp861',
- \ 'csibm861' : 'cp861',
- \ 'ibm862' : 'cp862',
- \ 'cp862' : 'cp862',
- \ '862' : 'cp862',
- \ 'cspc862latinhebrew' : 'cp862',
- \ 'ibm863' : 'cp863',
- \ 'cp863' : 'cp863',
- \ '863' : 'cp863',
- \ 'csibm863' : 'cp863',
- \ 'ibm865' : 'cp865',
- \ 'cp865' : 'cp865',
- \ '865' : 'cp865',
- \ 'csibm865' : 'cp865',
- \ 'ibm866' : 'cp866',
- \ 'cp866' : 'cp866',
- \ '866' : 'cp866',
- \ 'csibm866' : 'cp866',
- \ 'ibm869' : 'cp869',
- \ 'cp869' : 'cp869',
- \ '869' : 'cp869',
- \ 'cp-gr' : 'cp869',
- \ 'csibm869' : 'cp869',
- \ 'windows-1250' : 'cp1250',
- \ 'windows-1251' : 'cp1251',
- \ 'windows-1253' : 'cp1253',
- \ 'windows-1254' : 'cp1254',
- \ 'windows-1255' : 'cp1255',
- \ 'windows-1256' : 'cp1256',
- \ 'windows-1257' : 'cp1257',
- \ 'windows-1258' : 'cp1258',
- \ 'extended_unix_code_packed_format_for_japanese' : 'euc-jp',
- \ 'cseucpkdfmtjapanese' : 'euc-jp',
- \ 'euc-jp' : 'euc-jp',
- \ 'shift_jis' : 'sjis',
- \ 'ms_kanji' : 'sjis',
- \ 'sjis' : 'sjis',
- \ 'csshiftjis' : 'sjis',
- \ 'ibm-thai' : 'cp874',
- \ 'csibmthai' : 'cp874',
- \ 'ks_c_5601-1987' : 'cp949',
- \ 'iso-ir-149' : 'cp949',
- \ 'ks_c_5601-1989' : 'cp949',
- \ 'ksc_5601' : 'cp949',
- \ 'korean' : 'cp949',
- \ 'csksc56011987' : 'cp949',
- \ 'euc-kr' : 'euc-kr',
- \ 'cseuckr' : 'euc-kr',
- \ 'gbk' : 'cp936',
- \ 'cp936' : 'cp936',
- \ 'ms936' : 'cp936',
- \ 'windows-936' : 'cp936',
- \ 'gb_2312-80' : 'euc-cn',
- \ 'iso-ir-58' : 'euc-cn',
- \ 'chinese' : 'euc-cn',
- \ 'csiso58gb231280' : 'euc-cn',
- \ 'big5' : 'big5',
- \ 'csbig5' : 'big5',
- \ 'utf-8' : 'utf-8',
- \ 'iso-10646-ucs-2' : 'ucs-2',
- \ 'csunicode' : 'ucs-2',
- \ 'utf-16' : 'utf-16',
- \ 'utf-16be' : 'utf-16',
- \ 'utf-16le' : 'utf-16le',
- \ 'utf-32' : 'ucs-4',
- \ 'utf-32be' : 'ucs-4',
- \ 'utf-32le' : 'ucs-4le',
- \ 'iso-10646-ucs-4' : 'ucs-4',
- \ 'csucs4' : 'ucs-4'
- \ }
-lockvar g:tohtml#charset_to_encoding
-"}}}
-
-func! tohtml#Convert2HTML(line1, line2) "{{{
- let s:settings = tohtml#GetUserSettings()
-
- if !&diff || s:settings.diff_one_file "{{{
- if a:line2 >= a:line1
- let g:html_start_line = a:line1
- let g:html_end_line = a:line2
- else
- let g:html_start_line = a:line2
- let g:html_end_line = a:line1
- endif
- runtime syntax/2html.vim "}}}
- else "{{{
- let win_list = []
- let buf_list = []
- windo if &diff | call add(win_list, winbufnr(0)) | endif
- let s:settings.whole_filler = 1
- let g:html_diff_win_num = 0
- for window in win_list
- " switch to the next buffer to convert
- exe ":" .. bufwinnr(window) .. "wincmd w"
-
- " figure out whether current charset and encoding will work, if not
- " default to UTF-8
- if !exists('g:html_use_encoding') &&
- \ (((&l:fileencoding=='' || (&l:buftype!='' && &l:buftype!=?'help'))
- \ && &encoding!=?s:settings.vim_encoding)
- \ || &l:fileencoding!='' && &l:fileencoding!=?s:settings.vim_encoding)
- echohl WarningMsg
- echomsg "TOhtml: mismatched file encodings in Diff buffers, using UTF-8"
- echohl None
- let s:settings.vim_encoding = 'utf-8'
- let s:settings.encoding = 'UTF-8'
- endif
-
- " set up for diff-mode conversion
- let g:html_start_line = 1
- let g:html_end_line = line('$')
- let g:html_diff_win_num += 1
-
- " convert this file
- runtime syntax/2html.vim
-
- " remember the HTML buffer for later combination
- call add(buf_list, bufnr('%'))
- endfor
- unlet g:html_diff_win_num
- call tohtml#Diff2HTML(win_list, buf_list)
- endif "}}}
-
- unlet g:html_start_line
- unlet g:html_end_line
- unlet s:settings
-endfunc "}}}
-
-func! tohtml#Diff2HTML(win_list, buf_list) "{{{
- let xml_line = ""
- let tag_close = '>'
-
- let s:old_paste = &paste
- set paste
- let s:old_magic = &magic
- set magic
-
- let html = []
- if !s:settings.no_doc
- if s:settings.use_xhtml
- if s:settings.encoding != ""
- let xml_line = "<?xml version=\"1.0\" encoding=\"" .. s:settings.encoding .. "\"?>"
- else
- let xml_line = "<?xml version=\"1.0\"?>"
- endif
- let tag_close = ' />'
- endif
-
- let style = [s:settings.use_xhtml ? "" : '-->']
- let body_line = ''
-
- let s:html5 = 0
- if s:settings.use_xhtml
- call add(html, xml_line)
- endif
- if s:settings.use_xhtml
- call add(html, "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">")
- call add(html, '<html xmlns="http://www.w3.org/1999/xhtml">')
- elseif s:settings.use_css && !s:settings.no_pre
- call add(html, "<!DOCTYPE html>")
- call add(html, '<html>')
- let s:html5 = 1
- else
- call add(html, '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"')
- call add(html, ' "http://www.w3.org/TR/html4/loose.dtd">')
- call add(html, '<html>')
- endif
- call add(html, '<head>')
-
- " include encoding as close to the top as possible, but only if not already
- " contained in XML information
- if s:settings.encoding != "" && !s:settings.use_xhtml
- if s:html5
- call add(html, '<meta charset="' .. s:settings.encoding .. '"' .. tag_close)
- else
- call add(html, "<meta http-equiv=\"content-type\" content=\"text/html; charset=" .. s:settings.encoding .. '"' .. tag_close)
- endif
- endif
-
- call add(html, '<title>diff</title>')
- call add(html, '<meta name="Generator" content="Vim/'..v:version/100..'.'..v:version%100..'"'..tag_close)
- call add(html, '<meta name="plugin-version" content="'..g:loaded_2html_plugin..'"'..tag_close)
- call add(html, '<meta name="settings" content="'.
- \ join(filter(keys(s:settings),'s:settings[v:val]'),',').
- \ ',prevent_copy='..s:settings.prevent_copy.
- \ ',use_input_for_pc='..s:settings.use_input_for_pc.
- \ '"'..tag_close)
- call add(html, '<meta name="colorscheme" content="'.
- \ (exists('g:colors_name')
- \ ? g:colors_name
- \ : 'none').. '"'..tag_close)
-
- call add(html, '</head>')
- let body_line_num = len(html)
- call add(html, '<body'..(s:settings.line_ids ? ' onload="JumpToLine();"' : '')..'>')
- endif
- call add(html, "<table "..(s:settings.use_css? "" : "border='1' width='100%' ").."id='vimCodeElement"..s:settings.id_suffix.."'>")
-
- call add(html, '<tr>')
- for buf in a:win_list
- call add(html, '<th>'..bufname(buf)..'</th>')
- endfor
- call add(html, '</tr><tr>')
-
- let diff_style_start = 0
- let insert_index = 0
-
- for buf in a:buf_list
- let temp = []
- exe bufwinnr(buf) .. 'wincmd w'
-
- " If text is folded because of user foldmethod settings, etc. we don't want
- " to act on everything in a fold by mistake.
- setlocal nofoldenable
-
- " When not using CSS or when using xhtml, the <body> line can be important.
- " Assume it will be the same for all buffers and grab it from the first
- " buffer. Similarly, need to grab the body end line as well.
- if !s:settings.no_doc
- if body_line == ''
- 1
- call search('<body')
- let body_line = getline('.')
- $
- call search('</body>', 'b')
- let s:body_end_line = getline('.')
- endif
-
- " Grab the style information. Some of this will be duplicated so only insert
- " it if it's not already there. {{{
- 1
- let style_start = search('^<style\( type="text/css"\)\?>')
- 1
- let style_end = search('^</style>')
- if style_start > 0 && style_end > 0
- let buf_styles = getline(style_start + 1, style_end - 1)
- for a_style in buf_styles
- if index(style, a_style) == -1
- if diff_style_start == 0
- if a_style =~ '\<Diff\(Change\|Text\|Add\|Delete\)'
- let diff_style_start = len(style)-1
- endif
- endif
- call insert(style, a_style, insert_index)
- let insert_index += 1
- endif
- endfor
- endif " }}}
-
- " everything new will get added before the diff styles so diff highlight
- " properly overrides normal highlight
- if diff_style_start != 0
- let insert_index = diff_style_start
- endif
-
- " Delete those parts that are not needed so we can include the rest into the
- " resulting table.
- 1,/^<body.*\%(\n<!--.*-->\_s\+.*id='oneCharWidth'.*\_s\+.*id='oneInputWidth'.*\_s\+.*id='oneEmWidth'\)\?\zs/d_
- $
- ?</body>?,$d_
- elseif !s:settings.no_modeline
- " remove modeline from source files if it is included and we haven't deleted
- " due to removing html footer already
- $d
- endif
- let temp = getline(1,'$')
- " clean out id on the main content container because we already set it on
- " the table
- let temp[0] = substitute(temp[0], " id='vimCodeElement[^']*'", "", "")
- " undo deletion of start and end part
- " so we can later save the file as valid html
- " TODO: restore using grabbed lines if undolevel is 1?
- if !s:settings.no_doc
- normal! 2u
- elseif !s:settings.no_modeline
- normal! u
- endif
- if s:settings.use_css
- call add(html, '<td><div>')
- elseif s:settings.use_xhtml
- call add(html, '<td nowrap="nowrap" valign="top"><div>')
- else
- call add(html, '<td nowrap valign="top"><div>')
- endif
- let html += temp
- call add(html, '</div></td>')
-
- " Close this buffer
- " TODO: the comment above says we're going to allow saving the file
- " later...but here we discard it?
- quit!
- endfor
-
- if !s:settings.no_doc
- let html[body_line_num] = body_line
- endif
-
- call add(html, '</tr>')
- call add(html, '</table>')
- if !s:settings.no_doc
- call add(html, s:body_end_line)
- call add(html, '</html>')
- endif
-
- " The generated HTML is admittedly ugly and takes a LONG time to fold.
- " Make sure the user doesn't do syntax folding when loading a generated file,
- " using a modeline.
- if !s:settings.no_modeline
- call add(html, '<!-- vim: set foldmethod=manual : -->')
- endif
-
- let i = 1
- let name = "Diff" .. (s:settings.use_xhtml ? ".xhtml" : ".html")
- " Find an unused file name if current file name is already in use
- while filereadable(name)
- let name = substitute(name, '\d*\.x\?html$', '', '') .. i .. '.' .. fnamemodify(copy(name), ":t:e")
- let i += 1
- endwhile
-
- let s:ei_sav = &eventignore
- set eventignore+=FileType
- exe "topleft new " .. name
- let &eventignore=s:ei_sav
- unlet s:ei_sav
-
- setlocal modifiable
-
- " just in case some user autocmd creates content in the new buffer, make sure
- " it is empty before proceeding
- %d
-
- " set the fileencoding to match the charset we'll be using
- let &l:fileencoding=s:settings.vim_encoding
-
- " According to http://www.w3.org/TR/html4/charset.html#doc-char-set, the byte
- " order mark is highly recommend on the web when using multibyte encodings. But,
- " it is not a good idea to include it on UTF-8 files. Otherwise, let Vim
- " determine when it is actually inserted.
- if s:settings.vim_encoding == 'utf-8'
- setlocal nobomb
- else
- setlocal bomb
- endif
-
- call append(0, html)
-
- if !s:settings.no_doc
- if len(style) > 0
- 1
- let style_start = search('^</head>')-1
-
- " add required javascript in reverse order so we can just call append again
- " and again without adjusting {{{
-
- let s:uses_script = s:settings.dynamic_folds || s:settings.line_ids
-
- " insert script closing tag if needed
- if s:uses_script
- call append(style_start, [
- \ '',
- \ s:settings.use_xhtml ? '//]]>' : '-->',
- \ "</script>"
- \ ])
- endif
-
- " insert javascript to get IDs from line numbers, and to open a fold before
- " jumping to any lines contained therein
- if s:settings.line_ids
- call append(style_start, [
- \ " /* Always jump to new location even if the line was hidden inside a fold, or",
- \ " * we corrected the raw number to a line ID.",
- \ " */",
- \ " if (lineElem) {",
- \ " lineElem.scrollIntoView(true);",
- \ " }",
- \ " return true;",
- \ "}",
- \ "if ('onhashchange' in window) {",
- \ " window.onhashchange = JumpToLine;",
- \ "}"
- \ ])
-
- if s:settings.dynamic_folds
- call append(style_start, [
- \ "",
- \ " /* navigate upwards in the DOM tree to open all folds containing the line */",
- \ " var node = lineElem;",
- \ " while (node && node.id != 'vimCodeElement"..s:settings.id_suffix.."')",
- \ " {",
- \ " if (node.className == 'closed-fold')",
- \ " {",
- \ " /* toggle open the fold ID (remove window ID) */",
- \ " toggleFold(node.id.substr(4));",
- \ " }",
- \ " node = node.parentNode;",
- \ " }",
- \ ])
- endif
- endif
-
- if s:settings.line_ids
- call append(style_start, [
- \ "",
- \ "/* function to open any folds containing a jumped-to line before jumping to it */",
- \ "function JumpToLine()",
- \ "{",
- \ " var lineNum;",
- \ " lineNum = window.location.hash;",
- \ " lineNum = lineNum.substr(1); /* strip off '#' */",
- \ "",
- \ " if (lineNum.indexOf('L') == -1) {",
- \ " lineNum = 'L'+lineNum;",
- \ " }",
- \ " if (lineNum.indexOf('W') == -1) {",
- \ " lineNum = 'W1'+lineNum;",
- \ " }",
- \ " var lineElem = document.getElementById(lineNum);"
- \ ])
- endif
-
- " Insert javascript to toggle matching folds open and closed in all windows,
- " if dynamic folding is active.
- if s:settings.dynamic_folds
- call append(style_start, [
- \ " function toggleFold(objID)",
- \ " {",
- \ " for (win_num = 1; win_num <= "..len(a:buf_list).."; win_num++)",
- \ " {",
- \ " var fold;",
- \ ' fold = document.getElementById("win"+win_num+objID);',
- \ " if(fold.className == 'closed-fold')",
- \ " {",
- \ " fold.className = 'open-fold';",
- \ " }",
- \ " else if (fold.className == 'open-fold')",
- \ " {",
- \ " fold.className = 'closed-fold';",
- \ " }",
- \ " }",
- \ " }",
- \ ])
- endif
-
- if s:uses_script
- " insert script tag if needed
- call append(style_start, [
- \ "<script" .. (s:html5 ? "" : " type='text/javascript'") .. ">",
- \ s:settings.use_xhtml ? '//<![CDATA[' : "<!--"])
- endif
-
- " Insert styles from all the generated html documents and additional styles
- " for the table-based layout of the side-by-side diff. The diff should take
- " up the full browser window (but not more), and be static in size,
- " horizontally scrollable when the lines are too long. Otherwise, the diff
- " is pretty useless for really long lines. {{{
- if s:settings.use_css
- call append(style_start,
- \ ['<style' .. (s:html5 ? '' : 'type="text/css"') .. '>']+
- \ style+
- \ [ s:settings.use_xhtml ? '' : '<!--',
- \ 'table { table-layout: fixed; }',
- \ 'html, body, table, tbody { width: 100%; margin: 0; padding: 0; }',
- \ 'table, td, th { border: 1px solid; }',
- \ 'td { vertical-align: top; }',
- \ 'th, td { width: '..printf("%.1f",100.0/len(a:win_list))..'%; }',
- \ 'td div { overflow: auto; }',
- \ s:settings.use_xhtml ? '' : '-->',
- \ '</style>'
- \])
- endif "}}}
- endif
- endif
-
- let &paste = s:old_paste
- let &magic = s:old_magic
-endfunc "}}}
-
-" Gets a single user option and sets it in the passed-in Dict, or gives it the
-" default value if the option doesn't actually exist.
-func! tohtml#GetOption(settings, option, default) "{{{
- if exists('g:html_'..a:option)
- let a:settings[a:option] = g:html_{a:option}
- else
- let a:settings[a:option] = a:default
- endif
-endfunc "}}}
-
-" returns a Dict containing the values of all user options for 2html, including
-" default values for those not given an explicit value by the user. Discards the
-" html_ prefix of the option for nicer looking code.
-func! tohtml#GetUserSettings() "{{{
- if exists('s:settings')
- " just restore the known options if we've already retrieved them
- return s:settings
- else
- " otherwise figure out which options are set
- let user_settings = {}
-
- " Define the correct option if the old option name exists and we haven't
- " already defined the correct one.
- if exists('g:use_xhtml') && !exists("g:html_use_xhtml")
- echohl WarningMsg
- echomsg "Warning: g:use_xhtml is deprecated, use g:html_use_xhtml"
- echohl None
- let g:html_use_xhtml = g:use_xhtml
- endif
-
- " get current option settings with appropriate defaults {{{
- call tohtml#GetOption(user_settings, 'no_progress', !has("statusline") )
- call tohtml#GetOption(user_settings, 'diff_one_file', 0 )
- call tohtml#GetOption(user_settings, 'number_lines', &number )
- call tohtml#GetOption(user_settings, 'pre_wrap', &wrap )
- call tohtml#GetOption(user_settings, 'use_css', 1 )
- call tohtml#GetOption(user_settings, 'ignore_conceal', 0 )
- call tohtml#GetOption(user_settings, 'ignore_folding', 0 )
- call tohtml#GetOption(user_settings, 'dynamic_folds', 0 )
- call tohtml#GetOption(user_settings, 'no_foldcolumn', user_settings.ignore_folding)
- call tohtml#GetOption(user_settings, 'hover_unfold', 0 )
- call tohtml#GetOption(user_settings, 'no_pre', 0 )
- call tohtml#GetOption(user_settings, 'no_doc', 0 )
- call tohtml#GetOption(user_settings, 'no_links', 0 )
- call tohtml#GetOption(user_settings, 'no_modeline', 0 )
- call tohtml#GetOption(user_settings, 'no_invalid', 0 )
- call tohtml#GetOption(user_settings, 'whole_filler', 0 )
- call tohtml#GetOption(user_settings, 'use_xhtml', 0 )
- call tohtml#GetOption(user_settings, 'line_ids', user_settings.number_lines )
- call tohtml#GetOption(user_settings, 'use_input_for_pc', 'none')
- " }}}
-
- " override those settings that need it {{{
-
- " hover opening implies dynamic folding
- if user_settings.hover_unfold
- let user_settings.dynamic_folds = 1
- endif
-
- " ignore folding overrides dynamic folding
- if user_settings.ignore_folding && user_settings.dynamic_folds
- let user_settings.dynamic_folds = 0
- let user_settings.hover_unfold = 0
- endif
-
- " dynamic folding with no foldcolumn implies hover opens
- if user_settings.dynamic_folds && user_settings.no_foldcolumn
- let user_settings.hover_unfold = 1
- endif
-
- " dynamic folding implies css
- if user_settings.dynamic_folds
- let user_settings.use_css = 1
- else
- let user_settings.no_foldcolumn = 1 " won't do anything but for consistency and for the test suite
- endif
-
- " if we're not using CSS we cannot use a pre section because <font> tags
- " aren't allowed inside a <pre> block
- if !user_settings.use_css
- let user_settings.no_pre = 1
- endif
-
- " pre_wrap doesn't do anything if not using pre or not using CSS
- if user_settings.no_pre || !user_settings.use_css
- let user_settings.pre_wrap = 0
- endif
- "}}}
-
- " set up expand_tabs option after all the overrides so we know the
- " appropriate defaults {{{
- if user_settings.no_pre == 0
- call tohtml#GetOption(user_settings,
- \ 'expand_tabs',
- \ &expandtab || &ts != 8 || (exists("+vts") && &vts != '') || user_settings.number_lines ||
- \ (user_settings.dynamic_folds && !user_settings.no_foldcolumn))
- else
- let user_settings.expand_tabs = 1
- endif
- " }}}
-
- " textual options
- if exists("g:html_use_encoding") "{{{
- " user specified the desired MIME charset, figure out proper
- " 'fileencoding' from it or warn the user if we cannot
- let user_settings.encoding = g:html_use_encoding
- let user_settings.vim_encoding = tohtml#EncodingFromCharset(g:html_use_encoding)
- if user_settings.vim_encoding == ''
- echohl WarningMsg
- echomsg "TOhtml: file encoding for"
- \ g:html_use_encoding
- \ "unknown, please set 'fileencoding'"
- echohl None
- endif
- else
- " Figure out proper MIME charset from 'fileencoding' if possible
- if &l:fileencoding != ''
- " If the buffer is not a "normal" type, the 'fileencoding' value may not
- " be trusted; since the buffer should not be written the fileencoding is
- " not intended to be used.
- if &l:buftype=='' || &l:buftype==?'help'
- let user_settings.vim_encoding = &l:fileencoding
- call tohtml#CharsetFromEncoding(user_settings)
- else
- let user_settings.encoding = '' " trigger detection using &encoding
- endif
- endif
-
- " else from 'encoding' if possible
- if &l:fileencoding == '' || user_settings.encoding == ''
- let user_settings.vim_encoding = &encoding
- call tohtml#CharsetFromEncoding(user_settings)
- endif
-
- " else default to UTF-8 and warn user
- if user_settings.encoding == ''
- let user_settings.vim_encoding = 'utf-8'
- let user_settings.encoding = 'UTF-8'
- echohl WarningMsg
- echomsg "TOhtml: couldn't determine MIME charset, using UTF-8"
- echohl None
- endif
- endif "}}}
-
- " Default to making nothing uncopyable, because we default to
- " not-standards way of doing things, and also because Microsoft Word and
- " others paste the <input> elements anyway.
- "
- " html_prevent_copy only has an effect when using CSS.
- "
- " All options:
- " f - fold column
- " n - line numbers (also within fold text)
- " t - fold text
- " d - diff filler
- " c - concealed text (reserved future)
- " l - listchars (reserved possible future)
- " s - signs (reserved possible future)
- "
- " Normal text is always selectable.
- let user_settings.prevent_copy = ""
- if user_settings.use_css
- if exists("g:html_prevent_copy")
- if user_settings.dynamic_folds && !user_settings.no_foldcolumn && g:html_prevent_copy =~# 'f'
- let user_settings.prevent_copy ..= 'f'
- endif
- if user_settings.number_lines && g:html_prevent_copy =~# 'n'
- let user_settings.prevent_copy ..= 'n'
- endif
- if &diff && g:html_prevent_copy =~# 'd'
- let user_settings.prevent_copy ..= 'd'
- endif
- if !user_settings.ignore_folding && g:html_prevent_copy =~# 't'
- let user_settings.prevent_copy ..= 't'
- endif
- else
- let user_settings.prevent_copy = ""
- endif
- endif
- if empty(user_settings.prevent_copy)
- let user_settings.no_invalid = 0
- endif
-
- " enforce valid values for use_input_for_pc
- if user_settings.use_input_for_pc !~# 'fallback\|none\|all'
- let user_settings.use_input_for_pc = 'none'
- echohl WarningMsg
- echomsg '2html: "' .. g:html_use_input_for_pc .. '" is not valid for g:html_use_input_for_pc'
- echomsg '2html: defaulting to "' .. user_settings.use_input_for_pc .. '"'
- echohl None
- sleep 3
- endif
-
- if exists('g:html_id_expr')
- let user_settings.id_suffix = eval(g:html_id_expr)
- if user_settings.id_suffix !~ '^[-_:.A-Za-z0-9]*$'
- echohl WarningMsg
- echomsg '2html: g:html_id_expr evaluated to invalid string for HTML id attributes'
- echomsg '2html: Omitting user-specified suffix'
- echohl None
- sleep 3
- let user_settings.id_suffix=""
- endif
- else
- let user_settings.id_suffix=""
- endif
-
- " TODO: font
-
- return user_settings
- endif
-endfunc "}}}
-
-" get the proper HTML charset name from a Vim encoding option.
-function! tohtml#CharsetFromEncoding(settings) "{{{
- let l:vim_encoding = a:settings.vim_encoding
- if exists('g:html_charset_override') && has_key(g:html_charset_override, l:vim_encoding)
- let a:settings.encoding = g:html_charset_override[l:vim_encoding]
- else
- if l:vim_encoding =~ '^8bit\|^2byte'
- " 8bit- and 2byte- prefixes are to indicate encodings available on the
- " system that Vim will convert with iconv(), look up just the encoding name,
- " not Vim's prefix.
- let l:vim_encoding = substitute(l:vim_encoding, '^8bit-\|^2byte-', '', '')
- endif
- if has_key(g:tohtml#encoding_to_charset, l:vim_encoding)
- let a:settings.encoding = g:tohtml#encoding_to_charset[l:vim_encoding]
- else
- let a:settings.encoding = ""
- endif
- endif
- if a:settings.encoding != ""
- let l:vim_encoding = tohtml#EncodingFromCharset(a:settings.encoding)
- if l:vim_encoding != ""
- " if the Vim encoding to HTML encoding conversion is set up (by default or
- " by the user) to convert to a different encoding, we need to also change
- " the Vim encoding of the new buffer
- let a:settings.vim_encoding = l:vim_encoding
- endif
- endif
-endfun "}}}
-
-" Get the proper Vim encoding option setting from an HTML charset name.
-function! tohtml#EncodingFromCharset(encoding) "{{{
- if exists('g:html_encoding_override') && has_key(g:html_encoding_override, a:encoding)
- return g:html_encoding_override[a:encoding]
- elseif has_key(g:tohtml#charset_to_encoding, tolower(a:encoding))
- return g:tohtml#charset_to_encoding[tolower(a:encoding)]
- else
- return ""
- endif
-endfun "}}}
-
-let &cpo = s:cpo_sav
-unlet s:cpo_sav
-
-" Make sure any patches will probably use consistent indent
-" vim: ts=8 sw=2 sts=2 noet fdm=marker
diff --git a/runtime/autoload/userreg.vim b/runtime/autoload/userreg.vim
new file mode 100644
index 0000000000..fd026a12e6
--- /dev/null
+++ b/runtime/autoload/userreg.vim
@@ -0,0 +1,7 @@
+" This is used for the default userreg function.
+
+lua vim.userreg = require('vim.userreg')
+
+function! userreg#func(action, register, content) abort
+ return v:lua.vim.userreg.fn(a:action, a:register, a:content)
+endfunction
diff --git a/runtime/autoload/zip.vim b/runtime/autoload/zip.vim
index e61293c357..c0034f8a7a 100644
--- a/runtime/autoload/zip.vim
+++ b/runtime/autoload/zip.vim
@@ -2,7 +2,8 @@
" AUTOLOAD PORTION
" Date: Mar 12, 2023
" Version: 33
-" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Charles E Campbell
" License: Vim License (see vim's :help license)
" Copyright: Copyright (C) 2005-2019 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
diff --git a/runtime/colors/blue.vim b/runtime/colors/blue.vim
index aa99bacd3b..d6931e4c71 100644
--- a/runtime/colors/blue.vim
+++ b/runtime/colors/blue.vim
@@ -4,13 +4,14 @@
" Maintainer: Original maintainer Steven Vertigan <steven@vertigan.wattle.id.au>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 02 Sep 2022 09:41:44 MSK
+" Last Updated: Mon 08 Jan 2024 09:42:49 AM AEDT
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
set background=dark
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'blue'
let s:t_Co = &t_Co
@@ -80,8 +81,8 @@ hi Underlined guifg=NONE guibg=NONE gui=underline ctermfg=NONE ctermbg=NONE cter
hi Label guifg=#ffd700 guibg=NONE gui=NONE cterm=NONE
hi! link Terminal Normal
hi! link Debug Special
-hi! link diffAdded String
-hi! link diffRemoved WarningMsg
+hi! link Added String
+hi! link Removed WarningMsg
hi! link diffOnly WarningMsg
hi! link diffNoEOL WarningMsg
hi! link diffIsA WarningMsg
@@ -190,8 +191,8 @@ if s:t_Co >= 256
hi Label ctermfg=220 ctermbg=NONE cterm=NONE
hi! link Terminal Normal
hi! link Debug Special
- hi! link diffAdded String
- hi! link diffRemoved WarningMsg
+ hi! link Added String
+ hi! link Removed WarningMsg
hi! link diffOnly WarningMsg
hi! link diffNoEOL WarningMsg
hi! link diffIsA WarningMsg
@@ -303,8 +304,8 @@ if s:t_Co >= 16
hi Label ctermfg=yellow ctermbg=NONE cterm=NONE
hi! link Terminal Normal
hi! link Debug Special
- hi! link diffAdded String
- hi! link diffRemoved WarningMsg
+ hi! link Added String
+ hi! link Removed WarningMsg
hi! link diffOnly WarningMsg
hi! link diffNoEOL WarningMsg
hi! link diffIsA WarningMsg
@@ -415,8 +416,8 @@ if s:t_Co >= 8
hi Label ctermfg=yellow ctermbg=NONE cterm=NONE
hi! link Terminal Normal
hi! link Debug Special
- hi! link diffAdded String
- hi! link diffRemoved WarningMsg
+ hi! link Added String
+ hi! link Removed WarningMsg
hi! link diffOnly WarningMsg
hi! link diffNoEOL WarningMsg
hi! link diffIsA WarningMsg
@@ -587,4 +588,4 @@ endif
" Color: fgDiffB #000000 16 black
" Color: bgDiffC8 #5F87AF 67 darkblue
" Color: bgDiffD8 #AF5FAF 133 darkmagenta
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/darkblue.vim b/runtime/colors/darkblue.vim
index c7bba4471e..471b8561fb 100644
--- a/runtime/colors/darkblue.vim
+++ b/runtime/colors/darkblue.vim
@@ -4,13 +4,14 @@
" Maintainer: Original author Bohdan Vlasyuk <bohdan@vstu.edu.ua>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 02 Sep 2022 09:40:36 MSK
+" Last Updated: Mon 08 Jan 2024 09:43:03 AM AEDT
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
set background=dark
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'darkblue'
let s:t_Co = &t_Co
@@ -58,8 +59,8 @@ hi! link Structure Type
hi! link Tag Special
hi! link Typedef Type
hi! link Debug Special
-hi! link diffAdded String
-hi! link diffRemoved WarningMsg
+hi! link Added String
+hi! link Removed WarningMsg
hi! link diffOnly WarningMsg
hi! link diffNoEOL WarningMsg
hi! link diffIsA WarningMsg
@@ -166,8 +167,8 @@ if s:t_Co >= 256
hi! link Tag Special
hi! link Typedef Type
hi! link Debug Special
- hi! link diffAdded String
- hi! link diffRemoved WarningMsg
+ hi! link Added String
+ hi! link Removed WarningMsg
hi! link diffOnly WarningMsg
hi! link diffNoEOL WarningMsg
hi! link diffIsA WarningMsg
@@ -471,4 +472,4 @@ endif
" Color: fgDiffB #000000 16 black
" Color: bgDiffC8 #5F87AF 67 darkblue
" Color: bgDiffD8 #AF5FAF 133 darkmagenta
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/default.vim b/runtime/colors/default.vim
index d2960fa78b..8ee18a4ec4 100644
--- a/runtime/colors/default.vim
+++ b/runtime/colors/default.vim
@@ -1,15 +1,8 @@
-" Vim color file
-" Maintainer: The Vim Project <https://github.com/vim/vim>
-" Last Change: 2023 Aug 10
-" Former Maintainer: Bram Moolenaar <Bram@vim.org>
+" Neovim color file
+" Maintainer: The Neovim Project <https://github.com/neovim/neovim>
+" Last Change: 2023 Dec 01
-" This is the default color scheme. It doesn't define the Normal
-" highlighting, it uses whatever the colors used to be.
-
-" Set 'background' back to the default. The value can't always be estimated
-" and is then guessed.
-hi clear Normal
-set bg&
+" This is the default color scheme. See `:help dev_theme`.
" Remove all existing highlighting and set the defaults.
hi clear
diff --git a/runtime/colors/delek.vim b/runtime/colors/delek.vim
index d9db90f2c5..1919526760 100644
--- a/runtime/colors/delek.vim
+++ b/runtime/colors/delek.vim
@@ -4,13 +4,14 @@
" Maintainer: Original maintainer David Schweikert <david@schweikert.ch>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Sun 04 Sep 2022 09:31:26 MSK
+" Last Updated: Fri 15 Dec 2023 20:05:34
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
set background=light
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'delek'
let s:t_Co = &t_Co
@@ -412,4 +413,4 @@ endif
" Color: fgDiffB #000000 16 black
" Color: bgDiffC8 #5F87AF 67 darkblue
" Color: bgDiffD8 #AF5FAF 133 darkmagenta
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/desert.vim b/runtime/colors/desert.vim
index 0b56740664..453e966899 100644
--- a/runtime/colors/desert.vim
+++ b/runtime/colors/desert.vim
@@ -4,13 +4,14 @@
" Maintainer: Original maintainer Hans Fugal <hans@fugal.net>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 02 Sep 2022 09:39:21 MSK
+" Last Updated: Fri 15 Dec 2023 20:05:34
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
set background=dark
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'desert'
let s:t_Co = &t_Co
@@ -401,4 +402,4 @@ endif
" Color: fgDiffB #000000 16 black
" Color: bgDiffC8 #5F87AF 67 darkblue
" Color: bgDiffD8 #AF5FAF 133 darkmagenta
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/elflord.vim b/runtime/colors/elflord.vim
index 4a33e33eec..001368861f 100644
--- a/runtime/colors/elflord.vim
+++ b/runtime/colors/elflord.vim
@@ -3,13 +3,14 @@
" Maintainer: original maintainer Ron Aaron <ron@ronware.org>
" Website: https://www.github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 02 Sep 2022 09:44:22 MSK
+" Last Updated: Fri 15 Dec 2023 20:05:35
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
set background=dark
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'elflord'
let s:t_Co = &t_Co
@@ -450,4 +451,4 @@ endif
" Color: fgDiffB #000000 16 black
" Color: bgDiffC8 #5F87AF 67 darkblue
" Color: bgDiffD8 #AF5FAF 133 darkmagenta
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/evening.vim b/runtime/colors/evening.vim
index 70ae55aa8d..1abdd8006f 100644
--- a/runtime/colors/evening.vim
+++ b/runtime/colors/evening.vim
@@ -4,13 +4,14 @@
" Maintainer: Original maintainer Steven Vertigan <steven@vertigan.wattle.id.au>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Sun 04 Sep 2022 09:48:34 MSK
+" Last Updated: Mon 08 Jan 2024 09:43:27 AM AEDT
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
set background=dark
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'evening'
let s:t_Co = &t_Co
@@ -32,8 +33,8 @@ hi! link CursorIM Cursor
hi! link LineNrAbove LineNr
hi! link LineNrBelow LineNr
hi! link Debug Special
-hi! link diffAdded String
-hi! link diffRemoved WarningMsg
+hi! link Added String
+hi! link Removed WarningMsg
hi! link diffOnly WarningMsg
hi! link diffNoEOL WarningMsg
hi! link diffIsA WarningMsg
@@ -140,8 +141,8 @@ if s:t_Co >= 256
hi! link LineNrAbove LineNr
hi! link LineNrBelow LineNr
hi! link Debug Special
- hi! link diffAdded String
- hi! link diffRemoved WarningMsg
+ hi! link Added String
+ hi! link Removed WarningMsg
hi! link diffOnly WarningMsg
hi! link diffNoEOL WarningMsg
hi! link diffIsA WarningMsg
@@ -251,8 +252,8 @@ if s:t_Co >= 16
hi! link LineNrAbove LineNr
hi! link LineNrBelow LineNr
hi! link Debug Special
- hi! link diffAdded String
- hi! link diffRemoved WarningMsg
+ hi! link Added String
+ hi! link Removed WarningMsg
hi! link diffOnly WarningMsg
hi! link diffNoEOL WarningMsg
hi! link diffIsA WarningMsg
@@ -532,4 +533,4 @@ endif
" Color: fgDiffB #000000 16 black
" Color: bgDiffC8 #5F87AF 67 darkblue
" Color: bgDiffD8 #AF5FAF 133 darkmagenta
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/habamax.vim b/runtime/colors/habamax.vim
index c84354ca03..66f40ab56a 100644
--- a/runtime/colors/habamax.vim
+++ b/runtime/colors/habamax.vim
@@ -4,13 +4,14 @@
" Maintainer: Maxim Kim <habamax@gmail.com>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 24 Mar 2023 20:28:06 AEDT
+" Last Updated: Mon 08 Jan 2024 09:39:53 AM AEDT
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
set background=dark
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'habamax'
let s:t_Co = &t_Co
@@ -110,8 +111,9 @@ hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi Debug guifg=#5f8787 guibg=NONE gui=NONE cterm=NONE
hi DiffAdd guifg=#dadada guibg=#5f875f gui=NONE cterm=NONE
hi DiffDelete guifg=#af875f guibg=NONE gui=NONE cterm=NONE
-hi diffAdded guifg=#87af87 guibg=NONE gui=NONE cterm=NONE
-hi diffRemoved guifg=#d75f5f guibg=NONE gui=NONE cterm=NONE
+hi Added guifg=#87af87 guibg=NONE gui=NONE cterm=NONE
+hi Changed guifg=#5f8787 guibg=NONE gui=NONE cterm=NONE
+hi Removed guifg=#d75f5f guibg=NONE gui=NONE cterm=NONE
hi diffSubname guifg=#af87af guibg=NONE gui=NONE cterm=NONE
hi DiffText guifg=#dadada guibg=#878787 gui=NONE cterm=NONE
hi DiffChange guifg=#bcbcbc guibg=#5f5f5f gui=NONE cterm=NONE
@@ -203,8 +205,9 @@ if s:t_Co >= 256
hi Debug ctermfg=66 ctermbg=NONE cterm=NONE
hi DiffAdd ctermfg=253 ctermbg=65 cterm=NONE
hi DiffDelete ctermfg=137 ctermbg=NONE cterm=NONE
- hi diffAdded ctermfg=108 ctermbg=NONE cterm=NONE
- hi diffRemoved ctermfg=167 ctermbg=NONE cterm=NONE
+ hi Added ctermfg=108 ctermbg=NONE cterm=NONE
+ hi Changed ctermfg=66 ctermbg=NONE cterm=NONE
+ hi Removed ctermfg=167 ctermbg=NONE cterm=NONE
hi diffSubname ctermfg=139 ctermbg=NONE cterm=NONE
hi DiffText ctermfg=253 ctermbg=102 cterm=NONE
hi DiffChange ctermfg=250 ctermbg=59 cterm=NONE
@@ -281,8 +284,9 @@ if s:t_Co >= 16
hi Debug ctermfg=darkcyan ctermbg=NONE cterm=NONE
hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
hi DiffDelete ctermfg=darkyellow ctermbg=NONE cterm=NONE
- hi diffAdded ctermfg=darkgreen ctermbg=NONE cterm=NONE
- hi diffRemoved ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Added ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Changed ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Removed ctermfg=darkred ctermbg=NONE cterm=NONE
hi diffSubname ctermfg=darkmagenta ctermbg=NONE cterm=NONE
hi DiffText ctermfg=white ctermbg=lightgrey cterm=NONE
hi DiffChange ctermfg=white ctermbg=darkgray cterm=NONE
@@ -359,8 +363,9 @@ if s:t_Co >= 8
hi Debug ctermfg=darkcyan ctermbg=NONE cterm=NONE
hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
hi DiffDelete ctermfg=darkyellow ctermbg=NONE cterm=NONE
- hi diffAdded ctermfg=darkgreen ctermbg=NONE cterm=NONE
- hi diffRemoved ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Added ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Changed ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Removed ctermfg=darkred ctermbg=NONE cterm=NONE
hi diffSubname ctermfg=darkmagenta ctermbg=NONE cterm=NONE
hi DiffText ctermfg=white ctermbg=black cterm=bold,reverse
hi DiffChange ctermfg=black ctermbg=white cterm=NONE
@@ -469,4 +474,4 @@ endif
" Color: white #dadada 253 white
" Term colors: color00 color01 color02 color03 color04 color05 color06 color07
" Term colors: color08 color09 color10 color11 color12 color13 color14 color15
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/industry.vim b/runtime/colors/industry.vim
index f09786000d..449bf3b676 100644
--- a/runtime/colors/industry.vim
+++ b/runtime/colors/industry.vim
@@ -4,13 +4,14 @@
" Maintainer: Original maintainer Shian Lee.
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Sun 04 Sep 2022 09:50:04 MSK
+" Last Updated: Fri 15 Dec 2023 20:05:36
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
set background=dark
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'industry'
let s:t_Co = &t_Co
@@ -413,4 +414,4 @@ endif
" Color: fgDiffB #000000 16 black
" Color: bgDiffC8 #5F87AF 67 darkblue
" Color: bgDiffD8 #AF5FAF 133 darkmagenta
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/koehler.vim b/runtime/colors/koehler.vim
index 67719123a2..8a63f91a94 100644
--- a/runtime/colors/koehler.vim
+++ b/runtime/colors/koehler.vim
@@ -3,13 +3,14 @@
" Maintainer: original maintainer Ron Aaron <ron@ronware.org>
" Website: https://www.github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 02 Sep 2022 09:23:56 MSK
+" Last Updated: Fri 15 Dec 2023 20:05:36
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
set background=dark
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'koehler'
let s:t_Co = &t_Co
@@ -427,4 +428,4 @@ endif
" Color: fgDiffB #000000 16 black
" Color: bgDiffC8 #5F87AF 67 darkblue
" Color: bgDiffD8 #AF5FAF 133 darkmagenta
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/lunaperche.vim b/runtime/colors/lunaperche.vim
index 44c75c40cb..62538468dc 100644
--- a/runtime/colors/lunaperche.vim
+++ b/runtime/colors/lunaperche.vim
@@ -4,11 +4,12 @@
" Maintainer: Maxim Kim <habamax@gmail.com>
" Website: https://www.github.com/vim/colorschemes
" License: Vim License (see `:help license`)
-" Last Updated: Sun 26 Mar 2023 23:04:18 AEDT
+" Last Updated: Mon 08 Jan 2024 09:41:03 AM AEDT
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'lunaperche'
let s:t_Co = &t_Co
@@ -16,8 +17,24 @@ let s:t_Co = &t_Co
hi! link helpVim Title
hi! link helpHeader Title
hi! link helpHyperTextJump Underlined
+hi! link fugitiveSymbolicRef PreProc
+hi! link fugitiveHeading Statement
+hi! link fugitiveStagedHeading Statement
+hi! link fugitiveUnstagedHeading Statement
+hi! link fugitiveUntrackedHeading Statement
+hi! link fugitiveStagedModifier PreProc
+hi! link fugitiveUnstagedModifier PreProc
+hi! link fugitiveHash Constant
hi! link diffFile PreProc
hi! link markdownHeadingDelimiter Special
+hi! link rstSectionDelimiter Statement
+hi! link rstDirective PreProc
+hi! link rstHyperlinkReference Special
+hi! link rstFieldName Constant
+hi! link rstDelimiter Special
+hi! link rstInterpretedText Special
+hi! link rstCodeBlock Normal
+hi! link rstLiteralBlock rstCodeBlock
hi! link markdownUrl String
hi! link colortemplateKey Statement
hi! link xmlTagName Statement
@@ -122,10 +139,10 @@ if &background ==# 'dark'
hi WildMenu guifg=#000000 guibg=#ffd787 gui=bold cterm=bold
hi debugPC guifg=#5f87af guibg=NONE gui=reverse cterm=reverse
hi debugBreakpoint guifg=#5fafaf guibg=NONE gui=reverse cterm=reverse
- hi Cursor guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi Cursor guifg=#000000 guibg=#ffffff gui=NONE cterm=NONE
hi lCursor guifg=#ff5fff guibg=#000000 gui=reverse cterm=reverse
hi Visual guifg=#ffffff guibg=#005f87 gui=NONE cterm=NONE
- hi MatchParen guifg=#c5e7c5 guibg=#000000 gui=reverse cterm=reverse
+ hi MatchParen guifg=#ff00af guibg=NONE gui=bold cterm=bold
hi VisualNOS guifg=#000000 guibg=#5fafaf gui=NONE cterm=NONE
hi CursorLine guifg=NONE guibg=#262626 gui=NONE cterm=NONE
hi CursorColumn guifg=NONE guibg=#262626 gui=NONE cterm=NONE
@@ -152,8 +169,9 @@ if &background ==# 'dark'
hi DiffChange guifg=#c6c6c6 guibg=#5f5f5f gui=NONE cterm=NONE
hi DiffText guifg=#afffff guibg=#5f8787 gui=NONE cterm=NONE
hi DiffDelete guifg=#d78787 guibg=NONE gui=NONE cterm=NONE
- hi diffAdded guifg=#5fd75f guibg=NONE gui=NONE cterm=NONE
- hi diffRemoved guifg=#d78787 guibg=NONE gui=NONE cterm=NONE
+ hi Added guifg=#5fd75f guibg=NONE gui=NONE cterm=NONE
+ hi Changed guifg=#5fafff guibg=NONE gui=NONE cterm=NONE
+ hi Removed guifg=#d78787 guibg=NONE gui=NONE cterm=NONE
hi diffSubname guifg=#ff87ff guibg=NONE gui=NONE cterm=NONE
hi dirType guifg=#d787d7 guibg=NONE gui=NONE cterm=NONE
hi dirPermissionUser guifg=#5faf5f guibg=NONE gui=NONE cterm=NONE
@@ -216,10 +234,10 @@ else
hi WildMenu guifg=#000000 guibg=#ffd787 gui=bold cterm=bold
hi debugPC guifg=#005fd7 guibg=NONE gui=reverse cterm=reverse
hi debugBreakpoint guifg=#005f5f guibg=NONE gui=reverse cterm=reverse
- hi Cursor guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi Cursor guifg=#ffffff guibg=#000000 gui=NONE cterm=NONE
hi lCursor guifg=#ff00ff guibg=#000000 gui=reverse cterm=reverse
hi Visual guifg=#ffffff guibg=#5f87af gui=NONE cterm=NONE
- hi MatchParen guifg=NONE guibg=#c5e7c5 gui=NONE cterm=NONE
+ hi MatchParen guifg=#ff00af guibg=NONE gui=bold cterm=bold
hi VisualNOS guifg=#ffffff guibg=#008787 gui=NONE cterm=NONE
hi CursorLine guifg=NONE guibg=#eeeeee gui=NONE cterm=NONE
hi CursorColumn guifg=NONE guibg=#eeeeee gui=NONE cterm=NONE
@@ -246,8 +264,9 @@ else
hi DiffChange guifg=#000000 guibg=#d0d0d0 gui=NONE cterm=NONE
hi DiffText guifg=#000000 guibg=#5fd7d7 gui=NONE cterm=NONE
hi DiffDelete guifg=#870000 guibg=NONE gui=NONE cterm=NONE
- hi diffAdded guifg=#008700 guibg=NONE gui=NONE cterm=NONE
- hi diffRemoved guifg=#d70000 guibg=NONE gui=NONE cterm=NONE
+ hi Added guifg=#008700 guibg=NONE gui=NONE cterm=NONE
+ hi Changed guifg=#005fd7 guibg=NONE gui=NONE cterm=NONE
+ hi Removed guifg=#d70000 guibg=NONE gui=NONE cterm=NONE
hi diffSubname guifg=#af00af guibg=NONE gui=NONE cterm=NONE
hi dirType guifg=#005f5f guibg=NONE gui=NONE cterm=NONE
hi dirPermissionUser guifg=#af5f00 guibg=NONE gui=NONE cterm=NONE
@@ -270,8 +289,24 @@ if s:t_Co >= 256
hi! link helpVim Title
hi! link helpHeader Title
hi! link helpHyperTextJump Underlined
+ hi! link fugitiveSymbolicRef PreProc
+ hi! link fugitiveHeading Statement
+ hi! link fugitiveStagedHeading Statement
+ hi! link fugitiveUnstagedHeading Statement
+ hi! link fugitiveUntrackedHeading Statement
+ hi! link fugitiveStagedModifier PreProc
+ hi! link fugitiveUnstagedModifier PreProc
+ hi! link fugitiveHash Constant
hi! link diffFile PreProc
hi! link markdownHeadingDelimiter Special
+ hi! link rstSectionDelimiter Statement
+ hi! link rstDirective PreProc
+ hi! link rstHyperlinkReference Special
+ hi! link rstFieldName Constant
+ hi! link rstDelimiter Special
+ hi! link rstInterpretedText Special
+ hi! link rstCodeBlock Normal
+ hi! link rstLiteralBlock rstCodeBlock
hi! link markdownUrl String
hi! link colortemplateKey Statement
hi! link xmlTagName Statement
@@ -370,7 +405,7 @@ if s:t_Co >= 256
hi debugPC ctermfg=67 ctermbg=NONE cterm=reverse
hi debugBreakpoint ctermfg=73 ctermbg=NONE cterm=reverse
hi Visual ctermfg=231 ctermbg=24 cterm=NONE
- hi MatchParen ctermfg=30 ctermbg=16 cterm=reverse
+ hi MatchParen ctermfg=199 ctermbg=NONE cterm=bold
hi VisualNOS ctermfg=16 ctermbg=73 cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=235 cterm=NONE
hi CursorColumn ctermfg=NONE ctermbg=235 cterm=NONE
@@ -397,8 +432,9 @@ if s:t_Co >= 256
hi DiffChange ctermfg=251 ctermbg=59 cterm=NONE
hi DiffText ctermfg=159 ctermbg=66 cterm=NONE
hi DiffDelete ctermfg=174 ctermbg=NONE cterm=NONE
- hi diffAdded ctermfg=77 ctermbg=NONE cterm=NONE
- hi diffRemoved ctermfg=174 ctermbg=NONE cterm=NONE
+ hi Added ctermfg=77 ctermbg=NONE cterm=NONE
+ hi Changed ctermfg=75 ctermbg=NONE cterm=NONE
+ hi Removed ctermfg=174 ctermbg=NONE cterm=NONE
hi diffSubname ctermfg=213 ctermbg=NONE cterm=NONE
hi dirType ctermfg=176 ctermbg=NONE cterm=NONE
hi dirPermissionUser ctermfg=71 ctermbg=NONE cterm=NONE
@@ -455,7 +491,7 @@ if s:t_Co >= 256
hi debugPC ctermfg=26 ctermbg=NONE cterm=reverse
hi debugBreakpoint ctermfg=23 ctermbg=NONE cterm=reverse
hi Visual ctermfg=231 ctermbg=67 cterm=NONE
- hi MatchParen ctermfg=30 ctermbg=231 cterm=reverse
+ hi MatchParen ctermfg=199 ctermbg=NONE cterm=bold
hi VisualNOS ctermfg=231 ctermbg=30 cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=255 cterm=NONE
hi CursorColumn ctermfg=NONE ctermbg=255 cterm=NONE
@@ -482,8 +518,9 @@ if s:t_Co >= 256
hi DiffChange ctermfg=16 ctermbg=252 cterm=NONE
hi DiffText ctermfg=16 ctermbg=80 cterm=NONE
hi DiffDelete ctermfg=88 ctermbg=NONE cterm=NONE
- hi diffAdded ctermfg=28 ctermbg=NONE cterm=NONE
- hi diffRemoved ctermfg=160 ctermbg=NONE cterm=NONE
+ hi Added ctermfg=28 ctermbg=NONE cterm=NONE
+ hi Changed ctermfg=26 ctermbg=NONE cterm=NONE
+ hi Removed ctermfg=160 ctermbg=NONE cterm=NONE
hi diffSubname ctermfg=127 ctermbg=NONE cterm=NONE
hi dirType ctermfg=23 ctermbg=NONE cterm=NONE
hi dirPermissionUser ctermfg=130 ctermbg=NONE cterm=NONE
@@ -545,8 +582,7 @@ if s:t_Co >= 16
hi WildMenu ctermfg=black ctermbg=yellow cterm=bold
hi debugPC ctermfg=darkblue ctermbg=NONE cterm=reverse
hi debugBreakpoint ctermfg=darkcyan ctermbg=NONE cterm=reverse
- hi Visual ctermfg=white ctermbg=darkblue cterm=NONE
- hi MatchParen ctermfg=darkcyan ctermbg=black cterm=reverse
+ hi MatchParen ctermfg=NONE ctermbg=NONE cterm=bold,underline
hi VisualNOS ctermfg=black ctermbg=darkcyan cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
hi CursorColumn ctermfg=black ctermbg=yellow cterm=NONE
@@ -573,8 +609,9 @@ if s:t_Co >= 16
hi DiffChange ctermfg=white ctermbg=darkgreen cterm=NONE
hi DiffText ctermfg=black ctermbg=cyan cterm=NONE
hi DiffDelete ctermfg=darkred ctermbg=NONE cterm=NONE
- hi diffAdded ctermfg=green ctermbg=NONE cterm=NONE
- hi diffRemoved ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Added ctermfg=green ctermbg=NONE cterm=NONE
+ hi Changed ctermfg=blue ctermbg=NONE cterm=NONE
+ hi Removed ctermfg=darkred ctermbg=NONE cterm=NONE
hi diffSubname ctermfg=magenta ctermbg=NONE cterm=NONE
hi dirType ctermfg=darkmagenta ctermbg=NONE cterm=NONE
hi dirPermissionUser ctermfg=darkgreen ctermbg=NONE cterm=NONE
@@ -631,7 +668,7 @@ if s:t_Co >= 16
hi debugPC ctermfg=darkblue ctermbg=NONE cterm=reverse
hi debugBreakpoint ctermfg=darkcyan ctermbg=NONE cterm=reverse
hi Visual ctermfg=white ctermbg=darkblue cterm=NONE
- hi MatchParen ctermfg=darkcyan ctermbg=white cterm=reverse
+ hi MatchParen ctermfg=NONE ctermbg=NONE cterm=bold,underline
hi VisualNOS ctermfg=black ctermbg=cyan cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
hi CursorColumn ctermfg=black ctermbg=yellow cterm=NONE
@@ -658,8 +695,9 @@ if s:t_Co >= 16
hi DiffChange ctermfg=black ctermbg=lightgray cterm=NONE
hi DiffText ctermfg=black ctermbg=cyan cterm=NONE
hi DiffDelete ctermfg=darkred ctermbg=NONE cterm=NONE
- hi diffAdded ctermfg=darkgreen ctermbg=NONE cterm=NONE
- hi diffRemoved ctermfg=red ctermbg=NONE cterm=NONE
+ hi Added ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Changed ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi Removed ctermfg=red ctermbg=NONE cterm=NONE
hi diffSubname ctermfg=darkmagenta ctermbg=NONE cterm=NONE
hi dirType ctermfg=darkcyan ctermbg=NONE cterm=NONE
hi dirPermissionUser ctermfg=darkyellow ctermbg=NONE cterm=NONE
@@ -722,7 +760,7 @@ if s:t_Co >= 8
hi debugPC ctermfg=darkblue ctermbg=NONE cterm=reverse
hi debugBreakpoint ctermfg=darkcyan ctermbg=NONE cterm=reverse
hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse
- hi MatchParen ctermfg=darkcyan ctermbg=black cterm=reverse
+ hi MatchParen ctermfg=magenta ctermbg=NONE cterm=bold
hi VisualNOS ctermfg=black ctermbg=darkcyan cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
hi CursorColumn ctermfg=black ctermbg=darkyellow cterm=NONE
@@ -789,7 +827,7 @@ if s:t_Co >= 8
hi debugPC ctermfg=darkblue ctermbg=NONE cterm=reverse
hi debugBreakpoint ctermfg=darkcyan ctermbg=NONE cterm=reverse
hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse
- hi MatchParen ctermfg=darkcyan ctermbg=grey cterm=reverse
+ hi MatchParen ctermfg=magenta ctermbg=NONE cterm=bold
hi VisualNOS ctermfg=black ctermbg=darkcyan cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
hi CursorColumn ctermfg=black ctermbg=darkyellow cterm=NONE
@@ -914,7 +952,7 @@ endif
" Color: colorC #FFFFFF 231 white
" Color: colorlC #FF5FFF 207 magenta
" Color: colorV #005F87 24 darkblue
-" Color: colorMP #C5E7C5 30 darkcyan
+" Color: colorMP #ff00af 199 magenta
" Color: colorPMenuSel #4e4e4e 239 darkcyan
" Color: colorDim #878787 102 grey
" Color: diffAdd #875f87 96 darkmagenta
@@ -949,7 +987,7 @@ endif
" Color: colorC #000000 16 black
" Color: colorlC #FF00FF 201 magenta
" Color: colorV #5F87AF 67 darkblue
-" Color: colorMP #C5E7C5 30 darkcyan
+" Color: colorMP #ff00af 199 magenta
" Color: colorPMenuSel #C6C6C6 251 darkcyan
" Color: colorDim #626262 241 darkgrey
" Color: diffAdd #D7AFD7 182 darkmagenta
@@ -960,4 +998,4 @@ endif
" Term colors: color00 color01 color02 color03 color04 color05 color06 color07
" Term colors: color08 color09 color10 color11 color12 color13 color14 color15
" Background: any
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/morning.vim b/runtime/colors/morning.vim
index 5c6a617137..12f1efe9a6 100644
--- a/runtime/colors/morning.vim
+++ b/runtime/colors/morning.vim
@@ -4,13 +4,14 @@
" Maintainer: Original maintainer Bram Moolenaar <Bram@vim.org>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 02 Sep 2022 09:46:24 MSK
+" Last Updated: Fri 15 Dec 2023 20:05:37
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
set background=light
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'morning'
let s:t_Co = &t_Co
@@ -404,4 +405,4 @@ endif
" Color: fgDiffB #000000 16 black
" Color: bgDiffC8 #5F87AF 67 darkblue
" Color: bgDiffD8 #AF5FAF 133 darkmagenta
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/murphy.vim b/runtime/colors/murphy.vim
index 47d7dbe22e..c1612fbc0e 100644
--- a/runtime/colors/murphy.vim
+++ b/runtime/colors/murphy.vim
@@ -4,13 +4,14 @@
" Maintainer: Original maintainer Ron Aaron <ron@ronware.org>.
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 02 Sep 2022 09:47:20 MSK
+" Last Updated: Mon 08 Jan 2024 09:50:15 AM AEDT
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
set background=dark
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'murphy'
let s:t_Co = &t_Co
@@ -32,6 +33,7 @@ hi! link StatusLineTerm StatusLine
hi! link StatusLineTermNC StatusLineNC
hi! link MessageWindow Pmenu
hi! link PopupNotification Todo
+hi! link Added Constant
hi Normal guifg=#87ff87 guibg=#000000 gui=NONE cterm=NONE
hi EndOfBuffer guifg=#0000ff guibg=#000000 gui=NONE cterm=NONE
hi StatusLine guifg=#ffffff guibg=#00008b gui=NONE cterm=NONE
@@ -104,6 +106,7 @@ if s:t_Co >= 256
hi! link StatusLineTermNC StatusLineNC
hi! link MessageWindow Pmenu
hi! link PopupNotification Todo
+ hi! link Added Constant
hi Normal ctermfg=120 ctermbg=16 cterm=NONE
hi EndOfBuffer ctermfg=21 ctermbg=16 cterm=NONE
hi StatusLine ctermfg=231 ctermbg=18 cterm=NONE
@@ -398,4 +401,4 @@ endif
" Color: fgDiffB #000000 16 black
" Color: bgDiffC8 #5F87AF 67 darkblue
" Color: bgDiffD8 #AF5FAF 133 darkmagenta
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/pablo.vim b/runtime/colors/pablo.vim
index 8766cc4776..f53739bc6d 100644
--- a/runtime/colors/pablo.vim
+++ b/runtime/colors/pablo.vim
@@ -3,13 +3,14 @@
" Maintainer: Original maintainerRon Aaron <ron@ronware.org>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Wed 14 Sep 2022 19:05:27 MSK
+" Last Updated: Fri 15 Dec 2023 20:05:38
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
set background=dark
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'pablo'
let s:t_Co = &t_Co
@@ -431,4 +432,4 @@ endif
" Color: fgDiffB #000000 16 black
" Color: bgDiffC8 #5F87AF 67 darkblue
" Color: bgDiffD8 #AF5FAF 133 darkmagenta
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/peachpuff.vim b/runtime/colors/peachpuff.vim
index 0bab72dace..f4c1e21697 100644
--- a/runtime/colors/peachpuff.vim
+++ b/runtime/colors/peachpuff.vim
@@ -4,13 +4,14 @@
" Maintainer: Original maintainer David Ne\v{c}as (Yeti) <yeti@physics.muni.cz>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 02 Sep 2022 09:50:02 MSK
+" Last Updated: Fri 15 Dec 2023 20:05:39
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
set background=light
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'peachpuff'
let s:t_Co = &t_Co
@@ -409,4 +410,4 @@ endif
" Color: fgDiffB #000000 16 black
" Color: bgDiffC8 #5F87AF 67 darkblue
" Color: bgDiffD8 #AF5FAF 133 darkmagenta
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/quiet.vim b/runtime/colors/quiet.vim
index 9ab313b837..d7f8582888 100644
--- a/runtime/colors/quiet.vim
+++ b/runtime/colors/quiet.vim
@@ -4,11 +4,12 @@
" Maintainer: Maxence Weynans <neutaaaaan@gmail.com>
" Website: https://github.com/vim/colorschemes
" License: Vim License (see `:help license`)`
-" Last Updated: Wed 15 Mar 2023 06:45:06 PM CET
+" Last Updated: Fri 15 Dec 2023 20:05:39
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'quiet'
let s:t_Co = &t_Co
@@ -750,4 +751,4 @@ endif
" Term colors: light0 light1 light2 light3 light4 light5 light6 light7
" Term colors: light8 light9 light10 light11 light12 light13 light14 light15
" Background: any
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/retrobox.vim b/runtime/colors/retrobox.vim
index c0c4f9f6c2..b4a194d885 100644
--- a/runtime/colors/retrobox.vim
+++ b/runtime/colors/retrobox.vim
@@ -4,11 +4,12 @@
" Maintainer: Maxim Kim <habamax@gmail.com>, ported from gruvbox8 of Lifepillar <lifepillar@lifepillar.me>
" Website: https://www.github.com/vim/colorschemes
" License: Vim License (see `:help license`)
-" Last Updated: Sun 12 Mar 2023 15:14:04 AEDT
+" Last Updated: Fri 15 Dec 2023 20:05:40
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'retrobox'
let s:t_Co = &t_Co
@@ -65,7 +66,7 @@ if &background ==# 'dark'
hi WildMenu guifg=#83a598 guibg=#504945 gui=bold cterm=bold
hi EndOfBuffer guifg=#504945 guibg=NONE gui=NONE cterm=NONE
hi Conceal guifg=#83a598 guibg=NONE gui=NONE cterm=NONE
- hi Cursor guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi Cursor guifg=#1c1c1c guibg=#fbf1c7 gui=NONE cterm=NONE
hi DiffAdd guifg=#b8bb26 guibg=#1c1c1c gui=reverse cterm=reverse
hi DiffChange guifg=#8ec07c guibg=#1c1c1c gui=reverse cterm=reverse
hi DiffDelete guifg=#fb4934 guibg=#1c1c1c gui=reverse cterm=reverse
@@ -116,7 +117,7 @@ if &background ==# 'dark'
hi Type guifg=#fabd2f guibg=NONE gui=NONE cterm=NONE
hi Typedef guifg=#fabd2f guibg=NONE gui=NONE cterm=NONE
hi Underlined guifg=#83a598 guibg=NONE gui=underline cterm=underline
- hi CursorIM guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi CursorIM guifg=#1c1c1c guibg=#fbf1c7 gui=NONE cterm=NONE
else
" Light background
if (has('termguicolors') && &termguicolors) || has('gui_running')
@@ -160,7 +161,7 @@ else
hi WildMenu guifg=#076678 guibg=#e5d4b1 gui=bold cterm=bold
hi EndOfBuffer guifg=#e5d4b1 guibg=NONE gui=NONE cterm=NONE
hi Conceal guifg=#076678 guibg=NONE gui=NONE cterm=NONE
- hi Cursor guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi Cursor guifg=#fbf1c7 guibg=#282828 gui=NONE cterm=NONE
hi DiffAdd guifg=#79740e guibg=#fbf1c7 gui=reverse cterm=reverse
hi DiffChange guifg=#427b58 guibg=#fbf1c7 gui=reverse cterm=reverse
hi DiffDelete guifg=#9d0006 guibg=#fbf1c7 gui=reverse cterm=reverse
@@ -211,7 +212,7 @@ else
hi Type guifg=#b57614 guibg=NONE gui=NONE cterm=NONE
hi Typedef guifg=#b57614 guibg=NONE gui=NONE cterm=NONE
hi Underlined guifg=#076678 guibg=NONE gui=underline cterm=underline
- hi CursorIM guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi CursorIM guifg=#fbf1c7 guibg=#282828 gui=NONE cterm=NONE
endif
if s:t_Co >= 256
@@ -250,7 +251,7 @@ if s:t_Co >= 256
hi WildMenu ctermfg=109 ctermbg=239 cterm=bold
hi EndOfBuffer ctermfg=239 ctermbg=NONE cterm=NONE
hi Conceal ctermfg=109 ctermbg=NONE cterm=NONE
- hi Cursor ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi Cursor ctermfg=234 ctermbg=230 cterm=NONE
hi DiffAdd ctermfg=142 ctermbg=234 cterm=reverse
hi DiffChange ctermfg=107 ctermbg=234 cterm=reverse
hi DiffDelete ctermfg=203 ctermbg=234 cterm=reverse
@@ -301,7 +302,7 @@ if s:t_Co >= 256
hi Type ctermfg=214 ctermbg=NONE cterm=NONE
hi Typedef ctermfg=214 ctermbg=NONE cterm=NONE
hi Underlined ctermfg=109 ctermbg=NONE cterm=underline
- hi CursorIM ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi CursorIM ctermfg=234 ctermbg=230 cterm=NONE
else
" Light background
hi Normal ctermfg=237 ctermbg=230 cterm=NONE
@@ -338,7 +339,7 @@ if s:t_Co >= 256
hi WildMenu ctermfg=23 ctermbg=188 cterm=bold
hi EndOfBuffer ctermfg=188 ctermbg=NONE cterm=NONE
hi Conceal ctermfg=23 ctermbg=NONE cterm=NONE
- hi Cursor ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi Cursor ctermfg=230 ctermbg=235 cterm=NONE
hi DiffAdd ctermfg=64 ctermbg=230 cterm=reverse
hi DiffChange ctermfg=29 ctermbg=230 cterm=reverse
hi DiffDelete ctermfg=124 ctermbg=230 cterm=reverse
@@ -389,7 +390,7 @@ if s:t_Co >= 256
hi Type ctermfg=172 ctermbg=NONE cterm=NONE
hi Typedef ctermfg=172 ctermbg=NONE cterm=NONE
hi Underlined ctermfg=23 ctermbg=NONE cterm=underline
- hi CursorIM ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi CursorIM ctermfg=230 ctermbg=235 cterm=NONE
endif
unlet s:t_Co
finish
@@ -431,7 +432,7 @@ if s:t_Co >= 16
hi WildMenu ctermfg=White ctermbg=Black cterm=bold
hi EndOfBuffer ctermfg=DarkGray ctermbg=NONE cterm=NONE
hi Conceal ctermfg=Blue ctermbg=NONE cterm=NONE
- hi Cursor ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi Cursor ctermfg=Black ctermbg=White cterm=NONE
hi DiffAdd ctermfg=Green ctermbg=Black cterm=reverse
hi DiffChange ctermfg=Cyan ctermbg=Black cterm=reverse
hi DiffDelete ctermfg=Red ctermbg=Black cterm=reverse
@@ -482,7 +483,7 @@ if s:t_Co >= 16
hi Type ctermfg=Yellow ctermbg=NONE cterm=NONE
hi Typedef ctermfg=Yellow ctermbg=NONE cterm=NONE
hi Underlined ctermfg=Blue ctermbg=NONE cterm=underline
- hi CursorIM ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi CursorIM ctermfg=Black ctermbg=White cterm=NONE
else
" Light background
hi Normal ctermfg=Black ctermbg=White cterm=NONE
@@ -519,7 +520,7 @@ if s:t_Co >= 16
hi WildMenu ctermfg=Black ctermbg=White cterm=bold
hi EndOfBuffer ctermfg=Grey ctermbg=NONE cterm=NONE
hi Conceal ctermfg=Blue ctermbg=NONE cterm=NONE
- hi Cursor ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi Cursor ctermfg=White ctermbg=DarkGray cterm=NONE
hi DiffAdd ctermfg=Green ctermbg=White cterm=reverse
hi DiffChange ctermfg=Cyan ctermbg=White cterm=reverse
hi DiffDelete ctermfg=Red ctermbg=White cterm=reverse
@@ -570,7 +571,7 @@ if s:t_Co >= 16
hi Type ctermfg=Yellow ctermbg=NONE cterm=NONE
hi Typedef ctermfg=Yellow ctermbg=NONE cterm=NONE
hi Underlined ctermfg=Blue ctermbg=NONE cterm=underline
- hi CursorIM ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi CursorIM ctermfg=White ctermbg=DarkGray cterm=NONE
endif
unlet s:t_Co
finish
@@ -612,7 +613,7 @@ if s:t_Co >= 8
hi WildMenu ctermfg=Blue ctermbg=DarkGray cterm=bold
hi EndOfBuffer ctermfg=NONE ctermbg=NONE cterm=NONE
hi Conceal ctermfg=Blue ctermbg=NONE cterm=NONE
- hi Cursor ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi Cursor ctermfg=Black ctermbg=White cterm=NONE
hi DiffAdd ctermfg=Green ctermbg=Black cterm=reverse
hi DiffChange ctermfg=Cyan ctermbg=Black cterm=reverse
hi DiffDelete ctermfg=Red ctermbg=Black cterm=reverse
@@ -663,7 +664,7 @@ if s:t_Co >= 8
hi Type ctermfg=Yellow ctermbg=NONE cterm=NONE
hi Typedef ctermfg=Yellow ctermbg=NONE cterm=NONE
hi Underlined ctermfg=Blue ctermbg=NONE cterm=underline
- hi CursorIM ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi CursorIM ctermfg=Black ctermbg=White cterm=NONE
else
" Light background
hi Normal ctermfg=Black ctermbg=Grey cterm=NONE
@@ -700,7 +701,7 @@ if s:t_Co >= 8
hi WildMenu ctermfg=Blue ctermbg=Grey cterm=bold
hi EndOfBuffer ctermfg=NONE ctermbg=NONE cterm=NONE
hi Conceal ctermfg=Blue ctermbg=NONE cterm=NONE
- hi Cursor ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi Cursor ctermfg=White ctermbg=DarkGray cterm=NONE
hi DiffAdd ctermfg=Green ctermbg=White cterm=reverse
hi DiffChange ctermfg=Cyan ctermbg=White cterm=reverse
hi DiffDelete ctermfg=Red ctermbg=White cterm=reverse
@@ -751,7 +752,7 @@ if s:t_Co >= 8
hi Type ctermfg=Yellow ctermbg=NONE cterm=NONE
hi Typedef ctermfg=Yellow ctermbg=NONE cterm=NONE
hi Underlined ctermfg=Blue ctermbg=NONE cterm=underline
- hi CursorIM ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi CursorIM ctermfg=White ctermbg=DarkGray cterm=NONE
endif
unlet s:t_Co
finish
@@ -879,4 +880,4 @@ endif
" Term colors: fg1 neutralred neutralgreen neutralyellow neutralblue neutralpurple neutralaqua fg4
" Term colors: grey red green yellow blue purple aqua bg0
" Background: any
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/ron.vim b/runtime/colors/ron.vim
index d3a692a69f..4d55f9978f 100644
--- a/runtime/colors/ron.vim
+++ b/runtime/colors/ron.vim
@@ -3,13 +3,14 @@
" Maintainer: original maintainer Ron Aaron <ron@ronware.org>
" Website: https://www.github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 02 Sep 2022 09:50:56 MSK
+" Last Updated: Fri 15 Dec 2023 20:05:41
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
set background=dark
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'ron'
let s:t_Co = &t_Co
@@ -445,4 +446,4 @@ endif
" Color: fgDiffB #000000 16 black
" Color: bgDiffC8 #5F87AF 67 darkblue
" Color: bgDiffD8 #AF5FAF 133 darkmagenta
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/shine.vim b/runtime/colors/shine.vim
index b30ac415d0..b4a8793589 100644
--- a/runtime/colors/shine.vim
+++ b/runtime/colors/shine.vim
@@ -4,13 +4,14 @@
" Maintainer: Original maintainer is Yasuhiro Matsumoto <mattn@mail.goo.ne.jp>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 02 Sep 2022 09:51:42 MSK
+" Last Updated: Fri 15 Dec 2023 20:05:41
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
set background=light
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'shine'
let s:t_Co = &t_Co
@@ -417,4 +418,4 @@ endif
" Color: fgDiffB #000000 16 black
" Color: bgDiffC8 #5F87AF 67 darkblue
" Color: bgDiffD8 #AF5FAF 133 darkmagenta
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/slate.vim b/runtime/colors/slate.vim
index 6da572d9a7..aab6208b26 100644
--- a/runtime/colors/slate.vim
+++ b/runtime/colors/slate.vim
@@ -4,13 +4,14 @@
" Maintainer: Original maintainer Ralph Amissah <ralph@amissah.com>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 02 Sep 2022 09:52:25 MSK
+" Last Updated: Fri 15 Dec 2023 20:05:41
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
set background=dark
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'slate'
let s:t_Co = &t_Co
@@ -432,4 +433,4 @@ endif
" Color: fgDiffB #000000 16 black
" Color: bgDiffC8 #5F87AF 67 darkblue
" Color: bgDiffD8 #AF5FAF 133 darkmagenta
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/sorbet.vim b/runtime/colors/sorbet.vim
index 38cb141243..e4ef42469c 100644
--- a/runtime/colors/sorbet.vim
+++ b/runtime/colors/sorbet.vim
@@ -4,13 +4,14 @@
" Maintainer: Maxence Weynans <neutaaaaan@gmail.com>
" Website: https://github.com/vim/colorschemes
" License: Vim License (see `:help license`)`
-" Last Updated: Wed 15 Mar 2023 05:40:19 PM CET
+" Last Updated: Fri 15 Dec 2023 20:05:42
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
set background=dark
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'sorbet'
let s:t_Co = &t_Co
@@ -445,4 +446,4 @@ endif
" Color: errorred #ff5f5f 203 red
" Term colors: dark0 dark1 dark2 dark3 dark4 dark5 dark6 dark7
" Term colors: dark8 dark9 dark10 dark11 dark12 dark13 dark14 dark15
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/torte.vim b/runtime/colors/torte.vim
index bec681bb4e..36da28e596 100644
--- a/runtime/colors/torte.vim
+++ b/runtime/colors/torte.vim
@@ -4,13 +4,14 @@
" Maintainer: Original maintainer Thorsten Maerz <info@netztorte.de>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 02 Sep 2022 09:53:21 MSK
+" Last Updated: Fri 15 Dec 2023 20:05:42
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
set background=dark
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'torte'
let s:t_Co = &t_Co
@@ -424,4 +425,4 @@ endif
" Color: fgDiffB #000000 16 black
" Color: bgDiffC8 #5F87AF 67 darkblue
" Color: bgDiffD8 #AF5FAF 133 darkmagenta
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/vim.lua b/runtime/colors/vim.lua
new file mode 100644
index 0000000000..5a29ba0ec6
--- /dev/null
+++ b/runtime/colors/vim.lua
@@ -0,0 +1,285 @@
+-- Name: vim
+-- Description: Vim's default color scheme
+-- Author: Bram Moolenaar <Bram@vim.org>
+-- Maintainer: The Vim Project <https://github.com/vim/vim>
+-- Website: https://github.com/vim/vim
+-- License: Same as Vim
+-- Last Updated: 2023 Aug 10
+
+-- This is Vim's default color scheme. It doesn't define the Normal
+-- highlighting, it uses whatever the colors used to be.
+
+vim.cmd.highlight('clear')
+vim.g.colors_name = 'vim'
+
+local hi = function(name, val)
+ -- Force links
+ val.force = true
+
+ -- Make sure that `cterm` attribute is not populated from `gui`
+ val.cterm = val.cterm or {}
+
+ -- Define global highlight
+ vim.api.nvim_set_hl(0, name, val)
+end
+
+--stylua: ignore start
+-- General
+hi('Normal', {})
+
+hi('Conceal', { fg = 'LightGrey', bg = 'DarkGrey', ctermfg = 'LightGrey', ctermbg = 'DarkGrey' })
+hi('Cursor', {})
+hi('lCursor', {})
+hi('DiffText', { bg = 'Red', bold = true, ctermbg = 'Red', cterm = { bold = true } })
+hi('ErrorMsg', { fg = 'White', bg = 'Red', ctermfg = 'White', ctermbg = 'DarkRed' })
+hi('IncSearch', { reverse = true, cterm = { reverse = true } })
+hi('ModeMsg', { bold = true, cterm = { bold = true } })
+hi('NonText', { fg = 'Blue', bold = true, ctermfg = 'Blue' })
+hi('PmenuSbar', { bg = 'Grey', ctermbg = 'Grey' })
+hi('StatusLine', { reverse = true, bold = true, cterm = { reverse = true, bold = true }})
+hi('StatusLineNC', { reverse = true, cterm = { reverse = true } })
+hi('TabLineFill', { reverse = true, cterm = { reverse = true } })
+hi('TabLineSel', { bold = true, cterm = { bold = true } })
+hi('TermCursor', { reverse = true, cterm = { reverse = true } })
+hi('WinBar', { bold = true, cterm = { bold = true } })
+hi('WildMenu', { fg = 'Black', bg = 'Yellow', ctermfg = 'Black', ctermbg = 'Yellow' })
+
+hi('VertSplit', { link = 'Normal' })
+hi('WinSeparator', { link = 'VertSplit' })
+hi('WinBarNC', { link = 'WinBar' })
+hi('EndOfBuffer', { link = 'NonText' })
+hi('LineNrAbove', { link = 'LineNr' })
+hi('LineNrBelow', { link = 'LineNr' })
+hi('QuickFixLine', { link = 'Search' })
+hi('CursorLineSign', { link = 'SignColumn' })
+hi('CursorLineFold', { link = 'FoldColumn' })
+hi('CurSearch', { link = 'Search' })
+hi('PmenuKind', { link = 'Pmenu' })
+hi('PmenuKindSel', { link = 'PmenuSel' })
+hi('PmenuExtra', { link = 'Pmenu' })
+hi('PmenuExtraSel', { link = 'PmenuSel' })
+hi('Substitute', { link = 'Search' })
+hi('Whitespace', { link = 'NonText' })
+hi('MsgSeparator', { link = 'StatusLine' })
+hi('NormalFloat', { link = 'Pmenu' })
+hi('FloatBorder', { link = 'WinSeparator' })
+hi('FloatTitle', { link = 'Title' })
+hi('FloatFooter', { link = 'Title' })
+
+hi('FloatShadow', { bg = 'Black', blend=80 })
+hi('FloatShadowThrough', { bg = 'Black', blend=100 })
+hi('RedrawDebugNormal', { reverse = true, cterm = { reverse = true } })
+hi('RedrawDebugClear', { bg = 'Yellow', ctermbg = 'Yellow' })
+hi('RedrawDebugComposed', { bg = 'Green', ctermbg = 'Green' })
+hi('RedrawDebugRecompose', { bg = 'Red', ctermbg = 'Red' })
+hi('Error', { fg = 'White', bg = 'Red', ctermfg = 'White', ctermbg = 'Red' })
+hi('Todo', { fg = 'Blue', bg = 'Yellow', ctermfg = 'Black', ctermbg = 'Yellow' })
+
+hi('String', { link = 'Constant' })
+hi('Character', { link = 'Constant' })
+hi('Number', { link = 'Constant' })
+hi('Boolean', { link = 'Constant' })
+hi('Float', { link = 'Number' })
+hi('Function', { link = 'Identifier' })
+hi('Conditional', { link = 'Statement' })
+hi('Repeat', { link = 'Statement' })
+hi('Label', { link = 'Statement' })
+hi('Operator', { link = 'Statement' })
+hi('Keyword', { link = 'Statement' })
+hi('Exception', { link = 'Statement' })
+hi('Include', { link = 'PreProc' })
+hi('Define', { link = 'PreProc' })
+hi('Macro', { link = 'PreProc' })
+hi('PreCondit', { link = 'PreProc' })
+hi('StorageClass', { link = 'Type' })
+hi('Structure', { link = 'Type' })
+hi('Typedef', { link = 'Type' })
+hi('Tag', { link = 'Special' })
+hi('SpecialChar', { link = 'Special' })
+hi('Delimiter', { link = 'Special' })
+hi('SpecialComment', { link = 'Special' })
+hi('Debug', { link = 'Special' })
+
+hi('DiagnosticError', { fg = 'Red', ctermfg = 1 })
+hi('DiagnosticWarn', { fg = 'Orange', ctermfg = 3 })
+hi('DiagnosticInfo', { fg = 'LightBlue', ctermfg = 4 })
+hi('DiagnosticHint', { fg = 'LightGrey', ctermfg = 7 })
+hi('DiagnosticOk', { fg = 'LightGreen', ctermfg = 10 })
+hi('DiagnosticUnderlineError', { sp = 'Red', underline = true, cterm = { underline = true } })
+hi('DiagnosticUnderlineWarn', { sp = 'Orange', underline = true, cterm = { underline = true } })
+hi('DiagnosticUnderlineInfo', { sp = 'LightBlue', underline = true, cterm = { underline = true } })
+hi('DiagnosticUnderlineHint', { sp = 'LightGrey', underline = true, cterm = { underline = true } })
+hi('DiagnosticUnderlineOk', { sp = 'LightGreen', underline = true, cterm = { underline = true } })
+hi('DiagnosticVirtualTextError', { link = 'DiagnosticError' })
+hi('DiagnosticVirtualTextWarn', { link = 'DiagnosticWarn' })
+hi('DiagnosticVirtualTextInfo', { link = 'DiagnosticInfo' })
+hi('DiagnosticVirtualTextHint', { link = 'DiagnosticHint' })
+hi('DiagnosticVirtualTextOk', { link = 'DiagnosticOk' })
+hi('DiagnosticFloatingError', { link = 'DiagnosticError' })
+hi('DiagnosticFloatingWarn', { link = 'DiagnosticWarn' })
+hi('DiagnosticFloatingInfo', { link = 'DiagnosticInfo' })
+hi('DiagnosticFloatingHint', { link = 'DiagnosticHint' })
+hi('DiagnosticFloatingOk', { link = 'DiagnosticOk' })
+hi('DiagnosticSignError', { link = 'DiagnosticError' })
+hi('DiagnosticSignWarn', { link = 'DiagnosticWarn' })
+hi('DiagnosticSignInfo', { link = 'DiagnosticInfo' })
+hi('DiagnosticSignHint', { link = 'DiagnosticHint' })
+hi('DiagnosticSignOk', { link = 'DiagnosticOk' })
+hi('DiagnosticDeprecated', { sp = 'Red', strikethrough = true, cterm = { strikethrough = true } })
+
+hi('DiagnosticUnnecessary', { link = 'Comment' })
+hi('LspInlayHint', { link = 'NonText' })
+hi('SnippetTabstop', { link = 'Visual' })
+
+-- Text
+hi('@markup.raw', { link = 'Comment' })
+hi('@markup.link', { link = 'Identifier' })
+hi('@markup.heading', { link = 'Title' })
+hi('@markup.link.url', { link = 'Underlined' })
+hi('@markup.underline', { link = 'Underlined' })
+hi('@comment.todo', { link = 'Todo' })
+
+-- Miscs
+hi('@comment', { link = 'Comment' })
+hi('@punctuation', { link = 'Delimiter' })
+
+-- Constants
+hi('@constant', { link = 'Constant' })
+hi('@constant.builtin', { link = 'Special' })
+hi('@constant.macro', { link = 'Define' })
+hi('@keyword.directive', { link = 'Define' })
+hi('@string', { link = 'String' })
+hi('@string.escape', { link = 'SpecialChar' })
+hi('@string.special', { link = 'SpecialChar' })
+hi('@character', { link = 'Character' })
+hi('@character.special', { link = 'SpecialChar' })
+hi('@number', { link = 'Number' })
+hi('@boolean', { link = 'Boolean' })
+hi('@number.float', { link = 'Float' })
+
+-- Functions
+hi('@function', { link = 'Function' })
+hi('@function.builtin', { link = 'Special' })
+hi('@function.macro', { link = 'Macro' })
+hi('@variable.parameter', { link = 'Identifier' })
+hi('@function.method', { link = 'Function' })
+hi('@variable.member', { link = 'Identifier' })
+hi('@property', { link = 'Identifier' })
+hi('@constructor', { link = 'Special' })
+
+-- Keywords
+hi('@keyword.conditional', { link = 'Conditional' })
+hi('@keyword.repeat', { link = 'Repeat' })
+hi('@label', { link = 'Label' })
+hi('@operator', { link = 'Operator' })
+hi('@keyword', { link = 'Keyword' })
+hi('@keyword.exception', { link = 'Exception' })
+
+hi('@variable', { link = 'Identifier' })
+hi('@type', { link = 'Type' })
+hi('@type.definition', { link = 'Typedef' })
+hi('@keyword.storage', { link = 'StorageClass' })
+hi('@module', { link = 'Identifier' })
+hi('@keyword.import', { link = 'Include' })
+hi('@keyword.directive', { link = 'PreProc' })
+hi('@keyword.debug', { link = 'Debug' })
+hi('@tag', { link = 'Tag' })
+
+-- LSP semantic tokens
+hi('@lsp.type.class', { link = 'Structure' })
+hi('@lsp.type.comment', { link = 'Comment' })
+hi('@lsp.type.decorator', { link = 'Function' })
+hi('@lsp.type.enum', { link = 'Structure' })
+hi('@lsp.type.enumMember', { link = 'Constant' })
+hi('@lsp.type.function', { link = 'Function' })
+hi('@lsp.type.interface', { link = 'Structure' })
+hi('@lsp.type.macro', { link = 'Macro' })
+hi('@lsp.type.method', { link = 'Function' })
+hi('@lsp.type.namespace', { link = 'Structure' })
+hi('@lsp.type.parameter', { link = 'Identifier' })
+hi('@lsp.type.property', { link = 'Identifier' })
+hi('@lsp.type.struct', { link = 'Structure' })
+hi('@lsp.type.type', { link = 'Type' })
+hi('@lsp.type.typeParameter', { link = 'TypeDef' })
+hi('@lsp.type.variable', { link = 'Identifier' })
+
+if vim.o.background == 'light' then
+ -- Default colors only used with a light background.
+ hi('ColorColumn', { bg = 'LightRed', ctermbg = 'LightRed' })
+ hi('CursorColumn', { bg = 'Grey90', ctermbg = 'LightGrey' })
+ hi('CursorLine', { bg = 'Grey90', cterm = { underline = true } })
+ hi('CursorLineNr', { fg = 'Brown', bold = true, ctermfg = 'Brown', cterm = { underline = true } })
+ hi('DiffAdd', { bg = 'LightBlue', ctermbg = 'LightBlue' })
+ hi('DiffChange', { bg = 'LightMagenta', ctermbg = 'LightMagenta' })
+ hi('DiffDelete', { fg = 'Blue', bg = 'LightCyan', bold = true, ctermfg = 'Blue', ctermbg = 'LightCyan' })
+ hi('Directory', { fg = 'Blue', ctermfg = 'DarkBlue' })
+ hi('FoldColumn', { fg = 'DarkBlue', bg = 'Grey', ctermfg = 'DarkBlue', ctermbg = 'Grey' })
+ hi('Folded', { fg = 'DarkBlue', bg = 'LightGrey', ctermfg = 'DarkBlue', ctermbg = 'Grey' })
+ hi('LineNr', { fg = 'Brown', ctermfg = 'Brown' })
+ hi('MatchParen', { bg = 'Cyan', ctermbg = 'Cyan' })
+ hi('MoreMsg', { fg = 'SeaGreen', bold = true, ctermfg = 'DarkGreen' })
+ hi('Pmenu', { bg = 'LightMagenta', ctermfg = 'Black', ctermbg = 'LightMagenta' })
+ hi('PmenuSel', { bg = 'Grey', ctermfg = 'Black', ctermbg = 'LightGrey' })
+ hi('PmenuThumb', { bg = 'Black', ctermbg = 'Black' })
+ hi('Question', { fg = 'SeaGreen', bold = true, ctermfg = 'DarkGreen' })
+ hi('Search', { bg = 'Yellow', ctermbg = 'Yellow' })
+ hi('SignColumn', { fg = 'DarkBlue', bg = 'Grey', ctermfg = 'DarkBlue', ctermbg = 'Grey' })
+ hi('SpecialKey', { fg = 'Blue', ctermfg = 'DarkBlue' })
+ hi('SpellBad', { sp = 'Red', undercurl = true, ctermbg = 'LightRed' })
+ hi('SpellCap', { sp = 'Blue', undercurl = true, ctermbg = 'LightBlue' })
+ hi('SpellLocal', { sp = 'DarkCyan', undercurl = true, ctermbg = 'Cyan' })
+ hi('SpellRare', { sp = 'Magenta', undercurl = true, ctermbg = 'LightMagenta' })
+ hi('TabLine', { bg = 'LightGrey', underline = true, ctermfg = 'Black', ctermbg = 'LightGrey', cterm = { underline = true } })
+ hi('Title', { fg = 'Magenta', bold = true, ctermfg = 'DarkMagenta' })
+ hi('Visual', { fg = 'Black', bg = 'LightGrey', ctermfg = 'Black', ctermbg = 'Grey' })
+ hi('WarningMsg', { fg = 'Red', ctermfg = 'DarkRed' })
+ hi('Comment', { fg = 'Blue', ctermfg = 'DarkBlue' })
+ hi('Constant', { fg = 'Magenta', ctermfg = 'DarkRed' })
+ hi('Special', { fg = '#6a5acd', ctermfg = 'DarkMagenta' })
+ hi('Identifier', { fg = 'DarkCyan', ctermfg = 'DarkCyan' })
+ hi('Statement', { fg = 'Brown', bold = true, ctermfg = 'Brown' })
+ hi('PreProc', { fg = '#6a0dad', ctermfg = 'DarkMagenta' })
+ hi('Type', { fg = 'SeaGreen', bold = true, ctermfg = 'DarkGreen' })
+ hi('Underlined', { fg = 'SlateBlue', underline = true, ctermfg = 'DarkMagenta', cterm = { underline = true } })
+ hi('Ignore', { ctermfg = 'White' })
+else
+ -- Default colors only used with a dark background.
+ hi('ColorColumn', { bg = 'DarkRed', ctermbg = 'DarkRed' })
+ hi('CursorColumn', { bg = 'Grey40', ctermbg = 'DarkGrey' })
+ hi('CursorLine', { bg = 'Grey40', cterm = { underline = true } })
+ hi('CursorLineNr', { fg = 'Yellow', bold = true, ctermfg = 'Yellow', cterm = { underline = true } })
+ hi('DiffAdd', { bg = 'DarkBlue', ctermbg = 'DarkBlue' })
+ hi('DiffChange', { bg = 'DarkMagenta', ctermbg = 'DarkMagenta' })
+ hi('DiffDelete', { fg = 'Blue', bg = 'DarkCyan', bold = true, ctermfg = 'Blue', ctermbg = 'DarkCyan' })
+ hi('Directory', { fg = 'Cyan', ctermfg = 'LightCyan' })
+ hi('FoldColumn', { fg = 'Cyan', bg = 'Grey', ctermfg = 'Cyan', ctermbg = 'DarkGrey' })
+ hi('Folded', { fg = 'Cyan', bg = 'DarkGrey', ctermfg = 'Cyan', ctermbg = 'DarkGrey' })
+ hi('LineNr', { fg = 'Yellow', ctermfg = 'Yellow' })
+ hi('MatchParen', { bg = 'DarkCyan', ctermbg = 'DarkCyan' })
+ hi('MoreMsg', { fg = 'SeaGreen', bold = true, ctermfg = 'LightGreen' })
+ hi('Pmenu', { bg = 'Magenta', ctermfg = 'Black', ctermbg = 'Magenta' })
+ hi('PmenuSel', { bg = 'DarkGrey', ctermfg = 'DarkGrey', ctermbg = 'Black' })
+ hi('PmenuThumb', { bg = 'White', ctermbg = 'White' })
+ hi('Question', { fg = 'Green', bold = true, ctermfg = 'LightGreen' })
+ hi('Search', { fg = 'Black', bg = 'Yellow', ctermfg = 'Black', ctermbg = 'Yellow' })
+ hi('SignColumn', { fg = 'Cyan', bg = 'Grey', ctermfg = 'Cyan', ctermbg = 'DarkGrey' })
+ hi('SpecialKey', { fg = 'Cyan', ctermfg = 'LightBlue' })
+ hi('SpellBad', { sp = 'Red', undercurl = true, ctermbg = 'Red' })
+ hi('SpellCap', { sp = 'Blue', undercurl = true, ctermbg = 'Blue' })
+ hi('SpellLocal', { sp = 'Cyan', undercurl = true, ctermbg = 'Cyan' })
+ hi('SpellRare', { sp = 'Magenta', undercurl = true, ctermbg = 'Magenta' })
+ hi('TabLine', { bg = 'DarkGrey', underline = true, ctermfg = 'White', ctermbg = 'DarkGrey', cterm = { underline = true } })
+ hi('Title', { fg = 'Magenta', bold = true, ctermfg = 'LightMagenta' })
+ hi('Visual', { fg = 'LightGrey', bg = '#575757', ctermfg = 'Black', ctermbg = 'Grey' })
+ hi('WarningMsg', { fg = 'Red', ctermfg = 'LightRed' })
+ hi('Comment', { fg = '#80a0ff', ctermfg = 'Cyan' })
+ hi('Constant', { fg = '#ffa0a0', ctermfg = 'Magenta' })
+ hi('Special', { fg = 'Orange', ctermfg = 'LightRed' })
+ hi('Identifier', { fg = '#40ffff', ctermfg = 'Cyan', cterm = { bold = true } })
+ hi('Statement', { fg = '#ffff60', bold = true, ctermfg = 'Yellow' })
+ hi('PreProc', { fg = '#ff80ff', ctermfg = 'LightBlue' })
+ hi('Type', { fg = '#60ff60', bold = true, ctermfg = 'LightGreen' })
+ hi('Underlined', { fg = '#80a0ff', underline = true, ctermfg = 'LightBlue', cterm = { underline = true } })
+ hi('Ignore', { ctermfg = 'Black' })
+end
+--stylua: ignore end
diff --git a/runtime/colors/wildcharm.vim b/runtime/colors/wildcharm.vim
index 0f95ec88bb..c47a66d148 100644
--- a/runtime/colors/wildcharm.vim
+++ b/runtime/colors/wildcharm.vim
@@ -4,11 +4,12 @@
" Maintainer: Maxim Kim <habamax@gmail.com>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Sun 12 Mar 2023 18:46:06 AEDT
+" Last Updated: Mon 08 Jan 2024 09:40:36 AM AEDT
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'wildcharm'
let s:t_Co = &t_Co
@@ -55,8 +56,8 @@ if &background ==# 'dark'
hi PmenuExtra guifg=#767676 guibg=#303030 gui=NONE cterm=NONE
hi PmenuExtraSel guifg=#000000 guibg=#ffaf00 gui=NONE cterm=NONE
hi SignColumn guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
- hi Error guifg=#ffffff guibg=#d7005f gui=NONE cterm=NONE
- hi ErrorMsg guifg=#ffffff guibg=#d7005f gui=NONE cterm=NONE
+ hi Error guifg=#d7005f guibg=#ffffff gui=reverse cterm=reverse
+ hi ErrorMsg guifg=#d7005f guibg=#ffffff gui=reverse cterm=reverse
hi ModeMsg guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold
hi MoreMsg guifg=#00d75f guibg=NONE gui=NONE cterm=NONE
hi Question guifg=#ff87ff guibg=NONE gui=NONE cterm=NONE
@@ -67,9 +68,9 @@ if &background ==# 'dark'
hi WildMenu guifg=#000000 guibg=#ffaf00 gui=NONE cterm=NONE
hi debugPC guifg=#0087d7 guibg=NONE gui=reverse cterm=reverse
hi debugBreakpoint guifg=#00afaf guibg=NONE gui=reverse cterm=reverse
- hi Cursor guifg=#ffffff guibg=#000000 gui=reverse cterm=reverse
- hi lCursor guifg=#ff5fff guibg=#000000 gui=reverse cterm=reverse
- hi Visual guifg=#000000 guibg=#0087d7 gui=NONE cterm=NONE
+ hi Cursor guifg=#000000 guibg=#ffffff gui=NONE cterm=NONE
+ hi lCursor guifg=#000000 guibg=#ff5fff gui=NONE cterm=NONE
+ hi Visual guifg=#0087d7 guibg=#000000 gui=reverse cterm=reverse
hi VisualNOS guifg=#000000 guibg=#00afff gui=NONE cterm=NONE
hi CursorLine guifg=NONE guibg=#262626 gui=NONE cterm=NONE
hi CursorColumn guifg=NONE guibg=#262626 gui=NONE cterm=NONE
@@ -97,8 +98,9 @@ if &background ==# 'dark'
hi DiffChange guifg=#d0d0d0 guibg=#5f5f5f gui=NONE cterm=NONE
hi DiffText guifg=#afffff guibg=#5f8787 gui=NONE cterm=NONE
hi DiffDelete guifg=#ffafaf guibg=#875f5f gui=NONE cterm=NONE
- hi diffAdded guifg=#00af5f guibg=NONE gui=NONE cterm=NONE
- hi diffRemoved guifg=#d7005f guibg=NONE gui=NONE cterm=NONE
+ hi Added guifg=#00af5f guibg=NONE gui=NONE cterm=NONE
+ hi Changed guifg=#0087d7 guibg=NONE gui=NONE cterm=NONE
+ hi Removed guifg=#d7005f guibg=NONE gui=NONE cterm=NONE
else
" Light background
if (has('termguicolors') && &termguicolors) || has('gui_running')
@@ -133,8 +135,8 @@ else
hi PmenuExtra guifg=#808080 guibg=#e4e4e4 gui=NONE cterm=NONE
hi PmenuExtraSel guifg=#ffffff guibg=#d78700 gui=NONE cterm=NONE
hi SignColumn guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
- hi Error guifg=#ffffff guibg=#d70000 gui=NONE cterm=NONE
- hi ErrorMsg guifg=#ffffff guibg=#d70000 gui=NONE cterm=NONE
+ hi Error guifg=#d70000 guibg=#ffffff gui=reverse cterm=reverse
+ hi ErrorMsg guifg=#d70000 guibg=#ffffff gui=reverse cterm=reverse
hi ModeMsg guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold
hi MoreMsg guifg=#008700 guibg=NONE gui=NONE cterm=NONE
hi Question guifg=#870087 guibg=NONE gui=NONE cterm=NONE
@@ -145,9 +147,9 @@ else
hi WildMenu guifg=#ffffff guibg=#d78700 gui=NONE cterm=NONE
hi debugPC guifg=#005faf guibg=NONE gui=reverse cterm=reverse
hi debugBreakpoint guifg=#008787 guibg=NONE gui=reverse cterm=reverse
- hi Cursor guifg=#000000 guibg=#ffffff gui=reverse cterm=reverse
- hi lCursor guifg=#ff00ff guibg=#000000 gui=reverse cterm=reverse
- hi Visual guifg=#ffffff guibg=#0087d7 gui=NONE cterm=NONE
+ hi Cursor guifg=#ffffff guibg=#000000 gui=NONE cterm=NONE
+ hi lCursor guifg=#000000 guibg=#ff00ff gui=NONE cterm=NONE
+ hi Visual guifg=#0087d7 guibg=#ffffff gui=reverse cterm=reverse
hi VisualNOS guifg=#ffffff guibg=#005faf gui=NONE cterm=NONE
hi CursorLine guifg=NONE guibg=#eeeeee gui=NONE cterm=NONE
hi CursorColumn guifg=NONE guibg=#eeeeee gui=NONE cterm=NONE
@@ -175,8 +177,9 @@ else
hi DiffChange guifg=#262626 guibg=#dadada gui=NONE cterm=NONE
hi DiffText guifg=#005f5f guibg=#afd7d7 gui=NONE cterm=NONE
hi DiffDelete guifg=#875f5f guibg=#ffd7d7 gui=NONE cterm=NONE
- hi diffAdded guifg=#008700 guibg=NONE gui=NONE cterm=NONE
- hi diffRemoved guifg=#d70000 guibg=NONE gui=NONE cterm=NONE
+ hi Added guifg=#5faf5f guibg=NONE gui=NONE cterm=NONE
+ hi Changed guifg=#0087d7 guibg=NONE gui=NONE cterm=NONE
+ hi Removed guifg=#d70000 guibg=NONE gui=NONE cterm=NONE
endif
if s:t_Co >= 256
@@ -215,8 +218,8 @@ if s:t_Co >= 256
hi PmenuExtra ctermfg=243 ctermbg=236 cterm=NONE
hi PmenuExtraSel ctermfg=16 ctermbg=214 cterm=NONE
hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
- hi Error ctermfg=231 ctermbg=161 cterm=NONE
- hi ErrorMsg ctermfg=231 ctermbg=161 cterm=NONE
+ hi Error ctermfg=161 ctermbg=231 cterm=reverse
+ hi ErrorMsg ctermfg=161 ctermbg=231 cterm=reverse
hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
hi MoreMsg ctermfg=41 ctermbg=NONE cterm=NONE
hi Question ctermfg=213 ctermbg=NONE cterm=NONE
@@ -227,7 +230,7 @@ if s:t_Co >= 256
hi WildMenu ctermfg=16 ctermbg=214 cterm=NONE
hi debugPC ctermfg=32 ctermbg=NONE cterm=reverse
hi debugBreakpoint ctermfg=37 ctermbg=NONE cterm=reverse
- hi Visual ctermfg=16 ctermbg=32 cterm=NONE
+ hi Visual ctermfg=32 ctermbg=16 cterm=reverse
hi VisualNOS ctermfg=16 ctermbg=39 cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=235 cterm=NONE
hi CursorColumn ctermfg=NONE ctermbg=235 cterm=NONE
@@ -255,8 +258,9 @@ if s:t_Co >= 256
hi DiffChange ctermfg=252 ctermbg=59 cterm=NONE
hi DiffText ctermfg=159 ctermbg=66 cterm=NONE
hi DiffDelete ctermfg=217 ctermbg=95 cterm=NONE
- hi diffAdded ctermfg=35 ctermbg=NONE cterm=NONE
- hi diffRemoved ctermfg=161 ctermbg=NONE cterm=NONE
+ hi Added ctermfg=35 ctermbg=NONE cterm=NONE
+ hi Changed ctermfg=32 ctermbg=NONE cterm=NONE
+ hi Removed ctermfg=161 ctermbg=NONE cterm=NONE
else
" Light background
hi Normal ctermfg=16 ctermbg=231 cterm=NONE
@@ -284,8 +288,8 @@ if s:t_Co >= 256
hi PmenuExtra ctermfg=240 ctermbg=254 cterm=NONE
hi PmenuExtraSel ctermfg=231 ctermbg=172 cterm=NONE
hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
- hi Error ctermfg=231 ctermbg=160 cterm=NONE
- hi ErrorMsg ctermfg=231 ctermbg=160 cterm=NONE
+ hi Error ctermfg=160 ctermbg=231 cterm=reverse
+ hi ErrorMsg ctermfg=160 ctermbg=231 cterm=reverse
hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
hi MoreMsg ctermfg=28 ctermbg=NONE cterm=NONE
hi Question ctermfg=90 ctermbg=NONE cterm=NONE
@@ -296,7 +300,7 @@ if s:t_Co >= 256
hi WildMenu ctermfg=231 ctermbg=172 cterm=NONE
hi debugPC ctermfg=25 ctermbg=NONE cterm=reverse
hi debugBreakpoint ctermfg=30 ctermbg=NONE cterm=reverse
- hi Visual ctermfg=231 ctermbg=32 cterm=NONE
+ hi Visual ctermfg=32 ctermbg=231 cterm=reverse
hi VisualNOS ctermfg=231 ctermbg=25 cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=255 cterm=NONE
hi CursorColumn ctermfg=NONE ctermbg=255 cterm=NONE
@@ -324,8 +328,9 @@ if s:t_Co >= 256
hi DiffChange ctermfg=235 ctermbg=253 cterm=NONE
hi DiffText ctermfg=23 ctermbg=152 cterm=NONE
hi DiffDelete ctermfg=95 ctermbg=224 cterm=NONE
- hi diffAdded ctermfg=28 ctermbg=NONE cterm=NONE
- hi diffRemoved ctermfg=160 ctermbg=NONE cterm=NONE
+ hi Added ctermfg=71 ctermbg=NONE cterm=NONE
+ hi Changed ctermfg=32 ctermbg=NONE cterm=NONE
+ hi Removed ctermfg=160 ctermbg=NONE cterm=NONE
endif
unlet s:t_Co
finish
@@ -358,8 +363,8 @@ if s:t_Co >= 16
hi PmenuExtra ctermfg=darkgrey ctermbg=grey cterm=NONE
hi PmenuExtraSel ctermfg=black ctermbg=darkyellow cterm=NONE
hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
- hi Error ctermfg=white ctermbg=darkred cterm=NONE
- hi ErrorMsg ctermfg=white ctermbg=darkred cterm=NONE
+ hi Error ctermfg=darkred ctermbg=white cterm=reverse
+ hi ErrorMsg ctermfg=darkred ctermbg=white cterm=reverse
hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
hi MoreMsg ctermfg=green ctermbg=NONE cterm=NONE
hi Question ctermfg=magenta ctermbg=NONE cterm=NONE
@@ -370,7 +375,7 @@ if s:t_Co >= 16
hi WildMenu ctermfg=black ctermbg=yellow cterm=NONE
hi debugPC ctermfg=darkblue ctermbg=NONE cterm=reverse
hi debugBreakpoint ctermfg=darkcyan ctermbg=NONE cterm=reverse
- hi Visual ctermfg=black ctermbg=darkblue cterm=NONE
+ hi Visual ctermfg=darkblue ctermbg=black cterm=reverse
hi VisualNOS ctermfg=black ctermbg=blue cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
hi CursorColumn ctermfg=black ctermbg=yellow cterm=NONE
@@ -394,12 +399,13 @@ if s:t_Co >= 16
hi Directory ctermfg=blue ctermbg=NONE cterm=bold
hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
- hi DiffAdd ctermfg=black ctermbg=darkmagenta cterm=NONE
+ hi DiffAdd ctermfg=black ctermbg=darkgreen cterm=NONE
hi DiffChange ctermfg=black ctermbg=lightgray cterm=NONE
hi DiffText ctermfg=black ctermbg=cyan cterm=NONE
hi DiffDelete ctermfg=black ctermbg=darkred cterm=NONE
- hi diffAdded ctermfg=darkgreen ctermbg=NONE cterm=NONE
- hi diffRemoved ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Added ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Changed ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi Removed ctermfg=darkred ctermbg=NONE cterm=NONE
else
" Light background
hi Normal ctermfg=black ctermbg=white cterm=NONE
@@ -427,8 +433,8 @@ if s:t_Co >= 16
hi PmenuExtra ctermfg=darkgrey ctermbg=grey cterm=NONE
hi PmenuExtraSel ctermfg=black ctermbg=darkyellow cterm=NONE
hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
- hi Error ctermfg=white ctermbg=red cterm=NONE
- hi ErrorMsg ctermfg=white ctermbg=red cterm=NONE
+ hi Error ctermfg=red ctermbg=white cterm=reverse
+ hi ErrorMsg ctermfg=red ctermbg=white cterm=reverse
hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE
hi Question ctermfg=darkmagenta ctermbg=NONE cterm=NONE
@@ -439,7 +445,7 @@ if s:t_Co >= 16
hi WildMenu ctermfg=white ctermbg=yellow cterm=NONE
hi debugPC ctermfg=darkblue ctermbg=NONE cterm=reverse
hi debugBreakpoint ctermfg=darkcyan ctermbg=NONE cterm=reverse
- hi Visual ctermfg=white ctermbg=blue cterm=NONE
+ hi Visual ctermfg=blue ctermbg=white cterm=reverse
hi VisualNOS ctermfg=white ctermbg=darkblue cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
hi CursorColumn ctermfg=black ctermbg=yellow cterm=NONE
@@ -463,12 +469,13 @@ if s:t_Co >= 16
hi Directory ctermfg=darkblue ctermbg=NONE cterm=bold
hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
- hi DiffAdd ctermfg=black ctermbg=darkmagenta cterm=NONE
+ hi DiffAdd ctermfg=black ctermbg=darkgreen cterm=NONE
hi DiffChange ctermfg=black ctermbg=lightgray cterm=NONE
hi DiffText ctermfg=black ctermbg=cyan cterm=NONE
hi DiffDelete ctermfg=black ctermbg=darkred cterm=NONE
- hi diffAdded ctermfg=darkgreen ctermbg=NONE cterm=NONE
- hi diffRemoved ctermfg=red ctermbg=NONE cterm=NONE
+ hi Added ctermfg=green ctermbg=NONE cterm=NONE
+ hi Changed ctermfg=blue ctermbg=NONE cterm=NONE
+ hi Removed ctermfg=red ctermbg=NONE cterm=NONE
endif
unlet s:t_Co
finish
@@ -513,12 +520,12 @@ if s:t_Co >= 8
hi WildMenu ctermfg=black ctermbg=darkyellow cterm=NONE
hi debugPC ctermfg=darkblue ctermbg=NONE cterm=reverse
hi debugBreakpoint ctermfg=darkcyan ctermbg=NONE cterm=reverse
- hi Visual ctermfg=black ctermbg=darkblue cterm=NONE
+ hi Visual ctermfg=darkblue ctermbg=black cterm=reverse
hi MatchParen ctermfg=NONE ctermbg=NONE cterm=bold,underline
hi VisualNOS ctermfg=black ctermbg=darkblue cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
hi CursorColumn ctermfg=black ctermbg=darkyellow cterm=NONE
- hi Folded ctermfg=black ctermbg=NONE cterm=bold
+ hi Folded ctermfg=grey ctermbg=NONE cterm=bold
hi ColorColumn ctermfg=black ctermbg=darkyellow cterm=NONE
hi SpellBad ctermfg=darkred ctermbg=NONE cterm=reverse
hi SpellCap ctermfg=darkcyan ctermbg=NONE cterm=reverse
@@ -527,20 +534,20 @@ if s:t_Co >= 8
hi Comment ctermfg=NONE ctermbg=NONE cterm=bold
hi Constant ctermfg=darkred ctermbg=NONE cterm=NONE
hi String ctermfg=darkgreen ctermbg=NONE cterm=NONE
- hi Identifier ctermfg=NONE ctermbg=NONE cterm=NONE
- hi Statement ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi Identifier ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=darkblue ctermbg=NONE cterm=NONE
hi Type ctermfg=darkyellow ctermbg=NONE cterm=NONE
hi PreProc ctermfg=darkcyan ctermbg=NONE cterm=NONE
- hi Special ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Special ctermfg=darkmagenta ctermbg=NONE cterm=NONE
hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
hi Title ctermfg=NONE ctermbg=NONE cterm=bold
hi Directory ctermfg=darkblue ctermbg=NONE cterm=bold
hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
- hi DiffAdd ctermfg=black ctermbg=darkmagenta cterm=NONE
- hi DiffChange ctermfg=black ctermbg=darkcyan cterm=NONE
- hi DiffText ctermfg=black ctermbg=grey cterm=NONE
- hi DiffDelete ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi DiffAdd ctermfg=black ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=black ctermbg=darkblue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=darkmagenta cterm=NONE
+ hi DiffDelete ctermfg=black ctermbg=darkred cterm=NONE
else
" Light background
hi Normal ctermfg=black ctermbg=grey cterm=NONE
@@ -580,7 +587,7 @@ if s:t_Co >= 8
hi WildMenu ctermfg=black ctermbg=darkyellow cterm=NONE
hi debugPC ctermfg=darkblue ctermbg=NONE cterm=reverse
hi debugBreakpoint ctermfg=darkcyan ctermbg=NONE cterm=reverse
- hi Visual ctermfg=grey ctermbg=darkblue cterm=NONE
+ hi Visual ctermfg=darkblue ctermbg=grey cterm=reverse
hi MatchParen ctermfg=NONE ctermbg=NONE cterm=bold,underline
hi VisualNOS ctermfg=black ctermbg=darkblue cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
@@ -594,20 +601,20 @@ if s:t_Co >= 8
hi Comment ctermfg=NONE ctermbg=NONE cterm=bold
hi Constant ctermfg=darkred ctermbg=NONE cterm=NONE
hi String ctermfg=darkgreen ctermbg=NONE cterm=NONE
- hi Identifier ctermfg=NONE ctermbg=NONE cterm=NONE
- hi Statement ctermfg=darkblue ctermbg=NONE cterm=bold
+ hi Identifier ctermfg=darkmagenta ctermbg=NONE cterm=NONE
+ hi Statement ctermfg=darkblue ctermbg=NONE cterm=NONE
hi Type ctermfg=darkyellow ctermbg=NONE cterm=NONE
hi PreProc ctermfg=darkcyan ctermbg=NONE cterm=NONE
- hi Special ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Special ctermfg=darkmagenta ctermbg=NONE cterm=NONE
hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
hi Title ctermfg=NONE ctermbg=NONE cterm=bold
hi Directory ctermfg=darkblue ctermbg=NONE cterm=bold
hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
- hi DiffAdd ctermfg=black ctermbg=darkmagenta cterm=NONE
- hi DiffChange ctermfg=black ctermbg=darkcyan cterm=NONE
- hi DiffText ctermfg=grey ctermbg=black cterm=NONE
- hi DiffDelete ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi DiffAdd ctermfg=black ctermbg=darkgreen cterm=NONE
+ hi DiffChange ctermfg=black ctermbg=darkblue cterm=NONE
+ hi DiffText ctermfg=black ctermbg=darkmagenta cterm=NONE
+ hi DiffDelete ctermfg=black ctermbg=darkred cterm=NONE
endif
unlet s:t_Co
finish
@@ -708,7 +715,7 @@ endif
" Color: colorlC #ff5fff 207 magenta
" Color: colorDim #878787 102 grey
" Color: colorMP #ff00af 199 magenta
-" Color: diffAdd #5f875f 65 darkmagenta
+" Color: diffAdd #5f875f 65 darkgreen
" Color: diffAddFg #afffaf 157 black
" Color: diffDelete #875f5f 95 darkred
" Color: diffDeleteFg #ffafaf 217 black
@@ -747,7 +754,7 @@ endif
" Color: colorDim #626262 241 darkgrey
" Color: colorSt #5f5f5f 59 darkgrey
" Color: colorMP #ff00af 199 magenta
-" Color: diffAdd #afd7af 151 darkmagenta
+" Color: diffAdd #afd7af 151 darkgreen
" Color: diffAddFg #005f00 22 black
" Color: diffDelete #ffd7d7 224 darkred
" Color: diffDeleteFg #875f5f 95 black
@@ -758,4 +765,4 @@ endif
" Term colors: color00 color01 color02 color03 color04 color05 color06 color07
" Term colors: color08 color09 color10 color11 color12 color13 color14 color15
" Background: any
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/zaibatsu.vim b/runtime/colors/zaibatsu.vim
index e029f1451b..726843345b 100644
--- a/runtime/colors/zaibatsu.vim
+++ b/runtime/colors/zaibatsu.vim
@@ -4,13 +4,14 @@
" Maintainer: Romain Lafourcade <romainlafourcade@gmail.com>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Sun Mar 12 17:21:15 2023
+" Last Updated: Fri 15 Dec 2023 20:05:43
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
set background=dark
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'zaibatsu'
let s:t_Co = &t_Co
@@ -564,4 +565,4 @@ endif
" Color: fgDiffB #000000 16 black
" Color: bgDiffC8 #5F87AF 67 darkblue
" Color: bgDiffD8 #AF5FAF 133 darkmagenta
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/zellner.vim b/runtime/colors/zellner.vim
index af48ef86dc..37f012e92d 100644
--- a/runtime/colors/zellner.vim
+++ b/runtime/colors/zellner.vim
@@ -4,13 +4,14 @@
" Maintainer: Original maintainer Ron Aaron <ron@ronware.org>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 02 Sep 2022 09:54:15 MSK
+" Last Updated: Fri 15 Dec 2023 20:05:44
-" Generated by Colortemplate v2.2.0
+" Generated by Colortemplate v2.2.3
set background=light
-hi clear
+" hi clear
+source $VIMRUNTIME/colors/vim.lua " Nvim: revert to Vim default color scheme
let g:colors_name = 'zellner'
let s:t_Co = &t_Co
@@ -412,4 +413,4 @@ endif
" Color: fgDiffB #000000 16 black
" Color: bgDiffC8 #5F87AF 67 darkblue
" Color: bgDiffD8 #AF5FAF 133 darkmagenta
-" vim: et ts=2 sw=2
+" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/compiler/gm2.vim b/runtime/compiler/gm2.vim
new file mode 100644
index 0000000000..5053912200
--- /dev/null
+++ b/runtime/compiler/gm2.vim
@@ -0,0 +1,26 @@
+" Vim compiler file
+" Compiler: GNU Modula-2 Compiler
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2024 Jan 04
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "gm2"
+
+if exists(":CompilerSet") != 2 " older Vim always used :setlocal
+ command -nargs=* CompilerSet setlocal <args>
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+CompilerSet makeprg=gm2
+CompilerSet errorformat=%-G%f:%l:%c:\ error:\ compilation\ failed,
+ \%f:%l:%c:\ %trror:\ %m,
+ \%f:%l:%c:\ %tarning:\ %m,
+ \%f:%l:%c:\ %tote:\ %m,
+ \%-G%.%#
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index ba3b7c0915..87269ad147 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -579,7 +579,7 @@ created for extmark changes.
==============================================================================
Global Functions *api-global*
-nvim__get_runtime({pat}, {all}, {*opts}) *nvim__get_runtime()*
+nvim__get_runtime({pat}, {all}, {opts}) *nvim__get_runtime()*
Find files in runtime directories
Attributes: ~
@@ -700,6 +700,21 @@ nvim_chan_send({chan}, {data}) *nvim_chan_send()*
• {chan} id of the channel
• {data} data to write. 8-bit clean: can contain NUL bytes.
+nvim_complete_set({index}, {opts}) *nvim_complete_set()*
+ Set info for the completion candidate index. if the info was shown in a
+ window, then the window and buffer ids are returned for further
+ customization. If the text was not shown, an empty dict is returned.
+
+ Parameters: ~
+ • {index} the completion candidate index
+ • {opts} Optional parameters.
+ • info: (string) info text.
+
+ Return: ~
+ Dictionary containing these keys:
+ • winid: (number) floating window id
+ • bufnr: (number) buffer id in floating window
+
nvim_create_buf({listed}, {scratch}) *nvim_create_buf()*
Creates a new, empty, unnamed buffer.
@@ -751,13 +766,13 @@ nvim_del_var({name}) *nvim_del_var()*
Parameters: ~
• {name} Variable name
-nvim_echo({chunks}, {history}, {*opts}) *nvim_echo()*
+nvim_echo({chunks}, {history}, {opts}) *nvim_echo()*
Echo a message.
Parameters: ~
- • {chunks} A list of [text, hl_group] arrays, each representing a text
- chunk with specified highlight. `hl_group` element can be
- omitted for no highlight.
+ • {chunks} A list of `[text, hl_group]` arrays, each representing a
+ text chunk with specified highlight. `hl_group` element can
+ be omitted for no highlight.
• {history} if true, add to |message-history|.
• {opts} Optional parameters.
• verbose: Message was printed as a result of 'verbose'
@@ -782,7 +797,7 @@ nvim_err_writeln({str}) *nvim_err_writeln()*
See also: ~
• nvim_err_write()
-nvim_eval_statusline({str}, {*opts}) *nvim_eval_statusline()*
+nvim_eval_statusline({str}, {opts}) *nvim_eval_statusline()*
Evaluates statusline string.
Attributes: ~
@@ -863,16 +878,19 @@ nvim_get_api_info() *nvim_get_api_info()*
Returns a 2-tuple (Array), where item 0 is the current channel id and item
1 is the |api-metadata| map (Dictionary).
- Return: ~
- 2-tuple [{channel-id}, {api-metadata}]
-
Attributes: ~
|api-fast|
|RPC| only
+ Return: ~
+ 2-tuple `[{channel-id}, {api-metadata}]`
+
nvim_get_chan_info({chan}) *nvim_get_chan_info()*
Gets information about a channel.
+ Parameters: ~
+ • {chan} channel_id, or 0 for current channel
+
Return: ~
Dictionary describing a channel, with these keys:
• "id" Channel id.
@@ -882,12 +900,10 @@ nvim_get_chan_info({chan}) *nvim_get_chan_info()*
• "stderr" stderr of this Nvim instance
• "socket" TCP/IP socket or named pipe
• "job" Job with communication over its stdio.
-
• "mode" How data received on the channel is interpreted.
• "bytes" Send and receive raw bytes.
• "terminal" |terminal| instance interprets ASCII sequences.
• "rpc" |RPC| communication on the channel is active.
-
• "pty" (optional) Name of pseudoterminal. On a POSIX system this is a
device path like "/dev/pts/1". If the name is unknown, the key will
still be present if a pty is used (e.g. for conpty on Windows).
@@ -919,7 +935,7 @@ nvim_get_color_map() *nvim_get_color_map()*
Return: ~
Map of color names and RGB values.
-nvim_get_context({*opts}) *nvim_get_context()*
+nvim_get_context({opts}) *nvim_get_context()*
Gets a map of the current editor state.
Parameters: ~
@@ -954,7 +970,7 @@ nvim_get_current_win() *nvim_get_current_win()*
Return: ~
Window handle
-nvim_get_hl({ns_id}, {*opts}) *nvim_get_hl()*
+nvim_get_hl({ns_id}, {opts}) *nvim_get_hl()*
Gets all or specific highlight groups in a namespace.
Note: ~
@@ -983,7 +999,7 @@ nvim_get_hl_id_by_name({name}) *nvim_get_hl_id_by_name()*
similar to |hlID()|, but allocates a new ID if not present.
-nvim_get_hl_ns({*opts}) *nvim_get_hl_ns()*
+nvim_get_hl_ns({opts}) *nvim_get_hl_ns()*
Gets the active highlight namespace.
Parameters: ~
@@ -1032,12 +1048,12 @@ nvim_get_mode() *nvim_get_mode()*
Gets the current mode. |mode()| "blocking" is true if Nvim is waiting for
input.
- Return: ~
- Dictionary { "mode": String, "blocking": Boolean }
-
Attributes: ~
|api-fast|
+ Return: ~
+ Dictionary { "mode": String, "blocking": Boolean }
+
nvim_get_proc({pid}) *nvim_get_proc()*
Gets info describing process `pid`.
@@ -1099,7 +1115,7 @@ nvim_input({keys}) *nvim_input()*
• |keycodes| like <CR> are translated, so "<" is special. To input a
literal "<", send <LT>.
• For mouse events use |nvim_input_mouse()|. The pseudokey form
- "<LeftMouse><col,row>" is deprecated since |api-level| 6.
+ `<LeftMouse><col,row>` is deprecated since |api-level| 6.
Attributes: ~
|api-fast|
@@ -1122,7 +1138,7 @@ nvim_input_mouse({button}, {action}, {modifier}, {grid}, {row}, {col})
• Currently this doesn't support "scripting" multiple mouse events by
calling it multiple times in a loop: the intermediate mouse positions
will be ignored. It should be used to implement real-time mouse input
- in a GUI. The deprecated pseudokey form ("<LeftMouse><col,row>") of
+ in a GUI. The deprecated pseudokey form (`<LeftMouse><col,row>`) of
|nvim_input()| has the same limitation.
Attributes: ~
@@ -1130,7 +1146,7 @@ nvim_input_mouse({button}, {action}, {modifier}, {grid}, {row}, {col})
Parameters: ~
• {button} Mouse button: one of "left", "right", "middle", "wheel",
- "move".
+ "move", "x1", "x2".
• {action} For ordinary buttons, one of "press", "drag", "release".
For the wheel, one of "up", "down", "left", "right".
Ignored for "move".
@@ -1230,7 +1246,9 @@ nvim_open_term({buffer}, {opts}) *nvim_open_term()*
be to the pty master end. For instance, a carriage return
is sent as a "\r", not as a "\n". |textlock| applies. It
is possible to call |nvim_chan_send()| directly in the
- callback however. ["input", term, bufnr, data]
+ callback however. `["input", term, bufnr, data]`
+ • force_crlf: (boolean, default true) Convert "\n" to
+ "\r\n".
Return: ~
Channel id, or 0 on error
@@ -1260,13 +1278,13 @@ nvim_paste({data}, {crlf}, {phase}) *nvim_paste()*
• {data} Multiline input. May be binary (containing NUL bytes).
• {crlf} Also break lines at CR and CRLF.
• {phase} -1: paste in a single call (i.e. without streaming). To
- "stream" a paste, call `nvim_paste` sequentially with these `phase` values:
+ "stream" a paste, call `nvim_paste` sequentially with these
+ `phase` values:
• 1: starts the paste (exactly once)
• 2: continues the paste (zero or more times)
• 3: ends the paste (exactly once)
Return: ~
-
• true: Client may continue pasting.
• false: Client must cancel the paste.
@@ -1429,20 +1447,20 @@ nvim_set_current_win({window}) *nvim_set_current_win()*
Parameters: ~
• {window} Window handle
-nvim_set_hl({ns_id}, {name}, {*val}) *nvim_set_hl()*
+nvim_set_hl({ns_id}, {name}, {val}) *nvim_set_hl()*
Sets a highlight group.
Note: ~
- • Unlike the `:highlight` command which can update a highlight group, this
- function completely replaces the definition. For example:
+ • Unlike the `:highlight` command which can update a highlight group,
+ this function completely replaces the definition. For example:
`nvim_set_hl(0, 'Visual', {})` will clear the highlight group
'Visual'.
- • The fg and bg keys also accept the string values `"fg"` or `"bg"` which
- act as aliases to the corresponding foreground and background values
- of the Normal group. If the Normal group has not been defined, using
- these values results in an error.
- • If `link` is used in combination with other attributes; only the `link`
- will take effect (see |:hi-link|).
+ • The fg and bg keys also accept the string values `"fg"` or `"bg"`
+ which act as aliases to the corresponding foreground and background
+ values of the Normal group. If the Normal group has not been defined,
+ using these values results in an error.
+ • If `link` is used in combination with other attributes; only the
+ `link` will take effect (see |:hi-link|).
Parameters: ~
• {ns_id} Namespace id for this highlight |nvim_create_namespace()|.
@@ -1452,9 +1470,9 @@ nvim_set_hl({ns_id}, {name}, {*val}) *nvim_set_hl()*
activate them.
• {name} Highlight group name, e.g. "ErrorMsg"
• {val} Highlight definition map, accepts the following keys:
- • fg (or foreground): color name or "#RRGGBB", see note.
- • bg (or background): color name or "#RRGGBB", see note.
- • sp (or special): color name or "#RRGGBB"
+ • fg: color name or "#RRGGBB", see note.
+ • bg: color name or "#RRGGBB", see note.
+ • sp: color name or "#RRGGBB"
• blend: integer between 0 and 100
• bold: boolean
• standout: boolean
@@ -1499,13 +1517,13 @@ nvim_set_hl_ns_fast({ns_id}) *nvim_set_hl_ns_fast()*
Parameters: ~
• {ns_id} the namespace to activate
-nvim_set_keymap({mode}, {lhs}, {rhs}, {*opts}) *nvim_set_keymap()*
+nvim_set_keymap({mode}, {lhs}, {rhs}, {opts}) *nvim_set_keymap()*
Sets a global |mapping| for the given mode.
To set a buffer-local mapping, use |nvim_buf_set_keymap()|.
Unlike |:map|, leading/trailing whitespace is accepted as part of the
- {lhs} or {rhs}. Empty {rhs} is |<Nop>|. |keycodes| are replaced as usual.
+ {lhs} or {rhs}. Empty {rhs} is <Nop>. |keycodes| are replaced as usual.
Example: >vim
call nvim_set_keymap('n', ' <NL>', '', {'nowait': v:true})
@@ -1516,14 +1534,14 @@ nvim_set_keymap({mode}, {lhs}, {rhs}, {*opts}) *nvim_set_keymap()*
<
Parameters: ~
- • {mode} Mode short-name (map command prefix: "n", "i", "v", "x", 
) or
- "!" for |:map!|, or empty string for |:map|. "ia", "ca" or
+ • {mode} Mode short-name (map command prefix: "n", "i", "v", "x", 
)
+ or "!" for |:map!|, or empty string for |:map|. "ia", "ca" or
"!a" for abbreviation in Insert mode, Cmdline mode, or both,
respectively
• {lhs} Left-hand-side |{lhs}| of the mapping.
• {rhs} Right-hand-side |{rhs}| of the mapping.
• {opts} Optional parameters map: Accepts all |:map-arguments| as keys
- except |<buffer>|, values are booleans (default false). Also:
+ except <buffer>, values are booleans (default false). Also:
• "noremap" disables |recursive_mapping|, like |:noremap|
• "desc" human-readable description.
• "callback" Lua function called in place of {rhs}.
@@ -1630,7 +1648,7 @@ nvim_eval({expr}) *nvim_eval()*
Return: ~
Evaluation result or expanded object
-nvim_exec2({src}, {*opts}) *nvim_exec2()*
+nvim_exec2({src}, {opts}) *nvim_exec2()*
Executes Vimscript (multiline block of Ex commands), like anonymous
|:source|.
@@ -1671,8 +1689,8 @@ nvim_parse_expression({expr}, {flags}, {highlight})
operator/space, though also yielding an error).
• "l" when needing to start parsing with lvalues for
":let" or ":for". Common flag sets:
- • "m" to parse like for ":echo".
- • "E" to parse like for "<C-r>=".
+ • "m" to parse like for `":echo"`.
+ • "E" to parse like for `"<C-r>="`.
• empty string for ":call".
• "lm" to parse for ":let".
• {highlight} If true, return value will also include "highlight" key
@@ -1683,22 +1701,20 @@ nvim_parse_expression({expr}, {flags}, {highlight})
region [start_col, end_col)).
Return: ~
-
• AST: top-level dictionary with these keys:
• "error": Dictionary with error, present only if parser saw some
error. Contains the following keys:
• "message": String, error message in printf format, translated.
Must contain exactly one "%.*s".
• "arg": String, error message argument.
-
• "len": Amount of bytes successfully parsed. With flags equal to ""
- that should be equal to the length of expr string. (“Successfully
- parsed” here means “participated in AST creation”, not “till the
- first error”.)
+ that should be equal to the length of expr string. ("Successfully
+ parsed" here means "participated in AST creation", not "till the
+ first error".)
• "ast": AST, either nil or a dictionary with these keys:
• "type": node type, one of the value names from ExprASTNodeType
stringified without "kExprNode" prefix.
- • "start": a pair [line, column] describing where node is
+ • "start": a pair `[line, column]` describing where node is
"started" where "line" is always 0 (will not be 0 if you will be
using this API on e.g. ":let", but that is not present yet).
Both elements are Integers.
@@ -1709,7 +1725,6 @@ nvim_parse_expression({expr}, {flags}, {highlight})
is zero, one or two children, key will not be present if node
has no children. Maximum number of children may be found in
node_maxchildren array.
-
• Local values (present only for certain nodes):
• "scope": a single Integer, specifies scope for "Option" and
"PlainIdentifier" nodes. For "Option" it is one of ExprOptScope
@@ -1739,11 +1754,11 @@ nvim_parse_expression({expr}, {flags}, {highlight})
Command Functions *api-command*
*nvim_buf_create_user_command()*
-nvim_buf_create_user_command({buffer}, {name}, {command}, {*opts})
+nvim_buf_create_user_command({buffer}, {name}, {command}, {opts})
Creates a buffer-local command |user-commands|.
Parameters: ~
- • {buffer} Buffer handle, or 0 for current buffer.
+ • {buffer} Buffer handle, or 0 for current buffer.
See also: ~
• nvim_create_user_command
@@ -1759,7 +1774,7 @@ nvim_buf_del_user_command({buffer}, {name})
• {buffer} Buffer handle, or 0 for current buffer.
• {name} Name of the command to delete.
-nvim_buf_get_commands({buffer}, {*opts}) *nvim_buf_get_commands()*
+nvim_buf_get_commands({buffer}, {opts}) *nvim_buf_get_commands()*
Gets a map of buffer-local |user-commands|.
Parameters: ~
@@ -1769,7 +1784,7 @@ nvim_buf_get_commands({buffer}, {*opts}) *nvim_buf_get_commands()*
Return: ~
Map of maps describing commands.
-nvim_cmd({*cmd}, {*opts}) *nvim_cmd()*
+nvim_cmd({cmd}, {opts}) *nvim_cmd()*
Executes an Ex command.
Unlike |nvim_command()| this command takes a structured Dictionary instead
@@ -1804,7 +1819,7 @@ nvim_cmd({*cmd}, {*opts}) *nvim_cmd()*
• |nvim_command()|
*nvim_create_user_command()*
-nvim_create_user_command({name}, {command}, {*opts})
+nvim_create_user_command({name}, {command}, {opts})
Creates a global |user-commands| command.
For Lua usage see |lua-guide-commands-create|.
@@ -1824,22 +1839,21 @@ nvim_create_user_command({name}, {command}, {*opts})
argument that contains the following keys:
• name: (string) Command name
• args: (string) The args passed to the command, if any
- |<args>|
+ <args>
• fargs: (table) The args split by unescaped whitespace
- (when more than one argument is allowed), if any
- |<f-args>|
+ (when more than one argument is allowed), if any <f-args>
• nargs: (string) Number of arguments |:command-nargs|
• bang: (boolean) "true" if the command was executed with a
- ! modifier |<bang>|
+ ! modifier <bang>
• line1: (number) The starting line of the command range
- |<line1>|
+ <line1>
• line2: (number) The final line of the command range
- |<line2>|
+ <line2>
• range: (number) The number of items in the command range:
- 0, 1, or 2 |<range>|
- • count: (number) Any count supplied |<count>|
- • reg: (string) The optional register, if specified |<reg>|
- • mods: (string) Command modifiers, if any |<mods>|
+ 0, 1, or 2 <range>
+ • count: (number) Any count supplied <count>
+ • reg: (string) The optional register, if specified <reg>
+ • mods: (string) Command modifiers, if any <mods>
• smods: (table) Command modifiers in a structured format.
Has the same structure as the "mods" key of
|nvim_parse_cmd()|.
@@ -1864,7 +1878,7 @@ nvim_del_user_command({name}) *nvim_del_user_command()*
Parameters: ~
• {name} Name of the command to delete.
-nvim_get_commands({*opts}) *nvim_get_commands()*
+nvim_get_commands({opts}) *nvim_get_commands()*
Gets a map of global (non-buffer-local) Ex commands.
Currently only |user-commands| are supported, not builtin Ex commands.
@@ -1893,16 +1907,15 @@ nvim_parse_cmd({str}, {opts}) *nvim_parse_cmd()*
Return: ~
Dictionary containing command information, with these keys:
• cmd: (string) Command name.
- • range: (array) (optional) Command range (|<line1>| |<line2>|).
- Omitted if command doesn't accept a range. Otherwise, has no
- elements if no range was specified, one element if only a single
- range item was specified, or two elements if both range items were
- specified.
- • count: (number) (optional) Command |<count>|. Omitted if command
+ • range: (array) (optional) Command range (<line1> <line2>). Omitted
+ if command doesn't accept a range. Otherwise, has no elements if no
+ range was specified, one element if only a single range item was
+ specified, or two elements if both range items were specified.
+ • count: (number) (optional) Command <count>. Omitted if command
cannot take a count.
- • reg: (string) (optional) Command |<register>|. Omitted if command
+ • reg: (string) (optional) Command <register>. Omitted if command
cannot take a register.
- • bang: (boolean) Whether command contains a |<bang>| (!) modifier.
+ • bang: (boolean) Whether command contains a <bang> (!) modifier.
• args: (array) Command arguments.
• addr: (string) Value of |:command-addr|. Uses short name or "line"
for -addr=lines.
@@ -1916,13 +1929,11 @@ nvim_parse_cmd({str}, {opts}) *nvim_parse_cmd()*
• bar: (boolean) The "|" character is treated as a command separator
and the double quote character (") is treated as the start of a
comment.
-
• mods: (dictionary) |:command-modifiers|.
• filter: (dictionary) |:filter|.
• pattern: (string) Filter pattern. Empty string if there is no
filter.
• force: (boolean) Whether filter is inverted or not.
-
• silent: (boolean) |:silent|.
• emsg_silent: (boolean) |:silent!|.
• unsilent: (boolean) |:unsilent|.
@@ -1965,7 +1976,7 @@ nvim_get_all_options_info() *nvim_get_all_options_info()*
See also: ~
• |nvim_get_commands()|
-nvim_get_option_info2({name}, {*opts}) *nvim_get_option_info2()*
+nvim_get_option_info2({name}, {opts}) *nvim_get_option_info2()*
Gets the option information for one option from arbitrary buffer or window
Resulting dictionary has keys:
@@ -1999,7 +2010,7 @@ nvim_get_option_info2({name}, {*opts}) *nvim_get_option_info2()*
Return: ~
Option Information
-nvim_get_option_value({name}, {*opts}) *nvim_get_option_value()*
+nvim_get_option_value({name}, {opts}) *nvim_get_option_value()*
Gets the value of an option. The behavior of this function matches that of
|:set|: the local value of an option is returned if it exists; otherwise,
the global value is returned. Local values always correspond to the
@@ -2022,7 +2033,7 @@ nvim_get_option_value({name}, {*opts}) *nvim_get_option_value()*
Option value
*nvim_set_option_value()*
-nvim_set_option_value({name}, {value}, {*opts})
+nvim_set_option_value({name}, {value}, {opts})
Sets the value of an option. The behavior of this function matches that of
|:set|: for global-local options, both the global and local value are set
unless otherwise specified with {scope}.
@@ -2048,15 +2059,15 @@ For more information on buffers, see |buffers|.
Unloaded Buffers: ~
Buffers may be unloaded by the |:bunload| command or the buffer's
-|'bufhidden'| option. When a buffer is unloaded its file contents are
-freed from memory and vim cannot operate on the buffer lines until it is
-reloaded (usually by opening the buffer again in a new window). API
-methods such as |nvim_buf_get_lines()| and |nvim_buf_line_count()| will be
-affected.
+|'bufhidden'| option. When a buffer is unloaded its file contents are freed
+from memory and vim cannot operate on the buffer lines until it is reloaded
+(usually by opening the buffer again in a new window). API methods such as
+|nvim_buf_get_lines()| and |nvim_buf_line_count()| will be affected.
You can use |nvim_buf_is_loaded()| or |nvim_buf_line_count()| to check
whether a buffer is loaded.
+
nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
Activates buffer-update events on a channel, or as Lua callbacks.
@@ -2078,7 +2089,8 @@ nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
will be `nvim_buf_changedtick_event`. Not for Lua
callbacks.
• {opts} Optional parameters.
- • on_lines: Lua callback invoked on change. Return `true` to detach. Args:
+ • on_lines: Lua callback invoked on change. Return a
+ truthy value (not `false` or `nil`) to detach. Args:
• the string "lines"
• buffer handle
• b:changedtick
@@ -2088,10 +2100,10 @@ nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
• byte count of previous contents
• deleted_codepoints (if `utf_sizes` is true)
• deleted_codeunits (if `utf_sizes` is true)
-
• on_bytes: Lua callback invoked on change. This
callback receives more granular information about the
- change compared to on_lines. Return `true` to detach. Args:
+ change compared to on_lines. Return a truthy value
+ (not `false` or `nil`) to detach. Args:
• the string "bytes"
• buffer handle
• b:changedtick
@@ -2099,28 +2111,28 @@ nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
• start column of the changed text
• byte offset of the changed text (from the start of
the buffer)
- • old end row of the changed text
- • old end column of the changed text
+ • old end row of the changed text (offset from start
+ row)
+ • old end column of the changed text (if old end row
+ = 0, offset from start column)
• old end byte length of the changed text
- • new end row of the changed text
- • new end column of the changed text
+ • new end row of the changed text (offset from start
+ row)
+ • new end column of the changed text (if new end row
+ = 0, offset from start column)
• new end byte length of the changed text
-
• on_changedtick: Lua callback invoked on changedtick
increment without text change. Args:
• the string "changedtick"
• buffer handle
• b:changedtick
-
• on_detach: Lua callback invoked on detach. Args:
• the string "detach"
• buffer handle
-
• on_reload: Lua callback invoked on reload. The entire
buffer content should be considered changed. Args:
• the string "reload"
• buffer handle
-
• utf_sizes: include UTF-32 and UTF-16 size of the
replaced region, as args to `on_lines`.
• preview: also attach to command preview (i.e.
@@ -2156,8 +2168,7 @@ nvim_buf_call({buffer}, {fun}) *nvim_buf_call()*
only)
Return: ~
- Return value of function. NB: will deepcopy Lua values currently, use
- upvalues to send Lua references in and out.
+ Return value of function.
nvim_buf_del_keymap({buffer}, {mode}, {lhs}) *nvim_buf_del_keymap()*
Unmaps a buffer-local |mapping| for the given mode.
@@ -2235,8 +2246,8 @@ nvim_buf_get_keymap({buffer}, {mode}) *nvim_buf_get_keymap()*
Gets a list of buffer-local |mapping| definitions.
Parameters: ~
- • {mode} Mode short-name ("n", "i", "v", ...)
• {buffer} Buffer handle, or 0 for current buffer
+ • {mode} Mode short-name ("n", "i", "v", ...)
Return: ~
Array of |maparg()|-like dictionaries describing mappings. The
@@ -2375,7 +2386,7 @@ nvim_buf_line_count({buffer}) *nvim_buf_line_count()*
Line count, or 0 for unloaded buffer. |api-buffer|
*nvim_buf_set_keymap()*
-nvim_buf_set_keymap({buffer}, {mode}, {lhs}, {rhs}, {*opts})
+nvim_buf_set_keymap({buffer}, {mode}, {lhs}, {rhs}, {opts})
Sets a buffer-local |mapping| for the given mode.
Parameters: ~
@@ -2454,9 +2465,9 @@ nvim_buf_set_text({buffer}, {start_row}, {start_col}, {end_row}, {end_col},
Indexing is zero-based. Row indices are end-inclusive, and column indices
are end-exclusive.
- To insert text at a given `(row, column)` location, use `start_row =
- end_row = row` and `start_col = end_col = col`. To delete the text in a
- range, use `replacement = {}`.
+ To insert text at a given `(row, column)` location, use
+ `start_row = end_row = row` and `start_col = end_col = col`. To delete the
+ text in a range, use `replacement = {}`.
Prefer |nvim_buf_set_lines()| if you are only adding or deleting entire
lines.
@@ -2569,9 +2580,9 @@ nvim_buf_get_extmark_by_id({buffer}, {ns_id}, {id}, {opts})
0-indexed (row, col) tuple or empty list () if extmark id was absent
*nvim_buf_get_extmarks()*
-nvim_buf_get_extmarks({buffer}, {ns_id}, {start}, {end}, {*opts})
- Gets |extmarks| (including |signs|) in "traversal order" from a |charwise|
- region defined by buffer positions (inclusive, 0-indexed |api-indexing|).
+nvim_buf_get_extmarks({buffer}, {ns_id}, {start}, {end}, {opts})
+ Gets |extmarks| in "traversal order" from a |charwise| region defined by
+ buffer positions (inclusive, 0-indexed |api-indexing|).
Region can be given as (row,col) tuples, or valid extmark ids (whose
positions define the bounds). 0 and -1 are understood as (0,0) and (-1,-1)
@@ -2587,6 +2598,10 @@ nvim_buf_get_extmarks({buffer}, {ns_id}, {start}, {end}, {*opts})
the `overlap` option might be useful. Otherwise only the start position of
an extmark will be considered.
+ Note: legacy signs placed through the |:sign| commands are implemented as
+ extmarks and will show up here. Their details array will contain a
+ `sign_name` field.
+
Example: >lua
local api = vim.api
local pos = api.nvim_win_get_cursor(0)
@@ -2622,10 +2637,10 @@ nvim_buf_get_extmarks({buffer}, {ns_id}, {start}, {end}, {*opts})
"virt_text" and "virt_lines"
Return: ~
- List of [extmark_id, row, col] tuples in "traversal order".
+ List of `[extmark_id, row, col]` tuples in "traversal order".
*nvim_buf_set_extmark()*
-nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {*opts})
+nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts})
Creates or updates an |extmark|.
By default a new extmark is created when no id is passed in, but it is
@@ -2657,7 +2672,7 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {*opts})
EOL of a line, continue the highlight for the rest of the
screen line (just like for diff and cursorline highlight).
• virt_text : virtual text to link to this mark. A list of
- [text, highlight] tuples, each representing a text chunk
+ `[text, highlight]` tuples, each representing a text chunk
with specified highlight. `highlight` element can either
be a single highlight group, or an array of multiple
highlight groups that will be stacked (highest priority
@@ -2671,7 +2686,6 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {*opts})
• "right_align": display right aligned in the window.
• "inline": display at the specified column, and shift the
buffer text to the right as needed.
-
• virt_text_win_col : position the virtual text at a fixed
window column (starting from the first text column of the
screen line) instead of "virt_text_pos".
@@ -2679,6 +2693,8 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {*opts})
text is selected or hidden because of scrolling with
'nowrap' or 'smoothscroll'. Currently only affects
"overlay" virt_text.
+ • virt_text_repeat_linebreak : repeat the virtual text on
+ wrapped lines.
• hl_mode : control how highlights are combined with the
highlights of the text. Currently only affects virt_text
highlights, but might affect `hl_group` in later versions.
@@ -2687,16 +2703,16 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {*opts})
• "combine": combine with background text color.
• "blend": blend with background text color. Not supported
for "inline" virt_text.
-
• virt_lines : virtual lines to add next to this mark This
should be an array over lines, where each line in turn is
- an array over [text, highlight] tuples. In general, buffer
- and window options do not affect the display of the text.
- In particular 'wrap' and 'linebreak' options do not take
- effect, so the number of extra screen lines will always
- match the size of the array. However the 'tabstop' buffer
- option is still used for hard tabs. By default lines are
- placed below the buffer line containing the mark.
+ an array over `[text, highlight]` tuples. In general,
+ buffer and window options do not affect the display of the
+ text. In particular 'wrap' and 'linebreak' options do not
+ take effect, so the number of extra screen lines will
+ always match the size of the array. However the 'tabstop'
+ buffer option is still used for hard tabs. By default
+ lines are placed below the buffer line containing the
+ mark.
• virt_lines_above: place virtual lines above instead.
• virt_lines_leftcol: Place extmarks in the leftmost column
of the window, bypassing sign and number columns.
@@ -2715,30 +2731,28 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {*opts})
text around the mark was deleted and then restored by
undo. Defaults to true.
• invalidate : boolean that indicates whether to hide the
- extmark if the entirety of its range is deleted. If
+ extmark if the entirety of its range is deleted. For
+ hidden marks, an "invalid" key is added to the "details"
+ array of |nvim_buf_get_extmarks()| and family. If
"undo_restore" is false, the extmark is deleted instead.
- • priority: a priority value for the highlight group or sign
- attribute. For example treesitter highlighting uses a
- value of 100.
+ • priority: a priority value for the highlight group, sign
+ attribute or virtual text. For virtual text, item with
+ highest priority is drawn last. For example treesitter
+ highlighting uses a value of 100.
• strict: boolean that indicates extmark should not be
placed if the line or column value is past the end of the
buffer or end of the line respectively. Defaults to true.
• sign_text: string of length 1-2 used to display in the
- sign column. Note: ranges are unsupported and decorations
- are only applied to start_row
+ sign column.
• sign_hl_group: name of the highlight group used to
- highlight the sign column text. Note: ranges are
- unsupported and decorations are only applied to start_row
+ highlight the sign column text.
• number_hl_group: name of the highlight group used to
- highlight the number column. Note: ranges are unsupported
- and decorations are only applied to start_row
+ highlight the number column.
• line_hl_group: name of the highlight group used to
- highlight the whole line. Note: ranges are unsupported and
- decorations are only applied to start_row
+ highlight the whole line.
• cursorline_hl_group: name of the highlight group used to
- highlight the line when the cursor is on the same line as
- the mark and 'cursorline' is enabled. Note: ranges are
- unsupported and decorations are only applied to start_row
+ highlight the sign column text when the cursor is on the
+ same line as the mark and 'cursorline' is enabled.
• conceal: string which should be either empty or a single
character. Enable concealing similar to |:syn-conceal|.
When a character is supplied it is used as |:syn-cchar|.
@@ -2750,6 +2764,11 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {*opts})
drawn by a UI. When set, the UI will receive win_extmark
events. Note: the mark is positioned by virt_text
attributes. Can be used together with virt_text.
+ • url: A URL to associate with this extmark. In the TUI, the
+ OSC 8 control sequence is used to generate a clickable
+ hyperlink to this URL.
+ • scoped: boolean that indicates that the extmark should
+ only be displayed in the namespace scope. (experimental)
Return: ~
Id of the created/updated extmark
@@ -2777,7 +2796,7 @@ nvim_get_namespaces() *nvim_get_namespaces()*
dict that maps from names to namespace ids.
*nvim_set_decoration_provider()*
-nvim_set_decoration_provider({ns_id}, {*opts})
+nvim_set_decoration_provider({ns_id}, {opts})
Set or change decoration provider for a |namespace|
This is a very general purpose interface for having Lua callbacks being
@@ -2813,18 +2832,52 @@ nvim_set_decoration_provider({ns_id}, {*opts})
Parameters: ~
• {ns_id} Namespace id from |nvim_create_namespace()|
• {opts} Table of callbacks:
- • on_start: called first on each screen redraw ["start",
- tick]
+ • on_start: called first on each screen redraw >
+ ["start", tick]
+<
• on_buf: called for each buffer being redrawn (before window
- callbacks) ["buf", bufnr, tick]
- • on_win: called when starting to redraw a specific window.
- botline_guess is an approximation that does not exceed the
- last line number. ["win", winid, bufnr, topline,
- botline_guess]
+ callbacks) >
+ ["buf", bufnr, tick]
+<
+ • on_win: called when starting to redraw a specific window. >
+ ["win", winid, bufnr, topline, botline]
+<
• on_line: called for each buffer line being redrawn. (The
- interaction with fold lines is subject to change) ["win",
- winid, bufnr, row]
- • on_end: called at the end of a redraw cycle ["end", tick]
+ interaction with fold lines is subject to change) >
+ ["line", winid, bufnr, row]
+<
+ • on_end: called at the end of a redraw cycle >
+ ["end", tick]
+<
+
+nvim_win_add_ns({window}, {ns_id}) *nvim_win_add_ns()*
+ Adds the namespace scope to the window.
+
+ Parameters: ~
+ • {window} Window handle, or 0 for current window
+ • {ns_id} the namespace to add
+
+ Return: ~
+ true if the namespace was added, else false
+
+nvim_win_get_ns({window}) *nvim_win_get_ns()*
+ Gets all the namespaces scopes associated with a window.
+
+ Parameters: ~
+ • {window} Window handle, or 0 for current window
+
+ Return: ~
+ a list of namespaces ids
+
+nvim_win_remove_ns({window}, {ns_id}) *nvim_win_remove_ns()*
+ Removes the namespace scope from the window.
+
+ Parameters: ~
+ • {window} Window handle, or 0 for current window
+ • {ns_id} the namespace to remove
+
+ Return: ~
+ true if the namespace was removed, else false
==============================================================================
@@ -2842,8 +2895,7 @@ nvim_win_call({window}, {fun}) *nvim_win_call()*
only)
Return: ~
- Return value of function. NB: will deepcopy Lua values currently, use
- upvalues to send Lua references in and out.
+ Return value of function.
See also: ~
• |win_execute()|
@@ -3002,7 +3054,7 @@ nvim_win_set_hl_ns({window}, {ns_id}) *nvim_win_set_hl_ns()*
This takes precedence over the 'winhighlight' option.
Parameters: ~
- • {ns_id} the namespace to use
+ • {ns_id} the namespace to use
nvim_win_set_var({window}, {name}, {value}) *nvim_win_set_var()*
Sets a window-scoped (w:) variable
@@ -3020,7 +3072,7 @@ nvim_win_set_width({window}, {width}) *nvim_win_set_width()*
• {window} Window handle, or 0 for current window
• {width} Width as a count of columns
-nvim_win_text_height({window}, {*opts}) *nvim_win_text_height()*
+nvim_win_text_height({window}, {opts}) *nvim_win_text_height()*
Computes the number of screen lines occupied by a range of text in a given
window. Works for off-screen text and takes folds into account.
@@ -3056,21 +3108,31 @@ nvim_win_text_height({window}, {*opts}) *nvim_win_text_height()*
==============================================================================
-Win_Config Functions *api-win_config*
+Win_config Functions *api-win_config*
-nvim_open_win({buffer}, {enter}, {*config}) *nvim_open_win()*
- Open a new window.
+nvim_open_win({buffer}, {enter}, {config}) *nvim_open_win()*
+ Opens a new split window, or a floating window if `relative` is specified,
+ or an external window (managed by the UI) if `external` is specified.
- Currently this is used to open floating and external windows. Floats are
- windows that are drawn above the split layout, at some anchor position in
- some other window. Floats can be drawn internally or by external GUI with
- the |ui-multigrid| extension. External windows are only supported with
- multigrid GUIs, and are displayed as separate top-level windows.
+ Floats are windows that are drawn above the split layout, at some anchor
+ position in some other window. Floats can be drawn internally or by
+ external GUI with the |ui-multigrid| extension. External windows are only
+ supported with multigrid GUIs, and are displayed as separate top-level
+ windows.
For a general overview of floats, see |api-floatwin|.
- Exactly one of `external` and `relative` must be specified. The `width`
- and `height` of the new window must be specified.
+ The `width` and `height` of the new window must be specified when opening
+ a floating window, but are optional for normal windows.
+
+ If `relative` and `external` are omitted, a normal "split" window is
+ created. The `win` property determines which window will be split. If no
+ `win` is provided or `win == 0`, a window will be created adjacent to the
+ current window. If -1 is provided, a top-level split will be created.
+ `vertical` and `split` are only valid for normal windows, and are used to
+ control split direction. For `vertical`, the exact direction is determined
+ by |'splitright'| and |'splitbelow'|. Split windows cannot have
+ `bufpos`/`row`/`col`/`border`/`title`/`footer` properties.
With relative=editor (row=0,col=0) refers to the top-left corner of the
screen-grid and (row=Lines-1,col=Columns-1) refers to the bottom-right
@@ -3091,6 +3153,12 @@ nvim_open_win({buffer}, {enter}, {*config}) *nvim_open_win()*
Example (Lua): buffer-relative float (travels as buffer is scrolled) >lua
vim.api.nvim_open_win(0, false,
{relative='win', width=12, height=3, bufpos={100,10}})
+<
+
+ Example (Lua): vertical split left of the current window >lua
+ vim.api.nvim_open_win(0, false, {
+ split = 'left',
+ win = 0
})
<
@@ -3108,25 +3176,23 @@ nvim_open_win({buffer}, {enter}, {*config}) *nvim_open_win()*
window.
• "cursor" Cursor position in current window.
• "mouse" Mouse position
-
- • win: |window-ID| for relative="win".
+ • win: |window-ID| window to split, or relative window when
+ creating a float (relative="win").
• anchor: Decides which corner of the float to place at
(row,col):
• "NW" northwest (default)
• "NE" northeast
• "SW" southwest
• "SE" southeast
-
• width: Window width (in character cells). Minimum of 1.
• height: Window height (in character cells). Minimum of 1.
• bufpos: Places float relative to buffer text (only when
- relative="win"). Takes a tuple of zero-indexed [line,
- column]. `row` and `col` if given are applied relative to this position, else they
- default to:
+ relative="win"). Takes a tuple of zero-indexed
+ `[line, column]`. `row` and `col` if given are applied
+ relative to this position, else they default to:
• `row=1` and `col=0` if `anchor` is "NW" or "NE"
• `row=0` and `col=0` if `anchor` is "SW" or "SE" (thus
like a tooltip near the buffer text).
-
• row: Row position in units of "screen cell height", may be
fractional.
• col: Column position in units of "screen cell width", may
@@ -3137,8 +3203,9 @@ nvim_open_win({buffer}, {enter}, {*config}) *nvim_open_win()*
• external: GUI should display the window as an external
top-level window. Currently accepts no other positioning
configuration together with this.
- • zindex: Stacking order. floats with higher `zindex` go on top on floats with lower indices. Must be larger
- than zero. The following screen elements have hard-coded
+ • zindex: Stacking order. floats with higher `zindex` go on
+ top on floats with lower indices. Must be larger than
+ zero. The following screen elements have hard-coded
z-indices:
• 100: insert completion popupmenu
• 200: message scrollback
@@ -3146,7 +3213,6 @@ nvim_open_win({buffer}, {enter}, {*config}) *nvim_open_win()*
wildoptions+=pum) The default value for floats are 50.
In general, values below 100 are recommended, unless
there is a good reason to overshadow builtin elements.
-
• style: (optional) Configure the appearance of the window.
Currently only supports one value:
• "minimal" Nvim will display the window with many UI
@@ -3159,14 +3225,13 @@ nvim_open_win({buffer}, {enter}, {*config}) *nvim_open_win()*
empty. The end-of-buffer region is hidden by setting
`eob` flag of 'fillchars' to a space char, and clearing
the |hl-EndOfBuffer| region in 'winhighlight'.
-
• border: Style of (optional) window border. This can either
be a string or an array. The string values are
• "none": No border (default).
• "single": A single line box.
• "double": A double line box.
- • "rounded": Like "single", but with rounded corners ("╭"
- etc.).
+ • "rounded": Like "single", but with rounded corners
+ ("╭" etc.).
• "solid": Adds padding by a single whitespace cell.
• "shadow": A drop shadow effect by blending with the
background.
@@ -3174,19 +3239,26 @@ nvim_open_win({buffer}, {enter}, {*config}) *nvim_open_win()*
any divisor of eight. The array will specify the eight
chars building up the border in a clockwise fashion
starting with the top-left corner. As an example, the
- double box style could be specified as [ "╔", "═" ,"╗",
- "║", "╝", "═", "╚", "║" ]. If the number of chars are
- less than eight, they will be repeated. Thus an ASCII
- border could be specified as [ "/", "-", "\\", "|" ], or
- all chars the same as [ "x" ]. An empty string can be
- used to turn off a specific border, for instance, [ "",
- "", "", ">", "", "", "", "<" ] will only make vertical
- borders but not horizontal ones. By default,
- `FloatBorder` highlight is used, which links to
- `WinSeparator` when not defined. It could also be
- specified by character: [ ["+", "MyCorner"], ["x",
- "MyBorder"] ].
-
+ double box style could be specified as: >
+ [ "╔", "═" ,"╗", "║", "╝", "═", "╚", "║" ].
+<
+ If the number of chars are less than eight, they will be
+ repeated. Thus an ASCII border could be specified as >
+ [ "/", "-", \"\\\\\", "|" ],
+<
+ or all chars the same as >
+ [ "x" ].
+<
+ An empty string can be used to turn off a specific border,
+ for instance, >
+ [ "", "", "", ">", "", "", "", "<" ]
+<
+ will only make vertical borders but not horizontal ones.
+ By default, `FloatBorder` highlight is used, which links
+ to `WinSeparator` when not defined. It could also be
+ specified by character: >
+ [ ["+", "MyCorner"], ["x", "MyBorder"] ].
+<
• title: Title (optional) in window border, string or list.
List should consist of `[text, highlight]` tuples. If
string, the default highlight group is `FloatTitle`.
@@ -3205,6 +3277,8 @@ nvim_open_win({buffer}, {enter}, {*config}) *nvim_open_win()*
• fixed: If true when anchor is NW or SW, the float window
would be kept fixed even if the window would be truncated.
• hide: If true the floating window will be hidden.
+ • vertical: Split vertically |:vertical|.
+ • split: Split direction: "left", "right", "above", "below".
Return: ~
Window handle, or 0 on error
@@ -3222,7 +3296,7 @@ nvim_win_get_config({window}) *nvim_win_get_config()*
Return: ~
Map defining the window configuration, see |nvim_open_win()|
-nvim_win_set_config({window}, {*config}) *nvim_win_set_config()*
+nvim_win_set_config({window}, {config}) *nvim_win_set_config()*
Configures window layout. Currently only for floating and external windows
(including changing a split window to those layouts).
@@ -3302,11 +3376,18 @@ nvim_tabpage_set_var({tabpage}, {name}, {value})
• {name} Variable name
• {value} Variable value
+nvim_tabpage_set_win({tabpage}, {win}) *nvim_tabpage_set_win()*
+ Sets the current window in a tabpage
+
+ Parameters: ~
+ • {tabpage} Tabpage handle, or 0 for current tabpage
+ • {win} Window handle, must already belong to {tabpage}
+
==============================================================================
Autocmd Functions *api-autocmd*
-nvim_clear_autocmds({*opts}) *nvim_clear_autocmds()*
+nvim_clear_autocmds({opts}) *nvim_clear_autocmds()*
Clears all autocommands selected by {opts}. To delete autocmds see
|nvim_del_autocmd()|.
@@ -3316,24 +3397,21 @@ nvim_clear_autocmds({*opts}) *nvim_clear_autocmds()*
• event: "pat1"
• event: { "pat1" }
• event: { "pat1", "pat2", "pat3" }
-
• pattern: (string|table)
• pattern or patterns to match exactly.
• For example, if you have `*.py` as that pattern for the
autocmd, you must pass `*.py` exactly to clear it.
`test.py` will not match the pattern.
-
• defaults to clearing all patterns.
• NOTE: Cannot be used with {buffer}
-
• buffer: (bufnr)
• clear only |autocmd-buflocal| autocommands.
• NOTE: Cannot be used with {pattern}
-
• group: (string|int) The augroup name or id.
- • NOTE: If not passed, will only delete autocmds not in any group.
+ • NOTE: If not passed, will only delete autocmds not in any
+ group.
-nvim_create_augroup({name}, {*opts}) *nvim_create_augroup()*
+nvim_create_augroup({name}, {opts}) *nvim_create_augroup()*
Create or get an autocommand group |autocmd-groups|.
To get an existing group id, do: >lua
@@ -3354,8 +3432,10 @@ nvim_create_augroup({name}, {*opts}) *nvim_create_augroup()*
See also: ~
• |autocmd-groups|
-nvim_create_autocmd({event}, {*opts}) *nvim_create_autocmd()*
- Creates an |autocommand| event handler, defined by `callback` (Lua function or Vimscript function name string) or `command` (Ex command string).
+nvim_create_autocmd({event}, {opts}) *nvim_create_autocmd()*
+ Creates an |autocommand| event handler, defined by `callback` (Lua
+ function or Vimscript function name string) or `command` (Ex command
+ string).
Example using Lua callback: >lua
vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
@@ -3393,19 +3473,18 @@ nvim_create_autocmd({event}, {*opts}) *nvim_create_autocmd()*
troubleshooting).
• callback (function|string) optional: Lua function (or
Vimscript function name, if string) called when the
- event(s) is triggered. Lua callback can return true to
- delete the autocommand, and receives a table argument with
- these keys:
+ event(s) is triggered. Lua callback can return a truthy
+ value (not `false` or `nil`) to delete the autocommand.
+ Receives a table argument with these keys:
• id: (number) autocommand id
• event: (string) name of the triggered event
|autocmd-events|
• group: (number|nil) autocommand group id, if any
- • match: (string) expanded value of |<amatch>|
- • buf: (number) expanded value of |<abuf>|
- • file: (string) expanded value of |<afile>|
+ • match: (string) expanded value of <amatch>
+ • buf: (number) expanded value of <abuf>
+ • file: (string) expanded value of <afile>
• data: (any) arbitrary data passed from
|nvim_exec_autocmds()|
-
• command (string) optional: Vim command to execute on event.
Cannot be used with {callback}
• once (boolean) optional: defaults to false. Run the
@@ -3455,7 +3534,7 @@ nvim_del_autocmd({id}) *nvim_del_autocmd()*
Parameters: ~
• {id} Integer Autocommand id returned by |nvim_create_autocmd()|
-nvim_exec_autocmds({event}, {*opts}) *nvim_exec_autocmds()*
+nvim_exec_autocmds({event}, {opts}) *nvim_exec_autocmds()*
Execute all autocommands for {event} that match the corresponding {opts}
|autocmd-execute|.
@@ -3469,14 +3548,14 @@ nvim_exec_autocmds({event}, {*opts}) *nvim_exec_autocmds()*
• buffer (integer) optional: buffer number
|autocmd-buflocal|. Cannot be used with {pattern}.
• modeline (bool) optional: defaults to true. Process the
- modeline after the autocommands |<nomodeline>|.
+ modeline after the autocommands <nomodeline>.
• data (any): arbitrary data to send to the autocommand
callback. See |nvim_create_autocmd()| for details.
See also: ~
• |:doautocmd|
-nvim_get_autocmds({*opts}) *nvim_get_autocmds()*
+nvim_get_autocmds({opts}) *nvim_get_autocmds()*
Get all autocommands that match the corresponding {opts}.
These examples will get autocommands matching ALL the given criteria: >lua
@@ -3590,13 +3669,12 @@ nvim_ui_pum_set_height({height}) *nvim_ui_pum_set_height()*
• {height} Popupmenu height, must be greater than zero.
nvim_ui_set_focus({gained}) *nvim_ui_set_focus()*
- Tells the nvim server if focus was gained or lost by the GUI.
+ Tells the nvim server if focus was gained or lost by the GUI
Attributes: ~
|RPC| only
nvim_ui_set_option({name}, {value}) *nvim_ui_set_option()*
- TODO: Documentation
Attributes: ~
|RPC| only
@@ -3605,7 +3683,6 @@ nvim_ui_term_event({event}, {value}) *nvim_ui_term_event()*
Tells Nvim when a terminal event has occurred
The following terminal events are supported:
-
• "termresponse": The terminal sent an OSC or DCS response sequence to
Nvim. The payload is the received response. Sets |v:termresponse| and
fires |TermResponse|.
@@ -3614,11 +3691,10 @@ nvim_ui_term_event({event}, {value}) *nvim_ui_term_event()*
|RPC| only
Parameters: ~
- • {event} Event name
- • {payload} Event payload
+ • {event} Event name
+ • {value} Event payload
nvim_ui_try_resize({width}, {height}) *nvim_ui_try_resize()*
- TODO: Documentation
Attributes: ~
|RPC| only
@@ -3638,4 +3714,5 @@ nvim_ui_try_resize_grid({grid}, {width}, {height})
• {width} The new requested width.
• {height} The new requested height.
+
vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl:
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index c6f6559e37..8890872e1a 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -784,9 +784,6 @@ OptionSet After setting an option (except during
are not global-local it is the old local
value.
- OptionSet is not triggered on startup and for
- the 'key' option for obvious reasons.
-
Usage example: Check for the existence of the
directory in the 'backupdir' and 'undodir'
options, create the directory if it doesn't
@@ -800,6 +797,8 @@ OptionSet After setting an option (except during
Non-recursive: |:set| in the autocommand does
not trigger OptionSet again.
+ Not triggered on startup.
+
*QuickFixCmdPre*
QuickFixCmdPre Before a quickfix command is run (|:make|,
|:lmake|, |:grep|, |:lgrep|, |:grepadd|,
@@ -874,7 +873,7 @@ SafeState When nothing is pending, going to wait for the
- Command line completion is active
You can use `mode()` to find out what state
Vim is in. That may be:
- - VIsual mode
+ - Visual mode
- Normal mode
- Insert mode
- Command-line mode
@@ -986,6 +985,11 @@ TermLeave After leaving |Terminal-mode|.
TermClose When a |terminal| job ends.
Sets these |v:event| keys:
status
+ *TermRequest*
+TermRequest When a |terminal| job emits an OSC or DCS
+ sequence. Sets |v:termrequest|. When used from
+ Lua, the request string is included in the
+ "data" field of the autocommand callback.
*TermResponse*
TermResponse When Nvim receives an OSC or DCS response from
the terminal. Sets |v:termresponse|. When used
@@ -1001,10 +1005,10 @@ TermResponse When Nvim receives an OSC or DCS response from
once = true,
callback = function(args)
local resp = args.data
- local r, g, b = resp:match("\x1b%]4;1;rgb:(%w+)/(%w+)/(%w+)")
+ local r, g, b = resp:match("\027%]4;1;rgb:(%w+)/(%w+)/(%w+)")
end,
})
- io.stdout:write("\x1b]4;1;?\x1b\\")
+ io.stdout:write("\027]4;1;?\027\\")
<
*TextChanged*
TextChanged After a change was made to the text in the
diff --git a/runtime/doc/backers.txt b/runtime/doc/backers.txt
new file mode 100644
index 0000000000..d0cbd94978
--- /dev/null
+++ b/runtime/doc/backers.txt
@@ -0,0 +1,656 @@
+*backers.txt* Nvim
+
+
+ NVIM REFERENCE MANUAL
+
+
+==============================================================================
+Fundraiser Backers
+
+Thank you to everyone who backed the original Neovim Fundraiser.
+
+LIST OF BACKERS
+
+- [Bob Breznak](http://brez.io)
+- [Tim Uruski](http://timuruski.net)
+- @mikker (http://brnbw.com)
+- Aaron J. [@metaxis](http://twitter.com/metaxis) Peterson
+- Adam George http://www.adamgeorge.com
+- Adam Lindberg (http://alind.io)
+- Adam McLain http://twitter.com/adammclain
+- Adam Piper http://ahri.net
+- Adrian Philipp http://adrian-philipp.com
+- Alexander Quine
+- Alexandru Dabija
+- Alexis Hildebrandt http://surryhill.net
+- Andrew M. Farrell http://amfarrell.com
+- Anton Beloglazov http://beloglazov.info/
+- Arthur Axel fREW Schmidt - https://blog.afoolishmanifesto.com
+- Ben Thouret http://benjamin.thouret.com
+- Benedikt Böhm http://bb.xnull.de
+- bfredl, http://bfredl.github.io
+- Brandon Smith, http://reardencode.com
+- Brandon Wang, http://brandonwang.me
+- Brennen Bearnes http://p1k3.com
+- Brock Wilcox (awwaiid) http://thelackthereof.org/
+- Cameron Eagans http://cweagans.net
+- Carl Myers http://cmyers.org/
+- Carlos Alves http://www.carlosalves.info
+- Chris Chernesky, http://www.tinderglow.com
+- Chris Hartjes
+- Christoffer Holmstedt (http://www.christofferholmstedt.se)
+- Ciaran Downey <http://ciarand.me>
+- Craig Bane http://standardizedways.co.uk
+- Dane Summers http://pinedesk.biz
+- Daniel Collin https://twitter.com/daniel_collin
+- Daniel Rogers http://remotecodelist.com
+- Darshan Sawardekar http://pressing-matters.io
+- David Gabriel http://wiki.dest-unreachable.net
+- Deepak Kumar www.kreatio.com
+- Derek Rodger http://devslant.com
+- ebene fÃŒnf GmbH www.ebenefuenf.de
+- Ehtesh Choudhury
+- Emil Hernvall http://emilhernvall.github.io/
+- Eric Siegel https://github.com/esiegel
+- Ethan Schoonover http://ethanschoonover.com
+- FFunction http://ffctn.com
+- Frank http://duckpun.ch
+- Gabriele Lana http://github.com/gabrielelana
+- Gavin Rogers http://praxeology.co.uk
+- Geoff Greer https://floobits.com/
+- Glenn Strauss https://github.com/gstrauss/
+- Gustav Buchholtz http://grod.se
+- Henri Bourcereau http://bourcereau.fr
+- http://jaredforsyth.com
+- http://www.1bsyl.com
+- Johann Dahm (http://johanndahm.com)
+- Ian Farmer http://farmernet.net
+- iauns - http://www.noobtube.com
+- Jacob Jewell www.immersiveapplications.com
+- James A. Overton http://james.overton.ca
+- James Tomasino - http://jamestomasino.com
+- Jamiel Almeida http://slashfoo.com
+- Jan Christoph Ebersbach http://www.e-jc.de/
+- Jason Peacock http://jasonpeacock.com
+- Jason Weathered http://jasoncodes.com/
+- Javier Maestro
+- Jeff Craig http://blog.foxxtrot.net/
+- Jeremy Huffman http://jeremyhuffman.com
+- Jeremy Morrell http://rathercurio.us
+- Jesper Kjeldgaard (thejspr) - http://thejspr.com
+- Jim Hester (http://jimhester.com)
+- Joe Moon http://joe.xoxomoon.com
+- Johan Simonsson, http://fun-tech.se
+- John P. Kiffmeyer (http://jpk.is)
+- John Szakmeister http://www.szakmeister.net/
+- John W. Long http://wiseheartdesign.com Twitter: @johnwlong GitHub: @jlong
+- Jon Yurek http://thoughtbot.com
+- jonaias http://jonaias.info
+- Josh Davis, http://joshldavis.com
+- Joshua Levesque (www.jandyco.com)
+- Justin M. Keyes https://github.com/justinmk
+- Justin Russell http://jrussell.me
+- kbussell
+- Kevin Sjöberg, http://kevinsjoberg.com
+- Kevin Sumner http://kevinsumner.com
+- Kevin Wu http://kevinformatics.com
+- Ley Missailidis, http://polymet.is
+- Loa https://github.com/loa
+- Lowe Schmidt http://loweschmidt.se
+- Marcello Barnaba http://sindro.me/
+- Marcin Kulik - http://ku1ik.com
+- Marius Rieder http://www.durchmesser.ch/
+- Mark Allen [@bytemeorg](http://twitter.com/bytemeorg)
+- Mark Percival http://markpercival.us
+- Mark Sprevak
+- Martin Ansdell-Smith https://ansdell.net/
+- Martin Kopischke http://martin.kopischke.net
+- masukomi http://masukomi.org
+- Matt Greer -- http://mattgreer.org
+- MetaCosm | #Vim on Freenode
+- Michael Ulm www.mulm.at
+- Mikael Jansson http://mikaelj.se
+- Mikkel HÞgh http://mikkel.hoegh.org/
+- Ming Liu http://ming.codes
+- Holger Peters http://www.holger-peters.de
+- Alexander Myshov http://myshov.com/
+- Darren Cheng http://sanguinerane.com/
+- Felix Rath www.0fx.eu
+- Hong Xu http://www.topbug.net
+- Slava Kim https://www.meteor.com
+- Nate Soares (So8res) http://so8r.es
+- neektza http://pltconfusion.com
+- Niclas Nilsson, http://niclasnilsson.se
+- Nikolay Bachiyski http://extrapolate.me/
+- Nikush Patel http://nikush.co.uk
+- Norman Köhring https://koehr.in
+- Osamu Komagata
+- Øystein E. Krog https://github.com/oysteinkrog
+- Pablo Brasero Moreno http://pablobm.com
+- Peter Souter http://www.petersouter.co.uk
+- Phil Levchenko (http://philslair.com)
+- Pierre Douyon https://github.com/pgdouyon
+- Prateek Rungta
+- Przemysław Pietrzkiewicz, http://ppi.sh
+- Rasmus Mattsson http://zzm.se
+- Reed Esau https://github.com/reedes
+- Richard Harding https://bmark.us
+- Rob Warner http://grailbox.com
+- Runar Balstad Jensen, http://stdout.no/
+- Ryan Paul http://seg.phault.net
+- Saad Malik - https://github.com/saamalik
+- Saggi Malachi - http://sagg.im
+- Scott Wessels (http://www.usgn.net)
+- Sean DuBois (Sean-Der) http://siobud.com
+- Sebastian Vetter (http://www.roadside-developer.com)
+- Simen EndsjÞ, http://simendsjo.me
+- Stanley Chan (Happy-Dude)
+- Stefan Penner
+- Steve Vermeulen https://github.com/svermeulen
+- Steven Myint (https://github.com/myint)
+- Tae Sandoval Murgan <taecilla.github.io>
+- The Kompanee http://thekompanee.com
+- Thomas Cannon <http://thomascannon.net>
+- Tim Oxley http://campjs.com/
+- Timo Schmiade
+- Timothy Dahlin
+- Tiziano Santoro
+- Toban Wiebe http://tobanwiebe.com
+- Tobias Sjösten http://vvv.tobiassjosten.net/
+- Tom Cammann http://github.com/takac
+- Val Markovic http://val.markovic.io/
+- Víðir Valberg Guðmundsson http://rabotnik.coop
+- Weiyi Lou http://parlseygardens.net
+- Wesley Moore http://wezm.net/
+- Woody Peterson, http://www.bitsofsignal.com
+- Zach Kelling, http://zeekay.io
+
+### Your name in BACKERS.md.
+
+- @a13xb
+- @d1eg0
+- @derkha
+- @georgebashi
+- @tmcw
+- @xpayn
+- Adam Baxter (voltagex)
+- Adam Miller (maxamillion)
+- Adam Sunderland/iterion
+- Adon Metcalfe (adonm)
+- Adrian Duyzer
+- Aidan Stein
+- ak47
+- Aketzu
+- Alessandro Gangemi
+- Alessandro Pagnin
+- Alessandro Proscia
+- Alex Genco (alexgenco)
+- Alex Heeton
+- Alex Roper
+- Alex Soto (apsoto@gmail.com)
+- Alexander Flatter
+- Alexander Jeurissen
+- Alexander Shabalin
+- Alexander Woerndle
+- Alexandru Keszeg
+- Allan Hudgins
+- Ami Chayun
+- Amit Beka
+- Anders Fuzz
+- Andre Azzolini
+- Andre da Palma
+- André Santos/andrefs
+- Andrea Michi
+- Andreas Heider
+- Andreas Lappe
+- andrej ocenas / aocenas
+- Andrew Arminio @5thWall
+- Andrew DeMaria ~ muff1nman
+- Andrew Fallows
+- Andrew Fecheyr (@andruby)
+- Andrew Hartford
+- Andrey Tarantsov
+- Andrey Yurovsky
+- Andy Dirnberger
+- Andy Gayton
+- Andy Lindeman
+- Andy Webster
+- AngelLeliel
+- Anton Egorov / satyrius
+- Anton Shemerey
+- Arnaud Bétrémieux
+- Arne Ehrlich
+- Arseny Zarechnev
+- Arvind Deshpande
+- Astro Jetson Jr
+- Attila Maczak
+- Avétis KAZARIAN (avetisk)
+- BarryKay
+- bbinet
+- BenBergman
+- Bengt LÃŒers
+- Benjamin Bryant
+- BÚr "berkes" Kessels
+- Bernd Homuth
+- Bheesham Persaud
+- Bilal Quadri
+- Bjorn Tipling
+- Bojan Zivanovic
+- Boris Searles
+- Braden Bruington
+- Brandon Liu/thenovices
+- Brandon Mathis - @imathis
+- Brett Ritter
+- Brian Shaver (shakerlxxv)
+- Bryan Grohman
+- Bryn Edwards
+- Calin Iorgulescu
+- calind
+- Cameron Wood / cewood
+- Chris Lopes
+- Chris Lord
+- Chris Porter
+- Chris Sims (@jcsims)
+- Christian Anton / fibbs
+- Christian Delahousse cdelahousse
+- Christian Lange
+- Christian Wellenbrock
+- Christophe Badoit
+- Christopher LÃŒbbemeier
+- Christopher Mullins
+- Chungha Kim
+- ckromero
+- Claas-Thido Pfaff
+- Claes Mogren
+- Clayton Drazner
+- claytron
+- Colin Cooper
+- corytheboyd
+- Cristián Alberto Arenas Ulloa / NiñoScript
+- Cyril LEPAGNOT/cyrill62
+- D3 Designs
+- DAddYE (github: DAddYE)
+- Dan Webb
+- Daniel C. Henning / danielsdesk
+- Daniel Egeberg
+- Daniel Egger
+- Daniel Hodan/czertbytes
+- Daniel Latzer
+- Daniel Riti
+- Daniel Weisser
+- Daniele Polencic
+- Dave Dixon
+- David Collie
+- David Galeano
+- David Newell
+- David Rappo, Bountysource.com
+- David Rasch
+- David Stensland - terite
+- Davit Samvelyan
+- Dean Morin
+- deffi420
+- defrex
+- Deraen
+- Dewdrops
+- Dick Seabrook
+- Dominik Ritter
+- Don Browne
+- Donald Walker
+- Donna Martz
+- dpc
+- dperson
+- dvidsilva
+- Edan Maor
+- Eddy Garcia
+- Edward Ash/cazador481
+- Elias Tandel Barrionovo
+- Elijah Mirecki
+- Elliot Winkler (github: mcmire)
+- Enric Lluelles
+- Eric Fode
+- Erik Goldman
+- Erik Johnson Github: terminalmage Twitter: @terminalmage
+- Erik Nordlund
+- Ethan Erchinger/erchn
+- Evan Tatarka
+- Ewoud van Raamsdonk
+- fd0
+- Federico Galassi
+- Félix Archambault
+- Ferdinand Salis-Samaden
+- Florian Bartels
+- Florian Sachs
+- foca
+- forbesmyester
+- Frédéric de Villamil
+- Fredrik Rambris
+- Dapeng Li (luislee818)
+- Janko Marohnić (janko-m)
+- Jun Wu
+- Maurice van der Pot (Griffon26)
+- Ory Band (oryband)
+- Garrett Dawson
+- Gaveen Prabhasara
+- George Nikolopoulos
+- github username "alandyer"
+- Giuseppe Rota
+- gkalas
+- Gökhan Kocak
+- goodgravy
+- Göran Gustafsson (GLEG)
+- Graham Jans
+- Greg Marcil
+- Gregory Byrd/GByrd
+- Gustavo Barron / Cicloid
+- Gyuri Horák
+- Harald Hvaal
+- Harm Aarts
+- Harry Glaser
+- HÃ¥vard Grimelid
+- hencjo
+- Henning Hasemann
+- Henry "Ingvij" Kupty
+- henry4k
+- Heryandi
+- Hontvári József Levente
+- IKEDA, Yoshifumi
+- Ilia Choly
+- iliis
+- Ilya Katz
+- Indrek Juhkam / indrekj
+- irwand
+- Islam Sharabash / ibash
+- Ivar Vasara
+- Jack Stouffer
+- Jacqueline Leykam
+- Jakob Landbo
+- James Herdman
+- James Magness
+- James Murty / jmurty
+- James Nguyen
+- James Orr
+- James Pickard
+- James Seward
+- Jamie Hillman
+- Jan Larres
+- Jan Weitz
+- Janko Luin
+- Jannik Nielsen / bitkid
+- Jared Tyler Miller
+- Jason Imison
+- Jason Long / @jasonlong
+- Jason Stillwell/dragonfax
+- Jasu
+- javaguirre
+- Jedidiah Hurt
+- Jeff Schornick
+- Jen Patrick
+- Jens Hausherr
+- Jess Brown / Jess
+- Jesse Cooke/@jc00ke
+- Jessica Frazelle/ jfrazelle
+- Jesus Alvarez
+- Jez Allan
+- Jimmie Elvenmark
+- Jiří Koten
+- JJ Murre
+- joe di castro
+- Joe Malin/633squadron
+- Joel Meyer
+- Joey Trapp
+- Johan Klokkhammer Helsing
+- John Cant
+- John K. Paul
+- John Krueger
+- John Netherdrake
+- John Schmidt / schmee
+- John Whitley/@jwhitley
+- Jon Anhold
+- Jon Gosting
+- Jonas Rollsby
+- Jonathan Buschmann
+- Jonathan Gibert
+- Jonathan Jacobs
+- Jonathan Kinred
+- Jorge Gallegos (kad)
+- Joris Morger
+- Josemar Luedke
+- Joshua Brookover
+- Joshua Travis
+- Jouko Karvonen
+- jstemmer
+- Juan Campa
+- Juan Hernández Babón / jhbabon
+- juanolon
+- Justin Carter Moy
+- Justin Force
+- Kamil Slowikowski
+- Karl Ove Hufthammer
+- Kazuo Teramoto
+- Kevin Goslar
+- Kevin Hamer
+- Kevin Watters
+- Kevin Zimmerman / zim44
+- kryft
+- Krzysztof Adamski
+- Lachlan Brad Easton
+- Lance Ulmer
+- Larry Riedel (Larry@Riedel.org)
+- Lasse Immonen (lasse.immonen@gmail.com)
+- Léo Unbekandt / Soulou
+- Leszek Swirski
+- Levi Brown
+- lhl
+- linduxed
+- Lluis Satorre Gonzalez
+- lobachevsky
+- Louis Pilfold
+- Lucas Stephanou/lucasts
+- Lucas Werkmeister
+- Luke Sampson
+- Luke van der Hoeven / @plukevdh
+- Maciej Litwiniuk (@mlitwiniuk)
+- Mads Navntoft Noe
+- Maik Derstappen / MrTango
+- Manuel Salvadores
+- Marcus Huntemann/mapclyps
+- Marcus Martin/nymaen
+- Markus Dobler
+- Mat Moore
+- Mate Nagy
+- Mathias Fußenegger
+- Matt Moretti
+- Matthew Machuga
+- Matthew Sunderland
+- Matthias Bilger
+- Matthias Lehmann
+- Maximilian Gerlach
+- Meryn Stol
+- Michael "manveru" Fellinger
+- Michael "beefsack" Alexander
+- Michael Iles
+- Michael Irwin/mdi
+- Michael Kebe
+- Michael Lerch
+- Michael R. Jones
+- Michael Sanders/msanders
+- Michael Schall / schallm
+- Michail Denchev
+- Michał Bartoszkiewicz
+- Mickaël FORTUNATO
+- Miguel Santesmases
+- Mihir Pendse
+- Mike Bissett/paran01d
+- Mike Sergio
+- Mike Wadsten
+- mikedillion
+- Mikkel Oscar Lyderik Larsen
+- Miles Edland / edlandm
+- Miles Frain
+- Mirko Grönroos
+- Moritz Lotze
+- Morten Nygaard Åsnes
+- MrException
+- Julian Churchill (julianchurchill)
+- Nakul Dhotre
+- Corey Farwell (frewsxcv)
+- Tarrant Rollins (tarrant)
+- Naseer Ahmed
+- Nate Jones
+- Nate Soares (So8res)
+- Nate Straz
+- Neil Kirsopp
+- Nelson Chen/nelsonjchen
+- Nicholas Firth-McCoy (nfm)
+- Nick Sloan
+- Nickolas Means
+- Nicolai Ruckel
+- Niko KivelÀ
+- nop
+- Nuno Frade
+- Olaf Heinemann
+- Ole Reifschneider
+- Oliver Caldwell
+- Olivier Lechevalier
+- orangain
+- orestis
+- pablasso
+- Pascal Hartig
+- Patrick Berkeley
+- Patrick Bihan-Faou, TeamBox SARL
+- Patrick Stapfer
+- Paul R Alexander
+- Pavel Afanasyev
+- Pawel Grzech
+- Paweł Nowak
+- Pedro Rodriguez T
+- Per Modin
+- Peter Edge
+- Peter Fern
+- Philipe Farias/philipefarias
+- Philipp Millar
+- Piotr Mitoraj
+- Prithvi Prabhu (prithvi)
+- Qingping Hou / houqp
+- Quasar Jarosz
+- queria
+- Rachid Zarouali / Xinity
+- Radek Szymczyszyn
+- Randy Topliffe / Taar
+- Ranko Radonić
+- Raphael Henrique Ribas
+- Ravi Joseph Pinto
+- rekab
+- Renato Zannon
+- Richard "RichiH" Hartmann
+- Richard Mihalovič
+- Richard Sotarsh Clark
+- Rio Kierkels
+- rob allen
+- Rob Bevan
+- Rob Miller @robmil
+- Rob O'Dwyer
+- Rodolfo Borges (aka bart9h)
+- Rodrigo Souto
+- Roland Szabo
+- Romans Malinovskis
+- Roshan George
+- Rostepher
+- runar
+- Russ Adams / rustushki
+- Ryan Phillips
+- Ryan Pierce/ fission1110
+- Ryan Schmitt
+- Ryan Tarpine
+- Sadik Gokhan Caglar
+- Sam Stokes
+- Sanpi
+- Santiago Suarez Ordoñez
+- saxman7000
+- Scott D'Aquila
+- Scott Mathson
+- Sean Copenhaver (@copenhas)
+- Sean McCleary
+- Sean M. Collins (sc68cal)
+- Sean Tegtmeyer
+- seanbell
+- Sebastian Geiger
+- Sergey Alexandrov
+- Shane Delmore
+- shawndumas
+- shazow
+- Silvan Jegen
+- Simon Ratner (simonratner)
+- Song Gao
+- Stanimir Angelov Mladenov
+- Stanislav B. - zbstof
+- Stefan Gojan (hoschi)
+- Stefan Hoffmann / stefan991
+- Stefan Wienert
+- Steffen Rademacker
+- Stephen Oney/soney
+- Steve "ryz" Haßenpflug
+- Steven Daniel Webb
+- Steven Sloss
+- Sven Opitz
+- Sverre Rabbelier
+- Szymon Ząbkiewicz
+- Taichi Nakamura
+- Takayuki Soga
+- Teasp00n
+- Terin Stock - @terinjokes
+- Thai Pangsakulyanont (dtinth)
+- Thameera Senanayaka
+- Theo Belaire
+- Thomas Ferris Nicolaisen
+- Thomas Hirsch
+- Thomas Maffia/Szerated
+- Thomas Pani
+- Thomas Thune Hansen
+- ThorbjÞrn Lindeijer
+- Thunder Hu
+- Thys Meintjes
+- Tim Anema
+- Tim Matthews
+- Timo Kröger
+- Tolstyak
+- Tom Panning
+- Tom Wadley
+- Tony Kemp
+- tonyo112
+- Tori "TicViking" Hamblin
+- treppo
+- Truman Ellis
+- Tuomas VÀhÀnen
+- Tyler Briles/MrBri
+- Tyler Brock
+- Tyler Mandry
+- Ulf Fischer/ulf
+- Vangelis Tsoumenis
+- Vítězslav Homolka
+- Vladimir Chernis
+- Vojtech Jasny
+- vvakame
+- Vytis Valentinavičius
+- Wade Berrier
+- warrenv
+- whateverhuis
+- Will Binns-Smith
+- Xavier Antoviaque (xavier@antoviaque.org)
+- xsb
+- Yann Villessuzanne
+- yko
+- Youta Harada(cohalz)
+- Yrjö Peussa
+- Yusuke Kanda(@uskanda)
+- Yuval Langer
+- zerowidth
+- Ziling Zhao
+- Zsolt Botykai
+
+ANONYMOUS SUPPORTERS
+
+There were also 307 other people who didn't claim any level of reward but
+contributed to the fundraiser. Thank you all for the support!
+
+vim:tw=78:ts=8:et:ft=help:norl:
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index 6ffb514487..c5f3946871 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -802,6 +802,8 @@ complete_info([{what}]) *complete_info()*
no item is selected when using the <Up> or
<Down> keys)
inserted Inserted string. [NOT IMPLEMENTED YET]
+ preview_winid Info floating preview window id.
+ preview_bufnr Info floating preview buffer id.
*complete_info_mode*
mode values are:
@@ -963,8 +965,8 @@ ctxset({context} [, {index}]) *ctxset()*
ctxsize() *ctxsize()*
Returns the size of the |context-stack|.
-cursor({lnum}, {col} [, {off}])
-cursor({list}) *cursor()*
+cursor({lnum}, {col} [, {off}]) *cursor()*
+cursor({list})
Positions the cursor at the column (byte count) {col} in the
line {lnum}. The first column is one.
@@ -1367,6 +1369,7 @@ exists({expr}) *exists()*
echo exists("*strftime")
echo exists("*s:MyFunc")
echo exists("*MyFunc")
+ echo exists("*v:lua.Func")
echo exists("bufcount")
echo exists(":Make")
echo exists("#CursorHold")
@@ -1864,6 +1867,40 @@ foldtextresult({lnum}) *foldtextresult()*
line, "'m" mark m, etc.
Useful when exporting folded text, e.g., to HTML.
+foreach({expr1}, {expr2}) *foreach()*
+ {expr1} must be a |List|, |String|, |Blob| or |Dictionary|.
+ For each item in {expr1} execute {expr2}. {expr1} is not
+ modified; its values may be, as with |:lockvar| 1. |E741|
+ See |map()| and |filter()| to modify {expr1}.
+
+ {expr2} must be a |string| or |Funcref|.
+
+ If {expr2} is a |string|, inside {expr2} |v:val| has the value
+ of the current item. For a |Dictionary| |v:key| has the key
+ of the current item and for a |List| |v:key| has the index of
+ the current item. For a |Blob| |v:key| has the index of the
+ current byte. For a |String| |v:key| has the index of the
+ current character.
+ Examples: >vim
+ call foreach(mylist, 'let used[v:val] = v:true')
+< This records the items that are in the {expr1} list.
+
+ Note that {expr2} is the result of expression and is then used
+ as a command. Often it is good to use a |literal-string| to
+ avoid having to double backslashes.
+
+ If {expr2} is a |Funcref| it must take two arguments:
+ 1. the key or the index of the current item.
+ 2. the value of the current item.
+ With a lambda you don't get an error if it only accepts one
+ argument.
+ If the function returns a value, it is ignored.
+
+ Returns {expr1} in all cases.
+ When an error is encountered while executing {expr2} no
+ further items in {expr1} are processed.
+ When {expr2} is a Funcref errors inside a function are ignored,
+ unless it was defined with the "abort" flag.
fullcommand({name}) *fullcommand()*
Get the full command name from a short abbreviated command
@@ -2018,8 +2055,8 @@ get({func}, {what})
"args" The list with arguments
Returns zero on error.
-getbufinfo([{buf}])
-getbufinfo([{dict}]) *getbufinfo()*
+getbufinfo([{buf}]) *getbufinfo()*
+getbufinfo([{dict}])
Get information about buffers as a List of Dictionaries.
Without an argument information about all the buffers is
@@ -2042,6 +2079,8 @@ getbufinfo([{dict}]) *getbufinfo()*
bufnr Buffer number.
changed TRUE if the buffer is modified.
changedtick Number of changes made to the buffer.
+ command TRUE if the buffer belongs to the
+ command-line window |cmdwin|.
hidden TRUE if the buffer is hidden.
lastused Timestamp in seconds, like
|localtime()|, when the buffer was
@@ -2233,7 +2272,7 @@ getcharmod() *getcharmod()*
32 mouse double click
64 mouse triple click
96 mouse quadruple click (== 32 + 64)
- 128 command (Macintosh only)
+ 128 command (Mac) or super
Only the modifiers that have not been included in the
character itself are obtained. Thus Shift-a results in "A"
without a modifier. Returns 0 if no modifiers are used.
@@ -2370,6 +2409,7 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()*
help help subjects
highlight highlight groups
history |:history| suboptions
+ keymap keyboard mappings
locale locale names (as output of locale -a)
mapclear buffer argument
mapping mapping name
@@ -2878,6 +2918,57 @@ getreginfo([{regname}]) *getreginfo()*
If {regname} is not specified, |v:register| is used.
The returned Dictionary can be passed to |setreg()|.
+getregion({pos1}, {pos2} [, {opts}]) *getregion()*
+ Returns the list of strings from {pos1} to {pos2} from a
+ buffer.
+
+ {pos1} and {pos2} must both be |List|s with four numbers.
+ See |getpos()| for the format of the list. It's possible
+ to specify positions from a different buffer, but please
+ note the limitations at |getregion-notes|.
+
+ The optional argument {opts} is a Dict and supports the
+ following items:
+
+ type Specify the region's selection type
+ (default: "v"):
+ "v" for |charwise| mode
+ "V" for |linewise| mode
+ "<CTRL-V>" for |blockwise-visual| mode
+
+ exclusive If |TRUE|, use exclusive selection
+ for the end position
+ (default: follow 'selection')
+
+ You can get the last selection type by |visualmode()|.
+ If Visual mode is active, use |mode()| to get the Visual mode
+ (e.g., in a |:vmap|).
+ This function is useful to get text starting and ending in
+ different columns, such as a |charwise-visual| selection.
+
+ *getregion-notes*
+ Note that:
+ - Order of {pos1} and {pos2} doesn't matter, it will always
+ return content from the upper left position to the lower
+ right position.
+ - If 'virtualedit' is enabled and the region is past the end
+ of the lines, resulting lines are padded with spaces.
+ - If the region is blockwise and it starts or ends in the
+ middle of a multi-cell character, it is not included but
+ its selected part is substituted with spaces.
+ - If {pos1} and {pos2} are not in the same buffer, an empty
+ list is returned.
+ - {pos1} and {pos2} must belong to a |bufloaded()| buffer.
+ - It is evaluated in current window context, which makes a
+ difference if the buffer is displayed in a window with
+ different 'virtualedit' or 'list' values.
+
+ Examples: >
+ :xnoremap <CR>
+ \ <Cmd>echom getregion(
+ \ getpos('v'), getpos('.'), #{ type: mode() })<CR>
+<
+
getregtype([{regname}]) *getregtype()*
The result is a String, which is type of register {regname}.
The value will be one of:
@@ -3873,8 +3964,7 @@ json_decode({expr}) *json_decode()*
Vim value. In the following cases it will output
|msgpack-special-dict|:
1. Dictionary contains duplicate key.
- 2. Dictionary contains empty key.
- 3. String contains NUL byte. Two special dictionaries: for
+ 2. String contains NUL byte. Two special dictionaries: for
dictionary and for string will be emitted in case string
with NUL byte was a dictionary key.
@@ -4272,6 +4362,7 @@ mapnew({expr1}, {expr2}) *mapnew()*
don't want that use |deepcopy()| first.
mapset({mode}, {abbr}, {dict}) *mapset()*
+mapset({dict})
Restore a mapping from a dictionary, possibly returned by
|maparg()| or |maplist()|. A buffer mapping, when dict.buffer
is true, is set on the current buffer; it is up to the caller
@@ -4360,6 +4451,7 @@ match({expr}, {pat} [, {start} [, {count}]]) *match()*
Note that when {count} is added the way {start} works changes,
see above.
+ *match-pattern*
See |pattern| for the patterns that are accepted.
The 'ignorecase' option is used to set the ignore-caseness of
the pattern. 'smartcase' is NOT used. The matching is always
@@ -4477,6 +4569,50 @@ matcharg({nr}) *matcharg()*
Highlighting matches using the |:match| commands are limited
to three matches. |matchadd()| does not have this limitation.
+matchbufline({buf}, {pat}, {lnum}, {end}, [, {dict}]) *matchbufline()*
+ Returns the |List| of matches in lines from {lnum} to {end} in
+ buffer {buf} where {pat} matches.
+
+ {lnum} and {end} can either be a line number or the string "$"
+ to refer to the last line in {buf}.
+
+ The {dict} argument supports following items:
+ submatches include submatch information (|/\(|)
+
+ For each match, a |Dict| with the following items is returned:
+ byteidx starting byte index of the match
+ lnum line number where there is a match
+ text matched string
+ Note that there can be multiple matches in a single line.
+
+ This function works only for loaded buffers. First call
+ |bufload()| if needed.
+
+ See |match-pattern| for information about the effect of some
+ option settings on the pattern.
+
+ When {buf} is not a valid buffer, the buffer is not loaded or
+ {lnum} or {end} is not valid then an error is given and an
+ empty |List| is returned.
+
+ Examples: >vim
+ " Assuming line 3 in buffer 5 contains "a"
+ :echo matchbufline(5, '\<\k\+\>', 3, 3)
+ [{'lnum': 3, 'byteidx': 0, 'text': 'a'}]
+ " Assuming line 4 in buffer 10 contains "tik tok"
+ :echo matchbufline(10, '\<\k\+\>', 1, 4)
+ [{'lnum': 4, 'byteidx': 0, 'text': 'tik'}, {'lnum': 4, 'byteidx': 4, 'text': 'tok'}]
+<
+ If {submatch} is present and is v:true, then submatches like
+ "\1", "\2", etc. are also returned. Example: >vim
+ " Assuming line 2 in buffer 2 contains "acd"
+ :echo matchbufline(2, '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2, 2
+ \ {'submatches': v:true})
+ [{'lnum': 2, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]
+< The "submatches" List always contains 9 items. If a submatch
+ is not found, then an empty string is returned for that
+ submatch.
+
matchdelete({id} [, {win}]) *matchdelete()* *E802* *E803*
Deletes a match with ID {id} previously defined by |matchadd()|
or one of the |:match| commands. Returns 0 if successful,
@@ -4614,6 +4750,39 @@ matchstr({expr}, {pat} [, {start} [, {count}]]) *matchstr()*
When {expr} is a |List| then the matching item is returned.
The type isn't changed, it's not necessarily a String.
+matchstrlist({list}, {pat} [, {dict}]) *matchstrlist()*
+ Returns the |List| of matches in {list} where {pat} matches.
+ {list} is a |List| of strings. {pat} is matched against each
+ string in {list}.
+
+ The {dict} argument supports following items:
+ submatches include submatch information (|/\(|)
+
+ For each match, a |Dict| with the following items is returned:
+ byteidx starting byte index of the match.
+ idx index in {list} of the match.
+ text matched string
+ submatches a List of submatches. Present only if
+ "submatches" is set to v:true in {dict}.
+
+ See |match-pattern| for information about the effect of some
+ option settings on the pattern.
+
+ Example: >vim
+ :echo matchstrlist(['tik tok'], '\<\k\+\>')
+ [{'idx': 0, 'byteidx': 0, 'text': 'tik'}, {'idx': 0, 'byteidx': 4, 'text': 'tok'}]
+ :echo matchstrlist(['a', 'b'], '\<\k\+\>')
+ [{'idx': 0, 'byteidx': 0, 'text': 'a'}, {'idx': 1, 'byteidx': 0, 'text': 'b'}]
+<
+ If "submatches" is present and is v:true, then submatches like
+ "\1", "\2", etc. are also returned. Example: >vim
+ :echo matchstrlist(['acd'], '\(a\)\?\(b\)\?\(c\)\?\(.*\)',
+ \ #{submatches: v:true})
+ [{'idx': 0, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]
+< The "submatches" List always contains 9 items. If a submatch
+ is not found, then an empty string is returned for that
+ submatch.
+
matchstrpos({expr}, {pat} [, {start} [, {count}]]) *matchstrpos()*
Same as |matchstr()|, but return the matched string, the start
position and the end position of the match. Example: >vim
@@ -4640,7 +4809,7 @@ max({expr}) *max()*
it returns the maximum of all values in the Dictionary.
If {expr} is neither a List nor a Dictionary, or one of the
items in {expr} cannot be used as a Number this results in
- an error. An empty |List| or |Dictionary| results in zero.
+ an error. An empty |List| or |Dictionary| results in zero.
menu_get({path} [, {modes}]) *menu_get()*
Returns a |List| of |Dictionaries| describing |menus| (defined
@@ -4954,7 +5123,6 @@ msgpackparse({data}) *msgpackparse()*
are binary strings).
2. String with NUL byte inside.
3. Duplicate key.
- 4. Empty key.
ext |List| with two values: first is a signed integer
representing extension type. Second is
|readfile()|-style list of strings.
@@ -5173,9 +5341,9 @@ printf({fmt}, {expr1} ...) *printf()*
< This limits the length of the text used from "line" to
"width" bytes.
- If the argument to be formatted is specified using a posional
- argument specifier, and a '*' is used to indicate that a
- number argument is to be used to specify the width or
+ If the argument to be formatted is specified using a
+ positional argument specifier, and a '*' is used to indicate
+ that a number argument is to be used to specify the width or
precision, the argument(s) to be used must also be specified
using a {n$} positional argument specifier. See |printf-$|.
@@ -5630,9 +5798,9 @@ reg_recording() *reg_recording()*
Returns the single letter name of the register being recorded.
Returns an empty string when not recording. See |q|.
-reltime()
+reltime() *reltime()*
reltime({start})
-reltime({start}, {end}) *reltime()*
+reltime({start}, {end})
Return an item that represents a time value. The item is a
list with items that depend on the system.
The item can be passed to |reltimestr()| to convert it to a
@@ -5677,8 +5845,8 @@ reltimestr({time}) *reltimestr()*
< Also see |profiling|.
If there is an error an empty string is returned
-remove({list}, {idx})
-remove({list}, {idx}, {end}) *remove()*
+remove({list}, {idx}) *remove()*
+remove({list}, {idx}, {end})
Without {end}: Remove the item at {idx} from |List| {list} and
return the item.
With {end}: Remove items from {idx} to {end} (inclusive) and
@@ -6407,8 +6575,8 @@ setcmdpos({pos}) *setcmdpos()*
Returns 0 when successful, 1 when not editing the command
line.
-setcursorcharpos({lnum}, {col} [, {off}])
-setcursorcharpos({list}) *setcursorcharpos()*
+setcursorcharpos({lnum}, {col} [, {off}]) *setcursorcharpos()*
+setcursorcharpos({list})
Same as |cursor()| but uses the specified column number as the
character index instead of the byte index in the line.
@@ -6834,8 +7002,8 @@ shiftwidth([{col}]) *shiftwidth()*
'vartabstop' feature. If no {col} argument is given, column 1
will be assumed.
-sign_define({name} [, {dict}])
-sign_define({list}) *sign_define()*
+sign_define({name} [, {dict}]) *sign_define()*
+sign_define({list})
Define a new sign named {name} or modify the attributes of an
existing sign. This is similar to the |:sign-define| command.
@@ -7102,8 +7270,8 @@ sign_placelist({list}) *sign_placelist()*
\ ])
<
-sign_undefine([{name}])
-sign_undefine({list}) *sign_undefine()*
+sign_undefine([{name}]) *sign_undefine()*
+sign_undefine({list})
Deletes a previously defined sign {name}. This is similar to
the |:sign-undefine| command. If {name} is not supplied, then
deletes all the defined signs.
@@ -8255,7 +8423,6 @@ test_garbagecollect_now() *test_garbagecollect_now()*
internally, and |v:testing| must have been set before calling
any function.
-
timer_info([{id}]) *timer_info()*
Return a list with information about timers.
When {id} is given only information about this timer is
diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt
index e1bb7c5fc7..703addf51a 100644
--- a/runtime/doc/change.txt
+++ b/runtime/doc/change.txt
@@ -424,9 +424,12 @@ octal number.
Note that when 'nrformats' includes "octal", decimal numbers with leading
zeros cause mistakes, because they can be confused with octal numbers.
-Note similarly, when 'nrformats' includes "bin", binary numbers with a leading
-'0x' or '0X' can be interpreted as hexadecimal rather than binary since '0b'
-are valid hexadecimal digits.
+Note similarly, when 'nrformats' includes both "bin" and "hex", binary numbers
+with a leading '0x' or '0X' can be interpreted as hexadecimal rather than
+binary since '0b' are valid hexadecimal digits. CTRL-A on "0x0b11" results in
+"0x0b12", not "0x0b100".
+When 'nrformats' includes "bin" and doesn't include "hex", CTRL-A on "0b11" in
+"0x0b11" results in "0x0b100".
When the number under the cursor is too big to fit into 64 bits, it will be
rounded off to the nearest number that can be represented, and the
@@ -485,7 +488,7 @@ SHIFTING LINES LEFT OR RIGHT *shift-left-right*
lines to [indent] (default 0).
*:>*
-:[range]> [flags] Shift {count} [range] lines one 'shiftwidth' right.
+:[range]> [flags] Shift [range] lines one 'shiftwidth' right.
Repeat '>' for shifting multiple 'shiftwidth's.
See |ex-flags| for [flags].
diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt
index 8bed8a9ffc..57a4223c53 100644
--- a/runtime/doc/cmdline.txt
+++ b/runtime/doc/cmdline.txt
@@ -439,9 +439,8 @@ CTRL-T When 'incsearch' is set, entering a search pattern for "/" or
keyboard T is above G.
The 'wildchar' option defaults to <Tab> (CTRL-E when in Vi compatible mode; in
-a previous version <Esc> was used). In the pattern standard wildcards "*" and
-'?' are accepted when matching file names. "*" matches any string, '?'
-matches exactly one character.
+a previous version <Esc> was used). In the pattern standard |wildcards| are
+accepted when matching file names.
When repeating 'wildchar' or CTRL-N you cycle through the matches, eventually
ending up back to what was typed. If the first match is not what you wanted,
diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt
index 0a07f06c75..5ac4ad4ce2 100644
--- a/runtime/doc/deprecated.txt
+++ b/runtime/doc/deprecated.txt
@@ -90,7 +90,7 @@ For each of the functions below, use the corresponding function in
- *vim.lsp.diagnostic.enable()*
- *vim.lsp.diagnostic.get()*
- *vim.lsp.diagnostic.get_all()* Use |vim.diagnostic.get()| instead.
-- *vim.lsp.diagnostic.get_count()* Use |vim.diagnostic.get()| instead.
+- *vim.lsp.diagnostic.get_count()* Use |vim.diagnostic.count()| instead.
- *vim.lsp.diagnostic.get_line_diagnostics()* Use |vim.diagnostic.get()| instead.
- *vim.lsp.diagnostic.get_next()*
- *vim.lsp.diagnostic.get_next_pos()*
@@ -116,6 +116,9 @@ internally and are no longer exposed as part of the API. Instead, use
- *vim.lsp.diagnostic.set_underline()*
- *vim.lsp.diagnostic.set_virtual_text()*
+Configuring |diagnostic-signs| with |:sign-define| or |sign_define()| is no
+longer supported. Use the "signs" key of |vim.diagnostic.config()| instead.
+
LSP FUNCTIONS
- *vim.lsp.buf.server_ready()*
Use |LspAttach| instead, depending on your use-case. "Server ready" is not
@@ -138,9 +141,11 @@ LSP FUNCTIONS
- *vim.lsp.buf.range_formatting()* Use |vim.lsp.formatexpr()|
or |vim.lsp.buf.format()| instead.
- *vim.lsp.util.get_progress_messages()* Use |vim.lsp.status()| or access
- `progress` of |vim.lsp.client|
+ `progress` of |vim.lsp.Client|
- *vim.lsp.get_active_clients()* Use |vim.lsp.get_clients()|
- *vim.lsp.for_each_buffer_client()* Use |vim.lsp.get_clients()|
+- *vim.lsp.util.lookup_section()* Use |vim.tbl_get()| and
+ |vim.split()| with {plain=true} instead.
- *vim.lsp.util.trim_empty_lines()* Use |vim.split()| with `trimempty` instead.
- *vim.lsp.util.try_trim_markdown_code_blocks()*
- *vim.lsp.util.set_lines()*
@@ -164,6 +169,7 @@ LUA
- vim.register_keystroke_callback() Use |vim.on_key()| instead.
- *vim.pretty_print()* Use |vim.print()| instead.
- *vim.loop* Use |vim.uv| instead.
+- *vim.tbl_add_reverse_lookup()*
NORMAL COMMANDS
- *]f* *[f* Same as "gf".
@@ -171,7 +177,6 @@ NORMAL COMMANDS
OPTIONS
- *cpo-<* *:menu-<special>* *:menu-special* *:map-<special>* *:map-special*
`<>` notation is always enabled.
-- 'gdefault' Enables the |:substitute| flag 'g' by default.
- *'fe'* 'fenc'+'enc' before Vim 6.0; no longer used.
- *'highlight'* *'hl'* Names of builtin |highlight-groups| cannot be changed.
- *'langnoremap'* Deprecated alias to 'nolangremap'.
diff --git a/runtime/doc/dev_style.txt b/runtime/doc/dev_style.txt
index cb28f1a845..85aeddd425 100644
--- a/runtime/doc/dev_style.txt
+++ b/runtime/doc/dev_style.txt
@@ -41,17 +41,44 @@ All header files should start with `#pragma once` to prevent multiple inclusion.
#pragma once
<
+Headers system ~
-Constants ~
+Nvim uses two types of headers. There are "normal" headers and "defs" headers.
+Typically, each normal header will have a corresponding defs header, e.g.
+`fileio.h` and `fileio_defs.h`. This distinction is done to minimize
+recompilation on change. The reason for this is because adding a function or
+modifying a function's signature happens more frequently than changing a type
+The goal is to achieve the following:
-Do not use macros to define constants in headers.
+- All headers (defs and normal) must include only defs headers, system
+ headers, and generated declarations. In other words, headers must not
+ include normal headers.
-Macro constants in header files cannot be used by unit tests.
+- Source (.c) files may include all headers, but should only include normal
+ headers if they need symbols and not types.
-However, you are allowed to define a macro that holds the same value as a
-non-enum constant (defined in the same header) if the value of the constant
-represents the size of an array.
+Use the following guideline to determine what to put where:
+Symbols:
+ - regular function declarations
+ - `extern` variables (including the `EXTERN` macro)
+
+Non-symbols:
+ - macros, i.e. `#define`.
+ - static inline functions, but only if its function declaration has a
+ `REAL_FATTR_ALWAYS_INLINE` attribute.
+ - typedefs
+ - structs
+ - enums
+
+- All symbols must be moved to normal headers.
+
+- Non-symbols used by multiple headers should be moved to defs headers. This
+ is to ensure headers only include defs headers. Conversely, non-symbols used
+ by only a single header should be moved to that header.
+
+- EXCEPTION: if the macro calls a function, then it must be moved to a normal
+ header.
==============================================================================
Scoping *dev-style-scope*
@@ -73,6 +100,24 @@ should be used instead of declaration and assignment, e.g. >c
int j = g(); // GOOD: declaration has initialization.
+Initialization ~
+
+Multiple declarations can be defined in one line if they aren't initialized,
+but each initialization should be done on a separate line.
+
+>c
+ int i;
+ int j; // GOOD
+
+ int i, j; // GOOD: multiple declarations, no initialization.
+
+ int i = 0;
+ int j = 0; // GOOD: one initialization per line.
+
+ int i = 0, j; // BAD: multiple declarations with initialization.
+
+ int i = 0, j = 0; // BAD: multiple declarations with initialization.
+
==============================================================================
Nvim-Specific Magic
@@ -190,7 +235,7 @@ Function declarations ~
Every function must not have a separate declaration.
-Function declarations are created by the gendeclarations.lua script. >c
+Function declarations are created by the gen_declarations.lua script. >c
static void f(void);
@@ -773,47 +818,6 @@ example, `"\uFEFF"`, is the Unicode zero-width no-break space character, which
would be invisible if included in the source as straight UTF-8.
-Function Calls ~
-
-On one line if it fits; otherwise, wrap arguments at the parenthesis.
-
-Function calls have the following format: >c
-
- bool retval = do_something(argument1, argument2, argument3);
-
-If the arguments do not all fit on one line, they should be broken up onto
-multiple lines, with each subsequent line aligned with the first argument. Do
-not add spaces after the open paren or before the close paren: >c
-
- bool retval = do_something(averyveryveryverylongargument1,
- argument2, argument3);
-
-If the function has many arguments, consider having one per line if this makes
-the code more readable: >c
-
- bool retval = do_something(argument1,
- argument2,
- argument3,
- argument4);
-
-Arguments may optionally all be placed on subsequent lines, with one line per
-argument: >c
-
- if (...) {
- ...
- ...
- if (...) {
- do_something(
- argument1, // 4 space indent
- argument2,
- argument3,
- argument4);
- }
-
-In particular, this should be done if the function signature is so long that
-it cannot fit within the maximum line length.
-
-
Braced Initializer Lists ~
Format a braced list exactly like you would format a function call in its
@@ -915,11 +919,6 @@ Horizontal Whitespace ~
Use of horizontal whitespace depends on location.
- General ~
->c
- int x[] = { 0 }; // Spaces inside braces for braced-init-list.
-<
-
Variables ~
>c
int long_variable = 0; // Don't align assignments.
@@ -936,26 +935,6 @@ Use of horizontal whitespace depends on location.
};
<
-
- Operators ~
->c
- x = 0; // Assignment operators always have spaces around
- // them.
- x = -5; // No spaces separating unary operators and their
- x++; // arguments.
- if (x && !y)
-<
-
-Vertical Whitespace ~
-
-Minimize use of vertical whitespace.
-
-The basic principle is: The more code that fits on one screen, the easier it
-is to follow and understand the control flow of the program. Of course,
-readability can suffer from code being too dense as well as too spread out, so
-use your judgment. But in general, minimize use of vertical whitespace.
-
-
==============================================================================
Parting Words
diff --git a/runtime/doc/dev_theme.txt b/runtime/doc/dev_theme.txt
new file mode 100644
index 0000000000..29a2da0d90
--- /dev/null
+++ b/runtime/doc/dev_theme.txt
@@ -0,0 +1,121 @@
+*dev_theme.txt* Nvim
+
+
+ NVIM REFERENCE MANUAL
+
+
+Nvim theme style guide *dev-theme*
+
+This is style guide for developers working on Nvim's default color scheme.
+
+License: CC-By 3.0 https://creativecommons.org/licenses/by/3.0/
+
+ Type |gO| to see the table of contents.
+
+==============================================================================
+Design
+
+- Be "Neovim branded", i.e. have mostly "green-blue" feel plus one or two
+ colors reserved for very occasional user attention.
+
+- Be oriented for 'termguicolors' (true colors) while being extra minimal for
+ 'notermguicolors' (16 colors) as fallback.
+
+- Be accessible, i.e. have high enough contrast ratio (as defined in
+ https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef).
+ This means to have value at least 7 for |hl-Normal| and 4.5 for some common
+ cases (|hl-Visual|, `Comment` with set 'cursorline', colored syntax, `Diff*`,
+ |hl-Search|).
+
+- Be suitable for dark and light backgrounds via exchange of dark and light
+ palettes.
+
+- Be usable, i.e. provide enough visual feedback for common objects.
+
+
+==============================================================================
+Palettes
+
+- There are two separate palettes: dark and light. They all contain the same
+ set of colors exported as `NvimDark*` and `NvimLight*` colors respectively.
+
+- The dark palette is used for background in the dark color scheme and for
+ foreground in the light color scheme; and vice versa. This introduces
+ recognizable visual system without too standing out.
+
+- Actual computation of palettes should be done in a perceptually uniform
+ color space. Oklch is a good choice.
+
+- Each palette has the following colors (descriptions are for dark background;
+ reverse for light one):
+
+ - Four shades of colored "cold" greys for general UI.
+
+ - Dark ones (from darkest to lightest) are reserved as background for
+ |hl-NormalFloat| (considered as "black"), |hl-Normal| (background),
+ |hl-CursorLine|, |hl-Visual|.
+
+ - Light ones (also from darkest to lightest) are reserved for
+ `Comment`, |hl-StatusLine|/|hl-TabLine|, |hl-Normal| (foreground),
+ and color considered as "white".
+
+- Six colors to provide enough terminal colors: red, yellow, green, cyan,
+ blue, magenta.
+ They should have (reasonably) similar lightness and chroma to make them
+ visually coherent. Lightness should be as equal to the palette's basic grey
+ (which is used for |hl-Normal|) as possible. They should have (reasonably)
+ different hues to make them visually separable.
+
+- For 16 colors:
+
+ - Greys are not used and are replaced with the foreground and background
+ colors of the terminal emulator.
+
+ - Non-grey colors fall back to terminal colors as ordered in ANSI codes
+ (https://en.wikipedia.org/wiki/ANSI_escape_code#3-bit_and_4-bit),
+ that is red (1, 9), green (2, 10), yellow (3, 11), blue (4, 12),
+ magenta (5, 13), cyan (6, 14).
+ To increase contrast, colors 1-6 are used for light background and 9-14
+ for dark background.
+
+
+==============================================================================
+Highlight groups
+
+Use:
+
+- Grey shades for general UI according to their design.
+
+- Bold text for keywords (`Statement` highlight group). This is an important
+ choice to increase accessibility for people with color deficiencies, as it
+ doesn't rely on actual color.
+
+- Green for strings, |hl-DiffAdd| (as background), |hl-DiagnosticOk|, and some
+ minor text UI elements.
+
+- Cyan as main syntax color, i.e. for function usage (`Function` highlight
+ group), |hl-DiffText|, |hl-DiagnosticInfo|, and some minor text UI elements.
+
+- Red to generally mean high user attention, i.e. errors; in particular for
+ |hl-ErrorMsg|, |hl-DiffDelete|, |hl-DiagnosticError|.
+
+- Yellow very sparingly to mean mild user attention, i.e. warnings. That is,
+ |hl-DiagnosticWarn| and |hl-WarningMsg|.
+
+- Blue very sparingly as |hl-DiagnosticHint| and some additional important
+ syntax group (like `Identifier`).
+
+- Magenta very carefully (if at all).
+
+In case of 16 colors:
+
+- Rely on the assumption "Background color can be used as background; other
+ colors can be used as foreground". This means that in any
+ foreground/background combination there should be background and one
+ non-background color.
+
+- Use 0 (black) or 15 (bright white) as foreground for non-grey background,
+ depending on whether normal background is light or dark.
+
+
+ vim:tw=78:ts=8:et:ft=help:norl:
diff --git a/runtime/doc/dev_tools.txt b/runtime/doc/dev_tools.txt
new file mode 100644
index 0000000000..3ee48bec90
--- /dev/null
+++ b/runtime/doc/dev_tools.txt
@@ -0,0 +1,192 @@
+*dev_tools.txt* Nvim
+
+
+ NVIM REFERENCE MANUAL
+
+
+Tools and techniques for developing Nvim *dev-tools*
+
+The following advice is helpful when working on or debugging issues with Nvim
+itself. See also |debug.txt| for advice that applies to Vim.
+
+ Type |gO| to see the table of contents.
+
+==============================================================================
+Backtraces *dev-tools-backtrace*
+
+LINUX ~
+
+Core dumps are disabled by default on Ubuntu
+https://stackoverflow.com/a/18368068, CentOS and others. To enable core dumps:
+>bash
+ ulimit -c unlimited
+<
+On systemd-based systems getting a backtrace is as easy as:
+>bash
+ coredumpctl -1 gdb
+<
+It's an optional tool, so you may need to install it:
+>bash
+ sudo apt install systemd-coredump
+<
+
+The full backtrace is most useful, send us the `bt.txt` file:
+>bash
+ 2>&1 coredumpctl -1 gdb | tee -a bt.txt
+ thread apply all bt full
+<
+On older systems a `core` file will appear in the current directory. To get
+a backtrace from the `core` file:
+>bash
+ gdb build/bin/nvim core 2>&1 | tee backtrace.txt
+ thread apply all bt full
+<
+
+MACOS
+
+If `nvim` crashes, you can see the backtrace in `Console.app` (under "Crash
+Reports" or "User Diagnostic Reports" for older macOS versions).
+>bash
+ open -a Console
+<
+You may also want to enable core dumps on macOS. To do this, first make sure
+the `/cores/` directory exists and is writable:
+>bash
+ sudo mkdir /cores
+ sudo chown root:admin /cores
+ sudo chmod 1775 /cores
+<
+Then set the core size limit to `unlimited`:
+>bash
+ ulimit -c unlimited
+<
+Note that this is done per shell process. If you want to make this the default
+for all shells, add the above line to your shell's init file (e.g. `~/.bashrc`
+or similar).
+
+You can then open the core file in `lldb`:
+>bash
+ lldb -c /cores/core.12345
+<
+Apple's documentation archive has some other useful information
+https://developer.apple.com/library/archive/technotes/tn2124/_index.html#//apple_ref/doc/uid/DTS10003391-CH1-SECCOREDUMPS,
+but note that some of the things on this page are out of date (such as enabling
+core dumps with `/etc/launchd.conf`).
+
+==============================================================================
+Gdb *dev-tools-gdb*
+
+USING GDB TO STEP THROUGH FUNCTIONAL TESTS ~
+
+Use `TEST_TAG` to run tests matching busted tags (of the form `#foo` e.g.
+`it("test #foo ...", ...)`):
+>bash
+ GDB=1 TEST_TAG=foo make functionaltest
+<
+Then, in another terminal:
+>bash
+ gdb build/bin/nvim
+ target remote localhost:7777
+<
+- See also test/functional/helpers.lua https://github.com/neovim/neovim/blob/3098b18a2b63a841351f6d5e3697cb69db3035ef/test/functional/helpers.lua#L38-L44.
+
+
+USING LLDB TO STEP THROUGH UNIT TESTS ~
+
+>bash
+ lldb .deps/usr/bin/luajit -- .deps/usr/bin/busted --lpath="./build/?.lua" test/unit/
+<
+
+USING GDB ~
+
+To attach to a running `nvim` process with a pid of 1234:
+>bash
+ gdb -tui -p 1234 build/bin/nvim
+<
+The `gdb` interactive prompt will appear. At any time you can:
+
+- `break foo` to set a breakpoint on the `foo()` function
+- `n` to step over the next statement
+ - `<Enter>` to repeat the last command
+- `s` to step into the next statement
+- `c` to continue
+- `finish` to step out of the current function
+- `p zub` to print the value of `zub`
+- `bt` to see a backtrace (callstack) from the current location
+- `CTRL-x CTRL-a` or `tui enable` to show a TUI view of the source file in the
+ current debugging context. This can be extremely useful as it avoids the
+ need for a gdb "frontend".
+- `<up>` and `<down>` to scroll the source file view
+
+
+GDB "REVERSE DEBUGGING" ~
+
+- `set record full insn-number-max unlimited`
+- `continue` for a bit (at least until `main()` is executed
+- `record`
+- provoke the bug, then use `revert-next`, `reverse-step`, etc. to rewind the
+ debugger
+
+
+USING GDBSERVER ~
+
+You may want to connect multiple `gdb` clients to the same running `nvim`
+process, or you may want to connect to a remote `nvim` process with a local
+`gdb`. Using `gdbserver`, you can attach to a single process and control it
+from multiple `gdb` clients.
+
+Open a terminal and start `gdbserver` attached to `nvim` like this:
+>bash
+ gdbserver :6666 build/bin/nvim 2> gdbserver.log
+<
+`gdbserver` is now listening on port 6666. You then need to attach to this
+debugging session in another terminal:
+>bash
+ gdb build/bin/nvim
+<
+Once you've entered `gdb`, you need to attach to the remote session:
+>
+ target remote localhost:6666
+<
+In case gdbserver puts the TUI as a background process, the TUI can become
+unable to read input from pty (and receives SIGTTIN signal) and/or output data
+(SIGTTOU signal). To force the TUI as the foreground process, you can add
+>
+ signal (SIGTTOU, SIG_IGN);
+ if (!tcsetpgrp(data->input.in_fd, getpid())) {
+ perror("tcsetpgrp failed");
+ }
+<
+to `tui.c:terminfo_start`.
+
+
+USING GDBSERVER IN TMUX ~
+
+Consider using a custom makefile
+https://github.com/neovim/neovim/blob/master/BUILD.md#custom-makefile to
+quickly start debugging sessions using the `gdbserver` method mentioned above.
+This example `local.mk` will create the debugging session when you type `make
+debug`.
+>make
+ .PHONY: dbg-start dbg-attach debug build
+
+ build:
+ @$(MAKE) nvim
+
+ dbg-start: build
+ @tmux new-window -n 'dbg-neovim' 'gdbserver :6666 ./build/bin/nvim -D'
+
+ dbg-attach:
+ @tmux new-window -n 'dbg-cgdb' 'cgdb -x gdb_start.sh ./build/bin/nvim'
+
+ debug: dbg-start dbg-attach
+<
+Here `gdb_start.sh` includes `gdb` commands to be called when the debugger
+starts. It needs to attach to the server started by the `dbg-start` rule. For
+example:
+>
+ target remote localhost:6666
+ br main
+<
+
+vim:tw=78:ts=8:et:ft=help:norl:
diff --git a/runtime/doc/dev_vimpatch.txt b/runtime/doc/dev_vimpatch.txt
new file mode 100644
index 0000000000..96307dc7df
--- /dev/null
+++ b/runtime/doc/dev_vimpatch.txt
@@ -0,0 +1,303 @@
+*dev_vimpatch.txt* Nvim
+
+ NVIM REFERENCE MANUAL
+
+Merging patches from Vim *dev-vimpatch*
+
+
+Nvim was forked from Vim 7.4.160; it is kept up-to-date with relevant Vim
+patches in order to avoid duplicate work. Run `vim-patch.sh`
+https://github.com/neovim/neovim/blob/master/scripts/vim-patch.sh to see the
+status of Vim patches:
+>bash
+ ./scripts/vim-patch.sh -l
+<
+Everyone is welcome to |dev-vimpatch-pull-requests| for relevant Vim
+patches, but some types of patches are |dev-vimpatch-not-applicable|.
+See |dev-vimpatch-quickstart| to get started immediately.
+
+
+ Type |gO| to see the table of contents.
+
+==============================================================================
+QUICKSTART *dev-vimpatch-quickstart*
+
+1. Pull the Nvim source:
+>bash
+ git clone https://github.com/neovim/neovim.git
+<
+2. Run `./scripts/vim-patch.sh -l` to see the list of missing Vim patches.
+
+3. Choose a patch from the list (usually the oldest one), e.g. `8.0.0123`.
+
+ - Check for open vim-patch PRs
+ https://github.com/neovim/neovim/pulls?q=is%3Apr+is%3Aopen+label%3Avim-patch.
+
+4. Run `./scripts/vim-patch.sh -p 8.0.0123`
+
+5. Follow the instructions given by the script.
+
+NOTES ~
+
+- It's strongly recommended to work on the oldest missing patch, because
+ later patches might depend on the changes.
+- Use `git log --grep` or `git log -G` to search the Nvim/Vim source history
+ (even deleted code). E.g. to find `reset_option_was_set`: >bash
+
+ git log -p -G reset_option_was_set
+<
+- Pass `git log` options like `--grep` and `-G` to `./scripts/vim-patch.sh -L`
+ to filter unmerged Vim patches E.g. to find `+quickfix` patches: >bash
+
+ ./scripts/vim-patch.sh -L --grep quickfix -- src
+<
+==============================================================================
+PULL REQUESTS *dev-vimpatch-pull-requests*
+
+Note: vim-patch.sh automates these steps for you. Use it!
+
+- Install `gh` (https://cli.github.com/) if you want to use `vim-patch.sh` to
+ create PRs automatically
+- The pull request title should include `vim-patch:8.x.xxxx` (no whitespace)
+- The commit message
+ https://github.com/neovim/neovim/commit/4ccf1125ff569eccfc34abc4ad794044c5ab7455
+ should include:
+ - A token indicating the Vim patch number, formatted as follows:
+ `vim-patch:8.0.0123` (no whitespace)
+ - A URL pointing to the Vim commit:
+ https://github.com/vim/vim/commit/c8020ee825b9d9196b1329c0e097424576fc9b3a
+ - The original Vim commit message, including author
+
+Reviewers: hint for reviewing `runtime/` patches
+https://github.com/neovim/neovim/pull/1744#issuecomment-68202876
+
+==============================================================================
+NA (NOT APPLICABLE) PATCHES *dev-vimpatch-not-applicable*
+
+Many Vim patches are not applicable to Nvim. If you find NA patches, visit an
+open "version.c: update" pull request
+https://github.com/neovim/neovim/pulls?q=is%3Apr+author%3Aapp%2Fgithub-actions+version.c+is%3Aopen
+and mention the NA patches in a comment (please edit/update one comment,
+rather than adding a new comment for each patch).
+
+If there are no open `version.c: update` pull requests, include NA patches in
+a commit message in the following format:
+>
+ vim-patch:<version-or-commit>
+ vim-patch:<version-or-commit>
+ ...
+<
+where `<version-or-commit>` is a valid Vim version (like `8.0.0123`) or
+commit-id (SHA). Each patch is on a separate line.
+
+It is preferred to include NA patches by squashing it in applicable Vim
+patches, especially if the Vim patches are related. First line of the commit
+message should be from the applicable Vim patch.
+>
+ ./scripts/vim-patch -p <na-patch>
+ ./scripts/vim-patch -p <na-patch>
+ ...
+ ./scripts/vim-patch -P <patch>
+ git rebase -i master
+<
+Example:
+https://github.com/neovim/neovim/commit/00f60c2ce78fc1280e93d5a36bc7b2267d5f4ac6
+
+TYPES OF "NOT APPLICABLE" VIM PATCHES ~
+
+- Vim9script features, and anything related to `:scriptversion`. (Nvim
+ supports Vimscript version 1 only.) Be aware that patches labelled `Vim9:`
+ may still contain applicable fixes to other parts of the codebase, so these
+ patch need to be checked individually.
+- Updates to `testdir/Makefile` are usually NA because the Makefile implicitly
+ finds
+ https://github.com/neovim/neovim/commit/8a677f8a4bff6005fa39f090c14e970c3dfdbe6e#diff-b3c6ad6680a25a1b42095879e3a87104R52
+ all `test_*.vim` files.
+- Compiler warning fixes: Nvim strives to have no warnings at all, and has a
+ very different build system from Vim.
+ - Note: Coverity fixes in Vim are relevant to Nvim.
+- `*.proto` changes: Nvim autogenerates function prototypes
+- `#ifdef` tweaking: For example, Vim decided to enable `FEAT_VISUAL` for all
+ platforms - but Nvim already does that. Adding new `FEAT_` guards also isn't
+ relevant to Nvim.
+- Legacy system support: Fixes for legacy systems such as Amiga, OS/2 Xenix,
+ Mac OS 9, Windows older than XP SP2, are not needed because they are not
+ supported by Nvim.
+ - NA files: `src/Make_*`, `src/testdir/Make__*`
+- `if_*.c` changes: `if_python.c` et. al. were removed.
+- `term.c` changes: the Nvim TUI uses `libtermkey` to read terminal sequences;
+ Vim's `term.c` was removed.
+- `job` patches: incompatible API and implementation
+ - NA files: `src/channel_*`, `src/job_*`, `src/testdir/test_channel_*`,
+ `src/testdir/test_job_*`
+- `:terminal` patches that modify NA files: incompatible API and
+ implementation
+ - NA files: `src/terminal_*`, `src/testdir/test_terminal_*`
+- `defaults.vim` patches
+- Most GUI-related changes: Nvim GUIs are implemented external to the core C
+ codebase.
+ - NA files: `src/gui_*`, `src/gvim_*`, `src/GvimExt/*`, `src/testdir/test_gui*`
+- `balloon` changes: Nvim does not support balloon feature
+ - NA files: `src/beval_*`, `src/testdir/test_balloon_*`
+- libvterm changes: Nvim does not vendor libvterm in `src/`.
+- Screendump tests from `test_popupwin.vim`, `test_popupwin_textprop.vim`:
+ https://github.com/neovim/neovim/pull/12741#issuecomment-704677141
+- json changes: incompatible API https://github.com/neovim/neovim/pull/4131
+ - NA files: `src/json*`, `src/testdir/test_json.vim`
+- `test_restricted.vim` restricted mode is removed in
+ https://github.com/neovim/neovim/pull/11996
+- Many tests in `test_prompt_buffer.vim` require incompatible Vim features
+ such as `channel`; they should still be included, but skipped
+- non-runtime documentation: Moved to https://neovim.io/doc/,
+ - NA files: `Filelist`, `README`, `INSTALL`,
+- Anything else might be relevant; err on the side of caution, and post an
+ issue if you aren't sure.
+
+==============================================================================
+VERSION.C *dev-vimpatch-version.c*
+
+The list of Vim patches in `src/nvim/version.c` is automatically updated
+https://github.com/neovim/neovim/pull/7780 based on the presence of
+`vim-patch:xxx` tokens in the Nvim git log.
+
+- Don't update `src/nvim/version.c` yourself.
+ - `scripts/vim-patch.sh -p` intentionally omits `version.c` to avoid merge
+ conflicts and save time when porting a patch.
+- The automation script (`scripts/vimpatch.lua`) only recognizes tokens like
+ `vim-patch:8.0.1206`, not `vim-patch:<hash>`.
+
+==============================================================================
+CODE DIFFERENCES *dev-vimpatch-code-differences*
+
+The following functions have been removed or deprecated in favor of newer
+alternatives. See `memory.c`
+https://github.com/neovim/neovim/blob/master/src/nvim/memory.c for more
+information.
+>
+ -----------------------------------------------------------------------
+ Deprecated or removed Replacement
+ -----------------------------------------------------------------------
+ vim_free xfree
+ VIM_CLEAR(&foo) XFREE_CLEAR(foo)
+ malloc alloc lalloc lalloc_id ALLOC_ONE xmalloc
+ calloc lalloc_clear xcalloc
+ realloc vim_realloc xrealloc
+ mch_memmove memmove
+ vim_memset copy_chars copy_spaces memset
+ vim_strbyte strchr
+ vim_strncpy strncpy xstrlcpy
+ vim_strcat strncat xstrlcat
+ VIM_ISWHITE ascii_iswhite
+ IS_WHITE_OR_NUL ascii_iswhite_or_nul
+ vim_isalpha mb_isalpha
+ vim_isNormalIDc ascii_isident
+ vim_islower vim_isupper mb_islower mb_isupper
+ vim_tolower vim_toupper mb_tolower mb_toupper
+ mb_ptr2len utfc_ptr2len
+ mb_ptr2len_len utfc_ptr2len_len
+ mb_char2len utf_char2len
+ mb_char2bytes utf_char2bytes
+ mb_ptr2cells utf_ptr2cells
+ mb_ptr2cells_len utf_ptr2cells_len
+ mb_char2cells utf_char2cells
+ mb_off2cells utf_off2cells
+ mb_ptr2char utf_ptr2char
+ mb_head_off utf_head_off
+ mb_tail_off utf_cp_bounds
+ mb_lefthalve grid_lefthalve
+ mb_fix_col grid_fix_col
+ utf_off2cells grid_off2cells
+ ml_get_curline get_cursor_line_ptr
+ ml_get_cursor get_cursor_pos_ptr
+ screen_char ui_line
+ screen_line grid_put_linebuf
+ screen_* (most functions) grid_*
+ update_prepare, update_finish #9484 removed; use update_screen only
+ ARRAY_LENGTH ARRAY_SIZE
+ vim_strsave_escape_csi vim_strsave_escape_ks
+ vim_unescape_csi vim_unescape_ks
+ gettail path_tail
+ mch_isFullName path_is_absolute
+ script_do_profile profile_init
+
+ -----------------------------------------------------------------------
+<
+Make sure to note the difference between `utf_` and `utfc_` when replacing
+`mb_` functions. Also indirect call syntax `(*mb_ptr2len)(...)` should be
+replaced with an ordinary function call `utfc_ptr2len(...)`.
+>
+ -----------------------------------------------------------------------
+ Data type Format (Vim source) Portable format (Nvim source)
+ ------------ ----------------------- ----------------------------------
+ long long "%lld" "%" PRId64
+ size_t "%ld" "%zu"
+ linenr_T "%ld" "%" PRIdLINENR
+ -----------------------------------------------------------------------
+<
+- See also: https://github.com/neovim/neovim/pull/1729#discussion_r22423779
+- Vim's `ga_init2` was renamed to `ga_init` and the original `ga_init` is
+ gone.
+- "Old style" Vim tests (`src/testdir/*.in`) should be converted to Lua tests
+ (see #1286 https://github.com/neovim/neovim/issues/1286 and #1328
+ https://github.com/neovim/neovim/pull/1328). See Checklist for migrating
+ legacy tests
+ https://github.com/neovim/neovim/blob/master/test/README.md#checklist-for-migrating-legacy-tests.
+ - However, please do not convert "new style" Vim tests
+ (`src/testdir/*.vim`) to Lua. The "new style" Vim tests are faster than
+ the old ones, and converting them takes time and effort better spent
+ elsewhere. Just copy them to `test/old/testdir/*.vim`.
+- Conditions that check `enc_utf8` or `has_mbyte` are obsolete (only the
+ "true" case is applicable).
+ - `enc_utf8` and `has_mbyte` macros were removed in
+ https://github.com/neovim/neovim/pull/13293
+- Check for `CSI` in typeahead buffer is only necessary in Vim with
+ `FEAT_GUI`. `CSI` does not have a special meaning in typeahead buffer in
+ Nvim. (also see https://github.com/neovim/neovim/pull/16936)
+
+==============================================================================
+LIST MANAGEMENT *dev-vimpatch-list-management*
+
+Management of lists (types `list_T` and `listitem_T` from vim) was changed in
+https://github.com/neovim/neovim/pull/7708/. There is a lint against the "old"
+usage, but here are the most important changes.
+
+Declarations for the table
+
+- `list_T list`: a list
+- `listitem_T li`: an item of `list`
+- `int val` a value for `lv_copyID`
+
+>
+ --------------------------------------------------------------------------------------
+ Old New Comment
+ ------------------------------- ------------------------------------------------------
+ list->lv_first tv_list_first(list)
+ list->lv_last tv_list_last(list)
+ li->li_next TV_LIST_ITEM_NEXT(list, li) To be avoided if possible, must use list which li belongs to.
+ li->li_prev TV_LIST_ITEM_PREV(list, li) To be avoided if possible, must use list which li belongs to.
+ Suggestion by @ZyX-l: Use TV_LIST_ITER or indexing instead of the previous two calls.
+ list->lv_len tv_list_len(list)
+ list->lv_lock tv_list_locked(list)
+ &li->li_tv TV_LIST_ITEM_TV(li)
+ list->lv_refcount++ tv_list_ref(list)
+ val = list->lv_copyID val = tv_list_copyid(list)
+ list->lv_copyID = val tv_list_set_copyid(list, val)
+
+ for (li = list->lv_first; TV_LIST_ITER_CONST(list, li, Use TV_LIST_ITER(...) if you need to
+ li != NULL && another_cond; { if (another_cond) {break;} code}) modify list items (note: assigning copyID is also modification and this happens
+ li = li->li_next) code always when recursively traversing a list).
+
+ --------------------------------------------------------------------------------------
+<
+For more details and some more advanced usage, see `typval.h` and `typval.c`.
+
+==============================================================================
+DOCUMENTATION DIFFERENCES *dev-vimpatch-documentation*
+
+The following should be removed from all imported documentation, and not be
+used in new documentation:
+
+- `{Only when compiled with ...}`: the vast majority of features have been
+ made non-optional (see https://github.com/neovim/neovim/wiki/Introduction)
+
+vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt
index f1d74326c7..767f46ad1e 100644
--- a/runtime/doc/develop.txt
+++ b/runtime/doc/develop.txt
@@ -102,11 +102,11 @@ Examples:
The provider framework invokes Vimscript from C. It is composed of two
functions in eval.c:
-- eval_call_provider(name, method, arguments, discard): calls
- provider#{name}#Call with the method and arguments. If discard is true, any
+- eval_call_provider({name}, {method}, {arguments}, {discard}): Calls
+ `provider#{name}#Call` with {method} and {arguments}. If {discard} is true, any
value returned by the provider will be discarded and empty value will be
returned.
-- eval_has_provider(name): Checks the `g:loaded_{name}_provider` variable
+- eval_has_provider({name}): Checks the `g:loaded_{name}_provider` variable
which must be set to 2 by the provider script to indicate that it is
"enabled and working". Called by |has()| to check if features are available.
@@ -179,19 +179,22 @@ Strict "vimdoc" subset:
- Do not use indentation in random places—that prevents the page from using
"flow" layout. If you need a preformatted section, put it in
a |help-codeblock| starting with ">".
+- Parameters and fields are documented as `{foo}`.
+- Optional parameters and fields are documented as `{foo}?`.
C docstrings ~
-Nvim API documentation lives in the source code, as docstrings (Doxygen
+Nvim API documentation lives in the source code, as docstrings (doc
comments) on the function definitions. The |api| :help is generated
from the docstrings defined in src/nvim/api/*.c.
Docstring format:
- Lines start with `///`
- Special tokens start with `@` followed by the token name:
- `@note`, `@param`, `@returns`
-- Limited markdown is supported.
- - List-items start with `-` (useful to nest or "indent")
+ `@note`, `@param`, `@return`
+- Markdown is supported.
+- Tags are written as `[tag]()`.
+- References are written as `[tag]`
- Use ``` for code samples.
Code samples can be annotated as `vim` or `lua`
@@ -233,11 +236,35 @@ definitions. The |lua-vim| :help is generated from the docstrings.
Docstring format:
- Use LuaCATS annotations: https://luals.github.io/wiki/annotations/
-- Limited markdown is supported.
- - List-items start with `-` (useful to nest or "indent")
+- Markdown is supported.
+- Tags are written as `[tag]()`.
+- References are written as `[tag]`
- Use ``` for code samples.
Code samples can be annotated as `vim` or `lua`
- Use `@nodoc` to prevent documentation generation.
+- Use `@inlinedoc` to inline `@class` blocks into `@param` blocks.
+ E.g. >lua
+ --- Object with fields:
+ --- @class myOpts
+ --- @inlinedoc
+ ---
+ --- Documentation for some field
+ --- @field somefield? integer
+
+ --- @param opts? myOpts
+ function foo(opts)
+ end
+<
+
+ Will be rendered as: >vimdoc
+
+ foo({opts})
+
+ Parameters:
+ - {opts}? (table) Object with the fields:
+ - {somefield}? (integer) Documentation
+ for some field
+<
- Files which has `@meta` are only used for typing and documentation.
Example: the help for |vim.paste()| is generated from a docstring decorating
diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt
index 7f5c809ac3..c9e783ca62 100644
--- a/runtime/doc/diagnostic.txt
+++ b/runtime/doc/diagnostic.txt
@@ -38,24 +38,6 @@ optionally supplied). A good rule of thumb is that if a method is meant to
modify the diagnostics for a buffer (e.g. |vim.diagnostic.set()|) then it
requires a namespace.
- *diagnostic-structure*
-A diagnostic is a Lua table with the following keys. Required keys are
-indicated with (+):
-
- bufnr: Buffer number
- lnum(+): The starting line of the diagnostic
- end_lnum: The final line of the diagnostic
- col(+): The starting column of the diagnostic
- end_col: The final column of the diagnostic
- severity: The severity of the diagnostic |vim.diagnostic.severity|
- message(+): The diagnostic text
- source: The source of the diagnostic
- code: The diagnostic code
- user_data: Arbitrary data plugins or users can add
-
-Diagnostics use the same indexing as the rest of the Nvim API (i.e. 0-based
-rows and columns). |api-indexing|
-
*vim.diagnostic.severity* *diagnostic-severity*
The "severity" key in a diagnostic is one of the values defined in
`vim.diagnostic.severity`:
@@ -317,12 +299,24 @@ SIGNS *diagnostic-signs*
Signs are defined for each diagnostic severity. The default text for each sign
is the first letter of the severity name (for example, "E" for ERROR). Signs
-can be customized using the following: >vim
+can be customized with |vim.diagnostic.config()|. Example: >lua
- sign define DiagnosticSignError text=E texthl=DiagnosticSignError linehl= numhl=
- sign define DiagnosticSignWarn text=W texthl=DiagnosticSignWarn linehl= numhl=
- sign define DiagnosticSignInfo text=I texthl=DiagnosticSignInfo linehl= numhl=
- sign define DiagnosticSignHint text=H texthl=DiagnosticSignHint linehl= numhl=
+ -- Highlight entire line for errors
+ -- Highlight the line number for warnings
+ vim.diagnostic.config({
+ signs = {
+ text = {
+ [vim.diagnostic.severity.ERROR] = '',
+ [vim.diagnostic.severity.WARN] = '',
+ },
+ linehl = {
+ [vim.diagnostic.severity.ERROR] = 'ErrorMsg',
+ },
+ numhl = {
+ [vim.diagnostic.severity.WARN] = 'WarningMsg',
+ },
+ },
+ })
When the "severity_sort" option is set (see |vim.diagnostic.config()|) the
priority of each sign depends on the severity of the associated diagnostic.
@@ -349,6 +343,236 @@ Example: >lua
==============================================================================
Lua module: vim.diagnostic *diagnostic-api*
+*vim.Diagnostic*
+ *diagnostic-structure*
+
+ Diagnostics use the same indexing as the rest of the Nvim API (i.e.
+ 0-based rows and columns). |api-indexing|
+
+ Fields: ~
+ • {bufnr}? (`integer`) Buffer number
+ • {lnum} (`integer`) The starting line of the diagnostic
+ (0-indexed)
+ • {end_lnum}? (`integer`) The final line of the diagnostic (0-indexed)
+ • {col} (`integer`) The starting column of the diagnostic
+ (0-indexed)
+ • {end_col}? (`integer`) The final column of the diagnostic
+ (0-indexed)
+ • {severity}? (`vim.diagnostic.Severity`) The severity of the
+ diagnostic |vim.diagnostic.severity|
+ • {message} (`string`) The diagnostic text
+ • {source}? (`string`) The source of the diagnostic
+ • {code}? (`string|integer`) The diagnostic code
+ • {_tags}? (`{ deprecated: boolean, unnecessary: boolean}`)
+ • {user_data}? (`any`) arbitrary data plugins can add
+ • {namespace}? (`integer`)
+
+*vim.diagnostic.GetOpts*
+ A table with the following keys:
+
+ Fields: ~
+ • {namespace}? (`integer`) Limit diagnostics to the given namespace.
+ • {lnum}? (`integer`) Limit diagnostics to the given line number.
+ • {severity}? (`vim.diagnostic.SeverityFilter`) See
+ |diagnostic-severity|.
+
+*vim.diagnostic.GotoOpts*
+ Extends: |vim.diagnostic.GetOpts|
+
+ Configuration table with the following keys:
+
+ Fields: ~
+ • {cursor_position}? (`{[1]:integer,[2]:integer}`, default: current cursor position)
+ Cursor position as a `(row, col)` tuple. See
+ |nvim_win_get_cursor()|.
+ • {wrap}? (`boolean`, default: `true`) Whether to loop
+ around file or not. Similar to 'wrapscan'.
+ • {severity} (`vim.diagnostic.Severity`) See
+ |diagnostic-severity|.
+ • {float}? (`boolean|vim.diagnostic.Opts.Float`, default:
+ `true`) If `true`, call
+ |vim.diagnostic.open_float()| after moving. If a
+ table, pass the table as the {opts} parameter to
+ |vim.diagnostic.open_float()|. Unless overridden,
+ the float will show diagnostics at the new cursor
+ position (as if "cursor" were passed to the
+ "scope" option).
+ • {win_id}? (`integer`, default: `0`) Window ID
+
+*vim.diagnostic.NS*
+
+ Fields: ~
+ • {name} (`string`)
+ • {opts} (`vim.diagnostic.Opts`) See |vim.diagnostic.Opts|.
+ • {user_data} (`table`)
+ • {disabled}? (`boolean`)
+
+*vim.diagnostic.Opts*
+ Each of the configuration options below accepts one of the following:
+ • `false`: Disable this feature
+ • `true`: Enable this feature, use default settings.
+ • `table`: Enable this feature with overrides. Use an empty table to use
+ default values.
+ • `function`: Function with signature (namespace, bufnr) that returns any
+ of the above.
+
+ Fields: ~
+ • {underline}? (`boolean|vim.diagnostic.Opts.Underline|fun(namespace: integer, bufnr:integer): vim.diagnostic.Opts.Underline`, default: `true`)
+ Use underline for diagnostics.
+ • {virtual_text}? (`boolean|vim.diagnostic.Opts.VirtualText|fun(namespace: integer, bufnr:integer): vim.diagnostic.Opts.VirtualText`, default: `true`)
+ Use virtual text for diagnostics. If multiple
+ diagnostics are set for a namespace, one prefix
+ per diagnostic + the last diagnostic message are
+ shown.
+ • {signs}? (`boolean|vim.diagnostic.Opts.Signs|fun(namespace: integer, bufnr:integer): vim.diagnostic.Opts.Signs`, default: `true`)
+ Use signs for diagnostics |diagnostic-signs|.
+ • {float}? (`boolean|vim.diagnostic.Opts.Float|fun(namespace: integer, bufnr:integer): vim.diagnostic.Opts.Float`)
+ Options for floating windows. See
+ |vim.diagnostic.Opts.Float|.
+ • {update_in_insert}? (`boolean`, default: `false`) Update diagnostics
+ in Insert mode (if `false`, diagnostics are
+ updated on |InsertLeave|)
+ • {severity_sort}? (`boolean|{reverse?:boolean}`, default: `false)
+ Sort diagnostics by severity. This affects the
+ order in which signs and virtual text are
+ displayed. When true, higher severities are
+ displayed before lower severities (e.g. ERROR is
+ displayed before WARN). Options:
+ • {reverse}? (boolean) Reverse sort order
+
+*vim.diagnostic.Opts.Float*
+
+ Fields: ~
+ • {bufnr}? (`integer`, default: current buffer) Buffer number
+ to show diagnostics from.
+ • {namespace}? (`integer`) Limit diagnostics to the given namespace
+ • {scope}? (`'line'|'buffer'|'cursor'|'c'|'l'|'b'`, default:
+ `line`) Show diagnostics from the whole buffer
+ (`buffer"`, the current cursor line (`line`), or the
+ current cursor position (`cursor`). Shorthand
+ versions are also accepted (`c` for `cursor`, `l`
+ for `line`, `b` for `buffer`).
+ • {pos}? (`integer|{[1]:integer,[2]:integer}`) If {scope} is
+ "line" or "cursor", use this position rather than
+ the cursor position. If a number, interpreted as a
+ line number; otherwise, a (row, col) tuple.
+ • {severity_sort}? (`boolean|{reverse?:boolean}`, default: `false`)
+ Sort diagnostics by severity. Overrides the setting
+ from |vim.diagnostic.config()|.
+ • {severity}? (`vim.diagnostic.SeverityFilter`) See
+ |diagnostic-severity|. Overrides the setting from
+ |vim.diagnostic.config()|.
+ • {header}? (`string|{[1]:string,[2]:any}`) String to use as the
+ header for the floating window. If a table, it is
+ interpreted as a `[text, hl_group]` tuple. Overrides
+ the setting from |vim.diagnostic.config()|.
+ • {source}? (`boolean|'if_many'`) Include the diagnostic source
+ in the message. Use "if_many" to only show sources
+ if there is more than one source of diagnostics in
+ the buffer. Otherwise, any truthy value means to
+ always show the diagnostic source. Overrides the
+ setting from |vim.diagnostic.config()|.
+ • {format}? (`fun(diagnostic:vim.Diagnostic): string`) A
+ function that takes a diagnostic as input and
+ returns a string. The return value is the text used
+ to display the diagnostic. Overrides the setting
+ from |vim.diagnostic.config()|.
+ • {prefix}? (`string|table|(fun(diagnostic:vim.Diagnostic,i:integer,total:integer): string, string)`)
+ Prefix each diagnostic in the floating window:
+ • If a `function`, {i} is the index of the
+ diagnostic being evaluated and {total} is the
+ total number of diagnostics displayed in the
+ window. The function should return a `string`
+ which is prepended to each diagnostic in the
+ window as well as an (optional) highlight group
+ which will be used to highlight the prefix.
+ • If a `table`, it is interpreted as a
+ `[text, hl_group]` tuple as in |nvim_echo()|
+ • If a `string`, it is prepended to each diagnostic
+ in the window with no highlight. Overrides the
+ setting from |vim.diagnostic.config()|.
+ • {suffix}? (`string|table|(fun(diagnostic:vim.Diagnostic,i:integer,total:integer): string, string)`)
+ Same as {prefix}, but appends the text to the
+ diagnostic instead of prepending it. Overrides the
+ setting from |vim.diagnostic.config()|.
+ • {focus_id}? (`string`)
+
+*vim.diagnostic.Opts.Signs*
+
+ Fields: ~
+ • {severity}? (`vim.diagnostic.SeverityFilter`) Only show virtual text
+ for diagnostics matching the given severity
+ |diagnostic-severity|
+ • {priority}? (`integer`, default: `10`) Base priority to use for
+ signs. When {severity_sort} is used, the priority of a
+ sign is adjusted based on its severity. Otherwise, all
+ signs use the same priority.
+ • {text}? (`table<vim.diagnostic.Severity,string>`) A table mapping
+ |diagnostic-severity| to the sign text to display in the
+ sign column. The default is to use `"E"`, `"W"`, `"I"`,
+ and `"H"` for errors, warnings, information, and hints,
+ respectively. Example: >lua
+ vim.diagnostic.config({
+ signs = { text = { [vim.diagnostic.severity.ERROR] = 'E', ... } }
+ })
+<
+ • {numhl}? (`table<vim.diagnostic.Severity,string>`) A table mapping
+ |diagnostic-severity| to the highlight group used for the
+ line number where the sign is placed.
+ • {linehl}? (`table<vim.diagnostic.Severity,string>`) A table mapping
+ |diagnostic-severity| to the highlight group used for the
+ whole line the sign is placed in.
+
+*vim.diagnostic.Opts.Underline*
+
+ Fields: ~
+ • {severity}? (`vim.diagnostic.SeverityFilter`) Only underline
+ diagnostics matching the given severity
+ |diagnostic-severity|.
+
+*vim.diagnostic.Opts.VirtualText*
+
+ Fields: ~
+ • {severity}? (`vim.diagnostic.SeverityFilter`) Only show
+ virtual text for diagnostics matching the given
+ severity |diagnostic-severity|
+ • {source}? (`boolean|"if_many"`) Include the diagnostic
+ source in virtual text. Use `'if_many'` to only
+ show sources if there is more than one
+ diagnostic source in the buffer. Otherwise, any
+ truthy value means to always show the diagnostic
+ source.
+ • {spacing}? (`integer`) Amount of empty spaces inserted at
+ the beginning of the virtual text.
+ • {prefix}? (`string|(fun(diagnostic:vim.Diagnostic,i:integer,total:integer): string)`)
+ Prepend diagnostic message with prefix. If a
+ `function`, {i} is the index of the diagnostic
+ being evaluated, and {total} is the total number
+ of diagnostics for the line. This can be used to
+ render diagnostic symbols or error codes.
+ • {suffix}? (`string|(fun(diagnostic:vim.Diagnostic): string)`)
+ Append diagnostic message with suffix. This can
+ be used to render an LSP diagnostic error code.
+ • {format}? (`fun(diagnostic:vim.Diagnostic): string`) The
+ return value is the text used to display the
+ diagnostic. Example: >lua
+ function(diagnostic)
+ if diagnostic.severity == vim.diagnostic.severity.ERROR then
+ return string.format("E: %s", diagnostic.message)
+ end
+ return diagnostic.message
+ end
+<
+ • {hl_mode}? (`'replace'|'combine'|'blend'`) See
+ |nvim_buf_set_extmark()|.
+ • {virt_text}? (`{[1]:string,[2]:any}[]`) See
+ |nvim_buf_set_extmark()|.
+ • {virt_text_pos}? (`'eol'|'overlay'|'right_align'|'inline'`) See
+ |nvim_buf_set_extmark()|.
+ • {virt_text_win_col}? (`integer`) See |nvim_buf_set_extmark()|.
+ • {virt_text_hide}? (`boolean`) See |nvim_buf_set_extmark()|.
+
+
config({opts}, {namespace}) *vim.diagnostic.config()*
Configure diagnostic options globally or for a specific diagnostic
namespace.
@@ -368,115 +592,56 @@ config({opts}, {namespace}) *vim.diagnostic.config()*
then virtual text will not be enabled for those diagnostics.
- Note: ~
- • Each of the configuration options below accepts one of the following:
- • `false`: Disable this feature
- • `true`: Enable this feature, use default settings.
- • `table`: Enable this feature with overrides. Use an empty table to
- use default values.
- • `function`: Function with signature (namespace, bufnr) that returns
- any of the above.
+ Parameters: ~
+ • {opts} (`vim.diagnostic.Opts?`) When omitted or `nil`, retrieve
+ the current configuration. Otherwise, a configuration
+ table (see |vim.diagnostic.Opts|).
+ • {namespace} (`integer?`) Update the options for the given namespace.
+ When omitted, update the global diagnostic options.
+
+ Return: ~
+ (`vim.diagnostic.Opts?`) Current diagnostic config if {opts} is
+ omitted. See |vim.diagnostic.Opts|.
+
+count({bufnr}, {opts}) *vim.diagnostic.count()*
+ Get current diagnostics count.
Parameters: ~
- • {opts} (table|nil) When omitted or "nil", retrieve the current
- configuration. Otherwise, a configuration table with the
- following keys:
- • underline: (default true) Use underline for
- diagnostics. Options:
- • severity: Only underline diagnostics matching the
- given severity |diagnostic-severity|
-
- • virtual_text: (default true) Use virtual text for
- diagnostics. If multiple diagnostics are set for a
- namespace, one prefix per diagnostic + the last
- diagnostic message are shown. In addition to the
- options listed below, the "virt_text" options of
- |nvim_buf_set_extmark()| may also be used here (e.g.
- "virt_text_pos" and "hl_mode"). Options:
- • severity: Only show virtual text for diagnostics
- matching the given severity |diagnostic-severity|
- • source: (boolean or string) Include the diagnostic
- source in virtual text. Use "if_many" to only show
- sources if there is more than one diagnostic source
- in the buffer. Otherwise, any truthy value means to
- always show the diagnostic source.
- • spacing: (number) Amount of empty spaces inserted at
- the beginning of the virtual text.
- • prefix: (string or function) prepend diagnostic
- message with prefix. If a function, it must have the
- signature (diagnostic, i, total) -> string, where
- {diagnostic} is of type |diagnostic-structure|, {i}
- is the index of the diagnostic being evaluated, and
- {total} is the total number of diagnostics for the
- line. This can be used to render diagnostic symbols
- or error codes.
- • suffix: (string or function) Append diagnostic
- message with suffix. If a function, it must have the
- signature (diagnostic) -> string, where {diagnostic}
- is of type |diagnostic-structure|. This can be used
- to render an LSP diagnostic error code.
- • format: (function) A function that takes a diagnostic
- as input and returns a string. The return value is
- the text used to display the diagnostic. Example: >lua
-
- function(diagnostic)
- if diagnostic.severity == vim.diagnostic.severity.ERROR then
- return string.format("E: %s", diagnostic.message)
- end
- return diagnostic.message
- end
-<
+ • {bufnr} (`integer?`) Buffer number to get diagnostics from. Use 0 for
+ current buffer or nil for all buffers.
+ • {opts} (`vim.diagnostic.GetOpts?`) See |vim.diagnostic.GetOpts|.
- • signs: (default true) Use signs for diagnostics.
- Options:
- • severity: Only show signs for diagnostics matching
- the given severity |diagnostic-severity|
- • priority: (number, default 10) Base priority to use
- for signs. When {severity_sort} is used, the priority
- of a sign is adjusted based on its severity.
- Otherwise, all signs use the same priority.
-
- • float: Options for floating windows. See
- |vim.diagnostic.open_float()|.
- • update_in_insert: (default false) Update diagnostics in
- Insert mode (if false, diagnostics are updated on
- InsertLeave)
- • severity_sort: (default false) Sort diagnostics by
- severity. This affects the order in which signs and
- virtual text are displayed. When true, higher
- severities are displayed before lower severities (e.g.
- ERROR is displayed before WARN). Options:
- • reverse: (boolean) Reverse sort order
- • {namespace} (integer|nil) Update the options for the given namespace.
- When omitted, update the global diagnostic options.
+ Return: ~
+ (`table`) Table with actually present severity values as keys (see
+ |diagnostic-severity|) and integer counts as values.
disable({bufnr}, {namespace}) *vim.diagnostic.disable()*
Disable diagnostics in the given buffer.
Parameters: ~
- • {bufnr} (integer|nil) Buffer number, or 0 for current buffer.
- When omitted, disable diagnostics in all buffers.
- • {namespace} (integer|nil) Only disable diagnostics for the given
+ • {bufnr} (`integer?`) Buffer number, or 0 for current buffer. When
+ omitted, disable diagnostics in all buffers.
+ • {namespace} (`integer?`) Only disable diagnostics for the given
namespace.
enable({bufnr}, {namespace}) *vim.diagnostic.enable()*
Enable diagnostics in the given buffer.
Parameters: ~
- • {bufnr} (integer|nil) Buffer number, or 0 for current buffer.
- When omitted, enable diagnostics in all buffers.
- • {namespace} (integer|nil) Only enable diagnostics for the given
+ • {bufnr} (`integer?`) Buffer number, or 0 for current buffer. When
+ omitted, enable diagnostics in all buffers.
+ • {namespace} (`integer?`) Only enable diagnostics for the given
namespace.
fromqflist({list}) *vim.diagnostic.fromqflist()*
Convert a list of quickfix items to a list of diagnostics.
Parameters: ~
- • {list} table[] List of quickfix items from |getqflist()| or
+ • {list} (`table[]`) List of quickfix items from |getqflist()| or
|getloclist()|.
Return: ~
- Diagnostic [] array of |diagnostic-structure|
+ (`vim.Diagnostic[]`) See |vim.Diagnostic|.
get({bufnr}, {opts}) *vim.diagnostic.get()*
Get current diagnostics.
@@ -485,96 +650,79 @@ get({bufnr}, {opts}) *vim.diagnostic.get()*
diagnostics in a buffer, use |vim.diagnostic.set()|.
Parameters: ~
- • {bufnr} (integer|nil) Buffer number to get diagnostics from. Use 0
- for current buffer or nil for all buffers.
- • {opts} (table|nil) A table with the following keys:
- • namespace: (number) Limit diagnostics to the given
- namespace.
- • lnum: (number) Limit diagnostics to the given line number.
- • severity: See |diagnostic-severity|.
+ • {bufnr} (`integer?`) Buffer number to get diagnostics from. Use 0 for
+ current buffer or nil for all buffers.
+ • {opts} (`vim.diagnostic.GetOpts?`) See |vim.diagnostic.GetOpts|.
Return: ~
- Diagnostic [] table A list of diagnostic items |diagnostic-structure|. Keys `bufnr` , `end_lnum` , `end_col` , and `severity` are guaranteed to be present.
+ (`vim.Diagnostic[]`) Fields `bufnr`, `end_lnum`, `end_col`, and
+ `severity` are guaranteed to be present. See |vim.Diagnostic|.
get_namespace({namespace}) *vim.diagnostic.get_namespace()*
Get namespace metadata.
Parameters: ~
- • {namespace} (integer) Diagnostic namespace
+ • {namespace} (`integer`) Diagnostic namespace
Return: ~
- (table) Namespace metadata
+ (`vim.diagnostic.NS`) Namespace metadata. See |vim.diagnostic.NS|.
get_namespaces() *vim.diagnostic.get_namespaces()*
Get current diagnostic namespaces.
Return: ~
- (table) A list of active diagnostic namespaces |vim.diagnostic|.
+ (`table<integer,vim.diagnostic.NS>`) List of active diagnostic
+ namespaces |vim.diagnostic|.
get_next({opts}) *vim.diagnostic.get_next()*
Get the next diagnostic closest to the cursor position.
Parameters: ~
- • {opts} (table|nil) See |vim.diagnostic.goto_next()|
+ • {opts} (`vim.diagnostic.GotoOpts?`) See |vim.diagnostic.GotoOpts|.
Return: ~
- Diagnostic|nil Next diagnostic
+ (`vim.Diagnostic?`) Next diagnostic. See |vim.Diagnostic|.
get_next_pos({opts}) *vim.diagnostic.get_next_pos()*
Return the position of the next diagnostic in the current buffer.
Parameters: ~
- • {opts} (table|nil) See |vim.diagnostic.goto_next()|
+ • {opts} (`vim.diagnostic.GotoOpts?`) See |vim.diagnostic.GotoOpts|.
Return: ~
- table|false Next diagnostic position as a (row, col) tuple or false if
- no next diagnostic.
+ (`table|false`) Next diagnostic position as a `(row, col)` tuple or
+ false if no next diagnostic.
get_prev({opts}) *vim.diagnostic.get_prev()*
Get the previous diagnostic closest to the cursor position.
Parameters: ~
- • {opts} nil|table See |vim.diagnostic.goto_next()|
+ • {opts} (`vim.diagnostic.GotoOpts?`) See |vim.diagnostic.GotoOpts|.
Return: ~
- Diagnostic|nil Previous diagnostic
+ (`vim.Diagnostic?`) Previous diagnostic. See |vim.Diagnostic|.
get_prev_pos({opts}) *vim.diagnostic.get_prev_pos()*
Return the position of the previous diagnostic in the current buffer.
Parameters: ~
- • {opts} (table|nil) See |vim.diagnostic.goto_next()|
+ • {opts} (`vim.diagnostic.GotoOpts?`) See |vim.diagnostic.GotoOpts|.
Return: ~
- table|false Previous diagnostic position as a (row, col) tuple or
- false if there is no prior diagnostic
+ (`table|false`) Previous diagnostic position as a `(row, col)` tuple
+ or `false` if there is no prior diagnostic.
goto_next({opts}) *vim.diagnostic.goto_next()*
Move to the next diagnostic.
Parameters: ~
- • {opts} (table|nil) Configuration table with the following keys:
- • namespace: (number) Only consider diagnostics from the given
- namespace.
- • cursor_position: (cursor position) Cursor position as a
- (row, col) tuple. See |nvim_win_get_cursor()|. Defaults to
- the current cursor position.
- • wrap: (boolean, default true) Whether to loop around file or
- not. Similar to 'wrapscan'.
- • severity: See |diagnostic-severity|.
- • float: (boolean or table, default true) If "true", call
- |vim.diagnostic.open_float()| after moving. If a table, pass
- the table as the {opts} parameter to
- |vim.diagnostic.open_float()|. Unless overridden, the float
- will show diagnostics at the new cursor position (as if
- "cursor" were passed to the "scope" option).
- • win_id: (number, default 0) Window ID
+ • {opts} (`vim.diagnostic.GotoOpts?`) See |vim.diagnostic.GotoOpts|.
goto_prev({opts}) *vim.diagnostic.goto_prev()*
Move to the previous diagnostic in the current buffer.
Parameters: ~
- • {opts} (table|nil) See |vim.diagnostic.goto_next()|
+ • {opts} (`vim.diagnostic.GotoOpts?`) See |vim.diagnostic.GotoOpts|.
hide({namespace}, {bufnr}) *vim.diagnostic.hide()*
Hide currently displayed diagnostics.
@@ -587,22 +735,22 @@ hide({namespace}, {bufnr}) *vim.diagnostic.hide()*
|vim.diagnostic.disable()|.
Parameters: ~
- • {namespace} (integer|nil) Diagnostic namespace. When omitted, hide diagnostics from all
- namespaces.
- • {bufnr} (integer|nil) Buffer number, or 0 for current buffer.
- When omitted, hide diagnostics in all buffers.
+ • {namespace} (`integer?`) Diagnostic namespace. When omitted, hide
+ diagnostics from all namespaces.
+ • {bufnr} (`integer?`) Buffer number, or 0 for current buffer. When
+ omitted, hide diagnostics in all buffers.
is_disabled({bufnr}, {namespace}) *vim.diagnostic.is_disabled()*
Check whether diagnostics are disabled in a given buffer.
Parameters: ~
- • {bufnr} (integer|nil) Buffer number, or 0 for current buffer.
- • {namespace} (integer|nil) Diagnostic namespace. When omitted, checks if all diagnostics are
- disabled in {bufnr}. Otherwise, only checks if
- diagnostics from {namespace} are disabled.
+ • {bufnr} (`integer?`) Buffer number, or 0 for current buffer.
+ • {namespace} (`integer?`) Diagnostic namespace. When omitted, checks
+ if all diagnostics are disabled in {bufnr}. Otherwise,
+ only checks if diagnostics from {namespace} are disabled.
Return: ~
- (boolean)
+ (`boolean`)
*vim.diagnostic.match()*
match({str}, {pat}, {groups}, {severity_map}, {defaults})
@@ -612,7 +760,7 @@ match({str}, {pat}, {groups}, {severity_map}, {defaults})
WARNING filename:27:3: Variable 'foo' does not exist
<
- This can be parsed into a diagnostic |diagnostic-structure| with: >lua
+ This can be parsed into |vim.Diagnostic| structure with: >lua
local s = "WARNING filename:27:3: Variable 'foo' does not exist"
local pattern = "^(%w+) %w+:(%d+):(%d+): (.+)$"
local groups = { "severity", "lnum", "col", "message" }
@@ -620,75 +768,30 @@ match({str}, {pat}, {groups}, {severity_map}, {defaults})
<
Parameters: ~
- • {str} (string) String to parse diagnostics from.
- • {pat} (string) Lua pattern with capture groups.
- • {groups} (table) List of fields in a |diagnostic-structure| to
- associate with captures from {pat}.
- • {severity_map} (table) A table mapping the severity field from
+ • {str} (`string`) String to parse diagnostics from.
+ • {pat} (`string`) Lua pattern with capture groups.
+ • {groups} (`string[]`) List of fields in a |vim.Diagnostic|
+ structure to associate with captures from {pat}.
+ • {severity_map} (`table`) A table mapping the severity field from
{groups} with an item from |vim.diagnostic.severity|.
- • {defaults} (table|nil) Table of default values for any fields not
+ • {defaults} (`table?`) Table of default values for any fields not
listed in {groups}. When omitted, numeric values
default to 0 and "severity" defaults to ERROR.
Return: ~
- Diagnostic|nil: |diagnostic-structure| or `nil` if {pat} fails to
- match {str}.
+ (`vim.Diagnostic?`) |vim.Diagnostic| structure or `nil` if {pat} fails
+ to match {str}.
-open_float({opts}, {...}) *vim.diagnostic.open_float()*
+open_float({opts}) *vim.diagnostic.open_float()*
Show diagnostics in a floating window.
Parameters: ~
- • {opts} (table|nil) Configuration table with the same keys as
- |vim.lsp.util.open_floating_preview()| in addition to the
- following:
- • bufnr: (number) Buffer number to show diagnostics from.
- Defaults to the current buffer.
- • namespace: (number) Limit diagnostics to the given namespace
- • scope: (string, default "line") Show diagnostics from the
- whole buffer ("buffer"), the current cursor line ("line"),
- or the current cursor position ("cursor"). Shorthand
- versions are also accepted ("c" for "cursor", "l" for
- "line", "b" for "buffer").
- • pos: (number or table) If {scope} is "line" or "cursor", use
- this position rather than the cursor position. If a number,
- interpreted as a line number; otherwise, a (row, col) tuple.
- • severity_sort: (default false) Sort diagnostics by severity.
- Overrides the setting from |vim.diagnostic.config()|.
- • severity: See |diagnostic-severity|. Overrides the setting
- from |vim.diagnostic.config()|.
- • header: (string or table) String to use as the header for
- the floating window. If a table, it is interpreted as a
- [text, hl_group] tuple. Overrides the setting from
- |vim.diagnostic.config()|.
- • source: (boolean or string) Include the diagnostic source in
- the message. Use "if_many" to only show sources if there is
- more than one source of diagnostics in the buffer.
- Otherwise, any truthy value means to always show the
- diagnostic source. Overrides the setting from
- |vim.diagnostic.config()|.
- • format: (function) A function that takes a diagnostic as
- input and returns a string. The return value is the text
- used to display the diagnostic. Overrides the setting from
- |vim.diagnostic.config()|.
- • prefix: (function, string, or table) Prefix each diagnostic
- in the floating window. If a function, it must have the
- signature (diagnostic, i, total) -> (string, string), where
- {i} is the index of the diagnostic being evaluated and
- {total} is the total number of diagnostics displayed in the
- window. The function should return a string which is
- prepended to each diagnostic in the window as well as an
- (optional) highlight group which will be used to highlight
- the prefix. If {prefix} is a table, it is interpreted as a
- [text, hl_group] tuple as in |nvim_echo()|; otherwise, if
- {prefix} is a string, it is prepended to each diagnostic in
- the window with no highlight. Overrides the setting from
- |vim.diagnostic.config()|.
- • suffix: Same as {prefix}, but appends the text to the
- diagnostic instead of prepending it. Overrides the setting
- from |vim.diagnostic.config()|.
+ • {opts} (`vim.diagnostic.Opts.Float?`) See
+ |vim.diagnostic.Opts.Float|.
- Return: ~
- integer|nil, integer|nil: ({float_bufnr}, {win_id})
+ Return (multiple): ~
+ (`integer?`) float_bufnr
+ (`integer?`) win_id
reset({namespace}, {bufnr}) *vim.diagnostic.reset()*
Remove all diagnostics from the given namespace.
@@ -699,76 +802,78 @@ reset({namespace}, {bufnr}) *vim.diagnostic.reset()*
re-displayed, use |vim.diagnostic.hide()|.
Parameters: ~
- • {namespace} (integer|nil) Diagnostic namespace. When omitted, remove diagnostics from all
- namespaces.
- • {bufnr} (integer|nil) Remove diagnostics for the given buffer.
+ • {namespace} (`integer?`) Diagnostic namespace. When omitted, remove
+ diagnostics from all namespaces.
+ • {bufnr} (`integer?`) Remove diagnostics for the given buffer.
When omitted, diagnostics are removed for all buffers.
set({namespace}, {bufnr}, {diagnostics}, {opts}) *vim.diagnostic.set()*
Set diagnostics for the given namespace and buffer.
Parameters: ~
- • {namespace} (integer) The diagnostic namespace
- • {bufnr} (integer) Buffer number
- • {diagnostics} (table) A list of diagnostic items
- |diagnostic-structure|
- • {opts} (table|nil) Display options to pass to
- |vim.diagnostic.show()|
+ • {namespace} (`integer`) The diagnostic namespace
+ • {bufnr} (`integer`) Buffer number
+ • {diagnostics} (`vim.Diagnostic[]`) See |vim.Diagnostic|.
+ • {opts} (`vim.diagnostic.Opts?`) Display options to pass to
+ |vim.diagnostic.show()|. See |vim.diagnostic.Opts|.
setloclist({opts}) *vim.diagnostic.setloclist()*
Add buffer diagnostics to the location list.
Parameters: ~
- • {opts} (table|nil) Configuration table with the following keys:
- • namespace: (number) Only add diagnostics from the given
+ • {opts} (`table?`) Configuration table with the following keys:
+ • {namespace}? (`integer`) Only add diagnostics from the given
namespace.
- • winnr: (number, default 0) Window number to set location
- list for.
- • open: (boolean, default true) Open the location list after
- setting.
- • title: (string) Title of the location list. Defaults to
+ • {winnr}? (`integer`, default: `0`) Window number to set
+ location list for.
+ • {open}? (`boolean`, default: `true`) Open the location list
+ after setting.
+ • {title}? (`string`) Title of the location list. Defaults to
"Diagnostics".
- • severity: See |diagnostic-severity|.
+ • {severity}? (`vim.diagnostic.Severity`) See
+ |diagnostic-severity|.
setqflist({opts}) *vim.diagnostic.setqflist()*
Add all diagnostics to the quickfix list.
Parameters: ~
- • {opts} (table|nil) Configuration table with the following keys:
- • namespace: (number) Only add diagnostics from the given
+ • {opts} (`table?`) Configuration table with the following keys:
+ • {namespace}? (`integer`) Only add diagnostics from the given
namespace.
- • open: (boolean, default true) Open quickfix list after
- setting.
- • title: (string) Title of quickfix list. Defaults to
+ • {open}? (`boolean`, default: `true`) Open quickfix list
+ after setting.
+ • {title}? (`string`) Title of quickfix list. Defaults to
"Diagnostics".
- • severity: See |diagnostic-severity|.
+ • {severity}? (`vim.diagnostic.Severity`) See
+ |diagnostic-severity|.
*vim.diagnostic.show()*
show({namespace}, {bufnr}, {diagnostics}, {opts})
Display diagnostics for the given namespace and buffer.
Parameters: ~
- • {namespace} (integer|nil) Diagnostic namespace. When omitted, show diagnostics from all
- namespaces.
- • {bufnr} (integer|nil) Buffer number, or 0 for current buffer.
+ • {namespace} (`integer?`) Diagnostic namespace. When omitted, show
+ diagnostics from all namespaces.
+ • {bufnr} (`integer?`) Buffer number, or 0 for current buffer.
When omitted, show diagnostics in all buffers.
- • {diagnostics} (table|nil) The diagnostics to display. When omitted,
- use the saved diagnostics for the given namespace and
- buffer. This can be used to display a list of
- diagnostics without saving them or to display only a
- subset of diagnostics. May not be used when {namespace}
- or {bufnr} is nil.
- • {opts} (table|nil) Display options. See
- |vim.diagnostic.config()|.
+ • {diagnostics} (`vim.Diagnostic[]?`) The diagnostics to display. When
+ omitted, use the saved diagnostics for the given
+ namespace and buffer. This can be used to display a
+ list of diagnostics without saving them or to display
+ only a subset of diagnostics. May not be used when
+ {namespace} or {bufnr} is nil. See |vim.Diagnostic|.
+ • {opts} (`vim.diagnostic.Opts?`) Display options. See
+ |vim.diagnostic.Opts|.
toqflist({diagnostics}) *vim.diagnostic.toqflist()*
Convert a list of diagnostics to a list of quickfix items that can be
passed to |setqflist()| or |setloclist()|.
Parameters: ~
- • {diagnostics} (table) List of diagnostics |diagnostic-structure|.
+ • {diagnostics} (`vim.Diagnostic[]`) See |vim.Diagnostic|.
Return: ~
- table[] of quickfix list items |setqflist-what|
+ (`table[]`) Quickfix list items |setqflist-what|
+
vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl:
diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt
index 7df2eb9742..1a4572e94a 100644
--- a/runtime/doc/editing.txt
+++ b/runtime/doc/editing.txt
@@ -1291,8 +1291,9 @@ b:browsefilter variable. You would most likely set b:browsefilter in a
filetype plugin, so that the browse dialog would contain entries related to
the type of file you are currently editing. Disadvantage: This makes it
difficult to start editing a file of a different type. To overcome this, you
-may want to add "All Files\t*.*\n" as the final filter, so that the user can
-still access any desired file.
+may want to add "All Files (*.*)\t*\n" as the final filter on Windows or "All
+Files (*)\t*\n" on other platforms, so that the user can still access any
+desired file.
To avoid setting browsefilter when Vim does not actually support it, you can
use has("browsefilter"): >
diff --git a/runtime/doc/editorconfig.txt b/runtime/doc/editorconfig.txt
index 7c6e8fb95f..a2281a7b7c 100644
--- a/runtime/doc/editorconfig.txt
+++ b/runtime/doc/editorconfig.txt
@@ -49,6 +49,8 @@ indent_size A number indicating the size of a single indent.
Alternatively, use the value "tab" to use the value of
the tab_width property. Sets the 'shiftwidth' and
'softtabstop' options.
+ If this value is not "tab" and the tab_width property
+ is not set, 'tabstop' is also set to this value.
*editorconfig_insert_final_newline*
insert_final_newline "true" or "false" to ensure the file always has a
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index a73932be00..ef416fe56f 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -252,10 +252,15 @@ List concatenation ~
*list-concatenation*
Two lists can be concatenated with the "+" operator: >
:let longlist = mylist + [5, 6]
- :let mylist += [7, 8]
+ :let longlist = [5, 6] + mylist
+To prepend or append an item, turn it into a list by putting [] around it.
-To prepend or append an item, turn the item into a list by putting [] around
-it. To change a list in-place, refer to |list-modification| below.
+A list can be concatenated with another one in-place using |:let+=| or
+|extend()|: >
+ :let mylist += [7, 8]
+ :call extend(mylist, [7, 8])
+<
+See |list-modification| below for more about changing a list in-place.
Sublist ~
@@ -374,6 +379,18 @@ To change part of a list you can specify the first and last item to be
modified. The value must at least have the number of items in the range: >
:let list[3:5] = [3, 4, 5]
+To add items to a List in-place, you can use |:let+=| (|list-concatenation|): >
+ :let listA = [1, 2]
+ :let listA += [3, 4]
+<
+When two variables refer to the same List, changing one List in-place will
+cause the referenced List to be changed in-place: >
+ :let listA = [1, 2]
+ :let listB = listA
+ :let listB += [3, 4]
+ :echo listA
+ [1, 2, 3, 4]
+<
Adding and removing items from a list is done with functions. Here are a few
examples: >
:call insert(list, 'a') " prepend item 'a'
@@ -682,12 +699,15 @@ This calls Doit() with 0x11, 0x22 and 0x33.
Blob concatenation ~
-
+ *blob-concatenation*
Two blobs can be concatenated with the "+" operator: >
:let longblob = myblob + 0z4455
+ :let longblob = 0z4455 + myblob
+<
+A blob can be concatenated with another one in-place using |:let+=|: >
:let myblob += 0z6677
-
-To change a blob in-place see |blob-modification| below.
+<
+See |blob-modification| below for more about changing a blob in-place.
Part of a blob ~
@@ -730,6 +750,18 @@ To change part of a blob you can specify the first and last byte to be
modified. The value must have the same number of bytes in the range: >
:let blob[3:5] = 0z334455
+To add items to a Blob in-place, you can use |:let+=| (|blob-concatenation|): >
+ :let blobA = 0z1122
+ :let blobA += 0z3344
+<
+When two variables refer to the same Blob, changing one Blob in-place will
+cause the referenced Blob to be changed in-place: >
+ :let blobA = 0z1122
+ :let blobB = blobA
+ :let blobB += 0z3344
+ :echo blobA
+ 0z11223344
+<
You can also use the functions |add()|, |remove()| and |insert()|.
@@ -1765,624 +1797,9 @@ variables for each buffer. Use local buffer variables instead |b:var|.
PREDEFINED VIM VARIABLES *vim-variable* *v:var* *v:*
*E963*
-Some variables can be set by the user, but the type cannot be changed.
-
- *v:argv* *argv-variable*
-v:argv The command line arguments Vim was invoked with. This is a
- list of strings. The first item is the Vim command.
- See |v:progpath| for the command with full path.
-
- *v:char* *char-variable*
-v:char Argument for evaluating 'formatexpr' and used for the typed
- character when using <expr> in an abbreviation |:map-<expr>|.
- It is also used by the |InsertCharPre| and |InsertEnter| events.
-
- *v:charconvert_from* *charconvert_from-variable*
-v:charconvert_from
- The name of the character encoding of a file to be converted.
- Only valid while evaluating the 'charconvert' option.
-
- *v:charconvert_to* *charconvert_to-variable*
-v:charconvert_to
- The name of the character encoding of a file after conversion.
- Only valid while evaluating the 'charconvert' option.
-
- *v:cmdarg* *cmdarg-variable*
-v:cmdarg
- The extra arguments ("++p", "++enc=", "++ff=") given to a file
- read/write command. This is set before an autocommand event
- for a file read/write command is triggered. There is a
- leading space to make it possible to append this variable
- directly after the read/write command. Note: "+cmd" isn't
- included here, because it will be executed anyway.
-
- *v:collate* *collate-variable*
-v:collate The current locale setting for collation order of the runtime
- environment. This allows Vim scripts to be aware of the
- current locale encoding. Technical: it's the value of
- LC_COLLATE. When not using a locale the value is "C".
- This variable can not be set directly, use the |:language|
- command.
- See |multi-lang|.
-
- *v:cmdbang* *cmdbang-variable*
-v:cmdbang Set like v:cmdarg for a file read/write command. When a "!"
- was used the value is 1, otherwise it is 0. Note that this
- can only be used in autocommands. For user commands |<bang>|
- can be used.
-
- *v:completed_item* *completed_item-variable*
-v:completed_item
- Dictionary containing the most recent |complete-items| after
- |CompleteDone|. Empty if the completion failed, or after
- leaving and re-entering insert mode.
- Note: Plugins can modify the value to emulate the builtin
- |CompleteDone| event behavior.
-
- *v:count* *count-variable*
-v:count The count given for the last Normal mode command. Can be used
- to get the count before a mapping. Read-only. Example: >
- :map _x :<C-U>echo "the count is " .. v:count<CR>
-< Note: The <C-U> is required to remove the line range that you
- get when typing ':' after a count.
- When there are two counts, as in "3d2w", they are multiplied,
- just like what happens in the command, "d6w" for the example.
- Also used for evaluating the 'formatexpr' option.
-
- *v:count1* *count1-variable*
-v:count1 Just like "v:count", but defaults to one when no count is
- used.
-
- *v:ctype* *ctype-variable*
-v:ctype The current locale setting for characters of the runtime
- environment. This allows Vim scripts to be aware of the
- current locale encoding. Technical: it's the value of
- LC_CTYPE. When not using a locale the value is "C".
- This variable can not be set directly, use the |:language|
- command.
- See |multi-lang|.
-
- *v:dying* *dying-variable*
-v:dying Normally zero. When a deadly signal is caught it's set to
- one. When multiple signals are caught the number increases.
- Can be used in an autocommand to check if Vim didn't
- terminate normally.
- Example: >
- :au VimLeave * if v:dying | echo "\nAAAAaaaarrrggghhhh!!!\n" | endif
-< Note: if another deadly signal is caught when v:dying is one,
- VimLeave autocommands will not be executed.
-
- *v:exiting* *exiting-variable*
-v:exiting Exit code, or |v:null| before invoking the |VimLeavePre|
- and |VimLeave| autocmds. See |:q|, |:x| and |:cquit|.
- Example: >
- :au VimLeave * echo "Exit value is " .. v:exiting
-<
- *v:echospace* *echospace-variable*
-v:echospace Number of screen cells that can be used for an `:echo` message
- in the last screen line before causing the |hit-enter-prompt|.
- Depends on 'showcmd', 'ruler' and 'columns'. You need to
- check 'cmdheight' for whether there are full-width lines
- available above the last line.
-
- *v:errmsg* *errmsg-variable*
-v:errmsg Last given error message.
- Modifiable (can be set).
- Example: >
- :let v:errmsg = ""
- :silent! next
- :if v:errmsg != ""
- : ... handle error
-<
- *v:errors* *errors-variable* *assert-return*
-v:errors Errors found by assert functions, such as |assert_true()|.
- This is a list of strings.
- The assert functions append an item when an assert fails.
- The return value indicates this: a one is returned if an item
- was added to v:errors, otherwise zero is returned.
- To remove old results make it empty: >
- :let v:errors = []
-< If v:errors is set to anything but a list it is made an empty
- list by the assert function.
-
- *v:event* *event-variable*
-v:event Dictionary of event data for the current |autocommand|. Valid
- only during the event lifetime; storing or passing v:event is
- invalid! Copy it instead: >
- au TextYankPost * let g:foo = deepcopy(v:event)
-< Keys vary by event; see the documentation for the specific
- event, e.g. |DirChanged| or |TextYankPost|.
- KEY DESCRIPTION ~
- abort Whether the event triggered during
- an aborting condition (e.g. |c_Esc| or
- |c_CTRL-C| for |CmdlineLeave|).
- chan |channel-id|
- cmdlevel Level of cmdline.
- cmdtype Type of cmdline, |cmdline-char|.
- cwd Current working directory.
- inclusive Motion is |inclusive|, else exclusive.
- scope Event-specific scope name.
- operator Current |operator|. Also set for Ex
- commands (unlike |v:operator|). For
- example if |TextYankPost| is triggered
- by the |:yank| Ex command then
- `v:event.operator` is "y".
- regcontents Text stored in the register as a
- |readfile()|-style list of lines.
- regname Requested register (e.g "x" for "xyy)
- or the empty string for an unnamed
- operation.
- regtype Type of register as returned by
- |getregtype()|.
- visual Selection is visual (as opposed to,
- e.g., via motion).
- completed_item Current selected complete item on
- |CompleteChanged|, Is `{}` when no complete
- item selected.
- height Height of popup menu on |CompleteChanged|
- width width of popup menu on |CompleteChanged|
- row Row count of popup menu on |CompleteChanged|,
- relative to screen.
- col Col count of popup menu on |CompleteChanged|,
- relative to screen.
- size Total number of completion items on
- |CompleteChanged|.
- scrollbar Is |v:true| if popup menu have scrollbar, or
- |v:false| if not.
- changed_window Is |v:true| if the event fired while
- changing window (or tab) on |DirChanged|.
- status Job status or exit code, -1 means "unknown". |TermClose|
-
- *v:exception* *exception-variable*
-v:exception The value of the exception most recently caught and not
- finished. See also |v:throwpoint| and |throw-variables|.
- Example: >
- :try
- : throw "oops"
- :catch /.*/
- : echo "caught " .. v:exception
- :endtry
-< Output: "caught oops".
-
- *v:false* *false-variable*
-v:false Special value used to put "false" in JSON and msgpack. See
- |json_encode()|. This value is converted to "v:false" when used
- as a String (e.g. in |expr5| with string concatenation
- operator) and to zero when used as a Number (e.g. in |expr5|
- or |expr7| when used with numeric operators). Read-only.
-
- *v:fcs_reason* *fcs_reason-variable*
-v:fcs_reason The reason why the |FileChangedShell| event was triggered.
- Can be used in an autocommand to decide what to do and/or what
- to set v:fcs_choice to. Possible values:
- deleted file no longer exists
- conflict file contents, mode or timestamp was
- changed and buffer is modified
- changed file contents has changed
- mode mode of file changed
- time only file timestamp changed
-
- *v:fcs_choice* *fcs_choice-variable*
-v:fcs_choice What should happen after a |FileChangedShell| event was
- triggered. Can be used in an autocommand to tell Vim what to
- do with the affected buffer:
- reload Reload the buffer (does not work if
- the file was deleted).
- edit Reload the buffer and detect the
- values for options such as
- 'fileformat', 'fileencoding', 'binary'
- (does not work if the file was
- deleted).
- ask Ask the user what to do, as if there
- was no autocommand. Except that when
- only the timestamp changed nothing
- will happen.
- <empty> Nothing, the autocommand should do
- everything that needs to be done.
- The default is empty. If another (invalid) value is used then
- Vim behaves like it is empty, there is no warning message.
-
- *v:fname* *fname-variable*
-v:fname When evaluating 'includeexpr': the file name that was
- detected. Empty otherwise.
-
- *v:fname_in* *fname_in-variable*
-v:fname_in The name of the input file. Valid while evaluating:
- option used for ~
- 'charconvert' file to be converted
- 'diffexpr' original file
- 'patchexpr' original file
- And set to the swap file name for |SwapExists|.
-
- *v:fname_out* *fname_out-variable*
-v:fname_out The name of the output file. Only valid while
- evaluating:
- option used for ~
- 'charconvert' resulting converted file [1]
- 'diffexpr' output of diff
- 'patchexpr' resulting patched file
- [1] When doing conversion for a write command (e.g., ":w
- file") it will be equal to v:fname_in. When doing conversion
- for a read command (e.g., ":e file") it will be a temporary
- file and different from v:fname_in.
-
- *v:fname_new* *fname_new-variable*
-v:fname_new The name of the new version of the file. Only valid while
- evaluating 'diffexpr'.
-
- *v:fname_diff* *fname_diff-variable*
-v:fname_diff The name of the diff (patch) file. Only valid while
- evaluating 'patchexpr'.
-
- *v:folddashes* *folddashes-variable*
-v:folddashes Used for 'foldtext': dashes representing foldlevel of a closed
- fold.
- Read-only in the |sandbox|. |fold-foldtext|
-
- *v:foldlevel* *foldlevel-variable*
-v:foldlevel Used for 'foldtext': foldlevel of closed fold.
- Read-only in the |sandbox|. |fold-foldtext|
-
- *v:foldend* *foldend-variable*
-v:foldend Used for 'foldtext': last line of closed fold.
- Read-only in the |sandbox|. |fold-foldtext|
-
- *v:foldstart* *foldstart-variable*
-v:foldstart Used for 'foldtext': first line of closed fold.
- Read-only in the |sandbox|. |fold-foldtext|
-
- *v:hlsearch* *hlsearch-variable*
-v:hlsearch Variable that indicates whether search highlighting is on.
- Setting it makes sense only if 'hlsearch' is enabled. Setting
- this variable to zero acts like the |:nohlsearch| command,
- setting it to one acts like >
- let &hlsearch = &hlsearch
-< Note that the value is restored when returning from a
- function. |function-search-undo|.
-
- *v:insertmode* *insertmode-variable*
-v:insertmode Used for the |InsertEnter| and |InsertChange| autocommand
- events. Values:
- i Insert mode
- r Replace mode
- v Virtual Replace mode
-
- *v:key* *key-variable*
-v:key Key of the current item of a |Dictionary|. Only valid while
- evaluating the expression used with |map()| and |filter()|.
- Read-only.
-
- *v:lang* *lang-variable*
-v:lang The current locale setting for messages of the runtime
- environment. This allows Vim scripts to be aware of the
- current language. Technical: it's the value of LC_MESSAGES.
- The value is system dependent.
- This variable can not be set directly, use the |:language|
- command.
- It can be different from |v:ctype| when messages are desired
- in a different language than what is used for character
- encoding. See |multi-lang|.
-
- *v:lc_time* *lc_time-variable*
-v:lc_time The current locale setting for time messages of the runtime
- environment. This allows Vim scripts to be aware of the
- current language. Technical: it's the value of LC_TIME.
- This variable can not be set directly, use the |:language|
- command. See |multi-lang|.
-
- *v:lnum* *lnum-variable*
-v:lnum Line number for the 'foldexpr' |fold-expr|, 'formatexpr',
- 'indentexpr' and 'statuscolumn' expressions, tab page number
- for 'guitablabel' and 'guitabtooltip'. Only valid while one of
- these expressions is being evaluated. Read-only when in the
- |sandbox|.
-
- *v:lua* *lua-variable*
-v:lua Prefix for calling Lua functions from expressions.
- See |v:lua-call| for more information.
-
- *v:maxcol* *maxcol-variable*
-v:maxcol Maximum line length. Depending on where it is used it can be
- screen columns, characters or bytes. The value currently is
- 2147483647 on all systems.
-
- *v:mouse_win* *mouse_win-variable*
-v:mouse_win Window number for a mouse click obtained with |getchar()|.
- First window has number 1, like with |winnr()|. The value is
- zero when there was no mouse button click.
-
- *v:mouse_winid* *mouse_winid-variable*
-v:mouse_winid |window-ID| for a mouse click obtained with |getchar()|.
- The value is zero when there was no mouse button click.
-
- *v:mouse_lnum* *mouse_lnum-variable*
-v:mouse_lnum Line number for a mouse click obtained with |getchar()|.
- This is the text line number, not the screen line number. The
- value is zero when there was no mouse button click.
-
- *v:mouse_col* *mouse_col-variable*
-v:mouse_col Column number for a mouse click obtained with |getchar()|.
- This is the screen column number, like with |virtcol()|. The
- value is zero when there was no mouse button click.
-
- *v:msgpack_types* *msgpack_types-variable*
-v:msgpack_types Dictionary containing msgpack types used by |msgpackparse()|
- and |msgpackdump()|. All types inside dictionary are fixed
- (not editable) empty lists. To check whether some list is one
- of msgpack types, use |is| operator.
-
- *v:null* *null-variable*
-v:null Special value used to put "null" in JSON and NIL in msgpack.
- See |json_encode()|. This value is converted to "v:null" when
- used as a String (e.g. in |expr5| with string concatenation
- operator) and to zero when used as a Number (e.g. in |expr5|
- or |expr7| when used with numeric operators). Read-only.
- In some places `v:null` can be used for a List, Dict, etc.
- that is not set. That is slightly different than an empty
- List, Dict, etc.
-
- *v:numbermax* *numbermax-variable*
-v:numbermax Maximum value of a number.
-
- *v:numbermin* *numbermin-variable*
-v:numbermin Minimum value of a number (negative).
-
- *v:numbersize* *numbersize-variable*
-v:numbersize Number of bits in a Number. This is normally 64, but on some
- systems it may be 32.
-
- *v:oldfiles* *oldfiles-variable*
-v:oldfiles List of file names that is loaded from the |shada| file on
- startup. These are the files that Vim remembers marks for.
- The length of the List is limited by the ' argument of the
- 'shada' option (default is 100).
- When the |shada| file is not used the List is empty.
- Also see |:oldfiles| and |c_#<|.
- The List can be modified, but this has no effect on what is
- stored in the |shada| file later. If you use values other
- than String this will cause trouble.
-
- *v:option_new*
-v:option_new New value of the option. Valid while executing an |OptionSet|
- autocommand.
- *v:option_old*
-v:option_old Old value of the option. Valid while executing an |OptionSet|
- autocommand. Depending on the command used for setting and the
- kind of option this is either the local old value or the
- global old value.
- *v:option_oldlocal*
-v:option_oldlocal
- Old local value of the option. Valid while executing an
- |OptionSet| autocommand.
- *v:option_oldglobal*
-v:option_oldglobal
- Old global value of the option. Valid while executing an
- |OptionSet| autocommand.
- *v:option_type*
-v:option_type Scope of the set command. Valid while executing an
- |OptionSet| autocommand. Can be either "global" or "local"
- *v:option_command*
-v:option_command
- Command used to set the option. Valid while executing an
- |OptionSet| autocommand.
- value option was set via ~
- "setlocal" |:setlocal| or ":let l:xxx"
- "setglobal" |:setglobal| or ":let g:xxx"
- "set" |:set| or |:let|
- "modeline" |modeline|
- *v:operator* *operator-variable*
-v:operator The last operator given in Normal mode. This is a single
- character except for commands starting with <g> or <z>,
- in which case it is two characters. Best used alongside
- |v:prevcount| and |v:register|. Useful if you want to cancel
- Operator-pending mode and then use the operator, e.g.: >
- :omap O <Esc>:call MyMotion(v:operator)<CR>
-< The value remains set until another operator is entered, thus
- don't expect it to be empty.
- v:operator is not set for |:delete|, |:yank| or other Ex
- commands.
- Read-only.
-
- *v:prevcount* *prevcount-variable*
-v:prevcount The count given for the last but one Normal mode command.
- This is the v:count value of the previous command. Useful if
- you want to cancel Visual or Operator-pending mode and then
- use the count, e.g.: >
- :vmap % <Esc>:call MyFilter(v:prevcount)<CR>
-< Read-only.
-
- *v:profiling* *profiling-variable*
-v:profiling Normally zero. Set to one after using ":profile start".
- See |profiling|.
-
- *v:progname* *progname-variable*
-v:progname The name by which Nvim was invoked (with path removed).
- Read-only.
-
- *v:progpath* *progpath-variable*
-v:progpath Absolute path to the current running Nvim.
- Read-only.
-
- *v:register* *register-variable*
-v:register The name of the register in effect for the current normal mode
- command (regardless of whether that command actually used a
- register). Or for the currently executing normal mode mapping
- (use this in custom commands that take a register).
- If none is supplied it is the default register '"', unless
- 'clipboard' contains "unnamed" or "unnamedplus", then it is
- "*" or '+'.
- Also see |getreg()| and |setreg()|
-
- *v:relnum* *relnum-variable*
-v:relnum Relative line number for the 'statuscolumn' expression.
- Read-only.
-
- *v:scrollstart* *scrollstart-variable*
-v:scrollstart String describing the script or function that caused the
- screen to scroll up. It's only set when it is empty, thus the
- first reason is remembered. It is set to "Unknown" for a
- typed command.
- This can be used to find out why your script causes the
- hit-enter prompt.
-
- *v:servername* *servername-variable*
-v:servername Primary listen-address of Nvim, the first item returned by
- |serverlist()|. Usually this is the named pipe created by Nvim
- at |startup| or given by |--listen| (or the deprecated
- |$NVIM_LISTEN_ADDRESS| env var).
-
- See also |serverstart()| |serverstop()|.
- Read-only.
-
- *$NVIM*
- $NVIM is set by |terminal| and |jobstart()|, and is thus
- a hint that the current environment is a subprocess of Nvim.
- Example: >
- if $NVIM
- echo nvim_get_chan_info(v:parent)
- endif
-
-< Note the contents of $NVIM may change in the future.
-
-v:searchforward *v:searchforward* *searchforward-variable*
- Search direction: 1 after a forward search, 0 after a
- backward search. It is reset to forward when directly setting
- the last search pattern, see |quote/|.
- Note that the value is restored when returning from a
- function. |function-search-undo|.
- Read-write.
-
- *v:shell_error* *shell_error-variable*
-v:shell_error Result of the last shell command. When non-zero, the last
- shell command had an error. When zero, there was no problem.
- This only works when the shell returns the error code to Vim.
- The value -1 is often used when the command could not be
- executed. Read-only.
- Example: >
- :!mv foo bar
- :if v:shell_error
- : echo 'could not rename "foo" to "bar"!'
- :endif
-<
- *v:statusmsg* *statusmsg-variable*
-v:statusmsg Last given status message.
- Modifiable (can be set).
-
- *v:stderr* *stderr-variable*
-v:stderr |channel-id| corresponding to stderr. The value is always 2;
- use this variable to make your code more descriptive.
- Unlike stdin and stdout (see |stdioopen()|), stderr is always
- open for writing. Example: >
- :call chansend(v:stderr, "error: toaster empty\n")
-<
- *v:swapname* *swapname-variable*
-v:swapname Name of the swapfile found.
- Only valid during |SwapExists| event.
- Read-only.
-
- *v:swapchoice* *swapchoice-variable*
-v:swapchoice |SwapExists| autocommands can set this to the selected choice
- for handling an existing swapfile:
- 'o' Open read-only
- 'e' Edit anyway
- 'r' Recover
- 'd' Delete swapfile
- 'q' Quit
- 'a' Abort
- The value should be a single-character string. An empty value
- results in the user being asked, as would happen when there is
- no SwapExists autocommand. The default is empty.
-
- *v:swapcommand* *swapcommand-variable*
-v:swapcommand Normal mode command to be executed after a file has been
- opened. Can be used for a |SwapExists| autocommand to have
- another Vim open the file and jump to the right place. For
- example, when jumping to a tag the value is ":tag tagname\r".
- For ":edit +cmd file" the value is ":cmd\r".
-
- *v:t_TYPE* *v:t_bool* *t_bool-variable*
-v:t_bool Value of |Boolean| type. Read-only. See: |type()|
- *v:t_dict* *t_dict-variable*
-v:t_dict Value of |Dictionary| type. Read-only. See: |type()|
- *v:t_float* *t_float-variable*
-v:t_float Value of |Float| type. Read-only. See: |type()|
- *v:t_func* *t_func-variable*
-v:t_func Value of |Funcref| type. Read-only. See: |type()|
- *v:t_list* *t_list-variable*
-v:t_list Value of |List| type. Read-only. See: |type()|
- *v:t_number* *t_number-variable*
-v:t_number Value of |Number| type. Read-only. See: |type()|
- *v:t_string* *t_string-variable*
-v:t_string Value of |String| type. Read-only. See: |type()|
- *v:t_blob* *t_blob-variable*
-v:t_blob Value of |Blob| type. Read-only. See: |type()|
-
- *v:termresponse* *termresponse-variable*
-v:termresponse The value of the most recent OSC or DCS escape sequence
- received by Nvim from the terminal. This can be read in a
- |TermResponse| event handler after querying the terminal using
- another escape sequence.
-
- *v:testing* *testing-variable*
-v:testing Must be set before using `test_garbagecollect_now()`.
-
- *v:this_session* *this_session-variable*
-v:this_session Full filename of the last loaded or saved session file.
- Empty when no session file has been saved. See |:mksession|.
- Modifiable (can be set).
-
- *v:throwpoint* *throwpoint-variable*
-v:throwpoint The point where the exception most recently caught and not
- finished was thrown. Not set when commands are typed. See
- also |v:exception| and |throw-variables|.
- Example: >
- :try
- : throw "oops"
- :catch /.*/
- : echo "Exception from" v:throwpoint
- :endtry
-< Output: "Exception from test.vim, line 2"
-
- *v:true* *true-variable*
-v:true Special value used to put "true" in JSON and msgpack. See
- |json_encode()|. This value is converted to "v:true" when used
- as a String (e.g. in |expr5| with string concatenation
- operator) and to one when used as a Number (e.g. in |expr5| or
- |expr7| when used with numeric operators). Read-only.
-
- *v:val* *val-variable*
-v:val Value of the current item of a |List| or |Dictionary|. Only
- valid while evaluating the expression used with |map()| and
- |filter()|. Read-only.
-
- *v:version* *version-variable*
-v:version Vim version number: major version times 100 plus minor
- version. Vim 5.0 is 500, Vim 5.1 is 501.
- Read-only.
- Use |has()| to check the Nvim (not Vim) version: >
- :if has("nvim-0.2.1")
-<
-
- *v:virtnum* *virtnum-variable*
-v:virtnum Virtual line number for the 'statuscolumn' expression.
- Negative when drawing the status column for virtual lines, zero
- when drawing an actual buffer line, and positive when drawing
- the wrapped part of a buffer line.
- Read-only.
-
- *v:vim_did_enter* *vim_did_enter-variable*
-v:vim_did_enter 0 during startup, 1 just before |VimEnter|.
- Read-only.
-
- *v:warningmsg* *warningmsg-variable*
-v:warningmsg Last given warning message.
- Modifiable (can be set).
- *v:windowid* *windowid-variable*
-v:windowid Application-specific window "handle" which may be set by any
- attached UI. Defaults to zero.
- Note: For Nvim |windows| use |winnr()| or |win_getid()|, see
- |window-ID|.
+The alphabetic list of all builtin variables and details are in a separate
+help file: |vvars|.
==============================================================================
4. Builtin Functions *vim-function* *functions*
@@ -2493,6 +1910,8 @@ This does NOT work: >
:let {var} ..= {expr1} Like ":let {var} = {var} .. {expr1}".
These fail if {var} was not set yet and when the type
of {var} and {expr1} don't fit the operator.
+ `+=` modifies a |List| or a |Blob| in-place instead of
+ creating a new one.
:let ${env-name} = {expr1} *:let-environment* *:let-$*
@@ -4365,7 +3784,7 @@ have Vim execute random executables or may have forbidden to do so for
specific filetypes by setting the "<filetype>_exec" variable (|plugin_exec|).
It returns |TRUE| or |FALSE| to indicate whether the plugin should run the given
-exectuable. It takes the following arguments:
+executable. It takes the following arguments:
argument type ~
diff --git a/runtime/doc/faq.txt b/runtime/doc/faq.txt
new file mode 100644
index 0000000000..09bf829512
--- /dev/null
+++ b/runtime/doc/faq.txt
@@ -0,0 +1,485 @@
+*faq.txt* Nvim
+
+ NVIM REFERENCE MANUAL
+
+
+Frequently asked Questions *faq*
+
+ Type |gO| to see the table of contents.
+
+==============================================================================
+General Questions *faq-general*
+
+
+WHERE SHOULD I PUT MY CONFIG (VIMRC)? ~
+
+See |config|; you can copy (or symlink) your existing vimrc. |nvim-from-vim|
+
+
+HOW STABLE IS THE DEVELOPMENT (PRE-RELEASE) VERSION? ~
+
+The unstable (pre-release)
+https://github.com/neovim/neovim/releases/tag/nightly version of Nvim
+("HEAD", i.e. the `master` branch) is used to aggressively stage new features
+and changes. It's usually stable, but will occasionally break your workflow.
+We depend on HEAD users to report "blind spots" that were not caught by
+automated tests.
+
+Use the stable (release) https://github.com/neovim/neovim/releases/latest
+version for a more predictable experience.
+
+
+CAN I USE RUBY-BASED VIM PLUGINS (E.G. LUSTYEXPLORER)? ~
+
+Yes, starting with Nvim 0.1.5 PR #4980
+https://github.com/neovim/neovim/pull/4980 the legacy Vim `if_ruby` interface
+is supported.
+
+
+CAN I USE LUA-BASED VIM PLUGINS (E.G. NEOCOMPLETE)? ~
+
+No. Starting with Nvim 0.2 PR #4411
+https://github.com/neovim/neovim/pull/4411 Lua is built-in, but the legacy
+Vim `if_lua` interface is not supported.
+
+
+HOW CAN I USE "TRUE COLOR" IN THE TERMINAL? ~
+
+Truecolor (24bit colors) are enabled by default if a supporting terminal is
+detected. If your terminal is not detected but you are sure it supports
+truecolor, add this to your |init.vim|:
+>vim
+ set termguicolors
+<
+
+NVIM SHOWS WEIRD SYMBOLS (`ᅵ[2 q`) WHEN CHANGING MODES ~
+
+This is a bug in your terminal emulator. It happens because Nvim sends
+cursor-shape termcodes by default, if the terminal appears to be
+xterm-compatible (`TERM=xterm-256color`).
+
+To workaround the issue, you can:
+
+- Use a different terminal emulator
+- Disable 'guicursor' in your Nvim config: >vim
+
+ :set guicursor=
+ " Workaround some broken plugins which set guicursor indiscriminately.
+ :autocmd OptionSet guicursor noautocmd set guicursor=
+<
+See also |$TERM| for recommended values of `$TERM`.
+
+
+HOW TO CHANGE CURSOR SHAPE IN THE TERMINAL? ~
+
+- For Nvim 0.1.7 or older: see the note about `NVIM_TUI_ENABLE_CURSOR_SHAPE` in `man nvim`.
+- For Nvim 0.2 or newer: cursor styling is controlled by the 'guicursor' option.
+ - To _disable_ cursor-styling, set 'guicursor' to empty: >vim
+
+ :set guicursor=
+ " Workaround some broken plugins which set guicursor indiscriminately.
+ :autocmd OptionSet guicursor noautocmd set guicursor=
+<
+ - If you want a non-blinking cursor, use `blinkon0`. See 'guicursor'.
+ - 'guicursor' is enabled by default, unless Nvim thinks your terminal doesn't
+ support it. If you're sure that your terminal supports cursor-shaping, set
+ 'guicursor' in your |init.vim|, as described in 'guicursor'.
+- The Vim terminal options |t_SI| and `t_EI` are ignored, like all other |t_xx| options.
+- Old versions of libvte (gnome-terminal, roxterm, terminator, ...) do not
+ support cursor style control codes. #2537
+ https://github.com/neovim/neovim/issues/2537
+
+
+HOW TO CHANGE CURSOR COLOR IN THE TERMINAL? ~
+
+Cursor styling (shape, color, behavior) is controlled by 'guicursor', even in
+the terminal. Cursor color (as opposed to shape) only works if
+'termguicolors' is set.
+
+'guicursor' gives an example, but here's a more complicated example
+which sets different colors in insert-mode and normal-mode:
+>vim
+ :set termguicolors
+ :hi Cursor guifg=green guibg=green
+ :hi Cursor2 guifg=red guibg=red
+ :set guicursor=n-v-c:block-Cursor/lCursor,i-ci-ve:ver25-Cursor2/lCursor2,r-cr:hor20,o:hor50
+<
+
+CURSOR STYLE ISN'T RESTORED AFTER EXITING OR SUSPENDING AND RESUMING NVIM ~
+
+Terminals do not provide a way to query the cursor style. Use autocommands to
+manage the cursor style:
+>vim
+ au VimEnter,VimResume * set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50
+ \,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor
+ \,sm:block-blinkwait175-blinkoff150-blinkon175
+
+ au VimLeave,VimSuspend * set guicursor=a:block-blinkon0
+<
+
+CURSOR SHAPE DOESN'T CHANGE IN TMUX ~
+
+tmux decides that, not Nvim. See |tui-cursor-shape| for a fix.
+
+See #3165 https://github.com/neovim/neovim/pull/3165 for discussion.
+
+
+CURSOR FLICKER IN TMUX? ~
+
+If cursor `_` appears and disappears very quickly when opening nvim without a
+document under tmux, and you set |ctermbg| in `EndOfBuffer` and `Normal`, try
+setting these to `NONE`:
+>vim
+ hi EndOfBuffer ctermbg=NONE ctermfg=200 cterm=NONE
+ hi Normal ctermbg=NONE ctermfg=200 cterm=NONE
+<
+
+WHAT HAPPENED TO --remote AND FRIENDS? ~
+
+|--remote| is partly supported. |clientserver|
+
+If you require flags from Vim that are missing in Nvim, you can use
+https://github.com/mhinz/neovim-remote instead.
+
+==============================================================================
+Runtime issues *faq-runtime*
+
+
+COPYING TO X11 PRIMARY SELECTION WITH THE MOUSE DOESN'T WORK ~
+
+`clipboard=autoselect` is not implemented yet
+https://github.com/neovim/neovim/issues/2325. You may find this workaround to
+be useful:
+>vim
+ vnoremap <LeftRelease> "*ygv
+ vnoremap <2-LeftRelease> "*ygv
+<
+
+MY CTRL-H MAPPING DOESN'T WORK ~
+
+This was fixed in Nvim 0.2. If you are running Nvim 0.1.7 or older,
+adjust your terminal's "kbs" (key_backspace) terminfo entry:
+>vim
+ infocmp $TERM | sed 's/kbs=^[hH]/kbs=\\177/' > $TERM.ti
+ tic $TERM.ti
+<
+(Feel free to delete the temporary `*.ti` file created after running the above
+commands).
+
+
+<HOME> OR SOME OTHER "SPECIAL" KEY DOESN'T WORK ~
+
+Make sure |$TERM| is set correctly.
+
+- For screen or tmux, `$TERM` should be `screen-256color` (not `xterm-256color`!)
+- In other cases if "256" does not appear in the string it's probably wrong.
+ Try `TERM=xterm-256color`.
+
+
+:! AND SYSTEM() DO WEIRD THINGS WITH INTERACTIVE PROCESSES ~
+
+Interactive commands are supported by |:terminal| in Nvim. But |:!| and
+|system()| do not support interactive commands, primarily because Nvim UIs use
+stdio for msgpack communication, but also for performance, reliability, and
+consistency across platforms (see
+https://vimhelp.org/gui_x11.txt.html#gui-pty).
+
+See also #1496 https://github.com/neovim/neovim/issues/1496 and #8217
+https://github.com/neovim/neovim/issues/8217#issuecomment-402152307.
+
+
+PYTHON SUPPORT ISN'T WORKING ~
+
+Run |:checkhealth| in Nvim for automatic diagnosis.
+
+Other hints:
+
+- The python `neovim` module was renamed to `pynvim` (long ago).
+- If you're using pyenv or virtualenv for the `pynvim` module
+ https://pypi.python.org/pypi/pynvim/, you must set `g:python3_host_prog` to
+ the virtualenv's interpreter path.
+- Read |provider-python|.
+- Be sure you have the latest version of the `pynvim` Python module: >bash
+
+ python -m pip install setuptools
+ python -m pip install --upgrade pynvim
+ python3 -m pip install --upgrade pynvim
+<
+- Try with `nvim -u NORC` to make sure your config (|init.vim|) isn't causing a
+ problem. If you get `E117: Unknown function`, that means there's a runtime
+ issue: |faq-runtime|.
+
+
+:CHECKHEALTH REPORTS E5009: INVALID $VIMRUNTIME ~
+
+This means `health#check()` couldn't load, which suggests that |$VIMRUNTIME|
+or 'runtimepath' is broken.
+
+- |$VIMRUNTIME| must point to Nvim's runtime files, not Vim's.
+- The |$VIMRUNTIME| directory contents should be readable by the current user.
+- Verify that `:echo &runtimepath` contains the $VIMRUNTIME path.
+- Check the output of: >vim
+
+ :call health#check()
+ :verbose func health#check
+<
+
+NEOVIM CAN'T FIND ITS RUNTIME ~
+
+This is the case if `:help nvim` shows `E149: Sorry, no help for nvim`.
+
+Make sure that |$VIM| and |$VIMRUNTIME| point to Nvim's (as opposed to
+Vim's) runtime by checking `:echo $VIM` and `:echo $VIMRUNTIME`. This should
+give something like `/usr/share/nvim` resp. `/usr/share/nvim/runtime`.
+
+Also make sure that you don't accidentally overwrite your runtimepath
+(`:set runtimepath?`), which includes the above |$VIMRUNTIME| by default (see
+'runtimepath').
+
+
+NEOVIM IS SLOW ~
+
+
+Use a fast terminal emulator:
+
+- kitty https://github.com/kovidgoyal/kitty
+- alacritty https://github.com/jwilm/alacritty
+
+
+Use an optimized build:
+
+`:checkhealth nvim` should report one of these "build types":
+>
+ Build type: RelWithDebInfo
+ Build type: MinSizeRel
+ Build type: Release
+<
+If it reports `Build type: Debug` and you're building Nvim from source, see
+https://github.com/neovim/neovim/blob/master/BUILD.md.
+
+
+COLORS AREN'T DISPLAYED CORRECTLY ~
+
+Ensure that |$TERM| is set correctly.
+
+From a shell, run `TERM=xterm-256color nvim`. If colors are displayed
+correctly, then export that value of `TERM` in your user profile (usually
+`~/.profile`):
+>bash
+ export TERM=xterm-256color
+<
+If you're using `tmux`, instead add this to your `tmux.conf`:
+>bash
+ set -g default-terminal "tmux-256color"
+<
+
+For GNU `screen`, configure your `.screenrc`
+<https://wiki.archlinux.org/index.php/GNU_Screen#Use_256_colors>:
+>
+ term screen-256color
+<
+
+NOTE: Nvim ignores `t_Co` and other |t_xx| terminal codes.
+
+
+NEOVIM CAN'T READ UTF-8 CHARACTERS ~
+
+Run the following from the command line:
+>bash
+ locale | grep -E '(LANG|LC_CTYPE|LC_ALL)=(.*\.)?(UTF|utf)-?8'
+<
+If there's no results, then you might not be using a UTF-8 locale. See the
+following issues:
+#1601 https://github.com/neovim/neovim/issues/1601
+#1858 https://github.com/neovim/neovim/issues/1858
+#2386 https://github.com/neovim/neovim/issues/2386
+
+
+ESC IN TMUX OR GNU SCREEN IS DELAYED ~
+
+This is a common problem
+https://www.google.com/?q=tmux%20vim%20escape%20delay in `tmux` / `screen`
+(see also tmux/#131
+https://github.com/tmux/tmux/issues/131#issuecomment-145853211). The
+corresponding timeout needs to be tweaked to a low value (10-20ms).
+
+`.tmux.conf`:
+>
+ set -g escape-time 10
+ # Or for tmux >= 2.6
+ set -sg escape-time 10
+<
+`.screenrc`:
+>
+ maptimeout 10
+<
+
+"WHY DOESN'T THIS HAPPEN IN VIM?"
+
+It does happen (try `vim -N -u NONE`), but if you hit a key quickly after
+ESC_ then Vim interprets the ESC as ESC instead of ALT (META). You won't
+notice the delay unless you closely observe the cursor. The tradeoff is that
+Vim won't understand ALT (META) key-chords, so for example `nnoremap <M-a>`
+won't work. ALT (META) key-chords always work in Nvim. See also `:help
+xterm-cursor-keys` in Vim.
+
+Nvim 0.3 mimics the Vim behavior while still fully supporting ALT mappings. See
+|i_ALT|.
+
+
+ESC IN GNU SCREEN IS LOST WHEN MOUSE MODE IS ENABLED ~
+
+This happens because of a bug in screen https://savannah.gnu.org/bugs/?60196:
+in mouse mode, screen assumes that `ESC` is part of a mouse sequence and will
+wait an unlimited time for the rest of the sequence, regardless of
+`maptimeout`. Until it's fixed in screen, there's no known workaround for
+this other than double-pressing escape, which causes a single escape to be
+passed through to Nvim.
+
+
+CALLING INPUTLIST(), ECHOMSG, ... IN FILETYPE PLUGINS AND AUTOCMD DOES NOT WORK ~
+
+#10008 https://github.com/neovim/neovim/issues/10008,
+#10116 https://github.com/neovim/neovim/issues/10116,
+#12288 https://github.com/neovim/neovim/issues/12288,
+# vim/vim#4379 https://github.com/vim/vim/issues/4379.
+This is because Nvim sets `shortmess+=F` by default. Vim behaves the same way
+with `set shortmes+=F`. There are plans to improve this, but meanwhile as a
+workaround, use `set shortmess-=F` or use `unsilent` as follows.
+>vim
+ unsilent let var = inputlist(['1. item1', '2. item2'])
+ autocmd BufNewFile * unsilent echomsg 'The autocmd has been fired.'
+<
+
+G:CLIPBOARD SETTINGS ARE NOT USED. ~
+
+If the clipboard provider is already loaded, you will need to reload it after
+configuration. Use the following configuration.
+>vim
+ let g:clipboard = { 'name' : ... }
+ if exists('g:loaded_clipboard_provider')
+ unlet g:loaded_clipboard_provider
+ runtime autoload/provider/clipboard.vim
+ endif
+<
+
+Or, if you want automatic reloading when assigning to |g:clipboard|, set
+|init.vim| as follows.
+>vim
+ function! s:clipboard_changed(...) abort
+ if exists('g:loaded_clipboard_provider')
+ unlet g:loaded_clipboard_provider
+ endif
+ runtime autoload/provider/clipboard.vim
+ endfunction
+
+ if !exists('s:loaded")
+ call dictwatcheradd(g:, 'clipboard', function('s:clipboard_changed'))
+ endif
+ let s:loaded = v:true
+<
+
+==============================================================================
+Build issues *faq-build*
+
+
+GENERAL BUILD ISSUES ~
+
+Run `make distclean && make` to rule out a stale build environment causing the
+failure.
+
+
+SETTINGS IN LOCAL.MK DON'T TAKE EFFECT ~
+
+CMake caches build settings, so you might need to run `rm -r build && make`
+after modifying `local.mk`.
+
+
+CMAKE ERRORS ~
+
+`configure_file Problem configuring file`
+
+This is probably a permissions issue, which can happen if you run `make` as the
+root user, then later run an unprivileged `make`. To fix this, run `rm -rf
+build` and try again.
+
+
+GENERATING HELPTAGS FAILED ~
+
+If re-installation fails with "Generating helptags failed", try removing the
+previously installed runtime directory (if `CMAKE_INSTALL_PREFIX` is not set
+during building, the default is `/usr/local/share/nvim`):
+>bash
+ rm -r /usr/local/share/nvim
+<
+
+==============================================================================
+Design *faq-design*
+
+
+WHY NOT USE JSON FOR RPC? ~
+
+- JSON cannot easily/efficiently handle binary data
+- JSON specification is ambiguous: https://seriot.ch/parsing_json.php
+
+
+WHY EMBED LUA INSTEAD OF X? ~
+
+- Lua is a very small language, ideal for embedding. The biggest advantage of
+ Python/Ruby/etc is their huge collection of libraries, but that isn't
+ relevant for Nvim, where Nvim is the "batteries included" library:
+ introducing another stdlib would be redundant.
+- Lua 5.1 is a complete language: the syntax is frozen. This is great for
+ backwards compatibility.
+- Nvim also uses Lua internally as an alternative to C. Extra performance is
+ useful there, as opposed to a slow language like Python or Vim9script.
+- LuaJIT is one of the fastest runtimes on the planet, 10x faster than Python
+ and "Vim9script" https://vimhelp.org/vim9.txt.html, 100x faster than
+ Vimscript.
+- Python/JS cost more than Lua in terms of size and portability, and there are
+ already numerous Python/JS-based editors. So Python/JS would make Nvim
+ bigger and less portable, in exchange for a non-differentiating feature.
+
+See also:
+
+- Why Lua https://web.archive.org/web/20150219224654/https://blog.datamules.com/blog/2012/01/30/why-lua/
+- The Design of Lua https://cacm.acm.org/magazines/2018/11/232214-a-look-at-the-design-of-lua/fulltext
+- Scripting architecture considerations http://oldblog.antirez.com/post/redis-and-scripting.html
+- LuaJIT performance https://julialang.org/benchmarks/
+- Discussion of JavaScript vs Lua https://github.com/vim/vim/pull/5198#issuecomment-554693754
+- Discussion Python embedding https://lobste.rs/s/pnuak4/mercurial_s_journey_reflections_on#c_zshdwy
+
+
+WHY LUA 5.1 INSTEAD OF LUA 5.3+? ~
+
+Lua 5.1 is a different language than 5.3. The Lua org makes breaking changes
+with every new version, so even if we switched (not upgraded, but switched) to
+5.3 we gain nothing when they create the next new language in 5.4, 5.5, etc.
+And we would lose LuaJIT, which is far more valuable than Lua 5.3+.
+
+Lua 5.1 is a complete language. To "upgrade" it, add libraries, not syntax.
+Nvim itself already is a pretty good "stdlib" for Lua, and we will continue to
+grow and enhance it. Changing the rules of Lua gains nothing in this context.
+
+
+WILL NEOVIM TRANSLATE VIMSCRIPT TO LUA, INSTEAD OF EXECUTING VIMSCRIPT DIRECTLY? ~
+
+- We are experimenting with vim9jit https://github.com/tjdevries/vim9jit to
+ transpile Vim9script (Vim9's Vimscript variant) to Lua and have used this to
+ port Vim9 plugins https://github.com/neovim/neovim/pull/21662 to Nvim Lua.
+- We have no plans for transpiling legacy Vimscript.
+
+
+ARE PLUGIN AUTHORS ENCOURAGED TO PORT THEIR PLUGINS FROM VIMSCRIPT TO LUA? DO YOU PLAN ON SUPPORTING VIMSCRIPT INDEFINITELY? (#1152) ~
+
+We don't anticipate any reason to deprecate Vimscript, which is a valuable DSL
+https://en.wikipedia.org/wiki/Domain-specific_language for text-editing tasks.
+Maintaining Vimscript compatibility is less costly than a mass migration of
+existing Vim plugins.
+
+Porting from Vimscript to Lua just for the heck of it gains nothing. Nvim is
+emphatically a fork of Vim in order to leverage the work already spent on
+thousands of Vim plugins, while enabling new types of plugins and
+integrations.
+
+vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt
index ed21dc1c37..071a45c9c3 100644
--- a/runtime/doc/filetype.txt
+++ b/runtime/doc/filetype.txt
@@ -146,6 +146,7 @@ variables can be used to overrule the filetype used for certain extensions:
`*.cls` g:filetype_cls
`*.csh` g:filetype_csh |ft-csh-syntax|
`*.dat` g:filetype_dat
+ `*.def` g:filetype_def
`*.f` g:filetype_f |ft-forth-syntax|
`*.frm` g:filetype_frm |ft-form-syntax|
`*.fs` g:filetype_fs |ft-forth-syntax|
@@ -167,6 +168,7 @@ variables can be used to overrule the filetype used for certain extensions:
`*.sh` g:bash_is_sh |ft-sh-syntax|
`*.tex` g:tex_flavor |ft-tex-plugin|
`*.typ` g:filetype_typ
+ `*.v` g:filetype_v
`*.w` g:filetype_w |ft-cweb-syntax|
For a few filetypes the global variable is used only when the filetype could
@@ -457,7 +459,7 @@ g:changelog_new_date_format
%% insert a single '%' character
%d insert the date from above
%u insert the user from above
- %p insert result of b:changelog_entry_prefix
+ %p insert result of b:changelog_entry_prefix
%c where to position cursor when done
The default is "%d %u\n\n\t* %p%c\n\n", which produces
something like (| is where cursor will be, unless at
@@ -471,7 +473,7 @@ g:changelog_new_entry_format
The format used when creating a new entry.
The following table describes special tokens in the
string:
- %p insert result of b:changelog_entry_prefix
+ %p insert result of b:changelog_entry_prefix
%c where to position cursor when done
The default is "\t*%c", which produces something
similar to >
@@ -525,13 +527,26 @@ under it. If not found, a new entry and item is prepended to the beginning of
the Changelog.
+ASCIIDOC *ft-asciidoc-plugin*
+
+To enable |folding| use this: >
+ let g:asciidoc_folding = 1
+
+To disable nesting of folded headers use this: >
+ let g:asciidoc_foldnested = 0
+
+To disable folding everything under the title use this: >
+ let asciidoc_fold_under_title = 0
+
+
FORTRAN *ft-fortran-plugin*
Options:
'expandtab' is switched on to avoid tabs as required by the Fortran
standards unless the user has set fortran_have_tabs in vimrc.
-'textwidth' is set to 72 for fixed source format as required by the
- Fortran standards and to 80 for free source format.
+'textwidth' is set to 80 for fixed source format whereas it is set to 132
+ for free source format. Setting the fortran_extended_line_length
+ variable increases the width to 132 for fixed source format.
'formatoptions' is set to break code and comment lines and to preserve long
lines. You can format comments with |gq|.
For further discussion of fortran_have_tabs and the method used for the
@@ -684,7 +699,7 @@ To disable this behavior, set the following variable in your vimrc: >
QUERY *ft-query-plugin*
-Linting of tree-sitter queries for installed parsers using
+Linting of treesitter queries for installed parsers using
|vim.treesitter.query.lint()| is enabled by default on `BufEnter` and
`BufWrite`. To change the events that trigger linting, use >lua
@@ -734,6 +749,14 @@ To enable this behavior, set the following variable in your vimrc: >
let g:rst_style = 1
+RNOWEB *ft-rnoweb-plugin*
+
+The 'formatexpr' option is set dynamically with different values for R code
+and for LaTeX code. If you prefer that 'formatexpr' is not set, add to your
+|vimrc|: >
+ let rnw_dynamic_comments = 0
+
+
RPM SPEC *ft-spec-plugin*
Since the text for this plugin is rather long it has been put in a separate
diff --git a/runtime/doc/ft_ada.txt b/runtime/doc/ft_ada.txt
index 3b7d6a73dd..a9302cde97 100644
--- a/runtime/doc/ft_ada.txt
+++ b/runtime/doc/ft_ada.txt
@@ -172,7 +172,7 @@ GNAT OBJECT ~
*g:gnat.Make()*
g:gnat.Make()
Calls |g:gnat.Make_Command| and displays the result inside a
- |quickfix| window.
+ |quickfix| window.
*g:gnat.Pretty()*
g:gnat.Pretty()
diff --git a/runtime/doc/ft_sql.txt b/runtime/doc/ft_sql.txt
index 68e26d2a5b..241fa4bd74 100644
--- a/runtime/doc/ft_sql.txt
+++ b/runtime/doc/ft_sql.txt
@@ -375,7 +375,7 @@ This command breaks down as: >
'sqlKeyword' - Display the items for the sqlKeyword highlight
group
'sqlKeyword\w*' - A second option available with Vim 7.4 which
- uses a regular expression to determine which
+ uses a regular expression to determine which
syntax groups to use
)<CR> - Execute the :let command
<C-X><C-O> - Trigger the standard omni completion key stroke.
diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt
index b8526b55e9..7545d2c621 100644
--- a/runtime/doc/help.txt
+++ b/runtime/doc/help.txt
@@ -47,6 +47,7 @@ ABOUT NVIM *reference_toc* *doc-file-list* *Q_ct*
|news| News since the previous release
|nvim| Transitioning from Vim
|vim-differences| Nvim compared to Vim
+|faq| Frequently Asked Questions
|user-manual| User manual: How to accomplish editing tasks.
|quickref| Overview of common commands
|tutor| 30-minute interactive course for beginners
@@ -167,7 +168,9 @@ DEVELOPING NVIM
|dev| Development of Nvim
|dev-style| Development style guidelines
-|debug.txt| Debugging Vim itself
+|dev-theme| Design guidelines (colorschemes etc.)
+|dev-tools| Tools and techniques for developing Nvim
+|dev-vimpatch| Merging patches from Vim
Standard plugins ~
*standard-plugin-list*
diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt
index 853facdaa0..c20143bc6e 100644
--- a/runtime/doc/indent.txt
+++ b/runtime/doc/indent.txt
@@ -708,29 +708,29 @@ clojure-mode.el:
FORTRAN *ft-fortran-indent*
-Block if, select case, where, and forall constructs are indented. So are
-type, interface, associate, block, and enum constructs. The indenting of
-subroutines, functions, modules, and program blocks is optional. Comments,
-labelled statements and continuation lines are indented if the Fortran is in
-free source form, whereas they are not indented if the Fortran is in fixed
-source form because of the left margin requirements. Hence manual indent
-corrections will be necessary for labelled statements and continuation lines
-when fixed source form is being used. For further discussion of the method
-used for the detection of source format see |ft-fortran-syntax|.
+Block if, select case, select type, select rank, where, forall, type,
+interface, associate, block, enum, critical, and change team constructs are
+indented. The indenting of subroutines, functions, modules, and program blocks
+is optional. Comments, labeled statements, and continuation lines are indented
+if the Fortran is in free source form, whereas they are not indented if the
+Fortran is in fixed source form because of the left margin requirements. Hence
+manual indent corrections will be necessary for labeled statements and
+continuation lines when fixed source form is being used. For further
+discussion of the method used for the detection of source format see
+|ft-fortran-syntax|.
Do loops ~
All do loops are left unindented by default. Do loops can be unstructured in
-Fortran with (possibly multiple) loops ending on a labelled executable
+Fortran with (possibly multiple) loops ending on a labeled executable
statement of almost arbitrary type. Correct indentation requires
-compiler-quality parsing. Old code with do loops ending on labelled statements
-of arbitrary type can be indented with elaborate programs such as Tidy
-(https://www.unb.ca/chem/ajit/f_tidy.htm). Structured do/continue loops are
-also left unindented because continue statements are also used for purposes
-other than ending a do loop. Programs such as Tidy can convert structured
-do/continue loops to the do/enddo form. Do loops of the do/enddo variety can
-be indented. If you use only structured loops of the do/enddo form, you should
-declare this by setting the fortran_do_enddo variable in your vimrc as
-follows >
+compiler-quality parsing. Old code with do loops ending on labeled statements
+of arbitrary type can be indented with elaborate programs such as Tidy.
+Structured do/continue loops are also left unindented because continue
+statements are used for purposes other than ending a do loop. Programs such
+as Tidy can convert structured do/continue loops to the do/enddo form. Do
+loops of the do/enddo variety can be indented. If you use only structured
+loops of the do/enddo form, you should declare this by setting the
+fortran_do_enddo variable in your vimrc as follows >
let fortran_do_enddo=1
@@ -744,15 +744,14 @@ to get do loops indented in .f90 files and left alone in Fortran files with
other extensions such as .for.
Program units ~
-The indenting of program units (subroutines, functions, modules, and program
-blocks) is enabled by default but can be suppressed if a lighter, screen-width
-preserving indent style is desired. To suppress the indenting of program
-units for all fortran files set the global fortran_indent_less variable in
-your vimrc as follows >
+Indenting of program units (subroutines, functions, modules, and program
+blocks) can be increased by setting the variable fortran_indent_more and can
+be decreased by setting the variable fortran_indent_less. These variables
+can be set for all fortran files in your vimrc as follows >
let fortran_indent_less=1
-A finer level of suppression can be achieved by setting the corresponding
+A finer level of control can be achieved by setting the corresponding
buffer-local variable as follows >
let b:fortran_indent_less=1
@@ -1033,8 +1032,8 @@ r_indent_comment_column, as in the example below:
let r_indent_comment_column = 30
<
Any code after a line that ends with "<-" is indented. Emacs/ESS does not
-indent the code if it is a top level function. If you prefer that the
-Vim-R-plugin behaves like Emacs/ESS in this regard, put in your |vimrc|:
+indent the code if it is a top-level function. If you prefer a behavior like
+Emacs/ESS one in this regard, put in your |vimrc|:
>
let r_indent_ess_compatible = 1
<
@@ -1227,5 +1226,11 @@ indent for a continuation line, a line that starts with a backslash: >
Three times shiftwidth is the default value.
+YAML *ft-yaml-indent*
+
+By default, the yaml indent script does not try to detect multiline scalars.
+If you want to enable this, set the following variable: >
+
+ let g:yaml_indent_multiline_scalar = 1
vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index 75b12fece2..c1a8aec40e 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -1146,6 +1146,8 @@ tag command action ~
|:>| :> shift lines one 'shiftwidth' right
|:@| :@ execute contents of a register
|:@@| :@@ repeat the previous ":@"
+|:2match| :2mat[ch] define a second match to highlight
+|:3match| :3mat[ch] define a third match to highlight
|:Next| :N[ext] go to previous file in the argument list
|:append| :a[ppend] append text
|:abbreviate| :ab[breviate] enter abbreviation
diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt
index ce2ec36ca3..34affb22e9 100644
--- a/runtime/doc/insert.txt
+++ b/runtime/doc/insert.txt
@@ -160,22 +160,22 @@ CTRL-R CTRL-O {register} *i_CTRL-R_CTRL-O*
auto-indent. Does the same as pasting with the mouse
|<MiddleMouse>|. When the register is linewise this will
insert the text above the current line, like with `P`.
- Does not replace characters!
The '.' register (last inserted text) is still inserted as
typed.
After this command, the '.' register contains the command
typed and not the text. I.e., the literals "^R^O" and not the
text from the register.
+ Does not replace characters in |Replace-mode|!
CTRL-R CTRL-P {register} *i_CTRL-R_CTRL-P*
Insert the contents of a register literally and fix the
indent, like |[<MiddleMouse>|.
- Does not replace characters!
The '.' register (last inserted text) is still inserted as
typed.
After this command, the '.' register contains the command
typed and not the text. I.e., the literals "^R^P" and not the
text from the register.
+ Does not replace characters in |Replace-mode|!
*i_CTRL-T*
CTRL-T Insert one shiftwidth of indent at the start of the current
diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt
index 85115fc22b..c9211291d0 100644
--- a/runtime/doc/intro.txt
+++ b/runtime/doc/intro.txt
@@ -49,10 +49,9 @@ For more information try one of these:
==============================================================================
Nvim on the interwebs *internet*
- *www* *faq* *distribution* *download*
+ *www* *distribution* *download*
Nvim home page: https://neovim.io/
- Nvim FAQ: https://github.com/neovim/neovim/wiki/FAQ
Downloads: https://github.com/neovim/neovim/releases
Vim FAQ: https://vimhelp.org/vim_faq.txt.html
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
index 5e97628f42..eb37cb2a6f 100644
--- a/runtime/doc/lsp.txt
+++ b/runtime/doc/lsp.txt
@@ -218,7 +218,7 @@ Each response handler has this signature: >
- {ctx} (table) Table of calling state associated with the
handler, with these keys:
- {method} (string) |lsp-method| name.
- - {client_id} (number) |vim.lsp.client| identifier.
+ - {client_id} (number) |vim.lsp.Client| identifier.
- {bufnr} (Buffer) Buffer handle.
- {params} (table|nil) Request parameters table.
- {version} (number) Document version at time of
@@ -366,31 +366,6 @@ https://microsoft.github.io/language-server-protocol/specifications/specificatio
LSP notification shape:
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#notificationMessage
- *lsp-on-list-handler*
-
-`on_list` receives a table with:
-
- - `items` table[], structured like |setqflist-what|
- - `title` string, title for the list.
- - `context` table|nil. `ctx` from |lsp-handler|
-
-This table can be used with vim.fn.setqflist or vim.fn.setloclist. E.g.:
->lua
- local function on_list(options)
- vim.fn.setqflist({}, ' ', options)
- vim.api.nvim_command('cfirst')
- end
-
- vim.lsp.buf.definition{on_list=on_list}
- vim.lsp.buf.references(nil, {on_list=on_list})
-<
-If you prefer loclist do something like this:
->lua
- local function on_list(options)
- vim.fn.setloclist(0, {}, ' ', options)
- vim.api.nvim_command('lopen')
- end
-<
================================================================================
LSP HIGHLIGHT *lsp-highlight*
@@ -480,23 +455,23 @@ Use |LspTokenUpdate| and |vim.lsp.semantic_tokens.highlight_token()| for more
complex highlighting.
The following groups are linked by default to standard |group-name|s:
->
- @lsp.type.class Structure
- @lsp.type.decorator Function
- @lsp.type.enum Structure
- @lsp.type.enumMember Constant
- @lsp.type.function Function
- @lsp.type.interface Structure
- @lsp.type.macro Macro
- @lsp.type.method Function
- @lsp.type.namespace Structure
- @lsp.type.parameter Identifier
- @lsp.type.property Identifier
- @lsp.type.struct Structure
- @lsp.type.type Type
- @lsp.type.typeParameter TypeDef
- @lsp.type.variable Identifier
-<
+
+@lsp.type.class Structure
+@lsp.type.decorator Function
+@lsp.type.enum Structure
+@lsp.type.enumMember Constant
+@lsp.type.function Function
+@lsp.type.interface Structure
+@lsp.type.macro Macro
+@lsp.type.method Function
+@lsp.type.namespace Structure
+@lsp.type.parameter Identifier
+@lsp.type.property Identifier
+@lsp.type.struct Structure
+@lsp.type.type Type
+@lsp.type.typeParameter TypeDef
+@lsp.type.variable Identifier
+
==============================================================================
EVENTS *lsp-events*
@@ -557,7 +532,7 @@ LspNotify *LspNotify*
LspProgress *LspProgress*
Upon receipt of a progress notification from the server. Notifications can
- be polled from a `progress` ring buffer of a |vim.lsp.client| or use
+ be polled from a `progress` ring buffer of a |vim.lsp.Client| or use
|vim.lsp.status()| to get an aggregate message
If the server sends a "work done progress", the `pattern` is set to `kind`
@@ -583,7 +558,7 @@ LspRequest *LspRequest*
will trigger with {type} == `cancel`.
When used from Lua, the client ID, request ID, and request are sent in
- the "data" table. See {requests} in |vim.lsp.client| for details on the
+ the "data" table. See {requests} in |vim.lsp.Client| for details on the
{request} value. If the request type is `complete`, the request will be
deleted from the client's pending requests table immediately after
calling the event's callbacks. Example: >lua
@@ -642,12 +617,12 @@ buf_attach_client({bufnr}, {client_id}) *vim.lsp.buf_attach_client()*
Without calling this, the server won't be notified of changes to a buffer.
Parameters: ~
- • {bufnr} (integer) Buffer handle, or 0 for current
- • {client_id} (integer) Client id
+ • {bufnr} (`integer`) Buffer handle, or 0 for current
+ • {client_id} (`integer`) Client id
Return: ~
- (boolean) success `true` if client was attached successfully; `false`
- otherwise
+ (`boolean`) success `true` if client was attached successfully;
+ `false` otherwise
buf_detach_client({bufnr}, {client_id}) *vim.lsp.buf_detach_client()*
Detaches client from the specified buffer. Note: While the server is
@@ -655,26 +630,26 @@ buf_detach_client({bufnr}, {client_id}) *vim.lsp.buf_detach_client()*
send notifications should it ignore this notification.
Parameters: ~
- • {bufnr} (integer) Buffer handle, or 0 for current
- • {client_id} (integer) Client id
+ • {bufnr} (`integer`) Buffer handle, or 0 for current
+ • {client_id} (`integer`) Client id
buf_is_attached({bufnr}, {client_id}) *vim.lsp.buf_is_attached()*
Checks if a buffer is attached for a particular client.
Parameters: ~
- • {bufnr} (integer) Buffer handle, or 0 for current
- • {client_id} (integer) the client id
+ • {bufnr} (`integer`) Buffer handle, or 0 for current
+ • {client_id} (`integer`) the client id
buf_notify({bufnr}, {method}, {params}) *vim.lsp.buf_notify()*
Send a notification to a server
Parameters: ~
- • {bufnr} (integer|nil) The number of the buffer
- • {method} (string) Name of the request method
- • {params} (any) Arguments to send to the server
+ • {bufnr} (`integer?`) The number of the buffer
+ • {method} (`string`) Name of the request method
+ • {params} (`any`) Arguments to send to the server
Return: ~
- (boolean) success true if any client returns true; false otherwise
+ (`boolean`) success true if any client returns true; false otherwise
*vim.lsp.buf_request_all()*
buf_request_all({bufnr}, {method}, {params}, {handler})
@@ -682,14 +657,15 @@ buf_request_all({bufnr}, {method}, {params}, {handler})
executes the `handler` callback with the combined result.
Parameters: ~
- • {bufnr} (integer) Buffer handle, or 0 for current.
- • {method} (string) LSP method name
- • {params} (table|nil) Parameters to send to the server
- • {handler} (function) Handler called after all requests are completed.
- Server results are passed as a `client_id:result` map.
+ • {bufnr} (`integer`) Buffer handle, or 0 for current.
+ • {method} (`string`) LSP method name
+ • {params} (`table?`) Parameters to send to the server
+ • {handler} (`function`) Handler called after all requests are
+ completed. Server results are passed as a
+ `client_id:result` map.
Return: ~
- (function) cancel Function that cancels all requests.
+ (`function`) cancel Function that cancels all requests.
*vim.lsp.buf_request_sync()*
buf_request_sync({bufnr}, {method}, {params}, {timeout_ms})
@@ -697,89 +673,29 @@ buf_request_sync({bufnr}, {method}, {params}, {timeout_ms})
Calls |vim.lsp.buf_request_all()| but blocks Nvim while awaiting the
result. Parameters are the same as |vim.lsp.buf_request_all()| but the
- result is different. Waits a maximum of {timeout_ms} (default 1000) ms.
+ result is different. Waits a maximum of {timeout_ms}.
Parameters: ~
- • {bufnr} (integer) Buffer handle, or 0 for current.
- • {method} (string) LSP method name
- • {params} (table|nil) Parameters to send to the server
- • {timeout_ms} (integer|nil) Maximum time in milliseconds to wait for a
- result. Defaults to 1000
+ • {bufnr} (`integer`) Buffer handle, or 0 for current.
+ • {method} (`string`) LSP method name
+ • {params} (`table?`) Parameters to send to the server
+ • {timeout_ms} (`integer?`, default: `1000`) Maximum time in
+ milliseconds to wait for a result.
Return (multiple): ~
- (table) result Map of client_id:request_result.
- (string|nil) err On timeout, cancel, or error, `err` is a string
+ (`table<integer, {err: lsp.ResponseError, result: any}>?`) result Map
+ of client_id:request_result.
+ (`string?`) err On timeout, cancel, or error, `err` is a string
describing the failure reason, and `result` is nil.
-client() *vim.lsp.client*
- LSP client object. You can get an active client object via
- |vim.lsp.get_client_by_id()| or |vim.lsp.get_clients()|.
-
- • Methods:
- • request(method, params, [handler], bufnr) Sends a request to the
- server. This is a thin wrapper around {client.rpc.request} with some
- additional checking. If {handler} is not specified, If one is not
- found there, then an error will occur. Returns: {status},
- {[client_id]}. {status} is a boolean indicating if the notification
- was successful. If it is `false`, then it will always be `false` (the
- client has shutdown). If {status} is `true`, the function returns
- {request_id} as the second result. You can use this with
- `client.cancel_request(request_id)` to cancel the request.
- • request_sync(method, params, timeout_ms, bufnr) Sends a request to the
- server and synchronously waits for the response. This is a wrapper
- around {client.request} Returns: { err=err, result=result }, a
- dictionary, where `err` and `result` come from the |lsp-handler|. On
- timeout, cancel or error, returns `(nil, err)` where `err` is a string
- describing the failure reason. If the request was unsuccessful returns
- `nil`.
- • notify(method, params) Sends a notification to an LSP server. Returns:
- a boolean to indicate if the notification was successful. If it is
- false, then it will always be false (the client has shutdown).
- • cancel_request(id) Cancels a request with a given request id. Returns:
- same as `notify()`.
- • stop([force]) Stops a client, optionally with force. By default, it
- will just ask the server to shutdown without force. If you request to
- stop a client which has previously been requested to shutdown, it will
- automatically escalate and force shutdown.
- • is_stopped() Checks whether a client is stopped. Returns: true if the
- client is fully stopped.
- • on_attach(client, bufnr) Runs the on_attach function from the client's
- config if it was defined. Useful for buffer-local setup.
-
- • Members
- • {id} (number): The id allocated to the client.
- • {name} (string): If a name is specified on creation, that will be
- used. Otherwise it is just the client id. This is used for logs and
- messages.
- • {rpc} (table): RPC client object, for low level interaction with the
- client. See |vim.lsp.rpc.start()|.
- • {offset_encoding} (string): The encoding used for communicating with
- the server. You can modify this in the `config`'s `on_init` method
- before text is sent to the server.
- • {handlers} (table): The handlers used by the client as described in
- |lsp-handler|.
- • {requests} (table): The current pending requests in flight to the
- server. Entries are key-value pairs with the key being the request ID
- while the value is a table with `type`, `bufnr`, and `method`
- key-value pairs. `type` is either "pending" for an active request, or
- "cancel" for a cancel request. It will be "complete" ephemerally while
- executing |LspRequest| autocmds when replies are received from the
- server.
- • {config} (table): copy of the table that was passed by the user to
- |vim.lsp.start_client()|.
- • {server_capabilities} (table): Response from the server sent on
- `initialize` describing the server's capabilities.
- • {progress} A ring buffer (|vim.ringbuf()|) containing progress
- messages sent by the server.
-
client_is_stopped({client_id}) *vim.lsp.client_is_stopped()*
Checks whether a client is stopped.
Parameters: ~
- • {client_id} (integer)
+ • {client_id} (`integer`)
Return: ~
- (boolean) stopped true if client is stopped, false otherwise.
+ (`boolean`) stopped true if client is stopped, false otherwise.
commands *vim.lsp.commands*
Registry for client side commands. This is an extension point for plugins
@@ -803,68 +719,67 @@ formatexpr({opts}) *vim.lsp.formatexpr()*
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` via `vim.bo[bufnr].formatexpr =
- 'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})'`.
+ 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` via
+ `vim.bo[bufnr].formatexpr = 'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})'`.
Parameters: ~
- • {opts} (table) options for customizing the formatting expression
- which takes the following optional keys:
- • timeout_ms (default 500ms). The timeout period for the
- formatting request.
+ • {opts} (`table?`) A table with the following fields:
+ • {timeout_ms} (`integer`, default: 500ms) The timeout period
+ for the formatting request..
*vim.lsp.get_buffers_by_client_id()*
get_buffers_by_client_id({client_id})
Returns list of buffers attached to client_id.
Parameters: ~
- • {client_id} (integer) client id
+ • {client_id} (`integer`) client id
Return: ~
- integer[] buffers list of buffer ids
+ (`integer[]`) buffers list of buffer ids
get_client_by_id({client_id}) *vim.lsp.get_client_by_id()*
Gets a client by id, or nil if the id is invalid. The returned client may
not yet be fully initialized.
Parameters: ~
- • {client_id} (integer) client id
+ • {client_id} (`integer`) client id
Return: ~
- (nil|lsp.Client) client rpc object
+ (`vim.lsp.Client?`) client rpc object
get_clients({filter}) *vim.lsp.get_clients()*
Get active clients.
Parameters: ~
- • {filter} (table|nil) A table with key-value pairs used to filter the
- returned clients. The available keys are:
- • id (number): Only return clients with the given id
- • bufnr (number): Only return clients attached to this
+ • {filter} (`table?`) Key-value pairs used to filter the returned
+ clients.
+ • {id}? (`integer`) Only return clients with the given id
+ • {bufnr}? (`integer`) Only return clients attached to this
buffer
- • name (string): Only return clients with the given name
- • method (string): Only return clients supporting the given
- method
+ • {name}? (`string`) Only return clients with the given name
+ • {method}? (`string`) Only return clients supporting the
+ given method
Return: ~
- lsp.Client []: List of |vim.lsp.client| objects
+ (`vim.lsp.Client[]`) List of |vim.lsp.Client| objects
get_log_path() *vim.lsp.get_log_path()*
Gets the path of the logfile used by the LSP client.
Return: ~
- (string) path to log file
+ (`string`) path to log file
omnifunc({findstart}, {base}) *vim.lsp.omnifunc()*
Implements 'omnifunc' compatible LSP completion.
Parameters: ~
- • {findstart} (integer) 0 or 1, decides behavior
- • {base} (integer) findstart=0, text to match against
+ • {findstart} (`integer`) 0 or 1, decides behavior
+ • {base} (`integer`) findstart=0, text to match against
Return: ~
- integer|table Decided by {findstart}:
+ (`integer|table`) Decided by {findstart}:
• findstart=0: column where the completion starts, or -2 or -3
• findstart=1: list of matches (actually just calls |complete()|)
@@ -883,7 +798,7 @@ set_log_level({level}) *vim.lsp.set_log_level()*
Use `lsp.log_levels` for reverse lookup.
Parameters: ~
- • {level} (integer|string) the case insensitive level name or number
+ • {level} (`integer|string`) the case insensitive level name or number
See also: ~
• |vim.lsp.log_levels|
@@ -903,12 +818,10 @@ start({config}, {opts}) *vim.lsp.start()*
See |vim.lsp.start_client()| for all available options. The most important
are:
-
• `name` arbitrary name for the LSP client. Should be unique per language
server.
- • `cmd` command (in list form) used to start the language server. Must be
- absolute, or found on `$PATH`. Shell constructs like `~` are not
- expanded.
+ • `cmd` command string[] or function, described at
+ |vim.lsp.start_client()|.
• `root_dir` path to the project root. By default this is used to decide
if an existing client should be re-used. The example above uses
|vim.fs.find()| and |vim.fs.dirname()| to detect the root by traversing
@@ -928,135 +841,29 @@ start({config}, {opts}) *vim.lsp.start()*
`ftplugin/<filetype_name>.lua` (See |ftplugin-name|)
Parameters: ~
- • {config} (table) Same configuration as documented in
- |vim.lsp.start_client()|
- • {opts} (nil|lsp.StartOpts) Optional keyword arguments:
- • reuse_client (fun(client: client, config: table): boolean)
+ • {config} (`vim.lsp.ClientConfig`) Configuration for the server. See
+ |vim.lsp.ClientConfig|.
+ • {opts} (`table?`) Optional keyword arguments
+ • {reuse_client}
+ (`fun(client: vim.lsp.Client, config: table): boolean`)
Predicate used to decide if a client should be re-used.
Used on all running clients. The default implementation
re-uses a client if name and root_dir matches.
- • bufnr (number) Buffer handle to attach to if starting or
- re-using a client (0 for current).
+ • {bufnr} (`integer`) Buffer handle to attach to if starting
+ or re-using a client (0 for current).
Return: ~
- (integer|nil) client_id
+ (`integer?`) client_id
start_client({config}) *vim.lsp.start_client()*
Starts and initializes a client with the given configuration.
- Field `cmd` in {config} is required.
-
- Parameters: ~
- • {config} ( lsp.ClientConfig ) Configuration for the server:
- • cmd: (string[]|fun(dispatchers: table):table) command a
- list of strings treated like |jobstart()|. The command
- must launch the language server process. `cmd` can also be
- a function that creates an RPC client. The function
- receives a dispatchers table and must return a table with
- the functions `request`, `notify`, `is_closing` and
- `terminate` See |vim.lsp.rpc.request()| and
- |vim.lsp.rpc.notify()| For TCP there is a built-in rpc
- client factory: |vim.lsp.rpc.connect()|
- • cmd_cwd: (string, default=|getcwd()|) Directory to launch
- the `cmd` process. Not related to `root_dir`.
- • cmd_env: (table) Environment flags to pass to the LSP on
- spawn. Must be specified using a table. Non-string values
- are coerced to string. Example: >
-
- { PORT = 8080; HOST = "0.0.0.0"; }
-<
- • detached: (boolean, default true) Daemonize the server
- process so that it runs in a separate process group from
- Nvim. Nvim will shutdown the process on exit, but if Nvim
- fails to exit cleanly this could leave behind orphaned
- server processes.
- • workspace_folders: (table) List of workspace folders
- passed to the language server. For backwards compatibility
- rootUri and rootPath will be derived from the first
- workspace folder in this list. See `workspaceFolders` in
- the LSP spec.
- • capabilities: Map overriding the default capabilities
- defined by |vim.lsp.protocol.make_client_capabilities()|,
- passed to the language server on initialization. Hint: use
- make_client_capabilities() and modify its result.
- • Note: To send an empty dictionary use
- |vim.empty_dict()|, else it will be encoded as an array.
-
- • handlers: Map of language server method names to
- |lsp-handler|
- • settings: Map with language server specific settings.
- These are returned to the language server if requested via
- `workspace/configuration`. Keys are case-sensitive.
- • commands: table Table that maps string of clientside
- commands to user-defined functions. Commands passed to
- start_client take precedence over the global command
- registry. Each key must be a unique command name, and the
- value is a function which is called if any LSP action
- (code action, code lenses, ...) triggers the command.
- • init_options Values to pass in the initialization request
- as `initializationOptions`. See `initialize` in the LSP
- spec.
- • name: (string, default=client-id) Name in log messages.
- • get_language_id: function(bufnr, filetype) -> language ID
- as string. Defaults to the filetype.
- • offset_encoding: (default="utf-16") One of "utf-8",
- "utf-16", or "utf-32" which is the encoding that the LSP
- server expects. Client does not verify this is correct.
- • on_error: Callback with parameters (code, ...), invoked
- when the client operation throws an error. `code` is a
- number describing the error. Other arguments may be passed
- depending on the error kind. See
- `vim.lsp.rpc.client_errors` for possible errors. Use
- `vim.lsp.rpc.client_errors[code]` to get human-friendly
- name.
- • before_init: Callback with parameters (initialize_params,
- config) invoked before the LSP "initialize" phase, where
- `params` contains the parameters being sent to the server
- and `config` is the config that was passed to
- |vim.lsp.start_client()|. You can use this to modify
- parameters before they are sent.
- • on_init: Callback (client, initialize_result) invoked
- after LSP "initialize", where `result` is a table of
- `capabilities` and anything else the server may send. For
- example, clangd sends `initialize_result.offsetEncoding`
- if `capabilities.offsetEncoding` was sent to it. You can
- only modify the `client.offset_encoding` here before any
- notifications are sent. Most language servers expect to be
- sent client specified settings after initialization. Nvim
- does not make this assumption. A
- `workspace/didChangeConfiguration` notification should be
- sent to the server during on_init.
- • on_exit Callback (code, signal, client_id) invoked on
- client exit.
- • code: exit code of the process
- • signal: number describing the signal used to terminate
- (if any)
- • client_id: client handle
-
- • on_attach: Callback (client, bufnr) invoked when client
- attaches to a buffer.
- • trace: ("off" | "messages" | "verbose" | nil) passed
- directly to the language server in the initialize request.
- Invalid/empty values will default to "off"
- • flags: A table with flags for the client. The current
- (experimental) flags are:
- • allow_incremental_sync (bool, default true): Allow using
- incremental sync for buffer edits
- • debounce_text_changes (number, default 150): Debounce
- didChange notifications to the server by the given
- number in milliseconds. No debounce occurs if nil
- • exit_timeout (number|boolean, default false):
- Milliseconds to wait for server to exit cleanly after
- sending the "shutdown" request before sending kill -15.
- If set to false, nvim exits immediately after sending
- the "shutdown" request to the server.
-
- • root_dir: (string) Directory where the LSP server will
- base its workspaceFolders, rootUri, and rootPath on
- initialization.
+ Parameters: ~
+ • {config} (`vim.lsp.ClientConfig`) Configuration for the server. See
+ |vim.lsp.ClientConfig|.
Return: ~
- (integer|nil) client_id. |vim.lsp.get_client_by_id()| Note: client may
+ (`integer?`) client_id |vim.lsp.get_client_by_id()| Note: client may
not be fully initialized. Use `on_init` to do any actions once the
client has been initialized.
@@ -1065,12 +872,12 @@ status() *vim.lsp.status()*
a string. Empty if there are no clients or if no new messages
Return: ~
- (string)
+ (`string`)
stop_client({client_id}, {force}) *vim.lsp.stop_client()*
Stops a client(s).
- You can also use the `stop()` function on a |vim.lsp.client| object. To
+ You can also use the `stop()` function on a |vim.lsp.Client| object. To
stop all clients: >lua
vim.lsp.stop_client(vim.lsp.get_clients())
<
@@ -1079,9 +886,9 @@ stop_client({client_id}, {force}) *vim.lsp.stop_client()*
for this client, then force-shutdown is attempted.
Parameters: ~
- • {client_id} integer|table id or |vim.lsp.client| object, or list
- thereof
- • {force} (boolean|nil) shutdown forcefully
+ • {client_id} (`integer|vim.lsp.Client`) id or |vim.lsp.Client| object,
+ or list thereof
+ • {force} (`boolean?`) shutdown forcefully
tagfunc({pattern}, {flags}) *vim.lsp.tagfunc()*
Provides an interface between the built-in client and 'tagfunc'.
@@ -1092,29 +899,325 @@ tagfunc({pattern}, {flags}) *vim.lsp.tagfunc()*
LSP servers, falls back to using built-in tags.
Parameters: ~
- • {pattern} (string) Pattern used to find a workspace symbol
- • {flags} (string) See |tag-function|
+ • {pattern} (`string`) Pattern used to find a workspace symbol
+ • {flags} (`string`) See |tag-function|
Return: ~
- table[] tags A list of matching tags
+ (`table[]`) tags A list of matching tags
with({handler}, {override_config}) *vim.lsp.with()*
Function to manage overriding defaults for LSP handlers.
Parameters: ~
- • {handler} (function) See |lsp-handler|
- • {override_config} (table) Table containing the keys to override
+ • {handler} (`lsp.Handler`) See |lsp-handler|
+ • {override_config} (`table`) Table containing the keys to override
behavior of the {handler}
==============================================================================
+Lua module: vim.lsp.client *lsp-client*
+
+*vim.lsp.Client*
+
+ Fields: ~
+ • {id} (`integer`) The id allocated to the client.
+ • {name} (`string`) If a name is specified on creation,
+ that will be used. Otherwise it is just the
+ client id. This is used for logs and messages.
+ • {rpc} (`vim.lsp.rpc.PublicClient`) RPC client
+ object, for low level interaction with the
+ client. See |vim.lsp.rpc.start()|.
+ • {offset_encoding} (`string`) The encoding used for communicating
+ with the server. You can modify this in the
+ `config`'s `on_init` method before text is
+ sent to the server.
+ • {handlers} (`table<string,lsp.Handler>`) The handlers
+ used by the client as described in
+ |lsp-handler|.
+ • {requests} (`table<integer,{ type: string, bufnr: integer, method: string}>`)
+ The current pending requests in flight to the
+ server. Entries are key-value pairs with the
+ key being the request id while the value is a
+ table with `type`, `bufnr`, and `method`
+ key-value pairs. `type` is either "pending"
+ for an active request, or "cancel" for a
+ cancel request. It will be "complete"
+ ephemerally while executing |LspRequest|
+ autocmds when replies are received from the
+ server.
+ • {config} (`vim.lsp.ClientConfig`) copy of the table
+ that was passed by the user to
+ |vim.lsp.start_client()|. See
+ |vim.lsp.ClientConfig|.
+ • {server_capabilities} (`lsp.ServerCapabilities?`) Response from the
+ server sent on `initialize` describing the
+ server's capabilities.
+ • {progress} (`vim.lsp.Client.Progress`) A ring buffer
+ (|vim.ringbuf()|) containing progress messages
+ sent by the server. See
+ |vim.lsp.Client.Progress|.
+ • {initialized} (`true?`)
+ • {workspace_folders} (`lsp.WorkspaceFolder[]?`) The workspace
+ folders configured in the client when the
+ server starts. This property is only available
+ if the client supports workspace folders. It
+ can be `null` if the client supports workspace
+ folders but none are configured.
+ • {root_dir} (`string`)
+ • {attached_buffers} (`table<integer,true>`)
+ • {commands} (`table<string,fun(command: lsp.Command, ctx: table)>`)
+ Table of command name to function which is
+ called if any LSP action (code action, code
+ lenses, ...) triggers the command. Client
+ commands take precedence over the global
+ command registry.
+ • {settings} (`table`) Map with language server specific
+ settings. These are returned to the language
+ server if requested via
+ `workspace/configuration`. Keys are
+ case-sensitive.
+ • {flags} (`table`) A table with flags for the client.
+ The current (experimental) flags are:
+ • {allow_incremental_sync}? (`boolean`) Allow
+ using incremental sync for buffer edits
+ (defailt: `true`)
+ • {debounce_text_changes} (`integer`, default:
+ `150`) Debounce `didChange` notifications to
+ the server by the given number in
+ milliseconds. No debounce occurs if `nil`.
+ • {exit_timeout} (`integer|false`, default:
+ `false`) Milliseconds to wait for server to
+ exit cleanly after sending the "shutdown"
+ request before sending kill -15. If set to
+ false, nvim exits immediately after sending
+ the "shutdown" request to the server.
+ • {get_language_id} (`fun(bufnr: integer, filetype: string): string`)
+ • {capabilities} (`lsp.ClientCapabilities`) The capabilities
+ provided by the client (editor or tool)
+ • {dynamic_capabilities} (`lsp.DynamicCapabilities`)
+ • {request} (`fun(method: string, params: table?, handler: lsp.Handler?, bufnr: integer): boolean, integer?`)
+ Sends a request to the server. This is a thin
+ wrapper around {client.rpc.request} with some
+ additional checking. If {handler} is not
+ specified and if there's no respective global
+ handler, then an error will occur. Returns:
+ {status}, {client_id}?. {status} is a boolean
+ indicating if the notification was successful.
+ If it is `false`, then it will always be
+ `false` (the client has shutdown). If {status}
+ is `true`, the function returns {request_id}
+ as the second result. You can use this with
+ `client.cancel_request(request_id)` to cancel
+ the request.
+ • {request_sync} (`fun(method: string, params: table?, timeout_ms: integer?, bufnr: integer): {err: lsp.ResponseError?, result:any}?, string?`)
+ err # a dictionary, where
+ • {notify} (`fun(method: string, params: table?): boolean`)
+ Sends a notification to an LSP server.
+ Returns: a boolean to indicate if the
+ notification was successful. If it is false,
+ then it will always be false (the client has
+ shutdown).
+ • {cancel_request} (`fun(id: integer): boolean`) Cancels a
+ request with a given request id. Returns: same
+ as `notify()`.
+ • {stop} (`fun(force?: boolean)`) Stops a client,
+ optionally with force. By default, it will
+ just ask the server to shutdown without force.
+ If you request to stop a client which has
+ previously been requested to shutdown, it will
+ automatically escalate and force shutdown.
+ • {on_attach} (`fun(bufnr: integer)`) Runs the on_attach
+ function from the client's config if it was
+ defined. Useful for buffer-local setup.
+ • {supports_method} (`fun(method: string, opts?: {bufnr: integer?}): boolean`)
+ Checks if a client supports a given method.
+ Always returns true for unknown off-spec
+ methods. {opts} is a optional
+ `{bufnr?: integer}` table. Some language
+ server capabilities can be file specific.
+ • {is_stopped} (`fun(): boolean`) Checks whether a client is
+ stopped. Returns: true if the client is fully
+ stopped.
+
+*vim.lsp.Client.Progress*
+ Extends: |vim.Ringbuf|
+
+
+ Fields: ~
+ • {pending} (`table<lsp.ProgressToken,lsp.LSPAny>`)
+
+*vim.lsp.ClientConfig*
+
+ Fields: ~
+ • {cmd} (`string[]|fun(dispatchers: vim.lsp.rpc.Dispatchers): vim.lsp.rpc.PublicClient?`)
+ command string[] that launches the language
+ server (treated as in |jobstart()|, must be
+ absolute or on `$PATH`, shell constructs like
+ "~" are not expanded), or function that creates
+ an RPC client. Function receives a `dispatchers`
+ table and returns a table with member functions
+ `request`, `notify`, `is_closing` and
+ `terminate`. See |vim.lsp.rpc.request()|,
+ |vim.lsp.rpc.notify()|. For TCP there is a
+ builtin RPC client factory:
+ |vim.lsp.rpc.connect()|
+ • {cmd_cwd}? (`string`, default: cwd) Directory to launch the
+ `cmd` process. Not related to `root_dir`.
+ • {cmd_env}? (`table`) Environment flags to pass to the LSP
+ on spawn. Must be specified using a table.
+ Non-string values are coerced to string.
+ Example: >lua
+ { PORT = 8080; HOST = "0.0.0.0"; }
+<
+ • {detached}? (`boolean`, default: true) Daemonize the server
+ process so that it runs in a separate process
+ group from Nvim. Nvim will shutdown the process
+ on exit, but if Nvim fails to exit cleanly this
+ could leave behind orphaned server processes.
+ • {workspace_folders}? (`lsp.WorkspaceFolder[]`) List of workspace
+ folders passed to the language server. For
+ backwards compatibility rootUri and rootPath
+ will be derived from the first workspace folder
+ in this list. See `workspaceFolders` in the LSP
+ spec.
+ • {capabilities}? (`lsp.ClientCapabilities`) Map overriding the
+ default capabilities defined by
+ |vim.lsp.protocol.make_client_capabilities()|,
+ passed to the language server on initialization.
+ Hint: use make_client_capabilities() and modify
+ its result.
+ • Note: To send an empty dictionary use
+ |vim.empty_dict()|, else it will be encoded as
+ an array.
+ • {handlers}? (`table<string,function>`) Map of language
+ server method names to |lsp-handler|
+ • {settings}? (`table`) Map with language server specific
+ settings. See the {settings} in
+ |vim.lsp.Client|.
+ • {commands}? (`table<string,fun(command: lsp.Command, ctx: table)>`)
+ Table that maps string of clientside commands to
+ user-defined functions. Commands passed to
+ start_client take precedence over the global
+ command registry. Each key must be a unique
+ command name, and the value is a function which
+ is called if any LSP action (code action, code
+ lenses, ...) triggers the command.
+ • {init_options}? (`table`) Values to pass in the initialization
+ request as `initializationOptions`. See
+ `initialize` in the LSP spec.
+ • {name}? (`string`, default: client-id) Name in log
+ messages.
+ • {get_language_id}? (`fun(bufnr: integer, filetype: string): string`)
+ Language ID as string. Defaults to the filetype.
+ • {offset_encoding}? (`'utf-8'|'utf-16'|'utf-32'`) The encoding that
+ the LSP server expects. Client does not verify
+ this is correct.
+ • {on_error}? (`fun(code: integer, err: string)`) Callback
+ invoked when the client operation throws an
+ error. `code` is a number describing the error.
+ Other arguments may be passed depending on the
+ error kind. See `vim.lsp.rpc.client_errors` for
+ possible errors. Use
+ `vim.lsp.rpc.client_errors[code]` to get
+ human-friendly name.
+ • {before_init}? (`fun(params: lsp.InitializeParams, config: vim.lsp.ClientConfig)`)
+ Callback invoked before the LSP "initialize"
+ phase, where `params` contains the parameters
+ being sent to the server and `config` is the
+ config that was passed to
+ |vim.lsp.start_client()|. You can use this to
+ modify parameters before they are sent.
+ • {on_init}? (`elem_or_list<fun(client: vim.lsp.Client, initialize_result: lsp.InitializeResult)>`)
+ Callback invoked after LSP "initialize", where
+ `result` is a table of `capabilities` and
+ anything else the server may send. For example,
+ clangd sends `initialize_result.offsetEncoding`
+ if `capabilities.offsetEncoding` was sent to it.
+ You can only modify the `client.offset_encoding`
+ here before any notifications are sent.
+ • {on_exit}? (`elem_or_list<fun(code: integer, signal: integer, client_id: integer)>`)
+ Callback invoked on client exit.
+ • code: exit code of the process
+ • signal: number describing the signal used to
+ terminate (if any)
+ • client_id: client handle
+ • {on_attach}? (`elem_or_list<fun(client: vim.lsp.Client, bufnr: integer)>`)
+ Callback invoked when client attaches to a
+ buffer.
+ • {trace}? (`'off'|'messages'|'verbose'`, default: "off")
+ Passed directly to the language server in the
+ initialize request. Invalid/empty values will
+ • {flags}? (`table`) A table with flags for the client. The
+ current (experimental) flags are:
+ • {allow_incremental_sync}? (`boolean`) Allow
+ using incremental sync for buffer edits
+ (defailt: `true`)
+ • {debounce_text_changes} (`integer`, default:
+ `150`) Debounce `didChange` notifications to
+ the server by the given number in
+ milliseconds. No debounce occurs if `nil`.
+ • {exit_timeout} (`integer|false`, default:
+ `false`) Milliseconds to wait for server to
+ exit cleanly after sending the "shutdown"
+ request before sending kill -15. If set to
+ false, nvim exits immediately after sending
+ the "shutdown" request to the server.
+ • {root_dir}? (`string`) Directory where the LSP server will
+ base its workspaceFolders, rootUri, and rootPath
+ on initialization.
+
+
+
+==============================================================================
Lua module: vim.lsp.buf *lsp-buf*
+*vim.lsp.ListOpts*
+
+ Fields: ~
+ • {on_list}? (`fun(t: vim.lsp.LocationOpts.OnList)`) list-handler
+ replacing the default handler. Called for any non-empty
+ result. This table can be used with |setqflist()| or
+ |setloclist()|. E.g.: >lua
+ local function on_list(options)
+ vim.fn.setqflist({}, ' ', options)
+ vim.cmd.cfirst()
+ end
+
+ vim.lsp.buf.definition({ on_list = on_list })
+ vim.lsp.buf.references(nil, { on_list = on_list })
+<
+
+ If you prefer loclist do something like this: >lua
+ local function on_list(options)
+ vim.fn.setloclist(0, {}, ' ', options)
+ vim.cmd.lopen()
+ end
+<
+
+*vim.lsp.LocationOpts*
+ Extends: |vim.lsp.ListOpts|
+
+
+ Fields: ~
+ • {reuse_win}? (`boolean`) Jump to existing window if buffer is already
+ open.
+
+*vim.lsp.LocationOpts.OnList*
+
+ Fields: ~
+ • {items} (`table[]`) Structured like |setqflist-what|
+ • {title}? (`string`) Title for the list.
+ • {context}? (`table`) `ctx` from |lsp-handler|
+
+
*vim.lsp.buf.add_workspace_folder()*
add_workspace_folder({workspace_folder})
Add the folder at path to the workspace folders. If {path} is not
provided, the user will be prompted for a path using |input()|.
+ Parameters: ~
+ • {workspace_folder} (`string?`)
+
clear_references() *vim.lsp.buf.clear_references()*
Removes document highlights from current buffer.
@@ -1122,27 +1225,26 @@ code_action({options}) *vim.lsp.buf.code_action()*
Selects a code action available at the current cursor position.
Parameters: ~
- • {options} (table|nil) Optional table which holds the following
- optional fields:
- • context: (table|nil) Corresponds to `CodeActionContext` of the LSP specification:
- • diagnostics (table|nil): LSP `Diagnostic[]`. Inferred
+ • {options} (`table?`) A table with the following fields:
+ • {context}? (`lsp.CodeActionContext`) Corresponds to
+ `CodeActionContext` of the LSP specification:
+ • {diagnostics}? (`table`) LSP `Diagnostic[]`. Inferred
from the current position if not provided.
- • only (table|nil): List of LSP `CodeActionKind`s used to
+ • {only}? (`table`) List of LSP `CodeActionKind`s used to
filter the code actions. Most language servers support
values like `refactor` or `quickfix`.
- • triggerKind (number|nil): The reason why code actions
+ • {triggerKind}? (`integer`) The reason why code actions
were requested.
-
- • filter: (function|nil) Predicate taking an `CodeAction`
- and returning a boolean.
- • apply: (boolean|nil) When set to `true`, and there is
+ • {filter}? (`fun(x: lsp.CodeAction|lsp.Command):boolean`)
+ Predicate taking an `CodeAction` and returning a boolean.
+ • {apply}? (`boolean`) When set to `true`, and there is
just one remaining action (after filtering), the action
is applied without user query.
- • range: (table|nil) Range for which code actions should be
- requested. If in visual mode this defaults to the active
- selection. Table must contain `start` and `end` keys with
- {row,col} tuples using mark-like indexing. See
- |api-indexing|
+ • {range}? (`{start: integer[], end: integer[]}`) Range for
+ which code actions should be requested. If in visual mode
+ this defaults to the active selection. Table must contain
+ `start` and `end` keys with {row,col} tuples using
+ mark-like indexing. See |api-indexing|
See also: ~
• https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction
@@ -1153,7 +1255,7 @@ completion({context}) *vim.lsp.buf.completion()*
called in Insert mode.
Parameters: ~
- • {context} (table) (context support not yet implemented) Additional
+ • {context} (`table`) (context support not yet implemented) Additional
information about the context in which a completion was
triggered (how it was triggered, and by which trigger
character, if applicable)
@@ -1169,21 +1271,13 @@ declaration({options}) *vim.lsp.buf.declaration()*
|vim.lsp.buf.definition()| instead.
Parameters: ~
- • {options} (table|nil) additional options
- • reuse_win: (boolean) Jump to existing window if buffer is
- already open.
- • on_list: (function) |lsp-on-list-handler| replacing the
- default handler. Called for any non-empty result.
+ • {options} (`vim.lsp.LocationOpts?`) See |vim.lsp.LocationOpts|.
definition({options}) *vim.lsp.buf.definition()*
Jumps to the definition of the symbol under the cursor.
Parameters: ~
- • {options} (table|nil) additional options
- • reuse_win: (boolean) Jump to existing window if buffer is
- already open.
- • on_list: (function) |lsp-on-list-handler| replacing the
- default handler. Called for any non-empty result.
+ • {options} (`vim.lsp.LocationOpts?`) See |vim.lsp.LocationOpts|.
document_highlight() *vim.lsp.buf.document_highlight()*
Send request to the server to resolve document highlights for the current
@@ -1203,15 +1297,13 @@ document_symbol({options}) *vim.lsp.buf.document_symbol()*
Lists all symbols in the current buffer in the quickfix window.
Parameters: ~
- • {options} (table|nil) additional options
- • on_list: (function) handler for list results. See
- |lsp-on-list-handler|
+ • {options} (`vim.lsp.ListOpts?`) See |vim.lsp.ListOpts|.
execute_command({command_params}) *vim.lsp.buf.execute_command()*
Executes an LSP server command.
Parameters: ~
- • {command_params} (table) A valid `ExecuteCommandParams` object
+ • {command_params} (`lsp.ExecuteCommandParams`)
See also: ~
• https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand
@@ -1221,38 +1313,37 @@ format({options}) *vim.lsp.buf.format()*
server clients.
Parameters: ~
- • {options} (table|nil) Optional table which holds the following
- optional fields:
- • formatting_options (table|nil): Can be used to specify
+ • {options} (`table?`) A table with the following fields:
+ • {formatting_options}? (`table`) Can be used to specify
FormattingOptions. Some unspecified options will be
- automatically derived from the current Nvim options. See https://microsoft.github.io/language-server-protocol/specification/#formattingOptions
- • timeout_ms (integer|nil, default 1000): Time in
+ automatically derived from the current Nvim options. See
+ https://microsoft.github.io/language-server-protocol/specification/#formattingOptions
+ • {timeout_ms}? (`integer`, default: `1000`) Time in
milliseconds to block for formatting requests. No effect
- if async=true
- • bufnr (number|nil): Restrict formatting to the clients
- attached to the given buffer, defaults to the current
- buffer (0).
- • filter (function|nil): Predicate used to filter clients.
- Receives a client as argument and must return a boolean.
- Clients matching the predicate are included. Example: >lua
-
- -- Never request typescript-language-server for formatting
- vim.lsp.buf.format {
- filter = function(client) return client.name ~= "tsserver" end
- }
+ if async=true.
+ • {bufnr}? (`integer`, default: current buffer) Restrict
+ formatting to the clients attached to the given buffer.
+ • {filter}? (`fun(client: vim.lsp.Client): boolean?`)
+ Predicate used to filter clients. Receives a client as
+ argument and must return a boolean. Clients matching the
+ predicate are included. Example: >lua
+ -- Never request typescript-language-server for formatting
+ vim.lsp.buf.format {
+ filter = function(client) return client.name ~= "tsserver" end
+ }
<
- • async boolean|nil If true the method won't block.
- Defaults to false. Editing the buffer while formatting
+ • {async}? (`boolean`, default: false) If true the method
+ won't block. Editing the buffer while formatting
asynchronous can lead to unexpected changes.
- • id (number|nil): Restrict formatting to the client with
+ • {id}? (`integer`) Restrict formatting to the client with
ID (client.id) matching this field.
- • name (string|nil): Restrict formatting to the client with
+ • {name}? (`string`) Restrict formatting to the client with
name (client.name) matching this field.
- • range (table|nil) Range to format. Table must contain
- `start` and `end` keys with {row,col} tuples using (1,0)
- indexing. Defaults to current selection in visual mode
- Defaults to `nil` in other modes, formatting the full
- buffer
+ • {range}? (`{start:integer[],end:integer[]}`, default:
+ current selection in visual mode, `nil` in other modes,
+ formatting the full buffer) Range to format. Table must
+ contain `start` and `end` keys with {row,col} tuples
+ using (1,0) indexing.
hover() *vim.lsp.buf.hover()*
Displays hover information about the symbol under the cursor in a floating
@@ -1263,9 +1354,7 @@ implementation({options}) *vim.lsp.buf.implementation()*
quickfix window.
Parameters: ~
- • {options} (table|nil) additional options
- • on_list: (function) |lsp-on-list-handler| replacing the
- default handler. Called for any non-empty result.
+ • {options} (`vim.lsp.LocationOpts?`) See |vim.lsp.LocationOpts|.
incoming_calls() *vim.lsp.buf.incoming_calls()*
Lists all the call sites of the symbol under the cursor in the |quickfix|
@@ -1285,10 +1374,8 @@ references({context}, {options}) *vim.lsp.buf.references()*
window.
Parameters: ~
- • {context} (table|nil) Context for the request
- • {options} (table|nil) additional options
- • on_list: (function) handler for list results. See
- |lsp-on-list-handler|
+ • {context} (`table?`) Context for the request
+ • {options} (`vim.lsp.ListOpts?`) See |vim.lsp.ListOpts|.
See also: ~
• https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_references
@@ -1298,18 +1385,23 @@ remove_workspace_folder({workspace_folder})
Remove the folder at path from the workspace folders. If {path} is not
provided, the user will be prompted for a path using |input()|.
+ Parameters: ~
+ • {workspace_folder} (`string?`)
+
rename({new_name}, {options}) *vim.lsp.buf.rename()*
Renames all references to the symbol under the cursor.
Parameters: ~
- • {new_name} (string|nil) If not provided, the user will be prompted
- for a new name using |vim.ui.input()|.
- • {options} (table|nil) additional options
- • filter (function|nil): Predicate used to filter clients.
- Receives a client as argument and must return a boolean.
- Clients matching the predicate are included.
- • name (string|nil): Restrict clients used for rename to
+ • {new_name} (`string?`) If not provided, the user will be prompted for
+ a new name using |vim.ui.input()|.
+ • {options} (`table?`) Additional options:
+ • {filter}? (`fun(client: vim.lsp.Client): boolean?`)
+ Predicate used to filter clients. Receives a client as
+ argument and must return a boolean. Clients matching the
+ predicate are included.
+ • {name}? (`string`) Restrict clients used for rename to
ones where client.name matches this field.
+ • {bufnr}? (`integer`) (default: current buffer)
signature_help() *vim.lsp.buf.signature_help()*
Displays signature information about the symbol under the cursor in a
@@ -1319,11 +1411,7 @@ type_definition({options}) *vim.lsp.buf.type_definition()*
Jumps to the definition of the type of the symbol under the cursor.
Parameters: ~
- • {options} (table|nil) additional options
- • reuse_win: (boolean) Jump to existing window if buffer is
- already open.
- • on_list: (function) |lsp-on-list-handler| replacing the
- default handler. Called for any non-empty result.
+ • {options} (`vim.lsp.LocationOpts?`) See |vim.lsp.LocationOpts|.
workspace_symbol({query}, {options}) *vim.lsp.buf.workspace_symbol()*
Lists all symbols in the current workspace in the quickfix window.
@@ -1333,10 +1421,8 @@ workspace_symbol({query}, {options}) *vim.lsp.buf.workspace_symbol()*
string means no filtering is done.
Parameters: ~
- • {query} (string|nil) optional
- • {options} (table|nil) additional options
- • on_list: (function) handler for list results. See
- |lsp-on-list-handler|
+ • {query} (`string?`) optional
+ • {options} (`vim.lsp.ListOpts?`) See |vim.lsp.ListOpts|.
==============================================================================
@@ -1348,8 +1434,8 @@ get_namespace({client_id}, {is_pull})
|vim.diagnostic| for diagnostics
Parameters: ~
- • {client_id} (integer) The id of the LSP client
- • {is_pull} boolean? Whether the namespace is for a pull or push
+ • {client_id} (`integer`) The id of the LSP client
+ • {is_pull} (`boolean?`) Whether the namespace is for a pull or push
client. Defaults to push
*vim.lsp.diagnostic.on_diagnostic()*
@@ -1378,7 +1464,10 @@ on_diagnostic({_}, {result}, {ctx}, {config})
<
Parameters: ~
- • {config} (table) Configuration table (see |vim.diagnostic.config()|).
+ • {result} (`lsp.DocumentDiagnosticReport`)
+ • {ctx} (`lsp.HandlerContext`)
+ • {config} (`vim.diagnostic.Opts`) Configuration table (see
+ |vim.diagnostic.config()|).
*vim.lsp.diagnostic.on_publish_diagnostics()*
on_publish_diagnostics({_}, {result}, {ctx}, {config})
@@ -1406,7 +1495,10 @@ on_publish_diagnostics({_}, {result}, {ctx}, {config})
<
Parameters: ~
- • {config} (table) Configuration table (see |vim.diagnostic.config()|).
+ • {result} (`lsp.PublishDiagnosticsParams`)
+ • {ctx} (`lsp.HandlerContext`)
+ • {config} (`vim.diagnostic.Opts?`) Configuration table (see
+ |vim.diagnostic.config()|).
==============================================================================
@@ -1416,40 +1508,50 @@ clear({client_id}, {bufnr}) *vim.lsp.codelens.clear()*
Clear the lenses
Parameters: ~
- • {client_id} (integer|nil) filter by client_id. All clients if nil
- • {bufnr} (integer|nil) filter by buffer. All buffers if nil
+ • {client_id} (`integer?`) filter by client_id. All clients if nil
+ • {bufnr} (`integer?`) filter by buffer. All buffers if nil, 0 for
+ current buffer
display({lenses}, {bufnr}, {client_id}) *vim.lsp.codelens.display()*
Display the lenses using virtual text
Parameters: ~
- • {lenses} lsp.CodeLens[]|nil lenses to display
- • {bufnr} (integer)
- • {client_id} (integer)
+ • {lenses} (`lsp.CodeLens[]?`) lenses to display
+ • {bufnr} (`integer`)
+ • {client_id} (`integer`)
get({bufnr}) *vim.lsp.codelens.get()*
Return all lenses for the given buffer
Parameters: ~
- • {bufnr} (integer) Buffer number. 0 can be used for the current
+ • {bufnr} (`integer`) Buffer number. 0 can be used for the current
buffer.
Return: ~
- lsp.CodeLens[]
+ (`lsp.CodeLens[]`)
- *vim.lsp.codelens.on_codelens()*
-on_codelens({err}, {result}, {ctx}, {_})
+on_codelens({err}, {result}, {ctx}) *vim.lsp.codelens.on_codelens()*
|lsp-handler| for the method `textDocument/codeLens`
-refresh() *vim.lsp.codelens.refresh()*
- Refresh the codelens for the current buffer
+ Parameters: ~
+ • {err} (`lsp.ResponseError?`)
+ • {result} (`lsp.CodeLens[]`)
+ • {ctx} (`lsp.HandlerContext`)
+
+refresh({opts}) *vim.lsp.codelens.refresh()*
+ Refresh the lenses.
It is recommended to trigger this using an autocmd or via keymap.
Example: >vim
- autocmd BufEnter,CursorHold,InsertLeave <buffer> lua vim.lsp.codelens.refresh()
+ autocmd BufEnter,CursorHold,InsertLeave <buffer> lua vim.lsp.codelens.refresh({ bufnr = 0 })
<
+ Parameters: ~
+ • {opts} (`table?`) Optional fields
+ • {bufnr} (`integer?`) filter by buffer. All buffers if nil, 0
+ for current buffer
+
run() *vim.lsp.codelens.run()*
Run the code lens in the current line
@@ -1457,23 +1559,27 @@ save({lenses}, {bufnr}, {client_id}) *vim.lsp.codelens.save()*
Store lenses for a specific buffer and client
Parameters: ~
- • {lenses} lsp.CodeLens[]|nil lenses to store
- • {bufnr} (integer)
- • {client_id} (integer)
+ • {lenses} (`lsp.CodeLens[]?`) lenses to store
+ • {bufnr} (`integer`)
+ • {client_id} (`integer`)
==============================================================================
Lua module: vim.lsp.inlay_hint *lsp-inlay_hint*
enable({bufnr}, {enable}) *vim.lsp.inlay_hint.enable()*
- Enable/disable/toggle inlay hints for a buffer
+ Enables or disables inlay hints for a buffer.
+
+ To "toggle", pass the inverse of `is_enabled()`: >lua
+ vim.lsp.inlay_hint.enable(0, not vim.lsp.inlay_hint.is_enabled())
+<
Note: ~
- This API is pre-release (unstable).
+ • This API is pre-release (unstable).
Parameters: ~
- • {bufnr} (integer|nil) Buffer handle, or 0 or nil for current
- • {enable} (boolean|nil) true/nil to enable, false to disable
+ • {bufnr} (`integer?`) Buffer handle, or 0 or nil for current
+ • {enable} (`boolean?`) true/nil to enable, false to disable
get({filter}) *vim.lsp.inlay_hint.get()*
Get the list of inlay hints, (optionally) restricted by buffer or range.
@@ -1493,28 +1599,29 @@ get({filter}) *vim.lsp.inlay_hint.get()*
<
Note: ~
- This API is pre-release (unstable).
+ • This API is pre-release (unstable).
Parameters: ~
- • {filter} vim.lsp.inlay_hint.get.filter ? Optional filters |kwargs|:
- • bufnr (integer?): 0 for current buffer
- • range (lsp.Range?)
+ • {filter} (`table?`) Optional filters |kwargs|:
+ • {bufnr} (`integer?`)
+ • {range} (`lsp.Range?`)
Return: ~
- vim.lsp.inlay_hint.get.ret [] Each list item is a table with the following fields:
- • bufnr (integer)
- • client_id (integer)
- • inlay_hint (lsp.InlayHint)
+ (`table[]`) A list of objects with the following fields:
+ • {bufnr} (`integer`)
+ • {client_id} (`integer`)
+ • {inlay_hint} (`lsp.InlayHint`)
is_enabled({bufnr}) *vim.lsp.inlay_hint.is_enabled()*
+
Note: ~
- This API is pre-release (unstable).
+ • This API is pre-release (unstable).
Parameters: ~
- • {bufnr} (integer|nil) Buffer handle, or 0 or nil for current
+ • {bufnr} (`integer?`) Buffer handle, or 0 or nil for current
Return: ~
- (boolean)
+ (`boolean`)
==============================================================================
@@ -1527,7 +1634,7 @@ force_refresh({bufnr}) *vim.lsp.semantic_tokens.force_refresh()*
highlighting (|vim.lsp.semantic_tokens.start()| has been called for it)
Parameters: ~
- • {bufnr} (integer|nil) filter by buffer. All buffers if nil, current
+ • {bufnr} (`integer?`) filter by buffer. All buffers if nil, current
buffer if 0
*vim.lsp.semantic_tokens.get_at_pos()*
@@ -1536,12 +1643,12 @@ get_at_pos({bufnr}, {row}, {col})
arguments, returns the token under the cursor.
Parameters: ~
- • {bufnr} (integer|nil) Buffer number (0 for current buffer, default)
- • {row} (integer|nil) Position row (default cursor position)
- • {col} (integer|nil) Position column (default cursor position)
+ • {bufnr} (`integer?`) Buffer number (0 for current buffer, default)
+ • {row} (`integer?`) Position row (default cursor position)
+ • {col} (`integer?`) Position column (default cursor position)
Return: ~
- (table|nil) List of tokens at position. Each token has the following
+ (`table?`) List of tokens at position. Each token has the following
fields:
• line (integer) line number, 0-based
• start_col (integer) start column, 0-based
@@ -1549,6 +1656,7 @@ get_at_pos({bufnr}, {row}, {col})
• type (string) token type as string, e.g. "variable"
• modifiers (table) token modifiers as a set. E.g., { static = true,
readonly = true }
+ • client_id (integer)
*vim.lsp.semantic_tokens.highlight_token()*
highlight_token({token}, {bufnr}, {client_id}, {hl_group}, {opts})
@@ -1560,15 +1668,15 @@ highlight_token({token}, {bufnr}, {client_id}, {hl_group}, {opts})
use inside |LspTokenUpdate| callbacks.
Parameters: ~
- • {token} (table) a semantic token, found as `args.data.token` in
+ • {token} (`table`) a semantic token, found as `args.data.token` in
|LspTokenUpdate|.
- • {bufnr} (integer) the buffer to highlight
- • {client_id} (integer) The ID of the |vim.lsp.client|
- • {hl_group} (string) Highlight group name
- • {opts} (table|nil) Optional parameters.
- • priority: (integer|nil) Priority for the applied
- extmark. Defaults to
- `vim.highlight.priorities.semantic_tokens + 3`
+ • {bufnr} (`integer`) the buffer to highlight
+ • {client_id} (`integer`) The ID of the |vim.lsp.Client|
+ • {hl_group} (`string`) Highlight group name
+ • {opts} (`table?`) Optional parameters:
+ • {priority}? (`integer`, default:
+ `vim.highlight.priorities.semantic_tokens + 3`)
+ Priority for the applied extmark.
start({bufnr}, {client_id}, {opts}) *vim.lsp.semantic_tokens.start()*
Start the semantic token highlighting engine for the given buffer with the
@@ -1583,9 +1691,9 @@ start({bufnr}, {client_id}, {opts}) *vim.lsp.semantic_tokens.start()*
<
Parameters: ~
- • {bufnr} (integer)
- • {client_id} (integer)
- • {opts} (nil|table) Optional keyword arguments
+ • {bufnr} (`integer`)
+ • {client_id} (`integer`)
+ • {opts} (`table?`) Optional keyword arguments
• debounce (integer, default: 200): Debounce token
requests to the server by the given number in
milliseconds
@@ -1600,8 +1708,8 @@ stop({bufnr}, {client_id}) *vim.lsp.semantic_tokens.stop()*
from the buffer.
Parameters: ~
- • {bufnr} (integer)
- • {client_id} (integer)
+ • {bufnr} (`integer`)
+ • {client_id} (`integer`)
==============================================================================
@@ -1620,7 +1728,9 @@ hover({_}, {result}, {ctx}, {config}) *vim.lsp.handlers.hover()*
<
Parameters: ~
- • {config} (table) Configuration table.
+ • {result} (`lsp.Hover`)
+ • {ctx} (`lsp.HandlerContext`)
+ • {config} (`table`) Configuration table.
• border: (default=nil)
• Add borders to the floating window
• See |vim.lsp.util.open_floating_preview()| for more
@@ -1640,9 +1750,9 @@ signature_help({_}, {result}, {ctx}, {config})
<
Parameters: ~
- • {result} (table) Response from the language server
- • {ctx} (table) Client context
- • {config} (table) Configuration table.
+ • {result} (`lsp.SignatureHelp`) Response from the language server
+ • {ctx} (`lsp.HandlerContext`) Client context
+ • {config} (`table`) Configuration table.
• border: (default=nil)
• Add borders to the floating window
• See |vim.lsp.util.open_floating_preview()| for more
@@ -1658,9 +1768,10 @@ apply_text_document_edit({text_document_edit}, {index}, {offset_encoding})
document.
Parameters: ~
- • {text_document_edit} (table) a `TextDocumentEdit` object
- • {index} (integer) Optional index of the edit, if from a
- list of edits (or nil, if not from a list)
+ • {text_document_edit} (`table`) a `TextDocumentEdit` object
+ • {index} (`integer`) Optional index of the edit, if from
+ a list of edits (or nil, if not from a list)
+ • {offset_encoding} (`string?`)
See also: ~
• https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentEdit
@@ -1670,9 +1781,9 @@ apply_text_edits({text_edits}, {bufnr}, {offset_encoding})
Applies a list of text edits to a buffer.
Parameters: ~
- • {text_edits} (table) list of `TextEdit` objects
- • {bufnr} (integer) Buffer id
- • {offset_encoding} (string) utf-8|utf-16|utf-32
+ • {text_edits} (`table`) list of `TextEdit` objects
+ • {bufnr} (`integer`) Buffer id
+ • {offset_encoding} (`string`) utf-8|utf-16|utf-32
See also: ~
• https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textEdit
@@ -1682,24 +1793,27 @@ apply_workspace_edit({workspace_edit}, {offset_encoding})
Applies a `WorkspaceEdit`.
Parameters: ~
- • {workspace_edit} (table) `WorkspaceEdit`
- • {offset_encoding} (string) utf-8|utf-16|utf-32 (required)
+ • {workspace_edit} (`table`) `WorkspaceEdit`
+ • {offset_encoding} (`string`) utf-8|utf-16|utf-32 (required)
+
+ See also: ~
+ • https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_applyEdit
buf_clear_references({bufnr}) *vim.lsp.util.buf_clear_references()*
Removes document highlights from a buffer.
Parameters: ~
- • {bufnr} (integer|nil) Buffer id
+ • {bufnr} (`integer?`) Buffer id
*vim.lsp.util.buf_highlight_references()*
buf_highlight_references({bufnr}, {references}, {offset_encoding})
Shows a list of document highlights for a certain buffer.
Parameters: ~
- • {bufnr} (integer) Buffer id
- • {references} (table) List of `DocumentHighlight` objects to
+ • {bufnr} (`integer`) Buffer id
+ • {references} (`table`) List of `DocumentHighlight` objects to
highlight
- • {offset_encoding} (string) One of "utf-8", "utf-16", "utf-32".
+ • {offset_encoding} (`string`) One of "utf-8", "utf-16", "utf-32".
See also: ~
• https://microsoft.github.io/language-server-protocol/specification/#textDocumentContentChangeEvent
@@ -1709,14 +1823,14 @@ character_offset({buf}, {row}, {col}, {offset_encoding})
Returns the UTF-32 and UTF-16 offsets for a position in a certain buffer.
Parameters: ~
- • {buf} (integer) buffer number (0 for current)
- • {row} 0-indexed line
- • {col} 0-indexed byte offset in line
- • {offset_encoding} (string) utf-8|utf-16|utf-32 defaults to
+ • {buf} (`integer`) buffer number (0 for current)
+ • {row} (`integer`) 0-indexed line
+ • {col} (`integer`) 0-indexed byte offset in line
+ • {offset_encoding} (`string`) utf-8|utf-16|utf-32 defaults to
`offset_encoding` of first client of `buf`
Return: ~
- (integer) `offset_encoding` index of the character in line {row}
+ (`integer`) `offset_encoding` index of the character in line {row}
column {col} in buffer {buf}
*vim.lsp.util.convert_input_to_markdown_lines()*
@@ -1731,12 +1845,12 @@ convert_input_to_markdown_lines({input}, {contents})
modifications.
Parameters: ~
- • {input} (`MarkedString` | `MarkedString[]` | `MarkupContent`)
- • {contents} (table|nil) List of strings to extend with converted
- lines. Defaults to {}.
+ • {input} (`lsp.MarkedString|lsp.MarkedString[]|lsp.MarkupContent`)
+ • {contents} (`table?`) List of strings to extend with converted lines.
+ Defaults to {}.
Return: ~
- string[] extended with lines of converted markdown.
+ (`string[]`) extended with lines of converted markdown.
See also: ~
• https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_hover
@@ -1746,15 +1860,15 @@ convert_signature_help_to_markdown_lines({signature_help}, {ft}, {triggers})
Converts `textDocument/signatureHelp` response to markdown lines.
Parameters: ~
- • {signature_help} (table) Response of `textDocument/SignatureHelp`
- • {ft} (string|nil) filetype that will be use as the `lang`
+ • {signature_help} (`table`) Response of `textDocument/SignatureHelp`
+ • {ft} (`string?`) filetype that will be use as the `lang`
for the label markdown code block
- • {triggers} (table|nil) list of trigger characters from the lsp
+ • {triggers} (`table?`) list of trigger characters from the lsp
server. used to better determine parameter offsets
Return (multiple): ~
- (table|nil) table list of lines of converted markdown.
- (table|nil) table of active hl
+ (`table?`) table list of lines of converted markdown.
+ (`table?`) table of active hl
See also: ~
• https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_signatureHelp
@@ -1763,10 +1877,10 @@ get_effective_tabstop({bufnr}) *vim.lsp.util.get_effective_tabstop()*
Returns indentation size.
Parameters: ~
- • {bufnr} (integer|nil) Buffer handle, defaults to current
+ • {bufnr} (`integer?`) Buffer handle, defaults to current
Return: ~
- (integer) indentation size
+ (`integer`) indentation size
See also: ~
• 'shiftwidth'
@@ -1776,13 +1890,13 @@ jump_to_location({location}, {offset_encoding}, {reuse_win})
Jumps to a location.
Parameters: ~
- • {location} (table) (`Location`|`LocationLink`)
- • {offset_encoding} (string|nil) utf-8|utf-16|utf-32
- • {reuse_win} (boolean|nil) Jump to existing window if buffer is
+ • {location} (`table`) (`Location`|`LocationLink`)
+ • {offset_encoding} (`string?`) utf-8|utf-16|utf-32
+ • {reuse_win} (`boolean?`) Jump to existing window if buffer is
already open.
Return: ~
- (boolean) `true` if the jump succeeded
+ (`boolean`) `true` if the jump succeeded
*vim.lsp.util.locations_to_items()*
locations_to_items({locations}, {offset_encoding})
@@ -1796,23 +1910,18 @@ locations_to_items({locations}, {offset_encoding})
|setloclist()|.
Parameters: ~
- • {locations} (table) list of `Location`s or `LocationLink`s
- • {offset_encoding} (string) offset_encoding for locations
+ • {locations} (`lsp.Location[]|lsp.LocationLink[]`)
+ • {offset_encoding} (`string`) offset_encoding for locations
utf-8|utf-16|utf-32 default to first client of
buffer
Return: ~
- (table) list of items
-
-lookup_section({settings}, {section}) *vim.lsp.util.lookup_section()*
- Helper function to return nested values in language server settings
-
- Parameters: ~
- • {settings} (table) language server settings
- • {section} string indicating the field of the settings table
-
- Return: ~
- table|string The value of settings accessed via section
+ (`table[]`) A list of objects with the following fields:
+ • {filename} (`string`)
+ • {lnum} (`integer`) 1-indexed line number
+ • {col} (`integer`) 1-indexed column
+ • {text} (`string`)
+ • {user_data} (`lsp.Location|lsp.LocationLink`)
*vim.lsp.util.make_floating_popup_options()*
make_floating_popup_options({width}, {height}, {opts})
@@ -1820,9 +1929,9 @@ make_floating_popup_options({width}, {height}, {opts})
table can be passed to |nvim_open_win()|.
Parameters: ~
- • {width} (integer) window width (in character cells)
- • {height} (integer) window height (in character cells)
- • {opts} (table) optional
+ • {width} (`integer`) window width (in character cells)
+ • {height} (`integer`) window height (in character cells)
+ • {opts} (`table`) optional
• offset_x (integer) offset to add to `col`
• offset_y (integer) offset to add to `row`
• border (string or table) override `border`
@@ -1838,7 +1947,7 @@ make_floating_popup_options({width}, {height}, {opts})
are not enough lines to display the full window height.
Return: ~
- (table) Options
+ (`table`) Options
*vim.lsp.util.make_formatting_params()*
make_formatting_params({options})
@@ -1846,10 +1955,10 @@ make_formatting_params({options})
cursor position.
Parameters: ~
- • {options} (table|nil) with valid `FormattingOptions` entries
+ • {options} (`table?`) with valid `FormattingOptions` entries
Return: ~
- `DocumentFormattingParams` object
+ (`lsp.DocumentFormattingParams`) object
See also: ~
• https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting
@@ -1860,18 +1969,18 @@ make_given_range_params({start_pos}, {end_pos}, {bufnr}, {offset_encoding})
similar to |vim.lsp.util.make_range_params()|.
Parameters: ~
- • {start_pos} integer[]|nil {row,col} mark-indexed position.
+ • {start_pos} (`integer[]?`) {row,col} mark-indexed position.
Defaults to the start of the last visual selection.
- • {end_pos} integer[]|nil {row,col} mark-indexed position.
+ • {end_pos} (`integer[]?`) {row,col} mark-indexed position.
Defaults to the end of the last visual selection.
- • {bufnr} (integer|nil) buffer handle or 0 for current,
+ • {bufnr} (`integer?`) buffer handle or 0 for current,
defaults to current
- • {offset_encoding} "utf-8"|"utf-16"|"utf-32"|nil defaults to
+ • {offset_encoding} (`"utf-8"|"utf-16"|"utf-32"?`) defaults to
`offset_encoding` of first client of `bufnr`
Return: ~
- (table) { textDocument = { uri = `current_file_uri` }, range = { start
- = `start_position`, end = `end_position` } }
+ (`table`) { textDocument = { uri = `current_file_uri` }, range = {
+ start = `start_position`, end = `end_position` } }
*vim.lsp.util.make_position_params()*
make_position_params({window}, {offset_encoding})
@@ -1879,14 +1988,14 @@ make_position_params({window}, {offset_encoding})
cursor position.
Parameters: ~
- • {window} (integer|nil) window handle or 0 for current,
+ • {window} (`integer?`) window handle or 0 for current,
defaults to current
- • {offset_encoding} (string|nil) utf-8|utf-16|utf-32|nil defaults to
+ • {offset_encoding} (`string?`) utf-8|utf-16|utf-32|nil defaults to
`offset_encoding` of first client of buffer of
`window`
Return: ~
- (table) `TextDocumentPositionParams` object
+ (`table`) `TextDocumentPositionParams` object
See also: ~
• https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentPositionParams
@@ -1899,25 +2008,25 @@ make_range_params({window}, {offset_encoding})
`textDocument/rangeFormatting`.
Parameters: ~
- • {window} (integer|nil) window handle or 0 for current,
+ • {window} (`integer?`) window handle or 0 for current,
defaults to current
- • {offset_encoding} "utf-8"|"utf-16"|"utf-32"|nil defaults to
+ • {offset_encoding} (`"utf-8"|"utf-16"|"utf-32"?`) defaults to
`offset_encoding` of first client of buffer of
`window`
Return: ~
- (table) { textDocument = { uri = `current_file_uri` }, range = { start
- = `current_position`, end = `current_position` } }
+ (`table`) { textDocument = { uri = `current_file_uri` }, range = {
+ start = `current_position`, end = `current_position` } }
*vim.lsp.util.make_text_document_params()*
make_text_document_params({bufnr})
Creates a `TextDocumentIdentifier` object for the current buffer.
Parameters: ~
- • {bufnr} (integer|nil) Buffer handle, defaults to current
+ • {bufnr} (`integer?`) Buffer handle, defaults to current
Return: ~
- (table) `TextDocumentIdentifier`
+ (`table`) `TextDocumentIdentifier`
See also: ~
• https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentIdentifier
@@ -1927,38 +2036,41 @@ make_workspace_params({added}, {removed})
Create the workspace params
Parameters: ~
- • {added} (table)
- • {removed} (table)
+ • {added} (`table`)
+ • {removed} (`table`)
*vim.lsp.util.open_floating_preview()*
open_floating_preview({contents}, {syntax}, {opts})
Shows contents in a floating window.
Parameters: ~
- • {contents} (table) of lines to show in window
- • {syntax} (string) of syntax to set for opened buffer
- • {opts} (table) with optional fields (additional keys are filtered
- with |vim.lsp.util.make_floating_popup_options()| before
- they are passed on to |nvim_open_win()|)
- • height: (integer) height of floating window
- • width: (integer) width of floating window
- • wrap: (boolean, default true) wrap long lines
- • wrap_at: (integer) character to wrap at for computing
- height when wrap is enabled
- • max_width: (integer) maximal width of floating window
- • max_height: (integer) maximal height of floating window
- • focus_id: (string) if a popup with this id is opened,
- then focus it
- • close_events: (table) list of events that closes the
+ • {contents} (`table`) of lines to show in window
+ • {syntax} (`string`) of syntax to set for opened buffer
+ • {opts} (`table?`) with optional fields (additional keys are
+ filtered with |vim.lsp.util.make_floating_popup_options()|
+ before they are passed on to |nvim_open_win()|)
+ • {height}? (`integer`) Height of floating window
+ • {width}? (`integer`) Width of floating window
+ • {wrap}? (`boolean`, default: `true`) Wrap long lines
+ • {wrap_at}? (`integer`) Character to wrap at for
+ computing height when wrap is enabled
+ • {max_width}? (`integer`) Maximal width of floating
+ window
+ • {max_height}? (`integer`) Maximal height of floating
+ window
+ • {focus_id}? (`string`) If a popup with this id is
+ opened, then focus it
+ • {close_events}? (`table`) List of events that closes the
floating window
- • focusable: (boolean, default true) Make float focusable
- • focus: (boolean, default true) If `true`, and if
+ • {focusable}? (`boolean`, default: `true`) Make float
+ focusable.
+ • {focus}? (`boolean`, default: `true`) If `true`, and if
{focusable} is also `true`, focus an existing floating
window with the same {focus_id}
Return (multiple): ~
- (integer) bufnr of newly created float window
- (integer) winid of newly created float window preview window
+ (`integer`) bufnr of newly created float window
+ (`integer`) winid of newly created float window preview window
preview_location({location}, {opts}) *vim.lsp.util.preview_location()*
Previews a location in a floating window
@@ -1969,33 +2081,46 @@ preview_location({location}, {opts}) *vim.lsp.util.preview_location()*
definition)
Parameters: ~
- • {location} (table) a single `Location` or `LocationLink`
+ • {location} (`table`) a single `Location` or `LocationLink`
+ • {opts} (`table`)
Return (multiple): ~
- (integer|nil) buffer id of float window
- (integer|nil) window id of float window
+ (`integer?`) buffer id of float window
+ (`integer?`) window id of float window
rename({old_fname}, {new_fname}, {opts}) *vim.lsp.util.rename()*
Rename old_fname to new_fname
+ Existing buffers are renamed as well, while maintaining their bufnr.
+
+ It deletes existing buffers that conflict with the renamed file name only
+ when
+ • `opts` requests overwriting; or
+ • the conflicting buffers are not loaded, so that deleting thme does not
+ result in data loss.
+
Parameters: ~
- • {opts} (table)
+ • {old_fname} (`string`)
+ • {new_fname} (`string`)
+ • {opts} (`table?`) Options:
+ • {overwrite}? (`boolean`)
+ • {ignoreIfExists}? (`boolean`)
*vim.lsp.util.show_document()*
show_document({location}, {offset_encoding}, {opts})
Shows document and optionally jumps to the location.
Parameters: ~
- • {location} (table) (`Location`|`LocationLink`)
- • {offset_encoding} (string|nil) utf-8|utf-16|utf-32
- • {opts} (table|nil) options
+ • {location} (`table`) (`Location`|`LocationLink`)
+ • {offset_encoding} (`string?`) utf-8|utf-16|utf-32
+ • {opts} (`table?`) options
• reuse_win (boolean) Jump to existing window if
buffer is already open.
• focus (boolean) Whether to focus/jump to location
if possible. Defaults to true.
Return: ~
- (boolean) `true` if succeeded
+ (`boolean`) `true` if succeeded
*vim.lsp.util.stylize_markdown()*
stylize_markdown({bufnr}, {contents}, {opts})
@@ -2010,8 +2135,9 @@ stylize_markdown({bufnr}, {contents}, {opts})
`open_floating_preview` instead
Parameters: ~
- • {contents} (table) of lines to show in window
- • {opts} (table) with optional fields
+ • {bufnr} (`integer`)
+ • {contents} (`table`) of lines to show in window
+ • {opts} (`table`) with optional fields
• height of floating window
• width of floating window
• wrap_at character to wrap at for computing height
@@ -2020,13 +2146,14 @@ stylize_markdown({bufnr}, {contents}, {opts})
• separator insert separator after code block
Return: ~
- (table) stripped content
+ (`table`) stripped content
symbols_to_items({symbols}, {bufnr}) *vim.lsp.util.symbols_to_items()*
Converts symbols to quickfix list items.
Parameters: ~
- • {symbols} (table) DocumentSymbol[] or SymbolInformation[]
+ • {symbols} (`table`) DocumentSymbol[] or SymbolInformation[]
+ • {bufnr} (`integer`)
==============================================================================
@@ -2036,127 +2163,167 @@ get_filename() *vim.lsp.log.get_filename()*
Returns the log filename.
Return: ~
- (string) log filename
+ (`string`) log filename
get_level() *vim.lsp.log.get_level()*
Gets the current log level.
Return: ~
- (integer) current log level
+ (`integer`) current log level
set_format_func({handle}) *vim.lsp.log.set_format_func()*
Sets formatting function used to format logs
Parameters: ~
- • {handle} (function) function to apply to logging arguments, pass
+ • {handle} (`function`) function to apply to logging arguments, pass
vim.inspect for multi-line formatting
set_level({level}) *vim.lsp.log.set_level()*
Sets the current log level.
Parameters: ~
- • {level} (string|integer) One of `vim.lsp.log.levels`
+ • {level} (`string|integer`) One of `vim.lsp.log.levels`
should_log({level}) *vim.lsp.log.should_log()*
Checks whether the level is sufficient for logging.
Parameters: ~
- • {level} (integer) log level
+ • {level} (`integer`) log level
Return: ~
- (bool) true if would log, false if not
+ (`bool`) true if would log, false if not
==============================================================================
Lua module: vim.lsp.rpc *lsp-rpc*
+*vim.lsp.rpc.PublicClient*
+
+ Fields: ~
+ • {request} (`fun(method: string, params: table?, callback: fun(err: lsp.ResponseError?, result: any), notify_reply_callback: fun(integer)?):boolean,integer?`)
+ see |vim.lsp.rpc.request()|
+ • {notify} (`fun(method: string, params: any):boolean`) see
+ |vim.lsp.rpc.notify()|
+ • {is_closing} (`fun(): boolean`)
+ • {terminate} (`fun()`)
+
+
connect({host}, {port}) *vim.lsp.rpc.connect()*
Create a LSP RPC client factory that connects via TCP to the given host
- and port
+ and port.
+
+ Return a function that can be passed to the `cmd` field for
+ |vim.lsp.start_client()| or |vim.lsp.start()|.
+
+ Parameters: ~
+ • {host} (`string`) host to connect to
+ • {port} (`integer`) port to connect to
+
+ Return: ~
+ (`fun(dispatchers: vim.lsp.rpc.Dispatchers): vim.lsp.rpc.PublicClient`)
+
+ *vim.lsp.rpc.domain_socket_connect()*
+domain_socket_connect({pipe_path})
+ Create a LSP RPC client factory that connects via named pipes (Windows) or
+ unix domain sockets (Unix) to the given pipe_path (file path on Unix and
+ name on Windows).
+
+ Return a function that can be passed to the `cmd` field for
+ |vim.lsp.start_client()| or |vim.lsp.start()|.
Parameters: ~
- • {host} (string)
- • {port} (integer)
+ • {pipe_path} (`string`) file path of the domain socket (Unix) or name
+ of the named pipe (Windows) to connect to
Return: ~
- (function)
+ (`fun(dispatchers: vim.lsp.rpc.Dispatchers): vim.lsp.rpc.PublicClient`)
format_rpc_error({err}) *vim.lsp.rpc.format_rpc_error()*
Constructs an error message from an LSP error object.
Parameters: ~
- • {err} (table) The error object
+ • {err} (`table`) The error object
Return: ~
- (string) The formatted error message
+ (`string`) error_message The formatted error message
notify({method}, {params}) *vim.lsp.rpc.notify()*
Sends a notification to the LSP server.
Parameters: ~
- • {method} (string) The invoked LSP method
- • {params} (table|nil) Parameters for the invoked LSP method
+ • {method} (`string`) The invoked LSP method
+ • {params} (`table?`) Parameters for the invoked LSP method
Return: ~
- (boolean) `true` if notification could be sent, `false` if not
+ (`boolean`) `true` if notification could be sent, `false` if not
*vim.lsp.rpc.request()*
request({method}, {params}, {callback}, {notify_reply_callback})
Sends a request to the LSP server and runs {callback} upon response.
Parameters: ~
- • {method} (string) The invoked LSP method
- • {params} (table|nil) Parameters for the invoked LSP
+ • {method} (`string`) The invoked LSP method
+ • {params} (`table?`) Parameters for the invoked LSP
method
- • {callback} fun(err: lsp.ResponseError | nil, result:
- any) Callback to invoke
- • {notify_reply_callback} (function|nil) Callback to invoke as soon as
- a request is no longer pending
+ • {callback} (`fun(err: lsp.ResponseError?, result: any)`)
+ Callback to invoke
+ • {notify_reply_callback} (`fun(message_id: integer)?`) Callback to
+ invoke as soon as a request is no longer
+ pending
- Return: ~
- (boolean) success, integer|nil request_id true, message_id if request
- could be sent, `false` if not
+ Return (multiple): ~
+ (`boolean`) success `true` if request could be sent, `false` if not
+ (`integer?`) message_id if request could be sent, `nil` if not
*vim.lsp.rpc.rpc_response_error()*
rpc_response_error({code}, {message}, {data})
- Creates an RPC response object/table.
+ Creates an RPC response table `error` to be sent to the LSP response.
Parameters: ~
- • {code} (integer) RPC error code defined in
+ • {code} (`integer`) RPC error code defined, see
`vim.lsp.protocol.ErrorCodes`
- • {message} (string|nil) arbitrary message to send to server
- • {data} any|nil arbitrary data to send to server
+ • {message} (`string?`) arbitrary message to send to server
+ • {data} (`any?`) arbitrary data to send to server
- *vim.lsp.rpc.start()*
-start({cmd}, {cmd_args}, {dispatchers}, {extra_spawn_params})
+ Return: ~
+ (`lsp.ResponseError`)
+
+ See also: ~
+ • lsp.ErrorCodes See `vim.lsp.protocol.ErrorCodes`
+
+start({cmd}, {dispatchers}, {extra_spawn_params}) *vim.lsp.rpc.start()*
Starts an LSP server process and create an LSP RPC client object to
interact with it. Communication with the spawned process happens via
stdio. For communication via TCP, spawn a process manually and use
|vim.lsp.rpc.connect()|
Parameters: ~
- • {cmd} (string) Command to start the LSP server.
- • {cmd_args} (table) List of additional string arguments to
- pass to {cmd}.
- • {dispatchers} (table|nil) Dispatchers for LSP message types.
- Valid dispatcher names are:
- • `"notification"`
- • `"server_request"`
- • `"on_error"`
- • `"on_exit"`
- • {extra_spawn_params} (table|nil) Additional context for the LSP
- server process. May contain:
- • {cwd} (string) Working directory for the LSP
- server process
- • {env} (table) Additional environment variables
- for LSP server process
+ • {cmd} (`string[]`) Command to start the LSP server.
+ • {dispatchers} (`table?`) Dispatchers for LSP message types.
+ • {notification}
+ (`fun(method: string, params: table)`)
+ • {server_request}
+ (`fun(method: string, params: table): any?, lsp.ResponseError?`)
+ • {on_exit}
+ (`fun(code: integer, signal: integer)`)
+ • {on_error} (`fun(code: integer, err: any)`)
+ • {extra_spawn_params} (`table?`) Additional context for the LSP server
+ process.
+ • {cwd}? (`string`) Working directory for the
+ LSP server process
+ • {detached}? (`boolean`) Detach the LSP server
+ process from the current process
+ • {env}? (`table<string,string>`) Additional
+ environment variables for LSP server process.
+ See |vim.system()|
Return: ~
- (table|nil) Client RPC object, with these methods:
+ (`vim.lsp.rpc.PublicClient?`) Client RPC object, with these methods:
• `notify()` |vim.lsp.rpc.notify()|
• `request()` |vim.lsp.rpc.request()|
• `is_closing()` returns a boolean indicating if the RPC is closing.
- • `terminate()` terminates the RPC client.
+ • `terminate()` terminates the RPC client. See
+ |vim.lsp.rpc.PublicClient|.
==============================================================================
@@ -2168,23 +2335,24 @@ make_client_capabilities()
capabilities.
Return: ~
- lsp.ClientCapabilities
+ (`lsp.ClientCapabilities`)
Methods *vim.lsp.protocol.Methods*
LSP method names.
See also: ~
- • https://microsoft.github.io/language-server-protocol/specifications/specification-current/#metaModel
+ • https://microsoft.github.io/language-server-protocol/specification/#metaModel
*vim.lsp.protocol.resolve_capabilities()*
resolve_capabilities({server_capabilities})
Creates a normalized object describing LSP server capabilities.
Parameters: ~
- • {server_capabilities} (table) Table of capabilities supported by the
- server
+ • {server_capabilities} (`table`) Table of capabilities supported by
+ the server
Return: ~
- (table|nil) Normalized table of capabilities
+ (`lsp.ServerCapabilities?`) Normalized table of capabilities
+
vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl:
diff --git a/runtime/doc/lua-guide.txt b/runtime/doc/lua-guide.txt
index c15b1b0495..e8757a1859 100644
--- a/runtime/doc/lua-guide.txt
+++ b/runtime/doc/lua-guide.txt
@@ -157,7 +157,7 @@ its functions if this succeeds and prints an error message otherwise:
end
<
In contrast to |:source|, |require()| not only searches through all `lua/` directories
-under |'runtimepath'|, it also cache the module on first use. Calling
+under |'runtimepath'|, it also caches the module on first use. Calling
`require()` a second time will therefore _not_ execute the script again and
instead return the cached file. To rerun the file, you need to remove it from
the cache manually first:
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index a35d70cae8..367b5c36d2 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -121,16 +121,14 @@ languages like Python and C#. Example: >lua
func_with_opts { foo = true, filename = "hello.world" }
<
-There's nothing special going on here except that parentheses are treated as
-whitespace. But visually, this small bit of sugar gets reasonably close to
-a "keyword args" interface. Nvim code tends to prefer this style.
-
-------------------------------------------------------------------------------
-LUA PATTERNS *lua-patterns*
+There's nothing special going on here except that parentheses are implicitly
+added. But visually, this small bit of sugar gets reasonably close to a
+"keyword args" interface.
+ *lua-regex*
Lua intentionally does not support regular expressions, instead it has limited
-"patterns" |lua-pattern| which avoid the performance pitfalls of extended
-regex. Lua scripts can also use Vim regex via |vim.regex()|.
+|lua-patterns| which avoid the performance pitfalls of extended regex. Lua
+scripts can also use Vim regex via |vim.regex()|.
Examples: >lua
@@ -256,6 +254,14 @@ arguments separated by " " (space) instead of "\t" (tab).
< To see the LuaJIT version: >vim
:lua =jit.version
<
+:{range}lua
+ Executes buffer lines in {range} as Lua code. Unlike |:source|, this
+ always treats the lines as Lua code.
+
+ Example: select the following code and type ":lua<Enter>" to execute it: >lua
+ print(string.format(
+ 'unix time: %s', os.time()))
+<
*:lua-heredoc*
:lua << [trim] [{endmarker}]
{script}
@@ -268,10 +274,8 @@ arguments separated by " " (space) instead of "\t" (tab).
function! CurrentLineInfo()
lua << EOF
local linenr = vim.api.nvim_win_get_cursor(0)[1]
- local curline = vim.api.nvim_buf_get_lines(
- 0, linenr - 1, linenr, false)[1]
- print(string.format("Current line [%d] has %d bytes",
- linenr, #curline))
+ local curline = vim.api.nvim_buf_get_lines(0, linenr - 1, linenr, false)[1]
+ print(string.format('Line [%d] has %d bytes', linenr, #curline))
EOF
endfunction
<
@@ -574,41 +578,30 @@ A subset of the `vim.*` API is available in threads. This includes:
like `vim.split`, `vim.tbl_*`, `vim.list_*`, and so on.
- `vim.is_thread()` returns true from a non-main thread.
-------------------------------------------------------------------------------
-VIM.LPEG *lua-lpeg*
-
- *vim.lpeg* *vim.re*
-The Lpeg library for parsing expression grammars is being included as
-`vim.lpeg` (https://www.inf.puc-rio.br/~roberto/lpeg/). In addition, its regex-like
-interface is available as `vim.re` (https://www.inf.puc-rio.br/~roberto/lpeg/re.html).
==============================================================================
VIM.HIGHLIGHT *vim.highlight*
-
Nvim includes a function for highlighting a selection on yank.
To enable it, add the following to your `init.vim`: >vim
au TextYankPost * silent! lua vim.highlight.on_yank()
-
<
-You can customize the highlight group and the duration of the highlight
-via: >vim
+You can customize the highlight group and the duration of the highlight via: >vim
au TextYankPost * silent! lua vim.highlight.on_yank {higroup="IncSearch", timeout=150}
-
<
If you want to exclude visual selections from highlighting on yank, use: >vim
au TextYankPost * silent! lua vim.highlight.on_yank {on_visual=false}
-
<
+
vim.highlight.on_yank({opts}) *vim.highlight.on_yank()*
Highlight the yanked text
Parameters: ~
- • {opts} (table|nil) Optional parameters
+ • {opts} (`table?`) Optional parameters
• higroup highlight group for yanked region (default
"IncSearch")
• timeout time in ms before highlight is cleared (default 150)
@@ -622,7 +615,7 @@ vim.highlight.on_yank({opts}) *vim.highlight.on_yank()*
vim.highlight.priorities *vim.highlight.priorities*
Table with default priorities used for highlighting:
• `syntax`: `50`, used for standard syntax highlighting
- • `treesitter`: `100`, used for tree-sitter-based highlighting
+ • `treesitter`: `100`, used for treesitter-based highlighting
• `semantic_tokens`: `125`, used for LSP semantic token highlighting
• `diagnostics`: `150`, used for code analysis such as diagnostics
• `user`: `200`, used for user-triggered highlights such as LSP document
@@ -633,14 +626,14 @@ vim.highlight.range({bufnr}, {ns}, {higroup}, {start}, {finish}, {opts})
Apply highlight group to range of text.
Parameters: ~
- • {bufnr} (integer) Buffer number to apply highlighting to
- • {ns} (integer) Namespace to add highlight to
- • {higroup} (string) Highlight group to use for highlighting
- • {start} integer[]|string Start of region as a (line, column) tuple
- or string accepted by |getpos()|
- • {finish} integer[]|string End of region as a (line, column) tuple or
- string accepted by |getpos()|
- • {opts} (table|nil) Optional parameters
+ • {bufnr} (`integer`) Buffer number to apply highlighting to
+ • {ns} (`integer`) Namespace to add highlight to
+ • {higroup} (`string`) Highlight group to use for highlighting
+ • {start} (`integer[]|string`) Start of region as a (line, column)
+ tuple or string accepted by |getpos()|
+ • {finish} (`integer[]|string`) End of region as a (line, column)
+ tuple or string accepted by |getpos()|
+ • {opts} (`table?`) Optional parameters
• regtype type of range (see |setreg()|, default charwise)
• inclusive boolean indicating whether the range is
end-inclusive (default false)
@@ -649,47 +642,6 @@ vim.highlight.range({bufnr}, {ns}, {higroup}, {start}, {finish}, {opts})
==============================================================================
-VIM.REGEX *vim.regex*
-
-
-Vim regexes can be used directly from Lua. Currently they only allow
-matching within a single line.
-
-
-vim.regex({re}) *vim.regex()*
- Parse the Vim regex {re} and return a regex object. Regexes are "magic"
- and case-sensitive by default, regardless of 'magic' and 'ignorecase'.
- They can be controlled with flags, see |/magic| and |/ignorecase|.
-
- Parameters: ~
- • {re} (string)
-
- Return: ~
- vim.regex
-
- *regex:match_line()*
-vim.regex:match_line({bufnr}, {line_idx}, {start}, {end_})
- Match line {line_idx} (zero-based) in buffer {bufnr}. If {start} and {end}
- are supplied, match only this byte index range. Otherwise see
- |regex:match_str()|. If {start} is used, then the returned byte indices
- will be relative {start}.
-
- Parameters: ~
- • {bufnr} (integer)
- • {line_idx} (integer)
- • {start} (integer|nil)
- • {end_} (integer|nil)
-
-vim.regex:match_str({str}) *regex:match_str()*
- Match the string against the regex. If the string should match the regex
- precisely, surround the regex with `^` and `$` . If there was a match, the byte indices for the beginning and end of the
- match are returned. When there is no match, `nil` is returned. Because any integer is "truthy", `regex:match_str()` can be directly used as a condition in an if-statement.
-
- Parameters: ~
- • {str} (string)
-
-
-==============================================================================
VIM.DIFF *vim.diff*
vim.diff({a}, {b}, {opts}) *vim.diff()*
@@ -712,22 +664,20 @@ vim.diff({a}, {b}, {opts}) *vim.diff()*
<
Parameters: ~
- • {a} (string) First string to compare
- • {b} (string) Second string to compare
- • {opts} table<string,any> Optional parameters:
- • `on_hunk` (callback): Invoked for each hunk in the diff. Return a
- negative number to cancel the callback for any remaining
- hunks. Args:
+ • {a} (`string`) First string to compare
+ • {b} (`string`) Second string to compare
+ • {opts} (`table<string,any>`) Optional parameters:
+ • `on_hunk` (callback): Invoked for each hunk in the diff.
+ Return a negative number to cancel the callback for any
+ remaining hunks. Args:
• `start_a` (integer): Start line of hunk in {a}.
• `count_a` (integer): Hunk size in {a}.
• `start_b` (integer): Start line of hunk in {b}.
• `count_b` (integer): Hunk size in {b}.
-
• `result_type` (string): Form of the returned diff:
• "unified": (default) String in unified format.
• "indices": Array of hunk locations. Note: This option is
ignored if `on_hunk` is used.
-
• `linematch` (boolean|integer): Run linematch on the
resulting hunks from xdiff. When integer, only hunks upto
this size in lines are run through linematch. Requires
@@ -738,7 +688,6 @@ vim.diff({a}, {b}, {opts}) *vim.diff()*
possible diff
• "patience" patience diff algorithm
• "histogram" histogram diff algorithm
-
• `ctxlen` (integer): Context length
• `interhunkctxlen` (integer): Inter hunk context length
• `ignore_whitespace` (boolean): Ignore whitespace
@@ -753,37 +702,45 @@ vim.diff({a}, {b}, {opts}) *vim.diff()*
the internal diff library.
Return: ~
- string|table|nil See {opts.result_type}. `nil` if {opts.on_hunk} is
+ (`string|table?`) See {opts.result_type}. `nil` if {opts.on_hunk} is
given.
==============================================================================
VIM.MPACK *vim.mpack*
-
This module provides encoding and decoding of Lua objects to and from
msgpack-encoded strings. Supports |vim.NIL| and |vim.empty_dict()|.
+
vim.mpack.decode({str}) *vim.mpack.decode()*
Decodes (or "unpacks") the msgpack-encoded {str} to a Lua object.
Parameters: ~
- • {str} (string)
+ • {str} (`string`)
+
+ Return: ~
+ (`any`)
vim.mpack.encode({obj}) *vim.mpack.encode()*
Encodes (or "packs") Lua object {obj} as msgpack in a Lua string.
+ Parameters: ~
+ • {obj} (`any`)
+
+ Return: ~
+ (`string`)
+
==============================================================================
VIM.JSON *vim.json*
-
This module provides encoding and decoding of Lua objects to and from
JSON-encoded strings. Supports |vim.NIL| and |vim.empty_dict()|.
+
vim.json.decode({str}, {opts}) *vim.json.decode()*
Decodes (or "unpacks") the JSON-encoded {str} to a Lua object.
-
• Decodes JSON "null" as |vim.NIL| (controllable by {opts}, see below).
• Decodes empty object as |vim.empty_dict()|.
• Decodes empty array as `{}` (empty Lua table).
@@ -794,8 +751,8 @@ vim.json.decode({str}, {opts}) *vim.json.decode()*
<
Parameters: ~
- • {str} (string) Stringified JSON data.
- • {opts} table<string,any>|nil Options table with keys:
+ • {str} (`string`) Stringified JSON data.
+ • {opts} (`table<string,any>?`) Options table with keys:
• luanil: (table) Table with keys:
• object: (boolean) When true, converts `null` in JSON
objects to Lua `nil` instead of |vim.NIL|.
@@ -803,16 +760,16 @@ vim.json.decode({str}, {opts}) *vim.json.decode()*
to Lua `nil` instead of |vim.NIL|.
Return: ~
- any
+ (`any`)
vim.json.encode({obj}) *vim.json.encode()*
Encodes (or "packs") Lua object {obj} as JSON in a Lua string.
Parameters: ~
- • {obj} any
+ • {obj} (`any`)
Return: ~
- (string)
+ (`string`)
==============================================================================
@@ -822,19 +779,19 @@ vim.base64.decode({str}) *vim.base64.decode()*
Decode a Base64 encoded string.
Parameters: ~
- • {str} (string) Base64 encoded string
+ • {str} (`string`) Base64 encoded string
Return: ~
- (string) Decoded string
+ (`string`) Decoded string
vim.base64.encode({str}) *vim.base64.encode()*
Encode {str} using Base64.
Parameters: ~
- • {str} (string) String to encode
+ • {str} (`string`) String to encode
Return: ~
- (string) Encoded string
+ (`string`) Encoded string
==============================================================================
@@ -857,10 +814,11 @@ vim.spell.check({str}) *vim.spell.check()*
<
Parameters: ~
- • {str} (string)
+ • {str} (`string`)
Return: ~
- `{[1]: string, [2]: string, [3]: string}[]` List of tuples with three items:
+ (`{[1]: string, [2]: string, [3]: string}[]`) List of tuples with
+ three items:
• The badly spelled word.
• The type of the spelling error: "bad" spelling mistake "rare" rare
word "local" word only valid in another region "caps" word should
@@ -872,24 +830,24 @@ vim.spell.check({str}) *vim.spell.check()*
VIM *vim.builtin*
-vim.api.{func}({...}) *vim.api*
+vim.api.{func}({...}) *vim.api*
Invokes Nvim |API| function {func} with arguments {...}.
Example: call the "nvim_get_current_line()" API function: >lua
print(tostring(vim.api.nvim_get_current_line()))
-vim.NIL *vim.NIL*
+vim.NIL *vim.NIL*
Special value representing NIL in |RPC| and |v:null| in Vimscript
conversion, and similar cases. Lua `nil` cannot be used as part of a Lua
table representing a Dictionary or Array, because it is treated as
missing: `{"foo", nil}` is the same as `{"foo"}`.
-vim.type_idx *vim.type_idx*
+vim.type_idx *vim.type_idx*
Type index for use in |lua-special-tbl|. Specifying one of the values from
|vim.types| allows typing the empty table (it is unclear whether empty Lua
table represents empty list or empty array) and forcing integral numbers
to be |Float|. See |lua-special-tbl| for more details.
-vim.val_idx *vim.val_idx*
+vim.val_idx *vim.val_idx*
Value index for tables representing |Float|s. A table representing
floating-point value 1.0 looks like this: >lua
{
@@ -898,7 +856,7 @@ vim.val_idx *vim.val_id
}
< See also |vim.type_idx| and |lua-special-tbl|.
-vim.types *vim.types*
+vim.types *vim.types*
Table with possible values for |vim.type_idx|. Contains two sets of
key-value pairs: first maps possible values for |vim.type_idx| to
human-readable strings, second maps human-readable type names to values
@@ -927,6 +885,8 @@ Log levels are one of the values defined in `vim.log.levels`:
vim.log.levels.WARN
vim.log.levels.OFF
+
+
vim.empty_dict() *vim.empty_dict()*
Creates a special empty table (marked with a metatable), which Nvim
converts to an empty dictionary when translating Lua values to Vimscript
@@ -936,6 +896,9 @@ vim.empty_dict() *vim.empty_dict()*
Note: If numeric keys are present in the table, Nvim ignores the metatable
marker and converts the dict to a list/array anyway.
+ Return: ~
+ (`table`)
+
vim.iconv({str}, {from}, {to}, {opts}) *vim.iconv()*
The result is a String, which is the text {str} converted from encoding
{from} to encoding {to}. When the conversion fails `nil` is returned. When
@@ -944,13 +907,13 @@ vim.iconv({str}, {from}, {to}, {opts}) *vim.iconv()*
":Man 3 iconv".
Parameters: ~
- • {str} (string) Text to convert
- • {from} (number) Encoding of {str}
- • {to} (number) Target encoding
- • {opts} table<string,any>|nil
+ • {str} (`string`) Text to convert
+ • {from} (`number`) Encoding of {str}
+ • {to} (`number`) Target encoding
+ • {opts} (`table<string,any>?`)
Return: ~
- (string|nil) Converted string if conversion succeeds, `nil` otherwise.
+ (`string?`) Converted string if conversion succeeds, `nil` otherwise.
vim.in_fast_event() *vim.in_fast_event()*
Returns true if the code is executing as part of a "fast" event handler,
@@ -959,19 +922,18 @@ vim.in_fast_event() *vim.in_fast_event()*
When this is `false` most API functions are callable (but may be subject
to other restrictions such as |textlock|).
-vim.rpcnotify({channel}, {method}, {args}, {...}) *vim.rpcnotify()*
+vim.rpcnotify({channel}, {method}, {...}) *vim.rpcnotify()*
Sends {event} to {channel} via |RPC| and returns immediately. If {channel}
is 0, the event is broadcast to all channels.
This function also works in a fast callback |lua-loop-callbacks|.
Parameters: ~
- • {channel} (integer)
- • {method} (string)
- • {args} any[]|nil
- • {...} any|nil
+ • {channel} (`integer`)
+ • {method} (`string`)
+ • {...} (`any?`)
-vim.rpcrequest({channel}, {method}, {args}, {...}) *vim.rpcrequest()*
+vim.rpcrequest({channel}, {method}, {...}) *vim.rpcrequest()*
Sends a request to {channel} to invoke {method} via |RPC| and blocks until
a response is received.
@@ -979,17 +941,16 @@ vim.rpcrequest({channel}, {method}, {args}, {...}) *vim.rpcrequest()*
special value
Parameters: ~
- • {channel} (integer)
- • {method} (string)
- • {args} any[]|nil
- • {...} any|nil
+ • {channel} (`integer`)
+ • {method} (`string`)
+ • {...} (`any?`)
vim.schedule({fn}) *vim.schedule()*
Schedules {fn} to be invoked soon by the main event-loop. Useful to avoid
|textlock| or other temporary restrictions.
Parameters: ~
- • {fn} (function)
+ • {fn} (`function`)
vim.str_byteindex({str}, {index}, {use_utf16}) *vim.str_byteindex()*
Convert UTF-32 or UTF-16 {index} to byte index. If {use_utf16} is not
@@ -1000,9 +961,9 @@ vim.str_byteindex({str}, {index}, {use_utf16}) *vim.str_byteindex()*
sequence.
Parameters: ~
- • {str} (string)
- • {index} (number)
- • {use_utf16} any|nil
+ • {str} (`string`)
+ • {index} (`number`)
+ • {use_utf16} (`any?`)
vim.str_utf_end({str}, {index}) *vim.str_utf_end()*
Gets the distance (in bytes) from the last byte of the codepoint
@@ -1019,11 +980,11 @@ vim.str_utf_end({str}, {index}) *vim.str_utf_end()*
<
Parameters: ~
- • {str} (string)
- • {index} (number)
+ • {str} (`string`)
+ • {index} (`number`)
Return: ~
- (number)
+ (`number`)
vim.str_utf_pos({str}) *vim.str_utf_pos()*
Gets a list of the starting byte positions of each UTF-8 codepoint in the
@@ -1032,10 +993,10 @@ vim.str_utf_pos({str}) *vim.str_utf_pos()*
Embedded NUL bytes are treated as terminating the string.
Parameters: ~
- • {str} (string)
+ • {str} (`string`)
Return: ~
- (table)
+ (`table`)
vim.str_utf_start({str}, {index}) *vim.str_utf_start()*
Gets the distance (in bytes) from the starting byte of the codepoint
@@ -1055,11 +1016,11 @@ vim.str_utf_start({str}, {index}) *vim.str_utf_start()*
<
Parameters: ~
- • {str} (string)
- • {index} (number)
+ • {str} (`string`)
+ • {index} (`number`)
Return: ~
- (number)
+ (`number`)
vim.str_utfindex({str}, {index}) *vim.str_utfindex()*
Convert byte index to UTF-32 and UTF-16 indices. If {index} is not
@@ -1071,23 +1032,23 @@ vim.str_utfindex({str}, {index}) *vim.str_utfindex()*
that sequence.
Parameters: ~
- • {str} (string)
- • {index} (number|nil)
+ • {str} (`string`)
+ • {index} (`number?`)
Return (multiple): ~
- (integer) UTF-32 index
- (integer) UTF-16 index
+ (`integer`) UTF-32 index
+ (`integer`) UTF-16 index
vim.stricmp({a}, {b}) *vim.stricmp()*
Compares strings case-insensitively.
Parameters: ~
- • {a} (string)
- • {b} (string)
+ • {a} (`string`)
+ • {b} (`string`)
Return: ~
- 0|1|-1 if strings are equal, {a} is greater than {b} or {a} is lesser
- than {b}, respectively.
+ (`0|1|-1`) if strings are equal, {a} is greater than {b} or {a} is
+ lesser than {b}, respectively.
vim.ui_attach({ns}, {options}, {callback}) *vim.ui_attach()*
Attach to ui events, similar to |nvim_ui_attach()| but receive events as
@@ -1125,16 +1086,16 @@ vim.ui_attach({ns}, {options}, {callback}) *vim.ui_attach()*
<
Parameters: ~
- • {ns} (integer)
- • {options} table<string, any>
- • {callback} fun()
+ • {ns} (`integer`)
+ • {options} (`table<string, any>`)
+ • {callback} (`fun()`)
vim.ui_detach({ns}) *vim.ui_detach()*
Detach a callback previously attached with |vim.ui_attach()| for the given
namespace {ns}.
Parameters: ~
- • {ns} (integer)
+ • {ns} (`integer`)
vim.wait({time}, {callback}, {interval}, {fast_only}) *vim.wait()*
Wait for {time} in milliseconds until {callback} returns `true`.
@@ -1169,16 +1130,17 @@ vim.wait({time}, {callback}, {interval}, {fast_only}) *vim.wait()*
<
Parameters: ~
- • {time} (integer) Number of milliseconds to wait
- • {callback} fun():|nil boolean Optional callback. Waits until
+ • {time} (`integer`) Number of milliseconds to wait
+ • {callback} (`fun(): boolean?`) Optional callback. Waits until
{callback} returns true
- • {interval} (integer|nil) (Approximate) number of milliseconds to
- wait between polls
- • {fast_only} (boolean|nil) If true, only |api-fast| events will be
+ • {interval} (`integer?`) (Approximate) number of milliseconds to wait
+ between polls
+ • {fast_only} (`boolean?`) If true, only |api-fast| events will be
processed.
- Return: ~
- boolean, nil|-1|-2
+ Return (multiple): ~
+ (`boolean`)
+ (`-1|-2?`)
• If {callback} returns `true` during the {time}: `true, nil`
• If {callback} never returns `true` during the {time}: `false, -1`
• If {callback} is interrupted during the {time}: `false, -2`
@@ -1188,18 +1150,15 @@ vim.wait({time}, {callback}, {interval}, {fast_only}) *vim.wait()*
==============================================================================
LUA-VIMSCRIPT BRIDGE *lua-vimscript*
-
Nvim Lua provides an interface or "bridge" to Vimscript variables and
functions, and editor commands and options.
Objects passed over this bridge are COPIED (marshalled): there are no
-"references". |lua-guide-variables| For example, using `vim.fn.remove()`
-on a Lua list copies the list object to Vimscript and does NOT modify the
-Lua list: >lua
+"references". |lua-guide-variables| For example, using `vim.fn.remove()` on a
+Lua list copies the list object to Vimscript and does NOT modify the Lua list: >lua
local list = { 1, 2, 3 }
vim.fn.remove(list, 0)
vim.print(list) --> "{ 1, 2, 3 }"
-
<
vim.call({func}, {...}) *vim.call()*
@@ -1280,7 +1239,7 @@ vim.v *vim.v*
|v:| variables.
Invalid or unset key returns `nil`.
-` ` *lua-options*
+ *lua-options*
*lua-vim-options*
*lua-vim-set*
*lua-vim-setlocal*
@@ -1303,9 +1262,10 @@ window-scoped options. Note that this must NOT be confused with
|local-options| and |:setlocal|. There is also |vim.go| that only accesses the
global value of a |global-local| option, see |:setglobal|.
-` ` *vim.opt_local*
- *vim.opt_global*
- *vim.opt*
+ *vim.opt_local*
+ *vim.opt_global*
+ *vim.opt*
+
A special interface |vim.opt| exists for conveniently interacting with list-
and map-style option from Lua: It allows accessing them as Lua tables and
@@ -1366,6 +1326,7 @@ In any of the above examples, to replicate the behavior |:setlocal|, use
`vim.opt_local`. Additionally, to replicate the behavior of |:setglobal|, use
`vim.opt_global`.
+
Option:append({value}) *vim.opt:append()*
Append a value to string-style options. See |:set+=|
@@ -1375,7 +1336,7 @@ Option:append({value}) *vim.opt:append()*
<
Parameters: ~
- • {value} (string) Value to append
+ • {value} (`string`) Value to append
Option:get() *vim.opt:get()*
Returns a Lua-representation of the option. Boolean, number and string
@@ -1421,7 +1382,7 @@ Option:get() *vim.opt:get()*
<
Return: ~
- string|integer|boolean|nil value of option
+ (`string|integer|boolean?`) value of option
Option:prepend({value}) *vim.opt:prepend()*
Prepend a value to string-style options. See |:set^=|
@@ -1432,7 +1393,7 @@ Option:prepend({value}) *vim.opt:prepend()*
<
Parameters: ~
- • {value} (string) Value to prepend
+ • {value} (`string`) Value to prepend
Option:remove({value}) *vim.opt:remove()*
Remove a value from string-style options. See |:set-=|
@@ -1443,14 +1404,15 @@ Option:remove({value}) *vim.opt:remove()*
<
Parameters: ~
- • {value} (string) Value to remove
+ • {value} (`string`) Value to remove
vim.bo *vim.bo*
- Get or set buffer-scoped |options| for the buffer with number {bufnr}.
- Like `:set` and `:setlocal`. If [{bufnr}] is omitted then the current
- buffer is used. Invalid {bufnr} or key is an error.
+ Get or set buffer-scoped |options| for the buffer with number {bufnr}. If
+ {bufnr} is omitted then the current buffer is used. Invalid {bufnr} or key
+ is an error.
- Note: this is equivalent to both `:set` and `:setlocal`.
+ Note: this is equivalent to `:setlocal` for |global-local| options and
+ `:set` otherwise.
Example: >lua
local bufnr = vim.api.nvim_get_current_buf()
@@ -1469,9 +1431,6 @@ vim.env *vim.env*
print(vim.env.TERM)
<
- Parameters: ~
- • {var} (string)
-
vim.go *vim.go*
Get or set global |options|. Like `:setglobal`. Invalid key is an error.
@@ -1499,9 +1458,10 @@ vim.o *vim.o*
vim.wo *vim.wo*
Get or set window-scoped |options| for the window with handle {winid} and
- buffer with number {bufnr}. Like `:setlocal` if {bufnr} is provided, like
- `:set` otherwise. If [{winid}] is omitted then the current window is used.
- Invalid {winid}, {bufnr} or key is an error.
+ buffer with number {bufnr}. Like `:setlocal` if setting a |global-local|
+ option or if {bufnr} is provided, like `:set` otherwise. If {winid} is
+ omitted then the current window is used. Invalid {winid}, {bufnr} or key
+ is an error.
Note: only {bufnr} with value `0` (the current buffer in the window) is
supported.
@@ -1518,7 +1478,7 @@ vim.wo *vim.wo*
==============================================================================
Lua module: vim *lua-vim*
-vim.cmd *vim.cmd()*
+vim.cmd({command}) *vim.cmd()*
Executes Vim script commands.
Note that `vim.cmd` can be indexed with a command name to return a
@@ -1552,12 +1512,12 @@ vim.cmd *vim.cmd()*
<
Parameters: ~
- • {command} string|table Command(s) to execute. If a string, executes
- multiple lines of Vim script at once. In this case, it is
- an alias to |nvim_exec2()|, where `opts.output` is set to
- false. Thus it works identical to |:source|. If a table,
- executes a single command. In this case, it is an alias to
- |nvim_cmd()| where `opts` is empty.
+ • {command} (`string|table`) Command(s) to execute. If a string,
+ executes multiple lines of Vim script at once. In this
+ case, it is an alias to |nvim_exec2()|, where `opts.output`
+ is set to false. Thus it works identical to |:source|. If a
+ table, executes a single command. In this case, it is an
+ alias to |nvim_cmd()| where `opts` is empty.
See also: ~
• |ex-cmd-index|
@@ -1569,33 +1529,34 @@ vim.defer_fn({fn}, {timeout}) *vim.defer_fn()*
|vim.schedule_wrap()|ped automatically, so API functions are safe to call.
Parameters: ~
- • {fn} (function) Callback to call once `timeout` expires
- • {timeout} (integer) Number of milliseconds to wait before calling
+ • {fn} (`function`) Callback to call once `timeout` expires
+ • {timeout} (`integer`) Number of milliseconds to wait before calling
`fn`
Return: ~
- (table) timer luv timer object
+ (`table`) timer luv timer object
*vim.deprecate()*
vim.deprecate({name}, {alternative}, {version}, {plugin}, {backtrace})
Shows a deprecation message to the user.
Parameters: ~
- • {name} string Deprecated feature (function, API, etc.).
- • {alternative} (string|nil) Suggested alternative feature.
- • {version} string Version when the deprecated function will be removed.
- • {plugin} string|nil Name of the plugin that owns the deprecated
+ • {name} (`string`) Deprecated feature (function, API, etc.).
+ • {alternative} (`string?`) Suggested alternative feature.
+ • {version} (`string`) Version when the deprecated function will be
+ removed.
+ • {plugin} (`string?`) Name of the plugin that owns the deprecated
feature. Defaults to "Nvim".
- • {backtrace} boolean|nil Prints backtrace. Defaults to true.
+ • {backtrace} (`boolean?`) Prints backtrace. Defaults to true.
Return: ~
- (string|nil) Deprecated message, or nil if no message was shown.
+ (`string?`) Deprecated message, or nil if no message was shown.
-vim.inspect *vim.inspect()*
+vim.inspect() *vim.inspect()*
Gets a human-readable representation of the given object.
Return: ~
- (string)
+ (`string`)
See also: ~
• |vim.print()|
@@ -1611,20 +1572,23 @@ vim.keycode({str}) *vim.keycode()*
<
Parameters: ~
- • {str} (string) String to be converted.
+ • {str} (`string`) String to be converted.
Return: ~
- (string)
+ (`string`)
See also: ~
• |nvim_replace_termcodes()|
-vim.lua_omnifunc({find_start}, {_}) *vim.lua_omnifunc()*
+vim.lua_omnifunc({find_start}) *vim.lua_omnifunc()*
Omnifunc for completing Lua values from the runtime Lua interpreter,
similar to the builtin completion for the `:lua` command.
Activate using `set omnifunc=v:lua.vim.lua_omnifunc` in a Lua buffer.
+ Parameters: ~
+ • {find_start} (`1|0`)
+
vim.notify({msg}, {level}, {opts}) *vim.notify()*
Displays a notification to the user.
@@ -1633,9 +1597,9 @@ vim.notify({msg}, {level}, {opts}) *vim.notify()*
writes to |:messages|.
Parameters: ~
- • {msg} (string) Content of the notification to show to the user.
- • {level} (integer|nil) One of the values from |vim.log.levels|.
- • {opts} (table|nil) Optional parameters. Unused by default.
+ • {msg} (`string`) Content of the notification to show to the user.
+ • {level} (`integer?`) One of the values from |vim.log.levels|.
+ • {opts} (`table?`) Optional parameters. Unused by default.
vim.notify_once({msg}, {level}, {opts}) *vim.notify_once()*
Displays a notification only one time.
@@ -1644,12 +1608,12 @@ vim.notify_once({msg}, {level}, {opts}) *vim.notify_once()*
display a notification.
Parameters: ~
- • {msg} (string) Content of the notification to show to the user.
- • {level} (integer|nil) One of the values from |vim.log.levels|.
- • {opts} (table|nil) Optional parameters. Unused by default.
+ • {msg} (`string`) Content of the notification to show to the user.
+ • {level} (`integer?`) One of the values from |vim.log.levels|.
+ • {opts} (`table?`) Optional parameters. Unused by default.
Return: ~
- (boolean) true if message was displayed, else false
+ (`boolean`) true if message was displayed, else false
vim.on_key({fn}, {ns_id}) *vim.on_key()*
Adds Lua function {fn} with namespace id {ns_id} as a listener to every,
@@ -1664,15 +1628,15 @@ vim.on_key({fn}, {ns_id}) *vim.on_key()*
• {fn} will receive the keys after mappings have been evaluated
Parameters: ~
- • {fn} fun(key: string) Function invoked on every key press.
- |i_CTRL-V| Returning nil removes the callback associated with
- namespace {ns_id}.
- • {ns_id} integer? Namespace ID. If nil or 0, generates and returns a
- new |nvim_create_namespace()| id.
+ • {fn} (`fun(key: string)?`) Function invoked on every key press.
+ |i_CTRL-V| Passing in nil when {ns_id} is specified removes
+ the callback associated with namespace {ns_id}.
+ • {ns_id} (`integer?`) Namespace ID. If nil or 0, generates and returns
+ a new |nvim_create_namespace()| id.
Return: ~
- (integer) Namespace id associated with {fn}. Or count of all callbacks
- if on_key() is called without arguments.
+ (`integer`) Namespace id associated with {fn}. Or count of all
+ callbacks if on_key() is called without arguments.
vim.paste({lines}, {phase}) *vim.paste()*
Paste handler, invoked by |nvim_paste()| when a conforming UI (such as the
@@ -1691,19 +1655,20 @@ vim.paste({lines}, {phase}) *vim.paste()*
<
Parameters: ~
- • {lines} string[] # |readfile()|-style list of lines to paste.
+ • {lines} (`string[]`) |readfile()|-style list of lines to paste.
|channel-lines|
- • {phase} paste_phase -1: "non-streaming" paste: the call contains all
- lines. If paste is "streamed", `phase` indicates the stream state:
+ • {phase} (`-1|1|2|3`) -1: "non-streaming" paste: the call contains all
+ lines. If paste is "streamed", `phase` indicates the stream
+ state:
• 1: starts the paste (exactly once)
• 2: continues the paste (zero or more times)
• 3: ends the paste (exactly once)
Return: ~
- (boolean) result false if client should cancel the paste.
+ (`boolean`) result false if client should cancel the paste.
See also: ~
- • |paste| @alias paste_phase -1 | 1 | 2 | 3
+ • |paste|
vim.print({...}) *vim.print()*
"Pretty prints" the given arguments and returns them unmodified.
@@ -1712,8 +1677,11 @@ vim.print({...}) *vim.print()*
local hl_normal = vim.print(vim.api.nvim_get_hl(0, { name = 'Normal' }))
<
+ Parameters: ~
+ • {...} (`any`)
+
Return: ~
- any given arguments.
+ (`any`) given arguments.
See also: ~
• |vim.inspect()|
@@ -1729,17 +1697,17 @@ vim.region({bufnr}, {pos1}, {pos2}, {regtype}, {inclusive})
returned as |v:maxcol| (big number).
Parameters: ~
- • {bufnr} (integer) Buffer number, or 0 for current buffer
- • {pos1} integer[]|string Start of region as a (line, column)
+ • {bufnr} (`integer`) Buffer number, or 0 for current buffer
+ • {pos1} (`integer[]|string`) Start of region as a (line, column)
tuple or |getpos()|-compatible string
- • {pos2} integer[]|string End of region as a (line, column) tuple
- or |getpos()|-compatible string
- • {regtype} (string) |setreg()|-style selection type
- • {inclusive} (boolean) Controls whether the ending column is inclusive
- (see also 'selection').
+ • {pos2} (`integer[]|string`) End of region as a (line, column)
+ tuple or |getpos()|-compatible string
+ • {regtype} (`string`) |setreg()|-style selection type
+ • {inclusive} (`boolean`) Controls whether the ending column is
+ inclusive (see also 'selection').
Return: ~
- (table) region Dict of the form `{linenr = {startcol,endcol}}`.
+ (`table`) region Dict of the form `{linenr = {startcol,endcol}}`.
`endcol` is exclusive, and whole lines are returned as
`{startcol,endcol} = {0,-1}`.
@@ -1756,10 +1724,10 @@ vim.schedule_wrap({fn}) *vim.schedule_wrap()*
<
Parameters: ~
- • {fn} (function)
+ • {fn} (`function`)
Return: ~
- (function)
+ (`function`)
See also: ~
• |lua-loop-callbacks|
@@ -1789,8 +1757,8 @@ vim.system({cmd}, {opts}, {on_exit}) *vim.system()*
throws an error if {cmd} cannot be run.
Parameters: ~
- • {cmd} (string[]) Command to execute
- • {opts} (SystemOpts|nil) Options:
+ • {cmd} (`string[]`) Command to execute
+ • {opts} (`vim.SystemOpts?`) Options:
• cwd: (string) Set the current working directory for the
sub-process.
• env: table<string,string> Set environment variables for
@@ -1820,12 +1788,13 @@ vim.system({cmd}, {opts}, {on_exit}) *vim.system()*
process will still keep the parent's event loop alive
unless the parent process calls |uv.unref()| on the
child's process handle.
- • {on_exit} (function|nil) Called when subprocess exits. When provided,
- the command runs asynchronously. Receives SystemCompleted
- object, see return of SystemObj:wait().
+ • {on_exit} (`fun(out: vim.SystemCompleted)?`) Called when subprocess
+ exits. When provided, the command runs asynchronously.
+ Receives SystemCompleted object, see return of
+ SystemObj:wait().
Return: ~
- vim.SystemObj Object with the fields:
+ (`vim.SystemObj`) Object with the fields:
• pid (integer) Process ID
• wait (fun(timeout: integer|nil): SystemCompleted) Wait for the
process to complete. Upon timeout the process is sent the KILL
@@ -1836,7 +1805,6 @@ vim.system({cmd}, {opts}, {on_exit}) *vim.system()*
• signal: (integer)
• stdout: (string), nil if stdout argument is passed
• stderr: (string), nil if stderr argument is passed
-
• kill (fun(signal: integer|string))
• write (fun(data: string|nil)) Requires `stdin=true`. Pass `nil` to
close the stream.
@@ -1852,24 +1820,24 @@ vim.inspect_pos({bufnr}, {row}, {col}, {filter}) *vim.inspect_pos()*
Can also be pretty-printed with `:Inspect!`. *:Inspect!*
Parameters: ~
- • {bufnr} (integer|nil) defaults to the current buffer
- • {row} (integer|nil) row to inspect, 0-based. Defaults to the row
- of the current cursor
- • {col} (integer|nil) col to inspect, 0-based. Defaults to the col
- of the current cursor
- • {filter} (table|nil) a table with key-value pairs to filter the items
- • syntax (boolean): include syntax based highlight groups
- (defaults to true)
- • treesitter (boolean): include treesitter based highlight
- groups (defaults to true)
- • extmarks (boolean|"all"): include extmarks. When `all`,
- then extmarks without a `hl_group` will also be included
- (defaults to true)
- • semantic_tokens (boolean): include semantic tokens
- (defaults to true)
-
- Return: ~
- (table) a table with the following key-value pairs. Items are in
+ • {bufnr} (`integer?`) defaults to the current buffer
+ • {row} (`integer?`) row to inspect, 0-based. Defaults to the row of
+ the current cursor
+ • {col} (`integer?`) col to inspect, 0-based. Defaults to the col of
+ the current cursor
+ • {filter} (`table?`) Table with key-value pairs to filter the items
+ • {syntax} (`boolean`, default: `true`) Include syntax based
+ highlight groups.
+ • {treesitter} (`boolean`, default: `true`) Include
+ treesitter based highlight groups.
+ • {extmarks} (`boolean|"all"`, default: true) Include
+ extmarks. When `all`, then extmarks without a `hl_group`
+ will also be included.
+ • {semantic_tokens} (`boolean`, default: true) Include
+ semantic token highlights.
+
+ Return: ~
+ (`table`) a table with the following key-value pairs. Items are in
"traversal order":
• treesitter: a list of treesitter captures
• syntax: a list of syntax groups
@@ -1885,40 +1853,91 @@ vim.show_pos({bufnr}, {row}, {col}, {filter}) *vim.show_pos()*
Can also be shown with `:Inspect`. *:Inspect*
Parameters: ~
- • {bufnr} (integer|nil) defaults to the current buffer
- • {row} (integer|nil) row to inspect, 0-based. Defaults to the row
- of the current cursor
- • {col} (integer|nil) col to inspect, 0-based. Defaults to the col
- of the current cursor
- • {filter} (table|nil) see |vim.inspect_pos()|
+ • {bufnr} (`integer?`) defaults to the current buffer
+ • {row} (`integer?`) row to inspect, 0-based. Defaults to the row of
+ the current cursor
+ • {col} (`integer?`) col to inspect, 0-based. Defaults to the col of
+ the current cursor
+ • {filter} (`table?`) A table with the following fields:
+ • {syntax} (`boolean`, default: `true`) Include syntax based
+ highlight groups.
+ • {treesitter} (`boolean`, default: `true`) Include
+ treesitter based highlight groups.
+ • {extmarks} (`boolean|"all"`, default: true) Include
+ extmarks. When `all`, then extmarks without a `hl_group`
+ will also be included.
+ • {semantic_tokens} (`boolean`, default: true) Include
+ semantic token highlights.
+
+
+
+
+*vim.Ringbuf*
+
+ Fields: ~
+ • {clear} (`fun()`) Clear all items
+ • {push} (`fun(item: T)`) Adds an item, overriding the oldest item if
+ the buffer is full.
+ • {pop} (`fun(): T?`) Removes and returns the first unread item
+ • {peek} (`fun(): T?`) Returns the first unread item without removing
+ it
+
+
+Ringbuf:clear() *Ringbuf:clear()*
+ Clear all items
+
+Ringbuf:peek() *Ringbuf:peek()*
+ Returns the first unread item without removing it
+
+ Return: ~
+ (`any?`)
+Ringbuf:pop() *Ringbuf:pop()*
+ Removes and returns the first unread item
+
+ Return: ~
+ (`any?`)
+Ringbuf:push({item}) *Ringbuf:push()*
+ Adds an item, overriding the oldest item if the buffer is full.
+ Parameters: ~
+ • {item} (`any`)
vim.deep_equal({a}, {b}) *vim.deep_equal()*
Deep compare values for equality
- Tables are compared recursively unless they both provide the `eq` metamethod. All other types are compared using the equality `==` operator.
+ Tables are compared recursively unless they both provide the `eq`
+ metamethod. All other types are compared using the equality `==` operator.
Parameters: ~
- • {a} any First value
- • {b} any Second value
+ • {a} (`any`) First value
+ • {b} (`any`) Second value
Return: ~
- (boolean) `true` if values are equals, else `false`
+ (`boolean`) `true` if values are equals, else `false`
-vim.deepcopy({orig}) *vim.deepcopy()*
+vim.deepcopy({orig}, {noref}) *vim.deepcopy()*
Returns a deep copy of the given object. Non-table objects are copied as
in a typical Lua assignment, whereas table objects are copied recursively.
Functions are naively copied, so functions in the copied table point to
the same functions as those in the input table. Userdata and threads are
not copied and will throw an error.
+ Note: `noref=true` is much more performant on tables with unique table
+ fields, while `noref=false` is more performant on tables that reuse table
+ fields.
+
Parameters: ~
- • {orig} (table) Table to copy
+ • {orig} (`table`) Table to copy
+ • {noref} (`boolean?`) When `false` (default) a contained table is only
+ copied once and all references point to this single copy.
+ When `true` every occurrence of a table results in a new
+ copy. This also means that a cyclic reference can cause
+ `deepcopy()` to fail.
Return: ~
- (table) Table of copied keys and (nested) values.
+ (`table`) Table of copied keys and (nested) values.
vim.defaulttable({createfn}) *vim.defaulttable()*
Creates a table whose missing keys are provided by {createfn} (like
@@ -1931,21 +1950,21 @@ vim.defaulttable({createfn}) *vim.defaulttable()*
<
Parameters: ~
- • {createfn} function?(key:any):any Provides the value for a missing
+ • {createfn} (`fun(key:any):any?`) Provides the value for a missing
`key`.
Return: ~
- (table) Empty table with `__index` metamethod.
+ (`table`) Empty table with `__index` metamethod.
vim.endswith({s}, {suffix}) *vim.endswith()*
Tests if `s` ends with `suffix`.
Parameters: ~
- • {s} (string) String
- • {suffix} (string) Suffix to match
+ • {s} (`string`) String
+ • {suffix} (`string`) Suffix to match
Return: ~
- (boolean) `true` if `suffix` is a suffix of `s`
+ (`boolean`) `true` if `suffix` is a suffix of `s`
vim.gsplit({s}, {sep}, {opts}) *vim.gsplit()*
Gets an |iterator| that splits a string at each instance of a separator,
@@ -1965,15 +1984,16 @@ vim.gsplit({s}, {sep}, {opts}) *vim.gsplit()*
<
Parameters: ~
- • {s} (string) String to split
- • {sep} (string) Separator or pattern
- • {opts} (table|nil) Keyword arguments |kwargs|:
- • plain: (boolean) Use `sep` literally (as in string.find).
- • trimempty: (boolean) Discard empty segments at start and end
- of the sequence.
+ • {s} (`string`) String to split
+ • {sep} (`string`) Separator or pattern
+ • {opts} (`table?`) Keyword arguments |kwargs|:
+ • {plain}? (`boolean`) Use `sep` literally (as in
+ string.find).
+ • {trimempty}? (`boolean`) Discard empty segments at start and
+ end of the sequence.
Return: ~
- (function) Iterator over the split components
+ (`fun():string?`) Iterator over the split components
See also: ~
• |string.gmatch()|
@@ -1986,20 +2006,20 @@ vim.is_callable({f}) *vim.is_callable()*
Returns true if object `f` can be called as a function.
Parameters: ~
- • {f} any Any object
+ • {f} (`any`) Any object
Return: ~
- (boolean) `true` if `f` is callable, else `false`
+ (`boolean`) `true` if `f` is callable, else `false`
vim.list_contains({t}, {value}) *vim.list_contains()*
Checks if a list-like table (integer keys without gaps) contains `value`.
Parameters: ~
- • {t} (table) Table to check (must be list-like, not validated)
- • {value} any Value to compare
+ • {t} (`table`) Table to check (must be list-like, not validated)
+ • {value} (`any`) Value to compare
Return: ~
- (boolean) `true` if `t` contains `value`
+ (`boolean`) `true` if `t` contains `value`
See also: ~
• |vim.tbl_contains()| for checking values in general tables
@@ -2010,13 +2030,13 @@ vim.list_extend({dst}, {src}, {start}, {finish}) *vim.list_extend()*
NOTE: This mutates dst!
Parameters: ~
- • {dst} (table) List which will be modified and appended to
- • {src} (table) List from which values will be inserted
- • {start} (integer|nil) Start index on src. Defaults to 1
- • {finish} (integer|nil) Final index on src. Defaults to `#src`
+ • {dst} (`table`) List which will be modified and appended to
+ • {src} (`table`) List from which values will be inserted
+ • {start} (`integer?`) Start index on src. Defaults to 1
+ • {finish} (`integer?`) Final index on src. Defaults to `#src`
Return: ~
- (table) dst
+ (`table`) dst
See also: ~
• |vim.tbl_extend()|
@@ -2026,21 +2046,21 @@ vim.list_slice({list}, {start}, {finish}) *vim.list_slice()*
(inclusive)
Parameters: ~
- • {list} (list) Table
- • {start} (integer|nil) Start range of slice
- • {finish} (integer|nil) End range of slice
+ • {list} (`any[]`) Table
+ • {start} (`integer?`) Start range of slice
+ • {finish} (`integer?`) End range of slice
Return: ~
- (list) Copy of table sliced from start to finish (inclusive)
+ (`any[]`) Copy of table sliced from start to finish (inclusive)
vim.pesc({s}) *vim.pesc()*
Escapes magic chars in |lua-patterns|.
Parameters: ~
- • {s} (string) String to escape
+ • {s} (`string`) String to escape
Return: ~
- (string) %-escaped pattern string
+ (`string`) %-escaped pattern string
See also: ~
• https://github.com/rxi/lume
@@ -2064,50 +2084,31 @@ vim.ringbuf({size}) *vim.ringbuf()*
<
Returns a Ringbuf instance with the following methods:
-
• |Ringbuf:push()|
• |Ringbuf:pop()|
• |Ringbuf:peek()|
• |Ringbuf:clear()|
Parameters: ~
- • {size} (integer)
-
- Return: ~
- (table)
-
-vim.Ringbuf:clear() *Ringbuf:clear()*
- Clear all items.
-
-vim.Ringbuf:peek() *Ringbuf:peek()*
- Returns the first unread item without removing it
+ • {size} (`integer`)
Return: ~
- any?|nil
-
-vim.Ringbuf:pop() *Ringbuf:pop()*
- Removes and returns the first unread item
-
- Return: ~
- any?|nil
-
-vim.Ringbuf:push({item}) *Ringbuf:push()*
- Adds an item, overriding the oldest item if the buffer is full.
-
- Parameters: ~
- • {item} any
+ (`vim.Ringbuf`) ringbuf See |vim.Ringbuf|.
vim.spairs({t}) *vim.spairs()*
Enumerates key-value pairs of a table, ordered by key.
Parameters: ~
- • {t} (table) Dict-like table
+ • {t} (`table`) Dict-like table
- Return: ~
- (function) |for-in| iterator over sorted keys and their values
+ Return (multiple): ~
+ (`fun(table: table<K, V>, index?: K):K, V`) |for-in| iterator over
+ sorted keys and their values
+ (`table`)
See also: ~
- • Based on https://github.com/premake/premake-core/blob/master/src/base/table.lua
+ • Based on
+ https://github.com/premake/premake-core/blob/master/src/base/table.lua
vim.split({s}, {sep}, {opts}) *vim.split()*
Splits a string at each instance of a separator and returns the result as
@@ -2121,13 +2122,16 @@ vim.split({s}, {sep}, {opts}) *vim.split()*
<
Parameters: ~
- • {s} (string) String to split
- • {sep} (string) Separator or pattern
- • {opts} (table|nil) Keyword arguments |kwargs| accepted by
- |vim.gsplit()|
+ • {s} (`string`) String to split
+ • {sep} (`string`) Separator or pattern
+ • {opts} (`table?`) Keyword arguments |kwargs|:
+ • {plain}? (`boolean`) Use `sep` literally (as in
+ string.find).
+ • {trimempty}? (`boolean`) Discard empty segments at start and
+ end of the sequence.
Return: ~
- string[] List of split components
+ (`string[]`) List of split components
See also: ~
• |vim.gsplit()|
@@ -2137,23 +2141,11 @@ vim.startswith({s}, {prefix}) *vim.startswith()*
Tests if `s` starts with `prefix`.
Parameters: ~
- • {s} (string) String
- • {prefix} (string) Prefix to match
-
- Return: ~
- (boolean) `true` if `prefix` is a prefix of `s`
-
-vim.tbl_add_reverse_lookup({o}) *vim.tbl_add_reverse_lookup()*
- Add the reverse lookup values to an existing table. For example:
- `tbl_add_reverse_lookup { A = 1 } == { [1] = 'A', A = 1 }`
-
- Note that this modifies the input.
-
- Parameters: ~
- • {o} (table) Table to add the reverse to
+ • {s} (`string`) String
+ • {prefix} (`string`) Prefix to match
Return: ~
- (table) o
+ (`boolean`) `true` if `prefix` is a prefix of `s`
vim.tbl_contains({t}, {value}, {opts}) *vim.tbl_contains()*
Checks if a table contains a given value, specified either directly or via
@@ -2167,14 +2159,14 @@ vim.tbl_contains({t}, {value}, {opts}) *vim.tbl_contains()*
<
Parameters: ~
- • {t} (table) Table to check
- • {value} any Value to compare or predicate function reference
- • {opts} (table|nil) Keyword arguments |kwargs|:
- • predicate: (boolean) `value` is a function reference to be
- checked (default false)
+ • {t} (`table`) Table to check
+ • {value} (`any`) Value to compare or predicate function reference
+ • {opts} (`table?`) Keyword arguments |kwargs|:
+ • {predicate}? (`boolean`) `value` is a function reference to
+ be checked (default false)
Return: ~
- (boolean) `true` if `t` contains `value`
+ (`boolean`) `true` if `t` contains `value`
See also: ~
• |vim.list_contains()| for checking values in list-like tables
@@ -2186,10 +2178,10 @@ vim.tbl_count({t}) *vim.tbl_count()*
<
Parameters: ~
- • {t} (table) Table
+ • {t} (`table`) Table
Return: ~
- (integer) Number of non-nil values in table
+ (`integer`) Number of non-nil values in table
See also: ~
• https://github.com/Tieske/Penlight/blob/master/lua/pl/tablex.lua
@@ -2198,15 +2190,15 @@ vim.tbl_deep_extend({behavior}, {...}) *vim.tbl_deep_extend()*
Merges recursively two or more tables.
Parameters: ~
- • {behavior} (string) Decides what to do if a key is found in more than
- one map:
+ • {behavior} (`"error"|"keep"|"force"`) (string) Decides what to do if
+ a key is found in more than one map:
• "error": raise an error
• "keep": use value from the leftmost map
• "force": use value from the rightmost map
- • {...} (table) Two or more tables
+ • {...} (`table`) Two or more tables
Return: ~
- (table) Merged table
+ (`table`) Merged table
See also: ~
• |vim.tbl_extend()|
@@ -2215,15 +2207,15 @@ vim.tbl_extend({behavior}, {...}) *vim.tbl_extend()*
Merges two or more tables.
Parameters: ~
- • {behavior} (string) Decides what to do if a key is found in more than
- one map:
+ • {behavior} (`string`) Decides what to do if a key is found in more
+ than one map:
• "error": raise an error
• "keep": use value from the leftmost map
• "force": use value from the rightmost map
- • {...} (table) Two or more tables
+ • {...} (`table`) Two or more tables
Return: ~
- (table) Merged table
+ (`table`) Merged table
See also: ~
• |extend()|
@@ -2232,24 +2224,25 @@ vim.tbl_filter({func}, {t}) *vim.tbl_filter()*
Filter a table using a predicate function
Parameters: ~
- • {func} (function) Function
- • {t} (table) Table
+ • {func} (`function`) Function
+ • {t} (`table`) Table
Return: ~
- (table) Table of filtered values
+ (`any[]`) Table of filtered values
vim.tbl_flatten({t}) *vim.tbl_flatten()*
Creates a copy of a list-like table such that any nested tables are
"unrolled" and appended to the result.
Parameters: ~
- • {t} (table) List-like table
+ • {t} (`table`) List-like table
Return: ~
- (table) Flattened copy of the given list-like table
+ (`table`) Flattened copy of the given list-like table
See also: ~
- • From https://github.com/premake/premake-core/blob/master/src/base/table.lua
+ • From
+ https://github.com/premake/premake-core/blob/master/src/base/table.lua
vim.tbl_get({o}, {...}) *vim.tbl_get()*
Index into a table (first argument) via string keys passed as subsequent
@@ -2261,15 +2254,16 @@ vim.tbl_get({o}, {...}) *vim.tbl_get()*
<
Parameters: ~
- • {o} (table) Table to index
- • {...} any Optional keys (0 or more, variadic) via which to index the
- table
+ • {o} (`table`) Table to index
+ • {...} (`any`) Optional keys (0 or more, variadic) via which to index
+ the table
Return: ~
- any Nested value indexed by key (if it exists), else nil
+ (`any`) Nested value indexed by key (if it exists), else nil
vim.tbl_isarray({t}) *vim.tbl_isarray()*
- Tests if `t` is an "array": a table indexed only by integers (potentially non-contiguous).
+ Tests if `t` is an "array": a table indexed only by integers (potentially
+ non-contiguous).
If the indexes start from 1 and are contiguous then the array is also a
list. |vim.tbl_islist()|
@@ -2279,10 +2273,10 @@ vim.tbl_isarray({t}) *vim.tbl_isarray()*
|rpcrequest()| or |vim.fn|.
Parameters: ~
- • {t} (table)
+ • {t} (`table`)
Return: ~
- (boolean) `true` if array-like table, else `false`.
+ (`boolean`) `true` if array-like table, else `false`.
See also: ~
• https://github.com/openresty/luajit2#tableisarray
@@ -2291,27 +2285,27 @@ vim.tbl_isempty({t}) *vim.tbl_isempty()*
Checks if a table is empty.
Parameters: ~
- • {t} (table) Table to check
+ • {t} (`table`) Table to check
Return: ~
- (boolean) `true` if `t` is empty
+ (`boolean`) `true` if `t` is empty
See also: ~
• https://github.com/premake/premake-core/blob/master/src/base/table.lua
vim.tbl_islist({t}) *vim.tbl_islist()*
- Tests if `t` is a "list": a table indexed only by contiguous integers starting from 1 (what |lua-length| calls a "regular
- array").
+ Tests if `t` is a "list": a table indexed only by contiguous integers
+ starting from 1 (what |lua-length| calls a "regular array").
Empty table `{}` is a list, unless it was created by |vim.empty_dict()| or
returned as a dict-like |API| or Vimscript result, for example from
|rpcrequest()| or |vim.fn|.
Parameters: ~
- • {t} (table)
+ • {t} (`table`)
Return: ~
- (boolean) `true` if list-like table, else `false`.
+ (`boolean`) `true` if list-like table, else `false`.
See also: ~
• |vim.tbl_isarray()|
@@ -2321,42 +2315,43 @@ vim.tbl_keys({t}) *vim.tbl_keys()*
return table of keys is not guaranteed.
Parameters: ~
- • {t} (table) Table
+ • {t} (`table`) Table
Return: ~
- (list) List of keys
+ (`any[]`) List of keys
See also: ~
- • From https://github.com/premake/premake-core/blob/master/src/base/table.lua
+ • From
+ https://github.com/premake/premake-core/blob/master/src/base/table.lua
vim.tbl_map({func}, {t}) *vim.tbl_map()*
Apply a function to all values of a table.
Parameters: ~
- • {func} (function) Function
- • {t} (table) Table
+ • {func} (`fun(value: T): any`) Function
+ • {t} (`table<any, T>`) Table
Return: ~
- (table) Table of transformed values
+ (`table`) Table of transformed values
vim.tbl_values({t}) *vim.tbl_values()*
Return a list of all values used in a table. However, the order of the
return table of values is not guaranteed.
Parameters: ~
- • {t} (table) Table
+ • {t} (`table`) Table
Return: ~
- (list) List of values
+ (`any[]`) List of values
vim.trim({s}) *vim.trim()*
Trim whitespace (Lua pattern "%s") from both sides of a string.
Parameters: ~
- • {s} (string) String to trim
+ • {s} (`string`) String to trim
Return: ~
- (string) String with whitespace removed from its beginning and end
+ (`string`) String with whitespace removed from its beginning and end
See also: ~
• |lua-patterns|
@@ -2396,7 +2391,7 @@ vim.validate({opt}) *vim.validate()*
<
Parameters: ~
- • {opt} (table) Names of parameters to validate. Each key is a
+ • {opt} (`table`) Names of parameters to validate. Each key is a
parameter name; each value is a tuple in one of these forms:
1. (arg_value, type_name, optional)
• arg_value: argument value
@@ -2404,7 +2399,6 @@ vim.validate({opt}) *vim.validate()*
"string", "s", "number", "n", "boolean", "b", "function",
"f", "nil", "thread", "userdata") or list of them.
• optional: (optional) boolean, if true, `nil` is valid
-
2. (arg_value, fn, msg)
• arg_value: argument value
• fn: any function accepting one argument, returns true if
@@ -2433,32 +2427,32 @@ vim.loader.find({modname}, {opts}) *vim.loader.find()*
Finds Lua modules for the given module name.
Parameters: ~
- • {modname} (string) Module name, or `"*"` to find the top-level
+ • {modname} (`string`) Module name, or `"*"` to find the top-level
modules instead
- • {opts} (table|nil) Options for finding a module:
- • rtp: (boolean) Search for modname in the runtime path
- (defaults to `true`)
- • paths: (string[]) Extra paths to search for modname
- (defaults to `{}`)
- • patterns: (string[]) List of patterns to use when
+ • {opts} (`table?`) Options for finding a module:
+ • {rtp}? (`boolean`, default: `true`) Search for modname in
+ the runtime path.
+ • {paths}? (`string[]`, default: `{}`) Extra paths to
+ search for modname
+ • {patterns}? (`string[]`, default:
+ `{"/init.lua", ".lua"}`) List of patterns to use when
searching for modules. A pattern is a string added to the
- basename of the Lua module being searched. (defaults to
- `{"/init.lua", ".lua"}`)
- • all: (boolean) Return all matches instead of just the
- first one (defaults to `false`)
+ basename of the Lua module being searched.
+ • {all}? (`boolean`, default: `false`) Search for all
+ matches.
Return: ~
- (list) A list of results with the following properties:
- • modpath: (string) the path to the module
- • modname: (string) the name of the module
- • stat: (table|nil) the fs_stat of the module path. Won't be returned
- for `modname="*"`
+ (`table[]`) A list of objects with the following fields:
+ • {modpath} (`string`) Path of the module
+ • {modname} (`string`) Name of the module
+ • {stat}? (`uv.uv_fs_t`) The fs_stat of the module path. Won't be
+ returned for `modname="*"`
vim.loader.reset({path}) *vim.loader.reset()*
Resets the cache for the path, or all the paths if path is nil.
Parameters: ~
- • {path} string? path to reset
+ • {path} (`string?`) path to reset
==============================================================================
@@ -2468,57 +2462,57 @@ vim.uri_decode({str}) *vim.uri_decode()*
URI-decodes a string containing percent escapes.
Parameters: ~
- • {str} (string) string to decode
+ • {str} (`string`) string to decode
Return: ~
- (string) decoded string
+ (`string`) decoded string
vim.uri_encode({str}, {rfc}) *vim.uri_encode()*
URI-encodes a string using percent escapes.
Parameters: ~
- • {str} (string) string to encode
- • {rfc} "rfc2396" | "rfc2732" | "rfc3986" | nil
+ • {str} (`string`) string to encode
+ • {rfc} (`"rfc2396"|"rfc2732"|"rfc3986"?`)
Return: ~
- (string) encoded string
+ (`string`) encoded string
vim.uri_from_bufnr({bufnr}) *vim.uri_from_bufnr()*
Gets a URI from a bufnr.
Parameters: ~
- • {bufnr} (integer)
+ • {bufnr} (`integer`)
Return: ~
- (string) URI
+ (`string`) URI
vim.uri_from_fname({path}) *vim.uri_from_fname()*
Gets a URI from a file path.
Parameters: ~
- • {path} (string) Path to file
+ • {path} (`string`) Path to file
Return: ~
- (string) URI
+ (`string`) URI
vim.uri_to_bufnr({uri}) *vim.uri_to_bufnr()*
Gets the buffer for a uri. Creates a new unloaded buffer if no buffer for
the uri already exists.
Parameters: ~
- • {uri} (string)
+ • {uri} (`string`)
Return: ~
- (integer) bufnr
+ (`integer`) bufnr
vim.uri_to_fname({uri}) *vim.uri_to_fname()*
Gets a filename from a URI.
Parameters: ~
- • {uri} (string)
+ • {uri} (`string`)
Return: ~
- (string) filename or unchanged URI for non-file URIs
+ (`string`) filename or unchanged URI for non-file URIs
==============================================================================
@@ -2535,7 +2529,7 @@ vim.ui.input({opts}, {on_confirm}) *vim.ui.input()*
<
Parameters: ~
- • {opts} (table) Additional options. See |input()|
+ • {opts} (`table?`) Additional options. See |input()|
• prompt (string|nil) Text of the prompt
• default (string|nil) Default reply to the input
• completion (string|nil) Specifies type of completion
@@ -2544,7 +2538,7 @@ vim.ui.input({opts}, {on_confirm}) *vim.ui.input()*
"-complete=" argument. See |:command-completion|
• highlight (function) Function that will be used for
highlighting user inputs.
- • {on_confirm} (function) ((input|nil) -> ()) Called once the user
+ • {on_confirm} (`function`) ((input|nil) -> ()) Called once the user
confirms or abort the input. `input` is what the user
typed (it might be an empty string if nothing was
entered), or `nil` if the user aborted the dialog.
@@ -2563,11 +2557,11 @@ vim.ui.open({path}) *vim.ui.open()*
<
Parameters: ~
- • {path} (string) Path or URL to open
+ • {path} (`string`) Path or URL to open
Return (multiple): ~
- vim.SystemCompleted|nil Command result, or nil if not found.
- (string|nil) Error message on failure
+ (`vim.SystemCompleted?`) Command result, or nil if not found.
+ (`string?`) Error message on failure
See also: ~
• |vim.system()|
@@ -2592,8 +2586,8 @@ vim.ui.select({items}, {opts}, {on_choice}) *vim.ui.select()*
<
Parameters: ~
- • {items} (table) Arbitrary items
- • {opts} (table) Additional options
+ • {items} (`any[]`) Arbitrary items
+ • {opts} (`table`) Additional options
• prompt (string|nil) Text of the prompt. Defaults to
`Select one of:`
• format_item (function item -> text) Function to format
@@ -2603,8 +2597,8 @@ vim.ui.select({items}, {opts}, {on_choice}) *vim.ui.select()*
item shape. Plugins reimplementing `vim.ui.select` may
wish to use this to infer the structure or semantics of
`items`, or the context in which select() was called.
- • {on_choice} (function) ((item|nil, idx|nil) -> ()) Called once the
- user made a choice. `idx` is the 1-based index of `item`
+ • {on_choice} (`fun(item: any?, idx: integer?)`) Called once the user
+ made a choice. `idx` is the 1-based index of `item`
within `items`. `nil` if the user aborted the dialog.
@@ -2658,9 +2652,9 @@ vim.filetype.add({filetypes}) *vim.filetype.add()*
['/etc/foo/config'] = 'toml',
},
pattern = {
- ['.*&zwj;/etc/foo/.*'] = 'fooscript',
+ ['.*/etc/foo/.*'] = 'fooscript',
-- Using an optional priority
- ['.*&zwj;/etc/foo/.*%.conf'] = { 'dosini', { priority = 10 } },
+ ['.*/etc/foo/.*%.conf'] = { 'dosini', { priority = 10 } },
-- A pattern containing an environment variable
['${XDG_CONFIG_HOME}/foo/git'] = 'git',
['README.(%a+)$'] = function(path, bufnr, ext)
@@ -2693,8 +2687,11 @@ vim.filetype.add({filetypes}) *vim.filetype.add()*
<
Parameters: ~
- • {filetypes} (table) A table containing new filetype maps (see
+ • {filetypes} (`table`) A table containing new filetype maps (see
example).
+ • {pattern}? (`vim.filetype.mapping`)
+ • {extension}? (`vim.filetype.mapping`)
+ • {filename}? (`vim.filetype.mapping`)
*vim.filetype.get_option()*
vim.filetype.get_option({filetype}, {option})
@@ -2713,11 +2710,11 @@ vim.filetype.get_option({filetype}, {option})
may not reflect later changes.
Parameters: ~
- • {filetype} (string) Filetype
- • {option} (string) Option name
+ • {filetype} (`string`) Filetype
+ • {option} (`string`) Option name
Return: ~
- string|boolean|integer: Option value
+ (`string|boolean|integer`) Option value
vim.filetype.match({args}) *vim.filetype.match()*
Perform filetype detection.
@@ -2749,24 +2746,24 @@ vim.filetype.match({args}) *vim.filetype.match()*
<
Parameters: ~
- • {args} (table) Table specifying which matching strategy to use.
+ • {args} (`table`) Table specifying which matching strategy to use.
Accepted keys are:
- • buf (number): Buffer number to use for matching. Mutually
- exclusive with {contents}
- • filename (string): Filename to use for matching. When {buf}
- is given, defaults to the filename of the given buffer
+ • {buf}? (`integer`) Buffer number to use for matching.
+ Mutually exclusive with {contents}
+ • {filename}? (`string`) Filename to use for matching. When
+ {buf} is given, defaults to the filename of the given buffer
number. The file need not actually exist in the filesystem.
When used without {buf} only the name of the file is used
for filetype matching. This may result in failure to detect
the filetype in cases where the filename alone is not enough
to disambiguate the filetype.
- • contents (table): An array of lines representing file
+ • {contents}? (`string[]`) An array of lines representing file
contents to use for matching. Can be used with {filename}.
Mutually exclusive with {buf}.
Return (multiple): ~
- (string|nil) If a match was found, the matched filetype.
- (function|nil) A function that modifies buffer state when called (for
+ (`string?`) If a match was found, the matched filetype.
+ (`function?`) A function that modifies buffer state when called (for
example, to set some filetype specific buffer variables). The function
accepts a buffer number as its only argument.
@@ -2782,9 +2779,11 @@ vim.keymap.del({modes}, {lhs}, {opts}) *vim.keymap.del()*
<
Parameters: ~
- • {opts} (table|nil) A table of optional arguments:
- • "buffer": (integer|boolean) Remove a mapping from the given
- buffer. When `0` or `true`, use the current buffer.
+ • {modes} (`string|string[]`)
+ • {lhs} (`string`)
+ • {opts} (`table?`) A table of optional arguments:
+ • "buffer": (integer|boolean) Remove a mapping from the given
+ buffer. When `0` or `true`, use the current buffer.
See also: ~
• |vim.keymap.set()|
@@ -2806,16 +2805,15 @@ vim.keymap.set({mode}, {lhs}, {rhs}, {opts}) *vim.keymap.set()*
<
Parameters: ~
- • {mode} string|table Mode short-name, see |nvim_set_keymap()|. Can
+ • {mode} (`string|table`) Mode short-name, see |nvim_set_keymap()|. Can
also be list of modes to create mapping on multiple modes.
- • {lhs} (string) Left-hand side |{lhs}| of the mapping.
- • {rhs} string|function Right-hand side |{rhs}| of the mapping, can be
- a Lua function.
- • {opts} (table|nil) Table of |:map-arguments|.
+ • {lhs} (`string`) Left-hand side |{lhs}| of the mapping.
+ • {rhs} (`string|function`) Right-hand side |{rhs}| of the mapping,
+ can be a Lua function.
+ • {opts} (`table?`) Table of |:map-arguments|.
• Same as |nvim_set_keymap()| {opts}, except:
• "replace_keycodes" defaults to `true` if "expr" is `true`.
• "noremap": inverse of "remap" (see below).
-
• Also accepts:
• "buffer": (integer|boolean) Creates buffer-local mapping,
`0` or `true` for current buffer.
@@ -2836,26 +2834,26 @@ vim.fs.basename({file}) *vim.fs.basename()*
Return the basename of the given path
Parameters: ~
- • {file} (string) Path
+ • {file} (`string?`) Path
Return: ~
- (string|nil) Basename of {file}
+ (`string?`) Basename of {file}
vim.fs.dir({path}, {opts}) *vim.fs.dir()*
Return an iterator over the items located in {path}
Parameters: ~
- • {path} (string) An absolute or relative path to the directory to
+ • {path} (`string`) An absolute or relative path to the directory to
iterate over. The path is first normalized
|vim.fs.normalize()|.
- • {opts} (table|nil) Optional keyword arguments:
+ • {opts} (`table?`) Optional keyword arguments:
• depth: integer|nil How deep the traverse (default 1)
• skip: (fun(dir_name: string): boolean)|nil Predicate to
control traversal. Return false to stop searching the
current directory. Only useful when depth > 1
Return: ~
- Iterator over items in {path}. Each iteration yields two values:
+ (`Iterator`) over items in {path}. Each iteration yields two values:
"name" and "type". "name" is the basename of the item relative to
{path}. "type" is one of the following: "file", "directory", "link",
"fifo", "socket", "char", "block", "unknown".
@@ -2864,10 +2862,10 @@ vim.fs.dirname({file}) *vim.fs.dirname()*
Return the parent directory of the given path
Parameters: ~
- • {file} (string) Path
+ • {file} (`string?`) Path
Return: ~
- (string|nil) Parent directory of {file}
+ (`string?`) Parent directory of {file}
vim.fs.find({names}, {opts}) *vim.fs.find()*
Find files or directories (or other items as specified by `opts.type`) in
@@ -2903,7 +2901,7 @@ vim.fs.find({names}, {opts}) *vim.fs.find()*
<
Parameters: ~
- • {names} (string|string[]|fun(name: string, path: string): boolean)
+ • {names} (`string|string[]|fun(name: string, path: string): boolean`)
Names of the items to find. Must be base names, paths and
globs are not supported when {names} is a string or a table.
If {names} is a function, it is called for each traversed
@@ -2911,32 +2909,33 @@ vim.fs.find({names}, {opts}) *vim.fs.find()*
• name: base name of the current item
• path: full path of the current item The function should
return `true` if the given item is considered a match.
- • {opts} (table) Optional keyword arguments:
- • path (string): Path to begin searching from. If omitted,
- the |current-directory| is used.
- • upward (boolean, default false): If true, search upward
+ • {opts} (`table`) Optional keyword arguments:
+ • {path}? (`string`) Path to begin searching from. If
+ omitted, the |current-directory| is used.
+ • {upward}? (`boolean`, default: `false`) Search upward
through parent directories. Otherwise, search through child
directories (recursively).
- • stop (string): Stop searching when this directory is
+ • {stop}? (`string`) Stop searching when this directory is
reached. The directory itself is not searched.
- • type (string): Find only items of the given type. If
+ • {type}? (`string`) Find only items of the given type. If
omitted, all items that match {names} are included.
- • limit (number, default 1): Stop the search after finding
- this many matches. Use `math.huge` to place no limit on the
- number of matches.
+ • {limit}? (`number`, default: `1`) Stop the search after
+ finding this many matches. Use `math.huge` to place no
+ limit on the number of matches.
Return: ~
- (string[]) Normalized paths |vim.fs.normalize()| of all matching items
+ (`string[]`) Normalized paths |vim.fs.normalize()| of all matching
+ items
vim.fs.joinpath({...}) *vim.fs.joinpath()*
Concatenate directories and/or file paths into a single path with
normalization (e.g., `"foo/"` and `"bar"` get joined to `"foo/bar"`)
Parameters: ~
- • {...} (string)
+ • {...} (`string`)
Return: ~
- (string)
+ (`string`)
vim.fs.normalize({path}, {opts}) *vim.fs.normalize()*
Normalize a path to a standard format. A tilde (~) character at the
@@ -2956,13 +2955,13 @@ vim.fs.normalize({path}, {opts}) *vim.fs.normalize()*
<
Parameters: ~
- • {path} (string) Path to normalize
- • {opts} (table|nil) Options:
- • expand_env: boolean Expand environment variables (default:
- true)
+ • {path} (`string`) Path to normalize
+ • {opts} (`table?`) A table with the following fields:
+ • {expand_env} (`boolean`, default: `true`) Expand environment
+ variables.
Return: ~
- (string) Normalized path
+ (`string`) Normalized path
vim.fs.parents({start}) *vim.fs.parents()*
Iterate over all the parents of the given path.
@@ -2982,12 +2981,552 @@ vim.fs.parents({start}) *vim.fs.parents()*
<
Parameters: ~
- • {start} (string) Initial path.
+ • {start} (`string`) Initial path.
+
+ Return (multiple): ~
+ (`fun(_, dir: string): string?`) Iterator
+ (`nil`)
+ (`string?`)
+
+
+==============================================================================
+Lua module: vim.glob *vim.glob*
+
+vim.glob.to_lpeg({pattern}) *vim.glob.to_lpeg()*
+ Parses a raw glob into an |lua-lpeg| pattern.
+
+ This uses glob semantics from LSP 3.17.0:
+ https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#pattern
+
+ Glob patterns can have the following syntax:
+ • `*` to match one or more characters in a path segment
+ • `?` to match on one character in a path segment
+ • `**` to match any number of path segments, including none
+ • `{}` to group conditions (e.g. `*.{ts,js}` matches TypeScript and
+ JavaScript files)
+ • `[]` to declare a range of characters to match in a path segment (e.g.,
+ `example.[0-9]` to match on `example.0`, `example.1`, 
)
+ • `[!...]` to negate a range of characters to match in a path segment
+ (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not
+ `example.0`)
+
+ Parameters: ~
+ • {pattern} (`string`) The raw glob pattern
+
+ Return: ~
+ (`vim.lpeg.Pattern`) pattern An |lua-lpeg| representation of the
+ pattern
+
+
+==============================================================================
+VIM.LPEG *vim.lpeg*
+
+
+LPeg is a pattern-matching library for Lua, based on
+Parsing Expression Grammars (https://bford.info/packrat/) (PEGs).
+
+ *lua-lpeg*
+ *vim.lpeg.Pattern*
+The LPeg library for parsing expression grammars is included as `vim.lpeg`
+(https://www.inf.puc-rio.br/~roberto/lpeg/).
+
+In addition, its regex-like interface is available as |vim.re|
+(https://www.inf.puc-rio.br/~roberto/lpeg/re.html).
+
+
+
+Pattern:match({subject}, {init}) *Pattern:match()*
+ Matches the given `pattern` against the `subject` string. If the match
+ succeeds, returns the index in the subject of the first character after
+ the match, or the captured values (if the pattern captured any value). An
+ optional numeric argument `init` makes the match start at that position in
+ the subject string. As usual in Lua libraries, a negative value counts
+ from the end. Unlike typical pattern-matching functions, `match` works
+ only in anchored mode; that is, it tries to match the pattern with a
+ prefix of the given subject string (at position `init`), not with an
+ arbitrary substring of the subject. So, if we want to find a pattern
+ anywhere in a string, we must either write a loop in Lua or write a
+ pattern that matches anywhere.
+
+ Example: >lua
+ local pattern = lpeg.R('az') ^ 1 * -1
+ assert(pattern:match('hello') == 6)
+ assert(lpeg.match(pattern, 'hello') == 6)
+ assert(pattern:match('1 hello') == nil)
+<
+
+ Parameters: ~
+ • {subject} (`string`)
+ • {init} (`integer?`)
+
+ Return: ~
+ (`integer|vim.lpeg.Capture?`)
+
+vim.lpeg.B({pattern}) *vim.lpeg.B()*
+ Returns a pattern that matches only if the input string at the current
+ position is preceded by `patt`. Pattern `patt` must match only strings
+ with some fixed length, and it cannot contain captures. Like the `and`
+ predicate, this pattern never consumes any input, independently of success
+ or failure.
+
+ Parameters: ~
+ • {pattern} (`vim.lpeg.Pattern`)
+
+ Return: ~
+ (`vim.lpeg.Pattern`)
+
+vim.lpeg.C({patt}) *vim.lpeg.C()*
+ Creates a simple capture, which captures the substring of the subject that
+ matches `patt`. The captured value is a string. If `patt` has other
+ captures, their values are returned after this one.
+
+ Example: >lua
+ local function split (s, sep)
+ sep = lpeg.P(sep)
+ local elem = lpeg.C((1 - sep) ^ 0)
+ local p = elem * (sep * elem) ^ 0
+ return lpeg.match(p, s)
+ end
+ local a, b, c = split('a,b,c', ',')
+ assert(a == 'a')
+ assert(b == 'b')
+ assert(c == 'c')
+<
+
+ Parameters: ~
+ • {patt} (`vim.lpeg.Pattern`)
+
+ Return: ~
+ (`vim.lpeg.Capture`)
+
+vim.lpeg.Carg({n}) *vim.lpeg.Carg()*
+ Creates an argument capture. This pattern matches the empty string and
+ produces the value given as the nth extra argument given in the call to
+ `lpeg.match`.
+
+ Parameters: ~
+ • {n} (`integer`)
+
+ Return: ~
+ (`vim.lpeg.Capture`)
+
+vim.lpeg.Cb({name}) *vim.lpeg.Cb()*
+ Creates a back capture. This pattern matches the empty string and produces
+ the values produced by the most recent group capture named `name` (where
+ `name` can be any Lua value). Most recent means the last complete
+ outermost group capture with the given name. A Complete capture means that
+ the entire pattern corresponding to the capture has matched. An Outermost
+ capture means that the capture is not inside another complete capture. In
+ the same way that LPeg does not specify when it evaluates captures, it
+ does not specify whether it reuses values previously produced by the group
+ or re-evaluates them.
+
+ Parameters: ~
+ • {name} (`any`)
+
+ Return: ~
+ (`vim.lpeg.Capture`)
+
+vim.lpeg.Cc({...}) *vim.lpeg.Cc()*
+ Creates a constant capture. This pattern matches the empty string and
+ produces all given values as its captured values.
+
+ Parameters: ~
+ • {...} (`any`)
+
+ Return: ~
+ (`vim.lpeg.Capture`)
+
+vim.lpeg.Cf({patt}, {func}) *vim.lpeg.Cf()*
+ Creates a fold capture. If `patt` produces a list of captures C1 C2 ...
+ Cn, this capture will produce the value
+ `func(...func(func(C1, C2), C3)...,Cn)`, that is, it will fold (or
+ accumulate, or reduce) the captures from `patt` using function `func`.
+ This capture assumes that `patt` should produce at least one capture with
+ at least one value (of any type), which becomes the initial value of an
+ accumulator. (If you need a specific initial value, you may prefix a
+ constant captureto `patt`.) For each subsequent capture, LPeg calls `func`
+ with this accumulator as the first argument and all values produced by the
+ capture as extra arguments; the first result from this call becomes the
+ new value for the accumulator. The final value of the accumulator becomes
+ the captured value.
+
+ Example: >lua
+ local number = lpeg.R('09') ^ 1 / tonumber
+ local list = number * (',' * number) ^ 0
+ local function add(acc, newvalue) return acc + newvalue end
+ local sum = lpeg.Cf(list, add)
+ assert(sum:match('10,30,43') == 83)
+<
+
+ Parameters: ~
+ • {patt} (`vim.lpeg.Pattern`)
+ • {func} (`fun(acc, newvalue)`)
+
+ Return: ~
+ (`vim.lpeg.Capture`)
+
+vim.lpeg.Cg({patt}, {name}) *vim.lpeg.Cg()*
+ Creates a group capture. It groups all values returned by `patt` into a
+ single capture. The group may be anonymous (if no name is given) or named
+ with the given name (which can be any non-nil Lua value).
+
+ Parameters: ~
+ • {patt} (`vim.lpeg.Pattern`)
+ • {name} (`string?`)
+
+ Return: ~
+ (`vim.lpeg.Capture`)
+
+vim.lpeg.Cmt({patt}, {fn}) *vim.lpeg.Cmt()*
+ Creates a match-time capture. Unlike all other captures, this one is
+ evaluated immediately when a match occurs (even if it is part of a larger
+ pattern that fails later). It forces the immediate evaluation of all its
+ nested captures and then calls `function`. The given function gets as
+ arguments the entire subject, the current position (after the match of
+ `patt`), plus any capture values produced by `patt`. The first value
+ returned by `function` defines how the match happens. If the call returns
+ a number, the match succeeds and the returned number becomes the new
+ current position. (Assuming a subject sand current position `i`, the
+ returned number must be in the range `[i, len(s) + 1]`.) If the call
+ returns `true`, the match succeeds without consuming any input (so, to
+ return true is equivalent to return `i`). If the call returns `false`,
+ `nil`, or no value, the match fails. Any extra values returned by the
+ function become the values produced by the capture.
+
+ Parameters: ~
+ • {patt} (`vim.lpeg.Pattern`)
+ • {fn} (`function`)
+
+ Return: ~
+ (`vim.lpeg.Capture`)
+
+vim.lpeg.Cp() *vim.lpeg.Cp()*
+ Creates a position capture. It matches the empty string and captures the
+ position in the subject where the match occurs. The captured value is a
+ number.
+
+ Example: >lua
+ local I = lpeg.Cp()
+ local function anywhere(p) return lpeg.P({I * p * I + 1 * lpeg.V(1)}) end
+ local match_start, match_end = anywhere('world'):match('hello world!')
+ assert(match_start == 7)
+ assert(match_end == 12)
+<
+
+ Return: ~
+ (`vim.lpeg.Capture`)
+
+vim.lpeg.Cs({patt}) *vim.lpeg.Cs()*
+ Creates a substitution capture. This function creates a substitution
+ capture, which captures the substring of the subject that matches `patt`,
+ with substitutions. For any capture inside `patt` with a value, the
+ substring that matched the capture is replaced by the capture value (which
+ should be a string). The final captured value is the string resulting from
+ all replacements.
+
+ Example: >lua
+ local function gsub (s, patt, repl)
+ patt = lpeg.P(patt)
+ patt = lpeg.Cs((patt / repl + 1) ^ 0)
+ return lpeg.match(patt, s)
+ end
+ assert(gsub('Hello, xxx!', 'xxx', 'World') == 'Hello, World!')
+<
+
+ Parameters: ~
+ • {patt} (`vim.lpeg.Pattern`)
+
+ Return: ~
+ (`vim.lpeg.Capture`)
+
+vim.lpeg.Ct({patt}) *vim.lpeg.Ct()*
+ Creates a table capture. This capture returns a table with all values from
+ all anonymous captures made by `patt` inside this table in successive
+ integer keys, starting at 1. Moreover, for each named capture group
+ created by `patt`, the first value of the group is put into the table with
+ the group name as its key. The captured value is only the table.
+
+ Parameters: ~
+ • {patt} (`vim.lpeg.Pattern|''`)
+
+ Return: ~
+ (`vim.lpeg.Capture`)
+
+vim.lpeg.locale({tab}) *vim.lpeg.locale()*
+ Returns a table with patterns for matching some character classes
+ according to the current locale. The table has fields named `alnum`,
+ `alpha`, `cntrl`, `digit`, `graph`, `lower`, `print`, `punct`, `space`,
+ `upper`, and `xdigit`, each one containing a correspondent pattern. Each
+ pattern matches any single character that belongs to its class. If called
+ with an argument `table`, then it creates those fields inside the given
+ table and returns that table.
+
+ Example: >lua
+ lpeg.locale(lpeg)
+ local space = lpeg.space ^ 0
+ local name = lpeg.C(lpeg.alpha ^ 1) * space
+ local sep = lpeg.S(',;') * space
+ local pair = lpeg.Cg(name * '=' * space * name) * sep ^ -1
+ local list = lpeg.Cf(lpeg.Ct('') * pair ^ 0, rawset)
+ local t = list:match('a=b, c = hi; next = pi')
+ assert(t.a == 'b')
+ assert(t.c == 'hi')
+ assert(t.next == 'pi')
+ local locale = lpeg.locale()
+ assert(type(locale.digit) == 'userdata')
+<
+
+ Parameters: ~
+ • {tab} (`table?`)
+
+ Return: ~
+ (`vim.lpeg.Locale`)
+
+vim.lpeg.match({pattern}, {subject}, {init}) *vim.lpeg.match()*
+ Matches the given `pattern` against the `subject` string. If the match
+ succeeds, returns the index in the subject of the first character after
+ the match, or the captured values (if the pattern captured any value). An
+ optional numeric argument `init` makes the match start at that position in
+ the subject string. As usual in Lua libraries, a negative value counts
+ from the end. Unlike typical pattern-matching functions, `match` works
+ only in anchored mode; that is, it tries to match the pattern with a
+ prefix of the given subject string (at position `init`), not with an
+ arbitrary substring of the subject. So, if we want to find a pattern
+ anywhere in a string, we must either write a loop in Lua or write a
+ pattern that matches anywhere.
+
+ Example: >lua
+ local pattern = lpeg.R('az') ^ 1 * -1
+ assert(pattern:match('hello') == 6)
+ assert(lpeg.match(pattern, 'hello') == 6)
+ assert(pattern:match('1 hello') == nil)
+<
+
+ Parameters: ~
+ • {pattern} (`vim.lpeg.Pattern`)
+ • {subject} (`string`)
+ • {init} (`integer?`)
+
+ Return: ~
+ (`integer|vim.lpeg.Capture?`)
+
+vim.lpeg.P({value}) *vim.lpeg.P()*
+ Converts the given value into a proper pattern. The following rules are
+ applied:
+ • If the argument is a pattern, it is returned unmodified.
+ • If the argument is a string, it is translated to a pattern that matches
+ the string literally.
+ • If the argument is a non-negative number `n`, the result is a pattern
+ that matches exactly `n` characters.
+ • If the argument is a negative number `-n`, the result is a pattern that
+ succeeds only if the input string has less than `n` characters left:
+ `lpeg.P(-n)` is equivalent to `-lpeg.P(n)` (see the unary minus
+ operation).
+ • If the argument is a boolean, the result is a pattern that always
+ succeeds or always fails (according to the boolean value), without
+ consuming any input.
+ • If the argument is a table, it is interpreted as a grammar (see
+ Grammars).
+ • If the argument is a function, returns a pattern equivalent to a
+ match-time capture over the empty string.
+
+ Parameters: ~
+ • {value} (`vim.lpeg.Pattern|string|integer|boolean|table|function`)
+
+ Return: ~
+ (`vim.lpeg.Pattern`)
+
+vim.lpeg.R({...}) *vim.lpeg.R()*
+ Returns a pattern that matches any single character belonging to one of
+ the given ranges. Each `range` is a string `xy` of length 2, representing
+ all characters with code between the codes of `x` and `y` (both
+ inclusive). As an example, the pattern `lpeg.R('09')` matches any digit,
+ and `lpeg.R('az', 'AZ')` matches any ASCII letter.
+
+ Example: >lua
+ local pattern = lpeg.R('az') ^ 1 * -1
+ assert(pattern:match('hello') == 6)
+<
+
+ Parameters: ~
+ • {...} (`string`)
+
+ Return: ~
+ (`vim.lpeg.Pattern`)
+
+vim.lpeg.S({string}) *vim.lpeg.S()*
+ Returns a pattern that matches any single character that appears in the
+ given string (the `S` stands for Set). As an example, the pattern
+ `lpeg.S('+-*/')` matches any arithmetic operator. Note that, if `s` is a
+ character (that is, a string of length 1), then `lpeg.P(s)` is equivalent
+ to `lpeg.S(s)` which is equivalent to `lpeg.R(s..s)`. Note also that both
+ `lpeg.S('')` and `lpeg.R()` are patterns that always fail.
+
+ Parameters: ~
+ • {string} (`string`)
+
+ Return: ~
+ (`vim.lpeg.Pattern`)
+
+vim.lpeg.setmaxstack({max}) *vim.lpeg.setmaxstack()*
+ Sets a limit for the size of the backtrack stack used by LPeg to track
+ calls and choices. The default limit is `400`. Most well-written patterns
+ need little backtrack levels and therefore you seldom need to change this
+ limit; before changing it you should try to rewrite your pattern to avoid
+ the need for extra space. Nevertheless, a few useful patterns may
+ overflow. Also, with recursive grammars, subjects with deep recursion may
+ also need larger limits.
+
+ Parameters: ~
+ • {max} (`integer`)
+
+vim.lpeg.type({value}) *vim.lpeg.type()*
+ Returns the string `"pattern"` if the given value is a pattern, otherwise
+ `nil`.
+
+ Parameters: ~
+ • {value} (`vim.lpeg.Pattern|string|integer|boolean|table|function`)
+
+ Return: ~
+ (`"pattern"?`)
+
+vim.lpeg.V({v}) *vim.lpeg.V()*
+ Creates a non-terminal (a variable) for a grammar. This operation creates
+ a non-terminal (a variable) for a grammar. The created non-terminal refers
+ to the rule indexed by `v` in the enclosing grammar.
+
+ Example: >lua
+ local b = lpeg.P({'(' * ((1 - lpeg.S '()') + lpeg.V(1)) ^ 0 * ')'})
+ assert(b:match('((string))') == 11)
+ assert(b:match('(') == nil)
+<
+
+ Parameters: ~
+ • {v} (`string|integer`)
+
+ Return: ~
+ (`vim.lpeg.Pattern`)
+
+vim.lpeg.version() *vim.lpeg.version()*
+ Returns a string with the running version of LPeg.
+
+ Return: ~
+ (`string`)
+
+
+==============================================================================
+VIM.RE *vim.re*
+
+The `vim.re` module provides a conventional regex-like syntax for pattern
+usage within LPeg |vim.lpeg|.
+
+See https://www.inf.puc-rio.br/~roberto/lpeg/re.html for the original
+documentation including regex syntax and more concrete examples.
+
+
+vim.re.compile({string}, {defs}) *vim.re.compile()*
+ Compiles the given {string} and returns an equivalent LPeg pattern. The
+ given string may define either an expression or a grammar. The optional
+ {defs} table provides extra Lua values to be used by the pattern.
+
+ Parameters: ~
+ • {string} (`string`)
+ • {defs} (`table?`)
+
+ Return: ~
+ (`vim.lpeg.Pattern`)
+
+vim.re.find({subject}, {pattern}, {init}) *vim.re.find()*
+ Searches the given {pattern} in the given {subject}. If it finds a match,
+ returns the index where this occurrence starts and the index where it
+ ends. Otherwise, returns nil.
+
+ An optional numeric argument {init} makes the search starts at that
+ position in the subject string. As usual in Lua libraries, a negative
+ value counts from the end.
+
+ Parameters: ~
+ • {subject} (`string`)
+ • {pattern} (`vim.lpeg.Pattern|string`)
+ • {init} (`integer?`)
Return (multiple): ~
- fun(_, dir: string): string? Iterator
- nil
- (string|nil)
+ (`integer?`) the index where the occurrence starts, nil if no match
+ (`integer?`) the index where the occurrence ends, nil if no match
+
+vim.re.gsub({subject}, {pattern}, {replacement}) *vim.re.gsub()*
+ Does a global substitution, replacing all occurrences of {pattern} in the
+ given {subject} by {replacement}.
+
+ Parameters: ~
+ • {subject} (`string`)
+ • {pattern} (`vim.lpeg.Pattern|string`)
+ • {replacement} (`string`)
+
+ Return: ~
+ (`string`)
+
+vim.re.match({subject}, {pattern}, {init}) *vim.re.match()*
+ Matches the given {pattern} against the given {subject}, returning all
+ captures.
+
+ Parameters: ~
+ • {subject} (`string`)
+ • {pattern} (`vim.lpeg.Pattern|string`)
+ • {init} (`integer?`)
+
+ Return: ~
+ (`integer|vim.lpeg.Capture?`)
+
+ See also: ~
+ • vim.lpeg.match()
+
+vim.re.updatelocale() *vim.re.updatelocale()*
+ Updates the pre-defined character classes to the current locale.
+
+
+==============================================================================
+VIM.REGEX *vim.regex*
+
+Vim regexes can be used directly from Lua. Currently they only allow matching
+within a single line.
+
+
+ *regex:match_line()*
+regex:match_line({bufnr}, {line_idx}, {start}, {end_})
+ Match line {line_idx} (zero-based) in buffer {bufnr}. If {start} and {end}
+ are supplied, match only this byte index range. Otherwise see
+ |regex:match_str()|. If {start} is used, then the returned byte indices
+ will be relative {start}.
+
+ Parameters: ~
+ • {bufnr} (`integer`)
+ • {line_idx} (`integer`)
+ • {start} (`integer?`)
+ • {end_} (`integer?`)
+
+regex:match_str({str}) *regex:match_str()*
+ Match the string against the regex. If the string should match the regex
+ precisely, surround the regex with `^` and `$`. If there was a match, the
+ byte indices for the beginning and end of the match are returned. When
+ there is no match, `nil` is returned. Because any integer is "truthy",
+ `regex:match_str()` can be directly used as a condition in an
+ if-statement.
+
+ Parameters: ~
+ • {str} (`string`)
+
+vim.regex({re}) *vim.regex()*
+ Parse the Vim regex {re} and return a regex object. Regexes are "magic"
+ and case-sensitive by default, regardless of 'magic' and 'ignorecase'.
+ They can be controlled with flags, see |/magic| and |/ignorecase|.
+
+ Parameters: ~
+ • {re} (`string`)
+
+ Return: ~
+ (`vim.regex`)
==============================================================================
@@ -2999,10 +3538,10 @@ vim.secure.read({path}) *vim.secure.read()*
$XDG_STATE_HOME/nvim/trust.
Parameters: ~
- • {path} (string) Path to a file to read.
+ • {path} (`string`) Path to a file to read.
Return: ~
- (string|nil) The contents of the given file if it exists and is
+ (`string?`) The contents of the given file if it exists and is
trusted, or nil otherwise.
See also: ~
@@ -3014,47 +3553,43 @@ vim.secure.trust({opts}) *vim.secure.trust()*
The trust database is located at |$XDG_STATE_HOME|/nvim/trust.
Parameters: ~
- • {opts} (table)
- • action (string): "allow" to add a file to the trust database
- and trust it, "deny" to add a file to the trust database and
- deny it, "remove" to remove file from the trust database
- • path (string|nil): Path to a file to update. Mutually
+ • {opts} (`table?`) A table with the following fields:
+ • {action} (`'allow'|'deny'|'remove'`) - `'allow'` to add a
+ file to the trust database and trust it,
+ • `'deny'` to add a file to the trust database and deny it,
+ • `'remove'` to remove file from the trust database
+ • {path}? (`string`) Path to a file to update. Mutually
exclusive with {bufnr}. Cannot be used when {action} is
"allow".
- • bufnr (number|nil): Buffer number to update. Mutually
+ • {bufnr}? (`integer`) Buffer number to update. Mutually
exclusive with {path}.
Return (multiple): ~
- (boolean) success true if operation was successful
- (string) msg full path if operation was successful, else error message
+ (`boolean`) success true if operation was successful
+ (`string`) msg full path if operation was successful, else error
+ message
==============================================================================
Lua module: vim.version *vim.version*
-
-The `vim.version` module provides functions for comparing versions and
-ranges conforming to the
-
-https://semver.org
-
-spec. Plugins, and plugin managers, can use this to check available tools
-and dependencies on the current system.
+The `vim.version` module provides functions for comparing versions and ranges
+conforming to the https://semver.org spec. Plugins, and plugin managers, can
+use this to check available tools and dependencies on the current system.
Example: >lua
local v = vim.version.parse(vim.fn.system({'tmux', '-V'}), {strict=false})
if vim.version.gt(v, {3, 2, 0}) then
-- ...
end
-
<
*vim.version()* returns the version of the current Nvim process.
-VERSION RANGE SPEC *version-range*
+VERSION RANGE SPEC *version-range*
-A version "range spec" defines a semantic version range which can be
-tested against a version, using |vim.version.range()|.
+A version "range spec" defines a semantic version range which can be tested
+against a version, using |vim.version.range()|.
Supported range specs are shown in the following table. Note: suffixed
versions (1.2.3-rc1) are not matched. >
@@ -3085,9 +3620,9 @@ versions (1.2.3-rc1) are not matched. >
Partial left: missing pieces treated as 0 (1.2 => 1.2.0).
1.2 - 2.3.0 is 1.2.0 - 2.3.0
-
<
+
vim.version.cmp({v1}, {v2}) *vim.version.cmp()*
Parses and compares two version objects (the result of
|vim.version.parse()|, or specified literally as a `{major, minor, patch}`
@@ -3109,50 +3644,71 @@ vim.version.cmp({v1}, {v2}) *vim.version.cmp()*
otherwise-equivalent versions.
Parameters: ~
- • {v1} Version|number[] Version object.
- • {v2} Version|number[] Version to compare with `v1` .
+ • {v1} (`vim.Version|number[]|string`) Version object.
+ • {v2} (`vim.Version|number[]|string`) Version to compare with `v1`.
Return: ~
- (integer) -1 if `v1 < v2`, 0 if `v1 == v2`, 1 if `v1 > v2`.
+ (`integer`) -1 if `v1 < v2`, 0 if `v1 == v2`, 1 if `v1 > v2`.
vim.version.eq({v1}, {v2}) *vim.version.eq()*
- Returns `true` if the given versions are equal. See |vim.version.cmp()| for usage.
+ Returns `true` if the given versions are equal. See |vim.version.cmp()|
+ for usage.
Parameters: ~
- • {v1} Version|number[]
- • {v2} Version|number[]
+ • {v1} (`vim.Version|number[]|string`)
+ • {v2} (`vim.Version|number[]|string`)
Return: ~
- (boolean)
+ (`boolean`)
+
+vim.version.ge({v1}, {v2}) *vim.version.ge()*
+ Returns `true` if `v1 >= v2`. See |vim.version.cmp()| for usage.
+
+ Parameters: ~
+ • {v1} (`vim.Version|number[]|string`)
+ • {v2} (`vim.Version|number[]|string`)
+
+ Return: ~
+ (`boolean`)
vim.version.gt({v1}, {v2}) *vim.version.gt()*
- Returns `true` if `v1 > v2` . See |vim.version.cmp()| for usage.
+ Returns `true` if `v1 > v2`. See |vim.version.cmp()| for usage.
Parameters: ~
- • {v1} Version|number[]
- • {v2} Version|number[]
+ • {v1} (`vim.Version|number[]|string`)
+ • {v2} (`vim.Version|number[]|string`)
Return: ~
- (boolean)
+ (`boolean`)
vim.version.last({versions}) *vim.version.last()*
TODO: generalize this, move to func.lua
Parameters: ~
- • {versions} Version []
+ • {versions} (`vim.Version[]`)
+
+ Return: ~
+ (`vim.Version?`)
+
+vim.version.le({v1}, {v2}) *vim.version.le()*
+ Returns `true` if `v1 <= v2`. See |vim.version.cmp()| for usage.
+
+ Parameters: ~
+ • {v1} (`vim.Version|number[]|string`)
+ • {v2} (`vim.Version|number[]|string`)
Return: ~
- Version ?|nil
+ (`boolean`)
vim.version.lt({v1}, {v2}) *vim.version.lt()*
- Returns `true` if `v1 < v2` . See |vim.version.cmp()| for usage.
+ Returns `true` if `v1 < v2`. See |vim.version.cmp()| for usage.
Parameters: ~
- • {v1} Version|number[]
- • {v2} Version|number[]
+ • {v1} (`vim.Version|number[]|string`)
+ • {v2} (`vim.Version|number[]|string`)
Return: ~
- (boolean)
+ (`boolean`)
vim.version.parse({version}, {opts}) *vim.version.parse()*
Parses a semantic version string and returns a version object which can be
@@ -3162,18 +3718,19 @@ vim.version.parse({version}, {opts}) *vim.version.parse()*
<
Parameters: ~
- • {version} (string) Version string to parse.
- • {opts} (table|nil) Optional keyword arguments:
+ • {version} (`string`) Version string to parse.
+ • {opts} (`table?`) Optional keyword arguments:
• strict (boolean): Default false. If `true`, no coercion
is attempted on input not conforming to semver v2.0.0. If
`false`, `parse()` attempts to coerce input such as
"1.0", "0-x", "tmux 3.2a" into valid versions.
Return: ~
- (table|nil) parsed_version Version object or `nil` if input is invalid.
+ (`vim.Version?`) parsed_version Version object or `nil` if input is
+ invalid.
See also: ~
- • # https://semver.org/spec/v2.0.0.html
+ • https://semver.org/spec/v2.0.0.html
vim.version.range({spec}) *vim.version.range()*
Parses a semver |version-range| "spec" and returns a range object: >
@@ -3194,44 +3751,46 @@ vim.version.range({spec}) *vim.version.range()*
print(r:has(vim.version())) -- check against current Nvim version
<
- Or use cmp(), eq(), lt(), and gt() to compare `.to` and `.from` directly: >lua
- local r = vim.version.range('1.0.0 - 2.0.0')
- print(vim.version.gt({1,0,3}, r.from) and vim.version.lt({1,0,3}, r.to))
+ Or use cmp(), le(), lt(), ge(), gt(), and/or eq() to compare a version
+ against `.to` and `.from` directly: >lua
+ local r = vim.version.range('1.0.0 - 2.0.0') -- >=1.0, <2.0
+ print(vim.version.ge({1,0,3}, r.from) and vim.version.lt({1,0,3}, r.to))
<
Parameters: ~
- • {spec} (string) Version range "spec"
+ • {spec} (`string`) Version range "spec"
+
+ Return: ~
+ (`table?`) A table with the following fields:
+ • {from} (`vim.Version`)
+ • {to}? (`vim.Version`)
+ • {has} (`fun(self: vim.VersionRangeversion: string|vim.Version)`)
See also: ~
- • # https://github.com/npm/node-semver#ranges
+ • https://github.com/npm/node-semver#ranges
==============================================================================
Lua module: vim.iter *vim.iter*
-
*vim.iter()* is an interface for |iterable|s: it wraps a table or function
argument into an *Iter* object with methods (such as |Iter:filter()| and
-|Iter:map()|) that transform the underlying source data. These methods can
-be 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()`:
-
+|Iter:map()|) that transform the underlying source data. These methods can be
+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.
• Use |Iter:enumerate()| to also pass the index to the next stage.
• 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.
+• 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.
-The iterator pipeline terminates when the underlying |iterable| is
-exhausted (for function iterators this means it returned nil).
+The iterator pipeline terminates when the underlying |iterable| is exhausted
+(for function iterators this means it returned nil).
-Note: `vim.iter()` scans table input to decide if it is a list or a dict;
-to avoid this cost you can wrap the table with an iterator e.g.
+Note: `vim.iter()` scans table input to decide if it is a list or a dict; to
+avoid this cost you can wrap the table with an iterator e.g.
`vim.iter(ipairs({
}))`, but that precludes the use of |list-iterator|
operations such as |Iter:rev()|).
@@ -3272,26 +3831,26 @@ Examples: >lua
rb:push("b")
vim.iter(rb):totable()
-- { "a", "b" }
-
<
In addition to the |vim.iter()| function, the |vim.iter| module provides
convenience functions like |vim.iter.filter()| and |vim.iter.totable()|.
-filter({f}, {src}, {...}) *vim.iter.filter()*
+
+filter({f}, {src}) *vim.iter.filter()*
Filters a table or other |iterable|. >lua
-- Equivalent to:
vim.iter(src):filter(f):totable()
<
Parameters: ~
- • {f} function(...):bool Filter function. Accepts the current
+ • {f} (`fun(...):boolean`) Filter function. Accepts the current
iterator or table values as arguments and returns true if those
values should be kept in the final table
- • {src} table|function Table or iterator function to filter
+ • {src} (`table|function`) Table or iterator function to filter
Return: ~
- (table)
+ (`table`)
See also: ~
• |Iter:filter()|
@@ -3300,7 +3859,7 @@ Iter:all({pred}) *Iter:all()*
Returns true if all items in the iterator match the given predicate.
Parameters: ~
- • {pred} function(...):bool Predicate function. Takes all values
+ • {pred} (`fun(...):boolean`) Predicate function. Takes all values
returned from the previous stage in the pipeline as arguments
and returns true if the predicate matches.
@@ -3309,7 +3868,7 @@ Iter:any({pred}) *Iter:any()*
predicate.
Parameters: ~
- • {pred} function(...):bool Predicate function. Takes all values
+ • {pred} (`fun(...):boolean`) Predicate function. Takes all values
returned from the previous stage in the pipeline as arguments
and returns true if the predicate matches.
@@ -3321,7 +3880,7 @@ Iter:each({f}) *Iter:each()*
|Iter:map()|.
Parameters: ~
- • {f} function(...) Function to execute for each item in the pipeline.
+ • {f} (`fun(...)`) Function to execute for each item in the pipeline.
Takes all of the values returned by the previous stage in the
pipeline as arguments.
@@ -3340,15 +3899,15 @@ Iter:enumerate() *Iter:enumerate()*
Example: >lua
local it = vim.iter(vim.gsplit('abc', '')):enumerate()
it:next()
- -- 1 'a'
+ -- 1 'a'
it:next()
- -- 2 'b'
+ -- 2 'b'
it:next()
- -- 3 'c'
+ -- 3 'c'
<
Return: ~
- Iter
+ (`Iter`)
Iter:filter({f}) *Iter:filter()*
Filters an iterator pipeline.
@@ -3358,12 +3917,12 @@ Iter:filter({f}) *Iter:filter()*
<
Parameters: ~
- • {f} function(...):bool Takes all values returned from the previous
+ • {f} (`fun(...):boolean`) Takes all values returned from the previous
stage in the pipeline and returns false or nil if the current
iterator element should be removed.
Return: ~
- Iter
+ (`Iter`)
Iter:find({f}) *Iter:find()*
Find the first value in the iterator that satisfies the given predicate.
@@ -3385,8 +3944,33 @@ Iter:find({f}) *Iter:find()*
-- 12
<
+ Parameters: ~
+ • {f} (`any`)
+
+ Return: ~
+ (`any`)
+
+Iter:flatten({depth}) *Iter:flatten()*
+ Flattens a |list-iterator|, un-nesting nested values up to the given
+ {depth}. Errors if it attempts to flatten a dict-like value.
+
+ Examples: >lua
+ vim.iter({ 1, { 2 }, { { 3 } } }):flatten():totable()
+ -- { 1, 2, { 3 } }
+
+ vim.iter({1, { { a = 2 } }, { 3 } }):flatten():totable()
+ -- { 1, { a = 2 }, 3 }
+
+ vim.iter({ 1, { { a = 2 } }, { 3 } }):flatten(math.huge):totable()
+ -- error: attempt to flatten a dict-like table
+<
+
+ Parameters: ~
+ • {depth} (`number?`) Depth to which |list-iterator| should be
+ flattened (defaults to 1)
+
Return: ~
- any
+ (`Iter`)
Iter:fold({init}, {f}) *Iter:fold()*
Folds ("reduces") an iterator into a single value.
@@ -3404,11 +3988,24 @@ Iter:fold({init}, {f}) *Iter:fold()*
<
Parameters: ~
- • {init} any Initial value of the accumulator.
- • {f} function(acc:any, ...):A Accumulation function.
+ • {init} (`any`) Initial value of the accumulator.
+ • {f} (`fun(acc:A, ...):A`) Accumulation function.
Return: ~
- any
+ (`any`)
+
+Iter:join({delim}) *Iter:join()*
+ Collect the iterator into a delimited string.
+
+ Each element in the iterator is joined into a string separated by {delim}.
+
+ Consumes the iterator.
+
+ Parameters: ~
+ • {delim} (`string`) Delimiter
+
+ Return: ~
+ (`string`)
Iter:last() *Iter:last()*
Drains the iterator and returns the last item.
@@ -3424,7 +4021,7 @@ Iter:last() *Iter:last()*
<
Return: ~
- any
+ (`any`)
Iter:map({f}) *Iter:map()*
Maps the items of an iterator pipeline to the values returned by `f`.
@@ -3442,13 +4039,13 @@ Iter:map({f}) *Iter:map()*
<
Parameters: ~
- • {f} function(...):any Mapping function. Takes all values returned
- from the previous stage in the pipeline as arguments and returns
- one or more new values, which are used in the next pipeline
- stage. Nil return values are filtered from the output.
+ • {f} (`fun(...):any`) Mapping function. Takes all values returned from
+ the previous stage in the pipeline as arguments and returns one
+ or more new values, which are used in the next pipeline stage.
+ Nil return values are filtered from the output.
Return: ~
- Iter
+ (`Iter`)
Iter:next() *Iter:next()*
Gets the next value from the iterator.
@@ -3464,7 +4061,7 @@ Iter:next() *Iter:next()*
<
Return: ~
- any
+ (`any`)
Iter:nextback() *Iter:nextback()*
"Pops" a value from a |list-iterator| (gets the last value and decrements
@@ -3479,7 +4076,7 @@ Iter:nextback() *Iter:nextback()*
<
Return: ~
- any
+ (`any`)
Iter:nth({n}) *Iter:nth()*
Gets the nth value of an iterator (and advances to it).
@@ -3493,10 +4090,10 @@ Iter:nth({n}) *Iter:nth()*
<
Parameters: ~
- • {n} (number) The index of the value to return.
+ • {n} (`number`) The index of the value to return.
Return: ~
- any
+ (`any`)
Iter:nthback({n}) *Iter:nthback()*
Gets the nth value from the end of a |list-iterator| (and advances to it).
@@ -3510,10 +4107,10 @@ Iter:nthback({n}) *Iter:nthback()*
<
Parameters: ~
- • {n} (number) The index of the value to return.
+ • {n} (`number`) The index of the value to return.
Return: ~
- any
+ (`any`)
Iter:peek() *Iter:peek()*
Gets the next value in a |list-iterator| without consuming it.
@@ -3529,7 +4126,7 @@ Iter:peek() *Iter:peek()*
<
Return: ~
- any
+ (`any`)
Iter:peekback() *Iter:peekback()*
Gets the last value of a |list-iterator| without consuming it.
@@ -3547,7 +4144,7 @@ Iter:peekback() *Iter:peekback()*
<
Return: ~
- any
+ (`any`)
Iter:rev() *Iter:rev()*
Reverses a |list-iterator| pipeline.
@@ -3559,7 +4156,7 @@ Iter:rev() *Iter:rev()*
<
Return: ~
- Iter
+ (`Iter`)
Iter:rfind({f}) *Iter:rfind()*
Gets the first value in a |list-iterator| that satisfies a predicate,
@@ -3571,13 +4168,16 @@ Iter:rfind({f}) *Iter:rfind()*
Examples: >lua
local it = vim.iter({ 1, 2, 3, 2, 1 }):enumerate()
it:rfind(1)
- -- 5 1
+ -- 5 1
it:rfind(1)
- -- 1 1
+ -- 1 1
<
+ Parameters: ~
+ • {f} (`any`)
+
Return: ~
- any
+ (`any`)
See also: ~
• Iter.find
@@ -3592,10 +4192,10 @@ Iter:skip({n}) *Iter:skip()*
<
Parameters: ~
- • {n} (number) Number of values to skip.
+ • {n} (`number`) Number of values to skip.
Return: ~
- Iter
+ (`Iter`)
Iter:skipback({n}) *Iter:skipback()*
Skips `n` values backwards from the end of a |list-iterator| pipeline.
@@ -3609,10 +4209,10 @@ Iter:skipback({n}) *Iter:skipback()*
<
Parameters: ~
- • {n} (number) Number of values to skip.
+ • {n} (`number`) Number of values to skip.
Return: ~
- Iter
+ (`Iter`)
Iter:slice({first}, {last}) *Iter:slice()*
Sets the start and end of a |list-iterator| pipeline.
@@ -3620,11 +4220,30 @@ Iter:slice({first}, {last}) *Iter:slice()*
Equivalent to `:skip(first - 1):skipback(len - last + 1)`.
Parameters: ~
- • {first} (number)
- • {last} (number)
+ • {first} (`number`)
+ • {last} (`number`)
Return: ~
- Iter
+ (`Iter`)
+
+Iter:take({n}) *Iter:take()*
+ Transforms an iterator to yield only the first n values.
+
+ Example: >lua
+ local it = vim.iter({ 1, 2, 3, 4 }):take(2)
+ it:next()
+ -- 1
+ it:next()
+ -- 2
+ it:next()
+ -- nil
+<
+
+ Parameters: ~
+ • {n} (`integer`)
+
+ Return: ~
+ (`Iter`)
Iter:totable() *Iter:totable()*
Collect the iterator into a table.
@@ -3650,37 +4269,37 @@ Iter:totable() *Iter:totable()*
|Iter:fold()|.
Return: ~
- (table)
+ (`table`)
-map({f}, {src}, {...}) *vim.iter.map()*
+map({f}, {src}) *vim.iter.map()*
Maps a table or other |iterable|. >lua
-- Equivalent to:
vim.iter(src):map(f):totable()
<
Parameters: ~
- • {f} function(...):?any Map function. Accepts the current iterator
+ • {f} (`fun(...): any?`) Map function. Accepts the current iterator
or table values as arguments and returns one or more new
values. Nil values are removed from the final table.
- • {src} table|function Table or iterator function to filter
+ • {src} (`table|function`) Table or iterator function to filter
Return: ~
- (table)
+ (`table`)
See also: ~
• |Iter:map()|
-totable({f}, {...}) *vim.iter.totable()*
+totable({f}) *vim.iter.totable()*
Collects an |iterable| into a table. >lua
-- Equivalent to:
vim.iter(f):totable()
<
Parameters: ~
- • {f} (function) Iterator function
+ • {f} (`function`) Iterator function
Return: ~
- (table)
+ (`table`)
==============================================================================
@@ -3690,18 +4309,20 @@ vim.snippet.active() *vim.snippet.active()*
Returns `true` if there's an active snippet in the current buffer.
Return: ~
- (boolean)
+ (`boolean`)
vim.snippet.exit() *vim.snippet.exit()*
Exits the current snippet.
vim.snippet.expand({input}) *vim.snippet.expand()*
- Expands the given snippet text. Refer to https://microsoft.github.io/language-server-protocol/specification/#snippet_syntax for the specification of valid input.
+ Expands the given snippet text. Refer to
+ https://microsoft.github.io/language-server-protocol/specification/#snippet_syntax
+ for the specification of valid input.
Tabstops are highlighted with hl-SnippetTabstop.
Parameters: ~
- • {input} (string)
+ • {input} (`string`)
vim.snippet.jump({direction}) *vim.snippet.jump()*
Jumps within the active snippet in the given direction. If the jump isn't
@@ -3718,7 +4339,7 @@ vim.snippet.jump({direction}) *vim.snippet.jump()*
<
Parameters: ~
- • {direction} (vim.snippet.Direction) Navigation direction. -1 for
+ • {direction} (`vim.snippet.Direction`) Navigation direction. -1 for
previous, 1 for next.
vim.snippet.jumpable({direction}) *vim.snippet.jumpable()*
@@ -3735,11 +4356,11 @@ vim.snippet.jumpable({direction}) *vim.snippet.jumpable()*
<
Parameters: ~
- • {direction} (vim.snippet.Direction) Navigation direction. -1 for
+ • {direction} (`vim.snippet.Direction`) Navigation direction. -1 for
previous, 1 for next.
Return: ~
- (boolean)
+ (`boolean`)
==============================================================================
@@ -3749,18 +4370,50 @@ vim.text.hexdecode({enc}) *vim.text.hexdecode()*
Hex decode a string.
Parameters: ~
- • {enc} (string) String to decode
+ • {enc} (`string`) String to decode
Return: ~
- (string) Decoded string
+ (`string`) Decoded string
vim.text.hexencode({str}) *vim.text.hexencode()*
Hex encode a string.
Parameters: ~
- • {str} (string) String to encode
+ • {str} (`string`) String to encode
Return: ~
- (string) Hex encoded string
+ (`string`) Hex encoded string
+
+
+==============================================================================
+Lua module: tohtml *vim.tohtml*
+
+
+:TOhtml {file} *:TOhtml*
+Converts the buffer shown in the current window to HTML, opens the generated
+HTML in a new split window, and saves its contents to {file}. If {file} is not
+given, a temporary file (created by |tempname()|) is used.
+
+
+tohtml.tohtml({winid}, {opt}) *tohtml.tohtml.tohtml()*
+ Converts the buffer shown in the window {winid} to HTML and returns the
+ output as a list of string.
+
+ Parameters: ~
+ • {winid} (`integer?`) Window to convert (defaults to current window)
+ • {opt} (`table?`) Optional parameters.
+ • {title}? (`string|false`, default: buffer name) Title tag
+ to set in the generated HTML code.
+ • {number_lines}? (`boolean`, default: `false`) Show line
+ numbers.
+ • {font}? (`string[]|string`, default: `guifont`) Fonts to
+ use.
+ • {width}? (`integer`, default: 'textwidth' if non-zero or
+ window width otherwise) Width used for items which are
+ either right aligned or repeat a character infinitely.
+
+ Return: ~
+ (`string[]`)
+
vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl:
diff --git a/runtime/doc/luaref.txt b/runtime/doc/luaref.txt
index 467b5760cf..e7b62f4c6c 100644
--- a/runtime/doc/luaref.txt
+++ b/runtime/doc/luaref.txt
@@ -4150,7 +4150,7 @@ string.upper({s}) *string.upper()*
locale.
------------------------------------------------------------------------------
-5.4.1 Patterns *lua-patterns
+5.4.1 Patterns *lua-patterns*
A character class is used to represent a set of characters. The following
combinations are allowed in describing a character class:
@@ -4811,7 +4811,7 @@ debug.setupvalue({func}, {up}, {value}) *debug.setupvalue()*
upvalue with the given index. Otherwise, it returns the name of the
upvalue.
-debug.traceback([{thread},] [{message}] [,{level}]) *debug.traceback()*
+debug.traceback([{thread},] [{message} [,{level}]]) *debug.traceback()*
Returns a string with a traceback of the call stack. An optional
{message} string is appended at the beginning of the traceback. An
optional {level} number tells at which level to start the traceback
diff --git a/runtime/doc/luvref.txt b/runtime/doc/luvref.txt
index 915b69efe3..2be73f0412 100644
--- a/runtime/doc/luvref.txt
+++ b/runtime/doc/luvref.txt
@@ -837,7 +837,7 @@ uv.new_prepare() *uv.new_prepare()*
Creates and initializes a new |uv_prepare_t|. Returns the Lua
userdata wrapping it.
- Returns: `uv_prepare_t userdata` or `fail`
+ Returns: `uv_prepare_t userdata`
uv.prepare_start({prepare}, {callback}) *uv.prepare_start()*
@@ -882,7 +882,7 @@ uv.new_check() *uv.new_check()*
Creates and initializes a new |uv_check_t|. Returns the Lua
userdata wrapping it.
- Returns: `uv_check_t userdata` or `fail`
+ Returns: `uv_check_t userdata`
uv.check_start({check}, {callback}) *uv.check_start()*
@@ -934,7 +934,7 @@ uv.new_idle() *uv.new_idle()*
Creates and initializes a new |uv_idle_t|. Returns the Lua
userdata wrapping it.
- Returns: `uv_idle_t userdata` or `fail`
+ Returns: `uv_idle_t userdata`
uv.idle_start({idle}, {callback}) *uv.idle_start()*
@@ -977,15 +977,15 @@ called from another thread.
async:send()
<
-uv.new_async([{callback}]) *uv.new_async()*
+uv.new_async({callback}) *uv.new_async()*
Parameters:
- - `callback`: `callable` or `nil`
+ - `callback`: `callable`
- `...`: `threadargs` passed to/from
`uv.async_send(async, ...)`
Creates and initializes a new |uv_async_t|. Returns the Lua
- userdata wrapping it. A `nil` callback is allowed.
+ userdata wrapping it.
Returns: `uv_async_t userdata` or `fail`
@@ -2067,17 +2067,17 @@ uv.pipe({read_flags}, {write_flags}) *uv.pipe()*
uv.pipe_bind2({pipe}, {name}, {flags}) *uv.pipe_bind2()*
> method form `pipe:pipe_bind(name, flags)`
-
+
Parameters:
- `pipe`: `uv_pipe_t userdata`
- `name`: `string`
- - `flags`: `integer` or `table` or `nil`(default: 0)
+ - `flags`: `integer` or `table` or `nil` (default: 0)
Flags:
- If `type(flags)` is `number`, it must be `0` or
`uv.constants.PIPE_NO_TRUNCATE`.
- If `type(flags)` is `table`, it must be `{}` or
- `{ no_trunate = true|false }`.
+ `{ no_truncate = true|false }`.
- If `type(flags)` is `nil`, it use default value `0`.
- Returns `EINVAL` for unsupported flags without performing the
bind.
@@ -2101,7 +2101,7 @@ uv.pipe_connect2(pipe, name, [flags], [callback]) *uv.pipe_connect2()*
Parameters:
- `pipe`: `uv_pipe_t userdata`
- `name`: `string`
- - `flags`: `integer` or `table` or `nil`(default: 0)
+ - `flags`: `integer` or `table` or `nil` (default: 0)
- `callback`: `callable` or `nil`
- `err`: `nil` or `string`
@@ -2110,7 +2110,7 @@ uv.pipe_connect2(pipe, name, [flags], [callback]) *uv.pipe_connect2()*
- If `type(flags)` is `number`, it must be `0` or
`uv.constants.PIPE_NO_TRUNCATE`.
- If `type(flags)` is `table`, it must be `{}` or
- `{ no_trunate = true|false }`.
+ `{ no_truncate = true|false }`.
- If `type(flags)` is `nil`, it use default value `0`.
- Returns `EINVAL` for unsupported flags without performing the
bind operation.
@@ -3630,6 +3630,42 @@ uv.thread_getcpu() *uv.thread_getcpu()*
Returns: `integer` or `fail`
+uv.thread_setpriority({thread}, {priority}) *uv.thread.setpriority()*
+
+ > method form `thread:setpriority(priority)`
+
+ Parameters:
+ - `thread`: `luv_thread_t userdata`
+ - `priority`: `number`
+
+ Sets the specified thread's scheduling priority setting. It
+ requires elevated privilege to set specific priorities on some
+ platforms. The priority can be set to the following constants:
+ - `uv.constants.THREAD_PRIORITY_HIGHEST`
+ - `uv.constants.THREAD_PRIORITY_ABOVE_NORMAL`
+ - `uv.constants.THREAD_PRIORITY_NORMAL`
+ - `uv.constants.THREAD_PRIORITY_BELOW_NORMAL`
+ - `uv.constants.THREAD_PRIORITY_LOWEST`
+
+ Returns: `boolean` or `fail`
+
+uv.thread_getpriority({thread}) *uv.thread.getpriority()*
+
+ > method form `thread:getpriority()`
+
+ Parameters:
+ - `thread`: `luv_thread_t userdata`
+
+ Gets the thread's priority setting.
+
+ Retrieves the scheduling priority of the specified thread. The
+ returned priority value is platform dependent.
+
+ For Linux, when schedule policy is SCHED_OTHER (default),
+ priority is 0.
+
+ Returns: `number` or `fail`
+
uv.thread_self() *uv.thread_self()*
Returns the handle for the thread in which this is called.
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index 6f61259af0..68206dd494 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -849,8 +849,15 @@ For the Meta modifier the "T" character is used. For example, to map Meta-b
in Insert mode: >
:imap <T-b> terrible
+1.12 MAPPING SUPER-KEYS or COMMAND-KEYS *:map-super-keys* *:map-cmd-key*
-1.12 MAPPING AN OPERATOR *:map-operator*
+The Super / Command modifier is available if the terminal or GUI supports it.
+The character "D" is used for the Super / Command modifier.
+
+For example, to map Command-b in Insert mode: >
+ :imap <D-b> barritone
+
+1.13 MAPPING AN OPERATOR *:map-operator*
An operator is used before a {motion} command. To define your own operator
you must create a mapping that first sets the 'operatorfunc' option and then
@@ -1389,6 +1396,7 @@ completion can be enabled:
-complete=help help subjects
-complete=highlight highlight groups
-complete=history :history suboptions
+ -complete=keymap keyboard mappings
-complete=locale locale names (as output of locale -a)
-complete=lua Lua expression |:lua|
-complete=mapclear buffer argument
diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt
index 9f06e8c931..c3154fc372 100644
--- a/runtime/doc/message.txt
+++ b/runtime/doc/message.txt
@@ -127,8 +127,6 @@ This happens when an Ex command executes an Ex command that executes an Ex
command, etc. The limit is 200 or the value of 'maxfuncdepth', whatever is
larger. When it's more there probably is an endless loop. Probably a
|:execute| or |:source| command is involved.
-Can also happen with a recursive callback function (|channel-callback|).
-A limit of 20 is used here.
*E254* >
Cannot allocate color {name}
diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt
index aa18e44225..e80969c583 100644
--- a/runtime/doc/motion.txt
+++ b/runtime/doc/motion.txt
@@ -578,7 +578,8 @@ i] *v_i]* *v_i[* *i]* *i[*
i[ "inner [] block", select [count] '[' ']' blocks. This
goes backwards to the [count] unclosed '[', and finds
the matching ']'. The enclosed text is selected,
- excluding the '[' and ']'. The |cpo-M| option flag
+ excluding the '[' and ']'. It's an error to select an
+ empty inner block like "[]". The |cpo-M| option flag
is used to handle escaped brackets.
When used in Visual mode it is made charwise.
@@ -596,7 +597,8 @@ i( *vib* *v_ib* *v_i(* *ib*
ib "inner block", select [count] blocks, from "[count] [("
to the matching ')', excluding the '(' and ')' (see
|[(|). If the cursor is not inside a () block, then
- find the next "(". The |cpo-M| option flag
+ find the next "(". It's an error to select an empty
+ inner block like "()". The |cpo-M| option flag
is used to handle escaped parenthesis.
When used in Visual mode it is made charwise.
@@ -610,8 +612,9 @@ a< "a <> block", select [count] <> blocks, from the
i> *v_i>* *v_i<* *i>* *i<*
i< "inner <> block", select [count] <> blocks, from
the [count]'th unmatched '<' backwards to the matching
- '>', excluding the '<' and '>'. The |cpo-M| option flag
- is used to handle escaped '<' and '>'.
+ '>', excluding the '<' and '>'. It's an error to
+ select an empty inner block like "<>". The |cpo-M|
+ option flag is used to handle escaped '<' and '>'.
When used in Visual mode it is made charwise.
*v_at* *at*
@@ -640,7 +643,8 @@ i} *v_i}* *i}* *i{*
i{ *v_iB* *v_i{* *iB*
iB "inner Block", select [count] Blocks, from `[count] [{`
to the matching "}", excluding the "{" and "}" (see
- |[{|). The |cpo-M| option flag is used to handle
+ |[{|). It"s an error to select an empty inner block
+ like "{}". The |cpo-M| option flag is used to handle
escaped braces.
When used in Visual mode it is made charwise.
@@ -1044,7 +1048,7 @@ CTRL-I Go to [count] newer cursor position in jump list
|tui-modifyOtherKeys| or |tui-csiu|, CTRL-I can be
mapped separately from <Tab>, on the condition that
both keys are mapped, otherwise the mapping applies to
- both.
+ both. Except in tmux: https://github.com/tmux/tmux/issues/2705
*:ju* *:jumps*
:ju[mps] Print the jump list (not a motion command).
@@ -1292,14 +1296,12 @@ bring you back to the switch statement.
]m Go to [count] next start of a method (for Java or
similar structured language). When not before the
start of a method, jump to the start or end of the
- class. When no '{' is found after the cursor, this is
- an error. |exclusive| motion.
+ class. |exclusive| motion.
*]M*
]M Go to [count] next end of a method (for Java or
similar structured language). When not before the end
of a method, jump to the start or end of the class.
- When no '}' is found after the cursor, this is an
- error. |exclusive| motion.
+ |exclusive| motion.
*[m*
[m Go to [count] previous start of a method (for Java or
similar structured language). When not after the
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index 825e5ba41f..3029414500 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -15,7 +15,7 @@ BREAKING CHANGES *news-breaking*
The following changes may require adaptations in user config or plugins.
-• In some cases, the cursor in the Nvim |TUI| would blink even without
+• In some cases, the cursor in the Nvim |TUI| used to blink even without
configuring 'guicursor' as mentioned in |cursor-blinking|. This was a bug
that has now been fixed. If your cursor has stopped blinking, add the
following (or similar, adapted to user preference) to your |config| file: >vim
@@ -71,9 +71,6 @@ The following changes may require adaptations in user config or plugins.
now requires an explicit range argument to be passed. If injections are
required, provide an explicit range via `parser:parse({ start_row, end_row })`.
-• Float window support hide and show by setting `hide` on `nvim_open_win` and
- `nvim_win_set_config`.
-
• |vim.lsp.util.parse_snippet()| will now strictly follow the snippet grammar
defined by LSP, and hence previously parsed snippets might now be considered
invalid input.
@@ -95,14 +92,59 @@ The following changes may require adaptations in user config or plugins.
• Legacy and extmark signs are displayed and listed with the same priority:
line number -> priority -> sign id -> recently placed
+• Default color scheme has been updated to be "Nvim branded" and accessible.
+ Use `:colorscheme vim` to revert to the old legacy color scheme.
+
+ Here is a list of Nvim specific highlight groups which are now defined in
+ a meaningfully different way and might need an update:
+ • |hl-FloatBorder| is linked to |hl-NormalFloat| instead of |hl-WinSeparator|.
+ • |hl-NormalFloat| is not linked to |hl-Pmenu|.
+ • |hl-WinBar| has different background.
+ • |hl-WinBarNC| is similar to |hl-WinBar| but not bold.
+ • |hl-WinSeparator| is linked to |hl-Normal| instead of |hl-VertSplit|.
+
+ This also might result into some color schemes looking differently due to
+ them relying on implicit assumptions about how highlight groups are defined
+ by default. To account for this, define all attributes of highlight groups
+ explicitly. Alternatively, use `:colorscheme vim` or `:source
+ $VIMRUNTIME/colors/vim.lua` to restore previous definitions.
+
+• 'termguicolors' is enabled by default when Nvim is able to determine that
+ the host terminal emulator supports 24-bit color.
+
+• Treesitter highlight groups have been renamed to be more in line with
+ upstream tree-sitter and Helix to make it easier to share queries. The full
+ list is documented in |treesitter-highlight-groups|.
+
+• |vim.lsp.codelens.refresh()| now takes an `opts` argument. With this change,
+ the default behavior of just refreshing the current buffer has been replaced by
+ refreshing all buffers.
+
+• |shm-q| now fully hides macro recording message instead of only shortening it.
+
+• Returning any truthy value from a callback passed to |nvim_create_autocmd()|
+ (rather than just `true`) will delete the autocommand.
+
+• |vim.lsp.util.extract_completion_items()| will no longer return reliable
+ results, since it does not apply `itemDefaults` when its input is a
+ `CompletionList`.
+ Moreover, since support for LSP `completionList.itemDefaults` was added,
+ some third party plugins might be negatively impacted in case the language
+ servers support the feature but the plugin does not.
+ If necessary, the respective capability can be
+ removed when calling |vim.lsp.protocol.make_client_capabilities()|.
+
+• |:TOhtml| has been rewritten in Lua to support Neovim-specific decorations,
+ and many options have been removed.
+
==============================================================================
BREAKING CHANGES IN HEAD *news-breaking-dev*
The following breaking changes were made during the development cycle to
unreleased features on Nvim HEAD.
-• ...
-• ...
+• Removed `vim.treesitter.foldtext` as transparent foldtext is now supported
+ https://github.com/neovim/neovim/pull/20750
==============================================================================
NEW FEATURES *news-features*
@@ -115,31 +157,39 @@ The following new APIs and features were added.
• Treesitter highlighting now parses injections incrementally during
screen redraws only for the line range being rendered. This significantly
improves performance in large files with many injections.
+ • 'breakindent' performance is significantly improved for wrapped lines.
+ • Cursor movement, insertion with [count] and |screenpos()| are now faster.
• |vim.iter()| provides a generic iterator interface for tables and Lua
iterators |for-in|.
-• Added |vim.ringbuf()| to create ring buffers.
+• |vim.ringbuf()| creates ring buffers.
-• Added |vim.keycode()| for translating keycodes in a string.
+• |vim.keycode()| translates keycodes in a string.
• |'smoothscroll'| option to scroll by screen line rather than by text line
when |'wrap'| is set.
-• Added inline virtual text support to |nvim_buf_set_extmark()|.
+• |nvim_buf_set_extmark()| supports inline virtual text.
• 'foldtext' now supports virtual text format. |fold-foldtext|
+• |'foldtext'| can be set to an empty string to disable and render the line:
+ as normal with regular highlighting and no line wrapping.
+
• The terminal buffer now supports reflow (wrapped lines adapt when the buffer
is resized horizontally). Note: Lines that are not visible and kept in
|'scrollback'| are not reflown.
• |vim.system()| for running system commands.
-• Added |nvim_win_text_height()| to compute the number of screen lines occupied
+• |vim.lpeg| and |vim.re| expose the bundled Lpeg expression grammar parser
+ and its regex interface.
+
+• |nvim_win_text_height()| computes the number of screen lines occupied
by a range of text in a given window.
-• |nvim_set_keymap()| and |nvim_del_keymap()| now support abbreviations.
+• Mapping APIs now support abbreviations when mode short-name has suffix "a".
• Better cmdline completion for string option value. |complete-set-option|
@@ -158,7 +208,7 @@ The following new APIs and features were added.
https://microsoft.github.io/language-server-protocol/specification/#textDocument_inlayHint
• Implemented pull diagnostic textDocument/diagnostic: |vim.lsp.diagnostic.on_diagnostic()|
https://microsoft.github.io/language-server-protocol/specification/#textDocument_diagnostic
- • Added |vim.lsp.status()| to consume the last progress messages as a string.
+ • |vim.lsp.status()| consumes the last progress messages as a string.
• LSP client now always saves and restores named buffer marks when applying
text edits.
• LSP client now supports the `positionEncoding` server capability. If a server
@@ -169,26 +219,39 @@ The following new APIs and features were added.
indicator to see if a server supports a feature. Instead use
`client.supports_method(<method>)`. It considers both the dynamic
capabilities and static `server_capabilities`.
- • Added a new `anchor_bias` option to |lsp-handlers| to aid in positioning of
- floating windows.
+ • `anchor_bias` option to |lsp-handlers| aids in positioning of floating
+ windows.
+ • |vim.lsp.util.locations_to_items()| sets the `user_data` of each item to
+ the original LSP `Location` or `LocationLink`.
+ • Added support for connecting to servers using named pipes (Windows) or
+ unix domain sockets (Unix) via |vim.lsp.rpc.domain_socket_connect()|.
+ • Added support for `completionList.itemDefaults`, reducing overhead when
+ computing completion items where properties often share the same value
+ (e.g. `commitCharacters`). Note that this might affect plugins and
+ language servers that don't support the feature, and in such cases the
+ respective capability can be unset.
• Treesitter
• Bundled parsers and queries (highlight, folds) for Markdown, Python, and
Bash.
- • Added |vim.treesitter.query.omnifunc()| for treesitter query files (set by
+ • |vim.treesitter.query.omnifunc()| for treesitter query files (set by
default).
• |Query:iter_matches()| now has the ability to set the maximum start depth
for matches.
- • `@injection.language` now has smarter resolution and will now fallback to language aliases and/or attempt lower case variants of the text.
- language via aliases (e.g., filetype) registered via
- `vim.treesitter.language.register`.
- • The `#set!` directive now supports `injection.self` and `injection.parent` for injecting either the current node's language
- or the parent LanguageTree's language, respectively.
- • Added `vim.treesitter.query.edit()`, for live editing of treesitter
+ • `@injection.language` now has smarter resolution and will fall back to
+ language aliases (e.g., filetype or custom shorthands) registered via
+ |vim.treesitter.language.register()| and/or attempt lower case variants of
+ the text.
+ • The `#set!` directive now supports `injection.self` and `injection.parent`
+ for injecting either the current node's language or the parent
+ |LanguageTree|'s language, respectively.
+ • |vim.treesitter.query.edit()| allows live editing of treesitter
queries.
• Improved error messages for query parsing.
- • Added |vim.treesitter.foldtext()| to apply treesitter highlighting to
- foldtext.
+ • |:InspectTree| shows node ranges in 0-based indexing instead of 1-based
+ indexing.
+ • |:InspectTree| shows root nodes
+ • |:InspectTree| now supports |folding|
• |vim.ui.open()| opens URIs using the system default handler (macOS `open`,
Windows `explorer`, Linux `xdg-open`, etc.)
@@ -200,34 +263,35 @@ The following new APIs and features were added.
• `vim.*`
• `vim.fn.*`
• `vim.api.*`
+ • `vim.v.*`
• Improved messages for type errors in `vim.api.*` calls (including `opts` params)
• Functions that take a severity as an optional parameter (e.g.
|vim.diagnostic.get()|) now also accept a list of severities |vim.diagnostic.severity|
-• New RPC client type `msgpack-rpc` is added for `nvim_set_client_info` to
+• New RPC client type `msgpack-rpc` is added for |nvim_set_client_info()| to
support fully MessagePack-RPC compliant clients.
• Floating windows can now show footer with new `footer` and `footer_pos`
config fields. Uses |hl-FloatFooter| by default.
-• The |:terminal| command now accepts some |:command-modifiers| (specifically
- |:horizontal| and those that affect splitting a window).
+• Floating windows can now be hidden by setting `hide` in |nvim_open_win()| or
+ |nvim_win_set_config()|.
-• |vim.lsp.util.locations_to_items()| sets the `user_data` of each item to the
- original LSP `Location` or `LocationLink`.
+• |:terminal| command now accepts some |:command-modifiers| (specifically
+ |:horizontal| and those that affect splitting a window).
• |$NVIM_APPNAME| can be set to a relative path instead of only a name.
-• Added |:fclose| command.
+• |:fclose| command.
-• Added |vim.snippet| for snippet expansion support.
+• |vim.snippet| handles expansion of snippets in LSP format.
• 'complete' option supports "f" flag for completing buffer names.
-• Added |vim.base64.encode()| and |vim.base64.decode()| for encoding and decoding
- strings using Base64 encoding.
+• |vim.base64.encode()| and |vim.base64.decode()| encode and decode strings
+ using Base64 encoding.
• The |TermResponse| autocommand event can be used with |v:termresponse| to
read escape sequence responses from the terminal.
@@ -236,11 +300,45 @@ The following new APIs and features were added.
clipboard is now bundled by default and will be automatically enabled under
certain conditions. |clipboard-osc52|
-• The 'termsync' option asks the terminal emulator to buffer screen updates
- until the redraw cycle is complete. Requires support from the terminal.
+• 'termsync' option asks the terminal emulator to buffer screen updates until
+ the redraw cycle is complete. Requires support from the terminal.
+
+• |vim.text.hexencode()| and |vim.text.hexdecode()| convert strings to and
+ from byte representations.
+
+• 'completeopt' option supports "popup" flag to show extra information in a
+ floating window.
+
+• |nvim_input_mouse()| supports mouse buttons "x1" and "x2".
+
+• |v_Q-default| and |v_@-default| repeat a register for each line of a visual
+ selection.
+
+• |vim.diagnostic.count()| returns the number of diagnostics for a given
+ buffer and/or namespace, by severity. This is a faster alternative to
+ |vim.diagnostic.get()| when only the number of diagnostics is needed, but
+ not the diagnostics themselves.
+
+• |vim.deepcopy()| has a `noref` argument to avoid hashing table values.
+
+• Terminal buffers emit a |TermRequest| autocommand event when the child
+ process emits an OSC or DCS control sequence.
-• Added |vim.text.hexencode()| and |vim.text.hexdecode()| to convert strings
- to and from byte representations.
+• Terminal buffers respond to OSC background and foreground requests. |default-autocmds|
+
+• |vim.version.le()| and |vim.version.ge()| are added to |vim.version|.
+
+• |extmarks| can be associated with a URL and URLs are included as a new
+ highlight attribute. The TUI will display URLs using the OSC 8 control
+ sequence, enabling clickable text in supporting terminals.
+
+• Added |nvim_tabpage_set_win()| to set the current window of a tabpage.
+
+• Clicking on a tabpage in the tabline with the middle mouse button closes it.
+
+• |namespace| can now have window scopes. |nvim_win_add_ns()|
+
+• |extmarks| option `scoped`: only show the extmarks in its namespace's scope.
==============================================================================
CHANGED FEATURES *news-changed*
@@ -253,7 +351,7 @@ The following changes to existing APIs or features add new behavior.
• |vim.region()| can use a string accepted by |getpos()| as position.
-• vim.diagnostic.config() now accepts a function for the virtual_text.prefix
+• |vim.diagnostic.config()| now accepts a function for the virtual_text.prefix
option, which allows for rendering e.g., diagnostic severities differently.
• Defaults:
@@ -266,16 +364,24 @@ The following changes to existing APIs or features add new behavior.
vim.g.query_lint_on = {}
<
• Enabled treesitter highlighting for treesitter query files.
+ • Enabled treesitter highlighting for help files.
+ • Enabled treesitter highlighting for Lua files.
• The `workspace/didChangeWatchedFiles` LSP client capability is now enabled
by default.
+ • On Mac or Windows, `libuv.fs_watch` is used as the backend.
+ • On Linux, `fswatch` (recommended) is used as the backend if available,
+ otherwise `libuv.fs_event` is used on each subdirectory.
• |LspRequest| autocmd callbacks now contain additional information about the LSP
request status update that occurred.
-• `:source` without arguments treats a buffer with its 'filetype' set to "lua"
+• |:source| without arguments treats a buffer with its 'filetype' set to "lua"
as Lua code regardless of its extension.
+• |:lua| with a |[range]| executes that range in the current buffer as Lua code
+ regardless of its extension.
+
• |:checkhealth| buffer now implements |folding|. The initial folding status is
defined by the 'foldenable' option.
@@ -283,6 +389,7 @@ The following changes to existing APIs or features add new behavior.
• |gx| now uses |vim.ui.open()| and not netrw. To customize, you can redefine
`vim.ui.open` or remap `gx`. To continue using netrw (deprecated): >vim
+
:call netrw#BrowseX(expand(exists("g:netrw_gx")? g:netrw_gx : '<cfile>'), netrw#CheckIfRemote())<CR>
• |vim.lsp.start()| now maps |K| to use |vim.lsp.buf.hover()| if the server
@@ -307,11 +414,10 @@ The following changes to existing APIs or features add new behavior.
In addition, |nvim_buf_get_extmarks()| has gained an "overlap" option to
return such ranges even if they started before the specified position.
-• Extmarks can opt-out of precise undo tracking using the new "undo_restore"
- flag to |nvim_buf_set_extmark()|
-
-• Extmarks can be automatically hidden or removed using the new "invalidate"
- flag to |nvim_buf_set_extmark()|
+• The following flags were added to |nvim_buf_set_extmark()|:
+ - "undo_restore": opt-out extmarks of precise undo tracking.
+ - "invalidate": automatically hide or delete extmarks.
+ - "virt_text_repeat_linebreak": repeat virtual text on wrapped lines.
• LSP hover and signature help now use Treesitter for highlighting of Markdown
content.
@@ -327,17 +433,50 @@ The following changes to existing APIs or features add new behavior.
• |vim.wait()| is no longer allowed to be called in |api-fast|.
+• Vimscript function |exists()| supports checking |v:lua| functions.
+
+• Added "force_crlf" option field in |nvim_open_term()|.
+
+• Attempting to set an invalid keycode option (e.g. `set t_foo=123`) no longer
+ gives an error.
+
+• Passing 0 to |nvim_get_chan_info()| gets info about the current channel.
+
+• |:checkhealth| buffer can now be opened in a split window using modifiers like
+ |:vertical|, |:horizontal| and |:botright|.
+
+• |nvim_open_win()| and |nvim_win_set_config()| now support opening normal (split)
+ windows, and moving floating windows into split windows.
+
+• 'errorfile' (|-q|) accepts `-` as an alias for stdin.
+
+• |--startuptime| reports the startup times for both processes (TUI + server) as separate sections.
+
+• |nvim_buf_call()| and |nvim_win_call()| now preserves any return value (NB: not multiple return values)
+
+• Treesitter
+ • |Query:iter_matches()|, |vim.treesitter.query.add_predicate()|, and
+ |vim.treesitter.query.add_directive()| accept a new `all` option which
+ ensures that all matching nodes are returned as a table. The default option
+ `all=false` returns only a single node, breaking captures with quantifiers
+ like `(comment)+ @comment; it is only provided for backward compatibility
+ and will be removed after Nvim 0.10.
+ • |vim.treesitter.query.add_predicate()| and
+ |vim.treesitter.query.add_directive()| now accept an options table rather
+ than a boolean "force" argument. To force a predicate or directive to
+ override an existing predicate or directive, use `{ force = true }`.
+
==============================================================================
REMOVED FEATURES *news-removed*
The following deprecated functions or APIs were removed.
-• Vimball support is removed.
- - :Vimuntar command removed.
+• Vimball support
+ - :Vimuntar command
-• Support for legacy treesitter injection queries is removed.
+• Support for legacy treesitter injection queries
-• Removed 'shortmess' flags:
+• 'shortmess' flags:
- |shm-f|. Always uses "(3 of 5)", never "(file 3 of 5)"
- |shm-i|. Always use "[noeol]".
- |shm-x|. Always use "[dos]", "[unix]" and "[mac]"
@@ -349,6 +488,9 @@ DEPRECATIONS *news-deprecations*
The following functions are now deprecated and will be removed in a future
release.
+• Configuring |diagnostic-signs| using |:sign-define| or |sign_define()|. Use
+ the "signs" key of |vim.diagnostic.config()| instead.
+
• Checkhealth functions:
- |health#report_error|, |vim.health.report_error()| Use |vim.health.error()| instead.
- |health#report_info|, |vim.health.report_info()| Use |vim.health.info()| instead.
@@ -375,13 +517,16 @@ release.
- |vim.lsp.util.parse_snippet()|
- |vim.lsp.util.text_document_completion_list_to_complete_items()|
-• `vim.loop` has been renamed to `vim.uv`.
+• `vim.loop` has been renamed to |vim.uv|.
-• vim.treesitter.languagetree functions:
+• vim.treesitter functions:
- |LanguageTree:for_each_child()| Use |LanguageTree:children()| (non-recursive) instead.
• The "term_background" UI option |ui-ext-options| is deprecated and no longer
populated. Background color detection is now performed in Lua by the Nvim
core, not the TUI.
+• vim.shared functions:
+ - |vim.tbl_add_reverse_lookup()|
+
vim:tw=78:ts=8:sw=2:et:ft=help:norl:
diff --git a/runtime/doc/nvim_terminal_emulator.txt b/runtime/doc/nvim_terminal_emulator.txt
index dbc14f5a44..d4e05cee26 100644
--- a/runtime/doc/nvim_terminal_emulator.txt
+++ b/runtime/doc/nvim_terminal_emulator.txt
@@ -140,9 +140,9 @@ Example: >vim
- |'channel'| Terminal PTY |job-id|. Can be used with |chansend()| to send
input to the terminal.
- The |TermClose| event gives the terminal job exit code in the |v:event|
- "status" field. For example, this autocmd closes terminal buffers if the job
- exited without error: >vim
- autocmd TermClose * if !v:event.status | exe 'bdelete! '..expand('<abuf>') | endif
+ "status" field. For example, this autocommand outputs the terminal's exit
+ code to |:messages|: >vim
+ autocmd TermClose * echom 'Terminal exited with status '..v:event.status
Use |jobwait()| to check if the terminal job has finished: >vim
let running = jobwait([&channel], 0)[0] == -1
@@ -240,7 +240,7 @@ gdb window and use a "print" command, e.g.: >
If mouse pointer movements are working, Vim will also show a balloon when the
mouse rests on text that can be evaluated by gdb.
You can also use the "K" mapping that will either use Nvim floating windows
-if available to show the results or print below the status bar.
+to show the results.
Now go back to the source window and put the cursor on the first line after
the for loop, then type: >
@@ -283,8 +283,13 @@ gdb:
`:Run` [args] run the program with [args] or the previous arguments
`:Arguments` {args} set arguments for the next `:Run`
- *:Break* set a breakpoint at the current line; a sign will be displayed
- *:Clear* delete the breakpoint at the current line
+ *:Break* set a breakpoint at the cursor position
+ :Break {position}
+ set a breakpoint at the specified position
+ *:Tbreak* set a temporary breakpoint at the cursor position
+ :Tbreak {position}
+ set a temporary breakpoint at the specified position
+ *:Clear* delete the breakpoint at the cursor position
*:Step* execute the gdb "step" command
*:Over* execute the gdb "next" command (`:Next` is a Vim command)
@@ -315,6 +320,8 @@ Inspecting variables ~
This is similar to using "print" in the gdb window.
You can usually shorten `:Evaluate` to `:Ev`.
+The result is displayed in a floating window.
+You can move the cursor to this window by running `:Evaluate` (or `K`) again.
Navigating stack frames ~
@@ -338,8 +345,8 @@ Other commands ~
*:Asm* jump to the window with the disassembly, create it if there
isn't one
*:Var* jump to the window with the local and argument variables,
- create it if there isn't one. This window updates whenever the
- program is stopped
+ create it if there isn't one. This window updates whenever the
+ program is stopped
Events ~
*termdebug-events*
@@ -470,10 +477,6 @@ If the command needs an argument use a List: >vim
If there is no g:termdebug_config you can use: >vim
let g:termdebugger = ['rr', 'replay', '--']
-To not use Nvim floating windows for previewing variable evaluation, set the
-`g:termdebug_useFloatingHover` variable like this: >vim
- let g:termdebug_useFloatingHover = 0
-
If you are a mouse person, you can also define a mapping using your right
click to one of the terminal command like evaluate the variable under the
cursor: >vim
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index f47093782c..133b2bc33c 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -30,6 +30,7 @@ achieve special effects. These options come in three forms:
*E518* *E519*
:se[t] {option}? Show value of {option}.
+ NOTE: some legacy options were removed. |nvim-removed|
:se[t] {option} Toggle option: set, switch it on.
Number option: show value.
@@ -301,11 +302,24 @@ created, thus they behave slightly differently:
For a global option the global value is
shown (but that might change in the future).
-:setl[ocal] {option}< Set the local value of {option} to its global value by
- copying the value.
-
-:se[t] {option}< For |global-local| options: Remove the local value of
- {option}, so that the global value will be used.
+:se[t] {option}< Set the effective value of {option} to its global
+ value.
+ For string |global-local| options, the local value is
+ removed, so that the global value will be used.
+ For all other options, the global value is copied to
+ the local value.
+
+:setl[ocal] {option}< Set the effective value of {option} to its global
+ value.
+ For number and boolean |global-local| options, the
+ local value is removed, so that the global value will
+ be used.
+ For all other options, including string |global-local|
+ options, the global value is copied to the local
+ value.
+
+Note that the behaviour for |global-local| options is slightly different
+between string and number-based options.
*:setg* *:setglobal*
:setg[lobal][!] ... Like ":set" but set only the global value for a local
@@ -731,8 +745,8 @@ A jump table for the options with a short description can be found at |Q_op|.
from before it was deleted. When it appears again then it is read.
|timestamp|
If this option has a local value, use this command to switch back to
- using the global value: >
- :set autoread<
+ using the global value: >vim
+ set autoread<
<
*'autowrite'* *'aw'* *'noautowrite'* *'noaw'*
@@ -773,23 +787,19 @@ A jump table for the options with a short description can be found at |Q_op|.
See |:hi-normal| if you want to set the background color explicitly.
*g:colors_name*
When a color scheme is loaded (the "g:colors_name" variable is set)
- setting 'background' will cause the color scheme to be reloaded. If
+ changing 'background' will cause the color scheme to be reloaded. If
the color scheme adjusts to the value of 'background' this will work.
However, if the color scheme sets 'background' itself the effect may
be undone. First delete the "g:colors_name" variable when needed.
Normally this option would be set in the vimrc file. Possibly
- depending on the terminal name. Example: >
- :if $TERM ==# "xterm"
- : set background=dark
- :endif
-< When this option is set, the default settings for the highlight groups
+ depending on the terminal name. Example: >vim
+ if $TERM ==# "xterm"
+ set background=dark
+ endif
+< When this option is changed, the default settings for the highlight groups
will change. To use other settings, place ":highlight" commands AFTER
the setting of the 'background' option.
- This option is also used in the "$VIMRUNTIME/syntax/syntax.vim" file
- to select the colors for syntax highlighting. After changing this
- option, you must load syntax.vim again to see the result. This can be
- done with ":syntax on".
*'backspace'* *'bs'*
'backspace' 'bs' string (default "indent,eol,start")
@@ -917,12 +927,12 @@ A jump table for the options with a short description can be found at |Q_op|.
use '//', instead of '\\'.
- Environment variables are expanded |:set_env|.
- Careful with '\' characters, type one before a space, type two to
- get one in the option (see |option-backslash|), for example: >
- :set bdir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces
+ get one in the option (see |option-backslash|), for example: >vim
+ set bdir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces
<
See also 'backup' and 'writebackup' options.
- If you want to hide your backup files on Unix, consider this value: >
- :set backupdir=./.backup,~/.backup,.,/tmp
+ If you want to hide your backup files on Unix, consider this value: >vim
+ set backupdir=./.backup,~/.backup,.,/tmp
< You must create a ".backup" directory in each directory and in your
home directory for this to work properly.
The use of |:set+=| and |:set-=| is preferred when adding or removing
@@ -943,8 +953,8 @@ A jump table for the options with a short description can be found at |Q_op|.
If you like to keep a lot of backups, you could use a BufWritePre
autocommand to change 'backupext' just before writing the file to
- include a timestamp. >
- :au BufWritePre * let &bex = '-' .. strftime("%Y%b%d%X") .. '~'
+ include a timestamp. >vim
+ au BufWritePre * let &bex = '-' .. strftime("%Y%b%d%X") .. '~'
< Use 'backupdir' to put the backup in a different directory.
*'backupskip'* *'bsk'*
@@ -967,7 +977,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Note that environment variables are not expanded. If you want to use
$HOME you must expand it explicitly, e.g.: >vim
- :let &backupskip = escape(expand('$HOME'), '\') .. '/tmp/*'
+ let &backupskip = escape(expand('$HOME'), '\') .. '/tmp/*'
< Note that the default also makes sure that "crontab -e" works (when a
backup would be made by renaming the original file crontab won't see
@@ -1230,8 +1240,8 @@ A jump table for the options with a short description can be found at |Q_op|.
in the current directory first.
If the default value taken from $CDPATH is not what you want, include
a modified version of the following command in your vimrc file to
- override it: >
- :let &cdpath = ',' .. substitute(substitute($CDPATH, '[, ]', '\\\0', 'g'), ':', ',', 'g')
+ override it: >vim
+ let &cdpath = ',' .. substitute(substitute($CDPATH, '[, ]', '\\\0', 'g'), ':', ',', 'g')
< This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
(parts of 'cdpath' can be passed to the shell to expand file names).
@@ -1242,9 +1252,9 @@ A jump table for the options with a short description can be found at |Q_op|.
The key used in Command-line Mode to open the command-line window.
Only non-printable keys are allowed.
The key can be specified as a single character, but it is difficult to
- type. The preferred way is to use the <> notation. Examples: >
- :exe "set cedit=\<C-Y>"
- :exe "set cedit=\<Esc>"
+ type. The preferred way is to use the <> notation. Examples: >vim
+ exe "set cedit=\<C-Y>"
+ exe "set cedit=\<Esc>"
< |Nvi| also has this option, but it only uses the first character.
See |cmdwin|.
@@ -1274,7 +1284,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Conversion between "latin1", "unicode", "ucs-2", "ucs-4" and "utf-8"
is done internally by Vim, 'charconvert' is not used for this.
Also used for Unicode conversion.
- Example: >
+ Example: >vim
set charconvert=CharConvert()
fun CharConvert()
system("recode "
@@ -1326,7 +1336,7 @@ A jump table for the options with a short description can be found at |Q_op|.
local to buffer
Keywords that are interpreted as a C++ scope declaration by |cino-g|.
Useful e.g. for working with the Qt framework that defines additional
- scope declarations "signals", "public slots" and "private slots": >
+ scope declarations "signals", "public slots" and "private slots": >vim
set cinscopedecls+=signals,public\ slots,private\ slots
<
@@ -1396,11 +1406,11 @@ A jump table for the options with a short description can be found at |Q_op|.
highlighted with ColorColumn |hl-ColorColumn|. Useful to align
text. Will make screen redrawing slower.
The screen column can be an absolute number, or a number preceded with
- '+' or '-', which is added to or subtracted from 'textwidth'. >
+ '+' or '-', which is added to or subtracted from 'textwidth'. >vim
- :set cc=+1 " highlight column after 'textwidth'
- :set cc=+1,+2,+3 " highlight three columns after 'textwidth'
- :hi ColorColumn ctermbg=lightgrey guibg=lightgrey
+ set cc=+1 " highlight column after 'textwidth'
+ set cc=+1,+2,+3 " highlight three columns after 'textwidth'
+ hi ColorColumn ctermbg=lightgrey guibg=lightgrey
<
When 'textwidth' is zero then the items with '-' and '+' are not used.
A maximum of 256 columns are highlighted.
@@ -1417,8 +1427,8 @@ A jump table for the options with a short description can be found at |Q_op|.
number of columns of the display, the display may be messed up. For
the GUI it is always possible and Vim limits the number of columns to
what fits on the screen. You can use this command to get the widest
- window possible: >
- :set columns=9999
+ window possible: >vim
+ set columns=9999
< Minimum value is 12, maximum value is 10000.
*'comments'* *'com'* *E524* *E525*
@@ -1450,8 +1460,8 @@ A jump table for the options with a short description can be found at |Q_op|.
k scan the files given with the 'dictionary' option
kspell use the currently active spell checking |spell|
k{dict} scan the file {dict}. Several "k" flags can be given,
- patterns are valid too. For example: >
- :set cpt=k/usr/dict/*,k~/spanish
+ patterns are valid too. For example: >vim
+ set cpt=k/usr/dict/*,k~/spanish
< s scan the files given with the 'thesaurus' option
s{tsr} scan the file {tsr}. Several "s" flags can be given, patterns
are valid too.
@@ -1507,14 +1517,18 @@ A jump table for the options with a short description can be found at |Q_op|.
completion in the preview window. Only works in
combination with "menu" or "menuone".
- noinsert Do not insert any text for a match until the user selects
+ noinsert Do not insert any text for a match until the user selects
a match from the menu. Only works in combination with
"menu" or "menuone". No effect if "longest" is present.
- noselect Do not select a match in the menu, force the user to
+ noselect Do not select a match in the menu, force the user to
select one from the menu. Only works in combination with
"menu" or "menuone".
+ popup Show extra information about the currently selected
+ completion in a popup window. Only works in combination
+ with "menu" or "menuone". Overrides "preview".
+
*'completeslash'* *'csl'*
'completeslash' 'csl' string (default "")
local to buffer
@@ -1719,9 +1733,6 @@ A jump table for the options with a short description can be found at |Q_op|.
when it didn't exist when editing it. This is a
protection against a file unexpectedly created by
someone else. Vi didn't complain about this.
- *cpo-p*
- p Vi compatible Lisp indenting. When not present, a
- slightly better algorithm is used.
*cpo-P*
P When included, a ":write" command that appends to a
file will set the file name for the current buffer, if
@@ -1848,7 +1859,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|hl-CursorColumn|. Useful to align text. Will make screen redrawing
slower.
If you only want the highlighting in the current window you can use
- these autocommands: >
+ these autocommands: >vim
au WinLeave * set nocursorline nocursorcolumn
au WinEnter * set cursorline cursorcolumn
<
@@ -1911,7 +1922,7 @@ A jump table for the options with a short description can be found at |Q_op|.
< If the function is defined with `func_name : function() {...`: >
^\s*\ze\i\+\s*[:]\s*(*function\s*(
< When using the ":set" command, you need to double the backslashes!
- To avoid that use `:let` with a single quote string: >
+ To avoid that use `:let` with a single quote string: >vim
let &l:define = '^\s*\ze\k\+\s*=\s*function('
<
@@ -2071,11 +2082,11 @@ A jump table for the options with a short description can be found at |Q_op|.
patience patience diff algorithm
histogram histogram diff algorithm
- Examples: >
- :set diffopt=internal,filler,context:4
- :set diffopt=
- :set diffopt=internal,filler,foldcolumn:3
- :set diffopt-=internal " do NOT use the internal diff parser
+ Examples: >vim
+ set diffopt=internal,filler,context:4
+ set diffopt=
+ set diffopt=internal,filler,foldcolumn:3
+ set diffopt-=internal " do NOT use the internal diff parser
<
*'digraph'* *'dg'* *'nodigraph'* *'nodg'*
@@ -2118,8 +2129,8 @@ A jump table for the options with a short description can be found at |Q_op|.
- A directory name may end in an ':' or '/'.
- Environment variables are expanded |:set_env|.
- Careful with '\' characters, type one before a space, type two to
- get one in the option (see |option-backslash|), for example: >
- :set dir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces
+ get one in the option (see |option-backslash|), for example: >vim
+ set dir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces
<
Editing the same file twice will result in a warning. Using "/tmp" on
is discouraged: if the system crashes you lose the swap file. And
@@ -2264,8 +2275,8 @@ A jump table for the options with a short description can be found at |Q_op|.
A list of autocommand event names, which are to be ignored.
When set to "all" or when "all" is one of the items, all autocommand
events are ignored, autocommands will not be executed.
- Otherwise this is a comma-separated list of event names. Example: >
- :set ei=WinEnter,WinLeave
+ Otherwise this is a comma-separated list of event names. Example: >vim
+ set ei=WinEnter,WinLeave
<
*'expandtab'* *'et'* *'noexpandtab'* *'noet'*
@@ -2347,7 +2358,7 @@ A jump table for the options with a short description can be found at |Q_op|.
will work and the first entry of 'fileencodings' will be used (except
"ucs-bom", which requires the BOM to be present). If you prefer
another encoding use an BufReadPost autocommand event to test if your
- preferred encoding is to be used. Example: >
+ preferred encoding is to be used. Example: >vim
au BufReadPost * if search('\S', 'w') == 0 |
\ set fenc=iso-2022-jp | endif
< This sets 'fileencoding' to "iso-2022-jp" if the file does not contain
@@ -2355,8 +2366,8 @@ A jump table for the options with a short description can be found at |Q_op|.
When the |++enc| argument is used then the value of 'fileencodings' is
not used.
Note that 'fileencodings' is not used for a new file, the global value
- of 'fileencoding' is used instead. You can set it with: >
- :setglobal fenc=iso-8859-2
+ of 'fileencoding' is used instead. You can set it with: >vim
+ setglobal fenc=iso-8859-2
< This means that a non-existing file may get a different encoding than
an empty file.
The special value "ucs-bom" can be used to check for a Unicode BOM
@@ -2468,11 +2479,11 @@ A jump table for the options with a short description can be found at |Q_op|.
this use the ":filetype on" command. |:filetype|
Setting this option to a different value is most useful in a modeline,
for a file for which the file type is not automatically recognized.
- Example, for in an IDL file: >
+ Example, for in an IDL file: >c
/* vim: set filetype=idl : */
< |FileType| |filetypes|
When a dot appears in the value then this separates two filetype
- names. Example: >
+ names. Example: >c
/* vim: set filetype=c.doxygen : */
< This will use the "c" filetype first, then the "doxygen" filetype.
This works both for filetype plugins and for syntax files. More than
@@ -2487,7 +2498,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Characters to fill the statuslines, vertical separators and special
lines in the window.
It is a comma-separated list of items. Each item has a name, a colon
- and the value of that item:
+ and the value of that item: |E1511|
item default Used for ~
stl ' ' statusline of the current window
@@ -2520,12 +2531,12 @@ A jump table for the options with a short description can be found at |Q_op|.
"vert", "vertleft", "vertright", "verthoriz", "foldsep" and "fold"
default to single-byte alternatives.
- Example: >
- :set fillchars=stl:\ ,stlnc:\ ,vert:│,fold:·,diff:-
+ Example: >vim
+ set fillchars=stl:\ ,stlnc:\ ,vert:│,fold:·,diff:-
<
For the "stl", "stlnc", "foldopen", "foldclose" and "foldsep" items
single-byte and multibyte characters are supported. But double-width
- characters are not supported.
+ characters are not supported. |E1512|
The highlighting used for these items:
item highlight group ~
@@ -2716,6 +2727,9 @@ A jump table for the options with a short description can be found at |Q_op|.
It is not allowed to change text or jump to another window while
evaluating 'foldtext' |textlock|.
+ When set to an empty string, foldtext is disabled, and the line
+ is displayed normally with highlighting and no line wrapping.
+
*'formatexpr'* *'fex'*
'formatexpr' 'fex' string (default "")
local to buffer
@@ -2730,8 +2744,8 @@ A jump table for the options with a short description can be found at |Q_op|.
automatic formatting. This can be empty. Don't insert
it yet!
- Example: >
- :set formatexpr=mylang#Format()
+ Example: >vim
+ set formatexpr=mylang#Format()
< This will invoke the mylang#Format() function in the
autoload/mylang.vim file in 'runtimepath'. |autoload|
@@ -2745,7 +2759,7 @@ A jump table for the options with a short description can be found at |Q_op|.
the internal format mechanism.
If the expression starts with s: or |<SID>|, then it is replaced with
- the script ID (|local-function|). Example: >
+ the script ID (|local-function|). Example: >vim
set formatexpr=s:MyFormatExpr()
set formatexpr=<SID>SomeFormatExpr()
< Otherwise, the expression is evaluated in the context of the script
@@ -2826,9 +2840,9 @@ A jump table for the options with a short description can be found at |Q_op|.
:s///g subst. one subst. all
:s///gg subst. all subst. one
- DEPRECATED: Setting this option may break plugins that are not aware
- of this option. Also, many users get confused that adding the /g flag
- has the opposite effect of that it normally does.
+ NOTE: Setting this option may break plugins that rely on the default
+ behavior of the 'g' flag. This will also make the 'g' flag have the
+ opposite effect of that documented in |:s_g|.
*'grepformat'* *'gfm'*
'grepformat' 'gfm' string (default "%f:%l:%m,%f:%l%m,%f %l%m")
@@ -2847,8 +2861,8 @@ A jump table for the options with a short description can be found at |Q_op|.
will be included. Environment variables are expanded |:set_env|. See
|option-backslash| about including spaces and backslashes.
When your "grep" accepts the "-H" argument, use this to make ":grep"
- also work well with a single file: >
- :set grepprg=grep\ -nH
+ also work well with a single file: >vim
+ set grepprg=grep\ -nH
< Special value: When 'grepprg' is set to "internal" the |:grep| command
works like |:vimgrep|, |:lgrep| like |:lvimgrep|, |:grepadd| like
|:vimgrepadd| and |:lgrepadd| like |:lvimgrepadd|.
@@ -2863,11 +2877,11 @@ A jump table for the options with a short description can be found at |Q_op|.
Configures the cursor style for each mode. Works in the GUI and many
terminals. See |tui-cursor-shape|.
- To disable cursor-styling, reset the option: >
- :set guicursor=
+ To disable cursor-styling, reset the option: >vim
+ set guicursor=
-< To enable mode shapes, "Cursor" highlight, and blinking: >
- :set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50
+< To enable mode shapes, "Cursor" highlight, and blinking: >vim
+ set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50
\,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor
\,sm:block-blinkwait175-blinkoff150-blinkon175
@@ -2900,8 +2914,8 @@ A jump table for the options with a short description can be found at |Q_op|.
the cursor starts blinking, blinkon is the time that
the cursor is shown and blinkoff is the time that the
cursor is not shown. Times are in msec. When one of
- the numbers is zero, there is no blinking. E.g.: >
- :set guicursor=n:blinkon0
+ the numbers is zero, there is no blinking. E.g.: >vim
+ set guicursor=n:blinkon0
< - Default is "blinkon0" for each mode.
{group-name}
Highlight group that decides the color and font of the
@@ -2939,9 +2953,9 @@ A jump table for the options with a short description can be found at |Q_op|.
to do a common setting for all modes. For example, to switch off
blinking: "a:blinkon0"
- Examples of cursor highlighting: >
- :highlight Cursor gui=reverse guifg=NONE guibg=NONE
- :highlight Cursor gui=NONE guifg=bg guibg=fg
+ Examples of cursor highlighting: >vim
+ highlight Cursor gui=reverse guifg=NONE guibg=NONE
+ highlight Cursor gui=NONE guifg=bg guibg=fg
<
*'guifont'* *'gfn'* *E235* *E596*
@@ -2956,8 +2970,8 @@ A jump table for the options with a short description can be found at |Q_op|.
Spaces after a comma are ignored. To include a comma in a font name
precede it with a backslash. Setting an option requires an extra
backslash before a space and a backslash. See also
- |option-backslash|. For example: >
- :set guifont=Screen15,\ 7x13,font\\,with\\,commas
+ |option-backslash|. For example: >vim
+ set guifont=Screen15,\ 7x13,font\\,with\\,commas
< will make Vim try to use the font "Screen15" first, and if it fails it
will try to use "7x13" and then "font,with,commas" instead.
@@ -2968,14 +2982,14 @@ A jump table for the options with a short description can be found at |Q_op|.
the case of X). The font names given should be "normal" fonts. Vim
will try to find the related bold and italic fonts.
- For Win32 and Mac OS: >
- :set guifont=*
+ For Win32 and Mac OS: >vim
+ set guifont=*
< will bring up a font requester, where you can pick the font you want.
The font name depends on the GUI used.
- For Mac OSX you can use something like this: >
- :set guifont=Monaco:h10
+ For Mac OSX you can use something like this: >vim
+ set guifont=Monaco:h10
< *E236*
Note that the fonts must be mono-spaced (all characters have the same
width).
@@ -3000,9 +3014,9 @@ A jump table for the options with a short description can be found at |Q_op|.
Use a ':' to separate the options.
- A '_' can be used in the place of a space, so you don't need to use
backslashes to escape the spaces.
- - Examples: >
- :set guifont=courier_new:h12:w5:b:cRUSSIAN
- :set guifont=Andale_Mono:h7.5:w4.5
+ - Examples: >vim
+ set guifont=courier_new:h12:w5:b:cRUSSIAN
+ set guifont=Andale_Mono:h7.5:w4.5
<
*'guifontwide'* *'gfw'* *E231* *E533* *E534*
@@ -3142,8 +3156,8 @@ A jump table for the options with a short description can be found at |Q_op|.
When non-empty describes the text to use in a tooltip for the GUI tab
pages line. When empty Vim will use a default tooltip.
This option is otherwise just like 'guitablabel' above.
- You can include a line break. Simplest method is to use |:let|: >
- :let &guitabtooltip = "line one\nline two"
+ You can include a line break. Simplest method is to use |:let|: >vim
+ let &guitabtooltip = "line one\nline two"
<
*'helpfile'* *'hf'*
@@ -3177,8 +3191,8 @@ A jump table for the options with a short description can be found at |Q_op|.
be used as a last resort. You can add "en" to prefer English over
another language, but that will only find tags that exist in that
language and not in the English help.
- Example: >
- :set helplang=de,it
+ Example: >vim
+ set helplang=de,it
< This will first search German, then Italian and finally English help
files.
When using |CTRL-]| and ":help!" in a non-English help file Vim will
@@ -3289,8 +3303,8 @@ A jump table for the options with a short description can be found at |Q_op|.
1 :lmap is ON and IM is off
2 :lmap is off and IM is ON
To always reset the option to zero when leaving Insert mode with <Esc>
- this can be used: >
- :inoremap <ESC> <ESC>:set iminsert=0<CR>
+ this can be used: >vim
+ inoremap <ESC> <ESC>:set iminsert=0<CR>
< This makes :lmap and IM turn off automatically when leaving Insert
mode.
Note that this option changes when using CTRL-^ in Insert mode
@@ -3348,20 +3362,20 @@ A jump table for the options with a short description can be found at |Q_op|.
'includeexpr' 'inex' string (default "")
local to buffer
Expression to be used to transform the string found with the 'include'
- option to a file name. Mostly useful to change "." to "/" for Java: >
- :setlocal includeexpr=substitute(v:fname,'\\.','/','g')
+ option to a file name. Mostly useful to change "." to "/" for Java: >vim
+ setlocal includeexpr=substitute(v:fname,'\\.','/','g')
< The "v:fname" variable will be set to the file name that was detected.
Note the double backslash: the `:set` command first halves them, then
one remains in the value, where "\." matches a dot literally. For
- simple character replacements `tr()` avoids the need for escaping: >
- :setlocal includeexpr=tr(v:fname,'.','/')
+ simple character replacements `tr()` avoids the need for escaping: >vim
+ setlocal includeexpr=tr(v:fname,'.','/')
<
Also used for the |gf| command if an unmodified file name can't be
found. Allows doing "gf" on the name after an 'include' statement.
Also used for |<cfile>|.
If the expression starts with s: or |<SID>|, then it is replaced with
- the script ID (|local-function|). Example: >
+ the script ID (|local-function|). Example: >vim
setlocal includeexpr=s:MyIncludeExpr(v:fname)
setlocal includeexpr=<SID>SomeIncludeExpr(v:fname)
< Otherwise, the expression is evaluated in the context of the script
@@ -3395,7 +3409,7 @@ A jump table for the options with a short description can be found at |Q_op|.
typing a search command. See also: 'hlsearch'.
If you don't want to turn 'hlsearch' on, but want to highlight all
matches while searching, you can turn on and off 'hlsearch' with
- autocmd. Example: >
+ autocmd. Example: >vim
augroup vimrc-incsearch-highlight
autocmd!
autocmd CmdlineEnter /,\? :set hlsearch
@@ -3423,7 +3437,7 @@ A jump table for the options with a short description can be found at |Q_op|.
when the expression is evaluated (but it may be moved around).
If the expression starts with s: or |<SID>|, then it is replaced with
- the script ID (|local-function|). Example: >
+ the script ID (|local-function|). Example: >vim
set indentexpr=s:MyIndentExpr()
set indentexpr=<SID>SomeIndentExpr()
< Otherwise, the expression is evaluated in the context of the script
@@ -3437,8 +3451,8 @@ A jump table for the options with a short description can be found at |Q_op|.
The evaluation of the expression must not have side effects! It must
not change the text, jump to another window, etc. Afterwards the
cursor position is always restored, thus the cursor may be moved.
- Normally this option would be set to call a function: >
- :set indentexpr=GetMyIndent()
+ Normally this option would be set to call a function: >vim
+ set indentexpr=GetMyIndent()
< Error messages will be suppressed, unless the 'debug' option contains
"msg".
See |indent-expression|.
@@ -3635,9 +3649,9 @@ A jump table for the options with a short description can be found at |Q_op|.
When "man" or "man -s" is used, Vim will automatically translate
a [count] for the "K" command to a section number.
See |option-backslash| about including spaces and backslashes.
- Example: >
- :set keywordprg=man\ -s
- :set keywordprg=:Man
+ Example: >vim
+ set keywordprg=man\ -s
+ set keywordprg=:Man
< This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
@@ -3657,10 +3671,10 @@ A jump table for the options with a short description can be found at |Q_op|.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
- Example (for Greek, in UTF-8): *greek* >
- :set langmap=ΑA,ΒB,ΚC,ΔD,ΕE,ΊF,ΓG,ΗH,ΙI,ΞJ,ΚK,ΛL,ΜM,ΝN,ΟO,ΠP,QQ,ΡR,ΣS,΀T,ΘU,ΩV,WW,ΧX,Î¥Y,ΖZ,αa,βb,ψc,ÎŽd,εe,φf,γg,ηh,ιi,Οj,κk,λl,ÎŒm,Μn,οo,πp,qq,ρr,σs,τt,Ξu,ωv,ςw,χx,υy,ζz
-< Example (exchanges meaning of z and y for commands): >
- :set langmap=zy,yz,ZY,YZ
+ Example (for Greek, in UTF-8): *greek* >vim
+ set langmap=ΑA,ΒB,ΚC,ΔD,ΕE,ΊF,ΓG,ΗH,ΙI,ΞJ,ΚK,ΛL,ΜM,ΝN,ΟO,ΠP,QQ,ΡR,ΣS,΀T,ΘU,ΩV,WW,ΧX,Î¥Y,ΖZ,αa,βb,ψc,ÎŽd,εe,φf,γg,ηh,ιi,Οj,κk,λl,ÎŒm,Μn,οo,πp,qq,ρr,σs,τt,Ξu,ωv,ςw,χx,υy,ζz
+< Example (exchanges meaning of z and y for commands): >vim
+ set langmap=zy,yz,ZY,YZ
<
The 'langmap' option is a list of parts, separated with commas. Each
part can be in one of two forms:
@@ -3688,22 +3702,22 @@ A jump table for the options with a short description can be found at |Q_op|.
'langmenu' 'lm' string (default "")
global
Language to use for menu translation. Tells which file is loaded
- from the "lang" directory in 'runtimepath': >
+ from the "lang" directory in 'runtimepath': >vim
"lang/menu_" .. &langmenu .. ".vim"
< (without the spaces). For example, to always use the Dutch menus, no
- matter what $LANG is set to: >
- :set langmenu=nl_NL.ISO_8859-1
+ matter what $LANG is set to: >vim
+ set langmenu=nl_NL.ISO_8859-1
< When 'langmenu' is empty, |v:lang| is used.
Only normal file name characters can be used, `/\*?[|<>` are illegal.
If your $LANG is set to a non-English language but you do want to use
- the English menus: >
- :set langmenu=none
+ the English menus: >vim
+ set langmenu=none
< This option must be set before loading menus, switching on filetype
detection or syntax highlighting. Once the menus are defined setting
- this option has no effect. But you could do this: >
- :source $VIMRUNTIME/delmenu.vim
- :set langmenu=de_DE.ISO_8859-1
- :source $VIMRUNTIME/menu.vim
+ this option has no effect. But you could do this: >vim
+ source $VIMRUNTIME/delmenu.vim
+ set langmenu=de_DE.ISO_8859-1
+ source $VIMRUNTIME/menu.vim
< Warning: This deletes all menus that you defined yourself!
*'langremap'* *'lrm'* *'nolangremap'* *'nolrm'*
@@ -3759,8 +3773,8 @@ A jump table for the options with a short description can be found at |Q_op|.
option will cause the window size to be changed. When you only want
to use the size for the GUI, put the command in your |gvimrc| file.
Vim limits the number of lines to what fits on the screen. You can
- use this command to get the tallest window possible: >
- :set lines=999
+ use this command to get the tallest window possible: >vim
+ set lines=999
< Minimum value is 2, maximum value is 1000.
*'linespace'* *'lsp'*
@@ -3814,8 +3828,8 @@ A jump table for the options with a short description can be found at |Q_op|.
The cursor is displayed at the start of the space a Tab character
occupies, not at the end as usual in Normal mode. To get this cursor
- position while displaying Tabs with spaces, use: >
- :set list lcs=tab:\ \
+ position while displaying Tabs with spaces, use: >vim
+ set list lcs=tab:\ \
<
Note that list mode will also affect formatting (set with 'textwidth'
or 'wrapmargin') when 'cpoptions' includes 'L'. See 'listchars' for
@@ -3825,7 +3839,7 @@ A jump table for the options with a short description can be found at |Q_op|.
'listchars' 'lcs' string (default "tab:> ,trail:-,nbsp:+")
global or local to window |global-local|
Strings to use in 'list' mode and for the |:list| command. It is a
- comma-separated list of string settings.
+ comma-separated list of string settings. *E1511*
*lcs-eol*
eol:c Character to show at the end of each line. When
@@ -3869,8 +3883,8 @@ A jump table for the options with a short description can be found at |Q_op|.
lead:c Character to show for leading spaces. When omitted,
leading spaces are blank. Overrides the "space" and
"multispace" settings for leading spaces. You can
- combine it with "tab:", for example: >
- :set listchars+=tab:>-,lead:.
+ combine it with "tab:", for example: >vim
+ set listchars+=tab:>-,lead:.
<
*lcs-leadmultispace*
leadmultispace:c...
@@ -3904,19 +3918,19 @@ A jump table for the options with a short description can be found at |Q_op|.
omitted.
The characters ':' and ',' should not be used. UTF-8 characters can
- be used. All characters must be single width.
+ be used. All characters must be single width. *E1512*
- Each character can be specified as hex: >
+ Each character can be specified as hex: >vim
set listchars=eol:\\x24
set listchars=eol:\\u21b5
set listchars=eol:\\U000021b5
< Note that a double backslash is used. The number of hex characters
must be exactly 2 for \\x, 4 for \\u and 8 for \\U.
- Examples: >
- :set lcs=tab:>-,trail:-
- :set lcs=tab:>-,eol:<,nbsp:%
- :set lcs=extends:>,precedes:<
+ Examples: >vim
+ set lcs=tab:>-,trail:-
+ set lcs=tab:>-,eol:<,nbsp:%
+ set lcs=extends:>,precedes:<
< |hl-NonText| highlighting will be used for "eol", "extends" and
"precedes". |hl-Whitespace| for "nbsp", "space", "tab", "multispace",
"lead" and "trail".
@@ -3967,8 +3981,8 @@ A jump table for the options with a short description can be found at |Q_op|.
This would be mostly useful when you use MS-Windows. If iconv is
enabled, setting 'makeencoding' to "char" has the same effect as
- setting to the system locale encoding. Example: >
- :set makeencoding=char " system locale is used
+ setting to the system locale encoding. Example: >vim
+ set makeencoding=char " system locale is used
<
*'makeprg'* *'mp'*
@@ -3982,11 +3996,11 @@ A jump table for the options with a short description can be found at |Q_op|.
about including spaces and backslashes.
Note that a '|' must be escaped twice: once for ":set" and once for
the interpretation of a command. When you use a filter called
- "myfilter" do it like this: >
- :set makeprg=gmake\ \\\|\ myfilter
+ "myfilter" do it like this: >vim
+ set makeprg=gmake\ \\\|\ myfilter
< The placeholder "$*" can be given (even multiple times) to specify
- where the arguments will be included, for example: >
- :set makeprg=latex\ \\\\nonstopmode\ \\\\input\\{$*}
+ where the arguments will be included, for example: >vim
+ set makeprg=latex\ \\\\nonstopmode\ \\\\input\\{$*}
< This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
@@ -3999,12 +4013,12 @@ A jump table for the options with a short description can be found at |Q_op|.
jump between two double quotes.
The characters must be separated by a colon.
The pairs must be separated by a comma. Example for including '<' and
- '>' (for HTML): >
- :set mps+=<:>
+ '>' (for HTML): >vim
+ set mps+=<:>
< A more exotic example, to jump between the '=' and ';' in an
- assignment, useful for languages like C and Java: >
- :au FileType c,cpp,java set mps+==:;
+ assignment, useful for languages like C and Java: >vim
+ au FileType c,cpp,java set mps+==:;
< For a more advanced way of using "%", see the matchit.vim plugin in
the $VIMRUNTIME/plugin directory. |add-local-help|
@@ -4026,6 +4040,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Increasing this limit above 200 also changes the maximum for Ex
command recursion, see |E169|.
See also |:function|.
+ Also used for maximum depth of callback functions.
*'maxmapdepth'* *'mmd'* *E223*
'maxmapdepth' 'mmd' number (default 1000)
@@ -4090,8 +4105,8 @@ A jump table for the options with a short description can be found at |Q_op|.
The languages for which these numbers are important are Italian and
Hungarian. The default works for when you have about 512 Mbyte. If
- you have 1 Gbyte you could use: >
- :set mkspellmem=900000,3000,800
+ you have 1 Gbyte you could use: >vim
+ set mkspellmem=900000,3000,800
< If you have less than 512 Mbyte |:mkspell| may fail for some
languages, no matter what you set 'mkspellmem' to.
@@ -4165,8 +4180,8 @@ A jump table for the options with a short description can be found at |Q_op|.
'mouse' string (default "nvi")
global
Enables mouse support. For example, to enable the mouse in Normal mode
- and Visual mode: >
- :set mouse=nv
+ and Visual mode: >vim
+ set mouse=nv
<
To temporarily disable mouse support, hold the shift key while using
the mouse.
@@ -4249,19 +4264,19 @@ A jump table for the options with a short description can be found at |Q_op|.
Note that you can further refine the meaning of buttons with mappings.
See |mouse-overview|. But mappings are NOT used for modeless selection.
- Example: >
- :map <S-LeftMouse> <RightMouse>
- :map <S-LeftDrag> <RightDrag>
- :map <S-LeftRelease> <RightRelease>
- :map <2-S-LeftMouse> <2-RightMouse>
- :map <2-S-LeftDrag> <2-RightDrag>
- :map <2-S-LeftRelease> <2-RightRelease>
- :map <3-S-LeftMouse> <3-RightMouse>
- :map <3-S-LeftDrag> <3-RightDrag>
- :map <3-S-LeftRelease> <3-RightRelease>
- :map <4-S-LeftMouse> <4-RightMouse>
- :map <4-S-LeftDrag> <4-RightDrag>
- :map <4-S-LeftRelease> <4-RightRelease>
+ Example: >vim
+ map <S-LeftMouse> <RightMouse>
+ map <S-LeftDrag> <RightDrag>
+ map <S-LeftRelease> <RightRelease>
+ map <2-S-LeftMouse> <2-RightMouse>
+ map <2-S-LeftDrag> <2-RightDrag>
+ map <2-S-LeftRelease> <2-RightRelease>
+ map <3-S-LeftMouse> <3-RightMouse>
+ map <3-S-LeftDrag> <3-RightDrag>
+ map <3-S-LeftRelease> <3-RightRelease>
+ map <4-S-LeftMouse> <4-RightMouse>
+ map <4-S-LeftDrag> <4-RightDrag>
+ map <4-S-LeftRelease> <4-RightRelease>
<
Mouse commands requiring the CTRL modifier can be simulated by typing
the "g" key before using the mouse:
@@ -4293,8 +4308,8 @@ A jump table for the options with a short description can be found at |Q_op|.
for vertical scrolling). You can disable mouse scrolling by using
a count of 0.
- Example: >
- :set mousescroll=ver:5,hor:2
+ Example: >vim
+ set mousescroll=ver:5,hor:2
< Will make Nvim scroll 5 lines at a time when scrolling vertically, and
scroll 2 columns at a time when scrolling horizontally.
@@ -4355,8 +4370,8 @@ A jump table for the options with a short description can be found at |Q_op|.
Any modes not specified or shapes not available use the normal mouse
pointer.
- Example: >
- :set mouseshape=s:udsizing,m:no
+ Example: >vim
+ set mouseshape=s:udsizing,m:no
< will make the mouse turn to a sizing arrow over the status lines and
indicate no input when the hit-enter prompt is displayed (since
clicking the mouse has no effect in this state.)
@@ -4521,30 +4536,30 @@ A jump table for the options with a short description can be found at |Q_op|.
provided that the file being searched for has a relative path (not
starting with "/", "./" or "../"). The directories in the 'path'
option may be relative or absolute.
- - Use commas to separate directory names: >
- :set path=.,/usr/local/include,/usr/include
+ - Use commas to separate directory names: >vim
+ set path=.,/usr/local/include,/usr/include
< - Spaces can also be used to separate directory names. To have a
space in a directory name, precede it with an extra backslash, and
- escape the space: >
- :set path=.,/dir/with\\\ space
+ escape the space: >vim
+ set path=.,/dir/with\\\ space
< - To include a comma in a directory name precede it with an extra
- backslash: >
- :set path=.,/dir/with\\,comma
-< - To search relative to the directory of the current file, use: >
- :set path=.
+ backslash: >vim
+ set path=.,/dir/with\\,comma
+< - To search relative to the directory of the current file, use: >vim
+ set path=.
< - To search in the current directory use an empty string between two
- commas: >
- :set path=,,
+ commas: >vim
+ set path=,,
< - A directory name may end in a ':' or '/'.
- Environment variables are expanded |:set_env|.
- When using |netrw.vim| URLs can be used. For example, adding
"https://www.vim.org" will make ":find index.html" work.
- Search upwards and downwards in a directory tree using "*", "**" and
";". See |file-searching| for info and syntax.
- - Careful with '\' characters, type two to get one in the option: >
- :set path=.,c:\\include
-< Or just use '/' instead: >
- :set path=.,c:/include
+ - Careful with '\' characters, type two to get one in the option: >vim
+ set path=.,c:\\include
+< Or just use '/' instead: >vim
+ set path=.,c:/include
< Don't forget "." or files won't even be found in the same directory as
the file!
The maximum length is limited. How much depends on the system, mostly
@@ -4553,14 +4568,14 @@ A jump table for the options with a short description can be found at |Q_op|.
'path', see |:checkpath|.
The use of |:set+=| and |:set-=| is preferred when adding or removing
directories from the list. This avoids problems when a future version
- uses another default. To remove the current directory use: >
- :set path-=
-< To add the current directory use: >
- :set path+=
+ uses another default. To remove the current directory use: >vim
+ set path-=
+< To add the current directory use: >vim
+ set path+=
< To use an environment variable, you probably need to replace the
separator. Here is an example to append $INCL, in which directory
- names are separated with a semi-colon: >
- :let &path = &path .. "," .. substitute($INCL, ';', ',', 'g')
+ names are separated with a semi-colon: >vim
+ let &path = &path .. "," .. substitute($INCL, ';', ',', 'g')
< Replace the ';' with a ':' or whatever separator is used. Note that
this doesn't work when $INCL contains a comma or white space.
@@ -4602,10 +4617,10 @@ A jump table for the options with a short description can be found at |Q_op|.
It is possible to override the level for individual highlights within
the popupmenu using |highlight-blend|. For instance, to enable
- transparency but force the current selected element to be fully opaque: >
+ transparency but force the current selected element to be fully opaque: >vim
- :set pumblend=15
- :hi PmenuSel blend=0
+ set pumblend=15
+ hi PmenuSel blend=0
<
UI-dependent. Works best with RGB colors. 'termguicolors'
@@ -4828,8 +4843,8 @@ A jump table for the options with a short description can be found at |Q_op|.
The default ruler width is 17 characters. To make the ruler 15
characters wide, put "%15(" at the start and "%)" at the end.
- Example: >
- :set rulerformat=%15(%c%V\ %p%%%)
+ Example: >vim
+ set rulerformat=%15(%c%V\ %p%%%)
<
*'runtimepath'* *'rtp'* *vimfiles*
@@ -4907,8 +4922,8 @@ A jump table for the options with a short description can be found at |Q_op|.
runtime files. For speed, use as few items as possible and avoid
wildcards.
See |:runtime|.
- Example: >
- :set runtimepath=~/vimruntime,/mygroup/vim,$VIMRUNTIME
+ Example: >vim
+ set runtimepath=~/vimruntime,/mygroup/vim,$VIMRUNTIME
< This will use the directory "~/vimruntime" first (containing your
personal Nvim runtime files), then "/mygroup/vim", and finally
"$VIMRUNTIME" (the default runtime files).
@@ -4972,7 +4987,7 @@ A jump table for the options with a short description can be found at |Q_op|.
in the middle of the window (except at the start or end of the file or
when long lines wrap).
After using the local value, go back the global value with one of
- these two: >
+ these two: >vim
setlocal scrolloff<
setlocal scrolloff=-1
< For scrolling horizontally see 'sidescrolloff'.
@@ -5181,8 +5196,8 @@ A jump table for the options with a short description can be found at |Q_op|.
2^8 < 10240 < 2^16) + 10240 bytes (requested maximum item
contents size) = 10253 bytes.
- Example: >
- :set shada='50,<1000,s100,:0,n~/nvim/shada
+ Example: >vim
+ set shada='50,<1000,s100,:0,n~/nvim/shada
<
'50 Marks will be remembered for the last 50 files you
edited.
@@ -5225,12 +5240,12 @@ A jump table for the options with a short description can be found at |Q_op|.
Environment variables are expanded |:set_env|.
If the name of the shell contains a space, you need to enclose it in
- quotes. Example with quotes: >
- :set shell=\"c:\program\ files\unix\sh.exe\"\ -f
+ quotes. Example with quotes: >vim
+ set shell=\"c:\program\ files\unix\sh.exe\"\ -f
< Note the backslash before each quote (to avoid starting a comment) and
each space (to avoid ending the option value), so better use |:let-&|
- like this: >
- :let &shell='"C:\Program Files\unix\sh.exe" -f'
+ like this: >vim
+ let &shell='"C:\Program Files\unix\sh.exe" -f'
< Also note that the "-f" is not inside the quotes, because it is not
part of the command name.
*shell-unquoting*
@@ -5253,7 +5268,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Note that such processing is done after |:set| did its own round of
unescaping, so to keep yourself sane use |:let-&| like shown above.
*shell-powershell*
- To use PowerShell: >
+ To use PowerShell: >vim
let &shell = executable('pwsh') ? 'pwsh' : 'powershell'
let &shellcmdflag = '-NoLogo -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues[''Out-File:Encoding'']=''utf8'';Remove-Alias -Force -ErrorAction SilentlyContinue tee;'
let &shellredir = '2>&1 | %%{ "$_" } | Out-File %s; exit $LastExitCode'
@@ -5363,7 +5378,7 @@ A jump table for the options with a short description can be found at |Q_op|.
existing file names, thus this option needs to be set before opening
any file for best results. This might change in the future.
'shellslash' only works when a backslash can be used as a path
- separator. To test if this is so use: >
+ separator. To test if this is so use: >vim
if exists('+shellslash')
< Also see 'completeslash'.
@@ -5457,9 +5472,10 @@ A jump table for the options with a short description can be found at |Q_op|.
match", "Pattern not found", "Back at original", etc.
C don't give messages while scanning for ins-completion *shm-C*
items, for instance "scanning tags"
- q use "recording" instead of "recording @a" *shm-q*
+ q do not show "recording @a" when recording a macro *shm-q*
F don't give the file info when editing a file, like *shm-F*
- `:silent` was used for the command
+ `:silent` was used for the command; note that this also
+ affects messages from 'autoread' reloading
S do not show search count message when searching, e.g. *shm-S*
"[1/5]"
@@ -5476,9 +5492,9 @@ A jump table for the options with a short description can be found at |Q_op|.
'showbreak' 'sbr' string (default "")
global or local to window |global-local|
String to put at the start of lines that have been wrapped. Useful
- values are "> " or "+++ ": >
- :let &showbreak = "> "
- :let &showbreak = '+++ '
+ values are "> " or "+++ ": >vim
+ let &showbreak = "> "
+ let &showbreak = '+++ '
< Only printable single-cell characters are allowed, excluding <Tab> and
comma (in a future version the comma might be used to separate the
part that is shown at the end and at the start of a line).
@@ -5487,8 +5503,8 @@ A jump table for the options with a short description can be found at |Q_op|.
If you want the 'showbreak' to appear in between line numbers, add the
"n" flag to 'cpoptions'.
A window-local value overrules a global value. If the global value is
- set and you want no value in the current window use NONE: >
- :setlocal showbreak=NONE
+ set and you want no value in the current window use NONE: >vim
+ setlocal showbreak=NONE
<
*'showcmd'* *'sc'* *'noshowcmd'* *'nosc'*
@@ -5592,16 +5608,16 @@ A jump table for the options with a short description can be found at |Q_op|.
horizontally centered in the window, as long as one does not come too
close to the beginning of the line.
After using the local value, go back the global value with one of
- these two: >
+ these two: >vim
setlocal sidescrolloff<
setlocal sidescrolloff=-1
<
Example: Try this together with 'sidescroll' and 'listchars' as
in the following example to never allow the cursor to move
- onto the "extends" character: >
+ onto the "extends" character: >vim
- :set nowrap sidescroll=1 listchars=extends:>,precedes:<
- :set sidescrolloff=1
+ set nowrap sidescroll=1 listchars=extends:>,precedes:<
+ set sidescrolloff=1
<
*'signcolumn'* *'scl'*
@@ -5727,7 +5743,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Name of the word list file where words are added for the |zg| and |zw|
commands. It must end in ".{encoding}.add". You need to include the
path, otherwise the file is placed in the current directory.
- The path may include characters from 'isfname', space, comma and '@'.
+ The path may include characters from 'isfname', ' ', ',', '@' and ':'.
*E765*
It may also be a comma-separated list of names. A count before the
|zg| and |zw| commands can be used to access each. This allows using
@@ -5750,7 +5766,7 @@ A jump table for the options with a short description can be found at |Q_op|.
'spelllang' 'spl' string (default "en")
local to buffer
A comma-separated list of word list names. When the 'spell' option is
- on spellchecking will be done for these languages. Example: >
+ on spellchecking will be done for these languages. Example: >vim
set spelllang=en_us,nl,medical
< This means US English, Dutch and medical words are recognized. Words
that are not recognized will be highlighted.
@@ -5860,8 +5876,8 @@ A jump table for the options with a short description can be found at |Q_op|.
'verbose' option to a non-zero value.
Only one of "best", "double" or "fast" may be used. The others may
- appear several times in any order. Example: >
- :set sps=file:~/.config/nvim/sugg,best,expr:MySuggest()
+ appear several times in any order. Example: >vim
+ set sps=file:~/.config/nvim/sugg,best,expr:MySuggest()
<
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
@@ -5924,9 +5940,13 @@ A jump table for the options with a short description can be found at |Q_op|.
%s sign column for currently drawn line
%C fold column for currently drawn line
- NOTE: To draw the sign and fold columns, their items must be included in
- 'statuscolumn'. Even when they are not included, the status column width
- will adapt to the 'signcolumn' and 'foldcolumn' width.
+ The 'statuscolumn' width follows that of the default columns and
+ adapts to the |'numberwidth'|, |'signcolumn'| and |'foldcolumn'| option
+ values (regardless of whether the sign and fold items are present).
+ Additionally, the 'statuscolumn' grows with the size of the evaluated
+ format string, up to a point (following the maximum size of the default
+ fold, sign and number columns). Shrinking only happens when the number
+ of lines in a buffer changes, or the 'statuscolumn' option is set.
The |v:lnum| variable holds the line number to be drawn.
The |v:relnum| variable holds the relative line number to be drawn.
@@ -5934,6 +5954,9 @@ A jump table for the options with a short description can be found at |Q_op|.
when drawing the actual buffer line, and positive when
drawing the wrapped part of a buffer line.
+ When using |v:relnum|, keep in mind that cursor movement by itself will
+ not cause the 'statuscolumn' to update unless |'relativenumber'| is set.
+
NOTE: The %@ click execute function item is supported as well but the
specified function will be the same for each row in the same column.
It cannot be switched out through a dynamic 'statuscolumn' format, the
@@ -5941,21 +5964,21 @@ A jump table for the options with a short description can be found at |Q_op|.
Examples: >vim
" Relative number with bar separator and click handlers:
- :set statuscolumn=%@SignCb@%s%=%T%@NumCb@%r│%T
+ set statuscolumn=%@SignCb@%s%=%T%@NumCb@%r│%T
" Right aligned relative cursor line number:
- :let &stc='%=%{v:relnum?v:relnum:v:lnum} '
+ let &stc='%=%{v:relnum?v:relnum:v:lnum} '
" Line numbers in hexadecimal for non wrapped part of lines:
- :let &stc='%=%{v:virtnum>0?"":printf("%x",v:lnum)} '
+ let &stc='%=%{v:virtnum>0?"":printf("%x",v:lnum)} '
" Human readable line numbers with thousands separator:
- :let &stc='%{substitute(v:lnum,"\\d\\zs\\ze\\'
+ let &stc='%{substitute(v:lnum,"\\d\\zs\\ze\\'
. '%(\\d\\d\\d\\)\\+$",",","g")}'
" Both relative and absolute line numbers with different
" highlighting for odd and even relative numbers:
- :let &stc='%#NonText#%{&nu?v:lnum:""}' .
+ let &stc='%#NonText#%{&nu?v:lnum:""}' .
'%=%{&rnu&&(v:lnum%2)?"\ ".v:relnum:""}' .
'%#LineNr#%{&rnu&&!(v:lnum%2)?"\ ".v:relnum:""}'
@@ -5975,8 +5998,8 @@ A jump table for the options with a short description can be found at |Q_op|.
be given as "%%".
When the option starts with "%!" then it is used as an expression,
- evaluated and the result is used as the option value. Example: >
- :set statusline=%!MyStatusLine()
+ evaluated and the result is used as the option value. Example: >vim
+ set statusline=%!MyStatusLine()
< The *g:statusline_winid* variable will be set to the |window-ID| of the
window that the status line belongs to.
The result can contain %{} items that will be evaluated too.
@@ -6057,7 +6080,7 @@ A jump table for the options with a short description can be found at |Q_op|.
return value of expr contains "%" items they will get expanded.
The expression can contain the "}" character, the end of
expression is denoted by "%}".
- For example: >
+ For example: >vim
func! Stl_filename() abort
return "%t"
endfunc
@@ -6069,16 +6092,17 @@ A jump table for the options with a short description can be found at |Q_op|.
) - End of item group. No width fields allowed.
T N For 'tabline': start of tab page N label. Use %T or %X to end
the label. Clicking this label with left mouse button switches
- to the specified tab page.
+ to the specified tab page, while clicking it with middle mouse
+ button closes the specified tab page.
X N For 'tabline': start of close tab N label. Use %X or %T to end
the label, e.g.: %3Xclose%X. Use %999X for a "close current
- tab" label. Clicking this label with left mouse button closes
- specified tab page.
- @ N Start of execute function label. Use %X or %T to
- end the label, e.g.: %10@SwitchBuffer@foo.c%X. Clicking this
- label runs specified function: in the example when clicking once
- using left mouse button on "foo.c" "SwitchBuffer(10, 1, 'l',
- ' ')" expression will be run. Function receives the
+ tab" label. Clicking this label with left mouse button closes
+ the specified tab page.
+ @ N Start of execute function label. Use %X or %T to end the label,
+ e.g.: %10@SwitchBuffer@foo.c%X. Clicking this label runs the
+ specified function: in the example when clicking once using left
+ mouse button on "foo.c", a `SwitchBuffer(10, 1, 'l', ' ')`
+ expression will be run. The specified function receives the
following arguments in order:
1. minwid field value or zero if no N was specified
2. number of mouse clicks to detect multiple clicks
@@ -6124,8 +6148,8 @@ A jump table for the options with a short description can be found at |Q_op|.
When all items in a group becomes an empty string (i.e. flags that are
not set) and a minwid is not set for the group, the whole group will
become empty. This will make a group like the following disappear
- completely from the statusline when none of the flags are set. >
- :set statusline=...%(\ [%M%R%H]%)...
+ completely from the statusline when none of the flags are set. >vim
+ set statusline=...%(\ [%M%R%H]%)...
< Beware that an expression is evaluated each and every time the status
line is displayed.
*stl-%{* *g:actual_curbuf* *g:actual_curwin*
@@ -6156,23 +6180,23 @@ A jump table for the options with a short description can be found at |Q_op|.
edit your vimrc or whatever with "vim --clean" to get it right.
Examples:
- Emulate standard status line with 'ruler' set >
- :set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P
-< Similar, but add ASCII value of char under the cursor (like "ga") >
- :set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P
-< Display byte count and byte value, modified flag in red. >
- :set statusline=%<%f%=\ [%1*%M%*%n%R%H]\ %-19(%3l,%02c%03V%)%O'%02b'
- :hi User1 term=inverse,bold cterm=inverse,bold ctermfg=red
-< Display a ,GZ flag if a compressed file is loaded >
- :set statusline=...%r%{VarExists('b:gzflag','\ [GZ]')}%h...
-< In the |:autocmd|'s: >
- :let b:gzflag = 1
-< And: >
- :unlet b:gzflag
-< And define this function: >
- :function VarExists(var, val)
- : if exists(a:var) | return a:val | else | return '' | endif
- :endfunction
+ Emulate standard status line with 'ruler' set >vim
+ set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P
+< Similar, but add ASCII value of char under the cursor (like "ga") >vim
+ set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P
+< Display byte count and byte value, modified flag in red. >vim
+ set statusline=%<%f%=\ [%1*%M%*%n%R%H]\ %-19(%3l,%02c%03V%)%O'%02b'
+ hi User1 term=inverse,bold cterm=inverse,bold ctermfg=red
+< Display a ,GZ flag if a compressed file is loaded >vim
+ set statusline=...%r%{VarExists('b:gzflag','\ [GZ]')}%h...
+< In the |:autocmd|'s: >vim
+ let b:gzflag = 1
+< And: >vim
+ unlet b:gzflag
+< And define this function: >vim
+ function VarExists(var, val)
+ if exists(a:var) | return a:val | else | return '' | endif
+ endfunction
<
*'suffixes'* *'su'*
@@ -6193,8 +6217,8 @@ A jump table for the options with a short description can be found at |Q_op|.
'suffixesadd' 'sua' string (default "")
local to buffer
Comma-separated list of suffixes, which are used when searching for a
- file for the "gf", "[I", etc. commands. Example: >
- :set suffixesadd=.java
+ file for the "gf", "[I", etc. commands. Example: >vim
+ set suffixesadd=.java
<
*'swapfile'* *'swf'* *'noswapfile'* *'noswf'*
@@ -6266,19 +6290,19 @@ A jump table for the options with a short description can be found at |Q_op|.
Otherwise this option does not always reflect the current syntax (the
b:current_syntax variable does).
This option is most useful in a modeline, for a file which syntax is
- not automatically recognized. Example, in an IDL file: >
+ not automatically recognized. Example, in an IDL file: >c
/* vim: set syntax=idl : */
< When a dot appears in the value then this separates two filetype
- names. Example: >
+ names. Example: >c
/* vim: set syntax=c.doxygen : */
< This will use the "c" syntax first, then the "doxygen" syntax.
Note that the second one must be prepared to be loaded as an addition,
otherwise it will be skipped. More than one dot may appear.
- To switch off syntax highlighting for the current file, use: >
- :set syntax=OFF
+ To switch off syntax highlighting for the current file, use: >vim
+ set syntax=OFF
< To switch syntax highlighting on according to the current value of the
- 'filetype' option: >
- :set syntax=ON
+ 'filetype' option: >vim
+ set syntax=ON
< What actually happens when setting the 'syntax' option is that the
Syntax autocommand event is triggered with the value as argument.
This option is not copied to another buffer, independent of the 's' or
@@ -6495,6 +6519,10 @@ A jump table for the options with a short description can be found at |Q_op|.
attributes instead of "cterm" attributes. |guifg|
Requires an ISO-8613-3 compatible terminal.
+ Nvim will automatically attempt to determine if the host terminal
+ supports 24-bit color and will enable this option if it does
+ (unless explicitly disabled by the user).
+
*'termpastefilter'* *'tpf'*
'termpastefilter' 'tpf' string (default "BS,HT,ESC,DEL")
global
@@ -6628,13 +6656,13 @@ A jump table for the options with a short description can be found at |Q_op|.
expanded according to the rules used for 'statusline'.
This option cannot be set in a modeline when 'modelineexpr' is off.
- Example: >
- :auto BufEnter * let &titlestring = hostname() .. "/" .. expand("%:p")
- :set title titlestring=%<%F%=%l/%L-%P titlelen=70
+ Example: >vim
+ auto BufEnter * let &titlestring = hostname() .. "/" .. expand("%:p")
+ set title titlestring=%<%F%=%l/%L-%P titlelen=70
< The value of 'titlelen' is used to align items in the middle or right
of the available space.
- Some people prefer to have the file name first: >
- :set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:~:.:h\")})%)%(\ %a%)
+ Some people prefer to have the file name first: >vim
+ set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:~:.:h\")})%)%(\ %a%)
< Note the use of "%{ }" and an expression to get the path of the file,
without the file name. The "%( %)" constructs are used to add a
separating space only when needed.
@@ -6706,13 +6734,13 @@ A jump table for the options with a short description can be found at |Q_op|.
is kept in memory, higher numbers will cause more memory to be used.
Nevertheless, a single change can already use a large amount of memory.
Set to 0 for Vi compatibility: One level of undo and "u" undoes
- itself: >
+ itself: >vim
set ul=0
< But you can also get Vi compatibility by including the 'u' flag in
'cpoptions', and still be able to use CTRL-R to repeat undo.
Also see |undo-two-ways|.
Set to -1 for no undo at all. You might want to do this only for the
- current buffer: >
+ current buffer: >vim
setlocal ul=-1
< This helps when you run out of memory for a single change.
@@ -6757,6 +6785,57 @@ A jump table for the options with a short description can be found at |Q_op|.
written to disk (see |crash-recovery|). Also used for the
|CursorHold| autocommand event.
+ *'userregfunc'* *'urf'*
+'userregfunc' 'urf' string (default "")
+ global
+ The option specifies a function to be used to handle any registers
+ that Neovim does not natively handle. This option unlocks all
+ characters to be used as registers by the user.
+
+ The 'userregfunc' function is called each time a user register is read
+ from or written to.
+
+ The 'userregfunc' function must take the following parameters:
+
+ {action} The action being done on this register (either 'yank'
+ or 'put'
+
+ {register} The string holding the name of the register. This
+ is always a single character, though multi-byte
+ characters are allowed.
+
+ {content} If the action is 'yank' this is the content being
+ yanked into the register. The content is a dictionary
+ with the following items:
+
+ {lines} The lines being yanked, as a list.
+
+ {type} The type of yank, either "line", "char", or
+ "block"
+
+ {width} The width in case of "block" mode.
+
+ {additional_data} Additional data. (can be returned in
+ put mode).
+
+ In case the action is 'put', the 'userregfunc' function should return
+ the content to place in that location. The content can either be a
+ string, in which case "char" mode is inferred, or it can return a
+ dictionary of the same template that populates 'content'.
+
+ A very simple example of a 'userregfunc' function that behaves exactly
+ like traditional registers would look like: >
+
+ let s:contents = {}
+ function! MyUserregFunction(action, register, content) abort
+ if a:action == "put"
+ return get(s:contents, a:register, "")
+ else
+ let s:contents[a:register] = a:content
+ endif
+ endfunction
+ set userregfunc=MyUserregFunction
+<
*'varsofttabstop'* *'vsts'*
'varsofttabstop' 'vsts' string (default "")
local to buffer
@@ -6768,8 +6847,8 @@ A jump table for the options with a short description can be found at |Q_op|.
For example, when editing assembly language files where statements
start in the 9th column and comments in the 41st, it may be useful
- to use the following: >
- :set varsofttabstop=8,32,8
+ to use the following: >vim
+ set varsofttabstop=8,32,8
< This will set soft tabstops with 8 and 8 + 32 spaces, and 8 more
for every column thereafter.
@@ -6781,8 +6860,8 @@ A jump table for the options with a short description can be found at |Q_op|.
local to buffer
A list of the number of spaces that a <Tab> in the file counts for,
separated by commas. Each value corresponds to one tab, with the
- final value applying to all subsequent tabs. For example: >
- :set vartabstop=4,20,10,8
+ final value applying to all subsequent tabs. For example: >vim
+ set vartabstop=4,20,10,8
< This will make the first tab 4 spaces wide, the second 20 spaces,
the third 10 spaces, and all following tabs 8 spaces.
@@ -6794,15 +6873,15 @@ A jump table for the options with a short description can be found at |Q_op|.
global
Sets the verbosity level. Also set by |-V| and |:verbose|.
- Tracing of options in Lua scripts is activated at level 1; Lua scripts
- are not traced with verbose=0, for performance.
+ Tracing of assignments to options, mappings, etc. in Lua scripts is
+ enabled at level 1; Lua scripts are not traced when 'verbose' is 0,
+ for performance.
If greater than or equal to a given level, Nvim produces the following
messages:
Level Messages ~
----------------------------------------------------------------------
- 1 Lua assignments to options, mappings, etc.
2 When a file is ":source"'ed, or |shada| file is read or written.
3 UI info, terminal capabilities.
4 Shell commands.
@@ -6911,8 +6990,8 @@ A jump table for the options with a short description can be found at |Q_op|.
~ "~" Normal
[ <Left> Insert and Replace
] <Right> Insert and Replace
- For example: >
- :set ww=<,>,[,]
+ For example: >vim
+ set ww=<,>,[,]
< allows wrap only when cursor keys are used.
When the movement keys are used in combination with a delete or change
operator, the <EOL> also counts for a character. This makes "3h"
@@ -6936,8 +7015,8 @@ A jump table for the options with a short description can be found at |Q_op|.
Some keys will not work, such as CTRL-C, <CR> and Enter.
<Esc> can be used, but hitting it twice in a row will still exit
command-line as a failsafe measure.
- Although 'wc' is a number option, you can set it to a special key: >
- :set wc=<Tab>
+ Although 'wc' is a number option, you can set it to a special key: >vim
+ set wc=<Tab>
<
*'wildcharm'* *'wcm'*
@@ -6947,9 +7026,9 @@ A jump table for the options with a short description can be found at |Q_op|.
recognized when used inside a macro. You can find "spare" command-line
keys suitable for this option by looking at |ex-edit-index|. Normally
you'll never actually type 'wildcharm', just use it in mappings that
- automatically invoke completion mode, e.g.: >
- :set wcm=<C-Z>
- :cnoremap ss so $vim/sessions/*.vim<C-Z>
+ automatically invoke completion mode, e.g.: >vim
+ set wcm=<C-Z>
+ cnoremap ss so $vim/sessions/*.vim<C-Z>
< Then after typing :ss you can use CTRL-P & CTRL-N.
*'wildignore'* *'wig'*
@@ -6961,8 +7040,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|globpath()| unless a flag is passed to disable this.
The pattern is used like with |:autocmd|, see |autocmd-pattern|.
Also see 'suffixes'.
- Example: >
- :set wildignore=*.o,*.obj
+ Example: >vim
+ set wildignore=*.o,*.obj
< The use of |:set+=| and |:set-=| is preferred when adding or removing
a pattern from the list. This avoids problems when a future version
uses another default.
@@ -7010,9 +7089,9 @@ A jump table for the options with a short description can be found at |Q_op|.
completion.
If you want <Left> and <Right> to move the cursor instead of selecting
- a different match, use this: >
- :cnoremap <Left> <Space><BS><Left>
- :cnoremap <Right> <Space><BS><Right>
+ a different match, use this: >vim
+ cnoremap <Left> <Space><BS><Left>
+ cnoremap <Right> <Space><BS><Right>
<
|hl-WildMenu| highlights the current match.
@@ -7050,16 +7129,16 @@ A jump table for the options with a short description can be found at |Q_op|.
and sort buffers by time last used (other than the
current buffer).
- Examples: >
- :set wildmode=full
-< Complete first full match, next match, etc. (the default) >
- :set wildmode=longest,full
-< Complete longest common string, then each full match >
- :set wildmode=list:full
-< List all matches and complete each full match >
- :set wildmode=list,full
-< List all matches without completing, then each full match >
- :set wildmode=longest,list
+ Examples: >vim
+ set wildmode=full
+< Complete first full match, next match, etc. (the default) >vim
+ set wildmode=longest,full
+< Complete longest common string, then each full match >vim
+ set wildmode=list:full
+< List all matches and complete each full match >vim
+ set wildmode=list,full
+< List all matches without completing, then each full match >vim
+ set wildmode=longest,list
< Complete longest common string, then list alternatives.
More info here: |cmdline-completion|.
@@ -7169,7 +7248,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Other windows will be only 'winminheight' high. This has the drawback
that ":all" will create only two windows. To avoid "vim -o 1 2 3 4"
to create only two windows, set the option after startup is done,
- using the |VimEnter| event: >
+ using the |VimEnter| event: >vim
au VimEnter * set winheight=999
< Minimum value is 1.
The height is not adjusted after one of the commands that change the
@@ -7194,7 +7273,7 @@ A jump table for the options with a short description can be found at |Q_op|.
the popupmenu are determined by the current window. Highlights in the
message area cannot be overridden.
- Example: show a different color for non-current windows: >
+ Example: show a different color for non-current windows: >vim
set winhighlight=Normal:MyNormal,NormalNC:MyNormalNC
<
@@ -7250,9 +7329,9 @@ A jump table for the options with a short description can be found at |Q_op|.
horizontally.
The line will be broken in the middle of a word if necessary. See
'linebreak' to get the break at a word boundary.
- To make scrolling horizontally a bit more useful, try this: >
- :set sidescroll=5
- :set listchars+=precedes:<,extends:>
+ To make scrolling horizontally a bit more useful, try this: >vim
+ set sidescroll=5
+ set listchars+=precedes:<,extends:>
< See 'sidescroll', 'listchars' and |wrap-off|.
This option can't be set from a |modeline| when the 'diff' option is
on.
diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt
index 85ac290361..d8fcd066a8 100644
--- a/runtime/doc/pi_netrw.txt
+++ b/runtime/doc/pi_netrw.txt
@@ -639,7 +639,7 @@ additional prompting.
work with your ftp client. Otherwise the script will
prompt for user-id and password.
- (*3) for ftp, "machine" may be machine#port or machine:port
+ (*3) for ftp, "machine" may be machine#port or machine:port
if a different port is needed than the standard ftp port
(*4) for http:..., if wget is available it will be used. Otherwise,
@@ -785,7 +785,7 @@ below, a {netfile} is a URL to a remote file.
(related: |netrw-userpass|)
:NetrwSettings This command is described in |netrw-settings| -- used to
- display netrw settings and change netrw behavior.
+ display netrw settings and change netrw behavior.
==============================================================================
@@ -1621,10 +1621,8 @@ A further approach is to delete files which match a pattern.
This will cause the matching files to be marked. Then,
press "D".
-If your vim has 7.4 with patch#1107, then |g:netrw_localrmdir| no longer
-is used to remove directories; instead, vim's |delete()| is used with
-the "d" option. Please note that only empty directories may be deleted
-with the "D" mapping. Regular files are deleted with |delete()|, too.
+Please note that only empty directories may be deleted with the "D" mapping.
+Regular files are deleted with |delete()|, too.
The |g:netrw_rm_cmd|, |g:netrw_rmf_cmd|, and |g:netrw_rmdir_cmd| variables are
used to control the attempts to remove remote files and directories. The
@@ -1643,8 +1641,7 @@ to remove it again using the g:netrw_rmf_cmd variable. Its default value is:
|g:netrw_rmf_cmd|: ssh HOSTNAME rm -f
Related topics: |netrw-d|
-Associated setting variable: |g:netrw_localrmdir| |g:netrw_rm_cmd|
- |g:netrw_rmdir_cmd| |g:netrw_ssh_cmd|
+Associated setting variable: |g:netrw_rm_cmd| |g:netrw_ssh_cmd|
*netrw-explore* *netrw-hexplore* *netrw-nexplore* *netrw-pexplore*
@@ -1687,7 +1684,11 @@ DIRECTORY EXPLORATION COMMANDS {{{2
to 2; edits will thus preferentially be made in window#2.
The [N] specifies a |g:netrw_winsize| just for the new :Lexplore
- window.
+ window. That means that
+ if [N] < 0 : use |N| columns for the Lexplore window
+ if [N] = 0 : a normal split is made
+ if [N] > 0 : use N% of the current window will be used for the
+ new window
Those who like this method often also like tree style displays;
see |g:netrw_liststyle|.
@@ -2848,14 +2849,6 @@ your browsing preferences. (see also: |netrw-settings|)
=" /c move" Windows
Options for |g:netrw_localmovecmd|
- *g:netrw_localrmdir* ="rmdir" Linux/Unix/MacOS/Cygwin
- =expand("$COMSPEC") Windows
- Remove directory command (rmdir)
- This variable is only used if your vim is
- earlier than 7.4 or if your vim doesn't
- have patch#1107. Otherwise, |delete()|
- is used with the "d" option.
-
*g:netrw_maxfilenamelen* =32 by default, selected so as to make long
listings fit on 80 column displays.
If your screen is wider, and you have file
@@ -3766,7 +3759,7 @@ Example: Clear netrw's marked file list via a mapping on gu >
Netrw uses several system level commands to do things (see
|g:netrw_localcopycmd|, |g:netrw_localmovecmd|,
- |g:netrw_localrmdir|, |g:netrw_mkdir_cmd|).
+ |g:netrw_mkdir_cmd|).
You may need to adjust the default commands for one or more of
these commands by setting them properly in your .vimrc. Another
@@ -3892,8 +3885,13 @@ netrw:
==============================================================================
12. History *netrw-history* {{{1
- v172: Apr 22, 2023 * removed g:netrw_localrmdiropt
- removed g:netrw_localrmdir
+ v172: Sep 02, 2021 * (Bram Moolenaar) Changed "l:go" to "go"
+ * (Bram Moolenaar) no need for "b" in
+ netrw-safe guioptions
+ Nov 15, 2021 * removed netrw_localrm and netrw_localrmdir
+ references
+ Aug 18, 2022 * (Miguel Barro) improving compatability with
+ powershell
v171: Oct 09, 2020 * included code in s:NetrwOptionsSafe()
to allow |'bh'| to be set to delete when
rather than hide when g:netrw_fastbrowse
@@ -3981,7 +3979,6 @@ netrw:
|g:netrw_localcopydircmdopt|
|g:netrw_localmkdiropt|
|g:netrw_localmovecmdopt|
- g:netrw_localrmdiropt
Nov 21, 2016 * (mattn) provided a patch for preview; swapped
winwidth() with winheight()
Nov 22, 2016 * (glacambre) reported that files containing
@@ -4041,7 +4038,7 @@ netrw:
refreshes. However, inside a |:map-<expr>|,
tab and window changes are disallowed. Fixed.
(affects netrw's s:LocalBrowseRefresh())
- * |g:netrw_localrmdir| not used any more, but
+ * g:netrw_localrmdir not used any more, but
the relevant patch that causes |delete()| to
take over was #1107 (not #1109).
* |expand()| is now used on |g:netrw_home|;
diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt
index 4428ff2f65..9037ecc0f9 100644
--- a/runtime/doc/quickfix.txt
+++ b/runtime/doc/quickfix.txt
@@ -368,12 +368,12 @@ processing a quickfix or location list command, it will be aborted.
:cl[ist]! +{count} List the current and next {count} error lines. This
is useful to see unrecognized lines after the current
one. For example, if ":clist" shows:
- 8384 testje.java:252: error: cannot find symbol ~
+ 8384 testje.java:252: error: cannot find symbol ~
Then using ":cl! +3" shows the reason:
- 8384 testje.java:252: error: cannot find symbol ~
- 8385: ZexitCode = Fmainx(); ~
- 8386: ^ ~
- 8387: symbol: method Fmainx() ~
+ 8384 testje.java:252: error: cannot find symbol ~
+ 8385: ZexitCode = Fmainx(); ~
+ 8386: ^ ~
+ 8387: symbol: method Fmainx() ~
:lli[st] [from] [, [to]] *:lli* *:llist*
Same as ":clist", except the location list for the
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
index f976eb7464..572dc8a841 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -623,9 +623,9 @@ Short explanation of each option: *option-list*
'aleph' 'al' ASCII code of the letter Aleph (Hebrew)
'allowrevins' 'ari' allow CTRL-_ in Insert and Command-line mode
'ambiwidth' 'ambw' what to do with Unicode chars of ambiguous width
-'autochdir' 'acd' change directory to the file in the current window
'arabic' 'arab' for Arabic as a default second language
'arabicshape' 'arshape' do shaping for Arabic characters
+'autochdir' 'acd' change directory to the file in the current window
'autoindent' 'ai' take indent for new line from previous line
'autoread' 'ar' autom. read file when changed outside of Vim
'autowrite' 'aw' automatically write file if changed
@@ -655,8 +655,8 @@ Short explanation of each option: *option-list*
'cindent' 'cin' do C program indenting
'cinkeys' 'cink' keys that trigger indent when 'cindent' is set
'cinoptions' 'cino' how to do indenting when 'cindent' is set
-'cinwords' 'cinw' words where 'si' and 'cin' add an indent
'cinscopedecls' 'cinsd' words that are recognized by 'cino-g'
+'cinwords' 'cinw' words where 'si' and 'cin' add an indent
'clipboard' 'cb' use the clipboard as the unnamed register
'cmdheight' 'ch' number of lines to use for the command-line
'cmdwinheight' 'cwh' height of the command-line window
@@ -738,10 +738,10 @@ Short explanation of each option: *option-list*
'helpheight' 'hh' minimum height of a new help window
'helplang' 'hlg' preferred help languages
'hidden' 'hid' don't unload buffer when it is |abandon|ed
-'hlsearch' 'hls' highlight matches with last search pattern
'history' 'hi' number of command-lines that are remembered
'hkmap' 'hk' Hebrew keyboard mapping
'hkmapp' 'hkp' phonetic Hebrew keyboard mapping
+'hlsearch' 'hls' highlight matches with last search pattern
'icon' let Vim set the text of the window icon
'iconstring' string to use for the Vim icon text
'ignorecase' 'ic' ignore case in search patterns
@@ -939,10 +939,10 @@ Short explanation of each option: *option-list*
'wildoptions' 'wop' specifies how command line completion is done
'winaltkeys' 'wak' when the windows system handles ALT keys
'window' 'wi' nr of lines to scroll for CTRL-F and CTRL-B
-'winheight' 'wh' minimum number of lines for the current window
-'winhighlight' 'winhl' window-local highlighting
'winfixheight' 'wfh' keep window height when opening/closing windows
'winfixwidth' 'wfw' keep window width when opening/closing windows
+'winheight' 'wh' minimum number of lines for the current window
+'winhighlight' 'winhl' window-local highlighting
'winminheight' 'wmh' minimum number of lines for any window
'winminwidth' 'wmw' minimal number of columns for any window
'winwidth' 'wiw' minimal number of columns for current window
diff --git a/runtime/doc/recover.txt b/runtime/doc/recover.txt
index e6b5b06744..4312716b22 100644
--- a/runtime/doc/recover.txt
+++ b/runtime/doc/recover.txt
@@ -85,10 +85,10 @@ You can find this in the user manual, section |11.3|.
*W325*
The default |SwapExists| handler (|default-autocmds|) skips the |E325| prompt
-(selects "(E)dit") if the swapfile owner process (1) is still running and (2)
-was started by the current user. This presumes that you normally don't want
-to be bothered with the |ATTENTION| message just because you happen to edit
-the same file from multiple Nvim instances. In the worst case (a system
+(and automatically chooses "(E)dit") if the swapfile owner process is still
+running and owned by the current user. This presumes that you normally don't
+want to be bothered with the |ATTENTION| message just because you happen to
+edit the same file from multiple Nvim instances. In the worst case (a system
crash) there will be more than one swapfile for the file; use |:recover| to
inspect all of its swapfiles.
diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt
index 53f6904170..ae827fa06f 100644
--- a/runtime/doc/repeat.txt
+++ b/runtime/doc/repeat.txt
@@ -148,10 +148,20 @@ q Stops recording.
*@@* *E748*
@@ Repeat the previous @{0-9a-z":*} [count] times.
+ *v_@-default*
+{Visual}@{0-9a-z".=*+} In Visual mode, execute the contents of the register
+{Visual}@@ but for each selected line.
+ See |visual-repeat|, |default-mappings|.
+
*Q*
Q Repeat the last recorded register [count] times.
See |reg_recorded()|.
+ *v_Q-default*
+{Visual}Q In Visual mode, repeat the last recorded register for
+ each selected line.
+ See |visual-repeat|, |default-mappings|.
+
*:@*
:[addr]@{0-9a-z".=*+} Execute the contents of register {0-9a-z".=*+} as an Ex
command. First set cursor at line [addr] (default is
@@ -182,11 +192,11 @@ Using Vim scripts *using-scripts*
For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
*:so* *:source* *load-vim-script*
-:[range]so[urce] [file] Runs |Ex| commands or Lua code (".lua" files) from
+:[range]so[urce] [file] Runs |Ex-commands| or Lua code (".lua" files) from
[file].
- If no [file], the current buffer is used, and it is
- treated as Lua code if its 'filetype' is "lua" or its
- file name ends with ".lua".
+ If no [file], the current buffer is used and treated
+ as Lua code if 'filetype' is "lua" or its filename
+ ends with ".lua".
Triggers the |SourcePre| autocommand.
*:source!*
:[range]so[urce]! {file}
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index e1053b54f1..c02752a2b7 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -196,52 +196,56 @@ be preferred names for highlight groups that are common for many languages.
These are the suggested group names (if syntax highlighting works properly
you can see the actual color, except for "Ignore"):
- Comment any comment
+Comment any comment
- Constant any constant
- String a string constant: "this is a string"
- Character a character constant: 'c', '\n'
- Number a number constant: 234, 0xff
- Boolean a boolean constant: TRUE, false
- Float a floating point constant: 2.3e10
+Constant any constant
+String a string constant: "this is a string"
+Character a character constant: 'c', '\n'
+Number a number constant: 234, 0xff
+Boolean a boolean constant: TRUE, false
+Float a floating point constant: 2.3e10
- Identifier any variable name
- Function function name (also: methods for classes)
+Identifier any variable name
+Function function name (also: methods for classes)
- Statement any statement
- Conditional if, then, else, endif, switch, etc.
- Repeat for, do, while, etc.
- Label case, default, etc.
- Operator "sizeof", "+", "*", etc.
- Keyword any other keyword
- Exception try, catch, throw
+Statement any statement
+Conditional if, then, else, endif, switch, etc.
+Repeat for, do, while, etc.
+Label case, default, etc.
+Operator "sizeof", "+", "*", etc.
+Keyword any other keyword
+Exception try, catch, throw
- PreProc generic Preprocessor
- Include preprocessor #include
- Define preprocessor #define
- Macro same as Define
- PreCondit preprocessor #if, #else, #endif, etc.
+PreProc generic Preprocessor
+Include preprocessor #include
+Define preprocessor #define
+Macro same as Define
+PreCondit preprocessor #if, #else, #endif, etc.
- Type int, long, char, etc.
- StorageClass static, register, volatile, etc.
- Structure struct, union, enum, etc.
- Typedef A typedef
+Type int, long, char, etc.
+StorageClass static, register, volatile, etc.
+Structure struct, union, enum, etc.
+Typedef a typedef
- Special any special symbol
- SpecialChar special character in a constant
- Tag you can use CTRL-] on this
- Delimiter character that needs attention
- SpecialComment special things inside a comment
- Debug debugging statements
+Special any special symbol
+SpecialChar special character in a constant
+Tag you can use CTRL-] on this
+Delimiter character that needs attention
+SpecialComment special things inside a comment
+Debug debugging statements
- Underlined text that stands out, HTML links
+Underlined text that stands out, HTML links
- Ignore left blank, hidden |hl-Ignore|
+Ignore left blank, hidden |hl-Ignore|
- Error any erroneous construct
+Error any erroneous construct
- Todo anything that needs extra attention; mostly the
- keywords TODO FIXME and XXX
+Todo anything that needs extra attention; mostly the
+ keywords TODO FIXME and XXX
+
+Added added line in a diff
+Changed changed line in a diff
+Removed removed line in a diff
The names marked with * are the preferred groups; the others are minor groups.
For the preferred groups, the "syntax.vim" file contains default highlighting.
@@ -337,443 +341,11 @@ Upon loading a file, Vim finds the relevant syntax file as follows:
syntax.
==============================================================================
-4. Conversion to HTML *2html.vim* *convert-to-HTML*
-
-2html is not a syntax file itself, but a script that converts the current
-window into HTML. Vim opens a new window in which it builds the HTML file.
-
-After you save the resulting file, you can view it with any browser. The
-colors should be exactly the same as you see them in Vim. With
-|g:html_line_ids| you can jump to specific lines by adding (for example) #L123
-or #123 to the end of the URL in your browser's address bar. And with
-|g:html_dynamic_folds| enabled, you can show or hide the text that is folded
-in Vim.
+4. Conversion to HTML *convert-to-HTML* *2html.vim*
-You are not supposed to set the 'filetype' or 'syntax' option to "2html"!
-Source the script to convert the current file: >
-
- :runtime! syntax/2html.vim
-<
-Many variables affect the output of 2html.vim; see below. Any of the on/off
-options listed below can be enabled or disabled by setting them explicitly to
-the desired value, or restored to their default by removing the variable using
-|:unlet|.
-
-Remarks:
-- Some truly ancient browsers may not show the background colors.
-- From most browsers you can also print the file (in color)!
-
-Here is an example how to run the script over all .c and .h files from a
-Unix shell: >
- for f in *.[ch]; do gvim -f +"syn on" +"run! syntax/2html.vim" +"wq" +"q" $f; done
-<
- *g:html_start_line* *g:html_end_line*
-To restrict the conversion to a range of lines, use a range with the |:TOhtml|
-command below, or set "g:html_start_line" and "g:html_end_line" to the first
-and last line to be converted. Example, using the last set Visual area: >
-
- :let g:html_start_line = line("'<")
- :let g:html_end_line = line("'>")
- :runtime! syntax/2html.vim
-<
- *:TOhtml*
-:[range]TOhtml The ":TOhtml" command is defined in a standard plugin.
- This command will source |2html.vim| for you. When a
- range is given, this command sets |g:html_start_line|
- and |g:html_end_line| to the start and end of the
- range, respectively. Default range is the entire
- buffer.
-
- If the current window is part of a |diff|, unless
- |g:html_diff_one_file| is set, :TOhtml will convert
- all windows which are part of the diff in the current
- tab and place them side-by-side in a <table> element
- in the generated HTML. With |g:html_line_ids| you can
- jump to lines in specific windows with (for example)
- #W1L42 for line 42 in the first diffed window, or
- #W3L87 for line 87 in the third.
-
- Examples: >
-
- :10,40TOhtml " convert lines 10-40 to html
- :'<,'>TOhtml " convert current/last visual selection
- :TOhtml " convert entire buffer
-<
- *g:html_diff_one_file*
-Default: 0.
-When 0, and using |:TOhtml| all windows involved in a |diff| in the current tab
-page are converted to HTML and placed side-by-side in a <table> element. When
-1, only the current buffer is converted.
-Example: >
+The old to html converter has ben replaced by a Lua version and the
+documentation has been moved to |:TOhtml|.
- let g:html_diff_one_file = 1
-<
- *g:html_whole_filler*
-Default: 0.
-When 0, if |g:html_diff_one_file| is 1, a sequence of more than 3 filler lines
-is displayed as three lines with the middle line mentioning the total number
-of inserted lines.
-When 1, always display all inserted lines as if |g:html_diff_one_file| were
-not set.
->
- :let g:html_whole_filler = 1
-<
- *TOhtml-performance* *g:html_no_progress*
-Default: 0.
-When 0, display a progress bar in the statusline for each major step in the
-2html.vim conversion process.
-When 1, do not display the progress bar. This offers a minor speed improvement
-but you won't have any idea how much longer the conversion might take; for big
-files it can take a long time!
-Example: >
-
- let g:html_no_progress = 1
-<
-You can obtain better performance improvements by also instructing Vim to not
-run interactively, so that too much time is not taken to redraw as the script
-moves through the buffer, switches windows, and the like: >
-
- vim -E -s -c "let g:html_no_progress=1" -c "syntax on" -c "set ft=c" -c "runtime syntax/2html.vim" -cwqa myfile.c
-<
-Note that the -s flag prevents loading your vimrc and any plugins, so you
-need to explicitly source/enable anything that will affect the HTML
-conversion. See |-E| and |-s-ex| for details. It is probably best to create a
-script to replace all the -c commands and use it with the -u flag instead of
-specifying each command separately.
-
- *hl-TOhtmlProgress* *TOhtml-progress-color*
-When displayed, the progress bar will show colored boxes along the statusline
-as the HTML conversion proceeds. By default, the background color as the
-current "DiffDelete" highlight group is used. If "DiffDelete" and "StatusLine"
-have the same background color, TOhtml will automatically adjust the color to
-differ. If you do not like the automatically selected colors, you can define
-your own highlight colors for the progress bar. Example: >
-
- hi TOhtmlProgress guifg=#c0ffee ctermbg=7
-<
- *g:html_number_lines*
-Default: Current 'number' setting.
-When 0, buffer text is displayed in the generated HTML without line numbering.
-When 1, a column of line numbers is added to the generated HTML with the same
-highlighting as the line number column in Vim (|hl-LineNr|).
-Force line numbers even if 'number' is not set: >
- :let g:html_number_lines = 1
-Force to omit the line numbers: >
- :let g:html_number_lines = 0
-Go back to the default to use 'number' by deleting the variable: >
- :unlet g:html_number_lines
-<
- *g:html_line_ids*
-Default: 1 if |g:html_number_lines| is set, 0 otherwise.
-When 1, adds an HTML id attribute to each line number, or to an empty <span>
-inserted for that purpose if no line numbers are shown. This ID attribute
-takes the form of L123 for single-buffer HTML pages, or W2L123 for diff-view
-pages, and is used to jump to a specific line (in a specific window of a diff
-view). Javascript is inserted to open any closed dynamic folds
-(|g:html_dynamic_folds|) containing the specified line before jumping. The
-javascript also allows omitting the window ID in the url, and the leading L.
-For example: >
-
- page.html#L123 jumps to line 123 in a single-buffer file
- page.html#123 does the same
-
- diff.html#W1L42 jumps to line 42 in the first window in a diff
- diff.html#42 does the same
-<
- *g:html_use_css*
-Default: 1.
-When 1, generate valid HTML 5 markup with CSS styling, supported in all modern
-browsers and many old browsers.
-When 0, generate <font> tags and similar outdated markup. This is not
-recommended but it may work better in really old browsers, email clients,
-forum posts, and similar situations where basic CSS support is unavailable.
-Example: >
- :let g:html_use_css = 0
-<
- *g:html_ignore_conceal*
-Default: 0.
-When 0, concealed text is removed from the HTML and replaced with a character
-from |:syn-cchar| or 'listchars' as appropriate, depending on the current
-value of 'conceallevel'.
-When 1, include all text from the buffer in the generated HTML, even if it is
-|conceal|ed.
-
-Either of the following commands will ensure that all text in the buffer is
-included in the generated HTML (unless it is folded): >
- :let g:html_ignore_conceal = 1
- :setl conceallevel=0
-<
- *g:html_ignore_folding*
-Default: 0.
-When 0, text in a closed fold is replaced by the text shown for the fold in
-Vim (|fold-foldtext|). See |g:html_dynamic_folds| if you also want to allow
-the user to expand the fold as in Vim to see the text inside.
-When 1, include all text from the buffer in the generated HTML; whether the
-text is in a fold has no impact at all. |g:html_dynamic_folds| has no effect.
-
-Either of these commands will ensure that all text in the buffer is included
-in the generated HTML (unless it is concealed): >
- zR
- :let g:html_ignore_folding = 1
-<
- *g:html_dynamic_folds*
-Default: 0.
-When 0, text in a closed fold is not included at all in the generated HTML.
-When 1, generate javascript to open a fold and show the text within, just like
-in Vim.
-
-Setting this variable to 1 causes 2html.vim to always use CSS for styling,
-regardless of what |g:html_use_css| is set to.
-
-This variable is ignored when |g:html_ignore_folding| is set.
->
- :let g:html_dynamic_folds = 1
-<
- *g:html_no_foldcolumn*
-Default: 0.
-When 0, if |g:html_dynamic_folds| is 1, generate a column of text similar to
-Vim's foldcolumn (|fold-foldcolumn|) the user can click on to toggle folds
-open or closed. The minimum width of the generated text column is the current
-'foldcolumn' setting.
-When 1, do not generate this column; instead, hovering the mouse cursor over
-folded text will open the fold as if |g:html_hover_unfold| were set.
->
- :let g:html_no_foldcolumn = 1
-<
- *TOhtml-uncopyable-text* *g:html_prevent_copy*
-Default: Empty string.
-This option prevents certain regions of the generated HTML from being copied,
-when you select all text in document rendered in a browser and copy it. Useful
-for allowing users to copy-paste only the source text even if a fold column or
-line numbers are shown in the generated content. Specify regions to be
-affected in this way as follows:
- f: fold column
- n: line numbers (also within fold text)
- t: fold text
- d: diff filler
-
-Example, to make the fold column and line numbers uncopyable: >
- :let g:html_prevent_copy = "fn"
-<
-The method used to prevent copying in the generated page depends on the value
-of |g:html_use_input_for_pc|.
-
- *g:html_use_input_for_pc*
-Default: "none"
-If |g:html_prevent_copy| is non-empty, then:
-
-When "all", read-only <input> elements are used in place of normal text for
-uncopyable regions. In some browsers, especially older browsers, after
-selecting an entire page and copying the selection, the <input> tags are not
-pasted with the page text. If |g:html_no_invalid| is 0, the <input> tags have
-invalid type; this works in more browsers, but the page will not validate.
-Note: This method does NOT work in recent versions of Chrome and equivalent
-browsers; the <input> tags get pasted with the text.
-
-When "fallback" (default value), the same <input> elements are generated for
-older browsers, but newer browsers (detected by CSS feature query) hide the
-<input> elements and instead use generated content in an ::before pseudoelement
-to display the uncopyable text. This method should work with the largest
-number of browsers, both old and new.
-
-When "none", the <input> elements are not generated at all. Only the
-generated-content method is used. This means that old browsers, notably
-Internet Explorer, will either copy the text intended not to be copyable, or
-the non-copyable text may not appear at all. However, this is the most
-standards-based method, and there will be much less markup.
-
- *g:html_no_invalid*
-Default: 0.
-When 0, if |g:html_prevent_copy| is non-empty and |g:html_use_input_for_pc| is
-not "none", an invalid attribute is intentionally inserted into the <input>
-element for the uncopyable areas. This prevents pasting the <input> elements
-in some applications. Specifically, some versions of Microsoft Word will not
-paste the <input> elements if they contain this invalid attribute. When 1, no
-invalid markup is inserted, and the generated page should validate. However,
-<input> elements may be pasted into some applications and can be difficult to
-remove afterward.
-
- *g:html_hover_unfold*
-Default: 0.
-When 0, the only way to open a fold generated by 2html.vim with
-|g:html_dynamic_folds| set, is to click on the generated fold column.
-When 1, use CSS 2.0 to allow the user to open a fold by moving the mouse
-cursor over the displayed fold text. This is useful to allow users with
-disabled javascript to view the folded text.
-
-Note that old browsers (notably Internet Explorer 6) will not support this
-feature. Browser-specific markup for IE6 is included to fall back to the
-normal CSS1 styling so that the folds show up correctly for this browser, but
-they will not be openable without a foldcolumn.
->
- :let g:html_hover_unfold = 1
-<
- *g:html_id_expr*
-Default: ""
-Dynamic folding and jumping to line IDs rely on unique IDs within the document
-to work. If generated HTML is copied into a larger document, these IDs are no
-longer guaranteed to be unique. Set g:html_id_expr to an expression Vim can
-evaluate to get a unique string to append to each ID used in a given document,
-so that the full IDs will be unique even when combined with other content in a
-larger HTML document. Example, to append _ and the buffer number to each ID: >
-
- :let g:html_id_expr = '"_" .. bufnr("%")'
-<
-To append a string "_mystring" to the end of each ID: >
-
- :let g:html_id_expr = '"_mystring"'
-<
-Note: When converting a diff view to HTML, the expression will only be
-evaluated for the first window in the diff, and the result used for all the
-windows.
-
- *TOhtml-wrap-text* *g:html_pre_wrap*
-Default: Current 'wrap' setting.
-When 0, if |g:html_no_pre| is 0 or unset, the text in the generated HTML does
-not wrap at the edge of the browser window.
-When 1, if |g:html_use_css| is 1, the CSS 2.0 "white-space:pre-wrap" value is
-used, causing the text to wrap at whitespace at the edge of the browser
-window.
-Explicitly enable text wrapping: >
- :let g:html_pre_wrap = 1
-Explicitly disable wrapping: >
- :let g:html_pre_wrap = 0
-Go back to default, determine wrapping from 'wrap' setting: >
- :unlet g:html_pre_wrap
-<
- *g:html_no_pre*
-Default: 0.
-When 0, buffer text in the generated HTML is surrounded by <pre>...</pre>
-tags. Series of whitespace is shown as in Vim without special markup, and tab
-characters can be included literally (see |g:html_expand_tabs|).
-When 1 (not recommended), the <pre> tags are omitted, and a plain <div> is
-used instead. Whitespace is replaced by a series of &nbsp; character
-references, and <br> is used to end each line. This is another way to allow
-text in the generated HTML is wrap (see |g:html_pre_wrap|) which also works in
-old browsers, but may cause noticeable differences between Vim's display and
-the rendered page generated by 2html.vim.
->
- :let g:html_no_pre = 1
-<
- *g:html_no_doc*
-Default: 0.
-When 1 it doesn't generate a full HTML document with a DOCTYPE, <head>,
-<body>, etc. If |g:html_use_css| is enabled (the default) you'll have to
-define the CSS manually. The |g:html_dynamic_folds| and |g:html_line_ids|
-settings (off by default) also insert some JavaScript.
-
-
- *g:html_no_links*
-Default: 0.
-Don't generate <a> tags for text that looks like an URL.
-
- *g:html_no_modeline*
-Default: 0.
-Don't generate a modeline disabling folding.
-
- *g:html_expand_tabs*
-Default: 0 if 'tabstop' is 8, 'expandtab' is 0, 'vartabstop' is not in use,
- and no fold column or line numbers occur in the generated HTML;
- 1 otherwise.
-When 1, <Tab> characters in the buffer text are replaced with an appropriate
-number of space characters, or &nbsp; references if |g:html_no_pre| is 1.
-When 0, if |g:html_no_pre| is 0 or unset, <Tab> characters in the buffer text
-are included as-is in the generated HTML. This is useful for when you want to
-allow copy and paste from a browser without losing the actual whitespace in
-the source document. Note that this can easily break text alignment and
-indentation in the HTML, unless set by default.
-
-Force |2html.vim| to keep <Tab> characters: >
- :let g:html_expand_tabs = 0
-<
-Force tabs to be expanded: >
- :let g:html_expand_tabs = 1
-<
- *TOhtml-encoding-detect* *TOhtml-encoding*
-It is highly recommended to set your desired encoding with
-|g:html_use_encoding| for any content which will be placed on a web server.
-
-If you do not specify an encoding, |2html.vim| uses the preferred IANA name
-for the current value of 'fileencoding' if set, or 'encoding' if not.
-'encoding' is always used for certain 'buftype' values. 'fileencoding' will be
-set to match the chosen document encoding.
-
-Automatic detection works for the encodings mentioned specifically by name in
-|encoding-names|, but TOhtml will only automatically use those encodings with
-wide browser support. However, you can override this to support specific
-encodings that may not be automatically detected by default (see options
-below). See https://www.iana.org/assignments/character-sets for the IANA names.
-
-Note: By default all Unicode encodings are converted to UTF-8 with no BOM in
-the generated HTML, as recommended by W3C:
-
- https://www.w3.org/International/questions/qa-choosing-encodings
- https://www.w3.org/International/questions/qa-byte-order-mark
-
- *g:html_use_encoding*
-Default: none, uses IANA name for current 'fileencoding' as above.
-To overrule all automatic charset detection, set g:html_use_encoding to the
-name of the charset to be used. It is recommended to set this variable to
-something widely supported, like UTF-8, for anything you will be hosting on a
-webserver: >
- :let g:html_use_encoding = "UTF-8"
-You can also use this option to omit the line that specifies the charset
-entirely, by setting g:html_use_encoding to an empty string (NOT recommended): >
- :let g:html_use_encoding = ""
-To go back to the automatic mechanism, delete the |g:html_use_encoding|
-variable: >
- :unlet g:html_use_encoding
-<
- *g:html_encoding_override*
-Default: none, autoload/tohtml.vim contains default conversions for encodings
- mentioned by name at |encoding-names|.
-This option allows |2html.vim| to detect the correct 'fileencoding' when you
-specify an encoding with |g:html_use_encoding| which is not in the default
-list of conversions.
-
-This is a dictionary of charset-encoding pairs that will replace existing
-pairs automatically detected by TOhtml, or supplement with new pairs.
-
-Detect the HTML charset "windows-1252" as the encoding "8bit-cp1252": >
- :let g:html_encoding_override = {'windows-1252': '8bit-cp1252'}
-<
- *g:html_charset_override*
-Default: none, autoload/tohtml.vim contains default conversions for encodings
- mentioned by name at |encoding-names| and which have wide
- browser support.
-This option allows |2html.vim| to detect the HTML charset for any
-'fileencoding' or 'encoding' which is not detected automatically. You can also
-use it to override specific existing encoding-charset pairs. For example,
-TOhtml will by default use UTF-8 for all Unicode/UCS encodings. To use UTF-16
-and UTF-32 instead, use: >
- :let g:html_charset_override = {'ucs-4': 'UTF-32', 'utf-16': 'UTF-16'}
-
-Note that documents encoded in either UTF-32 or UTF-16 have known
-compatibility problems with some major browsers.
-
- *g:html_font*
-Default: "monospace"
-You can specify the font or fonts used in the converted document using
-g:html_font. If this option is set to a string, then the value will be
-surrounded with single quotes. If this option is set to a list then each list
-item is surrounded by single quotes and the list is joined with commas. Either
-way, "monospace" is added as the fallback generic family name and the entire
-result used as the font family (using CSS) or font face (if not using CSS).
-Examples: >
-
- " font-family: 'Consolas', monospace;
- :let g:html_font = "Consolas"
-
- " font-family: 'DejaVu Sans Mono', 'Consolas', monospace;
- :let g:html_font = ["DejaVu Sans Mono", "Consolas"]
-<
- *convert-to-XML* *convert-to-XHTML* *g:html_use_xhtml*
-Default: 0.
-When 0, generate standard HTML 4.01 (strict when possible).
-When 1, generate XHTML 1.0 instead (XML compliant HTML).
->
- :let g:html_use_xhtml = 1
-<
==============================================================================
5. Syntax file remarks *:syn-file-remarks*
@@ -964,27 +536,29 @@ An alternative is to switch to the C++ highlighting: >
Variable Highlight ~
*c_gnu* GNU gcc specific items
*c_comment_strings* strings and numbers inside a comment
-*c_space_errors* trailing white space and spaces before a <Tab>
-*c_no_trail_space_error* ... but no trailing spaces
+*c_space_errors* trailing white space and spaces before a <Tab>
+*c_no_trail_space_error* ... but no trailing spaces
*c_no_tab_space_error* ... but no spaces before a <Tab>
*c_no_bracket_error* don't highlight {}; inside [] as errors
*c_no_curly_error* don't highlight {}; inside [] and () as errors;
- except { and } in first column
- Default is to highlight them, otherwise you
- can't spot a missing ")".
+ ...except { and } in first column
+ Default is to highlight them, otherwise you
+ can't spot a missing ")".
*c_curly_error* highlight a missing } by finding all pairs; this
forces syncing from the start of the file, can be slow
*c_no_ansi* don't do standard ANSI types and constants
-*c_ansi_typedefs* ... but do standard ANSI types
+*c_ansi_typedefs* ... but do standard ANSI types
*c_ansi_constants* ... but do standard ANSI constants
*c_no_utf* don't highlight \u and \U in strings
-*c_syntax_for_h* for `*.h` files use C syntax instead of C++ and use objc
+*c_syntax_for_h* for `*.h` files use C syntax instead of C++ and use objc
syntax instead of objcpp
*c_no_if0* don't highlight "#if 0" blocks as comments
*c_no_cformat* don't highlight %-formats in strings
*c_no_c99* don't highlight C99 standard items
*c_no_c11* don't highlight C11 standard items
*c_no_bsd* don't highlight BSD specific types
+*c_functions* highlight function calls and definitions
+*c_function_pointers* highlight function pointers definitions
When 'foldmethod' is set to "syntax" then `/* */` comments and { } blocks will
become a fold. If you don't want comments to become a fold use: >
@@ -1233,7 +807,6 @@ there are very long lines in the file. To disable translations: >
Also see |diff-slow|.
-
DIRCOLORS *dircolors.vim* *ft-dircolors-syntax*
The dircolors utility highlighting definition has one option. It exists to
@@ -1289,12 +862,15 @@ Stack Overflow -
https://stackoverflow.com/questions/12407800/which-comment-style-should-i-use-in-batch-files
-To allow the use of the :: idiom for comments in the Windows Command
-Interpreter or working with MS-DOS bat files, set the
-dosbatch_colons_comment variable to anything: >
+To allow the use of the :: idiom for comments in command blocks with the
+Windows Command Interpreter set the dosbatch_colons_comment variable to
+anything: >
:let dosbatch_colons_comment = 1
+If this variable is set then a :: comment that is the last line in a command
+block will be highlighted as an error.
+
There is an option that covers whether `*.btm` files should be detected as type
"dosbatch" (MS-DOS batch files) or type "btm" (4DOS batch files). The latter
is used by default. You may select the former with the following line: >
@@ -1552,21 +1128,26 @@ edit F# or Fortran at all, use this in your startup vimrc: >
FORTRAN *fortran.vim* *ft-fortran-syntax*
Default highlighting and dialect ~
-Highlighting appropriate for Fortran 2008 is used by default. This choice
-should be appropriate for most users most of the time because Fortran 2008 is
-almost a superset of previous versions (Fortran 2003, 95, 90, and 77).
+Vim highlights according to Fortran 2023 (the most recent standard). This
+choice should be appropriate for most users most of the time because Fortran
+2023 is almost a superset of previous versions (Fortran 2018, 2008, 2003, 95,
+90, 77, and 66). A few legacy constructs deleted or declared obsolescent,
+respectively, in recent Fortran standards are highlighted as errors and todo
+items.
+
+The syntax script no longer supports Fortran dialects. The variable
+fortran_dialect is now silently ignored. Since computers are much faster now,
+the variable fortran_more_precise is no longer needed and is silently ignored.
Fortran source code form ~
Fortran code can be in either fixed or free source form. Note that the
syntax highlighting will not be correct if the form is incorrectly set.
-When you create a new fortran file, the syntax script assumes fixed source
+When you create a new Fortran file, the syntax script assumes fixed source
form. If you always use free source form, then >
:let fortran_free_source=1
-in your vimrc prior to the :syntax on command. If you always use fixed
-source form, then >
+If you always use fixed source form, then >
:let fortran_fixed_source=1
-in your vimrc prior to the :syntax on command.
If the form of the source code depends, in a non-standard way, upon the file
extension, then it is most convenient to set fortran_free_source in a ftplugin
@@ -1575,105 +1156,65 @@ will work only if the "filetype plugin indent on" command precedes the "syntax
on" command in your .vimrc file.
-When you edit an existing fortran file, the syntax script will assume free
+When you edit an existing Fortran file, the syntax script will assume free
source form if the fortran_free_source variable has been set, and assumes
-fixed source form if the fortran_fixed_source variable has been set. If
-neither of these variables have been set, the syntax script attempts to
+fixed source form if the fortran_fixed_source variable has been set. Suppose
+neither of these variables have been set. In that case, the syntax script attempts to
determine which source form has been used by examining the file extension
using conventions common to the ifort, gfortran, Cray, NAG, and PathScale
compilers (.f, .for, .f77 for fixed-source, .f90, .f95, .f03, .f08 for
-free-source). If none of this works, then the script examines the first five
-columns of the first 500 lines of your file. If no signs of free source form
-are detected, then the file is assumed to be in fixed source form. The
-algorithm should work in the vast majority of cases. In some cases, such as a
-file that begins with 500 or more full-line comments, the script may
-incorrectly decide that the fortran code is in fixed form. If that happens,
-just add a non-comment statement beginning anywhere in the first five columns
-of the first twenty-five lines, save (:w) and then reload (:e!) the file.
-
-Tabs in fortran files ~
+free-source). No default is used for the .fpp and .ftn file extensions because
+different compilers treat them differently. If none of this works, then the
+script examines the first five columns of the first 500 lines of your file. If
+no signs of free source form are detected, then the file is assumed to be in
+fixed source form. The algorithm should work in the vast majority of cases.
+In some cases, such as a file that begins with 500 or more full-line comments,
+the script may incorrectly decide that the code is in fixed form. If that
+happens, just add a non-comment statement beginning anywhere in the first five
+columns of the first twenty-five lines, save (:w), and then reload (:e!) the
+file.
+
+Vendor extensions ~
+Fixed-form Fortran requires a maximum line length of 72 characters but the
+script allows a maximum line length of 80 characters as do all compilers
+created in the last three decades. An even longer line length of 132
+characters is allowed if you set the variable fortran_extended_line_length
+with a command such as >
+ :let fortran_extended_line_length=1
+
+If you want additional highlighting of the CUDA Fortran extensions, you should
+set the variable fortran_CUDA with a command such as >
+ :let fortran_CUDA=1
+
+To activate recognition of some common, non-standard, vendor-supplied
+intrinsics, you should set the variable fortran_vendor_intrinsics with a
+command such as >
+ :let fortran_vendor_intrinsics=1
+
+Tabs in Fortran files ~
Tabs are not recognized by the Fortran standards. Tabs are not a good idea in
-fixed format fortran source code which requires fixed column boundaries.
+fixed format Fortran source code which requires fixed column boundaries.
Therefore, tabs are marked as errors. Nevertheless, some programmers like
-using tabs. If your fortran files contain tabs, then you should set the
+using tabs. If your Fortran files contain tabs, then you should set the
variable fortran_have_tabs in your vimrc with a command such as >
:let fortran_have_tabs=1
-placed prior to the :syntax on command. Unfortunately, the use of tabs will
-mean that the syntax file will not be able to detect incorrect margins.
+Unfortunately, the use of tabs will mean that the syntax file will not be able
+to detect incorrect margins.
-Syntax folding of fortran files ~
-If you wish to use foldmethod=syntax, then you must first set the variable
-fortran_fold with a command such as >
+Syntax folding of Fortran files ~
+Vim will fold your file using foldmethod=syntax, if you set the variable
+fortran_fold in your .vimrc with a command such as >
:let fortran_fold=1
to instruct the syntax script to define fold regions for program units, that
is main programs starting with a program statement, subroutines, function
-subprograms, block data subprograms, interface blocks, and modules. If you
-also set the variable fortran_fold_conditionals with a command such as >
+subprograms, modules, submodules, blocks of comment lines, and block data
+units. Block, interface, associate, critical, type definition, and change team
+constructs will also be folded. If you also set the variable
+fortran_fold_conditionals with a command such as >
:let fortran_fold_conditionals=1
-then fold regions will also be defined for do loops, if blocks, and select
-case constructs. If you also set the variable
-fortran_fold_multilinecomments with a command such as >
- :let fortran_fold_multilinecomments=1
-then fold regions will also be defined for three or more consecutive comment
-lines. Note that defining fold regions can be slow for large files.
-
-If fortran_fold, and possibly fortran_fold_conditionals and/or
-fortran_fold_multilinecomments, have been set, then vim will fold your file if
-you set foldmethod=syntax. Comments or blank lines placed between two program
-units are not folded because they are seen as not belonging to any program
-unit.
-
-More precise fortran syntax ~
-If you set the variable fortran_more_precise with a command such as >
- :let fortran_more_precise=1
-then the syntax coloring will be more precise but slower. In particular,
-statement labels used in do, goto and arithmetic if statements will be
-recognized, as will construct names at the end of a do, if, select or forall
-construct.
-
-Non-default fortran dialects ~
-The syntax script supports two Fortran dialects: f08 and F. You will probably
-find the default highlighting (f08) satisfactory. A few legacy constructs
-deleted or declared obsolescent in the 2008 standard are highlighted as todo
-items.
-
-If you use F, the advantage of setting the dialect appropriately is that
-other legacy features excluded from F will be highlighted as todo items and
-that free source form will be assumed.
-
-The dialect can be selected in various ways. If all your fortran files use
-the same dialect, set the global variable fortran_dialect in your vimrc prior
-to your syntax on statement. The case-sensitive, permissible values of
-fortran_dialect are "f08" or "F". Invalid values of fortran_dialect are
-ignored.
-
-If the dialect depends upon the file extension, then it is most convenient to
-set a buffer-local variable in a ftplugin file. For more information on
-ftplugin files, see |ftplugin|. For example, if all your fortran files with
-an .f90 extension are written in the F subset, your ftplugin file should
-contain the code >
- let s:extfname = expand("%:e")
- if s:extfname ==? "f90"
- let b:fortran_dialect="F"
- else
- unlet! b:fortran_dialect
- endif
-Note that this will work only if the "filetype plugin indent on" command
-precedes the "syntax on" command in your vimrc file.
-
-Finer control is necessary if the file extension does not uniquely identify
-the dialect. You can override the default dialect, on a file-by-file basis,
-by including a comment with the directive "fortran_dialect=xx" (where xx=F or
-f08) in one of the first three lines in your file. For example, your older .f
-files may be legacy code but your newer ones may be F codes, and you would
-identify the latter by including in the first three lines of those files a
-Fortran comment of the form >
- ! fortran_dialect=F
-
-For previous versions of the syntax, you may have set fortran_dialect to the
-now-obsolete values "f77", "f90", "f95", or "elf". Such settings will be
-silently handled as "f08". Users of "elf" may wish to experiment with "F"
-instead.
+then fold regions will also be defined for do loops, if blocks, select case,
+select type, and select rank constructs. Note that defining fold regions can
+be slow for large files.
The syntax/fortran.vim script contains embedded comments that tell you how to
comment and/or uncomment some lines to (a) activate recognition of some
@@ -1686,7 +1227,7 @@ Parenthesis checking does not catch too few closing parentheses. Hollerith
strings are not recognized. Some keywords may be highlighted incorrectly
because Fortran90 has no reserved words.
-For further information related to fortran, see |ft-fortran-indent| and
+For further information related to Fortran, see |ft-fortran-indent| and
|ft-fortran-plugin|.
FREEBASIC *freebasic.vim* *ft-freebasic-syntax*
@@ -2236,6 +1777,56 @@ have the following in your vimrc: >
let filetype_m = "mma"
+MODULA2 *modula2.vim* *ft-modula2-syntax*
+
+Vim will recognise comments with dialect tags to automatically select a given
+dialect.
+
+The syntax for a dialect tag comment is: >
+
+ taggedComment :=
+ '(*!' dialectTag '*)'
+ ;
+
+ dialectTag :=
+ m2pim | m2iso | m2r10
+ ;
+
+ reserved words
+ m2pim = 'm2pim', m2iso = 'm2iso', m2r10 = 'm2r10'
+
+A dialect tag comment is recognised by Vim if it occurs within the first 200
+lines of the source file. Only the very first such comment is recognised, any
+additional dialect tag comments are ignored.
+
+Example: >
+
+ DEFINITION MODULE FooLib; (*!m2pim*)
+ ...
+
+Variable g:modula2_default_dialect sets the default Modula-2 dialect when the
+dialect cannot be determined from the contents of the Modula-2 file: if
+defined and set to 'm2pim', the default dialect is PIM.
+
+Example: >
+
+ let g:modula2_default_dialect = 'm2pim'
+
+
+Highlighting is further configurable for each dialect via the following
+variables.
+
+Variable Highlight ~
+*modula2_iso_allow_lowline* allow low line in identifiers
+*modula2_iso_disallow_octals* disallow octal integer literals
+*modula2_iso_disallow_synonyms* disallow "@", "&" and "~" synonyms
+
+*modula2_pim_allow_lowline* allow low line in identifiers
+*modula2_pim_disallow_octals* disallow octal integer literals
+*modula2_pim_disallow_synonyms* disallow "&" and "~" synonyms
+
+*modula2_r10_allow_lowline* allow low line in identifiers
+
MOO *moo.vim* *ft-moo-syntax*
If you use C-style comments inside expressions and find it mangles your
@@ -2827,10 +2418,20 @@ To highlight R code in knitr chunk headers: >
let rmd_syn_hl_chunk = 1
By default, chunks of R code will be highlighted following the rules of R
-language. If you want proper syntax highlighting of chunks of other languages,
-you should add them to either `markdown_fenced_languages` or
-`rmd_fenced_languages`. For example to properly highlight both R and Python,
-you may add this to your |vimrc|: >
+language. Moreover, whenever the buffer is saved, Vim scans the buffer and
+highlights other languages if they are present in new chunks. LaTeX code also
+is automatically recognized and highlighted when the buffer is saved. This
+behavior can be controlled with the variables `rmd_dynamic_fenced_languages`,
+and `rmd_include_latex` whose valid values are: >
+ let rmd_dynamic_fenced_languages = 0 " No autodetection of languages
+ let rmd_dynamic_fenced_languages = 1 " Autodetection of languages
+ let rmd_include_latex = 0 " Don't highlight LaTeX code
+ let rmd_include_latex = 1 " Autodetect LaTeX code
+ let rmd_include_latex = 2 " Always include LaTeX highlighting
+
+If the value of `rmd_dynamic_fenced_languages` is 0, you still can set the
+list of languages whose chunks of code should be properly highlighted, as in
+the example: >
let rmd_fenced_languages = ['r', 'python']
@@ -5163,6 +4764,18 @@ guisp={color-name} *guisp*
Black White
Orange Purple Violet
+ Colors which define Nvim's default color scheme:
+ NvimDarkBlue NvimLightBlue
+ NvimDarkCyan NvimLightCyan
+ NvimDarkGreen NvimLightGreen
+ NvimDarkGrey1 NvimLightGrey1
+ NvimDarkGrey2 NvimLightGrey2
+ NvimDarkGrey3 NvimLightGrey3
+ NvimDarkGrey4 NvimLightGrey4
+ NvimDarkMagenta NvimLightMagenta
+ NvimDarkRed NvimLightRed
+ NvimDarkYellow NvimLightYellow
+
You can also specify a color by its RGB (red, green, blue) values.
The format is "#rrggbb", where
"rr" is the Red value
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index 9bdc6b8d24..5f33802ad5 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -17,25 +17,33 @@ changes. This documentation may also not fully reflect the latest changes.
==============================================================================
PARSER FILES *treesitter-parsers*
-Parsers are the heart of tree-sitter. They are libraries that tree-sitter will
+Parsers are the heart of treesitter. They are libraries that treesitter will
search for in the `parser` runtime directory. By default, Nvim bundles parsers
for C, Lua, Vimscript, Vimdoc and Treesitter query files, but parsers can be
-installed manually or via a plugin like
-https://github.com/nvim-treesitter/nvim-treesitter. Parsers are searched for
-as `parser/{lang}.*` in any 'runtimepath' directory. If multiple parsers for
-the same language are found, the first one is used. (This typically implies
-the priority "user config > plugins > bundled".
+installed via a plugin like https://github.com/nvim-treesitter/nvim-treesitter
+or even manually.
+
+Parsers are searched for as `parser/{lang}.*` in any 'runtimepath' directory.
+If multiple parsers for the same language are found, the first one is used.
+(NOTE: This typically implies the priority "user config > plugins > bundled".)
A parser can also be loaded manually using a full path: >lua
vim.treesitter.language.add('python', { path = "/path/to/python.so" })
<
+To associate certain |filetypes| with a treesitter language (name of parser),
+use |vim.treesitter.language.register()|. For example, to use the `xml`
+treesitter parser for buffers with filetype `svg` or `xslt`, use: >lua
+
+ vim.treesitter.language.register('xml', { 'svg', 'xslt' })
+<
+
==============================================================================
TREESITTER TREES *treesitter-tree*
*TSTree*
A "treesitter tree" represents the parsed contents of a buffer, which can be
used to perform further analysis. It is a |userdata| reference to an object
-held by the tree-sitter library.
+held by the treesitter library.
An instance `TSTree` of a treesitter tree supports the following methods.
@@ -51,7 +59,7 @@ TREESITTER NODES *treesitter-node*
A "treesitter node" represents one specific element of the parsed contents of
a buffer, which can be captured by a |Query| for, e.g., highlighting. It is
-a |userdata| reference to an object held by the tree-sitter library.
+a |userdata| reference to an object held by the treesitter library.
An instance `TSNode` of a treesitter node supports the following methods.
@@ -202,33 +210,53 @@ TREESITTER QUERY PREDICATES *treesitter-predicates*
Predicates are special scheme nodes that are evaluated to conditionally capture
nodes. For example, the `eq?` predicate can be used as follows: >query
- ((identifier) @foo (#eq? @foo "foo"))
+ ((identifier) @variable.builtin
+ (#eq? @variable.builtin "self"))
<
-to only match identifier corresponding to the `"foo"` text.
+to only match identifier corresponding to the `"self"` text. Such queries can
+be used to highlight built-in functions or variables differently, for instance.
The following predicates are built in:
`eq?` *treesitter-predicate-eq?*
Match a string against the text corresponding to a node: >query
- ((identifier) @foo (#eq? @foo "foo"))
+ ((identifier) @variable.builtin (#eq? @variable.builtin "self"))
((node1) @left (node2) @right (#eq? @left @right))
<
+ `any-eq?` *treesitter-predicate-any-eq?*
+ Like `eq?`, but for quantified patterns only one captured node must
+ match.
+
`match?` *treesitter-predicate-match?*
`vim-match?` *treesitter-predicate-vim-match?*
Match a |regexp| against the text corresponding to a node: >query
((identifier) @constant (#match? @constant "^[A-Z_]+$"))
-< Note: The `^` and `$` anchors will match the start and end of the
+<
+ Note: The `^` and `$` anchors will match the start and end of the
node's text.
+ `any-match?` *treesitter-predicate-any-match?*
+ `any-vim-match?` *treesitter-predicate-any-vim-match?*
+ Like `match?`, but for quantified patterns only one captured node must
+ match.
+
`lua-match?` *treesitter-predicate-lua-match?*
Match |lua-patterns| against the text corresponding to a node,
similar to `match?`
+ `any-lua-match?` *treesitter-predicate-any-lua-match?*
+ Like `lua-match?`, but for quantified patterns only one captured node
+ must match.
+
`contains?` *treesitter-predicate-contains?*
Match a string against parts of the text corresponding to a node: >query
((identifier) @foo (#contains? @foo "foo"))
((identifier) @foo-bar (#contains? @foo-bar "foo" "bar"))
<
+ `any-contains?` *treesitter-predicate-any-contains?*
+ Like `contains?`, but for quantified patterns only one captured node
+ must match.
+
`any-of?` *treesitter-predicate-any-of?*
Match any of the given strings against the text corresponding to
a node: >query
@@ -254,6 +282,32 @@ The following predicates are built in:
Each predicate has a `not-` prefixed predicate that is just the negation of
the predicate.
+ *lua-treesitter-all-predicate*
+ *lua-treesitter-any-predicate*
+Queries can use quantifiers to capture multiple nodes. When a capture contains
+multiple nodes, predicates match only if ALL nodes contained by the capture
+match the predicate. Some predicates (`eq?`, `match?`, `lua-match?`,
+`contains?`) accept an `any-` prefix to instead match if ANY of the nodes
+contained by the capture match the predicate.
+
+As an example, consider the following Lua code: >lua
+
+ -- TODO: This is a
+ -- very long
+ -- comment (just imagine it)
+<
+using the following predicated query:
+>query
+ (((comment)+ @comment)
+ (#match? @comment "TODO"))
+<
+This query will not match because not all of the nodes captured by @comment
+match the predicate. Instead, use:
+>query
+ (((comment)+ @comment)
+ (#any-match? @comment "TODO"))
+<
+
Further predicates can be added via |vim.treesitter.query.add_predicate()|.
Use |vim.treesitter.query.list_predicates()| to list all available predicates.
@@ -280,11 +334,12 @@ The following directives are built in:
Examples: >query
((identifier) @foo (#set! @foo "kind" "parameter"))
((node1) @left (node2) @right (#set! "type" "pair"))
+ ((codeblock) @markup.raw.block (#set! "priority" 90))
<
`offset!` *treesitter-directive-offset!*
Takes the range of the captured node and applies an offset. This will
- generate a new range object for the captured node as
- `metadata[capture_id].range`.
+ set a new `Range4` object for the captured node with `capture_id` as
+ `metadata[capture_id].range`. Useful for |treesitter-language-injections|.
Parameters: ~
{capture_id}
@@ -297,12 +352,13 @@ The following directives are built in:
((identifier) @constant (#offset! @constant 0 1 0 -1))
<
`gsub!` *treesitter-directive-gsub!*
- Transforms the content of the node using a Lua pattern. This will set
+ Transforms the content of the node using a |lua-pattern|. This will set
a new `metadata[capture_id].text`.
Parameters: ~
{capture_id}
{pattern}
+ {replacement}
Example: >query
(#gsub! @_node ".*%.(.*)" "%1")
@@ -344,13 +400,13 @@ currently supported modeline alternatives:
Note: These modeline comments must be at the top of the query, but can be
repeated, for example, the following two modeline blocks are both valid:
>query
- ;; inherits: foo,bar
+ ;; inherits: typescript,jsx
;; extends
<
>query
;; extends
;;
- ;; inherits: baz
+ ;; inherits: css
<
==============================================================================
TREESITTER SYNTAX HIGHLIGHTING *treesitter-highlight*
@@ -359,30 +415,47 @@ Syntax highlighting is specified through queries named `highlights.scm`,
which match a |TSNode| in the parsed |TSTree| to a `capture` that can be
assigned a highlight group. For example, the query >query
- (parameters (identifier) @parameter)
+ (parameters (identifier) @variable.parameter)
<
-matches any `identifier` node inside a function `parameter` node (e.g., the
-`bar` in `foo(bar)`) to the capture named `@parameter`. It is also possible to
-match literal expressions (provided the parser returns them): >query
+matches any `identifier` node inside a function `parameters` node to the
+capture named `@variable.parameter`. For example, for a Lua code >lua
- "return" @keyword.return
+ function f(foo, bar) end
+<
+which will be parsed as (see |:InspectTree|): >query
+
+ (function_declaration ; [1:1 - 24]
+ name: (identifier) ; [1:10 - 10]
+ parameters: (parameters ; [1:11 - 20]
+ name: (identifier) ; [1:12 - 14]
+ name: (identifier))) ; [1:17 - 19]
+<
+the above query will highlight `foo` and `bar` as `@variable.parameter`.
+
+It is also possible to match literal expressions (provided the parser returns
+them):
+>query
+ [
+ "if"
+ "else"
+ ] @keyword.conditional
<
Assuming a suitable parser and `highlights.scm` query is found in runtimepath,
treesitter highlighting for the current buffer can be enabled simply via
|vim.treesitter.start()|.
*treesitter-highlight-groups*
-The capture names, with `@` included, are directly usable as highlight groups.
+The capture names, prefixed with `@`, are directly usable as highlight groups.
For many commonly used captures, the corresponding highlight groups are linked
-to Nvim's standard |highlight-groups| by default but can be overridden in
-colorschemes.
+to Nvim's standard |highlight-groups| by default (e.g., `@comment` links to
+`Comment`) but can be overridden in colorschemes.
A fallback system is implemented, so that more specific groups fallback to
-more generic ones. For instance, in a language that has separate doc comments,
-`@comment.doc` could be used. If this group is not defined, the highlighting
-for an ordinary `@comment` is used. This way, existing color schemes already
-work out of the box, but it is possible to add more specific variants for
-queries that make them available.
+more generic ones. For instance, in a language that has separate doc comments
+(e.g., c, java, etc.), `@comment.documentation` could be used. If this group
+is not defined, the highlighting for an ordinary `@comment` is used. This way,
+existing color schemes already work out of the box, but it is possible to add
+more specific variants for queries that make them available.
As an additional rule, capture highlights can always be specialized by
language, by appending the language name after an additional dot. For
@@ -390,61 +463,119 @@ instance, to highlight comments differently per language: >vim
hi @comment.c guifg=Blue
hi @comment.lua guifg=DarkBlue
- hi link @comment.doc.java String
-<
-The following captures are linked by default to standard |group-name|s:
->
- @text.literal Comment
- @text.reference Identifier
- @text.title Title
- @text.uri Underlined
- @text.underline Underlined
- @text.todo Todo
-
- @comment Comment
- @punctuation Delimiter
-
- @constant Constant
- @constant.builtin Special
- @constant.macro Define
- @define Define
- @macro Macro
- @string String
- @string.escape SpecialChar
- @string.special SpecialChar
- @character Character
- @character.special SpecialChar
- @number Number
- @boolean Boolean
- @float Float
-
- @function Function
- @function.builtin Special
- @function.macro Macro
- @parameter Identifier
- @method Function
- @field Identifier
- @property Identifier
- @constructor Special
-
- @conditional Conditional
- @repeat Repeat
- @label Label
- @operator Operator
- @keyword Keyword
- @exception Exception
-
- @variable Identifier
- @type Type
- @type.definition Typedef
- @storageclass StorageClass
- @structure Structure
- @namespace Identifier
- @include Include
- @preproc PreProc
- @debug Debug
- @tag Tag
+ hi link @comment.documentation.java String
<
+The following is a list of standard captures used in queries for Nvim,
+highlighted according to the current colorscheme (use |:Inspect| on one to see
+the exact definition):
+
+@variable various variable names
+@variable.builtin built-in variable names (e.g. `this` / `self`)
+@variable.parameter parameters of a function
+@variable.member object and struct fields
+
+@constant constant identifiers
+@constant.builtin built-in constant values
+@constant.macro constants defined by the preprocessor
+
+@module modules or namespaces
+@module.builtin built-in modules or namespaces
+@label GOTO and other labels (e.g. `label:` in C), including heredoc labels
+
+@string string literals
+@string.documentation string documenting code (e.g. Python docstrings)
+@string.regexp regular expressions
+@string.escape escape sequences
+@string.special other special strings (e.g. dates)
+@string.special.symbol symbols or atoms
+@string.special.path filenames
+@string.special.url URIs (e.g. hyperlinks)
+
+@character character literals
+@character.special special characters (e.g. wildcards)
+
+@boolean boolean literals
+@number numeric literals
+@number.float floating-point number literals
+
+@type type or class definitions and annotations
+@type.builtin built-in types
+@type.definition identifiers in type definitions (e.g. `typedef <type> <identifier>` in C)
+@type.qualifier type qualifiers (e.g. `const`)
+
+@attribute attribute annotations (e.g. Python decorators)
+@property the key in key/value pairs
+
+@function function definitions
+@function.builtin built-in functions
+@function.call function calls
+@function.macro preprocessor macros
+
+@function.method method definitions
+@function.method.call method calls
+
+@constructor constructor calls and definitions
+@operator symbolic operators (e.g. `+` / `*`)
+
+@keyword keywords not fitting into specific categories
+@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.storage modifiers that affect storage in memory or life-time
+@keyword.repeat keywords related to loops (e.g. `for` / `while`)
+@keyword.return keywords like `return` and `yield`
+@keyword.debug keywords related to debugging
+@keyword.exception keywords related to exceptions (e.g. `throw` / `catch`)
+
+@keyword.conditional keywords related to conditionals (e.g. `if` / `else`)
+@keyword.conditional.ternary ternary operator (e.g. `?` / `:`)
+
+@keyword.directive various preprocessor directives and shebangs
+@keyword.directive.define preprocessor definition directives
+
+@punctuation.delimiter delimiters (e.g. `;` / `.` / `,`)
+@punctuation.bracket brackets (e.g. `()` / `{}` / `[]`)
+@punctuation.special special symbols (e.g. `{}` in string interpolation)
+
+@comment line and block comments
+@comment.documentation comments documenting code
+
+@comment.error error-type comments (e.g. `ERROR`, `FIXME`, `DEPRECATED`)
+@comment.warning warning-type comments (e.g. `WARNING`, `FIX`, `HACK`)
+@comment.todo todo-type comments (e.g. `TODO`, `WIP`, `FIXME`)
+@comment.note note-type comments (e.g. `NOTE`, `INFO`, `XXX`)
+
+@markup.strong bold text
+@markup.italic italic text
+@markup.strikethrough struck-through text
+@markup.underline underlined text (only for literal underline markup!)
+
+@markup.heading headings, titles (including markers)
+
+@markup.quote block quotes
+@markup.math math environments (e.g. `$ ... $` in LaTeX)
+@markup.environment environments (e.g. in LaTeX)
+
+@markup.link text references, footnotes, citations, etc.
+@markup.link.label link, reference descriptions
+@markup.link.url URL-style links
+
+@markup.raw literal or verbatim text (e.g. inline code)
+@markup.raw.block literal or verbatim text as a stand-alone block
+
+@markup.list list markers
+@markup.list.checked checked todo-style list markers
+@markup.list.unchecked unchecked todo-style list markers
+
+@diff.plus added text (for diff files)
+@diff.minus deleted text (for diff files)
+@diff.delta changed text (for diff files)
+
+@tag XML-style tag names (e.g. in XML, HTML, etc.)
+@tag.attribute XML-style tag attributes
+@tag.delimiter XML-style tag delimiters
+
*treesitter-highlight-spell*
The special `@spell` capture can be used to indicate that a node should be
spell checked by Nvim's builtin |spell| checker. For example, the following
@@ -475,7 +606,7 @@ Conceals specified in this way respect 'conceallevel'.
*treesitter-highlight-priority*
Treesitter uses |nvim_buf_set_extmark()| to set highlights with a default
priority of 100. This enables plugins to set a highlighting priority lower or
-higher than tree-sitter. It is also possible to change the priority of an
+higher than treesitter. It is also possible to change the priority of an
individual query pattern manually by setting its `"priority"` metadata
attribute: >query
@@ -536,17 +667,17 @@ associated with patterns:
VIM.TREESITTER *lua-treesitter*
The remainder of this document is a reference manual for the `vim.treesitter`
-Lua module, which is the main interface for Nvim's tree-sitter integration.
+Lua module, which is the main interface for Nvim's treesitter integration.
Most of the following content is automatically generated from the function
documentation.
*vim.treesitter.language_version*
-The latest parser ABI version that is supported by the bundled tree-sitter
+The latest parser ABI version that is supported by the bundled treesitter
library.
*vim.treesitter.minimum_language_version*
-The earliest parser ABI version that is supported by the bundled tree-sitter
+The earliest parser ABI version that is supported by the bundled treesitter
library.
==============================================================================
@@ -559,30 +690,20 @@ foldexpr({lnum}) *vim.treesitter.foldexpr()*
<
Parameters: ~
- • {lnum} (integer|nil) Line number to calculate fold level for
-
- Return: ~
- (string)
-
-foldtext() *vim.treesitter.foldtext()*
- Returns the highlighted content of the first line of the fold or falls
- back to |foldtext()| if no treesitter parser is found. Can be set directly
- to 'foldtext': >lua
- vim.wo.foldtext = 'v:lua.vim.treesitter.foldtext()'
-<
+ • {lnum} (`integer?`) Line number to calculate fold level for
Return: ~
- `{ [1]: string, [2]: string[] }[]` | string
+ (`string`)
*vim.treesitter.get_captures_at_cursor()*
get_captures_at_cursor({winnr})
Returns a list of highlight capture names under the cursor
Parameters: ~
- • {winnr} (integer|nil) Window handle or 0 for current window (default)
+ • {winnr} (`integer?`) Window handle or 0 for current window (default)
Return: ~
- string[] List of capture names
+ (`string[]`) List of capture names
*vim.treesitter.get_captures_at_pos()*
get_captures_at_pos({bufnr}, {row}, {col})
@@ -593,12 +714,13 @@ get_captures_at_pos({bufnr}, {row}, {col})
if none are defined).
Parameters: ~
- • {bufnr} (integer) Buffer number (0 for current buffer)
- • {row} (integer) Position row
- • {col} (integer) Position column
+ • {bufnr} (`integer`) Buffer number (0 for current buffer)
+ • {row} (`integer`) Position row
+ • {col} (`integer`) Position column
Return: ~
- table[] List of captures `{ capture = "name", metadata = { ... } }`
+ (`table[]`) List of captures
+ `{ capture = "name", metadata = { ... } }`
get_node({opts}) *vim.treesitter.get_node()*
Returns the smallest named node at the given position
@@ -610,45 +732,47 @@ get_node({opts}) *vim.treesitter.get_node()*
<
Parameters: ~
- • {opts} (table|nil) Optional keyword arguments:
- • bufnr integer|nil Buffer number (nil or 0 for current
+ • {opts} (`table?`) Optional keyword arguments:
+ • {bufnr} (`integer?`) Buffer number (nil or 0 for current
buffer)
- • pos table|nil 0-indexed (row, col) tuple. Defaults to cursor
- position in the current window. Required if {bufnr} is not
- the current buffer
- • ignore_injections boolean Ignore injected languages (default
- true)
+ • {pos} (`{ [1]: integer, [2]: integer }?`) 0-indexed (row,
+ col) tuple. Defaults to cursor position in the current
+ window. Required if {bufnr} is not the current buffer
+ • {lang} (`string?`) Parser language. (default: from buffer
+ filetype)
+ • {ignore_injections} (`boolean?`) Ignore injected languages
+ (default true)
Return: ~
- |TSNode| | nil Node at the given position
+ (`TSNode?`) Node at the given position
get_node_range({node_or_range}) *vim.treesitter.get_node_range()*
Returns the node's range or an unpacked range table
Parameters: ~
- • {node_or_range} (|TSNode| | table) Node or table of positions
+ • {node_or_range} (`TSNode|table`) Node or table of positions
Return (multiple): ~
- (integer) start_row
- (integer) start_col
- (integer) end_row
- (integer) end_col
+ (`integer`) start_row
+ (`integer`) start_col
+ (`integer`) end_row
+ (`integer`) end_col
*vim.treesitter.get_node_text()*
get_node_text({node}, {source}, {opts})
Gets the text corresponding to a given node
Parameters: ~
- • {node} |TSNode|
- • {source} (integer|string) Buffer or string from which the {node} is
+ • {node} (`TSNode`)
+ • {source} (`integer|string`) Buffer or string from which the {node} is
extracted
- • {opts} (table|nil) Optional parameters.
+ • {opts} (`table?`) Optional parameters.
• metadata (table) Metadata of a specific capture. This
would be set to `metadata[capture_id]` when using
|vim.treesitter.query.add_directive()|.
Return: ~
- (string)
+ (`string`)
get_parser({bufnr}, {lang}, {opts}) *vim.treesitter.get_parser()*
Returns the parser for a specific buffer and attaches it to the buffer
@@ -656,39 +780,39 @@ get_parser({bufnr}, {lang}, {opts}) *vim.treesitter.get_parser()*
If needed, this will create the parser.
Parameters: ~
- • {bufnr} (integer|nil) Buffer the parser should be tied to (default:
+ • {bufnr} (`integer?`) Buffer the parser should be tied to (default:
current buffer)
- • {lang} (string|nil) Filetype of this parser (default: buffer
+ • {lang} (`string?`) Language of this parser (default: from buffer
filetype)
- • {opts} (table|nil) Options to pass to the created language tree
+ • {opts} (`table?`) Options to pass to the created language tree
Return: ~
- |LanguageTree| object to use for parsing
+ (`vim.treesitter.LanguageTree`) object to use for parsing
get_range({node}, {source}, {metadata}) *vim.treesitter.get_range()*
Get the range of a |TSNode|. Can also supply {source} and {metadata} to
get the range with directives applied.
Parameters: ~
- • {node} |TSNode|
- • {source} integer|string|nil Buffer or string from which the {node}
+ • {node} (`TSNode`)
+ • {source} (`integer|string?`) Buffer or string from which the {node}
is extracted
- • {metadata} TSMetadata|nil
+ • {metadata} (`vim.treesitter.query.TSMetadata?`)
Return: ~
- (table)
+ (`Range6`)
*vim.treesitter.get_string_parser()*
get_string_parser({str}, {lang}, {opts})
Returns a string parser
Parameters: ~
- • {str} (string) Text to parse
- • {lang} (string) Language of this string
- • {opts} (table|nil) Options to pass to the created language tree
+ • {str} (`string`) Text to parse
+ • {lang} (`string`) Language of this string
+ • {opts} (`table?`) Options to pass to the created language tree
Return: ~
- |LanguageTree| object to use for parsing
+ (`vim.treesitter.LanguageTree`) object to use for parsing
inspect_tree({opts}) *vim.treesitter.inspect_tree()*
Open a window that displays a textual representation of the nodes in the
@@ -697,15 +821,15 @@ inspect_tree({opts}) *vim.treesitter.inspect_tree()*
While in the window, press "a" to toggle display of anonymous nodes, "I"
to toggle the display of the source language of each node, "o" to toggle
the query editor, and press <Enter> to jump to the node under the cursor
- in the source buffer.
+ in the source buffer. Folding also works (try |zo|, |zc|, etc.).
Can also be shown with `:InspectTree`. *:InspectTree*
Parameters: ~
- • {opts} (table|nil) Optional options table with the following possible
+ • {opts} (`table?`) Optional options table with the following possible
keys:
• lang (string|nil): The language of the source buffer. If
- omitted, the filetype of the source buffer is used.
+ omitted, detect from the filetype of the source buffer.
• bufnr (integer|nil): Buffer to draw the tree into. If
omitted, a new buffer is created.
• winid (integer|nil): Window id to display the tree buffer
@@ -722,33 +846,33 @@ is_ancestor({dest}, {source}) *vim.treesitter.is_ancestor()*
Determines whether a node is the ancestor of another
Parameters: ~
- • {dest} |TSNode| Possible ancestor
- • {source} |TSNode| Possible descendant
+ • {dest} (`TSNode`) Possible ancestor
+ • {source} (`TSNode`) Possible descendant
Return: ~
- (boolean) True if {dest} is an ancestor of {source}
+ (`boolean`) True if {dest} is an ancestor of {source}
*vim.treesitter.is_in_node_range()*
is_in_node_range({node}, {line}, {col})
Determines whether (line, col) position is in node range
Parameters: ~
- • {node} |TSNode| defining the range
- • {line} (integer) Line (0-based)
- • {col} (integer) Column (0-based)
+ • {node} (`TSNode`) defining the range
+ • {line} (`integer`) Line (0-based)
+ • {col} (`integer`) Column (0-based)
Return: ~
- (boolean) True if the position is in node range
+ (`boolean`) True if the position is in node range
node_contains({node}, {range}) *vim.treesitter.node_contains()*
Determines if a node contains a range
Parameters: ~
- • {node} |TSNode|
- • {range} (table)
+ • {node} (`TSNode`)
+ • {range} (`table`)
Return: ~
- (boolean) True if the {node} contains the {range}
+ (`boolean`) True if the {node} contains the {range}
start({bufnr}, {lang}) *vim.treesitter.start()*
Starts treesitter highlighting for a buffer
@@ -769,16 +893,16 @@ start({bufnr}, {lang}) *vim.treesitter.start()*
<
Parameters: ~
- • {bufnr} (integer|nil) Buffer to be highlighted (default: current
+ • {bufnr} (`integer?`) Buffer to be highlighted (default: current
buffer)
- • {lang} (string|nil) Language of the parser (default: buffer
+ • {lang} (`string?`) Language of the parser (default: from buffer
filetype)
stop({bufnr}) *vim.treesitter.stop()*
Stops treesitter highlighting for a buffer
Parameters: ~
- • {bufnr} (integer|nil) Buffer to stop highlighting (default: current
+ • {bufnr} (`integer?`) Buffer to stop highlighting (default: current
buffer)
@@ -792,29 +916,30 @@ add({lang}, {opts}) *vim.treesitter.language.add()*
{path}
Parameters: ~
- • {lang} (string) Name of the parser (alphanumerical and `_` only)
- • {opts} (table|nil) Options:
- • filetype (string|string[]) Default filetype the parser
- should be associated with. Defaults to {lang}.
- • path (string|nil) Optional path the parser is located at
- • symbol_name (string|nil) Internal symbol name for the
+ • {lang} (`string`) Name of the parser (alphanumerical and `_` only)
+ • {opts} (`table?`) Options:
+ • {filetype}? (`string|string[]`, default: {lang}) Default
+ filetype the parser should be associated with.
+ • {path}? (`string`) Optional path the parser is located at
+ • {symbol_name}? (`string`) Internal symbol name for the
language to load
get_filetypes({lang}) *vim.treesitter.language.get_filetypes()*
Get the filetypes associated with the parser named {lang}.
Parameters: ~
- • {lang} (string) Name of parser
+ • {lang} (`string`) Name of parser
Return: ~
- string[] filetypes
+ (`string[]`) filetypes
get_lang({filetype}) *vim.treesitter.language.get_lang()*
+
Parameters: ~
- • {filetype} (string)
+ • {filetype} (`string`)
Return: ~
- (string|nil)
+ (`string?`)
inspect({lang}) *vim.treesitter.language.inspect()*
Inspects the provided language.
@@ -823,55 +948,70 @@ inspect({lang}) *vim.treesitter.language.inspect()*
names, ...
Parameters: ~
- • {lang} (string) Language
+ • {lang} (`string`) Language
Return: ~
- (table)
+ (`table`)
register({lang}, {filetype}) *vim.treesitter.language.register()*
Register a parser named {lang} to be used for {filetype}(s).
+ Note: this adds or overrides the mapping for {filetype}, any existing
+ mappings from other filetypes to {lang} will be preserved.
+
Parameters: ~
- • {lang} (string) Name of parser
- • {filetype} string|string[] Filetype(s) to associate with lang
+ • {lang} (`string`) Name of parser
+ • {filetype} (`string|string[]`) Filetype(s) to associate with lang
==============================================================================
Lua module: vim.treesitter.query *lua-treesitter-query*
*vim.treesitter.query.add_directive()*
-add_directive({name}, {handler}, {force})
+add_directive({name}, {handler}, {opts})
Adds a new directive to be used in queries
Handlers can set match level data by setting directly on the metadata
- object `metadata.key = value`, additionally, handlers can set node level
+ object `metadata.key = value`. Additionally, handlers can set node level
data by using the capture id on the metadata table
`metadata[capture_id].key = value`
Parameters: ~
- • {name} (string) Name of the directive, without leading #
- • {handler} function(match:table<string,|TSNode|>, pattern:string,
- bufnr:integer, predicate:string[], metadata:table)
- • match: see |treesitter-query|
- • node-level data are accessible via `match[capture_id]`
-
- • pattern: see |treesitter-query|
+ • {name} (`string`) Name of the directive, without leading #
+ • {handler} (`function`)
+ • 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. `(node (#set! conceal "-"))` would get
the predicate `{ "#set!", "conceal", "-" }`
- • {force} (boolean|nil)
+ • {opts} (`table<string, any>`) Optional options:
+ • 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.
*vim.treesitter.query.add_predicate()*
-add_predicate({name}, {handler}, {force})
+add_predicate({name}, {handler}, {opts})
Adds a new predicate to be used in queries
Parameters: ~
- • {name} (string) Name of the predicate, without leading #
- • {handler} function(match:table<string,|TSNode|>, pattern:string,
- bufnr:integer, predicate:string[])
+ • {name} (`string`) Name of the predicate, without leading #
+ • {handler} (`function`)
• see |vim.treesitter.query.add_directive()| for argument
meanings
- • {force} (boolean|nil)
+ • {opts} (`table<string, any>`) Optional options:
+ • 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.
edit({lang}) *vim.treesitter.query.edit()*
Opens a live editor to query the buffer you started from.
@@ -884,31 +1024,33 @@ edit({lang}) *vim.treesitter.query.edit()*
`$VIMRUNTIME/queries/`.
Parameters: ~
- • {lang} (string|nil) language to open the query editor for. If
- omitted, inferred from the current buffer's filetype.
+ • {lang} (`string?`) language to open the query editor for. If omitted,
+ inferred from the current buffer's filetype.
get({lang}, {query_name}) *vim.treesitter.query.get()*
Returns the runtime query {query_name} for {lang}.
Parameters: ~
- • {lang} (string) Language to use for the query
- • {query_name} (string) Name of the query (e.g. "highlights")
+ • {lang} (`string`) Language to use for the query
+ • {query_name} (`string`) Name of the query (e.g. "highlights")
Return: ~
- Query|nil Parsed query
+ (`vim.treesitter.Query?`) Parsed query. `nil` if no query files are
+ found.
*vim.treesitter.query.get_files()*
get_files({lang}, {query_name}, {is_included})
Gets the list of files used to make up a query
Parameters: ~
- • {lang} (string) Language to get query for
- • {query_name} (string) Name of the query to load (e.g., "highlights")
- • {is_included} (boolean|nil) Internal parameter, most of the time left
+ • {lang} (`string`) Language to get query for
+ • {query_name} (`string`) Name of the query to load (e.g.,
+ "highlights")
+ • {is_included} (`boolean?`) Internal parameter, most of the time left
as `nil`
Return: ~
- string[] query_files List of files to load for given query and
+ (`string[]`) query_files List of files to load for given query and
language
lint({buf}, {opts}) *vim.treesitter.query.lint()*
@@ -916,34 +1058,34 @@ lint({buf}, {opts}) *vim.treesitter.query.lint()*
Use |treesitter-parsers| in runtimepath to check the query file in {buf}
for errors:
-
• verify that used nodes are valid identifiers in the grammar.
• verify that predicates and directives are valid.
• verify that top-level s-expressions are valid.
The found diagnostics are reported using |diagnostic-api|. By default, the
parser used for verification is determined by the containing folder of the
- query file, e.g., if the path ends in `/lua/highlights.scm` , the parser for the `lua` language will be used.
+ query file, e.g., if the path ends in `/lua/highlights.scm`, the parser
+ for the `lua` language will be used.
Parameters: ~
- • {buf} (integer) Buffer handle
- • {opts} (QueryLinterOpts|nil) Optional keyword arguments:
- • langs (string|string[]|nil) Language(s) to use for checking
+ • {buf} (`integer`) Buffer handle
+ • {opts} (`table?`) Optional keyword arguments:
+ • {langs}? (`string|string[]`) Language(s) to use for checking
the query. If multiple languages are specified, queries are
validated for all of them
- • clear (boolean) if `true`, just clear current lint errors
+ • {clear} (`boolean`) Just clear current lint errors
list_directives() *vim.treesitter.query.list_directives()*
Lists the currently available directives to use in queries.
Return: ~
- string[] List of supported directives.
+ (`string[]`) List of supported directives.
list_predicates() *vim.treesitter.query.list_predicates()*
Lists the currently available predicates to use in queries.
Return: ~
- string[] List of supported predicates.
+ (`string[]`) List of supported predicates.
omnifunc({findstart}, {base}) *vim.treesitter.query.omnifunc()*
Omnifunc for completing node names and predicates in treesitter queries.
@@ -952,24 +1094,32 @@ omnifunc({findstart}, {base}) *vim.treesitter.query.omnifunc()*
vim.bo.omnifunc = 'v:lua.vim.treesitter.query.omnifunc'
<
+ Parameters: ~
+ • {findstart} (`0|1`)
+ • {base} (`string`)
+
parse({lang}, {query}) *vim.treesitter.query.parse()*
Parse {query} as a string. (If the query is in a file, the caller should
read the contents into a string before calling).
- Returns a `Query` (see |lua-treesitter-query|) object which can be used to search nodes in
- the syntax tree for the patterns defined in {query} using `iter_*` methods below.
+ Returns a `Query` (see |lua-treesitter-query|) object which can be used to
+ search nodes in the syntax tree for the patterns defined in {query} using
+ the `iter_captures` and `iter_matches` methods.
Exposes `info` and `captures` with additional context about {query}.
• `captures` contains the list of unique capture names defined in {query}.
- -`info.captures` also points to `captures`.
+ • `info.captures` also points to `captures`.
• `info.patterns` contains information about predicates.
Parameters: ~
- • {lang} (string) Language to use for the query
- • {query} (string) Query in s-expr syntax
+ • {lang} (`string`) Language to use for the query
+ • {query} (`string`) Query in s-expr syntax
Return: ~
- Query Parsed query
+ (`vim.treesitter.Query`) Parsed query
+
+ See also: ~
+ • |vim.treesitter.query.get()|
*Query:iter_captures()*
Query:iter_captures({node}, {source}, {start}, {stop})
@@ -995,15 +1145,17 @@ Query:iter_captures({node}, {source}, {start}, {stop})
<
Parameters: ~
- • {node} |TSNode| under which the search will occur
- • {source} (integer|string) Source buffer or string to extract text
+ • {node} (`TSNode`) under which the search will occur
+ • {source} (`integer|string`) Source buffer or string to extract text
from
- • {start} (integer) Starting line for the search
- • {stop} (integer) Stopping line for the search (end-exclusive)
+ • {start} (`integer?`) Starting line for the search. Defaults to
+ `node:start()`.
+ • {stop} (`integer?`) Stopping line for the search (end-exclusive).
+ Defaults to `node:end_()`.
Return: ~
- (fun(end_line: integer|nil): integer, TSNode, TSMetadata): capture id,
- capture node, metadata
+ (`fun(end_line: integer?): integer, TSNode, vim.treesitter.query.TSMetadata`)
+ capture id, capture node, metadata
*Query:iter_matches()*
Query:iter_matches({node}, {source}, {start}, {stop}, {opts})
@@ -1012,35 +1164,48 @@ Query:iter_matches({node}, {source}, {start}, {stop}, {opts})
Iterate over all matches within a {node}. The arguments are the same as
for |Query:iter_captures()| but the iterated values are different: an
(1-based) index of the pattern in the query, a table mapping capture
- indices to nodes, and metadata from any directives processing the match.
- If the query has more than one pattern, the capture table might be sparse
- and e.g. `pairs()` method should be used over `ipairs`. Here is an example
- iterating over all captures in every match: >lua
- for pattern, match, metadata in cquery:iter_matches(tree:root(), bufnr, first, last) do
- for id, node in pairs(match) do
- local name = query.captures[id]
- -- `node` was captured by the `name` capture in the match
+ 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.
- local node_data = metadata[id] -- Node level metadata
+ Example: >lua
+ for pattern, match, metadata in cquery:iter_matches(tree:root(), bufnr, 0, -1, { all = true }) do
+ for id, nodes in pairs(match) do
+ local name = query.captures[id]
+ for _, node in ipairs(nodes) do
+ -- `node` was captured by the `name` capture in the match
- -- ... use the info here ...
+ local node_data = metadata[id] -- Node level metadata
+ ... use the info here ...
+ end
end
end
<
Parameters: ~
- • {node} |TSNode| under which the search will occur
- • {source} (integer|string) Source buffer or string to search
- • {start} (integer) Starting line for the search
- • {stop} (integer) Stopping line for the search (end-exclusive)
- • {opts} (table|nil) Options:
+ • {node} (`TSNode`) under which the search will occur
+ • {source} (`integer|string`) Source buffer or string to search
+ • {start} (`integer?`) Starting line for the search. Defaults to
+ `node:start()`.
+ • {stop} (`integer?`) Stopping line for the search (end-exclusive).
+ Defaults to `node:end_()`.
+ • {opts} (`table?`) Optional keyword arguments:
• 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. Requires treesitter >=
- 0.20.9.
+ traversing too deep into a tree.
+ • 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.
Return: ~
- (fun(): integer, table<integer,TSNode>, table): pattern id, match,
+ (`fun(): integer, table<integer, TSNode[]>, table`) pattern id, match,
metadata
set({lang}, {query_name}, {text}) *vim.treesitter.query.set()*
@@ -1050,49 +1215,44 @@ set({lang}, {query_name}, {text}) *vim.treesitter.query.set()*
by plugins.
Parameters: ~
- • {lang} (string) Language to use for the query
- • {query_name} (string) Name of the query (e.g., "highlights")
- • {text} (string) Query text (unparsed).
+ • {lang} (`string`) Language to use for the query
+ • {query_name} (`string`) Name of the query (e.g., "highlights")
+ • {text} (`string`) Query text (unparsed).
==============================================================================
Lua module: vim.treesitter.languagetree *lua-treesitter-languagetree*
-
-A *LanguageTree* contains a tree of parsers: the root treesitter parser
-for {lang} and any "injected" language parsers, which themselves may
-inject other languages, recursively. For example a Lua buffer containing
-some Vimscript commands needs multiple parsers to fully understand its
-contents.
+A *LanguageTree* contains a tree of parsers: the root treesitter parser for
+{lang} and any "injected" language parsers, which themselves may inject other
+languages, recursively. For example a Lua buffer containing some Vimscript
+commands needs multiple parsers to fully understand its contents.
To create a LanguageTree (parser object) for a given buffer and language, use: >lua
local parser = vim.treesitter.get_parser(bufnr, lang)
-
<
-(where `bufnr=0` means current buffer). `lang` defaults to 'filetype'.
-Note: currently the parser is retained for the lifetime of a buffer but
-this may change; a plugin should keep a reference to the parser object if
-it wants incremental updates.
+(where `bufnr=0` means current buffer). `lang` defaults to 'filetype'. Note:
+currently the parser is retained for the lifetime of a buffer but this may
+change; a plugin should keep a reference to the parser object if it wants
+incremental updates.
Whenever you need to access the current syntax tree, parse the buffer: >lua
local tree = parser:parse({ start_row, end_row })
-
<
-This returns a table of immutable |treesitter-tree| objects representing
-the current state of the buffer. When the plugin wants to access the state
-after a (possible) edit it must call `parse()` again. If the buffer wasn't
-edited, the same tree will be returned again without extra work. If the
-buffer was parsed before, incremental parsing will be done of the changed
-parts.
+This returns a table of immutable |treesitter-tree| objects representing the
+current state of the buffer. When the plugin wants to access the state after a
+(possible) edit it must call `parse()` again. If the buffer wasn't edited, the
+same tree will be returned again without extra work. If the buffer was parsed
+before, incremental parsing will be done of the changed parts.
+
+Note: To use the parser directly inside a |nvim_buf_attach()| Lua callback,
+you must call |vim.treesitter.get_parser()| before you register your callback.
+But preferably parsing shouldn't be done directly in the change callback
+anyway as they will be very frequent. Rather a plugin that does any kind of
+analysis on a tree should use a timer to throttle too frequent updates.
-Note: To use the parser directly inside a |nvim_buf_attach()| Lua
-callback, you must call |vim.treesitter.get_parser()| before you register
-your callback. But preferably parsing shouldn't be done directly in the
-change callback anyway as they will be very frequent. Rather a plugin that
-does any kind of analysis on a tree should use a timer to throttle too
-frequent updates.
LanguageTree:children() *LanguageTree:children()*
Returns a map of language to child tree.
@@ -1101,10 +1261,10 @@ LanguageTree:contains({range}) *LanguageTree:contains()*
Determines whether {range} is contained in the |LanguageTree|.
Parameters: ~
- • {range} (table) `{ start_line, start_col, end_line, end_col }`
+ • {range} (`Range4`) `{ start_line, start_col, end_line, end_col }`
Return: ~
- (boolean)
+ (`boolean`)
LanguageTree:destroy() *LanguageTree:destroy()*
Destroys this |LanguageTree| and all its children.
@@ -1120,32 +1280,33 @@ LanguageTree:for_each_tree({fn}) *LanguageTree:for_each_tree()*
Note: This includes the invoking tree's child trees as well.
Parameters: ~
- • {fn} fun(tree: TSTree, ltree: LanguageTree)
+ • {fn} (`fun(tree: TSTree, ltree: vim.treesitter.LanguageTree)`)
LanguageTree:included_regions() *LanguageTree:included_regions()*
- Gets the set of included regions managed by this LanguageTree . This can be different from the regions set by injection query, because a
- partial |LanguageTree:parse()| drops the regions outside the requested
- range.
+ Gets the set of included regions managed by this LanguageTree. This can be
+ different from the regions set by injection query, because a partial
+ |LanguageTree:parse()| drops the regions outside the requested range.
Return: ~
- table<integer, Range6[]>
+ (`table<integer, Range6[]>`)
LanguageTree:invalidate({reload}) *LanguageTree:invalidate()*
Invalidates this parser and all its children
Parameters: ~
- • {reload} (boolean|nil)
+ • {reload} (`boolean?`)
LanguageTree:is_valid({exclude_children}) *LanguageTree:is_valid()*
- Returns whether this LanguageTree is valid, i.e., |LanguageTree:trees()| reflects the latest state of the
- source. If invalid, user should call |LanguageTree:parse()|.
+ Returns whether this LanguageTree is valid, i.e., |LanguageTree:trees()|
+ reflects the latest state of the source. If invalid, user should call
+ |LanguageTree:parse()|.
Parameters: ~
- • {exclude_children} (boolean|nil) whether to ignore the validity of
+ • {exclude_children} (`boolean?`) whether to ignore the validity of
children (default `false`)
Return: ~
- (boolean)
+ (`boolean`)
LanguageTree:lang() *LanguageTree:lang()*
Gets the language of this tree node.
@@ -1155,23 +1316,23 @@ LanguageTree:language_for_range({range})
Gets the appropriate language that contains {range}.
Parameters: ~
- • {range} (table) `{ start_line, start_col, end_line, end_col }`
+ • {range} (`Range4`) `{ start_line, start_col, end_line, end_col }`
Return: ~
- |LanguageTree| Managing {range}
+ (`vim.treesitter.LanguageTree`) Managing {range}
*LanguageTree:named_node_for_range()*
LanguageTree:named_node_for_range({range}, {opts})
Gets the smallest named node that contains {range}.
Parameters: ~
- • {range} (table) `{ start_line, start_col, end_line, end_col }`
- • {opts} (table|nil) Optional keyword arguments:
+ • {range} (`Range4`) `{ start_line, start_col, end_line, end_col }`
+ • {opts} (`table?`) Optional keyword arguments:
• ignore_injections boolean Ignore injected languages
(default true)
Return: ~
- |TSNode| | nil Found node
+ (`TSNode?`) Found node
LanguageTree:parse({range}) *LanguageTree:parse()*
Recursively parse all regions in the language tree using
@@ -1184,23 +1345,24 @@ LanguageTree:parse({range}) *LanguageTree:parse()*
if {range} is `true`).
Parameters: ~
- • {range} boolean|Range|nil: Parse this range in the parser's source.
+ • {range} (`boolean|Range?`) Parse this range in the parser's source.
Set to `true` to run a complete parse of the source (Note:
Can be slow!) Set to `false|nil` to only parse regions with
empty ranges (typically only the root tree without
injections).
Return: ~
- table<integer, TSTree>
+ (`table<integer, TSTree>`)
*LanguageTree:register_cbs()*
LanguageTree:register_cbs({cbs}, {recursive})
Registers callbacks for the |LanguageTree|.
Parameters: ~
- • {cbs} (table) An |nvim_buf_attach()|-like table argument with
+ • {cbs} (`table`) An |nvim_buf_attach()|-like table argument with
the following handlers:
- • `on_bytes` : see |nvim_buf_attach()|, but this will be called after the parsers callback.
+ • `on_bytes` : see |nvim_buf_attach()|, but this will be
+ called after the parsers callback.
• `on_changedtree` : a callback that will be called every
time the tree has syntactical changes. It will be
passed two arguments: a table of the ranges (as node
@@ -1212,7 +1374,7 @@ LanguageTree:register_cbs({cbs}, {recursive})
• `on_detach` : emitted when the buffer is detached, see
|nvim_buf_detach_event|. Takes one argument, the number
of the buffer.
- • {recursive} (boolean|nil) Apply callbacks recursively for all
+ • {recursive} (`boolean?`) Apply callbacks recursively for all
children. Any new children will also inherit the
callbacks.
@@ -1224,21 +1386,23 @@ LanguageTree:tree_for_range({range}, {opts})
Gets the tree that contains {range}.
Parameters: ~
- • {range} (table) `{ start_line, start_col, end_line, end_col }`
- • {opts} (table|nil) Optional keyword arguments:
+ • {range} (`Range4`) `{ start_line, start_col, end_line, end_col }`
+ • {opts} (`table?`) Optional keyword arguments:
• ignore_injections boolean Ignore injected languages
(default true)
Return: ~
- TSTree|nil
+ (`TSTree?`)
LanguageTree:trees() *LanguageTree:trees()*
Returns all trees of the regions parsed by this parser. Does not include
child languages. The result is list-like if
- • this LanguageTree is the root, in which case the result is empty or a singleton list; or
+ • this LanguageTree is the root, in which case the result is empty or a
+ singleton list; or
• the root LanguageTree is fully parsed.
Return: ~
- table<integer, TSTree>
+ (`table<integer, TSTree>`)
+
vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl:
diff --git a/runtime/doc/ui.txt b/runtime/doc/ui.txt
index ab99b0446f..b8d47923ca 100644
--- a/runtime/doc/ui.txt
+++ b/runtime/doc/ui.txt
@@ -26,12 +26,12 @@ with these (optional) keys:
*ui-rgb*
- `rgb` Decides the color format.
- - true: (default) 24-bit RGB colors
- - false: Terminal colors (8-bit, max 256)
+ - true: (default) 24-bit RGB colors
+ - false: Terminal colors (8-bit, max 256)
*ui-override*
- `override` Decides how UI capabilities are resolved.
- - true: Enable requested UI capabilities, even if not
+ - true: Enable requested UI capabilities, even if not
supported by all connected UIs (including |TUI|).
- false: (default) Disable UI capabilities not
supported by all connected UIs (including TUI).
@@ -138,7 +138,7 @@ procedure:
to set |g:| variables visible to init.vim
3. If the UI wants to do additional setup after user config is loaded,
- register a VimEnter autocmd: >vim
+ register a VimEnter autocmd: >lua
nvim_command("autocmd VimEnter * call rpcrequest(1, 'vimenter')")
4. Now invoke |nvim_ui_attach()|. The UI must handle user input by now:
@@ -188,7 +188,7 @@ the editor.
`attr_id`: Cursor attribute id (defined by `hl_attr_define`).
When attr_id is 0, the background and foreground
colors should be swapped.
- `attr_id_lm`: Cursor attribute id for when 'langmap' is active.
+ `attr_id_lm`: Cursor attribute id for when |:lmap| is on.
`short_name`: Mode code name, see 'guicursor'.
`name`: Mode descriptive name.
`mouse_shape`: (To be implemented.)
@@ -228,6 +228,10 @@ the editor.
however a UI might still use such options when rendering raw text
sent from Nvim, like for |ui-cmdline|.
+["chdir", path] ~
+ The |current-directory| of the embedded Nvim process changed to
+ `path`.
+
["mode_change", mode, mode_idx] ~
Editor mode changed. The `mode` parameter is a string representing
the current mode. `mode_idx` is an index into the array emitted in
@@ -324,9 +328,11 @@ numerical highlight ids to the actual attributes.
`underdotted`: underdotted text. The dots have `special` color.
`underdashed`: underdashed text. The dashes have `special` color.
`altfont`: alternative font.
- `blend`: Blend level (0-100). Could be used by UIs to
+ `blend`: blend level (0-100). Could be used by UIs to
support blending floating windows to the
background or to signal a transparent cursor.
+ `url`: a URL associated with this highlight. UIs can
+ display this URL however they wish.
For absent color keys the default color should be used. Don't store
the default value in the table, rather a sentinel value, so that
@@ -555,7 +561,7 @@ with the following possible keys:
`kind`: always present. One of the following values:
"ui": Builtin UI highlight. |highlight-groups|
"syntax": Highlight applied to a buffer by a syntax declaration or
- other runtime/plugin functionality such as
+ other runtime/plugin functionality such as
|nvim_buf_add_highlight()|
"terminal": highlight from a process running in a |terminal-emulator|.
Contains no further semantic information.
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index e206a804f4..56750420e9 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -610,10 +610,13 @@ String manipulation: *string-functions*
toupper() turn a string to uppercase
charclass() class of a character
match() position where a pattern matches in a string
+ matchbufline() all the matches of a pattern in a buffer
matchend() position where a pattern match ends in a string
matchfuzzy() fuzzy matches a string in a list of strings
matchfuzzypos() fuzzy matches a string in a list of strings
matchstr() match of a pattern in a string
+ matchstrlist() all the matches of a pattern in a List of
+ strings
matchstrpos() match and positions of a pattern in a string
matchlist() like matchstr() and also return submatches
stridx() first index of a short string in a long string
@@ -662,6 +665,7 @@ List manipulation: *list-functions*
filter() remove selected items from a List
map() change each List item
mapnew() make a new List with changed items
+ foreach() apply function to List items
reduce() reduce a List to a value
slice() take a slice of a List
sort() sort a List
@@ -693,6 +697,7 @@ Dictionary manipulation: *dict-functions*
filter() remove selected entries from a Dictionary
map() change each Dictionary entry
mapnew() make a new Dictionary with changed items
+ foreach() apply function to Dictionary items
keys() get List of Dictionary keys
values() get List of Dictionary values
items() get List of Dictionary key-value pairs
@@ -788,6 +793,7 @@ Cursor and mark position: *cursor-functions* *mark-functions*
Working with text in the current buffer: *text-functions*
getline() get a line or list of lines from the buffer
+ getregion() get a region of text from the buffer
setline() replace a line in the buffer
append() append line or list of lines in the buffer
indent() indent of a specific line
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index cf9b3cf0e5..b0caf9fdaf 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -30,6 +30,11 @@ Defaults *nvim-defaults*
":filetype off" to |init.vim|.
- Syntax highlighting is enabled by default. This can be disabled by adding
":syntax off" to |init.vim|.
+- Default color scheme has been updated. This can result in color schemes
+ looking differently due to them relying on how highlight groups are defined
+ by default. Add ":colorscheme vim" to |init.vim| or
+ ":source $VIMRUNTIME/colors/vim.lua" to your color scheme file to restore
+ the old default links and colors.
- 'autoindent' is enabled
- 'autoread' is enabled (works in all UIs, including terminal)
@@ -73,6 +78,8 @@ Defaults *nvim-defaults*
- 'switchbuf' defaults to "uselast"
- 'tabpagemax' defaults to 50
- 'tags' defaults to "./tags;,tags"
+- 'termguicolors' is enabled by default if Nvim can detect support from the
+ host terminal
- 'ttimeoutlen' defaults to 50
- 'ttyfast' is always set
- 'undodir' defaults to ~/.local/state/nvim/undo// (|xdg|), auto-created
@@ -122,6 +129,8 @@ of these in your config by simply removing the mapping, e.g. ":unmap Y".
- <C-W> |i_CTRL-W-default|
- <C-L> |CTRL-L-default|
- & |&-default|
+- Q |v_Q-default|
+- @ |v_@-default|
- # |v_#-default|
- * |v_star-default|
- Nvim LSP client defaults |lsp-defaults|
@@ -136,6 +145,12 @@ nvim_terminal:
- BufReadCmd: Treats "term://" buffers as |terminal| buffers. |terminal-start|
- TermClose: A |terminal| buffer started with no arguments (which thus uses
'shell') and which exits with no error is closed automatically.
+- TermRequest: The terminal emulator responds to OSC background and foreground
+ requests, indicating (1) a black background and white foreground when Nvim
+ option 'background' is "dark" or (2) a white background and black foreground
+ when 'background' is "light". While this may not reflect the actual
+ foreground/background color, it permits 'background' to be retained for a
+ nested Nvim instance running in the terminal emulator.
nvim_cmdwin:
- CmdwinEnter: Limits syntax sync to maxlines=1 in the |cmdwin|.
@@ -312,7 +327,8 @@ Options:
'shortmess' "F" flag does not affect output from autocommands
'signcolumn' supports up to 9 dynamic/fixed columns
'statuscolumn' full control of columns using 'statusline' format
- 'tabline' %@Func@foo%X can call any function on mouse-click
+ 'tabline' middle-click on tabpage label closes tabpage,
+ and %@Func@foo%X can call any function on mouse-click
'termpastefilter'
'ttimeout', 'ttimeoutlen' behavior was simplified
'winblend' pseudo-transparency in floating windows |api-floatwin|
@@ -566,6 +582,9 @@ Autocommands:
- |TermResponse| is fired for any OSC sequence received from the terminal,
instead of the Primary Device Attributes response. |v:termresponse|
+Options:
+- |shm-q| fully hides macro recording message instead of only shortening it.
+
==============================================================================
Missing features *nvim-missing*
@@ -616,6 +635,7 @@ Commands:
:lcscope
:scscope
:Vimuntar
+ The old `:TOhtml`, replaced by a Lua version (contains many differences)
Compile-time features:
Emacs tags support
@@ -666,7 +686,7 @@ Options:
bioskey (MS-DOS)
conskey (MS-DOS)
*'cp'* *'nocompatible'* *'nocp'* *'compatible'* (Nvim is always "nocompatible".)
- 'cpoptions' (gjkHw<*- and all POSIX flags were removed)
+ 'cpoptions' (gjpkHw<*- and all POSIX flags were removed)
*'cryptmethod'* *'cm'* *'key'* (Vim encryption implementation)
cscopepathcomp
cscopeprg
diff --git a/runtime/doc/visual.txt b/runtime/doc/visual.txt
index 0d1ea937c0..a20fb6d31e 100644
--- a/runtime/doc/visual.txt
+++ b/runtime/doc/visual.txt
@@ -366,6 +366,20 @@ one of the last commands to extend the highlighted text, the repeating will
be applied up to the rightmost column of the longest line. Any count passed
to the `.` command is not used.
+Visual mode |default-mappings| "@" and "Q" can repeat commands in a register
+for all selected lines. See |v_@-default| and |v_Q-default| for details. For
+example, given the text:
+
+ 123(hello)321
+ 456(world)654
+ 456(NOT THIS)654
+
+With register "x" containing the commands `yi(VP`, Visually selecting the
+first two lines and typing `@x` produces:
+
+ hello
+ world
+ 456(NOT THIS)654
==============================================================================
7. Examples *visual-examples*
diff --git a/runtime/doc/vvars.txt b/runtime/doc/vvars.txt
new file mode 100644
index 0000000000..e71e31abf8
--- /dev/null
+++ b/runtime/doc/vvars.txt
@@ -0,0 +1,735 @@
+*vvars.txt* Nvim
+
+
+ NVIM REFERENCE MANUAL
+
+
+Predefined variables *vvars*
+
+Some variables can be set by the user, but the type cannot be changed.
+
+ Type |gO| to see the table of contents.
+
+ *v:argv* *argv-variable*
+v:argv
+ The command line arguments Vim was invoked with. This is a
+ list of strings. The first item is the Vim command.
+ See |v:progpath| for the command with full path.
+
+ *v:char* *char-variable*
+v:char
+ Argument for evaluating 'formatexpr' and used for the typed
+ character when using <expr> in an abbreviation |:map-<expr>|.
+ It is also used by the |InsertCharPre| and |InsertEnter| events.
+
+ *v:charconvert_from* *charconvert_from-variable*
+v:charconvert_from
+ The name of the character encoding of a file to be converted.
+ Only valid while evaluating the 'charconvert' option.
+
+ *v:charconvert_to* *charconvert_to-variable*
+v:charconvert_to
+ The name of the character encoding of a file after conversion.
+ Only valid while evaluating the 'charconvert' option.
+
+ *v:cmdarg* *cmdarg-variable*
+v:cmdarg
+ The extra arguments ("++p", "++enc=", "++ff=") given to a file
+ read/write command. This is set before an autocommand event
+ for a file read/write command is triggered. There is a
+ leading space to make it possible to append this variable
+ directly after the read/write command. Note: "+cmd" isn't
+ included here, because it will be executed anyway.
+
+ *v:cmdbang* *cmdbang-variable*
+v:cmdbang
+ Set like v:cmdarg for a file read/write command. When a "!"
+ was used the value is 1, otherwise it is 0. Note that this
+ can only be used in autocommands. For user commands |<bang>|
+ can be used.
+
+ *v:collate* *collate-variable*
+v:collate
+ The current locale setting for collation order of the runtime
+ environment. This allows Vim scripts to be aware of the
+ current locale encoding. Technical: it's the value of
+ LC_COLLATE. When not using a locale the value is "C".
+ This variable can not be set directly, use the |:language|
+ command.
+ See |multi-lang|.
+
+ *v:completed_item* *completed_item-variable*
+v:completed_item
+ Dictionary containing the most recent |complete-items| after
+ |CompleteDone|. Empty if the completion failed, or after
+ leaving and re-entering insert mode.
+ Note: Plugins can modify the value to emulate the builtin
+ |CompleteDone| event behavior.
+
+ *v:count* *count-variable*
+v:count
+ The count given for the last Normal mode command. Can be used
+ to get the count before a mapping. Read-only. Example: >vim
+ :map _x :<C-U>echo "the count is " .. v:count<CR>
+<
+ Note: The <C-U> is required to remove the line range that you
+ get when typing ':' after a count.
+ When there are two counts, as in "3d2w", they are multiplied,
+ just like what happens in the command, "d6w" for the example.
+ Also used for evaluating the 'formatexpr' option.
+
+ *v:count1* *count1-variable*
+v:count1
+ Just like "v:count", but defaults to one when no count is
+ used.
+
+ *v:ctype* *ctype-variable*
+v:ctype
+ The current locale setting for characters of the runtime
+ environment. This allows Vim scripts to be aware of the
+ current locale encoding. Technical: it's the value of
+ LC_CTYPE. When not using a locale the value is "C".
+ This variable can not be set directly, use the |:language|
+ command.
+ See |multi-lang|.
+
+ *v:dying* *dying-variable*
+v:dying
+ Normally zero. When a deadly signal is caught it's set to
+ one. When multiple signals are caught the number increases.
+ Can be used in an autocommand to check if Vim didn't
+ terminate normally.
+ Example: >vim
+ :au VimLeave * if v:dying | echo "\nAAAAaaaarrrggghhhh!!!\n" | endif
+<
+ Note: if another deadly signal is caught when v:dying is one,
+ VimLeave autocommands will not be executed.
+
+ *v:echospace* *echospace-variable*
+v:echospace
+ Number of screen cells that can be used for an `:echo` message
+ in the last screen line before causing the |hit-enter-prompt|.
+ Depends on 'showcmd', 'ruler' and 'columns'. You need to
+ check 'cmdheight' for whether there are full-width lines
+ available above the last line.
+
+ *v:errmsg* *errmsg-variable*
+v:errmsg
+ Last given error message.
+ Modifiable (can be set).
+ Example: >vim
+ let v:errmsg = ""
+ silent! next
+ if v:errmsg != ""
+ " ... handle error
+<
+
+ *v:errors* *errors-variable* *assert-return*
+v:errors
+ Errors found by assert functions, such as |assert_true()|.
+ This is a list of strings.
+ The assert functions append an item when an assert fails.
+ The return value indicates this: a one is returned if an item
+ was added to v:errors, otherwise zero is returned.
+ To remove old results make it empty: >vim
+ let v:errors = []
+<
+ If v:errors is set to anything but a list it is made an empty
+ list by the assert function.
+
+ *v:event* *event-variable*
+v:event
+ Dictionary of event data for the current |autocommand|. Valid
+ only during the event lifetime; storing or passing v:event is
+ invalid! Copy it instead: >vim
+ au TextYankPost * let g:foo = deepcopy(v:event)
+<
+ Keys vary by event; see the documentation for the specific
+ event, e.g. |DirChanged| or |TextYankPost|.
+ KEY DESCRIPTION ~
+ abort Whether the event triggered during
+ an aborting condition (e.g. |c_Esc| or
+ |c_CTRL-C| for |CmdlineLeave|).
+ chan |channel-id|
+ cmdlevel Level of cmdline.
+ cmdtype Type of cmdline, |cmdline-char|.
+ cwd Current working directory.
+ inclusive Motion is |inclusive|, else exclusive.
+ scope Event-specific scope name.
+ operator Current |operator|. Also set for Ex
+ commands (unlike |v:operator|). For
+ example if |TextYankPost| is triggered
+ by the |:yank| Ex command then
+ `v:event.operator` is "y".
+ regcontents Text stored in the register as a
+ |readfile()|-style list of lines.
+ regname Requested register (e.g "x" for "xyy)
+ or the empty string for an unnamed
+ operation.
+ regtype Type of register as returned by
+ |getregtype()|.
+ visual Selection is visual (as opposed to,
+ e.g., via motion).
+ completed_item Current selected complete item on
+ |CompleteChanged|, Is `{}` when no complete
+ item selected.
+ height Height of popup menu on |CompleteChanged|
+ width Width of popup menu on |CompleteChanged|
+ row Row count of popup menu on |CompleteChanged|,
+ relative to screen.
+ col Col count of popup menu on |CompleteChanged|,
+ relative to screen.
+ size Total number of completion items on
+ |CompleteChanged|.
+ scrollbar Is |v:true| if popup menu have scrollbar, or
+ |v:false| if not.
+ changed_window Is |v:true| if the event fired while
+ changing window (or tab) on |DirChanged|.
+ status Job status or exit code, -1 means "unknown". |TermClose|
+
+ *v:exception* *exception-variable*
+v:exception
+ The value of the exception most recently caught and not
+ finished. See also |v:throwpoint| and |throw-variables|.
+ Example: >vim
+ try
+ throw "oops"
+ catch /.*/
+ echo "caught " .. v:exception
+ endtry
+<
+ Output: "caught oops".
+
+ *v:exiting* *exiting-variable*
+v:exiting
+ Exit code, or |v:null| before invoking the |VimLeavePre|
+ and |VimLeave| autocmds. See |:q|, |:x| and |:cquit|.
+ Example: >vim
+ :au VimLeave * echo "Exit value is " .. v:exiting
+<
+
+ *v:false* *false-variable*
+v:false
+ Special value used to put "false" in JSON and msgpack. See
+ |json_encode()|. This value is converted to "v:false" when used
+ as a String (e.g. in |expr5| with string concatenation
+ operator) and to zero when used as a Number (e.g. in |expr5|
+ or |expr7| when used with numeric operators). Read-only.
+
+ *v:fcs_choice* *fcs_choice-variable*
+v:fcs_choice
+ What should happen after a |FileChangedShell| event was
+ triggered. Can be used in an autocommand to tell Vim what to
+ do with the affected buffer:
+ reload Reload the buffer (does not work if
+ the file was deleted).
+ edit Reload the buffer and detect the
+ values for options such as
+ 'fileformat', 'fileencoding', 'binary'
+ (does not work if the file was
+ deleted).
+ ask Ask the user what to do, as if there
+ was no autocommand. Except that when
+ only the timestamp changed nothing
+ will happen.
+ <empty> Nothing, the autocommand should do
+ everything that needs to be done.
+ The default is empty. If another (invalid) value is used then
+ Vim behaves like it is empty, there is no warning message.
+
+ *v:fcs_reason* *fcs_reason-variable*
+v:fcs_reason
+ The reason why the |FileChangedShell| event was triggered.
+ Can be used in an autocommand to decide what to do and/or what
+ to set v:fcs_choice to. Possible values:
+ deleted file no longer exists
+ conflict file contents, mode or timestamp was
+ changed and buffer is modified
+ changed file contents has changed
+ mode mode of file changed
+ time only file timestamp changed
+
+ *v:fname* *fname-variable*
+v:fname
+ When evaluating 'includeexpr': the file name that was
+ detected. Empty otherwise.
+
+ *v:fname_diff* *fname_diff-variable*
+v:fname_diff
+ The name of the diff (patch) file. Only valid while
+ evaluating 'patchexpr'.
+
+ *v:fname_in* *fname_in-variable*
+v:fname_in
+ The name of the input file. Valid while evaluating:
+ option used for ~
+ 'charconvert' file to be converted
+ 'diffexpr' original file
+ 'patchexpr' original file
+ And set to the swap file name for |SwapExists|.
+
+ *v:fname_new* *fname_new-variable*
+v:fname_new
+ The name of the new version of the file. Only valid while
+ evaluating 'diffexpr'.
+
+ *v:fname_out* *fname_out-variable*
+v:fname_out
+ The name of the output file. Only valid while
+ evaluating:
+ option used for ~
+ 'charconvert' resulting converted file [1]
+ 'diffexpr' output of diff
+ 'patchexpr' resulting patched file
+ [1] When doing conversion for a write command (e.g., ":w
+ file") it will be equal to v:fname_in. When doing conversion
+ for a read command (e.g., ":e file") it will be a temporary
+ file and different from v:fname_in.
+
+ *v:folddashes* *folddashes-variable*
+v:folddashes
+ Used for 'foldtext': dashes representing foldlevel of a closed
+ fold.
+ Read-only in the |sandbox|. |fold-foldtext|
+
+ *v:foldend* *foldend-variable*
+v:foldend
+ Used for 'foldtext': last line of closed fold.
+ Read-only in the |sandbox|. |fold-foldtext|
+
+ *v:foldlevel* *foldlevel-variable*
+v:foldlevel
+ Used for 'foldtext': foldlevel of closed fold.
+ Read-only in the |sandbox|. |fold-foldtext|
+
+ *v:foldstart* *foldstart-variable*
+v:foldstart
+ Used for 'foldtext': first line of closed fold.
+ Read-only in the |sandbox|. |fold-foldtext|
+
+ *v:hlsearch* *hlsearch-variable*
+v:hlsearch
+ Variable that indicates whether search highlighting is on.
+ Setting it makes sense only if 'hlsearch' is enabled. Setting
+ this variable to zero acts like the |:nohlsearch| command,
+ setting it to one acts like >vim
+ let &hlsearch = &hlsearch
+<
+ Note that the value is restored when returning from a
+ function. |function-search-undo|.
+
+ *v:insertmode* *insertmode-variable*
+v:insertmode
+ Used for the |InsertEnter| and |InsertChange| autocommand
+ events. Values:
+ i Insert mode
+ r Replace mode
+ v Virtual Replace mode
+
+ *v:key* *key-variable*
+v:key
+ Key of the current item of a |Dictionary|. Only valid while
+ evaluating the expression used with |map()| and |filter()|.
+ Read-only.
+
+ *v:lang* *lang-variable*
+v:lang
+ The current locale setting for messages of the runtime
+ environment. This allows Vim scripts to be aware of the
+ current language. Technical: it's the value of LC_MESSAGES.
+ The value is system dependent.
+ This variable can not be set directly, use the |:language|
+ command.
+ It can be different from |v:ctype| when messages are desired
+ in a different language than what is used for character
+ encoding. See |multi-lang|.
+
+ *v:lc_time* *lc_time-variable*
+v:lc_time
+ The current locale setting for time messages of the runtime
+ environment. This allows Vim scripts to be aware of the
+ current language. Technical: it's the value of LC_TIME.
+ This variable can not be set directly, use the |:language|
+ command. See |multi-lang|.
+
+ *v:lnum* *lnum-variable*
+v:lnum
+ Line number for the 'foldexpr' |fold-expr|, 'formatexpr',
+ 'indentexpr' and 'statuscolumn' expressions, tab page number
+ for 'guitablabel' and 'guitabtooltip'. Only valid while one of
+ these expressions is being evaluated. Read-only when in the
+ |sandbox|.
+
+ *v:lua* *lua-variable*
+v:lua
+ Prefix for calling Lua functions from expressions.
+ See |v:lua-call| for more information.
+
+ *v:maxcol* *maxcol-variable*
+v:maxcol
+ Maximum line length. Depending on where it is used it can be
+ screen columns, characters or bytes. The value currently is
+ 2147483647 on all systems.
+
+ *v:mouse_col* *mouse_col-variable*
+v:mouse_col
+ Column number for a mouse click obtained with |getchar()|.
+ This is the screen column number, like with |virtcol()|. The
+ value is zero when there was no mouse button click.
+
+ *v:mouse_lnum* *mouse_lnum-variable*
+v:mouse_lnum
+ Line number for a mouse click obtained with |getchar()|.
+ This is the text line number, not the screen line number. The
+ value is zero when there was no mouse button click.
+
+ *v:mouse_win* *mouse_win-variable*
+v:mouse_win
+ Window number for a mouse click obtained with |getchar()|.
+ First window has number 1, like with |winnr()|. The value is
+ zero when there was no mouse button click.
+
+ *v:mouse_winid* *mouse_winid-variable*
+v:mouse_winid
+ |window-ID| for a mouse click obtained with |getchar()|.
+ The value is zero when there was no mouse button click.
+
+ *v:msgpack_types* *msgpack_types-variable*
+v:msgpack_types
+ Dictionary containing msgpack types used by |msgpackparse()|
+ and |msgpackdump()|. All types inside dictionary are fixed
+ (not editable) empty lists. To check whether some list is one
+ of msgpack types, use |is| operator.
+
+ *v:null* *null-variable*
+v:null
+ Special value used to put "null" in JSON and NIL in msgpack.
+ See |json_encode()|. This value is converted to "v:null" when
+ used as a String (e.g. in |expr5| with string concatenation
+ operator) and to zero when used as a Number (e.g. in |expr5|
+ or |expr7| when used with numeric operators). Read-only.
+ In some places `v:null` can be used for a List, Dict, etc.
+ that is not set. That is slightly different than an empty
+ List, Dict, etc.
+
+ *v:numbermax* *numbermax-variable*
+v:numbermax Maximum value of a number.
+
+ *v:numbermin* *numbermin-variable*
+v:numbermin Minimum value of a number (negative).
+
+ *v:numbersize* *numbersize-variable*
+v:numbersize
+ Number of bits in a Number. This is normally 64, but on some
+ systems it may be 32.
+
+ *v:oldfiles* *oldfiles-variable*
+v:oldfiles
+ List of file names that is loaded from the |shada| file on
+ startup. These are the files that Vim remembers marks for.
+ The length of the List is limited by the ' argument of the
+ 'shada' option (default is 100).
+ When the |shada| file is not used the List is empty.
+ Also see |:oldfiles| and |c_#<|.
+ The List can be modified, but this has no effect on what is
+ stored in the |shada| file later. If you use values other
+ than String this will cause trouble.
+
+ *v:operator* *operator-variable*
+v:operator
+ The last operator given in Normal mode. This is a single
+ character except for commands starting with <g> or <z>,
+ in which case it is two characters. Best used alongside
+ |v:prevcount| and |v:register|. Useful if you want to cancel
+ Operator-pending mode and then use the operator, e.g.: >vim
+ :omap O <Esc>:call MyMotion(v:operator)<CR>
+<
+ The value remains set until another operator is entered, thus
+ don't expect it to be empty.
+ v:operator is not set for |:delete|, |:yank| or other Ex
+ commands.
+ Read-only.
+
+ *v:option_command* *option_command-variable*
+v:option_command
+ Command used to set the option. Valid while executing an
+ |OptionSet| autocommand.
+ value option was set via ~
+ "setlocal" |:setlocal| or `:let l:xxx`
+ "setglobal" |:setglobal| or `:let g:xxx`
+ "set" |:set| or |:let|
+ "modeline" |modeline|
+
+ *v:option_new* *option_new-variable*
+v:option_new
+ New value of the option. Valid while executing an |OptionSet|
+ autocommand.
+
+ *v:option_old* *option_old-variable*
+v:option_old
+ Old value of the option. Valid while executing an |OptionSet|
+ autocommand. Depending on the command used for setting and the
+ kind of option this is either the local old value or the
+ global old value.
+
+ *v:option_oldglobal* *option_oldglobal-variable*
+v:option_oldglobal
+ Old global value of the option. Valid while executing an
+ |OptionSet| autocommand.
+
+ *v:option_oldlocal* *option_oldlocal-variable*
+v:option_oldlocal
+ Old local value of the option. Valid while executing an
+ |OptionSet| autocommand.
+
+ *v:option_type* *option_type-variable*
+v:option_type
+ Scope of the set command. Valid while executing an
+ |OptionSet| autocommand. Can be either "global" or "local"
+
+ *v:prevcount* *prevcount-variable*
+v:prevcount
+ The count given for the last but one Normal mode command.
+ This is the v:count value of the previous command. Useful if
+ you want to cancel Visual or Operator-pending mode and then
+ use the count, e.g.: >vim
+ :vmap % <Esc>:call MyFilter(v:prevcount)<CR>
+<
+ Read-only.
+
+ *v:profiling* *profiling-variable*
+v:profiling
+ Normally zero. Set to one after using ":profile start".
+ See |profiling|.
+
+ *v:progname* *progname-variable*
+v:progname
+ The name by which Nvim was invoked (with path removed).
+ Read-only.
+
+ *v:progpath* *progpath-variable*
+v:progpath
+ Absolute path to the current running Nvim.
+ Read-only.
+
+ *v:register* *register-variable*
+v:register
+ The name of the register in effect for the current normal mode
+ command (regardless of whether that command actually used a
+ register). Or for the currently executing normal mode mapping
+ (use this in custom commands that take a register).
+ If none is supplied it is the default register '"', unless
+ 'clipboard' contains "unnamed" or "unnamedplus", then it is
+ "*" or '+'.
+ Also see |getreg()| and |setreg()|
+
+ *v:relnum* *relnum-variable*
+v:relnum
+ Relative line number for the 'statuscolumn' expression.
+ Read-only.
+
+ *v:scrollstart* *scrollstart-variable*
+v:scrollstart
+ String describing the script or function that caused the
+ screen to scroll up. It's only set when it is empty, thus the
+ first reason is remembered. It is set to "Unknown" for a
+ typed command.
+ This can be used to find out why your script causes the
+ hit-enter prompt.
+
+ *v:searchforward* *searchforward-variable*
+v:searchforward
+ Search direction: 1 after a forward search, 0 after a
+ backward search. It is reset to forward when directly setting
+ the last search pattern, see |quote/|.
+ Note that the value is restored when returning from a
+ function. |function-search-undo|.
+ Read-write.
+
+ *v:servername* *servername-variable*
+v:servername
+ Primary listen-address of Nvim, the first item returned by
+ |serverlist()|. Usually this is the named pipe created by Nvim
+ at |startup| or given by |--listen| (or the deprecated
+ |$NVIM_LISTEN_ADDRESS| env var).
+
+ See also |serverstart()| |serverstop()|.
+ Read-only.
+
+ *$NVIM*
+ $NVIM is set by |terminal| and |jobstart()|, and is thus
+ a hint that the current environment is a subprocess of Nvim.
+ Example: >vim
+ if $NVIM
+ echo nvim_get_chan_info(v:parent)
+ endif
+<
+
+ Note the contents of $NVIM may change in the future.
+
+ *v:shell_error* *shell_error-variable*
+v:shell_error
+ Result of the last shell command. When non-zero, the last
+ shell command had an error. When zero, there was no problem.
+ This only works when the shell returns the error code to Vim.
+ The value -1 is often used when the command could not be
+ executed. Read-only.
+ Example: >vim
+ !mv foo bar
+ if v:shell_error
+ echo 'could not rename "foo" to "bar"!'
+ endif
+<
+
+ *v:statusmsg* *statusmsg-variable*
+v:statusmsg
+ Last given status message.
+ Modifiable (can be set).
+
+ *v:stderr* *stderr-variable*
+v:stderr
+ |channel-id| corresponding to stderr. The value is always 2;
+ use this variable to make your code more descriptive.
+ Unlike stdin and stdout (see |stdioopen()|), stderr is always
+ open for writing. Example: >vim
+ :call chansend(v:stderr, "error: toaster empty\n")
+<
+
+ *v:swapchoice* *swapchoice-variable*
+v:swapchoice
+ |SwapExists| autocommands can set this to the selected choice
+ for handling an existing swapfile:
+ 'o' Open read-only
+ 'e' Edit anyway
+ 'r' Recover
+ 'd' Delete swapfile
+ 'q' Quit
+ 'a' Abort
+ The value should be a single-character string. An empty value
+ results in the user being asked, as would happen when there is
+ no SwapExists autocommand. The default is empty.
+
+ *v:swapcommand* *swapcommand-variable*
+v:swapcommand
+ Normal mode command to be executed after a file has been
+ opened. Can be used for a |SwapExists| autocommand to have
+ another Vim open the file and jump to the right place. For
+ example, when jumping to a tag the value is ":tag tagname\r".
+ For ":edit +cmd file" the value is ":cmd\r".
+
+ *v:swapname* *swapname-variable*
+v:swapname
+ Name of the swapfile found.
+ Only valid during |SwapExists| event.
+ Read-only.
+
+ *v:t_blob* *t_blob-variable* *v:t_TYPE*
+v:t_blob Value of |Blob| type. Read-only. See: |type()|
+
+ *v:t_bool* *t_bool-variable*
+v:t_bool Value of |Boolean| type. Read-only. See: |type()|
+
+ *v:t_dict* *t_dict-variable*
+v:t_dict Value of |Dictionary| type. Read-only. See: |type()|
+
+ *v:t_float* *t_float-variable*
+v:t_float Value of |Float| type. Read-only. See: |type()|
+
+ *v:t_func* *t_func-variable*
+v:t_func Value of |Funcref| type. Read-only. See: |type()|
+
+ *v:t_list* *t_list-variable*
+v:t_list Value of |List| type. Read-only. See: |type()|
+
+ *v:t_number* *t_number-variable*
+v:t_number Value of |Number| type. Read-only. See: |type()|
+
+ *v:t_string* *t_string-variable*
+v:t_string Value of |String| type. Read-only. See: |type()|
+
+ *v:termrequest* *termrequest-variable*
+v:termrequest
+ The value of the most recent OSC or DCS control sequence
+ sent from a process running in the embedded |terminal|.
+ This can be read in a |TermRequest| event handler to respond
+ to queries from embedded applications.
+
+ *v:termresponse* *termresponse-variable*
+v:termresponse
+ The value of the most recent OSC or DCS control sequence
+ received by Nvim from the terminal. This can be read in a
+ |TermResponse| event handler after querying the terminal using
+ another escape sequence.
+
+ *v:testing* *testing-variable*
+v:testing Must be set before using `test_garbagecollect_now()`.
+
+ *v:this_session* *this_session-variable*
+v:this_session
+ Full filename of the last loaded or saved session file.
+ Empty when no session file has been saved. See |:mksession|.
+ Modifiable (can be set).
+
+ *v:throwpoint* *throwpoint-variable*
+v:throwpoint
+ The point where the exception most recently caught and not
+ finished was thrown. Not set when commands are typed. See
+ also |v:exception| and |throw-variables|.
+ Example: >vim
+ try
+ throw "oops"
+ catch /.*/
+ echo "Exception from" v:throwpoint
+ endtry
+<
+ Output: "Exception from test.vim, line 2"
+
+ *v:true* *true-variable*
+v:true
+ Special value used to put "true" in JSON and msgpack. See
+ |json_encode()|. This value is converted to "v:true" when used
+ as a String (e.g. in |expr5| with string concatenation
+ operator) and to one when used as a Number (e.g. in |expr5| or
+ |expr7| when used with numeric operators). Read-only.
+
+ *v:val* *val-variable*
+v:val
+ Value of the current item of a |List| or |Dictionary|. Only
+ valid while evaluating the expression used with |map()| and
+ |filter()|. Read-only.
+
+ *v:version* *version-variable*
+v:version
+ Vim version number: major version times 100 plus minor
+ version. Vim 5.0 is 500, Vim 5.1 is 501.
+ Read-only.
+ Use |has()| to check the Nvim (not Vim) version: >vim
+ :if has("nvim-0.2.1")
+<
+
+ *v:vim_did_enter* *vim_did_enter-variable*
+v:vim_did_enter
+ 0 during startup, 1 just before |VimEnter|.
+ Read-only.
+
+ *v:virtnum* *virtnum-variable*
+v:virtnum
+ Virtual line number for the 'statuscolumn' expression.
+ Negative when drawing the status column for virtual lines, zero
+ when drawing an actual buffer line, and positive when drawing
+ the wrapped part of a buffer line.
+ Read-only.
+
+ *v:warningmsg* *warningmsg-variable*
+v:warningmsg
+ Last given warning message.
+ Modifiable (can be set).
+
+ *v:windowid* *windowid-variable*
+v:windowid
+ Application-specific window "handle" which may be set by any
+ attached UI. Defaults to zero.
+ Note: For Nvim |windows| use |winnr()| or |win_getid()|, see
+ |window-ID|.
+
+ vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt
index d6fce89f23..b71e7c80ab 100644
--- a/runtime/doc/windows.txt
+++ b/runtime/doc/windows.txt
@@ -242,9 +242,10 @@ and 'winminwidth' are relevant.
*:hor* *:horizontal*
:hor[izontal] {cmd}
Execute {cmd}. Currently only makes a difference for
- `horizontal wincmd =`, which will equalize windows only
- horizontally, and |:terminal|, which will open a |terminal|
- buffer in a split window.
+ the following commands:
+ - `:wincmd =`: equalize windows only horizontally.
+ - |:terminal|: open a |terminal| buffer in a split window.
+ - |:checkhealth|: open a healthcheck buffer in a split window.
:lefta[bove] {cmd} *:lefta* *:leftabove*
:abo[veleft] {cmd} *:abo* *:aboveleft*
diff --git a/runtime/ftplugin/aap.vim b/runtime/ftplugin/aap.vim
index df839c99ae..cd7e2a425e 100644
--- a/runtime/ftplugin/aap.vim
+++ b/runtime/ftplugin/aap.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Aap recipe
" Maintainer: The Vim Project <https://github.com/vim/vim>
-" Last Change: 2023 Aug 10
+" Last Change: 2024 Jan 14
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" Only do this when not done yet for this buffer
@@ -28,6 +28,11 @@ setlocal commentstring=#\ %s
setlocal expandtab
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Aap Recipe Files (*.aap)\t*.aap\nAll Files (*.*)\t*.*\n"
+ let b:browsefilter = "Aap Recipe Files (*.aap)\t*.aap\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/abap.vim b/runtime/ftplugin/abap.vim
index 61db8093fb..8b2040e5aa 100644
--- a/runtime/ftplugin/abap.vim
+++ b/runtime/ftplugin/abap.vim
@@ -3,7 +3,8 @@
" Author: Steven Oliver <oliver.steven@gmail.com>
" Copyright: Copyright (c) 2013 Steven Oliver
" License: You may redistribute this under the same terms as Vim itself
-" Last Change: 2023 Aug 28 by Vim Project (undo_ftplugin)
+" Last Change: 2023 Aug 28 by Vim Project (undo_ftplugin)
+" 2024 Jan 14 by Vim Project (browsefilter)
" --------------------------------------------------------------------------
" Only do this when not done yet for this buffer
@@ -21,10 +22,14 @@ setlocal suffixesadd=.abap
let b:undo_ftplugin = "setl sts< sua< sw<"
" Windows allows you to filter the open file dialog
-if has("gui_win32") && !exists("b:browsefilter")
- let b:browsefilter = "ABAP Source Files (*.abap)\t*.abap\n" .
- \ "All Files (*.*)\t*.*\n"
- let b:undo_ftplugin .= " | unlet! b:browsefilter"
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
+ let b:browsefilter = "ABAP Source Files (*.abap)\t*.abap\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
+ let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/abaqus.vim b/runtime/ftplugin/abaqus.vim
index 5931cd921d..c16e7b032e 100644
--- a/runtime/ftplugin/abaqus.vim
+++ b/runtime/ftplugin/abaqus.vim
@@ -2,6 +2,7 @@
" Language: Abaqus finite element input file (www.abaqus.com)
" Maintainer: Carl Osterwisch <costerwi@gmail.com>
" Last Change: 2022 Oct 08
+" 2024 Jan 14 by Vim Project (browsefilter)
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin") | finish | endif
@@ -49,8 +50,12 @@ endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "Abaqus Input Files (*.inp *.inc)\t*.inp;*.inc\n" .
\ "Abaqus Results (*.dat)\t*.dat\n" .
- \ "Abaqus Messages (*.pre *.msg *.sta)\t*.pre;*.msg;*.sta\n" .
- \ "All Files (*.*)\t*.*\n"
+ \ "Abaqus Messages (*.pre, *.msg, *.sta)\t*.pre;*.msg;*.sta\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin .= "|unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/ant.vim b/runtime/ftplugin/ant.vim
index aee07ca4b9..65e01a1a76 100644
--- a/runtime/ftplugin/ant.vim
+++ b/runtime/ftplugin/ant.vim
@@ -1,10 +1,11 @@
" Vim filetype plugin file
-" Language: ant
+" Language: ant
"
" This runtime file is looking for a new maintainer.
"
" Former maintainer: Dan Sharp
-" Last Changed: 20 Jan 2009
+" Last Change: 2009 Jan 20
+" 2024 Jan 14 by Vim Project (browsefilter)
if exists("b:did_ftplugin") | finish | endif
@@ -15,8 +16,12 @@ set cpo-=C
" Define some defaults in case the included ftplugins don't set them.
let s:undo_ftplugin = ""
-let s:browsefilter = "XML Files (*.xml)\t*.xml\n" .
- \ "All Files (*.*)\t*.*\n"
+let s:browsefilter = "XML Files (*.xml)\t*.xml\n"
+if has("win32")
+ let s:browsefilter .= "All Files (*.*)\t*\n"
+else
+ let s:browsefilter .= "All Files (*)\t*\n"
+endif
runtime! ftplugin/xml.vim ftplugin/xml_*.vim ftplugin/xml/*.vim
let b:did_ftplugin = 1
@@ -30,7 +35,7 @@ if exists("b:browsefilter")
endif
" Change the :browse e filter to primarily show Ant-related files.
-if has("gui_win32")
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "Build Files (build.xml)\tbuild.xml\n" .
\ "Java Files (*.java)\t*.java\n" .
\ "Properties Files (*.prop*)\t*.prop*\n" .
diff --git a/runtime/ftplugin/asciidoc.vim b/runtime/ftplugin/asciidoc.vim
new file mode 100644
index 0000000000..5974e28dc2
--- /dev/null
+++ b/runtime/ftplugin/asciidoc.vim
@@ -0,0 +1,67 @@
+" Vim filetype plugin file
+" Original Author: Maxim Kim <habamax@gmail.com>
+" Language: asciidoc
+" Maintainer: Luca Saccarola <github.e41mv@aleeas.com>
+" Last Change: 2024 Jan 16
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
+
+if exists('b:undo_ftplugin')
+ let b:undo_ftplugin .= "|setl cms< com< fo< flp< inex< efm< cfu< fde< fdm<"
+else
+ let b:undo_ftplugin = "setl cms< com< fo< flp< inex< efm< cfu< fde< fdm<"
+endif
+
+" gf to open include::file.ext[] and link:file.ext[] files
+setlocal includeexpr=substitute(v:fname,'\\(link:\\\|include::\\)\\(.\\{-}\\)\\[.*','\\2','g')
+
+setlocal comments=
+setlocal commentstring=//\ %s
+
+setlocal formatoptions+=cqn
+setlocal formatlistpat=^\\s*[\\[({]\\?\\([0-9]\\+
+setlocal formatlistpat+=\\\|[a-zA-Z]\\)[\\]:.)}]\\s\\+
+setlocal formatlistpat+=\\\|^\\s*-\\s\\+
+setlocal formatlistpat+=\\\|^\\s*[*]\\+\\s\\+
+setlocal formatlistpat+=\\\|^\\s*[.]\\+\\s\\+
+
+function AsciidocFold()
+ let line = getline(v:lnum)
+
+ if (v:lnum == 1) && (line =~ '^----*$')
+ return ">1"
+ endif
+
+ let nested = get(g:, "asciidoc_foldnested", 1)
+
+ " Regular headers
+ let depth = match(line, '\(^=\+\)\@<=\( .*$\)\@=')
+
+ " Do not fold nested regular headers
+ if depth > 1 && !nested
+ let depth = 1
+ endif
+
+ if depth > 0
+ " fold all sections under title
+ if depth > 1 && !get(g:, "asciidoc_fold_under_title", 1)
+ let depth -= 1
+ endif
+ " check syntax, it should be asciidocTitle or asciidocH
+ let syncode = synstack(v:lnum, 1)
+ if len(syncode) > 0 && synIDattr(syncode[0], 'name') =~ 'asciidoc\%(H[1-6]\)\|Title'
+ return ">" . depth
+ endif
+ endif
+
+ return "="
+endfunction
+
+if has("folding") && get(g:, 'asciidoc_folding', 0)
+ setlocal foldexpr=AsciidocFold()
+ setlocal foldmethod=expr
+ let b:undo_ftplugin .= "|setl foldexpr< foldmethod< foldtext<"
+endif
diff --git a/runtime/ftplugin/aspvbs.vim b/runtime/ftplugin/aspvbs.vim
index 70a130d287..6979bb8f84 100644
--- a/runtime/ftplugin/aspvbs.vim
+++ b/runtime/ftplugin/aspvbs.vim
@@ -1,10 +1,11 @@
" Vim filetype plugin file
-" Language: aspvbs
+" Language: aspvbs
"
" This runtime file is looking for a new maintainer.
"
" Former maintainer: Dan Sharp
-" Last Changed: 20 Jan 2009
+" Last Change: 2009 Jan 20
+" 2024 Jan 14 by Vim Project (browsefilter)
if exists("b:did_ftplugin") | finish | endif
@@ -15,8 +16,12 @@ set cpo-=C
" Define some defaults in case the included ftplugins don't set them.
let s:undo_ftplugin = ""
-let s:browsefilter = "HTML Files (*.html, *.htm)\t*.htm*\n" .
- \ "All Files (*.*)\t*.*\n"
+let s:browsefilter = "HTML Files (*.html, *.htm)\t*.htm*\n"
+if has("win32")
+ let s:browsefilter .= "All Files (*.*)\t*\n"
+else
+ let s:browsefilter .= "All Files (*)\t*\n"
+endif
let s:match_words = ""
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
@@ -51,7 +56,7 @@ if exists("loaded_matchit")
endif
" Change the :browse e filter to primarily show ASP-related files.
-if has("gui_win32")
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter="ASP Files (*.asp)\t*.asp\n" . s:browsefilter
endif
diff --git a/runtime/ftplugin/awk.vim b/runtime/ftplugin/awk.vim
index 40fe304cf4..bcd772350a 100644
--- a/runtime/ftplugin/awk.vim
+++ b/runtime/ftplugin/awk.vim
@@ -2,7 +2,7 @@
" Language: awk, nawk, gawk, mawk
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Antonio Colombo <azc100@gmail.com>
-" Last Change: 2020 Sep 28
+" Last Change: 2024 Jan 14
" This plugin was prepared by Mark Sikora
" This plugin was updated as proposed by Doug Kearns
@@ -25,8 +25,7 @@ setlocal formatoptions-=t formatoptions+=croql
setlocal define=function
setlocal suffixesadd+=.awk
-let b:undo_ftplugin = "setl fo< com< cms< def< sua<" .
- \ " | unlet! b:browsefilter"
+let b:undo_ftplugin = "setl fo< com< cms< def< sua<"
" TODO: set this in scripts.vim?
if exists("g:awk_is_gawk")
@@ -49,8 +48,13 @@ if exists("g:awk_is_gawk")
endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Awk Source Files (*.awk,*.gawk)\t*.awk;*.gawk\n" .
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Awk Source Files (*.awk, *.gawk)\t*.awk;*.gawk\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
+ let b:undo_ftplugin .= " | unlet! b:browsefilter"
endif
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/basic.vim b/runtime/ftplugin/basic.vim
index 4399fbf3ad..32f713b43e 100644
--- a/runtime/ftplugin/basic.vim
+++ b/runtime/ftplugin/basic.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: BASIC (QuickBASIC 4.5)
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2022 Jun 22
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -45,8 +45,12 @@ endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "BASIC Source Files (*.bas)\t*.bas\n" ..
- \ "BASIC Include Files (*.bi, *.bm)\t*.bi;*.bm\n" ..
- \ "All Files (*.*)\t*.*\n"
+ \ "BASIC Include Files (*.bi, *.bm)\t*.bi;*.bm\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
let b:basic_set_browsefilter = 1
let b:undo_ftplugin ..= " | unlet! b:browsefilter b:basic_set_browsefilter"
endif
diff --git a/runtime/ftplugin/c.vim b/runtime/ftplugin/c.vim
index 83fb9ead68..716b454675 100644
--- a/runtime/ftplugin/c.vim
+++ b/runtime/ftplugin/c.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: C
" Maintainer: The Vim Project <https://github.com/vim/vim>
-" Last Change: 2023 Aug 10
+" Last Change: 2023 Aug 22
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" Only do this when not done yet for this buffer
@@ -43,24 +43,26 @@ if !exists("b:match_words")
let b:undo_ftplugin ..= " | unlet! b:match_skip b:match_words"
endif
-" Win32 can filter files in the browse dialog
+" Win32 and GTK can filter files in the browse dialog
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
if &ft == "cpp"
- let b:browsefilter = "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" .
- \ "C Header Files (*.h)\t*.h\n" .
- \ "C Source Files (*.c)\t*.c\n" .
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "C++ Source Files (*.cpp, *.c++)\t*.cpp;*.c++\n" ..
+ \ "C Header Files (*.h)\t*.h\n" ..
+ \ "C Source Files (*.c)\t*.c\n"
elseif &ft == "ch"
- let b:browsefilter = "Ch Source Files (*.ch *.chf)\t*.ch;*.chf\n" .
- \ "C Header Files (*.h)\t*.h\n" .
- \ "C Source Files (*.c)\t*.c\n" .
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Ch Source Files (*.ch, *.chf)\t*.ch;*.chf\n" ..
+ \ "C Header Files (*.h)\t*.h\n" ..
+ \ "C Source Files (*.c)\t*.c\n"
else
- let b:browsefilter = "C Source Files (*.c)\t*.c\n" .
- \ "C Header Files (*.h)\t*.h\n" .
- \ "Ch Source Files (*.ch *.chf)\t*.ch;*.chf\n" .
- \ "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" .
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "C Source Files (*.c)\t*.c\n" ..
+ \ "C Header Files (*.h)\t*.h\n" ..
+ \ "Ch Source Files (*.ch, *.chf)\t*.ch;*.chf\n" ..
+ \ "C++ Source Files (*.cpp, *.c++)\t*.cpp;*.c++\n"
+ endif
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
endif
let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/clojure.vim b/runtime/ftplugin/clojure.vim
index c922d75699..4da7554d85 100644
--- a/runtime/ftplugin/clojure.vim
+++ b/runtime/ftplugin/clojure.vim
@@ -6,6 +6,7 @@
" URL: https://github.com/clojure-vim/clojure.vim
" License: Vim (see :h license)
" Last Change: 2022-03-24
+" 2024 Jan 14 by Vim Project (browsefilter)
if exists("b:did_ftplugin")
finish
@@ -66,10 +67,14 @@ endif
" Filter files in the browse dialog
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "All Files\t*\n" .
- \ "Clojure Files\t*.clj;*.cljc;*.cljs;*.cljx\n" .
+ let b:browsefilter = "Clojure Files\t*.clj;*.cljc;*.cljs;*.cljx\n" .
\ "EDN Files\t*.edn\n" .
\ "Java Files\t*.java\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin .= ' | unlet! b:browsefilter'
endif
diff --git a/runtime/ftplugin/cobol.vim b/runtime/ftplugin/cobol.vim
index ec1e95456d..5e52702fd5 100644
--- a/runtime/ftplugin/cobol.vim
+++ b/runtime/ftplugin/cobol.vim
@@ -3,6 +3,7 @@
" Maintainer: Ankit Jain <ajatkj@yahoo.co.in>
" (formerly Tim Pope <vimNOSPAM@tpope.info>)
" Last Update: By Ankit Jain (add gtk support) on 15.08.2020
+" 2024 Jan 14 by Vim Project (browsefilter)
" Insert mode mappings: <C-T> <C-D> <Tab>
" Normal mode mappings: < > << >> [[ ]] [] ][
@@ -39,8 +40,12 @@ endif
" add gtk support
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "COBOL Source Files (*.cbl, *.cob)\t*.cbl;*.cob;*.lib\n".
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "COBOL Source Files (*.cbl, *.cob)\t*.cbl;*.cob;*.lib\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
endif
let b:undo_ftplugin = "setlocal com< cms< fo< et< tw<" .
diff --git a/runtime/ftplugin/config.vim b/runtime/ftplugin/config.vim
index 73136cbc66..595fc657b9 100644
--- a/runtime/ftplugin/config.vim
+++ b/runtime/ftplugin/config.vim
@@ -1,10 +1,11 @@
" Vim filetype plugin file
-" Language: config
+" Language: config
"
" This runtime file is looking for a new maintainer.
"
" Former maintainer: Dan Sharp
-" Last Changed: 20 Jan 2009
+" Last Change: 2009 Jan 20
+" 2024 Jan 14 by Vim Project (browsefilter)
if exists("b:did_ftplugin") | finish | endif
@@ -15,8 +16,12 @@ set cpo-=C
" Define some defaults in case the included ftplugins don't set them.
let s:undo_ftplugin = ""
-let s:browsefilter = "Bourne Shell Files (*.sh)\t*.sh\n" .
- \ "All Files (*.*)\t*.*\n"
+let s:browsefilter = "Bourne Shell Files (*.sh)\t*.sh\n"
+if has("win32")
+ let s:browsefilter .= "All Files (*.*)\t*\n"
+else
+ let s:browsefilter .= "All Files (*)\t*\n"
+endif
let s:match_words = ""
runtime! ftplugin/sh.vim ftplugin/sh_*.vim ftplugin/sh/*.vim
@@ -31,7 +36,7 @@ if exists("b:browsefilter")
endif
" Change the :browse e filter to primarily show configure-related files.
-if has("gui_win32")
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter="Configure Scripts (configure.*, config.*)\tconfigure*;config.*\n" .
\ s:browsefilter
endif
diff --git a/runtime/ftplugin/cpp.vim b/runtime/ftplugin/cpp.vim
index cb425aa8e7..d4931a2533 100644
--- a/runtime/ftplugin/cpp.vim
+++ b/runtime/ftplugin/cpp.vim
@@ -10,8 +10,7 @@ if exists("b:did_ftplugin")
endif
" Behaves mostly just like C
-runtime! ftplugin/c.vim ftplugin/c_*.vim ftplugin/c/*.vim
-runtime! ftplugin/c.lua ftplugin/c_*.lua ftplugin/c/*.lua
+runtime! ftplugin/c.{vim,lua} ftplugin/c_*.{vim,lua} ftplugin/c/*.{vim,lua}
" C++ uses templates with <things>
" Disabled, because it gives an error for typing an unmatched ">".
diff --git a/runtime/ftplugin/cs.vim b/runtime/ftplugin/cs.vim
index 0734d11d22..ada71315e1 100644
--- a/runtime/ftplugin/cs.vim
+++ b/runtime/ftplugin/cs.vim
@@ -3,6 +3,7 @@
" Maintainer: Nick Jensen <nickspoon@gmail.com>
" Former Maintainer: Johannes Zellner <johannes@zellner.org>
" Last Change: 2022-11-16
+" 2024 Jan 14 by Vim Project (browsefilter)
" License: Vim (see :h license)
" Repository: https://github.com/nickspoons/vim-cs
@@ -31,10 +32,14 @@ if exists('loaded_matchit') && !exists('b:match_words')
endif
if (has('gui_win32') || has('gui_gtk')) && !exists('b:browsefilter')
- let b:browsefilter = "C# Source Files (*.cs *.csx)\t*.cs;*.csx\n" .
+ let b:browsefilter = "C# Source Files (*.cs, *.csx)\t*.cs;*.csx\n" .
\ "C# Project Files (*.csproj)\t*.csproj\n" .
- \ "Visual Studio Solution Files (*.sln)\t*.sln\n" .
- \ "All Files (*.*)\t*.*\n"
+ \ "Visual Studio Solution Files (*.sln)\t*.sln\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin .= ' | unlet! b:browsefilter'
endif
diff --git a/runtime/ftplugin/csh.vim b/runtime/ftplugin/csh.vim
index 2feec57bb2..a22bee3279 100644
--- a/runtime/ftplugin/csh.vim
+++ b/runtime/ftplugin/csh.vim
@@ -3,7 +3,7 @@
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Dan Sharp
" Contributor: Johannes Zellner <johannes@zellner.org>
-" Last Change: 2023 Oct 09
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -44,8 +44,12 @@ if exists("loaded_matchit") && !exists("b:match_words")
endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "csh Scripts (*.csh)\t*.csh\n" ..
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "csh Scripts (*.csh)\t*.csh\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
let b:csh_set_browsefilter = 1
let b:undo_ftplugin ..= " | unlet! b:browsefilter b:csh_set_browsefilter"
endif
diff --git a/runtime/ftplugin/diff.vim b/runtime/ftplugin/diff.vim
index f2a0820be9..2daa48aeb4 100644
--- a/runtime/ftplugin/diff.vim
+++ b/runtime/ftplugin/diff.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Diff
" Maintainer: The Vim Project <https://github.com/vim/vim>
-" Last Change: 2023 Aug 10
+" Last Change: 2023 Aug 22
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" Only do this when not done yet for this buffer
@@ -19,6 +19,11 @@ setlocal nomodeline
let &l:commentstring = "# %s"
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Diff Files (*.diff)\t*.diff\nPatch Files (*.patch)\t*.h\nAll Files (*.*)\t*.*\n"
+ let b:browsefilter = "Diff Files (*.diff)\t*.diff\nPatch Files (*.patch)\t*.h\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/dosbatch.vim b/runtime/ftplugin/dosbatch.vim
index f02f26b1fd..5001cf68bd 100644
--- a/runtime/ftplugin/dosbatch.vim
+++ b/runtime/ftplugin/dosbatch.vim
@@ -2,6 +2,7 @@
" Language: MS-DOS/Windows .bat files
" Maintainer: Mike Williams <mrmrdubya@gmail.com>
" Last Change: 12th February 2023
+" 2024 Jan 14 by Vim Project (browsefilter)
"
" Options Flags:
" dosbatch_colons_comment - any value to treat :: as comment line
@@ -37,12 +38,17 @@ if executable('help.exe')
endif
" Define patterns for the browse file filter
-if has("gui_win32") && !exists("b:browsefilter")
- let b:browsefilter = "DOS Batch Files (*.bat, *.cmd)\t*.bat;*.cmd\nAll Files (*.*)\t*.*\n"
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
+ let b:browsefilter = "DOS Batch Files (*.bat, *.cmd)\t*.bat;*.cmd\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
endif
let b:undo_ftplugin = "setlocal comments< formatoptions< keywordprg<"
- \ . "| unlet! b:browsefiler"
+ \ . "| unlet! b:browsefilter"
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/ftplugin/dtd.vim b/runtime/ftplugin/dtd.vim
index a046118c70..bea8c5c18a 100644
--- a/runtime/ftplugin/dtd.vim
+++ b/runtime/ftplugin/dtd.vim
@@ -1,10 +1,11 @@
" Vim filetype plugin file
-" Language: dtd
+" Language: dtd
"
" This runtime file is looking for a new maintainer.
"
" Former maintainer: Dan Sharp
-" Last Changed: 20 Jan 2009
+" Last Change: 2009 Jan 20
+" 2024 Jan 14 by Vim Project (browsefilter)
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
@@ -27,10 +28,14 @@ if exists("loaded_matchit")
endif
" Change the :browse e filter to primarily show Java-related files.
-if has("gui_win32")
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter="DTD Files (*.dtd)\t*.dtd\n" .
- \ "XML Files (*.xml)\t*.xml\n" .
- \ "All Files (*.*)\t*.*\n"
+ \ "XML Files (*.xml)\t*.xml\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
endif
" Undo the stuff we changed.
diff --git a/runtime/ftplugin/eiffel.vim b/runtime/ftplugin/eiffel.vim
index 216fdde162..e193110cde 100644
--- a/runtime/ftplugin/eiffel.vim
+++ b/runtime/ftplugin/eiffel.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: Eiffel
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2010 Aug 29
+" Last Change: 2024 Jan 14
if (exists("b:did_ftplugin"))
finish
@@ -18,8 +18,12 @@ setlocal formatoptions-=t formatoptions+=croql
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "Eiffel Source Files (*.e)\t*.e\n" .
- \ "Eiffel Control Files (*.ecf, *.ace, *.xace)\t*.ecf;*.ace;*.xace\n" .
- \ "All Files (*.*)\t*.*\n"
+ \ "Eiffel Control Files (*.ecf, *.ace, *.xace)\t*.ecf;*.ace;*.xace\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
endif
if exists("loaded_matchit") && !exists("b:match_words")
diff --git a/runtime/ftplugin/elixir.vim b/runtime/ftplugin/elixir.vim
index 50f63673dc..d067f472b7 100644
--- a/runtime/ftplugin/elixir.vim
+++ b/runtime/ftplugin/elixir.vim
@@ -1,7 +1,7 @@
" Elixir filetype plugin
" Language: Elixir
" Maintainer: Mitchell Hanberg <vimNOSPAM@mitchellhanberg.com>
-" Last Change: 2022 Sep 20
+" Last Change: 2023 Dec 27
if exists("b:did_ftplugin")
finish
@@ -27,7 +27,13 @@ setlocal shiftwidth=2 softtabstop=2 expandtab iskeyword+=!,?
setlocal comments=:#
setlocal commentstring=#\ %s
-let b:undo_ftplugin = 'setlocal sw< sts< et< isk< com< cms<'
+setlocal indentkeys=0#,!^F,o,O
+" Enable keys for blocks
+setlocal indentkeys+=0=after,0=catch,0=do,0=else,0=end,0=rescue
+" Enable keys that are usually the first keys in a line
+setlocal indentkeys+=0->,0\|>,0},0],0),>
+
+let b:undo_ftplugin = 'setlocal sw< sts< et< isk< com< cms< indk<'
let &cpo = s:save_cpo
unlet s:save_cpo
diff --git a/runtime/ftplugin/erlang.vim b/runtime/ftplugin/erlang.vim
index 31fa0c3213..1cb57f4c85 100644
--- a/runtime/ftplugin/erlang.vim
+++ b/runtime/ftplugin/erlang.vim
@@ -5,7 +5,8 @@
" Contributors: Ricardo Catalinas Jiménez <jimenezrick@gmail.com>
" Eduardo Lopez (http://github.com/tapichu)
" Arvid Bjurklint (http://github.com/slarwise)
-" Last Update: 2021-Nov-22
+" Paweł Zacharek (http://github.com/subc2)
+" Last Update: 2023-Dec-20
" License: Vim license
" URL: https://github.com/vim-erlang/vim-erlang-runtime
@@ -57,7 +58,7 @@ setlocal suffixesadd=.erl,.hrl
let &l:include = '^\s*-\%(include\|include_lib\)\s*("\zs\f*\ze")'
let &l:define = '^\s*-\%(define\|record\|type\|opaque\)'
-let s:erlang_fun_begin = '^\a\w*(.*$'
+let s:erlang_fun_begin = '^\l[A-Za-z0-9_@]*(.*$'
let s:erlang_fun_end = '^[^%]*\.\s*\(%.*\)\?$'
if !exists('*GetErlangFold')
@@ -95,9 +96,22 @@ if !exists('*ErlangFoldText')
endfunction
endif
+" The following lines enable the macros/matchit.vim plugin for extended
+" matching with the % key.
+let b:match_ignorecase = 0
+let b:match_words =
+ \ '\<\%(begin\|case\|fun\|if\|maybe\|receive\|try\)\>' .
+ \ ':\<\%(after\|catch\|else\|of\)\>' .
+ \ ':\<end\>,' .
+ \ '^\l[A-Za-z0-9_@]*' .
+ \ ':^\%(\%(\t\| \{' . shiftwidth() .
+ \ '}\)\%([^\t\ %][^%]*\)\?\)\?;\s*\%(%.*\)\?$\|\.[\t\ %]\|\.$'
+let b:match_skip = 's:comment\|string\|erlangmodifier\|erlangquotedatom'
+
let b:undo_ftplugin = "setlocal keywordprg< foldmethod< foldexpr< foldtext<"
\ . " comments< commentstring< formatoptions< suffixesadd< include<"
\ . " define<"
+ \ . " | unlet b:match_ignorecase b:match_words b:match_skip"
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/ftplugin/eruby.vim b/runtime/ftplugin/eruby.vim
index 893fa58d32..b5c4665d24 100644
--- a/runtime/ftplugin/eruby.vim
+++ b/runtime/ftplugin/eruby.vim
@@ -4,6 +4,7 @@
" URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2022 May 15
+" 2024 Jan 14 by Vim Project (browsefilter)
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -15,7 +16,11 @@ set cpo-=C
" Define some defaults in case the included ftplugins don't set them.
let s:undo_ftplugin = ""
-let s:browsefilter = "All Files (*.*)\t*.*\n"
+if has("win32")
+ let s:browsefilter = "All Files (*.*)\t*\n"
+else
+ let s:browsefilter = "All Files (*)\t*\n"
+endif
let s:match_words = ""
if !exists("g:eruby_default_subtype")
@@ -109,8 +114,8 @@ exe 'cmap <buffer><script><expr> <Plug><cfile> ErubyAtCursor() ? ' . maparg('<Pl
exe 'cmap <buffer><script><expr> <Plug><ctag> ErubyAtCursor() ? ' . maparg('<Plug><ctag>', 'c') . ' : ' . get(s:ctagmap, 'rhs', '"\022\027"')
unlet s:cfilemap s:ctagmap s:include s:path s:suffixesadd
-" Change the browse dialog on Win32 to show mainly eRuby-related files
-if has("gui_win32")
+" Change the browse dialog on Win32 and GTK to show mainly eRuby-related files
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter="eRuby Files (*.erb, *.rhtml)\t*.erb;*.rhtml\n" . s:browsefilter
endif
diff --git a/runtime/ftplugin/expect.vim b/runtime/ftplugin/expect.vim
index a4c6af96ce..b4db154999 100644
--- a/runtime/ftplugin/expect.vim
+++ b/runtime/ftplugin/expect.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Expect
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2022 Jul 16
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -14,8 +14,12 @@ let s:cpo_save = &cpo
set cpo&vim
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Expect Command Files (*.exp)\t*.exp\n" ..
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Expect Command Files (*.exp)\t*.exp\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
endif
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/falcon.vim b/runtime/ftplugin/falcon.vim
index affca38481..1000b62e76 100644
--- a/runtime/ftplugin/falcon.vim
+++ b/runtime/ftplugin/falcon.vim
@@ -4,6 +4,7 @@
" Copyright: Copyright (c) 2009-2013 Steven Oliver
" License: You may redistribute this under the same terms as Vim itself
" Last Update: 2020 Oct 10
+" 2024 Jan 14 by Vim Project (browsefilter)
" --------------------------------------------------------------------------
" Only do this when not done yet for this buffer
@@ -34,14 +35,18 @@ endif
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
" Windows allows you to filter the open file dialog
-if has("gui_win32") && !exists("b:browsefilter")
- let b:browsefilter = "Falcon Source Files (*.fal *.ftd)\t*.fal;*.ftd\n" .
- \ "All Files (*.*)\t*.*\n"
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
+ let b:browsefilter = "Falcon Source Files (*.fal, *.ftd)\t*.fal;*.ftd\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
endif
let b:undo_ftplugin = "setlocal tabstop< shiftwidth< expandtab< fileencoding<"
\ . " suffixesadd< comments<"
- \ . "| unlet! b:browsefiler"
+ \ . "| unlet! b:browsefilter"
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/ftplugin/forth.vim b/runtime/ftplugin/forth.vim
index d28c8484e1..df4694f206 100644
--- a/runtime/ftplugin/forth.vim
+++ b/runtime/ftplugin/forth.vim
@@ -2,6 +2,7 @@
" Language: Forth
" Maintainer: Johan Kotlinski <kotlinski@gmail.com>
" Last Change: 2023 Sep 15
+" 2024 Jan 14 by Vim Project (browsefilter)
" URL: https://github.com/jkotlinski/forth.vim
if exists("b:did_ftplugin")
@@ -62,8 +63,12 @@ if exists("loaded_matchit") && !exists("b:match_words")
endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Forth Source Files (*.f *.fs *.ft *.fth *.4th)\t*.f;*.fs;*.ft;*.fth;*.4th\n" ..
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Forth Source Files (*.f, *.fs, *.ft, *.fth, *.4th)\t*.f;*.fs;*.ft;*.fth;*.4th\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/fortran.vim b/runtime/ftplugin/fortran.vim
index 8f5b243b82..3c325818d3 100644
--- a/runtime/ftplugin/fortran.vim
+++ b/runtime/ftplugin/fortran.vim
@@ -1,13 +1,16 @@
" Vim settings file
-" Language: Fortran 2008 (and older: Fortran 2003, 95, 90, 77, 66)
-" Version: (v53) 2021 April 06 (updated 2022 May 22)
-" Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/>
+" Language: Fortran 2023 (and Fortran 2018, 2008, 2003, 95, 90, 77, 66)
+" Version: (v55) 2023 December 22
+" Maintainers: Ajit J. Thakkar <ajit@unb.ca>; <https://ajit.ext.unb.ca/>
+" Joshua Hollett <j.hollett@uwinnipeg.ca>
" Usage: For instructions, do :help fortran-plugin from Vim
" Credits:
" Version 0.1 was created in September 2000 by Ajit Thakkar.
" Since then, useful suggestions and contributions have been made, in order, by:
" Stefano Zacchiroli, Hendrik Merx, Ben Fritz, David Barnett, Eisuke Kawashima,
" Doug Kearns, and Fritz Reese.
+" Last Change: 2023 Dec 22
+" 2024 Jan 14 by Vim Project (browsefilter)
" Only do these settings when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -39,7 +42,7 @@ if !exists("b:fortran_fixed_source")
" Fixed-form file extension defaults
let b:fortran_fixed_source = 1
else
- " Modern fortran still allows both fixed and free source form
+ " Modern fortran compilers still allow both fixed and free source form
" Assume fixed source form unless signs of free source form
" are detected in the first five columns of the first s:lmax lines.
" Detection becomes more accurate and time-consuming if more lines
@@ -70,14 +73,14 @@ if (b:fortran_fixed_source == 1)
" but some vendor extensions allow longer lines
if exists("fortran_extended_line_length")
setlocal tw=132
- elseif exists("fortran_cardimage_line_length")
- setlocal tw=80
else
- setlocal tw=72
+ " The use of columns 73-80 for sequence numbers is obsolete
+ " so almost all compilers allow a textwidth of 80
+ setlocal tw=80
" If you need to add "&" on continued lines so that the code is
" compatible with both free and fixed format, then you should do so
- " in column 73 and uncomment the next line
- " setlocal tw=73
+ " in column 81 and uncomment the next line
+ " setlocal tw=81
endif
else
setlocal comments=:!
@@ -109,7 +112,9 @@ if !exists("b:match_words")
let b:match_ignorecase = 1
let b:match_words =
\ '(:),' .
- \ '\<select\s*case\>:' . s:notselect. '\<case\>:\<end\s*select\>,' .
+ \ s:notend .'\<select\s\+type\>:' . s:notselect. '\<type\|class\>:\<end\s*select\>,' .
+ \ s:notend .'\<select\s\+rank\>:' . s:notselect. '\<rank\>:\<end\s*select\>,' .
+ \ s:notend .'\<select\>:' . s:notselect. '\<case\>:\<end\s*select\>,' .
\ s:notelse . '\<if\s*(.\+)\s*then\>:' .
\ s:nothash . '\<else\s*\%(if\s*(.\+)\s*then\)\=\>:' . s:nothash . '\<end\s*if\>,'.
\ 'do\s\+\(\d\+\):\%(^\s*\)\@<=\1\s,'.
@@ -118,6 +123,9 @@ if !exists("b:match_words")
\ s:notend . '\<type\s*[^(]:\<end\s*type\>,'.
\ s:notend . '\<forall\>:\<end\s*forall\>,'.
\ s:notend . '\<associate\>:\<end\s*associate\>,'.
+ \ s:notend . '\<change\s\+team\>:\<end\s*team\>,'.
+ \ s:notend . '\<critical\>:\<end\s*critical\>,'.
+ \ s:notend . '\<block\>:\<end\s*block\>,'.
\ s:notend . '\<enum\>:\<end\s*enum\>,'.
\ s:notend . '\<interface\>:\<end\s*interface\>,'.
\ s:notend . '\<subroutine\>:\<end\s*subroutine\>,'.
@@ -129,8 +137,12 @@ endif
" File filters for :browse e
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Fortran Files (*.f;*.for;*.f77;*.f90;*.f95;*.f03;*.f08;*.fpp;*.ftn)\t*.f;*.for;*.f77;*.f90;*.f95;*.f03;*.f08;*.fpp;*.ftn\n" .
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Fortran Files (*.f, *.for, *.f77, *.f90, *.f95, *.f03, *.f08, *.fpp, *.ftn)\t*.f;*.for;*.f77;*.f90;*.f95;*.f03;*.f08;*.fpp;*.ftn\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
endif
let b:undo_ftplugin = "setl fo< com< tw< cms< et< inc< sua<"
diff --git a/runtime/ftplugin/fpcmake.vim b/runtime/ftplugin/fpcmake.vim
index 8d950838c7..e365ba7801 100644
--- a/runtime/ftplugin/fpcmake.vim
+++ b/runtime/ftplugin/fpcmake.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Free Pascal Makefile Generator
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2021 Apr 23
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -13,11 +13,15 @@ set cpo&vim
runtime! ftplugin/make.vim
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Free Pascal Makefile Definition Files (*.fpc)\t*.fpc\n" ..
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Free Pascal Makefile Definition Files (*.fpc)\t*.fpc\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
+ let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
-let b:undo_ftplugin = b:undo_ftplugin .. " | unlet! b:browsefilter"
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/ftplugin/freebasic.vim b/runtime/ftplugin/freebasic.vim
index 1680e84c9c..8eadb44c21 100644
--- a/runtime/ftplugin/freebasic.vim
+++ b/runtime/ftplugin/freebasic.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: FreeBASIC
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2022 Jun 24
+" Last Change: 2023 Aug 22
" Setup {{{1
if exists("b:did_ftplugin")
@@ -70,8 +70,12 @@ endif
if (has("gui_win32") || has("gui_gtk")) && exists("b:basic_set_browsefilter")
let b:browsefilter = "FreeBASIC Source Files (*.bas)\t*.bas\n" ..
- \ "FreeBASIC Header Files (*.bi)\t*.bi\n" ..
- \ "All Files (*.*)\t*.*\n"
+ \ "FreeBASIC Header Files (*.bi)\t*.bi\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
endif
" Cleanup {{{1
diff --git a/runtime/ftplugin/gdscript.vim b/runtime/ftplugin/gdscript.vim
new file mode 100644
index 0000000000..692afdd0ea
--- /dev/null
+++ b/runtime/ftplugin/gdscript.vim
@@ -0,0 +1,68 @@
+" Vim filetype plugin file
+" Language: gdscript (Godot game engine scripting language)
+" Maintainer: Maxim Kim <habamax@gmail.com>
+" Website: https://github.com/habamax/vim-gdscript
+"
+" This file has been manually translated from Vim9 script.
+
+if exists("b:did_ftplugin") | finish | endif
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+let b:did_ftplugin = 1
+let b:undo_ftplugin = 'setlocal cinkeys<'
+ \ .. '| setlocal indentkeys<'
+ \ .. '| setlocal commentstring<'
+ \ .. '| setlocal suffixesadd<'
+ \ .. '| setlocal foldexpr<'
+ \ .. '| setlocal foldignore<'
+
+setlocal cinkeys-=0#
+setlocal indentkeys-=0#
+setlocal suffixesadd=.gd
+setlocal commentstring=#\ %s
+setlocal foldignore=
+setlocal foldexpr=s:GDScriptFoldLevel()
+
+
+function s:GDScriptFoldLevel() abort
+ let line = getline(v:lnum)
+ if line =~? '^\s*$'
+ return "-1"
+ endif
+
+ let sw = shiftwidth()
+ let indent = indent(v:lnum) / sw
+ let indent_next = indent(nextnonblank(v:lnum + 1)) / sw
+
+ if indent_next > indent && line =~# ':\s*$'
+ return $">{indent_next}"
+ else
+ return $"{indent}"
+ endif
+endfunction
+
+
+if !exists("g:no_plugin_maps")
+ " Next/Previous section
+ function s:NextSection(back, cnt) abort
+ for n in range(a:cnt)
+ call search('^\s*func\s', a:back ? 'bW' : 'W')
+ endfor
+ endfunction
+
+ " Nvim: <scriptcmd> hasn't been ported yet.
+ " nnoremap <silent><buffer> ]] <scriptcmd>NextSection(false, v:count1)<CR>
+ " nnoremap <silent><buffer> [[ <scriptcmd>NextSection(true, v:count1)<CR>
+ nnoremap <silent><buffer> ]] <Cmd>call <SID>NextSection(v:false, v:count1)<CR>
+ nnoremap <silent><buffer> [[ <Cmd>call <SID>NextSection(v:true, v:count1)<CR>
+ xmap <buffer><expr> ]] $'<C-\><C-N>{v:count1}]]m>gv'
+ xmap <buffer><expr> [[ $'<C-\><C-N>{v:count1}[[m>gv'
+ let b:undo_ftplugin ..=
+ \ " | silent exe 'unmap <buffer> [['"
+ \ .. " | silent exe 'unmap <buffer> ]]'"
+endif
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
diff --git a/runtime/ftplugin/gdshader.vim b/runtime/ftplugin/gdshader.vim
new file mode 100644
index 0000000000..f0d34ee5a6
--- /dev/null
+++ b/runtime/ftplugin/gdshader.vim
@@ -0,0 +1,13 @@
+" Vim filetype plugin file
+" Language: Godot shading language
+" Maintainer: Maxim Kim <habamax@gmail.com>
+" Website: https://github.com/habamax/vim-gdscript
+"
+" This file has been manually translated from Vim9 script.
+
+if exists("b:did_ftplugin") | finish | endif
+let b:did_ftplugin = 1
+
+let b:undo_ftplugin = 'setlocal suffixesadd<'
+
+setlocal suffixesadd=.gdshader
diff --git a/runtime/ftplugin/git.vim b/runtime/ftplugin/git.vim
new file mode 100644
index 0000000000..7fcce53056
--- /dev/null
+++ b/runtime/ftplugin/git.vim
@@ -0,0 +1,15 @@
+" Vim filetype plugin
+" Language: generic git output
+" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
+" Last Change: 2023 Mar 26
+
+" Only do this when not done yet for this buffer
+if (exists("b:did_ftplugin"))
+ finish
+endif
+
+let b:did_ftplugin = 1
+
+setlocal nomodeline
+
+let b:undo_ftplugin = "setl modeline<"
diff --git a/runtime/ftplugin/gitcommit.vim b/runtime/ftplugin/gitcommit.vim
index 9342799b56..3749328595 100644
--- a/runtime/ftplugin/gitcommit.vim
+++ b/runtime/ftplugin/gitcommit.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: git commit file
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2022 Jan 05
+" Last Change: 2023 Dec 28
" Only do this when not done yet for this buffer
if (exists("b:did_ftplugin"))
@@ -12,7 +12,7 @@ let b:did_ftplugin = 1
setlocal nomodeline tabstop=8 formatoptions+=tl textwidth=72
setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q formatoptions+=n
-setlocal formatlistpat+=\\\|^\\s*[-*+]\\s\\+
+setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}]\\s\\+\\\|^\\s*[-*+]\\s\\+
setlocal include=^+++
setlocal includeexpr=substitute(v:fname,'^[bi]/','','')
@@ -42,6 +42,11 @@ function! s:diffcomplete(A, L, P) abort
return args
endfunction
+function! s:setupdiff() abort
+ command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0, <f-args>)
+ setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git
+endfunction
+
function! s:gitdiffcached(bang, ...) abort
let name = tempname()
if a:0
@@ -50,8 +55,6 @@ function! s:gitdiffcached(bang, ...) abort
let extra = "-p --stat=".&columns
endif
call system("git diff --cached --no-color --no-ext-diff ".extra." > ".shellescape(name))
- exe "pedit " . fnameescape(name)
- wincmd P
- command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0, <f-args>)
- setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git
+ exe 'pedit +call\ s:setupdiff()' fnameescape(name)
+ silent! wincmd P
endfunction
diff --git a/runtime/ftplugin/haml.vim b/runtime/ftplugin/haml.vim
index 6f30169958..910d9c78b3 100644
--- a/runtime/ftplugin/haml.vim
+++ b/runtime/ftplugin/haml.vim
@@ -2,6 +2,7 @@
" Language: Haml
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2019 Dec 05
+" 2024 Jan 14 by Vim Project (browsefilter)
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -13,7 +14,11 @@ set cpo-=C
" Define some defaults in case the included ftplugins don't set them.
let s:undo_ftplugin = ""
-let s:browsefilter = "All Files (*.*)\t*.*\n"
+if has("win32")
+ let s:browsefilter = "All Files (*.*)\t*\n"
+else
+ let s:browsefilter = "All Files (*)\t*\n"
+endif
let s:match_words = ""
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
@@ -44,14 +49,14 @@ if exists("b:undo_ftplugin")
let s:undo_ftplugin = b:undo_ftplugin . " | " . s:undo_ftplugin
endif
if exists ("b:browsefilter")
- let s:browsefilter = substitute(b:browsefilter,'\cAll Files (\*\.\*)\t\*\.\*\n','','') . s:browsefilter
+ let s:browsefilter = substitute(b:browsefilter,'\cAll Files (.*)\t\*\n','','') . s:browsefilter
endif
if exists("b:match_words")
let s:match_words = b:match_words . ',' . s:match_words
endif
-" Change the browse dialog on Win32 to show mainly Haml-related files
-if has("gui_win32")
+" Change the browse dialog on Win32 and GTK to show mainly Haml-related files
+if has("gui_win32") || has("gui_gtk")
let b:browsefilter="Haml Files (*.haml)\t*.haml\nSass Files (*.sass)\t*.sass\n" . s:browsefilter
endif
@@ -62,7 +67,7 @@ endif
setlocal comments= commentstring=-#\ %s
-let b:undo_ftplugin = "setl def< cms< com< "
+let b:undo_ftplugin = "setl def< cms< com< " .
\ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin
let &cpo = s:save_cpo
diff --git a/runtime/ftplugin/help.lua b/runtime/ftplugin/help.lua
index 4cc3386167..67c417b1be 100644
--- a/runtime/ftplugin/help.lua
+++ b/runtime/ftplugin/help.lua
@@ -1,3 +1,28 @@
-if vim.endswith(vim.fs.normalize(vim.api.nvim_buf_get_name(0)), '/doc/syntax.txt') then
- require('vim.vimhelp').highlight_groups()
+-- use treesitter over syntax (for highlighted code blocks)
+vim.treesitter.start()
+
+-- add custom highlights for list in `:h highlight-groups`
+local bufname = vim.fs.normalize(vim.api.nvim_buf_get_name(0))
+if vim.endswith(bufname, '/doc/syntax.txt') then
+ require('vim.vimhelp').highlight_groups({
+ { start = [[\*group-name\*]], stop = '^======', match = '^(%w+)\t' },
+ { start = [[\*highlight-groups\*]], stop = '^======', match = '^(%w+)\t' },
+ })
+elseif vim.endswith(bufname, '/doc/treesitter.txt') then
+ require('vim.vimhelp').highlight_groups({
+ {
+ start = [[\*treesitter-highlight-groups\*]],
+ stop = [[\*treesitter-highlight-spell\*]],
+ match = '^@[%w%p]+',
+ },
+ })
+elseif vim.endswith(bufname, '/doc/diagnostic.txt') then
+ require('vim.vimhelp').highlight_groups({
+ { start = [[\*diagnostic-highlights\*]], stop = '^======', match = '^(%w+)' },
+ })
+elseif vim.endswith(bufname, '/doc/lsp.txt') then
+ require('vim.vimhelp').highlight_groups({
+ { start = [[\*lsp-highlight\*]], stop = '^------', match = '^(%w+)' },
+ { start = [[\*lsp-semantic-highlight\*]], stop = '^======', match = '^@[%w%p]+' },
+ })
end
diff --git a/runtime/ftplugin/help.vim b/runtime/ftplugin/help.vim
index a6a6652b2f..a188e45cb4 100644
--- a/runtime/ftplugin/help.vim
+++ b/runtime/ftplugin/help.vim
@@ -71,7 +71,7 @@ if !exists('g:no_plugin_maps')
if indent(lnum) <= indent(l)
let level = has_section + has_sub_section
- let add_text = matchstr(text, '\S.*')
+ let add_text = matchstr(text, '\S.\{-}\ze\s\=\~$')
endif
endif
@@ -79,7 +79,7 @@ if !exists('g:no_plugin_maps')
if !empty(add_text) && last_added != lnum
let last_added = lnum
call add(toc, {'bufnr': bufnr('%'), 'lnum': lnum,
- \ 'text': repeat(' ', level) . add_text})
+ \ 'text': repeat("\u00a0\u00a0", level) . add_text})
endif
let lnum = nextnonblank(lnum + 1)
endwhile
diff --git a/runtime/ftplugin/html.vim b/runtime/ftplugin/html.vim
index 94cb62653f..3aa60a873e 100644
--- a/runtime/ftplugin/html.vim
+++ b/runtime/ftplugin/html.vim
@@ -2,7 +2,7 @@
" Language: HTML
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Dan Sharp
-" Last Changed: 2022 Jul 20
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -43,10 +43,14 @@ endif
" Change the :browse e filter to primarily show HTML-related files.
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "HTML Files (*.html *.htm)\t*.htm;*.html\n" ..
+ let b:browsefilter = "HTML Files (*.html, *.htm)\t*.html;*.htm\n" ..
\ "JavaScript Files (*.js)\t*.js\n" ..
- \ "Cascading StyleSheets (*.css)\t*.css\n" ..
- \ "All Files (*.*)\t*.*\n"
+ \ "Cascading StyleSheets (*.css)\t*.css\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
let b:html_set_browsefilter = 1
let b:undo_ftplugin ..= " | unlet! b:browsefilter b:html_set_browsefilter"
endif
diff --git a/runtime/ftplugin/hurl.vim b/runtime/ftplugin/hurl.vim
new file mode 100644
index 0000000000..10a3131d3a
--- /dev/null
+++ b/runtime/ftplugin/hurl.vim
@@ -0,0 +1,11 @@
+" Vim filetype plugin file
+" Language: hurl
+" Maintainer: Melker Ulander <melker.ulander@pm.me>
+" Last Changed: 2024 01 26
+
+if exists("b:did_ftplugin") | finish | endif
+
+let b:did_ftplugin = 1
+setlocal commentstring=#\ %s
+
+let b:undo_ftplugin = "setlocal commentstring<"
diff --git a/runtime/ftplugin/icon.vim b/runtime/ftplugin/icon.vim
index 33a86dfb9e..10411c8194 100644
--- a/runtime/ftplugin/icon.vim
+++ b/runtime/ftplugin/icon.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Icon
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2022 Jun 16
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -18,15 +18,19 @@ setlocal formatoptions-=t formatoptions+=croql
let b:undo_ftplugin = "setl fo< com< cms<"
if exists("loaded_matchit")
- " let b:match_ignorecase = 0
- let b:match_words = '^\s*$\s*if\(def\|ndef\)\=\>:^\s*$\s*elif\>:^\s*$\s*else\>:^\s*$\s*endif\>,' .
+ let b:match_ignorecase = 0
+ let b:match_words = '^\s*$\s*if\(def\|ndef\)\=\>:^\s*$\s*elif\>:^\s*$\s*else\>:^\s*$\s*endif\>,' ..
\ '\<procedure\>:\<\%(initial\|return\|suspend\|fail\)\>:\<end\>'
- let b:undo_ftplugin ..= " | unlet! b:match_words"
+ let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_words"
endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Icon Source Files (*.icn)\t*.icn\n" .
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Icon Source Files (*.icn)\t*.icn\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/ishd.vim b/runtime/ftplugin/ishd.vim
index b160349033..5e33efde78 100644
--- a/runtime/ftplugin/ishd.vim
+++ b/runtime/ftplugin/ishd.vim
@@ -2,7 +2,7 @@
" Language: InstallShield (ft=ishd)
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Johannes Zellner <johannes@zellner.org>
-" Last Change: 2023 Aug 28
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
@@ -29,8 +29,12 @@ if exists("loaded_matchit")
endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "InstallShield Files (*.rul)\t*.rul\n" .
- \ "All Files (*.*)\t*\n"
+ let b:browsefilter = "InstallShield Files (*.rul)\t*.rul\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin .= " | unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/j.vim b/runtime/ftplugin/j.vim
index ae235abba8..8335ea06c6 100644
--- a/runtime/ftplugin/j.vim
+++ b/runtime/ftplugin/j.vim
@@ -3,6 +3,7 @@
" Maintainer: David BÃŒrgin <dbuergin@gluet.ch>
" URL: https://gitlab.com/glts/vim-j
" Last Change: 2022-08-06
+" 2024 Jan 14 by Vim Project (browsefilter)
if exists('b:did_ftplugin')
finish
@@ -67,7 +68,11 @@ endif
" Browse dialog filter on Windows and GTK (see ":help browsefilter")
if (has('gui_win32') || has('gui_gtk')) && !exists('b:browsefilter')
let b:browsefilter = "J Script Files (*.ijs)\t*.ijs\n"
- \ . "All Files (*.*)\t*.*\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin .= ' | unlet! b:browsefilter'
endif
diff --git a/runtime/ftplugin/java.vim b/runtime/ftplugin/java.vim
index 74c8e8d1c1..bb7e7cd72c 100644
--- a/runtime/ftplugin/java.vim
+++ b/runtime/ftplugin/java.vim
@@ -1,10 +1,11 @@
" Vim filetype plugin file
-" Language: Java
+" Language: Java
"
" This runtime file is looking for a new maintainer.
"
" Former maintainer: Dan Sharp
-" Last Change: 2012 Mar 11
+" Last Change: 2012 Mar 11
+" 2024 Jan 14 by Vim Project (browsefilter)
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
@@ -36,11 +37,15 @@ setlocal comments& comments^=sO:*\ -,mO:*\ \ ,exO:*/
setlocal commentstring=//%s
" Change the :browse e filter to primarily show Java-related files.
-if has("gui_win32")
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter="Java Files (*.java)\t*.java\n" .
\ "Properties Files (*.prop*)\t*.prop*\n" .
- \ "Manifest Files (*.mf)\t*.mf\n" .
- \ "All Files (*.*)\t*.*\n"
+ \ "Manifest Files (*.mf)\t*.mf\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
endif
" Undo the stuff we changed.
diff --git a/runtime/ftplugin/javascript.vim b/runtime/ftplugin/javascript.vim
index 9a0b29e0ca..2633954903 100644
--- a/runtime/ftplugin/javascript.vim
+++ b/runtime/ftplugin/javascript.vim
@@ -1,8 +1,8 @@
" Vim filetype plugin file
" Language: Javascript
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2020 Jun 23
" Contributor: Romain Lafourcade <romainlafourcade@gmail.com>
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -34,7 +34,11 @@ if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
\ .. "JavaScript Modules (*.es, *.es6, *.cjs, *.mjs, *.jsm)\t*.es;*.es6;*.cjs;*.mjs;*.jsm\n"
\ .. "Vue Templates (*.vue)\t*.vue\n"
\ .. "JSON Files (*.json)\t*.json\n"
- \ .. "All Files (*.*)\t*.*\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
endif
" The following suffixes should be implied when resolving filenames
diff --git a/runtime/ftplugin/json5.vim b/runtime/ftplugin/json5.vim
index 2560857a33..302ed7606c 100644
--- a/runtime/ftplugin/json5.vim
+++ b/runtime/ftplugin/json5.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: JSON5
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2023 Oct 19
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -19,8 +19,12 @@ let b:undo_ftplugin = "setl fo< com< cms<"
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "JSON5 Files (*.json5)\t*.json5\n" ..
- \ "JSON Files (*.json)\t*.json\n" ..
- \ "All Files (*.*)\t*.*\n"
+ \ "JSON Files (*.json)\t*.json\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/jsp.vim b/runtime/ftplugin/jsp.vim
index 18136ccc24..cc7023279a 100644
--- a/runtime/ftplugin/jsp.vim
+++ b/runtime/ftplugin/jsp.vim
@@ -1,10 +1,11 @@
" Vim filetype plugin file
-" Language: jsp
+" Language: jsp
"
" This runtime file is looking for a new maintainer.
"
" Former maintainer: Dan Sharp
-" Last Changed: 20 Jan 2009
+" Last Change: 2009 Jan 20
+" 2024 Jan 14 by Vim Project (browsefilter)
if exists("b:did_ftplugin") | finish | endif
@@ -16,8 +17,12 @@ set cpo-=C
" Define some defaults in case the included ftplugins don't set them.
let s:undo_ftplugin = ""
let s:browsefilter = "Java Files (*.java)\t*.java\n" .
- \ "HTML Files (*.html, *.htm)\t*.html;*.htm\n" .
- \ "All Files (*.*)\t*.*\n"
+ \ "HTML Files (*.html, *.htm)\t*.html;*.htm\n"
+if has("win32")
+ let s:browsefilter .= "All Files (*.*)\t*\n"
+else
+ let s:browsefilter .= "All Files (*)\t*\n"
+endif
let s:match_words = ""
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
@@ -57,7 +62,7 @@ if exists("loaded_matchit")
endif
" Change the :browse e filter to primarily show JSP-related files.
-if has("gui_win32")
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter="JSP Files (*.jsp)\t*.jsp\n" . s:browsefilter
endif
diff --git a/runtime/ftplugin/kotlin.vim b/runtime/ftplugin/kotlin.vim
index b21de603ea..5c07088adb 100644
--- a/runtime/ftplugin/kotlin.vim
+++ b/runtime/ftplugin/kotlin.vim
@@ -3,7 +3,7 @@
" Maintainer: Alexander Udalov
" URL: https://github.com/udalov/kotlin-vim
" Last Change: 7 November 2021
-" 2023 Sep 17 by Vim Project (browsefilter)
+" 2024 Jan 14 by Vim Project (browsefilter)
if exists('b:did_ftplugin') | finish | endif
let b:did_ftplugin = 1
@@ -24,8 +24,12 @@ let b:undo_ftplugin = "setlocal comments< commentstring< ".
\ "formatoptions< includeexpr< suffixesadd<"
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Kotlin Source Files (*.kt, *kts)\t*.kt;*.kts\n" .
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Kotlin Source Files (*.kt, *kts)\t*.kt;*.kts\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin .= " | unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/kwt.vim b/runtime/ftplugin/kwt.vim
index 05b40d4e29..b37c7fa3a3 100644
--- a/runtime/ftplugin/kwt.vim
+++ b/runtime/ftplugin/kwt.vim
@@ -2,6 +2,7 @@
" Language: Kimwitu++
" Maintainer: Michael Piefel <entwurf@piefel.de>
" Last Change: 10 March 2012
+" 2024 Jan 14 by Vim Project (browsefilter)
" Behaves almost like C++
runtime! ftplugin/cpp.vim ftplugin/cpp_*.vim ftplugin/cpp/*.vim
@@ -10,11 +11,15 @@ let s:cpo_save = &cpo
set cpo&vim
" Limit the browser to related files
-if has("gui_win32") && !exists("b:browsefilter")
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "Kimwitu/Kimwitu++ Files (*.k)\t*.k\n" .
\ "Lex/Flex Files (*.l)\t*.l\n" .
- \ "Yacc/Bison Files (*.y)\t*.y\n" .
- \ "All Files (*.*)\t*.*\n"
+ \ "Yacc/Bison Files (*.y)\t*.y\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
endif
" Set the errorformat for the Kimwitu++ compiler
@@ -22,10 +27,10 @@ set efm+=kc%.%#:\ error\ at\ %f:%l:\ %m
if exists("b:undo_ftplugin")
let b:undo_ftplugin = b:undo_ftplugin . " | setlocal efm<"
- \ . "| unlet! b:browsefiler"
+ \ . "| unlet! b:browsefilter"
else
let b:undo_ftplugin = "setlocal efm<"
- \ . "| unlet! b:browsefiler"
+ \ . "| unlet! b:browsefilter"
endif
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/logtalk.dict b/runtime/ftplugin/logtalk.dict
index 3fcdfc6f6a..0d076b7b3e 100644
--- a/runtime/ftplugin/logtalk.dict
+++ b/runtime/ftplugin/logtalk.dict
@@ -18,11 +18,8 @@ atan2
atom
atomic
atom_chars
-atom_chars
-atom_codes
atom_codes
atom_concat
-atom_concat
atom_length
at_end_of_stream
bagof
@@ -32,6 +29,7 @@ call
callable
calls
catch
+catchall_catch
category
category_property
ceiling
@@ -45,9 +43,9 @@ coinduction
coinductive
compare
complements
-complements
complements_object
compound
+conditionals
conforms_to_protocol
context
context_switching_calls
@@ -87,6 +85,7 @@ end_object
end_protocol
engines
ensure_loaded
+error
evaluation_error
events
existence_error
@@ -152,12 +151,13 @@ nonvar
number
numbervars
number_chars
-number_chars
-number_codes
number_codes
object
object_property
once
+one
+one_or_error
+one_or_more
op
open
optimize
@@ -226,6 +226,7 @@ term_variables
this
threaded
threaded_call
+threaded_cancel
threaded_engine
threaded_engine_create
threaded_engine_destroy
@@ -250,6 +251,7 @@ type_error
undefined_predicates
underscore_variables
unify_with_occurs_check
+uninstantiation_error
unknown_entities
unknown_predicates
uses
@@ -260,3 +262,8 @@ write
writeq
write_canonical
xor
+zero
+zero_or_error
+zero_or_more
+zero_or_one
+zero_or_one_or_error
diff --git a/runtime/ftplugin/lua.lua b/runtime/ftplugin/lua.lua
new file mode 100644
index 0000000000..98f218e36e
--- /dev/null
+++ b/runtime/ftplugin/lua.lua
@@ -0,0 +1,2 @@
+-- use treesitter over syntax
+vim.treesitter.start()
diff --git a/runtime/ftplugin/lua.vim b/runtime/ftplugin/lua.vim
index 3529e1e3fd..80cbba78a2 100644
--- a/runtime/ftplugin/lua.vim
+++ b/runtime/ftplugin/lua.vim
@@ -5,7 +5,7 @@
" Contributor: Dorai Sitaram <ds26@gte.com>
" C.D. MacEachern <craig.daniel.maceachern@gmail.com>
" Tyler Miller <tmillr@proton.me>
-" Last Change: 2023 Mar 24
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -39,8 +39,12 @@ if exists("loaded_matchit") && !exists("b:match_words")
endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Lua Source Files (*.lua)\t*.lua\n" ..
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Lua Source Files (*.lua)\t*.lua\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/lynx.vim b/runtime/ftplugin/lynx.vim
index bf8410d6a0..4afed0a249 100644
--- a/runtime/ftplugin/lynx.vim
+++ b/runtime/ftplugin/lynx.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Lynx Web Browser Configuration
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2023 Nov 09
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -18,8 +18,12 @@ setlocal formatoptions-=t formatoptions+=croql
let b:undo_ftplugin = "setl cms< com< fo<"
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Lynx Configuration Files (lynx.cfg, .lynxrc)\tlynx.cfg;.lynxrc\n" ..
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Lynx Configuration Files (lynx.cfg, .lynxrc)\tlynx.cfg;.lynxrc\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/m3build.vim b/runtime/ftplugin/m3build.vim
index c910eaecd0..71960cec6d 100644
--- a/runtime/ftplugin/m3build.vim
+++ b/runtime/ftplugin/m3build.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Modula-3 Makefile
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2022 June 12
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -13,8 +13,12 @@ set cpo&vim
runtime! ftplugin/m3quake.vim
if (has("gui_win32") || has("gui_gtk")) && exists("b:m3quake_set_browsefilter")
- let b:browsefilter = "Modula-3 Makefile (m3makefile m3overrides)\tm3makefile;m3overrides\n" ..
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Modula-3 Makefile (m3makefile, m3overrides)\tm3makefile;m3overrides\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
endif
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/m3quake.vim b/runtime/ftplugin/m3quake.vim
index 7762875db9..33ba633ac6 100644
--- a/runtime/ftplugin/m3quake.vim
+++ b/runtime/ftplugin/m3quake.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Modula-3 Quake
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2022 June 12
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -23,8 +23,12 @@ if exists("loaded_matchit") && !exists("b:match_words")
endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Modula-3 Quake Source Files (*.quake)\t*.quake\n" ..
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Modula-3 Quake Source Files (*.quake)\t*.quake\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
let b:m3quake_set_browsefilter = 1
let b:undo_ftplugin ..= " | unlet! b:browsefilter b:m3quake_set_browsefilter"
endif
diff --git a/runtime/ftplugin/markdown.vim b/runtime/ftplugin/markdown.vim
index 2b963f139d..022dd0d601 100644
--- a/runtime/ftplugin/markdown.vim
+++ b/runtime/ftplugin/markdown.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: Markdown
" Maintainer: Tim Pope <https://github.com/tpope/vim-markdown>
-" Last Change: 2022 Oct 13
+" Last Change: 2023 Dec 28
if exists("b:did_ftplugin")
finish
@@ -35,7 +35,7 @@ if !exists("g:no_plugin_maps") && !exists("g:no_markdown_maps")
endif
function! s:NotCodeBlock(lnum) abort
- return synIDattr(synID(a:lnum, 1, 1), 'name') !=# 'markdownCode'
+ return synIDattr(synID(a:lnum, 1, 1), 'name') !=# 'markdownCodeBlock'
endfunction
function! MarkdownFold() abort
diff --git a/runtime/ftplugin/meson.vim b/runtime/ftplugin/meson.vim
index 1ce9a03037..17ffd5320a 100644
--- a/runtime/ftplugin/meson.vim
+++ b/runtime/ftplugin/meson.vim
@@ -4,6 +4,7 @@
" Maintainer: Liam Beguin <liambeguin@gmail.com>
" Original Author: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
" Last Change: 2018 Nov 27
+" 2024 Jan 14 by Vim Project (browsefilter)
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
@@ -30,8 +31,12 @@ if exists("loaded_matchit") && !exists("b:match_words")
endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Meson Build Files (meson.build)\tmeson.build\n" .
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Meson Build Files (meson.build)\tmeson.build\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin .= " | unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/modula2.vim b/runtime/ftplugin/modula2.vim
index 1d0e81ee70..9c1acc276a 100644
--- a/runtime/ftplugin/modula2.vim
+++ b/runtime/ftplugin/modula2.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Modula-2
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2021 Apr 08
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -11,28 +11,43 @@ let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo&vim
-setlocal comments=s0:(*,mb:\ ,ex:*)
-setlocal commentstring=(*%s*)
+let s:dialect = modula2#GetDialect()
+
+if s:dialect ==# "r10"
+ setlocal comments=s:(*,m:\ ,e:*),:!
+ setlocal commentstring=!\ %s
+else
+ setlocal commentstring=(*%s*)
+ setlocal comments=s:(*,m:\ ,e:*)
+endif
setlocal formatoptions-=t formatoptions+=croql
+let b:undo_ftplugin = "setl com< cms< fo<"
+
if exists("loaded_matchit") && !exists("b:match_words")
- " The second branch of the middle pattern is intended to match CASE labels
+ let b:match_ignorecase = 0
+ " the second branch of the middle pattern is intended to match CASE labels
let b:match_words = '\<REPEAT\>:\<UNTIL\>,' ..
- \ '\<\%(BEGIN\|CASE\|FOR\|IF\|LOOP\|WHILE\|WITH\)\>' ..
- \ ':' ..
- \ '\<\%(ELSIF\|ELSE\)\>\|\%(^\s*\)\@<=\w\+\%(\s*\,\s*\w\+\)\=\s*\:=\@!' ..
- \ ':' ..
- \ '\<END\>'
+ \ '\<\%(BEGIN\|CASE\|FOR\|IF\|LOOP\|WHILE\|WITH\|RECORD\)\>' ..
+ \ ':' ..
+ \ '\<\%(ELSIF\|ELSE\)\>\|\%(^\s*\)\@<=\w\+\%(\s*\,\s*\w\+\)\=\s*\:=\@!' ..
+ \ ':' ..
+ \ '\<END\>,' ..
+ \ '(\*:\*),<\*:\*>'
+ let b:match_skip = 's:Comment\|Pragma'
+ let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_skip b:match_words"
endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Modula-2 Source Files (*.def *.mod)\t*.def;*.mod\n" ..
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Modula-2 Source Files (*.def, *.mod)\t*.def;*.mod\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
+ let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
-let b:undo_ftplugin = "setl com< cms< fo< " ..
- \ "| unlet! b:browsefilter b:match_words"
-
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/ftplugin/modula3.vim b/runtime/ftplugin/modula3.vim
index 1f8ab359d5..45dd7ca01c 100644
--- a/runtime/ftplugin/modula3.vim
+++ b/runtime/ftplugin/modula3.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Modula-3
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2022 June 12
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -31,8 +31,12 @@ if exists("loaded_matchit") && !exists("b:match_words")
endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Modula-3 Source Files (*.m3)\t*.m3\n" ..
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Modula-3 Source Files (*.m3, *.i3, *.mg, *ig)\t*.m3;*.i3;*.mg;*.ig\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/msmessages.vim b/runtime/ftplugin/msmessages.vim
index 791eafe794..c4cbd94b13 100644
--- a/runtime/ftplugin/msmessages.vim
+++ b/runtime/ftplugin/msmessages.vim
@@ -2,6 +2,7 @@
" Language: MS Message files (*.mc)
" Maintainer: Kevin Locke <kwl7@cornell.edu>
" Last Change: 2008 April 09
+" 2024 Jan 14 by Vim Project (browsefilter)
" Location: http://kevinlocke.name/programs/vim/syntax/msmessages.vim
" Based on c.vim
@@ -29,11 +30,15 @@ setlocal fo-=ct fo+=roql
setlocal comments=:;,:;//,:;\ //,s:;\ /*\ ,m:;\ \ *\ ,e:;\ \ */
setlocal commentstring=;\ //\ %s
-" Win32 can filter files in the browse dialog
-if has("gui_win32") && !exists("b:browsefilter")
+" Win32 and GTK can filter files in the browse dialog
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "MS Message Files (*.mc)\t*.mc\n" .
- \ "Resource Files (*.rc)\t*.rc\n" .
- \ "All Files (*.*)\t*.*\n"
+ \ "Resource Files (*.rc)\t*.rc\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
endif
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/occam.vim b/runtime/ftplugin/occam.vim
index e9b7c014b3..0eb510f76d 100644
--- a/runtime/ftplugin/occam.vim
+++ b/runtime/ftplugin/occam.vim
@@ -3,6 +3,7 @@
" Copyright: Christian Jacobsen <clj3@kent.ac.uk>, Mario Schweigler <ms44@kent.ac.uk>
" Maintainer: Mario Schweigler <ms44@kent.ac.uk>
" Last Change: 23 April 2003
+" 2024 Jan 14 by Vim Project (browsefilter)
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -30,19 +31,23 @@ setlocal textwidth=78
"}}}
"{{{ File browsing filters
-" Win32 can filter files in the browse dialog
-if has("gui_win32") && !exists("b:browsefilter")
- let b:browsefilter = "All Occam Files (*.occ *.inc)\t*.occ;*.inc\n" .
+" Win32 and GTK can filter files in the browse dialog
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
+ let b:browsefilter = "All Occam Files (*.occ, *.inc)\t*.occ;*.inc\n" .
\ "Occam Include Files (*.inc)\t*.inc\n" .
- \ "Occam Source Files (*.occ)\t*.occ\n" .
- \ "All Files (*.*)\t*.*\n"
+ \ "Occam Source Files (*.occ)\t*.occ\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
endif
"}}}
"{{{ Undo settings
let b:undo_ftplugin = "setlocal shiftwidth< softtabstop< expandtab<"
\ . " formatoptions< comments< textwidth<"
- \ . "| unlet! b:browsefiler"
+ \ . "| unlet! b:browsefilter"
"}}}
let &cpo = s:keepcpo
diff --git a/runtime/ftplugin/octave.vim b/runtime/ftplugin/octave.vim
index 7cab7c212a..480b46a6eb 100644
--- a/runtime/ftplugin/octave.vim
+++ b/runtime/ftplugin/octave.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: GNU Octave
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2021 Sep 02
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -50,8 +50,12 @@ if exists("loaded_matchit") && !exists("b:match_words")
endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "GNU Octave Source Files (*.m)\t*.m\n" ..
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "GNU Octave Source Files (*.m)\t*.m\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
endif
let b:undo_ftplugin = "setl com< cms< fo< kp< " ..
diff --git a/runtime/ftplugin/odin.vim b/runtime/ftplugin/odin.vim
new file mode 100644
index 0000000000..c50fea65a3
--- /dev/null
+++ b/runtime/ftplugin/odin.vim
@@ -0,0 +1,26 @@
+" Vim filetype plugin file
+" Language: Odin
+" Maintainer: Maxim Kim <habamax@gmail.com>
+" Website: https://github.com/habamax/vim-odin
+" Last Change: 2024-01-15
+"
+" This file has been manually translated from Vim9 script.
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+let b:undo_ftplugin = 'setlocal commentstring<'
+ \ .. '| setlocal comments<'
+ \ .. '| setlocal suffixesadd<'
+
+setlocal suffixesadd=.odin
+setlocal commentstring=//%s
+setlocal comments=s1:/*,mb:*,ex:*/,://
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/ftplugin/pascal.vim b/runtime/ftplugin/pascal.vim
index aba1e54f27..9abd7dd382 100644
--- a/runtime/ftplugin/pascal.vim
+++ b/runtime/ftplugin/pascal.vim
@@ -2,7 +2,7 @@
" Language: Pascal
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Dan Sharp
-" Last Change: 2021 Apr 23
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
@@ -37,8 +37,12 @@ if exists("loaded_matchit")
endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Pascal Source Files (*.pas *.pp *.inc)\t*.pas;*.pp;*.inc\n" .
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Pascal Source Files (*.pas, *.pp, *.inc)\t*.pas;*.pp;*.inc\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
endif
let b:undo_ftplugin = "setl fo< cms< com< " ..
diff --git a/runtime/ftplugin/perl.vim b/runtime/ftplugin/perl.vim
index c63bd3f9c7..8c6a80eb4f 100644
--- a/runtime/ftplugin/perl.vim
+++ b/runtime/ftplugin/perl.vim
@@ -7,6 +7,7 @@
" Last Change: 2021 Nov 10
" 2023 Sep 07 by Vim Project (safety check: don't execute perl
" from current directory)
+" 2024 Jan 14 by Vim Project (browsefilter)
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
@@ -95,8 +96,12 @@ let b:undo_ftplugin .= " | setlocal pa<"
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "Perl Source Files (*.pl)\t*.pl\n" .
\ "Perl Modules (*.pm)\t*.pm\n" .
- \ "Perl Documentation Files (*.pod)\t*.pod\n" .
- \ "All Files (*.*)\t*.*\n"
+ \ "Perl Documentation Files (*.pod)\t*.pod\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin .= " | unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/php.vim b/runtime/ftplugin/php.vim
index 540653e030..f03f14512a 100644
--- a/runtime/ftplugin/php.vim
+++ b/runtime/ftplugin/php.vim
@@ -2,7 +2,7 @@
" Language: PHP
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Dan Sharp
-" Last Changed: 2022 Jul 20
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -15,8 +15,12 @@ set cpo&vim
" Define some defaults in case the included ftplugins don't set them.
let s:undo_ftplugin = ""
-let s:browsefilter = "HTML Files (*.html, *.htm)\t*.html;*.htm\n" ..
- \ "All Files (*.*)\t*.*\n"
+let s:browsefilter = "HTML Files (*.html, *.htm)\t*.html;*.htm\n"
+if has("win32")
+ let s:browsefilter ..= "All Files (*.*)\t*\n"
+else
+ let s:browsefilter ..= "All Files (*)\t*\n"
+endif
let s:match_words = ""
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
diff --git a/runtime/ftplugin/pod.vim b/runtime/ftplugin/pod.vim
index 61a4aa094a..81b0011bc5 100644
--- a/runtime/ftplugin/pod.vim
+++ b/runtime/ftplugin/pod.vim
@@ -6,6 +6,8 @@
" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
" License: Vim License (see :help license)
" Last Change: 2023 Jul 05
+" Last Change: 2021 Oct 19
+" 2024 Jan 14 by Vim Project (browsefilter)
if exists("b:did_ftplugin")
finish
@@ -33,8 +35,12 @@ endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "POD Source Files (*.pod)\t*.pod\n" .
\ "Perl Source Files (*.pl)\t*.pl\n" .
- \ "Perl Modules (*.pm)\t*.pm\n" .
- \ "All Files (*.*)\t*.*\n"
+ \ "Perl Modules (*.pm)\t*.pm\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin .= " | unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/poke.vim b/runtime/ftplugin/poke.vim
index 2be86695c8..4e31700995 100644
--- a/runtime/ftplugin/poke.vim
+++ b/runtime/ftplugin/poke.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: GNU Poke
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2021 March 11
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -18,14 +18,18 @@ setlocal formatoptions-=t formatoptions+=croql
setlocal include=load
setlocal suffixesadd=.pk
+let b:undo_ftplugin = "setl fo< com< cms< inc< sua<"
+
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Poke Files (*.pk)\t*.pk\n" .
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Poke Files (*.pk)\t*.pk\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
+ let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
-let b:undo_ftplugin = "setl fo< com< cms< inc< sua<" .
- \ " | unlet! b:browsefilter"
-
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/ftplugin/postscr.vim b/runtime/ftplugin/postscr.vim
index 3bdd2e6ffa..b4c5e06324 100644
--- a/runtime/ftplugin/postscr.vim
+++ b/runtime/ftplugin/postscr.vim
@@ -1,7 +1,8 @@
" Vim filetype plugin file
" Language: PostScript
" Maintainer: Mike Williams <mrw@eandem.co.uk>
-" Last Change: 24th April 2012
+" Last Change: 24th April 2012
+" 2024 Jan 14 by Vim Project (browsefilter)
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -25,14 +26,18 @@ if !exists("b:match_words")
endif
" Define patterns for the browse file filter
-if has("gui_win32") && !exists("b:browsefilter")
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "PostScript Files (*.ps)\t*.ps\n" .
- \ "EPS Files (*.eps)\t*.eps\n" .
- \ "All Files (*.*)\t*.*\n"
+ \ "EPS Files (*.eps)\t*.eps\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
endif
let b:undo_ftplugin = "setlocal comments< formatoptions<"
- \ . "| unlet! b:browsefiler b:match_ignorecase b:match_words"
+ \ . "| unlet! b:browsefilter b:match_ignorecase b:match_words"
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/ftplugin/ps1.vim b/runtime/ftplugin/ps1.vim
index aac3bc9903..d6ab01016b 100644
--- a/runtime/ftplugin/ps1.vim
+++ b/runtime/ftplugin/ps1.vim
@@ -2,6 +2,7 @@
" Language: Windows PowerShell
" URL: https://github.com/PProvost/vim-ps1
" Last Change: 2021 Apr 02
+" 2024 Jan 14 by Vim Project (browsefilter)
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin") | finish | endif
@@ -19,14 +20,18 @@ setlocal formatoptions=tcqro
" e.g. Get-Content or Get-ADUser
setlocal iskeyword+=-
-" Change the browse dialog on Win32 to show mainly PowerShell-related files
-if has("gui_win32")
+" Change the browse dialog on Win32 and GTK to show mainly PowerShell-related files
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter =
\ "All PowerShell Files (*.ps1, *.psd1, *.psm1, *.ps1xml)\t*.ps1;*.psd1;*.psm1;*.ps1xml\n" .
\ "PowerShell Script Files (*.ps1)\t*.ps1\n" .
\ "PowerShell Module Files (*.psd1, *.psm1)\t*.psd1;*.psm1\n" .
- \ "PowerShell XML Files (*.ps1xml)\t*.ps1xml\n" .
- \ "All Files (*.*)\t*.*\n"
+ \ "PowerShell XML Files (*.ps1xml)\t*.ps1xml\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
endif
" Look up keywords by Get-Help:
diff --git a/runtime/ftplugin/ps1xml.vim b/runtime/ftplugin/ps1xml.vim
index 837a3309b4..17bb181f37 100644
--- a/runtime/ftplugin/ps1xml.vim
+++ b/runtime/ftplugin/ps1xml.vim
@@ -2,6 +2,7 @@
" Language: Windows PowerShell
" URL: https://github.com/PProvost/vim-ps1
" Last Change: 2021 Apr 02
+" 2024 Jan 14 by Vim Project (browsefilter)
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin") | finish | endif
@@ -16,14 +17,18 @@ setlocal tw=0
setlocal commentstring=#%s
setlocal formatoptions=tcqro
-" Change the browse dialog on Win32 to show mainly PowerShell-related files
-if has("gui_win32")
+" Change the browse dialog on Win32 and GTK to show mainly PowerShell-related files
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter =
\ "All PowerShell Files (*.ps1, *.psd1, *.psm1, *.ps1xml)\t*.ps1;*.psd1;*.psm1;*.ps1xml\n" .
\ "PowerShell Script Files (*.ps1)\t*.ps1\n" .
\ "PowerShell Module Files (*.psd1, *.psm1)\t*.psd1;*.psm1\n" .
- \ "PowerShell XML Files (*.ps1xml)\t*.ps1xml\n" .
- \ "All Files (*.*)\t*.*\n"
+ \ "PowerShell XML Files (*.ps1xml)\t*.ps1xml\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
endif
" Undo the stuff we changed
diff --git a/runtime/ftplugin/pyrex.vim b/runtime/ftplugin/pyrex.vim
index 251da39df4..ec254761ec 100644
--- a/runtime/ftplugin/pyrex.vim
+++ b/runtime/ftplugin/pyrex.vim
@@ -3,6 +3,7 @@
" Maintainer: Marco Barisione <marco.bari@people.it>
" URL: http://marcobari.altervista.org/pyrex_vim.html
" Last Change: 2012 May 18
+" 2024 Jan 14 by Vim Project (browsefilter)
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -14,13 +15,17 @@ set cpo&vim
" Behaves just like Python
runtime! ftplugin/python.vim ftplugin/python_*.vim ftplugin/python/*.vim
-if has("gui_win32") && exists("b:browsefilter")
- let b:browsefilter = "Pyrex files (*.pyx,*.pxd)\t*.pyx;*.pxd\n" .
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
+ let b:browsefilter = "Pyrex files (*.pyx, *.pxd)\t*.pyx;*.pxd\n" .
\ "Python Files (*.py)\t*.py\n" .
\ "C Source Files (*.c)\t*.c\n" .
\ "C Header Files (*.h)\t*.h\n" .
- \ "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" .
- \ "All Files (*.*)\t*.*\n"
+ \ "C++ Source Files (*.cpp, *.c++)\t*.cpp;*.c++\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
endif
let &cpo = s:keepcpo
diff --git a/runtime/ftplugin/python.vim b/runtime/ftplugin/python.vim
index 000ddf52a3..79acaa6f08 100644
--- a/runtime/ftplugin/python.vim
+++ b/runtime/ftplugin/python.vim
@@ -4,6 +4,7 @@
" Previous Maintainer: James Sully <sullyj3@gmail.com>
" Previous Maintainer: Johannes Zellner <johannes@zellner.org>
" Last Change: Mon, 5 October 2020
+" 2024 Jan 14 by Vim Project (browsefilter)
" https://github.com/tpict/vim-ftplugin-python
if exists("b:did_ftplugin") | finish | endif
@@ -110,8 +111,12 @@ if !exists('*<SID>Python_jump')
endif
if has("browsefilter") && !exists("b:browsefilter")
- let b:browsefilter = "Python Files (*.py)\t*.py\n" .
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Python Files (*.py)\t*.py\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
endif
if !exists("g:python_recommended_style") || g:python_recommended_style != 0
diff --git a/runtime/ftplugin/qf.vim b/runtime/ftplugin/qf.vim
index a3dfce0e76..85fb9f6125 100644
--- a/runtime/ftplugin/qf.vim
+++ b/runtime/ftplugin/qf.vim
@@ -16,26 +16,3 @@ if !get(g:, 'qf_disable_statusline')
" Display the command that produced the list in the quickfix window:
setlocal stl=%t%{exists('w:quickfix_title')?\ '\ '.w:quickfix_title\ :\ ''}\ %=%-15(%l,%c%V%)\ %P
endif
-
-function! s:setup_toc() abort
- if get(w:, 'quickfix_title') !~# '\<TOC$' || &syntax != 'qf'
- return
- endif
-
- let list = getloclist(0)
- if empty(list)
- return
- endif
-
- let bufnr = list[0].bufnr
- setlocal modifiable
- silent %delete _
- call setline(1, map(list, 'v:val.text'))
- setlocal nomodifiable nomodified
- let &syntax = getbufvar(bufnr, '&syntax')
-endfunction
-
-augroup qf_toc
- autocmd!
- autocmd Syntax <buffer> call s:setup_toc()
-augroup END
diff --git a/runtime/ftplugin/qml.vim b/runtime/ftplugin/qml.vim
index fd5ddbb4bc..aa05c11bf9 100644
--- a/runtime/ftplugin/qml.vim
+++ b/runtime/ftplugin/qml.vim
@@ -2,6 +2,7 @@
" Language: QML
" Maintainer: Chase Knowlden <haroldknowlden@gmail.com>
" Last Change: 2023 Aug 16
+" 2023 Aug 23 by Vim Project (browsefilter)
if exists( 'b:did_ftplugin' )
finish
@@ -14,10 +15,15 @@ set cpoptions&vim
" command for undo
let b:undo_ftplugin = "setlocal formatoptions< comments< commentstring<"
-if (has("gui_win32") || has("gui_gtk")) && !exists( 'b:browsefilter' )
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter =
- \ 'QML Files (*.qml,*.qbs)\t*.qml;*.qbs\n' .
- \ 'All Files\t*\n'
+ \ "QML Files (*.qml, *.qbs)\t*.qml;*.qbs\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
+ let b:undo_ftplugin .= " | unlet! b:browsefilter"
endif
" Set 'comments' to format dashed lists in comments.
diff --git a/runtime/ftplugin/query.lua b/runtime/ftplugin/query.lua
index 964c221ad4..c75dc30430 100644
--- a/runtime/ftplugin/query.lua
+++ b/runtime/ftplugin/query.lua
@@ -1,5 +1,5 @@
-- Neovim filetype plugin file
--- Language: Tree-sitter query
+-- Language: Treesitter query
-- Last Change: 2023 Aug 23
if vim.b.did_ftplugin == 1 then
diff --git a/runtime/ftplugin/r.vim b/runtime/ftplugin/r.vim
index 28966368cb..6b07744c4a 100644
--- a/runtime/ftplugin/r.vim
+++ b/runtime/ftplugin/r.vim
@@ -1,8 +1,9 @@
" Vim filetype plugin file
-" Language: R
-" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Sun Apr 24, 2022 09:14AM
+" Language: R
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
+" Former Repository: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: 2024 Feb 28 by Vim Project
" Only do this when not yet done for this buffer
if exists("b:did_ftplugin")
@@ -22,8 +23,12 @@ setlocal comments=:#',:###,:##,:#
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "R Source Files (*.R)\t*.R\n" .
- \ "Files that include R (*.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" .
- \ "All Files (*.*)\t*.*\n"
+ \ "Files that include R (*.Rnw, *.Rd, *.Rmd, *.Rrst, *.qmd)\t*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
endif
let b:undo_ftplugin = "setl cms< com< fo< isk< | unlet! b:browsefilter"
diff --git a/runtime/ftplugin/racket.vim b/runtime/ftplugin/racket.vim
index 3aa413397e..84f5422140 100644
--- a/runtime/ftplugin/racket.vim
+++ b/runtime/ftplugin/racket.vim
@@ -4,6 +4,7 @@
" Previous Maintainer: Will Langstroth <will@langstroth.com>
" URL: https://github.com/benknoble/vim-racket
" Last Change: 2022 Aug 29
+" 2024 Jan 14 by Vim Project (browsefilter)
if exists("b:did_ftplugin")
finish
@@ -68,8 +69,12 @@ endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter =
- \ "Racket Source Files (*.rkt *.rktl)\t*.rkt;*.rktl\n"
- \. "All Files (*.*)\t*.*\n"
+ \ "Racket Source Files (*.rkt, *.rktl)\t*.rkt;*.rktl\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin .= " | unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/readline.vim b/runtime/ftplugin/readline.vim
index 181d8ac661..f5934ce2c0 100644
--- a/runtime/ftplugin/readline.vim
+++ b/runtime/ftplugin/readline.vim
@@ -2,7 +2,7 @@
" Language: readline(3) configuration file
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Last Change: 2022 Dec 09
+" Last Change: 2023 Aug 22
if exists("b:did_ftplugin")
finish
@@ -25,8 +25,12 @@ if exists("loaded_matchit") && !exists("b:match_words")
endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Readline Initialization Files (inputrc .inputrc)\tinputrc;*.inputrc\n" ..
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Readline Intialization Files (inputrc, .inputrc)\tinputrc;*.inputrc\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/registry.vim b/runtime/ftplugin/registry.vim
index 385785ac60..bb851c5491 100644
--- a/runtime/ftplugin/registry.vim
+++ b/runtime/ftplugin/registry.vim
@@ -2,6 +2,7 @@
" Language: Windows Registry export with regedit (*.reg)
" Maintainer: Cade Forester <ahx2323@gmail.com>
" Latest Revision: 2014-01-09
+" 2024 Jan 14 by Vim Project (browsefilter)
if exists("b:did_ftplugin")
finish
@@ -12,18 +13,22 @@ let s:cpo_save = &cpo
set cpo&vim
let b:undo_ftplugin =
- \ 'let b:browsefilter = "" | ' .
\ 'setlocal ' .
\ 'comments< '.
\ 'commentstring< ' .
- \ 'formatoptions< '
+ \ 'formatoptions<'
-if has( 'gui_win32' )
+if ( has( 'gui_win32' ) || has( 'gui_gtk' ) )
\ && !exists( 'b:browsefilter' )
let b:browsefilter =
- \ 'registry files (*.reg)\t*.reg\n' .
- \ 'All files (*.*)\t*.*\n'
+ \ "registry files (*.reg)\t*.reg\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
+ let b:undo_ftplugin .= " | unlet! b:browsefilter"
endif
setlocal comments=:;
diff --git a/runtime/ftplugin/rhelp.vim b/runtime/ftplugin/rhelp.vim
index 2fde4875c6..0fa1e56573 100644
--- a/runtime/ftplugin/rhelp.vim
+++ b/runtime/ftplugin/rhelp.vim
@@ -1,8 +1,9 @@
" Vim filetype plugin file
-" Language: R help file
-" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Sun Apr 24, 2022 09:12AM
+" Language: R help file
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
+" Former Repository: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: 2024 Feb 28 by Vim Project
" Only do this when not yet done for this buffer
if exists("b:did_ftplugin")
@@ -18,8 +19,12 @@ set cpo&vim
setlocal iskeyword=@,48-57,_,.
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" .
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "R Source Files (*.R, *.Rnw, *.Rd, *.Rmd, *.Rrst, *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
endif
let b:undo_ftplugin = "setl isk< | unlet! b:browsefilter"
diff --git a/runtime/ftplugin/rmd.vim b/runtime/ftplugin/rmd.vim
index a407c236dd..a537017aad 100644
--- a/runtime/ftplugin/rmd.vim
+++ b/runtime/ftplugin/rmd.vim
@@ -1,8 +1,9 @@
" Vim filetype plugin file
-" Language: R Markdown file
-" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Mon May 29, 2023 06:31AM
+" Language: R Markdown file
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
+" Former Repository: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: 2024 Feb 28 by Vim Project
" Original work by Alex Zvoleff (adjusted from R help for rmd by Michel Kuhlmann)
" Only do this when not yet done for this buffer
@@ -64,8 +65,12 @@ runtime ftplugin/pandoc.vim
let b:did_ftplugin = 1
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" .
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "R Source Files (*.R, *.Rnw, *.Rd, *.Rmd, *.Rrst, *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
endif
if exists('b:undo_ftplugin')
diff --git a/runtime/ftplugin/rnoweb.vim b/runtime/ftplugin/rnoweb.vim
index 26c1ab4e3f..8dfdf1e80f 100644
--- a/runtime/ftplugin/rnoweb.vim
+++ b/runtime/ftplugin/rnoweb.vim
@@ -1,8 +1,9 @@
" Vim filetype plugin file
-" Language: Rnoweb
-" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Mon Feb 27, 2023 07:16PM
+" Language: Rnoweb
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
+" Former Repository: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: 2024 Feb 28 by Vim Project
" Only do this when not yet done for this buffer
if exists("b:did_ftplugin")
@@ -25,8 +26,12 @@ setlocal suffixesadd=.bib,.tex
setlocal comments=b:%,b:#,b:##,b:###,b:#'
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" .
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "R Source Files (*.R, *.Rnw, *.Rd, *.Rmd, *.Rrst, *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
endif
function SetRnwCommentStr()
diff --git a/runtime/ftplugin/routeros.vim b/runtime/ftplugin/routeros.vim
index c6e4799aa2..9cd0b10344 100644
--- a/runtime/ftplugin/routeros.vim
+++ b/runtime/ftplugin/routeros.vim
@@ -2,6 +2,7 @@
" Language: MikroTik RouterOS Script
" Maintainer: zainin <z@wintr.dev>
" Last Change: 2021 Nov 14
+" 2024 Jan 14 by Vim Project (browsefilter)
if exists("b:did_ftplugin")
finish
@@ -18,8 +19,12 @@ setlocal formatoptions-=t formatoptions+=croql
let b:undo_ftplugin = "setlocal com< cms< fo<"
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "RouterOS Script Files (*.rsc)\t*.rsc\n" ..
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "RouterOS Script Files (*.rsc)\t*.rsc\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/rrst.vim b/runtime/ftplugin/rrst.vim
index d9df5e587f..d088f98224 100644
--- a/runtime/ftplugin/rrst.vim
+++ b/runtime/ftplugin/rrst.vim
@@ -1,8 +1,9 @@
" Vim filetype plugin file
-" Language: reStructuredText documentation format with R code
-" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Mon Feb 27, 2023 07:16PM
+" Language: reStructuredText documentation format with R code
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
+" Former Repository: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: 2024 Feb 28 by Vim Project
" Original work by Alex Zvoleff
" Only do this when not yet done for this buffer
@@ -38,8 +39,12 @@ if !exists("g:rrst_dynamic_comments") || (exists("g:rrst_dynamic_comments") && g
endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" .
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "R Source Files (*.R, *.Rnw, *.Rd, *.Rmd, *.Rrst, *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
endif
if exists('b:undo_ftplugin')
diff --git a/runtime/ftplugin/ruby.vim b/runtime/ftplugin/ruby.vim
index b61c1765d9..ab0a32576c 100644
--- a/runtime/ftplugin/ruby.vim
+++ b/runtime/ftplugin/ruby.vim
@@ -2,8 +2,8 @@
" Language: Ruby
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" URL: https://github.com/vim-ruby/vim-ruby
-" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2023 Sep 1st
+" Last Change: 2023 Dec 31
+" 2024 Jan 14 by Vim Project (browsefilter)
if (exists("b:did_ftplugin"))
finish
@@ -60,35 +60,38 @@ if !exists('g:ruby_version_paths')
let g:ruby_version_paths = {}
endif
+let s:path_split = has('win32') ? ';' : ':'
+
function! s:query_path(root) abort
- " Disabled by default for security reasons.
- if !get(g:, 'ruby_exec', get(g:, 'plugin_exec', 0))
- return []
+ " Disabled by default for security reasons.
+ if !get(g:, 'ruby_exec', get(g:, 'plugin_exec', 0)) || empty(a:root)
+ return map(split($RUBYLIB, s:path_split), 'v:val ==# "." ? "" : v:val')
endif
let code = "print $:.join %q{,}"
- if &shell =~# 'sh' && empty(&shellxquote)
- let prefix = 'env PATH='.shellescape($PATH).' '
- else
- let prefix = ''
- endif
if &shellxquote == "'"
- let path_check = prefix.'ruby --disable-gems -e "' . code . '"'
+ let args = ' --disable-gems -e "' . code . '"'
else
- let path_check = prefix."ruby --disable-gems -e '" . code . "'"
+ let args = " --disable-gems -e '" . code . "'"
endif
- let cd = haslocaldir() ? 'lcd' : 'cd'
+ let cd = haslocaldir() ? 'lcd' : exists(':tcd') && haslocaldir(-1) ? 'tcd' : 'cd'
let cwd = fnameescape(getcwd())
try
exe cd fnameescape(a:root)
- let s:tmp_cwd = getcwd()
- if (fnamemodify(exepath('ruby'), ':p:h') ==# cwd
- \ && (index(split($PATH,has("win32")? ';' : ':'), s:tmp_cwd) == -1 || s:tmp_cwd == '.'))
- let path = []
+ for dir in split($PATH, s:path_split)
+ if dir !=# '.' && executable(dir . '/ruby') == 1
+ let exepath = dir . '/ruby'
+ break
+ endif
+ endfor
+ if exists('l:exepath')
+ let path = split(system(exepath . args),',')
+ if v:shell_error
+ let path = []
+ endif
else
- let path = split(system(path_check),',')
+ let path = []
endif
- unlet! s:tmp_cwd
exe cd cwd
return path
finally
@@ -129,10 +132,8 @@ else
if !exists('g:ruby_default_path')
if has("ruby") && has("win32")
ruby ::VIM::command( 'let g:ruby_default_path = split("%s",",")' % $:.join(%q{,}) )
- elseif executable('ruby') && !empty($HOME)
- let g:ruby_default_path = s:query_path($HOME)
else
- let g:ruby_default_path = map(split($RUBYLIB,':'), 'v:val ==# "." ? "" : v:val')
+ let g:ruby_default_path = s:query_path($HOME)
endif
endif
let s:ruby_paths = g:ruby_default_path
@@ -147,8 +148,12 @@ if exists('s:ruby_paths') && stridx(&l:tags, join(map(copy(s:ruby_paths),'v:val.
endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Ruby Source Files (*.rb)\t*.rb\n" .
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Ruby Source Files (*.rb)\t*.rb\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
endif
let b:undo_ftplugin = "setl inc= sua= path= tags= fo< com< cms< kp="
diff --git a/runtime/ftplugin/sass.vim b/runtime/ftplugin/sass.vim
index 9ce446137a..e650be9312 100644
--- a/runtime/ftplugin/sass.vim
+++ b/runtime/ftplugin/sass.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: Sass
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2019 Dec 05
+" Last Change: 2023 Dec 28
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -23,6 +23,11 @@ if &filetype =~# '\<s[ac]ss]\>'
let b:undo_ftplugin .= ' isk<'
endif
+if get(g:, 'sass_recommended_style', 1)
+ setlocal shiftwidth=2 softtabstop=2 expandtab
+ let b:undo_ftplugin .= ' sw< sts< et<'
+endif
+
let &l:define = '^\C\v\s*%(\@function|\@mixin|\=)|^\s*%(\$[[:alnum:]-]+:|[%.][:alnum:]-]+\s*%(\{|$))@='
let &l:include = '^\s*@import\s\+\%(url(\)\=["'']\='
diff --git a/runtime/ftplugin/sbt.vim b/runtime/ftplugin/sbt.vim
index 309d30e503..bf2c7a657a 100644
--- a/runtime/ftplugin/sbt.vim
+++ b/runtime/ftplugin/sbt.vim
@@ -9,7 +9,6 @@ if exists('b:did_ftplugin') || &cp
finish
endif
-let b:did_ftplugin = 1
-
runtime! ftplugin/scala.vim
+let b:did_ftplugin = 1
diff --git a/runtime/ftplugin/sed.vim b/runtime/ftplugin/sed.vim
index 0073872877..acd089089a 100644
--- a/runtime/ftplugin/sed.vim
+++ b/runtime/ftplugin/sed.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: sed
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2020 Apr 1
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -18,8 +18,12 @@ setlocal formatoptions-=t formatoptions+=croql
let b:undo_ftplugin = "setl com< cms< fo<"
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "sed Script Files (*.sed)\t*.sed\n" ..
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "sed Script Files (*.sed)\t*.sed\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/sgml.vim b/runtime/ftplugin/sgml.vim
index ef52125c68..b6dbf1a0d1 100644
--- a/runtime/ftplugin/sgml.vim
+++ b/runtime/ftplugin/sgml.vim
@@ -1,10 +1,11 @@
" Vim filetype plugin file
-" Language: sgml
+" Language: sgml
"
" This runtime file is looking for a new maintainer.
"
" Former maintainer: Dan Sharp
-" Last Changed: 20 Jan 2009
+" Last Change: 2009 Jan 20
+" 2024 Jan 14 by Vim Project (browsefilter)
if exists("b:did_ftplugin") | finish | endif
@@ -15,8 +16,12 @@ set cpo-=C
" Define some defaults in case the included ftplugins don't set them.
let s:undo_ftplugin = ""
-let s:browsefilter = "XML Files (*.xml)\t*.xml\n" .
- \ "All Files (*.*)\t*.*\n"
+let s:browsefilter = "XML Files (*.xml)\t*.xml\n"
+if has("win32")
+ let s:browsefilter .= "All Files (*.*)\t*\n"
+else
+ let s:browsefilter .= "All Files (*)\t*\n"
+endif
runtime! ftplugin/xml.vim ftplugin/xml_*.vim ftplugin/xml/*.vim
let b:did_ftplugin = 1
@@ -30,7 +35,7 @@ if exists("b:browsefilter")
endif
" Change the :browse e filter to primarily show xml-related files.
-if has("gui_win32")
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter="SGML Files (*.sgml,*.sgm)\t*.sgm*\n" . s:browsefilter
endif
diff --git a/runtime/ftplugin/sh.vim b/runtime/ftplugin/sh.vim
index c1a6bc5ade..6d2093bf83 100644
--- a/runtime/ftplugin/sh.vim
+++ b/runtime/ftplugin/sh.vim
@@ -4,7 +4,7 @@
" Previous Maintainer: Dan Sharp
" Contributor: Enno Nagel <ennonagel+vim@gmail.com>
" Eisuke Kawashima
-" Last Change: 2023 Sep 28
+" Last Change: 2024 Feb 27
if exists("b:did_ftplugin")
finish
@@ -14,7 +14,7 @@ let b:did_ftplugin = 1
let s:save_cpo = &cpo
set cpo-=C
-setlocal comments=:#
+setlocal comments=b:#
setlocal commentstring=#\ %s
setlocal formatoptions-=t formatoptions+=croql
@@ -33,10 +33,14 @@ if exists("loaded_matchit") && !exists("b:match_words")
endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Bourne Shell Scripts (*.sh)\t*.sh\n" ..
- \ "Korn Shell Scripts (*.ksh)\t*.ksh\n" ..
- \ "Bash Shell Scripts (*.bash)\t*.bash\n" ..
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Bourne Shell Scripts (*.sh)\t*.sh\n" ..
+ \ "Korn Shell Scripts (*.ksh)\t*.ksh\n" ..
+ \ "Bash Shell Scripts (*.bash)\t*.bash\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/solution.vim b/runtime/ftplugin/solution.vim
index bd30c7bb19..19ec392ec5 100644
--- a/runtime/ftplugin/solution.vim
+++ b/runtime/ftplugin/solution.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Microsoft Visual Studio Solution
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2021 Dec 15
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -26,8 +26,12 @@ if exists("loaded_matchit") && !exists("b:match_words")
endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Microsoft Visual Studio Solution Files\t*.sln\n" ..
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Microsoft Visual Studio Solution Files(*.sln)\t*.sln\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/sql.vim b/runtime/ftplugin/sql.vim
index 7a29d39f8e..c85232f51b 100644
--- a/runtime/ftplugin/sql.vim
+++ b/runtime/ftplugin/sql.vim
@@ -3,6 +3,7 @@
" Version: 12.0
" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
" Last Change: 2017 Mar 07
+" 2024 Jan 14 by Vim Project (browsefilter)
" Download: http://vim.sourceforge.net/script.php?script_id=454
" For more details please use:
@@ -272,10 +273,14 @@ let b:undo_ftplugin = "setl comments< formatoptions< define< omnifunc<" .
let b:did_ftplugin = 1
let b:current_ftplugin = 'sql'
-" Win32 can filter files in the browse dialog
-if has("gui_win32") && !exists("b:browsefilter")
- let b:browsefilter = "SQL Files (*.sql)\t*.sql\n" .
- \ "All Files (*.*)\t*.*\n"
+" Win32 and GTK can filter files in the browse dialog
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
+ let b:browsefilter = "SQL Files (*.sql)\t*.sql\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
endif
" Some standard expressions for use with the matchit strings
diff --git a/runtime/ftplugin/svg.vim b/runtime/ftplugin/svg.vim
index 6f16b1a0f4..4ee9e4b77b 100644
--- a/runtime/ftplugin/svg.vim
+++ b/runtime/ftplugin/svg.vim
@@ -1,10 +1,11 @@
" Vim filetype plugin file
-" Language: svg
+" Language: svg
"
" This runtime file is looking for a new maintainer.
"
" Former maintainer: Dan Sharp
-" Last Changed: 20 Jan 2009
+" Last Change: 2009 Jan 20
+" 2024 Jan 14 by Vim Project (browsefilter)
if exists("b:did_ftplugin") | finish | endif
@@ -15,8 +16,12 @@ set cpo-=C
" Define some defaults in case the included ftplugins don't set them.
let s:undo_ftplugin = ""
-let s:browsefilter = "XML Files (*.xml)\t*.xml\n" .
- \ "All Files (*.*)\t*.*\n"
+let s:browsefilter = "XML Files (*.xml)\t*.xml\n"
+if has("win32")
+ let s:browsefilter .= "All Files (*.*)\t*\n"
+else
+ let s:browsefilter .= "All Files (*)\t*\n"
+endif
runtime! ftplugin/xml.vim ftplugin/xml_*.vim ftplugin/xml/*.vim
let b:did_ftplugin = 1
@@ -30,7 +35,7 @@ if exists("b:browsefilter")
endif
" Change the :browse e filter to primarily show xml-related files.
-if has("gui_win32")
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter="SVG Files (*.svg)\t*.svg\n" . s:browsefilter
endif
diff --git a/runtime/ftplugin/tcl.vim b/runtime/ftplugin/tcl.vim
index 1cc24d341e..fa900096c0 100644
--- a/runtime/ftplugin/tcl.vim
+++ b/runtime/ftplugin/tcl.vim
@@ -2,6 +2,7 @@
" Language: Tcl
" Maintainer: Robert L Hicks <sigzero@gmail.com>
" Latest Revision: 2009-05-01
+" 2024 Jan 14 by Vim Project (browsefilter)
if exists("b:did_ftplugin")
finish
@@ -18,10 +19,14 @@ setlocal commentstring=#%s
setlocal formatoptions+=croql
" Change the browse dialog on Windows to show mainly Tcl-related files
-if has("gui_win32")
- let b:browsefilter = "Tcl Source Files (.tcl)\t*.tcl\n" .
- \ "Tcl Test Files (.test)\t*.test\n" .
- \ "All Files (*.*)\t*.*\n"
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
+ let b:browsefilter = "Tcl Source Files (*.tcl)\t*.tcl\n" .
+ \ "Tcl Test Files (*.test)\t*.test\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
endif
"-----------------------------------------------------------------------------
diff --git a/runtime/ftplugin/tcsh.vim b/runtime/ftplugin/tcsh.vim
index b2467b43a2..74095aabe2 100644
--- a/runtime/ftplugin/tcsh.vim
+++ b/runtime/ftplugin/tcsh.vim
@@ -2,7 +2,7 @@
" Language: tcsh
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Dan Sharp
-" Last Change: 2023 Oct 09
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -13,8 +13,12 @@ set cpo-=C
" Define some defaults in case the included ftplugins don't set them.
let s:undo_ftplugin = ""
-let s:browsefilter = "csh Files (*.csh)\t*.csh\n" ..
- \ "All Files (*.*)\t*.*\n"
+let s:browsefilter = "csh Files (*.csh)\t*.csh\n"
+if has("win32")
+ let s:browsefilter ..= "All Files (*.*)\t*\n"
+else
+ let s:browsefilter ..= "All Files (*)\t*\n"
+endif
runtime! ftplugin/csh.vim ftplugin/csh_*.vim ftplugin/csh/*.vim
let b:did_ftplugin = 1
diff --git a/runtime/ftplugin/tidy.vim b/runtime/ftplugin/tidy.vim
index b81b66db4a..9a613799af 100644
--- a/runtime/ftplugin/tidy.vim
+++ b/runtime/ftplugin/tidy.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: HTML Tidy Configuration
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2020 Sep 4
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -15,17 +15,21 @@ setlocal comments=:#,://
setlocal commentstring=#\ %s
setlocal formatoptions-=t formatoptions+=croql
+let b:undo_ftplugin = "setl fo< com< cms<"
+
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "HTML Tidy Files (tidyrc, .tidyrc, tidy.conf)\ttidyrc;.tidyrc;tidy.conf\n" .
\ "HTML Files (*.html, *.htm)\t*.html;*.htm\n" .
\ "XHTML Files (*.xhtml, *.xhtm)\t*.xhtml;*.xhtm\n" .
- \ "XML Files (*.xml)\t*.xml\n" .
- \ "All Files (*.*)\t*.*\n"
+ \ "XML Files (*.xml)\t*.xml\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
+ let b:undo_ftplugin .= " | unlet! b:browsefilter"
endif
-let b:undo_ftplugin = "setl fo< com< cms<" .
- \ " | unlet! b:browsefilter"
-
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/ftplugin/typescript.vim b/runtime/ftplugin/typescript.vim
index f701ae96cd..680521df31 100644
--- a/runtime/ftplugin/typescript.vim
+++ b/runtime/ftplugin/typescript.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: TypeScript
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2019 Aug 30
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -22,6 +22,8 @@ setlocal commentstring=//%s
setlocal suffixesadd+=.ts,.d.ts,.tsx,.js,.jsx,.cjs,.mjs
+let b:undo_ftplugin = "setl fo< com< cms< sua<"
+
" Change the :browse e filter to primarily show TypeScript-related files.
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter="TypeScript Files (*.ts)\t*.ts\n" .
@@ -29,11 +31,14 @@ if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
\ "TSX Files (*.tsx)\t*.tsx\n" .
\ "JavaScript Files (*.js)\t*.js\n" .
\ "JavaScript Modules (*.es, *.cjs, *.mjs)\t*.es;*.cjs;*.mjs\n" .
- \ "JSON Files (*.json)\t*.json\n" .
- \ "All Files (*.*)\t*.*\n"
+ \ "JSON Files (*.json)\t*.json\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
+ let b:undo_ftplugin .= " | unlet! b:browsefilter"
endif
-let b:undo_ftplugin = "setl fo< com< cms< sua< | unlet! b:browsefilter"
-
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/ftplugin/vb.vim b/runtime/ftplugin/vb.vim
index 5a9548115b..94a2f35ff3 100644
--- a/runtime/ftplugin/vb.vim
+++ b/runtime/ftplugin/vb.vim
@@ -2,7 +2,7 @@
" Language: Visual Basic (ft=vb)
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Johannes Zellner <johannes@zellner.org>
-" Last Change: 2021 Nov 17
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -62,8 +62,12 @@ endif
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "Visual Basic Source Files (*.bas)\t*.bas\n" .
- \ "Visual Basic Form Files (*.frm)\t*.frm\n" .
- \ "All Files (*.*)\t*.*\n"
+ \ "Visual Basic Form Files (*.frm)\t*.frm\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin .= " | unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/verilog.vim b/runtime/ftplugin/verilog.vim
index cbf30a3185..83c3754e05 100644
--- a/runtime/ftplugin/verilog.vim
+++ b/runtime/ftplugin/verilog.vim
@@ -2,6 +2,7 @@
" Language: Verilog HDL
" Maintainer: Chih-Tsun Huang <cthuang@cs.nthu.edu.tw>
" Last Change: 2017 Aug 25 by Chih-Tsun Huang
+" 2024 Jan 14 by Vim Project (browsefilter)
" URL: http://www.cs.nthu.edu.tw/~cthuang/vim/ftplugin/verilog.vim
"
" Credits:
@@ -36,10 +37,14 @@ if &textwidth == 0
setlocal tw=78
endif
-" Win32 can filter files in the browse dialog
-if has("gui_win32") && !exists("b:browsefilter")
- let b:browsefilter = "Verilog Source Files (*.v)\t*.v\n" .
- \ "All Files (*.*)\t*.*\n"
+" Win32 and GTK can filter files in the browse dialog
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
+ let b:browsefilter = "Verilog Source Files (*.v)\t*.v\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
endif
" Let the matchit plugin know what items can be matched.
diff --git a/runtime/ftplugin/vhdl.vim b/runtime/ftplugin/vhdl.vim
index ff56166ebe..3850c70d50 100644
--- a/runtime/ftplugin/vhdl.vim
+++ b/runtime/ftplugin/vhdl.vim
@@ -3,6 +3,7 @@
" Maintainer: R.Shankar <shankar.pec?gmail.com>
" Modified By: Gerald Lai <laigera+vim?gmail.com>
" Last Change: 2011 Dec 11
+" 2024 Jan 14 by Vim Project (browsefilter)
" 2023 Aug 28 by Vim Project (undo_ftplugin, commentstring)
" Only do this when not done yet for this buffer
@@ -28,14 +29,15 @@ setlocal commentstring=--\ %s
" Format comments to be up to 78 characters long
"setlocal tw=75
-" let b:undo_ftplugin = "setl cms< com< fo< tw<"
-
let b:undo_ftplugin = "setl cms< "
-" Win32 can filter files in the browse dialog
-"if has("gui_win32") && !exists("b:browsefilter")
-" let b:browsefilter = "Verilog Source Files (*.v)\t*.v\n" .
-" \ "All Files (*.*)\t*.*\n"
+" Win32 and GTK can filter files in the browse dialog
+"if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
+" if has("win32")
+" let b:browsefilter ..= "All Files (*.*)\t*\n"
+" else
+" let b:browsefilter ..= "All Files (*)\t*\n"
+" endif
" let b:undo_ftplugin .= " | unlet! b:browsefilter"
"endif
diff --git a/runtime/ftplugin/vim.vim b/runtime/ftplugin/vim.vim
index 06369e8a82..f5dae0f94e 100644
--- a/runtime/ftplugin/vim.vim
+++ b/runtime/ftplugin/vim.vim
@@ -49,18 +49,17 @@ setlocal isk+=#
" Use :help to lookup the keyword under the cursor with K.
setlocal keywordprg=:help
-" if "\n" .. getline(1, 10)->join("\n") =~# '\n\s*vim9\%[script]\>'
-if "\n" .. join(getline(1, 10), "\n") =~# '\n\s*vim9\%[script]\>'
- " Set 'comments' to format dashed lists in comments
- setlocal com=sO:#\ -,mO:#\ \ ,eO:##,:#
- " Comments starts with # in Vim9 script
+" Comments starts with # in Vim9 script. We have to guess which one to use.
+if "\n" .. getline(1, 10)->join("\n") =~# '\n\s*vim9\%[script]\>'
setlocal commentstring=#%s
else
- setlocal com=sO:\"\ -,mO:\"\ \ ,eO:\"\",:\"
- " Comments starts with a double quote in legacy script
setlocal commentstring=\"%s
endif
+" Set 'comments' to format dashed lists in comments, both in Vim9 and legacy
+" script.
+setlocal com=sO:#\ -,mO:#\ \ ,eO:##,:#\\\ ,:#,sO:\"\ -,mO:\"\ \ ,eO:\"\",:\"\\\ ,:\"
+
" Format comments to be up to 78 characters long
if &tw == 0
diff --git a/runtime/ftplugin/wget.vim b/runtime/ftplugin/wget.vim
index db3b62191e..c7fdec292e 100644
--- a/runtime/ftplugin/wget.vim
+++ b/runtime/ftplugin/wget.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Wget configuration file (/etc/wgetrc ~/.wgetrc)
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2022 Apr 28
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -18,8 +18,12 @@ setlocal formatoptions-=t formatoptions+=croql
let b:undo_ftplugin = "setl fo< com< cms<"
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Wget Configuration File (wgetrc, .wgetrc)\twgetrc;.wgetrc\n" ..
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Wget Configuration File (wgetrc, .wgetrc)\twgetrc;.wgetrc\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/wget2.vim b/runtime/ftplugin/wget2.vim
index 8cfcd514e5..40da5c502a 100644
--- a/runtime/ftplugin/wget2.vim
+++ b/runtime/ftplugin/wget2.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Wget2 configuration file (/etc/wget2rc ~/.wget2rc)
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2022 Apr 28
+" Last Change: 2024 Jan 14
if exists("b:did_ftplugin")
finish
@@ -18,8 +18,12 @@ setlocal formatoptions-=t formatoptions+=croql
let b:undo_ftplugin = "setl fo< com< cms<"
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Wget2 Configuration File (wget2rc, .wget2rc)\twget2rc;.wget2rc\n" ..
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Wget2 Configuration File (wget2rc, .wget2rc)\twget2rc;.wget2rc\n"
+ if has("win32")
+ let b:browsefilter ..= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter ..= "All Files (*)\t*\n"
+ endif
let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
diff --git a/runtime/ftplugin/xhtml.vim b/runtime/ftplugin/xhtml.vim
index d2a1c0b566..8a45ba76b1 100644
--- a/runtime/ftplugin/xhtml.vim
+++ b/runtime/ftplugin/xhtml.vim
@@ -1,10 +1,11 @@
" Vim filetype plugin file
-" Language: xhtml
+" Language: xhtml
"
" This runtime file is looking for a new maintainer.
"
" Former maintainer: Dan Sharp
-" Last Changed: 20 Jan 2009
+" Last Changed: 2009 Jan 20
+" 2024 Jan 14 by Vim Project (browsefilter)
if exists("b:did_ftplugin") | finish | endif
@@ -16,8 +17,12 @@ set cpo-=C
" Define some defaults in case the included ftplugins don't set them.
let s:undo_ftplugin = ""
let s:browsefilter = "HTML Files (*.html, *.htm)\t*.html;*.htm\n" .
- \ "XML Files (*.xml)\t*.xml\n" .
- \ "All Files (*.*)\t*.*\n"
+ \ "XML Files (*.xml)\t*.xml\n"
+if has("win32")
+ let s:browsefilter .= "All Files (*.*)\t*\n"
+else
+ let s:browsefilter .= "All Files (*)\t*\n"
+endif
let s:match_words = ""
runtime! ftplugin/xml.vim ftplugin/xml_*.vim ftplugin/xml/*.vim
@@ -57,7 +62,7 @@ if exists("loaded_matchit")
endif
" Change the :browse e filter to primarily show tcsh-related files.
-if has("gui_win32")
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter="XHTML files (*.xhtml, *.xhtm)\t*.xhtml;*.xhtm\n" . s:browsefilter
endif
diff --git a/runtime/ftplugin/xml.vim b/runtime/ftplugin/xml.vim
index 9aa188cecc..b81c3980d2 100644
--- a/runtime/ftplugin/xml.vim
+++ b/runtime/ftplugin/xml.vim
@@ -2,6 +2,7 @@
" Language: xml
" Maintainer: Christian Brabandt <cb@256bit.org>
" Last Changed: Dec 07th, 2018
+" 2024 Jan 14 by Vim Project (browsefilter)
" Repository: https://github.com/chrisbra/vim-xml-ftplugin
" Previous Maintainer: Dan Sharp
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
@@ -52,8 +53,12 @@ command! -nargs=? XMLent call xmlcomplete#CreateEntConnection(<f-args>)
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter="XML Files (*.xml)\t*.xml\n" .
\ "DTD Files (*.dtd)\t*.dtd\n" .
- \ "XSD Files (*.xsd)\t*.xsd\n" .
- \ "All Files (*.*)\t*.*\n"
+ \ "XSD Files (*.xsd)\t*.xsd\n"
+ if has("win32")
+ let b:browsefilter .= "All Files (*.*)\t*\n"
+ else
+ let b:browsefilter .= "All Files (*)\t*\n"
+ endif
endif
" Undo the stuff we changed.
diff --git a/runtime/ftplugin/xsd.vim b/runtime/ftplugin/xsd.vim
index 7d3efbb390..aaec8a0f7d 100644
--- a/runtime/ftplugin/xsd.vim
+++ b/runtime/ftplugin/xsd.vim
@@ -1,10 +1,11 @@
" Vim filetype plugin file
-" Language: xsd
+" Language: xsd
"
" This runtime file is looking for a new maintainer.
"
" Former maintainer: Dan Sharp
-" Last Changed: 20 Jan 2009
+" Last Changed: 2009 Jan 20
+" 2024 Jan 14 by Vim Project (browsefilter)
if exists("b:did_ftplugin") | finish | endif
@@ -15,8 +16,12 @@ set cpo-=C
" Define some defaults in case the included ftplugins don't set them.
let s:undo_ftplugin = ""
-let s:browsefilter = "XML Files (*.xml)\t*.xml\n" .
- \ "All Files (*.*)\t*.*\n"
+let s:browsefilter = "XML Files (*.xml)\t*.xml\n"
+if has("win32")
+ let s:browsefilter .= "All Files (*.*)\t*\n"
+else
+ let s:browsefilter .= "All Files (*)\t*\n"
+endif
runtime! ftplugin/xml.vim ftplugin/xml_*.vim ftplugin/xml/*.vim
let b:did_ftplugin = 1
@@ -30,7 +35,7 @@ if exists("b:browsefilter")
endif
" Change the :browse e filter to primarily show xsd-related files.
-if has("gui_win32")
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter="XSD Files (*.xsd)\t*.xsd\n" . s:browsefilter
endif
diff --git a/runtime/ftplugin/xslt.vim b/runtime/ftplugin/xslt.vim
index 47e78eb81d..70986c9e48 100644
--- a/runtime/ftplugin/xslt.vim
+++ b/runtime/ftplugin/xslt.vim
@@ -14,5 +14,5 @@ let b:did_ftplugin = 1
" Change the :browse e filter to primarily show xsd-related files.
if (has("gui_win32") || has("gui_gtk")) && exists("b:browsefilter")
- let b:browsefilter = "XSLT Files (*.xsl,*.xslt)\t*.xsl;*.xslt\n" . b:browsefilter
+ let b:browsefilter = "XSLT Files (*.xsl, *.xslt)\t*.xsl;*.xslt\n" . b:browsefilter
endif
diff --git a/runtime/indent/cmake.vim b/runtime/indent/cmake.vim
index af27c0d49b..c1aa3bff86 100644
--- a/runtime/indent/cmake.vim
+++ b/runtime/indent/cmake.vim
@@ -3,9 +3,9 @@
" Author: Andy Cedilnik <andy.cedilnik@kitware.com>
" Maintainer: Dimitri Merejkowsky <d.merej@gmail.com>
" Former Maintainer: Karthik Krishnan <karthik.krishnan@kitware.com>
-" Last Change: 2022 Apr 06
+" Last Change: 2023 Dec 12
"
-" Licence: The CMake license applies to this file. See
+" License: The CMake license applies to this file. See
" https://cmake.org/licensing
" This implies that distribution with Vim is allowed
@@ -55,32 +55,41 @@ fun! CMakeGetIndent(lnum)
let cmake_indent_open_regex = '^\s*' . cmake_regex_identifier .
\ '\s*(' . cmake_regex_arguments .
\ '\(' . cmake_regex_comment . '\)\?$'
-
let cmake_indent_close_regex = '^' . cmake_regex_arguments .
\ ')\s*' .
\ '\(' . cmake_regex_comment . '\)\?$'
- let cmake_indent_begin_regex = '^\s*\(IF\|MACRO\|FOREACH\|ELSE\|ELSEIF\|WHILE\|FUNCTION\)\s*('
- let cmake_indent_end_regex = '^\s*\(ENDIF\|ENDFOREACH\|ENDMACRO\|ELSE\|ELSEIF\|ENDWHILE\|ENDFUNCTION\)\s*('
+ let cmake_closing_parens_line = '^\s*\()\+\)\s*$'
- " Add
- if previous_line =~? cmake_indent_comment_line " Handle comments
- let ind = ind
- else
- if previous_line =~? cmake_indent_begin_regex
- let ind = ind + shiftwidth()
+ let cmake_indent_begin_regex = '^\s*\(BLOCK\|IF\|MACRO\|FOREACH\|ELSE\|ELSEIF\|WHILE\|FUNCTION\)\s*('
+ let cmake_indent_end_regex = '^\s*\(ENDBLOCK\|ENDIF\|ENDFOREACH\|ENDMACRO\|ELSE\|ELSEIF\|ENDWHILE\|ENDFUNCTION\)\s*('
+
+ if this_line =~? cmake_closing_parens_line
+ if previous_line !~? cmake_indent_open_regex
+ let ind = ind - shiftwidth()
endif
- if previous_line =~? cmake_indent_open_regex
- let ind = ind + shiftwidth()
+ else
+ " Add
+ if previous_line =~? cmake_indent_comment_line " Handle comments
+ let ind = ind
+ else
+ if previous_line =~? cmake_indent_begin_regex
+ let ind = ind + shiftwidth()
+ endif
+ if previous_line =~? cmake_indent_open_regex
+ let ind = ind + shiftwidth()
+ endif
endif
- endif
- " Subtract
- if this_line =~? cmake_indent_end_regex
- let ind = ind - shiftwidth()
- endif
- if previous_line =~? cmake_indent_close_regex
- let ind = ind - shiftwidth()
+ " Subtract
+ if this_line =~? cmake_indent_end_regex
+ let ind = ind - shiftwidth()
+ endif
+ if previous_line !~? cmake_closing_parens_line
+ if previous_line =~? cmake_indent_close_regex
+ let ind = ind - shiftwidth()
+ endif
+ endif
endif
return ind
diff --git a/runtime/indent/cucumber.vim b/runtime/indent/cucumber.vim
index ad28a67a0d..5d144e426b 100644
--- a/runtime/indent/cucumber.vim
+++ b/runtime/indent/cucumber.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Cucumber
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2017 Jun 13
+" Last Change: 2023 Dec 28
if exists("b:did_indent")
finish
@@ -19,57 +19,80 @@ if exists("*GetCucumberIndent")
finish
endif
-function! s:syn(lnum)
- return synIDattr(synID(a:lnum,1+indent(a:lnum),1),'name')
+let s:headings = {
+ \ 'Feature': 'feature',
+ \ 'Rule': 'rule',
+ \ 'Background': 'bg_or_scenario',
+ \ 'Scenario': 'bg_or_scenario',
+ \ 'ScenarioOutline': 'bg_or_scenario',
+ \ 'Examples': 'examples',
+ \ 'Scenarios': 'examples'}
+
+function! s:Line(lnum) abort
+ if getline(a:lnum) =~# ':'
+ let group = matchstr(synIDattr(synID(a:lnum,1+indent(a:lnum), 1), 'name'), '^cucumber\zs.*')
+ if !has_key(s:headings, group)
+ let group = substitute(matchstr(getline(a:lnum), '^\s*\zs\%([^:]\+\)\ze:\S\@!'), '\s\+', '', 'g')
+ endif
+ else
+ let group = ''
+ endif
+ let char = matchstr(getline(a:lnum), '^\s*\zs[[:punct:]]')
+ return {
+ \ 'lnum': a:lnum,
+ \ 'indent': indent(a:lnum),
+ \ 'heading': get(s:headings, group, ''),
+ \ 'tag': char ==# '@',
+ \ 'table': char ==# '|',
+ \ 'comment': char ==# '#',
+ \ }
endfunction
-function! GetCucumberIndent()
- let line = getline(prevnonblank(v:lnum-1))
- let cline = getline(v:lnum)
- let nline = getline(nextnonblank(v:lnum+1))
- let sw = exists('*shiftwidth') ? shiftwidth() : shiftwidth()
- let syn = s:syn(prevnonblank(v:lnum-1))
- let csyn = s:syn(v:lnum)
- let nsyn = s:syn(nextnonblank(v:lnum+1))
- if csyn ==# 'cucumberFeature' || cline =~# '^\s*Feature:'
+function! GetCucumberIndent(...) abort
+ let lnum = a:0 ? a:1 : v:lnum
+ let sw = shiftwidth()
+ let prev = s:Line(prevnonblank(lnum-1))
+ let curr = s:Line(lnum)
+ let next = s:Line(nextnonblank(lnum+1))
+ if curr.heading ==# 'feature'
" feature heading
return 0
- elseif csyn ==# 'cucumberExamples' || cline =~# '^\s*\%(Examples\|Scenarios\):'
+ elseif curr.heading ==# 'examples'
" examples heading
return 2 * sw
- elseif csyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || cline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
+ elseif curr.heading ==# 'bg_or_scenario'
" background, scenario or outline heading
return sw
- elseif syn ==# 'cucumberFeature' || line =~# '^\s*Feature:'
+ elseif prev.heading ==# 'feature'
" line after feature heading
return sw
- elseif syn ==# 'cucumberExamples' || line =~# '^\s*\%(Examples\|Scenarios\):'
+ elseif prev.heading ==# 'examples'
" line after examples heading
return 3 * sw
- elseif syn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || line =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
+ elseif prev.heading ==# 'bg_or_scenario'
" line after background, scenario or outline heading
return 2 * sw
- elseif cline =~# '^\s*[@#]' && (nsyn == 'cucumberFeature' || nline =~# '^\s*Feature:' || indent(prevnonblank(v:lnum-1)) <= 0)
+ elseif (curr.tag || curr.comment) && (next.heading ==# 'feature' || prev.indent <= 0)
" tag or comment before a feature heading
return 0
- elseif cline =~# '^\s*@'
+ elseif curr.tag
" other tags
return sw
- elseif cline =~# '^\s*[#|]' && line =~# '^\s*|'
+ elseif (curr.table || curr.comment) && prev.table
" mid-table
" preserve indent
- return indent(prevnonblank(v:lnum-1))
- elseif cline =~# '^\s*|' && line =~# '^\s*[^|]'
+ return prev.indent
+ elseif curr.table && !prev.table
" first line of a table, relative indent
- return indent(prevnonblank(v:lnum-1)) + sw
- elseif cline =~# '^\s*[^|]' && line =~# '^\s*|'
+ return prev.indent + sw
+ elseif !curr.table && prev.table
" line after a table, relative unindent
- return indent(prevnonblank(v:lnum-1)) - sw
- elseif cline =~# '^\s*#' && getline(v:lnum-1) =~ '^\s*$' && (nsyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || nline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):')
+ return prev.indent - sw
+ elseif curr.comment && getline(v:lnum-1) =~# '^\s*$' && next.heading ==# 'bg_or_scenario'
" comments on scenarios
return sw
endif
- return indent(prevnonblank(v:lnum-1))
+ return prev.indent < 0 ? 0 : prev.indent
endfunction
" vim:set sts=2 sw=2:
diff --git a/runtime/indent/fortran.vim b/runtime/indent/fortran.vim
index 9623014818..392b2d29d5 100644
--- a/runtime/indent/fortran.vim
+++ b/runtime/indent/fortran.vim
@@ -1,7 +1,8 @@
" Vim indent file
-" Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77)
-" Version: (v49) 2022 May 14
-" Maintainer: Ajit J. Thakkar <thakkar.ajit@gmail.com>; <http://www2.unb.ca/~ajit/>
+" Language: Fortran 2023 (and Fortran 2018, 2008, 2003, 95, 90, 77, 66)
+" Version: (v50) 2023 December 22
+" Maintainers: Ajit J. Thakkar <ajit@unb.ca>; <https://ajit.ext.unb.ca/>
+" Joshua Hollett <j.hollett@uwinnipeg.ca>
" Usage: For instructions, do :help fortran-indent from Vim
" Credits:
" Version 0.1 was created in September 2000 by Ajit Thakkar.
@@ -21,8 +22,8 @@ let b:undo_indent = "setl inde< indk<"
setlocal indentkeys+==~end,=~case,=~if,=~else,=~do,=~where,=~elsewhere,=~select
setlocal indentkeys+==~endif,=~enddo,=~endwhere,=~endselect,=~elseif
-setlocal indentkeys+==~type,=~interface,=~forall,=~associate,=~block,=~enum
-setlocal indentkeys+==~endforall,=~endassociate,=~endblock,=~endenum
+setlocal indentkeys+==~interface,=~forall,=~associate,=~block,=~enum,=~critical
+setlocal indentkeys+==~endforall,=~endassociate,=~endblock,=~endenum,=~endcritical
if exists("b:fortran_indent_more") || exists("g:fortran_indent_more")
setlocal indentkeys+==~function,=~subroutine,=~module,=~contains,=~program
setlocal indentkeys+==~endfunction,=~endsubroutine,=~endmodule
@@ -48,7 +49,7 @@ if !exists("b:fortran_fixed_source")
" Fixed-form file extension defaults
let b:fortran_fixed_source = 1
else
- " Modern fortran still allows both fixed and free source form
+ " Modern fortran compilers still allow both fixed and free source form
" Assume fixed source form unless signs of free source form
" are detected in the first five columns of the first s:lmax lines.
" Detection becomes more accurate and time-consuming if more lines
@@ -108,8 +109,9 @@ function FortranGetIndent(lnum)
"Add a shiftwidth to statements following if, else, else if, case, class,
"where, else where, forall, type, interface and associate statements
- if prevstat =~? '^\s*\(case\|class\|else\|else\s*if\|else\s*where\)\>'
- \ ||prevstat=~? '^\s*\(type\|interface\|associate\|enum\)\>'
+ if prevstat =~? '^\s*\(case\|class\s\+is\|else\|else\s*if\|else\s*where\)\>'
+ \ ||prevstat=~? '^\s*\(type\|rank\|interface\|associate\|enum\|critical\)\>'
+ \ ||prevstat=~? '^\s*change\s\+team\>'
\ ||prevstat=~?'^\s*\(\d\+\s\)\=\s*\(\a\w*\s*:\)\=\s*\(forall\|where\|block\)\>'
\ ||prevstat=~? '^\s*\(\d\+\s\)\=\s*\(\a\w*\s*:\)\=\s*if\>'
let ind = ind + shiftwidth()
@@ -144,10 +146,10 @@ function FortranGetIndent(lnum)
"Subtract a shiftwidth from else, else if, elsewhere, case, class, end if,
" end where, end select, end forall, end interface, end associate,
- " end enum, end type, end block and end type statements
+ " end enum, end type, end block, end team and end type statements
if getline(v:lnum) =~? '^\s*\(\d\+\s\)\=\s*'
- \. '\(else\|else\s*if\|else\s*where\|case\|class\|'
- \. 'end\s*\(if\|where\|select\|interface\|'
+ \. '\(else\|else\s*if\|else\s*where\|case\|class\|rank\|type\s\+is\|'
+ \. 'end\s*\(if\|where\|select\|interface\|critical\|team\|'
\. 'type\|forall\|associate\|enum\|block\)\)\>'
let ind = ind - shiftwidth()
" Fix indent for case statement immediately after select
diff --git a/runtime/indent/gdscript.vim b/runtime/indent/gdscript.vim
new file mode 100644
index 0000000000..bbb4f284f1
--- /dev/null
+++ b/runtime/indent/gdscript.vim
@@ -0,0 +1,154 @@
+" Vim indent file
+" Language: gdscript (Godot game engine)
+" Maintainer: Maxim Kim <habamax@gmail.com>
+" Based on python indent file.
+"
+" This file has been manually translated from Vim9 script.
+
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+let s:undo_opts = "setl indentexpr< indentkeys< lisp< autoindent<"
+
+if exists('b:undo_indent')
+ let b:undo_indent ..= "|" .. s:undo_opts
+else
+ let b:undo_indent = s:undo_opts
+endif
+
+setlocal nolisp
+setlocal autoindent
+setlocal indentexpr=s:GDScriptIndent()
+setlocal indentkeys+=<:>,=elif,=except
+
+
+function s:GDScriptIndent() abort
+ " If this line is explicitly joined: If the previous line was also joined,
+ " line it up with that one, otherwise add two 'shiftwidth'
+ if getline(v:lnum - 1) =~# '\\$'
+ if v:lnum > 1 && getline(v:lnum - 2) =~# '\\$'
+ return indent(v:lnum - 1)
+ endif
+ return indent(v:lnum - 1) + (shiftwidth() * 2)
+ endif
+
+ " If the start of the line is in a string don't change the indent.
+ if has('syntax_items') && synIDattr(synID(v:lnum, 1, 1), "name") =~# "String$"
+ return -1
+ endif
+
+ " Search backwards for the previous non-empty line.
+ let plnum = prevnonblank(v:lnum - 1)
+
+ if plnum == 0
+ " This is the first non-empty line, use zero indent.
+ return 0
+ endif
+
+ let plindent = indent(plnum)
+ let plnumstart = plnum
+
+ " Get the line and remove a trailing comment.
+ " Use syntax highlighting attributes when possible.
+ let pline = getline(plnum)
+ let pline_len = strlen(pline)
+ if has('syntax_items')
+ " If the last character in the line is a comment, do a binary search for
+ " the start of the comment. synID() is slow, a linear search would take
+ " too long on a long line.
+ if synIDattr(synID(plnum, pline_len, 1), "name") =~# "\\(Comment\\|Todo\\)$"
+ let min = 1
+ let max = pline_len
+ while min < max
+ let col = (min + max) / 2
+ if synIDattr(synID(plnum, col, 1), "name") =~# "\\(Comment\\|Todo\\)$"
+ let max = col
+ else
+ let min = col + 1
+ endif
+ endwhile
+ let pline = strpart(pline, 0, min - 1)
+ endif
+ else
+ let col = 0
+ while col < pline_len
+ if pline[col] ==# '#'
+ let pline = strpart(pline, 0, col)
+ break
+ endif
+ let col = col + 1
+ endwhile
+ endif
+
+
+ " When "inside" parenthesis: If at the first line below the parenthesis add
+ " one 'shiftwidth' ("inside" is simplified and not really checked)
+ " my_var = (
+ " a
+ " + b
+ " + c
+ " )
+ if pline =~# '[({\[]\s*$'
+ return indent(plnum) + shiftwidth()
+ endif
+
+
+ " If the previous line ended with a colon, indent this line
+ if pline =~# ':\s*$'
+ return plindent + shiftwidth()
+ endif
+
+ " If the previous line was a stop-execution statement...
+ if getline(plnum) =~# '^\s*\(break\|continue\|raise\|return\|pass\)\>'
+ " See if the user has already dedented
+ if indent(v:lnum) > indent(plnum) - shiftwidth()
+ " If not, recommend one dedent
+ return indent(plnum) - shiftwidth()
+ endif
+ " Otherwise, trust the user
+ return -1
+ endif
+
+ " If the current line begins with a keyword that lines up with "try"
+ if getline(v:lnum) =~# '^\s*\(except\|finally\)\>'
+ let lnum = v:lnum - 1
+ while lnum >= 1
+ if getline(lnum) =~# '^\s*\(try\|except\)\>'
+ let ind = indent(lnum)
+ if ind >= indent(v:lnum)
+ return -1 " indent is already less than this
+ endif
+ return ind " line up with previous try or except
+ endif
+ let lnum = lnum - 1
+ endwhile
+ return -1 " no matching "try"!
+ endif
+
+
+ " If the current line begins with a header keyword, dedent
+ if getline(v:lnum) =~# '^\s*\(elif\|else\)\>'
+
+ " Unless the previous line was a one-liner
+ if getline(plnumstart) =~# '^\s*\(for\|if\|try\)\>'
+ return plindent
+ endif
+
+ " Or the user has already dedented
+ if indent(v:lnum) <= plindent - shiftwidth()
+ return -1
+ endif
+
+ return plindent - shiftwidth()
+ endif
+
+ return -1
+endfunction
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
diff --git a/runtime/indent/odin.vim b/runtime/indent/odin.vim
new file mode 100644
index 0000000000..0747b6b155
--- /dev/null
+++ b/runtime/indent/odin.vim
@@ -0,0 +1,124 @@
+" Vim indent plugin file
+" Language: Odin
+" Maintainer: Maxim Kim <habamax@gmail.com>
+" Website: https://github.com/habamax/vim-odin
+" Last Change: 2024-01-15
+"
+" This file has been manually translated from Vim9 script.
+
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+let b:undo_indent = 'setlocal cindent< cinoptions< cinkeys< indentexpr<'
+
+setlocal cindent
+setlocal cinoptions=L0,m1,(s,j1,J1,l1,+0,:0,#1
+setlocal cinkeys=0{,0},0),0],!^F,:,o,O
+
+setlocal indentexpr=s:GetOdinIndent(v:lnum)
+
+function s:PrevLine(lnum) abort
+ let plnum = a:lnum - 1
+ while plnum > 1
+ let plnum = prevnonblank(plnum)
+ let pline = getline(plnum)
+ " XXX: take into account nested multiline /* /* */ */ comments
+ if pline =~# '\*/\s*$'
+ while getline(plnum) !~# '/\*' && plnum > 1
+ let plnum -= 1
+ endwhile
+ if getline(plnum) =~# '^\s*/\*'
+ let plnum -= 1
+ else
+ break
+ endif
+ elseif pline =~# '^\s*//'
+ let plnum -= 1
+ else
+ break
+ endif
+ endwhile
+ return plnum
+endfunction
+
+function s:GetOdinIndent(lnum) abort
+ let plnum = s:PrevLine(a:lnum)
+ let pline = getline(plnum)
+ let pindent = indent(plnum)
+ " workaround of cindent "hang"
+ " if the previous line looks like:
+ " : #{}
+ " : #whatever{whateverelse}
+ " and variations where : # { } are in the string
+ " cindent(lnum) hangs
+ if pline =~# ':\s\+#.*{.*}'
+ return pindent
+ endif
+
+ let indent = cindent(a:lnum)
+ let line = getline(a:lnum)
+
+ if line =~# '^\s*#\k\+'
+ if pline =~# '[{:]\s*$'
+ let indent = pindent + shiftwidth()
+ else
+ let indent = pindent
+ endif
+ elseif pline =~# 'switch\s.*{\s*$'
+ let indent = pindent
+ elseif pline =~# 'case\s*.*,\s*\(//.*\)\?$' " https://github.com/habamax/vim-odin/issues/8
+ let indent = pindent + matchstr(pline, 'case\s*')->strcharlen()
+ elseif line =~# '^\s*case\s\+.*,\s*$'
+ let indent = pindent - shiftwidth()
+ elseif pline =~# 'case\s*.*:\s*\(//.*\)\?$'
+ if line !~# '^\s*}\s*$' && line !~# '^\s*case[[:space:]:]'
+ let indent = pindent + shiftwidth()
+ endif
+ elseif pline =~# '^\s*@.*' && line !~# '^\s*}'
+ let indent = pindent
+ elseif pline =~# ':[:=].*}\s*$'
+ let indent = pindent
+ elseif pline =~# '^\s*}\s*$'
+ if line !~# '^\s*}' && line !~# 'case\s*.*:\s*$'
+ let indent = pindent
+ else
+ let indent = pindent - shiftwidth()
+ endif
+ elseif pline =~# '\S:\s*$'
+ " looking up for a case something,
+ " whatever,
+ " anything:
+ " ... 20 lines before
+ for idx in range(plnum - 1, plnum - 21, -1)
+ if plnum < 1
+ break
+ endif
+ if getline(idx) =~# '^\s*case\s.*,\s*$'
+ let indent = indent(idx) + shiftwidth()
+ break
+ endif
+ endfor
+ elseif pline =~# '{[^{]*}\s*$' && line !~# '^\s*[})]\s*$' " https://github.com/habamax/vim-odin/issues/2
+ let indent = pindent
+ elseif pline =~# '^\s*}\s*$' " https://github.com/habamax/vim-odin/issues/3
+ " Find line with opening { and check if there is a label:
+ " If there is, return indent of the closing }
+ call cursor(plnum, 1)
+ silent normal! %
+ let brlnum = line('.')
+ let brline = getline('.')
+ if plnum != brlnum && (brline =~# '^\s*\k\+:\s\+for' || brline =~# '^\s*\k\+\s*:=')
+ let indent = pindent
+ endif
+ endif
+
+ return indent
+endfunction
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/indent/qml.vim b/runtime/indent/qml.vim
index 8c9fa91250..cf0ba41957 100644
--- a/runtime/indent/qml.vim
+++ b/runtime/indent/qml.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: QML
" Maintainer: Chase Knowlden <haroldknowlden@gmail.com>
-" Last Change: 2023 Aug 16
+" Last Change: 2024 Jan 24 by Vim Project
"
" Improved JavaScript indent script.
@@ -40,10 +40,10 @@ function! s:GetQmlIndent()
" bracket/brace/paren blocks
if pline =~ '[{[(]$'
- let ind += &sw
+ let ind += shiftwidth()
endif
if line =~ '^[}\])]'
- let ind -= &sw
+ let ind -= shiftwidth()
endif
" '/*' comments
diff --git a/runtime/indent/query.lua b/runtime/indent/query.lua
index c86948e95e..3261376d87 100644
--- a/runtime/indent/query.lua
+++ b/runtime/indent/query.lua
@@ -1,5 +1,5 @@
-- Neovim indent file
--- Language: Tree-sitter query
+-- Language: Treesitter query
-- Last Change: 2022 Mar 29
-- it's a lisp!
diff --git a/runtime/indent/r.vim b/runtime/indent/r.vim
index 07dfd13881..339c46b172 100644
--- a/runtime/indent/r.vim
+++ b/runtime/indent/r.vim
@@ -1,8 +1,10 @@
" Vim indent file
" Language: R
-" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Mon Feb 27, 2023 07:16PM
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
+" Former Repository: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: 2023 Oct 08 10:45AM
+" 2024 Feb 19 by Vim Project (announce adoption)
" Only load this indent file when no other was loaded.
@@ -13,6 +15,7 @@ let b:did_indent = 1
setlocal indentkeys=0{,0},:,!^F,o,O,e
setlocal indentexpr=GetRIndent()
+setlocal autoindent
let b:undo_indent = "setl inde< indk<"
@@ -47,27 +50,23 @@ function s:RDelete_quotes(line)
if a:line[i] == '"'
let i += 1
endif
- else
+ elseif a:line[i] == "'"
+ let i += 1
+ let line1 = line1 . 's'
+ while !(a:line[i] == "'" && ((i > 1 && a:line[i-1] == '\' && a:line[i-2] == '\') || a:line[i-1] != '\')) && i < llen
+ let i += 1
+ endwhile
if a:line[i] == "'"
let i += 1
- let line1 = line1 . 's'
- while !(a:line[i] == "'" && ((i > 1 && a:line[i-1] == '\' && a:line[i-2] == '\') || a:line[i-1] != '\')) && i < llen
- let i += 1
- endwhile
- if a:line[i] == "'"
- let i += 1
- endif
- else
- if a:line[i] == "`"
- let i += 1
- let line1 = line1 . 's'
- while a:line[i] != "`" && i < llen
- let i += 1
- endwhile
- if a:line[i] == "`"
- let i += 1
- endif
- endif
+ endif
+ elseif a:line[i] == "`"
+ let i += 1
+ let line1 = line1 . 's'
+ while a:line[i] != "`" && i < llen
+ let i += 1
+ endwhile
+ if a:line[i] == "`"
+ let i += 1
endif
endif
if i == llen
@@ -97,10 +96,8 @@ function s:RDelete_parens(line)
let i += 1
if a:line[i] == ')'
let nop -= 1
- else
- if a:line[i] == '('
- let nop += 1
- endif
+ elseif a:line[i] == '('
+ let nop += 1
endif
endwhile
let line1 = line1 . a:line[i]
@@ -174,10 +171,8 @@ function s:Get_last_paren_idx(line, o, c, pb)
if blc == 0
let theidx = idx
endif
- else
- if line[idx] == a:c
- let blc += 1
- endif
+ elseif line[idx] == a:c
+ let blc += 1
endif
let idx += 1
endwhile
@@ -316,6 +311,11 @@ function GetRIndent()
endif
if pb < 0 && line =~ '.*[,&|\-\*+<>]$'
+ if line =~ '.*[\-\*+>]$'
+ let is_op = v:true
+ else
+ let is_op = v:false
+ endif
let lnum = s:Get_prev_line(lnum)
while pb < 1 && lnum > 0
let line = SanitizeRLine(getline(lnum))
@@ -324,9 +324,10 @@ function GetRIndent()
while ind > 0
if line[ind] == ')'
let pb -= 1
- else
- if line[ind] == '('
- let pb += 1
+ elseif line[ind] == '('
+ let pb += 1
+ if is_op && pb == 0
+ return indent(lnum)
endif
endif
if pb == 1
@@ -367,10 +368,8 @@ function GetRIndent()
else
return indent(lnum) + shiftwidth()
endif
- else
- if substitute(oline, '#.*', '', '') =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
- return indent(lnum) - shiftwidth()
- endif
+ elseif substitute(oline, '#.*', '', '') =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
+ return indent(lnum) - shiftwidth()
endif
elseif substitute(line, '#.*', '', '') =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
return indent(lnum) + shiftwidth()
@@ -404,12 +403,10 @@ function GetRIndent()
if cline =~ '^\s*else'
if line =~ '<-\s*if\s*()'
return indent(lnum) + shiftwidth()
+ elseif line =~ '\<if\s*()'
+ return indent(lnum)
else
- if line =~ '\<if\s*()'
- return indent(lnum)
- else
- return indent(lnum) - shiftwidth()
- endif
+ return indent(lnum) - shiftwidth()
endif
endif
diff --git a/runtime/indent/racket.vim b/runtime/indent/racket.vim
index 93bd38fbff..d301cd64f9 100644
--- a/runtime/indent/racket.vim
+++ b/runtime/indent/racket.vim
@@ -3,7 +3,7 @@
" Maintainer: D. Ben Knoble <ben.knoble+github@gmail.com>
" Previous Maintainer: Will Langstroth <will@langstroth.com>
" URL: https://github.com/benknoble/vim-racket
-" Last Change: 2022 Aug 12
+" Last Change: 2024 Jan 31
if exists("b:did_indent")
finish
@@ -11,18 +11,25 @@ endif
let b:did_indent = 1
setlocal lisp autoindent nosmartindent
+if has('vim9script')
+ setlocal indentexpr=racket#Indent() lispoptions+=expr:1
+endif
-setlocal lispwords+=module,module*,module+,parameterize,let-values,let*-values,letrec-values,local
+setlocal lispwords+=module,module*,module+,parameterize,parameterize*,let-values,let*-values,letrec-values,local
setlocal lispwords+=define/contract
setlocal lispwords+=λ
setlocal lispwords+=with-handlers
setlocal lispwords+=define-values,opt-lambda,case-lambda,syntax-rules,with-syntax,syntax-case,syntax-parse
setlocal lispwords+=define-for-syntax,define-syntax-parser,define-syntax-parse-rule,define-syntax-class,define-splicing-syntax-class
+setlocal lispwords+=define-syntax-parameter,syntax-parameterize
setlocal lispwords+=define-signature,unit,unit/sig,compund-unit/sig,define-values/invoke-unit/sig
setlocal lispwords+=define-opt/c,define-syntax-rule
-setlocal lispwords+=define-test-suite
+setlocal lispwords+=define-test-suite,test-case
setlocal lispwords+=struct
setlocal lispwords+=with-input-from-file,with-output-to-file
+setlocal lispwords+=begin,begin0
+setlocal lispwords+=place
+setlocal lispwords+=cond
" Racket OOP
" TODO missing a lot of define-like forms here (e.g., define/augment, etc.)
@@ -41,6 +48,8 @@ setlocal lispwords+=for/hash,for/hasheq,for/hasheqv,for/sum,for/flvector,for*/fl
setlocal lispwords+=for/async
setlocal lispwords+=for/set,for*/set
setlocal lispwords+=for/first,for*/first
+setlocal lispwords+=for/last,for*/last
+setlocal lispwords+=for/stream,for*/stream
setlocal lispwords+=match,match*,match/values,define/match,match-lambda,match-lambda*,match-lambda**
setlocal lispwords+=match-let,match-let*,match-let-values,match-let*-values
@@ -57,4 +66,4 @@ setlocal lispwords+=if-view,case-view,cond-view,list-view,dyn-view
setlocal lispwords+=case/dep
setlocal lispwords+=define/obs
-let b:undo_indent = "setlocal lisp< ai< si< lw<"
+let b:undo_indent = "setlocal lisp< ai< si< lw<" .. (has('vim9script') ? ' indentexpr< lispoptions<' : '')
diff --git a/runtime/indent/rhelp.vim b/runtime/indent/rhelp.vim
index 334802ab78..97820ae148 100644
--- a/runtime/indent/rhelp.vim
+++ b/runtime/indent/rhelp.vim
@@ -1,8 +1,10 @@
" Vim indent file
" Language: R Documentation (Help), *.Rd
-" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Mon Feb 27, 2023 07:01PM
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
+" Former Repository: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: 2023 Feb 27 07:01PM
+" 2024 Feb 19 by Vim Project (announce adoption)
" Only load this indent file when no other was loaded.
diff --git a/runtime/indent/rmd.vim b/runtime/indent/rmd.vim
index a043b0c994..f2d34a3f32 100644
--- a/runtime/indent/rmd.vim
+++ b/runtime/indent/rmd.vim
@@ -1,8 +1,10 @@
" Vim indent file
" Language: Rmd
-" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Wed Nov 09, 2022 09:44PM
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
+" Former Repository: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: 2022 Nov 09 09:44PM
+" 2024 Feb 19 by Vim Project (announce adoption)
" Only load this indent file when no other was loaded.
diff --git a/runtime/indent/rnoweb.vim b/runtime/indent/rnoweb.vim
index 668cdb7ddd..1bdf7f3b12 100644
--- a/runtime/indent/rnoweb.vim
+++ b/runtime/indent/rnoweb.vim
@@ -1,8 +1,10 @@
" Vim indent file
" Language: Rnoweb
-" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Mon Feb 27, 2023 07:17PM
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
+" Former Repository: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: 2024 Feb 27 07:17PM
+" 2024 Feb 19 by Vim Project (announce adoption)
" Only load this indent file when no other was loaded.
diff --git a/runtime/indent/rrst.vim b/runtime/indent/rrst.vim
index 585c5e6654..73c8b04611 100644
--- a/runtime/indent/rrst.vim
+++ b/runtime/indent/rrst.vim
@@ -1,8 +1,10 @@
" Vim indent file
" Language: Rrst
-" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Feb 25, 2023
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
+" Former Repository: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: 2023 Feb 25
+" 2024 Feb 19 by Vim Project (announce adoption)
" Only load this indent file when no other was loaded.
diff --git a/runtime/indent/sass.vim b/runtime/indent/sass.vim
index 8c0ecd0746..45dc869a55 100644
--- a/runtime/indent/sass.vim
+++ b/runtime/indent/sass.vim
@@ -1,14 +1,14 @@
" Vim indent file
" Language: Sass
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2022 Mar 15
+" Last Change: 2023 Dec 28
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
-setlocal autoindent sw=2 et
+setlocal autoindent
setlocal indentexpr=GetSassIndent()
setlocal indentkeys=o,O,*<Return>,<:>,!^F
@@ -26,10 +26,8 @@ function! GetSassIndent()
let lnum = prevnonblank(v:lnum-1)
let line = substitute(getline(lnum),'\s\+$','','')
let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','')
- let lastcol = strlen(line)
let line = substitute(line,'^\s\+','','')
let indent = indent(lnum)
- let cindent = indent(v:lnum)
if line !~ s:property && line !~ s:extend && cline =~ s:property
return indent + shiftwidth()
else
diff --git a/runtime/indent/yaml.vim b/runtime/indent/yaml.vim
index 93fd8ea6f6..e5daf9f219 100644
--- a/runtime/indent/yaml.vim
+++ b/runtime/indent/yaml.vim
@@ -3,6 +3,7 @@
" Maintainer: Nikolai Pavlov <zyx.vim@gmail.com>
" Last Updates: Lukas Reineke, "lacygoill"
" Last Change: 2022 Jun 17
+" 2024 Feb 29 disable mulitline indent by default (The Vim project)
" Only load this indent file when no other was loaded.
if exists('b:did_indent')
@@ -138,11 +139,13 @@ function GetYAMLIndent(lnum)
else
return indent(prevmapline)
endif
- elseif prevline =~# '^\s*- '
+ elseif get(g:, 'yaml_indent_multiline_scalar', 0) &&
+ \ prevline =~# '^\s*- '
" - List with
" multiline scalar
return previndent+2
- elseif prevline =~# s:mapkeyregex .. '\v\s*%(%(' .. s:c_ns_tag_property ..
+ elseif get(g:, 'yaml_indent_multiline_scalar', 0) &&
+ \ prevline =~# s:mapkeyregex .. '\v\s*%(%(' .. s:c_ns_tag_property ..
\ '\v|' .. s:c_ns_anchor_property ..
\ '\v|' .. s:block_scalar_header ..
\ '\v)%(\s+|\s*%(\#.*)?$))*'
diff --git a/runtime/lua/man.lua b/runtime/lua/man.lua
index dcdfc2b87f..ac15aff60c 100644
--- a/runtime/lua/man.lua
+++ b/runtime/lua/man.lua
@@ -238,7 +238,7 @@ local function get_path(sect, name, silent)
-- If you run man -w strlen and string.3 comes up first, this is a problem. We
-- should search for a matching named one in the results list.
-- However, if you search for man -w clock_gettime, you will *only* get
- -- clock_getres.2, which is the right page. Searching the resuls for
+ -- clock_getres.2, which is the right page. Searching the results for
-- clock_gettime will no longer work. In this case, we should just use the
-- first one that was found in the correct section.
--
diff --git a/runtime/lua/nvim/health.lua b/runtime/lua/nvim/health.lua
index 6b6370fa19..0480e4df4e 100644
--- a/runtime/lua/nvim/health.lua
+++ b/runtime/lua/nvim/health.lua
@@ -17,15 +17,21 @@ local shell_error = function()
return vim.v.shell_error ~= 0
end
-local suggest_faq = 'https://github.com/neovim/neovim/wiki/Building-Neovim#optimized-builds'
+local suggest_faq = 'https://github.com/neovim/neovim/blob/docs/install/BUILD.md#building'
local function check_runtime()
health.start('Runtime')
-- Files from an old installation.
local bad_files = {
+ ['plugin/health.vim'] = false,
+ ['autoload/health/nvim.vim'] = false,
+ ['autoload/health/provider.vim'] = false,
+ ['autoload/man.vim'] = false,
['plugin/man.vim'] = false,
+ ['queries/help/highlights.scm'] = false,
+ ['queries/help/injections.scm'] = false,
['scripts.vim'] = false,
- ['autoload/man.vim'] = false,
+ ['syntax/syncolor.vim'] = false,
}
local bad_files_msg = ''
for k, _ in pairs(bad_files) do
@@ -42,10 +48,10 @@ local function check_runtime()
if not ok then
health.error(
string.format(
- '$VIMRUNTIME has files from an old installation (this can cause weird behavior):\n%s',
+ 'Found old files in $VIMRUNTIME (this can cause weird behavior):\n%s',
bad_files_msg
),
- { 'Delete $VIMRUNTIME (or uninstall Nvim), then reinstall Nvim.' }
+ { 'Delete the $VIMRUNTIME directory (or uninstall Nvim), then reinstall Nvim.' }
)
end
end
@@ -183,10 +189,6 @@ local function check_rplugin_manifest()
health.start('Remote Plugins')
local existing_rplugins = {}
- for _, item in ipairs(vim.fn['remote#host#PluginsForHost']('python')) do
- existing_rplugins[item.path] = 'python'
- end
-
for _, item in ipairs(vim.fn['remote#host#PluginsForHost']('python3')) do
existing_rplugins[item.path] = 'python3'
end
@@ -324,24 +326,17 @@ local function check_tmux()
end
-- check for RGB capabilities
- local info = vim.fn.system({ 'tmux', 'display-message', '-p', '#{client_termfeatures}' })
- info = vim.split(vim.trim(info), ',', { trimempty = true })
- if not vim.list_contains(info, 'RGB') then
- local has_rgb = false
- if #info == 0 then
- -- client_termfeatures may not be supported; fallback to checking show-messages
- info = vim.fn.system({ 'tmux', 'show-messages', '-JT' })
- has_rgb = info:find(' Tc: (flag) true', 1, true) or info:find(' RGB: (flag) true', 1, true)
- end
- if not has_rgb then
- health.warn(
- "Neither Tc nor RGB capability set. True colors are disabled. |'termguicolors'| won't work properly.",
- {
- "Put this in your ~/.tmux.conf and replace XXX by your $TERM outside of tmux:\nset-option -sa terminal-features ',XXX:RGB'",
- "For older tmux versions use this instead:\nset-option -ga terminal-overrides ',XXX:Tc'",
- }
- )
- end
+ local info = vim.fn.system({ 'tmux', 'show-messages', '-T' })
+ local has_setrgbb = vim.fn.stridx(info, ' setrgbb: (string)') ~= -1
+ local has_setrgbf = vim.fn.stridx(info, ' setrgbf: (string)') ~= -1
+ if not has_setrgbb or not has_setrgbf then
+ health.warn(
+ "True color support could not be detected. |'termguicolors'| won't work properly.",
+ {
+ "Add the following to your tmux configuration file, replacing XXX by the value of $TERM outside of tmux:\nset-option -a terminal-features 'XXX:RGB'",
+ "For older tmux versions use this instead:\nset-option -a terminal-overrides 'XXX:Tc'",
+ }
+ )
end
end
diff --git a/runtime/lua/provider/clipboard/health.lua b/runtime/lua/provider/clipboard/health.lua
new file mode 100644
index 0000000000..dc33cb0ab0
--- /dev/null
+++ b/runtime/lua/provider/clipboard/health.lua
@@ -0,0 +1,40 @@
+local health = vim.health
+local executable = health.executable
+
+local M = {}
+
+function M.check()
+ health.start('Clipboard (optional)')
+
+ if
+ os.getenv('TMUX')
+ and executable('tmux')
+ and executable('pbpaste')
+ and not health.cmd_ok('pbpaste')
+ then
+ local tmux_version = string.match(vim.fn.system('tmux -V'), '%d+%.%d+')
+ local advice = {
+ 'Install tmux 2.6+. https://superuser.com/q/231130',
+ 'or use tmux with reattach-to-user-namespace. https://superuser.com/a/413233',
+ }
+ health.error('pbcopy does not work with tmux version: ' .. tmux_version, advice)
+ end
+
+ local clipboard_tool = vim.fn['provider#clipboard#Executable']()
+ if vim.g.clipboard ~= nil and clipboard_tool == '' then
+ local error_message = vim.fn['provider#clipboard#Error']()
+ health.error(
+ error_message,
+ "Use the example in :help g:clipboard as a template, or don't set g:clipboard at all."
+ )
+ elseif clipboard_tool:find('^%s*$') then
+ health.warn(
+ 'No clipboard tool found. Clipboard registers (`"+` and `"*`) will not work.',
+ ':help clipboard'
+ )
+ else
+ health.ok('Clipboard tool found: ' .. clipboard_tool)
+ end
+end
+
+return M
diff --git a/runtime/lua/provider/health.lua b/runtime/lua/provider/health.lua
deleted file mode 100644
index d33f74f6e9..0000000000
--- a/runtime/lua/provider/health.lua
+++ /dev/null
@@ -1,916 +0,0 @@
-local M = {}
-
-local start = vim.health.start
-local ok = vim.health.ok
-local info = vim.health.info
-local warn = vim.health.warn
-local error = vim.health.error
-local iswin = vim.uv.os_uname().sysname == 'Windows_NT'
-
-local shell_error_code = 0
-local function shell_error()
- return shell_error_code ~= 0
-end
-
--- Returns true if `cmd` exits with success, else false.
-local function cmd_ok(cmd)
- vim.fn.system(cmd)
- return vim.v.shell_error == 0
-end
-
-local function executable(exe)
- return vim.fn.executable(exe) == 1
-end
-
-local function is_blank(s)
- return s:find('^%s*$') ~= nil
-end
-
-local function isdir(path)
- if not path then
- return false
- end
- local stat = vim.uv.fs_stat(path)
- if not stat then
- return false
- end
- return stat.type == 'directory'
-end
-
-local function isfile(path)
- if not path then
- return false
- end
- local stat = vim.uv.fs_stat(path)
- if not stat then
- return false
- end
- return stat.type == 'file'
-end
-
--- Handler for s:system() function.
-local function system_handler(self, _, data, event)
- if event == 'stderr' then
- if self.add_stderr_to_output then
- self.output = self.output .. vim.fn.join(data, '')
- else
- self.stderr = self.stderr .. vim.fn.join(data, '')
- end
- elseif event == 'stdout' then
- self.output = self.output .. vim.fn.join(data, '')
- elseif event == 'exit' then
- shell_error_code = data
- end
-end
-
--- Attempts to construct a shell command from an args list.
--- Only for display, to help users debug a failed command.
-local function shellify(cmd)
- if type(cmd) ~= 'table' then
- return cmd
- end
- return vim.fn.join(
- vim.fn.map(vim.fn.copy(cmd), [[v:val =~# ''\m[^\-.a-zA-Z_/]'' ? shellescape(v:val) : v:val]]),
- ' '
- )
-end
-
--- Run a system command and timeout after 30 seconds.
-local function system(cmd, ...)
- local args = { ... }
- local args_count = vim.tbl_count(args)
-
- local stdin = (args_count > 0 and args[1] or '')
- local stderr = (args_count > 1 and args[2] or false)
- local ignore_error = (args_count > 2 and args[3] or false)
-
- local opts = {
- add_stderr_to_output = stderr,
- output = '',
- stderr = '',
- on_stdout = system_handler,
- on_stderr = system_handler,
- on_exit = system_handler,
- }
- local jobid = vim.fn.jobstart(cmd, opts)
-
- if jobid < 1 then
- local message = 'Command error (job='
- .. jobid
- .. '): `'
- .. shellify(cmd)
- .. '` (in '
- .. vim.fn.string(vim.fn.getcwd())
- .. ')'
-
- error(message)
- shell_error_code = 1
- return opts.output
- end
-
- if not is_blank(stdin) then
- vim.api.nvim_chan_send(jobid, stdin)
- end
-
- local res = vim.fn.jobwait({ jobid }, 30000)
- if res[1] == -1 then
- error('Command timed out: ' .. shellify(cmd))
- vim.fn.jobstop(jobid)
- elseif shell_error() and not ignore_error then
- local emsg = 'Command error (job='
- .. jobid
- .. ', exit code '
- .. shell_error_code
- .. '): `'
- .. shellify(cmd)
- .. '` (in '
- .. vim.fn.string(vim.fn.getcwd())
- .. ')'
- if not is_blank(opts.output) then
- emsg = emsg .. '\noutput: ' .. opts.output
- end
- if not is_blank(opts.stderr) then
- emsg = emsg .. '\nstderr: ' .. opts.stderr
- end
- error(emsg)
- end
-
- -- return opts.output
- local _ = ...
- return vim.trim(vim.fn.system(cmd))
-end
-
-local function clipboard()
- start('Clipboard (optional)')
-
- if
- os.getenv('TMUX')
- and executable('tmux')
- and executable('pbpaste')
- and not cmd_ok('pbpaste')
- then
- local tmux_version = string.match(vim.fn.system('tmux -V'), '%d+%.%d+')
- local advice = {
- 'Install tmux 2.6+. https://superuser.com/q/231130',
- 'or use tmux with reattach-to-user-namespace. https://superuser.com/a/413233',
- }
- error('pbcopy does not work with tmux version: ' .. tmux_version, advice)
- end
-
- local clipboard_tool = vim.fn['provider#clipboard#Executable']()
- if vim.g.clipboard and is_blank(clipboard_tool) then
- local error_message = vim.fn['provider#clipboard#Error']()
- error(
- error_message,
- "Use the example in :help g:clipboard as a template, or don't set g:clipboard at all."
- )
- elseif is_blank(clipboard_tool) then
- warn(
- 'No clipboard tool found. Clipboard registers (`"+` and `"*`) will not work.',
- ':help clipboard'
- )
- else
- ok('Clipboard tool found: ' .. clipboard_tool)
- end
-end
-
-local function disabled_via_loaded_var(provider)
- local loaded_var = 'loaded_' .. provider .. '_provider'
- local v = vim.g[loaded_var]
- if v == 0 then
- info('Disabled (' .. loaded_var .. '=' .. v .. ').')
- return true
- end
- return false
-end
-
--- Check if pyenv is available and a valid pyenv root can be found, then return
--- their respective paths. If either of those is invalid, return two empty
--- strings, effectively ignoring pyenv.
-local function check_for_pyenv()
- local pyenv_path = vim.fn.resolve(vim.fn.exepath('pyenv'))
-
- if is_blank(pyenv_path) then
- return { '', '' }
- end
-
- info('pyenv: Path: ' .. pyenv_path)
-
- local pyenv_root = os.getenv('PYENV_ROOT') and vim.fn.resolve(os.getenv('PYENV_ROOT')) or ''
-
- if is_blank(pyenv_root) then
- pyenv_root = vim.trim(system({ pyenv_path, 'root' }))
- info('pyenv: $PYENV_ROOT is not set. Infer from `pyenv root`.')
- end
-
- if not isdir(pyenv_root) then
- local message = 'pyenv: Root does not exist: '
- .. pyenv_root
- .. '. Ignoring pyenv for all following checks.'
- warn(message)
- return { '', '' }
- end
-
- info('pyenv: Root: ' .. pyenv_root)
-
- return { pyenv_path, pyenv_root }
-end
-
--- Check the Python interpreter's usability.
-local function check_bin(bin)
- if not isfile(bin) and (not iswin or not isfile(bin .. '.exe')) then
- error('"' .. bin .. '" was not found.')
- return false
- elseif not executable(bin) then
- error('"' .. bin .. '" is not executable.')
- return false
- end
- return true
-end
-
--- Fetch the contents of a URL.
-local function download(url)
- local has_curl = executable('curl')
- if has_curl and vim.fn.system({ 'curl', '-V' }):find('Protocols:.*https') then
- local rv = system({ 'curl', '-sL', url }, '', 1, 1)
- if shell_error() then
- return 'curl error with ' .. url .. ': ' .. shell_error_code
- else
- return rv
- end
- elseif executable('python') then
- local script = "try:\n\
- from urllib.request import urlopen\n\
- except ImportError:\n\
- from urllib2 import urlopen\n\
- response = urlopen('" .. url .. "')\n\
- print(response.read().decode('utf8'))\n"
- local rv = system({ 'python', '-c', script })
- if is_blank(rv) and shell_error() then
- return 'python urllib.request error: ' .. shell_error_code
- else
- return rv
- end
- end
-
- local message = 'missing `curl` '
-
- if has_curl then
- message = message .. '(with HTTPS support) '
- end
- message = message .. 'and `python`, cannot make web request'
-
- return message
-end
-
--- Get the latest Nvim Python client (pynvim) version from PyPI.
-local function latest_pypi_version()
- local pypi_version = 'unable to get pypi response'
- local pypi_response = download('https://pypi.python.org/pypi/pynvim/json')
- if not is_blank(pypi_response) then
- local pcall_ok, output = pcall(vim.fn.json_decode, pypi_response)
- local pypi_data
- if pcall_ok then
- pypi_data = output
- else
- return 'error: ' .. pypi_response
- end
-
- local pypi_element = pypi_data['info'] or {}
- pypi_version = pypi_element['version'] or 'unable to parse'
- end
- return pypi_version
-end
-
-local function is_bad_response(s)
- local lower = s:lower()
- return vim.startswith(lower, 'unable')
- or vim.startswith(lower, 'error')
- or vim.startswith(lower, 'outdated')
-end
-
--- Get version information using the specified interpreter. The interpreter is
--- used directly in case breaking changes were introduced since the last time
--- Nvim's Python client was updated.
---
--- Returns: {
--- {python executable version},
--- {current nvim version},
--- {current pypi nvim status},
--- {installed version status}
--- }
-local function version_info(python)
- local pypi_version = latest_pypi_version()
-
- local python_version = vim.trim(system({
- python,
- '-c',
- 'import sys; print(".".join(str(x) for x in sys.version_info[:3]))',
- }))
-
- if is_blank(python_version) then
- python_version = 'unable to parse ' .. python .. ' response'
- end
-
- local nvim_path = vim.trim(system({
- python,
- '-c',
- 'import sys; sys.path = [p for p in sys.path if p != ""]; import neovim; print(neovim.__file__)',
- }))
- if shell_error() or is_blank(nvim_path) then
- return { python_version, 'unable to load neovim Python module', pypi_version, nvim_path }
- end
-
- -- Assuming that multiple versions of a package are installed, sort them
- -- numerically in descending order.
- local function compare(metapath1, metapath2)
- local a = vim.fn.matchstr(vim.fn.fnamemodify(metapath1, ':p:h:t'), [[[0-9.]\+]])
- local b = vim.fn.matchstr(vim.fn.fnamemodify(metapath2, ':p:h:t'), [[[0-9.]\+]])
- if a == b then
- return 0
- elseif a > b then
- return 1
- else
- return -1
- end
- end
-
- -- Try to get neovim.VERSION (added in 0.1.11dev).
- local nvim_version = system({
- python,
- '-c',
- 'from neovim import VERSION as v; print("{}.{}.{}{}".format(v.major, v.minor, v.patch, v.prerelease))',
- }, '', 1, 1)
- if is_blank(nvim_version) then
- nvim_version = 'unable to find pynvim module version'
- local base = vim.fs.basename(nvim_path, ':h')
- local metas = vim.fn.glob(base .. '-*/METADATA', 1, 1)
- vim.list_extend(metas, vim.fn.glob(base .. '-*/PKG-INFO', 1, 1))
- vim.list_extend(metas, vim.fn.glob(base .. '.egg-info/PKG-INFO', 1, 1))
- metas = table.sort(metas, compare)
-
- if metas and next(metas) ~= nil then
- for _, meta_line in ipairs(vim.fn.readfile(metas[1])) do
- if vim.startswith(meta_line, 'Version:') then
- nvim_version = vim.fn.matchstr(meta_line, [[^Version: \zs\S\+]])
- break
- end
- end
- end
- end
-
- local nvim_path_base = vim.fn.fnamemodify(nvim_path, [[:~:h]])
- local version_status = 'unknown; ' .. nvim_path_base
- if is_bad_response(nvim_version) and is_bad_response(pypi_version) then
- if vim.version.lt(nvim_version, pypi_version) then
- version_status = 'outdated; from ' .. nvim_path_base
- else
- version_status = 'up to date'
- end
- end
-
- return { python_version, nvim_version, pypi_version, version_status }
-end
-
--- Resolves Python executable path by invoking and checking `sys.executable`.
-local function python_exepath(invocation)
- return vim.fs.normalize(
- system(vim.fn.fnameescape(invocation) .. ' -c "import sys; sys.stdout.write(sys.executable)"')
- )
-end
-
-local function python()
- start('Python 3 provider (optional)')
-
- local pyname = 'python3'
- local python_exe = ''
- local virtual_env = os.getenv('VIRTUAL_ENV')
- local venv = virtual_env and vim.fn.resolve(virtual_env) or ''
- local host_prog_var = pyname .. '_host_prog'
- local python_multiple = {}
-
- if disabled_via_loaded_var(pyname) then
- return
- end
-
- local pyenv_table = check_for_pyenv()
- local pyenv = pyenv_table[1]
- local pyenv_root = pyenv_table[2]
-
- if vim.g[host_prog_var] then
- local message = 'Using: g:' .. host_prog_var .. ' = "' .. vim.g[host_prog_var] .. '"'
- info(message)
- end
-
- local python_table = vim.fn['provider#pythonx#Detect'](3)
- pyname = python_table[1]
- local pythonx_warnings = python_table[2]
-
- if is_blank(pyname) then
- warn(
- 'No Python executable found that can `import neovim`. '
- .. 'Using the first available executable for diagnostics.'
- )
- elseif vim.g[host_prog_var] then
- python_exe = pyname
- end
-
- -- No Python executable could `import neovim`, or host_prog_var was used.
- if not is_blank(pythonx_warnings) then
- warn(pythonx_warnings, {
- 'See :help provider-python for more information.',
- 'You may disable this provider (and warning) by adding `let g:loaded_python3_provider = 0` to your init.vim',
- })
- elseif not is_blank(pyname) and is_blank(python_exe) then
- if not vim.g[host_prog_var] then
- local message = '`g:'
- .. host_prog_var
- .. '` is not set. Searching for '
- .. pyname
- .. ' in the environment.'
- info(message)
- end
-
- if not is_blank(pyenv) then
- python_exe = vim.trim(system({ pyenv, 'which', pyname }, '', 1))
- if is_blank(python_exe) then
- warn('pyenv could not find ' .. pyname .. '.')
- end
- end
-
- if is_blank(python_exe) then
- python_exe = vim.fn.exepath(pyname)
-
- if os.getenv('PATH') then
- local path_sep = iswin and ';' or ':'
- local paths = vim.split(os.getenv('PATH') or '', path_sep)
-
- for _, path in ipairs(paths) do
- local path_bin = vim.fs.normalize(path .. '/' .. pyname)
- if
- path_bin ~= vim.fs.normalize(python_exe)
- and vim.list_contains(python_multiple, path_bin)
- and executable(path_bin)
- then
- python_multiple[#python_multiple + 1] = path_bin
- end
- end
-
- if vim.tbl_count(python_multiple) > 0 then
- -- This is worth noting since the user may install something
- -- that changes $PATH, like homebrew.
- local message = 'Multiple '
- .. pyname
- .. ' executables found. '
- .. 'Set `g:'
- .. host_prog_var
- .. '` to avoid surprises.'
- info(message)
- end
-
- if python_exe:find('shims') then
- local message = '`' .. python_exe .. '` appears to be a pyenv shim.'
- local advice = '`pyenv` is not in $PATH, your pyenv installation is broken. Set `g:'
- .. host_prog_var
- .. '` to avoid surprises.'
-
- warn(message, advice)
- end
- end
- end
- end
-
- if not is_blank(python_exe) and not vim.g[host_prog_var] then
- if
- is_blank(venv)
- and not is_blank(pyenv)
- and not is_blank(pyenv_root)
- and vim.startswith(vim.fn.resolve(python_exe), pyenv_root .. '/')
- then
- local advice = 'Create a virtualenv specifically for Nvim using pyenv, and set `g:'
- .. host_prog_var
- .. '`. This will avoid the need to install the pynvim module in each version/virtualenv.'
- warn('pyenv is not set up optimally.', advice)
- elseif not is_blank(venv) then
- local venv_root
- if not is_blank(pyenv_root) then
- venv_root = pyenv_root
- else
- venv_root = vim.fs.dirname(venv)
- end
-
- if vim.startswith(vim.fn.resolve(python_exe), venv_root .. '/') then
- local advice = 'Create a virtualenv specifically for Nvim and use `g:'
- .. host_prog_var
- .. '`. This will avoid the need to install the pynvim module in each virtualenv.'
- warn('Your virtualenv is not set up optimally.', advice)
- end
- end
- end
-
- if is_blank(python_exe) and not is_blank(pyname) then
- -- An error message should have already printed.
- error('`' .. pyname .. '` was not found.')
- elseif not is_blank(python_exe) and not check_bin(python_exe) then
- python_exe = ''
- end
-
- -- Diagnostic output
- info('Executable: ' .. (is_blank(python_exe) and 'Not found' or python_exe))
- if vim.tbl_count(python_multiple) > 0 then
- for _, path_bin in ipairs(python_multiple) do
- info('Other python executable: ' .. path_bin)
- end
- end
-
- if is_blank(python_exe) then
- -- No Python executable can import 'neovim'. Check if any Python executable
- -- can import 'pynvim'. If so, that Python failed to import 'neovim' as
- -- well, which is most probably due to a failed pip upgrade:
- -- https://github.com/neovim/neovim/wiki/Following-HEAD#20181118
- local pynvim_table = vim.fn['provider#pythonx#DetectByModule']('pynvim', 3)
- local pynvim_exe = pynvim_table[1]
- if not is_blank(pynvim_exe) then
- local message = 'Detected pip upgrade failure: Python executable can import "pynvim" but not "neovim": '
- .. pynvim_exe
- local advice = {
- 'Use that Python version to reinstall "pynvim" and optionally "neovim".',
- pynvim_exe .. ' -m pip uninstall pynvim neovim',
- pynvim_exe .. ' -m pip install pynvim',
- pynvim_exe .. ' -m pip install neovim # only if needed by third-party software',
- }
- error(message, advice)
- end
- else
- local version_info_table = version_info(python_exe)
- local majorpyversion = version_info_table[1]
- local current = version_info_table[2]
- local latest = version_info_table[3]
- local status = version_info_table[4]
-
- if vim.fn.str2nr(majorpyversion) ~= 3 then
- warn('Unexpected Python version. This could lead to confusing error messages.')
- end
-
- info('Python version: ' .. majorpyversion)
-
- if is_bad_response(status) then
- info('pynvim version: ' .. current .. ' (' .. status .. ')')
- else
- info('pynvim version: ' .. current)
- end
-
- if is_bad_response(current) then
- error(
- 'pynvim is not installed.\nError: ' .. current,
- 'Run in shell: ' .. python_exe .. ' -m pip install pynvim'
- )
- end
-
- if is_bad_response(latest) then
- warn('Could not contact PyPI to get latest version.')
- error('HTTP request failed: ' .. latest)
- elseif is_bad_response(status) then
- warn('Latest pynvim is NOT installed: ' .. latest)
- elseif not is_bad_response(current) then
- ok('Latest pynvim is installed.')
- end
- end
-
- start('Python virtualenv')
- if not virtual_env then
- ok('no $VIRTUAL_ENV')
- return
- end
- local errors = {}
- -- Keep hints as dict keys in order to discard duplicates.
- local hints = {}
- -- The virtualenv should contain some Python executables, and those
- -- executables should be first both on Nvim's $PATH and the $PATH of
- -- subshells launched from Nvim.
- local bin_dir = iswin and 'Scripts' or 'bin'
- local venv_bins = vim.tbl_filter(function(v)
- -- XXX: Remove irrelevant executables found in bin/.
- return not v:match('python%-config')
- end, vim.fn.glob(string.format('%s/%s/python*', virtual_env, bin_dir), true, true))
- if vim.tbl_count(venv_bins) > 0 then
- for _, venv_bin in pairs(venv_bins) do
- venv_bin = vim.fs.normalize(venv_bin)
- local py_bin_basename = vim.fs.basename(venv_bin)
- local nvim_py_bin = python_exepath(vim.fn.exepath(py_bin_basename))
- local subshell_py_bin = python_exepath(py_bin_basename)
- if venv_bin ~= nvim_py_bin then
- errors[#errors + 1] = '$PATH yields this '
- .. py_bin_basename
- .. ' executable: '
- .. nvim_py_bin
- local hint = '$PATH ambiguities arise if the virtualenv is not '
- .. 'properly activated prior to launching Nvim. Close Nvim, activate the virtualenv, '
- .. 'check that invoking Python from the command line launches the correct one, '
- .. 'then relaunch Nvim.'
- hints[hint] = true
- end
- if venv_bin ~= subshell_py_bin then
- errors[#errors + 1] = '$PATH in subshells yields this '
- .. py_bin_basename
- .. ' executable: '
- .. subshell_py_bin
- local hint = '$PATH ambiguities in subshells typically are '
- .. 'caused by your shell config overriding the $PATH previously set by the '
- .. 'virtualenv. Either prevent them from doing so, or use this workaround: '
- .. 'https://vi.stackexchange.com/a/34996'
- hints[hint] = true
- end
- end
- else
- errors[#errors + 1] = 'no Python executables found in the virtualenv '
- .. bin_dir
- .. ' directory.'
- end
-
- local msg = '$VIRTUAL_ENV is set to: ' .. virtual_env
- if vim.tbl_count(errors) > 0 then
- if vim.tbl_count(venv_bins) > 0 then
- msg = msg
- .. '\nAnd its '
- .. bin_dir
- .. ' directory contains: '
- .. vim.fn.join(vim.fn.map(venv_bins, [[fnamemodify(v:val, ':t')]]), ', ')
- end
- local conj = '\nBut '
- for _, err in ipairs(errors) do
- msg = msg .. conj .. err
- conj = '\nAnd '
- end
- msg = msg .. '\nSo invoking Python may lead to unexpected results.'
- warn(msg, vim.fn.keys(hints))
- else
- info(msg)
- info(
- 'Python version: '
- .. system('python -c "import platform, sys; sys.stdout.write(platform.python_version())"')
- )
- ok('$VIRTUAL_ENV provides :!python.')
- end
-end
-
-local function ruby()
- start('Ruby provider (optional)')
-
- if disabled_via_loaded_var('ruby') then
- return
- end
-
- if not executable('ruby') or not executable('gem') then
- warn(
- '`ruby` and `gem` must be in $PATH.',
- 'Install Ruby and verify that `ruby` and `gem` commands work.'
- )
- return
- end
- info('Ruby: ' .. system({ 'ruby', '-v' }))
-
- local ruby_detect_table = vim.fn['provider#ruby#Detect']()
- local host = ruby_detect_table[1]
- if is_blank(host) then
- warn('`neovim-ruby-host` not found.', {
- 'Run `gem install neovim` to ensure the neovim RubyGem is installed.',
- 'Run `gem environment` to ensure the gem bin directory is in $PATH.',
- 'If you are using rvm/rbenv/chruby, try "rehashing".',
- 'See :help g:ruby_host_prog for non-standard gem installations.',
- 'You may disable this provider (and warning) by adding `let g:loaded_ruby_provider = 0` to your init.vim',
- })
- return
- end
- info('Host: ' .. host)
-
- local latest_gem_cmd = (iswin and 'cmd /c gem list -ra "^^neovim$"' or 'gem list -ra ^neovim$')
- local latest_gem = system(vim.fn.split(latest_gem_cmd))
- if shell_error() or is_blank(latest_gem) then
- error(
- 'Failed to run: ' .. latest_gem_cmd,
- { "Make sure you're connected to the internet.", 'Are you behind a firewall or proxy?' }
- )
- return
- end
- local gem_split = vim.split(latest_gem, [[neovim (\|, \|)$]])
- latest_gem = gem_split[1] or 'not found'
-
- local current_gem_cmd = { host, '--version' }
- local current_gem = system(current_gem_cmd)
- if shell_error() then
- error(
- 'Failed to run: ' .. table.concat(current_gem_cmd, ' '),
- { 'Report this issue with the output of: ', table.concat(current_gem_cmd, ' ') }
- )
- return
- end
-
- if vim.version.lt(current_gem, latest_gem) then
- local message = 'Gem "neovim" is out-of-date. Installed: '
- .. current_gem
- .. ', latest: '
- .. latest_gem
- warn(message, 'Run in shell: gem update neovim')
- else
- ok('Latest "neovim" gem is installed: ' .. current_gem)
- end
-end
-
-local function node()
- start('Node.js provider (optional)')
-
- if disabled_via_loaded_var('node') then
- return
- end
-
- if
- not executable('node')
- or (not executable('npm') and not executable('yarn') and not executable('pnpm'))
- then
- warn(
- '`node` and `npm` (or `yarn`, `pnpm`) must be in $PATH.',
- 'Install Node.js and verify that `node` and `npm` (or `yarn`, `pnpm`) commands work.'
- )
- return
- end
-
- -- local node_v = vim.fn.split(system({'node', '-v'}), "\n")[1] or ''
- local node_v = system({ 'node', '-v' })
- info('Node.js: ' .. node_v)
- if shell_error() or vim.version.lt(node_v, '6.0.0') then
- warn('Nvim node.js host does not support Node ' .. node_v)
- -- Skip further checks, they are nonsense if nodejs is too old.
- return
- end
- if vim.fn['provider#node#can_inspect']() == 0 then
- warn(
- 'node.js on this system does not support --inspect-brk so $NVIM_NODE_HOST_DEBUG is ignored.'
- )
- end
-
- local node_detect_table = vim.fn['provider#node#Detect']()
- local host = node_detect_table[1]
- if is_blank(host) then
- warn('Missing "neovim" npm (or yarn, pnpm) package.', {
- 'Run in shell: npm install -g neovim',
- 'Run in shell (if you use yarn): yarn global add neovim',
- 'Run in shell (if you use pnpm): pnpm install -g neovim',
- 'You may disable this provider (and warning) by adding `let g:loaded_node_provider = 0` to your init.vim',
- })
- return
- end
- info('Nvim node.js host: ' .. host)
-
- local manager = 'npm'
- if executable('yarn') then
- manager = 'yarn'
- elseif executable('pnpm') then
- manager = 'pnpm'
- end
-
- local latest_npm_cmd = (
- iswin and 'cmd /c ' .. manager .. ' info neovim --json' or manager .. ' info neovim --json'
- )
- local latest_npm = system(vim.fn.split(latest_npm_cmd))
- if shell_error() or is_blank(latest_npm) then
- error(
- 'Failed to run: ' .. latest_npm_cmd,
- { "Make sure you're connected to the internet.", 'Are you behind a firewall or proxy?' }
- )
- return
- end
-
- local pcall_ok, output = pcall(vim.fn.json_decode, latest_npm)
- local pkg_data
- if pcall_ok then
- pkg_data = output
- else
- return 'error: ' .. latest_npm
- end
- local latest_npm_subtable = pkg_data['dist-tags'] or {}
- latest_npm = latest_npm_subtable['latest'] or 'unable to parse'
-
- local current_npm_cmd = { 'node', host, '--version' }
- local current_npm = system(current_npm_cmd)
- if shell_error() then
- error(
- 'Failed to run: ' .. table.concat(current_npm_cmd, ' '),
- { 'Report this issue with the output of: ', table.concat(current_npm_cmd, ' ') }
- )
- return
- end
-
- if latest_npm ~= 'unable to parse' and vim.version.lt(current_npm, latest_npm) then
- local message = 'Package "neovim" is out-of-date. Installed: '
- .. current_npm
- .. ' latest: '
- .. latest_npm
- warn(message, {
- 'Run in shell: npm install -g neovim',
- 'Run in shell (if you use yarn): yarn global add neovim',
- 'Run in shell (if you use pnpm): pnpm install -g neovim',
- })
- else
- ok('Latest "neovim" npm/yarn/pnpm package is installed: ' .. current_npm)
- end
-end
-
-local function perl()
- start('Perl provider (optional)')
-
- if disabled_via_loaded_var('perl') then
- return
- end
-
- local perl_detect_table = vim.fn['provider#perl#Detect']()
- local perl_exec = perl_detect_table[1]
- local perl_warnings = perl_detect_table[2]
-
- if is_blank(perl_exec) then
- if not is_blank(perl_warnings) then
- warn(perl_warnings, {
- 'See :help provider-perl for more information.',
- 'You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim',
- })
- else
- warn('No usable perl executable found')
- end
- return
- end
-
- info('perl executable: ' .. perl_exec)
-
- -- we cannot use cpanm that is on the path, as it may not be for the perl
- -- set with g:perl_host_prog
- system({ perl_exec, '-W', '-MApp::cpanminus', '-e', '' })
- if shell_error() then
- return { perl_exec, '"App::cpanminus" module is not installed' }
- end
-
- local latest_cpan_cmd = {
- perl_exec,
- '-MApp::cpanminus::script',
- '-e',
- 'my $app = App::cpanminus::script->new; $app->parse_options ("--info", "-q", "Neovim::Ext"); exit $app->doit',
- }
-
- local latest_cpan = system(latest_cpan_cmd)
- if shell_error() or is_blank(latest_cpan) then
- error(
- 'Failed to run: ' .. table.concat(latest_cpan_cmd, ' '),
- { "Make sure you're connected to the internet.", 'Are you behind a firewall or proxy?' }
- )
- return
- elseif latest_cpan[1] == '!' then
- local cpanm_errs = vim.split(latest_cpan, '!')
- if cpanm_errs[1]:find("Can't write to ") then
- local advice = {}
- for i = 2, #cpanm_errs do
- advice[#advice + 1] = cpanm_errs[i]
- end
-
- warn(cpanm_errs[1], advice)
- -- Last line is the package info
- latest_cpan = cpanm_errs[#cpanm_errs]
- else
- error('Unknown warning from command: ' .. latest_cpan_cmd, cpanm_errs)
- return
- end
- end
- latest_cpan = vim.fn.matchstr(latest_cpan, [[\(\.\?\d\)\+]])
- if is_blank(latest_cpan) then
- error('Cannot parse version number from cpanm output: ' .. latest_cpan)
- return
- end
-
- local current_cpan_cmd = { perl_exec, '-W', '-MNeovim::Ext', '-e', 'print $Neovim::Ext::VERSION' }
- local current_cpan = system(current_cpan_cmd)
- if shell_error() then
- error(
- 'Failed to run: ' .. table.concat(current_cpan_cmd, ' '),
- { 'Report this issue with the output of: ', table.concat(current_cpan_cmd, ' ') }
- )
- return
- end
-
- if vim.version.lt(current_cpan, latest_cpan) then
- local message = 'Module "Neovim::Ext" is out-of-date. Installed: '
- .. current_cpan
- .. ', latest: '
- .. latest_cpan
- warn(message, 'Run in shell: cpanm -n Neovim::Ext')
- else
- ok('Latest "Neovim::Ext" cpan module is installed: ' .. current_cpan)
- end
-end
-
-function M.check()
- clipboard()
- python()
- ruby()
- node()
- perl()
-end
-
-return M
diff --git a/runtime/lua/provider/node/health.lua b/runtime/lua/provider/node/health.lua
new file mode 100644
index 0000000000..a434f8a92b
--- /dev/null
+++ b/runtime/lua/provider/node/health.lua
@@ -0,0 +1,105 @@
+local health = vim.health
+local executable = health.executable
+local iswin = vim.loop.os_uname().sysname == 'Windows_NT'
+
+local M = {}
+
+function M.check()
+ health.start('Node.js provider (optional)')
+
+ if health.provider_disabled('node') then
+ return
+ end
+
+ if
+ not executable('node')
+ or (not executable('npm') and not executable('yarn') and not executable('pnpm'))
+ then
+ health.warn(
+ '`node` and `npm` (or `yarn`, `pnpm`) must be in $PATH.',
+ 'Install Node.js and verify that `node` and `npm` (or `yarn`, `pnpm`) commands work.'
+ )
+ return
+ end
+
+ -- local node_v = vim.fn.split(system({'node', '-v'}), "\n")[1] or ''
+ local ok, node_v = health.cmd_ok({ 'node', '-v' })
+ health.info('Node.js: ' .. node_v)
+ if not ok or vim.version.lt(node_v, '6.0.0') then
+ health.warn('Nvim node.js host does not support Node ' .. node_v)
+ -- Skip further checks, they are nonsense if nodejs is too old.
+ return
+ end
+ if vim.fn['provider#node#can_inspect']() == 0 then
+ health.warn(
+ 'node.js on this system does not support --inspect-brk so $NVIM_NODE_HOST_DEBUG is ignored.'
+ )
+ end
+
+ local node_detect_table = vim.fn['provider#node#Detect']()
+ local host = node_detect_table[1]
+ if host:find('^%s*$') then
+ health.warn('Missing "neovim" npm (or yarn, pnpm) package.', {
+ 'Run in shell: npm install -g neovim',
+ 'Run in shell (if you use yarn): yarn global add neovim',
+ 'Run in shell (if you use pnpm): pnpm install -g neovim',
+ 'You may disable this provider (and warning) by adding `let g:loaded_node_provider = 0` to your init.vim',
+ })
+ return
+ end
+ health.info('Nvim node.js host: ' .. host)
+
+ local manager = 'npm'
+ if executable('yarn') then
+ manager = 'yarn'
+ elseif executable('pnpm') then
+ manager = 'pnpm'
+ end
+
+ local latest_npm_cmd = (
+ iswin and 'cmd /c ' .. manager .. ' info neovim --json' or manager .. ' info neovim --json'
+ )
+ local latest_npm
+ ok, latest_npm = health.cmd_ok(vim.split(latest_npm_cmd, ' '))
+ if not ok or latest_npm:find('^%s$') then
+ health.error(
+ 'Failed to run: ' .. latest_npm_cmd,
+ { "Make sure you're connected to the internet.", 'Are you behind a firewall or proxy?' }
+ )
+ return
+ end
+
+ local pcall_ok, pkg_data = pcall(vim.json.decode, latest_npm)
+ if not pcall_ok then
+ return 'error: ' .. latest_npm
+ end
+ local latest_npm_subtable = pkg_data['dist-tags'] or {}
+ latest_npm = latest_npm_subtable['latest'] or 'unable to parse'
+
+ local current_npm_cmd = { 'node', host, '--version' }
+ local current_npm
+ ok, current_npm = health.cmd_ok(current_npm_cmd)
+ if not ok then
+ health.error(
+ 'Failed to run: ' .. table.concat(current_npm_cmd, ' '),
+ { 'Report this issue with the output of: ', table.concat(current_npm_cmd, ' ') }
+ )
+ return
+ end
+
+ if latest_npm ~= 'unable to parse' and vim.version.lt(current_npm, latest_npm) then
+ local message = 'Package "neovim" is out-of-date. Installed: '
+ .. current_npm
+ .. ' latest: '
+ .. latest_npm
+ health.warn(message({
+ 'Run in shell: npm install -g neovim',
+ 'Run in shell (if you use yarn): yarn global add neovim',
+ 'Run in shell (if you use pnpm): pnpm install -g neovim',
+ }))
+ else
+ health.ok('Latest "neovim" npm/yarn/pnpm package is installed: ' .. current_npm)
+ end
+end
+
+return M
diff --git a/runtime/lua/provider/perl/health.lua b/runtime/lua/provider/perl/health.lua
new file mode 100644
index 0000000000..535093d793
--- /dev/null
+++ b/runtime/lua/provider/perl/health.lua
@@ -0,0 +1,90 @@
+local health = vim.health
+
+local M = {}
+
+function M.check()
+ health.start('Perl provider (optional)')
+
+ if health.provider_disabled('perl') then
+ return
+ end
+
+ local perl_exec, perl_warnings = vim.provider.perl.detect()
+
+ if not perl_exec then
+ health.warn(assert(perl_warnings), {
+ 'See :help provider-perl for more information.',
+ 'You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim',
+ })
+ health.warn('No usable perl executable found')
+ return
+ end
+
+ health.info('perl executable: ' .. perl_exec)
+
+ -- we cannot use cpanm that is on the path, as it may not be for the perl
+ -- set with g:perl_host_prog
+ local ok = health.cmd_ok({ perl_exec, '-W', '-MApp::cpanminus', '-e', '' })
+ if not ok then
+ return { perl_exec, '"App::cpanminus" module is not installed' }
+ end
+
+ local latest_cpan_cmd = {
+ perl_exec,
+ '-MApp::cpanminus::fatscript',
+ '-e',
+ 'my $app = App::cpanminus::script->new; $app->parse_options ("--info", "-q", "Neovim::Ext"); exit $app->doit',
+ }
+ local latest_cpan
+ ok, latest_cpan = health.cmd_ok(latest_cpan_cmd)
+ if not ok or latest_cpan:find('^%s*$') then
+ health.error(
+ 'Failed to run: ' .. table.concat(latest_cpan_cmd, ' '),
+ { "Make sure you're connected to the internet.", 'Are you behind a firewall or proxy?' }
+ )
+ return
+ elseif latest_cpan[1] == '!' then
+ local cpanm_errs = vim.split(latest_cpan, '!')
+ if cpanm_errs[1]:find("Can't write to ") then
+ local advice = {}
+ for i = 2, #cpanm_errs do
+ advice[#advice + 1] = cpanm_errs[i]
+ end
+
+ health.warn(cpanm_errs[1], advice)
+ -- Last line is the package info
+ latest_cpan = cpanm_errs[#cpanm_errs]
+ else
+ health.error('Unknown warning from command: ' .. latest_cpan_cmd, cpanm_errs)
+ return
+ end
+ end
+ latest_cpan = vim.fn.matchstr(latest_cpan, [[\(\.\?\d\)\+]])
+ if latest_cpan:find('^%s*$') then
+ health.error('Cannot parse version number from cpanm output: ' .. latest_cpan)
+ return
+ end
+
+ local current_cpan_cmd = { perl_exec, '-W', '-MNeovim::Ext', '-e', 'print $Neovim::Ext::VERSION' }
+ local current_cpan
+ ok, current_cpan = health.cmd_ok(current_cpan_cmd)
+ if not ok then
+ health.error(
+ 'Failed to run: ' .. table.concat(current_cpan_cmd, ' '),
+ { 'Report this issue with the output of: ', table.concat(current_cpan_cmd, ' ') }
+ )
+ return
+ end
+
+ if vim.version.lt(current_cpan, latest_cpan) then
+ local message = 'Module "Neovim::Ext" is out-of-date. Installed: '
+ .. current_cpan
+ .. ', latest: '
+ .. latest_cpan
+ health.warn(message, 'Run in shell: cpanm -n Neovim::Ext')
+ else
+ health.ok('Latest "Neovim::Ext" cpan module is installed: ' .. current_cpan)
+ end
+end
+
+return M
diff --git a/runtime/lua/provider/python/health.lua b/runtime/lua/provider/python/health.lua
new file mode 100644
index 0000000000..333890b62b
--- /dev/null
+++ b/runtime/lua/provider/python/health.lua
@@ -0,0 +1,500 @@
+local health = vim.health
+local executable = health.executable
+local iswin = vim.loop.os_uname().sysname == 'Windows_NT'
+
+local M = {}
+
+local function is(path, ty)
+ if not path then
+ return false
+ end
+ local stat = vim.loop.fs_stat(path)
+ if not stat then
+ return false
+ end
+ return stat.type == ty
+end
+
+-- Resolves Python executable path by invoking and checking `sys.executable`.
+local function python_exepath(invocation)
+ local p = vim.system({ invocation, '-c', 'import sys; sys.stdout.write(sys.executable)' }):wait()
+ assert(p.code == 0, p.stderr)
+ return vim.fs.normalize(vim.trim(p.stdout))
+end
+
+-- Check if pyenv is available and a valid pyenv root can be found, then return
+-- their respective paths. If either of those is invalid, return two empty
+-- strings, effectively ignoring pyenv.
+local function check_for_pyenv()
+ local pyenv_path = vim.fn.resolve(vim.fn.exepath('pyenv'))
+
+ if pyenv_path == '' then
+ return { '', '' }
+ end
+
+ health.info('pyenv: Path: ' .. pyenv_path)
+
+ local pyenv_root = vim.fn.resolve(os.getenv('PYENV_ROOT') or '')
+
+ if pyenv_root == '' then
+ pyenv_root = vim.fn.system({ pyenv_path, 'root' })
+ health.info('pyenv: $PYENV_ROOT is not set. Infer from `pyenv root`.')
+ end
+
+ if not is(pyenv_root, 'directory') then
+ local message = string.format(
+ 'pyenv: Root does not exist: %s. Ignoring pyenv for all following checks.',
+ pyenv_root
+ )
+ health.warn(message)
+ return { '', '' }
+ end
+
+ health.info('pyenv: Root: ' .. pyenv_root)
+
+ return { pyenv_path, pyenv_root }
+end
+
+-- Check the Python interpreter's usability.
+local function check_bin(bin)
+ if not is(bin, 'file') and (not iswin or not is(bin .. '.exe', 'file')) then
+ health.error('"' .. bin .. '" was not found.')
+ return false
+ elseif not executable(bin) then
+ health.error('"' .. bin .. '" is not executable.')
+ return false
+ end
+ return true
+end
+
+-- Fetch the contents of a URL.
+local function download(url)
+ local has_curl = executable('curl')
+ if has_curl and vim.fn.system({ 'curl', '-V' }):find('Protocols:.*https') then
+ local out, rc = health.system({ 'curl', '-sL', url }, { stderr = true, ignore_error = true })
+ if rc ~= 0 then
+ return 'curl error with ' .. url .. ': ' .. rc
+ else
+ return out
+ end
+ elseif executable('python') then
+ local script = "try:\n\
+ from urllib.request import urlopen\n\
+ except ImportError:\n\
+ from urllib2 import urlopen\n\
+ response = urlopen('" .. url .. "')\n\
+ print(response.read().decode('utf8'))\n"
+ local out, rc = health.system({ 'python', '-c', script })
+ if out == '' and rc ~= 0 then
+ return 'python urllib.request error: ' .. rc
+ else
+ return out
+ end
+ end
+
+ local message = 'missing `curl` '
+
+ if has_curl then
+ message = message .. '(with HTTPS support) '
+ end
+ message = message .. 'and `python`, cannot make web request'
+
+ return message
+end
+
+-- Get the latest Nvim Python client (pynvim) version from PyPI.
+local function latest_pypi_version()
+ local pypi_version = 'unable to get pypi response'
+ local pypi_response = download('https://pypi.python.org/pypi/pynvim/json')
+ if pypi_response ~= '' then
+ local pcall_ok, output = pcall(vim.fn.json_decode, pypi_response)
+ local pypi_data
+ if pcall_ok then
+ pypi_data = output
+ else
+ return 'error: ' .. pypi_response
+ end
+
+ local pypi_element = pypi_data['info'] or {}
+ pypi_version = pypi_element['version'] or 'unable to parse'
+ end
+ return pypi_version
+end
+
+local function is_bad_response(s)
+ local lower = s:lower()
+ return vim.startswith(lower, 'unable')
+ or vim.startswith(lower, 'error')
+ or vim.startswith(lower, 'outdated')
+end
+
+-- Get version information using the specified interpreter. The interpreter is
+-- used directly in case breaking changes were introduced since the last time
+-- Nvim's Python client was updated.
+--
+-- Returns: {
+-- {python executable version},
+-- {current nvim version},
+-- {current pypi nvim status},
+-- {installed version status}
+-- }
+local function version_info(python)
+ local pypi_version = latest_pypi_version()
+
+ local python_version, rc = health.system({
+ python,
+ '-c',
+ 'import sys; print(".".join(str(x) for x in sys.version_info[:3]))',
+ })
+
+ if rc ~= 0 or python_version == '' then
+ python_version = 'unable to parse ' .. python .. ' response'
+ end
+
+ local nvim_path
+ nvim_path, rc = health.system({
+ python,
+ '-c',
+ 'import sys; sys.path = [p for p in sys.path if p != ""]; import neovim; print(neovim.__file__)',
+ })
+ if rc ~= 0 or nvim_path == '' then
+ return { python_version, 'unable to load neovim Python module', pypi_version, nvim_path }
+ end
+
+ -- Assuming that multiple versions of a package are installed, sort them
+ -- numerically in descending order.
+ local function compare(metapath1, metapath2)
+ local a = vim.fn.matchstr(vim.fn.fnamemodify(metapath1, ':p:h:t'), [[[0-9.]\+]])
+ local b = vim.fn.matchstr(vim.fn.fnamemodify(metapath2, ':p:h:t'), [[[0-9.]\+]])
+ if a == b then
+ return 0
+ elseif a > b then
+ return 1
+ else
+ return -1
+ end
+ end
+
+ -- Try to get neovim.VERSION (added in 0.1.11dev).
+ local nvim_version
+ nvim_version, rc = health.system({
+ python,
+ '-c',
+ 'from neovim import VERSION as v; print("{}.{}.{}{}".format(v.major, v.minor, v.patch, v.prerelease))',
+ }, { stderr = true, ignore_error = true })
+ if rc ~= 0 or nvim_version == '' then
+ nvim_version = 'unable to find pynvim module version'
+ local base = vim.fs.basename(nvim_path)
+ local metas = vim.fn.glob(base .. '-*/METADATA', 1, 1)
+ vim.list_extend(metas, vim.fn.glob(base .. '-*/PKG-INFO', 1, 1))
+ vim.list_extend(metas, vim.fn.glob(base .. '.egg-info/PKG-INFO', 1, 1))
+ metas = table.sort(metas, compare)
+
+ if metas and next(metas) ~= nil then
+ for line in io.lines(metas[1]) do
+ local version = line:match('^Version: (%S+)')
+ if version then
+ nvim_version = version
+ break
+ end
+ end
+ end
+ end
+
+ local nvim_path_base = vim.fn.fnamemodify(nvim_path, [[:~:h]])
+ local version_status = 'unknown; ' .. nvim_path_base
+ if is_bad_response(nvim_version) and is_bad_response(pypi_version) then
+ if vim.version.lt(nvim_version, pypi_version) then
+ version_status = 'outdated; from ' .. nvim_path_base
+ else
+ version_status = 'up to date'
+ end
+ end
+
+ return { python_version, nvim_version, pypi_version, version_status }
+end
+
+function M.check()
+ health.start('Python 3 provider (optional)')
+
+ local pyname = 'python3' ---@type string?
+ local python_exe = ''
+ local virtual_env = os.getenv('VIRTUAL_ENV')
+ local venv = virtual_env and vim.fn.resolve(virtual_env) or ''
+ local host_prog_var = pyname .. '_host_prog'
+ local python_multiple = {}
+
+ if health.provider_disabled(pyname) then
+ return
+ end
+
+ local pyenv_table = check_for_pyenv()
+ local pyenv = pyenv_table[1]
+ local pyenv_root = pyenv_table[2]
+
+ if vim.g[host_prog_var] then
+ local message = string.format('Using: g:%s = "%s"', host_prog_var, vim.g[host_prog_var])
+ health.info(message)
+ end
+
+ local pythonx_warnings
+ pyname, pythonx_warnings = vim.provider.python.detect_by_module('neovim')
+
+ if not pyname then
+ health.warn(
+ 'No Python executable found that can `import neovim`. '
+ .. 'Using the first available executable for diagnostics.'
+ )
+ elseif vim.g[host_prog_var] then
+ python_exe = pyname
+ end
+
+ -- No Python executable could `import neovim`, or host_prog_var was used.
+ if pythonx_warnings then
+ health.warn(pythonx_warnings, {
+ 'See :help provider-python for more information.',
+ 'You may disable this provider (and warning) by adding `let g:loaded_python3_provider = 0` to your init.vim',
+ })
+ elseif pyname and pyname ~= '' and python_exe == '' then
+ if not vim.g[host_prog_var] then
+ local message = string.format(
+ '`g:%s` is not set. Searching for %s in the environment.',
+ host_prog_var,
+ pyname
+ )
+ health.info(message)
+ end
+
+ if pyenv ~= '' then
+ python_exe = health.system({ pyenv, 'which', pyname }, { stderr = true })
+ if python_exe == '' then
+ health.warn('pyenv could not find ' .. pyname .. '.')
+ end
+ end
+
+ if python_exe == '' then
+ python_exe = vim.fn.exepath(pyname)
+
+ if os.getenv('PATH') then
+ local path_sep = iswin and ';' or ':'
+ local paths = vim.split(os.getenv('PATH') or '', path_sep)
+
+ for _, path in ipairs(paths) do
+ local path_bin = vim.fs.normalize(path .. '/' .. pyname)
+ if
+ path_bin ~= vim.fs.normalize(python_exe)
+ and vim.tbl_contains(python_multiple, path_bin)
+ and executable(path_bin)
+ then
+ python_multiple[#python_multiple + 1] = path_bin
+ end
+ end
+
+ if vim.tbl_count(python_multiple) > 0 then
+ -- This is worth noting since the user may install something
+ -- that changes $PATH, like homebrew.
+ local message = string.format(
+ 'Multiple %s executables found. Set `g:%s` to avoid surprises.',
+ pyname,
+ host_prog_var
+ )
+ health.info(message)
+ end
+
+ if python_exe:find('shims') then
+ local message = string.format('`%s` appears to be a pyenv shim.', python_exe)
+ local advice = string.format(
+ '`pyenv` is not in $PATH, your pyenv installation is broken. Set `g:%s` to avoid surprises.',
+ host_prog_var
+ )
+ health.warn(message, advice)
+ end
+ end
+ end
+ end
+
+ if python_exe ~= '' and not vim.g[host_prog_var] then
+ if
+ venv == ''
+ and pyenv ~= ''
+ and pyenv_root ~= ''
+ and vim.startswith(vim.fn.resolve(python_exe), pyenv_root .. '/')
+ then
+ local advice = string.format(
+ 'Create a virtualenv specifically for Nvim using pyenv, and set `g:%s`. This will avoid the need to install the pynvim module in each version/virtualenv.',
+ host_prog_var
+ )
+ health.warn('pyenv is not set up optimally.', advice)
+ elseif venv ~= '' then
+ local venv_root
+ if pyenv_root ~= '' then
+ venv_root = pyenv_root
+ else
+ venv_root = vim.fs.dirname(venv)
+ end
+
+ if vim.startswith(vim.fn.resolve(python_exe), venv_root .. '/') then
+ local advice = string.format(
+ 'Create a virtualenv specifically for Nvim and use `g:%s`. This will avoid the need to install the pynvim module in each virtualenv.',
+ host_prog_var
+ )
+ health.warn('Your virtualenv is not set up optimally.', advice)
+ end
+ end
+ end
+
+ if pyname and python_exe == '' and pyname ~= '' then
+ -- An error message should have already printed.
+ health.error('`' .. pyname .. '` was not found.')
+ elseif python_exe ~= '' and not check_bin(python_exe) then
+ python_exe = ''
+ end
+
+ -- Diagnostic output
+ health.info('Executable: ' .. (python_exe == '' and 'Not found' or python_exe))
+ if vim.tbl_count(python_multiple) > 0 then
+ for _, path_bin in ipairs(python_multiple) do
+ health.info('Other python executable: ' .. path_bin)
+ end
+ end
+
+ if python_exe == '' then
+ -- No Python executable can import 'neovim'. Check if any Python executable
+ -- can import 'pynvim'. If so, that Python failed to import 'neovim' as
+ -- well, which is most probably due to a failed pip upgrade:
+ -- https://github.com/neovim/neovim/wiki/Following-HEAD#20181118
+ local pynvim_exe = vim.provider.python.detect_by_module('pynvim')
+ if pynvim_exe then
+ local message = 'Detected pip upgrade failure: Python executable can import "pynvim" but not "neovim": '
+ .. pynvim_exe
+ local advice = {
+ 'Use that Python version to reinstall "pynvim" and optionally "neovim".',
+ pynvim_exe .. ' -m pip uninstall pynvim neovim',
+ pynvim_exe .. ' -m pip install pynvim',
+ pynvim_exe .. ' -m pip install neovim # only if needed by third-party software',
+ }
+ health.error(message, advice)
+ end
+ else
+ local version_info_table = version_info(python_exe)
+ local pyversion = version_info_table[1]
+ local current = version_info_table[2]
+ local latest = version_info_table[3]
+ local status = version_info_table[4]
+
+ if not vim.version.range('~3'):has(pyversion) then
+ health.warn('Unexpected Python version. This could lead to confusing error messages.')
+ end
+
+ health.info('Python version: ' .. pyversion)
+
+ if is_bad_response(status) then
+ health.info('pynvim version: ' .. current .. ' (' .. status .. ')')
+ else
+ health.info('pynvim version: ' .. current)
+ end
+
+ if is_bad_response(current) then
+ health.error(
+ 'pynvim is not installed.\nError: ' .. current,
+ 'Run in shell: ' .. python_exe .. ' -m pip install pynvim'
+ )
+ end
+
+ if is_bad_response(latest) then
+ health.warn('Could not contact PyPI to get latest version.')
+ health.error('HTTP request failed: ' .. latest)
+ elseif is_bad_response(status) then
+ health.warn('Latest pynvim is NOT installed: ' .. latest)
+ elseif not is_bad_response(current) then
+ health.ok('Latest pynvim is installed.')
+ end
+ end
+
+ health.start('Python virtualenv')
+ if not virtual_env then
+ health.ok('no $VIRTUAL_ENV')
+ return
+ end
+ local errors = {}
+ -- Keep hints as dict keys in order to discard duplicates.
+ local hints = {}
+ -- The virtualenv should contain some Python executables, and those
+ -- executables should be first both on Nvim's $PATH and the $PATH of
+ -- subshells launched from Nvim.
+ local bin_dir = iswin and 'Scripts' or 'bin'
+ local venv_bins = vim.fn.glob(string.format('%s/%s/python*', virtual_env, bin_dir), true, true)
+ venv_bins = vim.tbl_filter(function(v)
+ -- XXX: Remove irrelevant executables found in bin/.
+ return not v:match('python%-config')
+ end, venv_bins)
+ if vim.tbl_count(venv_bins) > 0 then
+ for _, venv_bin in pairs(venv_bins) do
+ venv_bin = vim.fs.normalize(venv_bin)
+ local py_bin_basename = vim.fs.basename(venv_bin)
+ local nvim_py_bin = python_exepath(vim.fn.exepath(py_bin_basename))
+ local subshell_py_bin = python_exepath(py_bin_basename)
+ if venv_bin ~= nvim_py_bin then
+ errors[#errors + 1] = '$PATH yields this '
+ .. py_bin_basename
+ .. ' executable: '
+ .. nvim_py_bin
+ local hint = '$PATH ambiguities arise if the virtualenv is not '
+ .. 'properly activated prior to launching Nvim. Close Nvim, activate the virtualenv, '
+ .. 'check that invoking Python from the command line launches the correct one, '
+ .. 'then relaunch Nvim.'
+ hints[hint] = true
+ end
+ if venv_bin ~= subshell_py_bin then
+ errors[#errors + 1] = '$PATH in subshells yields this '
+ .. py_bin_basename
+ .. ' executable: '
+ .. subshell_py_bin
+ local hint = '$PATH ambiguities in subshells typically are '
+ .. 'caused by your shell config overriding the $PATH previously set by the '
+ .. 'virtualenv. Either prevent them from doing so, or use this workaround: '
+ .. 'https://vi.stackexchange.com/a/34996'
+ hints[hint] = true
+ end
+ end
+ else
+ errors[#errors + 1] = 'no Python executables found in the virtualenv '
+ .. bin_dir
+ .. ' directory.'
+ end
+
+ local msg = '$VIRTUAL_ENV is set to: ' .. virtual_env
+ if vim.tbl_count(errors) > 0 then
+ if vim.tbl_count(venv_bins) > 0 then
+ msg = string.format(
+ '%s\nAnd its %s directory contains: %s',
+ msg,
+ bin_dir,
+ table.concat(
+ vim.tbl_map(function(v)
+ return vim.fn.fnamemodify(v, ':t')
+ end, venv_bins),
+ ', '
+ )
+ )
+ end
+ local conj = '\nBut '
+ for _, err in ipairs(errors) do
+ msg = msg .. conj .. err
+ conj = '\nAnd '
+ end
+ msg = msg .. '\nSo invoking Python may lead to unexpected results.'
+ health.warn(msg, vim.tbl_keys(hints))
+ else
+ health.info(msg)
+ health.info(
+ 'Python version: '
+ .. health.system(
+ 'python -c "import platform, sys; sys.stdout.write(platform.python_version())"'
+ )
+ )
+ health.ok('$VIRTUAL_ENV provides :!python.')
+ end
+end
+
+return M
diff --git a/runtime/lua/provider/ruby/health.lua b/runtime/lua/provider/ruby/health.lua
new file mode 100644
index 0000000000..04f6e303e6
--- /dev/null
+++ b/runtime/lua/provider/ruby/health.lua
@@ -0,0 +1,71 @@
+local health = vim.health
+local executable = health.executable
+local iswin = vim.loop.os_uname().sysname == 'Windows_NT'
+
+local M = {}
+
+function M.check()
+ health.start('Ruby provider (optional)')
+
+ if health.provider_disabled('ruby') then
+ return
+ end
+
+ if not executable('ruby') or not executable('gem') then
+ health.warn(
+ '`ruby` and `gem` must be in $PATH.',
+ 'Install Ruby and verify that `ruby` and `gem` commands work.'
+ )
+ return
+ end
+ health.info('Ruby: ' .. health.system({ 'ruby', '-v' }))
+
+ local ruby_detect_table = vim.provider.ruby.detect()
+ local host = ruby_detect_table[1]
+ if (not host) or host:find('^%s*$') then
+ health.warn('`neovim-ruby-host` not found.', {
+ 'Run `gem install neovim` to ensure the neovim RubyGem is installed.',
+ 'Run `gem environment` to ensure the gem bin directory is in $PATH.',
+ 'If you are using rvm/rbenv/chruby, try "rehashing".',
+ 'See :help g:ruby_host_prog for non-standard gem installations.',
+ 'You may disable this provider (and warning) by adding `let g:loaded_ruby_provider = 0` to your init.vim',
+ })
+ return
+ end
+ health.info('Host: ' .. host)
+
+ local latest_gem_cmd = (iswin and 'cmd /c gem list -ra "^^neovim$"' or 'gem list -ra ^neovim$')
+ local ok, latest_gem = health.cmd_ok(vim.split(latest_gem_cmd, ' '))
+ if not ok or latest_gem:find('^%s*$') then
+ health.error(
+ 'Failed to run: ' .. latest_gem_cmd,
+ { "Make sure you're connected to the internet.", 'Are you behind a firewall or proxy?' }
+ )
+ return
+ end
+ local gem_split = vim.split(latest_gem, [[neovim (\|, \|)$]])
+ latest_gem = gem_split[1] or 'not found'
+
+ local current_gem_cmd = { host, '--version' }
+ local current_gem
+ ok, current_gem = health.cmd_ok(current_gem_cmd)
+ if not ok then
+ health.error(
+ 'Failed to run: ' .. table.concat(current_gem_cmd, ' '),
+ { 'Report this issue with the output of: ', table.concat(current_gem_cmd, ' ') }
+ )
+ return
+ end
+
+ if vim.version.lt(current_gem, latest_gem) then
+ local message = 'Gem "neovim" is out-of-date. Installed: '
+ .. current_gem
+ .. ', latest: '
+ .. latest_gem
+ health.warn(message, 'Run in shell: gem update neovim')
+ else
+ health.ok('Latest "neovim" gem is installed: ' .. current_gem)
+ end
+end
+
+return M
diff --git a/runtime/lua/tohtml.lua b/runtime/lua/tohtml.lua
new file mode 100644
index 0000000000..505de720ba
--- /dev/null
+++ b/runtime/lua/tohtml.lua
@@ -0,0 +1,1349 @@
+--- @brief
+---<pre>help
+---:TOhtml {file} *:TOhtml*
+---Converts the buffer shown in the current window to HTML, opens the generated
+---HTML in a new split window, and saves its contents to {file}. If {file} is not
+---given, a temporary file (created by |tempname()|) is used.
+---</pre>
+
+-- The HTML conversion script is different from Vim's one. If you want to use
+-- Vim's TOhtml converter, download it from the vim GitHub repo.
+-- Here are the Vim files related to this functionality:
+-- - https://github.com/vim/vim/blob/master/runtime/syntax/2html.vim
+-- - https://github.com/vim/vim/blob/master/runtime/autoload/tohtml.vim
+-- - https://github.com/vim/vim/blob/master/runtime/plugin/tohtml.vim
+--
+-- Main differences between this and the vim version:
+-- - No "ignore some visual thing" settings (just set the right Vim option)
+-- - No support for legacy web engines
+-- - No support for legacy encoding (supports only UTF-8)
+-- - No interactive webpage
+-- - No specifying the internal HTML (no XHTML, no use_css=false)
+-- - No multiwindow diffs
+-- - No ranges
+--
+-- Remarks:
+-- - Not all visuals are supported, so it may differ.
+
+--- @class (private) vim.tohtml.state.global
+--- @field background string
+--- @field foreground string
+--- @field title string|false
+--- @field font string
+--- @field highlights_name table<integer,string>
+--- @field conf vim.tohtml.opt
+
+--- @class (private) vim.tohtml.state:vim.tohtml.state.global
+--- @field style vim.tohtml.styletable
+--- @field tabstop string|false
+--- @field opt vim.wo
+--- @field winid integer
+--- @field bufnr integer
+--- @field width integer
+--- @field buflen integer
+
+--- @class (private) vim.tohtml.styletable
+--- @field [integer] vim.tohtml.line (integer: (1-index, exclusive))
+
+--- @class (private) vim.tohtml.line
+--- @field virt_lines {[integer]:{[1]:string,[2]:integer}[]}
+--- @field pre_text string[][]
+--- @field hide? boolean
+--- @field [integer] vim.tohtml.cell? (integer: (1-index, exclusive))
+
+--- @class (private) vim.tohtml.cell
+--- @field [1] integer[] start
+--- @field [2] integer[] close
+--- @field [3] any[][] virt_text
+--- @field [4] any[][] overlay_text
+
+local HIDE_ID = -1
+-- stylua: ignore start
+local cterm_8_to_hex={
+ [0] = "#808080", "#ff6060", "#00ff00", "#ffff00",
+ "#8080ff", "#ff40ff", "#00ffff", "#ffffff",
+}
+local cterm_16_to_hex={
+ [0] = "#000000", "#c00000", "#008000", "#804000",
+ "#0000c0", "#c000c0", "#008080", "#c0c0c0",
+ "#808080", "#ff6060", "#00ff00", "#ffff00",
+ "#8080ff", "#ff40ff", "#00ffff", "#ffffff",
+}
+local cterm_88_to_hex={
+ [0] = "#000000", "#c00000", "#008000", "#804000",
+ "#0000c0", "#c000c0", "#008080", "#c0c0c0",
+ "#808080", "#ff6060", "#00ff00", "#ffff00",
+ "#8080ff", "#ff40ff", "#00ffff", "#ffffff",
+ "#000000", "#00008b", "#0000cd", "#0000ff",
+ "#008b00", "#008b8b", "#008bcd", "#008bff",
+ "#00cd00", "#00cd8b", "#00cdcd", "#00cdff",
+ "#00ff00", "#00ff8b", "#00ffcd", "#00ffff",
+ "#8b0000", "#8b008b", "#8b00cd", "#8b00ff",
+ "#8b8b00", "#8b8b8b", "#8b8bcd", "#8b8bff",
+ "#8bcd00", "#8bcd8b", "#8bcdcd", "#8bcdff",
+ "#8bff00", "#8bff8b", "#8bffcd", "#8bffff",
+ "#cd0000", "#cd008b", "#cd00cd", "#cd00ff",
+ "#cd8b00", "#cd8b8b", "#cd8bcd", "#cd8bff",
+ "#cdcd00", "#cdcd8b", "#cdcdcd", "#cdcdff",
+ "#cdff00", "#cdff8b", "#cdffcd", "#cdffff",
+ "#ff0000", "#ff008b", "#ff00cd", "#ff00ff",
+ "#ff8b00", "#ff8b8b", "#ff8bcd", "#ff8bff",
+ "#ffcd00", "#ffcd8b", "#ffcdcd", "#ffcdff",
+ "#ffff00", "#ffff8b", "#ffffcd", "#ffffff",
+ "#2e2e2e", "#5c5c5c", "#737373", "#8b8b8b",
+ "#a2a2a2", "#b9b9b9", "#d0d0d0", "#e7e7e7",
+}
+local cterm_256_to_hex={
+ [0] = "#000000", "#c00000", "#008000", "#804000",
+ "#0000c0", "#c000c0", "#008080", "#c0c0c0",
+ "#808080", "#ff6060", "#00ff00", "#ffff00",
+ "#8080ff", "#ff40ff", "#00ffff", "#ffffff",
+ "#000000", "#00005f", "#000087", "#0000af",
+ "#0000d7", "#0000ff", "#005f00", "#005f5f",
+ "#005f87", "#005faf", "#005fd7", "#005fff",
+ "#008700", "#00875f", "#008787", "#0087af",
+ "#0087d7", "#0087ff", "#00af00", "#00af5f",
+ "#00af87", "#00afaf", "#00afd7", "#00afff",
+ "#00d700", "#00d75f", "#00d787", "#00d7af",
+ "#00d7d7", "#00d7ff", "#00ff00", "#00ff5f",
+ "#00ff87", "#00ffaf", "#00ffd7", "#00ffff",
+ "#5f0000", "#5f005f", "#5f0087", "#5f00af",
+ "#5f00d7", "#5f00ff", "#5f5f00", "#5f5f5f",
+ "#5f5f87", "#5f5faf", "#5f5fd7", "#5f5fff",
+ "#5f8700", "#5f875f", "#5f8787", "#5f87af",
+ "#5f87d7", "#5f87ff", "#5faf00", "#5faf5f",
+ "#5faf87", "#5fafaf", "#5fafd7", "#5fafff",
+ "#5fd700", "#5fd75f", "#5fd787", "#5fd7af",
+ "#5fd7d7", "#5fd7ff", "#5fff00", "#5fff5f",
+ "#5fff87", "#5fffaf", "#5fffd7", "#5fffff",
+ "#870000", "#87005f", "#870087", "#8700af",
+ "#8700d7", "#8700ff", "#875f00", "#875f5f",
+ "#875f87", "#875faf", "#875fd7", "#875fff",
+ "#878700", "#87875f", "#878787", "#8787af",
+ "#8787d7", "#8787ff", "#87af00", "#87af5f",
+ "#87af87", "#87afaf", "#87afd7", "#87afff",
+ "#87d700", "#87d75f", "#87d787", "#87d7af",
+ "#87d7d7", "#87d7ff", "#87ff00", "#87ff5f",
+ "#87ff87", "#87ffaf", "#87ffd7", "#87ffff",
+ "#af0000", "#af005f", "#af0087", "#af00af",
+ "#af00d7", "#af00ff", "#af5f00", "#af5f5f",
+ "#af5f87", "#af5faf", "#af5fd7", "#af5fff",
+ "#af8700", "#af875f", "#af8787", "#af87af",
+ "#af87d7", "#af87ff", "#afaf00", "#afaf5f",
+ "#afaf87", "#afafaf", "#afafd7", "#afafff",
+ "#afd700", "#afd75f", "#afd787", "#afd7af",
+ "#afd7d7", "#afd7ff", "#afff00", "#afff5f",
+ "#afff87", "#afffaf", "#afffd7", "#afffff",
+ "#d70000", "#d7005f", "#d70087", "#d700af",
+ "#d700d7", "#d700ff", "#d75f00", "#d75f5f",
+ "#d75f87", "#d75faf", "#d75fd7", "#d75fff",
+ "#d78700", "#d7875f", "#d78787", "#d787af",
+ "#d787d7", "#d787ff", "#d7af00", "#d7af5f",
+ "#d7af87", "#d7afaf", "#d7afd7", "#d7afff",
+ "#d7d700", "#d7d75f", "#d7d787", "#d7d7af",
+ "#d7d7d7", "#d7d7ff", "#d7ff00", "#d7ff5f",
+ "#d7ff87", "#d7ffaf", "#d7ffd7", "#d7ffff",
+ "#ff0000", "#ff005f", "#ff0087", "#ff00af",
+ "#ff00d7", "#ff00ff", "#ff5f00", "#ff5f5f",
+ "#ff5f87", "#ff5faf", "#ff5fd7", "#ff5fff",
+ "#ff8700", "#ff875f", "#ff8787", "#ff87af",
+ "#ff87d7", "#ff87ff", "#ffaf00", "#ffaf5f",
+ "#ffaf87", "#ffafaf", "#ffafd7", "#ffafff",
+ "#ffd700", "#ffd75f", "#ffd787", "#ffd7af",
+ "#ffd7d7", "#ffd7ff", "#ffff00", "#ffff5f",
+ "#ffff87", "#ffffaf", "#ffffd7", "#ffffff",
+ "#080808", "#121212", "#1c1c1c", "#262626",
+ "#303030", "#3a3a3a", "#444444", "#4e4e4e",
+ "#585858", "#626262", "#6c6c6c", "#767676",
+ "#808080", "#8a8a8a", "#949494", "#9e9e9e",
+ "#a8a8a8", "#b2b2b2", "#bcbcbc", "#c6c6c6",
+ "#d0d0d0", "#dadada", "#e4e4e4", "#eeeeee",
+}
+-- stylua: ignore end
+
+--- @type table<integer,string>
+local cterm_color_cache = {}
+--- @type string?
+local background_color_cache = nil
+--- @type string?
+local foreground_color_cache = nil
+
+--- @see https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
+--- @param color "background"|"foreground"|integer
+--- @return string?
+local function try_query_terminal_color(color)
+ local parameter = 4
+ if color == 'foreground' then
+ parameter = 10
+ elseif color == 'background' then
+ parameter = 11
+ end
+ --- @type string?
+ local hex = nil
+ local au = vim.api.nvim_create_autocmd('TermResponse', {
+ once = true,
+ callback = function(args)
+ hex = '#'
+ .. table.concat({ args.data:match('\027%]%d+;%d*;?rgb:(%w%w)%w%w/(%w%w)%w%w/(%w%w)%w%w') })
+ end,
+ })
+ if type(color) == 'number' then
+ io.stdout:write(('\027]%s;%s;?\027\\'):format(parameter, color))
+ else
+ io.stdout:write(('\027]%s;?\027\\'):format(parameter))
+ end
+ vim.wait(100, function()
+ return hex and true or false
+ end)
+ pcall(vim.api.nvim_del_autocmd, au)
+ return hex
+end
+
+--- @param colorstr string
+--- @return string
+local function cterm_to_hex(colorstr)
+ if colorstr:sub(1, 1) == '#' then
+ return colorstr
+ end
+ assert(colorstr ~= '')
+ local color = tonumber(colorstr)
+ assert(color and 0 <= color and color <= 255)
+ if cterm_color_cache[color] then
+ return cterm_color_cache[color]
+ end
+ local hex = try_query_terminal_color(color)
+ if hex then
+ cterm_color_cache[color] = hex
+ else
+ vim.notify_once("Info(TOhtml): Couldn't get terminal colors, using fallback")
+ local t_Co = tonumber(vim.api.nvim_eval('&t_Co'))
+ if t_Co <= 8 then
+ cterm_color_cache = cterm_8_to_hex
+ elseif t_Co == 88 then
+ cterm_color_cache = cterm_88_to_hex
+ elseif t_Co == 256 then
+ cterm_color_cache = cterm_256_to_hex
+ else
+ cterm_color_cache = cterm_16_to_hex
+ end
+ end
+ return cterm_color_cache[color]
+end
+
+--- @return string
+local function get_background_color()
+ local bg = vim.fn.synIDattr(vim.fn.hlID('Normal'), 'bg#')
+ if bg ~= '' then
+ return cterm_to_hex(bg)
+ end
+ if background_color_cache then
+ return background_color_cache
+ end
+ local hex = try_query_terminal_color('background')
+ if not hex or not hex:match('#%x%x%x%x%x%x') then
+ vim.notify_once("Info(TOhtml): Couldn't get terminal background colors, using fallback")
+ hex = vim.o.background == 'light' and '#ffffff' or '#000000'
+ end
+ background_color_cache = hex
+ return hex
+end
+
+--- @return string
+local function get_foreground_color()
+ local fg = vim.fn.synIDattr(vim.fn.hlID('Normal'), 'fg#')
+ if fg ~= '' then
+ return cterm_to_hex(fg)
+ end
+ if foreground_color_cache then
+ return foreground_color_cache
+ end
+ local hex = try_query_terminal_color('foreground')
+ if not hex or not hex:match('#%x%x%x%x%x%x') then
+ vim.notify_once("Info(TOhtml): Couldn't get terminal foreground colors, using fallback")
+ hex = vim.o.background == 'light' and '#000000' or '#ffffff'
+ end
+ foreground_color_cache = hex
+ return hex
+end
+
+--- @param style_line vim.tohtml.line
+--- @param col integer (1-index)
+--- @param field integer
+--- @param val any
+local function _style_line_insert(style_line, col, field, val)
+ if style_line[col] == nil then
+ style_line[col] = { {}, {}, {}, {} }
+ end
+ table.insert(style_line[col][field], val)
+end
+
+--- @param style_line vim.tohtml.line
+--- @param col integer (1-index)
+--- @param val any[]
+local function style_line_insert_overlay_char(style_line, col, val)
+ _style_line_insert(style_line, col, 4, val)
+end
+
+--- @param style_line vim.tohtml.line
+--- @param col integer (1-index)
+--- @param val any[]
+local function style_line_insert_virt_text(style_line, col, val)
+ _style_line_insert(style_line, col, 3, val)
+end
+
+--- @param state vim.tohtml.state
+--- @param hl string|integer|nil
+--- @return nil|integer
+local function register_hl(state, hl)
+ if type(hl) == 'nil' then
+ return
+ elseif type(hl) == 'string' then
+ hl = vim.fn.hlID(hl)
+ assert(hl ~= 0)
+ end
+ hl = vim.fn.synIDtrans(hl)
+ if not state.highlights_name[hl] then
+ local name = vim.fn.synIDattr(hl, 'name')
+ assert(name ~= '')
+ state.highlights_name[hl] = name
+ end
+ return hl
+end
+
+--- @param state vim.tohtml.state
+--- @param start_row integer (1-index)
+--- @param start_col integer (1-index)
+--- @param end_row integer (1-index)
+--- @param end_col integer (1-index)
+--- @param conceal_text string
+--- @param hl_group string|integer?
+local function styletable_insert_conceal(
+ state,
+ start_row,
+ start_col,
+ end_row,
+ end_col,
+ conceal_text,
+ hl_group
+)
+ assert(state.opt.conceallevel > 0)
+ local styletable = state.style
+ if start_col == end_col and start_row == end_row then
+ return
+ end
+ if state.opt.conceallevel == 1 and conceal_text == '' then
+ conceal_text = vim.opt_local.listchars:get().conceal or ' '
+ end
+ local hlid = register_hl(state, hl_group)
+ if vim.wo[state.winid].conceallevel ~= 3 then
+ _style_line_insert(styletable[start_row], start_col, 3, { conceal_text, hlid })
+ end
+ _style_line_insert(styletable[start_row], start_col, 1, HIDE_ID)
+ _style_line_insert(styletable[end_row], end_col, 2, HIDE_ID)
+end
+
+--- @param state vim.tohtml.state
+--- @param start_row integer (1-index)
+--- @param start_col integer (1-index)
+--- @param end_row integer (1-index)
+--- @param end_col integer (1-index)
+--- @param hl_group string|integer|nil
+local function styletable_insert_range(state, start_row, start_col, end_row, end_col, hl_group)
+ if start_col == end_col and start_row == end_row or not hl_group then
+ return
+ end
+ local styletable = state.style
+ _style_line_insert(styletable[start_row], start_col, 1, hl_group)
+ _style_line_insert(styletable[end_row], end_col, 2, hl_group)
+end
+
+--- @param bufnr integer
+--- @return vim.tohtml.styletable
+local function generate_styletable(bufnr)
+ --- @type vim.tohtml.styletable
+ local styletable = {}
+ for row = 1, vim.api.nvim_buf_line_count(bufnr) + 1 do
+ styletable[row] = { virt_lines = {}, pre_text = {} }
+ end
+ return styletable
+end
+
+--- @param state vim.tohtml.state
+local function styletable_syntax(state)
+ for row = 1, state.buflen do
+ local prev_id = 0
+ local prev_col = nil
+ for col = 1, #vim.fn.getline(row) + 1 do
+ local hlid = vim.fn.synID(row, col, 1)
+ hlid = hlid == 0 and 0 or assert(register_hl(state, hlid))
+ if hlid ~= prev_id then
+ if prev_id ~= 0 then
+ styletable_insert_range(state, row, assert(prev_col), row, col, prev_id)
+ end
+ prev_col = col
+ prev_id = hlid
+ end
+ end
+ end
+end
+
+--- @param state vim.tohtml.state
+local function styletable_diff(state)
+ local styletable = state.style
+ for row = 1, state.buflen do
+ local style_line = styletable[row]
+ local filler = vim.fn.diff_filler(row)
+ if filler ~= 0 then
+ local fill = (vim.opt_local.fillchars:get().diff or '-')
+ table.insert(
+ style_line.virt_lines,
+ { { fill:rep(state.width), register_hl(state, 'DiffDelete') } }
+ )
+ end
+ if row == state.buflen + 1 then
+ break
+ end
+ local prev_id = 0
+ local prev_col = nil
+ for col = 1, #vim.fn.getline(row) do
+ local hlid = vim.fn.diff_hlID(row, col)
+ hlid = hlid == 0 and 0 or assert(register_hl(state, hlid))
+ if hlid ~= prev_id then
+ if prev_id ~= 0 then
+ styletable_insert_range(state, row, assert(prev_col), row, col, prev_id)
+ end
+ prev_col = col
+ prev_id = hlid
+ end
+ end
+ if prev_id ~= 0 then
+ styletable_insert_range(state, row, assert(prev_col), row, #vim.fn.getline(row) + 1, prev_id)
+ end
+ end
+end
+
+--- @param state vim.tohtml.state
+local function styletable_treesitter(state)
+ local bufnr = state.bufnr
+ local buf_highlighter = vim.treesitter.highlighter.active[bufnr]
+ if not buf_highlighter then
+ return
+ end
+ buf_highlighter.tree:parse(true)
+ buf_highlighter.tree:for_each_tree(function(tstree, tree)
+ --- @cast tree vim.treesitter.LanguageTree
+ if not tstree then
+ return
+ end
+ local root = tstree:root()
+ local q = buf_highlighter:get_query(tree:lang())
+ --- @type vim.treesitter.Query?
+ local query = q:query()
+ if not query then
+ return
+ end
+ for capture, node, metadata in query:iter_captures(root, buf_highlighter.bufnr, 0, state.buflen) do
+ local srow, scol, erow, ecol = node:range()
+ --- @diagnostic disable-next-line: invisible
+ local c = q._query.captures[capture]
+ if c ~= nil then
+ local hlid = register_hl(state, '@' .. c .. '.' .. tree:lang())
+ if metadata.conceal and state.opt.conceallevel ~= 0 then
+ styletable_insert_conceal(state, srow + 1, scol + 1, erow + 1, ecol + 1, metadata.conceal)
+ end
+ styletable_insert_range(state, srow + 1, scol + 1, erow + 1, ecol + 1, hlid)
+ end
+ end
+ end)
+end
+
+--- @param state vim.tohtml.state
+--- @param extmark {[1]:integer,[2]:integer,[3]:integer,[4]:vim.api.keyset.set_extmark|any}
+--- @param namespaces table<integer,string>
+local function _styletable_extmarks_highlight(state, extmark, namespaces)
+ if not extmark[4].hl_group then
+ return
+ end
+ ---TODO(altermo) LSP semantic tokens (and some other extmarks) are only
+ ---generated in visible lines, and not in the whole buffer.
+ if (namespaces[extmark[4].ns_id] or ''):find('vim_lsp_semantic_tokens') then
+ vim.notify_once('Info(TOhtml): lsp semantic tokens are not supported, HTML may be incorrect')
+ return
+ end
+ local srow, scol, erow, ecol =
+ extmark[2], extmark[3], extmark[4].end_row or extmark[2], extmark[4].end_col or extmark[3]
+ if scol == ecol and srow == erow then
+ return
+ end
+ local hlid = register_hl(state, extmark[4].hl_group)
+ styletable_insert_range(state, srow + 1, scol + 1, erow + 1, ecol + 1, hlid)
+end
+
+--- @param state vim.tohtml.state
+--- @param extmark {[1]:integer,[2]:integer,[3]:integer,[4]:vim.api.keyset.set_extmark|any}
+local function _styletable_extmarks_virt_text(state, extmark)
+ if not extmark[4].virt_text then
+ return
+ end
+ local styletable = state.style
+ --- @type integer,integer
+ local row, col = extmark[2], extmark[3]
+ if
+ extmark[4].virt_text_pos == 'inline'
+ or extmark[4].virt_text_pos == 'eol'
+ or extmark[4].virt_text_pos == 'overlay'
+ then
+ if extmark[4].virt_text_pos == 'eol' then
+ style_line_insert_virt_text(styletable[row + 1], #vim.fn.getline(row + 1) + 1, { ' ' })
+ end
+ local virt_text_len = 0
+ for _, i in
+ ipairs(extmark[4].virt_text --[[@as (string[][])]])
+ do
+ local hlid = register_hl(state, i[2])
+ if extmark[4].virt_text_pos == 'eol' then
+ style_line_insert_virt_text(
+ styletable[row + 1],
+ #vim.fn.getline(row + 1) + 1,
+ { i[1], hlid }
+ )
+ else
+ style_line_insert_virt_text(styletable[row + 1], col + 1, { i[1], hlid })
+ end
+ virt_text_len = virt_text_len + #i[1]
+ end
+ if extmark[4].virt_text_pos == 'overlay' then
+ styletable_insert_range(state, row + 1, col + 1, row + 1, col + virt_text_len + 1, HIDE_ID)
+ end
+ end
+ local not_supported = {
+ virt_text_pos = 'right_align',
+ hl_mode = 'blend',
+ hl_group = 'combine',
+ }
+ for opt, val in ipairs(not_supported) do
+ if extmark[4][opt] == val then
+ vim.notify_once(
+ ('Info(TOhtml): extmark.%s="%s" is not supported, HTML may be incorrect'):format(opt, val)
+ )
+ end
+ end
+end
+
+--- @param state vim.tohtml.state
+--- @param extmark {[1]:integer,[2]:integer,[3]:integer,[4]:vim.api.keyset.set_extmark|any}
+local function _styletable_extmarks_virt_lines(state, extmark)
+ ---TODO(altermo) if the fold start is equal to virt_line start then the fold hides the virt_line
+ if not extmark[4].virt_lines then
+ return
+ end
+ --- @type integer
+ local row = extmark[2] + (extmark[4].virt_lines_above and 1 or 2)
+ for _, line in
+ ipairs(extmark[4].virt_lines --[[@as (string[][][])]])
+ do
+ local virt_line = {}
+ for _, i in ipairs(line) do
+ local hlid = register_hl(state, i[2])
+ table.insert(virt_line, { i[1], hlid })
+ end
+ table.insert(state.style[row].virt_lines, virt_line)
+ end
+end
+
+--- @param state vim.tohtml.state
+--- @param extmark {[1]:integer,[2]:integer,[3]:integer,[4]:vim.api.keyset.set_extmark|any}
+local function _styletable_extmarks_conceal(state, extmark)
+ if not extmark[4].conceal or state.opt.conceallevel == 0 then
+ return
+ end
+ local srow, scol, erow, ecol =
+ extmark[2], extmark[3], extmark[4].end_row or extmark[2], extmark[4].end_col or extmark[3]
+ styletable_insert_conceal(
+ state,
+ srow + 1,
+ scol + 1,
+ erow + 1,
+ ecol + 1,
+ extmark[4].conceal,
+ extmark[4].hl_group or 'Conceal'
+ )
+end
+
+--- @param state vim.tohtml.state
+local function styletable_extmarks(state)
+ --TODO(altermo) extmarks may have col/row which is outside of the buffer, which could cause an error
+ local bufnr = state.bufnr
+ local extmarks = vim.api.nvim_buf_get_extmarks(bufnr, -1, 0, -1, { details = true })
+ local namespaces = {} --- @type table<integer, string>
+ for ns, ns_id in pairs(vim.api.nvim_get_namespaces()) do
+ namespaces[ns_id] = ns
+ end
+ for _, v in ipairs(extmarks) do
+ _styletable_extmarks_highlight(state, v, namespaces)
+ end
+ for _, v in ipairs(extmarks) do
+ _styletable_extmarks_conceal(state, v)
+ end
+ for _, v in ipairs(extmarks) do
+ _styletable_extmarks_virt_text(state, v)
+ end
+ for _, v in ipairs(extmarks) do
+ _styletable_extmarks_virt_lines(state, v)
+ end
+end
+
+--- @param state vim.tohtml.state
+local function styletable_folds(state)
+ local styletable = state.style
+ local has_folded = false
+ for row = 1, state.buflen do
+ if vim.fn.foldclosed(row) > 0 then
+ has_folded = true
+ styletable[row].hide = true
+ end
+ if vim.fn.foldclosed(row) == row then
+ local hlid = register_hl(state, 'Folded')
+ ---TODO(altermo): Is there a way to get highlighted foldtext?
+ local foldtext = vim.fn.foldtextresult(row)
+ foldtext = foldtext .. (vim.opt.fillchars:get().fold or '·'):rep(state.width - #foldtext)
+ table.insert(styletable[row].virt_lines, { { foldtext, hlid } })
+ end
+ end
+ if has_folded and type(({ pcall(vim.api.nvim_eval, vim.o.foldtext) })[2]) == 'table' then
+ vim.notify_once(
+ 'Info(TOhtml): foldtext returning a table is half supported, HTML may be incorrect'
+ )
+ end
+end
+
+--- @param state vim.tohtml.state
+local function styletable_conceal(state)
+ local bufnr = state.bufnr
+ vim.api.nvim_buf_call(bufnr, function()
+ for row = 1, state.buflen do
+ --- @type table<integer,{[1]:integer,[2]:integer,[3]:string}>
+ local conceals = {}
+ local line_len_exclusive = #vim.fn.getline(row) + 1
+ for col = 1, line_len_exclusive do
+ --- @type integer,string,integer
+ local is_concealed, conceal, hlid = unpack(vim.fn.synconcealed(row, col) --[[@as table]])
+ if is_concealed == 0 then
+ assert(true)
+ elseif not conceals[hlid] then
+ conceals[hlid] = { col, math.min(col + 1, line_len_exclusive), conceal }
+ else
+ conceals[hlid][2] = math.min(col + 1, line_len_exclusive)
+ end
+ end
+ for _, v in pairs(conceals) do
+ styletable_insert_conceal(state, row, v[1], row, v[2], v[3], 'Conceal')
+ end
+ end
+ end)
+end
+
+--- @param state vim.tohtml.state
+local function styletable_match(state)
+ for _, match in
+ ipairs(vim.fn.getmatches(state.winid) --[[@as (table[])]])
+ do
+ local hlid = register_hl(state, match.group)
+ local function range(srow, scol, erow, ecol)
+ if match.group == 'Conceal' and state.opt.conceallevel ~= 0 then
+ styletable_insert_conceal(state, srow, scol, erow, ecol, match.conceal or '', hlid)
+ else
+ styletable_insert_range(state, srow, scol, erow, ecol, hlid)
+ end
+ end
+ if match.pos1 then
+ for key, v in
+ pairs(match --[[@as (table<string,integer[]>)]])
+ do
+ if not key:match('^pos(%d+)$') then
+ assert(true)
+ elseif #v == 1 then
+ range(v[1], 1, v[1], #vim.fn.getline(v[1]) + 1)
+ else
+ range(v[1], v[2], v[1], v[3] + v[2])
+ end
+ end
+ else
+ for _, v in
+ ipairs(vim.fn.matchbufline(state.bufnr, match.pattern, 1, '$') --[[@as (table[])]])
+ do
+ range(v.lnum, v.byteidx + 1, v.lnum, v.byteidx + 1 + #v.text)
+ end
+ end
+ end
+end
+
+--- Requires state.conf.number_lines to be set to true
+--- @param state vim.tohtml.state
+local function styletable_statuscolumn(state)
+ if not state.conf.number_lines then
+ return
+ end
+ local statuscolumn = state.opt.statuscolumn
+
+ if statuscolumn == '' then
+ if state.opt.relativenumber then
+ if state.opt.number then
+ statuscolumn = '%C%s%{%v:lnum!=line(".")?"%=".v:relnum." ":v:lnum%}'
+ else
+ statuscolumn = '%C%s%{%"%=".v:relnum." "%}'
+ end
+ else
+ statuscolumn = '%C%s%{%"%=".v:lnum." "%}'
+ end
+ end
+ local minwidth = 0
+
+ local signcolumn = state.opt.signcolumn
+ if state.opt.number or state.opt.relativenumber then
+ minwidth = minwidth + state.opt.numberwidth
+ if signcolumn == 'number' then
+ signcolumn = 'no'
+ end
+ end
+ if signcolumn == 'number' then
+ signcolumn = 'auto'
+ end
+ if signcolumn ~= 'no' then
+ local max = tonumber(signcolumn:match('^%w-:(%d)')) or 1
+ if signcolumn:match('^auto') then
+ --- @type table<integer,integer>
+ local signcount = {}
+ for _, extmark in
+ ipairs(vim.api.nvim_buf_get_extmarks(state.bufnr, -1, 0, -1, { details = true }))
+ do
+ if extmark[4].sign_text then
+ signcount[extmark[2]] = (signcount[extmark[2]] or 0) + 1
+ end
+ end
+ local maxsigns = 0
+ for _, v in pairs(signcount) do
+ if v > maxsigns then
+ maxsigns = v
+ end
+ end
+ minwidth = minwidth + math.min(maxsigns, max) * 2
+ else
+ minwidth = minwidth + max * 2
+ end
+ end
+
+ local foldcolumn = state.opt.foldcolumn
+ if foldcolumn ~= '0' then
+ if foldcolumn:match('^auto') then
+ local max = tonumber(foldcolumn:match('^%w-:(%d)')) or 1
+ local maxfold = 0
+ vim.api.nvim_buf_call(state.bufnr, function()
+ for row = 1, vim.api.nvim_buf_line_count(state.bufnr) do
+ local foldlevel = vim.fn.foldlevel(row)
+ if foldlevel > maxfold then
+ maxfold = foldlevel
+ end
+ end
+ end)
+ minwidth = minwidth + math.min(maxfold, max)
+ else
+ minwidth = minwidth + tonumber(foldcolumn)
+ end
+ end
+
+ --- @type table<integer,any>
+ local statuses = {}
+ for row = 1, state.buflen do
+ local status = vim.api.nvim_eval_statusline(
+ statuscolumn,
+ { winid = state.winid, use_statuscol_lnum = row, highlights = true }
+ )
+ local width = vim.api.nvim_strwidth(status.str)
+ if width > minwidth then
+ minwidth = width
+ end
+ table.insert(statuses, status)
+ --- @type string
+ end
+ for row, status in pairs(statuses) do
+ --- @type string
+ local str = status.str
+ --- @type table[]
+ local hls = status.highlights
+ for k, v in ipairs(hls) do
+ local text = str:sub(v.start + 1, hls[k + 1] and hls[k + 1].start or nil)
+ if k == #hls then
+ text = text .. (' '):rep(minwidth - vim.api.nvim_strwidth(str))
+ end
+ if text ~= '' then
+ local hlid = register_hl(state, v.group)
+ local virt_text = { text, hlid }
+ table.insert(state.style[row].pre_text, virt_text)
+ end
+ end
+ end
+end
+
+--- @param state vim.tohtml.state
+local function styletable_listchars(state)
+ if not state.opt.list then
+ return
+ end
+ --- @return string
+ local function utf8_sub(str, i, j)
+ return vim.fn.strcharpart(str, i - 1, j and j - i + 1 or nil)
+ end
+ local len = vim.api.nvim_strwidth
+ --- @type table<string,string>
+ local listchars = vim.opt_local.listchars:get()
+ local ids = setmetatable({}, {
+ __index = function(t, k)
+ rawset(t, k, register_hl(state, k))
+ return rawget(t, k)
+ end,
+ })
+
+ if listchars.eol then
+ for row = 1, state.buflen do
+ local style_line = state.style[row]
+ style_line_insert_overlay_char(
+ style_line,
+ #vim.fn.getline(row) + 1,
+ { listchars.eol, ids.NonText }
+ )
+ end
+ end
+
+ if listchars.tab and state.tabstop then
+ for _, match in
+ ipairs(vim.fn.matchbufline(state.bufnr, '\t', 1, '$') --[[@as (table[])]])
+ do
+ --- @type integer
+ local tablen = #state.tabstop
+ - ((vim.fn.virtcol({ match.lnum, match.byteidx }, false, state.winid)) % #state.tabstop)
+ --- @type string?
+ local text
+ if len(listchars.tab) == 3 then
+ if tablen == 1 then
+ text = utf8_sub(listchars.tab, 3, 3)
+ else
+ text = utf8_sub(listchars.tab, 1, 1)
+ .. utf8_sub(listchars.tab, 2, 2):rep(tablen - 2)
+ .. utf8_sub(listchars.tab, 3, 3)
+ end
+ else
+ text = utf8_sub(listchars.tab, 1, 1) .. utf8_sub(listchars.tab, 2, 2):rep(tablen - 1)
+ end
+ style_line_insert_overlay_char(
+ state.style[match.lnum],
+ match.byteidx + 1,
+ { text, ids.Whitespace }
+ )
+ end
+ end
+
+ if listchars.space then
+ for _, match in
+ ipairs(vim.fn.matchbufline(state.bufnr, ' ', 1, '$') --[[@as (table[])]])
+ do
+ style_line_insert_overlay_char(
+ state.style[match.lnum],
+ match.byteidx + 1,
+ { listchars.space, ids.Whitespace }
+ )
+ end
+ end
+
+ if listchars.multispace then
+ for _, match in
+ ipairs(vim.fn.matchbufline(state.bufnr, [[ \+]], 1, '$') --[[@as (table[])]])
+ do
+ local text = utf8_sub(listchars.multispace:rep(len(match.text)), 1, len(match.text))
+ for i = 1, len(text) do
+ style_line_insert_overlay_char(
+ state.style[match.lnum],
+ match.byteidx + i,
+ { utf8_sub(text, i, i), ids.Whitespace }
+ )
+ end
+ end
+ end
+
+ if listchars.lead or listchars.leadmultispace then
+ for _, match in
+ ipairs(vim.fn.matchbufline(state.bufnr, [[^ \+]], 1, '$') --[[@as (table[])]])
+ do
+ local text = ''
+ if len(match.text) == 1 or not listchars.leadmultispace then
+ if listchars.lead then
+ text = listchars.lead:rep(len(match.text))
+ end
+ elseif listchars.leadmultispace then
+ text = utf8_sub(listchars.leadmultispace:rep(len(match.text)), 1, len(match.text))
+ end
+ for i = 1, len(text) do
+ style_line_insert_overlay_char(
+ state.style[match.lnum],
+ match.byteidx + i,
+ { utf8_sub(text, i, i), ids.Whitespace }
+ )
+ end
+ end
+ end
+
+ if listchars.trail then
+ for _, match in
+ ipairs(vim.fn.matchbufline(state.bufnr, [[ \+$]], 1, '$') --[[@as (table[])]])
+ do
+ local text = listchars.trail:rep(len(match.text))
+ for i = 1, len(text) do
+ style_line_insert_overlay_char(
+ state.style[match.lnum],
+ match.byteidx + i,
+ { utf8_sub(text, i, i), ids.Whitespace }
+ )
+ end
+ end
+ end
+
+ if listchars.nbsp then
+ for _, match in
+ ipairs(
+ vim.fn.matchbufline(state.bufnr, '\226\128\175\\|\194\160', 1, '$') --[[@as (table[])]]
+ )
+ do
+ style_line_insert_overlay_char(
+ state.style[match.lnum],
+ match.byteidx + 1,
+ { listchars.nbsp, ids.Whitespace }
+ )
+ for i = 2, #match.text do
+ style_line_insert_overlay_char(
+ state.style[match.lnum],
+ match.byteidx + i,
+ { '', ids.Whitespace }
+ )
+ end
+ end
+ end
+end
+
+--- @param name string
+--- @return string
+local function highlight_name_to_class_name(name)
+ return (name:gsub('%.', '-'):gsub('@', '-'))
+end
+
+--- @param name string
+--- @return string
+local function name_to_tag(name)
+ return '<span class="' .. highlight_name_to_class_name(name) .. '">'
+end
+
+--- @param _ string
+--- @return string
+local function name_to_closetag(_)
+ return '</span>'
+end
+
+--- @param str string
+--- @param tabstop string|false?
+--- @return string
+local function html_escape(str, tabstop)
+ str = str:gsub('&', '&amp;'):gsub('<', '&lt;'):gsub('>', '&gt;'):gsub('"', '&quot;')
+ if tabstop then
+ --- @type string
+ str = str:gsub('\t', tabstop)
+ end
+ return str
+end
+
+--- @param out string[]
+--- @param state vim.tohtml.state.global
+local function extend_style(out, state)
+ table.insert(out, '<style>')
+ table.insert(out, ('* {font-family: %s}'):format(state.font))
+ table.insert(
+ out,
+ ('body {background-color: %s; color: %s}'):format(state.background, state.foreground)
+ )
+ for hlid, name in pairs(state.highlights_name) do
+ --TODO(altermo) use local namespace (instead of global 0)
+ local fg = vim.fn.synIDattr(hlid, 'fg#')
+ local bg = vim.fn.synIDattr(hlid, 'bg#')
+ local decor_line = {}
+ if vim.fn.synIDattr(hlid, 'underline') ~= '' then
+ table.insert(decor_line, 'underline')
+ end
+ if vim.fn.synIDattr(hlid, 'strikethrough') ~= '' then
+ table.insert(decor_line, 'line-through')
+ end
+ if vim.fn.synIDattr(hlid, 'undercurl') ~= '' then
+ table.insert(decor_line, 'underline')
+ end
+ local c = {
+ color = fg ~= '' and cterm_to_hex(fg) or nil,
+ ['background-color'] = bg ~= '' and cterm_to_hex(bg) or nil,
+ ['font-style'] = vim.fn.synIDattr(hlid, 'italic') ~= '' and 'italic' or nil,
+ ['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(altermo) if strikethrough and undercurl then the strikethrough becomes wavy
+ ['text-decoration-style'] = vim.fn.synIDattr(hlid, 'undercurl') ~= '' and 'wavy' or nil,
+ }
+ local attrs = {}
+ for attr, val in pairs(c) do
+ table.insert(attrs, attr .. ': ' .. val)
+ end
+ table.insert(
+ out,
+ '.' .. highlight_name_to_class_name(name) .. ' {' .. table.concat(attrs, '; ') .. '}'
+ )
+ end
+ table.insert(out, '</style>')
+end
+
+--- @param out string[]
+--- @param state vim.tohtml.state.global
+local function extend_head(out, state)
+ table.insert(out, '<head>')
+ table.insert(out, '<meta charset="UTF-8">')
+ if state.title ~= false then
+ table.insert(out, ('<title>%s</title>'):format(state.title))
+ end
+ local colorscheme = vim.api.nvim_exec2('colorscheme', { output = true }).output
+ table.insert(
+ out,
+ ('<meta name="colorscheme" content="%s"></meta>'):format(html_escape(colorscheme))
+ )
+ extend_style(out, state)
+ table.insert(out, '</head>')
+end
+
+--- @param out string[]
+--- @param state vim.tohtml.state
+--- @param row integer
+local function _extend_virt_lines(out, state, row)
+ local style_line = state.style[row]
+ for _, virt_line in ipairs(style_line.virt_lines) do
+ local virt_s = ''
+ for _, v in ipairs(virt_line) do
+ if v[2] then
+ virt_s = virt_s .. (name_to_tag(state.highlights_name[v[2]]))
+ end
+ virt_s = virt_s .. v[1]
+ if v[2] then
+ --- @type string
+ virt_s = virt_s .. (name_to_closetag(state.highlights_name[v[2]]))
+ end
+ end
+ table.insert(out, virt_s)
+ end
+end
+
+--- @param state vim.tohtml.state
+--- @param row integer
+--- @return string
+local function _pre_text_to_html(state, row)
+ local style_line = state.style[row]
+ local s = ''
+ for _, pre_text in ipairs(style_line.pre_text) do
+ if pre_text[2] then
+ s = s .. (name_to_tag(state.highlights_name[pre_text[2]]))
+ end
+ s = s .. (html_escape(pre_text[1], state.tabstop))
+ if pre_text[2] then
+ --- @type string
+ s = s .. (name_to_closetag(state.highlights_name[pre_text[2]]))
+ end
+ end
+ return s
+end
+
+--- @param state vim.tohtml.state
+--- @param char table
+--- @return string
+local function _char_to_html(state, char)
+ local s = ''
+ if char[2] then
+ s = s .. name_to_tag(state.highlights_name[char[2]])
+ end
+ s = s .. html_escape(char[1], state.tabstop)
+ if char[2] then
+ s = s .. name_to_closetag(state.highlights_name[char[2]])
+ end
+ return s
+end
+
+--- @param state vim.tohtml.state
+--- @param cell vim.tohtml.cell
+--- @return string
+local function _virt_text_to_html(state, cell)
+ local s = ''
+ for _, v in ipairs(cell[3]) do
+ if v[2] then
+ s = s .. (name_to_tag(state.highlights_name[v[2]]))
+ end
+ --- @type string
+ s = s .. html_escape(v[1], state.tabstop)
+ if v[2] then
+ s = s .. name_to_closetag(state.highlights_name[v[2]])
+ end
+ end
+ return s
+end
+
+--- @param out string[]
+--- @param state vim.tohtml.state
+local function extend_pre(out, state)
+ local styletable = state.style
+ table.insert(out, '<pre>')
+ local hide_count = 0
+ --- @type integer[]
+ local stack = {}
+
+ local function loop(row)
+ local style_line = styletable[row]
+ if style_line.hide and (styletable[row - 1] or {}).hide then
+ return
+ end
+ _extend_virt_lines(out, state, row)
+ --Possible improvement (altermo):
+ --Instead of looping over all the buffer characters per line,
+ --why not loop over all the style_line cells,
+ --and then calculating the amount of text.
+ if style_line.hide then
+ return
+ end
+ local line = vim.api.nvim_buf_get_lines(state.bufnr, row - 1, row, false)[1] or ''
+ local s = ''
+ s = s .. _pre_text_to_html(state, row)
+ for col = 1, #line + 1 do
+ local cell = style_line[col]
+ --- @type table?
+ local char
+ if cell then
+ for i = #cell[2], 1, -1 do
+ local hlid = cell[2][i]
+ if hlid < 0 then
+ if hlid == HIDE_ID then
+ hide_count = hide_count - 1
+ end
+ else
+ --- @type integer?
+ local index
+ for idx = #stack, 1, -1 do
+ s = s .. (name_to_closetag(state.highlights_name[stack[idx]]))
+ if stack[idx] == hlid then
+ index = idx
+ break
+ end
+ end
+ assert(index, 'a coles tag which has no corresponding open tag')
+ for idx = index + 1, #stack do
+ s = s .. (name_to_tag(state.highlights_name[stack[idx]]))
+ end
+ table.remove(stack, index)
+ end
+ end
+
+ for _, hlid in ipairs(cell[1]) do
+ if hlid < 0 then
+ if hlid == HIDE_ID then
+ hide_count = hide_count + 1
+ end
+ else
+ table.insert(stack, hlid)
+ s = s .. (name_to_tag(state.highlights_name[hlid]))
+ end
+ end
+
+ if cell[3] then
+ s = s .. _virt_text_to_html(state, cell)
+ end
+
+ char = cell[4][#cell[4]]
+ end
+
+ if col == #line + 1 and not char then
+ break
+ end
+
+ if hide_count == 0 then
+ s = s
+ .. _char_to_html(
+ state,
+ char
+ or { vim.api.nvim_buf_get_text(state.bufnr, row - 1, col - 1, row - 1, col, {})[1] }
+ )
+ end
+ end
+ table.insert(out, s)
+ end
+
+ for row = 1, state.buflen + 1 do
+ loop(row)
+ end
+ assert(#stack == 0, 'an open HTML tag was never closed')
+ table.insert(out, '</pre>')
+end
+
+--- @param out string[]
+--- @param fn fun()
+local function extend_body(out, fn)
+ table.insert(out, '<body style="display: flex">')
+ fn()
+ table.insert(out, '</body>')
+end
+
+--- @param out string[]
+--- @param fn fun()
+local function extend_html(out, fn)
+ table.insert(out, '<!DOCTYPE html>')
+ table.insert(out, '<html>')
+ fn()
+ table.insert(out, '</html>')
+end
+
+--- @param winid integer
+--- @param global_state vim.tohtml.state.global
+--- @return vim.tohtml.state
+local function global_state_to_state(winid, global_state)
+ local bufnr = vim.api.nvim_win_get_buf(winid)
+ local opt = global_state.conf
+ local width = opt.width or vim.bo[bufnr].textwidth
+ if not width or width < 1 then
+ width = vim.api.nvim_win_get_width(winid)
+ end
+ local state = setmetatable({
+ winid = winid == 0 and vim.api.nvim_get_current_win() or winid,
+ opt = vim.wo[winid],
+ style = generate_styletable(bufnr),
+ bufnr = bufnr,
+ tabstop = (' '):rep(vim.bo[bufnr].tabstop),
+ width = width,
+ buflen = vim.api.nvim_buf_line_count(bufnr),
+ }, { __index = global_state })
+ return state --[[@as vim.tohtml.state]]
+end
+
+--- @param opt vim.tohtml.opt
+--- @param title? string
+--- @return vim.tohtml.state.global
+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[])]]
+ elseif vim.o.guifont:match('^[^:]+') then
+ table.insert(fonts, vim.o.guifont:match('^[^:]+'))
+ end
+ table.insert(fonts, 'monospace')
+ --- @type vim.tohtml.state.global
+ local state = {
+ background = get_background_color(),
+ foreground = get_foreground_color(),
+ title = opt.title or title or false,
+ font = table.concat(fonts, ','),
+ highlights_name = {},
+ conf = opt,
+ }
+ return state
+end
+
+--- @type fun(state: vim.tohtml.state)[]
+local styletable_funcs = {
+ styletable_syntax,
+ styletable_diff,
+ styletable_treesitter,
+ styletable_match,
+ styletable_extmarks,
+ styletable_conceal,
+ styletable_listchars,
+ styletable_folds,
+ styletable_statuscolumn,
+}
+
+--- @param state vim.tohtml.state
+local function state_generate_style(state)
+ vim.api.nvim_win_call(state.winid, function()
+ for _, fn in ipairs(styletable_funcs) do
+ --- @type string?
+ local cond
+ if type(fn) == 'table' then
+ cond = fn[2] --[[@as string]]
+ --- @type function
+ fn = fn[1]
+ end
+ if not cond or cond(state) then
+ fn(state)
+ end
+ end
+ end)
+end
+
+--- @param winid integer[]|integer
+--- @param opt? vim.tohtml.opt
+--- @return string[]
+local function win_to_html(winid, opt)
+ if type(winid) == 'number' then
+ winid = { winid }
+ end
+ --- @cast winid integer[]
+ assert(#winid > 0, 'no window specified')
+ opt = opt or {}
+ local title = table.concat(
+ vim.tbl_map(vim.api.nvim_buf_get_name, vim.tbl_map(vim.api.nvim_win_get_buf, winid)),
+ ','
+ )
+ local global_state = opt_to_global_state(opt, title)
+ --- @type vim.tohtml.state[]
+ local states = {}
+ for _, i in ipairs(winid) do
+ local state = global_state_to_state(i, global_state)
+ state_generate_style(state)
+ table.insert(states, state)
+ end
+ local html = {}
+ extend_html(html, function()
+ extend_head(html, global_state)
+ extend_body(html, function()
+ for _, state in ipairs(states) do
+ extend_pre(html, state)
+ end
+ end)
+ end)
+ return html
+end
+
+local M = {}
+
+--- @class vim.tohtml.opt
+--- @inlinedoc
+---
+--- Title tag to set in the generated HTML code.
+--- (default: buffer name)
+--- @field title? string|false
+---
+--- Show line numbers.
+--- (default: `false`)
+--- @field number_lines? boolean
+---
+--- Fonts to use.
+--- (default: `guifont`)
+--- @field font? string[]|string
+---
+--- Width used for items which are either right aligned or repeat a character
+--- infinitely.
+--- (default: 'textwidth' if non-zero or window width otherwise)
+--- @field width? integer
+
+--- Converts the buffer shown in the window {winid} to HTML and returns the output as a list of string.
+--- @param winid? integer Window to convert (defaults to current window)
+--- @param opt? vim.tohtml.opt Optional parameters.
+--- @return string[]
+function M.tohtml(winid, opt)
+ return win_to_html(winid or 0, opt)
+end
+
+return M
diff --git a/runtime/lua/vim/F.lua b/runtime/lua/vim/F.lua
index 5ed60ca8ab..8eb17a4c95 100644
--- a/runtime/lua/vim/F.lua
+++ b/runtime/lua/vim/F.lua
@@ -14,8 +14,9 @@ local F = {}
--- assert(vim.F.if_nil(a, b, c, d) == 42)
--- ```
---
----@param ... any
----@return any
+---@generic T
+---@param ... T
+---@return T
function F.if_nil(...)
local nargs = select('#', ...)
for i = 1, nargs do
diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua
index cc872dea83..91baee1a1e 100644
--- a/runtime/lua/vim/_defaults.lua
+++ b/runtime/lua/vim/_defaults.lua
@@ -4,27 +4,10 @@ do
---
--- See |v_star-default| and |v_#-default|
do
- local function region_chunks(region)
- local chunks = {}
- local maxcol = vim.v.maxcol
- for line, cols in vim.spairs(region) do
- local endcol = cols[2] == maxcol and -1 or cols[2]
- local chunk = vim.api.nvim_buf_get_text(0, line, cols[1], line, endcol, {})[1]
- table.insert(chunks, chunk)
- end
- return chunks
- end
-
local function _visual_search(cmd)
assert(cmd == '/' or cmd == '?')
- local region = vim.region(
- 0,
- '.',
- 'v',
- vim.api.nvim_get_mode().mode:sub(1, 1),
- vim.o.selection == 'inclusive'
- )
- local chunks = region_chunks(region)
+ local chunks =
+ vim.fn.getregion(vim.fn.getpos('.'), vim.fn.getpos('v'), { type = vim.fn.mode() })
local esc_chunks = vim
.iter(chunks)
:map(function(v)
@@ -67,17 +50,23 @@ do
--- See |&-default|
vim.keymap.set('n', '&', ':&&<CR>', { desc = ':help &-default' })
+ --- Use Q in visual mode to execute a macro on each line of the selection. #21422
+ ---
+ --- Applies to @x and includes @@ too.
+ vim.keymap.set(
+ 'x',
+ 'Q',
+ ':normal! @<C-R>=reg_recorded()<CR><CR>',
+ { silent = true, desc = ':help v_Q-default' }
+ )
+ vim.keymap.set(
+ 'x',
+ '@',
+ "':normal! @'.getcharstr().'<CR>'",
+ { silent = true, expr = true, desc = ':help v_@-default' }
+ )
--- Map |gx| to call |vim.ui.open| on the identifier under the cursor
do
- -- TODO: use vim.region() when it lands... #13896 #16843
- local function get_visual_selection()
- local save_a = vim.fn.getreginfo('a')
- vim.cmd([[norm! "ay]])
- local selection = vim.fn.getreg('a', 1)
- vim.fn.setreg('a', save_a)
- return selection
- end
-
local function do_open(uri)
local _, err = vim.ui.open(uri)
if err then
@@ -91,7 +80,10 @@ do
do_open(vim.fn.expand('<cfile>'))
end, { desc = gx_desc })
vim.keymap.set({ 'x' }, 'gx', function()
- do_open(get_visual_selection())
+ local lines =
+ vim.fn.getregion(vim.fn.getpos('.'), vim.fn.getpos('v'), { type = vim.fn.mode() })
+ -- Trim whitespace on each line and concatenate.
+ do_open(table.concat(vim.iter(lines):map(vim.trim):totable()))
end, { desc = gx_desc })
end
end
@@ -128,14 +120,43 @@ do
vim.api.nvim_create_autocmd({ 'TermClose' }, {
group = nvim_terminal_augroup,
+ nested = true,
desc = 'Automatically close terminal buffers when started with no arguments and exiting without an error',
callback = function(args)
- if vim.v.event.status == 0 then
- local info = vim.api.nvim_get_chan_info(vim.bo[args.buf].channel)
- local argv = info.argv or {}
- if #argv == 1 and argv[1] == vim.o.shell then
- vim.cmd({ cmd = 'bdelete', args = { args.buf }, bang = true })
+ if vim.v.event.status ~= 0 then
+ return
+ end
+ local info = vim.api.nvim_get_chan_info(vim.bo[args.buf].channel)
+ local argv = info.argv or {}
+ if #argv == 1 and argv[1] == vim.o.shell then
+ vim.api.nvim_buf_delete(args.buf, { force = true })
+ end
+ end,
+ })
+
+ vim.api.nvim_create_autocmd('TermRequest', {
+ group = nvim_terminal_augroup,
+ desc = 'Respond to OSC foreground/background color requests',
+ callback = function(args)
+ local channel = vim.bo[args.buf].channel
+ if channel == 0 then
+ return
+ end
+ local fg_request = args.data == '\027]10;?'
+ local bg_request = args.data == '\027]11;?'
+ if fg_request or bg_request then
+ -- WARN: This does not return the actual foreground/background color,
+ -- but rather returns:
+ -- - fg=white/bg=black when Nvim option 'background' is 'dark'
+ -- - fg=black/bg=white when Nvim option 'background' is 'light'
+ local red, green, blue = 0, 0, 0
+ local bg_option_dark = vim.o.background == 'dark'
+ if (fg_request and bg_option_dark) or (bg_request and not bg_option_dark) then
+ red, green, blue = 65535, 65535, 65535
end
+ local command = fg_request and 10 or 11
+ local data = string.format('\027]%d;rgb:%04x/%04x/%04x\007', command, red, green, blue)
+ vim.api.nvim_chan_send(channel, data)
end
end,
})
@@ -165,118 +186,125 @@ do
})
end
---- Guess value of 'background' based on terminal color.
----
---- We write Operating System Command (OSC) 11 to the terminal to request the
---- terminal's background color. We then wait for a response. If the response
---- matches `rgba:RRRR/GGGG/BBBB/AAAA` where R, G, B, and A are hex digits, then
---- compute the luminance[1] of the RGB color and classify it as light/dark
---- accordingly. Note that the color components may have anywhere from one to
---- four hex digits, and require scaling accordingly as values out of 4, 8, 12,
---- or 16 bits. Also note the A(lpha) component is optional, and is parsed but
---- ignored in the calculations.
----
---- [1] https://en.wikipedia.org/wiki/Luma_%28video%29
-do
- --- Parse a string of hex characters as a color.
- ---
- --- The string can contain 1 to 4 hex characters. The returned value is
- --- between 0.0 and 1.0 (inclusive) representing the intensity of the color.
- ---
- --- For instance, if only a single hex char "a" is used, then this function
- --- returns 0.625 (10 / 16), while a value of "aa" would return 0.664 (170 /
- --- 256).
+-- Only do the following when the TUI is attached
+local tty = nil
+for _, ui in ipairs(vim.api.nvim_list_uis()) do
+ if ui.chan == 1 and ui.stdout_tty then
+ tty = ui
+ break
+ end
+end
+
+if tty then
+ local group = vim.api.nvim_create_augroup('nvim_tty', {})
+
+ --- Set an option after startup (so that OptionSet is fired), but only if not
+ --- already set by the user.
---
- --- @param c string Color as a string of hex chars
- --- @return number? Intensity of the color
- local function parsecolor(c)
- if #c == 0 or #c > 4 then
- return nil
+ --- @param option string Option name
+ --- @param value any Option value
+ local function setoption(option, value)
+ if vim.api.nvim_get_option_info2(option, {}).was_set then
+ -- Don't do anything if option is already set
+ return
end
- local val = tonumber(c, 16)
- if not val then
- return nil
+ -- Wait until Nvim is finished starting to set the option to ensure the
+ -- OptionSet event fires.
+ if vim.v.vim_did_enter == 1 then
+ vim.o[option] = value
+ else
+ vim.api.nvim_create_autocmd('VimEnter', {
+ group = group,
+ once = true,
+ nested = true,
+ callback = function()
+ setoption(option, value)
+ end,
+ })
end
-
- local max = tonumber(string.rep('f', #c), 16)
- return val / max
end
- --- Parse an OSC 11 response
- ---
- --- Either of the two formats below are accepted:
- ---
- --- OSC 11 ; rgb:<red>/<green>/<blue>
+ --- Guess value of 'background' based on terminal color.
---
- --- or
+ --- We write Operating System Command (OSC) 11 to the terminal to request the
+ --- terminal's background color. We then wait for a response. If the response
+ --- matches `rgba:RRRR/GGGG/BBBB/AAAA` where R, G, B, and A are hex digits, then
+ --- compute the luminance[1] of the RGB color and classify it as light/dark
+ --- accordingly. Note that the color components may have anywhere from one to
+ --- four hex digits, and require scaling accordingly as values out of 4, 8, 12,
+ --- or 16 bits. Also note the A(lpha) component is optional, and is parsed but
+ --- ignored in the calculations.
---
- --- OSC 11 ; rgba:<red>/<green>/<blue>/<alpha>
- ---
- --- where
- ---
- --- <red>, <green>, <blue>, <alpha> := h | hh | hhh | hhhh
- ---
- --- The alpha component is ignored, if present.
- ---
- --- @param resp string OSC 11 response
- --- @return string? Red component
- --- @return string? Green component
- --- @return string? Blue component
- local function parseosc11(resp)
- local r, g, b
- r, g, b = resp:match('^\027%]11;rgb:(%x+)/(%x+)/(%x+)$')
- if not r and not g and not b then
- local a
- r, g, b, a = resp:match('^\027%]11;rgba:(%x+)/(%x+)/(%x+)/(%x+)$')
- if not a or #a > 4 then
- return nil, nil, nil
+ --- [1] https://en.wikipedia.org/wiki/Luma_%28video%29
+ do
+ --- Parse a string of hex characters as a color.
+ ---
+ --- The string can contain 1 to 4 hex characters. The returned value is
+ --- between 0.0 and 1.0 (inclusive) representing the intensity of the color.
+ ---
+ --- For instance, if only a single hex char "a" is used, then this function
+ --- returns 0.625 (10 / 16), while a value of "aa" would return 0.664 (170 /
+ --- 256).
+ ---
+ --- @param c string Color as a string of hex chars
+ --- @return number? Intensity of the color
+ local function parsecolor(c)
+ if #c == 0 or #c > 4 then
+ return nil
end
- end
-
- if r and g and b and #r <= 4 and #g <= 4 and #b <= 4 then
- return r, g, b
- end
- return nil, nil, nil
- end
+ local val = tonumber(c, 16)
+ if not val then
+ return nil
+ end
- local tty = false
- for _, ui in ipairs(vim.api.nvim_list_uis()) do
- if ui.chan == 1 and ui.stdout_tty then
- tty = true
- break
+ local max = tonumber(string.rep('f', #c), 16)
+ return val / max
end
- end
-
- if tty then
- local timer = assert(vim.uv.new_timer())
- ---@param bg string New value of the 'background' option
- local function setbg(bg)
- if vim.api.nvim_get_option_info2('background', {}).was_set then
- -- Don't do anything if 'background' is already set
- return
+ --- Parse an OSC 11 response
+ ---
+ --- Either of the two formats below are accepted:
+ ---
+ --- OSC 11 ; rgb:<red>/<green>/<blue>
+ ---
+ --- or
+ ---
+ --- OSC 11 ; rgba:<red>/<green>/<blue>/<alpha>
+ ---
+ --- where
+ ---
+ --- <red>, <green>, <blue>, <alpha> := h | hh | hhh | hhhh
+ ---
+ --- The alpha component is ignored, if present.
+ ---
+ --- @param resp string OSC 11 response
+ --- @return string? Red component
+ --- @return string? Green component
+ --- @return string? Blue component
+ local function parseosc11(resp)
+ local r, g, b
+ r, g, b = resp:match('^\027%]11;rgb:(%x+)/(%x+)/(%x+)$')
+ if not r and not g and not b then
+ local a
+ r, g, b, a = resp:match('^\027%]11;rgba:(%x+)/(%x+)/(%x+)/(%x+)$')
+ if not a or #a > 4 then
+ return nil, nil, nil
+ end
end
- -- Wait until Nvim is finished starting to set 'background' to ensure the
- -- OptionSet event fires.
- if vim.v.vim_did_enter == 1 then
- if vim.o.background ~= bg then
- vim.o.background = bg
- end
- else
- vim.api.nvim_create_autocmd('VimEnter', {
- once = true,
- nested = true,
- callback = function()
- setbg(bg)
- end,
- })
+ if r and g and b and #r <= 4 and #g <= 4 and #b <= 4 then
+ return r, g, b
end
+
+ return nil, nil, nil
end
+ local timer = assert(vim.uv.new_timer())
+
local id = vim.api.nvim_create_autocmd('TermResponse', {
+ group = group,
nested = true,
callback = function(args)
local resp = args.data ---@type string
@@ -289,7 +317,7 @@ do
if rr and gg and bb then
local luminance = (0.299 * rr) + (0.587 * gg) + (0.114 * bb)
local bg = luminance < 0.5 and 'dark' or 'light'
- setbg(bg)
+ setoption('background', bg)
end
return true
@@ -297,10 +325,10 @@ do
end,
})
- io.stdout:write('\027]11;?\027\\')
+ io.stdout:write('\027]11;?\007')
timer:start(1000, 0, function()
- -- No response received. Delete the autocommand
+ -- Delete the autocommand if no response was received
vim.schedule(function()
-- Suppress error if autocommand has already been deleted
pcall(vim.api.nvim_del_autocmd, id)
@@ -311,4 +339,102 @@ do
end
end)
end
+
+ --- If the TUI (term_has_truecolor) was able to determine that the host
+ --- terminal supports truecolor, enable 'termguicolors'. Otherwise, query the
+ --- terminal (using both XTGETTCAP and SGR + DECRQSS). If the terminal's
+ --- response indicates that it does support truecolor enable 'termguicolors',
+ --- but only if the user has not already disabled it.
+ do
+ if tty.rgb then
+ -- The TUI was able to determine truecolor support
+ setoption('termguicolors', true)
+ else
+ local caps = {} ---@type table<string, boolean>
+ require('vim.termcap').query({ 'Tc', 'RGB', 'setrgbf', 'setrgbb' }, function(cap, found)
+ if not found then
+ return
+ end
+
+ caps[cap] = true
+ if caps.Tc or caps.RGB or (caps.setrgbf and caps.setrgbb) then
+ setoption('termguicolors', true)
+ end
+ end)
+
+ local timer = assert(vim.uv.new_timer())
+
+ -- Arbitrary colors to set in the SGR sequence
+ local r = 1
+ local g = 2
+ local b = 3
+
+ local id = vim.api.nvim_create_autocmd('TermResponse', {
+ group = group,
+ nested = true,
+ callback = function(args)
+ local resp = args.data ---@type string
+ local decrqss = resp:match('^\027P1%$r([%d;:]+)m$')
+
+ if decrqss then
+ -- The DECRQSS SGR response first contains attributes separated by
+ -- semicolons, followed by the SGR itself with parameters separated
+ -- by colons. Some terminals include "0" in the attribute list
+ -- unconditionally; others do not. Our SGR sequence did not set any
+ -- attributes, so there should be no attributes in the list.
+ local attrs = vim.split(decrqss, ';')
+ if #attrs ~= 1 and (#attrs ~= 2 or attrs[1] ~= '0') then
+ return true
+ end
+
+ -- The returned SGR sequence should begin with 48:2
+ local sgr = attrs[#attrs]:match('^48:2:([%d:]+)$')
+ if not sgr then
+ return true
+ end
+
+ -- The remaining elements of the SGR sequence should be the 3 colors
+ -- we set. Some terminals also include an additional parameter
+ -- (which can even be empty!), so handle those cases as well
+ local params = vim.split(sgr, ':')
+ if #params ~= 3 and (#params ~= 4 or (params[1] ~= '' and params[1] ~= '1')) then
+ return true
+ end
+
+ if
+ tonumber(params[#params - 2]) == r
+ and tonumber(params[#params - 1]) == g
+ and tonumber(params[#params]) == b
+ then
+ setoption('termguicolors', true)
+ end
+
+ return true
+ end
+ end,
+ })
+
+ -- Write SGR followed by DECRQSS. This sets the background color then
+ -- immediately asks the terminal what the background color is. If the
+ -- terminal responds to the DECRQSS with the same SGR sequence that we
+ -- sent then the terminal supports truecolor.
+ local decrqss = '\027P$qm\027\\'
+ if os.getenv('TMUX') then
+ decrqss = string.format('\027Ptmux;%s\027\\', decrqss:gsub('\027', '\027\027'))
+ end
+ io.stdout:write(string.format('\027[48;2;%d;%d;%dm%s', r, g, b, decrqss))
+
+ timer:start(1000, 0, function()
+ -- Delete the autocommand if no response was received
+ vim.schedule(function()
+ -- Suppress error if autocommand has already been deleted
+ pcall(vim.api.nvim_del_autocmd, id)
+ end)
+
+ if not timer:is_closing() then
+ timer:close()
+ end
+ end)
+ end
+ end
end
diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua
index 6cccbe8313..6cf77b4648 100644
--- a/runtime/lua/vim/_editor.lua
+++ b/runtime/lua/vim/_editor.lua
@@ -95,7 +95,7 @@ vim.log = {
--- throws an error if {cmd} cannot be run.
---
--- @param cmd (string[]) Command to execute
---- @param opts (SystemOpts|nil) Options:
+--- @param opts vim.SystemOpts? Options:
--- - cwd: (string) Set the current working directory for the sub-process.
--- - env: table<string,string> Set environment variables for the new process. Inherits the
--- current environment with `NVIM` set to |v:servername|.
@@ -118,7 +118,7 @@ vim.log = {
--- parent exits. Note that the child process will still keep the parent's event loop alive
--- unless the parent process calls |uv.unref()| on the child's process handle.
---
---- @param on_exit (function|nil) Called when subprocess exits. When provided, the command runs
+--- @param on_exit? fun(out: vim.SystemCompleted) Called when subprocess exits. When provided, the command runs
--- asynchronously. Receives SystemCompleted object, see return of SystemObj:wait().
---
--- @return vim.SystemObj Object with the fields:
@@ -127,10 +127,10 @@ vim.log = {
--- timeout the process is sent the KILL signal (9) and the exit code is set to 124. Cannot
--- be called in |api-fast|.
--- - SystemCompleted is an object with the fields:
---- - code: (integer)
---- - signal: (integer)
---- - stdout: (string), nil if stdout argument is passed
---- - stderr: (string), nil if stderr argument is passed
+--- - code: (integer)
+--- - signal: (integer)
+--- - stdout: (string), nil if stdout argument is passed
+--- - stderr: (string), nil if stderr argument is passed
--- - kill (fun(signal: integer|string))
--- - write (fun(data: string|nil)) Requires `stdin=true`. Pass `nil` to close the stream.
--- - is_closing (fun(): boolean)
@@ -156,10 +156,10 @@ function vim._os_proc_info(pid)
elseif r.code ~= 0 then
error('command failed: ' .. vim.fn.string(cmd))
end
- local ppid = assert(vim.system({ 'ps', '-p', pid, '-o', 'ppid=' }):wait().stdout)
+ local ppid_string = assert(vim.system({ 'ps', '-p', pid, '-o', 'ppid=' }):wait().stdout)
-- Remove trailing whitespace.
name = vim.trim(name):gsub('^.*/', '')
- ppid = tonumber(ppid) or -1
+ local ppid = tonumber(ppid_string) or -1
return {
name = name,
pid = pid,
@@ -190,12 +190,19 @@ function vim._os_proc_children(ppid)
return children
end
+--- @nodoc
+--- @class vim.inspect.Opts
+--- @field depth? integer
+--- @field newline? string
+--- @field process? fun(item:any, path: string[]): any
+
--- Gets a human-readable representation of the given object.
---
---@see |vim.print()|
---@see https://github.com/kikito/inspect.lua
---@see https://github.com/mpeterv/vinspect
---@return string
+---@overload fun(x: any, opts?: vim.inspect.Opts): string
vim.inspect = vim.inspect
do
@@ -219,10 +226,9 @@ do
--- ```
---
---@see |paste|
- ---@alias paste_phase -1 | 1 | 2 | 3
---
---@param lines string[] # |readfile()|-style list of lines to paste. |channel-lines|
- ---@param phase paste_phase -1: "non-streaming" paste: the call contains all lines.
+ ---@param phase (-1|1|2|3) -1: "non-streaming" paste: the call contains all lines.
--- If paste is "streamed", `phase` indicates the stream state:
--- - 1: starts the paste (exactly once)
--- - 2: continues the paste (zero or more times)
@@ -269,6 +275,7 @@ do
for _, line in ipairs(lines) do
nchars = nchars + line:len()
end
+ --- @type integer, integer
local row, col = unpack(vim.api.nvim_win_get_cursor(0))
local bufline = vim.api.nvim_buf_get_lines(0, row - 1, row, true)[1]
local firstline = lines[1]
@@ -347,10 +354,13 @@ function vim.schedule_wrap(fn)
end
-- vim.fn.{func}(...)
----@private
+---@nodoc
vim.fn = setmetatable({}, {
+ --- @param t table<string,function>
+ --- @param key string
+ --- @return function
__index = function(t, key)
- local _fn
+ local _fn --- @type function
if vim.api[key] ~= nil then
_fn = function()
error(string.format('Tried to call API function with vim.fn: use vim.api.%s instead', key))
@@ -449,7 +459,7 @@ vim.cmd = setmetatable({}, {
end,
})
---- @class vim.var_accessor
+--- @class (private) vim.var_accessor
--- @field [string] any
--- @field [integer] vim.var_accessor
@@ -478,7 +488,7 @@ do
end
vim.g = make_dict_accessor('g', false)
- vim.v = make_dict_accessor('v', false)
+ vim.v = make_dict_accessor('v', false) --[[@as vim.v]]
vim.b = make_dict_accessor('b')
vim.w = make_dict_accessor('w')
vim.t = make_dict_accessor('t')
@@ -492,7 +502,7 @@ end
---@param bufnr integer Buffer number, or 0 for current buffer
---@param pos1 integer[]|string Start of region as a (line, column) tuple or |getpos()|-compatible string
---@param pos2 integer[]|string End of region as a (line, column) tuple or |getpos()|-compatible string
----@param regtype string \|setreg()|-style selection type
+---@param regtype string [setreg()]-style selection type
---@param inclusive boolean Controls whether the ending column is inclusive (see also 'selection').
---@return table region Dict of the form `{linenr = {startcol,endcol}}`. `endcol` is exclusive, and
---whole lines are returned as `{startcol,endcol} = {0,-1}`.
@@ -533,20 +543,21 @@ function vim.region(bufnr, pos1, pos2, regtype, inclusive)
local region = {}
for l = pos1[1], pos2[1] do
- local c1, c2
+ local c1 --- @type number
+ local c2 --- @type number
if regtype:byte() == 22 then -- block selection: take width from regtype
c1 = pos1[2]
- c2 = c1 + regtype:sub(2)
+ c2 = c1 + tonumber(regtype:sub(2))
-- and adjust for non-ASCII characters
local bufline = vim.api.nvim_buf_get_lines(bufnr, l, l + 1, true)[1]
local utflen = vim.str_utfindex(bufline, #bufline)
if c1 <= utflen then
- c1 = vim.str_byteindex(bufline, c1)
+ c1 = assert(tonumber(vim.str_byteindex(bufline, c1)))
else
c1 = #bufline + 1
end
if c2 <= utflen then
- c2 = vim.str_byteindex(bufline, c2)
+ c2 = assert(tonumber(vim.str_byteindex(bufline, c2)))
else
c2 = #bufline + 1
end
@@ -576,7 +587,7 @@ end
---@return table timer luv timer object
function vim.defer_fn(fn, timeout)
vim.validate({ fn = { fn, 'c', true } })
- local timer = vim.uv.new_timer()
+ local timer = assert(vim.uv.new_timer())
timer:start(
timeout,
0,
@@ -601,6 +612,7 @@ end
---@param msg string Content of the notification to show to the user.
---@param level integer|nil One of the values from |vim.log.levels|.
---@param opts table|nil Optional parameters. Unused by default.
+---@diagnostic disable-next-line: unused-local
function vim.notify(msg, level, opts) -- luacheck: no unused args
if level == vim.log.levels.ERROR then
vim.api.nvim_err_writeln(msg)
@@ -612,7 +624,7 @@ function vim.notify(msg, level, opts) -- luacheck: no unused args
end
do
- local notified = {}
+ local notified = {} --- @type table<string,true>
--- Displays a notification only one time.
---
@@ -633,7 +645,7 @@ do
end
end
-local on_key_cbs = {}
+local on_key_cbs = {} --- @type table<integer,function>
--- Adds Lua function {fn} with namespace id {ns_id} as a listener to every,
--- yes every, input key.
@@ -645,8 +657,9 @@ local on_key_cbs = {}
---@note {fn} will not be cleared by |nvim_buf_clear_namespace()|
---@note {fn} will receive the keys after mappings have been evaluated
---
----@param fn fun(key: string) Function invoked on every key press. |i_CTRL-V|
---- Returning nil removes the callback associated with namespace {ns_id}.
+---@param fn fun(key: string)? Function invoked on every key press. |i_CTRL-V|
+--- Passing in nil when {ns_id} is specified removes the
+--- callback associated with namespace {ns_id}.
---@param ns_id integer? Namespace ID. If nil or 0, generates and returns a
--- new |nvim_create_namespace()| id.
---
@@ -698,8 +711,11 @@ end
--- Generates a list of possible completions for the string.
--- String has the pattern.
---
---- 1. Can we get it to just return things in the global namespace with that name prefix
---- 2. Can we get it to return things from global namespace even with `print(` in front.
+--- 1. Can we get it to just return things in the global namespace with that name prefix
+--- 2. Can we get it to return things from global namespace even with `print(` in front.
+---
+--- @param pat string
+--- @return any[], integer
function vim._expand_pat(pat, env)
env = env or _G
@@ -732,7 +748,7 @@ function vim._expand_pat(pat, env)
if type(final_env) ~= 'table' then
return {}, 0
end
- local key
+ local key --- @type any
-- Normally, we just have a string
-- Just attempt to get the string directly from the environment
@@ -774,7 +790,8 @@ function vim._expand_pat(pat, env)
end
end
- local keys = {}
+ local keys = {} --- @type table<string,true>
+ --- @param obj table<any,any>
local function insert_keys(obj)
for k, _ in pairs(obj) do
if type(k) == 'string' and string.sub(k, 1, string.len(match_part)) == match_part then
@@ -801,11 +818,14 @@ function vim._expand_pat(pat, env)
return keys, #prefix_match_pat
end
+--- @param lua_string string
+--- @return (string|string[])[], integer
vim._expand_pat_get_parts = function(lua_string)
local parts = {}
local accumulator, search_index = '', 1
- local in_brackets, bracket_end = false, -1
+ local in_brackets = false
+ local bracket_end = -1 --- @type integer?
local string_char = nil
for idx = 1, #lua_string do
local s = lua_string:sub(idx, idx)
@@ -857,6 +877,7 @@ vim._expand_pat_get_parts = function(lua_string)
end
end
+ --- @param val any[]
parts = vim.tbl_filter(function(val)
return #val > 0
end, parts)
@@ -867,12 +888,13 @@ end
do
-- Ideally we should just call complete() inside omnifunc, though there are
-- some bugs, so fake the two-step dance for now.
- local matches
+ local matches --- @type any[]
--- Omnifunc for completing Lua values from the runtime Lua interpreter,
--- similar to the builtin completion for the `:lua` command.
---
--- Activate using `set omnifunc=v:lua.vim.lua_omnifunc` in a Lua buffer.
+ --- @param find_start 1|0
function vim.lua_omnifunc(find_start, _)
if find_start == 1 then
local line = vim.api.nvim_get_current_line()
@@ -886,12 +908,6 @@ do
end
end
----@private
-function vim.pretty_print(...)
- vim.deprecate('vim.pretty_print', 'vim.print', '0.10')
- return vim.print(...)
-end
-
--- "Pretty prints" the given arguments and returns them unmodified.
---
--- Example:
@@ -902,6 +918,7 @@ end
---
--- @see |vim.inspect()|
--- @see |:=|
+--- @param ... any
--- @return any # given arguments.
function vim.print(...)
if vim.in_fast_event() then
@@ -938,9 +955,12 @@ function vim.keycode(str)
return vim.api.nvim_replace_termcodes(str, true, true, true)
end
+--- @param server_addr string
+--- @param connect_error string
function vim._cs_remote(rcid, server_addr, connect_error, args)
+ --- @return string
local function connection_failure_errmsg(consequence)
- local explanation
+ local explanation --- @type string
if server_addr == '' then
explanation = 'No server specified with --server'
else
@@ -983,7 +1003,7 @@ function vim._cs_remote(rcid, server_addr, connect_error, args)
local res = tostring(vim.rpcrequest(rcid, 'nvim_eval', args[2]))
return { result = res, should_exit = true, tabbed = false }
elseif subcmd ~= '' then
- return { errmsg = 'Unknown option argument: ' .. args[1] }
+ return { errmsg = 'Unknown option argument: ' .. tostring(args[1]) }
end
if rcid == 0 then
@@ -1019,9 +1039,44 @@ end
---
---@return string|nil # Deprecated message, or nil if no message was shown.
function vim.deprecate(name, alternative, version, plugin, backtrace)
- local msg = ('%s is deprecated'):format(name)
+ vim.validate {
+ name = { name, 'string' },
+ alternative = { alternative, 'string', true },
+ version = { version, 'string', true },
+ plugin = { plugin, 'string', true },
+ }
plugin = plugin or 'Nvim'
- msg = alternative and ('%s, use %s instead.'):format(msg, alternative) or msg
+
+ -- Only issue warning if feature is hard-deprecated as specified by MAINTAIN.md.
+ -- e.g., when planned to be removed in version = '0.12' (soft-deprecated since 0.10-dev),
+ -- show warnings since 0.11, including 0.11-dev (hard_deprecated_since = 0.11-dev).
+ if plugin == 'Nvim' then
+ local current_version = vim.version() ---@type vim.Version
+ local removal_version = assert(vim.version.parse(version))
+ local is_hard_deprecated ---@type boolean
+
+ if removal_version.minor > 0 then
+ local hard_deprecated_since = assert(vim.version._version({
+ major = removal_version.major,
+ minor = removal_version.minor - 1,
+ patch = 0,
+ prerelease = 'dev', -- Show deprecation warnings in devel (nightly) version as well
+ }))
+ is_hard_deprecated = (current_version >= hard_deprecated_since)
+ else
+ -- Assume there will be no next minor version before bumping up the major version;
+ -- therefore we can always show a warning.
+ assert(removal_version.minor == 0, vim.inspect(removal_version))
+ is_hard_deprecated = true
+ end
+
+ if not is_hard_deprecated then
+ return
+ end
+ end
+
+ local msg = ('%s is deprecated'):format(name)
+ msg = alternative and ('%s, use %s instead.'):format(msg, alternative) or (msg .. '.')
msg = ('%s%s\nThis feature will be removed in %s version %s'):format(
msg,
(plugin == 'Nvim' and ' :help deprecated' or ''),
diff --git a/runtime/lua/vim/_init_packages.lua b/runtime/lua/vim/_init_packages.lua
index 4a961970cc..d0bb91114e 100644
--- a/runtime/lua/vim/_init_packages.lua
+++ b/runtime/lua/vim/_init_packages.lua
@@ -1,5 +1,5 @@
-local pathtrails = {}
-vim._so_trails = {}
+local pathtrails = {} --- @type table<string,true> ta
+vim._so_trails = {} --- @type string[]
for s in (package.cpath .. ';'):gmatch('[^;]*;') do
s = s:sub(1, -2) -- Strip trailing semicolon
-- Find out path patterns. pathtrail should contain something like
@@ -12,6 +12,7 @@ for s in (package.cpath .. ';'):gmatch('[^;]*;') do
end
end
+--- @param name string
function vim._load_package(name)
local basename = name:gsub('%.', '/')
local paths = { 'lua/' .. basename .. '.lua', 'lua/' .. basename .. '/init.lua' }
@@ -55,13 +56,16 @@ vim._submodules = {
inspect = true,
version = true,
fs = true,
+ glob = true,
iter = true,
re = true,
text = true,
+ provider = true,
}
-- These are for loading runtime modules in the vim namespace lazily.
setmetatable(vim, {
+ --- @param t table<any,any>
__index = function(t, key)
if vim._submodules[key] then
t[key] = require('vim.' .. key)
@@ -70,6 +74,7 @@ setmetatable(vim, {
require('vim._inspector')
return t[key]
elseif vim.startswith(key, 'uri_') then
+ --- @type any?
local val = require('vim.uri')[key]
if val ~= nil then
-- Expose all `vim.uri` functions on the `vim` module.
@@ -83,6 +88,7 @@ setmetatable(vim, {
--- <Docs described in |vim.empty_dict()| >
---@private
--- TODO: should be in vim.shared when vim.shared always uses nvim-lua
+--- @diagnostic disable-next-line:duplicate-set-field
function vim.empty_dict()
return setmetatable({}, vim._empty_dict_mt)
end
diff --git a/runtime/lua/vim/_inspector.lua b/runtime/lua/vim/_inspector.lua
index 3f7b9d2c23..afbd6211cd 100644
--- a/runtime/lua/vim/_inspector.lua
+++ b/runtime/lua/vim/_inspector.lua
@@ -1,8 +1,21 @@
----@class InspectorFilter
----@field syntax boolean include syntax based highlight groups (defaults to true)
----@field treesitter boolean include treesitter based highlight groups (defaults to true)
----@field extmarks boolean|"all" include extmarks. When `all`, then extmarks without a `hl_group` will also be included (defaults to true)
----@field semantic_tokens boolean include semantic token highlights (defaults to true)
+--- @class vim._inspector.Filter
+--- @inlinedoc
+---
+--- Include syntax based highlight groups.
+--- (default: `true`)
+--- @field syntax boolean
+---
+--- Include treesitter based highlight groups.
+--- (default: `true`)
+--- @field treesitter boolean
+---
+--- Include extmarks. When `all`, then extmarks without a `hl_group` will also be included.
+--- (default: true)
+--- @field extmarks boolean|"all"
+---
+--- Include semantic token highlights.
+--- (default: true)
+--- @field semantic_tokens boolean
local defaults = {
syntax = true,
treesitter = true,
@@ -12,16 +25,12 @@ local defaults = {
---Get all the items at a given buffer position.
---
----Can also be pretty-printed with `:Inspect!`. *:Inspect!*
+---Can also be pretty-printed with `:Inspect!`. [:Inspect!]()
---
---@param bufnr? integer defaults to the current buffer
---@param row? integer row to inspect, 0-based. Defaults to the row of the current cursor
---@param col? integer col to inspect, 0-based. Defaults to the col of the current cursor
----@param filter? InspectorFilter (table|nil) a table with key-value pairs to filter the items
---- - syntax (boolean): include syntax based highlight groups (defaults to true)
---- - treesitter (boolean): include treesitter based highlight groups (defaults to true)
---- - extmarks (boolean|"all"): include extmarks. When `all`, then extmarks without a `hl_group` will also be included (defaults to true)
---- - semantic_tokens (boolean): include semantic tokens (defaults to true)
+---@param filter? vim._inspector.Filter Table with key-value pairs to filter the items
---@return {treesitter:table,syntax:table,extmarks:table,semantic_tokens:table,buffer:integer,col:integer,row:integer} (table) a table with the following key-value pairs. Items are in "traversal order":
--- - treesitter: a list of treesitter captures
--- - syntax: a list of syntax groups
@@ -134,12 +143,12 @@ end
---Show all the items at a given buffer position.
---
----Can also be shown with `:Inspect`. *:Inspect*
+---Can also be shown with `:Inspect`. [:Inspect]()
---
---@param bufnr? integer defaults to the current buffer
---@param row? integer row to inspect, 0-based. Defaults to the row of the current cursor
---@param col? integer col to inspect, 0-based. Defaults to the col of the current cursor
----@param filter? InspectorFilter (table|nil) see |vim.inspect_pos()|
+---@param filter? vim._inspector.Filter
function vim.show_pos(bufnr, row, col, filter)
local items = vim.inspect_pos(bufnr, row, col, filter)
diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua
index e3b99f6b3d..731dd5b923 100644
--- a/runtime/lua/vim/_meta.lua
+++ b/runtime/lua/vim/_meta.lua
@@ -1,5 +1,7 @@
--- @meta
+--- @alias elem_or_list<T> T|T[]
+
---@type uv
vim.uv = ...
@@ -11,6 +13,7 @@ vim.diagnostic = require('vim.diagnostic')
vim.filetype = require('vim.filetype')
vim.fs = require('vim.fs')
vim.func = require('vim.func')
+vim.glob = require('vim.glob')
vim.health = require('vim.health')
vim.highlight = require('vim.highlight')
vim.iter = require('vim.iter')
@@ -20,6 +23,7 @@ vim.lsp = require('vim.lsp')
vim.re = require('vim.re')
vim.secure = require('vim.secure')
vim.snippet = require('vim.snippet')
+vim.text = require('vim.text')
vim.treesitter = require('vim.treesitter')
vim.ui = require('vim.ui')
vim.version = require('vim.version')
diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua
index 49269ba631..cb4c8749b8 100644
--- a/runtime/lua/vim/_meta/api.lua
+++ b/runtime/lua/vim/_meta/api.lua
@@ -38,6 +38,7 @@ function vim.api.nvim__get_runtime(pat, all, opts) end
--- @private
--- Returns object given as argument.
+---
--- This API function is used for testing. One should not rely on its presence
--- in plugins.
---
@@ -47,6 +48,7 @@ function vim.api.nvim__id(obj) end
--- @private
--- Returns array given as argument.
+---
--- This API function is used for testing. One should not rely on its presence
--- in plugins.
---
@@ -56,6 +58,7 @@ function vim.api.nvim__id_array(arr) end
--- @private
--- Returns dictionary given as argument.
+---
--- This API function is used for testing. One should not rely on its presence
--- in plugins.
---
@@ -65,6 +68,7 @@ function vim.api.nvim__id_dictionary(dct) end
--- @private
--- Returns floating-point value given as argument.
+---
--- This API function is used for testing. One should not rely on its presence
--- in plugins.
---
@@ -73,6 +77,9 @@ function vim.api.nvim__id_dictionary(dct) end
function vim.api.nvim__id_float(flt) end
--- @private
+--- NB: if your UI doesn't use hlstate, this will not return hlstate first
+--- time.
+---
--- @param grid integer
--- @param row integer
--- @param col integer
@@ -105,17 +112,20 @@ function vim.api.nvim__stats() end
function vim.api.nvim__unpack(str) end
--- Adds a highlight to buffer.
+---
--- Useful for plugins that dynamically generate highlights to a buffer (like
--- a semantic highlighter or linter). The function adds a single highlight to
--- a buffer. Unlike `matchaddpos()` highlights follow changes to line
--- numbering (as lines are inserted/removed above the highlighted line), like
--- signs and marks do.
+---
--- Namespaces are used for batch deletion/updating of a set of highlights. To
--- create a namespace, use `nvim_create_namespace()` which returns a
--- namespace id. Pass it in to this function as `ns_id` to add highlights to
--- the namespace. All highlights in the same namespace can then be cleared
--- with single call to `nvim_buf_clear_namespace()`. If the highlight never
--- will be deleted by an API call, pass `ns_id = -1`.
+---
--- As a shorthand, `ns_id = 0` can be used to create a new namespace for the
--- highlight, the allocated id is then returned. If `hl_group` is the empty
--- string no highlight is added, but a new `ns_id` is still returned. This is
@@ -128,11 +138,12 @@ function vim.api.nvim__unpack(str) end
--- @param line integer Line to highlight (zero-indexed)
--- @param col_start integer Start of (byte-indexed) column range to highlight
--- @param col_end integer End of (byte-indexed) column range to highlight, or -1 to
---- highlight to end of line
+--- highlight to end of line
--- @return integer
function vim.api.nvim_buf_add_highlight(buffer, ns_id, hl_group, line, col_start, col_end) end
--- Activates buffer-update events on a channel, or as Lua callbacks.
+---
--- Example (Lua): capture buffer updates in a global `events` variable (use
--- "vim.print(events)" to see its contents):
---
@@ -145,76 +156,78 @@ function vim.api.nvim_buf_add_highlight(buffer, ns_id, hl_group, line, col_start
--- })
--- ```
---
+---
--- @param buffer integer Buffer handle, or 0 for current buffer
--- @param send_buffer boolean True if the initial notification should contain the
--- whole buffer: first notification will be
--- `nvim_buf_lines_event`. Else the first notification
--- will be `nvim_buf_changedtick_event`. Not for Lua
--- callbacks.
---- @param opts table<string,function> Optional parameters.
---- • on_lines: Lua callback invoked on change. Return `true` to detach. Args:
---- • the string "lines"
---- • buffer handle
---- • b:changedtick
---- • first line that changed (zero-indexed)
---- • last line that was changed
---- • last line in the updated range
---- • byte count of previous contents
---- • deleted_codepoints (if `utf_sizes` is true)
---- • deleted_codeunits (if `utf_sizes` is true)
----
---- • on_bytes: Lua callback invoked on change. This
---- callback receives more granular information about the
---- change compared to on_lines. Return `true` to detach. Args:
---- • the string "bytes"
---- • buffer handle
---- • b:changedtick
---- • start row of the changed text (zero-indexed)
---- • start column of the changed text
---- • byte offset of the changed text (from the start of
---- the buffer)
---- • old end row of the changed text
---- • old end column of the changed text
---- • old end byte length of the changed text
---- • new end row of the changed text
---- • new end column of the changed text
---- • new end byte length of the changed text
----
---- • on_changedtick: Lua callback invoked on changedtick
---- increment without text change. Args:
---- • the string "changedtick"
---- • buffer handle
---- • b:changedtick
----
---- • on_detach: Lua callback invoked on detach. Args:
---- • the string "detach"
---- • buffer handle
----
---- • on_reload: Lua callback invoked on reload. The entire
---- buffer content should be considered changed. Args:
---- • the string "reload"
---- • buffer handle
----
---- • utf_sizes: include UTF-32 and UTF-16 size of the
---- replaced region, as args to `on_lines`.
---- • preview: also attach to command preview (i.e.
---- 'inccommand') events.
+--- @param opts vim.api.keyset.buf_attach Optional parameters.
+--- • on_lines: Lua callback invoked on change. Return a truthy
+--- value (not `false` or `nil`) to detach. Args:
+--- • the string "lines"
+--- • buffer handle
+--- • b:changedtick
+--- • first line that changed (zero-indexed)
+--- • last line that was changed
+--- • last line in the updated range
+--- • byte count of previous contents
+--- • deleted_codepoints (if `utf_sizes` is true)
+--- • deleted_codeunits (if `utf_sizes` is true)
+--- • on_bytes: Lua callback invoked on change. This callback
+--- receives more granular information about the change compared
+--- to on_lines. Return a truthy value (not `false` or `nil`) to
+--- detach. Args:
+--- • the string "bytes"
+--- • buffer handle
+--- • b:changedtick
+--- • start row of the changed text (zero-indexed)
+--- • start column of the changed text
+--- • byte offset of the changed text (from the start of the
+--- buffer)
+--- • old end row of the changed text (offset from start row)
+--- • old end column of the changed text (if old end row = 0,
+--- offset from start column)
+--- • old end byte length of the changed text
+--- • new end row of the changed text (offset from start row)
+--- • new end column of the changed text (if new end row = 0,
+--- offset from start column)
+--- • new end byte length of the changed text
+--- • on_changedtick: Lua callback invoked on changedtick
+--- increment without text change. Args:
+--- • the string "changedtick"
+--- • buffer handle
+--- • b:changedtick
+--- • on_detach: Lua callback invoked on detach. Args:
+--- • the string "detach"
+--- • buffer handle
+--- • on_reload: Lua callback invoked on reload. The entire buffer
+--- content should be considered changed. Args:
+--- • the string "reload"
+--- • buffer handle
+--- • utf_sizes: include UTF-32 and UTF-16 size of the replaced
+--- region, as args to `on_lines`.
+--- • preview: also attach to command preview (i.e. 'inccommand')
+--- events.
--- @return boolean
function vim.api.nvim_buf_attach(buffer, send_buffer, opts) end
--- call a function with buffer as temporary current buffer
+---
--- This temporarily switches current buffer to "buffer". If the current
--- window already shows "buffer", the window is not switched If a window
--- inside the current tabpage (including a float) already shows the buffer
--- One of these windows will be set as current window temporarily. Otherwise
--- a temporary scratch window (called the "autocmd window" for historical
--- reasons) will be used.
+---
--- This is useful e.g. to call Vimscript functions that only work with the
--- current buffer/window currently, like `termopen()`.
---
--- @param buffer integer Buffer handle, or 0 for current buffer
--- @param fun function Function to call inside the buffer (currently Lua callable
---- only)
+--- only)
--- @return any
function vim.api.nvim_buf_call(buffer, fun) end
@@ -227,14 +240,15 @@ function vim.api.nvim_buf_clear_highlight(buffer, ns_id, line_start, line_end) e
--- Clears `namespace`d objects (highlights, `extmarks`, virtual text) from a
--- region.
+---
--- Lines are 0-indexed. `api-indexing` To clear the namespace in the entire
--- buffer, specify line_start=0 and line_end=-1.
---
--- @param buffer integer Buffer handle, or 0 for current buffer
--- @param ns_id integer Namespace to clear, or -1 to clear all namespaces.
--- @param line_start integer Start of range of lines to clear
---- @param line_end integer End of range of lines to clear (exclusive) or -1 to
---- clear to end of buffer.
+--- @param line_end integer End of range of lines to clear (exclusive) or -1 to clear
+--- to end of buffer.
function vim.api.nvim_buf_clear_namespace(buffer, ns_id, line_start, line_end) end
--- Creates a buffer-local command `user-commands`.
@@ -268,6 +282,7 @@ function vim.api.nvim_buf_del_keymap(buffer, mode, lhs) end
function vim.api.nvim_buf_del_mark(buffer, name) end
--- Delete a buffer-local user-defined command.
+---
--- Only commands created with `:command-buffer` or
--- `nvim_buf_create_user_command()` can be deleted with this function.
---
@@ -284,9 +299,9 @@ function vim.api.nvim_buf_del_var(buffer, name) end
--- Deletes the buffer. See `:bwipeout`
---
--- @param buffer integer Buffer handle, or 0 for current buffer
---- @param opts table<string,any> Optional parameters. Keys:
---- • force: Force deletion and ignore unsaved changes.
---- • unload: Unloaded only, do not delete. See `:bunload`
+--- @param opts vim.api.keyset.buf_delete Optional parameters. Keys:
+--- • force: Force deletion and ignore unsaved changes.
+--- • unload: Unloaded only, do not delete. See `:bunload`
function vim.api.nvim_buf_delete(buffer, opts) end
--- Gets a changed tick of a buffer
@@ -307,15 +322,16 @@ function vim.api.nvim_buf_get_commands(buffer, opts) end
--- @param buffer integer Buffer handle, or 0 for current buffer
--- @param ns_id integer Namespace id from `nvim_create_namespace()`
--- @param id integer Extmark id
---- @param opts table<string,any> Optional parameters. Keys:
---- • details: Whether to include the details dict
---- • hl_name: Whether to include highlight group name instead
---- of id, true if omitted
---- @return integer[]
+--- @param opts vim.api.keyset.get_extmark Optional parameters. Keys:
+--- • details: Whether to include the details dict
+--- • hl_name: Whether to include highlight group name instead of
+--- id, true if omitted
+--- @return vim.api.keyset.get_extmark_item
function vim.api.nvim_buf_get_extmark_by_id(buffer, ns_id, id, opts) end
---- Gets `extmarks` (including `signs`) in "traversal order" from a `charwise`
---- region defined by buffer positions (inclusive, 0-indexed `api-indexing`).
+--- Gets `extmarks` in "traversal order" from a `charwise` region defined by
+--- buffer positions (inclusive, 0-indexed `api-indexing`).
+---
--- Region can be given as (row,col) tuples, or valid extmark ids (whose
--- positions define the bounds). 0 and -1 are understood as (0,0) and (-1,-1)
--- respectively, thus the following are equivalent:
@@ -327,9 +343,15 @@ function vim.api.nvim_buf_get_extmark_by_id(buffer, ns_id, id, opts) end
---
--- If `end` is less than `start`, traversal works backwards. (Useful with
--- `limit`, to get the first marks prior to a given position.)
+---
--- Note: when using extmark ranges (marks with a end_row/end_col position)
--- the `overlap` option might be useful. Otherwise only the start position of
--- an extmark will be considered.
+---
+--- Note: legacy signs placed through the `:sign` commands are implemented as
+--- extmarks and will show up here. Their details array will contain a
+--- `sign_name` field.
+---
--- Example:
---
--- ```lua
@@ -347,37 +369,39 @@ function vim.api.nvim_buf_get_extmark_by_id(buffer, ns_id, id, opts) end
--- vim.print(ms)
--- ```
---
+---
--- @param buffer integer Buffer handle, or 0 for current buffer
--- @param ns_id integer Namespace id from `nvim_create_namespace()` or -1 for all
---- namespaces
+--- namespaces
--- @param start any Start of range: a 0-indexed (row, col) or valid extmark id
---- (whose position defines the bound). `api-indexing`
+--- (whose position defines the bound). `api-indexing`
--- @param end_ any End of range (inclusive): a 0-indexed (row, col) or valid
---- extmark id (whose position defines the bound).
---- `api-indexing`
+--- extmark id (whose position defines the bound). `api-indexing`
--- @param opts vim.api.keyset.get_extmarks Optional parameters. Keys:
---- • limit: Maximum number of marks to return
---- • details: Whether to include the details dict
---- • hl_name: Whether to include highlight group name instead
---- of id, true if omitted
---- • overlap: Also include marks which overlap the range, even
---- if their start position is less than `start`
---- • type: Filter marks by type: "highlight", "sign",
---- "virt_text" and "virt_lines"
---- @return any[]
+--- • limit: Maximum number of marks to return
+--- • details: Whether to include the details dict
+--- • hl_name: Whether to include highlight group name instead of
+--- id, true if omitted
+--- • overlap: Also include marks which overlap the range, even if
+--- their start position is less than `start`
+--- • type: Filter marks by type: "highlight", "sign", "virt_text"
+--- and "virt_lines"
+--- @return vim.api.keyset.get_extmark_item[]
function vim.api.nvim_buf_get_extmarks(buffer, ns_id, start, end_, opts) end
--- Gets a list of buffer-local `mapping` definitions.
---
--- @param buffer integer Buffer handle, or 0 for current buffer
--- @param mode string Mode short-name ("n", "i", "v", ...)
---- @return table<string,any>[]
+--- @return vim.api.keyset.keymap[]
function vim.api.nvim_buf_get_keymap(buffer, mode) end
--- Gets a line-range from the buffer.
+---
--- Indexing is zero-based, end-exclusive. Negative indices are interpreted as
--- length+1+index: -1 refers to the index past the end. So to get the last
--- element use start=-2 and end=-1.
+---
--- Out-of-bounds indices are clamped to the nearest valid value, unless
--- `strict_indexing` is set.
---
@@ -391,6 +415,7 @@ function vim.api.nvim_buf_get_lines(buffer, start, end_, strict_indexing) end
--- Returns a `(row,col)` tuple representing the position of the named mark.
--- "End of line" column position is returned as `v:maxcol` (big number). See
--- `mark-motions`.
+---
--- Marks are (1,0)-indexed. `api-indexing`
---
--- @param buffer integer Buffer handle, or 0 for current buffer
@@ -410,10 +435,12 @@ function vim.api.nvim_buf_get_name(buffer) end
function vim.api.nvim_buf_get_number(buffer) end
--- Returns the byte offset of a line (0-indexed). `api-indexing`
+---
--- Line 1 (index=0) has offset 0. UTF-8 bytes are counted. EOL is one byte.
--- 'fileformat' and 'fileencoding' are ignored. The line index just after the
--- last line gives the total byte-count of the buffer. A final EOL byte is
--- counted if it would be written, see 'eol'.
+---
--- Unlike `line2byte()`, throws error for out-of-bounds indexing. Returns -1
--- for unloaded buffer.
---
@@ -429,10 +456,13 @@ function vim.api.nvim_buf_get_offset(buffer, index) end
function vim.api.nvim_buf_get_option(buffer, name) end
--- Gets a range from the buffer.
+---
--- This differs from `nvim_buf_get_lines()` in that it allows retrieving only
--- portions of a line.
+---
--- Indexing is zero-based. Row indices are end-inclusive, and column indices
--- are end-exclusive.
+---
--- Prefer `nvim_buf_get_lines()` when retrieving entire lines.
---
--- @param buffer integer Buffer handle, or 0 for current buffer
@@ -440,7 +470,7 @@ function vim.api.nvim_buf_get_option(buffer, name) end
--- @param start_col integer Starting column (byte offset) on first line
--- @param end_row integer Last line index, inclusive
--- @param end_col integer Ending column (byte offset) on last line, exclusive
---- @param opts table<string,any> Optional parameters. Currently unused.
+--- @param opts vim.api.keyset.empty Optional parameters. Currently unused.
--- @return string[]
function vim.api.nvim_buf_get_text(buffer, start_row, start_col, end_row, end_col, opts) end
@@ -471,13 +501,16 @@ function vim.api.nvim_buf_is_valid(buffer) end
function vim.api.nvim_buf_line_count(buffer) end
--- Creates or updates an `extmark`.
+---
--- By default a new extmark is created when no id is passed in, but it is
--- also possible to create a new mark by passing in a previously unused id or
--- move an existing mark by passing in its id. The caller must then keep
--- track of existing and unused ids itself. (Useful over RPC, to avoid
--- waiting for the return value.)
+---
--- Using the optional arguments, it is possible to use this to highlight a
--- range of text, and also to associate virtual text to the mark.
+---
--- If present, the position defined by `end_col` and `end_row` should be
--- after the start position in order for the extmark to cover a range. An
--- earlier end position is not an error, but then it behaves like an empty
@@ -488,108 +521,110 @@ function vim.api.nvim_buf_line_count(buffer) end
--- @param line integer Line where to place the mark, 0-based. `api-indexing`
--- @param col integer Column where to place the mark, 0-based. `api-indexing`
--- @param opts vim.api.keyset.set_extmark Optional parameters.
---- • id : id of the extmark to edit.
---- • end_row : ending line of the mark, 0-based inclusive.
---- • end_col : ending col of the mark, 0-based exclusive.
---- • hl_group : name of the highlight group used to highlight
---- this mark.
---- • hl_eol : when true, for a multiline highlight covering the
---- EOL of a line, continue the highlight for the rest of the
---- screen line (just like for diff and cursorline highlight).
---- • virt_text : virtual text to link to this mark. A list of
---- [text, highlight] tuples, each representing a text chunk
---- with specified highlight. `highlight` element can either
---- be a single highlight group, or an array of multiple
---- highlight groups that will be stacked (highest priority
---- last). A highlight group can be supplied either as a
---- string or as an integer, the latter which can be obtained
---- using `nvim_get_hl_id_by_name()`.
---- • virt_text_pos : position of virtual text. Possible values:
---- • "eol": right after eol character (default).
---- • "overlay": display over the specified column, without
---- shifting the underlying text.
---- • "right_align": display right aligned in the window.
---- • "inline": display at the specified column, and shift the
---- buffer text to the right as needed.
----
---- • virt_text_win_col : position the virtual text at a fixed
---- window column (starting from the first text column of the
---- screen line) instead of "virt_text_pos".
---- • virt_text_hide : hide the virtual text when the background
---- text is selected or hidden because of scrolling with
---- 'nowrap' or 'smoothscroll'. Currently only affects
---- "overlay" virt_text.
---- • hl_mode : control how highlights are combined with the
---- highlights of the text. Currently only affects virt_text
---- highlights, but might affect `hl_group` in later versions.
---- • "replace": only show the virt_text color. This is the
---- default.
---- • "combine": combine with background text color.
---- • "blend": blend with background text color. Not supported
---- for "inline" virt_text.
----
---- • virt_lines : virtual lines to add next to this mark This
---- should be an array over lines, where each line in turn is
---- an array over [text, highlight] tuples. In general, buffer
---- and window options do not affect the display of the text.
---- In particular 'wrap' and 'linebreak' options do not take
---- effect, so the number of extra screen lines will always
---- match the size of the array. However the 'tabstop' buffer
---- option is still used for hard tabs. By default lines are
---- placed below the buffer line containing the mark.
---- • virt_lines_above: place virtual lines above instead.
---- • virt_lines_leftcol: Place extmarks in the leftmost column
---- of the window, bypassing sign and number columns.
---- • ephemeral : for use with `nvim_set_decoration_provider()`
---- callbacks. The mark will only be used for the current
---- redraw cycle, and not be permantently stored in the
---- buffer.
---- • right_gravity : boolean that indicates the direction the
---- extmark will be shifted in when new text is inserted (true
---- for right, false for left). Defaults to true.
---- • end_right_gravity : boolean that indicates the direction
---- the extmark end position (if it exists) will be shifted in
---- when new text is inserted (true for right, false for
---- left). Defaults to false.
---- • undo_restore : Restore the exact position of the mark if
---- text around the mark was deleted and then restored by
---- undo. Defaults to true.
---- • invalidate : boolean that indicates whether to hide the
---- extmark if the entirety of its range is deleted. If
---- "undo_restore" is false, the extmark is deleted instead.
---- • priority: a priority value for the highlight group or sign
---- attribute. For example treesitter highlighting uses a
---- value of 100.
---- • strict: boolean that indicates extmark should not be
---- placed if the line or column value is past the end of the
---- buffer or end of the line respectively. Defaults to true.
---- • sign_text: string of length 1-2 used to display in the
---- sign column. Note: ranges are unsupported and decorations
---- are only applied to start_row
---- • sign_hl_group: name of the highlight group used to
---- highlight the sign column text. Note: ranges are
---- unsupported and decorations are only applied to start_row
---- • number_hl_group: name of the highlight group used to
---- highlight the number column. Note: ranges are unsupported
---- and decorations are only applied to start_row
---- • line_hl_group: name of the highlight group used to
---- highlight the whole line. Note: ranges are unsupported and
---- decorations are only applied to start_row
---- • cursorline_hl_group: name of the highlight group used to
---- highlight the line when the cursor is on the same line as
---- the mark and 'cursorline' is enabled. Note: ranges are
---- unsupported and decorations are only applied to start_row
---- • conceal: string which should be either empty or a single
---- character. Enable concealing similar to `:syn-conceal`.
---- When a character is supplied it is used as `:syn-cchar`.
---- "hl_group" is used as highlight for the cchar if provided,
---- otherwise it defaults to `hl-Conceal`.
---- • spell: boolean indicating that spell checking should be
---- performed within this extmark
---- • ui_watched: boolean that indicates the mark should be
---- drawn by a UI. When set, the UI will receive win_extmark
---- events. Note: the mark is positioned by virt_text
---- attributes. Can be used together with virt_text.
+--- • id : id of the extmark to edit.
+--- • end_row : ending line of the mark, 0-based inclusive.
+--- • end_col : ending col of the mark, 0-based exclusive.
+--- • hl_group : name of the highlight group used to highlight
+--- this mark.
+--- • hl_eol : when true, for a multiline highlight covering the
+--- EOL of a line, continue the highlight for the rest of the
+--- screen line (just like for diff and cursorline highlight).
+--- • virt_text : virtual text to link to this mark. A list of
+--- `[text, highlight]` tuples, each representing a text chunk
+--- with specified highlight. `highlight` element can either be
+--- a single highlight group, or an array of multiple highlight
+--- groups that will be stacked (highest priority last). A
+--- highlight group can be supplied either as a string or as an
+--- integer, the latter which can be obtained using
+--- `nvim_get_hl_id_by_name()`.
+--- • virt_text_pos : position of virtual text. Possible values:
+--- • "eol": right after eol character (default).
+--- • "overlay": display over the specified column, without
+--- shifting the underlying text.
+--- • "right_align": display right aligned in the window.
+--- • "inline": display at the specified column, and shift the
+--- buffer text to the right as needed.
+--- • virt_text_win_col : position the virtual text at a fixed
+--- window column (starting from the first text column of the
+--- screen line) instead of "virt_text_pos".
+--- • virt_text_hide : hide the virtual text when the background
+--- text is selected or hidden because of scrolling with
+--- 'nowrap' or 'smoothscroll'. Currently only affects "overlay"
+--- virt_text.
+--- • virt_text_repeat_linebreak : repeat the virtual text on
+--- wrapped lines.
+--- • hl_mode : control how highlights are combined with the
+--- highlights of the text. Currently only affects virt_text
+--- highlights, but might affect `hl_group` in later versions.
+--- • "replace": only show the virt_text color. This is the
+--- default.
+--- • "combine": combine with background text color.
+--- • "blend": blend with background text color. Not supported
+--- for "inline" virt_text.
+--- • virt_lines : virtual lines to add next to this mark This
+--- should be an array over lines, where each line in turn is an
+--- array over `[text, highlight]` tuples. In general, buffer
+--- and window options do not affect the display of the text. In
+--- particular 'wrap' and 'linebreak' options do not take
+--- effect, so the number of extra screen lines will always
+--- match the size of the array. However the 'tabstop' buffer
+--- option is still used for hard tabs. By default lines are
+--- placed below the buffer line containing the mark.
+--- • virt_lines_above: place virtual lines above instead.
+--- • virt_lines_leftcol: Place extmarks in the leftmost column of
+--- the window, bypassing sign and number columns.
+--- • ephemeral : for use with `nvim_set_decoration_provider()`
+--- callbacks. The mark will only be used for the current redraw
+--- cycle, and not be permantently stored in the buffer.
+--- • right_gravity : boolean that indicates the direction the
+--- extmark will be shifted in when new text is inserted (true
+--- for right, false for left). Defaults to true.
+--- • end_right_gravity : boolean that indicates the direction the
+--- extmark end position (if it exists) will be shifted in when
+--- new text is inserted (true for right, false for left).
+--- Defaults to false.
+--- • undo_restore : Restore the exact position of the mark if
+--- text around the mark was deleted and then restored by undo.
+--- Defaults to true.
+--- • invalidate : boolean that indicates whether to hide the
+--- extmark if the entirety of its range is deleted. For hidden
+--- marks, an "invalid" key is added to the "details" array of
+--- `nvim_buf_get_extmarks()` and family. If "undo_restore" is
+--- false, the extmark is deleted instead.
+--- • priority: a priority value for the highlight group, sign
+--- attribute or virtual text. For virtual text, item with
+--- highest priority is drawn last. For example treesitter
+--- highlighting uses a value of 100.
+--- • strict: boolean that indicates extmark should not be placed
+--- if the line or column value is past the end of the buffer or
+--- end of the line respectively. Defaults to true.
+--- • sign_text: string of length 1-2 used to display in the sign
+--- column.
+--- • sign_hl_group: name of the highlight group used to highlight
+--- the sign column text.
+--- • number_hl_group: name of the highlight group used to
+--- highlight the number column.
+--- • line_hl_group: name of the highlight group used to highlight
+--- the whole line.
+--- • cursorline_hl_group: name of the highlight group used to
+--- highlight the sign column text when the cursor is on the
+--- same line as the mark and 'cursorline' is enabled.
+--- • conceal: string which should be either empty or a single
+--- character. Enable concealing similar to `:syn-conceal`. When
+--- a character is supplied it is used as `:syn-cchar`.
+--- "hl_group" is used as highlight for the cchar if provided,
+--- otherwise it defaults to `hl-Conceal`.
+--- • spell: boolean indicating that spell checking should be
+--- performed within this extmark
+--- • ui_watched: boolean that indicates the mark should be drawn
+--- by a UI. When set, the UI will receive win_extmark events.
+--- Note: the mark is positioned by virt_text attributes. Can be
+--- used together with virt_text.
+--- • url: A URL to associate with this extmark. In the TUI, the
+--- OSC 8 control sequence is used to generate a clickable
+--- hyperlink to this URL.
+--- • scoped: boolean that indicates that the extmark should only
+--- be displayed in the namespace scope. (experimental)
--- @return integer
function vim.api.nvim_buf_set_extmark(buffer, ns_id, line, col, opts) end
@@ -603,11 +638,14 @@ function vim.api.nvim_buf_set_extmark(buffer, ns_id, line, col, opts) end
function vim.api.nvim_buf_set_keymap(buffer, mode, lhs, rhs, opts) end
--- Sets (replaces) a line-range in the buffer.
+---
--- Indexing is zero-based, end-exclusive. Negative indices are interpreted as
--- length+1+index: -1 refers to the index past the end. So to change or
--- delete the last element use start=-2 and end=-1.
+---
--- To insert lines at a given index, set `start` and `end` to the same index.
--- To delete a range of lines, set `replacement` to an empty array.
+---
--- Out-of-bounds indices are clamped to the nearest valid value, unless
--- `strict_indexing` is set.
---
@@ -620,13 +658,14 @@ function vim.api.nvim_buf_set_lines(buffer, start, end_, strict_indexing, replac
--- Sets a named mark in the given buffer, all marks are allowed
--- file/uppercase, visual, last change, etc. See `mark-motions`.
+---
--- Marks are (1,0)-indexed. `api-indexing`
---
--- @param buffer integer Buffer to set the mark on
--- @param name string Mark name
--- @param line integer Line number
--- @param col integer Column/row number
---- @param opts table<string,any> Optional parameters. Reserved for future use.
+--- @param opts vim.api.keyset.empty Optional parameters. Reserved for future use.
--- @return boolean
function vim.api.nvim_buf_set_mark(buffer, name, line, col, opts) end
@@ -643,16 +682,21 @@ function vim.api.nvim_buf_set_name(buffer, name) end
function vim.api.nvim_buf_set_option(buffer, name, value) end
--- Sets (replaces) a range in the buffer
+---
--- This is recommended over `nvim_buf_set_lines()` when only modifying parts
--- of a line, as extmarks will be preserved on non-modified parts of the
--- touched lines.
+---
--- Indexing is zero-based. Row indices are end-inclusive, and column indices
--- are end-exclusive.
---- To insert text at a given `(row, column)` location, use `start_row =
---- end_row = row` and `start_col = end_col = col`. To delete the text in a
---- range, use `replacement = {}`.
+---
+--- To insert text at a given `(row, column)` location, use
+--- `start_row = end_row = row` and `start_col = end_col = col`. To delete the
+--- text in a range, use `replacement = {}`.
+---
--- Prefer `nvim_buf_set_lines()` if you are only adding or deleting entire
--- lines.
+---
--- Prefer `nvim_put()` if you want to insert text at the cursor position.
---
--- @param buffer integer Buffer handle, or 0 for current buffer
@@ -675,11 +719,12 @@ function vim.api.nvim_buf_set_var(buffer, name, value) end
--- @param src_id integer
--- @param line integer
--- @param chunks any[]
---- @param opts table<string,any>
+--- @param opts vim.api.keyset.empty
--- @return integer
function vim.api.nvim_buf_set_virtual_text(buffer, src_id, line, chunks, opts) end
--- Calls a Vimscript `Dictionary-function` with the given arguments.
+---
--- On execution error: fails with Vimscript error, updates v:errmsg.
---
--- @param dict any Dictionary, or String evaluating to a Vimscript `self` dict
@@ -689,6 +734,7 @@ function vim.api.nvim_buf_set_virtual_text(buffer, src_id, line, chunks, opts) e
function vim.api.nvim_call_dict_function(dict, fn, args) end
--- Calls a Vimscript function with the given arguments.
+---
--- On execution error: fails with Vimscript error, updates v:errmsg.
---
--- @param fn string Function to call
@@ -700,6 +746,7 @@ function vim.api.nvim_call_function(fn, args) end
--- process. For the stdio channel `channel-stdio`, it writes to Nvim's
--- stdout. For an internal terminal instance (`nvim_open_term()`) it writes
--- directly to terminal output. See `channel-bytes` for more information.
+---
--- This function writes raw data, not RPC messages. If the channel was
--- created with `rpc=true` then the channel expects RPC messages, use
--- `vim.rpcnotify()` and `vim.rpcrequest()` instead.
@@ -716,41 +763,41 @@ function vim.api.nvim_chan_send(chan, data) end
--- • event: "pat1"
--- • event: { "pat1" }
--- • event: { "pat1", "pat2", "pat3" }
----
--- • pattern: (string|table)
--- • pattern or patterns to match exactly.
--- • For example, if you have `*.py` as that pattern for the
--- autocmd, you must pass `*.py` exactly to clear it.
--- `test.py` will not match the pattern.
----
--- • defaults to clearing all patterns.
--- • NOTE: Cannot be used with {buffer}
----
--- • buffer: (bufnr)
--- • clear only `autocmd-buflocal` autocommands.
--- • NOTE: Cannot be used with {pattern}
----
--- • group: (string|int) The augroup name or id.
---- • NOTE: If not passed, will only delete autocmds not in any group.
+--- • NOTE: If not passed, will only delete autocmds not in any
+--- group.
function vim.api.nvim_clear_autocmds(opts) end
--- Executes an Ex command.
+---
--- Unlike `nvim_command()` this command takes a structured Dictionary instead
--- of a String. This allows for easier construction and manipulation of an Ex
--- command. This also allows for things such as having spaces inside a
--- command argument, expanding filenames in a command that otherwise doesn't
--- expand filenames, etc. Command arguments may also be Number, Boolean or
--- String.
+---
--- The first argument may also be used instead of count for commands that
--- support it in order to make their usage simpler with `vim.cmd()`. For
--- example, instead of `vim.cmd.bdelete{ count = 2 }`, you may do
--- `vim.cmd.bdelete(2)`.
+---
--- On execution error: fails with Vimscript error, updates v:errmsg.
---
--- @param cmd vim.api.keyset.cmd Command to execute. Must be a Dictionary that can contain the
---- same values as the return value of `nvim_parse_cmd()` except
---- "addr", "nargs" and "nextcmd" which are ignored if provided.
---- All values except for "cmd" are optional.
+--- same values as the return value of `nvim_parse_cmd()` except
+--- "addr", "nargs" and "nextcmd" which are ignored if provided.
+--- All values except for "cmd" are optional.
--- @param opts vim.api.keyset.cmd_opts Optional parameters.
--- • output: (boolean, default false) Whether to return command
--- output.
@@ -758,7 +805,9 @@ function vim.api.nvim_clear_autocmds(opts) end
function vim.api.nvim_cmd(cmd, opts) end
--- Executes an Ex command.
+---
--- On execution error: fails with Vimscript error, updates v:errmsg.
+---
--- Prefer using `nvim_cmd()` or `nvim_exec2()` over this. To evaluate
--- multiple lines of Vim script or an Ex command directly, use
--- `nvim_exec2()`. To construct an Ex command using a structured format and
@@ -773,7 +822,18 @@ function vim.api.nvim_command(command) end
--- @return string
function vim.api.nvim_command_output(command) end
+--- Set info for the completion candidate index. if the info was shown in a
+--- window, then the window and buffer ids are returned for further
+--- customization. If the text was not shown, an empty dict is returned.
+---
+--- @param index integer the completion candidate index
+--- @param opts vim.api.keyset.complete_set Optional parameters.
+--- • info: (string) info text.
+--- @return table<string,any>
+function vim.api.nvim_complete_set(index, opts) end
+
--- Create or get an autocommand group `autocmd-groups`.
+---
--- To get an existing group id, do:
---
--- ```lua
@@ -782,6 +842,7 @@ function vim.api.nvim_command_output(command) end
--- })
--- ```
---
+---
--- @param name string String: The name of the group
--- @param opts vim.api.keyset.create_augroup Dictionary Parameters
--- • clear (bool) optional: defaults to true. Clear existing
@@ -789,7 +850,10 @@ function vim.api.nvim_command_output(command) end
--- @return integer
function vim.api.nvim_create_augroup(name, opts) end
---- Creates an `autocommand` event handler, defined by `callback` (Lua function or Vimscript function name string) or `command` (Ex command string).
+--- Creates an `autocommand` event handler, defined by `callback` (Lua
+--- function or Vimscript function name string) or `command` (Ex command
+--- string).
+---
--- Example using Lua callback:
---
--- ```lua
@@ -817,39 +881,39 @@ function vim.api.nvim_create_augroup(name, opts) end
--- pattern = vim.fn.expand("~") .. "/some/path/*.py"
--- ```
---
+---
--- @param event any (string|array) Event(s) that will trigger the handler
--- (`callback` or `command`).
--- @param opts vim.api.keyset.create_autocmd Options dict:
---- • group (string|integer) optional: autocommand group name or
---- id to match against.
---- • pattern (string|array) optional: pattern(s) to match
---- literally `autocmd-pattern`.
---- • buffer (integer) optional: buffer number for buffer-local
---- autocommands `autocmd-buflocal`. Cannot be used with
---- {pattern}.
---- • desc (string) optional: description (for documentation and
---- troubleshooting).
---- • callback (function|string) optional: Lua function (or
---- Vimscript function name, if string) called when the
---- event(s) is triggered. Lua callback can return true to
---- delete the autocommand, and receives a table argument with
---- these keys:
---- • id: (number) autocommand id
---- • event: (string) name of the triggered event
---- `autocmd-events`
---- • group: (number|nil) autocommand group id, if any
---- • match: (string) expanded value of `<amatch>`
---- • buf: (number) expanded value of `<abuf>`
---- • file: (string) expanded value of `<afile>`
---- • data: (any) arbitrary data passed from
---- `nvim_exec_autocmds()`
----
---- • command (string) optional: Vim command to execute on event.
---- Cannot be used with {callback}
---- • once (boolean) optional: defaults to false. Run the
---- autocommand only once `autocmd-once`.
---- • nested (boolean) optional: defaults to false. Run nested
---- autocommands `autocmd-nested`.
+--- • group (string|integer) optional: autocommand group name or
+--- id to match against.
+--- • pattern (string|array) optional: pattern(s) to match
+--- literally `autocmd-pattern`.
+--- • buffer (integer) optional: buffer number for buffer-local
+--- autocommands `autocmd-buflocal`. Cannot be used with
+--- {pattern}.
+--- • desc (string) optional: description (for documentation and
+--- troubleshooting).
+--- • callback (function|string) optional: Lua function (or
+--- Vimscript function name, if string) called when the event(s)
+--- is triggered. Lua callback can return a truthy value (not
+--- `false` or `nil`) to delete the autocommand. Receives a
+--- table argument with these keys:
+--- • id: (number) autocommand id
+--- • event: (string) name of the triggered event
+--- `autocmd-events`
+--- • group: (number|nil) autocommand group id, if any
+--- • match: (string) expanded value of <amatch>
+--- • buf: (number) expanded value of <abuf>
+--- • file: (string) expanded value of <afile>
+--- • data: (any) arbitrary data passed from
+--- `nvim_exec_autocmds()`
+--- • command (string) optional: Vim command to execute on event.
+--- Cannot be used with {callback}
+--- • once (boolean) optional: defaults to false. Run the
+--- autocommand only once `autocmd-once`.
+--- • nested (boolean) optional: defaults to false. Run nested
+--- autocommands `autocmd-nested`.
--- @return integer
function vim.api.nvim_create_autocmd(event, opts) end
@@ -862,9 +926,11 @@ function vim.api.nvim_create_autocmd(event, opts) end
--- @return integer
function vim.api.nvim_create_buf(listed, scratch) end
---- Creates a new namespace or gets an existing one. *namespace*
+--- Creates a new namespace or gets an existing one. *namespace*
+---
--- Namespaces are used for buffer highlights and virtual text, see
--- `nvim_buf_add_highlight()` and `nvim_buf_set_extmark()`.
+---
--- Namespaces can be named or anonymous. If `name` matches an existing
--- namespace, the associated id is returned. If `name` is an empty string a
--- new, anonymous namespace is created.
@@ -874,7 +940,9 @@ function vim.api.nvim_create_buf(listed, scratch) end
function vim.api.nvim_create_namespace(name) end
--- Creates a global `user-commands` command.
+---
--- For Lua usage see `lua-guide-commands-create`.
+---
--- Example:
---
--- ```vim
@@ -883,51 +951,52 @@ function vim.api.nvim_create_namespace(name) end
--- Hello world!
--- ```
---
+---
--- @param name string Name of the new user command. Must begin with an uppercase
---- letter.
+--- letter.
--- @param command any Replacement command to execute when this user command is
--- executed. When called from Lua, the command can also be a
--- Lua function. The function is called with a single table
--- argument that contains the following keys:
--- • name: (string) Command name
--- • args: (string) The args passed to the command, if any
---- `<args>`
+--- <args>
--- • fargs: (table) The args split by unescaped whitespace
---- (when more than one argument is allowed), if any
---- `<f-args>`
+--- (when more than one argument is allowed), if any <f-args>
--- • nargs: (string) Number of arguments `:command-nargs`
--- • bang: (boolean) "true" if the command was executed with a
---- ! modifier `<bang>`
+--- ! modifier <bang>
--- • line1: (number) The starting line of the command range
---- `<line1>`
+--- <line1>
--- • line2: (number) The final line of the command range
---- `<line2>`
+--- <line2>
--- • range: (number) The number of items in the command range:
---- 0, 1, or 2 `<range>`
---- • count: (number) Any count supplied `<count>`
---- • reg: (string) The optional register, if specified `<reg>`
---- • mods: (string) Command modifiers, if any `<mods>`
+--- 0, 1, or 2 <range>
+--- • count: (number) Any count supplied <count>
+--- • reg: (string) The optional register, if specified <reg>
+--- • mods: (string) Command modifiers, if any <mods>
--- • smods: (table) Command modifiers in a structured format.
--- Has the same structure as the "mods" key of
--- `nvim_parse_cmd()`.
--- @param opts vim.api.keyset.user_command Optional `command-attributes`.
---- • Set boolean attributes such as `:command-bang` or
---- `:command-bar` to true (but not `:command-buffer`, use
---- `nvim_buf_create_user_command()` instead).
---- • "complete" `:command-complete` also accepts a Lua
---- function which works like
---- `:command-completion-customlist`.
---- • Other parameters:
---- • desc: (string) Used for listing the command when a Lua
---- function is used for {command}.
---- • force: (boolean, default true) Override any previous
---- definition.
---- • preview: (function) Preview callback for 'inccommand'
---- `:command-preview`
+--- • Set boolean attributes such as `:command-bang` or
+--- `:command-bar` to true (but not `:command-buffer`, use
+--- `nvim_buf_create_user_command()` instead).
+--- • "complete" `:command-complete` also accepts a Lua function
+--- which works like `:command-completion-customlist`.
+--- • Other parameters:
+--- • desc: (string) Used for listing the command when a Lua
+--- function is used for {command}.
+--- • force: (boolean, default true) Override any previous
+--- definition.
+--- • preview: (function) Preview callback for 'inccommand'
+--- `:command-preview`
function vim.api.nvim_create_user_command(name, command, opts) end
--- Delete an autocommand group by id.
+---
--- To get a group id one can use `nvim_get_autocmds()`.
+---
--- NOTE: behavior differs from `:augroup-delete`. When deleting a group,
--- autocommands contained in this group will also be deleted and cleared.
--- This group will no longer exist.
@@ -936,6 +1005,7 @@ function vim.api.nvim_create_user_command(name, command, opts) end
function vim.api.nvim_del_augroup_by_id(id) end
--- Delete an autocommand group by name.
+---
--- NOTE: behavior differs from `:augroup-delete`. When deleting a group,
--- autocommands contained in this group will also be deleted and cleared.
--- This group will no longer exist.
@@ -953,6 +1023,7 @@ function vim.api.nvim_del_autocmd(id) end
function vim.api.nvim_del_current_line() end
--- Unmaps a global `mapping` for the given mode.
+---
--- To unmap a buffer-local mapping, use `nvim_buf_del_keymap()`.
---
--- @param mode string
@@ -977,15 +1048,15 @@ function vim.api.nvim_del_var(name) end
--- Echo a message.
---
---- @param chunks any[] A list of [text, hl_group] arrays, each representing a text
---- chunk with specified highlight. `hl_group` element can be
---- omitted for no highlight.
+--- @param chunks any[] A list of `[text, hl_group]` arrays, each representing a
+--- text chunk with specified highlight. `hl_group` element can
+--- be omitted for no highlight.
--- @param history boolean if true, add to `message-history`.
--- @param opts vim.api.keyset.echo_opts Optional parameters.
---- • verbose: Message was printed as a result of 'verbose'
---- option if Nvim was invoked with -V3log_file, the message
---- will be redirected to the log_file and suppressed from
---- direct output.
+--- • verbose: Message was printed as a result of 'verbose' option
+--- if Nvim was invoked with -V3log_file, the message will be
+--- redirected to the log_file and suppressed from direct
+--- output.
function vim.api.nvim_echo(chunks, history, opts) end
--- Writes a message to the Vim error buffer. Does not append "\n", the
@@ -1002,6 +1073,7 @@ function vim.api.nvim_err_writeln(str) end
--- Evaluates a Vimscript `expression`. Dictionaries and Lists are recursively
--- expanded.
+---
--- On execution error: fails with Vimscript error, updates v:errmsg.
---
--- @param expr string Vimscript expression string
@@ -1036,8 +1108,10 @@ function vim.api.nvim_exec(src, output) end
--- Executes Vimscript (multiline block of Ex commands), like anonymous
--- `:source`.
+---
--- Unlike `nvim_command()` this function supports heredocs, script-scope
--- (s:), etc.
+---
--- On execution error: fails with Vimscript error, updates v:errmsg.
---
--- @param src string Vimscript code
@@ -1052,24 +1126,27 @@ function vim.api.nvim_exec2(src, opts) end
---
--- @param event any (String|Array) The event or events to execute
--- @param opts vim.api.keyset.exec_autocmds Dictionary of autocommand options:
---- • group (string|integer) optional: the autocommand group name
---- or id to match against. `autocmd-groups`.
---- • pattern (string|array) optional: defaults to "*"
---- `autocmd-pattern`. Cannot be used with {buffer}.
---- • buffer (integer) optional: buffer number
---- `autocmd-buflocal`. Cannot be used with {pattern}.
---- • modeline (bool) optional: defaults to true. Process the
---- modeline after the autocommands `<nomodeline>`.
---- • data (any): arbitrary data to send to the autocommand
---- callback. See `nvim_create_autocmd()` for details.
+--- • group (string|integer) optional: the autocommand group name
+--- or id to match against. `autocmd-groups`.
+--- • pattern (string|array) optional: defaults to "*"
+--- `autocmd-pattern`. Cannot be used with {buffer}.
+--- • buffer (integer) optional: buffer number `autocmd-buflocal`.
+--- Cannot be used with {pattern}.
+--- • modeline (bool) optional: defaults to true. Process the
+--- modeline after the autocommands <nomodeline>.
+--- • data (any): arbitrary data to send to the autocommand
+--- callback. See `nvim_create_autocmd()` for details.
function vim.api.nvim_exec_autocmds(event, opts) end
--- Sends input-keys to Nvim, subject to various quirks controlled by `mode`
--- flags. This is a blocking call, unlike `nvim_input()`.
+---
--- On execution error: does not fail, but updates v:errmsg.
+---
--- To input sequences like <C-o> use `nvim_replace_termcodes()` (typically
--- with escape_ks=false) to replace `keycodes`, then pass the result to
--- nvim_feedkeys().
+---
--- Example:
---
--- ```vim
@@ -1077,6 +1154,7 @@ function vim.api.nvim_exec_autocmds(event, opts) end
--- :call nvim_feedkeys(key, 'n', v:false)
--- ```
---
+---
--- @param keys string to be typed
--- @param mode string behavior flags, see `feedkeys()`
--- @param escape_ks boolean If true, escape K_SPECIAL bytes in `keys`. This should be
@@ -1085,6 +1163,7 @@ function vim.api.nvim_exec_autocmds(event, opts) end
function vim.api.nvim_feedkeys(keys, mode, escape_ks) end
--- Gets the option information for all options.
+---
--- The dictionary has the full option names as keys and option metadata
--- dictionaries as detailed at `nvim_get_option_info2()`.
---
@@ -1092,6 +1171,7 @@ function vim.api.nvim_feedkeys(keys, mode, escape_ks) end
function vim.api.nvim_get_all_options_info() end
--- Get all autocommands that match the corresponding {opts}.
+---
--- These examples will get autocommands matching ALL the given criteria:
---
--- ```lua
@@ -1121,17 +1201,18 @@ function vim.api.nvim_get_all_options_info() end
--- • buffer: Buffer number or list of buffer numbers for buffer
--- local autocommands `autocmd-buflocal`. Cannot be used with
--- {pattern}
---- @return any[]
+--- @return vim.api.keyset.get_autocmds.ret[]
function vim.api.nvim_get_autocmds(opts) end
--- Gets information about a channel.
---
---- @param chan integer
+--- @param chan integer channel_id, or 0 for current channel
--- @return table<string,any>
function vim.api.nvim_get_chan_info(chan) end
--- Returns the 24-bit RGB value of a `nvim_get_color_map()` color name or
--- "#rrggbb" hexadecimal string.
+---
--- Example:
---
--- ```vim
@@ -1139,18 +1220,21 @@ function vim.api.nvim_get_chan_info(chan) end
--- :echo nvim_get_color_by_name("#cbcbcb")
--- ```
---
+---
--- @param name string Color name or "#rrggbb" string
--- @return integer
function vim.api.nvim_get_color_by_name(name) end
--- Returns a map of color names and RGB values.
+---
--- Keys are color names (e.g. "Aqua") and values are 24-bit RGB color values
--- (e.g. 65535).
---
---- @return table<string,any>
+--- @return table<string,integer>
function vim.api.nvim_get_color_map() end
--- Gets a map of global (non-buffer-local) Ex commands.
+---
--- Currently only `user-commands` are supported, not builtin Ex commands.
---
--- @param opts vim.api.keyset.get_commands Optional parameters. Currently only supports {"builtin":false}
@@ -1191,13 +1275,13 @@ function vim.api.nvim_get_current_win() end
--- `nvim_get_namespaces()`. Use 0 to get global highlight groups
--- `:highlight`.
--- @param opts vim.api.keyset.get_highlight Options dict:
---- • name: (string) Get a highlight definition by name.
---- • id: (integer) Get a highlight definition by id.
---- • link: (boolean, default true) Show linked group name
---- instead of effective definition `:hi-link`.
---- • create: (boolean, default true) When highlight group
---- doesn't exist create it.
---- @return table<string,any>
+--- • name: (string) Get a highlight definition by name.
+--- • id: (integer) Get a highlight definition by id.
+--- • link: (boolean, default true) Show linked group name instead
+--- of effective definition `:hi-link`.
+--- • create: (boolean, default true) When highlight group doesn't
+--- exist create it.
+--- @return vim.api.keyset.hl_info
function vim.api.nvim_get_hl(ns_id, opts) end
--- @deprecated
@@ -1213,6 +1297,7 @@ function vim.api.nvim_get_hl_by_id(hl_id, rgb) end
function vim.api.nvim_get_hl_by_name(name, rgb) end
--- Gets a highlight group by name
+---
--- similar to `hlID()`, but allocates a new ID if not present.
---
--- @param name string
@@ -1232,28 +1317,29 @@ function vim.api.nvim_get_hl_ns(opts) end
--- Gets a list of global (non-buffer-local) `mapping` definitions.
---
--- @param mode string Mode short-name ("n", "i", "v", ...)
---- @return table<string,any>[]
+--- @return vim.api.keyset.keymap[]
function vim.api.nvim_get_keymap(mode) end
--- Returns a `(row, col, buffer, buffername)` tuple representing the position
--- of the uppercase/file named mark. "End of line" column position is
--- returned as `v:maxcol` (big number). See `mark-motions`.
+---
--- Marks are (1,0)-indexed. `api-indexing`
---
--- @param name string Mark name
---- @param opts table<string,any> Optional parameters. Reserved for future use.
---- @return any[]
+--- @param opts vim.api.keyset.empty Optional parameters. Reserved for future use.
+--- @return vim.api.keyset.get_mark
function vim.api.nvim_get_mark(name, opts) end
--- Gets the current mode. `mode()` "blocking" is true if Nvim is waiting for
--- input.
---
---- @return table<string,any>
+--- @return vim.api.keyset.get_mode
function vim.api.nvim_get_mode() end
--- Gets existing, non-anonymous `namespace`s.
---
---- @return table<string,any>
+--- @return table<string,integer>
function vim.api.nvim_get_namespaces() end
--- @deprecated
@@ -1263,10 +1349,11 @@ function vim.api.nvim_get_option(name) end
--- @deprecated
--- @param name string
---- @return table<string,any>
+--- @return vim.api.keyset.get_option_info
function vim.api.nvim_get_option_info(name) end
--- Gets the option information for one option from arbitrary buffer or window
+---
--- Resulting dictionary has keys:
--- • name: Name of the option (like 'filetype')
--- • shortname: Shortened name of the option (like 'ft')
@@ -1293,7 +1380,7 @@ function vim.api.nvim_get_option_info(name) end
--- • win: `window-ID`. Used for getting window local options.
--- • buf: Buffer number. Used for getting buffer local options.
--- Implies {scope} is "local".
---- @return table<string,any>
+--- @return vim.api.keyset.get_option_info
function vim.api.nvim_get_option_info2(name, opts) end
--- Gets the value of an option. The behavior of this function matches that of
@@ -1328,10 +1415,12 @@ function vim.api.nvim_get_proc(pid) end
function vim.api.nvim_get_proc_children(pid) end
--- Find files in runtime directories
+---
--- "name" can contain wildcards. For example
--- nvim_get_runtime_file("colors/*.vim", true) will return all color scheme
--- files. Always use forward slashes (/) in the search pattern for
--- subdirectories regardless of platform.
+---
--- It is not an error to not find any files. An empty array is returned then.
---
--- @param name string pattern of files to search for
@@ -1354,6 +1443,7 @@ function vim.api.nvim_get_vvar(name) end
--- Queues raw user-input. Unlike `nvim_feedkeys()`, this uses a low-level
--- input buffer and the call is non-blocking (input is processed
--- asynchronously by the eventloop).
+---
--- On execution error: does not fail, but updates v:errmsg.
---
--- @param keys string to be typed
@@ -1361,14 +1451,15 @@ function vim.api.nvim_get_vvar(name) end
function vim.api.nvim_input(keys) end
--- Send mouse event from GUI.
+---
--- Non-blocking: does not wait on any result, but queues the event to be
--- processed soon by the event loop.
---
--- @param button string Mouse button: one of "left", "right", "middle", "wheel",
---- "move".
---- @param action string For ordinary buttons, one of "press", "drag", "release".
---- For the wheel, one of "up", "down", "left", "right".
---- Ignored for "move".
+--- "move", "x1", "x2".
+--- @param action string For ordinary buttons, one of "press", "drag", "release". For
+--- the wheel, one of "up", "down", "left", "right". Ignored for
+--- "move".
--- @param modifier string String of modifiers each represented by a single char. The
--- same specifiers are used as for a key press, except that
--- the "-" separator is optional, so "C-A-", "c-a" and "CA"
@@ -1379,6 +1470,7 @@ function vim.api.nvim_input(keys) end
function vim.api.nvim_input_mouse(button, action, modifier, grid, row, col) end
--- Gets the current list of buffer handles
+---
--- Includes unlisted (unloaded/deleted) buffers, like `:ls!`. Use
--- `nvim_buf_is_loaded()` to check if a buffer is loaded.
---
@@ -1417,6 +1509,7 @@ function vim.api.nvim_list_wins() end
function vim.api.nvim_load_context(dict) end
--- Notify the user with a message
+---
--- Relays the call to vim.notify . By default forwards your message in the
--- echo area but can be overridden to trigger desktop notifications.
---
@@ -1427,10 +1520,12 @@ function vim.api.nvim_load_context(dict) end
function vim.api.nvim_notify(msg, log_level, opts) end
--- Open a terminal instance in a buffer
+---
--- By default (and currently the only option) the terminal will not be
--- connected to an external process. Instead, input send on the channel will
--- be echoed directly by the terminal. This is useful to display ANSI
--- terminal sequences returned as part of a rpc message, or similar.
+---
--- Note: to directly initiate the terminal using the right size, display the
--- buffer in a configured window before calling this. For instance, for a
--- floating display, first create an empty buffer using `nvim_create_buf()`,
@@ -1439,34 +1534,51 @@ function vim.api.nvim_notify(msg, log_level, opts) end
--- virtual terminal having the intended size.
---
--- @param buffer integer the buffer to use (expected to be empty)
---- @param opts table<string,function> Optional parameters.
---- • on_input: Lua callback for input sent, i e keypresses in
---- terminal mode. Note: keypresses are sent raw as they would
---- be to the pty master end. For instance, a carriage return
---- is sent as a "\r", not as a "\n". `textlock` applies. It
---- is possible to call `nvim_chan_send()` directly in the
---- callback however. ["input", term, bufnr, data]
+--- @param opts vim.api.keyset.open_term Optional parameters.
+--- • on_input: Lua callback for input sent, i e keypresses in
+--- terminal mode. Note: keypresses are sent raw as they would
+--- be to the pty master end. For instance, a carriage return is
+--- sent as a "\r", not as a "\n". `textlock` applies. It is
+--- possible to call `nvim_chan_send()` directly in the callback
+--- however. `["input", term, bufnr, data]`
+--- • force_crlf: (boolean, default true) Convert "\n" to "\r\n".
--- @return integer
function vim.api.nvim_open_term(buffer, opts) end
---- Open a new window.
---- Currently this is used to open floating and external windows. Floats are
---- windows that are drawn above the split layout, at some anchor position in
---- some other window. Floats can be drawn internally or by external GUI with
---- the `ui-multigrid` extension. External windows are only supported with
---- multigrid GUIs, and are displayed as separate top-level windows.
+--- Opens a new split window, or a floating window if `relative` is specified,
+--- or an external window (managed by the UI) if `external` is specified.
+---
+--- Floats are windows that are drawn above the split layout, at some anchor
+--- position in some other window. Floats can be drawn internally or by
+--- external GUI with the `ui-multigrid` extension. External windows are only
+--- supported with multigrid GUIs, and are displayed as separate top-level
+--- windows.
+---
--- For a general overview of floats, see `api-floatwin`.
---- Exactly one of `external` and `relative` must be specified. The `width`
---- and `height` of the new window must be specified.
+---
+--- The `width` and `height` of the new window must be specified when opening
+--- a floating window, but are optional for normal windows.
+---
+--- If `relative` and `external` are omitted, a normal "split" window is
+--- created. The `win` property determines which window will be split. If no
+--- `win` is provided or `win == 0`, a window will be created adjacent to the
+--- current window. If -1 is provided, a top-level split will be created.
+--- `vertical` and `split` are only valid for normal windows, and are used to
+--- control split direction. For `vertical`, the exact direction is determined
+--- by `'splitright'` and `'splitbelow'`. Split windows cannot have
+--- `bufpos`/`row`/`col`/`border`/`title`/`footer` properties.
+---
--- With relative=editor (row=0,col=0) refers to the top-left corner of the
--- screen-grid and (row=Lines-1,col=Columns-1) refers to the bottom-right
--- corner. Fractional values are allowed, but the builtin implementation
--- (used by non-multigrid UIs) will always round down to nearest integer.
+---
--- Out-of-bounds values, and configurations that make the float not fit
--- inside the main editor, are allowed. The builtin implementation truncates
--- values so floats are fully within the main screen grid. External GUIs
--- could let floats hover outside of the main window like a tooltip, but this
--- should not be used to specify arbitrary WM screen positions.
+---
--- Example (Lua): window-relative float
---
--- ```lua
@@ -1479,12 +1591,21 @@ function vim.api.nvim_open_term(buffer, opts) end
--- ```lua
--- vim.api.nvim_open_win(0, false,
--- {relative='win', width=12, height=3, bufpos={100,10}})
+--- ```
+---
+--- Example (Lua): vertical split left of the current window
+---
+--- ```lua
+--- vim.api.nvim_open_win(0, false, {
+--- split = 'left',
+--- win = 0
--- })
--- ```
---
+---
--- @param buffer integer Buffer to display, or 0 for current buffer
--- @param enter boolean Enter the window (make it the current window)
---- @param config vim.api.keyset.float_config Map defining the window configuration. Keys:
+--- @param config vim.api.keyset.win_config Map defining the window configuration. Keys:
--- • relative: Sets the window layout to "floating", placed at
--- (row,col) coordinates relative to:
--- • "editor" The global editor grid
@@ -1492,25 +1613,23 @@ function vim.api.nvim_open_term(buffer, opts) end
--- window.
--- • "cursor" Cursor position in current window.
--- • "mouse" Mouse position
----
---- • win: `window-ID` for relative="win".
+--- • win: `window-ID` window to split, or relative window when
+--- creating a float (relative="win").
--- • anchor: Decides which corner of the float to place at
--- (row,col):
--- • "NW" northwest (default)
--- • "NE" northeast
--- • "SW" southwest
--- • "SE" southeast
----
--- • width: Window width (in character cells). Minimum of 1.
--- • height: Window height (in character cells). Minimum of 1.
--- • bufpos: Places float relative to buffer text (only when
---- relative="win"). Takes a tuple of zero-indexed [line,
---- column]. `row` and `col` if given are applied relative to this position, else they
---- default to:
+--- relative="win"). Takes a tuple of zero-indexed
+--- `[line, column]`. `row` and `col` if given are applied
+--- relative to this position, else they default to:
--- • `row=1` and `col=0` if `anchor` is "NW" or "NE"
--- • `row=0` and `col=0` if `anchor` is "SW" or "SE" (thus
--- like a tooltip near the buffer text).
----
--- • row: Row position in units of "screen cell height", may be
--- fractional.
--- • col: Column position in units of "screen cell width", may
@@ -1521,8 +1640,9 @@ function vim.api.nvim_open_term(buffer, opts) end
--- • external: GUI should display the window as an external
--- top-level window. Currently accepts no other positioning
--- configuration together with this.
---- • zindex: Stacking order. floats with higher `zindex` go on top on floats with lower indices. Must be larger
---- than zero. The following screen elements have hard-coded
+--- • zindex: Stacking order. floats with higher `zindex` go on
+--- top on floats with lower indices. Must be larger than
+--- zero. The following screen elements have hard-coded
--- z-indices:
--- • 100: insert completion popupmenu
--- • 200: message scrollback
@@ -1530,7 +1650,6 @@ function vim.api.nvim_open_term(buffer, opts) end
--- wildoptions+=pum) The default value for floats are 50.
--- In general, values below 100 are recommended, unless
--- there is a good reason to overshadow builtin elements.
----
--- • style: (optional) Configure the appearance of the window.
--- Currently only supports one value:
--- • "minimal" Nvim will display the window with many UI
@@ -1543,14 +1662,13 @@ function vim.api.nvim_open_term(buffer, opts) end
--- empty. The end-of-buffer region is hidden by setting
--- `eob` flag of 'fillchars' to a space char, and clearing
--- the `hl-EndOfBuffer` region in 'winhighlight'.
----
--- • border: Style of (optional) window border. This can either
--- be a string or an array. The string values are
--- • "none": No border (default).
--- • "single": A single line box.
--- • "double": A double line box.
---- • "rounded": Like "single", but with rounded corners ("╭"
---- etc.).
+--- • "rounded": Like "single", but with rounded corners
+--- ("╭" etc.).
--- • "solid": Adds padding by a single whitespace cell.
--- • "shadow": A drop shadow effect by blending with the
--- background.
@@ -1558,18 +1676,35 @@ function vim.api.nvim_open_term(buffer, opts) end
--- any divisor of eight. The array will specify the eight
--- chars building up the border in a clockwise fashion
--- starting with the top-left corner. As an example, the
---- double box style could be specified as [ "╔", "═" ,"╗",
---- "║", "╝", "═", "╚", "║" ]. If the number of chars are
---- less than eight, they will be repeated. Thus an ASCII
---- border could be specified as [ "/", "-", "\\", "|" ], or
---- all chars the same as [ "x" ]. An empty string can be
---- used to turn off a specific border, for instance, [ "",
---- "", "", ">", "", "", "", "<" ] will only make vertical
---- borders but not horizontal ones. By default,
---- `FloatBorder` highlight is used, which links to
---- `WinSeparator` when not defined. It could also be
---- specified by character: [ ["+", "MyCorner"], ["x",
---- "MyBorder"] ].
+--- double box style could be specified as:
+--- ```
+--- [ "╔", "═" ,"╗", "║", "╝", "═", "╚", "║" ].
+--- ```
+---
+--- If the number of chars are less than eight, they will be
+--- repeated. Thus an ASCII border could be specified as
+--- ```
+--- [ "/", "-", \"\\\\\", "|" ],
+--- ```
+---
+--- or all chars the same as
+--- ```
+--- [ "x" ].
+--- ```
+---
+--- An empty string can be used to turn off a specific border,
+--- for instance,
+--- ```
+--- [ "", "", "", ">", "", "", "", "<" ]
+--- ```
+---
+--- will only make vertical borders but not horizontal ones.
+--- By default, `FloatBorder` highlight is used, which links
+--- to `WinSeparator` when not defined. It could also be
+--- specified by character:
+--- ```
+--- [ ["+", "MyCorner"], ["x", "MyBorder"] ].
+--- ```
---
--- • title: Title (optional) in window border, string or list.
--- List should consist of `[text, highlight]` tuples. If
@@ -1589,6 +1724,8 @@ function vim.api.nvim_open_term(buffer, opts) end
--- • fixed: If true when anchor is NW or SW, the float window
--- would be kept fixed even if the window would be truncated.
--- • hide: If true the floating window will be hidden.
+--- • vertical: Split vertically `:vertical`.
+--- • split: Split direction: "left", "right", "above", "below".
--- @return integer
function vim.api.nvim_open_win(buffer, enter, config) end
@@ -1599,28 +1736,29 @@ function vim.api.nvim_open_win(buffer, enter, config) end
function vim.api.nvim_out_write(str) end
--- Parse command line.
+---
--- Doesn't check the validity of command arguments.
---
--- @param str string Command line string to parse. Cannot contain "\n".
---- @param opts table<string,any> Optional parameters. Reserved for future use.
---- @return table<string,any>
+--- @param opts vim.api.keyset.empty Optional parameters. Reserved for future use.
+--- @return vim.api.keyset.parse_cmd
function vim.api.nvim_parse_cmd(str, opts) end
--- Parse a Vimscript expression.
---
--- @param expr string Expression to parse. Always treated as a single line.
--- @param flags string Flags:
---- • "m" if multiple expressions in a row are allowed (only
---- the first one will be parsed),
---- • "E" if EOC tokens are not allowed (determines whether
---- they will stop parsing process or be recognized as an
---- operator/space, though also yielding an error).
---- • "l" when needing to start parsing with lvalues for
---- ":let" or ":for". Common flag sets:
---- • "m" to parse like for ":echo".
---- • "E" to parse like for "<C-r>=".
---- • empty string for ":call".
---- • "lm" to parse for ":let".
+--- • "m" if multiple expressions in a row are allowed (only the
+--- first one will be parsed),
+--- • "E" if EOC tokens are not allowed (determines whether they
+--- will stop parsing process or be recognized as an
+--- operator/space, though also yielding an error).
+--- • "l" when needing to start parsing with lvalues for ":let"
+--- or ":for". Common flag sets:
+--- • "m" to parse like for `":echo"`.
+--- • "E" to parse like for `"<C-r>="`.
+--- • empty string for ":call".
+--- • "lm" to parse for ":let".
--- @param highlight boolean If true, return value will also include "highlight" key
--- containing array of 4-tuples (arrays) (Integer, Integer,
--- Integer, String), where first three numbers define the
@@ -1631,8 +1769,10 @@ function vim.api.nvim_parse_cmd(str, opts) end
function vim.api.nvim_parse_expression(expr, flags, highlight) end
--- Pastes at cursor, in any mode.
+---
--- Invokes the `vim.paste` handler, which handles each mode appropriately.
--- Sets redo/undo. Faster than `nvim_input()`. Lines break at LF ("\n").
+---
--- Errors ('nomodifiable', `vim.paste()` failure, 
) are reflected in `err`
--- but do not affect the return value (which is strictly decided by
--- `vim.paste()`). On error, subsequent calls are ignored ("drained") until
@@ -1641,7 +1781,8 @@ function vim.api.nvim_parse_expression(expr, flags, highlight) end
--- @param data string Multiline input. May be binary (containing NUL bytes).
--- @param crlf boolean Also break lines at CR and CRLF.
--- @param phase integer -1: paste in a single call (i.e. without streaming). To
---- "stream" a paste, call `nvim_paste` sequentially with these `phase` values:
+--- "stream" a paste, call `nvim_paste` sequentially with these
+--- `phase` values:
--- • 1: starts the paste (exactly once)
--- • 2: continues the paste (zero or more times)
--- • 3: ends the paste (exactly once)
@@ -1649,16 +1790,16 @@ function vim.api.nvim_parse_expression(expr, flags, highlight) end
function vim.api.nvim_paste(data, crlf, phase) end
--- Puts text at cursor, in any mode.
+---
--- Compare `:put` and `p` which are always linewise.
---
--- @param lines string[] `readfile()`-style list of lines. `channel-lines`
--- @param type string Edit behavior: any `getregtype()` result, or:
---- • "b" `blockwise-visual` mode (may include width, e.g. "b3")
---- • "c" `charwise` mode
---- • "l" `linewise` mode
---- • "" guess by contents, see `setreg()`
---- @param after boolean If true insert after cursor (like `p`), or before (like
---- `P`).
+--- • "b" `blockwise-visual` mode (may include width, e.g. "b3")
+--- • "c" `charwise` mode
+--- • "l" `linewise` mode
+--- • "" guess by contents, see `setreg()`
+--- @param after boolean If true insert after cursor (like `p`), or before (like `P`).
--- @param follow boolean If true place cursor at end of inserted text.
function vim.api.nvim_put(lines, type, after, follow) end
@@ -1673,19 +1814,20 @@ function vim.api.nvim_put(lines, type, after, follow) end
function vim.api.nvim_replace_termcodes(str, from_part, do_lt, special) end
--- Selects an item in the completion popup menu.
+---
--- If neither `ins-completion` nor `cmdline-completion` popup menu is active
--- this API call is silently ignored. Useful for an external UI using
--- `ui-popupmenu` to control the popup menu with the mouse. Can also be used
--- in a mapping; use <Cmd> `:map-cmd` or a Lua mapping to ensure the mapping
--- doesn't end completion mode.
---
---- @param item integer Index (zero-based) of the item to select. Value of -1
---- selects nothing and restores the original text.
+--- @param item integer Index (zero-based) of the item to select. Value of -1 selects
+--- nothing and restores the original text.
--- @param insert boolean For `ins-completion`, whether the selection should be
--- inserted in the buffer. Ignored for `cmdline-completion`.
--- @param finish boolean Finish the completion and dismiss the popup menu. Implies
--- {insert}.
---- @param opts table<string,any> Optional parameters. Reserved for future use.
+--- @param opts vim.api.keyset.empty Optional parameters. Reserved for future use.
function vim.api.nvim_select_popupmenu_item(item, insert, finish, opts) end
--- Sets the current buffer.
@@ -1714,13 +1856,16 @@ function vim.api.nvim_set_current_tabpage(tabpage) end
function vim.api.nvim_set_current_win(window) end
--- Set or change decoration provider for a `namespace`
+---
--- This is a very general purpose interface for having Lua callbacks being
--- triggered during the redraw code.
+---
--- The expected usage is to set `extmarks` for the currently redrawn buffer.
--- `nvim_buf_set_extmark()` can be called to add marks on a per-window or
--- per-lines basis. Use the `ephemeral` key to only use the mark for the
--- current screen redraw (the callback will be called again for the next
--- redraw).
+---
--- Note: this function should not be called often. Rather, the callbacks
--- themselves can be used to throttle unneeded callbacks. the `on_start`
--- callback can return `false` to disable the provider until the next redraw.
@@ -1729,28 +1874,44 @@ function vim.api.nvim_set_current_win(window) end
--- plugin managing multiple sources of decoration should ideally only set one
--- provider, and merge the sources internally. You can use multiple `ns_id`
--- for the extmarks set/modified inside the callback anyway.
+---
--- Note: doing anything other than setting extmarks is considered
--- experimental. Doing things like changing options are not explicitly
--- forbidden, but is likely to have unexpected consequences (such as 100% CPU
--- consumption). doing `vim.rpcnotify` should be OK, but `vim.rpcrequest` is
--- quite dubious for the moment.
+---
--- Note: It is not allowed to remove or update extmarks in 'on_line'
--- callbacks.
---
--- @param ns_id integer Namespace id from `nvim_create_namespace()`
--- @param opts vim.api.keyset.set_decoration_provider Table of callbacks:
---- • on_start: called first on each screen redraw ["start",
---- tick]
---- • on_buf: called for each buffer being redrawn (before window
---- callbacks) ["buf", bufnr, tick]
---- • on_win: called when starting to redraw a specific window.
---- botline_guess is an approximation that does not exceed the
---- last line number. ["win", winid, bufnr, topline,
---- botline_guess]
---- • on_line: called for each buffer line being redrawn. (The
---- interaction with fold lines is subject to change) ["win",
---- winid, bufnr, row]
---- • on_end: called at the end of a redraw cycle ["end", tick]
+--- • on_start: called first on each screen redraw
+--- ```
+--- ["start", tick]
+--- ```
+---
+--- • on_buf: called for each buffer being redrawn (before window
+--- callbacks)
+--- ```
+--- ["buf", bufnr, tick]
+--- ```
+---
+--- • on_win: called when starting to redraw a specific window.
+--- ```
+--- ["win", winid, bufnr, topline, botline]
+--- ```
+---
+--- • on_line: called for each buffer line being redrawn. (The
+--- interaction with fold lines is subject to change)
+--- ```
+--- ["line", winid, bufnr, row]
+--- ```
+---
+--- • on_end: called at the end of a redraw cycle
+--- ```
+--- ["end", tick]
+--- ```
function vim.api.nvim_set_decoration_provider(ns_id, opts) end
--- Sets a highlight group.
@@ -1762,31 +1923,31 @@ function vim.api.nvim_set_decoration_provider(ns_id, opts) end
--- activate them.
--- @param name string Highlight group name, e.g. "ErrorMsg"
--- @param val vim.api.keyset.highlight Highlight definition map, accepts the following keys:
---- • fg (or foreground): color name or "#RRGGBB", see note.
---- • bg (or background): color name or "#RRGGBB", see note.
---- • sp (or special): color name or "#RRGGBB"
---- • blend: integer between 0 and 100
---- • bold: boolean
---- • standout: boolean
---- • underline: boolean
---- • undercurl: boolean
---- • underdouble: boolean
---- • underdotted: boolean
---- • underdashed: boolean
---- • strikethrough: boolean
---- • italic: boolean
---- • reverse: boolean
---- • nocombine: boolean
---- • link: name of another highlight group to link to, see
---- `:hi-link`.
---- • default: Don't override existing definition `:hi-default`
---- • ctermfg: Sets foreground of cterm color `ctermfg`
---- • ctermbg: Sets background of cterm color `ctermbg`
---- • cterm: cterm attribute map, like `highlight-args`. If not
---- set, cterm attributes will match those from the attribute
---- map documented above.
---- • force: if true force update the highlight group when it
---- exists.
+--- • fg: color name or "#RRGGBB", see note.
+--- • bg: color name or "#RRGGBB", see note.
+--- • sp: color name or "#RRGGBB"
+--- • blend: integer between 0 and 100
+--- • bold: boolean
+--- • standout: boolean
+--- • underline: boolean
+--- • undercurl: boolean
+--- • underdouble: boolean
+--- • underdotted: boolean
+--- • underdashed: boolean
+--- • strikethrough: boolean
+--- • italic: boolean
+--- • reverse: boolean
+--- • nocombine: boolean
+--- • link: name of another highlight group to link to, see
+--- `:hi-link`.
+--- • default: Don't override existing definition `:hi-default`
+--- • ctermfg: Sets foreground of cterm color `ctermfg`
+--- • ctermbg: Sets background of cterm color `ctermbg`
+--- • cterm: cterm attribute map, like `highlight-args`. If not
+--- set, cterm attributes will match those from the attribute map
+--- documented above.
+--- • force: if true force update the highlight group when it
+--- exists.
function vim.api.nvim_set_hl(ns_id, name, val) end
--- Set active namespace for highlights defined with `nvim_set_hl()`. This can
@@ -1797,6 +1958,7 @@ function vim.api.nvim_set_hl_ns(ns_id) end
--- Set active namespace for highlights defined with `nvim_set_hl()` while
--- redrawing.
+---
--- This function meant to be called while redrawing, primarily from
--- `nvim_set_decoration_provider()` on_win and on_line callbacks, which are
--- allowed to change the namespace during a redraw cycle.
@@ -1805,9 +1967,12 @@ function vim.api.nvim_set_hl_ns(ns_id) end
function vim.api.nvim_set_hl_ns_fast(ns_id) end
--- Sets a global `mapping` for the given mode.
+---
--- To set a buffer-local mapping, use `nvim_buf_set_keymap()`.
+---
--- Unlike `:map`, leading/trailing whitespace is accepted as part of the
---- {lhs} or {rhs}. Empty {rhs} is `<Nop>`. `keycodes` are replaced as usual.
+--- {lhs} or {rhs}. Empty {rhs} is <Nop>. `keycodes` are replaced as usual.
+---
--- Example:
---
--- ```vim
@@ -1820,14 +1985,15 @@ function vim.api.nvim_set_hl_ns_fast(ns_id) end
--- nmap <nowait> <Space><NL> <Nop>
--- ```
---
---- @param mode string Mode short-name (map command prefix: "n", "i", "v", "x", 
) or
---- "!" for `:map!`, or empty string for `:map`. "ia", "ca" or
+---
+--- @param mode string Mode short-name (map command prefix: "n", "i", "v", "x", 
)
+--- or "!" for `:map!`, or empty string for `:map`. "ia", "ca" or
--- "!a" for abbreviation in Insert mode, Cmdline mode, or both,
--- respectively
--- @param lhs string Left-hand-side `{lhs}` of the mapping.
--- @param rhs string Right-hand-side `{rhs}` of the mapping.
--- @param opts vim.api.keyset.keymap Optional parameters map: Accepts all `:map-arguments` as keys
---- except `<buffer>`, values are booleans (default false). Also:
+--- except <buffer>, values are booleans (default false). Also:
--- • "noremap" disables `recursive_mapping`, like `:noremap`
--- • "desc" human-readable description.
--- • "callback" Lua function called in place of {rhs}.
@@ -1845,15 +2011,16 @@ function vim.api.nvim_set_option(name, value) end
--- Sets the value of an option. The behavior of this function matches that of
--- `:set`: for global-local options, both the global and local value are set
--- unless otherwise specified with {scope}.
+---
--- Note the options {win} and {buf} cannot be used together.
---
--- @param name string Option name
--- @param value any New option value
--- @param opts vim.api.keyset.option Optional parameters
---- • scope: One of "global" or "local". Analogous to
---- `:setglobal` and `:setlocal`, respectively.
---- • win: `window-ID`. Used for setting window local option.
---- • buf: Buffer number. Used for setting buffer local option.
+--- • scope: One of "global" or "local". Analogous to `:setglobal`
+--- and `:setlocal`, respectively.
+--- • win: `window-ID`. Used for setting window local option.
+--- • buf: Buffer number. Used for setting buffer local option.
function vim.api.nvim_set_option_value(name, value, opts) end
--- Sets a global (g:) variable.
@@ -1919,11 +2086,24 @@ function vim.api.nvim_tabpage_list_wins(tabpage) end
--- @param value any Variable value
function vim.api.nvim_tabpage_set_var(tabpage, name, value) end
+--- Sets the current window in a tabpage
+---
+--- @param tabpage integer Tabpage handle, or 0 for current tabpage
+--- @param win integer Window handle, must already belong to {tabpage}
+function vim.api.nvim_tabpage_set_win(tabpage, win) end
+
+--- Adds the namespace scope to the window.
+---
+--- @param window integer Window handle, or 0 for current window
+--- @param ns_id integer the namespace to add
+--- @return boolean
+function vim.api.nvim_win_add_ns(window, ns_id) end
+
--- Calls a function with window as temporary current window.
---
--- @param window integer Window handle, or 0 for current window
--- @param fun function Function to call inside the window (currently Lua callable
---- only)
+--- only)
--- @return any
function vim.api.nvim_win_call(window, fun) end
@@ -1931,8 +2111,8 @@ function vim.api.nvim_win_call(window, fun) end
---
--- @param window integer Window handle, or 0 for current window
--- @param force boolean Behave like `:close!` The last window of a buffer with
---- unwritten changes can be closed. The buffer will become
---- hidden, even if 'hidden' is not set.
+--- unwritten changes can be closed. The buffer will become
+--- hidden, even if 'hidden' is not set.
function vim.api.nvim_win_close(window, force) end
--- Removes a window-scoped (w:) variable
@@ -1948,11 +2128,13 @@ function vim.api.nvim_win_del_var(window, name) end
function vim.api.nvim_win_get_buf(window) end
--- Gets window configuration.
+---
--- The returned value may be given to `nvim_open_win()`.
+---
--- `relative` is empty for normal windows.
---
--- @param window integer Window handle, or 0 for current window
---- @return table<string,any>
+--- @return vim.api.keyset.win_config
function vim.api.nvim_win_get_config(window) end
--- Gets the (1,0)-indexed, buffer-relative cursor position for a given window
@@ -1969,6 +2151,12 @@ function vim.api.nvim_win_get_cursor(window) end
--- @return integer
function vim.api.nvim_win_get_height(window) end
+--- Gets all the namespaces scopes associated with a window.
+---
+--- @param window integer Window handle, or 0 for current window
+--- @return integer[]
+function vim.api.nvim_win_get_ns(window) end
+
--- Gets the window number
---
--- @param window integer Window handle, or 0 for current window
@@ -2008,6 +2196,7 @@ function vim.api.nvim_win_get_width(window) end
--- Closes the window and hide the buffer it contains (like `:hide` with a
--- `window-ID`).
+---
--- Like `:hide` the buffer becomes hidden unless another window is editing
--- it, or 'bufhidden' is `unload`, `delete` or `wipe` as opposed to `:close`
--- or `nvim_win_close()`, which will close the buffer.
@@ -2021,6 +2210,13 @@ function vim.api.nvim_win_hide(window) end
--- @return boolean
function vim.api.nvim_win_is_valid(window) end
+--- Removes the namespace scope from the window.
+---
+--- @param window integer Window handle, or 0 for current window
+--- @param ns_id integer the namespace to remove
+--- @return boolean
+function vim.api.nvim_win_remove_ns(window, ns_id) end
+
--- Sets the current buffer in a window, without side effects
---
--- @param window integer Window handle, or 0 for current window
@@ -2029,11 +2225,12 @@ function vim.api.nvim_win_set_buf(window, buffer) end
--- Configures window layout. Currently only for floating and external windows
--- (including changing a split window to those layouts).
+---
--- When reconfiguring a floating window, absent option keys will not be
--- changed. `row`/`col` and `relative` must be reconfigured together.
---
--- @param window integer Window handle, or 0 for current window
---- @param config vim.api.keyset.float_config Map defining the window configuration, see `nvim_open_win()`
+--- @param config vim.api.keyset.win_config Map defining the window configuration, see `nvim_open_win()`
function vim.api.nvim_win_set_config(window, config) end
--- Sets the (1,0)-indexed cursor position in the window. `api-indexing` This
@@ -2052,6 +2249,7 @@ function vim.api.nvim_win_set_height(window, height) end
--- Set highlight namespace for a window. This will use highlights defined
--- with `nvim_set_hl()` for this namespace, but fall back to global
--- highlights (ns=0) when missing.
+---
--- This takes precedence over the 'winhighlight' option.
---
--- @param window integer
@@ -2080,23 +2278,26 @@ function vim.api.nvim_win_set_width(window, width) end
--- Computes the number of screen lines occupied by a range of text in a given
--- window. Works for off-screen text and takes folds into account.
+---
--- Diff filler or virtual lines above a line are counted as a part of that
--- line, unless the line is on "start_row" and "start_vcol" is specified.
+---
--- Diff filler or virtual lines below the last buffer line are counted in the
--- result when "end_row" is omitted.
+---
--- Line indexing is similar to `nvim_buf_get_text()`.
---
--- @param window integer Window handle, or 0 for current window.
--- @param opts vim.api.keyset.win_text_height Optional parameters:
---- • start_row: Starting line index, 0-based inclusive. When
---- omitted start at the very top.
---- • end_row: Ending line index, 0-based inclusive. When
---- omitted end at the very bottom.
---- • start_vcol: Starting virtual column index on "start_row",
---- 0-based inclusive, rounded down to full screen lines. When
---- omitted include the whole line.
---- • end_vcol: Ending virtual column index on "end_row",
---- 0-based exclusive, rounded up to full screen lines. When
---- omitted include the whole line.
+--- • start_row: Starting line index, 0-based inclusive. When
+--- omitted start at the very top.
+--- • end_row: Ending line index, 0-based inclusive. When omitted
+--- end at the very bottom.
+--- • start_vcol: Starting virtual column index on "start_row",
+--- 0-based inclusive, rounded down to full screen lines. When
+--- omitted include the whole line.
+--- • end_vcol: Ending virtual column index on "end_row", 0-based
+--- exclusive, rounded up to full screen lines. When omitted
+--- include the whole line.
--- @return table<string,any>
function vim.api.nvim_win_text_height(window, opts) end
diff --git a/runtime/lua/vim/_meta/api_keysets.lua b/runtime/lua/vim/_meta/api_keysets.lua
index f69e5a92c7..37e4372196 100644
--- a/runtime/lua/vim/_meta/api_keysets.lua
+++ b/runtime/lua/vim/_meta/api_keysets.lua
@@ -3,6 +3,19 @@
-- DO NOT EDIT
error('Cannot require a meta file')
+--- @class vim.api.keyset.buf_attach
+--- @field on_lines? function
+--- @field on_bytes? function
+--- @field on_changedtick? function
+--- @field on_detach? function
+--- @field on_reload? function
+--- @field utf_sizes? boolean
+--- @field preview? boolean
+
+--- @class vim.api.keyset.buf_delete
+--- @field force? boolean
+--- @field unload? boolean
+
--- @class vim.api.keyset.clear_autocmds
--- @field buffer? integer
--- @field event? any
@@ -55,6 +68,9 @@ error('Cannot require a meta file')
--- @class vim.api.keyset.cmd_opts
--- @field output? boolean
+--- @class vim.api.keyset.complete_set
+--- @field info? string
+
--- @class vim.api.keyset.context
--- @field types? any[]
@@ -74,6 +90,8 @@ error('Cannot require a meta file')
--- @class vim.api.keyset.echo_opts
--- @field verbose? boolean
+--- @class vim.api.keyset.empty
+
--- @class vim.api.keyset.eval_statusline
--- @field winid? integer
--- @field maxwidth? integer
@@ -93,28 +111,6 @@ error('Cannot require a meta file')
--- @class vim.api.keyset.exec_opts
--- @field output? boolean
---- @class vim.api.keyset.float_config
---- @field row? number
---- @field col? number
---- @field width? integer
---- @field height? integer
---- @field anchor? string
---- @field relative? string
---- @field win? integer
---- @field bufpos? any[]
---- @field external? boolean
---- @field focusable? boolean
---- @field zindex? integer
---- @field border? any
---- @field title? any
---- @field title_pos? string
---- @field footer? any
---- @field footer_pos? string
---- @field style? string
---- @field noautocmd? boolean
---- @field fixed? boolean
---- @field hide? boolean
-
--- @class vim.api.keyset.get_autocmds
--- @field event? any
--- @field group? any
@@ -124,6 +120,10 @@ error('Cannot require a meta file')
--- @class vim.api.keyset.get_commands
--- @field builtin? boolean
+--- @class vim.api.keyset.get_extmark
+--- @field details? boolean
+--- @field hl_name? boolean
+
--- @class vim.api.keyset.get_extmarks
--- @field limit? integer
--- @field details? boolean
@@ -170,6 +170,7 @@ error('Cannot require a meta file')
--- @field fg_indexed? boolean
--- @field bg_indexed? boolean
--- @field force? boolean
+--- @field url? string
--- @class vim.api.keyset.highlight_cterm
--- @field bold? boolean
@@ -196,6 +197,10 @@ error('Cannot require a meta file')
--- @field desc? string
--- @field replace_keycodes? boolean
+--- @class vim.api.keyset.open_term
+--- @field on_input? function
+--- @field force_crlf? boolean
+
--- @class vim.api.keyset.option
--- @field scope? string
--- @field win? integer
@@ -220,11 +225,12 @@ error('Cannot require a meta file')
--- @field end_line? integer
--- @field end_row? integer
--- @field end_col? integer
---- @field hl_group? any
+--- @field hl_group? number|string
--- @field virt_text? any[]
--- @field virt_text_pos? string
--- @field virt_text_win_col? integer
--- @field virt_text_hide? boolean
+--- @field virt_text_repeat_linebreak? boolean
--- @field hl_eol? boolean
--- @field hl_mode? string
--- @field invalidate? boolean
@@ -237,14 +243,17 @@ error('Cannot require a meta file')
--- @field virt_lines_leftcol? boolean
--- @field strict? boolean
--- @field sign_text? string
---- @field sign_hl_group? any
---- @field number_hl_group? any
---- @field line_hl_group? any
---- @field cursorline_hl_group? any
+--- @field sign_hl_group? number|string
+--- @field number_hl_group? number|string
+--- @field line_hl_group? number|string
+--- @field cursorline_hl_group? number|string
--- @field conceal? string
--- @field spell? boolean
--- @field ui_watched? boolean
--- @field undo_restore? boolean
+--- @field url? string
+--- @field scoped? boolean
+--- @field _subpriority? integer
--- @class vim.api.keyset.user_command
--- @field addr? any
@@ -260,8 +269,46 @@ error('Cannot require a meta file')
--- @field range? any
--- @field register? boolean
+--- @class vim.api.keyset.win_config
+--- @field row? number
+--- @field col? number
+--- @field width? integer
+--- @field height? integer
+--- @field anchor? string
+--- @field relative? string
+--- @field split? string
+--- @field win? integer
+--- @field bufpos? any[]
+--- @field external? boolean
+--- @field focusable? boolean
+--- @field vertical? boolean
+--- @field zindex? integer
+--- @field border? any
+--- @field title? any
+--- @field title_pos? string
+--- @field footer? any
+--- @field footer_pos? string
+--- @field style? string
+--- @field noautocmd? boolean
+--- @field fixed? boolean
+--- @field hide? boolean
+
--- @class vim.api.keyset.win_text_height
--- @field start_row? integer
--- @field end_row? integer
--- @field start_vcol? integer
--- @field end_vcol? integer
+
+--- @class vim.api.keyset.xdl_diff
+--- @field on_hunk? function
+--- @field result_type? string
+--- @field algorithm? string
+--- @field ctxlen? integer
+--- @field interhunkctxlen? integer
+--- @field linematch? any
+--- @field ignore_whitespace? boolean
+--- @field ignore_whitespace_change? boolean
+--- @field ignore_whitespace_change_at_eol? boolean
+--- @field ignore_cr_at_eol? boolean
+--- @field ignore_blank_lines? boolean
+--- @field indent_heuristic? boolean
diff --git a/runtime/lua/vim/_meta/api_keysets_extra.lua b/runtime/lua/vim/_meta/api_keysets_extra.lua
new file mode 100644
index 0000000000..d61dd2c02f
--- /dev/null
+++ b/runtime/lua/vim/_meta/api_keysets_extra.lua
@@ -0,0 +1,167 @@
+--- @meta _
+error('Cannot require a meta file')
+
+--- Extra types we can't generate keysets for
+
+--- @class vim.api.keyset.extmark_details
+--- @field ns_id integer
+--- @field right_gravity boolean
+---
+--- @field end_row? integer
+--- @field end_col? integer
+--- @field end_right_gravity? integer
+---
+--- @field priority? integer
+---
+--- @field undo_restore? false
+--- @field invalidate? true
+--- @field invalid? true
+---
+--- @field hl_group? string
+--- @field hl_eol? boolean
+---
+--- @field conceal? boolean
+--- @field spell? boolean
+--- @field ui_watched? boolean
+--- @field url? boolean
+--- @field hl_mode? string
+---
+--- @field virt_text? {[1]: string, [2]: string}[]
+--- @field virt_text_hide? boolean
+--- @field virt_text_repeat_linebreak? boolean
+--- @field virt_text_win_col? integer
+--- @field virt_text_pos? string
+---
+--- @field virt_lines? {[1]: string, [2]: string}[][]
+--- @field virt_lines_above? boolean
+--- @field virt_lines_leftcol? boolean
+---
+--- @field sign_text? string
+--- @field sign_name? string
+--- @field sign_hl_group? string
+--- @field number_hl_group? string
+--- @field line_hl_group? string
+--- @field cursorline_hl_group? string
+
+--- @class vim.api.keyset.get_extmark_item
+--- @field [1] integer row
+--- @field [2] integer col
+--- @field [3] vim.api.keyset.extmark_details?
+
+--- @class vim.api.keyset.get_mark
+--- @field [1] integer row
+--- @field [2] integer col
+--- @field [3] integer buffer
+--- @field [4] string buffername
+
+--- @class vim.api.keyset.get_autocmds.ret
+--- @field id? integer
+--- @field group? integer
+--- @field group_name? integer
+--- @field desc? string
+--- @field event? string
+--- @field command? string
+--- @field callback? function
+--- @field once? boolean
+--- @field pattern? string
+--- @field buflocal? boolean
+--- @field buffer? integer
+
+--- @class vim.api.keyset.command_info
+--- @field name string
+--- @field definition string
+--- @field script_id integer
+--- @field bang boolean
+--- @field bar boolean
+--- @field register boolean
+--- @field keepscript boolean
+--- @field preview boolean
+--- @field nargs string
+--- @field complete? string
+--- @field complete_arg? string
+--- @field count? string
+--- @field range? string
+--- @field addr? string
+
+--- @class vim.api.keyset.hl_info.base
+--- @field reverse? true
+--- @field bold? true
+--- @field italic? true
+--- @field underline? true
+--- @field undercurl? true
+--- @field underdouble? true
+--- @field underdotted? true
+--- @field underdashed? true
+--- @field standout? true
+--- @field strikethrough? true
+--- @field altfont? true
+--- @field nocombine? true
+
+--- @class vim.api.keyset.hl_info.cterm : vim.api.keyset.hl_info.base
+--- @field ctermfg? integer
+--- @field ctermbg? integer
+--- @field foreground? integer
+--- @field background? integer
+
+--- @class vim.api.keyset.hl_info : vim.api.keyset.hl_info.base
+--- @field fg? integer
+--- @field bg? integer
+--- @field sp? integer
+--- @field default? true
+--- @field link? string
+--- @field blend? integer
+--- @field cterm? vim.api.keyset.hl_info.cterm
+
+--- @class vim.api.keyset.get_mode
+--- @field blocking boolean
+--- @field mode string
+
+--- @class vim.api.keyset.get_option_info
+--- @field name string
+--- @field shortname string
+--- @field scope 'buf'|'win'|'global'
+--- @field global_local boolean
+--- @field commalist boolean
+--- @field flaglist boolean
+--- @field was_set boolean
+--- @field last_set_id integer
+--- @field last_set_linenr integer
+--- @field last_set_chan integer
+--- @field type 'string'|'boolean'|'number'
+--- @field default string|boolean|integer
+--- @field allows_duplicates boolean
+
+--- @class vim.api.keyset.parse_cmd.mods
+--- @field filter { force: boolean, pattern: string }
+--- @field silent boolean
+--- @field emsg_silent boolean
+--- @field unsilent boolean
+--- @field sandbox boolean
+--- @field noautocmd boolean
+--- @field tab integer
+--- @field verbose integer
+--- @field browse boolean
+--- @field confirm boolean
+--- @field hide boolean
+--- @field keepalt boolean
+--- @field keepjumps boolean
+--- @field keepmarks boolean
+--- @field keeppatterns boolean
+--- @field lockmarks boolean
+--- @field noswapfile boolean
+--- @field vertical boolean
+--- @field horizontal boolean
+--- @field split ''|'botright'|'topleft'|'belowright'|'aboveleft'
+
+--- @class vim.api.keyset.parse_cmd
+--- @field addr 'line'|'arg'|'buf'|'load'|'win'|'tab'|'qf'|'none'|'?'
+--- @field args string[]
+--- @field bang boolean
+--- @field cmd string
+--- @field magic {bar: boolean, file: boolean}
+--- @field mods vim.api.keyset.parse_cmd.mods
+--- @field nargs '0'|'1'|'?'|'+'|'*'
+--- @field nextcmd string
+--- @field range? integer[]
+--- @field count? integer
+--- @field reg? string
diff --git a/runtime/lua/vim/_meta/builtin.lua b/runtime/lua/vim/_meta/builtin.lua
index eeba356672..9a67667f02 100644
--- a/runtime/lua/vim/_meta/builtin.lua
+++ b/runtime/lua/vim/_meta/builtin.lua
@@ -1,66 +1,72 @@
---@meta
-
-- luacheck: no unused args
----@defgroup vim.builtin
----
----@brief <pre>help
----vim.api.{func}({...}) *vim.api*
---- Invokes Nvim |API| function {func} with arguments {...}.
---- Example: call the "nvim_get_current_line()" API function: >lua
---- print(tostring(vim.api.nvim_get_current_line()))
----
----vim.NIL *vim.NIL*
---- Special value representing NIL in |RPC| and |v:null| in Vimscript
---- conversion, and similar cases. Lua `nil` cannot be used as part of a Lua
---- table representing a Dictionary or Array, because it is treated as
---- missing: `{"foo", nil}` is the same as `{"foo"}`.
----
----vim.type_idx *vim.type_idx*
---- Type index for use in |lua-special-tbl|. Specifying one of the values from
---- |vim.types| allows typing the empty table (it is unclear whether empty Lua
---- table represents empty list or empty array) and forcing integral numbers
---- to be |Float|. See |lua-special-tbl| for more details.
----
----vim.val_idx *vim.val_idx*
---- Value index for tables representing |Float|s. A table representing
---- floating-point value 1.0 looks like this: >lua
---- {
---- [vim.type_idx] = vim.types.float,
---- [vim.val_idx] = 1.0,
---- }
----< See also |vim.type_idx| and |lua-special-tbl|.
----
----vim.types *vim.types*
---- Table with possible values for |vim.type_idx|. Contains two sets of
---- key-value pairs: first maps possible values for |vim.type_idx| to
---- human-readable strings, second maps human-readable type names to values
---- for |vim.type_idx|. Currently contains pairs for `float`, `array` and
---- `dictionary` types.
----
---- Note: One must expect that values corresponding to `vim.types.float`,
---- `vim.types.array` and `vim.types.dictionary` fall under only two following
---- assumptions:
---- 1. Value may serve both as a key and as a value in a table. Given the
---- properties of Lua tables this basically means “value is not `nil`”.
---- 2. For each value in `vim.types` table `vim.types[vim.types[value]]` is the
---- same as `value`.
---- No other restrictions are put on types, and it is not guaranteed that
---- values corresponding to `vim.types.float`, `vim.types.array` and
---- `vim.types.dictionary` will not change or that `vim.types` table will only
---- contain values for these three types.
----
---- *log_levels* *vim.log.levels*
----Log levels are one of the values defined in `vim.log.levels`:
----
---- vim.log.levels.DEBUG
---- vim.log.levels.ERROR
---- vim.log.levels.INFO
---- vim.log.levels.TRACE
---- vim.log.levels.WARN
---- vim.log.levels.OFF
----
----</pre>
+error('Cannot require a meta file')
+
+--- @brief <pre>help
+--- vim.api.{func}({...}) *vim.api*
+--- Invokes Nvim |API| function {func} with arguments {...}.
+--- Example: call the "nvim_get_current_line()" API function: >lua
+--- print(tostring(vim.api.nvim_get_current_line()))
+---
+--- vim.NIL *vim.NIL*
+--- Special value representing NIL in |RPC| and |v:null| in Vimscript
+--- conversion, and similar cases. Lua `nil` cannot be used as part of a Lua
+--- table representing a Dictionary or Array, because it is treated as
+--- missing: `{"foo", nil}` is the same as `{"foo"}`.
+---
+--- vim.type_idx *vim.type_idx*
+--- Type index for use in |lua-special-tbl|. Specifying one of the values from
+--- |vim.types| allows typing the empty table (it is unclear whether empty Lua
+--- table represents empty list or empty array) and forcing integral numbers
+--- to be |Float|. See |lua-special-tbl| for more details.
+---
+--- vim.val_idx *vim.val_idx*
+--- Value index for tables representing |Float|s. A table representing
+--- floating-point value 1.0 looks like this: >lua
+--- {
+--- [vim.type_idx] = vim.types.float,
+--- [vim.val_idx] = 1.0,
+--- }
+--- < See also |vim.type_idx| and |lua-special-tbl|.
+---
+--- vim.types *vim.types*
+--- Table with possible values for |vim.type_idx|. Contains two sets of
+--- key-value pairs: first maps possible values for |vim.type_idx| to
+--- human-readable strings, second maps human-readable type names to values
+--- for |vim.type_idx|. Currently contains pairs for `float`, `array` and
+--- `dictionary` types.
+---
+--- Note: One must expect that values corresponding to `vim.types.float`,
+--- `vim.types.array` and `vim.types.dictionary` fall under only two following
+--- assumptions:
+--- 1. Value may serve both as a key and as a value in a table. Given the
+--- properties of Lua tables this basically means “value is not `nil`”.
+--- 2. For each value in `vim.types` table `vim.types[vim.types[value]]` is the
+--- same as `value`.
+--- No other restrictions are put on types, and it is not guaranteed that
+--- values corresponding to `vim.types.float`, `vim.types.array` and
+--- `vim.types.dictionary` will not change or that `vim.types` table will only
+--- contain values for these three types.
+---
+--- *log_levels* *vim.log.levels*
+--- Log levels are one of the values defined in `vim.log.levels`:
+---
+--- vim.log.levels.DEBUG
+--- vim.log.levels.ERROR
+--- vim.log.levels.INFO
+--- vim.log.levels.TRACE
+--- vim.log.levels.WARN
+--- vim.log.levels.OFF
+---
+--- </pre>
+
+---@nodoc
+---@class vim.NIL
+
+---@type vim.NIL
+---@nodoc
+vim.NIL = ...
--- Returns true if the code is executing as part of a "fast" event handler,
--- where most of the API is disabled. These are low-level events (e.g.
@@ -76,6 +82,7 @@ function vim.in_fast_event() end
---
--- Note: If numeric keys are present in the table, Nvim ignores the metatable
--- marker and converts the dict to a list/array anyway.
+--- @return table
function vim.empty_dict() end
--- Sends {event} to {channel} via |RPC| and returns immediately. If {channel}
@@ -84,9 +91,8 @@ function vim.empty_dict() end
--- This function also works in a fast callback |lua-loop-callbacks|.
--- @param channel integer
--- @param method string
---- @param args? any[]
--- @param ...? any
-function vim.rpcnotify(channel, method, args, ...) end
+function vim.rpcnotify(channel, method, ...) end
--- Sends a request to {channel} to invoke {method} via |RPC| and blocks until
--- a response is received.
@@ -95,9 +101,8 @@ function vim.rpcnotify(channel, method, args, ...) end
--- special value
--- @param channel integer
--- @param method string
---- @param args? any[]
--- @param ...? any
-function vim.rpcrequest(channel, method, args, ...) end
+function vim.rpcrequest(channel, method, ...) end
--- Compares strings case-insensitively.
--- @param a string
diff --git a/runtime/lua/vim/_meta/builtin_types.lua b/runtime/lua/vim/_meta/builtin_types.lua
index ef0452c649..0bbc3e9bc8 100644
--- a/runtime/lua/vim/_meta/builtin_types.lua
+++ b/runtime/lua/vim/_meta/builtin_types.lua
@@ -81,10 +81,10 @@
--- @class vim.fn.sign_getplaced.dict
--- @field group? string
--- @field id? integer
---- @field lnum? string
+--- @field lnum? string|integer
--- @class vim.fn.sign_getplaced.ret.item
---- @field buf integer
+--- @field bufnr integer
--- @field signs vim.fn.sign[]
--- @class vim.fn.sign_place.dict
@@ -118,7 +118,7 @@
--- @field topfill? integer
--- @field topline? integer
---- @class vim.fn.winsaveview.ret
+--- @class vim.fn.winsaveview.ret: vim.fn.winrestview.dict
--- @field col integer
--- @field coladd integer
--- @field curswant integer
diff --git a/runtime/lua/vim/_meta/json.lua b/runtime/lua/vim/_meta/json.lua
index e010086615..07d89aafc8 100644
--- a/runtime/lua/vim/_meta/json.lua
+++ b/runtime/lua/vim/_meta/json.lua
@@ -5,7 +5,7 @@ vim.json = {}
-- luacheck: no unused args
----@defgroup vim.json
+---@brief
---
--- This module provides encoding and decoding of Lua objects to and
--- from JSON-encoded strings. Supports |vim.NIL| and |vim.empty_dict()|.
diff --git a/runtime/lua/vim/_meta/lpeg.lua b/runtime/lua/vim/_meta/lpeg.lua
index 42c9a6449e..1ce40f3340 100644
--- a/runtime/lua/vim/_meta/lpeg.lua
+++ b/runtime/lua/vim/_meta/lpeg.lua
@@ -1,11 +1,27 @@
--- @meta
+error('Cannot require a meta file')
--- These types were taken from https://github.com/LuaCATS/lpeg, with types being renamed to include
--- the vim namespace and with some descriptions made less verbose.
+-- These types were taken from https://github.com/LuaCATS/lpeg
+-- (based on revision e6789e28e5b91a4a277a2a03081d708c403a3e34)
+-- with types being renamed to include the vim namespace and with some descriptions made less verbose.
+
+--- @brief <pre>help
+--- LPeg is a pattern-matching library for Lua, based on
+--- Parsing Expression Grammars (https://bford.info/packrat/) (PEGs).
+---
+--- *lua-lpeg*
+--- *vim.lpeg.Pattern*
+--- The LPeg library for parsing expression grammars is included as `vim.lpeg`
+--- (https://www.inf.puc-rio.br/~roberto/lpeg/).
+---
+--- In addition, its regex-like interface is available as |vim.re|
+--- (https://www.inf.puc-rio.br/~roberto/lpeg/re.html).
+---
+--- </pre>
---- *LPeg* is a new pattern-matching library for Lua, based on [Parsing Expression Grammars](https://bford.info/packrat/) (PEGs).
vim.lpeg = {}
+--- @nodoc
--- @class vim.lpeg.Pattern
--- @operator unm: vim.lpeg.Pattern
--- @operator add(vim.lpeg.Pattern): vim.lpeg.Pattern
@@ -32,11 +48,12 @@ local Pattern = {}
--- matches anywhere.
---
--- Example:
+---
--- ```lua
---- local pattern = lpeg.R("az") ^ 1 * -1
---- assert(pattern:match("hello") == 6)
---- assert(lpeg.match(pattern, "hello") == 6)
---- assert(pattern:match("1 hello") == nil)
+--- local pattern = lpeg.R('az') ^ 1 * -1
+--- assert(pattern:match('hello') == 6)
+--- assert(lpeg.match(pattern, 'hello') == 6)
+--- assert(pattern:match('1 hello') == nil)
--- ```
---
--- @param pattern vim.lpeg.Pattern
@@ -55,11 +72,12 @@ function vim.lpeg.match(pattern, subject, init) end
--- we must either write a loop in Lua or write a pattern that matches anywhere.
---
--- Example:
+---
--- ```lua
---- local pattern = lpeg.R("az") ^ 1 * -1
---- assert(pattern:match("hello") == 6)
---- assert(lpeg.match(pattern, "hello") == 6)
---- assert(pattern:match("1 hello") == nil)
+--- local pattern = lpeg.R('az') ^ 1 * -1
+--- assert(pattern:match('hello') == 6)
+--- assert(lpeg.match(pattern, 'hello') == 6)
+--- assert(pattern:match('1 hello') == nil)
--- ```
---
--- @param subject string
@@ -69,7 +87,8 @@ function Pattern:match(subject, init) end
--- Returns the string `"pattern"` if the given value is a pattern, otherwise `nil`.
---
---- @return 'pattern'|nil
+--- @param value vim.lpeg.Pattern|string|integer|boolean|table|function
+--- @return "pattern"|nil
function vim.lpeg.type(value) end
--- Returns a string with the running version of LPeg.
@@ -85,7 +104,7 @@ function vim.lpeg.version() end
--- @param max integer
function vim.lpeg.setmaxstack(max) end
---- Converts the given value into a proper pattern. This following rules are applied:
+--- Converts the given value into a proper pattern. The following rules are applied:
--- * If the argument is a pattern, it is returned unmodified.
--- * If the argument is a string, it is translated to a pattern that matches the string literally.
--- * If the argument is a non-negative number `n`, the result is a pattern that matches exactly `n` characters.
@@ -95,7 +114,7 @@ function vim.lpeg.setmaxstack(max) end
--- * If the argument is a boolean, the result is a pattern that always succeeds or always fails
--- (according to the boolean value), without consuming any input.
--- * If the argument is a table, it is interpreted as a grammar (see Grammars).
---- * If the argument is a function, returns a pattern equivalent to a match-time captureover the empty string.
+--- * If the argument is a function, returns a pattern equivalent to a match-time capture over the empty string.
---
--- @param value vim.lpeg.Pattern|string|integer|boolean|table|function
--- @return vim.lpeg.Pattern
@@ -103,7 +122,7 @@ function vim.lpeg.P(value) end
--- Returns a pattern that matches only if the input string at the current position is preceded by `patt`.
--- Pattern `patt` must match only strings with some fixed length, and it cannot contain captures.
---- Like the and predicate, this pattern never consumes any input, independently of success or failure.
+--- Like the `and` predicate, this pattern never consumes any input, independently of success or failure.
---
--- @param pattern vim.lpeg.Pattern
--- @return vim.lpeg.Pattern
@@ -111,13 +130,14 @@ function vim.lpeg.B(pattern) end
--- Returns a pattern that matches any single character belonging to one of the given ranges.
--- Each `range` is a string `xy` of length 2, representing all characters with code between the codes of
---- `x` and `y` (both inclusive). As an example, the pattern `lpeg.R("09")` matches any digit, and
---- `lpeg.R("az", "AZ")` matches any ASCII letter.
+--- `x` and `y` (both inclusive). As an example, the pattern `lpeg.R('09')` matches any digit, and
+--- `lpeg.R('az', 'AZ')` matches any ASCII letter.
---
--- Example:
+---
--- ```lua
---- local pattern = lpeg.R("az") ^ 1 * -1
---- assert(pattern:match("hello") == 6)
+--- local pattern = lpeg.R('az') ^ 1 * -1
+--- assert(pattern:match('hello') == 6)
--- ```
---
--- @param ... string
@@ -125,9 +145,9 @@ function vim.lpeg.B(pattern) end
function vim.lpeg.R(...) end
--- Returns a pattern that matches any single character that appears in the given string (the `S` stands for Set).
---- As an example, the pattern `lpeg.S("+-*/")` matches any arithmetic operator. Note that, if `s` is a character
+--- As an example, the pattern `lpeg.S('+-*/')` matches any arithmetic operator. Note that, if `s` is a character
--- (that is, a string of length 1), then `lpeg.P(s)` is equivalent to `lpeg.S(s)` which is equivalent to
---- `lpeg.R(s..s)`. Note also that both `lpeg.S("")` and `lpeg.R()` are patterns that always fail.
+--- `lpeg.R(s..s)`. Note also that both `lpeg.S('')` and `lpeg.R()` are patterns that always fail.
---
--- @param string string
--- @return vim.lpeg.Pattern
@@ -137,8 +157,9 @@ function vim.lpeg.S(string) end
--- for a grammar. The created non-terminal refers to the rule indexed by `v` in the enclosing grammar.
---
--- Example:
+---
--- ```lua
---- local b = lpeg.P({"(" * ((1 - lpeg.S "()") + lpeg.V(1)) ^ 0 * ")"})
+--- local b = lpeg.P({'(' * ((1 - lpeg.S '()') + lpeg.V(1)) ^ 0 * ')'})
--- assert(b:match('((string))') == 11)
--- assert(b:match('(') == nil)
--- ```
@@ -147,6 +168,7 @@ function vim.lpeg.S(string) end
--- @return vim.lpeg.Pattern
function vim.lpeg.V(v) end
+--- @nodoc
--- @class vim.lpeg.Locale
--- @field alnum userdata
--- @field alpha userdata
@@ -168,14 +190,15 @@ function vim.lpeg.V(v) end
--- that table.
---
--- Example:
+---
--- ```lua
--- lpeg.locale(lpeg)
---- local space = lpeg.space^0
---- local name = lpeg.C(lpeg.alpha^1) * space
---- local sep = lpeg.S(",;") * space
---- local pair = lpeg.Cg(name * "=" * space * name) * sep^-1
---- local list = lpeg.Cf(lpeg.Ct("") * pair^0, rawset)
---- local t = list:match("a=b, c = hi; next = pi")
+--- local space = lpeg.space ^ 0
+--- local name = lpeg.C(lpeg.alpha ^ 1) * space
+--- local sep = lpeg.S(',;') * space
+--- local pair = lpeg.Cg(name * '=' * space * name) * sep ^ -1
+--- local list = lpeg.Cf(lpeg.Ct('') * pair ^ 0, rawset)
+--- local t = list:match('a=b, c = hi; next = pi')
--- assert(t.a == 'b')
--- assert(t.c == 'hi')
--- assert(t.next == 'pi')
@@ -191,11 +214,12 @@ function vim.lpeg.locale(tab) end
--- The captured value is a string. If `patt` has other captures, their values are returned after this one.
---
--- Example:
+---
--- ```lua
--- local function split (s, sep)
--- sep = lpeg.P(sep)
---- local elem = lpeg.C((1 - sep)^0)
---- local p = elem * (sep * elem)^0
+--- local elem = lpeg.C((1 - sep) ^ 0)
+--- local p = elem * (sep * elem) ^ 0
--- return lpeg.match(p, s)
--- end
--- local a, b, c = split('a,b,c', ',')
@@ -241,12 +265,13 @@ function vim.lpeg.Cc(...) end
--- becomes the captured value.
---
--- Example:
+---
--- ```lua
---- local number = lpeg.R("09") ^ 1 / tonumber
---- local list = number * ("," * number) ^ 0
+--- local number = lpeg.R('09') ^ 1 / tonumber
+--- local list = number * (',' * number) ^ 0
--- local function add(acc, newvalue) return acc + newvalue end
--- local sum = lpeg.Cf(list, add)
---- assert(sum:match("10,30,43") == 83)
+--- assert(sum:match('10,30,43') == 83)
--- ```
---
--- @param patt vim.lpeg.Pattern
@@ -267,10 +292,11 @@ function vim.lpeg.Cg(patt, name) end
--- subject where the match occurs. The captured value is a number.
---
--- Example:
+---
--- ```lua
--- local I = lpeg.Cp()
--- local function anywhere(p) return lpeg.P({I * p * I + 1 * lpeg.V(1)}) end
---- local match_start, match_end = anywhere("world"):match("hello world!")
+--- local match_start, match_end = anywhere('world'):match('hello world!')
--- assert(match_start == 7)
--- assert(match_end == 12)
--- ```
@@ -285,10 +311,11 @@ function vim.lpeg.Cp() end
--- value is the string resulting from all replacements.
---
--- Example:
+---
--- ```lua
--- local function gsub (s, patt, repl)
--- patt = lpeg.P(patt)
---- patt = lpeg.Cs((patt / repl + 1)^0)
+--- patt = lpeg.Cs((patt / repl + 1) ^ 0)
--- return lpeg.match(patt, s)
--- end
--- assert(gsub('Hello, xxx!', 'xxx', 'World') == 'Hello, World!')
@@ -312,9 +339,9 @@ function vim.lpeg.Ct(patt) end
--- and then calls `function`. The given function gets as arguments the entire subject, the current position
--- (after the match of `patt`), plus any capture values produced by `patt`. The first value returned by `function`
--- defines how the match happens. If the call returns a number, the match succeeds and the returned number
---- becomes the new current position. (Assuming a subject sand current position i, the returned number must be
---- in the range [i, len(s) + 1].) If the call returns true, the match succeeds without consuming any input
---- (so, to return true is equivalent to return i). If the call returns false, nil, or no value, the match fails.
+--- becomes the new current position. (Assuming a subject sand current position `i`, the returned number must be
+--- in the range `[i, len(s) + 1]`.) If the call returns `true`, the match succeeds without consuming any input
+--- (so, to return true is equivalent to return `i`). If the call returns `false`, `nil`, or no value, the match fails.
--- Any extra values returned by the function become the values produced by the capture.
---
--- @param patt vim.lpeg.Pattern
diff --git a/runtime/lua/vim/_meta/misc.lua b/runtime/lua/vim/_meta/misc.lua
index 0d70e16314..ab80e18434 100644
--- a/runtime/lua/vim/_meta/misc.lua
+++ b/runtime/lua/vim/_meta/misc.lua
@@ -10,6 +10,7 @@
--- vim.fn[func]({...})
--- ```
---
---- @param func fun()
+--- @param func string
--- @param ... any
+--- @return any
function vim.call(func, ...) end
diff --git a/runtime/lua/vim/_meta/mpack.lua b/runtime/lua/vim/_meta/mpack.lua
index 54e097ad97..3970341b78 100644
--- a/runtime/lua/vim/_meta/mpack.lua
+++ b/runtime/lua/vim/_meta/mpack.lua
@@ -2,14 +2,17 @@
-- luacheck: no unused args
---- @defgroup vim.mpack
+--- @brief
---
--- This module provides encoding and decoding of Lua objects to and
--- from msgpack-encoded strings. Supports |vim.NIL| and |vim.empty_dict()|.
--- Decodes (or "unpacks") the msgpack-encoded {str} to a Lua object.
--- @param str string
+--- @return any
function vim.mpack.decode(str) end
--- Encodes (or "packs") Lua object {obj} as msgpack in a Lua string.
+--- @param obj any
+--- @return string
function vim.mpack.encode(obj) end
diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua
index d2bdab4d28..757720d8fb 100644
--- a/runtime/lua/vim/_meta/options.lua
+++ b/runtime/lua/vim/_meta/options.lua
@@ -137,8 +137,9 @@ vim.bo.ai = vim.bo.autoindent
--- `timestamp`
--- If this option has a local value, use this command to switch back to
--- using the global value:
---- ```
---- :set autoread<
+---
+--- ```vim
+--- set autoread<
--- ```
---
---
@@ -191,25 +192,22 @@ vim.go.awa = vim.go.autowriteall
--- See `:hi-normal` if you want to set the background color explicitly.
--- *g:colors_name*
--- When a color scheme is loaded (the "g:colors_name" variable is set)
---- setting 'background' will cause the color scheme to be reloaded. If
+--- changing 'background' will cause the color scheme to be reloaded. If
--- the color scheme adjusts to the value of 'background' this will work.
--- However, if the color scheme sets 'background' itself the effect may
--- be undone. First delete the "g:colors_name" variable when needed.
---
--- Normally this option would be set in the vimrc file. Possibly
--- depending on the terminal name. Example:
+---
+--- ```vim
+--- if $TERM ==# "xterm"
+--- set background=dark
+--- endif
--- ```
---- :if $TERM ==# "xterm"
---- : set background=dark
---- :endif
---- ```
---- When this option is set, the default settings for the highlight groups
+--- When this option is changed, the default settings for the highlight groups
--- will change. To use other settings, place ":highlight" commands AFTER
--- the setting of the 'background' option.
---- This option is also used in the "$VIMRUNTIME/syntax/syntax.vim" file
---- to select the colors for syntax highlighting. After changing this
---- option, you must load syntax.vim again to see the result. This can be
---- done with ":syntax on".
---
--- @type string
vim.o.background = "dark"
@@ -352,14 +350,16 @@ vim.go.bkc = vim.go.backupcopy
--- - Environment variables are expanded `:set_env`.
--- - Careful with '\' characters, type one before a space, type two to
--- get one in the option (see `option-backslash`), for example:
---- ```
---- :set bdir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces
+---
+--- ```vim
+--- set bdir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces
--- ```
---
--- See also 'backup' and 'writebackup' options.
--- If you want to hide your backup files on Unix, consider this value:
---- ```
---- :set backupdir=./.backup,~/.backup,.,/tmp
+---
+--- ```vim
+--- set backupdir=./.backup,~/.backup,.,/tmp
--- ```
--- You must create a ".backup" directory in each directory and in your
--- home directory for this to work properly.
@@ -385,8 +385,9 @@ vim.go.bdir = vim.go.backupdir
--- If you like to keep a lot of backups, you could use a BufWritePre
--- autocommand to change 'backupext' just before writing the file to
--- include a timestamp.
---- ```
---- :au BufWritePre * let &bex = '-' .. strftime("%Y%b%d%X") .. '~'
+---
+--- ```vim
+--- au BufWritePre * let &bex = '-' .. strftime("%Y%b%d%X") .. '~'
--- ```
--- Use 'backupdir' to put the backup in a different directory.
---
@@ -413,7 +414,7 @@ vim.go.bex = vim.go.backupext
--- $HOME you must expand it explicitly, e.g.:
---
--- ```vim
---- :let &backupskip = escape(expand('$HOME'), '\') .. '/tmp/*'
+--- let &backupskip = escape(expand('$HOME'), '\') .. '/tmp/*'
--- ```
--- Note that the default also makes sure that "crontab -e" works (when a
--- backup would be made by renaming the original file crontab won't see
@@ -714,8 +715,9 @@ vim.go.cdh = vim.go.cdhome
--- If the default value taken from $CDPATH is not what you want, include
--- a modified version of the following command in your vimrc file to
--- override it:
---- ```
---- :let &cdpath = ',' .. substitute(substitute($CDPATH, '[, ]', '\\\0', 'g'), ':', ',', 'g')
+---
+--- ```vim
+--- let &cdpath = ',' .. substitute(substitute($CDPATH, '[, ]', '\\\0', 'g'), ':', ',', 'g')
--- ```
--- This option cannot be set from a `modeline` or in the `sandbox`, for
--- security reasons.
@@ -731,9 +733,10 @@ vim.go.cd = vim.go.cdpath
--- Only non-printable keys are allowed.
--- The key can be specified as a single character, but it is difficult to
--- type. The preferred way is to use the <> notation. Examples:
---- ```
---- :exe "set cedit=\\<C-Y>"
---- :exe "set cedit=\\<Esc>"
+---
+--- ```vim
+--- exe "set cedit=\\<C-Y>"
+--- exe "set cedit=\\<Esc>"
--- ```
--- `Nvi` also has this option, but it only uses the first character.
--- See `cmdwin`.
@@ -767,7 +770,8 @@ vim.bo.channel = vim.o.channel
--- is done internally by Vim, 'charconvert' is not used for this.
--- Also used for Unicode conversion.
--- Example:
---- ```
+---
+--- ```vim
--- set charconvert=CharConvert()
--- fun CharConvert()
--- system("recode "
@@ -833,7 +837,8 @@ vim.bo.cino = vim.bo.cinoptions
--- Keywords that are interpreted as a C++ scope declaration by `cino-g`.
--- Useful e.g. for working with the Qt framework that defines additional
--- scope declarations "signals", "public slots" and "private slots":
---- ```
+---
+--- ```vim
--- set cinscopedecls+=signals,public\ slots,private\ slots
--- ```
---
@@ -920,10 +925,12 @@ vim.go.cwh = vim.go.cmdwinheight
--- text. Will make screen redrawing slower.
--- The screen column can be an absolute number, or a number preceded with
--- '+' or '-', which is added to or subtracted from 'textwidth'.
---- ```
---- :set cc=+1 " highlight column after 'textwidth'
---- :set cc=+1,+2,+3 " highlight three columns after 'textwidth'
---- :hi ColorColumn ctermbg=lightgrey guibg=lightgrey
+---
+--- ```vim
+---
+--- set cc=+1 " highlight column after 'textwidth'
+--- set cc=+1,+2,+3 " highlight three columns after 'textwidth'
+--- hi ColorColumn ctermbg=lightgrey guibg=lightgrey
--- ```
---
--- When 'textwidth' is zero then the items with '-' and '+' are not used.
@@ -945,8 +952,9 @@ vim.wo.cc = vim.wo.colorcolumn
--- the GUI it is always possible and Vim limits the number of columns to
--- what fits on the screen. You can use this command to get the widest
--- window possible:
---- ```
---- :set columns=9999
+---
+--- ```vim
+--- set columns=9999
--- ```
--- Minimum value is 12, maximum value is 10000.
---
@@ -989,8 +997,9 @@ vim.bo.cms = vim.bo.commentstring
--- kspell use the currently active spell checking `spell`
--- k{dict} scan the file {dict}. Several "k" flags can be given,
--- patterns are valid too. For example:
---- ```
---- :set cpt=k/usr/dict/*,k~/spanish
+---
+--- ```vim
+--- set cpt=k/usr/dict/*,k~/spanish
--- ```
--- s scan the files given with the 'thesaurus' option
--- s{tsr} scan the file {tsr}. Several "s" flags can be given, patterns
@@ -1053,14 +1062,18 @@ vim.bo.cfu = vim.bo.completefunc
--- completion in the preview window. Only works in
--- combination with "menu" or "menuone".
---
---- noinsert Do not insert any text for a match until the user selects
+--- noinsert Do not insert any text for a match until the user selects
--- a match from the menu. Only works in combination with
--- "menu" or "menuone". No effect if "longest" is present.
---
---- noselect Do not select a match in the menu, force the user to
+--- noselect Do not select a match in the menu, force the user to
--- select one from the menu. Only works in combination with
--- "menu" or "menuone".
---
+--- popup Show extra information about the currently selected
+--- completion in a popup window. Only works in combination
+--- with "menu" or "menuone". Overrides "preview".
+---
--- @type string
vim.o.completeopt = "menu,preview"
vim.o.cot = vim.o.completeopt
@@ -1283,9 +1296,6 @@ vim.bo.ci = vim.bo.copyindent
--- when it didn't exist when editing it. This is a
--- protection against a file unexpectedly created by
--- someone else. Vi didn't complain about this.
---- *cpo-p*
---- p Vi compatible Lisp indenting. When not present, a
---- slightly better algorithm is used.
--- *cpo-P*
--- P When included, a ":write" command that appends to a
--- file will set the file name for the current buffer, if
@@ -1419,7 +1429,8 @@ vim.wo.crb = vim.wo.cursorbind
--- slower.
--- If you only want the highlighting in the current window you can use
--- these autocommands:
---- ```
+---
+--- ```vim
--- au WinLeave * set nocursorline nocursorcolumn
--- au WinEnter * set cursorline cursorcolumn
--- ```
@@ -1502,7 +1513,8 @@ vim.go.debug = vim.o.debug
--- ```
--- When using the ":set" command, you need to double the backslashes!
--- To avoid that use `:let` with a single quote string:
---- ```
+---
+--- ```vim
--- let &l:define = '^\s*\ze\k\+\s*=\s*function('
--- ```
---
@@ -1681,11 +1693,12 @@ vim.go.dex = vim.go.diffexpr
--- histogram histogram diff algorithm
---
--- Examples:
---- ```
---- :set diffopt=internal,filler,context:4
---- :set diffopt=
---- :set diffopt=internal,filler,foldcolumn:3
---- :set diffopt-=internal " do NOT use the internal diff parser
+---
+--- ```vim
+--- set diffopt=internal,filler,context:4
+--- set diffopt=
+--- set diffopt=internal,filler,foldcolumn:3
+--- set diffopt-=internal " do NOT use the internal diff parser
--- ```
---
---
@@ -1736,8 +1749,9 @@ vim.go.dg = vim.go.digraph
--- - Environment variables are expanded `:set_env`.
--- - Careful with '\' characters, type one before a space, type two to
--- get one in the option (see `option-backslash`), for example:
---- ```
---- :set dir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces
+---
+--- ```vim
+--- set dir=c:\\tmp,\ dir\\,with\\,commas,\\\ dir\ with\ spaces
--- ```
---
--- Editing the same file twice will result in a warning. Using "/tmp" on
@@ -1924,8 +1938,9 @@ vim.go.efm = vim.go.errorformat
--- When set to "all" or when "all" is one of the items, all autocommand
--- events are ignored, autocommands will not be executed.
--- Otherwise this is a comma-separated list of event names. Example:
---- ```
---- :set ei=WinEnter,WinLeave
+---
+--- ```vim
+--- set ei=WinEnter,WinLeave
--- ```
---
---
@@ -2021,7 +2036,8 @@ vim.bo.fenc = vim.bo.fileencoding
--- "ucs-bom", which requires the BOM to be present). If you prefer
--- another encoding use an BufReadPost autocommand event to test if your
--- preferred encoding is to be used. Example:
---- ```
+---
+--- ```vim
--- au BufReadPost * if search('\S', 'w') == 0 |
--- \ set fenc=iso-2022-jp | endif
--- ```
@@ -2031,8 +2047,9 @@ vim.bo.fenc = vim.bo.fileencoding
--- not used.
--- Note that 'fileencodings' is not used for a new file, the global value
--- of 'fileencoding' is used instead. You can set it with:
---- ```
---- :setglobal fenc=iso-8859-2
+---
+--- ```vim
+--- setglobal fenc=iso-8859-2
--- ```
--- This means that a non-existing file may get a different encoding than
--- an empty file.
@@ -2156,14 +2173,12 @@ vim.go.fic = vim.go.fileignorecase
--- this use the ":filetype on" command. `:filetype`
--- Setting this option to a different value is most useful in a modeline,
--- for a file for which the file type is not automatically recognized.
---- Example, for in an IDL file:
---- ```
+--- Example, for in an IDL file: >c
--- /* vim: set filetype=idl : */
--- ```
--- `FileType` `filetypes`
--- When a dot appears in the value then this separates two filetype
---- names. Example:
---- ```
+--- names. Example: >c
--- /* vim: set filetype=c.doxygen : */
--- ```
--- This will use the "c" filetype first, then the "doxygen" filetype.
@@ -2182,7 +2197,7 @@ vim.bo.ft = vim.bo.filetype
--- Characters to fill the statuslines, vertical separators and special
--- lines in the window.
--- It is a comma-separated list of items. Each item has a name, a colon
---- and the value of that item:
+--- and the value of that item: `E1511`
---
--- item default Used for ~
--- stl ' ' statusline of the current window
@@ -2216,13 +2231,14 @@ vim.bo.ft = vim.bo.filetype
--- default to single-byte alternatives.
---
--- Example:
---- ```
---- :set fillchars=stl:\ ,stlnc:\ ,vert:│,fold:·,diff:-
+---
+--- ```vim
+--- set fillchars=stl:\ ,stlnc:\ ,vert:│,fold:·,diff:-
--- ```
---
--- For the "stl", "stlnc", "foldopen", "foldclose" and "foldsep" items
--- single-byte and multibyte characters are supported. But double-width
---- characters are not supported.
+--- characters are not supported. `E1512`
---
--- The highlighting used for these items:
--- item highlight group ~
@@ -2457,6 +2473,9 @@ vim.go.fdo = vim.go.foldopen
--- It is not allowed to change text or jump to another window while
--- evaluating 'foldtext' `textlock`.
---
+--- When set to an empty string, foldtext is disabled, and the line
+--- is displayed normally with highlighting and no line wrapping.
+---
--- @type string
vim.o.foldtext = "foldtext()"
vim.o.fdt = vim.o.foldtext
@@ -2475,8 +2494,9 @@ vim.wo.fdt = vim.wo.foldtext
--- it yet!
---
--- Example:
---- ```
---- :set formatexpr=mylang#Format()
+---
+--- ```vim
+--- set formatexpr=mylang#Format()
--- ```
--- This will invoke the mylang#Format() function in the
--- autoload/mylang.vim file in 'runtimepath'. `autoload`
@@ -2492,7 +2512,8 @@ vim.wo.fdt = vim.wo.foldtext
---
--- If the expression starts with s: or `<SID>`, then it is replaced with
--- the script ID (`local-function`). Example:
---- ```
+---
+--- ```vim
--- set formatexpr=s:MyFormatExpr()
--- set formatexpr=<SID>SomeFormatExpr()
--- ```
@@ -2591,9 +2612,9 @@ vim.go.fs = vim.go.fsync
--- :s///g subst. one subst. all
--- :s///gg subst. all subst. one
---
---- DEPRECATED: Setting this option may break plugins that are not aware
---- of this option. Also, many users get confused that adding the /g flag
---- has the opposite effect of that it normally does.
+--- NOTE: Setting this option may break plugins that rely on the default
+--- behavior of the 'g' flag. This will also make the 'g' flag have the
+--- opposite effect of that documented in `:s_g`.
---
--- @type boolean
vim.o.gdefault = false
@@ -2618,8 +2639,9 @@ vim.go.gfm = vim.go.grepformat
--- `option-backslash` about including spaces and backslashes.
--- When your "grep" accepts the "-H" argument, use this to make ":grep"
--- also work well with a single file:
---- ```
---- :set grepprg=grep\ -nH
+---
+--- ```vim
+--- set grepprg=grep\ -nH
--- ```
--- Special value: When 'grepprg' is set to "internal" the `:grep` command
--- works like `:vimgrep`, `:lgrep` like `:lvimgrep`, `:grepadd` like
@@ -2641,12 +2663,14 @@ vim.go.gp = vim.go.grepprg
--- terminals. See `tui-cursor-shape`.
---
--- To disable cursor-styling, reset the option:
---- ```
---- :set guicursor=
+---
+--- ```vim
+--- set guicursor=
--- ```
--- To enable mode shapes, "Cursor" highlight, and blinking:
---- ```
---- :set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50
+---
+--- ```vim
+--- set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50
--- \,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor
--- \,sm:block-blinkwait175-blinkoff150-blinkon175
--- ```
@@ -2680,8 +2704,9 @@ vim.go.gp = vim.go.grepprg
--- the cursor is shown and blinkoff is the time that the
--- cursor is not shown. Times are in msec. When one of
--- the numbers is zero, there is no blinking. E.g.:
---- ```
---- :set guicursor=n:blinkon0
+---
+--- ```vim
+--- set guicursor=n:blinkon0
--- ```
--- - Default is "blinkon0" for each mode.
--- {group-name}
@@ -2721,9 +2746,10 @@ vim.go.gp = vim.go.grepprg
--- blinking: "a:blinkon0"
---
--- Examples of cursor highlighting:
---- ```
---- :highlight Cursor gui=reverse guifg=NONE guibg=NONE
---- :highlight Cursor gui=NONE guifg=bg guibg=fg
+---
+--- ```vim
+--- highlight Cursor gui=reverse guifg=NONE guibg=NONE
+--- highlight Cursor gui=NONE guifg=bg guibg=fg
--- ```
---
---
@@ -2743,8 +2769,9 @@ vim.go.gcr = vim.go.guicursor
--- precede it with a backslash. Setting an option requires an extra
--- backslash before a space and a backslash. See also
--- `option-backslash`. For example:
---- ```
---- :set guifont=Screen15,\ 7x13,font\\,with\\,commas
+---
+--- ```vim
+--- set guifont=Screen15,\ 7x13,font\\,with\\,commas
--- ```
--- will make Vim try to use the font "Screen15" first, and if it fails it
--- will try to use "7x13" and then "font,with,commas" instead.
@@ -2757,16 +2784,18 @@ vim.go.gcr = vim.go.guicursor
--- will try to find the related bold and italic fonts.
---
--- For Win32 and Mac OS:
---- ```
---- :set guifont=*
+---
+--- ```vim
+--- set guifont=*
--- ```
--- will bring up a font requester, where you can pick the font you want.
---
--- The font name depends on the GUI used.
---
--- For Mac OSX you can use something like this:
---- ```
---- :set guifont=Monaco:h10
+---
+--- ```vim
+--- set guifont=Monaco:h10
--- ```
--- *E236*
--- Note that the fonts must be mono-spaced (all characters have the same
@@ -2793,9 +2822,10 @@ vim.go.gcr = vim.go.guicursor
--- - A '_' can be used in the place of a space, so you don't need to use
--- backslashes to escape the spaces.
--- - Examples:
---- ```
---- :set guifont=courier_new:h12:w5:b:cRUSSIAN
---- :set guifont=Andale_Mono:h7.5:w4.5
+---
+--- ```vim
+--- set guifont=courier_new:h12:w5:b:cRUSSIAN
+--- set guifont=Andale_Mono:h7.5:w4.5
--- ```
---
---
@@ -2949,8 +2979,9 @@ vim.go.gtl = vim.go.guitablabel
--- pages line. When empty Vim will use a default tooltip.
--- This option is otherwise just like 'guitablabel' above.
--- You can include a line break. Simplest method is to use `:let`:
---- ```
---- :let &guitabtooltip = "line one\nline two"
+---
+--- ```vim
+--- let &guitabtooltip = "line one\nline two"
--- ```
---
---
@@ -2994,8 +3025,9 @@ vim.go.hh = vim.go.helpheight
--- another language, but that will only find tags that exist in that
--- language and not in the English help.
--- Example:
---- ```
---- :set helplang=de,it
+---
+--- ```vim
+--- set helplang=de,it
--- ```
--- This will first search German, then Italian and finally English help
--- files.
@@ -3131,8 +3163,9 @@ vim.go.imd = vim.go.imdisable
--- 2 :lmap is off and IM is ON
--- To always reset the option to zero when leaving Insert mode with <Esc>
--- this can be used:
---- ```
---- :inoremap <ESC> <ESC>:set iminsert=0<CR>
+---
+--- ```vim
+--- inoremap <ESC> <ESC>:set iminsert=0<CR>
--- ```
--- This makes :lmap and IM turn off automatically when leaving Insert
--- mode.
@@ -3206,15 +3239,17 @@ vim.go.inc = vim.go.include
--- Expression to be used to transform the string found with the 'include'
--- option to a file name. Mostly useful to change "." to "/" for Java:
---- ```
---- :setlocal includeexpr=substitute(v:fname,'\\.','/','g')
+---
+--- ```vim
+--- setlocal includeexpr=substitute(v:fname,'\\.','/','g')
--- ```
--- The "v:fname" variable will be set to the file name that was detected.
--- Note the double backslash: the `:set` command first halves them, then
--- one remains in the value, where "\." matches a dot literally. For
--- simple character replacements `tr()` avoids the need for escaping:
---- ```
---- :setlocal includeexpr=tr(v:fname,'.','/')
+---
+--- ```vim
+--- setlocal includeexpr=tr(v:fname,'.','/')
--- ```
---
--- Also used for the `gf` command if an unmodified file name can't be
@@ -3223,7 +3258,8 @@ vim.go.inc = vim.go.include
---
--- If the expression starts with s: or `<SID>`, then it is replaced with
--- the script ID (`local-function`). Example:
---- ```
+---
+--- ```vim
--- setlocal includeexpr=s:MyIncludeExpr(v:fname)
--- setlocal includeexpr=<SID>SomeIncludeExpr(v:fname)
--- ```
@@ -3262,7 +3298,8 @@ vim.bo.inex = vim.bo.includeexpr
--- If you don't want to turn 'hlsearch' on, but want to highlight all
--- matches while searching, you can turn on and off 'hlsearch' with
--- autocmd. Example:
---- ```
+---
+--- ```vim
--- augroup vimrc-incsearch-highlight
--- autocmd!
--- autocmd CmdlineEnter /,\? :set hlsearch
@@ -3295,7 +3332,8 @@ vim.go.is = vim.go.incsearch
---
--- If the expression starts with s: or `<SID>`, then it is replaced with
--- the script ID (`local-function`). Example:
---- ```
+---
+--- ```vim
--- set indentexpr=s:MyIndentExpr()
--- set indentexpr=<SID>SomeIndentExpr()
--- ```
@@ -3311,8 +3349,9 @@ vim.go.is = vim.go.incsearch
--- not change the text, jump to another window, etc. Afterwards the
--- cursor position is always restored, thus the cursor may be moved.
--- Normally this option would be set to call a function:
---- ```
---- :set indentexpr=GetMyIndent()
+---
+--- ```vim
+--- set indentexpr=GetMyIndent()
--- ```
--- Error messages will be suppressed, unless the 'debug' option contains
--- "msg".
@@ -3540,9 +3579,10 @@ vim.go.km = vim.go.keymodel
--- a [count] for the "K" command to a section number.
--- See `option-backslash` about including spaces and backslashes.
--- Example:
---- ```
---- :set keywordprg=man\ -s
---- :set keywordprg=:Man
+---
+--- ```vim
+--- set keywordprg=man\ -s
+--- set keywordprg=:Man
--- ```
--- This option cannot be set from a `modeline` or in the `sandbox`, for
--- security reasons.
@@ -3569,12 +3609,14 @@ vim.go.kp = vim.go.keywordprg
--- security reasons.
---
--- Example (for Greek, in UTF-8): *greek*
---- ```
---- :set langmap=ΑA,ΒB,ΚC,ΔD,ΕE,ΊF,ΓG,ΗH,ΙI,ΞJ,ΚK,ΛL,ΜM,ΝN,ΟO,ΠP,QQ,ΡR,ΣS,΀T,ΘU,ΩV,WW,ΧX,Î¥Y,ΖZ,αa,βb,ψc,ÎŽd,εe,φf,γg,ηh,ιi,Οj,κk,λl,ÎŒm,Μn,οo,πp,qq,ρr,σs,τt,Ξu,ωv,ςw,χx,υy,ζz
+---
+--- ```vim
+--- set langmap=ΑA,ΒB,ΚC,ΔD,ΕE,ΊF,ΓG,ΗH,ΙI,ΞJ,ΚK,ΛL,ΜM,ΝN,ΟO,ΠP,QQ,ΡR,ΣS,΀T,ΘU,ΩV,WW,ΧX,Î¥Y,ΖZ,αa,βb,ψc,ÎŽd,εe,φf,γg,ηh,ιi,Οj,κk,λl,ÎŒm,Μn,οo,πp,qq,ρr,σs,τt,Ξu,ωv,ςw,χx,υy,ζz
--- ```
--- Example (exchanges meaning of z and y for commands):
---- ```
---- :set langmap=zy,yz,ZY,YZ
+---
+--- ```vim
+--- set langmap=zy,yz,ZY,YZ
--- ```
---
--- The 'langmap' option is a list of parts, separated with commas. Each
@@ -3607,28 +3649,32 @@ vim.go.lmap = vim.go.langmap
--- Language to use for menu translation. Tells which file is loaded
--- from the "lang" directory in 'runtimepath':
---- ```
+---
+--- ```vim
--- "lang/menu_" .. &langmenu .. ".vim"
--- ```
--- (without the spaces). For example, to always use the Dutch menus, no
--- matter what $LANG is set to:
---- ```
---- :set langmenu=nl_NL.ISO_8859-1
+---
+--- ```vim
+--- set langmenu=nl_NL.ISO_8859-1
--- ```
--- When 'langmenu' is empty, `v:lang` is used.
--- Only normal file name characters can be used, `/\*?[|<>` are illegal.
--- If your $LANG is set to a non-English language but you do want to use
--- the English menus:
---- ```
---- :set langmenu=none
+---
+--- ```vim
+--- set langmenu=none
--- ```
--- This option must be set before loading menus, switching on filetype
--- detection or syntax highlighting. Once the menus are defined setting
--- this option has no effect. But you could do this:
---- ```
---- :source $VIMRUNTIME/delmenu.vim
---- :set langmenu=de_DE.ISO_8859-1
---- :source $VIMRUNTIME/menu.vim
+---
+--- ```vim
+--- source $VIMRUNTIME/delmenu.vim
+--- set langmenu=de_DE.ISO_8859-1
+--- source $VIMRUNTIME/menu.vim
--- ```
--- Warning: This deletes all menus that you defined yourself!
---
@@ -3701,8 +3747,9 @@ vim.wo.lbr = vim.wo.linebreak
--- to use the size for the GUI, put the command in your `gvimrc` file.
--- Vim limits the number of lines to what fits on the screen. You can
--- use this command to get the tallest window possible:
---- ```
---- :set lines=999
+---
+--- ```vim
+--- set lines=999
--- ```
--- Minimum value is 2, maximum value is 1000.
---
@@ -3771,8 +3818,9 @@ vim.go.lw = vim.go.lispwords
--- The cursor is displayed at the start of the space a Tab character
--- occupies, not at the end as usual in Normal mode. To get this cursor
--- position while displaying Tabs with spaces, use:
---- ```
---- :set list lcs=tab:\ \
+---
+--- ```vim
+--- set list lcs=tab:\ \
--- ```
---
--- Note that list mode will also affect formatting (set with 'textwidth'
@@ -3784,7 +3832,7 @@ vim.o.list = false
vim.wo.list = vim.o.list
--- Strings to use in 'list' mode and for the `:list` command. It is a
---- comma-separated list of string settings.
+--- comma-separated list of string settings. *E1511*
---
--- *lcs-eol*
--- eol:c Character to show at the end of each line. When
@@ -3837,8 +3885,9 @@ vim.wo.list = vim.o.list
--- leading spaces are blank. Overrides the "space" and
--- "multispace" settings for leading spaces. You can
--- combine it with "tab:", for example:
---- ```
---- :set listchars+=tab:>-,lead:.
+---
+--- ```vim
+--- set listchars+=tab:>-,lead:.
--- ```
---
--- *lcs-leadmultispace*
@@ -3875,10 +3924,11 @@ vim.wo.list = vim.o.list
--- omitted.
---
--- The characters ':' and ',' should not be used. UTF-8 characters can
---- be used. All characters must be single width.
+--- be used. All characters must be single width. *E1512*
---
--- Each character can be specified as hex:
---- ```
+---
+--- ```vim
--- set listchars=eol:\\x24
--- set listchars=eol:\\u21b5
--- set listchars=eol:\\U000021b5
@@ -3887,10 +3937,11 @@ vim.wo.list = vim.o.list
--- must be exactly 2 for \\x, 4 for \\u and 8 for \\U.
---
--- Examples:
---- ```
---- :set lcs=tab:>-,trail:-
---- :set lcs=tab:>-,eol:<,nbsp:%
---- :set lcs=extends:>,precedes:<
+---
+--- ```vim
+--- set lcs=tab:>-,trail:-
+--- set lcs=tab:>-,eol:<,nbsp:%
+--- set lcs=extends:>,precedes:<
--- ```
--- `hl-NonText` highlighting will be used for "eol", "extends" and
--- "precedes". `hl-Whitespace` for "nbsp", "space", "tab", "multispace",
@@ -3955,8 +4006,9 @@ vim.go.mef = vim.go.makeef
--- This would be mostly useful when you use MS-Windows. If iconv is
--- enabled, setting 'makeencoding' to "char" has the same effect as
--- setting to the system locale encoding. Example:
---- ```
---- :set makeencoding=char " system locale is used
+---
+--- ```vim
+--- set makeencoding=char " system locale is used
--- ```
---
---
@@ -3977,13 +4029,15 @@ vim.go.menc = vim.go.makeencoding
--- Note that a '|' must be escaped twice: once for ":set" and once for
--- the interpretation of a command. When you use a filter called
--- "myfilter" do it like this:
---- ```
---- :set makeprg=gmake\ \\\|\ myfilter
+---
+--- ```vim
+--- set makeprg=gmake\ \\\|\ myfilter
--- ```
--- The placeholder "$*" can be given (even multiple times) to specify
--- where the arguments will be included, for example:
---- ```
---- :set makeprg=latex\ \\\\nonstopmode\ \\\\input\\{$*}
+---
+--- ```vim
+--- set makeprg=latex\ \\\\nonstopmode\ \\\\input\\{$*}
--- ```
--- This option cannot be set from a `modeline` or in the `sandbox`, for
--- security reasons.
@@ -4003,13 +4057,15 @@ vim.go.mp = vim.go.makeprg
--- The characters must be separated by a colon.
--- The pairs must be separated by a comma. Example for including '<' and
--- '>' (for HTML):
---- ```
---- :set mps+=<:>
+---
+--- ```vim
+--- set mps+=<:>
--- ```
--- A more exotic example, to jump between the '=' and ';' in an
--- assignment, useful for languages like C and Java:
---- ```
---- :au FileType c,cpp,java set mps+==:;
+---
+--- ```vim
+--- au FileType c,cpp,java set mps+==:;
--- ```
--- For a more advanced way of using "%", see the matchit.vim plugin in
--- the $VIMRUNTIME/plugin directory. `add-local-help`
@@ -4037,6 +4093,7 @@ vim.go.mat = vim.go.matchtime
--- Increasing this limit above 200 also changes the maximum for Ex
--- command recursion, see `E169`.
--- See also `:function`.
+--- Also used for maximum depth of callback functions.
---
--- @type integer
vim.o.maxfuncdepth = 100
@@ -4116,8 +4173,9 @@ vim.go.mis = vim.go.menuitems
--- The languages for which these numbers are important are Italian and
--- Hungarian. The default works for when you have about 512 Mbyte. If
--- you have 1 Gbyte you could use:
---- ```
---- :set mkspellmem=900000,3000,800
+---
+--- ```vim
+--- set mkspellmem=900000,3000,800
--- ```
--- If you have less than 512 Mbyte `:mkspell` may fail for some
--- languages, no matter what you set 'mkspellmem' to.
@@ -4212,8 +4270,9 @@ vim.go.more = vim.o.more
--- Enables mouse support. For example, to enable the mouse in Normal mode
--- and Visual mode:
---- ```
---- :set mouse=nv
+---
+--- ```vim
+--- set mouse=nv
--- ```
---
--- To temporarily disable mouse support, hold the shift key while using
@@ -4305,19 +4364,20 @@ vim.go.mh = vim.go.mousehide
--- See `mouse-overview`. But mappings are NOT used for modeless selection.
---
--- Example:
---- ```
---- :map <S-LeftMouse> <RightMouse>
---- :map <S-LeftDrag> <RightDrag>
---- :map <S-LeftRelease> <RightRelease>
---- :map <2-S-LeftMouse> <2-RightMouse>
---- :map <2-S-LeftDrag> <2-RightDrag>
---- :map <2-S-LeftRelease> <2-RightRelease>
---- :map <3-S-LeftMouse> <3-RightMouse>
---- :map <3-S-LeftDrag> <3-RightDrag>
---- :map <3-S-LeftRelease> <3-RightRelease>
---- :map <4-S-LeftMouse> <4-RightMouse>
---- :map <4-S-LeftDrag> <4-RightDrag>
---- :map <4-S-LeftRelease> <4-RightRelease>
+---
+--- ```vim
+--- map <S-LeftMouse> <RightMouse>
+--- map <S-LeftDrag> <RightDrag>
+--- map <S-LeftRelease> <RightRelease>
+--- map <2-S-LeftMouse> <2-RightMouse>
+--- map <2-S-LeftDrag> <2-RightDrag>
+--- map <2-S-LeftRelease> <2-RightRelease>
+--- map <3-S-LeftMouse> <3-RightMouse>
+--- map <3-S-LeftDrag> <3-RightDrag>
+--- map <3-S-LeftRelease> <3-RightRelease>
+--- map <4-S-LeftMouse> <4-RightMouse>
+--- map <4-S-LeftDrag> <4-RightDrag>
+--- map <4-S-LeftRelease> <4-RightRelease>
--- ```
---
--- Mouse commands requiring the CTRL modifier can be simulated by typing
@@ -4357,8 +4417,9 @@ vim.go.mousemev = vim.go.mousemoveevent
--- a count of 0.
---
--- Example:
---- ```
---- :set mousescroll=ver:5,hor:2
+---
+--- ```vim
+--- set mousescroll=ver:5,hor:2
--- ```
--- Will make Nvim scroll 5 lines at a time when scrolling vertically, and
--- scroll 2 columns at a time when scrolling horizontally.
@@ -4421,8 +4482,9 @@ vim.go.mousescroll = vim.o.mousescroll
--- pointer.
---
--- Example:
---- ```
---- :set mouseshape=s:udsizing,m:no
+---
+--- ```vim
+--- set mouseshape=s:udsizing,m:no
--- ```
--- will make the mouse turn to a sizing arrow over the status lines and
--- indicate no input when the hit-enter prompt is displayed (since
@@ -4626,28 +4688,33 @@ vim.go.pm = vim.go.patchmode
--- starting with "/", "./" or "../"). The directories in the 'path'
--- option may be relative or absolute.
--- - Use commas to separate directory names:
---- ```
---- :set path=.,/usr/local/include,/usr/include
+---
+--- ```vim
+--- set path=.,/usr/local/include,/usr/include
--- ```
--- - Spaces can also be used to separate directory names. To have a
--- space in a directory name, precede it with an extra backslash, and
--- escape the space:
---- ```
---- :set path=.,/dir/with\\\ space
+---
+--- ```vim
+--- set path=.,/dir/with\\\ space
--- ```
--- - To include a comma in a directory name precede it with an extra
--- backslash:
---- ```
---- :set path=.,/dir/with\\,comma
+---
+--- ```vim
+--- set path=.,/dir/with\\,comma
--- ```
--- - To search relative to the directory of the current file, use:
---- ```
---- :set path=.
+---
+--- ```vim
+--- set path=.
--- ```
--- - To search in the current directory use an empty string between two
--- commas:
---- ```
---- :set path=,,
+---
+--- ```vim
+--- set path=,,
--- ```
--- - A directory name may end in a ':' or '/'.
--- - Environment variables are expanded `:set_env`.
@@ -4656,12 +4723,14 @@ vim.go.pm = vim.go.patchmode
--- - Search upwards and downwards in a directory tree using "*", "**" and
--- ";". See `file-searching` for info and syntax.
--- - Careful with '\' characters, type two to get one in the option:
---- ```
---- :set path=.,c:\\include
+---
+--- ```vim
+--- set path=.,c:\\include
--- ```
--- Or just use '/' instead:
---- ```
---- :set path=.,c:/include
+---
+--- ```vim
+--- set path=.,c:/include
--- ```
--- Don't forget "." or files won't even be found in the same directory as
--- the file!
@@ -4672,18 +4741,21 @@ vim.go.pm = vim.go.patchmode
--- The use of `:set+=` and `:set-=` is preferred when adding or removing
--- directories from the list. This avoids problems when a future version
--- uses another default. To remove the current directory use:
---- ```
---- :set path-=
+---
+--- ```vim
+--- set path-=
--- ```
--- To add the current directory use:
---- ```
---- :set path+=
+---
+--- ```vim
+--- set path+=
--- ```
--- To use an environment variable, you probably need to replace the
--- separator. Here is an example to append $INCL, in which directory
--- names are separated with a semi-colon:
---- ```
---- :let &path = &path .. "," .. substitute($INCL, ';', ',', 'g')
+---
+--- ```vim
+--- let &path = &path .. "," .. substitute($INCL, ';', ',', 'g')
--- ```
--- Replace the ';' with a ':' or whatever separator is used. Note that
--- this doesn't work when $INCL contains a comma or white space.
@@ -4741,9 +4813,11 @@ vim.wo.pvw = vim.wo.previewwindow
--- It is possible to override the level for individual highlights within
--- the popupmenu using `highlight-blend`. For instance, to enable
--- transparency but force the current selected element to be fully opaque:
---- ```
---- :set pumblend=15
---- :hi PmenuSel blend=0
+---
+--- ```vim
+---
+--- set pumblend=15
+--- hi PmenuSel blend=0
--- ```
---
--- UI-dependent. Works best with RGB colors. 'termguicolors'
@@ -5014,8 +5088,9 @@ vim.go.ru = vim.go.ruler
--- The default ruler width is 17 characters. To make the ruler 15
--- characters wide, put "%15(" at the start and "%)" at the end.
--- Example:
---- ```
---- :set rulerformat=%15(%c%V\ %p%%%)
+---
+--- ```vim
+--- set rulerformat=%15(%c%V\ %p%%%)
--- ```
---
---
@@ -5082,8 +5157,9 @@ vim.go.ruf = vim.go.rulerformat
--- wildcards.
--- See `:runtime`.
--- Example:
---- ```
---- :set runtimepath=~/vimruntime,/mygroup/vim,$VIMRUNTIME
+---
+--- ```vim
+--- set runtimepath=~/vimruntime,/mygroup/vim,$VIMRUNTIME
--- ```
--- This will use the directory "~/vimruntime" first (containing your
--- personal Nvim runtime files), then "/mygroup/vim", and finally
@@ -5164,7 +5240,8 @@ vim.go.sj = vim.go.scrolljump
--- when long lines wrap).
--- After using the local value, go back the global value with one of
--- these two:
---- ```
+---
+--- ```vim
--- setlocal scrolloff<
--- setlocal scrolloff=-1
--- ```
@@ -5393,8 +5470,9 @@ vim.go.ssop = vim.go.sessionoptions
--- contents size) = 10253 bytes.
---
--- Example:
---- ```
---- :set shada='50,<1000,s100,:0,n~/nvim/shada
+---
+--- ```vim
+--- set shada='50,<1000,s100,:0,n~/nvim/shada
--- ```
---
--- '50 Marks will be remembered for the last 50 files you
@@ -5445,14 +5523,16 @@ vim.go.sdf = vim.go.shadafile
---
--- If the name of the shell contains a space, you need to enclose it in
--- quotes. Example with quotes:
---- ```
---- :set shell=\"c:\program\ files\unix\sh.exe\"\ -f
+---
+--- ```vim
+--- set shell=\"c:\program\ files\unix\sh.exe\"\ -f
--- ```
--- Note the backslash before each quote (to avoid starting a comment) and
--- each space (to avoid ending the option value), so better use `:let-&`
--- like this:
---- ```
---- :let &shell='"C:\Program Files\unix\sh.exe" -f'
+---
+--- ```vim
+--- let &shell='"C:\Program Files\unix\sh.exe" -f'
--- ```
--- Also note that the "-f" is not inside the quotes, because it is not
--- part of the command name.
@@ -5477,7 +5557,8 @@ vim.go.sdf = vim.go.shadafile
--- unescaping, so to keep yourself sane use `:let-&` like shown above.
--- *shell-powershell*
--- To use PowerShell:
---- ```
+---
+--- ```vim
--- let &shell = executable('pwsh') ? 'pwsh' : 'powershell'
--- let &shellcmdflag = '-NoLogo -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues[''Out-File:Encoding'']=''utf8'';Remove-Alias -Force -ErrorAction SilentlyContinue tee;'
--- let &shellredir = '2>&1 | %%{ "$_" } | Out-File %s; exit $LastExitCode'
@@ -5602,7 +5683,8 @@ vim.go.srr = vim.go.shellredir
--- any file for best results. This might change in the future.
--- 'shellslash' only works when a backslash can be used as a path
--- separator. To test if this is so use:
---- ```
+---
+--- ```vim
--- if exists('+shellslash')
--- ```
--- Also see 'completeslash'.
@@ -5715,9 +5797,10 @@ vim.bo.sw = vim.bo.shiftwidth
--- match", "Pattern not found", "Back at original", etc.
--- C don't give messages while scanning for ins-completion *shm-C*
--- items, for instance "scanning tags"
---- q use "recording" instead of "recording @a" *shm-q*
+--- q do not show "recording @a" when recording a macro *shm-q*
--- F don't give the file info when editing a file, like *shm-F*
---- `:silent` was used for the command
+--- `:silent` was used for the command; note that this also
+--- affects messages from 'autoread' reloading
--- S do not show search count message when searching, e.g. *shm-S*
--- "[1/5]"
---
@@ -5738,9 +5821,10 @@ vim.go.shm = vim.go.shortmess
--- String to put at the start of lines that have been wrapped. Useful
--- values are "> " or "+++ ":
---- ```
---- :let &showbreak = "> "
---- :let &showbreak = '+++ '
+---
+--- ```vim
+--- let &showbreak = "> "
+--- let &showbreak = '+++ '
--- ```
--- Only printable single-cell characters are allowed, excluding <Tab> and
--- comma (in a future version the comma might be used to separate the
@@ -5751,8 +5835,9 @@ vim.go.shm = vim.go.shortmess
--- "n" flag to 'cpoptions'.
--- A window-local value overrules a global value. If the global value is
--- set and you want no value in the current window use NONE:
---- ```
---- :setlocal showbreak=NONE
+---
+--- ```vim
+--- setlocal showbreak=NONE
--- ```
---
---
@@ -5884,7 +5969,8 @@ vim.go.ss = vim.go.sidescroll
--- close to the beginning of the line.
--- After using the local value, go back the global value with one of
--- these two:
---- ```
+---
+--- ```vim
--- setlocal sidescrolloff<
--- setlocal sidescrolloff=-1
--- ```
@@ -5892,9 +5978,11 @@ vim.go.ss = vim.go.sidescroll
--- Example: Try this together with 'sidescroll' and 'listchars' as
--- in the following example to never allow the cursor to move
--- onto the "extends" character:
---- ```
---- :set nowrap sidescroll=1 listchars=extends:>,precedes:<
---- :set sidescrolloff=1
+---
+--- ```vim
+---
+--- set nowrap sidescroll=1 listchars=extends:>,precedes:<
+--- set sidescrolloff=1
--- ```
---
---
@@ -6048,7 +6136,7 @@ vim.bo.spc = vim.bo.spellcapcheck
--- Name of the word list file where words are added for the `zg` and `zw`
--- commands. It must end in ".{encoding}.add". You need to include the
--- path, otherwise the file is placed in the current directory.
---- The path may include characters from 'isfname', space, comma and '@'.
+--- The path may include characters from 'isfname', ' ', ',', '@' and ':'.
--- *E765*
--- It may also be a comma-separated list of names. A count before the
--- `zg` and `zw` commands can be used to access each. This allows using
@@ -6075,7 +6163,8 @@ vim.bo.spf = vim.bo.spellfile
--- A comma-separated list of word list names. When the 'spell' option is
--- on spellchecking will be done for these languages. Example:
---- ```
+---
+--- ```vim
--- set spelllang=en_us,nl,medical
--- ```
--- This means US English, Dutch and medical words are recognized. Words
@@ -6193,8 +6282,9 @@ vim.bo.spo = vim.bo.spelloptions
---
--- Only one of "best", "double" or "fast" may be used. The others may
--- appear several times in any order. Example:
---- ```
---- :set sps=file:~/.config/nvim/sugg,best,expr:MySuggest()
+---
+--- ```vim
+--- set sps=file:~/.config/nvim/sugg,best,expr:MySuggest()
--- ```
---
--- This option cannot be set from a `modeline` or in the `sandbox`, for
@@ -6273,9 +6363,13 @@ vim.go.sol = vim.go.startofline
--- %s sign column for currently drawn line
--- %C fold column for currently drawn line
---
---- NOTE: To draw the sign and fold columns, their items must be included in
---- 'statuscolumn'. Even when they are not included, the status column width
---- will adapt to the 'signcolumn' and 'foldcolumn' width.
+--- The 'statuscolumn' width follows that of the default columns and
+--- adapts to the `'numberwidth'`, `'signcolumn'` and `'foldcolumn'` option
+--- values (regardless of whether the sign and fold items are present).
+--- Additionally, the 'statuscolumn' grows with the size of the evaluated
+--- format string, up to a point (following the maximum size of the default
+--- fold, sign and number columns). Shrinking only happens when the number
+--- of lines in a buffer changes, or the 'statuscolumn' option is set.
---
--- The `v:lnum` variable holds the line number to be drawn.
--- The `v:relnum` variable holds the relative line number to be drawn.
@@ -6283,6 +6377,9 @@ vim.go.sol = vim.go.startofline
--- when drawing the actual buffer line, and positive when
--- drawing the wrapped part of a buffer line.
---
+--- When using `v:relnum`, keep in mind that cursor movement by itself will
+--- not cause the 'statuscolumn' to update unless `'relativenumber'` is set.
+---
--- NOTE: The %@ click execute function item is supported as well but the
--- specified function will be the same for each row in the same column.
--- It cannot be switched out through a dynamic 'statuscolumn' format, the
@@ -6292,21 +6389,21 @@ vim.go.sol = vim.go.startofline
---
--- ```vim
--- " Relative number with bar separator and click handlers:
---- :set statuscolumn=%@SignCb@%s%=%T%@NumCb@%r│%T
+--- set statuscolumn=%@SignCb@%s%=%T%@NumCb@%r│%T
---
--- " Right aligned relative cursor line number:
---- :let &stc='%=%{v:relnum?v:relnum:v:lnum} '
+--- let &stc='%=%{v:relnum?v:relnum:v:lnum} '
---
--- " Line numbers in hexadecimal for non wrapped part of lines:
---- :let &stc='%=%{v:virtnum>0?"":printf("%x",v:lnum)} '
+--- let &stc='%=%{v:virtnum>0?"":printf("%x",v:lnum)} '
---
--- " Human readable line numbers with thousands separator:
---- :let &stc='%{substitute(v:lnum,"\\d\\zs\\ze\\'
+--- let &stc='%{substitute(v:lnum,"\\d\\zs\\ze\\'
--- . '%(\\d\\d\\d\\)\\+$",",","g")}'
---
--- " Both relative and absolute line numbers with different
--- " highlighting for odd and even relative numbers:
---- :let &stc='%#NonText#%{&nu?v:lnum:""}' .
+--- let &stc='%#NonText#%{&nu?v:lnum:""}' .
--- '%=%{&rnu&&(v:lnum%2)?"\ ".v:relnum:""}' .
--- '%#LineNr#%{&rnu&&!(v:lnum%2)?"\ ".v:relnum:""}'
--- ```
@@ -6330,8 +6427,9 @@ vim.wo.stc = vim.wo.statuscolumn
---
--- When the option starts with "%!" then it is used as an expression,
--- evaluated and the result is used as the option value. Example:
---- ```
---- :set statusline=%!MyStatusLine()
+---
+--- ```vim
+--- set statusline=%!MyStatusLine()
--- ```
--- The *g:statusline_winid* variable will be set to the `window-ID` of the
--- window that the status line belongs to.
@@ -6414,7 +6512,8 @@ vim.wo.stc = vim.wo.statuscolumn
--- The expression can contain the "}" character, the end of
--- expression is denoted by "%}".
--- For example:
---- ```
+---
+--- ```vim
--- func! Stl_filename() abort
--- return "%t"
--- endfunc
@@ -6427,16 +6526,17 @@ vim.wo.stc = vim.wo.statuscolumn
--- ) - End of item group. No width fields allowed.
--- T N For 'tabline': start of tab page N label. Use %T or %X to end
--- the label. Clicking this label with left mouse button switches
---- to the specified tab page.
+--- to the specified tab page, while clicking it with middle mouse
+--- button closes the specified tab page.
--- X N For 'tabline': start of close tab N label. Use %X or %T to end
--- the label, e.g.: %3Xclose%X. Use %999X for a "close current
---- tab" label. Clicking this label with left mouse button closes
---- specified tab page.
---- @ N Start of execute function label. Use %X or %T to
---- end the label, e.g.: %10@SwitchBuffer@foo.c%X. Clicking this
---- label runs specified function: in the example when clicking once
---- using left mouse button on "foo.c" "SwitchBuffer(10, 1, 'l',
---- ' ')" expression will be run. Function receives the
+--- tab" label. Clicking this label with left mouse button closes
+--- the specified tab page.
+--- @ N Start of execute function label. Use %X or %T to end the label,
+--- e.g.: %10@SwitchBuffer@foo.c%X. Clicking this label runs the
+--- specified function: in the example when clicking once using left
+--- mouse button on "foo.c", a `SwitchBuffer(10, 1, 'l', ' ')`
+--- expression will be run. The specified function receives the
--- following arguments in order:
--- 1. minwid field value or zero if no N was specified
--- 2. number of mouse clicks to detect multiple clicks
@@ -6483,8 +6583,9 @@ vim.wo.stc = vim.wo.statuscolumn
--- not set) and a minwid is not set for the group, the whole group will
--- become empty. This will make a group like the following disappear
--- completely from the statusline when none of the flags are set.
---- ```
---- :set statusline=...%(\ [%M%R%H]%)...
+---
+--- ```vim
+--- set statusline=...%(\ [%M%R%H]%)...
--- ```
--- Beware that an expression is evaluated each and every time the status
--- line is displayed.
@@ -6517,35 +6618,42 @@ vim.wo.stc = vim.wo.statuscolumn
---
--- Examples:
--- Emulate standard status line with 'ruler' set
---- ```
---- :set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P
+---
+--- ```vim
+--- set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P
--- ```
--- Similar, but add ASCII value of char under the cursor (like "ga")
---- ```
---- :set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P
+---
+--- ```vim
+--- set statusline=%<%f%h%m%r%=%b\ 0x%B\ \ %l,%c%V\ %P
--- ```
--- Display byte count and byte value, modified flag in red.
---- ```
---- :set statusline=%<%f%=\ [%1*%M%*%n%R%H]\ %-19(%3l,%02c%03V%)%O'%02b'
---- :hi User1 term=inverse,bold cterm=inverse,bold ctermfg=red
+---
+--- ```vim
+--- set statusline=%<%f%=\ [%1*%M%*%n%R%H]\ %-19(%3l,%02c%03V%)%O'%02b'
+--- hi User1 term=inverse,bold cterm=inverse,bold ctermfg=red
--- ```
--- Display a ,GZ flag if a compressed file is loaded
---- ```
---- :set statusline=...%r%{VarExists('b:gzflag','\ [GZ]')}%h...
+---
+--- ```vim
+--- set statusline=...%r%{VarExists('b:gzflag','\ [GZ]')}%h...
--- ```
--- In the `:autocmd`'s:
---- ```
---- :let b:gzflag = 1
+---
+--- ```vim
+--- let b:gzflag = 1
--- ```
--- And:
---- ```
---- :unlet b:gzflag
+---
+--- ```vim
+--- unlet b:gzflag
--- ```
--- And define this function:
---- ```
---- :function VarExists(var, val)
---- : if exists(a:var) | return a:val | else | return '' | endif
---- :endfunction
+---
+--- ```vim
+--- function VarExists(var, val)
+--- if exists(a:var) | return a:val | else | return '' | endif
+--- endfunction
--- ```
---
---
@@ -6576,8 +6684,9 @@ vim.go.su = vim.go.suffixes
--- Comma-separated list of suffixes, which are used when searching for a
--- file for the "gf", "[I", etc. commands. Example:
---- ```
---- :set suffixesadd=.java
+---
+--- ```vim
+--- set suffixesadd=.java
--- ```
---
---
@@ -6662,26 +6771,26 @@ vim.bo.smc = vim.bo.synmaxcol
--- Otherwise this option does not always reflect the current syntax (the
--- b:current_syntax variable does).
--- This option is most useful in a modeline, for a file which syntax is
---- not automatically recognized. Example, in an IDL file:
---- ```
+--- not automatically recognized. Example, in an IDL file: >c
--- /* vim: set syntax=idl : */
--- ```
--- When a dot appears in the value then this separates two filetype
---- names. Example:
---- ```
+--- names. Example: >c
--- /* vim: set syntax=c.doxygen : */
--- ```
--- This will use the "c" syntax first, then the "doxygen" syntax.
--- Note that the second one must be prepared to be loaded as an addition,
--- otherwise it will be skipped. More than one dot may appear.
--- To switch off syntax highlighting for the current file, use:
---- ```
---- :set syntax=OFF
+---
+--- ```vim
+--- set syntax=OFF
--- ```
--- To switch syntax highlighting on according to the current value of the
--- 'filetype' option:
---- ```
---- :set syntax=ON
+---
+--- ```vim
+--- set syntax=ON
--- ```
--- What actually happens when setting the 'syntax' option is that the
--- Syntax autocommand event is triggered with the value as argument.
@@ -6941,6 +7050,10 @@ vim.go.tbidi = vim.go.termbidi
--- attributes instead of "cterm" attributes. `guifg`
--- Requires an ISO-8613-3 compatible terminal.
---
+--- Nvim will automatically attempt to determine if the host terminal
+--- supports 24-bit color and will enable this option if it does
+--- (unless explicitly disabled by the user).
+---
--- @type boolean
vim.o.termguicolors = false
vim.o.tgc = vim.o.termguicolors
@@ -7107,15 +7220,17 @@ vim.go.titleold = vim.o.titleold
--- This option cannot be set in a modeline when 'modelineexpr' is off.
---
--- Example:
---- ```
---- :auto BufEnter * let &titlestring = hostname() .. "/" .. expand("%:p")
---- :set title titlestring=%<%F%=%l/%L-%P titlelen=70
+---
+--- ```vim
+--- auto BufEnter * let &titlestring = hostname() .. "/" .. expand("%:p")
+--- set title titlestring=%<%F%=%l/%L-%P titlelen=70
--- ```
--- The value of 'titlelen' is used to align items in the middle or right
--- of the available space.
--- Some people prefer to have the file name first:
---- ```
---- :set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:~:.:h\")})%)%(\ %a%)
+---
+--- ```vim
+--- set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:~:.:h\")})%)%(\ %a%)
--- ```
--- Note the use of "%{ }" and an expression to get the path of the file,
--- without the file name. The "%( %)" constructs are used to add a
@@ -7200,7 +7315,8 @@ vim.bo.udf = vim.bo.undofile
--- Nevertheless, a single change can already use a large amount of memory.
--- Set to 0 for Vi compatibility: One level of undo and "u" undoes
--- itself:
---- ```
+---
+--- ```vim
--- set ul=0
--- ```
--- But you can also get Vi compatibility by including the 'u' flag in
@@ -7208,7 +7324,8 @@ vim.bo.udf = vim.bo.undofile
--- Also see `undo-two-ways`.
--- Set to -1 for no undo at all. You might want to do this only for the
--- current buffer:
---- ```
+---
+--- ```vim
--- setlocal ul=-1
--- ```
--- This helps when you run out of memory for a single change.
@@ -7280,8 +7397,9 @@ vim.go.ut = vim.go.updatetime
--- For example, when editing assembly language files where statements
--- start in the 9th column and comments in the 41st, it may be useful
--- to use the following:
---- ```
---- :set varsofttabstop=8,32,8
+---
+--- ```vim
+--- set varsofttabstop=8,32,8
--- ```
--- This will set soft tabstops with 8 and 8 + 32 spaces, and 8 more
--- for every column thereafter.
@@ -7298,8 +7416,9 @@ vim.bo.vsts = vim.bo.varsofttabstop
--- A list of the number of spaces that a <Tab> in the file counts for,
--- separated by commas. Each value corresponds to one tab, with the
--- final value applying to all subsequent tabs. For example:
---- ```
---- :set vartabstop=4,20,10,8
+---
+--- ```vim
+--- set vartabstop=4,20,10,8
--- ```
--- This will make the first tab 4 spaces wide, the second 20 spaces,
--- the third 10 spaces, and all following tabs 8 spaces.
@@ -7315,15 +7434,15 @@ vim.bo.vts = vim.bo.vartabstop
--- Sets the verbosity level. Also set by `-V` and `:verbose`.
---
---- Tracing of options in Lua scripts is activated at level 1; Lua scripts
---- are not traced with verbose=0, for performance.
+--- Tracing of assignments to options, mappings, etc. in Lua scripts is
+--- enabled at level 1; Lua scripts are not traced when 'verbose' is 0,
+--- for performance.
---
--- If greater than or equal to a given level, Nvim produces the following
--- messages:
---
--- Level Messages ~
--- ----------------------------------------------------------------------
---- 1 Lua assignments to options, mappings, etc.
--- 2 When a file is ":source"'ed, or `shada` file is read or written.
--- 3 UI info, terminal capabilities.
--- 4 Shell commands.
@@ -7454,8 +7573,9 @@ vim.go.warn = vim.o.warn
--- [ <Left> Insert and Replace
--- ] <Right> Insert and Replace
--- For example:
---- ```
---- :set ww=<,>,[,]
+---
+--- ```vim
+--- set ww=<,>,[,]
--- ```
--- allows wrap only when cursor keys are used.
--- When the movement keys are used in combination with a delete or change
@@ -7484,8 +7604,9 @@ vim.go.ww = vim.go.whichwrap
--- <Esc> can be used, but hitting it twice in a row will still exit
--- command-line as a failsafe measure.
--- Although 'wc' is a number option, you can set it to a special key:
---- ```
---- :set wc=<Tab>
+---
+--- ```vim
+--- set wc=<Tab>
--- ```
---
---
@@ -7500,9 +7621,10 @@ vim.go.wc = vim.go.wildchar
--- keys suitable for this option by looking at `ex-edit-index`. Normally
--- you'll never actually type 'wildcharm', just use it in mappings that
--- automatically invoke completion mode, e.g.:
---- ```
---- :set wcm=<C-Z>
---- :cnoremap ss so $vim/sessions/*.vim<C-Z>
+---
+--- ```vim
+--- set wcm=<C-Z>
+--- cnoremap ss so $vim/sessions/*.vim<C-Z>
--- ```
--- Then after typing :ss you can use CTRL-P & CTRL-N.
---
@@ -7519,8 +7641,9 @@ vim.go.wcm = vim.go.wildcharm
--- The pattern is used like with `:autocmd`, see `autocmd-pattern`.
--- Also see 'suffixes'.
--- Example:
---- ```
---- :set wildignore=*.o,*.obj
+---
+--- ```vim
+--- set wildignore=*.o,*.obj
--- ```
--- The use of `:set+=` and `:set-=` is preferred when adding or removing
--- a pattern from the list. This avoids problems when a future version
@@ -7576,9 +7699,10 @@ vim.go.wic = vim.go.wildignorecase
---
--- If you want <Left> and <Right> to move the cursor instead of selecting
--- a different match, use this:
---- ```
---- :cnoremap <Left> <Space><BS><Left>
---- :cnoremap <Right> <Space><BS><Right>
+---
+--- ```vim
+--- cnoremap <Left> <Space><BS><Left>
+--- cnoremap <Right> <Space><BS><Right>
--- ```
---
--- `hl-WildMenu` highlights the current match.
@@ -7621,24 +7745,29 @@ vim.go.wmnu = vim.go.wildmenu
--- current buffer).
---
--- Examples:
---- ```
---- :set wildmode=full
+---
+--- ```vim
+--- set wildmode=full
--- ```
--- Complete first full match, next match, etc. (the default)
---- ```
---- :set wildmode=longest,full
+---
+--- ```vim
+--- set wildmode=longest,full
--- ```
--- Complete longest common string, then each full match
---- ```
---- :set wildmode=list:full
+---
+--- ```vim
+--- set wildmode=list:full
--- ```
--- List all matches and complete each full match
---- ```
---- :set wildmode=list,full
+---
+--- ```vim
+--- set wildmode=list,full
--- ```
--- List all matches without completing, then each full match
---- ```
---- :set wildmode=longest,list
+---
+--- ```vim
+--- set wildmode=longest,list
--- ```
--- Complete longest common string, then list alternatives.
--- More info here: `cmdline-completion`.
@@ -7776,7 +7905,8 @@ vim.wo.wfw = vim.wo.winfixwidth
--- that ":all" will create only two windows. To avoid "vim -o 1 2 3 4"
--- to create only two windows, set the option after startup is done,
--- using the `VimEnter` event:
---- ```
+---
+--- ```vim
--- au VimEnter * set winheight=999
--- ```
--- Minimum value is 1.
@@ -7806,7 +7936,8 @@ vim.go.wh = vim.go.winheight
--- message area cannot be overridden.
---
--- Example: show a different color for non-current windows:
---- ```
+---
+--- ```vim
--- set winhighlight=Normal:MyNormal,NormalNC:MyNormalNC
--- ```
---
@@ -7876,9 +8007,10 @@ vim.go.wiw = vim.go.winwidth
--- The line will be broken in the middle of a word if necessary. See
--- 'linebreak' to get the break at a word boundary.
--- To make scrolling horizontally a bit more useful, try this:
---- ```
---- :set sidescroll=5
---- :set listchars+=precedes:<,extends:>
+---
+--- ```vim
+--- set sidescroll=5
+--- set listchars+=precedes:<,extends:>
--- ```
--- See 'sidescroll', 'listchars' and `wrap-off`.
--- This option can't be set from a `modeline` when the 'diff' option is
diff --git a/runtime/lua/vim/_meta/re.lua b/runtime/lua/vim/_meta/re.lua
new file mode 100644
index 0000000000..14c94c7824
--- /dev/null
+++ b/runtime/lua/vim/_meta/re.lua
@@ -0,0 +1,54 @@
+--- @meta
+error('Cannot require a meta file')
+
+-- Documentations and Lua types for vim.re (vendored re.lua, lpeg-1.1.0)
+-- https://www.inf.puc-rio.br/~roberto/lpeg/re.html
+--
+-- Copyright © 2007-2023 Lua.org, PUC-Rio.
+-- See 'lpeg.html' for license
+
+--- @brief
+--- The `vim.re` module provides a conventional regex-like syntax for pattern usage
+--- within LPeg |vim.lpeg|.
+---
+--- See https://www.inf.puc-rio.br/~roberto/lpeg/re.html for the original
+--- documentation including regex syntax and more concrete examples.
+
+--- Compiles the given {string} and returns an equivalent LPeg pattern. The given string may define
+--- either an expression or a grammar. The optional {defs} table provides extra Lua values to be used
+--- by the pattern.
+--- @param string string
+--- @param defs? table
+--- @return vim.lpeg.Pattern
+function vim.re.compile(string, defs) end
+
+--- Searches the given {pattern} in the given {subject}. If it finds a match, returns the index
+--- where this occurrence starts and the index where it ends. Otherwise, returns nil.
+---
+--- An optional numeric argument {init} makes the search starts at that position in the subject
+--- string. As usual in Lua libraries, a negative value counts from the end.
+--- @param subject string
+--- @param pattern vim.lpeg.Pattern|string
+--- @param init? integer
+--- @return integer|nil the index where the occurrence starts, nil if no match
+--- @return integer|nil the index where the occurrence ends, nil if no match
+function vim.re.find(subject, pattern, init) end
+
+--- Does a global substitution, replacing all occurrences of {pattern} in the given {subject} by
+--- {replacement}.
+--- @param subject string
+--- @param pattern vim.lpeg.Pattern|string
+--- @param replacement string
+--- @return string
+function vim.re.gsub(subject, pattern, replacement) end
+
+--- Matches the given {pattern} against the given {subject}, returning all captures.
+--- @param subject string
+--- @param pattern vim.lpeg.Pattern|string
+--- @param init? integer
+--- @return integer|vim.lpeg.Capture|nil
+--- @see vim.lpeg.match()
+function vim.re.match(subject, pattern, init) end
+
+--- Updates the pre-defined character classes to the current locale.
+function vim.re.updatelocale() end
diff --git a/runtime/lua/vim/_meta/regex.lua b/runtime/lua/vim/_meta/regex.lua
index 58aa2be8c2..595ad96319 100644
--- a/runtime/lua/vim/_meta/regex.lua
+++ b/runtime/lua/vim/_meta/regex.lua
@@ -2,8 +2,6 @@
-- luacheck: no unused args
---- @defgroup vim.regex
----
--- @brief Vim regexes can be used directly from Lua. Currently they only allow
--- matching within a single line.
@@ -14,6 +12,7 @@
--- @return vim.regex
function vim.regex(re) end
+--- @nodoc
--- @class vim.regex
local regex = {} -- luacheck: no unused
diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua
index 05e5b2b871..ac25547212 100644
--- a/runtime/lua/vim/_meta/vimfn.lua
+++ b/runtime/lua/vim/_meta/vimfn.lua
@@ -582,7 +582,7 @@ function vim.fn.bufloaded(buf) end
--- echo bufname("file2") " name of buffer where "file2" matches.
--- <
---
---- @param buf? any
+--- @param buf? integer|string
--- @return string
function vim.fn.bufname(buf) end
@@ -599,7 +599,7 @@ function vim.fn.bufname(buf) end
--- number necessarily exist, because ":bwipeout" may have removed
--- them. Use bufexists() to test for the existence of a buffer.
---
---- @param buf? any
+--- @param buf? integer|string
--- @param create? any
--- @return integer
function vim.fn.bufnr(buf, create) end
@@ -1024,6 +1024,8 @@ function vim.fn.complete_check() end
--- no item is selected when using the <Up> or
--- <Down> keys)
--- inserted Inserted string. [NOT IMPLEMENTED YET]
+--- preview_winid Info floating preview window id.
+--- preview_bufnr Info floating preview buffer id.
---
--- *complete_info_mode*
--- mode values are:
@@ -1707,6 +1709,7 @@ function vim.fn.exepath(expr) end
--- echo exists("*strftime")
--- echo exists("*s:MyFunc")
--- echo exists("*MyFunc")
+--- echo exists("*v:lua.Func")
--- echo exists("bufcount")
--- echo exists(":Make")
--- echo exists("#CursorHold")
@@ -1841,7 +1844,13 @@ function vim.fn.exp(expr) end
---
--- @param string string
--- @param nosuf? boolean
---- @param list? any
+--- @param list? nil|false
+--- @return string
+function vim.fn.expand(string, nosuf, list) end
+
+--- @param string string
+--- @param nosuf boolean
+--- @param list true|number|string|table
--- @return string|string[]
function vim.fn.expand(string, nosuf, list) end
@@ -2300,6 +2309,45 @@ function vim.fn.foldtext() end
--- @return string
function vim.fn.foldtextresult(lnum) end
+--- {expr1} must be a |List|, |String|, |Blob| or |Dictionary|.
+--- For each item in {expr1} execute {expr2}. {expr1} is not
+--- modified; its values may be, as with |:lockvar| 1. |E741|
+--- See |map()| and |filter()| to modify {expr1}.
+---
+--- {expr2} must be a |string| or |Funcref|.
+---
+--- If {expr2} is a |string|, inside {expr2} |v:val| has the value
+--- of the current item. For a |Dictionary| |v:key| has the key
+--- of the current item and for a |List| |v:key| has the index of
+--- the current item. For a |Blob| |v:key| has the index of the
+--- current byte. For a |String| |v:key| has the index of the
+--- current character.
+--- Examples: >vim
+--- call foreach(mylist, 'let used[v:val] = v:true')
+--- <This records the items that are in the {expr1} list.
+---
+--- Note that {expr2} is the result of expression and is then used
+--- as a command. Often it is good to use a |literal-string| to
+--- avoid having to double backslashes.
+---
+--- If {expr2} is a |Funcref| it must take two arguments:
+--- 1. the key or the index of the current item.
+--- 2. the value of the current item.
+--- With a lambda you don't get an error if it only accepts one
+--- argument.
+--- If the function returns a value, it is ignored.
+---
+--- Returns {expr1} in all cases.
+--- When an error is encountered while executing {expr2} no
+--- further items in {expr1} are processed.
+--- When {expr2} is a Funcref errors inside a function are ignored,
+--- unless it was defined with the "abort" flag.
+---
+--- @param expr1 any
+--- @param expr2 any
+--- @return any
+function vim.fn.foreach(expr1, expr2) end
+
--- Get the full command name from a short abbreviated command
--- name; see |20.2| for details on command abbreviations.
---
@@ -2514,6 +2562,8 @@ function vim.fn.getbufinfo(buf) end
--- bufnr Buffer number.
--- changed TRUE if the buffer is modified.
--- changedtick Number of changes made to the buffer.
+--- command TRUE if the buffer belongs to the
+--- command-line window |cmdwin|.
--- hidden TRUE if the buffer is hidden.
--- lastused Timestamp in seconds, like
--- |localtime()|, when the buffer was
@@ -2729,7 +2779,7 @@ function vim.fn.getchar() end
--- 32 mouse double click
--- 64 mouse triple click
--- 96 mouse quadruple click (== 32 + 64)
---- 128 command (Macintosh only)
+--- 128 command (Mac) or super
--- Only the modifiers that have not been included in the
--- character itself are obtained. Thus Shift-a results in "A"
--- without a modifier. Returns 0 if no modifiers are used.
@@ -2887,6 +2937,7 @@ function vim.fn.getcmdwintype() end
--- help help subjects
--- highlight highlight groups
--- history |:history| suboptions
+--- keymap keyboard mappings
--- locale locale names (as output of locale -a)
--- mapclear buffer argument
--- mapping mapping name
@@ -3134,8 +3185,13 @@ function vim.fn.getjumplist(winnr, tabnr) end
--- <To get lines from another buffer see |getbufline()| and
--- |getbufoneline()|
---
+--- @param lnum integer|string
+--- @param end_? nil|false
+--- @return string
+function vim.fn.getline(lnum, end_) end
+
--- @param lnum integer
---- @param end_? any
+--- @param end_ true|number|string|table
--- @return string|string[]
function vim.fn.getline(lnum, end_) end
@@ -3433,7 +3489,12 @@ function vim.fn.getqflist(what) end
--- If {regname} is not specified, |v:register| is used.
---
--- @param regname? string
---- @param list? any
+--- @param list? nil|false
+--- @return string
+function vim.fn.getreg(regname, list) end
+
+--- @param regname string
+--- @param list true|number|string|table
--- @return string|string[]
function vim.fn.getreg(regname, list) end
@@ -3464,6 +3525,62 @@ function vim.fn.getreg(regname, list) end
--- @return table
function vim.fn.getreginfo(regname) end
+--- Returns the list of strings from {pos1} to {pos2} from a
+--- buffer.
+---
+--- {pos1} and {pos2} must both be |List|s with four numbers.
+--- See |getpos()| for the format of the list. It's possible
+--- to specify positions from a different buffer, but please
+--- note the limitations at |getregion-notes|.
+---
+--- The optional argument {opts} is a Dict and supports the
+--- following items:
+---
+--- type Specify the region's selection type
+--- (default: "v"):
+--- "v" for |charwise| mode
+--- "V" for |linewise| mode
+--- "<CTRL-V>" for |blockwise-visual| mode
+---
+--- exclusive If |TRUE|, use exclusive selection
+--- for the end position
+--- (default: follow 'selection')
+---
+--- You can get the last selection type by |visualmode()|.
+--- If Visual mode is active, use |mode()| to get the Visual mode
+--- (e.g., in a |:vmap|).
+--- This function is useful to get text starting and ending in
+--- different columns, such as a |charwise-visual| selection.
+---
+--- *getregion-notes*
+--- Note that:
+--- - Order of {pos1} and {pos2} doesn't matter, it will always
+--- return content from the upper left position to the lower
+--- right position.
+--- - If 'virtualedit' is enabled and the region is past the end
+--- of the lines, resulting lines are padded with spaces.
+--- - If the region is blockwise and it starts or ends in the
+--- middle of a multi-cell character, it is not included but
+--- its selected part is substituted with spaces.
+--- - If {pos1} and {pos2} are not in the same buffer, an empty
+--- list is returned.
+--- - {pos1} and {pos2} must belong to a |bufloaded()| buffer.
+--- - It is evaluated in current window context, which makes a
+--- difference if the buffer is displayed in a window with
+--- different 'virtualedit' or 'list' values.
+---
+--- Examples: >
+--- :xnoremap <CR>
+--- \ <Cmd>echom getregion(
+--- \ getpos('v'), getpos('.'), #{ type: mode() })<CR>
+--- <
+---
+--- @param pos1 table
+--- @param pos2 table
+--- @param opts? table
+--- @return string[]
+function vim.fn.getregion(pos1, pos2, opts) end
+
--- The result is a String, which is type of register {regname}.
--- The value will be one of:
--- "v" for |charwise| text
@@ -4135,7 +4252,7 @@ function vim.fn.id(expr) end
--- |getline()|.
--- When {lnum} is invalid -1 is returned.
---
---- @param lnum integer
+--- @param lnum integer|string
--- @return integer
function vim.fn.indent(lnum) end
@@ -4678,8 +4795,7 @@ function vim.fn.join(list, sep) end
--- Vim value. In the following cases it will output
--- |msgpack-special-dict|:
--- 1. Dictionary contains duplicate key.
---- 2. Dictionary contains empty key.
---- 3. String contains NUL byte. Two special dictionaries: for
+--- 2. String contains NUL byte. Two special dictionaries: for
--- dictionary and for string will be emitted in case string
--- with NUL byte was a dictionary key.
---
@@ -5065,7 +5181,14 @@ function vim.fn.map(expr1, expr2) end
--- @param name string
--- @param mode? string
--- @param abbr? boolean
---- @param dict? boolean
+--- @param dict? false
+--- @return string
+function vim.fn.maparg(name, mode, abbr, dict) end
+
+--- @param name string
+--- @param mode string
+--- @param abbr boolean
+--- @param dict true
--- @return string|table<string,any>
function vim.fn.maparg(name, mode, abbr, dict) end
@@ -5150,6 +5273,12 @@ function vim.fn.maplist() end
--- @return any
function vim.fn.mapnew(expr1, expr2) end
+--- @param mode string
+--- @param abbr? any
+--- @param dict? any
+--- @return any
+function vim.fn.mapset(mode, abbr, dict) end
+
--- Restore a mapping from a dictionary, possibly returned by
--- |maparg()| or |maplist()|. A buffer mapping, when dict.buffer
--- is true, is set on the current buffer; it is up to the caller
@@ -5185,11 +5314,9 @@ function vim.fn.mapnew(expr1, expr2) end
--- call mapset(d)
--- endfor
---
---- @param mode string
---- @param abbr? any
---- @param dict? any
+--- @param dict any
--- @return any
-function vim.fn.mapset(mode, abbr, dict) end
+function vim.fn.mapset(dict) end
--- When {expr} is a |List| then this returns the index of the
--- first item where {pat} matches. Each item is used as a
@@ -5243,6 +5370,7 @@ function vim.fn.mapset(mode, abbr, dict) end
--- Note that when {count} is added the way {start} works changes,
--- see above.
---
+--- *match-pattern*
--- See |pattern| for the patterns that are accepted.
--- The 'ignorecase' option is used to set the ignore-caseness of
--- the pattern. 'smartcase' is NOT used. The matching is always
@@ -5383,6 +5511,57 @@ function vim.fn.matchaddpos(group, pos, priority, id, dict) end
--- @return any
function vim.fn.matcharg(nr) end
+--- Returns the |List| of matches in lines from {lnum} to {end} in
+--- buffer {buf} where {pat} matches.
+---
+--- {lnum} and {end} can either be a line number or the string "$"
+--- to refer to the last line in {buf}.
+---
+--- The {dict} argument supports following items:
+--- submatches include submatch information (|/\(|)
+---
+--- For each match, a |Dict| with the following items is returned:
+--- byteidx starting byte index of the match
+--- lnum line number where there is a match
+--- text matched string
+--- Note that there can be multiple matches in a single line.
+---
+--- This function works only for loaded buffers. First call
+--- |bufload()| if needed.
+---
+--- See |match-pattern| for information about the effect of some
+--- option settings on the pattern.
+---
+--- When {buf} is not a valid buffer, the buffer is not loaded or
+--- {lnum} or {end} is not valid then an error is given and an
+--- empty |List| is returned.
+---
+--- Examples: >vim
+--- " Assuming line 3 in buffer 5 contains "a"
+--- :echo matchbufline(5, '\<\k\+\>', 3, 3)
+--- [{'lnum': 3, 'byteidx': 0, 'text': 'a'}]
+--- " Assuming line 4 in buffer 10 contains "tik tok"
+--- :echo matchbufline(10, '\<\k\+\>', 1, 4)
+--- [{'lnum': 4, 'byteidx': 0, 'text': 'tik'}, {'lnum': 4, 'byteidx': 4, 'text': 'tok'}]
+--- <
+--- If {submatch} is present and is v:true, then submatches like
+--- "\1", "\2", etc. are also returned. Example: >vim
+--- " Assuming line 2 in buffer 2 contains "acd"
+--- :echo matchbufline(2, '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2, 2
+--- \ {'submatches': v:true})
+--- [{'lnum': 2, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]
+--- <The "submatches" List always contains 9 items. If a submatch
+--- is not found, then an empty string is returned for that
+--- submatch.
+---
+--- @param buf string|integer
+--- @param pat string
+--- @param lnum string|integer
+--- @param end_ string|integer
+--- @param dict? table
+--- @return any
+function vim.fn.matchbufline(buf, pat, lnum, end_, dict) end
+
--- Deletes a match with ID {id} previously defined by |matchadd()|
--- or one of the |:match| commands. Returns 0 if successful,
--- otherwise -1. See example for |matchadd()|. All matches can
@@ -5552,6 +5731,44 @@ function vim.fn.matchlist(expr, pat, start, count) end
--- @return any
function vim.fn.matchstr(expr, pat, start, count) end
+--- Returns the |List| of matches in {list} where {pat} matches.
+--- {list} is a |List| of strings. {pat} is matched against each
+--- string in {list}.
+---
+--- The {dict} argument supports following items:
+--- submatches include submatch information (|/\(|)
+---
+--- For each match, a |Dict| with the following items is returned:
+--- byteidx starting byte index of the match.
+--- idx index in {list} of the match.
+--- text matched string
+--- submatches a List of submatches. Present only if
+--- "submatches" is set to v:true in {dict}.
+---
+--- See |match-pattern| for information about the effect of some
+--- option settings on the pattern.
+---
+--- Example: >vim
+--- :echo matchstrlist(['tik tok'], '\<\k\+\>')
+--- [{'idx': 0, 'byteidx': 0, 'text': 'tik'}, {'idx': 0, 'byteidx': 4, 'text': 'tok'}]
+--- :echo matchstrlist(['a', 'b'], '\<\k\+\>')
+--- [{'idx': 0, 'byteidx': 0, 'text': 'a'}, {'idx': 1, 'byteidx': 0, 'text': 'b'}]
+--- <
+--- If "submatches" is present and is v:true, then submatches like
+--- "\1", "\2", etc. are also returned. Example: >vim
+--- :echo matchstrlist(['acd'], '\(a\)\?\(b\)\?\(c\)\?\(.*\)',
+--- \ #{submatches: v:true})
+--- [{'idx': 0, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]
+--- <The "submatches" List always contains 9 items. If a submatch
+--- is not found, then an empty string is returned for that
+--- submatch.
+---
+--- @param list string[]
+--- @param pat string
+--- @param dict? table
+--- @return any
+function vim.fn.matchstrlist(list, pat, dict) end
+
--- Same as |matchstr()|, but return the matched string, the start
--- position and the end position of the match. Example: >vim
--- echo matchstrpos("testing", "ing")
@@ -5583,7 +5800,7 @@ function vim.fn.matchstrpos(expr, pat, start, count) end
--- it returns the maximum of all values in the Dictionary.
--- If {expr} is neither a List nor a Dictionary, or one of the
--- items in {expr} cannot be used as a Number this results in
---- an error. An empty |List| or |Dictionary| results in zero.
+--- an error. An empty |List| or |Dictionary| results in zero.
---
--- @param expr any
--- @return any
@@ -5828,8 +6045,9 @@ function vim.fn.mkdir(name, flags, prot) end
--- the leading character(s).
--- Also see |visualmode()|.
---
+--- @param expr? any
--- @return any
-function vim.fn.mode() end
+function vim.fn.mode(expr) end
--- Convert a list of Vimscript objects to msgpack. Returned value is a
--- |readfile()|-style list. When {type} contains "B", a |Blob| is
@@ -5922,7 +6140,6 @@ function vim.fn.msgpackdump(list, type) end
--- are binary strings).
--- 2. String with NUL byte inside.
--- 3. Duplicate key.
---- 4. Empty key.
--- ext |List| with two values: first is a signed integer
--- representing extension type. Second is
--- |readfile()|-style list of strings.
@@ -6158,9 +6375,9 @@ function vim.fn.prevnonblank(lnum) end
--- <This limits the length of the text used from "line" to
--- "width" bytes.
---
---- If the argument to be formatted is specified using a posional
---- argument specifier, and a '*' is used to indicate that a
---- number argument is to be used to specify the width or
+--- If the argument to be formatted is specified using a
+--- positional argument specifier, and a '*' is used to indicate
+--- that a number argument is to be used to specify the width or
--- precision, the argument(s) to be used must also be specified
--- using a {n$} positional argument specifier. See |printf-$|.
---
@@ -7969,7 +8186,7 @@ function vim.fn.setqflist(list, action, what) end
---
--- @param regname string
--- @param value any
---- @param options? table
+--- @param options? string
--- @return any
function vim.fn.setreg(regname, value, options) end
@@ -9311,7 +9528,12 @@ function vim.fn.strwidth(string) end
--- A line break is included as a newline character.
---
--- @param nr integer
---- @param list? integer
+--- @param list? nil
+--- @return string
+function vim.fn.submatch(nr, list) end
+
+--- @param nr integer
+--- @param list integer
--- @return string|string[]
function vim.fn.submatch(nr, list) end
@@ -9527,7 +9749,7 @@ function vim.fn.synIDtrans(synID) end
---
--- @param lnum integer
--- @param col integer
---- @return {[1]: integer, [2]: string, [3]: integer}[]
+--- @return {[1]: integer, [2]: string, [3]: integer}
function vim.fn.synconcealed(lnum, col) end
--- Return a |List|, which is the stack of syntax items at the
diff --git a/runtime/lua/vim/_meta/vvars.lua b/runtime/lua/vim/_meta/vvars.lua
new file mode 100644
index 0000000000..ee6d8ddf35
--- /dev/null
+++ b/runtime/lua/vim/_meta/vvars.lua
@@ -0,0 +1,779 @@
+--- @meta _
+-- THIS FILE IS GENERATED
+-- DO NOT EDIT
+error('Cannot require a meta file')
+
+--- @class vim.v
+vim.v = ...
+
+--- The command line arguments Vim was invoked with. This is a
+--- list of strings. The first item is the Vim command.
+--- See `v:progpath` for the command with full path.
+--- @type string[]
+vim.v.argv = ...
+
+--- Argument for evaluating 'formatexpr' and used for the typed
+--- character when using <expr> in an abbreviation `:map-<expr>`.
+--- It is also used by the `InsertCharPre` and `InsertEnter` events.
+--- @type any
+vim.v.char = ...
+
+--- The name of the character encoding of a file to be converted.
+--- Only valid while evaluating the 'charconvert' option.
+--- @type string
+vim.v.charconvert_from = ...
+
+--- The name of the character encoding of a file after conversion.
+--- Only valid while evaluating the 'charconvert' option.
+--- @type string
+vim.v.charconvert_to = ...
+
+--- The extra arguments ("++p", "++enc=", "++ff=") given to a file
+--- read/write command. This is set before an autocommand event
+--- for a file read/write command is triggered. There is a
+--- leading space to make it possible to append this variable
+--- directly after the read/write command. Note: "+cmd" isn't
+--- included here, because it will be executed anyway.
+--- @type string
+vim.v.cmdarg = ...
+
+--- Set like v:cmdarg for a file read/write command. When a "!"
+--- was used the value is 1, otherwise it is 0. Note that this
+--- can only be used in autocommands. For user commands `<bang>`
+--- can be used.
+--- @type integer
+vim.v.cmdbang = ...
+
+--- The current locale setting for collation order of the runtime
+--- environment. This allows Vim scripts to be aware of the
+--- current locale encoding. Technical: it's the value of
+--- LC_COLLATE. When not using a locale the value is "C".
+--- This variable can not be set directly, use the `:language`
+--- command.
+--- See `multi-lang`.
+--- @type string
+vim.v.collate = ...
+
+--- Dictionary containing the most recent `complete-items` after
+--- `CompleteDone`. Empty if the completion failed, or after
+--- leaving and re-entering insert mode.
+--- Note: Plugins can modify the value to emulate the builtin
+--- `CompleteDone` event behavior.
+--- @type any
+vim.v.completed_item = ...
+
+--- The count given for the last Normal mode command. Can be used
+--- to get the count before a mapping. Read-only. Example:
+---
+--- ```vim
+--- :map _x :<C-U>echo "the count is " .. v:count<CR>
+--- ```
+---
+--- Note: The <C-U> is required to remove the line range that you
+--- get when typing ':' after a count.
+--- When there are two counts, as in "3d2w", they are multiplied,
+--- just like what happens in the command, "d6w" for the example.
+--- Also used for evaluating the 'formatexpr' option.
+--- @type integer
+vim.v.count = ...
+
+--- Just like "v:count", but defaults to one when no count is
+--- used.
+--- @type integer
+vim.v.count1 = ...
+
+--- The current locale setting for characters of the runtime
+--- environment. This allows Vim scripts to be aware of the
+--- current locale encoding. Technical: it's the value of
+--- LC_CTYPE. When not using a locale the value is "C".
+--- This variable can not be set directly, use the `:language`
+--- command.
+--- See `multi-lang`.
+--- @type any
+vim.v.ctype = ...
+
+--- Normally zero. When a deadly signal is caught it's set to
+--- one. When multiple signals are caught the number increases.
+--- Can be used in an autocommand to check if Vim didn't
+--- terminate normally.
+--- Example:
+---
+--- ```vim
+--- :au VimLeave * if v:dying | echo "\nAAAAaaaarrrggghhhh!!!\n" | endif
+--- ```
+---
+--- Note: if another deadly signal is caught when v:dying is one,
+--- VimLeave autocommands will not be executed.
+--- @type integer
+vim.v.dying = ...
+
+--- Number of screen cells that can be used for an `:echo` message
+--- in the last screen line before causing the `hit-enter-prompt`.
+--- Depends on 'showcmd', 'ruler' and 'columns'. You need to
+--- check 'cmdheight' for whether there are full-width lines
+--- available above the last line.
+--- @type integer
+vim.v.echospace = ...
+
+--- Last given error message.
+--- Modifiable (can be set).
+--- Example:
+---
+--- ```vim
+--- let v:errmsg = ""
+--- silent! next
+--- if v:errmsg != ""
+--- " ... handle error
+--- ```
+--- @type string
+vim.v.errmsg = ...
+
+--- Errors found by assert functions, such as `assert_true()`.
+--- This is a list of strings.
+--- The assert functions append an item when an assert fails.
+--- The return value indicates this: a one is returned if an item
+--- was added to v:errors, otherwise zero is returned.
+--- To remove old results make it empty:
+---
+--- ```vim
+--- let v:errors = []
+--- ```
+---
+--- If v:errors is set to anything but a list it is made an empty
+--- list by the assert function.
+--- @type string[]
+vim.v.errors = ...
+
+--- Dictionary of event data for the current `autocommand`. Valid
+--- only during the event lifetime; storing or passing v:event is
+--- invalid! Copy it instead:
+---
+--- ```vim
+--- au TextYankPost * let g:foo = deepcopy(v:event)
+--- ```
+---
+--- Keys vary by event; see the documentation for the specific
+--- event, e.g. `DirChanged` or `TextYankPost`.
+--- KEY DESCRIPTION ~
+--- abort Whether the event triggered during
+--- an aborting condition (e.g. `c_Esc` or
+--- `c_CTRL-C` for `CmdlineLeave`).
+--- chan `channel-id`
+--- cmdlevel Level of cmdline.
+--- cmdtype Type of cmdline, `cmdline-char`.
+--- cwd Current working directory.
+--- inclusive Motion is `inclusive`, else exclusive.
+--- scope Event-specific scope name.
+--- operator Current `operator`. Also set for Ex
+--- commands (unlike `v:operator`). For
+--- example if `TextYankPost` is triggered
+--- by the `:yank` Ex command then
+--- `v:event.operator` is "y".
+--- regcontents Text stored in the register as a
+--- `readfile()`-style list of lines.
+--- regname Requested register (e.g "x" for "xyy)
+--- or the empty string for an unnamed
+--- operation.
+--- regtype Type of register as returned by
+--- `getregtype()`.
+--- visual Selection is visual (as opposed to,
+--- e.g., via motion).
+--- completed_item Current selected complete item on
+--- `CompleteChanged`, Is `{}` when no complete
+--- item selected.
+--- height Height of popup menu on `CompleteChanged`
+--- width Width of popup menu on `CompleteChanged`
+--- row Row count of popup menu on `CompleteChanged`,
+--- relative to screen.
+--- col Col count of popup menu on `CompleteChanged`,
+--- relative to screen.
+--- size Total number of completion items on
+--- `CompleteChanged`.
+--- scrollbar Is `v:true` if popup menu have scrollbar, or
+--- `v:false` if not.
+--- changed_window Is `v:true` if the event fired while
+--- changing window (or tab) on `DirChanged`.
+--- status Job status or exit code, -1 means "unknown". `TermClose`
+--- @type any
+vim.v.event = ...
+
+--- The value of the exception most recently caught and not
+--- finished. See also `v:throwpoint` and `throw-variables`.
+--- Example:
+---
+--- ```vim
+--- try
+--- throw "oops"
+--- catch /.*/
+--- echo "caught " .. v:exception
+--- endtry
+--- ```
+---
+--- Output: "caught oops".
+--- @type string
+vim.v.exception = ...
+
+--- Exit code, or `v:null` before invoking the `VimLeavePre`
+--- and `VimLeave` autocmds. See `:q`, `:x` and `:cquit`.
+--- Example:
+---
+--- ```vim
+--- :au VimLeave * echo "Exit value is " .. v:exiting
+--- ```
+--- @type any
+vim.v.exiting = ...
+
+--- Special value used to put "false" in JSON and msgpack. See
+--- `json_encode()`. This value is converted to "v:false" when used
+--- as a String (e.g. in `expr5` with string concatenation
+--- operator) and to zero when used as a Number (e.g. in `expr5`
+--- or `expr7` when used with numeric operators). Read-only.
+--- @type boolean
+vim.v['false'] = ...
+
+--- What should happen after a `FileChangedShell` event was
+--- triggered. Can be used in an autocommand to tell Vim what to
+--- do with the affected buffer:
+--- reload Reload the buffer (does not work if
+--- the file was deleted).
+--- edit Reload the buffer and detect the
+--- values for options such as
+--- 'fileformat', 'fileencoding', 'binary'
+--- (does not work if the file was
+--- deleted).
+--- ask Ask the user what to do, as if there
+--- was no autocommand. Except that when
+--- only the timestamp changed nothing
+--- will happen.
+--- <empty> Nothing, the autocommand should do
+--- everything that needs to be done.
+--- The default is empty. If another (invalid) value is used then
+--- Vim behaves like it is empty, there is no warning message.
+--- @type string
+vim.v.fcs_choice = ...
+
+--- The reason why the `FileChangedShell` event was triggered.
+--- Can be used in an autocommand to decide what to do and/or what
+--- to set v:fcs_choice to. Possible values:
+--- deleted file no longer exists
+--- conflict file contents, mode or timestamp was
+--- changed and buffer is modified
+--- changed file contents has changed
+--- mode mode of file changed
+--- time only file timestamp changed
+--- @type string
+vim.v.fcs_reason = ...
+
+--- When evaluating 'includeexpr': the file name that was
+--- detected. Empty otherwise.
+--- @type string
+vim.v.fname = ...
+
+--- The name of the diff (patch) file. Only valid while
+--- evaluating 'patchexpr'.
+--- @type string
+vim.v.fname_diff = ...
+
+--- The name of the input file. Valid while evaluating:
+--- option used for ~
+--- 'charconvert' file to be converted
+--- 'diffexpr' original file
+--- 'patchexpr' original file
+--- And set to the swap file name for `SwapExists`.
+--- @type string
+vim.v.fname_in = ...
+
+--- The name of the new version of the file. Only valid while
+--- evaluating 'diffexpr'.
+--- @type string
+vim.v.fname_new = ...
+
+--- The name of the output file. Only valid while
+--- evaluating:
+--- option used for ~
+--- 'charconvert' resulting converted file [1]
+--- 'diffexpr' output of diff
+--- 'patchexpr' resulting patched file
+--- [1] When doing conversion for a write command (e.g., ":w
+--- file") it will be equal to v:fname_in. When doing conversion
+--- for a read command (e.g., ":e file") it will be a temporary
+--- file and different from v:fname_in.
+--- @type string
+vim.v.fname_out = ...
+
+--- Used for 'foldtext': dashes representing foldlevel of a closed
+--- fold.
+--- Read-only in the `sandbox`. `fold-foldtext`
+--- @type string
+vim.v.folddashes = ...
+
+--- Used for 'foldtext': last line of closed fold.
+--- Read-only in the `sandbox`. `fold-foldtext`
+--- @type integer
+vim.v.foldend = ...
+
+--- Used for 'foldtext': foldlevel of closed fold.
+--- Read-only in the `sandbox`. `fold-foldtext`
+--- @type integer
+vim.v.foldlevel = ...
+
+--- Used for 'foldtext': first line of closed fold.
+--- Read-only in the `sandbox`. `fold-foldtext`
+--- @type integer
+vim.v.foldstart = ...
+
+--- Variable that indicates whether search highlighting is on.
+--- Setting it makes sense only if 'hlsearch' is enabled. Setting
+--- this variable to zero acts like the `:nohlsearch` command,
+--- setting it to one acts like
+---
+--- ```vim
+--- let &hlsearch = &hlsearch
+--- ```
+---
+--- Note that the value is restored when returning from a
+--- function. `function-search-undo`.
+--- @type integer
+vim.v.hlsearch = ...
+
+--- Used for the `InsertEnter` and `InsertChange` autocommand
+--- events. Values:
+--- i Insert mode
+--- r Replace mode
+--- v Virtual Replace mode
+--- @type string
+vim.v.insertmode = ...
+
+--- Key of the current item of a `Dictionary`. Only valid while
+--- evaluating the expression used with `map()` and `filter()`.
+--- Read-only.
+--- @type string
+vim.v.key = ...
+
+--- The current locale setting for messages of the runtime
+--- environment. This allows Vim scripts to be aware of the
+--- current language. Technical: it's the value of LC_MESSAGES.
+--- The value is system dependent.
+--- This variable can not be set directly, use the `:language`
+--- command.
+--- It can be different from `v:ctype` when messages are desired
+--- in a different language than what is used for character
+--- encoding. See `multi-lang`.
+--- @type string
+vim.v.lang = ...
+
+--- The current locale setting for time messages of the runtime
+--- environment. This allows Vim scripts to be aware of the
+--- current language. Technical: it's the value of LC_TIME.
+--- This variable can not be set directly, use the `:language`
+--- command. See `multi-lang`.
+--- @type string
+vim.v.lc_time = ...
+
+--- Line number for the 'foldexpr' `fold-expr`, 'formatexpr',
+--- 'indentexpr' and 'statuscolumn' expressions, tab page number
+--- for 'guitablabel' and 'guitabtooltip'. Only valid while one of
+--- these expressions is being evaluated. Read-only when in the
+--- `sandbox`.
+--- @type integer
+vim.v.lnum = ...
+
+--- Prefix for calling Lua functions from expressions.
+--- See `v:lua-call` for more information.
+--- @type any
+vim.v.lua = ...
+
+--- Maximum line length. Depending on where it is used it can be
+--- screen columns, characters or bytes. The value currently is
+--- 2147483647 on all systems.
+--- @type integer
+vim.v.maxcol = ...
+
+--- Column number for a mouse click obtained with `getchar()`.
+--- This is the screen column number, like with `virtcol()`. The
+--- value is zero when there was no mouse button click.
+--- @type integer
+vim.v.mouse_col = ...
+
+--- Line number for a mouse click obtained with `getchar()`.
+--- This is the text line number, not the screen line number. The
+--- value is zero when there was no mouse button click.
+--- @type integer
+vim.v.mouse_lnum = ...
+
+--- Window number for a mouse click obtained with `getchar()`.
+--- First window has number 1, like with `winnr()`. The value is
+--- zero when there was no mouse button click.
+--- @type integer
+vim.v.mouse_win = ...
+
+--- `window-ID` for a mouse click obtained with `getchar()`.
+--- The value is zero when there was no mouse button click.
+--- @type integer
+vim.v.mouse_winid = ...
+
+--- Dictionary containing msgpack types used by `msgpackparse()`
+--- and `msgpackdump()`. All types inside dictionary are fixed
+--- (not editable) empty lists. To check whether some list is one
+--- of msgpack types, use `is` operator.
+--- @type any
+vim.v.msgpack_types = ...
+
+--- Special value used to put "null" in JSON and NIL in msgpack.
+--- See `json_encode()`. This value is converted to "v:null" when
+--- used as a String (e.g. in `expr5` with string concatenation
+--- operator) and to zero when used as a Number (e.g. in `expr5`
+--- or `expr7` when used with numeric operators). Read-only.
+--- In some places `v:null` can be used for a List, Dict, etc.
+--- that is not set. That is slightly different than an empty
+--- List, Dict, etc.
+--- @type vim.NIL
+vim.v.null = ...
+
+--- Maximum value of a number.
+--- @type integer
+vim.v.numbermax = ...
+
+--- Minimum value of a number (negative).
+--- @type integer
+vim.v.numbermin = ...
+
+--- Number of bits in a Number. This is normally 64, but on some
+--- systems it may be 32.
+--- @type integer
+vim.v.numbersize = ...
+
+--- List of file names that is loaded from the `shada` file on
+--- startup. These are the files that Vim remembers marks for.
+--- The length of the List is limited by the ' argument of the
+--- 'shada' option (default is 100).
+--- When the `shada` file is not used the List is empty.
+--- Also see `:oldfiles` and `c_#<`.
+--- The List can be modified, but this has no effect on what is
+--- stored in the `shada` file later. If you use values other
+--- than String this will cause trouble.
+--- @type string[]
+vim.v.oldfiles = ...
+
+--- The last operator given in Normal mode. This is a single
+--- character except for commands starting with <g> or <z>,
+--- in which case it is two characters. Best used alongside
+--- `v:prevcount` and `v:register`. Useful if you want to cancel
+--- Operator-pending mode and then use the operator, e.g.:
+---
+--- ```vim
+--- :omap O <Esc>:call MyMotion(v:operator)<CR>
+--- ```
+---
+--- The value remains set until another operator is entered, thus
+--- don't expect it to be empty.
+--- v:operator is not set for `:delete`, `:yank` or other Ex
+--- commands.
+--- Read-only.
+--- @type string
+vim.v.operator = ...
+
+--- Command used to set the option. Valid while executing an
+--- `OptionSet` autocommand.
+--- value option was set via ~
+--- "setlocal" `:setlocal` or `:let l:xxx`
+--- "setglobal" `:setglobal` or `:let g:xxx`
+--- "set" `:set` or `:let`
+--- "modeline" `modeline`
+--- @type string
+vim.v.option_command = ...
+
+--- New value of the option. Valid while executing an `OptionSet`
+--- autocommand.
+--- @type any
+vim.v.option_new = ...
+
+--- Old value of the option. Valid while executing an `OptionSet`
+--- autocommand. Depending on the command used for setting and the
+--- kind of option this is either the local old value or the
+--- global old value.
+--- @type any
+vim.v.option_old = ...
+
+--- Old global value of the option. Valid while executing an
+--- `OptionSet` autocommand.
+--- @type any
+vim.v.option_oldglobal = ...
+
+--- Old local value of the option. Valid while executing an
+--- `OptionSet` autocommand.
+--- @type any
+vim.v.option_oldlocal = ...
+
+--- Scope of the set command. Valid while executing an
+--- `OptionSet` autocommand. Can be either "global" or "local"
+--- @type string
+vim.v.option_type = ...
+
+--- The count given for the last but one Normal mode command.
+--- This is the v:count value of the previous command. Useful if
+--- you want to cancel Visual or Operator-pending mode and then
+--- use the count, e.g.:
+---
+--- ```vim
+--- :vmap % <Esc>:call MyFilter(v:prevcount)<CR>
+--- ```
+---
+--- Read-only.
+--- @type integer
+vim.v.prevcount = ...
+
+--- Normally zero. Set to one after using ":profile start".
+--- See `profiling`.
+--- @type integer
+vim.v.profiling = ...
+
+--- The name by which Nvim was invoked (with path removed).
+--- Read-only.
+--- @type string
+vim.v.progname = ...
+
+--- Absolute path to the current running Nvim.
+--- Read-only.
+--- @type string
+vim.v.progpath = ...
+
+--- The name of the register in effect for the current normal mode
+--- command (regardless of whether that command actually used a
+--- register). Or for the currently executing normal mode mapping
+--- (use this in custom commands that take a register).
+--- If none is supplied it is the default register '"', unless
+--- 'clipboard' contains "unnamed" or "unnamedplus", then it is
+--- "*" or '+'.
+--- Also see `getreg()` and `setreg()`
+--- @type string
+vim.v.register = ...
+
+--- Relative line number for the 'statuscolumn' expression.
+--- Read-only.
+--- @type integer
+vim.v.relnum = ...
+
+--- String describing the script or function that caused the
+--- screen to scroll up. It's only set when it is empty, thus the
+--- first reason is remembered. It is set to "Unknown" for a
+--- typed command.
+--- This can be used to find out why your script causes the
+--- hit-enter prompt.
+--- @type any
+vim.v.scrollstart = ...
+
+--- Search direction: 1 after a forward search, 0 after a
+--- backward search. It is reset to forward when directly setting
+--- the last search pattern, see `quote/`.
+--- Note that the value is restored when returning from a
+--- function. `function-search-undo`.
+--- Read-write.
+--- @type integer
+vim.v.searchforward = ...
+
+--- Primary listen-address of Nvim, the first item returned by
+--- `serverlist()`. Usually this is the named pipe created by Nvim
+--- at `startup` or given by `--listen` (or the deprecated
+--- `$NVIM_LISTEN_ADDRESS` env var).
+---
+--- See also `serverstart()` `serverstop()`.
+--- Read-only.
+---
+--- *$NVIM*
+--- $NVIM is set by `terminal` and `jobstart()`, and is thus
+--- a hint that the current environment is a subprocess of Nvim.
+--- Example:
+---
+--- ```vim
+--- if $NVIM
+--- echo nvim_get_chan_info(v:parent)
+--- endif
+--- ```
+---
+--- Note the contents of $NVIM may change in the future.
+--- @type string
+vim.v.servername = ...
+
+--- Result of the last shell command. When non-zero, the last
+--- shell command had an error. When zero, there was no problem.
+--- This only works when the shell returns the error code to Vim.
+--- The value -1 is often used when the command could not be
+--- executed. Read-only.
+--- Example:
+---
+--- ```vim
+--- !mv foo bar
+--- if v:shell_error
+--- echo 'could not rename "foo" to "bar"!'
+--- endif
+--- ```
+--- @type integer
+vim.v.shell_error = ...
+
+--- Last given status message.
+--- Modifiable (can be set).
+--- @type string
+vim.v.statusmsg = ...
+
+--- `channel-id` corresponding to stderr. The value is always 2;
+--- use this variable to make your code more descriptive.
+--- Unlike stdin and stdout (see `stdioopen()`), stderr is always
+--- open for writing. Example:
+---
+--- ```vim
+--- :call chansend(v:stderr, "error: toaster empty\n")
+--- ```
+--- @type integer
+vim.v.stderr = ...
+
+--- `SwapExists` autocommands can set this to the selected choice
+--- for handling an existing swapfile:
+--- 'o' Open read-only
+--- 'e' Edit anyway
+--- 'r' Recover
+--- 'd' Delete swapfile
+--- 'q' Quit
+--- 'a' Abort
+--- The value should be a single-character string. An empty value
+--- results in the user being asked, as would happen when there is
+--- no SwapExists autocommand. The default is empty.
+--- @type string
+vim.v.swapchoice = ...
+
+--- Normal mode command to be executed after a file has been
+--- opened. Can be used for a `SwapExists` autocommand to have
+--- another Vim open the file and jump to the right place. For
+--- example, when jumping to a tag the value is ":tag tagname\r".
+--- For ":edit +cmd file" the value is ":cmd\r".
+--- @type string
+vim.v.swapcommand = ...
+
+--- Name of the swapfile found.
+--- Only valid during `SwapExists` event.
+--- Read-only.
+--- @type string
+vim.v.swapname = ...
+
+--- Value of `Blob` type. Read-only. See: `type()`
+--- @type integer
+vim.v.t_blob = ...
+
+--- Value of `Boolean` type. Read-only. See: `type()`
+--- @type integer
+vim.v.t_bool = ...
+
+--- Value of `Dictionary` type. Read-only. See: `type()`
+--- @type integer
+vim.v.t_dict = ...
+
+--- Value of `Float` type. Read-only. See: `type()`
+--- @type integer
+vim.v.t_float = ...
+
+--- Value of `Funcref` type. Read-only. See: `type()`
+--- @type integer
+vim.v.t_func = ...
+
+--- Value of `List` type. Read-only. See: `type()`
+--- @type integer
+vim.v.t_list = ...
+
+--- Value of `Number` type. Read-only. See: `type()`
+--- @type integer
+vim.v.t_number = ...
+
+--- Value of `String` type. Read-only. See: `type()`
+--- @type integer
+vim.v.t_string = ...
+
+--- The value of the most recent OSC or DCS control sequence
+--- sent from a process running in the embedded `terminal`.
+--- This can be read in a `TermRequest` event handler to respond
+--- to queries from embedded applications.
+--- @type string
+vim.v.termrequest = ...
+
+--- The value of the most recent OSC or DCS control sequence
+--- received by Nvim from the terminal. This can be read in a
+--- `TermResponse` event handler after querying the terminal using
+--- another escape sequence.
+--- @type string
+vim.v.termresponse = ...
+
+--- Must be set before using `test_garbagecollect_now()`.
+--- @type any
+vim.v.testing = ...
+
+--- Full filename of the last loaded or saved session file.
+--- Empty when no session file has been saved. See `:mksession`.
+--- Modifiable (can be set).
+--- @type any
+vim.v.this_session = ...
+
+--- The point where the exception most recently caught and not
+--- finished was thrown. Not set when commands are typed. See
+--- also `v:exception` and `throw-variables`.
+--- Example:
+---
+--- ```vim
+--- try
+--- throw "oops"
+--- catch /.*/
+--- echo "Exception from" v:throwpoint
+--- endtry
+--- ```
+---
+--- Output: "Exception from test.vim, line 2"
+--- @type any
+vim.v.throwpoint = ...
+
+--- Special value used to put "true" in JSON and msgpack. See
+--- `json_encode()`. This value is converted to "v:true" when used
+--- as a String (e.g. in `expr5` with string concatenation
+--- operator) and to one when used as a Number (e.g. in `expr5` or
+--- `expr7` when used with numeric operators). Read-only.
+--- @type boolean
+vim.v['true'] = ...
+
+--- Value of the current item of a `List` or `Dictionary`. Only
+--- valid while evaluating the expression used with `map()` and
+--- `filter()`. Read-only.
+--- @type any
+vim.v.val = ...
+
+--- Vim version number: major version times 100 plus minor
+--- version. Vim 5.0 is 500, Vim 5.1 is 501.
+--- Read-only.
+--- Use `has()` to check the Nvim (not Vim) version:
+---
+--- ```vim
+--- :if has("nvim-0.2.1")
+--- ```
+--- @type integer
+vim.v.version = ...
+
+--- 0 during startup, 1 just before `VimEnter`.
+--- Read-only.
+--- @type integer
+vim.v.vim_did_enter = ...
+
+--- Virtual line number for the 'statuscolumn' expression.
+--- Negative when drawing the status column for virtual lines, zero
+--- when drawing an actual buffer line, and positive when drawing
+--- the wrapped part of a buffer line.
+--- Read-only.
+--- @type integer
+vim.v.virtnum = ...
+
+--- Last given warning message.
+--- Modifiable (can be set).
+--- @type string
+vim.v.warningmsg = ...
+
+--- Application-specific window "handle" which may be set by any
+--- attached UI. Defaults to zero.
+--- Note: For Nvim `windows` use `winnr()` or `win_getid()`, see
+--- `window-ID`.
+--- @type integer
+vim.v.windowid = ...
diff --git a/runtime/lua/vim/_options.lua b/runtime/lua/vim/_options.lua
index b83a8dd4b1..13ad6cc58f 100644
--- a/runtime/lua/vim/_options.lua
+++ b/runtime/lua/vim/_options.lua
@@ -1,12 +1,10 @@
----@defgroup lua-vimscript
+--- @brief Nvim Lua provides an interface or "bridge" to Vimscript variables and
+--- functions, and editor commands and options.
---
----@brief Nvim Lua provides an interface or "bridge" to Vimscript variables and
----functions, and editor commands and options.
----
----Objects passed over this bridge are COPIED (marshalled): there are no
----"references". |lua-guide-variables| For example, using \`vim.fn.remove()\` on
----a Lua list copies the list object to Vimscript and does NOT modify the Lua
----list:
+--- Objects passed over this bridge are COPIED (marshalled): there are no
+--- "references". |lua-guide-variables| For example, using `vim.fn.remove()` on
+--- a Lua list copies the list object to Vimscript and does NOT modify the Lua
+--- list:
---
--- ```lua
--- local list = { 1, 2, 3 }
@@ -14,86 +12,85 @@
--- vim.print(list) --> "{ 1, 2, 3 }"
--- ```
----@addtogroup lua-vimscript
----@brief <pre>help
----vim.call({func}, {...}) *vim.call()*
---- Invokes |vim-function| or |user-function| {func} with arguments {...}.
---- See also |vim.fn|.
---- Equivalent to: >lua
---- vim.fn[func]({...})
----<
----vim.cmd({command})
---- See |vim.cmd()|.
----
----vim.fn.{func}({...}) *vim.fn*
---- Invokes |vim-function| or |user-function| {func} with arguments {...}.
---- To call autoload functions, use the syntax: >lua
---- vim.fn['some\#function']({...})
----<
---- Unlike vim.api.|nvim_call_function()| this converts directly between Vim
---- objects and Lua objects. If the Vim function returns a float, it will be
---- represented directly as a Lua number. Empty lists and dictionaries both
---- are represented by an empty table.
----
---- Note: |v:null| values as part of the return value is represented as
---- |vim.NIL| special value
----
---- Note: vim.fn keys are generated lazily, thus `pairs(vim.fn)` only
---- enumerates functions that were called at least once.
----
---- Note: The majority of functions cannot run in |api-fast| callbacks with some
---- undocumented exceptions which are allowed.
----
---- *lua-vim-variables*
----The Vim editor global dictionaries |g:| |w:| |b:| |t:| |v:| can be accessed
----from Lua conveniently and idiomatically by referencing the `vim.*` Lua tables
----described below. In this way you can easily read and modify global Vimscript
----variables from Lua.
----
----Example: >lua
----
---- vim.g.foo = 5 -- Set the g:foo Vimscript variable.
---- print(vim.g.foo) -- Get and print the g:foo Vimscript variable.
---- vim.g.foo = nil -- Delete (:unlet) the Vimscript variable.
---- vim.b[2].foo = 6 -- Set b:foo for buffer 2
----<
----
----Note that setting dictionary fields directly will not write them back into
----Nvim. This is because the index into the namespace simply returns a copy.
----Instead the whole dictionary must be written as one. This can be achieved by
----creating a short-lived temporary.
----
----Example: >lua
----
---- vim.g.my_dict.field1 = 'value' -- Does not work
----
---- local my_dict = vim.g.my_dict --
---- my_dict.field1 = 'value' -- Instead do
---- vim.g.my_dict = my_dict --
----
----vim.g *vim.g*
---- Global (|g:|) editor variables.
---- Key with no value returns `nil`.
----
----vim.b *vim.b*
---- Buffer-scoped (|b:|) variables for the current buffer.
---- Invalid or unset key returns `nil`. Can be indexed with
---- an integer to access variables for a specific buffer.
----
----vim.w *vim.w*
---- Window-scoped (|w:|) variables for the current window.
---- Invalid or unset key returns `nil`. Can be indexed with
---- an integer to access variables for a specific window.
----
----vim.t *vim.t*
---- Tabpage-scoped (|t:|) variables for the current tabpage.
---- Invalid or unset key returns `nil`. Can be indexed with
---- an integer to access variables for a specific tabpage.
----
----vim.v *vim.v*
---- |v:| variables.
---- Invalid or unset key returns `nil`.
----</pre>
+--- @brief <pre>help
+--- vim.call({func}, {...}) *vim.call()*
+--- Invokes |vim-function| or |user-function| {func} with arguments {...}.
+--- See also |vim.fn|.
+--- Equivalent to: >lua
+--- vim.fn[func]({...})
+--- <
+--- vim.cmd({command})
+--- See |vim.cmd()|.
+---
+--- vim.fn.{func}({...}) *vim.fn*
+--- Invokes |vim-function| or |user-function| {func} with arguments {...}.
+--- To call autoload functions, use the syntax: >lua
+--- vim.fn['some#function']({...})
+--- <
+--- Unlike vim.api.|nvim_call_function()| this converts directly between Vim
+--- objects and Lua objects. If the Vim function returns a float, it will be
+--- represented directly as a Lua number. Empty lists and dictionaries both
+--- are represented by an empty table.
+---
+--- Note: |v:null| values as part of the return value is represented as
+--- |vim.NIL| special value
+---
+--- Note: vim.fn keys are generated lazily, thus `pairs(vim.fn)` only
+--- enumerates functions that were called at least once.
+---
+--- Note: The majority of functions cannot run in |api-fast| callbacks with some
+--- undocumented exceptions which are allowed.
+---
+--- *lua-vim-variables*
+--- The Vim editor global dictionaries |g:| |w:| |b:| |t:| |v:| can be accessed
+--- from Lua conveniently and idiomatically by referencing the `vim.*` Lua tables
+--- described below. In this way you can easily read and modify global Vimscript
+--- variables from Lua.
+---
+--- Example: >lua
+---
+--- vim.g.foo = 5 -- Set the g:foo Vimscript variable.
+--- print(vim.g.foo) -- Get and print the g:foo Vimscript variable.
+--- vim.g.foo = nil -- Delete (:unlet) the Vimscript variable.
+--- vim.b[2].foo = 6 -- Set b:foo for buffer 2
+--- <
+---
+--- Note that setting dictionary fields directly will not write them back into
+--- Nvim. This is because the index into the namespace simply returns a copy.
+--- Instead the whole dictionary must be written as one. This can be achieved by
+--- creating a short-lived temporary.
+---
+--- Example: >lua
+---
+--- vim.g.my_dict.field1 = 'value' -- Does not work
+---
+--- local my_dict = vim.g.my_dict --
+--- my_dict.field1 = 'value' -- Instead do
+--- vim.g.my_dict = my_dict --
+---
+--- vim.g *vim.g*
+--- Global (|g:|) editor variables.
+--- Key with no value returns `nil`.
+---
+--- vim.b *vim.b*
+--- Buffer-scoped (|b:|) variables for the current buffer.
+--- Invalid or unset key returns `nil`. Can be indexed with
+--- an integer to access variables for a specific buffer.
+---
+--- vim.w *vim.w*
+--- Window-scoped (|w:|) variables for the current window.
+--- Invalid or unset key returns `nil`. Can be indexed with
+--- an integer to access variables for a specific window.
+---
+--- vim.t *vim.t*
+--- Tabpage-scoped (|t:|) variables for the current tabpage.
+--- Invalid or unset key returns `nil`. Can be indexed with
+--- an integer to access variables for a specific tabpage.
+---
+--- vim.v *vim.v*
+--- |v:| variables.
+--- Invalid or unset key returns `nil`.
+--- </pre>
local api = vim.api
@@ -108,6 +105,10 @@ local key_value_options = {
winhl = true,
}
+--- @nodoc
+--- @class vim._option.Info : vim.api.keyset.get_option_info
+--- @field metatype 'boolean'|'string'|'number'|'map'|'array'|'set'
+
--- Convert a vimoption_T style dictionary to the correct OptionType associated with it.
---@return string
local function get_option_metatype(name, info)
@@ -126,8 +127,10 @@ local function get_option_metatype(name, info)
end
--- @param name string
+--- @return vim._option.Info
local function get_options_info(name)
local info = api.nvim_get_option_info2(name, {})
+ --- @cast info vim._option.Info
info.metatype = get_option_metatype(name, info)
return info
end
@@ -142,8 +145,6 @@ end
--- vim.env.FOO = 'bar'
--- print(vim.env.TERM)
--- ```
----
----@param var string
vim.env = setmetatable({}, {
__index = function(_, k)
local v = vim.fn.getenv(k)
@@ -205,31 +206,30 @@ local function new_win_opt_accessor(winid, bufnr)
})
end
----@addtogroup lua-vimscript
----@brief <pre>help
----` ` *lua-options*
---- *lua-vim-options*
---- *lua-vim-set*
---- *lua-vim-setlocal*
+--- @brief <pre>help
+--- *lua-options*
+--- *lua-vim-options*
+--- *lua-vim-set*
+--- *lua-vim-setlocal*
---
----Vim options can be accessed through |vim.o|, which behaves like Vimscript
----|:set|.
+--- Vim options can be accessed through |vim.o|, which behaves like Vimscript
+--- |:set|.
---
---- Examples: ~
+--- Examples: ~
---
---- To set a boolean toggle:
---- Vimscript: `set number`
---- Lua: `vim.o.number = true`
+--- To set a boolean toggle:
+--- Vimscript: `set number`
+--- Lua: `vim.o.number = true`
---
---- To set a string value:
---- Vimscript: `set wildignore=*.o,*.a,__pycache__`
---- Lua: `vim.o.wildignore = '*.o,*.a,__pycache__'`
+--- To set a string value:
+--- Vimscript: `set wildignore=*.o,*.a,__pycache__`
+--- Lua: `vim.o.wildignore = '*.o,*.a,__pycache__'`
---
----Similarly, there is |vim.bo| and |vim.wo| for setting buffer-scoped and
----window-scoped options. Note that this must NOT be confused with
----|local-options| and |:setlocal|. There is also |vim.go| that only accesses the
----global value of a |global-local| option, see |:setglobal|.
----</pre>
+--- Similarly, there is |vim.bo| and |vim.wo| for setting buffer-scoped and
+--- window-scoped options. Note that this must NOT be confused with
+--- |local-options| and |:setlocal|. There is also |vim.go| that only accesses the
+--- global value of a |global-local| option, see |:setglobal|.
+--- </pre>
--- Get or set |options|. Like `:set`. Invalid key is an error.
---
@@ -276,10 +276,10 @@ vim.go = setmetatable({}, {
})
--- Get or set buffer-scoped |options| for the buffer with number {bufnr}.
---- Like `:set` and `:setlocal`. If [{bufnr}] is omitted then the current
---- buffer is used. Invalid {bufnr} or key is an error.
+--- If {bufnr} is omitted then the current buffer is used.
+--- Invalid {bufnr} or key is an error.
---
---- Note: this is equivalent to both `:set` and `:setlocal`.
+--- Note: this is equivalent to `:setlocal` for |global-local| options and `:set` otherwise.
---
--- Example:
---
@@ -292,9 +292,9 @@ vim.go = setmetatable({}, {
vim.bo = new_buf_opt_accessor()
--- Get or set window-scoped |options| for the window with handle {winid} and
---- buffer with number {bufnr}. Like `:setlocal` if {bufnr} is provided, like
---- `:set` otherwise. If [{winid}] is omitted then the current window is
---- used. Invalid {winid}, {bufnr} or key is an error.
+--- buffer with number {bufnr}. Like `:setlocal` if setting a |global-local| option
+--- or if {bufnr} is provided, like `:set` otherwise. If {winid} is omitted then
+--- the current window is used. Invalid {winid}, {bufnr} or key is an error.
---
--- Note: only {bufnr} with value `0` (the current buffer in the window) is
--- supported.
@@ -310,18 +310,21 @@ vim.bo = new_buf_opt_accessor()
--- ```
vim.wo = new_win_opt_accessor()
----@brief [[
--- vim.opt, vim.opt_local and vim.opt_global implementation
---
--- To be used as helpers for working with options within neovim.
--- For information on how to use, see :help vim.opt
----
----@brief ]]
--- Preserves the order and does not mutate the original list
+--- @generic T
+--- @param t T[]
+--- @return T[]
local function remove_duplicate_values(t)
+ --- @type table, table<any,true>
local result, seen = {}, {}
- for _, v in ipairs(t) do
+ for _, v in
+ ipairs(t --[[@as any[] ]])
+ do
if not seen[v] then
table.insert(result, v)
end
@@ -332,8 +335,11 @@ local function remove_duplicate_values(t)
return result
end
--- Check whether the OptionTypes is allowed for vim.opt
--- If it does not match, throw an error which indicates which option causes the error.
+--- Check whether the OptionTypes is allowed for vim.opt
+--- If it does not match, throw an error which indicates which option causes the error.
+--- @param name any
+--- @param value any
+--- @param types string[]
local function assert_valid_value(name, value, types)
local type_of_value = type(value)
for _, valid_type in ipairs(types) do
@@ -360,6 +366,8 @@ local function tbl_merge(left, right)
return vim.tbl_extend('force', left, right)
end
+--- @param t table<any,any>
+--- @param value any|any[]
local function tbl_remove(t, value)
if type(value) == 'string' then
t[value] = nil
@@ -388,6 +396,8 @@ local to_vim_value = {
number = passthrough,
string = passthrough,
+ --- @param info vim._option.Info
+ --- @param value string|table<string,true>
set = function(info, value)
if type(value) == 'string' then
return value
@@ -415,6 +425,8 @@ local to_vim_value = {
end
end,
+ --- @param info vim._option.Info
+ --- @param value string|string[]
array = function(info, value)
if type(value) == 'string' then
return value
@@ -425,6 +437,7 @@ local to_vim_value = {
return table.concat(value, ',')
end,
+ --- @param value string|table<string,string>
map = function(_, value)
if type(value) == 'string' then
return value
@@ -474,7 +487,8 @@ local to_lua_value = {
end
-- Handles unescaped commas in a list.
- if string.find(value, ',,,') then
+ if value:find(',,,') then
+ --- @type string, string
local left, right = unpack(vim.split(value, ',,,'))
local result = {}
@@ -487,8 +501,9 @@ local to_lua_value = {
return result
end
- if string.find(value, ',^,,', 1, true) then
- local left, right = unpack(vim.split(value, ',^,,', true))
+ if value:find(',^,,', 1, true) then
+ --- @type string, string
+ local left, right = unpack(vim.split(value, ',^,,', { plain = true }))
local result = {}
vim.list_extend(result, vim.split(left, ','))
@@ -516,22 +531,20 @@ local to_lua_value = {
assert(info.flaglist, 'That is the only one I know how to handle')
+ local result = {} --- @type table<string,true>
+
if info.flaglist and info.commalist then
local split_value = vim.split(value, ',')
- local result = {}
for _, v in ipairs(split_value) do
result[v] = true
end
-
- return result
else
- local result = {}
for i = 1, #value do
result[value:sub(i, i)] = true
end
-
- return result
end
+
+ return result
end,
map = function(info, raw_value)
@@ -541,10 +554,11 @@ local to_lua_value = {
assert(info.commalist, 'Only commas are supported currently')
- local result = {}
+ local result = {} --- @type table<string,string>
local comma_split = vim.split(raw_value, ',')
for _, key_value_str in ipairs(comma_split) do
+ --- @type string, string
local key, value = unpack(vim.split(key_value_str, ':'))
key = vim.trim(key)
@@ -590,14 +604,21 @@ local function prepend_value(info, current, new)
end
local add_methods = {
+ --- @param left integer
+ --- @param right integer
number = function(left, right)
return left + right
end,
+ --- @param left string
+ --- @param right string
string = function(left, right)
return left .. right
end,
+ --- @param left string[]
+ --- @param right string[]
+ --- @return string[]
array = function(left, right)
for _, v in ipairs(right) do
table.insert(left, v)
@@ -618,6 +639,8 @@ local function add_value(info, current, new)
)
end
+--- @param t table<any,any>
+--- @param val any
local function remove_one_item(t, val)
if vim.tbl_islist(t) then
local remove_index = nil
@@ -636,6 +659,8 @@ local function remove_one_item(t, val)
end
local remove_methods = {
+ --- @param left integer
+ --- @param right integer
number = function(left, right)
return left - right
end,
@@ -644,6 +669,9 @@ local remove_methods = {
error('Subtraction not supported for strings.')
end,
+ --- @param left string[]
+ --- @param right string[]
+ --- @return string[]
array = function(left, right)
if type(right) == 'string' then
remove_one_item(left, right)
@@ -739,74 +767,74 @@ local function create_option_accessor(scope)
})
end
----@addtogroup lua-vimscript
----@brief <pre>help
----` ` *vim.opt_local*
---- *vim.opt_global*
---- *vim.opt*
----
----
----A special interface |vim.opt| exists for conveniently interacting with list-
----and map-style option from Lua: It allows accessing them as Lua tables and
----offers object-oriented method for adding and removing entries.
----
---- Examples: ~
----
---- The following methods of setting a list-style option are equivalent:
---- In Vimscript: >vim
---- set wildignore=*.o,*.a,__pycache__
----<
---- In Lua using `vim.o`: >lua
---- vim.o.wildignore = '*.o,*.a,__pycache__'
----<
---- In Lua using `vim.opt`: >lua
---- vim.opt.wildignore = { '*.o', '*.a', '__pycache__' }
----<
---- To replicate the behavior of |:set+=|, use: >lua
----
---- vim.opt.wildignore:append { "*.pyc", "node_modules" }
----<
---- To replicate the behavior of |:set^=|, use: >lua
----
---- vim.opt.wildignore:prepend { "new_first_value" }
----<
---- To replicate the behavior of |:set-=|, use: >lua
----
---- vim.opt.wildignore:remove { "node_modules" }
----<
---- The following methods of setting a map-style option are equivalent:
---- In Vimscript: >vim
---- set listchars=space:_,tab:>~
----<
---- In Lua using `vim.o`: >lua
---- vim.o.listchars = 'space:_,tab:>~'
----<
---- In Lua using `vim.opt`: >lua
---- vim.opt.listchars = { space = '_', tab = '>~' }
----<
----
----Note that |vim.opt| returns an `Option` object, not the value of the option,
----which is accessed through |vim.opt:get()|:
----
---- Examples: ~
----
---- The following methods of getting a list-style option are equivalent:
---- In Vimscript: >vim
---- echo wildignore
----<
---- In Lua using `vim.o`: >lua
---- print(vim.o.wildignore)
----<
---- In Lua using `vim.opt`: >lua
---- vim.print(vim.opt.wildignore:get())
----<
----
----In any of the above examples, to replicate the behavior |:setlocal|, use
----`vim.opt_local`. Additionally, to replicate the behavior of |:setglobal|, use
----`vim.opt_global`.
----</pre>
-
---- @diagnostic disable-next-line:unused-local used for gen_vimdoc
+--- @brief <pre>help
+--- *vim.opt_local*
+--- *vim.opt_global*
+--- *vim.opt*
+---
+---
+--- A special interface |vim.opt| exists for conveniently interacting with list-
+--- and map-style option from Lua: It allows accessing them as Lua tables and
+--- offers object-oriented method for adding and removing entries.
+---
+--- Examples: ~
+---
+--- The following methods of setting a list-style option are equivalent:
+--- In Vimscript: >vim
+--- set wildignore=*.o,*.a,__pycache__
+--- <
+--- In Lua using `vim.o`: >lua
+--- vim.o.wildignore = '*.o,*.a,__pycache__'
+--- <
+--- In Lua using `vim.opt`: >lua
+--- vim.opt.wildignore = { '*.o', '*.a', '__pycache__' }
+--- <
+--- To replicate the behavior of |:set+=|, use: >lua
+---
+--- vim.opt.wildignore:append { "*.pyc", "node_modules" }
+--- <
+--- To replicate the behavior of |:set^=|, use: >lua
+---
+--- vim.opt.wildignore:prepend { "new_first_value" }
+--- <
+--- To replicate the behavior of |:set-=|, use: >lua
+---
+--- vim.opt.wildignore:remove { "node_modules" }
+--- <
+--- The following methods of setting a map-style option are equivalent:
+--- In Vimscript: >vim
+--- set listchars=space:_,tab:>~
+--- <
+--- In Lua using `vim.o`: >lua
+--- vim.o.listchars = 'space:_,tab:>~'
+--- <
+--- In Lua using `vim.opt`: >lua
+--- vim.opt.listchars = { space = '_', tab = '>~' }
+--- <
+---
+--- Note that |vim.opt| returns an `Option` object, not the value of the option,
+--- which is accessed through |vim.opt:get()|:
+---
+--- Examples: ~
+---
+--- The following methods of getting a list-style option are equivalent:
+--- In Vimscript: >vim
+--- echo wildignore
+--- <
+--- In Lua using `vim.o`: >lua
+--- print(vim.o.wildignore)
+--- <
+--- In Lua using `vim.opt`: >lua
+--- vim.print(vim.opt.wildignore:get())
+--- <
+---
+--- In any of the above examples, to replicate the behavior |:setlocal|, use
+--- `vim.opt_local`. Additionally, to replicate the behavior of |:setglobal|, use
+--- `vim.opt_global`.
+--- </pre>
+
+--- @nodoc
+--- @class vim.Option
local Option = {} -- luacheck: no unused
--- Returns a Lua-representation of the option. Boolean, number and string
@@ -856,9 +884,7 @@ local Option = {} -- luacheck: no unused
--- print("J is enabled!")
--- end
--- ```
----
---@return string|integer|boolean|nil value of option
----@diagnostic disable-next-line:unused-local used for gen_vimdoc
function Option:get() end
--- Append a value to string-style options. See |:set+=|
@@ -869,7 +895,6 @@ function Option:get() end
--- vim.opt.formatoptions:append('j')
--- vim.opt.formatoptions = vim.opt.formatoptions + 'j'
--- ```
----
---@param value string Value to append
---@diagnostic disable-next-line:unused-local used for gen_vimdoc
function Option:append(value) end -- luacheck: no unused
@@ -882,7 +907,6 @@ function Option:append(value) end -- luacheck: no unused
--- vim.opt.wildignore:prepend('*.o')
--- vim.opt.wildignore = vim.opt.wildignore ^ '*.o'
--- ```
----
---@param value string Value to prepend
---@diagnostic disable-next-line:unused-local used for gen_vimdoc
function Option:prepend(value) end -- luacheck: no unused
@@ -895,7 +919,6 @@ function Option:prepend(value) end -- luacheck: no unused
--- vim.opt.wildignore:remove('*.pyc')
--- vim.opt.wildignore = vim.opt.wildignore - '*.pyc'
--- ```
----
---@param value string Value to remove
---@diagnostic disable-next-line:unused-local used for gen_vimdoc
function Option:remove(value) end -- luacheck: no unused
diff --git a/runtime/lua/vim/_system.lua b/runtime/lua/vim/_system.lua
index 9279febddf..e97a5fc6c3 100644
--- a/runtime/lua/vim/_system.lua
+++ b/runtime/lua/vim/_system.lua
@@ -1,6 +1,6 @@
local uv = vim.uv
---- @class SystemOpts
+--- @class vim.SystemOpts
--- @field stdin? string|string[]|true
--- @field stdout? fun(err:string?, data: string?)|false
--- @field stderr? fun(err:string?, data: string?)|false
@@ -61,7 +61,7 @@ end
--- @field wait fun(self: vim.SystemObj, timeout?: integer): vim.SystemCompleted
--- @field kill fun(self: vim.SystemObj, signal: integer|string)
--- @field write fun(self: vim.SystemObj, data?: string|string[])
---- @field is_closing fun(self: vim.SystemObj): boolean?
+--- @field is_closing fun(self: vim.SystemObj): boolean
local SystemObj = {}
--- @param state vim.SystemState
@@ -94,14 +94,14 @@ function SystemObj:wait(timeout)
local done = vim.wait(timeout or state.timeout or MAX_TIMEOUT, function()
return state.result ~= nil
- end)
+ end, nil, true)
if not done then
-- Send sigkill since this cannot be caught
self:_timeout(SIG.KILL)
vim.wait(timeout or state.timeout or MAX_TIMEOUT, function()
return state.result ~= nil
- end)
+ end, nil, true)
end
return state.result
@@ -140,7 +140,7 @@ end
--- @return boolean
function SystemObj:is_closing()
local handle = self._state.handle
- return handle == nil or handle:is_closing()
+ return handle == nil or handle:is_closing() or false
end
---@param output fun(err:string?, data: string?)|false
@@ -302,7 +302,7 @@ end
--- Run a system command
---
--- @param cmd string[]
---- @param opts? SystemOpts
+--- @param opts? vim.SystemOpts
--- @param on_exit? fun(out: vim.SystemCompleted)
--- @return vim.SystemObj
function M.run(cmd, opts, on_exit)
diff --git a/runtime/lua/vim/_watch.lua b/runtime/lua/vim/_watch.lua
index 43fce3bf7f..97c5481ad1 100644
--- a/runtime/lua/vim/_watch.lua
+++ b/runtime/lua/vim/_watch.lua
@@ -1,45 +1,61 @@
-local M = {}
local uv = vim.uv
----@enum vim._watch.FileChangeType
-local FileChangeType = {
+local M = {}
+
+--- @enum vim._watch.FileChangeType
+--- Types of events watchers will emit.
+M.FileChangeType = {
Created = 1,
Changed = 2,
Deleted = 3,
}
---- Enumeration describing the types of events watchers will emit.
-M.FileChangeType = vim.tbl_add_reverse_lookup(FileChangeType)
-
---- Joins filepath elements by static '/' separator
+--- @class vim._watch.Opts
---
----@param ... (string) The path elements.
----@return string
-local function filepath_join(...)
- return table.concat({ ... }, '/')
-end
-
---- Stops and closes a libuv |uv_fs_event_t| or |uv_fs_poll_t| handle
+--- @field debounce? integer ms
+---
+--- An |lpeg| pattern. Only changes to files whose full paths match the pattern
+--- will be reported. Only matches against non-directoriess, all directories will
+--- be watched for new potentially-matching files. exclude_pattern can be used to
+--- filter out directories. When nil, matches any file name.
+--- @field include_pattern? vim.lpeg.Pattern
---
----@param handle (uv.uv_fs_event_t|uv.uv_fs_poll_t) The handle to stop
-local function stop(handle)
- local _, stop_err = handle:stop()
- assert(not stop_err, stop_err)
- local is_closing, close_err = handle:is_closing()
- assert(not close_err, close_err)
- if not is_closing then
- handle:close()
+--- An |lpeg| pattern. Only changes to files and directories whose full path does
+--- not match the pattern will be reported. Matches against both files and
+--- directories. When nil, matches nothing.
+--- @field exclude_pattern? vim.lpeg.Pattern
+
+--- @alias vim._watch.Callback fun(path: string, change_type: vim._watch.FileChangeType)
+
+--- @class vim._watch.watch.Opts : vim._watch.Opts
+--- @field uvflags? uv.fs_event_start.flags
+
+--- @param path string
+--- @param opts? vim._watch.Opts
+local function skip(path, opts)
+ if not opts then
+ return false
+ end
+
+ if opts.include_pattern and opts.include_pattern:match(path) == nil then
+ return true
+ end
+
+ if opts.exclude_pattern and opts.exclude_pattern:match(path) ~= nil then
+ return true
end
+
+ return false
end
--- Initializes and starts a |uv_fs_event_t|
---
----@param path (string) The path to watch
----@param opts (table|nil) Additional options
---- - uvflags (table|nil)
---- Same flags as accepted by |uv.fs_event_start()|
----@param callback (function) The function called when new events
----@return (function) Stops the watcher
+--- @param path string The path to watch
+--- @param opts vim._watch.watch.Opts? Additional options:
+--- - uvflags (table|nil)
+--- Same flags as accepted by |uv.fs_event_start()|
+--- @param callback vim._watch.Callback Callback for new events
+--- @return fun() cancel Stops the watcher
function M.watch(path, opts, callback)
vim.validate({
path = { path, 'string', false },
@@ -47,110 +63,120 @@ function M.watch(path, opts, callback)
callback = { callback, 'function', false },
})
+ opts = opts or {}
+
path = vim.fs.normalize(path)
local uvflags = opts and opts.uvflags or {}
- local handle, new_err = vim.uv.new_fs_event()
- assert(not new_err, new_err)
+ local handle = assert(uv.new_fs_event())
+
local _, start_err = handle:start(path, uvflags, function(err, filename, events)
assert(not err, err)
local fullpath = path
if filename then
- filename = filename:gsub('\\', '/')
- fullpath = filepath_join(fullpath, filename)
+ fullpath = vim.fs.normalize(vim.fs.joinpath(fullpath, filename))
end
- local change_type = events.change and M.FileChangeType.Changed or 0
+
+ if skip(fullpath, opts) then
+ return
+ end
+
+ --- @type vim._watch.FileChangeType
+ local change_type
if events.rename then
- local _, staterr, staterrname = vim.uv.fs_stat(fullpath)
+ local _, staterr, staterrname = uv.fs_stat(fullpath)
if staterrname == 'ENOENT' then
change_type = M.FileChangeType.Deleted
else
assert(not staterr, staterr)
change_type = M.FileChangeType.Created
end
+ elseif events.change then
+ change_type = M.FileChangeType.Changed
end
callback(fullpath, change_type)
end)
+
assert(not start_err, start_err)
+
return function()
- stop(handle)
+ local _, stop_err = handle:stop()
+ assert(not stop_err, stop_err)
+ local is_closing, close_err = handle:is_closing()
+ assert(not close_err, close_err)
+ if not is_closing then
+ handle:close()
+ end
end
end
---- @class watch.PollOpts
---- @field debounce? integer
---- @field include_pattern? vim.lpeg.Pattern
---- @field exclude_pattern? vim.lpeg.Pattern
+--- Initializes and starts a |uv_fs_event_t| recursively watching every directory underneath the
+--- directory at path.
+---
+--- @param path string The path to watch. Must refer to a directory.
+--- @param opts vim._watch.Opts? Additional options
+--- @param callback vim._watch.Callback Callback for new events
+--- @return fun() cancel Stops the watcher
+function M.watchdirs(path, opts, callback)
+ vim.validate({
+ path = { path, 'string', false },
+ opts = { opts, 'table', true },
+ callback = { callback, 'function', false },
+ })
----@param path string
----@param opts watch.PollOpts
----@param callback function Called on new events
----@return function cancel stops the watcher
-local function recurse_watch(path, opts, callback)
opts = opts or {}
local debounce = opts.debounce or 500
- local uvflags = {}
+
---@type table<string, uv.uv_fs_event_t> handle by fullpath
local handles = {}
local timer = assert(uv.new_timer())
- ---@type table[]
- local changesets = {}
-
- local function is_included(filepath)
- return opts.include_pattern and opts.include_pattern:match(filepath)
- end
- local function is_excluded(filepath)
- return opts.exclude_pattern and opts.exclude_pattern:match(filepath)
- end
+ --- Map of file path to boolean indicating if the file has been changed
+ --- at some point within the debounce cycle.
+ --- @type table<string, boolean>
+ local filechanges = {}
- local process_changes = function()
- assert(false, "Replaced later. I'm only here as forward reference")
- end
+ local process_changes --- @type fun()
+ --- @param filepath string
+ --- @return uv.fs_event_start.callback
local function create_on_change(filepath)
return function(err, filename, events)
assert(not err, err)
local fullpath = vim.fs.joinpath(filepath, filename)
- if is_included(fullpath) and not is_excluded(filepath) then
- table.insert(changesets, {
- fullpath = fullpath,
- events = events,
- })
- timer:start(debounce, 0, process_changes)
+ if skip(fullpath, opts) then
+ return
+ end
+
+ if not filechanges[fullpath] then
+ filechanges[fullpath] = events.change or false
end
+ timer:start(debounce, 0, process_changes)
end
end
process_changes = function()
- ---@type table<string, table[]>
- local filechanges = vim.defaulttable()
- for i, change in ipairs(changesets) do
- changesets[i] = nil
- if is_included(change.fullpath) and not is_excluded(change.fullpath) then
- table.insert(filechanges[change.fullpath], change.events)
- end
- end
- for fullpath, events_list in pairs(filechanges) do
+ -- Since the callback is debounced it may have also been deleted later on
+ -- so we always need to check the existence of the file:
+ -- stat succeeds, changed=true -> Changed
+ -- stat succeeds, changed=false -> Created
+ -- stat fails -> Removed
+ for fullpath, changed in pairs(filechanges) do
uv.fs_stat(fullpath, function(_, stat)
---@type vim._watch.FileChangeType
local change_type
if stat then
- change_type = FileChangeType.Created
- for _, event in ipairs(events_list) do
- if event.change then
- change_type = FileChangeType.Changed
- end
- end
+ change_type = changed and M.FileChangeType.Changed or M.FileChangeType.Created
if stat.type == 'directory' then
local handle = handles[fullpath]
if not handle then
handle = assert(uv.new_fs_event())
handles[fullpath] = handle
- handle:start(fullpath, uvflags, create_on_change(fullpath))
+ handle:start(fullpath, {}, create_on_change(fullpath))
end
end
else
+ change_type = M.FileChangeType.Deleted
local handle = handles[fullpath]
if handle then
if not handle:is_closing() then
@@ -158,15 +184,16 @@ local function recurse_watch(path, opts, callback)
end
handles[fullpath] = nil
end
- change_type = FileChangeType.Deleted
end
callback(fullpath, change_type)
end)
end
+ filechanges = {}
end
+
local root_handle = assert(uv.new_fs_event())
handles[path] = root_handle
- root_handle:start(path, uvflags, create_on_change(path))
+ root_handle:start(path, {}, create_on_change(path))
--- "640K ought to be enough for anyone"
--- Who has folders this deep?
@@ -174,12 +201,13 @@ local function recurse_watch(path, opts, callback)
for name, type in vim.fs.dir(path, { depth = max_depth }) do
local filepath = vim.fs.joinpath(path, name)
- if type == 'directory' and not is_excluded(filepath) then
+ if type == 'directory' and not skip(filepath, opts) then
local handle = assert(uv.new_fs_event())
handles[filepath] = handle
- handle:start(filepath, uvflags, create_on_change(filepath))
+ handle:start(filepath, {}, create_on_change(filepath))
end
end
+
local function cancel()
for fullpath, handle in pairs(handles) do
if not handle:is_closing() then
@@ -190,34 +218,96 @@ local function recurse_watch(path, opts, callback)
timer:stop()
timer:close()
end
+
return cancel
end
---- Initializes and starts a |uv_fs_poll_t| recursively watching every file underneath the
---- directory at path.
----
----@param path (string) The path to watch. Must refer to a directory.
----@param opts (table|nil) Additional options
---- - debounce (number|nil)
---- Time events are debounced in ms. Defaults to 500
---- - include_pattern (LPeg pattern|nil)
---- An |lpeg| pattern. Only changes to files whose full paths match the pattern
---- will be reported. Only matches against non-directoriess, all directories will
---- be watched for new potentially-matching files. exclude_pattern can be used to
---- filter out directories. When nil, matches any file name.
---- - exclude_pattern (LPeg pattern|nil)
---- An |lpeg| pattern. Only changes to files and directories whose full path does
---- not match the pattern will be reported. Matches against both files and
---- directories. When nil, matches nothing.
----@param callback (function) The function called when new events
----@return function Stops the watcher
-function M.poll(path, opts, callback)
- vim.validate({
- path = { path, 'string', false },
- opts = { opts, 'table', true },
- callback = { callback, 'function', false },
+--- @param data string
+--- @param opts vim._watch.Opts?
+--- @param callback vim._watch.Callback
+local function fswatch_output_handler(data, opts, callback)
+ local d = vim.split(data, '%s+')
+
+ -- only consider the last reported event
+ local fullpath, event = d[1], d[#d]
+
+ if skip(fullpath, opts) then
+ return
+ end
+
+ --- @type integer
+ local change_type
+
+ if event == 'Created' then
+ change_type = M.FileChangeType.Created
+ elseif event == 'Removed' then
+ change_type = M.FileChangeType.Deleted
+ elseif event == 'Updated' then
+ change_type = M.FileChangeType.Changed
+ elseif event == 'Renamed' then
+ local _, staterr, staterrname = uv.fs_stat(fullpath)
+ if staterrname == 'ENOENT' then
+ change_type = M.FileChangeType.Deleted
+ else
+ assert(not staterr, staterr)
+ change_type = M.FileChangeType.Created
+ end
+ end
+
+ if change_type then
+ callback(fullpath, change_type)
+ end
+end
+
+--- @param path string The path to watch. Must refer to a directory.
+--- @param opts vim._watch.Opts?
+--- @param callback vim._watch.Callback Callback for new events
+--- @return fun() cancel Stops the watcher
+function M.fswatch(path, opts, callback)
+ -- debounce isn't the same as latency but close enough
+ local latency = 0.5 -- seconds
+ if opts and opts.debounce then
+ latency = opts.debounce / 1000
+ end
+
+ local obj = vim.system({
+ 'fswatch',
+ '--event=Created',
+ '--event=Removed',
+ '--event=Updated',
+ '--event=Renamed',
+ '--event-flags',
+ '--recursive',
+ '--latency=' .. tostring(latency),
+ '--exclude',
+ '/.git/',
+ path,
+ }, {
+ stderr = function(err, data)
+ if err then
+ error(err)
+ end
+
+ if data and #vim.trim(data) > 0 then
+ vim.schedule(function()
+ vim.notify('fswatch: ' .. data, vim.log.levels.ERROR)
+ end)
+ end
+ end,
+ stdout = function(err, data)
+ if err then
+ error(err)
+ end
+
+ for line in vim.gsplit(data or '', '\n', { plain = true, trimempty = true }) do
+ fswatch_output_handler(line, opts, callback)
+ end
+ end,
})
- return recurse_watch(path, opts, callback)
+
+ return function()
+ obj:kill(2)
+ end
end
return M
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua
index 99448982b4..d5075d7d3d 100644
--- a/runtime/lua/vim/diagnostic.lua
+++ b/runtime/lua/vim/diagnostic.lua
@@ -2,15 +2,260 @@ local api, if_nil = vim.api, vim.F.if_nil
local M = {}
----@enum DiagnosticSeverity
+--- [diagnostic-structure]()
+---
+--- Diagnostics use the same indexing as the rest of the Nvim API (i.e. 0-based
+--- rows and columns). |api-indexing|
+--- @class vim.Diagnostic
+---
+--- Buffer number
+--- @field bufnr? integer
+---
+--- The starting line of the diagnostic (0-indexed)
+--- @field lnum integer
+---
+--- The final line of the diagnostic (0-indexed)
+--- @field end_lnum? integer
+---
+--- The starting column of the diagnostic (0-indexed)
+--- @field col integer
+---
+--- The final column of the diagnostic (0-indexed)
+--- @field end_col? integer
+---
+--- The severity of the diagnostic |vim.diagnostic.severity|
+--- @field severity? vim.diagnostic.Severity
+---
+--- The diagnostic text
+--- @field message string
+---
+--- The source of the diagnostic
+--- @field source? string
+---
+--- The diagnostic code
+--- @field code? string|integer
+---
+--- @field _tags? { deprecated: boolean, unnecessary: boolean}
+---
+--- Arbitrary data plugins or users can add
+--- @field user_data? any arbitrary data plugins can add
+---
+--- @field namespace? integer
+
+--- Each of the configuration options below accepts one of the following:
+--- - `false`: Disable this feature
+--- - `true`: Enable this feature, use default settings.
+--- - `table`: Enable this feature with overrides. Use an empty table to use default values.
+--- - `function`: Function with signature (namespace, bufnr) that returns any of the above.
+--- @class vim.diagnostic.Opts
+---
+--- Use underline for diagnostics.
+--- (default: `true`)
+--- @field underline? boolean|vim.diagnostic.Opts.Underline|fun(namespace: integer, bufnr:integer): vim.diagnostic.Opts.Underline
+---
+--- Use virtual text for diagnostics. If multiple diagnostics are set for a
+--- namespace, one prefix per diagnostic + the last diagnostic message are
+--- shown.
+--- (default: `true`)
+--- @field virtual_text? boolean|vim.diagnostic.Opts.VirtualText|fun(namespace: integer, bufnr:integer): vim.diagnostic.Opts.VirtualText
+---
+--- Use signs for diagnostics |diagnostic-signs|.
+--- (default: `true`)
+--- @field signs? boolean|vim.diagnostic.Opts.Signs|fun(namespace: integer, bufnr:integer): vim.diagnostic.Opts.Signs
+---
+--- Options for floating windows. See |vim.diagnostic.Opts.Float|.
+--- @field float? boolean|vim.diagnostic.Opts.Float|fun(namespace: integer, bufnr:integer): vim.diagnostic.Opts.Float
+---
+--- Update diagnostics in Insert mode
+--- (if `false`, diagnostics are updated on |InsertLeave|)
+--- (default: `false`)
+--- @field update_in_insert? boolean
+---
+--- Sort diagnostics by severity. This affects the order in which signs and
+--- virtual text are displayed. When true, higher severities are displayed
+--- before lower severities (e.g. ERROR is displayed before WARN).
+--- Options:
+--- - {reverse}? (boolean) Reverse sort order
+--- (default: `false)
+--- @field severity_sort? boolean|{reverse?:boolean}
+
+--- @class (private) vim.diagnostic.OptsResolved
+--- @field float vim.diagnostic.Opts.Float
+--- @field update_in_insert boolean
+--- @field underline vim.diagnostic.Opts.Underline
+--- @field virtual_text vim.diagnostic.Opts.VirtualText
+--- @field signs vim.diagnostic.Opts.Signs
+--- @field severity_sort {reverse?:boolean}
+
+--- @class vim.diagnostic.Opts.Float
+---
+--- Buffer number to show diagnostics from.
+--- (default: current buffer)
+--- @field bufnr? integer
+---
+--- Limit diagnostics to the given namespace
+--- @field namespace? integer
+---
+--- Show diagnostics from the whole buffer (`buffer"`, the current cursor line
+--- (`line`), or the current cursor position (`cursor`). Shorthand versions
+--- are also accepted (`c` for `cursor`, `l` for `line`, `b` for `buffer`).
+--- (default: `line`)
+--- @field scope? 'line'|'buffer'|'cursor'|'c'|'l'|'b'
+---
+--- If {scope} is "line" or "cursor", use this position rather than the cursor
+--- position. If a number, interpreted as a line number; otherwise, a
+--- (row, col) tuple.
+--- @field pos? integer|{[1]:integer,[2]:integer}
+---
+--- Sort diagnostics by severity.
+--- Overrides the setting from |vim.diagnostic.config()|.
+--- (default: `false`)
+--- @field severity_sort? boolean|{reverse?:boolean}
+---
+--- See |diagnostic-severity|.
+--- Overrides the setting from |vim.diagnostic.config()|.
+--- @field severity? vim.diagnostic.SeverityFilter
+---
+--- String to use as the header for the floating window. If a table, it is
+--- interpreted as a `[text, hl_group]` tuple.
+--- Overrides the setting from |vim.diagnostic.config()|.
+--- @field header? string|{[1]:string,[2]:any}
+---
+--- Include the diagnostic source in the message.
+--- Use "if_many" to only show sources if there is more than one source of
+--- diagnostics in the buffer. Otherwise, any truthy value means to always show
+--- the diagnostic source.
+--- Overrides the setting from |vim.diagnostic.config()|.
+--- @field source? boolean|'if_many'
+---
+--- A function that takes a diagnostic as input and returns a string.
+--- The return value is the text used to display the diagnostic.
+--- Overrides the setting from |vim.diagnostic.config()|.
+--- @field format? fun(diagnostic:vim.Diagnostic): string
+---
+--- Prefix each diagnostic in the floating window:
+--- - If a `function`, {i} is the index of the diagnostic being evaluated and
+--- {total} is the total number of diagnostics displayed in the window. The
+--- function should return a `string` which is prepended to each diagnostic
+--- in the window as well as an (optional) highlight group which will be
+--- used to highlight the prefix.
+--- - If a `table`, it is interpreted as a `[text, hl_group]` tuple as
+--- in |nvim_echo()|
+--- - If a `string`, it is prepended to each diagnostic in the window with no
+--- highlight.
+--- Overrides the setting from |vim.diagnostic.config()|.
+--- @field prefix? string|table|(fun(diagnostic:vim.Diagnostic,i:integer,total:integer): string, string)
+---
+--- Same as {prefix}, but appends the text to the diagnostic instead of
+--- prepending it.
+--- Overrides the setting from |vim.diagnostic.config()|.
+--- @field suffix? string|table|(fun(diagnostic:vim.Diagnostic,i:integer,total:integer): string, string)
+---
+--- @field focus_id? string
+
+--- @class vim.diagnostic.Opts.Underline
+---
+--- Only underline diagnostics matching the given
+--- severity |diagnostic-severity|.
+--- @field severity? vim.diagnostic.SeverityFilter
+
+--- @class vim.diagnostic.Opts.VirtualText
+---
+--- Only show virtual text for diagnostics matching the given
+--- severity |diagnostic-severity|
+--- @field severity? vim.diagnostic.SeverityFilter
+---
+--- Include the diagnostic source in virtual text. Use `'if_many'` to only
+--- show sources if there is more than one diagnostic source in the buffer.
+--- Otherwise, any truthy value means to always show the diagnostic source.
+--- @field source? boolean|"if_many"
+---
+--- Amount of empty spaces inserted at the beginning of the virtual text.
+--- @field spacing? integer
+---
+--- Prepend diagnostic message with prefix. If a `function`, {i} is the index
+--- of the diagnostic being evaluated, and {total} is the total number of
+--- diagnostics for the line. This can be used to render diagnostic symbols
+--- or error codes.
+--- @field prefix? string|(fun(diagnostic:vim.Diagnostic,i:integer,total:integer): string)
+---
+--- Append diagnostic message with suffix.
+--- This can be used to render an LSP diagnostic error code.
+--- @field suffix? string|(fun(diagnostic:vim.Diagnostic): string)
+---
+--- The return value is the text used to display the diagnostic. Example:
+--- ```lua
+--- function(diagnostic)
+--- if diagnostic.severity == vim.diagnostic.severity.ERROR then
+--- return string.format("E: %s", diagnostic.message)
+--- end
+--- return diagnostic.message
+--- end
+--- ```
+--- @field format? fun(diagnostic:vim.Diagnostic): string
+---
+--- See |nvim_buf_set_extmark()|.
+--- @field hl_mode? 'replace'|'combine'|'blend'
+---
+--- See |nvim_buf_set_extmark()|.
+--- @field virt_text? {[1]:string,[2]:any}[]
+---
+--- See |nvim_buf_set_extmark()|.
+--- @field virt_text_pos? 'eol'|'overlay'|'right_align'|'inline'
+---
+--- See |nvim_buf_set_extmark()|.
+--- @field virt_text_win_col? integer
+---
+--- See |nvim_buf_set_extmark()|.
+--- @field virt_text_hide? boolean
+
+--- @class vim.diagnostic.Opts.Signs
+---
+--- Only show virtual text for diagnostics matching the given
+--- severity |diagnostic-severity|
+--- @field severity? vim.diagnostic.SeverityFilter
+---
+--- Base priority to use for signs. When {severity_sort} is used, the priority
+--- of a sign is adjusted based on its severity.
+--- Otherwise, all signs use the same priority.
+--- (default: `10`)
+--- @field priority? integer
+---
+--- A table mapping |diagnostic-severity| to the sign text to display in the
+--- sign column. The default is to use `"E"`, `"W"`, `"I"`, and `"H"` for errors,
+--- warnings, information, and hints, respectively. Example:
+--- ```lua
+--- vim.diagnostic.config({
+--- signs = { text = { [vim.diagnostic.severity.ERROR] = 'E', ... } }
+--- })
+--- ```
+--- @field text? table<vim.diagnostic.Severity,string>
+---
+--- A table mapping |diagnostic-severity| to the highlight group used for the
+--- line number where the sign is placed.
+--- @field numhl? table<vim.diagnostic.Severity,string>
+---
+--- A table mapping |diagnostic-severity| to the highlight group used for the
+--- whole line the sign is placed in.
+--- @field linehl? table<vim.diagnostic.Severity,string>
+
+--- @nodoc
+--- @enum vim.diagnostic.Severity
M.severity = {
ERROR = 1,
WARN = 2,
INFO = 3,
HINT = 4,
+ [1] = 'ERROR',
+ [2] = 'WARN',
+ [3] = 'INFO',
+ [4] = 'HINT',
}
-vim.tbl_add_reverse_lookup(M.severity)
+--- @alias vim.diagnostic.SeverityInt 1|2|3|4
+
+--- See |diagnostic-severity| and |vim.diagnostic.get()|
+--- @alias vim.diagnostic.SeverityFilter vim.diagnostic.Severity|vim.diagnostic.Severity[]|{min:vim.diagnostic.Severity,max:vim.diagnostic.Severity}
-- Mappings from qflist/loclist error types to severities
M.severity.E = M.severity.ERROR
@@ -18,6 +263,7 @@ M.severity.W = M.severity.WARN
M.severity.I = M.severity.INFO
M.severity.N = M.severity.HINT
+--- @type vim.diagnostic.Opts
local global_diagnostic_options = {
signs = true,
underline = true,
@@ -27,6 +273,12 @@ local global_diagnostic_options = {
severity_sort = false,
}
+--- @class (private) vim.diagnostic.Handler
+--- @field show? fun(namespace: integer, bufnr: integer, diagnostics: vim.Diagnostic[], opts?: vim.diagnostic.OptsResolved)
+--- @field hide? fun(namespace:integer, bufnr:integer)
+
+--- @nodoc
+--- @type table<string,vim.diagnostic.Handler>
M.handlers = setmetatable({}, {
__newindex = function(t, name, handler)
vim.validate({ handler = { handler, 't' } })
@@ -39,6 +291,9 @@ M.handlers = setmetatable({}, {
-- Metatable that automatically creates an empty table when assigning to a missing key
local bufnr_and_namespace_cacher_mt = {
+ --- @param t table<integer,table>
+ --- @param bufnr integer
+ --- @return table
__index = function(t, bufnr)
assert(bufnr > 0, 'Invalid buffer number')
t[bufnr] = {}
@@ -46,10 +301,13 @@ local bufnr_and_namespace_cacher_mt = {
end,
}
-local diagnostic_cache
+-- bufnr -> ns -> Diagnostic[]
+local diagnostic_cache = {} --- @type table<integer,table<integer,vim.Diagnostic[]>>
do
local group = api.nvim_create_augroup('DiagnosticBufWipeout', {})
- diagnostic_cache = setmetatable({}, {
+ setmetatable(diagnostic_cache, {
+ --- @param t table<integer,vim.Diagnostic[]>
+ --- @param bufnr integer
__index = function(t, bufnr)
assert(bufnr > 0, 'Invalid buffer number')
api.nvim_create_autocmd('BufWipeout', {
@@ -65,61 +323,93 @@ do
})
end
+--- @class (private) vim.diagnostic._extmark
+--- @field [1] integer id
+--- @field [2] integer start
+--- @field [3] integer end
+--- @field [4] table details
+
+--- @type table<integer,table<integer,vim.diagnostic._extmark[]>>
local diagnostic_cache_extmarks = setmetatable({}, bufnr_and_namespace_cacher_mt)
+
+--- @type table<integer,true>
local diagnostic_attached_buffers = {}
+
+--- @type table<integer,true|table<integer,true>>
local diagnostic_disabled = {}
+
+--- @type table<integer,table<integer,table>>
local bufs_waiting_to_update = setmetatable({}, bufnr_and_namespace_cacher_mt)
+--- @class vim.diagnostic.NS
+--- @field name string
+--- @field opts vim.diagnostic.Opts
+--- @field user_data table
+--- @field disabled? boolean
+
+--- @type table<integer,vim.diagnostic.NS>
local all_namespaces = {}
+---@param severity string|vim.diagnostic.Severity
+---@return vim.diagnostic.Severity?
local function to_severity(severity)
if type(severity) == 'string' then
- return assert(
- M.severity[string.upper(severity)],
- string.format('Invalid severity: %s', severity)
- )
+ assert(M.severity[string.upper(severity)], string.format('Invalid severity: %s', severity))
+ return M.severity[string.upper(severity)]
end
return severity
end
+--- @param severity vim.diagnostic.SeverityFilter
+--- @param diagnostics vim.Diagnostic[]
+--- @return vim.Diagnostic[]
local function filter_by_severity(severity, diagnostics)
if not severity then
return diagnostics
end
if type(severity) ~= 'table' then
- severity = to_severity(severity)
+ severity = assert(to_severity(severity))
+ --- @param t vim.Diagnostic
return vim.tbl_filter(function(t)
return t.severity == severity
end, diagnostics)
end
if severity.min or severity.max then
+ --- @cast severity {min:vim.diagnostic.Severity,max:vim.diagnostic.Severity}
local min_severity = to_severity(severity.min) or M.severity.HINT
local max_severity = to_severity(severity.max) or M.severity.ERROR
+ --- @param t vim.Diagnostic
return vim.tbl_filter(function(t)
return t.severity <= min_severity and t.severity >= max_severity
end, diagnostics)
end
- local severities = {}
+ --- @cast severity vim.diagnostic.Severity[]
+
+ local severities = {} --- @type table<vim.diagnostic.Severity,true>
for _, s in ipairs(severity) do
- severities[to_severity(s)] = true
+ severities[assert(to_severity(s))] = true
end
+ --- @param t vim.Diagnostic
return vim.tbl_filter(function(t)
return severities[t.severity]
end, diagnostics)
end
+--- @param bufnr integer
+--- @return integer
local function count_sources(bufnr)
- local seen = {}
+ local seen = {} --- @type table<string,true>
local count = 0
for _, namespace_diagnostics in pairs(diagnostic_cache[bufnr]) do
for _, diagnostic in ipairs(namespace_diagnostics) do
- if diagnostic.source and not seen[diagnostic.source] then
- seen[diagnostic.source] = true
+ local source = diagnostic.source
+ if source and not seen[source] then
+ seen[source] = true
count = count + 1
end
end
@@ -127,51 +417,65 @@ local function count_sources(bufnr)
return count
end
+--- @param diagnostics vim.Diagnostic[]
+--- @return vim.Diagnostic[]
local function prefix_source(diagnostics)
+ --- @param d vim.Diagnostic
return vim.tbl_map(function(d)
if not d.source then
return d
end
- local t = vim.deepcopy(d)
+ local t = vim.deepcopy(d, true)
t.message = string.format('%s: %s', d.source, d.message)
return t
end, diagnostics)
end
+--- @param diagnostics vim.Diagnostic[]
+--- @return vim.Diagnostic[]
local function reformat_diagnostics(format, diagnostics)
vim.validate({
format = { format, 'f' },
diagnostics = { diagnostics, 't' },
})
- local formatted = vim.deepcopy(diagnostics)
+ local formatted = vim.deepcopy(diagnostics, true)
for _, diagnostic in ipairs(formatted) do
diagnostic.message = format(diagnostic)
end
return formatted
end
+--- @param option string
+--- @param namespace integer?
+--- @return table
local function enabled_value(option, namespace)
local ns = namespace and M.get_namespace(namespace) or {}
if ns.opts and type(ns.opts[option]) == 'table' then
return ns.opts[option]
end
- if type(global_diagnostic_options[option]) == 'table' then
- return global_diagnostic_options[option]
+ local global_opt = global_diagnostic_options[option]
+ if type(global_opt) == 'table' then
+ return global_opt
end
return {}
end
+--- @param option string
+--- @param value any?
+--- @param namespace integer?
+--- @param bufnr integer
+--- @return any
local function resolve_optional_value(option, value, namespace, bufnr)
if not value then
return false
elseif value == true then
return enabled_value(option, namespace)
elseif type(value) == 'function' then
- local val = value(namespace, bufnr)
+ local val = value(namespace, bufnr) --- @type any
if val == true then
return enabled_value(option, namespace)
else
@@ -179,15 +483,18 @@ local function resolve_optional_value(option, value, namespace, bufnr)
end
elseif type(value) == 'table' then
return value
- else
- error('Unexpected option type: ' .. vim.inspect(value))
end
+ error('Unexpected option type: ' .. vim.inspect(value))
end
+--- @param opts vim.diagnostic.Opts?
+--- @param namespace integer?
+--- @param bufnr integer
+--- @return vim.diagnostic.OptsResolved
local function get_resolved_options(opts, namespace, bufnr)
local ns = namespace and M.get_namespace(namespace) or {}
-- Do not use tbl_deep_extend so that an empty table can be used to reset to default values
- local resolved = vim.tbl_extend('keep', opts or {}, ns.opts or {}, global_diagnostic_options)
+ local resolved = vim.tbl_extend('keep', opts or {}, ns.opts or {}, global_diagnostic_options) --- @type table<string,any>
for k in pairs(global_diagnostic_options) do
if resolved[k] ~= nil then
resolved[k] = resolve_optional_value(k, resolved[k], namespace, bufnr)
@@ -204,9 +511,11 @@ local diagnostic_severities = {
[M.severity.HINT] = { ctermfg = 7, guifg = 'LightGrey' },
}
--- Make a map from DiagnosticSeverity -> Highlight Name
+--- Make a map from vim.diagnostic.Severity -> Highlight Name
+--- @param base_name string
+--- @return table<vim.diagnostic.SeverityInt,string>
local function make_highlight_map(base_name)
- local result = {}
+ local result = {} --- @type table<vim.diagnostic.SeverityInt,string>
for k in pairs(diagnostic_severities) do
local name = M.severity[k]
name = name:sub(1, 1) .. name:sub(2):lower()
@@ -216,35 +525,13 @@ local function make_highlight_map(base_name)
return result
end
+-- TODO(lewis6991): these highlight maps can only be indexed with an integer, however there usage
+-- implies they can be indexed with any vim.diagnostic.Severity
local virtual_text_highlight_map = make_highlight_map('VirtualText')
local underline_highlight_map = make_highlight_map('Underline')
local floating_highlight_map = make_highlight_map('Floating')
local sign_highlight_map = make_highlight_map('Sign')
----@private
-local define_default_signs = (function()
- local signs_defined = false
- return function()
- if signs_defined then
- return
- end
-
- for severity, sign_hl_name in pairs(sign_highlight_map) do
- if vim.tbl_isempty(vim.fn.sign_getdefined(sign_hl_name)) then
- local severity_name = M.severity[severity]
- vim.fn.sign_define(sign_hl_name, {
- text = (severity_name or 'U'):sub(1, 1),
- texthl = sign_hl_name,
- linehl = '',
- numhl = '',
- })
- end
- end
-
- signs_defined = true
- end
-end)()
-
local function get_bufnr(bufnr)
if not bufnr or bufnr == 0 then
return api.nvim_get_current_buf()
@@ -252,12 +539,14 @@ local function get_bufnr(bufnr)
return bufnr
end
+--- @param diagnostics vim.Diagnostic[]
+--- @return table<integer,vim.Diagnostic[]>
local function diagnostic_lines(diagnostics)
if not diagnostics then
return {}
end
- local diagnostics_by_line = {}
+ local diagnostics_by_line = {} --- @type table<integer,vim.Diagnostic[]>
for _, diagnostic in ipairs(diagnostics) do
local line_diagnostics = diagnostics_by_line[diagnostic.lnum]
if not line_diagnostics then
@@ -269,6 +558,9 @@ local function diagnostic_lines(diagnostics)
return diagnostics_by_line
end
+--- @param namespace integer
+--- @param bufnr integer
+--- @param diagnostics vim.Diagnostic[]
local function set_diagnostic_cache(namespace, bufnr, diagnostics)
for _, diagnostic in ipairs(diagnostics) do
assert(diagnostic.lnum, 'Diagnostic line number is required')
@@ -283,10 +575,12 @@ local function set_diagnostic_cache(namespace, bufnr, diagnostics)
diagnostic_cache[bufnr][namespace] = diagnostics
end
+--- @param bufnr integer
+--- @param last integer
local function restore_extmarks(bufnr, last)
for ns, extmarks in pairs(diagnostic_cache_extmarks[bufnr]) do
local extmarks_current = api.nvim_buf_get_extmarks(bufnr, ns, 0, -1, { details = true })
- local found = {}
+ local found = {} --- @type table<integer,true>
for _, extmark in ipairs(extmarks_current) do
-- nvim_buf_set_lines will move any extmark to the line after the last
-- nvim_buf_set_text will move any extmark to the last line
@@ -304,6 +598,8 @@ local function restore_extmarks(bufnr, last)
end
end
+--- @param namespace integer
+--- @param bufnr? integer
local function save_extmarks(namespace, bufnr)
bufnr = get_bufnr(bufnr)
if not diagnostic_attached_buffers[bufnr] then
@@ -321,6 +617,7 @@ local function save_extmarks(namespace, bufnr)
api.nvim_buf_get_extmarks(bufnr, namespace, 0, -1, { details = true })
end
+--- @type table<string,true>
local registered_autocmds = {}
local function make_augroup_key(namespace, bufnr)
@@ -328,6 +625,8 @@ local function make_augroup_key(namespace, bufnr)
return string.format('DiagnosticInsertLeave:%s:%s', bufnr, ns.name)
end
+--- @param namespace integer
+--- @param bufnr integer
local function execute_scheduled_display(namespace, bufnr)
local args = bufs_waiting_to_update[bufnr][namespace]
if not args then
@@ -343,6 +642,9 @@ end
--- Table of autocmd events to fire the update for displaying new diagnostic information
local insert_leave_auto_cmds = { 'InsertLeave', 'CursorHoldI' }
+--- @param namespace integer
+--- @param bufnr integer
+--- @param args any[]
local function schedule_display(namespace, bufnr, args)
bufs_waiting_to_update[bufnr][namespace] = args
@@ -361,6 +663,8 @@ local function schedule_display(namespace, bufnr, args)
end
end
+--- @param namespace integer
+--- @param bufnr integer
local function clear_scheduled_display(namespace, bufnr)
local key = make_augroup_key(namespace, bufnr)
@@ -370,6 +674,10 @@ local function clear_scheduled_display(namespace, bufnr)
end
end
+--- @param bufnr integer?
+--- @param opts vim.diagnostic.GetOpts?
+--- @param clamp boolean
+--- @return vim.Diagnostic[]
local function get_diagnostics(bufnr, opts, clamp)
opts = opts or {}
@@ -377,16 +685,21 @@ local function get_diagnostics(bufnr, opts, clamp)
local diagnostics = {}
-- Memoized results of buf_line_count per bufnr
+ --- @type table<integer,integer>
local buf_line_count = setmetatable({}, {
+ --- @param t table<integer,integer>
+ --- @param k integer
+ --- @return integer
__index = function(t, k)
t[k] = api.nvim_buf_line_count(k)
return rawget(t, k)
end,
})
+ ---@param b integer
+ ---@param d vim.Diagnostic
local function add(b, d)
if not opts.lnum or d.lnum == opts.lnum then
- d = vim.deepcopy(d)
if clamp and api.nvim_buf_is_loaded(b) then
local line_count = buf_line_count[b] - 1
if
@@ -397,8 +710,9 @@ local function get_diagnostics(bufnr, opts, clamp)
or d.col < 0
or d.end_col < 0
then
+ d = vim.deepcopy(d, true)
d.lnum = math.max(math.min(d.lnum, line_count), 0)
- d.end_lnum = math.max(math.min(d.end_lnum, line_count), 0)
+ d.end_lnum = math.max(math.min(assert(d.end_lnum), line_count), 0)
d.col = math.max(d.col, 0)
d.end_col = math.max(d.end_col, 0)
end
@@ -407,6 +721,8 @@ local function get_diagnostics(bufnr, opts, clamp)
end
end
+ --- @param buf integer
+ --- @param diags vim.Diagnostic[]
local function add_all_diags(buf, diags)
for _, diagnostic in pairs(diags) do
add(buf, diagnostic)
@@ -440,18 +756,20 @@ local function get_diagnostics(bufnr, opts, clamp)
return diagnostics
end
+--- @param loclist boolean
+--- @param opts vim.diagnostic.setqflist.Opts|vim.diagnostic.setloclist.Opts?
local function set_list(loclist, opts)
opts = opts or {}
- local open = vim.F.if_nil(opts.open, true)
+ local open = if_nil(opts.open, true)
local title = opts.title or 'Diagnostics'
local winnr = opts.winnr or 0
- local bufnr
+ local bufnr --- @type integer?
if loclist then
bufnr = api.nvim_win_get_buf(winnr)
end
-- Don't clamp line numbers since the quickfix list can already handle line
-- numbers beyond the end of the buffer
- local diagnostics = get_diagnostics(bufnr, opts, false)
+ local diagnostics = get_diagnostics(bufnr, opts --[[@as vim.diagnostic.GetOpts]], false)
local items = M.toqflist(diagnostics)
if loclist then
vim.fn.setloclist(winnr, {}, ' ', { title = title, items = items })
@@ -463,10 +781,16 @@ local function set_list(loclist, opts)
end
end
+--- @param position {[1]: integer, [2]: integer}
+--- @param search_forward boolean
+--- @param bufnr integer
+--- @param opts vim.diagnostic.GotoOpts
+--- @param namespace integer
+--- @return vim.Diagnostic?
local function next_diagnostic(position, search_forward, bufnr, opts, namespace)
position[1] = position[1] - 1
bufnr = get_bufnr(bufnr)
- local wrap = vim.F.if_nil(opts.wrap, true)
+ local wrap = if_nil(opts.wrap, true)
local line_count = api.nvim_buf_line_count(bufnr)
local diagnostics =
get_diagnostics(bufnr, vim.tbl_extend('keep', opts, { namespace = namespace }), true)
@@ -483,6 +807,7 @@ local function next_diagnostic(position, search_forward, bufnr, opts, namespace)
end
if line_diagnostics[lnum] and not vim.tbl_isempty(line_diagnostics[lnum]) then
local line_length = #api.nvim_buf_get_lines(bufnr, lnum, lnum + 1, true)[1]
+ --- @type function, function
local sort_diagnostics, is_next
if search_forward then
sort_diagnostics = function(a, b)
@@ -501,7 +826,9 @@ local function next_diagnostic(position, search_forward, bufnr, opts, namespace)
end
table.sort(line_diagnostics[lnum], sort_diagnostics)
if i == 0 then
- for _, v in pairs(line_diagnostics[lnum]) do
+ for _, v in
+ pairs(line_diagnostics[lnum] --[[@as table<string,any>]])
+ do
if is_next(v) then
return v
end
@@ -513,10 +840,12 @@ local function next_diagnostic(position, search_forward, bufnr, opts, namespace)
end
end
+--- @param opts vim.diagnostic.GotoOpts?
+--- @param pos {[1]:integer,[2]:integer}|false
local function diagnostic_move_pos(opts, pos)
opts = opts or {}
- local float = vim.F.if_nil(opts.float, true)
+ local float = if_nil(opts.float, true)
local win_id = opts.win_id or api.nvim_get_current_win()
if not pos then
@@ -566,76 +895,18 @@ end
---
--- then virtual text will not be enabled for those diagnostics.
---
----@note Each of the configuration options below accepts one of the following:
---- - `false`: Disable this feature
---- - `true`: Enable this feature, use default settings.
---- - `table`: Enable this feature with overrides. Use an empty table to use default values.
---- - `function`: Function with signature (namespace, bufnr) that returns any of the above.
----
----@param opts table|nil When omitted or "nil", retrieve the current configuration. Otherwise, a
---- configuration table with the following keys:
---- - underline: (default true) Use underline for diagnostics. Options:
---- * severity: Only underline diagnostics matching the given
---- severity |diagnostic-severity|
---- - virtual_text: (default true) Use virtual text for diagnostics. If multiple diagnostics
---- are set for a namespace, one prefix per diagnostic + the last diagnostic
---- message are shown. In addition to the options listed below, the
---- "virt_text" options of |nvim_buf_set_extmark()| may also be used here
---- (e.g. "virt_text_pos" and "hl_mode").
---- Options:
---- * severity: Only show virtual text for diagnostics matching the given
---- severity |diagnostic-severity|
---- * source: (boolean or string) Include the diagnostic source in virtual
---- text. Use "if_many" to only show sources if there is more than
---- one diagnostic source in the buffer. Otherwise, any truthy value
---- means to always show the diagnostic source.
---- * spacing: (number) Amount of empty spaces inserted at the beginning
---- of the virtual text.
---- * prefix: (string or function) prepend diagnostic message with prefix.
---- If a function, it must have the signature (diagnostic, i, total)
---- -> string, where {diagnostic} is of type |diagnostic-structure|,
---- {i} is the index of the diagnostic being evaluated, and {total}
---- is the total number of diagnostics for the line. This can be
---- used to render diagnostic symbols or error codes.
---- * suffix: (string or function) Append diagnostic message with suffix.
---- If a function, it must have the signature (diagnostic) ->
---- string, where {diagnostic} is of type |diagnostic-structure|.
---- This can be used to render an LSP diagnostic error code.
---- * format: (function) A function that takes a diagnostic as input and
---- returns a string. The return value is the text used to display
---- the diagnostic. Example:
---- <pre>lua
---- function(diagnostic)
---- if diagnostic.severity == vim.diagnostic.severity.ERROR then
---- return string.format("E: %s", diagnostic.message)
---- end
---- return diagnostic.message
---- end
---- </pre>
---- - signs: (default true) Use signs for diagnostics. Options:
---- * severity: Only show signs for diagnostics matching the given
---- severity |diagnostic-severity|
---- * priority: (number, default 10) Base priority to use for signs. When
---- {severity_sort} is used, the priority of a sign is adjusted based on
---- its severity. Otherwise, all signs use the same priority.
---- - float: Options for floating windows. See |vim.diagnostic.open_float()|.
---- - update_in_insert: (default false) Update diagnostics in Insert mode (if false,
---- diagnostics are updated on InsertLeave)
---- - severity_sort: (default false) Sort diagnostics by severity. This affects the order in
---- which signs and virtual text are displayed. When true, higher severities
---- are displayed before lower severities (e.g. ERROR is displayed before WARN).
---- Options:
---- * reverse: (boolean) Reverse sort order
----
----@param namespace integer|nil Update the options for the given namespace. When omitted, update the
---- global diagnostic options.
+---@param opts vim.diagnostic.Opts? When omitted or `nil`, retrieve the current
+--- configuration. Otherwise, a configuration table (see |vim.diagnostic.Opts|).
+---@param namespace integer? Update the options for the given namespace.
+--- When omitted, update the global diagnostic options.
+---@return vim.diagnostic.Opts? : Current diagnostic config if {opts} is omitted.
function M.config(opts, namespace)
vim.validate({
opts = { opts, 't', true },
namespace = { namespace, 'n', true },
})
- local t
+ local t --- @type vim.diagnostic.Opts
if namespace then
local ns = M.get_namespace(namespace)
t = ns.opts
@@ -645,10 +916,12 @@ function M.config(opts, namespace)
if not opts then
-- Return current config
- return vim.deepcopy(t)
+ return vim.deepcopy(t, true)
end
- for k, v in pairs(opts) do
+ for k, v in
+ pairs(opts --[[@as table<any,any>]])
+ do
t[k] = v
end
@@ -671,8 +944,8 @@ end
---
---@param namespace integer The diagnostic namespace
---@param bufnr integer Buffer number
----@param diagnostics table A list of diagnostic items |diagnostic-structure|
----@param opts table|nil Display options to pass to |vim.diagnostic.show()|
+---@param diagnostics vim.Diagnostic[]
+---@param opts? vim.diagnostic.Opts Display options to pass to |vim.diagnostic.show()|
function M.set(namespace, bufnr, diagnostics, opts)
vim.validate({
namespace = { namespace, 'n' },
@@ -698,6 +971,7 @@ function M.set(namespace, bufnr, diagnostics, opts)
api.nvim_exec_autocmds('DiagnosticChanged', {
modeline = false,
buffer = bufnr,
+ -- TODO(lewis6991): should this be deepcopy()'d like they are in vim.diagnostic.get()
data = { diagnostics = diagnostics },
})
end
@@ -705,11 +979,11 @@ end
--- Get namespace metadata.
---
---@param namespace integer Diagnostic namespace
----@return table Namespace metadata
+---@return vim.diagnostic.NS : Namespace metadata
function M.get_namespace(namespace)
vim.validate({ namespace = { namespace, 'n' } })
if not all_namespaces[namespace] then
- local name
+ local name --- @type string?
for k, v in pairs(api.nvim_get_namespaces()) do
if namespace == v then
name = k
@@ -730,48 +1004,56 @@ end
--- Get current diagnostic namespaces.
---
----@return table A list of active diagnostic namespaces |vim.diagnostic|.
+---@return table<integer,vim.diagnostic.NS> : List of active diagnostic namespaces |vim.diagnostic|.
function M.get_namespaces()
- return vim.deepcopy(all_namespaces)
+ return vim.deepcopy(all_namespaces, true)
end
----@class Diagnostic
----@field bufnr? integer
----@field lnum integer 0-indexed
----@field end_lnum? integer 0-indexed
----@field col integer 0-indexed
----@field end_col? integer 0-indexed
----@field severity? DiagnosticSeverity
----@field message string
----@field source? string
----@field code? string
----@field _tags? { deprecated: boolean, unnecessary: boolean}
----@field user_data? any arbitrary data plugins can add
-
--- Get current diagnostics.
---
---- Modifying diagnostics in the returned table has no effect. To set diagnostics in a buffer, use |vim.diagnostic.set()|.
+--- Modifying diagnostics in the returned table has no effect.
+--- To set diagnostics in a buffer, use |vim.diagnostic.set()|.
---
----@param bufnr integer|nil Buffer number to get diagnostics from. Use 0 for
---- current buffer or nil for all buffers.
----@param opts table|nil A table with the following keys:
---- - namespace: (number) Limit diagnostics to the given namespace.
---- - lnum: (number) Limit diagnostics to the given line number.
---- - severity: See |diagnostic-severity|.
----@return Diagnostic[] table A list of diagnostic items |diagnostic-structure|. Keys `bufnr`, `end_lnum`, `end_col`, and `severity` are guaranteed to be present.
+---@param bufnr integer? Buffer number to get diagnostics from. Use 0 for
+--- current buffer or nil for all buffers.
+---@param opts? vim.diagnostic.GetOpts
+---@return vim.Diagnostic[] : Fields `bufnr`, `end_lnum`, `end_col`, and `severity`
+--- are guaranteed to be present.
function M.get(bufnr, opts)
vim.validate({
bufnr = { bufnr, 'n', true },
opts = { opts, 't', true },
})
- return get_diagnostics(bufnr, opts, false)
+ return vim.deepcopy(get_diagnostics(bufnr, opts, false), true)
+end
+
+--- Get current diagnostics count.
+---
+---@param bufnr? integer Buffer number to get diagnostics from. Use 0 for
+--- current buffer or nil for all buffers.
+---@param opts? vim.diagnostic.GetOpts
+---@return table : Table with actually present severity values as keys
+--- (see |diagnostic-severity|) and integer counts as values.
+function M.count(bufnr, opts)
+ vim.validate({
+ bufnr = { bufnr, 'n', true },
+ opts = { opts, 't', true },
+ })
+
+ local diagnostics = get_diagnostics(bufnr, opts, false)
+ local count = {} --- @type table<integer,integer>
+ for i = 1, #diagnostics do
+ local severity = diagnostics[i].severity --[[@as integer]]
+ count[severity] = (count[severity] or 0) + 1
+ end
+ return count
end
--- Get the previous diagnostic closest to the cursor position.
---
----@param opts nil|table See |vim.diagnostic.goto_next()|
----@return Diagnostic|nil Previous diagnostic
+---@param opts? vim.diagnostic.GotoOpts
+---@return vim.Diagnostic? : Previous diagnostic
function M.get_prev(opts)
opts = opts or {}
@@ -784,9 +1066,9 @@ end
--- Return the position of the previous diagnostic in the current buffer.
---
----@param opts table|nil See |vim.diagnostic.goto_next()|
----@return table|false Previous diagnostic position as a (row, col) tuple or false if there is no
---- prior diagnostic
+---@param opts? vim.diagnostic.GotoOpts
+---@return table|false: Previous diagnostic position as a `(row, col)` tuple
+--- or `false` if there is no prior diagnostic.
function M.get_prev_pos(opts)
local prev = M.get_prev(opts)
if not prev then
@@ -797,15 +1079,15 @@ function M.get_prev_pos(opts)
end
--- Move to the previous diagnostic in the current buffer.
----@param opts table|nil See |vim.diagnostic.goto_next()|
+---@param opts? vim.diagnostic.GotoOpts
function M.goto_prev(opts)
return diagnostic_move_pos(opts, M.get_prev_pos(opts))
end
--- Get the next diagnostic closest to the cursor position.
---
----@param opts table|nil See |vim.diagnostic.goto_next()|
----@return Diagnostic|nil Next diagnostic
+---@param opts? vim.diagnostic.GotoOpts
+---@return vim.Diagnostic? : Next diagnostic
function M.get_next(opts)
opts = opts or {}
@@ -818,9 +1100,9 @@ end
--- Return the position of the next diagnostic in the current buffer.
---
----@param opts table|nil See |vim.diagnostic.goto_next()|
----@return table|false Next diagnostic position as a (row, col) tuple or false if no next
---- diagnostic.
+---@param opts? vim.diagnostic.GotoOpts
+---@return table|false : Next diagnostic position as a `(row, col)` tuple or false if no next
+--- diagnostic.
function M.get_next_pos(opts)
local next = M.get_next(opts)
if not next then
@@ -830,22 +1112,49 @@ function M.get_next_pos(opts)
return { next.lnum, next.col }
end
+--- A table with the following keys:
+--- @class vim.diagnostic.GetOpts
+---
+--- Limit diagnostics to the given namespace.
+--- @field namespace? integer
+---
+--- Limit diagnostics to the given line number.
+--- @field lnum? integer
+---
+--- See |diagnostic-severity|.
+--- @field severity? vim.diagnostic.SeverityFilter
+
+--- Configuration table with the following keys:
+--- @class vim.diagnostic.GotoOpts : vim.diagnostic.GetOpts
+---
+--- Cursor position as a `(row, col)` tuple.
+--- See |nvim_win_get_cursor()|.
+--- (default: current cursor position)
+--- @field cursor_position? {[1]:integer,[2]:integer}
+---
+--- Whether to loop around file or not. Similar to 'wrapscan'.
+--- (default: `true`)
+--- @field wrap? boolean
+---
+--- See |diagnostic-severity|.
+--- @field severity vim.diagnostic.Severity
+---
+--- If `true`, call |vim.diagnostic.open_float()| after moving.
+--- If a table, pass the table as the {opts} parameter to |vim.diagnostic.open_float()|.
+--- Unless overridden, the float will show diagnostics at the new cursor
+--- position (as if "cursor" were passed to the "scope" option).
+--- (default: `true`)
+--- @field float? boolean|vim.diagnostic.Opts.Float
+---
+--- Window ID
+--- (default: `0`)
+--- @field win_id? integer
+
--- Move to the next diagnostic.
---
----@param opts table|nil Configuration table with the following keys:
---- - namespace: (number) Only consider diagnostics from the given namespace.
---- - cursor_position: (cursor position) Cursor position as a (row, col) tuple.
---- See |nvim_win_get_cursor()|. Defaults to the current cursor position.
---- - wrap: (boolean, default true) Whether to loop around file or not. Similar to 'wrapscan'.
---- - severity: See |diagnostic-severity|.
---- - float: (boolean or table, default true) If "true", call |vim.diagnostic.open_float()|
---- after moving. If a table, pass the table as the {opts} parameter
---- to |vim.diagnostic.open_float()|. Unless overridden, the float will show
---- diagnostics at the new cursor position (as if "cursor" were passed to
---- the "scope" option).
---- - win_id: (number, default 0) Window ID
+---@param opts? vim.diagnostic.GotoOpts
function M.goto_next(opts)
- return diagnostic_move_pos(opts, M.get_next_pos(opts))
+ diagnostic_move_pos(opts, M.get_next_pos(opts))
end
M.handlers.signs = {
@@ -868,11 +1177,9 @@ M.handlers.signs = {
diagnostics = filter_by_severity(opts.signs.severity, diagnostics)
end
- define_default_signs()
-
-- 10 is the default sign priority when none is explicitly specified
local priority = opts.signs and opts.signs.priority or 10
- local get_priority
+ local get_priority --- @type function
if opts.severity_sort then
if type(opts.severity_sort) == 'table' and opts.severity_sort.reverse then
get_priority = function(severity)
@@ -890,22 +1197,85 @@ M.handlers.signs = {
end
local ns = M.get_namespace(namespace)
- if not ns.user_data.sign_group then
- ns.user_data.sign_group = string.format('vim.diagnostic.%s', ns.name)
+ if not ns.user_data.sign_ns then
+ ns.user_data.sign_ns =
+ api.nvim_create_namespace(string.format('%s/diagnostic/signs', ns.name))
end
- local sign_group = ns.user_data.sign_group
+ -- Handle legacy diagnostic sign definitions
+ -- These were deprecated in 0.10 and will be removed in 0.12
+ if opts.signs and not opts.signs.text and not opts.signs.numhl then
+ for _, v in ipairs({ 'Error', 'Warn', 'Info', 'Hint' }) do
+ local name = string.format('DiagnosticSign%s', v)
+ local sign = vim.fn.sign_getdefined(name)[1]
+ if sign then
+ local severity = M.severity[v:upper()]
+ vim.deprecate(
+ 'Defining diagnostic signs with :sign-define or sign_define()',
+ 'vim.diagnostic.config()',
+ '0.12',
+ nil,
+ false
+ )
+
+ if not opts.signs.text then
+ opts.signs.text = {}
+ end
+
+ if not opts.signs.numhl then
+ opts.signs.numhl = {}
+ end
+
+ if not opts.signs.linehl then
+ opts.signs.linehl = {}
+ end
+
+ if opts.signs.text[severity] == nil then
+ opts.signs.text[severity] = sign.text or ''
+ end
+
+ if opts.signs.numhl[severity] == nil then
+ opts.signs.numhl[severity] = sign.numhl
+ end
+
+ if opts.signs.linehl[severity] == nil then
+ opts.signs.linehl[severity] = sign.linehl
+ end
+ end
+ end
+ end
+
+ local text = {} ---@type table<vim.diagnostic.Severity|string, string>
+ for k in pairs(M.severity) do
+ if opts.signs.text and opts.signs.text[k] then
+ text[k] = opts.signs.text[k]
+ elseif type(k) == 'string' and not text[k] then
+ text[k] = string.sub(k, 1, 1):upper()
+ end
+ end
+
+ local numhl = opts.signs.numhl or {}
+ local linehl = opts.signs.linehl or {}
+
for _, diagnostic in ipairs(diagnostics) do
- vim.fn.sign_place(0, sign_group, sign_highlight_map[diagnostic.severity], bufnr, {
- priority = get_priority(diagnostic.severity),
- lnum = diagnostic.lnum + 1,
- })
+ if api.nvim_buf_is_loaded(diagnostic.bufnr) then
+ api.nvim_buf_set_extmark(bufnr, ns.user_data.sign_ns, diagnostic.lnum, 0, {
+ sign_text = text[diagnostic.severity] or text[M.severity[diagnostic.severity]] or 'U',
+ sign_hl_group = sign_highlight_map[diagnostic.severity],
+ number_hl_group = numhl[diagnostic.severity],
+ line_hl_group = linehl[diagnostic.severity],
+ priority = get_priority(diagnostic.severity),
+ })
+ end
end
end,
+
+ --- @param namespace integer
+ --- @param bufnr integer
hide = function(namespace, bufnr)
local ns = M.get_namespace(namespace)
- if ns.user_data.sign_group and api.nvim_buf_is_valid(bufnr) then
- vim.fn.sign_unplace(ns.user_data.sign_group, { buffer = bufnr })
+ if ns.user_data.sign_ns and api.nvim_buf_is_valid(bufnr) then
+ api.nvim_buf_clear_namespace(bufnr, ns.user_data.sign_ns, 0, -1)
end
end,
}
@@ -936,15 +1306,18 @@ M.handlers.underline = {
local ns = M.get_namespace(namespace)
if not ns.user_data.underline_ns then
- ns.user_data.underline_ns = api.nvim_create_namespace('')
+ ns.user_data.underline_ns =
+ api.nvim_create_namespace(string.format('%s/diagnostic/underline', ns.name))
end
local underline_ns = ns.user_data.underline_ns
for _, diagnostic in ipairs(diagnostics) do
- local higroup = underline_highlight_map[diagnostic.severity]
+ --- @type string?
+ local higroup = underline_highlight_map[assert(diagnostic.severity)]
if higroup == nil then
-- Default to error if we don't have a highlight associated
+ -- TODO(lewis6991): this is always nil since underline_highlight_map only has integer keys
higroup = underline_highlight_map.Error
end
@@ -1000,7 +1373,7 @@ M.handlers.virtual_text = {
return
end
- local severity
+ local severity --- @type vim.diagnostic.SeverityFilter?
if opts.virtual_text then
if opts.virtual_text.format then
diagnostics = reformat_diagnostics(opts.virtual_text.format, diagnostics)
@@ -1018,7 +1391,8 @@ M.handlers.virtual_text = {
local ns = M.get_namespace(namespace)
if not ns.user_data.virt_text_ns then
- ns.user_data.virt_text_ns = api.nvim_create_namespace('')
+ ns.user_data.virt_text_ns =
+ api.nvim_create_namespace(string.format('%s/diagnostic/virtual_text', ns.name))
end
local virt_text_ns = ns.user_data.virt_text_ns
@@ -1057,7 +1431,9 @@ M.handlers.virtual_text = {
--- Exported for backward compatibility with
--- vim.lsp.diagnostic.get_virtual_text_chunks_for_line(). When that function is eventually removed,
--- this can be made local.
----@private
+--- @private
+--- @param line_diags table<integer,vim.Diagnostic>
+--- @param opts vim.diagnostic.Opts.VirtualText
function M._get_virt_text_chunks(line_diags, opts)
if #line_diags == 0 then
return nil
@@ -1107,10 +1483,10 @@ end
--- To hide diagnostics and prevent them from re-displaying, use
--- |vim.diagnostic.disable()|.
---
----@param namespace integer|nil Diagnostic namespace. When omitted, hide
---- diagnostics from all namespaces.
----@param bufnr integer|nil Buffer number, or 0 for current buffer. When
---- omitted, hide diagnostics in all buffers.
+---@param namespace integer? Diagnostic namespace. When omitted, hide
+--- diagnostics from all namespaces.
+---@param bufnr integer? Buffer number, or 0 for current buffer. When
+--- omitted, hide diagnostics in all buffers.
function M.hide(namespace, bufnr)
vim.validate({
namespace = { namespace, 'n', true },
@@ -1132,11 +1508,11 @@ end
--- Check whether diagnostics are disabled in a given buffer.
---
----@param bufnr integer|nil Buffer number, or 0 for current buffer.
----@param namespace integer|nil Diagnostic namespace. When omitted, checks if
---- all diagnostics are disabled in {bufnr}.
---- Otherwise, only checks if diagnostics from
---- {namespace} are disabled.
+---@param bufnr integer? Buffer number, or 0 for current buffer.
+---@param namespace integer? Diagnostic namespace. When omitted, checks if
+--- all diagnostics are disabled in {bufnr}.
+--- Otherwise, only checks if diagnostics from
+--- {namespace} are disabled.
---@return boolean
function M.is_disabled(bufnr, namespace)
bufnr = get_bufnr(bufnr)
@@ -1153,17 +1529,17 @@ end
--- Display diagnostics for the given namespace and buffer.
---
----@param namespace integer|nil Diagnostic namespace. When omitted, show
---- diagnostics from all namespaces.
----@param bufnr integer|nil Buffer number, or 0 for current buffer. When omitted, show
---- diagnostics in all buffers.
----@param diagnostics table|nil The diagnostics to display. When omitted, use the
+---@param namespace integer? Diagnostic namespace. When omitted, show
+--- diagnostics from all namespaces.
+---@param bufnr integer? Buffer number, or 0 for current buffer. When omitted, show
+--- diagnostics in all buffers.
+---@param diagnostics vim.Diagnostic[]? The diagnostics to display. When omitted, use the
--- saved diagnostics for the given namespace and
--- buffer. This can be used to display a list of diagnostics
--- without saving them or to display only a subset of
--- diagnostics. May not be used when {namespace}
--- or {bufnr} is nil.
----@param opts table|nil Display options. See |vim.diagnostic.config()|.
+---@param opts? vim.diagnostic.Opts Display options.
function M.show(namespace, bufnr, diagnostics, opts)
vim.validate({
namespace = { namespace, 'n', true },
@@ -1202,24 +1578,24 @@ function M.show(namespace, bufnr, diagnostics, opts)
diagnostics = diagnostics or get_diagnostics(bufnr, { namespace = namespace }, true)
- if not diagnostics or vim.tbl_isempty(diagnostics) then
+ if vim.tbl_isempty(diagnostics) then
return
end
- opts = get_resolved_options(opts, namespace, bufnr)
+ local opts_res = get_resolved_options(opts, namespace, bufnr)
- if opts.update_in_insert then
+ if opts_res.update_in_insert then
clear_scheduled_display(namespace, bufnr)
else
local mode = api.nvim_get_mode()
if string.sub(mode.mode, 1, 1) == 'i' then
- schedule_display(namespace, bufnr, opts)
+ schedule_display(namespace, bufnr, opts_res)
return
end
end
- if vim.F.if_nil(opts.severity_sort, false) then
- if type(opts.severity_sort) == 'table' and opts.severity_sort.reverse then
+ if if_nil(opts_res.severity_sort, false) then
+ if type(opts_res.severity_sort) == 'table' and opts_res.severity_sort.reverse then
table.sort(diagnostics, function(a, b)
return a.severity < b.severity
end)
@@ -1231,61 +1607,23 @@ function M.show(namespace, bufnr, diagnostics, opts)
end
for handler_name, handler in pairs(M.handlers) do
- if handler.show and opts[handler_name] then
- handler.show(namespace, bufnr, diagnostics, opts)
+ if handler.show and opts_res[handler_name] then
+ handler.show(namespace, bufnr, diagnostics, opts_res)
end
end
end
--- Show diagnostics in a floating window.
---
----@param opts table|nil Configuration table with the same keys
---- as |vim.lsp.util.open_floating_preview()| in addition to the following:
---- - bufnr: (number) Buffer number to show diagnostics from.
---- Defaults to the current buffer.
---- - namespace: (number) Limit diagnostics to the given namespace
---- - scope: (string, default "line") Show diagnostics from the whole buffer ("buffer"),
---- the current cursor line ("line"), or the current cursor position ("cursor").
---- Shorthand versions are also accepted ("c" for "cursor", "l" for "line", "b"
---- for "buffer").
---- - pos: (number or table) If {scope} is "line" or "cursor", use this position rather
---- than the cursor position. If a number, interpreted as a line number;
---- otherwise, a (row, col) tuple.
---- - severity_sort: (default false) Sort diagnostics by severity. Overrides the setting
---- from |vim.diagnostic.config()|.
---- - severity: See |diagnostic-severity|. Overrides the setting
---- from |vim.diagnostic.config()|.
---- - header: (string or table) String to use as the header for the floating window. If a
---- table, it is interpreted as a [text, hl_group] tuple. Overrides the setting
---- from |vim.diagnostic.config()|.
---- - source: (boolean or string) Include the diagnostic source in the message.
---- Use "if_many" to only show sources if there is more than one source of
---- diagnostics in the buffer. Otherwise, any truthy value means to always show
---- the diagnostic source. Overrides the setting from |vim.diagnostic.config()|.
---- - format: (function) A function that takes a diagnostic as input and returns a
---- string. The return value is the text used to display the diagnostic.
---- Overrides the setting from |vim.diagnostic.config()|.
---- - prefix: (function, string, or table) Prefix each diagnostic in the floating
---- window. If a function, it must have the signature (diagnostic, i,
---- total) -> (string, string), where {i} is the index of the diagnostic
---- being evaluated and {total} is the total number of diagnostics
---- displayed in the window. The function should return a string which
---- is prepended to each diagnostic in the window as well as an
---- (optional) highlight group which will be used to highlight the
---- prefix. If {prefix} is a table, it is interpreted as a [text,
---- hl_group] tuple as in |nvim_echo()|; otherwise, if {prefix} is a
---- string, it is prepended to each diagnostic in the window with no
---- highlight.
---- Overrides the setting from |vim.diagnostic.config()|.
---- - suffix: Same as {prefix}, but appends the text to the diagnostic instead of
---- prepending it. Overrides the setting from |vim.diagnostic.config()|.
----@return integer|nil, integer|nil: ({float_bufnr}, {win_id})
+---@param opts vim.diagnostic.Opts.Float?
+---@return integer? float_bufnr
+---@return integer? win_id
function M.open_float(opts, ...)
-- Support old (bufnr, opts) signature
- local bufnr
+ local bufnr --- @type integer?
if opts == nil or type(opts) == 'number' then
bufnr = opts
- opts = ...
+ opts = ... --- @type vim.diagnostic.Opts.Float
else
vim.validate({
opts = { opts, 't', true },
@@ -1307,16 +1645,17 @@ function M.open_float(opts, ...)
end
local scope = ({ l = 'line', c = 'cursor', b = 'buffer' })[opts.scope] or opts.scope or 'line'
- local lnum, col
+ local lnum, col --- @type integer, integer
+ local opts_pos = opts.pos
if scope == 'line' or scope == 'cursor' then
- if not opts.pos then
+ if not opts_pos then
local pos = api.nvim_win_get_cursor(0)
lnum = pos[1] - 1
col = pos[2]
- elseif type(opts.pos) == 'number' then
- lnum = opts.pos
- elseif type(opts.pos) == 'table' then
- lnum, col = unpack(opts.pos)
+ elseif type(opts_pos) == 'number' then
+ lnum = opts_pos
+ elseif type(opts_pos) == 'table' then
+ lnum, col = opts_pos[1], opts_pos[2]
else
error("Invalid value for option 'pos'")
end
@@ -1324,15 +1663,17 @@ function M.open_float(opts, ...)
error("Invalid value for option 'scope'")
end
- local diagnostics = get_diagnostics(bufnr, opts, true)
+ local diagnostics = get_diagnostics(bufnr, opts --[[@as vim.diagnostic.GetOpts]], true)
if scope == 'line' then
+ --- @param d vim.Diagnostic
diagnostics = vim.tbl_filter(function(d)
return d.lnum == lnum
end, diagnostics)
elseif scope == 'cursor' then
-- LSP servers can send diagnostics with `end_col` past the length of the line
local line_length = #api.nvim_buf_get_lines(bufnr, lnum, lnum + 1, true)[1]
+ --- @param d vim.Diagnostic
diagnostics = vim.tbl_filter(function(d)
return d.lnum == lnum
and math.min(d.col, line_length - 1) <= col
@@ -1344,7 +1685,7 @@ function M.open_float(opts, ...)
return
end
- local severity_sort = vim.F.if_nil(opts.severity_sort, global_diagnostic_options.severity_sort)
+ local severity_sort = if_nil(opts.severity_sort, global_diagnostic_options.severity_sort)
if severity_sort then
if type(severity_sort) == 'table' and severity_sort.reverse then
table.sort(diagnostics, function(a, b)
@@ -1357,8 +1698,8 @@ function M.open_float(opts, ...)
end
end
- local lines = {}
- local highlights = {}
+ local lines = {} --- @type string[]
+ local highlights = {} --- @type table[]
local header = if_nil(opts.header, 'Diagnostics:')
if header then
vim.validate({
@@ -1393,7 +1734,7 @@ function M.open_float(opts, ...)
return string.format('%d. ', i)
end)
- local prefix, prefix_hl_group
+ local prefix, prefix_hl_group --- @type string?, string?
if prefix_opt then
vim.validate({
prefix = {
@@ -1413,7 +1754,7 @@ function M.open_float(opts, ...)
return diagnostic.code and string.format(' [%s]', diagnostic.code) or ''
end)
- local suffix, suffix_hl_group
+ local suffix, suffix_hl_group --- @type string?, string?
if suffix_opt then
vim.validate({
suffix = {
@@ -1430,15 +1771,18 @@ function M.open_float(opts, ...)
end
for i, diagnostic in ipairs(diagnostics) do
- if prefix_opt and type(prefix_opt) == 'function' then
- prefix, prefix_hl_group = prefix_opt(diagnostic, i, #diagnostics)
- prefix, prefix_hl_group = prefix or '', prefix_hl_group or 'NormalFloat'
+ if type(prefix_opt) == 'function' then
+ --- @cast prefix_opt fun(...): string?, string?
+ local prefix0, prefix_hl_group0 = prefix_opt(diagnostic, i, #diagnostics)
+ prefix, prefix_hl_group = prefix0 or '', prefix_hl_group0 or 'NormalFloat'
end
- if suffix_opt and type(suffix_opt) == 'function' then
- suffix, suffix_hl_group = suffix_opt(diagnostic, i, #diagnostics)
- suffix, suffix_hl_group = suffix or '', suffix_hl_group or 'NormalFloat'
+ if type(suffix_opt) == 'function' then
+ --- @cast suffix_opt fun(...): string?, string?
+ local suffix0, suffix_hl_group0 = suffix_opt(diagnostic, i, #diagnostics)
+ suffix, suffix_hl_group = suffix0 or '', suffix_hl_group0 or 'NormalFloat'
end
- local hiname = floating_highlight_map[diagnostic.severity]
+ --- @type string?
+ local hiname = floating_highlight_map[assert(diagnostic.severity)]
local message_lines = vim.split(diagnostic.message, '\n')
for j = 1, #message_lines do
local pre = j == 1 and prefix or string.rep(' ', #prefix)
@@ -1462,7 +1806,7 @@ function M.open_float(opts, ...)
if not opts.focus_id then
opts.focus_id = scope
end
- local float_bufnr, winnr = require('vim.lsp.util').open_floating_preview(lines, 'plaintext', opts)
+ local float_bufnr, winnr = vim.lsp.util.open_floating_preview(lines, 'plaintext', opts)
for i, hl in ipairs(highlights) do
local line = lines[i]
local prefix_len = hl.prefix and hl.prefix.length or 0
@@ -1486,10 +1830,10 @@ end
--- simply remove diagnostic decorations in a way that they can be
--- re-displayed, use |vim.diagnostic.hide()|.
---
----@param namespace integer|nil Diagnostic namespace. When omitted, remove
---- diagnostics from all namespaces.
----@param bufnr integer|nil Remove diagnostics for the given buffer. When omitted,
---- diagnostics are removed for all buffers.
+---@param namespace integer? Diagnostic namespace. When omitted, remove
+--- diagnostics from all namespaces.
+---@param bufnr integer? Remove diagnostics for the given buffer. When omitted,
+--- diagnostics are removed for all buffers.
function M.reset(namespace, bufnr)
vim.validate({
namespace = { namespace, 'n', true },
@@ -1516,34 +1860,63 @@ function M.reset(namespace, bufnr)
end
end
+--- Configuration table with the following keys:
+--- @class vim.diagnostic.setqflist.Opts
+--- @inlinedoc
+---
+--- Only add diagnostics from the given namespace.
+--- @field namespace? integer
+---
+--- Open quickfix list after setting.
+--- (default: `true`)
+--- @field open? boolean
+---
+--- Title of quickfix list. Defaults to "Diagnostics".
+--- @field title? string
+---
+--- See |diagnostic-severity|.
+--- @field severity? vim.diagnostic.Severity
+
--- Add all diagnostics to the quickfix list.
---
----@param opts table|nil Configuration table with the following keys:
---- - namespace: (number) Only add diagnostics from the given namespace.
---- - open: (boolean, default true) Open quickfix list after setting.
---- - title: (string) Title of quickfix list. Defaults to "Diagnostics".
---- - severity: See |diagnostic-severity|.
+---@param opts? vim.diagnostic.setqflist.Opts
function M.setqflist(opts)
set_list(false, opts)
end
+---Configuration table with the following keys:
+--- @class vim.diagnostic.setloclist.Opts
+--- @inlinedoc
+---
+--- Only add diagnostics from the given namespace.
+--- @field namespace? integer
+---
+--- Window number to set location list for.
+--- (default: `0`)
+--- @field winnr? integer
+---
+--- Open the location list after setting.
+--- (default: `true`)
+--- @field open? boolean
+---
+--- Title of the location list. Defaults to "Diagnostics".
+--- @field title? string
+---
+--- See |diagnostic-severity|.
+--- @field severity? vim.diagnostic.Severity
+
--- Add buffer diagnostics to the location list.
---
----@param opts table|nil Configuration table with the following keys:
---- - namespace: (number) Only add diagnostics from the given namespace.
---- - winnr: (number, default 0) Window number to set location list for.
---- - open: (boolean, default true) Open the location list after setting.
---- - title: (string) Title of the location list. Defaults to "Diagnostics".
---- - severity: See |diagnostic-severity|.
+---@param opts? vim.diagnostic.setloclist.Opts
function M.setloclist(opts)
set_list(true, opts)
end
--- Disable diagnostics in the given buffer.
---
----@param bufnr integer|nil Buffer number, or 0 for current buffer. When
---- omitted, disable diagnostics in all buffers.
----@param namespace integer|nil Only disable diagnostics for the given namespace.
+---@param bufnr integer? Buffer number, or 0 for current buffer. When
+--- omitted, disable diagnostics in all buffers.
+---@param namespace integer? Only disable diagnostics for the given namespace.
function M.disable(bufnr, namespace)
vim.validate({ bufnr = { bufnr, 'n', true }, namespace = { namespace, 'n', true } })
if bufnr == nil then
@@ -1578,9 +1951,9 @@ end
--- Enable diagnostics in the given buffer.
---
----@param bufnr integer|nil Buffer number, or 0 for current buffer. When
---- omitted, enable diagnostics in all buffers.
----@param namespace integer|nil Only enable diagnostics for the given namespace.
+---@param bufnr integer? Buffer number, or 0 for current buffer. When
+--- omitted, enable diagnostics in all buffers.
+---@param namespace integer? Only enable diagnostics for the given namespace.
function M.enable(bufnr, namespace)
vim.validate({ bufnr = { bufnr, 'n', true }, namespace = { namespace, 'n', true } })
if bufnr == nil then
@@ -1614,8 +1987,7 @@ end
--- WARNING filename:27:3: Variable 'foo' does not exist
--- ```
---
---- This can be parsed into a diagnostic |diagnostic-structure|
---- with:
+--- This can be parsed into |vim.Diagnostic| structure with:
---
--- ```lua
--- local s = "WARNING filename:27:3: Variable 'foo' does not exist"
@@ -1626,14 +1998,14 @@ end
---
---@param str string String to parse diagnostics from.
---@param pat string Lua pattern with capture groups.
----@param groups table List of fields in a |diagnostic-structure| to
+---@param groups string[] List of fields in a |vim.Diagnostic| structure to
--- associate with captures from {pat}.
---@param severity_map table A table mapping the severity field from {groups}
--- with an item from |vim.diagnostic.severity|.
----@param defaults table|nil Table of default values for any fields not listed in {groups}.
---- When omitted, numeric values default to 0 and "severity" defaults to
---- ERROR.
----@return Diagnostic|nil: |diagnostic-structure| or `nil` if {pat} fails to match {str}.
+---@param defaults table? Table of default values for any fields not listed in {groups}.
+--- When omitted, numeric values default to 0 and "severity" defaults to
+--- ERROR.
+---@return vim.Diagnostic?: |vim.Diagnostic| structure or `nil` if {pat} fails to match {str}.
function M.match(str, pat, groups, severity_map, defaults)
vim.validate({
str = { str, 's' },
@@ -1643,14 +2015,16 @@ function M.match(str, pat, groups, severity_map, defaults)
defaults = { defaults, 't', true },
})
+ --- @type table<string,vim.diagnostic.Severity>
severity_map = severity_map or M.severity
- local diagnostic = {}
- local matches = { string.match(str, pat) }
+ local matches = { str:match(pat) } --- @type any[]
if vim.tbl_isempty(matches) then
return
end
+ local diagnostic = {} --- @type type<string,any>
+
for i, match in ipairs(matches) do
local field = groups[i]
if field == 'severity' then
@@ -1658,10 +2032,10 @@ function M.match(str, pat, groups, severity_map, defaults)
elseif field == 'lnum' or field == 'end_lnum' or field == 'col' or field == 'end_col' then
match = assert(tonumber(match)) - 1
end
- diagnostic[field] = match
+ diagnostic[field] = match --- @type any
end
- diagnostic = vim.tbl_extend('keep', diagnostic, defaults or {})
+ diagnostic = vim.tbl_extend('keep', diagnostic, defaults or {}) --- @type vim.Diagnostic
diagnostic.severity = diagnostic.severity or M.severity.ERROR
diagnostic.col = diagnostic.col or 0
diagnostic.end_lnum = diagnostic.end_lnum or diagnostic.lnum
@@ -1679,8 +2053,8 @@ local errlist_type_map = {
--- Convert a list of diagnostics to a list of quickfix items that can be
--- passed to |setqflist()| or |setloclist()|.
---
----@param diagnostics table List of diagnostics |diagnostic-structure|.
----@return table[] of quickfix list items |setqflist-what|
+---@param diagnostics vim.Diagnostic[]
+---@return table[] : Quickfix list items |setqflist-what|
function M.toqflist(diagnostics)
vim.validate({
diagnostics = {
@@ -1690,7 +2064,7 @@ function M.toqflist(diagnostics)
},
})
- local list = {}
+ local list = {} --- @type table[]
for _, v in ipairs(diagnostics) do
local item = {
bufnr = v.bufnr,
@@ -1720,7 +2094,7 @@ end
--- Convert a list of quickfix items to a list of diagnostics.
---
---@param list table[] List of quickfix items from |getqflist()| or |getloclist()|.
----@return Diagnostic[] array of |diagnostic-structure|
+---@return vim.Diagnostic[]
function M.fromqflist(list)
vim.validate({
list = {
@@ -1730,7 +2104,7 @@ function M.fromqflist(list)
},
})
- local diagnostics = {}
+ local diagnostics = {} --- @type vim.Diagnostic[]
for _, item in ipairs(list) do
if item.valid == 1 then
local lnum = math.max(0, item.lnum - 1)
@@ -1738,7 +2112,7 @@ function M.fromqflist(list)
local end_lnum = item.end_lnum > 0 and (item.end_lnum - 1) or lnum
local end_col = item.end_col > 0 and (item.end_col - 1) or col
local severity = item.type ~= '' and M.severity[item.type] or M.severity.ERROR
- table.insert(diagnostics, {
+ diagnostics[#diagnostics + 1] = {
bufnr = item.bufnr,
lnum = lnum,
col = col,
@@ -1746,7 +2120,7 @@ function M.fromqflist(list)
end_col = end_col,
severity = severity,
message = item.text,
- })
+ }
end
end
return diagnostics
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua
index c6200f16bb..fba76f93b2 100644
--- a/runtime/lua/vim/filetype.lua
+++ b/runtime/lua/vim/filetype.lua
@@ -267,6 +267,7 @@ local extension = {
crdpro = 'chordpro',
cho = 'chordpro',
chordpro = 'chordpro',
+ ck = 'chuck',
eni = 'cl',
icl = 'clean',
cljx = 'clojure',
@@ -341,7 +342,7 @@ local extension = {
decl = detect.decl,
dec = detect.decl,
dcl = detect_seq(detect.decl, 'clean'),
- def = 'def',
+ def = detect.def,
desc = 'desc',
directory = 'desktop',
desktop = 'desktop',
@@ -363,6 +364,8 @@ local extension = {
d = detect.dtrace,
dts = 'dts',
dtsi = 'dts',
+ dtso = 'dts',
+ its = 'dts',
dylan = 'dylan',
intr = 'dylanintr',
lid = 'dylanlid',
@@ -674,8 +677,6 @@ local extension = {
mmp = 'mmp',
mms = detect.mms,
DEF = 'modula2',
- m2 = 'modula2',
- mi = 'modula2',
lm3 = 'modula3',
mojo = 'mojo',
['🔥'] = 'mojo', -- 🙄
@@ -695,6 +696,7 @@ local extension = {
msql = 'msql',
mu = 'mupad',
mush = 'mush',
+ mustache = 'mustache',
mysql = 'mysql',
n1ql = 'n1ql',
nql = 'n1ql',
@@ -908,6 +910,7 @@ local extension = {
sed = 'sed',
sexp = 'sexplib',
bash = detect.bash,
+ bats = detect.bash,
ebuild = detect.bash,
eclass = detect.bash,
env = detect.sh,
@@ -1341,10 +1344,12 @@ local filename = {
['.hintrc'] = 'jsonc',
['.jsfmtrc'] = 'jsonc',
['.jshintrc'] = 'jsonc',
+ ['.luaurc'] = 'jsonc',
['.swrc'] = 'jsonc',
['.justfile'] = 'just',
Kconfig = 'kconfig',
['Kconfig.debug'] = 'kconfig',
+ ['Config.in'] = 'kconfig',
['lftp.conf'] = 'lftp',
['.lftprc'] = 'lftp',
['/.libao'] = 'libao',
@@ -1393,6 +1398,7 @@ local filename = {
octaverc = 'octave',
['octave.conf'] = 'octave',
opam = 'opam',
+ ['pacman.log'] = 'pacmanlog',
['/etc/pam.conf'] = 'pamconf',
['pam_env.conf'] = 'pamenv',
['.pam_environment'] = 'pamenv',
@@ -1654,6 +1660,11 @@ local pattern = {
['.*/dtrace/.*%.d'] = 'dtrace',
['.*esmtprc'] = 'esmtprc',
['.*Eterm/.*%.cfg'] = 'eterm',
+ ['.*s6.*/up'] = 'execline',
+ ['.*s6.*/down'] = 'execline',
+ ['.*s6.*/run'] = 'execline',
+ ['.*s6.*/finish'] = 'execline',
+ ['s6%-.*'] = 'execline',
['[a-zA-Z0-9].*Dict'] = detect.foam,
['[a-zA-Z0-9].*Dict%..*'] = detect.foam,
['[a-zA-Z].*Properties'] = detect.foam,
@@ -1730,6 +1741,7 @@ local pattern = {
['[jt]sconfig.*%.json'] = 'jsonc',
['[jJ]ustfile'] = 'just',
['Kconfig%..*'] = starsetf('kconfig'),
+ ['Config%.in%..*'] = starsetf('kconfig'),
['.*%.[Ss][Uu][Bb]'] = 'krl',
['lilo%.conf.*'] = starsetf('lilo'),
['.*/etc/logcheck/.*%.d.*/.*'] = starsetf('logcheck'),
@@ -1903,7 +1915,7 @@ local pattern = {
['.*baseq[2-3]/.*%.cfg'] = 'quake',
['.*quake[1-3]/.*%.cfg'] = 'quake',
['.*id1/.*%.cfg'] = 'quake',
- ['.*/queries/.*%.scm'] = 'query', -- tree-sitter queries (Neovim only)
+ ['.*/queries/.*%.scm'] = 'query', -- treesitter queries (Neovim only)
['.*,v'] = 'rcs',
['%.reminders.*'] = starsetf('remind'),
['[rR]akefile.*'] = starsetf('ruby'),
@@ -2070,6 +2082,7 @@ local function normalize_path(path, as_pattern)
end
--- @class vim.filetype.add.filetypes
+--- @inlinedoc
--- @field pattern? vim.filetype.mapping
--- @field extension? vim.filetype.mapping
--- @field filename? vim.filetype.mapping
@@ -2260,16 +2273,31 @@ local function match_pattern(name, path, tail, pat)
end
--- @class vim.filetype.match.args
+--- @inlinedoc
+---
+--- Buffer number to use for matching. Mutually exclusive with {contents}
--- @field buf? integer
+---
+--- Filename to use for matching. When {buf} is given,
+--- defaults to the filename of the given buffer number. The
+--- file need not actually exist in the filesystem. When used
+--- without {buf} only the name of the file is used for
+--- filetype matching. This may result in failure to detect
+--- the filetype in cases where the filename alone is not
+--- enough to disambiguate the filetype.
--- @field filename? string
+---
+--- An array of lines representing file contents to use for
+--- matching. Can be used with {filename}. Mutually exclusive
+--- with {buf}.
--- @field contents? string[]
--- Perform filetype detection.
---
--- The filetype can be detected using one of three methods:
---- 1. Using an existing buffer
---- 2. Using only a file name
---- 3. Using only file contents
+--- 1. Using an existing buffer
+--- 2. Using only a file name
+--- 3. Using only file contents
---
--- Of these, option 1 provides the most accurate result as it uses both the buffer's filename and
--- (optionally) the buffer contents. Options 2 and 3 can be used without an existing buffer, but
@@ -2295,18 +2323,6 @@ end
---
---@param args vim.filetype.match.args Table specifying which matching strategy to use.
--- Accepted keys are:
---- * buf (number): Buffer number to use for matching. Mutually exclusive with
---- {contents}
---- * filename (string): Filename to use for matching. When {buf} is given,
---- defaults to the filename of the given buffer number. The
---- file need not actually exist in the filesystem. When used
---- without {buf} only the name of the file is used for
---- filetype matching. This may result in failure to detect
---- the filetype in cases where the filename alone is not
---- enough to disambiguate the filetype.
---- * contents (table): An array of lines representing file contents to use for
---- matching. Can be used with {filename}. Mutually exclusive
---- with {buf}.
---@return string|nil # If a match was found, the matched filetype.
---@return function|nil # A function that modifies buffer state when called (for example, to set some
--- filetype specific buffer variables). The function accepts a buffer number as
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua
index 9d0f1bd3ab..3db4f2bcdc 100644
--- a/runtime/lua/vim/filetype/detect.lua
+++ b/runtime/lua/vim/filetype/detect.lua
@@ -419,6 +419,55 @@ function M.dtrace(_, bufnr)
return 'd'
end
+--- @param bufnr integer
+--- @return boolean
+local function is_modula2(bufnr)
+ return matchregex(nextnonblank(bufnr, 1), [[\<MODULE\s\+\w\+\s*\%(\[.*]\s*\)\=;\|^\s*(\*]])
+end
+
+--- @param bufnr integer
+--- @return string, fun(b: integer)
+local function modula2(bufnr)
+ local dialect = vim.g.modula2_default_dialect or 'pim'
+ local extension = vim.g.modula2_default_extension or ''
+
+ -- ignore unknown dialects or badly formatted tags
+ for _, line in ipairs(getlines(bufnr, 1, 200)) do
+ local matched_dialect, matched_extension = line:match('%(%*!m2(%w+)%+(%w+)%*%)')
+ if not matched_dialect then
+ matched_dialect = line:match('%(%*!m2(%w+)%*%)')
+ end
+ if matched_dialect then
+ if vim.tbl_contains({ 'iso', 'pim', 'r10' }, matched_dialect) then
+ dialect = matched_dialect
+ end
+ if vim.tbl_contains({ 'gm2' }, matched_extension) then
+ extension = matched_extension
+ end
+ break
+ end
+ end
+
+ return 'modula2',
+ function(b)
+ vim.api.nvim_buf_call(b, function()
+ fn['modula2#SetDialect'](dialect, extension)
+ end)
+ end
+end
+
+--- @type vim.filetype.mapfn
+function M.def(_, bufnr)
+ if vim.g.filetype_def == 'modula2' or is_modula2(bufnr) then
+ return modula2(bufnr)
+ end
+
+ if vim.g.filetype_def then
+ return vim.g.filetype_def
+ end
+ return 'def'
+end
+
--- @type vim.filetype.mapfn
function M.e(_, bufnr)
if vim.g.filetype_euphoria then
@@ -906,14 +955,16 @@ end
--- Determine if *.mod is ABB RAPID, LambdaProlog, Modula-2, Modsim III or go.mod
--- @type vim.filetype.mapfn
function M.mod(path, bufnr)
+ if vim.g.filetype_mod == 'modula2' or is_modula2(bufnr) then
+ return modula2(bufnr)
+ end
+
if vim.g.filetype_mod then
return vim.g.filetype_mod
elseif matchregex(path, [[\c\<go\.mod$]]) then
return 'gomod'
elseif is_lprolog(bufnr) then
return 'lprolog'
- elseif matchregex(nextnonblank(bufnr, 1), [[\%(\<MODULE\s\+\w\+\s*;\|^\s*(\*\)]]) then
- return 'modula2'
elseif is_rapid(bufnr) then
return 'rapid'
end
@@ -1530,12 +1581,26 @@ function M.v(_, bufnr)
-- Filetype was already detected
return
end
+ if vim.g.filetype_v then
+ return vim.g.filetype_v
+ end
+ local in_comment = 0
for _, line in ipairs(getlines(bufnr, 1, 200)) do
- if not line:find('^%s*/') then
- if findany(line, { ';%s*$', ';%s*/' }) then
- return 'verilog'
- elseif findany(line, { '%.%s*$', '%.%s*%(%*' }) then
+ if line:find('^%s*/%*') then
+ in_comment = 1
+ end
+ if in_comment == 1 then
+ if line:find('%*/') then
+ in_comment = 0
+ end
+ elseif not line:find('^%s*//') then
+ if
+ line:find('%.%s*$') and not line:find('/[/*]')
+ or line:find('%(%*') and not line:find('/[/*].*%(%*')
+ then
return 'coq'
+ elseif findany(line, { ';%s*$', ';%s*/[/*]' }) then
+ return 'verilog'
end
end
end
@@ -1661,6 +1726,7 @@ local patterns_hashbang = {
['^\\%(rexx\\|regina\\)\\>'] = { 'rexx', { vim_regex = true } },
['^janet\\>'] = { 'janet', { vim_regex = true } },
['^dart\\>'] = { 'dart', { vim_regex = true } },
+ ['^execlineb\\>'] = { 'execline', { vim_regex = true } },
}
---@private
diff --git a/runtime/lua/vim/fs.lua b/runtime/lua/vim/fs.lua
index 22612a7255..f9fe122f01 100644
--- a/runtime/lua/vim/fs.lua
+++ b/runtime/lua/vim/fs.lua
@@ -39,8 +39,9 @@ end
--- Return the parent directory of the given path
---
----@param file (string) Path
----@return string|nil Parent directory of {file}
+---@generic T : string|nil
+---@param file T Path
+---@return T Parent directory of {file}
function M.dirname(file)
if file == nil then
return nil
@@ -53,6 +54,7 @@ function M.dirname(file)
elseif file == '/' or file:match('^/[^/]+$') then
return '/'
end
+ ---@type string
local dir = file:match('[/\\]$') and file:sub(1, #file - 1) or file:match('^([/\\]?.+)[/\\]')
if iswin and dir:match('^%w:$') then
return dir .. '/'
@@ -62,8 +64,9 @@ end
--- Return the basename of the given path
---
----@param file string Path
----@return string|nil Basename of {file}
+---@generic T : string|nil
+---@param file T Path
+---@return T Basename of {file}
function M.basename(file)
if file == nil then
return nil
@@ -147,12 +150,30 @@ function M.dir(path, opts)
end)
end
---- @class vim.fs.find.opts
---- @field path string
---- @field upward boolean
---- @field stop string
---- @field type string
---- @field limit number
+--- @class vim.fs.find.Opts
+--- @inlinedoc
+---
+--- Path to begin searching from. If
+--- omitted, the |current-directory| is used.
+--- @field path? string
+---
+--- Search upward through parent directories.
+--- Otherwise, search through child directories (recursively).
+--- (default: `false`)
+--- @field upward? boolean
+---
+--- Stop searching when this directory is reached.
+--- The directory itself is not searched.
+--- @field stop? string
+---
+--- Find only items of the given type.
+--- If omitted, all items that match {names} are included.
+--- @field type? string
+---
+--- Stop the search after finding this many matches.
+--- Use `math.huge` to place no limit on the number of matches.
+--- (default: `1`)
+--- @field limit? number
--- Find files or directories (or other items as specified by `opts.type`) in the given path.
---
@@ -194,23 +215,10 @@ end
--- - path: full path of the current item
--- The function should return `true` if the given item is considered a match.
---
----@param opts (table) Optional keyword arguments:
---- - path (string): Path to begin searching from. If
---- omitted, the |current-directory| is used.
---- - upward (boolean, default false): If true, search
---- upward through parent directories. Otherwise,
---- search through child directories
---- (recursively).
---- - stop (string): Stop searching when this directory is
---- reached. The directory itself is not searched.
---- - type (string): Find only items of the given type.
---- If omitted, all items that match {names} are included.
---- - limit (number, default 1): Stop the search after
---- finding this many matches. Use `math.huge` to
---- place no limit on the number of matches.
+---@param opts vim.fs.find.Opts Optional keyword arguments:
---@return (string[]) # Normalized paths |vim.fs.normalize()| of all matching items
function M.find(names, opts)
- opts = opts or {} --[[@as vim.fs.find.opts]]
+ opts = opts or {}
vim.validate({
names = { names, { 's', 't', 'f' } },
path = { opts.path, 's', true },
@@ -224,7 +232,7 @@ function M.find(names, opts)
names = { names }
end
- local path = opts.path or vim.uv.cwd()
+ local path = opts.path or assert(vim.uv.cwd())
local stop = opts.stop
local limit = opts.limit or 1
@@ -318,9 +326,16 @@ function M.find(names, opts)
return matches
end
+--- @class vim.fs.normalize.Opts
+--- @inlinedoc
+---
+--- Expand environment variables.
+--- (default: `true`)
+--- @field expand_env boolean
+
--- Normalize a path to a standard format. A tilde (~) character at the
--- beginning of the path is expanded to the user's home directory and any
---- backslash (\\) characters are converted to forward slashes (/). Environment
+--- backslash (\) characters are converted to forward slashes (/). Environment
--- variables are also expanded.
---
--- Examples:
@@ -337,9 +352,8 @@ end
--- ```
---
---@param path (string) Path to normalize
----@param opts table|nil Options:
---- - expand_env: boolean Expand environment variables (default: true)
----@return (string) Normalized path
+---@param opts? vim.fs.normalize.Opts
+---@return (string) : Normalized path
function M.normalize(path, opts)
opts = opts or {}
diff --git a/runtime/lua/vim/glob.lua b/runtime/lua/vim/glob.lua
new file mode 100644
index 0000000000..ad4a915a94
--- /dev/null
+++ b/runtime/lua/vim/glob.lua
@@ -0,0 +1,84 @@
+local lpeg = vim.lpeg
+local P, S, V, R, B = lpeg.P, lpeg.S, lpeg.V, lpeg.R, lpeg.B
+local C, Cc, Ct, Cf = lpeg.C, lpeg.Cc, lpeg.Ct, lpeg.Cf
+
+local M = {}
+
+local pathsep = P('/')
+
+--- Parses a raw glob into an |lua-lpeg| pattern.
+---
+--- This uses glob semantics from LSP 3.17.0: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#pattern
+---
+--- Glob patterns can have the following syntax:
+--- - `*` to match one or more characters in a path segment
+--- - `?` to match on one character in a path segment
+--- - `**` to match any number of path segments, including none
+--- - `{}` to group conditions (e.g. `*.{ts,js}` matches TypeScript and JavaScript files)
+--- - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, 
)
+--- - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)
+---
+---@param pattern string The raw glob pattern
+---@return vim.lpeg.Pattern pattern An |lua-lpeg| representation of the pattern
+function M.to_lpeg(pattern)
+ local function class(inv, ranges)
+ local patt = R(unpack(vim.tbl_map(table.concat, ranges)))
+ if inv == '!' then
+ patt = P(1) - patt
+ end
+ return patt
+ end
+
+ local function add(acc, a)
+ return acc + a
+ end
+
+ local function mul(acc, m)
+ return acc * m
+ end
+
+ local function star(stars, after)
+ return (-after * (P(1) - pathsep)) ^ #stars * after
+ end
+
+ local function dstar(after)
+ return (-after * P(1)) ^ 0 * after
+ end
+
+ local p = P({
+ 'Pattern',
+ Pattern = V('Elem') ^ -1 * V('End'),
+ Elem = Cf(
+ (V('DStar') + V('Star') + V('Ques') + V('Class') + V('CondList') + V('Literal'))
+ * (V('Elem') + V('End')),
+ mul
+ ),
+ DStar = (B(pathsep) + -B(P(1)))
+ * P('**')
+ * (pathsep * (V('Elem') + V('End')) + V('End'))
+ / dstar,
+ Star = C(P('*') ^ 1) * (V('Elem') + V('End')) / star,
+ Ques = P('?') * Cc(P(1) - pathsep),
+ Class = P('[')
+ * C(P('!') ^ -1)
+ * Ct(Ct(C(P(1)) * P('-') * C(P(1) - P(']'))) ^ 1 * P(']'))
+ / class,
+ CondList = P('{') * Cf(V('Cond') * (P(',') * V('Cond')) ^ 0, add) * P('}'),
+ -- TODO: '*' inside a {} condition is interpreted literally but should probably have the same
+ -- wildcard semantics it usually has.
+ -- Fixing this is non-trivial because '*' should match non-greedily up to "the rest of the
+ -- pattern" which in all other cases is the entire succeeding part of the pattern, but at the end of a {}
+ -- condition means "everything after the {}" where several other options separated by ',' may
+ -- exist in between that should not be matched by '*'.
+ Cond = Cf((V('Ques') + V('Class') + V('CondList') + (V('Literal') - S(',}'))) ^ 1, mul)
+ + Cc(P(0)),
+ Literal = P(1) / P,
+ End = P(-1) * Cc(P(-1)),
+ })
+
+ local lpeg_pattern = p:match(pattern) --[[@as vim.lpeg.Pattern?]]
+ assert(lpeg_pattern, 'Invalid glob')
+ return lpeg_pattern
+end
+
+return M
diff --git a/runtime/lua/vim/health.lua b/runtime/lua/vim/health.lua
index 6e47a22d03..f6f7abef8f 100644
--- a/runtime/lua/vim/health.lua
+++ b/runtime/lua/vim/health.lua
@@ -1,8 +1,8 @@
local M = {}
-local s_output = {}
+local s_output = {} ---@type string[]
--- Returns the fold text of the current healthcheck section
+--- Returns the fold text of the current healthcheck section
function M.foldtext()
local foldtext = vim.fn.foldtext()
@@ -36,12 +36,13 @@ function M.foldtext()
return vim.b.failedchecks[foldtext] and '+WE' .. foldtext:sub(4) or foldtext
end
--- From a path return a list [{name}, {func}, {type}] representing a healthcheck
+--- @param path string path to search for the healthcheck
+--- @return string[] { name, func, type } representing a healthcheck
local function filepath_to_healthcheck(path)
path = vim.fs.normalize(path)
- local name
- local func
- local filetype
+ local name --- @type string
+ local func --- @type string
+ local filetype --- @type string
if path:find('vim$') then
name = vim.fs.basename(path):gsub('%.vim$', '')
func = 'health#' .. name .. '#check'
@@ -50,10 +51,10 @@ local function filepath_to_healthcheck(path)
local subpath = path:gsub('.*lua/', '')
if vim.fs.basename(subpath) == 'health.lua' then
-- */health.lua
- name = vim.fs.dirname(subpath)
+ name = assert(vim.fs.dirname(subpath))
else
-- */health/init.lua
- name = vim.fs.dirname(vim.fs.dirname(subpath))
+ name = assert(vim.fs.dirname(assert(vim.fs.dirname(subpath))))
end
name = name:gsub('/', '.')
@@ -63,11 +64,12 @@ local function filepath_to_healthcheck(path)
return { name, func, filetype }
end
--- Returns { {name, func, type}, ... } representing healthchecks
+--- @param plugin_names string
+--- @return table<any,string[]> { {name, func, type}, ... } representing healthchecks
local function get_healthcheck_list(plugin_names)
- local healthchecks = {}
- plugin_names = vim.split(plugin_names, ' ')
- for _, p in pairs(plugin_names) do
+ local healthchecks = {} --- @type table<any,string[]>
+ local plugin_names_list = vim.split(plugin_names, ' ')
+ for _, p in pairs(plugin_names_list) do
-- support vim/lsp/health{/init/}.lua as :checkhealth vim.lsp
p = p:gsub('%.', '/')
@@ -83,7 +85,7 @@ local function get_healthcheck_list(plugin_names)
if vim.tbl_count(paths) == 0 then
healthchecks[#healthchecks + 1] = { p, '', '' } -- healthcheck not found
else
- local unique_paths = {}
+ local unique_paths = {} --- @type table<string, boolean>
for _, v in pairs(paths) do
unique_paths[v] = true
end
@@ -100,10 +102,11 @@ local function get_healthcheck_list(plugin_names)
return healthchecks
end
--- Returns {name: [func, type], ..} representing healthchecks
+--- @param plugin_names string
+--- @return table<string, string[]> {name: [func, type], ..} representing healthchecks
local function get_healthcheck(plugin_names)
local health_list = get_healthcheck_list(plugin_names)
- local healthchecks = {}
+ local healthchecks = {} --- @type table<string, string[]>
for _, c in pairs(health_list) do
if c[1] ~= 'vim' then
healthchecks[c[1]] = { c[2], c[3] }
@@ -113,7 +116,11 @@ local function get_healthcheck(plugin_names)
return healthchecks
end
--- Indents lines *except* line 1 of a string if it contains newlines.
+--- Indents lines *except* line 1 of a string if it contains newlines.
+---
+--- @param s string
+--- @param columns integer
+--- @return string
local function indent_after_line1(s, columns)
local lines = vim.split(s, '\n')
local indent = string.rep(' ', columns)
@@ -123,13 +130,20 @@ local function indent_after_line1(s, columns)
return table.concat(lines, '\n')
end
--- Changes ':h clipboard' to ':help |clipboard|'.
+--- Changes ':h clipboard' to ':help |clipboard|'.
+---
+--- @param s string
+--- @return string
local function help_to_link(s)
return vim.fn.substitute(s, [[\v:h%[elp] ([^|][^"\r\n ]+)]], [[:help |\1|]], [[g]])
end
--- Format a message for a specific report item.
--- Variable args: Optional advice (string or list)
+--- Format a message for a specific report item.
+---
+--- @param status string
+--- @param msg string
+--- @param ... string|string[] Optional advice
+--- @return string
local function format_report_message(status, msg, ...)
local output = '- ' .. status
if status ~= '' then
@@ -159,42 +173,54 @@ local function format_report_message(status, msg, ...)
return help_to_link(output)
end
+--- @param output string
local function collect_output(output)
vim.list_extend(s_output, vim.split(output, '\n'))
end
--- Starts a new report.
+--- Starts a new report.
+---
+--- @param name string
function M.start(name)
local input = string.format('\n%s ~', name)
collect_output(input)
end
--- Reports a message in the current section.
+--- Reports a message in the current section.
+---
+--- @param msg string
function M.info(msg)
local input = format_report_message('', msg)
collect_output(input)
end
--- Reports a successful healthcheck.
+--- Reports a successful healthcheck.
+---
+--- @param msg string
function M.ok(msg)
local input = format_report_message('OK', msg)
collect_output(input)
end
--- Reports a health warning.
--- ...: Optional advice (string or table)
+--- Reports a health warning.
+---
+--- @param msg string
+--- @param ... string|string[] Optional advice
function M.warn(msg, ...)
local input = format_report_message('WARNING', msg, ...)
collect_output(input)
end
--- Reports a failed healthcheck.
--- ...: Optional advice (string or table)
+--- Reports a failed healthcheck.
+---
+--- @param msg string
+--- @param ... string|string[] Optional advice
function M.error(msg, ...)
local input = format_report_message('ERROR', msg, ...)
collect_output(input)
end
+--- @param type string
local function deprecate(type)
local before = string.format('vim.health.report_%s()', type)
local after = string.format('vim.health.%s()', type)
@@ -206,27 +232,149 @@ local function deprecate(type)
vim.print('Running healthchecks...')
end
+--- @deprecated
+--- @param name string
function M.report_start(name)
deprecate('start')
M.start(name)
end
+
+--- @deprecated
+--- @param msg string
function M.report_info(msg)
deprecate('info')
M.info(msg)
end
+
+--- @deprecated
+--- @param msg string
function M.report_ok(msg)
deprecate('ok')
M.ok(msg)
end
+
+--- @deprecated
+--- @param msg string
function M.report_warn(msg, ...)
deprecate('warn')
M.warn(msg, ...)
end
+
+--- @deprecated
+--- @param msg string
function M.report_error(msg, ...)
deprecate('error')
M.error(msg, ...)
end
+function M.provider_disabled(provider)
+ local loaded_var = 'loaded_' .. provider .. '_provider'
+ local v = vim.g[loaded_var]
+ if v == 0 then
+ M.info('Disabled (' .. loaded_var .. '=' .. v .. ').')
+ return true
+ end
+ return false
+end
+
+-- Handler for s:system() function.
+local function system_handler(self, _, data, event)
+ if event == 'stderr' then
+ if self.add_stderr_to_output then
+ self.output = self.output .. table.concat(data, '')
+ else
+ self.stderr = self.stderr .. table.concat(data, '')
+ end
+ elseif event == 'stdout' then
+ self.output = self.output .. table.concat(data, '')
+ end
+end
+
+-- Attempts to construct a shell command from an args list.
+-- Only for display, to help users debug a failed command.
+local function shellify(cmd)
+ if type(cmd) ~= 'table' then
+ return cmd
+ end
+ local escaped = {}
+ for i, v in ipairs(cmd) do
+ if v:match('[^A-Za-z_/.-]') then
+ escaped[i] = vim.fn.shellescape(v)
+ else
+ escaped[i] = v
+ end
+ end
+ return table.concat(escaped, ' ')
+end
+
+function M.cmd_ok(cmd)
+ local out = vim.fn.system(cmd)
+ return vim.v.shell_error == 0, out
+end
+
+--- Run a system command and timeout after 30 seconds.
+---
+--- @param cmd table List of command arguments to execute
+--- @param args? table Optional arguments:
+--- - stdin (string): Data to write to the job's stdin
+--- - stderr (boolean): Append stderr to stdout
+--- - ignore_error (boolean): If true, ignore error output
+--- - timeout (number): Number of seconds to wait before timing out (default 30)
+function M.system(cmd, args)
+ args = args or {}
+ local stdin = args.stdin or ''
+ local stderr = vim.F.if_nil(args.stderr, false)
+ local ignore_error = vim.F.if_nil(args.ignore_error, false)
+
+ local shell_error_code = 0
+ local opts = {
+ add_stderr_to_output = stderr,
+ output = '',
+ stderr = '',
+ on_stdout = system_handler,
+ on_stderr = system_handler,
+ on_exit = function(_, data)
+ shell_error_code = data
+ end,
+ }
+ local jobid = vim.fn.jobstart(cmd, opts)
+
+ if jobid < 1 then
+ local message =
+ string.format('Command error (job=%d): %s (in %s)', jobid, shellify(cmd), vim.loop.cwd())
+ error(message)
+ return opts.output, 1
+ end
+
+ if stdin:find('^%s$') then
+ vim.fn.chansend(jobid, stdin)
+ end
+
+ local res = vim.fn.jobwait({ jobid }, vim.F.if_nil(args.timeout, 30) * 1000)
+ if res[1] == -1 then
+ error('Command timed out: ' .. shellify(cmd))
+ vim.fn.jobstop(jobid)
+ elseif shell_error_code ~= 0 and not ignore_error then
+ local emsg = string.format(
+ 'Command error (job=%d, exit code %d): %s (in %s)',
+ jobid,
+ shell_error_code,
+ shellify(cmd),
+ vim.loop.cwd()
+ )
+ if opts.output:find('%S') then
+ emsg = string.format('%s\noutput: %s', emsg, opts.output)
+ end
+ if opts.stderr:find('%S') then
+ emsg = string.format('%s\nstderr: %s', emsg, opts.stderr)
+ end
+ error(emsg)
+ end
+
+ -- return opts.output
+ return vim.trim(vim.fn.system(cmd)), shell_error_code
+end
+
local path2name = function(path)
if path:match('%.lua$') then
-- Lua: transform "../lua/vim/lsp/health.lua" into "vim.lsp"
@@ -251,7 +399,7 @@ local path2name = function(path)
end
local PATTERNS = { '/autoload/health/*.vim', '/lua/**/**/health.lua', '/lua/**/**/health/init.lua' }
--- :checkhealth completion function used by ex_getln.c get_healthcheck_names()
+--- :checkhealth completion function used by cmdexpand.c get_healthcheck_names()
M._complete = function()
local names = vim.tbl_flatten(vim.tbl_map(function(pattern)
return vim.tbl_map(path2name, vim.api.nvim_get_runtime_file(pattern, true))
@@ -266,16 +414,25 @@ M._complete = function()
return vim.tbl_keys(unique)
end
--- Runs the specified healthchecks.
--- Runs all discovered healthchecks if plugin_names is empty.
-function M._check(plugin_names)
+--- Runs the specified healthchecks.
+--- Runs all discovered healthchecks if plugin_names is empty.
+---
+--- @param mods string command modifiers that affect splitting a window.
+--- @param plugin_names string glob of plugin names, split on whitespace. For example, using
+--- `:checkhealth vim.* nvim` will healthcheck `vim.lsp`, `vim.treesitter`
+--- and `nvim` modules.
+function M._check(mods, plugin_names)
local healthchecks = plugin_names == '' and get_healthcheck('*') or get_healthcheck(plugin_names)
- -- Create buffer and open in a tab, unless this is the default buffer when Nvim starts.
local emptybuf = vim.fn.bufnr('$') == 1 and vim.fn.getline(1) == '' and 1 == vim.fn.line('$')
- local mod = emptybuf and 'buffer' or 'tab sbuffer'
+
+ -- When no command modifiers are used:
+ -- - If the current buffer is empty, open healthcheck directly.
+ -- - If not specified otherwise open healthcheck in a tab.
+ local buf_cmd = #mods > 0 and (mods .. ' sbuffer') or emptybuf and 'buffer' or 'tab sbuffer'
+
local bufnr = vim.api.nvim_create_buf(true, true)
- vim.cmd(mod .. ' ' .. bufnr)
+ vim.cmd(buf_cmd .. ' ' .. bufnr)
if vim.fn.bufexists('health://') == 1 then
vim.cmd.bwipe('health://')
@@ -283,7 +440,8 @@ function M._check(plugin_names)
vim.cmd.file('health://')
vim.cmd.setfiletype('checkhealth')
- if healthchecks == nil or next(healthchecks) == nil then
+ -- This should only happen when doing `:checkhealth vim`
+ if next(healthchecks) == nil then
vim.fn.setline(1, 'ERROR: No healthchecks found.')
return
end
@@ -319,7 +477,7 @@ function M._check(plugin_names)
local header = { string.rep('=', 78), name .. ': ' .. func, '' }
-- remove empty line after header from report_start
if s_output[1] == '' then
- local tmp = {}
+ local tmp = {} ---@type string[]
for i = 2, #s_output do
tmp[#tmp + 1] = s_output[i]
end
@@ -339,4 +497,11 @@ function M._check(plugin_names)
vim.print('')
end
+local fn_bool = function(key)
+ return function(...)
+ return vim.fn[key](...) == 1
+ end
+end
+M.executable = fn_bool('executable')
+
return M
diff --git a/runtime/lua/vim/highlight.lua b/runtime/lua/vim/highlight.lua
index fc2fd43c97..effe280dee 100644
--- a/runtime/lua/vim/highlight.lua
+++ b/runtime/lua/vim/highlight.lua
@@ -1,4 +1,4 @@
----@defgroup vim.highlight
+---@brief
---
--- Nvim includes a function for highlighting a selection on yank.
---
@@ -19,18 +19,19 @@
--- ```vim
--- au TextYankPost * silent! lua vim.highlight.on_yank {on_visual=false}
--- ```
+---
local api = vim.api
local M = {}
--- Table with default priorities used for highlighting:
---- - `syntax`: `50`, used for standard syntax highlighting
---- - `treesitter`: `100`, used for tree-sitter-based highlighting
---- - `semantic_tokens`: `125`, used for LSP semantic token highlighting
---- - `diagnostics`: `150`, used for code analysis such as diagnostics
---- - `user`: `200`, used for user-triggered highlights such as LSP document
---- symbols or `on_yank` autocommands
+--- - `syntax`: `50`, used for standard syntax highlighting
+--- - `treesitter`: `100`, used for treesitter-based highlighting
+--- - `semantic_tokens`: `125`, used for LSP semantic token highlighting
+--- - `diagnostics`: `150`, used for code analysis such as diagnostics
+--- - `user`: `200`, used for user-triggered highlights such as LSP document
+--- symbols or `on_yank` autocommands
M.priorities = {
syntax = 50,
treesitter = 100,
@@ -55,6 +56,7 @@ function M.range(bufnr, ns, higroup, start, finish, opts)
local regtype = opts.regtype or 'v'
local inclusive = opts.inclusive or false
local priority = opts.priority or M.priorities.user
+ local scoped = opts._scoped or false
-- TODO: in case of 'v', 'V' (not block), this should calculate equivalent
-- bounds (row, col, end_row, end_col) as multiline regions are natively
@@ -72,12 +74,14 @@ function M.range(bufnr, ns, higroup, start, finish, opts)
end_col = cols[2],
priority = priority,
strict = false,
+ scoped = scoped,
})
end
end
local yank_ns = api.nvim_create_namespace('hlyank')
local yank_timer
+local yank_cancel
--- Highlight the yanked text
---
@@ -120,24 +124,29 @@ function M.on_yank(opts)
local higroup = opts.higroup or 'IncSearch'
local timeout = opts.timeout or 150
- local bufnr = api.nvim_get_current_buf()
- api.nvim_buf_clear_namespace(bufnr, yank_ns, 0, -1)
+ local bufnr = vim.api.nvim_get_current_buf()
+ local winid = vim.api.nvim_get_current_win()
if yank_timer then
yank_timer:close()
+ yank_cancel()
end
M.range(bufnr, yank_ns, higroup, "'[", "']", {
regtype = event.regtype,
inclusive = event.inclusive,
priority = opts.priority or M.priorities.user,
+ _scoped = true,
})
+ vim.api.nvim_win_add_ns(winid, yank_ns)
- yank_timer = vim.defer_fn(function()
+ yank_cancel = function()
yank_timer = nil
- if api.nvim_buf_is_valid(bufnr) then
- api.nvim_buf_clear_namespace(bufnr, yank_ns, 0, -1)
- end
- end, timeout)
+ yank_cancel = nil
+ pcall(vim.api.nvim_buf_clear_namespace, bufnr, yank_ns, 0, -1)
+ pcall(vim.api.nvim_win_remove_ns, winid, yank_ns)
+ end
+
+ yank_timer = vim.defer_fn(yank_cancel, timeout)
end
return M
diff --git a/runtime/lua/vim/iter.lua b/runtime/lua/vim/iter.lua
index 874bdfb437..a37b7f7858 100644
--- a/runtime/lua/vim/iter.lua
+++ b/runtime/lua/vim/iter.lua
@@ -1,7 +1,7 @@
----@defgroup vim.iter
+--- @brief
---
---- \*vim.iter()\* is an interface for |iterable|s: it wraps a table or function argument into an
---- \*Iter\* object with methods (such as |Iter:filter()| and |Iter:map()|) that transform the
+--- [vim.iter()]() is an interface for [iterable]s: it wraps a table or function argument into an
+--- [Iter]() object with methods (such as [Iter:filter()] and [Iter:map()]) that transform the
--- underlying source data. These methods can be 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()`:
@@ -64,10 +64,16 @@
--- In addition to the |vim.iter()| function, the |vim.iter| module provides
--- convenience functions like |vim.iter.filter()| and |vim.iter.totable()|.
+--- LuaLS is bad at generics which this module mostly deals with
+--- @diagnostic disable:no-unknown
+
+---@nodoc
---@class IterMod
---@operator call:Iter
+
local M = {}
+---@nodoc
---@class Iter
local Iter = {}
Iter.__index = Iter
@@ -76,6 +82,7 @@ Iter.__call = function(self)
end
--- Special case implementations for iterators on list tables.
+---@nodoc
---@class ListIter : Iter
---@field _table table Underlying table data
---@field _head number Index to the front of a table iterator
@@ -112,6 +119,35 @@ local function sanitize(t)
return t
end
+--- Flattens a single list-like table. Errors if it attempts to flatten a
+--- dict-like table
+---@param v table table which should be flattened
+---@param max_depth number depth to which the table should be flattened
+---@param depth number current iteration depth
+---@param result table output table that contains flattened result
+---@return table|nil flattened table if it can be flattened, otherwise nil
+local function flatten(v, max_depth, depth, result)
+ if depth < max_depth and type(v) == 'table' then
+ local i = 0
+ for _ in pairs(v) do
+ i = i + 1
+
+ if v[i] == nil then
+ -- short-circuit: this is not a list like table
+ return nil
+ end
+
+ if flatten(v[i], max_depth, depth + 1, result) == nil then
+ return nil
+ end
+ end
+ else
+ result[#result + 1] = v
+ end
+
+ return result
+end
+
--- Determine if the current iterator stage should continue.
---
--- If any arguments are passed to this function, then return those arguments
@@ -152,11 +188,11 @@ end
--- local bufs = vim.iter(vim.api.nvim_list_bufs()):filter(vim.api.nvim_buf_is_loaded)
--- ```
---
----@param f function(...):bool Takes all values returned from the previous stage
---- in the pipeline and returns false or nil if the
---- current iterator element should be removed.
+---@param f fun(...):boolean Takes all values returned from the previous stage
+--- in the pipeline and returns false or nil if the
+--- current iterator element should be removed.
---@return Iter
-function Iter.filter(self, f)
+function Iter:filter(f)
return self:map(function(...)
if f(...) then
return ...
@@ -165,7 +201,7 @@ function Iter.filter(self, f)
end
---@private
-function ListIter.filter(self, f)
+function ListIter:filter(f)
local inc = self._head < self._tail and 1 or -1
local n = self._head
for i = self._head, self._tail - inc, inc do
@@ -179,6 +215,55 @@ function ListIter.filter(self, f)
return self
end
+--- Flattens a |list-iterator|, un-nesting nested values up to the given {depth}.
+--- Errors if it attempts to flatten a dict-like value.
+---
+--- Examples:
+---
+--- ```lua
+--- vim.iter({ 1, { 2 }, { { 3 } } }):flatten():totable()
+--- -- { 1, 2, { 3 } }
+---
+--- vim.iter({1, { { a = 2 } }, { 3 } }):flatten():totable()
+--- -- { 1, { a = 2 }, 3 }
+---
+--- vim.iter({ 1, { { a = 2 } }, { 3 } }):flatten(math.huge):totable()
+--- -- error: attempt to flatten a dict-like table
+--- ```
+---
+---@param depth? number Depth to which |list-iterator| should be flattened
+--- (defaults to 1)
+---@return Iter
+---@diagnostic disable-next-line:unused-local
+function Iter:flatten(depth) -- luacheck: no unused args
+ error('flatten() requires a list-like table')
+end
+
+---@private
+function ListIter:flatten(depth)
+ depth = depth or 1
+ local inc = self._head < self._tail and 1 or -1
+ local target = {}
+
+ for i = self._head, self._tail - inc, inc do
+ local flattened = flatten(self._table[i], depth, 0, {})
+
+ -- exit early if we try to flatten a dict-like table
+ if flattened == nil then
+ error('flatten() requires a list-like table')
+ end
+
+ for _, v in pairs(flattened) do
+ target[#target + 1] = v
+ end
+ end
+
+ self._head = 1
+ self._tail = #target + 1
+ self._table = target
+ return self
+end
+
--- Maps the items of an iterator pipeline to the values returned by `f`.
---
--- If the map function returns nil, the value is filtered from the iterator.
@@ -195,13 +280,13 @@ end
--- -- { 6, 12 }
--- ```
---
----@param f function(...):any Mapping function. Takes all values returned from
---- the previous stage in the pipeline as arguments
---- and returns one or more new values, which are used
---- in the next pipeline stage. Nil return values
---- are filtered from the output.
+---@param f fun(...):any Mapping function. Takes all values returned from
+--- the previous stage in the pipeline as arguments
+--- and returns one or more new values, which are used
+--- in the next pipeline stage. Nil return values
+--- are filtered from the output.
---@return Iter
-function Iter.map(self, f)
+function Iter:map(f)
-- Implementation note: the reader may be forgiven for observing that this
-- function appears excessively convoluted. The problem to solve is that each
-- stage of the iterator pipeline can return any number of values, and the
@@ -245,7 +330,7 @@ function Iter.map(self, f)
end
---@private
-function ListIter.map(self, f)
+function ListIter:map(f)
local inc = self._head < self._tail and 1 or -1
local n = self._head
for i = self._head, self._tail - inc, inc do
@@ -263,10 +348,10 @@ end
---
--- For functions with side effects. To modify the values in the iterator, use |Iter:map()|.
---
----@param f function(...) Function to execute for each item in the pipeline.
---- Takes all of the values returned by the previous stage
---- in the pipeline as arguments.
-function Iter.each(self, f)
+---@param f fun(...) Function to execute for each item in the pipeline.
+--- Takes all of the values returned by the previous stage
+--- in the pipeline as arguments.
+function Iter:each(f)
local function fn(...)
if select(1, ...) ~= nil then
f(...)
@@ -278,7 +363,7 @@ function Iter.each(self, f)
end
---@private
-function ListIter.each(self, f)
+function ListIter:each(f)
local inc = self._head < self._tail and 1 or -1
for i = self._head, self._tail - inc, inc do
f(unpack(self._table[i]))
@@ -311,7 +396,7 @@ end
---
---
---@return table
-function Iter.totable(self)
+function Iter:totable()
local t = {}
while true do
@@ -326,7 +411,7 @@ function Iter.totable(self)
end
---@private
-function ListIter.totable(self)
+function ListIter:totable()
if self.next ~= ListIter.next or self._head >= self._tail then
return Iter.totable(self)
end
@@ -356,6 +441,18 @@ function ListIter.totable(self)
return self._table
end
+--- Collect the iterator into a delimited string.
+---
+--- Each element in the iterator is joined into a string separated by {delim}.
+---
+--- Consumes the iterator.
+---
+--- @param delim string Delimiter
+--- @return string
+function Iter:join(delim)
+ return table.concat(self:totable(), delim)
+end
+
--- Folds ("reduces") an iterator into a single value.
---
--- Examples:
@@ -375,9 +472,9 @@ end
---@generic A
---
---@param init A Initial value of the accumulator.
----@param f function(acc:A, ...):A Accumulation function.
+---@param f fun(acc:A, ...):A Accumulation function.
---@return A
-function Iter.fold(self, init, f)
+function Iter:fold(init, f)
local acc = init
--- Use a closure to handle var args returned from iterator
@@ -394,7 +491,7 @@ function Iter.fold(self, init, f)
end
---@private
-function ListIter.fold(self, init, f)
+function ListIter:fold(init, f)
local acc = init
local inc = self._head < self._tail and 1 or -1
for i = self._head, self._tail - inc, inc do
@@ -420,13 +517,13 @@ end
--- ```
---
---@return any
-function Iter.next(self) -- luacheck: no unused args
+function Iter:next()
-- This function is provided by the source iterator in Iter.new. This definition exists only for
-- the docstring
end
---@private
-function ListIter.next(self)
+function ListIter:next()
if self._head ~= self._tail then
local v = self._table[self._head]
local inc = self._head < self._tail and 1 or -1
@@ -448,13 +545,12 @@ end
--- ```
---
---@return Iter
-function Iter.rev(self)
+function Iter:rev()
error('rev() requires a list-like table')
- return self
end
---@private
-function ListIter.rev(self)
+function ListIter:rev()
local inc = self._head < self._tail and 1 or -1
self._head, self._tail = self._tail - inc, self._head - inc
return self
@@ -477,12 +573,12 @@ end
--- ```
---
---@return any
-function Iter.peek(self) -- luacheck: no unused args
+function Iter:peek()
error('peek() requires a list-like table')
end
---@private
-function ListIter.peek(self)
+function ListIter:peek()
if self._head ~= self._tail then
return self._table[self._head]
end
@@ -509,9 +605,9 @@ end
--- -- 12
---
--- ```
----
+---@param f any
---@return any
-function Iter.find(self, f)
+function Iter:find(f)
if type(f) ~= 'function' then
local val = f
f = function(v)
@@ -555,13 +651,15 @@ end
---
---@see Iter.find
---
+---@param f any
---@return any
-function Iter.rfind(self, f) -- luacheck: no unused args
+---@diagnostic disable-next-line: unused-local
+function Iter:rfind(f) -- luacheck: no unused args
error('rfind() requires a list-like table')
end
---@private
-function ListIter.rfind(self, f) -- luacheck: no unused args
+function ListIter:rfind(f)
if type(f) ~= 'function' then
local val = f
f = function(v)
@@ -580,6 +678,41 @@ function ListIter.rfind(self, f) -- luacheck: no unused args
self._head = self._tail
end
+--- Transforms an iterator to yield only the first n values.
+---
+--- Example:
+---
+--- ```lua
+--- local it = vim.iter({ 1, 2, 3, 4 }):take(2)
+--- it:next()
+--- -- 1
+--- it:next()
+--- -- 2
+--- it:next()
+--- -- nil
+--- ```
+---
+---@param n integer
+---@return Iter
+function Iter:take(n)
+ local next = self.next
+ local i = 0
+ self.next = function()
+ if i < n then
+ i = i + 1
+ return next(self)
+ end
+ end
+ return self
+end
+
+---@private
+function ListIter:take(n)
+ local inc = self._head < self._tail and 1 or -1
+ self._tail = math.min(self._tail, self._head + n * inc)
+ return self
+end
+
--- "Pops" a value from a |list-iterator| (gets the last value and decrements the tail).
---
--- Example:
@@ -593,11 +726,12 @@ end
--- ```
---
---@return any
-function Iter.nextback(self) -- luacheck: no unused args
+function Iter:nextback()
error('nextback() requires a list-like table')
end
-function ListIter.nextback(self)
+--- @nodoc
+function ListIter:nextback()
if self._head ~= self._tail then
local inc = self._head < self._tail and 1 or -1
self._tail = self._tail - inc
@@ -622,11 +756,12 @@ end
--- ```
---
---@return any
-function Iter.peekback(self) -- luacheck: no unused args
+function Iter:peekback()
error('peekback() requires a list-like table')
end
-function ListIter.peekback(self)
+---@nodoc
+function ListIter:peekback()
if self._head ~= self._tail then
local inc = self._head < self._tail and 1 or -1
return self._table[self._tail - inc]
@@ -647,7 +782,7 @@ end
---
---@param n number Number of values to skip.
---@return Iter
-function Iter.skip(self, n)
+function Iter:skip(n)
for _ = 1, n do
local _ = self:next()
end
@@ -655,7 +790,7 @@ function Iter.skip(self, n)
end
---@private
-function ListIter.skip(self, n)
+function ListIter:skip(n)
local inc = self._head < self._tail and n or -n
self._head = self._head + inc
if (inc > 0 and self._head > self._tail) or (inc < 0 and self._head < self._tail) then
@@ -678,13 +813,13 @@ end
---
---@param n number Number of values to skip.
---@return Iter
-function Iter.skipback(self, n) -- luacheck: no unused args
+---@diagnostic disable-next-line: unused-local
+function Iter:skipback(n) -- luacheck: no unused args
error('skipback() requires a list-like table')
- return self
end
---@private
-function ListIter.skipback(self, n)
+function ListIter:skipback(n)
local inc = self._head < self._tail and n or -n
self._tail = self._tail - inc
if (inc > 0 and self._head > self._tail) or (inc < 0 and self._head < self._tail) then
@@ -709,7 +844,7 @@ end
---
---@param n number The index of the value to return.
---@return any
-function Iter.nth(self, n)
+function Iter:nth(n)
if n > 0 then
return self:skip(n - 1):next()
end
@@ -731,7 +866,7 @@ end
---
---@param n number The index of the value to return.
---@return any
-function Iter.nthback(self, n)
+function Iter:nthback(n)
if n > 0 then
return self:skipback(n - 1):nextback()
end
@@ -744,22 +879,22 @@ end
---@param first number
---@param last number
---@return Iter
-function Iter.slice(self, first, last) -- luacheck: no unused args
+---@diagnostic disable-next-line: unused-local
+function Iter:slice(first, last) -- luacheck: no unused args
error('slice() requires a list-like table')
- return self
end
---@private
-function ListIter.slice(self, first, last)
+function ListIter:slice(first, last)
return self:skip(math.max(0, first - 1)):skipback(math.max(0, self._tail - last - 1))
end
--- Returns true if any of the items in the iterator match the given predicate.
---
----@param pred function(...):bool Predicate function. Takes all values returned from the previous
---- stage in the pipeline as arguments and returns true if the
---- predicate matches.
-function Iter.any(self, pred)
+---@param pred fun(...):boolean Predicate function. Takes all values returned from the previous
+--- stage in the pipeline as arguments and returns true if the
+--- predicate matches.
+function Iter:any(pred)
local any = false
--- Use a closure to handle var args returned from iterator
@@ -780,10 +915,10 @@ end
--- Returns true if all items in the iterator match the given predicate.
---
----@param pred function(...):bool Predicate function. Takes all values returned from the previous
---- stage in the pipeline as arguments and returns true if the
---- predicate matches.
-function Iter.all(self, pred)
+---@param pred fun(...):boolean Predicate function. Takes all values returned from the previous
+--- stage in the pipeline as arguments and returns true if the
+--- predicate matches.
+function Iter:all(pred)
local all = true
local function fn(...)
@@ -818,7 +953,7 @@ end
--- ```
---
---@return any
-function Iter.last(self)
+function Iter:last()
local last = self:next()
local cur = self:next()
while cur do
@@ -829,7 +964,7 @@ function Iter.last(self)
end
---@private
-function ListIter.last(self)
+function ListIter:last()
local inc = self._head < self._tail and 1 or -1
local v = self._table[self._tail - inc]
self._head = self._tail
@@ -865,7 +1000,7 @@ end
--- ```
---
---@return Iter
-function Iter.enumerate(self)
+function Iter:enumerate()
local i = 0
return self:map(function(...)
i = i + 1
@@ -874,7 +1009,7 @@ function Iter.enumerate(self)
end
---@private
-function ListIter.enumerate(self)
+function ListIter:enumerate()
local inc = self._head < self._tail and 1 or -1
for i = self._head, self._tail - inc, inc do
local v = self._table[i]
@@ -978,9 +1113,9 @@ end
---
---@see |Iter:filter()|
---
----@param f function(...):bool Filter function. Accepts the current iterator or table values as
---- arguments and returns true if those values should be kept in the
---- final table
+---@param f fun(...):boolean Filter function. Accepts the current iterator or table values as
+--- arguments and returns true if those values should be kept in the
+--- final table
---@param src table|function Table or iterator function to filter
---@return table
function M.filter(f, src, ...)
@@ -996,18 +1131,17 @@ end
---
---@see |Iter:map()|
---
----@param f function(...):?any Map function. Accepts the current iterator or table values as
---- arguments and returns one or more new values. Nil values are removed
---- from the final table.
+---@param f fun(...): any? Map function. Accepts the current iterator or table values as
+--- arguments and returns one or more new values. Nil values are removed
+--- from the final table.
---@param src table|function Table or iterator function to filter
---@return table
function M.map(f, src, ...)
return Iter.new(src, ...):map(f):totable()
end
----@type IterMod
return setmetatable(M, {
__call = function(_, ...)
return Iter.new(...)
end,
-})
+}) --[[@as IterMod]]
diff --git a/runtime/lua/vim/keymap.lua b/runtime/lua/vim/keymap.lua
index bdea95f9ab..84e9b4197d 100644
--- a/runtime/lua/vim/keymap.lua
+++ b/runtime/lua/vim/keymap.lua
@@ -44,7 +44,7 @@ function keymap.set(mode, lhs, rhs, opts)
opts = { opts, 't', true },
})
- opts = vim.deepcopy(opts or {})
+ opts = vim.deepcopy(opts or {}, true)
---@cast mode string[]
mode = type(mode) == 'string' and { mode } or mode
@@ -90,6 +90,8 @@ end
--- vim.keymap.del({'n', 'i', 'v'}, '<leader>w', { buffer = 5 })
--- ```
---
+---@param modes string|string[]
+---@param lhs string
---@param opts table|nil A table of optional arguments:
--- - "buffer": (integer|boolean) Remove a mapping from the given buffer.
--- When `0` or `true`, use the current buffer.
diff --git a/runtime/lua/vim/loader.lua b/runtime/lua/vim/loader.lua
index ee01111337..d3d8948654 100644
--- a/runtime/lua/vim/loader.lua
+++ b/runtime/lua/vim/loader.lua
@@ -1,24 +1,46 @@
+local fs = vim.fs -- "vim.fs" is a dependency, so must be loaded early.
local uv = vim.uv
-local uri_encode = vim.uri_encode
+local uri_encode = vim.uri_encode --- @type function
--- @type (fun(modename: string): fun()|string)[]
local loaders = package.loaders
local M = {}
----@alias CacheHash {mtime: {nsec: integer, sec: integer}, size: integer, type?: uv.aliases.fs_stat_types}
+---@alias CacheHash {mtime: {nsec: integer, sec: integer}, size: integer, type?: string}
---@alias CacheEntry {hash:CacheHash, chunk:string}
----@class ModuleFindOpts
----@field all? boolean Search for all matches (defaults to `false`)
----@field rtp? boolean Search for modname in the runtime path (defaults to `true`)
----@field patterns? string[] Patterns to use (defaults to `{"/init.lua", ".lua"}`)
----@field paths? string[] Extra paths to search for modname
-
----@class ModuleInfo
----@field modpath string Path of the module
----@field modname string Name of the module
----@field stat? uv.uv_fs_t File stat of the module path
+--- @class vim.loader.find.Opts
+--- @inlinedoc
+---
+--- Search for modname in the runtime path.
+--- (default: `true`)
+--- @field rtp? boolean
+---
+--- Extra paths to search for modname
+--- (default: `{}`)
+--- @field paths? string[]
+---
+--- List of patterns to use when searching for modules.
+--- A pattern is a string added to the basename of the Lua module being searched.
+--- (default: `{"/init.lua", ".lua"}`)
+--- @field patterns? string[]
+---
+--- Search for all matches.
+--- (default: `false`)
+--- @field all? boolean
+
+--- @class vim.loader.ModuleInfo
+--- @inlinedoc
+---
+--- Path of the module
+--- @field modpath string
+---
+--- Name of the module
+--- @field modname string
+---
+--- The fs_stat of the module path. Won't be returned for `modname="*"`
+--- @field stat? uv.uv_fs_t
---@alias LoaderStats table<string, {total:number, time:number, [string]:number?}?>
@@ -28,14 +50,14 @@ M.path = vim.fn.stdpath('cache') .. '/luac'
---@nodoc
M.enabled = false
----@class Loader
----@field _rtp string[]
----@field _rtp_pure string[]
----@field _rtp_key string
----@field _hashes? table<string, CacheHash>
+---@class (private) Loader
+---@field private _rtp string[]
+---@field private _rtp_pure string[]
+---@field private _rtp_key string
+---@field private _hashes? table<string, CacheHash>
local Loader = {
VERSION = 4,
- ---@type table<string, table<string,ModuleInfo>>
+ ---@type table<string, table<string,vim.loader.ModuleInfo>>
_indexed = {},
---@type table<string, string[]>
_topmods = {},
@@ -63,7 +85,7 @@ function Loader.get_hash(path)
end
local function normalize(path)
- return vim.fs.normalize(path, { expand_env = false })
+ return fs.normalize(path, { expand_env = false })
end
--- Gets the rtp excluding after directories.
@@ -189,7 +211,6 @@ function Loader.loader_lib(modname)
local sysname = uv.os_uname().sysname:lower() or ''
local is_win = sysname:find('win', 1, true) and not sysname:find('darwin', 1, true)
local ret = M.find(modname, { patterns = is_win and { '.dll' } or { '.so' } })[1]
- ---@type function?, string?
if ret then
-- Making function name in Lua 5.1 (see src/loadlib.c:mkfuncname) is
-- a) strip prefix up to and including the first dash, if any
@@ -207,15 +228,13 @@ end
--- `loadfile` using the cache
--- Note this has the mode and env arguments which is supported by LuaJIT and is 5.1 compatible.
---@param filename? string
----@param mode? "b"|"t"|"bt"
+---@param _mode? "b"|"t"|"bt"
---@param env? table
---@return function?, string? error_message
---@private
--- luacheck: ignore 312
-function Loader.loadfile(filename, mode, env)
+function Loader.loadfile(filename, _mode, env)
-- ignore mode, since we byte-compile the Lua source files
- mode = nil
- return Loader.load(normalize(filename), { mode = mode, env = env })
+ return Loader.load(normalize(filename), { env = env })
end
--- Checks whether two cache hashes are the same based on:
@@ -272,17 +291,8 @@ end
--- Finds Lua modules for the given module name.
---@param modname string Module name, or `"*"` to find the top-level modules instead
----@param opts? ModuleFindOpts (table|nil) Options for finding a module:
---- - rtp: (boolean) Search for modname in the runtime path (defaults to `true`)
---- - paths: (string[]) Extra paths to search for modname (defaults to `{}`)
---- - patterns: (string[]) List of patterns to use when searching for modules.
---- A pattern is a string added to the basename of the Lua module being searched.
---- (defaults to `{"/init.lua", ".lua"}`)
---- - all: (boolean) Return all matches instead of just the first one (defaults to `false`)
----@return ModuleInfo[] (list) A list of results with the following properties:
---- - modpath: (string) the path to the module
---- - modname: (string) the name of the module
---- - stat: (table|nil) the fs_stat of the module path. Won't be returned for `modname="*"`
+---@param opts? vim.loader.find.Opts Options for finding a module:
+---@return vim.loader.ModuleInfo[]
function M.find(modname, opts)
opts = opts or {}
@@ -308,7 +318,7 @@ function M.find(modname, opts)
patterns[p] = '/lua/' .. basename .. pattern
end
- ---@type ModuleInfo[]
+ ---@type vim.loader.ModuleInfo[]
local results = {}
-- Only continue if we haven't found anything yet or we want to find all
@@ -432,7 +442,7 @@ end
function Loader.lsmod(path)
if not Loader._indexed[path] then
Loader._indexed[path] = {}
- for name, t in vim.fs.dir(path .. '/lua') do
+ for name, t in fs.dir(path .. '/lua') do
local modpath = path .. '/lua/' .. name
-- HACK: type is not always returned due to a bug in luv
t = t or Loader.get_hash(modpath).type
@@ -474,12 +484,12 @@ function Loader.track(stat, f)
end
end
----@class ProfileOpts
+---@class (private) vim.loader._profile.Opts
---@field loaders? boolean Add profiling to the loaders
--- Debug function that wraps all loaders and tracks stats
---@private
----@param opts ProfileOpts?
+---@param opts vim.loader._profile.Opts?
function M._profile(opts)
Loader.get_rtp = Loader.track('get_rtp', Loader.get_rtp)
Loader.read = Loader.track('read', Loader.read)
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index 261a3aa5de..d5c376ba44 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -1,39 +1,37 @@
----@diagnostic disable: invisible
-local default_handlers = require('vim.lsp.handlers')
-local log = require('vim.lsp.log')
-local lsp_rpc = require('vim.lsp.rpc')
-local protocol = require('vim.lsp.protocol')
-local ms = protocol.Methods
-local util = require('vim.lsp.util')
-local sync = require('vim.lsp.sync')
-local semantic_tokens = require('vim.lsp.semantic_tokens')
-
local api = vim.api
-local nvim_err_writeln, nvim_buf_get_lines, nvim_command, nvim_exec_autocmds =
- api.nvim_err_writeln, api.nvim_buf_get_lines, api.nvim_command, api.nvim_exec_autocmds
-local uv = vim.uv
local tbl_isempty, tbl_extend = vim.tbl_isempty, vim.tbl_extend
local validate = vim.validate
local if_nil = vim.F.if_nil
-local lsp = {
- protocol = protocol,
-
- handlers = default_handlers,
-
- buf = require('vim.lsp.buf'),
- diagnostic = require('vim.lsp.diagnostic'),
- codelens = require('vim.lsp.codelens'),
- inlay_hint = require('vim.lsp.inlay_hint'),
- semantic_tokens = semantic_tokens,
- util = util,
+local lsp = vim._defer_require('vim.lsp', {
+ _changetracking = ..., --- @module 'vim.lsp._changetracking'
+ _completion = ..., --- @module 'vim.lsp._completion'
+ _dynamic = ..., --- @module 'vim.lsp._dynamic'
+ _snippet_grammar = ..., --- @module 'vim.lsp._snippet_grammar'
+ _tagfunc = ..., --- @module 'vim.lsp._tagfunc'
+ _watchfiles = ..., --- @module 'vim.lsp._watchfiles'
+ buf = ..., --- @module 'vim.lsp.buf'
+ client = ..., --- @module 'vim.lsp.client'
+ codelens = ..., --- @module 'vim.lsp.codelens'
+ diagnostic = ..., --- @module 'vim.lsp.diagnostic'
+ handlers = ..., --- @module 'vim.lsp.handlers'
+ inlay_hint = ..., --- @module 'vim.lsp.inlay_hint'
+ log = ..., --- @module 'vim.lsp.log'
+ protocol = ..., --- @module 'vim.lsp.protocol'
+ rpc = ..., --- @module 'vim.lsp.rpc'
+ semantic_tokens = ..., --- @module 'vim.lsp.semantic_tokens'
+ util = ..., --- @module 'vim.lsp.util'
+})
- -- Allow raw RPC access.
- rpc = lsp_rpc,
+local log = lsp.log
+local protocol = lsp.protocol
+local ms = protocol.Methods
+local util = lsp.util
+local changetracking = lsp._changetracking
- -- Export these directly from rpc.
- rpc_response_error = lsp_rpc.rpc_response_error,
-}
+-- Export these directly from rpc.
+---@nodoc
+lsp.rpc_response_error = lsp.rpc.rpc_response_error
-- maps request name to the required server_capability in the client.
lsp._request_name_to_capability = {
@@ -69,14 +67,6 @@ lsp._request_name_to_capability = {
-- TODO improve handling of scratch buffers with LSP attached.
---- Concatenates and writes a list of strings to the Vim error buffer.
----
----@param ... string List to write to the buffer
-local function err_message(...)
- nvim_err_writeln(table.concat(vim.tbl_flatten({ ... })))
- nvim_command('redraw')
-end
-
--- Returns the buffer number for the given {bufnr}.
---
---@param bufnr (integer|nil) Buffer number to resolve. Defaults to current buffer
@@ -102,57 +92,28 @@ function lsp._unsupported_method(method)
return msg
end
---- Checks whether a given path is a directory.
----
----@param filename (string) path to check
----@return boolean # true if {filename} exists and is a directory, false otherwise
-local function is_dir(filename)
- validate({ filename = { filename, 's' } })
- local stat = uv.fs_stat(filename)
- return stat and stat.type == 'directory' or false
-end
-
local wait_result_reason = { [-1] = 'timeout', [-2] = 'interrupted', [-3] = 'error' }
-local valid_encodings = {
- ['utf-8'] = 'utf-8',
- ['utf-16'] = 'utf-16',
- ['utf-32'] = 'utf-32',
- ['utf8'] = 'utf-8',
- ['utf16'] = 'utf-16',
- ['utf32'] = 'utf-32',
- UTF8 = 'utf-8',
- UTF16 = 'utf-16',
- UTF32 = 'utf-32',
-}
-
local format_line_ending = {
['unix'] = '\n',
['dos'] = '\r\n',
['mac'] = '\r',
}
+---@private
---@param bufnr (number)
---@return string
-local function buf_get_line_ending(bufnr)
+function lsp._buf_get_line_ending(bufnr)
return format_line_ending[vim.bo[bufnr].fileformat] or '\n'
end
-local client_index = 0
---- Returns a new, unused client id.
----
----@return integer client_id
-local function next_client_id()
- client_index = client_index + 1
- return client_index
-end
-- Tracks all clients created via lsp.start_client
-local active_clients = {} --- @type table<integer,lsp.Client>
+local active_clients = {} --- @type table<integer,vim.lsp.Client>
local all_buffer_active_clients = {} --- @type table<integer,table<integer,true>>
-local uninitialized_clients = {} --- @type table<integer,lsp.Client>
+local uninitialized_clients = {} --- @type table<integer,vim.lsp.Client>
---@param bufnr? integer
----@param fn fun(client: lsp.Client, client_id: integer, bufnr: integer)
+---@param fn fun(client: vim.lsp.Client, client_id: integer, bufnr: integer)
local function for_each_buffer_client(bufnr, fn, restrict_client_ids)
validate({
fn = { fn, 'f' },
@@ -182,136 +143,36 @@ local function for_each_buffer_client(bufnr, fn, restrict_client_ids)
end
end
+local client_errors_base = table.maxn(lsp.rpc.client_errors)
+local client_errors_offset = 0
+
+local function client_error(name)
+ client_errors_offset = client_errors_offset + 1
+ local index = client_errors_base + client_errors_offset
+ return { [name] = index, [index] = name }
+end
+
--- Error codes to be used with `on_error` from |vim.lsp.start_client|.
--- Can be used to look up the string from a the number or the number
--- from the string.
--- @nodoc
lsp.client_errors = tbl_extend(
'error',
- lsp_rpc.client_errors,
- vim.tbl_add_reverse_lookup({
- BEFORE_INIT_CALLBACK_ERROR = table.maxn(lsp_rpc.client_errors) + 1,
- ON_INIT_CALLBACK_ERROR = table.maxn(lsp_rpc.client_errors) + 2,
- ON_ATTACH_ERROR = table.maxn(lsp_rpc.client_errors) + 3,
- })
+ lsp.rpc.client_errors,
+ client_error('BEFORE_INIT_CALLBACK_ERROR'),
+ client_error('ON_INIT_CALLBACK_ERROR'),
+ client_error('ON_ATTACH_ERROR'),
+ client_error('ON_EXIT_CALLBACK_ERROR')
)
---- Normalizes {encoding} to valid LSP encoding names.
----
----@param encoding (string) Encoding to normalize
----@return string # normalized encoding name
-local function validate_encoding(encoding)
- validate({
- encoding = { encoding, 's' },
- })
- return valid_encodings[encoding:lower()]
- or error(
- string.format(
- "Invalid offset encoding %q. Must be one of: 'utf-8', 'utf-16', 'utf-32'",
- encoding
- )
- )
-end
-
----@internal
---- Parses a command invocation into the command itself and its args. If there
---- are no arguments, an empty table is returned as the second argument.
----
----@param input string[]
----@return string command, string[] args #the command and arguments
-function lsp._cmd_parts(input)
- validate({
- cmd = {
- input,
- function()
- return vim.tbl_islist(input)
- end,
- 'list',
- },
- })
-
- local cmd = input[1]
- local cmd_args = {}
- -- Don't mutate our input.
- for i, v in ipairs(input) do
- validate({ ['cmd argument'] = { v, 's' } })
- if i > 1 then
- table.insert(cmd_args, v)
- end
- end
- return cmd, cmd_args
-end
-
---- Augments a validator function with support for optional (nil) values.
----
----@param fn (fun(v): boolean) The original validator function; should return a
----bool.
----@return fun(v): boolean # The augmented function. Also returns true if {v} is
----`nil`.
-local function optional_validator(fn)
- return function(v)
- return v == nil or fn(v)
- end
-end
-
---- Validates a client configuration as given to |vim.lsp.start_client()|.
----
----@param config (lsp.ClientConfig)
----@return (string|fun(dispatchers:table):table) Command
----@return string[] Arguments
----@return string Encoding.
-local function validate_client_config(config)
- validate({
- config = { config, 't' },
- })
- validate({
- handlers = { config.handlers, 't', true },
- capabilities = { config.capabilities, 't', true },
- cmd_cwd = { config.cmd_cwd, optional_validator(is_dir), 'directory' },
- cmd_env = { config.cmd_env, 't', true },
- detached = { config.detached, 'b', true },
- name = { config.name, 's', true },
- on_error = { config.on_error, 'f', true },
- on_exit = { config.on_exit, 'f', true },
- on_init = { config.on_init, 'f', true },
- settings = { config.settings, 't', true },
- commands = { config.commands, 't', true },
- before_init = { config.before_init, 'f', true },
- offset_encoding = { config.offset_encoding, 's', true },
- flags = { config.flags, 't', true },
- get_language_id = { config.get_language_id, 'f', true },
- })
- assert(
- (
- not config.flags
- or not config.flags.debounce_text_changes
- or type(config.flags.debounce_text_changes) == 'number'
- ),
- 'flags.debounce_text_changes must be a number with the debounce time in milliseconds'
- )
-
- local cmd, cmd_args --- @type (string|fun(dispatchers:table):table), string[]
- local config_cmd = config.cmd
- if type(config_cmd) == 'function' then
- cmd = config_cmd
- else
- cmd, cmd_args = lsp._cmd_parts(config_cmd)
- end
- local offset_encoding = valid_encodings.UTF16
- if config.offset_encoding then
- offset_encoding = validate_encoding(config.offset_encoding)
- end
-
- return cmd, cmd_args, offset_encoding
-end
-
+---@private
--- Returns full text of buffer {bufnr} as a string.
---
---@param bufnr (number) Buffer handle, or 0 for current.
---@return string # Buffer text as string.
-local function buf_get_full_text(bufnr)
- local line_ending = buf_get_line_ending(bufnr)
- local text = table.concat(nvim_buf_get_lines(bufnr, 0, -1, true), line_ending)
+function lsp._buf_get_full_text(bufnr)
+ local line_ending = lsp._buf_get_line_ending(bufnr)
+ local text = table.concat(api.nvim_buf_get_lines(bufnr, 0, -1, true), line_ending)
if vim.bo[bufnr].eol then
text = text .. line_ending
end
@@ -327,484 +188,26 @@ end
---@param fn (T) Function to run
---@return T
local function once(fn)
- local value --- @type any
+ local value --- @type function
local ran = false
return function(...)
if not ran then
- value = fn(...)
+ value = fn(...) --- @type function
ran = true
end
return value
end
end
-local changetracking = {}
-do
- ---@private
- ---
- --- LSP has 3 different sync modes:
- --- - None (Servers will read the files themselves when needed)
- --- - Full (Client sends the full buffer content on updates)
- --- - Incremental (Client sends only the changed parts)
- ---
- --- Changes are tracked per buffer.
- --- A buffer can have multiple clients attached and each client needs to send the changes
- --- To minimize the amount of changesets to compute, computation is grouped:
- ---
- --- None: One group for all clients
- --- Full: One group for all clients
- --- Incremental: One group per `offset_encoding`
- ---
- --- Sending changes can be debounced per buffer. To simplify the implementation the
- --- smallest debounce interval is used and we don't group clients by different intervals.
- ---
- --- @class CTGroup
- --- @field sync_kind integer TextDocumentSyncKind, considers config.flags.allow_incremental_sync
- --- @field offset_encoding "utf-8"|"utf-16"|"utf-32"
- ---
- --- @class CTBufferState
- --- @field name string name of the buffer
- --- @field lines string[] snapshot of buffer lines from last didChange
- --- @field lines_tmp string[]
- --- @field pending_changes table[] List of debounced changes in incremental sync mode
- --- @field timer nil|uv.uv_timer_t uv_timer
- --- @field last_flush nil|number uv.hrtime of the last flush/didChange-notification
- --- @field needs_flush boolean true if buffer updates haven't been sent to clients/servers yet
- --- @field refs integer how many clients are using this group
- ---
- --- @class CTGroupState
- --- @field buffers table<integer, CTBufferState>
- --- @field debounce integer debounce duration in ms
- --- @field clients table<integer, table> clients using this state. {client_id, client}
-
- ---@param group CTGroup
- ---@return string
- local function group_key(group)
- if group.sync_kind == protocol.TextDocumentSyncKind.Incremental then
- return tostring(group.sync_kind) .. '\0' .. group.offset_encoding
- end
- return tostring(group.sync_kind)
- end
-
- ---@private
- ---@type table<CTGroup, CTGroupState>
- local state_by_group = setmetatable({}, {
- __index = function(tbl, k)
- return rawget(tbl, group_key(k))
- end,
- __newindex = function(tbl, k, v)
- rawset(tbl, group_key(k), v)
- end,
- })
-
- ---@return CTGroup
- local function get_group(client)
- local allow_inc_sync = if_nil(client.config.flags.allow_incremental_sync, true)
- local change_capability = vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'change')
- local sync_kind = change_capability or protocol.TextDocumentSyncKind.None
- if not allow_inc_sync and change_capability == protocol.TextDocumentSyncKind.Incremental then
- sync_kind = protocol.TextDocumentSyncKind.Full
- end
- return {
- sync_kind = sync_kind,
- offset_encoding = client.offset_encoding,
- }
- end
-
- ---@param state CTBufferState
- local function incremental_changes(state, encoding, bufnr, firstline, lastline, new_lastline)
- local prev_lines = state.lines
- local curr_lines = state.lines_tmp
-
- local changed_lines = nvim_buf_get_lines(bufnr, firstline, new_lastline, true)
- for i = 1, firstline do
- curr_lines[i] = prev_lines[i]
- end
- for i = firstline + 1, new_lastline do
- curr_lines[i] = changed_lines[i - firstline]
- end
- for i = lastline + 1, #prev_lines do
- curr_lines[i - lastline + new_lastline] = prev_lines[i]
- end
- if tbl_isempty(curr_lines) then
- -- Can happen when deleting the entire contents of a buffer, see https://github.com/neovim/neovim/issues/16259.
- curr_lines[1] = ''
- end
-
- local line_ending = buf_get_line_ending(bufnr)
- local incremental_change = sync.compute_diff(
- state.lines,
- curr_lines,
- firstline,
- lastline,
- new_lastline,
- encoding,
- line_ending
- )
-
- -- Double-buffering of lines tables is used to reduce the load on the garbage collector.
- -- At this point the prev_lines table is useless, but its internal storage has already been allocated,
- -- so let's keep it around for the next didChange event, in which it will become the next
- -- curr_lines table. Note that setting elements to nil doesn't actually deallocate slots in the
- -- internal storage - it merely marks them as free, for the GC to deallocate them.
- for i in ipairs(prev_lines) do
- prev_lines[i] = nil
- end
- state.lines = curr_lines
- state.lines_tmp = prev_lines
-
- return incremental_change
- end
-
- ---@private
- function changetracking.init(client, bufnr)
- assert(client.offset_encoding, 'lsp client must have an offset_encoding')
- local group = get_group(client)
- local state = state_by_group[group]
- if state then
- state.debounce = math.min(state.debounce, client.config.flags.debounce_text_changes or 150)
- state.clients[client.id] = client
- else
- state = {
- buffers = {},
- debounce = client.config.flags.debounce_text_changes or 150,
- clients = {
- [client.id] = client,
- },
- }
- state_by_group[group] = state
- end
- local buf_state = state.buffers[bufnr]
- if buf_state then
- buf_state.refs = buf_state.refs + 1
- else
- buf_state = {
- name = api.nvim_buf_get_name(bufnr),
- lines = {},
- lines_tmp = {},
- pending_changes = {},
- needs_flush = false,
- refs = 1,
- }
- state.buffers[bufnr] = buf_state
- if group.sync_kind == protocol.TextDocumentSyncKind.Incremental then
- buf_state.lines = nvim_buf_get_lines(bufnr, 0, -1, true)
- end
- end
- end
-
- ---@private
- function changetracking._get_and_set_name(client, bufnr, name)
- local state = state_by_group[get_group(client)] or {}
- local buf_state = (state.buffers or {})[bufnr]
- local old_name = buf_state.name
- buf_state.name = name
- return old_name
- end
-
- ---@private
- function changetracking.reset_buf(client, bufnr)
- changetracking.flush(client, bufnr)
- local state = state_by_group[get_group(client)]
- if not state then
- return
- end
- assert(state.buffers, 'CTGroupState must have buffers')
- local buf_state = state.buffers[bufnr]
- buf_state.refs = buf_state.refs - 1
- assert(buf_state.refs >= 0, 'refcount on buffer state must not get negative')
- if buf_state.refs == 0 then
- state.buffers[bufnr] = nil
- changetracking._reset_timer(buf_state)
- end
- end
-
- ---@private
- function changetracking.reset(client)
- local state = state_by_group[get_group(client)]
- if not state then
- return
- end
- state.clients[client.id] = nil
- if vim.tbl_count(state.clients) == 0 then
- for _, buf_state in pairs(state.buffers) do
- changetracking._reset_timer(buf_state)
- end
- state.buffers = {}
- end
- end
-
- -- Adjust debounce time by taking time of last didChange notification into
- -- consideration. If the last didChange happened more than `debounce` time ago,
- -- debounce can be skipped and otherwise maybe reduced.
- --
- -- This turns the debounce into a kind of client rate limiting
- --
- ---@param debounce integer
- ---@param buf_state CTBufferState
- ---@return number
- local function next_debounce(debounce, buf_state)
- if debounce == 0 then
- return 0
- end
- local ns_to_ms = 0.000001
- if not buf_state.last_flush then
- return debounce
- end
- local now = uv.hrtime()
- local ms_since_last_flush = (now - buf_state.last_flush) * ns_to_ms
- return math.max(debounce - ms_since_last_flush, 0)
- end
-
- ---@param bufnr integer
- ---@param sync_kind integer protocol.TextDocumentSyncKind
- ---@param state CTGroupState
- ---@param buf_state CTBufferState
- local function send_changes(bufnr, sync_kind, state, buf_state)
- if not buf_state.needs_flush then
- return
- end
- buf_state.last_flush = uv.hrtime()
- buf_state.needs_flush = false
-
- if not api.nvim_buf_is_valid(bufnr) then
- buf_state.pending_changes = {}
- return
- end
-
- local changes
- if sync_kind == protocol.TextDocumentSyncKind.None then
- return
- elseif sync_kind == protocol.TextDocumentSyncKind.Incremental then
- changes = buf_state.pending_changes
- buf_state.pending_changes = {}
- else
- changes = {
- { text = buf_get_full_text(bufnr) },
- }
- end
- local uri = vim.uri_from_bufnr(bufnr)
- for _, client in pairs(state.clients) do
- if not client.is_stopped() and lsp.buf_is_attached(bufnr, client.id) then
- client.notify(ms.textDocument_didChange, {
- textDocument = {
- uri = uri,
- version = util.buf_versions[bufnr],
- },
- contentChanges = changes,
- })
- end
- end
- end
-
- ---@private
- function changetracking.send_changes(bufnr, firstline, lastline, new_lastline)
- local groups = {} ---@type table<string,CTGroup>
- for _, client in pairs(lsp.get_clients({ bufnr = bufnr })) do
- local group = get_group(client)
- groups[group_key(group)] = group
- end
- for _, group in pairs(groups) do
- local state = state_by_group[group]
- if not state then
- error(
- string.format(
- 'changetracking.init must have been called for all LSP clients. group=%s states=%s',
- vim.inspect(group),
- vim.inspect(vim.tbl_keys(state_by_group))
- )
- )
- end
- local buf_state = state.buffers[bufnr]
- buf_state.needs_flush = true
- changetracking._reset_timer(buf_state)
- local debounce = next_debounce(state.debounce, buf_state)
- if group.sync_kind == protocol.TextDocumentSyncKind.Incremental then
- -- This must be done immediately and cannot be delayed
- -- The contents would further change and startline/endline may no longer fit
- local changes = incremental_changes(
- buf_state,
- group.offset_encoding,
- bufnr,
- firstline,
- lastline,
- new_lastline
- )
- table.insert(buf_state.pending_changes, changes)
- end
- if debounce == 0 then
- send_changes(bufnr, group.sync_kind, state, buf_state)
- else
- local timer = assert(uv.new_timer(), 'Must be able to create timer')
- buf_state.timer = timer
- timer:start(
- debounce,
- 0,
- vim.schedule_wrap(function()
- changetracking._reset_timer(buf_state)
- send_changes(bufnr, group.sync_kind, state, buf_state)
- end)
- )
- end
- end
- end
-
- ---@private
- function changetracking._reset_timer(buf_state)
- local timer = buf_state.timer
- if timer then
- buf_state.timer = nil
- if not timer:is_closing() then
- timer:stop()
- timer:close()
- end
- end
- end
-
- --- Flushes any outstanding change notification.
- ---@private
- function changetracking.flush(client, bufnr)
- local group = get_group(client)
- local state = state_by_group[group]
- if not state then
- return
- end
- if bufnr then
- local buf_state = state.buffers[bufnr] or {}
- changetracking._reset_timer(buf_state)
- send_changes(bufnr, group.sync_kind, state, buf_state)
- else
- for buf, buf_state in pairs(state.buffers) do
- changetracking._reset_timer(buf_state)
- send_changes(buf, group.sync_kind, state, buf_state)
- end
- end
- end
-end
-
---- Default handler for the 'textDocument/didOpen' LSP notification.
----
----@param bufnr integer Number of the buffer, or 0 for current
----@param client table Client object
-local function text_document_did_open_handler(bufnr, client)
- changetracking.init(client, bufnr)
- if not vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'openClose') then
- return
- end
- if not api.nvim_buf_is_loaded(bufnr) then
- return
- end
- local filetype = vim.bo[bufnr].filetype
-
- local params = {
- textDocument = {
- version = 0,
- uri = vim.uri_from_bufnr(bufnr),
- languageId = client.config.get_language_id(bufnr, filetype),
- text = buf_get_full_text(bufnr),
- },
- }
- client.notify(ms.textDocument_didOpen, params)
- util.buf_versions[bufnr] = params.textDocument.version
-
- -- Next chance we get, we should re-do the diagnostics
- vim.schedule(function()
- -- Protect against a race where the buffer disappears
- -- between `did_open_handler` and the scheduled function firing.
- if api.nvim_buf_is_valid(bufnr) then
- local namespace = vim.lsp.diagnostic.get_namespace(client.id)
- vim.diagnostic.show(namespace, bufnr)
- end
- end)
-end
-
--- FIXME: DOC: Shouldn't need to use a dummy function
---
---- LSP client object. You can get an active client object via
---- |vim.lsp.get_client_by_id()| or |vim.lsp.get_clients()|.
----
---- - Methods:
----
---- - request(method, params, [handler], bufnr)
---- Sends a request to the server.
---- This is a thin wrapper around {client.rpc.request} with some additional
---- checking.
---- If {handler} is not specified, If one is not found there, then an error will occur.
---- Returns: {status}, {[client_id]}. {status} is a boolean indicating if
---- the notification was successful. If it is `false`, then it will always
---- be `false` (the client has shutdown).
---- If {status} is `true`, the function returns {request_id} as the second
---- result. You can use this with `client.cancel_request(request_id)`
---- to cancel the request.
----
---- - request_sync(method, params, timeout_ms, bufnr)
---- Sends a request to the server and synchronously waits for the response.
---- This is a wrapper around {client.request}
---- Returns: { err=err, result=result }, a dictionary, where `err` and `result` come from
---- the |lsp-handler|. On timeout, cancel or error, returns `(nil, err)` where `err` is a
---- string describing the failure reason. If the request was unsuccessful returns `nil`.
----
---- - notify(method, params)
---- Sends a notification to an LSP server.
---- Returns: a boolean to indicate if the notification was successful. If
---- it is false, then it will always be false (the client has shutdown).
----
---- - cancel_request(id)
---- Cancels a request with a given request id.
---- Returns: same as `notify()`.
----
---- - stop([force])
---- Stops a client, optionally with force.
---- By default, it will just ask the server to shutdown without force.
---- If you request to stop a client which has previously been requested to
---- shutdown, it will automatically escalate and force shutdown.
----
---- - is_stopped()
---- Checks whether a client is stopped.
---- Returns: true if the client is fully stopped.
----
---- - on_attach(client, bufnr)
---- Runs the on_attach function from the client's config if it was defined.
---- Useful for buffer-local setup.
+--- @class vim.lsp.start.Opts
+--- @inlinedoc
---
---- - Members
---- - {id} (number): The id allocated to the client.
+--- Predicate used to decide if a client should be re-used. Used on all
+--- running clients. The default implementation re-uses a client if name and
+--- root_dir matches.
+--- @field reuse_client fun(client: vim.lsp.Client, config: table): boolean
---
---- - {name} (string): If a name is specified on creation, that will be
---- used. Otherwise it is just the client id. This is used for
---- logs and messages.
----
---- - {rpc} (table): RPC client object, for low level interaction with the
---- client. See |vim.lsp.rpc.start()|.
----
---- - {offset_encoding} (string): The encoding used for communicating
---- with the server. You can modify this in the `config`'s `on_init` method
---- before text is sent to the server.
----
---- - {handlers} (table): The handlers used by the client as described in |lsp-handler|.
----
---- - {requests} (table): The current pending requests in flight
---- to the server. Entries are key-value pairs with the key
---- being the request ID while the value is a table with `type`,
---- `bufnr`, and `method` key-value pairs. `type` is either "pending"
---- for an active request, or "cancel" for a cancel request. It will
---- be "complete" ephemerally while executing |LspRequest| autocmds
---- when replies are received from the server.
----
---- - {config} (table): copy of the table that was passed by the user
---- to |vim.lsp.start_client()|.
----
---- - {server_capabilities} (table): Response from the server sent on
---- `initialize` describing the server's capabilities.
----
---- - {progress} A ring buffer (|vim.ringbuf()|) containing progress messages
---- sent by the server.
-function lsp.client()
- error()
-end
-
---- @class lsp.StartOpts
---- @field reuse_client fun(client: lsp.Client, config: table): boolean
+--- Buffer handle to attach to if starting or re-using a client (0 for current).
--- @field bufnr integer
--- Create a new LSP client and start a language server or reuses an already
@@ -824,8 +227,7 @@ end
--- See |vim.lsp.start_client()| for all available options. The most important are:
---
--- - `name` arbitrary name for the LSP client. Should be unique per language server.
---- - `cmd` command (in list form) used to start the language server. Must be absolute, or found on
---- `$PATH`. Shell constructs like `~` are not expanded.
+--- - `cmd` command string[] or function, described at |vim.lsp.start_client()|.
--- - `root_dir` path to the project root. By default this is used to decide if an existing client
--- should be re-used. The example above uses |vim.fs.find()| and |vim.fs.dirname()| to detect the
--- root by traversing the file system upwards starting from the current directory until either
@@ -844,30 +246,18 @@ end
--- Either use |:au|, |nvim_create_autocmd()| or put the call in a
--- `ftplugin/<filetype_name>.lua` (See |ftplugin-name|)
---
----@param config table Same configuration as documented in |vim.lsp.start_client()|
----@param opts (nil|lsp.StartOpts) Optional keyword arguments:
---- - reuse_client (fun(client: client, config: table): boolean)
---- Predicate used to decide if a client should be re-used.
---- Used on all running clients.
---- The default implementation re-uses a client if name
---- and root_dir matches.
---- - bufnr (number)
---- Buffer handle to attach to if starting or re-using a
---- client (0 for current).
----@return integer|nil client_id
+--- @param config vim.lsp.ClientConfig Configuration for the server.
+--- @param opts vim.lsp.start.Opts? Optional keyword arguments
+--- @return integer? client_id
function lsp.start(config, opts)
opts = opts or {}
local reuse_client = opts.reuse_client
or function(client, conf)
- return client.config.root_dir == conf.root_dir and client.name == conf.name
+ return client.root_dir == conf.root_dir and client.name == conf.name
end
- if not config.name and type(config.cmd) == 'table' then
- config.name = config.cmd[1] and vim.fs.basename(config.cmd[1]) or nil
- end
- local bufnr = opts.bufnr
- if bufnr == nil or bufnr == 0 then
- bufnr = api.nvim_get_current_buf()
- end
+
+ local bufnr = resolve_bufnr(opts.bufnr)
+
for _, clients in ipairs({ uninitialized_clients, lsp.get_clients() }) do
for _, client in pairs(clients) do
if reuse_client(client, config) then
@@ -876,10 +266,13 @@ function lsp.start(config, opts)
end
end
end
+
local client_id = lsp.start_client(config)
- if client_id == nil then
- return nil -- lsp.start_client will have printed an error
+
+ if not client_id then
+ return -- lsp.start_client will have printed an error
end
+
lsp.buf_attach_client(bufnr, client_id)
return client_id
end
@@ -890,9 +283,11 @@ end
---@return string
function lsp.status()
local percentage = nil
- local messages = {}
+ local messages = {} --- @type string[]
for _, client in ipairs(vim.lsp.get_clients()) do
+ --- @diagnostic disable-next-line:no-unknown
for progress in client.progress do
+ --- @cast progress {token: lsp.ProgressToken, value: lsp.LSPAny}
local value = progress.value
if type(value) == 'table' and value.kind then
local message = value.message and (value.title .. ': ' .. value.message) or value.title
@@ -913,12 +308,15 @@ function lsp.status()
end
-- Determines whether the given option can be set by `set_defaults`.
+---@param bufnr integer
+---@param option string
+---@return boolean
local function is_empty_or_default(bufnr, option)
if vim.bo[bufnr][option] == '' then
return true
end
- local info = vim.api.nvim_get_option_info2(option, { buf = bufnr })
+ local info = api.nvim_get_option_info2(option, { buf = bufnr })
local scriptinfo = vim.tbl_filter(function(e)
return e.sid == info.last_set_sid
end, vim.fn.getscriptinfo())
@@ -931,7 +329,8 @@ local function is_empty_or_default(bufnr, option)
end
---@private
----@param client lsp.Client
+---@param client vim.lsp.Client
+---@param bufnr integer
function lsp._set_defaults(client, bufnr)
if
client.supports_method(ms.textDocument_definition) and is_empty_or_default(bufnr, 'tagfunc')
@@ -964,818 +363,151 @@ function lsp._set_defaults(client, bufnr)
end
end
---- @class lsp.ClientConfig
---- @field cmd (string[]|fun(dispatchers: table):table)
---- @field cmd_cwd string
---- @field cmd_env (table)
---- @field detached boolean
---- @field workspace_folders (table)
---- @field capabilities lsp.ClientCapabilities
---- @field handlers table<string,function>
---- @field settings table
---- @field commands table
---- @field init_options table
---- @field name string
---- @field get_language_id fun(bufnr: integer, filetype: string): string
---- @field offset_encoding string
---- @field on_error fun(code: integer)
---- @field before_init function
---- @field on_init function
---- @field on_exit fun(code: integer, signal: integer, client_id: integer)
---- @field on_attach fun(client: lsp.Client, bufnr: integer)
---- @field trace 'off'|'messages'|'verbose'|nil
---- @field flags table
---- @field root_dir string
-
--- FIXME: DOC: Currently all methods on the `vim.lsp.client` object are
--- documented twice: Here, and on the methods themselves (e.g.
--- `client.request()`). This is a workaround for the vimdoc generator script
--- not handling method names correctly. If you change the documentation on
--- either, please make sure to update the other as well.
---
---- Starts and initializes a client with the given configuration.
----
---- Field `cmd` in {config} is required.
----
----@param config (lsp.ClientConfig) Configuration for the server:
---- - cmd: (string[]|fun(dispatchers: table):table) command a list of
---- strings treated like |jobstart()|. The command must launch the language server
---- process. `cmd` can also be a function that creates an RPC client.
---- The function receives a dispatchers table and must return a table with the
---- functions `request`, `notify`, `is_closing` and `terminate`
---- See |vim.lsp.rpc.request()| and |vim.lsp.rpc.notify()|
---- For TCP there is a built-in rpc client factory: |vim.lsp.rpc.connect()|
----
---- - cmd_cwd: (string, default=|getcwd()|) Directory to launch
---- the `cmd` process. Not related to `root_dir`.
----
---- - cmd_env: (table) Environment flags to pass to the LSP on
---- spawn. Must be specified using a table.
---- Non-string values are coerced to string.
---- Example:
---- <pre>
---- { PORT = 8080; HOST = "0.0.0.0"; }
---- </pre>
----
---- - detached: (boolean, default true) Daemonize the server process so that it runs in a
---- separate process group from Nvim. Nvim will shutdown the process on exit, but if Nvim fails to
---- exit cleanly this could leave behind orphaned server processes.
----
---- - workspace_folders: (table) List of workspace folders passed to the
---- language server. For backwards compatibility rootUri and rootPath will be
---- derived from the first workspace folder in this list. See `workspaceFolders` in
---- the LSP spec.
----
---- - capabilities: Map overriding the default capabilities defined by
---- \|vim.lsp.protocol.make_client_capabilities()|, passed to the language
---- server on initialization. Hint: use make_client_capabilities() and modify
---- its result.
---- - Note: To send an empty dictionary use |vim.empty_dict()|, else it will be encoded as an
---- array.
----
---- - handlers: Map of language server method names to |lsp-handler|
----
---- - settings: Map with language server specific settings. These are
---- returned to the language server if requested via `workspace/configuration`.
---- Keys are case-sensitive.
----
---- - commands: table Table that maps string of clientside commands to user-defined functions.
---- Commands passed to start_client take precedence over the global command registry. Each key
---- must be a unique command name, and the value is a function which is called if any LSP action
---- (code action, code lenses, ...) triggers the command.
----
---- - init_options Values to pass in the initialization request
---- as `initializationOptions`. See `initialize` in the LSP spec.
----
---- - name: (string, default=client-id) Name in log messages.
----
---- - get_language_id: function(bufnr, filetype) -> language ID as string.
---- Defaults to the filetype.
----
---- - offset_encoding: (default="utf-16") One of "utf-8", "utf-16",
---- or "utf-32" which is the encoding that the LSP server expects. Client does
---- not verify this is correct.
----
---- - on_error: Callback with parameters (code, ...), invoked
---- when the client operation throws an error. `code` is a number describing
---- the error. Other arguments may be passed depending on the error kind. See
---- `vim.lsp.rpc.client_errors` for possible errors.
---- Use `vim.lsp.rpc.client_errors[code]` to get human-friendly name.
----
---- - before_init: Callback with parameters (initialize_params, config)
---- invoked before the LSP "initialize" phase, where `params` contains the
---- parameters being sent to the server and `config` is the config that was
---- passed to |vim.lsp.start_client()|. You can use this to modify parameters before
---- they are sent.
----
---- - on_init: Callback (client, initialize_result) invoked after LSP
---- "initialize", where `result` is a table of `capabilities` and anything else
---- the server may send. For example, clangd sends
---- `initialize_result.offsetEncoding` if `capabilities.offsetEncoding` was
---- sent to it. You can only modify the `client.offset_encoding` here before
---- any notifications are sent. Most language servers expect to be sent client specified settings after
---- initialization. Nvim does not make this assumption. A
---- `workspace/didChangeConfiguration` notification should be sent
---- to the server during on_init.
----
---- - on_exit Callback (code, signal, client_id) invoked on client
---- exit.
---- - code: exit code of the process
---- - signal: number describing the signal used to terminate (if any)
---- - client_id: client handle
----
---- - on_attach: Callback (client, bufnr) invoked when client
---- attaches to a buffer.
----
---- - trace: ("off" | "messages" | "verbose" | nil) passed directly to the language
---- server in the initialize request. Invalid/empty values will default to "off"
----
---- - flags: A table with flags for the client. The current (experimental) flags are:
---- - allow_incremental_sync (bool, default true): Allow using incremental sync for buffer edits
---- - debounce_text_changes (number, default 150): Debounce didChange
---- notifications to the server by the given number in milliseconds. No debounce
---- occurs if nil
---- - exit_timeout (number|boolean, default false): Milliseconds to wait for server to
---- exit cleanly after sending the "shutdown" request before sending kill -15.
---- If set to false, nvim exits immediately after sending the "shutdown" request to the server.
----
---- - root_dir: (string) Directory where the LSP
---- server will base its workspaceFolders, rootUri, and rootPath
---- on initialization.
----
----@return integer|nil client_id. |vim.lsp.get_client_by_id()| Note: client may not be
---- fully initialized. Use `on_init` to do any actions once
---- the client has been initialized.
-function lsp.start_client(config)
- local cmd, cmd_args, offset_encoding = validate_client_config(config)
-
- config.flags = config.flags or {}
- config.settings = config.settings or {}
-
- -- By default, get_language_id just returns the exact filetype it is passed.
- -- It is possible to pass in something that will calculate a different filetype,
- -- to be sent by the client.
- config.get_language_id = config.get_language_id or function(_, filetype)
- return filetype
- end
-
- local client_id = next_client_id()
-
- local handlers = config.handlers or {}
- local name = config.name or tostring(client_id)
- local log_prefix = string.format('LSP[%s]', name)
-
- local dispatch = {}
-
- --- Returns the handler associated with an LSP method.
- --- Returns the default handler if the user hasn't set a custom one.
- ---
- ---@param method (string) LSP method name
- ---@return lsp-handler|nil The handler for the given method, if defined, or the default from |vim.lsp.handlers|
- local function resolve_handler(method)
- return handlers[method] or default_handlers[method]
- end
-
- ---@private
- --- Handles a notification sent by an LSP server by invoking the
- --- corresponding handler.
- ---
- ---@param method (string) LSP method name
- ---@param params (table) The parameters for that method.
- function dispatch.notification(method, params)
- if log.trace() then
- log.trace('notification', method, params)
- end
- local handler = resolve_handler(method)
- if handler then
- -- Method name is provided here for convenience.
- handler(nil, params, { method = method, client_id = client_id })
- end
- end
-
- ---@private
- --- Handles a request from an LSP server by invoking the corresponding handler.
- ---
- ---@param method (string) LSP method name
- ---@param params (table) The parameters for that method
- function dispatch.server_request(method, params)
- if log.trace() then
- log.trace('server_request', method, params)
- end
- local handler = resolve_handler(method)
- if handler then
- if log.trace() then
- log.trace('server_request: found handler for', method)
- end
- return handler(nil, params, { method = method, client_id = client_id })
- end
- if log.warn() then
- log.warn('server_request: no handler found for', method)
- end
- return nil, lsp.rpc_response_error(protocol.ErrorCodes.MethodNotFound)
+--- Reset defaults set by `set_defaults`.
+--- Must only be called if the last client attached to a buffer exits.
+local function reset_defaults(bufnr)
+ if vim.bo[bufnr].tagfunc == 'v:lua.vim.lsp.tagfunc' then
+ vim.bo[bufnr].tagfunc = nil
end
-
- --- Logs the given error to the LSP log and to the error buffer.
- --- @param code integer Error code
- --- @param err any Error arguments
- local function write_error(code, err)
- if log.error() then
- log.error(log_prefix, 'on_error', { code = lsp.client_errors[code], err = err })
- end
- err_message(log_prefix, ': Error ', lsp.client_errors[code], ': ', vim.inspect(err))
- end
-
- ---@private
- --- Invoked when the client operation throws an error.
- ---
- ---@param code (integer) Error code
- ---@param err (...) Other arguments may be passed depending on the error kind
- ---@see vim.lsp.rpc.client_errors for possible errors. Use
- ---`vim.lsp.rpc.client_errors[code]` to get a human-friendly name.
- function dispatch.on_error(code, err)
- write_error(code, err)
- if config.on_error then
- local status, usererr = pcall(config.on_error, code, err)
- if not status then
- local _ = log.error() and log.error(log_prefix, 'user on_error failed', { err = usererr })
- err_message(log_prefix, ' user on_error failed: ', tostring(usererr))
- end
- end
+ if vim.bo[bufnr].omnifunc == 'v:lua.vim.lsp.omnifunc' then
+ vim.bo[bufnr].omnifunc = nil
end
-
- --- Reset defaults set by `set_defaults`.
- --- Must only be called if the last client attached to a buffer exits.
- local function reset_defaults(bufnr)
- if vim.bo[bufnr].tagfunc == 'v:lua.vim.lsp.tagfunc' then
- vim.bo[bufnr].tagfunc = nil
- end
- if vim.bo[bufnr].omnifunc == 'v:lua.vim.lsp.omnifunc' then
- vim.bo[bufnr].omnifunc = nil
- end
- if vim.bo[bufnr].formatexpr == 'v:lua.vim.lsp.formatexpr()' then
- vim.bo[bufnr].formatexpr = nil
- end
- api.nvim_buf_call(bufnr, function()
- local keymap = vim.fn.maparg('K', 'n', false, true)
- if keymap and keymap.callback == vim.lsp.buf.hover then
- vim.keymap.del('n', 'K', { buffer = bufnr })
- end
- end)
+ if vim.bo[bufnr].formatexpr == 'v:lua.vim.lsp.formatexpr()' then
+ vim.bo[bufnr].formatexpr = nil
end
-
- ---@private
- --- Invoked on client exit.
- ---
- ---@param code (integer) exit code of the process
- ---@param signal (integer) the signal used to terminate (if any)
- function dispatch.on_exit(code, signal)
- if config.on_exit then
- pcall(config.on_exit, code, signal, client_id)
+ api.nvim_buf_call(bufnr, function()
+ local keymap = vim.fn.maparg('K', 'n', false, true)
+ if keymap and keymap.callback == vim.lsp.buf.hover then
+ vim.keymap.del('n', 'K', { buffer = bufnr })
end
+ end)
+end
- local client = active_clients[client_id] and active_clients[client_id]
- or uninitialized_clients[client_id]
-
- for bufnr, client_ids in pairs(all_buffer_active_clients) do
- if client_ids[client_id] then
- vim.schedule(function()
- if client and client.attached_buffers[bufnr] then
- nvim_exec_autocmds('LspDetach', {
- buffer = bufnr,
- modeline = false,
- data = { client_id = client_id },
- })
- end
-
- local namespace = vim.lsp.diagnostic.get_namespace(client_id)
- vim.diagnostic.reset(namespace, bufnr)
-
- client_ids[client_id] = nil
- if vim.tbl_isempty(client_ids) then
- reset_defaults(bufnr)
- end
- end)
- end
+--- @param client vim.lsp.Client
+local function on_client_init(client)
+ local id = client.id
+ uninitialized_clients[id] = nil
+ -- Only assign after initialized.
+ active_clients[id] = client
+ -- If we had been registered before we start, then send didOpen This can
+ -- happen if we attach to buffers before initialize finishes or if
+ -- someone restarts a client.
+ for bufnr, client_ids in pairs(all_buffer_active_clients) do
+ if client_ids[id] then
+ client.on_attach(bufnr)
end
-
- -- Schedule the deletion of the client object so that it exists in the execution of LspDetach
- -- autocommands
- vim.schedule(function()
- active_clients[client_id] = nil
- uninitialized_clients[client_id] = nil
-
- -- Client can be absent if executable starts, but initialize fails
- -- init/attach won't have happened
- if client then
- changetracking.reset(client)
- end
- if code ~= 0 or (signal ~= 0 and signal ~= 15) then
- local msg = string.format(
- 'Client %s quit with exit code %s and signal %s. Check log for errors: %s',
- name,
- code,
- signal,
- lsp.get_log_path()
- )
- vim.notify(msg, vim.log.levels.WARN)
- end
- end)
- end
-
- -- Start the RPC client.
- local rpc
- if type(cmd) == 'function' then
- rpc = cmd(dispatch)
- else
- rpc = lsp_rpc.start(cmd, cmd_args, dispatch, {
- cwd = config.cmd_cwd,
- env = config.cmd_env,
- detached = config.detached,
- })
end
+end
- -- Return nil if client fails to start
- if not rpc then
- return
- end
-
- ---@class lsp.Client
- local client = {
- id = client_id,
- name = name,
- rpc = rpc,
- offset_encoding = offset_encoding,
- config = config,
- attached_buffers = {},
-
- handlers = handlers,
- commands = config.commands or {},
-
- --- @type table<integer,{ type: string, bufnr: integer, method: string}>
- requests = {},
-
- --- Contains $/progress report messages.
- --- They have the format {token: integer|string, value: any}
- --- For "work done progress", value will be one of:
- --- - lsp.WorkDoneProgressBegin,
- --- - lsp.WorkDoneProgressReport (extended with title from Begin)
- --- - lsp.WorkDoneProgressEnd (extended with title from Begin)
- progress = vim.ringbuf(50),
-
- --- @type lsp.ServerCapabilities
- server_capabilities = {},
-
- ---@deprecated use client.progress instead
- messages = { name = name, messages = {}, progress = {}, status = {} },
- dynamic_capabilities = require('vim.lsp._dynamic').new(client_id),
- }
-
- ---@type table<string|integer, string> title of unfinished progress sequences by token
- client.progress.pending = {}
-
- --- @type lsp.ClientCapabilities
- client.config.capabilities = config.capabilities or protocol.make_client_capabilities()
-
- -- Store the uninitialized_clients for cleanup in case we exit before initialize finishes.
- uninitialized_clients[client_id] = client
-
- local function initialize()
- local valid_traces = {
- off = 'off',
- messages = 'messages',
- verbose = 'verbose',
- }
-
- local workspace_folders --- @type table[]?
- local root_uri --- @type string?
- local root_path --- @type string?
- if config.workspace_folders or config.root_dir then
- if config.root_dir and not config.workspace_folders then
- workspace_folders = {
- {
- uri = vim.uri_from_fname(config.root_dir),
- name = string.format('%s', config.root_dir),
- },
- }
- else
- workspace_folders = config.workspace_folders
- end
- root_uri = workspace_folders[1].uri
- root_path = vim.uri_to_fname(root_uri)
- else
- workspace_folders = nil
- root_uri = nil
- root_path = nil
- end
+--- @param code integer
+--- @param signal integer
+--- @param client_id integer
+local function on_client_exit(code, signal, client_id)
+ local client = active_clients[client_id] or uninitialized_clients[client_id]
- local initialize_params = {
- -- The process Id of the parent process that started the server. Is null if
- -- the process has not been started by another process. If the parent
- -- process is not alive then the server should exit (see exit notification)
- -- its process.
- processId = uv.os_getpid(),
- -- Information about the client
- -- since 3.15.0
- clientInfo = {
- name = 'Neovim',
- version = tostring(vim.version()),
- },
- -- The rootPath of the workspace. Is null if no folder is open.
- --
- -- @deprecated in favour of rootUri.
- rootPath = root_path or vim.NIL,
- -- The rootUri of the workspace. Is null if no folder is open. If both
- -- `rootPath` and `rootUri` are set `rootUri` wins.
- rootUri = root_uri or vim.NIL,
- -- The workspace folders configured in the client when the server starts.
- -- This property is only available if the client supports workspace folders.
- -- It can be `null` if the client supports workspace folders but none are
- -- configured.
- workspaceFolders = workspace_folders or vim.NIL,
- -- User provided initialization options.
- initializationOptions = config.init_options,
- -- The capabilities provided by the client (editor or tool)
- capabilities = config.capabilities,
- -- The initial trace setting. If omitted trace is disabled ("off").
- -- trace = "off" | "messages" | "verbose";
- trace = valid_traces[config.trace] or 'off',
- }
- if config.before_init then
- local status, err = pcall(config.before_init, initialize_params, config)
- if not status then
- write_error(lsp.client_errors.BEFORE_INIT_CALLBACK_ERROR, err)
- end
- end
-
- --- @param method string
- --- @param opts? {bufnr?: number}
- client.supports_method = function(method, opts)
- opts = opts or {}
- local required_capability = lsp._request_name_to_capability[method]
- -- if we don't know about the method, assume that the client supports it.
- if not required_capability then
- return true
- end
- if vim.tbl_get(client.server_capabilities, unpack(required_capability)) then
- return true
- else
- if client.dynamic_capabilities:supports_registration(method) then
- return client.dynamic_capabilities:supports(method, opts)
+ for bufnr, client_ids in pairs(all_buffer_active_clients) do
+ if client_ids[client_id] then
+ vim.schedule(function()
+ if client and client.attached_buffers[bufnr] then
+ api.nvim_exec_autocmds('LspDetach', {
+ buffer = bufnr,
+ modeline = false,
+ data = { client_id = client_id },
+ })
end
- return false
- end
- end
- local _ = log.trace() and log.trace(log_prefix, 'initialize_params', initialize_params)
- rpc.request('initialize', initialize_params, function(init_err, result)
- assert(not init_err, tostring(init_err))
- assert(result, 'server sent empty result')
- rpc.notify('initialized', vim.empty_dict())
- client.initialized = true
- uninitialized_clients[client_id] = nil
- client.workspace_folders = workspace_folders
-
- -- These are the cleaned up capabilities we use for dynamically deciding
- -- when to send certain events to clients.
- client.server_capabilities =
- assert(result.capabilities, "initialize result doesn't contain capabilities")
- client.server_capabilities = protocol.resolve_capabilities(client.server_capabilities)
-
- if client.server_capabilities.positionEncoding then
- client.offset_encoding = client.server_capabilities.positionEncoding
- end
-
- if next(config.settings) then
- client.notify(ms.workspace_didChangeConfiguration, { settings = config.settings })
- end
-
- if config.on_init then
- local status, err = pcall(config.on_init, client, result)
- if not status then
- write_error(lsp.client_errors.ON_INIT_CALLBACK_ERROR, err)
- end
- end
- local _ = log.info()
- and log.info(
- log_prefix,
- 'server_capabilities',
- { server_capabilities = client.server_capabilities }
- )
+ local namespace = vim.lsp.diagnostic.get_namespace(client_id)
+ vim.diagnostic.reset(namespace, bufnr)
- -- Only assign after initialized.
- active_clients[client_id] = client
- -- If we had been registered before we start, then send didOpen This can
- -- happen if we attach to buffers before initialize finishes or if
- -- someone restarts a client.
- for bufnr, client_ids in pairs(all_buffer_active_clients) do
- if client_ids[client_id] then
- client._on_attach(bufnr)
+ client_ids[client_id] = nil
+ if vim.tbl_isempty(client_ids) then
+ reset_defaults(bufnr)
end
- end
- end)
- end
-
- ---@nodoc
- --- Sends a request to the server.
- ---
- --- This is a thin wrapper around {client.rpc.request} with some additional
- --- checks for capabilities and handler availability.
- ---
- ---@param method string LSP method name.
- ---@param params table|nil LSP request params.
- ---@param handler lsp-handler|nil Response |lsp-handler| for this method.
- ---@param bufnr integer Buffer handle (0 for current).
- ---@return boolean status, integer|nil request_id {status} is a bool indicating
- ---whether the request was successful. If it is `false`, then it will
- ---always be `false` (the client has shutdown). If it was
- ---successful, then it will return {request_id} as the
- ---second result. You can use this with `client.cancel_request(request_id)`
- ---to cancel the-request.
- ---@see |vim.lsp.buf_request_all()|
- function client.request(method, params, handler, bufnr)
- if not handler then
- handler = assert(
- resolve_handler(method),
- string.format('not found: %q request handler for client %q.', method, client.name)
- )
- end
- -- Ensure pending didChange notifications are sent so that the server doesn't operate on a stale state
- changetracking.flush(client, bufnr)
- local version = util.buf_versions[bufnr]
- bufnr = resolve_bufnr(bufnr)
- if log.debug() then
- log.debug(log_prefix, 'client.request', client_id, method, params, handler, bufnr)
- end
- local success, request_id = rpc.request(method, params, function(err, result)
- local context = {
- method = method,
- client_id = client_id,
- bufnr = bufnr,
- params = params,
- version = version,
- }
- handler(err, result, context)
- end, function(request_id)
- local request = client.requests[request_id]
- request.type = 'complete'
- nvim_exec_autocmds('LspRequest', {
- buffer = api.nvim_buf_is_valid(bufnr) and bufnr or nil,
- modeline = false,
- data = { client_id = client_id, request_id = request_id, request = request },
- })
- client.requests[request_id] = nil
- end)
-
- if success and request_id then
- local request = { type = 'pending', bufnr = bufnr, method = method }
- client.requests[request_id] = request
- nvim_exec_autocmds('LspRequest', {
- buffer = bufnr,
- modeline = false,
- data = { client_id = client_id, request_id = request_id, request = request },
- })
- end
-
- return success, request_id
- end
-
- ---@private
- --- Sends a request to the server and synchronously waits for the response.
- ---
- --- This is a wrapper around {client.request}
- ---
- ---@param method (string) LSP method name.
- ---@param params (table) LSP request params.
- ---@param timeout_ms (integer|nil) Maximum time in milliseconds to wait for
- --- a result. Defaults to 1000
- ---@param bufnr (integer) Buffer handle (0 for current).
- ---@return {err: lsp.ResponseError|nil, result:any}|nil, string|nil err # a dictionary, where
- --- `err` and `result` come from the |lsp-handler|.
- --- On timeout, cancel or error, returns `(nil, err)` where `err` is a
- --- string describing the failure reason. If the request was unsuccessful
- --- returns `nil`.
- ---@see |vim.lsp.buf_request_sync()|
- function client.request_sync(method, params, timeout_ms, bufnr)
- local request_result = nil
- local function _sync_handler(err, result)
- request_result = { err = err, result = result }
- end
-
- local success, request_id = client.request(method, params, _sync_handler, bufnr)
- if not success then
- return nil
- end
-
- local wait_result, reason = vim.wait(timeout_ms or 1000, function()
- return request_result ~= nil
- end, 10)
-
- if not wait_result then
- if request_id then
- client.cancel_request(request_id)
- end
- return nil, wait_result_reason[reason]
- end
- return request_result
- end
-
- ---@nodoc
- --- Sends a notification to an LSP server.
- ---
- ---@param method string LSP method name.
- ---@param params table|nil LSP request params.
- ---@return boolean status true if the notification was successful.
- ---If it is false, then it will always be false
- ---(the client has shutdown).
- function client.notify(method, params)
- if method ~= ms.textDocument_didChange then
- changetracking.flush(client)
- end
-
- local client_active = rpc.notify(method, params)
-
- if client_active then
- vim.schedule(function()
- nvim_exec_autocmds('LspNotify', {
- modeline = false,
- data = {
- client_id = client.id,
- method = method,
- params = params,
- },
- })
end)
end
-
- return client_active
- end
-
- ---@nodoc
- --- Cancels a request with a given request id.
- ---
- ---@param id (integer) id of request to cancel
- ---@return boolean status true if notification was successful. false otherwise
- ---@see |vim.lsp.client.notify()|
- function client.cancel_request(id)
- validate({ id = { id, 'n' } })
- local request = client.requests[id]
- if request and request.type == 'pending' then
- request.type = 'cancel'
- nvim_exec_autocmds('LspRequest', {
- buffer = request.bufnr,
- modeline = false,
- data = { client_id = client_id, request_id = id, request = request },
- })
- end
- return rpc.notify(ms.dollar_cancelRequest, { id = id })
end
- -- Track this so that we can escalate automatically if we've already tried a
- -- graceful shutdown
- local graceful_shutdown_failed = false
-
- ---@nodoc
- --- Stops a client, optionally with force.
- ---
- ---By default, it will just ask the - server to shutdown without force. If
- --- you request to stop a client which has previously been requested to
- --- shutdown, it will automatically escalate and force shutdown.
- ---
- ---@param force boolean|nil
- function client.stop(force)
- if rpc.is_closing() then
- return
- end
- if force or not client.initialized or graceful_shutdown_failed then
- rpc.terminate()
- return
- end
- -- Sending a signal after a process has exited is acceptable.
- rpc.request(ms.shutdown, nil, function(err, _)
- if err == nil then
- rpc.notify(ms.exit)
- else
- -- If there was an error in the shutdown request, then term to be safe.
- rpc.terminate()
- graceful_shutdown_failed = true
- end
- end)
- end
+ local name = client.name or 'unknown'
- ---@private
- --- Checks whether a client is stopped.
- ---
- ---@return boolean # true if client is stopped or in the process of being
- ---stopped; false otherwise
- function client.is_stopped()
- return rpc.is_closing()
- end
-
- ---@private
- --- Execute a lsp command, either via client command function (if available)
- --- or via workspace/executeCommand (if supported by the server)
- ---
- ---@param command lsp.Command
- ---@param context? {bufnr: integer}
- ---@param handler? lsp-handler only called if a server command
- function client._exec_cmd(command, context, handler)
- context = vim.deepcopy(context or {})
- context.bufnr = context.bufnr or api.nvim_get_current_buf()
- context.client_id = client.id
- local cmdname = command.command
- local fn = client.commands[cmdname] or lsp.commands[cmdname]
- if fn then
- fn(command, context)
- return
- end
+ -- Schedule the deletion of the client object so that it exists in the execution of LspDetach
+ -- autocommands
+ vim.schedule(function()
+ active_clients[client_id] = nil
+ uninitialized_clients[client_id] = nil
- local command_provider = client.server_capabilities.executeCommandProvider
- local commands = type(command_provider) == 'table' and command_provider.commands or {}
- if not vim.list_contains(commands, cmdname) then
- vim.notify_once(
- string.format(
- 'Language server `%s` does not support command `%s`. This command may require a client extension.',
- client.name,
- cmdname
- ),
- vim.log.levels.WARN
+ -- Client can be absent if executable starts, but initialize fails
+ -- init/attach won't have happened
+ if client then
+ changetracking.reset(client)
+ end
+ if code ~= 0 or (signal ~= 0 and signal ~= 15) then
+ local msg = string.format(
+ 'Client %s quit with exit code %s and signal %s. Check log for errors: %s',
+ name,
+ code,
+ signal,
+ lsp.get_log_path()
)
- return
+ vim.notify(msg, vim.log.levels.WARN)
end
- -- Not using command directly to exclude extra properties,
- -- see https://github.com/python-lsp/python-lsp-server/issues/146
- local params = {
- command = command.command,
- arguments = command.arguments,
- }
- client.request(ms.workspace_executeCommand, params, handler, context.bufnr)
- end
-
- ---@private
- --- Runs the on_attach function from the client's config if it was defined.
- ---@param bufnr integer Buffer number
- function client._on_attach(bufnr)
- text_document_did_open_handler(bufnr, client)
-
- lsp._set_defaults(client, bufnr)
+ end)
+end
- nvim_exec_autocmds('LspAttach', {
- buffer = bufnr,
- modeline = false,
- data = { client_id = client.id },
- })
+--- Starts and initializes a client with the given configuration.
+--- @param config vim.lsp.ClientConfig Configuration for the server.
+--- @return integer|nil client_id |vim.lsp.get_client_by_id()| Note: client may not be
+--- fully initialized. Use `on_init` to do any actions once
+--- the client has been initialized.
+function lsp.start_client(config)
+ local client = require('vim.lsp.client').create(config)
- if config.on_attach then
- local status, err = pcall(config.on_attach, client, bufnr)
- if not status then
- write_error(lsp.client_errors.ON_ATTACH_ERROR, err)
- end
- end
+ if not client then
+ return
+ end
- -- schedule the initialization of semantic tokens to give the above
- -- on_attach and LspAttach callbacks the ability to schedule wrap the
- -- opt-out (deleting the semanticTokensProvider from capabilities)
- vim.schedule(function()
- if vim.tbl_get(client.server_capabilities, 'semanticTokensProvider', 'full') then
- semantic_tokens.start(bufnr, client.id)
- end
- end)
+ --- @diagnostic disable-next-line: invisible
+ table.insert(client._on_init_cbs, on_client_init)
+ --- @diagnostic disable-next-line: invisible
+ table.insert(client._on_exit_cbs, on_client_exit)
- client.attached_buffers[bufnr] = true
- end
+ -- Store the uninitialized_clients for cleanup in case we exit before initialize finishes.
+ uninitialized_clients[client.id] = client
- initialize()
+ client:initialize()
- return client_id
+ return client.id
end
----@private
----@fn text_document_did_change_handler(_, bufnr, changedtick, firstline, lastline, new_lastline, old_byte_size, old_utf32_size, old_utf16_size)
--- Notify all attached clients that a buffer has changed.
-local text_document_did_change_handler
-do
- text_document_did_change_handler = function(
- _,
- bufnr,
- changedtick,
- firstline,
- lastline,
- new_lastline
- )
- -- Detach (nvim_buf_attach) via returning True to on_lines if no clients are attached
- if tbl_isempty(all_buffer_active_clients[bufnr] or {}) then
- return true
- end
- util.buf_versions[bufnr] = changedtick
- changetracking.send_changes(bufnr, firstline, lastline, new_lastline)
+---@param _ integer
+---@param bufnr integer
+---@param changedtick integer
+---@param firstline integer
+---@param lastline integer
+---@param new_lastline integer
+---@return true?
+local function text_document_did_change_handler(
+ _,
+ bufnr,
+ changedtick,
+ firstline,
+ lastline,
+ new_lastline
+)
+ -- Detach (nvim_buf_attach) via returning True to on_lines if no clients are attached
+ if tbl_isempty(all_buffer_active_clients[bufnr] or {}) then
+ return true
end
+ util.buf_versions[bufnr] = changedtick
+ changetracking.send_changes(bufnr, firstline, lastline, new_lastline)
end
---Buffer lifecycle handler for textDocument/didSave
+--- @param bufnr integer
local function text_document_did_save_handler(bufnr)
bufnr = resolve_bufnr(bufnr)
local uri = vim.uri_from_bufnr(bufnr)
- local text = once(buf_get_full_text)
+ local text = once(lsp._buf_get_full_text)
for _, client in ipairs(lsp.get_clients({ bufnr = bufnr })) do
local name = api.nvim_buf_get_name(bufnr)
local old_name = changetracking._get_and_set_name(client, bufnr, name)
@@ -1789,15 +521,15 @@ local function text_document_did_save_handler(bufnr)
textDocument = {
version = 0,
uri = uri,
- languageId = client.config.get_language_id(bufnr, vim.bo[bufnr].filetype),
- text = buf_get_full_text(bufnr),
+ languageId = client.get_language_id(bufnr, vim.bo[bufnr].filetype),
+ text = lsp._buf_get_full_text(bufnr),
},
})
util.buf_versions[bufnr] = 0
end
local save_capability = vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'save')
if save_capability then
- local included_text
+ local included_text --- @type string?
if type(save_capability) == 'table' and save_capability.includeText then
included_text = text(bufnr)
end
@@ -1826,8 +558,7 @@ function lsp.buf_attach_client(bufnr, client_id)
})
bufnr = resolve_bufnr(bufnr)
if not api.nvim_buf_is_loaded(bufnr) then
- local _ = log.warn()
- and log.warn(string.format('buf_attach_client called on unloaded buffer (id: %d): ', bufnr))
+ log.warn(string.format('buf_attach_client called on unloaded buffer (id: %d): ', bufnr))
return false
end
local buffer_client_ids = all_buffer_active_clients[bufnr]
@@ -1884,7 +615,7 @@ function lsp.buf_attach_client(bufnr, client_id)
if vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'openClose') then
client.notify(ms.textDocument_didClose, params)
end
- text_document_did_open_handler(bufnr, client)
+ client:_text_document_did_open_handler(bufnr)
end
end,
on_detach = function()
@@ -1916,7 +647,7 @@ function lsp.buf_attach_client(bufnr, client_id)
-- Send didOpen for the client if it is initialized. If it isn't initialized
-- then it will send didOpen on initialize.
if client then
- client._on_attach(bufnr)
+ client:_on_attach(bufnr)
end
return true
end
@@ -1946,7 +677,7 @@ function lsp.buf_detach_client(bufnr, client_id)
return
end
- nvim_exec_autocmds('LspDetach', {
+ api.nvim_exec_autocmds('LspDetach', {
buffer = bufnr,
modeline = false,
data = { client_id = client_id },
@@ -1985,7 +716,7 @@ end
---
---@param client_id integer client id
---
----@return (nil|lsp.Client) client rpc object
+---@return (nil|vim.lsp.Client) client rpc object
function lsp.get_client_by_id(client_id)
return active_clients[client_id] or uninitialized_clients[client_id]
end
@@ -2001,7 +732,7 @@ end
--- Stops a client(s).
---
---- You can also use the `stop()` function on a |vim.lsp.client| object.
+--- You can also use the `stop()` function on a |vim.lsp.Client| object.
--- To stop all clients:
---
--- ```lua
@@ -2011,7 +742,7 @@ end
--- By default asks the server to shutdown, unless stop was requested
--- already for this client, then force-shutdown is attempted.
---
----@param client_id integer|table id or |vim.lsp.client| object, or list thereof
+---@param client_id integer|vim.lsp.Client id or |vim.lsp.Client| object, or list thereof
---@param force boolean|nil shutdown forcefully
function lsp.stop_client(client_id, force)
local ids = type(client_id) == 'table' and client_id or { client_id }
@@ -2026,28 +757,32 @@ function lsp.stop_client(client_id, force)
end
end
----@class vim.lsp.get_clients.filter
----@field id integer|nil Match clients by id
----@field bufnr integer|nil match clients attached to the given buffer
----@field name string|nil match clients by name
----@field method string|nil match client by supported method name
+--- Key-value pairs used to filter the returned clients.
+--- @class vim.lsp.get_clients.Filter
+--- @inlinedoc
+---
+--- Only return clients with the given id
+--- @field id? integer
+---
+--- Only return clients attached to this buffer
+--- @field bufnr? integer
+---
+--- Only return clients with the given name
+--- @field name? string
+---
+--- Only return clients supporting the given method
+--- @field method? string
--- Get active clients.
---
----@param filter vim.lsp.get_clients.filter|nil (table|nil) A table with
---- key-value pairs used to filter the returned clients.
---- The available keys are:
---- - id (number): Only return clients with the given id
---- - bufnr (number): Only return clients attached to this buffer
---- - name (string): Only return clients with the given name
---- - method (string): Only return clients supporting the given method
----@return lsp.Client[]: List of |vim.lsp.client| objects
+---@param filter? vim.lsp.get_clients.Filter
+---@return vim.lsp.Client[]: List of |vim.lsp.Client| objects
function lsp.get_clients(filter)
validate({ filter = { filter, 't', true } })
filter = filter or {}
- local clients = {} --- @type lsp.Client[]
+ local clients = {} --- @type vim.lsp.Client[]
local t = filter.bufnr and (all_buffer_active_clients[resolve_bufnr(filter.bufnr)] or {})
or active_clients
@@ -2068,7 +803,7 @@ end
---@private
---@deprecated
function lsp.get_active_clients(filter)
- -- TODO: add vim.deprecate call after 0.10 is out for removal in 0.12
+ vim.deprecate('vim.lsp.get_active_clients()', 'vim.lsp.get_clients()', '0.12')
return lsp.get_clients(filter)
end
@@ -2087,12 +822,12 @@ api.nvim_create_autocmd('VimLeavePre', {
client.stop()
end
- local timeouts = {}
+ local timeouts = {} --- @type table<integer,integer>
local max_timeout = 0
local send_kill = false
for client_id, client in pairs(active_clients) do
- local timeout = if_nil(client.config.flags.exit_timeout, false)
+ local timeout = if_nil(client.flags.exit_timeout, false)
if timeout then
send_kill = true
timeouts[client_id] = timeout
@@ -2134,7 +869,7 @@ api.nvim_create_autocmd('VimLeavePre', {
---@param bufnr (integer) Buffer handle, or 0 for current.
---@param method (string) LSP method name
---@param params table|nil Parameters to send to the server
----@param handler? lsp-handler See |lsp-handler|
+---@param handler? lsp.Handler See |lsp-handler|
--- If nil, follows resolution strategy defined in |lsp-handler-configuration|
---
---@return table<integer, integer> client_request_ids Map of client-id:request-id pairs
@@ -2152,7 +887,7 @@ function lsp.buf_request(bufnr, method, params, handler)
bufnr = resolve_bufnr(bufnr)
local method_supported = false
local clients = lsp.get_clients({ bufnr = bufnr })
- local client_request_ids = {}
+ local client_request_ids = {} --- @type table<integer,integer>
for _, client in ipairs(clients) do
if client.supports_method(method, { bufnr = bufnr }) then
method_supported = true
@@ -2169,7 +904,7 @@ function lsp.buf_request(bufnr, method, params, handler)
-- if has client but no clients support the given method, notify the user
if next(clients) and not method_supported then
vim.notify(lsp._unsupported_method(method), vim.log.levels.ERROR)
- nvim_command('redraw')
+ vim.cmd.redraw()
return {}, function() end
end
@@ -2194,7 +929,7 @@ end
--- a `client_id:result` map.
---@return function cancel Function that cancels all requests.
function lsp.buf_request_all(bufnr, method, params, handler)
- local results = {}
+ local results = {} --- @type table<integer,{error:string, result:any}>
local result_count = 0
local expected_result_count = 0
@@ -2225,16 +960,15 @@ end
---
--- Calls |vim.lsp.buf_request_all()| but blocks Nvim while awaiting the result.
--- Parameters are the same as |vim.lsp.buf_request_all()| but the result is
---- different. Waits a maximum of {timeout_ms} (default 1000) ms.
----
----@param bufnr (integer) Buffer handle, or 0 for current.
----@param method (string) LSP method name
----@param params (table|nil) Parameters to send to the server
----@param timeout_ms (integer|nil) Maximum time in milliseconds to wait for a
---- result. Defaults to 1000
----
----@return table<integer, {err: lsp.ResponseError, result: any}>|nil (table) result Map of client_id:request_result.
----@return string|nil err On timeout, cancel, or error, `err` is a string describing the failure reason, and `result` is nil.
+--- different. Waits a maximum of {timeout_ms}.
+---
+---@param bufnr integer Buffer handle, or 0 for current.
+---@param method string LSP method name
+---@param params table? Parameters to send to the server
+---@param timeout_ms integer? Maximum time in milliseconds to wait for a result.
+--- (default: `1000`)
+---@return table<integer, {err: lsp.ResponseError, result: any}>? result Map of client_id:request_result.
+---@return string? err On timeout, cancel, or error, `err` is a string describing the failure reason, and `result` is nil.
function lsp.buf_request_sync(bufnr, method, params, timeout_ms)
local request_results
@@ -2287,21 +1021,24 @@ end
--- - findstart=0: column where the completion starts, or -2 or -3
--- - findstart=1: list of matches (actually just calls |complete()|)
function lsp.omnifunc(findstart, base)
- if log.debug() then
- log.debug('omnifunc.findstart', { findstart = findstart, base = base })
- end
- return require('vim.lsp._completion').omnifunc(findstart, base)
+ log.debug('omnifunc.findstart', { findstart = findstart, base = base })
+ return vim.lsp._completion.omnifunc(findstart, base)
end
+--- @class vim.lsp.formatexpr.Opts
+--- @inlinedoc
+---
+--- The timeout period for the formatting request.
+--- (default: 500ms).
+--- @field timeout_ms integer
+
--- 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`
---- via ``vim.bo[bufnr].formatexpr = 'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})'``.
+--- via `vim.bo[bufnr].formatexpr = 'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})'`.
---
----@param opts table options for customizing the formatting expression which takes the
---- following optional keys:
---- * timeout_ms (default 500ms). The timeout period for the formatting request.
+---@param opts? vim.lsp.formatexpr.Opts
function lsp.formatexpr(opts)
opts = opts or {}
local timeout_ms = opts.timeout_ms or 500
@@ -2324,6 +1061,7 @@ function lsp.formatexpr(opts)
local params = util.make_formatting_params()
local end_line = vim.fn.getline(end_lnum) --[[@as string]]
local end_col = util._str_utfindex_enc(end_line, nil, client.offset_encoding)
+ --- @cast params +lsp.DocumentRangeFormattingParams
params.range = {
start = {
line = start_lnum - 1,
@@ -2337,7 +1075,7 @@ function lsp.formatexpr(opts)
local response =
client.request_sync(ms.textDocument_rangeFormatting, params, timeout_ms, bufnr)
if response and response.result then
- lsp.util.apply_text_edits(response.result, 0, client.offset_encoding)
+ lsp.util.apply_text_edits(response.result, bufnr, client.offset_encoding)
return 0
end
end
@@ -2359,7 +1097,7 @@ end
---
---@return table[] tags A list of matching tags
function lsp.tagfunc(pattern, flags)
- return require('vim.lsp.tagfunc')(pattern, flags)
+ return vim.lsp._tagfunc(pattern, flags)
end
---Checks whether a client is stopped.
@@ -2372,13 +1110,14 @@ function lsp.client_is_stopped(client_id)
end
--- Gets a map of client_id:client pairs for the given buffer, where each value
---- is a |vim.lsp.client| object.
+--- is a |vim.lsp.Client| object.
---
---@param bufnr (integer|nil): Buffer handle, or 0 for current
---@return table result is table of (client_id, client) pairs
---@deprecated Use |vim.lsp.get_clients()| instead.
function lsp.buf_get_clients(bufnr)
- local result = {}
+ vim.deprecate('vim.lsp.buf_get_clients()', 'vim.lsp.get_clients()', '0.12')
+ local result = {} --- @type table<integer,vim.lsp.Client>
for _, client in ipairs(lsp.get_clients({ bufnr = resolve_bufnr(bufnr) })) do
result[client.id] = client
end
@@ -2428,11 +1167,16 @@ end
--- buffer number as arguments.
---@deprecated use lsp.get_clients({ bufnr = bufnr }) with regular loop
function lsp.for_each_buffer_client(bufnr, fn)
+ vim.deprecate(
+ 'vim.lsp.for_each_buffer_client()',
+ 'lsp.get_clients({ bufnr = bufnr }) with regular loop',
+ '0.12'
+ )
return for_each_buffer_client(bufnr, fn)
end
--- Function to manage overriding defaults for LSP handlers.
----@param handler (function) See |lsp-handler|
+---@param handler (lsp.Handler) See |lsp-handler|
---@param override_config (table) Table containing the keys to override behavior of the {handler}
function lsp.with(handler, override_config)
return function(err, result, ctx, config)
@@ -2497,6 +1241,7 @@ end
--- arguments?: any[]
---
--- The second argument is the `ctx` of |lsp-handler|
+--- @type table<string,function>
lsp.commands = setmetatable({}, {
__newindex = function(tbl, key, value)
assert(type(key) == 'string', 'The key for commands in `vim.lsp.commands` must be a string')
diff --git a/runtime/lua/vim/lsp/_changetracking.lua b/runtime/lua/vim/lsp/_changetracking.lua
new file mode 100644
index 0000000000..b2be53269f
--- /dev/null
+++ b/runtime/lua/vim/lsp/_changetracking.lua
@@ -0,0 +1,373 @@
+local protocol = require('vim.lsp.protocol')
+local sync = require('vim.lsp.sync')
+local util = require('vim.lsp.util')
+
+local api = vim.api
+local uv = vim.uv
+
+local M = {}
+
+--- LSP has 3 different sync modes:
+--- - None (Servers will read the files themselves when needed)
+--- - Full (Client sends the full buffer content on updates)
+--- - Incremental (Client sends only the changed parts)
+---
+--- Changes are tracked per buffer.
+--- A buffer can have multiple clients attached and each client needs to send the changes
+--- To minimize the amount of changesets to compute, computation is grouped:
+---
+--- None: One group for all clients
+--- Full: One group for all clients
+--- Incremental: One group per `offset_encoding`
+---
+--- Sending changes can be debounced per buffer. To simplify the implementation the
+--- smallest debounce interval is used and we don't group clients by different intervals.
+---
+--- @class vim.lsp.CTGroup
+--- @field sync_kind integer TextDocumentSyncKind, considers config.flags.allow_incremental_sync
+--- @field offset_encoding "utf-8"|"utf-16"|"utf-32"
+---
+--- @class vim.lsp.CTBufferState
+--- @field name string name of the buffer
+--- @field lines string[] snapshot of buffer lines from last didChange
+--- @field lines_tmp string[]
+--- @field pending_changes table[] List of debounced changes in incremental sync mode
+--- @field timer uv.uv_timer_t? uv_timer
+--- @field last_flush nil|number uv.hrtime of the last flush/didChange-notification
+--- @field needs_flush boolean true if buffer updates haven't been sent to clients/servers yet
+--- @field refs integer how many clients are using this group
+---
+--- @class vim.lsp.CTGroupState
+--- @field buffers table<integer,vim.lsp.CTBufferState>
+--- @field debounce integer debounce duration in ms
+--- @field clients table<integer, table> clients using this state. {client_id, client}
+
+---@param group vim.lsp.CTGroup
+---@return string
+local function group_key(group)
+ if group.sync_kind == protocol.TextDocumentSyncKind.Incremental then
+ return tostring(group.sync_kind) .. '\0' .. group.offset_encoding
+ end
+ return tostring(group.sync_kind)
+end
+
+---@type table<vim.lsp.CTGroup,vim.lsp.CTGroupState>
+local state_by_group = setmetatable({}, {
+ __index = function(tbl, k)
+ return rawget(tbl, group_key(k))
+ end,
+ __newindex = function(tbl, k, v)
+ rawset(tbl, group_key(k), v)
+ end,
+})
+
+---@param client vim.lsp.Client
+---@return vim.lsp.CTGroup
+local function get_group(client)
+ local allow_inc_sync = vim.F.if_nil(client.flags.allow_incremental_sync, true) --- @type boolean
+ local change_capability = vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'change')
+ local sync_kind = change_capability or protocol.TextDocumentSyncKind.None
+ if not allow_inc_sync and change_capability == protocol.TextDocumentSyncKind.Incremental then
+ sync_kind = protocol.TextDocumentSyncKind.Full --[[@as integer]]
+ end
+ return {
+ sync_kind = sync_kind,
+ offset_encoding = client.offset_encoding,
+ }
+end
+
+---@param state vim.lsp.CTBufferState
+---@param encoding string
+---@param bufnr integer
+---@param firstline integer
+---@param lastline integer
+---@param new_lastline integer
+---@return lsp.TextDocumentContentChangeEvent
+local function incremental_changes(state, encoding, bufnr, firstline, lastline, new_lastline)
+ local prev_lines = state.lines
+ local curr_lines = state.lines_tmp
+
+ local changed_lines = api.nvim_buf_get_lines(bufnr, firstline, new_lastline, true)
+ for i = 1, firstline do
+ curr_lines[i] = prev_lines[i]
+ end
+ for i = firstline + 1, new_lastline do
+ curr_lines[i] = changed_lines[i - firstline]
+ end
+ for i = lastline + 1, #prev_lines do
+ curr_lines[i - lastline + new_lastline] = prev_lines[i]
+ end
+ if vim.tbl_isempty(curr_lines) then
+ -- Can happen when deleting the entire contents of a buffer, see https://github.com/neovim/neovim/issues/16259.
+ curr_lines[1] = ''
+ end
+
+ local line_ending = vim.lsp._buf_get_line_ending(bufnr)
+ local incremental_change = sync.compute_diff(
+ state.lines,
+ curr_lines,
+ firstline,
+ lastline,
+ new_lastline,
+ encoding,
+ line_ending
+ )
+
+ -- Double-buffering of lines tables is used to reduce the load on the garbage collector.
+ -- At this point the prev_lines table is useless, but its internal storage has already been allocated,
+ -- so let's keep it around for the next didChange event, in which it will become the next
+ -- curr_lines table. Note that setting elements to nil doesn't actually deallocate slots in the
+ -- internal storage - it merely marks them as free, for the GC to deallocate them.
+ for i in ipairs(prev_lines) do
+ prev_lines[i] = nil
+ end
+ state.lines = curr_lines
+ state.lines_tmp = prev_lines
+
+ return incremental_change
+end
+
+---@param client vim.lsp.Client
+---@param bufnr integer
+function M.init(client, bufnr)
+ assert(client.offset_encoding, 'lsp client must have an offset_encoding')
+ local group = get_group(client)
+ local state = state_by_group[group]
+ if state then
+ state.debounce = math.min(state.debounce, client.flags.debounce_text_changes or 150)
+ state.clients[client.id] = client
+ else
+ state = {
+ buffers = {},
+ debounce = client.flags.debounce_text_changes or 150,
+ clients = {
+ [client.id] = client,
+ },
+ }
+ state_by_group[group] = state
+ end
+ local buf_state = state.buffers[bufnr]
+ if buf_state then
+ buf_state.refs = buf_state.refs + 1
+ else
+ buf_state = {
+ name = api.nvim_buf_get_name(bufnr),
+ lines = {},
+ lines_tmp = {},
+ pending_changes = {},
+ needs_flush = false,
+ refs = 1,
+ }
+ state.buffers[bufnr] = buf_state
+ if group.sync_kind == protocol.TextDocumentSyncKind.Incremental then
+ buf_state.lines = api.nvim_buf_get_lines(bufnr, 0, -1, true)
+ end
+ end
+end
+
+--- @param client vim.lsp.Client
+--- @param bufnr integer
+--- @param name string
+--- @return string
+function M._get_and_set_name(client, bufnr, name)
+ local state = state_by_group[get_group(client)] or {}
+ local buf_state = (state.buffers or {})[bufnr]
+ local old_name = buf_state.name
+ buf_state.name = name
+ return old_name
+end
+
+---@param buf_state vim.lsp.CTBufferState
+local function reset_timer(buf_state)
+ local timer = buf_state.timer
+ if timer then
+ buf_state.timer = nil
+ if not timer:is_closing() then
+ timer:stop()
+ timer:close()
+ end
+ end
+end
+
+--- @param client vim.lsp.Client
+--- @param bufnr integer
+function M.reset_buf(client, bufnr)
+ M.flush(client, bufnr)
+ local state = state_by_group[get_group(client)]
+ if not state then
+ return
+ end
+ assert(state.buffers, 'CTGroupState must have buffers')
+ local buf_state = state.buffers[bufnr]
+ buf_state.refs = buf_state.refs - 1
+ assert(buf_state.refs >= 0, 'refcount on buffer state must not get negative')
+ if buf_state.refs == 0 then
+ state.buffers[bufnr] = nil
+ reset_timer(buf_state)
+ end
+end
+
+--- @param client vim.lsp.Client
+function M.reset(client)
+ local state = state_by_group[get_group(client)]
+ if not state then
+ return
+ end
+ state.clients[client.id] = nil
+ if vim.tbl_count(state.clients) == 0 then
+ for _, buf_state in pairs(state.buffers) do
+ reset_timer(buf_state)
+ end
+ state.buffers = {}
+ end
+end
+
+-- Adjust debounce time by taking time of last didChange notification into
+-- consideration. If the last didChange happened more than `debounce` time ago,
+-- debounce can be skipped and otherwise maybe reduced.
+--
+-- This turns the debounce into a kind of client rate limiting
+--
+---@param debounce integer
+---@param buf_state vim.lsp.CTBufferState
+---@return number
+local function next_debounce(debounce, buf_state)
+ if debounce == 0 then
+ return 0
+ end
+ local ns_to_ms = 0.000001
+ if not buf_state.last_flush then
+ return debounce
+ end
+ local now = uv.hrtime()
+ local ms_since_last_flush = (now - buf_state.last_flush) * ns_to_ms
+ return math.max(debounce - ms_since_last_flush, 0)
+end
+
+---@param bufnr integer
+---@param sync_kind integer protocol.TextDocumentSyncKind
+---@param state vim.lsp.CTGroupState
+---@param buf_state vim.lsp.CTBufferState
+local function send_changes(bufnr, sync_kind, state, buf_state)
+ if not buf_state.needs_flush then
+ return
+ end
+ buf_state.last_flush = uv.hrtime()
+ buf_state.needs_flush = false
+
+ if not api.nvim_buf_is_valid(bufnr) then
+ buf_state.pending_changes = {}
+ return
+ end
+
+ local changes --- @type lsp.TextDocumentContentChangeEvent[]
+ if sync_kind == protocol.TextDocumentSyncKind.None then
+ return
+ elseif sync_kind == protocol.TextDocumentSyncKind.Incremental then
+ changes = buf_state.pending_changes
+ buf_state.pending_changes = {}
+ else
+ changes = {
+ { text = vim.lsp._buf_get_full_text(bufnr) },
+ }
+ end
+ local uri = vim.uri_from_bufnr(bufnr)
+ for _, client in pairs(state.clients) do
+ if not client.is_stopped() and vim.lsp.buf_is_attached(bufnr, client.id) then
+ client.notify(protocol.Methods.textDocument_didChange, {
+ textDocument = {
+ uri = uri,
+ version = util.buf_versions[bufnr],
+ },
+ contentChanges = changes,
+ })
+ end
+ end
+end
+
+--- @param bufnr integer
+--- @param firstline integer
+--- @param lastline integer
+--- @param new_lastline integer
+--- @param group vim.lsp.CTGroup
+local function send_changes_for_group(bufnr, firstline, lastline, new_lastline, group)
+ local state = state_by_group[group]
+ if not state then
+ error(
+ string.format(
+ 'changetracking.init must have been called for all LSP clients. group=%s states=%s',
+ vim.inspect(group),
+ vim.inspect(vim.tbl_keys(state_by_group))
+ )
+ )
+ end
+ local buf_state = state.buffers[bufnr]
+ buf_state.needs_flush = true
+ reset_timer(buf_state)
+ local debounce = next_debounce(state.debounce, buf_state)
+ if group.sync_kind == protocol.TextDocumentSyncKind.Incremental then
+ -- This must be done immediately and cannot be delayed
+ -- The contents would further change and startline/endline may no longer fit
+ local changes = incremental_changes(
+ buf_state,
+ group.offset_encoding,
+ bufnr,
+ firstline,
+ lastline,
+ new_lastline
+ )
+ table.insert(buf_state.pending_changes, changes)
+ end
+ if debounce == 0 then
+ send_changes(bufnr, group.sync_kind, state, buf_state)
+ else
+ local timer = assert(uv.new_timer(), 'Must be able to create timer')
+ buf_state.timer = timer
+ timer:start(
+ debounce,
+ 0,
+ vim.schedule_wrap(function()
+ reset_timer(buf_state)
+ send_changes(bufnr, group.sync_kind, state, buf_state)
+ end)
+ )
+ end
+end
+
+--- @param bufnr integer
+--- @param firstline integer
+--- @param lastline integer
+--- @param new_lastline integer
+function M.send_changes(bufnr, firstline, lastline, new_lastline)
+ local groups = {} ---@type table<string,vim.lsp.CTGroup>
+ for _, client in pairs(vim.lsp.get_clients({ bufnr = bufnr })) do
+ local group = get_group(client)
+ groups[group_key(group)] = group
+ end
+ for _, group in pairs(groups) do
+ send_changes_for_group(bufnr, firstline, lastline, new_lastline, group)
+ end
+end
+
+--- Flushes any outstanding change notification.
+---@param client vim.lsp.Client
+---@param bufnr? integer
+function M.flush(client, bufnr)
+ local group = get_group(client)
+ local state = state_by_group[group]
+ if not state then
+ return
+ end
+ if bufnr then
+ local buf_state = state.buffers[bufnr] or {}
+ reset_timer(buf_state)
+ send_changes(bufnr, group.sync_kind, state, buf_state)
+ else
+ for buf, buf_state in pairs(state.buffers) do
+ reset_timer(buf_state)
+ send_changes(buf, group.sync_kind, state, buf_state)
+ end
+ end
+end
+
+return M
diff --git a/runtime/lua/vim/lsp/_completion.lua b/runtime/lua/vim/lsp/_completion.lua
index 7a607d6c13..a169f96565 100644
--- a/runtime/lua/vim/lsp/_completion.lua
+++ b/runtime/lua/vim/lsp/_completion.lua
@@ -4,11 +4,21 @@ local lsp = vim.lsp
local protocol = lsp.protocol
local ms = protocol.Methods
+--- @alias vim.lsp.CompletionResult lsp.CompletionList | lsp.CompletionItem[]
+
+-- TODO(mariasolos): Remove this declaration once we figure out a better way to handle
+-- literal/anonymous types (see https://github.com/neovim/neovim/pull/27542/files#r1495259331).
+--- @class lsp.ItemDefaults
+--- @field editRange lsp.Range | { insert: lsp.Range, replace: lsp.Range } | nil
+--- @field insertTextFormat lsp.InsertTextFormat?
+--- @field insertTextMode lsp.InsertTextMode?
+--- @field data any
+
---@param input string unparsed snippet
---@return string parsed snippet
local function parse_snippet(input)
local ok, parsed = pcall(function()
- return require('vim.lsp._snippet_grammar').parse(input)
+ return vim.lsp._snippet_grammar.parse(input)
end)
return ok and tostring(parsed) or input
end
@@ -37,19 +47,49 @@ local function get_completion_word(item)
return item.label
end
----@param result lsp.CompletionList|lsp.CompletionItem[]
+--- Applies the given defaults to the completion item, modifying it in place.
+---
+--- @param item lsp.CompletionItem
+--- @param defaults lsp.ItemDefaults?
+local function apply_defaults(item, defaults)
+ if not defaults then
+ return
+ end
+
+ item.insertTextFormat = item.insertTextFormat or defaults.insertTextFormat
+ item.insertTextMode = item.insertTextMode or defaults.insertTextMode
+ item.data = item.data or defaults.data
+ if defaults.editRange then
+ local textEdit = item.textEdit or {}
+ item.textEdit = textEdit
+ textEdit.newText = textEdit.newText or item.textEditText or item.insertText
+ if defaults.editRange.start then
+ textEdit.range = textEdit.range or defaults.editRange
+ elseif defaults.editRange.insert then
+ textEdit.insert = defaults.editRange.insert
+ textEdit.replace = defaults.editRange.replace
+ end
+ end
+end
+
+---@param result vim.lsp.CompletionResult
---@return lsp.CompletionItem[]
local function get_items(result)
if result.items then
+ for _, item in ipairs(result.items) do
+ ---@diagnostic disable-next-line: param-type-mismatch
+ apply_defaults(item, result.itemDefaults)
+ end
return result.items
+ else
+ return result
end
- return result
end
--- Turns the result of a `textDocument/completion` request into vim-compatible
--- |complete-items|.
---
----@param result lsp.CompletionList|lsp.CompletionItem[] Result of `textDocument/completion`
+---@param result vim.lsp.CompletionResult Result of `textDocument/completion`
---@param prefix string prefix to filter the completion items
---@return table[]
---@see complete-items
@@ -130,7 +170,7 @@ end
---@param lnum integer 0-indexed line number
---@param client_start_boundary integer 0-indexed word boundary
---@param server_start_boundary? integer 0-indexed word boundary, based on textEdit.range.start.character
----@param result lsp.CompletionList|lsp.CompletionItem[]
+---@param result vim.lsp.CompletionResult
---@param encoding string
---@return table[] matches
---@return integer? server_start_boundary
@@ -206,7 +246,7 @@ function M.omnifunc(findstart, base)
local params = util.make_position_params(win, client.offset_encoding)
client.request(ms.textDocument_completion, params, function(err, result)
if err then
- require('vim.lsp.log').warn(err.message)
+ vim.lsp.log.warn(err.message)
end
if result and vim.fn.mode() == 'i' then
local matches
diff --git a/runtime/lua/vim/lsp/_dynamic.lua b/runtime/lua/vim/lsp/_dynamic.lua
index 04040e8e28..819b03a63a 100644
--- a/runtime/lua/vim/lsp/_dynamic.lua
+++ b/runtime/lua/vim/lsp/_dynamic.lua
@@ -1,4 +1,4 @@
-local wf = require('vim.lsp._watchfiles')
+local glob = vim.glob
--- @class lsp.DynamicCapabilities
--- @field capabilities table<string, lsp.Registration[]>
@@ -6,6 +6,7 @@ local wf = require('vim.lsp._watchfiles')
local M = {}
--- @param client_id number
+--- @return lsp.DynamicCapabilities
function M.new(client_id)
return setmetatable({
capabilities = {},
@@ -18,12 +19,12 @@ function M:supports_registration(method)
if not client then
return false
end
- local capability = vim.tbl_get(client.config.capabilities, unpack(vim.split(method, '/')))
+ local capability = vim.tbl_get(client.capabilities, unpack(vim.split(method, '/')))
return type(capability) == 'table' and capability.dynamicRegistration
end
--- @param registrations lsp.Registration[]
---- @private
+--- @package
function M:register(registrations)
-- remove duplicates
self:unregister(registrations)
@@ -37,7 +38,7 @@ function M:register(registrations)
end
--- @param unregisterations lsp.Unregistration[]
---- @private
+--- @package
function M:unregister(unregisterations)
for _, unreg in ipairs(unregisterations) do
local method = unreg.method
@@ -55,9 +56,9 @@ function M:unregister(unregisterations)
end
--- @param method string
---- @param opts? {bufnr?: number}
+--- @param opts? {bufnr: integer?}
--- @return lsp.Registration? (table|nil) the registration if found
---- @private
+--- @package
function M:get(method, opts)
opts = opts or {}
opts.bufnr = opts.bufnr or vim.api.nvim_get_current_buf()
@@ -69,15 +70,15 @@ function M:get(method, opts)
if not documentSelector then
return reg
end
- if M.match(opts.bufnr, documentSelector) then
+ if self:match(opts.bufnr, documentSelector) then
return reg
end
end
end
--- @param method string
---- @param opts? {bufnr?: number}
---- @private
+--- @param opts? {bufnr: integer?}
+--- @package
function M:supports(method, opts)
return self:get(method, opts) ~= nil
end
@@ -85,19 +86,23 @@ end
--- @param bufnr number
--- @param documentSelector lsp.DocumentSelector
--- @private
-function M.match(bufnr, documentSelector)
- local ft = vim.bo[bufnr].filetype
+function M:match(bufnr, documentSelector)
+ local client = vim.lsp.get_client_by_id(self.client_id)
+ if not client then
+ return false
+ end
+ local language = client.get_language_id(bufnr, vim.bo[bufnr].filetype)
local uri = vim.uri_from_bufnr(bufnr)
local fname = vim.uri_to_fname(uri)
for _, filter in ipairs(documentSelector) do
local matches = true
- if filter.language and ft ~= filter.language then
+ if filter.language and language ~= filter.language then
matches = false
end
if matches and filter.scheme and not vim.startswith(uri, filter.scheme .. ':') then
matches = false
end
- if matches and filter.pattern and not wf._match(filter.pattern, fname) then
+ if matches and filter.pattern and not glob.to_lpeg(filter.pattern):match(fname) then
matches = false
end
if matches then
diff --git a/runtime/lua/vim/lsp/_meta.lua b/runtime/lua/vim/lsp/_meta.lua
index acf799264e..be3222828d 100644
--- a/runtime/lua/vim/lsp/_meta.lua
+++ b/runtime/lua/vim/lsp/_meta.lua
@@ -1,22 +1,16 @@
---@meta
error('Cannot require a meta file')
----@alias lsp-handler fun(err: lsp.ResponseError|nil, result: any, context: lsp.HandlerContext, config: table|nil): any?
+---@alias lsp.Handler fun(err: lsp.ResponseError?, result: any, context: lsp.HandlerContext, config?: table): ...any
---@class lsp.HandlerContext
---@field method string
---@field client_id integer
---@field bufnr? integer
---@field params? any
+---@field version? integer
---@class lsp.ResponseError
---@field code integer
---@field message string
---@field data string|number|boolean|table[]|table|nil
-
---- @class lsp.DocumentFilter
---- @field language? string
---- @field scheme? string
---- @field pattern? string
-
---- @alias lsp.RegisterOptions any | lsp.StaticRegistrationOptions | lsp.TextDocumentRegistrationOptions
diff --git a/runtime/lua/vim/lsp/_meta/protocol.lua b/runtime/lua/vim/lsp/_meta/protocol.lua
index 72b0f00f65..a5da5ac6b7 100644
--- a/runtime/lua/vim/lsp/_meta/protocol.lua
+++ b/runtime/lua/vim/lsp/_meta/protocol.lua
@@ -1,7 +1,11 @@
--[[
-This file is autogenerated from scripts/gen_lsp.lua
+THIS FILE IS GENERATED by scripts/gen_lsp.lua
+DO NOT EDIT MANUALLY
+
+Based on LSP protocol 3.18
+
Regenerate:
-nvim -l scripts/gen_lsp.lua gen --version 3.18 --runtime/lua/vim/lsp/_meta/protocol.lua
+nvim -l scripts/gen_lsp.lua gen --version 3.18
--]]
---@meta
@@ -9,111 +13,132 @@ error('Cannot require a meta file')
---@alias lsp.null nil
---@alias uinteger integer
----@alias lsp.decimal number
+---@alias decimal number
---@alias lsp.DocumentUri string
---@alias lsp.URI string
----@alias lsp.LSPObject table<string, lsp.LSPAny>
----@alias lsp.LSPArray lsp.LSPAny[]
----@alias lsp.LSPAny lsp.LSPObject|lsp.LSPArray|string|number|boolean|nil
---@class lsp.ImplementationParams: lsp.TextDocumentPositionParams, lsp.WorkDoneProgressParams, lsp.PartialResultParams
---Represents a location inside a resource, such as a line
---inside a text file.
---@class lsp.Location
+---
---@field uri lsp.DocumentUri
+---
---@field range lsp.Range
----@class lsp.ImplementationRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions
+---@class lsp.ImplementationRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.ImplementationOptions, lsp.StaticRegistrationOptions
---@class lsp.TypeDefinitionParams: lsp.TextDocumentPositionParams, lsp.WorkDoneProgressParams, lsp.PartialResultParams
----@class lsp.TypeDefinitionRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions
+---@class lsp.TypeDefinitionRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.TypeDefinitionOptions, lsp.StaticRegistrationOptions
---A workspace folder inside a client.
---@class lsp.WorkspaceFolder
+---
---The associated URI for this workspace folder.
---@field uri lsp.URI
+---
---The name of the workspace folder. Used to refer to this
---workspace folder in the user interface.
---@field name string
---The parameters of a `workspace/didChangeWorkspaceFolders` notification.
---@class lsp.DidChangeWorkspaceFoldersParams
+---
---The actual workspace folder change event.
---@field event lsp.WorkspaceFoldersChangeEvent
---The parameters of a configuration request.
---@class lsp.ConfigurationParams
+---
---@field items lsp.ConfigurationItem[]
---Parameters for a {@link DocumentColorRequest}.
----@class lsp.DocumentColorParams
+---@class lsp.DocumentColorParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams
+---
---The text document.
---@field textDocument lsp.TextDocumentIdentifier
---Represents a color range from a document.
---@class lsp.ColorInformation
+---
---The range in the document where this color appears.
---@field range lsp.Range
+---
---The actual color value for this color range.
---@field color lsp.Color
----@class lsp.DocumentColorRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions
+---@class lsp.DocumentColorRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.DocumentColorOptions, lsp.StaticRegistrationOptions
---Parameters for a {@link ColorPresentationRequest}.
----@class lsp.ColorPresentationParams
+---@class lsp.ColorPresentationParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams
+---
---The text document.
---@field textDocument lsp.TextDocumentIdentifier
+---
---The color to request presentations for.
---@field color lsp.Color
+---
---The range where the color would be inserted. Serves as a context.
---@field range lsp.Range
---@class lsp.ColorPresentation
+---
---The label of this color presentation. It will be shown on the color
---picker header. By default this is also the text that is inserted when selecting
---this color presentation.
---@field label string
+---
---An {@link TextEdit edit} which is applied to a document when selecting
---this presentation for the color. When `falsy` the {@link ColorPresentation.label label}
---is used.
---@field textEdit? lsp.TextEdit
+---
---An optional array of additional {@link TextEdit text edits} that are applied when
---selecting this color presentation. Edits must not overlap with the main {@link ColorPresentation.textEdit edit} nor with themselves.
---@field additionalTextEdits? lsp.TextEdit[]
---@class lsp.WorkDoneProgressOptions
+---
---@field workDoneProgress? boolean
---General text document registration options.
---@class lsp.TextDocumentRegistrationOptions
+---
---A document selector to identify the scope of the registration. If set to null
---the document selector provided on the client side will be used.
---@field documentSelector lsp.DocumentSelector|lsp.null
---Parameters for a {@link FoldingRangeRequest}.
----@class lsp.FoldingRangeParams
+---@class lsp.FoldingRangeParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams
+---
---The text document.
---@field textDocument lsp.TextDocumentIdentifier
---Represents a folding range. To be valid, start and end line must be bigger than zero and smaller
---than the number of lines in the document. Clients are free to ignore invalid ranges.
---@class lsp.FoldingRange
+---
---The zero-based start line of the range to fold. The folded area starts after the line's last character.
---To be valid, the end must be zero or larger and smaller than the number of lines in the document.
---@field startLine uinteger
+---
---The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line.
---@field startCharacter? uinteger
+---
---The zero-based end line of the range to fold. The folded area ends with the line's last character.
---To be valid, the end must be zero or larger and smaller than the number of lines in the document.
---@field endLine uinteger
+---
---The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line.
---@field endCharacter? uinteger
+---
---Describes the kind of the folding range such as `comment' or 'region'. The kind
---is used to categorize folding ranges and used by commands like 'Fold all comments'.
---See {@link FoldingRangeKind} for an enumeration of standardized kinds.
---@field kind? lsp.FoldingRangeKind
+---
---The text that the client should show when the specified range is
---collapsed. If not defined or not supported by the client, a default
---will be chosen by the client.
@@ -121,34 +146,40 @@ error('Cannot require a meta file')
---@since 3.17.0
---@field collapsedText? string
----@class lsp.FoldingRangeRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions
+---@class lsp.FoldingRangeRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.FoldingRangeOptions, lsp.StaticRegistrationOptions
---@class lsp.DeclarationParams: lsp.TextDocumentPositionParams, lsp.WorkDoneProgressParams, lsp.PartialResultParams
----@class lsp.DeclarationRegistrationOptions: lsp.DeclarationOptions, lsp.StaticRegistrationOptions
+---@class lsp.DeclarationRegistrationOptions: lsp.DeclarationOptions, lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions
---A parameter literal used in selection range requests.
----@class lsp.SelectionRangeParams
+---@class lsp.SelectionRangeParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams
+---
---The text document.
---@field textDocument lsp.TextDocumentIdentifier
+---
---The positions inside the text document.
---@field positions lsp.Position[]
---A selection range represents a part of a selection hierarchy. A selection range
---may have a parent selection range that contains it.
---@class lsp.SelectionRange
+---
---The {@link Range range} of this selection range.
---@field range lsp.Range
+---
---The parent selection range containing this range. Therefore `parent.range` must contain `this.range`.
---@field parent? lsp.SelectionRange
----@class lsp.SelectionRangeRegistrationOptions: lsp.SelectionRangeOptions, lsp.StaticRegistrationOptions
+---@class lsp.SelectionRangeRegistrationOptions: lsp.SelectionRangeOptions, lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions
---@class lsp.WorkDoneProgressCreateParams
+---
---The token to be used to report progress.
---@field token lsp.ProgressToken
---@class lsp.WorkDoneProgressCancelParams
+---
---The token to be used to report progress.
---@field token lsp.ProgressToken
@@ -162,21 +193,29 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@class lsp.CallHierarchyItem
+---
---The name of this item.
---@field name string
+---
---The kind of this item.
---@field kind lsp.SymbolKind
+---
---Tags for this item.
---@field tags? lsp.SymbolTag[]
+---
---More detail for this item, e.g. the signature of a function.
---@field detail? string
+---
---The resource identifier of this item.
---@field uri lsp.DocumentUri
+---
---The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code.
---@field range lsp.Range
+---
---The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function.
---Must be contained by the {@link CallHierarchyItem.range `range`}.
---@field selectionRange lsp.Range
+---
---A data entry field that is preserved between a call hierarchy prepare and
---incoming calls or outgoing calls requests.
---@field data? lsp.LSPAny
@@ -184,20 +223,23 @@ error('Cannot require a meta file')
---Call hierarchy options used during static or dynamic registration.
---
---@since 3.16.0
----@class lsp.CallHierarchyRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions
+---@class lsp.CallHierarchyRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.CallHierarchyOptions, lsp.StaticRegistrationOptions
---The parameter of a `callHierarchy/incomingCalls` request.
---
---@since 3.16.0
----@class lsp.CallHierarchyIncomingCallsParams
+---@class lsp.CallHierarchyIncomingCallsParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams
+---
---@field item lsp.CallHierarchyItem
---Represents an incoming call, e.g. a caller of a method or constructor.
---
---@since 3.16.0
---@class lsp.CallHierarchyIncomingCall
+---
---The item that makes the call.
---@field from lsp.CallHierarchyItem
+---
---The ranges at which the calls appear. This is relative to the caller
---denoted by {@link CallHierarchyIncomingCall.from `this.from`}.
---@field fromRanges lsp.Range[]
@@ -205,64 +247,78 @@ error('Cannot require a meta file')
---The parameter of a `callHierarchy/outgoingCalls` request.
---
---@since 3.16.0
----@class lsp.CallHierarchyOutgoingCallsParams
+---@class lsp.CallHierarchyOutgoingCallsParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams
+---
---@field item lsp.CallHierarchyItem
---Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc.
---
---@since 3.16.0
---@class lsp.CallHierarchyOutgoingCall
+---
---The item that is called.
---@field to lsp.CallHierarchyItem
+---
---The range at which this item is called. This is the range relative to the caller, e.g the item
---passed to {@link CallHierarchyItemProvider.provideCallHierarchyOutgoingCalls `provideCallHierarchyOutgoingCalls`}
---and not {@link CallHierarchyOutgoingCall.to `this.to`}.
---@field fromRanges lsp.Range[]
---@since 3.16.0
----@class lsp.SemanticTokensParams
+---@class lsp.SemanticTokensParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams
+---
---The text document.
---@field textDocument lsp.TextDocumentIdentifier
---@since 3.16.0
---@class lsp.SemanticTokens
+---
---An optional result id. If provided and clients support delta updating
---the client will include the result id in the next semantic token request.
---A server can then instead of computing all semantic tokens again simply
---send a delta.
---@field resultId? string
+---
---The actual tokens.
---@field data uinteger[]
---@since 3.16.0
---@class lsp.SemanticTokensPartialResult
+---
---@field data uinteger[]
---@since 3.16.0
----@class lsp.SemanticTokensRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions
+---@class lsp.SemanticTokensRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.SemanticTokensOptions, lsp.StaticRegistrationOptions
---@since 3.16.0
----@class lsp.SemanticTokensDeltaParams
+---@class lsp.SemanticTokensDeltaParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams
+---
---The text document.
---@field textDocument lsp.TextDocumentIdentifier
+---
---The result id of a previous response. The result Id can either point to a full response
---or a delta response depending on what was received last.
---@field previousResultId string
---@since 3.16.0
---@class lsp.SemanticTokensDelta
+---
---@field resultId? string
+---
---The semantic token edits to transform a previous result into a new result.
---@field edits lsp.SemanticTokensEdit[]
---@since 3.16.0
---@class lsp.SemanticTokensDeltaPartialResult
+---
---@field edits lsp.SemanticTokensEdit[]
---@since 3.16.0
----@class lsp.SemanticTokensRangeParams
+---@class lsp.SemanticTokensRangeParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams
+---
---The text document.
---@field textDocument lsp.TextDocumentIdentifier
+---
---The range the semantic tokens are requested for.
---@field range lsp.Range
@@ -270,17 +326,21 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@class lsp.ShowDocumentParams
+---
---The uri to show.
---@field uri lsp.URI
+---
---Indicates to show the resource in an external program.
---To show, for example, `https://code.visualstudio.com/`
---in the default WEB browser set `external` to `true`.
---@field external? boolean
+---
---An optional property to indicate whether the editor
---showing the document should take focus or not.
---Clients might ignore this property if an external
---program is started.
---@field takeFocus? boolean
+---
---An optional selection range if the document is a text
---document. Clients might ignore the property if an
---external program is started or the file is not a text
@@ -291,6 +351,7 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@class lsp.ShowDocumentResult
+---
---A boolean indicating if the show was successful.
---@field success boolean
@@ -300,21 +361,24 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@class lsp.LinkedEditingRanges
+---
---A list of ranges that can be edited together. The ranges must have
---identical length and contain identical text content. The ranges cannot overlap.
---@field ranges lsp.Range[]
+---
---An optional word pattern (regular expression) that describes valid contents for
---the given ranges. If no pattern is provided, the client configuration's word
---pattern will be used.
---@field wordPattern? string
----@class lsp.LinkedEditingRangeRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions
+---@class lsp.LinkedEditingRangeRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.LinkedEditingRangeOptions, lsp.StaticRegistrationOptions
---The parameters sent in notifications/requests for user-initiated creation of
---files.
---
---@since 3.16.0
---@class lsp.CreateFilesParams
+---
---An array of all files/folders created in this operation.
---@field files lsp.FileCreate[]
@@ -331,8 +395,10 @@ error('Cannot require a meta file')
---cause failure of the operation. How the client recovers from the failure is described by
---the client capability: `workspace.workspaceEdit.failureHandling`
---@class lsp.WorkspaceEdit
+---
---Holds changes to existing resources.
---@field changes? table<lsp.DocumentUri, lsp.TextEdit[]>
+---
---Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes
---are either an array of `TextDocumentEdit`s to express changes to n different text documents
---where each text document edit addresses a specific version of a text document. Or it can contain
@@ -343,7 +409,8 @@ error('Cannot require a meta file')
---
---If a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then
---only plain `TextEdit`s using the `changes` property are supported.
----@field documentChanges? lsp.TextDocumentEdit|lsp.CreateFile|lsp.RenameFile|lsp.DeleteFile[]
+---@field documentChanges? (lsp.TextDocumentEdit|lsp.CreateFile|lsp.RenameFile|lsp.DeleteFile)[]
+---
---A map of change annotations that can be referenced in `AnnotatedTextEdit`s or create, rename and
---delete file / folder operations.
---
@@ -356,6 +423,7 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@class lsp.FileOperationRegistrationOptions
+---
---The actual filters.
---@field filters lsp.FileOperationFilter[]
@@ -364,6 +432,7 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@class lsp.RenameFilesParams
+---
---An array of all files/folders renamed in this operation. When a folder is renamed, only
---the folder will be included, and not its children.
---@field files lsp.FileRename[]
@@ -373,6 +442,7 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@class lsp.DeleteFilesParams
+---
---An array of all files/folders deleted in this operation.
---@field files lsp.FileDelete[]
@@ -382,17 +452,21 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@class lsp.Moniker
+---
---The scheme of the moniker. For example tsc or .Net
---@field scheme string
+---
---The identifier of the moniker. The value is opaque in LSIF however
---schema owners are allowed to define the structure if they want.
---@field identifier string
+---
---The scope in which the moniker is unique
---@field unique lsp.UniquenessLevel
+---
---The moniker kind if known.
---@field kind? lsp.MonikerKind
----@class lsp.MonikerRegistrationOptions: lsp.TextDocumentRegistrationOptions
+---@class lsp.MonikerRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.MonikerOptions
---The parameter of a `textDocument/prepareTypeHierarchy` request.
---
@@ -401,23 +475,31 @@ error('Cannot require a meta file')
---@since 3.17.0
---@class lsp.TypeHierarchyItem
+---
---The name of this item.
---@field name string
+---
---The kind of this item.
---@field kind lsp.SymbolKind
+---
---Tags for this item.
---@field tags? lsp.SymbolTag[]
+---
---More detail for this item, e.g. the signature of a function.
---@field detail? string
+---
---The resource identifier of this item.
---@field uri lsp.DocumentUri
+---
---The range enclosing this symbol not including leading/trailing whitespace
---but everything else, e.g. comments and code.
---@field range lsp.Range
+---
---The range that should be selected and revealed when this symbol is being
---picked, e.g. the name of a function. Must be contained by the
---{@link TypeHierarchyItem.range `range`}.
---@field selectionRange lsp.Range
+---
---A data entry field that is preserved between a type hierarchy prepare and
---supertypes or subtypes requests. It could also be used to identify the
---type hierarchy in the server, helping improve the performance on
@@ -427,28 +509,33 @@ error('Cannot require a meta file')
---Type hierarchy options used during static or dynamic registration.
---
---@since 3.17.0
----@class lsp.TypeHierarchyRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions
+---@class lsp.TypeHierarchyRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.TypeHierarchyOptions, lsp.StaticRegistrationOptions
---The parameter of a `typeHierarchy/supertypes` request.
---
---@since 3.17.0
----@class lsp.TypeHierarchySupertypesParams
+---@class lsp.TypeHierarchySupertypesParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams
+---
---@field item lsp.TypeHierarchyItem
---The parameter of a `typeHierarchy/subtypes` request.
---
---@since 3.17.0
----@class lsp.TypeHierarchySubtypesParams
+---@class lsp.TypeHierarchySubtypesParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams
+---
---@field item lsp.TypeHierarchyItem
---A parameter literal used in inline value requests.
---
---@since 3.17.0
----@class lsp.InlineValueParams
+---@class lsp.InlineValueParams: lsp.WorkDoneProgressParams
+---
---The text document.
---@field textDocument lsp.TextDocumentIdentifier
+---
---The document range for which inline values should be computed.
---@field range lsp.Range
+---
---Additional information about the context in which inline values were
---requested.
---@field context lsp.InlineValueContext
@@ -456,14 +543,16 @@ error('Cannot require a meta file')
---Inline value options used during static or dynamic registration.
---
---@since 3.17.0
----@class lsp.InlineValueRegistrationOptions: lsp.InlineValueOptions, lsp.StaticRegistrationOptions
+---@class lsp.InlineValueRegistrationOptions: lsp.InlineValueOptions, lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions
---A parameter literal used in inlay hint requests.
---
---@since 3.17.0
----@class lsp.InlayHintParams
+---@class lsp.InlayHintParams: lsp.WorkDoneProgressParams
+---
---The text document.
---@field textDocument lsp.TextDocumentIdentifier
+---
---The document range for which inlay hints should be computed.
---@field range lsp.Range
@@ -471,36 +560,47 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.InlayHint
+---
---The position of this hint.
+---
+---If multiple hints have the same position, they will be shown in the order
+---they appear in the response.
---@field position lsp.Position
+---
---The label of this hint. A human readable string or an array of
---InlayHintLabelPart label parts.
---
---*Note* that neither the string nor the label part can be empty.
---@field label string|lsp.InlayHintLabelPart[]
+---
---The kind of this hint. Can be omitted in which case the client
---should fall back to a reasonable default.
---@field kind? lsp.InlayHintKind
+---
---Optional text edits that are performed when accepting this inlay hint.
---
---*Note* that edits are expected to change the document so that the inlay
---hint (or its nearest variant) is now part of the document and the inlay
---hint itself is now obsolete.
---@field textEdits? lsp.TextEdit[]
+---
---The tooltip text when you hover over this item.
---@field tooltip? string|lsp.MarkupContent
+---
---Render padding before the hint.
---
---Note: Padding should use the editor's background color, not the
---background color of the hint itself. That means padding can be used
---to visually align/separate an inlay hint.
---@field paddingLeft? boolean
+---
---Render padding after the hint.
---
---Note: Padding should use the editor's background color, not the
---background color of the hint itself. That means padding can be used
---to visually align/separate an inlay hint.
---@field paddingRight? boolean
+---
---A data entry field that is preserved on an inlay hint between
---a `textDocument/inlayHint` and a `inlayHint/resolve` request.
---@field data? lsp.LSPAny
@@ -508,16 +608,19 @@ error('Cannot require a meta file')
---Inlay hint options used during static or dynamic registration.
---
---@since 3.17.0
----@class lsp.InlayHintRegistrationOptions: lsp.InlayHintOptions, lsp.StaticRegistrationOptions
+---@class lsp.InlayHintRegistrationOptions: lsp.InlayHintOptions, lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions
---Parameters of the document diagnostic request.
---
---@since 3.17.0
----@class lsp.DocumentDiagnosticParams
+---@class lsp.DocumentDiagnosticParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams
+---
---The text document.
---@field textDocument lsp.TextDocumentIdentifier
+---
---The additional identifier provided during registration.
---@field identifier? string
+---
---The result id of a previous response if provided.
---@field previousResultId? string
@@ -525,25 +628,29 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.DocumentDiagnosticReportPartialResult
+---
---@field relatedDocuments table<lsp.DocumentUri, lsp.FullDocumentDiagnosticReport|lsp.UnchangedDocumentDiagnosticReport>
---Cancellation data returned from a diagnostic request.
---
---@since 3.17.0
---@class lsp.DiagnosticServerCancellationData
+---
---@field retriggerRequest boolean
---Diagnostic registration options.
---
---@since 3.17.0
----@class lsp.DiagnosticRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions
+---@class lsp.DiagnosticRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.DiagnosticOptions, lsp.StaticRegistrationOptions
---Parameters of the workspace diagnostic request.
---
---@since 3.17.0
----@class lsp.WorkspaceDiagnosticParams
+---@class lsp.WorkspaceDiagnosticParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams
+---
---The additional identifier provided during registration.
---@field identifier? string
+---
---The currently known diagnostic reports with their
---previous result ids.
---@field previousResultIds lsp.PreviousResultId[]
@@ -552,20 +659,24 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.WorkspaceDiagnosticReport
+---
---@field items lsp.WorkspaceDocumentDiagnosticReport[]
---A partial result for a workspace diagnostic report.
---
---@since 3.17.0
---@class lsp.WorkspaceDiagnosticReportPartialResult
+---
---@field items lsp.WorkspaceDocumentDiagnosticReport[]
---The params sent in an open notebook document notification.
---
---@since 3.17.0
---@class lsp.DidOpenNotebookDocumentParams
+---
---The notebook document that got opened.
---@field notebookDocument lsp.NotebookDocument
+---
---The text documents that represent the content
---of a notebook cell.
---@field cellTextDocuments lsp.TextDocumentItem[]
@@ -574,11 +685,13 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.DidChangeNotebookDocumentParams
+---
---The notebook document that did change. The version number points
---to the version after all provided changes have been applied. If
---only the text document content of a cell changes the notebook version
---doesn't necessarily have to change.
---@field notebookDocument lsp.VersionedNotebookDocumentIdentifier
+---
---The actual changes to the notebook document.
---
---The changes describe single state changes to the notebook document.
@@ -598,6 +711,7 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.DidSaveNotebookDocumentParams
+---
---The notebook document that got saved.
---@field notebookDocument lsp.NotebookDocumentIdentifier
@@ -605,8 +719,10 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.DidCloseNotebookDocumentParams
+---
---The notebook document that got closed.
---@field notebookDocument lsp.NotebookDocumentIdentifier
+---
---The text documents that represent the content
---of a notebook cell that got closed.
---@field cellTextDocuments lsp.TextDocumentIdentifier[]
@@ -614,56 +730,71 @@ error('Cannot require a meta file')
---A parameter literal used in inline completion requests.
---
---@since 3.18.0
+---@proposed
---@class lsp.InlineCompletionParams: lsp.TextDocumentPositionParams, lsp.WorkDoneProgressParams
+---
---Additional information about the context in which inline completions were
---requested.
---@field context lsp.InlineCompletionContext
---Represents a collection of {@link InlineCompletionItem inline completion items} to be presented in the editor.
+---
+---@since 3.18.0
+---@proposed
---@class lsp.InlineCompletionList
+---
---The inline completion items
---@field items lsp.InlineCompletionItem[]
---An inline completion item represents a text snippet that is proposed inline to complete text that is being typed.
---
---@since 3.18.0
+---@proposed
---@class lsp.InlineCompletionItem
+---
---The text to replace the range with. Must be set.
----@field insertText string
----The format of the insert text. The format applies to the `insertText`. If omitted defaults to `InsertTextFormat.PlainText`.
----@field insertTextFormat? lsp.InsertTextFormat
+---@field insertText string|lsp.StringValue
+---
---A text that is used to decide if this inline completion should be shown. When `falsy` the {@link InlineCompletionItem.insertText} is used.
---@field filterText? string
+---
---The range to replace. Must begin and end on the same line.
---@field range? lsp.Range
+---
---An optional {@link Command} that is executed *after* inserting this completion.
---@field command? lsp.Command
---Inline completion options used during static or dynamic registration.
---
---@since 3.18.0
----@class lsp.InlineCompletionRegistrationOptions: lsp.InlineCompletionOptions, lsp.StaticRegistrationOptions
+---@proposed
+---@class lsp.InlineCompletionRegistrationOptions: lsp.InlineCompletionOptions, lsp.TextDocumentRegistrationOptions, lsp.StaticRegistrationOptions
---@class lsp.RegistrationParams
+---
---@field registrations lsp.Registration[]
---@class lsp.UnregistrationParams
+---
---@field unregisterations lsp.Unregistration[]
----@class lsp.InitializeParams: lsp._InitializeParams
+---@class lsp.InitializeParams: lsp._InitializeParams, lsp.WorkspaceFoldersInitializeParams
---The result returned from an initialize request.
---@class lsp.InitializeResult
+---
---The capabilities the language server provides.
---@field capabilities lsp.ServerCapabilities
+---
---Information about the server.
---
---@since 3.15.0
----@field serverInfo? anonym1
+---@field serverInfo? lsp._anonym1.serverInfo
---The data type of the ResponseError if the
---initialize request fails.
---@class lsp.InitializeError
+---
---Indicates whether the client execute the following retry logic:
---(1) show the message provided by the ResponseError to the user
---(2) user selects retry or cancel
@@ -674,49 +805,62 @@ error('Cannot require a meta file')
---The parameters of a change configuration notification.
---@class lsp.DidChangeConfigurationParams
+---
---The actual changed settings
---@field settings lsp.LSPAny
---@class lsp.DidChangeConfigurationRegistrationOptions
+---
---@field section? string|string[]
---The parameters of a notification message.
---@class lsp.ShowMessageParams
+---
---The message type. See {@link MessageType}
---@field type lsp.MessageType
+---
---The actual message.
---@field message string
---@class lsp.ShowMessageRequestParams
+---
---The message type. See {@link MessageType}
---@field type lsp.MessageType
+---
---The actual message.
---@field message string
+---
---The message action items to present.
---@field actions? lsp.MessageActionItem[]
---@class lsp.MessageActionItem
+---
---A short title like 'Retry', 'Open Log' etc.
---@field title string
---The log message parameters.
---@class lsp.LogMessageParams
+---
---The message type. See {@link MessageType}
---@field type lsp.MessageType
+---
---The actual message.
---@field message string
---The parameters sent in an open text document notification
---@class lsp.DidOpenTextDocumentParams
+---
---The document that was opened.
---@field textDocument lsp.TextDocumentItem
---The change text document notification's parameters.
---@class lsp.DidChangeTextDocumentParams
+---
---The document that did change. The version number points
---to the version after all provided content changes have
---been applied.
---@field textDocument lsp.VersionedTextDocumentIdentifier
+---
---The actual content changes. The content changes describe single state changes
---to the document. So if there are two content changes c1 (at array index 0) and
---c2 (at array index 1) for a document in state S then c1 moves the document from
@@ -732,64 +876,78 @@ error('Cannot require a meta file')
---Describe options to be used when registered for text document change events.
---@class lsp.TextDocumentChangeRegistrationOptions: lsp.TextDocumentRegistrationOptions
+---
---How documents are synced to the server.
---@field syncKind lsp.TextDocumentSyncKind
---The parameters sent in a close text document notification
---@class lsp.DidCloseTextDocumentParams
+---
---The document that was closed.
---@field textDocument lsp.TextDocumentIdentifier
---The parameters sent in a save text document notification
---@class lsp.DidSaveTextDocumentParams
+---
---The document that was saved.
---@field textDocument lsp.TextDocumentIdentifier
+---
---Optional the content when saved. Depends on the includeText value
---when the save notification was requested.
---@field text? string
---Save registration options.
----@class lsp.TextDocumentSaveRegistrationOptions: lsp.TextDocumentRegistrationOptions
+---@class lsp.TextDocumentSaveRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.SaveOptions
---The parameters sent in a will save text document notification.
---@class lsp.WillSaveTextDocumentParams
+---
---The document that will be saved.
---@field textDocument lsp.TextDocumentIdentifier
+---
---The 'TextDocumentSaveReason'.
---@field reason lsp.TextDocumentSaveReason
---A text edit applicable to a text document.
---@class lsp.TextEdit
+---
---The range of the text document to be manipulated. To insert
---text into a document create a range where start === end.
---@field range lsp.Range
+---
---The string to be inserted. For delete operations use an
---empty string.
---@field newText string
---The watched files change notification's parameters.
---@class lsp.DidChangeWatchedFilesParams
+---
---The actual file events.
---@field changes lsp.FileEvent[]
---Describe options to be used when registered for text document change events.
---@class lsp.DidChangeWatchedFilesRegistrationOptions
+---
---The watchers to register.
---@field watchers lsp.FileSystemWatcher[]
---The publish diagnostic notification's parameters.
---@class lsp.PublishDiagnosticsParams
+---
---The URI for which diagnostic information is reported.
---@field uri lsp.DocumentUri
+---
---Optional the version number of the document the diagnostics are published for.
---
---@since 3.15.0
---@field version? integer
+---
---An array of diagnostic information items.
---@field diagnostics lsp.Diagnostic[]
---Completion parameters
---@class lsp.CompletionParams: lsp.TextDocumentPositionParams, lsp.WorkDoneProgressParams, lsp.PartialResultParams
+---
---The completion context. This is only available it the client specifies
---to send this using the client capability `textDocument.completion.contextSupport === true`
---@field context? lsp.CompletionContext
@@ -797,6 +955,7 @@ error('Cannot require a meta file')
---A completion item represents a text snippet that is
---proposed to complete text that is being typed.
---@class lsp.CompletionItem
+---
---The label of this completion item.
---
---The label property is also by default the text that
@@ -805,39 +964,49 @@ error('Cannot require a meta file')
---If label details are provided the label itself should
---be an unqualified name of the completion item.
---@field label string
+---
---Additional details for the label
---
---@since 3.17.0
---@field labelDetails? lsp.CompletionItemLabelDetails
+---
---The kind of this completion item. Based of the kind
---an icon is chosen by the editor.
---@field kind? lsp.CompletionItemKind
+---
---Tags for this completion item.
---
---@since 3.15.0
---@field tags? lsp.CompletionItemTag[]
+---
---A human-readable string with additional information
---about this item, like type or symbol information.
---@field detail? string
+---
---A human-readable string that represents a doc-comment.
---@field documentation? string|lsp.MarkupContent
+---
---Indicates if this item is deprecated.
---@deprecated Use `tags` instead.
---@field deprecated? boolean
+---
---Select this item when showing.
---
---*Note* that only one completion item can be selected and that the
---tool / client decides which item that is. The rule is that the *first*
---item of those that match best is selected.
---@field preselect? boolean
+---
---A string that should be used when comparing this item
---with other items. When `falsy` the {@link CompletionItem.label label}
---is used.
---@field sortText? string
+---
---A string that should be used when filtering a set of
---completion items. When `falsy` the {@link CompletionItem.label label}
---is used.
---@field filterText? string
+---
---A string that should be inserted into a document when selecting
---this completion. When `falsy` the {@link CompletionItem.label label}
---is used.
@@ -850,6 +1019,7 @@ error('Cannot require a meta file')
---recommended to use `textEdit` instead since it avoids additional client
---side interpretation.
---@field insertText? string
+---
---The format of the insert text. The format applies to both the
---`insertText` property and the `newText` property of a provided
---`textEdit`. If omitted defaults to `InsertTextFormat.PlainText`.
@@ -857,12 +1027,14 @@ error('Cannot require a meta file')
---Please note that the insertTextFormat doesn't apply to
---`additionalTextEdits`.
---@field insertTextFormat? lsp.InsertTextFormat
+---
---How whitespace and indentation is handled during completion
---item insertion. If not provided the clients default value depends on
---the `textDocument.completion.insertTextMode` client capability.
---
---@since 3.16.0
---@field insertTextMode? lsp.InsertTextMode
+---
---An {@link TextEdit edit} which is applied to a document when selecting
---this completion. When an edit is provided the value of
---{@link CompletionItem.insertText insertText} is ignored.
@@ -884,6 +1056,7 @@ error('Cannot require a meta file')
---
---@since 3.16.0 additional type `InsertReplaceEdit`
---@field textEdit? lsp.TextEdit|lsp.InsertReplaceEdit
+---
---The edit text used if the completion item is part of a CompletionList and
---CompletionList defines an item default for the text edit range.
---
@@ -895,6 +1068,7 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@field textEditText? string
+---
---An optional array of additional {@link TextEdit text edits} that are applied when
---selecting this completion. Edits must not overlap (including the same insert position)
---with the main {@link CompletionItem.textEdit edit} nor with themselves.
@@ -903,14 +1077,17 @@ error('Cannot require a meta file')
---(for example adding an import statement at the top of the file if the completion item will
---insert an unqualified type).
---@field additionalTextEdits? lsp.TextEdit[]
+---
---An optional set of characters that when pressed while this completion is active will accept it first and
---then type that character. *Note* that all commit characters should have `length=1` and that superfluous
---characters will be ignored.
---@field commitCharacters? string[]
+---
---An optional {@link Command command} that is executed *after* inserting this completion. *Note* that
---additional modifications to the current document should be described with the
---{@link CompletionItem.additionalTextEdits additionalTextEdits}-property.
---@field command? lsp.Command
+---
---A data entry field that is preserved on a completion item between a
---{@link CompletionRequest} and a {@link CompletionResolveRequest}.
---@field data? lsp.LSPAny
@@ -918,11 +1095,13 @@ error('Cannot require a meta file')
---Represents a collection of {@link CompletionItem completion items} to be presented
---in the editor.
---@class lsp.CompletionList
+---
---This list it not complete. Further typing results in recomputing this list.
---
---Recomputed lists have all their items replaced (not appended) in the
---incomplete completion sessions.
---@field isIncomplete boolean
+---
---In many cases the items of an actual completion result share the same
---value for properties like `commitCharacters` or the range of a text
---edit. A completion list can therefore define item defaults which will
@@ -936,29 +1115,33 @@ error('Cannot require a meta file')
---capability.
---
---@since 3.17.0
----@field itemDefaults? anonym3
+---@field itemDefaults? lsp._anonym2.itemDefaults
+---
---The completion items.
---@field items lsp.CompletionItem[]
---Registration options for a {@link CompletionRequest}.
----@class lsp.CompletionRegistrationOptions: lsp.TextDocumentRegistrationOptions
+---@class lsp.CompletionRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.CompletionOptions
---Parameters for a {@link HoverRequest}.
---@class lsp.HoverParams: lsp.TextDocumentPositionParams, lsp.WorkDoneProgressParams
---The result of a hover request.
---@class lsp.Hover
+---
---The hover's content
---@field contents lsp.MarkupContent|lsp.MarkedString|lsp.MarkedString[]
+---
---An optional range inside the text document that is used to
---visualize the hover, e.g. by changing the background color.
---@field range? lsp.Range
---Registration options for a {@link HoverRequest}.
----@class lsp.HoverRegistrationOptions: lsp.TextDocumentRegistrationOptions
+---@class lsp.HoverRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.HoverOptions
---Parameters for a {@link SignatureHelpRequest}.
---@class lsp.SignatureHelpParams: lsp.TextDocumentPositionParams, lsp.WorkDoneProgressParams
+---
---The signature help context. This is only available if the client specifies
---to send this using the client capability `textDocument.signatureHelp.contextSupport === true`
---
@@ -969,8 +1152,10 @@ error('Cannot require a meta file')
---callable. There can be multiple signature but only one
---active and only one active parameter.
---@class lsp.SignatureHelp
+---
---One or more signatures.
---@field signatures lsp.SignatureInformation[]
+---
---The active signature. If omitted or the value lies outside the
---range of `signatures` the value defaults to zero or is ignored if
---the `SignatureHelp` has no signatures.
@@ -981,30 +1166,41 @@ error('Cannot require a meta file')
---In future version of the protocol this property might become
---mandatory to better express this.
---@field activeSignature? uinteger
----The active parameter of the active signature. If omitted or the value
----lies outside the range of `signatures[activeSignature].parameters`
----defaults to 0 if the active signature has parameters. If
----the active signature has no parameters it is ignored.
+---
+---The active parameter of the active signature.
+---
+---If `null`, no parameter of the signature is active (for example a named
+---argument that does not match any declared parameters). This is only valid
+---since 3.18.0 and if the client specifies the client capability
+---`textDocument.signatureHelp.noActiveParameterSupport === true`
+---
+---If omitted or the value lies outside the range of
+---`signatures[activeSignature].parameters` defaults to 0 if the active
+---signature has parameters.
+---
+---If the active signature has no parameters it is ignored.
+---
---In future version of the protocol this property might become
----mandatory to better express the active parameter if the
----active signature does have any.
----@field activeParameter? uinteger
+---mandatory (but still nullable) to better express the active parameter if
+---the active signature does have any.
+---@field activeParameter? uinteger|lsp.null
---Registration options for a {@link SignatureHelpRequest}.
----@class lsp.SignatureHelpRegistrationOptions: lsp.TextDocumentRegistrationOptions
+---@class lsp.SignatureHelpRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.SignatureHelpOptions
---Parameters for a {@link DefinitionRequest}.
---@class lsp.DefinitionParams: lsp.TextDocumentPositionParams, lsp.WorkDoneProgressParams, lsp.PartialResultParams
---Registration options for a {@link DefinitionRequest}.
----@class lsp.DefinitionRegistrationOptions: lsp.TextDocumentRegistrationOptions
+---@class lsp.DefinitionRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.DefinitionOptions
---Parameters for a {@link ReferencesRequest}.
---@class lsp.ReferenceParams: lsp.TextDocumentPositionParams, lsp.WorkDoneProgressParams, lsp.PartialResultParams
+---
---@field context lsp.ReferenceContext
---Registration options for a {@link ReferencesRequest}.
----@class lsp.ReferenceRegistrationOptions: lsp.TextDocumentRegistrationOptions
+---@class lsp.ReferenceRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.ReferenceOptions
---Parameters for a {@link DocumentHighlightRequest}.
---@class lsp.DocumentHighlightParams: lsp.TextDocumentPositionParams, lsp.WorkDoneProgressParams, lsp.PartialResultParams
@@ -1013,26 +1209,31 @@ error('Cannot require a meta file')
---special attention. Usually a document highlight is visualized by changing
---the background color of its range.
---@class lsp.DocumentHighlight
+---
---The range this highlight applies to.
---@field range lsp.Range
+---
---The highlight kind, default is {@link DocumentHighlightKind.Text text}.
---@field kind? lsp.DocumentHighlightKind
---Registration options for a {@link DocumentHighlightRequest}.
----@class lsp.DocumentHighlightRegistrationOptions: lsp.TextDocumentRegistrationOptions
+---@class lsp.DocumentHighlightRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.DocumentHighlightOptions
---Parameters for a {@link DocumentSymbolRequest}.
----@class lsp.DocumentSymbolParams
+---@class lsp.DocumentSymbolParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams
+---
---The text document.
---@field textDocument lsp.TextDocumentIdentifier
---Represents information about programming constructs like variables, classes,
---interfaces etc.
---@class lsp.SymbolInformation: lsp.BaseSymbolInformation
+---
---Indicates if this symbol is deprecated.
---
---@deprecated Use tags instead
---@field deprecated? boolean
+---
---The location of this symbol. The location's range is used by a tool
---to reveal the location in the editor. If the symbol is selected in the
---tool the range's start information is used to position the cursor. So
@@ -1049,40 +1250,51 @@ error('Cannot require a meta file')
---have two ranges: one that encloses its definition and one that points to
---its most interesting range, e.g. the range of an identifier.
---@class lsp.DocumentSymbol
+---
---The name of this symbol. Will be displayed in the user interface and therefore must not be
---an empty string or a string only consisting of white spaces.
---@field name string
+---
---More detail for this symbol, e.g the signature of a function.
---@field detail? string
+---
---The kind of this symbol.
---@field kind lsp.SymbolKind
+---
---Tags for this document symbol.
---
---@since 3.16.0
---@field tags? lsp.SymbolTag[]
+---
---Indicates if this symbol is deprecated.
---
---@deprecated Use tags instead
---@field deprecated? boolean
+---
---The range enclosing this symbol not including leading/trailing whitespace but everything else
---like comments. This information is typically used to determine if the clients cursor is
---inside the symbol to reveal in the symbol in the UI.
---@field range lsp.Range
+---
---The range that should be selected and revealed when this symbol is being picked, e.g the name of a function.
---Must be contained by the `range`.
---@field selectionRange lsp.Range
+---
---Children of this symbol, e.g. properties of a class.
---@field children? lsp.DocumentSymbol[]
---Registration options for a {@link DocumentSymbolRequest}.
----@class lsp.DocumentSymbolRegistrationOptions: lsp.TextDocumentRegistrationOptions
+---@class lsp.DocumentSymbolRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.DocumentSymbolOptions
---The parameters of a {@link CodeActionRequest}.
----@class lsp.CodeActionParams
+---@class lsp.CodeActionParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams
+---
---The document in which the command was invoked.
---@field textDocument lsp.TextDocumentIdentifier
+---
---The range for which the command was invoked.
---@field range lsp.Range
+---
---Context carrying additional information.
---@field context lsp.CodeActionContext
@@ -1091,10 +1303,13 @@ error('Cannot require a meta file')
---an array of arguments which will be passed to the command handler
---function when invoked.
---@class lsp.Command
+---
---Title of the command, like `save`.
---@field title string
+---
---The identifier of the actual command handler.
---@field command string
+---
---Arguments that the command handler should be
---invoked with.
---@field arguments? lsp.LSPAny[]
@@ -1104,14 +1319,18 @@ error('Cannot require a meta file')
---
---A CodeAction must set either `edit` and/or a `command`. If both are supplied, the `edit` is applied first, then the `command` is executed.
---@class lsp.CodeAction
+---
---A short, human-readable, title for this code action.
---@field title string
+---
---The kind of the code action.
---
---Used to filter code actions.
---@field kind? lsp.CodeActionKind
+---
---The diagnostics that this code action resolves.
---@field diagnostics? lsp.Diagnostic[]
+---
---Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted
---by keybindings.
---
@@ -1120,6 +1339,7 @@ error('Cannot require a meta file')
---
---@since 3.15.0
---@field isPreferred? boolean
+---
---Marks that the code action cannot currently be applied.
---
---Clients should follow the following guidelines regarding disabled code actions:
@@ -1135,13 +1355,16 @@ error('Cannot require a meta file')
--- error message with `reason` in the editor.
---
---@since 3.16.0
----@field disabled? anonym4
+---@field disabled? lsp._anonym4.disabled
+---
---The workspace edit this code action performs.
---@field edit? lsp.WorkspaceEdit
+---
---A command this code action executes. If a code action
---provides an edit and a command, first the edit is
---executed and then the command.
---@field command? lsp.Command
+---
---A data entry field that is preserved on a code action between
---a `textDocument/codeAction` and a `codeAction/resolve` request.
---
@@ -1149,10 +1372,11 @@ error('Cannot require a meta file')
---@field data? lsp.LSPAny
---Registration options for a {@link CodeActionRequest}.
----@class lsp.CodeActionRegistrationOptions: lsp.TextDocumentRegistrationOptions
+---@class lsp.CodeActionRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.CodeActionOptions
---The parameters of a {@link WorkspaceSymbolRequest}.
----@class lsp.WorkspaceSymbolParams
+---@class lsp.WorkspaceSymbolParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams
+---
---A query string to filter symbols by. Clients may send an empty
---string here to request all symbols.
---@field query string
@@ -1163,12 +1387,14 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.WorkspaceSymbol: lsp.BaseSymbolInformation
+---
---The location of the symbol. Whether a server is allowed to
---return a location without a range depends on the client
---capability `workspace.symbol.resolveSupport`.
---
---See SymbolInformation#location for more details.
----@field location lsp.Location|anonym5
+---@field location lsp.Location|lsp._anonym5.location
+---
---A data entry field that is preserved on a workspace symbol between a
---workspace symbol request and a workspace symbol resolve request.
---@field data? lsp.LSPAny
@@ -1177,7 +1403,8 @@ error('Cannot require a meta file')
---@class lsp.WorkspaceSymbolRegistrationOptions: lsp.WorkspaceSymbolOptions
---The parameters of a {@link CodeLensRequest}.
----@class lsp.CodeLensParams
+---@class lsp.CodeLensParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams
+---
---The document to request code lens for.
---@field textDocument lsp.TextDocumentIdentifier
@@ -1187,30 +1414,36 @@ error('Cannot require a meta file')
---A code lens is _unresolved_ when no command is associated to it. For performance
---reasons the creation of a code lens and resolving should be done in two stages.
---@class lsp.CodeLens
+---
---The range in which this code lens is valid. Should only span a single line.
---@field range lsp.Range
+---
---The command this code lens represents.
---@field command? lsp.Command
+---
---A data entry field that is preserved on a code lens item between
----a {@link CodeLensRequest} and a [CodeLensResolveRequest]
----(#CodeLensResolveRequest)
+---a {@link CodeLensRequest} and a {@link CodeLensResolveRequest}
---@field data? lsp.LSPAny
---Registration options for a {@link CodeLensRequest}.
----@class lsp.CodeLensRegistrationOptions: lsp.TextDocumentRegistrationOptions
+---@class lsp.CodeLensRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.CodeLensOptions
---The parameters of a {@link DocumentLinkRequest}.
----@class lsp.DocumentLinkParams
+---@class lsp.DocumentLinkParams: lsp.WorkDoneProgressParams, lsp.PartialResultParams
+---
---The document to provide document links for.
---@field textDocument lsp.TextDocumentIdentifier
---A document link is a range in a text document that links to an internal or external resource, like another
---text document or a web site.
---@class lsp.DocumentLink
+---
---The range this link applies to.
---@field range lsp.Range
+---
---The uri this link points to. If missing a resolve request is sent later.
---@field target? lsp.URI
+---
---The tooltip text when you hover over this link.
---
---If a tooltip is provided, is will be displayed in a string that includes instructions on how to
@@ -1219,86 +1452,104 @@ error('Cannot require a meta file')
---
---@since 3.15.0
---@field tooltip? string
+---
---A data entry field that is preserved on a document link between a
---DocumentLinkRequest and a DocumentLinkResolveRequest.
---@field data? lsp.LSPAny
---Registration options for a {@link DocumentLinkRequest}.
----@class lsp.DocumentLinkRegistrationOptions: lsp.TextDocumentRegistrationOptions
+---@class lsp.DocumentLinkRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.DocumentLinkOptions
---The parameters of a {@link DocumentFormattingRequest}.
----@class lsp.DocumentFormattingParams
+---@class lsp.DocumentFormattingParams: lsp.WorkDoneProgressParams
+---
---The document to format.
---@field textDocument lsp.TextDocumentIdentifier
+---
---The format options.
---@field options lsp.FormattingOptions
---Registration options for a {@link DocumentFormattingRequest}.
----@class lsp.DocumentFormattingRegistrationOptions: lsp.TextDocumentRegistrationOptions
+---@class lsp.DocumentFormattingRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.DocumentFormattingOptions
---The parameters of a {@link DocumentRangeFormattingRequest}.
----@class lsp.DocumentRangeFormattingParams
+---@class lsp.DocumentRangeFormattingParams: lsp.WorkDoneProgressParams
+---
---The document to format.
---@field textDocument lsp.TextDocumentIdentifier
+---
---The range to format
---@field range lsp.Range
+---
---The format options
---@field options lsp.FormattingOptions
---Registration options for a {@link DocumentRangeFormattingRequest}.
----@class lsp.DocumentRangeFormattingRegistrationOptions: lsp.TextDocumentRegistrationOptions
+---@class lsp.DocumentRangeFormattingRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.DocumentRangeFormattingOptions
---The parameters of a {@link DocumentRangesFormattingRequest}.
---
---@since 3.18.0
---@proposed
----@class lsp.DocumentRangesFormattingParams
+---@class lsp.DocumentRangesFormattingParams: lsp.WorkDoneProgressParams
+---
---The document to format.
---@field textDocument lsp.TextDocumentIdentifier
+---
---The ranges to format
---@field ranges lsp.Range[]
+---
---The format options
---@field options lsp.FormattingOptions
---The parameters of a {@link DocumentOnTypeFormattingRequest}.
---@class lsp.DocumentOnTypeFormattingParams
+---
---The document to format.
---@field textDocument lsp.TextDocumentIdentifier
+---
---The position around which the on type formatting should happen.
---This is not necessarily the exact position where the character denoted
---by the property `ch` got typed.
---@field position lsp.Position
+---
---The character that has been typed that triggered the formatting
---on type request. That is not necessarily the last character that
---got inserted into the document since the client could auto insert
---characters as well (e.g. like automatic brace completion).
---@field ch string
+---
---The formatting options.
---@field options lsp.FormattingOptions
---Registration options for a {@link DocumentOnTypeFormattingRequest}.
----@class lsp.DocumentOnTypeFormattingRegistrationOptions: lsp.TextDocumentRegistrationOptions
+---@class lsp.DocumentOnTypeFormattingRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.DocumentOnTypeFormattingOptions
---The parameters of a {@link RenameRequest}.
----@class lsp.RenameParams
+---@class lsp.RenameParams: lsp.WorkDoneProgressParams
+---
---The document to rename.
---@field textDocument lsp.TextDocumentIdentifier
+---
---The position at which this request was sent.
---@field position lsp.Position
+---
---The new name of the symbol. If the given name is not valid the
---request must return a {@link ResponseError} with an
---appropriate message set.
---@field newName string
---Registration options for a {@link RenameRequest}.
----@class lsp.RenameRegistrationOptions: lsp.TextDocumentRegistrationOptions
+---@class lsp.RenameRegistrationOptions: lsp.TextDocumentRegistrationOptions, lsp.RenameOptions
---@class lsp.PrepareRenameParams: lsp.TextDocumentPositionParams, lsp.WorkDoneProgressParams
---The parameters of a {@link ExecuteCommandRequest}.
----@class lsp.ExecuteCommandParams
+---@class lsp.ExecuteCommandParams: lsp.WorkDoneProgressParams
+---
---The identifier of the actual command handler.
---@field command string
+---
---Arguments that the command should be invoked with.
---@field arguments? lsp.LSPAny[]
@@ -1307,10 +1558,12 @@ error('Cannot require a meta file')
---The parameters passed via an apply workspace edit request.
---@class lsp.ApplyWorkspaceEditParams
+---
---An optional label of the workspace edit. This label is
---presented in the user interface for example on an undo
---stack to undo the workspace edit.
---@field label? string
+---
---The edits to apply.
---@field edit lsp.WorkspaceEdit
@@ -1318,34 +1571,42 @@ error('Cannot require a meta file')
---
---@since 3.17 renamed from ApplyWorkspaceEditResponse
---@class lsp.ApplyWorkspaceEditResult
+---
---Indicates whether the edit was applied or not.
---@field applied boolean
+---
---An optional textual description for why the edit was not applied.
---This may be used by the server for diagnostic logging or to provide
---a suitable error for a request that triggered the edit.
---@field failureReason? string
+---
---Depending on the client's failure handling strategy `failedChange` might
---contain the index of the change that failed. This property is only available
---if the client signals a `failureHandlingStrategy` in its client capabilities.
---@field failedChange? uinteger
---@class lsp.WorkDoneProgressBegin
+---
---@field kind "begin"
+---
---Mandatory title of the progress operation. Used to briefly inform about
---the kind of operation being performed.
---
---Examples: "Indexing" or "Linking dependencies".
---@field title string
+---
---Controls if a cancel button should show to allow the user to cancel the
---long running operation. Clients that don't support cancellation are allowed
---to ignore the setting.
---@field cancellable? boolean
+---
---Optional, more detailed associated progress message. Contains
---complementary information to the `title`.
---
---Examples: "3/25 files", "project/src/module2", "node_modules/some_dep".
---If unset, the previous progress message (if any) is still valid.
---@field message? string
+---
---Optional progress percentage to display (value 100 is considered 100%).
---If not provided infinite progress is assumed and clients are allowed
---to ignore the `percentage` value in subsequent in report notifications.
@@ -1355,18 +1616,22 @@ error('Cannot require a meta file')
---@field percentage? uinteger
---@class lsp.WorkDoneProgressReport
+---
---@field kind "report"
+---
---Controls enablement state of a cancel button.
---
---Clients that don't support cancellation or don't support controlling the button's
---enablement state are allowed to ignore the property.
---@field cancellable? boolean
+---
---Optional, more detailed associated progress message. Contains
---complementary information to the `title`.
---
---Examples: "3/25 files", "project/src/module2", "node_modules/some_dep".
---If unset, the previous progress message (if any) is still valid.
---@field message? string
+---
---Optional progress percentage to display (value 100 is considered 100%).
---If not provided infinite progress is assumed and clients are allowed
---to ignore the `percentage` value in subsequent in report notifications.
@@ -1376,41 +1641,53 @@ error('Cannot require a meta file')
---@field percentage? uinteger
---@class lsp.WorkDoneProgressEnd
+---
---@field kind "end"
+---
---Optional, a final message indicating to for example indicate the outcome
---of the operation.
---@field message? string
---@class lsp.SetTraceParams
+---
---@field value lsp.TraceValues
---@class lsp.LogTraceParams
+---
---@field message string
+---
---@field verbose? string
---@class lsp.CancelParams
+---
---The request id to cancel.
---@field id integer|string
---@class lsp.ProgressParams
+---
---The progress token provided by the client or server.
---@field token lsp.ProgressToken
+---
---The progress data.
---@field value lsp.LSPAny
---A parameter literal used in requests to pass a text document and a position inside that
---document.
---@class lsp.TextDocumentPositionParams
+---
---The text document.
---@field textDocument lsp.TextDocumentIdentifier
+---
---The position inside the text document.
---@field position lsp.Position
---@class lsp.WorkDoneProgressParams
+---
---An optional token that a server can use to report work done progress.
---@field workDoneToken? lsp.ProgressToken
---@class lsp.PartialResultParams
+---
---An optional token that a server can use to report partial results (e.g. streaming) to
---the client.
---@field partialResultToken? lsp.ProgressToken
@@ -1418,17 +1695,21 @@ error('Cannot require a meta file')
---Represents the connection of two locations. Provides additional metadata over normal {@link Location locations},
---including an origin range.
---@class lsp.LocationLink
+---
---Span of the origin of this link.
---
---Used as the underlined span for mouse interaction. Defaults to the word range at
---the definition position.
---@field originSelectionRange? lsp.Range
+---
---The target resource identifier of this link.
---@field targetUri lsp.DocumentUri
+---
---The full target range of this link. If the target for example is a symbol then target range is the
---range enclosing this symbol not including leading/trailing whitespace but everything else
---like comments. This information is typically used to highlight the range in the editor.
---@field targetRange lsp.Range
+---
---The range that should be selected and revealed when this link is being followed, e.g the name of a function.
---Must be contained by the `targetRange`. See also `DocumentSymbol#range`
---@field targetSelectionRange lsp.Range
@@ -1445,56 +1726,68 @@ error('Cannot require a meta file')
---}
---```
---@class lsp.Range
+---
---The range's start position.
---@field start lsp.Position
+---
---The range's end position.
---@field end lsp.Position
----@class lsp.ImplementationOptions
+---@class lsp.ImplementationOptions: lsp.WorkDoneProgressOptions
---Static registration options to be returned in the initialize
---request.
---@class lsp.StaticRegistrationOptions
+---
---The id used to register the request. The id can be used to deregister
---the request again. See also Registration#id.
---@field id? string
----@class lsp.TypeDefinitionOptions
+---@class lsp.TypeDefinitionOptions: lsp.WorkDoneProgressOptions
---The workspace folder change event.
---@class lsp.WorkspaceFoldersChangeEvent
+---
---The array of added workspace folders
---@field added lsp.WorkspaceFolder[]
+---
---The array of the removed workspace folders
---@field removed lsp.WorkspaceFolder[]
---@class lsp.ConfigurationItem
+---
---The scope to get the configuration section for.
----@field scopeUri? string
+---@field scopeUri? lsp.URI
+---
---The configuration section asked for.
---@field section? string
---A literal to identify a text document in the client.
---@class lsp.TextDocumentIdentifier
+---
---The text document's uri.
---@field uri lsp.DocumentUri
---Represents a color in RGBA space.
---@class lsp.Color
+---
---The red component of this color in the range [0-1].
---@field red decimal
+---
---The green component of this color in the range [0-1].
---@field green decimal
+---
---The blue component of this color in the range [0-1].
---@field blue decimal
+---
---The alpha component of this color in the range [0-1].
---@field alpha decimal
----@class lsp.DocumentColorOptions
+---@class lsp.DocumentColorOptions: lsp.WorkDoneProgressOptions
----@class lsp.FoldingRangeOptions
+---@class lsp.FoldingRangeOptions: lsp.WorkDoneProgressOptions
----@class lsp.DeclarationOptions
+---@class lsp.DeclarationOptions: lsp.WorkDoneProgressOptions
---Position in a text document expressed as zero-based line and character
---offset. Prior to 3.17 the offsets were always based on a UTF-16 string
@@ -1503,14 +1796,14 @@ error('Cannot require a meta file')
---offset of b is 3 since `𐐀` is represented using two code units in UTF-16.
---Since 3.17 clients and servers can agree on a different string encoding
---representation (e.g. UTF-8). The client announces it's supported encoding
----via the client capability [`general.positionEncodings`](#clientCapabilities).
+---via the client capability [`general.positionEncodings`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#clientCapabilities).
---The value is an array of position encodings the client supports, with
---decreasing preference (e.g. the encoding at index `0` is the most preferred
---one). To stay backwards compatible the only mandatory encoding is UTF-16
---represented via the string `utf-16`. The server can pick one of the
---encodings offered by the client and signals that encoding back to the
---client via the initialize result's property
----[`capabilities.positionEncoding`](#serverCapabilities). If the string value
+---[`capabilities.positionEncoding`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#serverCapabilities). If the string value
---`utf-16` is missing from the client's capability `general.positionEncodings`
---servers can safely assume that the client supports UTF-16. If the server
---omits the position encoding in its initialize result the encoding defaults
@@ -1524,11 +1817,13 @@ error('Cannot require a meta file')
---
---@since 3.17.0 - support for negotiated position encoding.
---@class lsp.Position
+---
---Line position in a document (zero-based).
---
---If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document.
---If a line number is negative, it defaults to 0.
---@field line uinteger
+---
---Character offset on a line in a document (zero-based).
---
---The meaning of this offset is determined by the negotiated
@@ -1538,38 +1833,45 @@ error('Cannot require a meta file')
---line length.
---@field character uinteger
----@class lsp.SelectionRangeOptions
+---@class lsp.SelectionRangeOptions: lsp.WorkDoneProgressOptions
---Call hierarchy options used during static registration.
---
---@since 3.16.0
----@class lsp.CallHierarchyOptions
+---@class lsp.CallHierarchyOptions: lsp.WorkDoneProgressOptions
---@since 3.16.0
----@class lsp.SemanticTokensOptions
+---@class lsp.SemanticTokensOptions: lsp.WorkDoneProgressOptions
+---
---The legend used by the server
---@field legend lsp.SemanticTokensLegend
+---
---Server supports providing semantic tokens for a specific range
---of a document.
----@field range? boolean|anonym6
+---@field range? boolean|lsp._anonym6.range
+---
---Server supports providing semantic tokens for a full document.
----@field full? boolean|anonym7
+---@field full? boolean|lsp._anonym7.full
---@since 3.16.0
---@class lsp.SemanticTokensEdit
+---
---The start offset of the edit.
---@field start uinteger
+---
---The count of elements to remove.
---@field deleteCount uinteger
+---
---The elements to insert.
---@field data? uinteger[]
----@class lsp.LinkedEditingRangeOptions
+---@class lsp.LinkedEditingRangeOptions: lsp.WorkDoneProgressOptions
---Represents information on a file/folder create.
---
---@since 3.16.0
---@class lsp.FileCreate
+---
---A file:// URI for the location of the file/folder being created.
---@field uri string
@@ -1578,40 +1880,52 @@ error('Cannot require a meta file')
---So the creator of a TextDocumentEdit doesn't need to sort the array of edits or do any
---kind of ordering. However the edits must be non overlapping.
---@class lsp.TextDocumentEdit
+---
---The text document to change.
---@field textDocument lsp.OptionalVersionedTextDocumentIdentifier
+---
---The edits to be applied.
---
---@since 3.16.0 - support for AnnotatedTextEdit. This is guarded using a
---client capability.
----@field edits lsp.TextEdit|lsp.AnnotatedTextEdit[]
+---@field edits (lsp.TextEdit|lsp.AnnotatedTextEdit)[]
---Create file operation.
---@class lsp.CreateFile: lsp.ResourceOperation
+---
---A create
---@field kind "create"
+---
---The resource to create.
---@field uri lsp.DocumentUri
+---
---Additional options
---@field options? lsp.CreateFileOptions
---Rename file operation
---@class lsp.RenameFile: lsp.ResourceOperation
+---
---A rename
---@field kind "rename"
+---
---The old (existing) location.
---@field oldUri lsp.DocumentUri
+---
---The new location.
---@field newUri lsp.DocumentUri
+---
---Rename options.
---@field options? lsp.RenameFileOptions
---Delete file operation
---@class lsp.DeleteFile: lsp.ResourceOperation
+---
---A delete
---@field kind "delete"
+---
---The file to delete.
---@field uri lsp.DocumentUri
+---
---Delete options.
---@field options? lsp.DeleteFileOptions
@@ -1619,12 +1933,15 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@class lsp.ChangeAnnotation
+---
---A human-readable string describing the actual change. The string
---is rendered prominent in the user interface.
---@field label string
+---
---A flag which indicates that user confirmation is needed
---before applying the change.
---@field needsConfirmation? boolean
+---
---A human-readable string which is rendered less prominent in
---the user interface.
---@field description? string
@@ -1634,8 +1951,10 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@class lsp.FileOperationFilter
+---
---A Uri scheme like `file` or `untitled`.
---@field scheme? string
+---
---The actual file operation pattern.
---@field pattern lsp.FileOperationPattern
@@ -1643,8 +1962,10 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@class lsp.FileRename
+---
---A file:// URI for the original location of the file/folder being renamed.
---@field oldUri string
+---
---A file:// URI for the new location of the file/folder being renamed.
---@field newUri string
@@ -1652,20 +1973,23 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@class lsp.FileDelete
+---
---A file:// URI for the location of the file/folder being deleted.
---@field uri string
----@class lsp.MonikerOptions
+---@class lsp.MonikerOptions: lsp.WorkDoneProgressOptions
---Type hierarchy options used during static registration.
---
---@since 3.17.0
----@class lsp.TypeHierarchyOptions
+---@class lsp.TypeHierarchyOptions: lsp.WorkDoneProgressOptions
---@since 3.17.0
---@class lsp.InlineValueContext
+---
---The stack frame (as a DAP Id) where the execution has stopped.
---@field frameId integer
+---
---The document range where execution has stopped.
---Typically the end position of the range denotes the line where the inline values are shown.
---@field stoppedLocation lsp.Range
@@ -1674,8 +1998,10 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.InlineValueText
+---
---The document range for which the inline value applies.
---@field range lsp.Range
+---
---The text of the inline value.
---@field text string
@@ -1685,11 +2011,14 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.InlineValueVariableLookup
+---
---The document range for which the inline value applies.
---The range is used to extract the variable name from the underlying document.
---@field range lsp.Range
+---
---If specified the name of the variable to look up.
---@field variableName? string
+---
---How to perform the lookup.
---@field caseSensitiveLookup boolean
@@ -1699,28 +2028,33 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.InlineValueEvaluatableExpression
+---
---The document range for which the inline value applies.
---The range is used to extract the evaluatable expression from the underlying document.
---@field range lsp.Range
+---
---If specified the expression overrides the extracted expression.
---@field expression? string
---Inline value options used during static registration.
---
---@since 3.17.0
----@class lsp.InlineValueOptions
+---@class lsp.InlineValueOptions: lsp.WorkDoneProgressOptions
---An inlay hint label part allows for interactive and composite labels
---of inlay hints.
---
---@since 3.17.0
---@class lsp.InlayHintLabelPart
+---
---The value of this label part.
---@field value string
+---
---The tooltip text when you hover over this label part. Depending on
---the client capability `inlayHint.resolveSupport` clients might resolve
---this property late using the resolve request.
---@field tooltip? string|lsp.MarkupContent
+---
---An optional source code location that represents this
---label part.
---
@@ -1733,6 +2067,7 @@ error('Cannot require a meta file')
---Depending on the client capability `inlayHint.resolveSupport` clients
---might resolve this property late using the resolve request.
---@field location? lsp.Location
+---
---An optional command for this label part.
---
---Depending on the client capability `inlayHint.resolveSupport` clients
@@ -1762,15 +2097,18 @@ error('Cannot require a meta file')
---*Please Note* that clients might sanitize the return markdown. A client could decide to
---remove HTML from the markdown to avoid script execution.
---@class lsp.MarkupContent
+---
---The type of the Markup
---@field kind lsp.MarkupKind
+---
---The content itself
---@field value string
---Inlay hint options used during static registration.
---
---@since 3.17.0
----@class lsp.InlayHintOptions
+---@class lsp.InlayHintOptions: lsp.WorkDoneProgressOptions
+---
---The server provides support to resolve additional
---information for an inlay hint item.
---@field resolveProvider? boolean
@@ -1779,6 +2117,7 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.RelatedFullDocumentDiagnosticReport: lsp.FullDocumentDiagnosticReport
+---
---Diagnostics of related documents. This information is useful
---in programming languages where code in a file A can generate
---diagnostics in a file B which A depends on. An example of
@@ -1792,6 +2131,7 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.RelatedUnchangedDocumentDiagnosticReport: lsp.UnchangedDocumentDiagnosticReport
+---
---Diagnostics of related documents. This information is useful
---in programming languages where code in a file A can generate
---diagnostics in a file B which A depends on. An example of
@@ -1805,12 +2145,15 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.FullDocumentDiagnosticReport
+---
---A full document diagnostic report.
---@field kind "full"
+---
---An optional result id. If provided it will
---be sent on the next diagnostic request for the
---same document.
---@field resultId? string
+---
---The actual items.
---@field items lsp.Diagnostic[]
@@ -1819,11 +2162,13 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.UnchangedDocumentDiagnosticReport
+---
---A document diagnostic report indicating
---no changes to the last result. A server can
---only return `unchanged` if result ids are
---provided.
---@field kind "unchanged"
+---
---A result id which will be sent on the next
---diagnostic request for the same document.
---@field resultId string
@@ -1831,15 +2176,18 @@ error('Cannot require a meta file')
---Diagnostic options.
---
---@since 3.17.0
----@class lsp.DiagnosticOptions
+---@class lsp.DiagnosticOptions: lsp.WorkDoneProgressOptions
+---
---An optional identifier under which the diagnostics are
---managed by the client.
---@field identifier? string
+---
---Whether the language has inter file dependencies meaning that
---editing code in one file can result in a different diagnostic
---set in another file. Inter file dependencies are common for
---most programming languages and typically uncommon for linters.
---@field interFileDependencies boolean
+---
---The server provides support for workspace diagnostics as well.
---@field workspaceDiagnostics boolean
@@ -1847,9 +2195,11 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.PreviousResultId
+---
---The URI for which the client knowns a
---result id.
---@field uri lsp.DocumentUri
+---
---The value of the previous result id.
---@field value string
@@ -1857,31 +2207,40 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.NotebookDocument
+---
---The notebook document's uri.
---@field uri lsp.URI
+---
---The type of the notebook.
---@field notebookType string
+---
---The version number of this document (it will increase after each
---change, including undo/redo).
---@field version integer
+---
---Additional metadata stored with the notebook
---document.
---
---Note: should always be an object literal (e.g. LSPObject)
---@field metadata? lsp.LSPObject
+---
---The cells of a notebook.
---@field cells lsp.NotebookCell[]
---An item to transfer a text document from the client to the
---server.
---@class lsp.TextDocumentItem
+---
---The text document's uri.
---@field uri lsp.DocumentUri
+---
---The text document's language identifier.
---@field languageId string
+---
---The version number of this document (it will increase after each
---change, including undo/redo).
---@field version integer
+---
---The content of the opened text document.
---@field text string
@@ -1889,8 +2248,10 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.VersionedNotebookDocumentIdentifier
+---
---The version number of this notebook document.
---@field version integer
+---
---The notebook document's uri.
---@field uri lsp.URI
@@ -1898,64 +2259,97 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.NotebookDocumentChangeEvent
+---
---The changed meta data if any.
---
---Note: should always be an object literal (e.g. LSPObject)
---@field metadata? lsp.LSPObject
+---
---Changes to cells
----@field cells? anonym10
+---@field cells? lsp._anonym8.cells
---A literal to identify a notebook document in the client.
---
---@since 3.17.0
---@class lsp.NotebookDocumentIdentifier
+---
---The notebook document's uri.
---@field uri lsp.URI
---Provides information about the context in which an inline completion was requested.
---
---@since 3.18.0
+---@proposed
---@class lsp.InlineCompletionContext
+---
---Describes how the inline completion was triggered.
---@field triggerKind lsp.InlineCompletionTriggerKind
+---
---Provides information about the currently selected item in the autocomplete widget if it is visible.
---@field selectedCompletionInfo? lsp.SelectedCompletionInfo
+---A string value used as a snippet is a template which allows to insert text
+---and to control the editor cursor when insertion happens.
+---
+---A snippet can define tab stops and placeholders with `$1`, `$2`
+---and `${3:foo}`. `$0` defines the final tab stop, it defaults to
+---the end of the snippet. Variables are defined with `$name` and
+---`${name:default value}`.
+---
+---@since 3.18.0
+---@proposed
+---@class lsp.StringValue
+---
+---The kind of string value.
+---@field kind "snippet"
+---
+---The snippet string.
+---@field value string
+
---Inline completion options used during static registration.
---
---@since 3.18.0
----@class lsp.InlineCompletionOptions
+---@proposed
+---@class lsp.InlineCompletionOptions: lsp.WorkDoneProgressOptions
----General parameters to to register for an notification or to register a provider.
+---General parameters to register for a notification or to register a provider.
---@class lsp.Registration
+---
---The id used to register the request. The id can be used to deregister
---the request again.
---@field id string
+---
---The method / capability to register for.
---@field method string
+---
---Options necessary for the registration.
---@field registerOptions? lsp.LSPAny
---General parameters to unregister a request or notification.
---@class lsp.Unregistration
+---
---The id used to unregister the request or notification. Usually an id
---provided during the register request.
---@field id string
+---
---The method to unregister for.
---@field method string
---The initialize parameters
----@class lsp._InitializeParams
+---@class lsp._InitializeParams: lsp.WorkDoneProgressParams
+---
---The process Id of the parent process that started
---the server.
---
---Is `null` if the process has not been started by another process.
---If the parent process is not alive then the server should exit.
---@field processId integer|lsp.null
+---
---Information about the client
---
---@since 3.15.0
----@field clientInfo? anonym11
+---@field clientInfo? lsp._anonym11.clientInfo
+---
---The locale the client is currently showing the user interface
---in. This must not necessarily be the locale of the operating
---system.
@@ -1965,25 +2359,31 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@field locale? string
+---
---The rootPath of the workspace. Is null
---if no folder is open.
---
---@deprecated in favour of rootUri.
---@field rootPath? string|lsp.null
+---
---The rootUri of the workspace. Is null if no
---folder is open. If both `rootPath` and `rootUri` are set
---`rootUri` wins.
---
---@deprecated in favour of workspaceFolders.
---@field rootUri lsp.DocumentUri|lsp.null
+---
---The capabilities provided by the client (editor or tool)
---@field capabilities lsp.ClientCapabilities
+---
---User provided initialization options.
---@field initializationOptions? lsp.LSPAny
+---
---The initial trace setting. If omitted trace is disabled ('off').
---@field trace? lsp.TraceValues
---@class lsp.WorkspaceFoldersInitializeParams
+---
---The workspace folders configured in the client when the server starts.
---
---This property is only available if the client supports workspace folders.
@@ -1996,6 +2396,7 @@ error('Cannot require a meta file')
---Defines the capabilities provided by a language
---server.
---@class lsp.ServerCapabilities
+---
---The position encoding the server picked from the encodings offered
---by the client via the client capability `general.positionEncodings`.
---
@@ -2006,125 +2407,167 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@field positionEncoding? lsp.PositionEncodingKind
+---
---Defines how text documents are synced. Is either a detailed structure
---defining each notification or for backwards compatibility the
---TextDocumentSyncKind number.
---@field textDocumentSync? lsp.TextDocumentSyncOptions|lsp.TextDocumentSyncKind
+---
---Defines how notebook documents are synced.
---
---@since 3.17.0
---@field notebookDocumentSync? lsp.NotebookDocumentSyncOptions|lsp.NotebookDocumentSyncRegistrationOptions
+---
---The server provides completion support.
---@field completionProvider? lsp.CompletionOptions
+---
---The server provides hover support.
---@field hoverProvider? boolean|lsp.HoverOptions
+---
---The server provides signature help support.
---@field signatureHelpProvider? lsp.SignatureHelpOptions
+---
---The server provides Goto Declaration support.
---@field declarationProvider? boolean|lsp.DeclarationOptions|lsp.DeclarationRegistrationOptions
+---
---The server provides goto definition support.
---@field definitionProvider? boolean|lsp.DefinitionOptions
+---
---The server provides Goto Type Definition support.
---@field typeDefinitionProvider? boolean|lsp.TypeDefinitionOptions|lsp.TypeDefinitionRegistrationOptions
+---
---The server provides Goto Implementation support.
---@field implementationProvider? boolean|lsp.ImplementationOptions|lsp.ImplementationRegistrationOptions
+---
---The server provides find references support.
---@field referencesProvider? boolean|lsp.ReferenceOptions
+---
---The server provides document highlight support.
---@field documentHighlightProvider? boolean|lsp.DocumentHighlightOptions
+---
---The server provides document symbol support.
---@field documentSymbolProvider? boolean|lsp.DocumentSymbolOptions
+---
---The server provides code actions. CodeActionOptions may only be
---specified if the client states that it supports
---`codeActionLiteralSupport` in its initial `initialize` request.
---@field codeActionProvider? boolean|lsp.CodeActionOptions
+---
---The server provides code lens.
---@field codeLensProvider? lsp.CodeLensOptions
+---
---The server provides document link support.
---@field documentLinkProvider? lsp.DocumentLinkOptions
+---
---The server provides color provider support.
---@field colorProvider? boolean|lsp.DocumentColorOptions|lsp.DocumentColorRegistrationOptions
+---
---The server provides workspace symbol support.
---@field workspaceSymbolProvider? boolean|lsp.WorkspaceSymbolOptions
+---
---The server provides document formatting.
---@field documentFormattingProvider? boolean|lsp.DocumentFormattingOptions
+---
---The server provides document range formatting.
---@field documentRangeFormattingProvider? boolean|lsp.DocumentRangeFormattingOptions
+---
---The server provides document formatting on typing.
---@field documentOnTypeFormattingProvider? lsp.DocumentOnTypeFormattingOptions
+---
---The server provides rename support. RenameOptions may only be
---specified if the client states that it supports
---`prepareSupport` in its initial `initialize` request.
---@field renameProvider? boolean|lsp.RenameOptions
+---
---The server provides folding provider support.
---@field foldingRangeProvider? boolean|lsp.FoldingRangeOptions|lsp.FoldingRangeRegistrationOptions
+---
---The server provides selection range support.
---@field selectionRangeProvider? boolean|lsp.SelectionRangeOptions|lsp.SelectionRangeRegistrationOptions
+---
---The server provides execute command support.
---@field executeCommandProvider? lsp.ExecuteCommandOptions
+---
---The server provides call hierarchy support.
---
---@since 3.16.0
---@field callHierarchyProvider? boolean|lsp.CallHierarchyOptions|lsp.CallHierarchyRegistrationOptions
+---
---The server provides linked editing range support.
---
---@since 3.16.0
---@field linkedEditingRangeProvider? boolean|lsp.LinkedEditingRangeOptions|lsp.LinkedEditingRangeRegistrationOptions
+---
---The server provides semantic tokens support.
---
---@since 3.16.0
---@field semanticTokensProvider? lsp.SemanticTokensOptions|lsp.SemanticTokensRegistrationOptions
+---
---The server provides moniker support.
---
---@since 3.16.0
---@field monikerProvider? boolean|lsp.MonikerOptions|lsp.MonikerRegistrationOptions
+---
---The server provides type hierarchy support.
---
---@since 3.17.0
---@field typeHierarchyProvider? boolean|lsp.TypeHierarchyOptions|lsp.TypeHierarchyRegistrationOptions
+---
---The server provides inline values.
---
---@since 3.17.0
---@field inlineValueProvider? boolean|lsp.InlineValueOptions|lsp.InlineValueRegistrationOptions
+---
---The server provides inlay hints.
---
---@since 3.17.0
---@field inlayHintProvider? boolean|lsp.InlayHintOptions|lsp.InlayHintRegistrationOptions
+---
---The server has support for pull model diagnostics.
---
---@since 3.17.0
---@field diagnosticProvider? lsp.DiagnosticOptions|lsp.DiagnosticRegistrationOptions
+---
---Inline completion options used during static registration.
---
---@since 3.18.0
+---@proposed
---@field inlineCompletionProvider? boolean|lsp.InlineCompletionOptions
+---
---Workspace specific server capabilities.
----@field workspace? anonym12
+---@field workspace? lsp._anonym12.workspace
+---
---Experimental server capabilities.
---@field experimental? lsp.LSPAny
---A text document identifier to denote a specific version of a text document.
---@class lsp.VersionedTextDocumentIdentifier: lsp.TextDocumentIdentifier
+---
---The version number of this document.
---@field version integer
---Save options.
---@class lsp.SaveOptions
+---
---The client is supposed to include the content on save.
---@field includeText? boolean
---An event describing a file change.
---@class lsp.FileEvent
+---
---The file's uri.
---@field uri lsp.DocumentUri
+---
---The change type.
---@field type lsp.FileChangeType
---@class lsp.FileSystemWatcher
+---
---The glob pattern to watch. See {@link GlobPattern glob pattern} for more detail.
---
---@since 3.17.0 support for relative patterns.
---@field globPattern lsp.GlobPattern
+---
---The kind of events of interest. If omitted it defaults
---to WatchKind.Create | WatchKind.Change | WatchKind.Delete
---which is 7.
@@ -2133,31 +2576,40 @@ error('Cannot require a meta file')
---Represents a diagnostic, such as a compiler error or warning. Diagnostic objects
---are only valid in the scope of a resource.
---@class lsp.Diagnostic
+---
---The range at which the message applies
---@field range lsp.Range
+---
---The diagnostic's severity. Can be omitted. If omitted it is up to the
---client to interpret diagnostics as error, warning, info or hint.
---@field severity? lsp.DiagnosticSeverity
+---
---The diagnostic's code, which usually appear in the user interface.
---@field code? integer|string
+---
---An optional property to describe the error code.
---Requires the code field (above) to be present/not null.
---
---@since 3.16.0
---@field codeDescription? lsp.CodeDescription
+---
---A human-readable string describing the source of this
---diagnostic, e.g. 'typescript' or 'super lint'. It usually
---appears in the user interface.
---@field source? string
+---
---The diagnostic's message. It usually appears in the user interface
---@field message string
+---
---Additional metadata about the diagnostic.
---
---@since 3.15.0
---@field tags? lsp.DiagnosticTag[]
+---
---An array of related diagnostic information, e.g. when symbol-names within
---a scope collide all definitions can be marked via this property.
---@field relatedInformation? lsp.DiagnosticRelatedInformation[]
+---
---A data entry field that is preserved between a `textDocument/publishDiagnostics`
---notification and `textDocument/codeAction` request.
---
@@ -2166,8 +2618,10 @@ error('Cannot require a meta file')
---Contains additional information about the context in which a completion request is triggered.
---@class lsp.CompletionContext
+---
---How the completion was triggered.
---@field triggerKind lsp.CompletionTriggerKind
+---
---The trigger character (a single character) that has trigger code complete.
---Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter`
---@field triggerCharacter? string
@@ -2176,9 +2630,11 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.CompletionItemLabelDetails
+---
---An optional string which is rendered less prominently directly after {@link CompletionItem.label label},
---without any spacing. Should be used for function signatures and type annotations.
---@field detail? string
+---
---An optional string which is rendered less prominently after {@link CompletionItem.detail}. Should be used
---for fully qualified names and file paths.
---@field description? string
@@ -2187,15 +2643,19 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@class lsp.InsertReplaceEdit
+---
---The string to be inserted.
---@field newText string
+---
---The range if the insert is requested
---@field insert lsp.Range
+---
---The range if the replace is requested.
---@field replace lsp.Range
---Completion options.
----@class lsp.CompletionOptions
+---@class lsp.CompletionOptions: lsp.WorkDoneProgressOptions
+---
---Most tools trigger completion request automatically without explicitly requesting
---it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user
---starts to type an identifier. For example if the user types `c` in a JavaScript file
@@ -2205,6 +2665,7 @@ error('Cannot require a meta file')
---If code complete should automatically be trigger on characters not being valid inside
---an identifier (for example `.` in JavaScript) list them in `triggerCharacters`.
---@field triggerCharacters? string[]
+---
---The list of all possible characters that commit a completion. This field can be used
---if clients don't support individual commit characters per completion item. See
---`ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport`
@@ -2214,33 +2675,39 @@ error('Cannot require a meta file')
---
---@since 3.2.0
---@field allCommitCharacters? string[]
+---
---The server provides support to resolve additional
---information for a completion item.
---@field resolveProvider? boolean
+---
---The server supports the following `CompletionItem` specific
---capabilities.
---
---@since 3.17.0
----@field completionItem? anonym13
+---@field completionItem? lsp._anonym13.completionItem
---Hover options.
----@class lsp.HoverOptions
+---@class lsp.HoverOptions: lsp.WorkDoneProgressOptions
---Additional information about the context in which a signature help request was triggered.
---
---@since 3.15.0
---@class lsp.SignatureHelpContext
+---
---Action that caused signature help to be triggered.
---@field triggerKind lsp.SignatureHelpTriggerKind
+---
---Character that caused signature help to be triggered.
---
---This is undefined when `triggerKind !== SignatureHelpTriggerKind.TriggerCharacter`
---@field triggerCharacter? string
+---
---`true` if signature help was already showing when it was triggered.
---
---Retriggers occurs when the signature help is already active and can be caused by actions such as
---typing a trigger character, a cursor move, or document content changes.
---@field isRetrigger boolean
+---
---The currently active `SignatureHelp`.
---
---The `activeSignatureHelp` has its `SignatureHelp.activeSignature` field updated based on
@@ -2251,25 +2718,37 @@ error('Cannot require a meta file')
---can have a label, like a function-name, a doc-comment, and
---a set of parameters.
---@class lsp.SignatureInformation
+---
---The label of this signature. Will be shown in
---the UI.
---@field label string
+---
---The human-readable doc-comment of this signature. Will be shown
---in the UI but can be omitted.
---@field documentation? string|lsp.MarkupContent
+---
---The parameters of this signature.
---@field parameters? lsp.ParameterInformation[]
+---
---The index of the active parameter.
---
----If provided, this is used in place of `SignatureHelp.activeParameter`.
+---If `null`, no parameter of the signature is active (for example a named
+---argument that does not match any declared parameters). This is only valid
+---since 3.18.0 and if the client specifies the client capability
+---`textDocument.signatureHelp.noActiveParameterSupport === true`
+---
+---If provided (or `null`), this is used in place of
+---`SignatureHelp.activeParameter`.
---
---@since 3.16.0
----@field activeParameter? uinteger
+---@field activeParameter? uinteger|lsp.null
---Server Capabilities for a {@link SignatureHelpRequest}.
----@class lsp.SignatureHelpOptions
+---@class lsp.SignatureHelpOptions: lsp.WorkDoneProgressOptions
+---
---List of characters that trigger signature help automatically.
---@field triggerCharacters? string[]
+---
---List of characters that re-trigger signature help.
---
---These trigger characters are only active when signature help is already showing. All trigger characters
@@ -2279,30 +2758,35 @@ error('Cannot require a meta file')
---@field retriggerCharacters? string[]
---Server Capabilities for a {@link DefinitionRequest}.
----@class lsp.DefinitionOptions
+---@class lsp.DefinitionOptions: lsp.WorkDoneProgressOptions
---Value-object that contains additional information when
---requesting references.
---@class lsp.ReferenceContext
+---
---Include the declaration of the current symbol.
---@field includeDeclaration boolean
---Reference options.
----@class lsp.ReferenceOptions
+---@class lsp.ReferenceOptions: lsp.WorkDoneProgressOptions
---Provider options for a {@link DocumentHighlightRequest}.
----@class lsp.DocumentHighlightOptions
+---@class lsp.DocumentHighlightOptions: lsp.WorkDoneProgressOptions
---A base for all symbol information.
---@class lsp.BaseSymbolInformation
+---
---The name of this symbol.
---@field name string
+---
---The kind of this symbol.
---@field kind lsp.SymbolKind
+---
---Tags for this symbol.
---
---@since 3.16.0
---@field tags? lsp.SymbolTag[]
+---
---The name of the symbol containing this symbol. This information is for
---user interface purposes (e.g. to render a qualifier in the user interface
---if necessary). It can't be used to re-infer a hierarchy for the document
@@ -2310,7 +2794,8 @@ error('Cannot require a meta file')
---@field containerName? string
---Provider options for a {@link DocumentSymbolRequest}.
----@class lsp.DocumentSymbolOptions
+---@class lsp.DocumentSymbolOptions: lsp.WorkDoneProgressOptions
+---
---A human-readable string that is shown when multiple outlines trees
---are shown for the same document.
---
@@ -2320,29 +2805,34 @@ error('Cannot require a meta file')
---Contains additional diagnostic information about the context in which
---a {@link CodeActionProvider.provideCodeActions code action} is run.
---@class lsp.CodeActionContext
+---
---An array of diagnostics known on the client side overlapping the range provided to the
---`textDocument/codeAction` request. They are provided so that the server knows which
---errors are currently presented to the user for the given range. There is no guarantee
---that these accurately reflect the error state of the resource. The primary parameter
---to compute code actions is the provided range.
---@field diagnostics lsp.Diagnostic[]
+---
---Requested kind of actions to return.
---
---Actions not of this kind are filtered out by the client before being shown. So servers
---can omit computing them.
---@field only? lsp.CodeActionKind[]
+---
---The reason why code actions were requested.
---
---@since 3.17.0
---@field triggerKind? lsp.CodeActionTriggerKind
---Provider options for a {@link CodeActionRequest}.
----@class lsp.CodeActionOptions
+---@class lsp.CodeActionOptions: lsp.WorkDoneProgressOptions
+---
---CodeActionKinds that this server may return.
---
---The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server
---may list out every specific kind they provide.
---@field codeActionKinds? lsp.CodeActionKind[]
+---
---The server provides support to resolve additional
---information for a code action.
---
@@ -2350,7 +2840,8 @@ error('Cannot require a meta file')
---@field resolveProvider? boolean
---Server capabilities for a {@link WorkspaceSymbolRequest}.
----@class lsp.WorkspaceSymbolOptions
+---@class lsp.WorkspaceSymbolOptions: lsp.WorkDoneProgressOptions
+---
---The server provides support to resolve additional
---information for a workspace symbol.
---
@@ -2358,39 +2849,47 @@ error('Cannot require a meta file')
---@field resolveProvider? boolean
---Code Lens provider options of a {@link CodeLensRequest}.
----@class lsp.CodeLensOptions
+---@class lsp.CodeLensOptions: lsp.WorkDoneProgressOptions
+---
---Code lens has a resolve provider as well.
---@field resolveProvider? boolean
---Provider options for a {@link DocumentLinkRequest}.
----@class lsp.DocumentLinkOptions
+---@class lsp.DocumentLinkOptions: lsp.WorkDoneProgressOptions
+---
---Document links have a resolve provider as well.
---@field resolveProvider? boolean
---Value-object describing what options formatting should use.
---@class lsp.FormattingOptions
+---
---Size of a tab in spaces.
---@field tabSize uinteger
+---
---Prefer spaces over tabs.
---@field insertSpaces boolean
+---
---Trim trailing whitespace on a line.
---
---@since 3.15.0
---@field trimTrailingWhitespace? boolean
+---
---Insert a newline character at the end of the file if one does not exist.
---
---@since 3.15.0
---@field insertFinalNewline? boolean
+---
---Trim all newlines after the final newline at the end of the file.
---
---@since 3.15.0
---@field trimFinalNewlines? boolean
---Provider options for a {@link DocumentFormattingRequest}.
----@class lsp.DocumentFormattingOptions
+---@class lsp.DocumentFormattingOptions: lsp.WorkDoneProgressOptions
---Provider options for a {@link DocumentRangeFormattingRequest}.
----@class lsp.DocumentRangeFormattingOptions
+---@class lsp.DocumentRangeFormattingOptions: lsp.WorkDoneProgressOptions
+---
---Whether the server supports formatting multiple ranges at once.
---
---@since 3.18.0
@@ -2399,32 +2898,39 @@ error('Cannot require a meta file')
---Provider options for a {@link DocumentOnTypeFormattingRequest}.
---@class lsp.DocumentOnTypeFormattingOptions
+---
---A character on which formatting should be triggered, like `{`.
---@field firstTriggerCharacter string
+---
---More trigger characters.
---@field moreTriggerCharacter? string[]
---Provider options for a {@link RenameRequest}.
----@class lsp.RenameOptions
+---@class lsp.RenameOptions: lsp.WorkDoneProgressOptions
+---
---Renames should be checked and tested before being executed.
---
---@since version 3.12.0
---@field prepareProvider? boolean
---The server capabilities of a {@link ExecuteCommandRequest}.
----@class lsp.ExecuteCommandOptions
+---@class lsp.ExecuteCommandOptions: lsp.WorkDoneProgressOptions
+---
---The commands to be executed on the server
---@field commands string[]
---@since 3.16.0
---@class lsp.SemanticTokensLegend
+---
---The token types a server uses.
---@field tokenTypes string[]
+---
---The token modifiers a server uses.
---@field tokenModifiers string[]
---A text document identifier to optionally denote a specific version of a text document.
---@class lsp.OptionalVersionedTextDocumentIdentifier: lsp.TextDocumentIdentifier
+---
---The version number of this document. If a versioned text document identifier
---is sent from the server to the client and the file is not open in the editor
---(the server has not received an open notification before) the server can send
@@ -2436,13 +2942,16 @@ error('Cannot require a meta file')
---
---@since 3.16.0.
---@class lsp.AnnotatedTextEdit: lsp.TextEdit
+---
---The actual identifier of the change annotation
---@field annotationId lsp.ChangeAnnotationIdentifier
---A generic resource operation.
---@class lsp.ResourceOperation
+---
---The resource operation kind.
---@field kind string
+---
---An optional annotation identifier describing the operation.
---
---@since 3.16.0
@@ -2450,22 +2959,28 @@ error('Cannot require a meta file')
---Options to create a file.
---@class lsp.CreateFileOptions
+---
---Overwrite existing file. Overwrite wins over `ignoreIfExists`
---@field overwrite? boolean
+---
---Ignore if exists.
---@field ignoreIfExists? boolean
---Rename file options
---@class lsp.RenameFileOptions
+---
---Overwrite target if existing. Overwrite wins over `ignoreIfExists`
---@field overwrite? boolean
+---
---Ignores if target exists.
---@field ignoreIfExists? boolean
---Delete file options
---@class lsp.DeleteFileOptions
+---
---Delete the content recursively if a folder is denoted.
---@field recursive? boolean
+---
---Ignore the operation if the file doesn't exist.
---@field ignoreIfNotExists? boolean
@@ -2474,18 +2989,21 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@class lsp.FileOperationPattern
+---
---The glob pattern to match. Glob patterns can have the following syntax:
---- `*` to match one or more characters in a path segment
---- `?` to match on one character in a path segment
---- `**` to match any number of path segments, including none
----- `{}` to group sub patterns into an OR expression. (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files)
+---- `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files)
---- `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, 
)
---- `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)
---@field glob string
+---
---Whether to match files or folders with this pattern.
---
---Matches both if undefined.
---@field matches? lsp.FileOperationPatternKind
+---
---Additional options used during matching.
---@field options? lsp.FileOperationPatternOptions
@@ -2493,8 +3011,10 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.WorkspaceFullDocumentDiagnosticReport: lsp.FullDocumentDiagnosticReport
+---
---The URI for which diagnostic information is reported.
---@field uri lsp.DocumentUri
+---
---The version number for which the diagnostics are reported.
---If the document is not marked as open `null` can be provided.
---@field version integer|lsp.null
@@ -2503,8 +3023,10 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.WorkspaceUnchangedDocumentDiagnosticReport: lsp.UnchangedDocumentDiagnosticReport
+---
---The URI for which diagnostic information is reported.
---@field uri lsp.DocumentUri
+---
---The version number for which the diagnostics are reported.
---If the document is not marked as open `null` can be provided.
---@field version integer|lsp.null
@@ -2517,15 +3039,19 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.NotebookCell
+---
---The cell's kind
---@field kind lsp.NotebookCellKind
+---
---The URI of the cell's text document
---content.
---@field document lsp.DocumentUri
+---
---Additional metadata stored with the cell.
---
---Note: should always be an object literal (e.g. LSPObject)
---@field metadata? lsp.LSPObject
+---
---Additional execution summary information
---if supported by the client.
---@field executionSummary? lsp.ExecutionSummary
@@ -2535,54 +3061,71 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.NotebookCellArrayChange
+---
---The start oftest of the cell that changed.
---@field start uinteger
+---
---The deleted cells
---@field deleteCount uinteger
+---
---The new cells, if any
---@field cells? lsp.NotebookCell[]
---Describes the currently selected completion item.
---
---@since 3.18.0
+---@proposed
---@class lsp.SelectedCompletionInfo
+---
---The range that will be replaced if this completion item is accepted.
---@field range lsp.Range
+---
---The text the range will be replaced with if this completion is accepted.
---@field text string
---Defines the capabilities provided by the client.
---@class lsp.ClientCapabilities
+---
---Workspace specific client capabilities.
---@field workspace? lsp.WorkspaceClientCapabilities
+---
---Text document specific client capabilities.
---@field textDocument? lsp.TextDocumentClientCapabilities
+---
---Capabilities specific to the notebook document support.
---
---@since 3.17.0
---@field notebookDocument? lsp.NotebookDocumentClientCapabilities
+---
---Window specific client capabilities.
---@field window? lsp.WindowClientCapabilities
+---
---General client capabilities.
---
---@since 3.16.0
---@field general? lsp.GeneralClientCapabilities
+---
---Experimental client capabilities.
---@field experimental? lsp.LSPAny
---@class lsp.TextDocumentSyncOptions
+---
---Open and close notifications are sent to the server. If omitted open close notification should not
---be sent.
---@field openClose? boolean
+---
---Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full
---and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None.
---@field change? lsp.TextDocumentSyncKind
+---
---If present will save notifications are sent to the server. If omitted the notification should not be
---sent.
---@field willSave? boolean
+---
---If present will save wait until requests are sent to the server. If omitted the request should not be
---sent.
---@field willSaveWaitUntil? boolean
+---
---If present save notifications are sent to the server. If omitted the notification should not be
---sent.
---@field save? boolean|lsp.SaveOptions
@@ -2601,8 +3144,10 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.NotebookDocumentSyncOptions
+---
---The notebooks to be synced
----@field notebookSelector anonym15|anonym17[]
+---@field notebookSelector (lsp._anonym14.notebookSelector|lsp._anonym16.notebookSelector)[]
+---
---Whether save notification should be forwarded to
---the server. Will only be honored if mode === `notebook`.
---@field save? boolean
@@ -2613,8 +3158,10 @@ error('Cannot require a meta file')
---@class lsp.NotebookDocumentSyncRegistrationOptions: lsp.NotebookDocumentSyncOptions, lsp.StaticRegistrationOptions
---@class lsp.WorkspaceFoldersServerCapabilities
+---
---The server has support for workspace folders
---@field supported? boolean
+---
---Whether the server wants to receive workspace folder
---change notifications.
---
@@ -2628,16 +3175,22 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@class lsp.FileOperationOptions
+---
---The server is interested in receiving didCreateFiles notifications.
---@field didCreate? lsp.FileOperationRegistrationOptions
+---
---The server is interested in receiving willCreateFiles requests.
---@field willCreate? lsp.FileOperationRegistrationOptions
+---
---The server is interested in receiving didRenameFiles notifications.
---@field didRename? lsp.FileOperationRegistrationOptions
+---
---The server is interested in receiving willRenameFiles requests.
---@field willRename? lsp.FileOperationRegistrationOptions
+---
---The server is interested in receiving didDeleteFiles file notifications.
---@field didDelete? lsp.FileOperationRegistrationOptions
+---
---The server is interested in receiving willDeleteFiles file requests.
---@field willDelete? lsp.FileOperationRegistrationOptions
@@ -2645,6 +3198,7 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@class lsp.CodeDescription
+---
---An URI to open with more information about the diagnostic error.
---@field href lsp.URI
@@ -2652,14 +3206,17 @@ error('Cannot require a meta file')
---used to point to code locations that cause or related to a diagnostics, e.g when duplicating
---a symbol in a scope.
---@class lsp.DiagnosticRelatedInformation
+---
---The location of this related diagnostic information.
---@field location lsp.Location
+---
---The message of this related diagnostic information.
---@field message string
---Represents a parameter of a callable-signature. A parameter can
---have a label and a doc-comment.
---@class lsp.ParameterInformation
+---
---The label of this parameter information.
---
---Either a string or an inclusive start and exclusive end offsets within its containing
@@ -2669,6 +3226,7 @@ error('Cannot require a meta file')
---*Note*: a label of type string should be a substring of its containing signature label.
---Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`.
---@field label string|{ [1]: uinteger, [2]: uinteger }
+---
---The human-readable doc-comment of this parameter. Will be shown
---in the UI but can be omitted.
---@field documentation? string|lsp.MarkupContent
@@ -2678,11 +3236,13 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.NotebookCellTextDocumentFilter
+---
---A filter that matches against the notebook
---containing the notebook cell. If a string
---value is provided it matches against the
---notebook type. '*' matches every notebook.
---@field notebook string|lsp.NotebookDocumentFilter
+---
---A language id like `python`.
---
---Will be matched against the language id of the
@@ -2693,178 +3253,235 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@class lsp.FileOperationPatternOptions
+---
---The pattern should be matched ignoring casing.
---@field ignoreCase? boolean
---@class lsp.ExecutionSummary
+---
---A strict monotonically increasing value
---indicating the execution order of a cell
---inside a notebook.
---@field executionOrder uinteger
+---
---Whether the execution was successful or
---not if known by the client.
---@field success? boolean
---Workspace specific client capabilities.
---@class lsp.WorkspaceClientCapabilities
+---
---The client supports applying batch edits
---to the workspace by supporting the request
---'workspace/applyEdit'
---@field applyEdit? boolean
+---
---Capabilities specific to `WorkspaceEdit`s.
---@field workspaceEdit? lsp.WorkspaceEditClientCapabilities
+---
---Capabilities specific to the `workspace/didChangeConfiguration` notification.
---@field didChangeConfiguration? lsp.DidChangeConfigurationClientCapabilities
+---
---Capabilities specific to the `workspace/didChangeWatchedFiles` notification.
---@field didChangeWatchedFiles? lsp.DidChangeWatchedFilesClientCapabilities
+---
---Capabilities specific to the `workspace/symbol` request.
---@field symbol? lsp.WorkspaceSymbolClientCapabilities
+---
---Capabilities specific to the `workspace/executeCommand` request.
---@field executeCommand? lsp.ExecuteCommandClientCapabilities
+---
---The client has support for workspace folders.
---
---@since 3.6.0
---@field workspaceFolders? boolean
+---
---The client supports `workspace/configuration` requests.
---
---@since 3.6.0
---@field configuration? boolean
+---
---Capabilities specific to the semantic token requests scoped to the
---workspace.
---
---@since 3.16.0.
---@field semanticTokens? lsp.SemanticTokensWorkspaceClientCapabilities
+---
---Capabilities specific to the code lens requests scoped to the
---workspace.
---
---@since 3.16.0.
---@field codeLens? lsp.CodeLensWorkspaceClientCapabilities
+---
---The client has support for file notifications/requests for user operations on files.
---
---Since 3.16.0
---@field fileOperations? lsp.FileOperationClientCapabilities
+---
---Capabilities specific to the inline values requests scoped to the
---workspace.
---
---@since 3.17.0.
---@field inlineValue? lsp.InlineValueWorkspaceClientCapabilities
+---
---Capabilities specific to the inlay hint requests scoped to the
---workspace.
---
---@since 3.17.0.
---@field inlayHint? lsp.InlayHintWorkspaceClientCapabilities
+---
---Capabilities specific to the diagnostic requests scoped to the
---workspace.
---
---@since 3.17.0.
---@field diagnostics? lsp.DiagnosticWorkspaceClientCapabilities
+---
+---Capabilities specific to the folding range requests scoped to the workspace.
+---
+---@since 3.18.0
+---@proposed
+---@field foldingRange? lsp.FoldingRangeWorkspaceClientCapabilities
---Text document specific client capabilities.
---@class lsp.TextDocumentClientCapabilities
+---
---Defines which synchronization capabilities the client supports.
---@field synchronization? lsp.TextDocumentSyncClientCapabilities
+---
---Capabilities specific to the `textDocument/completion` request.
---@field completion? lsp.CompletionClientCapabilities
+---
---Capabilities specific to the `textDocument/hover` request.
---@field hover? lsp.HoverClientCapabilities
+---
---Capabilities specific to the `textDocument/signatureHelp` request.
---@field signatureHelp? lsp.SignatureHelpClientCapabilities
+---
---Capabilities specific to the `textDocument/declaration` request.
---
---@since 3.14.0
---@field declaration? lsp.DeclarationClientCapabilities
+---
---Capabilities specific to the `textDocument/definition` request.
---@field definition? lsp.DefinitionClientCapabilities
+---
---Capabilities specific to the `textDocument/typeDefinition` request.
---
---@since 3.6.0
---@field typeDefinition? lsp.TypeDefinitionClientCapabilities
+---
---Capabilities specific to the `textDocument/implementation` request.
---
---@since 3.6.0
---@field implementation? lsp.ImplementationClientCapabilities
+---
---Capabilities specific to the `textDocument/references` request.
---@field references? lsp.ReferenceClientCapabilities
+---
---Capabilities specific to the `textDocument/documentHighlight` request.
---@field documentHighlight? lsp.DocumentHighlightClientCapabilities
+---
---Capabilities specific to the `textDocument/documentSymbol` request.
---@field documentSymbol? lsp.DocumentSymbolClientCapabilities
+---
---Capabilities specific to the `textDocument/codeAction` request.
---@field codeAction? lsp.CodeActionClientCapabilities
+---
---Capabilities specific to the `textDocument/codeLens` request.
---@field codeLens? lsp.CodeLensClientCapabilities
+---
---Capabilities specific to the `textDocument/documentLink` request.
---@field documentLink? lsp.DocumentLinkClientCapabilities
+---
---Capabilities specific to the `textDocument/documentColor` and the
---`textDocument/colorPresentation` request.
---
---@since 3.6.0
---@field colorProvider? lsp.DocumentColorClientCapabilities
+---
---Capabilities specific to the `textDocument/formatting` request.
---@field formatting? lsp.DocumentFormattingClientCapabilities
+---
---Capabilities specific to the `textDocument/rangeFormatting` request.
---@field rangeFormatting? lsp.DocumentRangeFormattingClientCapabilities
+---
---Capabilities specific to the `textDocument/onTypeFormatting` request.
---@field onTypeFormatting? lsp.DocumentOnTypeFormattingClientCapabilities
+---
---Capabilities specific to the `textDocument/rename` request.
---@field rename? lsp.RenameClientCapabilities
+---
---Capabilities specific to the `textDocument/foldingRange` request.
---
---@since 3.10.0
---@field foldingRange? lsp.FoldingRangeClientCapabilities
+---
---Capabilities specific to the `textDocument/selectionRange` request.
---
---@since 3.15.0
---@field selectionRange? lsp.SelectionRangeClientCapabilities
+---
---Capabilities specific to the `textDocument/publishDiagnostics` notification.
---@field publishDiagnostics? lsp.PublishDiagnosticsClientCapabilities
+---
---Capabilities specific to the various call hierarchy requests.
---
---@since 3.16.0
---@field callHierarchy? lsp.CallHierarchyClientCapabilities
+---
---Capabilities specific to the various semantic token request.
---
---@since 3.16.0
---@field semanticTokens? lsp.SemanticTokensClientCapabilities
+---
---Capabilities specific to the `textDocument/linkedEditingRange` request.
---
---@since 3.16.0
---@field linkedEditingRange? lsp.LinkedEditingRangeClientCapabilities
+---
---Client capabilities specific to the `textDocument/moniker` request.
---
---@since 3.16.0
---@field moniker? lsp.MonikerClientCapabilities
+---
---Capabilities specific to the various type hierarchy requests.
---
---@since 3.17.0
---@field typeHierarchy? lsp.TypeHierarchyClientCapabilities
+---
---Capabilities specific to the `textDocument/inlineValue` request.
---
---@since 3.17.0
---@field inlineValue? lsp.InlineValueClientCapabilities
+---
---Capabilities specific to the `textDocument/inlayHint` request.
---
---@since 3.17.0
---@field inlayHint? lsp.InlayHintClientCapabilities
+---
---Capabilities specific to the diagnostic pull model.
---
---@since 3.17.0
---@field diagnostic? lsp.DiagnosticClientCapabilities
+---
---Client capabilities specific to inline completions.
---
---@since 3.18.0
+---@proposed
---@field inlineCompletion? lsp.InlineCompletionClientCapabilities
---Capabilities specific to the notebook document support.
---
---@since 3.17.0
---@class lsp.NotebookDocumentClientCapabilities
+---
---Capabilities specific to notebook document synchronization
---
---@since 3.17.0
---@field synchronization lsp.NotebookDocumentSyncClientCapabilities
---@class lsp.WindowClientCapabilities
+---
---It indicates whether the client supports server initiated
---progress using the `window/workDoneProgress/create` request.
---
@@ -2875,10 +3492,12 @@ error('Cannot require a meta file')
---
---@since 3.15.0
---@field workDoneProgress? boolean
+---
---Capabilities specific to the showMessage request.
---
---@since 3.16.0
---@field showMessage? lsp.ShowMessageRequestClientCapabilities
+---
---Capabilities specific to the showDocument request.
---
---@since 3.16.0
@@ -2888,21 +3507,25 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@class lsp.GeneralClientCapabilities
+---
---Client capability that signals how the client
---handles stale requests (e.g. a request
---for which the client will not process the response
---anymore since the information is outdated).
---
---@since 3.17.0
----@field staleRequestSupport? anonym18
+---@field staleRequestSupport? lsp._anonym18.staleRequestSupport
+---
---Client capabilities specific to regular expressions.
---
---@since 3.16.0
---@field regularExpressions? lsp.RegularExpressionsClientCapabilities
+---
---Client capabilities specific to the client's markdown parser.
---
---@since 3.16.0
---@field markdown? lsp.MarkdownClientCapabilities
+---
---The position encodings supported by the client. Client and server
---have to agree on the same position encoding to ensure that offsets
---(e.g. character position in a line) are interpreted the same on both
@@ -2929,25 +3552,31 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.RelativePattern
+---
---A workspace folder or a base URI to which this pattern will be matched
---against relatively.
---@field baseUri lsp.WorkspaceFolder|lsp.URI
+---
---The actual glob pattern;
---@field pattern lsp.Pattern
---@class lsp.WorkspaceEditClientCapabilities
+---
---The client supports versioned document changes in `WorkspaceEdit`s
---@field documentChanges? boolean
+---
---The resource operations the client supports. Clients should at least
---support 'create', 'rename' and 'delete' files and folders.
---
---@since 3.13.0
---@field resourceOperations? lsp.ResourceOperationKind[]
+---
---The failure handling strategy of a client if applying the workspace edit
---fails.
---
---@since 3.13.0
---@field failureHandling? lsp.FailureHandlingKind
+---
---Whether the client normalizes line endings to the client specific
---setting.
---If set to `true` the client will normalize line ending characters
@@ -2956,21 +3585,25 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@field normalizesLineEndings? boolean
+---
---Whether the client in general supports change annotations on text edits,
---create file, rename file and delete file changes.
---
---@since 3.16.0
----@field changeAnnotationSupport? anonym19
+---@field changeAnnotationSupport? lsp._anonym19.changeAnnotationSupport
---@class lsp.DidChangeConfigurationClientCapabilities
+---
---Did change configuration notification supports dynamic registration.
---@field dynamicRegistration? boolean
---@class lsp.DidChangeWatchedFilesClientCapabilities
+---
---Did change watched files notification supports dynamic registration. Please note
---that the current protocol doesn't support static configuration for file changes
---from the server side.
---@field dynamicRegistration? boolean
+---
---Whether the client has support for {@link RelativePattern relative pattern}
---or not.
---
@@ -2979,29 +3612,35 @@ error('Cannot require a meta file')
---Client capabilities for a {@link WorkspaceSymbolRequest}.
---@class lsp.WorkspaceSymbolClientCapabilities
+---
---Symbol request supports dynamic registration.
---@field dynamicRegistration? boolean
+---
---Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.
----@field symbolKind? anonym20
+---@field symbolKind? lsp._anonym20.symbolKind
+---
---The client supports tags on `SymbolInformation`.
---Clients supporting tags have to handle unknown tags gracefully.
---
---@since 3.16.0
----@field tagSupport? anonym21
+---@field tagSupport? lsp._anonym21.tagSupport
+---
---The client support partial workspace symbols. The client will send the
---request `workspaceSymbol/resolve` to the server to resolve additional
---properties.
---
---@since 3.17.0
----@field resolveSupport? anonym22
+---@field resolveSupport? lsp._anonym22.resolveSupport
---The client capabilities of a {@link ExecuteCommandRequest}.
---@class lsp.ExecuteCommandClientCapabilities
+---
---Execute command supports dynamic registration.
---@field dynamicRegistration? boolean
---@since 3.16.0
---@class lsp.SemanticTokensWorkspaceClientCapabilities
+---
---Whether the client implementation supports a refresh request sent from
---the server to the client.
---
@@ -3013,6 +3652,7 @@ error('Cannot require a meta file')
---@since 3.16.0
---@class lsp.CodeLensWorkspaceClientCapabilities
+---
---Whether the client implementation supports a refresh request sent from the
---server to the client.
---
@@ -3029,18 +3669,25 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@class lsp.FileOperationClientCapabilities
+---
---Whether the client supports dynamic registration for file requests/notifications.
---@field dynamicRegistration? boolean
+---
---The client has support for sending didCreateFiles notifications.
---@field didCreate? boolean
+---
---The client has support for sending willCreateFiles requests.
---@field willCreate? boolean
+---
---The client has support for sending didRenameFiles notifications.
---@field didRename? boolean
+---
---The client has support for sending willRenameFiles requests.
---@field willRename? boolean
+---
---The client has support for sending didDeleteFiles notifications.
---@field didDelete? boolean
+---
---The client has support for sending willDeleteFiles requests.
---@field willDelete? boolean
@@ -3048,6 +3695,7 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.InlineValueWorkspaceClientCapabilities
+---
---Whether the client implementation supports a refresh request sent from the
---server to the client.
---
@@ -3061,6 +3709,7 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.InlayHintWorkspaceClientCapabilities
+---
---Whether the client implementation supports a refresh request sent from
---the server to the client.
---
@@ -3074,6 +3723,7 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.DiagnosticWorkspaceClientCapabilities
+---
---Whether the client implementation supports a refresh request sent from
---the server to the client.
---
@@ -3083,55 +3733,88 @@ error('Cannot require a meta file')
---change that requires such a calculation.
---@field refreshSupport? boolean
+---Client workspace capabilities specific to folding ranges
+---
+---@since 3.18.0
+---@proposed
+---@class lsp.FoldingRangeWorkspaceClientCapabilities
+---
+---Whether the client implementation supports a refresh request sent from the
+---server to the client.
+---
+---Note that this event is global and will force the client to refresh all
+---folding ranges currently shown. It should be used with absolute care and is
+---useful for situation where a server for example detects a project wide
+---change that requires such a calculation.
+---
+---@since 3.18.0
+---@proposed
+---@field refreshSupport? boolean
+
---@class lsp.TextDocumentSyncClientCapabilities
+---
---Whether text document synchronization supports dynamic registration.
---@field dynamicRegistration? boolean
+---
---The client supports sending will save notifications.
---@field willSave? boolean
+---
---The client supports sending a will save request and
---waits for a response providing text edits which will
---be applied to the document before it is saved.
---@field willSaveWaitUntil? boolean
+---
---The client supports did save notifications.
---@field didSave? boolean
---Completion client capabilities
---@class lsp.CompletionClientCapabilities
+---
---Whether completion supports dynamic registration.
---@field dynamicRegistration? boolean
+---
---The client supports the following `CompletionItem` specific
---capabilities.
----@field completionItem? anonym26
----@field completionItemKind? anonym27
+---@field completionItem? lsp._anonym23.completionItem
+---
+---@field completionItemKind? lsp._anonym27.completionItemKind
+---
---Defines how the client handles whitespace and indentation
---when accepting a completion item that uses multi line
---text in either `insertText` or `textEdit`.
---
---@since 3.17.0
---@field insertTextMode? lsp.InsertTextMode
+---
---The client supports to send additional context information for a
---`textDocument/completion` request.
---@field contextSupport? boolean
+---
---The client supports the following `CompletionList` specific
---capabilities.
---
---@since 3.17.0
----@field completionList? anonym28
+---@field completionList? lsp._anonym28.completionList
---@class lsp.HoverClientCapabilities
+---
---Whether hover supports dynamic registration.
---@field dynamicRegistration? boolean
+---
---Client supports the following content formats for the content
---property. The order describes the preferred format of the client.
---@field contentFormat? lsp.MarkupKind[]
---Client Capabilities for a {@link SignatureHelpRequest}.
---@class lsp.SignatureHelpClientCapabilities
+---
---Whether signature help supports dynamic registration.
---@field dynamicRegistration? boolean
+---
---The client supports the following `SignatureInformation`
---specific properties.
----@field signatureInformation? anonym30
+---@field signatureInformation? lsp._anonym29.signatureInformation
+---
---The client supports to send additional context information for a
---`textDocument/signatureHelp` request. A client that opts into
---contextSupport will also support the `retriggerCharacters` on
@@ -3142,17 +3825,21 @@ error('Cannot require a meta file')
---@since 3.14.0
---@class lsp.DeclarationClientCapabilities
+---
---Whether declaration supports dynamic registration. If this is set to `true`
---the client supports the new `DeclarationRegistrationOptions` return value
---for the corresponding server capability as well.
---@field dynamicRegistration? boolean
+---
---The client supports additional metadata in the form of declaration links.
---@field linkSupport? boolean
---Client Capabilities for a {@link DefinitionRequest}.
---@class lsp.DefinitionClientCapabilities
+---
---Whether definition supports dynamic registration.
---@field dynamicRegistration? boolean
+---
---The client supports additional metadata in the form of definition links.
---
---@since 3.14.0
@@ -3160,10 +3847,12 @@ error('Cannot require a meta file')
---Since 3.6.0
---@class lsp.TypeDefinitionClientCapabilities
+---
---Whether implementation supports dynamic registration. If this is set to `true`
---the client supports the new `TypeDefinitionRegistrationOptions` return value
---for the corresponding server capability as well.
---@field dynamicRegistration? boolean
+---
---The client supports additional metadata in the form of definition links.
---
---Since 3.14.0
@@ -3171,10 +3860,12 @@ error('Cannot require a meta file')
---@since 3.6.0
---@class lsp.ImplementationClientCapabilities
+---
---Whether implementation supports dynamic registration. If this is set to `true`
---the client supports the new `ImplementationRegistrationOptions` return value
---for the corresponding server capability as well.
---@field dynamicRegistration? boolean
+---
---The client supports additional metadata in the form of definition links.
---
---@since 3.14.0
@@ -3182,29 +3873,36 @@ error('Cannot require a meta file')
---Client Capabilities for a {@link ReferencesRequest}.
---@class lsp.ReferenceClientCapabilities
+---
---Whether references supports dynamic registration.
---@field dynamicRegistration? boolean
---Client Capabilities for a {@link DocumentHighlightRequest}.
---@class lsp.DocumentHighlightClientCapabilities
+---
---Whether document highlight supports dynamic registration.
---@field dynamicRegistration? boolean
---Client Capabilities for a {@link DocumentSymbolRequest}.
---@class lsp.DocumentSymbolClientCapabilities
+---
---Whether document symbol supports dynamic registration.
---@field dynamicRegistration? boolean
+---
---Specific capabilities for the `SymbolKind` in the
---`textDocument/documentSymbol` request.
----@field symbolKind? anonym31
+---@field symbolKind? lsp._anonym31.symbolKind
+---
---The client supports hierarchical document symbols.
---@field hierarchicalDocumentSymbolSupport? boolean
+---
---The client supports tags on `SymbolInformation`. Tags are supported on
---`DocumentSymbol` if `hierarchicalDocumentSymbolSupport` is set to true.
---Clients supporting tags have to handle unknown tags gracefully.
---
---@since 3.16.0
----@field tagSupport? anonym32
+---@field tagSupport? lsp._anonym32.tagSupport
+---
---The client supports an additional label presented in the UI when
---registering a document symbol provider.
---
@@ -3213,33 +3911,40 @@ error('Cannot require a meta file')
---The Client Capabilities of a {@link CodeActionRequest}.
---@class lsp.CodeActionClientCapabilities
+---
---Whether code action supports dynamic registration.
---@field dynamicRegistration? boolean
+---
---The client support code action literals of type `CodeAction` as a valid
---response of the `textDocument/codeAction` request. If the property is not
---set the request can only return `Command` literals.
---
---@since 3.8.0
----@field codeActionLiteralSupport? anonym34
+---@field codeActionLiteralSupport? lsp._anonym33.codeActionLiteralSupport
+---
---Whether code action supports the `isPreferred` property.
---
---@since 3.15.0
---@field isPreferredSupport? boolean
+---
---Whether code action supports the `disabled` property.
---
---@since 3.16.0
---@field disabledSupport? boolean
+---
---Whether code action supports the `data` property which is
---preserved between a `textDocument/codeAction` and a
---`codeAction/resolve` request.
---
---@since 3.16.0
---@field dataSupport? boolean
+---
---Whether the client supports resolving additional code action
---properties via a separate `codeAction/resolve` request.
---
---@since 3.16.0
----@field resolveSupport? anonym35
+---@field resolveSupport? lsp._anonym35.resolveSupport
+---
---Whether the client honors the change annotations in
---text edits and resource operations returned via the
---`CodeAction#edit` property by for example presenting
@@ -3251,19 +3956,23 @@ error('Cannot require a meta file')
---The client capabilities of a {@link CodeLensRequest}.
---@class lsp.CodeLensClientCapabilities
+---
---Whether code lens supports dynamic registration.
---@field dynamicRegistration? boolean
---The client capabilities of a {@link DocumentLinkRequest}.
---@class lsp.DocumentLinkClientCapabilities
+---
---Whether document link supports dynamic registration.
---@field dynamicRegistration? boolean
+---
---Whether the client supports the `tooltip` property on `DocumentLink`.
---
---@since 3.15.0
---@field tooltipSupport? boolean
---@class lsp.DocumentColorClientCapabilities
+---
---Whether implementation supports dynamic registration. If this is set to `true`
---the client supports the new `DocumentColorRegistrationOptions` return value
---for the corresponding server capability as well.
@@ -3271,13 +3980,16 @@ error('Cannot require a meta file')
---Client capabilities of a {@link DocumentFormattingRequest}.
---@class lsp.DocumentFormattingClientCapabilities
+---
---Whether formatting supports dynamic registration.
---@field dynamicRegistration? boolean
---Client capabilities of a {@link DocumentRangeFormattingRequest}.
---@class lsp.DocumentRangeFormattingClientCapabilities
+---
---Whether range formatting supports dynamic registration.
---@field dynamicRegistration? boolean
+---
---Whether the client supports formatting multiple ranges at once.
---
---@since 3.18.0
@@ -3286,17 +3998,21 @@ error('Cannot require a meta file')
---Client capabilities of a {@link DocumentOnTypeFormattingRequest}.
---@class lsp.DocumentOnTypeFormattingClientCapabilities
+---
---Whether on type formatting supports dynamic registration.
---@field dynamicRegistration? boolean
---@class lsp.RenameClientCapabilities
+---
---Whether rename supports dynamic registration.
---@field dynamicRegistration? boolean
+---
---Client supports testing for validity of rename operations
---before execution.
---
---@since 3.12.0
---@field prepareSupport? boolean
+---
---Client supports the default behavior result.
---
---The value indicates the default behavior used by the
@@ -3304,6 +4020,7 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@field prepareSupportDefaultBehavior? lsp.PrepareSupportDefaultBehavior
+---
---Whether the client honors the change annotations in
---text edits and resource operations returned via the
---rename request's workspace edit by for example presenting
@@ -3314,29 +4031,35 @@ error('Cannot require a meta file')
---@field honorsChangeAnnotations? boolean
---@class lsp.FoldingRangeClientCapabilities
+---
---Whether implementation supports dynamic registration for folding range
---providers. If this is set to `true` the client supports the new
---`FoldingRangeRegistrationOptions` return value for the corresponding
---server capability as well.
---@field dynamicRegistration? boolean
+---
---The maximum number of folding ranges that the client prefers to receive
---per document. The value serves as a hint, servers are free to follow the
---limit.
---@field rangeLimit? uinteger
+---
---If set, the client signals that it only supports folding complete lines.
---If set, client will ignore specified `startCharacter` and `endCharacter`
---properties in a FoldingRange.
---@field lineFoldingOnly? boolean
+---
---Specific options for the folding range kind.
---
---@since 3.17.0
----@field foldingRangeKind? anonym36
+---@field foldingRangeKind? lsp._anonym36.foldingRangeKind
+---
---Specific options for the folding range.
---
---@since 3.17.0
----@field foldingRange? anonym37
+---@field foldingRange? lsp._anonym37.foldingRange
---@class lsp.SelectionRangeClientCapabilities
+---
---Whether implementation supports dynamic registration for selection range providers. If this is set to `true`
---the client supports the new `SelectionRangeRegistrationOptions` return value for the corresponding server
---capability as well.
@@ -3344,22 +4067,27 @@ error('Cannot require a meta file')
---The publish diagnostic client capabilities.
---@class lsp.PublishDiagnosticsClientCapabilities
+---
---Whether the clients accepts diagnostics with related information.
---@field relatedInformation? boolean
+---
---Client supports the tag property to provide meta data about a diagnostic.
---Clients supporting tags have to handle unknown tags gracefully.
---
---@since 3.15.0
----@field tagSupport? anonym38
+---@field tagSupport? lsp._anonym38.tagSupport
+---
---Whether the client interprets the version property of the
---`textDocument/publishDiagnostics` notification's parameter.
---
---@since 3.15.0
---@field versionSupport? boolean
+---
---Client supports a codeDescription property
---
---@since 3.16.0
---@field codeDescriptionSupport? boolean
+---
---Whether code action supports the `data` property which is
---preserved between a `textDocument/publishDiagnostics` and
---`textDocument/codeAction` request.
@@ -3369,6 +4097,7 @@ error('Cannot require a meta file')
---@since 3.16.0
---@class lsp.CallHierarchyClientCapabilities
+---
---Whether implementation supports dynamic registration. If this is set to `true`
---the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
---return value for the corresponding server capability as well.
@@ -3376,10 +4105,12 @@ error('Cannot require a meta file')
---@since 3.16.0
---@class lsp.SemanticTokensClientCapabilities
+---
---Whether implementation supports dynamic registration. If this is set to `true`
---the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
---return value for the corresponding server capability as well.
---@field dynamicRegistration? boolean
+---
---Which requests the client supports and might send to the server
---depending on the server's capability. Please note that clients might not
---show semantic tokens or degrade some of the user experience if a range
@@ -3388,17 +4119,23 @@ error('Cannot require a meta file')
---`request.range` are both set to true but the server only provides a
---range provider the client might not render a minimap correctly or might
---even decide to not show any semantic tokens at all.
----@field requests anonym41
+---@field requests lsp._anonym39.requests
+---
---The token types that the client supports.
---@field tokenTypes string[]
+---
---The token modifiers that the client supports.
---@field tokenModifiers string[]
+---
---The token formats the clients supports.
---@field formats lsp.TokenFormat[]
+---
---Whether the client supports tokens that can overlap each other.
---@field overlappingTokenSupport? boolean
+---
---Whether the client supports tokens that can span multiple lines.
---@field multilineTokenSupport? boolean
+---
---Whether the client allows the server to actively cancel a
---semantic token request, e.g. supports returning
---LSPErrorCodes.ServerCancelled. If a server does the client
@@ -3406,6 +4143,7 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@field serverCancelSupport? boolean
+---
---Whether the client uses semantic tokens to augment existing
---syntax tokens. If set to `true` client side created syntax
---tokens and semantic tokens are both used for colorization. If
@@ -3422,6 +4160,7 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@class lsp.LinkedEditingRangeClientCapabilities
+---
---Whether implementation supports dynamic registration. If this is set to `true`
---the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
---return value for the corresponding server capability as well.
@@ -3431,6 +4170,7 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@class lsp.MonikerClientCapabilities
+---
---Whether moniker supports dynamic registration. If this is set to `true`
---the client supports the new `MonikerRegistrationOptions` return value
---for the corresponding server capability as well.
@@ -3438,6 +4178,7 @@ error('Cannot require a meta file')
---@since 3.17.0
---@class lsp.TypeHierarchyClientCapabilities
+---
---Whether implementation supports dynamic registration. If this is set to `true`
---the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
---return value for the corresponding server capability as well.
@@ -3447,6 +4188,7 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.InlineValueClientCapabilities
+---
---Whether implementation supports dynamic registration for inline value providers.
---@field dynamicRegistration? boolean
@@ -3454,27 +4196,33 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.InlayHintClientCapabilities
+---
---Whether inlay hints support dynamic registration.
---@field dynamicRegistration? boolean
+---
---Indicates which properties a client can resolve lazily on an inlay
---hint.
----@field resolveSupport? anonym42
+---@field resolveSupport? lsp._anonym42.resolveSupport
---Client capabilities specific to diagnostic pull requests.
---
---@since 3.17.0
---@class lsp.DiagnosticClientCapabilities
+---
---Whether implementation supports dynamic registration. If this is set to `true`
---the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
---return value for the corresponding server capability as well.
---@field dynamicRegistration? boolean
+---
---Whether the clients supports related documents for document diagnostic pulls.
---@field relatedDocumentSupport? boolean
---Client capabilities specific to inline completions.
---
---@since 3.18.0
+---@proposed
---@class lsp.InlineCompletionClientCapabilities
+---
---Whether implementation supports dynamic registration for inline completion providers.
---@field dynamicRegistration? boolean
@@ -3482,23 +4230,27 @@ error('Cannot require a meta file')
---
---@since 3.17.0
---@class lsp.NotebookDocumentSyncClientCapabilities
+---
---Whether implementation supports dynamic registration. If this is
---set to `true` the client supports the new
---`(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
---return value for the corresponding server capability as well.
---@field dynamicRegistration? boolean
+---
---The client supports sending execution summary data per cell.
---@field executionSummarySupport? boolean
---Show message request client capabilities
---@class lsp.ShowMessageRequestClientCapabilities
+---
---Capabilities specific to the `MessageActionItem` type.
----@field messageActionItem? anonym43
+---@field messageActionItem? lsp._anonym43.messageActionItem
---Client capabilities for the showDocument request.
---
---@since 3.16.0
---@class lsp.ShowDocumentClientCapabilities
+---
---The client has support for the showDocument
---request.
---@field support boolean
@@ -3507,8 +4259,10 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@class lsp.RegularExpressionsClientCapabilities
+---
---The engine's name.
---@field engine string
+---
---The engine's version.
---@field version? string
@@ -3516,10 +4270,13 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@class lsp.MarkdownClientCapabilities
+---
---The name of the parser.
---@field parser string
+---
---The version of the parser.
---@field version? string
+---
---A list of HTML tags that the client allows / supports in
---Markdown.
---
@@ -3662,18 +4419,13 @@ error('Cannot require a meta file')
---| 1 # Type
---| 2 # Parameter
----Defines whether the insert text in a completion item should be interpreted as
----plain text or a snippet.
----@alias lsp.InsertTextFormat
----| 1 # PlainText
----| 2 # Snippet
-
---The message type
---@alias lsp.MessageType
---| 1 # Error
---| 2 # Warning
---| 3 # Info
---| 4 # Log
+---| 5 # Debug
---Defines how the host (editor) should sync
---document changes to the language server.
@@ -3723,6 +4475,12 @@ error('Cannot require a meta file')
---@alias lsp.CompletionItemTag
---| 1 # Deprecated
+---Defines whether the insert text in a completion item should be interpreted as
+---plain text or a snippet.
+---@alias lsp.InsertTextFormat
+---| 1 # PlainText
+---| 2 # Snippet
+
---How whitespace and indentation is handled during completion
---item insertion.
---
@@ -3766,6 +4524,7 @@ error('Cannot require a meta file')
---Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered.
---
---@since 3.18.0
+---@proposed
---@alias lsp.InlineCompletionTriggerKind
---| 0 # Invoked
---| 1 # Automatic
@@ -3912,11 +4671,11 @@ error('Cannot require a meta file')
---@since 3.17.0
---@alias lsp.DocumentDiagnosticReport lsp.RelatedFullDocumentDiagnosticReport|lsp.RelatedUnchangedDocumentDiagnosticReport
----@alias lsp.PrepareRenameResult lsp.Range|anonym44|anonym45
+---@alias lsp.PrepareRenameResult lsp.Range|lsp._anonym44.PrepareRenameResult|lsp._anonym45.PrepareRenameResult
---A document selector is the combination of one or many document filters.
---
----@sample `let sel:DocumentSelector = [{ language: 'typescript' }, { language: 'json', pattern: '**∕tsconfig.json' }]`;
+---\@sample `let sel:DocumentSelector = [{ language: 'typescript' }, { language: 'json', pattern: '**∕tsconfig.json' }]`;
---
---The use of a string as a document filter is deprecated @since 3.16.0.
---@alias lsp.DocumentSelector lsp.DocumentFilter[]
@@ -3933,7 +4692,7 @@ error('Cannot require a meta file')
---An event describing a change to a text document. If only a text is provided
---it is considered to be the full content of the document.
----@alias lsp.TextDocumentContentChangeEvent anonym46|anonym47
+---@alias lsp.TextDocumentContentChangeEvent lsp._anonym46.TextDocumentContentChangeEvent|lsp._anonym47.TextDocumentContentChangeEvent
---MarkedString can be used to render human readable text. It is either a markdown string
---or a code-block that provides a language and a code snippet. The language identifier
@@ -3947,7 +4706,7 @@ error('Cannot require a meta file')
---
---Note that markdown strings will be sanitized - that means html will be escaped.
---@deprecated use MarkupContent instead.
----@alias lsp.MarkedString string|anonym48
+---@alias lsp.MarkedString string|lsp._anonym48.MarkedString
---A document filter describes a top level text document or
---a notebook cell document.
@@ -3972,120 +4731,145 @@ error('Cannot require a meta file')
---- `*` to match one or more characters in a path segment
---- `?` to match on one character in a path segment
---- `**` to match any number of path segments, including none
----- `{}` to group sub patterns into an OR expression. (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files)
+---- `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files)
---- `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, 
)
---- `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)
---
----@sample A language filter that applies to typescript files on disk: `{ language: 'typescript', scheme: 'file' }`
----@sample A language filter that applies to all package.json paths: `{ language: 'json', pattern: '**package.json' }`
+---\@sample A language filter that applies to typescript files on disk: `{ language: 'typescript', scheme: 'file' }`
+---\@sample A language filter that applies to all package.json paths: `{ language: 'json', pattern: '**package.json' }`
---
---@since 3.17.0
----@alias lsp.TextDocumentFilter anonym49|anonym50|anonym51
+---@alias lsp.TextDocumentFilter lsp._anonym49.TextDocumentFilter|lsp._anonym50.TextDocumentFilter|lsp._anonym51.TextDocumentFilter
---A notebook document filter denotes a notebook document by
---different properties. The properties will be match
---against the notebook's URI (same as with documents)
---
---@since 3.17.0
----@alias lsp.NotebookDocumentFilter anonym52|anonym53|anonym54
+---@alias lsp.NotebookDocumentFilter lsp._anonym52.NotebookDocumentFilter|lsp._anonym53.NotebookDocumentFilter|lsp._anonym54.NotebookDocumentFilter
---The glob pattern to watch relative to the base path. Glob patterns can have the following syntax:
---- `*` to match one or more characters in a path segment
---- `?` to match on one character in a path segment
---- `**` to match any number of path segments, including none
----- `{}` to group conditions (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files)
+---- `{}` to group conditions (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files)
---- `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, 
)
---- `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)
---
---@since 3.17.0
---@alias lsp.Pattern string
----@class anonym1
+---@class lsp._anonym1.serverInfo
+---
---The name of the server as defined by the server.
---@field name string
+---
---The server's version as defined by the server.
---@field version? string
----@class anonym3
+---@class lsp._anonym3.itemDefaults.editRange
+---
---@field insert lsp.Range
+---
---@field replace lsp.Range
----@class anonym2
+---@class lsp._anonym2.itemDefaults
+---
---A default commit character set.
---
---@since 3.17.0
---@field commitCharacters? string[]
+---
---A default edit range.
---
---@since 3.17.0
----@field editRange? lsp.Range|anonym3
+---@field editRange? lsp.Range|lsp._anonym3.itemDefaults.editRange
+---
---A default insert text format.
---
---@since 3.17.0
---@field insertTextFormat? lsp.InsertTextFormat
+---
---A default insert text mode.
---
---@since 3.17.0
---@field insertTextMode? lsp.InsertTextMode
+---
---A default data value.
---
---@since 3.17.0
---@field data? lsp.LSPAny
----@class anonym4
+---@class lsp._anonym4.disabled
+---
---Human readable description of why the code action is currently disabled.
---
---This is displayed in the code actions UI.
---@field reason string
----@class anonym5
+---@class lsp._anonym5.location
+---
---@field uri lsp.DocumentUri
----@class anonym6
+---@class lsp._anonym6.range
----@class anonym7
+---@class lsp._anonym7.full
+---
---The server supports deltas for full documents.
---@field delta? boolean
----@class anonym9
+---@class lsp._anonym9.cells.structure
+---
---The change to the cell array.
---@field array lsp.NotebookCellArrayChange
+---
---Additional opened cell text documents.
---@field didOpen? lsp.TextDocumentItem[]
+---
---Additional closed cell text documents.
---@field didClose? lsp.TextDocumentIdentifier[]
----@class anonym10
+---@class lsp._anonym10.cells.textContent
+---
---@field document lsp.VersionedTextDocumentIdentifier
+---
---@field changes lsp.TextDocumentContentChangeEvent[]
----@class anonym8
+---@class lsp._anonym8.cells
+---
---Changes to the cell structure to add or
---remove cells.
----@field structure? anonym9
+---@field structure? lsp._anonym9.cells.structure
+---
---Changes to notebook cells properties like its
---kind, execution summary or metadata.
---@field data? lsp.NotebookCell[]
+---
---Changes to the text content of notebook cells.
----@field textContent? anonym10[]
+---@field textContent? lsp._anonym10.cells.textContent[]
----@class anonym11
+---@class lsp._anonym11.clientInfo
+---
---The name of the client as defined by the client.
---@field name string
+---
---The client's version as defined by the client.
---@field version? string
----@class anonym12
+---@class lsp._anonym12.workspace
+---
---The server supports workspace folder.
---
---@since 3.6.0
---@field workspaceFolders? lsp.WorkspaceFoldersServerCapabilities
+---
---The server is interested in notifications/requests for operations on files.
---
---@since 3.16.0
---@field fileOperations? lsp.FileOperationOptions
----@class anonym13
+---@class lsp._anonym13.completionItem
+---
---The server has support for completion item label
---details (see also `CompletionItemLabelDetails`) when
---receiving a completion item in a resolve call.
@@ -4093,43 +4877,53 @@ error('Cannot require a meta file')
---@since 3.17.0
---@field labelDetailsSupport? boolean
----@class anonym15
+---@class lsp._anonym15.notebookSelector.cells
+---
---@field language string
----@class anonym14
+---@class lsp._anonym14.notebookSelector
+---
---The notebook to be synced If a string
---value is provided it matches against the
---notebook type. '*' matches every notebook.
---@field notebook string|lsp.NotebookDocumentFilter
+---
---The cells of the matching notebook to be synced.
----@field cells? anonym15[]
+---@field cells? lsp._anonym15.notebookSelector.cells[]
----@class anonym17
+---@class lsp._anonym17.notebookSelector.cells
+---
---@field language string
----@class anonym16
+---@class lsp._anonym16.notebookSelector
+---
---The notebook to be synced If a string
---value is provided it matches against the
---notebook type. '*' matches every notebook.
---@field notebook? string|lsp.NotebookDocumentFilter
+---
---The cells of the matching notebook to be synced.
----@field cells anonym17[]
+---@field cells lsp._anonym17.notebookSelector.cells[]
----@class anonym18
+---@class lsp._anonym18.staleRequestSupport
+---
---The client will actively cancel the request.
---@field cancel boolean
+---
---The list of requests for which the client
---will retry the request if it receives a
---response with error code `ContentModified`
---@field retryOnContentModified string[]
----@class anonym19
+---@class lsp._anonym19.changeAnnotationSupport
+---
---Whether the client groups edits with equal labels into tree nodes,
---for instance all edits labelled with "Changes in Strings" would
---be a tree node.
---@field groupsOnLabel? boolean
----@class anonym20
+---@class lsp._anonym20.symbolKind
+---
---The symbol kind values the client supports. When this
---property exists the client also guarantees that it will
---handle values outside its set gracefully and falls back
@@ -4140,27 +4934,33 @@ error('Cannot require a meta file')
---the initial version of the protocol.
---@field valueSet? lsp.SymbolKind[]
----@class anonym21
+---@class lsp._anonym21.tagSupport
+---
---The tags supported by the client.
---@field valueSet lsp.SymbolTag[]
----@class anonym22
+---@class lsp._anonym22.resolveSupport
+---
---The properties that a client can resolve lazily. Usually
---`location.range`
---@field properties string[]
----@class anonym24
+---@class lsp._anonym24.completionItem.tagSupport
+---
---The tags supported by the client.
---@field valueSet lsp.CompletionItemTag[]
----@class anonym25
+---@class lsp._anonym25.completionItem.resolveSupport
+---
---The properties that a client can resolve lazily.
---@field properties string[]
----@class anonym26
+---@class lsp._anonym26.completionItem.insertTextModeSupport
+---
---@field valueSet lsp.InsertTextMode[]
----@class anonym23
+---@class lsp._anonym23.completionItem
+---
---Client supports snippets as insert text.
---
---A snippet can define tab stops and placeholders with `$1`, `$2`
@@ -4168,46 +4968,56 @@ error('Cannot require a meta file')
---the end of the snippet. Placeholders with equal identifiers are linked,
---that is typing in one will update others too.
---@field snippetSupport? boolean
+---
---Client supports commit characters on a completion item.
---@field commitCharactersSupport? boolean
+---
---Client supports the following content formats for the documentation
---property. The order describes the preferred format of the client.
---@field documentationFormat? lsp.MarkupKind[]
+---
---Client supports the deprecated property on a completion item.
---@field deprecatedSupport? boolean
+---
---Client supports the preselect property on a completion item.
---@field preselectSupport? boolean
+---
---Client supports the tag property on a completion item. Clients supporting
---tags have to handle unknown tags gracefully. Clients especially need to
---preserve unknown tags when sending a completion item back to the server in
---a resolve call.
---
---@since 3.15.0
----@field tagSupport? anonym24
+---@field tagSupport? lsp._anonym24.completionItem.tagSupport
+---
---Client support insert replace edit to control different behavior if a
---completion item is inserted in the text or should replace text.
---
---@since 3.16.0
---@field insertReplaceSupport? boolean
+---
---Indicates which properties a client can resolve lazily on a completion
---item. Before version 3.16.0 only the predefined properties `documentation`
---and `details` could be resolved lazily.
---
---@since 3.16.0
----@field resolveSupport? anonym25
+---@field resolveSupport? lsp._anonym25.completionItem.resolveSupport
+---
---The client supports the `insertTextMode` property on
---a completion item to override the whitespace handling mode
---as defined by the client (see `insertTextMode`).
---
---@since 3.16.0
----@field insertTextModeSupport? anonym26
+---@field insertTextModeSupport? lsp._anonym26.completionItem.insertTextModeSupport
+---
---The client has support for completion item label
---details (see also `CompletionItemLabelDetails`).
---
---@since 3.17.0
---@field labelDetailsSupport? boolean
----@class anonym27
+---@class lsp._anonym27.completionItemKind
+---
---The completion item kind values the client supports. When this
---property exists the client also guarantees that it will
---handle values outside its set gracefully and falls back
@@ -4218,7 +5028,8 @@ error('Cannot require a meta file')
---the initial version of the protocol.
---@field valueSet? lsp.CompletionItemKind[]
----@class anonym28
+---@class lsp._anonym28.completionList
+---
---The client supports the following itemDefaults on
---a completion list.
---
@@ -4229,26 +5040,38 @@ error('Cannot require a meta file')
---@since 3.17.0
---@field itemDefaults? string[]
----@class anonym30
+---@class lsp._anonym30.signatureInformation.parameterInformation
+---
---The client supports processing label offsets instead of a
---simple label string.
---
---@since 3.14.0
---@field labelOffsetSupport? boolean
----@class anonym29
+---@class lsp._anonym29.signatureInformation
+---
---Client supports the following content formats for the documentation
---property. The order describes the preferred format of the client.
---@field documentationFormat? lsp.MarkupKind[]
+---
---Client capabilities specific to parameter information.
----@field parameterInformation? anonym30
+---@field parameterInformation? lsp._anonym30.signatureInformation.parameterInformation
+---
---The client supports the `activeParameter` property on `SignatureInformation`
---literal.
---
---@since 3.16.0
---@field activeParameterSupport? boolean
+---
+---The client supports the `activeParameter` property on
+---`SignatureInformation` being set to `null` to indicate that no
+---parameter should be active.
+---
+---@since 3.18.0
+---@field noActiveParameterSupport? boolean
----@class anonym31
+---@class lsp._anonym31.symbolKind
+---
---The symbol kind values the client supports. When this
---property exists the client also guarantees that it will
---handle values outside its set gracefully and falls back
@@ -4259,138 +5082,177 @@ error('Cannot require a meta file')
---the initial version of the protocol.
---@field valueSet? lsp.SymbolKind[]
----@class anonym32
+---@class lsp._anonym32.tagSupport
+---
---The tags supported by the client.
---@field valueSet lsp.SymbolTag[]
----@class anonym34
+---@class lsp._anonym34.codeActionLiteralSupport.codeActionKind
+---
---The code action kind values the client supports. When this
---property exists the client also guarantees that it will
---handle values outside its set gracefully and falls back
---to a default value when unknown.
---@field valueSet lsp.CodeActionKind[]
----@class anonym33
+---@class lsp._anonym33.codeActionLiteralSupport
+---
---The code action kind is support with the following value
---set.
----@field codeActionKind anonym34
+---@field codeActionKind lsp._anonym34.codeActionLiteralSupport.codeActionKind
----@class anonym35
+---@class lsp._anonym35.resolveSupport
+---
---The properties that a client can resolve lazily.
---@field properties string[]
----@class anonym36
+---@class lsp._anonym36.foldingRangeKind
+---
---The folding range kind values the client supports. When this
---property exists the client also guarantees that it will
---handle values outside its set gracefully and falls back
---to a default value when unknown.
---@field valueSet? lsp.FoldingRangeKind[]
----@class anonym37
+---@class lsp._anonym37.foldingRange
+---
---If set, the client signals that it supports setting collapsedText on
---folding ranges to display custom labels instead of the default text.
---
---@since 3.17.0
---@field collapsedText? boolean
----@class anonym38
+---@class lsp._anonym38.tagSupport
+---
---The tags supported by the client.
---@field valueSet lsp.DiagnosticTag[]
----@class anonym40
+---@class lsp._anonym40.requests.range
----@class anonym41
+---@class lsp._anonym41.requests.full
+---
---The client will send the `textDocument/semanticTokens/full/delta` request if
---the server provides a corresponding handler.
---@field delta? boolean
----@class anonym39
+---@class lsp._anonym39.requests
+---
---The client will send the `textDocument/semanticTokens/range` request if
---the server provides a corresponding handler.
----@field range? boolean|anonym40
+---@field range? boolean|lsp._anonym40.requests.range
+---
---The client will send the `textDocument/semanticTokens/full` request if
---the server provides a corresponding handler.
----@field full? boolean|anonym41
+---@field full? boolean|lsp._anonym41.requests.full
----@class anonym42
+---@class lsp._anonym42.resolveSupport
+---
---The properties that a client can resolve lazily.
---@field properties string[]
----@class anonym43
+---@class lsp._anonym43.messageActionItem
+---
---Whether the client supports additional attributes which
---are preserved and send back to the server in the
---request's response.
---@field additionalPropertiesSupport? boolean
----@class anonym44
+---@class lsp._anonym44.PrepareRenameResult
+---
---@field range lsp.Range
+---
---@field placeholder string
----@class anonym45
+---@class lsp._anonym45.PrepareRenameResult
+---
---@field defaultBehavior boolean
----@class anonym46
+---@class lsp._anonym46.TextDocumentContentChangeEvent
+---
---The range of the document that changed.
---@field range lsp.Range
+---
---The optional length of the range that got replaced.
---
---@deprecated use range instead.
---@field rangeLength? uinteger
+---
---The new text for the provided range.
---@field text string
----@class anonym47
+---@class lsp._anonym47.TextDocumentContentChangeEvent
+---
---The new text of the whole document.
---@field text string
----@class anonym48
+---@class lsp._anonym48.MarkedString
+---
---@field language string
+---
---@field value string
----@class anonym49
+---@class lsp._anonym49.TextDocumentFilter
+---
---A language id, like `typescript`.
---@field language string
+---
---A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
---@field scheme? string
----A glob pattern, like `*.{ts,js}`.
+---
+---A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples.
---@field pattern? string
----@class anonym50
+---@class lsp._anonym50.TextDocumentFilter
+---
---A language id, like `typescript`.
---@field language? string
+---
---A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
---@field scheme string
----A glob pattern, like `*.{ts,js}`.
+---
+---A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples.
---@field pattern? string
----@class anonym51
+---@class lsp._anonym51.TextDocumentFilter
+---
---A language id, like `typescript`.
---@field language? string
+---
---A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
---@field scheme? string
----A glob pattern, like `*.{ts,js}`.
+---
+---A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples.
---@field pattern string
----@class anonym52
+---@class lsp._anonym52.NotebookDocumentFilter
+---
---The type of the enclosing notebook.
---@field notebookType string
+---
---A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
---@field scheme? string
+---
---A glob pattern.
---@field pattern? string
----@class anonym53
+---@class lsp._anonym53.NotebookDocumentFilter
+---
---The type of the enclosing notebook.
---@field notebookType? string
+---
---A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
---@field scheme string
+---
---A glob pattern.
---@field pattern? string
----@class anonym54
+---@class lsp._anonym54.NotebookDocumentFilter
+---
---The type of the enclosing notebook.
---@field notebookType? string
+---
---A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
---@field scheme? string
+---
---A glob pattern.
---@field pattern string
diff --git a/runtime/lua/vim/lsp/tagfunc.lua b/runtime/lua/vim/lsp/_tagfunc.lua
index 4ad50e4a58..4ad50e4a58 100644
--- a/runtime/lua/vim/lsp/tagfunc.lua
+++ b/runtime/lua/vim/lsp/_tagfunc.lua
diff --git a/runtime/lua/vim/lsp/_watchfiles.lua b/runtime/lua/vim/lsp/_watchfiles.lua
index 1fd112631d..49328fbe9b 100644
--- a/runtime/lua/vim/lsp/_watchfiles.lua
+++ b/runtime/lua/vim/lsp/_watchfiles.lua
@@ -1,95 +1,20 @@
local bit = require('bit')
-local watch = require('vim._watch')
+local glob = vim.glob
+local watch = vim._watch
local protocol = require('vim.lsp.protocol')
local ms = protocol.Methods
local lpeg = vim.lpeg
local M = {}
---- Parses the raw pattern into an |lpeg| pattern. LPeg patterns natively support the "this" or "that"
---- alternative constructions described in the LSP spec that cannot be expressed in a standard Lua pattern.
----
----@param pattern string The raw glob pattern
----@return vim.lpeg.Pattern? pattern An |lpeg| representation of the pattern, or nil if the pattern is invalid.
-local function parse(pattern)
- local l = lpeg
-
- local P, S, V = lpeg.P, lpeg.S, lpeg.V
- local C, Cc, Ct, Cf = lpeg.C, lpeg.Cc, lpeg.Ct, lpeg.Cf
-
- local pathsep = '/'
-
- local function class(inv, ranges)
- for i, r in ipairs(ranges) do
- ranges[i] = r[1] .. r[2]
- end
- local patt = l.R(unpack(ranges))
- if inv == '!' then
- patt = P(1) - patt
- end
- return patt
- end
-
- local function add(acc, a)
- return acc + a
- end
-
- local function mul(acc, m)
- return acc * m
- end
-
- local function star(stars, after)
- return (-after * (l.P(1) - pathsep)) ^ #stars * after
- end
-
- local function dstar(after)
- return (-after * l.P(1)) ^ 0 * after
- end
-
- local p = P({
- 'Pattern',
- Pattern = V('Elem') ^ -1 * V('End'),
- Elem = Cf(
- (V('DStar') + V('Star') + V('Ques') + V('Class') + V('CondList') + V('Literal'))
- * (V('Elem') + V('End')),
- mul
- ),
- DStar = P('**') * (P(pathsep) * (V('Elem') + V('End')) + V('End')) / dstar,
- Star = C(P('*') ^ 1) * (V('Elem') + V('End')) / star,
- Ques = P('?') * Cc(l.P(1) - pathsep),
- Class = P('[') * C(P('!') ^ -1) * Ct(Ct(C(1) * '-' * C(P(1) - ']')) ^ 1 * ']') / class,
- CondList = P('{') * Cf(V('Cond') * (P(',') * V('Cond')) ^ 0, add) * '}',
- -- TODO: '*' inside a {} condition is interpreted literally but should probably have the same
- -- wildcard semantics it usually has.
- -- Fixing this is non-trivial because '*' should match non-greedily up to "the rest of the
- -- pattern" which in all other cases is the entire succeeding part of the pattern, but at the end of a {}
- -- condition means "everything after the {}" where several other options separated by ',' may
- -- exist in between that should not be matched by '*'.
- Cond = Cf((V('Ques') + V('Class') + V('CondList') + (V('Literal') - S(',}'))) ^ 1, mul)
- + Cc(l.P(0)),
- Literal = P(1) / l.P,
- End = P(-1) * Cc(l.P(-1)),
- })
-
- return p:match(pattern) --[[@as vim.lpeg.Pattern?]]
-end
-
----@private
---- Implementation of LSP 3.17.0's pattern matching: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#pattern
----
----@param pattern string|vim.lpeg.Pattern The glob pattern (raw or parsed) to match.
----@param s string The string to match against pattern.
----@return boolean Whether or not pattern matches s.
-function M._match(pattern, s)
- if type(pattern) == 'string' then
- local p = assert(parse(pattern))
- return p:match(s) ~= nil
- end
- return pattern:match(s) ~= nil
+if vim.fn.has('win32') == 1 or vim.fn.has('mac') == 1 then
+ M._watchfunc = watch.watch
+elseif vim.fn.executable('fswatch') == 1 then
+ M._watchfunc = watch.fswatch
+else
+ M._watchfunc = watch.watchdirs
end
-M._watchfunc = (vim.fn.has('win32') == 1 or vim.fn.has('mac') == 1) and watch.watch or watch.poll
-
---@type table<integer, table<string, function[]>> client id -> registration id -> cancel function
local cancels = vim.defaulttable()
@@ -112,9 +37,9 @@ local to_lsp_change_type = {
--- Default excludes the same as VSCode's `files.watcherExclude` setting.
--- https://github.com/microsoft/vscode/blob/eef30e7165e19b33daa1e15e92fa34ff4a5df0d3/src/vs/workbench/contrib/files/browser/files.contribution.ts#L261
---@type vim.lpeg.Pattern parsed Lpeg pattern
-M._poll_exclude_pattern = parse('**/.git/{objects,subtree-cache}/**')
- + parse('**/node_modules/*/**')
- + parse('**/.hg/store/**')
+M._poll_exclude_pattern = glob.to_lpeg('**/.git/{objects,subtree-cache}/**')
+ + glob.to_lpeg('**/node_modules/*/**')
+ + glob.to_lpeg('**/.hg/store/**')
--- Registers the workspace/didChangeWatchedFiles capability dynamically.
---
@@ -125,12 +50,8 @@ function M.register(reg, ctx)
local client = assert(vim.lsp.get_client_by_id(client_id), 'Client must be running')
-- Ill-behaved servers may not honor the client capability and try to register
-- anyway, so ignore requests when the user has opted out of the feature.
- local has_capability = vim.tbl_get(
- client.config.capabilities or {},
- 'workspace',
- 'didChangeWatchedFiles',
- 'dynamicRegistration'
- )
+ local has_capability =
+ vim.tbl_get(client.capabilities, 'workspace', 'didChangeWatchedFiles', 'dynamicRegistration')
if not has_capability or not client.workspace_folders then
return
end
@@ -143,7 +64,7 @@ function M.register(reg, ctx)
local glob_pattern = w.globPattern
if type(glob_pattern) == 'string' then
- local pattern = parse(glob_pattern)
+ local pattern = glob.to_lpeg(glob_pattern)
if not pattern then
error('Cannot parse pattern: ' .. glob_pattern)
end
@@ -155,7 +76,7 @@ function M.register(reg, ctx)
local base_uri = glob_pattern.baseUri
local uri = type(base_uri) == 'string' and base_uri or base_uri.uri
local base_dir = vim.uri_to_fname(uri)
- local pattern = parse(glob_pattern.pattern)
+ local pattern = glob.to_lpeg(glob_pattern.pattern)
if not pattern then
error('Cannot parse pattern: ' .. glob_pattern.pattern)
end
@@ -248,4 +169,13 @@ function M.unregister(unreg, ctx)
end
end
+--- @param client_id integer
+function M.cancel(client_id)
+ for _, reg_cancels in pairs(cancels[client_id]) do
+ for _, cancel in pairs(reg_cancels) do
+ cancel()
+ end
+ end
+end
+
return M
diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua
index cf9acc0808..50121f30b2 100644
--- a/runtime/lua/vim/lsp/buf.lua
+++ b/runtime/lua/vim/lsp/buf.lua
@@ -11,8 +11,8 @@ local M = {}
---
---@param method (string) LSP method name
---@param params (table|nil) Parameters to send to the server
----@param handler (function|nil) See |lsp-handler|. Follows |lsp-handler-resolution|
---
+---@param handler lsp.Handler? See |lsp-handler|. Follows |lsp-handler-resolution|
+---
---@return table<integer, integer> client_request_ids Map of client-id:request-id pairs
---for all successful requests.
---@return function _cancel_all_requests Function which can be used to
@@ -28,16 +28,6 @@ local function request(method, params, handler)
return vim.lsp.buf_request(0, method, params, handler)
end
---- Checks whether the language servers attached to the current buffer are
---- ready.
----
----@return boolean if server responds.
----@deprecated
-function M.server_ready()
- vim.deprecate('vim.lsp.buf.server_ready', nil, '0.10.0')
- return not not vim.lsp.buf_notify(0, 'window/progress', {})
-end
-
--- Displays hover information about the symbol under the cursor in a floating
--- window. Calling the function twice will jump into the floating window.
function M.hover()
@@ -46,10 +36,10 @@ function M.hover()
end
local function request_with_options(name, params, options)
- local req_handler
+ local req_handler --- @type function?
if options then
req_handler = function(err, result, ctx, config)
- local client = vim.lsp.get_client_by_id(ctx.client_id)
+ local client = assert(vim.lsp.get_client_by_id(ctx.client_id))
local handler = client.handlers[name] or vim.lsp.handlers[name]
handler(err, result, ctx, vim.tbl_extend('force', config or {}, options))
end
@@ -57,35 +47,57 @@ local function request_with_options(name, params, options)
request(name, params, req_handler)
end
---- Jumps to the declaration of the symbol under the cursor.
----@note Many servers do not implement this method. Generally, see |vim.lsp.buf.definition()| instead.
+--- @class vim.lsp.ListOpts
---
----@param options table|nil additional options
---- - reuse_win: (boolean) Jump to existing window if buffer is already open.
---- - on_list: (function) |lsp-on-list-handler| replacing the default handler.
---- Called for any non-empty result.
+--- list-handler replacing the default handler.
+--- Called for any non-empty result.
+--- This table can be used with |setqflist()| or |setloclist()|. E.g.:
+--- ```lua
+--- local function on_list(options)
+--- vim.fn.setqflist({}, ' ', options)
+--- vim.cmd.cfirst()
+--- end
+---
+--- vim.lsp.buf.definition({ on_list = on_list })
+--- vim.lsp.buf.references(nil, { on_list = on_list })
+--- ```
+---
+--- If you prefer loclist do something like this:
+--- ```lua
+--- local function on_list(options)
+--- vim.fn.setloclist(0, {}, ' ', options)
+--- vim.cmd.lopen()
+--- end
+--- ```
+--- @field on_list? fun(t: vim.lsp.LocationOpts.OnList)
+
+--- @class vim.lsp.LocationOpts.OnList
+--- @field items table[] Structured like |setqflist-what|
+--- @field title? string Title for the list.
+--- @field context? table `ctx` from |lsp-handler|
+
+--- @class vim.lsp.LocationOpts: vim.lsp.ListOpts
+---
+--- Jump to existing window if buffer is already open.
+--- @field reuse_win? boolean
+
+--- Jumps to the declaration of the symbol under the cursor.
+--- @note Many servers do not implement this method. Generally, see |vim.lsp.buf.definition()| instead.
+--- @param options? vim.lsp.LocationOpts
function M.declaration(options)
local params = util.make_position_params()
request_with_options(ms.textDocument_declaration, params, options)
end
--- Jumps to the definition of the symbol under the cursor.
----
----@param options table|nil additional options
---- - reuse_win: (boolean) Jump to existing window if buffer is already open.
---- - on_list: (function) |lsp-on-list-handler| replacing the default handler.
---- Called for any non-empty result.
+--- @param options? vim.lsp.LocationOpts
function M.definition(options)
local params = util.make_position_params()
request_with_options(ms.textDocument_definition, params, options)
end
--- Jumps to the definition of the type of the symbol under the cursor.
----
----@param options table|nil additional options
---- - reuse_win: (boolean) Jump to existing window if buffer is already open.
---- - on_list: (function) |lsp-on-list-handler| replacing the default handler.
---- Called for any non-empty result.
+--- @param options? vim.lsp.LocationOpts
function M.type_definition(options)
local params = util.make_position_params()
request_with_options(ms.textDocument_typeDefinition, params, options)
@@ -93,10 +105,7 @@ end
--- Lists all the implementations for the symbol under the cursor in the
--- quickfix window.
----
----@param options table|nil additional options
---- - on_list: (function) |lsp-on-list-handler| replacing the default handler.
---- Called for any non-empty result.
+--- @param options? vim.lsp.LocationOpts
function M.implementation(options)
local params = util.make_position_params()
request_with_options(ms.textDocument_implementation, params, options)
@@ -156,44 +165,55 @@ local function range_from_selection(bufnr, mode)
}
end
+--- @class vim.lsp.buf.format.Opts
+--- @inlinedoc
+---
+--- Can be used to specify FormattingOptions. Some unspecified options will be
+--- automatically derived from the current Nvim options.
+--- See https://microsoft.github.io/language-server-protocol/specification/#formattingOptions
+--- @field formatting_options? table
+---
+--- Time in milliseconds to block for formatting requests. No effect if async=true.
+--- (default: `1000`)
+--- @field timeout_ms? integer
+---
+--- Restrict formatting to the clients attached to the given buffer.
+--- (default: current buffer)
+--- @field bufnr? integer
+---
+--- Predicate used to filter clients. Receives a client as argument and must
+--- return a boolean. Clients matching the predicate are included. Example:
+--- ```lua
+--- -- Never request typescript-language-server for formatting
+--- vim.lsp.buf.format {
+--- filter = function(client) return client.name ~= "tsserver" end
+--- }
+--- ```
+--- @field filter? fun(client: vim.lsp.Client): boolean?
+---
+--- If true the method won't block.
+--- Editing the buffer while formatting asynchronous can lead to unexpected
+--- changes.
+--- (Default: false)
+--- @field async? boolean
+---
+--- Restrict formatting to the client with ID (client.id) matching this field.
+--- @field id? integer
+---
+--- Restrict formatting to the client with name (client.name) matching this field.
+--- @field name? string
+---
+--- Range to format.
+--- Table must contain `start` and `end` keys with {row,col} tuples using
+--- (1,0) indexing.
+--- (Default: current selection in visual mode, `nil` in other modes,
+--- formatting the full buffer)
+--- @field range? {start:integer[],end:integer[]}
+
--- Formats a buffer using the attached (and optionally filtered) language
--- server clients.
---
---- @param options table|nil Optional table which holds the following optional fields:
---- - formatting_options (table|nil):
---- Can be used to specify FormattingOptions. Some unspecified options will be
---- automatically derived from the current Nvim options.
---- See https://microsoft.github.io/language-server-protocol/specification/#formattingOptions
---- - timeout_ms (integer|nil, default 1000):
---- Time in milliseconds to block for formatting requests. No effect if async=true
---- - bufnr (number|nil):
---- Restrict formatting to the clients attached to the given buffer, defaults to the current
---- buffer (0).
----
---- - filter (function|nil):
---- Predicate used to filter clients. Receives a client as argument and must return a
---- boolean. Clients matching the predicate are included. Example: <pre>lua
---- -- Never request typescript-language-server for formatting
---- vim.lsp.buf.format {
---- filter = function(client) return client.name ~= "tsserver" end
---- }
---- </pre>
----
---- - async boolean|nil
---- If true the method won't block. Defaults to false.
---- Editing the buffer while formatting asynchronous can lead to unexpected
---- changes.
----
---- - id (number|nil):
---- Restrict formatting to the client with ID (client.id) matching this field.
---- - name (string|nil):
---- Restrict formatting to the client with name (client.name) matching this field.
----
---- - range (table|nil) Range to format.
---- Table must contain `start` and `end` keys with {row,col} tuples using
---- (1,0) indexing.
---- Defaults to current selection in visual mode
---- Defaults to `nil` in other modes, formatting the full buffer
+--- @param options? vim.lsp.buf.format.Opts
function M.format(options)
options = options or {}
local bufnr = options.bufnr or api.nvim_get_current_buf()
@@ -218,6 +238,9 @@ function M.format(options)
vim.notify('[LSP] Format request failed, no matching language servers.')
end
+ --- @param client vim.lsp.Client
+ --- @param params lsp.DocumentFormattingParams
+ --- @return lsp.DocumentFormattingParams
local function set_range(client, params)
if range then
local range_params =
@@ -228,8 +251,7 @@ function M.format(options)
end
if options.async then
- local do_format
- do_format = function(idx, client)
+ local function do_format(idx, client)
if not client then
return
end
@@ -255,17 +277,25 @@ function M.format(options)
end
end
+--- @class vim.lsp.buf.rename.Opts
+--- @inlinedoc
+---
+--- Predicate used to filter clients. Receives a client as argument and
+--- must return a boolean. Clients matching the predicate are included.
+--- @field filter? fun(client: vim.lsp.Client): boolean?
+---
+--- Restrict clients used for rename to ones where client.name matches
+--- this field.
+--- @field name? string
+---
+--- (default: current buffer)
+--- @field bufnr? integer
+
--- Renames all references to the symbol under the cursor.
---
---@param new_name string|nil If not provided, the user will be prompted for a new
--- name using |vim.ui.input()|.
----@param options table|nil additional options
---- - filter (function|nil):
---- Predicate used to filter clients. Receives a client as argument and
---- must return a boolean. Clients matching the predicate are included.
---- - name (string|nil):
---- Restrict clients used for rename to ones where client.name matches
---- this field.
+---@param options? vim.lsp.buf.rename.Opts Additional options:
function M.rename(new_name, options)
options = options or {}
local bufnr = options.bufnr or api.nvim_get_current_buf()
@@ -299,12 +329,12 @@ function M.rename(new_name, options)
)[1]
end
- local try_use_client
- try_use_client = function(idx, client)
+ local function try_use_client(idx, client)
if not client then
return
end
+ --- @param name string
local function rename(name)
local params = util.make_position_params(win, client.offset_encoding)
params.newName = name
@@ -385,8 +415,7 @@ end
---
---@param context (table|nil) Context for the request
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_references
----@param options table|nil additional options
---- - on_list: (function) handler for list results. See |lsp-on-list-handler|
+---@param options? vim.lsp.ListOpts
function M.references(context, options)
validate({ context = { context, 't', true } })
local params = util.make_position_params()
@@ -397,14 +426,13 @@ function M.references(context, options)
end
--- Lists all symbols in the current buffer in the quickfix window.
----
----@param options table|nil additional options
---- - on_list: (function) handler for list results. See |lsp-on-list-handler|
+--- @param options? vim.lsp.ListOpts
function M.document_symbol(options)
local params = { textDocument = util.make_text_document_params() }
request_with_options(ms.textDocument_documentSymbol, params, options)
end
+--- @param call_hierarchy_items lsp.CallHierarchyItem[]?
local function pick_call_hierarchy_item(call_hierarchy_items)
if not call_hierarchy_items then
return
@@ -424,8 +452,10 @@ local function pick_call_hierarchy_item(call_hierarchy_items)
return choice
end
+--- @param method string
local function call_hierarchy(method)
local params = util.make_position_params()
+ --- @param result lsp.CallHierarchyItem[]?
request(ms.textDocument_prepareCallHierarchy, params, function(err, result, ctx)
if err then
vim.notify(err.message, vim.log.levels.WARN)
@@ -472,6 +502,7 @@ end
--- Add the folder at path to the workspace folders. If {path} is
--- not provided, the user will be prompted for a path using |input()|.
+--- @param workspace_folder? string
function M.add_workspace_folder(workspace_folder)
workspace_folder = workspace_folder
or npcall(vim.fn.input, 'Workspace Folder: ', vim.fn.expand('%:p:h'), 'dir')
@@ -511,6 +542,7 @@ end
--- Remove the folder at path from the workspace folders. If
--- {path} is not provided, the user will be prompted for
--- a path using |input()|.
+--- @param workspace_folder? string
function M.remove_workspace_folder(workspace_folder)
workspace_folder = workspace_folder
or npcall(vim.fn.input, 'Workspace Folder: ', vim.fn.expand('%:p:h'))
@@ -542,9 +574,8 @@ end
--- call, the user is prompted to enter a string on the command line. An empty
--- string means no filtering is done.
---
----@param query string|nil optional
----@param options table|nil additional options
---- - on_list: (function) handler for list results. See |lsp-on-list-handler|
+--- @param query string? optional
+--- @param options? vim.lsp.ListOpts
function M.workspace_symbol(query, options)
query = query or npcall(vim.fn.input, 'Query: ')
if query == nil then
@@ -579,16 +610,36 @@ function M.clear_references()
util.buf_clear_references()
end
+---@nodoc
---@class vim.lsp.CodeActionResultEntry
---@field error? lsp.ResponseError
---@field result? (lsp.Command|lsp.CodeAction)[]
---@field ctx lsp.HandlerContext
----@class vim.lsp.buf.code_action.opts
----@field context? lsp.CodeActionContext
----@field filter? fun(x: lsp.CodeAction|lsp.Command):boolean
----@field apply? boolean
----@field range? {start: integer[], end: integer[]}
+--- @class vim.lsp.buf.code_action.Opts
+--- @inlinedoc
+---
+--- Corresponds to `CodeActionContext` of the LSP specification:
+--- - {diagnostics}? (`table`) LSP `Diagnostic[]`. Inferred from the current
+--- position if not provided.
+--- - {only}? (`table`) List of LSP `CodeActionKind`s used to filter the code actions.
+--- Most language servers support values like `refactor`
+--- or `quickfix`.
+--- - {triggerKind}? (`integer`) The reason why code actions were requested.
+--- @field context? lsp.CodeActionContext
+---
+--- Predicate taking an `CodeAction` and returning a boolean.
+--- @field filter? fun(x: lsp.CodeAction|lsp.Command):boolean
+---
+--- When set to `true`, and there is just one remaining action
+--- (after filtering), the action is applied without user query.
+--- @field apply? boolean
+---
+--- Range for which code actions should be requested.
+--- If in visual mode this defaults to the active selection.
+--- Table must contain `start` and `end` keys with {row,col} tuples
+--- using mark-like indexing. See |api-indexing|
+--- @field range? {start: integer[], end: integer[]}
--- This is not public because the main extension point is
--- vim.ui.select which can be overridden independently.
@@ -599,7 +650,7 @@ end
--- need to be able to link a `CodeAction|Command` to the right client for
--- `codeAction/resolve`
---@param results table<integer, vim.lsp.CodeActionResultEntry>
----@param opts? vim.lsp.buf.code_action.opts
+---@param opts? vim.lsp.buf.code_action.Opts
local function on_code_action_results(results, opts)
---@param a lsp.Command|lsp.CodeAction
local function action_filter(a)
@@ -644,15 +695,16 @@ local function on_code_action_results(results, opts)
end
---@param action lsp.Command|lsp.CodeAction
- ---@param client lsp.Client
+ ---@param client vim.lsp.Client
---@param ctx lsp.HandlerContext
local function apply_action(action, client, ctx)
if action.edit then
util.apply_workspace_edit(action.edit, client.offset_encoding)
end
- if action.command then
- local command = type(action.command) == 'table' and action.command or action
- client._exec_cmd(command, ctx)
+ local a_cmd = action.command
+ if a_cmd then
+ local command = type(a_cmd) == 'table' and a_cmd or action
+ client:_exec_cmd(command, ctx)
end
end
@@ -673,7 +725,6 @@ local function on_code_action_results(results, opts)
-- command: string
-- arguments?: any[]
--
- ---@type lsp.Client
local client = assert(vim.lsp.get_client_by_id(choice.ctx.client_id))
local action = choice.action
local bufnr = assert(choice.ctx.bufnr, 'Must have buffer number')
@@ -723,29 +774,7 @@ end
--- Selects a code action available at the current
--- cursor position.
---
----@param options table|nil Optional table which holds the following optional fields:
---- - context: (table|nil)
---- Corresponds to `CodeActionContext` of the LSP specification:
---- - diagnostics (table|nil):
---- LSP `Diagnostic[]`. Inferred from the current
---- position if not provided.
---- - only (table|nil):
---- List of LSP `CodeActionKind`s used to filter the code actions.
---- Most language servers support values like `refactor`
---- or `quickfix`.
---- - triggerKind (number|nil): The reason why code actions were requested.
---- - filter: (function|nil)
---- Predicate taking an `CodeAction` and returning a boolean.
---- - apply: (boolean|nil)
---- When set to `true`, and there is just one remaining action
---- (after filtering), the action is applied without user query.
----
---- - range: (table|nil)
---- Range for which code actions should be requested.
---- If in visual mode this defaults to the active selection.
---- Table must contain `start` and `end` keys with {row,col} tuples
---- using mark-like indexing. See |api-indexing|
----
+---@param options? vim.lsp.buf.code_action.Opts
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction
---@see vim.lsp.protocol.CodeActionTriggerKind
function M.code_action(options)
@@ -753,6 +782,7 @@ function M.code_action(options)
options = options or {}
-- Detect old API call code_action(context) which should now be
-- code_action({ context = context} )
+ --- @diagnostic disable-next-line:undefined-field
if options.diagnostics or options.only then
options = { options = options }
end
@@ -811,9 +841,8 @@ function M.code_action(options)
end
--- Executes an LSP server command.
----
----@param command_params table A valid `ExecuteCommandParams` object
----@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand
+--- @param command_params lsp.ExecuteCommandParams
+--- @see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand
function M.execute_command(command_params)
validate({
command = { command_params.command, 's' },
diff --git a/runtime/lua/vim/lsp/client.lua b/runtime/lua/vim/lsp/client.lua
new file mode 100644
index 0000000000..ff0db166d5
--- /dev/null
+++ b/runtime/lua/vim/lsp/client.lua
@@ -0,0 +1,1056 @@
+local uv = vim.uv
+local api = vim.api
+local lsp = vim.lsp
+local log = lsp.log
+local ms = lsp.protocol.Methods
+local changetracking = lsp._changetracking
+local validate = vim.validate
+
+--- @alias vim.lsp.client.on_init_cb fun(client: vim.lsp.Client, initialize_result: lsp.InitializeResult)
+--- @alias vim.lsp.client.on_attach_cb fun(client: vim.lsp.Client, bufnr: integer)
+--- @alias vim.lsp.client.on_exit_cb fun(code: integer, signal: integer, client_id: integer)
+--- @alias vim.lsp.client.before_init_cb fun(params: lsp.InitializeParams, config: vim.lsp.ClientConfig)
+
+--- @class vim.lsp.Client.Flags
+--- @inlinedoc
+---
+--- Allow using incremental sync for buffer edits
+--- (defailt: `true`)
+--- @field allow_incremental_sync? boolean
+---
+--- Debounce `didChange` notifications to the server by the given number in milliseconds.
+--- No debounce occurs if `nil`.
+--- (default: `150`)
+--- @field debounce_text_changes integer
+---
+--- Milliseconds to wait for server to exit cleanly after sending the
+--- "shutdown" request before sending kill -15. If set to false, nvim exits
+--- immediately after sending the "shutdown" request to the server.
+--- (default: `false`)
+--- @field exit_timeout integer|false
+
+--- @class vim.lsp.ClientConfig
+--- command string[] that launches the language
+--- server (treated as in |jobstart()|, must be absolute or on `$PATH`, shell constructs like
+--- "~" are not expanded), or function that creates an RPC client. Function receives
+--- a `dispatchers` table and returns a table with member functions `request`, `notify`,
+--- `is_closing` and `terminate`.
+--- See |vim.lsp.rpc.request()|, |vim.lsp.rpc.notify()|.
+--- For TCP there is a builtin RPC client factory: |vim.lsp.rpc.connect()|
+--- @field cmd string[]|fun(dispatchers: vim.lsp.rpc.Dispatchers): vim.lsp.rpc.PublicClient?
+---
+--- Directory to launch the `cmd` process. Not related to `root_dir`.
+--- (default: cwd)
+--- @field cmd_cwd? string
+---
+--- Environment flags to pass to the LSP on spawn.
+--- Must be specified using a table.
+--- Non-string values are coerced to string.
+--- Example:
+--- ```lua
+--- { PORT = 8080; HOST = "0.0.0.0"; }
+--- ```
+--- @field cmd_env? table
+---
+--- Daemonize the server process so that it runs in a separate process group from Nvim.
+--- Nvim will shutdown the process on exit, but if Nvim fails to exit cleanly this could leave
+--- behind orphaned server processes.
+--- (default: true)
+--- @field detached? boolean
+---
+--- List of workspace folders passed to the language server.
+--- For backwards compatibility rootUri and rootPath will be derived from the first workspace
+--- folder in this list. See `workspaceFolders` in the LSP spec.
+--- @field workspace_folders? lsp.WorkspaceFolder[]
+---
+--- Map overriding the default capabilities defined by |vim.lsp.protocol.make_client_capabilities()|,
+--- passed to the language server on initialization. Hint: use make_client_capabilities() and modify
+--- its result.
+--- - Note: To send an empty dictionary use |vim.empty_dict()|, else it will be encoded as an
+--- array.
+--- @field capabilities? lsp.ClientCapabilities
+---
+--- Map of language server method names to |lsp-handler|
+--- @field handlers? table<string,function>
+---
+--- Map with language server specific settings.
+--- See the {settings} in |vim.lsp.Client|.
+--- @field settings? table
+---
+--- Table that maps string of clientside commands to user-defined functions.
+--- Commands passed to start_client take precedence over the global command registry. Each key
+--- must be a unique command name, and the value is a function which is called if any LSP action
+--- (code action, code lenses, ...) triggers the command.
+--- @field commands? table<string,fun(command: lsp.Command, ctx: table)>
+---
+--- Values to pass in the initialization request as `initializationOptions`. See `initialize` in
+--- the LSP spec.
+--- @field init_options? table
+---
+--- Name in log messages.
+--- (default: client-id)
+--- @field name? string
+---
+--- Language ID as string. Defaults to the filetype.
+--- @field get_language_id? fun(bufnr: integer, filetype: string): string
+---
+--- The encoding that the LSP server expects. Client does not verify this is correct.
+--- @field offset_encoding? 'utf-8'|'utf-16'|'utf-32'
+---
+--- Callback invoked when the client operation throws an error. `code` is a number describing the error.
+--- Other arguments may be passed depending on the error kind. See `vim.lsp.rpc.client_errors`
+--- for possible errors. Use `vim.lsp.rpc.client_errors[code]` to get human-friendly name.
+--- @field on_error? fun(code: integer, err: string)
+---
+--- Callback invoked before the LSP "initialize" phase, where `params` contains the parameters
+--- being sent to the server and `config` is the config that was passed to |vim.lsp.start_client()|.
+--- You can use this to modify parameters before they are sent.
+--- @field before_init? fun(params: lsp.InitializeParams, config: vim.lsp.ClientConfig)
+---
+--- Callback invoked after LSP "initialize", where `result` is a table of `capabilities`
+--- and anything else the server may send. For example, clangd sends
+--- `initialize_result.offsetEncoding` if `capabilities.offsetEncoding` was sent to it.
+--- You can only modify the `client.offset_encoding` here before any notifications are sent.
+--- @field on_init? elem_or_list<fun(client: vim.lsp.Client, initialize_result: lsp.InitializeResult)>
+---
+--- Callback invoked on client exit.
+--- - code: exit code of the process
+--- - signal: number describing the signal used to terminate (if any)
+--- - client_id: client handle
+--- @field on_exit? elem_or_list<fun(code: integer, signal: integer, client_id: integer)>
+---
+--- Callback invoked when client attaches to a buffer.
+--- @field on_attach? elem_or_list<fun(client: vim.lsp.Client, bufnr: integer)>
+---
+--- Passed directly to the language server in the initialize request. Invalid/empty values will
+--- (default: "off")
+--- @field trace? 'off'|'messages'|'verbose'
+---
+--- A table with flags for the client. The current (experimental) flags are:
+--- @field flags? vim.lsp.Client.Flags
+---
+--- Directory where the LSP server will base its workspaceFolders, rootUri, and rootPath on initialization.
+--- @field root_dir? string
+
+--- @class vim.lsp.Client.Progress: vim.Ringbuf<{token: integer|string, value: any}>
+--- @field pending table<lsp.ProgressToken,lsp.LSPAny>
+
+--- @class vim.lsp.Client
+---
+--- The id allocated to the client.
+--- @field id integer
+---
+--- If a name is specified on creation, that will be used. Otherwise it is just
+--- the client id. This is used for logs and messages.
+--- @field name string
+---
+--- RPC client object, for low level interaction with the client.
+--- See |vim.lsp.rpc.start()|.
+--- @field rpc vim.lsp.rpc.PublicClient
+---
+--- The encoding used for communicating with the server. You can modify this in
+--- the `config`'s `on_init` method before text is sent to the server.
+--- @field offset_encoding string
+---
+--- The handlers used by the client as described in |lsp-handler|.
+--- @field handlers table<string,lsp.Handler>
+---
+--- The current pending requests in flight to the server. Entries are key-value
+--- pairs with the key being the request id while the value is a table with
+--- `type`, `bufnr`, and `method` key-value pairs. `type` is either "pending"
+--- for an active request, or "cancel" for a cancel request. It will be
+--- "complete" ephemerally while executing |LspRequest| autocmds when replies
+--- are received from the server.
+--- @field requests table<integer,{ type: string, bufnr: integer, method: string}>
+---
+--- copy of the table that was passed by the user
+--- to |vim.lsp.start_client()|.
+--- @field config vim.lsp.ClientConfig
+---
+--- Response from the server sent on `initialize` describing the server's
+--- capabilities.
+--- @field server_capabilities lsp.ServerCapabilities?
+---
+--- A ring buffer (|vim.ringbuf()|) containing progress messages
+--- sent by the server.
+--- @field progress vim.lsp.Client.Progress
+---
+--- @field initialized true?
+---
+--- The workspace folders configured in the client when the server starts.
+--- This property is only available if the client supports workspace folders.
+--- It can be `null` if the client supports workspace folders but none are
+--- configured.
+--- @field workspace_folders lsp.WorkspaceFolder[]?
+--- @field root_dir string
+---
+--- @field attached_buffers table<integer,true>
+--- @field private _log_prefix string
+---
+--- Track this so that we can escalate automatically if we've already tried a
+--- graceful shutdown
+--- @field private _graceful_shutdown_failed true?
+---
+--- The initial trace setting. If omitted trace is disabled ("off").
+--- trace = "off" | "messages" | "verbose";
+--- @field private _trace 'off'|'messages'|'verbose'
+---
+--- Table of command name to function which is called if any LSP action
+--- (code action, code lenses, ...) triggers the command.
+--- Client commands take precedence over the global command registry.
+--- @field commands table<string,fun(command: lsp.Command, ctx: table)>
+---
+--- Map with language server specific settings. These are returned to the
+--- language server if requested via `workspace/configuration`. Keys are
+--- case-sensitive.
+--- @field settings table
+---
+--- A table with flags for the client. The current (experimental) flags are:
+--- @field flags vim.lsp.Client.Flags
+---
+--- @field get_language_id fun(bufnr: integer, filetype: string): string
+---
+--- The capabilities provided by the client (editor or tool)
+--- @field capabilities lsp.ClientCapabilities
+--- @field dynamic_capabilities lsp.DynamicCapabilities
+---
+--- Sends a request to the server.
+--- This is a thin wrapper around {client.rpc.request} with some additional
+--- checking.
+--- If {handler} is not specified and if there's no respective global
+--- handler, then an error will occur.
+--- Returns: {status}, {client_id}?. {status} is a boolean indicating if
+--- the notification was successful. If it is `false`, then it will always
+--- be `false` (the client has shutdown).
+--- If {status} is `true`, the function returns {request_id} as the second
+--- result. You can use this with `client.cancel_request(request_id)` to cancel
+--- the request.
+--- @field request fun(method: string, params: table?, handler: lsp.Handler?, bufnr: integer): boolean, integer?
+---
+--- Sends a request to the server and synchronously waits for the response.
+--- This is a wrapper around {client.request}
+--- Returns: { err=err, result=result }, a dictionary, where `err` and `result`
+--- come from the |lsp-handler|. On timeout, cancel or error, returns `(nil,
+--- err)` where `err` is a string describing the failure reason. If the request
+--- was unsuccessful returns `nil`.
+--- @field request_sync fun(method: string, params: table?, timeout_ms: integer?, bufnr: integer): {err: lsp.ResponseError|nil, result:any}|nil, string|nil err # a dictionary, where
+---
+--- Sends a notification to an LSP server.
+--- Returns: a boolean to indicate if the notification was successful. If
+--- it is false, then it will always be false (the client has shutdown).
+--- @field notify fun(method: string, params: table?): boolean
+---
+--- Cancels a request with a given request id.
+--- Returns: same as `notify()`.
+--- @field cancel_request fun(id: integer): boolean
+---
+--- Stops a client, optionally with force.
+--- By default, it will just ask the server to shutdown without force.
+--- If you request to stop a client which has previously been requested to
+--- shutdown, it will automatically escalate and force shutdown.
+--- @field stop fun(force?: boolean)
+---
+--- Runs the on_attach function from the client's config if it was defined.
+--- Useful for buffer-local setup.
+--- @field on_attach fun(bufnr: integer)
+---
+--- @field private _before_init_cb? vim.lsp.client.before_init_cb
+--- @field private _on_attach_cbs vim.lsp.client.on_attach_cb[]
+--- @field private _on_init_cbs vim.lsp.client.on_init_cb[]
+--- @field private _on_exit_cbs vim.lsp.client.on_exit_cb[]
+--- @field private _on_error_cb? fun(code: integer, err: string)
+---
+--- Checks if a client supports a given method.
+--- Always returns true for unknown off-spec methods.
+--- {opts} is a optional `{bufnr?: integer}` table.
+--- Some language server capabilities can be file specific.
+--- @field supports_method fun(method: string, opts?: {bufnr: integer?}): boolean
+---
+--- Checks whether a client is stopped.
+--- Returns: true if the client is fully stopped.
+--- @field is_stopped fun(): boolean
+local Client = {}
+Client.__index = Client
+
+--- @param cls table
+--- @param meth any
+--- @return function
+local function method_wrapper(cls, meth)
+ return function(...)
+ return meth(cls, ...)
+ end
+end
+
+local client_index = 0
+
+--- Checks whether a given path is a directory.
+--- @param filename (string) path to check
+--- @return boolean # true if {filename} exists and is a directory, false otherwise
+local function is_dir(filename)
+ validate({ filename = { filename, 's' } })
+ local stat = uv.fs_stat(filename)
+ return stat and stat.type == 'directory' or false
+end
+
+local valid_encodings = {
+ ['utf-8'] = 'utf-8',
+ ['utf-16'] = 'utf-16',
+ ['utf-32'] = 'utf-32',
+ ['utf8'] = 'utf-8',
+ ['utf16'] = 'utf-16',
+ ['utf32'] = 'utf-32',
+ UTF8 = 'utf-8',
+ UTF16 = 'utf-16',
+ UTF32 = 'utf-32',
+}
+
+--- Normalizes {encoding} to valid LSP encoding names.
+--- @param encoding string? Encoding to normalize
+--- @return string # normalized encoding name
+local function validate_encoding(encoding)
+ validate({
+ encoding = { encoding, 's', true },
+ })
+ if not encoding then
+ return valid_encodings.UTF16
+ end
+ return valid_encodings[encoding:lower()]
+ or error(
+ string.format(
+ "Invalid offset encoding %q. Must be one of: 'utf-8', 'utf-16', 'utf-32'",
+ encoding
+ )
+ )
+end
+
+--- Augments a validator function with support for optional (nil) values.
+--- @param fn (fun(v): boolean) The original validator function; should return a
+--- bool.
+--- @return fun(v): boolean # The augmented function. Also returns true if {v} is
+--- `nil`.
+local function optional_validator(fn)
+ return function(v)
+ return v == nil or fn(v)
+ end
+end
+
+--- By default, get_language_id just returns the exact filetype it is passed.
+--- It is possible to pass in something that will calculate a different filetype,
+--- to be sent by the client.
+--- @param _bufnr integer
+--- @param filetype string
+local function default_get_language_id(_bufnr, filetype)
+ return filetype
+end
+
+--- Validates a client configuration as given to |vim.lsp.start_client()|.
+--- @param config vim.lsp.ClientConfig
+local function validate_config(config)
+ validate({
+ config = { config, 't' },
+ })
+ validate({
+ handlers = { config.handlers, 't', true },
+ capabilities = { config.capabilities, 't', true },
+ cmd_cwd = { config.cmd_cwd, optional_validator(is_dir), 'directory' },
+ cmd_env = { config.cmd_env, 't', true },
+ detached = { config.detached, 'b', true },
+ name = { config.name, 's', true },
+ on_error = { config.on_error, 'f', true },
+ on_exit = { config.on_exit, { 'f', 't' }, true },
+ on_init = { config.on_init, { 'f', 't' }, true },
+ on_attach = { config.on_attach, { 'f', 't' }, true },
+ settings = { config.settings, 't', true },
+ commands = { config.commands, 't', true },
+ before_init = { config.before_init, { 'f', 't' }, true },
+ offset_encoding = { config.offset_encoding, 's', true },
+ flags = { config.flags, 't', true },
+ get_language_id = { config.get_language_id, 'f', true },
+ })
+
+ assert(
+ (
+ not config.flags
+ or not config.flags.debounce_text_changes
+ or type(config.flags.debounce_text_changes) == 'number'
+ ),
+ 'flags.debounce_text_changes must be a number with the debounce time in milliseconds'
+ )
+end
+
+--- @param trace string
+--- @return 'off'|'messages'|'verbose'
+local function get_trace(trace)
+ local valid_traces = {
+ off = 'off',
+ messages = 'messages',
+ verbose = 'verbose',
+ }
+ return trace and valid_traces[trace] or 'off'
+end
+
+--- @param id integer
+--- @param config vim.lsp.ClientConfig
+--- @return string
+local function get_name(id, config)
+ local name = config.name
+ if name then
+ return name
+ end
+
+ if type(config.cmd) == 'table' and config.cmd[1] then
+ return assert(vim.fs.basename(config.cmd[1]))
+ end
+
+ return tostring(id)
+end
+
+--- @param workspace_folders lsp.WorkspaceFolder[]?
+--- @param root_dir string?
+--- @return lsp.WorkspaceFolder[]?
+local function get_workspace_folders(workspace_folders, root_dir)
+ if workspace_folders then
+ return workspace_folders
+ end
+ if root_dir then
+ return {
+ {
+ uri = vim.uri_from_fname(root_dir),
+ name = string.format('%s', root_dir),
+ },
+ }
+ end
+end
+
+--- @generic T
+--- @param x elem_or_list<T>?
+--- @return T[]
+local function ensure_list(x)
+ if type(x) == 'table' then
+ return x
+ end
+ return { x }
+end
+
+--- @package
+--- @param config vim.lsp.ClientConfig
+--- @return vim.lsp.Client?
+function Client.create(config)
+ validate_config(config)
+
+ client_index = client_index + 1
+ local id = client_index
+ local name = get_name(id, config)
+
+ --- @class vim.lsp.Client
+ local self = {
+ id = id,
+ config = config,
+ handlers = config.handlers or {},
+ offset_encoding = validate_encoding(config.offset_encoding),
+ name = name,
+ _log_prefix = string.format('LSP[%s]', name),
+ requests = {},
+ attached_buffers = {},
+ server_capabilities = {},
+ dynamic_capabilities = lsp._dynamic.new(id),
+ commands = config.commands or {},
+ settings = config.settings or {},
+ flags = config.flags or {},
+ get_language_id = config.get_language_id or default_get_language_id,
+ capabilities = config.capabilities or lsp.protocol.make_client_capabilities(),
+ workspace_folders = get_workspace_folders(config.workspace_folders, config.root_dir),
+ root_dir = config.root_dir,
+ _before_init_cb = config.before_init,
+ _on_init_cbs = ensure_list(config.on_init),
+ _on_exit_cbs = ensure_list(config.on_exit),
+ _on_attach_cbs = ensure_list(config.on_attach),
+ _on_error_cb = config.on_error,
+ _root_dir = config.root_dir,
+ _trace = get_trace(config.trace),
+
+ --- Contains $/progress report messages.
+ --- They have the format {token: integer|string, value: any}
+ --- For "work done progress", value will be one of:
+ --- - lsp.WorkDoneProgressBegin,
+ --- - lsp.WorkDoneProgressReport (extended with title from Begin)
+ --- - lsp.WorkDoneProgressEnd (extended with title from Begin)
+ progress = vim.ringbuf(50) --[[@as vim.lsp.Client.Progress]],
+
+ --- @deprecated use client.progress instead
+ messages = { name = name, messages = {}, progress = {}, status = {} },
+ }
+
+ self.request = method_wrapper(self, Client._request)
+ self.request_sync = method_wrapper(self, Client._request_sync)
+ self.notify = method_wrapper(self, Client._notify)
+ self.cancel_request = method_wrapper(self, Client._cancel_request)
+ self.stop = method_wrapper(self, Client._stop)
+ self.is_stopped = method_wrapper(self, Client._is_stopped)
+ self.on_attach = method_wrapper(self, Client._on_attach)
+ self.supports_method = method_wrapper(self, Client._supports_method)
+
+ --- @type table<string|integer, string> title of unfinished progress sequences by token
+ self.progress.pending = {}
+
+ --- @type vim.lsp.rpc.Dispatchers
+ local dispatchers = {
+ notification = method_wrapper(self, Client._notification),
+ server_request = method_wrapper(self, Client._server_request),
+ on_error = method_wrapper(self, Client._on_error),
+ on_exit = method_wrapper(self, Client._on_exit),
+ }
+
+ -- Start the RPC client.
+ local rpc --- @type vim.lsp.rpc.PublicClient?
+ local config_cmd = config.cmd
+ if type(config_cmd) == 'function' then
+ rpc = config_cmd(dispatchers)
+ else
+ rpc = lsp.rpc.start(config_cmd, dispatchers, {
+ cwd = config.cmd_cwd,
+ env = config.cmd_env,
+ detached = config.detached,
+ })
+ end
+
+ -- Return nil if the rpc client fails to start
+ if not rpc then
+ return
+ end
+
+ self.rpc = rpc
+
+ setmetatable(self, Client)
+
+ return self
+end
+
+--- @private
+--- @param cbs function[]
+--- @param error_id integer
+--- @param ... any
+function Client:_run_callbacks(cbs, error_id, ...)
+ for _, cb in pairs(cbs) do
+ --- @type boolean, string?
+ local status, err = pcall(cb, ...)
+ if not status then
+ self:write_error(error_id, err)
+ end
+ end
+end
+
+--- @package
+function Client:initialize()
+ local config = self.config
+
+ local root_uri --- @type string?
+ local root_path --- @type string?
+ if self.workspace_folders then
+ root_uri = self.workspace_folders[1].uri
+ root_path = vim.uri_to_fname(root_uri)
+ end
+
+ local initialize_params = {
+ -- The process Id of the parent process that started the server. Is null if
+ -- the process has not been started by another process. If the parent
+ -- process is not alive then the server should exit (see exit notification)
+ -- its process.
+ processId = uv.os_getpid(),
+ -- Information about the client
+ -- since 3.15.0
+ clientInfo = {
+ name = 'Neovim',
+ version = tostring(vim.version()),
+ },
+ -- The rootPath of the workspace. Is null if no folder is open.
+ --
+ -- @deprecated in favour of rootUri.
+ rootPath = root_path or vim.NIL,
+ -- The rootUri of the workspace. Is null if no folder is open. If both
+ -- `rootPath` and `rootUri` are set `rootUri` wins.
+ rootUri = root_uri or vim.NIL,
+ workspaceFolders = self.workspace_folders or vim.NIL,
+ -- User provided initialization options.
+ initializationOptions = config.init_options,
+ capabilities = self.capabilities,
+ trace = self._trace,
+ }
+
+ self:_run_callbacks(
+ { self._before_init_cb },
+ lsp.client_errors.BEFORE_INIT_CALLBACK_ERROR,
+ initialize_params,
+ config
+ )
+
+ log.trace(self._log_prefix, 'initialize_params', initialize_params)
+
+ local rpc = self.rpc
+
+ rpc.request('initialize', initialize_params, function(init_err, result)
+ assert(not init_err, tostring(init_err))
+ assert(result, 'server sent empty result')
+ rpc.notify('initialized', vim.empty_dict())
+ self.initialized = true
+
+ -- These are the cleaned up capabilities we use for dynamically deciding
+ -- when to send certain events to clients.
+ self.server_capabilities =
+ assert(result.capabilities, "initialize result doesn't contain capabilities")
+ self.server_capabilities = assert(lsp.protocol.resolve_capabilities(self.server_capabilities))
+
+ if self.server_capabilities.positionEncoding then
+ self.offset_encoding = self.server_capabilities.positionEncoding
+ end
+
+ if next(self.settings) then
+ self:_notify(ms.workspace_didChangeConfiguration, { settings = self.settings })
+ end
+
+ self:_run_callbacks(self._on_init_cbs, lsp.client_errors.ON_INIT_CALLBACK_ERROR, self, result)
+
+ log.info(
+ self._log_prefix,
+ 'server_capabilities',
+ { server_capabilities = self.server_capabilities }
+ )
+ end)
+end
+
+--- @private
+--- Returns the handler associated with an LSP method.
+--- Returns the default handler if the user hasn't set a custom one.
+---
+--- @param method (string) LSP method name
+--- @return lsp.Handler|nil handler for the given method, if defined, or the default from |vim.lsp.handlers|
+function Client:_resolve_handler(method)
+ return self.handlers[method] or lsp.handlers[method]
+end
+
+--- Returns the buffer number for the given {bufnr}.
+---
+--- @param bufnr (integer|nil) Buffer number to resolve. Defaults to current buffer
+--- @return integer bufnr
+local function resolve_bufnr(bufnr)
+ validate({ bufnr = { bufnr, 'n', true } })
+ if bufnr == nil or bufnr == 0 then
+ return api.nvim_get_current_buf()
+ end
+ return bufnr
+end
+
+--- @private
+--- Sends a request to the server.
+---
+--- This is a thin wrapper around {client.rpc.request} with some additional
+--- checks for capabilities and handler availability.
+---
+--- @param method string LSP method name.
+--- @param params table|nil LSP request params.
+--- @param handler lsp.Handler|nil Response |lsp-handler| for this method.
+--- @param bufnr integer Buffer handle (0 for current).
+--- @return boolean status, integer|nil request_id {status} is a bool indicating
+--- whether the request was successful. If it is `false`, then it will
+--- always be `false` (the client has shutdown). If it was
+--- successful, then it will return {request_id} as the
+--- second result. You can use this with `client.cancel_request(request_id)`
+--- to cancel the-request.
+--- @see |vim.lsp.buf_request_all()|
+function Client:_request(method, params, handler, bufnr)
+ if not handler then
+ handler = assert(
+ self:_resolve_handler(method),
+ string.format('not found: %q request handler for client %q.', method, self.name)
+ )
+ end
+ -- Ensure pending didChange notifications are sent so that the server doesn't operate on a stale state
+ changetracking.flush(self, bufnr)
+ local version = lsp.util.buf_versions[bufnr]
+ bufnr = resolve_bufnr(bufnr)
+ log.debug(self._log_prefix, 'client.request', self.id, method, params, handler, bufnr)
+ local success, request_id = self.rpc.request(method, params, function(err, result)
+ local context = {
+ method = method,
+ client_id = self.id,
+ bufnr = bufnr,
+ params = params,
+ version = version,
+ }
+ handler(err, result, context)
+ end, function(request_id)
+ local request = self.requests[request_id]
+ request.type = 'complete'
+ api.nvim_exec_autocmds('LspRequest', {
+ buffer = api.nvim_buf_is_valid(bufnr) and bufnr or nil,
+ modeline = false,
+ data = { client_id = self.id, request_id = request_id, request = request },
+ })
+ self.requests[request_id] = nil
+ end)
+
+ if success and request_id then
+ local request = { type = 'pending', bufnr = bufnr, method = method }
+ self.requests[request_id] = request
+ api.nvim_exec_autocmds('LspRequest', {
+ buffer = bufnr,
+ modeline = false,
+ data = { client_id = self.id, request_id = request_id, request = request },
+ })
+ end
+
+ return success, request_id
+end
+
+-- TODO(lewis6991): duplicated from lsp.lua
+local wait_result_reason = { [-1] = 'timeout', [-2] = 'interrupted', [-3] = 'error' }
+
+--- Concatenates and writes a list of strings to the Vim error buffer.
+---
+--- @param ... string List to write to the buffer
+local function err_message(...)
+ local message = table.concat(vim.tbl_flatten({ ... }))
+ if vim.in_fast_event() then
+ vim.schedule(function()
+ api.nvim_err_writeln(message)
+ api.nvim_command('redraw')
+ end)
+ else
+ api.nvim_err_writeln(message)
+ api.nvim_command('redraw')
+ end
+end
+
+--- @private
+--- Sends a request to the server and synchronously waits for the response.
+---
+--- This is a wrapper around {client.request}
+---
+--- @param method (string) LSP method name.
+--- @param params (table) LSP request params.
+--- @param timeout_ms (integer|nil) Maximum time in milliseconds to wait for
+--- a result. Defaults to 1000
+--- @param bufnr (integer) Buffer handle (0 for current).
+--- @return {err: lsp.ResponseError|nil, result:any}|nil, string|nil err # a dictionary, where
+--- `err` and `result` come from the |lsp-handler|.
+--- On timeout, cancel or error, returns `(nil, err)` where `err` is a
+--- string describing the failure reason. If the request was unsuccessful
+--- returns `nil`.
+--- @see |vim.lsp.buf_request_sync()|
+function Client:_request_sync(method, params, timeout_ms, bufnr)
+ local request_result = nil
+ local function _sync_handler(err, result)
+ request_result = { err = err, result = result }
+ end
+
+ local success, request_id = self:_request(method, params, _sync_handler, bufnr)
+ if not success then
+ return nil
+ end
+
+ local wait_result, reason = vim.wait(timeout_ms or 1000, function()
+ return request_result ~= nil
+ end, 10)
+
+ if not wait_result then
+ if request_id then
+ self:_cancel_request(request_id)
+ end
+ return nil, wait_result_reason[reason]
+ end
+ return request_result
+end
+
+--- @private
+--- Sends a notification to an LSP server.
+---
+--- @param method string LSP method name.
+--- @param params table|nil LSP request params.
+--- @return boolean status true if the notification was successful.
+--- If it is false, then it will always be false
+--- (the client has shutdown).
+function Client:_notify(method, params)
+ if method ~= ms.textDocument_didChange then
+ changetracking.flush(self)
+ end
+
+ local client_active = self.rpc.notify(method, params)
+
+ if client_active then
+ vim.schedule(function()
+ api.nvim_exec_autocmds('LspNotify', {
+ modeline = false,
+ data = {
+ client_id = self.id,
+ method = method,
+ params = params,
+ },
+ })
+ end)
+ end
+
+ return client_active
+end
+
+--- @private
+--- Cancels a request with a given request id.
+---
+--- @param id (integer) id of request to cancel
+--- @return boolean status true if notification was successful. false otherwise
+--- @see |vim.lsp.client.notify()|
+function Client:_cancel_request(id)
+ validate({ id = { id, 'n' } })
+ local request = self.requests[id]
+ if request and request.type == 'pending' then
+ request.type = 'cancel'
+ api.nvim_exec_autocmds('LspRequest', {
+ buffer = request.bufnr,
+ modeline = false,
+ data = { client_id = self.id, request_id = id, request = request },
+ })
+ end
+ return self.rpc.notify(ms.dollar_cancelRequest, { id = id })
+end
+
+--- @private
+--- Stops a client, optionally with force.
+---
+--- By default, it will just ask the - server to shutdown without force. If
+--- you request to stop a client which has previously been requested to
+--- shutdown, it will automatically escalate and force shutdown.
+---
+--- @param force boolean|nil
+function Client:_stop(force)
+ local rpc = self.rpc
+
+ if rpc.is_closing() then
+ return
+ end
+
+ if force or not self.initialized or self._graceful_shutdown_failed then
+ rpc.terminate()
+ return
+ end
+
+ -- Sending a signal after a process has exited is acceptable.
+ rpc.request(ms.shutdown, nil, function(err, _)
+ if err == nil then
+ rpc.notify(ms.exit)
+ else
+ -- If there was an error in the shutdown request, then term to be safe.
+ rpc.terminate()
+ self._graceful_shutdown_failed = true
+ end
+ vim.lsp._watchfiles.cancel(self.id)
+ end)
+end
+
+--- @private
+--- Checks whether a client is stopped.
+---
+--- @return boolean # true if client is stopped or in the process of being
+--- stopped; false otherwise
+function Client:_is_stopped()
+ return self.rpc.is_closing()
+end
+
+--- @package
+--- Execute a lsp command, either via client command function (if available)
+--- or via workspace/executeCommand (if supported by the server)
+---
+--- @param command lsp.Command
+--- @param context? {bufnr: integer}
+--- @param handler? lsp.Handler only called if a server command
+function Client:_exec_cmd(command, context, handler)
+ context = vim.deepcopy(context or {}, true) --[[@as lsp.HandlerContext]]
+ context.bufnr = context.bufnr or api.nvim_get_current_buf()
+ context.client_id = self.id
+ local cmdname = command.command
+ local fn = self.commands[cmdname] or lsp.commands[cmdname]
+ if fn then
+ fn(command, context)
+ return
+ end
+
+ local command_provider = self.server_capabilities.executeCommandProvider
+ local commands = type(command_provider) == 'table' and command_provider.commands or {}
+ if not vim.list_contains(commands, cmdname) then
+ vim.notify_once(
+ string.format(
+ 'Language server `%s` does not support command `%s`. This command may require a client extension.',
+ self.name,
+ cmdname
+ ),
+ vim.log.levels.WARN
+ )
+ return
+ end
+ -- Not using command directly to exclude extra properties,
+ -- see https://github.com/python-lsp/python-lsp-server/issues/146
+ local params = {
+ command = command.command,
+ arguments = command.arguments,
+ }
+ self.request(ms.workspace_executeCommand, params, handler, context.bufnr)
+end
+
+--- @package
+--- Default handler for the 'textDocument/didOpen' LSP notification.
+---
+--- @param bufnr integer Number of the buffer, or 0 for current
+function Client:_text_document_did_open_handler(bufnr)
+ changetracking.init(self, bufnr)
+ if not vim.tbl_get(self.server_capabilities, 'textDocumentSync', 'openClose') then
+ return
+ end
+ if not api.nvim_buf_is_loaded(bufnr) then
+ return
+ end
+ local filetype = vim.bo[bufnr].filetype
+
+ local params = {
+ textDocument = {
+ version = 0,
+ uri = vim.uri_from_bufnr(bufnr),
+ languageId = self.get_language_id(bufnr, filetype),
+ text = lsp._buf_get_full_text(bufnr),
+ },
+ }
+ self.notify(ms.textDocument_didOpen, params)
+ lsp.util.buf_versions[bufnr] = params.textDocument.version
+
+ -- Next chance we get, we should re-do the diagnostics
+ vim.schedule(function()
+ -- Protect against a race where the buffer disappears
+ -- between `did_open_handler` and the scheduled function firing.
+ if api.nvim_buf_is_valid(bufnr) then
+ local namespace = lsp.diagnostic.get_namespace(self.id)
+ vim.diagnostic.show(namespace, bufnr)
+ end
+ end)
+end
+
+--- @package
+--- Runs the on_attach function from the client's config if it was defined.
+--- @param bufnr integer Buffer number
+function Client:_on_attach(bufnr)
+ self:_text_document_did_open_handler(bufnr)
+
+ lsp._set_defaults(self, bufnr)
+
+ api.nvim_exec_autocmds('LspAttach', {
+ buffer = bufnr,
+ modeline = false,
+ data = { client_id = self.id },
+ })
+
+ self:_run_callbacks(self._on_attach_cbs, lsp.client_errors.ON_ATTACH_ERROR, self, bufnr)
+
+ -- schedule the initialization of semantic tokens to give the above
+ -- on_attach and LspAttach callbacks the ability to schedule wrap the
+ -- opt-out (deleting the semanticTokensProvider from capabilities)
+ vim.schedule(function()
+ if vim.tbl_get(self.server_capabilities, 'semanticTokensProvider', 'full') then
+ lsp.semantic_tokens.start(bufnr, self.id)
+ end
+ end)
+
+ self.attached_buffers[bufnr] = true
+end
+
+--- @private
+--- Logs the given error to the LSP log and to the error buffer.
+--- @param code integer Error code
+--- @param err any Error arguments
+function Client:write_error(code, err)
+ local client_error = lsp.client_errors[code] --- @type string|integer
+ log.error(self._log_prefix, 'on_error', { code = client_error, err = err })
+ err_message(self._log_prefix, ': Error ', client_error, ': ', vim.inspect(err))
+end
+
+--- @private
+--- @param method string
+--- @param opts? {bufnr: integer?}
+function Client:_supports_method(method, opts)
+ local required_capability = lsp._request_name_to_capability[method]
+ -- if we don't know about the method, assume that the client supports it.
+ if not required_capability then
+ return true
+ end
+ if vim.tbl_get(self.server_capabilities, unpack(required_capability)) then
+ return true
+ end
+ if self.dynamic_capabilities:supports_registration(method) then
+ return self.dynamic_capabilities:supports(method, opts)
+ end
+ return false
+end
+
+--- @private
+--- Handles a notification sent by an LSP server by invoking the
+--- corresponding handler.
+---
+--- @param method string LSP method name
+--- @param params table The parameters for that method.
+function Client:_notification(method, params)
+ log.trace('notification', method, params)
+ local handler = self:_resolve_handler(method)
+ if handler then
+ -- Method name is provided here for convenience.
+ handler(nil, params, { method = method, client_id = self.id })
+ end
+end
+
+--- @private
+--- Handles a request from an LSP server by invoking the corresponding handler.
+---
+--- @param method (string) LSP method name
+--- @param params (table) The parameters for that method
+--- @return any result
+--- @return lsp.ResponseError error code and message set in case an exception happens during the request.
+function Client:_server_request(method, params)
+ log.trace('server_request', method, params)
+ local handler = self:_resolve_handler(method)
+ if handler then
+ log.trace('server_request: found handler for', method)
+ return handler(nil, params, { method = method, client_id = self.id })
+ end
+ log.warn('server_request: no handler found for', method)
+ return nil, lsp.rpc_response_error(lsp.protocol.ErrorCodes.MethodNotFound)
+end
+
+--- @private
+--- Invoked when the client operation throws an error.
+---
+--- @param code integer Error code
+--- @param err any Other arguments may be passed depending on the error kind
+--- @see vim.lsp.rpc.client_errors for possible errors. Use
+--- `vim.lsp.rpc.client_errors[code]` to get a human-friendly name.
+function Client:_on_error(code, err)
+ self:write_error(code, err)
+ if self._on_error_cb then
+ --- @type boolean, string
+ local status, usererr = pcall(self._on_error_cb, code, err)
+ if not status then
+ log.error(self._log_prefix, 'user on_error failed', { err = usererr })
+ err_message(self._log_prefix, ' user on_error failed: ', tostring(usererr))
+ end
+ end
+end
+
+--- @private
+--- Invoked on client exit.
+---
+--- @param code integer) exit code of the process
+--- @param signal integer the signal used to terminate (if any)
+function Client:_on_exit(code, signal)
+ self:_run_callbacks(
+ self._on_exit_cbs,
+ lsp.client_errors.ON_EXIT_CALLBACK_ERROR,
+ code,
+ signal,
+ self.id
+ )
+end
+
+return Client
diff --git a/runtime/lua/vim/lsp/codelens.lua b/runtime/lua/vim/lsp/codelens.lua
index 9cccaa1d66..48c096c0c1 100644
--- a/runtime/lua/vim/lsp/codelens.lua
+++ b/runtime/lua/vim/lsp/codelens.lua
@@ -6,7 +6,7 @@ local M = {}
--- bufnr → true|nil
--- to throttle refreshes to at most one at a time
-local active_refreshes = {}
+local active_refreshes = {} --- @type table<integer,true>
---@type table<integer, table<integer, lsp.CodeLens[]>>
--- bufnr -> client_id -> lenses
@@ -48,7 +48,7 @@ local function execute_lens(lens, bufnr, client_id)
local client = vim.lsp.get_client_by_id(client_id)
assert(client, 'Client is required to execute lens, client_id=' .. client_id)
- client._exec_cmd(lens.command, { bufnr = bufnr }, function(...)
+ client:_exec_cmd(lens.command, { bufnr = bufnr }, function(...)
vim.lsp.handlers[ms.workspace_executeCommand](...)
M.refresh()
end)
@@ -75,7 +75,7 @@ end
function M.run()
local line = api.nvim_win_get_cursor(0)[1]
local bufnr = api.nvim_get_current_buf()
- local options = {}
+ local options = {} --- @type {client: integer, lens: lsp.CodeLens}[]
local lenses_by_client = lens_cache_by_buf[bufnr] or {}
for client, lenses in pairs(lenses_by_client) do
for _, lens in pairs(lenses) do
@@ -111,7 +111,7 @@ end
--- Clear the lenses
---
---@param client_id integer|nil filter by client_id. All clients if nil
----@param bufnr integer|nil filter by buffer. All buffers if nil
+---@param bufnr integer|nil filter by buffer. All buffers if nil, 0 for current buffer
function M.clear(client_id, bufnr)
bufnr = bufnr and resolve_bufnr(bufnr)
local buffers = bufnr and { bufnr }
@@ -230,6 +230,7 @@ local function resolve_lenses(lenses, bufnr, client_id, callback)
if lens.command then
countdown()
else
+ assert(client)
client.request('codeLens/resolve', lens, function(_, result)
if api.nvim_buf_is_loaded(bufnr) and result and result.command then
lens.command = result.command
@@ -257,10 +258,13 @@ end
--- |lsp-handler| for the method `textDocument/codeLens`
---
+---@param err lsp.ResponseError?
+---@param result lsp.CodeLens[]
+---@param ctx lsp.HandlerContext
function M.on_codelens(err, result, ctx, _)
if err then
- active_refreshes[ctx.bufnr] = nil
- local _ = log.error() and log.error('codelens', err)
+ active_refreshes[assert(ctx.bufnr)] = nil
+ log.error('codelens', err)
return
end
@@ -270,30 +274,41 @@ function M.on_codelens(err, result, ctx, _)
-- once resolved.
M.display(result, ctx.bufnr, ctx.client_id)
resolve_lenses(result, ctx.bufnr, ctx.client_id, function()
- active_refreshes[ctx.bufnr] = nil
+ active_refreshes[assert(ctx.bufnr)] = nil
M.display(result, ctx.bufnr, ctx.client_id)
end)
end
---- Refresh the codelens for the current buffer
+--- @class vim.lsp.codelens.refresh.Opts
+--- @inlinedoc
+--- @field bufnr integer? filter by buffer. All buffers if nil, 0 for current buffer
+
+--- Refresh the lenses.
---
--- It is recommended to trigger this using an autocmd or via keymap.
---
--- Example:
---
--- ```vim
---- autocmd BufEnter,CursorHold,InsertLeave <buffer> lua vim.lsp.codelens.refresh()
+--- autocmd BufEnter,CursorHold,InsertLeave <buffer> lua vim.lsp.codelens.refresh({ bufnr = 0 })
--- ```
-function M.refresh()
+---
+--- @param opts? vim.lsp.codelens.refresh.Opts Optional fields
+function M.refresh(opts)
+ opts = opts or {}
+ local bufnr = opts.bufnr and resolve_bufnr(opts.bufnr)
+ local buffers = bufnr and { bufnr }
+ or vim.tbl_filter(api.nvim_buf_is_loaded, api.nvim_list_bufs())
local params = {
textDocument = util.make_text_document_params(),
}
- local bufnr = api.nvim_get_current_buf()
- if active_refreshes[bufnr] then
- return
+
+ for _, buf in ipairs(buffers) do
+ if not active_refreshes[buf] then
+ active_refreshes[buf] = true
+ vim.lsp.buf_request(buf, ms.textDocument_codeLens, params, M.on_codelens)
+ end
end
- active_refreshes[bufnr] = true
- vim.lsp.buf_request(0, ms.textDocument_codeLens, params, M.on_codelens)
end
return M
diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua
index b6f0cfa0b3..08cea13548 100644
--- a/runtime/lua/vim/lsp/diagnostic.lua
+++ b/runtime/lua/vim/lsp/diagnostic.lua
@@ -1,8 +1,4 @@
----@brief lsp-diagnostic
-
-local util = require('vim.lsp.util')
local protocol = require('vim.lsp.protocol')
-local log = require('vim.lsp.log')
local ms = protocol.Methods
local api = vim.api
@@ -24,7 +20,7 @@ end
---@param severity lsp.DiagnosticSeverity
local function severity_lsp_to_vim(severity)
if type(severity) == 'string' then
- severity = protocol.DiagnosticSeverity[severity]
+ severity = protocol.DiagnosticSeverity[severity] --- @type integer
end
return severity
end
@@ -37,6 +33,10 @@ local function severity_vim_to_lsp(severity)
return severity
end
+---@param lines string[]?
+---@param lnum integer
+---@param col integer
+---@param offset_encoding string
---@return integer
local function line_byte_from_position(lines, lnum, col, offset_encoding)
if not lines or offset_encoding == 'utf-8' then
@@ -46,12 +46,14 @@ local function line_byte_from_position(lines, lnum, col, offset_encoding)
local line = lines[lnum + 1]
local ok, result = pcall(vim.str_byteindex, line, col, offset_encoding == 'utf-16')
if ok then
- return result
+ return result --- @type integer
end
return col
end
+---@param bufnr integer
+---@return string[]?
local function get_buf_lines(bufnr)
if vim.api.nvim_buf_is_loaded(bufnr) then
return vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
@@ -89,7 +91,7 @@ local function tags_lsp_to_vim(diagnostic, client_id)
tags = tags or {}
tags.deprecated = true
else
- log.info(string.format('Unknown DiagnosticTag %d from LSP client %d', tag, client_id))
+ vim.lsp.log.info(string.format('Unknown DiagnosticTag %d from LSP client %d', tag, client_id))
end
end
return tags
@@ -98,16 +100,17 @@ end
---@param diagnostics lsp.Diagnostic[]
---@param bufnr integer
---@param client_id integer
----@return Diagnostic[]
+---@return vim.Diagnostic[]
local function diagnostic_lsp_to_vim(diagnostics, bufnr, client_id)
local buf_lines = get_buf_lines(bufnr)
local client = vim.lsp.get_client_by_id(client_id)
local offset_encoding = client and client.offset_encoding or 'utf-16'
- ---@diagnostic disable-next-line:no-unknown
+ --- @param diagnostic lsp.Diagnostic
+ --- @return vim.Diagnostic
return vim.tbl_map(function(diagnostic)
- ---@cast diagnostic lsp.Diagnostic
local start = diagnostic.range.start
local _end = diagnostic.range['end']
+ --- @type vim.Diagnostic
return {
lnum = start.line,
col = line_byte_from_position(buf_lines, start.line, start.character, offset_encoding),
@@ -131,12 +134,29 @@ local function diagnostic_lsp_to_vim(diagnostics, bufnr, client_id)
end, diagnostics)
end
---- @param diagnostics Diagnostic[]
+--- @param diagnostic vim.Diagnostic
+--- @return lsp.DiagnosticTag[]?
+local function tags_vim_to_lsp(diagnostic)
+ if not diagnostic._tags then
+ return
+ end
+
+ local tags = {} --- @type lsp.DiagnosticTag[]
+ if diagnostic._tags.unnecessary then
+ tags[#tags + 1] = protocol.DiagnosticTag.Unnecessary
+ end
+ if diagnostic._tags.deprecated then
+ tags[#tags + 1] = protocol.DiagnosticTag.Deprecated
+ end
+ return tags
+end
+
+--- @param diagnostics vim.Diagnostic[]
--- @return lsp.Diagnostic[]
local function diagnostic_vim_to_lsp(diagnostics)
- ---@diagnostic disable-next-line:no-unknown
+ ---@param diagnostic vim.Diagnostic
+ ---@return lsp.Diagnostic
return vim.tbl_map(function(diagnostic)
- ---@cast diagnostic Diagnostic
return vim.tbl_extend('keep', {
-- "keep" the below fields over any duplicate fields in diagnostic.user_data.lsp
range = {
@@ -153,6 +173,7 @@ local function diagnostic_vim_to_lsp(diagnostics)
message = diagnostic.message,
source = diagnostic.source,
code = diagnostic.code,
+ tags = tags_vim_to_lsp(diagnostic),
}, diagnostic.user_data and (diagnostic.user_data.lsp or {}) or {})
end, diagnostics)
end
@@ -198,6 +219,47 @@ function M.get_namespace(client_id, is_pull)
end
end
+local function convert_severity(opt)
+ if type(opt) == 'table' and not opt.severity and opt.severity_limit then
+ vim.deprecate('severity_limit', '{min = severity} See vim.diagnostic.severity', '0.11')
+ opt.severity = { min = severity_lsp_to_vim(opt.severity_limit) }
+ end
+end
+
+--- @param uri string
+--- @param client_id? integer
+--- @param diagnostics vim.Diagnostic[]
+--- @param is_pull boolean
+--- @param config? vim.diagnostic.Opts
+local function handle_diagnostics(uri, client_id, diagnostics, is_pull, config)
+ local fname = vim.uri_to_fname(uri)
+
+ if #diagnostics == 0 and vim.fn.bufexists(fname) == 0 then
+ return
+ end
+
+ local bufnr = vim.fn.bufadd(fname)
+ if not bufnr then
+ return
+ end
+
+ client_id = get_client_id(client_id)
+ local namespace = M.get_namespace(client_id, is_pull)
+
+ if config then
+ --- @cast config table<string, table>
+ for _, opt in pairs(config) do
+ convert_severity(opt)
+ end
+ -- Persist configuration to ensure buffer reloads use the same
+ -- configuration. To make lsp.with configuration work (See :help
+ -- lsp-handler-configuration)
+ vim.diagnostic.config(config, namespace)
+ end
+
+ vim.diagnostic.set(namespace, bufnr, diagnostic_lsp_to_vim(diagnostics, bufnr, client_id))
+end
+
--- |lsp-handler| for the method "textDocument/publishDiagnostics"
---
--- See |vim.diagnostic.config()| for configuration options. Handler-specific
@@ -223,40 +285,12 @@ end
--- )
--- ```
---
----@param config table Configuration table (see |vim.diagnostic.config()|).
+---@param _ lsp.ResponseError?
+---@param result lsp.PublishDiagnosticsParams
+---@param ctx lsp.HandlerContext
+---@param config? vim.diagnostic.Opts Configuration table (see |vim.diagnostic.config()|).
function M.on_publish_diagnostics(_, result, ctx, config)
- local client_id = ctx.client_id
- local uri = result.uri
- local fname = vim.uri_to_fname(uri)
- local diagnostics = result.diagnostics
- if #diagnostics == 0 and vim.fn.bufexists(fname) == 0 then
- return
- end
- local bufnr = vim.fn.bufadd(fname)
-
- if not bufnr then
- return
- end
-
- client_id = get_client_id(client_id)
- local namespace = M.get_namespace(client_id, false)
-
- if config then
- for _, opt in pairs(config) do
- if type(opt) == 'table' then
- if not opt.severity and opt.severity_limit then
- opt.severity = { min = severity_lsp_to_vim(opt.severity_limit) }
- end
- end
- end
-
- -- Persist configuration to ensure buffer reloads use the same
- -- configuration. To make lsp.with configuration work (See :help
- -- lsp-handler-configuration)
- vim.diagnostic.config(config, namespace)
- end
-
- vim.diagnostic.set(namespace, bufnr, diagnostic_lsp_to_vim(diagnostics, bufnr, client_id))
+ handle_diagnostics(result.uri, ctx.client_id, result.diagnostics, false, config)
end
--- |lsp-handler| for the method "textDocument/diagnostic"
@@ -284,48 +318,16 @@ end
--- )
--- ```
---
----@param config table Configuration table (see |vim.diagnostic.config()|).
+---@param _ lsp.ResponseError?
+---@param result lsp.DocumentDiagnosticReport
+---@param ctx lsp.HandlerContext
+---@param config vim.diagnostic.Opts Configuration table (see |vim.diagnostic.config()|).
function M.on_diagnostic(_, result, ctx, config)
- local client_id = ctx.client_id
- local uri = ctx.params.textDocument.uri
- local fname = vim.uri_to_fname(uri)
-
- if result == nil then
- return
- end
-
- if result.kind == 'unchanged' then
- return
- end
-
- local diagnostics = result.items
- if #diagnostics == 0 and vim.fn.bufexists(fname) == 0 then
+ if result == nil or result.kind == 'unchanged' then
return
end
- local bufnr = vim.fn.bufadd(fname)
-
- if not bufnr then
- return
- end
-
- client_id = get_client_id(client_id)
-
- local namespace = M.get_namespace(client_id, true)
-
- if config then
- for _, opt in pairs(config) do
- if type(opt) == 'table' and not opt.severity and opt.severity_limit then
- opt.severity = { min = severity_lsp_to_vim(opt.severity_limit) }
- end
- end
-
- -- Persist configuration to ensure buffer reloads use the same
- -- configuration. To make lsp.with configuration work (See :help
- -- lsp-handler-configuration)
- vim.diagnostic.config(config, namespace)
- end
- vim.diagnostic.set(namespace, bufnr, diagnostic_lsp_to_vim(diagnostics, bufnr, client_id))
+ handle_diagnostics(ctx.params.textDocument.uri, ctx.client_id, result.items, true, config)
end
--- Clear push diagnostics and diagnostic cache.
@@ -335,7 +337,7 @@ end
--- implementation so it's simply marked @private rather than @deprecated.
---
---@param client_id integer
----@param buffer_client_map table map of buffers to active clients
+---@param buffer_client_map table<integer, table<integer, table>> map of buffers to active clients
---@private
function M.reset(client_id, buffer_client_map)
buffer_client_map = vim.deepcopy(buffer_client_map)
@@ -356,34 +358,28 @@ end
---
---@param bufnr integer|nil The buffer number
---@param line_nr integer|nil The line number
----@param opts table|nil Configuration keys
---- - severity: (DiagnosticSeverity, default nil)
---- - Only return diagnostics with this severity. Overrides severity_limit
---- - severity_limit: (DiagnosticSeverity, default nil)
---- - Limit severity of diagnostics found. E.g. "Warning" means { "Error", "Warning" } will be valid.
+---@param opts {severity?:lsp.DiagnosticSeverity}?
+--- - severity: (lsp.DiagnosticSeverity)
+--- - Only return diagnostics with this severity.
---@param client_id integer|nil the client id
---@return table Table with map of line number to list of diagnostics.
--- Structured: { [1] = {...}, [5] = {.... } }
---@private
function M.get_line_diagnostics(bufnr, line_nr, opts, client_id)
- opts = opts or {}
- if opts.severity then
- opts.severity = severity_lsp_to_vim(opts.severity)
- elseif opts.severity_limit then
- opts.severity = { min = severity_lsp_to_vim(opts.severity_limit) }
- end
+ convert_severity(opts)
+ local diag_opts = {} --- @type vim.diagnostic.GetOpts
- if client_id then
- opts.namespace = M.get_namespace(client_id, false)
+ if opts and opts.severity then
+ diag_opts.severity = severity_lsp_to_vim(opts.severity)
end
- if not line_nr then
- line_nr = vim.api.nvim_win_get_cursor(0)[1] - 1
+ if client_id then
+ diag_opts.namespace = M.get_namespace(client_id, false)
end
- opts.lnum = line_nr
+ diag_opts.lnum = line_nr or (api.nvim_win_get_cursor(0)[1] - 1)
- return diagnostic_vim_to_lsp(vim.diagnostic.get(bufnr, opts))
+ return diagnostic_vim_to_lsp(vim.diagnostic.get(bufnr, diag_opts))
end
--- Clear diagnostics from pull based clients
@@ -394,12 +390,13 @@ local function clear(bufnr)
end
end
----@class lsp.diagnostic.bufstate
+---@class (private) lsp.diagnostic.bufstate
---@field enabled boolean Whether inlay hints are enabled for this buffer
---@type table<integer, lsp.diagnostic.bufstate>
local bufstates = {}
--- Disable pull diagnostics for a buffer
+--- @param bufnr integer
--- @private
local function disable(bufnr)
local bufstate = bufstates[bufnr]
@@ -416,7 +413,7 @@ end
local function _refresh(bufnr, opts)
opts = opts or {}
opts['bufnr'] = bufnr
- util._refresh(ms.textDocument_diagnostic, opts)
+ vim.lsp.util._refresh(ms.textDocument_diagnostic, opts)
end
--- Enable pull diagnostics for a buffer
@@ -440,7 +437,8 @@ function M._enable(bufnr)
return
end
if bufstates[bufnr] and bufstates[bufnr].enabled then
- _refresh(bufnr, { only_visible = true, client_id = opts.data.client_id })
+ local client_id = opts.data.client_id --- @type integer?
+ _refresh(bufnr, { only_visible = true, client_id = client_id })
end
end,
group = augroup,
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index 6fde55cf04..daf4fec8d2 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -4,6 +4,7 @@ local ms = protocol.Methods
local util = require('vim.lsp.util')
local api = vim.api
+--- @type table<string,lsp.Handler>
local M = {}
-- FIXME: DOC: Expose in vimdocs
@@ -15,12 +16,12 @@ local function err_message(...)
api.nvim_command('redraw')
end
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand
M[ms.workspace_executeCommand] = function(_, _, _, _)
-- Error handling is done implicitly by wrapping all handlers; see end of this file
end
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#progress
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#progress
---@param result lsp.ProgressParams
---@param ctx lsp.HandlerContext
M[ms.dollar_progress] = function(_, result, ctx)
@@ -56,7 +57,7 @@ M[ms.dollar_progress] = function(_, result, ctx)
})
end
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window_workDoneProgress_create
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window_workDoneProgress_create
---@param result lsp.WorkDoneProgressCreateParams
---@param ctx lsp.HandlerContext
M[ms.window_workDoneProgress_create] = function(_, result, ctx)
@@ -69,7 +70,7 @@ M[ms.window_workDoneProgress_create] = function(_, result, ctx)
return vim.NIL
end
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window_showMessageRequest
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window_showMessageRequest
---@param result lsp.ShowMessageRequestParams
M[ms.window_showMessageRequest] = function(_, result)
local actions = result.actions or {}
@@ -105,11 +106,11 @@ M[ms.window_showMessageRequest] = function(_, result)
end
end
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#client_registerCapability
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#client_registerCapability
+--- @param result lsp.RegistrationParams
M[ms.client_registerCapability] = function(_, result, ctx)
local client_id = ctx.client_id
- ---@type lsp.Client
- local client = vim.lsp.get_client_by_id(client_id)
+ local client = assert(vim.lsp.get_client_by_id(client_id))
client.dynamic_capabilities:register(result.registrations)
for bufnr, _ in pairs(client.attached_buffers) do
@@ -120,7 +121,7 @@ M[ms.client_registerCapability] = function(_, result, ctx)
local unsupported = {}
for _, reg in ipairs(result.registrations) do
if reg.method == ms.workspace_didChangeWatchedFiles then
- require('vim.lsp._watchfiles').register(reg, ctx)
+ vim.lsp._watchfiles.register(reg, ctx)
elseif not client.dynamic_capabilities:supports_registration(reg.method) then
unsupported[#unsupported + 1] = reg.method
end
@@ -136,21 +137,22 @@ M[ms.client_registerCapability] = function(_, result, ctx)
return vim.NIL
end
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#client_unregisterCapability
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#client_unregisterCapability
+--- @param result lsp.UnregistrationParams
M[ms.client_unregisterCapability] = function(_, result, ctx)
local client_id = ctx.client_id
- local client = vim.lsp.get_client_by_id(client_id)
+ local client = assert(vim.lsp.get_client_by_id(client_id))
client.dynamic_capabilities:unregister(result.unregisterations)
for _, unreg in ipairs(result.unregisterations) do
if unreg.method == ms.workspace_didChangeWatchedFiles then
- require('vim.lsp._watchfiles').unregister(unreg, ctx)
+ vim.lsp._watchfiles.unregister(unreg, ctx)
end
end
return vim.NIL
end
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_applyEdit
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_applyEdit
M[ms.workspace_applyEdit] = function(_, workspace_edit, ctx)
assert(
workspace_edit,
@@ -158,7 +160,7 @@ M[ms.workspace_applyEdit] = function(_, workspace_edit, ctx)
)
-- TODO(ashkan) Do something more with label?
local client_id = ctx.client_id
- local client = vim.lsp.get_client_by_id(client_id)
+ local client = assert(vim.lsp.get_client_by_id(client_id))
if workspace_edit.label then
print('Workspace edit', workspace_edit.label)
end
@@ -170,7 +172,16 @@ M[ms.workspace_applyEdit] = function(_, workspace_edit, ctx)
}
end
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_configuration
+---@param table table e.g., { foo = { bar = "z" } }
+---@param section string indicating the field of the table, e.g., "foo.bar"
+---@return any|nil setting value read from the table, or `nil` not found
+local function lookup_section(table, section)
+ local keys = vim.split(section, '.', { plain = true }) --- @type string[]
+ return vim.tbl_get(table, unpack(keys))
+end
+
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_configuration
+--- @param result lsp.ConfigurationParams
M[ms.workspace_configuration] = function(_, result, ctx)
local client_id = ctx.client_id
local client = vim.lsp.get_client_by_id(client_id)
@@ -189,10 +200,13 @@ M[ms.workspace_configuration] = function(_, result, ctx)
local response = {}
for _, item in ipairs(result.items) do
if item.section then
- local value = util.lookup_section(client.config.settings, item.section)
+ local value = lookup_section(client.settings, item.section)
-- For empty sections with no explicit '' key, return settings as is
- if value == vim.NIL and item.section == '' then
- value = client.config.settings or vim.NIL
+ if value == nil and item.section == '' then
+ value = client.settings
+ end
+ if value == nil then
+ value = vim.NIL
end
table.insert(response, value)
end
@@ -200,7 +214,7 @@ M[ms.workspace_configuration] = function(_, result, ctx)
return response
end
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_workspaceFolders
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_workspaceFolders
M[ms.workspace_workspaceFolders] = function(_, _, ctx)
local client_id = ctx.client_id
local client = vim.lsp.get_client_by_id(client_id)
@@ -212,41 +226,42 @@ M[ms.workspace_workspaceFolders] = function(_, _, ctx)
end
M[ms.textDocument_publishDiagnostics] = function(...)
- return require('vim.lsp.diagnostic').on_publish_diagnostics(...)
+ return vim.lsp.diagnostic.on_publish_diagnostics(...)
end
M[ms.textDocument_diagnostic] = function(...)
- return require('vim.lsp.diagnostic').on_diagnostic(...)
+ return vim.lsp.diagnostic.on_diagnostic(...)
end
M[ms.textDocument_codeLens] = function(...)
- return require('vim.lsp.codelens').on_codelens(...)
+ return vim.lsp.codelens.on_codelens(...)
end
M[ms.textDocument_inlayHint] = function(...)
- return require('vim.lsp.inlay_hint').on_inlayhint(...)
+ return vim.lsp.inlay_hint.on_inlayhint(...)
end
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_references
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_references
M[ms.textDocument_references] = function(_, result, ctx, config)
if not result or vim.tbl_isempty(result) then
vim.notify('No references found')
- else
- local client = vim.lsp.get_client_by_id(ctx.client_id)
- config = config or {}
- local title = 'References'
- local items = util.locations_to_items(result, client.offset_encoding)
+ return
+ end
- if config.loclist then
- vim.fn.setloclist(0, {}, ' ', { title = title, items = items, context = ctx })
- api.nvim_command('lopen')
- elseif config.on_list then
- assert(type(config.on_list) == 'function', 'on_list is not a function')
- config.on_list({ title = title, items = items, context = ctx })
- else
- vim.fn.setqflist({}, ' ', { title = title, items = items, context = ctx })
- api.nvim_command('botright copen')
- end
+ local client = assert(vim.lsp.get_client_by_id(ctx.client_id))
+ config = config or {}
+ local title = 'References'
+ local items = util.locations_to_items(result, client.offset_encoding)
+
+ if config.loclist then
+ vim.fn.setloclist(0, {}, ' ', { title = title, items = items, context = ctx })
+ api.nvim_command('lopen')
+ elseif config.on_list then
+ assert(type(config.on_list) == 'function', 'on_list is not a function')
+ config.on_list({ title = title, items = items, context = ctx })
+ else
+ vim.fn.setqflist({}, ' ', { title = title, items = items, context = ctx })
+ api.nvim_command('botright copen')
end
end
@@ -259,31 +274,32 @@ end
---
---@param map_result function `((resp, bufnr) -> list)` to convert the response
---@param entity string name of the resource used in a `not found` error message
----@param title_fn function Function to call to generate list title
+---@param title_fn fun(ctx: lsp.HandlerContext): string Function to call to generate list title
+---@return lsp.Handler
local function response_to_list(map_result, entity, title_fn)
return function(_, result, ctx, config)
if not result or vim.tbl_isempty(result) then
vim.notify('No ' .. entity .. ' found')
+ return
+ end
+ config = config or {}
+ local title = title_fn(ctx)
+ local items = map_result(result, ctx.bufnr)
+
+ if config.loclist then
+ vim.fn.setloclist(0, {}, ' ', { title = title, items = items, context = ctx })
+ api.nvim_command('lopen')
+ elseif config.on_list then
+ assert(type(config.on_list) == 'function', 'on_list is not a function')
+ config.on_list({ title = title, items = items, context = ctx })
else
- config = config or {}
- local title = title_fn(ctx)
- local items = map_result(result, ctx.bufnr)
-
- if config.loclist then
- vim.fn.setloclist(0, {}, ' ', { title = title, items = items, context = ctx })
- api.nvim_command('lopen')
- elseif config.on_list then
- assert(type(config.on_list) == 'function', 'on_list is not a function')
- config.on_list({ title = title, items = items, context = ctx })
- else
- vim.fn.setqflist({}, ' ', { title = title, items = items, context = ctx })
- api.nvim_command('botright copen')
- end
+ vim.fn.setqflist({}, ' ', { title = title, items = items, context = ctx })
+ api.nvim_command('botright copen')
end
end
end
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentSymbol
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentSymbol
M[ms.textDocument_documentSymbol] = response_to_list(
util.symbols_to_items,
'document symbols',
@@ -293,45 +309,46 @@ M[ms.textDocument_documentSymbol] = response_to_list(
end
)
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_symbol
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_symbol
M[ms.workspace_symbol] = response_to_list(util.symbols_to_items, 'symbols', function(ctx)
return string.format("Symbols matching '%s'", ctx.params.query)
end)
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_rename
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_rename
M[ms.textDocument_rename] = function(_, result, ctx, _)
if not result then
vim.notify("Language server couldn't provide rename result", vim.log.levels.INFO)
return
end
- local client = vim.lsp.get_client_by_id(ctx.client_id)
+ local client = assert(vim.lsp.get_client_by_id(ctx.client_id))
util.apply_workspace_edit(result, client.offset_encoding)
end
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_rangeFormatting
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_rangeFormatting
M[ms.textDocument_rangeFormatting] = function(_, result, ctx, _)
if not result then
return
end
- local client = vim.lsp.get_client_by_id(ctx.client_id)
+ local client = assert(vim.lsp.get_client_by_id(ctx.client_id))
util.apply_text_edits(result, ctx.bufnr, client.offset_encoding)
end
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting
M[ms.textDocument_formatting] = function(_, result, ctx, _)
if not result then
return
end
- local client = vim.lsp.get_client_by_id(ctx.client_id)
+ local client = assert(vim.lsp.get_client_by_id(ctx.client_id))
util.apply_text_edits(result, ctx.bufnr, client.offset_encoding)
end
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion
M[ms.textDocument_completion] = function(_, result, _, _)
if vim.tbl_isempty(result or {}) then
return
end
- local row, col = unpack(api.nvim_win_get_cursor(0))
+ local cursor = api.nvim_win_get_cursor(0)
+ local row, col = cursor[1], cursor[2]
local line = assert(api.nvim_buf_get_lines(0, row - 1, row, false)[1])
local line_to_cursor = line:sub(col + 1)
local textMatch = vim.fn.match(line_to_cursor, '\\k*$')
@@ -354,6 +371,9 @@ end
--- )
--- ```
---
+---@param _ lsp.ResponseError?
+---@param result lsp.Hover
+---@param ctx lsp.HandlerContext
---@param config table Configuration table.
--- - border: (default=nil)
--- - Add borders to the floating window
@@ -388,20 +408,21 @@ function M.hover(_, result, ctx, config)
return util.open_floating_preview(contents, format, config)
end
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_hover
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_hover
M[ms.textDocument_hover] = M.hover
--- Jumps to a location. Used as a handler for multiple LSP methods.
---@param _ nil not used
---@param result (table) result of LSP method; a location or a list of locations.
----@param ctx (table) table containing the context of the request, including the method
+---@param ctx (lsp.HandlerContext) table containing the context of the request, including the method
+---@param config? vim.lsp.LocationOpts
---(`textDocument/definition` can return `Location` or `Location[]`
local function location_handler(_, result, ctx, config)
if result == nil or vim.tbl_isempty(result) then
- local _ = log.info() and log.info(ctx.method, 'No location found')
+ log.info(ctx.method, 'No location found')
return nil
end
- local client = vim.lsp.get_client_by_id(ctx.client_id)
+ local client = assert(vim.lsp.get_client_by_id(ctx.client_id))
config = config or {}
@@ -427,13 +448,13 @@ local function location_handler(_, result, ctx, config)
api.nvim_command('botright copen')
end
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_declaration
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_declaration
M[ms.textDocument_declaration] = location_handler
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_definition
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_definition
M[ms.textDocument_definition] = location_handler
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_typeDefinition
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_typeDefinition
M[ms.textDocument_typeDefinition] = location_handler
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_implementation
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_implementation
M[ms.textDocument_implementation] = location_handler
--- |lsp-handler| for the method "textDocument/signatureHelp".
@@ -449,8 +470,9 @@ M[ms.textDocument_implementation] = location_handler
--- )
--- ```
---
----@param result table Response from the language server
----@param ctx table Client context
+---@param _ lsp.ResponseError?
+---@param result lsp.SignatureHelp Response from the language server
+---@param ctx lsp.HandlerContext Client context
---@param config table Configuration table.
--- - border: (default=nil)
--- - Add borders to the floating window
@@ -470,7 +492,7 @@ function M.signature_help(_, result, ctx, config)
end
return
end
- local client = vim.lsp.get_client_by_id(ctx.client_id)
+ local client = assert(vim.lsp.get_client_by_id(ctx.client_id))
local triggers =
vim.tbl_get(client.server_capabilities, 'signatureHelpProvider', 'triggerCharacters')
local ft = vim.bo[ctx.bufnr].filetype
@@ -490,10 +512,10 @@ function M.signature_help(_, result, ctx, config)
return fbuf, fwin
end
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_signatureHelp
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_signatureHelp
M[ms.textDocument_signatureHelp] = M.signature_help
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentHighlight
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentHighlight
M[ms.textDocument_documentHighlight] = function(_, result, ctx, _)
if not result then
return
@@ -506,21 +528,22 @@ M[ms.textDocument_documentHighlight] = function(_, result, ctx, _)
util.buf_highlight_references(ctx.bufnr, result, client.offset_encoding)
end
----@private
+--- @private
---
--- Displays call hierarchy in the quickfix window.
---
----@param direction `"from"` for incoming calls and `"to"` for outgoing calls
----@return function
---- `CallHierarchyIncomingCall[]` if {direction} is `"from"`,
---- `CallHierarchyOutgoingCall[]` if {direction} is `"to"`,
-local make_call_hierarchy_handler = function(direction)
+--- @param direction 'from'|'to' `"from"` for incoming calls and `"to"` for outgoing calls
+--- @overload fun(direction:'from'): fun(_, result: lsp.CallHierarchyIncomingCall[]?)
+--- @overload fun(direction:'to'): fun(_, result: lsp.CallHierarchyOutgoingCall[]?)
+local function make_call_hierarchy_handler(direction)
+ --- @param result lsp.CallHierarchyIncomingCall[]|lsp.CallHierarchyOutgoingCall[]
return function(_, result)
if not result then
return
end
local items = {}
for _, call_hierarchy_call in pairs(result) do
+ --- @type lsp.CallHierarchyItem
local call_hierarchy_item = call_hierarchy_call[direction]
for _, range in pairs(call_hierarchy_call.fromRanges) do
table.insert(items, {
@@ -536,13 +559,14 @@ local make_call_hierarchy_handler = function(direction)
end
end
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#callHierarchy_incomingCalls
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#callHierarchy_incomingCalls
M[ms.callHierarchy_incomingCalls] = make_call_hierarchy_handler('from')
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#callHierarchy_outgoingCalls
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#callHierarchy_outgoingCalls
M[ms.callHierarchy_outgoingCalls] = make_call_hierarchy_handler('to')
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window_logMessage
+--- @see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window_logMessage
+--- @param result lsp.LogMessageParams
M[ms.window_logMessage] = function(_, result, ctx, _)
local message_type = result.type
local message = result.message
@@ -564,7 +588,8 @@ M[ms.window_logMessage] = function(_, result, ctx, _)
return result
end
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window_showMessage
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window_showMessage
+--- @param result lsp.ShowMessageParams
M[ms.window_showMessage] = function(_, result, ctx, _)
local message_type = result.type
local message = result.message
@@ -583,7 +608,8 @@ M[ms.window_showMessage] = function(_, result, ctx, _)
return result
end
---see: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window_showDocument
+--- @see # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#window_showDocument
+--- @param result lsp.ShowDocumentParams
M[ms.window_showDocument] = function(_, result, ctx, _)
local uri = result.uri
@@ -626,19 +652,25 @@ end
---@see https://microsoft.github.io/language-server-protocol/specification/#workspace_inlayHint_refresh
M[ms.workspace_inlayHint_refresh] = function(err, result, ctx, config)
- return require('vim.lsp.inlay_hint').on_refresh(err, result, ctx, config)
+ return vim.lsp.inlay_hint.on_refresh(err, result, ctx, config)
+end
+
+---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#semanticTokens_refreshRequest
+M[ms.workspace_semanticTokens_refresh] = function(err, result, ctx, _config)
+ return vim.lsp.semantic_tokens._refresh(err, result, ctx)
end
-- Add boilerplate error validation and logging for all of these.
for k, fn in pairs(M) do
M[k] = function(err, result, ctx, config)
- local _ = log.trace()
- and log.trace('default_handler', ctx.method, {
+ if log.trace() then
+ log.trace('default_handler', ctx.method, {
err = err,
result = result,
ctx = vim.inspect(ctx),
config = config,
})
+ end
if err then
-- LSP spec:
diff --git a/runtime/lua/vim/lsp/health.lua b/runtime/lua/vim/lsp/health.lua
index fe06006108..797a1097f9 100644
--- a/runtime/lua/vim/lsp/health.lua
+++ b/runtime/lua/vim/lsp/health.lua
@@ -1,13 +1,12 @@
local M = {}
---- Performs a healthcheck for LSP
-function M.check()
- local report_info = vim.health.info
- local report_warn = vim.health.warn
+local report_info = vim.health.info
+local report_warn = vim.health.warn
- local log = require('vim.lsp.log')
+local function check_log()
+ local log = vim.lsp.log
local current_log_level = log.get_level()
- local log_level_string = log.levels[current_log_level]
+ local log_level_string = log.levels[current_log_level] ---@type string
report_info(string.format('LSP log level : %s', log_level_string))
if current_log_level < log.levels.WARN then
@@ -27,9 +26,11 @@ function M.check()
local report_fn = (log_size / 1000000 > 100 and report_warn or report_info)
report_fn(string.format('Log size: %d KB', log_size / 1000))
+end
- local clients = vim.lsp.get_clients()
+local function check_active_clients()
vim.health.start('vim.lsp: Active Clients')
+ local clients = vim.lsp.get_clients()
if next(clients) then
for _, client in pairs(clients) do
local attached_to = table.concat(vim.tbl_keys(client.attached_buffers or {}), ',')
@@ -38,7 +39,7 @@ function M.check()
'%s (id=%s, root_dir=%s, attached_to=[%s])',
client.name,
client.id,
- vim.fn.fnamemodify(client.config.root_dir, ':~'),
+ vim.fn.fnamemodify(client.root_dir, ':~'),
attached_to
)
)
@@ -48,4 +49,33 @@ function M.check()
end
end
+local function check_watcher()
+ vim.health.start('vim.lsp: File watcher')
+ local watchfunc = vim.lsp._watchfiles._watchfunc
+ assert(watchfunc)
+ local watchfunc_name --- @type string
+ if watchfunc == vim._watch.watch then
+ watchfunc_name = 'libuv-watch'
+ elseif watchfunc == vim._watch.watchdirs then
+ watchfunc_name = 'libuv-watchdirs'
+ elseif watchfunc == vim._watch.fswatch then
+ watchfunc_name = 'fswatch'
+ else
+ local nm = debug.getinfo(watchfunc, 'S').source
+ watchfunc_name = string.format('Custom (%s)', nm)
+ end
+
+ report_info('File watch backend: ' .. watchfunc_name)
+ if watchfunc_name == 'libuv-watchdirs' then
+ report_warn('libuv-watchdirs has known performance issues. Consider installing fswatch.')
+ end
+end
+
+--- Performs a healthcheck for LSP
+function M.check()
+ check_log()
+ check_active_clients()
+ check_watcher()
+end
+
return M
diff --git a/runtime/lua/vim/lsp/inlay_hint.lua b/runtime/lua/vim/lsp/inlay_hint.lua
index 4f7a3b0076..ec676ea97f 100644
--- a/runtime/lua/vim/lsp/inlay_hint.lua
+++ b/runtime/lua/vim/lsp/inlay_hint.lua
@@ -4,12 +4,12 @@ local ms = require('vim.lsp.protocol').Methods
local api = vim.api
local M = {}
----@class lsp.inlay_hint.bufstate
+---@class (private) vim.lsp.inlay_hint.bufstate
---@field version? integer
----@field client_hint? table<integer, table<integer, lsp.InlayHint[]>> client_id -> (lnum -> hints)
+---@field client_hints? table<integer, table<integer, lsp.InlayHint[]>> client_id -> (lnum -> hints)
---@field applied table<integer, integer> Last version of hints applied to this line
---@field enabled boolean Whether inlay hints are enabled for this buffer
----@type table<integer, lsp.inlay_hint.bufstate>
+---@type table<integer, vim.lsp.inlay_hint.bufstate>
local bufstates = {}
local namespace = api.nvim_create_namespace('vim_lsp_inlayhint')
@@ -17,13 +17,15 @@ local augroup = api.nvim_create_augroup('vim_lsp_inlayhint', {})
--- |lsp-handler| for the method `textDocument/inlayHint`
--- Store hints for a specific buffer and client
+---@param result lsp.InlayHint[]?
+---@param ctx lsp.HandlerContext
---@private
function M.on_inlayhint(err, result, ctx, _)
if err then
- local _ = log.error() and log.error('inlayhint', err)
+ log.error('inlayhint', err)
return
end
- local bufnr = ctx.bufnr
+ local bufnr = assert(ctx.bufnr)
if util.buf_versions[bufnr] ~= ctx.version then
return
end
@@ -35,12 +37,12 @@ function M.on_inlayhint(err, result, ctx, _)
if not bufstate or not bufstate.enabled then
return
end
- if not (bufstate.client_hint and bufstate.version) then
- bufstate.client_hint = vim.defaulttable()
+ if not (bufstate.client_hints and bufstate.version) then
+ bufstate.client_hints = vim.defaulttable()
bufstate.version = ctx.version
end
- local hints_by_client = bufstate.client_hint
- local client = vim.lsp.get_client_by_id(client_id)
+ local hints_by_client = bufstate.client_hints
+ local client = assert(vim.lsp.get_client_by_id(client_id))
local new_hints_by_lnum = vim.defaulttable()
local num_unprocessed = #result
@@ -52,6 +54,8 @@ function M.on_inlayhint(err, result, ctx, _)
end
local lines = api.nvim_buf_get_lines(bufnr, 0, -1, false)
+ ---@param position lsp.Position
+ ---@return integer
local function pos_to_byte(position)
local col = position.character
if col > 0 then
@@ -78,6 +82,7 @@ function M.on_inlayhint(err, result, ctx, _)
end
--- |lsp-handler| for the method `textDocument/inlayHint/refresh`
+---@param ctx lsp.HandlerContext
---@private
function M.on_refresh(err, _, ctx, _)
if err then
@@ -98,11 +103,14 @@ function M.on_refresh(err, _, ctx, _)
return vim.NIL
end
---- @class vim.lsp.inlay_hint.get.filter
+--- Optional filters |kwargs|:
+--- @class vim.lsp.inlay_hint.get.Filter
+--- @inlinedoc
--- @field bufnr integer?
--- @field range lsp.Range?
----
+
--- @class vim.lsp.inlay_hint.get.ret
+--- @inlinedoc
--- @field bufnr integer
--- @field client_id integer
--- @field inlay_hint lsp.InlayHint
@@ -125,17 +133,8 @@ end
--- })
--- ```
---
---- @param filter vim.lsp.inlay_hint.get.filter?
---- Optional filters |kwargs|:
---- - bufnr (integer?): 0 for current buffer
---- - range (lsp.Range?)
----
+--- @param filter vim.lsp.inlay_hint.get.Filter?
--- @return vim.lsp.inlay_hint.get.ret[]
---- Each list item is a table with the following fields:
---- - bufnr (integer)
---- - client_id (integer)
---- - inlay_hint (lsp.InlayHint)
----
--- @since 12
function M.get(filter)
vim.validate({ filter = { filter, 'table', true } })
@@ -155,7 +154,7 @@ function M.get(filter)
end
local bufstate = bufstates[bufnr]
- if not (bufstate and bufstate.client_hint) then
+ if not (bufstate and bufstate.client_hints) then
return {}
end
@@ -178,7 +177,7 @@ function M.get(filter)
--- @type vim.lsp.inlay_hint.get.ret[]
local hints = {}
for _, client in pairs(clients) do
- local hints_by_lnum = bufstate.client_hint[client.id]
+ local hints_by_lnum = bufstate.client_hints[client.id]
if hints_by_lnum then
for lnum = range.start.line, range['end'].line do
local line_hints = hints_by_lnum[lnum] or {}
@@ -211,11 +210,11 @@ local function clear(bufnr)
return
end
local bufstate = bufstates[bufnr]
- local client_lens = (bufstate or {}).client_hint or {}
- local client_ids = vim.tbl_keys(client_lens)
+ local client_lens = (bufstate or {}).client_hints or {}
+ local client_ids = vim.tbl_keys(client_lens) --- @type integer[]
for _, iter_client_id in ipairs(client_ids) do
if bufstate then
- bufstate.client_hint[iter_client_id] = {}
+ bufstate.client_hints[iter_client_id] = {}
end
end
api.nvim_buf_clear_namespace(bufnr, namespace, 0, -1)
@@ -236,7 +235,7 @@ end
--- Refresh inlay hints, only if we have attached clients that support it
---@param bufnr (integer) Buffer handle, or 0 for current
----@param opts? table Additional options to pass to util._refresh
+---@param opts? vim.lsp.util._refresh.Opts Additional options to pass to util._refresh
---@private
local function _refresh(bufnr, opts)
opts = opts or {}
@@ -312,7 +311,7 @@ api.nvim_set_decoration_provider(namespace, {
if bufstate.version ~= util.buf_versions[bufnr] then
return
end
- local hints_by_client = bufstate.client_hint
+ local hints_by_client = assert(bufstate.client_hints)
for lnum = topline, botline do
if bufstate.applied[lnum] ~= bufstate.version then
@@ -321,14 +320,15 @@ api.nvim_set_decoration_provider(namespace, {
local line_hints = hints_by_lnum[lnum] or {}
for _, hint in pairs(line_hints) do
local text = ''
- if type(hint.label) == 'string' then
- text = hint.label
+ local label = hint.label
+ if type(label) == 'string' then
+ text = label
else
- for _, part in ipairs(hint.label) do
+ for _, part in ipairs(label) do
text = text .. part.value
end
end
- local vt = {}
+ local vt = {} --- @type {[1]: string, [2]: string?}[]
if hint.paddingLeft then
vt[#vt + 1] = { ' ' }
end
@@ -360,7 +360,13 @@ function M.is_enabled(bufnr)
return bufstates[bufnr] and bufstates[bufnr].enabled or false
end
---- Enable/disable/toggle inlay hints for a buffer
+--- Enables or disables inlay hints for a buffer.
+---
+--- To "toggle", pass the inverse of `is_enabled()`:
+---
+--- ```lua
+--- vim.lsp.inlay_hint.enable(0, not vim.lsp.inlay_hint.is_enabled())
+--- ```
---
--- @param bufnr (integer|nil) Buffer handle, or 0 or nil for current
--- @param enable (boolean|nil) true/nil to enable, false to disable
diff --git a/runtime/lua/vim/lsp/log.lua b/runtime/lua/vim/lsp/log.lua
index 6d2e0bc292..9f2bd71158 100644
--- a/runtime/lua/vim/lsp/log.lua
+++ b/runtime/lua/vim/lsp/log.lua
@@ -2,138 +2,144 @@
local log = {}
+local log_levels = vim.log.levels
+
--- Log level dictionary with reverse lookup as well.
---
--- Can be used to lookup the number from the name or the name from the number.
--- Levels by name: "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "OFF"
--- Level numbers begin with "TRACE" at 0
+--- @type table<string|integer, string|integer>
--- @nodoc
-log.levels = vim.deepcopy(vim.log.levels)
+log.levels = vim.deepcopy(log_levels)
-- Default log level is warn.
-local current_log_level = log.levels.WARN
+local current_log_level = log_levels.WARN
+
local log_date_format = '%F %H:%M:%S'
-local format_func = function(arg)
+
+local function format_func(arg)
return vim.inspect(arg, { newline = '' })
end
-do
- local function notify(msg, level)
- if vim.in_fast_event() then
- vim.schedule(function()
- vim.notify(msg, level)
- end)
- else
+local function notify(msg, level)
+ if vim.in_fast_event() then
+ vim.schedule(function()
vim.notify(msg, level)
- end
+ end)
+ else
+ vim.notify(msg, level)
end
+end
+
+local logfilename = vim.fs.joinpath(vim.fn.stdpath('log'), 'lsp.log')
+
+-- TODO: Ideally the directory should be created in open_logfile(), right
+-- before opening the log file, but open_logfile() can be called from libuv
+-- callbacks, where using fn.mkdir() is not allowed.
+vim.fn.mkdir(vim.fn.stdpath('log'), 'p')
+
+--- Returns the log filename.
+---@return string log filename
+function log.get_filename()
+ return logfilename
+end
- local path_sep = vim.uv.os_uname().version:match('Windows') and '\\' or '/'
- local function path_join(...)
- return table.concat(vim.tbl_flatten({ ... }), path_sep)
+--- @type file*?, string?
+local logfile, openerr
+
+--- Opens log file. Returns true if file is open, false on error
+local function open_logfile()
+ -- Try to open file only once
+ if logfile then
+ return true
+ end
+ if openerr then
+ return false
end
- local logfilename = path_join(vim.fn.stdpath('log'), 'lsp.log')
- -- TODO: Ideally the directory should be created in open_logfile(), right
- -- before opening the log file, but open_logfile() can be called from libuv
- -- callbacks, where using fn.mkdir() is not allowed.
- vim.fn.mkdir(vim.fn.stdpath('log'), 'p')
+ logfile, openerr = io.open(logfilename, 'a+')
+ if not logfile then
+ local err_msg = string.format('Failed to open LSP client log file: %s', openerr)
+ notify(err_msg, log_levels.ERROR)
+ return false
+ end
- --- Returns the log filename.
- ---@return string log filename
- function log.get_filename()
- return logfilename
+ local log_info = vim.uv.fs_stat(logfilename)
+ if log_info and log_info.size > 1e9 then
+ local warn_msg = string.format(
+ 'LSP client log is large (%d MB): %s',
+ log_info.size / (1000 * 1000),
+ logfilename
+ )
+ notify(warn_msg)
end
- local logfile, openerr
- --- Opens log file. Returns true if file is open, false on error
- local function open_logfile()
- -- Try to open file only once
- if logfile then
+ -- Start message for logging
+ logfile:write(string.format('[START][%s] LSP logging initiated\n', os.date(log_date_format)))
+ return true
+end
+
+for level, levelnr in pairs(log_levels) do
+ -- Also export the log level on the root object.
+ log[level] = levelnr
+
+ -- Add a reverse lookup.
+ log.levels[levelnr] = level
+end
+
+--- @param level string
+--- @param levelnr integer
+--- @return fun(...:any): boolean?
+local function create_logger(level, levelnr)
+ return function(...)
+ if levelnr < current_log_level then
+ return false
+ end
+ local argc = select('#', ...)
+ if argc == 0 then
return true
end
- if openerr then
+ if not open_logfile() then
return false
end
-
- logfile, openerr = io.open(logfilename, 'a+')
- if not logfile then
- local err_msg = string.format('Failed to open LSP client log file: %s', openerr)
- notify(err_msg, vim.log.levels.ERROR)
- return false
+ local info = debug.getinfo(2, 'Sl')
+ local header = string.format(
+ '[%s][%s] ...%s:%s',
+ level,
+ os.date(log_date_format),
+ info.short_src:sub(-16),
+ info.currentline
+ )
+ local parts = { header }
+ for i = 1, argc do
+ local arg = select(i, ...)
+ table.insert(parts, arg == nil and 'nil' or format_func(arg))
end
+ assert(logfile)
+ logfile:write(table.concat(parts, '\t'), '\n')
+ logfile:flush()
+ end
+end
- local log_info = vim.uv.fs_stat(logfilename)
- if log_info and log_info.size > 1e9 then
- local warn_msg = string.format(
- 'LSP client log is large (%d MB): %s',
- log_info.size / (1000 * 1000),
- logfilename
- )
- notify(warn_msg)
- end
+-- If called without arguments, it will check whether the log level is
+-- greater than or equal to this one. When called with arguments, it will
+-- log at that level (if applicable, it is checked either way).
- -- Start message for logging
- logfile:write(string.format('[START][%s] LSP logging initiated\n', os.date(log_date_format)))
- return true
- end
+--- @nodoc
+log.debug = create_logger('DEBUG', log_levels.DEBUG)
- for level, levelnr in pairs(log.levels) do
- -- Also export the log level on the root object.
- log[level] = levelnr
- -- FIXME: DOC
- -- Should be exposed in the vim docs.
- --
- -- Set the lowercase name as the main use function.
- -- If called without arguments, it will check whether the log level is
- -- greater than or equal to this one. When called with arguments, it will
- -- log at that level (if applicable, it is checked either way).
- --
- -- Recommended usage:
- -- ```
- -- local _ = log.warn() and log.warn("123")
- -- ```
- --
- -- This way you can avoid string allocations if the log level isn't high enough.
- if level ~= 'OFF' then
- log[level:lower()] = function(...)
- local argc = select('#', ...)
- if levelnr < current_log_level then
- return false
- end
- if argc == 0 then
- return true
- end
- if not open_logfile() then
- return false
- end
- local info = debug.getinfo(2, 'Sl')
- local header = string.format(
- '[%s][%s] ...%s:%s',
- level,
- os.date(log_date_format),
- string.sub(info.short_src, #info.short_src - 15),
- info.currentline
- )
- local parts = { header }
- for i = 1, argc do
- local arg = select(i, ...)
- if arg == nil then
- table.insert(parts, 'nil')
- else
- table.insert(parts, format_func(arg))
- end
- end
- logfile:write(table.concat(parts, '\t'), '\n')
- logfile:flush()
- end
- end
- end
-end
+--- @nodoc
+log.error = create_logger('ERROR', log_levels.ERROR)
--- This is put here on purpose after the loop above so that it doesn't
--- interfere with iterating the levels
-vim.tbl_add_reverse_lookup(log.levels)
+--- @nodoc
+log.info = create_logger('INFO', log_levels.INFO)
+
+--- @nodoc
+log.trace = create_logger('TRACE', log_levels.TRACE)
+
+--- @nodoc
+log.warn = create_logger('WARN', log_levels.WARN)
--- Sets the current log level.
---@param level (string|integer) One of `vim.lsp.log.levels`
@@ -163,7 +169,7 @@ end
--- Checks whether the level is sufficient for logging.
---@param level integer log level
----@returns (bool) true if would log, false if not
+---@return bool : true if would log, false if not
function log.should_log(level)
return level >= current_log_level
end
diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua
index a7c3914834..599f02425e 100644
--- a/runtime/lua/vim/lsp/protocol.lua
+++ b/runtime/lua/vim/lsp/protocol.lua
@@ -1,24 +1,17 @@
--- Protocol for the Microsoft Language Server Protocol (mslsp)
-
-local protocol = {}
+--- @diagnostic disable: duplicate-doc-alias
---[=[
----@private
---- Useful for interfacing with:
---- https://github.com/microsoft/language-server-protocol/raw/gh-pages/_specifications/specification-3-14.md
-function transform_schema_comments()
- nvim.command [[silent! '<,'>g/\/\*\*\|\*\/\|^$/d]]
- nvim.command [[silent! '<,'>s/^\(\s*\) \* \=\(.*\)/\1--\2/]]
-end
----@private
-function transform_schema_to_table()
- transform_schema_comments()
- nvim.command [[silent! '<,'>s/: \S\+//]]
- nvim.command [[silent! '<,'>s/export const //]]
- nvim.command [[silent! '<,'>s/export namespace \(\S*\)\s*{/protocol.\1 = {/]]
- nvim.command [[silent! '<,'>s/namespace \(\S*\)\s*{/protocol.\1 = {/]]
+---@param tbl table<string, string|number>
+local function get_value_set(tbl)
+ local value_set = {}
+ for _, v in pairs(tbl) do
+ table.insert(value_set, v)
+ end
+ table.sort(value_set)
+ return value_set
end
---]=]
+
+-- Protocol for the Microsoft Language Server Protocol (mslsp)
+local protocol = {}
local constants = {
--- @enum lsp.DiagnosticSeverity
@@ -313,10 +306,13 @@ local constants = {
},
}
-for k, v in pairs(constants) do
- local tbl = vim.deepcopy(v)
- vim.tbl_add_reverse_lookup(tbl)
- protocol[k] = tbl
+for k1, v1 in pairs(constants) do
+ local tbl = vim.deepcopy(v1, true)
+ for _, k2 in ipairs(vim.tbl_keys(tbl)) do
+ local v2 = tbl[k2]
+ tbl[v2] = k2
+ end
+ protocol[k1] = tbl
end
--[=[
@@ -722,11 +718,7 @@ function protocol.make_client_capabilities()
codeActionLiteralSupport = {
codeActionKind = {
- valueSet = (function()
- local res = vim.tbl_values(constants.CodeActionKind)
- table.sort(res)
- return res
- end)(),
+ valueSet = get_value_set(constants.CodeActionKind),
},
},
isPreferredSupport = true,
@@ -751,18 +743,18 @@ function protocol.make_client_capabilities()
commitCharactersSupport = false,
preselectSupport = false,
deprecatedSupport = false,
- documentationFormat = { protocol.MarkupKind.Markdown, protocol.MarkupKind.PlainText },
+ documentationFormat = { constants.MarkupKind.Markdown, constants.MarkupKind.PlainText },
},
completionItemKind = {
- valueSet = (function()
- local res = {}
- for k in ipairs(protocol.CompletionItemKind) do
- if type(k) == 'number' then
- table.insert(res, k)
- end
- end
- return res
- end)(),
+ valueSet = get_value_set(constants.CompletionItemKind),
+ },
+ completionList = {
+ itemDefaults = {
+ 'editRange',
+ 'insertTextFormat',
+ 'insertTextMode',
+ 'data',
+ },
},
-- TODO(tjdevries): Implement this
@@ -783,13 +775,13 @@ function protocol.make_client_capabilities()
},
hover = {
dynamicRegistration = true,
- contentFormat = { protocol.MarkupKind.Markdown, protocol.MarkupKind.PlainText },
+ contentFormat = { constants.MarkupKind.Markdown, constants.MarkupKind.PlainText },
},
signatureHelp = {
dynamicRegistration = false,
signatureInformation = {
activeParameterSupport = true,
- documentationFormat = { protocol.MarkupKind.Markdown, protocol.MarkupKind.PlainText },
+ documentationFormat = { constants.MarkupKind.Markdown, constants.MarkupKind.PlainText },
parameterInformation = {
labelOffsetSupport = true,
},
@@ -804,15 +796,7 @@ function protocol.make_client_capabilities()
documentSymbol = {
dynamicRegistration = false,
symbolKind = {
- valueSet = (function()
- local res = {}
- for k in ipairs(protocol.SymbolKind) do
- if type(k) == 'number' then
- table.insert(res, k)
- end
- end
- return res
- end)(),
+ valueSet = get_value_set(constants.SymbolKind),
},
hierarchicalDocumentSymbolSupport = true,
},
@@ -823,15 +807,7 @@ function protocol.make_client_capabilities()
publishDiagnostics = {
relatedInformation = true,
tagSupport = {
- valueSet = (function()
- local res = {}
- for k in ipairs(protocol.DiagnosticTag) do
- if type(k) == 'number' then
- table.insert(res, k)
- end
- end
- return res
- end)(),
+ valueSet = get_value_set(constants.DiagnosticTag),
},
dataSupport = true,
},
@@ -843,15 +819,7 @@ function protocol.make_client_capabilities()
symbol = {
dynamicRegistration = false,
symbolKind = {
- valueSet = (function()
- local res = {}
- for k in ipairs(protocol.SymbolKind) do
- if type(k) == 'number' then
- table.insert(res, k)
- end
- end
- return res
- end)(),
+ valueSet = get_value_set(constants.SymbolKind),
},
},
configuration = true,
@@ -891,9 +859,9 @@ end
--- Creates a normalized object describing LSP server capabilities.
---@param server_capabilities table Table of capabilities supported by the server
----@return table|nil Normalized table of capabilities
+---@return lsp.ServerCapabilities|nil : Normalized table of capabilities
function protocol.resolve_capabilities(server_capabilities)
- local TextDocumentSyncKind = protocol.TextDocumentSyncKind
+ local TextDocumentSyncKind = protocol.TextDocumentSyncKind ---@type table<string|number, string|number>
local textDocumentSync = server_capabilities.textDocumentSync
if textDocumentSync == nil then
-- Defaults if omitted.
@@ -934,7 +902,7 @@ end
-- Generated by gen_lsp.lua, keep at end of file.
--- LSP method names.
---
----@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#metaModel
+---@see https://microsoft.github.io/language-server-protocol/specification/#metaModel
protocol.Methods = {
--- A request to resolve the incoming calls for a given `CallHierarchyItem`.
--- @since 3.16.0
@@ -1021,16 +989,14 @@ protocol.Methods = {
--- `filterText`, `insertText`, and `textEdit`, must not be changed during resolve.
textDocument_completion = 'textDocument/completion',
--- A request to resolve the type definition locations of a symbol at a given text
- --- document position. The request's parameter is of type [TextDocumentPositionParams]
- --- (#TextDocumentPositionParams) the response is of type {@link Declaration}
- --- or a typed array of {@link DeclarationLink} or a Thenable that resolves
- --- to such.
+ --- document position. The request's parameter is of type {@link TextDocumentPositionParams}
+ --- the response is of type {@link Declaration} or a typed array of {@link DeclarationLink}
+ --- or a Thenable that resolves to such.
textDocument_declaration = 'textDocument/declaration',
--- A request to resolve the definition location of a symbol at a given text
- --- document position. The request's parameter is of type [TextDocumentPosition]
- --- (#TextDocumentPosition) the response is of either type {@link Definition}
- --- or a typed array of {@link DefinitionLink} or a Thenable that resolves
- --- to such.
+ --- document position. The request's parameter is of type {@link TextDocumentPosition}
+ --- the response is of either type {@link Definition} or a typed array of
+ --- {@link DefinitionLink} or a Thenable that resolves to such.
textDocument_definition = 'textDocument/definition',
--- The document diagnostic request definition.
--- @since 3.17.0
@@ -1064,9 +1030,9 @@ protocol.Methods = {
--- that resolves to such.
textDocument_documentColor = 'textDocument/documentColor',
--- Request to resolve a {@link DocumentHighlight} for a given
- --- text document position. The request's parameter is of type [TextDocumentPosition]
- --- (#TextDocumentPosition) the request response is of type [DocumentHighlight[]]
- --- (#DocumentHighlight) or a Thenable that resolves to such.
+ --- text document position. The request's parameter is of type {@link TextDocumentPosition}
+ --- the request response is an array of type {@link DocumentHighlight}
+ --- or a Thenable that resolves to such.
textDocument_documentHighlight = 'textDocument/documentHighlight',
--- A request to provide document links
textDocument_documentLink = 'textDocument/documentLink',
@@ -1080,16 +1046,15 @@ protocol.Methods = {
--- response is of type {@link FoldingRangeList} or a Thenable
--- that resolves to such.
textDocument_foldingRange = 'textDocument/foldingRange',
- --- A request to to format a whole document.
+ --- A request to format a whole document.
textDocument_formatting = 'textDocument/formatting',
--- Request to request hover information at a given text document position. The request's
--- parameter is of type {@link TextDocumentPosition} the response is of
--- type {@link Hover} or a Thenable that resolves to such.
textDocument_hover = 'textDocument/hover',
--- A request to resolve the implementation locations of a symbol at a given text
- --- document position. The request's parameter is of type [TextDocumentPositionParams]
- --- (#TextDocumentPositionParams) the response is of type {@link Definition} or a
- --- Thenable that resolves to such.
+ --- document position. The request's parameter is of type {@link TextDocumentPositionParams}
+ --- the response is of type {@link Definition} or a Thenable that resolves to such.
textDocument_implementation = 'textDocument/implementation',
--- A request to provide inlay hints in a document. The request's parameter is of
--- type {@link InlayHintsParams}, the response is of type
@@ -1100,6 +1065,7 @@ protocol.Methods = {
--- type {@link InlineCompletionParams}, the response is of type
--- {@link InlineCompletion InlineCompletion[]} or a Thenable that resolves to such.
--- @since 3.18.0
+ --- @proposed
textDocument_inlineCompletion = 'textDocument/inlineCompletion',
--- A request to provide inline values in a document. The request's parameter is of
--- type {@link InlineValueParams}, the response is of type
@@ -1155,9 +1121,8 @@ protocol.Methods = {
textDocument_semanticTokens_range = 'textDocument/semanticTokens/range',
textDocument_signatureHelp = 'textDocument/signatureHelp',
--- A request to resolve the type definition locations of a symbol at a given text
- --- document position. The request's parameter is of type [TextDocumentPositionParams]
- --- (#TextDocumentPositionParams) the response is of type {@link Definition} or a
- --- Thenable that resolves to such.
+ --- document position. The request's parameter is of type {@link TextDocumentPositionParams}
+ --- the response is of type {@link Definition} or a Thenable that resolves to such.
textDocument_typeDefinition = 'textDocument/typeDefinition',
--- A document will save notification is sent from the client to the server before
--- the document is actually saved.
@@ -1200,14 +1165,14 @@ protocol.Methods = {
--- symbol's location.
--- @since 3.17.0
workspaceSymbol_resolve = 'workspaceSymbol/resolve',
- --- A request sent from the server to the client to modified certain resources.
+ --- A request sent from the server to the client to modify certain resources.
workspace_applyEdit = 'workspace/applyEdit',
--- A request to refresh all code actions
--- @since 3.16.0
workspace_codeLens_refresh = 'workspace/codeLens/refresh',
--- The 'workspace/configuration' request is sent from the server to the client to fetch a certain
--- configuration setting.
- --- This pull model replaces the old push model were the client signaled configuration change via an
+ --- This pull model replaces the old push model where the client signaled configuration change via an
--- event. If the server still needs to react to configuration changes (since the server caches the
--- result of `workspace/configuration` requests) the server should register for an empty configuration
--- change event and empty the cache if such an event is received.
@@ -1240,9 +1205,12 @@ protocol.Methods = {
--- files were renamed from within the client.
--- @since 3.16.0
workspace_didRenameFiles = 'workspace/didRenameFiles',
- --- A request send from the client to the server to execute a command. The request might return
+ --- A request sent from the client to the server to execute a command. The request might return
--- a workspace edit which the client will apply to the workspace.
workspace_executeCommand = 'workspace/executeCommand',
+ --- @since 3.18.0
+ --- @proposed
+ workspace_foldingRange_refresh = 'workspace/foldingRange/refresh',
--- @since 3.17.0
workspace_inlayHint_refresh = 'workspace/inlayHint/refresh',
--- @since 3.17.0
diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua
index 6ab5708721..984e4f040a 100644
--- a/runtime/lua/vim/lsp/rpc.lua
+++ b/runtime/lua/vim/lsp/rpc.lua
@@ -6,7 +6,7 @@ local validate, schedule, schedule_wrap = vim.validate, vim.schedule, vim.schedu
local is_win = uv.os_uname().version:find('Windows')
--- Checks whether a given path exists and is a directory.
----@param filename (string) path to check
+---@param filename string path to check
---@return boolean
local function is_dir(filename)
local stat = uv.fs_stat(filename)
@@ -15,34 +15,39 @@ end
--- Embeds the given string into a table and correctly computes `Content-Length`.
---
----@param encoded_message (string)
----@return string containing encoded message and `Content-Length` attribute
-local function format_message_with_content_length(encoded_message)
+---@param message string
+---@return string message with `Content-Length` attribute
+local function format_message_with_content_length(message)
return table.concat({
'Content-Length: ',
- tostring(#encoded_message),
+ tostring(#message),
'\r\n\r\n',
- encoded_message,
+ message,
})
end
+---@class (private) vim.lsp.rpc.Headers: {string: any}
+---@field content_length integer
+
--- Parses an LSP Message's header
---
----@param header string: The header to parse.
----@return table # parsed headers
+---@param header string The header to parse.
+---@return vim.lsp.rpc.Headers#parsed headers
local function parse_headers(header)
assert(type(header) == 'string', 'header must be a string')
+ --- @type vim.lsp.rpc.Headers
local headers = {}
for line in vim.gsplit(header, '\r\n', { plain = true }) do
if line == '' then
break
end
+ --- @type string?, string?
local key, value = line:match('^%s*(%S+)%s*:%s*(.+)%s*$')
if key then
- key = key:lower():gsub('%-', '_')
+ key = key:lower():gsub('%-', '_') --- @type string
headers[key] = value
else
- local _ = log.error() and log.error('invalid header line %q', line)
+ log.error('invalid header line %q', line)
error(string.format('invalid header line %q', line))
end
end
@@ -73,15 +78,25 @@ local function request_parser_loop()
-- be searching for.
-- TODO(ashkan) I'd like to remove this, but it seems permanent :(
local buffer_start = buffer:find(header_start_pattern)
+ if not buffer_start then
+ error(
+ string.format(
+ "Headers were expected, a different response was received. The server response was '%s'.",
+ buffer
+ )
+ )
+ end
local headers = parse_headers(buffer:sub(buffer_start, start - 1))
local content_length = headers.content_length
-- Use table instead of just string to buffer the message. It prevents
-- a ton of strings allocating.
-- ref. http://www.lua.org/pil/11.6.html
+ ---@type string[]
local body_chunks = { buffer:sub(finish + 1) }
local body_length = #body_chunks[1]
-- Keep waiting for data until we have enough.
while body_length < content_length do
+ ---@type string
local chunk = coroutine.yield()
or error('Expected more data for the body. The server may have died.') -- TODO hmm.
table.insert(body_chunks, chunk)
@@ -96,17 +111,17 @@ local function request_parser_loop()
end
local body = table.concat(body_chunks)
-- Yield our data.
- buffer = rest
- .. (
- coroutine.yield(headers, body)
- or error('Expected more data for the body. The server may have died.')
- ) -- TODO hmm.
+
+ --- @type string
+ local data = coroutine.yield(headers, body)
+ or error('Expected more data for the body. The server may have died.')
+ buffer = rest .. data
else
-- Get more data since we don't have enough.
- buffer = buffer
- .. (
- coroutine.yield() or error('Expected more data for the header. The server may have died.')
- ) -- TODO hmm.
+ --- @type string
+ local data = coroutine.yield()
+ or error('Expected more data for the header. The server may have died.')
+ buffer = buffer .. data
end
end
end
@@ -115,7 +130,7 @@ local M = {}
--- Mapping of error codes used by the client
--- @nodoc
-M.client_errors = {
+local client_errors = {
INVALID_SERVER_MESSAGE = 1,
INVALID_SERVER_JSON = 2,
NO_RESULT_CALLBACK_FOUND = 3,
@@ -125,12 +140,17 @@ M.client_errors = {
SERVER_RESULT_CALLBACK_ERROR = 7,
}
-M.client_errors = vim.tbl_add_reverse_lookup(M.client_errors)
+--- @type table<string|integer, string|integer>
+--- @nodoc
+M.client_errors = vim.deepcopy(client_errors)
+for k, v in pairs(client_errors) do
+ M.client_errors[v] = k
+end
--- Constructs an error message from an LSP error object.
---
----@param err (table) The error object
----@returns (string) The formatted error message
+---@param err table The error object
+---@return string error_message The formatted error message
function M.format_rpc_error(err)
validate({
err = { err, 't' },
@@ -138,7 +158,7 @@ function M.format_rpc_error(err)
-- There is ErrorCodes in the LSP specification,
-- but in ResponseError.code it is not used and the actual type is number.
- local code
+ local code --- @type string
if protocol.ErrorCodes[err.code] then
code = string.format('code_name = %s,', protocol.ErrorCodes[err.code])
else
@@ -157,13 +177,17 @@ function M.format_rpc_error(err)
return table.concat(message_parts, ' ')
end
---- Creates an RPC response object/table.
+--- Creates an RPC response table `error` to be sent to the LSP response.
+---
+---@param code integer RPC error code defined, see `vim.lsp.protocol.ErrorCodes`
+---@param message? string arbitrary message to send to server
+---@param data? any arbitrary data to send to server
---
----@param code integer RPC error code defined in `vim.lsp.protocol.ErrorCodes`
----@param message string|nil arbitrary message to send to server
----@param data any|nil arbitrary data to send to server
+---@see lsp.ErrorCodes See `vim.lsp.protocol.ErrorCodes`
+---@return lsp.ResponseError
function M.rpc_response_error(code, message, data)
-- TODO should this error or just pick a sane error (like InternalError)?
+ ---@type string
local code_name = assert(protocol.ErrorCodes[code], 'Invalid RPC error code')
return setmetatable({
code = code,
@@ -174,52 +198,55 @@ function M.rpc_response_error(code, message, data)
})
end
-local default_dispatchers = {}
-
----@private
---- Default dispatcher for notifications sent to an LSP server.
----
----@param method (string) The invoked LSP method
----@param params (table): Parameters for the invoked LSP method
-function default_dispatchers.notification(method, params)
- local _ = log.debug() and log.debug('notification', method, params)
-end
-
----@private
---- Default dispatcher for requests sent to an LSP server.
----
----@param method (string) The invoked LSP method
----@param params (table): Parameters for the invoked LSP method
----@return nil
----@return table `vim.lsp.protocol.ErrorCodes.MethodNotFound`
-function default_dispatchers.server_request(method, params)
- local _ = log.debug() and log.debug('server_request', method, params)
- return nil, M.rpc_response_error(protocol.ErrorCodes.MethodNotFound)
-end
+--- Dispatchers for LSP message types.
+--- @class vim.lsp.rpc.Dispatchers
+--- @inlinedoc
+--- @field notification fun(method: string, params: table)
+--- @field server_request fun(method: string, params: table): any?, lsp.ResponseError?
+--- @field on_exit fun(code: integer, signal: integer)
+--- @field on_error fun(code: integer, err: any)
+
+--- @type vim.lsp.rpc.Dispatchers
+local default_dispatchers = {
+ --- Default dispatcher for notifications sent to an LSP server.
+ ---
+ ---@param method string The invoked LSP method
+ ---@param params table Parameters for the invoked LSP method
+ notification = function(method, params)
+ log.debug('notification', method, params)
+ end,
----@private
---- Default dispatcher for when a client exits.
----
----@param code (integer): Exit code
----@param signal (integer): Number describing the signal used to terminate (if
----any)
-function default_dispatchers.on_exit(code, signal)
- local _ = log.info() and log.info('client_exit', { code = code, signal = signal })
-end
+ --- Default dispatcher for requests sent to an LSP server.
+ ---
+ ---@param method string The invoked LSP method
+ ---@param params table Parameters for the invoked LSP method
+ ---@return any result (always nil for the default dispatchers)
+ ---@return lsp.ResponseError error `vim.lsp.protocol.ErrorCodes.MethodNotFound`
+ server_request = function(method, params)
+ log.debug('server_request', method, params)
+ return nil, M.rpc_response_error(protocol.ErrorCodes.MethodNotFound)
+ end,
+
+ --- Default dispatcher for when a client exits.
+ ---
+ ---@param code integer Exit code
+ ---@param signal integer Number describing the signal used to terminate (if any)
+ on_exit = function(code, signal)
+ log.info('client_exit', { code = code, signal = signal })
+ end,
----@private
---- Default dispatcher for client errors.
----
----@param code (integer): Error code
----@param err (any): Details about the error
----any)
-function default_dispatchers.on_error(code, err)
- local _ = log.error() and log.error('client_error:', M.client_errors[code], err)
-end
+ --- Default dispatcher for client errors.
+ ---
+ ---@param code integer Error code
+ ---@param err any Details about the error
+ on_error = function(code, err)
+ log.error('client_error:', M.client_errors[code], err)
+ end,
+}
---@private
function M.create_read_loop(handle_body, on_no_chunk, on_error)
- local parse_chunk = coroutine.wrap(request_parser_loop)
+ local parse_chunk = coroutine.wrap(request_parser_loop) --[[@as fun(chunk: string?): vim.lsp.rpc.Headers?, string?]]
parse_chunk()
return function(err, chunk)
if err then
@@ -246,31 +273,32 @@ function M.create_read_loop(handle_body, on_no_chunk, on_error)
end
end
----@class RpcClient
+---@class (private) vim.lsp.rpc.Client
---@field message_index integer
----@field message_callbacks table
----@field notify_reply_callbacks table
----@field transport table
----@field dispatchers table
-
----@class RpcClient
+---@field message_callbacks table<integer, function> dict of message_id to callback
+---@field notify_reply_callbacks table<integer, function> dict of message_id to callback
+---@field transport vim.lsp.rpc.Transport
+---@field dispatchers vim.lsp.rpc.Dispatchers
local Client = {}
---@private
function Client:encode_and_send(payload)
- local _ = log.debug() and log.debug('rpc.send', payload)
+ log.debug('rpc.send', payload)
if self.transport.is_closing() then
return false
end
- local encoded = vim.json.encode(payload)
- self.transport.write(format_message_with_content_length(encoded))
+ local jsonstr = assert(
+ vim.json.encode(payload),
+ string.format("Couldn't encode payload '%s'", vim.inspect(payload))
+ )
+ self.transport.write(format_message_with_content_length(jsonstr))
return true
end
----@private
+---@package
--- Sends a notification to the LSP server.
----@param method (string) The invoked LSP method
----@param params (any): Parameters for the invoked LSP method
+---@param method string The invoked LSP method
+---@param params any Parameters for the invoked LSP method
---@return boolean `true` if notification could be sent, `false` if not
function Client:notify(method, params)
return self:encode_and_send({
@@ -291,14 +319,15 @@ function Client:send_response(request_id, err, result)
})
end
----@private
---- Sends a request to the LSP server and runs {callback} upon response.
+---@package
+--- Sends a request to the LSP server and runs {callback} upon response. |vim.lsp.rpc.request()|
---
----@param method (string) The invoked LSP method
----@param params (table|nil) Parameters for the invoked LSP method
----@param callback fun(err: lsp.ResponseError|nil, result: any) Callback to invoke
----@param notify_reply_callback (function|nil) Callback to invoke as soon as a request is no longer pending
----@return boolean success, integer|nil request_id true, request_id if request could be sent, `false` if not
+---@param method string The invoked LSP method
+---@param params table? Parameters for the invoked LSP method
+---@param callback fun(err?: lsp.ResponseError, result: any) Callback to invoke
+---@param notify_reply_callback fun(message_id: integer)|nil Callback to invoke as soon as a request is no longer pending
+---@return boolean success `true` if request could be sent, `false` if not
+---@return integer? message_id if request could be sent, `nil` if not
function Client:request(method, params, callback, notify_reply_callback)
validate({
callback = { callback, 'f' },
@@ -318,18 +347,20 @@ function Client:request(method, params, callback, notify_reply_callback)
if message_callbacks then
message_callbacks[message_id] = schedule_wrap(callback)
else
- return false
+ return false, nil
end
if notify_reply_callback and notify_reply_callbacks then
notify_reply_callbacks[message_id] = schedule_wrap(notify_reply_callback)
end
return result, message_id
else
- return false
+ return false, nil
end
end
----@private
+---@package
+---@param errkind integer
+---@param ... any
function Client:on_error(errkind, ...)
assert(M.client_errors[errkind])
-- TODO what to do if this fails?
@@ -337,6 +368,13 @@ function Client:on_error(errkind, ...)
end
---@private
+---@param errkind integer
+---@param status boolean
+---@param head any
+---@param ... any
+---@return boolean status
+---@return any head
+---@return any|nil ...
function Client:pcall_handler(errkind, status, head, ...)
if not status then
self:on_error(errkind, head, ...)
@@ -346,6 +384,12 @@ function Client:pcall_handler(errkind, status, head, ...)
end
---@private
+---@param errkind integer
+---@param fn function
+---@param ... any
+---@return boolean status
+---@return any head
+---@return any|nil ...
function Client:try_call(errkind, fn, ...)
return self:pcall_handler(errkind, pcall(fn, ...))
end
@@ -354,17 +398,17 @@ end
-- time and log them. This would require storing the timestamp. I could call
-- them with an error then, perhaps.
----@private
+---@package
function Client:handle_body(body)
local ok, decoded = pcall(vim.json.decode, body, { luanil = { object = true } })
if not ok then
self:on_error(M.client_errors.INVALID_SERVER_JSON, decoded)
return
end
- local _ = log.debug() and log.debug('rpc.receive', decoded)
+ log.debug('rpc.receive', decoded)
if type(decoded.method) == 'string' and decoded.id then
- local err
+ local err --- @type lsp.ResponseError|nil
-- Schedule here so that the users functions don't trigger an error and
-- we can still use the result.
schedule(function()
@@ -376,11 +420,10 @@ function Client:handle_body(body)
decoded.method,
decoded.params
)
- local _ = log.debug()
- and log.debug(
- 'server_request: callback result',
- { status = status, result = result, err = err }
- )
+ log.debug(
+ 'server_request: callback result',
+ { status = status, result = result, err = err }
+ )
if status then
if result == nil and err == nil then
error(
@@ -391,10 +434,12 @@ function Client:handle_body(body)
)
end
if err then
+ ---@cast err lsp.ResponseError
assert(
type(err) == 'table',
'err must be a table. Use rpc_response_error to help format errors.'
)
+ ---@type string
local code_name = assert(
protocol.ErrorCodes[err.code],
'Errors must use protocol.ErrorCodes. Use rpc_response_error to help format errors.'
@@ -431,7 +476,7 @@ function Client:handle_body(body)
if decoded.error then
local mute_error = false
if decoded.error.code == protocol.ErrorCodes.RequestCancelled then
- local _ = log.debug() and log.debug('Received cancellation ack', decoded)
+ log.debug('Received cancellation ack', decoded)
mute_error = true
end
@@ -457,7 +502,7 @@ function Client:handle_body(body)
if decoded.error then
decoded.error = setmetatable(decoded.error, {
__tostring = M.format_rpc_error,
- })
+ }) --- @type table
end
self:try_call(
M.client_errors.SERVER_RESULT_CALLBACK_ERROR,
@@ -467,7 +512,7 @@ function Client:handle_body(body)
)
else
self:on_error(M.client_errors.NO_RESULT_CALLBACK_FOUND, decoded)
- local _ = log.error() and log.error('No callback found for server response id ' .. result_id)
+ log.error('No callback found for server response id ' .. result_id)
end
elseif type(decoded.method) == 'string' then
-- Notification
@@ -483,7 +528,14 @@ function Client:handle_body(body)
end
end
----@return RpcClient
+---@class (private) vim.lsp.rpc.Transport
+---@field write fun(msg: string)
+---@field is_closing fun(): boolean
+---@field terminate fun()
+
+---@param dispatchers vim.lsp.rpc.Dispatchers
+---@param transport vim.lsp.rpc.Transport
+---@return vim.lsp.rpc.Client
local function new_client(dispatchers, transport)
local state = {
message_index = 0,
@@ -495,8 +547,17 @@ local function new_client(dispatchers, transport)
return setmetatable(state, { __index = Client })
end
----@param client RpcClient
+---@class vim.lsp.rpc.PublicClient
+---@field request fun(method: string, params: table?, callback: fun(err: lsp.ResponseError|nil, result: any), notify_reply_callback: fun(integer)|nil):boolean,integer? see |vim.lsp.rpc.request()|
+---@field notify fun(method: string, params: any):boolean see |vim.lsp.rpc.notify()|
+---@field is_closing fun(): boolean
+---@field terminate fun()
+
+---@param client vim.lsp.rpc.Client
+---@return vim.lsp.rpc.PublicClient
local function public_client(client)
+ ---@type vim.lsp.rpc.PublicClient
+ ---@diagnostic disable-next-line: missing-fields
local result = {}
---@private
@@ -512,17 +573,18 @@ local function public_client(client)
--- Sends a request to the LSP server and runs {callback} upon response.
---
---@param method (string) The invoked LSP method
- ---@param params (table|nil) Parameters for the invoked LSP method
- ---@param callback fun(err: lsp.ResponseError | nil, result: any) Callback to invoke
- ---@param notify_reply_callback (function|nil) Callback to invoke as soon as a request is no longer pending
- ---@return boolean success, integer|nil request_id true, message_id if request could be sent, `false` if not
+ ---@param params (table?) Parameters for the invoked LSP method
+ ---@param callback fun(err: lsp.ResponseError|nil, result: any) Callback to invoke
+ ---@param notify_reply_callback fun(message_id: integer)|nil Callback to invoke as soon as a request is no longer pending
+ ---@return boolean success `true` if request could be sent, `false` if not
+ ---@return integer? message_id if request could be sent, `nil` if not
function result.request(method, params, callback, notify_reply_callback)
return client:request(method, params, callback, notify_reply_callback)
end
--- Sends a notification to the LSP server.
---@param method (string) The invoked LSP method
- ---@param params (table|nil): Parameters for the invoked LSP method
+ ---@param params (table?) Parameters for the invoked LSP method
---@return boolean `true` if notification could be sent, `false` if not
function result.notify(method, params)
return client:notify(method, params)
@@ -531,43 +593,46 @@ local function public_client(client)
return result
end
+---@param dispatchers vim.lsp.rpc.Dispatchers?
+---@return vim.lsp.rpc.Dispatchers
local function merge_dispatchers(dispatchers)
- if dispatchers then
- local user_dispatchers = dispatchers
- dispatchers = {}
- for dispatch_name, default_dispatch in pairs(default_dispatchers) do
- local user_dispatcher = user_dispatchers[dispatch_name]
- if user_dispatcher then
- if type(user_dispatcher) ~= 'function' then
- error(string.format('dispatcher.%s must be a function', dispatch_name))
- end
- -- server_request is wrapped elsewhere.
- if
- not (dispatch_name == 'server_request' or dispatch_name == 'on_exit') -- TODO this blocks the loop exiting for some reason.
- then
- user_dispatcher = schedule_wrap(user_dispatcher)
- end
- dispatchers[dispatch_name] = user_dispatcher
- else
- dispatchers[dispatch_name] = default_dispatch
- end
+ if not dispatchers then
+ return default_dispatchers
+ end
+ ---@diagnostic disable-next-line: no-unknown
+ for name, fn in pairs(dispatchers) do
+ if type(fn) ~= 'function' then
+ error(string.format('dispatcher.%s must be a function', name))
end
- else
- dispatchers = default_dispatchers
end
- return dispatchers
+ ---@type vim.lsp.rpc.Dispatchers
+ local merged = {
+ notification = (
+ dispatchers.notification and vim.schedule_wrap(dispatchers.notification)
+ or default_dispatchers.notification
+ ),
+ on_error = (
+ dispatchers.on_error and vim.schedule_wrap(dispatchers.on_error)
+ or default_dispatchers.on_error
+ ),
+ on_exit = dispatchers.on_exit or default_dispatchers.on_exit,
+ server_request = dispatchers.server_request or default_dispatchers.server_request,
+ }
+ return merged
end
---- Create a LSP RPC client factory that connects via TCP to the given host
---- and port
+--- Create a LSP RPC client factory that connects via TCP to the given host and port.
+---
+--- Return a function that can be passed to the `cmd` field for
+--- |vim.lsp.start_client()| or |vim.lsp.start()|.
---
----@param host string
----@param port integer
----@return function
+---@param host string host to connect to
+---@param port integer port to connect to
+---@return fun(dispatchers: vim.lsp.rpc.Dispatchers): vim.lsp.rpc.PublicClient
function M.connect(host, port)
return function(dispatchers)
dispatchers = merge_dispatchers(dispatchers)
- local tcp = uv.new_tcp()
+ local tcp = assert(uv.new_tcp())
local closing = false
local transport = {
write = function(msg)
@@ -608,35 +673,84 @@ function M.connect(host, port)
end
end
+--- Create a LSP RPC client factory that connects via named pipes (Windows)
+--- or unix domain sockets (Unix) to the given pipe_path (file path on
+--- Unix and name on Windows).
+---
+--- Return a function that can be passed to the `cmd` field for
+--- |vim.lsp.start_client()| or |vim.lsp.start()|.
+---
+---@param pipe_path string file path of the domain socket (Unix) or name of the named pipe (Windows) to connect to
+---@return fun(dispatchers: vim.lsp.rpc.Dispatchers): vim.lsp.rpc.PublicClient
+function M.domain_socket_connect(pipe_path)
+ return function(dispatchers)
+ dispatchers = merge_dispatchers(dispatchers)
+ local pipe =
+ assert(uv.new_pipe(false), string.format('pipe with name %s could not be opened.', pipe_path))
+ local closing = false
+ local transport = {
+ write = vim.schedule_wrap(function(msg)
+ pipe:write(msg)
+ end),
+ is_closing = function()
+ return closing
+ end,
+ terminate = function()
+ if not closing then
+ closing = true
+ pipe:shutdown()
+ pipe:close()
+ dispatchers.on_exit(0, 0)
+ end
+ end,
+ }
+ local client = new_client(dispatchers, transport)
+ pipe:connect(pipe_path, function(err)
+ if err then
+ vim.schedule(function()
+ vim.notify(
+ string.format('Could not connect to :%s, reason: %s', pipe_path, vim.inspect(err)),
+ vim.log.levels.WARN
+ )
+ end)
+ return
+ end
+ local handle_body = function(body)
+ client:handle_body(body)
+ end
+ pipe:read_start(M.create_read_loop(handle_body, transport.terminate, function(read_err)
+ client:on_error(M.client_errors.READ_ERROR, read_err)
+ end))
+ end)
+
+ return public_client(client)
+ end
+end
+
+--- Additional context for the LSP server process.
+--- @class vim.lsp.rpc.ExtraSpawnParams
+--- @inlinedoc
+--- @field cwd? string Working directory for the LSP server process
+--- @field detached? boolean Detach the LSP server process from the current process
+--- @field env? table<string,string> Additional environment variables for LSP server process. See |vim.system()|
+
--- Starts an LSP server process and create an LSP RPC client object to
--- interact with it. Communication with the spawned process happens via stdio. For
--- communication via TCP, spawn a process manually and use |vim.lsp.rpc.connect()|
---
----@param cmd (string) Command to start the LSP server.
----@param cmd_args (table) List of additional string arguments to pass to {cmd}.
----@param dispatchers table|nil Dispatchers for LSP message types. Valid
----dispatcher names are:
---- - `"notification"`
---- - `"server_request"`
---- - `"on_error"`
---- - `"on_exit"`
----@param extra_spawn_params table|nil Additional context for the LSP
---- server process. May contain:
---- - {cwd} (string) Working directory for the LSP server process
---- - {env} (table) Additional environment variables for LSP server process
----@return table|nil Client RPC object, with these methods:
---- - `notify()` |vim.lsp.rpc.notify()|
---- - `request()` |vim.lsp.rpc.request()|
---- - `is_closing()` returns a boolean indicating if the RPC is closing.
---- - `terminate()` terminates the RPC client.
-function M.start(cmd, cmd_args, dispatchers, extra_spawn_params)
- if log.info() then
- log.info('Starting RPC client', { cmd = cmd, args = cmd_args, extra = extra_spawn_params })
- end
+--- @param cmd string[] Command to start the LSP server.
+--- @param dispatchers? vim.lsp.rpc.Dispatchers
+--- @param extra_spawn_params? vim.lsp.rpc.ExtraSpawnParams
+--- @return vim.lsp.rpc.PublicClient? : Client RPC object, with these methods:
+--- - `notify()` |vim.lsp.rpc.notify()|
+--- - `request()` |vim.lsp.rpc.request()|
+--- - `is_closing()` returns a boolean indicating if the RPC is closing.
+--- - `terminate()` terminates the RPC client.
+function M.start(cmd, dispatchers, extra_spawn_params)
+ log.info('Starting RPC client', { cmd = cmd, extra = extra_spawn_params })
validate({
- cmd = { cmd, 's' },
- cmd_args = { cmd_args, 't' },
+ cmd = { cmd, 't' },
dispatchers = { dispatchers, 't', true },
})
@@ -671,8 +785,8 @@ function M.start(cmd, cmd_args, dispatchers, extra_spawn_params)
end)
local stderr_handler = function(_, chunk)
- if chunk and log.error() then
- log.error('rpc', cmd, 'stderr', chunk)
+ if chunk then
+ log.error('rpc', cmd[1], 'stderr', chunk)
end
end
@@ -681,10 +795,7 @@ function M.start(cmd, cmd_args, dispatchers, extra_spawn_params)
detached = extra_spawn_params.detached
end
- local cmd1 = { cmd }
- vim.list_extend(cmd1, cmd_args)
-
- local ok, sysobj_or_err = pcall(vim.system, cmd1, {
+ local ok, sysobj_or_err = pcall(vim.system, cmd, {
stdin = true,
stdout = stdout_handler,
stderr = stderr_handler,
@@ -697,15 +808,16 @@ function M.start(cmd, cmd_args, dispatchers, extra_spawn_params)
if not ok then
local err = sysobj_or_err --[[@as string]]
- local msg = string.format('Spawning language server with cmd: `%s` failed', cmd)
+ local sfx --- @type string
if string.match(err, 'ENOENT') then
- msg = msg
- .. '. The language server is either not installed, missing from PATH, or not executable.'
+ sfx = '. The language server is either not installed, missing from PATH, or not executable.'
else
- msg = msg .. string.format(' with error message: %s', err)
+ sfx = string.format(' with error message: %s', err)
end
+ local msg =
+ string.format('Spawning language server with cmd: `%s` failed%s', vim.inspect(cmd), sfx)
vim.notify(msg, vim.log.levels.WARN)
- return
+ return nil
end
sysobj = sysobj_or_err --[[@as vim.SystemObj]]
diff --git a/runtime/lua/vim/lsp/semantic_tokens.lua b/runtime/lua/vim/lsp/semantic_tokens.lua
index a5831c0beb..20ac0a125f 100644
--- a/runtime/lua/vim/lsp/semantic_tokens.lua
+++ b/runtime/lua/vim/lsp/semantic_tokens.lua
@@ -1,35 +1,34 @@
local api = vim.api
local bit = require('bit')
-local handlers = require('vim.lsp.handlers')
local ms = require('vim.lsp.protocol').Methods
local util = require('vim.lsp.util')
local uv = vim.uv
---- @class STTokenRange
+--- @class (private) STTokenRange
--- @field line integer line number 0-based
--- @field start_col integer start column 0-based
--- @field end_col integer end column 0-based
--- @field type string token type as string
---- @field modifiers table token modifiers as a set. E.g., { static = true, readonly = true }
+--- @field modifiers table<string,boolean> token modifiers as a set. E.g., { static = true, readonly = true }
--- @field marked boolean whether this token has had extmarks applied
---
---- @class STCurrentResult
+--- @class (private) STCurrentResult
--- @field version? integer document version associated with this result
--- @field result_id? string resultId from the server; used with delta requests
--- @field highlights? STTokenRange[] cache of highlight ranges for this document version
--- @field tokens? integer[] raw token array as received by the server. used for calculating delta responses
--- @field namespace_cleared? boolean whether the namespace was cleared for this result yet
---
---- @class STActiveRequest
---- @field request_id integer the LSP request ID of the most recent request sent to the server
---- @field version integer the document version associated with the most recent request
+--- @class (private) STActiveRequest
+--- @field request_id? integer the LSP request ID of the most recent request sent to the server
+--- @field version? integer the document version associated with the most recent request
---
---- @class STClientState
+--- @class (private) STClientState
--- @field namespace integer
--- @field active_request STActiveRequest
--- @field current_result STCurrentResult
----@class STHighlighter
+---@class (private) STHighlighter
---@field active table<integer, STHighlighter>
---@field bufnr integer
---@field augroup integer augroup for buffer events
@@ -72,9 +71,11 @@ end
--- Extracts modifier strings from the encoded number in the token array
---
+---@param x integer
+---@param modifiers_table table<integer,string>
---@return table<string, boolean>
local function modifiers_from_number(x, modifiers_table)
- local modifiers = {}
+ local modifiers = {} ---@type table<string,boolean>
local idx = 1
while x > 0 do
if bit.band(x, 1) == 1 then
@@ -89,20 +90,24 @@ end
--- Converts a raw token list to a list of highlight ranges used by the on_win callback
---
+---@param data integer[]
+---@param bufnr integer
+---@param client vim.lsp.Client
+---@param request STActiveRequest
---@return STTokenRange[]
local function tokens_to_ranges(data, bufnr, client, request)
local legend = client.server_capabilities.semanticTokensProvider.legend
local token_types = legend.tokenTypes
local token_modifiers = legend.tokenModifiers
local lines = api.nvim_buf_get_lines(bufnr, 0, -1, false)
- local ranges = {}
+ local ranges = {} ---@type STTokenRange[]
local start = uv.hrtime()
local ms_to_ns = 1000 * 1000
local yield_interval_ns = 5 * ms_to_ns
local co, is_main = coroutine.running()
- local line
+ local line ---@type integer?
local start_char = 0
for i = 1, #data, 5 do
-- if this function is called from the main coroutine, let it run to completion with no yield
@@ -167,6 +172,7 @@ end
---
---@private
---@param bufnr integer
+---@return STHighlighter
function STHighlighter.new(bufnr)
local self = setmetatable({}, { __index = STHighlighter })
@@ -221,7 +227,7 @@ function STHighlighter.new(bufnr)
return self
end
----@private
+---@package
function STHighlighter:destroy()
for client_id, _ in pairs(self.client_state) do
self:detach(client_id)
@@ -231,7 +237,7 @@ function STHighlighter:destroy()
STHighlighter.active[self.bufnr] = nil
end
----@private
+---@package
function STHighlighter:attach(client_id)
local state = self.client_state[client_id]
if not state then
@@ -244,7 +250,7 @@ function STHighlighter:attach(client_id)
end
end
----@private
+---@package
function STHighlighter:detach(client_id)
local state = self.client_state[client_id]
if state then
@@ -267,7 +273,7 @@ end
--- Finally, if the request was successful, the requestId and document version
--- are saved to facilitate document synchronization in the response.
---
----@private
+---@package
function STHighlighter:send_request()
local version = util.buf_versions[self.bufnr]
@@ -303,7 +309,8 @@ function STHighlighter:send_request()
-- look client up again using ctx.client_id instead of using a captured
-- client object
local c = vim.lsp.get_client_by_id(ctx.client_id)
- local highlighter = STHighlighter.active[ctx.bufnr]
+ local bufnr = assert(ctx.bufnr)
+ local highlighter = STHighlighter.active[bufnr]
if not err and c and highlighter then
coroutine.wrap(STHighlighter.process_response)(highlighter, response, c, version)
end
@@ -328,6 +335,7 @@ end
--- Finally, a redraw command is issued to force nvim to redraw the screen to
--- pick up changed highlight tokens.
---
+---@param response lsp.SemanticTokens|lsp.SemanticTokensDelta
---@private
function STHighlighter:process_response(response, client, version)
local state = self.client_state[client.id]
@@ -348,15 +356,15 @@ function STHighlighter:process_response(response, client, version)
-- if we have a response to a delta request, update the state of our tokens
-- appropriately. if it's a full response, just use that
- local tokens
+ local tokens ---@type integer[]
local token_edits = response.edits
if token_edits then
table.sort(token_edits, function(a, b)
return a.start < b.start
end)
- tokens = {}
- local old_tokens = state.current_result.tokens
+ tokens = {} --- @type integer[]
+ local old_tokens = assert(state.current_result.tokens)
local idx = 1
for _, token_edit in ipairs(token_edits) do
vim.list_extend(tokens, old_tokens, idx, token_edit.start)
@@ -404,7 +412,9 @@ end
--- handler to avoid the "blink" that occurs due to the timing between the
--- response handler and the actual redraw.
---
----@private
+---@package
+---@param topline integer
+---@param botline integer
function STHighlighter:on_win(topline, botline)
for client_id, state in pairs(self.client_state) do
local current_result = state.current_result
@@ -450,7 +460,7 @@ function STHighlighter:on_win(topline, botline)
end
local ft = vim.bo[self.bufnr].filetype
- local highlights = current_result.highlights
+ local highlights = assert(current_result.highlights)
local first = lower_bound(highlights, topline, 1, #highlights + 1)
local last = upper_bound(highlights, botline, first, #highlights + 1) - 1
@@ -480,7 +490,7 @@ end
--- Reset the buffer's highlighting state and clears the extmark highlights.
---
----@private
+---@package
function STHighlighter:reset()
for client_id, state in pairs(self.client_state) do
api.nvim_buf_clear_namespace(self.bufnr, state.namespace, 0, -1)
@@ -499,7 +509,7 @@ end
--- in the on_win callback. The rest of the current results are saved
--- in case the server supports delta requests.
---
----@private
+---@package
---@param client_id integer
function STHighlighter:mark_dirty(client_id)
local state = self.client_state[client_id]
@@ -521,7 +531,7 @@ function STHighlighter:mark_dirty(client_id)
end
end
----@private
+---@package
function STHighlighter:on_change()
self:reset_timer()
if self.debounce > 0 then
@@ -562,7 +572,7 @@ local M = {}
---
---@param bufnr integer
---@param client_id integer
----@param opts (nil|table) Optional keyword arguments
+---@param opts? table Optional keyword arguments
--- - debounce (integer, default: 200): Debounce token requests
--- to the server by the given number in milliseconds
function M.start(bufnr, client_id, opts)
@@ -636,6 +646,10 @@ function M.stop(bufnr, client_id)
end
end
+--- @nodoc
+--- @class STTokenRangeInspect : STTokenRange
+--- @field client_id integer
+
--- Return the semantic token(s) at the given position.
--- If called without arguments, returns the token under the cursor.
---
@@ -643,13 +657,14 @@ end
---@param row integer|nil Position row (default cursor position)
---@param col integer|nil Position column (default cursor position)
---
----@return table|nil (table|nil) List of tokens at position. Each token has
+---@return STTokenRangeInspect[]|nil (table|nil) List of tokens at position. Each token has
--- the following fields:
--- - line (integer) line number, 0-based
--- - start_col (integer) start column, 0-based
--- - end_col (integer) end column, 0-based
--- - type (string) token type as string, e.g. "variable"
--- - modifiers (table) token modifiers as a set. E.g., { static = true, readonly = true }
+--- - client_id (integer)
function M.get_at_pos(bufnr, row, col)
if bufnr == nil or bufnr == 0 then
bufnr = api.nvim_get_current_buf()
@@ -665,13 +680,14 @@ function M.get_at_pos(bufnr, row, col)
row, col = cursor[1] - 1, cursor[2]
end
- local tokens = {}
+ local tokens = {} --- @type STTokenRangeInspect[]
for client_id, client in pairs(highlighter.client_state) do
local highlights = client.current_result.highlights
if highlights then
local idx = lower_bound(highlights, row, 1, #highlights + 1)
for i = idx, #highlights do
local token = highlights[i]
+ --- @cast token STTokenRangeInspect
if token.line > row then
break
@@ -712,6 +728,13 @@ function M.force_refresh(bufnr)
end
end
+--- @class vim.lsp.semantic_tokens.highlight_token.Opts
+--- @inlinedoc
+---
+--- Priority for the applied extmark.
+--- (Default: `vim.highlight.priorities.semantic_tokens + 3`)
+--- @field priority? integer
+
--- Highlight a semantic token.
---
--- Apply an extmark with a given highlight group for a semantic token. The
@@ -720,11 +743,9 @@ end
--- use inside |LspTokenUpdate| callbacks.
---@param token (table) a semantic token, found as `args.data.token` in |LspTokenUpdate|.
---@param bufnr (integer) the buffer to highlight
----@param client_id (integer) The ID of the |vim.lsp.client|
+---@param client_id (integer) The ID of the |vim.lsp.Client|
---@param hl_group (string) Highlight group name
----@param opts (table|nil) Optional parameters.
---- - priority: (integer|nil) Priority for the applied extmark. Defaults
---- to `vim.highlight.priorities.semantic_tokens + 3`
+---@param opts? vim.lsp.semantic_tokens.highlight_token.Opts Optional parameters:
function M.highlight_token(token, bufnr, client_id, hl_group, opts)
local highlighter = STHighlighter.active[bufnr]
if not highlighter then
@@ -747,6 +768,7 @@ function M.highlight_token(token, bufnr, client_id, hl_group, opts)
})
end
+--- @package
--- |lsp-handler| for the method `workspace/semanticTokens/refresh`
---
--- Refresh requests are sent by the server to indicate a project-wide change
@@ -754,9 +776,7 @@ end
--- invalidate the current results of all buffers and automatically kick off a
--- new request for buffers that are displayed in a window. For those that aren't, a
--- the BufWinEnter event should take care of it next time it's displayed.
----
----@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#semanticTokens_refreshRequest
-handlers[ms.workspace_semanticTokens_refresh] = function(err, _, ctx)
+function M._refresh(err, _, ctx)
if err then
return vim.NIL
end
diff --git a/runtime/lua/vim/lsp/sync.lua b/runtime/lua/vim/lsp/sync.lua
index ca01cdc08b..936579e003 100644
--- a/runtime/lua/vim/lsp/sync.lua
+++ b/runtime/lua/vim/lsp/sync.lua
@@ -53,13 +53,12 @@ local str_utf_end = vim.str_utf_end
---@param line string the line to index into
---@param byte integer the byte idx
---@param offset_encoding string utf-8|utf-16|utf-32|nil (default: utf-8)
---@returns integer the utf idx for the given encoding
+---@return integer utf_idx for the given encoding
local function byte_to_utf(line, byte, offset_encoding)
-- convert to 0 based indexing for str_utfindex
byte = byte - 1
- local utf_idx
- local _
+ local utf_idx, _ --- @type integer, integer
-- Convert the byte range to utf-{8,16,32} and convert 1-based (lua) indexing to 0-based
if offset_encoding == 'utf-16' then
_, utf_idx = str_utfindex(line, byte)
@@ -73,9 +72,11 @@ local function byte_to_utf(line, byte, offset_encoding)
return utf_idx + 1
end
+---@param line string
+---@param offset_encoding string
+---@return integer
local function compute_line_length(line, offset_encoding)
- local length
- local _
+ local length, _ --- @type integer, integer
if offset_encoding == 'utf-16' then
_, length = str_utfindex(line)
elseif offset_encoding == 'utf-32' then
@@ -94,7 +95,7 @@ end
---@return integer byte_idx of first change position
---@return integer char_idx of first change position
local function align_end_position(line, byte, offset_encoding)
- local char
+ local char --- @type integer
-- If on the first byte, or an empty string: the trivial case
if byte == 1 or #line == 0 then
char = byte
@@ -119,14 +120,19 @@ local function align_end_position(line, byte, offset_encoding)
return byte, char
end
+---@class vim.lsp.sync.Range
+---@field line_idx integer
+---@field byte_idx integer
+---@field char_idx integer
+
--- Finds the first line, byte, and char index of the difference between the previous and current lines buffer normalized to the previous codepoint.
----@param prev_lines table list of lines from previous buffer
----@param curr_lines table list of lines from current buffer
+---@param prev_lines string[] list of lines from previous buffer
+---@param curr_lines string[] list of lines from current buffer
---@param firstline integer firstline from on_lines, adjusted to 1-index
---@param lastline integer lastline from on_lines, adjusted to 1-index
---@param new_lastline integer new_lastline from on_lines, adjusted to 1-index
---@param offset_encoding string utf-8|utf-16|utf-32|nil (fallback to utf-8)
----@return table result table include line_idx, byte_idx, and char_idx of first change position
+---@return vim.lsp.sync.Range result table include line_idx, byte_idx, and char_idx of first change position
local function compute_start_range(
prev_lines,
curr_lines,
@@ -135,14 +141,14 @@ local function compute_start_range(
new_lastline,
offset_encoding
)
- local char_idx
- local byte_idx
+ local char_idx --- @type integer?
+ local byte_idx --- @type integer?
-- If firstline == lastline, no existing text is changed. All edit operations
-- occur on a new line pointed to by lastline. This occurs during insertion of
-- new lines(O), the new newline is inserted at the line indicated by
-- new_lastline.
if firstline == lastline then
- local line_idx
+ local line_idx --- @type integer
local line = prev_lines[firstline - 1]
if line then
line_idx = firstline - 1
@@ -198,15 +204,15 @@ end
--- Normalized to the next codepoint.
--- prev_end_range is the text range sent to the server representing the changed region.
--- curr_end_range is the text that should be collected and sent to the server.
---
----@param prev_lines table list of lines
----@param curr_lines table list of lines
----@param start_range table
+---
+---@param prev_lines string[] list of lines
+---@param curr_lines string[] list of lines
+---@param start_range vim.lsp.sync.Range
+---@param firstline integer
---@param lastline integer
---@param new_lastline integer
---@param offset_encoding string
----@return integer|table end_line_idx and end_col_idx of range
----@return table|nil end_col_idx of range
+---@return vim.lsp.sync.Range, vim.lsp.sync.Range
local function compute_end_range(
prev_lines,
curr_lines,
@@ -250,7 +256,7 @@ local function compute_end_range(
-- Editing the same line
-- If the byte offset is zero, that means there is a difference on the last byte (not newline)
if prev_line_idx == curr_line_idx then
- local max_length
+ local max_length --- @type integer
if start_line_idx == prev_line_idx then
-- Search until beginning of difference
max_length = min(
@@ -283,7 +289,7 @@ local function compute_end_range(
local prev_end_range =
{ line_idx = prev_line_idx, byte_idx = prev_byte_idx, char_idx = prev_char_idx }
- local curr_end_range
+ local curr_end_range ---@type vim.lsp.sync.Range
-- Deletion event, new_range cannot be before start
if curr_line_idx < start_line_idx then
curr_end_range = { line_idx = start_line_idx, byte_idx = 1, char_idx = 1 }
@@ -343,6 +349,12 @@ end
-- codeunits for utf-32
-- Line endings count here as 2 chars for \r\n (dos), 1 char for \n (unix), and 1 char for \r (mac)
-- These correspond to Windows, Linux/macOS (OSX and newer), and macOS (version 9 and prior)
+---@param lines string[]
+---@param start_range vim.lsp.sync.Range
+---@param end_range vim.lsp.sync.Range
+---@param offset_encoding string
+---@param line_ending string
+---@return integer
local function compute_range_length(lines, start_range, end_range, offset_encoding, line_ending)
local line_ending_length = #line_ending
-- Single line case
@@ -351,7 +363,7 @@ local function compute_range_length(lines, start_range, end_range, offset_encodi
end
local start_line = lines[start_range.line_idx]
- local range_length
+ local range_length --- @type integer
if start_line and #start_line > 0 then
range_length = compute_line_length(start_line, offset_encoding)
- start_range.char_idx
@@ -387,7 +399,8 @@ end
---@param lastline integer line to begin search in old_lines for last difference
---@param new_lastline integer line to begin search in new_lines for last difference
---@param offset_encoding string encoding requested by language server
----@return table TextDocumentContentChangeEvent see https://microsoft.github.io/language-server-protocol/specification/#textDocumentContentChangeEvent
+---@param line_ending string
+---@return lsp.TextDocumentContentChangeEvent : see https://microsoft.github.io/language-server-protocol/specification/#textDocumentContentChangeEvent
function M.compute_diff(
prev_lines,
curr_lines,
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index 32b220746f..f8e5b6a90d 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -3,7 +3,7 @@ local snippet = require('vim.lsp._snippet_grammar')
local validate = vim.validate
local api = vim.api
local list_extend = vim.list_extend
-local highlight = require('vim.highlight')
+local highlight = vim.highlight
local uv = vim.uv
local npcall = vim.F.npcall
@@ -180,6 +180,7 @@ local _str_byteindex_enc = M._str_byteindex_enc
---@param new_lines (table) list of strings to replace the original
---@return table The modified {lines} object
function M.set_lines(lines, A, B, new_lines)
+ vim.deprecate('vim.lsp.util.set_lines()', 'nil', '0.12')
-- 0-indexing to 1-indexing
local i_0 = A[1] + 1
-- If it extends past the end, truncate it to the end. This is because the
@@ -346,7 +347,7 @@ end
---@private
---@deprecated Use vim.lsp.status() or access client.progress directly
function M.get_progress_messages()
- vim.deprecate('vim.lsp.util.get_progress_messages', 'vim.lsp.status', '0.11.0')
+ vim.deprecate('vim.lsp.util.get_progress_messages()', 'vim.lsp.status()', '0.11')
local new_messages = {}
local progress_remove = {}
@@ -418,6 +419,9 @@ function M.apply_text_edits(text_edits, bufnr, offset_encoding)
if not next(text_edits) then
return
end
+
+ assert(bufnr ~= 0, 'Explicit buffer number is required')
+
if not api.nvim_buf_is_loaded(bufnr) then
vim.fn.bufload(bufnr)
end
@@ -456,7 +460,7 @@ function M.apply_text_edits(text_edits, bufnr, offset_encoding)
-- save and restore local marks since they get deleted by nvim_buf_set_lines
local marks = {}
- for _, m in pairs(vim.fn.getmarklist(bufnr or vim.api.nvim_get_current_buf())) do
+ for _, m in pairs(vim.fn.getmarklist(bufnr)) do
if m.mark:match("^'[a-z]$") then
marks[m.mark:sub(2, 2)] = { m.pos[2], m.pos[3] - 1 } -- api-indexed
end
@@ -515,7 +519,7 @@ function M.apply_text_edits(text_edits, bufnr, offset_encoding)
local max = api.nvim_buf_line_count(bufnr)
-- no need to restore marks that still exist
- for _, m in pairs(vim.fn.getmarklist(bufnr or vim.api.nvim_get_current_buf())) do
+ for _, m in pairs(vim.fn.getmarklist(bufnr)) do
marks[m.mark:sub(2, 2)] = nil
end
-- restore marks
@@ -547,12 +551,16 @@ end
--- Can be used to extract the completion items from a
--- `textDocument/completion` request, which may return one of
--- `CompletionItem[]`, `CompletionList` or null.
+---
+--- Note that this method doesn't apply `itemDefaults` to `CompletionList`s, and hence the returned
+--- results might be incorrect.
+---
---@deprecated
---@param result table The result of a `textDocument/completion` request
---@return lsp.CompletionItem[] List of completion items
---@see https://microsoft.github.io/language-server-protocol/specification#textDocument_completion
function M.extract_completion_items(result)
- vim.deprecate('vim.lsp.util.extract_completion_items', nil, '0.11')
+ vim.deprecate('vim.lsp.util.extract_completion_items()', nil, '0.11')
if type(result) == 'table' and result.items then
-- result is a `CompletionList`
return result.items
@@ -570,6 +578,7 @@ end
---
---@param text_document_edit table: a `TextDocumentEdit` object
---@param index integer: Optional index of the edit, if from a list of edits (or nil, if not from a list)
+---@param offset_encoding? string
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentEdit
function M.apply_text_document_edit(text_document_edit, index, offset_encoding)
local text_document = text_document_edit.textDocument
@@ -612,7 +621,7 @@ end
---@param input string unparsed snippet
---@return string parsed snippet
function M.parse_snippet(input)
- vim.deprecate('vim.lsp.util.parse_snippet', nil, '0.11')
+ vim.deprecate('vim.lsp.util.parse_snippet()', nil, '0.11')
local ok, parsed = pcall(function()
return snippet.parse(input)
end)
@@ -634,76 +643,129 @@ end
---@return table[] items
---@see complete-items
function M.text_document_completion_list_to_complete_items(result, prefix)
- vim.deprecate('vim.lsp.util.text_document_completion_list_to_complete_items', nil, '0.11')
- return require('vim.lsp._completion')._lsp_to_complete_items(result, prefix)
+ vim.deprecate('vim.lsp.util.text_document_completion_list_to_complete_items()', nil, '0.11')
+ return vim.lsp._completion._lsp_to_complete_items(result, prefix)
end
---- Like vim.fn.bufwinid except it works across tabpages.
-local function bufwinid(bufnr)
- for _, win in ipairs(api.nvim_list_wins()) do
- if api.nvim_win_get_buf(win) == bufnr then
- return win
+local function path_components(path)
+ return vim.split(path, '/', { plain = true })
+end
+
+local function path_under_prefix(path, prefix)
+ for i, c in ipairs(prefix) do
+ if c ~= path[i] then
+ return false
end
end
+ return true
end
---- Get list of buffers for a directory
-local function get_dir_bufs(path)
- path = path:gsub('([^%w])', '%%%1')
+--- Get list of buffers whose filename matches the given path prefix (normalized full path)
+---@return integer[]
+local function get_bufs_with_prefix(prefix)
+ prefix = path_components(prefix)
local buffers = {}
for _, v in ipairs(vim.api.nvim_list_bufs()) do
- local bufname = vim.api.nvim_buf_get_name(v):gsub('buffer://', '')
- if bufname:find(path) then
+ local bname = vim.api.nvim_buf_get_name(v)
+ local path = path_components(vim.fs.normalize(bname, { expand_env = false }))
+ if path_under_prefix(path, prefix) then
table.insert(buffers, v)
end
end
return buffers
end
+local function escape_gsub_repl(s)
+ return (s:gsub('%%', '%%%%'))
+end
+
+--- @class vim.lsp.util.rename.Opts
+--- @inlinedoc
+--- @field overwrite? boolean
+--- @field ignoreIfExists? boolean
+
--- Rename old_fname to new_fname
---
----@param opts (table)
--- overwrite? bool
--- ignoreIfExists? bool
+--- Existing buffers are renamed as well, while maintaining their bufnr.
+---
+--- It deletes existing buffers that conflict with the renamed file name only when
+--- * `opts` requests overwriting; or
+--- * the conflicting buffers are not loaded, so that deleting thme does not result in data loss.
+---
+--- @param old_fname string
+--- @param new_fname string
+--- @param opts? vim.lsp.util.rename.Opts Options:
function M.rename(old_fname, new_fname, opts)
opts = opts or {}
- local target_exists = uv.fs_stat(new_fname) ~= nil
- if target_exists and not opts.overwrite or opts.ignoreIfExists then
- vim.notify('Rename target already exists. Skipping rename.')
+ local skip = not opts.overwrite or opts.ignoreIfExists
+
+ local old_fname_full = vim.uv.fs_realpath(vim.fs.normalize(old_fname, { expand_env = false }))
+ if not old_fname_full then
+ vim.notify('Invalid path: ' .. old_fname, vim.log.levels.ERROR)
return
end
- local oldbufs = {}
- local win = nil
-
- if vim.fn.isdirectory(old_fname) == 1 then
- oldbufs = get_dir_bufs(old_fname)
- else
- local oldbuf = vim.fn.bufadd(old_fname)
- table.insert(oldbufs, oldbuf)
- win = bufwinid(oldbuf)
+ local target_exists = uv.fs_stat(new_fname) ~= nil
+ if target_exists and skip then
+ vim.notify(new_fname .. ' already exists. Skipping rename.', vim.log.levels.ERROR)
+ return
end
- for _, b in ipairs(oldbufs) do
- vim.fn.bufload(b)
- -- The there may be pending changes in the buffer
- api.nvim_buf_call(b, function()
- vim.cmd('w!')
+ local buf_rename = {} ---@type table<integer, {from: string, to: string}>
+ local old_fname_pat = '^' .. vim.pesc(old_fname_full)
+ for b in
+ vim.iter(get_bufs_with_prefix(old_fname_full)):filter(function(b)
+ -- No need to care about unloaded or nofile buffers. Also :saveas won't work for them.
+ return api.nvim_buf_is_loaded(b)
+ and not vim.list_contains({ 'nofile', 'nowrite' }, vim.bo[b].buftype)
end)
+ do
+ -- Renaming a buffer may conflict with another buffer that happens to have the same name. In
+ -- most cases, this would have been already detected by the file conflict check above, but the
+ -- conflicting buffer may not be associated with a file. For example, 'buftype' can be "nofile"
+ -- or "nowrite", or the buffer can be a normal buffer but has not been written to the file yet.
+ -- Renaming should fail in such cases to avoid losing the contents of the conflicting buffer.
+ local old_bname = vim.api.nvim_buf_get_name(b)
+ local new_bname = old_bname:gsub(old_fname_pat, escape_gsub_repl(new_fname))
+ if vim.fn.bufexists(new_bname) == 1 then
+ local existing_buf = vim.fn.bufnr(new_bname)
+ if api.nvim_buf_is_loaded(existing_buf) and skip then
+ vim.notify(
+ new_bname .. ' already exists in the buffer list. Skipping rename.',
+ vim.log.levels.ERROR
+ )
+ return
+ end
+ -- no need to preserve if such a buffer is empty
+ api.nvim_buf_delete(existing_buf, {})
+ end
+
+ buf_rename[b] = { from = old_bname, to = new_bname }
end
- local ok, err = os.rename(old_fname, new_fname)
+ local newdir = assert(vim.fs.dirname(new_fname))
+ vim.fn.mkdir(newdir, 'p')
+
+ local ok, err = os.rename(old_fname_full, new_fname)
assert(ok, err)
- if vim.fn.isdirectory(new_fname) == 0 then
- local newbuf = vim.fn.bufadd(new_fname)
- if win then
- api.nvim_win_set_buf(win, newbuf)
- end
+ local old_undofile = vim.fn.undofile(old_fname_full)
+ if uv.fs_stat(old_undofile) ~= nil then
+ local new_undofile = vim.fn.undofile(new_fname)
+ vim.fn.mkdir(assert(vim.fs.dirname(new_undofile)), 'p')
+ os.rename(old_undofile, new_undofile)
end
- for _, b in ipairs(oldbufs) do
- api.nvim_buf_delete(b, {})
+ for b, rename in pairs(buf_rename) do
+ -- Rename with :saveas. This does two things:
+ -- * Unset BF_WRITE_MASK, so that users don't get E13 when they do :write.
+ -- * Send didClose and didOpen via textDocument/didSave handler.
+ api.nvim_buf_call(b, function()
+ vim.cmd('keepalt saveas! ' .. vim.fn.fnameescape(rename.to))
+ end)
+ -- Delete the new buffer with the old name created by :saveas. nvim_buf_delete and
+ -- :bwipeout are futile because the buffer will be added again somewhere else.
+ vim.cmd('bdelete! ' .. vim.fn.bufnr(rename.from))
end
end
@@ -745,7 +807,7 @@ end
---
---@param workspace_edit table `WorkspaceEdit`
---@param offset_encoding string utf-8|utf-16|utf-32 (required)
---see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_applyEdit
+---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_applyEdit
function M.apply_workspace_edit(workspace_edit, offset_encoding)
if offset_encoding == nil then
vim.notify_once(
@@ -789,7 +851,7 @@ end
--- Note that if the input is of type `MarkupContent` and its kind is `plaintext`,
--- then the corresponding value is returned without further modifications.
---
----@param input (`MarkedString` | `MarkedString[]` | `MarkupContent`)
+---@param input (lsp.MarkedString | lsp.MarkedString[] | lsp.MarkupContent)
---@param contents (table|nil) List of strings to extend with converted lines. Defaults to {}.
---@return string[] extended with lines of converted markdown.
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_hover
@@ -1055,7 +1117,7 @@ function M.show_document(location, offset_encoding, opts)
vim.fn.settagstack(vim.fn.win_getid(), { items = items }, 't')
end
- local win = opts.reuse_win and bufwinid(bufnr)
+ local win = opts.reuse_win and vim.fn.win_findbuf(bufnr)[1]
or focus and api.nvim_get_current_win()
or create_window_without_focus()
@@ -1068,7 +1130,7 @@ function M.show_document(location, offset_encoding, opts)
-- location may be Location or LocationLink
local range = location.range or location.targetSelectionRange
if range then
- --- Jump to new location (adjusting for encoding of characters)
+ -- Jump to new location (adjusting for encoding of characters)
local row = range.start.line
local col = get_line_byte_from_position(bufnr, range.start, offset_encoding)
api.nvim_win_set_cursor(win, { row + 1, col })
@@ -1105,6 +1167,7 @@ end
--- - for LocationLink, targetRange is shown (e.g., body of function definition)
---
---@param location table a single `Location` or `LocationLink`
+---@param opts table
---@return integer|nil buffer id of float window
---@return integer|nil window id of float window
function M.preview_location(location, opts)
@@ -1218,6 +1281,7 @@ end
---
--- If you want to open a popup with fancy markdown, use `open_floating_preview` instead
---
+---@param bufnr integer
---@param contents table of lines to show in window
---@param opts table with optional fields
--- - height of floating window
@@ -1410,7 +1474,7 @@ function M.stylize_markdown(bufnr, contents, opts)
return stripped
end
---- @class lsp.util.NormalizeMarkdownOptions
+--- @class (private) vim.lsp.util._normalize_markdown.Opts
--- @field width integer Thematic breaks are expanded to this size. Defaults to 80.
--- Normalizes Markdown input to a canonical form.
@@ -1426,7 +1490,7 @@ end
---
---@private
---@param contents string[]
----@param opts? lsp.util.NormalizeMarkdownOptions
+---@param opts? vim.lsp.util._normalize_markdown.Opts
---@return string[] table of lines containing normalized Markdown
---@see https://github.github.com/gfm
function M._normalize_markdown(contents, opts)
@@ -1497,7 +1561,7 @@ local function close_preview_autocmd(events, winnr, bufnrs)
end
end
----@internal
+---@private
--- Computes size of float needed to show contents (with optional wrapping)
---
---@param contents table of lines to show in window
@@ -1573,24 +1637,50 @@ function M._make_floating_popup_size(contents, opts)
return width, height
end
+--- @class vim.lsp.util.open_floating_preview.Opts
+--- @inlinedoc
+---
+--- Height of floating window
+--- @field height? integer
+---
+--- Width of floating window
+--- @field width? integer
+---
+--- Wrap long lines
+--- (default: `true`)
+--- @field wrap? boolean
+---
+--- Character to wrap at for computing height when wrap is enabled
+--- @field wrap_at? integer
+---
+--- Maximal width of floating window
+--- @field max_width? integer
+---
+--- Maximal height of floating window
+--- @field max_height? integer
+---
+--- If a popup with this id is opened, then focus it
+--- @field focus_id? string
+---
+--- List of events that closes the floating window
+--- @field close_events? table
+---
+--- Make float focusable.
+--- (default: `true`)
+--- @field focusable? boolean
+---
+--- If `true`, and if {focusable} is also `true`, focus an existing floating
+--- window with the same {focus_id}
+--- (default: `true`)
+--- @field focus? boolean
+
--- Shows contents in a floating window.
---
---@param contents table of lines to show in window
---@param syntax string of syntax to set for opened buffer
----@param opts table with optional fields (additional keys are filtered with |vim.lsp.util.make_floating_popup_options()|
---- before they are passed on to |nvim_open_win()|)
---- - height: (integer) height of floating window
---- - width: (integer) width of floating window
---- - wrap: (boolean, default true) wrap long lines
---- - wrap_at: (integer) character to wrap at for computing height when wrap is enabled
---- - max_width: (integer) maximal width of floating window
---- - max_height: (integer) maximal height of floating window
---- - focus_id: (string) if a popup with this id is opened, then focus it
---- - close_events: (table) list of events that closes the floating window
---- - focusable: (boolean, default true) Make float focusable
---- - focus: (boolean, default true) If `true`, and if {focusable}
---- is also `true`, focus an existing floating window with the same
---- {focus_id}
+---@param opts? vim.lsp.util.open_floating_preview.Opts with optional fields
+--- (additional keys are filtered with |vim.lsp.util.make_floating_popup_options()|
+--- before they are passed on to |nvim_open_win()|)
---@return integer bufnr of newly created float window
---@return integer winid of newly created float window preview window
function M.open_floating_preview(contents, syntax, opts)
@@ -1754,6 +1844,14 @@ local position_sort = sort_by_key(function(v)
return { v.start.line, v.start.character }
end)
+---@class vim.lsp.util.locations_to_items.ret
+---@inlinedoc
+---@field filename string
+---@field lnum integer 1-indexed line number
+---@field col integer 1-indexed column
+---@field text string
+---@field user_data lsp.Location|lsp.LocationLink
+
--- Returns the items with the byte position calculated correctly and in sorted
--- order, for display in quickfix and location lists.
---
@@ -1763,10 +1861,10 @@ end)
--- The result can be passed to the {list} argument of |setqflist()| or
--- |setloclist()|.
---
----@param locations table list of `Location`s or `LocationLink`s
+---@param locations lsp.Location[]|lsp.LocationLink[]
---@param offset_encoding string offset_encoding for locations utf-8|utf-16|utf-32
--- default to first client of buffer
----@return table list of items
+---@return vim.lsp.util.locations_to_items.ret[]
function M.locations_to_items(locations, offset_encoding)
if offset_encoding == nil then
vim.notify_once(
@@ -1777,6 +1875,7 @@ function M.locations_to_items(locations, offset_encoding)
end
local items = {}
+ ---@type table<string, {start: lsp.Position, location: lsp.Location|lsp.LocationLink}[]>
local grouped = setmetatable({}, {
__index = function(t, k)
local v = {}
@@ -1791,6 +1890,7 @@ function M.locations_to_items(locations, offset_encoding)
table.insert(grouped[uri], { start = range.start, location = d })
end
+ ---@type string[]
local keys = vim.tbl_keys(grouped)
table.sort(keys)
-- TODO(ashkan) I wish we could do this lazily.
@@ -1799,16 +1899,13 @@ function M.locations_to_items(locations, offset_encoding)
table.sort(rows, position_sort)
local filename = vim.uri_to_fname(uri)
- -- list of row numbers
- local uri_rows = {}
+ local line_numbers = {}
for _, temp in ipairs(rows) do
- local pos = temp.start
- local row = pos.line
- table.insert(uri_rows, row)
+ table.insert(line_numbers, temp.start.line)
end
-- get all the lines for this uri
- local lines = get_lines(vim.uri_to_bufnr(uri), uri_rows)
+ local lines = get_lines(vim.uri_to_bufnr(uri), line_numbers)
for _, temp in ipairs(rows) do
local pos = temp.start
@@ -1837,6 +1934,7 @@ end
--- Converts symbols to quickfix list items.
---
---@param symbols table DocumentSymbol[] or SymbolInformation[]
+---@param bufnr integer
function M.symbols_to_items(symbols, bufnr)
local function _symbols_to_items(_symbols, _items, _bufnr)
for _, symbol in ipairs(_symbols) do
@@ -1879,6 +1977,7 @@ end
---@param lines table list of lines to trim
---@return table trimmed list of lines
function M.trim_empty_lines(lines)
+ vim.deprecate('vim.lsp.util.trim_empty_lines()', 'vim.split() with `trimempty`', '0.12')
local start = 1
for i = 1, #lines do
if lines[i] ~= nil and #lines[i] > 0 then
@@ -1905,6 +2004,7 @@ end
---@param lines table list of lines
---@return string filetype or "markdown" if it was unchanged.
function M.try_trim_markdown_code_blocks(lines)
+ vim.deprecate('vim.lsp.util.try_trim_markdown_code_blocks()', 'nil', '0.12')
local language_id = lines[1]:match('^```(.*)')
if language_id then
local has_inner_code_fence = false
@@ -2089,7 +2189,7 @@ end
--- Creates a `DocumentFormattingParams` object for the current buffer and cursor position.
---
---@param options table|nil with valid `FormattingOptions` entries
----@return `DocumentFormattingParams` object
+---@return lsp.DocumentFormattingParams object
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting
function M.make_formatting_params(options)
validate({ options = { options, 't', true } })
@@ -2106,8 +2206,8 @@ end
--- Returns the UTF-32 and UTF-16 offsets for a position in a certain buffer.
---
---@param buf integer buffer number (0 for current)
----@param row 0-indexed line
----@param col 0-indexed byte offset in line
+---@param row integer 0-indexed line
+---@param col integer 0-indexed byte offset in line
---@param offset_encoding string utf-8|utf-16|utf-32 defaults to `offset_encoding` of first client of `buf`
---@return integer `offset_encoding` index of the character in line {row} column {col} in buffer {buf}
function M.character_offset(buf, row, col, offset_encoding)
@@ -2130,8 +2230,10 @@ end
---
---@param settings table language server settings
---@param section string indicating the field of the settings table
----@return table|string The value of settings accessed via section
+---@return table|string|vim.NIL The value of settings accessed via section. `vim.NIL` if not found.
+---@deprecated
function M.lookup_section(settings, section)
+ vim.deprecate('vim.lsp.util.lookup_section()', 'vim.tbl_get() with `vim.split`', '0.12')
for part in vim.gsplit(section, '.', { plain = true }) do
settings = settings[part]
if settings == nil then
@@ -2170,16 +2272,16 @@ local function make_line_range_params(bufnr, start_line, end_line, offset_encodi
}
end
----@private
---- Request updated LSP information for a buffer.
----
----@class lsp.util.RefreshOptions
+---@class (private) vim.lsp.util._refresh.Opts
---@field bufnr integer? Buffer to refresh (default: 0)
---@field only_visible? boolean Whether to only refresh for the visible regions of the buffer (default: false)
---@field client_id? integer Client ID to refresh (default: all clients)
---
+
+---@private
+--- Request updated LSP information for a buffer.
+---
---@param method string LSP method to call
----@param opts? lsp.util.RefreshOptions Options table
+---@param opts? vim.lsp.util._refresh.Opts Options table
function M._refresh(method, opts)
opts = opts or {}
local bufnr = opts.bufnr
@@ -2228,6 +2330,6 @@ end
M._get_line_byte_from_position = get_line_byte_from_position
---@nodoc
-M.buf_versions = {}
+M.buf_versions = {} ---@type table<integer,integer>
return M
diff --git a/runtime/lua/vim/provider.lua b/runtime/lua/vim/provider.lua
new file mode 100644
index 0000000000..08b3fd6cbd
--- /dev/null
+++ b/runtime/lua/vim/provider.lua
@@ -0,0 +1,7 @@
+local M = vim._defer_require('vim.provider', {
+ perl = ..., --- @module 'vim.provider.perl'
+ python = ..., --- @module 'vim.provider.python'
+ ruby = ..., --- @module 'vim.provider.ruby'
+})
+
+return M
diff --git a/runtime/lua/vim/provider/perl.lua b/runtime/lua/vim/provider/perl.lua
new file mode 100644
index 0000000000..da4af0a2a7
--- /dev/null
+++ b/runtime/lua/vim/provider/perl.lua
@@ -0,0 +1,66 @@
+local M = {}
+local s_err ---@type string?
+local s_host ---@type string?
+
+function M.require(host, prog)
+ local args = { prog, '-e', 'use Neovim::Ext; start_host();' }
+
+ -- Collect registered perl plugins into args
+ local perl_plugins = vim.fn['remote#host#PluginsForHost'](host.name) ---@type any
+ ---@param plugin any
+ for _, plugin in ipairs(perl_plugins) do
+ table.insert(args, plugin.path)
+ end
+
+ return vim.fn['provider#Poll'](args, host.orig_name, '$NVIM_PERL_LOG_FILE')
+end
+
+--- @return string? path to detected perl, if any; nil if not found
+--- @return string? error message if perl can't be detected; nil if success
+function M.detect()
+ -- use g:perl_host_prog if set or check if perl is on the path
+ local prog = vim.fn.exepath(vim.g.perl_host_prog or 'perl')
+ if prog == '' then
+ return nil, 'No perl executable found'
+ end
+
+ -- if perl is available, make sure we have 5.22+
+ vim.fn.system({ prog, '-e', 'use v5.22' })
+ if vim.v.shell_error ~= 0 then
+ return nil, 'Perl version is too old, 5.22+ required'
+ end
+
+ -- if perl is available, make sure the required module is available
+ vim.fn.system({ prog, '-W', '-MNeovim::Ext', '-e', '' })
+ if vim.v.shell_error ~= 0 then
+ return nil, '"Neovim::Ext" cpan module is not installed'
+ end
+ return prog, nil
+end
+
+function M.call(method, args)
+ if s_err then
+ return
+ end
+
+ if not s_host then
+ -- Ensure that we can load the Perl host before bootstrapping
+ local ok, result = pcall(vim.fn['remote#host#Require'], 'legacy-perl-provider') ---@type any, any
+ if not ok then
+ s_err = result
+ vim.api.nvim_echo({ { result, 'WarningMsg' } }, true, {})
+ return
+ end
+ s_host = result
+ end
+
+ return vim.fn.rpcrequest(s_host, 'perl_' .. method, unpack(args))
+end
+
+function M.start()
+ -- The perl provider plugin will run in a separate instance of the perl host.
+ vim.fn['remote#host#RegisterClone']('legacy-perl-provider', 'perl')
+ vim.fn['remote#host#RegisterPlugin']('legacy-perl-provider', 'ScriptHost.pm', {})
+end
+
+return M
diff --git a/runtime/lua/vim/provider/python.lua b/runtime/lua/vim/provider/python.lua
new file mode 100644
index 0000000000..8322131238
--- /dev/null
+++ b/runtime/lua/vim/provider/python.lua
@@ -0,0 +1,150 @@
+local M = {}
+local min_version = '3.7'
+local s_err ---@type string?
+local s_host ---@type string?
+
+local python_candidates = {
+ 'python3',
+ 'python3.12',
+ 'python3.11',
+ 'python3.10',
+ 'python3.9',
+ 'python3.8',
+ 'python3.7',
+ 'python',
+}
+
+--- @param prog string
+--- @param module string
+--- @return integer, string
+local function import_module(prog, module)
+ local program = [[
+import sys, importlib.util;
+sys.path = [p for p in sys.path if p != ""];
+sys.stdout.write(str(sys.version_info[0]) + "." + str(sys.version_info[1]));]]
+
+ program = program
+ .. string.format('sys.exit(2 * int(importlib.util.find_spec("%s") is None))', module)
+
+ local out = vim.system({ prog, '-W', 'ignore', '-c', program }):wait()
+ return out.code, assert(out.stdout)
+end
+
+--- @param prog string
+--- @param module string
+--- @return string?
+local function check_for_module(prog, module)
+ local prog_path = vim.fn.exepath(prog)
+ if prog_path == '' then
+ return prog .. ' not found in search path or not executable.'
+ end
+
+ -- Try to load module, and output Python version.
+ -- Exit codes:
+ -- 0 module can be loaded.
+ -- 2 module cannot be loaded.
+ -- Otherwise something else went wrong (e.g. 1 or 127).
+ local prog_exitcode, prog_version = import_module(prog, module)
+ if prog_exitcode == 2 or prog_exitcode == 0 then
+ -- Check version only for expected return codes.
+ if vim.version.lt(prog_version, min_version) then
+ return string.format(
+ '%s is Python %s and cannot provide Python >= %s.',
+ prog_path,
+ prog_version,
+ min_version
+ )
+ end
+ end
+
+ if prog_exitcode == 2 then
+ return string.format('%s does not have the "%s" module.', prog_path, module)
+ elseif prog_exitcode == 127 then
+ -- This can happen with pyenv's shims.
+ return string.format('%s does not exist: %s', prog_path, prog_version)
+ elseif prog_exitcode ~= 0 then
+ return string.format(
+ 'Checking %s caused an unknown error. (%s, output: %s) Report this at https://github.com/neovim/neovim',
+ prog_path,
+ prog_exitcode,
+ prog_version
+ )
+ end
+
+ return nil
+end
+
+--- @param module string
+--- @return string? path to detected python, if any; nil if not found
+--- @return string? error message if python can't be detected by {module}; nil if success
+function M.detect_by_module(module)
+ local python_exe = vim.fn.expand(vim.g.python3_host_prog or '', true)
+
+ if python_exe ~= '' then
+ return vim.fn.exepath(vim.fn.expand(python_exe, true)), nil
+ end
+
+ local errors = {}
+ for _, exe in ipairs(python_candidates) do
+ local error = check_for_module(exe, module)
+ if not error then
+ return exe, error
+ end
+ -- Accumulate errors in case we don't find any suitable Python executable.
+ table.insert(errors, error)
+ end
+
+ -- No suitable Python executable found.
+ return nil, 'Could not load Python :\n' .. table.concat(errors, '\n')
+end
+
+function M.require(host)
+ -- Python host arguments
+ local prog = M.detect_by_module('neovim')
+ local args = {
+ prog,
+ '-c',
+ 'import sys; sys.path = [p for p in sys.path if p != ""]; import neovim; neovim.start_host()',
+ }
+
+ -- Collect registered Python plugins into args
+ local python_plugins = vim.fn['remote#host#PluginsForHost'](host.name) ---@type any
+ ---@param plugin any
+ for _, plugin in ipairs(python_plugins) do
+ table.insert(args, plugin.path)
+ end
+
+ return vim.fn['provider#Poll'](
+ args,
+ host.orig_name,
+ '$NVIM_PYTHON_LOG_FILE',
+ { ['overlapped'] = true }
+ )
+end
+
+function M.call(method, args)
+ if s_err then
+ return
+ end
+
+ if not s_host then
+ -- Ensure that we can load the Python3 host before bootstrapping
+ local ok, result = pcall(vim.fn['remote#host#Require'], 'legacy-python3-provider') ---@type any, any
+ if not ok then
+ s_err = result
+ vim.api.nvim_echo({ { result, 'WarningMsg' } }, true, {})
+ return
+ end
+ s_host = result
+ end
+
+ return vim.fn.rpcrequest(s_host, 'python_' .. method, unpack(args))
+end
+
+function M.start()
+ -- The Python3 provider plugin will run in a separate instance of the Python3 host.
+ vim.fn['remote#host#RegisterClone']('legacy-python3-provider', 'python3')
+ vim.fn['remote#host#RegisterPlugin']('legacy-python3-provider', 'script_host.py', {})
+end
+
+return M
diff --git a/runtime/lua/vim/provider/ruby.lua b/runtime/lua/vim/provider/ruby.lua
new file mode 100644
index 0000000000..3ad86001f3
--- /dev/null
+++ b/runtime/lua/vim/provider/ruby.lua
@@ -0,0 +1,61 @@
+local M = {}
+local s_err ---@type string?
+local s_host ---@type string?
+
+function M.require(host)
+ local prog = M.detect()
+ local args = { prog }
+ local ruby_plugins = vim.fn['remote#host#PluginsForHost'](host.name) ---@type any
+
+ ---@param plugin any
+ for _, plugin in ipairs(ruby_plugins) do
+ table.insert(args, plugin.path)
+ end
+
+ return vim.fn['provider#Poll'](args, host.orig_name, '$NVIM_RUBY_LOG_FILE')
+end
+
+function M.call(method, args)
+ if s_err then
+ return
+ end
+
+ if not s_host then
+ local ok, result = pcall(vim.fn['remote#host#Require'], 'legacy-ruby-provider') ---@type any, any
+ if not ok then
+ s_err = result
+ vim.api.nvim_echo({ { result, 'WarningMsg' } }, true, {})
+ return
+ end
+ s_host = result
+ end
+
+ return vim.fn.rpcrequest(s_host, 'ruby_' .. method, unpack(args))
+end
+
+function M.detect()
+ local prog ---@type string
+ if vim.g.ruby_host_prog then
+ prog = vim.fn.expand(vim.g.ruby_host_prog, true)
+ elseif vim.fn.has('win32') == 1 then
+ prog = vim.fn.exepath('neovim-ruby-host.bat')
+ else
+ local p = vim.fn.exepath('neovim-ruby-host')
+ if p == '' then
+ prog = ''
+ else
+ -- neovim-ruby-host could be an rbenv shim for another Ruby version.
+ vim.fn.system(p)
+ prog = vim.v.shell_error ~= 0 and '' or p
+ end
+ end
+ local err = prog == '' and 'missing ruby or ruby-host' or ''
+ return prog, err
+end
+
+function M.start(plugin_path)
+ vim.fn['remote#host#RegisterClone']('legacy-ruby-provider', 'ruby')
+ vim.fn['remote#host#RegisterPlugin']('legacy-ruby-provider', plugin_path, {})
+end
+
+return M
diff --git a/runtime/lua/vim/re.lua b/runtime/lua/vim/re.lua
index 007eb27ed8..114f74eb80 100644
--- a/runtime/lua/vim/re.lua
+++ b/runtime/lua/vim/re.lua
@@ -3,6 +3,7 @@
-- written by Roberto Ierusalimschy
--
--- vendored from lpeg-1.1.0
+--- documentation available at runtime/lua/vim/_meta/re.lua
-- imported functions and modules
local tonumber, type, print, error = tonumber, type, print, error
diff --git a/runtime/lua/vim/secure.lua b/runtime/lua/vim/secure.lua
index d29c356af3..3992eef78a 100644
--- a/runtime/lua/vim/secure.lua
+++ b/runtime/lua/vim/secure.lua
@@ -108,22 +108,25 @@ function M.read(path)
return contents
end
----@class vim.trust.opts
----@field action string
----@field path? string
----@field bufnr? integer
+--- @class vim.trust.opts
+--- @inlinedoc
+---
+--- - `'allow'` to add a file to the trust database and trust it,
+--- - `'deny'` to add a file to the trust database and deny it,
+--- - `'remove'` to remove file from the trust database
+--- @field action 'allow'|'deny'|'remove'
+---
+--- Path to a file to update. Mutually exclusive with {bufnr}.
+--- Cannot be used when {action} is "allow".
+--- @field path? string
+--- Buffer number to update. Mutually exclusive with {path}.
+--- @field bufnr? integer
--- Manage the trust database.
---
--- The trust database is located at |$XDG_STATE_HOME|/nvim/trust.
---
----@param opts (table):
---- - action (string): "allow" to add a file to the trust database and trust it,
---- "deny" to add a file to the trust database and deny it,
---- "remove" to remove file from the trust database
---- - path (string|nil): Path to a file to update. Mutually exclusive with {bufnr}.
---- Cannot be used when {action} is "allow".
---- - bufnr (number|nil): Buffer number to update. Mutually exclusive with {path}.
+---@param opts? vim.trust.opts
---@return boolean success true if operation was successful
---@return string msg full path if operation was successful, else error message
function M.trust(opts)
diff --git a/runtime/lua/vim/shared.lua b/runtime/lua/vim/shared.lua
index 9542d93789..bd553598c7 100644
--- a/runtime/lua/vim/shared.lua
+++ b/runtime/lua/vim/shared.lua
@@ -6,46 +6,40 @@
-- or the test suite. (Eventually the test suite will be run in a worker process,
-- so this wouldn't be a separate case to consider)
+---@nodoc
---@diagnostic disable-next-line: lowercase-global
vim = vim or {}
-local function _id(v)
- return v
-end
+---@generic T
+---@param orig T
+---@param cache? table<any,any>
+---@return T
+local function deepcopy(orig, cache)
+ if orig == vim.NIL then
+ return vim.NIL
+ elseif type(orig) == 'userdata' or type(orig) == 'thread' then
+ error('Cannot deepcopy object of type ' .. type(orig))
+ elseif type(orig) ~= 'table' then
+ return orig
+ end
-local deepcopy
+ --- @cast orig table<any,any>
-local deepcopy_funcs = {
- table = function(orig, cache)
- if cache[orig] then
- return cache[orig]
- end
- local copy = {}
+ if cache and cache[orig] then
+ return cache[orig]
+ end
+ local copy = {} --- @type table<any,any>
+
+ if cache then
cache[orig] = copy
- local mt = getmetatable(orig)
- for k, v in pairs(orig) do
- copy[deepcopy(k, cache)] = deepcopy(v, cache)
- end
- return setmetatable(copy, mt)
- end,
- number = _id,
- string = _id,
- ['nil'] = _id,
- boolean = _id,
- ['function'] = _id,
-}
-
-deepcopy = function(orig, _cache)
- local f = deepcopy_funcs[type(orig)]
- if f then
- return f(orig, _cache or {})
- else
- if type(orig) == 'userdata' and orig == vim.NIL then
- return vim.NIL
- end
- error('Cannot deepcopy object of type ' .. type(orig))
end
+
+ for k, v in pairs(orig) do
+ copy[deepcopy(k, cache)] = deepcopy(v, cache)
+ end
+
+ return setmetatable(copy, getmetatable(orig))
end
--- Returns a deep copy of the given object. Non-table objects are copied as
@@ -54,13 +48,31 @@ end
--- same functions as those in the input table. Userdata and threads are not
--- copied and will throw an error.
---
+--- Note: `noref=true` is much more performant on tables with unique table
+--- fields, while `noref=false` is more performant on tables that reuse table
+--- fields.
+---
---@generic T: table
---@param orig T Table to copy
+---@param noref? boolean
+--- When `false` (default) a contained table is only copied once and all
+--- references point to this single copy. When `true` every occurrence of a
+--- table results in a new copy. This also means that a cyclic reference can
+--- cause `deepcopy()` to fail.
---@return T Table of copied keys and (nested) values.
-function vim.deepcopy(orig)
- return deepcopy(orig)
+function vim.deepcopy(orig, noref)
+ return deepcopy(orig, not noref and {} or nil)
end
+--- @class vim.gsplit.Opts
+--- @inlinedoc
+---
+--- Use `sep` literally (as in string.find).
+--- @field plain? boolean
+---
+--- Discard empty segments at start and end of the sequence.
+--- @field trimempty? boolean
+
--- Gets an |iterator| that splits a string at each instance of a separator, in "lazy" fashion
--- (as opposed to |vim.split()| which is "eager").
---
@@ -89,12 +101,10 @@ end
---
--- @param s string String to split
--- @param sep string Separator or pattern
---- @param opts (table|nil) Keyword arguments |kwargs|:
---- - plain: (boolean) Use `sep` literally (as in string.find).
---- - trimempty: (boolean) Discard empty segments at start and end of the sequence.
----@return fun():string|nil (function) Iterator over the split components
+--- @param opts? vim.gsplit.Opts Keyword arguments |kwargs|:
+--- @return fun():string? : Iterator over the split components
function vim.gsplit(s, sep, opts)
- local plain
+ local plain --- @type boolean?
local trimempty = false
if type(opts) == 'boolean' then
plain = opts -- For backwards compatibility.
@@ -111,6 +121,11 @@ function vim.gsplit(s, sep, opts)
local segs = {}
local empty_start = true -- Only empty segments seen so far.
+ --- @param i integer?
+ --- @param j integer
+ --- @param ... unknown
+ --- @return string
+ --- @return ...
local function _pass(i, j, ...)
if i then
assert(j + 1 > start, 'Infinite loop detected')
@@ -180,8 +195,8 @@ end
---
---@param s string String to split
---@param sep string Separator or pattern
----@param opts (table|nil) Keyword arguments |kwargs| accepted by |vim.gsplit()|
----@return string[] List of split components
+---@param opts? vim.gsplit.Opts Keyword arguments |kwargs|:
+---@return string[] : List of split components
function vim.split(s, sep, opts)
local t = {}
for c in vim.gsplit(s, sep, opts) do
@@ -195,14 +210,15 @@ end
---
---@see From https://github.com/premake/premake-core/blob/master/src/base/table.lua
---
----@generic T: table
+---@generic T
---@param t table<T, any> (table) Table
----@return T[] (list) List of keys
+---@return T[] : List of keys
function vim.tbl_keys(t)
- assert(type(t) == 'table', string.format('Expected table, got %s', type(t)))
+ vim.validate({ t = { t, 't' } })
+ --- @cast t table<any,any>
local keys = {}
- for k, _ in pairs(t) do
+ for k in pairs(t) do
table.insert(keys, k)
end
return keys
@@ -213,12 +229,14 @@ end
---
---@generic T
---@param t table<any, T> (table) Table
----@return T[] (list) List of values
+---@return T[] : List of values
function vim.tbl_values(t)
- assert(type(t) == 'table', string.format('Expected table, got %s', type(t)))
+ vim.validate({ t = { t, 't' } })
local values = {}
- for _, v in pairs(t) do
+ for _, v in
+ pairs(t --[[@as table<any,any>]])
+ do
table.insert(values, v)
end
return values
@@ -227,13 +245,14 @@ end
--- Apply a function to all values of a table.
---
---@generic T
----@param func fun(value: T): any (function) Function
----@param t table<any, T> (table) Table
----@return table Table of transformed values
+---@param func fun(value: T): any Function
+---@param t table<any, T> Table
+---@return table : Table of transformed values
function vim.tbl_map(func, t)
vim.validate({ func = { func, 'c' }, t = { t, 't' } })
+ --- @cast t table<any,any>
- local rettab = {}
+ local rettab = {} --- @type table<any,any>
for k, v in pairs(t) do
rettab[k] = func(v)
end
@@ -245,19 +264,26 @@ end
---@generic T
---@param func fun(value: T): boolean (function) Function
---@param t table<any, T> (table) Table
----@return T[] (table) Table of filtered values
+---@return T[] : Table of filtered values
function vim.tbl_filter(func, t)
vim.validate({ func = { func, 'c' }, t = { t, 't' } })
+ --- @cast t table<any,any>
- local rettab = {}
+ local rettab = {} --- @type table<any,any>
for _, entry in pairs(t) do
if func(entry) then
- table.insert(rettab, entry)
+ rettab[#rettab + 1] = entry
end
end
return rettab
end
+--- @class vim.tbl_contains.Opts
+--- @inlinedoc
+---
+--- `value` is a function reference to be checked (default false)
+--- @field predicate? boolean
+
--- Checks if a table contains a given value, specified either directly or via
--- a predicate that is checked for each value.
---
@@ -274,13 +300,13 @@ end
---
---@param t table Table to check
---@param value any Value to compare or predicate function reference
----@param opts (table|nil) Keyword arguments |kwargs|:
---- - predicate: (boolean) `value` is a function reference to be checked (default false)
+---@param opts? vim.tbl_contains.Opts Keyword arguments |kwargs|:
---@return boolean `true` if `t` contains `value`
function vim.tbl_contains(t, value, opts)
vim.validate({ t = { t, 't' }, opts = { opts, 't', true } })
+ --- @cast t table<any,any>
- local pred
+ local pred --- @type fun(v: any): boolean?
if opts and opts.predicate then
vim.validate({ value = { value, 'c' } })
pred = value
@@ -307,6 +333,7 @@ end
---@return boolean `true` if `t` contains `value`
function vim.list_contains(t, value)
vim.validate({ t = { t, 't' } })
+ --- @cast t table<any,any>
for _, v in ipairs(t) do
if v == value then
@@ -323,7 +350,7 @@ end
---@param t table Table to check
---@return boolean `true` if `t` is empty
function vim.tbl_isempty(t)
- assert(type(t) == 'table', string.format('Expected table, got %s', type(t)))
+ vim.validate({ t = { t, 't' } })
return next(t) == nil
end
@@ -345,7 +372,7 @@ local function tbl_extend(behavior, deep_extend, ...)
)
end
- local ret = {}
+ 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
@@ -353,6 +380,7 @@ local function tbl_extend(behavior, deep_extend, ...)
for i = 1, select('#', ...) do
local tbl = select(i, ...)
vim.validate({ ['after the second argument'] = { tbl, 't' } })
+ --- @cast tbl 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
@@ -379,7 +407,7 @@ end
--- - "keep": use value from the leftmost map
--- - "force": use value from the rightmost map
---@param ... table Two or more tables
----@return table Merged table
+---@return table : Merged table
function vim.tbl_extend(behavior, ...)
return tbl_extend(behavior, false, ...)
end
@@ -415,12 +443,14 @@ function vim.deep_equal(a, b)
return false
end
if type(a) == 'table' then
+ --- @cast a table<any,any>
+ --- @cast b table<any,any>
for k, v in pairs(a) do
if not vim.deep_equal(v, b[k]) then
return false
end
end
- for k, _ in pairs(b) do
+ for k in pairs(b) do
if a[k] == nil then
return false
end
@@ -432,12 +462,17 @@ end
--- Add the reverse lookup values to an existing table.
--- For example:
---- ``tbl_add_reverse_lookup { A = 1 } == { [1] = 'A', A = 1 }``
+--- `tbl_add_reverse_lookup { A = 1 } == { [1] = 'A', A = 1 }`
---
--- Note that this *modifies* the input.
+---@deprecated
---@param o table Table to add the reverse to
---@return table o
function vim.tbl_add_reverse_lookup(o)
+ vim.deprecate('vim.tbl_add_reverse_lookup', nil, '0.12')
+
+ --- @cast o table<any,any>
+ --- @type any[]
local keys = vim.tbl_keys(o)
for _, k in ipairs(keys) do
local v = o[k]
@@ -467,15 +502,14 @@ end
---
---@param o table Table to index
---@param ... any Optional keys (0 or more, variadic) via which to index the table
----
----@return any Nested value indexed by key (if it exists), else nil
+---@return any : Nested value indexed by key (if it exists), else nil
function vim.tbl_get(o, ...)
local keys = { ... }
if #keys == 0 then
return nil
end
for i, k in ipairs(keys) do
- o = o[k]
+ o = o[k] --- @type any
if o == nil then
return nil
elseif type(o) ~= 'table' and next(keys, i) then
@@ -494,8 +528,8 @@ end
---@generic T: table
---@param dst T List which will be modified and appended to
---@param src table List from which values will be inserted
----@param start (integer|nil) Start index on src. Defaults to 1
----@param finish (integer|nil) Final index on src. Defaults to `#src`
+---@param start integer? Start index on src. Defaults to 1
+---@param finish integer? Final index on src. Defaults to `#src`
---@return T dst
function vim.list_extend(dst, src, start, finish)
vim.validate({
@@ -519,6 +553,7 @@ end
---@return table Flattened copy of the given list-like table
function vim.tbl_flatten(t)
local result = {}
+ --- @param _t table<any,any>
local function _tbl_flatten(_t)
local n = #_t
for i = 1, n do
@@ -538,10 +573,13 @@ end
---
---@see Based on https://github.com/premake/premake-core/blob/master/src/base/table.lua
---
----@param t table Dict-like table
----@return function # |for-in| iterator over sorted keys and their values
+---@generic T: table, K, V
+---@param t T Dict-like table
+---@return fun(table: table<K, V>, index?: K):K, V # |for-in| iterator over sorted keys and their values
+---@return T
function vim.spairs(t)
- assert(type(t) == 'table', string.format('Expected table, got %s', type(t)))
+ vim.validate({ t = { t, 't' } })
+ --- @cast t table<any,any>
-- collect the keys
local keys = {}
@@ -557,7 +595,8 @@ function vim.spairs(t)
if keys[i] then
return keys[i], t[keys[i]]
end
- end
+ end,
+ t
end
--- Tests if `t` is an "array": a table indexed _only_ by integers (potentially non-contiguous).
@@ -576,10 +615,12 @@ function vim.tbl_isarray(t)
return false
end
+ --- @cast t table<any,any>
+
local count = 0
for k, _ in pairs(t) do
- --- Check if the number k is an integer
+ -- Check if the number k is an integer
if type(k) == 'number' and k == math.floor(k) then
count = count + 1
else
@@ -614,23 +655,21 @@ function vim.tbl_islist(t)
return false
end
- local num_elem = vim.tbl_count(t)
-
- if num_elem == 0 then
- -- TODO(bfredl): in the future, we will always be inside nvim
- -- then this check can be deleted.
- if vim._empty_dict_mt == nil then
- return nil
- end
+ if next(t) == nil then
return getmetatable(t) ~= vim._empty_dict_mt
- else
- for i = 1, num_elem do
- if t[i] == nil then
- return false
- end
+ end
+
+ local j = 1
+ for _ in
+ pairs(t--[[@as table<any,any>]])
+ do
+ if t[j] == nil then
+ return false
end
- return true
+ j = j + 1
end
+
+ return true
end
--- Counts the number of non-nil values in table `t`.
@@ -642,9 +681,10 @@ end
---
---@see https://github.com/Tieske/Penlight/blob/master/lua/pl/tablex.lua
---@param t table Table
----@return integer Number of non-nil values in table
+---@return integer : Number of non-nil values in table
function vim.tbl_count(t)
vim.validate({ t = { t, 't' } })
+ --- @cast t table<any,any>
local count = 0
for _ in pairs(t) do
@@ -656,12 +696,12 @@ end
--- Creates a copy of a table containing only elements from start to end (inclusive)
---
---@generic T
----@param list T[] (list) Table
+---@param list T[] Table
---@param start integer|nil Start range of slice
---@param finish integer|nil End range of slice
----@return T[] (list) Copy of table sliced from start to finish (inclusive)
+---@return T[] Copy of table sliced from start to finish (inclusive)
function vim.list_slice(list, start, finish)
- local new_list = {}
+ local new_list = {} --- @type `T`[]
for i = start or 1, finish or #list do
new_list[#new_list + 1] = list[i]
end
@@ -710,6 +750,16 @@ function vim.endswith(s, suffix)
end
do
+ --- @alias vim.validate.Type
+ --- | 't' | 'table'
+ --- | 's' | 'string'
+ --- | 'n' | 'number'
+ --- | 'f' | 'function'
+ --- | 'c' | 'callable'
+ --- | 'nil'
+ --- | 'thread'
+ --- | 'userdata
+
local type_names = {
['table'] = 'table',
t = 'table',
@@ -728,10 +778,18 @@ do
['userdata'] = 'userdata',
}
+ --- @nodoc
+ --- @class vim.validate.Spec {[1]: any, [2]: string|string[], [3]: boolean }
+ --- @field [1] any Argument value
+ --- @field [2] string|string[]|fun(v:any):boolean, string? Type name, or callable
+ --- @field [3]? boolean
+
local function _is_type(val, t)
return type(val) == t or (t == 'callable' and vim.is_callable(val))
end
+ --- @param opt table<vim.validate.Type,vim.validate.Spec>
+ --- @return boolean, string?
local function is_valid(opt)
if type(opt) ~= 'table' then
return false, string.format('opt: expected table, got %s', type(opt))
@@ -790,7 +848,7 @@ do
end
end
- return true, nil
+ return true
end
--- Validates a parameter specification (types and values).
@@ -798,41 +856,40 @@ do
--- Usage example:
---
--- ```lua
- --- function user.new(name, age, hobbies)
- --- vim.validate{
- --- name={name, 'string'},
- --- age={age, 'number'},
- --- hobbies={hobbies, 'table'},
- --- }
- --- ...
- --- end
+ --- function user.new(name, age, hobbies)
+ --- vim.validate{
+ --- name={name, 'string'},
+ --- age={age, 'number'},
+ --- hobbies={hobbies, 'table'},
+ --- }
+ --- ...
+ --- end
--- ```
---
--- Examples with explicit argument values (can be run directly):
---
--- ```lua
- --- vim.validate{arg1={{'foo'}, 'table'}, arg2={'foo', 'string'}}
- --- --> NOP (success)
+ --- vim.validate{arg1={{'foo'}, 'table'}, arg2={'foo', 'string'}}
+ --- --> NOP (success)
---
- --- vim.validate{arg1={1, 'table'}}
- --- --> error('arg1: expected table, got number')
+ --- vim.validate{arg1={1, 'table'}}
+ --- --> error('arg1: expected table, got number')
---
- --- vim.validate{arg1={3, function(a) return (a % 2) == 0 end, 'even number'}}
- --- --> error('arg1: expected even number, got 3')
+ --- vim.validate{arg1={3, function(a) return (a % 2) == 0 end, 'even number'}}
+ --- --> error('arg1: expected even number, got 3')
--- ```
---
--- If multiple types are valid they can be given as a list.
---
--- ```lua
- --- vim.validate{arg1={{'foo'}, {'table', 'string'}}, arg2={'foo', {'table', 'string'}}}
- --- -- NOP (success)
- ---
- --- vim.validate{arg1={1, {'string', 'table'}}}
- --- -- error('arg1: expected string|table, got number')
+ --- vim.validate{arg1={{'foo'}, {'table', 'string'}}, arg2={'foo', {'table', 'string'}}}
+ --- -- NOP (success)
---
+ --- vim.validate{arg1={1, {'string', 'table'}}}
+ --- -- error('arg1: expected string|table, got number')
--- ```
---
- ---@param opt table Names of parameters to validate. Each key is a parameter
+ ---@param opt table<vim.validate.Type,vim.validate.Spec> (table) Names of parameters to validate. Each key is a parameter
--- name; each value is a tuple in one of these forms:
--- 1. (arg_value, type_name, optional)
--- - arg_value: argument value
@@ -878,7 +935,7 @@ end
--- a.b.c = 1
--- ```
---
----@param createfn function?(key:any):any Provides the value for a missing `key`.
+---@param createfn? fun(key:any):any Provides the value for a missing `key`.
---@return table # Empty table with `__index` metamethod.
function vim.defaulttable(createfn)
createfn = createfn or function(_)
@@ -898,6 +955,7 @@ do
---@field private _idx_read integer
---@field private _idx_write integer
---@field private _size integer
+ ---@overload fun(self): table?
local Ringbuf = {}
--- Clear all items
@@ -946,19 +1004,19 @@ do
--- Once the buffer is full, adding a new entry overrides the oldest entry.
---
--- ```lua
- --- local ringbuf = vim.ringbuf(4)
- --- ringbuf:push("a")
- --- ringbuf:push("b")
- --- ringbuf:push("c")
- --- ringbuf:push("d")
- --- ringbuf:push("e") -- overrides "a"
- --- print(ringbuf:pop()) -- returns "b"
- --- print(ringbuf:pop()) -- returns "c"
+ --- local ringbuf = vim.ringbuf(4)
+ --- ringbuf:push("a")
+ --- ringbuf:push("b")
+ --- ringbuf:push("c")
+ --- ringbuf:push("d")
+ --- ringbuf:push("e") -- overrides "a"
+ --- print(ringbuf:pop()) -- returns "b"
+ --- print(ringbuf:pop()) -- returns "c"
---
- --- -- Can be used as iterator. Pops remaining items:
- --- for val in ringbuf do
- --- print(val)
- --- end
+ --- -- Can be used as iterator. Pops remaining items:
+ --- for val in ringbuf do
+ --- print(val)
+ --- end
--- ```
---
--- Returns a Ringbuf instance with the following methods:
@@ -969,7 +1027,7 @@ do
--- - |Ringbuf:clear()|
---
---@param size integer
- ---@return vim.Ringbuf ringbuf (table)
+ ---@return vim.Ringbuf ringbuf
function vim.ringbuf(size)
local ringbuf = {
_items = {},
@@ -986,4 +1044,24 @@ do
end
end
+--- @private
+--- @generic T
+--- @param root string
+--- @param mod T
+--- @return T
+function vim._defer_require(root, mod)
+ return setmetatable({}, {
+ ---@param t table<string, any>
+ ---@param k string
+ __index = function(t, k)
+ if not mod[k] then
+ return
+ end
+ local name = string.format('%s.%s', root, k)
+ t[k] = require(name)
+ return t[k]
+ end,
+ })
+end
+
return vim
diff --git a/runtime/lua/vim/snippet.lua b/runtime/lua/vim/snippet.lua
index 32a8ea0b0d..5e60efa778 100644
--- a/runtime/lua/vim/snippet.lua
+++ b/runtime/lua/vim/snippet.lua
@@ -1,6 +1,7 @@
-local G = require('vim.lsp._snippet_grammar')
+local G = vim.lsp._snippet_grammar
local snippet_group = vim.api.nvim_create_augroup('vim/snippet', {})
local snippet_ns = vim.api.nvim_create_namespace('vim/snippet')
+local hl_group = 'SnippetTabstop'
--- Returns the 0-based cursor position.
---
@@ -42,9 +43,7 @@ local function resolve_variable(var, default)
elseif var == 'TM_FILENAME' then
return expand_or_default('%:t')
elseif var == 'TM_FILENAME_BASE' then
- -- Not using '%:t:r' since we want to remove all extensions.
- local filename_base = expand_or_default('%:t'):gsub('%.[^%.]*$', '')
- return filename_base
+ return expand_or_default('%:t:r')
elseif var == 'TM_DIRECTORY' then
return expand_or_default('%:p:h:t')
elseif var == 'TM_FILEPATH' then
@@ -102,7 +101,7 @@ local function get_extmark_range(bufnr, extmark_id)
return { mark[1], mark[2], mark[3].end_row, mark[3].end_col }
end
---- @class vim.snippet.Tabstop
+--- @class (private) vim.snippet.Tabstop
--- @field extmark_id integer
--- @field bufnr integer
--- @field index integer
@@ -119,11 +118,11 @@ local Tabstop = {}
--- @return vim.snippet.Tabstop
function Tabstop.new(index, bufnr, range, choices)
local extmark_id = vim.api.nvim_buf_set_extmark(bufnr, snippet_ns, range[1], range[2], {
- right_gravity = false,
+ right_gravity = true,
end_right_gravity = true,
end_line = range[3],
end_col = range[4],
- hl_group = 'SnippetTabstop',
+ hl_group = hl_group,
})
local self = setmetatable(
@@ -163,7 +162,22 @@ function Tabstop:set_text(text)
vim.api.nvim_buf_set_text(self.bufnr, range[1], range[2], range[3], range[4], text_to_lines(text))
end
---- @class vim.snippet.Session
+--- Sets the right gravity of the tabstop's extmark.
+---
+--- @package
+--- @param right_gravity boolean
+function Tabstop:set_right_gravity(right_gravity)
+ local range = self:get_range()
+ self.extmark_id = vim.api.nvim_buf_set_extmark(self.bufnr, snippet_ns, range[1], range[2], {
+ right_gravity = right_gravity,
+ end_right_gravity = true,
+ end_line = range[3],
+ end_col = range[4],
+ hl_group = hl_group,
+ })
+end
+
+--- @class (private) vim.snippet.Session
--- @field bufnr integer
--- @field extmark_id integer
--- @field tabstops table<integer, vim.snippet.Tabstop[]>
@@ -220,8 +234,17 @@ function Session:get_dest_index(direction)
end
end
---- @class vim.snippet.Snippet
---- @field private _session? vim.snippet.Session
+--- Sets the right gravity of the tabstop group with the given index.
+---
+--- @package
+--- @param index integer
+--- @param right_gravity boolean
+function Session:set_group_gravity(index, right_gravity)
+ for _, tabstop in ipairs(self.tabstops[index]) do
+ tabstop:set_right_gravity(right_gravity)
+ end
+end
+
local M = { session = nil }
--- Displays the choices for the given tabstop as completion items.
@@ -562,9 +585,15 @@ function M.jump(direction)
-- Clear the autocommands so that we can move the cursor freely while selecting the tabstop.
vim.api.nvim_clear_autocmds({ group = snippet_group, buffer = M._session.bufnr })
+ -- Deactivate expansion of the current tabstop.
+ M._session:set_group_gravity(M._session.current_tabstop.index, true)
+
M._session.current_tabstop = dest
select_tabstop(dest)
+ -- Activate expansion of the destination tabstop.
+ M._session:set_group_gravity(dest.index, false)
+
-- Restore the autocommands.
setup_autocmds(M._session.bufnr)
end
diff --git a/runtime/lua/vim/termcap.lua b/runtime/lua/vim/termcap.lua
index 862cc52149..ec29acca48 100644
--- a/runtime/lua/vim/termcap.lua
+++ b/runtime/lua/vim/termcap.lua
@@ -12,7 +12,10 @@ local M = {}
--- emulator supports the XTGETTCAP sequence.
---
--- @param caps string|table A terminal capability or list of capabilities to query
---- @param cb function(cap:string, seq:string) Function to call when a response is received
+--- @param cb function(cap:string, found:bool, seq:string?) Callback function which is called for
+--- each capability in {caps}. {found} is set to true if the capability was found or false
+--- otherwise. {seq} is the control sequence for the capability if found, or nil for
+--- boolean capabilities.
function M.query(caps, cb)
vim.validate({
caps = { caps, { 'string', 'table' } },
@@ -23,21 +26,40 @@ function M.query(caps, cb)
caps = { caps }
end
- local count = #caps
+ local pending = {} ---@type table<string, boolean>
+ for _, v in ipairs(caps) do
+ pending[v] = true
+ end
+
+ local timer = assert(vim.uv.new_timer())
- vim.api.nvim_create_autocmd('TermResponse', {
+ local id = vim.api.nvim_create_autocmd('TermResponse', {
+ nested = true,
callback = function(args)
local resp = args.data ---@type string
- local k, v = resp:match('^\027P1%+r(%x+)=(%x+)$')
- if k and v then
+ local k, rest = resp:match('^\027P1%+r(%x+)(.*)$')
+ if k and rest then
local cap = vim.text.hexdecode(k)
- local seq =
- vim.text.hexdecode(v):gsub('\\E', '\027'):gsub('%%p%d', ''):gsub('\\(%d+)', string.char)
+ if not pending[cap] then
+ -- Received a response for a capability we didn't request. This can happen if there are
+ -- multiple concurrent XTGETTCAP requests
+ return
+ end
+
+ local seq ---@type string?
+ if rest:match('^=%x+$') then
+ seq = vim.text
+ .hexdecode(rest:sub(2))
+ :gsub('\\E', '\027')
+ :gsub('%%p%d', '')
+ :gsub('\\(%d+)', string.char)
+ end
- cb(cap, seq)
+ cb(cap, true, seq)
- count = count - 1
- if count == 0 then
+ pending[cap] = nil
+
+ if next(pending) == nil then
return true
end
end
@@ -57,6 +79,23 @@ function M.query(caps, cb)
end
io.stdout:write(query)
+
+ timer:start(1000, 0, function()
+ -- Delete the autocommand if no response was received
+ vim.schedule(function()
+ -- Suppress error if autocommand has already been deleted
+ pcall(vim.api.nvim_del_autocmd, id)
+
+ -- Call the callback for all capabilities that were not found
+ for k in pairs(pending) do
+ cb(k, false, nil)
+ end
+ end)
+
+ if not timer:is_closing() then
+ timer:close()
+ end
+ end)
end
return M
diff --git a/runtime/lua/vim/text.lua b/runtime/lua/vim/text.lua
index cfb0f9b821..576b962838 100644
--- a/runtime/lua/vim/text.lua
+++ b/runtime/lua/vim/text.lua
@@ -1,4 +1,4 @@
---- Text processing functions.
+-- Text processing functions.
local M = {}
diff --git a/runtime/lua/vim/treesitter.lua b/runtime/lua/vim/treesitter.lua
index e7a66c00b2..a09619f369 100644
--- a/runtime/lua/vim/treesitter.lua
+++ b/runtime/lua/vim/treesitter.lua
@@ -1,44 +1,21 @@
local api = vim.api
-local LanguageTree = require('vim.treesitter.languagetree')
-local Range = require('vim.treesitter._range')
----@type table<integer,LanguageTree>
+---@type table<integer,vim.treesitter.LanguageTree>
local parsers = setmetatable({}, { __mode = 'v' })
----@class TreesitterModule
----@field highlighter TSHighlighter
----@field query TSQueryModule
----@field language TSLanguageModule
-local M = setmetatable({}, {
- __index = function(t, k)
- ---@diagnostic disable:no-unknown
- if k == 'highlighter' then
- t[k] = require('vim.treesitter.highlighter')
- return t[k]
- elseif k == 'language' then
- t[k] = require('vim.treesitter.language')
- return t[k]
- elseif k == 'query' then
- t[k] = require('vim.treesitter.query')
- return t[k]
- end
-
- local query = require('vim.treesitter.query')
- if query[k] then
- vim.deprecate('vim.treesitter.' .. k .. '()', 'vim.treesitter.query.' .. k .. '()', '0.10')
- t[k] = query[k]
- return t[k]
- end
-
- local language = require('vim.treesitter.language')
- if language[k] then
- vim.deprecate('vim.treesitter.' .. k .. '()', 'vim.treesitter.language.' .. k .. '()', '0.10')
- t[k] = language[k]
- return t[k]
- end
- end,
+local M = vim._defer_require('vim.treesitter', {
+ _fold = ..., --- @module 'vim.treesitter._fold'
+ _query_linter = ..., --- @module 'vim.treesitter._query_linter'
+ _range = ..., --- @module 'vim.treesitter._range'
+ dev = ..., --- @module 'vim.treesitter.dev'
+ highlighter = ..., --- @module 'vim.treesitter.highlighter'
+ language = ..., --- @module 'vim.treesitter.language'
+ languagetree = ..., --- @module 'vim.treesitter.languagetree'
+ query = ..., --- @module 'vim.treesitter.query'
})
+local LanguageTree = M.languagetree
+
--- @nodoc
M.language_version = vim._ts_get_language_version()
@@ -53,7 +30,7 @@ M.minimum_language_version = vim._ts_get_minimum_language_version()
---@param lang string Language of the parser
---@param opts (table|nil) Options to pass to the created language tree
---
----@return LanguageTree object to use for parsing
+---@return vim.treesitter.LanguageTree object to use for parsing
function M._create_parser(bufnr, lang, opts)
if bufnr == 0 then
bufnr = vim.api.nvim_get_current_buf()
@@ -100,10 +77,10 @@ end
--- 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) Filetype of this parser (default: buffer filetype)
+---@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 LanguageTree object to use for parsing
+---@return vim.treesitter.LanguageTree object to use for parsing
function M.get_parser(bufnr, lang, opts)
opts = opts or {}
@@ -142,7 +119,7 @@ end
---@param lang string Language of this string
---@param opts (table|nil) Options to pass to the created language tree
---
----@return LanguageTree object to use for parsing
+---@return vim.treesitter.LanguageTree object to use for parsing
function M.get_string_parser(str, lang, opts)
vim.validate({
str = { str, 'string' },
@@ -195,12 +172,12 @@ end
---to get the range with directives applied.
---@param node TSNode
---@param source integer|string|nil Buffer or string from which the {node} is extracted
----@param metadata TSMetadata|nil
+---@param metadata vim.treesitter.query.TSMetadata|nil
---@return Range6
function M.get_range(node, source, metadata)
if metadata and metadata.range then
assert(source)
- return Range.add_bytes(source, metadata.range)
+ return M._range.add_bytes(source, metadata.range)
end
return { node:range(true) }
end
@@ -209,7 +186,7 @@ end
---@param range Range
---@returns string
local function buf_range_get_text(buf, range)
- local start_row, start_col, end_row, end_col = Range.unpack4(range)
+ local start_row, start_col, end_row, end_col = M._range.unpack4(range)
if end_col == 0 then
if start_row == end_row then
start_col = -1
@@ -237,7 +214,7 @@ function M.get_node_text(node, source, opts)
if metadata.text then
return metadata.text
elseif type(source) == 'number' then
- local range = vim.treesitter.get_range(node, source, metadata)
+ local range = M.get_range(node, source, metadata)
return buf_range_get_text(source, range)
end
@@ -266,9 +243,9 @@ function M.node_contains(node, range)
vim.validate({
-- allow a table so nodes can be mocked
node = { node, { 'userdata', 'table' } },
- range = { range, Range.validate, 'integer list with 4 or 6 elements' },
+ range = { range, M._range.validate, 'integer list with 4 or 6 elements' },
})
- return Range.contains({ node:range() }, range)
+ return M._range.contains({ node:range() }, range)
end
--- Returns a list of highlight captures at the given position
@@ -317,6 +294,7 @@ function M.get_captures_at_pos(bufnr, row, col)
for capture, node, metadata in iter do
if M.is_in_node_range(node, row, col) then
+ ---@diagnostic disable-next-line: invisible
local c = q._query.captures[capture] -- name of the capture in the query
if c ~= nil then
table.insert(matches, { capture = c, metadata = metadata, lang = tree:lang() })
@@ -348,6 +326,23 @@ function M.get_captures_at_cursor(winnr)
return captures
end
+--- Optional keyword arguments:
+--- @class vim.treesitter.get_node.Opts
+--- @inlinedoc
+---
+--- Buffer number (nil or 0 for current buffer)
+--- @field bufnr integer?
+---
+--- 0-indexed (row, col) tuple. Defaults to cursor position in the
+--- current window. Required if {bufnr} is not the current buffer
+--- @field pos { [1]: integer, [2]: integer }?
+---
+--- Parser language. (default: from buffer filetype)
+--- @field lang string?
+---
+--- Ignore injected languages (default true)
+--- @field ignore_injections boolean?
+
--- Returns the smallest named node at the given position
---
--- NOTE: Calling this on an unparsed tree can yield an invalid node.
@@ -358,11 +353,7 @@ end
--- vim.treesitter.get_parser(bufnr):parse(range)
--- ```
---
----@param opts table|nil Optional keyword arguments:
---- - bufnr integer|nil Buffer number (nil or 0 for current buffer)
---- - pos table|nil 0-indexed (row, col) tuple. Defaults to cursor position in the
---- current window. Required if {bufnr} is not the current buffer
---- - ignore_injections boolean Ignore injected languages (default true)
+---@param opts vim.treesitter.get_node.Opts?
---
---@return TSNode | nil Node at the given position
function M.get_node(opts)
@@ -374,7 +365,7 @@ function M.get_node(opts)
bufnr = api.nvim_get_current_buf()
end
- local row, col
+ local row, col --- @type integer, integer
if opts.pos then
assert(#opts.pos == 2, 'Position must be a (row, col) tuple')
row, col = opts.pos[1], opts.pos[2]
@@ -392,34 +383,6 @@ function M.get_node(opts)
local ts_range = { row, col, row, col }
- local root_lang_tree = M.get_parser(bufnr)
- if not root_lang_tree then
- return
- end
-
- return root_lang_tree:named_node_for_range(ts_range, opts)
-end
-
---- Returns the smallest named node at the given position
----
----@param bufnr integer Buffer number (0 for current buffer)
----@param row integer Position row
----@param col integer Position column
----@param opts table Optional keyword arguments:
---- - lang string|nil Parser language
---- - ignore_injections boolean Ignore injected languages (default true)
----
----@return TSNode | nil Node at the given position
----@deprecated
-function M.get_node_at_pos(bufnr, row, col, opts)
- vim.deprecate('vim.treesitter.get_node_at_pos()', 'vim.treesitter.get_node()', '0.10')
- if bufnr == 0 then
- bufnr = api.nvim_get_current_buf()
- end
- local ts_range = { row, col, row, col }
-
- opts = opts or {}
-
local root_lang_tree = M.get_parser(bufnr, opts.lang)
if not root_lang_tree then
return
@@ -428,26 +391,12 @@ function M.get_node_at_pos(bufnr, row, col, opts)
return root_lang_tree:named_node_for_range(ts_range, opts)
end
---- Returns the smallest named node under the cursor
----
----@param winnr (integer|nil) Window handle or 0 for current window (default)
----
----@return string Name of node under the cursor
----@deprecated
-function M.get_node_at_cursor(winnr)
- vim.deprecate('vim.treesitter.get_node_at_cursor()', 'vim.treesitter.get_node():type()', '0.10')
- winnr = winnr or 0
- local bufnr = api.nvim_win_get_buf(winnr)
-
- return M.get_node({ bufnr = bufnr, ignore_injections = false }):type()
-end
-
--- Starts treesitter highlighting for a buffer
---
--- Can be used in an ftplugin or FileType autocommand.
---
--- Note: By default, disables regex syntax highlighting, which may be required for some plugins.
---- In this case, add ``vim.bo.syntax = 'on'`` after the call to `start`.
+--- In this case, add `vim.bo.syntax = 'on'` after the call to `start`.
---
--- Example:
---
@@ -461,7 +410,7 @@ end
--- ```
---
---@param bufnr (integer|nil) Buffer to be highlighted (default: current buffer)
----@param lang (string|nil) Language of the parser (default: buffer filetype)
+---@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)
@@ -483,13 +432,14 @@ end
---
--- While in the window, press "a" to toggle display of anonymous nodes, "I" to toggle the
--- display of the source language of each node, "o" to toggle the query editor, and press
---- <Enter> to jump to the node under the cursor in the source buffer.
+--- [<Enter>] to jump to the node under the cursor in the source buffer. Folding also works
+--- (try |zo|, |zc|, etc.).
---
---- Can also be shown with `:InspectTree`. *:InspectTree*
+--- Can also be shown with `:InspectTree`. [:InspectTree]()
---
---@param opts table|nil Optional options table with the following possible keys:
---- - lang (string|nil): The language of the source buffer. If omitted, the
---- filetype of the source buffer is used.
+--- - lang (string|nil): The language of the source buffer. If omitted, detect
+--- from the filetype of the source buffer.
--- - bufnr (integer|nil): Buffer to draw the tree into. If omitted, a new
--- buffer is created.
--- - winid (integer|nil): Window id to display the tree buffer in. If omitted,
@@ -501,7 +451,7 @@ end
--- argument and should return a string.
function M.inspect_tree(opts)
---@diagnostic disable-next-line: invisible
- require('vim.treesitter.dev').inspect_tree(opts)
+ M.dev.inspect_tree(opts)
end
--- Returns the fold level for {lnum} in the current buffer. Can be set directly to 'foldexpr':
@@ -513,19 +463,7 @@ end
---@param lnum integer|nil Line number to calculate fold level for
---@return string
function M.foldexpr(lnum)
- return require('vim.treesitter._fold').foldexpr(lnum)
-end
-
---- Returns the highlighted content of the first line of the fold or falls back to |foldtext()|
---- if no treesitter parser is found. Can be set directly to 'foldtext':
----
---- ```lua
---- vim.wo.foldtext = 'v:lua.vim.treesitter.foldtext()'
---- ```
----
----@return { [1]: string, [2]: string[] }[] | string
-function M.foldtext()
- return require('vim.treesitter._fold').foldtext()
+ return M._fold.foldexpr(lnum)
end
return M
diff --git a/runtime/lua/vim/treesitter/_fold.lua b/runtime/lua/vim/treesitter/_fold.lua
index 5c1cc06908..d96cc966de 100644
--- a/runtime/lua/vim/treesitter/_fold.lua
+++ b/runtime/lua/vim/treesitter/_fold.lua
@@ -5,35 +5,20 @@ local Range = require('vim.treesitter._range')
local api = vim.api
---@class TS.FoldInfo
----@field levels table<integer,string>
----@field levels0 table<integer,integer>
----@field private start_counts table<integer,integer>
----@field private stop_counts table<integer,integer>
+---@field levels string[] the foldexpr result for each line
+---@field levels0 integer[] the raw fold levels
+---@field edits? {[1]: integer, [2]: integer} line range edited since the last invocation of the callback scheduled in on_bytes. 0-indexed, end-exclusive.
local FoldInfo = {}
FoldInfo.__index = FoldInfo
---@private
function FoldInfo.new()
return setmetatable({
- start_counts = {},
- stop_counts = {},
levels0 = {},
levels = {},
}, FoldInfo)
end
----@package
----@param srow integer
----@param erow integer
-function FoldInfo:invalidate_range(srow, erow)
- for i = srow, erow do
- self.start_counts[i + 1] = nil
- self.stop_counts[i + 1] = nil
- self.levels0[i + 1] = nil
- self.levels[i + 1] = nil
- end
-end
-
--- Efficiently remove items from middle of a list a list.
---
--- Calling table.remove() in a loop will re-index the tail of the table on
@@ -55,12 +40,10 @@ end
---@package
---@param srow integer
----@param erow integer
+---@param erow integer 0-indexed, exclusive
function FoldInfo:remove_range(srow, erow)
list_remove(self.levels, srow + 1, erow)
list_remove(self.levels0, srow + 1, erow)
- list_remove(self.start_counts, srow + 1, erow)
- list_remove(self.stop_counts, srow + 1, erow)
end
--- Efficiently insert items into the middle of a list.
@@ -91,46 +74,37 @@ end
---@package
---@param srow integer
----@param erow integer
+---@param erow integer 0-indexed, exclusive
function FoldInfo:add_range(srow, erow)
- list_insert(self.levels, srow + 1, erow, '-1')
+ list_insert(self.levels, srow + 1, erow, '=')
list_insert(self.levels0, srow + 1, erow, -1)
- list_insert(self.start_counts, srow + 1, erow, nil)
- list_insert(self.stop_counts, srow + 1, erow, nil)
end
---@package
----@param lnum integer
-function FoldInfo:add_start(lnum)
- self.start_counts[lnum] = (self.start_counts[lnum] or 0) + 1
-end
-
----@package
----@param lnum integer
-function FoldInfo:add_stop(lnum)
- self.stop_counts[lnum] = (self.stop_counts[lnum] or 0) + 1
-end
-
----@package
----@param lnum integer
----@return integer
-function FoldInfo:get_start(lnum)
- return self.start_counts[lnum] or 0
+---@param srow integer
+---@param erow_old integer
+---@param erow_new integer 0-indexed, exclusive
+function FoldInfo:edit_range(srow, erow_old, erow_new)
+ if self.edits then
+ self.edits[1] = math.min(srow, self.edits[1])
+ if erow_old <= self.edits[2] then
+ self.edits[2] = self.edits[2] + (erow_new - erow_old)
+ end
+ self.edits[2] = math.max(self.edits[2], erow_new)
+ else
+ self.edits = { srow, erow_new }
+ end
end
---@package
----@param lnum integer
----@return integer
-function FoldInfo:get_stop(lnum)
- return self.stop_counts[lnum] or 0
-end
-
-local function trim_level(level)
- local max_fold_level = vim.wo.foldnestmax
- if level > max_fold_level then
- return max_fold_level
+---@return integer? srow
+---@return integer? erow 0-indexed, exclusive
+function FoldInfo:flush_edit()
+ if self.edits then
+ local srow, erow = self.edits[1], self.edits[2]
+ self.edits = nil
+ return srow, erow
end
- return level
end
--- If a parser doesn't have any ranges explicitly set, treesitter will
@@ -140,10 +114,10 @@ end
--- TODO(lewis6991): Handle this generally
---
--- @param bufnr integer
---- @param erow integer?
+--- @param erow integer? 0-indexed, exclusive
--- @return integer
local function normalise_erow(bufnr, erow)
- local max_erow = api.nvim_buf_line_count(bufnr) - 1
+ local max_erow = api.nvim_buf_line_count(bufnr)
return math.min(erow or max_erow, max_erow)
end
@@ -152,31 +126,30 @@ end
---@param bufnr integer
---@param info TS.FoldInfo
---@param srow integer?
----@param erow integer?
+---@param erow integer? 0-indexed, exclusive
---@param parse_injections? boolean
local function get_folds_levels(bufnr, info, srow, erow, parse_injections)
srow = srow or 0
erow = normalise_erow(bufnr, erow)
- info:invalidate_range(srow, erow)
-
- local prev_start = -1
- local prev_stop = -1
-
local parser = ts.get_parser(bufnr)
parser:parse(parse_injections and { srow, erow } or nil)
+ local enter_counts = {} ---@type table<integer, integer>
+ local leave_counts = {} ---@type table<integer, integer>
+ local prev_start = -1
+ local prev_stop = -1
+
parser:for_each_tree(function(tree, ltree)
local query = ts.query.get(ltree:lang(), 'folds')
if not query then
return
end
- -- erow in query is end-exclusive
- local q_erow = erow and erow + 1 or -1
-
- for id, node, metadata in query:iter_captures(tree:root(), bufnr, srow, q_erow) do
+ -- 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 id, node, metadata in query:iter_captures(tree:root(), bufnr, math.max(srow - 1, 0), erow) do
if query.captures[id] == 'fold' then
local range = ts.get_range(node, bufnr, metadata[id])
local start, _, stop, stop_col = Range.unpack4(range)
@@ -193,8 +166,8 @@ local function get_folds_levels(bufnr, info, srow, erow, parse_injections)
if
fold_length > vim.wo.foldminlines and not (start == prev_start and stop == prev_stop)
then
- info:add_start(start + 1)
- info:add_stop(stop + 1)
+ enter_counts[start + 1] = (enter_counts[start + 1] or 0) + 1
+ leave_counts[stop + 1] = (leave_counts[stop + 1] or 0) + 1
prev_start = start
prev_stop = stop
end
@@ -202,16 +175,15 @@ local function get_folds_levels(bufnr, info, srow, erow, parse_injections)
end
end)
- local current_level = info.levels0[srow] or 0
+ local nestmax = vim.wo.foldnestmax
+ local level0_prev = info.levels0[srow] or 0
+ local leave_prev = leave_counts[srow] or 0
-- We now have the list of fold opening and closing, fill the gaps and mark where fold start
- for lnum = srow + 1, erow + 1 do
- local last_trimmed_level = trim_level(current_level)
- current_level = current_level + info:get_start(lnum)
- info.levels0[lnum] = current_level
-
- local trimmed_level = trim_level(current_level)
- current_level = current_level - info:get_stop(lnum)
+ for lnum = srow + 1, erow do
+ local enter_line = enter_counts[lnum] or 0
+ local leave_line = leave_counts[lnum] or 0
+ local level0 = level0_prev - leave_prev + enter_line
-- Determine if it's the start/end of a fold
-- NB: vim's fold-expr interface does not have a mechanism to indicate that
@@ -219,14 +191,36 @@ local function get_folds_levels(bufnr, info, srow, erow, parse_injections)
-- ( \n ( \n )) \n (( \n ) \n )
-- versus
-- ( \n ( \n ) \n ( \n ) \n )
- -- If it did have such a mechanism, (trimmed_level - last_trimmed_level)
+ -- Both are represented by ['>1', '>2', '2', '>2', '2', '1'], and
+ -- vim interprets as the second case.
+ -- If it did have such a mechanism, (clamped - clamped_prev)
-- would be the correct number of starts to pass on.
+ local adjusted = level0 ---@type integer
local prefix = ''
- if trimmed_level - last_trimmed_level > 0 then
+ if enter_line > 0 then
prefix = '>'
+ if leave_line > 0 then
+ -- If this line ends a fold f1 and starts a fold f2, then move f1's end to the previous line
+ -- so that f2 gets the correct level on this line. This may reduce the size of f1 below
+ -- foldminlines, but we don't handle it for simplicity.
+ adjusted = level0 - leave_line
+ leave_line = 0
+ end
+ end
+
+ -- Clamp at foldnestmax.
+ local clamped = adjusted
+ if adjusted > nestmax then
+ prefix = ''
+ clamped = nestmax
end
- info.levels[lnum] = prefix .. tostring(trimmed_level)
+ -- Record the "real" level, so that it can be used as "base" of later get_folds_levels().
+ info.levels0[lnum] = adjusted
+ info.levels[lnum] = prefix .. tostring(clamped)
+
+ leave_prev = leave_line
+ level0_prev = adjusted
end
end
@@ -296,8 +290,12 @@ end
local function on_changedtree(bufnr, foldinfo, tree_changes)
schedule_if_loaded(bufnr, function()
for _, change in ipairs(tree_changes) do
- local srow, _, erow = Range.unpack4(change)
- get_folds_levels(bufnr, foldinfo, srow, erow)
+ local srow, _, erow, ecol = Range.unpack4(change)
+ if ecol > 0 then
+ erow = erow + 1
+ end
+ -- Start from `srow - foldminlines`, because this edit may have shrunken the fold below limit.
+ get_folds_levels(bufnr, foldinfo, math.max(srow - vim.wo.foldminlines, 0), erow)
end
if #tree_changes > 0 then
foldupdate(bufnr)
@@ -309,19 +307,46 @@ end
---@param foldinfo TS.FoldInfo
---@param start_row integer
---@param old_row integer
+---@param old_col integer
---@param new_row integer
-local function on_bytes(bufnr, foldinfo, start_row, old_row, new_row)
- local end_row_old = start_row + old_row
- local end_row_new = start_row + new_row
+---@param new_col integer
+local function on_bytes(bufnr, foldinfo, start_row, start_col, old_row, old_col, new_row, new_col)
+ -- extend the end to fully include the range
+ local end_row_old = start_row + old_row + 1
+ local end_row_new = start_row + new_row + 1
if new_row ~= old_row then
+ -- foldexpr can be evaluated before the scheduled callback is invoked. So it may observe the
+ -- outdated levels, which may spuriously open the folds that didn't change. So we should shift
+ -- folds as accurately as possible. For this to be perfectly accurate, we should track the
+ -- actual TSNodes that account for each fold, and compare the node's range with the edited
+ -- range. But for simplicity, we just check whether the start row is completely removed (e.g.,
+ -- `dd`) or shifted (e.g., `o`).
if new_row < old_row then
- foldinfo:remove_range(end_row_new, end_row_old)
+ if start_col == 0 and new_row == 0 and new_col == 0 then
+ foldinfo:remove_range(start_row, start_row + (end_row_old - end_row_new))
+ else
+ foldinfo:remove_range(end_row_new, end_row_old)
+ end
else
- foldinfo:add_range(start_row, end_row_new)
+ if start_col == 0 and old_row == 0 and old_col == 0 then
+ foldinfo:add_range(start_row, start_row + (end_row_new - end_row_old))
+ else
+ foldinfo:add_range(end_row_old, end_row_new)
+ end
end
+ foldinfo:edit_range(start_row, end_row_old, end_row_new)
+
+ -- This callback must not use on_bytes arguments, because they can be outdated when the callback
+ -- is invoked. For example, `J` with non-zero count triggers multiple on_bytes before executing
+ -- the scheduled callback. So we should collect the edits.
schedule_if_loaded(bufnr, function()
- get_folds_levels(bufnr, foldinfo, start_row, end_row_new)
+ local srow, erow = foldinfo:flush_edit()
+ if not srow then
+ return
+ end
+ -- Start from `srow - foldminlines`, because this edit may have shrunken the fold below limit.
+ get_folds_levels(bufnr, foldinfo, math.max(srow - vim.wo.foldminlines, 0), erow)
foldupdate(bufnr)
end)
end
@@ -348,8 +373,8 @@ function M.foldexpr(lnum)
on_changedtree(bufnr, foldinfos[bufnr], tree_changes)
end,
- on_bytes = function(_, _, start_row, _, _, old_row, _, _, new_row, _, _)
- on_bytes(bufnr, foldinfos[bufnr], start_row, old_row, new_row)
+ on_bytes = function(_, _, start_row, start_col, _, old_row, old_col, _, new_row, new_col, _)
+ on_bytes(bufnr, foldinfos[bufnr], start_row, start_col, old_row, old_col, new_row, new_col)
end,
on_detach = function()
@@ -361,96 +386,15 @@ function M.foldexpr(lnum)
return foldinfos[bufnr].levels[lnum] or '0'
end
----@package
----@return { [1]: string, [2]: string[] }[]|string
-function M.foldtext()
- local foldstart = vim.v.foldstart
- local bufnr = api.nvim_get_current_buf()
-
- ---@type boolean, LanguageTree
- local ok, parser = pcall(ts.get_parser, bufnr)
- if not ok then
- return vim.fn.foldtext()
- end
-
- local query = ts.query.get(parser:lang(), 'highlights')
- if not query then
- return vim.fn.foldtext()
- end
-
- local tree = parser:parse({ foldstart - 1, foldstart })[1]
-
- local line = api.nvim_buf_get_lines(bufnr, foldstart - 1, foldstart, false)[1]
- if not line then
- return vim.fn.foldtext()
- end
-
- ---@type { [1]: string, [2]: string[], range: { [1]: integer, [2]: integer } }[] | { [1]: string, [2]: string[] }[]
- local result = {}
-
- local line_pos = 0
-
- for id, node, metadata in query:iter_captures(tree:root(), 0, foldstart - 1, foldstart) do
- local name = query.captures[id]
- local start_row, start_col, end_row, end_col = node:range()
-
- local priority = tonumber(metadata.priority or vim.highlight.priorities.treesitter)
-
- if start_row == foldstart - 1 and end_row == foldstart - 1 then
- -- check for characters ignored by treesitter
- if start_col > line_pos then
- table.insert(result, {
- line:sub(line_pos + 1, start_col),
- {},
- range = { line_pos, start_col },
- })
- end
- line_pos = end_col
-
- local text = line:sub(start_col + 1, end_col)
- table.insert(result, { text, { { '@' .. name, priority } }, range = { start_col, end_col } })
- end
- end
-
- local i = 1
- while i <= #result do
- -- find first capture that is not in current range and apply highlights on the way
- local j = i + 1
- while
- j <= #result
- and result[j].range[1] >= result[i].range[1]
- and result[j].range[2] <= result[i].range[2]
- do
- for k, v in ipairs(result[i][2]) do
- if not vim.tbl_contains(result[j][2], v) then
- table.insert(result[j][2], k, v)
- end
- end
- j = j + 1
- end
-
- -- remove the parent capture if it is split into children
- if j > i + 1 then
- table.remove(result, i)
- else
- -- highlights need to be sorted by priority, on equal prio, the deeper nested capture (earlier
- -- in list) should be considered higher prio
- if #result[i][2] > 1 then
- table.sort(result[i][2], function(a, b)
- return a[2] < b[2]
- end)
- end
-
- result[i][2] = vim.tbl_map(function(tbl)
- return tbl[1]
- end, result[i][2])
- result[i] = { result[i][1], result[i][2] }
-
- i = i + 1
+api.nvim_create_autocmd('OptionSet', {
+ pattern = { 'foldminlines', 'foldnestmax' },
+ desc = 'Refresh treesitter folds',
+ callback = function()
+ for _, bufnr in ipairs(vim.tbl_keys(foldinfos)) do
+ foldinfos[bufnr] = FoldInfo.new()
+ get_folds_levels(bufnr, foldinfos[bufnr])
+ foldupdate(bufnr)
end
- end
-
- return result
-end
-
+ end,
+})
return M
diff --git a/runtime/lua/vim/treesitter/_meta.lua b/runtime/lua/vim/treesitter/_meta.lua
index 80c998b555..19d97d2820 100644
--- a/runtime/lua/vim/treesitter/_meta.lua
+++ b/runtime/lua/vim/treesitter/_meta.lua
@@ -1,4 +1,5 @@
---@meta
+error('Cannot require a meta file')
---@class TSNode: userdata
---@field id fun(self: TSNode): string
@@ -33,27 +34,26 @@
---@field byte_length fun(self: TSNode): integer
local TSNode = {}
----@param query userdata
+---@param query TSQuery
---@param captures true
---@param start? integer
---@param end_? integer
---@param opts? table
----@return fun(): integer, TSNode, any
+---@return fun(): integer, TSNode, vim.treesitter.query.TSMatch
function TSNode:_rawquery(query, captures, start, end_, opts) end
----@param query userdata
+---@param query TSQuery
---@param captures false
---@param start? integer
---@param end_? integer
---@param opts? table
----@return fun(): string, any
+---@return fun(): integer, vim.treesitter.query.TSMatch
function TSNode:_rawquery(query, captures, start, end_, opts) end
---@alias TSLoggerCallback fun(logtype: 'parse'|'lex', msg: string)
----@class TSParser
----@field parse fun(self: TSParser, tree: TSTree?, source: integer|string, include_bytes: true): TSTree, Range6[]
----@field parse fun(self: TSParser, tree: TSTree?, source: integer|string, include_bytes: false|nil): TSTree, Range4[]
+---@class TSParser: userdata
+---@field parse fun(self: TSParser, tree: TSTree?, source: integer|string, include_bytes: boolean): TSTree, (Range4|Range6)[]
---@field reset fun(self: TSParser)
---@field included_ranges fun(self: TSParser, include_bytes: boolean?): integer[]
---@field set_included_ranges fun(self: TSParser, ranges: (Range6|TSNode)[])
@@ -62,19 +62,31 @@ function TSNode:_rawquery(query, captures, start, end_, opts) end
---@field _set_logger fun(self: TSParser, lex: boolean, parse: boolean, cb: TSLoggerCallback)
---@field _logger fun(self: TSParser): TSLoggerCallback
----@class TSTree
+---@class TSTree: userdata
---@field root fun(self: TSTree): TSNode
---@field edit fun(self: TSTree, _: integer, _: integer, _: integer, _: integer, _: integer, _: integer, _: integer, _: integer, _:integer)
---@field copy fun(self: TSTree): TSTree
---@field included_ranges fun(self: TSTree, include_bytes: true): Range6[]
---@field included_ranges fun(self: TSTree, include_bytes: false): Range4[]
+---@class TSQuery: userdata
+---@field inspect fun(self: TSQuery): TSQueryInfo
+
+---@class (exact) TSQueryInfo
+---@field captures string[]
+---@field patterns table<integer, (integer|string)[][]>
+
---@return integer
vim._ts_get_language_version = function() end
---@return integer
vim._ts_get_minimum_language_version = function() end
+---@param lang string Language to use for the query
+---@param query string Query string in s-expr syntax
+---@return TSQuery
+vim._ts_parse_query = function(lang, query) end
+
---@param lang string
---@return TSParser
vim._create_ts_parser = function(lang) end
diff --git a/runtime/lua/vim/treesitter/_query_linter.lua b/runtime/lua/vim/treesitter/_query_linter.lua
index 87d74789a3..6216d4e891 100644
--- a/runtime/lua/vim/treesitter/_query_linter.lua
+++ b/runtime/lua/vim/treesitter/_query_linter.lua
@@ -17,7 +17,7 @@ local M = {}
--- @field is_first_lang boolean Whether this is the first language of a linter run checking queries for multiple `langs`
--- Adds a diagnostic for node in the query buffer
---- @param diagnostics Diagnostic[]
+--- @param diagnostics vim.Diagnostic[]
--- @param range Range4
--- @param lint string
--- @param lang string?
@@ -45,7 +45,7 @@ local function guess_query_lang(buf)
end
--- @param buf integer
---- @param opts QueryLinterOpts|QueryLinterNormalizedOpts|nil
+--- @param opts vim.treesitter.query.lint.Opts|QueryLinterNormalizedOpts|nil
--- @return QueryLinterNormalizedOpts
local function normalize_opts(buf, opts)
opts = opts or {}
@@ -92,7 +92,7 @@ local function get_error_entry(err, node)
end_col = end_col + #underlined
elseif msg:match('^Invalid') then
-- Use the length of the problematic type/capture/field
- end_col = end_col + #msg:match('"([^"]+)"')
+ end_col = end_col + #(msg:match('"([^"]+)"') or '')
end
return {
@@ -114,7 +114,7 @@ end
--- @return vim.treesitter.ParseError?
local parse = vim.func._memoize(hash_parse, function(node, buf, lang)
local query_text = vim.treesitter.get_node_text(node, buf)
- local ok, err = pcall(vim.treesitter.query.parse, lang, query_text) ---@type boolean|vim.treesitter.ParseError, string|Query
+ local ok, err = pcall(vim.treesitter.query.parse, lang, query_text) ---@type boolean|vim.treesitter.ParseError, string|vim.treesitter.Query
if not ok and type(err) == 'string' then
return get_error_entry(err, node)
@@ -122,28 +122,30 @@ local parse = vim.func._memoize(hash_parse, function(node, buf, lang)
end)
--- @param buf integer
---- @param match table<integer,TSNode>
---- @param query Query
+--- @param match vim.treesitter.query.TSMatch
+--- @param query vim.treesitter.Query
--- @param lang_context QueryLinterLanguageContext
---- @param diagnostics Diagnostic[]
+--- @param diagnostics vim.Diagnostic[]
local function lint_match(buf, match, query, lang_context, diagnostics)
local lang = lang_context.lang
local parser_info = lang_context.parser_info
- for id, node in pairs(match) do
- local cap_id = query.captures[id]
+ for id, nodes in pairs(match) do
+ for _, node in ipairs(nodes) do
+ local cap_id = query.captures[id]
- -- perform language-independent checks only for first lang
- if lang_context.is_first_lang and cap_id == 'error' then
- local node_text = vim.treesitter.get_node_text(node, buf):gsub('\n', ' ')
- add_lint_for_node(diagnostics, { node:range() }, 'Syntax error: ' .. node_text)
- end
+ -- perform language-independent checks only for first lang
+ if lang_context.is_first_lang and cap_id == 'error' then
+ local node_text = vim.treesitter.get_node_text(node, buf):gsub('\n', ' ')
+ add_lint_for_node(diagnostics, { node:range() }, 'Syntax error: ' .. node_text)
+ end
- -- other checks rely on Neovim parser introspection
- if lang and parser_info and cap_id == 'toplevel' then
- local err = parse(node, buf, lang)
- if err then
- add_lint_for_node(diagnostics, err.range, err.msg, lang)
+ -- other checks rely on Neovim parser introspection
+ if lang and parser_info and cap_id == 'toplevel' then
+ local err = parse(node, buf, lang)
+ if err then
+ add_lint_for_node(diagnostics, err.range, err.msg, lang)
+ end
end
end
end
@@ -151,7 +153,7 @@ end
--- @private
--- @param buf integer Buffer to lint
---- @param opts QueryLinterOpts|QueryLinterNormalizedOpts|nil Options for linting
+--- @param opts vim.treesitter.query.lint.Opts|QueryLinterNormalizedOpts|nil Options for linting
function M.lint(buf, opts)
if buf == 0 then
buf = api.nvim_get_current_buf()
@@ -173,7 +175,7 @@ function M.lint(buf, opts)
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) do
+ for _, match, _ in query:iter_matches(tree:root(), buf, 0, -1, { all = true }) do
local lang_context = {
lang = lang,
parser_info = parser_info,
@@ -195,7 +197,7 @@ function M.clear(buf)
end
--- @private
---- @param findstart integer
+--- @param findstart 0|1
--- @param base string
function M.omnifunc(findstart, base)
if findstart == 1 then
diff --git a/runtime/lua/vim/treesitter/dev.lua b/runtime/lua/vim/treesitter/dev.lua
index 69ddc9b558..dc2a14d238 100644
--- a/runtime/lua/vim/treesitter/dev.lua
+++ b/runtime/lua/vim/treesitter/dev.lua
@@ -1,31 +1,29 @@
local api = vim.api
----@class TSDevModule
local M = {}
----@class TSTreeView
+---@class (private) vim.treesitter.dev.TSTreeView
---@field ns integer API namespace
----@field opts table Options table with the following keys:
---- - anon (boolean): If true, display anonymous nodes
---- - lang (boolean): If true, display the language alongside each node
---- - indent (number): Number of spaces to indent nested lines. Default is 2.
----@field nodes TSP.Node[]
----@field named TSP.Node[]
+---@field opts vim.treesitter.dev.TSTreeViewOpts
+---@field nodes vim.treesitter.dev.Node[]
+---@field named vim.treesitter.dev.Node[]
local TSTreeView = {}
----@class TSP.Node
----@field id integer Node id
----@field text string Node text
----@field named boolean True if this is a named (non-anonymous) node
----@field depth integer Depth of the node within the tree
----@field lnum integer Beginning line number of this node in the source buffer
----@field col integer Beginning column number of this node in the source buffer
----@field end_lnum integer Final line number of this node in the source buffer
----@field end_col integer Final column number of this node in the source buffer
+---@private
+---@class (private) vim.treesitter.dev.TSTreeViewOpts
+---@field anon boolean If true, display anonymous nodes.
+---@field lang boolean If true, display the language alongside each node.
+---@field indent number Number of spaces to indent nested lines.
+
+---@class (private) vim.treesitter.dev.Node
+---@field node TSNode Treesitter node
+---@field field string? Node field
+---@field depth integer Depth of this node in the tree
+---@field text string? Text displayed in the inspector for this node. Not computed until the
+--- inspector is drawn.
---@field lang string Source language of this node
----@field root TSNode
----@class TSP.Injection
+---@class (private) vim.treesitter.dev.Injection
---@field lang string Source language of this injection
---@field root TSNode Root node of the injection
@@ -43,48 +41,26 @@ local TSTreeView = {}
---
---@param node TSNode Starting node to begin traversal |tsnode|
---@param depth integer Current recursion depth
+---@param field string|nil The field of the current node
---@param lang string Language of the tree currently being traversed
----@param injections table<string, TSP.Injection> Mapping of node ids to root nodes
+---@param injections table<string, vim.treesitter.dev.Injection> Mapping of node ids to root nodes
--- of injected language trees (see explanation above)
----@param tree TSP.Node[] Output table containing a list of tables each representing a node in the tree
-local function traverse(node, depth, lang, injections, tree)
+---@param tree vim.treesitter.dev.Node[] Output table containing a list of tables each representing a node in the tree
+local function traverse(node, depth, field, lang, injections, tree)
+ table.insert(tree, {
+ node = node,
+ depth = depth,
+ lang = lang,
+ field = field,
+ })
+
local injection = injections[node:id()]
if injection then
- traverse(injection.root, depth, injection.lang, injections, tree)
+ traverse(injection.root, depth + 1, nil, injection.lang, injections, tree)
end
- for child, field in node:iter_children() do
- local type = child:type()
- local lnum, col, end_lnum, end_col = child:range()
- local named = child:named()
- local text ---@type string
- if named then
- if field then
- text = string.format('%s: (%s', field, type)
- else
- text = string.format('(%s', type)
- end
- else
- text = string.format('"%s"', type:gsub('\n', '\\n'):gsub('"', '\\"'))
- end
-
- table.insert(tree, {
- id = child:id(),
- text = text,
- named = named,
- depth = depth,
- lnum = lnum,
- col = col,
- end_lnum = end_lnum,
- end_col = end_col,
- lang = lang,
- })
-
- traverse(child, depth + 1, lang, injections, tree)
-
- if named then
- tree[#tree].text = string.format('%s)', tree[#tree].text)
- end
+ for child, child_field in node:iter_children() do
+ traverse(child, depth + 1, child_field, lang, injections, tree)
end
return tree
@@ -95,44 +71,45 @@ end
---@param bufnr integer Source buffer number
---@param lang string|nil Language of source buffer
---
----@return TSTreeView|nil
+---@return vim.treesitter.dev.TSTreeView|nil
---@return string|nil Error message, if any
---
---@package
function TSTreeView:new(bufnr, lang)
local ok, parser = pcall(vim.treesitter.get_parser, bufnr or 0, lang)
if not ok then
- return nil, 'No parser available for the given buffer'
+ local err = parser --[[ @as string ]]
+ return nil, 'No parser available for the given buffer:\n' .. err
end
-- For each child tree (injected language), find the root of the tree and locate the node within
-- the primary tree that contains that root. Add a mapping from the node in the primary tree to
-- the root in the child tree to the {injections} table.
local root = parser:parse(true)[1]:root()
- local injections = {} ---@type table<string, TSP.Injection>
+ local injections = {} ---@type table<string, vim.treesitter.dev.Injection>
parser:for_each_tree(function(parent_tree, parent_ltree)
local parent = parent_tree:root()
for _, child in pairs(parent_ltree:children()) do
- child:for_each_tree(function(tree, ltree)
+ for _, tree in pairs(child:trees()) do
local r = tree:root()
local node = assert(parent:named_descendant_for_range(r:range()))
local id = node:id()
if not injections[id] or r:byte_length() > injections[id].root:byte_length() then
injections[id] = {
- lang = ltree:lang(),
+ lang = child:lang(),
root = r,
}
end
- end)
+ end
end
end)
- local nodes = traverse(root, 0, parser:lang(), injections, {})
+ local nodes = traverse(root, 0, nil, parser:lang(), injections, {})
- local named = {} ---@type TSP.Node[]
+ local named = {} ---@type vim.treesitter.dev.Node[]
for _, v in ipairs(nodes) do
- if v.named then
+ if v.node:named() then
named[#named + 1] = v
end
end
@@ -141,6 +118,7 @@ function TSTreeView:new(bufnr, lang)
ns = api.nvim_create_namespace('treesitter/dev-inspect'),
nodes = nodes,
named = named,
+ ---@type vim.treesitter.dev.TSTreeViewOpts
opts = {
anon = false,
lang = false,
@@ -155,16 +133,12 @@ end
local decor_ns = api.nvim_create_namespace('ts.dev')
----@param lnum integer
----@param col integer
----@param end_lnum integer
----@param end_col integer
+---@param range Range4
---@return string
-local function get_range_str(lnum, col, end_lnum, end_col)
- if lnum == end_lnum then
- return string.format('[%d:%d - %d]', lnum + 1, col + 1, end_col)
- end
- return string.format('[%d:%d - %d:%d]', lnum + 1, col + 1, end_lnum + 1, end_col)
+local function range_to_string(range)
+ ---@type integer, integer, integer, integer
+ local row, col, end_row, end_col = unpack(range)
+ return string.format('[%d, %d] - [%d, %d]', row, col, end_row, end_col)
end
---@param w integer
@@ -183,7 +157,10 @@ end
local function set_dev_properties(w, b)
vim.wo[w].scrolloff = 5
vim.wo[w].wrap = false
- vim.wo[w].foldmethod = 'manual' -- disable folding
+ vim.wo[w].foldmethod = 'expr'
+ vim.wo[w].foldexpr = 'v:lua.vim.treesitter.foldexpr()' -- explicitly set foldexpr
+ vim.wo[w].foldenable = false -- Don't fold on first open InspectTree
+ vim.wo[w].foldlevel = 99
vim.bo[b].buflisted = false
vim.bo[b].buftype = 'nofile'
vim.bo[b].bufhidden = 'wipe'
@@ -192,7 +169,7 @@ end
--- Updates the cursor position in the inspector to match the node under the cursor.
---
---- @param treeview TSTreeView
+--- @param treeview vim.treesitter.dev.TSTreeView
--- @param lang string
--- @param source_buf integer
--- @param inspect_buf integer
@@ -213,7 +190,7 @@ local function set_inspector_cursor(treeview, lang, source_buf, inspect_buf, ins
local cursor_node_id = cursor_node:id()
for i, v in treeview:iter() do
- if v.id == cursor_node_id then
+ if v.node:id() == cursor_node_id then
local start = v.depth * treeview.opts.indent ---@type integer
local end_col = start + #v.text
api.nvim_buf_set_extmark(inspect_buf, treeview.ns, i - 1, start, {
@@ -228,6 +205,8 @@ end
--- Write the contents of this View into {bufnr}.
---
+--- Calling this function computes the text that is displayed for each node.
+---
---@param bufnr integer Buffer number to write into.
---@package
function TSTreeView:draw(bufnr)
@@ -235,13 +214,35 @@ function TSTreeView:draw(bufnr)
local lines = {} ---@type string[]
local lang_hl_marks = {} ---@type table[]
- for _, item in self:iter() do
- local range_str = get_range_str(item.lnum, item.col, item.end_lnum, item.end_col)
+ for i, item in self:iter() do
+ local range_str = range_to_string({ item.node:range() })
local lang_str = self.opts.lang and string.format(' %s', item.lang) or ''
+
+ local text ---@type string
+ if item.node:named() then
+ if item.field then
+ text = string.format('%s: (%s', item.field, item.node:type())
+ else
+ text = string.format('(%s', item.node:type())
+ end
+ else
+ text = string.format('"%s"', item.node:type():gsub('\n', '\\n'):gsub('"', '\\"'))
+ end
+
+ local next = self:get(i + 1)
+ if not next or next.depth <= item.depth then
+ local parens = item.depth - (next and next.depth or 0) + (item.node:named() and 1 or 0)
+ if parens > 0 then
+ text = string.format('%s%s', text, string.rep(')', parens))
+ end
+ end
+
+ item.text = text
+
local line = string.format(
'%s%s ; %s%s',
string.rep(' ', item.depth * self.opts.indent),
- item.text,
+ text,
range_str,
lang_str
)
@@ -253,7 +254,7 @@ function TSTreeView:draw(bufnr)
}
end
- lines[#lines + 1] = line
+ lines[i] = line
end
api.nvim_buf_set_lines(bufnr, 0, -1, false, lines)
@@ -275,7 +276,7 @@ end
--- The node number is dependent on whether or not anonymous nodes are displayed.
---
---@param i integer Node number to get
----@return TSP.Node
+---@return vim.treesitter.dev.Node
---@package
function TSTreeView:get(i)
local t = self.opts.anon and self.nodes or self.named
@@ -284,7 +285,7 @@ end
--- Iterate over all of the nodes in this View.
---
----@return (fun(): integer, TSP.Node) Iterator over all nodes in this View
+---@return (fun(): integer, vim.treesitter.dev.Node) Iterator over all nodes in this View
---@return table
---@return integer
---@package
@@ -292,22 +293,31 @@ function TSTreeView:iter()
return ipairs(self.opts.anon and self.nodes or self.named)
end
---- @class InspectTreeOpts
---- @field lang string? The language of the source buffer. If omitted, the
---- filetype of the source buffer is used.
---- @field bufnr integer? Buffer to draw the tree into. If omitted, a new
---- buffer is created.
---- @field winid integer? Window id to display the tree buffer in. If omitted,
---- a new window is created with {command}.
---- @field command string? Vimscript command to create the window. Default
---- value is "60vnew". Only used when {winid} is nil.
---- @field title (string|fun(bufnr:integer):string|nil) Title of the window. If a
---- function, it accepts the buffer number of the source
---- buffer as its only argument and should return a string.
+--- @class vim.treesitter.dev.inspect_tree.Opts
+--- @inlinedoc
+---
+--- The language of the source buffer. If omitted, the filetype of the source
+--- buffer is used.
+--- @field lang string?
+---
+--- Buffer to draw the tree into. If omitted, a new buffer is created.
+--- @field bufnr integer?
+---
+--- Window id to display the tree buffer in. If omitted, a new window is
+--- created with {command}.
+--- @field winid integer?
+---
+--- Vimscript command to create the window. Default value is "60vnew".
+--- Only used when {winid} is nil.
+--- @field command string?
+---
+--- Title of the window. If a function, it accepts the buffer number of the
+--- source buffer as its only argument and should return a string.
+--- @field title (string|fun(bufnr:integer):string|nil)
--- @private
---
---- @param opts InspectTreeOpts?
+--- @param opts vim.treesitter.dev.inspect_tree.Opts?
function M.inspect_tree(opts)
vim.validate({
opts = { opts, 't', true },
@@ -364,9 +374,9 @@ function M.inspect_tree(opts)
desc = 'Jump to the node under the cursor in the source buffer',
callback = function()
local row = api.nvim_win_get_cursor(w)[1]
- local pos = treeview:get(row)
+ local lnum, col = treeview:get(row).node:start()
api.nvim_set_current_win(win)
- api.nvim_win_set_cursor(win, { pos.lnum + 1, pos.col })
+ api.nvim_win_set_cursor(win, { lnum + 1, col })
end,
})
api.nvim_buf_set_keymap(b, 'n', 'a', '', {
@@ -374,7 +384,7 @@ function M.inspect_tree(opts)
callback = function()
local row, col = unpack(api.nvim_win_get_cursor(w)) ---@type integer, integer
local curnode = treeview:get(row)
- while curnode and not curnode.named do
+ while curnode and not curnode.node:named() do
row = row - 1
curnode = treeview:get(row)
end
@@ -386,9 +396,9 @@ function M.inspect_tree(opts)
return
end
- local id = curnode.id
+ local id = curnode.node:id()
for i, node in treeview:iter() do
- if node.id == id then
+ if node.node:id() == id then
api.nvim_win_set_cursor(w, { i, col })
break
end
@@ -424,20 +434,20 @@ function M.inspect_tree(opts)
api.nvim_buf_clear_namespace(buf, treeview.ns, 0, -1)
local row = api.nvim_win_get_cursor(w)[1]
- local pos = treeview:get(row)
- api.nvim_buf_set_extmark(buf, treeview.ns, pos.lnum, pos.col, {
- end_row = pos.end_lnum,
- end_col = math.max(0, pos.end_col),
+ local lnum, col, end_lnum, end_col = treeview:get(row).node:range()
+ api.nvim_buf_set_extmark(buf, treeview.ns, lnum, col, {
+ end_row = end_lnum,
+ end_col = math.max(0, end_col),
hl_group = 'Visual',
})
local topline, botline = vim.fn.line('w0', win), vim.fn.line('w$', win)
-- Move the cursor if highlighted range is completely out of view
- if pos.lnum < topline and pos.end_lnum < topline then
- api.nvim_win_set_cursor(win, { pos.end_lnum + 1, 0 })
- elseif pos.lnum > botline and pos.end_lnum > botline then
- api.nvim_win_set_cursor(win, { pos.lnum + 1, 0 })
+ if lnum < topline and end_lnum < topline then
+ api.nvim_win_set_cursor(win, { end_lnum + 1, 0 })
+ elseif lnum > botline and end_lnum > botline then
+ api.nvim_win_set_cursor(win, { lnum + 1, 0 })
end
end,
})
@@ -462,7 +472,9 @@ function M.inspect_tree(opts)
return true
end
+ local treeview_opts = treeview.opts
treeview = assert(TSTreeView:new(buf, opts.lang))
+ treeview.opts = treeview_opts
treeview:draw(b)
end,
})
diff --git a/runtime/lua/vim/treesitter/health.lua b/runtime/lua/vim/treesitter/health.lua
index ed1161e97f..a9b066d158 100644
--- a/runtime/lua/vim/treesitter/health.lua
+++ b/runtime/lua/vim/treesitter/health.lua
@@ -1,6 +1,6 @@
local M = {}
local ts = vim.treesitter
-local health = require('vim.health')
+local health = vim.health
--- Performs a healthcheck for treesitter integration
function M.check()
diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua
index 496193c6ed..388680259a 100644
--- a/runtime/lua/vim/treesitter/highlighter.lua
+++ b/runtime/lua/vim/treesitter/highlighter.lua
@@ -2,50 +2,25 @@ local api = vim.api
local query = vim.treesitter.query
local Range = require('vim.treesitter._range')
----@alias TSHlIter fun(end_line: integer|nil): integer, TSNode, TSMetadata
-
----@class TSHighlightState
----@field next_row integer
----@field iter TSHlIter|nil
-
----@class TSHighlighter
----@field active table<integer,TSHighlighter>
----@field bufnr integer
----@field orig_spelloptions string
----@field _highlight_states table<TSTree,TSHighlightState>
----@field _queries table<string,TSHighlighterQuery>
----@field tree LanguageTree
----@field redraw_count integer
-local TSHighlighter = rawget(vim.treesitter, 'TSHighlighter') or {}
-TSHighlighter.__index = TSHighlighter
+local ns = api.nvim_create_namespace('treesitter/highlighter')
---- @nodoc
-TSHighlighter.active = TSHighlighter.active or {}
+---@alias vim.treesitter.highlighter.Iter fun(end_line: integer|nil): integer, TSNode, vim.treesitter.query.TSMetadata
----@class TSHighlighterQuery
----@field _query Query|nil
----@field hl_cache table<integer,integer>
+---@class (private) vim.treesitter.highlighter.Query
+---@field private _query vim.treesitter.Query?
+---@field private lang string
+---@field private hl_cache table<integer,integer>
local TSHighlighterQuery = {}
TSHighlighterQuery.__index = TSHighlighterQuery
-local ns = api.nvim_create_namespace('treesitter/highlighter')
-
---@private
+---@param lang string
+---@param query_string string?
+---@return vim.treesitter.highlighter.Query
function TSHighlighterQuery.new(lang, query_string)
- local self = setmetatable({}, { __index = TSHighlighterQuery })
-
- self.hl_cache = setmetatable({}, {
- __index = function(table, capture)
- local name = self._query.captures[capture]
- local id = 0
- if not vim.startswith(name, '_') then
- id = api.nvim_get_hl_id_by_name('@' .. name .. '.' .. lang)
- end
-
- rawset(table, capture, id)
- return id
- end,
- })
+ local self = setmetatable({}, TSHighlighterQuery)
+ self.lang = lang
+ self.hl_cache = {}
if query_string then
self._query = query.parse(lang, query_string)
@@ -57,18 +32,57 @@ function TSHighlighterQuery.new(lang, query_string)
end
---@package
+---@param capture integer
+---@return integer?
+function TSHighlighterQuery:get_hl_from_capture(capture)
+ if not self.hl_cache[capture] then
+ local name = self._query.captures[capture]
+ local id = 0
+ if not vim.startswith(name, '_') then
+ id = api.nvim_get_hl_id_by_name('@' .. name .. '.' .. self.lang)
+ end
+ self.hl_cache[capture] = id
+ end
+
+ return self.hl_cache[capture]
+end
+
+---@package
function TSHighlighterQuery:query()
return self._query
end
+---@class (private) vim.treesitter.highlighter.State
+---@field tstree TSTree
+---@field next_row integer
+---@field iter vim.treesitter.highlighter.Iter?
+---@field highlighter_query vim.treesitter.highlighter.Query
+
+---@nodoc
+---@class vim.treesitter.highlighter
+---@field active table<integer,vim.treesitter.highlighter>
+---@field bufnr integer
+---@field private orig_spelloptions string
+--- A map of highlight states.
+--- This state is kept during rendering across each line update.
+---@field private _highlight_states vim.treesitter.highlighter.State[]
+---@field private _queries table<string,vim.treesitter.highlighter.Query>
+---@field tree vim.treesitter.LanguageTree
+---@field private redraw_count integer
+local TSHighlighter = {
+ active = {},
+}
+
+TSHighlighter.__index = TSHighlighter
+
---@package
---
--- Creates a highlighter for `tree`.
---
----@param tree LanguageTree parser object to use for highlighting
+---@param tree vim.treesitter.LanguageTree parser object to use for highlighting
---@param opts (table|nil) Configuration of the highlighter:
--- - queries table overwrite queries used by the highlighter
----@return TSHighlighter Created highlighter object
+---@return vim.treesitter.highlighter Created highlighter object
function TSHighlighter.new(tree, opts)
local self = setmetatable({}, TSHighlighter)
@@ -98,15 +112,12 @@ function TSHighlighter.new(tree, opts)
end,
}, true)
- self.bufnr = tree:source() --[[@as integer]]
- self.edit_count = 0
+ local source = tree:source()
+ assert(type(source) == 'number')
+
+ self.bufnr = source
self.redraw_count = 0
- self.line_count = {}
- -- A map of highlight states.
- -- This state is kept during rendering across each line update.
self._highlight_states = {}
-
- ---@type table<string,TSHighlighterQuery>
self._queries = {}
-- Queries for a specific language can be overridden by a custom
@@ -144,11 +155,9 @@ end
--- @nodoc
--- Removes all internal references to the highlighter
function TSHighlighter:destroy()
- if TSHighlighter.active[self.bufnr] then
- TSHighlighter.active[self.bufnr] = nil
- end
+ TSHighlighter.active[self.bufnr] = nil
- if vim.api.nvim_buf_is_loaded(self.bufnr) then
+ if api.nvim_buf_is_loaded(self.bufnr) then
vim.bo[self.bufnr].spelloptions = self.orig_spelloptions
vim.b[self.bufnr].ts_highlight = nil
if vim.g.syntax_on == 1 then
@@ -157,23 +166,49 @@ function TSHighlighter:destroy()
end
end
----@package
----@param tstree TSTree
----@return TSHighlightState
-function TSHighlighter:get_highlight_state(tstree)
- if not self._highlight_states[tstree] then
- self._highlight_states[tstree] = {
+---@param srow integer
+---@param erow integer exclusive
+---@private
+function TSHighlighter:prepare_highlight_states(srow, erow)
+ self._highlight_states = {}
+
+ self.tree:for_each_tree(function(tstree, tree)
+ if not tstree then
+ return
+ end
+
+ local root_node = tstree:root()
+ local root_start_row, _, root_end_row, _ = root_node:range()
+
+ -- Only consider trees within the visible range
+ if root_start_row > erow or root_end_row < srow then
+ return
+ end
+
+ local highlighter_query = self:get_query(tree:lang())
+
+ -- Some injected languages may not have highlight queries.
+ if not highlighter_query:query() then
+ return
+ end
+
+ -- _highlight_states should be a list so that the highlights are added in the same order as
+ -- for_each_tree traversal. This ensures that parents' highlight don't override children's.
+ table.insert(self._highlight_states, {
+ tstree = tstree,
next_row = 0,
iter = nil,
- }
- end
-
- return self._highlight_states[tstree]
+ highlighter_query = highlighter_query,
+ })
+ end)
end
----@private
-function TSHighlighter:reset_highlight_state()
- self._highlight_states = {}
+---@param fn fun(state: vim.treesitter.highlighter.State)
+---@package
+function TSHighlighter:for_each_highlight_state(fn)
+ for _, state in ipairs(self._highlight_states) do
+ fn(state)
+ end
end
---@package
@@ -197,10 +232,9 @@ function TSHighlighter:on_changedtree(changes)
end
--- Gets the query used for @param lang
---
---@package
---@param lang string Language used by the highlighter.
----@return TSHighlighterQuery
+---@return vim.treesitter.highlighter.Query
function TSHighlighter:get_query(lang)
if not self._queries[lang] then
self._queries[lang] = TSHighlighterQuery.new(lang)
@@ -209,35 +243,23 @@ function TSHighlighter:get_query(lang)
return self._queries[lang]
end
----@param self TSHighlighter
+---@param self vim.treesitter.highlighter
---@param buf integer
---@param line integer
---@param is_spell_nav boolean
local function on_line_impl(self, buf, line, is_spell_nav)
- self.tree:for_each_tree(function(tstree, tree)
- if not tstree then
- return
- end
-
- local root_node = tstree:root()
+ self:for_each_highlight_state(function(state)
+ local root_node = state.tstree:root()
local root_start_row, _, root_end_row, _ = root_node:range()
- -- Only worry about trees within the line range
+ -- Only consider trees that contain this line
if root_start_row > line or root_end_row < line then
return
end
- local state = self:get_highlight_state(tstree)
- local highlighter_query = self:get_query(tree:lang())
-
- -- Some injected languages may not have highlight queries.
- if not highlighter_query:query() then
- return
- end
-
if state.iter == nil or state.next_row < line then
state.iter =
- highlighter_query:query():iter_captures(root_node, self.bufnr, line, root_end_row + 1)
+ state.highlighter_query:query():iter_captures(root_node, self.bufnr, line, root_end_row + 1)
end
while line >= state.next_row do
@@ -250,9 +272,9 @@ local function on_line_impl(self, buf, line, is_spell_nav)
local start_row, start_col, end_row, end_col = Range.unpack4(range)
if capture then
- local hl = highlighter_query.hl_cache[capture]
+ local hl = state.highlighter_query:get_hl_from_capture(capture)
- local capture_name = highlighter_query:query().captures[capture]
+ local capture_name = state.highlighter_query:query().captures[capture]
local spell = nil ---@type boolean?
if capture_name == 'spell' then
spell = true
@@ -308,7 +330,7 @@ function TSHighlighter._on_spell_nav(_, _, buf, srow, _, erow, _)
return
end
- self:reset_highlight_state()
+ self:prepare_highlight_states(srow, erow)
for row = srow, erow do
on_line_impl(self, buf, row, true)
@@ -326,7 +348,7 @@ function TSHighlighter._on_win(_, _win, buf, topline, botline)
return false
end
self.tree:parse({ topline, botline + 1 })
- self:reset_highlight_state()
+ self:prepare_highlight_states(topline, botline + 1)
self.redraw_count = self.redraw_count + 1
return true
end
diff --git a/runtime/lua/vim/treesitter/language.lua b/runtime/lua/vim/treesitter/language.lua
index 15bf666a1e..47abf65332 100644
--- a/runtime/lua/vim/treesitter/language.lua
+++ b/runtime/lua/vim/treesitter/language.lua
@@ -1,6 +1,5 @@
local api = vim.api
----@class TSLanguageModule
local M = {}
---@type table<string,string>
@@ -37,6 +36,11 @@ end
---@deprecated
function M.require_language(lang, path, silent, symbol_name)
+ vim.deprecate(
+ 'vim.treesitter.language.require_language()',
+ 'vim.treesitter.language.add()',
+ '0.12'
+ )
local opts = {
silent = silent,
path = path,
@@ -52,10 +56,17 @@ function M.require_language(lang, path, silent, symbol_name)
return true
end
----@class treesitter.RequireLangOpts
----@field path? string
----@field silent? boolean
+---@class vim.treesitter.language.add.Opts
+---@inlinedoc
+---
+---Default filetype the parser should be associated with.
+---(Default: {lang})
---@field filetype? string|string[]
+---
+---Optional path the parser is located at
+---@field path? string
+---
+---Internal symbol name for the language to load
---@field symbol_name? string
--- Load parser with name {lang}
@@ -63,13 +74,8 @@ end
--- Parsers are searched in the `parser` runtime directory, or the provided {path}
---
---@param lang string Name of the parser (alphanumerical and `_` only)
----@param opts (table|nil) Options:
---- - filetype (string|string[]) Default filetype the parser should be associated with.
---- Defaults to {lang}.
---- - path (string|nil) Optional path the parser is located at
---- - symbol_name (string|nil) Internal symbol name for the language to load
+---@param opts? vim.treesitter.language.add.Opts Options:
function M.add(lang, opts)
- ---@cast opts treesitter.RequireLangOpts
opts = opts or {}
local path = opts.path
local filetype = opts.filetype or lang
@@ -114,6 +120,10 @@ local function ensure_list(x)
end
--- Register a parser named {lang} to be used for {filetype}(s).
+---
+--- Note: this adds or overrides the mapping for {filetype}, any existing mappings from other
+--- filetypes to {lang} will be preserved.
+---
--- @param lang string Name of parser
--- @param filetype string|string[] Filetype(s) to associate with lang
function M.register(lang, filetype)
@@ -140,14 +150,4 @@ function M.inspect(lang)
return vim._ts_inspect_language(lang)
end
----@deprecated
-function M.inspect_language(...)
- vim.deprecate(
- 'vim.treesitter.language.inspect_language()',
- 'vim.treesitter.language.inspect()',
- '0.10'
- )
- return M.inspect(...)
-end
-
return M
diff --git a/runtime/lua/vim/treesitter/languagetree.lua b/runtime/lua/vim/treesitter/languagetree.lua
index 0171b416cd..62714d3f1b 100644
--- a/runtime/lua/vim/treesitter/languagetree.lua
+++ b/runtime/lua/vim/treesitter/languagetree.lua
@@ -1,6 +1,4 @@
---- @defgroup lua-treesitter-languagetree
----
---- @brief A \*LanguageTree\* contains a tree of parsers: the root treesitter parser for {lang} and
+--- @brief A [LanguageTree]() contains a tree of parsers: the root treesitter parser for {lang} and
--- any "injected" language parsers, which themselves may inject other languages, recursively.
--- For example a Lua buffer containing some Vimscript commands needs multiple parsers to fully
--- understand its contents.
@@ -69,11 +67,12 @@ local TSCallbackNames = {
on_child_removed = 'child_removed',
}
----@class LanguageTree
+---@nodoc
+---@class vim.treesitter.LanguageTree
---@field private _callbacks table<TSCallbackName,function[]> Callback handlers
---@field package _callbacks_rec table<TSCallbackName,function[]> Callback handlers (recursive)
----@field private _children table<string,LanguageTree> Injected languages
----@field private _injection_query Query Queries defining injected languages
+---@field private _children table<string,vim.treesitter.LanguageTree> Injected languages
+---@field private _injection_query vim.treesitter.Query Queries defining injected languages
---@field private _injections_processed boolean
---@field private _opts table Options
---@field private _parser TSParser Parser for language
@@ -91,9 +90,11 @@ local TSCallbackNames = {
---@field private _logfile? file*
local LanguageTree = {}
----@class LanguageTreeOpts
----@field queries table<string,string> -- Deprecated
----@field injections table<string,string>
+---Optional arguments:
+---@class vim.treesitter.LanguageTree.new.Opts
+---@inlinedoc
+---@field queries? table<string,string> -- Deprecated
+---@field injections? table<string,string>
LanguageTree.__index = LanguageTree
@@ -104,14 +105,11 @@ LanguageTree.__index = LanguageTree
---
---@param source (integer|string) Buffer or text string to parse
---@param lang string Root language of this tree
----@param opts (table|nil) Optional arguments:
---- - injections table Map of language to injection query strings. Overrides the
---- built-in runtime file searching for language injections.
+---@param opts vim.treesitter.LanguageTree.new.Opts?
---@param parent_lang? string Parent language name of this tree
----@return LanguageTree parser object
+---@return vim.treesitter.LanguageTree parser object
function LanguageTree.new(source, lang, opts, parent_lang)
language.add(lang)
- ---@type LanguageTreeOpts
opts = opts or {}
if source == 0 then
@@ -120,7 +118,7 @@ function LanguageTree.new(source, lang, opts, parent_lang)
local injections = opts.injections or {}
- --- @type LanguageTree
+ --- @type vim.treesitter.LanguageTree
local self = {
_source = source,
_lang = lang,
@@ -196,7 +194,7 @@ local function tcall(f, ...)
end
---@private
----@vararg any
+---@param ... any
function LanguageTree:_log(...)
if not self._logger then
return
@@ -348,7 +346,13 @@ function LanguageTree:_parse_regions(range)
-- If there are no ranges, set to an empty list
-- so the included ranges in the parser are cleared.
for i, ranges in pairs(self:included_regions()) do
- if not self._valid[i] and intercepts_region(ranges, range) then
+ if
+ not self._valid[i]
+ and (
+ intercepts_region(ranges, range)
+ or (self._trees[i] and intercepts_region(self._trees[i]:included_ranges(false), range))
+ )
+ then
self._parser:set_included_ranges(ranges)
local parse_time, tree, tree_changes =
tcall(self._parser.parse, self._parser, self._trees[i], self._source, true)
@@ -427,7 +431,7 @@ function LanguageTree:parse(range)
local query_time = 0
local total_parse_time = 0
- --- At least 1 region is invalid
+ -- At least 1 region is invalid
if not self:is_valid(true) then
changes, no_regions_parsed, total_parse_time = self:_parse_regions(range)
-- Need to run injections when we parsed something
@@ -460,7 +464,7 @@ end
--- add recursion yourself if needed.
--- Invokes the callback for each |LanguageTree| and its children recursively
---
----@param fn fun(tree: LanguageTree, lang: string)
+---@param fn fun(tree: vim.treesitter.LanguageTree, lang: string)
---@param include_self boolean|nil Whether to include the invoking tree in the results
function LanguageTree:for_each_child(fn, include_self)
vim.deprecate('LanguageTree:for_each_child()', 'LanguageTree:children()', '0.11')
@@ -469,6 +473,7 @@ function LanguageTree:for_each_child(fn, include_self)
end
for _, child in pairs(self._children) do
+ --- @diagnostic disable-next-line:deprecated
child:for_each_child(fn, true)
end
end
@@ -477,7 +482,7 @@ end
---
--- Note: This includes the invoking tree's child trees as well.
---
----@param fn fun(tree: TSTree, ltree: LanguageTree)
+---@param fn fun(tree: TSTree, ltree: vim.treesitter.LanguageTree)
function LanguageTree:for_each_tree(fn)
for _, tree in pairs(self._trees) do
fn(tree, self)
@@ -494,7 +499,7 @@ end
---
---@private
---@param lang string Language to add.
----@return LanguageTree injected
+---@return vim.treesitter.LanguageTree injected
function LanguageTree:add_child(lang)
if self._children[lang] then
self:remove_child(lang)
@@ -664,7 +669,7 @@ end
---@param node TSNode
---@param source string|integer
----@param metadata TSMetadata
+---@param metadata vim.treesitter.query.TSMetadata
---@param include_children boolean
---@return Range6[]
local function get_node_ranges(node, source, metadata, include_children)
@@ -698,13 +703,14 @@ local function get_node_ranges(node, source, metadata, include_children)
return ranges
end
----@class TSInjectionElem
+---@nodoc
+---@class vim.treesitter.languagetree.InjectionElem
---@field combined boolean
---@field regions Range6[][]
----@alias TSInjection table<string,table<integer,TSInjectionElem>>
+---@alias vim.treesitter.languagetree.Injection table<string,table<integer,vim.treesitter.languagetree.InjectionElem>>
----@param t table<integer,TSInjection>
+---@param t table<integer,vim.treesitter.languagetree.Injection>
---@param tree_index integer
---@param pattern integer
---@param lang string
@@ -751,6 +757,11 @@ end)
---@param alias string language or filetype name
---@return string? # resolved parser name
local function resolve_lang(alias)
+ -- validate that `alias` is a legal language
+ if not (alias and alias:match('[%w_]+') == alias) then
+ return
+ end
+
if has_parser(alias) then
return alias
end
@@ -773,8 +784,8 @@ end
---@private
--- Extract injections according to:
--- https://tree-sitter.github.io/tree-sitter/syntax-highlighting#language-injection
----@param match table<integer,TSNode>
----@param metadata TSMetadata
+---@param match table<integer,TSNode[]>
+---@param metadata vim.treesitter.query.TSMetadata
---@return string?, boolean, Range6[]
function LanguageTree:_get_injection(match, metadata)
local ranges = {} ---@type Range6[]
@@ -785,14 +796,16 @@ function LanguageTree:_get_injection(match, metadata)
or (injection_lang and resolve_lang(injection_lang))
local include_children = metadata['injection.include-children'] ~= nil
- for id, node in pairs(match) do
- local name = self._injection_query.captures[id]
- -- Lang should override any other language tag
- if name == 'injection.language' then
- local text = vim.treesitter.get_node_text(node, self._source, { metadata = metadata[id] })
- lang = resolve_lang(text)
- elseif name == 'injection.content' then
- ranges = get_node_ranges(node, self._source, metadata[id], include_children)
+ for id, nodes in pairs(match) do
+ for _, node in ipairs(nodes) do
+ local name = self._injection_query.captures[id]
+ -- Lang should override any other language tag
+ if name == 'injection.language' then
+ local text = vim.treesitter.get_node_text(node, self._source, { metadata = metadata[id] })
+ lang = resolve_lang(text)
+ elseif name == 'injection.content' then
+ ranges = get_node_ranges(node, self._source, metadata[id], include_children)
+ end
end
end
@@ -825,7 +838,7 @@ function LanguageTree:_get_injections()
return {}
end
- ---@type table<integer,TSInjection>
+ ---@type table<integer,vim.treesitter.languagetree.Injection>
local injections = {}
for index, tree in pairs(self._trees) do
@@ -833,7 +846,13 @@ 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)
+ self._injection_query:iter_matches(
+ root_node,
+ self._source,
+ start_line,
+ end_line + 1,
+ { all = true }
+ )
do
local lang, combined, ranges = self:_get_injection(match, metadata)
if lang then
@@ -1133,7 +1152,7 @@ end
--- Gets the appropriate language that contains {range}.
---
---@param range Range4 `{ start_line, start_col, end_line, end_col }`
----@return LanguageTree Managing {range}
+---@return vim.treesitter.LanguageTree Managing {range}
function LanguageTree:language_for_range(range)
for _, child in pairs(self._children) do
if child:contains(range) then
diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua
index 8cbbffcd60..a086f5e876 100644
--- a/runtime/lua/vim/treesitter/query.lua
+++ b/runtime/lua/vim/treesitter/query.lua
@@ -1,19 +1,50 @@
local api = vim.api
local language = require('vim.treesitter.language')
----@class Query
----@field captures string[] List of captures used in query
----@field info TSQueryInfo Contains used queries, predicates, directives
----@field query userdata Parsed query
+local M = {}
+
+---@nodoc
+---Parsed query, see |vim.treesitter.query.parse()|
+---
+---@class vim.treesitter.Query
+---@field lang string name of the language for this parser
+---@field captures string[] list of (unique) capture names defined in query
+---@field info vim.treesitter.QueryInfo contains information used in the query (e.g. captures, predicates, directives)
+---@field query TSQuery userdata query object
local Query = {}
Query.__index = Query
----@class TSQueryInfo
----@field captures table
----@field patterns table<string,any[][]>
+---@package
+---@see vim.treesitter.query.parse
+---@param lang string
+---@param ts_query TSQuery
+---@return vim.treesitter.Query
+function Query.new(lang, ts_query)
+ local self = setmetatable({}, Query)
+ local query_info = ts_query:inspect() ---@type TSQueryInfo
+ self.query = ts_query
+ self.lang = lang
+ self.info = {
+ captures = query_info.captures,
+ patterns = query_info.patterns,
+ }
+ self.captures = self.info.captures
+ return self
+end
----@class TSQueryModule
-local M = {}
+---@nodoc
+---Information for Query, see |vim.treesitter.query.parse()|
+---@class vim.treesitter.QueryInfo
+---
+---List of (unique) capture names defined in query.
+---@field captures string[]
+---
+---Contains information about predicates and directives.
+---Key is pattern id, and value is list of predicates or directives defined in the pattern.
+---A predicate or directive is a list of (integer|string); integer represents `capture_id`, and
+---string represents (literal) arguments to predicate/directive. See |treesitter-predicates|
+---and |treesitter-directives| for more details.
+---@field patterns table<integer, (integer|string)[][]>
---@param files string[]
---@return string[]
@@ -53,16 +84,6 @@ local function add_included_lang(base_langs, lang, ilang)
return false
end
----@deprecated
-function M.get_query_files(...)
- vim.deprecate(
- 'vim.treesitter.query.get_query_files()',
- 'vim.treesitter.query.get_files()',
- '0.10'
- )
- return M.get_files(...)
-end
-
--- Gets the list of files used to make up a query
---
---@param lang string Language to get query for
@@ -163,7 +184,7 @@ local function read_query_files(filenames)
end
-- The explicitly set queries from |vim.treesitter.query.set()|
----@type table<string,table<string,Query>>
+---@type table<string,table<string,vim.treesitter.Query>>
local explicit_queries = setmetatable({}, {
__index = function(t, k)
local lang_queries = {}
@@ -173,12 +194,6 @@ local explicit_queries = setmetatable({}, {
end,
})
----@deprecated
-function M.set_query(...)
- vim.deprecate('vim.treesitter.query.set_query()', 'vim.treesitter.query.set()', '0.10')
- M.set(...)
-end
-
--- Sets the runtime query named {query_name} for {lang}
---
--- This allows users to override any runtime files and/or configuration
@@ -191,18 +206,12 @@ function M.set(lang, query_name, text)
explicit_queries[lang][query_name] = M.parse(lang, text)
end
----@deprecated
-function M.get_query(...)
- vim.deprecate('vim.treesitter.query.get_query()', 'vim.treesitter.query.get()', '0.10')
- return M.get(...)
-end
-
--- Returns the runtime query {query_name} for {lang}.
---
---@param lang string Language to use for the query
---@param query_name string Name of the query (e.g. "highlights")
---
----@return Query|nil Parsed query
+---@return vim.treesitter.Query|nil : Parsed query. `nil` if no query files are found.
M.get = vim.func._memoize('concat-2', function(lang, query_name)
if explicit_queries[lang][query_name] then
return explicit_queries[lang][query_name]
@@ -218,92 +227,96 @@ M.get = vim.func._memoize('concat-2', function(lang, query_name)
return M.parse(lang, query_string)
end)
----@deprecated
-function M.parse_query(...)
- vim.deprecate('vim.treesitter.query.parse_query()', 'vim.treesitter.query.parse()', '0.10')
- return M.parse(...)
-end
-
--- Parse {query} as a string. (If the query is in a file, the caller
--- should read the contents into a string before calling).
---
--- Returns a `Query` (see |lua-treesitter-query|) object which can be used to
--- search nodes in the syntax tree for the patterns defined in {query}
---- using `iter_*` methods below.
+--- using the `iter_captures` and `iter_matches` methods.
---
--- Exposes `info` and `captures` with additional context about {query}.
---- - `captures` contains the list of unique capture names defined in
---- {query}.
---- -` info.captures` also points to `captures`.
+--- - `captures` contains the list of unique capture names defined in {query}.
+--- - `info.captures` also points to `captures`.
--- - `info.patterns` contains information about predicates.
---
---@param lang string Language to use for the query
---@param query string Query in s-expr syntax
---
----@return Query Parsed query
+---@return vim.treesitter.Query Parsed query
+---
+---@see |vim.treesitter.query.get()|
M.parse = vim.func._memoize('concat-2', function(lang, query)
language.add(lang)
- local self = setmetatable({}, Query)
- self.query = vim._ts_parse_query(lang, query)
- self.info = self.query:inspect()
- self.captures = self.info.captures
- return self
+ local ts_query = vim._ts_parse_query(lang, query)
+ return Query.new(lang, ts_query)
end)
----@deprecated
-function M.get_range(...)
- vim.deprecate('vim.treesitter.query.get_range()', 'vim.treesitter.get_range()', '0.10')
- return vim.treesitter.get_range(...)
-end
-
----@deprecated
-function M.get_node_text(...)
- vim.deprecate('vim.treesitter.query.get_node_text()', 'vim.treesitter.get_node_text()', '0.10')
- return vim.treesitter.get_node_text(...)
-end
-
----@alias TSMatch table<integer,TSNode>
-
----@alias TSPredicate fun(match: TSMatch, _, _, predicate: any[]): boolean
-
--- Predicate handler receive the following arguments
--- (match, pattern, bufnr, predicate)
----@type table<string,TSPredicate>
-local predicate_handlers = {
- ['eq?'] = function(match, _, source, predicate)
- local node = match[predicate[2]]
- if not node then
+--- Implementations of predicates that can optionally be prefixed with "any-".
+---
+--- These functions contain the implementations for each predicate, correctly
+--- handling the "any" vs "all" semantics. They are called from the
+--- predicate_handlers table with the appropriate arguments for each predicate.
+local impl = {
+ --- @param match vim.treesitter.query.TSMatch
+ --- @param source integer|string
+ --- @param predicate any[]
+ --- @param any boolean
+ ['eq'] = function(match, source, predicate, any)
+ local nodes = match[predicate[2]]
+ if not nodes or #nodes == 0 then
return true
end
- local node_text = vim.treesitter.get_node_text(node, source)
- local str ---@type string
- if type(predicate[3]) == 'string' then
- -- (#eq? @aa "foo")
- str = predicate[3]
- else
- -- (#eq? @aa @bb)
- str = vim.treesitter.get_node_text(match[predicate[3]], source)
- end
+ for _, node in ipairs(nodes) do
+ local node_text = vim.treesitter.get_node_text(node, source)
+
+ local str ---@type string
+ if type(predicate[3]) == 'string' then
+ -- (#eq? @aa "foo")
+ str = predicate[3]
+ else
+ -- (#eq? @aa @bb)
+ local other = assert(match[predicate[3]])
+ assert(#other == 1, '#eq? does not support comparison with captures on multiple nodes')
+ str = vim.treesitter.get_node_text(other[1], source)
+ end
- if node_text ~= str or str == nil then
- return false
+ local res = str ~= nil and node_text == str
+ if any and res then
+ return true
+ elseif not any and not res then
+ return false
+ end
end
- return true
+ return not any
end,
- ['lua-match?'] = function(match, _, source, predicate)
- local node = match[predicate[2]]
- if not node then
+ --- @param match vim.treesitter.query.TSMatch
+ --- @param source integer|string
+ --- @param predicate any[]
+ --- @param any boolean
+ ['lua-match'] = function(match, source, predicate, any)
+ local nodes = match[predicate[2]]
+ if not nodes or #nodes == 0 then
return true
end
- local regex = predicate[3]
- return string.find(vim.treesitter.get_node_text(node, source), regex) ~= nil
+
+ for _, node in ipairs(nodes) do
+ local regex = predicate[3]
+ local res = string.find(vim.treesitter.get_node_text(node, source), regex) ~= nil
+ if any and res then
+ return true
+ elseif not any and not res then
+ return false
+ end
+ end
+
+ return not any
end,
- ['match?'] = (function()
+ ['match'] = (function()
local magic_prefixes = { ['\\v'] = true, ['\\m'] = true, ['\\M'] = true, ['\\V'] = true }
local function check_magic(str)
if string.len(str) < 2 or magic_prefixes[string.sub(str, 1, 2)] then
@@ -320,85 +333,161 @@ local predicate_handlers = {
end,
})
- return function(match, _, source, pred)
- ---@cast match TSMatch
- local node = match[pred[2]]
- if not node then
+ --- @param match vim.treesitter.query.TSMatch
+ --- @param source integer|string
+ --- @param predicate any[]
+ --- @param any boolean
+ return function(match, source, predicate, any)
+ local nodes = match[predicate[2]]
+ if not nodes or #nodes == 0 then
return true
end
- ---@diagnostic disable-next-line no-unknown
- local regex = compiled_vim_regexes[pred[3]]
- return regex:match_str(vim.treesitter.get_node_text(node, source))
+
+ for _, node in ipairs(nodes) do
+ local regex = compiled_vim_regexes[predicate[3]] ---@type vim.regex
+ local res = regex:match_str(vim.treesitter.get_node_text(node, source))
+ if any and res then
+ return true
+ elseif not any and not res then
+ return false
+ end
+ end
+ return not any
end
end)(),
- ['contains?'] = function(match, _, source, predicate)
- local node = match[predicate[2]]
- if not node then
+ --- @param match vim.treesitter.query.TSMatch
+ --- @param source integer|string
+ --- @param predicate any[]
+ --- @param any boolean
+ ['contains'] = function(match, source, predicate, any)
+ local nodes = match[predicate[2]]
+ if not nodes or #nodes == 0 then
return true
end
- local node_text = vim.treesitter.get_node_text(node, source)
- for i = 3, #predicate do
- if string.find(node_text, predicate[i], 1, true) then
- return true
+ for _, node in ipairs(nodes) do
+ local node_text = vim.treesitter.get_node_text(node, source)
+
+ for i = 3, #predicate do
+ local res = string.find(node_text, predicate[i], 1, true)
+ if any and res then
+ return true
+ elseif not any and not res then
+ return false
+ end
end
end
- return false
+ return not any
+ end,
+}
+
+---@nodoc
+---@class vim.treesitter.query.TSMatch
+---@field pattern? integer
+---@field active? boolean
+---@field [integer] TSNode[]
+
+---@alias TSPredicate fun(match: vim.treesitter.query.TSMatch, pattern: integer, source: integer|string, predicate: any[]): boolean
+
+-- Predicate handler receive the following arguments
+-- (match, pattern, bufnr, predicate)
+---@type table<string,TSPredicate>
+local predicate_handlers = {
+ ['eq?'] = function(match, _, source, predicate)
+ return impl['eq'](match, source, predicate, false)
+ end,
+
+ ['any-eq?'] = function(match, _, source, predicate)
+ return impl['eq'](match, source, predicate, true)
+ end,
+
+ ['lua-match?'] = function(match, _, source, predicate)
+ return impl['lua-match'](match, source, predicate, false)
+ end,
+
+ ['any-lua-match?'] = function(match, _, source, predicate)
+ return impl['lua-match'](match, source, predicate, true)
+ end,
+
+ ['match?'] = function(match, _, source, predicate)
+ return impl['match'](match, source, predicate, false)
+ end,
+
+ ['any-match?'] = function(match, _, source, predicate)
+ return impl['match'](match, source, predicate, true)
+ end,
+
+ ['contains?'] = function(match, _, source, predicate)
+ return impl['contains'](match, source, predicate, false)
+ end,
+
+ ['any-contains?'] = function(match, _, source, predicate)
+ return impl['contains'](match, source, predicate, true)
end,
['any-of?'] = function(match, _, source, predicate)
- local node = match[predicate[2]]
- if not node then
+ local nodes = match[predicate[2]]
+ if not nodes or #nodes == 0 then
return true
end
- local node_text = vim.treesitter.get_node_text(node, source)
- -- Since 'predicate' will not be used by callers of this function, use it
- -- to store a string set built from the list of words to check against.
- local string_set = predicate['string_set']
- if not string_set then
- string_set = {}
- for i = 3, #predicate do
- ---@diagnostic disable-next-line:no-unknown
- string_set[predicate[i]] = true
+ for _, node in ipairs(nodes) do
+ local node_text = vim.treesitter.get_node_text(node, source)
+
+ -- Since 'predicate' will not be used by callers of this function, use it
+ -- to store a string set built from the list of words to check against.
+ local string_set = predicate['string_set'] --- @type table<string, boolean>
+ if not string_set then
+ string_set = {}
+ for i = 3, #predicate do
+ string_set[predicate[i]] = true
+ end
+ predicate['string_set'] = string_set
+ end
+
+ if string_set[node_text] then
+ return true
end
- predicate['string_set'] = string_set
end
- return string_set[node_text]
+ return false
end,
['has-ancestor?'] = function(match, _, _, predicate)
- local node = match[predicate[2]]
- if not node then
+ local nodes = match[predicate[2]]
+ if not nodes or #nodes == 0 then
return true
end
- local ancestor_types = {}
- for _, type in ipairs({ unpack(predicate, 3) }) do
- ancestor_types[type] = true
- end
+ for _, node in ipairs(nodes) do
+ local ancestor_types = {} --- @type table<string, boolean>
+ for _, type in ipairs({ unpack(predicate, 3) }) do
+ ancestor_types[type] = true
+ end
- node = node:parent()
- while node do
- if ancestor_types[node:type()] then
- return true
+ local cur = node:parent()
+ while cur do
+ if ancestor_types[cur:type()] then
+ return true
+ end
+ cur = cur:parent()
end
- node = node:parent()
end
return false
end,
['has-parent?'] = function(match, _, _, predicate)
- local node = match[predicate[2]]
- if not node then
+ local nodes = match[predicate[2]]
+ if not nodes or #nodes == 0 then
return true
end
- if vim.list_contains({ unpack(predicate, 3) }, node:parent():type()) then
- return true
+ for _, node in ipairs(nodes) do
+ if vim.list_contains({ unpack(predicate, 3) }, node:parent():type()) then
+ return true
+ end
end
return false
end,
@@ -406,14 +495,16 @@ local predicate_handlers = {
-- As we provide lua-match? also expose vim-match?
predicate_handlers['vim-match?'] = predicate_handlers['match?']
+predicate_handlers['any-vim-match?'] = predicate_handlers['any-match?']
----@class TSMetadata
+---@nodoc
+---@class vim.treesitter.query.TSMetadata
---@field range? Range
---@field conceal? string
----@field [integer] TSMetadata
+---@field [integer] vim.treesitter.query.TSMetadata
---@field [string] integer|string
----@alias TSDirective fun(match: TSMatch, _, _, predicate: (string|integer)[], metadata: TSMetadata)
+---@alias TSDirective fun(match: vim.treesitter.query.TSMatch, _, _, predicate: (string|integer)[], metadata: vim.treesitter.query.TSMetadata)
-- Predicate handler receive the following arguments
-- (match, pattern, bufnr, predicate)
@@ -441,13 +532,17 @@ local directive_handlers = {
-- Shifts the range of a node.
-- Example: (#offset! @_node 0 1 0 -1)
['offset!'] = function(match, _, _, pred, metadata)
- ---@cast pred integer[]
- local capture_id = pred[2]
+ local capture_id = pred[2] --[[@as integer]]
+ local nodes = match[capture_id]
+ assert(#nodes == 1, '#offset! does not support captures on multiple nodes')
+
+ local node = nodes[1]
+
if not metadata[capture_id] then
metadata[capture_id] = {}
end
- local range = metadata[capture_id].range or { match[capture_id]:range() }
+ local range = metadata[capture_id].range or { node:range() }
local start_row_offset = pred[3] or 0
local start_col_offset = pred[4] or 0
local end_row_offset = pred[5] or 0
@@ -471,7 +566,9 @@ local directive_handlers = {
local id = pred[2]
assert(type(id) == 'number')
- local node = match[id]
+ local nodes = match[id]
+ assert(#nodes == 1, '#gsub! does not support captures on multiple nodes')
+ local node = nodes[1]
local text = vim.treesitter.get_node_text(node, bufnr, { metadata = metadata[id] }) or ''
if not metadata[id] then
@@ -491,10 +588,9 @@ local directive_handlers = {
local capture_id = pred[2]
assert(type(capture_id) == 'number')
- local node = match[capture_id]
- if not node then
- return
- end
+ local nodes = match[capture_id]
+ assert(#nodes == 1, '#trim! does not support captures on multiple nodes')
+ local node = nodes[1]
local start_row, start_col, end_row, end_col = node:range()
@@ -525,38 +621,93 @@ local directive_handlers = {
--- Adds a new predicate to be used in queries
---
---@param name string Name of the predicate, without leading #
----@param handler function(match:table<string,TSNode>, pattern:string, bufnr:integer, predicate:string[])
+---@param handler function(match: table<integer,TSNode[]>, pattern: integer, source: integer|string, predicate: any[], metadata: table)
--- - see |vim.treesitter.query.add_directive()| for argument meanings
----@param force boolean|nil
-function M.add_predicate(name, handler, force)
- if predicate_handlers[name] and not force then
- error(string.format('Overriding %s', name))
+---@param opts table<string, any> Optional options:
+--- - 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.
+function M.add_predicate(name, handler, opts)
+ -- Backward compatibility: old signature had "force" as boolean argument
+ if type(opts) == 'boolean' then
+ opts = { force = opts }
end
- predicate_handlers[name] = handler
+ opts = opts or {}
+
+ if predicate_handlers[name] and not opts.force then
+ error(string.format('Overriding existing predicate %s', name))
+ end
+
+ if opts.all then
+ predicate_handlers[name] = handler
+ else
+ --- @param match table<integer, TSNode[]>
+ local function wrapper(match, ...)
+ local m = {} ---@type table<integer, TSNode>
+ for k, v in pairs(match) do
+ if type(k) == 'number' then
+ m[k] = v[#v]
+ end
+ end
+ return handler(m, ...)
+ end
+ predicate_handlers[name] = wrapper
+ end
end
--- Adds a new directive to be used in queries
---
--- Handlers can set match level data by setting directly on the
---- metadata object `metadata.key = value`, additionally, handlers
+--- metadata object `metadata.key = value`. Additionally, handlers
--- can set node level data by using the capture id on the
--- metadata table `metadata[capture_id].key = value`
---
---@param name string Name of the directive, without leading #
----@param handler function(match:table<string,TSNode>, pattern:string, bufnr:integer, predicate:string[], metadata:table)
---- - match: see |treesitter-query|
---- - node-level data are accessible via `match[capture_id]`
---- - pattern: see |treesitter-query|
+---@param handler function(match: table<integer,TSNode[]>, pattern: integer, source: integer|string, predicate: any[], metadata: table)
+--- - 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.
--- `(node (#set! conceal "-"))` would get the predicate `{ "#set!", "conceal", "-" }`
----@param force boolean|nil
-function M.add_directive(name, handler, force)
- if directive_handlers[name] and not force then
- error(string.format('Overriding %s', name))
+---@param opts table<string, any> Optional options:
+--- - 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.
+function M.add_directive(name, handler, opts)
+ -- Backward compatibility: old signature had "force" as boolean argument
+ if type(opts) == 'boolean' then
+ opts = { force = opts }
end
- directive_handlers[name] = handler
+ opts = opts or {}
+
+ if directive_handlers[name] and not opts.force then
+ error(string.format('Overriding existing directive %s', name))
+ end
+
+ if opts.all then
+ directive_handlers[name] = handler
+ else
+ --- @param match table<integer, TSNode[]>
+ local function wrapper(match, ...)
+ local m = {} ---@type table<integer, TSNode>
+ for k, v in pairs(match) do
+ m[k] = v[#v]
+ end
+ handler(m, ...)
+ end
+ directive_handlers[name] = wrapper
+ end
end
--- Lists the currently available directives to use in queries.
@@ -580,8 +731,8 @@ local function is_directive(name)
end
---@private
----@param match TSMatch
----@param pattern string
+---@param match vim.treesitter.query.TSMatch
+---@param pattern integer
---@param source integer|string
function Query:match_preds(match, pattern, source)
local preds = self.info.patterns[pattern]
@@ -591,18 +742,14 @@ function Query:match_preds(match, pattern, source)
-- continue on the other case. This way unknown predicates will not be considered,
-- which allows some testing and easier user extensibility (#12173).
-- Also, tree-sitter strips the leading # from predicates for us.
- local pred_name ---@type string
-
- local is_not ---@type boolean
+ local is_not = false
-- Skip over directives... they will get processed after all the predicates.
if not is_directive(pred[1]) then
- if string.sub(pred[1], 1, 4) == 'not-' then
- pred_name = string.sub(pred[1], 5)
+ local pred_name = pred[1]
+ if pred_name:match('^not%-') then
+ pred_name = pred_name:sub(5)
is_not = true
- else
- pred_name = pred[1]
- is_not = false
end
local handler = predicate_handlers[pred_name]
@@ -623,8 +770,8 @@ function Query:match_preds(match, pattern, source)
end
---@private
----@param match TSMatch
----@param metadata TSMetadata
+---@param match vim.treesitter.query.TSMatch
+---@param metadata vim.treesitter.query.TSMetadata
function Query:apply_directives(match, pattern, source, metadata)
local preds = self.info.patterns[pattern]
@@ -645,14 +792,16 @@ end
--- Returns the start and stop value if set else the node's range.
-- When the node's range is used, the stop is incremented by 1
-- to make the search inclusive.
----@param start integer
----@param stop integer
+---@param start integer|nil
+---@param stop integer|nil
---@param node TSNode
---@return integer, integer
local function value_or_node_range(start, stop, node)
- if start == nil and stop == nil then
- local node_start, _, node_stop, _ = node:range()
- return node_start, node_stop + 1 -- Make stop inclusive
+ if start == nil then
+ start = node:start()
+ end
+ if stop == nil then
+ stop = node:end_() + 1 -- Make stop inclusive
end
return start, stop
@@ -683,10 +832,10 @@ end
---
---@param node TSNode under which the search will occur
---@param source (integer|string) Source buffer or string to extract text from
----@param start integer Starting line for the search
----@param stop integer Stopping line for the search (end-exclusive)
+---@param start? integer Starting line for the search. Defaults to `node:start()`.
+---@param stop? integer Stopping line for the search (end-exclusive). Defaults to `node:end_()`.
---
----@return (fun(end_line: integer|nil): integer, TSNode, TSMetadata):
+---@return (fun(end_line: integer|nil): integer, TSNode, vim.treesitter.query.TSMetadata):
--- capture id, capture node, metadata
function Query:iter_captures(node, source, start, stop)
if type(source) == 'number' and source == 0 then
@@ -695,7 +844,7 @@ function Query:iter_captures(node, source, start, stop)
start, stop = value_or_node_range(start, stop, node)
- local raw_iter = node:_rawquery(self.query, true, start, stop)
+ local raw_iter = node:_rawquery(self.query, true, start, stop) ---@type fun(): integer, TSNode, vim.treesitter.query.TSMatch
local function iter(end_line)
local capture, captured_node, match = raw_iter()
local metadata = {}
@@ -719,46 +868,55 @@ end
--- Iterates the matches of self on a given range.
---
---- Iterate over all matches within a {node}. The arguments are the same as
---- for |Query:iter_captures()| but the iterated values are different:
---- an (1-based) index of the pattern in the query, a table mapping
---- capture indices to nodes, and metadata from any directives processing the match.
---- If the query has more than one pattern, the capture table might be sparse
---- and e.g. `pairs()` method should be used over `ipairs`.
---- Here is an example iterating over all captures in every match:
+--- Iterate over all matches within a {node}. The arguments are the same as for
+--- |Query:iter_captures()| but the iterated values are different: an (1-based)
+--- index of the pattern in the query, a table mapping capture indices to 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, first, last) do
---- for id, node in pairs(match) do
+--- for pattern, match, metadata in cquery:iter_matches(tree:root(), bufnr, 0, -1, { all = true }) do
+--- for id, nodes in pairs(match) do
--- local name = query.captures[id]
---- -- `node` was captured by the `name` capture in the match
+--- for _, node in ipairs(nodes) do
+--- -- `node` was captured by the `name` capture in the match
---
---- local node_data = metadata[id] -- Node level metadata
----
---- -- ... use the info here ...
+--- local node_data = metadata[id] -- Node level metadata
+--- ... use the info here ...
+--- end
--- end
--- end
--- ```
---
+---
---@param node TSNode under which the search will occur
---@param source (integer|string) Source buffer or string to search
----@param start integer Starting line for the search
----@param stop integer Stopping line for the search (end-exclusive)
----@param opts table|nil Options:
+---@param start? integer Starting line for the search. Defaults to `node:start()`.
+---@param stop? integer Stopping line for the search (end-exclusive). Defaults to `node:end_()`.
+---@param opts? table Optional keyword arguments:
--- - 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.
---- Requires treesitter >= 0.20.9.
+--- - 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.
---
----@return (fun(): integer, table<integer,TSNode>, table): pattern id, match, metadata
+---@return (fun(): integer, table<integer, TSNode[]>, table): pattern id, match, metadata
function Query:iter_matches(node, source, start, stop, opts)
+ local all = opts and opts.all
if type(source) == 'number' and source == 0 then
source = api.nvim_get_current_buf()
end
start, stop = value_or_node_range(start, stop, node)
- local raw_iter = node:_rawquery(self.query, false, start, stop, opts)
- ---@cast raw_iter fun(): string, any
+ local raw_iter = node:_rawquery(self.query, false, start, stop, opts) ---@type fun(): integer, vim.treesitter.query.TSMatch
local function iter()
local pattern, match = raw_iter()
local metadata = {}
@@ -771,14 +929,33 @@ function Query:iter_matches(node, source, start, stop, opts)
self:apply_directives(match, pattern, source, metadata)
end
+
+ if not all 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!
+ local old_match = {} ---@type table<integer, TSNode>
+ for k, v in pairs(match or {}) do
+ old_match[k] = v[#v]
+ end
+ return pattern, old_match, metadata
+ end
+
return pattern, match, metadata
end
return iter
end
----@class QueryLinterOpts
----@field langs (string|string[]|nil)
----@field clear (boolean)
+--- Optional keyword arguments:
+--- @class vim.treesitter.query.lint.Opts
+--- @inlinedoc
+---
+--- Language(s) to use for checking the query.
+--- If multiple languages are specified, queries are validated for all of them
+--- @field langs? string|string[]
+---
+--- Just clear current lint errors
+--- @field clear boolean
--- Lint treesitter queries using installed parser, or clear lint errors.
---
@@ -793,15 +970,12 @@ end
--- of the query file, e.g., if the path ends in `/lua/highlights.scm`, the parser for the
--- `lua` language will be used.
---@param buf (integer) Buffer handle
----@param opts (QueryLinterOpts|nil) Optional keyword arguments:
---- - langs (string|string[]|nil) Language(s) to use for checking the query.
---- If multiple languages are specified, queries are validated for all of them
---- - clear (boolean) if `true`, just clear current lint errors
+---@param opts? vim.treesitter.query.lint.Opts
function M.lint(buf, opts)
if opts and opts.clear then
- require('vim.treesitter._query_linter').clear(buf)
+ vim.treesitter._query_linter.clear(buf)
else
- require('vim.treesitter._query_linter').lint(buf, opts)
+ vim.treesitter._query_linter.lint(buf, opts)
end
end
@@ -813,13 +987,15 @@ end
--- vim.bo.omnifunc = 'v:lua.vim.treesitter.query.omnifunc'
--- ```
---
+--- @param findstart 0|1
+--- @param base string
function M.omnifunc(findstart, base)
- return require('vim.treesitter._query_linter').omnifunc(findstart, base)
+ return vim.treesitter._query_linter.omnifunc(findstart, base)
end
--- Opens a live editor to query the buffer you started from.
---
---- Can also be shown with *:EditQuery*.
+--- Can also be shown with [:EditQuery]().
---
--- If you move the cursor to a capture name ("@foo"), text matching the capture is highlighted in
--- the source buffer. The query editor is a scratch buffer, use `:write` to save it. You can find
@@ -827,7 +1003,7 @@ end
---
--- @param lang? string language to open the query editor for. If omitted, inferred from the current buffer's filetype.
function M.edit(lang)
- require('vim.treesitter.dev').edit_query(lang)
+ vim.treesitter.dev.edit_query(lang)
end
return M
diff --git a/runtime/lua/vim/ui.lua b/runtime/lua/vim/ui.lua
index b6ddf337ce..b0e7ca1a35 100644
--- a/runtime/lua/vim/ui.lua
+++ b/runtime/lua/vim/ui.lua
@@ -20,7 +20,7 @@ local M = {}
--- end)
--- ```
---
----@param items table Arbitrary items
+---@param items any[] Arbitrary items
---@param opts table Additional options
--- - prompt (string|nil)
--- Text of the prompt. Defaults to `Select one of:`
@@ -32,7 +32,7 @@ local M = {}
--- Plugins reimplementing `vim.ui.select` may wish to
--- use this to infer the structure or semantics of
--- `items`, or the context in which select() was called.
----@param on_choice function ((item|nil, idx|nil) -> ())
+---@param on_choice fun(item: any|nil, idx: integer|nil)
--- Called once the user made a choice.
--- `idx` is the 1-based index of `item` within `items`.
--- `nil` if the user aborted the dialog.
@@ -44,7 +44,7 @@ function M.select(items, opts, on_choice)
opts = opts or {}
local choices = { opts.prompt or 'Select one of:' }
local format_item = opts.format_item or tostring
- for i, item in pairs(items) do
+ for i, item in ipairs(items) do
table.insert(choices, string.format('%d: %s', i, format_item(item)))
end
local choice = vim.fn.inputlist(choices)
@@ -66,7 +66,7 @@ end
--- end)
--- ```
---
----@param opts table Additional options. See |input()|
+---@param opts table? Additional options. See |input()|
--- - prompt (string|nil)
--- Text of the prompt
--- - default (string|nil)
@@ -87,6 +87,7 @@ end
--- `nil` if the user aborted the dialog.
function M.input(opts, on_confirm)
vim.validate({
+ opts = { opts, 'table', true },
on_confirm = { on_confirm, 'function', false },
})
@@ -133,7 +134,7 @@ function M.open(path)
path = vim.fn.expand(path)
end
- local cmd
+ local cmd --- @type string[]
if vim.fn.has('mac') == 1 then
cmd = { 'open', path }
@@ -143,12 +144,12 @@ 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 }
else
- return nil, 'vim.ui.open: no handler found (tried: wslview, xdg-open)'
+ return nil, 'vim.ui.open: no handler found (tried: explorer.exe, xdg-open)'
end
local rv = vim.system(cmd, { text = true, detach = true }):wait()
diff --git a/runtime/lua/vim/ui/clipboard/osc52.lua b/runtime/lua/vim/ui/clipboard/osc52.lua
index 6483f0387d..50afbe63a5 100644
--- a/runtime/lua/vim/ui/clipboard/osc52.lua
+++ b/runtime/lua/vim/ui/clipboard/osc52.lua
@@ -13,7 +13,9 @@ function M.copy(reg)
local clipboard = reg == '+' and 'c' or 'p'
return function(lines)
local s = table.concat(lines, '\n')
- io.stdout:write(osc52(clipboard, vim.base64.encode(s)))
+ -- The data to be written here can be quite long.
+ -- Use nvim_chan_send() as io.stdout:write() doesn't handle EAGAIN. #26688
+ vim.api.nvim_chan_send(2, osc52(clipboard, vim.base64.encode(s)))
end
end
diff --git a/runtime/lua/vim/uri.lua b/runtime/lua/vim/uri.lua
index 2dc817c5c1..b4e4098b91 100644
--- a/runtime/lua/vim/uri.lua
+++ b/runtime/lua/vim/uri.lua
@@ -1,4 +1,4 @@
----TODO: This is implemented only for files currently.
+-- TODO: This is implemented only for files currently.
-- https://tools.ietf.org/html/rfc3986
-- https://tools.ietf.org/html/rfc2732
-- https://tools.ietf.org/html/rfc2396
@@ -10,14 +10,14 @@ local tohex = require('bit').tohex
local URI_SCHEME_PATTERN = '^([a-zA-Z]+[a-zA-Z0-9.+-]*):.*'
local WINDOWS_URI_SCHEME_PATTERN = '^([a-zA-Z]+[a-zA-Z0-9.+-]*):[a-zA-Z]:.*'
local PATTERNS = {
- ---RFC 2396
- ---https://tools.ietf.org/html/rfc2396#section-2.2
+ -- RFC 2396
+ -- https://tools.ietf.org/html/rfc2396#section-2.2
rfc2396 = "^A-Za-z0-9%-_.!~*'()",
- ---RFC 2732
- ---https://tools.ietf.org/html/rfc2732
+ -- RFC 2732
+ -- https://tools.ietf.org/html/rfc2732
rfc2732 = "^A-Za-z0-9%-_.!~*'()[]",
- ---RFC 3986
- ---https://tools.ietf.org/html/rfc3986#section-2.2
+ -- RFC 3986
+ -- https://tools.ietf.org/html/rfc3986#section-2.2
rfc3986 = "^A-Za-z0-9%-._~!$&'()*+,;=:@/",
}
@@ -104,6 +104,10 @@ function M.uri_to_fname(uri)
if scheme ~= 'file' then
return uri
end
+ local fragment_index = uri:find('#')
+ if fragment_index ~= nil then
+ uri = uri:sub(1, fragment_index - 1)
+ end
uri = M.uri_decode(uri)
--TODO improve this.
if is_windows_file_uri(uri) then
@@ -116,7 +120,6 @@ end
---Gets the buffer for a uri.
---Creates a new unloaded buffer if no buffer for the uri already exists.
---
---@param uri string
---@return integer bufnr
function M.uri_to_bufnr(uri)
diff --git a/runtime/lua/vim/userreg.lua b/runtime/lua/vim/userreg.lua
new file mode 100644
index 0000000000..5abcff0407
--- /dev/null
+++ b/runtime/lua/vim/userreg.lua
@@ -0,0 +1,51 @@
+-- Defualt implementation of the userregfunc. This default implementation is
+-- extensible and allows other plugins to register handlers for different
+-- registers.
+--
+-- The default handler behaves just as a normal register would.
+
+local userreg = {}
+
+-- Returns a "default handler" which behaves exactly like the builtin registers
+-- in Vim. Simply stores whatever was yanked and returns the last thing that was
+-- yanked.
+function userreg._default_handler()
+ local d = {}
+
+ function d.do_yank(self, content)
+ self.content = content
+ end
+
+ function d.do_put(self)
+ return self.content or {}
+ end
+
+ return d
+end
+
+-- The store for registers default handler
+userreg._regtable = {}
+
+-- Function for the userreg. This function will defer to the handler registered
+-- to the given register. If no handler is registered to the given register, the
+-- default handler is used.
+function userreg.fn(action, register, content)
+ if not userreg._regtable[register] then
+ userreg._regtable[register] = userreg._default_handler()
+ end
+
+ if action == "yank" then
+ userreg._regtable[register]:do_yank(content)
+ return nil
+ else
+ return userreg._regtable[register]:do_put()
+ end
+end
+
+-- Registers a handler with a register. Future yanks and puts will defer to the
+-- handler when determining the content to put/yank.
+function userreg.register_handler(register, handler)
+ userreg._regtable[register] = handler
+end
+
+return userreg
diff --git a/runtime/lua/vim/version.lua b/runtime/lua/vim/version.lua
index 306eef90d3..0b149700b5 100644
--- a/runtime/lua/vim/version.lua
+++ b/runtime/lua/vim/version.lua
@@ -1,6 +1,5 @@
---- @defgroup vim.version
----
---- @brief The \`vim.version\` module provides functions for comparing versions and ranges
+--- @brief
+--- The `vim.version` module provides functions for comparing versions and ranges
--- conforming to the https://semver.org spec. Plugins, and plugin managers, can use this to check
--- available tools and dependencies on the current system.
---
@@ -13,9 +12,9 @@
--- end
--- ```
---
---- \*vim.version()\* returns the version of the current Nvim process.
+--- [vim.version()]() returns the version of the current Nvim process.
---
---- VERSION RANGE SPEC \*version-range\*
+--- VERSION RANGE SPEC [version-range]()
---
--- A version "range spec" defines a semantic version range which can be tested against a version,
--- using |vim.version.range()|.
@@ -55,7 +54,8 @@
local M = {}
----@class Version
+---@nodoc
+---@class vim.Version
---@field [1] number
---@field [2] number
---@field [3] number
@@ -69,6 +69,8 @@ Version.__index = Version
--- Compares prerelease strings: per semver, number parts must be must be treated as numbers:
--- "pre1.10" is greater than "pre1.2". https://semver.org/#spec-item-11
+---@param prerel1 string?
+---@param prerel2 string?
local function cmp_prerel(prerel1, prerel2)
if not prerel1 or not prerel2 then
return prerel1 and -1 or (prerel2 and 1 or 0)
@@ -78,8 +80,8 @@ local function cmp_prerel(prerel1, prerel2)
local iter1 = prerel1:gmatch('([^0-9]*)(%d*)')
local iter2 = prerel2:gmatch('([^0-9]*)(%d*)')
while true do
- local word1, n1 = iter1()
- local word2, n2 = iter2()
+ local word1, n1 = iter1() --- @type string?, string|number|nil
+ local word2, n2 = iter2() --- @type string?, string|number|nil
if word1 == nil and word2 == nil then -- Done iterating.
return 0
end
@@ -110,7 +112,7 @@ function Version:__newindex(key, value)
end
end
----@param other Version
+---@param other vim.Version
function Version:__eq(other)
for i = 1, 3 do
if self[i] ~= other[i] then
@@ -131,7 +133,7 @@ function Version:__tostring()
return ret
end
----@param other Version
+---@param other vim.Version
function Version:__lt(other)
for i = 1, 3 do
if self[i] > other[i] then
@@ -143,7 +145,7 @@ function Version:__lt(other)
return -1 == cmp_prerel(self.prerelease, other.prerelease)
end
----@param other Version
+---@param other vim.Version
function Version:__le(other)
return self < other or self == other
end
@@ -152,13 +154,13 @@ end
---
--- Creates a new Version object, or returns `nil` if `version` is invalid.
---
---- @param version string|number[]|Version
+--- @param version string|number[]|vim.Version
--- @param strict? boolean Reject "1.0", "0-x", "3.2a" or other non-conforming version strings
---- @return Version?
+--- @return vim.Version?
function M._version(version, strict) -- Adapted from https://github.com/folke/lazy.nvim
if type(version) == 'table' then
if version.major then
- return setmetatable(vim.deepcopy(version), Version)
+ return setmetatable(vim.deepcopy(version, true), Version)
end
return setmetatable({
major = version[1] or 0,
@@ -168,6 +170,7 @@ function M._version(version, strict) -- Adapted from https://github.com/folke/la
end
if not strict then -- TODO: add more "scrubbing".
+ --- @cast version string
version = version:match('%d[^ ]*')
end
@@ -201,7 +204,7 @@ end
---TODO: generalize this, move to func.lua
---
----@generic T: Version
+---@generic T: vim.Version
---@param versions T[]
---@return T?
function M.last(versions)
@@ -214,21 +217,22 @@ function M.last(versions)
return last
end
----@class VersionRange
----@field from Version
----@field to? Version
+---@class vim.VersionRange
+---@inlinedoc
+---@field from vim.Version
+---@field to? vim.Version
local VersionRange = {}
--- @private
---
----@param version string|Version
+---@param version string|vim.Version
function VersionRange:has(version)
if type(version) == 'string' then
---@diagnostic disable-next-line: cast-local-type
version = M.parse(version)
elseif getmetatable(version) ~= Version then
-- Need metatable to compare versions.
- version = setmetatable(vim.deepcopy(version), Version)
+ version = setmetatable(vim.deepcopy(version, true), Version)
end
if version then
if version.prerelease ~= self.from.prerelease then
@@ -259,16 +263,18 @@ end
--- print(r:has(vim.version())) -- check against current Nvim version
--- ```
---
---- Or use cmp(), eq(), lt(), and gt() to compare `.to` and `.from` directly:
+--- Or use cmp(), le(), lt(), ge(), gt(), and/or eq() to compare a version
+--- against `.to` and `.from` directly:
---
--- ```lua
---- local r = vim.version.range('1.0.0 - 2.0.0')
---- print(vim.version.gt({1,0,3}, r.from) and vim.version.lt({1,0,3}, r.to))
+--- local r = vim.version.range('1.0.0 - 2.0.0') -- >=1.0, <2.0
+--- print(vim.version.ge({1,0,3}, r.from) and vim.version.lt({1,0,3}, r.to))
--- ```
---
--- @see # https://github.com/npm/node-semver#ranges
---
--- @param spec string Version range "spec"
+--- @return vim.VersionRange?
function M.range(spec) -- Adapted from https://github.com/folke/lazy.nvim
if spec == '*' or spec == '' then
return setmetatable({ from = M.parse('0.0.0') }, { __index = VersionRange })
@@ -297,8 +303,9 @@ function M.range(spec) -- Adapted from https://github.com/folke/lazy.nvim
local semver = M.parse(version)
if semver then
- local from = semver
- local to = vim.deepcopy(semver)
+ local from = semver --- @type vim.Version?
+ local to = vim.deepcopy(semver, true) --- @type vim.Version?
+ ---@diagnostic disable: need-check-nil
if mods == '' or mods == '=' then
to.patch = to.patch + 1
elseif mods == '<' then
@@ -308,9 +315,9 @@ function M.range(spec) -- Adapted from https://github.com/folke/lazy.nvim
to.patch = to.patch + 1
elseif mods == '>' then
from.patch = from.patch + 1
- to = nil ---@diagnostic disable-line: cast-local-type
+ to = nil
elseif mods == '>=' then
- to = nil ---@diagnostic disable-line: cast-local-type
+ to = nil
elseif mods == '~' then
if #parts >= 2 then
to[2] = to[2] + 1
@@ -331,11 +338,12 @@ function M.range(spec) -- Adapted from https://github.com/folke/lazy.nvim
end
end
end
+ ---@diagnostic enable: need-check-nil
return setmetatable({ from = from, to = to }, { __index = VersionRange })
end
end
----@param v string|Version
+---@param v string|vim.Version
---@return string
local function create_err_msg(v)
if type(v) == 'string' then
@@ -364,8 +372,8 @@ end
---
--- @note Per semver, build metadata is ignored when comparing two otherwise-equivalent versions.
---
----@param v1 Version|number[] Version object.
----@param v2 Version|number[] Version to compare with `v1`.
+---@param v1 vim.Version|number[]|string Version object.
+---@param v2 vim.Version|number[]|string Version to compare with `v1`.
---@return integer -1 if `v1 < v2`, 0 if `v1 == v2`, 1 if `v1 > v2`.
function M.cmp(v1, v2)
local v1_parsed = assert(M._version(v1), create_err_msg(v1))
@@ -380,24 +388,40 @@ function M.cmp(v1, v2)
end
---Returns `true` if the given versions are equal. See |vim.version.cmp()| for usage.
----@param v1 Version|number[]
----@param v2 Version|number[]
+---@param v1 vim.Version|number[]|string
+---@param v2 vim.Version|number[]|string
---@return boolean
function M.eq(v1, v2)
return M.cmp(v1, v2) == 0
end
+---Returns `true` if `v1 <= v2`. See |vim.version.cmp()| for usage.
+---@param v1 vim.Version|number[]|string
+---@param v2 vim.Version|number[]|string
+---@return boolean
+function M.le(v1, v2)
+ return M.cmp(v1, v2) <= 0
+end
+
---Returns `true` if `v1 < v2`. See |vim.version.cmp()| for usage.
----@param v1 Version|number[]
----@param v2 Version|number[]
+---@param v1 vim.Version|number[]|string
+---@param v2 vim.Version|number[]|string
---@return boolean
function M.lt(v1, v2)
return M.cmp(v1, v2) == -1
end
+---Returns `true` if `v1 >= v2`. See |vim.version.cmp()| for usage.
+---@param v1 vim.Version|number[]|string
+---@param v2 vim.Version|number[]|string
+---@return boolean
+function M.ge(v1, v2)
+ return M.cmp(v1, v2) >= 0
+end
+
---Returns `true` if `v1 > v2`. See |vim.version.cmp()| for usage.
----@param v1 Version|number[]
----@param v2 Version|number[]
+---@param v1 vim.Version|number[]|string
+---@param v2 vim.Version|number[]|string
---@return boolean
function M.gt(v1, v2)
return M.cmp(v1, v2) == 1
@@ -417,7 +441,7 @@ end
--- - strict (boolean): Default false. If `true`, no coercion is attempted on
--- input not conforming to semver v2.0.0. If `false`, `parse()` attempts to
--- coerce input such as "1.0", "0-x", "tmux 3.2a" into valid versions.
----@return table|nil parsed_version Version object or `nil` if input is invalid.
+---@return vim.Version? parsed_version Version object or `nil` if input is invalid.
function M.parse(version, opts)
assert(type(version) == 'string', create_err_msg(version))
opts = opts or { strict = false }
@@ -426,8 +450,9 @@ end
setmetatable(M, {
--- Returns the current Nvim version.
+ ---@return vim.Version
__call = function()
- local version = vim.fn.api_info().version
+ local version = vim.fn.api_info().version ---@type vim.Version
-- Workaround: vim.fn.api_info().version reports "prerelease" as a boolean.
version.prerelease = version.prerelease and 'dev' or nil
return setmetatable(version, Version)
diff --git a/runtime/lua/vim/vimhelp.lua b/runtime/lua/vim/vimhelp.lua
index a4d6a50b12..4af6866d48 100644
--- a/runtime/lua/vim/vimhelp.lua
+++ b/runtime/lua/vim/vimhelp.lua
@@ -2,26 +2,28 @@
local M = {}
--- Called when editing the doc/syntax.txt file
-function M.highlight_groups()
- local save_cursor = vim.fn.getcurpos()
-
- local start_lnum = vim.fn.search([[\*highlight-groups\*]], 'c')
- if start_lnum == 0 then
- return
- end
- local end_lnum = vim.fn.search('^======')
- if end_lnum == 0 then
- return
- end
-
+--- Apply current colorscheme to lists of default highlight groups
+---
+--- Note: {patterns} is assumed to be sorted by occurrence in the file.
+--- @param patterns {start:string,stop:string,match:string}[]
+function M.highlight_groups(patterns)
local ns = vim.api.nvim_create_namespace('vimhelp')
vim.api.nvim_buf_clear_namespace(0, ns, 0, -1)
- for lnum = start_lnum, end_lnum do
- local word = vim.api.nvim_buf_get_lines(0, lnum - 1, lnum, true)[1]:match('^(%w+)\t')
- if vim.fn.hlexists(word) ~= 0 then
- vim.api.nvim_buf_set_extmark(0, ns, lnum - 1, 0, { end_col = #word, hl_group = word })
+ local save_cursor = vim.fn.getcurpos()
+
+ for _, pat in pairs(patterns) do
+ local start_lnum = vim.fn.search(pat.start, 'c')
+ local end_lnum = vim.fn.search(pat.stop)
+ if start_lnum == 0 or end_lnum == 0 then
+ break
+ end
+
+ for lnum = start_lnum, end_lnum do
+ local word = vim.api.nvim_buf_get_lines(0, lnum - 1, lnum, true)[1]:match(pat.match)
+ if vim.fn.hlexists(word) ~= 0 then
+ vim.api.nvim_buf_set_extmark(0, ns, lnum - 1, 0, { end_col = #word, hl_group = word })
+ end
end
end
diff --git a/runtime/macros/less.vim b/runtime/macros/less.vim
index c99c636e59..8df29d96e6 100644
--- a/runtime/macros/less.vim
+++ b/runtime/macros/less.vim
@@ -1,6 +1,6 @@
" Vim script to work like "less"
" Maintainer: The Vim Project <https://github.com/vim/vim>
-" Last Change: 2023 Aug 10
+" Last Change: 2024 Feb 15
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" Avoid loading this file twice, allow the user to define his own script.
@@ -227,67 +227,181 @@ noremap q :q<CR>
" Switch to editing (switch off less mode)
map v :silent call <SID>End()<CR>
fun! s:End()
- set ma
+ set modifiable noreadonly
if exists('s:lz')
let &lz = s:lz
endif
- unmap h
- unmap H
- unmap <Space>
- unmap <C-V>
- unmap f
- unmap <C-F>
- unmap z
- unmap <Esc><Space>
- unmap F
- unmap d
- unmap <C-D>
- unmap <CR>
- unmap <C-N>
- unmap e
- unmap <C-E>
- unmap j
- unmap <C-J>
- unmap b
- unmap <C-B>
- unmap w
- unmap <Esc>v
- unmap u
- unmap <C-U>
- unmap k
- unmap y
- unmap <C-Y>
- unmap <C-P>
- unmap <C-K>
- unmap r
- unmap <C-R>
- unmap R
- unmap g
- unmap <
- unmap <Esc><
- unmap G
- unmap >
- unmap <Esc>>
- unmap %
- unmap p
- unmap n
- unmap N
- unmap q
- unmap v
- unmap /
- unmap ?
- unmap <Up>
- unmap <Down>
- unmap <PageDown>
- unmap <kPageDown>
- unmap <PageUp>
- unmap <kPageUp>
- unmap <S-Down>
- unmap <S-Up>
- unmap <Home>
- unmap <kHome>
- unmap <End>
- unmap <kEnd>
+ if !empty(maparg('h'))
+ unmap h
+ endif
+ if !empty(maparg('H'))
+ unmap H
+ endif
+ if !empty(maparg('<Space>'))
+ unmap <Space>
+ endif
+ if !empty(maparg('<C-V>'))
+ unmap <C-V>
+ endif
+ if !empty(maparg('f'))
+ unmap f
+ endif
+ if !empty(maparg('<C-F>'))
+ unmap <C-F>
+ endif
+ if !empty(maparg('z'))
+ unmap z
+ endif
+ if !empty(maparg('<Esc><Space>'))
+ unmap <Esc><Space>
+ endif
+ if !empty(maparg('F'))
+ unmap F
+ endif
+ if !empty(maparg('d'))
+ unmap d
+ endif
+ if !empty(maparg('<C-D>'))
+ unmap <C-D>
+ endif
+ if !empty(maparg('<CR>'))
+ unmap <CR>
+ endif
+ if !empty(maparg('<C-N>'))
+ unmap <C-N>
+ endif
+ if !empty(maparg('e'))
+ unmap e
+ endif
+ if !empty(maparg('<C-E>'))
+ unmap <C-E>
+ endif
+ if !empty(maparg('j'))
+ unmap j
+ endif
+ if !empty(maparg('<C-J>'))
+ unmap <C-J>
+ endif
+ if !empty(maparg('b'))
+ unmap b
+ endif
+ if !empty(maparg('<C-B>'))
+ unmap <C-B>
+ endif
+ if !empty(maparg('w'))
+ unmap w
+ endif
+ if !empty(maparg('<Esc>v'))
+ unmap <Esc>v
+ endif
+ if !empty(maparg('u'))
+ unmap u
+ endif
+ if !empty(maparg('<C-U>'))
+ unmap <C-U>
+ endif
+ if !empty(maparg('k'))
+ unmap k
+ endif
+ if !empty(maparg('y'))
+ unmap y
+ endif
+ if !empty(maparg('<C-Y>'))
+ unmap <C-Y>
+ endif
+ if !empty(maparg('<C-P>'))
+ unmap <C-P>
+ endif
+ if !empty(maparg('<C-K>'))
+ unmap <C-K>
+ endif
+ if !empty(maparg('r'))
+ unmap r
+ endif
+ if !empty(maparg('<C-R>'))
+ unmap <C-R>
+ endif
+ if !empty(maparg('R'))
+ unmap R
+ endif
+ if !empty(maparg('g'))
+ unmap g
+ endif
+ if !empty(maparg('<'))
+ unmap <
+ endif
+ if !empty(maparg('<Esc><'))
+ unmap <Esc><
+ endif
+ if !empty(maparg('G'))
+ unmap G
+ endif
+ if !empty(maparg('>'))
+ unmap >
+ endif
+ if !empty(maparg('<Esc>>'))
+ unmap <Esc>>
+ endif
+ if !empty(maparg('%'))
+ unmap %
+ endif
+ if !empty(maparg('p'))
+ unmap p
+ endif
+ if !empty(maparg('n'))
+ unmap n
+ endif
+ if !empty(maparg('N'))
+ unmap N
+ endif
+ if !empty(maparg('q'))
+ unmap q
+ endif
+ if !empty(maparg('v'))
+ unmap v
+ endif
+ if !empty(maparg('/'))
+ unmap /
+ endif
+ if !empty(maparg('?'))
+ unmap ?
+ endif
+ if !empty(maparg('<Up>'))
+ unmap <Up>
+ endif
+ if !empty(maparg('<Down>'))
+ unmap <Down>
+ endif
+ if !empty(maparg('<PageDown>'))
+ unmap <PageDown>
+ endif
+ if !empty(maparg('<kPageDown>'))
+ unmap <kPageDown>
+ endif
+ if !empty(maparg('<PageUp>'))
+ unmap <PageUp>
+ endif
+ if !empty(maparg('<kPageUp>'))
+ unmap <kPageUp>
+ endif
+ if !empty(maparg('<S-Down>'))
+ unmap <S-Down>
+ endif
+ if !empty(maparg('<S-Up>'))
+ unmap <S-Up>
+ endif
+ if !empty(maparg('<Home>'))
+ unmap <Home>
+ endif
+ if !empty(maparg('<kHome>'))
+ unmap <kHome>
+ endif
+ if !empty(maparg('<End>'))
+ unmap <End>
+ endif
+ if !empty(maparg('<kEnd>'))
+ unmap <kEnd>
+ endif
endfun
" vim: sw=2
diff --git a/runtime/makemenu.vim b/runtime/makemenu.vim
index 5d288e2f40..01f214cfa0 100644
--- a/runtime/makemenu.vim
+++ b/runtime/makemenu.vim
@@ -382,8 +382,10 @@ SynMenu M.MMIX:mmix
SynMenu M.Modconf:modconf
SynMenu M.Model:model
SynMenu M.Modsim\ III:modsim3
-SynMenu M.Modula\ 2:modula2
-SynMenu M.Modula\ 3:modula3
+SynMenu M.Modula-2.R10\ (2010):modula2:r10
+SynMenu M.Modula-2.ISO\ (1994):modula2:iso
+SynMenu M.Modula-2.PIM\ (1985):modula2:pim
+SynMenu M.Modula-3:modula3
SynMenu M.Monk:monk
SynMenu M.Motorola\ S-Record:srec
SynMenu M.Mplayer\ config:mplayerconf
diff --git a/runtime/mswin.vim b/runtime/mswin.vim
index 815667ead9..107a2acc2e 100644
--- a/runtime/mswin.vim
+++ b/runtime/mswin.vim
@@ -1,7 +1,7 @@
" Set options and add mapping such that Vim behaves a lot like MS-Windows
"
" Maintainer: The Vim Project <https://github.com/vim/vim>
-" Last Change: 2023 Aug 10
+" Last Change: 2024 Mar 3
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" Bail out if this isn't wanted.
@@ -27,7 +27,7 @@ set backspace=indent,eol,start whichwrap+=<,>,[,]
" backspace in Visual mode deletes selection
vnoremap <BS> d
-if has("clipboard")
+if has("clipboard_working")
" CTRL-X and SHIFT-Del are Cut
vnoremap <C-X> "+x
vnoremap <S-Del> "+x
@@ -42,6 +42,23 @@ if has("clipboard")
cmap <C-V> <C-R>+
cmap <S-Insert> <C-R>+
+else
+ " Use unnamed register while clipboard not exist
+
+ " CTRL-X and SHIFT-Del are Cut
+ vnoremap <C-X> x
+ vnoremap <S-Del> x
+
+ " CTRL-C and CTRL-Insert are Copy
+ vnoremap <C-C> y
+ vnoremap <C-Insert> y
+
+ " CTRL-V and SHIFT-Insert are Paste
+ noremap <C-V> gP
+ noremap <S-Insert> gP
+
+ inoremap <C-V> <C-R>"
+ inoremap <S-Insert> <C-R>"
endif
" Pasting blockwise and linewise selections is not possible in Insert and
@@ -50,7 +67,7 @@ endif
" Uses the paste.vim autoload script.
" Use CTRL-G u to have CTRL-Z only undo the paste.
-if 1
+if has("clipboard_working")
exe 'inoremap <script> <C-V> <C-G>u' . paste#paste_cmd['i']
exe 'vnoremap <script> <C-V> ' . paste#paste_cmd['v']
endif
diff --git a/runtime/nvim.appdata.xml b/runtime/nvim.appdata.xml
index 29db9d5ee4..bff8bc4bff 100644
--- a/runtime/nvim.appdata.xml
+++ b/runtime/nvim.appdata.xml
@@ -56,7 +56,7 @@
<launchable type="desktop-id">nvim.desktop</launchable>
<url type="homepage">https://neovim.io/</url>
<url type="bugtracker">https://github.com/neovim/neovim/issues</url>
- <url type="faq">https://github.com/neovim/neovim/wiki/FAQ</url>
+ <url type="faq">https://neovim.io/doc/user/faq.html</url>
<url type="help">https://neovim.io/doc/</url>
<url type="donation">https://neovim.io/#sponsor</url>
<url type="translate">https://github.com/neovim/neovim/tree/master/src/nvim/po</url>
diff --git a/runtime/pack/dist/opt/justify/plugin/justify.vim b/runtime/pack/dist/opt/justify/plugin/justify.vim
index 4ef3bf95fa..57be790423 100644
--- a/runtime/pack/dist/opt/justify/plugin/justify.vim
+++ b/runtime/pack/dist/opt/justify/plugin/justify.vim
@@ -80,7 +80,7 @@
" conformant with :left, :right and :center.
"
" If joinspaces is set, an extra space is added after '.', '?' and '!'.
-" If 'cpooptions' include 'j', extra space is only added after '.'.
+" If 'cpoptions' include 'j', extra space is only added after '.'.
" (This may on occasion conflict with maxspaces.)
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index 1b5baa9a8b..a253acc63f 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -35,21 +35,14 @@
" The communication with gdb uses GDB/MI. See:
" https://sourceware.org/gdb/current/onlinedocs/gdb/GDB_002fMI.html
"
-" For neovim compatibility, the vim specific calls were replaced with neovim
-" specific calls:
-" term_start -> termopen
-" term_sendkeys -> chansend
-" term_getline -> getbufline
-" job_info && term_getjob -> using linux command ps to get the tty
-" balloon -> nvim floating window
+" NEOVIM COMPATIBILITY
"
-" The code for opening the floating window was taken from the beautiful
-" implementation of LanguageClient-Neovim:
-" https://github.com/autozimu/LanguageClient-neovim/blob/0ed9b69dca49c415390a8317b19149f97ae093fa/autoload/LanguageClient.vim#L304
-"
-" Neovim terminal also works seamlessly on windows, which is why the ability
-" Author: Bram Moolenaar
-" Copyright: Vim license applies, see ":help license"
+" The vim specific functionalities were replaced with neovim specific calls:
+" - term_start -> termopen
+" - term_sendkeys -> chansend
+" - term_getline -> getbufline
+" - job_info && term_getjob -> nvim_get_chan_info
+" - balloon -> vim.lsp.util.open_floating_preview
" In case this gets sourced twice.
if exists(':Termdebug')
@@ -985,6 +978,7 @@ func s:InstallCommands()
set cpo&vim
command -nargs=? Break call s:SetBreakpoint(<q-args>)
+ command -nargs=? Tbreak call s:SetBreakpoint(<q-args>, v:true)
command Clear call s:ClearBreakpoint()
command Step call s:SendResumingCommand('-exec-step')
command Over call s:SendResumingCommand('-exec-next')
@@ -1093,6 +1087,7 @@ endfunc
" Delete installed debugger commands in the current window.
func s:DeleteCommands()
delcommand Break
+ delcommand Tbreak
delcommand Clear
delcommand Step
delcommand Over
@@ -1193,7 +1188,7 @@ func s:Until(at)
endfunc
" :Break - Set a breakpoint at the cursor position.
-func s:SetBreakpoint(at)
+func s:SetBreakpoint(at, tbreak=v:false)
" Setting a breakpoint may not work while the program is running.
" Interrupt to make it work.
let do_continue = 0
@@ -1206,7 +1201,12 @@ func s:SetBreakpoint(at)
" Use the fname:lnum format, older gdb can't handle --source.
let at = empty(a:at) ?
\ fnameescape(expand('%:p')) . ':' . line('.') : a:at
- call s:SendCommand('-break-insert ' . at)
+ if a:tbreak
+ let cmd = '-break-insert -t ' . at
+ else
+ let cmd = '-break-insert ' . at
+ endif
+ call s:SendCommand(cmd)
if do_continue
Continue
endif
@@ -1306,7 +1306,14 @@ endfunc
" :Evaluate - evaluate what is specified / under the cursor
func s:Evaluate(range, arg)
+ if s:eval_float_win_id > 0 && nvim_win_is_valid(s:eval_float_win_id)
+ \ && a:range == 0 && empty(a:arg)
+ call nvim_set_current_win(s:eval_float_win_id)
+ return
+ endif
let expr = s:GetEvaluationExpression(a:range, a:arg)
+ let s:evalFromBalloonExpr = 1
+ let s:evalFromBalloonExprResult = ''
let s:ignoreEvalError = 0
call s:SendEval(expr)
endfunc
@@ -1363,6 +1370,8 @@ let s:ignoreEvalError = 0
let s:evalFromBalloonExpr = 0
let s:evalFromBalloonExprResult = ''
+let s:eval_float_win_id = -1
+
" Handle the result of data-evaluate-expression
func s:HandleEvaluate(msg)
let value = a:msg
@@ -1385,9 +1394,15 @@ func s:HandleEvaluate(msg)
else
let s:evalFromBalloonExprResult .= ' = ' . value
endif
- let s:evalFromBalloonExprResult = split(s:evalFromBalloonExprResult, '\\n')
- call s:OpenHoverPreview(s:evalFromBalloonExprResult, v:null)
- let s:evalFromBalloonExprResult = ''
+ " NEOVIM:
+ " - Result pretty-printing is not implemented. Vim prettifies the result
+ " with balloon_split(), which is not ported to nvim.
+ " - Manually implement window focusing. Sometimes the result of pointer
+ " evaluation arrives in two separate messages, one for the address
+ " itself and the other for the value in that address. So with the stock
+ " focus option, the second message will focus the window containing the
+ " first message.
+ let s:eval_float_win_id = luaeval('select(2, vim.lsp.util.open_floating_preview(_A))', [s:evalFromBalloonExprResult])
else
echomsg '"' . s:evalexpr . '": ' . value
endif
@@ -1396,132 +1411,9 @@ func s:HandleEvaluate(msg)
" Looks like a pointer, also display what it points to.
let s:ignoreEvalError = 1
call s:SendEval('*' . s:evalexpr)
- else
- let s:evalFromBalloonExprResult = ''
endif
endfunc
-function! s:ShouldUseFloatWindow() abort
- if exists('*nvim_open_win') && (get(g:, 'termdebug_useFloatingHover', 1) == 1)
- return v:true
- else
- return v:false
- endif
-endfunction
-
-function! s:CloseFloatingHoverOnCursorMove(win_id, opened) abort
- if getpos('.') == a:opened
- " Just after opening floating window, CursorMoved event is run.
- " To avoid closing floating window immediately, check the cursor
- " was really moved
- return
- endif
- autocmd! nvim_termdebug_close_hover
- let winnr = win_id2win(a:win_id)
- if winnr == 0
- return
- endif
- call nvim_win_close(a:win_id, v:true)
-endfunction
-
-function! s:CloseFloatingHoverOnBufEnter(win_id, bufnr) abort
- let winnr = win_id2win(a:win_id)
- if winnr == 0
- " Float window was already closed
- autocmd! nvim_termdebug_close_hover
- return
- endif
- if winnr == winnr()
- " Cursor is moving into floating window. Do not close it
- return
- endif
- if bufnr('%') == a:bufnr
- " When current buffer opened hover window, it's not another buffer. Skipped
- return
- endif
- autocmd! nvim_termdebug_close_hover
- call nvim_win_close(a:win_id, v:true)
-endfunction
-
-" Open preview window. Window is open in:
-" - Floating window on Neovim (0.4.0 or later)
-" - Preview window on Neovim (0.3.0 or earlier) or Vim
-function! s:OpenHoverPreview(lines, filetype) abort
- " Use local variable since parameter is not modifiable
- let lines = a:lines
- let bufnr = bufnr('%')
-
- let use_float_win = s:ShouldUseFloatWindow()
- if use_float_win
- let pos = getpos('.')
-
- " Calculate width and height
- let width = 0
- for index in range(len(lines))
- let line = lines[index]
- let lw = strdisplaywidth(line)
- if lw > width
- let width = lw
- endif
- let lines[index] = line
- endfor
-
- let height = len(lines)
-
- " Calculate anchor
- " Prefer North, but if there is no space, fallback into South
- let bottom_line = line('w0') + winheight(0) - 1
- if pos[1] + height <= bottom_line
- let vert = 'N'
- let row = 1
- else
- let vert = 'S'
- let row = 0
- endif
-
- " Prefer West, but if there is no space, fallback into East
- if pos[2] + width <= &columns
- let hor = 'W'
- let col = 0
- else
- let hor = 'E'
- let col = 1
- endif
-
- let buf = nvim_create_buf(v:false, v:true)
- call nvim_buf_set_lines(buf, 0, -1, v:true, lines)
- " using v:true for second argument of nvim_open_win make the floating
- " window disappear
- let float_win_id = nvim_open_win(buf, v:false, {
- \ 'relative': 'cursor',
- \ 'anchor': vert . hor,
- \ 'row': row,
- \ 'col': col,
- \ 'width': width,
- \ 'height': height,
- \ 'style': 'minimal',
- \ })
-
- if a:filetype isnot v:null
- call nvim_set_option_value('filetype', a:filetype, { 'win' : float_win_id })
- endif
-
- call nvim_set_option_value('modified', v:false, { 'buf' : buf })
- call nvim_set_option_value('modifiable', v:false, { 'buf' : buf })
-
- " Unlike preview window, :pclose does not close window. Instead, close
- " hover window automatically when cursor is moved.
- let call_after_move = printf('<SID>CloseFloatingHoverOnCursorMove(%d, %s)', float_win_id, string(pos))
- let call_on_bufenter = printf('<SID>CloseFloatingHoverOnBufEnter(%d, %d)', float_win_id, bufnr)
- augroup nvim_termdebug_close_hover
- execute 'autocmd CursorMoved,CursorMovedI,InsertEnter <buffer> call ' . call_after_move
- execute 'autocmd BufEnter * call ' . call_on_bufenter
- augroup END
- else
- echomsg a:lines[0]
- endif
-endfunction
-
" Handle an error.
func s:HandleError(msg)
if s:ignoreEvalError
diff --git a/runtime/plugin/netrwPlugin.vim b/runtime/plugin/netrwPlugin.vim
index a347781e6f..ed6f7dc008 100644
--- a/runtime/plugin/netrwPlugin.vim
+++ b/runtime/plugin/netrwPlugin.vim
@@ -1,7 +1,8 @@
" netrwPlugin.vim: Handles file transfer and remote directory listing across a network
" PLUGIN SECTION
+" Maintainer: This runtime file is looking for a new maintainer.
" Date: Feb 09, 2021
-" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
+" Former Maintainer: Charles E Campbell
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
" Copyright: Copyright (C) 1999-2021 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
diff --git a/runtime/plugin/osc52.lua b/runtime/plugin/osc52.lua
index 374b70066f..7ffd64342e 100644
--- a/runtime/plugin/osc52.lua
+++ b/runtime/plugin/osc52.lua
@@ -1,12 +1,20 @@
-local tty = vim.iter(vim.api.nvim_list_uis()):any(function(ui)
- return ui.chan == 1 and ui.stdout_tty
-end)
+local tty = false
+for _, ui in ipairs(vim.api.nvim_list_uis()) do
+ if ui.chan == 1 and ui.stdout_tty then
+ tty = true
+ break
+ end
+end
if not tty or vim.g.clipboard ~= nil or vim.o.clipboard ~= '' or not os.getenv('SSH_TTY') then
return
end
-require('vim.termcap').query('Ms', function(cap, seq)
+require('vim.termcap').query('Ms', function(cap, found, seq)
+ if not found then
+ return
+ end
+
assert(cap == 'Ms')
-- Check 'clipboard' and g:clipboard again to avoid a race condition
@@ -16,7 +24,7 @@ require('vim.termcap').query('Ms', function(cap, seq)
-- If the terminal reports a sequence other than OSC 52 for the Ms capability
-- then ignore it. We only support OSC 52 (for now)
- if not seq:match('^\027%]52') then
+ if not seq or not seq:match('^\027%]52') then
return
end
diff --git a/runtime/plugin/tarPlugin.vim b/runtime/plugin/tarPlugin.vim
index 384a3ed823..26a994aee5 100644
--- a/runtime/plugin/tarPlugin.vim
+++ b/runtime/plugin/tarPlugin.vim
@@ -45,7 +45,7 @@ augroup tar
au BufReadCmd *.tar.xz call tar#Browse(expand("<amatch>"))
au BufReadCmd *.txz call tar#Browse(expand("<amatch>"))
au BufReadCmd *.tar.zst call tar#Browse(expand("<amatch>"))
- au BufReadCmd *.tzs call tar#Browse(expand("<amatch>"))
+ au BufReadCmd *.tzst call tar#Browse(expand("<amatch>"))
augroup END
" ---------------------------------------------------------------------
diff --git a/runtime/plugin/tohtml.lua b/runtime/plugin/tohtml.lua
new file mode 100644
index 0000000000..79f2794a40
--- /dev/null
+++ b/runtime/plugin/tohtml.lua
@@ -0,0 +1,12 @@
+if vim.g.loaded_2html_plugin ~= nil then
+ return
+end
+vim.g.loaded_2html_plugin = true
+
+vim.api.nvim_create_user_command('TOhtml', function(args)
+ local outfile = args.args ~= '' and args.args or vim.fn.tempname() .. '.html'
+ local html = require('tohtml').tohtml()
+ vim.fn.writefile(html, outfile)
+ vim.cmd.split(outfile)
+ vim.bo.filetype = 'html'
+end, { bar = true, nargs = '?' })
diff --git a/runtime/plugin/tohtml.vim b/runtime/plugin/tohtml.vim
deleted file mode 100644
index 56eb2c15bf..0000000000
--- a/runtime/plugin/tohtml.vim
+++ /dev/null
@@ -1,254 +0,0 @@
-" Vim plugin for converting a syntax highlighted file to HTML.
-" Maintainer: Ben Fritz <fritzophrenic@gmail.com>
-" Last Change: 2023 Sep 07
-"
-" The core of the code is in $VIMRUNTIME/autoload/tohtml.vim and
-" $VIMRUNTIME/syntax/2html.vim
-"
-if exists('g:loaded_2html_plugin')
- finish
-endif
-let g:loaded_2html_plugin = 'vim9.0_v2'
-
-"
-" Changelog: {{{
-" 9.0_v2 (this version): - Warn if using deprecated g:use_xhtml option
-" - Change default g:html_use_input_for_pc to "none"
-" instead of "fallback". All modern browsers support
-" the "user-select: none" and "content:" CSS
-" properties so the older method relying on extra
-" markup and unspecified browser/app clipboard
-" handling is only needed in rare special cases.
-" - Fix SourceForge issue #33: generate diff filler
-" correctly when new lines have been added to or
-" removed from end of buffer.
-" - Fix SourceForge issue #32/Vim Github issue #8547:
-" use translated highlight ID for styling the
-" special-use group names (e.g. LineNr) used
-" directly by name in the 2html processing.
-" - Fix SourceForge issue #26, refactoring to use
-" :let-heredoc style string assignment and
-" additional fixes for ".." vs. "." style string
-" concatenation. Requires Vim v8.1.1354 or higher.
-" 9.0_v1 (Vim 9.0.1275): - Implement g:html_no_doc and g:html_no_modeline
-" for diff mode. Add tests.
-" (Vim 9.0.1122): NOTE: no version string update for this version!
-" - Bugfix for variable name in g:html_no_doc
-" (Vim 9.0.0819): NOTE: no version string update for this version!
-" - Add options g:html_no_doc, g:html_no_lines,
-" and g:html_no_modeline (partially included in Vim
-" runtime prior to version string update).
-" - Updates for new Vim9 string append style (i.e. use
-" ".." instead of "."). Requires Vim version
-" 8.1.1114 or higher.
-"
-" 8.1 updates: {{{
-" 8.1_v2 (Vim 8.1.2312): - Fix SourceForge issue #19: fix calculation of tab
-" stop position to use in expanding a tab, when that
-" tab occurs after a syntax match which in turn
-" comes after previously expanded tabs.
-" - Set eventignore while splitting a window for the
-" destination file to ignore FileType events;
-" speeds up processing when the destination file
-" already exists and HTML highlight takes too long.
-" - Fix SourceForge issue #20: progress bar could not be
-" seen when DiffDelete background color matched
-" StatusLine background color. Added TOhtmlProgress
-" highlight group for manual user override, but
-" calculate it to be visible compared to StatusLine
-" by default.
-" - Fix SourceForge issue #1: Remove workaround for old
-" browsers which don't support 'ch' CSS unit, since
-" all modern browsers, including IE>=9, support it.
-" - Fix SourceForge issue #10: support termguicolors
-" - Fix SourceForge issue #21: default to using
-" generated content instead of <input> tags for
-" uncopyable text, so that text is correctly
-" prevented from being copied in chrome. Use
-" g:html_use_input_for_pc option to control the
-" method used.
-" - Switch to HTML5 to allow using vnu as a validator
-" in unit test.
-" - Fix fallback sizing of <input> tags for browsers
-" without "ch" support.
-" - Fix cursor on unselectable diff filler text.
-" 8.1_v1 (Vim 8.1.0528): - Fix SourceForge issue #6: Don't generate empty
-" script tag.
-" - Fix SourceForge issue #5: javascript should
-" declare variables with "var".
-" - Fix SourceForge issue #13: errors thrown sourcing
-" 2html.vim directly when plugins not loaded.
-" - Fix SourceForge issue #16: support 'vartabstop'.
-"}}}
-"
-" 7.4 updates: {{{
-" 7.4_v2 (Vim 7.4.0899): Fix error raised when converting a diff containing
-" an empty buffer. Jan Stocker: allow g:html_font to
-" take a list so it is easier to specfiy fallback
-" fonts in the generated CSS.
-" 7.4_v1 (Vim 7.4.0000): Fix modeline mangling for new "Vim:" format, and
-" also for version-specific modelines like "vim>703:".
-"}}}
-"
-" 7.3 updates: {{{
-" 7.3_v14 (Vim 7.3.1246): Allow suppressing line number anchors using
-" g:html_line_ids=0. Allow customizing
-" important IDs (like line IDs and fold IDs) using
-" g:html_id_expr evaluated when the buffer conversion
-" is started.
-" 7.3_v13 (Vim 7.3.1088): Keep foldmethod at manual in the generated file and
-" insert modeline to set it to manual.
-" Fix bug: diff mode with 2 unsaved buffers creates a
-" duplicate of one buffer instead of including both.
-" Add anchors to each line so you can put '#L123'
-" or '#123' at the end of the URL to jump to line 123
-" (idea by Andy Spencer). Add javascript to open folds
-" to show the anchor being jumped to if it is hidden.
-" Fix XML validation error: &nsbp; not part of XML.
-" Allow TOhtml to chain together with other commands
-" using |.
-" 7.3_v12 (Vim 7.3.0616): Fix modeline mangling to also work for when multiple
-" highlight groups make up the start-of-modeline text.
-" Improve render time of page with uncopyable regions
-" by not using one-input-per-char. Change name of
-" uncopyable option from html_unselectable to
-" html_prevent_copy. Added html_no_invalid option and
-" default to inserting invalid markup for uncopyable
-" regions to prevent MS Word from pasting undeletable
-" <input> elements. Fix 'cpo' handling (Thilo Six).
-" 7.3_v12b1: Add html_unselectable option. Rework logic to
-" eliminate post-processing substitute commands in
-" favor of doing the work up front. Remove unnecessary
-" special treatment of 'LineNr' highlight group. Minor
-" speed improvements. Fix modeline mangling in
-" generated output so it works for text in the first
-" column. Fix missing line number and fold column in
-" diff filler lines. Fix that some fonts have a 1px
-" gap (using a dirty hack, improvements welcome). Add
-" "colorscheme" meta tag. Does NOT include support for
-" the new default foldtext added in v11, as the patch
-" adding it has not yet been included in Vim.
-" 7.3_v11 ( unreleased ): Support new default foldtext from patch by Christian
-" Brabandt in
-" http://groups.google.com/d/topic/vim_dev/B6FSGfq9VoI/discussion.
-" This patch has not yet been included in Vim, thus
-" these changes are removed in the next version.
-" 7.3_v10 (Vim 7.3.0227): Fix error E684 when converting a range wholly inside
-" multiple nested folds with dynamic folding on.
-" Also fix problem with foldtext in this situation.
-" 7.3_v9 (Vim 7.3.0170): Add html_pre_wrap option active with html_use_css
-" and without html_no_pre, default value same as
-" 'wrap' option, (Andy Spencer). Don't use
-" 'fileencoding' for converted document encoding if
-" 'buftype' indicates a special buffer which isn't
-" written.
-" 7.3_v8 (Vim 7.3.0100): Add html_expand_tabs option to allow leaving tab
-" characters in generated output (Andy Spencer).
-" Escape text that looks like a modeline so Vim
-" doesn't use anything in the converted HTML as a
-" modeline. Bugfixes: Fix folding when a fold starts
-" before the conversion range. Remove fold column when
-" there are no folds.
-" 7.3_v7 (Vim 7-3-0063): see betas released on vim_dev below:
-" 7.3_v7b3: Fixed bug, convert Unicode to UTF-8 all the way.
-" 7.3_v7b2: Remove automatic detection of encodings that are not
-" supported by all major browsers according to
-" http://wiki.whatwg.org/wiki/Web_Encodings and
-" convert to UTF-8 for all Unicode encodings. Make
-" HTML encoding to Vim encoding detection be
-" case-insensitive for built-in pairs.
-" 7.3_v7b1: Remove use of setwinvar() function which cannot be
-" called in restricted mode (Andy Spencer). Use
-" 'fencoding' instead of 'encoding' to determine by
-" charset, and make sure the 'fenc' of the generated
-" file matches its indicated charset. Add charsets for
-" all of Vim's natively supported encodings.
-" 7.3_v6 (Vim 7.3.0000): Really fix bug with 'nowrapscan', 'magic' and other
-" user settings interfering with diff mode generation,
-" trailing whitespace (e.g. line number column) when
-" using html_no_pre, and bugs when using
-" html_hover_unfold.
-" 7.3_v5 ( unreleased ): Fix bug with 'nowrapscan' and also with out-of-sync
-" folds in diff mode when first line was folded.
-" 7.3_v4 (Vim 7.3.0000): Bugfixes, especially for xhtml markup, and diff mode
-" 7.3_v3 (Vim 7.3.0000): Refactor option handling and make html_use_css
-" default to true when not set to anything. Use strict
-" doctypes where possible. Rename use_xhtml option to
-" html_use_xhtml for consistency. Use .xhtml extension
-" when using this option. Add meta tag for settings.
-" 7.3_v2 (Vim 7.3.0000): Fix syntax highlighting in diff mode to use both the
-" diff colors and the normal syntax colors
-" 7.3_v1 (Vim 7.3.0000): Add conceal support and meta tags in output
-"}}}
-"}}}
-
-" TODO: {{{
-" * Check the issue tracker:
-" https://sourceforge.net/p/vim-tohtml/issues/search/?q=%21status%3Aclosed
-" * Options for generating the CSS in external style sheets. New :TOcss
-" command to convert the current color scheme into a (mostly) generic CSS
-" stylesheet which can be re-used. Alternate stylesheet support? Good start
-" by Erik Falor
-" ( https://groups.google.com/d/topic/vim_use/7XTmC4D22dU/discussion ).
-" * Add optional argument to :TOhtml command to specify mode (gui, cterm,
-" term) to use for the styling. Suggestion by "nacitar".
-" * Add way to override or specify which RGB colors map to the color numbers
-" in cterm. Get better defaults than just guessing? Suggestion by "nacitar".
-" * Disable filetype detection until after all processing is done.
-" * Add option for not generating the hyperlink on stuff that looks like a
-" URL? Or just color the link to fit with the colorscheme (and only special
-" when hovering)?
-" * Bug: Opera does not allow printing more than one page if uncopyable
-" regions is turned on. Possible solution: Add normal text line numbers with
-" display:none, set to display:inline for print style sheets, and hide
-" <input> elements for print, to allow Opera printing multiple pages (and
-" other uncopyable areas?). May need to make the new text invisible to IE
-" with conditional comments to prevent copying it, IE for some reason likes
-" to copy hidden text. Other browsers too?
-" * Bug: still a 1px gap throughout the fold column when html_prevent_copy is
-" "fn" in some browsers. Specifically, in Chromium on Ubuntu (but not Chrome
-" on Windows). Perhaps it is font related?
-" * Bug: still some gaps in the fold column when html_prevent_copy contains
-" 'd' and showing the whole diff (observed in multiple browsers). Only gaps
-" on diff lines though.
-" * Undercurl support via CSS3, with fallback to dotted or something:
-" https://groups.google.com/d/topic/vim_use/BzXA6He1pHg/discussion
-" * Redo updates for modified default foldtext (v11) when/if the patch is
-" accepted to modify it.
-" * Test case +diff_one_file-dynamic_folds+expand_tabs-hover_unfold
-" +ignore_conceal-ignore_folding+no_foldcolumn+no_pre+no_progress
-" +number_lines-pre_wrap-use_css+use_xhtml+whole_filler.xhtml
-" does not show the whole diff filler as it is supposed to?
-" * Bug: when 'isprint' is wrong for the current encoding, will generate
-" invalid content. Can/should anything be done about this? Maybe a separate
-" plugin to correct 'isprint' based on encoding?
-" * Check to see if the windows-125\d encodings actually work in Unix without
-" the 8bit- prefix. Add prefix to autoload dictionaries for Unix if not.
-" * Font auto-detection similar to
-" http://www.vim.org/scripts/script.php?script_id=2384 but for a variety of
-" platforms.
-" * Pull in code from http://www.vim.org/scripts/script.php?script_id=3113 :
-" - listchars support
-" - full-line background highlight
-" - other?
-" * Make it so deleted lines in a diff don't create side-scrolling (get it
-" free with full-line background highlight above).
-" * Restore open/closed folds and cursor position after processing each file
-" with option not to restore for speed increase.
-" * Add extra meta info (generation time, etc.)?
-" * Tidy up so we can use strict doctype in even more situations
-" * Implementation detail: add threshold for writing the lines to the html
-" buffer before we're done (5000 or so lines should do it)
-" * TODO comments for code cleanup scattered throughout
-"}}}
-
-" Define the :TOhtml command when:
-" - 'compatible' is not set
-" - this plugin or user override was not already loaded
-" - user commands are available. {{{
-if !&cp && !exists(":TOhtml") && has("user_commands")
- command -range=% -bar TOhtml :call tohtml#Convert2HTML(<line1>, <line2>)
-endif "}}}
-
-" Make sure any patches will probably use consistent indent
-" vim: ts=8 sw=2 sts=2 noet fdm=marker
diff --git a/runtime/plugin/userreg.vim b/runtime/plugin/userreg.vim
new file mode 100644
index 0000000000..099e7c65cb
--- /dev/null
+++ b/runtime/plugin/userreg.vim
@@ -0,0 +1 @@
+set userregfunc=userreg#func
diff --git a/runtime/plugin/zipPlugin.vim b/runtime/plugin/zipPlugin.vim
index c3118a361d..2af119bbcb 100644
--- a/runtime/plugin/zipPlugin.vim
+++ b/runtime/plugin/zipPlugin.vim
@@ -1,7 +1,8 @@
" zipPlugin.vim: Handles browsing zipfiles
" PLUGIN PORTION
" Date: Dec 07, 2021
-" Maintainer: Charles E Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Charles E Campbell
" License: Vim License (see vim's :help license)
" Copyright: Copyright (C) 2005-2016 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
diff --git a/runtime/queries/bash/folds.scm b/runtime/queries/bash/folds.scm
index 851c67eed4..766dbe598b 100644
--- a/runtime/queries/bash/folds.scm
+++ b/runtime/queries/bash/folds.scm
@@ -5,4 +5,5 @@
(for_statement)
(while_statement)
(c_style_for_statement)
+ (heredoc_redirect)
] @fold
diff --git a/runtime/queries/bash/highlights.scm b/runtime/queries/bash/highlights.scm
index 23bf03e697..b4360ce7e1 100644
--- a/runtime/queries/bash/highlights.scm
+++ b/runtime/queries/bash/highlights.scm
@@ -1,81 +1,108 @@
-(simple_expansion) @none
-(expansion
- "${" @punctuation.special
- "}" @punctuation.special) @none
[
- "("
- ")"
- "(("
- "))"
- "{"
- "}"
- "["
- "]"
- "[["
- "]]"
- ] @punctuation.bracket
+ "("
+ ")"
+ "{"
+ "}"
+ "["
+ "]"
+ "[["
+ "]]"
+ "(("
+ "))"
+] @punctuation.bracket
[
- ";"
- ";;"
- (heredoc_start)
- ] @punctuation.delimiter
+ ";"
+ ";;"
+ ";&"
+ ";;&"
+ "&"
+] @punctuation.delimiter
[
- "$"
-] @punctuation.special
-
+ ">"
+ ">>"
+ "<"
+ "<<"
+ "&&"
+ "|"
+ "|&"
+ "||"
+ "="
+ "+="
+ "=~"
+ "=="
+ "!="
+ "&>"
+ "&>>"
+ "<&"
+ ">&"
+ ">|"
+ "<&-"
+ ">&-"
+ "<<-"
+ "<<<"
+ ".."
+ "!"
+] @operator
+
+; Do *not* spell check strings since they typically have some sort of
+; interpolation in them, or, are typically used for things like filenames, URLs,
+; flags and file content.
[
- ">"
- ">>"
- "<"
- "<<"
- "&"
- "&&"
- "|"
- "||"
- "="
- "=~"
- "=="
- "!="
- ] @operator
+ (string)
+ (raw_string)
+ (ansi_c_string)
+ (heredoc_body)
+] @string
[
- (string)
- (raw_string)
- (ansi_c_string)
- (heredoc_body)
-] @string @spell
+ (heredoc_start)
+ (heredoc_end)
+] @label
+
+(variable_assignment
+ (word) @string)
+
+(command
+ argument: "$" @string) ; bare dollar
-(variable_assignment (word) @string)
+(concatenation
+ [
+ (simple_expansion)
+ (expansion)
+ ]
+ (word) @string)
[
- "if"
- "then"
- "else"
- "elif"
- "fi"
- "case"
- "in"
- "esac"
- ] @conditional
+ "if"
+ "then"
+ "else"
+ "elif"
+ "fi"
+ "case"
+ "in"
+ "esac"
+] @keyword.conditional
[
- "for"
- "do"
- "done"
- "select"
- "until"
- "while"
- ] @repeat
+ "for"
+ "do"
+ "done"
+ "select"
+ "until"
+ "while"
+] @keyword.repeat
[
- "declare"
- "export"
- "local"
- "readonly"
- "unset"
- ] @keyword
+ "declare"
+ "typeset"
+ "export"
+ "readonly"
+ "local"
+ "unset"
+ "unsetenv"
+] @keyword
"function" @keyword.function
@@ -83,28 +110,56 @@
; trap -l
((word) @constant.builtin
- (#match? @constant.builtin "^SIG(HUP|INT|QUIT|ILL|TRAP|ABRT|BUS|FPE|KILL|USR[12]|SEGV|PIPE|ALRM|TERM|STKFLT|CHLD|CONT|STOP|TSTP|TT(IN|OU)|URG|XCPU|XFSZ|VTALRM|PROF|WINCH|IO|PWR|SYS|RTMIN([+]([1-9]|1[0-5]))?|RTMAX(-([1-9]|1[0-4]))?)$"))
+ (#match? @constant.builtin "^SIG(HUP|INT|QUIT|ILL|TRAP|ABRT|BUS|FPE|KILL|USR[12]|SEGV|PIPE|ALRM|TERM|STKFLT|CHLD|CONT|STOP|TSTP|TT(IN|OU)|URG|XCPU|XFSZ|VTALRM|PROF|WINCH|IO|PWR|SYS|RTMIN([+]([1-9]|1[0-5]))?|RTMAX(-([1-9]|1[0-4]))?)$"))
((word) @boolean
(#any-of? @boolean "true" "false"))
(comment) @comment @spell
-(test_operator) @string
+
+(test_operator) @operator
(command_substitution
- [ "$(" ")" ] @punctuation.bracket)
+ "$(" @punctuation.bracket)
(process_substitution
- [ "<(" ")" ] @punctuation.bracket)
+ "<(" @punctuation.bracket)
+
+(arithmetic_expansion
+ [
+ "$(("
+ "(("
+ ] @punctuation.special
+ "))" @punctuation.special)
+
+(arithmetic_expansion
+ "," @punctuation.delimiter)
+
+(ternary_expression
+ [
+ "?"
+ ":"
+ ] @keyword.conditional.ternary)
+
+(binary_expression
+ operator: _ @operator)
+
+(unary_expression
+ operator: _ @operator)
+(postfix_expression
+ operator: _ @operator)
(function_definition
name: (word) @function)
-(command_name (word) @function.call)
+(command_name
+ (word) @function.call)
-((command_name (word) @function.builtin)
- (#any-of? @function.builtin
+((command_name
+ (word) @function.builtin)
+ ; format-ignore
+ (#any-of? @function.builtin
"alias" "bg" "bind" "break" "builtin" "caller" "cd"
"command" "compgen" "complete" "compopt" "continue"
"coproc" "dirs" "disown" "echo" "enable" "eval"
@@ -116,30 +171,59 @@
"ulimit" "umask" "unalias" "wait"))
(command
- argument: [
- (word) @parameter
- (concatenation (word) @parameter)
- ])
+ argument:
+ [
+ (word) @variable.parameter
+ (concatenation
+ (word) @variable.parameter)
+ ])
+
+(number) @number
((word) @number
(#lua-match? @number "^[0-9]+$"))
(file_redirect
- descriptor: (file_descriptor) @operator
- destination: (word) @parameter)
+ destination: (word) @variable.parameter)
+
+(file_descriptor) @operator
+
+(simple_expansion
+ "$" @punctuation.special) @none
+
+(expansion
+ "${" @punctuation.special
+ "}" @punctuation.special) @none
(expansion
- [ "${" "}" ] @punctuation.bracket)
+ operator: _ @punctuation.special)
+
+(expansion
+ "@"
+ .
+ operator: _ @character.special)
+
+((expansion
+ (subscript
+ index: (word) @character.special))
+ (#any-of? @character.special "@" "*"))
+
+"``" @punctuation.special
(variable_name) @variable
((variable_name) @constant
- (#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
+ (#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
(case_item
- value: (word) @parameter)
-
-(regex) @string.regex
+ value: (word) @variable.parameter)
-((program . (comment) @preproc)
- (#lua-match? @preproc "^#!/"))
+[
+ (regex)
+ (extglob_pattern)
+] @string.regexp
+
+((program
+ .
+ (comment) @keyword.directive)
+ (#lua-match? @keyword.directive "^#!/"))
diff --git a/runtime/queries/c/folds.scm b/runtime/queries/c/folds.scm
index 5a35334a24..2e2a6b4d0c 100644
--- a/runtime/queries/c/folds.scm
+++ b/runtime/queries/c/folds.scm
@@ -1,19 +1,21 @@
[
- (for_statement)
- (if_statement)
- (while_statement)
- (switch_statement)
- (case_statement)
- (function_definition)
- (struct_specifier)
- (enum_specifier)
- (comment)
- (preproc_if)
- (preproc_elif)
- (preproc_else)
- (preproc_ifdef)
- (initializer_list)
- (gnu_asm_expression)
+ (for_statement)
+ (if_statement)
+ (while_statement)
+ (do_statement)
+ (switch_statement)
+ (case_statement)
+ (function_definition)
+ (struct_specifier)
+ (enum_specifier)
+ (comment)
+ (preproc_if)
+ (preproc_elif)
+ (preproc_else)
+ (preproc_ifdef)
+ (preproc_function_def)
+ (initializer_list)
+ (gnu_asm_expression)
] @fold
(compound_statement
diff --git a/runtime/queries/c/highlights.scm b/runtime/queries/c/highlights.scm
index 29fb5747ca..c848f68dca 100644
--- a/runtime/queries/c/highlights.scm
+++ b/runtime/queries/c/highlights.scm
@@ -1,6 +1,9 @@
-; Lower priority to prefer @parameter when identifier appears in parameter_declaration.
-((identifier) @variable (#set! "priority" 95))
-(preproc_def (preproc_arg) @variable)
+; Lower priority to prefer @variable.parameter when identifier appears in parameter_declaration.
+((identifier) @variable
+ (#set! "priority" 95))
+
+(preproc_def
+ (preproc_arg) @variable)
[
"default"
@@ -17,7 +20,10 @@
"sizeof"
"offsetof"
] @keyword.operator
-(alignof_expression . _ @keyword.operator)
+
+(alignof_expression
+ .
+ _ @keyword.operator)
"return" @keyword.return
@@ -27,14 +33,14 @@
"do"
"continue"
"break"
-] @repeat
+] @keyword.repeat
[
- "if"
- "else"
- "case"
- "switch"
-] @conditional
+ "if"
+ "else"
+ "case"
+ "switch"
+] @keyword.conditional
[
"#if"
@@ -46,48 +52,54 @@
"#elifdef"
"#elifndef"
(preproc_directive)
-] @preproc
+] @keyword.directive
-"#define" @define
+"#define" @keyword.directive.define
-"#include" @include
+"#include" @keyword.import
-[ ";" ":" "," "::" ] @punctuation.delimiter
+[
+ ";"
+ ":"
+ ","
+ "::"
+] @punctuation.delimiter
"..." @punctuation.special
-[ "(" ")" "[" "]" "{" "}"] @punctuation.bracket
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
[
"="
-
"-"
"*"
"/"
"+"
"%"
-
"~"
"|"
"&"
"^"
"<<"
">>"
-
"->"
"."
-
"<"
"<="
">="
">"
"=="
"!="
-
"!"
"&&"
"||"
-
"-="
"+="
"*="
@@ -102,45 +114,57 @@
"++"
] @operator
-;; Make sure the comma operator is given a highlight group after the comma
-;; punctuator so the operator is highlighted properly.
-(comma_expression [ "," ] @operator)
+; Make sure the comma operator is given a highlight group after the comma
+; punctuator so the operator is highlighted properly.
+(comma_expression
+ "," @operator)
[
(true)
(false)
] @boolean
-(conditional_expression [ "?" ":" ] @conditional.ternary)
+(conditional_expression
+ [
+ "?"
+ ":"
+ ] @keyword.conditional.ternary)
(string_literal) @string
+
(system_lib_string) @string
+
(escape_sequence) @string.escape
(null) @constant.builtin
+
(number_literal) @number
+
(char_literal) @character
-((preproc_arg) @function.macro (#set! "priority" 90))
+((preproc_arg) @function.macro
+ (#set! "priority" 90))
+
(preproc_defined) @function.macro
-(((field_expression
- (field_identifier) @property)) @_parent
- (#not-has-parent? @_parent template_method function_declarator call_expression))
+((field_expression
+ (field_identifier) @property) @_parent
+ (#not-has-parent? @_parent template_method function_declarator call_expression))
(field_designator) @property
-(((field_identifier) @property)
- (#has-ancestor? @property field_declaration)
- (#not-has-ancestor? @property function_declarator))
+
+((field_identifier) @property
+ (#has-ancestor? @property field_declaration)
+ (#not-has-ancestor? @property function_declarator))
(statement_identifier) @label
[
- (type_identifier)
- (type_descriptor)
+ (type_identifier)
+ (type_descriptor)
] @type
-(storage_class_specifier) @storageclass
+(storage_class_specifier) @keyword.storage
[
(type_qualifier)
@@ -149,25 +173,32 @@
] @type.qualifier
(linkage_specification
- "extern" @storageclass)
+ "extern" @keyword.storage)
(type_definition
declarator: (type_identifier) @type.definition)
(primitive_type) @type.builtin
-(sized_type_specifier _ @type.builtin type: _?)
+(sized_type_specifier
+ _ @type.builtin
+ type: _?)
((identifier) @constant
- (#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
-(preproc_def (preproc_arg) @constant
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
+
+(preproc_def
+ (preproc_arg) @constant
+ (#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
+
(enumerator
name: (identifier) @constant)
+
(case_statement
value: (identifier) @constant)
((identifier) @constant.builtin
+ ; format-ignore
(#any-of? @constant.builtin
"stderr" "stdin" "stdout"
"__FILE__" "__LINE__" "__DATE__" "__TIME__"
@@ -180,7 +211,10 @@
"__clang_wide_literal_encoding__"
"__FUNCTION__" "__func__" "__PRETTY_FUNCTION__"
"__VA_ARGS__" "__VA_OPT__"))
-(preproc_def (preproc_arg) @constant.builtin
+
+(preproc_def
+ (preproc_arg) @constant.builtin
+ ; format-ignore
(#any-of? @constant.builtin
"stderr" "stdin" "stdout"
"__FILE__" "__LINE__" "__DATE__" "__TIME__"
@@ -195,21 +229,26 @@
"__VA_ARGS__" "__VA_OPT__"))
(attribute_specifier
- (argument_list (identifier) @variable.builtin))
+ (argument_list
+ (identifier) @variable.builtin))
+
((attribute_specifier
- (argument_list (call_expression
- function: (identifier) @variable.builtin))))
+ (argument_list
+ (call_expression
+ function: (identifier) @variable.builtin))))
((call_expression
function: (identifier) @function.builtin)
(#lua-match? @function.builtin "^__builtin_"))
+
((call_expression
- function: (identifier) @function.builtin)
+ function: (identifier) @function.builtin)
(#has-ancestor? @function.builtin attribute_specifier))
-;; Preproc def / undef
+; Preproc def / undef
(preproc_def
name: (_) @constant)
+
(preproc_call
directive: (preproc_directive) @_u
argument: (_) @constant
@@ -217,15 +256,21 @@
(call_expression
function: (identifier) @function.call)
+
(call_expression
- function: (field_expression
- field: (field_identifier) @function.call))
+ function:
+ (field_expression
+ field: (field_identifier) @function.call))
+
(function_declarator
declarator: (identifier) @function)
+
(function_declarator
- declarator: (parenthesized_declarator
- (pointer_declarator
- declarator: (field_identifier) @function)))
+ declarator:
+ (parenthesized_declarator
+ (pointer_declarator
+ declarator: (field_identifier) @function)))
+
(preproc_function_def
name: (identifier) @function.macro)
@@ -234,17 +279,40 @@
((comment) @comment.documentation
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
-;; Parameters
+; Parameters
(parameter_declaration
- declarator: (identifier) @parameter)
+ declarator: (identifier) @variable.parameter)
(parameter_declaration
- declarator: (array_declarator) @parameter)
+ declarator: (array_declarator) @variable.parameter)
(parameter_declaration
- declarator: (pointer_declarator) @parameter)
-
-(preproc_params (identifier) @parameter)
+ declarator: (pointer_declarator) @variable.parameter)
+
+; K&R functions
+; To enable support for K&R functions,
+; add the following lines to your own query config and uncomment them.
+; They are commented out as they'll conflict with C++
+; Note that you'll need to have `; extends` at the top of your query file.
+;
+; (parameter_list (identifier) @variable.parameter)
+;
+; (function_definition
+; declarator: _
+; (declaration
+; declarator: (identifier) @variable.parameter))
+;
+; (function_definition
+; declarator: _
+; (declaration
+; declarator: (array_declarator) @variable.parameter))
+;
+; (function_definition
+; declarator: _
+; (declaration
+; declarator: (pointer_declarator) @variable.parameter))
+(preproc_params
+ (identifier) @variable.parameter)
[
"__attribute__"
@@ -259,5 +327,3 @@
(ms_pointer_modifier)
(attribute_declaration)
] @attribute
-
-(ERROR) @error
diff --git a/runtime/queries/c/injections.scm b/runtime/queries/c/injections.scm
index 5a49e20df5..ce2f88a215 100644
--- a/runtime/queries/c/injections.scm
+++ b/runtime/queries/c/injections.scm
@@ -1,21 +1,2 @@
-((preproc_def
- (preproc_arg) @injection.content)
- (#lua-match? @injection.content "\n")
- (#set! injection.language "c"))
-
-(preproc_function_def
- (preproc_arg) @injection.content
- (#set! injection.language "c"))
-
-(preproc_call
- (preproc_arg) @injection.content
- (#set! injection.language "c"))
-
-; ((comment) @injection.content
-; (#set! injection.language "comment"))
-
-; TODO: add when asm is added
-; (gnu_asm_expression assembly_code: (string_literal) @injection.content
-; (#set! injection.language "asm"))
-; (gnu_asm_expression assembly_code: (concatenated_string (string_literal) @injection.content)
-; (#set! injection.language "asm"))
+((preproc_arg) @injection.content
+ (#set! injection.self))
diff --git a/runtime/queries/lua/folds.scm b/runtime/queries/lua/folds.scm
index d8f0b42df3..9dfac3abc6 100644
--- a/runtime/queries/lua/folds.scm
+++ b/runtime/queries/lua/folds.scm
@@ -1,10 +1,12 @@
[
- (do_statement)
- (while_statement)
- (repeat_statement)
- (if_statement)
- (for_statement)
- (function_declaration)
- (function_definition)
- (table_constructor)
+ (do_statement)
+ (while_statement)
+ (repeat_statement)
+ (if_statement)
+ (for_statement)
+ (function_declaration)
+ (function_definition)
+ (parameters)
+ (arguments)
+ (table_constructor)
] @fold
diff --git a/runtime/queries/lua/highlights.scm b/runtime/queries/lua/highlights.scm
index 96ffeae793..0b0bf35a8b 100644
--- a/runtime/queries/lua/highlights.scm
+++ b/runtime/queries/lua/highlights.scm
@@ -1,81 +1,79 @@
-;; Keywords
-
+; Keywords
"return" @keyword.return
[
- "goto"
- "in"
- "local"
+ "goto"
+ "in"
+ "local"
] @keyword
(break_statement) @keyword
(do_statement
-[
- "do"
- "end"
-] @keyword)
+ [
+ "do"
+ "end"
+ ] @keyword)
(while_statement
-[
- "while"
- "do"
- "end"
-] @repeat)
+ [
+ "while"
+ "do"
+ "end"
+ ] @keyword.repeat)
(repeat_statement
-[
- "repeat"
- "until"
-] @repeat)
+ [
+ "repeat"
+ "until"
+ ] @keyword.repeat)
(if_statement
-[
- "if"
- "elseif"
- "else"
- "then"
- "end"
-] @conditional)
+ [
+ "if"
+ "elseif"
+ "else"
+ "then"
+ "end"
+ ] @keyword.conditional)
(elseif_statement
-[
- "elseif"
- "then"
- "end"
-] @conditional)
+ [
+ "elseif"
+ "then"
+ "end"
+ ] @keyword.conditional)
(else_statement
-[
- "else"
- "end"
-] @conditional)
+ [
+ "else"
+ "end"
+ ] @keyword.conditional)
(for_statement
-[
- "for"
- "do"
- "end"
-] @repeat)
+ [
+ "for"
+ "do"
+ "end"
+ ] @keyword.repeat)
(function_declaration
-[
- "function"
- "end"
-] @keyword.function)
+ [
+ "function"
+ "end"
+ ] @keyword.function)
(function_definition
-[
- "function"
- "end"
-] @keyword.function)
-
-;; Operators
+ [
+ "function"
+ "end"
+ ] @keyword.function)
+; Operators
[
- "and"
- "not"
- "or"
+ "and"
+ "not"
+ "or"
] @keyword.operator
[
@@ -102,8 +100,7 @@
".."
] @operator
-;; Punctuations
-
+; Punctuations
[
";"
":"
@@ -112,19 +109,17 @@
"."
] @punctuation.delimiter
-;; Brackets
-
+; Brackets
[
- "("
- ")"
- "["
- "]"
- "{"
- "}"
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
] @punctuation.bracket
-;; Variables
-
+; Variables
(identifier) @variable
((identifier) @constant.builtin
@@ -133,27 +128,28 @@
((identifier) @variable.builtin
(#eq? @variable.builtin "self"))
-((identifier) @namespace.builtin
- (#any-of? @namespace.builtin "_G" "debug" "io" "jit" "math" "os" "package" "string" "table" "utf8"))
+((identifier) @module.builtin
+ (#any-of? @module.builtin "_G" "debug" "io" "jit" "math" "os" "package" "string" "table" "utf8"))
((identifier) @keyword.coroutine
(#eq? @keyword.coroutine "coroutine"))
(variable_list
- attribute: (attribute
- (["<" ">"] @punctuation.bracket
- (identifier) @attribute)))
-
-;; Labels
+ (attribute
+ "<" @punctuation.bracket
+ (identifier) @attribute
+ ">" @punctuation.bracket))
-(label_statement (identifier) @label)
+; Labels
+(label_statement
+ (identifier) @label)
-(goto_statement (identifier) @label)
-
-;; Constants
+(goto_statement
+ (identifier) @label)
+; Constants
((identifier) @constant
- (#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
+ (#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
(vararg_expression) @constant
@@ -164,41 +160,49 @@
(true)
] @boolean
-;; Tables
-
-(field name: (identifier) @field)
+; Tables
+(field
+ name: (identifier) @variable.member)
-(dot_index_expression field: (identifier) @field)
+(dot_index_expression
+ field: (identifier) @variable.member)
(table_constructor
-[
- "{"
- "}"
-] @constructor)
+ [
+ "{"
+ "}"
+ ] @constructor)
-;; Functions
+; Functions
+(parameters
+ (identifier) @variable.parameter)
-(parameters (identifier) @parameter)
-
-(function_declaration
- name: [
- (identifier) @function
- (dot_index_expression
- field: (identifier) @function)
- ])
+(vararg_expression) @variable.parameter.builtin
(function_declaration
- name: (method_index_expression
- method: (identifier) @method))
-
-(assignment_statement
- (variable_list .
- name: [
+ name:
+ [
(identifier) @function
(dot_index_expression
field: (identifier) @function)
])
- (expression_list .
+
+(function_declaration
+ name:
+ (method_index_expression
+ method: (identifier) @function.method))
+
+(assignment_statement
+ (variable_list
+ .
+ name:
+ [
+ (identifier) @function
+ (dot_index_expression
+ field: (identifier) @function)
+ ])
+ (expression_list
+ .
value: (function_definition)))
(table_constructor
@@ -207,18 +211,20 @@
value: (function_definition)))
(function_call
- name: [
- (identifier) @function.call
- (dot_index_expression
- field: (identifier) @function.call)
- (method_index_expression
- method: (identifier) @method.call)
- ])
+ name:
+ [
+ (identifier) @function.call
+ (dot_index_expression
+ field: (identifier) @function.call)
+ (method_index_expression
+ method: (identifier) @function.method.call)
+ ])
(function_call
(identifier) @function.builtin
+ ; format-ignore
(#any-of? @function.builtin
- ;; built-in functions in Lua 5.1
+ ; built-in functions in Lua 5.1
"assert" "collectgarbage" "dofile" "error" "getfenv" "getmetatable" "ipairs"
"load" "loadfile" "loadstring" "module" "next" "pairs" "pcall" "print"
"rawequal" "rawget" "rawlen" "rawset" "require" "select" "setfenv" "setmetatable"
@@ -227,8 +233,7 @@
"__idiv" "__index" "__le" "__len" "__lt" "__metatable" "__mod" "__mul" "__name" "__newindex"
"__pairs" "__pow" "__shl" "__shr" "__sub" "__tostring" "__unm"))
-;; Others
-
+; Others
(comment) @comment @spell
((comment) @comment.documentation
@@ -237,13 +242,34 @@
((comment) @comment.documentation
(#lua-match? @comment.documentation "^[-][-](%s?)@"))
-(hash_bang_line) @preproc
+(hash_bang_line) @keyword.directive
(number) @number
-(string) @string @spell
+(string) @string
(escape_sequence) @string.escape
-;; Error
-(ERROR) @error
+; string.match("123", "%d+")
+(function_call
+ (dot_index_expression
+ field: (identifier) @_method
+ (#any-of? @_method "find" "match" "gmatch" "gsub"))
+ arguments:
+ (arguments
+ .
+ (_)
+ .
+ (string
+ content: (string_content) @string.regexp)))
+
+;("123"):match("%d+")
+(function_call
+ (method_index_expression
+ method: (identifier) @_method
+ (#any-of? @_method "find" "match" "gmatch" "gsub"))
+ arguments:
+ (arguments
+ .
+ (string
+ content: (string_content) @string.regexp)))
diff --git a/runtime/queries/lua/injections.scm b/runtime/queries/lua/injections.scm
index dbfe75ae31..c8a1843c84 100644
--- a/runtime/queries/lua/injections.scm
+++ b/runtime/queries/lua/injections.scm
@@ -1,35 +1,130 @@
((function_call
- name: [
- (identifier) @_cdef_identifier
- (_ _ (identifier) @_cdef_identifier)
- ]
+ name:
+ [
+ (identifier) @_cdef_identifier
+ (_
+ _
+ (identifier) @_cdef_identifier)
+ ]
arguments:
(arguments
- (string content: _ @injection.content)))
+ (string
+ content: _ @injection.content)))
(#set! injection.language "c")
(#eq? @_cdef_identifier "cdef"))
((function_call
name: (_) @_vimcmd_identifier
- arguments: (arguments (string content: _ @injection.content)))
+ arguments:
+ (arguments
+ (string
+ content: _ @injection.content)))
(#set! injection.language "vim")
(#any-of? @_vimcmd_identifier "vim.cmd" "vim.api.nvim_command" "vim.api.nvim_command" "vim.api.nvim_exec2"))
((function_call
name: (_) @_vimcmd_identifier
- arguments: (arguments (string content: _ @injection.content) .))
+ arguments:
+ (arguments
+ (string
+ content: _ @injection.content) .))
(#set! injection.language "query")
(#any-of? @_vimcmd_identifier "vim.treesitter.query.set" "vim.treesitter.query.parse"))
((function_call
name: (_) @_vimcmd_identifier
- arguments: (arguments . (_) . (string content: _ @_method) . (string content: _ @injection.content)))
+ arguments:
+ (arguments
+ .
+ (_)
+ .
+ (string
+ content: _ @_method)
+ .
+ (string
+ content: _ @injection.content)))
(#any-of? @_vimcmd_identifier "vim.rpcrequest" "vim.rpcnotify")
(#eq? @_method "nvim_exec_lua")
(#set! injection.language "lua"))
-;; highlight string as query if starts with `;; query`
-(string content: _ @injection.content
- (#lua-match? @injection.content "^%s*;+%s?query")
- (#set! injection.language "query"))
+; vim.api.nvim_create_autocmd("FileType", { command = "injected here" })
+(function_call
+ name: (_) @_vimcmd_identifier
+ arguments:
+ (arguments
+ .
+ (_)
+ .
+ (table_constructor
+ (field
+ name: (identifier) @_command
+ value:
+ (string
+ content: (_) @injection.content))) .)
+ ; limit so only 2-argument functions gets matched before pred handle
+ (#eq? @_vimcmd_identifier "vim.api.nvim_create_autocmd")
+ (#eq? @_command "command")
+ (#set! injection.language "vim"))
+
+(function_call
+ name: (_) @_user_cmd
+ arguments:
+ (arguments
+ .
+ (_)
+ .
+ (string
+ content: (_) @injection.content)
+ .
+ (_) .)
+ (#eq? @_user_cmd "vim.api.nvim_create_user_command")
+ (#set! injection.language "vim"))
+
+(function_call
+ name: (_) @_user_cmd
+ arguments:
+ (arguments
+ .
+ (_)
+ .
+ (_)
+ .
+ (string
+ content: (_) @injection.content)
+ .
+ (_) .)
+ ; Limiting predicate handling to only functions with 4 arguments
+ (#eq? @_user_cmd "vim.api.nvim_buf_create_user_command")
+ (#set! injection.language "vim"))
+; rhs highlighting for vim.keymap.set/vim.api.nvim_set_keymap/vim.api.nvim_buf_set_keymap
+; (function_call
+; name: (_) @_map
+; arguments:
+; (arguments
+; . (_)
+; . (_)
+; .
+; (string
+; content: (_) @injection.content))
+; (#any-of? @_map "vim.api.nvim_set_keymap" "vim.keymap.set")
+; (#set! injection.language "vim"))
+;
+; (function_call
+; name: (_) @_map
+; arguments:
+; (arguments
+; . (_)
+; . (_)
+; . (_)
+; .
+; (string
+; content: (_) @injection.content)
+; . (_) .)
+; (#eq? @_map "vim.api.nvim_buf_set_keymap")
+; (#set! injection.language "vim"))
+; highlight string as query if starts with `;; query`
+(string
+ content: _ @injection.content
+ (#lua-match? @injection.content "^%s*;+%s?query")
+ (#set! injection.language "query"))
diff --git a/runtime/queries/markdown/folds.scm b/runtime/queries/markdown/folds.scm
index 5900f7ffbe..a682e20e00 100644
--- a/runtime/queries/markdown/folds.scm
+++ b/runtime/queries/markdown/folds.scm
@@ -1,9 +1,7 @@
-(
- [
- (fenced_code_block)
- (indented_code_block)
- (list)
- (section)
- ] @fold
- (#trim! @fold)
-)
+([
+ (fenced_code_block)
+ (indented_code_block)
+ (list)
+ (section)
+] @fold
+ (#trim! @fold))
diff --git a/runtime/queries/markdown/highlights.scm b/runtime/queries/markdown/highlights.scm
index 2cc5546bac..7c26fd710c 100644
--- a/runtime/queries/markdown/highlights.scm
+++ b/runtime/queries/markdown/highlights.scm
@@ -1,40 +1,73 @@
;From MDeiml/tree-sitter-markdown & Helix
-(setext_heading (paragraph) @text.title.1 (setext_h1_underline) @text.title.1.marker)
-(setext_heading (paragraph) @text.title.2 (setext_h2_underline) @text.title.2.marker)
+(setext_heading
+ (paragraph) @markup.heading.1
+ (setext_h1_underline) @markup.heading.1.marker)
-(atx_heading (atx_h1_marker) @text.title.1.marker (inline) @text.title.1)
-(atx_heading (atx_h2_marker) @text.title.2.marker (inline) @text.title.2)
-(atx_heading (atx_h3_marker) @text.title.3.marker (inline) @text.title.3)
-(atx_heading (atx_h4_marker) @text.title.4.marker (inline) @text.title.4)
-(atx_heading (atx_h5_marker) @text.title.5.marker (inline) @text.title.5)
-(atx_heading (atx_h6_marker) @text.title.6.marker (inline) @text.title.6)
+(setext_heading
+ (paragraph) @markup.heading.2
+ (setext_h2_underline) @markup.heading.2.marker)
-(link_title) @text.literal
-(indented_code_block) @text.literal.block
-((fenced_code_block) @text.literal.block (#set! "priority" 90))
+(atx_heading
+ (atx_h1_marker) @markup.heading.1.marker
+ (inline) @markup.heading.1)
+
+(atx_heading
+ (atx_h2_marker) @markup.heading.2.marker
+ (inline) @markup.heading.2)
+
+(atx_heading
+ (atx_h3_marker) @markup.heading.3.marker
+ (inline) @markup.heading.3)
+
+(atx_heading
+ (atx_h4_marker) @markup.heading.4.marker
+ (inline) @markup.heading.4)
+
+(atx_heading
+ (atx_h5_marker) @markup.heading.5.marker
+ (inline) @markup.heading.5)
+
+(atx_heading
+ (atx_h6_marker) @markup.heading.6.marker
+ (inline) @markup.heading.6)
(info_string) @label
-(pipe_table_header (pipe_table_cell) @text.title)
+(pipe_table_header
+ (pipe_table_cell) @markup.heading)
+
+(pipe_table_header
+ "|" @punctuation.special)
+
+(pipe_table_row
+ "|" @punctuation.special)
+
+(pipe_table_delimiter_row
+ "|" @punctuation.special)
-(pipe_table_header "|" @punctuation.special)
-(pipe_table_row "|" @punctuation.special)
-(pipe_table_delimiter_row "|" @punctuation.special)
(pipe_table_delimiter_cell) @punctuation.special
-[
- (fenced_code_block_delimiter)
-] @punctuation.delimiter
+; Code blocks (conceal backticks and language annotation)
+(indented_code_block) @markup.raw.block
-(code_fence_content) @none
+((fenced_code_block) @markup.raw.block
+ (#set! "priority" 90))
-[
- (link_destination)
-] @text.uri
+(fenced_code_block
+ (fenced_code_block_delimiter) @markup.raw.delimiter
+ (#set! conceal ""))
+
+(fenced_code_block
+ (info_string
+ (language) @conceal
+ (#set! conceal "")))
+
+(link_destination) @markup.link.url
[
+ (link_title)
(link_label)
-] @text.reference
+] @markup.link.label
[
(list_marker_plus)
@@ -42,30 +75,43 @@
(list_marker_star)
(list_marker_dot)
(list_marker_parenthesis)
- (thematic_break)
-] @punctuation.special
-
-
-(task_list_marker_unchecked) @text.todo.unchecked
-(task_list_marker_checked) @text.todo.checked
-
-(block_quote) @text.quote
+] @markup.list
+
+; NOTE: The following has been commented out due to issues with spaces in the
+; list marker nodes generated by the parser. If those spaces ever get captured
+; by a different node (e.g. block_continuation) we can safely readd these
+; conceals.
+; ;; Conceal bullet points
+; ([(list_marker_plus) (list_marker_star)]
+; @punctuation.special
+; (#offset! @punctuation.special 0 0 0 -1)
+; (#set! conceal "•"))
+; ([(list_marker_plus) (list_marker_star)]
+; @punctuation.special
+; (#any-of? @punctuation.special "+" "*")
+; (#set! conceal "•"))
+; ((list_marker_minus)
+; @punctuation.special
+; (#offset! @punctuation.special 0 0 0 -1)
+; (#set! conceal "—"))
+; ((list_marker_minus)
+; @punctuation.special
+; (#eq? @punctuation.special "-")
+; (#set! conceal "—"))
+(thematic_break) @punctuation.special
+
+(task_list_marker_unchecked) @markup.list.unchecked
+
+(task_list_marker_checked) @markup.list.checked
+
+((block_quote) @markup.quote
+ (#set! "priority" 90))
[
(block_continuation)
(block_quote_marker)
] @punctuation.special
-[
- (backslash_escape)
-] @string.escape
+(backslash_escape) @string.escape
(inline) @spell
-
-;; Conceal backticks
-(fenced_code_block
- (fenced_code_block_delimiter) @conceal
- (#set! conceal ""))
-(fenced_code_block
- (info_string (language) @conceal
- (#set! conceal "")))
diff --git a/runtime/queries/markdown/injections.scm b/runtime/queries/markdown/injections.scm
index fda7036830..1f33c30b63 100644
--- a/runtime/queries/markdown/injections.scm
+++ b/runtime/queries/markdown/injections.scm
@@ -3,23 +3,23 @@
(language) @injection.language)
(code_fence_content) @injection.content)
-((html_block) @injection.content
- (#set! injection.language "html")
- (#set! injection.combined)
- (#set! injection.include-children))
+((html_block) @injection.content
+ (#set! injection.language "html")
+ (#set! injection.combined)
+ (#set! injection.include-children))
-((minus_metadata) @injection.content
- (#set! injection.language "yaml")
- (#offset! @injection.content 1 0 -1 0)
- (#set! injection.include-children))
+((minus_metadata) @injection.content
+ (#set! injection.language "yaml")
+ (#offset! @injection.content 1 0 -1 0)
+ (#set! injection.include-children))
-((plus_metadata) @injection.content
- (#set! injection.language "toml")
- (#offset! @injection.content 1 0 -1 0)
- (#set! injection.include-children))
+((plus_metadata) @injection.content
+ (#set! injection.language "toml")
+ (#offset! @injection.content 1 0 -1 0)
+ (#set! injection.include-children))
([
(inline)
(pipe_table_cell)
- ] @injection.content
- (#set! injection.language "markdown_inline"))
+] @injection.content
+ (#set! injection.language "markdown_inline"))
diff --git a/runtime/queries/markdown_inline/highlights.scm b/runtime/queries/markdown_inline/highlights.scm
index c75da478af..e9b41c31d5 100644
--- a/runtime/queries/markdown_inline/highlights.scm
+++ b/runtime/queries/markdown_inline/highlights.scm
@@ -1,49 +1,26 @@
-;; From MDeiml/tree-sitter-markdown
-[
- (code_span)
- (link_title)
-] @text.literal @nospell
-
-[
- (emphasis_delimiter)
- (code_span_delimiter)
-] @punctuation.delimiter
-
-(emphasis) @text.emphasis
+; From MDeiml/tree-sitter-markdown
+(code_span) @markup.raw @nospell
-(strong_emphasis) @text.strong
+(emphasis) @markup.italic
-(strikethrough) @text.strike
-
-[
- (link_destination)
- (uri_autolink)
-] @text.uri @nospell
+(strong_emphasis) @markup.strong
-(shortcut_link (link_text) @nospell)
+(strikethrough) @markup.strikethrough
-[
- (link_label)
- (link_text)
- (image_description)
-] @text.reference
+(shortcut_link
+ (link_text) @nospell)
[
(backslash_escape)
(hard_line_break)
] @string.escape
-(image "!" @punctuation.special)
-(image ["[" "]" "(" ")"] @punctuation.bracket)
-(inline_link ["[" "]" "(" ")"] @punctuation.bracket)
-(shortcut_link ["[" "]"] @punctuation.bracket)
-
; Conceal codeblock and text style markers
-([
- (code_span_delimiter)
- (emphasis_delimiter)
-] @conceal
-(#set! conceal ""))
+((code_span_delimiter) @markup.raw.delimiter
+ (#set! conceal ""))
+
+((emphasis_delimiter) @conceal
+ (#set! conceal ""))
; Conceal inline links
(inline_link
@@ -53,7 +30,7 @@
"("
(link_destination)
")"
- ] @conceal
+ ] @markup.link
(#set! conceal ""))
; Conceal image links
@@ -65,7 +42,7 @@
"("
(link_destination)
")"
- ] @conceal
+ ] @markup.link
(#set! conceal ""))
; Conceal full reference links
@@ -74,7 +51,7 @@
"["
"]"
(link_label)
- ] @conceal
+ ] @markup.link
(#set! conceal ""))
; Conceal collapsed reference links
@@ -82,7 +59,7 @@
[
"["
"]"
- ] @conceal
+ ] @markup.link
(#set! conceal ""))
; Conceal shortcut links
@@ -90,13 +67,42 @@
[
"["
"]"
- ] @conceal
+ ] @markup.link
(#set! conceal ""))
-;; Replace common HTML entities.
-((entity_reference) @conceal (#eq? @conceal "&nbsp;") (#set! conceal ""))
-((entity_reference) @conceal (#eq? @conceal "&lt;") (#set! conceal "<"))
-((entity_reference) @conceal (#eq? @conceal "&gt;") (#set! conceal ">"))
-((entity_reference) @conceal (#eq? @conceal "&amp;") (#set! conceal "&"))
-((entity_reference) @conceal (#eq? @conceal "&quot;") (#set! conceal "\""))
-((entity_reference) @conceal (#any-of? @conceal "&ensp;" "&emsp;") (#set! conceal " "))
+[
+ (link_destination)
+ (uri_autolink)
+] @markup.link.url @nospell
+
+[
+ (link_label)
+ (link_text)
+ (link_title)
+ (image_description)
+] @markup.link.label
+
+; Replace common HTML entities.
+((entity_reference) @character.special
+ (#eq? @character.special "&nbsp;")
+ (#set! conceal ""))
+
+((entity_reference) @character.special
+ (#eq? @character.special "&lt;")
+ (#set! conceal "<"))
+
+((entity_reference) @character.special
+ (#eq? @character.special "&gt;")
+ (#set! conceal ">"))
+
+((entity_reference) @character.special
+ (#eq? @character.special "&amp;")
+ (#set! conceal "&"))
+
+((entity_reference) @character.special
+ (#eq? @character.special "&quot;")
+ (#set! conceal "\""))
+
+((entity_reference) @character.special
+ (#any-of? @character.special "&ensp;" "&emsp;")
+ (#set! conceal " "))
diff --git a/runtime/queries/markdown_inline/injections.scm b/runtime/queries/markdown_inline/injections.scm
index f7aa19caff..6448b77c1b 100644
--- a/runtime/queries/markdown_inline/injections.scm
+++ b/runtime/queries/markdown_inline/injections.scm
@@ -1,8 +1,7 @@
((html_tag) @injection.content
- (#set! injection.language "html")
- (#set! injection.combined)
- (#set! injection.include-children))
+ (#set! injection.language "html")
+ (#set! injection.combined))
((latex_block) @injection.content
- (#set! injection.language "latex")
- (#set! injection.include-children))
+ (#set! injection.language "latex")
+ (#set! injection.include-children))
diff --git a/runtime/queries/python/folds.scm b/runtime/queries/python/folds.scm
index 78e1e2c00d..7c547db38f 100644
--- a/runtime/queries/python/folds.scm
+++ b/runtime/queries/python/folds.scm
@@ -1,28 +1,23 @@
[
(function_definition)
(class_definition)
-
(while_statement)
(for_statement)
(if_statement)
(with_statement)
(try_statement)
(match_statement)
-
(import_from_statement)
(parameters)
(argument_list)
-
(parenthesized_expression)
(generator_expression)
(list_comprehension)
(set_comprehension)
(dictionary_comprehension)
-
(tuple)
(list)
(set)
(dictionary)
-
(string)
] @fold
diff --git a/runtime/queries/python/highlights.scm b/runtime/queries/python/highlights.scm
index 04398668e9..764521c7be 100644
--- a/runtime/queries/python/highlights.scm
+++ b/runtime/queries/python/highlights.scm
@@ -1,183 +1,223 @@
-;; From tree-sitter-python licensed under MIT License
+; From tree-sitter-python licensed under MIT License
; Copyright (c) 2016 Max Brunsfeld
-
; Variables
(identifier) @variable
; Reset highlighting in f-string interpolations
(interpolation) @none
-;; Identifier naming conventions
+; Identifier naming conventions
((identifier) @type
- (#lua-match? @type "^[A-Z].*[a-z]"))
+ (#lua-match? @type "^[A-Z].*[a-z]"))
+
((identifier) @constant
- (#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
+ (#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
((identifier) @constant.builtin
- (#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$"))
+ (#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$"))
((identifier) @constant.builtin
- (#any-of? @constant.builtin
- ;; https://docs.python.org/3/library/constants.html
- "NotImplemented"
- "Ellipsis"
- "quit"
- "exit"
- "copyright"
- "credits"
- "license"))
+ ; format-ignore
+ (#any-of? @constant.builtin
+ ; https://docs.python.org/3/library/constants.html
+ "NotImplemented" "Ellipsis"
+ "quit" "exit" "copyright" "credits" "license"))
"_" @constant.builtin ; match wildcard
((attribute
- attribute: (identifier) @field)
- (#lua-match? @field "^[%l_].*$"))
+ attribute: (identifier) @variable.member)
+ (#lua-match? @variable.member "^[%l_].*$"))
((assignment
left: (identifier) @type.definition
- (type (identifier) @_annotation))
- (#eq? @_annotation "TypeAlias"))
+ (type
+ (identifier) @_annotation))
+ (#eq? @_annotation "TypeAlias"))
((assignment
left: (identifier) @type.definition
- right: (call
- function: (identifier) @_func))
- (#any-of? @_func "TypeVar" "NewType"))
+ right:
+ (call
+ function: (identifier) @_func))
+ (#any-of? @_func "TypeVar" "NewType"))
; Function calls
-
(call
function: (identifier) @function.call)
(call
- function: (attribute
- attribute: (identifier) @method.call))
+ function:
+ (attribute
+ attribute: (identifier) @function.method.call))
((call
- function: (identifier) @constructor)
- (#lua-match? @constructor "^%u"))
+ function: (identifier) @constructor)
+ (#lua-match? @constructor "^%u"))
((call
- function: (attribute
- attribute: (identifier) @constructor))
- (#lua-match? @constructor "^%u"))
-
-;; Decorators
+ function:
+ (attribute
+ attribute: (identifier) @constructor))
+ (#lua-match? @constructor "^%u"))
-((decorator "@" @attribute)
- (#set! "priority" 101))
+; Decorators
+((decorator
+ "@" @attribute)
+ (#set! "priority" 101))
(decorator
(identifier) @attribute)
+
(decorator
(attribute
attribute: (identifier) @attribute))
+
(decorator
- (call (identifier) @attribute))
+ (call
+ (identifier) @attribute))
+
(decorator
- (call (attribute
- attribute: (identifier) @attribute)))
+ (call
+ (attribute
+ attribute: (identifier) @attribute)))
((decorator
(identifier) @attribute.builtin)
- (#any-of? @attribute.builtin "classmethod" "property"))
-
-;; Builtin functions
+ (#any-of? @attribute.builtin "classmethod" "property"))
+; Builtin functions
((call
function: (identifier) @function.builtin)
- (#any-of? @function.builtin
- "abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr" "classmethod"
- "compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec" "filter" "float" "format"
- "frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id" "input" "int" "isinstance" "issubclass"
- "iter" "len" "list" "locals" "map" "max" "memoryview" "min" "next" "object" "oct" "open" "ord" "pow"
- "print" "property" "range" "repr" "reversed" "round" "set" "setattr" "slice" "sorted" "staticmethod" "str"
- "sum" "super" "tuple" "type" "vars" "zip" "__import__"))
-
-;; Function definitions
+ (#any-of? @function.builtin "abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr" "classmethod" "compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec" "filter" "float" "format" "frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id" "input" "int" "isinstance" "issubclass" "iter" "len" "list" "locals" "map" "max" "memoryview" "min" "next" "object" "oct" "open" "ord" "pow" "print" "property" "range" "repr" "reversed" "round" "set" "setattr" "slice" "sorted" "staticmethod" "str" "sum" "super" "tuple" "type" "vars" "zip" "__import__"))
+; Function definitions
(function_definition
name: (identifier) @function)
-(type (identifier) @type)
+(type
+ (identifier) @type)
+
(type
(subscript
(identifier) @type)) ; type subscript: Tuple[int]
((call
function: (identifier) @_isinstance
- arguments: (argument_list
- (_)
- (identifier) @type))
- (#eq? @_isinstance "isinstance"))
+ arguments:
+ (argument_list
+ (_)
+ (identifier) @type))
+ (#eq? @_isinstance "isinstance"))
-;; Normal parameters
+; Normal parameters
(parameters
- (identifier) @parameter)
-;; Lambda parameters
+ (identifier) @variable.parameter)
+
+; Lambda parameters
(lambda_parameters
- (identifier) @parameter)
+ (identifier) @variable.parameter)
+
(lambda_parameters
(tuple_pattern
- (identifier) @parameter))
+ (identifier) @variable.parameter))
+
; Default parameters
(keyword_argument
- name: (identifier) @parameter)
+ name: (identifier) @variable.parameter)
+
; Naming parameters on call-site
(default_parameter
- name: (identifier) @parameter)
+ name: (identifier) @variable.parameter)
+
(typed_parameter
- (identifier) @parameter)
+ (identifier) @variable.parameter)
+
(typed_default_parameter
- (identifier) @parameter)
+ name: (identifier) @variable.parameter)
+
; Variadic parameters *args, **kwargs
(parameters
(list_splat_pattern ; *args
- (identifier) @parameter))
+ (identifier) @variable.parameter))
+
(parameters
(dictionary_splat_pattern ; **kwargs
- (identifier) @parameter))
+ (identifier) @variable.parameter))
+; Typed variadic parameters
+(parameters
+ (typed_parameter
+ (list_splat_pattern ; *args: type
+ (identifier) @variable.parameter)))
-;; Literals
+(parameters
+ (typed_parameter
+ (dictionary_splat_pattern ; *kwargs: type
+ (identifier) @variable.parameter)))
+
+; Lambda parameters
+(lambda_parameters
+ (list_splat_pattern
+ (identifier) @variable.parameter))
+(lambda_parameters
+ (dictionary_splat_pattern
+ (identifier) @variable.parameter))
+
+; Literals
(none) @constant.builtin
-[(true) (false)] @boolean
+
+[
+ (true)
+ (false)
+] @boolean
+
((identifier) @variable.builtin
- (#eq? @variable.builtin "self"))
+ (#eq? @variable.builtin "self"))
+
((identifier) @variable.builtin
- (#eq? @variable.builtin "cls"))
+ (#eq? @variable.builtin "cls"))
(integer) @number
-(float) @float
+
+(float) @number.float
(comment) @comment @spell
-((module . (comment) @preproc)
- (#lua-match? @preproc "^#!/"))
+((module
+ .
+ (comment) @keyword.directive)
+ (#lua-match? @keyword.directive "^#!/"))
(string) @string
+
[
(escape_sequence)
(escape_interpolation)
] @string.escape
; doc-strings
-
-(module . (expression_statement (string) @string.documentation @spell))
+(module
+ .
+ (expression_statement
+ (string) @string.documentation @spell))
(class_definition
body:
(block
- . (expression_statement (string) @string.documentation @spell)))
+ .
+ (expression_statement
+ (string) @string.documentation @spell)))
(function_definition
body:
(block
- . (expression_statement (string) @string.documentation @spell)))
+ .
+ (expression_statement
+ (string) @string.documentation @spell)))
; Tokens
-
[
"-"
"-="
@@ -227,7 +267,6 @@
"or"
"is not"
"not in"
-
"del"
] @keyword.operator
@@ -258,19 +297,36 @@
"return"
"yield"
] @keyword.return
-(yield "from" @keyword.return)
+
+(yield
+ "from" @keyword.return)
(future_import_statement
- "from" @include
+ "from" @keyword.import
"__future__" @constant.builtin)
-(import_from_statement "from" @include)
-"import" @include
-(aliased_import "as" @include)
+(import_from_statement
+ "from" @keyword.import)
+
+"import" @keyword.import
-["if" "elif" "else" "match" "case"] @conditional
+(aliased_import
+ "as" @keyword.import)
-["for" "while" "break" "continue"] @repeat
+[
+ "if"
+ "elif"
+ "else"
+ "match"
+ "case"
+] @keyword.conditional
+
+[
+ "for"
+ "while"
+ "break"
+ "continue"
+] @keyword.repeat
[
"try"
@@ -278,15 +334,23 @@
"except*"
"raise"
"finally"
-] @exception
+] @keyword.exception
-(raise_statement "from" @exception)
+(raise_statement
+ "from" @keyword.exception)
(try_statement
(else_clause
- "else" @exception))
+ "else" @keyword.exception))
-["(" ")" "[" "]" "{" "}"] @punctuation.bracket
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
(interpolation
"{" @punctuation.special
@@ -294,58 +358,80 @@
(type_conversion) @function.macro
-["," "." ":" ";" (ellipsis)] @punctuation.delimiter
-
-;; Class definitions
-
-(class_definition name: (identifier) @type)
+[
+ ","
+ "."
+ ":"
+ ";"
+ (ellipsis)
+] @punctuation.delimiter
+
+; Class definitions
+(class_definition
+ name: (identifier) @type)
(class_definition
- body: (block
- (function_definition
- name: (identifier) @method)))
+ body:
+ (block
+ (function_definition
+ name: (identifier) @function.method)))
(class_definition
- superclasses: (argument_list
- (identifier) @type))
+ superclasses:
+ (argument_list
+ (identifier) @type))
((class_definition
- body: (block
- (expression_statement
- (assignment
- left: (identifier) @field))))
- (#lua-match? @field "^%l.*$"))
+ body:
+ (block
+ (expression_statement
+ (assignment
+ left: (identifier) @variable.member))))
+ (#lua-match? @variable.member "^%l.*$"))
+
((class_definition
- body: (block
- (expression_statement
- (assignment
- left: (_
- (identifier) @field)))))
- (#lua-match? @field "^%l.*$"))
+ body:
+ (block
+ (expression_statement
+ (assignment
+ left:
+ (_
+ (identifier) @variable.member)))))
+ (#lua-match? @variable.member "^%l.*$"))
((class_definition
(block
(function_definition
name: (identifier) @constructor)))
- (#any-of? @constructor "__new__" "__init__"))
+ (#any-of? @constructor "__new__" "__init__"))
((identifier) @type.builtin
- (#any-of? @type.builtin
- ;; https://docs.python.org/3/library/exceptions.html
- "BaseException" "Exception" "ArithmeticError" "BufferError" "LookupError" "AssertionError" "AttributeError"
- "EOFError" "FloatingPointError" "GeneratorExit" "ImportError" "ModuleNotFoundError" "IndexError" "KeyError"
- "KeyboardInterrupt" "MemoryError" "NameError" "NotImplementedError" "OSError" "OverflowError" "RecursionError"
- "ReferenceError" "RuntimeError" "StopIteration" "StopAsyncIteration" "SyntaxError" "IndentationError" "TabError"
- "SystemError" "SystemExit" "TypeError" "UnboundLocalError" "UnicodeError" "UnicodeEncodeError" "UnicodeDecodeError"
- "UnicodeTranslateError" "ValueError" "ZeroDivisionError" "EnvironmentError" "IOError" "WindowsError"
- "BlockingIOError" "ChildProcessError" "ConnectionError" "BrokenPipeError" "ConnectionAbortedError"
- "ConnectionRefusedError" "ConnectionResetError" "FileExistsError" "FileNotFoundError" "InterruptedError"
- "IsADirectoryError" "NotADirectoryError" "PermissionError" "ProcessLookupError" "TimeoutError" "Warning"
- "UserWarning" "DeprecationWarning" "PendingDeprecationWarning" "SyntaxWarning" "RuntimeWarning"
- "FutureWarning" "ImportWarning" "UnicodeWarning" "BytesWarning" "ResourceWarning"
- ;; https://docs.python.org/3/library/stdtypes.html
- "bool" "int" "float" "complex" "list" "tuple" "range" "str"
- "bytes" "bytearray" "memoryview" "set" "frozenset" "dict" "type" "object"))
-
-;; Error
-(ERROR) @error
+ ; format-ignore
+ (#any-of? @type.builtin
+ ; https://docs.python.org/3/library/exceptions.html
+ "BaseException" "Exception" "ArithmeticError" "BufferError" "LookupError" "AssertionError" "AttributeError"
+ "EOFError" "FloatingPointError" "GeneratorExit" "ImportError" "ModuleNotFoundError" "IndexError" "KeyError"
+ "KeyboardInterrupt" "MemoryError" "NameError" "NotImplementedError" "OSError" "OverflowError" "RecursionError"
+ "ReferenceError" "RuntimeError" "StopIteration" "StopAsyncIteration" "SyntaxError" "IndentationError" "TabError"
+ "SystemError" "SystemExit" "TypeError" "UnboundLocalError" "UnicodeError" "UnicodeEncodeError" "UnicodeDecodeError"
+ "UnicodeTranslateError" "ValueError" "ZeroDivisionError" "EnvironmentError" "IOError" "WindowsError"
+ "BlockingIOError" "ChildProcessError" "ConnectionError" "BrokenPipeError" "ConnectionAbortedError"
+ "ConnectionRefusedError" "ConnectionResetError" "FileExistsError" "FileNotFoundError" "InterruptedError"
+ "IsADirectoryError" "NotADirectoryError" "PermissionError" "ProcessLookupError" "TimeoutError" "Warning"
+ "UserWarning" "DeprecationWarning" "PendingDeprecationWarning" "SyntaxWarning" "RuntimeWarning"
+ "FutureWarning" "ImportWarning" "UnicodeWarning" "BytesWarning" "ResourceWarning"
+ ; https://docs.python.org/3/library/stdtypes.html
+ "bool" "int" "float" "complex" "list" "tuple" "range" "str"
+ "bytes" "bytearray" "memoryview" "set" "frozenset" "dict" "type" "object"))
+
+; Regex from the `re` module
+(call
+ function:
+ (attribute
+ object: (identifier) @_re)
+ arguments:
+ (argument_list
+ .
+ (string
+ (string_content) @string.regexp))
+ (#eq? @_re "re"))
diff --git a/runtime/queries/query/highlights.scm b/runtime/queries/query/highlights.scm
index f2d2ef6c7f..cdedb23e29 100644
--- a/runtime/queries/query/highlights.scm
+++ b/runtime/queries/query/highlights.scm
@@ -1,14 +1,30 @@
(string) @string
+
(escape_sequence) @string.escape
-(capture (identifier) @type)
-(anonymous_node (identifier) @string)
-(predicate name: (identifier) @function)
-(named_node name: (identifier) @variable)
-(field_definition name: (identifier) @property)
-(negated_field "!" @operator (identifier) @property)
+
+(capture
+ (identifier) @type)
+
+(anonymous_node
+ (identifier) @string)
+
+(predicate
+ name: (identifier) @function.call)
+
+(named_node
+ name: (identifier) @variable)
+
+(field_definition
+ name: (identifier) @property)
+
+(negated_field
+ "!" @operator
+ (identifier) @property)
+
(comment) @comment @spell
(quantifier) @operator
+
(predicate_type) @punctuation.special
"." @operator
@@ -21,14 +37,51 @@
] @punctuation.bracket
":" @punctuation.delimiter
-["@" "#"] @punctuation.special
+
+[
+ "@"
+ "#"
+] @punctuation.special
+
"_" @constant
-((parameters (identifier) @number)
- (#match? @number "^[-+]?[0-9]+(.[0-9]+)?$"))
+((parameters
+ (identifier) @number)
+ (#match? @number "^[-+]?[0-9]+(.[0-9]+)?$"))
+
+((program
+ .
+ (comment)*
+ .
+ (comment) @keyword.import)
+ (#lua-match? @keyword.import "^;+ *inherits *:"))
+
+((program
+ .
+ (comment)*
+ .
+ (comment) @keyword.directive)
+ (#lua-match? @keyword.directive "^;+ *extends *$"))
+
+((comment) @keyword.directive
+ (#lua-match? @keyword.directive "^;+%s*format%-ignore%s*$"))
-((program . (comment)* . (comment) @include)
- (#lua-match? @include "^;+ *inherits *:"))
+((predicate
+ name: (identifier) @_name
+ parameters:
+ (parameters
+ (string
+ "\"" @string
+ "\"" @string) @string.regexp))
+ (#any-of? @_name "match" "not-match" "vim-match" "not-vim-match" "lua-match" "not-lua-match"))
-((program . (comment)* . (comment) @preproc)
- (#lua-match? @preproc "^;+ *extends"))
+((predicate
+ name: (identifier) @_name
+ parameters:
+ (parameters
+ (string
+ "\"" @string
+ "\"" @string) @string.regexp
+ .
+ (string) .))
+ (#any-of? @_name "gsub" "not-gsub"))
diff --git a/runtime/queries/vim/folds.scm b/runtime/queries/vim/folds.scm
index 4c99735836..0a1fb695f3 100644
--- a/runtime/queries/vim/folds.scm
+++ b/runtime/queries/vim/folds.scm
@@ -1,4 +1,4 @@
[
- (if_statement)
- (function_definition)
+ (if_statement)
+ (function_definition)
] @fold
diff --git a/runtime/queries/vim/highlights.scm b/runtime/queries/vim/highlights.scm
index 09188ddb68..54832ffa56 100644
--- a/runtime/queries/vim/highlights.scm
+++ b/runtime/queries/vim/highlights.scm
@@ -1,15 +1,15 @@
(identifier) @variable
-((identifier) @constant
- (#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
-;; Keywords
+((identifier) @constant
+ (#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
+; Keywords
[
"if"
"else"
"elseif"
"endif"
-] @conditional
+] @keyword.conditional
[
"try"
@@ -17,7 +17,7 @@
"finally"
"endtry"
"throw"
-] @exception
+] @keyword.exception
[
"for"
@@ -27,31 +27,50 @@
"endwhile"
"break"
"continue"
-] @repeat
+] @keyword.repeat
[
"function"
"endfunction"
] @keyword.function
-;; Function related
-(function_declaration name: (_) @function)
-(call_expression function: (identifier) @function.call)
-(call_expression function: (scoped_identifier (identifier) @function.call))
-(parameters (identifier) @parameter)
-(default_parameter (identifier) @parameter)
+; Function related
+(function_declaration
+ name: (_) @function)
+
+(call_expression
+ function: (identifier) @function.call)
+
+(call_expression
+ function:
+ (scoped_identifier
+ (identifier) @function.call))
-[ (bang) (spread) ] @punctuation.special
+(parameters
+ (identifier) @variable.parameter)
+
+(default_parameter
+ (identifier) @variable.parameter)
+
+[
+ (bang)
+ (spread)
+] @punctuation.special
+
+[
+ (no_option)
+ (inv_option)
+ (default_option)
+ (option_name)
+] @variable.builtin
-[ (no_option) (inv_option) (default_option) (option_name) ] @variable.builtin
[
(scope)
"a:"
"$"
-] @namespace
-
-;; Commands and user defined commands
+] @module
+; Commands and user defined commands
[
"let"
"unlet"
@@ -83,6 +102,7 @@
"delcommand"
"comclear"
"colorscheme"
+ "scriptencoding"
"startinsert"
"stopinsert"
"global"
@@ -106,41 +126,48 @@
"visual"
"view"
"eval"
+ "sign"
] @keyword
-(map_statement cmd: _ @keyword)
+
+(map_statement
+ cmd: _ @keyword)
+
(command_name) @function.macro
-;; Filetype command
-
-(filetype_statement [
- "detect"
- "plugin"
- "indent"
- "on"
- "off"
-] @keyword)
-
-;; Syntax command
-
-(syntax_statement (keyword) @string)
-(syntax_statement [
- "enable"
- "on"
- "off"
- "reset"
- "case"
- "spell"
- "foldlevel"
- "iskeyword"
- "keyword"
- "match"
- "cluster"
- "region"
- "clear"
- "include"
-] @keyword)
-
-(syntax_argument name: _ @keyword)
+; Filetype command
+(filetype_statement
+ [
+ "detect"
+ "plugin"
+ "indent"
+ "on"
+ "off"
+ ] @keyword)
+
+; Syntax command
+(syntax_statement
+ (keyword) @string)
+
+(syntax_statement
+ [
+ "enable"
+ "on"
+ "off"
+ "reset"
+ "case"
+ "spell"
+ "foldlevel"
+ "iskeyword"
+ "keyword"
+ "match"
+ "cluster"
+ "region"
+ "clear"
+ "include"
+ ] @keyword)
+
+(syntax_argument
+ name: _ @keyword)
[
"<buffer>"
@@ -151,70 +178,96 @@
"<unique>"
] @constant.builtin
-(augroup_name) @namespace
+(augroup_name) @module
(au_event) @constant
-(normal_statement (commands) @constant)
-;; Highlight command
+(normal_statement
+ (commands) @constant)
+; Highlight command
(hl_attribute
key: _ @property
val: _ @constant)
(hl_group) @type
-(highlight_statement [
- "default"
- "link"
- "clear"
-] @keyword)
-
-;; Command command
+(highlight_statement
+ [
+ "default"
+ "link"
+ "clear"
+ ] @keyword)
+; Command command
(command) @string
(command_attribute
name: _ @property
- val: (behavior
- name: _ @constant
- val: (identifier)? @function)?)
+ val:
+ (behavior
+ name: _ @constant
+ val: (identifier)? @function)?)
-;; Edit command
+; Edit command
(plus_plus_opt
val: _? @constant) @property
-(plus_cmd "+" @property) @property
-
-;; Runtime command
-(runtime_statement (where) @keyword.operator)
+(plus_cmd
+ "+" @property) @property
-;; Colorscheme command
+; Runtime command
+(runtime_statement
+ (where) @keyword.operator)
-(colorscheme_statement (name) @string)
+; Colorscheme command
+(colorscheme_statement
+ (name) @string)
-;; Literals
+; Scriptencoding command
+(scriptencoding_statement
+ (encoding) @string.special)
+; Literals
(string_literal) @string
+
(integer_literal) @number
-(float_literal) @float
+
+(float_literal) @number.float
+
(comment) @comment @spell
+
(line_continuation_comment) @comment @spell
+
(pattern) @string.special
-(pattern_multi) @string.regex
-(filename) @string
-(heredoc (body) @string)
-(heredoc (parameter) @keyword)
-[ (marker_definition) (endmarker) ] @label
-(literal_dictionary (literal_key) @label)
-((scoped_identifier
- (scope) @_scope . (identifier) @boolean)
- (#eq? @_scope "v:")
- (#any-of? @boolean "true" "false"))
-;; Operators
+(pattern_multi) @string.regexp
+
+(filename) @string.special.path
+
+(heredoc
+ (body) @string)
+
+(heredoc
+ (parameter) @keyword)
[
+ (marker_definition)
+ (endmarker)
+] @label
+
+(literal_dictionary
+ (literal_key) @property)
+
+((scoped_identifier
+ (scope) @_scope
+ .
+ (identifier) @boolean)
+ (#eq? @_scope "v:")
+ (#any-of? @boolean "true" "false"))
+
+; Operators
+[
"||"
"&&"
"&"
@@ -248,12 +301,13 @@
] @operator
; Some characters have different meanings based on the context
-(unary_operation "!" @operator)
-(binary_operation "." @operator)
-
+(unary_operation
+ "!" @operator)
-;; Punctuation
+(binary_operation
+ "." @operator)
+; Punctuation
[
"("
")"
@@ -264,27 +318,31 @@
"#{"
] @punctuation.bracket
-(field_expression "." @punctuation.delimiter)
+(field_expression
+ "." @punctuation.delimiter)
[
","
":"
] @punctuation.delimiter
-(ternary_expression ["?" ":"] @conditional.ternary)
+(ternary_expression
+ [
+ "?"
+ ":"
+ ] @keyword.conditional.ternary)
; Options
((set_value) @number
- (#lua-match? @number "^[%d]+(%.[%d]+)?$"))
+ (#lua-match? @number "^[%d]+(%.[%d]+)?$"))
+
+(inv_option
+ "!" @operator)
-(inv_option "!" @operator)
-(set_item "?" @operator)
+(set_item
+ "?" @operator)
((set_item
- option: (option_name) @_option
- value: (set_value) @function)
- (#any-of? @_option
- "tagfunc" "tfu"
- "completefunc" "cfu"
- "omnifunc" "ofu"
- "operatorfunc" "opfunc"))
+ option: (option_name) @_option
+ value: (set_value) @function)
+ (#any-of? @_option "tagfunc" "tfu" "completefunc" "cfu" "omnifunc" "ofu" "operatorfunc" "opfunc"))
diff --git a/runtime/queries/vim/injections.scm b/runtime/queries/vim/injections.scm
index 50f0190112..16ec57ca99 100644
--- a/runtime/queries/vim/injections.scm
+++ b/runtime/queries/vim/injections.scm
@@ -1,48 +1,32 @@
-((lua_statement (script (body) @injection.content))
- (#set! injection.language "lua"))
+(lua_statement
+ (script
+ (body) @injection.content
+ (#set! injection.language "lua")))
-((lua_statement (chunk) @injection.content)
- (#set! injection.language "lua"))
+(lua_statement
+ (chunk) @injection.content
+ (#set! injection.language "lua"))
-((ruby_statement (script (body) @injection.content))
- (#set! injection.language "ruby"))
+(ruby_statement
+ (script
+ (body) @injection.content
+ (#set! injection.language "ruby")))
-((ruby_statement (chunk) @injection.content)
- (#set! injection.language "ruby"))
+(ruby_statement
+ (chunk) @injection.content
+ (#set! injection.language "ruby"))
-((python_statement (script (body) @injection.content))
- (#set! injection.language "python"))
+(python_statement
+ (script
+ (body) @injection.content
+ (#set! injection.language "python")))
-((python_statement (chunk) @injection.content)
- (#set! injection.language "python"))
-
-;; If we support perl at some point...
-;; ((perl_statement (script (body) @injection.content))
-;; (#set! injection.language "perl"))
-;; ((perl_statement (chunk) @injection.content)
-;; (#set! injection.language "perl"))
-
-((autocmd_statement (pattern) @injection.content)
- (#set! injection.language "regex"))
+(python_statement
+ (chunk) @injection.content
+ (#set! injection.language "python"))
((set_item
- option: (option_name) @_option
- value: (set_value) @injection.content)
- (#any-of? @_option
- "includeexpr" "inex"
- "printexpr" "pexpr"
- "formatexpr" "fex"
- "indentexpr" "inde"
- "foldtext" "fdt"
- "foldexpr" "fde"
- "diffexpr" "dex"
- "patchexpr" "pex"
- "charconvert" "ccv")
+ option: (option_name) @_option
+ value: (set_value) @injection.content)
+ (#any-of? @_option "includeexpr" "inex" "printexpr" "pexpr" "formatexpr" "fex" "indentexpr" "inde" "foldtext" "fdt" "foldexpr" "fde" "diffexpr" "dex" "patchexpr" "pex" "charconvert" "ccv")
(#set! injection.language "vim"))
-
-
-; ((comment) @injection.content
-; (#set! injection.language "comment"))
-
-; ((line_continuation_comment) @injection.content
-; (#set! injection.language "comment"))
diff --git a/runtime/queries/vimdoc/highlights.scm b/runtime/queries/vimdoc/highlights.scm
index e0dce49b2a..294fa94f10 100644
--- a/runtime/queries/vimdoc/highlights.scm
+++ b/runtime/queries/vimdoc/highlights.scm
@@ -1,25 +1,58 @@
-(h1) @text.title.1
-(h2) @text.title.2
-(h3) @text.title.3
-(column_heading) @text.title.4
+(h1) @markup.heading.1
+
+(h2) @markup.heading.2
+
+(h3) @markup.heading.3
+
+(column_heading) @markup.heading.4
+
(column_heading
- "~" @conceal (#set! conceal ""))
+ "~" @markup.heading.4.marker
+ (#set! conceal ""))
+
(tag
- "*" @conceal (#set! conceal "")
- text: (_) @label)
+ "*" @markup.heading.5.marker
+ (#set! conceal "")
+ text: (_) @label)
+
(taglink
- "|" @conceal (#set! conceal "")
- text: (_) @text.reference)
+ "|" @markup.link
+ (#set! conceal "")
+ text: (_) @markup.link)
+
(optionlink
- text: (_) @text.reference)
+ text: (_) @markup.link)
+
(codespan
- "`" @conceal (#set! conceal "")
- text: (_) @text.literal)
-(codeblock) @text.literal
+ "`" @markup.raw.delimiter
+ (#set! conceal "")
+ text: (_) @markup.raw)
+
+((codeblock) @markup.raw.block
+ (#set! "priority" 90))
+
(codeblock
- [">" (language)] @conceal (#set! conceal ""))
+ [
+ ">"
+ (language)
+ ] @markup.raw.delimiter
+ (#set! conceal ""))
+
(block
- "<" @conceal (#set! conceal ""))
-(argument) @parameter
+ "<" @markup.raw.delimiter
+ (#set! conceal ""))
+
+(argument) @variable.parameter
+
(keycode) @string.special
-(url) @text.uri
+
+(url) @string.special.url
+
+((note) @comment.note
+ (#any-of? @comment.note "Note:" "NOTE:" "Notes:"))
+
+((note) @comment.warning
+ (#any-of? @comment.warning "Warning:" "WARNING:"))
+
+((note) @comment.error
+ (#any-of? @comment.error "Deprecated:" "DEPRECATED:"))
diff --git a/runtime/queries/vimdoc/injections.scm b/runtime/queries/vimdoc/injections.scm
index 260a05d863..3b8fbf0f36 100644
--- a/runtime/queries/vimdoc/injections.scm
+++ b/runtime/queries/vimdoc/injections.scm
@@ -1,4 +1,4 @@
((codeblock
(language) @injection.language
(code) @injection.content)
- (#set! injection.include-children))
+ (#set! injection.include-children))
diff --git a/runtime/synmenu.vim b/runtime/synmenu.vim
index 43aae6f88b..edc6eabd1d 100644
--- a/runtime/synmenu.vim
+++ b/runtime/synmenu.vim
@@ -1,8 +1,8 @@
" Vim support file to define the syntax selection menu
" This file is normally sourced from menu.vim.
"
-" Maintainer: The Vim Project <https://github.com/vim/vim>
-" Last Change: 2023 Aug 10
+" Maintainer: The Vim Project <https://github.com/vim/vim>
+" Last Change: 2024 Jan 04
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" Define the SetSyn function, used for the Syntax menu entries.
@@ -16,6 +16,9 @@ fun! SetSyn(name)
let use_fvwm_2 = 1
let use_fvwm_1 = 0
let name = "fvwm"
+ elseif a:name =~ '^modula2:\w\+$'
+ let [name, dialect] = split(a:name, ":")
+ call modula2#SetDialect(dialect)
else
let name = a:name
endif
@@ -364,25 +367,27 @@ an 50.70.340 &Syntax.M.MMIX :cal SetSyn("mmix")<CR>
an 50.70.350 &Syntax.M.Modconf :cal SetSyn("modconf")<CR>
an 50.70.360 &Syntax.M.Model :cal SetSyn("model")<CR>
an 50.70.370 &Syntax.M.Modsim\ III :cal SetSyn("modsim3")<CR>
-an 50.70.380 &Syntax.M.Modula\ 2 :cal SetSyn("modula2")<CR>
-an 50.70.390 &Syntax.M.Modula\ 3 :cal SetSyn("modula3")<CR>
-an 50.70.400 &Syntax.M.Monk :cal SetSyn("monk")<CR>
-an 50.70.410 &Syntax.M.Motorola\ S-Record :cal SetSyn("srec")<CR>
-an 50.70.420 &Syntax.M.Mplayer\ config :cal SetSyn("mplayerconf")<CR>
-an 50.70.430 &Syntax.M.MOO :cal SetSyn("moo")<CR>
-an 50.70.440 &Syntax.M.Mrxvtrc :cal SetSyn("mrxvtrc")<CR>
-an 50.70.450 &Syntax.M.MS-DOS/Windows.4DOS\ \.bat\ file :cal SetSyn("btm")<CR>
-an 50.70.460 &Syntax.M.MS-DOS/Windows.\.bat\/\.cmd\ file :cal SetSyn("dosbatch")<CR>
-an 50.70.470 &Syntax.M.MS-DOS/Windows.\.ini\ file :cal SetSyn("dosini")<CR>
-an 50.70.480 &Syntax.M.MS-DOS/Windows.Message\ text :cal SetSyn("msmessages")<CR>
-an 50.70.490 &Syntax.M.MS-DOS/Windows.Module\ Definition :cal SetSyn("def")<CR>
-an 50.70.500 &Syntax.M.MS-DOS/Windows.Registry :cal SetSyn("registry")<CR>
-an 50.70.510 &Syntax.M.MS-DOS/Windows.Resource\ file :cal SetSyn("rc")<CR>
-an 50.70.520 &Syntax.M.Msql :cal SetSyn("msql")<CR>
-an 50.70.530 &Syntax.M.MuPAD :cal SetSyn("mupad")<CR>
-an 50.70.540 &Syntax.M.Murphi :cal SetSyn("murphi")<CR>
-an 50.70.550 &Syntax.M.MUSHcode :cal SetSyn("mush")<CR>
-an 50.70.560 &Syntax.M.Muttrc :cal SetSyn("muttrc")<CR>
+an 50.70.380 &Syntax.M.Modula-2.R10\ (2010) :cal SetSyn("modula2:r10")<CR>
+an 50.70.390 &Syntax.M.Modula-2.ISO\ (1994) :cal SetSyn("modula2:iso")<CR>
+an 50.70.400 &Syntax.M.Modula-2.PIM\ (1985) :cal SetSyn("modula2:pim")<CR>
+an 50.70.410 &Syntax.M.Modula-3 :cal SetSyn("modula3")<CR>
+an 50.70.420 &Syntax.M.Monk :cal SetSyn("monk")<CR>
+an 50.70.430 &Syntax.M.Motorola\ S-Record :cal SetSyn("srec")<CR>
+an 50.70.440 &Syntax.M.Mplayer\ config :cal SetSyn("mplayerconf")<CR>
+an 50.70.450 &Syntax.M.MOO :cal SetSyn("moo")<CR>
+an 50.70.460 &Syntax.M.Mrxvtrc :cal SetSyn("mrxvtrc")<CR>
+an 50.70.470 &Syntax.M.MS-DOS/Windows.4DOS\ \.bat\ file :cal SetSyn("btm")<CR>
+an 50.70.480 &Syntax.M.MS-DOS/Windows.\.bat\/\.cmd\ file :cal SetSyn("dosbatch")<CR>
+an 50.70.490 &Syntax.M.MS-DOS/Windows.\.ini\ file :cal SetSyn("dosini")<CR>
+an 50.70.500 &Syntax.M.MS-DOS/Windows.Message\ text :cal SetSyn("msmessages")<CR>
+an 50.70.510 &Syntax.M.MS-DOS/Windows.Module\ Definition :cal SetSyn("def")<CR>
+an 50.70.520 &Syntax.M.MS-DOS/Windows.Registry :cal SetSyn("registry")<CR>
+an 50.70.530 &Syntax.M.MS-DOS/Windows.Resource\ file :cal SetSyn("rc")<CR>
+an 50.70.540 &Syntax.M.Msql :cal SetSyn("msql")<CR>
+an 50.70.550 &Syntax.M.MuPAD :cal SetSyn("mupad")<CR>
+an 50.70.560 &Syntax.M.Murphi :cal SetSyn("murphi")<CR>
+an 50.70.570 &Syntax.M.MUSHcode :cal SetSyn("mush")<CR>
+an 50.70.580 &Syntax.M.Muttrc :cal SetSyn("muttrc")<CR>
an 50.80.100 &Syntax.NO.N1QL :cal SetSyn("n1ql")<CR>
an 50.80.110 &Syntax.NO.Nanorc :cal SetSyn("nanorc")<CR>
an 50.80.120 &Syntax.NO.Nastran\ input/DMAP :cal SetSyn("nastran")<CR>
@@ -650,7 +655,7 @@ an 50.170.390 &Syntax.WXYZ.XFree86\ Config :cal SetSyn("xf86conf")<CR>
an 50.170.410 &Syntax.WXYZ.YAML :cal SetSyn("yaml")<CR>
an 50.170.420 &Syntax.WXYZ.Yacc :cal SetSyn("yacc")<CR>
an 50.170.440 &Syntax.WXYZ.Zimbu :cal SetSyn("zimbu")<CR>
-an 50.170.440 &Syntax.WXYZ.Zserio:cal SetSyn("zserio")<CR>
+an 50.170.450 &Syntax.WXYZ.Zserio :cal SetSyn("zserio")<CR>
" The End Of The Syntax Menu
diff --git a/runtime/syntax/2html.vim b/runtime/syntax/2html.vim
deleted file mode 100644
index 5fbdad90f3..0000000000
--- a/runtime/syntax/2html.vim
+++ /dev/null
@@ -1,2068 +0,0 @@
-" Vim syntax support file
-" Maintainer: Ben Fritz <fritzophrenic@gmail.com>
-" Last Change: 2023 Sep 05
-"
-" Additional contributors:
-"
-" Original by Bram Moolenaar <Bram@vim.org>
-" Modified by David Ne\v{c}as (Yeti) <yeti@physics.muni.cz>
-" XHTML support by Panagiotis Issaris <takis@lumumba.luc.ac.be>
-" Made w3 compliant by Edd Barrett <vext01@gmail.com>
-" Added html_font. Edd Barrett <vext01@gmail.com>
-" Progress bar based off code from "progressbar widget" plugin by
-" Andreas Politz, heavily modified:
-" http://www.vim.org/scripts/script.php?script_id=2006
-"
-" See Mercurial change logs for more!
-
-" Transform a file into HTML, using the current syntax highlighting.
-
-" this file uses line continuations
-let s:cpo_sav = &cpo
-let s:ls = &ls
-let s:ei_sav = &eventignore
-set cpo&vim
-
-" HTML filetype can take a while to load/highlight if the destination file
-" already exists.
-set eventignore+=FileType
-
-let s:end=line('$')
-
-" Font
-if exists("g:html_font")
- if type(g:html_font) == type([])
- let s:htmlfont = "'".. join(g:html_font,"','") .. "', monospace"
- else
- let s:htmlfont = "'".. g:html_font .. "', monospace"
- endif
-else
- let s:htmlfont = "monospace"
-endif
-
-let s:settings = tohtml#GetUserSettings()
-
-if s:settings.use_xhtml
- let s:html5 = 0
-elseif s:settings.use_css && !s:settings.no_pre
- let s:html5 = 1
-else
- let s:html5 = 0
-endif
-
-if !exists('s:FOLDED_ID')
- let s:FOLDED_ID = hlID("Folded") | lockvar s:FOLDED_ID
- let s:FOLD_C_ID = hlID("FoldColumn") | lockvar s:FOLD_C_ID
- let s:LINENR_ID = hlID('LineNr') | lockvar s:LINENR_ID
- let s:DIFF_D_ID = hlID("DiffDelete") | lockvar s:DIFF_D_ID
- let s:DIFF_A_ID = hlID("DiffAdd") | lockvar s:DIFF_A_ID
- let s:DIFF_C_ID = hlID("DiffChange") | lockvar s:DIFF_C_ID
- let s:DIFF_T_ID = hlID("DiffText") | lockvar s:DIFF_T_ID
- let s:CONCEAL_ID = hlID('Conceal') | lockvar s:CONCEAL_ID
-endif
-
-" Whitespace
-if s:settings.pre_wrap
- let s:whitespace = "white-space: pre-wrap; "
-else
- let s:whitespace = ""
-endif
-
-if !empty(s:settings.prevent_copy)
- if s:settings.no_invalid
- " User has decided they don't want invalid markup. Still works in
- " OpenOffice, and for text editors, but when pasting into Microsoft Word the
- " input elements get pasted too and they cannot be deleted (at least not
- " easily).
- let s:unselInputType = ""
- else
- " Prevent from copy-pasting the input elements into Microsoft Word where
- " they cannot be deleted easily by deliberately inserting invalid markup.
- let s:unselInputType = " type='invalid_input_type'"
- endif
-endif
-
-" When gui colors are not supported, we can only guess the colors.
-" TODO - is this true anymore? Is there a way to ask the terminal what colors
-" each number means or read them from some file?
-if &termguicolors || has("gui_running")
- let s:whatterm = "gui"
-else
- let s:whatterm = "cterm"
- if &t_Co == 8
- let s:cterm_color = {
- \ 0: "#808080", 1: "#ff6060", 2: "#00ff00", 3: "#ffff00",
- \ 4: "#8080ff", 5: "#ff40ff", 6: "#00ffff", 7: "#ffffff"
- \ }
- else
- let s:cterm_color = {
- \ 0: "#000000", 1: "#c00000", 2: "#008000", 3: "#804000",
- \ 4: "#0000c0", 5: "#c000c0", 6: "#008080", 7: "#c0c0c0",
- \ 8: "#808080", 9: "#ff6060", 10: "#00ff00", 11: "#ffff00",
- \ 12: "#8080ff", 13: "#ff40ff", 14: "#00ffff", 15: "#ffffff"
- \ }
-
- " Colors for 88 and 256 come from xterm.
- if &t_Co == 88
- call extend(s:cterm_color, {
- \ 16: "#000000", 17: "#00008b", 18: "#0000cd", 19: "#0000ff",
- \ 20: "#008b00", 21: "#008b8b", 22: "#008bcd", 23: "#008bff",
- \ 24: "#00cd00", 25: "#00cd8b", 26: "#00cdcd", 27: "#00cdff",
- \ 28: "#00ff00", 29: "#00ff8b", 30: "#00ffcd", 31: "#00ffff",
- \ 32: "#8b0000", 33: "#8b008b", 34: "#8b00cd", 35: "#8b00ff",
- \ 36: "#8b8b00", 37: "#8b8b8b", 38: "#8b8bcd", 39: "#8b8bff",
- \ 40: "#8bcd00", 41: "#8bcd8b", 42: "#8bcdcd", 43: "#8bcdff",
- \ 44: "#8bff00", 45: "#8bff8b", 46: "#8bffcd", 47: "#8bffff",
- \ 48: "#cd0000", 49: "#cd008b", 50: "#cd00cd", 51: "#cd00ff",
- \ 52: "#cd8b00", 53: "#cd8b8b", 54: "#cd8bcd", 55: "#cd8bff",
- \ 56: "#cdcd00", 57: "#cdcd8b", 58: "#cdcdcd", 59: "#cdcdff",
- \ 60: "#cdff00", 61: "#cdff8b", 62: "#cdffcd", 63: "#cdffff",
- \ 64: "#ff0000"
- \ })
- call extend(s:cterm_color, {
- \ 65: "#ff008b", 66: "#ff00cd", 67: "#ff00ff", 68: "#ff8b00",
- \ 69: "#ff8b8b", 70: "#ff8bcd", 71: "#ff8bff", 72: "#ffcd00",
- \ 73: "#ffcd8b", 74: "#ffcdcd", 75: "#ffcdff", 76: "#ffff00",
- \ 77: "#ffff8b", 78: "#ffffcd", 79: "#ffffff", 80: "#2e2e2e",
- \ 81: "#5c5c5c", 82: "#737373", 83: "#8b8b8b", 84: "#a2a2a2",
- \ 85: "#b9b9b9", 86: "#d0d0d0", 87: "#e7e7e7"
- \ })
- elseif &t_Co == 256
- call extend(s:cterm_color, {
- \ 16: "#000000", 17: "#00005f", 18: "#000087", 19: "#0000af",
- \ 20: "#0000d7", 21: "#0000ff", 22: "#005f00", 23: "#005f5f",
- \ 24: "#005f87", 25: "#005faf", 26: "#005fd7", 27: "#005fff",
- \ 28: "#008700", 29: "#00875f", 30: "#008787", 31: "#0087af",
- \ 32: "#0087d7", 33: "#0087ff", 34: "#00af00", 35: "#00af5f",
- \ 36: "#00af87", 37: "#00afaf", 38: "#00afd7", 39: "#00afff",
- \ 40: "#00d700", 41: "#00d75f", 42: "#00d787", 43: "#00d7af",
- \ 44: "#00d7d7", 45: "#00d7ff", 46: "#00ff00", 47: "#00ff5f",
- \ 48: "#00ff87", 49: "#00ffaf", 50: "#00ffd7", 51: "#00ffff",
- \ 52: "#5f0000", 53: "#5f005f", 54: "#5f0087", 55: "#5f00af",
- \ 56: "#5f00d7", 57: "#5f00ff", 58: "#5f5f00", 59: "#5f5f5f",
- \ 60: "#5f5f87", 61: "#5f5faf", 62: "#5f5fd7", 63: "#5f5fff",
- \ 64: "#5f8700"
- \ })
- call extend(s:cterm_color, {
- \ 65: "#5f875f", 66: "#5f8787", 67: "#5f87af", 68: "#5f87d7",
- \ 69: "#5f87ff", 70: "#5faf00", 71: "#5faf5f", 72: "#5faf87",
- \ 73: "#5fafaf", 74: "#5fafd7", 75: "#5fafff", 76: "#5fd700",
- \ 77: "#5fd75f", 78: "#5fd787", 79: "#5fd7af", 80: "#5fd7d7",
- \ 81: "#5fd7ff", 82: "#5fff00", 83: "#5fff5f", 84: "#5fff87",
- \ 85: "#5fffaf", 86: "#5fffd7", 87: "#5fffff", 88: "#870000",
- \ 89: "#87005f", 90: "#870087", 91: "#8700af", 92: "#8700d7",
- \ 93: "#8700ff", 94: "#875f00", 95: "#875f5f", 96: "#875f87",
- \ 97: "#875faf", 98: "#875fd7", 99: "#875fff", 100: "#878700",
- \ 101: "#87875f", 102: "#878787", 103: "#8787af", 104: "#8787d7",
- \ 105: "#8787ff", 106: "#87af00", 107: "#87af5f", 108: "#87af87",
- \ 109: "#87afaf", 110: "#87afd7", 111: "#87afff", 112: "#87d700"
- \ })
- call extend(s:cterm_color, {
- \ 113: "#87d75f", 114: "#87d787", 115: "#87d7af", 116: "#87d7d7",
- \ 117: "#87d7ff", 118: "#87ff00", 119: "#87ff5f", 120: "#87ff87",
- \ 121: "#87ffaf", 122: "#87ffd7", 123: "#87ffff", 124: "#af0000",
- \ 125: "#af005f", 126: "#af0087", 127: "#af00af", 128: "#af00d7",
- \ 129: "#af00ff", 130: "#af5f00", 131: "#af5f5f", 132: "#af5f87",
- \ 133: "#af5faf", 134: "#af5fd7", 135: "#af5fff", 136: "#af8700",
- \ 137: "#af875f", 138: "#af8787", 139: "#af87af", 140: "#af87d7",
- \ 141: "#af87ff", 142: "#afaf00", 143: "#afaf5f", 144: "#afaf87",
- \ 145: "#afafaf", 146: "#afafd7", 147: "#afafff", 148: "#afd700",
- \ 149: "#afd75f", 150: "#afd787", 151: "#afd7af", 152: "#afd7d7",
- \ 153: "#afd7ff", 154: "#afff00", 155: "#afff5f", 156: "#afff87",
- \ 157: "#afffaf", 158: "#afffd7"
- \ })
- call extend(s:cterm_color, {
- \ 159: "#afffff", 160: "#d70000", 161: "#d7005f", 162: "#d70087",
- \ 163: "#d700af", 164: "#d700d7", 165: "#d700ff", 166: "#d75f00",
- \ 167: "#d75f5f", 168: "#d75f87", 169: "#d75faf", 170: "#d75fd7",
- \ 171: "#d75fff", 172: "#d78700", 173: "#d7875f", 174: "#d78787",
- \ 175: "#d787af", 176: "#d787d7", 177: "#d787ff", 178: "#d7af00",
- \ 179: "#d7af5f", 180: "#d7af87", 181: "#d7afaf", 182: "#d7afd7",
- \ 183: "#d7afff", 184: "#d7d700", 185: "#d7d75f", 186: "#d7d787",
- \ 187: "#d7d7af", 188: "#d7d7d7", 189: "#d7d7ff", 190: "#d7ff00",
- \ 191: "#d7ff5f", 192: "#d7ff87", 193: "#d7ffaf", 194: "#d7ffd7",
- \ 195: "#d7ffff", 196: "#ff0000", 197: "#ff005f", 198: "#ff0087",
- \ 199: "#ff00af", 200: "#ff00d7", 201: "#ff00ff", 202: "#ff5f00",
- \ 203: "#ff5f5f", 204: "#ff5f87"
- \ })
- call extend(s:cterm_color, {
- \ 205: "#ff5faf", 206: "#ff5fd7", 207: "#ff5fff", 208: "#ff8700",
- \ 209: "#ff875f", 210: "#ff8787", 211: "#ff87af", 212: "#ff87d7",
- \ 213: "#ff87ff", 214: "#ffaf00", 215: "#ffaf5f", 216: "#ffaf87",
- \ 217: "#ffafaf", 218: "#ffafd7", 219: "#ffafff", 220: "#ffd700",
- \ 221: "#ffd75f", 222: "#ffd787", 223: "#ffd7af", 224: "#ffd7d7",
- \ 225: "#ffd7ff", 226: "#ffff00", 227: "#ffff5f", 228: "#ffff87",
- \ 229: "#ffffaf", 230: "#ffffd7", 231: "#ffffff", 232: "#080808",
- \ 233: "#121212", 234: "#1c1c1c", 235: "#262626", 236: "#303030",
- \ 237: "#3a3a3a", 238: "#444444", 239: "#4e4e4e", 240: "#585858",
- \ 241: "#626262", 242: "#6c6c6c", 243: "#767676", 244: "#808080",
- \ 245: "#8a8a8a", 246: "#949494", 247: "#9e9e9e", 248: "#a8a8a8",
- \ 249: "#b2b2b2", 250: "#bcbcbc", 251: "#c6c6c6", 252: "#d0d0d0",
- \ 253: "#dadada", 254: "#e4e4e4", 255: "#eeeeee"
- \ })
- endif
- endif
-endif
-
-" Return good color specification: in GUI no transformation is done, in
-" terminal return RGB values of known colors and empty string for unknown
-if s:whatterm == "gui"
- function! s:HtmlColor(color)
- return a:color
- endfun
-else
- function! s:HtmlColor(color)
- if has_key(s:cterm_color, a:color)
- return s:cterm_color[a:color]
- else
- return ""
- endif
- endfun
-endif
-
-" Find out the background and foreground color for use later
-let s:fgc = s:HtmlColor(synIDattr(hlID("Normal")->synIDtrans(), "fg#", s:whatterm))
-let s:bgc = s:HtmlColor(synIDattr(hlID("Normal")->synIDtrans(), "bg#", s:whatterm))
-if s:fgc == ""
- let s:fgc = ( &background == "dark" ? "#ffffff" : "#000000" )
-endif
-if s:bgc == ""
- let s:bgc = ( &background == "dark" ? "#000000" : "#ffffff" )
-endif
-
-if !s:settings.use_css
- " Return opening HTML tag for given highlight id
- function! s:HtmlOpening(id, extra_attrs)
- let a = ""
- let translated_ID = synIDtrans(a:id)
- if synIDattr(translated_ID, "inverse")
- " For inverse, we always must set both colors (and exchange them)
- let x = s:HtmlColor(synIDattr(translated_ID, "fg#", s:whatterm))
- let a = a .. '<span '..a:extra_attrs..'style="background-color: ' .. ( x != "" ? x : s:fgc ) .. '">'
- let x = s:HtmlColor(synIDattr(translated_ID, "bg#", s:whatterm))
- let a = a .. '<font color="' .. ( x != "" ? x : s:bgc ) .. '">'
- else
- let x = s:HtmlColor(synIDattr(translated_ID, "bg#", s:whatterm))
- if x != ""
- let a = a .. '<span '..a:extra_attrs..'style="background-color: ' .. x .. '">'
- elseif !empty(a:extra_attrs)
- let a = a .. '<span '..a:extra_attrs..'>'
- endif
- let x = s:HtmlColor(synIDattr(translated_ID, "fg#", s:whatterm))
- if x != "" | let a = a .. '<font color="' .. x .. '">' | endif
- endif
- if synIDattr(translated_ID, "bold") | let a = a .. "<b>" | endif
- if synIDattr(translated_ID, "italic") | let a = a .. "<i>" | endif
- if synIDattr(translated_ID, "underline") | let a = a .. "<u>" | endif
- return a
- endfun
-
- " Return closing HTML tag for given highlight id
- function! s:HtmlClosing(id, has_extra_attrs)
- let a = ""
- let translated_ID = synIDtrans(a:id)
- if synIDattr(translated_ID, "underline") | let a = a .. "</u>" | endif
- if synIDattr(translated_ID, "italic") | let a = a .. "</i>" | endif
- if synIDattr(translated_ID, "bold") | let a = a .. "</b>" | endif
- if synIDattr(translated_ID, "inverse")
- let a = a .. '</font></span>'
- else
- let x = s:HtmlColor(synIDattr(translated_ID, "fg#", s:whatterm))
- if x != "" | let a = a .. '</font>' | endif
- let x = s:HtmlColor(synIDattr(translated_ID, "bg#", s:whatterm))
- if x != "" || a:has_extra_attrs | let a = a .. '</span>' | endif
- endif
- return a
- endfun
-endif
-
-" Use a different function for formatting based on user options. This way we
-" can avoid a lot of logic during the actual execution.
-"
-" Build the function line by line containing only what is needed for the options
-" in use for maximum code sharing with minimal branch logic for greater speed.
-"
-" Note, 'exec' commands do not recognize line continuations, so must concatenate
-" lines rather than continue them.
-if s:settings.use_css
- " save CSS to a list of rules to add to the output at the end of processing
-
- " first, get the style names we need
- let s:wrapperfunc_lines = []
- call add(s:wrapperfunc_lines, [])
- let s:wrapperfunc_lines[-1] =<< trim ENDLET
- function! s:BuildStyleWrapper(style_id, diff_style_id, extra_attrs, text, make_unselectable, unformatted)
-
- let l:style_name = synIDattr(a:style_id, "name", s:whatterm)
- ENDLET
- if &diff
- call add(s:wrapperfunc_lines, [])
- let s:wrapperfunc_lines[-1] =<< trim ENDLET
- let l:diff_style_name = synIDattr(a:diff_style_id, "name", s:whatterm)
- ENDLET
-
- " Add normal groups and diff groups to separate lists so we can order them to
- " allow diff highlight to override normal highlight
-
- " if primary style IS a diff style, grab it from the diff cache instead
- " (always succeeds because we pre-populate it)
- call add(s:wrapperfunc_lines, [])
- let s:wrapperfunc_lines[-1] =<< trim ENDLET
-
- if a:style_id == s:DIFF_D_ID || a:style_id == s:DIFF_A_ID || a:style_id == s:DIFF_C_ID || a:style_id == s:DIFF_T_ID
- let l:saved_style = get(s:diffstylelist,a:style_id)
- else
- ENDLET
- endif
-
- " get primary style info from cache or build it on the fly if not found
- call add(s:wrapperfunc_lines, [])
- let s:wrapperfunc_lines[-1] =<< trim ENDLET
- let l:saved_style = get(s:stylelist,a:style_id)
- if type(l:saved_style) == type(0)
- unlet l:saved_style
- let l:saved_style = s:CSS1(a:style_id)
- if l:saved_style != ""
- let l:saved_style = "." .. l:style_name .. " { " .. l:saved_style .. "}"
- endif
- let s:stylelist[a:style_id] = l:saved_style
- endif
- ENDLET
- if &diff
- call add(s:wrapperfunc_lines, [])
- let s:wrapperfunc_lines[-1] =<< trim ENDLET
- endif
- ENDLET
- endif
-" Ignore this comment, just bypassing a highlighting issue: if
-
- " Build the wrapper tags around the text. It turns out that caching these
- " gives pretty much zero performance gain and adds a lot of logic.
-
- call add(s:wrapperfunc_lines, [])
- let s:wrapperfunc_lines[-1] =<< trim ENDLET
-
- if l:saved_style == "" && empty(a:extra_attrs)
- ENDLET
- if &diff
- call add(s:wrapperfunc_lines, [])
- let s:wrapperfunc_lines[-1] =<< trim ENDLET
- if a:diff_style_id <= 0
- ENDLET
- endif
- " no surroundings if neither primary nor diff style has any info
- call add(s:wrapperfunc_lines, [])
- let s:wrapperfunc_lines[-1] =<< trim ENDLET
- return a:text
- ENDLET
- if &diff
- " no primary style, but diff style
- call add(s:wrapperfunc_lines, [])
- let s:wrapperfunc_lines[-1] =<< trim ENDLET
- else
- return '<span class="' ..l:diff_style_name .. '">'..a:text.."</span>"
- endif
- ENDLET
- endif
- " Ignore this comment, just bypassing a highlighting issue: if
-
- " open tag for non-empty primary style
- call add(s:wrapperfunc_lines, [])
- let s:wrapperfunc_lines[-1] =<< trim ENDLET
- else
- ENDLET
- " non-empty primary style. handle either empty or non-empty diff style.
- "
- " separate the two classes by a space to apply them both if there is a diff
- " style name, unless the primary style is empty, then just use the diff style
- " name
- let s:diffstyle =
- \ (&diff ? '(a:diff_style_id <= 0 ? "" : " " .. l:diff_style_name)..'
- \ : '')
- if s:settings.prevent_copy == ""
- call add(s:wrapperfunc_lines, [])
- let s:wrapperfunc_lines[-1] =<< trim eval ENDLET
- return "<span "..a:extra_attrs..'class="' .. l:style_name ..{s:diffstyle}'">'..a:text.."</span>"
- ENDLET
- else
-
- " New method: use generated content in the CSS. The only thing needed here
- " is a span with no content, with an attribute holding the desired text.
- "
- " Old method: use an <input> element when text is unsectable. This is still
- " used in conditional comments for Internet Explorer, where the new method
- " doesn't work.
- "
- " Wrap the <input> in a <span> to allow fixing the stupid bug in some fonts
- " which cause browsers to display a 1px gap between lines when these
- " <input>s have a background color (maybe not really a bug, this isn't
- " well-defined)
- "
- " use strwidth, because we care only about how many character boxes are
- " needed to size the input, we don't care how many characters (including
- " separately counted composing chars, from strchars()) or bytes (from
- " len())the string contains. strdisplaywidth() is not needed because none of
- " the unselectable groups can contain tab characters (fold column, fold
- " text, line number).
- "
- " Note, if maxlength property needs to be added in the future, it will need
- " to use strchars(), because HTML specifies that the maxlength parameter
- " uses the number of unique codepoints for its limit.
- call add(s:wrapperfunc_lines, [])
- let s:wrapperfunc_lines[-1] =<< trim eval ENDLET
- if a:make_unselectable
- let return_span = "<span "..a:extra_attrs..'class="' .. l:style_name ..{s:diffstyle}'"'
- ENDLET
- if s:settings.use_input_for_pc !=# 'all'
- call add(s:wrapperfunc_lines, [])
- let s:wrapperfunc_lines[-1] =<< trim ENDLET
- let return_span ..= " data-" .. l:style_name .. '-content="'..a:text..'"'
- ENDLET
- endif
- call add(s:wrapperfunc_lines, [])
- let s:wrapperfunc_lines[-1] =<< trim ENDLET
- let return_span ..= '>'
- ENDLET
- if s:settings.use_input_for_pc !=# 'none'
- call add(s:wrapperfunc_lines, [])
- let s:wrapperfunc_lines[-1] =<< trim eval ENDLET
- let return_span ..= '<input'..s:unselInputType..' class="' .. l:style_name ..{s:diffstyle}'"'
- let return_span ..= ' value="'..substitute(a:unformatted,'\s\+$',"","")..'"'
- let return_span ..= " onselect='this.blur(); return false;'"
- let return_span ..= " onmousedown='this.blur(); return false;'"
- let return_span ..= " onclick='this.blur(); return false;'"
- let return_span ..= " readonly='readonly'"
- let return_span ..= ' size="'..strwidth(a:unformatted)..'"'
- let return_span ..= (s:settings.use_xhtml ? '/>' : '>')
- ENDLET
- endif
- call add(s:wrapperfunc_lines, [])
- let s:wrapperfunc_lines[-1] =<< trim eval ENDLET
- return return_span..'</span>'
- else
- return "<span "..a:extra_attrs..'class="' .. l:style_name .. {s:diffstyle}'">'..a:text.."</span>"
- endif
- ENDLET
- endif
- call add(s:wrapperfunc_lines, [])
- let s:wrapperfunc_lines[-1] =<< trim ENDLET
- endif
- endfun
- ENDLET
-else
- " Non-CSS method just needs the wrapper.
- "
- " Functions used to get opening/closing automatically return null strings if
- " no styles exist.
- if &diff
- let s:wrapperfunc_lines =<< trim ENDLET
- function! s:BuildStyleWrapper(style_id, diff_style_id, extra_attrs, text, unusedarg, unusedarg2)
- if a:diff_style_id <= 0
- let l:diff_opening = s:HtmlOpening(a:diff_style_id, "")
- let l:diff_closing = s:HtmlClosing(a:diff_style_id, 0)
- else
- let l:diff_opening = ""
- let l:diff_closing = ""
- endif
- return s:HtmlOpening(a:style_id, a:extra_attrs)..l:diff_opening..a:text..l:diff_closing..s:HtmlClosing(a:style_id, !empty(a:extra_attrs))
- endfun
- ENDLET
- else
- let s:wrapperfunc_lines =<< trim ENDLET
- function! s:BuildStyleWrapper(style_id, diff_style_id, extra_attrs, text, unusedarg, unusedarg2)
- return s:HtmlOpening(a:style_id, a:extra_attrs)..a:text..s:HtmlClosing(a:style_id, !empty(a:extra_attrs))
- endfun
- ENDLET
- endif
-endif
-
-" create the function we built line by line above
-exec join(flatten(s:wrapperfunc_lines), "\n")
-
-let s:diff_mode = &diff
-
-" Return HTML valid characters enclosed in a span of class style_name with
-" unprintable characters expanded and double spaces replaced as necessary.
-"
-" TODO: eliminate unneeded logic like done for BuildStyleWrapper
-function! s:HtmlFormat(text, style_id, diff_style_id, extra_attrs, make_unselectable)
- " Replace unprintable characters
- let unformatted = strtrans(a:text)
-
- let formatted = unformatted
-
- " Replace the reserved html characters
- let formatted = substitute(formatted, '&', '\&amp;', 'g')
- let formatted = substitute(formatted, '<', '\&lt;', 'g')
- let formatted = substitute(formatted, '>', '\&gt;', 'g')
- let formatted = substitute(formatted, '"', '\&quot;', 'g')
- " &apos; is not valid in HTML but it is in XHTML, so just use the numeric
- " reference for it instead. Needed because it could appear in quotes
- " especially if unselectable regions is turned on.
- let formatted = substitute(formatted, '"', '\&#0039;', 'g')
-
- " Replace a "form feed" character with HTML to do a page break
- " TODO: need to prevent this in unselectable areas? Probably it should never
- " BE in an unselectable area...
- let formatted = substitute(formatted, "\x0c", '<hr class="PAGE-BREAK">', 'g')
-
- " Replace double spaces, leading spaces, and trailing spaces if needed
- if ' ' != s:HtmlSpace
- let formatted = substitute(formatted, ' ', s:HtmlSpace .. s:HtmlSpace, 'g')
- let formatted = substitute(formatted, '^ ', s:HtmlSpace, 'g')
- let formatted = substitute(formatted, ' \+$', s:HtmlSpace, 'g')
- endif
-
- " Enclose in the correct format
- return s:BuildStyleWrapper(a:style_id, a:diff_style_id, a:extra_attrs, formatted, a:make_unselectable, unformatted)
-endfun
-
-" set up functions to call HtmlFormat in certain ways based on whether the
-" element is supposed to be unselectable or not
-if s:settings.prevent_copy =~# 'n'
- if s:settings.number_lines
- if s:settings.line_ids
- function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr)
- if a:lnr > 0
- return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, 'id="'..(exists('g:html_diff_win_num') ? 'W'..g:html_diff_win_num : "")..'L'..a:lnr..s:settings.id_suffix..'" ', 1)
- else
- return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 1)
- endif
- endfun
- else
- function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr)
- return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 1)
- endfun
- endif
- elseif s:settings.line_ids
- " if lines are not being numbered the only reason this function gets called
- " is to put the line IDs on each line; "text" will be empty but lnr will
- " always be non-zero, however we don't want to use the <input> because that
- " won't work as nice for empty text
- function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr)
- return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, 'id="'..(exists('g:html_diff_win_num') ? 'W'..g:html_diff_win_num : "")..'L'..a:lnr..s:settings.id_suffix..'" ', 0)
- endfun
- endif
-else
- if s:settings.line_ids
- function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr)
- if a:lnr > 0
- return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, 'id="'..(exists('g:html_diff_win_num') ? 'W'..g:html_diff_win_num : "")..'L'..a:lnr..s:settings.id_suffix..'" ', 0)
- else
- return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 0)
- endif
- endfun
- else
- function! s:HtmlFormat_n(text, style_id, diff_style_id, lnr)
- return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 0)
- endfun
- endif
-endif
-if s:settings.prevent_copy =~# 'd'
- function! s:HtmlFormat_d(text, style_id, diff_style_id)
- return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 1)
- endfun
-else
- function! s:HtmlFormat_d(text, style_id, diff_style_id)
- return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 0)
- endfun
-endif
-if s:settings.prevent_copy =~# 'f'
- if s:settings.use_input_for_pc ==# 'none'
- " Simply space-pad to the desired width inside the generated content (note
- " that the FoldColumn definition includes a whitespace:pre rule)
- function! s:FoldColumn_build(char, len, numfill, char2, class, click)
- return "<a href='#' class='"..a:class.."' onclick='"..a:click.."' data-FoldColumn-content='".
- \ repeat(a:char, a:len)..a:char2..repeat(' ', a:numfill).
- \ "'></a>"
- endfun
- function! s:FoldColumn_fill()
- return s:HtmlFormat(repeat(' ', s:foldcolumn), s:FOLD_C_ID, 0, "", 1)
- endfun
- else
- " Note the <input> elements for fill spaces will have a single space for
- " content, to allow active cursor CSS selection to work.
- "
- " Wrap the whole thing in a span for the 1px padding workaround for gaps.
- "
- " Build the function line by line containing only what is needed for the
- " options in use for maximum code sharing with minimal branch logic for
- " greater speed.
- "
- " Note, 'exec' commands do not recognize line continuations, so must
- " concatenate lines rather than continue them.
- let s:build_fun_lines = []
- call add(s:build_fun_lines, [])
- let s:build_fun_lines[-1] =<< trim ENDLET
- function! s:FoldColumn_build(char, len, numfill, char2, class, click)
- let l:input_open = "<input readonly='readonly'"..s:unselInputType
- let l:input_open ..= " onselect='this.blur(); return false;'"
- let l:input_open ..= " onmousedown='this.blur(); "..a:click.." return false;'"
- let l:input_open ..= " onclick='return false;' size='"
- let l:input_open ..= string(a:len + (empty(a:char2) ? 0 : 1) + a:numfill) .. "' "
- let l:common_attrs = "class='FoldColumn' value='"
- let l:input_close = (s:settings.use_xhtml ? "' />" : "'>")
- let l:return_span = "<span class='"..a:class.."'>"
- let l:return_span ..= l:input_open..l:common_attrs..repeat(a:char, a:len)..(a:char2)
- let l:return_span ..= l:input_close
- ENDLET
- if s:settings.use_input_for_pc ==# 'fallback'
- call add(s:build_fun_lines, [])
- let s:build_fun_lines[-1] =<< trim ENDLET
- let l:return_span ..= "<a href='#' class='FoldColumn' onclick='"..a:click.."'"
- let l:return_span ..= " data-FoldColumn-content='"
- let l:return_span ..= repeat(a:char, a:len)..a:char2..repeat(' ', a:numfill)
- let l:return_span ..= "'></a>"
- ENDLET
- endif
- call add(s:build_fun_lines, [])
- let s:build_fun_lines[-1] =<< trim ENDLET
- let l:return_span ..= "</span>"
- return l:return_span
- endfun
- ENDLET
- " create the function we built line by line above
- exec join(flatten(s:build_fun_lines), "\n")
-
- function! s:FoldColumn_fill()
- return s:FoldColumn_build(' ', s:foldcolumn, 0, '', 'FoldColumn', '')
- endfun
- endif
-else
- " For normal fold columns, simply space-pad to the desired width (note that
- " the FoldColumn definition includes a whitespace:pre rule)
- function! s:FoldColumn_build(char, len, numfill, char2, class, click)
- return "<a href='#' class='"..a:class.."' onclick='"..a:click.."'>".
- \ repeat(a:char, a:len)..a:char2..repeat(' ', a:numfill).
- \ "</a>"
- endfun
- function! s:FoldColumn_fill()
- return s:HtmlFormat(repeat(' ', s:foldcolumn), s:FOLD_C_ID, 0, "", 0)
- endfun
-endif
-if s:settings.prevent_copy =~# 't'
- " put an extra empty span at the end for dynamic folds, so the linebreak can
- " be surrounded. Otherwise do it as normal.
- "
- " TODO: isn't there a better way to do this, than placing it here and using a
- " substitute later?
- if s:settings.dynamic_folds
- function! s:HtmlFormat_t(text, style_id, diff_style_id)
- return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 1) .
- \ s:HtmlFormat("", a:style_id, 0, "", 0)
- endfun
- else
- function! s:HtmlFormat_t(text, style_id, diff_style_id)
- return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 1)
- endfun
- endif
-else
- function! s:HtmlFormat_t(text, style_id, diff_style_id)
- return s:HtmlFormat(a:text, a:style_id, a:diff_style_id, "", 0)
- endfun
-endif
-
-" Return CSS style describing given highlight id (can be empty)
-function! s:CSS1(id)
- let a = ""
- let translated_ID = synIDtrans(a:id)
- if synIDattr(translated_ID, "inverse")
- " For inverse, we always must set both colors (and exchange them)
- let x = s:HtmlColor(synIDattr(translated_ID, "bg#", s:whatterm))
- let a = a .. "color: " .. ( x != "" ? x : s:bgc ) .. "; "
- let x = s:HtmlColor(synIDattr(translated_ID, "fg#", s:whatterm))
- let a = a .. "background-color: " .. ( x != "" ? x : s:fgc ) .. "; "
- else
- let x = s:HtmlColor(synIDattr(translated_ID, "fg#", s:whatterm))
- if x != "" | let a = a .. "color: " .. x .. "; " | endif
- let x = s:HtmlColor(synIDattr(translated_ID, "bg#", s:whatterm))
- if x != ""
- let a = a .. "background-color: " .. x .. "; "
- " stupid hack because almost every browser seems to have at least one font
- " which shows 1px gaps between lines which have background
- let a = a .. "padding-bottom: 1px; "
- elseif (translated_ID == s:FOLDED_ID || translated_ID == s:LINENR_ID || translated_ID == s:FOLD_C_ID) && !empty(s:settings.prevent_copy)
- " input elements default to a different color than the rest of the page
- let a = a .. "background-color: " .. s:bgc .. "; "
- endif
- endif
- if synIDattr(translated_ID, "bold") | let a = a .. "font-weight: bold; " | endif
- if synIDattr(translated_ID, "italic") | let a = a .. "font-style: italic; " | endif
- if synIDattr(translated_ID, "underline") | let a = a .. "text-decoration: underline; " | endif
- return a
-endfun
-
-if s:settings.dynamic_folds
- " compares two folds as stored in our list of folds
- " A fold is "less" than another if it starts at an earlier line number,
- " or ends at a later line number, ties broken by fold level
- function! s:FoldCompare(f1, f2)
- if a:f1.firstline != a:f2.firstline
- " put it before if it starts earlier
- return a:f1.firstline - a:f2.firstline
- elseif a:f1.lastline != a:f2.lastline
- " put it before if it ends later
- return a:f2.lastline - a:f1.lastline
- else
- " if folds begin and end on the same lines, put lowest fold level first
- return a:f1.level - a:f2.level
- endif
- endfunction
-
-endif
-
-
-" Set some options to make it work faster.
-" Don't report changes for :substitute, there will be many of them.
-" Don't change other windows; turn off scroll bind temporarily
-let s:old_title = &title
-let s:old_icon = &icon
-let s:old_et = &l:et
-let s:old_bind = &l:scrollbind
-let s:old_report = &report
-let s:old_search = @/
-let s:old_more = &more
-set notitle noicon
-setlocal et
-set nomore
-set report=1000000
-setlocal noscrollbind
-
-if exists(':ownsyntax') && exists('w:current_syntax')
- let s:current_syntax = w:current_syntax
-elseif exists('b:current_syntax')
- let s:current_syntax = b:current_syntax
-else
- let s:current_syntax = 'none'
-endif
-
-if s:current_syntax == ''
- let s:current_syntax = 'none'
-endif
-
-" If the user is sourcing this script directly then the plugin version isn't
-" known because the main plugin script didn't load. In the usual case where the
-" user still has the full Vim runtime installed, or has this full plugin
-" installed in a package or something, then we can extract the version from the
-" main plugin file at it's usual spot relative to this file. Otherwise the user
-" is assembling their runtime piecemeal and we have no idea what versions of
-" other files may be present so don't even try to make a guess or assume the
-" presence of other specific files with specific meaning.
-"
-" We don't want to actually source the main plugin file here because the user
-" may have a good reason not to (e.g. they define their own TOhtml command or
-" something).
-"
-" If this seems way too complicated and convoluted, it is. Probably I should
-" have put the version information in the autoload file from the start. But the
-" version has been in the global variable for so long that changing it could
-" break a lot of user scripts.
-if exists("g:loaded_2html_plugin")
- let s:pluginversion = g:loaded_2html_plugin
-else
- if !exists("g:unloaded_tohtml_plugin")
- let s:main_plugin_path = expand("<sfile>:p:h:h").."/plugin/tohtml.vim"
- if filereadable(s:main_plugin_path)
- let s:lines = readfile(s:main_plugin_path, "", 20)
- call filter(s:lines, 'v:val =~ "loaded_2html_plugin = "')
- if empty(s:lines)
- let g:unloaded_tohtml_plugin = "unknown"
- else
- let g:unloaded_tohtml_plugin = substitute(s:lines[0], '.*loaded_2html_plugin = \([''"]\)\(\%(\1\@!.\)\+\)\1', '\2', '')
- endif
- unlet s:lines
- else
- let g:unloaded_tohtml_plugin = "unknown"
- endif
- unlet s:main_plugin_path
- endif
- let s:pluginversion = g:unloaded_tohtml_plugin
-endif
-
-" Split window to create a buffer with the HTML file.
-let s:orgbufnr = winbufnr(0)
-let s:origwin_stl = &l:stl
-if expand("%") == ""
- if exists('g:html_diff_win_num')
- exec 'new Untitled_win'..g:html_diff_win_num..'.'.(s:settings.use_xhtml ? 'xhtml' : 'html')
- else
- exec 'new Untitled.'..(s:settings.use_xhtml ? 'xhtml' : 'html')
- endif
-else
- exec 'new %.'..(s:settings.use_xhtml ? 'xhtml' : 'html')
-endif
-
-" Resize the new window to very small in order to make it draw faster
-let s:old_winheight = winheight(0)
-let s:old_winfixheight = &l:winfixheight
-if s:old_winheight > 2
- resize 1 " leave enough room to view one line at a time
- norm! G
- norm! zt
-endif
-setlocal winfixheight
-
-let s:newwin_stl = &l:stl
-
-" on the new window, set the least time-consuming fold method
-let s:old_fen = &foldenable
-setlocal foldmethod=manual
-setlocal nofoldenable
-
-let s:newwin = winnr()
-let s:orgwin = bufwinnr(s:orgbufnr)
-
-setlocal modifiable
-%d
-let s:old_paste = &paste
-set paste
-let s:old_magic = &magic
-set magic
-
-" set the fileencoding to match the charset we'll be using
-let &l:fileencoding=s:settings.vim_encoding
-
-" According to http://www.w3.org/TR/html4/charset.html#doc-char-set, the byte
-" order mark is highly recommend on the web when using multibyte encodings. But,
-" it is not a good idea to include it on UTF-8 files. Otherwise, let Vim
-" determine when it is actually inserted.
-if s:settings.vim_encoding == 'utf-8'
- setlocal nobomb
-else
- setlocal bomb
-endif
-
-let s:lines = []
-
-if s:settings.use_xhtml
- if s:settings.encoding != ""
- call add(s:lines, "<?xml version=\"1.0\" encoding=\"" .. s:settings.encoding .. "\"?>")
- else
- call add(s:lines, "<?xml version=\"1.0\"?>")
- endif
- let s:tag_close = ' />'
-else
- let s:tag_close = '>'
-endif
-
-let s:HtmlSpace = ' '
-let s:LeadingSpace = ' '
-let s:HtmlEndline = ''
-if s:settings.no_pre
- let s:HtmlEndline = '<br' .. s:tag_close
- let s:LeadingSpace = s:settings.use_xhtml ? '&#160;' : '&nbsp;'
- let s:HtmlSpace = '\' .. s:LeadingSpace
-endif
-
-" HTML header, with the title and generator ;-). Left free space for the CSS,
-" to be filled at the end.
-if !s:settings.no_doc
- call extend(s:lines, [
- \ "<html>",
- \ "<head>"])
- " include encoding as close to the top as possible, but only if not already
- " contained in XML information (to avoid haggling over content type)
- if s:settings.encoding != "" && !s:settings.use_xhtml
- if s:html5
- call add(s:lines, '<meta charset="' .. s:settings.encoding .. '"' .. s:tag_close)
- else
- call add(s:lines, "<meta http-equiv=\"content-type\" content=\"text/html; charset=" .. s:settings.encoding .. '"' .. s:tag_close)
- endif
- endif
- call extend(s:lines, [
- \ ("<title>"..expand("%:p:~").."</title>"),
- \ ("<meta name=\"Generator\" content=\"Vim/"..v:version/100.."."..v:version%100..'"'..s:tag_close),
- \ ("<meta name=\"plugin-version\" content=\""..s:pluginversion..'"'..s:tag_close)
- \ ])
- call add(s:lines, '<meta name="syntax" content="'..s:current_syntax..'"'..s:tag_close)
- call add(s:lines, '<meta name="settings" content="'..
- \ join(filter(keys(s:settings),'s:settings[v:val]'),',')..
- \ ',prevent_copy='..s:settings.prevent_copy..
- \ ',use_input_for_pc='..s:settings.use_input_for_pc..
- \ '"'..s:tag_close)
- call add(s:lines, '<meta name="colorscheme" content="'..
- \ (exists('g:colors_name')
- \ ? g:colors_name
- \ : 'none').. '"'..s:tag_close)
-
- if s:settings.use_css
- call extend(s:lines, [
- \ "<style" .. (s:html5 ? "" : " type=\"text/css\"") .. ">",
- \ s:settings.use_xhtml ? "" : "<!--"])
- let s:ieonly = []
- if s:settings.dynamic_folds
- if s:settings.hover_unfold
- " if we are doing hover_unfold, use css 2 with css 1 fallback for IE6
- call extend(s:lines, [
- \ ".FoldColumn { text-decoration: none; white-space: pre; }",
- \ "",
- \ "body * { margin: 0; padding: 0; }", "",
- \ ".open-fold > span.Folded { display: none; }",
- \ ".open-fold > .fulltext { display: inline; }",
- \ ".closed-fold > .fulltext { display: none; }",
- \ ".closed-fold > span.Folded { display: inline; }",
- \ "",
- \ ".open-fold > .toggle-open { display: none; }",
- \ ".open-fold > .toggle-closed { display: inline; }",
- \ ".closed-fold > .toggle-open { display: inline; }",
- \ ".closed-fold > .toggle-closed { display: none; }",
- \ "", "",
- \ '/* opening a fold while hovering won''t be supported by IE6 and other',
- \ "similar browsers, but it should fail gracefully. */",
- \ ".closed-fold:hover > .fulltext { display: inline; }",
- \ ".closed-fold:hover > .toggle-filler { display: none; }",
- \ ".closed-fold:hover > .Folded { display: none; }"])
- " TODO: IE6 is REALLY old and I can't even test it anymore. Maybe we
- " should remove this? Leave it in for now, it was working at one point,
- " and doesn't affect any modern browsers. Even newer IE versions should
- " support the above code and ignore the following.
- let s:ieonly = [
- \ "<!--[if lt IE 7]><style type=\"text/css\">",
- \ ".open-fold .fulltext { display: inline; }",
- \ ".open-fold span.Folded { display: none; }",
- \ ".open-fold .toggle-open { display: none; }",
- \ ".open-fold .toggle-closed { display: inline; }",
- \ "",
- \ ".closed-fold .fulltext { display: none; }",
- \ ".closed-fold span.Folded { display: inline; }",
- \ ".closed-fold .toggle-open { display: inline; }",
- \ ".closed-fold .toggle-closed { display: none; }",
- \ "</style>",
- \ "<![endif]-->",
- \]
- else
- " if we aren't doing hover_unfold, use CSS 1 only
- call extend(s:lines, [
- \ ".FoldColumn { text-decoration: none; white-space: pre; }",
- \ ".open-fold .fulltext { display: inline; }",
- \ ".open-fold span.Folded { display: none; }",
- \ ".open-fold .toggle-open { display: none; }",
- \ ".open-fold .toggle-closed { display: inline; }",
- \ "",
- \ ".closed-fold .fulltext { display: none; }",
- \ ".closed-fold span.Folded { display: inline; }",
- \ ".closed-fold .toggle-open { display: inline; }",
- \ ".closed-fold .toggle-closed { display: none; }",
- \])
- endif
- endif
- " else we aren't doing any dynamic folding, no need for any special rules
-
- call extend(s:lines, [
- \ s:settings.use_xhtml ? "" : '-->',
- \ "</style>",
- \])
- call extend(s:lines, s:ieonly)
- unlet s:ieonly
- endif
-
- let s:uses_script = s:settings.dynamic_folds || s:settings.line_ids
-
- " insert script tag if needed
- if s:uses_script
- call extend(s:lines, [
- \ "",
- \ "<script" .. (s:html5 ? "" : " type='text/javascript'") .. ">",
- \ s:settings.use_xhtml ? '//<![CDATA[' : "<!--"])
- endif
-
- " insert javascript to toggle folds open and closed
- if s:settings.dynamic_folds
- call extend(s:lines, [
- \ "",
- \ "function toggleFold(objID)",
- \ "{",
- \ " var fold;",
- \ " fold = document.getElementById(objID);",
- \ " if (fold.className == 'closed-fold')",
- \ " {",
- \ " fold.className = 'open-fold';",
- \ " }",
- \ " else if (fold.className == 'open-fold')",
- \ " {",
- \ " fold.className = 'closed-fold';",
- \ " }",
- \ "}"
- \ ])
- endif
-
- if s:settings.line_ids
- " insert javascript to get IDs from line numbers, and to open a fold before
- " jumping to any lines contained therein
- call extend(s:lines, [
- \ "",
- \ "/* function to open any folds containing a jumped-to line before jumping to it */",
- \ "function JumpToLine()",
- \ "{",
- \ " var lineNum;",
- \ " lineNum = window.location.hash;",
- \ " lineNum = lineNum.substr(1); /* strip off '#' */",
- \ "",
- \ " if (lineNum.indexOf('L') == -1) {",
- \ " lineNum = 'L'+lineNum;",
- \ " }",
- \ " var lineElem = document.getElementById(lineNum);"
- \ ])
-
- if s:settings.dynamic_folds
- call extend(s:lines, [
- \ "",
- \ " /* navigate upwards in the DOM tree to open all folds containing the line */",
- \ " var node = lineElem;",
- \ " while (node && node.id != 'vimCodeElement"..s:settings.id_suffix.."')",
- \ " {",
- \ " if (node.className == 'closed-fold')",
- \ " {",
- \ " node.className = 'open-fold';",
- \ " }",
- \ " node = node.parentNode;",
- \ " }",
- \ ])
- endif
- call extend(s:lines, [
- \ " /* Always jump to new location even if the line was hidden inside a fold, or",
- \ " * we corrected the raw number to a line ID.",
- \ " */",
- \ " if (lineElem) {",
- \ " lineElem.scrollIntoView(true);",
- \ " }",
- \ " return true;",
- \ "}",
- \ "if ('onhashchange' in window) {",
- \ " window.onhashchange = JumpToLine;",
- \ "}"
- \ ])
- endif
-
- " insert script closing tag if needed
- if s:uses_script
- call extend(s:lines, [
- \ '',
- \ s:settings.use_xhtml ? '//]]>' : '-->',
- \ "</script>"
- \ ])
- endif
-
- call extend(s:lines, ["</head>",
- \ "<body"..(s:settings.line_ids ? " onload='JumpToLine();'" : "")..">"])
-endif
-
-if s:settings.no_pre
- " if we're not using CSS we use a font tag which can't have a div inside
- if s:settings.use_css
- call extend(s:lines, ["<div id='vimCodeElement" .. s:settings.id_suffix .. "'>"])
- endif
-else
- call extend(s:lines, ["<pre id='vimCodeElement" .. s:settings.id_suffix .. "'>"])
-endif
-
-exe s:orgwin .. "wincmd w"
-
-" caches of style data
-" initialize to include line numbers if using them
-if s:settings.number_lines
- let s:stylelist = { s:LINENR_ID : ".LineNr { " .. s:CSS1( s:LINENR_ID ) .. "}" }
-else
- let s:stylelist = {}
-endif
-let s:diffstylelist = {
- \ s:DIFF_A_ID : ".DiffAdd { " .. s:CSS1( s:DIFF_A_ID ) .. "}",
- \ s:DIFF_C_ID : ".DiffChange { " .. s:CSS1( s:DIFF_C_ID ) .. "}",
- \ s:DIFF_D_ID : ".DiffDelete { " .. s:CSS1( s:DIFF_D_ID ) .. "}",
- \ s:DIFF_T_ID : ".DiffText { " .. s:CSS1( s:DIFF_T_ID ) .. "}"
- \ }
-
-" set up progress bar in the status line
-if !s:settings.no_progress
- " ProgressBar Indicator
- let s:progressbar={}
-
- " Progressbar specific functions
-
- func! s:SetProgbarColor()
- if hlID("TOhtmlProgress") != 0
- hi! link TOhtmlProgress_auto TOhtmlProgress
- elseif hlID("TOhtmlProgress_auto")==0 ||
- \ !exists("s:last_colors_name") || !exists("g:colors_name") ||
- \ g:colors_name != s:last_colors_name
- let s:last_colors_name = exists("g:colors_name") ? g:colors_name : "none"
-
- let l:diffatr = synIDattr(hlID("DiffDelete")->synIDtrans(), "reverse", s:whatterm) ? "fg#" : "bg#"
- let l:stlatr = synIDattr(hlID("StatusLine")->synIDtrans(), "reverse", s:whatterm) ? "fg#" : "bg#"
-
- let l:progbar_color = synIDattr(hlID("DiffDelete")->synIDtrans(), l:diffatr, s:whatterm)
- let l:stl_color = synIDattr(hlID("StatusLine")->synIDtrans(), l:stlatr, s:whatterm)
-
- if "" == l:progbar_color
- let l:progbar_color = synIDattr(hlID("DiffDelete")->synIDtrans(), "reverse", s:whatterm) ? s:fgc : s:bgc
- endif
- if "" == l:stl_color
- let l:stl_color = synIDattr(hlID("StatusLine")->synIDtrans(), "reverse", s:whatterm) ? s:fgc : s:bgc
- endif
-
- if l:progbar_color == l:stl_color
- if s:whatterm == 'cterm'
- if l:progbar_color >= (&t_Co/2)
- let l:progbar_color-=1
- else
- let l:progbar_color+=1
- endif
- else
- let l:rgb = map(matchlist(l:progbar_color, '#\zs\x\x\ze\(\x\x\)\(\x\x\)')[:2], 'str2nr(v:val, 16)')
- let l:avg = (l:rgb[0] + l:rgb[1] + l:rgb[2])/3
- if l:avg >= 128
- let l:avg_new = l:avg
- while l:avg - l:avg_new < 0x15
- let l:rgb = map(l:rgb, 'v:val * 3 / 4')
- let l:avg_new = (l:rgb[0] + l:rgb[1] + l:rgb[2])/3
- endwhile
- else
- let l:avg_new = l:avg
- while l:avg_new - l:avg < 0x15
- let l:rgb = map(l:rgb, 'min([max([v:val, 4]) * 5 / 4, 255])')
- let l:avg_new = (l:rgb[0] + l:rgb[1] + l:rgb[2])/3
- endwhile
- endif
- let l:progbar_color = printf("#%02x%02x%02x", l:rgb[0], l:rgb[1], l:rgb[2])
- endif
- echomsg "diff detected progbar color set to" l:progbar_color
- endif
- exe "hi TOhtmlProgress_auto" s:whatterm.."bg="..l:progbar_color
- endif
- endfun
-
- func! s:ProgressBar(title, max_value, winnr)
- let pgb=copy(s:progressbar)
- let pgb.title = a:title..' '
- let pgb.max_value = a:max_value
- let pgb.winnr = a:winnr
- let pgb.cur_value = 0
-
- let pgb.items = { 'title' : { 'color' : 'Statusline' },
- \'bar' : { 'color' : 'Statusline' , 'fillcolor' : 'TOhtmlProgress_auto' , 'bg' : 'Statusline' } ,
- \'counter' : { 'color' : 'Statusline' } }
- let pgb.last_value = 0
- let pgb.needs_redraw = 0
- " Note that you must use len(split) instead of len() if you want to use
- " unicode in title.
- "
- " Subtract 3 for spacing around the title.
- " Subtract 4 for the percentage display.
- " Subtract 2 for spacing before this.
- " Subtract 2 more for the '|' on either side of the progress bar
- let pgb.subtractedlen=len(split(pgb.title, '\zs'))+3+4+2+2
- let pgb.max_len = 0
- set laststatus=2
- return pgb
- endfun
-
- " Function: progressbar.calculate_ticks() {{{1
- func! s:progressbar.calculate_ticks(pb_len)
- if a:pb_len<=0
- let pb_len = 100
- else
- let pb_len = a:pb_len
- endif
- let self.progress_ticks = map(range(pb_len+1), "v:val * self.max_value / pb_len")
- endfun
-
- "Function: progressbar.paint()
- func! s:progressbar.paint()
- " Recalculate widths.
- let max_len = winwidth(self.winnr)
- let pb_len = 0
- " always true on first call because of initial value of self.max_len
- if max_len != self.max_len
- let self.max_len = max_len
-
- " Progressbar length
- let pb_len = max_len - self.subtractedlen
-
- call self.calculate_ticks(pb_len)
-
- let self.needs_redraw = 1
- let cur_value = 0
- let self.pb_len = pb_len
- else
- " start searching at the last found index to make the search for the
- " appropriate tick value normally take 0 or 1 comparisons
- let cur_value = self.last_value
- let pb_len = self.pb_len
- endif
-
- let cur_val_max = pb_len > 0 ? pb_len : 100
-
- " find the current progress bar position based on precalculated thresholds
- while cur_value < cur_val_max && self.cur_value > self.progress_ticks[cur_value]
- let cur_value += 1
- endwhile
-
- " update progress bar
- if self.last_value != cur_value || self.needs_redraw || self.cur_value == self.max_value
- let self.needs_redraw = 1
- let self.last_value = cur_value
-
- let t_color = self.items.title.color
- let b_fcolor = self.items.bar.fillcolor
- let b_color = self.items.bar.color
- let c_color = self.items.counter.color
-
- let stl = "%#".t_color."#%-( ".self.title." %)".
- \"%#".b_color."#".
- \(pb_len>0 ?
- \ ('|%#'.b_fcolor."#%-(".repeat(" ",cur_value)."%)".
- \ '%#'.b_color."#".repeat(" ",pb_len-cur_value)."|"):
- \ ('')).
- \"%=%#".c_color."#%( ".printf("%3.d ",100*self.cur_value/self.max_value)."%% %)"
- call setwinvar(self.winnr, '&stl', stl)
- endif
- endfun
-
- func! s:progressbar.incr( ... )
- let self.cur_value += (a:0 ? a:1 : 1)
- " if we were making a general-purpose progress bar, we'd need to limit to a
- " lower limit as well, but since we always increment with a positive value
- " in this script, we only need limit the upper value
- let self.cur_value = (self.cur_value > self.max_value ? self.max_value : self.cur_value)
- call self.paint()
- endfun
- " }}}
- if s:settings.dynamic_folds
- " to process folds we make two passes through each line
- let s:pgb = s:ProgressBar("Processing folds:", line('$')*2, s:orgwin)
- endif
-
- call s:SetProgbarColor()
-endif
-
-let s:build_fun_lines = []
-call add(s:build_fun_lines, [])
-let s:build_fun_lines[-1] =<< trim ENDLET
- func! s:Add_diff_fill(lnum)
- let l:filler = diff_filler(a:lnum)
- if l:filler > 0
- let l:to_insert = l:filler
- while l:to_insert > 0
- let l:new = repeat(s:difffillchar, 3)
-
- if l:to_insert > 2 && l:to_insert < l:filler && !s:settings.whole_filler
- let l:new = l:new .. " " .. l:filler .. " inserted lines "
- let l:to_insert = 2
- endif
-ENDLET
-call add(s:build_fun_lines, [])
-if !s:settings.no_pre
- let s:build_fun_lines[-1] =<< trim ENDLET
- " HTML line wrapping is off--go ahead and fill to the margin
- " TODO: what about when CSS wrapping is turned on?
- let l:new = l:new .. repeat(s:difffillchar, &columns - strlen(l:new) - s:margin)
- ENDLET
-else
- let s:build_fun_lines[-1] =<< trim ENDLET
- let l:new = l:new .. repeat(s:difffillchar, 3)
- ENDLET
-endif
-call add(s:build_fun_lines, [])
-let s:build_fun_lines[-1] =<< trim ENDLET
- let l:new = s:HtmlFormat_d(l:new, s:DIFF_D_ID, 0)
-ENDLET
-if s:settings.number_lines
- call add(s:build_fun_lines, [])
- let s:build_fun_lines[-1] =<< trim ENDLET
- " Indent if line numbering is on. Indent gets style of line number
- " column.
- let l:new = s:HtmlFormat_n(repeat(' ', s:margin), s:LINENR_ID, 0, 0) .. l:new
- ENDLET
-endif
-if s:settings.dynamic_folds && !s:settings.no_foldcolumn
- call add(s:build_fun_lines, [])
- let s:build_fun_lines[-1] =<< trim ENDLET
- if s:foldcolumn > 0
- " Indent for foldcolumn if there is one. Assume it's empty, there should
- " not be a fold for deleted lines in diff mode.
- let l:new = s:FoldColumn_fill() .. l:new
- endif
- ENDLET
-endif
-" Ignore this comment, just bypassing a highlighting issue: if
-call add(s:build_fun_lines, [])
-let s:build_fun_lines[-1] =<< trim ENDLET
- call add(s:lines, l:new..s:HtmlEndline)
- let l:to_insert = l:to_insert - 1
- endwhile
- endif
- endfun
-ENDLET
-exec join(flatten(s:build_fun_lines), "\n")
-
-" First do some preprocessing for dynamic folding. Do this for the entire file
-" so we don't accidentally start within a closed fold or something.
-let s:allfolds = []
-
-if s:settings.dynamic_folds
- let s:lnum = 1
- let s:end = line('$')
- " save the fold text and set it to the default so we can find fold levels
- let s:foldtext_save = &foldtext
- setlocal foldtext&
-
- " we will set the foldcolumn in the html to the greater of the maximum fold
- " level and the current foldcolumn setting
- let s:foldcolumn = &foldcolumn
-
- " get all info needed to describe currently closed folds
- while s:lnum <= s:end
- if foldclosed(s:lnum) == s:lnum
- " default fold text has '+-' and then a number of dashes equal to fold
- " level, so subtract 2 from index of first non-dash after the dashes
- " in order to get the fold level of the current fold
- let s:level = match(foldtextresult(s:lnum), '+-*\zs[^-]') - 2
- " store fold info for later use
- let s:newfold = {'firstline': s:lnum, 'lastline': foldclosedend(s:lnum), 'level': s:level,'type': "closed-fold"}
- call add(s:allfolds, s:newfold)
- " open the fold so we can find any contained folds
- execute s:lnum.."foldopen"
- else
- if !s:settings.no_progress
- call s:pgb.incr()
- if s:pgb.needs_redraw
- redrawstatus
- let s:pgb.needs_redraw = 0
- endif
- endif
- let s:lnum = s:lnum + 1
- endif
- endwhile
-
- " close all folds to get info for originally open folds
- silent! %foldclose!
- let s:lnum = 1
-
- " the originally open folds will be all folds we encounter that aren't
- " already in the list of closed folds
- while s:lnum <= s:end
- if foldclosed(s:lnum) == s:lnum
- " default fold text has '+-' and then a number of dashes equal to fold
- " level, so subtract 2 from index of first non-dash after the dashes
- " in order to get the fold level of the current fold
- let s:level = match(foldtextresult(s:lnum), '+-*\zs[^-]') - 2
- let s:newfold = {'firstline': s:lnum, 'lastline': foldclosedend(s:lnum), 'level': s:level,'type': "closed-fold"}
- " only add the fold if we don't already have it
- if empty(s:allfolds) || index(s:allfolds, s:newfold) == -1
- let s:newfold.type = "open-fold"
- call add(s:allfolds, s:newfold)
- endif
- " open the fold so we can find any contained folds
- execute s:lnum.."foldopen"
- else
- if !s:settings.no_progress
- call s:pgb.incr()
- if s:pgb.needs_redraw
- redrawstatus
- let s:pgb.needs_redraw = 0
- endif
- endif
- let s:lnum = s:lnum + 1
- endif
- endwhile
-
- " sort the folds so that we only ever need to look at the first item in the
- " list of folds
- call sort(s:allfolds, "s:FoldCompare")
-
- let &l:foldtext = s:foldtext_save
- unlet s:foldtext_save
-
- " close all folds again so we can get the fold text as we go
- silent! %foldclose!
-
- " Go through and remove folds we don't need to (or cannot) process in the
- " current conversion range
- "
- " If a fold is removed which contains other folds, which are included, we need
- " to adjust the level of the included folds as used by the conversion logic
- " (avoiding special cases is good)
- "
- " Note any time we remove a fold, either all of the included folds are in it,
- " or none of them, because we only remove a fold if neither its start nor its
- " end are within the conversion range.
- let leveladjust = 0
- for afold in s:allfolds
- let removed = 0
- if exists("g:html_start_line") && exists("g:html_end_line")
- if afold.firstline < g:html_start_line
- if afold.lastline <= g:html_end_line && afold.lastline >= g:html_start_line
- " if a fold starts before the range to convert but stops within the
- " range, we need to include it. Make it start on the first converted
- " line.
- let afold.firstline = g:html_start_line
- else
- " if the fold lies outside the range or the start and stop enclose
- " the entire range, don't bother parsing it
- call remove(s:allfolds, index(s:allfolds, afold))
- let removed = 1
- if afold.lastline > g:html_end_line
- let leveladjust += 1
- endif
- endif
- elseif afold.firstline > g:html_end_line
- " If the entire fold lies outside the range we need to remove it.
- call remove(s:allfolds, index(s:allfolds, afold))
- let removed = 1
- endif
- elseif exists("g:html_start_line")
- if afold.firstline < g:html_start_line
- " if there is no last line, but there is a first line, the end of the
- " fold will always lie within the region of interest, so keep it
- let afold.firstline = g:html_start_line
- endif
- elseif exists("g:html_end_line")
- " if there is no first line we default to the first line in the buffer so
- " the fold start will always be included if the fold itself is included.
- " If however the entire fold lies outside the range we need to remove it.
- if afold.firstline > g:html_end_line
- call remove(s:allfolds, index(s:allfolds, afold))
- let removed = 1
- endif
- endif
- if !removed
- let afold.level -= leveladjust
- if afold.level+1 > s:foldcolumn
- let s:foldcolumn = afold.level+1
- endif
- endif
- endfor
-
- " if we've removed folds containing the conversion range from processing,
- " getting foldtext as we go won't know to open the removed folds, so the
- " foldtext would be wrong; open them now.
- "
- " Note that only when a start and an end line is specified will a fold
- " containing the current range ever be removed.
- while leveladjust > 0
- exe g:html_start_line.."foldopen"
- let leveladjust -= 1
- endwhile
-endif
-
-" Now loop over all lines in the original text to convert to html.
-" Use html_start_line and html_end_line if they are set.
-if exists("g:html_start_line")
- let s:lnum = html_start_line
- if s:lnum < 1 || s:lnum > line("$")
- let s:lnum = 1
- endif
-else
- let s:lnum = 1
-endif
-if exists("g:html_end_line")
- let s:end = html_end_line
- if s:end < s:lnum || s:end > line("$")
- let s:end = line("$")
- endif
-else
- let s:end = line("$")
-endif
-
-" stack to keep track of all the folds containing the current line
-let s:foldstack = []
-
-if !s:settings.no_progress
- let s:pgb = s:ProgressBar("Processing lines:", s:end - s:lnum + 1, s:orgwin)
-endif
-
-if s:settings.number_lines
- let s:margin = strlen(s:end) + 1
-else
- let s:margin = 0
-endif
-
-if has('folding') && !s:settings.ignore_folding
- let s:foldfillchar = &fillchars[matchend(&fillchars, 'fold:')]
- if s:foldfillchar == ''
- let s:foldfillchar = '-'
- endif
-endif
-let s:difffillchar = &fillchars[matchend(&fillchars, 'diff:')]
-if s:difffillchar == ''
- let s:difffillchar = '-'
-endif
-
-let s:foldId = 0
-
-if !s:settings.expand_tabs
- " If keeping tabs, add them to printable characters so we keep them when
- " formatting text (strtrans() doesn't replace printable chars)
- let s:old_isprint = &isprint
- setlocal isprint+=9
-endif
-
-while s:lnum <= s:end
-
- " If there are filler lines for diff mode, show these above the line.
- call s:Add_diff_fill(s:lnum)
-
- " Start the line with the line number.
- if s:settings.number_lines
- let s:numcol = repeat(' ', s:margin - 1 - strlen(s:lnum)) .. s:lnum .. ' '
- endif
-
- let s:new = ""
-
- if has('folding') && !s:settings.ignore_folding && foldclosed(s:lnum) > -1 && !s:settings.dynamic_folds
- "
- " This is the beginning of a folded block (with no dynamic folding)
- let s:new = foldtextresult(s:lnum)
- if !s:settings.no_pre
- " HTML line wrapping is off--go ahead and fill to the margin
- let s:new = s:new .. repeat(s:foldfillchar, &columns - strlen(s:new))
- endif
-
- " put numcol in a separate group for sake of unselectable text
- let s:new = (s:settings.number_lines ? s:HtmlFormat_n(s:numcol, s:FOLDED_ID, 0, s:lnum): "") .. s:HtmlFormat_t(s:new, s:FOLDED_ID, 0)
-
- " Skip to the end of the fold
- let s:new_lnum = foldclosedend(s:lnum)
-
- if !s:settings.no_progress
- call s:pgb.incr(s:new_lnum - s:lnum)
- endif
-
- let s:lnum = s:new_lnum
-
- else
- "
- " A line that is not folded, or doing dynamic folding.
- "
- let s:line = getline(s:lnum)
- let s:len = strlen(s:line)
-
- if s:settings.dynamic_folds
- " First insert a closing for any open folds that end on this line
- while !empty(s:foldstack) && get(s:foldstack,0).lastline == s:lnum-1
- let s:new = s:new.."</span></span>"
- call remove(s:foldstack, 0)
- endwhile
-
- " Now insert an opening for any new folds that start on this line
- let s:firstfold = 1
- while !empty(s:allfolds) && get(s:allfolds,0).firstline == s:lnum
- let s:foldId = s:foldId + 1
- let s:new ..= "<span id='"
- let s:new ..= (exists('g:html_diff_win_num') ? "win"..g:html_diff_win_num : "")
- let s:new ..= "fold"..s:foldId..s:settings.id_suffix.."' class='"..s:allfolds[0].type.."'>"
-
-
- " Unless disabled, add a fold column for the opening line of a fold.
- "
- " Note that dynamic folds require using css so we just use css to take
- " care of the leading spaces rather than using &nbsp; in the case of
- " html_no_pre to make it easier
- if !s:settings.no_foldcolumn
- " add fold column that can open the new fold
- if s:allfolds[0].level > 1 && s:firstfold
- let s:new = s:new .. s:FoldColumn_build('|', s:allfolds[0].level - 1, 0, "",
- \ 'toggle-open FoldColumn','javascript:toggleFold("fold'..s:foldstack[0].id..s:settings.id_suffix..'");')
- endif
- " add the filler spaces separately from the '+' char so that it can be
- " shown/hidden separately during a hover unfold
- let s:new = s:new .. s:FoldColumn_build("+", 1, 0, "",
- \ 'toggle-open FoldColumn', 'javascript:toggleFold("fold'..s:foldId..s:settings.id_suffix..'");')
- " If this is not the last fold we're opening on this line, we need
- " to keep the filler spaces hidden if the fold is opened by mouse
- " hover. If it is the last fold to open in the line, we shouldn't hide
- " them, so don't apply the toggle-filler class.
- let s:new = s:new .. s:FoldColumn_build(" ", 1, s:foldcolumn - s:allfolds[0].level - 1, "",
- \ 'toggle-open FoldColumn'.. (get(s:allfolds, 1, {'firstline': 0}).firstline == s:lnum ?" toggle-filler" :""),
- \ 'javascript:toggleFold("fold'..s:foldId..s:settings.id_suffix..'");')
-
- " add fold column that can close the new fold
- " only add extra blank space if we aren't opening another fold on the
- " same line
- if get(s:allfolds, 1, {'firstline': 0}).firstline != s:lnum
- let s:extra_space = s:foldcolumn - s:allfolds[0].level
- else
- let s:extra_space = 0
- endif
- if s:firstfold
- " the first fold in a line has '|' characters from folds opened in
- " previous lines, before the '-' for this fold
- let s:new ..= s:FoldColumn_build('|', s:allfolds[0].level - 1, s:extra_space, '-',
- \ 'toggle-closed FoldColumn', 'javascript:toggleFold("fold'..s:foldId..s:settings.id_suffix..'");')
- else
- " any subsequent folds in the line only add a single '-'
- let s:new = s:new .. s:FoldColumn_build("-", 1, s:extra_space, "",
- \ 'toggle-closed FoldColumn', 'javascript:toggleFold("fold'..s:foldId..s:settings.id_suffix..'");')
- endif
- let s:firstfold = 0
- endif
-
- " Add fold text, moving the span ending to the next line so collapsing
- " of folds works correctly.
- " Put numcol in a separate group for sake of unselectable text.
- let s:new = s:new .. (s:settings.number_lines ? s:HtmlFormat_n(s:numcol, s:FOLDED_ID, 0, 0) : "") .. substitute(s:HtmlFormat_t(foldtextresult(s:lnum), s:FOLDED_ID, 0), '</span>', s:HtmlEndline..'\n\0', '')
- let s:new = s:new .. "<span class='fulltext'>"
-
- " open the fold now that we have the fold text to allow retrieval of
- " fold text for subsequent folds
- execute s:lnum.."foldopen"
- call insert(s:foldstack, remove(s:allfolds,0))
- let s:foldstack[0].id = s:foldId
- endwhile
-
- " Unless disabled, add a fold column for other lines.
- "
- " Note that dynamic folds require using css so we just use css to take
- " care of the leading spaces rather than using &nbsp; in the case of
- " html_no_pre to make it easier
- if !s:settings.no_foldcolumn
- if empty(s:foldstack)
- " add the empty foldcolumn for unfolded lines if there is a fold
- " column at all
- if s:foldcolumn > 0
- let s:new = s:new .. s:FoldColumn_fill()
- endif
- else
- " add the fold column for folds not on the opening line
- if get(s:foldstack, 0).firstline < s:lnum
- let s:new = s:new .. s:FoldColumn_build('|', s:foldstack[0].level, s:foldcolumn - s:foldstack[0].level, "",
- \ 'FoldColumn', 'javascript:toggleFold("fold'..s:foldstack[0].id..s:settings.id_suffix..'");')
- endif
- endif
- endif
- endif
-
- " Now continue with the unfolded line text
- if s:settings.number_lines
- let s:new = s:new .. s:HtmlFormat_n(s:numcol, s:LINENR_ID, 0, s:lnum)
- elseif s:settings.line_ids
- let s:new = s:new .. s:HtmlFormat_n("", s:LINENR_ID, 0, s:lnum)
- endif
-
- " Get the diff attribute, if any.
- let s:diffattr = diff_hlID(s:lnum, 1)
-
- " initialize conceal info to act like not concealed, just in case
- let s:concealinfo = [0, '']
-
- " Loop over each character in the line
- let s:col = 1
-
- " most of the time we won't use the diff_id, initialize to zero
- let s:diff_id = 0
-
- while s:col <= s:len || (s:col == 1 && s:diffattr)
- let s:startcol = s:col " The start column for processing text
- if !s:settings.ignore_conceal && has('conceal')
- let s:concealinfo = synconcealed(s:lnum, s:col)
- endif
- if !s:settings.ignore_conceal && s:concealinfo[0]
- let s:col = s:col + 1
- " Speed loop (it's small - that's the trick)
- " Go along till we find a change in the match sequence number (ending
- " the specific concealed region) or until there are no more concealed
- " characters.
- while s:col <= s:len && s:concealinfo == synconcealed(s:lnum, s:col) | let s:col = s:col + 1 | endwhile
- elseif s:diffattr
- let s:diff_id = diff_hlID(s:lnum, s:col)
- let s:id = synID(s:lnum, s:col, 1)
- let s:col = s:col + 1
- " Speed loop (it's small - that's the trick)
- " Go along till we find a change in hlID
- while s:col <= s:len && s:id == synID(s:lnum, s:col, 1)
- \ && s:diff_id == diff_hlID(s:lnum, s:col) |
- \ let s:col = s:col + 1 |
- \ endwhile
- if s:len < &columns && !s:settings.no_pre
- " Add spaces at the end of the raw text line to extend the changed
- " line to the full width.
- let s:line = s:line .. repeat(' ', &columns - virtcol([s:lnum, s:len]) - s:margin)
- let s:len = &columns
- endif
- else
- let s:id = synID(s:lnum, s:col, 1)
- let s:col = s:col + 1
- " Speed loop (it's small - that's the trick)
- " Go along till we find a change in synID
- while s:col <= s:len && s:id == synID(s:lnum, s:col, 1) | let s:col = s:col + 1 | endwhile
- endif
-
- if s:settings.ignore_conceal || !s:concealinfo[0]
- " Expand tabs if needed
- let s:expandedtab = strpart(s:line, s:startcol - 1, s:col - s:startcol)
- if s:settings.expand_tabs
- let s:offset = 0
- let s:idx = stridx(s:expandedtab, "\t")
- let s:tablist = exists("+vts") ? split(&vts,',') : []
- if empty(s:tablist)
- let s:tablist = [ &ts ]
- endif
- let s:tabidx = 0
- let s:tabwidth = 0
- while s:idx >= 0
- if s:startcol + s:idx == 1
- let s:i = s:tablist[0]
- else
- " Get the character, which could be multiple bytes, which falls
- " immediately before the found tab. Extract it by matching a
- " character just prior to the column where the tab matches.
- " We'll use this to get the byte index of the character
- " immediately preceding the tab, so we can then look up the
- " virtual column that character appears in, to determine how
- " much of the current tabstop has been used up.
- if s:idx == 0
- " if the found tab is the first character in the text being
- " processed, we need to get the character prior to the text,
- " given by startcol.
- let s:prevc = matchstr(s:line, '.\%' .. (s:startcol + s:offset) .. 'c')
- else
- " Otherwise, the byte index of the tab into s:expandedtab is
- " given by s:idx.
- let s:prevc = matchstr(s:expandedtab, '.\%' .. (s:idx + 1) .. 'c')
- endif
- let s:vcol = virtcol([s:lnum, s:startcol + s:idx + s:offset - len(s:prevc)])
-
- " find the tabstop interval to use for the tab we just found. Keep
- " adding tabstops (which could be variable) until we would exceed
- " the virtual screen position of the start of the found tab.
- while s:vcol >= s:tabwidth + s:tablist[s:tabidx]
- let s:tabwidth += s:tablist[s:tabidx]
- if s:tabidx < len(s:tablist)-1
- let s:tabidx = s:tabidx+1
- endif
- endwhile
- let s:i = s:tablist[s:tabidx] - (s:vcol - s:tabwidth)
- endif
- " update offset to keep the index within the line corresponding to
- " actual tab characters instead of replaced spaces; s:idx reflects
- " replaced spaces in s:expandedtab, s:offset cancels out all but
- " the tab character itself.
- let s:offset -= s:i - 1
- let s:expandedtab = substitute(s:expandedtab, '\t', repeat(' ', s:i), '')
- let s:idx = stridx(s:expandedtab, "\t")
- endwhile
- end
-
- " get the highlight group name to use
- let s:id = synIDtrans(s:id)
- else
- " use Conceal highlighting for concealed text
- let s:id = s:CONCEAL_ID
- let s:expandedtab = s:concealinfo[1]
- endif
-
- " Output the text with the same synID, with class set to the highlight ID
- " name, unless it has been concealed completely.
- if strlen(s:expandedtab) > 0
- let s:new = s:new .. s:HtmlFormat(s:expandedtab, s:id, s:diff_id, "", 0)
- endif
- endwhile
- endif
-
- call extend(s:lines, split(s:new..s:HtmlEndline, '\n', 1))
- if !s:settings.no_progress && s:pgb.needs_redraw
- redrawstatus
- let s:pgb.needs_redraw = 0
- endif
- let s:lnum = s:lnum + 1
-
- if !s:settings.no_progress
- call s:pgb.incr()
- endif
-endwhile
-
-" Diff filler is returned based on what needs inserting *before* the given line.
-" So to get diff filler at the end of the buffer, we need to use last line + 1
-call s:Add_diff_fill(s:end+1)
-
-if s:settings.dynamic_folds
- " finish off any open folds
- while !empty(s:foldstack)
- let s:lines[-1]..="</span></span>"
- call remove(s:foldstack, 0)
- endwhile
-
- " add fold column to the style list if not already there
- let s:id = s:FOLD_C_ID
- if !has_key(s:stylelist, s:id)
- let s:stylelist[s:id] = '.FoldColumn { ' .. s:CSS1(s:id) .. '}'
- endif
-endif
-
-if s:settings.no_pre
- if !s:settings.use_css
- " Close off the font tag that encapsulates the whole <body>
- call extend(s:lines, ["</font>"])
- else
- call extend(s:lines, ["</div>"])
- endif
-else
- call extend(s:lines, ["</pre>"])
-endif
-if !s:settings.no_doc
- call extend(s:lines, ["</body>", "</html>"])
-endif
-
-exe s:newwin .. "wincmd w"
-call setline(1, s:lines)
-unlet s:lines
-
-" Mangle modelines so Vim doesn't try to use HTML text as a modeline if editing
-" this file in the future; need to do this after generating all the text in case
-" the modeline text has different highlight groups which all turn out to be
-" stripped from the final output.
-%s!\v(%(^|\s+)%([Vv]i%(m%([<=>]?\d+)?)?|ex)):!\1\&#0058;!ge
-
-" The generated HTML is admittedly ugly and takes a LONG time to fold.
-" Make sure the user doesn't do syntax folding when loading a generated file,
-" using a modeline.
-if !s:settings.no_modeline
- call append(line('$'), "<!-- vim: set foldmethod=manual : -->")
-endif
-
-" Now, when we finally know which, we define the colors and styles
-if s:settings.use_css && !s:settings.no_doc
- 1;/<style\>/+1
-
- " Normal/global attributes
- if s:settings.no_pre
- call append('.', "body { color: " .. s:fgc .. "; background-color: " .. s:bgc .. "; font-family: ".. s:htmlfont .."; }")
- +
- else
- call append('.', "pre { " .. s:whitespace .. "font-family: ".. s:htmlfont .."; color: " .. s:fgc .. "; background-color: " .. s:bgc .. "; }")
- +
- yank
- put
- execute "normal! ^cwbody\e"
- " body should not have the wrap formatting, only the pre section
- if s:whitespace != ''
- exec 's#'..s:whitespace
- endif
- endif
- " fix browser inconsistencies (sometimes within the same browser) of different
- " default font size for different elements
- call append('.', '* { font-size: 1em; }')
- +
- " if we use any input elements for unselectable content, make sure they look
- " like normal text
- if !empty(s:settings.prevent_copy)
- if s:settings.use_input_for_pc !=# "none"
- call append('.', 'input { border: none; margin: 0; padding: 0; font-family: '..s:htmlfont..'; }')
- +
- " ch units for browsers which support them, em units for a somewhat
- " reasonable fallback.
- for w in range(1, 20, 1)
- call append('.', [
- \ "input[size='"..w.."'] { width: "..w.."em; width: "..w.."ch; }"
- \ ])
- +
- endfor
- endif
-
- if s:settings.use_input_for_pc !=# 'all'
- let s:unselectable_styles = []
- if s:settings.prevent_copy =~# 'f'
- call add(s:unselectable_styles, 'FoldColumn')
- endif
- if s:settings.prevent_copy =~# 'n'
- call add(s:unselectable_styles, 'LineNr')
- endif
- if s:settings.prevent_copy =~# 't' && !s:settings.ignore_folding
- call add(s:unselectable_styles, 'Folded')
- endif
- if s:settings.prevent_copy =~# 'd'
- call add(s:unselectable_styles, 'DiffDelete')
- endif
- if s:settings.use_input_for_pc !=# 'none'
- call append('.', [
- \ '/* Note: IE does not support @supports conditionals, but also does not fully support',
- \ ' "content:" with custom content, so we *want* the check to fail */',
- \ '@supports ( content: attr(data-custom-content) ) {'
- \ ])
- +3
- endif
- " The line number column inside the foldtext is styled just like the fold
- " text in Vim, but it should use the prevent_copy settings of line number
- " rather than fold text. Apply the prevent_copy styles to foldtext
- " specifically for line numbers, which always come after the fold column,
- " or at the beginning of the line.
- if s:settings.prevent_copy =~# 'n' && !s:settings.ignore_folding
- call append('.', [
- \ ' .FoldColumn + .Folded, .Folded:first-child { user-select: none; }',
- \ ' .FoldColumn + [data-Folded-content]::before, [data-Folded-content]:first-child::before { content: attr(data-Folded-content); }',
- \ ' .FoldColumn + [data-Folded-content]::before, [data-Folded-content]:first-child::before { padding-bottom: 1px; display: inline-block; /* match the 1-px padding of standard items with background */ }',
- \ ' .FoldColumn + span[data-Folded-content]::before, [data-Folded-content]:first-child::before { cursor: default; }',
- \ ])
- +4
- endif
- for s:style_name in s:unselectable_styles
- call append('.', [
- \ ' .'..s:style_name..' { user-select: none; }',
- \ ' [data-'..s:style_name..'-content]::before { content: attr(data-'..s:style_name..'-content); }',
- \ ' [data-'..s:style_name..'-content]::before { padding-bottom: 1px; display: inline-block; /* match the 1-px padding of standard items with background */ }',
- \ ' span[data-'..s:style_name..'-content]::before { cursor: default; }',
- \ ])
- +4
- endfor
- if s:settings.use_input_for_pc !=# 'none'
- " Note, the extra '}' is to match the "@supports" above
- call append('.', [
- \ ' input { display: none; }',
- \ '}'
- \ ])
- +2
- endif
- unlet s:unselectable_styles
- endif
-
- " Fix mouse cursor shape for the fallback <input> method of uncopyable text
- if s:settings.use_input_for_pc !=# 'none'
- if s:settings.prevent_copy =~# 'f'
- " Make the cursor show active fold columns as active areas, and empty fold
- " columns as not interactive.
- call append('.', ['input.FoldColumn { cursor: pointer; }',
- \ 'input.FoldColumn[value="'..repeat(' ', s:foldcolumn)..'"] { cursor: default; }'
- \ ])
- +2
- if s:settings.use_input_for_pc !=# 'all'
- call append('.', [
- \ 'a[data-FoldColumn-content="'..repeat(' ', s:foldcolumn)..'"] { cursor: default; }'
- \ ])
- +1
- end
- endif
- " make line number column show as non-interactive if not selectable
- if s:settings.prevent_copy =~# 'n'
- call append('.', 'input.LineNr { cursor: default; }')
- +
- endif
- " make fold text and line number column within fold text show as
- " non-interactive if not selectable
- if (s:settings.prevent_copy =~# 'n' || s:settings.prevent_copy =~# 't') && !s:settings.ignore_folding
- call append('.', 'input.Folded { cursor: default; }')
- +
- endif
- " make diff filler show as non-interactive if not selectable
- if s:settings.prevent_copy =~# 'd'
- call append('.', 'input.DiffDelete { cursor: default; }')
- +
- endif
- endif
- endif
-endif
-
-if !s:settings.use_css && !s:settings.no_doc
- " For Netscape 4, set <body> attributes too, though, strictly speaking, it's
- " incorrect.
- execute '%s:<body\([^>]*\):<body bgcolor="' .. s:bgc .. '" text="' .. s:fgc .. '"\1>\r<font face="'.. s:htmlfont ..'"'
-endif
-
-" Gather attributes for all other classes. Do diff first so that normal
-" highlight groups are inserted before it.
-if s:settings.use_css && !s:settings.no_doc
- if s:diff_mode
- call append('.', filter(map(keys(s:diffstylelist), "s:diffstylelist[v:val]"), 'v:val != ""'))
- endif
- if !empty(s:stylelist)
- call append('.', filter(map(keys(s:stylelist), "s:stylelist[v:val]"), 'v:val != ""'))
- endif
-endif
-
-" Add hyperlinks
-if !s:settings.no_links
- %s+\(https\=://\S\{-}\)\(\([.,;:}]\=\(\s\|$\)\)\|[\\"'<>]\|&gt;\|&lt;\|&quot;\)+<a href="\1">\1</a>\2+ge
-endif
-
-" The DTD
-if !s:settings.no_doc
- if s:settings.use_xhtml
- exe "normal! gg$a\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"
- elseif s:html5
- exe "normal! gg0i<!DOCTYPE html>\n"
- else
- exe "normal! gg0i<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n"
- endif
-endif
-
-if s:settings.use_xhtml && !s:settings.no_doc
- exe "normal! gg/<html/e\na xmlns=\"http://www.w3.org/1999/xhtml\"\e"
-endif
-
-" Cleanup
-%s:\s\+$::e
-
-" Restore old settings (new window first)
-"
-" Don't bother restoring foldmethod in case it was syntax because the markup is
-" so weirdly formatted it can take a LONG time.
-let &l:foldenable = s:old_fen
-let &report = s:old_report
-let &title = s:old_title
-let &icon = s:old_icon
-let &paste = s:old_paste
-let &magic = s:old_magic
-let @/ = s:old_search
-let &more = s:old_more
-
-" switch to original window to restore those settings
-exe s:orgwin .. "wincmd w"
-
-if !s:settings.expand_tabs
- let &l:isprint = s:old_isprint
-endif
-let &l:stl = s:origwin_stl
-let &l:et = s:old_et
-let &l:scrollbind = s:old_bind
-
-" and back to the new window again to end there
-exe s:newwin .. "wincmd w"
-
-let &l:stl = s:newwin_stl
-exec 'resize' s:old_winheight
-let &l:winfixheight = s:old_winfixheight
-
-let &ls=s:ls
-let &eventignore=s:ei_sav
-
-" Save a little bit of memory (worth doing?)
-unlet s:htmlfont s:whitespace
-unlet s:old_et s:old_paste s:old_icon s:old_report s:old_title s:old_search
-unlet s:old_magic s:old_more s:old_fen s:old_winheight
-unlet! s:old_isprint
-unlet s:whatterm s:stylelist s:diffstylelist s:lnum s:end s:margin s:fgc s:bgc s:old_winfixheight
-unlet! s:col s:id s:attr s:len s:line s:new s:expandedtab s:concealinfo s:diff_mode
-unlet! s:orgwin s:newwin s:orgbufnr s:idx s:i s:offset s:ls s:ei_sav s:origwin_stl
-unlet! s:newwin_stl s:current_syntax
-if !v:profiling
- delfunc s:HtmlColor
- delfunc s:HtmlFormat
- delfunc s:CSS1
- delfunc s:BuildStyleWrapper
- if !s:settings.use_css
- delfunc s:HtmlOpening
- delfunc s:HtmlClosing
- endif
- if s:settings.dynamic_folds
- delfunc s:FoldCompare
- endif
-
- if !s:settings.no_progress
- delfunc s:ProgressBar
- delfunc s:progressbar.paint
- delfunc s:progressbar.incr
- unlet s:pgb s:progressbar
- endif
-
- delfunc s:Add_diff_fill
-endif
-
-unlet! s:new_lnum s:diffattr s:difffillchar s:foldfillchar s:HtmlSpace s:diffstyle
-unlet! s:LeadingSpace s:HtmlEndline s:firstfold s:numcol s:foldcolumn
-unlet! s:wrapperfunc_lines s:build_fun_lines
-unlet s:foldstack s:allfolds s:foldId s:settings
-
-let &cpo = s:cpo_sav
-unlet! s:cpo_sav
-
-" Make sure any patches will probably use consistent indent
-" vim: ts=8 sw=2 sts=2 noet
diff --git a/runtime/syntax/8th.vim b/runtime/syntax/8th.vim
index 643c9cb095..a88a5a294a 100644
--- a/runtime/syntax/8th.vim
+++ b/runtime/syntax/8th.vim
@@ -1,26 +1,26 @@
" Vim syntax file
" Language: 8th
-" Version: 21.08
-" Last Change: 2021 Sep 20
+" Version: 23.09.01
+" Last Change: 2023 Dec 19
" Maintainer: Ron Aaron <ron@aaron-tech.com>
" URL: https://8th-dev.com/
" Filetypes: *.8th
" NOTE: You should also have the ftplugin/8th.vim file to set 'isk'
-if version < 600
- syntax clear
- finish
-elseif exists("b:current_syntax")
+if exists("b:current_syntax")
finish
endif
let s:cpo_save = &cpo
set cpo&vim
syn clear
-" Synchronization method
+
syn sync ccomment
-syn sync maxlines=100
+syn sync maxlines=200
+
syn case match
+syn iskeyword 33-255
+
syn match eighthColonName "\S\+" contained
syn match eighthColonDef ":\s\+\S\+" contains=eighthColonName
@@ -34,230 +34,257 @@ syn keyword eighthDefine var var,
" Built in words:
com! -nargs=+ Builtin syn keyword eighthBuiltin <args>
-Builtin args #:args b #:b dhm #:dhm exec# #:exec# id2ns #:id2ns id? #:id? idd #:idd key #:key oa #:oa
-Builtin oid #:oid okey #:okey with #:with with! #:with! zip #:zip gen-secret 2fa:gen-secret gen-url 2fa:gen-url
-Builtin validate-code 2fa:validate-code ! G:! #! G:#! ## G:## #> G:#> #if G:#if ' G:' ( G:( (* G:(*
-Builtin (:) G:(:) (code) G:(code) (defer) G:(defer) (dump) G:(dump) (getc) G:(getc) (gets) G:(gets)
+
+Builtin gen-secret 2fa:gen-secret gen-url 2fa:gen-url validate-code 2fa:validate-code cb AWS:cb cli AWS:cli
+Builtin cmd AWS:cmd cp AWS:cp rc AWS:rc call DBUS:call init DBUS:init + DOM:+ - DOM:- attr! DOM:attr!
+Builtin attr@ DOM:attr@ attrs DOM:attrs children DOM:children css-parse DOM:css-parse each DOM:each
+Builtin find DOM:find new DOM:new type DOM:type ! G:! !if G:!if #! G:#! ## G:## #if G:#if ' G:' ( G:(
+Builtin (* G:(* (:) G:(:) (code) G:(code) (defer) G:(defer) (dump) G:(dump) (getc) G:(getc) (gets) G:(gets)
Builtin (interp) G:(interp) (log) G:(log) (needs) G:(needs) (parseln) G:(parseln) (putc) G:(putc) (puts) G:(puts)
-Builtin (putslim) G:(putslim) (stat) G:(stat) (with) G:(with) ) G:) +hook G:+hook +listener G:+listener
-Builtin +ref G:+ref ,# G:,# -- G:-- -----BEGIN G:-----BEGIN -Inf G:-Inf -Inf? G:-Inf? -hook G:-hook
-Builtin -listener G:-listener -ref G:-ref -rot G:-rot . G:. .# G:.# .hook G:.hook .needs G:.needs .r G:.r
-Builtin .s G:.s .s-truncate G:.s-truncate .stats G:.stats .ver G:.ver .with G:.with 0; G:0; 2dip G:2dip
-Builtin 2drop G:2drop 2dup G:2dup 2over G:2over 2swap G:2swap 3drop G:3drop 3rev G:3rev 4drop G:4drop
-Builtin 8thdt? G:8thdt? 8thsku G:8thsku 8thver? G:8thver? 8thvernum? G:8thvernum? : G:: ; G:; ;; G:;;
-Builtin ;;; G:;;; ;with G:;with <# G:<# <#> G:<#> >clip G:>clip >json G:>json >kind G:>kind >n G:>n
-Builtin >r G:>r >s G:>s ?: G:?: @ G:@ BITMAP: G:BITMAP: ENUM: G:ENUM: FLAG: G:FLAG: Inf G:Inf Inf? G:Inf?
-Builtin NaN G:NaN NaN? G:NaN? SED-CHECK G:SED-CHECK SED: G:SED: SED: G:SED: \ G:\ _dup G:_dup _swap G:_swap
-Builtin actor: G:actor: again G:again ahead G:ahead and G:and appname G:appname apropos G:apropos argc G:argc
-Builtin args G:args array? G:array? assert G:assert base G:base bi G:bi bits G:bits break G:break break? G:break?
-Builtin breakif G:breakif build? G:build? buildver? G:buildver? bye G:bye c# G:c# c/does G:c/does case: G:case:
-Builtin catch G:catch chdir G:chdir clip> G:clip> clone G:clone clone-shallow G:clone-shallow cold G:cold
-Builtin compile G:compile compile? G:compile? compiling? G:compiling? conflict G:conflict const G:const
-Builtin container? G:container? counting-allocations G:counting-allocations cr G:cr curlang G:curlang
-Builtin curry G:curry curry: G:curry: decimal G:decimal default: G:default: defer: G:defer: deferred: G:deferred:
-Builtin deg>rad G:deg>rad depth G:depth die G:die dip G:dip drop G:drop dstack G:dstack dump G:dump
-Builtin dup G:dup dup>r G:dup>r dup? G:dup? e# G:e# enum: G:enum: error? G:error? eval G:eval eval! G:eval!
-Builtin eval0 G:eval0 execnull G:execnull expect G:expect extra! G:extra! extra@ G:extra@ false G:false
-Builtin fnv G:fnv fourth G:fourth free G:free func: G:func: getc G:getc getcwd G:getcwd getenv G:getenv
-Builtin gets G:gets handler G:handler header G:header help G:help hex G:hex i: G:i: i; G:i; isa? G:isa?
-Builtin items-used G:items-used jcall G:jcall jclass G:jclass jmethod G:jmethod json! G:json! json-8th> G:json-8th>
-Builtin json-nesting G:json-nesting json-pretty G:json-pretty json-throw G:json-throw json> G:json>
-Builtin json@ G:json@ k32 G:k32 keep G:keep l: G:l: last G:last lib G:lib libbin G:libbin libc G:libc
-Builtin listener@ G:listener@ literal G:literal locals: G:locals: lock G:lock lock-to G:lock-to locked? G:locked?
-Builtin log G:log log-syslog G:log-syslog log-task G:log-task log-time G:log-time log-time-local G:log-time-local
-Builtin long-days G:long-days long-months G:long-months longjmp G:longjmp lookup G:lookup loop G:loop
-Builtin loop- G:loop- map? G:map? mark G:mark mark? G:mark? memfree G:memfree mobile? G:mobile? n# G:n#
-Builtin name>os G:name>os name>sem G:name>sem ndrop G:ndrop needs G:needs new G:new next-arg G:next-arg
-Builtin nip G:nip noop G:noop not G:not nothrow G:nothrow ns G:ns ns: G:ns: ns>ls G:ns>ls ns>s G:ns>s
-Builtin ns? G:ns? null G:null null; G:null; null? G:null? number? G:number? of: G:of: off G:off on G:on
-Builtin onexit G:onexit only G:only op! G:op! or G:or os G:os os-names G:os-names os>long-name G:os>long-name
-Builtin os>name G:os>name over G:over p: G:p: pack G:pack parse G:parse parse-csv G:parse-csv parsech G:parsech
-Builtin parseln G:parseln parsews G:parsews pick G:pick poke G:poke pool-clear G:pool-clear pool-clear-all G:pool-clear-all
+Builtin (stat) G:(stat) (with) G:(with) ) G:) +hook G:+hook +ref G:+ref ,# G:,# -- G:-- -----BEGIN G:-----BEGIN
+Builtin -Inf G:-Inf -Inf? G:-Inf? -hook G:-hook -ref G:-ref -rot G:-rot . G:. .# G:.# .hook G:.hook
+Builtin .needs G:.needs .r G:.r .s G:.s .s-truncate G:.s-truncate .stats G:.stats .ver G:.ver .with G:.with
+Builtin 0; G:0; 2dip G:2dip 2drop G:2drop 2dup G:2dup 2nip G:2nip 2over G:2over 2swap G:2swap 2tuck G:2tuck
+Builtin 3drop G:3drop 3drop G:3drop 3dup G:3dup 3rev G:3rev 4drop G:4drop 8thdt? G:8thdt? 8thsku G:8thsku
+Builtin 8thver? G:8thver? 8thvernum? G:8thvernum? : G:: ; G:; ;; G:;; ;;; G:;;; ;with G:;with >clip G:>clip
+Builtin >json G:>json >kind G:>kind >n G:>n >r G:>r >s G:>s ?: G:?: ?@ G:?@ @ G:@ BITMAP: G:BITMAP:
+Builtin ENUM: G:ENUM: FLAG: G:FLAG: I G:I Inf G:Inf Inf? G:Inf? J G:J K G:K NaN G:NaN NaN? G:NaN? SED-CHECK G:SED-CHECK
+Builtin SED: G:SED: SED: G:SED: X G:X \ G:\ _dup G:_dup _swap G:_swap actor: G:actor: again G:again
+Builtin ahead G:ahead and G:and apropos G:apropos argc G:argc args G:args array? G:array? assert G:assert
+Builtin base G:base base>n G:base>n bi G:bi bits G:bits break G:break break? G:break? breakif G:breakif
+Builtin build? G:build? buildver? G:buildver? bye G:bye c/does G:c/does case: G:case: catch G:catch
+Builtin chdir G:chdir clip> G:clip> clone G:clone clone-shallow G:clone-shallow cold G:cold compile G:compile
+Builtin compile? G:compile? compiling? G:compiling? conflict G:conflict const G:const container? G:container?
+Builtin counting-allocations G:counting-allocations cr G:cr critical: G:critical: critical; G:critical;
+Builtin curlang G:curlang curry G:curry curry: G:curry: decimal G:decimal default: G:default: defer: G:defer:
+Builtin deferred: G:deferred: deg>rad G:deg>rad depth G:depth die G:die dip G:dip drop G:drop dstack G:dstack
+Builtin dump G:dump dup G:dup dup>r G:dup>r dup? G:dup? e# G:e# enum: G:enum: error? G:error? eval G:eval
+Builtin eval! G:eval! eval0 G:eval0 expect G:expect extra! G:extra! extra@ G:extra@ false G:false fnv G:fnv
+Builtin fourth G:fourth free G:free func: G:func: getc G:getc getcwd G:getcwd getenv G:getenv gets G:gets
+Builtin handler G:handler header G:header help G:help hex G:hex i: G:i: i; G:i; isa? G:isa? items-used G:items-used
+Builtin jcall G:jcall jclass G:jclass jmethod G:jmethod json! G:json! json-8th> G:json-8th> json-nesting G:json-nesting
+Builtin json-pretty G:json-pretty json-throw G:json-throw json> G:json> json@ G:json@ k32 G:k32 keep G:keep
+Builtin l: G:l: last G:last lib G:lib libbin G:libbin libc G:libc literal G:literal locals: G:locals:
+Builtin lock G:lock lock-to G:lock-to locked? G:locked? log G:log log-syslog G:log-syslog log-task G:log-task
+Builtin log-time G:log-time log-time-local G:log-time-local long-days G:long-days long-months G:long-months
+Builtin longjmp G:longjmp lookup G:lookup loop G:loop loop- G:loop- map? G:map? mark G:mark mark? G:mark?
+Builtin mobile? G:mobile? n# G:n# name>os G:name>os name>sem G:name>sem ndrop G:ndrop needs G:needs
+Builtin new G:new next-arg G:next-arg nip G:nip noop G:noop not G:not nothrow G:nothrow ns G:ns ns: G:ns:
+Builtin ns>ls G:ns>ls ns>s G:ns>s ns? G:ns? null G:null null; G:null; null? G:null? nullvar G:nullvar
+Builtin number? G:number? of: G:of: off G:off on G:on onexit G:onexit only G:only op! G:op! or G:or
+Builtin os G:os os-names G:os-names os>long-name G:os>long-name os>name G:os>name over G:over p: G:p:
+Builtin pack G:pack parse G:parse parse-csv G:parse-csv parse-date G:parse-date parsech G:parsech parseln G:parseln
+Builtin parsews G:parsews pick G:pick poke G:poke pool-clear G:pool-clear pool-clear-all G:pool-clear-all
Builtin prior G:prior private G:private process-args G:process-args process-args-fancy G:process-args-fancy
Builtin process-args-help G:process-args-help process-args-vars G:process-args-vars prompt G:prompt
-Builtin public G:public putc G:putc puts G:puts putslim G:putslim quote G:quote r! G:r! r> G:r> r@ G:r@
-Builtin rad>deg G:rad>deg rand-jit G:rand-jit rand-jsf G:rand-jsf rand-native G:rand-native rand-normal G:rand-normal
+Builtin public G:public putc G:putc puts G:puts quote G:quote r! G:r! r> G:r> r@ G:r@ rad>deg G:rad>deg
+Builtin rand-jit G:rand-jit rand-jsf G:rand-jsf rand-native G:rand-native rand-normal G:rand-normal
Builtin rand-pcg G:rand-pcg rand-pcg-seed G:rand-pcg-seed rand-range G:rand-range rand-select G:rand-select
Builtin randbuf-pcg G:randbuf-pcg random G:random rdrop G:rdrop recurse G:recurse recurse-stack G:recurse-stack
Builtin ref@ G:ref@ reg! G:reg! reg@ G:reg@ regbin@ G:regbin@ remaining-args G:remaining-args repeat G:repeat
Builtin required? G:required? requires G:requires reset G:reset roll G:roll rop! G:rop! rot G:rot rpick G:rpick
-Builtin rroll G:rroll rstack G:rstack rswap G:rswap rusage G:rusage s>ns G:s>ns same? G:same? scriptdir G:scriptdir
-Builtin scriptfile G:scriptfile sem G:sem sem-post G:sem-post sem-rm G:sem-rm sem-wait G:sem-wait sem-wait? G:sem-wait?
-Builtin sem>name G:sem>name semi-throw G:semi-throw set-wipe G:set-wipe setenv G:setenv setjmp G:setjmp
-Builtin settings! G:settings! settings![] G:settings![] settings@ G:settings@ settings@? G:settings@?
-Builtin settings@[] G:settings@[] sh G:sh sh$ G:sh$ short-days G:short-days short-months G:short-months
-Builtin sleep G:sleep sleep-until G:sleep-until slog G:slog space G:space stack-check G:stack-check
-Builtin stack-size G:stack-size step G:step sthrow G:sthrow string? G:string? struct: G:struct: swap G:swap
-Builtin tab-hook G:tab-hook tell-conflict G:tell-conflict tempdir G:tempdir tempfilename G:tempfilename
-Builtin third G:third throw G:throw thrownull G:thrownull times G:times tlog G:tlog tri G:tri true G:true
-Builtin tuck G:tuck type-check G:type-check typeassert G:typeassert uid G:uid uname G:uname unlock G:unlock
-Builtin unpack G:unpack until G:until until! G:until! while G:while while! G:while! with: G:with: word? G:word?
-Builtin words G:words words-like G:words-like words/ G:words/ xchg G:xchg xor G:xor >auth HTTP:>auth
-Builtin (curry) I:(curry) notimpl I:notimpl sh I:sh trace-word I:trace-word call JSONRPC:call auth-string OAuth:auth-string
-Builtin gen-nonce OAuth:gen-nonce params OAuth:params call SOAP:call ! a:! + a:+ - a:- / a:/ 2each a:2each
-Builtin 2map a:2map 2map+ a:2map+ 2map= a:2map= = a:= @ a:@ @? a:@? _@ a:_@ all a:all any a:any bsearch a:bsearch
-Builtin centroid a:centroid clear a:clear close a:close diff a:diff dot a:dot each a:each each! a:each!
-Builtin each-slice a:each-slice exists? a:exists? filter a:filter generate a:generate group a:group
-Builtin indexof a:indexof insert a:insert intersect a:intersect join a:join len a:len map a:map map+ a:map+
-Builtin map= a:map= mean a:mean mean&variance a:mean&variance merge a:merge new a:new op! a:op! open a:open
-Builtin pop a:pop push a:push qsort a:qsort randeach a:randeach reduce a:reduce reduce+ a:reduce+ remove a:remove
-Builtin rev a:rev shift a:shift shuffle a:shuffle slice a:slice slice+ a:slice+ slide a:slide smear a:smear
-Builtin sort a:sort union a:union x a:x x-each a:x-each xchg a:xchg y a:y zip a:zip 8thdir app:8thdir
-Builtin asset app:asset atrun app:atrun atrun app:atrun atrun app:atrun basedir app:basedir current app:current
-Builtin datadir app:datadir exename app:exename lowmem app:lowmem main app:main name app:name oncrash app:oncrash
+Builtin rreset G:rreset rroll G:rroll rstack G:rstack rswap G:rswap rusage G:rusage s>ns G:s>ns same? G:same?
+Builtin scriptdir G:scriptdir scriptfile G:scriptfile sem G:sem sem-post G:sem-post sem-rm G:sem-rm
+Builtin sem-wait G:sem-wait sem-wait? G:sem-wait? sem>name G:sem>name semi-throw G:semi-throw set-wipe G:set-wipe
+Builtin setenv G:setenv setjmp G:setjmp settings! G:settings! settings![] G:settings![] settings@ G:settings@
+Builtin settings@? G:settings@? settings@[] G:settings@[] sh G:sh sh$ G:sh$ short-days G:short-days
+Builtin short-months G:short-months sleep G:sleep sleep-msec G:sleep-msec sleep-until G:sleep-until
+Builtin slog G:slog space G:space stack-check G:stack-check stack-size G:stack-size step G:step sthrow G:sthrow
+Builtin string? G:string? struct: G:struct: swap G:swap tab-hook G:tab-hook tell-conflict G:tell-conflict
+Builtin tempdir G:tempdir tempfilename G:tempfilename third G:third throw G:throw thrownull G:thrownull
+Builtin times G:times tlog G:tlog tri G:tri true G:true tuck G:tuck type-check G:type-check typeassert G:typeassert
+Builtin uid G:uid uname G:uname unlock G:unlock unpack G:unpack until G:until until! G:until! while G:while
+Builtin while! G:while! with: G:with: word? G:word? words G:words words-like G:words-like words/ G:words/
+Builtin xchg G:xchg xor G:xor >auth HTTP:>auth (curry) I:(curry) notimpl I:notimpl sh I:sh trace-word I:trace-word
+Builtin call JSONRPC:call auth-string OAuth:auth-string gen-nonce OAuth:gen-nonce params OAuth:params
+Builtin call SOAP:call ! a:! + a:+ - a:- / a:/ 2each a:2each 2map a:2map 2map+ a:2map+ 2map= a:2map=
+Builtin <> a:<> = a:= @ a:@ @? a:@? _@ a:_@ all a:all any a:any bsearch a:bsearch centroid a:centroid
+Builtin clear a:clear close a:close cmp a:cmp diff a:diff dot a:dot each a:each each! a:each! each-par a:each-par
+Builtin each-slice a:each-slice exists? a:exists? filter a:filter filter-par a:filter-par generate a:generate
+Builtin group a:group indexof a:indexof insert a:insert intersect a:intersect join a:join len a:len
+Builtin map a:map map+ a:map+ map-par a:map-par map= a:map= maxlen a:maxlen mean a:mean mean&variance a:mean&variance
+Builtin merge a:merge new a:new op! a:op! open a:open pigeon a:pigeon pivot a:pivot pop a:pop push a:push
+Builtin qsort a:qsort randeach a:randeach reduce a:reduce reduce+ a:reduce+ remove a:remove rev a:rev
+Builtin rindexof a:rindexof shift a:shift shuffle a:shuffle slice a:slice slice+ a:slice+ slide a:slide
+Builtin smear a:smear sort a:sort split a:split squash a:squash switch a:switch union a:union uniq a:uniq
+Builtin unzip a:unzip x a:x x-each a:x-each xchg a:xchg y a:y zip a:zip 8thdir app:8thdir asset app:asset
+Builtin atrun app:atrun atrun app:atrun atrun app:atrun basedir app:basedir basename app:basename config-file-name app:config-file-name
+Builtin current app:current datadir app:datadir display-moved app:display-moved exename app:exename
+Builtin localechanged app:localechanged lowmem app:lowmem main app:main name app:name oncrash app:oncrash
Builtin opts! app:opts! opts@ app:opts@ orientation app:orientation orientation! app:orientation! pid app:pid
-Builtin post-main app:post-main pre-main app:pre-main raise app:raise request-perm app:request-perm
+Builtin post-main app:post-main pre-main app:pre-main privdir app:privdir raise app:raise read-config app:read-config
+Builtin read-config-map app:read-config-map read-config-var app:read-config-var request-perm app:request-perm
Builtin restart app:restart resumed app:resumed signal app:signal standalone app:standalone subdir app:subdir
-Builtin suspended app:suspended sysquit app:sysquit terminated app:terminated trap app:trap (here) asm:(here)
-Builtin >n asm:>n avail asm:avail c, asm:c, here! asm:here! n> asm:n> used asm:used w, asm:w, ! b:!
-Builtin + b:+ / b:/ 1+ b:1+ 1- b:1- = b:= >base16 b:>base16 >base32 b:>base32 >base64 b:>base64 >base85 b:>base85
-Builtin >hex b:>hex >mpack b:>mpack @ b:@ append b:append base16> b:base16> base32> b:base32> base64> b:base64>
-Builtin base85> b:base85> bit! b:bit! bit@ b:bit@ clear b:clear compress b:compress conv b:conv each b:each
-Builtin each! b:each! each-slice b:each-slice expand b:expand fill b:fill getb b:getb hex> b:hex> len b:len
-Builtin mem> b:mem> move b:move mpack-compat b:mpack-compat mpack-date b:mpack-date mpack-ignore b:mpack-ignore
-Builtin mpack> b:mpack> n! b:n! n+ b:n+ n@ b:n@ new b:new op b:op pad b:pad rev b:rev search b:search
-Builtin shmem b:shmem slice b:slice splice b:splice ungetb b:ungetb unpad b:unpad writable b:writable
-Builtin xor b:xor +block bc:+block .blocks bc:.blocks add-block bc:add-block block-hash bc:block-hash
-Builtin block@ bc:block@ first-block bc:first-block hash bc:hash last-block bc:last-block load bc:load
-Builtin new bc:new save bc:save set-sql bc:set-sql validate bc:validate validate-block bc:validate-block
-Builtin add bloom:add filter bloom:filter in? bloom:in? accept bt:accept ch! bt:ch! ch@ bt:ch@ connect bt:connect
-Builtin disconnect bt:disconnect init bt:init leconnect bt:leconnect lescan bt:lescan listen bt:listen
-Builtin on? bt:on? read bt:read scan bt:scan service? bt:service? services? bt:services? write bt:write
-Builtin * c:* * c:* + c:+ + c:+ = c:= = c:= >ri c:>ri >ri c:>ri abs c:abs abs c:abs arg c:arg arg c:arg
-Builtin conj c:conj conj c:conj im c:im n> c:n> new c:new new c:new re c:re >redir con:>redir accept con:accept
-Builtin accept-pwd con:accept-pwd ansi? con:ansi? black con:black blue con:blue clreol con:clreol cls con:cls
-Builtin cyan con:cyan down con:down free con:free getxy con:getxy gotoxy con:gotoxy green con:green
-Builtin key con:key key? con:key? left con:left load-history con:load-history magenta con:magenta onBlack con:onBlack
-Builtin onBlue con:onBlue onCyan con:onCyan onGreen con:onGreen onMagenta con:onMagenta onRed con:onRed
-Builtin onWhite con:onWhite onYellow con:onYellow print con:print red con:red redir> con:redir> redir? con:redir?
-Builtin right con:right save-history con:save-history size? con:size? up con:up white con:white yellow con:yellow
-Builtin >aes128gcm cr:>aes128gcm >aes256gcm cr:>aes256gcm >cp cr:>cp >cpe cr:>cpe >decrypt cr:>decrypt
-Builtin >edbox cr:>edbox >encrypt cr:>encrypt >nbuf cr:>nbuf >rsabox cr:>rsabox >uuid cr:>uuid CBC cr:CBC
-Builtin CFB cr:CFB CTR cr:CTR ECB cr:ECB GCM cr:GCM OFB cr:OFB aad? cr:aad? aes128box-sig cr:aes128box-sig
-Builtin aes128gcm> cr:aes128gcm> aes256box-sig cr:aes256box-sig aes256gcm> cr:aes256gcm> aesgcm cr:aesgcm
-Builtin blakehash cr:blakehash chacha20box-sig cr:chacha20box-sig chachapoly cr:chachapoly cipher! cr:cipher!
-Builtin cipher@ cr:cipher@ cp> cr:cp> cpe> cr:cpe> decrypt cr:decrypt decrypt+ cr:decrypt+ decrypt> cr:decrypt>
-Builtin dh-genkey cr:dh-genkey dh-secret cr:dh-secret dh-sign cr:dh-sign dh-verify cr:dh-verify ebox-sig cr:ebox-sig
-Builtin ecc-genkey cr:ecc-genkey ecc-secret cr:ecc-secret ecc-sign cr:ecc-sign ecc-verify cr:ecc-verify
-Builtin edbox-sig cr:edbox-sig edbox> cr:edbox> encrypt cr:encrypt encrypt+ cr:encrypt+ encrypt> cr:encrypt>
-Builtin ensurekey cr:ensurekey gcm-tag-size cr:gcm-tag-size genkey cr:genkey hash cr:hash hash! cr:hash!
-Builtin hash+ cr:hash+ hash>b cr:hash>b hash>s cr:hash>s hash@ cr:hash@ hmac cr:hmac hotp cr:hotp iv? cr:iv?
-Builtin mode cr:mode mode@ cr:mode@ rand cr:rand randbuf cr:randbuf randkey cr:randkey restore cr:restore
+Builtin suspended app:suspended sysquit app:sysquit terminated app:terminated timeout app:timeout trap app:trap
+Builtin dawn astro:dawn do-dawn astro:do-dawn do-dusk astro:do-dusk do-rise astro:do-rise dusk astro:dusk
+Builtin latitude astro:latitude location! astro:location! longitude astro:longitude sunrise astro:sunrise
+Builtin genkeys auth:genkeys secret auth:secret session-id auth:session-id session-key auth:session-key
+Builtin validate auth:validate ! b:! + b:+ / b:/ 1+ b:1+ 1- b:1- <> b:<> = b:= >base16 b:>base16 >base32 b:>base32
+Builtin >base64 b:>base64 >base85 b:>base85 >hex b:>hex >mpack b:>mpack @ b:@ append b:append base16> b:base16>
+Builtin base32> b:base32> base64> b:base64> base85> b:base85> bit! b:bit! bit@ b:bit@ clear b:clear
+Builtin compress b:compress conv b:conv each b:each each! b:each! each-slice b:each-slice expand b:expand
+Builtin fill b:fill getb b:getb hex> b:hex> len b:len mem> b:mem> move b:move mpack-compat b:mpack-compat
+Builtin mpack-date b:mpack-date mpack-ignore b:mpack-ignore mpack> b:mpack> n! b:n! n+ b:n+ n@ b:n@
+Builtin new b:new op b:op op! b:op! pad b:pad rev b:rev search b:search shmem b:shmem slice b:slice
+Builtin splice b:splice ungetb b:ungetb unpad b:unpad writable b:writable xor b:xor +block bc:+block
+Builtin .blocks bc:.blocks add-block bc:add-block block-hash bc:block-hash block@ bc:block@ first-block bc:first-block
+Builtin hash bc:hash last-block bc:last-block load bc:load new bc:new save bc:save set-sql bc:set-sql
+Builtin validate bc:validate validate-block bc:validate-block add bloom:add filter bloom:filter in? bloom:in?
+Builtin parse bson:parse accept bt:accept ch! bt:ch! ch@ bt:ch@ connect bt:connect disconnect bt:disconnect
+Builtin init bt:init leconnect bt:leconnect lescan bt:lescan listen bt:listen on? bt:on? read bt:read
+Builtin scan bt:scan service? bt:service? services? bt:services? write bt:write * c:* * c:* + c:+ + c:+
+Builtin = c:= = c:= >ri c:>ri >ri c:>ri abs c:abs abs c:abs arg c:arg arg c:arg conj c:conj conj c:conj
+Builtin im c:im n> c:n> new c:new new c:new re c:re (.hebrew) cal:(.hebrew) (.islamic) cal:(.islamic)
+Builtin .hebrew cal:.hebrew .islamic cal:.islamic >hebepoch cal:>hebepoch >jdn cal:>jdn Adar cal:Adar
+Builtin Adar2 cal:Adar2 Adar2 cal:Adar2 Av cal:Av Elul cal:Elul Heshvan cal:Heshvan Iyar cal:Iyar Kislev cal:Kislev
+Builtin Nissan cal:Nissan Shevat cal:Shevat Sivan cal:Sivan Tammuz cal:Tammuz Tevet cal:Tevet Tishrei cal:Tishrei
+Builtin days-in-hebrew-year cal:days-in-hebrew-year displaying-hebrew cal:displaying-hebrew fixed>hebrew cal:fixed>hebrew
+Builtin fixed>islamic cal:fixed>islamic gershayim cal:gershayim hanukkah cal:hanukkah hebrew-epoch cal:hebrew-epoch
+Builtin hebrew>fixed cal:hebrew>fixed hebrewtoday cal:hebrewtoday hmonth-name cal:hmonth-name islamic.epoch cal:islamic.epoch
+Builtin islamic>fixed cal:islamic>fixed islamictoday cal:islamictoday jdn> cal:jdn> last-day-of-hebrew-month cal:last-day-of-hebrew-month
+Builtin number>hebrew cal:number>hebrew omer cal:omer pesach cal:pesach purim cal:purim rosh-chodesh? cal:rosh-chodesh?
+Builtin rosh-hashanah cal:rosh-hashanah shavuot cal:shavuot taanit-esther cal:taanit-esther tisha-beav cal:tisha-beav
+Builtin yom-haatsmaut cal:yom-haatsmaut yom-kippur cal:yom-kippur >redir con:>redir accept con:accept
+Builtin accept-nl con:accept-nl accept-pwd con:accept-pwd alert con:alert ansi? con:ansi? black con:black
+Builtin blue con:blue clreol con:clreol cls con:cls ctrld-empty con:ctrld-empty cyan con:cyan down con:down
+Builtin file>history con:file>history free con:free getxy con:getxy gotoxy con:gotoxy green con:green
+Builtin history-handler con:history-handler history>file con:history>file key con:key key? con:key?
+Builtin left con:left load-history con:load-history magenta con:magenta max-history con:max-history
+Builtin onBlack con:onBlack onBlue con:onBlue onCyan con:onCyan onGreen con:onGreen onMagenta con:onMagenta
+Builtin onRed con:onRed onWhite con:onWhite onYellow con:onYellow print con:print red con:red redir> con:redir>
+Builtin redir? con:redir? right con:right save-history con:save-history size? con:size? up con:up white con:white
+Builtin yellow con:yellow >aes128gcm cr:>aes128gcm >aes256gcm cr:>aes256gcm >cp cr:>cp >cpe cr:>cpe
+Builtin >decrypt cr:>decrypt >edbox cr:>edbox >encrypt cr:>encrypt >nbuf cr:>nbuf >rsabox cr:>rsabox
+Builtin >uuid cr:>uuid aad? cr:aad? aes128box-sig cr:aes128box-sig aes128gcm> cr:aes128gcm> aes256box-sig cr:aes256box-sig
+Builtin aes256gcm> cr:aes256gcm> aesgcm cr:aesgcm blakehash cr:blakehash chacha20box-sig cr:chacha20box-sig
+Builtin chachapoly cr:chachapoly cipher! cr:cipher! cipher@ cr:cipher@ ciphers cr:ciphers cp> cr:cp>
+Builtin cpe> cr:cpe> decrypt cr:decrypt decrypt+ cr:decrypt+ decrypt> cr:decrypt> ebox-sig cr:ebox-sig
+Builtin ecc-curves cr:ecc-curves ecc-genkey cr:ecc-genkey ecc-secret cr:ecc-secret ecc-sign cr:ecc-sign
+Builtin ecc-verify cr:ecc-verify ed25519 cr:ed25519 ed25519-secret cr:ed25519-secret ed25519-sign cr:ed25519-sign
+Builtin ed25519-verify cr:ed25519-verify edbox-sig cr:edbox-sig edbox> cr:edbox> encrypt cr:encrypt
+Builtin encrypt+ cr:encrypt+ encrypt> cr:encrypt> ensurekey cr:ensurekey genkey cr:genkey hash cr:hash
+Builtin hash! cr:hash! hash+ cr:hash+ hash>b cr:hash>b hash>s cr:hash>s hash@ cr:hash@ hashes cr:hashes
+Builtin hmac cr:hmac hotp cr:hotp iv? cr:iv? pem-read cr:pem-read pem-write cr:pem-write pwd-valid? cr:pwd-valid?
+Builtin pwd/ cr:pwd/ pwd>hash cr:pwd>hash rand cr:rand randbuf cr:randbuf randkey cr:randkey restore cr:restore
Builtin root-certs cr:root-certs rsa_decrypt cr:rsa_decrypt rsa_encrypt cr:rsa_encrypt rsa_sign cr:rsa_sign
Builtin rsa_verify cr:rsa_verify rsabox-sig cr:rsabox-sig rsabox> cr:rsabox> rsagenkey cr:rsagenkey
Builtin save cr:save sbox-sig cr:sbox-sig sha1-hmac cr:sha1-hmac shard cr:shard tag? cr:tag? totp cr:totp
Builtin totp-epoch cr:totp-epoch totp-time-step cr:totp-time-step unshard cr:unshard uuid cr:uuid uuid> cr:uuid>
-Builtin validate-pgp-sig cr:validate-pgp-sig (.hebrew) d:(.hebrew) (.islamic) d:(.islamic) + d:+ +day d:+day
-Builtin +hour d:+hour +min d:+min +msec d:+msec - d:- .hebrew d:.hebrew .islamic d:.islamic .time d:.time
-Builtin / d:/ = d:= >fixed d:>fixed >hebepoch d:>hebepoch >jdn d:>jdn >msec d:>msec >unix d:>unix >ymd d:>ymd
-Builtin ?= d:?= Adar d:Adar Adar2 d:Adar2 Adar2 d:Adar2 Av d:Av Elul d:Elul Fri d:Fri Heshvan d:Heshvan
-Builtin Iyar d:Iyar Kislev d:Kislev Mon d:Mon Nissan d:Nissan Sat d:Sat Shevat d:Shevat Sivan d:Sivan
-Builtin Sun d:Sun Tammuz d:Tammuz Tevet d:Tevet Thu d:Thu Tishrei d:Tishrei Tue d:Tue Wed d:Wed adjust-dst d:adjust-dst
-Builtin approx! d:approx! approx? d:approx? approximates! d:approximates! between d:between d. d:d.
-Builtin dawn d:dawn days-in-hebrew-year d:days-in-hebrew-year displaying-hebrew d:displaying-hebrew
-Builtin do-dawn d:do-dawn do-dusk d:do-dusk do-rise d:do-rise doy d:doy dst? d:dst? dstquery d:dstquery
-Builtin dstzones? d:dstzones? dusk d:dusk elapsed-timer d:elapsed-timer elapsed-timer-seconds d:elapsed-timer-seconds
-Builtin first-dow d:first-dow fixed> d:fixed> fixed>dow d:fixed>dow fixed>hebrew d:fixed>hebrew fixed>islamic d:fixed>islamic
-Builtin format d:format hanukkah d:hanukkah hebrew-epoch d:hebrew-epoch hebrew>fixed d:hebrew>fixed
-Builtin hebrewtoday d:hebrewtoday hmonth-name d:hmonth-name islamic.epoch d:islamic.epoch islamic>fixed d:islamic>fixed
-Builtin islamictoday d:islamictoday jdn> d:jdn> join d:join last-day-of-hebrew-month d:last-day-of-hebrew-month
-Builtin last-dow d:last-dow last-month d:last-month last-week d:last-week last-year d:last-year latitude d:latitude
-Builtin longitude d:longitude longitude d:longitude msec d:msec msec> d:msec> new d:new next-dow d:next-dow
-Builtin next-month d:next-month next-week d:next-week next-year d:next-year number>hebrew d:number>hebrew
-Builtin omer d:omer parse d:parse parse-approx d:parse-approx parse-range d:parse-range pesach d:pesach
-Builtin prev-dow d:prev-dow purim d:purim rosh-chodesh? d:rosh-chodesh? rosh-hashanah d:rosh-hashanah
-Builtin shavuot d:shavuot start-timer d:start-timer sunrise d:sunrise taanit-esther d:taanit-esther
-Builtin ticks d:ticks ticks/sec d:ticks/sec timer d:timer timer-ctrl d:timer-ctrl tisha-beav d:tisha-beav
-Builtin tzadjust d:tzadjust unix> d:unix> unknown d:unknown unknown? d:unknown? updatetz d:updatetz
-Builtin year@ d:year@ ymd d:ymd ymd> d:ymd> yom-haatsmaut d:yom-haatsmaut yom-kippur d:yom-kippur add-func db:add-func
-Builtin aes! db:aes! begin db:begin bind db:bind bind-exec db:bind-exec bind-exec[] db:bind-exec[]
-Builtin close db:close col db:col col[] db:col[] col{} db:col{} commit db:commit each db:each exec db:exec
-Builtin exec-cb db:exec-cb exec-name db:exec-name get db:get get-sub db:get-sub key db:key kind? db:kind?
-Builtin last-rowid db:last-rowid mysql? db:mysql? odbc? db:odbc? open db:open open? db:open? prep-name db:prep-name
-Builtin prepare db:prepare query db:query query-all db:query-all rekey db:rekey rollback db:rollback
-Builtin set db:set set-sub db:set-sub sql@ db:sql@ bp dbg:bp except-task@ dbg:except-task@ go dbg:go
-Builtin line-info dbg:line-info prompt dbg:prompt stop dbg:stop trace dbg:trace trace-enter dbg:trace-enter
-Builtin trace-leave dbg:trace-leave / f:/ abspath f:abspath absrel f:absrel append f:append associate f:associate
-Builtin atime f:atime canwrite? f:canwrite? chmod f:chmod close f:close copy f:copy copydir f:copydir
+Builtin validate-pgp-sig cr:validate-pgp-sig validate-pwd cr:validate-pwd + d:+ +day d:+day +hour d:+hour
+Builtin +min d:+min +msec d:+msec - d:- .time d:.time / d:/ = d:= >fixed d:>fixed >hmds d:>hmds >hmds: d:>hmds:
+Builtin >msec d:>msec >unix d:>unix >ymd d:>ymd ?= d:?= Fri d:Fri Mon d:Mon Sat d:Sat Sun d:Sun Thu d:Thu
+Builtin Tue d:Tue Wed d:Wed adjust-dst d:adjust-dst alarm d:alarm approx! d:approx! approx? d:approx?
+Builtin approximates! d:approximates! between d:between cmp d:cmp d. d:d. default-now d:default-now
+Builtin doy d:doy dst-ofs d:dst-ofs dst? d:dst? dstinfo d:dstinfo dstquery d:dstquery dstzones? d:dstzones?
+Builtin elapsed-timer d:elapsed-timer elapsed-timer-hmds d:elapsed-timer-hmds elapsed-timer-msec d:elapsed-timer-msec
+Builtin elapsed-timer-seconds d:elapsed-timer-seconds first-dow d:first-dow fixed> d:fixed> fixed>dow d:fixed>dow
+Builtin format d:format join d:join last-dow d:last-dow last-month d:last-month last-week d:last-week
+Builtin last-year d:last-year msec d:msec msec> d:msec> new d:new next-dow d:next-dow next-month d:next-month
+Builtin next-week d:next-week next-year d:next-year parse d:parse parse-approx d:parse-approx parse-range d:parse-range
+Builtin prev-dow d:prev-dow rfc5322 d:rfc5322 start-timer d:start-timer ticks d:ticks ticks/sec d:ticks/sec
+Builtin timer d:timer timer-ctrl d:timer-ctrl tzadjust d:tzadjust unix> d:unix> unknown d:unknown unknown? d:unknown?
+Builtin updatetz d:updatetz year@ d:year@ ymd d:ymd ymd> d:ymd> add-func db:add-func aes! db:aes! again? db:again?
+Builtin begin db:begin bind db:bind bind-exec db:bind-exec bind-exec{} db:bind-exec{} close db:close
+Builtin col db:col col{} db:col{} commit db:commit db db:db dbpush db:dbpush disuse db:disuse each db:each
+Builtin err-handler db:err-handler exec db:exec exec-cb db:exec-cb exec-name db:exec-name exec{} db:exec{}
+Builtin get db:get get-sub db:get-sub key db:key kind? db:kind? last-rowid db:last-rowid mysql? db:mysql?
+Builtin odbc? db:odbc? open db:open open? db:open? prep-name db:prep-name prepare db:prepare query db:query
+Builtin query-all db:query-all rekey db:rekey rollback db:rollback set db:set set-sub db:set-sub sql@ db:sql@
+Builtin sql[] db:sql[] sql[np] db:sql[np] sql{np} db:sql{np} sql{} db:sql{} use db:use zip db:zip bp dbg:bp
+Builtin bt dbg:bt except-task@ dbg:except-task@ go dbg:go line-info dbg:line-info prompt dbg:prompt
+Builtin stop dbg:stop trace dbg:trace trace-enter dbg:trace-enter trace-leave dbg:trace-leave / f:/
+Builtin >posix f:>posix abspath f:abspath absrel f:absrel append f:append associate f:associate atime f:atime
+Builtin autodel f:autodel canwrite? f:canwrite? chmod f:chmod close f:close copy f:copy copydir f:copydir
Builtin create f:create ctime f:ctime dir? f:dir? dname f:dname eachbuf f:eachbuf eachline f:eachline
-Builtin enssep f:enssep eof? f:eof? exists? f:exists? flush f:flush fname f:fname getb f:getb getc f:getc
-Builtin getline f:getline getmod f:getmod glob f:glob glob-nocase f:glob-nocase homedir f:homedir homedir! f:homedir!
-Builtin include f:include ioctl f:ioctl join f:join launch f:launch link f:link link> f:link> link? f:link?
-Builtin mkdir f:mkdir mmap f:mmap mmap-range f:mmap-range mmap-range? f:mmap-range? mtime f:mtime mv f:mv
-Builtin name@ f:name@ open f:open open-ro f:open-ro popen f:popen print f:print read f:read read? f:read?
-Builtin relpath f:relpath rglob f:rglob rm f:rm rmdir f:rmdir seek f:seek sep f:sep size f:size slurp f:slurp
-Builtin sparse? f:sparse? spit f:spit stderr f:stderr stdin f:stdin stdout f:stdout tell f:tell times f:times
-Builtin tmpspit f:tmpspit trash f:trash truncate f:truncate ungetb f:ungetb ungetc f:ungetc unzip f:unzip
-Builtin unzip-entry f:unzip-entry watch f:watch write f:write writen f:writen zip+ f:zip+ zip@ f:zip@
-Builtin zipentry f:zipentry zipnew f:zipnew zipopen f:zipopen zipsave f:zipsave atlas! font:atlas!
-Builtin atlas@ font:atlas@ default-size font:default-size info font:info ls font:ls measure font:measure
-Builtin new font:new oversample font:oversample pixels font:pixels pixels? font:pixels? +edge gr:+edge
-Builtin +edge+w gr:+edge+w +node gr:+node connect gr:connect edges gr:edges edges! gr:edges! m! gr:m!
-Builtin m@ gr:m@ neighbors gr:neighbors new gr:new node-edges gr:node-edges nodes gr:nodes traverse gr:traverse
-Builtin weight! gr:weight! + h:+ clear h:clear cmp! h:cmp! len h:len max! h:max! new h:new peek h:peek
-Builtin pop h:pop push h:push unique h:unique arm? hw:arm? camera hw:camera camera-img hw:camera-img
-Builtin camera-limits hw:camera-limits camera? hw:camera? cpu? hw:cpu? device? hw:device? displays? hw:displays?
-Builtin displaysize? hw:displaysize? finger-match hw:finger-match finger-support hw:finger-support
-Builtin gpio hw:gpio gpio! hw:gpio! gpio-mmap hw:gpio-mmap gpio@ hw:gpio@ i2c hw:i2c i2c! hw:i2c! i2c!reg hw:i2c!reg
-Builtin i2c@ hw:i2c@ i2c@reg hw:i2c@reg isround? hw:isround? iswatch? hw:iswatch? mac? hw:mac? mem? hw:mem?
-Builtin model? hw:model? poll hw:poll sensor hw:sensor start hw:start stop hw:stop uid? hw:uid? fetch-full imap:fetch-full
-Builtin fetch-uid-mail imap:fetch-uid-mail login imap:login logout imap:logout new imap:new search imap:search
-Builtin select-inbox imap:select-inbox >file img:>file >fmt img:>fmt copy img:copy crop img:crop data img:data
-Builtin desat img:desat fill img:fill fillrect img:fillrect filter img:filter flip img:flip from-svg img:from-svg
-Builtin new img:new pix! img:pix! pix@ img:pix@ qr-gen img:qr-gen qr-parse img:qr-parse rotate img:rotate
-Builtin scale img:scale scroll img:scroll size img:size countries iso:countries find loc:find sort loc:sort
-Builtin ! m:! !? m:!? + m:+ +? m:+? - m:- >arr m:>arr @ m:@ @? m:@? _! m:_! _@ m:_@ arr> m:arr> bitmap m:bitmap
-Builtin clear m:clear data m:data each m:each exists? m:exists? filter m:filter iter m:iter iter-all m:iter-all
-Builtin keys m:keys len m:len map m:map merge m:merge new m:new op! m:op! open m:open slice m:slice
-Builtin vals m:vals xchg m:xchg zip m:zip ! mat:! * mat:* + mat:+ = mat:= @ mat:@ affine mat:affine
-Builtin col mat:col data mat:data det mat:det dim? mat:dim? get-n mat:get-n ident mat:ident inv mat:inv
-Builtin m. mat:m. minor mat:minor n* mat:n* new mat:new new-minor mat:new-minor rotate mat:rotate row mat:row
-Builtin same-size? mat:same-size? scale mat:scale shear mat:shear trans mat:trans translate mat:translate
-Builtin xform mat:xform 2console md:2console 2html md:2html 2nk md:2nk bounds meta:bounds color meta:color
-Builtin console meta:console end meta:end ffi meta:ffi ! n:! * n:* */ n:*/ + n:+ +! n:+! - n:- / n:/
-Builtin /mod n:/mod 1+ n:1+ 1- n:1- < n:< = n:= > n:> BIGE n:BIGE BIGPI n:BIGPI E n:E PI n:PI ^ n:^
-Builtin _mod n:_mod abs n:abs acos n:acos acos n:acos asin n:asin asin n:asin atan n:atan atan n:atan
-Builtin atan2 n:atan2 band n:band between n:between bfloat n:bfloat bic n:bic bint n:bint binv n:binv
-Builtin bnot n:bnot bor n:bor bxor n:bxor cast n:cast ceil n:ceil clamp n:clamp cmp n:cmp comb n:comb
-Builtin cos n:cos cosd n:cosd emod n:emod exp n:exp expm1 n:expm1 expmod n:expmod float n:float floor n:floor
-Builtin fmod n:fmod frac n:frac gcd n:gcd int n:int invmod n:invmod kind? n:kind? lcm n:lcm ln n:ln
-Builtin ln1p n:ln1p max n:max median n:median min n:min mod n:mod neg n:neg odd? n:odd? perm n:perm
-Builtin prime? n:prime? quantize n:quantize quantize! n:quantize! r+ n:r+ range n:range rot32l n:rot32l
-Builtin rot32r n:rot32r round n:round round2 n:round2 rounding n:rounding running-variance n:running-variance
-Builtin running-variance-finalize n:running-variance-finalize sgn n:sgn shl n:shl shr n:shr sin n:sin
-Builtin sind n:sind sqr n:sqr sqrt n:sqrt tan n:tan tand n:tand trunc n:trunc ~= n:~= ! net:! !? net:!?
-Builtin - net:- >url net:>url @ net:@ @? net:@? DGRAM net:DGRAM INET4 net:INET4 INET6 net:INET6 PROTO_TCP net:PROTO_TCP
-Builtin PROTO_UDP net:PROTO_UDP STREAM net:STREAM accept net:accept addrinfo>o net:addrinfo>o again? net:again?
-Builtin alloc-and-read net:alloc-and-read alloc-buf net:alloc-buf bind net:bind close net:close closed? net:closed?
-Builtin connect net:connect debug? net:debug? delete net:delete get net:get getaddrinfo net:getaddrinfo
-Builtin getpeername net:getpeername head net:head ifaces? net:ifaces? listen net:listen map>url net:map>url
-Builtin net-socket net:net-socket opts net:opts port-is-ssl? net:port-is-ssl? post net:post proxy! net:proxy!
-Builtin put net:put read net:read read-all net:read-all recvfrom net:recvfrom s>url net:s>url sendto net:sendto
-Builtin server net:server setsockopt net:setsockopt socket net:socket tlshello net:tlshello url> net:url>
-Builtin user-agent net:user-agent wait net:wait write net:write (begin) nk:(begin) (chart-begin) nk:(chart-begin)
-Builtin (chart-begin-colored) nk:(chart-begin-colored) (chart-end) nk:(chart-end) (end) nk:(end) (group-begin) nk:(group-begin)
-Builtin (group-end) nk:(group-end) (property) nk:(property) >img nk:>img addfont nk:addfont anti-alias nk:anti-alias
-Builtin any-clicked? nk:any-clicked? bounds nk:bounds bounds! nk:bounds! button nk:button button-color nk:button-color
-Builtin button-label nk:button-label button-set-behavior nk:button-set-behavior button-symbol nk:button-symbol
-Builtin button-symbol-label nk:button-symbol-label chart-add-slot nk:chart-add-slot chart-add-slot-colored nk:chart-add-slot-colored
-Builtin chart-push nk:chart-push chart-push-slot nk:chart-push-slot checkbox nk:checkbox clicked? nk:clicked?
-Builtin close-this! nk:close-this! close-this? nk:close-this? close? nk:close? color-picker nk:color-picker
-Builtin combo nk:combo combo-begin-color nk:combo-begin-color combo-begin-label nk:combo-begin-label
+Builtin enssep f:enssep eof? f:eof? exec f:exec exists? f:exists? flush f:flush fname f:fname getb f:getb
+Builtin getc f:getc getline f:getline getmod f:getmod glob f:glob glob-links f:glob-links glob-nocase f:glob-nocase
+Builtin gunz f:gunz homedir f:homedir homedir! f:homedir! include f:include ioctl f:ioctl join f:join
+Builtin launch f:launch link f:link link> f:link> link? f:link? lock f:lock mkdir f:mkdir mmap f:mmap
+Builtin mmap-range f:mmap-range mmap-range? f:mmap-range? mtime f:mtime mv f:mv name@ f:name@ open f:open
+Builtin open! f:open! open-ro f:open-ro popen f:popen popen3 f:popen3 print f:print read f:read read-buf f:read-buf
+Builtin read? f:read? relpath f:relpath rglob f:rglob rm f:rm rmdir f:rmdir seek f:seek sep f:sep size f:size
+Builtin slurp f:slurp sparse? f:sparse? spit f:spit stderr f:stderr stdin f:stdin stdout f:stdout tell f:tell
+Builtin tempfile f:tempfile times f:times tmpspit f:tmpspit trash f:trash truncate f:truncate ungetb f:ungetb
+Builtin ungetc f:ungetc unzip f:unzip unzip-entry f:unzip-entry watch f:watch write f:write writen f:writen
+Builtin zip+ f:zip+ zip@ f:zip@ zipentry f:zipentry zipnew f:zipnew zipopen f:zipopen zipsave f:zipsave
+Builtin atlas! font:atlas! atlas@ font:atlas@ default-size font:default-size default-size@ font:default-size@
+Builtin info font:info ls font:ls measure font:measure new font:new oversample font:oversample pixels font:pixels
+Builtin pixels? font:pixels? system font:system system font:system distance geo:distance km/deg-lat geo:km/deg-lat
+Builtin km/deg-lon geo:km/deg-lon nearest geo:nearest +edge gr:+edge +edge+w gr:+edge+w +node gr:+node
+Builtin connect gr:connect edges gr:edges edges! gr:edges! m! gr:m! m@ gr:m@ neighbors gr:neighbors
+Builtin new gr:new node-edges gr:node-edges nodes gr:nodes traverse gr:traverse weight! gr:weight!
+Builtin + h:+ clear h:clear cmp! h:cmp! len h:len max! h:max! new h:new peek h:peek pop h:pop push h:push
+Builtin unique h:unique parse html:parse arm? hw:arm? camera hw:camera camera-img hw:camera-img camera-limits hw:camera-limits
+Builtin camera? hw:camera? cpu? hw:cpu? device? hw:device? displays? hw:displays? displaysize? hw:displaysize?
+Builtin finger-match hw:finger-match finger-support hw:finger-support gpio hw:gpio gpio! hw:gpio! gpio-mmap hw:gpio-mmap
+Builtin gpio@ hw:gpio@ i2c hw:i2c i2c! hw:i2c! i2c!reg hw:i2c!reg i2c@ hw:i2c@ i2c@reg hw:i2c@reg isround? hw:isround?
+Builtin iswatch? hw:iswatch? mac? hw:mac? mem? hw:mem? model? hw:model? poll hw:poll sensor hw:sensor
+Builtin start hw:start stop hw:stop uid? hw:uid? fetch-full imap:fetch-full fetch-uid-mail imap:fetch-uid-mail
+Builtin login imap:login logout imap:logout new imap:new search imap:search select-inbox imap:select-inbox
+Builtin >file img:>file >fmt img:>fmt copy img:copy crop img:crop data img:data desat img:desat draw img:draw
+Builtin draw-sub img:draw-sub fill img:fill fillrect img:fillrect filter img:filter flip img:flip from-svg img:from-svg
+Builtin line img:line new img:new pikchr img:pikchr pix! img:pix! pix@ img:pix@ qr-gen img:qr-gen qr-parse img:qr-parse
+Builtin rect img:rect rotate img:rotate scale img:scale scroll img:scroll size img:size countries iso:countries
+Builtin languages iso:languages utils/help library:utils/help find loc:find sort loc:sort ! m:! !? m:!?
+Builtin + m:+ +? m:+? - m:- <> m:<> = m:= >arr m:>arr @ m:@ @? m:@? _! m:_! _@ m:_@ alias m:alias arr> m:arr>
+Builtin bitmap m:bitmap clear m:clear data m:data each m:each exists? m:exists? filter m:filter ic m:ic
+Builtin iter m:iter iter-all m:iter-all keys m:keys len m:len map m:map merge m:merge new m:new op! m:op!
+Builtin open m:open slice m:slice vals m:vals xchg m:xchg zip m:zip ! mat:! * mat:* + mat:+ = mat:=
+Builtin @ mat:@ affine mat:affine col mat:col data mat:data det mat:det dim? mat:dim? get-n mat:get-n
+Builtin ident mat:ident inv mat:inv m. mat:m. minor mat:minor n* mat:n* new mat:new new-minor mat:new-minor
+Builtin rotate mat:rotate row mat:row same-size? mat:same-size? scale mat:scale shear mat:shear trans mat:trans
+Builtin translate mat:translate xform mat:xform 2console md:2console 2html md:2html 2nk md:2nk color meta:color
+Builtin console meta:console gui meta:gui meta meta:meta ! n:! * n:* */ n:*/ + n:+ +! n:+! - n:- / n:/
+Builtin /mod n:/mod 1+ n:1+ 1- n:1- < n:< = n:= > n:> >bool n:>bool BIGE n:BIGE BIGPI n:BIGPI E n:E
+Builtin PI n:PI ^ n:^ _mod n:_mod abs n:abs acos n:acos acos n:acos andor n:andor asin n:asin asin n:asin
+Builtin atan n:atan atan n:atan atan2 n:atan2 band n:band between n:between bfloat n:bfloat bic n:bic
+Builtin bint n:bint binv n:binv bnot n:bnot bor n:bor bxor n:bxor cast n:cast ceil n:ceil clamp n:clamp
+Builtin cmp n:cmp comb n:comb cos n:cos cosd n:cosd emod n:emod exp n:exp expm1 n:expm1 expmod n:expmod
+Builtin float n:float floor n:floor fmod n:fmod frac n:frac gcd n:gcd int n:int invmod n:invmod kind? n:kind?
+Builtin lcm n:lcm lerp n:lerp ln n:ln ln1p n:ln1p lnerp n:lnerp max n:max median n:median min n:min
+Builtin mod n:mod neg n:neg odd? n:odd? perm n:perm prime? n:prime? quantize n:quantize quantize! n:quantize!
+Builtin r+ n:r+ range n:range rot32l n:rot32l rot32r n:rot32r round n:round round2 n:round2 rounding n:rounding
+Builtin running-variance n:running-variance running-variance-finalize n:running-variance-finalize sgn n:sgn
+Builtin shl n:shl shr n:shr sin n:sin sind n:sind sqr n:sqr sqrt n:sqrt tan n:tan tand n:tand trunc n:trunc
+Builtin ~= n:~= ! net:! !? net:!? - net:- >base64url net:>base64url >url net:>url @ net:@ @? net:@?
+Builtin CGI net:CGI DGRAM net:DGRAM INET4 net:INET4 INET6 net:INET6 PROTO_TCP net:PROTO_TCP PROTO_UDP net:PROTO_UDP
+Builtin REMOTE_IP net:REMOTE_IP STREAM net:STREAM accept net:accept active? net:active? addrinfo>o net:addrinfo>o
+Builtin again? net:again? alloc-and-read net:alloc-and-read alloc-buf net:alloc-buf base64url> net:base64url>
+Builtin bind net:bind cgi-get net:cgi-get cgi-http-header net:cgi-http-header cgi-init net:cgi-init
+Builtin cgi-init-stunnel net:cgi-init-stunnel cgi-out net:cgi-out close net:close closed? net:closed?
+Builtin connect net:connect curnet net:curnet debug? net:debug? delete net:delete get net:get getaddrinfo net:getaddrinfo
+Builtin getpeername net:getpeername head net:head ifaces? net:ifaces? ipv6? net:ipv6? listen net:listen
+Builtin map>url net:map>url mime-type net:mime-type net-socket net:net-socket opts net:opts port-is-ssl? net:port-is-ssl?
+Builtin post net:post proxy! net:proxy! put net:put read net:read read-all net:read-all read-buf net:read-buf
+Builtin recvfrom net:recvfrom s>url net:s>url sendto net:sendto server net:server setsockopt net:setsockopt
+Builtin socket net:socket tcp-connect net:tcp-connect tlserr net:tlserr tlshello net:tlshello udp-connect net:udp-connect
+Builtin url> net:url> user-agent net:user-agent vpncheck net:vpncheck wait net:wait webserver net:webserver
+Builtin write net:write (begin) nk:(begin) (chart-begin) nk:(chart-begin) (chart-begin-colored) nk:(chart-begin-colored)
+Builtin (chart-end) nk:(chart-end) (end) nk:(end) (group-begin) nk:(group-begin) (group-end) nk:(group-end)
+Builtin (property) nk:(property) >img nk:>img addfont nk:addfont anti-alias nk:anti-alias any-clicked? nk:any-clicked?
+Builtin bounds nk:bounds bounds! nk:bounds! button nk:button button-color nk:button-color button-label nk:button-label
+Builtin button-set-behavior nk:button-set-behavior button-symbol nk:button-symbol button-symbol-label nk:button-symbol-label
+Builtin center-rect nk:center-rect chart-add-slot nk:chart-add-slot chart-add-slot-colored nk:chart-add-slot-colored
+Builtin chart-push nk:chart-push chart-push-slot nk:chart-push-slot checkbox nk:checkbox circle nk:circle
+Builtin clicked? nk:clicked? close-this! nk:close-this! close-this? nk:close-this? close? nk:close?
+Builtin color-picker nk:color-picker combo nk:combo combo-begin-color nk:combo-begin-color combo-begin-label nk:combo-begin-label
Builtin combo-cb nk:combo-cb combo-end nk:combo-end contextual-begin nk:contextual-begin contextual-close nk:contextual-close
Builtin contextual-end nk:contextual-end contextual-item-image-text nk:contextual-item-image-text contextual-item-symbol-text nk:contextual-item-symbol-text
-Builtin contextual-item-text nk:contextual-item-text cp! nk:cp! cp@ nk:cp@ display-info nk:display-info
-Builtin display@ nk:display@ do nk:do down? nk:down? draw-image nk:draw-image draw-image-at nk:draw-image-at
-Builtin draw-image-centered nk:draw-image-centered draw-sub-image nk:draw-sub-image draw-text nk:draw-text
-Builtin draw-text-high nk:draw-text-high draw-text-wrap nk:draw-text-wrap edit-focus nk:edit-focus
+Builtin contextual-item-text nk:contextual-item-text cp! nk:cp! cp@ nk:cp@ curpos nk:curpos cursor-load nk:cursor-load
+Builtin cursor-set nk:cursor-set cursor-show nk:cursor-show display-info nk:display-info display@ nk:display@
+Builtin do nk:do down? nk:down? draw-image nk:draw-image draw-image-at nk:draw-image-at draw-image-centered nk:draw-image-centered
+Builtin draw-sub-image nk:draw-sub-image draw-text nk:draw-text draw-text-centered nk:draw-text-centered
+Builtin draw-text-high nk:draw-text-high draw-text-wrap nk:draw-text-wrap drivers nk:drivers edit-focus nk:edit-focus
Builtin edit-string nk:edit-string event nk:event event-boost nk:event-boost event-msec nk:event-msec
-Builtin event-wait nk:event-wait fill-arc nk:fill-arc fill-circle nk:fill-circle fill-poly nk:fill-poly
-Builtin fill-rect nk:fill-rect fill-rect-color nk:fill-rect-color fill-triangle nk:fill-triangle flags! nk:flags!
-Builtin flags@ nk:flags@ fullscreen nk:fullscreen get nk:get get-row-height nk:get-row-height getfont nk:getfont
-Builtin getmap nk:getmap gl? nk:gl? grid nk:grid grid-push nk:grid-push group-scroll-ofs nk:group-scroll-ofs
-Builtin group-scroll-ofs! nk:group-scroll-ofs! hovered? nk:hovered? image nk:image init nk:init input-button nk:input-button
-Builtin input-key nk:input-key input-motion nk:input-motion input-scroll nk:input-scroll input-string nk:input-string
-Builtin key-down? nk:key-down? key-pressed? nk:key-pressed? key-released? nk:key-released? label nk:label
-Builtin label-colored nk:label-colored label-wrap nk:label-wrap label-wrap-colored nk:label-wrap-colored
+Builtin event-wait nk:event-wait event? nk:event? fill-arc nk:fill-arc fill-circle nk:fill-circle fill-color nk:fill-color
+Builtin fill-poly nk:fill-poly fill-rect nk:fill-rect fill-rect-color nk:fill-rect-color fill-triangle nk:fill-triangle
+Builtin finger nk:finger flags! nk:flags! flags@ nk:flags@ flash nk:flash fullscreen nk:fullscreen
+Builtin gesture nk:gesture get nk:get get-row-height nk:get-row-height getfont nk:getfont getmap nk:getmap
+Builtin getmap! nk:getmap! gl? nk:gl? grid nk:grid grid-push nk:grid-push group-scroll-ofs nk:group-scroll-ofs
+Builtin group-scroll-ofs! nk:group-scroll-ofs! hovered? nk:hovered? hrule nk:hrule image nk:image init nk:init
+Builtin input-button nk:input-button input-key nk:input-key input-motion nk:input-motion input-scroll nk:input-scroll
+Builtin input-string nk:input-string key-down? nk:key-down? key-pressed? nk:key-pressed? key-released? nk:key-released?
+Builtin label nk:label label-colored nk:label-colored label-wrap nk:label-wrap label-wrap-colored nk:label-wrap-colored
Builtin layout-bounds nk:layout-bounds layout-grid-begin nk:layout-grid-begin layout-grid-end nk:layout-grid-end
Builtin layout-push-dynamic nk:layout-push-dynamic layout-push-static nk:layout-push-static layout-push-variable nk:layout-push-variable
Builtin layout-ratio-from-pixel nk:layout-ratio-from-pixel layout-reset-row-height nk:layout-reset-row-height
@@ -266,79 +293,94 @@ Builtin layout-row-end nk:layout-row-end layout-row-height nk:layout-row-height
Builtin layout-row-static nk:layout-row-static layout-row-template-begin nk:layout-row-template-begin
Builtin layout-row-template-end nk:layout-row-template-end layout-space-begin nk:layout-space-begin
Builtin layout-space-end nk:layout-space-end layout-space-push nk:layout-space-push layout-widget-bounds nk:layout-widget-bounds
-Builtin list-begin nk:list-begin list-end nk:list-end list-new nk:list-new list-range nk:list-range
-Builtin m! nk:m! m@ nk:m@ make-style nk:make-style max-vertex-element nk:max-vertex-element measure nk:measure
-Builtin measure-font nk:measure-font menu-begin nk:menu-begin menu-close nk:menu-close menu-end nk:menu-end
-Builtin menu-item-image nk:menu-item-image menu-item-label nk:menu-item-label menu-item-symbol nk:menu-item-symbol
-Builtin menubar-begin nk:menubar-begin menubar-end nk:menubar-end mouse-pos nk:mouse-pos msgdlg nk:msgdlg
-Builtin option nk:option plot nk:plot plot-fn nk:plot-fn pop-font nk:pop-font popup-begin nk:popup-begin
-Builtin popup-close nk:popup-close popup-end nk:popup-end popup-scroll-ofs nk:popup-scroll-ofs popup-scroll-ofs! nk:popup-scroll-ofs!
-Builtin progress nk:progress prop-int nk:prop-int pt>local nk:pt>local pt>screen nk:pt>screen pts>rect nk:pts>rect
-Builtin push-font nk:push-font rect-center nk:rect-center rect-intersect nk:rect-intersect rect-ofs nk:rect-ofs
-Builtin rect-pad nk:rect-pad rect-shrink nk:rect-shrink rect-union nk:rect-union rect/high nk:rect/high
-Builtin rect/wide nk:rect/wide rect>center nk:rect>center rect>local nk:rect>local rect>pos nk:rect>pos
-Builtin rect>pts nk:rect>pts rect>screen nk:rect>screen rect>size nk:rect>size released? nk:released?
-Builtin render nk:render restore nk:restore rotate nk:rotate save nk:save scale nk:scale scancode? nk:scancode?
-Builtin screen-saver nk:screen-saver screen-size nk:screen-size screen-win-close nk:screen-win-close
-Builtin selectable nk:selectable set nk:set set-font nk:set-font set-num-vertices nk:set-num-vertices
-Builtin setpos nk:setpos setwin nk:setwin slider nk:slider slider-int nk:slider-int space nk:space
-Builtin spacing nk:spacing stroke-arc nk:stroke-arc stroke-circle nk:stroke-circle stroke-curve nk:stroke-curve
-Builtin stroke-line nk:stroke-line stroke-polygon nk:stroke-polygon stroke-polyline nk:stroke-polyline
-Builtin stroke-rect nk:stroke-rect stroke-tri nk:stroke-tri style-from-table nk:style-from-table sw-gl nk:sw-gl
-Builtin text? nk:text? tooltip nk:tooltip translate nk:translate tree-pop nk:tree-pop tree-state-push nk:tree-state-push
-Builtin use-style nk:use-style vsync nk:vsync widget nk:widget widget-bounds nk:widget-bounds widget-fitting nk:widget-fitting
-Builtin widget-high nk:widget-high widget-hovered? nk:widget-hovered? widget-mouse-click-down? nk:widget-mouse-click-down?
-Builtin widget-mouse-clicked? nk:widget-mouse-clicked? widget-pos nk:widget-pos widget-size nk:widget-size
-Builtin widget-wide nk:widget-wide win nk:win win-bounds nk:win-bounds win-bounds! nk:win-bounds! win-close nk:win-close
-Builtin win-closed? nk:win-closed? win-collapse nk:win-collapse win-collapsed? nk:win-collapsed? win-content-bounds nk:win-content-bounds
+Builtin line-rel nk:line-rel line-to nk:line-to list-begin nk:list-begin list-end nk:list-end list-new nk:list-new
+Builtin list-range nk:list-range m! nk:m! m@ nk:m@ make-style nk:make-style max-vertex-element nk:max-vertex-element
+Builtin maximize nk:maximize measure nk:measure measure-font nk:measure-font menu-begin nk:menu-begin
+Builtin menu-close nk:menu-close menu-end nk:menu-end menu-item-image nk:menu-item-image menu-item-label nk:menu-item-label
+Builtin menu-item-symbol nk:menu-item-symbol menubar-begin nk:menubar-begin menubar-end nk:menubar-end
+Builtin minimize nk:minimize mouse-pos nk:mouse-pos move-back nk:move-back move-rel nk:move-rel move-to nk:move-to
+Builtin msg nk:msg msgdlg nk:msgdlg ontop nk:ontop option nk:option pen-color nk:pen-color pen-width nk:pen-width
+Builtin plot nk:plot plot-fn nk:plot-fn pop-font nk:pop-font popup-begin nk:popup-begin popup-close nk:popup-close
+Builtin popup-end nk:popup-end popup-scroll-ofs nk:popup-scroll-ofs popup-scroll-ofs! nk:popup-scroll-ofs!
+Builtin progress nk:progress prop-int nk:prop-int pt-in? nk:pt-in? pt-open nk:pt-open pt>local nk:pt>local
+Builtin pt>rect nk:pt>rect pt>screen nk:pt>screen pt>x nk:pt>x pts>rect nk:pts>rect push-font nk:push-font
+Builtin raise nk:raise rect! nk:rect! rect-center nk:rect-center rect-intersect nk:rect-intersect rect-ofs nk:rect-ofs
+Builtin rect-open nk:rect-open rect-pad nk:rect-pad rect-rel nk:rect-rel rect-shrink nk:rect-shrink
+Builtin rect-to nk:rect-to rect-union nk:rect-union rect/high nk:rect/high rect/wide nk:rect/wide rect= nk:rect=
+Builtin rect>local nk:rect>local rect>pos nk:rect>pos rect>pts nk:rect>pts rect>pts4 nk:rect>pts4 rect>screen nk:rect>screen
+Builtin rect>size nk:rect>size rect>x nk:rect>x rect@ nk:rect@ released? nk:released? render nk:render
+Builtin render-timed nk:render-timed restore nk:restore rotate nk:rotate rotate-rel nk:rotate-rel save nk:save
+Builtin scale nk:scale scancode? nk:scancode? screen-saver nk:screen-saver screen-size nk:screen-size
+Builtin screen-win-close nk:screen-win-close selectable nk:selectable set nk:set set-font nk:set-font
+Builtin set-num-vertices nk:set-num-vertices set-radius nk:set-radius setpos nk:setpos setwin nk:setwin
+Builtin show nk:show slider nk:slider slider-int nk:slider-int space nk:space spacing nk:spacing stroke-arc nk:stroke-arc
+Builtin stroke-circle nk:stroke-circle stroke-curve nk:stroke-curve stroke-line nk:stroke-line stroke-polygon nk:stroke-polygon
+Builtin stroke-polyline nk:stroke-polyline stroke-rect nk:stroke-rect stroke-tri nk:stroke-tri style-from-table nk:style-from-table
+Builtin swipe nk:swipe swipe-dir-threshold nk:swipe-dir-threshold swipe-threshold nk:swipe-threshold
+Builtin text nk:text text-align nk:text-align text-font nk:text-font text-pad nk:text-pad text? nk:text?
+Builtin timer-delay nk:timer-delay timer? nk:timer? tooltip nk:tooltip translate nk:translate tree-pop nk:tree-pop
+Builtin tree-state-push nk:tree-state-push use-style nk:use-style vsync nk:vsync widget nk:widget widget-bounds nk:widget-bounds
+Builtin widget-disable nk:widget-disable widget-fitting nk:widget-fitting widget-high nk:widget-high
+Builtin widget-hovered? nk:widget-hovered? widget-mouse-click-down? nk:widget-mouse-click-down? widget-mouse-clicked? nk:widget-mouse-clicked?
+Builtin widget-pos nk:widget-pos widget-size nk:widget-size widget-size nk:widget-size widget-wide nk:widget-wide
+Builtin win nk:win win-bounds nk:win-bounds win-bounds! nk:win-bounds! win-close nk:win-close win-closed? nk:win-closed?
+Builtin win-collapse nk:win-collapse win-collapsed? nk:win-collapsed? win-content-bounds nk:win-content-bounds
Builtin win-focus nk:win-focus win-focused? nk:win-focused? win-hidden? nk:win-hidden? win-high nk:win-high
Builtin win-hovered? nk:win-hovered? win-pos nk:win-pos win-scroll-ofs nk:win-scroll-ofs win-scroll-ofs! nk:win-scroll-ofs!
-Builtin win-show nk:win-show win-size nk:win-size win-wide nk:win-wide win? nk:win? MAX ns:MAX ! o:!
-Builtin + o:+ +? o:+? ??? o:??? @ o:@ class o:class exec o:exec isa o:isa method o:method mutate o:mutate
-Builtin new o:new super o:super devname os:devname env os:env lang os:lang mem-arenas os:mem-arenas
-Builtin notify os:notify region os:region cast ptr:cast len ptr:len null? ptr:null? pack ptr:pack unpack ptr:unpack
-Builtin unpack_orig ptr:unpack_orig publish pubsub:publish qsize pubsub:qsize subscribe pubsub:subscribe
-Builtin + q:+ clear q:clear len q:len new q:new notify q:notify overwrite q:overwrite peek q:peek pick q:pick
-Builtin pop q:pop push q:push remove q:remove shift q:shift size q:size slide q:slide throwing q:throwing
-Builtin wait q:wait ++match r:++match +/ r:+/ +match r:+match / r:/ @ r:@ len r:len match r:match new r:new
-Builtin rx r:rx str r:str * rat:* + rat:+ - rat:- / rat:/ >n rat:>n >s rat:>s new rat:new proper rat:proper
-Builtin ! s:! * s:* + s:+ - s:- / s:/ /scripts s:/scripts <+ s:<+ = s:= =ic s:=ic >base64 s:>base64
-Builtin >ucs2 s:>ucs2 @ s:@ append s:append base64> s:base64> clear s:clear cmp s:cmp cmpi s:cmpi compress s:compress
-Builtin days! s:days! dist s:dist each s:each each! s:each! eachline s:eachline escape s:escape expand s:expand
-Builtin fill s:fill fmt s:fmt fold s:fold gershayim s:gershayim globmatch s:globmatch hexupr s:hexupr
-Builtin insert s:insert intl s:intl intl! s:intl! lang s:lang lc s:lc lc? s:lc? len s:len lsub s:lsub
-Builtin ltrim s:ltrim map s:map months! s:months! new s:new norm s:norm reduce s:reduce repinsert s:repinsert
-Builtin replace s:replace replace! s:replace! rev s:rev rsearch s:rsearch rsub s:rsub rtrim s:rtrim
-Builtin script? s:script? search s:search size s:size slice s:slice soundex s:soundex strfmap s:strfmap
-Builtin strfmt s:strfmt text-wrap s:text-wrap trim s:trim tsub s:tsub uc s:uc uc? s:uc? ucs2> s:ucs2>
-Builtin utf8? s:utf8? zt s:zt close sio:close enum sio:enum open sio:open opts! sio:opts! opts@ sio:opts@
-Builtin read sio:read write sio:write @ slv:@ auto slv:auto build slv:build constraint slv:constraint
+Builtin win-show nk:win-show win-size nk:win-size win-wide nk:win-wide win? nk:win? x>pt nk:x>pt x>rect nk:x>rect
+Builtin MAX ns:MAX ! o:! + o:+ +? o:+? ??? o:??? @ o:@ class o:class exec o:exec isa o:isa method o:method
+Builtin mutate o:mutate new o:new super o:super chroot os:chroot devname os:devname docker? os:docker?
+Builtin env os:env lang os:lang locales os:locales notify os:notify power-state os:power-state region os:region
+Builtin waitpid os:waitpid bezier pdf:bezier bezierq pdf:bezierq circle pdf:circle color pdf:color
+Builtin ellipse pdf:ellipse font pdf:font img pdf:img line pdf:line new pdf:new page pdf:page page-size pdf:page-size
+Builtin rect pdf:rect save pdf:save size pdf:size text pdf:text text-rotate pdf:text-rotate text-size pdf:text-size
+Builtin text-width pdf:text-width text-wrap pdf:text-wrap text-wrap-rotate pdf:text-wrap-rotate cast ptr:cast
+Builtin len ptr:len null? ptr:null? pack ptr:pack unpack ptr:unpack unpack_orig ptr:unpack_orig publish pubsub:publish
+Builtin qsize pubsub:qsize subscribe pubsub:subscribe + q:+ clear q:clear len q:len new q:new notify q:notify
+Builtin overwrite q:overwrite peek q:peek pick q:pick pop q:pop push q:push remove q:remove shift q:shift
+Builtin size q:size slide q:slide throwing q:throwing wait q:wait ++match r:++match +/ r:+/ +match r:+match
+Builtin / r:/ @ r:@ len r:len match r:match new r:new rx r:rx str r:str * rat:* + rat:+ - rat:- / rat:/
+Builtin >n rat:>n >s rat:>s new rat:new proper rat:proper ! s:! * s:* + s:+ - s:- / s:/ /scripts s:/scripts
+Builtin <+ s:<+ <> s:<> = s:= =ic s:=ic >base64 s:>base64 >ucs2 s:>ucs2 @ s:@ append s:append base64> s:base64>
+Builtin clear s:clear cmp s:cmp cmpi s:cmpi compress s:compress count-match s:count-match days! s:days!
+Builtin dist s:dist each s:each each! s:each! eachline s:eachline escape s:escape expand s:expand fill s:fill
+Builtin fold s:fold globmatch s:globmatch hexupr s:hexupr insert s:insert intl s:intl intl! s:intl!
+Builtin lang s:lang lc s:lc lc? s:lc? len s:len lsub s:lsub ltrim s:ltrim map s:map months! s:months!
+Builtin n> s:n> new s:new norm s:norm reduce s:reduce repinsert s:repinsert replace s:replace replace! s:replace!
+Builtin rev s:rev rsearch s:rsearch rsub s:rsub rtrim s:rtrim scan-match s:scan-match script? s:script?
+Builtin search s:search size s:size slice s:slice soundex s:soundex strfmap s:strfmap strfmt s:strfmt
+Builtin term s:term text-wrap s:text-wrap tr s:tr translate s:translate trim s:trim tsub s:tsub uc s:uc
+Builtin uc? s:uc? ucs2> s:ucs2> utf8? s:utf8? zt s:zt close sio:close enum sio:enum open sio:open opts! sio:opts!
+Builtin opts@ sio:opts@ read sio:read write sio:write @ slv:@ auto slv:auto build slv:build constraint slv:constraint
Builtin dump slv:dump edit slv:edit named-variable slv:named-variable new slv:new relation slv:relation
Builtin reset slv:reset suggest slv:suggest term slv:term update slv:update v[] slv:v[] variable slv:variable
Builtin v{} slv:v{} new smtp:new send smtp:send apply-filter snd:apply-filter devices? snd:devices?
-Builtin end-record snd:end-record filter snd:filter formats? snd:formats? freq snd:freq gain snd:gain
-Builtin gain? snd:gain? init snd:init len snd:len loop snd:loop loop? snd:loop? mix snd:mix new snd:new
-Builtin pause snd:pause play snd:play played snd:played rate snd:rate ready? snd:ready? record snd:record
-Builtin resume snd:resume seek snd:seek stop snd:stop stopall snd:stopall volume snd:volume volume? snd:volume?
-Builtin + st:+ . st:. clear st:clear len st:len ndrop st:ndrop new st:new op! st:op! peek st:peek pick st:pick
-Builtin pop st:pop push st:push roll st:roll shift st:shift size st:size slide st:slide swap st:swap
-Builtin throwing st:throwing >buf struct:>buf arr> struct:arr> buf struct:buf buf> struct:buf> byte struct:byte
-Builtin double struct:double field! struct:field! field@ struct:field@ float struct:float ignore struct:ignore
-Builtin int struct:int long struct:long struct; struct:struct; word struct:word ! t:! @ t:@ by-name t:by-name
-Builtin cor t:cor cor-drop t:cor-drop curtask t:curtask def-queue t:def-queue def-stack t:def-stack
-Builtin done? t:done? err! t:err! err? t:err? errno? t:errno? getq t:getq handler t:handler handler@ t:handler@
+Builtin end-record snd:end-record filter snd:filter freq snd:freq gain snd:gain gain? snd:gain? init snd:init
+Builtin len snd:len loop snd:loop loop? snd:loop? mix snd:mix new snd:new pause snd:pause play snd:play
+Builtin played snd:played rate snd:rate ready? snd:ready? record snd:record resume snd:resume seek snd:seek
+Builtin stop snd:stop stopall snd:stopall volume snd:volume volume? snd:volume? + st:+ . st:. clear st:clear
+Builtin len st:len ndrop st:ndrop new st:new op! st:op! peek st:peek pick st:pick pop st:pop push st:push
+Builtin roll st:roll shift st:shift size st:size slide st:slide swap st:swap throwing st:throwing >buf struct:>buf
+Builtin arr> struct:arr> buf struct:buf buf> struct:buf> byte struct:byte double struct:double field! struct:field!
+Builtin field@ struct:field@ float struct:float ignore struct:ignore int struct:int long struct:long
+Builtin struct; struct:struct; word struct:word ! t:! @ t:@ by-name t:by-name cor t:cor cor-drop t:cor-drop
+Builtin curtask t:curtask def-queue t:def-queue def-stack t:def-stack done? t:done? dtor t:dtor err! t:err!
+Builtin err? t:err? errno? t:errno? extra t:extra getq t:getq handler t:handler handler@ t:handler@
Builtin kill t:kill list t:list main t:main max-exceptions t:max-exceptions name! t:name! name@ t:name@
-Builtin notify t:notify parent t:parent pop t:pop priority t:priority push t:push q-notify t:q-notify
+Builtin notify t:notify parent t:parent pop t:pop priority t:priority push t:push push! t:push! q-notify t:q-notify
Builtin q-wait t:q-wait qlen t:qlen result t:result set-affinity t:set-affinity setq t:setq start t:start
-Builtin task t:task task-n t:task-n task-stop t:task-stop wait t:wait yield t:yield yield! t:yield!
+Builtin task t:task task-n t:task-n task-stop t:task-stop ticks t:ticks wait t:wait yield t:yield yield! t:yield!
Builtin add tree:add binary tree:binary bk tree:bk btree tree:btree cmp! tree:cmp! data tree:data del tree:del
Builtin find tree:find iter tree:iter next tree:next nodes tree:nodes parent tree:parent parse tree:parse
Builtin prev tree:prev root tree:root search tree:search trie tree:trie ! w:! (is) w:(is) @ w:@ alias: w:alias:
Builtin cb w:cb deprecate w:deprecate dlcall w:dlcall dlopen w:dlopen dlsym w:dlsym exec w:exec exec? w:exec?
-Builtin ffifail w:ffifail find w:find forget w:forget is w:is name w:name undo w:undo >s xml:>s >txt xml:>txt
-Builtin md-init xml:md-init md-parse xml:md-parse parse xml:parse parse-html xml:parse-html parse-stream xml:parse-stream
+Builtin ffifail w:ffifail find w:find forget w:forget is w:is name w:name undo w:undo close ws:close
+Builtin decode ws:decode encode ws:encode encode-nomask ws:encode-nomask gen-accept-header ws:gen-accept-header
+Builtin gen-accept-key ws:gen-accept-key opcodes ws:opcodes open ws:open >s xml:>s >txt xml:>txt md-init xml:md-init
+Builtin md-parse xml:md-parse parse xml:parse parse-html xml:parse-html parse-stream xml:parse-stream
Builtin getmsg[] zmq:getmsg[] sendmsg[] zmq:sendmsg[]
+
" numbers
syn keyword eighthMath decimal hex base@ base!
syn match eighthInteger '\<-\=[0-9.]*[0-9.]\+\>'
@@ -349,6 +391,11 @@ syn match eighthInteger '\<\x*\d\x*\>' " *2* --- this order!
syn match eighthInteger '\<%[0-1]*[0-1]\+\>'
syn match eighthInteger "\<'.\>"
+syn include @SQL syntax/sql.vim
+syn region eightSQL matchgroup=Define start=/\<SQL\[\s/ end=/\<]\>/ contains=@SQL keepend
+syn region eightSQL matchgroup=Define start=/\<SQL{\s/ end=/\<}\>/ contains=@SQL keepend
+syn region eightSQL matchgroup=Define start=/\<SQL!\s/ end=/\<!\>/ contains=@SQL keepend
+
" Strings
syn region eighthString start=+\.\?\"+ skip=+"+ end=+$+
syn keyword jsonNull null
@@ -356,49 +403,57 @@ syn keyword jsonBool /\(true\|false\)/
syn region eighthString start=/\<"/ end=/"\>/
syn match jsonObjEntry /"\"[^"]\+\"\ze\s*:/
-" Include files
-syn region eighthComment start="\zs\\" end="$" contains=eighthTodo
+syn region eighthNeeds start=+needs\[+ end=+]+ matchgroup=eighthNeeds2 transparent
+syn match eighthNeeds2 /\<needs\[/
+syn match eighthNeeds2 /]\>/
-" Define the default highlighting.
-if !exists("did_eighth_syntax_inits")
- let did_eighth_syntax_inits=1
+syn match eighthBuiltin /m:\[]!/
+syn match eighthBuiltin /v:\[]/
+syn match eighthBuiltin /db:bind-exec\[]/
+syn match eighthBuiltin /db:exec\[]/
+syn match eighthBuiltin /db:col\[]/
- " The default methods for highlighting. Can be overridden later.
- hi def link eighthTodo Todo
- hi def link eighthOperators Operator
- hi def link eighthMath Number
- hi def link eighthInteger Number
- hi def link eighthStack Special
- hi def link eighthFStack Special
- hi def link eighthSP Special
- hi def link eighthColonDef Define
- hi def link eighthColonName Operator
- hi def link eighthEndOfColonDef Define
- hi def link eighthDefine Define
- hi def link eighthDebug Debug
- hi def link eighthCharOps Character
- hi def link eighthConversion String
- hi def link eighthForth Statement
- hi def link eighthVocs Statement
- hi def link eighthString String
- hi def link eighthComment Comment
- hi def link eighthClassDef Define
- hi def link eighthEndOfClassDef Define
- hi def link eighthObjectDef Define
- hi def link eighthEndOfObjectDef Define
- hi def link eighthInclude Include
- hi def link eighthBuiltin Define
- hi def link eighthClasses Define
- hi def link eighthClassWord Keyword
- hi def link jsonObject Delimiter
- hi def link jsonObjEntry Label
- hi def link jsonArray Special
- hi def link jsonNull Function
- hi def link jsonBool Boolean
-endif
+" TODO
+syn region eighthComment start="\zs\\" end="$" contains=eighthTodo
+
+" The default methods for highlighting. Can be overriden later.
+hi def link eighthTodo Todo
+hi def link eighthNeeds2 Include
+hi def link eighthNeeds Error
+hi def link eighthOperators Operator
+hi def link eighthMath Number
+hi def link eighthInteger Number
+hi def link eighthStack Special
+hi def link eighthFStack Special
+hi def link eighthFname Operator
+hi def link eighthSP Special
+hi def link eighthColonDef Define
+hi def link eighthColonName Operator
+hi def link eighthEndOfColonDef Define
+hi def link eighthDefine Define
+hi def link eighthDebug Debug
+hi def link eighthCharOps Character
+hi def link eighthConversion String
+hi def link eighthForth Statement
+hi def link eighthVocs Statement
+hi def link eighthString String
+hi def link eighthComment Comment
+hi def link eighthClassDef Define
+hi def link eighthEndOfClassDef Define
+hi def link eighthObjectDef Define
+hi def link eighthEndOfObjectDef Define
+hi def link eighthInclude Include
+hi def link eighthBuiltin Define
+hi def link eighthClasses Define
+hi def link eighthClassWord Keyword
+hi def link jsonObject Delimiter
+hi def link jsonObjEntry Label
+hi def link jsonArray Special
+hi def link jsonNull Function
+hi def link jsonBool Boolean
let b:current_syntax = "8th"
let &cpo = s:cpo_save
unlet s:cpo_save
-" vim: ft=vim:ts=8:sw=4:nocindent:smartindent:
+" vim: ft=vim ts=4 sw=4 nocin:si
diff --git a/runtime/syntax/amiga.vim b/runtime/syntax/amiga.vim
index 5a664c4f60..9402196482 100644
--- a/runtime/syntax/amiga.vim
+++ b/runtime/syntax/amiga.vim
@@ -1,9 +1,10 @@
" Vim syntax file
" Language: AmigaDos
-" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Charles E. Campbell
" Last Change: Aug 31, 2016
" Version: 10
-" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_AMIGA
+" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_AMIGA
" quit when a syntax file was already loaded
if exists("b:current_syntax")
diff --git a/runtime/syntax/ant.vim b/runtime/syntax/ant.vim
index 6696f96eb1..b0231236dd 100644
--- a/runtime/syntax/ant.vim
+++ b/runtime/syntax/ant.vim
@@ -1,9 +1,9 @@
" Vim syntax file
-" Language: ANT build file (xml)
-" Maintainer: Johannes Zellner <johannes@zellner.org>
-" Last Change: Tue Apr 27 13:05:59 CEST 2004
-" Filenames: build.xml
-" $Id: ant.vim,v 1.1 2004/06/13 18:13:18 vimboss Exp $
+" Language: ANT build file (xml)
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer: Johannes Zellner <johannes@zellner.org>
+" Last Change: 2024 Jan 27
+" Filenames: build.xml
" Quit when a syntax file was already loaded
if exists("b:current_syntax")
@@ -44,48 +44,48 @@ call AntSyntaxScript('jpython', 'python.vim')
syn cluster xmlTagHook add=antElement
-syn keyword antElement display WsdlToDotnet addfiles and ant antcall antstructure apply archives arg argument
-syn keyword antElement display assertions attrib attribute available basename bcc blgenclient bootclasspath
-syn keyword antElement display borland bottom buildnumber buildpath buildpathelement bunzip2 bzip2 cab
-syn keyword antElement display catalogpath cc cccheckin cccheckout cclock ccmcheckin ccmcheckintask ccmcheckout
-syn keyword antElement display ccmcreatetask ccmkattr ccmkbl ccmkdir ccmkelem ccmklabel ccmklbtype
-syn keyword antElement display ccmreconfigure ccrmtype ccuncheckout ccunlock ccupdate checksum chgrp chmod
-syn keyword antElement display chown classconstants classes classfileset classpath commandline comment
-syn keyword antElement display compilerarg compilerclasspath concat concatfilter condition copy copydir
-syn keyword antElement display copyfile coveragepath csc custom cvs cvschangelog cvspass cvstagdiff cvsversion
-syn keyword antElement display daemons date defaultexcludes define delete deletecharacters deltree depend
-syn keyword antElement display depends dependset depth description different dirname dirset disable dname
-syn keyword antElement display doclet doctitle dtd ear echo echoproperties ejbjar element enable entity entry
-syn keyword antElement display env equals escapeunicode exclude excludepackage excludesfile exec execon
-syn keyword antElement display existing expandproperties extdirs extension extensionSet extensionset factory
-syn keyword antElement display fail filelist filename filepath fileset filesmatch filetokenizer filter
-syn keyword antElement display filterchain filterreader filters filterset filtersfile fixcrlf footer format
-syn keyword antElement display from ftp generic genkey get gjdoc grant group gunzip gzip header headfilter http
-syn keyword antElement display ignoreblank ilasm ildasm import importtypelib include includesfile input iplanet
-syn keyword antElement display iplanet-ejbc isfalse isreference isset istrue jar jarlib-available
-syn keyword antElement display jarlib-manifest jarlib-resolve java javac javacc javadoc javadoc2 jboss jdepend
-syn keyword antElement display jjdoc jjtree jlink jonas jpcoverage jpcovmerge jpcovreport jsharpc jspc
-syn keyword antElement display junitreport jvmarg lib libfileset linetokenizer link loadfile loadproperties
-syn keyword antElement display location macrodef mail majority manifest map mapper marker mergefiles message
-syn keyword antElement display metainf method mimemail mkdir mmetrics modified move mparse none not options or
-syn keyword antElement display os outputproperty package packageset parallel param patch path pathconvert
-syn keyword antElement display pathelement patternset permissions prefixlines present presetdef project
-syn keyword antElement display property propertyfile propertyref propertyset pvcs pvcsproject record reference
-syn keyword antElement display regexp rename renameext replace replacefilter replaceregex replaceregexp
-syn keyword antElement display replacestring replacetoken replacetokens replacevalue replyto report resource
-syn keyword antElement display revoke rmic root rootfileset rpm scp section selector sequential serverdeploy
-syn keyword antElement display setproxy signjar size sleep socket soscheckin soscheckout sosget soslabel source
-syn keyword antElement display sourcepath sql src srcfile srcfilelist srcfiles srcfileset sshexec stcheckin
-syn keyword antElement display stcheckout stlabel stlist stringtokenizer stripjavacomments striplinebreaks
-syn keyword antElement display striplinecomments style subant substitution support symlink sync sysproperty
-syn keyword antElement display syspropertyset tabstospaces tag taglet tailfilter tar tarfileset target
-syn keyword antElement display targetfile targetfilelist targetfileset taskdef tempfile test testlet text title
-syn keyword antElement display to token tokenfilter touch transaction translate triggers trim tstamp type
-syn keyword antElement display typedef unjar untar unwar unzip uptodate url user vbc vssadd vsscheckin
-syn keyword antElement display vsscheckout vsscp vsscreate vssget vsshistory vsslabel waitfor war wasclasspath
-syn keyword antElement display webapp webinf weblogic weblogictoplink websphere whichresource wlclasspath
-syn keyword antElement display wljspc wsdltodotnet xmlcatalog xmlproperty xmlvalidate xslt zip zipfileset
-syn keyword antElement display zipgroupfileset
+syn keyword antElement WsdlToDotnet addfiles and ant antcall antstructure apply archives arg argument
+syn keyword antElement assertions attrib attribute available basename bcc blgenclient bootclasspath
+syn keyword antElement borland bottom buildnumber buildpath buildpathelement bunzip2 bzip2 cab
+syn keyword antElement catalogpath cc cccheckin cccheckout cclock ccmcheckin ccmcheckintask ccmcheckout
+syn keyword antElement ccmcreatetask ccmkattr ccmkbl ccmkdir ccmkelem ccmklabel ccmklbtype
+syn keyword antElement ccmreconfigure ccrmtype ccuncheckout ccunlock ccupdate checksum chgrp chmod
+syn keyword antElement chown classconstants classes classfileset classpath commandline comment
+syn keyword antElement compilerarg compilerclasspath concat concatfilter condition copy copydir
+syn keyword antElement copyfile coveragepath csc custom cvs cvschangelog cvspass cvstagdiff cvsversion
+syn keyword antElement daemons date defaultexcludes define delete deletecharacters deltree depend
+syn keyword antElement depends dependset depth description different dirname dirset disable dname
+syn keyword antElement doclet doctitle dtd ear echo echoproperties ejbjar element enable entity entry
+syn keyword antElement env equals escapeunicode exclude excludepackage excludesfile exec execon
+syn keyword antElement existing expandproperties extdirs extension extensionSet extensionset factory
+syn keyword antElement fail filelist filename filepath fileset filesmatch filetokenizer filter
+syn keyword antElement filterchain filterreader filters filterset filtersfile fixcrlf footer format
+syn keyword antElement from ftp generic genkey get gjdoc grant group gunzip gzip header headfilter http
+syn keyword antElement ignoreblank ilasm ildasm import importtypelib include includesfile input iplanet
+syn keyword antElement iplanet-ejbc isfalse isreference isset istrue jar jarlib-available
+syn keyword antElement jarlib-manifest jarlib-resolve java javac javacc javadoc javadoc2 jboss jdepend
+syn keyword antElement jjdoc jjtree jlink jonas jpcoverage jpcovmerge jpcovreport jsharpc jspc
+syn keyword antElement junitreport jvmarg lib libfileset linetokenizer link loadfile loadproperties
+syn keyword antElement location macrodef mail majority manifest map mapper marker mergefiles message
+syn keyword antElement metainf method mimemail mkdir mmetrics modified move mparse none not options or
+syn keyword antElement os outputproperty package packageset parallel param patch path pathconvert
+syn keyword antElement pathelement patternset permissions prefixlines present presetdef project
+syn keyword antElement property propertyfile propertyref propertyset pvcs pvcsproject record reference
+syn keyword antElement regexp rename renameext replace replacefilter replaceregex replaceregexp
+syn keyword antElement replacestring replacetoken replacetokens replacevalue replyto report resource
+syn keyword antElement revoke rmic root rootfileset rpm scp section selector sequential serverdeploy
+syn keyword antElement setproxy signjar size sleep socket soscheckin soscheckout sosget soslabel source
+syn keyword antElement sourcepath sql src srcfile srcfilelist srcfiles srcfileset sshexec stcheckin
+syn keyword antElement stcheckout stlabel stlist stringtokenizer stripjavacomments striplinebreaks
+syn keyword antElement striplinecomments style subant substitution support symlink sync sysproperty
+syn keyword antElement syspropertyset tabstospaces tag taglet tailfilter tar tarfileset target
+syn keyword antElement targetfile targetfilelist targetfileset taskdef tempfile test testlet text title
+syn keyword antElement to token tokenfilter touch transaction translate triggers trim tstamp type
+syn keyword antElement typedef unjar untar unwar unzip uptodate url user vbc vssadd vsscheckin
+syn keyword antElement vsscheckout vsscp vsscreate vssget vsshistory vsslabel waitfor war wasclasspath
+syn keyword antElement webapp webinf weblogic weblogictoplink websphere whichresource wlclasspath
+syn keyword antElement wljspc wsdltodotnet xmlcatalog xmlproperty xmlvalidate xslt zip zipfileset
+syn keyword antElement zipgroupfileset
hi def link antElement Statement
diff --git a/runtime/syntax/c.vim b/runtime/syntax/c.vim
index 5ed8fdc847..30db9438d0 100644
--- a/runtime/syntax/c.vim
+++ b/runtime/syntax/c.vim
@@ -252,7 +252,7 @@ if exists("c_gnu")
syn keyword cOperator typeof __typeof__
syn keyword cOperator __real__ __imag__
syn keyword cStorageClass __attribute__ __const__ __extension__
- syn keyword cStorageClass inline __inline__
+ syn keyword cStorageClass inline __inline __inline__
syn keyword cStorageClass __restrict__ __volatile__ __noreturn__
endif
syn keyword cType int long short char void
@@ -444,6 +444,14 @@ syn match cUserLabel display "\I\i*" contained
syn match cBitField display "^\s*\zs\I\i*\s*:\s*[1-9]"me=e-1 contains=cType
syn match cBitField display ";\s*\zs\I\i*\s*:\s*[1-9]"me=e-1 contains=cType
+if exists("c_functions")
+ syn match cFunction "\<\h\w*\ze\_s*("
+ endif
+
+if exists("c_function_pointers")
+ syn match cFunctionPointer "\%((\s*\*\s*\)\@<=\h\w*\ze\s*)\_s*(.*)"
+endif
+
if exists("c_minlines")
let b:c_minlines = c_minlines
else
@@ -513,6 +521,8 @@ hi def link cCppOutSkip cCppOutIf2
hi def link cCppInElse2 cCppOutIf2
hi def link cCppOutIf2 cCppOut
hi def link cCppOut Comment
+hi def link cFunction Function
+hi def link cFunctionPointer Function
let b:current_syntax = "c"
diff --git a/runtime/syntax/chuck.vim b/runtime/syntax/chuck.vim
new file mode 100644
index 0000000000..6fcf40ca8b
--- /dev/null
+++ b/runtime/syntax/chuck.vim
@@ -0,0 +1,187 @@
+" Vim syntax file
+" Language: ChucK
+" Maintainer: Andrea Callea
+" URL: https://github.com/gacallea/chuck.vim
+" Last Change: 2024 Jan 21 by Andrea Callea
+
+" Sources used for this syntax
+" https://chuck.cs.princeton.edu/doc/language/
+" https://chuck.cs.princeton.edu/doc/reference/
+
+" HISTORY:
+" 2024 Jan 21 - Initial revision
+
+" quit when a syntax file was already loaded
+if exists("b:current_syntax")
+ finish
+endif
+
+" https://chuck.cs.princeton.edu/doc/language/type.html
+syn keyword chuckPrimitiveType int float time dur void vec3 vec4
+syn keyword chuckComplexType complex polar
+syn keyword chuckReferenceType Object Event UGen array string
+syn keyword chuckBoolean true false maybe
+syn keyword chuckBoolean null NULL
+
+" https://chuck.cs.princeton.edu/doc/language/oper.html
+syn match chuckOperator "=>"
+syn match chuckOperator "@=>"
+
+syn match chuckOperator "=^"
+
+syn match chuckOperator "+"
+syn match chuckOperator "-"
+syn match chuckOperator "*"
+syn match chuckOperator "/"
+syn match chuckOperator "%"
+syn match chuckOperator "!"
+syn match chuckOperator "&"
+syn match chuckOperator "|"
+syn match chuckOperator "\^"
+
+syn match chuckOperator "+=>"
+syn match chuckOperator "-=>"
+syn match chuckOperator "*=>"
+syn match chuckOperator "/=>"
+syn match chuckOperator "%=>"
+syn match chuckOperator "!=>"
+syn match chuckOperator "&=>"
+syn match chuckOperator "|=>"
+syn match chuckOperator "\^=>"
+
+syn match chuckOperator "&&"
+syn match chuckOperator "||"
+syn match chuckOperator "=="
+syn match chuckOperator "!="
+syn match chuckOperator ">"
+syn match chuckOperator ">="
+syn match chuckOperator "<"
+syn match chuckOperator "<="
+
+syn match chuckOperator ">>"
+syn match chuckOperator "<<"
+
+syn match chuckOperator "++"
+syn match chuckOperator "--"
+syn match chuckOperator "<<<"
+syn match chuckOperator ">>>"
+
+syn keyword chuckOperator new
+
+" https://chuck.cs.princeton.edu/doc/language/ctrl.html
+syn keyword chuckConditional if else
+syn keyword chuckRepeat while do until for each
+
+" https://chuck.cs.princeton.edu/doc/language/time.html
+syn keyword chuckTimeAndDuration samp ms second minute hour day week
+syn keyword chuckTimeAndDuration now later
+
+" these may need some additional keywords I missed, for a future revision
+syn keyword chuckKeyword dac adc
+syn keyword chuckKeyword fun function
+syn keyword chuckKeyword return
+syn keyword chuckKeyword const
+syn match chuckKeyword "@"
+syn keyword chuckKeyword pi
+syn keyword chuckKeyword me
+syn keyword chuckKeyword repeat break continue
+syn keyword chuckKeyword class extends public private static pure this
+syn keyword chuckKeyword spork
+syn keyword chuckKeyword cherr chout
+
+" https://chuck.cs.princeton.edu/doc/reference/
+syn keyword chuckBaseClasses Shred Math Machine Std
+
+" https://chuck.cs.princeton.edu/doc/reference/
+syn keyword chuckBasicUGen Gain Impulse Step SndBuf SndBuf2
+syn keyword chuckBasicUGen ADSR Envelope Delay DelayL DelayA Echo
+syn keyword chuckBasicUGen Noise CNoise Osc SinOsc TriOsc SawOsc PulseOsc SqrOsc
+syn keyword chuckBasicUGen Phasor HalfRect FullRect
+syn keyword chuckBasicUGen Chugraph Chugen UGen_Multi UGen_Stereo Mix2 Pan2
+
+" https://chuck.cs.princeton.edu/doc/reference/
+syn keyword chuckFilterUGen FilterBasic LPF HPF BPF BRF BiQuad ResonZ
+syn keyword chuckFilterUGen OnePole OneZero TwoPole TwoZero PoleZero
+
+" https://chuck.cs.princeton.edu/doc/reference/
+syn keyword chuckSTKUGen JCRev NRev PRCRev
+syn keyword chuckSTKUGen Chorus Modulate PitShift SubNoise
+syn keyword chuckSTKUGen BLT Blit BlitSaw BlitSquare FilterStk
+syn keyword chuckSTKUGen WvIn WaveLoop WvOut WvOut2 StkInstrument
+syn keyword chuckSTKUGen BandedWG BlowBotl BlowHole
+syn keyword chuckSTKUGen Bowed Brass Clarinet Flute Mandolin
+syn keyword chuckSTKUGen ModalBar Moog Saxofony Shakers Sitar StifKarp
+syn keyword chuckSTKUGen VoicForm KrstlChr FM BeeThree FMVoices
+syn keyword chuckSTKUGen HevyMetl HnkyTonk FrencHrn PercFlut Rhodey TubeBell Wurley
+
+" https://chuck.cs.princeton.edu/doc/reference/
+syn keyword chuckAdvancedUGen LiSa LiSa2 LiSa6 LiSa8 LiSa10
+syn keyword chuckAdvancedUGen LiSa16 GenX Gen5 Gen7 Gen9 Gen10 Gen17
+syn keyword chuckAdvancedUGen CurveTable WarpTable Dyno
+
+" https://chuck.cs.princeton.edu/doc/reference/
+syn keyword chuckChugin ABSaturator AmbPan3 Bitcrusher Elliptic ExpDelay ExpEnv FIR
+syn keyword chuckChugin FoldbackSaturator GVerb KasFilter MagicSine Mesh2D
+syn keyword chuckChugin Multicomb Pan4 Pan8 Pan16 PitchTrack PowerADSR RegEx
+syn keyword chuckChugin Sigmund Spectacle WinFuncEnv WPDiodeLadder WPKorg35
+
+" https://chuck.cs.princeton.edu/doc/reference/
+syn keyword chuckUnitAnalyzer UAna UAnaBlob Windowing
+syn keyword chuckUnitAnalyzer FFT IFFT DCT IDCT
+syn keyword chuckUnitAnalyzer Centroid Flux RMS RollOff
+syn keyword chuckUnitAnalyzer Flip UnFlip XCorr
+syn keyword chuckUnitAnalyzer Chroma Kurtosis MFCC SFM ZeroX AutoCorr FeatureCollector
+
+" https://chuck.cs.princeton.edu/doc/reference/
+syn keyword chuckChAI MLP KNN KNN2 HMM SVM Word2Vec PCA Wekinator AI
+
+" https://chuck.cs.princeton.edu/doc/reference/
+syn keyword chuckInputOutput IO FileIO OscIn OscOut OscMsg
+syn keyword chuckInputOutput Hid HidMsg KBHit SerialIO
+syn keyword chuckInputOutput MidiIn MidiOut MidiMsg MidiFileIn
+
+" https://chuck.cs.princeton.edu/doc/reference/
+syn keyword chuckUtilities CKDoc StringTokenizer ConsoleInput
+
+" https://github.com/wilsaj/chuck.vim/blob/master/syntax/chuck.vim
+syn match chuckNumber /\%(\i\|\$\)\@<![-]\?\d\+/ display
+syn match chuckHex /\<0[xX]\x\+[lL]\=\>/ display
+syn match chuckFloat /\%(\i\|\$\)\@<![-]\?\%(\d*\.\d\+\|\d\+\.\)/ display
+
+" this may need fixing/improvements
+syn match chuckComment "//.*$"
+syn region chuckComment start="/\*" end="\*/"
+syn match chuckSpecialChar contained "\\n"
+syn match chuckSpecialChar contained "\\t"
+syn match chuckSpecialChar contained "\\a"
+syn match chuckSpecialChar contained /\\"/
+syn match chuckSpecialChar contained "\\0"
+syn region chuckString start=/"/ end=/"/ display contains=chuckSpecialChar
+
+hi def link chuckPrimitiveType Type
+hi def link chuckComplexType Type
+hi def link chuckReferenceType Type
+hi def link chuckBoolean Boolean
+hi def link chuckOperator Operator
+hi def link chuckConditional Conditional
+hi def link chuckRepeat Repeat
+hi def link chuckTimeAndDuration Keyword
+hi def link chuckKeyword Keyword
+hi def link chuckBaseClasses Special
+hi def link chuckBasicUGen Structure
+hi def link chuckFilterUGen Structure
+hi def link chuckSTKUGen Structure
+hi def link chuckAdvancedUGen Structure
+hi def link chuckChugin Structure
+hi def link chuckUnitAnalyzer Structure
+hi def link chuckChAI Structure
+hi def link chuckInputOutput Special
+hi def link chuckUtilities Special
+hi def link chuckNumber Number
+hi def link chuckHex Number
+hi def link chuckFloat Float
+hi def link chuckComment Comment
+hi def link chuckSpecialChar SpecialChar
+hi def link chuckString String
+
+let b:current_syntax = "chuck"
diff --git a/runtime/syntax/cmake.vim b/runtime/syntax/cmake.vim
index 7340ac238e..c95503beb5 100644
--- a/runtime/syntax/cmake.vim
+++ b/runtime/syntax/cmake.vim
@@ -1,15 +1,15 @@
" Vim syntax file
" Program: CMake - Cross-Platform Makefile Generator
-" Version: cmake version 3.9.20170830-ge0713
+" Version: cmake version 3.27.20230713-gdc88dd5
" Language: CMake
" Author: Andy Cedilnik <andy.cedilnik@kitware.com>,
" Nicholas Hutchinson <nshutchinson@gmail.com>,
" Patrick Boettcher <patrick.boettcher@posteo.de>
" Maintainer: Dimitri Merejkowsky <d.merej@gmail.com>
" Former Maintainer: Karthik Krishnan <karthik.krishnan@kitware.com>
-" Last Change: 2017 Aug 30
+" Last Change: 2023 Jul 13
"
-" Licence: The CMake license applies to this file. See
+" License: The CMake license applies to this file. See
" https://cmake.org/licensing
" This implies that distribution with Vim is allowed
@@ -19,335 +19,4799 @@ endif
let s:keepcpo= &cpo
set cpo&vim
-syn region cmakeComment start="#" end="$" contains=cmakeTodo,cmakeLuaComment,@Spell
-syn region cmakeLuaComment start="\[\z(=*\)\[" end="\]\z1\]" contains=cmakeTodo,@Spell
+syn region cmakeBracketArgument start="\[\z(=*\)\[" end="\]\z1\]" contains=cmakeTodo,@Spell
+
+syn region cmakeComment start="#\(\[=*\[\)\@!" end="$" contains=cmakeTodo,@Spell
+syn region cmakeBracketComment start="#\[\z(=*\)\[" end="\]\z1\]" contains=cmakeTodo,@Spell
syn match cmakeEscaped /\(\\\\\|\\"\|\\n\|\\t\)/ contained
syn region cmakeRegistry start="\[" end="]" contained oneline contains=cmakeTodo,cmakeEscaped
syn region cmakeGeneratorExpression start="$<" end=">" contained oneline contains=cmakeVariableValue,cmakeProperty,cmakeGeneratorExpressions,cmakeTodo
-syn region cmakeString start='"' end='"' contained contains=cmakeTodo,cmakeVariableValue,cmakeEscaped
+syn region cmakeString start='"' end='"' contained contains=cmakeTodo,cmakeVariableValue,cmakeEscaped,@Spell
-syn region cmakeVariableValue start="${" end="}" contained oneline contains=cmakeVariable,cmakeTodo
+syn region cmakeVariableValue start="${" end="}" contained oneline contains=cmakeVariable,cmakeTodo,cmakeVariableValue
syn region cmakeEnvironment start="$ENV{" end="}" contained oneline contains=cmakeTodo
-syn region cmakeArguments start="(" end=")" contains=ALLBUT,cmakeCommand,cmakeCommandConditional,cmakeCommandRepeat,cmakeCommandDeprecated,cmakeArguments,cmakeTodo
+syn region cmakeArguments start="(" end=")" contains=ALLBUT,cmakeGeneratorExpressions,cmakeCommand,cmakeCommandConditional,cmakeCommandRepeat,cmakeCommandDeprecated,cmakeCommandManuallyAdded,cmakeArguments,cmakeTodo,@Spell
syn case match
syn keyword cmakeProperty contained
- \ ABSTRACT ADDITIONAL_MAKE_CLEAN_FILES ADVANCED ALIASED_TARGET ALLOW_DUPLICATE_CUSTOM_TARGETS ANDROID_ANT_ADDITIONAL_OPTIONS ANDROID_API ANDROID_API_MIN ANDROID_ARCH ANDROID_ASSETS_DIRECTORIES ANDROID_GUI ANDROID_JAR_DEPENDENCIES ANDROID_JAR_DIRECTORIES ANDROID_JAVA_SOURCE_DIR ANDROID_NATIVE_LIB_DEPENDENCIES ANDROID_NATIVE_LIB_DIRECTORIES ANDROID_PROCESS_MAX ANDROID_PROGUARD ANDROID_PROGUARD_CONFIG_PATH ANDROID_SECURE_PROPS_PATH ANDROID_SKIP_ANT_STEP ANDROID_STL_TYPE ARCHIVE_OUTPUT_DIRECTORY ARCHIVE_OUTPUT_NAME ATTACHED_FILES ATTACHED_FILES_ON_FAIL AUTOGEN_BUILD_DIR AUTOGEN_SOURCE_GROUP AUTOGEN_TARGETS_FOLDER AUTOGEN_TARGET_DEPENDS AUTOMOC AUTOMOC_DEPEND_FILTERS AUTOMOC_MACRO_NAMES AUTOMOC_MOC_OPTIONS AUTOMOC_SOURCE_GROUP AUTOMOC_TARGETS_FOLDER AUTORCC AUTORCC_OPTIONS AUTORCC_SOURCE_GROUP AUTOUIC AUTOUIC_OPTIONS AUTOUIC_SEARCH_PATHS BINARY_DIR BUILDSYSTEM_TARGETS BUILD_RPATH BUILD_WITH_INSTALL_NAME_DIR BUILD_WITH_INSTALL_RPATH BUNDLE BUNDLE_EXTENSION CACHE_VARIABLES CLEAN_NO_CUSTOM CMAKE_CONFIGURE_DEPENDS CMAKE_CXX_KNOWN_FEATURES CMAKE_C_KNOWN_FEATURES COMPATIBLE_INTERFACE_BOOL COMPATIBLE_INTERFACE_NUMBER_MAX COMPATIBLE_INTERFACE_NUMBER_MIN COMPATIBLE_INTERFACE_STRING COMPILE_DEFINITIONS COMPILE_FEATURES COMPILE_FLAGS COMPILE_OPTIONS COMPILE_PDB_NAME COMPILE_PDB_OUTPUT_DIRECTORY COST CPACK_DESKTOP_SHORTCUTS CPACK_NEVER_OVERWRITE CPACK_PERMANENT CPACK_STARTUP_SHORTCUTS CPACK_START_MENU_SHORTCUTS CPACK_WIX_ACL CROSSCOMPILING_EMULATOR CUDA_EXTENSIONS CUDA_PTX_COMPILATION CUDA_RESOLVE_DEVICE_SYMBOLS CUDA_SEPARABLE_COMPILATION CUDA_STANDARD CUDA_STANDARD_REQUIRED CXX_EXTENSIONS CXX_STANDARD CXX_STANDARD_REQUIRED C_EXTENSIONS C_STANDARD C_STANDARD_REQUIRED DEBUG_CONFIGURATIONS DEBUG_POSTFIX DEFINE_SYMBOL DEFINITIONS DEPENDS DEPLOYMENT_REMOTE_DIRECTORY DISABLED DISABLED_FEATURES ECLIPSE_EXTRA_NATURES ENABLED_FEATURES ENABLED_LANGUAGES ENABLE_EXPORTS ENVIRONMENT EXCLUDE_FROM_ALL EXCLUDE_FROM_DEFAULT_BUILD EXPORT_NAME EXTERNAL_OBJECT EchoString FAIL_REGULAR_EXPRESSION FIND_LIBRARY_USE_LIB32_PATHS FIND_LIBRARY_USE_LIB64_PATHS FIND_LIBRARY_USE_LIBX32_PATHS FIND_LIBRARY_USE_OPENBSD_VERSIONING FIXTURES_CLEANUP FIXTURES_REQUIRED FIXTURES_SETUP FOLDER FRAMEWORK FRAMEWORK_VERSION Fortran_FORMAT Fortran_MODULE_DIRECTORY GENERATED GENERATOR_FILE_NAME GENERATOR_IS_MULTI_CONFIG GLOBAL_DEPENDS_DEBUG_MODE GLOBAL_DEPENDS_NO_CYCLES GNUtoMS HAS_CXX HEADER_FILE_ONLY HELPSTRING IMPLICIT_DEPENDS_INCLUDE_TRANSFORM IMPORTED IMPORTED_CONFIGURATIONS IMPORTED_IMPLIB IMPORTED_LIBNAME IMPORTED_LINK_DEPENDENT_LIBRARIES IMPORTED_LINK_INTERFACE_LANGUAGES IMPORTED_LINK_INTERFACE_LIBRARIES IMPORTED_LINK_INTERFACE_MULTIPLICITY IMPORTED_LOCATION IMPORTED_NO_SONAME IMPORTED_OBJECTS IMPORTED_SONAME IMPORT_PREFIX IMPORT_SUFFIX INCLUDE_DIRECTORIES INCLUDE_REGULAR_EXPRESSION INSTALL_NAME_DIR INSTALL_RPATH INSTALL_RPATH_USE_LINK_PATH INTERFACE_AUTOUIC_OPTIONS INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_FEATURES INTERFACE_COMPILE_OPTIONS INTERFACE_INCLUDE_DIRECTORIES INTERFACE_LINK_LIBRARIES INTERFACE_POSITION_INDEPENDENT_CODE INTERFACE_SOURCES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES INTERPROCEDURAL_OPTIMIZATION IN_TRY_COMPILE IOS_INSTALL_COMBINED JOB_POOLS JOB_POOL_COMPILE JOB_POOL_LINK KEEP_EXTENSION LABELS LANGUAGE LIBRARY_OUTPUT_DIRECTORY LIBRARY_OUTPUT_NAME LINKER_LANGUAGE LINK_DEPENDS LINK_DEPENDS_NO_SHARED LINK_DIRECTORIES LINK_FLAGS LINK_INTERFACE_LIBRARIES LINK_INTERFACE_MULTIPLICITY LINK_LIBRARIES LINK_SEARCH_END_STATIC LINK_SEARCH_START_STATIC LINK_WHAT_YOU_USE LISTFILE_STACK LOCATION MACOSX_BUNDLE MACOSX_BUNDLE_INFO_PLIST MACOSX_FRAMEWORK_INFO_PLIST MACOSX_PACKAGE_LOCATION MACOSX_RPATH MACROS MANUALLY_ADDED_DEPENDENCIES MEASUREMENT MODIFIED NAME NO_SONAME NO_SYSTEM_FROM_IMPORTED OBJECT_DEPENDS OBJECT_OUTPUTS OSX_ARCHITECTURES OUTPUT_NAME PACKAGES_FOUND PACKAGES_NOT_FOUND PARENT_DIRECTORY PASS_REGULAR_EXPRESSION PDB_NAME PDB_OUTPUT_DIRECTORY POSITION_INDEPENDENT_CODE POST_INSTALL_SCRIPT PREDEFINED_TARGETS_FOLDER PREFIX PRE_INSTALL_SCRIPT PRIVATE_HEADER PROCESSORS PROJECT_LABEL PUBLIC_HEADER REPORT_UNDEFINED_PROPERTIES REQUIRED_FILES RESOURCE RESOURCE_LOCK RULE_LAUNCH_COMPILE RULE_LAUNCH_CUSTOM RULE_LAUNCH_LINK RULE_MESSAGES RUNTIME_OUTPUT_DIRECTORY RUNTIME_OUTPUT_NAME RUN_SERIAL SKIP_AUTOGEN SKIP_AUTOMOC SKIP_AUTORCC SKIP_AUTOUIC SKIP_BUILD_RPATH SKIP_RETURN_CODE SOURCES SOURCE_DIR SOVERSION STATIC_LIBRARY_FLAGS STRINGS SUBDIRECTORIES SUFFIX SYMBOLIC TARGET_ARCHIVES_MAY_BE_SHARED_LIBS TARGET_MESSAGES TARGET_SUPPORTS_SHARED_LIBS TEST_INCLUDE_FILE TEST_INCLUDE_FILES TIMEOUT TIMEOUT_AFTER_MATCH TYPE USE_FOLDERS VALUE VARIABLES VERSION VISIBILITY_INLINES_HIDDEN VS_CONFIGURATION_TYPE VS_COPY_TO_OUT_DIR VS_DEBUGGER_WORKING_DIRECTORY VS_DEPLOYMENT_CONTENT VS_DEPLOYMENT_LOCATION VS_DESKTOP_EXTENSIONS_VERSION VS_DOTNET_REFERENCES VS_DOTNET_REFERENCES_COPY_LOCAL VS_DOTNET_TARGET_FRAMEWORK_VERSION VS_GLOBAL_KEYWORD VS_GLOBAL_PROJECT_TYPES VS_GLOBAL_ROOTNAMESPACE VS_INCLUDE_IN_VSIX VS_IOT_EXTENSIONS_VERSION VS_IOT_STARTUP_TASK VS_KEYWORD VS_MOBILE_EXTENSIONS_VERSION VS_RESOURCE_GENERATOR VS_SCC_AUXPATH VS_SCC_LOCALPATH VS_SCC_PROJECTNAME VS_SCC_PROVIDER VS_SDK_REFERENCES VS_SHADER_ENTRYPOINT VS_SHADER_FLAGS VS_SHADER_MODEL VS_SHADER_TYPE VS_STARTUP_PROJECT VS_TOOL_OVERRIDE VS_USER_PROPS VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION VS_WINRT_COMPONENT VS_WINRT_EXTENSIONS VS_WINRT_REFERENCES VS_XAML_TYPE WILL_FAIL WIN32_EXECUTABLE WINDOWS_EXPORT_ALL_SYMBOLS WORKING_DIRECTORY WRAP_EXCLUDE XCODE_EMIT_EFFECTIVE_PLATFORM_NAME XCODE_EXPLICIT_FILE_TYPE XCODE_FILE_ATTRIBUTES XCODE_LAST_KNOWN_FILE_TYPE XCODE_PRODUCT_TYPE XCTEST
+ \ ABSTRACT
+ \ ADDITIONAL_CLEAN_FILES
+ \ ADDITIONAL_MAKE_CLEAN_FILES
+ \ ADVANCED
+ \ AIX_EXPORT_ALL_SYMBOLS
+ \ ALIASED_TARGET
+ \ ALIAS_GLOBAL
+ \ ALLOW_DUPLICATE_CUSTOM_TARGETS
+ \ ANDROID_ANT_ADDITIONAL_OPTIONS
+ \ ANDROID_API
+ \ ANDROID_API_MIN
+ \ ANDROID_ARCH
+ \ ANDROID_ASSETS_DIRECTORIES
+ \ ANDROID_GUI
+ \ ANDROID_JAR_DEPENDENCIES
+ \ ANDROID_JAR_DIRECTORIES
+ \ ANDROID_JAVA_SOURCE_DIR
+ \ ANDROID_NATIVE_LIB_DEPENDENCIES
+ \ ANDROID_NATIVE_LIB_DIRECTORIES
+ \ ANDROID_PROCESS_MAX
+ \ ANDROID_PROGUARD
+ \ ANDROID_PROGUARD_CONFIG_PATH
+ \ ANDROID_SECURE_PROPS_PATH
+ \ ANDROID_SKIP_ANT_STEP
+ \ ANDROID_STL_TYPE
+ \ ARCHIVE_OUTPUT_DIRECTORY
+ \ ARCHIVE_OUTPUT_NAME
+ \ ATTACHED_FILES
+ \ ATTACHED_FILES_ON_FAIL
+ \ AUTOGEN_BUILD_DIR
+ \ AUTOGEN_COMMAND_LINE_LENGTH_MAX
+ \ AUTOGEN_ORIGIN_DEPENDS
+ \ AUTOGEN_PARALLEL
+ \ AUTOGEN_SOURCE_GROUP
+ \ AUTOGEN_USE_SYSTEM_INCLUDE
+ \ AUTOGEN_TARGETS_FOLDER
+ \ AUTOGEN_TARGET_DEPENDS
+ \ AUTOGEN_USE_SYSTEM_INCLUDE
+ \ AUTOMOC
+ \ AUTOMOC_COMPILER_PREDEFINES
+ \ AUTOMOC_DEPEND_FILTERS
+ \ AUTOMOC_EXECUTABLE
+ \ AUTOMOC_MACRO_NAMES
+ \ AUTOMOC_MOC_OPTIONS
+ \ AUTOMOC_PATH_PREFIX
+ \ AUTOMOC_SOURCE_GROUP
+ \ AUTOMOC_TARGETS_FOLDER
+ \ AUTORCC
+ \ AUTORCC_EXECUTABLE
+ \ AUTORCC_OPTIONS
+ \ AUTORCC_SOURCE_GROUP
+ \ AUTOUIC
+ \ AUTOUIC_EXECUTABLE
+ \ AUTOUIC_OPTIONS
+ \ AUTOUIC_SEARCH_PATHS
+ \ AUTOUIC_SOURCE_GROUP
+ \ BINARY_DIR
+ \ BUILDSYSTEM_TARGETS
+ \ BUILD_RPATH
+ \ BUILD_RPATH_USE_ORIGIN
+ \ BUILD_WITH_INSTALL_NAME_DIR
+ \ BUILD_WITH_INSTALL_RPATH
+ \ BUNDLE
+ \ BUNDLE_EXTENSION
+ \ CACHE_VARIABLES
+ \ CLEAN_NO_CUSTOM
+ \ CMAKE_CONFIGURE_DEPENDS
+ \ CMAKE_CUDA_KNOWN_FEATURES
+ \ CMAKE_CXX_KNOWN_FEATURES
+ \ CMAKE_C_KNOWN_FEATURES
+ \ CMAKE_ROLE
+ \ COMMON_LANGUAGE_RUNTIME
+ \ COMPATIBLE_INTERFACE_BOOL
+ \ COMPATIBLE_INTERFACE_NUMBER_MAX
+ \ COMPATIBLE_INTERFACE_NUMBER_MIN
+ \ COMPATIBLE_INTERFACE_STRING
+ \ COMPILE_DEFINITIONS
+ \ COMPILE_FEATURES
+ \ COMPILE_FLAGS
+ \ COMPILE_OPTIONS
+ \ COMPILE_PDB_NAME
+ \ COMPILE_PDB_OUTPUT_DIRECTORY
+ \ COMPILE_WARNING_AS_ERROR
+ \ COST
+ \ CPACK_DESKTOP_SHORTCUTS
+ \ CPACK_NEVER_OVERWRITE
+ \ CPACK_PERMANENT
+ \ CPACK_STARTUP_SHORTCUTS
+ \ CPACK_START_MENU_SHORTCUTS
+ \ CPACK_WIX_ACL
+ \ CROSSCOMPILING_EMULATOR
+ \ CUDA_ARCHITECTURES
+ \ CUDA_CUBIN_COMPILATION
+ \ CUDA_EXTENSIONS
+ \ CUDA_FATBIN_COMPILATION
+ \ CUDA_OPTIX_COMPILATION
+ \ CUDA_PTX_COMPILATION
+ \ CUDA_RESOLVE_DEVICE_SYMBOLS
+ \ CUDA_RUNTIME_LIBRARY
+ \ CUDA_SEPARABLE_COMPILATION
+ \ CUDA_STANDARD
+ \ CUDA_STANDARD_REQUIRED
+ \ CXX_EXTENSIONS
+ \ CXX_MODULE_DIRS
+ \ CXX_MODULE_SET
+ \ CXX_MODULE_SETS
+ \ CXX_SCAN_FOR_MODULES
+ \ CXX_STANDARD
+ \ CXX_STANDARD_REQUIRED
+ \ C_EXTENSIONS
+ \ C_STANDARD
+ \ C_STANDARD_REQUIRED
+ \ DEBUG_CONFIGURATIONS
+ \ DEBUG_POSTFIX
+ \ DEFINE_SYMBOL
+ \ DEFINITIONS
+ \ DEPENDS
+ \ DEPLOYMENT_ADDITIONAL_FILES
+ \ DEPLOYMENT_REMOTE_DIRECTORY
+ \ DEPRECATION
+ \ DISABLED
+ \ DISABLED_FEATURES
+ \ DISABLE_PRECOMPILE_HEADERS
+ \ DLL_NAME_WITH_SOVERSION
+ \ DOTNET_SDK
+ \ DOTNET_TARGET_FRAMEWORK
+ \ DOTNET_TARGET_FRAMEWORK_VERSION
+ \ ECLIPSE_EXTRA_CPROJECT_CONTENTS
+ \ ECLIPSE_EXTRA_NATURES
+ \ ENABLED_FEATURES
+ \ ENABLED_LANGUAGES
+ \ ENABLE_EXPORTS
+ \ ENVIRONMENT
+ \ ENVIRONMENT_MODIFICATION
+ \ EXCLUDE_FROM_ALL
+ \ EXCLUDE_FROM_DEFAULT_BUILD
+ \ EXPORT_COMPILE_COMMANDS
+ \ EXPORT_NAME
+ \ EXPORT_NO_SYSTEM
+ \ EXPORT_PROPERTIES
+ \ EXTERNAL_OBJECT
+ \ EchoString
+ \ FAIL_REGULAR_EXPRESSION
+ \ FIND_LIBRARY_USE_LIB32_PATHS
+ \ FIND_LIBRARY_USE_LIB64_PATHS
+ \ FIND_LIBRARY_USE_LIBX32_PATHS
+ \ FIND_LIBRARY_USE_OPENBSD_VERSIONING
+ \ FIXTURES_CLEANUP
+ \ FIXTURES_REQUIRED
+ \ FIXTURES_SETUP
+ \ FOLDER
+ \ FRAMEWORK
+ \ FRAMEWORK_VERSION
+ \ Fortran_BUILDING_INSTRINSIC_MODULES
+ \ Fortran_FORMAT
+ \ Fortran_MODULE_DIRECTORY
+ \ Fortran_PREPROCESS
+ \ GENERATED
+ \ GENERATOR_FILE_NAME
+ \ GENERATOR_IS_MULTI_CONFIG
+ \ GHS_INTEGRITY_APP
+ \ GHS_NO_SOURCE_GROUP_FILE
+ \ GLOBAL_DEPENDS_DEBUG_MODE
+ \ GLOBAL_DEPENDS_NO_CYCLES
+ \ GNUtoMS
+ \ HAS_CXX
+ \ HEADER_DIRS
+ \ HEADER_FILE_ONLY
+ \ HEADER_SET
+ \ HEADER_SETS
+ \ HELPSTRING
+ \ HIP_ARCHITECTURES
+ \ HIP_EXTENSIONS
+ \ HIP_STANDARD
+ \ HIP_STANDARD_REQUIRED
+ \ IMPLICIT_DEPENDS_INCLUDE_TRANSFORM
+ \ IMPORTED
+ \ IMPORTED_COMMON_LANGUAGE_RUNTIME
+ \ IMPORTED_CONFIGURATIONS
+ \ IMPORTED_GLOBAL
+ \ IMPORTED_IMPLIB
+ \ IMPORTED_LIBNAME
+ \ IMPORTED_LINK_DEPENDENT_LIBRARIES
+ \ IMPORTED_LINK_INTERFACE_LANGUAGES
+ \ IMPORTED_LINK_INTERFACE_LIBRARIES
+ \ IMPORTED_LINK_INTERFACE_MULTIPLICITY
+ \ IMPORTED_LOCATION
+ \ IMPORTED_NO_SONAME
+ \ IMPORTED_NO_SYSTEM
+ \ IMPORTED_OBJECTS
+ \ IMPORTED_SONAME
+ \ IMPORTED_TARGETS
+ \ IMPORT_PREFIX
+ \ IMPORT_SUFFIX
+ \ INCLUDE_DIRECTORIES
+ \ INCLUDE_REGULAR_EXPRESSION
+ \ INSTALL_NAME_DIR
+ \ INSTALL_REMOVE_ENVIRONMENT_RPATH
+ \ INSTALL_RPATH
+ \ INSTALL_RPATH_USE_LINK_PATH
+ \ INTERFACE_AUTOMOC_MACRO_NAMES
+ \ INTERFACE_AUTOUIC_OPTIONS
+ \ INTERFACE_AUTOMOC_MACRO_NAMES
+ \ INTERFACE_COMPILE_DEFINITIONS
+ \ INTERFACE_COMPILE_FEATURES
+ \ INTERFACE_COMPILE_OPTIONS
+ \ INTERFACE_CXX_MODULE_SETS
+ \ INTERFACE_HEADER_SETS
+ \ INTERFACE_HEADER_SETS_TO_VERIFY
+ \ INTERFACE_INCLUDE_DIRECTORIES
+ \ INTERFACE_LINK_DEPENDS
+ \ INTERFACE_LINK_DIRECTORIES
+ \ INTERFACE_LINK_LIBRARIES
+ \ INTERFACE_LINK_LIBRARIES_DIRECT
+ \ INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE
+ \ INTERFACE_LINK_OPTIONS
+ \ INTERFACE_POSITION_INDEPENDENT_CODE
+ \ INTERFACE_PRECOMPILE_HEADERS
+ \ INTERFACE_SOURCES
+ \ INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
+ \ INTERPROCEDURAL_OPTIMIZATION
+ \ IN_TRY_COMPILE
+ \ IOS_INSTALL_COMBINED
+ \ ISPC_HEADER_DIRECTORY
+ \ ISPC_HEADER_SUFFIX
+ \ ISPC_INSTRUCTION_SETS
+ \ JOB_POOLS
+ \ JOB_POOL_COMPILE
+ \ JOB_POOL_LINK
+ \ JOB_POOL_PRECOMPILE_HEADER
+ \ KEEP_EXTENSION
+ \ LABELS
+ \ LANGUAGE
+ \ LIBRARY_OUTPUT_DIRECTORY
+ \ LIBRARY_OUTPUT_NAME
+ \ LINKER_LANGUAGE
+ \ LINK_DEPENDS
+ \ LINK_DEPENDS_NO_SHARED
+ \ LINK_DIRECTORIES
+ \ LINK_FLAGS
+ \ LINK_INTERFACE_LIBRARIES
+ \ LINK_INTERFACE_MULTIPLICITY
+ \ LINK_LIBRARIES
+ \ LINK_LIBRARIES_ONLY_TARGETS
+ \ LINK_LIBRARY_OVERRIDE
+ \ LINK_OPTIONS
+ \ LINK_SEARCH_END_STATIC
+ \ LINK_SEARCH_START_STATIC
+ \ LINK_WHAT_YOU_USE
+ \ LISTFILE_STACK
+ \ LOCATION
+ \ MACHO_COMPATIBILITY_VERSION
+ \ MACHO_CURRENT_VERSION
+ \ MACOSX_BUNDLE
+ \ MACOSX_BUNDLE_INFO_PLIST
+ \ MACOSX_FRAMEWORK_INFO_PLIST
+ \ MACOSX_PACKAGE_LOCATION
+ \ MACOSX_RPATH
+ \ MACROS
+ \ MANUALLY_ADDED_DEPENDENCIES
+ \ MEASUREMENT
+ \ MODIFIED
+ \ MSVC_DEBUG_INFORMATION_FORMAT
+ \ MSVC_RUNTIME_LIBRARY
+ \ NAME
+ \ NO_SONAME
+ \ NO_SYSTEM_FROM_IMPORTED
+ \ OBJCXX_EXTENSIONS
+ \ OBJCXX_STANDARD
+ \ OBJCXX_STANDARD_REQUIRED
+ \ OBJC_EXTENSIONS
+ \ OBJC_STANDARD
+ \ OBJC_STANDARD_REQUIRED
+ \ OBJECT_DEPENDS
+ \ OBJECT_OUTPUTS
+ \ OPTIMIZE_DEPENDENCIES
+ \ OSX_ARCHITECTURES
+ \ OUTPUT_NAME
+ \ PACKAGES_FOUND
+ \ PACKAGES_NOT_FOUND
+ \ PARENT_DIRECTORY
+ \ PASS_REGULAR_EXPRESSION
+ \ PCH_INSTANTIATE_TEMPLATES
+ \ PCH_WARN_INVALID
+ \ PDB_NAME
+ \ PDB_OUTPUT_DIRECTORY
+ \ POSITION_INDEPENDENT_CODE
+ \ POST_INSTALL_SCRIPT
+ \ PRECOMPILE_HEADERS
+ \ PRECOMPILE_HEADERS_REUSE_FROM
+ \ PREDEFINED_TARGETS_FOLDER
+ \ PREFIX
+ \ PRE_INSTALL_SCRIPT
+ \ PRIVATE_HEADER
+ \ PROCESSORS
+ \ PROCESSOR_AFFINITY
+ \ PROJECT_LABEL
+ \ PUBLIC_HEADER
+ \ REPORT_UNDEFINED_PROPERTIES
+ \ REQUIRED_FILES
+ \ RESOURCE
+ \ RESOURCE_GROUPS
+ \ RESOURCE_LOCK
+ \ RULE_LAUNCH_COMPILE
+ \ RULE_LAUNCH_CUSTOM
+ \ RULE_LAUNCH_LINK
+ \ RULE_MESSAGES
+ \ RUNTIME_OUTPUT_DIRECTORY
+ \ RUNTIME_OUTPUT_NAME
+ \ RUN_SERIAL
+ \ SKIP_AUTOGEN
+ \ SKIP_AUTOMOC
+ \ SKIP_AUTORCC
+ \ SKIP_AUTOUIC
+ \ SKIP_BUILD_RPATH
+ \ SKIP_LINTING
+ \ SKIP_PRECOMPILE_HEADERS
+ \ SKIP_REGULAR_EXPRESSION
+ \ SKIP_RETURN_CODE
+ \ SKIP_UNITY_BUILD_INCLUSION
+ \ SOURCES
+ \ SOURCE_DIR
+ \ SOVERSION
+ \ STATIC_LIBRARY_FLAGS
+ \ STATIC_LIBRARY_OPTIONS
+ \ STRINGS
+ \ SUBDIRECTORIES
+ \ SUFFIX
+ \ SYMBOLIC
+ \ SYSTEM
+ \ Swift_DEPENDENCIES_FILE
+ \ Swift_DIAGNOSTICS_FILE
+ \ Swift_LANGUAGE_VERSION
+ \ Swift_MODULE_DIRECTORY
+ \ Swift_MODULE_NAME
+ \ Swift_COMPILATION_MODE
+ \ TARGET_ARCHIVES_MAY_BE_SHARED_LIBS
+ \ TARGET_MESSAGES
+ \ TARGET_SUPPORTS_SHARED_LIBS
+ \ TESTS
+ \ TEST_INCLUDE_FILE
+ \ TEST_INCLUDE_FILES
+ \ TIMEOUT
+ \ TIMEOUT_AFTER_MATCH
+ \ TIMEOUT_SIGNAL_GRACE_PERIOD
+ \ TIMEOUT_SIGNAL_NAME
+ \ TYPE
+ \ UNITY_BUILD
+ \ UNITY_BUILD_BATCH_SIZE
+ \ UNITY_BUILD_CODE_AFTER_INCLUDE
+ \ UNITY_BUILD_CODE_BEFORE_INCLUDE
+ \ UNITY_BUILD_MODE
+ \ UNITY_BUILD_UNIQUE_ID
+ \ UNITY_GROUP
+ \ USE_FOLDERS
+ \ VALUE
+ \ VARIABLES
+ \ VERIFY_INTERFACE_HEADER_SETS
+ \ VERSION
+ \ VISIBILITY_INLINES_HIDDEN
+ \ VS_CONFIGURATION_TYPE
+ \ VS_COPY_TO_OUT_DIR
+ \ VS_DEBUGGER_COMMAND
+ \ VS_DEBUGGER_COMMAND_ARGUMENTS
+ \ VS_DEBUGGER_ENVIRONMENT
+ \ VS_DEBUGGER_WORKING_DIRECTORY
+ \ VS_DEPLOYMENT_CONTENT
+ \ VS_DEPLOYMENT_LOCATION
+ \ VS_DESKTOP_EXTENSIONS_VERSION
+ \ VS_DOTNET_DOCUMENTATION_FILE
+ \ VS_DOTNET_REFERENCES
+ \ VS_DOTNET_REFERENCES_COPY_LOCAL
+ \ VS_DOTNET_STARTUP_OBJECT
+ \ VS_DOTNET_TARGET_FRAMEWORK_VERSION
+ \ VS_DPI_AWARE
+ \ VS_GLOBAL_KEYWORD
+ \ VS_GLOBAL_PROJECT_TYPES
+ \ VS_GLOBAL_ROOTNAMESPACE
+ \ VS_INCLUDE_IN_VSIX
+ \ VS_IOT_EXTENSIONS_VERSION
+ \ VS_IOT_STARTUP_TASK
+ \ VS_JUST_MY_CODE_DEBUGGING
+ \ VS_KEYWORD
+ \ VS_MOBILE_EXTENSIONS_VERSION
+ \ VS_NO_COMPILE_BATCHING
+ \ VS_NO_SOLUTION_DEPLOY
+ \ VS_PACKAGE_REFERENCES
+ \ VS_PLATFORM_TOOLSET
+ \ VS_PROJECT_IMPORT
+ \ VS_RESOURCE_GENERATOR
+ \ VS_SCC_AUXPATH
+ \ VS_SCC_LOCALPATH
+ \ VS_SCC_PROJECTNAME
+ \ VS_SCC_PROVIDER
+ \ VS_SDK_REFERENCES
+ \ VS_SETTINGS
+ \ VS_SHADER_DISABLE_OPTIMIZATIONS
+ \ VS_SHADER_ENABLE_DEBUG
+ \ VS_SHADER_ENTRYPOINT
+ \ VS_SHADER_FLAGS
+ \ VS_SHADER_MODEL
+ \ VS_SHADER_OBJECT_FILE_NAME
+ \ VS_SHADER_OUTPUT_HEADER_FILE
+ \ VS_SHADER_TYPE
+ \ VS_SHADER_VARIABLE_NAME
+ \ VS_SOLUTION_DEPLOY
+ \ VS_STARTUP_PROJECT
+ \ VS_TOOL_OVERRIDE
+ \ VS_USER_PROPS
+ \ VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION
+ \ VS_WINRT_COMPONENT
+ \ VS_WINRT_EXTENSIONS
+ \ VS_WINRT_REFERENCES
+ \ VS_XAML_TYPE
+ \ WATCOM_RUNTIME_LIBRARY
+ \ WILL_FAIL
+ \ WIN32_EXECUTABLE
+ \ WINDOWS_EXPORT_ALL_SYMBOLS
+ \ WORKING_DIRECTORY
+ \ WRAP_EXCLUDE
+ \ XCODE_EMBED_FRAMEWORKS_CODE_SIGN_ON_COPY
+ \ XCODE_EMBED_FRAMEWORKS_REMOVE_HEADERS_ON_COPY
+ \ XCODE_EMIT_EFFECTIVE_PLATFORM_NAME
+ \ XCODE_EXPLICIT_FILE_TYPE
+ \ XCODE_FILE_ATTRIBUTES
+ \ XCODE_GENERATE_SCHEME
+ \ XCODE_LAST_KNOWN_FILE_TYPE
+ \ XCODE_LINK_BUILD_PHASE_MODE
+ \ XCODE_PRODUCT_TYPE
+ \ XCODE_SCHEME_ADDRESS_SANITIZER
+ \ XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN
+ \ XCODE_SCHEME_ARGUMENTS
+ \ XCODE_SCHEME_DEBUG_AS_ROOT
+ \ XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING
+ \ XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE
+ \ XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER
+ \ XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS
+ \ XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE
+ \ XCODE_SCHEME_ENABLE_GPU_API_VALIDATION
+ \ XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE
+ \ XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION
+ \ XCODE_SCHEME_ENVIRONMENT
+ \ XCODE_SCHEME_EXECUTABLE
+ \ XCODE_SCHEME_GUARD_MALLOC
+ \ XCODE_SCHEME_LAUNCH_CONFIGURATION
+ \ XCODE_SCHEME_LAUNCH_MODE
+ \ XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP
+ \ XCODE_SCHEME_MALLOC_GUARD_EDGES
+ \ XCODE_SCHEME_MALLOC_SCRIBBLE
+ \ XCODE_SCHEME_MALLOC_STACK
+ \ XCODE_SCHEME_THREAD_SANITIZER
+ \ XCODE_SCHEME_THREAD_SANITIZER_STOP
+ \ XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER
+ \ XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP
+ \ XCODE_SCHEME_ENABLE_GPU_API_VALIDATION
+ \ XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION
+ \ XCODE_SCHEME_LAUNCH_CONFIGURATION
+ \ XCODE_SCHEME_WORKING_DIRECTORY
+ \ XCODE_SCHEME_ZOMBIE_OBJECTS
+ \ XCODE_XCCONFIG
+ \ XCTEST
syn keyword cmakeVariable contained
- \ ANDROID APPLE BORLAND BUILD_SHARED_LIBS CMAKE_ABSOLUTE_DESTINATION_FILES CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS CMAKE_ANDROID_API CMAKE_ANDROID_API_MIN CMAKE_ANDROID_ARCH CMAKE_ANDROID_ARCH_ABI CMAKE_ANDROID_ARM_MODE CMAKE_ANDROID_ARM_NEON CMAKE_ANDROID_ASSETS_DIRECTORIES CMAKE_ANDROID_GUI CMAKE_ANDROID_JAR_DEPENDENCIES CMAKE_ANDROID_JAR_DIRECTORIES CMAKE_ANDROID_JAVA_SOURCE_DIR CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES CMAKE_ANDROID_NDK CMAKE_ANDROID_NDK_DEPRECATED_HEADERS CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION CMAKE_ANDROID_PROCESS_MAX CMAKE_ANDROID_PROGUARD CMAKE_ANDROID_PROGUARD_CONFIG_PATH CMAKE_ANDROID_SECURE_PROPS_PATH CMAKE_ANDROID_SKIP_ANT_STEP CMAKE_ANDROID_STANDALONE_TOOLCHAIN CMAKE_ANDROID_STL_TYPE CMAKE_APPBUNDLE_PATH CMAKE_AR CMAKE_ARCHIVE_OUTPUT_DIRECTORY CMAKE_ARGC CMAKE_ARGV0 CMAKE_AUTOMOC CMAKE_AUTOMOC_DEPEND_FILTERS CMAKE_AUTOMOC_MACRO_NAMES CMAKE_AUTOMOC_MOC_OPTIONS CMAKE_AUTOMOC_RELAXED_MODE CMAKE_AUTORCC CMAKE_AUTORCC_OPTIONS CMAKE_AUTOUIC CMAKE_AUTOUIC_OPTIONS CMAKE_AUTOUIC_SEARCH_PATHS CMAKE_BACKWARDS_COMPATIBILITY CMAKE_BINARY_DIR CMAKE_BUILD_RPATH CMAKE_BUILD_TOOL CMAKE_BUILD_TYPE CMAKE_BUILD_WITH_INSTALL_NAME_DIR CMAKE_BUILD_WITH_INSTALL_RPATH CMAKE_CACHEFILE_DIR CMAKE_CACHE_MAJOR_VERSION CMAKE_CACHE_MINOR_VERSION CMAKE_CACHE_PATCH_VERSION CMAKE_CFG_INTDIR CMAKE_CL_64 CMAKE_CODELITE_USE_TARGETS CMAKE_COLOR_MAKEFILE CMAKE_COMMAND CMAKE_COMPILER_2005 CMAKE_COMPILER_IS_GNUCC CMAKE_COMPILER_IS_GNUCXX CMAKE_COMPILER_IS_GNUG77 CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY CMAKE_CONFIGURATION_TYPES CMAKE_CROSSCOMPILING CMAKE_CROSSCOMPILING_EMULATOR CMAKE_CTEST_COMMAND CMAKE_CUDA_EXTENSIONS CMAKE_CUDA_STANDARD CMAKE_CUDA_STANDARD_REQUIRED CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES CMAKE_CURRENT_BINARY_DIR CMAKE_CURRENT_LIST_DIR CMAKE_CURRENT_LIST_FILE CMAKE_CURRENT_LIST_LINE CMAKE_CURRENT_SOURCE_DIR CMAKE_CXX_COMPILE_FEATURES CMAKE_CXX_EXTENSIONS CMAKE_CXX_STANDARD CMAKE_CXX_STANDARD_REQUIRED CMAKE_C_COMPILE_FEATURES CMAKE_C_EXTENSIONS CMAKE_C_STANDARD CMAKE_C_STANDARD_REQUIRED CMAKE_DEBUG_POSTFIX CMAKE_DEBUG_TARGET_PROPERTIES CMAKE_DEPENDS_IN_PROJECT_ONLY CMAKE_DIRECTORY_LABELS CMAKE_DL_LIBS CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT CMAKE_ECLIPSE_MAKE_ARGUMENTS CMAKE_ECLIPSE_VERSION CMAKE_EDIT_COMMAND CMAKE_ENABLE_EXPORTS CMAKE_ERROR_DEPRECATED CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION CMAKE_EXECUTABLE_SUFFIX CMAKE_EXE_LINKER_FLAGS CMAKE_EXE_LINKER_FLAGS_INIT CMAKE_EXPORT_COMPILE_COMMANDS CMAKE_EXPORT_NO_PACKAGE_REGISTRY CMAKE_EXTRA_GENERATOR CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES CMAKE_FIND_APPBUNDLE CMAKE_FIND_FRAMEWORK CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX CMAKE_FIND_LIBRARY_PREFIXES CMAKE_FIND_LIBRARY_SUFFIXES CMAKE_FIND_NO_INSTALL_PREFIX CMAKE_FIND_PACKAGE_NAME CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY CMAKE_FIND_PACKAGE_SORT_DIRECTION CMAKE_FIND_PACKAGE_SORT_ORDER CMAKE_FIND_PACKAGE_WARN_NO_MODULE CMAKE_FIND_ROOT_PATH CMAKE_FIND_ROOT_PATH_MODE_INCLUDE CMAKE_FIND_ROOT_PATH_MODE_LIBRARY CMAKE_FIND_ROOT_PATH_MODE_PACKAGE CMAKE_FIND_ROOT_PATH_MODE_PROGRAM CMAKE_FRAMEWORK_PATH CMAKE_Fortran_FORMAT CMAKE_Fortran_MODDIR_DEFAULT CMAKE_Fortran_MODDIR_FLAG CMAKE_Fortran_MODOUT_FLAG CMAKE_Fortran_MODULE_DIRECTORY CMAKE_GENERATOR CMAKE_GENERATOR_PLATFORM CMAKE_GENERATOR_TOOLSET CMAKE_GNUtoMS CMAKE_HOME_DIRECTORY CMAKE_HOST_APPLE CMAKE_HOST_SOLARIS CMAKE_HOST_SYSTEM CMAKE_HOST_SYSTEM_NAME CMAKE_HOST_SYSTEM_PROCESSOR CMAKE_HOST_SYSTEM_VERSION CMAKE_HOST_UNIX CMAKE_HOST_WIN32 CMAKE_IGNORE_PATH CMAKE_IMPORT_LIBRARY_PREFIX CMAKE_IMPORT_LIBRARY_SUFFIX CMAKE_INCLUDE_CURRENT_DIR CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE CMAKE_INCLUDE_DIRECTORIES_BEFORE CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE CMAKE_INCLUDE_PATH CMAKE_INSTALL_DEFAULT_COMPONENT_NAME CMAKE_INSTALL_MESSAGE CMAKE_INSTALL_NAME_DIR CMAKE_INSTALL_PREFIX CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT CMAKE_INSTALL_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH CMAKE_INTERNAL_PLATFORM_ABI CMAKE_INTERPROCEDURAL_OPTIMIZATION CMAKE_IOS_INSTALL_COMBINED CMAKE_JOB_POOL_COMPILE CMAKE_JOB_POOL_LINK CMAKE_LIBRARY_ARCHITECTURE CMAKE_LIBRARY_ARCHITECTURE_REGEX CMAKE_LIBRARY_OUTPUT_DIRECTORY CMAKE_LIBRARY_PATH CMAKE_LIBRARY_PATH_FLAG CMAKE_LINK_DEF_FILE_FLAG CMAKE_LINK_DEPENDS_NO_SHARED CMAKE_LINK_INTERFACE_LIBRARIES CMAKE_LINK_LIBRARY_FILE_FLAG CMAKE_LINK_LIBRARY_FLAG CMAKE_LINK_LIBRARY_SUFFIX CMAKE_LINK_SEARCH_END_STATIC CMAKE_LINK_SEARCH_START_STATIC CMAKE_LINK_WHAT_YOU_USE CMAKE_MACOSX_BUNDLE CMAKE_MACOSX_RPATH CMAKE_MAJOR_VERSION CMAKE_MAKE_PROGRAM CMAKE_MATCH_COUNT CMAKE_MFC_FLAG CMAKE_MINIMUM_REQUIRED_VERSION CMAKE_MINOR_VERSION CMAKE_MODULE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS_INIT CMAKE_MODULE_PATH CMAKE_MSVCIDE_RUN_PATH CMAKE_NINJA_OUTPUT_PATH_PREFIX CMAKE_NOT_USING_CONFIG_FLAGS CMAKE_NO_BUILTIN_CHRPATH CMAKE_NO_SYSTEM_FROM_IMPORTED CMAKE_OBJECT_PATH_MAX CMAKE_OSX_ARCHITECTURES CMAKE_OSX_DEPLOYMENT_TARGET CMAKE_OSX_SYSROOT CMAKE_PARENT_LIST_FILE CMAKE_PATCH_VERSION CMAKE_PDB_OUTPUT_DIRECTORY CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH CMAKE_PROGRAM_PATH CMAKE_PROJECT_DESCRIPTION CMAKE_PROJECT_NAME CMAKE_RANLIB CMAKE_ROOT CMAKE_RUNTIME_OUTPUT_DIRECTORY CMAKE_SCRIPT_MODE_FILE CMAKE_SHARED_LIBRARY_PREFIX CMAKE_SHARED_LIBRARY_SUFFIX CMAKE_SHARED_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS_INIT CMAKE_SHARED_MODULE_PREFIX CMAKE_SHARED_MODULE_SUFFIX CMAKE_SIZEOF_VOID_P CMAKE_SKIP_BUILD_RPATH CMAKE_SKIP_INSTALL_ALL_DEPENDENCY CMAKE_SKIP_INSTALL_RPATH CMAKE_SKIP_INSTALL_RULES CMAKE_SKIP_RPATH CMAKE_SOURCE_DIR CMAKE_STAGING_PREFIX CMAKE_STATIC_LIBRARY_PREFIX CMAKE_STATIC_LIBRARY_SUFFIX CMAKE_STATIC_LINKER_FLAGS CMAKE_STATIC_LINKER_FLAGS_INIT CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE CMAKE_SYSROOT CMAKE_SYSROOT_COMPILE CMAKE_SYSROOT_LINK CMAKE_SYSTEM CMAKE_SYSTEM_APPBUNDLE_PATH CMAKE_SYSTEM_FRAMEWORK_PATH CMAKE_SYSTEM_IGNORE_PATH CMAKE_SYSTEM_INCLUDE_PATH CMAKE_SYSTEM_LIBRARY_PATH CMAKE_SYSTEM_NAME CMAKE_SYSTEM_PREFIX_PATH CMAKE_SYSTEM_PROCESSOR CMAKE_SYSTEM_PROGRAM_PATH CMAKE_SYSTEM_VERSION CMAKE_Swift_LANGUAGE_VERSION CMAKE_TOOLCHAIN_FILE CMAKE_TRY_COMPILE_CONFIGURATION CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_TRY_COMPILE_TARGET_TYPE CMAKE_TWEAK_VERSION CMAKE_USER_MAKE_RULES_OVERRIDE CMAKE_USE_RELATIVE_PATHS CMAKE_VERBOSE_MAKEFILE CMAKE_VERSION CMAKE_VISIBILITY_INLINES_HIDDEN CMAKE_VS_DEVENV_COMMAND CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD CMAKE_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD CMAKE_VS_INTEL_Fortran_PROJECT_VERSION CMAKE_VS_MSBUILD_COMMAND CMAKE_VS_NsightTegra_VERSION CMAKE_VS_PLATFORM_NAME CMAKE_VS_PLATFORM_TOOLSET CMAKE_VS_PLATFORM_TOOLSET_CUDA CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION CMAKE_WARN_DEPRECATED CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION CMAKE_WIN32_EXECUTABLE CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS CMAKE_XCODE_GENERATE_SCHEME CMAKE_XCODE_PLATFORM_TOOLSET CPACK_ABSOLUTE_DESTINATION_FILES CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION CPACK_INCLUDE_TOPLEVEL_DIRECTORY CPACK_INSTALL_SCRIPT CPACK_PACKAGING_INSTALL_PREFIX CPACK_SET_DESTDIR CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION CTEST_BINARY_DIRECTORY CTEST_BUILD_COMMAND CTEST_BUILD_NAME CTEST_BZR_COMMAND CTEST_BZR_UPDATE_OPTIONS CTEST_CHANGE_ID CTEST_CHECKOUT_COMMAND CTEST_CONFIGURATION_TYPE CTEST_CONFIGURE_COMMAND CTEST_COVERAGE_COMMAND CTEST_COVERAGE_EXTRA_FLAGS CTEST_CURL_OPTIONS CTEST_CUSTOM_COVERAGE_EXCLUDE CTEST_CUSTOM_ERROR_EXCEPTION CTEST_CUSTOM_ERROR_MATCH CTEST_CUSTOM_ERROR_POST_CONTEXT CTEST_CUSTOM_ERROR_PRE_CONTEXT CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE CTEST_CUSTOM_MEMCHECK_IGNORE CTEST_CUSTOM_POST_MEMCHECK CTEST_CUSTOM_POST_TEST CTEST_CUSTOM_PRE_MEMCHECK CTEST_CUSTOM_PRE_TEST CTEST_CUSTOM_TEST_IGNORE CTEST_CUSTOM_WARNING_EXCEPTION CTEST_CUSTOM_WARNING_MATCH CTEST_CVS_CHECKOUT CTEST_CVS_COMMAND CTEST_CVS_UPDATE_OPTIONS CTEST_DROP_LOCATION CTEST_DROP_METHOD CTEST_DROP_SITE CTEST_DROP_SITE_CDASH CTEST_DROP_SITE_PASSWORD CTEST_DROP_SITE_USER CTEST_EXTRA_COVERAGE_GLOB CTEST_GIT_COMMAND CTEST_GIT_INIT_SUBMODULES CTEST_GIT_UPDATE_CUSTOM CTEST_GIT_UPDATE_OPTIONS CTEST_HG_COMMAND CTEST_HG_UPDATE_OPTIONS CTEST_LABELS_FOR_SUBPROJECTS CTEST_MEMORYCHECK_COMMAND CTEST_MEMORYCHECK_COMMAND_OPTIONS CTEST_MEMORYCHECK_SANITIZER_OPTIONS CTEST_MEMORYCHECK_SUPPRESSIONS_FILE CTEST_MEMORYCHECK_TYPE CTEST_NIGHTLY_START_TIME CTEST_P4_CLIENT CTEST_P4_COMMAND CTEST_P4_OPTIONS CTEST_P4_UPDATE_OPTIONS CTEST_SCP_COMMAND CTEST_SITE CTEST_SOURCE_DIRECTORY CTEST_SVN_COMMAND CTEST_SVN_OPTIONS CTEST_SVN_UPDATE_OPTIONS CTEST_TEST_LOAD CTEST_TEST_TIMEOUT CTEST_TRIGGER_SITE CTEST_UPDATE_COMMAND CTEST_UPDATE_OPTIONS CTEST_UPDATE_VERSION_ONLY CTEST_USE_LAUNCHERS CYGWIN ENV EXECUTABLE_OUTPUT_PATH GHS-MULTI LIBRARY_OUTPUT_PATH MINGW MSVC MSVC10 MSVC11 MSVC12 MSVC14 MSVC60 MSVC70 MSVC71 MSVC80 MSVC90 MSVC_IDE MSVC_VERSION PROJECT_BINARY_DIR PROJECT_DESCRIPTION PROJECT_NAME PROJECT_SOURCE_DIR PROJECT_VERSION PROJECT_VERSION_MAJOR PROJECT_VERSION_MINOR PROJECT_VERSION_PATCH PROJECT_VERSION_TWEAK UNIX WIN32 WINCE WINDOWS_PHONE WINDOWS_STORE XCODE XCODE_VERSION
+ \ ANDROID
+ \ APPLE
+ \ BORLAND
+ \ BSD
+ \ BUILD_SHARED_LIBS
+ \ CACHE
+ \ CMAKE_ABSOLUTE_DESTINATION_FILES
+ \ CMAKE_ADD_CUSTOM_COMMAND_DEPENDS_EXPLICIT_ONLY
+ \ CMAKE_ADSP_ROOT
+ \ CMAKE_AIX_EXPORT_ALL_SYMBOLS
+ \ CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS
+ \ CMAKE_ANDROID_API
+ \ CMAKE_ANDROID_API_MIN
+ \ CMAKE_ANDROID_ARCH
+ \ CMAKE_ANDROID_ARCH_ABI
+ \ CMAKE_ANDROID_ARM_MODE
+ \ CMAKE_ANDROID_ARM_NEON
+ \ CMAKE_ANDROID_ASSETS_DIRECTORIES
+ \ CMAKE_ANDROID_EXCEPTIONS
+ \ CMAKE_ANDROID_GUI
+ \ CMAKE_ANDROID_JAR_DEPENDENCIES
+ \ CMAKE_ANDROID_JAR_DIRECTORIES
+ \ CMAKE_ANDROID_JAVA_SOURCE_DIR
+ \ CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES
+ \ CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES
+ \ CMAKE_ANDROID_NDK
+ \ CMAKE_ANDROID_NDK_DEPRECATED_HEADERS
+ \ CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG
+ \ CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION
+ \ CMAKE_ANDROID_NDK_VERSION
+ \ CMAKE_ANDROID_PROCESS_MAX
+ \ CMAKE_ANDROID_PROGUARD
+ \ CMAKE_ANDROID_PROGUARD_CONFIG_PATH
+ \ CMAKE_ANDROID_RTTI
+ \ CMAKE_ANDROID_SECURE_PROPS_PATH
+ \ CMAKE_ANDROID_SKIP_ANT_STEP
+ \ CMAKE_ANDROID_STANDALONE_TOOLCHAIN
+ \ CMAKE_ANDROID_STL_TYPE
+ \ CMAKE_APPBUNDLE_PATH
+ \ CMAKE_APPLE_SILICON_PROCESSOR
+ \ CMAKE_AR
+ \ CMAKE_ARCHIVE_OUTPUT_DIRECTORY
+ \ CMAKE_ARGC
+ \ CMAKE_ARGV0
+ \ CMAKE_ASM
+ \ CMAKE_ASM_ANDROID_TOOLCHAIN_MACHINE
+ \ CMAKE_ASM_ANDROID_TOOLCHAIN_PREFIX
+ \ CMAKE_ASM_ANDROID_TOOLCHAIN_SUFFIX
+ \ CMAKE_ASM_ARCHIVE_APPEND
+ \ CMAKE_ASM_ARCHIVE_CREATE
+ \ CMAKE_ASM_ARCHIVE_FINISH
+ \ CMAKE_ASM_BYTE_ORDER
+ \ CMAKE_ASM_CLANG_TIDY
+ \ CMAKE_ASM_CLANG_TIDY_EXPORT_FIXES_DIR
+ \ CMAKE_ASM_COMPILER
+ \ CMAKE_ASM_COMPILER_ABI
+ \ CMAKE_ASM_COMPILER_AR
+ \ CMAKE_ASM_COMPILER_ARCHITECTURE_ID
+ \ CMAKE_ASM_COMPILER_EXTERNAL_TOOLCHAIN
+ \ CMAKE_ASM_COMPILER_FRONTEND_VARIANT
+ \ CMAKE_ASM_COMPILER_ID
+ \ CMAKE_ASM_COMPILER_LAUNCHER
+ \ CMAKE_ASM_COMPILER_LOADED
+ \ CMAKE_ASM_COMPILER_PREDEFINES_COMMAND
+ \ CMAKE_ASM_COMPILER_RANLIB
+ \ CMAKE_ASM_COMPILER_TARGET
+ \ CMAKE_ASM_COMPILER_VERSION
+ \ CMAKE_ASM_COMPILER_VERSION_INTERNAL
+ \ CMAKE_ASM_COMPILE_OBJECT
+ \ CMAKE_ASM_CPPCHECK
+ \ CMAKE_ASM_CPPLINT
+ \ CMAKE_ASM_CREATE_SHARED_LIBRARY
+ \ CMAKE_ASM_CREATE_SHARED_MODULE
+ \ CMAKE_ASM_CREATE_STATIC_LIBRARY
+ \ CMAKE_ASM_EXTENSIONS
+ \ CMAKE_ASM_EXTENSIONS_DEFAULT
+ \ CMAKE_ASM_FLAGS
+ \ CMAKE_ASM_FLAGS_DEBUG
+ \ CMAKE_ASM_FLAGS_DEBUG_INIT
+ \ CMAKE_ASM_FLAGS_INIT
+ \ CMAKE_ASM_FLAGS_MINSIZEREL
+ \ CMAKE_ASM_FLAGS_MINSIZEREL_INIT
+ \ CMAKE_ASM_FLAGS_RELEASE
+ \ CMAKE_ASM_FLAGS_RELEASE_INIT
+ \ CMAKE_ASM_FLAGS_RELWITHDEBINFO
+ \ CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT
+ \ CMAKE_ASM_IGNORE_EXTENSIONS
+ \ CMAKE_ASM_IMPLICIT_INCLUDE_DIRECTORIES
+ \ CMAKE_ASM_IMPLICIT_LINK_DIRECTORIES
+ \ CMAKE_ASM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
+ \ CMAKE_ASM_IMPLICIT_LINK_LIBRARIES
+ \ CMAKE_ASM_INCLUDE_WHAT_YOU_USE
+ \ CMAKE_ASM_INIT
+ \ CMAKE_ASM_LIBRARY_ARCHITECTURE
+ \ CMAKE_ASM_LINKER_LAUNCHER
+ \ CMAKE_ASM_LINKER_PREFERENCE
+ \ CMAKE_ASM_LINKER_PREFERENCE_PROPAGATES
+ \ CMAKE_ASM_LINKER_WRAPPER_FLAG
+ \ CMAKE_ASM_LINKER_WRAPPER_FLAG_SEP
+ \ CMAKE_ASM_LINK_EXECUTABLE
+ \ CMAKE_ASM_LINK_LIBRARY_FILE_FLAG
+ \ CMAKE_ASM_LINK_LIBRARY_FLAG
+ \ CMAKE_ASM_LINK_LIBRARY_SUFFIX
+ \ CMAKE_ASM_LINK_WHAT_YOU_USE_FLAG
+ \ CMAKE_ASM_MASM
+ \ CMAKE_ASM_MASM_ANDROID_TOOLCHAIN_MACHINE
+ \ CMAKE_ASM_MASM_ANDROID_TOOLCHAIN_PREFIX
+ \ CMAKE_ASM_MASM_ANDROID_TOOLCHAIN_SUFFIX
+ \ CMAKE_ASM_MASM_ARCHIVE_APPEND
+ \ CMAKE_ASM_MASM_ARCHIVE_CREATE
+ \ CMAKE_ASM_MASM_ARCHIVE_FINISH
+ \ CMAKE_ASM_MASM_BYTE_ORDER
+ \ CMAKE_ASM_MASM_CLANG_TIDY
+ \ CMAKE_ASM_MASM_CLANG_TIDY_EXPORT_FIXES_DIR
+ \ CMAKE_ASM_MASM_COMPILER
+ \ CMAKE_ASM_MASM_COMPILER_ABI
+ \ CMAKE_ASM_MASM_COMPILER_AR
+ \ CMAKE_ASM_MASM_COMPILER_ARCHITECTURE_ID
+ \ CMAKE_ASM_MASM_COMPILER_EXTERNAL_TOOLCHAIN
+ \ CMAKE_ASM_MASM_COMPILER_FRONTEND_VARIANT
+ \ CMAKE_ASM_MASM_COMPILER_ID
+ \ CMAKE_ASM_MASM_COMPILER_LAUNCHER
+ \ CMAKE_ASM_MASM_COMPILER_LOADED
+ \ CMAKE_ASM_MASM_COMPILER_PREDEFINES_COMMAND
+ \ CMAKE_ASM_MASM_COMPILER_RANLIB
+ \ CMAKE_ASM_MASM_COMPILER_TARGET
+ \ CMAKE_ASM_MASM_COMPILER_VERSION
+ \ CMAKE_ASM_MASM_COMPILER_VERSION_INTERNAL
+ \ CMAKE_ASM_MASM_COMPILE_OBJECT
+ \ CMAKE_ASM_MASM_CPPCHECK
+ \ CMAKE_ASM_MASM_CPPLINT
+ \ CMAKE_ASM_MASM_CREATE_SHARED_LIBRARY
+ \ CMAKE_ASM_MASM_CREATE_SHARED_MODULE
+ \ CMAKE_ASM_MASM_CREATE_STATIC_LIBRARY
+ \ CMAKE_ASM_MASM_EXTENSIONS
+ \ CMAKE_ASM_MASM_EXTENSIONS_DEFAULT
+ \ CMAKE_ASM_MASM_FLAGS
+ \ CMAKE_ASM_MASM_FLAGS_DEBUG
+ \ CMAKE_ASM_MASM_FLAGS_DEBUG_INIT
+ \ CMAKE_ASM_MASM_FLAGS_INIT
+ \ CMAKE_ASM_MASM_FLAGS_MINSIZEREL
+ \ CMAKE_ASM_MASM_FLAGS_MINSIZEREL_INIT
+ \ CMAKE_ASM_MASM_FLAGS_RELEASE
+ \ CMAKE_ASM_MASM_FLAGS_RELEASE_INIT
+ \ CMAKE_ASM_MASM_FLAGS_RELWITHDEBINFO
+ \ CMAKE_ASM_MASM_FLAGS_RELWITHDEBINFO_INIT
+ \ CMAKE_ASM_MASM_IGNORE_EXTENSIONS
+ \ CMAKE_ASM_MASM_IMPLICIT_INCLUDE_DIRECTORIES
+ \ CMAKE_ASM_MASM_IMPLICIT_LINK_DIRECTORIES
+ \ CMAKE_ASM_MASM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
+ \ CMAKE_ASM_MASM_IMPLICIT_LINK_LIBRARIES
+ \ CMAKE_ASM_MASM_INCLUDE_WHAT_YOU_USE
+ \ CMAKE_ASM_MASM_INIT
+ \ CMAKE_ASM_MASM_LIBRARY_ARCHITECTURE
+ \ CMAKE_ASM_MASM_LINKER_LAUNCHER
+ \ CMAKE_ASM_MASM_LINKER_PREFERENCE
+ \ CMAKE_ASM_MASM_LINKER_PREFERENCE_PROPAGATES
+ \ CMAKE_ASM_MASM_LINKER_WRAPPER_FLAG
+ \ CMAKE_ASM_MASM_LINKER_WRAPPER_FLAG_SEP
+ \ CMAKE_ASM_MASM_LINK_EXECUTABLE
+ \ CMAKE_ASM_MASM_LINK_LIBRARY_FILE_FLAG
+ \ CMAKE_ASM_MASM_LINK_LIBRARY_FLAG
+ \ CMAKE_ASM_MASM_LINK_LIBRARY_SUFFIX
+ \ CMAKE_ASM_MASM_LINK_WHAT_YOU_USE_FLAG
+ \ CMAKE_ASM_MASM_OUTPUT_EXTENSION
+ \ CMAKE_ASM_MASM_PLATFORM_ID
+ \ CMAKE_ASM_MASM_SIMULATE_ID
+ \ CMAKE_ASM_MASM_SIMULATE_VERSION
+ \ CMAKE_ASM_MASM_SIZEOF_DATA_PTR
+ \ CMAKE_ASM_MASM_SOURCE_FILE_EXTENSIONS
+ \ CMAKE_ASM_MASM_STANDARD
+ \ CMAKE_ASM_MASM_STANDARD_DEFAULT
+ \ CMAKE_ASM_MASM_STANDARD_INCLUDE_DIRECTORIES
+ \ CMAKE_ASM_MASM_STANDARD_LIBRARIES
+ \ CMAKE_ASM_MASM_STANDARD_REQUIRED
+ \ CMAKE_ASM_MASM_SUPPORTED
+ \ CMAKE_ASM_MASM_VISIBILITY_PRESET
+ \ CMAKE_ASM_NASM
+ \ CMAKE_ASM_NASM_ANDROID_TOOLCHAIN_MACHINE
+ \ CMAKE_ASM_NASM_ANDROID_TOOLCHAIN_PREFIX
+ \ CMAKE_ASM_NASM_ANDROID_TOOLCHAIN_SUFFIX
+ \ CMAKE_ASM_NASM_ARCHIVE_APPEND
+ \ CMAKE_ASM_NASM_ARCHIVE_CREATE
+ \ CMAKE_ASM_NASM_ARCHIVE_FINISH
+ \ CMAKE_ASM_NASM_BYTE_ORDER
+ \ CMAKE_ASM_NASM_CLANG_TIDY
+ \ CMAKE_ASM_NASM_CLANG_TIDY_EXPORT_FIXES_DIR
+ \ CMAKE_ASM_NASM_COMPILER
+ \ CMAKE_ASM_NASM_COMPILER_ABI
+ \ CMAKE_ASM_NASM_COMPILER_AR
+ \ CMAKE_ASM_NASM_COMPILER_ARCHITECTURE_ID
+ \ CMAKE_ASM_NASM_COMPILER_EXTERNAL_TOOLCHAIN
+ \ CMAKE_ASM_NASM_COMPILER_FRONTEND_VARIANT
+ \ CMAKE_ASM_NASM_COMPILER_ID
+ \ CMAKE_ASM_NASM_COMPILER_LAUNCHER
+ \ CMAKE_ASM_NASM_COMPILER_LOADED
+ \ CMAKE_ASM_NASM_COMPILER_PREDEFINES_COMMAND
+ \ CMAKE_ASM_NASM_COMPILER_RANLIB
+ \ CMAKE_ASM_NASM_COMPILER_TARGET
+ \ CMAKE_ASM_NASM_COMPILER_VERSION
+ \ CMAKE_ASM_NASM_COMPILER_VERSION_INTERNAL
+ \ CMAKE_ASM_NASM_COMPILE_OBJECT
+ \ CMAKE_ASM_NASM_CPPCHECK
+ \ CMAKE_ASM_NASM_CPPLINT
+ \ CMAKE_ASM_NASM_CREATE_SHARED_LIBRARY
+ \ CMAKE_ASM_NASM_CREATE_SHARED_MODULE
+ \ CMAKE_ASM_NASM_CREATE_STATIC_LIBRARY
+ \ CMAKE_ASM_NASM_EXTENSIONS
+ \ CMAKE_ASM_NASM_EXTENSIONS_DEFAULT
+ \ CMAKE_ASM_NASM_FLAGS
+ \ CMAKE_ASM_NASM_FLAGS_DEBUG
+ \ CMAKE_ASM_NASM_FLAGS_DEBUG_INIT
+ \ CMAKE_ASM_NASM_FLAGS_INIT
+ \ CMAKE_ASM_NASM_FLAGS_MINSIZEREL
+ \ CMAKE_ASM_NASM_FLAGS_MINSIZEREL_INIT
+ \ CMAKE_ASM_NASM_FLAGS_RELEASE
+ \ CMAKE_ASM_NASM_FLAGS_RELEASE_INIT
+ \ CMAKE_ASM_NASM_FLAGS_RELWITHDEBINFO
+ \ CMAKE_ASM_NASM_FLAGS_RELWITHDEBINFO_INIT
+ \ CMAKE_ASM_NASM_IGNORE_EXTENSIONS
+ \ CMAKE_ASM_NASM_IMPLICIT_INCLUDE_DIRECTORIES
+ \ CMAKE_ASM_NASM_IMPLICIT_LINK_DIRECTORIES
+ \ CMAKE_ASM_NASM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
+ \ CMAKE_ASM_NASM_IMPLICIT_LINK_LIBRARIES
+ \ CMAKE_ASM_NASM_INCLUDE_WHAT_YOU_USE
+ \ CMAKE_ASM_NASM_INIT
+ \ CMAKE_ASM_NASM_LIBRARY_ARCHITECTURE
+ \ CMAKE_ASM_NASM_LINKER_LAUNCHER
+ \ CMAKE_ASM_NASM_LINKER_PREFERENCE
+ \ CMAKE_ASM_NASM_LINKER_PREFERENCE_PROPAGATES
+ \ CMAKE_ASM_NASM_LINKER_WRAPPER_FLAG
+ \ CMAKE_ASM_NASM_LINKER_WRAPPER_FLAG_SEP
+ \ CMAKE_ASM_NASM_LINK_EXECUTABLE
+ \ CMAKE_ASM_NASM_LINK_LIBRARY_FILE_FLAG
+ \ CMAKE_ASM_NASM_LINK_LIBRARY_FLAG
+ \ CMAKE_ASM_NASM_LINK_LIBRARY_SUFFIX
+ \ CMAKE_ASM_NASM_LINK_WHAT_YOU_USE_FLAG
+ \ CMAKE_ASM_NASM_OUTPUT_EXTENSION
+ \ CMAKE_ASM_NASM_PLATFORM_ID
+ \ CMAKE_ASM_NASM_SIMULATE_ID
+ \ CMAKE_ASM_NASM_SIMULATE_VERSION
+ \ CMAKE_ASM_NASM_SIZEOF_DATA_PTR
+ \ CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS
+ \ CMAKE_ASM_NASM_STANDARD
+ \ CMAKE_ASM_NASM_STANDARD_DEFAULT
+ \ CMAKE_ASM_NASM_STANDARD_INCLUDE_DIRECTORIES
+ \ CMAKE_ASM_NASM_STANDARD_LIBRARIES
+ \ CMAKE_ASM_NASM_STANDARD_REQUIRED
+ \ CMAKE_ASM_NASM_SUPPORTED
+ \ CMAKE_ASM_NASM_VISIBILITY_PRESET
+ \ CMAKE_ASM_OUTPUT_EXTENSION
+ \ CMAKE_ASM_PLATFORM_ID
+ \ CMAKE_ASM_SIMULATE_ID
+ \ CMAKE_ASM_SIMULATE_VERSION
+ \ CMAKE_ASM_SIZEOF_DATA_PTR
+ \ CMAKE_ASM_SOURCE_FILE_EXTENSIONS
+ \ CMAKE_ASM_STANDARD
+ \ CMAKE_ASM_STANDARD_DEFAULT
+ \ CMAKE_ASM_STANDARD_INCLUDE_DIRECTORIES
+ \ CMAKE_ASM_STANDARD_LIBRARIES
+ \ CMAKE_ASM_STANDARD_REQUIRED
+ \ CMAKE_ASM_SUPPORTED
+ \ CMAKE_ASM_VISIBILITY_PRESET
+ \ CMAKE_AUTOGEN_COMMAND_LINE_LENGTH_MAX
+ \ CMAKE_AUTOGEN_ORIGIN_DEPENDS
+ \ CMAKE_AUTOGEN_PARALLEL
+ \ CMAKE_AUTOGEN_USE_SYSTEM_INCLUDE
+ \ CMAKE_AUTOGEN_VERBOSE
+ \ CMAKE_AUTOMOC
+ \ CMAKE_AUTOMOC_COMPILER_PREDEFINES
+ \ CMAKE_AUTOMOC_DEPEND_FILTERS
+ \ CMAKE_AUTOMOC_EXECUTABLE
+ \ CMAKE_AUTOMOC_MACRO_NAMES
+ \ CMAKE_AUTOMOC_MOC_OPTIONS
+ \ CMAKE_AUTOMOC_PATH_PREFIX
+ \ CMAKE_AUTOMOC_RELAXED_MODE
+ \ CMAKE_AUTOMOC_EXECUTABLE
+ \ CMAKE_AUTORCC
+ \ CMAKE_AUTORCC_EXECUTABLE
+ \ CMAKE_AUTORCC_OPTIONS
+ \ CMAKE_AUTORCC_EXECUTABLE
+ \ CMAKE_AUTOUIC
+ \ CMAKE_AUTOUIC_EXECUTABLE
+ \ CMAKE_AUTOUIC_OPTIONS
+ \ CMAKE_AUTOUIC_SEARCH_PATHS
+ \ CMAKE_AUTOUIC_EXECUTABLE
+ \ CMAKE_BACKWARDS_COMPATIBILITY
+ \ CMAKE_BINARY_DIR
+ \ CMAKE_BUILD_RPATH
+ \ CMAKE_BUILD_RPATH_USE_ORIGIN
+ \ CMAKE_BUILD_TOOL
+ \ CMAKE_BUILD_TYPE
+ \ CMAKE_BUILD_WITH_INSTALL_NAME_DIR
+ \ CMAKE_BUILD_WITH_INSTALL_RPATH
+ \ CMAKE_C
+ \ CMAKE_CACHEFILE_DIR
+ \ CMAKE_CACHE_MAJOR_VERSION
+ \ CMAKE_CACHE_MINOR_VERSION
+ \ CMAKE_CACHE_PATCH_VERSION
+ \ CMAKE_CFG_INTDIR
+ \ CMAKE_CLANG_VFS_OVERLAY
+ \ CMAKE_CL_64
+ \ CMAKE_CODEBLOCKS_COMPILER_ID
+ \ CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES
+ \ CMAKE_CODELITE_USE_TARGETS
+ \ CMAKE_COLOR_DIAGNOSTICS
+ \ CMAKE_COLOR_MAKEFILE
+ \ CMAKE_COMMAND
+ \ CMAKE_COMPILER_2005
+ \ CMAKE_COMPILER_IS_GNUCC
+ \ CMAKE_COMPILER_IS_GNUCXX
+ \ CMAKE_COMPILER_IS_GNUG77
+ \ CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY
+ \ CMAKE_COMPILE_WARNING_AS_ERROR
+ \ CMAKE_CONFIGURATION_TYPES
+ \ CMAKE_CPACK_COMMAND
+ \ CMAKE_CROSSCOMPILING
+ \ CMAKE_CROSSCOMPILING_EMULATOR
+ \ CMAKE_CROSS_CONFIGS
+ \ CMAKE_CSharp
+ \ CMAKE_CSharp_ANDROID_TOOLCHAIN_MACHINE
+ \ CMAKE_CSharp_ANDROID_TOOLCHAIN_PREFIX
+ \ CMAKE_CSharp_ANDROID_TOOLCHAIN_SUFFIX
+ \ CMAKE_CSharp_ARCHIVE_APPEND
+ \ CMAKE_CSharp_ARCHIVE_CREATE
+ \ CMAKE_CSharp_ARCHIVE_FINISH
+ \ CMAKE_CSharp_BYTE_ORDER
+ \ CMAKE_CSharp_CLANG_TIDY
+ \ CMAKE_CSharp_CLANG_TIDY_EXPORT_FIXES_DIR
+ \ CMAKE_CSharp_COMPILER
+ \ CMAKE_CSharp_COMPILER_ABI
+ \ CMAKE_CSharp_COMPILER_AR
+ \ CMAKE_CSharp_COMPILER_ARCHITECTURE_ID
+ \ CMAKE_CSharp_COMPILER_EXTERNAL_TOOLCHAIN
+ \ CMAKE_CSharp_COMPILER_FRONTEND_VARIANT
+ \ CMAKE_CSharp_COMPILER_ID
+ \ CMAKE_CSharp_COMPILER_LAUNCHER
+ \ CMAKE_CSharp_COMPILER_LOADED
+ \ CMAKE_CSharp_COMPILER_PREDEFINES_COMMAND
+ \ CMAKE_CSharp_COMPILER_RANLIB
+ \ CMAKE_CSharp_COMPILER_TARGET
+ \ CMAKE_CSharp_COMPILER_VERSION
+ \ CMAKE_CSharp_COMPILER_VERSION_INTERNAL
+ \ CMAKE_CSharp_COMPILE_OBJECT
+ \ CMAKE_CSharp_CPPCHECK
+ \ CMAKE_CSharp_CPPLINT
+ \ CMAKE_CSharp_CREATE_SHARED_LIBRARY
+ \ CMAKE_CSharp_CREATE_SHARED_MODULE
+ \ CMAKE_CSharp_CREATE_STATIC_LIBRARY
+ \ CMAKE_CSharp_EXTENSIONS
+ \ CMAKE_CSharp_EXTENSIONS_DEFAULT
+ \ CMAKE_CSharp_FLAGS
+ \ CMAKE_CSharp_FLAGS_DEBUG
+ \ CMAKE_CSharp_FLAGS_DEBUG_INIT
+ \ CMAKE_CSharp_FLAGS_INIT
+ \ CMAKE_CSharp_FLAGS_MINSIZEREL
+ \ CMAKE_CSharp_FLAGS_MINSIZEREL_INIT
+ \ CMAKE_CSharp_FLAGS_RELEASE
+ \ CMAKE_CSharp_FLAGS_RELEASE_INIT
+ \ CMAKE_CSharp_FLAGS_RELWITHDEBINFO
+ \ CMAKE_CSharp_FLAGS_RELWITHDEBINFO_INIT
+ \ CMAKE_CSharp_IGNORE_EXTENSIONS
+ \ CMAKE_CSharp_IMPLICIT_INCLUDE_DIRECTORIES
+ \ CMAKE_CSharp_IMPLICIT_LINK_DIRECTORIES
+ \ CMAKE_CSharp_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
+ \ CMAKE_CSharp_IMPLICIT_LINK_LIBRARIES
+ \ CMAKE_CSharp_INCLUDE_WHAT_YOU_USE
+ \ CMAKE_CSharp_INIT
+ \ CMAKE_CSharp_LIBRARY_ARCHITECTURE
+ \ CMAKE_CSharp_LINKER_LAUNCHER
+ \ CMAKE_CSharp_LINKER_PREFERENCE
+ \ CMAKE_CSharp_LINKER_PREFERENCE_PROPAGATES
+ \ CMAKE_CSharp_LINKER_WRAPPER_FLAG
+ \ CMAKE_CSharp_LINKER_WRAPPER_FLAG_SEP
+ \ CMAKE_CSharp_LINK_EXECUTABLE
+ \ CMAKE_CSharp_LINK_LIBRARY_FILE_FLAG
+ \ CMAKE_CSharp_LINK_LIBRARY_FLAG
+ \ CMAKE_CSharp_LINK_LIBRARY_SUFFIX
+ \ CMAKE_CSharp_LINK_WHAT_YOU_USE_FLAG
+ \ CMAKE_CSharp_OUTPUT_EXTENSION
+ \ CMAKE_CSharp_PLATFORM_ID
+ \ CMAKE_CSharp_SIMULATE_ID
+ \ CMAKE_CSharp_SIMULATE_VERSION
+ \ CMAKE_CSharp_SIZEOF_DATA_PTR
+ \ CMAKE_CSharp_SOURCE_FILE_EXTENSIONS
+ \ CMAKE_CSharp_STANDARD
+ \ CMAKE_CSharp_STANDARD_DEFAULT
+ \ CMAKE_CSharp_STANDARD_INCLUDE_DIRECTORIES
+ \ CMAKE_CSharp_STANDARD_LIBRARIES
+ \ CMAKE_CSharp_STANDARD_REQUIRED
+ \ CMAKE_CSharp_SUPPORTED
+ \ CMAKE_CSharp_VISIBILITY_PRESET
+ \ CMAKE_CTEST_ARGUMENTS
+ \ CMAKE_CTEST_COMMAND
+ \ CMAKE_CUDA
+ \ CMAKE_CUDA_ANDROID_TOOLCHAIN_MACHINE
+ \ CMAKE_CUDA_ANDROID_TOOLCHAIN_PREFIX
+ \ CMAKE_CUDA_ANDROID_TOOLCHAIN_SUFFIX
+ \ CMAKE_CUDA_ARCHITECTURES
+ \ CMAKE_CUDA_ARCHIVE_APPEND
+ \ CMAKE_CUDA_ARCHIVE_CREATE
+ \ CMAKE_CUDA_ARCHIVE_FINISH
+ \ CMAKE_CUDA_BYTE_ORDER
+ \ CMAKE_CUDA_CLANG_TIDY
+ \ CMAKE_CUDA_CLANG_TIDY_EXPORT_FIXES_DIR
+ \ CMAKE_CUDA_COMPILER
+ \ CMAKE_CUDA_COMPILER_ABI
+ \ CMAKE_CUDA_COMPILER_AR
+ \ CMAKE_CUDA_COMPILER_ARCHITECTURE_ID
+ \ CMAKE_CUDA_COMPILER_EXTERNAL_TOOLCHAIN
+ \ CMAKE_CUDA_COMPILER_FRONTEND_VARIANT
+ \ CMAKE_CUDA_COMPILER_ID
+ \ CMAKE_CUDA_COMPILER_LAUNCHER
+ \ CMAKE_CUDA_COMPILER_LOADED
+ \ CMAKE_CUDA_COMPILER_PREDEFINES_COMMAND
+ \ CMAKE_CUDA_COMPILER_RANLIB
+ \ CMAKE_CUDA_COMPILER_TARGET
+ \ CMAKE_CUDA_COMPILER_VERSION
+ \ CMAKE_CUDA_COMPILER_VERSION_INTERNAL
+ \ CMAKE_CUDA_COMPILE_FEATURES
+ \ CMAKE_CUDA_COMPILE_OBJECT
+ \ CMAKE_CUDA_CPPCHECK
+ \ CMAKE_CUDA_CPPLINT
+ \ CMAKE_CUDA_CREATE_SHARED_LIBRARY
+ \ CMAKE_CUDA_CREATE_SHARED_MODULE
+ \ CMAKE_CUDA_CREATE_STATIC_LIBRARY
+ \ CMAKE_CUDA_EXTENSIONS
+ \ CMAKE_CUDA_EXTENSIONS_DEFAULT
+ \ CMAKE_CUDA_FLAGS
+ \ CMAKE_CUDA_FLAGS_DEBUG
+ \ CMAKE_CUDA_FLAGS_DEBUG_INIT
+ \ CMAKE_CUDA_FLAGS_INIT
+ \ CMAKE_CUDA_FLAGS_MINSIZEREL
+ \ CMAKE_CUDA_FLAGS_MINSIZEREL_INIT
+ \ CMAKE_CUDA_FLAGS_RELEASE
+ \ CMAKE_CUDA_FLAGS_RELEASE_INIT
+ \ CMAKE_CUDA_FLAGS_RELWITHDEBINFO
+ \ CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT
+ \ CMAKE_CUDA_HOST_COMPILER
+ \ CMAKE_CUDA_IGNORE_EXTENSIONS
+ \ CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES
+ \ CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES
+ \ CMAKE_CUDA_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
+ \ CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES
+ \ CMAKE_CUDA_INCLUDE_WHAT_YOU_USE
+ \ CMAKE_CUDA_INIT
+ \ CMAKE_CUDA_LIBRARY_ARCHITECTURE
+ \ CMAKE_CUDA_LINKER_LAUNCHER
+ \ CMAKE_CUDA_LINKER_PREFERENCE
+ \ CMAKE_CUDA_LINKER_PREFERENCE_PROPAGATES
+ \ CMAKE_CUDA_LINKER_WRAPPER_FLAG
+ \ CMAKE_CUDA_LINKER_WRAPPER_FLAG_SEP
+ \ CMAKE_CUDA_LINK_EXECUTABLE
+ \ CMAKE_CUDA_LINK_LIBRARY_FILE_FLAG
+ \ CMAKE_CUDA_LINK_LIBRARY_FLAG
+ \ CMAKE_CUDA_LINK_LIBRARY_SUFFIX
+ \ CMAKE_CUDA_LINK_WHAT_YOU_USE_FLAG
+ \ CMAKE_CUDA_OUTPUT_EXTENSION
+ \ CMAKE_CUDA_PLATFORM_ID
+ \ CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS
+ \ CMAKE_CUDA_RUNTIME_LIBRARY
+ \ CMAKE_CUDA_SEPARABLE_COMPILATION
+ \ CMAKE_CUDA_SIMULATE_ID
+ \ CMAKE_CUDA_SIMULATE_VERSION
+ \ CMAKE_CUDA_SIZEOF_DATA_PTR
+ \ CMAKE_CUDA_SOURCE_FILE_EXTENSIONS
+ \ CMAKE_CUDA_STANDARD
+ \ CMAKE_CUDA_STANDARD_DEFAULT
+ \ CMAKE_CUDA_STANDARD_INCLUDE_DIRECTORIES
+ \ CMAKE_CUDA_STANDARD_LIBRARIES
+ \ CMAKE_CUDA_STANDARD_REQUIRED
+ \ CMAKE_CUDA_SUPPORTED
+ \ CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES
+ \ CMAKE_CUDA_VISIBILITY_PRESET
+ \ CMAKE_CURRENT_BINARY_DIR
+ \ CMAKE_CURRENT_FUNCTION
+ \ CMAKE_CURRENT_FUNCTION_LIST_DIR
+ \ CMAKE_CURRENT_FUNCTION_LIST_FILE
+ \ CMAKE_CURRENT_FUNCTION_LIST_LINE
+ \ CMAKE_CURRENT_LIST_DIR
+ \ CMAKE_CURRENT_LIST_FILE
+ \ CMAKE_CURRENT_LIST_LINE
+ \ CMAKE_CURRENT_SOURCE_DIR
+ \ CMAKE_CXX
+ \ CMAKE_CXX_ANDROID_TOOLCHAIN_MACHINE
+ \ CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX
+ \ CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX
+ \ CMAKE_CXX_ARCHIVE_APPEND
+ \ CMAKE_CXX_ARCHIVE_CREATE
+ \ CMAKE_CXX_ARCHIVE_FINISH
+ \ CMAKE_CXX_BYTE_ORDER
+ \ CMAKE_CXX_CLANG_TIDY
+ \ CMAKE_CXX_CLANG_TIDY_EXPORT_FIXES_DIR
+ \ CMAKE_CXX_COMPILER
+ \ CMAKE_CXX_COMPILER_ABI
+ \ CMAKE_CXX_COMPILER_AR
+ \ CMAKE_CXX_COMPILER_ARCHITECTURE_ID
+ \ CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN
+ \ CMAKE_CXX_COMPILER_FRONTEND_VARIANT
+ \ CMAKE_CXX_COMPILER_ID
+ \ CMAKE_CXX_COMPILER_LAUNCHER
+ \ CMAKE_CXX_COMPILER_LOADED
+ \ CMAKE_CXX_COMPILER_PREDEFINES_COMMAND
+ \ CMAKE_CXX_COMPILER_RANLIB
+ \ CMAKE_CXX_COMPILER_TARGET
+ \ CMAKE_CXX_COMPILER_VERSION
+ \ CMAKE_CXX_COMPILER_VERSION_INTERNAL
+ \ CMAKE_CXX_COMPILE_FEATURES
+ \ CMAKE_CXX_COMPILE_OBJECT
+ \ CMAKE_CXX_CPPCHECK
+ \ CMAKE_CXX_CPPLINT
+ \ CMAKE_CXX_CREATE_SHARED_LIBRARY
+ \ CMAKE_CXX_CREATE_SHARED_MODULE
+ \ CMAKE_CXX_CREATE_STATIC_LIBRARY
+ \ CMAKE_CXX_EXTENSIONS
+ \ CMAKE_CXX_EXTENSIONS_DEFAULT
+ \ CMAKE_CXX_FLAGS
+ \ CMAKE_CXX_FLAGS_DEBUG
+ \ CMAKE_CXX_FLAGS_DEBUG_INIT
+ \ CMAKE_CXX_FLAGS_INIT
+ \ CMAKE_CXX_FLAGS_MINSIZEREL
+ \ CMAKE_CXX_FLAGS_MINSIZEREL_INIT
+ \ CMAKE_CXX_FLAGS_RELEASE
+ \ CMAKE_CXX_FLAGS_RELEASE_INIT
+ \ CMAKE_CXX_FLAGS_RELWITHDEBINFO
+ \ CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT
+ \ CMAKE_CXX_IGNORE_EXTENSIONS
+ \ CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES
+ \ CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES
+ \ CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
+ \ CMAKE_CXX_IMPLICIT_LINK_LIBRARIES
+ \ CMAKE_CXX_INCLUDE_WHAT_YOU_USE
+ \ CMAKE_CXX_INIT
+ \ CMAKE_CXX_LIBRARY_ARCHITECTURE
+ \ CMAKE_CXX_LINKER_LAUNCHER
+ \ CMAKE_CXX_LINKER_PREFERENCE
+ \ CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES
+ \ CMAKE_CXX_LINKER_WRAPPER_FLAG
+ \ CMAKE_CXX_LINKER_WRAPPER_FLAG_SEP
+ \ CMAKE_CXX_LINK_EXECUTABLE
+ \ CMAKE_CXX_LINK_LIBRARY_FILE_FLAG
+ \ CMAKE_CXX_LINK_LIBRARY_FLAG
+ \ CMAKE_CXX_LINK_LIBRARY_SUFFIX
+ \ CMAKE_CXX_LINK_WHAT_YOU_USE_FLAG
+ \ CMAKE_CXX_OUTPUT_EXTENSION
+ \ CMAKE_CXX_PLATFORM_ID
+ \ CMAKE_CXX_SCAN_FOR_MODULES
+ \ CMAKE_CXX_SIMULATE_ID
+ \ CMAKE_CXX_SIMULATE_VERSION
+ \ CMAKE_CXX_SIZEOF_DATA_PTR
+ \ CMAKE_CXX_SOURCE_FILE_EXTENSIONS
+ \ CMAKE_CXX_STANDARD
+ \ CMAKE_CXX_STANDARD_DEFAULT
+ \ CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES
+ \ CMAKE_CXX_STANDARD_LIBRARIES
+ \ CMAKE_CXX_STANDARD_REQUIRED
+ \ CMAKE_CXX_SUPPORTED
+ \ CMAKE_CXX_VISIBILITY_PRESET
+ \ CMAKE_C_ANDROID_TOOLCHAIN_MACHINE
+ \ CMAKE_C_ANDROID_TOOLCHAIN_PREFIX
+ \ CMAKE_C_ANDROID_TOOLCHAIN_SUFFIX
+ \ CMAKE_C_ARCHIVE_APPEND
+ \ CMAKE_C_ARCHIVE_CREATE
+ \ CMAKE_C_ARCHIVE_FINISH
+ \ CMAKE_C_BYTE_ORDER
+ \ CMAKE_C_CLANG_TIDY
+ \ CMAKE_C_CLANG_TIDY_EXPORT_FIXES_DIR
+ \ CMAKE_C_COMPILER
+ \ CMAKE_C_COMPILER_ABI
+ \ CMAKE_C_COMPILER_AR
+ \ CMAKE_C_COMPILER_ARCHITECTURE_ID
+ \ CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN
+ \ CMAKE_C_COMPILER_FRONTEND_VARIANT
+ \ CMAKE_C_COMPILER_ID
+ \ CMAKE_C_COMPILER_LAUNCHER
+ \ CMAKE_C_COMPILER_LOADED
+ \ CMAKE_C_COMPILER_PREDEFINES_COMMAND
+ \ CMAKE_C_COMPILER_RANLIB
+ \ CMAKE_C_COMPILER_TARGET
+ \ CMAKE_C_COMPILER_VERSION
+ \ CMAKE_C_COMPILER_VERSION_INTERNAL
+ \ CMAKE_C_COMPILE_FEATURES
+ \ CMAKE_C_COMPILE_OBJECT
+ \ CMAKE_C_CPPCHECK
+ \ CMAKE_C_CPPLINT
+ \ CMAKE_C_CREATE_SHARED_LIBRARY
+ \ CMAKE_C_CREATE_SHARED_MODULE
+ \ CMAKE_C_CREATE_STATIC_LIBRARY
+ \ CMAKE_C_EXTENSIONS
+ \ CMAKE_C_EXTENSIONS_DEFAULT
+ \ CMAKE_C_FLAGS
+ \ CMAKE_C_FLAGS_DEBUG
+ \ CMAKE_C_FLAGS_DEBUG_INIT
+ \ CMAKE_C_FLAGS_INIT
+ \ CMAKE_C_FLAGS_MINSIZEREL
+ \ CMAKE_C_FLAGS_MINSIZEREL_INIT
+ \ CMAKE_C_FLAGS_RELEASE
+ \ CMAKE_C_FLAGS_RELEASE_INIT
+ \ CMAKE_C_FLAGS_RELWITHDEBINFO
+ \ CMAKE_C_FLAGS_RELWITHDEBINFO_INIT
+ \ CMAKE_C_IGNORE_EXTENSIONS
+ \ CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES
+ \ CMAKE_C_IMPLICIT_LINK_DIRECTORIES
+ \ CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
+ \ CMAKE_C_IMPLICIT_LINK_LIBRARIES
+ \ CMAKE_C_INCLUDE_WHAT_YOU_USE
+ \ CMAKE_C_INIT
+ \ CMAKE_C_LIBRARY_ARCHITECTURE
+ \ CMAKE_C_LINKER_LAUNCHER
+ \ CMAKE_C_LINKER_PREFERENCE
+ \ CMAKE_C_LINKER_PREFERENCE_PROPAGATES
+ \ CMAKE_C_LINKER_WRAPPER_FLAG
+ \ CMAKE_C_LINKER_WRAPPER_FLAG_SEP
+ \ CMAKE_C_LINK_EXECUTABLE
+ \ CMAKE_C_LINK_LIBRARY_FILE_FLAG
+ \ CMAKE_C_LINK_LIBRARY_FLAG
+ \ CMAKE_C_LINK_LIBRARY_SUFFIX
+ \ CMAKE_C_LINK_WHAT_YOU_USE_FLAG
+ \ CMAKE_C_OUTPUT_EXTENSION
+ \ CMAKE_C_PLATFORM_ID
+ \ CMAKE_C_SIMULATE_ID
+ \ CMAKE_C_SIMULATE_VERSION
+ \ CMAKE_C_SIZEOF_DATA_PTR
+ \ CMAKE_C_SOURCE_FILE_EXTENSIONS
+ \ CMAKE_C_STANDARD
+ \ CMAKE_C_STANDARD_DEFAULT
+ \ CMAKE_C_STANDARD_INCLUDE_DIRECTORIES
+ \ CMAKE_C_STANDARD_LIBRARIES
+ \ CMAKE_C_STANDARD_REQUIRED
+ \ CMAKE_C_SUPPORTED
+ \ CMAKE_C_VISIBILITY_PRESET
+ \ CMAKE_DEBUG_POSTFIX
+ \ CMAKE_DEBUG_TARGET_PROPERTIES
+ \ CMAKE_DEFAULT_BUILD_TYPE
+ \ CMAKE_DEFAULT_CONFIGS
+ \ CMAKE_DEPENDS_IN_PROJECT_ONLY
+ \ CMAKE_DEPENDS_USE_COMPILER
+ \ CMAKE_DIRECTORY_LABELS
+ \ CMAKE_DISABLE_PRECOMPILE_HEADERS
+ \ CMAKE_DLL_NAME_WITH_SOVERSION
+ \ CMAKE_DL_LIBS
+ \ CMAKE_DOTNET_SDK
+ \ CMAKE_DOTNET_TARGET_FRAMEWORK
+ \ CMAKE_DOTNET_TARGET_FRAMEWORK_VERSION
+ \ CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES
+ \ CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT
+ \ CMAKE_ECLIPSE_MAKE_ARGUMENTS
+ \ CMAKE_ECLIPSE_RESOURCE_ENCODING
+ \ CMAKE_ECLIPSE_VERSION
+ \ CMAKE_EDIT_COMMAND
+ \ CMAKE_ENABLE_EXPORTS
+ \ CMAKE_ERROR_DEPRECATED
+ \ CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION
+ \ CMAKE_EXECUTABLE_ENABLE_EXPORTS
+ \ CMAKE_EXECUTABLE_SUFFIX
+ \ CMAKE_EXECUTABLE_SUFFIX_ASM
+ \ CMAKE_EXECUTABLE_SUFFIX_ASM_MASM
+ \ CMAKE_EXECUTABLE_SUFFIX_ASM_NASM
+ \ CMAKE_EXECUTABLE_SUFFIX_C
+ \ CMAKE_EXECUTABLE_SUFFIX_CSharp
+ \ CMAKE_EXECUTABLE_SUFFIX_CUDA
+ \ CMAKE_EXECUTABLE_SUFFIX_CXX
+ \ CMAKE_EXECUTABLE_SUFFIX_Fortran
+ \ CMAKE_EXECUTABLE_SUFFIX_HIP
+ \ CMAKE_EXECUTABLE_SUFFIX_Java
+ \ CMAKE_EXECUTABLE_SUFFIX_RC
+ \ CMAKE_EXECUTABLE_SUFFIX_Swift
+ \ CMAKE_EXECUTE_PROCESS_COMMAND_ECHO
+ \ CMAKE_EXE_LINKER_FLAGS
+ \ CMAKE_EXE_LINKER_FLAGS_INIT
+ \ CMAKE_EXPORT_COMPILE_COMMANDS
+ \ CMAKE_EXPORT_NO_PACKAGE_REGISTRY
+ \ CMAKE_EXPORT_PACKAGE_REGISTRY
+ \ CMAKE_EXTRA_GENERATOR
+ \ CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES
+ \ CMAKE_FIND_APPBUNDLE
+ \ CMAKE_FIND_DEBUG_MODE
+ \ CMAKE_FIND_FRAMEWORK
+ \ CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX
+ \ CMAKE_FIND_LIBRARY_PREFIXES
+ \ CMAKE_FIND_LIBRARY_SUFFIXES
+ \ CMAKE_FIND_NO_INSTALL_PREFIX
+ \ CMAKE_FIND_PACKAGE_NAME
+ \ CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY
+ \ CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY
+ \ CMAKE_FIND_PACKAGE_PREFER_CONFIG
+ \ CMAKE_FIND_PACKAGE_REDIRECTS_DIR
+ \ CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS
+ \ CMAKE_FIND_PACKAGE_SORT_DIRECTION
+ \ CMAKE_FIND_PACKAGE_SORT_ORDER
+ \ CMAKE_FIND_PACKAGE_TARGETS_GLOBAL
+ \ CMAKE_FIND_PACKAGE_WARN_NO_MODULE
+ \ CMAKE_FIND_ROOT_PATH
+ \ CMAKE_FIND_ROOT_PATH_MODE_INCLUDE
+ \ CMAKE_FIND_ROOT_PATH_MODE_LIBRARY
+ \ CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
+ \ CMAKE_FIND_ROOT_PATH_MODE_PROGRAM
+ \ CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH
+ \ CMAKE_FIND_USE_INSTALL_PREFIX
+ \ CMAKE_FIND_USE_CMAKE_PATH
+ \ CMAKE_FIND_USE_CMAKE_SYSTEM_PATH
+ \ CMAKE_FIND_USE_INSTALL_PREFIX
+ \ CMAKE_FIND_USE_PACKAGE_REGISTRY
+ \ CMAKE_FIND_USE_PACKAGE_ROOT_PATH
+ \ CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH
+ \ CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY
+ \ CMAKE_FOLDER
+ \ CMAKE_FRAMEWORK
+ \ CMAKE_FRAMEWORK_PATH
+ \ CMAKE_Fortran
+ \ CMAKE_Fortran_ANDROID_TOOLCHAIN_MACHINE
+ \ CMAKE_Fortran_ANDROID_TOOLCHAIN_PREFIX
+ \ CMAKE_Fortran_ANDROID_TOOLCHAIN_SUFFIX
+ \ CMAKE_Fortran_ARCHIVE_APPEND
+ \ CMAKE_Fortran_ARCHIVE_CREATE
+ \ CMAKE_Fortran_ARCHIVE_FINISH
+ \ CMAKE_Fortran_BYTE_ORDER
+ \ CMAKE_Fortran_CLANG_TIDY
+ \ CMAKE_Fortran_CLANG_TIDY_EXPORT_FIXES_DIR
+ \ CMAKE_Fortran_COMPILER
+ \ CMAKE_Fortran_COMPILER_ABI
+ \ CMAKE_Fortran_COMPILER_AR
+ \ CMAKE_Fortran_COMPILER_ARCHITECTURE_ID
+ \ CMAKE_Fortran_COMPILER_EXTERNAL_TOOLCHAIN
+ \ CMAKE_Fortran_COMPILER_FRONTEND_VARIANT
+ \ CMAKE_Fortran_COMPILER_ID
+ \ CMAKE_Fortran_COMPILER_LAUNCHER
+ \ CMAKE_Fortran_COMPILER_LOADED
+ \ CMAKE_Fortran_COMPILER_PREDEFINES_COMMAND
+ \ CMAKE_Fortran_COMPILER_RANLIB
+ \ CMAKE_Fortran_COMPILER_TARGET
+ \ CMAKE_Fortran_COMPILER_VERSION
+ \ CMAKE_Fortran_COMPILER_VERSION_INTERNAL
+ \ CMAKE_Fortran_COMPILE_OBJECT
+ \ CMAKE_Fortran_CPPCHECK
+ \ CMAKE_Fortran_CPPLINT
+ \ CMAKE_Fortran_CREATE_SHARED_LIBRARY
+ \ CMAKE_Fortran_CREATE_SHARED_MODULE
+ \ CMAKE_Fortran_CREATE_STATIC_LIBRARY
+ \ CMAKE_Fortran_EXTENSIONS
+ \ CMAKE_Fortran_EXTENSIONS_DEFAULT
+ \ CMAKE_Fortran_FLAGS
+ \ CMAKE_Fortran_FLAGS_DEBUG
+ \ CMAKE_Fortran_FLAGS_DEBUG_INIT
+ \ CMAKE_Fortran_FLAGS_INIT
+ \ CMAKE_Fortran_FLAGS_MINSIZEREL
+ \ CMAKE_Fortran_FLAGS_MINSIZEREL_INIT
+ \ CMAKE_Fortran_FLAGS_RELEASE
+ \ CMAKE_Fortran_FLAGS_RELEASE_INIT
+ \ CMAKE_Fortran_FLAGS_RELWITHDEBINFO
+ \ CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT
+ \ CMAKE_Fortran_FORMAT
+ \ CMAKE_Fortran_IGNORE_EXTENSIONS
+ \ CMAKE_Fortran_IMPLICIT_INCLUDE_DIRECTORIES
+ \ CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES
+ \ CMAKE_Fortran_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
+ \ CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES
+ \ CMAKE_Fortran_INCLUDE_WHAT_YOU_USE
+ \ CMAKE_Fortran_INIT
+ \ CMAKE_Fortran_LIBRARY_ARCHITECTURE
+ \ CMAKE_Fortran_LINKER_LAUNCHER
+ \ CMAKE_Fortran_LINKER_PREFERENCE
+ \ CMAKE_Fortran_LINKER_PREFERENCE_PROPAGATES
+ \ CMAKE_Fortran_LINKER_WRAPPER_FLAG
+ \ CMAKE_Fortran_LINKER_WRAPPER_FLAG_SEP
+ \ CMAKE_Fortran_LINK_EXECUTABLE
+ \ CMAKE_Fortran_LINK_LIBRARY_FILE_FLAG
+ \ CMAKE_Fortran_LINK_LIBRARY_FLAG
+ \ CMAKE_Fortran_LINK_LIBRARY_SUFFIX
+ \ CMAKE_Fortran_LINK_WHAT_YOU_USE_FLAG
+ \ CMAKE_Fortran_MODDIR_DEFAULT
+ \ CMAKE_Fortran_MODDIR_FLAG
+ \ CMAKE_Fortran_MODOUT_FLAG
+ \ CMAKE_Fortran_MODULE_DIRECTORY
+ \ CMAKE_Fortran_OUTPUT_EXTENSION
+ \ CMAKE_Fortran_PLATFORM_ID
+ \ CMAKE_Fortran_PREPROCESS
+ \ CMAKE_Fortran_SIMULATE_ID
+ \ CMAKE_Fortran_SIMULATE_VERSION
+ \ CMAKE_Fortran_SIZEOF_DATA_PTR
+ \ CMAKE_Fortran_SOURCE_FILE_EXTENSIONS
+ \ CMAKE_Fortran_STANDARD
+ \ CMAKE_Fortran_STANDARD_DEFAULT
+ \ CMAKE_Fortran_STANDARD_INCLUDE_DIRECTORIES
+ \ CMAKE_Fortran_STANDARD_LIBRARIES
+ \ CMAKE_Fortran_STANDARD_REQUIRED
+ \ CMAKE_Fortran_SUPPORTED
+ \ CMAKE_Fortran_VISIBILITY_PRESET
+ \ CMAKE_GENERATOR
+ \ CMAKE_GENERATOR_INSTANCE
+ \ CMAKE_GENERATOR_PLATFORM
+ \ CMAKE_GENERATOR_TOOLSET
+ \ CMAKE_GHS_NO_SOURCE_GROUP_FILE
+ \ CMAKE_GLOBAL_AUTOGEN_TARGET
+ \ CMAKE_GLOBAL_AUTOGEN_TARGET_NAME
+ \ CMAKE_GLOBAL_AUTORCC_TARGET
+ \ CMAKE_GLOBAL_AUTORCC_TARGET_NAME
+ \ CMAKE_GNUtoMS
+ \ CMAKE_HIP
+ \ CMAKE_HIP_ANDROID_TOOLCHAIN_MACHINE
+ \ CMAKE_HIP_ANDROID_TOOLCHAIN_PREFIX
+ \ CMAKE_HIP_ANDROID_TOOLCHAIN_SUFFIX
+ \ CMAKE_HIP_ARCHITECTURES
+ \ CMAKE_HIP_ARCHIVE_APPEND
+ \ CMAKE_HIP_ARCHIVE_CREATE
+ \ CMAKE_HIP_ARCHIVE_FINISH
+ \ CMAKE_HIP_BYTE_ORDER
+ \ CMAKE_HIP_CLANG_TIDY
+ \ CMAKE_HIP_CLANG_TIDY_EXPORT_FIXES_DIR
+ \ CMAKE_HIP_COMPILER
+ \ CMAKE_HIP_COMPILER_ABI
+ \ CMAKE_HIP_COMPILER_AR
+ \ CMAKE_HIP_COMPILER_ARCHITECTURE_ID
+ \ CMAKE_HIP_COMPILER_EXTERNAL_TOOLCHAIN
+ \ CMAKE_HIP_COMPILER_FRONTEND_VARIANT
+ \ CMAKE_HIP_COMPILER_ID
+ \ CMAKE_HIP_COMPILER_LAUNCHER
+ \ CMAKE_HIP_COMPILER_LOADED
+ \ CMAKE_HIP_COMPILER_PREDEFINES_COMMAND
+ \ CMAKE_HIP_COMPILER_RANLIB
+ \ CMAKE_HIP_COMPILER_TARGET
+ \ CMAKE_HIP_COMPILER_VERSION
+ \ CMAKE_HIP_COMPILER_VERSION_INTERNAL
+ \ CMAKE_HIP_COMPILE_FEATURES
+ \ CMAKE_HIP_COMPILE_OBJECT
+ \ CMAKE_HIP_CPPCHECK
+ \ CMAKE_HIP_CPPLINT
+ \ CMAKE_HIP_CREATE_SHARED_LIBRARY
+ \ CMAKE_HIP_CREATE_SHARED_MODULE
+ \ CMAKE_HIP_CREATE_STATIC_LIBRARY
+ \ CMAKE_HIP_EXTENSIONS
+ \ CMAKE_HIP_EXTENSIONS_DEFAULT
+ \ CMAKE_HIP_FLAGS
+ \ CMAKE_HIP_FLAGS_DEBUG
+ \ CMAKE_HIP_FLAGS_DEBUG_INIT
+ \ CMAKE_HIP_FLAGS_INIT
+ \ CMAKE_HIP_FLAGS_MINSIZEREL
+ \ CMAKE_HIP_FLAGS_MINSIZEREL_INIT
+ \ CMAKE_HIP_FLAGS_RELEASE
+ \ CMAKE_HIP_FLAGS_RELEASE_INIT
+ \ CMAKE_HIP_FLAGS_RELWITHDEBINFO
+ \ CMAKE_HIP_FLAGS_RELWITHDEBINFO_INIT
+ \ CMAKE_HIP_IGNORE_EXTENSIONS
+ \ CMAKE_HIP_IMPLICIT_INCLUDE_DIRECTORIES
+ \ CMAKE_HIP_IMPLICIT_LINK_DIRECTORIES
+ \ CMAKE_HIP_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
+ \ CMAKE_HIP_IMPLICIT_LINK_LIBRARIES
+ \ CMAKE_HIP_INCLUDE_WHAT_YOU_USE
+ \ CMAKE_HIP_INIT
+ \ CMAKE_HIP_LIBRARY_ARCHITECTURE
+ \ CMAKE_HIP_LINKER_LAUNCHER
+ \ CMAKE_HIP_LINKER_PREFERENCE
+ \ CMAKE_HIP_LINKER_PREFERENCE_PROPAGATES
+ \ CMAKE_HIP_LINKER_WRAPPER_FLAG
+ \ CMAKE_HIP_LINKER_WRAPPER_FLAG_SEP
+ \ CMAKE_HIP_LINK_EXECUTABLE
+ \ CMAKE_HIP_LINK_LIBRARY_FILE_FLAG
+ \ CMAKE_HIP_LINK_LIBRARY_FLAG
+ \ CMAKE_HIP_LINK_LIBRARY_SUFFIX
+ \ CMAKE_HIP_LINK_WHAT_YOU_USE_FLAG
+ \ CMAKE_HIP_OUTPUT_EXTENSION
+ \ CMAKE_HIP_PLATFORM_ID
+ \ CMAKE_HIP_SIMULATE_ID
+ \ CMAKE_HIP_SIMULATE_VERSION
+ \ CMAKE_HIP_SIZEOF_DATA_PTR
+ \ CMAKE_HIP_SOURCE_FILE_EXTENSIONS
+ \ CMAKE_HIP_STANDARD
+ \ CMAKE_HIP_STANDARD_DEFAULT
+ \ CMAKE_HIP_STANDARD_INCLUDE_DIRECTORIES
+ \ CMAKE_HIP_STANDARD_LIBRARIES
+ \ CMAKE_HIP_STANDARD_REQUIRED
+ \ CMAKE_HIP_SUPPORTED
+ \ CMAKE_HIP_VISIBILITY_PRESET
+ \ CMAKE_HOME_DIRECTORY
+ \ CMAKE_HOST_APPLE
+ \ CMAKE_HOST_BSD
+ \ CMAKE_HOST_LINUX
+ \ CMAKE_HOST_SOLARIS
+ \ CMAKE_HOST_SYSTEM
+ \ CMAKE_HOST_SYSTEM_NAME
+ \ CMAKE_HOST_SYSTEM_PROCESSOR
+ \ CMAKE_HOST_SYSTEM_VERSION
+ \ CMAKE_HOST_UNIX
+ \ CMAKE_HOST_WIN32
+ \ CMAKE_IGNORE_PATH
+ \ CMAKE_IGNORE_PREFIX_PATH
+ \ CMAKE_IMPORT_LIBRARY_PREFIX
+ \ CMAKE_IMPORT_LIBRARY_SUFFIX
+ \ CMAKE_INCLUDE_CURRENT_DIR
+ \ CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE
+ \ CMAKE_INCLUDE_DIRECTORIES_BEFORE
+ \ CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE
+ \ CMAKE_INCLUDE_PATH
+ \ CMAKE_INSTALL_DEFAULT_COMPONENT_NAME
+ \ CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS
+ \ CMAKE_INSTALL_MESSAGE
+ \ CMAKE_INSTALL_NAME_DIR
+ \ CMAKE_INSTALL_PREFIX
+ \ CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT
+ \ CMAKE_INSTALL_REMOVE_ENVIRONMENT_RPATH
+ \ CMAKE_INSTALL_RPATH
+ \ CMAKE_INSTALL_RPATH_USE_LINK_PATH
+ \ CMAKE_INTERNAL_PLATFORM_ABI
+ \ CMAKE_INTERPROCEDURAL_OPTIMIZATION
+ \ CMAKE_IOS_INSTALL_COMBINED
+ \ CMAKE_ISPC_HEADER_DIRECTORY
+ \ CMAKE_ISPC_HEADER_SUFFIX
+ \ CMAKE_ISPC_INSTRUCTION_SETS
+ \ CMAKE_JOB_POOLS
+ \ CMAKE_JOB_POOL_COMPILE
+ \ CMAKE_JOB_POOL_LINK
+ \ CMAKE_JOB_POOL_PRECOMPILE_HEADER
+ \ CMAKE_Java
+ \ CMAKE_Java_ANDROID_TOOLCHAIN_MACHINE
+ \ CMAKE_Java_ANDROID_TOOLCHAIN_PREFIX
+ \ CMAKE_Java_ANDROID_TOOLCHAIN_SUFFIX
+ \ CMAKE_Java_ARCHIVE_APPEND
+ \ CMAKE_Java_ARCHIVE_CREATE
+ \ CMAKE_Java_ARCHIVE_FINISH
+ \ CMAKE_Java_BYTE_ORDER
+ \ CMAKE_Java_CLANG_TIDY
+ \ CMAKE_Java_CLANG_TIDY_EXPORT_FIXES_DIR
+ \ CMAKE_Java_COMPILER
+ \ CMAKE_Java_COMPILER_ABI
+ \ CMAKE_Java_COMPILER_AR
+ \ CMAKE_Java_COMPILER_ARCHITECTURE_ID
+ \ CMAKE_Java_COMPILER_EXTERNAL_TOOLCHAIN
+ \ CMAKE_Java_COMPILER_FRONTEND_VARIANT
+ \ CMAKE_Java_COMPILER_ID
+ \ CMAKE_Java_COMPILER_LAUNCHER
+ \ CMAKE_Java_COMPILER_LOADED
+ \ CMAKE_Java_COMPILER_PREDEFINES_COMMAND
+ \ CMAKE_Java_COMPILER_RANLIB
+ \ CMAKE_Java_COMPILER_TARGET
+ \ CMAKE_Java_COMPILER_VERSION
+ \ CMAKE_Java_COMPILER_VERSION_INTERNAL
+ \ CMAKE_Java_COMPILE_OBJECT
+ \ CMAKE_Java_CPPCHECK
+ \ CMAKE_Java_CPPLINT
+ \ CMAKE_Java_CREATE_SHARED_LIBRARY
+ \ CMAKE_Java_CREATE_SHARED_MODULE
+ \ CMAKE_Java_CREATE_STATIC_LIBRARY
+ \ CMAKE_Java_EXTENSIONS
+ \ CMAKE_Java_EXTENSIONS_DEFAULT
+ \ CMAKE_Java_FLAGS
+ \ CMAKE_Java_FLAGS_DEBUG
+ \ CMAKE_Java_FLAGS_DEBUG_INIT
+ \ CMAKE_Java_FLAGS_INIT
+ \ CMAKE_Java_FLAGS_MINSIZEREL
+ \ CMAKE_Java_FLAGS_MINSIZEREL_INIT
+ \ CMAKE_Java_FLAGS_RELEASE
+ \ CMAKE_Java_FLAGS_RELEASE_INIT
+ \ CMAKE_Java_FLAGS_RELWITHDEBINFO
+ \ CMAKE_Java_FLAGS_RELWITHDEBINFO_INIT
+ \ CMAKE_Java_IGNORE_EXTENSIONS
+ \ CMAKE_Java_IMPLICIT_INCLUDE_DIRECTORIES
+ \ CMAKE_Java_IMPLICIT_LINK_DIRECTORIES
+ \ CMAKE_Java_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
+ \ CMAKE_Java_IMPLICIT_LINK_LIBRARIES
+ \ CMAKE_Java_INCLUDE_WHAT_YOU_USE
+ \ CMAKE_Java_INIT
+ \ CMAKE_Java_LIBRARY_ARCHITECTURE
+ \ CMAKE_Java_LINKER_LAUNCHER
+ \ CMAKE_Java_LINKER_PREFERENCE
+ \ CMAKE_Java_LINKER_PREFERENCE_PROPAGATES
+ \ CMAKE_Java_LINKER_WRAPPER_FLAG
+ \ CMAKE_Java_LINKER_WRAPPER_FLAG_SEP
+ \ CMAKE_Java_LINK_EXECUTABLE
+ \ CMAKE_Java_LINK_LIBRARY_FILE_FLAG
+ \ CMAKE_Java_LINK_LIBRARY_FLAG
+ \ CMAKE_Java_LINK_LIBRARY_SUFFIX
+ \ CMAKE_Java_LINK_WHAT_YOU_USE_FLAG
+ \ CMAKE_Java_OUTPUT_EXTENSION
+ \ CMAKE_Java_PLATFORM_ID
+ \ CMAKE_Java_SIMULATE_ID
+ \ CMAKE_Java_SIMULATE_VERSION
+ \ CMAKE_Java_SIZEOF_DATA_PTR
+ \ CMAKE_Java_SOURCE_FILE_EXTENSIONS
+ \ CMAKE_Java_STANDARD
+ \ CMAKE_Java_STANDARD_DEFAULT
+ \ CMAKE_Java_STANDARD_INCLUDE_DIRECTORIES
+ \ CMAKE_Java_STANDARD_LIBRARIES
+ \ CMAKE_Java_STANDARD_REQUIRED
+ \ CMAKE_Java_SUPPORTED
+ \ CMAKE_Java_VISIBILITY_PRESET
+ \ CMAKE_KATE_FILES_MODE
+ \ CMAKE_KATE_MAKE_ARGUMENTS
+ \ CMAKE_LIBRARY_ARCHITECTURE
+ \ CMAKE_LIBRARY_ARCHITECTURE_REGEX
+ \ CMAKE_LIBRARY_OUTPUT_DIRECTORY
+ \ CMAKE_LIBRARY_PATH
+ \ CMAKE_LIBRARY_PATH_FLAG
+ \ CMAKE_LINK_DEF_FILE_FLAG
+ \ CMAKE_LINK_DEPENDS_NO_SHARED
+ \ CMAKE_LINK_DEPENDS_USE_LINKER
+ \ CMAKE_LINK_DIRECTORIES_BEFORE
+ \ CMAKE_LINK_INTERFACE_LIBRARIES
+ \ CMAKE_LINK_LIBRARIES_ONLY_TARGETS
+ \ CMAKE_LINK_LIBRARY_FILE_FLAG
+ \ CMAKE_LINK_LIBRARY_FLAG
+ \ CMAKE_LINK_LIBRARY_SUFFIX
+ \ CMAKE_LINK_SEARCH_END_STATIC
+ \ CMAKE_LINK_SEARCH_START_STATIC
+ \ CMAKE_LINK_WHAT_YOU_USE
+ \ CMAKE_LINK_WHAT_YOU_USE_CHECK
+ \ CMAKE_MACOSX_BUNDLE
+ \ CMAKE_MACOSX_RPATH
+ \ CMAKE_MAJOR_VERSION
+ \ CMAKE_MAKE_PROGRAM
+ \ CMAKE_MATCH_COUNT
+ \ CMAKE_MAXIMUM_RECURSION_DEPTH
+ \ CMAKE_MESSAGE_CONTEXT
+ \ CMAKE_MESSAGE_CONTEXT_SHOW
+ \ CMAKE_MESSAGE_INDENT
+ \ CMAKE_MESSAGE_LOG_LEVEL
+ \ CMAKE_MFC_FLAG
+ \ CMAKE_MINIMUM_REQUIRED_VERSION
+ \ CMAKE_MINOR_VERSION
+ \ CMAKE_MODULE_LINKER_FLAGS
+ \ CMAKE_MODULE_LINKER_FLAGS_INIT
+ \ CMAKE_MODULE_PATH
+ \ CMAKE_MSVCIDE_RUN_PATH
+ \ CMAKE_MSVC_DEBUG_INFORMATION_FORMAT
+ \ CMAKE_MSVC_RUNTIME_LIBRARY
+ \ CMAKE_NETRC
+ \ CMAKE_NETRC_FILE
+ \ CMAKE_NINJA_OUTPUT_PATH_PREFIX
+ \ CMAKE_NOT_USING_CONFIG_FLAGS
+ \ CMAKE_NO_BUILTIN_CHRPATH
+ \ CMAKE_NO_SYSTEM_FROM_IMPORTED
+ \ CMAKE_OBJCXX_CLANG_TIDY
+ \ CMAKE_OBJCXX_EXTENSIONS
+ \ CMAKE_OBJCXX_LINKER_LAUNCHER
+ \ CMAKE_OBJCXX_STANDARD
+ \ CMAKE_OBJCXX_STANDARD_REQUIRED
+ \ CMAKE_OBJC_CLANG_TIDY
+ \ CMAKE_OBJC_EXTENSIONS
+ \ CMAKE_OBJC_LINKER_LAUNCHER
+ \ CMAKE_OBJC_STANDARD
+ \ CMAKE_OBJC_STANDARD_REQUIRED
+ \ CMAKE_OBJECT_PATH_MAX
+ \ CMAKE_OPTIMIZE_DEPENDENCIES
+ \ CMAKE_OSX_ARCHITECTURES
+ \ CMAKE_OSX_DEPLOYMENT_TARGET
+ \ CMAKE_OSX_SYSROOT
+ \ CMAKE_PARENT_LIST_FILE
+ \ CMAKE_PATCH_VERSION
+ \ CMAKE_PCH_INSTANTIATE_TEMPLATES
+ \ CMAKE_PCH_WARN_INVALID
+ \ CMAKE_PDB_OUTPUT_DIRECTORY
+ \ CMAKE_PLATFORM_NO_VERSIONED_SONAME
+ \ CMAKE_POSITION_INDEPENDENT_CODE
+ \ CMAKE_PREFIX_PATH
+ \ CMAKE_PROGRAM_PATH
+ \ CMAKE_PROJECT_DESCRIPTION
+ \ CMAKE_PROJECT_HOMEPAGE_URL
+ \ CMAKE_PROJECT_INCLUDE
+ \ CMAKE_PROJECT_INCLUDE_BEFORE
+ \ CMAKE_PROJECT_NAME
+ \ CMAKE_PROJECT_TOP_LEVEL_INCLUDES
+ \ CMAKE_PROJECT_VERSION
+ \ CMAKE_PROJECT_VERSION_MAJOR
+ \ CMAKE_PROJECT_VERSION_MINOR
+ \ CMAKE_PROJECT_VERSION_PATCH
+ \ CMAKE_PROJECT_VERSION_TWEAK
+ \ CMAKE_RANLIB
+ \ CMAKE_RC
+ \ CMAKE_RC_ANDROID_TOOLCHAIN_MACHINE
+ \ CMAKE_RC_ANDROID_TOOLCHAIN_PREFIX
+ \ CMAKE_RC_ANDROID_TOOLCHAIN_SUFFIX
+ \ CMAKE_RC_ARCHIVE_APPEND
+ \ CMAKE_RC_ARCHIVE_CREATE
+ \ CMAKE_RC_ARCHIVE_FINISH
+ \ CMAKE_RC_BYTE_ORDER
+ \ CMAKE_RC_CLANG_TIDY
+ \ CMAKE_RC_CLANG_TIDY_EXPORT_FIXES_DIR
+ \ CMAKE_RC_COMPILER
+ \ CMAKE_RC_COMPILER_ABI
+ \ CMAKE_RC_COMPILER_AR
+ \ CMAKE_RC_COMPILER_ARCHITECTURE_ID
+ \ CMAKE_RC_COMPILER_EXTERNAL_TOOLCHAIN
+ \ CMAKE_RC_COMPILER_FRONTEND_VARIANT
+ \ CMAKE_RC_COMPILER_ID
+ \ CMAKE_RC_COMPILER_LAUNCHER
+ \ CMAKE_RC_COMPILER_LOADED
+ \ CMAKE_RC_COMPILER_PREDEFINES_COMMAND
+ \ CMAKE_RC_COMPILER_RANLIB
+ \ CMAKE_RC_COMPILER_TARGET
+ \ CMAKE_RC_COMPILER_VERSION
+ \ CMAKE_RC_COMPILER_VERSION_INTERNAL
+ \ CMAKE_RC_COMPILE_OBJECT
+ \ CMAKE_RC_CPPCHECK
+ \ CMAKE_RC_CPPLINT
+ \ CMAKE_RC_CREATE_SHARED_LIBRARY
+ \ CMAKE_RC_CREATE_SHARED_MODULE
+ \ CMAKE_RC_CREATE_STATIC_LIBRARY
+ \ CMAKE_RC_EXTENSIONS
+ \ CMAKE_RC_EXTENSIONS_DEFAULT
+ \ CMAKE_RC_FLAGS
+ \ CMAKE_RC_FLAGS_DEBUG
+ \ CMAKE_RC_FLAGS_DEBUG_INIT
+ \ CMAKE_RC_FLAGS_INIT
+ \ CMAKE_RC_FLAGS_MINSIZEREL
+ \ CMAKE_RC_FLAGS_MINSIZEREL_INIT
+ \ CMAKE_RC_FLAGS_RELEASE
+ \ CMAKE_RC_FLAGS_RELEASE_INIT
+ \ CMAKE_RC_FLAGS_RELWITHDEBINFO
+ \ CMAKE_RC_FLAGS_RELWITHDEBINFO_INIT
+ \ CMAKE_RC_IGNORE_EXTENSIONS
+ \ CMAKE_RC_IMPLICIT_INCLUDE_DIRECTORIES
+ \ CMAKE_RC_IMPLICIT_LINK_DIRECTORIES
+ \ CMAKE_RC_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
+ \ CMAKE_RC_IMPLICIT_LINK_LIBRARIES
+ \ CMAKE_RC_INCLUDE_WHAT_YOU_USE
+ \ CMAKE_RC_INIT
+ \ CMAKE_RC_LIBRARY_ARCHITECTURE
+ \ CMAKE_RC_LINKER_LAUNCHER
+ \ CMAKE_RC_LINKER_PREFERENCE
+ \ CMAKE_RC_LINKER_PREFERENCE_PROPAGATES
+ \ CMAKE_RC_LINKER_WRAPPER_FLAG
+ \ CMAKE_RC_LINKER_WRAPPER_FLAG_SEP
+ \ CMAKE_RC_LINK_EXECUTABLE
+ \ CMAKE_RC_LINK_LIBRARY_FILE_FLAG
+ \ CMAKE_RC_LINK_LIBRARY_FLAG
+ \ CMAKE_RC_LINK_LIBRARY_SUFFIX
+ \ CMAKE_RC_LINK_WHAT_YOU_USE_FLAG
+ \ CMAKE_RC_OUTPUT_EXTENSION
+ \ CMAKE_RC_PLATFORM_ID
+ \ CMAKE_RC_SIMULATE_ID
+ \ CMAKE_RC_SIMULATE_VERSION
+ \ CMAKE_RC_SIZEOF_DATA_PTR
+ \ CMAKE_RC_SOURCE_FILE_EXTENSIONS
+ \ CMAKE_RC_STANDARD
+ \ CMAKE_RC_STANDARD_DEFAULT
+ \ CMAKE_RC_STANDARD_INCLUDE_DIRECTORIES
+ \ CMAKE_RC_STANDARD_LIBRARIES
+ \ CMAKE_RC_STANDARD_REQUIRED
+ \ CMAKE_RC_SUPPORTED
+ \ CMAKE_RC_VISIBILITY_PRESET
+ \ CMAKE_ROOT
+ \ CMAKE_RULE_MESSAGES
+ \ CMAKE_RUNTIME_OUTPUT_DIRECTORY
+ \ CMAKE_SCRIPT_MODE_FILE
+ \ CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS
+ \ CMAKE_SHARED_LIBRARY_PREFIX
+ \ CMAKE_SHARED_LIBRARY_SUFFIX
+ \ CMAKE_SHARED_LINKER_FLAGS
+ \ CMAKE_SHARED_LINKER_FLAGS_INIT
+ \ CMAKE_SHARED_MODULE_PREFIX
+ \ CMAKE_SHARED_MODULE_SUFFIX
+ \ CMAKE_SIZEOF_VOID_P
+ \ CMAKE_SKIP_BUILD_RPATH
+ \ CMAKE_SKIP_INSTALL_ALL_DEPENDENCY
+ \ CMAKE_SKIP_INSTALL_RPATH
+ \ CMAKE_SKIP_INSTALL_RULES
+ \ CMAKE_SKIP_RPATH
+ \ CMAKE_SKIP_TEST_ALL_DEPENDENCY
+ \ CMAKE_SOURCE_DIR
+ \ CMAKE_STAGING_PREFIX
+ \ CMAKE_STATIC_LIBRARY_PREFIX
+ \ CMAKE_STATIC_LIBRARY_SUFFIX
+ \ CMAKE_STATIC_LINKER_FLAGS
+ \ CMAKE_STATIC_LINKER_FLAGS_INIT
+ \ CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS
+ \ CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE
+ \ CMAKE_SUPPRESS_REGENERATION
+ \ CMAKE_SYSROOT
+ \ CMAKE_SYSROOT_COMPILE
+ \ CMAKE_SYSROOT_LINK
+ \ CMAKE_SYSTEM
+ \ CMAKE_SYSTEM_APPBUNDLE_PATH
+ \ CMAKE_SYSTEM_FRAMEWORK_PATH
+ \ CMAKE_SYSTEM_IGNORE_PATH
+ \ CMAKE_SYSTEM_IGNORE_PREFIX_PATH
+ \ CMAKE_SYSTEM_INCLUDE_PATH
+ \ CMAKE_SYSTEM_LIBRARY_PATH
+ \ CMAKE_SYSTEM_NAME
+ \ CMAKE_SYSTEM_PREFIX_PATH
+ \ CMAKE_SYSTEM_PROCESSOR
+ \ CMAKE_SYSTEM_PROGRAM_PATH
+ \ CMAKE_SYSTEM_VERSION
+ \ CMAKE_Swift
+ \ CMAKE_Swift_ANDROID_TOOLCHAIN_MACHINE
+ \ CMAKE_Swift_ANDROID_TOOLCHAIN_PREFIX
+ \ CMAKE_Swift_ANDROID_TOOLCHAIN_SUFFIX
+ \ CMAKE_Swift_ARCHIVE_APPEND
+ \ CMAKE_Swift_ARCHIVE_CREATE
+ \ CMAKE_Swift_ARCHIVE_FINISH
+ \ CMAKE_Swift_BYTE_ORDER
+ \ CMAKE_Swift_CLANG_TIDY
+ \ CMAKE_Swift_CLANG_TIDY_EXPORT_FIXES_DIR
+ \ CMAKE_Swift_COMPILER
+ \ CMAKE_Swift_COMPILER_ABI
+ \ CMAKE_Swift_COMPILER_AR
+ \ CMAKE_Swift_COMPILER_ARCHITECTURE_ID
+ \ CMAKE_Swift_COMPILER_EXTERNAL_TOOLCHAIN
+ \ CMAKE_Swift_COMPILER_FRONTEND_VARIANT
+ \ CMAKE_Swift_COMPILER_ID
+ \ CMAKE_Swift_COMPILER_LAUNCHER
+ \ CMAKE_Swift_COMPILER_LOADED
+ \ CMAKE_Swift_COMPILER_PREDEFINES_COMMAND
+ \ CMAKE_Swift_COMPILER_RANLIB
+ \ CMAKE_Swift_COMPILER_TARGET
+ \ CMAKE_Swift_COMPILER_VERSION
+ \ CMAKE_Swift_COMPILER_VERSION_INTERNAL
+ \ CMAKE_Swift_COMPILE_OBJECT
+ \ CMAKE_Swift_CPPCHECK
+ \ CMAKE_Swift_CPPLINT
+ \ CMAKE_Swift_CREATE_SHARED_LIBRARY
+ \ CMAKE_Swift_CREATE_SHARED_MODULE
+ \ CMAKE_Swift_CREATE_STATIC_LIBRARY
+ \ CMAKE_Swift_EXTENSIONS
+ \ CMAKE_Swift_EXTENSIONS_DEFAULT
+ \ CMAKE_Swift_FLAGS
+ \ CMAKE_Swift_FLAGS_DEBUG
+ \ CMAKE_Swift_FLAGS_DEBUG_INIT
+ \ CMAKE_Swift_FLAGS_INIT
+ \ CMAKE_Swift_FLAGS_MINSIZEREL
+ \ CMAKE_Swift_FLAGS_MINSIZEREL_INIT
+ \ CMAKE_Swift_FLAGS_RELEASE
+ \ CMAKE_Swift_FLAGS_RELEASE_INIT
+ \ CMAKE_Swift_FLAGS_RELWITHDEBINFO
+ \ CMAKE_Swift_FLAGS_RELWITHDEBINFO_INIT
+ \ CMAKE_Swift_IGNORE_EXTENSIONS
+ \ CMAKE_Swift_IMPLICIT_INCLUDE_DIRECTORIES
+ \ CMAKE_Swift_IMPLICIT_LINK_DIRECTORIES
+ \ CMAKE_Swift_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
+ \ CMAKE_Swift_IMPLICIT_LINK_LIBRARIES
+ \ CMAKE_Swift_INCLUDE_WHAT_YOU_USE
+ \ CMAKE_Swift_INIT
+ \ CMAKE_Swift_LANGUAGE_VERSION
+ \ CMAKE_Swift_LIBRARY_ARCHITECTURE
+ \ CMAKE_Swift_LINKER_LAUNCHER
+ \ CMAKE_Swift_LINKER_PREFERENCE
+ \ CMAKE_Swift_LINKER_PREFERENCE_PROPAGATES
+ \ CMAKE_Swift_LINKER_WRAPPER_FLAG
+ \ CMAKE_Swift_LINKER_WRAPPER_FLAG_SEP
+ \ CMAKE_Swift_LINK_EXECUTABLE
+ \ CMAKE_Swift_LINK_LIBRARY_FILE_FLAG
+ \ CMAKE_Swift_LINK_LIBRARY_FLAG
+ \ CMAKE_Swift_LINK_LIBRARY_SUFFIX
+ \ CMAKE_Swift_LINK_WHAT_YOU_USE_FLAG
+ \ CMAKE_Swift_MODULE_DIRECTORY
+ \ CMAKE_Swift_NUM_THREADS
+ \ CMAKE_Swift_OUTPUT_EXTENSION
+ \ CMAKE_Swift_PLATFORM_ID
+ \ CMAKE_Swift_SIMULATE_ID
+ \ CMAKE_Swift_SIMULATE_VERSION
+ \ CMAKE_Swift_SIZEOF_DATA_PTR
+ \ CMAKE_Swift_SOURCE_FILE_EXTENSIONS
+ \ CMAKE_Swift_STANDARD
+ \ CMAKE_Swift_STANDARD_DEFAULT
+ \ CMAKE_Swift_STANDARD_INCLUDE_DIRECTORIES
+ \ CMAKE_Swift_STANDARD_LIBRARIES
+ \ CMAKE_Swift_STANDARD_REQUIRED
+ \ CMAKE_Swift_SUPPORTED
+ \ CMAKE_Swift_VISIBILITY_PRESET
+ \ CMAKE_TASKING_TOOLSET
+ \ CMAKE_TLS_CAINFO
+ \ CMAKE_TLS_VERIFY
+ \ CMAKE_TOOLCHAIN_FILE
+ \ CMAKE_TRY_COMPILE_CONFIGURATION
+ \ CMAKE_TRY_COMPILE_NO_PLATFORM_VARIABLES
+ \ CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
+ \ CMAKE_TRY_COMPILE_TARGET_TYPE
+ \ CMAKE_TWEAK_VERSION
+ \ CMAKE_UNITY_BUILD
+ \ CMAKE_UNITY_BUILD_BATCH_SIZE
+ \ CMAKE_UNITY_BUILD_UNIQUE_ID
+ \ CMAKE_USER_MAKE_RULES_OVERRIDE
+ \ CMAKE_USER_MAKE_RULES_OVERRIDE_ASM
+ \ CMAKE_USER_MAKE_RULES_OVERRIDE_ASM_MASM
+ \ CMAKE_USER_MAKE_RULES_OVERRIDE_ASM_NASM
+ \ CMAKE_USER_MAKE_RULES_OVERRIDE_C
+ \ CMAKE_USER_MAKE_RULES_OVERRIDE_CSharp
+ \ CMAKE_USER_MAKE_RULES_OVERRIDE_CUDA
+ \ CMAKE_USER_MAKE_RULES_OVERRIDE_CXX
+ \ CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran
+ \ CMAKE_USER_MAKE_RULES_OVERRIDE_HIP
+ \ CMAKE_USER_MAKE_RULES_OVERRIDE_Java
+ \ CMAKE_USER_MAKE_RULES_OVERRIDE_RC
+ \ CMAKE_USER_MAKE_RULES_OVERRIDE_Swift
+ \ CMAKE_USE_RELATIVE_PATHS
+ \ CMAKE_VERBOSE_MAKEFILE
+ \ CMAKE_VERIFY_INTERFACE_HEADER_SETS
+ \ CMAKE_VERSION
+ \ CMAKE_VISIBILITY_INLINES_HIDDEN
+ \ CMAKE_VS_DEBUGGER_COMMAND
+ \ CMAKE_VS_DEBUGGER_COMMAND_ARGUMENTS
+ \ CMAKE_VS_DEBUGGER_ENVIRONMENT
+ \ CMAKE_VS_DEBUGGER_WORKING_DIRECTORY
+ \ CMAKE_VS_DEVENV_COMMAND
+ \ CMAKE_VS_GLOBALS
+ \ CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD
+ \ CMAKE_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD
+ \ CMAKE_VS_INTEL_Fortran_PROJECT_VERSION
+ \ CMAKE_VS_JUST_MY_CODE_DEBUGGING
+ \ CMAKE_VS_MSBUILD_COMMAND
+ \ CMAKE_VS_NO_COMPILE_BATCHING
+ \ CMAKE_VS_NUGET_PACKAGE_RESTORE
+ \ CMAKE_VS_NsightTegra_VERSION
+ \ CMAKE_VS_PLATFORM_NAME
+ \ CMAKE_VS_PLATFORM_NAME_DEFAULT
+ \ CMAKE_VS_PLATFORM_TOOLSET
+ \ CMAKE_VS_PLATFORM_TOOLSET_CUDA
+ \ CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR
+ \ CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE
+ \ CMAKE_VS_PLATFORM_TOOLSET_VERSION
+ \ CMAKE_VS_SDK_EXCLUDE_DIRECTORIES
+ \ CMAKE_VS_SDK_EXECUTABLE_DIRECTORIES
+ \ CMAKE_VS_SDK_INCLUDE_DIRECTORIES
+ \ CMAKE_VS_SDK_LIBRARY_DIRECTORIES
+ \ CMAKE_VS_SDK_LIBRARY_WINRT_DIRECTORIES
+ \ CMAKE_VS_SDK_REFERENCE_DIRECTORIES
+ \ CMAKE_VS_SDK_SOURCE_DIRECTORIES
+ \ CMAKE_VS_TARGET_FRAMEWORK_IDENTIFIER
+ \ CMAKE_VS_TARGET_FRAMEWORK_TARGETS_VERSION
+ \ CMAKE_VS_TARGET_FRAMEWORK_VERSION
+ \ CMAKE_VS_VERSION_BUILD_NUMBER
+ \ CMAKE_VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION
+ \ CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION
+ \ CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM
+ \ CMAKE_VS_WINRT_BY_DEFAULT
+ \ CMAKE_WARN_DEPRECATED
+ \ CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION
+ \ CMAKE_WATCOM_RUNTIME_LIBRARY
+ \ CMAKE_WIN32_EXECUTABLE
+ \ CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS
+ \ CMAKE_XCODE_BUILD_SYSTEM
+ \ CMAKE_XCODE_GENERATE_SCHEME
+ \ CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY
+ \ CMAKE_XCODE_LINK_BUILD_PHASE_MODE
+ \ CMAKE_XCODE_PLATFORM_TOOLSET
+ \ CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER
+ \ CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN
+ \ CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING
+ \ CMAKE_XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE
+ \ CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER
+ \ CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS
+ \ CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE
+ \ CMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION
+ \ CMAKE_XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE
+ \ CMAKE_XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION
+ \ CMAKE_XCODE_SCHEME_ENVIRONMENT
+ \ CMAKE_XCODE_SCHEME_GUARD_MALLOC
+ \ CMAKE_XCODE_SCHEME_LAUNCH_CONFIGURATION
+ \ CMAKE_XCODE_SCHEME_LAUNCH_MODE
+ \ CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP
+ \ CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES
+ \ CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE
+ \ CMAKE_XCODE_SCHEME_MALLOC_STACK
+ \ CMAKE_XCODE_SCHEME_THREAD_SANITIZER
+ \ CMAKE_XCODE_SCHEME_THREAD_SANITIZER_STOP
+ \ CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER
+ \ CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP
+ \ CMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION
+ \ CMAKE_XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION
+ \ CMAKE_XCODE_SCHEME_LAUNCH_CONFIGURATION
+ \ CMAKE_XCODE_SCHEME_WORKING_DIRECTORY
+ \ CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS
+ \ CMAKE_XCODE_XCCONFIG
+ \ CPACK_ABSOLUTE_DESTINATION_FILES
+ \ CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY
+ \ CPACK_CUSTOM_INSTALL_VARIABLES
+ \ CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION
+ \ CPACK_INCLUDE_TOPLEVEL_DIRECTORY
+ \ CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS
+ \ CPACK_PACKAGING_INSTALL_PREFIX
+ \ CPACK_SET_DESTDIR
+ \ CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION
+ \ CTEST_BINARY_DIRECTORY
+ \ CTEST_BUILD_COMMAND
+ \ CTEST_BUILD_NAME
+ \ CTEST_BZR_COMMAND
+ \ CTEST_BZR_UPDATE_OPTIONS
+ \ CTEST_CHANGE_ID
+ \ CTEST_CHECKOUT_COMMAND
+ \ CTEST_CONFIGURATION_TYPE
+ \ CTEST_CONFIGURE_COMMAND
+ \ CTEST_COVERAGE_COMMAND
+ \ CTEST_COVERAGE_EXTRA_FLAGS
+ \ CTEST_CURL_OPTIONS
+ \ CTEST_CUSTOM_COVERAGE_EXCLUDE
+ \ CTEST_CUSTOM_ERROR_EXCEPTION
+ \ CTEST_CUSTOM_ERROR_MATCH
+ \ CTEST_CUSTOM_ERROR_POST_CONTEXT
+ \ CTEST_CUSTOM_ERROR_PRE_CONTEXT
+ \ CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE
+ \ CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS
+ \ CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS
+ \ CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE
+ \ CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION
+ \ CTEST_CUSTOM_MEMCHECK_IGNORE
+ \ CTEST_CUSTOM_POST_MEMCHECK
+ \ CTEST_CUSTOM_POST_TEST
+ \ CTEST_CUSTOM_PRE_MEMCHECK
+ \ CTEST_CUSTOM_PRE_TEST
+ \ CTEST_CUSTOM_TESTS_IGNORE
+ \ CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION
+ \ CTEST_CUSTOM_WARNING_EXCEPTION
+ \ CTEST_CUSTOM_WARNING_MATCH
+ \ CTEST_CVS_CHECKOUT
+ \ CTEST_CVS_COMMAND
+ \ CTEST_CVS_UPDATE_OPTIONS
+ \ CTEST_DROP_LOCATION
+ \ CTEST_DROP_METHOD
+ \ CTEST_DROP_SITE
+ \ CTEST_DROP_SITE_CDASH
+ \ CTEST_DROP_SITE_PASSWORD
+ \ CTEST_DROP_SITE_USER
+ \ CTEST_EXTRA_COVERAGE_GLOB
+ \ CTEST_GIT_COMMAND
+ \ CTEST_GIT_INIT_SUBMODULES
+ \ CTEST_GIT_UPDATE_CUSTOM
+ \ CTEST_GIT_UPDATE_OPTIONS
+ \ CTEST_HG_COMMAND
+ \ CTEST_HG_UPDATE_OPTIONS
+ \ CTEST_LABELS_FOR_SUBPROJECTS
+ \ CTEST_MEMORYCHECK_COMMAND
+ \ CTEST_MEMORYCHECK_COMMAND_OPTIONS
+ \ CTEST_MEMORYCHECK_SANITIZER_OPTIONS
+ \ CTEST_MEMORYCHECK_SUPPRESSIONS_FILE
+ \ CTEST_MEMORYCHECK_TYPE
+ \ CTEST_NIGHTLY_START_TIME
+ \ CTEST_P4_CLIENT
+ \ CTEST_P4_COMMAND
+ \ CTEST_P4_OPTIONS
+ \ CTEST_P4_UPDATE_OPTIONS
+ \ CTEST_RESOURCE_SPEC_FILE
+ \ CTEST_RUN_CURRENT_SCRIPT
+ \ CTEST_SCP_COMMAND
+ \ CTEST_SCRIPT_DIRECTORY
+ \ CTEST_SITE
+ \ CTEST_SOURCE_DIRECTORY
+ \ CTEST_SUBMIT_INACTIVITY_TIMEOUT
+ \ CTEST_SUBMIT_URL
+ \ CTEST_SVN_COMMAND
+ \ CTEST_SVN_OPTIONS
+ \ CTEST_SVN_UPDATE_OPTIONS
+ \ CTEST_TEST_LOAD
+ \ CTEST_TEST_TIMEOUT
+ \ CTEST_TRIGGER_SITE
+ \ CTEST_UPDATE_COMMAND
+ \ CTEST_UPDATE_OPTIONS
+ \ CTEST_UPDATE_VERSION_ONLY
+ \ CTEST_UPDATE_VERSION_OVERRIDE
+ \ CTEST_USE_LAUNCHERS
+ \ CYGWIN
+ \ DOXYGEN_ABBREVIATE_BRIEF
+ \ DOXYGEN_ALIASES
+ \ DOXYGEN_ALLEXTERNALS
+ \ DOXYGEN_ALLOW_UNICODE_NAMES
+ \ DOXYGEN_ALPHABETICAL_INDEX
+ \ DOXYGEN_ALWAYS_DETAILED_SEC
+ \ DOXYGEN_AUTOLINK_SUPPORT
+ \ DOXYGEN_BINARY_TOC
+ \ DOXYGEN_BRIEF_MEMBER_DESC
+ \ DOXYGEN_BUILTIN_STL_SUPPORT
+ \ DOXYGEN_CALLER_GRAPH
+ \ DOXYGEN_CALL_GRAPH
+ \ DOXYGEN_CASE_SENSE_NAMES
+ \ DOXYGEN_CHM_FILE
+ \ DOXYGEN_CHM_INDEX_ENCODING
+ \ DOXYGEN_CITE_BIB_FILES
+ \ DOXYGEN_CLANG_ASSISTED_PARSING
+ \ DOXYGEN_CLANG_DATABASE_PATH
+ \ DOXYGEN_CLANG_OPTIONS
+ \ DOXYGEN_CLASS_DIAGRAMS
+ \ DOXYGEN_CLASS_GRAPH
+ \ DOXYGEN_COLLABORATION_GRAPH
+ \ DOXYGEN_COLS_IN_ALPHA_INDEX
+ \ DOXYGEN_COMPACT_LATEX
+ \ DOXYGEN_COMPACT_RTF
+ \ DOXYGEN_CPP_CLI_SUPPORT
+ \ DOXYGEN_CREATE_SUBDIRS
+ \ DOXYGEN_DIAFILE_DIRS
+ \ DOXYGEN_DIA_PATH
+ \ DOXYGEN_DIRECTORY_GRAPH
+ \ DOXYGEN_DISABLE_INDEX
+ \ DOXYGEN_DISTRIBUTE_GROUP_DOC
+ \ DOXYGEN_DOCBOOK_OUTPUT
+ \ DOXYGEN_DOCBOOK_PROGRAMLISTING
+ \ DOXYGEN_DOCSET_BUNDLE_ID
+ \ DOXYGEN_DOCSET_FEEDNAME
+ \ DOXYGEN_DOCSET_PUBLISHER_ID
+ \ DOXYGEN_DOCSET_PUBLISHER_NAME
+ \ DOXYGEN_DOTFILE_DIRS
+ \ DOXYGEN_DOT_CLEANUP
+ \ DOXYGEN_DOT_FONTNAME
+ \ DOXYGEN_DOT_FONTPATH
+ \ DOXYGEN_DOT_FONTSIZE
+ \ DOXYGEN_DOT_GRAPH_MAX_NODES
+ \ DOXYGEN_DOT_IMAGE_FORMAT
+ \ DOXYGEN_DOT_MULTI_TARGETS
+ \ DOXYGEN_DOT_NUM_THREADS
+ \ DOXYGEN_DOT_PATH
+ \ DOXYGEN_DOT_TRANSPARENT
+ \ DOXYGEN_DOXYFILE_ENCODING
+ \ DOXYGEN_ECLIPSE_DOC_ID
+ \ DOXYGEN_ENABLED_SECTIONS
+ \ DOXYGEN_ENABLE_PREPROCESSING
+ \ DOXYGEN_ENUM_VALUES_PER_LINE
+ \ DOXYGEN_EXAMPLE_PATH
+ \ DOXYGEN_EXAMPLE_PATTERNS
+ \ DOXYGEN_EXAMPLE_RECURSIVE
+ \ DOXYGEN_EXCLUDE
+ \ DOXYGEN_EXCLUDE_PATTERNS
+ \ DOXYGEN_EXCLUDE_SYMBOLS
+ \ DOXYGEN_EXCLUDE_SYMLINKS
+ \ DOXYGEN_EXPAND_AS_DEFINED
+ \ DOXYGEN_EXPAND_ONLY_PREDEF
+ \ DOXYGEN_EXTENSION_MAPPING
+ \ DOXYGEN_EXTERNAL_GROUPS
+ \ DOXYGEN_EXTERNAL_PAGES
+ \ DOXYGEN_EXTERNAL_SEARCH
+ \ DOXYGEN_EXTERNAL_SEARCH_ID
+ \ DOXYGEN_EXTRACT_ALL
+ \ DOXYGEN_EXTRACT_ANON_NSPACES
+ \ DOXYGEN_EXTRACT_LOCAL_CLASSES
+ \ DOXYGEN_EXTRACT_LOCAL_METHODS
+ \ DOXYGEN_EXTRACT_PACKAGE
+ \ DOXYGEN_EXTRACT_PRIVATE
+ \ DOXYGEN_EXTRACT_PRIV_VIRTUAL
+ \ DOXYGEN_EXTRACT_STATIC
+ \ DOXYGEN_EXTRA_PACKAGES
+ \ DOXYGEN_EXTRA_SEARCH_MAPPINGS
+ \ DOXYGEN_EXT_LINKS_IN_WINDOW
+ \ DOXYGEN_FILE_PATTERNS
+ \ DOXYGEN_FILE_VERSION_FILTER
+ \ DOXYGEN_FILTER_PATTERNS
+ \ DOXYGEN_FILTER_SOURCE_FILES
+ \ DOXYGEN_FILTER_SOURCE_PATTERNS
+ \ DOXYGEN_FORCE_LOCAL_INCLUDES
+ \ DOXYGEN_FORMULA_FONTSIZE
+ \ DOXYGEN_FORMULA_TRANSPARENT
+ \ DOXYGEN_FULL_PATH_NAMES
+ \ DOXYGEN_GENERATE_AUTOGEN_DEF
+ \ DOXYGEN_GENERATE_BUGLIST
+ \ DOXYGEN_GENERATE_CHI
+ \ DOXYGEN_GENERATE_DEPRECATEDLIST
+ \ DOXYGEN_GENERATE_DOCBOOK
+ \ DOXYGEN_GENERATE_DOCSET
+ \ DOXYGEN_GENERATE_ECLIPSEHELP
+ \ DOXYGEN_GENERATE_HTML
+ \ DOXYGEN_GENERATE_HTMLHELP
+ \ DOXYGEN_GENERATE_LATEX
+ \ DOXYGEN_GENERATE_LEGEND
+ \ DOXYGEN_GENERATE_MAN
+ \ DOXYGEN_GENERATE_PERLMOD
+ \ DOXYGEN_GENERATE_QHP
+ \ DOXYGEN_GENERATE_RTF
+ \ DOXYGEN_GENERATE_TAGFILE
+ \ DOXYGEN_GENERATE_TESTLIST
+ \ DOXYGEN_GENERATE_TODOLIST
+ \ DOXYGEN_GENERATE_TREEVIEW
+ \ DOXYGEN_GENERATE_XML
+ \ DOXYGEN_GRAPHICAL_HIERARCHY
+ \ DOXYGEN_GROUP_GRAPHS
+ \ DOXYGEN_GROUP_NESTED_COMPOUNDS
+ \ DOXYGEN_HAVE_DOT
+ \ DOXYGEN_HHC_LOCATION
+ \ DOXYGEN_HIDE_COMPOUND_REFERENCE
+ \ DOXYGEN_HIDE_FRIEND_COMPOUNDS
+ \ DOXYGEN_HIDE_IN_BODY_DOCS
+ \ DOXYGEN_HIDE_SCOPE_NAMES
+ \ DOXYGEN_HIDE_UNDOC_CLASSES
+ \ DOXYGEN_HIDE_UNDOC_MEMBERS
+ \ DOXYGEN_HIDE_UNDOC_RELATIONS
+ \ DOXYGEN_HTML_COLORSTYLE_GAMMA
+ \ DOXYGEN_HTML_COLORSTYLE_HUE
+ \ DOXYGEN_HTML_COLORSTYLE_SAT
+ \ DOXYGEN_HTML_DYNAMIC_MENUS
+ \ DOXYGEN_HTML_DYNAMIC_SECTIONS
+ \ DOXYGEN_HTML_EXTRA_FILES
+ \ DOXYGEN_HTML_EXTRA_STYLESHEET
+ \ DOXYGEN_HTML_FILE_EXTENSION
+ \ DOXYGEN_HTML_FOOTER
+ \ DOXYGEN_HTML_HEADER
+ \ DOXYGEN_HTML_INDEX_NUM_ENTRIES
+ \ DOXYGEN_HTML_OUTPUT
+ \ DOXYGEN_HTML_STYLESHEET
+ \ DOXYGEN_HTML_TIMESTAMP
+ \ DOXYGEN_IDL_PROPERTY_SUPPORT
+ \ DOXYGEN_IGNORE_PREFIX
+ \ DOXYGEN_IMAGE_PATH
+ \ DOXYGEN_INCLUDED_BY_GRAPH
+ \ DOXYGEN_INCLUDE_FILE_PATTERNS
+ \ DOXYGEN_INCLUDE_GRAPH
+ \ DOXYGEN_INCLUDE_PATH
+ \ DOXYGEN_INHERIT_DOCS
+ \ DOXYGEN_INLINE_GROUPED_CLASSES
+ \ DOXYGEN_INLINE_INFO
+ \ DOXYGEN_INLINE_INHERITED_MEMB
+ \ DOXYGEN_INLINE_SIMPLE_STRUCTS
+ \ DOXYGEN_INLINE_SOURCES
+ \ DOXYGEN_INPUT
+ \ DOXYGEN_INPUT_ENCODING
+ \ DOXYGEN_INPUT_FILTER
+ \ DOXYGEN_INTERACTIVE_SVG
+ \ DOXYGEN_INTERNAL_DOCS
+ \ DOXYGEN_JAVADOC_AUTOBRIEF
+ \ DOXYGEN_JAVADOC_BANNER
+ \ DOXYGEN_LATEX_BATCHMODE
+ \ DOXYGEN_LATEX_BIB_STYLE
+ \ DOXYGEN_LATEX_CMD_NAME
+ \ DOXYGEN_LATEX_EMOJI_DIRECTORY
+ \ DOXYGEN_LATEX_EXTRA_FILES
+ \ DOXYGEN_LATEX_EXTRA_STYLESHEET
+ \ DOXYGEN_LATEX_FOOTER
+ \ DOXYGEN_LATEX_HEADER
+ \ DOXYGEN_LATEX_HIDE_INDICES
+ \ DOXYGEN_LATEX_MAKEINDEX_CMD
+ \ DOXYGEN_LATEX_OUTPUT
+ \ DOXYGEN_LATEX_SOURCE_CODE
+ \ DOXYGEN_LATEX_TIMESTAMP
+ \ DOXYGEN_LAYOUT_FILE
+ \ DOXYGEN_LOOKUP_CACHE_SIZE
+ \ DOXYGEN_MACRO_EXPANSION
+ \ DOXYGEN_MAKEINDEX_CMD_NAME
+ \ DOXYGEN_MAN_EXTENSION
+ \ DOXYGEN_MAN_LINKS
+ \ DOXYGEN_MAN_OUTPUT
+ \ DOXYGEN_MAN_SUBDIR
+ \ DOXYGEN_MARKDOWN_SUPPORT
+ \ DOXYGEN_MATHJAX_CODEFILE
+ \ DOXYGEN_MATHJAX_EXTENSIONS
+ \ DOXYGEN_MATHJAX_FORMAT
+ \ DOXYGEN_MATHJAX_RELPATH
+ \ DOXYGEN_MAX_DOT_GRAPH_DEPTH
+ \ DOXYGEN_MAX_INITIALIZER_LINES
+ \ DOXYGEN_MSCFILE_DIRS
+ \ DOXYGEN_MULTILINE_CPP_IS_BRIEF
+ \ DOXYGEN_OPTIMIZE_FOR_FORTRAN
+ \ DOXYGEN_OPTIMIZE_OUTPUT_FOR_C
+ \ DOXYGEN_OPTIMIZE_OUTPUT_JAVA
+ \ DOXYGEN_OPTIMIZE_OUTPUT_SLICE
+ \ DOXYGEN_OPTIMIZE_OUTPUT_VHDL
+ \ DOXYGEN_OUTPUT_DIRECTORY
+ \ DOXYGEN_OUTPUT_LANGUAGE
+ \ DOXYGEN_OUTPUT_TEXT_DIRECTION
+ \ DOXYGEN_PAPER_TYPE
+ \ DOXYGEN_PDF_HYPERLINKS
+ \ DOXYGEN_PERLMOD_LATEX
+ \ DOXYGEN_PERLMOD_MAKEVAR_PREFIX
+ \ DOXYGEN_PERLMOD_PRETTY
+ \ DOXYGEN_PLANTUML_CFG_FILE
+ \ DOXYGEN_PLANTUML_INCLUDE_PATH
+ \ DOXYGEN_PLANTUML_JAR_PATH
+ \ DOXYGEN_PREDEFINED
+ \ DOXYGEN_PROJECT_BRIEF
+ \ DOXYGEN_PROJECT_LOGO
+ \ DOXYGEN_PROJECT_NAME
+ \ DOXYGEN_PROJECT_NUMBER
+ \ DOXYGEN_QCH_FILE
+ \ DOXYGEN_QHG_LOCATION
+ \ DOXYGEN_QHP_CUST_FILTER_ATTRS
+ \ DOXYGEN_QHP_CUST_FILTER_NAME
+ \ DOXYGEN_QHP_NAMESPACE
+ \ DOXYGEN_QHP_SECT_FILTER_ATTRS
+ \ DOXYGEN_QHP_VIRTUAL_FOLDER
+ \ DOXYGEN_QT_AUTOBRIEF
+ \ DOXYGEN_QUIET
+ \ DOXYGEN_RECURSIVE
+ \ DOXYGEN_REFERENCED_BY_RELATION
+ \ DOXYGEN_REFERENCES_LINK_SOURCE
+ \ DOXYGEN_REFERENCES_RELATION
+ \ DOXYGEN_REPEAT_BRIEF
+ \ DOXYGEN_RTF_EXTENSIONS_FILE
+ \ DOXYGEN_RTF_HYPERLINKS
+ \ DOXYGEN_RTF_OUTPUT
+ \ DOXYGEN_RTF_SOURCE_CODE
+ \ DOXYGEN_RTF_STYLESHEET_FILE
+ \ DOXYGEN_SEARCHDATA_FILE
+ \ DOXYGEN_SEARCHENGINE
+ \ DOXYGEN_SEARCHENGINE_URL
+ \ DOXYGEN_SEARCH_INCLUDES
+ \ DOXYGEN_SEPARATE_MEMBER_PAGES
+ \ DOXYGEN_SERVER_BASED_SEARCH
+ \ DOXYGEN_SHORT_NAMES
+ \ DOXYGEN_SHOW_FILES
+ \ DOXYGEN_SHOW_GROUPED_MEMB_INC
+ \ DOXYGEN_SHOW_INCLUDE_FILES
+ \ DOXYGEN_SHOW_NAMESPACES
+ \ DOXYGEN_SHOW_USED_FILES
+ \ DOXYGEN_SIP_SUPPORT
+ \ DOXYGEN_SKIP_FUNCTION_MACROS
+ \ DOXYGEN_SORT_BRIEF_DOCS
+ \ DOXYGEN_SORT_BY_SCOPE_NAME
+ \ DOXYGEN_SORT_GROUP_NAMES
+ \ DOXYGEN_SORT_MEMBERS_CTORS_1ST
+ \ DOXYGEN_SORT_MEMBER_DOCS
+ \ DOXYGEN_SOURCE_BROWSER
+ \ DOXYGEN_SOURCE_TOOLTIPS
+ \ DOXYGEN_STRICT_PROTO_MATCHING
+ \ DOXYGEN_STRIP_CODE_COMMENTS
+ \ DOXYGEN_STRIP_FROM_INC_PATH
+ \ DOXYGEN_STRIP_FROM_PATH
+ \ DOXYGEN_SUBGROUPING
+ \ DOXYGEN_TAB_SIZE
+ \ DOXYGEN_TAGFILES
+ \ DOXYGEN_TCL_SUBST
+ \ DOXYGEN_TEMPLATE_RELATIONS
+ \ DOXYGEN_TOC_EXPAND
+ \ DOXYGEN_TOC_INCLUDE_HEADINGS
+ \ DOXYGEN_TREEVIEW_WIDTH
+ \ DOXYGEN_TYPEDEF_HIDES_STRUCT
+ \ DOXYGEN_UML_LIMIT_NUM_FIELDS
+ \ DOXYGEN_UML_LOOK
+ \ DOXYGEN_USE_HTAGS
+ \ DOXYGEN_USE_MATHJAX
+ \ DOXYGEN_USE_MDFILE_AS_MAINPAGE
+ \ DOXYGEN_USE_PDFLATEX
+ \ DOXYGEN_VERBATIM_HEADERS
+ \ DOXYGEN_VERBATIM_VARS
+ \ DOXYGEN_VERSION
+ \ DOXYGEN_WARNINGS
+ \ DOXYGEN_WARN_AS_ERROR
+ \ DOXYGEN_WARN_FORMAT
+ \ DOXYGEN_WARN_IF_DOC_ERROR
+ \ DOXYGEN_WARN_IF_UNDOCUMENTED
+ \ DOXYGEN_WARN_LOGFILE
+ \ DOXYGEN_WARN_NO_PARAMDOC
+ \ DOXYGEN_XML_NS_MEMB_FILE_SCOPE
+ \ DOXYGEN_XML_OUTPUT
+ \ DOXYGEN_XML_PROGRAMLISTING
+ \ ENV
+ \ EXECUTABLE_OUTPUT_PATH
+ \ GHSMULTI
+ \ IOS
+ \ LIBRARY_OUTPUT_PATH
+ \ LINUX
+ \ MINGW
+ \ MSVC
+ \ MSVC10
+ \ MSVC11
+ \ MSVC12
+ \ MSVC14
+ \ MSVC60
+ \ MSVC70
+ \ MSVC71
+ \ MSVC80
+ \ MSVC90
+ \ MSVC_IDE
+ \ MSVC_TOOLSET_VERSION
+ \ MSVC_VERSION
+ \ MSYS
+ \ PROJECT_BINARY_DIR
+ \ PROJECT_DESCRIPTION
+ \ PROJECT_HOMEPAGE_URL
+ \ PROJECT_IS_TOP_LEVEL
+ \ PROJECT_NAME
+ \ PROJECT_SOURCE_DIR
+ \ PROJECT_VERSION
+ \ PROJECT_VERSION_MAJOR
+ \ PROJECT_VERSION_MINOR
+ \ PROJECT_VERSION_PATCH
+ \ PROJECT_VERSION_TWEAK
+ \ UNIX
+ \ WIN32
+ \ WINCE
+ \ WINDOWS_PHONE
+ \ WINDOWS_STORE
+ \ XCODE
+ \ XCODE_VERSION
syn keyword cmakeModule contained
\ ExternalProject
+ \ FetchContent
syn keyword cmakeKWExternalProject contained
- \ ALGO AWS BINARY_DIR BUILD_ALWAYS BUILD_BYPRODUCTS BUILD_COMMAND BUILD_IN_SOURCE CMAKE_ARGS CMAKE_CACHE_ARGS CMAKE_CACHE_DEFAULT_ARGS CMAKE_TLS_CAINFO CMAKE_TLS_VERIFY COMMENT CONFIGURE_COMMAND CVS CVSROOT CVS_MODULE CVS_REPOSITORY CVS_TAG DEPENDEES DEPENDERS DEPENDS DOWNLOADED_FILE DOWNLOAD_COMMAND DOWNLOAD_DIR DOWNLOAD_NAME DOWNLOAD_NO_EXTRACT DOWNLOAD_NO_PROGRESS EP_BASE EP_INDEPENDENT_STEP_TARGETS EP_PREFIX EP_STEP_TARGETS EP_UPDATE_DISCONNECTED EXCLUDE_FROM_ALL FORCE GIT_CONFIG GIT_PROGRESS GIT_REMOTE_NAME GIT_REPOSITORY GIT_SHALLOW GIT_SUBMODULES GIT_TAG HG_REPOSITORY HG_TAG HTTP_HEADER HTTP_PASSWORD HTTP_USERNAME INDEPENDENT_STEP_TARGETS INSTALL_COMMAND INSTALL_DIR JOB_POOLS LIST_SEPARATOR LOG_ LOG_BUILD LOG_CONFIGURE LOG_DOWNLOAD LOG_INSTALL LOG_TEST LOG_UPDATE MAKE_EXE NAMES NOTE NO_DEPENDS PATCH_COMMAND PREFIX PROPERTY SOURCE_DIR SOURCE_SUBDIR STAMP_DIR STEP_TARGETS STRING SVN_PASSWORD SVN_REPOSITORY SVN_REVISION SVN_TRUST_CERT SVN_USERNAME TEST_AFTER_INSTALL TEST_BEFORE_INSTALL TEST_COMMAND TEST_EXCLUDE_FROM_MAIN TIMEOUT TLS_CAINFO TLS_VERIFY TMP_DIR TRUE UPDATE_COMMAND UPDATE_DISCONNECTED URL URL_HASH USES_TERMINAL_BUILD USES_TERMINAL_CONFIGURE USES_TERMINAL_DOWNLOAD USES_TERMINAL_INSTALL USES_TERMINAL_TEST USES_TERMINAL_UPDATE WORKING_DIRECTORY
+ \ AWS
+ \ BINARY_DIR
+ \ BUILD_ALWAYS
+ \ BUILD_BYPRODUCTS
+ \ BUILD_COMMAND
+ \ BUILD_IN_SOURCE
+ \ CHECKOUT
+ \ CMAKE_ARGS
+ \ CMAKE_CACHE_ARGS
+ \ CMAKE_CACHE_DEFAULT_ARGS
+ \ CMAKE_EP_GIT_REMOTE_UPDATE_STRATEGY
+ \ CMAKE_INSTALL_MODE
+ \ COMMENT
+ \ CONFIGURE_COMMAND
+ \ CONFIGURE_HANDLED_BY_BUILD
+ \ CVS
+ \ CVSROOT
+ \ CVS_MODULE
+ \ CVS_REPOSITORY
+ \ CVS_TAG
+ \ DEPENDEES
+ \ DEPENDERS
+ \ DEPENDS
+ \ DOWNLOADED_FILE
+ \ DOWNLOAD_COMMAND
+ \ DOWNLOAD_DIR
+ \ DOWNLOAD_EXTRACT_TIMESTAMP
+ \ DOWNLOAD_NAME
+ \ DOWNLOAD_NO_EXTRACT
+ \ DOWNLOAD_NO_PROGRESS
+ \ EP_BASE
+ \ EP_INDEPENDENT_STEP_TARGETS
+ \ EP_PREFIX
+ \ EP_STEP_TARGETS
+ \ EP_UPDATE_DISCONNECTED
+ \ EXCLUDE_FROM_ALL
+ \ FALSE
+ \ FORCE
+ \ GHS
+ \ GIT_CONFIG
+ \ GIT_PROGRESS
+ \ GIT_REMOTE_NAME
+ \ GIT_REMOTE_UPDATE_STRATEGY
+ \ GIT_REPOSITORY
+ \ GIT_SHALLOW
+ \ GIT_SUBMODULES
+ \ GIT_SUBMODULES_RECURSE
+ \ GIT_TAG
+ \ HG_REPOSITORY
+ \ HG_TAG
+ \ HTTP_HEADER
+ \ HTTP_PASSWORD
+ \ HTTP_USERNAME
+ \ IGNORED
+ \ INACTIVITY_TIMEOUT
+ \ INDEPENDENT_STEP_TARGETS
+ \ INSTALL_BYPRODUCTS
+ \ INSTALL_COMMAND
+ \ INSTALL_DIR
+ \ JOB_POOLS
+ \ LIST_SEPARATOR
+ \ LOG_BUILD
+ \ LOG_CONFIGURE
+ \ LOG_DIR
+ \ LOG_DOWNLOAD
+ \ LOG_INSTALL
+ \ LOG_MERGED_STDOUTERR
+ \ LOG_OUTPUT_ON_FAILURE
+ \ LOG_PATCH
+ \ LOG_TEST
+ \ LOG_UPDATE
+ \ MAKE_EXE
+ \ MULTI
+ \ NAMES
+ \ NETRC
+ \ NETRC_FILE
+ \ NOTE
+ \ NO_DEPENDS
+ \ OPTIONAL
+ \ PATCH_COMMAND
+ \ PREFIX
+ \ PROPERTY
+ \ REBASE
+ \ REBASE_CHECKOUT
+ \ REQUIRED
+ \ SOURCE_DIR
+ \ SOURCE_SUBDIR
+ \ STAMP_DIR
+ \ STEP_TARGETS
+ \ STRING
+ \ SVN_PASSWORD
+ \ SVN_REPOSITORY
+ \ SVN_REVISION
+ \ SVN_TRUST_CERT
+ \ SVN_USERNAME
+ \ TEST_AFTER_INSTALL
+ \ TEST_BEFORE_INSTALL
+ \ TEST_COMMAND
+ \ TEST_EXCLUDE_FROM_MAIN
+ \ TIMEOUT
+ \ TLS_CAINFO
+ \ TLS_VERIFY
+ \ TMP_DIR
+ \ TRUE
+ \ UPDATE_COMMAND
+ \ UPDATE_DISCONNECTED
+ \ URL
+ \ URL_HASH
+ \ URL_MD5
+ \ USES_TERMINAL_BUILD
+ \ USES_TERMINAL_CONFIGURE
+ \ USES_TERMINAL_DOWNLOAD
+ \ USES_TERMINAL_INSTALL
+ \ USES_TERMINAL_PATCH
+ \ USES_TERMINAL_TEST
+ \ USES_TERMINAL_UPDATE
+ \ WORKING_DIRECTORY
+
+syn keyword cmakeKWFetchContent contained
+ \ ALWAYS
+ \ BINARY_DIR
+ \ BUILD_COMMAND
+ \ BYPASS_PROVIDER
+ \ CMAKE_PROJECT_
+ \ CONFIGURE_COMMAND
+ \ COPY
+ \ CORRECT
+ \ DCMAKE_TOOLCHAIN_FILE
+ \ DESTINATION
+ \ DOWNLOAD_NO_EXTRACT
+ \ EXISTS
+ \ FETCHCONTENT_BASE_DIR
+ \ FETCHCONTENT_FULLY_DISCONNECTED
+ \ FETCHCONTENT_MAKEAVAILABLE_SERIAL
+ \ FETCHCONTENT_QUIET
+ \ FETCHCONTENT_SOURCE_DIR_
+ \ FETCHCONTENT_TRY_FIND_PACKAGE_MODE
+ \ FETCHCONTENT_UPDATES_DISCONNECTED
+ \ FETCHCONTENT_UPDATES_DISCONNECTED_
+ \ FIND_PACKAGE_ARGS
+ \ GIT_REPOSITORY
+ \ GIT_TAG
+ \ GLOBAL
+ \ GTEST_BOTH_LIBRARIES
+ \ GTEST_LIBRARIES
+ \ GTEST_MAIN_LIBRARIES
+ \ INSTALL_COMMAND
+ \ INTERNAL
+ \ NAME
+ \ NAMES
+ \ NEVER
+ \ NOTE
+ \ OFF
+ \ OPTIONAL
+ \ OPT_IN
+ \ OVERRIDE_FIND_PACKAGE
+ \ PACKAGE_VERSION_COMPATIBLE
+ \ PACKAGE_VERSION_EXACT
+ \ QUIET
+ \ SOURCE_SUBDIR
+ \ STREQUAL
+ \ SUBBUILD_DIR
+ \ SVN_REPOSITORY
+ \ SVN_REVISION
+ \ SYSTEM
+ \ TARGET
+ \ TEST_COMMAND
+ \ TRUE
+ \ URL
+ \ URL_HASH
+ \ VERIFY_INTERFACE_HEADER_SETS
+ \ WRITE
+ \ WRONG
+ \ _BINARY_DIR
+ \ _INCLUDE
+ \ _POPULATED
+ \ _SOURCE_DIR
+
+syn keyword cmakeKWadd_compile_definitions contained
+ \ COMPILE_DEFINITIONS
+ \ VAR
syn keyword cmakeKWadd_compile_options contained
+ \ CMAKE_
+ \ COMPILE_LANGUAGE
\ COMPILE_OPTIONS
+ \ CONFIG
+ \ SHELL
+ \ UNIX_COMMAND
+ \ _FLAGS
+ \ _FLAGS_
syn keyword cmakeKWadd_custom_command contained
- \ APPEND ARGS BYPRODUCTS CC COMMAND COMMAND_EXPAND_LISTS COMMENT CROSSCOMPILING_EMULATOR DEPENDS DEPFILE GENERATED IMPLICIT_DEPENDS INCLUDE_DIRECTORIES JOIN MAIN_DEPENDENCY NOT OUTPUT POST_BUILD PRE_BUILD PRE_LINK SYMBOLIC TARGET_FILE TARGET_PROPERTY USES_TERMINAL VERBATIM WORKING_DIRECTORY
+ \ APPEND
+ \ ARGS
+ \ BNF
+ \ BYPRODUCTS
+ \ CC
+ \ COMMAND
+ \ COMMAND_EXPAND_LISTS
+ \ COMMENT
+ \ CONFIG
+ \ CROSSCOMPILING_EMULATOR
+ \ DEPENDS
+ \ DEPENDS_EXPLICIT_ONLY
+ \ DEPFILE
+ \ GENERATED
+ \ IMPLICIT_DEPENDS
+ \ INCLUDE_DIRECTORIES
+ \ JOB_POOL
+ \ JOB_POOLS
+ \ JOIN
+ \ MAIN_DEPENDENCY
+ \ MODULE
+ \ NOT
+ \ OUTPUT
+ \ PATH
+ \ POST_BUILD
+ \ PRE_BUILD
+ \ PRE_LINK
+ \ SYMBOLIC
+ \ TARGET_FILE
+ \ TARGET_LINKER_FILE
+ \ TARGET_PDB_FILE
+ \ TARGET_PROPERTY
+ \ TARGET_SONAME_FILE
+ \ USES_TERMINAL
+ \ VERBATIM
+ \ WORKING_DIRECTORY
syn keyword cmakeKWadd_custom_target contained
- \ ALL BYPRODUCTS CC COMMAND COMMAND_EXPAND_LISTS COMMENT CROSSCOMPILING_EMULATOR DEPENDS GENERATED INCLUDE_DIRECTORIES JOIN SOURCES TARGET_PROPERTY USES_TERMINAL VERBATIM WORKING_DIRECTORY
+ \ ALL
+ \ BYPRODUCTS
+ \ CC
+ \ COMMAND
+ \ COMMAND_EXPAND_LISTS
+ \ COMMENT
+ \ CROSSCOMPILING_EMULATOR
+ \ DEPENDS
+ \ GENERATED
+ \ INCLUDE_DIRECTORIES
+ \ JOB_POOL
+ \ JOB_POOLS
+ \ JOIN
+ \ PATH
+ \ SOURCES
+ \ TARGET_FILE
+ \ TARGET_LINKER_FILE
+ \ TARGET_PDB_FILE
+ \ TARGET_PROPERTY
+ \ TARGET_SONAME_FILE
+ \ USES_TERMINAL
+ \ VERBATIM
+ \ WORKING_DIRECTORY
syn keyword cmakeKWadd_definitions contained
\ COMPILE_DEFINITIONS
syn keyword cmakeKWadd_dependencies contained
- \ DEPENDS OBJECT_DEPENDS
+ \ DEPENDS
+ \ OBJECT_DEPENDS
syn keyword cmakeKWadd_executable contained
- \ ALIAS CONFIG EXCLUDE_FROM_ALL GLOBAL HEADER_FILE_ONLY IMPORTED IMPORTED_ IMPORTED_LOCATION IMPORTED_LOCATION_ MACOSX_BUNDLE OUTPUT_NAME RUNTIME_OUTPUT_DIRECTORY TARGET
+ \ ALIAS
+ \ ALIAS_GLOBAL
+ \ CONFIG
+ \ EXCLUDE_FROM_ALL
+ \ GLOBAL
+ \ HEADER_FILE_ONLY
+ \ IMPORTED
+ \ IMPORTED_
+ \ IMPORTED_LOCATION
+ \ IMPORTED_LOCATION_
+ \ MACOSX_BUNDLE
+ \ OUTPUT_NAME
+ \ RUNTIME_OUTPUT_DIRECTORY
+ \ TARGET
syn keyword cmakeKWadd_library contained
- \ ALIAS ARCHIVE_OUTPUT_DIRECTORY CLI CONFIG DLL EXCLUDE_FROM_ALL FRAMEWORK GLOBAL HEADER_FILE_ONLY IMPORTED IMPORTED_ IMPORTED_LOCATION IMPORTED_LOCATION_ INTERFACE_ LIBRARY_OUTPUT_DIRECTORY MODULE OBJECT ON OUTPUT_NAME POSITION_INDEPENDENT_CODE POST_BUILD PRE_BUILD PRE_LINK RUNTIME_OUTPUT_DIRECTORY SHARED STATIC TARGET_OBJECTS UNKNOWN
+ \ ALIAS
+ \ ALIAS_GLOBAL
+ \ ARCHIVE_OUTPUT_DIRECTORY
+ \ CLI
+ \ CONFIG
+ \ DLL
+ \ EXCLUDE_FROM_ALL
+ \ FRAMEWORK
+ \ GLOBAL
+ \ HEADER_FILE_ONLY
+ \ HEADER_SETS
+ \ IMPORTED
+ \ IMPORTED_
+ \ IMPORTED_IMPLIB
+ \ IMPORTED_IMPLIB_
+ \ IMPORTED_LOCATION
+ \ IMPORTED_LOCATION_
+ \ IMPORTED_NO_SONAME
+ \ IMPORTED_OBJECTS
+ \ IMPORTED_OBJECTS_
+ \ IMPORTED_SONAME
+ \ INTERFACE
+ \ INTERFACE_
+ \ INTERFACE_SOURCES
+ \ LC_ID_DYLIB
+ \ LIBRARY_OUTPUT_DIRECTORY
+ \ MODULE
+ \ OBJECT
+ \ ON
+ \ OUTPUT_NAME
+ \ POSITION_INDEPENDENT_CODE
+ \ POST_BUILD
+ \ PRE_BUILD
+ \ PRE_LINK
+ \ PRIVATE_HEADER
+ \ PUBLIC_HEADER
+ \ RUNTIME_OUTPUT_DIRECTORY
+ \ SHARED
+ \ SONAME
+ \ SOURCES
+ \ STATIC
+ \ TARGETS
+ \ TARGET_OBJECTS
+ \ TARGET_RUNTIME_DLLS
+ \ UNKNOWN
+
+syn keyword cmakeKWadd_link_options contained
+ \ CMAKE_
+ \ CONFIG
+ \ CUDA_RESOLVE_DEVICE_SYMBOLS
+ \ CUDA_SEPARABLE_COMPILATION
+ \ DEVICE_LINK
+ \ GCC
+ \ HOST_LINK
+ \ LANG
+ \ LINKER
+ \ LINK_OPTIONS
+ \ SHELL
+ \ STATIC_LIBRARY_OPTIONS
+ \ UNIX_COMMAND
+ \ _FLAGS
+ \ _FLAGS_
+ \ _LINKER_WRAPPER_FLAG
+ \ _LINKER_WRAPPER_FLAG_SEP
syn keyword cmakeKWadd_subdirectory contained
\ EXCLUDE_FROM_ALL
+ \ SYSTEM
syn keyword cmakeKWadd_test contained
- \ BUILD_TESTING COMMAND CONFIGURATIONS FAIL_REGULAR_EXPRESSION NAME PASS_REGULAR_EXPRESSION TARGET_FILE WILL_FAIL WORKING_DIRECTORY
+ \ BUILD_TESTING
+ \ COMMAND
+ \ COMMAND_EXPAND_LISTS
+ \ CONFIGURATIONS
+ \ FAIL_REGULAR_EXPRESSION
+ \ NAME
+ \ OFF
+ \ PASS_REGULAR_EXPRESSION
+ \ SKIP_REGULAR_EXPRESSION
+ \ TARGET_FILE
+ \ WILL_FAIL
+ \ WILL_FALL
+ \ WORKING_DIRECTORY
+
+syn keyword cmakeKWblock contained
+ \ PARENT_SCOPE
+ \ POLICIES
+ \ PROPAGATE
+ \ PUSH
+ \ SCOPE_FOR
+ \ TRUE
+ \ VARIABLES
syn keyword cmakeKWbuild_command contained
- \ CONFIGURATION TARGET
+ \ CONFIGURATION
+ \ PARALLEL_LEVEL
+ \ TARGET
-syn keyword cmakeKWbuild_name contained
- \ CMAKE_CXX_COMPILER
+syn keyword cmakeKWcmake_file_api contained
+ \ API
+ \ API_VERSION
+ \ BUILD_DIR
+ \ CMAKEFILES
+ \ CODEMODEL
+ \ COMMAND
+ \ CONFIG
+ \ QUERY
+ \ TOOLCHAINS
syn keyword cmakeKWcmake_host_system_information contained
- \ AVAILABLE_PHYSICAL_MEMORY AVAILABLE_VIRTUAL_MEMORY FQDN HAS_FPU HAS_MMX HAS_MMX_PLUS HAS_SERIAL_NUMBER HAS_SSE HAS_SSE_FP HAS_SSE_MMX HOSTNAME ID NUMBER_OF_LOGICAL_CORES NUMBER_OF_PHYSICAL_CORES OS_NAME OS_PLATFORM OS_RELEASE OS_VERSION PROCESSOR_DESCRIPTION PROCESSOR_NAME PROCESSOR_SERIAL_NUMBER QUERY RESULT TOTAL_PHYSICAL_MEMORY TOTAL_VIRTUAL_MEMORY
+ \ APPEND
+ \ AVAILABLE_PHYSICAL_MEMORY
+ \ AVAILABLE_VIRTUAL_MEMORY
+ \ BOTH
+ \ CMAKE_GET_OS_RELEASE_FALLBACK_CONTENT
+ \ CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_
+ \ CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_ID
+ \ CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_NAME
+ \ CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_PRETTY_NAME
+ \ CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_VERSION
+ \ CMAKE_GET_OS_RELEASE_FALLBACK_RESULT_VERSION_ID
+ \ CMAKE_GET_OS_RELEASE_FALLBACK_SCRIPTS
+ \ DISTRIB_INFO
+ \ DISTRIB_PRETTY_NAME
+ \ DISTRO
+ \ DISTRO_BUG_REPORT_URL
+ \ DISTRO_HOME_URL
+ \ DISTRO_ID
+ \ DISTRO_ID_LIKE
+ \ DISTRO_NAME
+ \ DISTRO_PRETTY_NAME
+ \ DISTRO_PRIVACY_POLICY_URL
+ \ DISTRO_SUPPORT_URL
+ \ DISTRO_UBUNTU_CODENAME
+ \ DISTRO_VERSION
+ \ DISTRO_VERSION_CODENAME
+ \ DISTRO_VERSION_ID
+ \ ERROR_VARIABLE
+ \ EXISTS
+ \ FQDN
+ \ HAS_FPU
+ \ HAS_MMX
+ \ HAS_MMX_PLUS
+ \ HAS_SERIAL_NUMBER
+ \ HAS_SSE
+ \ HAS_SSE_FP
+ \ HAS_SSE_MMX
+ \ HKCC
+ \ HKCR
+ \ HKCU
+ \ HKEY_CLASSES_ROOT
+ \ HKEY_CURRENT_CONFIG
+ \ HKEY_CURRENT_USER
+ \ HKEY_LOCAL_MACHINE
+ \ HKEY_USERS
+ \ HKLM
+ \ HKU
+ \ HOSTNAME
+ \ ID
+ \ LIMIT_COUNT
+ \ LISTS
+ \ LTS
+ \ MATCHES
+ \ NNN
+ \ NOT
+ \ NUMBER_OF_LOGICAL_CORES
+ \ NUMBER_OF_PHYSICAL_CORES
+ \ OS_NAME
+ \ OS_PLATFORM
+ \ OS_RELEASE
+ \ OS_VERSION
+ \ PRETTY_NAME
+ \ PROCESSOR_DESCRIPTION
+ \ PROCESSOR_NAME
+ \ PROCESSOR_SERIAL_NUMBER
+ \ QUERY
+ \ REG_DWORD
+ \ REG_EXPAND_SZ
+ \ REG_MULTI_SZ
+ \ REG_QWORD
+ \ REG_SZ
+ \ RESULT
+ \ SEPARATOR
+ \ SOFTWARE
+ \ STATUS
+ \ STRINGS
+ \ SUBKEYS
+ \ TARGET
+ \ TOTAL_PHYSICAL_MEMORY
+ \ TOTAL_VIRTUAL_MEMORY
+ \ VALUE_NAMES
+ \ VAR
+ \ VIEW
+ \ WINDOWS_REGISTRY
+
+syn keyword cmakeKWcmake_language contained
+ \ AND
+ \ ANY
+ \ APPEND
+ \ ARGN
+ \ BINARY_DIR
+ \ BYPASS_PROVIDER
+ \ CALL
+ \ CANCEL_CALL
+ \ CODE
+ \ COMMAND
+ \ COMMAND_ERROR_IS_FATAL
+ \ DCMAKE_PROJECT_TOP_LEVEL_INCLUDES
+ \ DEFER
+ \ DIRECTORY
+ \ EVAL
+ \ FALSE
+ \ FETCHCONTENT_MAKEAVAILABE_SERIAL
+ \ FETCHCONTENT_MAKEAVAILABLE_SERIAL
+ \ FETCHCONTENT_SOURCE_DIR_
+ \ FETCHCONTENT_TRY_FIND_PACKAGE_MODE
+ \ FIND_PACKAGE
+ \ FIND_PACKAGE_ARGS
+ \ GET_CALL_IDS
+ \ GET_MESSAGE_LOG_LEVEL
+ \ GIT_REPOSITORY
+ \ GIT_SUBMODULES
+ \ GIT_TAG
+ \ ID_VAR
+ \ MATCHES
+ \ MYCOMP_PROVIDER_INSTALL_DIR
+ \ NEVER
+ \ NOT
+ \ OVERRIDE_FIND_PACKAGE
+ \ PATH
+ \ POP_BACK
+ \ QUIET
+ \ SET_DEPENDENCY_PROVIDER
+ \ SOURCE_DIR
+ \ STATUS
+ \ STREQUAL
+ \ SUPPORTED_METHODS
+ \ TRUE
+ \ VERSION
+ \ WRITE
+ \ _FOUND
+ \ _PATH
syn keyword cmakeKWcmake_minimum_required contained
- \ FATAL_ERROR VERSION
+ \ FATAL_ERROR
+ \ VERSION
syn keyword cmakeKWcmake_parse_arguments contained
- \ ARGN CONFIGURATIONS DESTINATION FALSE FAST FILES MY_INSTALL MY_INSTALL_CONFIGURATIONS MY_INSTALL_DESTINATION MY_INSTALL_FAST MY_INSTALL_OPTIONAL MY_INSTALL_RENAME MY_INSTALL_TARGETS MY_INSTALL_UNPARSED_ARGUMENTS OPTIONAL PARSE_ARGV RENAME TARGETS TRUE _UNPARSED_ARGUMENTS
+ \ ARGN
+ \ CONFIGURATIONS
+ \ DESTINATION
+ \ FALSE
+ \ FAST
+ \ FILES
+ \ MY_INSTALL
+ \ MY_INSTALL_CONFIGURATIONS
+ \ MY_INSTALL_DESTINATION
+ \ MY_INSTALL_FAST
+ \ MY_INSTALL_KEYWORDS_MISSING_VALUES
+ \ MY_INSTALL_OPTIONAL
+ \ MY_INSTALL_RENAME
+ \ MY_INSTALL_TARGETS
+ \ MY_INSTALL_UNPARSED_ARGUMENTS
+ \ OPTIONAL
+ \ PARSE_ARGV
+ \ RENAME
+ \ TARGETS
+ \ TRUE
+ \ UNDEFINED
+ \ _KEYWORDS_MISSING_VALUES
+ \ _UNPARSED_ARGUMENTS
+
+syn keyword cmakeKWcmake_path contained
+ \ ABSOLUTE_PATH
+ \ AND
+ \ APPEND
+ \ APPEND_STRING
+ \ BASE_DIRECTORY
+ \ COMPARE
+ \ CONVERT
+ \ EQUAL
+ \ EXTENSION
+ \ EXTENSION_DEF
+ \ FALSE
+ \ FILENAME
+ \ FILENAME_DEF
+ \ GET
+ \ GET_EXTENSION
+ \ GET_FILENAME
+ \ GET_PARENT_PATH
+ \ GET_RELATIVE_PART
+ \ GET_ROOT_DIRECTORY
+ \ GET_ROOT_NAME
+ \ GET_ROOT_PATH
+ \ GET_STEM
+ \ HASH
+ \ HAS_EXTENSION
+ \ HAS_FILENAME
+ \ HAS_PARENT_PATH
+ \ HAS_RELATIVE_PART
+ \ HAS_ROOT_DIRECTORY
+ \ HAS_ROOT_NAME
+ \ HAS_ROOT_PATH
+ \ HAS_STEM
+ \ IS_ABSOLUTE
+ \ IS_PREFIX
+ \ IS_RELATIVE
+ \ LAST_ONLY
+ \ MATCHES
+ \ NATIVE_PATH
+ \ NORMALIZE
+ \ NORMAL_PATH
+ \ NOT_EQUAL
+ \ OP
+ \ OUTPUT_VARIABLE
+ \ PARENT_PATH
+ \ REAL_PATH
+ \ RELATIVE_PART
+ \ RELATIVE_PATH
+ \ REMOVE_EXTENSION
+ \ REMOVE_FILENAME
+ \ REPLACE_EXTENSION
+ \ REPLACE_FILENAME
+ \ ROOT_DIRECTORY
+ \ ROOT_NAME
+ \ ROOT_PATH
+ \ SET
+ \ STEM
+ \ STREQUAL
+ \ TO_CMAKE_PATH_LIST
+ \ TO_NATIVE_PATH_LIST
+ \ TRUE
+ \ XOR
syn keyword cmakeKWcmake_policy contained
- \ CMAKE_POLICY_DEFAULT_CMP CMP GET NNNN NO_POLICY_SCOPE OLD POP PUSH SET VERSION
+ \ CMAKE_POLICY_DEFAULT_CMP
+ \ CMP
+ \ GET
+ \ NNNN
+ \ NO_POLICY_SCOPE
+ \ OLD
+ \ POLICIES
+ \ POP
+ \ PUSH
+ \ SCOPE_FOR
+ \ SET
+ \ VERSION
syn keyword cmakeKWconfigure_file contained
- \ COPYONLY CRLF DOS ESCAPE_QUOTES FOO_ENABLE FOO_STRING LF NEWLINE_STYLE VAR
+ \ COPYONLY
+ \ CRLF
+ \ DOS
+ \ ESCAPE_QUOTES
+ \ FILE_PERMISSIONS
+ \ FOO_ENABLE
+ \ FOO_STRING
+ \ GENERATE
+ \ INTERFACE
+ \ LF
+ \ NEWLINE_STYLE
+ \ NO_SOURCE_PERMISSIONS
+ \ PRIVATE
+ \ PUBLIC
+ \ SYSTEM
+ \ USE_SOURCE_PERMISSIONS
+ \ VAR
syn keyword cmakeKWcreate_test_sourcelist contained
- \ CMAKE_TESTDRIVER_AFTER_TESTMAIN CMAKE_TESTDRIVER_BEFORE_TESTMAIN EXTRA_INCLUDE FUNCTION
+ \ CMAKE_TESTDRIVER_AFTER_TESTMAIN
+ \ CMAKE_TESTDRIVER_BEFORE_TESTMAIN
+ \ EXTRA_INCLUDE
+ \ FUNCTION
syn keyword cmakeKWctest_build contained
- \ ALL_BUILD APPEND BUILD CAPTURE_CMAKE_ERROR CONFIGURATION CTEST_BUILD_CONFIGURATION CTEST_BUILD_FLAGS CTEST_BUILD_TARGET CTEST_PROJECT_NAME FLAGS NUMBER_ERRORS NUMBER_WARNINGS QUIET RETURN_VALUE TARGET
+ \ ALL_BUILD
+ \ APPEND
+ \ BUILD
+ \ CAPTURE_CMAKE_ERROR
+ \ CMAKE_BUILD_PARALLEL_LEVEL
+ \ CONFIGURATION
+ \ CTEST_BUILD_CONFIGURATION
+ \ CTEST_BUILD_FLAGS
+ \ CTEST_BUILD_TARGET
+ \ FLAGS
+ \ NUMBER_ERRORS
+ \ NUMBER_WARNINGS
+ \ PARALLEL_LEVEL
+ \ QUIET
+ \ RETURN_VALUE
+ \ TARGET
syn keyword cmakeKWctest_configure contained
- \ APPEND BUILD CAPTURE_CMAKE_ERROR OPTIONS QUIET RETURN_VALUE SOURCE
+ \ APPEND
+ \ BUILD
+ \ CAPTURE_CMAKE_ERROR
+ \ OPTIONS
+ \ QUIET
+ \ RETURN_VALUE
+ \ SOURCE
syn keyword cmakeKWctest_coverage contained
- \ APPEND BUILD CAPTURE_CMAKE_ERROR LABELS QUIET RETURN_VALUE
+ \ APPEND
+ \ BUILD
+ \ CAPTURE_CMAKE_ERROR
+ \ LABELS
+ \ QUIET
+ \ RETURN_VALUE
syn keyword cmakeKWctest_memcheck contained
- \ APPEND BUILD DEFECT_COUNT EXCLUDE EXCLUDE_FIXTURE EXCLUDE_FIXTURE_CLEANUP EXCLUDE_FIXTURE_SETUP EXCLUDE_LABEL INCLUDE INCLUDE_LABEL OFF ON PARALLEL_LEVEL QUIET RETURN_VALUE SCHEDULE_RANDOM START STOP_TIME STRIDE TEST_LOAD
+ \ APPEND
+ \ BUILD
+ \ CAPTURE_CMAKE_ERROR
+ \ DEFECT_COUNT
+ \ EXCLUDE
+ \ EXCLUDE_FIXTURE
+ \ EXCLUDE_FIXTURE_CLEANUP
+ \ EXCLUDE_FIXTURE_SETUP
+ \ EXCLUDE_LABEL
+ \ INCLUDE
+ \ INCLUDE_LABEL
+ \ OFF
+ \ ON
+ \ OUTPUT_JUNIT
+ \ PARALLEL_LEVEL
+ \ QUIET
+ \ REPEAT
+ \ RESOURCE_SPEC_FILE
+ \ RETURN_VALUE
+ \ SCHEDULE_RANDOM
+ \ START
+ \ STOP_ON_FAILURE
+ \ STOP_TIME
+ \ STRIDE
+ \ TEST_LOAD
syn keyword cmakeKWctest_run_script contained
- \ NEW_PROCESS RETURN_VALUE
+ \ NEW_PROCESS
+ \ RETURN_VALUE
syn keyword cmakeKWctest_start contained
- \ APPEND QUIET TAG TRACK
+ \ APPEND
+ \ GROUP
+ \ QUIET
+ \ TAG
+ \ TRACK
syn keyword cmakeKWctest_submit contained
- \ API CDASH_UPLOAD CDASH_UPLOAD_TYPE CTEST_EXTRA_SUBMIT_FILES CTEST_NOTES_FILES FILES HTTPHEADER PARTS QUIET RETRY_COUNT RETRY_DELAY RETURN_VALUE
+ \ API
+ \ BUILD_ID
+ \ CAPTURE_CMAKE_ERROR
+ \ CDASH_UPLOAD
+ \ CDASH_UPLOAD_TYPE
+ \ CTEST_EXTRA_SUBMIT_FILES
+ \ CTEST_NOTES_FILES
+ \ FILES
+ \ HTTPHEADER
+ \ PARTS
+ \ QUIET
+ \ RETRY_COUNT
+ \ RETRY_DELAY
+ \ RETURN_VALUE
+ \ SUBMIT_URL
syn keyword cmakeKWctest_test contained
- \ APPEND BUILD CAPTURE_CMAKE_ERROR CPU EXCLUDE EXCLUDE_FIXTURE EXCLUDE_FIXTURE_CLEANUP EXCLUDE_FIXTURE_SETUP EXCLUDE_LABEL INCLUDE INCLUDE_LABEL OFF ON PARALLEL_LEVEL QUIET RETURN_VALUE SCHEDULE_RANDOM START STOP_TIME STRIDE TEST_LOAD
+ \ AFTER_TIMEOUT
+ \ APPEND
+ \ ATTACHED_FILES
+ \ ATTACHED_FILES_ON_FAIL
+ \ BUILD
+ \ CAPTURE_CMAKE_ERROR
+ \ CPU
+ \ EXCLUDE
+ \ EXCLUDE_FIXTURE
+ \ EXCLUDE_FIXTURE_CLEANUP
+ \ EXCLUDE_FIXTURE_SETUP
+ \ EXCLUDE_LABEL
+ \ INCLUDE
+ \ INCLUDE_LABEL
+ \ LABELS
+ \ OFF
+ \ ON
+ \ OUTPUT_JUNIT
+ \ PARALLEL_LEVEL
+ \ QUIET
+ \ REPEAT
+ \ RESOURCE_SPEC_FILE
+ \ RETURN_VALUE
+ \ SCHEDULE_RANDOM
+ \ START
+ \ STOP_ON_FAILURE
+ \ STOP_TIME
+ \ STRIDE
+ \ TEST_LOAD
+ \ UNTIL_FAIL
+ \ UNTIL_PASS
+ \ URL
+ \ XML
syn keyword cmakeKWctest_update contained
- \ QUIET RETURN_VALUE SOURCE
+ \ CAPTURE_CMAKE_ERROR
+ \ QUIET
+ \ RETURN_VALUE
+ \ SOURCE
syn keyword cmakeKWctest_upload contained
- \ CAPTURE_CMAKE_ERROR FILES QUIET
+ \ CAPTURE_CMAKE_ERROR
+ \ FILES
+ \ QUIET
syn keyword cmakeKWdefine_property contained
- \ BRIEF_DOCS CACHED_VARIABLE DIRECTORY FULL_DOCS GLOBAL INHERITED PROPERTY SOURCE TARGET TEST VARIABLE
+ \ APPEND
+ \ APPEND_STRING
+ \ BRIEF_DOCS
+ \ CACHED_VARIABLE
+ \ CMAKE_
+ \ DIRECTORY
+ \ FULL_DOCS
+ \ GLOBAL
+ \ INHERITED
+ \ INITIALIZE_FROM_VARIABLE
+ \ PROPERTY
+ \ SOURCE
+ \ TARGET
+ \ TEST
+ \ VARIABLE
+ \ _CMAKE_
+
+syn keyword cmakeKWdoxygen_add_docs contained
+ \ ALL
+ \ COMMENT
+ \ USE_STAMP_FILE
+ \ WORKING_DIRECTORY
syn keyword cmakeKWenable_language contained
+ \ ASM
+ \ ASM_MARMASM
+ \ ASM_MASM
+ \ ASM_NASM
+ \ ATT
+ \ CUDA
+ \ HIP
+ \ ISPC
+ \ OBJC
+ \ OBJCXX
\ OPTIONAL
+syn keyword cmakeKWenable_testing contained
+ \ BUILD_TESTING
+
syn keyword cmakeKWexec_program contained
- \ ARGS OUTPUT_VARIABLE RETURN_VALUE
+ \ ARGS
+ \ OUTPUT_VARIABLE
+ \ RETURN_VALUE
syn keyword cmakeKWexecute_process contained
- \ ANSI AUTO COMMAND ENCODING ERROR_FILE ERROR_QUIET ERROR_STRIP_TRAILING_WHITESPACE ERROR_VARIABLE INPUT_FILE NONE OEM OUTPUT_FILE OUTPUT_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE RESULTS_VARIABLE RESULT_VARIABLE TIMEOUT UTF VERBATIM WORKING_DIRECTORY
+ \ ANSI
+ \ ANY
+ \ AUTO
+ \ COMMAND
+ \ COMMAND_ECHO
+ \ COMMAND_ERROR_IS_FATAL
+ \ ECHO_ERROR_VARIABLE
+ \ ECHO_OUTPUT_VARIABLE
+ \ ENCODING
+ \ ERROR_FILE
+ \ ERROR_QUIET
+ \ ERROR_STRIP_TRAILING_WHITESPACE
+ \ ERROR_VARIABLE
+ \ INPUT_FILE
+ \ LAST
+ \ NONE
+ \ OEM
+ \ OUTPUT_FILE
+ \ OUTPUT_QUIET
+ \ OUTPUT_STRIP_TRAILING_WHITESPACE
+ \ OUTPUT_VARIABLE
+ \ POSIX
+ \ RESULTS_VARIABLE
+ \ RESULT_VARIABLE
+ \ RFC
+ \ STDERR
+ \ STDOUT
+ \ TIMEOUT
+ \ UTF
+ \ WORKING_DIRECTORY
syn keyword cmakeKWexport contained
- \ ANDROID_MK APPEND CONFIG EXPORT EXPORT_LINK_INTERFACE_LIBRARIES FILE IMPORTED IMPORTED_ NAMESPACE NDK OLD PACKAGE TARGETS
+ \ ANDROID_MK
+ \ APPEND
+ \ CONFIG
+ \ CXX_MODULES_DIRECTORY
+ \ EXPORT
+ \ EXPORT_LINK_INTERFACE_LIBRARIES
+ \ FILE
+ \ IMPORTED_
+ \ NAMESPACE
+ \ NDK
+ \ OLD
+ \ PACKAGE
+ \ TARGETS
syn keyword cmakeKWexport_library_dependencies contained
- \ APPEND EXPORT INCLUDE LINK_INTERFACE_LIBRARIES SET
+ \ APPEND
+ \ EXPORT
+ \ INCLUDE
+ \ LINK_INTERFACE_LIBRARIES
+ \ SET
syn keyword cmakeKWfile contained
- \ ALGO APPEND ASCII CMAKE_TLS_CAINFO CMAKE_TLS_VERIFY CONDITION CONFIG CONTENT COPY CR DESTINATION DIRECTORY_PERMISSIONS DOWNLOAD ENCODING EXCLUDE EXPECTED_HASH FILES_MATCHING FILE_PERMISSIONS FOLLOW_SYMLINKS FUNCTION GENERATE GLOB GLOB_RECURSE GUARD HASH HEX HTTPHEADER INACTIVITY_TIMEOUT INSTALL LENGTH_MAXIMUM LENGTH_MINIMUM LF LIMIT LIMIT_COUNT LIMIT_INPUT LIMIT_OUTPUT LIST_DIRECTORIES LOCK LOG MAKE_DIRECTORY NEWLINE_CONSUME NO_HEX_CONVERSION NO_SOURCE_PERMISSIONS OFFSET OLD PATTERN PROCESS READ REGEX RELATIVE RELATIVE_PATH RELEASE REMOVE REMOVE_RECURSE RENAME RESULT_VARIABLE SHOW_PROGRESS SSL STATUS STRINGS TIMESTAMP TLS_CAINFO TLS_VERIFY TO_CMAKE_PATH TO_NATIVE_PATH UPLOAD USERPWD USE_SOURCE_PERMISSIONS UTC UTF WRITE
+ \ APPEND
+ \ ARCHIVE_CREATE
+ \ ARCHIVE_EXTRACT
+ \ ASCII
+ \ BASE_DIRECTORY
+ \ BUNDLE_EXECUTABLE
+ \ CHMOD
+ \ CHMOD_RECURSE
+ \ CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND
+ \ CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM
+ \ CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL
+ \ CMAKE_INSTALL_MODE
+ \ CMAKE_OBJDUMP
+ \ CODE
+ \ COMPILE_FEATURES
+ \ COMPRESSION
+ \ COMPRESSION_LEVEL
+ \ CONDITION
+ \ CONFIGURE
+ \ CONFIGURE_DEPENDS
+ \ CONFLICTING_DEPENDENCIES_PREFIX
+ \ CONTENT
+ \ CONVERT
+ \ COPYONLY
+ \ COPY_FILE
+ \ COPY_ON_ERROR
+ \ CREATE_LINK
+ \ CRLF
+ \ DESTINATION
+ \ DIRECTORIES
+ \ DIRECTORY_PERMISSIONS
+ \ DLL
+ \ DOS
+ \ DOWNLOAD
+ \ ENCODING
+ \ ESCAPE_QUOTES
+ \ EXECUTABLES
+ \ EXPAND_TILDE
+ \ EXPECTED_HASH
+ \ FILES_MATCHING
+ \ FILE_PERMISSIONS
+ \ FOLLOW_SYMLINKS
+ \ FOLLOW_SYMLINK_CHAIN
+ \ FORMAT
+ \ FUNCTION
+ \ GENERATE
+ \ GET_RUNTIME_DEPENDENCIES
+ \ GLOB
+ \ GLOB_RECURSE
+ \ GROUP_EXECUTE
+ \ GROUP_READ
+ \ GROUP_WRITE
+ \ GUARD
+ \ HASH
+ \ HEX
+ \ HOME
+ \ HTTPHEADER
+ \ IGNORED
+ \ INACTIVITY_TIMEOUT
+ \ INPUT
+ \ INPUT_MAY_BE_RECENT
+ \ INSTALL
+ \ IS_ABSOLUTE
+ \ LENGTH_MAXIMUM
+ \ LENGTH_MINIMUM
+ \ LF
+ \ LIBRARIES
+ \ LIMIT
+ \ LIMIT_COUNT
+ \ LIMIT_INPUT
+ \ LIMIT_OUTPUT
+ \ LIST_DIRECTORIES
+ \ LIST_ONLY
+ \ LOCK
+ \ LOG
+ \ MAKE_DIRECTORY
+ \ MODULES
+ \ MTIME
+ \ MYLIBRARY
+ \ NETRC
+ \ NETRC_FILE
+ \ NEWLINE_CONSUME
+ \ NEWLINE_STYLE
+ \ NOT
+ \ NO_HEX_CONVERSION
+ \ NO_REPLACE
+ \ NO_SOURCE_PERMISSIONS
+ \ OFFSET
+ \ ONLY
+ \ ONLY_IF_DIFFERENT
+ \ OPTIONAL
+ \ OUTPUT
+ \ OWNER_EXECUTE
+ \ OWNER_READ
+ \ OWNER_WRITE
+ \ PATHS
+ \ PATTERN
+ \ PATTERNS
+ \ PERMISSIONS
+ \ POST_EXCLUDE_FILES
+ \ POST_EXCLUDE_REGEXES
+ \ POST_INCLUDE_FILES
+ \ POST_INCLUDE_REGEXES
+ \ PRE_EXCLUDE_REGEXES
+ \ PRE_INCLUDE_REGEXES
+ \ PROCESS
+ \ RANGE_END
+ \ RANGE_START
+ \ READ
+ \ READ_SYMLINK
+ \ REAL_PATH
+ \ REGEX
+ \ RELATIVE
+ \ RELATIVE_PATH
+ \ RELEASE
+ \ REMOVE
+ \ REMOVE_RECURSE
+ \ RENAME
+ \ REQUIRED
+ \ RESOLVED_DEPENDENCIES_VAR
+ \ RESULT
+ \ RESULT_VARIABLE
+ \ RPATH
+ \ RUNPATH
+ \ RUNTIME_DEPENDENCY_SET
+ \ SCRIPT
+ \ SETGID
+ \ SETUID
+ \ SHARED
+ \ SHOW_PROGRESS
+ \ SIZE
+ \ SSL
+ \ STATIC
+ \ STATUS
+ \ STRINGS
+ \ SYMBOLIC
+ \ TARGET
+ \ TARGET_PROPERTY
+ \ TIMESTAMP
+ \ TLS_CAINFO
+ \ TLS_VERIFY
+ \ TOUCH
+ \ TOUCH_NOCREATE
+ \ TO_CMAKE_PATH
+ \ TO_CMAKE_PATH_LIST
+ \ TO_NATIVE_PATH
+ \ TO_NATIVE_PATH_LIST
+ \ UNRESOLVED_DEPENDENCIES_VAR
+ \ UPLOAD
+ \ URL
+ \ USERPROFILE
+ \ USERPWD
+ \ USE_SOURCE_PERMISSIONS
+ \ UTC
+ \ UTF
+ \ VERBOSE
+ \ WORLD_EXECUTE
+ \ WORLD_READ
+ \ WORLD_WRITE
+ \ WRITE
+ \ XZ
+ \ _FILENAMES
syn keyword cmakeKWfind_file contained
- \ CMAKE_FIND_ROOT_PATH_BOTH DOC DVAR HINTS INCLUDE NAMES NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH ONLY_CMAKE_FIND_ROOT_PATH OS PATHS PATH_SUFFIXES VAR
+ \ BOTH
+ \ CATEGORY
+ \ CMAKE_FIND_ROOT_PATH_BOTH
+ \ CMAKE_FIND_USE_
+ \ DOC
+ \ DVAR
+ \ FALSE
+ \ FIND_XXX_REGISTRY_VIEW
+ \ HINTS
+ \ HOST
+ \ INCLUDE
+ \ MATCHES
+ \ NAMES
+ \ NOT
+ \ NO_CACHE
+ \ NO_CMAKE_ENVIRONMENT_PATH
+ \ NO_CMAKE_FIND_ROOT_PATH
+ \ NO_CMAKE_INSTALL_PREFIX
+ \ NO_CMAKE_PATH
+ \ NO_CMAKE_SYSTEM_PATH
+ \ NO_DEFAULT_PATH
+ \ NO_PACKAGE_ROOT_PATH
+ \ NO_SYSTEM_ENVIRONMENT_PATH
+ \ ONLY_CMAKE_FIND_ROOT_PATH
+ \ PACKAGENAME
+ \ PARENT_SCOPE
+ \ PATHS
+ \ PATH_SUFFIXES
+ \ REGISTRY_VIEW
+ \ REQUIRED
+ \ TARGET
+ \ VALIDATOR
+ \ VAR
syn keyword cmakeKWfind_library contained
- \ CMAKE_FIND_ROOT_PATH_BOTH DOC DVAR HINTS LIB NAMES NAMES_PER_DIR NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH ONLY_CMAKE_FIND_ROOT_PATH OS PATHS PATH_SUFFIXES VAR
+ \ BOTH
+ \ CATEGORY
+ \ CMAKE_FIND_ROOT_PATH_BOTH
+ \ CMAKE_FIND_USE_
+ \ DOC
+ \ DVAR
+ \ FALSE
+ \ FIND_XXX_REGISTRY_VIEW
+ \ HINTS
+ \ HOST
+ \ LIB
+ \ MATCHES
+ \ NAMES
+ \ NAMES_PER_DIR
+ \ NOT
+ \ NO_CACHE
+ \ NO_CMAKE_ENVIRONMENT_PATH
+ \ NO_CMAKE_FIND_ROOT_PATH
+ \ NO_CMAKE_INSTALL_PREFIX
+ \ NO_CMAKE_PATH
+ \ NO_CMAKE_SYSTEM_PATH
+ \ NO_DEFAULT_PATH
+ \ NO_PACKAGE_ROOT_PATH
+ \ NO_SYSTEM_ENVIRONMENT_PATH
+ \ ONLY_CMAKE_FIND_ROOT_PATH
+ \ PACKAGENAME
+ \ PARENT_SCOPE
+ \ PATHS
+ \ PATH_SUFFIXES
+ \ REGISTRY_VIEW
+ \ REQUIRED
+ \ TARGET
+ \ VALIDATOR
+ \ VAR
syn keyword cmakeKWfind_package contained
- \ CMAKE_DISABLE_FIND_PACKAGE_ CMAKE_FIND_ROOT_PATH_BOTH COMPONENTS CONFIG CONFIGS DEC DVAR EXACT HINTS MODULE NAMES NATURAL NO_CMAKE_BUILDS_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_PACKAGE_REGISTRY NO_CMAKE_PATH NO_CMAKE_SYSTEM_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_MODULE NO_POLICY_SCOPE NO_SYSTEM_ENVIRONMENT_PATH ONLY_CMAKE_FIND_ROOT_PATH OPTIONAL_COMPONENTS OS PACKAGE_FIND_NAME PACKAGE_FIND_VERSION PACKAGE_FIND_VERSION_COUNT PACKAGE_FIND_VERSION_MAJOR PACKAGE_FIND_VERSION_MINOR PACKAGE_FIND_VERSION_PATCH PACKAGE_FIND_VERSION_TWEAK PACKAGE_VERSION PACKAGE_VERSION_COMPATIBLE PACKAGE_VERSION_EXACT PACKAGE_VERSION_UNSUITABLE PATHS PATH_SUFFIXES QUIET REQUIRED SET TRUE _CONFIG _CONSIDERED_CONFIGS _CONSIDERED_VERSIONS _DIR _FIND_COMPONENTS _FIND_QUIETLY _FIND_REQUIRED _FIND_REQUIRED_ _FIND_VERSION_EXACT _FOUND
+ \ ABI
+ \ BOTH
+ \ BUNDLE
+ \ BYPASS_PROVIDER
+ \ CATEGORY
+ \ CMAKE_DISABLE_FIND_PACKAGE_
+ \ CMAKE_REQUIRE_FIND_PACKAGE_
+ \ CMAKE_FIND_ROOT_PATH_BOTH
+ \ CMAKE_FIND_USE_
+ \ CMAKE_REQUIRE_FIND_PACKAGE_
+ \ COMPONENTS
+ \ CONFIG
+ \ CONFIGS
+ \ DEC
+ \ DVAR
+ \ EXACT
+ \ EXCLUDE
+ \ FALSE
+ \ FIND_PACKAGE_VERSION_FORMAT
+ \ FRAMEWORK
+ \ GLOBAL
+ \ HINTS
+ \ HOST
+ \ INCLUDE
+ \ MODULE
+ \ NAMES
+ \ NATURAL
+ \ NO_CMAKE_BUILDS_PATH
+ \ NO_CMAKE_ENVIRONMENT_PATH
+ \ NO_CMAKE_FIND_ROOT_PATH
+ \ NO_CMAKE_INSTALL_PREFIX
+ \ NO_CMAKE_PACKAGE_REGISTRY
+ \ NO_CMAKE_PATH
+ \ NO_CMAKE_SYSTEM_PACKAGE_REGISTRY
+ \ NO_CMAKE_SYSTEM_PATH
+ \ NO_DEFAULT_PATH
+ \ NO_MODULE
+ \ NO_PACKAGE_ROOT_PATH
+ \ NO_POLICY_SCOPE
+ \ NO_SYSTEM_ENVIRONMENT_PATH
+ \ OLD
+ \ ONLY_CMAKE_FIND_ROOT_PATH
+ \ OPTIONAL_COMPONENTS
+ \ PACKAGENAME
+ \ PACKAGE_FIND_NAME
+ \ PACKAGE_FIND_VERSION
+ \ PACKAGE_FIND_VERSION_COMPLETE
+ \ PACKAGE_FIND_VERSION_COUNT
+ \ PACKAGE_FIND_VERSION_MAJOR
+ \ PACKAGE_FIND_VERSION_MAX
+ \ PACKAGE_FIND_VERSION_MAX_COUNT
+ \ PACKAGE_FIND_VERSION_MAX_MAJOR
+ \ PACKAGE_FIND_VERSION_MAX_MINOR
+ \ PACKAGE_FIND_VERSION_MAX_PATCH
+ \ PACKAGE_FIND_VERSION_MAX_TWEAK
+ \ PACKAGE_FIND_VERSION_MINOR
+ \ PACKAGE_FIND_VERSION_MIN_COUNT
+ \ PACKAGE_FIND_VERSION_MIN_MAJOR
+ \ PACKAGE_FIND_VERSION_MIN_MINOR
+ \ PACKAGE_FIND_VERSION_MIN_PATCH
+ \ PACKAGE_FIND_VERSION_MIN_TWEAK
+ \ PACKAGE_FIND_VERSION_PATCH
+ \ PACKAGE_FIND_VERSION_RANGE
+ \ PACKAGE_FIND_VERSION_RANGE_MAX
+ \ PACKAGE_FIND_VERSION_RANGE_MIN
+ \ PACKAGE_FIND_VERSION_TWEAK
+ \ PACKAGE_VERSION_COMPATIBLE
+ \ PACKAGE_VERSION_EXACT
+ \ PACKAGE_VERSION_UNSUITABLE
+ \ PATHS
+ \ PATH_SUFFIXES
+ \ QUIET
+ \ REGISTRY_VIEW
+ \ REQUIRED
+ \ SET
+ \ TARGET
+ \ TRUE
+ \ VALUE
+ \ _CONFIG
+ \ _CONSIDERED_CONFIGS
+ \ _CONSIDERED_VERSIONS
+ \ _DIR
+ \ _FIND_COMPONENTS
+ \ _FIND_QUIETLY
+ \ _FIND_REGISTRY_VIEW
+ \ _FIND_REQUIRED
+ \ _FIND_REQUIRED_
+ \ _FIND_VERSION_EXACT
+ \ _FOUND
syn keyword cmakeKWfind_path contained
- \ CMAKE_FIND_ROOT_PATH_BOTH DOC DVAR HINTS INCLUDE NAMES NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH ONLY_CMAKE_FIND_ROOT_PATH OS PATHS PATH_SUFFIXES VAR
+ \ BOTH
+ \ CATEGORY
+ \ CMAKE_FIND_ROOT_PATH_BOTH
+ \ CMAKE_FIND_USE_
+ \ DOC
+ \ DVAR
+ \ FALSE
+ \ FIND_XXX_REGISTRY_VIEW
+ \ HINTS
+ \ HOST
+ \ INCLUDE
+ \ MATCHES
+ \ NAMES
+ \ NOT
+ \ NO_CACHE
+ \ NO_CMAKE_ENVIRONMENT_PATH
+ \ NO_CMAKE_FIND_ROOT_PATH
+ \ NO_CMAKE_INSTALL_PREFIX
+ \ NO_CMAKE_PATH
+ \ NO_CMAKE_SYSTEM_PATH
+ \ NO_DEFAULT_PATH
+ \ NO_PACKAGE_ROOT_PATH
+ \ NO_SYSTEM_ENVIRONMENT_PATH
+ \ ONLY_CMAKE_FIND_ROOT_PATH
+ \ PACKAGENAME
+ \ PARENT_SCOPE
+ \ PATHS
+ \ PATH_SUFFIXES
+ \ REGISTRY_VIEW
+ \ REQUIRED
+ \ TARGET
+ \ VALIDATOR
+ \ VAR
syn keyword cmakeKWfind_program contained
- \ CMAKE_FIND_ROOT_PATH_BOTH DOC DVAR HINTS NAMES NAMES_PER_DIR NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH ONLY_CMAKE_FIND_ROOT_PATH OS PATHS PATH_SUFFIXES VAR
+ \ BOTH
+ \ CATEGORY
+ \ CMAKE_FIND_ROOT_PATH_BOTH
+ \ CMAKE_FIND_USE_
+ \ DOC
+ \ DVAR
+ \ FALSE
+ \ FIND_XXX_REGISTRY_VIEW
+ \ HINTS
+ \ HOST
+ \ MATCHES
+ \ NAMES
+ \ NAMES_PER_DIR
+ \ NOT
+ \ NO_CACHE
+ \ NO_CMAKE_ENVIRONMENT_PATH
+ \ NO_CMAKE_FIND_ROOT_PATH
+ \ NO_CMAKE_INSTALL_PREFIX
+ \ NO_CMAKE_PATH
+ \ NO_CMAKE_SYSTEM_PATH
+ \ NO_DEFAULT_PATH
+ \ NO_PACKAGE_ROOT_PATH
+ \ NO_SYSTEM_ENVIRONMENT_PATH
+ \ ONLY_CMAKE_FIND_ROOT_PATH
+ \ PACKAGENAME
+ \ PARENT_SCOPE
+ \ PATHS
+ \ PATH_SUFFIXES
+ \ REGISTRY_VIEW
+ \ REQUIRED
+ \ TARGET
+ \ VALIDATOR
+ \ VAR
syn keyword cmakeKWfltk_wrap_ui contained
\ FLTK
syn keyword cmakeKWforeach contained
- \ ARGS IN ITEMS LISTS RANGE
+ \ APPEND
+ \ IN
+ \ ITEMS
+ \ LISTS
+ \ RANGE
+ \ STATUS
+ \ ZIP_LISTS
syn keyword cmakeKWfunction contained
- \ ARGC ARGN ARGS ARGV PARENT_SCOPE
+ \ ARGC
+ \ ARGN
+ \ ARGV
+ \ CALL
+ \ FOO
+ \ PARENT_SCOPE
syn keyword cmakeKWget_cmake_property contained
- \ COMPONENTS GLOBAL MACROS VAR VARIABLES
+ \ COMPONENTS
+ \ GLOBAL
+ \ MACROS
+ \ VARIABLES
syn keyword cmakeKWget_directory_property contained
- \ DEFINITION DIRECTORY
+ \ DEFINITION
+ \ DIRECTORY
+ \ INHERITED
syn keyword cmakeKWget_filename_component contained
- \ ABSOLUTE ARG_VAR BASE_DIR CACHE COMP DIRECTORY EXT NAME NAME_WE PATH PROGRAM PROGRAM_ARGS REALPATH VAR
+ \ ABSOLUTE
+ \ BASE_DIR
+ \ DIRECTORY
+ \ EXT
+ \ LAST_EXT
+ \ NAME
+ \ NAME_WE
+ \ NAME_WLE
+ \ PROGRAM
+ \ PROGRAM_ARGS
+ \ QUERY
+ \ REALPATH
+ \ REAL_PATH
+ \ WINDOWS_REGISTRY
syn keyword cmakeKWget_property contained
- \ BRIEF_DOCS CACHE DEFINED DIRECTORY FULL_DOCS GLOBAL INSTALL PROPERTY SET SOURCE TARGET TEST VARIABLE
+ \ BRIEF_DOCS
+ \ DEFINED
+ \ DIRECTORY
+ \ FULL_DOCS
+ \ GENERATED
+ \ GLOBAL
+ \ INSTALL
+ \ PROPERTY
+ \ SET
+ \ SOURCE
+ \ TARGET
+ \ TARGET_DIRECTORY
+ \ TEST
+ \ VARIABLE
syn keyword cmakeKWget_source_file_property contained
- \ LOCATION VAR
+ \ DIRECTORY
+ \ GENERATED
+ \ INHERITED
+ \ LOCATION
+ \ TARGET_DIRECTORY
syn keyword cmakeKWget_target_property contained
+ \ INHERITED
\ VAR
syn keyword cmakeKWget_test_property contained
+ \ INHERITED
\ VAR
syn keyword cmakeKWif contained
- \ ARGS CMAKE_MATCH_ CMP COMMAND DEFINED EQUAL EXISTS FALSE GREATER GREATER_EQUAL IGNORE IN_LIST IS_ABSOLUTE IS_DIRECTORY IS_NEWER_THAN IS_SYMLINK LESS LESS_EQUAL MATCHES NNNN NOT OFF OR POLICY STREQUAL STRGREATER STRGREATER_EQUAL STRLESS STRLESS_EQUAL TARGET TEST THEN TRUE VERSION_EQUAL VERSION_GREATER VERSION_GREATER_EQUAL VERSION_LESS VERSION_LESS_EQUAL YES
+ \ CMAKE_MATCH_
+ \ CMP
+ \ COMMAND
+ \ COMPARE
+ \ DEFINED
+ \ EQUAL
+ \ EXISTS
+ \ FALSE
+ \ GREATER
+ \ GREATER_EQUAL
+ \ IGNORE
+ \ IN_LIST
+ \ IS_ABSOLUTE
+ \ IS_DIRECTORY
+ \ IS_NEWER_THAN
+ \ IS_SYMLINK
+ \ LESS
+ \ LESS_EQUAL
+ \ MATCHES
+ \ NNNN
+ \ NOT
+ \ OFF
+ \ OR
+ \ PATH_EQUAL
+ \ POLICY
+ \ STREQUAL
+ \ STRGREATER
+ \ STRGREATER_EQUAL
+ \ STRLESS
+ \ STRLESS_EQUAL
+ \ TARGET
+ \ TEST
+ \ TRUE
+ \ VERSION_EQUAL
+ \ VERSION_GREATER
+ \ VERSION_GREATER_EQUAL
+ \ VERSION_LESS
+ \ VERSION_LESS_EQUAL
+ \ YES
syn keyword cmakeKWinclude contained
- \ NO_POLICY_SCOPE OPTIONAL RESULT_VARIABLE
+ \ NO_POLICY_SCOPE
+ \ OPTIONAL
+ \ RESULT_VARIABLE
syn keyword cmakeKWinclude_directories contained
- \ AFTER BEFORE INCLUDE_DIRECTORIES ON SYSTEM
+ \ AFTER
+ \ BEFORE
+ \ INCLUDE_DIRECTORIES
+ \ ON
+ \ SYSTEM
syn keyword cmakeKWinclude_external_msproject contained
- \ GUID MAP_IMPORTED_CONFIG_ PLATFORM TYPE WIX
+ \ GUID
+ \ MAP_IMPORTED_CONFIG_
+ \ PLATFORM
+ \ TYPE
+ \ WIX
syn keyword cmakeKWinclude_guard contained
- \ DIRECTORY GLOBAL TRUE __CURRENT_FILE_VAR__
+ \ DIRECTORY
+ \ GLOBAL
+ \ TRUE
+ \ __CURRENT_FILE_VAR__
syn keyword cmakeKWinstall contained
- \ ARCHIVE BUNDLE CODE COMPONENT CONFIGURATIONS CVS DESTDIR DESTINATION DIRECTORY DIRECTORY_PERMISSIONS DLL EXCLUDE_FROM_ALL EXPORT EXPORT_ANDROID_MK EXPORT_LINK_INTERFACE_LIBRARIES FILES FILES_MATCHING FILE_PERMISSIONS FRAMEWORK GROUP_EXECUTE GROUP_READ GROUP_WRITE IMPORTED_ INCLUDES INSTALL_PREFIX INTERFACE_INCLUDE_DIRECTORIES LIBRARY MACOSX_BUNDLE MESSAGE_NEVER NAMELINK_ONLY NAMELINK_SKIP NAMESPACE NDK OBJECTS OPTIONAL OWNER_EXECUTE OWNER_READ OWNER_WRITE PATTERN PERMISSIONS POST_INSTALL_SCRIPT PRE_INSTALL_SCRIPT PRIVATE_HEADER PROGRAMS PUBLIC_HEADER REGEX RENAME RESOURCE RUNTIME SCRIPT SETGID SETUID SOVERSION TARGETS TRUE USE_SOURCE_PERMISSIONS VERSION WORLD_EXECUTE WORLD_READ WORLD_WRITE
+ \ AFTER
+ \ AIX
+ \ ALL_COMPONENTS
+ \ APT
+ \ ARCHIVE
+ \ BEFORE
+ \ BUILD_TYPE
+ \ BUNDLE
+ \ BUNDLE_EXECUTABLE
+ \ CMAKE_INSTALL_BINDIR
+ \ CMAKE_INSTALL_DATADIR
+ \ CMAKE_INSTALL_DATAROOTDIR
+ \ CMAKE_INSTALL_DOCDIR
+ \ CMAKE_INSTALL_INCLUDEDIR
+ \ CMAKE_INSTALL_INFODIR
+ \ CMAKE_INSTALL_LIBDIR
+ \ CMAKE_INSTALL_LOCALEDIR
+ \ CMAKE_INSTALL_LOCALSTATEDIR
+ \ CMAKE_INSTALL_MANDIR
+ \ CMAKE_INSTALL_MODE
+ \ CMAKE_INSTALL_RUNSTATEDIR
+ \ CMAKE_INSTALL_SBINDIR
+ \ CMAKE_INSTALL_SHARESTATEDIR
+ \ CMAKE_INSTALL_SYSCONFDIR
+ \ CODE
+ \ COMPONENT
+ \ CONFIGURATIONS
+ \ CVS
+ \ CXX_MODULES_BMI
+ \ CXX_MODULES_DIRECTORY
+ \ DATA
+ \ DATAROOT
+ \ DBUILD_TYPE
+ \ DCOMPONENT
+ \ DESTDIR
+ \ DESTINATION
+ \ DIRECTORY
+ \ DIRECTORY_PERMISSIONS
+ \ DLL
+ \ DOC
+ \ ENABLE_EXPORTS
+ \ EXCLUDE_FROM_ALL
+ \ EXECUTABLES
+ \ EXPORT
+ \ EXPORT_ANDROID_MK
+ \ EXPORT_LINK_INTERFACE_LIBRARIES
+ \ EXPORT_NAME
+ \ FILES
+ \ FILES_MATCHING
+ \ FILE_PERMISSIONS
+ \ FILE_SET
+ \ FRAMEWORK
+ \ GET_RUNTIME_DEPENDENCIES
+ \ GROUP_EXECUTE
+ \ GROUP_READ
+ \ GROUP_WRITE
+ \ HEADERS
+ \ IMPORTED_RUNTIME_ARTIFACTS
+ \ INCLUDES
+ \ INFO
+ \ INSTALL_PREFIX
+ \ INTERFACE
+ \ INTERFACE_INCLUDE_DIRECTORIES
+ \ LIBRARY
+ \ LOCALE
+ \ LOCALSTATE
+ \ MACOSX_BUNDLE
+ \ MAN
+ \ MESSAGE_NEVER
+ \ NAMELINK_COMPONENT
+ \ NAMELINK_ONLY
+ \ NAMELINK_SKIP
+ \ NAMESPACE
+ \ NDK
+ \ OBJECTS
+ \ OPTIONAL
+ \ OWNER_EXECUTE
+ \ OWNER_READ
+ \ OWNER_WRITE
+ \ PATTERN
+ \ PERMISSIONS
+ \ POST_EXCLUDE_FILES
+ \ POST_EXCLUDE_REGEXES
+ \ POST_INCLUDE_FILES
+ \ POST_INCLUDE_REGEXES
+ \ POST_INSTALL_SCRIPT
+ \ PRE_EXCLUDE_REGEXES
+ \ PRE_INCLUDE_REGEXES
+ \ PRE_INSTALL_SCRIPT
+ \ PRIVATE_HEADER
+ \ PROGRAMS
+ \ PROPERTIES
+ \ PUBLIC_HEADER
+ \ RENAME
+ \ RESOURCE
+ \ RPM
+ \ RUNSTATE
+ \ RUNTIME_DEPENDENCIES
+ \ RUNTIME_DEPENDENCY_SET
+ \ SBIN
+ \ SCRIPT
+ \ SETGID
+ \ SETUID
+ \ SHAREDSTATE
+ \ SOVERSION
+ \ STATIC
+ \ SYSCONF
+ \ TARGETS
+ \ TRUE
+ \ TYPE
+ \ USE_SOURCE_PERMISSIONS
+ \ VERSION
+ \ WORLD_EXECUTE
+ \ WORLD_READ
+ \ WORLD_WRITE
syn keyword cmakeKWinstall_files contained
- \ FILES GLOB
+ \ FILES
+ \ GLOB
syn keyword cmakeKWinstall_programs contained
- \ FILES GLOB PROGRAMS TARGETS
+ \ FILES
+ \ GLOB
+ \ PROGRAMS
+ \ TARGETS
syn keyword cmakeKWinstall_targets contained
- \ DLL RUNTIME_DIRECTORY TARGETS
+ \ DLL
+ \ RUNTIME_DIRECTORY
+
+syn keyword cmakeKWlink_directories contained
+ \ AFTER
+ \ BEFORE
+ \ LINK_DIRECTORIES
+ \ ON
+ \ ORIGIN
+ \ RPATH
syn keyword cmakeKWlist contained
- \ APPEND CACHE EXCLUDE FILTER FIND GET INCLUDE INSERT INTERNAL LENGTH LIST NOTES PARENT_SCOPE REGEX REMOVE_AT REMOVE_DUPLICATES REMOVE_ITEM REVERSE SORT
+ \ ACTION
+ \ APPEND
+ \ ASCENDING
+ \ CASE
+ \ COMPARE
+ \ DESCENDING
+ \ EXCLUDE
+ \ FILE_BASENAME
+ \ FILTER
+ \ FIND
+ \ GENEX_STRIP
+ \ GET
+ \ INCLUDE
+ \ INSENSITIVE
+ \ INSERT
+ \ INTERNAL
+ \ JOIN
+ \ LENGTH
+ \ NATURAL
+ \ ORDER
+ \ OUTPUT_VARIABLE
+ \ PARENT_SCOPE
+ \ POP_BACK
+ \ POP_FRONT
+ \ PREPEND
+ \ REGEX
+ \ REMOVE_AT
+ \ REMOVE_DUPLICATES
+ \ REMOVE_ITEM
+ \ REPLACE
+ \ REVERSE
+ \ SELECTOR
+ \ SENSITIVE
+ \ SORT
+ \ STRING
+ \ STRIP
+ \ SUBLIST
+ \ TOLOWER
+ \ TOUPPER
+ \ TRANSFORM
+ \ TRANSFORM_APPEND
+ \ TRANSFORM_GENEX_STRIP
+ \ TRANSFORM_REPLACE
+ \ TRANSFORM_STRIP
+ \ TRANSFORM_TOLOWER
syn keyword cmakeKWload_cache contained
- \ EXCLUDE INCLUDE_INTERNALS READ_WITH_PREFIX
+ \ EXCLUDE
+ \ INCLUDE_INTERNALS
+ \ READ_WITH_PREFIX
syn keyword cmakeKWload_command contained
- \ CMAKE_LOADED_COMMAND_ COMMAND_NAME
+ \ CMAKE_LOADED_COMMAND_
+ \ COMMAND_NAME
syn keyword cmakeKWmacro contained
- \ ARGC ARGN ARGS ARGV DEFINED GREATER LISTS NOT _BAR _FOO
-
-syn keyword cmakeKWmake_directory contained
- \ MAKE_DIRECTORY
+ \ ARGC
+ \ ARGN
+ \ ARGV
+ \ CALL
+ \ DEFINED
+ \ FOO
+ \ GREATER
+ \ LISTS
+ \ NOT
syn keyword cmakeKWmark_as_advanced contained
- \ CLEAR FORCE VAR
+ \ CLEAR
+ \ FORCE
syn keyword cmakeKWmath contained
\ EXPR
+ \ HEXADECIMAL
+ \ OUTPUT_FORMAT
syn keyword cmakeKWmessage contained
- \ AUTHOR_WARNING DEPRECATION FATAL_ERROR GUI SEND_ERROR STATUS WARNING
+ \ APPEND
+ \ AUTHOR_WARNING
+ \ CHECK_
+ \ CHECK_FAIL
+ \ CHECK_PASS
+ \ CHECK_START
+ \ CONFIGURE_LOG
+ \ DEBUG
+ \ DEFINED
+ \ DEPRECATION
+ \ FATAL_ERROR
+ \ GET_MESSAGE_LOG_LEVEL
+ \ GUI
+ \ INTERNAL
+ \ MY_CHECK_RESULT
+ \ NOTICE
+ \ POP_BACK
+ \ SEND_ERROR
+ \ STATUS
+ \ TRACE
+ \ VERBOSE
+ \ WARNING
syn keyword cmakeKWoption contained
- \ OFF ON
+ \ OFF
syn keyword cmakeKWproject contained
- \ CMAKE_PROJECT_ DESCRIPTION LANGUAGES NAME NONE PROJECT VERSION _BINARY_DIR _INCLUDE _SOURCE_DIR _VERSION _VERSION_MAJOR _VERSION_MINOR _VERSION_PATCH _VERSION_TWEAK
+ \ ASM
+ \ ASM_MARMASM
+ \ ASM_MASM
+ \ ASM_NASM
+ \ ATT
+ \ CMAKE_PROJECT_
+ \ CUDA
+ \ DESCRIPTION
+ \ HIP
+ \ HOMEPAGE_URL
+ \ ISPC
+ \ LANGUAGES
+ \ NAME
+ \ NONE
+ \ OBJC
+ \ OBJCXX
+ \ PROJECT
+ \ VERSION
+ \ _BINARY_DIR
+ \ _DESCRIPTION
+ \ _HOMEPAGE_URL
+ \ _INCLUDE_BEFORE
+ \ _IS_TOP_LEVEL
+ \ _SOURCE_DIR
+ \ _VERSION
+ \ _VERSION_MAJOR
+ \ _VERSION_MINOR
+ \ _VERSION_PATCH
+ \ _VERSION_TWEAK
+
+syn keyword cmakeKWqt_wrap_cpp contained
+ \ AUTOMOC
+
+syn keyword cmakeKWqt_wrap_ui contained
+ \ AUTOUIC
syn keyword cmakeKWremove contained
- \ REMOVE_ITEM VALUE VAR
+ \ VALUE
+ \ VAR
+
+syn keyword cmakeKWreturn contained
+ \ DEFER
+ \ PARENT_SCOPE
+ \ PROPAGATE
+ \ SCOPE_FOR
+ \ VARIABLES
+ \ VERSION
syn keyword cmakeKWseparate_arguments contained
- \ MSDN NATIVE NATIVE_COMMAND UNIX_COMMAND WINDOWS WINDOWS_COMMAND _COMMAND
+ \ MSDN
+ \ NATIVE_COMMAND
+ \ PROGRAM
+ \ SEPARATE_ARGS
+ \ UNIX_COMMAND
+ \ WINDOWS_COMMAND
syn keyword cmakeKWset contained
- \ BOOL CACHE FILEPATH FORCE INTERNAL OFF ON PARENT_SCOPE STRING STRINGS
+ \ BOOL
+ \ FILEPATH
+ \ FORCE
+ \ INTERNAL
+ \ OFF
+ \ OLD
+ \ ON
+ \ PARENT_SCOPE
+ \ PROPAGATE
+ \ STRING
+ \ STRINGS
+ \ VAR
syn keyword cmakeKWset_directory_properties contained
+ \ DIRECTORY
\ PROPERTIES
syn keyword cmakeKWset_property contained
- \ APPEND APPEND_STRING CACHE DIRECTORY GLOBAL INSTALL PROPERTY SOURCE TARGET TEST WIX
+ \ APPEND
+ \ APPEND_STRING
+ \ DIRECTORY
+ \ GENERATED
+ \ GLOBAL
+ \ INHERITED
+ \ INSTALL
+ \ NAME
+ \ PROPERTY
+ \ SOURCE
+ \ TARGET
+ \ TARGET_DIRECTORY
+ \ TEST
+ \ WIX
syn keyword cmakeKWset_source_files_properties contained
+ \ DIRECTORY
+ \ GENERATED
\ PROPERTIES
+ \ SOURCE
+ \ TARGET_DIRECTORY
syn keyword cmakeKWset_target_properties contained
\ PROPERTIES
syn keyword cmakeKWset_tests_properties contained
+ \ NAME
\ PROPERTIES
+syn keyword cmakeKWsite_name contained
+ \ HOSTNAME
+
syn keyword cmakeKWsource_group contained
- \ FILES PREFIX REGULAR_EXPRESSION TREE
+ \ FILES
+ \ PREFIX
+ \ REGULAR_EXPRESSION
+ \ TREE
syn keyword cmakeKWstring contained
- \ ALPHABET APPEND ASCII CMAKE_MATCH_ COMPARE CONCAT CONFIGURE EQUAL ESCAPE_QUOTES FIND GENEX_STRIP GREATER GREATER_EQUAL GUID HASH LENGTH LESS LESS_EQUAL MAKE_C_IDENTIFIER MATCH MATCHALL MATCHES NAMESPACE NOTEQUAL ONLY PREPEND RANDOM RANDOM_SEED REGEX REPLACE REVERSE RFC SHA SOURCE_DATE_EPOCH STRIP SUBSTRING SZ TIMESTAMP TOLOWER TOUPPER TYPE US UTC UUID
+ \ ALPHABET
+ \ APPEND
+ \ ARRAY
+ \ ASCII
+ \ BOOLEAN
+ \ CMAKE_MATCH_
+ \ COMPARE
+ \ CONCAT
+ \ CONFIGURE
+ \ EQUAL
+ \ ERROR_VARIABLE
+ \ ESCAPE_QUOTES
+ \ FIND
+ \ GENEX_STRIP
+ \ GET
+ \ GREATER
+ \ GREATER_EQUAL
+ \ GUID
+ \ HASH
+ \ HEX
+ \ ISO
+ \ JOIN
+ \ JSON
+ \ LENGTH
+ \ LESS
+ \ LESS_EQUAL
+ \ MAKE_C_IDENTIFIER
+ \ MATCH
+ \ MATCHALL
+ \ MATCHES
+ \ MEMBER
+ \ NAMESPACE
+ \ NOTEQUAL
+ \ NULL
+ \ NUMBER
+ \ OBJECT
+ \ OFF
+ \ ONLY
+ \ PREPEND
+ \ RANDOM
+ \ RANDOM_SEED
+ \ REGEX
+ \ REMOVE
+ \ REPEAT
+ \ REPLACE
+ \ REVERSE
+ \ RFC
+ \ SET
+ \ SHA
+ \ SOURCE_DATE_EPOCH
+ \ STRIP
+ \ SUBSTRING
+ \ SZ
+ \ TIMESTAMP
+ \ TOLOWER
+ \ TOUPPER
+ \ TYPE
+ \ US
+ \ UTC
+ \ UUID
syn keyword cmakeKWsubdirs contained
- \ EXCLUDE_FROM_ALL PREORDER
+ \ EXCLUDE_FROM_ALL
+ \ PREORDER
syn keyword cmakeKWtarget_compile_definitions contained
- \ COMPILE_DEFINITIONS INTERFACE INTERFACE_COMPILE_DEFINITIONS PRIVATE PUBLIC
+ \ ALIAS
+ \ COMPILE_DEFINITIONS
+ \ FOO
+ \ IMPORTED
+ \ INTERFACE
+ \ INTERFACE_COMPILE_DEFINITIONS
+ \ PRIVATE
+ \ PUBLIC
syn keyword cmakeKWtarget_compile_features contained
- \ COMPILE_FEATURES IMPORTED INTERFACE INTERFACE_COMPILE_FEATURES PRIVATE PUBLIC
+ \ ALIAS
+ \ COMPILE_FEATURES
+ \ IMPORTED
+ \ INTERFACE
+ \ INTERFACE_COMPILE_FEATURES
+ \ PRIVATE
+ \ PUBLIC
syn keyword cmakeKWtarget_compile_options contained
- \ BEFORE COMPILE_OPTIONS IMPORTED INTERFACE INTERFACE_COMPILE_OPTIONS PRIVATE PUBLIC
+ \ ALIAS
+ \ BEFORE
+ \ CMAKE_
+ \ COMPILE_LANGUAGE
+ \ COMPILE_OPTIONS
+ \ CONFIG
+ \ IMPORTED
+ \ INTERFACE
+ \ INTERFACE_COMPILE_OPTIONS
+ \ PRIVATE
+ \ PUBLIC
+ \ SHELL
+ \ UNIX_COMMAND
+ \ _FLAGS
+ \ _FLAGS_
syn keyword cmakeKWtarget_include_directories contained
- \ BEFORE BUILD_INTERFACE IMPORTED INCLUDE_DIRECTORIES INSTALL_INTERFACE INTERFACE INTERFACE_INCLUDE_DIRECTORIES INTERFACE_LINK_LIBRARIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES PRIVATE PUBLIC SYSTEM
+ \ AFTER
+ \ ALIAS
+ \ BEFORE
+ \ BUILD_INTERFACE
+ \ IMPORTED
+ \ INCLUDE_DIRECTORIES
+ \ INSTALL_INTERFACE
+ \ INTERFACE
+ \ INTERFACE_INCLUDE_DIRECTORIES
+ \ INTERFACE_LINK_LIBRARIES
+ \ INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
+ \ PRIVATE
+ \ PUBLIC
+ \ SYSTEM
+
+syn keyword cmakeKWtarget_link_directories contained
+ \ ALIAS
+ \ BEFORE
+ \ IMPORTED
+ \ INTERFACE
+ \ INTERFACE_LINK_DIRECTORIES
+ \ LINK_DIRECTORIES
+ \ ORIGIN
+ \ PRIVATE
+ \ PUBLIC
+ \ RPATH
syn keyword cmakeKWtarget_link_libraries contained
- \ ALIAS DAG DEBUG_CONFIGURATIONS IMPORTED IMPORTED_NO_SONAME INTERFACE INTERFACE_LINK_LIBRARIES LINK_FLAGS LINK_INTERFACE_LIBRARIES LINK_INTERFACE_LIBRARIES_DEBUG LINK_INTERFACE_MULTIPLICITY LINK_PRIVATE LINK_PUBLIC OLD OSX PRIVATE PUBLIC STATIC
+ \ ALIAS
+ \ DA
+ \ DAG
+ \ DEBUG_CONFIGURATIONS
+ \ DOBJ
+ \ IMPORTED
+ \ IMPORTED_NO_SONAME
+ \ INTERFACE
+ \ INTERFACE_LINK_LIBRARIES
+ \ LINK_FLAGS
+ \ LINK_INTERFACE_LIBRARIES
+ \ LINK_INTERFACE_LIBRARIES_DEBUG
+ \ LINK_INTERFACE_MULTIPLICITY
+ \ LINK_OPTIONS
+ \ LINK_PRIVATE
+ \ LINK_PUBLIC
+ \ OBJECT
+ \ OLD
+ \ PRIVATE
+ \ PUBLIC
+ \ SHARED
+ \ STATIC
+ \ TARGET_OBJECTS
+
+syn keyword cmakeKWtarget_link_options contained
+ \ ALIAS
+ \ BEFORE
+ \ CMAKE_
+ \ CONFIG
+ \ CUDA_RESOLVE_DEVICE_SYMBOLS
+ \ CUDA_SEPARABLE_COMPILATION
+ \ DEVICE_LINK
+ \ GCC
+ \ HOST_LINK
+ \ IMPORTED
+ \ INTERFACE
+ \ INTERFACE_LINK_OPTIONS
+ \ LANG
+ \ LINKER
+ \ LINK_OPTIONS
+ \ PRIVATE
+ \ PUBLIC
+ \ SHELL
+ \ STATIC_LIBRARY_OPTIONS
+ \ UNIX_COMMAND
+ \ _FLAGS
+ \ _FLAGS_
+ \ _LINKER_WRAPPER_FLAG
+ \ _LINKER_WRAPPER_FLAG_SEP
+
+syn keyword cmakeKWtarget_precompile_headers contained
+ \ ALIAS
+ \ ANGLE
+ \ BUILD_INTERFACE
+ \ COMPILE_LANGUAGE
+ \ DISABLE_PRECOMPILE_HEADERS
+ \ EXPORT
+ \ FI
+ \ GCC
+ \ IMPORTED
+ \ INTERFACE
+ \ INTERFACE_PRECOMPILE_HEADERS
+ \ PRECOMPILE_HEADERS
+ \ PRECOMPILE_HEADERS_REUSE_FROM
+ \ PRIVATE
+ \ PUBLIC
+ \ REUSE_FROM
+ \ SKIP_PRECOMPILE_HEADERS
syn keyword cmakeKWtarget_sources contained
- \ IMPORTED INTERFACE INTERFACE_SOURCES PRIVATE PUBLIC SOURCES
+ \ ALIAS
+ \ BASE_DIRS
+ \ BUILD_INTERFACE
+ \ CONFIG
+ \ CORRECT
+ \ CXX_MODULES
+ \ CXX_MODULE_DIRS
+ \ CXX_MODULE_DIRS_
+ \ CXX_MODULE_SETS
+ \ CXX_MODULE_SET_
+ \ EXPORT
+ \ FILES
+ \ FILE_SET
+ \ FRAMEWORK
+ \ HEADERS
+ \ HEADER_DIRS
+ \ HEADER_DIRS_
+ \ HEADER_FILE_ONLY
+ \ HEADER_SETS
+ \ HEADER_SET_
+ \ IMPORTED
+ \ INCLUDE_DIRECTORIES
+ \ INTERFACE
+ \ INTERFACE_CXX_MODULE_SETS
+ \ INTERFACE_HEADER_SETS
+ \ INTERFACE_INCLUDE_DIRECTORIES
+ \ INTERFACE_SOURCES
+ \ NAME
+ \ PRIVATE
+ \ PUBLIC
+ \ SOURCES
+ \ SOURCE_DIR
+ \ TARGETS
+ \ TRUE
+ \ TYPE
+ \ WRONG
syn keyword cmakeKWtry_compile contained
- \ ALL_BUILD CMAKE_FLAGS COMPILE_DEFINITIONS COPY_FILE COPY_FILE_ERROR CUDA_EXTENSIONS CUDA_STANDARD CUDA_STANDARD_REQUIRED CXX_EXTENSIONS CXX_STANDARD CXX_STANDARD_REQUIRED C_EXTENSIONS C_STANDARD C_STANDARD_REQUIRED DEFINED DLINK_LIBRARIES DVAR FALSE INCLUDE_DIRECTORIES LANG LINK_DIRECTORIES LINK_LIBRARIES NOT OUTPUT_VARIABLE RESULT_VAR SOURCES TRUE TYPE VALUE _EXTENSIONS _STANDARD _STANDARD_REQUIRED
+ \ ALL_BUILD
+ \ BINARY_DIR
+ \ CMAKE_FLAGS
+ \ COMPILE_DEFINITIONS
+ \ COPY_FILE
+ \ COPY_FILE_ERROR
+ \ CUDA_EXTENSIONS
+ \ CUDA_STANDARD
+ \ CUDA_STANDARD_REQUIRED
+ \ CXX_EXTENSIONS
+ \ CXX_STANDARD
+ \ CXX_STANDARD_REQUIRED
+ \ C_EXTENSIONS
+ \ C_STANDARD
+ \ C_STANDARD_REQUIRED
+ \ DEFINED
+ \ DLINK_LIBRARIES
+ \ DVAR
+ \ EXECUTABLE
+ \ FALSE
+ \ GHS
+ \ HIP_EXTENSIONS
+ \ HIP_STANDARD
+ \ HIP_STANDARD_REQUIRED
+ \ INCLUDE_DIRECTORIES
+ \ LANG
+ \ LINK_DIRECTORIES
+ \ LINK_LIBRARIES
+ \ LINK_OPTIONS
+ \ LOG_DESCRIPTION
+ \ MULTI
+ \ NOT
+ \ NO_CACHE
+ \ NO_LOG
+ \ OBJCXX_EXTENSIONS
+ \ OBJCXX_STANDARD
+ \ OBJCXX_STANDARD_REQUIRED
+ \ OBJC_EXTENSIONS
+ \ OBJC_STANDARD
+ \ OBJC_STANDARD_REQUIRED
+ \ OUTPUT_VARIABLE
+ \ PRIVATE
+ \ PROJECT
+ \ RESULTVAR
+ \ SOURCES
+ \ SOURCE_DIR
+ \ SOURCE_FROM_CONTENT
+ \ SOURCE_FROM_FILE
+ \ SOURCE_FROM_VAR
+ \ STATIC_LIBRARY
+ \ STATIC_LIBRARY_OPTIONS
+ \ TARGET
+ \ TRUE
+ \ TYPE
+ \ VALUE
+ \ _EXTENSIONS
+ \ _STANDARD
+ \ _STANDARD_REQUIRED
syn keyword cmakeKWtry_run contained
- \ ARGS CMAKE_FLAGS COMPILE_DEFINITIONS COMPILE_OUTPUT_VARIABLE COMPILE_RESULT_VAR DLINK_LIBRARIES DVAR FAILED_TO_RUN FALSE INCLUDE_DIRECTORIES LINK_DIRECTORIES LINK_LIBRARIES RUN_OUTPUT_VARIABLE RUN_RESULT_VAR TRUE TYPE VALUE __TRYRUN_OUTPUT
+ \ ARGS
+ \ CMAKE_FLAGS
+ \ COMPILE_DEFINITIONS
+ \ COMPILE_OUTPUT_VARIABLE
+ \ COPY_FILE
+ \ COPY_FILE_ERROR
+ \ FAILED_TO_RUN
+ \ FALSE
+ \ LANG
+ \ LINK_LIBRARIES
+ \ LINK_OPTIONS
+ \ LOG_DESCRIPTION
+ \ NO_CACHE
+ \ NO_LOG
+ \ RUN_OUTPUT_STDERR_VARIABLE
+ \ RUN_OUTPUT_STDOUT_VARIABLE
+ \ RUN_OUTPUT_VARIABLE
+ \ SOURCES
+ \ SOURCE_FROM_CONTENT
+ \ SOURCE_FROM_FILE
+ \ SOURCE_FROM_VAR
+ \ TRUE
+ \ WORKING_DIRECTORY
+ \ _EXTENSIONS
+ \ _STANDARD
+ \ _STANDARD_REQUIRED
+ \ __TRYRUN_OUTPUT
syn keyword cmakeKWunset contained
- \ CACHE LD_LIBRARY_PATH PARENT_SCOPE
+ \ PARENT_SCOPE
+ \ VAR
syn keyword cmakeKWuse_mangled_mesa contained
- \ GL OUTPUT_DIRECTORY PATH_TO_MESA
+ \ GL
+ \ OUTPUT_DIRECTORY
+ \ PATH_TO_MESA
syn keyword cmakeKWvariable_requires contained
- \ RESULT_VARIABLE TEST_VARIABLE
+ \ RESULT_VARIABLE
+ \ TEST_VARIABLE
syn keyword cmakeKWvariable_watch contained
+ \ APPEND
\ COMMAND
-
-syn keyword cmakeKWwhile contained
- \ ARGS
+ \ DEFINED
+ \ MODIFIED_ACCESS
+ \ READ_ACCESS
+ \ REMOVED_ACCESS
+ \ UNKNOWN_MODIFIED_ACCESS
+ \ UNKNOWN_READ_ACCESS
syn keyword cmakeKWwrite_file contained
- \ APPEND CONFIGURE_FILE NOTE WRITE
+ \ APPEND
+ \ CONFIGURE_FILE
+ \ NOTE
+ \ WRITE
syn keyword cmakeGeneratorExpressions contained
- \ LINK_LIBRARIES INCLUDE_DIRECTORIES COMPILE_DEFINITIONS CONFIG DEBUG_MODE BOOL AND NOT IF STREQUAL MAP_IMPORTED_CONFIG_ PLATFORM_ID C_COMPILER_ID CXX_COMPILER_ID VERSION_LESS VERSION_GREATER VERSION_EQUAL VERSION_LESS_EQUAL VERSION_GREATER_EQUAL C_COMPILER_VERSION CXX_COMPILER_VERSION TARGET_POLICY COMPILE_FEATURES C_STANDARD CXX_STANDARD COMPILE_LANGUAGE PRIVATE PUBLIC COMPILING_CXX GNU OLD_COMPILER CMAKE_CXX_COMPILER_VERSION CONFIGURATION TARGET_FILE TARGET_FILE_NAME TARGET_FILE_DIR TARGET_LINKER_FILE TARGET_LINKER_FILE_NAME TARGET_LINKER_FILE_DIR TARGET_SONAME_FILE TARGET_SONAME_FILE_NAME TARGET_SONAME_FILE_DIR TARGET_PDB_FILE PDB_NAME PDB_OUTPUT_DIRECTORY PDB_NAME_ PDB_OUTPUT_DIRECTORY_ TARGET_PDB_FILE_NAME TARGET_PDB_FILE_DIR TARGET_BUNDLE_DIR TARGET_BUNDLE_CONTENT_DIR SDK TARGET_PROPERTY INSTALL_PREFIX EXPORT JOIN ANGLE COMMA SEMICOLON TARGET_NAME LINK_ONLY INTERFACE_LINK_LIBRARIES INSTALL_INTERFACE BUILD_INTERFACE LOWER_CASE UPPER_CASE MAKE_C_IDENTIFIER TARGET_OBJECTS OBJECT_LIBRARY SHELL_PATH MSYS
+ \ ABSOLUTE_PATH
+ \ ACTION
+ \ AIX
+ \ ANGLE
+ \ APPEND
+ \ ARCHIVE_OUTPUT_NAME
+ \ ARCHIVE_OUTPUT_NAME_
+ \ ASCENDING
+ \ BAR
+ \ BOOL
+ \ BUILD_INTERFACE
+ \ BUILD_LOCAL_INTERFACE
+ \ CMAKE_LINK_GROUP_USING_
+ \ CMAKE_LINK_LIBRARY_USING_
+ \ CMAKE_PATH
+ \ CODE
+ \ COMMAND_CONFIG
+ \ COMMAND_EXPAND_LISTS
+ \ COMPARE
+ \ COMPILE_DEFINITIONS
+ \ COMPILE_FEATURES
+ \ COMPILE_LANGUAGE
+ \ COMPILE_LANG_AND_ID
+ \ COMPILE_ONLY
+ \ COMPILING_CUDA
+ \ COMPILING_CXX
+ \ COMPILING_CXX_WITH_CLANG
+ \ COMPILING_CXX_WITH_INTEL
+ \ COMPILING_C_WITH_CLANG
+ \ CONFIG
+ \ CONFIGURATION
+ \ CONTENT
+ \ CUDA_COMPILER_ID
+ \ CUDA_COMPILER_VERSION
+ \ CUDA_RESOLVE_DEVICE_SYMBOLS
+ \ CUDA_SEPARABLE_COMPILATION
+ \ CUSTOM_KEYS
+ \ CXX_COMPILER_ID
+ \ CXX_COMPILER_VERSION
+ \ CXX_CONFIG
+ \ CXX_STANDARD
+ \ C_COMPILER_ID
+ \ C_COMPILER_VERSION
+ \ C_STANDARD
+ \ DEBUG_MODE
+ \ DEBUG_POSTFIX
+ \ DENABLE_SOME_FEATURE
+ \ DESCENDING
+ \ DEVICE_LINK
+ \ DLL
+ \ ENABLE_EXPORTS
+ \ EXCLUDE
+ \ EXPORT
+ \ EXTENSION_DEF
+ \ FALSE
+ \ FILENAME_DEF
+ \ FILE_BASENAME
+ \ FILTER
+ \ FIND
+ \ FOO_EXTRA_THINGS
+ \ GENERATE
+ \ GENEX_EVAL
+ \ GET_EXTENSION
+ \ GET_FILENAME
+ \ GET_PARENT_PATH
+ \ GET_RELATIVE_PART
+ \ GET_ROOT_DIRECTORY
+ \ GET_ROOT_NAME
+ \ GET_ROOT_PATH
+ \ GET_STEM
+ \ HAS_
+ \ HAS_EXTENSION
+ \ HAS_FILENAME
+ \ HAS_PARENT_PATH
+ \ HAS_RELATIVE_PART
+ \ HAS_ROOT_DIRECTORY
+ \ HAS_ROOT_NAME
+ \ HAS_ROOT_PATH
+ \ HAS_STEM
+ \ HAVE_SOME_FEATURE
+ \ HIP_COMPILER_ID
+ \ HIP_COMPILER_VERSION
+ \ HIP_STANDARD
+ \ HOST_LINK
+ \ IF
+ \ IGNORE
+ \ IMPORTED_LOCATION
+ \ IMPORT_PREFIX
+ \ IMPORT_SUFFIX
+ \ INCLUDE_DIRECTORIES
+ \ INSENSITIVE
+ \ INSERT
+ \ INSTALL_INTERFACE
+ \ INSTALL_NAME_DIR
+ \ INSTALL_PREFIX
+ \ INSTALL_RPATH
+ \ INTERFACE_LINK_LIBRARIES
+ \ INTERFACE_LINK_LIBRARIES_DIRECT
+ \ IN_LIST
+ \ ISPC_COMPILER_ID
+ \ ISPC_COMPILER_VERSION
+ \ IS_ABSOLUTE
+ \ IS_PREFIX
+ \ IS_RELATIVE
+ \ JOIN
+ \ LANG
+ \ LANG_COMPILER_ID
+ \ LAST_ONLY
+ \ LENGTH
+ \ LIBRARY_OUTPUT_NAME
+ \ LIBRARY_OUTPUT_NAME_
+ \ LINK_GROUP
+ \ LINK_GROUP_PREDEFINED_FEATURES
+ \ LINK_LANGUAGE
+ \ LINK_LANG_AND_ID
+ \ LINK_LIBRARIES
+ \ LINK_LIBRARY
+ \ LINK_LIBRARY_OVERRIDE
+ \ LINK_LIBRARY_OVERRIDE_
+ \ LINK_LIBRARY_PREDEFINED_FEATURES
+ \ LINK_ONLY
+ \ LOWER_CASE
+ \ MAKE_C_IDENTIFIER
+ \ MAP_IMPORTED_CONFIG_
+ \ MODULE
+ \ NATURAL
+ \ NO
+ \ NORMALIZE
+ \ NORMAL_PATH
+ \ NOT
+ \ OBJCXX_COMPILER_ID
+ \ OBJCXX_COMPILER_VERSION
+ \ OBJC_COMPILER_ID
+ \ OBJC_COMPILER_VERSION
+ \ OBJECT
+ \ OFF
+ \ OLD_COMPILER
+ \ ORDER
+ \ OUTPUT
+ \ OUTPUT_CONFIG
+ \ OUTPUT_NAME
+ \ OUTPUT_NAME_
+ \ PATH
+ \ PATH_EQUAL
+ \ PDB_NAME
+ \ PDB_NAME_
+ \ PDB_OUTPUT_DIRECTORY
+ \ PDB_OUTPUT_DIRECTORY_
+ \ PLATFORM_ID
+ \ POP_BACK
+ \ POP_FRONT
+ \ POSIX
+ \ POST_BUILD
+ \ PREPEND
+ \ PRIVATE
+ \ PUBLIC
+ \ REGEX
+ \ RELATIVE_PATH
+ \ REMOVE_AT
+ \ REMOVE_DUPLICATES
+ \ REMOVE_EXTENSION
+ \ REMOVE_FILENAME
+ \ REMOVE_ITEM
+ \ REPLACE
+ \ REPLACE_EXTENSION
+ \ REPLACE_FILENAME
+ \ REQUIRED
+ \ RESCAN
+ \ REVERSE
+ \ RPATH
+ \ RUNTIME_DEPENDENCY_SET
+ \ RUNTIME_OUTPUT_NAME
+ \ RUNTIME_OUTPUT_NAME_
+ \ SCRIPT
+ \ SDK
+ \ SELECTOR
+ \ SEMICOLON
+ \ SENSITIVE
+ \ SHARED
+ \ SHELL_PATH
+ \ SORT
+ \ STATIC
+ \ STREQUAL
+ \ STRING
+ \ STRIP
+ \ SUBLIST
+ \ TARGET_BUNDLE_CONTENT_DIR
+ \ TARGET_BUNDLE_DIR
+ \ TARGET_BUNDLE_DIR_NAME
+ \ TARGET_EXISTS
+ \ TARGET_FILE
+ \ TARGET_FILE_BASE_NAME
+ \ TARGET_FILE_DIR
+ \ TARGET_FILE_NAME
+ \ TARGET_FILE_PREFIX
+ \ TARGET_FILE_SUFFIX
+ \ TARGET_GENEX_EVAL
+ \ TARGET_IMPORT_FILE
+ \ TARGET_IMPORT_FILE_BASE_NAME
+ \ TARGET_IMPORT_FILE_DIR
+ \ TARGET_IMPORT_FILE_NAME
+ \ TARGET_IMPORT_FILE_PREFIX
+ \ TARGET_IMPORT_FILE_SUFFIX
+ \ TARGET_LINKER_FILE
+ \ TARGET_LINKER_FILE_BASE_NAME
+ \ TARGET_LINKER_FILE_DIR
+ \ TARGET_LINKER_FILE_NAME
+ \ TARGET_LINKER_FILE_PREFIX
+ \ TARGET_LINKER_FILE_SUFFIX
+ \ TARGET_LINKER_IMPORT_FILE
+ \ TARGET_LINKER_IMPORT_FILE_BASE_NAME
+ \ TARGET_LINKER_IMPORT_FILE_DIR
+ \ TARGET_LINKER_IMPORT_FILE_NAME
+ \ TARGET_LINKER_IMPORT_FILE_PREFIX
+ \ TARGET_LINKER_IMPORT_FILE_SUFFIX
+ \ TARGET_LINKER_LIBRARY_FILE
+ \ TARGET_LINKER_LIBRARY_FILE_BASE_NAME
+ \ TARGET_LINKER_LIBRARY_FILE_DIR
+ \ TARGET_LINKER_LIBRARY_FILE_NAME
+ \ TARGET_LINKER_LIBRARY_FILE_PREFIX
+ \ TARGET_LINKER_LIBRARY_FILE_SUFFIX
+ \ TARGET_NAME_IF_EXISTS
+ \ TARGET_OBJECTS
+ \ TARGET_PDB_FILE
+ \ TARGET_PDB_FILE_BASE_NAME
+ \ TARGET_PDB_FILE_DIR
+ \ TARGET_PDB_FILE_NAME
+ \ TARGET_POLICY
+ \ TARGET_PROPERTY
+ \ TARGET_RUNTIME_DLLS
+ \ TARGET_RUNTIME_DLL_DIRS
+ \ TARGET_SONAME_FILE
+ \ TARGET_SONAME_FILE_DIR
+ \ TARGET_SONAME_FILE_NAME
+ \ TARGET_SONAME_IMPORT_FILE
+ \ TARGET_SONAME_IMPORT_FILE_DIR
+ \ TARGET_SONAME_IMPORT_FILE_NAME
+ \ TOLOWER
+ \ TOUPPER
+ \ TRANSFORM
+ \ TRANSFORM_APPEND
+ \ TRANSFORM_REPLACE
+ \ TRANSFORM_STRIP
+ \ TRANSFORM_TOLOWER
+ \ UNKNOWN
+ \ UPPER_CASE
+ \ VERBATIM
+ \ VERSION_EQUAL
+ \ VERSION_GREATER_EQUAL
+ \ VERSION_LESS
+ \ VERSION_LESS_EQUAL
+ \ WHOLE_ARCHIVE
+ \ WRONG
+ \ _LINK_GROUP_USING_
+ \ _LINK_LIBRARY_USING_
+ \ _POSTFIX
+ \ _SUPPORTED
syn case ignore
syn keyword cmakeCommand
- \ add_compile_options add_compile_definitions add_custom_command add_custom_target add_definitions add_dependencies add_executable add_library add_subdirectory add_test aux_source_directory break build_command cmake_host_system_information cmake_minimum_required cmake_parse_arguments cmake_policy configure_file continue create_test_sourcelist ctest_build ctest_configure ctest_coverage ctest_empty_binary_directory ctest_memcheck ctest_read_custom_files ctest_run_script ctest_sleep ctest_start ctest_submit ctest_test ctest_update ctest_upload define_property enable_language enable_testing endfunction endmacro execute_process export file find_file find_library find_package find_path find_program fltk_wrap_ui function get_cmake_property get_directory_property get_filename_component get_property get_source_file_property get_target_property get_test_property include include_directories include_external_msproject include_guard include_regular_expression install link_directories list load_cache load_command macro mark_as_advanced math message option project qt_wrap_cpp qt_wrap_ui remove_definitions return separate_arguments set set_directory_properties set_property set_source_files_properties set_target_properties set_tests_properties site_name source_group string target_compile_definitions target_compile_features target_compile_options target_include_directories target_link_libraries target_sources try_compile try_run unset variable_watch
+ \ add_compile_definitions
+ \ add_compile_options
+ \ add_custom_command
+ \ add_custom_target
+ \ add_definitions
+ \ add_dependencies
+ \ add_executable
+ \ add_library
+ \ add_link_options
+ \ add_subdirectory
+ \ add_test
+ \ aux_source_directory
+ \ block
+ \ break
+ \ build_command
+ \ cmake_file_api
+ \ cmake_host_system_information
+ \ cmake_language
+ \ cmake_minimum_required
+ \ cmake_parse_arguments
+ \ cmake_path
+ \ cmake_policy
+ \ configure_file
+ \ continue
+ \ create_test_sourcelist
+ \ ctest_build
+ \ ctest_configure
+ \ ctest_coverage
+ \ ctest_empty_binary_directory
+ \ ctest_memcheck
+ \ ctest_read_custom_files
+ \ ctest_run_script
+ \ ctest_sleep
+ \ ctest_start
+ \ ctest_submit
+ \ ctest_test
+ \ ctest_update
+ \ ctest_upload
+ \ define_property
+ \ enable_language
+ \ enable_testing
+ \ endblock
+ \ endfunction
+ \ endmacro
+ \ execute_process
+ \ export
+ \ file
+ \ find_file
+ \ find_library
+ \ find_package
+ \ find_path
+ \ find_program
+ \ fltk_wrap_ui
+ \ function
+ \ get_cmake_property
+ \ get_directory_property
+ \ get_filename_component
+ \ get_property
+ \ get_source_file_property
+ \ get_target_property
+ \ get_test_property
+ \ include
+ \ include_directories
+ \ include_external_msproject
+ \ include_guard
+ \ include_regular_expression
+ \ install
+ \ link_directories
+ \ list
+ \ load_cache
+ \ load_command
+ \ macro
+ \ mark_as_advanced
+ \ math
+ \ message
+ \ option
+ \ project
+ \ qt_wrap_cpp
+ \ qt_wrap_ui
+ \ remove_definitions
+ \ return
+ \ separate_arguments
+ \ set
+ \ set_directory_properties
+ \ set_property
+ \ set_source_files_properties
+ \ set_target_properties
+ \ set_tests_properties
+ \ site_name
+ \ source_group
+ \ string
+ \ target_compile_definitions
+ \ target_compile_features
+ \ target_compile_options
+ \ target_include_directories
+ \ target_link_directories
+ \ target_link_libraries
+ \ target_link_options
+ \ target_precompile_headers
+ \ target_sources
+ \ try_compile
+ \ try_run
+ \ unset
+ \ variable_watch
\ nextgroup=cmakeArguments
syn keyword cmakeCommandConditional
- \ else elseif endif if
+ \ else
+ \ elseif
+ \ endif
+ \ if
\ nextgroup=cmakeArguments
syn keyword cmakeCommandRepeat
- \ endforeach endwhile foreach while
+ \ endforeach
+ \ endwhile
+ \ foreach
+ \ while
\ nextgroup=cmakeArguments
syn keyword cmakeCommandDeprecated
- \ build_name exec_program export_library_dependencies install_files install_programs install_targets link_libraries make_directory output_required_files remove subdir_depends subdirs use_mangled_mesa utility_source variable_requires write_file
+ \ build_name
+ \ exec_program
+ \ export_library_dependencies
+ \ install_files
+ \ install_programs
+ \ install_targets
+ \ link_libraries
+ \ make_directory
+ \ output_required_files
+ \ remove
+ \ subdir_depends
+ \ subdirs
+ \ use_mangled_mesa
+ \ utility_source
+ \ variable_requires
+ \ write_file
\ nextgroup=cmakeArguments
syn case match
@@ -356,6 +4820,8 @@ syn keyword cmakeTodo
\ TODO FIXME XXX
\ contained
+hi def link cmakeBracketArgument String
+hi def link cmakeBracketComment Comment
hi def link cmakeCommand Function
hi def link cmakeCommandConditional Conditional
hi def link cmakeCommandDeprecated WarningMsg
@@ -365,7 +4831,6 @@ hi def link cmakeEnvironment Special
hi def link cmakeEscaped Special
hi def link cmakeGeneratorExpression WarningMsg
hi def link cmakeGeneratorExpressions Constant
-hi def link cmakeLuaComment Comment
hi def link cmakeModule Include
hi def link cmakeProperty Constant
hi def link cmakeRegistry Underlined
@@ -375,6 +4840,8 @@ hi def link cmakeVariableValue Type
hi def link cmakeVariable Identifier
hi def link cmakeKWExternalProject ModeMsg
+hi def link cmakeKWFetchContent ModeMsg
+hi def link cmakeKWadd_compile_definitions ModeMsg
hi def link cmakeKWadd_compile_options ModeMsg
hi def link cmakeKWadd_custom_command ModeMsg
hi def link cmakeKWadd_custom_target ModeMsg
@@ -382,13 +4849,17 @@ hi def link cmakeKWadd_definitions ModeMsg
hi def link cmakeKWadd_dependencies ModeMsg
hi def link cmakeKWadd_executable ModeMsg
hi def link cmakeKWadd_library ModeMsg
+hi def link cmakeKWadd_link_options ModeMsg
hi def link cmakeKWadd_subdirectory ModeMsg
hi def link cmakeKWadd_test ModeMsg
+hi def link cmakeKWblock ModeMsg
hi def link cmakeKWbuild_command ModeMsg
-hi def link cmakeKWbuild_name ModeMsg
+hi def link cmakeKWcmake_file_api ModeMsg
hi def link cmakeKWcmake_host_system_information ModeMsg
+hi def link cmakeKWcmake_language ModeMsg
hi def link cmakeKWcmake_minimum_required ModeMsg
hi def link cmakeKWcmake_parse_arguments ModeMsg
+hi def link cmakeKWcmake_path ModeMsg
hi def link cmakeKWcmake_policy ModeMsg
hi def link cmakeKWconfigure_file ModeMsg
hi def link cmakeKWcreate_test_sourcelist ModeMsg
@@ -403,7 +4874,9 @@ hi def link cmakeKWctest_test ModeMsg
hi def link cmakeKWctest_update ModeMsg
hi def link cmakeKWctest_upload ModeMsg
hi def link cmakeKWdefine_property ModeMsg
+hi def link cmakeKWdoxygen_add_docs ModeMsg
hi def link cmakeKWenable_language ModeMsg
+hi def link cmakeKWenable_testing ModeMsg
hi def link cmakeKWexec_program ModeMsg
hi def link cmakeKWexecute_process ModeMsg
hi def link cmakeKWexport ModeMsg
@@ -433,17 +4906,20 @@ hi def link cmakeKWinstall ModeMsg
hi def link cmakeKWinstall_files ModeMsg
hi def link cmakeKWinstall_programs ModeMsg
hi def link cmakeKWinstall_targets ModeMsg
+hi def link cmakeKWlink_directories ModeMsg
hi def link cmakeKWlist ModeMsg
hi def link cmakeKWload_cache ModeMsg
hi def link cmakeKWload_command ModeMsg
hi def link cmakeKWmacro ModeMsg
-hi def link cmakeKWmake_directory ModeMsg
hi def link cmakeKWmark_as_advanced ModeMsg
hi def link cmakeKWmath ModeMsg
hi def link cmakeKWmessage ModeMsg
hi def link cmakeKWoption ModeMsg
hi def link cmakeKWproject ModeMsg
+hi def link cmakeKWqt_wrap_cpp ModeMsg
+hi def link cmakeKWqt_wrap_ui ModeMsg
hi def link cmakeKWremove ModeMsg
+hi def link cmakeKWreturn ModeMsg
hi def link cmakeKWseparate_arguments ModeMsg
hi def link cmakeKWset ModeMsg
hi def link cmakeKWset_directory_properties ModeMsg
@@ -451,6 +4927,7 @@ hi def link cmakeKWset_property ModeMsg
hi def link cmakeKWset_source_files_properties ModeMsg
hi def link cmakeKWset_target_properties ModeMsg
hi def link cmakeKWset_tests_properties ModeMsg
+hi def link cmakeKWsite_name ModeMsg
hi def link cmakeKWsource_group ModeMsg
hi def link cmakeKWstring ModeMsg
hi def link cmakeKWsubdirs ModeMsg
@@ -458,7 +4935,10 @@ hi def link cmakeKWtarget_compile_definitions ModeMsg
hi def link cmakeKWtarget_compile_features ModeMsg
hi def link cmakeKWtarget_compile_options ModeMsg
hi def link cmakeKWtarget_include_directories ModeMsg
+hi def link cmakeKWtarget_link_directories ModeMsg
hi def link cmakeKWtarget_link_libraries ModeMsg
+hi def link cmakeKWtarget_link_options ModeMsg
+hi def link cmakeKWtarget_precompile_headers ModeMsg
hi def link cmakeKWtarget_sources ModeMsg
hi def link cmakeKWtry_compile ModeMsg
hi def link cmakeKWtry_run ModeMsg
@@ -466,9 +4946,32 @@ hi def link cmakeKWunset ModeMsg
hi def link cmakeKWuse_mangled_mesa ModeMsg
hi def link cmakeKWvariable_requires ModeMsg
hi def link cmakeKWvariable_watch ModeMsg
-hi def link cmakeKWwhile ModeMsg
hi def link cmakeKWwrite_file ModeMsg
+" Manually added - difficult to parse out of documentation
+syn case ignore
+
+syn keyword cmakeCommandManuallyAdded
+ \ configure_package_config_file write_basic_package_version_file
+ \ nextgroup=cmakeArguments
+
+syn case match
+
+syn keyword cmakeKWconfigure_package_config_file contained
+ \ INSTALL_DESTINATION PATH_VARS NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO INSTALL_PREFIX
+
+syn keyword cmakeKWconfigure_package_config_file_constants contained
+ \ AnyNewerVersion SameMajorVersion SameMinorVersion ExactVersion
+
+syn keyword cmakeKWwrite_basic_package_version_file contained
+ \ VERSION COMPATIBILITY
+
+hi def link cmakeCommandManuallyAdded Function
+
+hi def link cmakeKWconfigure_package_config_file ModeMsg
+hi def link cmakeKWwrite_basic_package_version_file ModeMsg
+hi def link cmakeKWconfigure_package_config_file_constants Constant
+
let b:current_syntax = "cmake"
let &cpo = s:keepcpo
diff --git a/runtime/syntax/cpp.vim b/runtime/syntax/cpp.vim
index 5437580a0a..8daf90a33c 100644
--- a/runtime/syntax/cpp.vim
+++ b/runtime/syntax/cpp.vim
@@ -2,7 +2,7 @@
" Language: C++
" Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp)
" Previous Maintainer: Ken Shan <ccshan@post.harvard.edu>
-" Last Change: 2021 Aug 23
+" Last Change: 2023 Dec 08
" quit when a syntax file was already loaded
if exists("b:current_syntax")
@@ -15,6 +15,7 @@ let b:filetype_in_cpp_family = 1
" Read the C syntax to start with
runtime! syntax/c.vim
unlet b:current_syntax
+unlet b:filetype_in_cpp_family
" C++ extensions
syn keyword cppStatement new delete this friend using
diff --git a/runtime/syntax/csh.vim b/runtime/syntax/csh.vim
index 6a056c7004..0ad85adfc7 100644
--- a/runtime/syntax/csh.vim
+++ b/runtime/syntax/csh.vim
@@ -1,9 +1,10 @@
" Vim syntax file
" Language: C-shell (csh)
-" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Charles E. Campbell
" Last Change: Aug 31, 2016
" Version: 14
-" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_CSH
+" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_CSH
" quit when a syntax file was already loaded
if exists("b:current_syntax")
diff --git a/runtime/syntax/css.vim b/runtime/syntax/css.vim
index f8104ea2c5..f4d09cfa4e 100644
--- a/runtime/syntax/css.vim
+++ b/runtime/syntax/css.vim
@@ -7,7 +7,7 @@
" Nikolai Weibull (Add CSS2 support)
" URL: https://github.com/vim-language-dept/css-syntax.vim
" Maintainer: Jay Sitter <jay@jaysitter.com>
-" Last Change: 2021 Oct 20
+" Last Change: 2024 Mar 2
" quit when a syntax file was already loaded
if !exists("main_syntax")
@@ -127,7 +127,7 @@ syn match cssColor contained "#\x\{8\}\>" contains=cssUnitDecorators
syn region cssURL contained matchgroup=cssFunctionName start="\<\(uri\|url\|local\|format\)\s*(" end=")" contains=cssStringQ,cssStringQQ oneline
syn region cssMathGroup contained matchgroup=cssMathParens start="(" end=")" containedin=cssFunction,cssMathGroup contains=cssCustomProp,cssValue.*,cssFunction,cssColor,cssStringQ,cssStringQQ oneline
-syn region cssFunction contained matchgroup=cssFunctionName start="\<\(var\|calc\)\s*(" end=")" contains=cssCustomProp,cssValue.*,cssFunction,cssColor,cssStringQ,cssStringQQ oneline
+syn region cssFunction contained matchgroup=cssFunctionName start="\<\(var\|calc\)\s*(" end=")" contains=cssCustomProp,cssValue.*,cssFunction,cssURL,cssColor,cssStringQ,cssStringQQ oneline
syn region cssFunction contained matchgroup=cssFunctionName start="\<\(rgb\|clip\|attr\|counter\|rect\|cubic-bezier\|steps\)\s*(" end=")" oneline contains=cssValueInteger,cssValueNumber,cssValueLength,cssFunctionComma
syn region cssFunction contained matchgroup=cssFunctionName start="\<\(rgba\|hsl\|hsla\|color-stop\|from\|to\)\s*(" end=")" oneline contains=cssColor,cssValueInteger,cssValueNumber,cssValueLength,cssFunctionComma,cssFunction
syn region cssFunction contained matchgroup=cssFunctionName start="\<\(linear-\|radial-\|conic-\)\=\gradient\s*(" end=")" oneline contains=cssColor,cssValueInteger,cssValueNumber,cssValueLength,cssFunction,cssGradientAttr,cssFunctionComma
@@ -176,6 +176,8 @@ syn keyword cssBackgroundAttr contained cover contain
syn match cssBorderProp contained "\<border\(-\(top\|right\|bottom\|left\)\)\=\(-\(width\|color\|style\)\)\=\>"
syn match cssBorderProp contained "\<border\(-\(top\|bottom\)-\(left\|right\)\)\=-radius\>"
+syn match cssBorderProp contained "\<border-\(inline\|block\)\(-\(start\|end\)\)\=\(-\(style\|width\|color\)\)\=\>"
+syn match cssBorderProp contained "\<border-\(start\|end\)-\(start\|end\)-radius\>"
syn match cssBorderProp contained "\<border-image\(-\(outset\|repeat\|slice\|source\|width\)\)\=\>"
syn match cssBorderProp contained "\<box-decoration-break\>"
syn match cssBorderProp contained "\<box-shadow\>"
@@ -195,6 +197,7 @@ syn keyword cssBorderAttr contained clone slice
syn match cssBoxProp contained "\<padding\(-\(top\|right\|bottom\|left\)\)\=\>"
syn match cssBoxProp contained "\<margin\(-\(top\|right\|bottom\|left\)\)\=\>"
+syn match cssBoxProp contained "\<\(margin\|padding\)\(-\(inline\|block\)\(-\(start\|end\)\)\)\=\>"
syn match cssBoxProp contained "\<overflow\(-\(x\|y\|style\)\)\=\>"
syn match cssBoxProp contained "\<rotation\(-point\)\=\>"
syn keyword cssBoxAttr contained visible hidden scroll auto
@@ -227,7 +230,7 @@ syn match cssFlexibleBoxAttr contained "\<space\(-\(between\|around\|evenly\)\)\
" CSS Fonts Module Level 3
" http://www.w3.org/TR/css-fonts-3/
-syn match cssFontProp contained "\<font\(-\(family\|\|feature-settings\|kerning\|language-override\|size\(-adjust\)\=\|stretch\|style\|synthesis\|variant\(-\(alternates\|caps\|east-asian\|ligatures\|numeric\|position\)\)\=\|weight\)\)\=\>"
+syn match cssFontProp contained "\<font\(-\(display\|family\|feature-settings\|kerning\|language-override\|size\(-adjust\)\=\|stretch\|style\|synthesis\|variant\(-\(alternates\|caps\|east-asian\|ligatures\|numeric\|position\)\)\=\|weight\)\)\=\>"
" font attributes
syn keyword cssFontAttr contained icon menu caption
@@ -248,6 +251,8 @@ syn keyword cssFontAttr contained italic oblique
syn keyword cssFontAttr contained weight style
" font-weight attributes
syn keyword cssFontAttr contained bold bolder lighter
+" font-display attributes
+syn keyword cssFontAttr contained auto block swap fallback optional
" TODO: font-variant-* attributes
"------------------------------------------------
@@ -282,7 +287,7 @@ syn match cssGeneratedContentAttr contained "\<\(no-\)\=\(open\|close\)-quote\>"
" https://www.w3.org/TR/css-grid-1/
syn match cssGridProp contained "\<grid\>"
syn match cssGridProp contained "\<grid-template\(-\(columns\|rows\|areas\)\)\=\>"
-syn match cssGridProp contained "\<grid-\(column\|row\)\(-\(start\|end\|gap\)\)\=\>"
+syn match cssGridProp contained "\<\(grid-\)\=\(column\|row\)\(-\(start\|end\|gap\)\)\=\>"
syn match cssGridProp contained "\<grid-\(area\|gap\)\>"
syn match cssGridProp contained "\<gap\>"
syn match cssGridProp contained "\<grid-auto-\(flow\|rows\|columns\)\>"
@@ -452,12 +457,12 @@ syn match cssAttrComma ","
" Pseudo class
" https://www.w3.org/TR/selectors-4/
syn match cssPseudoClass ":[A-Za-z0-9_-]*" contains=cssNoise,cssPseudoClassId,cssUnicodeEscape,cssVendor,cssPseudoClassFn
-syn keyword cssPseudoClassId contained link visited active hover before after left right any-link
-syn keyword cssPseudoClassId contained root empty target enabled disabled checked invalid default defined autofill fullscreen host indeterminate in-range modal optional out-of-range picture-in-picture placeholder-shown paused playing read-only read-write required scope
+syn keyword cssPseudoClassId contained link visited active hover before after left right
+syn keyword cssPseudoClassId contained root empty target enabled disabled checked invalid
syn match cssPseudoClassId contained "\<first-\(line\|letter\)\>"
syn match cssPseudoClassId contained "\<\(first\|last\|only\)-\(of-type\|child\)\>"
syn match cssPseudoClassId contained "\<focus\(-within\|-visible\)\=\>"
-syn region cssPseudoClassFn contained matchgroup=cssFunctionName start="\<\(where\|has\|host\|not\|is\|lang\|\(nth\|nth-last\)-\(of-type\|child\)\)(" end=")" contains=cssStringQ,cssStringQQ,cssTagName,cssAttributeSelector,cssClassName,cssIdentifier
+syn region cssPseudoClassFn contained matchgroup=cssFunctionName start="\<\(not\|is\|lang\|\(nth\|nth-last\)-\(of-type\|child\)\)(" end=")" contains=cssStringQ,cssStringQQ,cssTagName,cssAttributeSelector,cssClassName,cssIdentifier
" ------------------------------------
" Vendor specific properties
syn match cssPseudoClassId contained "\<selection\>"
diff --git a/runtime/syntax/cucumber.vim b/runtime/syntax/cucumber.vim
index f1ef2992ec..90fdbfaf4f 100644
--- a/runtime/syntax/cucumber.vim
+++ b/runtime/syntax/cucumber.vim
@@ -2,7 +2,7 @@
" Language: Cucumber
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Filenames: *.feature
-" Last Change: 2013 May 30
+" Last Change: 2023 Dec 28
if exists("b:current_syntax")
finish
@@ -14,60 +14,84 @@ syn case match
syn sync minlines=20
let g:cucumber_languages = {
- \"en": {"and": "And\\>", "background": "Background\\>", "but": "But\\>", "examples": "Scenarios\\>\\|Examples\\>", "feature": "Business Need\\>\\|Feature\\>\\|Ability\\>", "given": "Given\\>", "scenario": "Scenario\\>", "scenario_outline": "Scenario Template\\>\\|Scenario Outline\\>", "then": "Then\\>", "when": "When\\>"},
- \"ar": {"and": "\\%u0648\\>", "background": "\\%u0627\\%u0644\\%u062e\\%u0644\\%u0641\\%u064a\\%u0629\\>", "but": "\\%u0644\\%u0643\\%u0646\\>", "examples": "\\%u0627\\%u0645\\%u062b\\%u0644\\%u0629\\>", "feature": "\\%u062e\\%u0627\\%u0635\\%u064a\\%u0629\\>", "given": "\\%u0628\\%u0641\\%u0631\\%u0636\\>", "scenario": "\\%u0633\\%u064a\\%u0646\\%u0627\\%u0631\\%u064a\\%u0648\\>", "scenario_outline": "\\%u0633\\%u064a\\%u0646\\%u0627\\%u0631\\%u064a\\%u0648 \\%u0645\\%u062e\\%u0637\\%u0637\\>", "then": "\\%u0627\\%u0630\\%u0627\\%u064b\\>\\|\\%u062b\\%u0645\\>", "when": "\\%u0639\\%u0646\\%u062f\\%u0645\\%u0627\\>\\|\\%u0645\\%u062a\\%u0649\\>"},
- \"bg": {"and": "\\%u0418\\>", "background": "\\%u041f\\%u0440\\%u0435\\%u0434\\%u0438\\%u0441\\%u0442\\%u043e\\%u0440\\%u0438\\%u044f\\>", "but": "\\%u041d\\%u043e\\>", "examples": "\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\%u0438\\>", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\%u043d\\%u043e\\%u0441\\%u0442\\>", "given": "\\%u0414\\%u0430\\%u0434\\%u0435\\%u043d\\%u043e\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\>", "scenario_outline": "\\%u0420\\%u0430\\%u043c\\%u043a\\%u0430 \\%u043d\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\>", "then": "\\%u0422\\%u043e\\>", "when": "\\%u041a\\%u043e\\%u0433\\%u0430\\%u0442\\%u043e\\>"},
- \"bm": {"and": "Dan\\>", "background": "Latar Belakang\\>", "but": "Tetapi\\>", "examples": "Contoh \\>", "feature": "Fungsi\\>", "given": "Bagi\\>", "scenario": "Senario\\>", "scenario_outline": "Menggariskan Senario \\>", "then": "Kemudian\\>", "when": "Apabila\\>"},
- \"ca": {"and": "I\\>", "background": "Antecedents\\>\\|Rerefons\\>", "but": "Per\\%u00f2\\>", "examples": "Exemples\\>", "feature": "Caracter\\%u00edstica\\>\\|Funcionalitat\\>", "given": "At\\%u00e8s\\>\\|Donada\\>\\|Donat\\>\\|Atesa\\>", "scenario": "Escenari\\>", "scenario_outline": "Esquema de l'escenari\\>", "then": "Aleshores\\>\\|Cal\\>", "when": "Quan\\>"},
- \"cs": {"and": "A tak\\%u00e9\\>\\|A\\>", "background": "Pozad\\%u00ed\\>\\|Kontext\\>", "but": "Ale\\>", "examples": "P\\%u0159\\%u00edklady\\>", "feature": "Po\\%u017eadavek\\>", "given": "Za p\\%u0159edpokladu\\>\\|Pokud\\>", "scenario": "Sc\\%u00e9n\\%u00e1\\%u0159\\>", "scenario_outline": "N\\%u00e1\\%u010drt Sc\\%u00e9n\\%u00e1\\%u0159e\\>\\|Osnova sc\\%u00e9n\\%u00e1\\%u0159e\\>", "then": "Pak\\>", "when": "Kdy\\%u017e\\>"},
- \"cy-GB": {"and": "A\\>", "background": "Cefndir\\>", "but": "Ond\\>", "examples": "Enghreifftiau\\>", "feature": "Arwedd\\>", "given": "Anrhegedig a\\>", "scenario": "Scenario\\>", "scenario_outline": "Scenario Amlinellol\\>", "then": "Yna\\>", "when": "Pryd\\>"},
- \"da": {"and": "Og\\>", "background": "Baggrund\\>", "but": "Men\\>", "examples": "Eksempler\\>", "feature": "Egenskab\\>", "given": "Givet\\>", "scenario": "Scenarie\\>", "scenario_outline": "Abstrakt Scenario\\>", "then": "S\\%u00e5\\>", "when": "N\\%u00e5r\\>"},
- \"de": {"and": "Und\\>", "background": "Grundlage\\>", "but": "Aber\\>", "examples": "Beispiele\\>", "feature": "Funktionalit\\%u00e4t\\>", "given": "Gegeben sei\\>\\|Angenommen\\>", "scenario": "Szenario\\>", "scenario_outline": "Szenariogrundriss\\>", "then": "Dann\\>", "when": "Wenn\\>"},
- \"el": {"and": "\\%u039a\\%u03b1\\%u03b9\\>", "background": "\\%u03a5\\%u03c0\\%u03cc\\%u03b2\\%u03b1\\%u03b8\\%u03c1\\%u03bf\\>", "but": "\\%u0391\\%u03bb\\%u03bb\\%u03ac\\>", "examples": "\\%u03a0\\%u03b1\\%u03c1\\%u03b1\\%u03b4\\%u03b5\\%u03af\\%u03b3\\%u03bc\\%u03b1\\%u03c4\\%u03b1\\>\\|\\%u03a3\\%u03b5\\%u03bd\\%u03ac\\%u03c1\\%u03b9\\%u03b1\\>", "feature": "\\%u0394\\%u03c5\\%u03bd\\%u03b1\\%u03c4\\%u03cc\\%u03c4\\%u03b7\\%u03c4\\%u03b1\\>\\|\\%u039b\\%u03b5\\%u03b9\\%u03c4\\%u03bf\\%u03c5\\%u03c1\\%u03b3\\%u03af\\%u03b1\\>", "given": "\\%u0394\\%u03b5\\%u03b4\\%u03bf\\%u03bc\\%u03ad\\%u03bd\\%u03bf\\%u03c5 \\%u03cc\\%u03c4\\%u03b9\\>\\|\\%u0394\\%u03b5\\%u03b4\\%u03bf\\%u03bc\\%u03ad\\%u03bd\\%u03bf\\%u03c5\\>", "scenario": "\\%u03a3\\%u03b5\\%u03bd\\%u03ac\\%u03c1\\%u03b9\\%u03bf\\>", "scenario_outline": "\\%u03a0\\%u03b5\\%u03c1\\%u03b9\\%u03b3\\%u03c1\\%u03b1\\%u03c6\\%u03ae \\%u03a3\\%u03b5\\%u03bd\\%u03b1\\%u03c1\\%u03af\\%u03bf\\%u03c5\\>", "then": "\\%u03a4\\%u03cc\\%u03c4\\%u03b5\\>", "when": "\\%u038c\\%u03c4\\%u03b1\\%u03bd\\>"},
- \"en-Scouse": {"and": "An\\>", "background": "Dis is what went down\\>", "but": "Buh\\>", "examples": "Examples\\>", "feature": "Feature\\>", "given": "Youse know when youse got\\>\\|Givun\\>", "scenario": "The thing of it is\\>", "scenario_outline": "Wharrimean is\\>", "then": "Den youse gotta\\>\\|Dun\\>", "when": "Youse know like when\\>\\|Wun\\>"},
- \"en-au": {"and": "Too right\\>", "background": "First off\\>", "but": "Yeah nah\\>", "examples": "You'll wanna\\>", "feature": "Pretty much\\>", "given": "Y'know\\>", "scenario": "Awww, look mate\\>", "scenario_outline": "Reckon it's like\\>", "then": "But at the end of the day I reckon\\>", "when": "It's just unbelievable\\>"},
- \"en-lol": {"and": "AN\\>", "background": "B4\\>", "but": "BUT\\>", "examples": "EXAMPLZ\\>", "feature": "OH HAI\\>", "given": "I CAN HAZ\\>", "scenario": "MISHUN\\>", "scenario_outline": "MISHUN SRSLY\\>", "then": "DEN\\>", "when": "WEN\\>"},
- \"en-old": {"and": "Ond\\>\\|7\\>", "background": "\\%u00c6r\\>\\|Aer\\>", "but": "Ac\\>", "examples": "Se \\%u00f0e\\>\\|Se \\%u00fee\\>\\|Se the\\>", "feature": "Hw\\%u00e6t\\>\\|Hwaet\\>", "given": "\\%u00d0urh\\>\\|\\%u00deurh\\>\\|Thurh\\>", "scenario": "Swa\\>", "scenario_outline": "Swa hw\\%u00e6r swa\\>\\|Swa hwaer swa\\>", "then": "\\%u00d0a \\%u00f0e\\>\\|\\%u00dea \\%u00fee\\>\\|\\%u00dea\\>\\|\\%u00d0a\\>\\|Tha the\\>\\|Tha\\>", "when": "\\%u00d0a\\>\\|\\%u00dea\\>\\|Tha\\>"},
- \"en-pirate": {"and": "Aye\\>", "background": "Yo-ho-ho\\>", "but": "Avast!\\>", "examples": "Dead men tell no tales\\>", "feature": "Ahoy matey!\\>", "given": "Gangway!\\>", "scenario": "Heave to\\>", "scenario_outline": "Shiver me timbers\\>", "then": "Let go and haul\\>", "when": "Blimey!\\>"},
- \"en-tx": {"and": "And y'all\\>", "background": "Background\\>", "but": "But y'all\\>", "examples": "Examples\\>", "feature": "Feature\\>", "given": "Given y'all\\>", "scenario": "Scenario\\>", "scenario_outline": "All y'all\\>", "then": "Then y'all\\>", "when": "When y'all\\>"},
- \"eo": {"and": "Kaj\\>", "background": "Fono\\>", "but": "Sed\\>", "examples": "Ekzemploj\\>", "feature": "Trajto\\>", "given": "Donita\\%u0135o\\>", "scenario": "Scenaro\\>", "scenario_outline": "Konturo de la scenaro\\>", "then": "Do\\>", "when": "Se\\>"},
- \"es": {"and": "Y\\>", "background": "Antecedentes\\>", "but": "Pero\\>", "examples": "Ejemplos\\>", "feature": "Caracter\\%u00edstica\\>", "given": "Dadas\\>\\|Dados\\>\\|Dada\\>\\|Dado\\>", "scenario": "Escenario\\>", "scenario_outline": "Esquema del escenario\\>", "then": "Entonces\\>", "when": "Cuando\\>"},
- \"et": {"and": "Ja\\>", "background": "Taust\\>", "but": "Kuid\\>", "examples": "Juhtumid\\>", "feature": "Omadus\\>", "given": "Eeldades\\>", "scenario": "Stsenaarium\\>", "scenario_outline": "Raamstsenaarium\\>", "then": "Siis\\>", "when": "Kui\\>"},
- \"fa": {"and": "\\%u0648\\>", "background": "\\%u0632\\%u0645\\%u06cc\\%u0646\\%u0647\\>", "but": "\\%u0627\\%u0645\\%u0627\\>", "examples": "\\%u0646\\%u0645\\%u0648\\%u0646\\%u0647 \\%u0647\\%u0627\\>", "feature": "\\%u0648\\%u0650\\%u06cc\\%u0698\\%u06af\\%u06cc\\>", "given": "\\%u0628\\%u0627 \\%u0641\\%u0631\\%u0636\\>", "scenario": "\\%u0633\\%u0646\\%u0627\\%u0631\\%u06cc\\%u0648\\>", "scenario_outline": "\\%u0627\\%u0644\\%u06af\\%u0648\\%u06cc \\%u0633\\%u0646\\%u0627\\%u0631\\%u06cc\\%u0648\\>", "then": "\\%u0622\\%u0646\\%u06af\\%u0627\\%u0647\\>", "when": "\\%u0647\\%u0646\\%u06af\\%u0627\\%u0645\\%u06cc\\>"},
- \"fi": {"and": "Ja\\>", "background": "Tausta\\>", "but": "Mutta\\>", "examples": "Tapaukset\\>", "feature": "Ominaisuus\\>", "given": "Oletetaan\\>", "scenario": "Tapaus\\>", "scenario_outline": "Tapausaihio\\>", "then": "Niin\\>", "when": "Kun\\>"},
- \"fr": {"and": "Et\\>", "background": "Contexte\\>", "but": "Mais\\>", "examples": "Exemples\\>", "feature": "Fonctionnalit\\%u00e9\\>", "given": "\\%u00c9tant donn\\%u00e9es\\>\\|\\%u00c9tant donn\\%u00e9s\\>\\|\\%u00c9tant donn\\%u00e9e\\>\\|\\%u00c9tant donn\\%u00e9\\>\\|Etant donn\\%u00e9es\\>\\|Etant donn\\%u00e9s\\>\\|Etant donn\\%u00e9e\\>\\|Etant donn\\%u00e9\\>\\|Soit\\>", "scenario": "Sc\\%u00e9nario\\>", "scenario_outline": "Plan du sc\\%u00e9nario\\>\\|Plan du Sc\\%u00e9nario\\>", "then": "Alors\\>", "when": "Lorsqu'\\|Lorsque\\>\\|Quand\\>"},
- \"gl": {"and": "E\\>", "background": "Contexto\\>", "but": "Mais\\>\\|Pero\\>", "examples": "Exemplos\\>", "feature": "Caracter\\%u00edstica\\>", "given": "Dadas\\>\\|Dados\\>\\|Dada\\>\\|Dado\\>", "scenario": "Escenario\\>", "scenario_outline": "Esbozo do escenario\\>", "then": "Ent\\%u00f3n\\>\\|Logo\\>", "when": "Cando\\>"},
- \"he": {"and": "\\%u05d5\\%u05d2\\%u05dd\\>", "background": "\\%u05e8\\%u05e7\\%u05e2\\>", "but": "\\%u05d0\\%u05d1\\%u05dc\\>", "examples": "\\%u05d3\\%u05d5\\%u05d2\\%u05de\\%u05d0\\%u05d5\\%u05ea\\>", "feature": "\\%u05ea\\%u05db\\%u05d5\\%u05e0\\%u05d4\\>", "given": "\\%u05d1\\%u05d4\\%u05d9\\%u05e0\\%u05ea\\%u05df\\>", "scenario": "\\%u05ea\\%u05e8\\%u05d7\\%u05d9\\%u05e9\\>", "scenario_outline": "\\%u05ea\\%u05d1\\%u05e0\\%u05d9\\%u05ea \\%u05ea\\%u05e8\\%u05d7\\%u05d9\\%u05e9\\>", "then": "\\%u05d0\\%u05d6\\%u05d9\\>\\|\\%u05d0\\%u05d6\\>", "when": "\\%u05db\\%u05d0\\%u05e9\\%u05e8\\>"},
- \"hi": {"and": "\\%u0924\\%u0925\\%u093e\\>\\|\\%u0914\\%u0930\\>", "background": "\\%u092a\\%u0943\\%u0937\\%u094d\\%u0920\\%u092d\\%u0942\\%u092e\\%u093f\\>", "but": "\\%u092a\\%u0930\\>", "examples": "\\%u0909\\%u0926\\%u093e\\%u0939\\%u0930\\%u0923\\>", "feature": "\\%u0930\\%u0942\\%u092a \\%u0932\\%u0947\\%u0916\\>", "given": "\\%u091a\\%u0942\\%u0902\\%u0915\\%u093f\\>\\|\\%u092f\\%u0926\\%u093f\\>\\|\\%u0905\\%u0917\\%u0930\\>", "scenario": "\\%u092a\\%u0930\\%u093f\\%u0926\\%u0943\\%u0936\\%u094d\\%u092f\\>", "scenario_outline": "\\%u092a\\%u0930\\%u093f\\%u0926\\%u0943\\%u0936\\%u094d\\%u092f \\%u0930\\%u0942\\%u092a\\%u0930\\%u0947\\%u0916\\%u093e\\>", "then": "\\%u0924\\%u092c\\>", "when": "\\%u091c\\%u092c\\>"},
- \"hr": {"and": "I\\>", "background": "Pozadina\\>", "but": "Ali\\>", "examples": "Scenariji\\>\\|Primjeri\\>", "feature": "Mogu\\%u0107nost\\>\\|Mogucnost\\>\\|Osobina\\>", "given": "Zadano\\>\\|Zadani\\>\\|Zadan\\>", "scenario": "Scenarij\\>", "scenario_outline": "Koncept\\>\\|Skica\\>", "then": "Onda\\>", "when": "Kada\\>\\|Kad\\>"},
- \"hu": {"and": "\\%u00c9s\\>", "background": "H\\%u00e1tt\\%u00e9r\\>", "but": "De\\>", "examples": "P\\%u00e9ld\\%u00e1k\\>", "feature": "Jellemz\\%u0151\\>", "given": "Amennyiben\\>\\|Adott\\>", "scenario": "Forgat\\%u00f3k\\%u00f6nyv\\>", "scenario_outline": "Forgat\\%u00f3k\\%u00f6nyv v\\%u00e1zlat\\>", "then": "Akkor\\>", "when": "Amikor\\>\\|Majd\\>\\|Ha\\>"},
- \"id": {"and": "Dan\\>", "background": "Dasar\\>", "but": "Tapi\\>", "examples": "Contoh\\>", "feature": "Fitur\\>", "given": "Dengan\\>", "scenario": "Skenario\\>", "scenario_outline": "Skenario konsep\\>", "then": "Maka\\>", "when": "Ketika\\>"},
- \"is": {"and": "Og\\>", "background": "Bakgrunnur\\>", "but": "En\\>", "examples": "Atbur\\%u00f0ar\\%u00e1sir\\>\\|D\\%u00e6mi\\>", "feature": "Eiginleiki\\>", "given": "Ef\\>", "scenario": "Atbur\\%u00f0ar\\%u00e1s\\>", "scenario_outline": "L\\%u00fdsing Atbur\\%u00f0ar\\%u00e1sar\\>\\|L\\%u00fdsing D\\%u00e6ma\\>", "then": "\\%u00de\\%u00e1\\>", "when": "\\%u00deegar\\>"},
- \"it": {"and": "E\\>", "background": "Contesto\\>", "but": "Ma\\>", "examples": "Esempi\\>", "feature": "Funzionalit\\%u00e0\\>", "given": "Dato\\>\\|Data\\>\\|Dati\\>\\|Date\\>", "scenario": "Scenario\\>", "scenario_outline": "Schema dello scenario\\>", "then": "Allora\\>", "when": "Quando\\>"},
- \"ja": {"and": "\\%u304b\\%u3064", "background": "\\%u80cc\\%u666f\\>", "but": "\\%u3057\\%u304b\\%u3057\\|\\%u305f\\%u3060\\%u3057\\|\\%u4f46\\%u3057", "examples": "\\%u30b5\\%u30f3\\%u30d7\\%u30eb\\>\\|\\%u4f8b\\>", "feature": "\\%u30d5\\%u30a3\\%u30fc\\%u30c1\\%u30e3\\>\\|\\%u6a5f\\%u80fd\\>", "given": "\\%u524d\\%u63d0", "scenario": "\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\>", "scenario_outline": "\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\%u30a2\\%u30a6\\%u30c8\\%u30e9\\%u30a4\\%u30f3\\>\\|\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\%u30c6\\%u30f3\\%u30d7\\%u30ec\\%u30fc\\%u30c8\\>\\|\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\%u30c6\\%u30f3\\%u30d7\\%u30ec\\>\\|\\%u30c6\\%u30f3\\%u30d7\\%u30ec\\>", "then": "\\%u306a\\%u3089\\%u3070", "when": "\\%u3082\\%u3057"},
- \"ko": {"and": "\\%uadf8\\%ub9ac\\%uace0", "background": "\\%ubc30\\%uacbd\\>", "but": "\\%ud558\\%uc9c0\\%ub9cc\\|\\%ub2e8", "examples": "\\%uc608\\>", "feature": "\\%uae30\\%ub2a5\\>", "given": "\\%uc870\\%uac74\\|\\%uba3c\\%uc800", "scenario": "\\%uc2dc\\%ub098\\%ub9ac\\%uc624\\>", "scenario_outline": "\\%uc2dc\\%ub098\\%ub9ac\\%uc624 \\%uac1c\\%uc694\\>", "then": "\\%uadf8\\%ub7ec\\%uba74", "when": "\\%ub9cc\\%uc77c\\|\\%ub9cc\\%uc57d"},
- \"lt": {"and": "Ir\\>", "background": "Kontekstas\\>", "but": "Bet\\>", "examples": "Pavyzd\\%u017eiai\\>\\|Scenarijai\\>\\|Variantai\\>", "feature": "Savyb\\%u0117\\>", "given": "Duota\\>", "scenario": "Scenarijus\\>", "scenario_outline": "Scenarijaus \\%u0161ablonas\\>", "then": "Tada\\>", "when": "Kai\\>"},
- \"lu": {"and": "an\\>\\|a\\>", "background": "Hannergrond\\>", "but": "m\\%u00e4\\>\\|awer\\>", "examples": "Beispiller\\>", "feature": "Funktionalit\\%u00e9it\\>", "given": "ugeholl\\>", "scenario": "Szenario\\>", "scenario_outline": "Plang vum Szenario\\>", "then": "dann\\>", "when": "wann\\>"},
- \"lv": {"and": "Un\\>", "background": "Situ\\%u0101cija\\>\\|Konteksts\\>", "but": "Bet\\>", "examples": "Piem\\%u0113ri\\>\\|Paraugs\\>", "feature": "Funkcionalit\\%u0101te\\>\\|F\\%u012b\\%u010da\\>", "given": "Kad\\>", "scenario": "Scen\\%u0101rijs\\>", "scenario_outline": "Scen\\%u0101rijs p\\%u0113c parauga\\>", "then": "Tad\\>", "when": "Ja\\>"},
- \"nl": {"and": "En\\>", "background": "Achtergrond\\>", "but": "Maar\\>", "examples": "Voorbeelden\\>", "feature": "Functionaliteit\\>", "given": "Gegeven\\>\\|Stel\\>", "scenario": "Scenario\\>", "scenario_outline": "Abstract Scenario\\>", "then": "Dan\\>", "when": "Als\\>"},
- \"no": {"and": "Og\\>", "background": "Bakgrunn\\>", "but": "Men\\>", "examples": "Eksempler\\>", "feature": "Egenskap\\>", "given": "Gitt\\>", "scenario": "Scenario\\>", "scenario_outline": "Abstrakt Scenario\\>\\|Scenariomal\\>", "then": "S\\%u00e5\\>", "when": "N\\%u00e5r\\>"},
- \"pl": {"and": "Oraz\\>\\|I\\>", "background": "Za\\%u0142o\\%u017cenia\\>", "but": "Ale\\>", "examples": "Przyk\\%u0142ady\\>", "feature": "W\\%u0142a\\%u015bciwo\\%u015b\\%u0107\\>\\|Potrzeba biznesowa\\>\\|Funkcja\\>\\|Aspekt\\>", "given": "Zak\\%u0142adaj\\%u0105c\\>\\|Maj\\%u0105c\\>", "scenario": "Scenariusz\\>", "scenario_outline": "Szablon scenariusza\\>", "then": "Wtedy\\>", "when": "Je\\%u017celi\\>\\|Je\\%u015bli\\>\\|Kiedy\\>\\|Gdy\\>"},
- \"pt": {"and": "E\\>", "background": "Cen\\%u00e1rio de Fundo\\>\\|Cenario de Fundo\\>\\|Contexto\\>\\|Fundo\\>", "but": "Mas\\>", "examples": "Cen\\%u00e1rios\\>\\|Exemplos\\>\\|Cenarios\\>", "feature": "Caracter\\%u00edstica\\>\\|Funcionalidade\\>\\|Caracteristica\\>", "given": "Dadas\\>\\|Dados\\>\\|Dada\\>\\|Dado\\>", "scenario": "Cen\\%u00e1rio\\>\\|Cenario\\>", "scenario_outline": "Delinea\\%u00e7\\%u00e3o do Cen\\%u00e1rio\\>\\|Esquema do Cen\\%u00e1rio\\>\\|Delineacao do Cenario\\>\\|Esquema do Cenario\\>", "then": "Ent\\%u00e3o\\>\\|Entao\\>", "when": "Quando\\>"},
- \"ro": {"and": "\\%u015ei\\>\\|\\%u0218i\\>\\|Si\\>", "background": "Context\\>", "but": "Dar\\>", "examples": "Exemple\\>", "feature": "Func\\%u0163ionalitate\\>\\|Func\\%u021bionalitate\\>\\|Functionalitate\\>", "given": "Da\\%u0163i fiind\\>\\|Da\\%u021bi fiind\\>\\|Dati fiind\\>\\|Date fiind\\>\\|Dat fiind\\>", "scenario": "Scenariu\\>", "scenario_outline": "Structur\\%u0103 scenariu\\>\\|Structura scenariu\\>", "then": "Atunci\\>", "when": "C\\%u00e2nd\\>\\|Cand\\>"},
- \"ru": {"and": "\\%u041a \\%u0442\\%u043e\\%u043c\\%u0443 \\%u0436\\%u0435\\>\\|\\%u0422\\%u0430\\%u043a\\%u0436\\%u0435\\>\\|\\%u0418\\>", "background": "\\%u041f\\%u0440\\%u0435\\%u0434\\%u044b\\%u0441\\%u0442\\%u043e\\%u0440\\%u0438\\%u044f\\>\\|\\%u041a\\%u043e\\%u043d\\%u0442\\%u0435\\%u043a\\%u0441\\%u0442\\>", "but": "\\%u041d\\%u043e\\>\\|\\%u0410\\>", "examples": "\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\%u044b\\>", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\>\\|\\%u0421\\%u0432\\%u043e\\%u0439\\%u0441\\%u0442\\%u0432\\%u043e\\>\\|\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u044f\\>", "given": "\\%u0414\\%u043e\\%u043f\\%u0443\\%u0441\\%u0442\\%u0438\\%u043c\\>\\|\\%u041f\\%u0443\\%u0441\\%u0442\\%u044c\\>\\|\\%u0414\\%u0430\\%u043d\\%u043e\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\>", "scenario_outline": "\\%u0421\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u044f\\>", "then": "\\%u0422\\%u043e\\%u0433\\%u0434\\%u0430\\>\\|\\%u0422\\%u043e\\>", "when": "\\%u041a\\%u043e\\%u0433\\%u0434\\%u0430\\>\\|\\%u0415\\%u0441\\%u043b\\%u0438\\>"},
- \"sk": {"and": "A z\\%u00e1rove\\%u0148\\>\\|A taktie\\%u017e\\>\\|A tie\\%u017e\\>\\|A\\>", "background": "Pozadie\\>", "but": "Ale\\>", "examples": "Pr\\%u00edklady\\>", "feature": "Po\\%u017eiadavka\\>\\|Vlastnos\\%u0165\\>\\|Funkcia\\>", "given": "Za predpokladu\\>\\|Pokia\\%u013e\\>", "scenario": "Scen\\%u00e1r\\>", "scenario_outline": "N\\%u00e1\\%u010drt Scen\\%u00e1ru\\>\\|N\\%u00e1\\%u010drt Scen\\%u00e1ra\\>\\|Osnova Scen\\%u00e1ra\\>", "then": "Potom\\>\\|Tak\\>", "when": "Ke\\%u010f\\>\\|Ak\\>"},
- \"sr-Cyrl": {"and": "\\%u0418\\>", "background": "\\%u041a\\%u043e\\%u043d\\%u0442\\%u0435\\%u043a\\%u0441\\%u0442\\>\\|\\%u041f\\%u043e\\%u0437\\%u0430\\%u0434\\%u0438\\%u043d\\%u0430\\>\\|\\%u041e\\%u0441\\%u043d\\%u043e\\%u0432\\%u0430\\>", "but": "\\%u0410\\%u043b\\%u0438\\>", "examples": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0458\\%u0438\\>\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\%u0438\\>", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\%u043d\\%u043e\\%u0441\\%u0442\\>\\|\\%u041c\\%u043e\\%u0433\\%u0443\\%u045b\\%u043d\\%u043e\\%u0441\\%u0442\\>\\|\\%u041e\\%u0441\\%u043e\\%u0431\\%u0438\\%u043d\\%u0430\\>", "given": "\\%u0417\\%u0430\\%u0434\\%u0430\\%u0442\\%u043e\\>\\|\\%u0417\\%u0430\\%u0434\\%u0430\\%u0442\\%u0435\\>\\|\\%u0417\\%u0430\\%u0434\\%u0430\\%u0442\\%u0438\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u043e\\>\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\>", "scenario_outline": "\\%u0421\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0458\\%u0430\\>\\|\\%u041a\\%u043e\\%u043d\\%u0446\\%u0435\\%u043f\\%u0442\\>\\|\\%u0421\\%u043a\\%u0438\\%u0446\\%u0430\\>", "then": "\\%u041e\\%u043d\\%u0434\\%u0430\\>", "when": "\\%u041a\\%u0430\\%u0434\\%u0430\\>\\|\\%u041a\\%u0430\\%u0434\\>"},
- \"sr-Latn": {"and": "I\\>", "background": "Kontekst\\>\\|Pozadina\\>\\|Osnova\\>", "but": "Ali\\>", "examples": "Scenariji\\>\\|Primeri\\>", "feature": "Mogu\\%u0107nost\\>\\|Funkcionalnost\\>\\|Mogucnost\\>\\|Osobina\\>", "given": "Zadato\\>\\|Zadate\\>\\|Zatati\\>", "scenario": "Scenario\\>\\|Primer\\>", "scenario_outline": "Struktura scenarija\\>\\|Koncept\\>\\|Skica\\>", "then": "Onda\\>", "when": "Kada\\>\\|Kad\\>"},
- \"sv": {"and": "Och\\>", "background": "Bakgrund\\>", "but": "Men\\>", "examples": "Exempel\\>", "feature": "Egenskap\\>", "given": "Givet\\>", "scenario": "Scenario\\>", "scenario_outline": "Abstrakt Scenario\\>\\|Scenariomall\\>", "then": "S\\%u00e5\\>", "when": "N\\%u00e4r\\>"},
- \"th": {"and": "\\%u0e41\\%u0e25\\%u0e30\\>", "background": "\\%u0e41\\%u0e19\\%u0e27\\%u0e04\\%u0e34\\%u0e14\\>", "but": "\\%u0e41\\%u0e15\\%u0e48\\>", "examples": "\\%u0e0a\\%u0e38\\%u0e14\\%u0e02\\%u0e2d\\%u0e07\\%u0e40\\%u0e2b\\%u0e15\\%u0e38\\%u0e01\\%u0e32\\%u0e23\\%u0e13\\%u0e4c\\>\\|\\%u0e0a\\%u0e38\\%u0e14\\%u0e02\\%u0e2d\\%u0e07\\%u0e15\\%u0e31\\%u0e27\\%u0e2d\\%u0e22\\%u0e48\\%u0e32\\%u0e07\\>", "feature": "\\%u0e04\\%u0e27\\%u0e32\\%u0e21\\%u0e15\\%u0e49\\%u0e2d\\%u0e07\\%u0e01\\%u0e32\\%u0e23\\%u0e17\\%u0e32\\%u0e07\\%u0e18\\%u0e38\\%u0e23\\%u0e01\\%u0e34\\%u0e08\\>\\|\\%u0e04\\%u0e27\\%u0e32\\%u0e21\\%u0e2a\\%u0e32\\%u0e21\\%u0e32\\%u0e23\\%u0e16\\>\\|\\%u0e42\\%u0e04\\%u0e23\\%u0e07\\%u0e2b\\%u0e25\\%u0e31\\%u0e01\\>", "given": "\\%u0e01\\%u0e33\\%u0e2b\\%u0e19\\%u0e14\\%u0e43\\%u0e2b\\%u0e49\\>", "scenario": "\\%u0e40\\%u0e2b\\%u0e15\\%u0e38\\%u0e01\\%u0e32\\%u0e23\\%u0e13\\%u0e4c\\>", "scenario_outline": "\\%u0e42\\%u0e04\\%u0e23\\%u0e07\\%u0e2a\\%u0e23\\%u0e49\\%u0e32\\%u0e07\\%u0e02\\%u0e2d\\%u0e07\\%u0e40\\%u0e2b\\%u0e15\\%u0e38\\%u0e01\\%u0e32\\%u0e23\\%u0e13\\%u0e4c\\>\\|\\%u0e2a\\%u0e23\\%u0e38\\%u0e1b\\%u0e40\\%u0e2b\\%u0e15\\%u0e38\\%u0e01\\%u0e32\\%u0e23\\%u0e13\\%u0e4c\\>", "then": "\\%u0e14\\%u0e31\\%u0e07\\%u0e19\\%u0e31\\%u0e49\\%u0e19\\>", "when": "\\%u0e40\\%u0e21\\%u0e37\\%u0e48\\%u0e2d\\>"},
- \"tl": {"and": "\\%u0c2e\\%u0c30\\%u0c3f\\%u0c2f\\%u0c41\\>", "background": "\\%u0c28\\%u0c47\\%u0c2a\\%u0c25\\%u0c4d\\%u0c2f\\%u0c02\\>", "but": "\\%u0c15\\%u0c3e\\%u0c28\\%u0c3f\\>", "examples": "\\%u0c09\\%u0c26\\%u0c3e\\%u0c39\\%u0c30\\%u0c23\\%u0c32\\%u0c41\\>", "feature": "\\%u0c17\\%u0c41\\%u0c23\\%u0c2e\\%u0c41\\>", "given": "\\%u0c1a\\%u0c46\\%u0c2a\\%u0c4d\\%u0c2a\\%u0c2c\\%u0c21\\%u0c3f\\%u0c28\\%u0c26\\%u0c3f\\>", "scenario": "\\%u0c38\\%u0c28\\%u0c4d\\%u0c28\\%u0c3f\\%u0c35\\%u0c47\\%u0c36\\%u0c02\\>", "scenario_outline": "\\%u0c15\\%u0c25\\%u0c28\\%u0c02\\>", "then": "\\%u0c05\\%u0c2a\\%u0c4d\\%u0c2a\\%u0c41\\%u0c21\\%u0c41\\>", "when": "\\%u0c08 \\%u0c2a\\%u0c30\\%u0c3f\\%u0c38\\%u0c4d\\%u0c25\\%u0c3f\\%u0c24\\%u0c3f\\%u0c32\\%u0c4b\\>"},
- \"tr": {"and": "Ve\\>", "background": "Ge\\%u00e7mi\\%u015f\\>", "but": "Fakat\\>\\|Ama\\>", "examples": "\\%u00d6rnekler\\>", "feature": "\\%u00d6zellik\\>", "given": "Diyelim ki\\>", "scenario": "Senaryo\\>", "scenario_outline": "Senaryo tasla\\%u011f\\%u0131\\>", "then": "O zaman\\>", "when": "E\\%u011fer ki\\>"},
- \"tt": {"and": "\\%u04ba\\%u04d9\\%u043c\\>\\|\\%u0412\\%u04d9\\>", "background": "\\%u041a\\%u0435\\%u0440\\%u0435\\%u0448\\>", "but": "\\%u041b\\%u04d9\\%u043a\\%u0438\\%u043d\\>\\|\\%u04d8\\%u043c\\%u043c\\%u0430\\>", "examples": "\\%u04ae\\%u0440\\%u043d\\%u04d9\\%u043a\\%u043b\\%u04d9\\%u0440\\>\\|\\%u041c\\%u0438\\%u0441\\%u0430\\%u043b\\%u043b\\%u0430\\%u0440\\>", "feature": "\\%u04ae\\%u0437\\%u0435\\%u043d\\%u0447\\%u04d9\\%u043b\\%u0435\\%u043a\\%u043b\\%u0435\\%u043b\\%u0435\\%u043a\\>\\|\\%u041c\\%u04e9\\%u043c\\%u043a\\%u0438\\%u043d\\%u043b\\%u0435\\%u043a\\>", "given": "\\%u04d8\\%u0439\\%u0442\\%u0438\\%u043a\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\>", "scenario_outline": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\%u043d\\%u044b\\%u04a3 \\%u0442\\%u04e9\\%u0437\\%u0435\\%u043b\\%u0435\\%u0448\\%u0435\\>", "then": "\\%u041d\\%u04d9\\%u0442\\%u0438\\%u0497\\%u04d9\\%u0434\\%u04d9\\>", "when": "\\%u04d8\\%u0433\\%u04d9\\%u0440\\>"},
- \"uk": {"and": "\\%u0410 \\%u0442\\%u0430\\%u043a\\%u043e\\%u0436\\>\\|\\%u0422\\%u0430\\>\\|\\%u0406\\>", "background": "\\%u041f\\%u0435\\%u0440\\%u0435\\%u0434\\%u0443\\%u043c\\%u043e\\%u0432\\%u0430\\>", "but": "\\%u0410\\%u043b\\%u0435\\>", "examples": "\\%u041f\\%u0440\\%u0438\\%u043a\\%u043b\\%u0430\\%u0434\\%u0438\\>", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0456\\%u043e\\%u043d\\%u0430\\%u043b\\>", "given": "\\%u041f\\%u0440\\%u0438\\%u043f\\%u0443\\%u0441\\%u0442\\%u0438\\%u043c\\%u043e, \\%u0449\\%u043e\\>\\|\\%u041f\\%u0440\\%u0438\\%u043f\\%u0443\\%u0441\\%u0442\\%u0438\\%u043c\\%u043e\\>\\|\\%u041d\\%u0435\\%u0445\\%u0430\\%u0439\\>\\|\\%u0414\\%u0430\\%u043d\\%u043e\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0456\\%u0439\\>", "scenario_outline": "\\%u0421\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0456\\%u044e\\>", "then": "\\%u0422\\%u043e\\%u0434\\%u0456\\>\\|\\%u0422\\%u043e\\>", "when": "\\%u042f\\%u043a\\%u0449\\%u043e\\>\\|\\%u041a\\%u043e\\%u043b\\%u0438\\>"},
- \"uz": {"and": "\\%u0412\\%u0430\\>", "background": "\\%u0422\\%u0430\\%u0440\\%u0438\\%u0445\\>", "but": "\\%u041b\\%u0435\\%u043a\\%u0438\\%u043d\\>\\|\\%u0411\\%u0438\\%u0440\\%u043e\\%u043a\\>\\|\\%u0410\\%u043c\\%u043c\\%u043e\\>", "examples": "\\%u041c\\%u0438\\%u0441\\%u043e\\%u043b\\%u043b\\%u0430\\%u0440\\>", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\>", "given": "\\%u0410\\%u0433\\%u0430\\%u0440\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\>", "scenario_outline": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439 \\%u0441\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430\\%u0441\\%u0438\\>", "then": "\\%u0423\\%u043d\\%u0434\\%u0430\\>", "when": "\\%u0410\\%u0433\\%u0430\\%u0440\\>"},
- \"vi": {"and": "V\\%u00e0\\>", "background": "B\\%u1ed1i c\\%u1ea3nh\\>", "but": "Nh\\%u01b0ng\\>", "examples": "D\\%u1eef li\\%u1ec7u\\>", "feature": "T\\%u00ednh n\\%u0103ng\\>", "given": "Bi\\%u1ebft\\>\\|Cho\\>", "scenario": "T\\%u00ecnh hu\\%u1ed1ng\\>\\|K\\%u1ecbch b\\%u1ea3n\\>", "scenario_outline": "Khung t\\%u00ecnh hu\\%u1ed1ng\\>\\|Khung k\\%u1ecbch b\\%u1ea3n\\>", "then": "Th\\%u00ec\\>", "when": "Khi\\>"},
- \"zh-CN": {"and": "\\%u800c\\%u4e14\\|\\%u5e76\\%u4e14\\|\\%u540c\\%u65f6", "background": "\\%u80cc\\%u666f\\>", "but": "\\%u4f46\\%u662f", "examples": "\\%u4f8b\\%u5b50\\>", "feature": "\\%u529f\\%u80fd\\>", "given": "\\%u5047\\%u5982\\|\\%u5047\\%u8bbe\\|\\%u5047\\%u5b9a", "scenario": "\\%u573a\\%u666f\\>\\|\\%u5267\\%u672c\\>", "scenario_outline": "\\%u573a\\%u666f\\%u5927\\%u7eb2\\>\\|\\%u5267\\%u672c\\%u5927\\%u7eb2\\>", "then": "\\%u90a3\\%u4e48", "when": "\\%u5f53"},
- \"zh-TW": {"and": "\\%u800c\\%u4e14\\|\\%u4e26\\%u4e14\\|\\%u540c\\%u6642", "background": "\\%u80cc\\%u666f\\>", "but": "\\%u4f46\\%u662f", "examples": "\\%u4f8b\\%u5b50\\>", "feature": "\\%u529f\\%u80fd\\>", "given": "\\%u5047\\%u5982\\|\\%u5047\\%u8a2d\\|\\%u5047\\%u5b9a", "scenario": "\\%u5834\\%u666f\\>\\|\\%u5287\\%u672c\\>", "scenario_outline": "\\%u5834\\%u666f\\%u5927\\%u7db1\\>\\|\\%u5287\\%u672c\\%u5927\\%u7db1\\>", "then": "\\%u90a3\\%u9ebc", "when": "\\%u7576"}}
+ \"en": {"and": "And\\>", "background": "Background", "but": "But\\>", "examples": "Scenarios\\|Examples", "feature": "Business Need\\|Feature\\|Ability", "given": "Given\\>", "rule": "Rule", "scenario": "Scenario\\|Example", "scenario_outline": "Scenario Template\\|Scenario Outline", "then": "Then\\>", "when": "When\\>"},
+ \"af": {"and": "En\\>", "background": "Agtergrond", "but": "Maar\\>", "examples": "Voorbeelde", "feature": "Besigheid Behoefte\\|Funksie\\|Vermo\\%u00eb", "given": "Gegewe\\>", "rule": "Regel", "scenario": "Voorbeeld\\|Situasie", "scenario_outline": "Situasie Uiteensetting", "then": "Dan\\>", "when": "Wanneer\\>"},
+ \"am": {"and": "\\%u0535\\%u057e\\>", "background": "\\%u053f\\%u0578\\%u0576\\%u057f\\%u0565\\%u0584\\%u057d\\%u057f", "but": "\\%u0532\\%u0561\\%u0575\\%u0581\\>", "examples": "\\%u0555\\%u0580\\%u056b\\%u0576\\%u0561\\%u056f\\%u0576\\%u0565\\%u0580", "feature": "\\%u0556\\%u0578\\%u0582\\%u0576\\%u056f\\%u0581\\%u056b\\%u0578\\%u0576\\%u0561\\%u056c\\%u0578\\%u0582\\%u0569\\%u0575\\%u0578\\%u0582\\%u0576\\|\\%u0540\\%u0561\\%u057f\\%u056f\\%u0578\\%u0582\\%u0569\\%u0575\\%u0578\\%u0582\\%u0576", "given": "\\%u0534\\%u056b\\%u0581\\%u0578\\%u0582\\%u0584\\>", "rule": "Rule", "scenario": "\\%u0555\\%u0580\\%u056b\\%u0576\\%u0561\\%u056f\\|\\%u054d\\%u0581\\%u0565\\%u0576\\%u0561\\%u0580", "scenario_outline": "\\%u054d\\%u0581\\%u0565\\%u0576\\%u0561\\%u0580\\%u056b \\%u056f\\%u0561\\%u057c\\%u0578\\%u0582\\%u0581\\%u057e\\%u0561\\%u0581\\%u0584\\%u0568", "then": "\\%u0531\\%u057a\\%u0561\\>", "when": "\\%u0535\\%u0569\\%u0565\\>\\|\\%u0535\\%u0580\\%u0562\\>"},
+ \"amh": {"and": "\\%u12a5\\%u1293\\>", "background": "\\%u1245\\%u12f5\\%u1218 \\%u1201\\%u1294\\%u1273\\|\\%u1218\\%u1290\\%u123b \\%u1200\\%u1233\\%u1265\\|\\%u1218\\%u1290\\%u123b", "but": "\\%u130d\\%u1295\\>", "examples": "\\%u121d\\%u1233\\%u120c\\%u12ce\\%u127d\\|\\%u1201\\%u1293\\%u1274\\%u12ce\\%u127d", "feature": "\\%u12e8\\%u121a\\%u1348\\%u1208\\%u1308\\%u12cd \\%u12f5\\%u122d\\%u130a\\%u1275\\|\\%u12e8\\%u1270\\%u1348\\%u1208\\%u1308\\%u12cd \\%u1235\\%u122b\\|\\%u1235\\%u122b", "given": "\\%u12e8\\%u1270\\%u1230\\%u1320\\>", "rule": "\\%u1205\\%u130d", "scenario": "\\%u121d\\%u1233\\%u120c\\|\\%u1201\\%u1293\\%u1274", "scenario_outline": "\\%u1201\\%u1293\\%u1274 \\%u12dd\\%u122d\\%u12dd\\%u122d\\|\\%u1201\\%u1293\\%u1274 \\%u12a0\\%u1265\\%u1290\\%u1275", "then": "\\%u12a8\\%u12da\\%u12eb\\>", "when": "\\%u1218\\%u127c\\>"},
+ \"an": {"and": "Y\\>\\|E\\>", "background": "Antecedents", "but": "Pero\\>", "examples": "Eixemplos", "feature": "Caracteristica", "given": "Dadas\\>\\|Dada\\>\\|Daus\\>\\|Dau\\>", "rule": "Rule", "scenario": "Eixemplo\\|Caso", "scenario_outline": "Esquema del caso", "then": "Antonces\\>\\|Alavez\\>\\|Allora\\>", "when": "Cuan\\>"},
+ \"ar": {"and": "\\%u0648\\>", "background": "\\%u0627\\%u0644\\%u062e\\%u0644\\%u0641\\%u064a\\%u0629", "but": "\\%u0644\\%u0643\\%u0646\\>", "examples": "\\%u0627\\%u0645\\%u062b\\%u0644\\%u0629", "feature": "\\%u062e\\%u0627\\%u0635\\%u064a\\%u0629", "given": "\\%u0628\\%u0641\\%u0631\\%u0636\\>", "rule": "Rule", "scenario": "\\%u0633\\%u064a\\%u0646\\%u0627\\%u0631\\%u064a\\%u0648\\|\\%u0645\\%u062b\\%u0627\\%u0644", "scenario_outline": "\\%u0633\\%u064a\\%u0646\\%u0627\\%u0631\\%u064a\\%u0648 \\%u0645\\%u062e\\%u0637\\%u0637", "then": "\\%u0627\\%u0630\\%u0627\\%u064b\\>\\|\\%u062b\\%u0645\\>", "when": "\\%u0639\\%u0646\\%u062f\\%u0645\\%u0627\\>\\|\\%u0645\\%u062a\\%u0649\\>"},
+ \"ast": {"and": "Ya\\>\\|Y\\>", "background": "Antecedentes", "but": "Peru\\>", "examples": "Exemplos", "feature": "Carauter\\%u00edstica", "given": "Dada\\>\\|Daos\\>\\|Daes\\>\\|D\\%u00e1u\\>", "rule": "Rule", "scenario": "Exemplo\\|Casu", "scenario_outline": "Esbozu del casu", "then": "Ent\\%u00f3s\\>", "when": "Cuando\\>"},
+ \"az": {"and": "H\\%u0259m\\>\\|V\\%u0259\\>", "background": "Kontekst\\|Ke\\%u00e7mi\\%u015f", "but": "Ancaq\\>\\|Amma\\>", "examples": "N\\%u00fcmun\\%u0259l\\%u0259r", "feature": "\\%u00d6z\\%u0259llik", "given": "Tutaq ki\\>\\|Verilir\\>", "rule": "Rule", "scenario": "Ssenari\\|N\\%u00fcmun\\%u0259", "scenario_outline": "Ssenarinin strukturu", "then": "O halda\\>", "when": "N\\%u0259 vaxt ki\\>\\|\\%u018fg\\%u0259r\\>"},
+ \"bg": {"and": "\\%u0418\\>", "background": "\\%u041f\\%u0440\\%u0435\\%u0434\\%u0438\\%u0441\\%u0442\\%u043e\\%u0440\\%u0438\\%u044f", "but": "\\%u041d\\%u043e\\>", "examples": "\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\%u0438", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\%u043d\\%u043e\\%u0441\\%u0442", "given": "\\%u0414\\%u0430\\%u0434\\%u0435\\%u043d\\%u043e\\>", "rule": "\\%u041f\\%u0440\\%u0430\\%u0432\\%u0438\\%u043b\\%u043e", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440", "scenario_outline": "\\%u0420\\%u0430\\%u043c\\%u043a\\%u0430 \\%u043d\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439", "then": "\\%u0422\\%u043e\\>", "when": "\\%u041a\\%u043e\\%u0433\\%u0430\\%u0442\\%u043e\\>"},
+ \"bm": {"and": "Dan\\>", "background": "Latar Belakang", "but": "Tetapi\\>\\|Tapi\\>", "examples": "Contoh", "feature": "Fungsi", "given": "Diberi\\>\\|Bagi\\>", "rule": "Rule", "scenario": "Senario\\|Situasi\\|Keadaan", "scenario_outline": "Garis Panduan Senario\\|Kerangka Senario\\|Kerangka Situasi\\|Kerangka Keadaan", "then": "Kemudian\\>\\|Maka\\>", "when": "Apabila\\>"},
+ \"bs": {"and": "I\\>\\|A\\>", "background": "Pozadina", "but": "Ali\\>", "examples": "Primjeri", "feature": "Karakteristika", "given": "Dato\\>", "rule": "Rule", "scenario": "Scenariju\\|Scenario\\|Primjer", "scenario_outline": "Scenario-outline\\|Scenariju-obris", "then": "Zatim\\>", "when": "Kada\\>"},
+ \"ca": {"and": "I\\>", "background": "Antecedents\\|Rerefons", "but": "Per\\%u00f2\\>", "examples": "Exemples", "feature": "Caracter\\%u00edstica\\|Funcionalitat", "given": "Donada\\>\\|Donat\\>\\|Atesa\\>\\|At\\%u00e8s\\>", "rule": "Rule", "scenario": "Escenari\\|Exemple", "scenario_outline": "Esquema de l'escenari", "then": "Aleshores\\>\\|Cal\\>", "when": "Quan\\>"},
+ \"cs": {"and": "A tak\\%u00e9\\>\\|A\\>", "background": "Kontext\\|Pozad\\%u00ed", "but": "Ale\\>", "examples": "P\\%u0159\\%u00edklady", "feature": "Po\\%u017eadavek", "given": "Za p\\%u0159edpokladu\\>\\|Pokud\\>", "rule": "Pravidlo", "scenario": "P\\%u0159\\%u00edklad\\|Sc\\%u00e9n\\%u00e1\\%u0159", "scenario_outline": "Osnova sc\\%u00e9n\\%u00e1\\%u0159e\\|N\\%u00e1\\%u010drt Sc\\%u00e9n\\%u00e1\\%u0159e", "then": "Pak\\>", "when": "Kdy\\%u017e\\>"},
+ \"cy-GB": {"and": "A\\>", "background": "Cefndir", "but": "Ond\\>", "examples": "Enghreifftiau", "feature": "Arwedd", "given": "Anrhegedig a\\>", "rule": "Rule", "scenario": "Enghraifft\\|Scenario", "scenario_outline": "Scenario Amlinellol", "then": "Yna\\>", "when": "Pryd\\>"},
+ \"da": {"and": "Og\\>", "background": "Baggrund", "but": "Men\\>", "examples": "Eksempler", "feature": "Egenskab", "given": "Givet\\>", "rule": "Rule", "scenario": "Eksempel\\|Scenarie", "scenario_outline": "Abstrakt Scenario", "then": "S\\%u00e5\\>", "when": "N\\%u00e5r\\>"},
+ \"de": {"and": "Und\\>", "background": "Voraussetzungen\\|Vorbedingungen\\|Hintergrund\\|Grundlage", "but": "Aber\\>", "examples": "Beispiele", "feature": "Funktionalit\\%u00e4t\\|Funktion", "given": "Gegeben seien\\>\\|Gegeben sei\\>\\|Angenommen\\>", "rule": "Regel\\|Rule", "scenario": "Beispiel\\|Szenario", "scenario_outline": "Szenariogrundriss\\|Szenarien", "then": "Dann\\>", "when": "Wenn\\>"},
+ \"el": {"and": "\\%u039a\\%u03b1\\%u03b9\\>", "background": "\\%u03a5\\%u03c0\\%u03cc\\%u03b2\\%u03b1\\%u03b8\\%u03c1\\%u03bf", "but": "\\%u0391\\%u03bb\\%u03bb\\%u03ac\\>", "examples": "\\%u03a0\\%u03b1\\%u03c1\\%u03b1\\%u03b4\\%u03b5\\%u03af\\%u03b3\\%u03bc\\%u03b1\\%u03c4\\%u03b1\\|\\%u03a3\\%u03b5\\%u03bd\\%u03ac\\%u03c1\\%u03b9\\%u03b1", "feature": "\\%u0394\\%u03c5\\%u03bd\\%u03b1\\%u03c4\\%u03cc\\%u03c4\\%u03b7\\%u03c4\\%u03b1\\|\\%u039b\\%u03b5\\%u03b9\\%u03c4\\%u03bf\\%u03c5\\%u03c1\\%u03b3\\%u03af\\%u03b1", "given": "\\%u0394\\%u03b5\\%u03b4\\%u03bf\\%u03bc\\%u03ad\\%u03bd\\%u03bf\\%u03c5\\>", "rule": "Rule", "scenario": "\\%u03a0\\%u03b1\\%u03c1\\%u03ac\\%u03b4\\%u03b5\\%u03b9\\%u03b3\\%u03bc\\%u03b1\\|\\%u03a3\\%u03b5\\%u03bd\\%u03ac\\%u03c1\\%u03b9\\%u03bf", "scenario_outline": "\\%u03a0\\%u03b5\\%u03c1\\%u03af\\%u03b3\\%u03c1\\%u03b1\\%u03bc\\%u03bc\\%u03b1 \\%u03a3\\%u03b5\\%u03bd\\%u03b1\\%u03c1\\%u03af\\%u03bf\\%u03c5\\|\\%u03a0\\%u03b5\\%u03c1\\%u03b9\\%u03b3\\%u03c1\\%u03b1\\%u03c6\\%u03ae \\%u03a3\\%u03b5\\%u03bd\\%u03b1\\%u03c1\\%u03af\\%u03bf\\%u03c5", "then": "\\%u03a4\\%u03cc\\%u03c4\\%u03b5\\>", "when": "\\%u038c\\%u03c4\\%u03b1\\%u03bd\\>"},
+ \"em": {"and": "\\%u1f602", "background": "\\%u1f4a4", "but": "\\%u1f614", "examples": "\\%u1f4d3", "feature": "\\%u1f4da", "given": "\\%u1f610", "rule": "Rule", "scenario": "\\%u1f952\\|\\%u1f4d5", "scenario_outline": "\\%u1f4d6", "then": "\\%u1f64f", "when": "\\%u1f3ac"},
+ \"en-Scouse": {"and": "An\\>", "background": "Dis is what went down", "but": "Buh\\>", "examples": "Examples", "feature": "Feature", "given": "Youse know when youse got\\>\\|Givun\\>", "rule": "Rule", "scenario": "The thing of it is", "scenario_outline": "Wharrimean is", "then": "Den youse gotta\\>\\|Dun\\>", "when": "Youse know like when\\>\\|Wun\\>"},
+ \"en-au": {"and": "Too right\\>", "background": "First off", "but": "Yeah nah\\>", "examples": "You'll wanna", "feature": "Pretty much", "given": "Y'know\\>", "rule": "Rule", "scenario": "Awww, look mate", "scenario_outline": "Reckon it's like", "then": "But at the end of the day I reckon\\>", "when": "It's just unbelievable\\>"},
+ \"en-lol": {"and": "AN\\>", "background": "B4", "but": "BUT\\>", "examples": "EXAMPLZ", "feature": "OH HAI", "given": "I CAN HAZ\\>", "rule": "Rule", "scenario": "MISHUN", "scenario_outline": "MISHUN SRSLY", "then": "DEN\\>", "when": "WEN\\>"},
+ \"en-old": {"and": "Ond\\>\\|7\\>", "background": "Aer\\|\\%u00c6r", "but": "Ac\\>", "examples": "Se the\\|Se \\%u00fee\\|Se \\%u00f0e", "feature": "Hwaet\\|Hw\\%u00e6t", "given": "Thurh\\>\\|\\%u00deurh\\>\\|\\%u00d0urh\\>", "rule": "Rule", "scenario": "Swa", "scenario_outline": "Swa hwaer swa\\|Swa hw\\%u00e6r swa", "then": "Tha the\\>\\|\\%u00dea \\%u00fee\\>\\|\\%u00d0a \\%u00f0e\\>\\|Tha\\>\\|\\%u00dea\\>\\|\\%u00d0a\\>", "when": "B\\%u00e6\\%u00fesealfa\\>\\|B\\%u00e6\\%u00fesealfe\\>\\|B\\%u00e6\\%u00fesealf\\>\\|Ciric\\%u00e6we\\>\\|Ciric\\%u00e6wa\\>\\|Ciric\\%u00e6w\\>"},
+ \"en-pirate": {"and": "Aye\\>", "background": "Yo-ho-ho", "but": "Avast!\\>", "examples": "Dead men tell no tales", "feature": "Ahoy matey!", "given": "Gangway!\\>", "rule": "Rule", "scenario": "Heave to", "scenario_outline": "Shiver me timbers", "then": "Let go and haul\\>", "when": "Blimey!\\>"},
+ \"en-tx": {"and": "Come hell or high water\\>", "background": "Lemme tell y'all a story", "but": "Well now hold on, I'll you what\\>", "examples": "Now that's a story longer than a cattle drive in July", "feature": "This ain\\%u2019t my first rodeo\\|All gussied up", "given": "All git out\\>\\|Fixin' to\\>", "rule": "Rule\\>", "scenario": "All hat and no cattle", "scenario_outline": "Busy as a hound in flea season\\|Serious as a snake bite", "then": "There\\%u2019s no tree but bears some fruit\\>", "when": "Quick out of the chute\\>"},
+ \"eo": {"and": "Kaj\\>", "background": "Fono", "but": "Sed\\>", "examples": "Ekzemploj", "feature": "Trajto", "given": "Donita\\%u0135o\\>\\|Komence\\>", "rule": "Rule", "scenario": "Ekzemplo\\|Scenaro\\|Kazo", "scenario_outline": "Konturo de la scenaro\\|Kazo-skizo\\|Skizo", "then": "Do\\>", "when": "Se\\>"},
+ \"es": {"and": "Y\\>\\|E\\>", "background": "Antecedentes", "but": "Pero\\>", "examples": "Ejemplos", "feature": "Necesidad del negocio\\|Caracter\\%u00edstica\\|Requisito", "given": "Dados\\>\\|Dadas\\>\\|Dado\\>\\|Dada\\>", "rule": "Regla de negocio\\|Regla", "scenario": "Escenario\\|Ejemplo", "scenario_outline": "Esquema del escenario", "then": "Entonces\\>", "when": "Cuando\\>"},
+ \"et": {"and": "Ja\\>", "background": "Taust", "but": "Kuid\\>", "examples": "Juhtumid", "feature": "Omadus", "given": "Eeldades\\>", "rule": "Reegel", "scenario": "Stsenaarium\\|Juhtum", "scenario_outline": "Raamstsenaarium\\|Raamjuhtum", "then": "Siis\\>", "when": "Kui\\>"},
+ \"fa": {"and": "\\%u0648\\>", "background": "\\%u0632\\%u0645\\%u06cc\\%u0646\\%u0647", "but": "\\%u0627\\%u0645\\%u0627\\>", "examples": "\\%u0646\\%u0645\\%u0648\\%u0646\\%u0647 \\%u0647\\%u0627", "feature": "\\%u0648\\%u0650\\%u06cc\\%u0698\\%u06af\\%u06cc", "given": "\\%u0628\\%u0627 \\%u0641\\%u0631\\%u0636\\>", "rule": "Rule", "scenario": "\\%u0633\\%u0646\\%u0627\\%u0631\\%u06cc\\%u0648\\|\\%u0645\\%u062b\\%u0627\\%u0644", "scenario_outline": "\\%u0627\\%u0644\\%u06af\\%u0648\\%u06cc \\%u0633\\%u0646\\%u0627\\%u0631\\%u06cc\\%u0648", "then": "\\%u0622\\%u0646\\%u06af\\%u0627\\%u0647\\>", "when": "\\%u0647\\%u0646\\%u06af\\%u0627\\%u0645\\%u06cc\\>"},
+ \"fi": {"and": "Ja\\>", "background": "Tausta", "but": "Mutta\\>", "examples": "Tapaukset", "feature": "Ominaisuus", "given": "Oletetaan\\>", "rule": "Rule", "scenario": "Tapaus", "scenario_outline": "Tapausaihio", "then": "Niin\\>", "when": "Kun\\>"},
+ \"fr": {"and": "Et que\\>\\|Et qu'\\|Et\\>", "background": "Contexte", "but": "Mais que\\>\\|Mais qu'\\|Mais\\>", "examples": "Exemples", "feature": "Fonctionnalit\\%u00e9", "given": "Etant donn\\%u00e9 que\\>\\|\\%u00c9tant donn\\%u00e9 que\\>\\|Etant donn\\%u00e9 qu'\\|\\%u00c9tant donn\\%u00e9 qu'\\|Etant donn\\%u00e9es\\>\\|\\%u00c9tant donn\\%u00e9es\\>\\|Etant donn\\%u00e9e\\>\\|Etant donn\\%u00e9s\\>\\|\\%u00c9tant donn\\%u00e9e\\>\\|\\%u00c9tant donn\\%u00e9s\\>\\|Sachant que\\>\\|Etant donn\\%u00e9\\>\\|\\%u00c9tant donn\\%u00e9\\>\\|Sachant qu'\\|Sachant\\>\\|Soit\\>", "rule": "R\\%u00e8gle", "scenario": "Sc\\%u00e9nario\\|Exemple", "scenario_outline": "Plan du sc\\%u00e9nario\\|Plan du Sc\\%u00e9nario", "then": "Alors\\>\\|Donc\\>", "when": "Lorsque\\>\\|Lorsqu'\\|Quand\\>"},
+ \"ga": {"and": "Agus", "background": "C\\%u00falra", "but": "Ach", "examples": "Sampla\\%u00ed", "feature": "Gn\\%u00e9", "given": "Cuir i gc\\%u00e1s nach\\|Cuir i gc\\%u00e1s gur\\|Cuir i gc\\%u00e1s n\\%u00e1r\\|Cuir i gc\\%u00e1s go", "rule": "Rule", "scenario": "Sampla\\|C\\%u00e1s", "scenario_outline": "C\\%u00e1s Achomair", "then": "Ansin", "when": "Nuair nach\\|Nuair n\\%u00e1r\\|Nuair ba\\|Nuair a"},
+ \"gj": {"and": "\\%u0a85\\%u0aa8\\%u0ac7\\>", "background": "\\%u0aac\\%u0ac7\\%u0a95\\%u0a97\\%u0acd\\%u0ab0\\%u0abe\\%u0a89\\%u0aa8\\%u0acd\\%u0aa1", "but": "\\%u0aaa\\%u0aa3\\>", "examples": "\\%u0a89\\%u0aa6\\%u0abe\\%u0ab9\\%u0ab0\\%u0aa3\\%u0acb", "feature": "\\%u0ab5\\%u0acd\\%u0aaf\\%u0abe\\%u0aaa\\%u0abe\\%u0ab0 \\%u0a9c\\%u0ab0\\%u0ac2\\%u0ab0\\|\\%u0a95\\%u0acd\\%u0ab7\\%u0aae\\%u0aa4\\%u0abe\\|\\%u0ab2\\%u0a95\\%u0acd\\%u0ab7\\%u0aa3", "given": "\\%u0a86\\%u0aaa\\%u0ac7\\%u0ab2 \\%u0a9b\\%u0ac7\\>", "rule": "Rule", "scenario": "\\%u0a89\\%u0aa6\\%u0abe\\%u0ab9\\%u0ab0\\%u0aa3\\|\\%u0ab8\\%u0acd\\%u0aa5\\%u0abf\\%u0aa4\\%u0abf", "scenario_outline": "\\%u0aaa\\%u0ab0\\%u0abf\\%u0aa6\\%u0acd\\%u0aa6\\%u0ab6\\%u0acd\\%u0aaf \\%u0ab0\\%u0ac2\\%u0aaa\\%u0ab0\\%u0ac7\\%u0a96\\%u0abe\\|\\%u0aaa\\%u0ab0\\%u0abf\\%u0aa6\\%u0acd\\%u0aa6\\%u0ab6\\%u0acd\\%u0aaf \\%u0aa2\\%u0abe\\%u0a82\\%u0a9a\\%u0acb", "then": "\\%u0aaa\\%u0a9b\\%u0ac0\\>", "when": "\\%u0a95\\%u0acd\\%u0aaf\\%u0abe\\%u0ab0\\%u0ac7\\>"},
+ \"gl": {"and": "E\\>", "background": "Contexto", "but": "Mais\\>\\|Pero\\>", "examples": "Exemplos", "feature": "Caracter\\%u00edstica", "given": "Dados\\>\\|Dadas\\>\\|Dado\\>\\|Dada\\>", "rule": "Rule", "scenario": "Escenario\\|Exemplo", "scenario_outline": "Esbozo do escenario", "then": "Ent\\%u00f3n\\>\\|Logo\\>", "when": "Cando\\>"},
+ \"he": {"and": "\\%u05d5\\%u05d2\\%u05dd\\>", "background": "\\%u05e8\\%u05e7\\%u05e2", "but": "\\%u05d0\\%u05d1\\%u05dc\\>", "examples": "\\%u05d3\\%u05d5\\%u05d2\\%u05de\\%u05d0\\%u05d5\\%u05ea", "feature": "\\%u05ea\\%u05db\\%u05d5\\%u05e0\\%u05d4", "given": "\\%u05d1\\%u05d4\\%u05d9\\%u05e0\\%u05ea\\%u05df\\>", "rule": "\\%u05db\\%u05dc\\%u05dc", "scenario": "\\%u05d3\\%u05d5\\%u05d2\\%u05de\\%u05d0\\|\\%u05ea\\%u05e8\\%u05d7\\%u05d9\\%u05e9", "scenario_outline": "\\%u05ea\\%u05d1\\%u05e0\\%u05d9\\%u05ea \\%u05ea\\%u05e8\\%u05d7\\%u05d9\\%u05e9", "then": "\\%u05d0\\%u05d6\\%u05d9\\>\\|\\%u05d0\\%u05d6\\>", "when": "\\%u05db\\%u05d0\\%u05e9\\%u05e8\\>"},
+ \"hi": {"and": "\\%u0924\\%u0925\\%u093e\\>\\|\\%u0914\\%u0930\\>", "background": "\\%u092a\\%u0943\\%u0937\\%u094d\\%u0920\\%u092d\\%u0942\\%u092e\\%u093f", "but": "\\%u092a\\%u0930\\%u0928\\%u094d\\%u0924\\%u0941\\>\\|\\%u0915\\%u093f\\%u0928\\%u094d\\%u0924\\%u0941\\>\\|\\%u092a\\%u0930\\>", "examples": "\\%u0909\\%u0926\\%u093e\\%u0939\\%u0930\\%u0923", "feature": "\\%u0930\\%u0942\\%u092a \\%u0932\\%u0947\\%u0916", "given": "\\%u091a\\%u0942\\%u0902\\%u0915\\%u093f\\>\\|\\%u0905\\%u0917\\%u0930\\>\\|\\%u092f\\%u0926\\%u093f\\>", "rule": "\\%u0928\\%u093f\\%u092f\\%u092e", "scenario": "\\%u092a\\%u0930\\%u093f\\%u0926\\%u0943\\%u0936\\%u094d\\%u092f", "scenario_outline": "\\%u092a\\%u0930\\%u093f\\%u0926\\%u0943\\%u0936\\%u094d\\%u092f \\%u0930\\%u0942\\%u092a\\%u0930\\%u0947\\%u0916\\%u093e", "then": "\\%u0924\\%u0926\\%u093e\\>\\|\\%u0924\\%u092c\\>", "when": "\\%u0915\\%u0926\\%u093e\\>\\|\\%u091c\\%u092c\\>"},
+ \"hr": {"and": "I\\>", "background": "Pozadina", "but": "Ali\\>", "examples": "Scenariji\\|Primjeri", "feature": "Mogu\\%u0107nost\\|Mogucnost\\|Osobina", "given": "Ukoliko\\>\\|Zadani\\>\\|Zadano\\>\\|Zadan\\>", "rule": "Rule", "scenario": "Scenarij\\|Primjer", "scenario_outline": "Koncept\\|Skica", "then": "Onda\\>", "when": "Kada\\>\\|Kad\\>"},
+ \"ht": {"and": "Epi\\>\\|Ak\\>\\|E\\>", "background": "Kont\\%u00e8ks\\|Istorik", "but": "Men\\>", "examples": "Egzanp", "feature": "Karakteristik\\|Fonksyonalite\\|Mak", "given": "Sipoze ke\\>\\|Sipoze Ke\\>\\|Sipoze\\>", "rule": "Rule", "scenario": "Senaryo", "scenario_outline": "Senaryo deskripsyon\\|Senaryo Deskripsyon\\|Dyagram senaryo\\|Dyagram Senaryo\\|Plan senaryo\\|Plan Senaryo", "then": "L\\%u00e8 sa a\\>\\|Le sa a\\>", "when": "L\\%u00e8\\>\\|Le\\>"},
+ \"hu": {"and": "\\%u00c9s\\>", "background": "H\\%u00e1tt\\%u00e9r", "but": "De\\>", "examples": "P\\%u00e9ld\\%u00e1k", "feature": "Jellemz\\%u0151", "given": "Amennyiben\\>\\|Adott\\>", "rule": "Szab\\%u00e1ly", "scenario": "Forgat\\%u00f3k\\%u00f6nyv\\|P\\%u00e9lda", "scenario_outline": "Forgat\\%u00f3k\\%u00f6nyv v\\%u00e1zlat", "then": "Akkor\\>", "when": "Amikor\\>\\|Majd\\>\\|Ha\\>"},
+ \"id": {"and": "Dan\\>", "background": "Latar Belakang\\|Dasar", "but": "Tetapi\\>\\|Tapi\\>", "examples": "Contoh\\|Misal", "feature": "Fitur", "given": "Diasumsikan\\>\\|Diketahui\\>\\|Dengan\\>\\|Bila\\>\\|Jika\\>", "rule": "Aturan\\|Rule", "scenario": "Skenario", "scenario_outline": "Garis-Besar Skenario\\|Skenario konsep", "then": "Kemudian\\>\\|Maka\\>", "when": "Ketika\\>"},
+ \"is": {"and": "Og\\>", "background": "Bakgrunnur", "but": "En\\>", "examples": "Atbur\\%u00f0ar\\%u00e1sir\\|D\\%u00e6mi", "feature": "Eiginleiki", "given": "Ef\\>", "rule": "Rule", "scenario": "Atbur\\%u00f0ar\\%u00e1s", "scenario_outline": "L\\%u00fdsing Atbur\\%u00f0ar\\%u00e1sar\\|L\\%u00fdsing D\\%u00e6ma", "then": "\\%u00de\\%u00e1\\>", "when": "\\%u00deegar\\>"},
+ \"it": {"and": "E\\>", "background": "Contesto", "but": "Ma\\>", "examples": "Esempi", "feature": "Esigenza di Business\\|Funzionalit\\%u00e0\\|Abilit\\%u00e0", "given": "Dato\\>\\|Data\\>\\|Dati\\>\\|Date\\>", "rule": "Regola", "scenario": "Scenario\\|Esempio", "scenario_outline": "Schema dello scenario", "then": "Allora\\>", "when": "Quando\\>"},
+ \"ja": {"and": "\\%u4e14\\%u3064\\|\\%u304b\\%u3064", "background": "\\%u80cc\\%u666f", "but": "\\%u3057\\%u304b\\%u3057\\|\\%u305f\\%u3060\\%u3057\\|\\%u7136\\%u3057\\|\\%u4f46\\%u3057", "examples": "\\%u30b5\\%u30f3\\%u30d7\\%u30eb\\|\\%u4f8b", "feature": "\\%u30d5\\%u30a3\\%u30fc\\%u30c1\\%u30e3\\|\\%u6a5f\\%u80fd", "given": "\\%u524d\\%u63d0", "rule": "\\%u30eb\\%u30fc\\%u30eb", "scenario": "\\%u30b7\\%u30ca\\%u30ea\\%u30aa", "scenario_outline": "\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\%u30a2\\%u30a6\\%u30c8\\%u30e9\\%u30a4\\%u30f3\\|\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\%u30c6\\%u30f3\\%u30d7\\%u30ec\\%u30fc\\%u30c8\\|\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\%u30c6\\%u30f3\\%u30d7\\%u30ec\\|\\%u30c6\\%u30f3\\%u30d7\\%u30ec", "then": "\\%u306a\\%u3089\\%u3070", "when": "\\%u3082\\%u3057"},
+ \"jv": {"and": "Lan\\>", "background": "Dasar", "but": "Ananging\\>\\|Nanging\\>\\|Tapi\\>", "examples": "Contone\\|Conto", "feature": "Fitur", "given": "Nalikaning\\>\\|Nalika\\>", "rule": "Rule", "scenario": "Skenario", "scenario_outline": "Konsep skenario", "then": "Banjur\\>\\|Njuk\\>", "when": "Manawa\\>\\|Menawa\\>"},
+ \"ka": {"and": "\\%u10d0\\%u10e1\\%u10d4\\%u10d5\\%u10d4\\>\\|\\%u10d3\\%u10d0\\>", "background": "\\%u10d9\\%u10dd\\%u10dc\\%u10e2\\%u10d4\\%u10e5\\%u10e1\\%u10e2\\%u10d8", "but": "\\%u10db\\%u10d0\\%u10d2\\%u10e0\\%u10d0\\%u10db\\>\\|\\%u10d7\\%u10e3\\%u10db\\%u10ea\\%u10d0\\>", "examples": "\\%u10db\\%u10d0\\%u10d2\\%u10d0\\%u10da\\%u10d8\\%u10d7\\%u10d4\\%u10d1\\%u10d8", "feature": "\\%u10db\\%u10dd\\%u10d7\\%u10ee\\%u10dd\\%u10d5\\%u10dc\\%u10d0\\|\\%u10d7\\%u10d5\\%u10d8\\%u10e1\\%u10d4\\%u10d1\\%u10d0", "given": "\\%u10db\\%u10dd\\%u10ea\\%u10d4\\%u10db\\%u10e3\\%u10da\\%u10d8\\%u10d0\\>\\|\\%u10db\\%u10dd\\%u10ea\\%u10d4\\%u10db\\%u10e3\\%u10da\\%u10d8\\>\\|\\%u10d5\\%u10d7\\%u10e5\\%u10d5\\%u10d0\\%u10d7\\>", "rule": "\\%u10ec\\%u10d4\\%u10e1\\%u10d8", "scenario": "\\%u10db\\%u10d0\\%u10d2\\%u10d0\\%u10da\\%u10d8\\%u10d7\\%u10d0\\%u10d3\\|\\%u10db\\%u10d0\\%u10d2\\%u10d0\\%u10da\\%u10d8\\%u10d7\\%u10d8\\|\\%u10e1\\%u10ea\\%u10d4\\%u10dc\\%u10d0\\%u10e0\\%u10d8\\|\\%u10db\\%u10d0\\%u10d2", "scenario_outline": "\\%u10e1\\%u10ea\\%u10d4\\%u10dc\\%u10d0\\%u10e0\\%u10d8\\%u10e1 \\%u10e8\\%u10d0\\%u10d1\\%u10da\\%u10dd\\%u10dc\\%u10d8\\|\\%u10e1\\%u10ea\\%u10d4\\%u10dc\\%u10d0\\%u10e0\\%u10d8\\%u10e1 \\%u10dc\\%u10d8\\%u10db\\%u10e3\\%u10e8\\%u10d8\\|\\%u10e8\\%u10d0\\%u10d1\\%u10da\\%u10dd\\%u10dc\\%u10d8\\|\\%u10dc\\%u10d8\\%u10db\\%u10e3\\%u10e8\\%u10d8", "then": "\\%u10db\\%u10d0\\%u10e8\\%u10d8\\%u10dc\\>", "when": "\\%u10e0\\%u10dd\\%u10d2\\%u10dd\\%u10e0\\%u10ea \\%u10d9\\%u10d8\\>\\|\\%u10e0\\%u10dd\\%u10d3\\%u10d4\\%u10e1\\%u10d0\\%u10ea\\>\\|\\%u10e0\\%u10dd\\%u10ea\\%u10d0\\>\\|\\%u10d7\\%u10e3\\>"},
+ \"kn": {"and": "\\%u0cae\\%u0ca4\\%u0ccd\\%u0ca4\\%u0cc1\\>", "background": "\\%u0cb9\\%u0cbf\\%u0ca8\\%u0ccd\\%u0ca8\\%u0cc6\\%u0cb2\\%u0cc6", "but": "\\%u0c86\\%u0ca6\\%u0cb0\\%u0cc6\\>", "examples": "\\%u0c89\\%u0ca6\\%u0cbe\\%u0cb9\\%u0cb0\\%u0ca3\\%u0cc6\\%u0c97\\%u0cb3\\%u0cc1", "feature": "\\%u0cb9\\%u0cc6\\%u0c9a\\%u0ccd\\%u0c9a\\%u0cb3", "given": "\\%u0ca8\\%u0cbf\\%u0cd5\\%u0ca1\\%u0cbf\\%u0ca6\\>", "rule": "Rule", "scenario": "\\%u0c95\\%u0ca5\\%u0cbe\\%u0cb8\\%u0cbe\\%u0cb0\\%u0cbe\\%u0c82\\%u0cb6\\|\\%u0c89\\%u0ca6\\%u0cbe\\%u0cb9\\%u0cb0\\%u0ca3\\%u0cc6", "scenario_outline": "\\%u0cb5\\%u0cbf\\%u0cb5\\%u0cb0\\%u0ca3\\%u0cc6", "then": "\\%u0ca8\\%u0c82\\%u0ca4\\%u0cb0\\>", "when": "\\%u0cb8\\%u0ccd\\%u0ca5\\%u0cbf\\%u0ca4\\%u0cbf\\%u0caf\\%u0ca8\\%u0ccd\\%u0ca8\\%u0cc1\\>"},
+ \"ko": {"and": "\\%uadf8\\%ub9ac\\%uace0", "background": "\\%ubc30\\%uacbd", "but": "\\%ud558\\%uc9c0\\%ub9cc\\|\\%ub2e8", "examples": "\\%uc608", "feature": "\\%uae30\\%ub2a5", "given": "\\%uc870\\%uac74\\|\\%uba3c\\%uc800", "rule": "Rule", "scenario": "\\%uc2dc\\%ub098\\%ub9ac\\%uc624", "scenario_outline": "\\%uc2dc\\%ub098\\%ub9ac\\%uc624 \\%uac1c\\%uc694", "then": "\\%uadf8\\%ub7ec\\%uba74", "when": "\\%ub9cc\\%uc77c\\|\\%ub9cc\\%uc57d"},
+ \"lt": {"and": "Ir\\>", "background": "Kontekstas", "but": "Bet\\>", "examples": "Pavyzd\\%u017eiai\\|Scenarijai\\|Variantai", "feature": "Savyb\\%u0117", "given": "Duota\\>", "rule": "Rule", "scenario": "Scenarijus\\|Pavyzdys", "scenario_outline": "Scenarijaus \\%u0161ablonas", "then": "Tada\\>", "when": "Kai\\>"},
+ \"lu": {"and": "an\\>\\|a\\>", "background": "Hannergrond", "but": "awer\\>\\|m\\%u00e4\\>", "examples": "Beispiller", "feature": "Funktionalit\\%u00e9it", "given": "ugeholl\\>", "rule": "Rule", "scenario": "Beispill\\|Szenario", "scenario_outline": "Plang vum Szenario", "then": "dann\\>", "when": "wann\\>"},
+ \"lv": {"and": "Un\\>", "background": "Konteksts\\|Situ\\%u0101cija", "but": "Bet\\>", "examples": "Piem\\%u0113ri\\|Paraugs", "feature": "Funkcionalit\\%u0101te\\|F\\%u012b\\%u010da", "given": "Kad\\>", "rule": "Rule", "scenario": "Scen\\%u0101rijs\\|Piem\\%u0113rs", "scenario_outline": "Scen\\%u0101rijs p\\%u0113c parauga", "then": "Tad\\>", "when": "Ja\\>"},
+ \"mk-Cyrl": {"and": "\\%u0418\\>", "background": "\\%u041a\\%u043e\\%u043d\\%u0442\\%u0435\\%u043a\\%u0441\\%u0442\\|\\%u0421\\%u043e\\%u0434\\%u0440\\%u0436\\%u0438\\%u043d\\%u0430", "but": "\\%u041d\\%u043e\\>", "examples": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0458\\%u0430\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\%u0438", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\%u043d\\%u043e\\%u0441\\%u0442\\|\\%u0411\\%u0438\\%u0437\\%u043d\\%u0438\\%u0441 \\%u043f\\%u043e\\%u0442\\%u0440\\%u0435\\%u0431\\%u0430\\|\\%u041c\\%u043e\\%u0436\\%u043d\\%u043e\\%u0441\\%u0442", "given": "\\%u0414\\%u0430\\%u0434\\%u0435\\%u043d\\%u043e\\>\\|\\%u0414\\%u0430\\%u0434\\%u0435\\%u043d\\%u0430\\>", "rule": "Rule", "scenario": "\\%u041d\\%u0430 \\%u043f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\|\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u043e\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440", "scenario_outline": "\\%u041f\\%u0440\\%u0435\\%u0433\\%u043b\\%u0435\\%u0434 \\%u043d\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0458\\%u0430\\|\\%u041a\\%u043e\\%u043d\\%u0446\\%u0435\\%u043f\\%u0442\\|\\%u0421\\%u043a\\%u0438\\%u0446\\%u0430", "then": "\\%u0422\\%u043e\\%u0433\\%u0430\\%u0448\\>", "when": "\\%u041a\\%u043e\\%u0433\\%u0430\\>"},
+ \"mk-Latn": {"and": "I\\>", "background": "Sodrzhina\\|Kontekst", "but": "No\\>", "examples": "Scenaria\\|Primeri", "feature": "Funkcionalnost\\|Biznis potreba\\|Mozhnost", "given": "Dadeno\\>\\|Dadena\\>", "rule": "Rule", "scenario": "Na primer\\|Scenario", "scenario_outline": "Pregled na scenarija\\|Koncept\\|Skica", "then": "Togash\\>", "when": "Koga\\>"},
+ \"mn": {"and": "\\%u0422\\%u044d\\%u0433\\%u044d\\%u044d\\%u0434\\>\\|\\%u041c\\%u04e9\\%u043d\\>", "background": "\\%u0410\\%u0433\\%u0443\\%u0443\\%u043b\\%u0433\\%u0430", "but": "\\%u0413\\%u044d\\%u0445\\%u0434\\%u044d\\%u044d\\>\\|\\%u0425\\%u0430\\%u0440\\%u0438\\%u043d\\>", "examples": "\\%u0422\\%u0443\\%u0445\\%u0430\\%u0439\\%u043b\\%u0431\\%u0430\\%u043b", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\|\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446", "given": "\\%u04e8\\%u0433\\%u04e9\\%u0433\\%u0434\\%u0441\\%u04e9\\%u043d \\%u043d\\%u044c\\>\\|\\%u0410\\%u043d\\%u0445\\>", "rule": "Rule", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440", "scenario_outline": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u044b\\%u043d \\%u0442\\%u04e9\\%u043b\\%u04e9\\%u0432\\%u043b\\%u04e9\\%u0433\\%u04e9\\%u04e9", "then": "\\%u04ae\\%u04af\\%u043d\\%u0438\\%u0439 \\%u0434\\%u0430\\%u0440\\%u0430\\%u0430\\>\\|\\%u0422\\%u044d\\%u0433\\%u044d\\%u0445\\%u044d\\%u0434\\>", "when": "\\%u0425\\%u044d\\%u0440\\%u044d\\%u0432\\>"},
+ \"mr": {"and": "\\%u0924\\%u0938\\%u0947\\%u091a\\>\\|\\%u0906\\%u0923\\%u093f\\>", "background": "\\%u092a\\%u093e\\%u0930\\%u094d\\%u0936\\%u094d\\%u0935\\%u092d\\%u0942\\%u092e\\%u0940", "but": "\\%u092a\\%u0930\\%u0902\\%u0924\\%u0941\\>\\|\\%u092a\\%u0923\\>", "examples": "\\%u0909\\%u0926\\%u093e\\%u0939\\%u0930\\%u0923", "feature": "\\%u0935\\%u0948\\%u0936\\%u093f\\%u0937\\%u094d\\%u091f\\%u094d\\%u092f\\|\\%u0938\\%u0941\\%u0935\\%u093f\\%u0927\\%u093e", "given": "\\%u0926\\%u093f\\%u0932\\%u0947\\%u0932\\%u094d\\%u092f\\%u093e \\%u092a\\%u094d\\%u0930\\%u092e\\%u093e\\%u0923\\%u0947\\>\\|\\%u091c\\%u0930", "rule": "\\%u0928\\%u093f\\%u092f\\%u092e", "scenario": "\\%u092a\\%u0930\\%u093f\\%u0926\\%u0943\\%u0936\\%u094d\\%u092f", "scenario_outline": "\\%u092a\\%u0930\\%u093f\\%u0926\\%u0943\\%u0936\\%u094d\\%u092f \\%u0930\\%u0942\\%u092a\\%u0930\\%u0947\\%u0916\\%u093e", "then": "\\%u0924\\%u0947\\%u0935\\%u094d\\%u0939\\%u093e\\>\\|\\%u092e\\%u0917\\>", "when": "\\%u091c\\%u0947\\%u0935\\%u094d\\%u0939\\%u093e\\>"},
+ \"ne": {"and": "\\%u0905\\%u0928\\%u093f\\>\\|\\%u0930\\>", "background": "\\%u092a\\%u0943\\%u0937\\%u094d\\%u0920\\%u092d\\%u0942\\%u092e\\%u0940", "but": "\\%u0924\\%u0930\\>", "examples": "\\%u0909\\%u0926\\%u093e\\%u0939\\%u0930\\%u0923\\%u0939\\%u0930\\%u0941\\|\\%u0909\\%u0926\\%u093e\\%u0939\\%u0930\\%u0923", "feature": "\\%u0935\\%u093f\\%u0936\\%u0947\\%u0937\\%u0924\\%u093e\\|\\%u0938\\%u0941\\%u0935\\%u093f\\%u0927\\%u093e", "given": "\\%u0926\\%u093f\\%u0907\\%u090f\\%u0915\\%u094b\\>\\|\\%u0926\\%u093f\\%u090f\\%u0915\\%u094b\\>\\|\\%u092f\\%u0926\\%u093f\\>", "rule": "\\%u0928\\%u093f\\%u092f\\%u092e", "scenario": "\\%u092a\\%u0930\\%u093f\\%u0926\\%u0943\\%u0936\\%u094d\\%u092f", "scenario_outline": "\\%u092a\\%u0930\\%u093f\\%u0926\\%u0943\\%u0936\\%u094d\\%u092f \\%u0930\\%u0942\\%u092a\\%u0930\\%u0947\\%u0916\\%u093e", "then": "\\%u0924\\%u094d\\%u092f\\%u0938\\%u092a\\%u091b\\%u093f\\>\\|\\%u0905\\%u0928\\%u0940\\>", "when": "\\%u091c\\%u092c\\>"},
+ \"nl": {"and": "En\\>", "background": "Achtergrond", "but": "Maar\\>", "examples": "Voorbeelden", "feature": "Functionaliteit", "given": "Gegeven\\>\\|Stel\\>", "rule": "Rule", "scenario": "Voorbeeld\\|Scenario", "scenario_outline": "Abstract Scenario", "then": "Dan\\>", "when": "Wanneer\\>\\|Als\\>"},
+ \"no": {"and": "Og\\>", "background": "Bakgrunn", "but": "Men\\>", "examples": "Eksempler", "feature": "Egenskap", "given": "Gitt\\>", "rule": "Regel", "scenario": "Eksempel\\|Scenario", "scenario_outline": "Abstrakt Scenario\\|Scenariomal", "then": "S\\%u00e5\\>", "when": "N\\%u00e5r\\>"},
+ \"pa": {"and": "\\%u0a05\\%u0a24\\%u0a47\\>", "background": "\\%u0a2a\\%u0a3f\\%u0a1b\\%u0a4b\\%u0a15\\%u0a5c", "but": "\\%u0a2a\\%u0a30\\>", "examples": "\\%u0a09\\%u0a26\\%u0a3e\\%u0a39\\%u0a30\\%u0a28\\%u0a3e\\%u0a02", "feature": "\\%u0a28\\%u0a15\\%u0a36 \\%u0a28\\%u0a41\\%u0a39\\%u0a3e\\%u0a30\\|\\%u0a2e\\%u0a41\\%u0a39\\%u0a3e\\%u0a02\\%u0a26\\%u0a30\\%u0a3e\\|\\%u0a16\\%u0a3e\\%u0a38\\%u0a40\\%u0a05\\%u0a24", "given": "\\%u0a1c\\%u0a3f\\%u0a35\\%u0a47\\%u0a02 \\%u0a15\\%u0a3f\\>\\|\\%u0a1c\\%u0a47\\%u0a15\\%u0a30\\>", "rule": "Rule", "scenario": "\\%u0a09\\%u0a26\\%u0a3e\\%u0a39\\%u0a30\\%u0a28\\|\\%u0a2a\\%u0a1f\\%u0a15\\%u0a25\\%u0a3e", "scenario_outline": "\\%u0a2a\\%u0a1f\\%u0a15\\%u0a25\\%u0a3e \\%u0a30\\%u0a42\\%u0a2a \\%u0a30\\%u0a47\\%u0a16\\%u0a3e\\|\\%u0a2a\\%u0a1f\\%u0a15\\%u0a25\\%u0a3e \\%u0a22\\%u0a3e\\%u0a02\\%u0a1a\\%u0a3e", "then": "\\%u0a24\\%u0a26\\>", "when": "\\%u0a1c\\%u0a26\\%u0a4b\\%u0a02\\>"},
+ \"pl": {"and": "Oraz\\>\\|I\\>", "background": "Za\\%u0142o\\%u017cenia", "but": "Ale\\>", "examples": "Przyk\\%u0142ady", "feature": "Potrzeba biznesowa\\|W\\%u0142a\\%u015bciwo\\%u015b\\%u0107\\|Funkcja\\|Aspekt", "given": "Zak\\%u0142adaj\\%u0105c, \\%u017ce\\>\\|Zak\\%u0142adaj\\%u0105c\\>\\|Maj\\%u0105c\\>", "rule": "Zasada\\|Regu\\%u0142a", "scenario": "Scenariusz\\|Przyk\\%u0142ad", "scenario_outline": "Szablon scenariusza", "then": "Wtedy\\>", "when": "Je\\%u017celi\\>\\|Je\\%u015bli\\>\\|Kiedy\\>\\|Gdy\\>"},
+ \"pt": {"and": "E\\>", "background": "Cen\\%u00e1rio de Fundo\\|Cenario de Fundo\\|Contexto\\|Fundo", "but": "Mas\\>", "examples": "Exemplos\\|Cen\\%u00e1rios\\|Cenarios", "feature": "Funcionalidade\\|Caracter\\%u00edstica\\|Caracteristica", "given": "Dados\\>\\|Dadas\\>\\|Dado\\>\\|Dada\\>", "rule": "Regra", "scenario": "Exemplo\\|Cen\\%u00e1rio\\|Cenario", "scenario_outline": "Delinea\\%u00e7\\%u00e3o do Cen\\%u00e1rio\\|Delineacao do Cenario\\|Esquema do Cen\\%u00e1rio\\|Esquema do Cenario", "then": "Ent\\%u00e3o\\>\\|Entao\\>", "when": "Quando\\>"},
+ \"ro": {"and": "Si\\>\\|\\%u0218i\\>\\|\\%u015ei\\>", "background": "Context", "but": "Dar\\>", "examples": "Exemple", "feature": "Functionalitate\\|Func\\%u021bionalitate\\|Func\\%u0163ionalitate", "given": "Date fiind\\>\\|Dati fiind\\>\\|Da\\%u021bi fiind\\>\\|Da\\%u0163i fiind\\>\\|Dat fiind\\>\\|Dat\\%u0103 fiind", "rule": "Rule", "scenario": "Scenariu\\|Exemplu", "scenario_outline": "Structura scenariu\\|Structur\\%u0103 scenariu", "then": "Atunci\\>", "when": "Cand\\>\\|C\\%u00e2nd\\>"},
+ \"ru": {"and": "\\%u041a \\%u0442\\%u043e\\%u043c\\%u0443 \\%u0436\\%u0435\\>\\|\\%u0422\\%u0430\\%u043a\\%u0436\\%u0435\\>\\|\\%u0418\\>", "background": "\\%u041f\\%u0440\\%u0435\\%u0434\\%u044b\\%u0441\\%u0442\\%u043e\\%u0440\\%u0438\\%u044f\\|\\%u041a\\%u043e\\%u043d\\%u0442\\%u0435\\%u043a\\%u0441\\%u0442", "but": "\\%u0418\\%u043d\\%u0430\\%u0447\\%u0435\\>\\|\\%u041d\\%u043e\\>\\|\\%u0410\\>", "examples": "\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\%u044b", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\%u044c\\%u043d\\%u043e\\%u0441\\%u0442\\%u044c\\|\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\|\\%u0421\\%u0432\\%u043e\\%u0439\\%u0441\\%u0442\\%u0432\\%u043e\\|\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u044f\\|\\%u0424\\%u0438\\%u0447\\%u0430", "given": "\\%u0414\\%u043e\\%u043f\\%u0443\\%u0441\\%u0442\\%u0438\\%u043c\\>\\|\\%u041f\\%u0443\\%u0441\\%u0442\\%u044c\\>\\|\\%u0414\\%u0430\\%u043d\\%u043e\\>", "rule": "\\%u041f\\%u0440\\%u0430\\%u0432\\%u0438\\%u043b\\%u043e", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440", "scenario_outline": "\\%u0421\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u044f\\|\\%u0428\\%u0430\\%u0431\\%u043b\\%u043e\\%u043d \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u044f", "then": "\\%u0417\\%u0430\\%u0442\\%u0435\\%u043c\\>\\|\\%u0422\\%u043e\\%u0433\\%u0434\\%u0430\\>\\|\\%u0422\\%u043e\\>", "when": "\\%u041a\\%u043e\\%u0433\\%u0434\\%u0430\\>\\|\\%u0415\\%u0441\\%u043b\\%u0438\\>"},
+ \"sk": {"and": "A taktie\\%u017e\\>\\|A z\\%u00e1rove\\%u0148\\>\\|A tie\\%u017e\\>\\|A\\>", "background": "Pozadie", "but": "Ale\\>", "examples": "Pr\\%u00edklady", "feature": "Po\\%u017eiadavka\\|Vlastnos\\%u0165\\|Funkcia", "given": "Za predpokladu\\>\\|Pokia\\%u013e\\>", "rule": "Rule", "scenario": "Pr\\%u00edklad\\|Scen\\%u00e1r", "scenario_outline": "Osnova Scen\\%u00e1ra\\|N\\%u00e1\\%u010drt Scen\\%u00e1ru\\|N\\%u00e1\\%u010drt Scen\\%u00e1ra", "then": "Potom\\>\\|Tak\\>", "when": "Ke\\%u010f\\>\\|Ak\\>"},
+ \"sl": {"and": "Ter\\>\\|In\\>", "background": "Kontekst\\|Osnova\\|Ozadje", "but": "Vendar\\>\\|Ampak\\>\\|Toda\\>", "examples": "Scenariji\\|Primeri", "feature": "Funkcionalnost\\|Zna\\%u010dilnost\\|Funkcija\\|Mo\\%u017enosti\\|Moznosti\\|Lastnost", "given": "Privzeto\\>\\|Podano\\>\\|Zaradi\\>\\|Dano\\>", "rule": "Rule", "scenario": "Scenarij\\|Primer", "scenario_outline": "Struktura scenarija\\|Oris scenarija\\|Koncept\\|Osnutek\\|Skica", "then": "Takrat\\>\\|Potem\\>\\|Nato\\>", "when": "Kadar\\>\\|Ko\\>\\|Ce\\>\\|\\%u010ce\\>"},
+ \"sr-Cyrl": {"and": "\\%u0418\\>", "background": "\\%u041a\\%u043e\\%u043d\\%u0442\\%u0435\\%u043a\\%u0441\\%u0442\\|\\%u041f\\%u043e\\%u0437\\%u0430\\%u0434\\%u0438\\%u043d\\%u0430\\|\\%u041e\\%u0441\\%u043d\\%u043e\\%u0432\\%u0430", "but": "\\%u0410\\%u043b\\%u0438\\>", "examples": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0458\\%u0438\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\%u0438", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\%u043d\\%u043e\\%u0441\\%u0442\\|\\%u041c\\%u043e\\%u0433\\%u0443\\%u045b\\%u043d\\%u043e\\%u0441\\%u0442\\|\\%u041e\\%u0441\\%u043e\\%u0431\\%u0438\\%u043d\\%u0430", "given": "\\%u0417\\%u0430 \\%u0434\\%u0430\\%u0442\\%u043e\\>\\|\\%u0417\\%u0430 \\%u0434\\%u0430\\%u0442\\%u0435\\>\\|\\%u0417\\%u0430 \\%u0434\\%u0430\\%u0442\\%u0438\\>", "rule": "\\%u041f\\%u0440\\%u0430\\%u0432\\%u0438\\%u043b\\%u043e", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u043e\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440", "scenario_outline": "\\%u0421\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0458\\%u0430\\|\\%u041a\\%u043e\\%u043d\\%u0446\\%u0435\\%u043f\\%u0442\\|\\%u0421\\%u043a\\%u0438\\%u0446\\%u0430", "then": "\\%u041e\\%u043d\\%u0434\\%u0430\\>", "when": "\\%u041a\\%u0430\\%u0434\\%u0430\\>\\|\\%u041a\\%u0430\\%u0434\\>"},
+ \"sr-Latn": {"and": "I\\>", "background": "Kontekst\\|Pozadina\\|Osnova", "but": "Ali\\>", "examples": "Scenariji\\|Primeri", "feature": "Funkcionalnost\\|Mogu\\%u0107nost\\|Mogucnost\\|Osobina", "given": "Za dato\\>\\|Za date\\>\\|Za dati\\>", "rule": "Pravilo", "scenario": "Scenario\\|Primer", "scenario_outline": "Struktura scenarija\\|Koncept\\|Skica", "then": "Onda\\>", "when": "Kada\\>\\|Kad\\>"},
+ \"sv": {"and": "Och\\>", "background": "Bakgrund", "but": "Men\\>", "examples": "Exempel", "feature": "Egenskap", "given": "Givet\\>", "rule": "Regel", "scenario": "Scenario", "scenario_outline": "Abstrakt Scenario\\|Scenariomall", "then": "S\\%u00e5\\>", "when": "N\\%u00e4r\\>"},
+ \"ta": {"and": "\\%u0bae\\%u0bc7\\%u0bb2\\%u0bc1\\%u0bae\\%u0bcd \\>\\|\\%u0bae\\%u0bb1\\%u0bcd\\%u0bb1\\%u0bc1\\%u0bae\\%u0bcd\\>", "background": "\\%u0baa\\%u0bbf\\%u0ba9\\%u0bcd\\%u0ba9\\%u0ba3\\%u0bbf", "but": "\\%u0b86\\%u0ba9\\%u0bbe\\%u0bb2\\%u0bcd \\>", "examples": "\\%u0b8e\\%u0b9f\\%u0bc1\\%u0ba4\\%u0bcd\\%u0ba4\\%u0bc1\\%u0b95\\%u0bcd\\%u0b95\\%u0bbe\\%u0b9f\\%u0bcd\\%u0b9f\\%u0bc1\\%u0b95\\%u0bb3\\%u0bcd\\|\\%u0ba8\\%u0bbf\\%u0bb2\\%u0bc8\\%u0bae\\%u0bc8\\%u0b95\\%u0bb3\\%u0bbf\\%u0bb2\\%u0bcd\\|\\%u0b95\\%u0bbe\\%u0b9f\\%u0bcd\\%u0b9a\\%u0bbf\\%u0b95\\%u0bb3\\%u0bcd", "feature": "\\%u0bb5\\%u0ba3\\%u0bbf\\%u0b95 \\%u0ba4\\%u0bc7\\%u0bb5\\%u0bc8\\|\\%u0b85\\%u0bae\\%u0bcd\\%u0b9a\\%u0bae\\%u0bcd\\|\\%u0ba4\\%u0bbf\\%u0bb1\\%u0ba9\\%u0bcd", "given": "\\%u0b95\\%u0bc6\\%u0bbe\\%u0b9f\\%u0bc1\\%u0b95\\%u0bcd\\%u0b95\\%u0baa\\%u0bcd\\%u0baa\\%u0b9f\\%u0bcd\\%u0b9f\\>", "rule": "Rule", "scenario": "\\%u0b89\\%u0ba4\\%u0bbe\\%u0bb0\\%u0ba3\\%u0bae\\%u0bbe\\%u0b95\\|\\%u0b95\\%u0bbe\\%u0b9f\\%u0bcd\\%u0b9a\\%u0bbf", "scenario_outline": "\\%u0b95\\%u0bbe\\%u0b9f\\%u0bcd\\%u0b9a\\%u0bbf \\%u0bb5\\%u0bbe\\%u0bb0\\%u0bcd\\%u0baa\\%u0bcd\\%u0baa\\%u0bc1\\%u0bb0\\%u0bc1\\|\\%u0b95\\%u0bbe\\%u0b9f\\%u0bcd\\%u0b9a\\%u0bbf \\%u0b9a\\%u0bc1\\%u0bb0\\%u0bc1\\%u0b95\\%u0bcd\\%u0b95\\%u0bae\\%u0bcd", "then": "\\%u0b85\\%u0baa\\%u0bcd\\%u0baa\\%u0bc6\\%u0bbe\\%u0bb4\\%u0bc1\\%u0ba4\\%u0bc1\\>", "when": "\\%u0b8e\\%u0baa\\%u0bcd\\%u0baa\\%u0bc7\\%u0bbe\\%u0ba4\\%u0bc1\\>"},
+ \"te": {"and": "\\%u0c2e\\%u0c30\\%u0c3f\\%u0c2f\\%u0c41\\>", "background": "\\%u0c28\\%u0c47\\%u0c2a\\%u0c25\\%u0c4d\\%u0c2f\\%u0c02", "but": "\\%u0c15\\%u0c3e\\%u0c28\\%u0c3f\\>", "examples": "\\%u0c09\\%u0c26\\%u0c3e\\%u0c39\\%u0c30\\%u0c23\\%u0c32\\%u0c41", "feature": "\\%u0c17\\%u0c41\\%u0c23\\%u0c2e\\%u0c41", "given": "\\%u0c1a\\%u0c46\\%u0c2a\\%u0c4d\\%u0c2a\\%u0c2c\\%u0c21\\%u0c3f\\%u0c28\\%u0c26\\%u0c3f\\>", "rule": "Rule", "scenario": "\\%u0c38\\%u0c28\\%u0c4d\\%u0c28\\%u0c3f\\%u0c35\\%u0c47\\%u0c36\\%u0c02\\|\\%u0c09\\%u0c26\\%u0c3e\\%u0c39\\%u0c30\\%u0c23", "scenario_outline": "\\%u0c15\\%u0c25\\%u0c28\\%u0c02", "then": "\\%u0c05\\%u0c2a\\%u0c4d\\%u0c2a\\%u0c41\\%u0c21\\%u0c41\\>", "when": "\\%u0c08 \\%u0c2a\\%u0c30\\%u0c3f\\%u0c38\\%u0c4d\\%u0c25\\%u0c3f\\%u0c24\\%u0c3f\\%u0c32\\%u0c4b\\>"},
+ \"th": {"and": "\\%u0e41\\%u0e25\\%u0e30\\>", "background": "\\%u0e41\\%u0e19\\%u0e27\\%u0e04\\%u0e34\\%u0e14", "but": "\\%u0e41\\%u0e15\\%u0e48\\>", "examples": "\\%u0e0a\\%u0e38\\%u0e14\\%u0e02\\%u0e2d\\%u0e07\\%u0e40\\%u0e2b\\%u0e15\\%u0e38\\%u0e01\\%u0e32\\%u0e23\\%u0e13\\%u0e4c\\|\\%u0e0a\\%u0e38\\%u0e14\\%u0e02\\%u0e2d\\%u0e07\\%u0e15\\%u0e31\\%u0e27\\%u0e2d\\%u0e22\\%u0e48\\%u0e32\\%u0e07", "feature": "\\%u0e04\\%u0e27\\%u0e32\\%u0e21\\%u0e15\\%u0e49\\%u0e2d\\%u0e07\\%u0e01\\%u0e32\\%u0e23\\%u0e17\\%u0e32\\%u0e07\\%u0e18\\%u0e38\\%u0e23\\%u0e01\\%u0e34\\%u0e08\\|\\%u0e04\\%u0e27\\%u0e32\\%u0e21\\%u0e2a\\%u0e32\\%u0e21\\%u0e32\\%u0e23\\%u0e16\\|\\%u0e42\\%u0e04\\%u0e23\\%u0e07\\%u0e2b\\%u0e25\\%u0e31\\%u0e01", "given": "\\%u0e01\\%u0e33\\%u0e2b\\%u0e19\\%u0e14\\%u0e43\\%u0e2b\\%u0e49\\>", "rule": "Rule", "scenario": "\\%u0e40\\%u0e2b\\%u0e15\\%u0e38\\%u0e01\\%u0e32\\%u0e23\\%u0e13\\%u0e4c", "scenario_outline": "\\%u0e42\\%u0e04\\%u0e23\\%u0e07\\%u0e2a\\%u0e23\\%u0e49\\%u0e32\\%u0e07\\%u0e02\\%u0e2d\\%u0e07\\%u0e40\\%u0e2b\\%u0e15\\%u0e38\\%u0e01\\%u0e32\\%u0e23\\%u0e13\\%u0e4c\\|\\%u0e2a\\%u0e23\\%u0e38\\%u0e1b\\%u0e40\\%u0e2b\\%u0e15\\%u0e38\\%u0e01\\%u0e32\\%u0e23\\%u0e13\\%u0e4c", "then": "\\%u0e14\\%u0e31\\%u0e07\\%u0e19\\%u0e31\\%u0e49\\%u0e19\\>", "when": "\\%u0e40\\%u0e21\\%u0e37\\%u0e48\\%u0e2d\\>"},
+ \"tlh": {"and": "latlh\\>\\|'ej\\>", "background": "mo'", "but": "'ach\\>\\|'a\\>", "examples": "ghantoH\\|lutmey", "feature": "poQbogh malja'\\|Qu'meH 'ut\\|perbogh\\|Qap\\|laH", "given": "DaH ghu' bejlu'\\>\\|ghu' noblu'\\>", "rule": "Rule", "scenario": "lut", "scenario_outline": "lut chovnatlh", "then": "vaj\\>", "when": "qaSDI'\\>"},
+ \"tr": {"and": "Ve\\>", "background": "Ge\\%u00e7mi\\%u015f", "but": "Fakat\\>\\|Ama\\>", "examples": "\\%u00d6rnekler", "feature": "\\%u00d6zellik", "given": "Diyelim ki\\>", "rule": "Kural", "scenario": "Senaryo\\|\\%u00d6rnek", "scenario_outline": "Senaryo tasla\\%u011f\\%u0131", "then": "O zaman\\>", "when": "E\\%u011fer ki\\>"},
+ \"tt": {"and": "\\%u04ba\\%u04d9\\%u043c\\>\\|\\%u0412\\%u04d9\\>", "background": "\\%u041a\\%u0435\\%u0440\\%u0435\\%u0448", "but": "\\%u041b\\%u04d9\\%u043a\\%u0438\\%u043d\\>\\|\\%u04d8\\%u043c\\%u043c\\%u0430\\>", "examples": "\\%u04ae\\%u0440\\%u043d\\%u04d9\\%u043a\\%u043b\\%u04d9\\%u0440\\|\\%u041c\\%u0438\\%u0441\\%u0430\\%u043b\\%u043b\\%u0430\\%u0440", "feature": "\\%u04ae\\%u0437\\%u0435\\%u043d\\%u0447\\%u04d9\\%u043b\\%u0435\\%u043a\\%u043b\\%u0435\\%u043b\\%u0435\\%u043a\\|\\%u041c\\%u04e9\\%u043c\\%u043a\\%u0438\\%u043d\\%u043b\\%u0435\\%u043a", "given": "\\%u04d8\\%u0439\\%u0442\\%u0438\\%u043a\\>", "rule": "Rule", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439", "scenario_outline": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\%u043d\\%u044b\\%u04a3 \\%u0442\\%u04e9\\%u0437\\%u0435\\%u043b\\%u0435\\%u0448\\%u0435", "then": "\\%u041d\\%u04d9\\%u0442\\%u0438\\%u0497\\%u04d9\\%u0434\\%u04d9\\>", "when": "\\%u04d8\\%u0433\\%u04d9\\%u0440\\>"},
+ \"uk": {"and": "\\%u0410 \\%u0442\\%u0430\\%u043a\\%u043e\\%u0436\\>\\|\\%u0422\\%u0430\\>\\|\\%u0406\\>", "background": "\\%u041f\\%u0435\\%u0440\\%u0435\\%u0434\\%u0443\\%u043c\\%u043e\\%u0432\\%u0430", "but": "\\%u0410\\%u043b\\%u0435\\>", "examples": "\\%u041f\\%u0440\\%u0438\\%u043a\\%u043b\\%u0430\\%u0434\\%u0438", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0456\\%u043e\\%u043d\\%u0430\\%u043b", "given": "\\%u041f\\%u0440\\%u0438\\%u043f\\%u0443\\%u0441\\%u0442\\%u0438\\%u043c\\%u043e, \\%u0449\\%u043e\\>\\|\\%u041f\\%u0440\\%u0438\\%u043f\\%u0443\\%u0441\\%u0442\\%u0438\\%u043c\\%u043e\\>\\|\\%u041d\\%u0435\\%u0445\\%u0430\\%u0439\\>\\|\\%u0414\\%u0430\\%u043d\\%u043e\\>", "rule": "Rule", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0456\\%u0439\\|\\%u041f\\%u0440\\%u0438\\%u043a\\%u043b\\%u0430\\%u0434", "scenario_outline": "\\%u0421\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0456\\%u044e", "then": "\\%u0422\\%u043e\\%u0434\\%u0456\\>\\|\\%u0422\\%u043e\\>", "when": "\\%u042f\\%u043a\\%u0449\\%u043e\\>\\|\\%u041a\\%u043e\\%u043b\\%u0438\\>"},
+ \"ur": {"and": "\\%u0627\\%u0648\\%u0631\\>", "background": "\\%u067e\\%u0633 \\%u0645\\%u0646\\%u0638\\%u0631", "but": "\\%u0644\\%u06cc\\%u06a9\\%u0646\\>", "examples": "\\%u0645\\%u062b\\%u0627\\%u0644\\%u06cc\\%u06ba", "feature": "\\%u06a9\\%u0627\\%u0631\\%u0648\\%u0628\\%u0627\\%u0631 \\%u06a9\\%u06cc \\%u0636\\%u0631\\%u0648\\%u0631\\%u062a\\|\\%u0635\\%u0644\\%u0627\\%u062d\\%u06cc\\%u062a\\|\\%u062e\\%u0635\\%u0648\\%u0635\\%u06cc\\%u062a", "given": "\\%u0641\\%u0631\\%u0636 \\%u06a9\\%u06cc\\%u0627\\>\\|\\%u0628\\%u0627\\%u0644\\%u0641\\%u0631\\%u0636\\>\\|\\%u0627\\%u06af\\%u0631\\>", "rule": "Rule", "scenario": "\\%u0645\\%u0646\\%u0638\\%u0631\\%u0646\\%u0627\\%u0645\\%u06c1", "scenario_outline": "\\%u0645\\%u0646\\%u0638\\%u0631 \\%u0646\\%u0627\\%u0645\\%u06d2 \\%u06a9\\%u0627 \\%u062e\\%u0627\\%u06a9\\%u06c1", "then": "\\%u067e\\%u06be\\%u0631\\>\\|\\%u062a\\%u0628\\>", "when": "\\%u062c\\%u0628\\>"},
+ \"uz": {"and": "\\%u0412\\%u0430\\>", "background": "\\%u0422\\%u0430\\%u0440\\%u0438\\%u0445", "but": "\\%u041b\\%u0435\\%u043a\\%u0438\\%u043d\\>\\|\\%u0411\\%u0438\\%u0440\\%u043e\\%u043a\\>\\|\\%u0410\\%u043c\\%u043c\\%u043e\\>", "examples": "\\%u041c\\%u0438\\%u0441\\%u043e\\%u043b\\%u043b\\%u0430\\%u0440", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b", "given": "Belgilangan\\>", "rule": "Rule", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439", "scenario_outline": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439 \\%u0441\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430\\%u0441\\%u0438", "then": "\\%u0423\\%u043d\\%u0434\\%u0430\\>", "when": "\\%u0410\\%u0433\\%u0430\\%u0440\\>"},
+ \"vi": {"and": "V\\%u00e0\\>", "background": "B\\%u1ed1i c\\%u1ea3nh", "but": "Nh\\%u01b0ng\\>", "examples": "D\\%u1eef li\\%u1ec7u", "feature": "T\\%u00ednh n\\%u0103ng", "given": "Bi\\%u1ebft\\>\\|Cho\\>", "rule": "Rule", "scenario": "T\\%u00ecnh hu\\%u1ed1ng\\|K\\%u1ecbch b\\%u1ea3n", "scenario_outline": "Khung t\\%u00ecnh hu\\%u1ed1ng\\|Khung k\\%u1ecbch b\\%u1ea3n", "then": "Th\\%u00ec\\>", "when": "Khi\\>"},
+ \"zh-CN": {"and": "\\%u800c\\%u4e14\\|\\%u5e76\\%u4e14\\|\\%u540c\\%u65f6", "background": "\\%u80cc\\%u666f", "but": "\\%u4f46\\%u662f", "examples": "\\%u4f8b\\%u5b50", "feature": "\\%u529f\\%u80fd", "given": "\\%u5047\\%u5982\\|\\%u5047\\%u8bbe\\|\\%u5047\\%u5b9a", "rule": "Rule\\|\\%u89c4\\%u5219", "scenario": "\\%u573a\\%u666f\\|\\%u5267\\%u672c", "scenario_outline": "\\%u573a\\%u666f\\%u5927\\%u7eb2\\|\\%u5267\\%u672c\\%u5927\\%u7eb2", "then": "\\%u90a3\\%u4e48", "when": "\\%u5f53"},
+ \"zh-TW": {"and": "\\%u800c\\%u4e14\\|\\%u4e26\\%u4e14\\|\\%u540c\\%u6642", "background": "\\%u80cc\\%u666f", "but": "\\%u4f46\\%u662f", "examples": "\\%u4f8b\\%u5b50", "feature": "\\%u529f\\%u80fd", "given": "\\%u5047\\%u5982\\|\\%u5047\\%u8a2d\\|\\%u5047\\%u5b9a", "rule": "Rule", "scenario": "\\%u5834\\%u666f\\|\\%u5287\\%u672c", "scenario_outline": "\\%u5834\\%u666f\\%u5927\\%u7db1\\|\\%u5287\\%u672c\\%u5927\\%u7db1", "then": "\\%u90a3\\%u9ebc", "when": "\\%u7576"}}
function! s:pattern(key)
let language = matchstr(getline(1),'#\s*language:\s*\zs\S\+')
@@ -83,16 +107,18 @@ function! s:pattern(key)
endfunction
function! s:Add(name)
- let next = " skipempty skipwhite nextgroup=".join(map(["Region","AndRegion","ButRegion","Comment","String","Table"],'"cucumber".a:name.v:val'),",")
+ let next = " skipempty skipwhite nextgroup=".join(map(["Region","AndRegion","ButRegion","StarRegion","Comment","String","Table"],'"cucumber".a:name.v:val'),",")
exe "syn region cucumber".a:name.'Region matchgroup=cucumber'.a:name.' start="\%(^\s*\)\@<=\%('.s:pattern(tolower(a:name)).'\)" end="$"'.next
exe 'syn region cucumber'.a:name.'AndRegion matchgroup=cucumber'.a:name.'And start="\%(^\s*\)\@<='.s:pattern('and').'" end="$" contained'.next
exe 'syn region cucumber'.a:name.'ButRegion matchgroup=cucumber'.a:name.'But start="\%(^\s*\)\@<='.s:pattern('but').'" end="$" contained'.next
+ exe 'syn region cucumber'.a:name.'StarRegion matchgroup=cucumber'.a:name.'Star start="\%(^\s*\)\@<=\*\S\@!" end="$" contained'.next
exe 'syn match cucumber'.a:name.'Comment "\%(^\s*\)\@<=#.*" contained'.next
exe 'syn region cucumber'.a:name.'String start=+\%(^\s*\)\@<="""+ end=+"""+ contained'.next
exe 'syn match cucumber'.a:name.'Table "\%(^\s*\)\@<=|.*" contained contains=cucumberDelimiter'.next
exe 'hi def link cucumber'.a:name.'Comment cucumberComment'
exe 'hi def link cucumber'.a:name.'String cucumberString'
exe 'hi def link cucumber'.a:name.'But cucumber'.a:name.'And'
+ exe 'hi def link cucumber'.a:name.'Star cucumber'.a:name.'And'
exe 'hi def link cucumber'.a:name.'And cucumber'.a:name
exe 'syn cluster cucumberStepRegions add=cucumber'.a:name.'Region,cucumber'.a:name.'AndRegion,cucumber'.a:name.'ButRegion'
endfunction
@@ -100,12 +126,13 @@ endfunction
syn match cucumberComment "\%(^\s*\)\@<=#.*"
syn match cucumberComment "\%(\%^\s*\)\@<=#.*" contains=cucumberLanguage
syn match cucumberLanguage "\%(#\s*\)\@<=language:" contained
-syn match cucumberUnparsed "\S.*" nextgroup=cucumberUnparsedComment,cucumberUnparsed,cucumberTags,cucumberBackground,cucumberScenario,cucumberScenarioOutline,cucumberExamples skipwhite skipempty contained
-syn match cucumberUnparsedComment "#.*" nextgroup=cucumberUnparsedComment,cucumberUnparsed,cucumberTags,cucumberBackground,cucumberScenario,cucumberScenarioOutline,cucumberExamples skipwhite skipempty contained
+syn match cucumberUnparsed "\S.*" nextgroup=cucumberUnparsedComment,cucumberUnparsed,cucumberTags,cucumberBackground,cucumberRule,cucumberScenario,cucumberScenarioOutline,cucumberExamples skipwhite skipempty contained
+syn match cucumberUnparsedComment "#.*" nextgroup=cucumberUnparsedComment,cucumberUnparsed,cucumberTags,cucumberBackground,cucumberRule,cucumberScenario,cucumberScenarioOutline,cucumberExamples skipwhite skipempty contained
-exe 'syn match cucumberFeature "\%(^\s*\)\@<='.s:pattern('feature').':" nextgroup=cucumberUnparsedComment,cucumberUnparsed,cucumberBackground,cucumberScenario,cucumberScenarioOutline,cucumberExamples skipwhite skipempty'
+exe 'syn match cucumberFeature "\%(^\s*\)\@<='.s:pattern('feature').':" nextgroup=cucumberUnparsedComment,cucumberUnparsed,cucumberBackground,cucumberRule,cucumberScenario,cucumberScenarioOutline,cucumberExamples skipwhite skipempty'
exe 'syn match cucumberBackground "\%(^\s*\)\@<='.s:pattern('background').':"'
exe 'syn match cucumberScenario "\%(^\s*\)\@<='.s:pattern('scenario').':"'
+exe 'syn match cucumberRule "\%(^\s*\)\@<='.s:pattern('rule').':"'
exe 'syn match cucumberScenarioOutline "\%(^\s*\)\@<='.s:pattern('scenario_outline').':"'
exe 'syn match cucumberExamples "\%(^\s*\)\@<='.s:pattern('examples').':" nextgroup=cucumberExampleTable skipempty skipwhite'
@@ -123,6 +150,7 @@ hi def link cucumberComment Comment
hi def link cucumberLanguage SpecialComment
hi def link cucumberFeature Macro
hi def link cucumberBackground Define
+hi def link cucumberRule Define
hi def link cucumberScenario Define
hi def link cucumberScenarioOutline Define
hi def link cucumberExamples Define
diff --git a/runtime/syntax/dcl.vim b/runtime/syntax/dcl.vim
index 7e9741efc7..547fdcb9f7 100644
--- a/runtime/syntax/dcl.vim
+++ b/runtime/syntax/dcl.vim
@@ -1,9 +1,10 @@
" Vim syntax file
" Language: DCL (Digital Command Language - vms)
-" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Charles E. Campbell
" Last Change: Mar 26, 2019
" Version: 13
-" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_DCL
+" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_DCL
" quit when a syntax file was already loaded
if exists("b:current_syntax")
diff --git a/runtime/syntax/deb822sources.vim b/runtime/syntax/deb822sources.vim
index 81113610e8..f7d337fce9 100644
--- a/runtime/syntax/deb822sources.vim
+++ b/runtime/syntax/deb822sources.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: Debian deb822-format source list file
" Maintainer: Debian Vim Maintainers
-" Last Change: 2023 May 25
+" Last Change: 2024 Jan 30
" URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/syntax/deb822sources.vim
" Standard syntax initialization
@@ -12,19 +12,19 @@ endif
" case insensitive
syn case ignore
+" A bunch of useful keywords
+syn match deb822sourcesType /\<\(deb-src\|deb\)\ */ contained
+syn match deb822sourcesFreeComponent /\<\(main\|universe\)\> */ contained
+syn match deb822sourcesNonFreeComponent /\<\(contrib\|non-free-firmware\|non-free\|restricted\|multiverse\)\> */ contained
+
" Comments are matched from the first character of a line to the end-of-line
syn region deb822sourcesComment start="^#" end="$"
-" A bunch of useful keywords
-syn match deb822sourcesType /\(deb-src\|deb\)/
-syn match deb822sourcesFreeComponent /\(main\|universe\)/
-syn match deb822sourcesNonFreeComponent /\(contrib\|non-free-firmware\|non-free\|restricted\|multiverse\)/
-
" Include Debian versioning information
runtime! syntax/shared/debversions.vim
-exe 'syn match deb822sourcesSupportedSuites contained + *\([[:alnum:]_./]*\)\<\('. join(g:debSharedSupportedVersions, '\|'). '\)\>\([-[:alnum:]_./]*\)+'
-exe 'syn match deb822sourcesUnsupportedSuites contained + *\([[:alnum:]_./]*\)\<\('. join(g:debSharedUnsupportedVersions, '\|'). '\)\>\([-[:alnum:]_./]*\)+'
+exe 'syn match deb822sourcesSupportedSuites contained + *\([[:alnum:]_./]*\)\<\('. join(g:debSharedSupportedVersions, '\|'). '\)\>\([-[:alnum:]_./]*\) *+'
+exe 'syn match deb822sourcesUnsupportedSuites contained + *\([[:alnum:]_./]*\)\<\('. join(g:debSharedUnsupportedVersions, '\|'). '\)\>\([-[:alnum:]_./]*\) *+'
unlet g:debSharedSupportedVersions
unlet g:debSharedUnsupportedVersions
@@ -37,13 +37,13 @@ syn keyword deb822sourcesYesNo contained yes no
" Match uri's
syn match deb822sourcesUri '\(https\?://\|ftp://\|[rs]sh://\|debtorrent://\|\(cdrom\|copy\|file\):\)[^' <>"]\+'
-syn match deb822sourcesEntryField "^\%(Types\|URIs\|Suites\|Components\): *"
-syn match deb822sourcesOptionField "^\%(Signed-By\|Check-Valid-Until\|Valid-Until-Min\|Valid-Until-Max\|Date-Max-Future\|InRelease-Path\): *"
-syn match deb822sourcesMultiValueOptionField "^\%(Architectures\|Languages\|Targets\)\%(-Add\|-Remove\)\?: *"
-
+syn region deb822sourcesStrictField matchgroup=deb822sourcesEntryField start="^\%(Types\|URIs\|Suites\|Components\): *" end="$" contains=deb822sourcesType,deb822sourcesUri,deb822sourcesSupportedSuites,deb822sourcesUnsupportedSuites,deb822sourcesFreeComponent,deb822sourcesNonFreeComponent oneline
+syn region deb822sourcesField matchgroup=deb822sourcesOptionField start="^\%(Signed-By\|Check-Valid-Until\|Valid-Until-Min\|Valid-Until-Max\|Date-Max-Future\|InRelease-Path\): *" end="$" oneline
+syn region deb822sourcesField matchgroup=deb822sourcesMultiValueOptionField start="^\%(Architectures\|Languages\|Targets\)\%(-Add\|-Remove\)\?: *" end="$" oneline
syn region deb822sourcesStrictField matchgroup=deb822sourcesBooleanOptionField start="^\%(PDiffs\|Allow-Insecure\|Allow-Weak\|Allow-Downgrade-To-Insecure\|Trusted\|Check-Date\): *" end="$" contains=deb822sourcesYesNo oneline
syn region deb822sourcesStrictField matchgroup=deb822sourcesForceBooleanOptionField start="^\%(By-Hash\): *" end="$" contains=deb822sourcesForce,deb822sourcesYesNo oneline
+hi def link deb822sourcesField Default
hi def link deb822sourcesComment Comment
hi def link deb822sourcesEntryField Keyword
hi def link deb822sourcesOptionField Special
diff --git a/runtime/syntax/debcontrol.vim b/runtime/syntax/debcontrol.vim
index af78ebc3ae..b173a7b3f7 100644
--- a/runtime/syntax/debcontrol.vim
+++ b/runtime/syntax/debcontrol.vim
@@ -3,7 +3,7 @@
" Maintainer: Debian Vim Maintainers
" Former Maintainers: Gerfried Fuchs <alfie@ist.org>
" Wichert Akkerman <wakkerma@debian.org>
-" Last Change: 2023 Jan 16
+" Last Change: 2023 Dec 22
" URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/syntax/debcontrol.vim
" Standard syntax initialization
@@ -29,7 +29,7 @@ syn match debControlSpace "[ \t]"
let s:kernels = ['linux', 'hurd', 'kfreebsd', 'knetbsd', 'kopensolaris', 'netbsd']
let s:archs = [
\ 'alpha', 'amd64', 'armeb', 'armel', 'armhf', 'arm64', 'avr32', 'hppa'
- \, 'i386', 'ia64', 'lpia', 'm32r', 'm68k', 'mipsel', 'mips64el', 'mips'
+ \, 'i386', 'ia64', 'loong64', 'lpia', 'm32r', 'm68k', 'mipsel', 'mips64el', 'mips'
\, 'powerpcspe', 'powerpc', 'ppc64el', 'ppc64', 'riscv64', 's390x', 's390', 'sh3eb'
\, 'sh3', 'sh4eb', 'sh4', 'sh', 'sparc64', 'sparc', 'x32'
\ ]
diff --git a/runtime/syntax/debsources.vim b/runtime/syntax/debsources.vim
index 9846cfdef0..76b52cfaa4 100644
--- a/runtime/syntax/debsources.vim
+++ b/runtime/syntax/debsources.vim
@@ -2,7 +2,7 @@
" Language: Debian sources.list
" Maintainer: Debian Vim Maintainers
" Former Maintainer: Matthijs Mohlmann <matthijs@cacholong.nl>
-" Last Change: 2023 Oct 11
+" Last Change: 2024 Jan 30
" URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/syntax/debsources.vim
" Standard syntax initialization
@@ -14,9 +14,9 @@ endif
syn case match
" A bunch of useful keywords
-syn match debsourcesType /\(deb-src\|deb\)/
-syn match debsourcesFreeComponent /\(main\|universe\)/
-syn match debsourcesNonFreeComponent /\(contrib\|non-free-firmware\|non-free\|restricted\|multiverse\)/
+syn match debsourcesType /\<\(deb-src\|deb\)\>/ contained
+syn match debsourcesFreeComponent /\<\(main\|universe\)\>/ contained
+syn match debsourcesNonFreeComponent /\<\(contrib\|non-free-firmware\|non-free\|restricted\|multiverse\)\>/ contained
" Match comments
syn match debsourcesComment /#.*/ contains=@Spell
@@ -34,7 +34,6 @@ unlet g:debSharedUnsupportedVersions
syn match debsourcesUri '\(https\?://\|ftp://\|[rs]sh://\|debtorrent://\|\(cdrom\|copy\|file\):\)[^' <>"]\+'
syn region debsourcesLine start="^" end="$" contains=debsourcesType,debsourcesFreeComponent,debsourcesNonFreeComponent,debsourcesComment,debsourcesUri,debsourcesDistrKeyword,debsourcesUnsupportedDistrKeyword oneline
-
" Associate our matches and regions with pretty colours
hi def link debsourcesType Statement
hi def link debsourcesFreeComponent Statement
diff --git a/runtime/syntax/diff.vim b/runtime/syntax/diff.vim
index 4cadf5dae8..b0a8594def 100644
--- a/runtime/syntax/diff.vim
+++ b/runtime/syntax/diff.vim
@@ -378,9 +378,9 @@ hi def link diffBDiffer Constant
hi def link diffIsA Constant
hi def link diffNoEOL Constant
hi def link diffCommon Constant
-hi def link diffRemoved Special
-hi def link diffChanged PreProc
-hi def link diffAdded Identifier
+hi def link diffRemoved Removed
+hi def link diffChanged Changed
+hi def link diffAdded Added
hi def link diffLine Statement
hi def link diffSubname PreProc
hi def link diffComment Comment
diff --git a/runtime/syntax/dosbatch.vim b/runtime/syntax/dosbatch.vim
index a75771bd2d..55601996ad 100644
--- a/runtime/syntax/dosbatch.vim
+++ b/runtime/syntax/dosbatch.vim
@@ -2,11 +2,11 @@
" Language: MS-DOS/Windows batch file (with NT command extensions)
" Maintainer: Mike Williams <mrmrdubya@gmail.com>
" Filenames: *.bat
-" Last Change: 12th February 2023
+" Last Change: 3rd February 2024
"
" Options Flags:
" dosbatch_cmdextversion - 1 = Windows NT, 2 = Windows 2000 [default]
-" dosbatch_colons_comment - any value to treat :: as comment line
+" dosbatch_colons_comment - any value to allow :: comments in code blocks
"
" quit when a syntax file was already loaded
@@ -88,18 +88,22 @@ syn match dosbatchLabel "\<goto\s\+\h\w*\>"lc=4
syn match dosbatchLabel ":\h\w*\>"
" Comments - usual rem but also two colons as first non-space is an idiom
-syn match dosbatchComment "^rem\($\|\s.*$\)"lc=3 contains=dosbatchTodo,dosbatchSpecialChar,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell
-syn match dosbatchComment "^@rem\($\|\s.*$\)"lc=4 contains=dosbatchTodo,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell
-syn match dosbatchComment "\srem\($\|\s.*$\)"lc=4 contains=dosbatchTodo,dosbatchSpecialChar,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell
-syn match dosbatchComment "\s@rem\($\|\s.*$\)"lc=5 contains=dosbatchTodo,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell
+syn match dosbatchRemComment "^rem\($\|\s.*$\)"lc=3 contains=dosbatchTodo,dosbatchSpecialChar,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell
+syn match dosbatchRemComment "^@rem\($\|\s.*$\)"lc=4 contains=dosbatchTodo,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell
+syn match dosbatchRemComment "\srem\($\|\s.*$\)"lc=4 contains=dosbatchTodo,dosbatchSpecialChar,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell
+syn match dosbatchRemComment "\s@rem\($\|\s.*$\)"lc=5 contains=dosbatchTodo,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell
+syn match dosbatchColonComment "\s*:\s*:.*$" contains=dosbatchTodo,dosbatchSpecialChar,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell
+
+" Commands code blocks
+syn cluster dosbatchCodeBlockComment contains=dosbatchRemComment
if exists("dosbatch_colons_comment")
- syn match dosbatchComment "\s*:\s*:.*$" contains=dosbatchTodo,dosbatchSpecialChar,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell
+ syn cluster dosbatchCodeBlockComment add=dosbatchColonComment
else
- syn match dosbatchError "\s*:\s*:.*$"
+ syn match dosbatchColonCommentErr contained "\s*:\s*:.*$"
endif
-
-" Comments in ()'s - still to handle spaces before rem
-syn match dosbatchComment "(rem\([^)]\|\^\@<=)\)*"lc=4 contains=dosbatchTodo,@dosbatchNumber,dosbatchVariable,dosbatchArgument,@Spell
+syn match dosbatchColonCommentErr contained "\s*:\s*:[^)]*\(\(\n\s*\)\?)\)\@="
+syn region dosbatchCodeBlock transparent start=+(+ end=+)+ contains=dosbatchString,dosbatchVariable,dosBatchArgument,@dosbatchNumber,dosbatchImplicit,dosbatchStatement,dosbatchConditional,dosbatchRepeat,dosbatchOperator,@dosbatchCodeBlockComment,dosbatchColonCommentErr,dosbatchCodeBlock
+syn match dosbatchCodeBlockErr ")"
syn keyword dosbatchImplicit append assoc at attrib break cacls cd chcp chdir
syn keyword dosbatchImplicit chkdsk chkntfs cls cmd color comp compact convert copy
@@ -116,6 +120,8 @@ syn keyword dosbatchImplicit vol xcopy
hi def link dosbatchTodo Todo
hi def link dosbatchError Error
+hi def link dosbatchCodeBlockErr dosbatchError
+hi def link dosbatchColonCommentErr dosbatchError
hi def link dosbatchStatement Statement
hi def link dosbatchCommands dosbatchStatement
@@ -140,6 +146,9 @@ hi def link dosbatchBinary dosbatchNumber
hi def link dosbatchOctal dosbatchNumber
hi def link dosbatchComment Comment
+hi def link dosbatchRemComment dosbatchComment
+hi def link dosbatchColonComment dosbatchComment
+
hi def link dosbatchImplicit Function
hi def link dosbatchSwitch Special
diff --git a/runtime/syntax/elmfilt.vim b/runtime/syntax/elmfilt.vim
index d995853e8e..aa1b57cbfe 100644
--- a/runtime/syntax/elmfilt.vim
+++ b/runtime/syntax/elmfilt.vim
@@ -1,9 +1,10 @@
" Vim syntax file
" Language: Elm Filter rules
-" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Charles E. Campbell
" Last Change: Aug 31, 2016
" Version: 9
-" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_ELMFILT
+" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_ELMFILT
" quit when a syntax file was already loaded
if exists("b:current_syntax")
diff --git a/runtime/syntax/exports.vim b/runtime/syntax/exports.vim
index 05a3f1acfe..00b7d80dfa 100644
--- a/runtime/syntax/exports.vim
+++ b/runtime/syntax/exports.vim
@@ -1,10 +1,11 @@
" Vim syntax file
" Language: exports
-" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Charles E. Campbell
" Last Change: Aug 31, 2016
" Version: 8
" Notes: This file includes both SysV and BSD 'isms
-" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_EXPORTS
+" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_EXPORTS
" quit when a syntax file was already loaded
if exists("b:current_syntax")
diff --git a/runtime/syntax/fortran.vim b/runtime/syntax/fortran.vim
index fc6c82b480..8167e4d737 100644
--- a/runtime/syntax/fortran.vim
+++ b/runtime/syntax/fortran.vim
@@ -1,7 +1,8 @@
" Vim syntax file
-" Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77)
-" Version: (v105) 2023 August 14
-" Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/>
+" Language: Fortran 2023 (and Fortran 2018, 2008, 2003, 95, 90, and 77)
+" Version: (v113) 2024 February 01
+" Maintainers: Ajit J. Thakkar <ajit@unb.ca>; <https://ajit.ext.unb.ca/>
+" Joshua Hollett <j.hollett@uwinnipeg.ca>
" Usage: For instructions, do :help fortran-syntax from Vim
" Credits:
" Version 0.1 for Fortran 95 was created in April 2000 by Ajit Thakkar from an
@@ -11,7 +12,8 @@
" Walter Dieudonne, Alexander Wagner, Roman Bertle, Charles Rendleman,
" Andrew Griffiths, Joe Krahn, Hendrik Merx, Matt Thompson, Jan Hermann,
" Stefano Zaghi, Vishnu V. Krishnan, Judicael Grasset, Takuma Yoshida,
-" Eisuke Kawashima, Andre Chalella, Fritz Reese, and Karl D. Hammond.
+" Eisuke Kawashima, Andre Chalella, Fritz Reese, Karl D. Hammond,
+" and Michele Esposito Marzino.
if exists("b:current_syntax")
finish
@@ -20,35 +22,10 @@ endif
let s:cpo_save = &cpo
set cpo&vim
-" Choose fortran_dialect using the priority:
-" source file directive > buffer-local value > global value > file extension
-" first try using directive in first three lines of file
-let b:fortran_retype = getline(1)." ".getline(2)." ".getline(3)
-if b:fortran_retype =~? '\<fortran_dialect\s*=\s*F\>'
- let b:fortran_dialect = "F"
-elseif b:fortran_retype =~? '\<fortran_dialect\s*=\s*f08\>'
- let b:fortran_dialect = "f08"
-elseif !exists("b:fortran_dialect")
- if exists("g:fortran_dialect") && g:fortran_dialect =~# '\<F\|f08\>'
- " try global variable
- let b:fortran_dialect = g:fortran_dialect
- else " nothing found, so use default
- let b:fortran_dialect = "f08"
- endif
-endif
-unlet! b:fortran_retype
-" make sure buffer-local value is not invalid
-if b:fortran_dialect !~# '\<F\|f08\>'
- let b:fortran_dialect = "f08"
-endif
-
" Choose between fixed and free source form if this hasn't been done yet
if !exists("b:fortran_fixed_source")
- if b:fortran_dialect == "F"
- " F requires free source form
- let b:fortran_fixed_source = 0
- elseif exists("fortran_free_source")
- " User guarantees free source form for all fortran files
+ if exists("fortran_free_source")
+ " User guarantees free source form for all Fortran files
let b:fortran_fixed_source = 0
elseif exists("fortran_fixed_source")
" User guarantees fixed source form for all fortran files
@@ -60,7 +37,7 @@ if !exists("b:fortran_fixed_source")
" Fixed-form file extension defaults
let b:fortran_fixed_source = 1
else
- " Modern fortran still allows both free and fixed source form.
+ " Modern Fortran compilers still allow both free and fixed source form.
" Assume fixed source form unless signs of free source form
" are detected in the first five columns of the first s:lmax lines.
" Detection becomes more accurate and time-consuming if more lines
@@ -84,6 +61,9 @@ if !exists("b:fortran_fixed_source")
endif
endif
+" Group names ending in 'Del' and 'Ob', respectively, indicate features deleted and obsolescent in Fortran 2018 and later
+" Deleted features are highlighted as errors
+" Obsolescent features are highlighted as todo items
syn case ignore
if b:fortran_fixed_source == 1
@@ -91,46 +71,107 @@ if b:fortran_fixed_source == 1
else
syn match fortranConstructName "^\s*\zs\a\w*\ze\s*:"
endif
-if exists("fortran_more_precise")
- syn match fortranConstructName "\(\<end\s*do\s\+\)\@11<=\a\w*"
- syn match fortranConstructName "\(\<end\s*if\s\+\)\@11<=\a\w*"
- syn match fortranConstructName "\(\<end\s*select\s\+\)\@15<=\a\w*"
- syn match fortranConstructName "\(\<\%(exit\|cycle\)\s\+\)\@11<=\a\w*"
+syn match fortranConstructName "\%(\<end\s*do\s\+\)\@11<=\a\w*"
+syn match fortranConstructName "\%(\<end\s*if\s\+\)\@11<=\a\w*"
+syn match fortranConstructName "\%(\<end\s*select\s\+\)\@15<=\a\w*"
+syn match fortranConstructName "\%(\<end\s*where\s\+\)\@14<=\a\w*"
+syn match fortranConstructName "\%(\<end\s*block\s\+\)\@14<=\a\w*"
+syn match fortranConstructName "\%(\<\%(exit\|cycle\)\s\+\)\@11<=\a\w*"
+syn match fortranConstructName "\%(\<end\s*forall\s\+\)\@15<=\a\w*\>"
+syn match fortranConstructName "\%(\<end\s*critical\s\+\)\@17<=\a\w*\>"
+syn match fortranConstructName "\%(\<end\s*associate\s\+\)\@18<=\a\w*\>"
+
+syn match fortranUnitName "\%(\<\%(end\s*\)\?\%(subroutine\|function\|module\|program\|submodule\)\s\+\)\@12<=\a\w*"
+syn match fortranUnitHeader "\<end\>\ze\s*\%(!.*\)\?$"
+
+syn keyword fortranIntrinsic abs acos aimag aint anint asin atan atan2 cmplx conjg cos cosh exp ichar index int log log10 max min nint sin sinh sqrt tan tanh
+syn keyword fortranIntrinsicR achar iachar transfer dble dprod dim lge lgt lle llt mod
+syn keyword fortranIntrinsic command_argument_count get_command get_command_argument get_environment_variable is_iostat_end is_iostat_eor move_alloc new_line same_type_as extends_type_of
+syn keyword fortranIntrinsic selected_real_kind selected_int_kind selected_logical_kind selected_char_kind next previous
+syn keyword fortranIntrinsic acosh asinh atanh bessel_j0 bessel_j1 bessel_jn bessel_y0 bessel_y1 bessel_yn erf erfc erfc_scaled gamma log_gamma hypot norm2
+syn keyword fortranIntrinsic adjustl adjustr all allocated any associated bit_size btest ceiling cshift date_and_time digits
+syn keyword fortranIntrinsic dot_product eoshift exponent floor fraction iand ibclr ibits ibset ieor ior ishft ishftc lbound len_trim matmul maxexponent maxloc merge minexponent minloc
+syn keyword fortranIntrinsic modulo mvbits nearest pack precision present radix random_number random_seed range repeat reshape rrspacing scale scan set_exponent shape spacing
+" intrinsic names often used for variables in older Fortran code
+syn match fortranIntrinsic '\<\%(count\|epsilon\|maxval\|minval\|product\|sum\|huge\|tiny\|char\)\>\ze\s*('
+syn keyword fortranIntrinsic spread system_clock transpose trim ubound unpack verify is_contiguous event_query
+syn keyword fortranIntrinsic atomic_define atomic_ref execute_command_line leadz trailz storage_size merge_bits
+syn keyword fortranIntrinsic bge bgt ble blt dshiftl dshiftr findloc iall iany iparity image_index lcobound ucobound maskl maskr num_images parity popcnt poppar shifta shiftl shiftr this_image
+syn keyword fortranIntrinsic null cpu_time failed_images stopped_images image_status co_broadcast co_max co_min co_sum co_reduce
+syn keyword fortranIntrinsic atomic_add atomic_and atomic_or atomic_xor atomic_fetch_add atomic_fetch_and atomic_fetch_or atomic_fetch_xor atomic_cas
+syn keyword fortranIntrinsic ieee_arithmetic ieee_features ieee_exceptions
+syn keyword fortranIntrinsic ieee_class ieee_copy_sign ieee_fma ieee_get_rounding_mode ieee_get_underflow_mode ieee_int ieee_is_finite
+syn keyword fortranIntrinsic ieee_is_nan ieee_is_negative ieee_is_normal ieee_logb ieee_max ieee_max_mag ieee_max_num ieee_max_num_mag
+syn keyword fortranIntrinsic ieee_min ieee_min_mag ieee_min_num ieee_min_num_mag ieee_next_after ieee_next_down ieee_next_up ieee_quiet_eq
+syn keyword fortranIntrinsic ieee_quiet_ge ieee_quiet_gt ieee_quiet_le ieee_quiet_lt ieee_quiet_ne ieee_real ieee_rem ieee_rint ieee_scalb
+syn keyword fortranIntrinsic ieee_selected_real_kind ieee_set_rounding_mode ieee_set_underflow_mode ieee_signaling_eq ieee_signaling_ge
+syn keyword fortranIntrinsic ieee_signaling_gt ieee_signaling_le ieee_signaling_lt ieee_signaling_ne ieee_signbit ieee_support_datatype
+syn keyword fortranIntrinsic ieee_support_denormal ieee_support_divide ieee_support_inf ieee_support_io ieee_support_nan ieee_support_rounding
+syn keyword fortranIntrinsic ieee_support_sqrt ieee_support_subnormal ieee_support_standard ieee_support_underflow_control
+syn keyword fortranIntrinsic ieee_unordered ieee_value ieee_get_flag ieee_get_halting_mode ieee_get_modes ieee_get_status
+syn keyword fortranIntrinsic ieee_set_flag ieee_set_halting_mode ieee_set_modes ieee_set_status ieee_support_flag ieee_support_halting
+syn keyword fortranIntrinsic iso_c_binding c_loc c_funloc c_sizeof c_associated c_f_pointer c_f_procpointer c_f_strpointer f_c_string
+syn keyword fortranIntrinsic iso_fortran_env compiler_options compiler_version
+syn keyword fortranIntrinsic out_of_range reduce random_init coshape get_team split tokenize
+syn keyword fortranIntrinsic acosd asind atand atan2d cosd sind tand acospi asinpi atanpi atan2pi cospi sinpi tanpi
+syn match fortranIntrinsic "\%(^\s*\|type *is *(\s*\)\@12<!\<real\ze\s*("
+syn match fortranIntrinsic '\<\%(logical\|not\|len\|kind\|rank\)\>\ze\s*('
+syn match fortranIntrinsic '\<\%(sign\|size\|team_number\)\>\ze\s*('
+" Obsolescent type-specific intrinsics
+syn keyword fortranIntrinsicOb alog alog10 amax0 amax1 amin0 amin1 amod cabs ccos cexp clog csin csqrt dabs dacos dasin datan datan2 dcos dcosh ddim dexp dint dlog dlog10 dmax1 dmin1 dmod dnint dsign dsin dsinh dsqrt dtan dtanh float iabs idim idint idnint ifix isign max0 max1 min0 min1 sngl
+if exists("fortran_vendor_intrinsics")
+ syn keyword fortranIntrinsicVen algama cdabs cdcos cdexp cdlog cdsin cdsqrt cqabs cqcos cqexp cqlog cqsin cqsqrt dcmplx dconjg derf derfc dfloat dgamma dimag dlgama iqint qabs qacos qasin qatan qatan2 qcmplx qconjg qcos qcosh qdim qerf qerfc qexp qgamma qimag qlgama qlog qlog10 qmax1 qmin1 qmod qnint qsign qsin qsinh qsqrt qtan qtanh
endif
-syn match fortranUnitHeader "\<end\>"
-syn match fortranType "\<character\((\s*kind\s*=\w\+)\)\?\>"
-syn match fortranType "\<complex\((\s*kind\s*=\w\+)\)\?\>"
-syn keyword fortranType intrinsic
-syn match fortranType "\<implicit\>\s\+\(none\)\?"
-syn keyword fortranStructure dimension
-syn keyword fortranStorageClass parameter save
-syn match fortranUnitHeader "\<subroutine\>"
-syn keyword fortranCall call
-syn match fortranUnitHeader "\<function\>"
-syn match fortranUnitHeader "\<program\>"
-syn match fortranUnitHeader "\<block\>"
-syn keyword fortranKeyword return stop
-syn keyword fortranConditional else then
-syn match fortranConditional "\<if\>"
-syn match fortranConditionalOb "\<if\s*(.*)\s*\d\+\s*,\s*\d\+\s*,\s*\d\+\s*$"
+syn keyword fortranType generic final enumerator import classof typeof team_type event_type lock_type notify_type
+syn keyword fortranType ieee_flag_type ieee_modes_type ieee_status_type ieee_class_type ieee_round_type ieee_features_type
+syn keyword fortranType c_ptr c_funptr elemental pure impure recursive non_recursive simple
+syn match fortranType "^\s*\%(implicit\s\+\)\?\%(real\|double\s*precision\|integer\|logical\|complex\|character\|type\)\>"
+syn match fortranTypeOb "^\s*\%(character\s*\)\@15<=\*"
+syn match fortranType "^\s*\zsimplicit\s\+none\>"
+syn match fortranType "\<class\>"
+syn match fortranType "\%(\<type\s\+is\s\+[(]\s*\)\@15<=\%(real\|double\s*precision\|integer\|logical\|complex\|character\)\>"
+syn match fortranType "\<\%(end\s*\)\?interface\>"
+syn match fortranType "\<enum\s*,\s*bind\s*(\s*c\s*)"
+syn match fortranType "\<end\s*\%(enum\|type\)\>"
+syn match fortranType "\<\%(end\s*\)\?enumeration\s\+type\>"
+syn match fortranType "\<\%(end\s*\)\?\%(module\s\+\)\?procedure\>"
+syn match fortranType "\%(simple \|pure \|impure \|recursive \|non_recursive \|elemental \|module \)\@17<=\%(real\|double precision\|integer\|logical\|complex\|character\)"
+syn match fortranTypeR display "\<double\s*precision\>"
+syn match fortranTypeR display "\<double\s\+complex\>"
+syn keyword fortranAttribute abstract allocatable bind codimension contiguous deferred dimension extends
+syn keyword fortranAttribute external intent intrinsic non_intrinsic non_overridable nopass optional parameter pass
+syn keyword fortranAttribute pointer private protected public save sequence target value volatile
+syn match fortranAttribute "\<asynchronous\>\ze\s*\%(::\|,\|(\)"
+
+syn keyword fortranUnitHeader result operator assignment
+syn match fortranUnitHeader "\<\%(end\s*\)\?\%(subroutine\|function\|module\|program\|submodule\)\>"
+syn match fortranBlock "\<\%(end\s*\)\?\%(block\|critical\|associate\)\>"
+syn match fortranCalled "\<\%(call\s\+\)\@7<=\a\w*"
syn match fortranRepeat "\<do\>"
+syn keyword fortranRepeat concurrent
+syn keyword fortranRepeatR while
+syn match fortranRepeat "\<end\s*do\>"
+syn keyword fortranRepeatOb forall
+syn match fortranRepeatOb "\<end\s*forall\>"
-syn keyword fortranTodo contained todo fixme
+syn keyword fortranTodo contained bug note debug todo fixme
"Catch errors caused by too many right parentheses
syn region fortranParen transparent start="(" end=")" contains=ALLBUT,fortranParenError,@fortranCommentGroup,cIncluded,@spell
syn match fortranParenError ")"
-syn match fortranOperator "\.\s*n\=eqv\s*\."
-syn match fortranOperator "\.\s*\(and\|or\|not\)\s*\."
-syn match fortranOperator "\(+\|-\|/\|\*\)"
-syn match fortranTypeOb "\<character\s*\*"
-
-syn match fortranBoolean "\.\s*\(true\|false\)\s*\."
+syn match fortranOperator "\.\s*n\?eqv\s*\."
+syn match fortranOperator "\.\s*\%(and\|or\|not\)\s*\."
+syn match fortranOperator "\%(+\|-\|/\|\*\)"
+syn match fortranOperator "\%(\%(>\|<\)=\?\|==\|/=\|=\)"
+syn match fortranOperator "\%(%\|?\|=>\)"
+syn match fortranOperator "\%([\|]\)"
+syn match fortranOperatorR "\.\s*[gl][et]\s*\."
+syn match fortranOperatorR "\.\s*\%(eq\|ne\)\s*\."
-syn keyword fortranReadWrite print
-syn match fortranReadWrite '\<\(backspace\|close\|endfile\|inquire\|open\|read\|rewind\|write\)\ze\s*('
+syn keyword fortranReadWrite print flush
+syn match fortranReadWrite '\<\%(backspace\|close\|endfile\|inquire\|open\|read\|rewind\|wait\|write\)\ze\s*('
"If tabs are allowed then the left margin checks do not work
if exists("fortran_have_tabs")
@@ -139,34 +180,19 @@ else
syn match fortranTab "\t"
endif
-syn match fortranIO '\%(\((\|,\|, *&\n\)\s*\)\@<=\(access\|blank\|direct\|exist\|file\|fmt\|form\|formatted\|iostat\|name\|named\|nextrec\|number\|opened\|rec\|recl\|sequential\|status\|unformatted\|unit\)\ze\s*='
-
-syn keyword fortranIntrinsicR alog alog10 amax0 amax1 amin0 amin1 amod cabs ccos cexp clog csin csqrt dabs dacos dasin datan datan2 dcos dcosh ddim dexp dint dlog dlog10 dmax1 dmin1 dmod dnint dsign dsin dsinh dsqrt dtan dtanh float iabs idim idint idnint ifix isign max0 max1 min0 min1 sngl
-
-" Intrinsics provided by some vendors
-syn keyword fortranExtraIntrinsic algama cdabs cdcos cdexp cdlog cdsin cdsqrt cqabs cqcos cqexp cqlog cqsin cqsqrt dcmplx dconjg derf derfc dfloat dgamma dimag dlgama iqint qabs qacos qasin qatan qatan2 qcmplx qconjg qcos qcosh qdim qerf qerfc qexp qgamma qimag qlgama qlog qlog10 qmax1 qmin1 qmod qnint qsign qsin qsinh qsqrt qtan qtanh
-
-syn keyword fortranIntrinsic abs acos aimag aint anint asin atan atan2 char cmplx conjg cos cosh exp ichar index int log log10 max min nint sign sin sinh sqrt tan tanh
-syn match fortranIntrinsic "\<len\s*[(,]"me=s+3
-syn match fortranIntrinsic "\<real\s*("me=s+4
-syn match fortranIntrinsic "\<logical\s*("me=s+7
-syn match fortranType "\<type\>\(\s\+is\>\)\?"
-syn match fortranType "^\s*\(type\s\+\(is\)\? \)\?\s*\(real\|integer\|logical\|complex\|character\)\>"
-syn match fortranType "^\s*\(implicit \)\?\s*\(real\|integer\|logical\|complex\|character\)\>"
-
"Numbers of various sorts
" Integers
-syn match fortranNumber display "\<\d\+\(_\a\w*\)\=\>"
+syn match fortranNumber display "\<\d\+\%(_\a\w*\)\?\>"
" floating point number, without a decimal point
-syn match fortranFloatIll display "\<\d\+[deq][-+]\=\d\+\(_\a\w*\)\=\>"
+syn match fortranFloatIll display "\<\d\+[deq][-+]\?\d\+\%(_\a\w*\)\?\>"
" floating point number, starting with a decimal point
-syn match fortranFloatIll display "\.\d\+\([deq][-+]\=\d\+\)\=\(_\a\w*\)\=\>"
+syn match fortranFloatIll display "\.\d\+\%([deq][-+]\?\d\+\)\?\%(_\a\w*\)\?\>"
" floating point number, no digits after decimal
-syn match fortranFloatIll display "\<\d\+\.\([deq][-+]\=\d\+\)\=\(_\a\w*\)\=\>"
+syn match fortranFloatIll display "\<\d\+\.\%([deq][-+]\?\d\+\)\?\%(_\a\w*\)\?\>"
" floating point number, D or Q exponents
-syn match fortranFloatIll display "\<\d\+\.\d\+\([dq][-+]\=\d\+\)\=\(_\a\w*\)\=\>"
+syn match fortranFloatIll display "\<\d\+\.\d\+\%([dq][-+]\?\d\+\)\?\%(_\a\w*\)\?\>"
" floating point number
-syn match fortranFloat display "\<\d\+\.\d\+\(e[-+]\=\d\+\)\=\(_\a\w*\)\=\>"
+syn match fortranFloat display "\<\d\+\.\d\+\%(e[-+]\?\d\+\)\?\%(_\a\w*\)\?\>"
" binary number
syn match fortranBinary display "b["'][01]\+["']"
" octal number
@@ -175,151 +201,95 @@ syn match fortranOctal display "o["'][0-7]\+["']"
syn match fortranHex display "z["'][0-9A-F]\+["']"
" Numbers in formats
syn match fortranFormatSpec display "\d*f\d\+\.\d\+"
-syn match fortranFormatSpec display "\d*e[sn]\=\d\+\.\d\+\(e\d+\>\)\="
-syn match fortranFormatSpec display "\d*\(d\|q\|g\)\d\+\.\d\+\(e\d+\)\="
+syn match fortranFormatSpec display "\d*e[sn]\?\d\+\.\d\+\%(e\d+\>\)\?"
+syn match fortranFormatSpec display "\d*\%(d\|q\|g\)\d\+\.\d\+\%(e\d+\)\?"
syn match fortranFormatSpec display "\d\+x\>"
" The next match cannot be used because it would pick up identifiers as well
-" syn match fortranFormatSpec display "\<\(a\|i\)\d\+"
-
+" syn match fortranFormatSpec display "\<\%(a\|i\)\d\+"
" Numbers as labels
-syn match fortranLabelNumber display "^\d\{1,5}\s"me=e-1
-syn match fortranLabelNumber display "^ \d\{1,4}\s"ms=s+1,me=e-1
-syn match fortranLabelNumber display "^ \d\{1,3}\s"ms=s+2,me=e-1
-syn match fortranLabelNumber display "^ \d\d\=\s"ms=s+3,me=e-1
-syn match fortranLabelNumber display "^ \d\s"ms=s+4,me=e-1
-
-if exists("fortran_more_precise")
- " Numbers as targets
- syn match fortranTarget display "\(\<if\s*(.\+)\s*\)\@<=\(\d\+\s*,\s*\)\{2}\d\+\>"
- syn match fortranTarget display "\(\<do\s\+\)\@11<=\d\+\>"
- syn match fortranTarget display "\(\<go\s*to\s*(\=\)\@11<=\(\d\+\s*,\s*\)*\d\+\>"
+if (b:fortran_fixed_source == 1)
+ syn match fortranLabelNumber display "^\zs\d\{1,5}\ze\s"
+ syn match fortranLabelNumber display "^ \zs\d\{1,4}\ze\s"
+ syn match fortranLabelNumber display "^ \zs\d\{1,3}\ze\s"
+ syn match fortranLabelNumber display "^ \zs\d\d\?\ze\s"
+ syn match fortranLabelNumber display "^ \zs\d\ze\s"
+else
+ syn match fortranLabelNumber display "^\s*\zs\d\{1,5}\ze\s*\a"
+ syn match fortranLabelNumberOb display "^\s*\zs\d\{1,5}\ze *end\s*\%(do\|if\)\>\ze"
endif
+" Numbers as targets
+syn match fortranTarget display "\%(\<if\s*(.\+)\s*\)\@<=\%(\d\+\s*,\s*\)\{2}\d\+\>"
+syn match fortranTargetOb display "\%(\<do\s*,\?\s*\)\@11<=\d\+\>"
+syn match fortranTarget display "\%(\<go\s*to\s*(\?\)\@11<=\%(\d\+\s*,\s*\)*\d\+\>"
-syn keyword fortranTypeR external
-syn keyword fortranIOR format
-syn match fortranKeywordR "\<continue\>"
-syn match fortranKeyword "^\s*\d\+\s\+continue\>"
+syn match fortranBoolean "\.\s*\%(true\|false\)\s*\."
+
+syn keyword fortranKeyword call use only continue allocate deallocate nullify return cycle exit contains
+syn match fortranKeyword "\<fail\s\+image\>"
+syn match fortranKeyword "\<\%(error\s\+\)\?stop\>"
syn match fortranKeyword "\<go\s*to\>"
syn match fortranKeywordDel "\<go\s*to\ze\s\+.*,\s*(.*$"
syn match fortranKeywordOb "\<go\s*to\ze\s*(\d\+.*$"
-syn region fortranStringR start=+'+ end=+'+ contains=fortranContinueMark,fortranLeftMargin,fortranSerialNumber
-syn keyword fortranIntrinsicR dim lge lgt lle llt mod
-syn keyword fortranKeywordDel assign pause
-
-syn keyword fortranStructure private public intent optional
-syn keyword fortranStructure pointer target allocatable
-syn keyword fortranStorageClass in out
-syn match fortranStorageClass "\<kind\s*="me=s+4
-syn match fortranStorageClass "\<len\s*="me=s+3
-
-syn match fortranUnitHeader "\<module\>"
-syn match fortranUnitHeader "\<submodule\>"
-syn keyword fortranUnitHeader use only contains
-syn keyword fortranUnitHeader result operator assignment
-syn match fortranUnitHeader "\<interface\>"
-syn keyword fortranKeyword allocate deallocate nullify cycle exit
-syn match fortranConditional "\<select\>"
-syn match fortranConditional "\<case\s\+default\>"
-syn keyword fortranConditional where elsewhere
-
-syn match fortranOperator "\(\(>\|<\)=\=\|==\|/=\|=\)"
-syn match fortranOperator "=>"
+syn keyword fortranKeywordDel pause
+syn match fortranKeywordDel "assign\s*\d\+\s*to\s\+\a\w*"
+syn match fortranStringDel display "[/(,] *\d\+H"
+syn region fortranString start=+'+ end=+'+ contains=fortranLeftMargin,fortranContinueMark,fortranSerialNumber
syn region fortranString start=+"+ end=+"+ contains=fortranLeftMargin,fortranContinueMark,fortranSerialNumber
-syn keyword fortranIO pad position action delim readwrite
-syn keyword fortranIO eor advance nml
-
-syn match fortranIntrinsic '\<\(adjustl\|adjustr\|all\|allocated\|any\|associated\|bit_size\|btest\|ceiling\|count\|cshift\|date_and_time\|digits\|dot_product\|eoshift\|epsilon\|exponent\|floor\|fraction\|huge\|iand\|ibclr\|ibits\|ibset\|ieor\|ior\|ishft\|ishftc\|lbound\|len_trim\|matmul\|maxexponent\|maxloc\|maxval\|merge\|minexponent\|minloc\|minval\|modulo\|mvbits\|nearest\|pack\|precision\|present\|product\|radix\|random_number\|random_seed\|range\|repeat\|reshape\|rrspacing\|scale\|scan\|selected_int_kind\|selected_real_kind\|set_exponent\|shape\|size\|spacing\|spread\|sum\|system_clock\|tiny\|transpose\|trim\|ubound\|unpack\|verify\)\>\ze\s*('
-syn match fortranIntrinsic "\<not\>\(\s*\.\)\@!"me=s+3
-syn match fortranIntrinsic "\<kind\>\s*[(,]"me=s+4
-
-syn match fortranUnitHeader "\<end\s*function"
-syn match fortranUnitHeader "\<end\s*interface"
-syn match fortranUnitHeader "\<end\s*module"
-syn match fortranUnitHeader "\<end\s*submodule"
-syn match fortranUnitHeader "\<end\s*program"
-syn match fortranUnitHeader "\<end\s*subroutine"
-syn match fortranUnitHeader "\<end\s*block"
-syn match fortranRepeat "\<end\s*do"
-syn match fortranConditional "\<end\s*where"
-syn match fortranConditional "\<select\s*case"
-syn match fortranConditional "\<end\s*select"
-syn match fortranType "\<end\s*type"
-syn match fortranType "\<in\s*out"
-
-syn keyword fortranType procedure
-syn match fortranType "\<module\ze\s\+procedure\>"
-syn keyword fortranIOR namelist
-syn keyword fortranConditionalR while
-syn keyword fortranIntrinsicR achar iachar transfer
+
+syn match fortranSpecifier '\%(\%((\|,\|, *&\n\)\s*\)\@<=\%(access\|acquired_lock\|action\|advance\|asynchronous\|blank\|decimal\|delim\|direct\|encoding\|end\|eor\|err\)\ze\s*='
+syn match fortranSpecifier '\%(\%((\|,\|, *&\n\)\s*\)\@<=\%(errmsg\|exist\|file\|fmt\|form\|formatted\|id\|iolength\|iomsg\|iostat\|leading_zero\|mold\|name\|named\)\ze\s*='
+syn match fortranSpecifier '\%(\%((\|,\|, *&\n\)\s*\)\@<=\%(new_index\|newunit\|nextrec\|nml\|notify\|number\|opened\|pad\|pending\|pos\|position\|quiet\)\ze\s*='
+syn match fortranSpecifier '\%(\%((\|,\|, *&\n\)\s*\)\@<=\%(read\|readwrite\|rec\|recl\|round\|sequential\|sign\|size\)\ze\s*='
+syn match fortranSpecifier '\%(\%((\|,\|, *&\n\)\s*\)\@<=\%(source\|stat\|status\|stream\|team\|team_number\|unformatted\|unit\|until_count\|write\)\ze\s*='
+syn match fortranSpecifier "\%((\s*\)\@<=\%(un\)\?formatted\ze\s*)"
+syn match fortranSpecifier "\%(local\|local_init\|reduce\|shared\)\ze\s*("
+syn match fortranSpecifier "\<default\s*(\s*none\s*)"
+syn keyword fortranIOR format namelist
+
+syn keyword fortranConditional else then where elsewhere
+syn match fortranConditional "\<\%(else\s*\)\?if\>"
+syn match fortranConditional "\<\%(end\s*\)\?\%(if\|where\|select\)\>"
+syn match fortranConditional "\<select\s*\%(case\|rank\|type\)\>"
+syn match fortranConditional "\<\%(case\|rank\|class\)\s\+default\>"
+syn match fortranConditional "^\s*\zs\%(case\|rank\)\ze\s\+("
+syn match fortranConditional "\<\%(class\|type\)\s\+is\>"
+syn match fortranConditionalDel "\<if\s*(.*)\s*\d\+\s*,\s*\d\+\s*,\s*\d\+\s*$"
syn keyword fortranInclude include
-syn keyword fortranStorageClassR sequence
-syn match fortranConditional "\<end\s*if"
-syn match fortranIO contains=fortranOperator "\<e\(nd\|rr\)\s*=\s*\d\+"
-syn match fortranConditional "\<else\s*if"
+syn match fortranImageControl "\<sync\s\+\%(all\|images\|memory\|team\)\>"
+syn match fortranImageControl "\<\%(change\|form\|end\)\s\+team\>"
+syn match fortranImageControl "\<event\s\+\%(post\|wait\)"
+syn match fortranImageControl "\<\%(un\)\?lock\ze\s*("
+syn match fortranImageControl "\<notify\s\+wait\ze\s*("
syn keyword fortranUnitHeaderOb entry
-syn match fortranTypeR display "double\s\+precision"
-syn match fortranTypeR display "double\s\+complex"
-syn match fortranUnitHeaderR display "block\s\+data"
-syn keyword fortranStorageClassR common equivalence data
-syn keyword fortranIntrinsicR dble dprod
-syn match fortranOperatorR "\.\s*[gl][et]\s*\."
-syn match fortranOperatorR "\.\s*\(eq\|ne\)\s*\."
-
-syn keyword fortranRepeat forall
-syn match fortranRepeat "\<end\s*forall"
-syn keyword fortranIntrinsic null cpu_time
-syn match fortranType "\<elemental\>"
-syn match fortranType "\<pure\>"
-syn match fortranType "\<impure\>"
-syn match fortranType "\<recursive\>"
-if exists("fortran_more_precise")
- syn match fortranConstructName "\(\<end\s*forall\s\+\)\@15<=\a\w*\>"
-endif
-
-if b:fortran_dialect == "f08"
- " F2003
- syn keyword fortranIntrinsic command_argument_count get_command get_command_argument get_environment_variable is_iostat_end is_iostat_eor move_alloc new_line selected_char_kind same_type_as extends_type_of
- " ISO_C_binding
- syn keyword fortranConstant c_null_char c_alert c_backspace c_form_feed c_new_line c_carriage_return c_horizontal_tab c_vertical_tab
- syn keyword fortranConstant c_int c_short c_long c_long_long c_signed_char c_size_t c_int8_t c_int16_t c_int32_t c_int64_t c_int_least8_t c_int_least16_t c_int_least32_t c_int_least64_t c_int_fast8_t c_int_fast16_t c_int_fast32_t c_int_fast64_t c_intmax_t C_intptr_t c_float c_double c_long_double c_float_complex c_double_complex c_long_double_complex c_bool c_char c_null_ptr c_null_funptr
- syn keyword fortranIntrinsic iso_c_binding c_loc c_funloc c_associated c_f_pointer c_f_procpointer
- syn keyword fortranType c_ptr c_funptr
- " ISO_Fortran_env
- syn keyword fortranConstant iso_fortran_env character_storage_size error_unit file_storage_size input_unit iostat_end iostat_eor numeric_storage_size output_unit
- " IEEE_arithmetic
- syn keyword fortranIntrinsic ieee_arithmetic ieee_support_underflow_control ieee_get_underflow_mode ieee_set_underflow_mode
-
- syn keyword fortranReadWrite flush wait
- syn keyword fortranIO decimal round iomsg
- syn keyword fortranType asynchronous nopass non_overridable pass protected volatile extends import
- syn keyword fortranType non_intrinsic value bind deferred generic final enumerator
- syn match fortranType "\<abstract\>"
- syn match fortranType "\<class\>"
- syn match fortranType "\<associate\>"
- syn match fortranType "\<end\s*associate"
- syn match fortranType "\<enum\s*,\s*bind\s*(\s*c\s*)"
- syn match fortranType "\<end\s*enum"
- syn match fortranConditional "\<select\s*type"
- syn match fortranConditional "\<class\s*is\>"
- syn match fortranConditional "\<class\s*default\>"
- syn match fortranUnitHeader "\<abstract\s*interface\>"
- syn match fortranOperator "\([\|]\)"
-
- " F2008
- syn keyword fortranIntrinsic acosh asinh atanh bessel_j0 bessel_j1 bessel_jn bessel_y0 bessel_y1 bessel_yn erf erfc erfc_scaled gamma log_gamma hypot norm2
- syn keyword fortranIntrinsic atomic_define atomic_ref execute_command_line leadz trailz storage_size merge_bits
- syn keyword fortranIntrinsic bge bgt ble blt dshiftl dshiftr findloc iall iany iparity image_index lcobound ucobound maskl maskr num_images parity popcnt poppar shifta shiftl shiftr this_image
- syn keyword fortranIO newunit
- syn keyword fortranType contiguous
- syn keyword fortranRepeat concurrent
-
-" CUDA fortran
+syn match fortranUnitHeaderOb display "\<block\s*data\>"
+
+syn keyword fortranStorageClass in out inout
+syn match fortranStorageClass '\<\%(kind\|len\)\>\ze\s*='
+syn match fortranStorageClass "^\s*data\>\ze\%(\s\+\a\)\@="
+syn match fortranStorageClassOb "\<common\>\%(\s*\%(/\|\a\)\)\@="
+syn match fortranStorageClassOb "\<equivalence\>\%(\s*(\)\@="
+
+syn keyword fortranConstant c_null_char c_alert c_backspace c_form_feed c_new_line c_carriage_return c_horizontal_tab c_vertical_tab c_ptrdiff_t
+syn keyword fortranConstant c_int c_short c_long c_long_long c_signed_char c_size_t c_int8_t c_int16_t c_int32_t c_int64_t c_int_least8_t c_int_least16_t c_int_least32_t c_int_least64_t c_int_fast8_t c_int_fast16_t c_int_fast32_t c_int_fast64_t c_intmax_t C_intptr_t c_float c_double c_long_double c_float_complex c_double_complex c_long_double_complex c_bool c_char c_null_ptr c_null_funptr
+syn keyword fortranConstant character_storage_size error_unit file_storage_size input_unit iostat_end iostat_eor numeric_storage_size output_unit stat_failed_image stat_locked stat_locked_other_image stat_stopped_image stat_unlocked stat_unlocked_failed_image
+syn keyword fortranConstant int8 int16 int32 int64 real16 real32 real64 real128 character_kinds integer_kinds logical_kinds real_kinds iostat_inquire_internal_unit initial_team current_team parent_team
+syn keyword fortranConstant ieee_invalid ieee_overflow ieee_divide_by_zero ieee_underflow ieee_inexact ieee_usual ieee_all
+syn keyword fortranConstant ieee_signaling_nan ieee_quiet_nan ieee_negative_inf ieee_negative_normal ieee_negative_subnormal
+syn keyword fortranConstant ieee_negative_zero ieee_positive_zero ieee_positive_subnormal ieee_positive_normal ieee_positive_inf
+syn keyword fortranConstant ieee_other_value ieee_negative_denormal ieee_positive_denormal ieee_negative_subnormal
+syn keyword fortranConstant ieee_positive_subnormal ieee_nearest ieee_to_zero ieee_up ieee_down ieee_away ieee_other ieee_datatype
+syn keyword fortranConstant ieee_denormal ieee_divide ieee_halting ieee_inexact_flag ieee_inf ieee_invalid_flag ieee_nan
+syn keyword fortranConstant ieee_rounding ieee_sqrt ieee_subnormal ieee_underflow_flag
+syn match fortranConstant "\.\s*nil\s*\."
+
+" CUDA Fortran
+if exists("fortran_CUDA")
syn match fortranTypeCUDA "\<attributes\>"
- syn keyword fortranTypeCUDA host global device value
+ syn keyword fortranTypeCUDA host global device
syn keyword fortranTypeCUDA shared constant pinned texture
syn keyword fortranTypeCUDA dim1 dim2 dim3 dim4
syn keyword fortranTypeCUDA cudadeviceprop cuda_count_kind cuda_stream_kind
@@ -336,10 +306,10 @@ if b:fortran_dialect == "f08"
syn keyword fortranTypeCUDA cudaErrorNotReady cudaSuccess cudaErrorInvalidValue
syn keyword fortranTypeCUDA c_devptr
- syn match fortranStringCUDA "blockidx%[xyz]"
- syn match fortranStringCUDA "blockdim%[xyz]"
- syn match fortranStringCUDA "griddim%[xyz]"
- syn match fortranStringCUDA "threadidx%[xyz]"
+ syn match fortranStringCUDA "\<blockidx%[xyz]\>"
+ syn match fortranStringCUDA "\<blockdim%[xyz]\>"
+ syn match fortranStringCUDA "\<griddim%[xyz]\>"
+ syn match fortranStringCUDA "\<threadidx%[xyz]\>"
syn keyword fortranIntrinsicCUDA warpsize syncthreads syncthreads_and syncthreads_count syncthreads_or threadfence threadfence_block threadfence_system gpu_time allthreads anythread ballot
syn keyword fortranIntrinsicCUDA atomicadd atomicsub atomicmax atomicmin atomicand atomicor atomicxor atomicexch atomicinc atomicdec atomiccas sizeof __shfl __shfl_up __shfl_down __shfl_xor
@@ -349,22 +319,21 @@ if b:fortran_dialect == "f08"
syn keyword fortranIntrinsicCUDA cudaHostAlloc cudaHostGetDevicePointer cudaHostGetFlags cudaHostRegister cudaHostUnregister cudaMalloc cudaMallocArray cudaMallocHost cudaMallocPitch cudaMalloc3D cudaMalloc3DArray
syn keyword fortranIntrinsicCUDA cudaMemcpy cudaMemcpyArraytoArray cudaMemcpyAsync cudaMemcpyFromArray cudaMemcpyFromSymbol cudaMemcpyFromSymbolAsync cudaMemcpyPeer cudaMemcpyPeerAsync cudaMemcpyToArray cudaMemcpyToSymbol cudaMemcpyToSymbolAsync cudaMemcpy2D cudaMemcpy2DArrayToArray cudaMemcpy2DAsync cudaMemcpy2DFromArray cudaMemcpy2DToArray cudaMemcpy3D cudaMemcpy3DAsync
syn keyword fortranIntrinsicCUDA cudaMemGetInfo cudaMemset cudaMemset2D cudaMemset3D cudaDeviceCanAccessPeer cudaDeviceDisablePeerAccess cudaDeviceEnablePeerAccess cudaPointerGetAttributes cudaDriverGetVersion cudaRuntimeGetVersion
-
- syn region none matchgroup=fortranType start="<<<" end=">>>" contains=ALLBUT,none
endif
+syn region none matchgroup=fortranType start="<<<" end=">>>" contains=ALLBUT,none
+
syn cluster fortranCommentGroup contains=fortranTodo
if (b:fortran_fixed_source == 1)
if !exists("fortran_have_tabs")
- " Fixed format requires a textwidth of 72 for code,
- " but some vendor extensions allow longer lines
if exists("fortran_extended_line_length")
+ " Vendor extensions allow lines with a text width of 132
syn match fortranSerialNumber excludenl "^.\{133,}$"lc=132
- elseif exists("fortran_cardimage_line_length")
- syn match fortranSerialNumber excludenl "^.\{81,}$"lc=80
else
- syn match fortranSerialNumber excludenl "^.\{73,}$"lc=72
+ " Standard requires fixed format to have a text width of 72,
+ " but all current compilers use 80 instead
+ syn match fortranSerialNumber excludenl "^.\{81,}$"lc=80
endif
"Flag left margin errors
syn match fortranLabelError "^.\{-,4}[^0-9 ]" contains=fortranTab
@@ -378,20 +347,20 @@ else
endif
syn match fortranComment excludenl "!.*$" contains=@fortranCommentGroup,@spell
-syn match fortranOpenMP excludenl "^\s*!\$\(OMP\)\=&\=\s.*$"
+syn match fortranOpenMP excludenl "^\s*\zs!\$\%(OMP\)\?&\?\s.*$"
+syn match fortranEndStatement display ";"
"cpp is often used with Fortran
-syn match cPreProc "^\s*#\s*\(define\|ifdef\)\>.*"
-syn match cPreProc "^\s*#\s*\(elif\|if\)\>.*"
-syn match cPreProc "^\s*#\s*\(ifndef\|undef\)\>.*"
-syn match cPreCondit "^\s*#\s*\(else\|endif\)\>.*"
+syn match cPreProc "^\s*#\s*\%(define\|ifdef\)\>.*"
+syn match cPreProc "^\s*#\s*\%(elif\|if\)\>.*"
+syn match cPreProc "^\s*#\s*\%(ifndef\|undef\)\>.*"
+syn match cPreCondit "^\s*#\s*\%(else\|endif\)\>.*"
syn region cIncluded contained start=+"[^("]+ skip=+\\\\\|\\"+ end=+"+ contains=fortranLeftMargin,fortranContinueMark,fortranSerialNumber
-"syn region cIncluded contained start=+"[^("]+ skip=+\\\\\|\\"+ end=+"+
syn match cIncluded contained "<[^>]*>"
syn match cInclude "^\s*#\s*include\>\s*["<]" contains=cIncluded
"Synchronising limits assume that comment and continuation lines are not mixed
-if exists("fortran_fold") || exists("fortran_more_precise")
+if exists("fortran_fold")
syn sync fromstart
elseif (b:fortran_fixed_source == 0)
syn sync linecont "&" minlines=30
@@ -401,149 +370,118 @@ endif
if exists("fortran_fold")
+ if has("folding")
+ setlocal foldmethod=syntax
+ endif
if (b:fortran_fixed_source == 1)
- syn region fortranProgram transparent fold keepend start="^\s*program\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\(program\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranModule
- syn region fortranModule transparent fold keepend start="^\s*submodule\s\+(\a\w*\s*\(:\a\w*\s*\)*)\s*\z\(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\(submodule\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranProgram,fortranModule
- syn region fortranModule transparent fold keepend start="^\s*module\s\+\(procedure\)\@!\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\(module\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranProgram
- syn region fortranFunction transparent fold keepend extend start="^\s*\(elemental \|pure \|impure \|module \|recursive \)\=\s*\(\(\(real \|integer \|logical \|complex \|double \s*precision \)\s*\((\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\|type\s\+(\s*\w\+\s*) \|character \((\(\s*len\s*=\)\=\s*\d\+\s*)\|(\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\=\s*function\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\($\|function\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule
- syn region fortranSubroutine transparent fold keepend extend start="^\s*\(elemental \|pure \|impure \|module \|recursive \)\=\s*subroutine\s\+\z(\a\w*\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\($\|subroutine\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule
- syn region fortranBlockData transparent fold keepend start="\<block\s*data\(\s\+\z(\a\w*\)\)\=" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*\($\|block\s*data\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock
- syn region fortranAssociate transparent fold keepend start="^\s*\<associate\s\+" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*associate" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction
- syn region fortranInterface transparent fold keepend extend start="^\s*\(abstract \)\=\s*interface\>" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*interface\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock
- syn region fortranTypeDef transparent fold keepend extend start="^\s*type\s*\(,\s*\(public\|private\|abstract\)\)\=\s*::" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*type\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock,fortranInterface
+ syn region fortranProgram transparent fold keepend start="^\s*program\s\+\z(\a\w*\)" skip="^\%([!c*]\|\s*#\).*$" excludenl end="\<end\s*\%(program\%(\s\+\z1\>\)\?\|$\)" contains=ALLBUT,fortranModule
+ syn region fortranModule transparent fold keepend start="^\s*submodule\s\+(\a\w*\s*\%(:\a\w*\s*\)*)\s*\z\(\a\w*\)" skip="^\%([!c*]\|\s*#\).*$" excludenl end="\<end\s*\%(submodule\%(\s\+\z1\>\)\?\|$\)" contains=ALLBUT,fortranProgram,fortranModule
+ syn region fortranModule transparent fold keepend start="^\s*module\s\+\%(procedure\)\@9!\z(\a\w*\)" skip="^\%([!c*]\|\s*#\).*$" excludenl end="\<end\s*\%(module\%(\s\+\z1\>\)\?\|$\)" contains=ALLBUT,fortranProgram
+ syn region fortranFunction transparent fold keepend extend start="\<function\s\+\z(\a\w*\)" skip="^\%([!c*]\|\s*#\).*$" excludenl end="\<end\s*\%($\|function\%(\s\+\z1\>\)\?\)" contains=ALLBUT,fortranProgram,fortranModule
+ syn region fortranSubroutine transparent fold keepend extend start="\<subroutine\s\+\z(\a\w*\)" skip="^\%([!c*]\|\s*#\).*$" excludenl end="\<end\s*\%($\|subroutine\%(\s\+\z1\>\)\?\)" contains=ALLBUT,fortranProgram,fortranModule
+ syn region fortranBlockData transparent fold keepend start="\<block\>" skip="^\%([!c*]\|\s*#\).*$" excludenl end="\<end\s*block\>" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock
+ syn region fortranAssociate transparent fold keepend start="\<associate\s\+" skip="^\%([!c*]\|\s*#\).*$" excludenl end="\<end\s*associate" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction
+ syn region fortranCritical transparent fold keepend start="\<critical\s\+" skip="^\%([!c*]\|\s*#\).*$" excludenl end="\<end\s*critical" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction
+ syn region fortranTeam transparent fold keepend start="\<change\s\+team\>" skip="^\%([!c*]\|\s*#\).*$" excludenl end="\<end\s*team\>" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction
+ syn region fortranInterface transparent fold keepend extend start="\<\%(abstract \)\?\s*interface\>" skip="^\%([!c*]\|\s*#\).*$" excludenl end="\<end\s*interface\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock
+ syn region fortranTypeDef transparent fold keepend extend start="^\s*type\s*\%(,\s*\%(abstract\|private\|public\|bind(c)\|extends(\a\w*)\)\)\{0,4}\s*::\s*\z(\a\w*\)" skip="^\%([!c*]\|\s*#\).*$" excludenl end="\<end\s*type\>\%(\s\+\z1\>\)\?" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction
+ syn region fortranMultiComments fold start="^\zs[!c*].*\_s*[!c*]" skip="^[!c*]" end='^\ze\s*[^!c*]'
else
- syn region fortranProgram transparent fold keepend start="^\s*program\s\+\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\(program\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranModule
- syn region fortranModule transparent fold keepend start="^\s*submodule\s\+(\a\w*\s*\(:\a\w*\s*\)*)\s*\z\(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\(submodule\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranProgram,fortranModule
- syn region fortranModule transparent fold keepend start="^\s*module\s\+\(procedure\)\@!\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\(module\(\s\+\z1\>\)\=\|$\)" contains=ALLBUT,fortranProgram
- syn region fortranFunction transparent fold keepend extend start="^\s*\(elemental \|pure \|impure \|module \|recursive \)\=\s*\(\(\(real \|integer \|logical \|complex \|double \s*precision \)\s*\((\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\|type\s\+(\s*\w\+\s*) \|character \((\(\s*len\s*=\)\=\s*\d\+\s*)\|(\(\s*kind\s*=\)\=\s*\w\+\s*)\)\=\)\=\s*function\s\+\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\($\|function\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule
- syn region fortranSubroutine transparent fold keepend extend start="^\s*\(elemental \|pure \|impure \|module \|recursive \)\=\s*subroutine\s\+\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\($\|subroutine\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule
- syn region fortranBlockData transparent fold keepend start="\<block\s*data\(\s\+\z(\a\w*\)\)\=" skip="^\s*[!#].*$" excludenl end="\<end\s*\($\|block\s*data\(\s\+\z1\>\)\=\)" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock
- syn region fortranAssociate transparent fold keepend start="^\s*\<associate\s\+" skip="^\s*[!#].*$" excludenl end="\<end\s*associate" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction
- syn region fortranInterface transparent fold keepend extend start="^\s*\(abstract \)\=\s*interface\>" skip="^\s*[!#].*$" excludenl end="\<end\s*interface\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock
- syn region fortranTypeDef transparent fold keepend extend start="^\s*type\s*\(,\s*\(public\|private\|abstract\)\)\=\s*::" skip="^\s*[!#].*$" excludenl end="\<end\s*type\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock,fortranInterface
+ syn region fortranProgram transparent fold keepend start="^\s*program\s\+\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\%(program\%(\s\+\z1\>\)\?\|$\)" contains=ALLBUT,fortranModule
+ syn region fortranModule transparent fold keepend start="^\s*submodule\s\+(\a\w*\s*\%(:\a\w*\s*\)*)\s*\z\(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\%(submodule\%(\s\+\z1\>\)\?\|$\)" contains=ALLBUT,fortranProgram,fortranModule
+ syn region fortranModule transparent fold keepend start="^\s*module\s\+\%(procedure\)\@9!\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\%(module\%(\s\+\z1\>\)\?\|$\)" contains=ALLBUT,fortranProgram
+ syn region fortranFunction transparent fold keepend extend start="\<function\s\+\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\%($\|function\%(\s\+\z1\>\)\?\)" contains=ALLBUT,fortranProgram,fortranModule
+ syn region fortranSubroutine transparent fold keepend extend start="\<subroutine\s\+\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*\%($\|subroutine\%(\s\+\z1\>\)\?\)" contains=ALLBUT,fortranProgram,fortranModule
+ syn region fortranBlockData transparent fold keepend start="\<block\>" skip="^\s*[!#].*$" excludenl end="\<end\s*block\>" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock
+ syn region fortranAssociate transparent fold keepend start="\<associate\>" skip="^\s*[!#].*$" excludenl end="\<end\s*associate\>" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction
+ syn region fortranCritical transparent fold keepend start="\<critical\>" skip="^\s*[!#].*$" excludenl end="\<end\s*critical\>" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction
+ syn region fortranTeam transparent fold keepend start="\<change\s\+team\>" skip="^\s*[!#].*$" excludenl end="\<end\s*team\>" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction
+ syn region fortranInterface transparent fold keepend extend start="\<\%(abstract \)\?\s*interface\>" skip="^\s*[!#].*$" excludenl end="\<end\s*interface\>" contains=ALLBUT,fortranProgram,fortranModule,fortran77Loop,fortranCase,fortran90Loop,fortranIfBlock
+ syn region fortranTypeDef transparent fold keepend extend start="^\s*type\s*\%(,\s*\%(abstract\|private\|public\|bind(c)\|extends(\a\w*)\)\)\{0,4}\s*::\s*\z(\a\w*\)" skip="^\s*[!#].*$" excludenl end="\<end\s*type\>\%(\s\+\z1\>\)\?" contains=ALLBUT,fortranProgram,fortranModule,fortranSubroutine,fortranFunction
+ syn region fortranMultiComments fold start="^\zs\s*!.*\_s*!" skip="^\s*!" end='^\ze\s*[^!]'
endif
if exists("fortran_fold_conditionals")
if (b:fortran_fixed_source == 1)
- syn region fortran77Loop transparent fold keepend start="\<do\s\+\z(\d\+\)" end="^\s*\z1\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
- syn region fortran90Loop transparent fold keepend extend start="\(\<end\s\+\)\@<!\<do\(\s\+\a\|\s*$\)" skip="^\([!c*]\|\s*#\).*$" excludenl end="\<end\s*do\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
- syn region fortranIfBlock transparent fold keepend extend start="\(\<e\(nd\|lse\)\s\+\)\@<!\<if\s*(.\+)\s*then\>" skip="^\([!c*]\|\s*#\).*$" end="\<end\s*if\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
- syn region fortranCase transparent fold keepend extend start="\<select\s*\(case\|type\)\>" skip="^\([!c*]\|\s*#\).*$" end="\<end\s*select\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
+ syn region fortran77Loop transparent fold keepend start="\<do\s\+\z(\d\+\)" end="^\s*\z1\>" contains=ALLBUT,fortranUnitHeader,fortranAttribute,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
+ syn region fortran90Loop transparent fold keepend extend start="\%(\<end\s\+\)\@5<!\<do\%(\s\+\a\|\s*$\)" skip="^\%([!c*]\|\s*#\).*$" excludenl end="\<end\s*do\>" contains=ALLBUT,fortranUnitHeader,fortranAttribute,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
+ syn region fortranIfBlock transparent fold keepend extend start="\%(\<e\%(nd\|lse\)\s\+\)\@6<!\<if\s*(.\+)\s*then\>" skip="^\%([!c*]\|\s*#\).*$" end="\<end\s*if\>" contains=ALLBUT,fortranUnitHeader,fortranAttribute,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
+ syn region fortranCase transparent fold keepend extend start="\<select\s*\%(case\|type\|rank\)\>" skip="^\%([!c*]\|\s*#\).*$" end="\<end\s*select\>" contains=ALLBUT,fortranUnitHeader,fortranAttribute,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
else
- syn region fortran77Loop transparent fold keepend start="\<do\s\+\z(\d\+\)" end="^\s*\z1\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
- syn region fortran90Loop transparent fold keepend extend start="\(\<end\s\+\)\@<!\<do\(\s\+\a\|\s*$\)" skip="^\s*[!#].*$" excludenl end="\<end\s*do\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
- syn region fortranIfBlock transparent fold keepend extend start="\(\<e\(nd\|lse\)\s\+\)\@<!\<if\s*(\(.\|&\s*\n\)\+)\(\s\|&\s*\n\)*then\>" skip="^\s*[!#].*$" end="\<end\s*if\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
- syn region fortranCase transparent fold keepend extend start="\<select\s*\(case\|type\)\>" skip="^\s*[!#].*$" end="\<end\s*select\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
+ syn region fortran77Loop transparent fold keepend start="\<do\s\+\z(\d\+\)" end="^\s*\z1\>" contains=ALLBUT,fortranUnitHeader,fortranAttribute,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
+ syn region fortran90Loop transparent fold keepend extend start="\%(\<end\s\+\)\@5<!\<do\%(\s\+\a\|\s*$\)" skip="^\s*[!#].*$" excludenl end="\<end\s*do\>" contains=ALLBUT,fortranUnitHeader,fortranAttribute,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
+ syn region fortranIfBlock transparent fold keepend extend start="\%(\<e\%(nd\|lse\)\s\+\)\@6<!\<if\s*(\%(.\|&\s*\n\)\+)\%(\s\|&\s*\n\)*then\>" skip="^\s*[!#].*$" end="\<end\s*if\>" contains=ALLBUT,fortranUnitHeader,fortranAttribute,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
+ syn region fortranCase transparent fold keepend extend start="\<select\s*\%(case\|type\|rank\)\>" skip="^\s*[!#].*$" end="\<end\s*select\>" contains=ALLBUT,fortranUnitHeader,fortranAttribute,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
endif
endif
- if exists("fortran_fold_multilinecomments")
- if (b:fortran_fixed_source == 1)
- syn match fortranMultiLineComments transparent fold "\(^[!c*].*\(\n\|\%$\)\)\{4,}" contains=ALLBUT,fortranMultiCommentLines
- else
- syn match fortranMultiLineComments transparent fold "\(^\s*!.*\(\n\|\%$\)\)\{4,}" contains=ALLBUT,fortranMultiCommentLines
- endif
- endif
endif
" Define the default highlighting.
-" The default highlighting differs for each dialect.
-" Transparent groups:
-" fortranParen, fortranLeftMargin
-" fortranProgram, fortranModule, fortranSubroutine, fortranFunction,
-" fortranBlockData
-" fortran77Loop, fortran90Loop, fortranIfBlock, fortranCase
-" fortranMultiCommentLines
-hi def link fortranKeyword Keyword
+hi def link fortranBoolean Boolean
+hi def link fortranComment Comment
+hi def link fortranMultiComments Comment
+hi def link fortranBlock Conditional
+hi def link fortranConditional Conditional
+hi def link fortranConstant Constant
+hi def link fortranConditionalDel Error
+hi def link fortranKeywordDel Error
+hi def link fortranLabelError Error
+hi def link fortranParenError Error
+hi def link fortranStringDel Error
+hi def link fortranTab Error
+hi def link fortranFloat Float
+hi def link fortranFloatIll Float
+hi def link fortranCalled Function
+hi def link fortranIntrinsic Function
+hi def link fortranIntrinsicCUDA Function
+hi def link fortranIntrinsicR Function
+hi def link fortranIntrinsicVen Function
+hi def link fortranUnitName Function
hi def link fortranConstructName Identifier
-hi def link fortranConditional Conditional
-hi def link fortranRepeat Repeat
-hi def link fortranTodo Todo
-hi def link fortranContinueMark Special
-hi def link fortranString String
-hi def link fortranNumber Number
-hi def link fortranBinary Number
-hi def link fortranOctal Number
-hi def link fortranHex Number
-hi def link fortranOperator Operator
-hi def link fortranBoolean Boolean
-hi def link fortranLabelError Error
-hi def link fortranObsolete Todo
-hi def link fortranType Type
-hi def link fortranStructure Type
-hi def link fortranStorageClass StorageClass
-hi def link fortranCall Function
-hi def link fortranUnitHeader fortranPreCondit
-hi def link fortranReadWrite Keyword
-hi def link fortranIO Keyword
-hi def link fortranIntrinsic Function
-hi def link fortranConstant Constant
-
-" To stop deleted & obsolescent features being highlighted as Todo items,
-" comment out the next 5 lines and uncomment the 5 lines after that
-hi def link fortranUnitHeaderOb fortranObsolete
-hi def link fortranKeywordOb fortranObsolete
-hi def link fortranConditionalOb fortranObsolete
-hi def link fortranTypeOb fortranObsolete
-hi def link fortranKeywordDel fortranObsolete
-"hi def link fortranUnitHeaderOb fortranUnitHeader
-"hi def link fortranKeywordOb fortranKeyword
-"hi def link fortranConditionalOb fortranConditional
-"hi def link fortranTypeOb fortranType
-"hi def link fortranKeywordDel fortranKeyword
-
-if b:fortran_dialect == "F"
- hi! def link fortranIntrinsicR fortranObsolete
- hi! def link fortranUnitHeaderR fortranObsolete
- hi! def link fortranTypeR fortranObsolete
- hi! def link fortranStorageClassR fortranObsolete
- hi! def link fortranOperatorR fortranObsolete
- hi! def link fortranInclude fortranObsolete
- hi! def link fortranLabelNumber fortranObsolete
- hi! def link fortranTarget fortranObsolete
- hi! def link fortranFloatIll fortranObsolete
- hi! def link fortranIOR fortranObsolete
- hi! def link fortranKeywordR fortranObsolete
- hi! def link fortranStringR fortranObsolete
- hi! def link fortranConditionalR fortranObsolete
-else
- hi! def link fortranIntrinsicR fortranIntrinsic
- hi! def link fortranUnitHeaderR fortranPreCondit
- hi! def link fortranTypeR fortranType
- hi! def link fortranStorageClassR fortranStorageClass
- hi! def link fortranOperatorR fortranOperator
- hi! def link fortranInclude Include
- hi! def link fortranLabelNumber Special
- hi! def link fortranTarget Special
- hi! def link fortranFloatIll fortranFloat
- hi! def link fortranIOR fortranIO
- hi! def link fortranKeywordR fortranKeyword
- hi! def link fortranStringR fortranString
- hi! def link fortranConditionalR fortranConditional
-endif
-
-hi def link fortranFormatSpec Identifier
-hi def link fortranFloat Float
-hi def link fortranPreCondit PreCondit
-hi def link cIncluded fortranString
-hi def link cInclude Include
-hi def link cPreProc PreProc
-hi def link cPreCondit PreCondit
-hi def link fortranOpenMP PreProc
-hi def link fortranParenError Error
-hi def link fortranComment Comment
-hi def link fortranSerialNumber Todo
-hi def link fortranTab Error
-
-if exists("fortran_CUDA")
- hi def link fortranIntrinsicCUDA fortranIntrinsic
- hi def link fortranTypeCUDA fortranType
- hi def link fortranStringCUDA fortranString
-endif
-
-if exists("fortran_vendor_intrinsics")
- hi def link fortranExtraIntrinsic Function
-endif
+hi def link fortranFormatSpec Identifier
+hi def link cInclude Include
+hi def link fortranInclude Include
+hi def link fortranIOR Keyword
+hi def link fortranImageControl Keyword
+hi def link fortranKeyword Keyword
+hi def link fortranReadWrite Keyword
+hi def link fortranSpecifier Keyword
+hi def link fortranBinary Number
+hi def link fortranHex Number
+hi def link fortranNumber Number
+hi def link fortranBinary Number
+hi def link fortranOctal Number
+hi def link fortranOperator Operator
+hi def link fortranOperatorR Operator
+hi def link cPreCondit PreCondit
+hi def link fortranUnitHeader PreCondit
+hi def link fortranOpenMP PreProc
+hi def link cPreProc PreProc
+hi def link fortranRepeat Repeat
+hi def link fortranRepeatR Repeat
+hi def link fortranContinueMark Special
+hi def link fortranEndStatement Special
+hi def link fortranLabelNumber Special
+hi def link fortranTarget Special
+hi def link fortranStorageClass StorageClass
+hi def link cIncluded String
+hi def link fortranString String
+hi def link fortranStringCUDA String
+hi def link fortranIntrinsicOb Todo
+hi def link fortranKeywordOb Todo
+hi def link fortranLabelNumberOb Todo
+hi def link fortranRepeatOb Todo
+hi def link fortranSerialNumber Todo
+hi def link fortranStorageClassOb Todo
+hi def link fortranTargetOb Todo
+hi def link fortranTodo Todo
+hi def link fortranTypeOb Todo
+hi def link fortranUnitHeaderOb Todo
+hi def link fortranAttribute Type
+hi def link fortranType Type
+hi def link fortranTypeCUDA Type
+hi def link fortranTypeR Type
let b:current_syntax = "fortran"
diff --git a/runtime/syntax/git.vim b/runtime/syntax/git.vim
index bf013ce195..51eb8127dd 100644
--- a/runtime/syntax/git.vim
+++ b/runtime/syntax/git.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: generic git output
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
-" Last Change: 2022 Jan 05
+" Last Change: 2023 Dec 28
if exists("b:current_syntax")
finish
@@ -38,7 +38,7 @@ syn match gitReflog /^\x\{40,\} \x\{40,\} .\{-\}\d\+\s-\d\{4\}\t.*/ skipwhite c
syn region gitDiff start=/^\%(diff --git \)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff fold
syn region gitDiff start=/^\%(@@ -\)\@=/ end=/^\%(diff --\%(git\|cc\|combined\) \|$\)\@=/ contains=@gitDiff
-syn region gitDiffMerge start=/^\%(diff --\%(cc\|combined\) \)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff
+syn region gitDiffMerge start=/^\%(diff --\%(cc\|combined\) \)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff fold
syn region gitDiffMerge start=/^\%(@@@@* -\)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff
syn match gitDiffAdded "^ \++.*" contained containedin=gitDiffMerge
syn match gitDiffAdded "{+[^}]*+}" contained containedin=gitDiff
diff --git a/runtime/syntax/gitcommit.vim b/runtime/syntax/gitcommit.vim
index 42c8d4414f..bce6772762 100644
--- a/runtime/syntax/gitcommit.vim
+++ b/runtime/syntax/gitcommit.vim
@@ -2,7 +2,7 @@
" Language: git commit file
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Filenames: *.git/COMMIT_EDITMSG
-" Last Change: 2022 Jan 05
+" Last Change: 2023 Dec 28
if exists("b:current_syntax")
finish
@@ -21,7 +21,11 @@ endif
syn include @gitcommitDiff syntax/diff.vim
syn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^\%(diff --\|$\|@@\@!\|[^[:alnum:]\ +-]\S\@!\)\@=/ fold contains=@gitcommitDiff
-syn match gitcommitSummary "^.*\%<51v." contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell
+if get(g:, 'gitcommit_summary_length') < 0
+ syn match gitcommitSummary "^.*$" contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell
+elseif get(g:, 'gitcommit_summary_length', 1) > 0
+ exe 'syn match gitcommitSummary "^.*\%<' . (get(g:, 'gitcommit_summary_length', 50) + 1) . 'v." contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell'
+endif
syn match gitcommitOverflow ".*" contained contains=@Spell
syn match gitcommitBlank "^.\+" contained contains=@Spell
syn match gitcommitFirstLine "\%^.*" nextgroup=gitcommitBlank,gitcommitComment skipnl
diff --git a/runtime/syntax/go.vim b/runtime/syntax/go.vim
index 4272e807f3..ba776f949c 100644
--- a/runtime/syntax/go.vim
+++ b/runtime/syntax/go.vim
@@ -5,7 +5,7 @@
" go.vim: Vim syntax file for Go.
" Language: Go
" Maintainer: Billie Cleek <bhcleek@gmail.com>
-" Latest Revision: 2023-08-21
+" Latest Revision: 2024-01-21
" License: BSD-style. See LICENSE file in source repository.
" Repository: https://github.com/fatih/vim-go
@@ -230,21 +230,31 @@ endif
" import
if s:FoldEnable('import')
syn region goImport start='import (' end=')' transparent fold contains=goImport,goImportString,goComment
+ syn match goImport /^import ()/ transparent fold contains=goImport
else
syn region goImport start='import (' end=')' transparent contains=goImport,goImportString,goComment
+ syn match goImport /^import ()/ transparent contains=goImport
endif
" var, const
if s:FoldEnable('varconst')
syn region goVar start='var (' end='^\s*)$' transparent fold
- \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
+ \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
+ syn match goVar /var ()/ transparent fold
+ \ contains=goVar
syn region goConst start='const (' end='^\s*)$' transparent fold
- \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
+ \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
+ syn match goConst /const ()/ transparent fold
+ \ contains=goConst
else
syn region goVar start='var (' end='^\s*)$' transparent
- \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
+ \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
+ syn match goVar /var ()/ transparent
+ \ contains=goVar
syn region goConst start='const (' end='^\s*)$' transparent
- \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
+ \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
+ syn match goConst /const ()/ transparent
+ \ contains=goConst
endif
" Single-line var, const, and import.
diff --git a/runtime/syntax/gpg.vim b/runtime/syntax/gpg.vim
index c7f3584ff0..f132a52705 100644
--- a/runtime/syntax/gpg.vim
+++ b/runtime/syntax/gpg.vim
@@ -1,9 +1,13 @@
" Vim syntax file
" Language: gpg(1) configuration file
+" Maintainer: This runtime file is looking for a maintainer.
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2010-10-14
-" Updated: 2023-01-23 @ObserverOfTime: added a couple of keywords
+" Latest Revision: 2024-02-11
+" Updated:
+" 2023-01-23 @ObserverOfTime: added a couple of keywords
" 2023-03-21 Todd Zullinger <tmz@pobox.com>: sync with gnupg-2.4.0
+" 2024-02-10 Daniel Kahn Gillmor <dkg@fifthhorseman.net>:
+" mark use-embedded-filename as warning for security reasons
if exists("b:current_syntax")
finish
@@ -21,7 +25,7 @@ syn region gpgComment contained display oneline start='#' end='$'
syn match gpgID contained display '\<\(0x\)\=\x\{8,}\>'
-syn match gpgBegin display '^' skipwhite nextgroup=gpgComment,gpgOption,gpgCommand
+syn match gpgBegin display '^' skipwhite nextgroup=gpgComment,gpgOption,gpgOptionDeprecated,gpgCommand
syn keyword gpgCommand contained skipwhite nextgroup=gpgArg
\ change-passphrase check-sig check-signatures
@@ -41,6 +45,7 @@ syn keyword gpgCommand contained skipwhite nextgroup=gpgArg
\ quick-set-expire quick-set-primary-uid quick-sign-key
\ quick-update-pref receive-keys recv-keys refresh-keys
\ search-keys show-key show-keys sign-key tofu-policy
+
syn keyword gpgCommand contained skipwhite nextgroup=gpgArgError
\ card-edit card-status change-pin check-trustdb
\ clear-sign clearsign dearmor dearmour decrypt
@@ -97,6 +102,7 @@ syn keyword gpgOption contained skipwhite nextgroup=gpgArg
\ trusted-key trust-model try-secret-key ttyname
\ ttytype ungroup user verify-options weak-digest
\ xauthority
+
syn keyword gpgOption contained skipwhite nextgroup=gpgArgError
\ allow-freeform-uid allow-multiple-messages
\ allow-multisig-verification allow-non-selfsigned-uid
@@ -145,7 +151,7 @@ syn keyword gpgOption contained skipwhite nextgroup=gpgArgError
\ no-sk-comments no-skip-hidden-recipients
\ no-symkey-cache not-dash-escaped no-textmode
\ no-throw-keyids no-tty no-use-agent
- \ no-use-embedded-filename no-utf8-strings no-verbose
+ \ no-utf8-strings no-verbose
\ no-version only-sign-text-ids openpgp
\ override-compliance-check pgp6 pgp7 pgp8
\ preserve-permissions print-dane-records quiet
@@ -155,7 +161,7 @@ syn keyword gpgOption contained skipwhite nextgroup=gpgArgError
\ show-notation show-photos show-policy-url
\ show-session-key sk-comments skip-hidden-recipients
\ skip-verify textmode throw-keyids try-all-secrets
- \ unwrap use-agent use-embedded-filename use-keyboxd
+ \ unwrap use-agent use-keyboxd
\ use-only-openpgp-card utf8-strings verbose version
\ warranty with-colons with-fingerprint
\ with-icao-spelling with-key-data with-keygrip
@@ -164,6 +170,10 @@ syn keyword gpgOption contained skipwhite nextgroup=gpgArgError
\ with-subkey-fingerprints with-tofu-info with-wkd-hash
\ yes
+" depcrated for security reasons
+syn keyword gpgOptionDeprecated contained skipwhite nextgroup=gpgArgError
+ \ use-embedded-filename no-use-embedded-filename
+
syn match gpgArg contained display '\S\+\(\s\+\S\+\)*' contains=gpgID
syn match gpgArgError contained display '\S\+\(\s\+\S\+\)*'
@@ -171,6 +181,7 @@ hi def link gpgComment Comment
hi def link gpgTodo Todo
hi def link gpgID Number
hi def link gpgOption Keyword
+hi def link gpgOptionDeprecated WarningMsg
hi def link gpgCommand Error
hi def link gpgArgError Error
diff --git a/runtime/syntax/help.vim b/runtime/syntax/help.vim
index f1e650b2fb..fced5e7dd1 100644
--- a/runtime/syntax/help.vim
+++ b/runtime/syntax/help.vim
@@ -136,6 +136,10 @@ syn match helpTodo "\t[* ]Todo\t\+[a-z].*"
syn match helpURL `\v<(((https?|ftp|gopher)://|(mailto|file|news):)[^' <>"]+|(www|web|w3)[a-z0-9_-]*\.[a-z0-9._-]+\.[^' <>"]+)[a-zA-Z0-9/]`
+syn match helpDiffAdded "\t[* ]Added\t\+[a-z].*"
+syn match helpDiffChanged "\t[* ]Changed\t\+[a-z].*"
+syn match helpDiffRemoved "\t[* ]Removed\t\+[a-z].*"
+
" Additionally load a language-specific syntax file "help_ab.vim".
let s:i = match(expand("%"), '\.\a\ax$')
if s:i > 0
@@ -209,6 +213,9 @@ hi def link helpUnderlined Underlined
hi def link helpError Error
hi def link helpTodo Todo
hi def link helpURL String
+hi def link helpDiffAdded Added
+hi def link helpDiffChanged Changed
+hi def link helpDiffRemoved Removed
let b:current_syntax = "help"
diff --git a/runtime/syntax/html.vim b/runtime/syntax/html.vim
index 82c829a2e1..c975ae8620 100644
--- a/runtime/syntax/html.vim
+++ b/runtime/syntax/html.vim
@@ -3,9 +3,9 @@
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainers: Jorge Maldonado Ventura <jorgesumle@freakspot.net>
" Claudio Fleiner <claudio@fleiner.com>
-" Last Change: 2023 Feb 20
+" Last Change: 2023 Nov 28
-" Please check :help html.vim for some comments and a description of the options
+" See :help html.vim for some comments and a description of the options
" quit when a syntax file was already loaded
if !exists("main_syntax")
@@ -28,7 +28,6 @@ syn case ignore
" mark illegal characters
syn match htmlError "[<>&]"
-
" tags
syn region htmlString contained start=+"+ end=+"+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc
syn region htmlString contained start=+'+ end=+'+ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc
@@ -39,7 +38,6 @@ syn match htmlTagN contained +<\s*[-a-zA-Z0-9]\++hs=s+1 contains=htmlTagName,
syn match htmlTagN contained +</\s*[-a-zA-Z0-9]\++hs=s+2 contains=htmlTagName,htmlSpecialTagName,@htmlTagNameCluster
syn match htmlTagError contained "[^>]<"ms=s+1
-
" tag names
syn keyword htmlTagName contained address applet area a base basefont
syn keyword htmlTagName contained big blockquote br caption center
@@ -61,7 +59,7 @@ syn keyword htmlTagName contained article aside audio bdi canvas data
syn keyword htmlTagName contained datalist details dialog embed figcaption
syn keyword htmlTagName contained figure footer header hgroup keygen main
syn keyword htmlTagName contained mark menuitem meter nav output picture
-syn keyword htmlTagName contained progress rb rp rt rtc ruby section
+syn keyword htmlTagName contained progress rb rp rt rtc ruby search section
syn keyword htmlTagName contained slot source summary template time track
syn keyword htmlTagName contained video wbr
@@ -88,19 +86,72 @@ syn keyword htmlArg contained size src start target text type url
syn keyword htmlArg contained usemap ismap valign value vlink vspace width wrap
syn match htmlArg contained "\<\%(http-equiv\|href\|title\)="me=e-1
-" aria attributes
-exe 'syn match htmlArg contained "\<aria-\%(' . join([
- \ 'activedescendant', 'atomic', 'autocomplete', 'busy', 'checked', 'colcount',
- \ 'colindex', 'colspan', 'controls', 'current', 'describedby', 'details',
- \ 'disabled', 'dropeffect', 'errormessage', 'expanded', 'flowto', 'grabbed',
- \ 'haspopup', 'hidden', 'invalid', 'keyshortcuts', 'label', 'labelledby', 'level',
- \ 'live', 'modal', 'multiline', 'multiselectable', 'orientation', 'owns',
- \ 'placeholder', 'posinset', 'pressed', 'readonly', 'relevant', 'required',
- \ 'roledescription', 'rowcount', 'rowindex', 'rowspan', 'selected', 'setsize',
- \ 'sort', 'valuemax', 'valuemin', 'valuenow', 'valuetext'
- \ ], '\|') . '\)\>"'
syn keyword htmlArg contained role
+" ARIA attributes {{{1
+let s:aria =<< trim END
+ activedescendant
+ atomic
+ autocomplete
+ braillelabel
+ brailleroledescription
+ busy
+ checked
+ colcount
+ colindex
+ colindextext
+ colspan
+ controls
+ current
+ describedby
+ description
+ details
+ disabled
+ errormessage
+ expanded
+ flowto
+ haspopup
+ hidden
+ invalid
+ keyshortcuts
+ label
+ labelledby
+ level
+ live
+ modal
+ multiline
+ multiselectable
+ orientation
+ owns
+ placeholder
+ posinset
+ pressed
+ readonly
+ relevant
+ required
+ roledescription
+ rowcount
+ rowindex
+ rowindextext
+ rowspan
+ selected
+ setsize
+ sort
+ valuemax
+ valuemin
+ valuenow
+ valuetext
+END
+let s:aria_deprecated =<< trim END
+ dropeffect
+ grabbed
+END
+
+call extend(s:aria, s:aria_deprecated)
+exe 'syn match htmlArg contained "\%#=1\<aria-\%(' .. s:aria->join('\|') .. '\)\>"'
+unlet s:aria s:aria_deprecated
+" }}}
+
" Netscape extensions
syn keyword htmlTagName contained frame noframes frameset nobr blink
syn keyword htmlTagName contained layer ilayer nolayer spacer
@@ -321,9 +372,9 @@ if !exists("html_no_rendering")
hi def htmlUnderlineItalic term=italic,underline cterm=italic,underline gui=italic,underline
hi def htmlItalic term=italic cterm=italic gui=italic
if v:version > 800 || v:version == 800 && has("patch1038")
- hi def htmlStrike term=strikethrough cterm=strikethrough gui=strikethrough
+ hi def htmlStrike term=strikethrough cterm=strikethrough gui=strikethrough
else
- hi def htmlStrike term=underline cterm=underline gui=underline
+ hi def htmlStrike term=underline cterm=underline gui=underline
endif
endif
endif
@@ -356,4 +407,5 @@ endif
let &cpo = s:cpo_save
unlet s:cpo_save
-" vim: ts=8
+
+" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:
diff --git a/runtime/syntax/i3config.vim b/runtime/syntax/i3config.vim
index d4512525f9..8131639a11 100644
--- a/runtime/syntax/i3config.vim
+++ b/runtime/syntax/i3config.vim
@@ -2,8 +2,8 @@
" Language: i3 config file
" Original Author: Josef Litos (JosefLitos/i3config.vim)
" Maintainer: Quentin Hibon (github user hiqua)
-" Version: 1.0.0
-" Last Change: 2023-11-11
+" Version: 1.0.2
+" Last Change: 2023-12-28
" References:
" http://i3wm.org/docs/userguide.html#configuring
@@ -137,8 +137,7 @@ syn match i3ConfigIpcKeyword /ipc-socket/ contained
syn match i3ConfigParamLine /^ipc-socket .*$/ contains=i3ConfigIpcKeyword
" 4.24 Focus follows mouse
-syn keyword i3ConfigFocusFollowsMouseOpts always contained
-syn match i3ConfigKeyword /^focus_follows_mouse \(yes\|no\|always\)$/ contains=i3ConfigBoolean,i3ConfigFocusFollowsMouseOpts
+syn match i3ConfigKeyword /^focus_follows_mouse \(yes\|no\)$/ contains=i3ConfigBoolean
" 4.25 Mouse warping
syn keyword i3ConfigMouseWarpingOpts output container none contained
@@ -298,7 +297,6 @@ hi def link i3ConfigWorkspaceDir i3ConfigOption
hi def link i3ConfigDotOperator i3ConfigOperator
hi def link i3ConfigClientOpts i3ConfigOption
hi def link i3ConfigIpcKeyword i3ConfigKeyword
-hi def link i3ConfigFocusFollowsMouseOpts i3ConfigOption
hi def link i3ConfigMouseWarpingOpts i3ConfigOption
hi def link i3ConfigPopupFullscreenOpts i3ConfigOption
hi def link i3ConfigFocusWrappingOpts i3ConfigOption
diff --git a/runtime/syntax/java.vim b/runtime/syntax/java.vim
index 00d6071944..f6d2660277 100644
--- a/runtime/syntax/java.vim
+++ b/runtime/syntax/java.vim
@@ -2,7 +2,7 @@
" Language: Java
" Maintainer: Claudio Fleiner <claudio@fleiner.com>
" URL: https://github.com/fleiner/vim/blob/master/runtime/syntax/java.vim
-" Last Change: 2022 Jun 08
+" Last Change: 2024 Mar 02
" Please check :help java.vim for comments on some of the options available.
@@ -37,6 +37,14 @@ syn keyword javaBoolean true false
syn keyword javaConstant null
syn keyword javaTypedef this super
syn keyword javaOperator var new instanceof
+" Since the yield statement, which could take a parenthesised operand,
+" and _qualified_ yield methods get along within the switch block
+" (JLS-17, §3.8), it seems futile to make a region definition for this
+" block; instead look for the _yield_ word alone, and if found,
+" backtrack (arbitrarily) 80 bytes, at most, on the matched line and,
+" if necessary, on the line before that (h: \@<=), trying to match
+" neither a method reference nor a qualified method invocation.
+syn match javaOperator "\%(\%(::\|\.\)[[:space:]\n]*\)\@80<!\<yield\>"
syn keyword javaType boolean char byte short int long float double
syn keyword javaType void
syn keyword javaStatement return
@@ -56,6 +64,7 @@ syn keyword javaBranch break continue nextgroup=javaUserLabelRef skipwhite
syn match javaUserLabelRef "\k\+" contained
syn match javaVarArg "\.\.\."
syn keyword javaScopeDecl public protected private abstract
+syn match javaConceptKind "\<default\>\%(\s*\%(:\|->\)\)\@!"
function s:isModuleInfoDeclarationCurrentBuffer() abort
return fnamemodify(bufname("%"), ":t") =~ '^module-info\%(\.class\>\)\@!'
@@ -142,28 +151,46 @@ if exists("java_space_errors")
endif
endif
-syn region javaLabelRegion transparent matchgroup=javaLabel start="\<case\>" end="->" matchgroup=NONE end=":" contains=javaNumber,javaCharacter,javaString
-syn match javaUserLabel "^\s*[_$a-zA-Z][_$a-zA-Z0-9_]*\s*:"he=e-1 contains=javaLabel
-syn keyword javaLabel default
+syn match javaUserLabel "^\s*\<\K\k*\>\%(\<default\>\)\@<!\s*:"he=e-1
+syn region javaLabelRegion transparent matchgroup=javaLabel start="\<case\>" matchgroup=NONE end=":\|->" contains=javaLabelCastType,javaLabelNumber,javaCharacter,javaString,javaConstant,@javaClasses,javaLabelDefault,javaLabelVarType,javaLabelWhenClause
+syn region javaLabelRegion transparent matchgroup=javaLabel start="\<default\>\%(\s*\%(:\|->\)\)\@=" matchgroup=NONE end=":\|->" oneline
+" Consider grouped _default_ _case_ labels, i.e.
+" case null, default ->
+" case null: default:
+syn keyword javaLabelDefault contained default
+syn keyword javaLabelVarType contained var
+syn keyword javaLabelCastType contained char byte short int
+" Allow for the contingency of the enclosing region not being able to
+" _keep_ its _end_, e.g. case ':':.
+syn region javaLabelWhenClause contained transparent matchgroup=javaLabel start="\<when\>" matchgroup=NONE end=":"me=e-1 end="->"me=e-2 contains=TOP,javaExternal
+syn match javaLabelNumber contained "\<0\>[lL]\@!"
+syn match javaLabelNumber contained "\<\%(0\%([xX]\x\%(_*\x\)*\|_*\o\%(_*\o\)*\|[bB][01]\%(_*[01]\)*\)\|[1-9]\%(_*\d\)*\)\>[lL]\@!"
+hi def link javaLabelDefault javaLabel
+hi def link javaLabelVarType javaOperator
+hi def link javaLabelNumber javaNumber
+hi def link javaLabelCastType javaType
" highlighting C++ keywords as errors removed, too many people find it
" annoying. Was: if !exists("java_allow_cpp_keywords")
" The following cluster contains all java groups except the contained ones
-syn cluster javaTop add=javaExternal,javaError,javaBranch,javaLabelRegion,javaLabel,javaConditional,javaRepeat,javaBoolean,javaConstant,javaTypedef,javaOperator,javaType,javaStatement,javaStorageClass,javaAssert,javaExceptions,javaMethodDecl,javaClassDecl,javaScopeDecl,javaError2,javaUserLabel,javaLangObject,javaAnnotation,javaVarArg
+syn cluster javaTop add=javaExternal,javaError,javaBranch,javaLabelRegion,javaConditional,javaRepeat,javaBoolean,javaConstant,javaTypedef,javaOperator,javaType,javaStatement,javaStorageClass,javaAssert,javaExceptions,javaMethodDecl,javaClassDecl,javaScopeDecl,javaConceptKind,javaError2,javaUserLabel,javaLangObject,javaAnnotation,javaVarArg
" Comments
syn keyword javaTodo contained TODO FIXME XXX
+
if exists("java_comment_strings")
syn region javaCommentString contained start=+"+ end=+"+ end=+$+ end=+\*/+me=s-1,he=s-1 contains=javaSpecial,javaCommentStar,javaSpecialChar,@Spell
- syn region javaComment2String contained start=+"+ end=+$\|"+ contains=javaSpecial,javaSpecialChar,@Spell
+ syn region javaCommentString contained start=+"""[ \t\x0c\r]*$+hs=e+1 end=+"""+he=s-1 contains=javaSpecial,javaCommentStar,javaSpecialChar,@Spell,javaSpecialError,javaTextBlockError
+ syn region javaComment2String contained start=+"+ end=+$\|"+ contains=javaSpecial,javaSpecialChar,@Spell
syn match javaCommentCharacter contained "'\\[^']\{1,6\}'" contains=javaSpecialChar
syn match javaCommentCharacter contained "'\\''" contains=javaSpecialChar
syn match javaCommentCharacter contained "'[^\\]'"
syn cluster javaCommentSpecial add=javaCommentString,javaCommentCharacter,javaNumber
syn cluster javaCommentSpecial2 add=javaComment2String,javaCommentCharacter,javaNumber
endif
+
syn region javaComment start="/\*" end="\*/" contains=@javaCommentSpecial,javaTodo,@Spell
syn match javaCommentStar contained "^\s*\*[^/]"me=e-1
syn match javaCommentStar contained "^\s*\*$"
@@ -202,22 +229,32 @@ syn match javaComment "/\*\*/"
" Strings and constants
syn match javaSpecialError contained "\\."
syn match javaSpecialCharError contained "[^']"
-syn match javaSpecialChar contained "\\\([4-9]\d\|[0-3]\d\d\|[\"\\'ntbrf]\|u\x\{4\}\)"
+" Escape Sequences (JLS-17, §3.10.7):
+syn match javaSpecialChar contained "\\\%(u\x\x\x\x\|[0-3]\o\o\|\o\o\=\|[bstnfr"'\\]\)"
syn region javaString start=+"+ end=+"+ end=+$+ contains=javaSpecialChar,javaSpecialError,@Spell
-" next line disabled, it can cause a crash for a long line
-"syn match javaStringError +"\([^"\\]\|\\.\)*$+
+syn region javaString start=+"""[ \t\x0c\r]*$+hs=e+1 end=+"""+he=s-1 contains=javaSpecialChar,javaSpecialError,javaTextBlockError,@Spell
+syn match javaTextBlockError +"""\s*"""+
+" The next line is commented out, it can cause a crash for a long line
+"syn match javaStringError +"\%([^"\\]\|\\.\)*$+
syn match javaCharacter "'[^']*'" contains=javaSpecialChar,javaSpecialCharError
syn match javaCharacter "'\\''" contains=javaSpecialChar
syn match javaCharacter "'[^\\]'"
-syn match javaNumber "\<\(0[bB][0-1]\+\|0[0-7]*\|0[xX]\x\+\|\d\(\d\|_\d\)*\)[lL]\=\>"
-syn match javaNumber "\(\<\d\(\d\|_\d\)*\.\(\d\(\d\|_\d\)*\)\=\|\.\d\(\d\|_\d\)*\)\([eE][-+]\=\d\(\d\|_\d\)*\)\=[fFdD]\="
-syn match javaNumber "\<\d\(\d\|_\d\)*[eE][-+]\=\d\(\d\|_\d\)*[fFdD]\=\>"
-syn match javaNumber "\<\d\(\d\|_\d\)*\([eE][-+]\=\d\(\d\|_\d\)*\)\=[fFdD]\>"
-
-" unicode characters
-syn match javaSpecial "\\u\d\{4\}"
-
-syn cluster javaTop add=javaString,javaCharacter,javaNumber,javaSpecial,javaStringError
+" Integer literals (JLS-17, §3.10.1):
+syn keyword javaNumber 0 0l 0L
+syn match javaNumber "\<\%(0\%([xX]\x\%(_*\x\)*\|_*\o\%(_*\o\)*\|[bB][01]\%(_*[01]\)*\)\|[1-9]\%(_*\d\)*\)[lL]\=\>"
+" Decimal floating-point literals (JLS-17, §3.10.2):
+" Against "\<\d\+\>\.":
+syn match javaNumber "\<\d\%(_*\d\)*\."
+syn match javaNumber "\%(\<\d\%(_*\d\)*\.\%(\d\%(_*\d\)*\)\=\|\.\d\%(_*\d\)*\)\%([eE][-+]\=\d\%(_*\d\)*\)\=[fFdD]\=\>"
+syn match javaNumber "\<\d\%(_*\d\)*[eE][-+]\=\d\%(_*\d\)*[fFdD]\=\>"
+syn match javaNumber "\<\d\%(_*\d\)*\%([eE][-+]\=\d\%(_*\d\)*\)\=[fFdD]\>"
+" Hexadecimal floating-point literals (JLS-17, §3.10.2):
+syn match javaNumber "\<0[xX]\%(\x\%(_*\x\)*\.\=\|\%(\x\%(_*\x\)*\)\=\.\x\%(_*\x\)*\)[pP][-+]\=\d\%(_*\d\)*[fFdD]\=\>"
+
+" Unicode characters
+syn match javaSpecial "\\u\x\x\x\x"
+
+syn cluster javaTop add=javaString,javaCharacter,javaNumber,javaSpecial,javaStringError,javaTextBlockError
if exists("java_highlight_functions")
if java_highlight_functions == "indent"
@@ -231,26 +268,31 @@ if exists("java_highlight_functions")
" 1. class names are always capitalized (ie: Button)
" 2. method names are never capitalized (except constructors, of course)
"syn region javaFuncDef start=+^\s\+\(\(public\|protected\|private\|static\|abstract\|final\|native\|synchronized\)\s\+\)*\(\(void\|boolean\|char\|byte\|short\|int\|long\|float\|double\|\([A-Za-z_][A-Za-z0-9_$]*\.\)*[A-Z][A-Za-z0-9_$]*\)\(<[^>]*>\)\=\(\[\]\)*\s\+[a-z][A-Za-z0-9_$]*\|[A-Z][A-Za-z0-9_$]*\)\s*([^0-9]+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,javaComment,javaLineComment,@javaClasses
- syn region javaFuncDef start=+^\s\+\(\(public\|protected\|private\|static\|abstract\|final\|native\|synchronized\)\s\+\)*\(<.*>\s\+\)\?\(\(void\|boolean\|char\|byte\|short\|int\|long\|float\|double\|\([A-Za-z_][A-Za-z0-9_$]*\.\)*[A-Z][A-Za-z0-9_$]*\)\(<[^(){}]*>\)\=\(\[\]\)*\s\+[a-z][A-Za-z0-9_$]*\|[A-Z][A-Za-z0-9_$]*\)\s*(+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,javaComment,javaLineComment,@javaClasses,javaAnnotation
+ syn region javaFuncDef start=+^\s\+\%(\%(public\|protected\|private\|static\|\%(abstract\|default\)\|final\|native\|synchronized\)\s\+\)*\%(<.*>\s\+\)\?\%(\%(void\|boolean\|char\|byte\|short\|int\|long\|float\|double\|\%([A-Za-z_][A-Za-z0-9_$]*\.\)*[A-Z][A-Za-z0-9_$]*\)\%(<[^(){}]*>\)\=\%(\[\]\)*\s\+[a-z][A-Za-z0-9_$]*\|[A-Z][A-Za-z0-9_$]*\)\s*(+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,javaComment,javaLineComment,@javaClasses,javaAnnotation
endif
- syn match javaLambdaDef "[a-zA-Z_][a-zA-Z0-9_]*\s*->"
+ syn match javaLambdaDef "\<\K\k*\>\%(\<default\>\)\@<!\s*->"
syn match javaBraces "[{}]"
syn cluster javaTop add=javaFuncDef,javaBraces,javaLambdaDef
endif
if exists("java_highlight_debug")
-
" Strings and constants
- syn match javaDebugSpecial contained "\\\d\d\d\|\\."
+ syn match javaDebugSpecial contained "\\\%(u\x\x\x\x\|[0-3]\o\o\|\o\o\=\|[bstnfr"'\\]\)"
syn region javaDebugString contained start=+"+ end=+"+ contains=javaDebugSpecial
- syn match javaDebugStringError +"\([^"\\]\|\\.\)*$+
+ syn region javaDebugString contained start=+"""[ \t\x0c\r]*$+hs=e+1 end=+"""+he=s-1 contains=javaDebugSpecial,javaDebugTextBlockError
+" The next line is commented out, it can cause a crash for a long line
+" syn match javaDebugStringError contained +"\%([^"\\]\|\\.\)*$+
+ syn match javaDebugTextBlockError contained +"""\s*"""+
syn match javaDebugCharacter contained "'[^\\]'"
syn match javaDebugSpecialCharacter contained "'\\.'"
syn match javaDebugSpecialCharacter contained "'\\''"
- syn match javaDebugNumber contained "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>"
- syn match javaDebugNumber contained "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\="
- syn match javaDebugNumber contained "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>"
- syn match javaDebugNumber contained "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>"
+ syn keyword javaDebugNumber contained 0 0l 0L
+ syn match javaDebugNumber contained "\<\d\%(_*\d\)*\."
+ syn match javaDebugNumber contained "\<\%(0\%([xX]\x\%(_*\x\)*\|_*\o\%(_*\o\)*\|[bB][01]\%(_*[01]\)*\)\|[1-9]\%(_*\d\)*\)[lL]\=\>"
+ syn match javaDebugNumber contained "\%(\<\d\%(_*\d\)*\.\%(\d\%(_*\d\)*\)\=\|\.\d\%(_*\d\)*\)\%([eE][-+]\=\d\%(_*\d\)*\)\=[fFdD]\=\>"
+ syn match javaDebugNumber contained "\<\d\%(_*\d\)*[eE][-+]\=\d\%(_*\d\)*[fFdD]\=\>"
+ syn match javaDebugNumber contained "\<\d\%(_*\d\)*\%([eE][-+]\=\d\%(_*\d\)*\)\=[fFdD]\>"
+ syn match javaDebugNumber contained "\<0[xX]\%(\x\%(_*\x\)*\.\=\|\%(\x\%(_*\x\)*\)\=\.\x\%(_*\x\)*\)[pP][-+]\=\d\%(_*\d\)*[fFdD]\=\>"
syn keyword javaDebugBoolean contained true false
syn keyword javaDebugType contained null this super
syn region javaDebugParen start=+(+ end=+)+ contained contains=javaDebug.*,javaDebugParen
@@ -266,6 +308,7 @@ if exists("java_highlight_debug")
hi def link javaDebug Debug
hi def link javaDebugString DebugString
hi def link javaDebugStringError javaError
+ hi def link javaDebugTextBlockError javaDebugStringError
hi def link javaDebugType DebugType
hi def link javaDebugBoolean DebugBoolean
hi def link javaDebugNumber Debug
@@ -326,6 +369,7 @@ hi def link javaStorageClass StorageClass
hi def link javaMethodDecl javaStorageClass
hi def link javaClassDecl javaStorageClass
hi def link javaScopeDecl javaStorageClass
+hi def link javaConceptKind NonText
hi def link javaBoolean Boolean
hi def link javaSpecial Special
@@ -337,6 +381,7 @@ hi def link javaSpecialChar SpecialChar
hi def link javaNumber Number
hi def link javaError Error
hi def link javaStringError Error
+hi def link javaTextBlockError javaStringError
hi def link javaStatement Statement
hi def link javaOperator Operator
hi def link javaComment Comment
diff --git a/runtime/syntax/json5.vim b/runtime/syntax/json5.vim
index 5b01d33aad..dc0d11b2a1 100644
--- a/runtime/syntax/json5.vim
+++ b/runtime/syntax/json5.vim
@@ -49,9 +49,11 @@ syn match json5Key /@\?\%(\I\|\$\)\%(\i\|\$\)*\s*\ze::\@!/ contains=@Spell
syn match json5Key /"\([^"]\|\\"\)\{-}"\ze\s*:/ contains=json5Escape,@Spell
" Comment
-syn region json5LineComment start=+\/\/+ end=+$+ keepend contains=@Spell
-syn region json5LineComment start=+^\s*\/\/+ skip=+\n\s*\/\/+ end=+$+ keepend fold contains=@Spell
-syn region json5Comment start="/\*" end="\*/" fold contains=@Spell
+syn region json5LineComment start=+\/\/+ end=+$+ keepend contains=@Spell,json5Todo
+syn region json5LineComment start=+^\s*\/\/+ skip=+\n\s*\/\/+ end=+$+ keepend fold contains=@Spell,json5Todo
+syn region json5Comment start="/\*" end="\*/" fold contains=@Spell,json5Todo
+
+syn keyword json5Todo contained TODO FIXME XXX
" Define the default highlighting
hi def link json5String String
@@ -66,6 +68,7 @@ hi def link json5Boolean Boolean
hi def link json5LineComment Comment
hi def link json5Comment Comment
hi def link json5NumError Error
+hi def link json5Todo Todo
if !exists('b:current_syntax')
let b:current_syntax = 'json5'
diff --git a/runtime/syntax/lex.vim b/runtime/syntax/lex.vim
index 82197adbed..b05148e88f 100644
--- a/runtime/syntax/lex.vim
+++ b/runtime/syntax/lex.vim
@@ -1,9 +1,11 @@
" Vim syntax file
" Language: Lex and Flex
-" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Charles E. Campbell
" Contributor: Robert A. van Engelen <engelen@acm.org>
-" Last Change: Apr 24, 2020
" Version: 18
+" Last Change: Apr 24, 2020
+" 2024 Feb 19 by Vim Project (announce adoption)
" quit when a syntax file was already loaded
if exists("b:current_syntax")
diff --git a/runtime/syntax/lisp.vim b/runtime/syntax/lisp.vim
index 90513e3a00..5350b4dc51 100644
--- a/runtime/syntax/lisp.vim
+++ b/runtime/syntax/lisp.vim
@@ -1,9 +1,11 @@
" Vim syntax file
" Language: Lisp
-" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Charles E. Campbell
" Last Change: Nov 10, 2021
+" 2024 Feb 19 by Vim Project (announce adoption)
" Version: 31
-" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_LISP
+" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_LISP
"
" Thanks to F Xavier Noria for a list of 978 Common Lisp symbols taken from HyperSpec
" Clisp additions courtesy of http://clisp.cvs.sourceforge.net/*checkout*/clisp/clisp/emacs/lisp.vim
diff --git a/runtime/syntax/logtalk.vim b/runtime/syntax/logtalk.vim
index bc70ef41b4..2c6c82aaa0 100644
--- a/runtime/syntax/logtalk.vim
+++ b/runtime/syntax/logtalk.vim
@@ -1,8 +1,9 @@
" Vim syntax file
"
" Language: Logtalk
-" Maintainer: Paulo Moura <pmoura@logtalk.org>
-" Last Change: August 3, 2018
+" Maintainer: Paulo Moura <pmoura@logtalk.org>
+" Last Change: December 16, 2023
+
" quit when a syntax file was already loaded
@@ -30,7 +31,7 @@ syn match logtalkOperator ":-"
" Logtalk quoted atoms and strings
-syn region logtalkString start=+"+ skip=+\\"+ end=+"+
+syn region logtalkString start=+"+ skip=+\\"+ end=+"+ contains=logtalkEscapeSequence
syn region logtalkAtom start=+'+ skip=+\\'+ end=+'+ contains=logtalkEscapeSequence
syn match logtalkEscapeSequence contained "\\\([\\abfnrtv\"\']\|\(x[a-fA-F0-9]\+\|[0-7]\+\)\\\)"
@@ -39,7 +40,7 @@ syn match logtalkEscapeSequence contained "\\\([\\abfnrtv\"\']\|\(x[a-fA-F0-9]\+
" Logtalk message sending operators
syn match logtalkOperator "::"
-syn match logtalkOperator ":"
+syn match logtalkOperator "\(0'\)\@<!:"
syn match logtalkOperator "\^\^"
@@ -138,7 +139,7 @@ syn match logtalkBuiltIn "\<logtalk_make\>"
syn match logtalkBuiltIn "\<\(for\|retract\)all\ze("
-syn match logtalkBuiltIn "\<threaded\(_\(call\|once\|ignore\|exit\|peek\|wait\|notify\)\)\?\ze("
+syn match logtalkBuiltIn "\<threaded\(_\(ca\(ll\|ncel\)\|once\|ignore\|exit\|peek\|wait\|notify\)\)\?\ze("
syn match logtalkBuiltIn "\<threaded_engine\(_\(create\|destroy\|self\|next\|next_reified\|yield\|post\|fetch\)\)\?\ze("
@@ -171,8 +172,8 @@ syn match logtalkBuiltInMethod "\<phrase\ze("
" Mode operators
-syn match logtalkOperator "?"
-syn match logtalkOperator "@"
+syn match logtalkOperator "\(0'\)\@<!?"
+syn match logtalkOperator "\(0'\)\@<!@"
" Control constructs
@@ -181,19 +182,19 @@ syn match logtalkKeyword "\<true\>"
syn match logtalkKeyword "\<fail\>"
syn match logtalkKeyword "\<false\>"
syn match logtalkKeyword "\<ca\(ll\|tch\)\ze("
-syn match logtalkOperator "!"
-" syn match logtalkOperator ","
-syn match logtalkOperator ";"
+syn match logtalkOperator "\(0'\)\@<!!"
+" syn match logtalkOperator "\(0'\)\@<!,"
+syn match logtalkOperator "\(0'\)\@<!;"
syn match logtalkOperator "-->"
syn match logtalkOperator "->"
syn match logtalkKeyword "\<throw\ze("
syn match logtalkKeyword "\<\(instantiation\|system\)_error\>"
-syn match logtalkKeyword "\<\(type\|domain\|existence\|permission\|representation\|evaluation\|resource\|syntax\)_error\ze("
+syn match logtalkKeyword "\<\(uninstantiation\|type\|domain\|existence\|permission\|representation\|evaluation\|resource\|syntax\)_error\ze("
" Term unification
-syn match logtalkOperator "="
+syn match logtalkOperator "\(0'\)\@<!="
syn match logtalkKeyword "\<subsumes_term\ze("
syn match logtalkKeyword "\<unify_with_occurs_check\ze("
syn match logtalkOperator "\\="
@@ -246,9 +247,9 @@ syn match logtalkOperator "\<is\>"
syn match logtalkOperator "=:="
syn match logtalkOperator "=\\="
-syn match logtalkOperator "<"
+syn match logtalkOperator "\(0'\)\@<!<"
syn match logtalkOperator "=<"
-syn match logtalkOperator ">"
+syn match logtalkOperator "\(0'\)\@<!>"
syn match logtalkOperator ">="
@@ -310,11 +311,11 @@ syn match logtalkKeyword "\<\(key\)\?sort\ze("
" Evaluable functors
-syn match logtalkOperator "+"
-syn match logtalkOperator "-"
-syn match logtalkOperator "\*"
+syn match logtalkOperator "\(0'\)\@<![+]"
+syn match logtalkOperator "\(0'\)\@<![-]"
+syn match logtalkOperator "\(0'\)\@<!\*"
syn match logtalkOperator "//"
-syn match logtalkOperator "/"
+syn match logtalkOperator "\(0'\)\@<!/"
syn match logtalkKeyword "\<div\ze("
syn match logtalkKeyword "\<r\(ound\|em\)\ze("
syn match logtalkKeyword "\<e\>"
@@ -330,7 +331,7 @@ syn match logtalkKeyword "\<t\(an\|runcate\)\ze("
syn match logtalkKeyword "\<ceiling\ze("
-" Other arithmetic functors
+" Other arithemtic functors
syn match logtalkOperator "\*\*"
syn match logtalkKeyword "\<s\(in\|qrt\)\ze("
@@ -346,18 +347,18 @@ syn match logtalkOperator ">>"
syn match logtalkOperator "<<"
syn match logtalkOperator "/\\"
syn match logtalkOperator "\\/"
-syn match logtalkOperator "\\"
+syn match logtalkOperator "0'\@<!\\"
syn match logtalkKeyword "\<xor\ze("
" Logtalk list operator
-syn match logtalkOperator "|"
+syn match logtalkOperator "\(0'\)\@<!|"
" Logtalk existential quantifier operator
-syn match logtalkOperator "\^"
+syn match logtalkOperator "\(0'\)\@<!^"
" Logtalk numbers
@@ -366,7 +367,7 @@ syn match logtalkNumber "\<\d\+\>"
syn match logtalkNumber "\<\d\+\.\d\+\>"
syn match logtalkNumber "\<\d\+[eE][-+]\=\d\+\>"
syn match logtalkNumber "\<\d\+\.\d\+[eE][-+]\=\d\+\>"
-syn match logtalkNumber "\<0'[\\]\?.\|0''\|0'\"\>"
+syn match logtalkNumber "0'[\\]\?."
syn match logtalkNumber "\<0b[0-1]\+\>"
syn match logtalkNumber "\<0o\o\+\>"
syn match logtalkNumber "\<0x\x\+\>"
@@ -374,13 +375,13 @@ syn match logtalkNumber "\<0x\x\+\>"
" Logtalk end-of-clause
-syn match logtalkOperator "\."
+syn match logtalkOperator "\(0'\)\@<!\."
" Logtalk comments
syn region logtalkBlockComment start="/\*" end="\*/" fold
-syn match logtalkLineComment "%.*"
+syn match logtalkLineComment "%.*$"
syn cluster logtalkComment contains=logtalkBlockComment,logtalkLineComment
diff --git a/runtime/syntax/mail.vim b/runtime/syntax/mail.vim
index 0cd48fc77a..9beeba69e2 100644
--- a/runtime/syntax/mail.vim
+++ b/runtime/syntax/mail.vim
@@ -2,7 +2,7 @@
" Language: Mail file
" Previous Maintainer: Felix von Leitner <leitner@math.fu-berlin.de>
" Maintainer: GI <a@b.c>, where a='gi1242+vim', b='gmail', c='com'
-" Last Change: Wed 14 Aug 2013 08:24:52 AM PDT
+" Last Change: Thu 25 Jan 2024 10:34:02 AM EST
" Quit when a syntax file was already loaded
if exists("b:current_syntax")
@@ -12,6 +12,8 @@ endif
let s:cpo_save = &cpo
set cpo&vim
+syn spell toplevel
+
" The mail header is recognized starting with a "keyword:" line and ending
" with an empty line or other line that can't be in the header. All lines of
" the header are highlighted. Headers of quoted messages (quoted with >) are
@@ -61,6 +63,9 @@ syn region mailVerbatim contains=@mailQuoteExps,@NoSpell keepend start="^\z(\(>
syn match mailURL contains=@NoSpell `\v<(((https?|ftp|gopher)://|(mailto|file|news):)[^' <>"]+|(www|web|w3)[a-z0-9_-]*\.[a-z0-9._-]+\.[^' <>"]+)[a-z0-9/]`
syn match mailEmail contains=@NoSpell "\v[_=a-z\./+0-9-]+\@[a-z0-9._-]+\a{2}"
+" Don't spell emojis
+syn match mailEmoji contains=@NoSpell "\%#=2\v[\U1f300-\U1f64f\U1f900-\U1f9ff]"
+
" Make sure quote markers in regions (header / signature) have correct color
syn match mailQuoteExp1 contained "\v^(\> ?)"
syn match mailQuoteExp2 contained "\v^(\> ?){2}"
@@ -86,14 +91,14 @@ endif
" Define the default highlighting.
hi def link mailVerbatim Special
-hi def link mailHeader Statement
+hi def link mailHeader PreProc
hi def link mailHeaderKey Type
-hi def link mailSignature PreProc
+hi def link mailSignature Comment
hi def link mailHeaderEmail mailEmail
-hi def link mailEmail Special
-hi def link mailURL String
-hi def link mailSubject Title
-hi def link mailQuoted1 Comment
+hi def link mailEmail String
+hi def link mailURL Constant
+hi def link mailSubject Statement
+hi def link mailQuoted1 Function
hi def link mailQuoted3 mailQuoted1
hi def link mailQuoted5 mailQuoted1
hi def link mailQuoted2 Identifier
diff --git a/runtime/syntax/maple.vim b/runtime/syntax/maple.vim
index 78f2b4e09e..b0bd9aaef9 100644
--- a/runtime/syntax/maple.vim
+++ b/runtime/syntax/maple.vim
@@ -1,9 +1,11 @@
" Vim syntax file
" Language: Maple V (based on release 4)
-" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer:Charles E. Campbell
" Last Change: Mar 26, 2019
+" 2024 Feb 19 by Vim Project (announce adoption)
" Version: 17
-" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_MAPLE
+" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_MAPLE
"
" Package Function Selection: {{{1
" Because there are a lot of packages, and because of the potential for namespace
diff --git a/runtime/syntax/masm.vim b/runtime/syntax/masm.vim
index 85e457106d..dc9a292cce 100644
--- a/runtime/syntax/masm.vim
+++ b/runtime/syntax/masm.vim
@@ -2,7 +2,7 @@
" Language: Microsoft Macro Assembler (80x86)
" Orig Author: Rob Brady <robb@datatone.com>
" Maintainer: Wu Yongwei <wuyongwei@gmail.com>
-" Last Change: 2023-09-09 20:48:26 +0800
+" Last Change: 2023-12-20 10:20:04 +0800
" Quit when a syntax file was already loaded
if exists("b:current_syntax")
@@ -459,8 +459,9 @@ syn keyword masmOpcode VMOVAPD VMOVAPS VMOVD VMOVQ VMOVDDUP
syn keyword masmOpcode VMOVHLPS VMOVHPD VMOVHPS VMOVLHPS VMOVLPD
syn keyword masmOpcode VMOVLPS VMOVNTDQA VMOVNTDQ VMOVNTPD VMOVNTPS
syn keyword masmOpcode VMOVSD VMOVSHDUP VMOVSLDUP VMOVSS VMOVUPD
-syn keyword masmOpcode VMOVUPS VMOVDQA32 VMOVDQA64 VMOVDQU8
-syn keyword masmOpcode VMOVDQU16 VMOVDQU32 VMOVDQU64 VMULPD VMULPS
+syn keyword masmOpcode VMOVUPS VMOVDQA VMOVDQA32 VMOVDQA64
+syn keyword masmOpcode VMOVDQU VMOVDQU8 VMOVDQU16 VMOVDQU32 VMOVDQU64
+syn keyword masmOpcode VMULPD VMULPS
syn keyword masmOpcode VMULSD VMULSS VORPD VORPS VSQRTPD VSQRTPS
syn keyword masmOpcode VSQRTSD VSQRTSS VSUBPD VSUBPS VSUBSD VSUBSS
syn keyword masmOpcode VUCOMISD VUCOMISS VUNPCKHPD VUNPCKHPS VUNPCKLPD
@@ -468,8 +469,8 @@ syn keyword masmOpcode VUNPCKLPS VXORPD VXORPS VEXTRACTPS VINSERTPS
syn keyword masmOpcode VPEXTRB VPEXTRW VPEXTRD VPEXTRQ VPINSRB VPINSRW
syn keyword masmOpcode VPINSRD VPINSRQ VPACKSSWB VPACKSSDW VPACKUSDW
syn keyword masmOpcode VPACKUSWB VPADDB VPADDW VPADDD VPADDQ VPADDSB
-syn keyword masmOpcode VPADDSW VPADDUSB VPADDUSW VPANDD VPANDQ VPANDND
-syn keyword masmOpcode VPANDNQ VPAVGB VPAVGW VPCMPEQB VPCMPEQW
+syn keyword masmOpcode VPADDSW VPADDUSB VPADDUSW VPAND VPANDD VPANDQ
+syn keyword masmOpcode VPANDND VPANDNQ VPAVGB VPAVGW VPCMPEQB VPCMPEQW
syn keyword masmOpcode VPCMPEQD VPCMPEQQ VPCMPGTB VPCMPGTW VPCMPGTD
syn keyword masmOpcode VPCMPGTQ VPMAXSB VPMAXSW VPMAXSD VPMAXSQ
syn keyword masmOpcode VPMAXUB VPMAXUW VPMAXUD VPMAXUQ VPMINSB VPMINSW
@@ -482,7 +483,8 @@ syn keyword masmOpcode VPMULLQ VPMULLW VPORD VPORQ VPSUBB VPSUBW
syn keyword masmOpcode VPSUBD VPSUBQ VPSUBSB VPSUBSW VPSUBUSB VPSUBUSW
syn keyword masmOpcode VPUNPCKHBW VPUNPCKHWD VPUNPCKHDQ VPUNPCKHQDQ
syn keyword masmOpcode VPUNPCKLBW VPUNPCKLWD VPUNPCKLDQ VPUNPCKLQDQ
-syn keyword masmOpcode VPXORD VPXORQ VPSADBW VPSHUFB VPSHUFHW VPSHUFLW
+syn keyword masmOpcode VPXOR VPXORD VPXORQ
+syn keyword masmOpcode VPSADBW VPSHUFB VPSHUFHW VPSHUFLW
syn keyword masmOpcode VPSHUFD VPSLLDQ VPSLLW VPSLLD VPSLLQ VPSRAW
syn keyword masmOpcode VPSRAD VPSRAQ VPSRLDQ VPSRLW VPSRLD VPSRLQ
syn keyword masmOpcode VPSLLVW VPSRLVW VPSHUFPD VPSHUFPS VEXTRACTF32X4
@@ -516,7 +518,7 @@ syn keyword masmOpcode VFNMSUB132SS VFNMSUB213SS VFNMSUB231SS
syn keyword masmOpcode VPSRAVW VPSRAVQ
" Other opcodes in Pentium and later processors
-syn keyword masmOpcode CMPXCHG8B CPUID UD2
+syn keyword masmOpcode CMPXCHG8B CPUID UD2 MOVSXD
syn keyword masmOpcode RSM RDMSR WRMSR RDPMC RDTSC SYSENTER SYSEXIT
syn match masmOpcode "CMOV\(P[EO]\|\(N\?\([ABGL]E\?\|[CEOPSZ]\)\)\)\>"
diff --git a/runtime/syntax/mermaid.vim b/runtime/syntax/mermaid.vim
index afdbcc3d62..5a9a217337 100644
--- a/runtime/syntax/mermaid.vim
+++ b/runtime/syntax/mermaid.vim
@@ -2,7 +2,7 @@
" Language: Mermaid
" Maintainer: Craig MacEahern <https://github.com/craigmac/vim-mermaid>
" Filenames: *.mmd
-" Last Change: 2022 Nov 22
+" Last Change: 2023 Dec 26
if exists("b:current_syntax")
finish
@@ -85,54 +85,30 @@ syntax keyword mermaidKeyword
highlight link mermaidKeyword Keyword
syntax match mermaidStatement "|"
-syntax match mermaidStatement "--\?[>x)]>\?+\?-\?"
syntax match mermaidStatement "\~\~\~"
syntax match mermaidStatement "--"
-syntax match mermaidStatement "---"
-syntax match mermaidStatement "-->"
+syntax match mermaidStatement "\%(<|\|[<*o]\)\?\%(--\|\.\.\)\%(|>\|[>*o]\)\?"
+syntax match mermaidStatement "-\{2,4}[>ox-]"
+syntax match mermaidStatement "\.-[>ox]"
syntax match mermaidStatement "-\."
-syntax match mermaidStatement "\.->"
-syntax match mermaidStatement "-\.-"
-syntax match mermaidStatement "-\.\.-"
-syntax match mermaidStatement "-\.\.\.-"
+syntax match mermaidStatement "-\.\{1,3}-"
syntax match mermaidStatement "=="
-syntax match mermaidStatement "==>"
-syntax match mermaidStatement "===>"
-syntax match mermaidStatement "====>"
+syntax match mermaidStatement "=\{2,4}[>ox=]"
syntax match mermaidStatement "&"
-syntax match mermaidStatement "--o"
-syntax match mermaidStatement "--x"
+syntax match mermaidStatement "--\?[>x)]>\?[+-]\?"
syntax match mermaidStatement "x--x"
-syntax match mermaidStatement "-----"
-syntax match mermaidStatement "---->"
-syntax match mermaidStatement "==="
-syntax match mermaidStatement "===="
-syntax match mermaidStatement "====="
+syntax match mermaidStatement "o--o\?"
+syntax match mermaidStatement "<-->\?"
syntax match mermaidStatement ":::"
-syntax match mermaidStatement "<|--"
-syntax match mermaidStatement "\*--"
-syntax match mermaidStatement "o--"
-syntax match mermaidStatement "o--o"
-syntax match mermaidStatement "<--"
-syntax match mermaidStatement "<-->"
-syntax match mermaidStatement "\.\."
-syntax match mermaidStatement "<\.\."
-syntax match mermaidStatement "<|\.\."
-syntax match mermaidStatement "--|>"
-syntax match mermaidStatement "--\*"
-syntax match mermaidStatement "--o"
-syntax match mermaidStatement "\.\.>"
-syntax match mermaidStatement "\.\.|>"
-syntax match mermaidStatement "<|--|>"
syntax match mermaidStatement "||--o{"
highlight link mermaidStatement Statement
-syntax match mermaidIdentifier "[\+-]\?\w\+(.*)[\$\*]\?"
-highlight link mermaidIdentifier Identifier
+" FIXME: This unexpectedly matches flow chart node `id1(text)` or others.
+"syntax match mermaidIdentifier "[\+-]\?\w\+(.*)[\$\*]\?"
+"highlight link mermaidIdentifier Identifier
-syntax match mermaidType "[\+-\#\~]\?\cint\>"
-syntax match mermaidType "[\+-\#\~]\?\cString\>"
-syntax match mermaidType "[\+-\#\~]\?\cbool\>"
+syntax match mermaidType "[\+-\#\~]\?\c\%(const\s\+\|\*\s*\)*\%(unsigned\s\+\)\?\%(int\|u\?int\%(8\|16\|32\|64\)_t\|char\|long\|long\s\+long\)\>\%(\s\+const\|\s*[\*&]\)*"
+syntax match mermaidType "[\+-\#\~]\?\c\%(const\s\+\|\*\s*\)*\%(double\|float\|String\|bool\)\>\%(\s\+const\|\s*[\*&]\)*"
syntax match mermaidType "[\+-\#\~]\?\cBigDecimal\>"
syntax match mermaidType "[\+-\#\~]\?\cList\~.\+\~"
syntax match mermaidType "<<\w\+>>"
diff --git a/runtime/syntax/modula2.vim b/runtime/syntax/modula2.vim
index 4a14cf1f6f..6a9f4af6aa 100644
--- a/runtime/syntax/modula2.vim
+++ b/runtime/syntax/modula2.vim
@@ -1,73 +1,16 @@
" Vim syntax file
-" Language: Modula 2
-" Maintainer: pf@artcom0.north.de (Peter Funk)
-" based on original work of Bram Moolenaar <Bram@vim.org>
-" Last Change: 2001 May 09
+" Language: Modula-2
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer: pf@artcom0.north.de (Peter Funk)
+" Last Change: 2024 Jan 04
-" quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
-" Don't ignore case (Modula-2 is case significant). This is the default in vim
-
-" Especially emphasize headers of procedures and modules:
-syn region modula2Header matchgroup=modula2Header start="PROCEDURE " end="(" contains=modula2Ident oneline
-syn region modula2Header matchgroup=modula2Header start="MODULE " end=";" contains=modula2Ident oneline
-syn region modula2Header matchgroup=modula2Header start="BEGIN (\*" end="\*)" contains=modula2Ident oneline
-syn region modula2Header matchgroup=modula2Header start="END " end=";" contains=modula2Ident oneline
-syn region modula2Keyword start="END" end=";" contains=ALLBUT,modula2Ident oneline
-
-" Some very important keywords which should be emphasized more than others:
-syn keyword modula2AttKeyword CONST EXIT HALT RETURN TYPE VAR
-" All other keywords in alphabetical order:
-syn keyword modula2Keyword AND ARRAY BY CASE DEFINITION DIV DO ELSE
-syn keyword modula2Keyword ELSIF EXPORT FOR FROM IF IMPLEMENTATION IMPORT
-syn keyword modula2Keyword IN LOOP MOD NOT OF OR POINTER QUALIFIED RECORD
-syn keyword modula2Keyword SET THEN TO UNTIL WHILE WITH
-
-syn keyword modula2Type ADDRESS BITSET BOOLEAN CARDINAL CHAR INTEGER REAL WORD
-syn keyword modula2StdFunc ABS CAP CHR DEC EXCL INC INCL ORD SIZE TSIZE VAL
-syn keyword modula2StdConst FALSE NIL TRUE
-" The following may be discussed, since NEW and DISPOSE are some kind of
-" special builtin macro functions:
-syn keyword modula2StdFunc NEW DISPOSE
-" The following types are added later on and may be missing from older
-" Modula-2 Compilers (they are at least missing from the original report
-" by N.Wirth from March 1980 ;-) Highlighting should apply nevertheless:
-syn keyword modula2Type BYTE LONGCARD LONGINT LONGREAL PROC SHORTCARD SHORTINT
-" same note applies to min and max, which were also added later to m2:
-syn keyword modula2StdFunc MAX MIN
-" The underscore was originally disallowed in m2 ids, it was also added later:
-syn match modula2Ident " [A-Z,a-z][A-Z,a-z,0-9,_]*" contained
-
-" Comments may be nested in Modula-2:
-syn region modula2Comment start="(\*" end="\*)" contains=modula2Comment,modula2Todo
-syn keyword modula2Todo contained TODO FIXME XXX
-
-" Strings
-syn region modula2String start=+"+ end=+"+
-syn region modula2String start="'" end="'"
-syn region modula2Set start="{" end="}"
-
-" Define the default highlighting.
-" Only when an item doesn't have highlighting yet
-
-hi def link modula2Ident Identifier
-hi def link modula2StdConst Boolean
-hi def link modula2Type Identifier
-hi def link modula2StdFunc Identifier
-hi def link modula2Header Type
-hi def link modula2Keyword Statement
-hi def link modula2AttKeyword PreProc
-hi def link modula2Comment Comment
-" The following is just a matter of taste (you want to try this instead):
-" hi modula2Comment term=bold ctermfg=DarkBlue guifg=Blue gui=bold
-hi def link modula2Todo Todo
-hi def link modula2String String
-hi def link modula2Set String
-
+let dialect = modula2#GetDialect()
+exe "runtime! syntax/modula2/opt/" .. dialect .. ".vim"
let b:current_syntax = "modula2"
-" vim: ts=8
+" vim: nowrap sw=2 sts=2 ts=8 noet:
diff --git a/runtime/syntax/modula2/opt/iso.vim b/runtime/syntax/modula2/opt/iso.vim
new file mode 100644
index 0000000000..5bd24f6885
--- /dev/null
+++ b/runtime/syntax/modula2/opt/iso.vim
@@ -0,0 +1,380 @@
+" Vim syntax file
+" Language: Modula-2 (ISO)
+" Maintainer: B.Kowarsch <trijezdci@moc.liamg>
+" Last Change: 2016 August 22
+
+" ----------------------------------------------------
+" THIS FILE IS LICENSED UNDER THE VIM LICENSE
+" see https://github.com/vim/vim/blob/master/LICENSE
+" ----------------------------------------------------
+
+" Remarks:
+" Vim Syntax files are available for the following Modula-2 dialects:
+" * for the PIM dialect : m2pim.vim
+" * for the ISO dialect : m2iso.vim (this file)
+" * for the R10 dialect : m2r10.vim
+
+" -----------------------------------------------------------------------------
+" This syntax description follows ISO standard IS-10514 (aka ISO Modula-2)
+" with the addition of the following language extensions:
+" * non-standard types LONGCARD and LONGBITSET
+" * non-nesting code disabling tags ?< and >? at the start of a line
+" -----------------------------------------------------------------------------
+
+" Parameters:
+"
+" Vim's filetype script recognises Modula-2 dialect tags within the first 200
+" lines of Modula-2 .def and .mod input files. The script sets filetype and
+" dialect automatically when a valid dialect tag is found in the input file.
+" The dialect tag for the ISO dialect is (*!m2iso*). It is recommended to put
+" the tag immediately after the module header in the Modula-2 input file.
+"
+" Example:
+" DEFINITION MODULE Foolib; (*!m2iso*)
+"
+" Variable g:modula2_default_dialect sets the default Modula-2 dialect when the
+" dialect cannot be determined from the contents of the Modula-2 input file:
+" if defined and set to 'm2iso', the default dialect is ISO.
+"
+" Variable g:modula2_iso_allow_lowline controls support for lowline in identifiers:
+" if defined and set to a non-zero value, they are recognised, otherwise not
+"
+" Variable g:modula2_iso_disallow_octals controls the rendering of octal literals:
+" if defined and set to a non-zero value, they are rendered as errors.
+"
+" Variable g:modula2_iso_disallow_synonyms controls the rendering of @, & and ~:
+" if defined and set to a non-zero value, they are rendered as errors.
+"
+" Variables may be defined in Vim startup file .vimrc
+"
+" Examples:
+" let g:modula2_default_dialect = 'm2iso'
+" let g:modula2_iso_allow_lowline = 1
+" let g:modula2_iso_disallow_octals = 1
+" let g:modula2_iso_disallow_synonyms = 1
+
+
+if exists("b:current_syntax")
+ finish
+endif
+
+" Modula-2 is case sensitive
+syn case match
+
+
+" -----------------------------------------------------------------------------
+" Reserved Words
+" -----------------------------------------------------------------------------
+syn keyword modula2Resword AND ARRAY BEGIN BY CASE CONST DEFINITION DIV DO ELSE
+syn keyword modula2Resword ELSIF EXCEPT EXIT EXPORT FINALLY FOR FORWARD FROM IF
+syn keyword modula2Resword IMPLEMENTATION IMPORT IN LOOP MOD NOT OF OR PACKEDSET
+syn keyword modula2Resword POINTER QUALIFIED RECORD REPEAT REM RETRY RETURN SET
+syn keyword modula2Resword THEN TO TYPE UNTIL VAR WHILE WITH
+
+
+" -----------------------------------------------------------------------------
+" Builtin Constant Identifiers
+" -----------------------------------------------------------------------------
+syn keyword modula2ConstIdent FALSE NIL TRUE INTERRUPTIBLE UNINTERRUPTIBLE
+
+
+" -----------------------------------------------------------------------------
+" Builtin Type Identifiers
+" -----------------------------------------------------------------------------
+syn keyword modula2TypeIdent BITSET BOOLEAN CHAR PROC
+syn keyword modula2TypeIdent CARDINAL INTEGER LONGINT REAL LONGREAL
+syn keyword modula2TypeIdent COMPLEX LONGCOMPLEX PROTECTION
+
+
+" -----------------------------------------------------------------------------
+" Builtin Procedure and Function Identifiers
+" -----------------------------------------------------------------------------
+syn keyword modula2ProcIdent CAP DEC EXCL HALT INC INCL
+syn keyword modula2FuncIdent ABS CHR CMPLX FLOAT HIGH IM INT LENGTH LFLOAT MAX MIN
+syn keyword modula2FuncIdent ODD ORD RE SIZE TRUNC VAL
+
+
+" -----------------------------------------------------------------------------
+" Wirthian Macro Identifiers
+" -----------------------------------------------------------------------------
+syn keyword modula2MacroIdent NEW DISPOSE
+
+
+" -----------------------------------------------------------------------------
+" Unsafe Facilities via Pseudo-Module SYSTEM
+" -----------------------------------------------------------------------------
+syn keyword modula2UnsafeIdent ADDRESS BYTE LOC WORD
+syn keyword modula2UnsafeIdent ADR CAST TSIZE SYSTEM
+syn keyword modula2UnsafeIdent MAKEADR ADDADR SUBADR DIFADR ROTATE SHIFT
+
+
+" -----------------------------------------------------------------------------
+" Non-Portable Language Extensions
+" -----------------------------------------------------------------------------
+syn keyword modula2NonPortableIdent LONGCARD LONGBITSET
+
+
+" -----------------------------------------------------------------------------
+" User Defined Identifiers
+" -----------------------------------------------------------------------------
+syn match modula2Ident "[a-zA-Z][a-zA-Z0-9]*\(_\)\@!"
+syn match modula2LowLineIdent "[a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)\+"
+
+
+" -----------------------------------------------------------------------------
+" String Literals
+" -----------------------------------------------------------------------------
+syn region modula2String start=/"/ end=/"/ oneline
+syn region modula2String start=/'/ end=/'/ oneline
+
+
+" -----------------------------------------------------------------------------
+" Numeric Literals
+" -----------------------------------------------------------------------------
+syn match modula2Num
+ \ "\(\([0-7]\+\)[BC]\@!\|[89]\)[0-9]*\(\.[0-9]\+\([eE][+-]\?[0-9]\+\)\?\)\?"
+syn match modula2Num "[0-9A-F]\+H"
+syn match modula2Octal "[0-7]\+[BC]"
+
+
+" -----------------------------------------------------------------------------
+" Punctuation
+" -----------------------------------------------------------------------------
+syn match modula2Punctuation
+ \ "\.\|[,:;]\|\*\|[/+-]\|\#\|[=<>]\|\^\|\[\|\]\|(\(\*\)\@!\|[){}]"
+syn match modula2Synonym "[@&~]"
+
+
+" -----------------------------------------------------------------------------
+" Pragmas
+" -----------------------------------------------------------------------------
+syn region modula2Pragma start="<\*" end="\*>"
+syn match modula2DialectTag "(\*!m2iso\(+[a-z0-9]\+\)\?\*)"
+
+" -----------------------------------------------------------------------------
+" Block Comments
+" -----------------------------------------------------------------------------
+syn region modula2Comment start="(\*\(!m2iso\(+[a-z0-9]\+\)\?\*)\)\@!" end="\*)"
+ \ contains = modula2Comment, modula2CommentKey, modula2TechDebtMarker
+syn match modula2CommentKey "[Aa]uthor[s]\?\|[Cc]opyright\|[Ll]icense\|[Ss]ynopsis"
+syn match modula2CommentKey "\([Pp]re\|[Pp]ost\|[Ee]rror\)\-condition[s]\?:"
+
+
+" -----------------------------------------------------------------------------
+" Technical Debt Markers
+" -----------------------------------------------------------------------------
+syn keyword modula2TechDebtMarker contained DEPRECATED FIXME
+syn match modula2TechDebtMarker "TODO[:]\?" contained
+
+" -----------------------------------------------------------------------------
+" Disabled Code Sections
+" -----------------------------------------------------------------------------
+syn region modula2DisabledCode start="^?<" end="^>?"
+
+
+" -----------------------------------------------------------------------------
+" Headers
+" -----------------------------------------------------------------------------
+" !!! this section must be second last !!!
+
+" new module header
+syn match modula2ModuleHeader
+ \ "MODULE\( [A-Z][a-zA-Z0-9]*\)\?"
+ \ contains = modula2ReswordModule, modula2ModuleIdent
+
+syn match modula2ModuleIdent
+ \ "[A-Z][a-zA-Z0-9]*" contained
+
+syn match modula2ModuleTail
+ \ "END [A-Z][a-zA-Z0-9]*\.$"
+ \ contains = modula2ReswordEnd, modula2ModuleIdent, modula2Punctuation
+
+" new procedure header
+syn match modula2ProcedureHeader
+ \ "PROCEDURE\( [a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)*\)\?"
+ \ contains = modula2ReswordProcedure,
+ \ modula2ProcedureIdent, modula2ProcedureLowlineIdent, modula2IllegalChar, modula2IllegalIdent
+
+syn match modula2ProcedureIdent
+ \ "\([a-zA-Z]\)\([a-zA-Z0-9]*\)" contained
+
+syn match modula2ProcedureLowlineIdent
+ \ "[a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)\+" contained
+
+syn match modula2ProcedureTail
+ \ "END\( \([a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)*\)[.;]$\)\?"
+ \ contains = modula2ReswordEnd,
+ \ modula2ProcedureIdent, modula2ProcedureLowLineIdent,
+ \ modula2Punctuation, modula2IllegalChar, modula2IllegalIdent
+
+syn keyword modula2ReswordModule contained MODULE
+syn keyword modula2ReswordProcedure contained PROCEDURE
+syn keyword modula2ReswordEnd contained END
+
+
+" -----------------------------------------------------------------------------
+" Illegal Symbols
+" -----------------------------------------------------------------------------
+" !!! this section must be last !!!
+
+" any '`' '!' '$' '%' or '\'
+syn match modula2IllegalChar "[`!$%\\]"
+
+" any solitary sequence of '_'
+syn match modula2IllegalChar "\<_\+\>"
+
+" any '?' at start of line if not followed by '<'
+syn match modula2IllegalChar "^?\(<\)\@!"
+
+" any '?' not following '>' at start of line
+syn match modula2IllegalChar "\(\(^>\)\|\(^\)\)\@<!?"
+
+" any identifiers with leading occurrences of '_'
+syn match modula2IllegalIdent "_\+[a-zA-Z][a-zA-Z0-9]*\(_\+[a-zA-Z0-9]*\)*"
+
+" any identifiers containing consecutive occurences of '_'
+syn match modula2IllegalIdent
+ \ "[a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)*\(__\+[a-zA-Z0-9]\+\(_[a-zA-Z0-9]\+\)*\)\+"
+
+" any identifiers with trailing occurrences of '_'
+syn match modula2IllegalIdent "[a-zA-Z][a-zA-Z0-9]*\(_\+[a-zA-Z0-9]\+\)*_\+\>"
+
+
+" -----------------------------------------------------------------------------
+" Define Rendering Styles
+" -----------------------------------------------------------------------------
+
+" highlight default link modula2PredefIdentStyle Keyword
+" highlight default link modula2ConstIdentStyle modula2PredefIdentStyle
+" highlight default link modula2TypeIdentStyle modula2PredefIdentStyle
+" highlight default link modula2ProcIdentStyle modula2PredefIdentStyle
+" highlight default link modula2FuncIdentStyle modula2PredefIdentStyle
+" highlight default link modula2MacroIdentStyle modula2PredefIdentStyle
+
+highlight default link modula2ConstIdentStyle Constant
+highlight default link modula2TypeIdentStyle Type
+highlight default link modula2ProcIdentStyle Function
+highlight default link modula2FuncIdentStyle Function
+highlight default link modula2MacroIdentStyle Function
+highlight default link modula2UnsafeIdentStyle Question
+highlight default link modula2NonPortableIdentStyle Question
+highlight default link modula2StringLiteralStyle String
+highlight default link modula2CommentStyle Comment
+highlight default link modula2PragmaStyle PreProc
+highlight default link modula2DialectTagStyle SpecialComment
+highlight default link modula2TechDebtMarkerStyle SpecialComment
+highlight default link modula2ReswordStyle Keyword
+highlight default link modula2HeaderIdentStyle Function
+highlight default link modula2UserDefIdentStyle Normal
+highlight default link modula2NumericLiteralStyle Number
+highlight default link modula2PunctuationStyle Delimiter
+highlight default link modula2CommentKeyStyle SpecialComment
+highlight default link modula2DisabledCodeStyle NonText
+
+" -----------------------------------------------------------------------------
+" Assign Rendering Styles
+" -----------------------------------------------------------------------------
+
+" headers
+highlight default link modula2ModuleIdent modula2HeaderIdentStyle
+highlight default link modula2ProcedureIdent modula2HeaderIdentStyle
+highlight default link modula2ModuleHeader Normal
+highlight default link modula2ModuleTail Normal
+highlight default link modula2ProcedureHeader Normal
+highlight default link modula2ProcedureTail Normal
+
+" lowline identifiers are rendered as errors if g:modula2_iso_allow_lowline is unset
+if exists("g:modula2_iso_allow_lowline")
+ if g:modula2_iso_allow_lowline != 0
+ highlight default link modula2ProcedureLowlineIdent modula2HeaderIdentStyle
+ else
+ highlight default link modula2ProcedureLowlineIdent Error
+ endif
+else
+ highlight default link modula2ProcedureLowlineIdent modula2HeaderIdentStyle
+endif
+
+" reserved words
+highlight default link modula2Resword modula2ReswordStyle
+highlight default link modula2ReswordModule modula2ReswordStyle
+highlight default link modula2ReswordProcedure modula2ReswordStyle
+highlight default link modula2ReswordEnd modula2ReswordStyle
+
+" predefined identifiers
+highlight default link modula2ConstIdent modula2ConstIdentStyle
+highlight default link modula2TypeIdent modula2TypeIdentStyle
+highlight default link modula2ProcIdent modula2ProcIdentStyle
+highlight default link modula2FuncIdent modula2FuncIdentStyle
+highlight default link modula2MacroIdent modula2MacroIdentStyle
+
+" unsafe and non-portable identifiers
+highlight default link modula2UnsafeIdent modula2UnsafeIdentStyle
+highlight default link modula2NonPortableIdent modula2NonPortableIdentStyle
+
+" user defined identifiers
+highlight default link modula2Ident modula2UserDefIdentStyle
+
+" lowline identifiers are rendered as errors if g:modula2_iso_allow_lowline is unset
+if exists("g:modula2_iso_allow_lowline")
+ if g:modula2_iso_allow_lowline != 0
+ highlight default link modula2LowLineIdent modula2UserDefIdentStyle
+ else
+ highlight default link modula2LowLineIdent Error
+ endif
+else
+ highlight default link modula2LowLineIdent modula2UserDefIdentStyle
+endif
+
+" literals
+highlight default link modula2String modula2StringLiteralStyle
+highlight default link modula2Num modula2NumericLiteralStyle
+
+" octal literals are rendered as errors if g:modula2_iso_disallow_octals is set
+if exists("g:modula2_iso_disallow_octals")
+ if g:modula2_iso_disallow_octals != 0
+ highlight default link modula2Octal Error
+ else
+ highlight default link modula2Octal modula2NumericLiteralStyle
+ endif
+else
+ highlight default link modula2Octal modula2NumericLiteralStyle
+endif
+
+" punctuation
+highlight default link modula2Punctuation modula2PunctuationStyle
+
+" synonyms & and ~ are rendered as errors if g:modula2_iso_disallow_synonyms is set
+if exists("g:modula2_iso_disallow_synonyms")
+ if g:modula2_iso_disallow_synonyms != 0
+ highlight default link modula2Synonym Error
+ else
+ highlight default link modula2Synonym modula2PunctuationStyle
+ endif
+else
+ highlight default link modula2Synonym modula2PunctuationStyle
+endif
+
+" pragmas
+highlight default link modula2Pragma modula2PragmaStyle
+highlight default link modula2DialectTag modula2DialectTagStyle
+
+" comments
+highlight default link modula2Comment modula2CommentStyle
+highlight default link modula2CommentKey modula2CommentKeyStyle
+
+" technical debt markers
+highlight default link modula2TechDebtMarker modula2TechDebtMarkerStyle
+
+" disabled code
+highlight default link modula2DisabledCode modula2DisabledCodeStyle
+
+" illegal symbols
+highlight default link modula2IllegalChar Error
+highlight default link modula2IllegalIdent Error
+
+
+let b:current_syntax = "modula2"
+
+" vim: ts=4
+
+" END OF FILE
diff --git a/runtime/syntax/modula2/opt/pim.vim b/runtime/syntax/modula2/opt/pim.vim
new file mode 100644
index 0000000000..1626db91cf
--- /dev/null
+++ b/runtime/syntax/modula2/opt/pim.vim
@@ -0,0 +1,377 @@
+" Vim syntax file
+" Language: Modula-2 (PIM)
+" Maintainer: B.Kowarsch <trijezdci@moc.liamg>
+" Last Change: 2016 August 22
+
+" ----------------------------------------------------
+" THIS FILE IS LICENSED UNDER THE VIM LICENSE
+" see https://github.com/vim/vim/blob/master/LICENSE
+" ----------------------------------------------------
+
+" Remarks:
+" Vim Syntax files are available for the following Modula-2 dialects:
+" * for the PIM dialect : m2pim.vim (this file)
+" * for the ISO dialect : m2iso.vim
+" * for the R10 dialect : m2r10.vim
+
+" -----------------------------------------------------------------------------
+" This syntax description follows the 3rd and 4th editions of N.Wirth's Book
+" Programming in Modula-2 (aka PIM) plus the following language extensions:
+" * non-leading, non-trailing, non-consecutive lowlines _ in identifiers
+" * widely supported non-standard types BYTE, LONGCARD and LONGBITSET
+" * non-nesting code disabling tags ?< and >? at the start of a line
+" -----------------------------------------------------------------------------
+
+" Parameters:
+"
+" Vim's filetype script recognises Modula-2 dialect tags within the first 200
+" lines of Modula-2 .def and .mod input files. The script sets filetype and
+" dialect automatically when a valid dialect tag is found in the input file.
+" The dialect tag for the PIM dialect is (*!m2pim*). It is recommended to put
+" the tag immediately after the module header in the Modula-2 input file.
+"
+" Example:
+" DEFINITION MODULE Foolib; (*!m2pim*)
+"
+" Variable g:modula2_default_dialect sets the default Modula-2 dialect when the
+" dialect cannot be determined from the contents of the Modula-2 input file:
+" if defined and set to 'm2pim', the default dialect is PIM.
+"
+" Variable g:modula2_pim_allow_lowline controls support for lowline in identifiers:
+" if defined and set to a non-zero value, they are recognised, otherwise not
+"
+" Variable g:modula2_pim_disallow_octals controls the rendering of octal literals:
+" if defined and set to a non-zero value, they are rendered as errors.
+"
+" Variable g:modula2_pim_disallow_synonyms controls the rendering of & and ~:
+" if defined and set to a non-zero value, they are rendered as errors.
+"
+" Variables may be defined in Vim startup file .vimrc
+"
+" Examples:
+" let g:modula2_default_dialect = 'm2pim'
+" let g:modula2_pim_allow_lowline = 1
+" let g:modula2_pim_disallow_octals = 1
+" let g:modula2_pim_disallow_synonyms = 1
+
+
+if exists("b:current_syntax")
+ finish
+endif
+
+" Modula-2 is case sensitive
+syn case match
+
+
+" -----------------------------------------------------------------------------
+" Reserved Words
+" -----------------------------------------------------------------------------
+syn keyword modula2Resword AND ARRAY BEGIN BY CASE CONST DEFINITION DIV DO ELSE
+syn keyword modula2Resword ELSIF EXIT EXPORT FOR FROM IF IMPLEMENTATION IMPORT
+syn keyword modula2Resword IN LOOP MOD NOT OF OR POINTER QUALIFIED RECORD REPEAT
+syn keyword modula2Resword RETURN SET THEN TO TYPE UNTIL VAR WHILE WITH
+
+
+" -----------------------------------------------------------------------------
+" Builtin Constant Identifiers
+" -----------------------------------------------------------------------------
+syn keyword modula2ConstIdent FALSE NIL TRUE
+
+
+" -----------------------------------------------------------------------------
+" Builtin Type Identifiers
+" -----------------------------------------------------------------------------
+syn keyword modula2TypeIdent BITSET BOOLEAN CHAR PROC
+syn keyword modula2TypeIdent CARDINAL INTEGER LONGINT REAL LONGREAL
+
+
+" -----------------------------------------------------------------------------
+" Builtin Procedure and Function Identifiers
+" -----------------------------------------------------------------------------
+syn keyword modula2ProcIdent CAP DEC EXCL HALT INC INCL
+syn keyword modula2FuncIdent ABS CHR FLOAT HIGH MAX MIN ODD ORD SIZE TRUNC VAL
+
+
+" -----------------------------------------------------------------------------
+" Wirthian Macro Identifiers
+" -----------------------------------------------------------------------------
+syn keyword modula2MacroIdent NEW DISPOSE
+
+
+" -----------------------------------------------------------------------------
+" Unsafe Facilities via Pseudo-Module SYSTEM
+" -----------------------------------------------------------------------------
+syn keyword modula2UnsafeIdent ADDRESS PROCESS WORD
+syn keyword modula2UnsafeIdent ADR TSIZE NEWPROCESS TRANSFER SYSTEM
+
+
+" -----------------------------------------------------------------------------
+" Non-Portable Language Extensions
+" -----------------------------------------------------------------------------
+syn keyword modula2NonPortableIdent BYTE LONGCARD LONGBITSET
+
+
+" -----------------------------------------------------------------------------
+" User Defined Identifiers
+" -----------------------------------------------------------------------------
+syn match modula2Ident "[a-zA-Z][a-zA-Z0-9]*\(_\)\@!"
+syn match modula2LowLineIdent "[a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)\+"
+
+
+" -----------------------------------------------------------------------------
+" String Literals
+" -----------------------------------------------------------------------------
+syn region modula2String start=/"/ end=/"/ oneline
+syn region modula2String start=/'/ end=/'/ oneline
+
+
+" -----------------------------------------------------------------------------
+" Numeric Literals
+" -----------------------------------------------------------------------------
+syn match modula2Num
+ \ "\(\([0-7]\+\)[BC]\@!\|[89]\)[0-9]*\(\.[0-9]\+\([eE][+-]\?[0-9]\+\)\?\)\?"
+syn match modula2Num "[0-9A-F]\+H"
+syn match modula2Octal "[0-7]\+[BC]"
+
+
+" -----------------------------------------------------------------------------
+" Punctuation
+" -----------------------------------------------------------------------------
+syn match modula2Punctuation
+ \ "\.\|[,:;]\|\*\|[/+-]\|\#\|[=<>]\|\^\|\[\|\]\|(\(\*\)\@!\|[){}]"
+syn match modula2Synonym "[&~]"
+
+
+" -----------------------------------------------------------------------------
+" Pragmas
+" -----------------------------------------------------------------------------
+syn region modula2Pragma start="(\*\$" end="\*)"
+syn match modula2DialectTag "(\*!m2pim\(+[a-z0-9]\+\)\?\*)"
+
+" -----------------------------------------------------------------------------
+" Block Comments
+" -----------------------------------------------------------------------------
+syn region modula2Comment start="(\*\(\$\|!m2pim\(+[a-z0-9]\+\)\?\*)\)\@!" end="\*)"
+ \ contains = modula2Comment, modula2CommentKey, modula2TechDebtMarker
+syn match modula2CommentKey "[Aa]uthor[s]\?\|[Cc]opyright\|[Ll]icense\|[Ss]ynopsis"
+syn match modula2CommentKey "\([Pp]re\|[Pp]ost\|[Ee]rror\)\-condition[s]\?:"
+
+
+" -----------------------------------------------------------------------------
+" Technical Debt Markers
+" -----------------------------------------------------------------------------
+syn keyword modula2TechDebtMarker contained DEPRECATED FIXME
+syn match modula2TechDebtMarker "TODO[:]\?" contained
+
+" -----------------------------------------------------------------------------
+" Disabled Code Sections
+" -----------------------------------------------------------------------------
+syn region modula2DisabledCode start="^?<" end="^>?"
+
+
+" -----------------------------------------------------------------------------
+" Headers
+" -----------------------------------------------------------------------------
+" !!! this section must be second last !!!
+
+" new module header
+syn match modula2ModuleHeader
+ \ "MODULE\( [A-Z][a-zA-Z0-9]*\)\?"
+ \ contains = modula2ReswordModule, modula2ModuleIdent
+
+syn match modula2ModuleIdent
+ \ "[A-Z][a-zA-Z0-9]*" contained
+
+syn match modula2ModuleTail
+ \ "END [A-Z][a-zA-Z0-9]*\.$"
+ \ contains = modula2ReswordEnd, modula2ModuleIdent, modula2Punctuation
+
+" new procedure header
+syn match modula2ProcedureHeader
+ \ "PROCEDURE\( [a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)*\)\?"
+ \ contains = modula2ReswordProcedure,
+ \ modula2ProcedureIdent, modula2ProcedureLowlineIdent, modula2IllegalChar, modula2IllegalIdent
+
+syn match modula2ProcedureIdent
+ \ "\([a-zA-Z]\)\([a-zA-Z0-9]*\)" contained
+
+syn match modula2ProcedureLowlineIdent
+ \ "[a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)\+" contained
+
+syn match modula2ProcedureTail
+ \ "END\( \([a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)*\)[.;]$\)\?"
+ \ contains = modula2ReswordEnd,
+ \ modula2ProcedureIdent, modula2ProcedureLowLineIdent,
+ \ modula2Punctuation, modula2IllegalChar, modula2IllegalIdent
+
+syn keyword modula2ReswordModule contained MODULE
+syn keyword modula2ReswordProcedure contained PROCEDURE
+syn keyword modula2ReswordEnd contained END
+
+
+" -----------------------------------------------------------------------------
+" Illegal Symbols
+" -----------------------------------------------------------------------------
+" !!! this section must be last !!!
+
+" any '`' '!' '@ ''$' '%' or '\'
+syn match modula2IllegalChar "[`!@$%\\]"
+
+" any solitary sequence of '_'
+syn match modula2IllegalChar "\<_\+\>"
+
+" any '?' at start of line if not followed by '<'
+syn match modula2IllegalChar "^?\(<\)\@!"
+
+" any '?' not following '>' at start of line
+syn match modula2IllegalChar "\(\(^>\)\|\(^\)\)\@<!?"
+
+" any identifiers with leading occurrences of '_'
+syn match modula2IllegalIdent "_\+[a-zA-Z][a-zA-Z0-9]*\(_\+[a-zA-Z0-9]*\)*"
+
+" any identifiers containing consecutive occurences of '_'
+syn match modula2IllegalIdent
+ \ "[a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)*\(__\+[a-zA-Z0-9]\+\(_[a-zA-Z0-9]\+\)*\)\+"
+
+" any identifiers with trailing occurrences of '_'
+syn match modula2IllegalIdent "[a-zA-Z][a-zA-Z0-9]*\(_\+[a-zA-Z0-9]\+\)*_\+\>"
+
+
+" -----------------------------------------------------------------------------
+" Define Rendering Styles
+" -----------------------------------------------------------------------------
+
+" highlight default link modula2PredefIdentStyle Keyword
+" highlight default link modula2ConstIdentStyle modula2PredefIdentStyle
+" highlight default link modula2TypeIdentStyle modula2PredefIdentStyle
+" highlight default link modula2ProcIdentStyle modula2PredefIdentStyle
+" highlight default link modula2FuncIdentStyle modula2PredefIdentStyle
+" highlight default link modula2MacroIdentStyle modula2PredefIdentStyle
+
+highlight default link modula2ConstIdentStyle Constant
+highlight default link modula2TypeIdentStyle Type
+highlight default link modula2ProcIdentStyle Function
+highlight default link modula2FuncIdentStyle Function
+highlight default link modula2MacroIdentStyle Function
+highlight default link modula2UnsafeIdentStyle Question
+highlight default link modula2NonPortableIdentStyle Question
+highlight default link modula2StringLiteralStyle String
+highlight default link modula2CommentStyle Comment
+highlight default link modula2PragmaStyle PreProc
+highlight default link modula2DialectTagStyle SpecialComment
+highlight default link modula2TechDebtMarkerStyle SpecialComment
+highlight default link modula2ReswordStyle Keyword
+highlight default link modula2HeaderIdentStyle Function
+highlight default link modula2UserDefIdentStyle Normal
+highlight default link modula2NumericLiteralStyle Number
+highlight default link modula2PunctuationStyle Delimiter
+highlight default link modula2CommentKeyStyle SpecialComment
+highlight default link modula2DisabledCodeStyle NonText
+
+" -----------------------------------------------------------------------------
+" Assign Rendering Styles
+" -----------------------------------------------------------------------------
+
+" headers
+highlight default link modula2ModuleIdent modula2HeaderIdentStyle
+highlight default link modula2ProcedureIdent modula2HeaderIdentStyle
+highlight default link modula2ModuleHeader Normal
+highlight default link modula2ModuleTail Normal
+highlight default link modula2ProcedureHeader Normal
+highlight default link modula2ProcedureTail Normal
+
+" lowline identifiers are rendered as errors if g:modula2_pim_allow_lowline is unset
+if exists("g:modula2_pim_allow_lowline")
+ if g:modula2_pim_allow_lowline != 0
+ highlight default link modula2ProcedureLowlineIdent modula2HeaderIdentStyle
+ else
+ highlight default link modula2ProcedureLowlineIdent Error
+ endif
+else
+ highlight default link modula2ProcedureLowlineIdent Error
+endif
+
+" reserved words
+highlight default link modula2Resword modula2ReswordStyle
+highlight default link modula2ReswordModule modula2ReswordStyle
+highlight default link modula2ReswordProcedure modula2ReswordStyle
+highlight default link modula2ReswordEnd modula2ReswordStyle
+
+" predefined identifiers
+highlight default link modula2ConstIdent modula2ConstIdentStyle
+highlight default link modula2TypeIdent modula2TypeIdentStyle
+highlight default link modula2ProcIdent modula2ProcIdentStyle
+highlight default link modula2FuncIdent modula2FuncIdentStyle
+highlight default link modula2MacroIdent modula2MacroIdentStyle
+
+" unsafe and non-portable identifiers
+highlight default link modula2UnsafeIdent modula2UnsafeIdentStyle
+highlight default link modula2NonPortableIdent modula2NonPortableIdentStyle
+
+" user defined identifiers
+highlight default link modula2Ident modula2UserDefIdentStyle
+
+" lowline identifiers are rendered as errors if g:modula2_pim_allow_lowline is unset
+if exists("g:modula2_pim_allow_lowline")
+ if g:modula2_pim_allow_lowline != 0
+ highlight default link modula2LowLineIdent modula2UserDefIdentStyle
+ else
+ highlight default link modula2LowLineIdent Error
+ endif
+else
+ highlight default link modula2LowLineIdent Error
+endif
+
+" literals
+highlight default link modula2String modula2StringLiteralStyle
+highlight default link modula2Num modula2NumericLiteralStyle
+
+" octal literals are rendered as errors if g:modula2_pim_disallow_octals is set
+if exists("g:modula2_pim_disallow_octals")
+ if g:modula2_pim_disallow_octals != 0
+ highlight default link modula2Octal Error
+ else
+ highlight default link modula2Octal modula2NumericLiteralStyle
+ endif
+else
+ highlight default link modula2Octal modula2NumericLiteralStyle
+endif
+
+" punctuation
+highlight default link modula2Punctuation modula2PunctuationStyle
+
+" synonyms & and ~ are rendered as errors if g:modula2_pim_disallow_synonyms is set
+if exists("g:modula2_pim_disallow_synonyms")
+ if g:modula2_pim_disallow_synonyms != 0
+ highlight default link modula2Synonym Error
+ else
+ highlight default link modula2Synonym modula2PunctuationStyle
+ endif
+else
+ highlight default link modula2Synonym modula2PunctuationStyle
+endif
+
+" pragmas
+highlight default link modula2Pragma modula2PragmaStyle
+highlight default link modula2DialectTag modula2DialectTagStyle
+
+" comments
+highlight default link modula2Comment modula2CommentStyle
+highlight default link modula2CommentKey modula2CommentKeyStyle
+
+" technical debt markers
+highlight default link modula2TechDebtMarker modula2TechDebtMarkerStyle
+
+" disabled code
+highlight default link modula2DisabledCode modula2DisabledCodeStyle
+
+" illegal symbols
+highlight default link modula2IllegalChar Error
+highlight default link modula2IllegalIdent Error
+
+
+let b:current_syntax = "modula2"
+
+" vim: ts=4
+
+" END OF FILE
diff --git a/runtime/syntax/modula2/opt/r10.vim b/runtime/syntax/modula2/opt/r10.vim
new file mode 100644
index 0000000000..775f498dfb
--- /dev/null
+++ b/runtime/syntax/modula2/opt/r10.vim
@@ -0,0 +1,452 @@
+" Vim syntax file
+" Language: Modula-2 (R10)
+" Maintainer: B.Kowarsch <trijezdci@moc.liamg>
+" Last Change: 2020 June 18 (moved repository from bb to github)
+
+" ----------------------------------------------------
+" THIS FILE IS LICENSED UNDER THE VIM LICENSE
+" see https://github.com/vim/vim/blob/master/LICENSE
+" ----------------------------------------------------
+
+" Remarks:
+" Vim Syntax files are available for the following Modula-2 dialects:
+" * for the PIM dialect : m2pim.vim
+" * for the ISO dialect : m2iso.vim
+" * for the R10 dialect : m2r10.vim (this file)
+
+" -----------------------------------------------------------------------------
+" This syntax description follows the Modula-2 Revision 2010 language report
+" (Kowarsch and Sutcliffe, 2015) available at http://modula-2.info/m2r10.
+" -----------------------------------------------------------------------------
+
+" Parameters:
+"
+" Vim's filetype script recognises Modula-2 dialect tags within the first 200
+" lines of Modula-2 .def and .mod input files. The script sets filetype and
+" dialect automatically when a valid dialect tag is found in the input file.
+" The dialect tag for the R10 dialect is (*!m2r10*). It is recommended to put
+" the tag immediately after the module header in the Modula-2 input file.
+"
+" Example:
+" DEFINITION MODULE Foolib; (*!m2r10*)
+"
+" Variable g:modula2_default_dialect sets the default Modula-2 dialect when the
+" dialect cannot be determined from the contents of the Modula-2 input file:
+" if defined and set to 'm2r10', the default dialect is R10.
+"
+" Variable g:modula2_r10_allow_lowline controls support for lowline in identifiers:
+" if defined and set to a non-zero value, they are recognised, otherwise not
+"
+" Variables may be defined in Vim startup file .vimrc
+"
+" Examples:
+" let g:modula2_default_dialect = 'm2r10'
+" let g:modula2_r10_allow_lowline = 1
+
+
+if exists("b:current_syntax")
+ finish
+endif
+
+" Modula-2 is case sensitive
+syn case match
+
+
+" -----------------------------------------------------------------------------
+" Reserved Words
+" -----------------------------------------------------------------------------
+" Note: MODULE, PROCEDURE and END are defined separately further below
+syn keyword modula2Resword ALIAS AND ARGLIST ARRAY BEGIN CASE CONST COPY DEFINITION
+syn keyword modula2Resword DIV DO ELSE ELSIF EXIT FOR FROM GENLIB IF IMPLEMENTATION
+syn keyword modula2Resword IMPORT IN LOOP MOD NEW NOT OF OPAQUE OR POINTER READ
+syn keyword modula2Resword RECORD RELEASE REPEAT RETAIN RETURN SET THEN TO TYPE
+syn keyword modula2Resword UNTIL VAR WHILE WRITE YIELD
+
+
+" -----------------------------------------------------------------------------
+" Schroedinger's Tokens
+" -----------------------------------------------------------------------------
+syn keyword modula2SchroedToken CAPACITY COROUTINE LITERAL
+
+
+" -----------------------------------------------------------------------------
+" Builtin Constant Identifiers
+" -----------------------------------------------------------------------------
+syn keyword modula2ConstIdent NIL FALSE TRUE
+
+
+" -----------------------------------------------------------------------------
+" Builtin Type Identifiers
+" -----------------------------------------------------------------------------
+syn keyword modula2TypeIdent BOOLEAN CHAR UNICHAR OCTET
+syn keyword modula2TypeIdent CARDINAL LONGCARD INTEGER LONGINT REAL LONGREAL
+
+
+" -----------------------------------------------------------------------------
+" Builtin Procedure and Function Identifiers
+" -----------------------------------------------------------------------------
+syn keyword modula2ProcIdent APPEND INSERT REMOVE SORT SORTNEW
+syn keyword modula2FuncIdent CHR ORD ODD ABS SGN MIN MAX LOG2 POW2 ENTIER
+syn keyword modula2FuncIdent PRED SUCC PTR COUNT LENGTH
+
+
+" -----------------------------------------------------------------------------
+" Builtin Macro Identifiers
+" -----------------------------------------------------------------------------
+syn keyword modula2MacroIdent NOP TMIN TMAX TSIZE TLIMIT
+
+
+" -----------------------------------------------------------------------------
+" Builtin Primitives
+" -----------------------------------------------------------------------------
+syn keyword modula2PrimitiveIdent SXF VAL STORE VALUE SEEK SUBSET
+
+
+" -----------------------------------------------------------------------------
+" Unsafe Facilities via Pseudo-Module UNSAFE
+" -----------------------------------------------------------------------------
+syn keyword modula2UnsafeIdent UNSAFE BYTE WORD LONGWORD OCTETSEQ
+syn keyword modula2UnsafeIdent ADD SUB INC DEC SETBIT HALT
+syn keyword modula2UnsafeIdent ADR CAST BIT SHL SHR BWNOT BWAND BWOR
+
+
+" -----------------------------------------------------------------------------
+" Non-Portable Language Extensions
+" -----------------------------------------------------------------------------
+syn keyword modula2NonPortableIdent ASSEMBLER ASM REG
+
+
+" -----------------------------------------------------------------------------
+" User Defined Identifiers
+" -----------------------------------------------------------------------------
+syn match modula2Ident "[a-zA-Z][a-zA-Z0-9]*\(_\)\@!"
+syn match modula2LowLineIdent "[a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)\+"
+
+syn match modula2ReswordDo "\(TO\)\@<!DO"
+syn match modula2ReswordTo "TO\(\sDO\)\@!"
+
+" TODO: support for OpenVMS reswords and identifiers which may include $ and %
+
+
+" -----------------------------------------------------------------------------
+" String Literals
+" -----------------------------------------------------------------------------
+syn region modula2String start=/"/ end=/"/ oneline
+syn region modula2String start="\(^\|\s\|[({=<>&#,]\|\[\)\@<='" end=/'/ oneline
+
+
+" -----------------------------------------------------------------------------
+" Numeric Literals
+" -----------------------------------------------------------------------------
+syn match modula2Base2Num "0b[01]\+\('[01]\+\)*"
+syn match modula2Base16Num "0[ux][0-9A-F]\+\('[0-9A-F]\+\)*"
+
+"| *** VMSCRIPT BUG ALERT ***
+"| The regular expression below causes errors when split into separate strings
+"|
+"| syn match modula2Base10Num
+"| \ "\(\(0[bux]\@!\|[1-9]\)[0-9]*\('[0-9]\+\)*\)" .
+"| \ "\(\.[0-9]\+\('[0-9]\+\)*\(e[+-]\?[0-9]\+\('[0-9]\+\)*\)\?\)\?"
+"|
+"| E475: Invalid argument: modula2Base10Num "\(\(0[bux]\@!\|[1-9]\)[0-9]*\('[0-9]\+\)*\)"
+"| . "\(\.[0-9]\+\('[0-9]\+\)*\(e[+-]\?[0-9]\+\('[0-9]\+\)*\)\?\)\?"
+"|
+"| However, the same regular expression works just fine as a sole string.
+"|
+"| As a consequence, we have no choice but to put it all into a single line
+"| which greatly diminishes readability and thereby increases the opportunity
+"| for error during maintenance. Ideally, regular expressions should be split
+"| into small human readable pieces with interleaved comments that explain
+"| precisely what each piece is doing. Vimscript imposes poor design. :-(
+
+syn match modula2Base10Num
+ \ "\(\(0[bux]\@!\|[1-9]\)[0-9]*\('[0-9]\+\)*\)\(\.[0-9]\+\('[0-9]\+\)*\(e[+-]\?[0-9]\+\('[0-9]\+\)*\)\?\)\?"
+
+
+" -----------------------------------------------------------------------------
+" Punctuation
+" -----------------------------------------------------------------------------
+syn match modula2Punctuation
+ \ "\.\|[,:;]\|\*\|[/+-]\|\#\|[=<>&]\|\^\|\[\|\]\|(\(\*\)\@!\|[){}]"
+
+
+" -----------------------------------------------------------------------------
+" Pragmas
+" -----------------------------------------------------------------------------
+syn region modula2Pragma start="<\*" end="\*>"
+ \ contains = modula2PragmaKey, modula2TechDebtPragma
+syn keyword modula2PragmaKey contained MSG IF ELSIF ELSE END INLINE NOINLINE OUT
+syn keyword modula2PragmaKey contained GENERATED ENCODING ALIGN PADBITS NORETURN
+syn keyword modula2PragmaKey contained PURITY SINGLEASSIGN LOWLATENCY VOLATILE
+syn keyword modula2PragmaKey contained FORWARD ADDR FFI FFIDENT
+
+syn match modula2DialectTag "(\*!m2r10\(+[a-z0-9]\+\)\?\*)"
+
+
+" -----------------------------------------------------------------------------
+" Line Comments
+" -----------------------------------------------------------------------------
+syn region modula2Comment start=/^!/ end=/$/ oneline
+
+
+" -----------------------------------------------------------------------------
+" Block Comments
+" -----------------------------------------------------------------------------
+syn region modula2Comment
+ \ start="\(END\s\)\@<!(\*\(!m2r10\(+[a-z0-9]\+\)\?\*)\)\@!" end="\*)"
+ \ contains = modula2Comment, modula2CommentKey, modula2TechDebtMarker
+
+syn match modula2CommentKey
+ \ "[Aa]uthor[s]\?\|[Cc]opyright\|[Ll]icense\|[Ss]ynopsis" contained
+syn match modula2CommentKey
+ \ "\([Pp]re\|[Pp]ost\|[Ee]rror\)\-condition[s]\?:" contained
+
+
+" -----------------------------------------------------------------------------
+" Block Statement Tails
+" -----------------------------------------------------------------------------
+syn match modula2ReswordEnd
+ \ "END" nextgroup = modula2StmtTailComment skipwhite
+syn match modula2StmtTailComment
+ \ "(\*\s\(IF\|CASE\|FOR\|LOOP\|WHILE\)\s\*)" contained
+
+
+" -----------------------------------------------------------------------------
+" Technical Debt Markers
+" -----------------------------------------------------------------------------
+syn match modula2ToDoHeader "TO DO"
+
+syn match modula2ToDoTail
+ \ "END\(\s(\*\sTO DO\s\*)\)\@=" nextgroup = modula2ToDoTailComment skipwhite
+syntax match modula2ToDoTailComment "(\*\sTO DO\s\*)" contained
+
+" contained within pragma
+syn keyword modula2TechDebtPragma contained DEPRECATED
+
+" contained within comment
+syn keyword modula2TechDebtMarker contained FIXME
+
+
+" -----------------------------------------------------------------------------
+" Disabled Code Sections
+" -----------------------------------------------------------------------------
+syn region modula2DisabledCode start="^?<" end="^>?"
+
+
+" -----------------------------------------------------------------------------
+" Headers
+" -----------------------------------------------------------------------------
+" !!! this section must be second last !!!
+
+" module header
+syn match modula2ModuleHeader
+ \ "\(MODULE\|BLUEPRINT\)\( [A-Z][a-zA-Z0-9]*\)\?"
+ \ contains = modula2ReswordModule, modula2ReswordBlueprint, modula2ModuleIdent
+
+syn match modula2ModuleIdent
+ \ "[A-Z][a-zA-Z0-9]*" contained
+
+syn match modula2ModuleTail
+ \ "END [A-Z][a-zA-Z0-9]*\.$"
+ \ contains = modula2ReswordEnd, modula2ModuleIdent, modula2Punctuation
+
+" procedure, sole occurrence
+syn match modula2ProcedureHeader
+ \ "PROCEDURE\(\s\[\|\s[a-zA-Z]\)\@!" contains = modula2ReswordProcedure
+
+" procedure header
+syn match modula2ProcedureHeader
+ \ "PROCEDURE [a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)*"
+ \ contains = modula2ReswordProcedure,
+ \ modula2ProcedureIdent, modula2ProcedureLowlineIdent, modula2IllegalChar, modula2IllegalIdent
+
+" procedure binding to operator
+syn match modula2ProcedureHeader
+ \ "PROCEDURE \[[+-\*/\\=<>]\] [a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)*"
+ \ contains = modula2ReswordProcedure, modula2Punctuation,
+ \ modula2ProcedureIdent, modula2ProcedureLowlineIdent, modula2IllegalChar, modula2IllegalIdent
+
+" procedure binding to builtin
+syn match modula2ProcedureHeader
+ \ "PROCEDURE \[[A-Z]\+\(:\([#\*,]\|++\|--\)\?\)\?\] [a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)*"
+ \ contains = modula2ReswordProcedure,
+ \ modula2Punctuation, modula2Resword, modula2SchroedToken,
+ \ modula2ProcIdent, modula2FuncIdent, modula2PrimitiveIdent,
+ \ modula2ProcedureIdent, modula2ProcedureLowlineIdent, modula2IllegalChar, modula2IllegalIdent
+
+syn match modula2ProcedureIdent
+ \ "\([a-zA-Z]\)\([a-zA-Z0-9]*\)" contained
+
+syn match modula2ProcedureLowlineIdent
+ \ "[a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)\+" contained
+
+syn match modula2ProcedureTail
+ \ "END [a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)*;$"
+ \ contains = modula2ReswordEnd,
+ \ modula2ProcedureIdent, modula2ProcedureLowLineIdent,
+ \ modula2Punctuation, modula2IllegalChar, modula2IllegalIdent
+
+syn keyword modula2ReswordModule contained MODULE
+syn keyword modula2ReswordBlueprint contained BLUEPRINT
+syn keyword modula2ReswordProcedure contained PROCEDURE
+syn keyword modula2ReswordEnd contained END
+
+
+" -----------------------------------------------------------------------------
+" Illegal Symbols
+" -----------------------------------------------------------------------------
+" !!! this section must be last !!!
+
+" any '`' '~' '@' '$' '%'
+syn match modula2IllegalChar "[`~@$%]"
+
+" any solitary sequence of '_'
+syn match modula2IllegalChar "\<_\+\>"
+
+" any '?' at start of line if not followed by '<'
+syn match modula2IllegalChar "^?\(<\)\@!"
+
+" any '?' not following '>' at start of line
+syn match modula2IllegalChar "\(\(^>\)\|\(^\)\)\@<!?"
+
+" any identifiers with leading occurrences of '_'
+syn match modula2IllegalIdent "_\+[a-zA-Z][a-zA-Z0-9]*\(_\+[a-zA-Z0-9]*\)*"
+
+" any identifiers containing consecutive occurences of '_'
+syn match modula2IllegalIdent
+ \ "[a-zA-Z][a-zA-Z0-9]*\(_[a-zA-Z0-9]\+\)*\(__\+[a-zA-Z0-9]\+\(_[a-zA-Z0-9]\+\)*\)\+"
+
+" any identifiers with trailing occurrences of '_'
+syn match modula2IllegalIdent "[a-zA-Z][a-zA-Z0-9]*\(_\+[a-zA-Z0-9]\+\)*_\+\>"
+
+
+" -----------------------------------------------------------------------------
+" Define Rendering Styles
+" -----------------------------------------------------------------------------
+
+" highlight default link modula2PredefIdentStyle Keyword
+" highlight default link modula2ConstIdentStyle modula2PredefIdentStyle
+" highlight default link modula2TypeIdentStyle modula2PredefIdentStyle
+" highlight default link modula2ProcIdentStyle modula2PredefIdentStyle
+" highlight default link modula2FuncIdentStyle modula2PredefIdentStyle
+" highlight default link modula2MacroIdentStyle modula2PredefIdentStyle
+
+highlight default link modula2ConstIdentStyle Constant
+highlight default link modula2TypeIdentStyle Type
+highlight default link modula2ProcIdentStyle Function
+highlight default link modula2FuncIdentStyle Function
+highlight default link modula2MacroIdentStyle Function
+highlight default link modula2PrimitiveIdentStyle Function
+highlight default link modula2UnsafeIdentStyle Question
+highlight default link modula2NonPortableIdentStyle Question
+highlight default link modula2StringLiteralStyle String
+highlight default link modula2CommentStyle Comment
+highlight default link modula2PragmaStyle PreProc
+highlight default link modula2PragmaKeyStyle PreProc
+highlight default link modula2DialectTagStyle SpecialComment
+highlight default link modula2TechDebtMarkerStyle SpecialComment
+highlight default link modula2ReswordStyle Keyword
+highlight default link modula2HeaderIdentStyle Function
+highlight default link modula2UserDefIdentStyle Normal
+highlight default link modula2NumericLiteralStyle Number
+highlight default link modula2PunctuationStyle Delimiter
+highlight default link modula2CommentKeyStyle SpecialComment
+highlight default link modula2DisabledCodeStyle NonText
+
+
+" -----------------------------------------------------------------------------
+" Assign Rendering Styles
+" -----------------------------------------------------------------------------
+
+" headers
+highlight default link modula2ModuleIdent modula2HeaderIdentStyle
+highlight default link modula2ProcedureIdent modula2HeaderIdentStyle
+highlight default link modula2ModuleHeader modula2HeaderIdentStyle
+highlight default link modula2ModuleTail Normal
+highlight default link modula2ProcedureHeader Normal
+highlight default link modula2ProcedureTail Normal
+
+" lowline identifiers are rendered as errors if g:modula2_r10_allow_lowline is unset
+if exists("g:modula2_r10_allow_lowline")
+ if g:modula2_r10_allow_lowline != 0
+ highlight default link modula2ProcedureLowlineIdent modula2HeaderIdentStyle
+ else
+ highlight default link modula2ProcedureLowlineIdent Error
+ endif
+else
+ highlight default link modula2ProcedureLowlineIdent modula2HeaderIdentStyle
+endif
+
+" reserved words
+highlight default link modula2Resword modula2ReswordStyle
+highlight default link modula2ReswordModule modula2ReswordStyle
+highlight default link modula2ReswordProcedure modula2ReswordStyle
+highlight default link modula2ReswordEnd modula2ReswordStyle
+highlight default link modula2ReswordDo modula2ReswordStyle
+highlight default link modula2ReswordTo modula2ReswordStyle
+highlight default link modula2SchroedToken modula2ReswordStyle
+
+" predefined identifiers
+highlight default link modula2ConstIdent modula2ConstIdentStyle
+highlight default link modula2TypeIdent modula2TypeIdentStyle
+highlight default link modula2ProcIdent modula2ProcIdentStyle
+highlight default link modula2FuncIdent modula2FuncIdentStyle
+highlight default link modula2MacroIdent modula2MacroIdentStyle
+highlight default link modula2PrimitiveIdent modula2PrimitiveIdentStyle
+
+" unsafe and non-portable identifiers
+highlight default link modula2UnsafeIdent modula2UnsafeIdentStyle
+highlight default link modula2NonPortableIdent modula2NonPortableIdentStyle
+
+" user defined identifiers
+highlight default link modula2Ident modula2UserDefIdentStyle
+
+" lowline identifiers are rendered as errors if g:modula2_r10_allow_lowline is unset
+if exists("g:modula2_r10_allow_lowline")
+ if g:modula2_r10_allow_lowline != 0
+ highlight default link modula2LowLineIdent modula2UserDefIdentStyle
+ else
+ highlight default link modula2LowLineIdent Error
+ endif
+else
+ highlight default link modula2LowLineIdent modula2UserDefIdentStyle
+endif
+
+" literals
+highlight default link modula2String modula2StringLiteralStyle
+highlight default link modula2Base2Num modula2NumericLiteralStyle
+highlight default link modula2Base10Num modula2NumericLiteralStyle
+highlight default link modula2Base16Num modula2NumericLiteralStyle
+
+" punctuation
+highlight default link modula2Punctuation modula2PunctuationStyle
+
+" pragmas
+highlight default link modula2Pragma modula2PragmaStyle
+highlight default link modula2PragmaKey modula2PragmaKeyStyle
+highlight default link modula2DialectTag modula2DialectTagStyle
+
+" comments
+highlight default link modula2Comment modula2CommentStyle
+highlight default link modula2CommentKey modula2CommentKeyStyle
+highlight default link modula2ToDoTailComment modula2CommentStyle
+highlight default link modula2StmtTailComment modula2CommentStyle
+
+" technical debt markers
+highlight default link modula2ToDoHeader modula2TechDebtMarkerStyle
+highlight default link modula2ToDoTail modula2TechDebtMarkerStyle
+highlight default link modula2TechDebtPragma modula2TechDebtMarkerStyle
+
+" disabled code
+highlight default link modula2DisabledCode modula2DisabledCodeStyle
+
+" illegal symbols
+highlight default link modula2IllegalChar Error
+highlight default link modula2IllegalIdent Error
+
+
+let b:current_syntax = "modula2"
+
+" vim: ts=4
+
+" END OF FILE
diff --git a/runtime/syntax/netrw.vim b/runtime/syntax/netrw.vim
index 1f02bbef78..f5b7fdc2c6 100644
--- a/runtime/syntax/netrw.vim
+++ b/runtime/syntax/netrw.vim
@@ -1,6 +1,8 @@
" Language : Netrw Listing Syntax
-" Maintainer : Charles E. Campbell
-" Last change: Nov 07, 2019
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Charles E. Campbell
+" Last Change: Nov 07, 2019
+" 2024 Feb 19 by Vim Project (announce adoption)
" Version : 20
" ---------------------------------------------------------------------
if exists("b:current_syntax")
diff --git a/runtime/syntax/odin.vim b/runtime/syntax/odin.vim
new file mode 100644
index 0000000000..4169ebb7d9
--- /dev/null
+++ b/runtime/syntax/odin.vim
@@ -0,0 +1,109 @@
+" Vim indent plugin file
+" Language: Odin
+" Maintainer: Maxim Kim <habamax@gmail.com>
+" Website: https://github.com/habamax/vim-odin
+" Last Change: 2024-01-15
+"
+" This file has been manually translated from Vim9 script.
+
+if exists("b:current_syntax")
+ finish
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+syntax keyword odinKeyword using transmute cast distinct opaque where dynamic
+syntax keyword odinKeyword struct enum union const bit_field bit_set
+syntax keyword odinKeyword package proc map import export foreign
+syntax keyword odinKeyword size_of offset_of type_info_of typeid_of type_of align_of
+syntax keyword odinKeyword return defer
+syntax keyword odinKeyword or_return or_else
+syntax keyword odinKeyword inline no_inline
+
+syntax keyword odinConditional if when else do for switch case continue break
+syntax keyword odinType string cstring bool b8 b16 b32 b64 rune any rawptr
+syntax keyword odinType f16 f32 f64 f16le f16be f32le f32be f64le f64be
+syntax keyword odinType u8 u16 u32 u64 u128 u16le u32le u64le u128le u16be
+syntax keyword odinType u32be u64be u128be uint uintptr i8 i16 i32 i64 i128
+syntax keyword odinType i16le i32le i64le i128le i16be i32be i64be i128be
+syntax keyword odinType int complex complex32 complex64 complex128 matrix typeid
+syntax keyword odinType quaternion quaternion64 quaternion128 quaternion256
+syntax keyword odinBool true false
+syntax keyword odinNull nil
+syntax match odinUninitialized '\s\+---\(\s\|$\)'
+
+syntax keyword odinOperator in notin not_in
+syntax match odinOperator "?" display
+syntax match odinOperator "->" display
+
+syntax match odinTodo "TODO" contained
+syntax match odinTodo "XXX" contained
+syntax match odinTodo "FIXME" contained
+syntax match odinTodo "HACK" contained
+
+syntax region odinRawString start=+`+ end=+`+
+syntax region odinChar start=+'+ skip=+\\\\\|\\'+ end=+'+
+syntax region odinString start=+"+ skip=+\\\\\|\\'+ end=+"+ contains=odinEscape
+syntax match odinEscape display contained /\\\([nrt\\'"]\|x\x\{2}\)/
+
+syntax match odinProcedure "\v<\w*>(\s*::\s*proc)@="
+
+syntax match odinAttribute "@\ze\<\w\+\>" display
+syntax region odinAttribute
+ \ matchgroup=odinAttribute
+ \ start="@\ze(" end="\ze)"
+ \ transparent oneline
+
+syntax match odinInteger "\-\?\<\d\+\>" display
+syntax match odinFloat "\-\?\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\%([eE][+-]\=[0-9_]\+\)\=" display
+syntax match odinHex "\<0[xX][0-9A-Fa-f]\+\>" display
+syntax match odinDoz "\<0[zZ][0-9a-bA-B]\+\>" display
+syntax match odinOct "\<0[oO][0-7]\+\>" display
+syntax match odinBin "\<0[bB][01]\+\>" display
+
+syntax match odinAddressOf "&" display
+syntax match odinDeref "\^" display
+
+syntax match odinMacro "#\<\w\+\>" display
+
+syntax match odinTemplate "$\<\w\+\>"
+
+syntax region odinLineComment start=/\/\// end=/$/ contains=@Spell,odinTodo
+syntax region odinBlockComment start=/\/\*/ end=/\*\// contains=@Spell,odinTodo,odinBlockComment
+syn sync ccomment odinBlockComment
+
+highlight def link odinKeyword Statement
+highlight def link odinConditional Conditional
+highlight def link odinOperator Operator
+
+highlight def link odinString String
+highlight def link odinRawString String
+highlight def link odinChar Character
+highlight def link odinEscape Special
+
+highlight def link odinProcedure Function
+
+highlight def link odinMacro PreProc
+
+highlight def link odinLineComment Comment
+highlight def link odinBlockComment Comment
+
+highlight def link odinTodo Todo
+
+highlight def link odinAttribute Statement
+highlight def link odinType Type
+highlight def link odinBool Boolean
+highlight def link odinNull Constant
+highlight def link odinUninitialized Constant
+highlight def link odinInteger Number
+highlight def link odinFloat Float
+highlight def link odinHex Number
+highlight def link odinOct Number
+highlight def link odinBin Number
+highlight def link odinDoz Number
+
+let b:current_syntax = "odin"
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/syntax/pacmanlog.vim b/runtime/syntax/pacmanlog.vim
new file mode 100644
index 0000000000..98abd58685
--- /dev/null
+++ b/runtime/syntax/pacmanlog.vim
@@ -0,0 +1,41 @@
+" Vim syntax file
+" Language: pacman.log
+" Maintainer: Ronan Pigott <ronan@rjp.ie>
+" Last Change: 2023 Dec 04
+
+if exists("b:current_syntax")
+ finish
+endif
+
+syn sync maxlines=1
+syn region pacmanlogMsg start='\S' end='$' keepend contains=pacmanlogTransaction,pacmanlogALPMMsg
+syn region pacmanlogTag start='\['hs=s+1 end='\]'he=e-1 keepend nextgroup=pacmanlogMsg
+syn region pacmanlogTime start='^\['hs=s+1 end='\]'he=e-1 keepend nextgroup=pacmanlogTag
+
+syn match pacmanlogPackageName '\v[a-z0-9@_+.-]+' contained skipwhite nextgroup=pacmanlogPackageVersion
+syn match pacmanlogPackageVersion '(.*)' contained
+
+syn match pacmanlogTransaction 'transaction \v(started|completed)$' contained
+syn match pacmanlogInstalled '\v(re)?installed' contained nextgroup=pacmanlogPackageName
+syn match pacmanlogUpgraded 'upgraded' contained nextgroup=pacmanlogPackageName
+syn match pacmanlogDowngraded 'downgraded' contained nextgroup=pacmanlogPackageName
+syn match pacmanlogRemoved 'removed' contained nextgroup=pacmanlogPackageName
+syn match pacmanlogWarning 'warning:.*$' contained
+
+syn region pacmanlogALPMMsg start='\v(\[ALPM\] )@<=(transaction|(re)?installed|upgraded|downgraded|removed|warning)>' end='$' contained
+ \ contains=pacmanlogTransaction,pacmanlogInstalled,pacmanlogUpgraded,pacmanlogDowngraded,pacmanlogRemoved,pacmanlogWarning,pacmanlogPackageName,pacmanlogPackgeVersion
+
+hi def link pacmanlogTime String
+hi def link pacmanlogTag Type
+
+hi def link pacmanlogTransaction Special
+hi def link pacmanlogInstalled Identifier
+hi def link pacmanlogRemoved Repeat
+hi def link pacmanlogUpgraded pacmanlogInstalled
+hi def link pacmanlogDowngraded pacmanlogRemoved
+hi def link pacmanlogWarning WarningMsg
+
+hi def link pacmanlogPackageName Normal
+hi def link pacmanlogPackageVersion Comment
+
+let b:current_syntax = "pacmanlog"
diff --git a/runtime/syntax/qf.vim b/runtime/syntax/qf.vim
index 6f2ea6a92e..3131caccd8 100644
--- a/runtime/syntax/qf.vim
+++ b/runtime/syntax/qf.vim
@@ -15,6 +15,12 @@ syn match qfSeparator "|" nextgroup=qfLineNr contained
syn match qfLineNr "[^|]*" contained contains=qfError
syn match qfError "error" contained
+" Hide file name and line number for help outline (TOC).
+if has_key(w:, 'qf_toc') || get(w:, 'quickfix_title') =~# '\<TOC$'
+ setlocal conceallevel=3 concealcursor=nc
+ syn match Ignore "^[^|]*|[^|]*| " conceal
+endif
+
" The default highlighting.
hi def link qfFileName Directory
hi def link qfLineNr LineNr
diff --git a/runtime/syntax/quarto.vim b/runtime/syntax/quarto.vim
index d5d4ee257d..f83071dd7f 100644
--- a/runtime/syntax/quarto.vim
+++ b/runtime/syntax/quarto.vim
@@ -1,7 +1,9 @@
" Language: Quarto (Markdown with chunks of R, Python and other languages)
-" Provisory Maintainer: Jakson Aquino <jalvesaq@gmail.com>
-" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Fri Feb 24, 2023 08:26AM
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
+" Former Repository: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: 2023 Feb 24 08:26AM
+" 2024 Feb 19 by Vim Project (announce adoption)
"
" The developers of tools for Quarto maintain Vim runtime files in their
" Github repository and, if required, I will hand over the maintenance of
diff --git a/runtime/syntax/query.lua b/runtime/syntax/query.lua
index 8f40b1cb8a..1e129dbeff 100644
--- a/runtime/syntax/query.lua
+++ b/runtime/syntax/query.lua
@@ -1,5 +1,5 @@
-- Neovim syntax file
--- Language: Tree-sitter query
+-- Language: Treesitter query
-- Last Change: 2022 Apr 13
-- it's a lisp!
diff --git a/runtime/syntax/r.vim b/runtime/syntax/r.vim
index 9b3754ae23..fa73194332 100644
--- a/runtime/syntax/r.vim
+++ b/runtime/syntax/r.vim
@@ -1,12 +1,14 @@
" Vim syntax file
" Language: R (GNU S)
-" Maintainer: Jakson Aquino <jalvesaq@gmail.com>
-" Former Maintainers: Vaidotas Zemlys <zemlys@gmail.com>
-" Tom Payne <tom@tompayne.org>
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainers: Jakson Aquino <jalvesaq@gmail.com>
+" Vaidotas Zemlys <zemlys@gmail.com>
+" Tom Payne <tom@tompayne.org>
" Contributor: Johannes Ranke <jranke@uni-bremen.de>
-" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Thu Nov 17, 2022 10:13PM
-" Filenames: *.R *.r *.Rhistory *.Rt
+" Former Repository: https://github.com/jalvesaq/R-Vim-runtime
+" Filenames: *.R *.r *.Rhistory *.Rt
+" Last Change: 2023 Dec 24 08:05AM
+" 2024 Feb 19 by Vim Project (announce adoption)
"
" NOTE: The highlighting of R functions might be defined in
" runtime files created by a filetype plugin, if installed.
@@ -26,11 +28,7 @@ if exists("b:current_syntax")
finish
endif
-if has("patch-7.4.1142")
- syn iskeyword @,48-57,_,.
-else
- setlocal iskeyword=@,48-57,_,.
-endif
+syn iskeyword @,48-57,_,.
" The variables g:r_hl_roxygen and g:r_syn_minlines were renamed on April 8, 2017.
if exists("g:r_hl_roxygen")
diff --git a/runtime/syntax/racket.vim b/runtime/syntax/racket.vim
index b1ed2b454c..fcd64a7c9b 100644
--- a/runtime/syntax/racket.vim
+++ b/runtime/syntax/racket.vim
@@ -4,7 +4,7 @@
" Previous Maintainer: Will Langstroth <will@langstroth.com>
" URL: https://github.com/benknoble/vim-racket
" Description: Contains all of the keywords in #lang racket
-" Last Change: 2022 Aug 12
+" Last Change: 2023 Sep 22
" Initializing:
if exists("b:current_syntax")
@@ -514,13 +514,13 @@ syntax region racketString start=/\%(\\\)\@<!"/ skip=/\\[\\"]/ end=/"/ contains=
syntax region racketString start=/#"/ skip=/\\[\\"]/ end=/"/ contains=racketStringEscapeError,racketStringEscape
if exists("racket_no_string_fold")
- syn region racketString start=/#<<\z(.*\)$/ end=/^\z1$/
+ syn region racketHereString start=/#<<\z(.*\)$/ end=/^\z1$/
else
- syn region racketString start=/#<<\z(.*\)$/ end=/^\z1$/ fold
+ syn region racketHereString start=/#<<\z(.*\)$/ end=/^\z1$/ fold
endif
-syntax cluster racketTop add=racketError,racketConstant,racketStruc,racketString
+syntax cluster racketTop add=racketError,racketConstant,racketStruc,racketString,racketHereString
" Numbers
@@ -623,6 +623,7 @@ highlight default link racketFunc Function
highlight default link racketString String
highlight default link racketStringEscape Special
+highlight default link racketHereString String
highlight default link racketUStringEscape Special
highlight default link racketStringEscapeError Error
highlight default link racketChar Character
diff --git a/runtime/syntax/rhelp.vim b/runtime/syntax/rhelp.vim
index 8cac585bb0..7407538e4c 100644
--- a/runtime/syntax/rhelp.vim
+++ b/runtime/syntax/rhelp.vim
@@ -1,9 +1,11 @@
" Vim syntax file
" Language: R Help File
-" Maintainer: Jakson Aquino <jalvesaq@gmail.com>
-" Former Maintainer: Johannes Ranke <jranke@uni-bremen.de>
-" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Tue Jun 28, 2016 08:53AM
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainers: Jakson Aquino <jalvesaq@gmail.com>
+" Johannes Ranke <jranke@uni-bremen.de>
+" Former Repository: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: 2016 Jun 28 08:53AM
+" 2024 Feb 19 by Vim Project (announce adoption)
" Remarks: - Includes R syntax highlighting in the appropriate
" sections if an r.vim file is in the same directory or in the
" default debian location.
diff --git a/runtime/syntax/rmd.vim b/runtime/syntax/rmd.vim
index 93343dd729..4b4db1e783 100644
--- a/runtime/syntax/rmd.vim
+++ b/runtime/syntax/rmd.vim
@@ -1,7 +1,9 @@
" Language: Markdown with chunks of R, Python and other languages
-" Maintainer: Jakson Aquino <jalvesaq@gmail.com>
-" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Wed May 17, 2023 06:34AM
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
+" Former Repository: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: 2023 Dec 24 07:21AM
+" 2024 Feb 19 by Vim Project (announce adoption)
"
" For highlighting pandoc extensions to markdown like citations and TeX and
" many other advanced features like folding of markdown sections, it is
@@ -16,6 +18,13 @@ endif
let s:cpo_save = &cpo
set cpo&vim
+let g:rmd_include_latex = get(g:, 'rmd_include_latex', 1)
+if g:rmd_include_latex == 0 || g:rmd_include_latex == 1
+ let b:rmd_has_LaTeX = v:false
+elseif g:rmd_include_latex == 2
+ let b:rmd_has_LaTeX = v:true
+endif
+
" Highlight the header of the chunks as R code
let g:rmd_syn_hl_chunk = get(g:, 'rmd_syn_hl_chunk', 0)
@@ -136,7 +145,7 @@ syn match knitrBodyVar '| \zs\S\{-}\ze:' contained containedin=knitrBodyOptions
let g:rmd_fenced_languages = get(g:, 'rmd_fenced_languages', ['r'])
let s:no_syntax_vim = []
-function IncludeLanguage(lng)
+function s:IncludeLanguage(lng)
if a:lng =~ '='
let ftpy = substitute(a:lng, '.*=', '', '')
let lnm = substitute(a:lng, '=.*', '', '')
@@ -171,11 +180,23 @@ function IncludeLanguage(lng)
endfunction
for s:type in g:rmd_fenced_languages
- call IncludeLanguage(s:type)
+ call s:IncludeLanguage(s:type)
endfor
unlet! s:type
-function CheckRmdFencedLanguages()
+let s:LaTeX_included = v:false
+function s:IncludeLaTeX()
+ let s:LaTeX_included = v:true
+ unlet! b:current_syntax
+ syn include @RmdLaTeX syntax/tex.vim
+ " From vim-pandoc-syntax
+ syn region rmdLaTeXInlineMath start=/\v\\@<!\$\S@=/ end=/\v\\@<!\$\d@!/ keepend contains=@RmdLaTeX
+ syn match rmdLaTeXCmd /\\[[:alpha:]]\+\(\({.\{-}}\)\=\(\[.\{-}\]\)\=\)*/ contains=@RmdLaTeX
+ syn region rmdLaTeX start='\$\$' end='\$\$' keepend contains=@RmdLaTeX
+ syn region rmdLaTeX start=/\\begin{\z(.\{-}\)}/ end=/\\end{\z1}/ keepend contains=@RmdLaTeX
+endfunction
+
+function s:CheckRmdFencedLanguages()
let alines = getline(1, '$')
call filter(alines, "v:val =~ '^```{'")
call map(alines, "substitute(v:val, '^```{', '', '')")
@@ -193,16 +214,31 @@ function CheckRmdFencedLanguages()
endfor
if has_lng == 0
let g:rmd_fenced_languages += [tpy]
- call IncludeLanguage(tpy)
+ call s:IncludeLanguage(tpy)
endif
endfor
+
+ if hlexists('pandocLaTeXCommand')
+ return
+ endif
+ if g:rmd_include_latex
+ if !b:rmd_has_LaTeX && (search('\$\$', 'wn') > 0 ||
+ \ search('\\begin{', 'wn') > 0) ||
+ \ search('\\[[:alpha:]]\+', 'wn') ||
+ \ search('\$[^\$]\+\$', 'wn')
+ let b:rmd_has_LaTeX = v:true
+ endif
+ if b:rmd_has_LaTeX && !s:LaTeX_included
+ call s:IncludeLaTeX()
+ endif
+ endif
endfunction
if g:rmd_dynamic_fenced_languages
- call CheckRmdFencedLanguages()
+ call s:CheckRmdFencedLanguages()
augroup RmdSyntax
autocmd!
- autocmd BufWritePost <buffer> call CheckRmdFencedLanguages()
+ autocmd BufWritePost <buffer> call s:CheckRmdFencedLanguages()
augroup END
endif
@@ -225,6 +261,8 @@ unlet s:save_pandoc_lngs
let &cpo = s:cpo_save
unlet s:cpo_save
+syntax iskeyword clear
+
let b:current_syntax = "rmd"
" vim: ts=8 sw=2
diff --git a/runtime/syntax/rpcgen.vim b/runtime/syntax/rpcgen.vim
index 60c9b8cdda..e5a0b0b56f 100644
--- a/runtime/syntax/rpcgen.vim
+++ b/runtime/syntax/rpcgen.vim
@@ -1,9 +1,11 @@
" Vim syntax file
" Language: rpcgen
-" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Charles E. Campbell
" Last Change: Aug 31, 2016
+" 2024 Feb 19 by Vim Project (announce adoption)
" Version: 13
-" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_RPCGEN
+" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_RPCGEN
if exists("b:current_syntax")
finish
diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim
index e2b1947197..97e74d205f 100644
--- a/runtime/syntax/sh.vim
+++ b/runtime/syntax/sh.vim
@@ -1,10 +1,11 @@
" Vim syntax file
" Language: shell (sh) Korn shell (ksh) bash (sh)
-" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
-" Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int>
-" Last Change: Feb 28, 2023
+" Maintainer: This runtime file is looking for a new maintainer.
+" Previous Maintainers: Charles E. Campbell
+" Lennart Schultz <Lennart.Schultz@ecmwf.int>
+" Last Change: 2024 Mar 04 by Vim Project
" Version: 208
-" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH
+" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH
" For options and settings, please use: :help ft-sh-syntax
" This file includes many ideas from Eric Brunet (eric.brunet@ens.fr) and heredoc fixes from Felipe Contreras
@@ -138,17 +139,17 @@ endif
syn cluster shArithParenList contains=shArithmetic,shArithParen,shCaseEsac,shComment,shDeref,shDo,shDerefSimple,shEcho,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shExDoubleQuote,shHereString,shRedir,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen,bashSpecialVariables,bashStatement,shIf,shFor,shFunctionKey,shFunctionOne,shFunctionTwo
syn cluster shArithList contains=@shArithParenList,shParenError
syn cluster shCaseEsacList contains=shCaseStart,shCaseLabel,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq,@shErrorList,shStringSpecial,shCaseRange
-syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSubBQ,shComment,shDblBrace,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq
+syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSubBQ,shSubshare,shValsub,shComment,shDblBrace,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq
if exists("b:is_kornshell") || exists("b:is_bash")
syn cluster shCaseList add=shForPP,shDblParen
endif
syn cluster shCommandSubList contains=shAlias,shArithmetic,shCmdParenRegion,shCommandSub,shComment,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shEcho,shEscape,shExDoubleQuote,shExpr,shExSingleQuote,shHereDoc,shNumber,shOperator,shOption,shPosnParm,shHereString,shRedir,shSingleQuote,shSpecial,shStatement,shSubSh,shTest,shVariable
syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial
" COMBAK: removing shEscape from shDblQuoteList fails ksh04:43 -- Jun 09, 2022: I don't see the problem with ksh04, so am reinstating shEscape
-syn cluster shDblQuoteList contains=shArithmetic,shCommandSub,shCommandSubBQ,shDeref,shDerefSimple,shEscape,shPosnParm,shCtrlSeq,shSpecial,shSpecialDQ
+syn cluster shDblQuoteList contains=shArithmetic,shCommandSub,shCommandSubBQ,shSubshare,shValsub,shDeref,shDerefSimple,shEscape,shPosnParm,shCtrlSeq,shSpecial,shSpecialDQ
syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPSR,shDerefPPS
syn cluster shDerefVarList contains=shDerefOffset,shDerefOp,shDerefVarArray,shDerefOpError
-syn cluster shEchoList contains=shArithmetic,shCommandSub,shCommandSubBQ,shDeref,shDerefSimple,shEscape,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq,shEchoQuote
+syn cluster shEchoList contains=shArithmetic,shCommandSub,shCommandSubBQ,shSubshare,shValsub,shDeref,shDerefSimple,shEscape,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq,shEchoQuote
syn cluster shExprList1 contains=shCharClass,shNumber,shOperator,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shDblBrace,shDeref,shDerefSimple,shCtrlSeq
syn cluster shExprList2 contains=@shExprList1,@shCaseList,shTest
syn cluster shFunctionList contains=@shCommandSubList,shCaseEsac,shColon,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shOption,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shOperator,shCtrlSeq
@@ -159,24 +160,29 @@ endif
syn cluster shHereBeginList contains=@shCommandSubList
syn cluster shHereList contains=shBeginHere,shHerePayload
syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload
-syn cluster shIdList contains=shArithmetic,shCommandSub,shCommandSubBQ,shWrapLineOperator,shSetOption,shComment,shDeref,shDerefSimple,shHereString,shNumber,shOperator,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr
+syn cluster shIdList contains=shArithmetic,shCommandSub,shCommandSubBQ,shSubshare,shValsub,shWrapLineOperator,shSetOption,shComment,shDeref,shDerefSimple,shHereString,shNumber,shOperator,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr
syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo
syn cluster shLoopList contains=@shCaseList,@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shIf,shOption,shSet,shTest,shTestOpr,shTouch
if exists("b:is_kornshell") || exists("b:is_bash")
syn cluster shLoopList add=shForPP,shDblParen
endif
-syn cluster shPPSLeftList contains=shAlias,shArithmetic,shCmdParenRegion,shCommandSub,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shEcho,shEscape,shExDoubleQuote,shExpr,shExSingleQuote,shHereDoc,shNumber,shOperator,shOption,shPosnParm,shHereString,shRedir,shSingleQuote,shSpecial,shStatement,shSubSh,shTest,shVariable
+syn cluster shPPSLeftList contains=shAlias,shArithmetic,shCmdParenRegion,shCommandSub,shSubshare,shValsub,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shEcho,shEscape,shExDoubleQuote,shExpr,shExSingleQuote,shHereDoc,shNumber,shOperator,shOption,shPosnParm,shHereString,shRedir,shSingleQuote,shSpecial,shStatement,shSubSh,shTest,shVariable
syn cluster shPPSRightList contains=shDeref,shDerefSimple,shEscape,shPosnParm
-syn cluster shSubShList contains=@shCommandSubList,shCommandSubBQ,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator
-syn cluster shTestList contains=shArithmetic,shCharClass,shCommandSub,shCommandSubBQ,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shSpecialDQ,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr
+syn cluster shSubShList contains=@shCommandSubList,shCommandSubBQ,shSubshare,shValsub,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator
+syn cluster shTestList contains=shArithmetic,shCharClass,shCommandSub,shCommandSubBQ,shSubshare,shValsub,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shSpecialDQ,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr
syn cluster shNoZSList contains=shSpecialNoZS
-syn cluster shForList contains=shTestOpr,shNumber,shDerefSimple,shDeref,shCommandSub,shCommandSubBQ,shArithmetic
+syn cluster shForList contains=shTestOpr,shNumber,shDerefSimple,shDeref,shCommandSub,shCommandSubBQ,shSubshare,shValsub,shArithmetic
" Echo: {{{1
" ====
" This one is needed INSIDE a CommandSub, so that `echo bla` be correct
-syn region shEcho matchgroup=shStatement start="\<echo\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|()`]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 contains=@shEchoList skipwhite nextgroup=shQuickComment
-syn region shEcho matchgroup=shStatement start="\<print\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|()`]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 contains=@shEchoList skipwhite nextgroup=shQuickComment
+if exists("b:is_kornshell")
+ syn region shEcho matchgroup=shStatement start="\<echo\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|()`}]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 end="\ze[ \t\n;]}" contains=@shEchoList skipwhite nextgroup=shQuickComment
+ syn region shEcho matchgroup=shStatement start="\<print\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|()`}]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 end="\ze[ \t\n;]}" contains=@shEchoList skipwhite nextgroup=shQuickComment
+else
+ syn region shEcho matchgroup=shStatement start="\<echo\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|()`]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 contains=@shEchoList skipwhite nextgroup=shQuickComment
+ syn region shEcho matchgroup=shStatement start="\<print\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|()`]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 contains=@shEchoList skipwhite nextgroup=shQuickComment
+endif
if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix")
syn region shEchoDeref contained matchgroup=shStatement start="\<echo\>" skip="\\$" matchgroup=shEchoDelim end="$" end="[<>;&|()`}]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 contains=@shEchoList skipwhite nextgroup=shQuickComment
syn region shEchoDeref contained matchgroup=shStatement start="\<print\>" skip="\\$" matchgroup=shEchoDelim end="$" end="[<>;&|()`}]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 contains=@shEchoList skipwhite nextgroup=shQuickComment
@@ -336,6 +342,10 @@ syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.' nextgroup=shComment
" an Error under /bin/sh. By consensus of vimdev'ers!
if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix")
syn region shCommandSub matchgroup=shCmdSubRegion start="\$(\ze[^(]" skip='\\\\\|\\.' end=")" contains=@shCommandSubList
+ if exists("b:is_kornshell")
+ syn region shSubshare matchgroup=shCmdSubRegion start="\${\ze[ \t\n<]" skip='\\\\\|\\.' end="\zs[ \t\n;]}" contains=@shCommandSubList
+ syn region shValsub matchgroup=shCmdSubRegion start="\${|" skip='\\\\\|\\.' end="}" contains=@shCommandSubList
+ endif
syn region shArithmetic matchgroup=shArithRegion start="\$((" skip='\\\\\|\\.' end="))" contains=@shArithList
syn region shArithmetic matchgroup=shArithRegion start="\$\[" skip='\\\\\|\\.' end="\]" contains=@shArithList
syn match shSkipInitWS contained "^\s\+"
@@ -343,7 +353,7 @@ if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix")
elseif !exists("g:sh_no_error")
syn region shCommandSub matchgroup=Error start="\$(" end=")" contains=@shCommandSubList
endif
-syn region shCmdParenRegion matchgroup=shCmdSubRegion start="(\ze[^(]" skip='\\\\\|\\.' end=")" contains=@shCommandSubList
+syn region shCmdParenRegion matchgroup=shCmdSubRegion start="((\@!" skip='\\\\\|\\.' end=")" contains=@shCommandSubList
if exists("b:is_bash")
syn cluster shCommandSubList add=bashSpecialVariables,bashStatement
@@ -491,7 +501,11 @@ if !exists("g:sh_no_error")
syn match shDerefWordError "[^}$[~]" contained
endif
syn match shDerefSimple "\$\%(\h\w*\|\d\)" nextgroup=@shNoZSList
-syn region shDeref matchgroup=PreProc start="\${" end="}" contains=@shDerefList,shDerefVarArray nextgroup=shSpecialStart
+if exists("b:is_kornshell")
+ syn region shDeref matchgroup=PreProc start="\${\ze[^ \t\n<|]" end="}" contains=@shDerefList,shDerefVarArray nextgroup=shSpecialStart
+else
+ syn region shDeref matchgroup=PreProc start="\${" end="}" contains=@shDerefList,shDerefVarArray nextgroup=shSpecialStart
+endif
syn match shDerefSimple "\$[-#*@!?]" nextgroup=@shNoZSList
syn match shDerefSimple "\$\$" nextgroup=@shNoZSList
syn match shDerefSimple "\${\d}" nextgroup=@shNoZSList nextgroup=shSpecialStart
@@ -620,7 +634,7 @@ elseif exists("b:is_bash")
syn keyword shStatement bg builtin disown export false fg getopts jobs let printf sleep true unalias
syn keyword shStatement typeset nextgroup=shSetOption
syn keyword shStatement fc hash history source suspend times type
- syn keyword shStatement bind builtin caller compopt declare dirs disown enable export help logout mapfile popd pushd readarray shopt source typeset
+ syn keyword shStatement bind builtin caller compopt declare dirs disown enable export help logout local mapfile popd pushd readarray shopt source typeset
else
syn keyword shStatement login newgrp
endif
@@ -754,6 +768,8 @@ if !exists("skip_sh_syntax_inits")
hi def link shSnglCase Statement
hi def link shCommandSub Special
hi def link shCommandSubBQ shCommandSub
+ hi def link shSubshare shCommandSub
+ hi def link shValsub shCommandSub
hi def link shComment Comment
hi def link shConditional Conditional
hi def link shCtrlSeq Special
diff --git a/runtime/syntax/shared/debversions.vim b/runtime/syntax/shared/debversions.vim
index 6c944cd4e1..4aec246e27 100644
--- a/runtime/syntax/shared/debversions.vim
+++ b/runtime/syntax/shared/debversions.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: Debian version information
" Maintainer: Debian Vim Maintainers
-" Last Change: 2023 Nov 01
+" Last Change: 2024 Jan 25
" URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/syntax/shared/debversions.vim
let s:cpo = &cpo
@@ -11,7 +11,7 @@ let g:debSharedSupportedVersions = [
\ 'oldstable', 'stable', 'testing', 'unstable', 'experimental', 'sid', 'rc-buggy',
\ 'bullseye', 'bookworm', 'trixie', 'forky',
\
- \ 'trusty', 'xenial', 'bionic', 'focal', 'jammy', 'lunar', 'mantic', 'noble',
+ \ 'trusty', 'xenial', 'bionic', 'focal', 'jammy', 'mantic', 'noble',
\ 'devel'
\ ]
let g:debSharedUnsupportedVersions = [
@@ -23,7 +23,7 @@ let g:debSharedUnsupportedVersions = [
\ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid',
\ 'maverick', 'natty', 'oneiric', 'precise', 'quantal', 'raring', 'saucy',
\ 'utopic', 'vivid', 'wily', 'yakkety', 'zesty', 'artful', 'cosmic',
- \ 'disco', 'eoan', 'hirsute', 'impish', 'kinetic', 'groovy'
+ \ 'disco', 'eoan', 'hirsute', 'impish', 'kinetic', 'lunar', 'groovy'
\ ]
let &cpo=s:cpo
diff --git a/runtime/syntax/sm.vim b/runtime/syntax/sm.vim
index a16575c519..13a5bf117e 100644
--- a/runtime/syntax/sm.vim
+++ b/runtime/syntax/sm.vim
@@ -1,9 +1,11 @@
" Vim syntax file
" Language: sendmail
-" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Charles E. Campbell
" Last Change: Oct 25, 2016
+" 2024 Feb 19 by Vim Project (announce adoption)
" Version: 9
-" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SM
+" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SM
if exists("b:current_syntax")
finish
endif
diff --git a/runtime/syntax/spec.vim b/runtime/syntax/spec.vim
index aed04bc900..12ce8d5ac1 100644
--- a/runtime/syntax/spec.vim
+++ b/runtime/syntax/spec.vim
@@ -102,7 +102,7 @@ syn case ignore
"%% PreAmble Section %%
"Copyright and Serial were deprecated by License and Epoch
syn region specPreAmbleDeprecated oneline matchgroup=specError start='^\(Copyright\|Serial\)' end='$' contains=specEmail,specURL,specURLMacro,specLicense,specColon,specVariables,specSpecialChar,specMacroIdentifier
-syn region specPreAmble oneline matchgroup=specCommand start='^\(Prereq\|Summary\|Name\|Version\|Packager\|Requires\|Recommends\|Suggests\|Supplements\|Enhances\|Icon\|URL\|Source\d*\|Patch\d*\|Prefix\|Packager\|Group\|License\|Release\|BuildRoot\|Distribution\|Vendor\|Provides\|ExclusiveArch\|ExcludeArch\|ExclusiveOS\|Obsoletes\|BuildArch\|BuildArchitectures\|BuildRequires\|BuildConflicts\|BuildPreReq\|Conflicts\|AutoRequires\|AutoReq\|AutoReqProv\|AutoProv\|Epoch\)' end='$' contains=specEmail,specURL,specURLMacro,specLicense,specColon,specVariables,specSpecialChar,specMacroIdentifier
+syn region specPreAmble oneline matchgroup=specCommand start='^\(Prereq\|Summary\|Name\|Version\|Packager\|Requires\|Recommends\|Suggests\|Supplements\|Enhances\|Icon\|URL\|SourceLicense\|Source\d*\|Patch\d*\|Prefix\|Packager\|Group\|License\|Release\|BuildRoot\|Distribution\|Vendor\|Provides\|ExclusiveArch\|ExcludeArch\|ExclusiveOS\|Obsoletes\|BuildArch\|BuildArchitectures\|BuildRequires\|BuildConflicts\|BuildPreReq\|Conflicts\|AutoRequires\|AutoReq\|AutoReqProv\|AutoProv\|Epoch\)' end='$' contains=specEmail,specURL,specURLMacro,specLicense,specColon,specVariables,specSpecialChar,specMacroIdentifier
"%% Description Section %%
syn region specDescriptionArea matchgroup=specSection start='^%description' end='^%'me=e-1 contains=specDescriptionOpts,specEmail,specURL,specNumber,specMacroIdentifier,specComment
diff --git a/runtime/syntax/squirrel.vim b/runtime/syntax/squirrel.vim
index 81d59cc986..85bdd87d9e 100644
--- a/runtime/syntax/squirrel.vim
+++ b/runtime/syntax/squirrel.vim
@@ -2,7 +2,7 @@
" Language: squirrel
" Current Maintainer: Matt Dunford (zenmatic@gmail.com)
" URL: https://github.com/zenmatic/vim-syntax-squirrel
-" Last Change: 2021 Nov 28
+" Last Change: 2023 Dec 08
" http://squirrel-lang.org/
@@ -17,6 +17,7 @@ let b:filetype_in_cpp_family = 1
" Read the C syntax to start with
runtime! syntax/c.vim
unlet b:current_syntax
+unlet b:filetype_in_cpp_family
" squirrel extensions
syn keyword squirrelStatement delete this in yield resume base clone
diff --git a/runtime/syntax/swayconfig.vim b/runtime/syntax/swayconfig.vim
index 7b1c889d6d..69fe26d370 100644
--- a/runtime/syntax/swayconfig.vim
+++ b/runtime/syntax/swayconfig.vim
@@ -2,8 +2,8 @@
" Language: sway config file
" Original Author: Josef Litos (JosefLitos/i3config.vim)
" Maintainer: James Eapen <james.eapen@vai.org>
-" Version: 1.0.0
-" Last Change: 2023-09-14
+" Version: 1.0.2
+" Last Change: 2023-12-28
" References:
" http://i3wm.org/docs/userguide.html#configuring
@@ -43,6 +43,12 @@ syn region swayConfigExecBlock start=/exec\(_always\)\? {/ end=/^}$/ contains=i3
syn keyword swayConfigFloatingModifierOpts normal inverse contained
syn match i3ConfigKeyword /^floating_modifier [$a-zA-Z0-9+]\+ \(normal\|inverse\)$/ contains=i3ConfigVariable,i3ConfigBindModkey,swayConfigFloatingModifierOpts
+syn keyword swayConfigSmartGapsOpts toggle contained
+syn match i3ConfigKeyword /^smart_gaps toggle$/ contains=i3ConfigSmartGapOpts,i3ConfigBoolean,swayConfigSmartGapsOpts
+
+syn keyword swayConfigFocusFollowsMouseOpts always contained
+syn match i3ConfigKeyword /^focus_follows_mouse always$/ contains=i3ConfigBoolean,swayConfigFocusFollowsMouseOpts
+
syn match i3ConfigKeyword /^hide_edge_borders --i3 \w*$/ contains=i3ConfigEdgeKeyword,i3ConfigShParam
syn keyword i3ConfigBarOpts swaybar_command gaps height pango_markup status_edge_padding status_padding wrap_scroll tray_bindcode tray_bindsym icon_theme contained
@@ -118,7 +124,9 @@ syn region swayConfigOutput start=/^output/ skip=/\\$/ end=/$/ contains=swayCon
syn region swayConfigOutput start=/^output .* {$/ end=/}$/ contains=swayConfigOutputKeyword,swayConfigOutputMode,swayConfigOutputOpts,swayConfigOutputOptVals,i3ConfigVariable,i3ConfigNumber,i3ConfigString,i3ConfigColor,i3ConfigBoolean,swayConfigDeviceOps,i3ConfigParen keepend extend
" Define the highlighting.
+hi def link swayConfigSmartGapsOpts i3ConfigOption
hi def link swayConfigFloatingModifierOpts i3ConfigOption
+hi def link swayConfigFocusFollowsMouseOpts i3ConfigOption
hi def link swayConfigBindKeyword i3ConfigBindKeyword
hi def link swayConfigXOpt i3ConfigOption
hi def link swayConfigInhibitKeyword i3ConfigCommand
diff --git a/runtime/syntax/tags.vim b/runtime/syntax/tags.vim
index 4c06dc1df8..e87e3fcf61 100644
--- a/runtime/syntax/tags.vim
+++ b/runtime/syntax/tags.vim
@@ -1,8 +1,10 @@
" Language: tags
-" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Charles E. Campbell
" Last Change: Oct 26, 2016
+" 2024 Feb 19 by Vim Project (announce adoption)
" Version: 8
-" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TAGS
+" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TAGS
" quit when a syntax file was already loaded
if exists("b:current_syntax")
diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim
index 5544fb63fc..d782bd4845 100644
--- a/runtime/syntax/tex.vim
+++ b/runtime/syntax/tex.vim
@@ -1,9 +1,11 @@
" Vim syntax file
" Language: TeX
-" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Charles E. Campbell
" Last Change: Apr 22, 2022
+" 2024 Feb 19 by Vim Project (announce adoption)
" Version: 121
-" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX
+" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX
"
" Notes: {{{1
"
diff --git a/runtime/syntax/tmux.vim b/runtime/syntax/tmux.vim
index 042b96e872..9766ed55d7 100644
--- a/runtime/syntax/tmux.vim
+++ b/runtime/syntax/tmux.vim
@@ -1,5 +1,5 @@
" Language: tmux(1) configuration file
-" Version: 3.3-rc (git-964deae4)
+" Version: 3.4 (git-608d1134)
" 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)
@@ -17,8 +17,9 @@ let b:current_syntax = "tmux"
syntax iskeyword @,48-57,_,192-255,-
syntax case match
-syn keyword tmuxAction none any current other
-syn keyword tmuxBoolean off on yes no
+" The values "yes" and "no" are synonyms for "on" and "off", so they do not
+" appear in the option table file.
+syn keyword tmuxEnums yes no
syn keyword tmuxTodo FIXME NOTE TODO XXX contained
@@ -27,12 +28,20 @@ syn match tmuxKey /\(C-\|M-\|\^\)\+\S\+/ display
syn match tmuxNumber /\<\d\+\>/ display
syn match tmuxFlags /\s-\a\+/ display
syn match tmuxVariableExpansion /\$\({[A-Za-z_]\w*}\|[A-Za-z_]\w*\)/ display
-syn match tmuxControl /^\s*%\(if\|elif\|else\|endif\)\>/
+syn match tmuxControl /\(^\|\s\)%\(if\|elif\|else\|endif\)\($\|\s\)/ display
syn match tmuxEscape /\\\(u\x\{4\}\|U\x\{8\}\|\o\{3\}\|[\\ernt$]\)/ display
+" Missing closing bracket.
+syn match tmuxInvalidVariableExpansion /\${[^}]*$/ display
+" Starts with invalid character.
+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 region tmuxComment start=/#/ skip=/\\\@<!\\$/ end=/$/ contains=tmuxTodo,@Spell
-syn region tmuxString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=tmuxFormatString,tmuxEscape,tmuxVariableExpansion,@Spell
+syn region tmuxString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=tmuxFormatString,tmuxEscape,tmuxVariableExpansion,tmuxInvalidVariableExpansion,@Spell
syn region tmuxUninterpolatedString start=+'+ skip=+\\$+ excludenl end=+'+ end='$' contains=tmuxFormatString,@Spell
" TODO: Figure out how escaping works inside of #(...) and #{...} blocks.
@@ -43,7 +52,7 @@ syn region tmuxFormatString start=/#(/ skip=/#(.\{-})/ end=/)/ contained keepend
" At the time of this writing, the latest tmux release will parse a line
" reading "abc=xyz set-option ..." as an assignment followed by a command
" hence the presence of "\s" in the "end" argument.
-syn region tmuxAssignment matchgroup=tmuxVariable start=/^\s*[A-Za-z_]\w*=\@=/ skip=/\\$\|\\\s/ end=/\s\|$/ contains=tmuxString,tmuxUninterpolatedString,tmuxVariableExpansion,tmuxControl,tmuxEscape
+syn region tmuxAssignment matchgroup=tmuxVariable start=/^\s*[A-Za-z_]\w*=\@=/ skip=/\\$\|\\\s/ end=/\s\|$/ contains=tmuxString,tmuxUninterpolatedString,tmuxVariableExpansion,tmuxControl,tmuxEscape,tmuxInvalidVariableExpansion
hi def link tmuxFormatString Identifier
hi def link tmuxAction Boolean
@@ -51,8 +60,11 @@ hi def link tmuxBoolean Boolean
hi def link tmuxCommands Keyword
hi def link tmuxControl PreCondit
hi def link tmuxComment Comment
+hi def link tmuxEnums Boolean
hi def link tmuxEscape Special
hi def link tmuxEscapeUnquoted Special
+hi def link tmuxInvalidVariableExpansion
+\ Error
hi def link tmuxKey Special
hi def link tmuxNumber Number
hi def link tmuxFlags Identifier
@@ -77,78 +89,84 @@ endif
syn keyword tmuxOptions
\ activity-action after-bind-key after-capture-pane after-copy-mode
-\ after-display-message after-display-panes after-kill-pane
-\ after-list-buffers after-list-clients after-list-keys after-list-panes
-\ after-list-sessions after-list-windows after-load-buffer after-lock-server
-\ after-new-session after-new-window after-paste-buffer after-pipe-pane
-\ after-queue after-refresh-client after-rename-session after-rename-window
-\ after-resize-pane after-resize-window after-save-buffer
-\ after-select-layout after-select-pane after-select-window after-send-keys
-\ after-set-buffer after-set-environment after-set-hook after-set-option
-\ after-show-environment after-show-messages after-show-options
-\ after-split-window after-unbind-key aggressive-resize alert-activity
-\ alert-bell alert-silence allow-passthrough allow-rename alternate-screen
-\ assume-paste-time automatic-rename automatic-rename-format backspace
-\ base-index bell-action buffer-limit client-active client-attached
-\ client-detached client-focus-in client-focus-out client-resized
-\ client-session-changed clock-mode-colour clock-mode-style command-alias
-\ copy-command copy-mode-current-match-style copy-mode-mark-style
-\ copy-mode-match-style cursor-colour cursor-style default-command
-\ default-shell default-size default-terminal destroy-unattached
-\ detach-on-destroy display-panes-active-colour display-panes-colour
-\ display-panes-time display-time editor escape-time exit-empty
-\ exit-unattached extended-keys fill-character focus-events history-file
-\ history-limit key-table lock-after-time lock-command main-pane-height
-\ main-pane-width message-command-style message-limit message-style
-\ mode-keys mode-style monitor-activity monitor-bell monitor-silence mouse
-\ other-pane-height other-pane-width pane-active-border-style
-\ pane-base-index pane-border-format pane-border-indicators
-\ pane-border-lines pane-border-status pane-border-style pane-colours
-\ pane-died pane-exited pane-focus-in pane-focus-out pane-mode-changed
-\ pane-set-clipboard pane-title-changed popup-border-lines
+\ after-display-message after-display-panes after-kill-pane after-list-buffers
+\ after-list-clients after-list-keys after-list-panes after-list-sessions
+\ after-list-windows after-load-buffer after-lock-server after-new-session
+\ after-new-window after-paste-buffer after-pipe-pane after-queue
+\ after-refresh-client after-rename-session after-rename-window
+\ after-resize-pane after-resize-window after-save-buffer after-select-layout
+\ after-select-pane after-select-window after-send-keys after-set-buffer
+\ after-set-environment after-set-hook after-set-option after-show-environment
+\ after-show-messages after-show-options after-split-window after-unbind-key
+\ aggressive-resize alert-activity alert-bell alert-silence allow-passthrough
+\ allow-rename alternate-screen assume-paste-time automatic-rename
+\ automatic-rename-format backspace base-index bell-action buffer-limit
+\ client-active client-attached client-detached client-focus-in
+\ client-focus-out client-resized client-session-changed clock-mode-color
+\ clock-mode-colour clock-mode-style command-alias copy-command
+\ copy-mode-current-match-style copy-mode-mark-style copy-mode-match-style
+\ cursor-color cursor-colour cursor-style default-command default-shell
+\ default-size default-terminal destroy-unattached detach-on-destroy
+\ display-panes-active-color display-panes-active-colour display-panes-color
+\ display-panes-colour display-panes-time display-time editor escape-time
+\ exit-empty exit-unattached extended-keys fill-character focus-events
+\ history-file history-limit key-table lock-after-time lock-command
+\ main-pane-height main-pane-width menu-border-lines menu-border-style
+\ menu-selected-style menu-style message-command-style message-limit
+\ message-line message-style mode-keys mode-style monitor-activity monitor-bell
+\ monitor-silence mouse other-pane-height other-pane-width
+\ pane-active-border-style pane-base-index pane-border-format
+\ pane-border-indicators pane-border-lines pane-border-status pane-border-style
+\ pane-colors pane-colours pane-died pane-exited pane-focus-in pane-focus-out
+\ pane-mode-changed pane-set-clipboard pane-title-changed popup-border-lines
\ popup-border-style popup-style prefix prefix2 prompt-history-limit
\ remain-on-exit remain-on-exit-format renumber-windows repeat-time
\ scroll-on-clear session-closed session-created session-renamed
\ session-window-changed set-clipboard set-titles set-titles-string
\ silence-action status status-bg status-fg status-format status-interval
-\ status-justify status-keys status-left status-left-length
-\ status-left-style status-position status-right status-right-length
-\ status-right-style status-style synchronize-panes terminal-features
-\ terminal-overrides update-environment user-keys visual-activity
-\ visual-bell visual-silence window-active-style window-layout-changed
-\ window-linked window-pane-changed window-renamed window-resized
-\ window-size window-status-activity-style window-status-bell-style
-\ window-status-current-format window-status-current-style
-\ window-status-format window-status-last-style window-status-separator
-\ window-status-style window-style window-unlinked word-separators
-\ wrap-search xterm-keys
+\ status-justify status-keys status-left status-left-length status-left-style
+\ status-position status-right status-right-length status-right-style
+\ status-style synchronize-panes terminal-features terminal-overrides
+\ update-environment user-keys visual-activity visual-bell visual-silence
+\ window-active-style window-layout-changed window-linked window-pane-changed
+\ window-renamed window-resized window-size window-status-activity-style
+\ window-status-bell-style window-status-current-format
+\ window-status-current-style window-status-format window-status-last-style
+\ window-status-separator window-status-style window-style window-unlinked
+\ word-separators wrap-search xterm-keys
syn keyword tmuxCommands
-\ attach attach-session bind bind-key break-pane breakp capture-pane
-\ capturep choose-buffer choose-client choose-session choose-tree
-\ choose-window clear-history clear-prompt-history clearhist clearphist
-\ clock-mode command-prompt confirm confirm-before copy-mode customize-mode
-\ delete-buffer deleteb detach detach-client display display-menu
-\ display-message display-panes display-popup displayp find-window findw has
-\ has-session if if-shell info join-pane joinp kill-pane kill-server
-\ kill-session kill-window killp killw last last-pane last-window lastp
-\ link-window linkw list-buffers list-clients list-commands list-keys
-\ list-panes list-sessions list-windows load-buffer loadb lock lock-client
-\ lock-server lock-session lockc locks ls lsb lsc lscm lsk lsp lsw menu
-\ move-pane move-window movep movew new new-session new-window neww next
-\ next-layout next-window nextl paste-buffer pasteb pipe-pane pipep popup
-\ prev previous-layout previous-window prevl refresh refresh-client rename
-\ rename-session rename-window renamew resize-pane resize-window resizep
-\ resizew respawn-pane respawn-window respawnp respawnw rotate-window
-\ rotatew run run-shell save-buffer saveb select-layout select-pane
-\ select-window selectl selectp selectw send send-keys send-prefix
-\ server-info set set-buffer set-environment set-hook set-option
-\ set-window-option setb setenv setw show show-buffer show-environment
-\ show-hooks show-messages show-options show-prompt-history
-\ show-window-options showb showenv showmsgs showphist showw source
-\ source-file split-pane split-window splitp splitw start start-server
-\ suspend-client suspendc swap-pane swap-window swapp swapw switch-client
-\ switchc unbind unbind-key unlink-window unlinkw wait wait-for
+\ attach attach-session bind bind-key break-pane breakp capture-pane capturep
+\ choose-buffer choose-client choose-session choose-tree choose-window
+\ clear-history clear-prompt-history clearhist clearphist clock-mode
+\ command-prompt confirm confirm-before copy-mode customize-mode delete-buffer
+\ deleteb detach detach-client display display-menu display-message
+\ display-panes display-popup displayp find-window findw has has-session if
+\ if-shell info join-pane joinp kill-pane kill-server kill-session kill-window
+\ killp killw last last-pane last-window lastp link-window linkw list-buffers
+\ list-clients list-commands list-keys list-panes list-sessions list-windows
+\ load-buffer loadb lock lock-client lock-server lock-session lockc locks ls
+\ lsb lsc lscm lsk lsp lsw menu move-pane move-window movep movew new
+\ new-session new-window neww next next-layout next-window nextl paste-buffer
+\ pasteb pipe-pane pipep popup prev previous-layout previous-window prevl
+\ refresh refresh-client rename rename-session rename-window renamew
+\ resize-pane resize-window resizep resizew respawn-pane respawn-window
+\ respawnp respawnw rotate-window rotatew run run-shell save-buffer saveb
+\ select-layout select-pane select-window selectl selectp selectw send
+\ send-keys send-prefix server-access server-info set set-buffer
+\ set-environment set-hook set-option set-window-option setb setenv setw show
+\ show-buffer show-environment show-hooks show-messages show-options
+\ show-prompt-history show-window-options showb showenv showmsgs showphist
+\ showw source source-file split-pane split-window splitp splitw start
+\ start-server suspend-client suspendc swap-pane swap-window swapp swapw
+\ switch-client switchc unbind unbind-key unlink-window unlinkw wait wait-for
+
+syn keyword tmuxEnums
+\ absolute-centre all always any arrows bar blinking-bar blinking-block
+\ blinking-underline block both bottom centre color colour current default
+\ double emacs external failed heavy keep-group keep-last largest latest left
+\ manual next no-detached none number off on other padded previous right
+\ rounded simple single smallest top underline vi
let &cpo = s:original_cpo
unlet! s:original_cpo s:bg s:i
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index fcd50bccd2..2857146949 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -23,7 +23,7 @@ syn cluster vimCommentGroup contains=vimTodo,@Spell
" Special and plugin vim commands {{{2
syn match vimCommand contained "\<z[-+^.=]\=\>"
syn keyword vimOnlyCommand contained fix[del] op[en] sh[ell] P[rint]
-syn keyword vimStdPlugin contained Arguments Asm Break Cfilter Clear Continue DiffOrig Evaluate Finish Gdb Lfilter Man N[ext] Over P[rint] Program Run S Source Step Stop Termdebug TermdebugCommand TOhtml Until Winbar XMLent XMLns
+syn keyword vimStdPlugin contained Arguments Asm Break Cfilter Clear Continue DiffOrig Evaluate Finish Gdb Lfilter Man Over Program Run S Source Step Stop Termdebug TermdebugCommand TOhtml Until Winbar XMLent XMLns
" Vim-specific options {{{2
syn keyword vimOnlyOption contained biosk bioskey cp compatible consk conskey cm cryptmethod edcompatible guipty key macatsui mzq mzquantum osfiletype oft renderoptions rop st shelltype sn shortname tenc termencoding ta textauto tx textmode tf ttyfast ttym ttymouse tbi ttybuiltin wiv weirdinvert
@@ -34,8 +34,10 @@ syn keyword vimOnlyOption contained nobiosk nobioskey noconsk noconskey nocp noc
" Invertible setting variants
syn keyword vimOnlyOption contained invbiosk invbioskey invconsk invconskey invcp invcompatible invguipty invmacatsui invsn invshortname invta invtextauto invtx invtextmode invtf invttyfast invtbi invttybuiltin invwiv invweirdinvert
" termcap codes (which can also be set) {{{2
-syn keyword vimTermOption contained t_8b t_AB t_al t_bc t_ce t_cl t_Co t_Cs t_CV t_db t_DL t_Ds t_F1 t_F2 t_F3 t_F4 t_F5 t_F6 t_F7 t_F8 t_F9 t_fs t_IE t_IS t_k1 t_K1 t_k2 t_k3 t_K3 t_k4 t_K4 t_k5 t_K5 t_k6 t_K6 t_k7 t_K7 t_k8 t_K8 t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_ke t_KE t_KF t_KG t_KH t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ks t_ku t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_RB t_RI t_RV t_Sb t_se t_Sf t_SI t_so t_sr t_SR t_te t_ti t_ts t_u7 t_ue t_us t_Us t_ut t_vb t_ve t_vi t_vs t_WP t_WS t_xn t_xs t_ZH t_ZR
-syn keyword vimTermOption contained t_8f t_AF t_AL t_cd t_Ce t_cm t_cs t_CS t_da t_dl t_ds t_EI t_kh t_kI
+" GEN_SYN_VIM: vimOption term output code, START_STR='syn keyword vimOption contained', END_STR=''
+syn keyword vimOption contained t_AB t_AF t_AU t_AL t_al t_bc t_BE t_BD t_cd t_ce t_Ce t_CF t_cl t_cm t_Co t_CS t_Cs t_cs t_CV t_da t_db t_DL t_dl t_ds t_Ds t_EC t_EI t_fs t_fd t_fe t_GP t_IE t_IS t_ke t_ks t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_RF t_RB t_RC t_RI t_Ri t_RK t_RS t_RT t_RV t_Sb t_SC t_se t_Sf t_SH t_SI t_Si t_so t_SR t_sr t_ST t_Te t_te t_TE t_ti t_TI t_Ts t_ts t_u7 t_ue t_us t_Us t_ut t_vb t_ve t_vi t_VS t_vs t_WP t_WS t_XM t_xn t_xs t_ZH t_ZR t_8f t_8b t_8u
+" term key codes
+syn keyword vimOption contained t_F1 t_F2 t_F3 t_F4 t_F5 t_F6 t_F7 t_F8 t_F9 t_k1 t_K1 t_k2 t_k3 t_K3 t_k4 t_K4 t_k5 t_K5 t_k6 t_K6 t_k7 t_K7 t_k8 t_K8 t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_KE t_KF t_KG t_kh t_KH t_kI t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ku
syn match vimTermOption contained "t_%1"
syn match vimTermOption contained "t_#2"
syn match vimTermOption contained "t_#4"
@@ -46,19 +48,22 @@ syn match vimTermOption contained "t_%i"
syn match vimTermOption contained "t_k;"
" unsupported settings: these are supported by vi but don't do anything in vim {{{2
-syn keyword vimErrSetting contained hardtabs ht w1200 w300 w9600
+" GEN_SYN_VIM: Missing vimOption, START_STR='syn keyword vimErrSetting contained', END_STR=''
+syn keyword vimErrSetting contained akm altkeymap anti antialias ap autoprint bf beautify biosk bioskey consk conskey fk fkmap fl flash gr graphic ht hardtabs macatsui mesg novice open opt optimize oft osfiletype redraw slow slowopen sourceany w1200 w300 w9600
+syn keyword vimErrSetting contained noakm noaltkeymap noanti noantialias noap noautoprint nobf nobeautify nobiosk nobioskey noconsk noconskey nofk nofkmap nofl noflash nogr nographic nomacatsui nomesg nonovice noopen noopt nooptimize noredraw noslow noslowopen nosourceany
+syn keyword vimErrSetting contained invakm invaltkeymap invanti invantialias invap invautoprint invbf invbeautify invbiosk invbioskey invconsk invconskey invfk invfkmap invfl invflash invgr invgraphic invmacatsui invmesg invnovice invopen invopt invoptimize invredraw invslow invslowopen invsourceany
"}}}2
syn case ignore
" Highlight commonly used Groupnames {{{2
syn keyword vimGroup contained Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo
" Default highlighting groups {{{2
-syn keyword vimHLGroup contained ColorColumn Cursor CursorColumn CursorIM CursorLine CursorLineFold CursorLineNr CursorLineSign DiffAdd DiffChange DiffDelete DiffText Directory EndOfBuffer ErrorMsg FoldColumn Folded IncSearch LineNr MatchParen Menu MessageWindow ModeMsg MoreMsg NonText Normal Pmenu PmenuExtra PmenuExtraSel PmenuKind PmenuKindSel PmenuSbar PmenuSel PmenuThumb Question QuickFixLine Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC TabLine TabLineFill TabLineSel Title Tooltip VertSplit Visual WarningMsg WildMenu
-syn match vimHLGroup contained "Conceal"
-syn keyword vimOnlyHLGroup contained LineNrAbove LineNrBelow StatusLineTerm Terminal VisualNOS
-syn keyword nvimHLGroup contained Substitute TermCursor TermCursorNC
+syn keyword vimHLGroup contained ErrorMsg IncSearch ModeMsg NonText StatusLine StatusLineNC EndOfBuffer VertSplit DiffText PmenuSbar TabLineSel TabLineFill Cursor lCursor QuickFixLine CursorLineSign CursorLineFold CurSearch PmenuKind PmenuKindSel PmenuExtra PmenuExtraSel Normal Directory LineNr CursorLineNr MoreMsg Question Search SpellBad SpellCap SpellRare SpellLocal PmenuThumb Pmenu PmenuSel SpecialKey Title WarningMsg WildMenu Folded FoldColumn SignColumn Visual DiffAdd DiffChange DiffDelete TabLine CursorColumn CursorLine ColorColumn Conceal MatchParen CursorIM LineNrAbove LineNrBelow
+syn keyword vimOnlyHLGroup contained Menu Scrollbar StatusLineTerm StatusLineTermNC ToolbarButton ToolbarLine Tooltip VisualNOS
+syn keyword nvimHLGroup contained FloatBorder FloatFooter FloatTitle MsgSeparator NormalFloat NormalNC Substitute TermCursor TermCursorNC VisualNC Whitespace WinBar WinBarNC WinSeparator
"}}}2
syn case match
+
" Special Vim Highlighting (not automatic) {{{1
" Set up folding commands for this syntax highlighting file {{{2
@@ -140,23 +145,28 @@ endif
" Numbers {{{2
" =======
-syn match vimNumber '\<\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment
-syn match vimNumber '-\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment
-syn match vimNumber '\<0[xX]\x\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment
-syn match vimNumber '\%(^\|\A\)\zs#\x\{6}' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment
-syn match vimNumber '\<0[zZ][a-zA-Z0-9.]\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment
-syn match vimNumber '0[0-7]\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment
-syn match vimNumber '0[bB][01]\+' skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment,vim9Comment
+syn match vimNumber '\<\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,vimComment,vim9Comment
+syn match vimNumber '-\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,vimComment,vim9Comment
+syn match vimNumber '\<0[xX]\x\+' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,vimComment,vim9Comment
+syn match vimNumber '\%(^\|\A\)\zs#\x\{6}' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,vimComment,vim9Comment
+syn match vimNumber '\<0[zZ][a-zA-Z0-9.]\+' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,vimComment,vim9Comment
+syn match vimNumber '0[0-7]\+' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,vimComment,vim9Comment
+syn match vimNumber '0[bB][01]\+' skipwhite nextgroup=vimGlobal,vimSubst1,vimCommand,vimComment,vim9Comment
" All vimCommands are contained by vimIsCommand. {{{2
-syn match vimCmdSep "[:|]\+" skipwhite nextgroup=vimAddress,vimAutoCmd,vimEcho,vimIsCommand,vimExtCmd,vimFilter,vimLet,vimMap,vimMark,vimSet,vimSyntax,vimUserCmd
-syn match vimIsCommand "\<\h\w*\>" contains=vimCommand
+syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimEcho,vimEchoHL,vimExecute,vimIsCommand,vimExtCmd,vimFunction,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNotFunc,vimNorm,vimSet,vimSyntax,vimUnlet,vimUnmap,vimUserCmd
+syn match vimCmdSep "[:|]\+" skipwhite nextgroup=@vimCmdList,vimSubst1
+syn match vimIsCommand "\<\%(\h\w*\|[23]mat\%[ch]\)\>" contains=vimCommand
syn match vimVar contained "\<\h[a-zA-Z0-9#_]*\>"
syn match vimVar "\<[bwglstav]:\h[a-zA-Z0-9#_]*\>"
-syn match vimVar "\s\zs&\a\+\>"
+syn match vimVar "\s\zs&\%([lg]:\)\=\a\+\>"
+syn match vimVar "\s\zs&t_\S[a-zA-Z0-9]\>"
+syn match vimVar "\s\zs&t_k;"
syn match vimFBVar contained "\<[bwglstav]:\h[a-zA-Z0-9#_]*\>"
syn keyword vimCommand contained in
+syn cluster vimExprList contains=vimEnvvar,vimFunc,vimFuncVar,vimNumber,vimOper,vimOperParen,vimLetRegister,vimString,vimVar
+
" Insertions And Appends: insert append {{{2
" (buftype != nofile test avoids having append, change, insert show up in the command window)
" =======================
@@ -168,11 +178,12 @@ endif
" Behave! {{{2
" =======
-syn match vimBehave "\<be\%[have]\>" skipwhite nextgroup=vimBehaveModel,vimBehaveError
-syn keyword vimBehaveModel contained mswin xterm
if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_nobehaveerror")
syn match vimBehaveError contained "[^ ]\+"
endif
+syn match vimBehave "\<be\%[have]\>" nextgroup=vimBehaveBang,vimBehaveModel,vimBehaveError skipwhite
+syn match vimBehaveBang contained "\a\@1<=!" nextgroup=vimBehaveModel skipwhite
+syn keyword vimBehaveModel contained mswin xterm
" Filetypes {{{2
" =========
@@ -185,22 +196,26 @@ syn keyword vimFTOption contained detect indent off on plugin
" Augroup : vimAugroupError removed because long augroups caused sync'ing problems. {{{2
" ======= : Trade-off: Increasing synclines with slower editing vs augroup END error checking.
-syn cluster vimAugroupList contains=vimAugroup,vimIsCommand,vimUserCmd,vimExecute,vimNotFunc,vimFuncName,vimFunction,vimFunctionError,vimLineComment,vimNotFunc,vimMap,vimSpecFile,vimOper,vimNumber,vimOperParen,vimComment,vim9Comment,vimString,vimSubst,vimMark,vimRegister,vimAddress,vimFilter,vimCmplxRepeat,vimComment,vim9Comment,vimLet,vimSet,vimAutoCmd,vimRegion,vimSynLine,vimNotation,vimCtrlChar,vimFuncVar,vimContinue,vimSetEqual,vimOption
+syn cluster vimAugroupList contains=@vimCmdList,vimFilter,vimFunc,vimLineComment,vimSpecFile,vimOper,vimNumber,vimOperParen,vimComment,vim9Comment,vimString,vimSubst,vimRegister,vimCmplxRepeat,vimRegion,vimNotation,vimCtrlChar,vimFuncVar,vimContinue
+syn match vimAugroup "\<aug\%[roup]\>" contains=vimAugroupKey,vimAugroupBang skipwhite nextgroup=vimAugroupBang,vimAutoCmdGroup
if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'a'
- syn region vimAugroup fold matchgroup=vimAugroupKey start="\<aug\%[roup]\>\ze\s\+\K\k*" end="\<aug\%[roup]\>\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList
+ syn region vimAugroup fold start="\<aug\%[roup]\>\ze\s\+\%([eE][nN][dD]\)\@!\S\+" matchgroup=vimAugroupKey end="\<aug\%[roup]\>\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList,vimAugroupkey skipwhite nextgroup=vimAugroupEnd
else
- syn region vimAugroup matchgroup=vimAugroupKey start="\<aug\%[roup]\>\ze\s\+\K\k*" end="\<aug\%[roup]\>\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList
+ syn region vimAugroup start="\<aug\%[roup]\>\ze\s\+\%([eE][nN][dD]\)\@!\S\+" matchgroup=vimAugroupKey end="\<aug\%[roup]\>\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList,vimAugroupkey skipwhite nextgroup=vimAugroupEnd
endif
-syn match vimAugroup "aug\%[roup]!" contains=vimAugroupKey
if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_noaugrouperror")
- syn match vimAugroupError "\<aug\%[roup]\>\s\+[eE][nN][dD]\>"
+ syn match vimAugroupError "\<aug\%[roup]\>\s\+[eE][nN][dD]\>"
endif
-syn keyword vimAugroupKey contained aug[roup]
+
+syn match vimAutoCmdGroup contained "\S\+"
+syn match vimAugroupEnd contained "\c\<END\>"
+syn match vimAugroupBang contained "\a\@1<=!" skipwhite nextgroup=vimAutoCmdGroup
+syn keyword vimAugroupKey contained aug[roup] skipwhite nextgroup=vimAugroupBang,vimAutoCmdGroup,vimAugroupEnd
" Operators: {{{2
" =========
-syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimType,vimRegister,vimContinue,vim9Comment,vimVar
-syn match vimOper "||\|&&\|[-+.!]" skipwhite nextgroup=vimString,vimSpecFile
+syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimType,vimRegister,@vimContinue,vim9Comment,vimVar
+syn match vimOper "||\|&&\|[-+*/%.!]" skipwhite nextgroup=vimString,vimSpecFile
syn match vimOper "\%#=1\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\|!\~#\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile
syn match vimOper "\(\<is\|\<isnot\)[?#]\{0,2}\>" skipwhite nextgroup=vimString,vimSpecFile
syn region vimOperParen matchgroup=vimParenSep start="(" end=")" contains=vimoperStar,@vimOperGroup
@@ -212,9 +227,9 @@ endif
" Functions : Tag is provided for those who wish to highlight tagged functions {{{2
" =========
syn cluster vimFuncList contains=vimCommand,vimFunctionError,vimFuncKey,Tag,vimFuncSID
-syn cluster vimFuncBodyList contains=vimAbb,vimAddress,vimAugroupKey,vimAutoCmd,vimCmplxRepeat,vimComment,vim9Comment,vimContinue,vimCtrlChar,vimEcho,vimEchoHL,vimEnvvar,vimExecute,vimIsCommand,vimFBVar,vimFunc,vimFunction,vimFuncVar,vimGlobal,vimHighlight,vimIsCommand,vimLet,vimLetHereDoc,vimLineComment,vimMap,vimMark,vimNorm,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegion,vimRegister,vimSearch,vimSet,vimSpecFile,vimString,vimSubst,vimSynLine,vimUnmap,vimUserCommand
+syn cluster vimFuncBodyList contains=@vimCmdList,vimCmplxRepeat,vimComment,vim9Comment,vimContinue,vimCtrlChar,vimEnvvar,vimFBVar,vimFunc,vimFunction,vimFuncVar,vimLetHereDoc,vimLineComment,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegion,vimRegister,vimSearch,vimSpecFile,vimString,vimSubst
syn match vimFunction "\<\(fu\%[nction]\)!\=\s\+\%(<[sS][iI][dD]>\|[sSgGbBwWtTlL]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)*\ze\s*(" contains=@vimFuncList nextgroup=vimFuncBody
- syn match vimFunction "\<def!\=\ze\s*(" contains=@vimFuncList nextgroup=vimFuncBody
+syn match vimFunction "\<def!\=\ze\s*(" contains=@vimFuncList nextgroup=vimFuncBody
if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'f'
syn region vimFuncBody contained fold start="\ze\s*(" matchgroup=vimCommand end="\<\(endf\>\|endfu\%[nction]\>\|enddef\>\)" contains=@vimFuncBodyList
@@ -229,21 +244,34 @@ syn match vimFuncBlank contained "\s\+"
syn keyword vimPattern contained start skip end
" vimTypes : new for vim9
- syn match vimType ":\s*\zs\<\(bool\|number\|float\|string\|blob\|list<\|dict<\|job\|channel\|func\)\>"
+syn match vimType ":\s*\zs\<\(bool\|number\|float\|string\|blob\|list<\|dict<\|job\|channel\|func\)\>"
+
+" Keymaps: (Vim Project Addition) {{{2
+" =======
+
+" TODO: autogenerated vimCommand keyword list does not handle all abbreviations
+" : handle Vim9 script comments when something like #13104 is merged
+syn match vimKeymapStart "^" contained skipwhite nextgroup=vimKeymapLhs,vimKeymapLineComment
+syn match vimKeymapLhs "\S\+" contained skipwhite nextgroup=vimKeymapRhs contains=vimNotation
+syn match vimKeymapRhs "\S\+" contained skipwhite nextgroup=vimKeymapTailComment contains=vimNotation
+syn match vimKeymapTailComment "\S.*" contained
+syn match vimKeymapLineComment +".*+ contained contains=@vimCommentGroup,vimCommentString,vimCommentTitle
+
+syn region vimKeymap matchgroup=vimCommand start="\<loadk\%[eymap]\>" end="\%$" contains=vimKeymapStart
" Special Filenames, Modifiers, Extension Removal: {{{2
" ===============================================
-syn match vimSpecFile "<c\(word\|WORD\)>" nextgroup=vimSpecFileMod,vimSubst
-syn match vimSpecFile "<\([acs]file\|amatch\|abuf\)>" nextgroup=vimSpecFileMod,vimSubst
-syn match vimSpecFile "\s%[ \t:]"ms=s+1,me=e-1 nextgroup=vimSpecFileMod,vimSubst
-syn match vimSpecFile "\s%$"ms=s+1 nextgroup=vimSpecFileMod,vimSubst
-syn match vimSpecFile "\s%<"ms=s+1,me=e-1 nextgroup=vimSpecFileMod,vimSubst
-syn match vimSpecFile "#\d\+\|[#%]<\>" nextgroup=vimSpecFileMod,vimSubst
+syn match vimSpecFile "<c\(word\|WORD\)>" nextgroup=vimSpecFileMod,vimSubst1
+syn match vimSpecFile "<\([acs]file\|amatch\|abuf\)>" nextgroup=vimSpecFileMod,vimSubst1
+syn match vimSpecFile "\s%[ \t:]"ms=s+1,me=e-1 nextgroup=vimSpecFileMod,vimSubst1
+syn match vimSpecFile "\s%$"ms=s+1 nextgroup=vimSpecFileMod,vimSubst1
+syn match vimSpecFile "\s%<"ms=s+1,me=e-1 nextgroup=vimSpecFileMod,vimSubst1
+syn match vimSpecFile "#\d\+\|[#%]<\>" nextgroup=vimSpecFileMod,vimSubst1
syn match vimSpecFileMod "\(:[phtre]\)\+" contained
" User-Specified Commands: {{{2
" =======================
-syn cluster vimUserCmdList contains=vimAddress,vimSyntax,vimHighlight,vimAutoCmd,vimCmplxRepeat,vimComment,vim9Comment,vimCtrlChar,vimEscapeBrace,vimFunc,vimFuncName,vimFunction,vimFunctionError,vimIsCommand,vimMark,vimNotation,vimNumber,vimOper,vimRegion,vimRegister,vimLet,vimSet,vimSetEqual,vimSetString,vimSpecFile,vimString,vimSubst,vimSubstRep,vimSubstRange,vimSynLine
+syn cluster vimUserCmdList contains=@vimCmdList,vimCmplxRepeat,vimComment,vim9Comment,vimCtrlChar,vimEscapeBrace,vimFunc,vimNotation,vimNumber,vimOper,vimRegion,vimRegister,vimSpecFile,vimString,vimSubst,vimSubstRep,vimSubstRange
syn keyword vimUserCommand contained com[mand]
syn match vimUserCmd "\<com\%[mand]!\=\>.*$" contains=vimUserAttrb,vimUserAttrbError,vimUserCommand,@vimUserCmdList,vimComFilter
syn match vimUserAttrbError contained "-\a\+\ze\s"
@@ -260,9 +288,10 @@ if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_nousercmderror")
endif
syn case ignore
syn keyword vimUserAttrbKey contained bar ban[g] cou[nt] ra[nge] com[plete] n[args] re[gister]
-syn keyword vimUserAttrbCmplt contained augroup buffer behave color command compiler cscope dir environment event expression file file_in_path filetype function help highlight history locale mapping menu option packadd shellcmd sign syntax syntime tag tag_listfiles user var
+" GEN_SYN_VIM: vimUserAttrbCmplt, START_STR='syn keyword vimUserAttrbCmplt contained', END_STR=''
+syn keyword vimUserAttrbCmplt contained arglist augroup behave buffer color command compiler cscope diff_buffer dir environment event expression file file_in_path filetype function help highlight history keymap locale mapclear mapping menu messages syntax syntime option packadd runtime shellcmd sign tag tag_listfiles user var breakpoint scriptnames
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 match vimUserAttrbCmpltFunc contained ",\%([sS]:\|<[sS][iI][dD]>\)\=\%(\h\w*\%([.#]\h\w*\)\+\|\h\w*\)"hs=s+1 nextgroup=vimUserCmdError
syn case match
syn match vimUserAttrbCmplt contained "custom,\u\w*"
@@ -299,45 +328,54 @@ syn match vimNotPatSep contained "\\\\"
syn cluster vimStringGroup contains=vimEscape,vimEscapeBrace,vimPatSep,vimNotPatSep,vimPatSepErr,vimPatSepZone,@Spell
syn region vimString oneline keepend start=+[^a-zA-Z>!\\@]"+lc=1 skip=+\\\\\|\\"+ matchgroup=vimStringEnd end=+"+ contains=@vimStringGroup
syn region vimString oneline keepend start=+[^a-zA-Z>!\\@]'+lc=1 end=+'+
-syn region vimString oneline start=+=!+lc=1 skip=+\\\\\|\\!+ end=+!+ contains=@vimStringGroup
-syn region vimString oneline start="=+"lc=1 skip="\\\\\|\\+" end="+" contains=@vimStringGroup
"syn region vimString oneline start="\s/\s*\A"lc=1 skip="\\\\\|\\+" end="/" contains=@vimStringGroup " see tst45.vim
syn match vimString contained +"[^"]*\\$+ skipnl nextgroup=vimStringCont
syn match vimStringCont contained +\(\\\\\|.\)\{-}[^\\]"+
syn match vimEscape contained "\\."
+" syn match vimEscape contained +\\[befnrt\"]+
+syn match vimEscape contained "\\\o\{1,3}\|\\[xX]\x\{1,2}\|\\u\x\{1,4}\|\\U\x\{1,8}"
+syn match vimEscape contained "\\<" contains=vimNotation
+syn match vimEscape contained "\\<\*[^>]*>\=>"
+
+syn region vimString oneline start=+$'+ skip=+''+ end=+'+ contains=vimStringInterpolationBrace,vimStringInterpolationExpr
+syn region vimString oneline start=+$"+ end=+"+ contains=@vimStringGroup,vimStringInterpolationBrace,vimStringInterpolationExpr
+syn region vimStringInterpolationExpr oneline contained matchgroup=vimSep start=+{+ end=+}+ contains=@vimExprList
+syn match vimStringInterpolationBrace contained "{{"
+syn match vimStringInterpolationBrace contained "}}"
" Substitutions: {{{2
" =============
syn cluster vimSubstList contains=vimPatSep,vimPatRegion,vimPatSepErr,vimSubstTwoBS,vimSubstRange,vimNotation
syn cluster vimSubstRepList contains=vimSubstSubstr,vimSubstTwoBS,vimNotation
syn cluster vimSubstList add=vimCollection
-syn match vimSubst "\(:\+\s*\|^\s*\||\s*\)\<\%(\<s\%[ubstitute]\>\|\<sm\%[agic]\>\|\<sno\%[magic]\>\)[:#[:alpha:]]\@!" nextgroup=vimSubstPat
-"syn match vimSubst "\%(^\|[^\\]\)\<s\%[ubstitute]\>[:#[:alpha:]]\@!" nextgroup=vimSubstPat contained
-syn match vimSubst "\%(^\|[^\\\"']\)\<s\%[ubstitute]\>[:#[:alpha:]\"']\@!" nextgroup=vimSubstPat contained
-syn match vimSubst "/\zs\<s\%[ubstitute]\>\ze/" nextgroup=vimSubstPat
-syn match vimSubst "\(:\+\s*\|^\s*\)s\ze#.\{-}#.\{-}#" nextgroup=vimSubstPat
-syn match vimSubst1 contained "\<s\%[ubstitute]\>" nextgroup=vimSubstPat
-syn match vimSubst2 contained "s\%[ubstitute]\>" nextgroup=vimSubstPat
-syn region vimSubstPat contained matchgroup=vimSubstDelim start="\z([^a-zA-Z( \t[\]&]\)"rs=s+1 skip="\\\\\|\\\z1" end="\z1"re=e-1,me=e-1 contains=@vimSubstList nextgroup=vimSubstRep4 oneline
-syn region vimSubstRep4 contained matchgroup=vimSubstDelim start="\z(.\)" skip="\\\\\|\\\z1" end="\z1" matchgroup=vimNotation end="<[cC][rR]>" contains=@vimSubstRepList nextgroup=vimSubstFlagErr oneline
-syn region vimCollection contained transparent start="\\\@<!\[" skip="\\\[" end="\]" contains=vimCollClass
-syn match vimCollClassErr contained "\[:.\{-\}:\]"
-syn match vimCollClass contained transparent "\%#=1\[:\(alnum\|alpha\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|xdigit\|return\|tab\|escape\|backspace\):\]"
-syn match vimSubstSubstr contained "\\z\=\d"
-syn match vimSubstTwoBS contained "\\\\"
-syn match vimSubstFlagErr contained "[^< \t\r|]\+" contains=vimSubstFlags
-syn match vimSubstFlags contained "[&cegiIlnpr#]\+"
+syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)\>[\"#|]\@!" nextgroup=vimSubstPat
+syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)_\@=" nextgroup=vimSubstPat
+syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\ze#.\{-}#.\{-}#" nextgroup=vimSubstPat
+syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\>[\"#|]\@!" nextgroup=vimSubstPat
+syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)_\@=" nextgroup=vimSubstPat
+syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\ze#.\{-}#.\{-}#" nextgroup=vimSubstPat
+" TODO: Vim9 illegal separators for abbreviated :s form are [-.:], :su\%[...] required
+" : # is allowed but "not recommended" (see :h pattern-delimiter)
+syn region vimSubstPat contained matchgroup=vimSubstDelim start="\z([!#$%&'()*+,-./:;<=>?@[\]^_`{}~]\)"rs=s+1 skip="\\\\\|\\\z1" end="\z1"re=e-1,me=e-1 contains=@vimSubstList nextgroup=vimSubstRep4 oneline
+syn region vimSubstRep4 contained matchgroup=vimSubstDelim start="\z(.\)" skip="\\\\\|\\\z1" end="\z1" matchgroup=vimNotation end="<[cC][rR]>" contains=@vimSubstRepList nextgroup=vimSubstFlagErr oneline
+syn region vimCollection contained transparent start="\\\@<!\[" skip="\\\[" end="\]" contains=vimCollClass
+syn match vimCollClassErr contained "\[:.\{-\}:\]"
+syn match vimCollClass contained transparent "\%#=1\[:\(alnum\|alpha\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|xdigit\|retu\%[rn]\|tab\|escape\|backspace\):\]"
+syn match vimSubstSubstr contained "\\z\=\d"
+syn match vimSubstTwoBS contained "\\\\"
+syn match vimSubstFlagErr contained "[^< \t\r|]\+" contains=vimSubstFlags
+syn match vimSubstFlags contained "[&cegiIlnpr#]\+"
" 'String': {{{2
syn match vimString "[^(,]'[^']\{-}\zs'"
" Marks, Registers, Addresses, Filters: {{{2
-syn match vimMark "'[a-zA-Z0-9]\ze[-+,!]" nextgroup=vimFilter,vimMarkNumber,vimSubst
-syn match vimMark "'[<>]\ze[-+,!]" nextgroup=vimFilter,vimMarkNumber,vimSubst
-syn match vimMark ",\zs'[<>]\ze" nextgroup=vimFilter,vimMarkNumber,vimSubst
-syn match vimMark "[!,:]\zs'[a-zA-Z0-9]" nextgroup=vimFilter,vimMarkNumber,vimSubst
-syn match vimMark "\<norm\%[al]\s\zs'[a-zA-Z0-9]" nextgroup=vimFilter,vimMarkNumber,vimSubst
-syn match vimMarkNumber "[-+]\d\+" contained contains=vimOper nextgroup=vimSubst2
+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 "[!,:]\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
syn match vimPlainMark contained "'[a-zA-Z0-9]"
syn match vimRange "[`'][a-zA-Z0-9],[`'][a-zA-Z0-9]" contains=vimMark skipwhite nextgroup=vimFilter
@@ -346,6 +384,7 @@ syn match vimRegister '\<norm\s\+\zs"[a-zA-Z0-9]'
syn match vimRegister '\<normal\s\+\zs"[a-zA-Z0-9]'
syn match vimRegister '@"'
syn match vimPlainRegister contained '"[a-zA-Z0-9\-:.%#*+=]'
+syn match vimLetRegister contained '@["0-9\-a-zA-Z#=*+_/]'
syn match vimAddress ",\zs[.$]" skipwhite nextgroup=vimSubst1
syn match vimAddress "%\ze\a" skipwhite nextgroup=vimString,vimSubst1
@@ -355,24 +394,36 @@ syn match vimFilter contained "!!\=[^"]\{-}\(|\|\ze\"\|$\)" contains=vimOper,
syn match vimComFilter contained "|!!\=[^"]\{-}\(|\|\ze\"\|$\)" contains=vimOper,vimSpecFile
" Complex Repeats: (:h complex-repeat) {{{2
+" ===============
syn match vimCmplxRepeat '[^a-zA-Z_/\\()]q[0-9a-zA-Z"]\>'lc=1
syn match vimCmplxRepeat '@[0-9a-z".=@:]\ze\($\|[^a-zA-Z]\>\)'
" Set command and associated set-options (vimOptions) with comment {{{2
syn region vimSet matchgroup=vimCommand start="\<\%(setl\%[ocal]\|setg\%[lobal]\|se\%[t]\)\>" skip="\%(\\\\\)*\\.\n\@!" end="$" end="|" matchgroup=vimNotation end="<[cC][rR]>" keepend contains=vimSetEqual,vimOption,vimErrSetting,vimComment,vim9Comment,vimSetString,vimSetMod
- syn region vimSetEqual contained start="[=:]\|[-+^]=" skip="\\\\\|\\\s" end="[| \t]"me=e-1 end="$" contains=vimCtrlChar,vimSetSep,vimNotation,vimEnvvar
+syn region vimSetEqual contained start="[=:]\|[-+^]=" skip="\\\\\|\\\s" end="[| \t]"me=e-1 end="$" contains=vimCtrlChar,vimSetSep,vimNotation,vimEnvvar
syn region vimSetString contained start=+="+hs=s+1 skip=+\\\\\|\\"+ end=+"+ contains=vimCtrlChar
syn match vimSetSep contained "[,:]"
syn match vimSetMod contained "&vim\=\|[!&?<]\|all&"
" Let: {{{2
" ===
-syn keyword vimLet let unl[et] skipwhite nextgroup=vimVar,vimFuncVar,vimLetHereDoc
+syn keyword vimLet let skipwhite nextgroup=vimVar,vimFuncVar,vimLetHereDoc,vimLetRegister,vimVarList
+syn keyword vimConst cons[t] skipwhite nextgroup=vimVar,vimLetHereDoc,vimVarList
+syn region vimVarList contained start="\[" end="]" contains=vimVar,vimContinue
+
+syn keyword vimUnlet unl[et] skipwhite nextgroup=vimUnletBang,vimUnletVars
+syn match vimUnletBang contained "!" skipwhite nextgroup=vimUnletVars
+syn region vimUnletVars contained start="$\I\|\h" skip="\n\s*\\" end="$" end="|" contains=vimVar,vimEnvvar,vimContinue,vimString,vimNumber
+
VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s*\%(trim\s\+\%(eval\s\+\)\=\|eval\s\+\%(trim\s\+\)\=\)\=\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\s*\z1\s*$'
+" For: {{{2
+" ===
+syn keyword vimFor for skipwhite nextgroup=vimVar,vimVarList
" Abbreviations: {{{2
" =============
-syn keyword vimAbb ab[breviate] ca[bbrev] inorea[bbrev] cnorea[bbrev] norea[bbrev] ia[bbrev] skipwhite nextgroup=vimMapMod,vimMapLhs
+" GEN_SYN_VIM: vimCommand abbrev, START_STR='syn keyword vimAbb', END_STR='skipwhite nextgroup=vimMapMod,vimMapLhs'
+syn keyword vimAbb ab[breviate] ca[bbrev] cnorea[bbrev] cuna[bbrev] ia[bbrev] inorea[bbrev] iuna[bbrev] norea[bbrev] una[bbreviate] skipwhite nextgroup=vimMapMod,vimMapLhs
" Autocmd: {{{2
" =======
@@ -382,25 +433,32 @@ syn match vimAutoCmdSfxList contained "\S*" skipwhite nextgroup=vimAutoCmdMod
syn keyword vimAutoCmd au[tocmd] do[autocmd] doautoa[ll] skipwhite nextgroup=vimAutoEventList
syn match vimAutoCmdMod "\(++\)\=\(once\|nested\)"
-" Echo and Execute: -- prefer strings! {{{2
+" Echo And Execute: -- prefer strings! {{{2
" ================
-syn region vimEcho oneline excludenl matchgroup=vimCommand start="\<ec\%[ho]\>" skip="\(\\\\\)*\\|" end="$\||" contains=vimFunc,vimFuncVar,vimString,vimVar
-syn region vimExecute oneline excludenl matchgroup=vimCommand start="\<exe\%[cute]\>" skip="\(\\\\\)*\\|" end="$\||\|<[cC][rR]>" contains=vimFuncVar,vimIsCommand,vimOper,vimNotation,vimOperParen,vimString,vimVar
-syn match vimEchoHL "echohl\=" skipwhite nextgroup=vimGroup,vimHLGroup,vimEchoHLNone,vimOnlyHLGroup,nvimHLGroup
+" GEN_SYN_VIM: vimCommand echo, START_STR='syn keyword vimEcho', END_STR='skipwhite nextgroup=vimEchoExpr'
+syn keyword vimEcho ec[ho] echoe[rr] echom[sg] echoc[onsole] echon echow[indow] skipwhite nextgroup=vimEchoExpr
+syn region vimEchoExpr contained start="[^[:space:]|]" skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ + matchgroup=vimCmdSep end="|" end="$" contains=@vimContinue,@vimExprList
+
+syn match vimEchoHL "\<echohl\=\>" skipwhite nextgroup=vimGroup,vimHLGroup,vimEchoHLNone,vimOnlyHLGroup,nvimHLGroup
syn case ignore
syn keyword vimEchoHLNone none
syn case match
+syn region vimExecute oneline excludenl matchgroup=vimCommand start="\<exe\%[cute]\>" skip="\(\\\\\)*\\|" end="$\||\|<[cC][rR]>" contains=vimFuncVar,vimIsCommand,vimOper,vimNotation,vimOperParen,vimString,vimVar
+
" Maps: {{{2
" ====
-syn match vimMap "\<map\>!\=\ze\s*[^(]" skipwhite nextgroup=vimMapMod,vimMapLhs
-syn keyword vimMap cm[ap] cno[remap] im[ap] ino[remap] lm[ap] ln[oremap] nm[ap] nn[oremap] no[remap] om[ap] ono[remap] smap snor[emap] tno[remap] tm[ap] vm[ap] vmapc[lear] vn[oremap] xm[ap] xn[oremap] skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs
-syn keyword nvimMap tn[oremap] tm[ap] skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs
-syn keyword vimMap mapc[lear] smapc[lear]
-syn keyword vimUnmap cu[nmap] iu[nmap] lu[nmap] nun[map] ou[nmap] sunm[ap] unm[ap] unm[ap] vu[nmap] xu[nmap] skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs
-syn keyword nvimUnmap tunm[ap] skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs
+syn match vimMap "\<map\>\ze\s*(\@!" skipwhite nextgroup=vimMapMod,vimMapLhs
+syn match vimMap "\<map!" contains=vimMapBang skipwhite nextgroup=vimMapMod,vimMapLhs
+" GEN_SYN_VIM: vimCommand map, START_STR='syn keyword vimMap', END_STR='skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs'
+syn keyword vimMap cm[ap] cno[remap] im[ap] ino[remap] lm[ap] ln[oremap] nm[ap] nn[oremap] no[remap] om[ap] ono[remap] smap snor[emap] tma[p] tno[remap] vm[ap] vn[oremap] xm[ap] xn[oremap] skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs
+" GEN_SYN_VIM: vimCommand mapclear, START_STR='syn keyword vimMap', END_STR='skipwhite nextgroup=vimMapMod'
+syn keyword vimMap cmapc[lear] imapc[lear] lmapc[lear] nmapc[lear] omapc[lear] smapc[lear] tmapc[lear] vmapc[lear] xmapc[lear] skipwhite nextgroup=vimMapMod
+syn keyword vimMap mapc[lear] skipwhite nextgroup=vimMapBang,vimMapMod
+" GEN_SYN_VIM: vimCommand unmap, START_STR='syn keyword vimUnmap', END_STR='skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs'
+syn keyword vimUnmap cu[nmap] iu[nmap] lu[nmap] nun[map] ou[nmap] sunm[ap] tunma[p] unm[ap] vu[nmap] xu[nmap] skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs
syn match vimMapLhs contained "\S\+" contains=vimNotation,vimCtrlChar skipwhite nextgroup=vimMapRhs
-syn match vimMapBang contained "!" skipwhite nextgroup=vimMapMod,vimMapLhs
+syn match vimMapBang contained "\a\@1<=!" skipwhite nextgroup=vimMapMod,vimMapLhs
syn match vimMapMod contained "\%#=1\c<\(buffer\|expr\|\(local\)\=leader\|nowait\|plug\|script\|sid\|unique\|silent\)\+>" contains=vimMapModKey,vimMapModErr skipwhite nextgroup=vimMapMod,vimMapLhs
syn match vimMapRhs contained ".*" contains=vimNotation,vimCtrlChar skipnl nextgroup=vimMapRhsExtend
syn match vimMapRhsExtend contained "^\s*\\.*$" contains=vimContinue
@@ -411,7 +469,8 @@ syn case match
" Menus: {{{2
" =====
syn cluster vimMenuList contains=vimMenuBang,vimMenuPriority,vimMenuName,vimMenuMod
-syn keyword vimCommand am[enu] an[oremenu] aun[menu] cme[nu] cnoreme[nu] cunme[nu] ime[nu] inoreme[nu] iunme[nu] me[nu] nme[nu] nnoreme[nu] noreme[nu] nunme[nu] ome[nu] onoreme[nu] ounme[nu] tlm[enu] tln[oremenu] tlu[nmenu] unme[nu] vme[nu] vnoreme[nu] vunme[nu] skipwhite nextgroup=@vimMenuList
+" GEN_SYN_VIM: vimCommand menu, START_STR='syn keyword vimCommand', END_STR='skipwhite nextgroup=@vimMenuList'
+syn keyword vimCommand am[enu] an[oremenu] aun[menu] cme[nu] cnoreme[nu] cunme[nu] ime[nu] inoreme[nu] iunme[nu] me[nu] nme[nu] nnoreme[nu] noreme[nu] nunme[nu] ome[nu] onoreme[nu] ounme[nu] sme[nu] snoreme[nu] sunme[nu] tlm[enu] tln[oremenu] tlu[nmenu] unme[nu] vme[nu] vnoreme[nu] vunme[nu] xme[nu] xnoreme[nu] xunme[nu] skipwhite nextgroup=@vimMenuList
syn match vimMenuName "[^ \t\\<]\+" contained nextgroup=vimMenuNameMore,vimMenuMap
syn match vimMenuPriority "\d\+\(\.\d\+\)*" contained skipwhite nextgroup=vimMenuName
syn match vimMenuNameMore "\c\\\s\|<tab>\|\\\." contained nextgroup=vimMenuName,vimMenuNameMore contains=vimNotation
@@ -423,12 +482,23 @@ syn match vimMenuBang "!" contained skipwhite nextgroup=@vimMenuList
" Angle-Bracket Notation: (tnx to Michael Geddes) {{{2
" ======================
syn case ignore
-syn match vimNotation "\%#=1\(\\\|<lt>\)\=<\([scamd]-\)\{0,4}x\=\(f\d\{1,2}\|[^ \t:]\|cmd\|cr\|lf\|linefeed\|return\|enter\|k\=del\%[ete]\|bs\|backspace\|tab\|esc\|right\|left\|help\|undo\|insert\|ins\|mouse\|k\=home\|k\=end\|kplus\|kminus\|kdivide\|kmultiply\|kenter\|kpoint\|space\|k\=\(page\)\=\(\|down\|up\|k\d\>\)\)>" contains=vimBracket
-syn match vimNotation "\%#=1\(\\\|<lt>\)\=<\([scam2-4]-\)\{0,4}\(right\|left\|middle\)\(mouse\)\=\(drag\|release\)\=>" contains=vimBracket
-syn match vimNotation "\%#=1\(\\\|<lt>\)\=<\(bslash\|plug\|sid\|space\|bar\|nop\|nul\|lt\)>" contains=vimBracket
-syn match vimNotation '\(\\\|<lt>\)\=<C-R>[0-9a-z"%#:.\-=]'he=e-1 contains=vimBracket
-syn match vimNotation '\%#=1\(\\\|<lt>\)\=<\%(q-\)\=\(line[12]\|count\|bang\|reg\|args\|mods\|f-args\|f-mods\|lt\)>' contains=vimBracket
-syn match vimNotation "\%#=1\(\\\|<lt>\)\=<\([cas]file\|abuf\|amatch\|cword\|cWORD\|client\)>" contains=vimBracket
+syn match vimNotation "\%#=1\%(\\\|<lt>\)\=<\%([scamd]-\)\{0,4}x\=\%(f\d\{1,2}\|[^ \t:]\|space\|bar\|bslash\|nl\|newline\|lf\|linefeed\|cr\|retu\%[rn]\|enter\|k\=del\%[ete]\|bs\|backspace\|tab\|esc\|csi\|right\|paste\%(start\|end\)\|left\|help\|undo\|k\=insert\|ins\|mouse\|[kz]\=home\|[kz]\=end\|kplus\|kminus\|kdivide\|kmultiply\|kenter\|kpoint\|space\|k\=\%(page\)\=\%(\|down\|up\|k\d\>\)\)>" contains=vimBracket
+
+syn match vimNotation "\%#=1\%(\\\|<lt>\)\=<\%([scamd2-4]-\)\{0,4}\%(net\|dec\|jsb\|pterm\|urxvt\|sgr\)mouse>" contains=vimBracket
+syn match vimNotation "\%#=1\%(\\\|<lt>\)\=<\%([scamd2-4]-\)\{0,4}\%(left\|middle\|right\)\%(mouse\|drag\|release\)>" contains=vimBracket
+syn match vimNotation "\%#=1\%(\\\|<lt>\)\=<\%([scamd2-4]-\)\{0,4}left\%(mouse\|release\)nm>" contains=vimBracket
+syn match vimNotation "\%#=1\%(\\\|<lt>\)\=<\%([scamd2-4]-\)\{0,4}x[12]\%(mouse\|drag\|release\)>" contains=vimBracket
+syn match vimNotation "\%#=1\%(\\\|<lt>\)\=<\%([scamd2-4]-\)\{0,4}sgrmouserelease>" contains=vimBracket
+syn match vimNotation "\%#=1\%(\\\|<lt>\)\=<\%([scamd2-4]-\)\{0,4}mouse\%(up\|down\|move\)>" contains=vimBracket
+syn match vimNotation "\%#=1\%(\\\|<lt>\)\=<\%([scamd2-4]-\)\{0,4}scrollwheel\%(up\|down\|right\|left\)>" contains=vimBracket
+
+syn match vimNotation "\%#=1\%(\\\|<lt>\)\=<\%(sid\|nop\|nul\|lt\|drop\)>" contains=vimBracket
+syn match vimNotation "\%#=1\%(\\\|<lt>\)\=<\%(snr\|plug\|cursorhold\|ignore\|cmd\|scriptcmd\|focus\%(gained\|lost\)\)>" contains=vimBracket
+syn match vimNotation '\%(\\\|<lt>\)\=<C-R>[0-9a-z"%#:.\-=]'he=e-1 contains=vimBracket
+syn match vimNotation '\%#=1\%(\\\|<lt>\)\=<\%(q-\)\=\%(line[12]\|count\|bang\|reg\|args\|mods\|f-args\|f-mods\|lt\)>' contains=vimBracket
+syn match vimNotation "\%#=1\%(\\\|<lt>\)\=<\%([cas]file\|abuf\|amatch\|cexpr\|cword\|cWORD\|client\|stack\|script\|sf\=lnum\)>" contains=vimBracket
+syn match vimNotation "\%#=1\%(\\\|<lt>\)\=<\%([scamd]-\)\{0,4}char-\%(\d\+\|0\o\+\|0x\x\+\)>" contains=vimBracket
+
syn match vimBracket contained "[\\<>]"
syn case match
@@ -460,16 +530,22 @@ syn match vimNormCmds contained ".*$"
" Syntax: {{{2
"=======
-syn match vimGroupList contained "@\=[^ \t,]*" contains=vimGroupSpecial,vimPatSep
-syn match vimGroupList contained "@\=[^ \t,]*," nextgroup=vimGroupList contains=vimGroupSpecial,vimPatSep
+syn match vimGroupList contained "[^[:space:],]\+\%(\s*,\s*[^[:space:],]\+\)*" contains=vimGroupSpecial
+syn region vimGroupList contained start=/^\s*["#]\\ \|^\s*\\\|[^[:space:],]\+\s*,/ skip=/\s*\n\s*\\\|\s*\n\s*["#]\\ \|^\s*\\\|^\s*["#]\\ / end=/[^[:space:],]\s*$\|[^[:space:],]\ze\s\+\w/ contains=@vimContinue,vimGroupSpecial
syn keyword vimGroupSpecial contained ALL ALLBUT CONTAINED TOP
+
if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_novimsynerror")
syn match vimSynError contained "\i\+"
syn match vimSynError contained "\i\+=" nextgroup=vimGroupList
endif
-syn match vimSynContains contained "\<contain\(s\|edin\)=" nextgroup=vimGroupList
-syn match vimSynKeyContainedin contained "\<containedin=" nextgroup=vimGroupList
-syn match vimSynNextgroup contained "nextgroup=" nextgroup=vimGroupList
+syn match vimSynContains contained "\<contain\%(s\|edin\)=" skipwhite skipnl nextgroup=vimGroupList
+syn match vimSynKeyContainedin contained "\<containedin=" skipwhite skipnl nextgroup=vimGroupList
+syn match vimSynNextgroup contained "\<nextgroup=" skipwhite skipnl nextgroup=vimGroupList
+if has("conceal")
+ " no whitespace allowed after '='
+ syn match vimSynCchar contained "\<cchar=" nextgroup=vimSynCcharValue
+ syn match vimSynCcharValue contained "\S"
+endif
syn match vimSyntax "\<sy\%[ntax]\>" contains=vimCommand skipwhite nextgroup=vimSynType,vimComment,vim9Comment
syn match vimAuSyntax contained "\s+sy\%[ntax]" contains=vimCommand skipwhite nextgroup=vimSynType,vimComment,vim9Comment
@@ -487,10 +563,16 @@ syn keyword vimSynType contained clear skipwhite nextgroup=vimGroupList
" Syntax: cluster {{{2
syn keyword vimSynType contained cluster skipwhite nextgroup=vimClusterName
-syn region vimClusterName contained matchgroup=vimGroupName start="\h\w*" skip="\\\\\|\\|" matchgroup=vimSep end="$\||" contains=vimGroupAdd,vimGroupRem,vimSynContains,vimSynError
-syn match vimGroupAdd contained "add=" nextgroup=vimGroupList
-syn match vimGroupRem contained "remove=" nextgroup=vimGroupList
-syn cluster vimFuncBodyList add=vimSynType,vimGroupAdd,vimGroupRem
+syn region vimClusterName contained keepend matchgroup=vimGroupName start="\h\w*\>" skip=+\\\\\|\\\|\n\s*\\\|\n\s*"\\ + matchgroup=vimCmdSep end="$\||" contains=@vimContinue,vimGroupAdd,vimGroupRem,vimSynContains,vimSynError
+syn match vimGroupAdd contained keepend "\<add=" skipwhite skipnl nextgroup=vimGroupList
+syn match vimGroupRem contained keepend "\<remove=" skipwhite skipnl nextgroup=vimGroupList
+
+" Syntax: foldlevel {{{2
+syn keyword vimSynType contained foldlevel skipwhite nextgroup=vimSynFoldMethod,vimSynFoldMethodError
+if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_novimsynfoldmethoderror")
+ syn match vimSynFoldMethodError contained "\i\+"
+endif
+syn keyword vimSynFoldMethod contained start minimum
" Syntax: iskeyword {{{2
syn keyword vimSynType contained iskeyword skipwhite nextgroup=vimIskList
@@ -499,38 +581,31 @@ syn match vimIskSep contained ','
" Syntax: include {{{2
syn keyword vimSynType contained include skipwhite nextgroup=vimGroupList
-syn cluster vimFuncBodyList add=vimSynType
" Syntax: keyword {{{2
-syn cluster vimSynKeyGroup contains=vimSynNextgroup,vimSynKeyOpt,vimSynKeyContainedin
+syn cluster vimSynKeyGroup contains=@vimContinue,vimSynCchar,vimSynNextgroup,vimSynKeyOpt,vimSynKeyContainedin
syn keyword vimSynType contained keyword skipwhite nextgroup=vimSynKeyRegion
-syn region vimSynKeyRegion contained oneline keepend matchgroup=vimGroupName start="\h\w*" skip="\\\\\|\\|" matchgroup=vimSep end="|\|$" contains=@vimSynKeyGroup
+syn region vimSynKeyRegion contained keepend matchgroup=vimGroupName start="\h\w*\>" skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ + matchgroup=vimCmdSep end="|\|$" contains=@vimSynKeyGroup
syn match vimSynKeyOpt contained "\%#=1\<\(conceal\|contained\|transparent\|skipempty\|skipwhite\|skipnl\)\>"
-syn cluster vimFuncBodyList add=vimSynType
" Syntax: match {{{2
-syn cluster vimSynMtchGroup contains=vimMtchComment,vimSynContains,vimSynError,vimSynMtchOpt,vimSynNextgroup,vimSynRegPat,vimNotation,vim9Comment
+syn cluster vimSynMtchGroup contains=@vimContinue,vimSynCchar,vimSynContains,vimSynError,vimSynMtchOpt,vimSynNextgroup,vimSynRegPat,vimNotation,vimMtchComment
syn keyword vimSynType contained match skipwhite nextgroup=vimSynMatchRegion
-syn region vimSynMatchRegion contained keepend matchgroup=vimGroupName start="\h\w*" matchgroup=vimSep end="|\|$" contains=@vimSynMtchGroup
+syn region vimSynMatchRegion contained keepend matchgroup=vimGroupName start="\h\w*\>" skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ + matchgroup=vimCmdSep end="|\|$" contains=@vimSynMtchGroup
syn match vimSynMtchOpt contained "\%#=1\<\(conceal\|transparent\|contained\|excludenl\|keepend\|skipempty\|skipwhite\|display\|extend\|skipnl\|fold\)\>"
-if has("conceal")
- syn match vimSynMtchOpt contained "\<cchar=" nextgroup=vimSynMtchCchar
- syn match vimSynMtchCchar contained "\S"
-endif
-syn cluster vimFuncBodyList add=vimSynMtchGroup
" Syntax: off and on {{{2
syn keyword vimSynType contained enable list manual off on reset
" Syntax: region {{{2
-syn cluster vimSynRegPatGroup contains=vimPatSep,vimNotPatSep,vimSynPatRange,vimSynNotPatRange,vimSubstSubstr,vimPatRegion,vimPatSepErr,vimNotation
-syn cluster vimSynRegGroup contains=vimSynContains,vimSynNextgroup,vimSynRegOpt,vimSynReg,vimSynMtchGrp
+syn cluster vimSynRegPatGroup contains=@vimContinue,vimPatSep,vimNotPatSep,vimSynPatRange,vimSynNotPatRange,vimSubstSubstr,vimPatRegion,vimPatSepErr,vimNotation
+syn cluster vimSynRegGroup contains=@vimContinue,vimSynCchar,vimSynContains,vimSynNextgroup,vimSynRegOpt,vimSynReg,vimSynMtchGrp
syn keyword vimSynType contained region skipwhite nextgroup=vimSynRegion
-syn region vimSynRegion contained keepend matchgroup=vimGroupName start="\h\w*" skip="\\\\\|\\|" end="|\|$" contains=@vimSynRegGroup
+syn region vimSynRegion contained keepend matchgroup=vimGroupName start="\h\w*" skip=+\\\\\|\\\|\n\s*\\\|\n\s*"\\ + end="|\|$" contains=@vimSynRegGroup
syn match vimSynRegOpt contained "\%#=1\<\(conceal\(ends\)\=\|transparent\|contained\|excludenl\|skipempty\|skipwhite\|display\|keepend\|oneline\|extend\|skipnl\|fold\)\>"
-syn match vimSynReg contained "\(start\|skip\|end\)="he=e-1 nextgroup=vimSynRegPat
+syn match vimSynReg contained "\<\%(start\|skip\|end\)=" nextgroup=vimSynRegPat
syn match vimSynMtchGrp contained "matchgroup=" nextgroup=vimGroup,vimHLGroup,vimOnlyHLGroup,nvimHLGroup
-syn region vimSynRegPat contained extend start="\z([-`~!@#$%^&*_=+;:'",./?]\)" skip="\\\\\|\\\z1" end="\z1" contains=@vimSynRegPatGroup skipwhite nextgroup=vimSynPatMod,vimSynReg
+syn region vimSynRegPat contained extend start="\z([-`~!@#$%^&*_=+;:'",./?]\)" skip=/\\\\\|\\\z1\|\n\s*\\\|\n\s*"\\ / end="\z1" contains=@vimSynRegPatGroup skipwhite nextgroup=vimSynPatMod,vimSynReg
syn match vimSynPatMod contained "\%#=1\(hs\|ms\|me\|hs\|he\|rs\|re\)=[se]\([-+]\d\+\)\="
syn match vimSynPatMod contained "\%#=1\(hs\|ms\|me\|hs\|he\|rs\|re\)=[se]\([-+]\d\+\)\=," nextgroup=vimSynPatMod
syn match vimSynPatMod contained "lc=\d\+"
@@ -538,7 +613,6 @@ syn match vimSynPatMod contained "lc=\d\+," nextgroup=vimSynPatMod
syn region vimSynPatRange contained start="\[" skip="\\\\\|\\]" end="]"
syn match vimSynNotPatRange contained "\\\\\|\\\["
syn match vimMtchComment contained '"[^"]\+$'
-syn cluster vimFuncBodyList add=vimSynType
" Syntax: sync {{{2
" ============
@@ -572,7 +646,7 @@ syn match vimHiBang contained "!" skipwhite nextgroup=@vimHighlightCluster
syn match vimHiGroup contained "\i\+"
syn case ignore
-syn keyword vimHiAttrib contained none bold inverse italic nocombine reverse standout strikethrough underline undercurl underdouble underdotted underdashed
+syn keyword vimHiAttrib contained none bold inverse italic nocombine reverse standout strikethrough underline undercurl underdashed underdotted underdouble
syn keyword vimFgBgAttrib contained none bg background fg foreground
syn case match
syn match vimHiAttribList contained "\i\+" contains=vimHiAttrib
@@ -587,7 +661,7 @@ syn match vimHiGuiFontname contained "'[a-zA-Z\-* ]\+'"
syn match vimHiGuiRgb contained "#\x\{6}"
" Highlighting: hi group key=arg ... {{{2
-syn cluster vimHiCluster contains=vimGroup,vimHiBlend,vimHiGroup,vimHiTerm,vimHiCTerm,vimHiStartStop,vimHiCtermFgBg,vimHiCtermul,vimHiGui,vimHiGuiFont,vimHiGuiFgBg,vimHiKeyError,vimNotation
+syn cluster vimHiCluster contains=vimGroup,vimHiBlend,vimHiGroup,vimHiTerm,vimHiCTerm,vimHiStartStop,vimHiCtermFgBg,vimHiCtermul,vimHiGui,vimHiGuiFont,vimHiGuiFgBg,vimHiKeyError,vimNotation,vimComment,vim9comment
syn region vimHiKeyList contained oneline start="\i\+" skip="\\\\\|\\|" end="$\||" contains=@vimHiCluster
if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_vimhikeyerror")
syn match vimHiKeyError contained "\i\+="he=e-1
@@ -611,7 +685,6 @@ syn keyword vimHiClear contained clear nextgroup=vimHiGroup
" see tst24 (hi def vs hi) (Jul 06, 2018)
"syn region vimHiLink contained oneline matchgroup=vimCommand start="\(\<hi\%[ghlight]\s\+\)\@<=\(\(def\%[ault]\s\+\)\=link\>\|\<def\>\)" end="$" contains=vimHiGroup,vimGroup,vimHLGroup,vimNotation
syn region vimHiLink contained oneline matchgroup=vimCommand start="\(\<hi\%[ghlight]\s\+\)\@<=\(\(def\%[ault]\s\+\)\=link\>\|\<def\>\)" end="$" contains=@vimHiCluster
-syn cluster vimFuncBodyList add=vimHiLink
" Control Characters: {{{2
" ==================
@@ -619,10 +692,14 @@ syn match vimCtrlChar "[- -]"
" Beginners - Patterns that involve ^ {{{2
" =========
-syn match vimLineComment +^[ \t:]*".*$+ contains=@vimCommentGroup,vimCommentString,vimCommentTitle
+syn match vimLineComment +^[ \t:]*".*$+ contains=@vimCommentGroup,vimCommentString,vimCommentTitle,vimComment
+syn match vimLineComment +^[ \t:]*"\("[^"]*"\|[^"]\)*$+ contains=@vimCommentGroup,vimCommentString,vimCommentTitle
syn match vim9LineComment +^[ \t:]\+#.*$+ contains=@vimCommentGroup,vimCommentString,vimCommentTitle
syn match vimCommentTitle '"\s*\%([sS]:\|\h\w*#\)\=\u\w*\(\s\+\u\w*\)*:'hs=s+1 contained contains=vimCommentTitleLeader,vimTodo,@vimCommentGroup
-syn match vimContinue "^\s*\\"
+" Note: Look-behind to work around nextgroup skipnl consuming leading whitespace and preventing a match
+syn match vimContinue "^\s*\zs\\"
+syn match vimContinueComment '^\s*\zs["#]\\ .*' contained
+syn cluster vimContinue contains=vimContinue,vimContinueComment
syn region vimString start="^\s*\\\z(['"]\)" skip='\\\\\|\\\z1' end="\z1" oneline keepend contains=@vimStringGroup,vimContinue
syn match vimCommentTitleLeader '"\s\+'ms=s+1 contained
@@ -630,8 +707,8 @@ syn match vimCommentTitleLeader '"\s\+'ms=s+1 contained
" ====================
syn match vimSearch '^\s*[/?].*' contains=vimSearchDelim
syn match vimSearchDelim '^\s*\zs[/?]\|[/?]$' contained
-syn region vimGlobal matchgroup=Statement start='\<g\%[lobal]!\=/' skip='\\.' end='/' skipwhite nextgroup=vimSubst
-syn region vimGlobal matchgroup=Statement start='\<v\%[global]!\=/' skip='\\.' end='/' skipwhite nextgroup=vimSubst
+syn region vimGlobal matchgroup=Statement start='\<g\%[lobal]!\=/' skip='\\.' end='/' skipwhite nextgroup=vimSubst1
+syn region vimGlobal matchgroup=Statement start='\<v\%[global]!\=/' skip='\\.' end='/' skipwhite nextgroup=vimSubst1
" Embedded Scripts: {{{2
" ================
@@ -840,11 +917,13 @@ if !exists("skip_vim_syntax_inits")
hi def link vimMapModErr vimError
hi def link vimSubstFlagErr vimError
hi def link vimSynCaseError vimError
+ hi def link vimSynFoldMethodError vimError
hi def link vimBufnrWarn vimWarn
endif
hi def link vimAbb vimCommand
hi def link vimAddress vimMark
+ hi def link vimAugroupBang vimBang
hi def link vimAugroupError vimError
hi def link vimAugroupKey vimCommand
hi def link vimAuHighlight vimHighlight
@@ -853,6 +932,8 @@ if !exists("skip_vim_syntax_inits")
hi def link vimAutoEvent Type
hi def link vimAutoCmdMod Special
hi def link vimAutoSet vimCommand
+ hi def link vimBang vimOper
+ hi def link vimBehaveBang vimBang
hi def link vimBehaveModel vimBehave
hi def link vimBehave vimCommand
hi def link vimBracket Delimiter
@@ -863,8 +944,11 @@ if !exists("skip_vim_syntax_inits")
hi def link vimCommentString vimString
hi def link vimCommentTitle PreProc
hi def link vimCondHL vimCommand
+ hi def link vimConst vimCommand
hi def link vimContinue Special
+ hi def link vimContinueComment vimComment
hi def link vimCtrlChar SpecialChar
+ hi def link vimEcho vimCommand
hi def link vimEchoHLNone vimGroup
hi def link vimEchoHL vimCommand
hi def link vimElseIfErr Error
@@ -877,6 +961,7 @@ if !exists("skip_vim_syntax_inits")
hi def link vimFuncEcho vimCommand
hi def link vimHiCtermul vimHiTerm
hi def link vimFold Folded
+ hi def link vimFor vimCommand
hi def link vimFTCmd vimCommand
hi def link vimFTOption vimSynType
hi def link vimFuncKey vimCommand
@@ -889,6 +974,7 @@ if !exists("skip_vim_syntax_inits")
hi def link vimGroupSpecial Special
hi def link vimGroup Type
hi def link vimHiAttrib PreProc
+ hi def link vimHiBang vimBang
hi def link vimHiBlend vimHiTerm
hi def link vimHiClear vimHighlight
hi def link vimHiCtermFgBg vimHiTerm
@@ -907,19 +993,23 @@ if !exists("skip_vim_syntax_inits")
hi def link vimInsert vimString
hi def link vimIskSep Delimiter
hi def link vimKeyCode vimSpecFile
+ hi def link vimKeymapLineComment vimComment
+ hi def link vimKeymapTailComment vimComment
hi def link vimKeyword Statement
hi def link vimLet vimCommand
hi def link vimLetHereDoc vimString
hi def link vimLetHereDocStart Special
hi def link vimLetHereDocStop Special
+ hi def link vimLetRegister Special
hi def link vimLineComment vimComment
hi def link vim9LineComment vimComment
- hi def link vimMapBang vimCommand
+ hi def link vimMapBang vimBang
hi def link vimMapModKey vimFuncSID
hi def link vimMapMod vimBracket
hi def link vimMap vimCommand
hi def link vimMark Number
hi def link vimMarkNumber vimNumber
+ hi def link vimMenuBang vimBang
hi def link vimMenuMod vimMapMod
hi def link vimMenuNameMore vimMenuName
hi def link vimMenuName PreProc
@@ -957,6 +1047,7 @@ if !exists("skip_vim_syntax_inits")
hi def link vimStringCont vimString
hi def link vimString String
hi def link vimStringEnd vimString
+ hi def link vimStringInterpolationBrace vimEscape
hi def link vimSubst1 vimSubst
hi def link vimSubstDelim Delimiter
hi def link vimSubstFlags Special
@@ -973,8 +1064,12 @@ if !exists("skip_vim_syntax_inits")
hi def link vimSyncNone Type
hi def link vimSynContains vimSynOption
hi def link vimSynError Error
+ hi def link vimSynFoldMethodError Error
+ hi def link vimSynFoldMethod Type
hi def link vimSynKeyContainedin vimSynContains
hi def link vimSynKeyOpt vimSynOption
+ hi def link vimSynCchar vimSynOption
+ hi def link vimSynCcharValue Character
hi def link vimSynMtchGrp vimSynOption
hi def link vimSynMtchOpt vimSynOption
hi def link vimSynNextgroup vimSynOption
@@ -988,6 +1083,8 @@ if !exists("skip_vim_syntax_inits")
hi def link vimSynType vimSpecial
hi def link vimTodo Todo
hi def link vimType Type
+ 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
@@ -1002,8 +1099,6 @@ if !exists("skip_vim_syntax_inits")
hi def link nvimAutoEvent vimAutoEvent
hi def link nvimHLGroup vimHLGroup
- hi def link nvimMap vimMap
- hi def link nvimUnmap vimUnmap
endif
" Current Syntax Variable: {{{2
diff --git a/runtime/syntax/xmath.vim b/runtime/syntax/xmath.vim
index 37ae951112..466c1159c7 100644
--- a/runtime/syntax/xmath.vim
+++ b/runtime/syntax/xmath.vim
@@ -1,9 +1,11 @@
" Vim syntax file
" Language: xmath (a simulation tool)
-" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Charles E. Campbell
" Last Change: Aug 31, 2016
+" 2024 Feb 19 by Vim Project (announce adoption)
" Version: 10
-" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_XMATH
+" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_XMATH
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
diff --git a/runtime/syntax/xxd.vim b/runtime/syntax/xxd.vim
index 2f90b6b0bd..1c06b4296f 100644
--- a/runtime/syntax/xxd.vim
+++ b/runtime/syntax/xxd.vim
@@ -1,10 +1,12 @@
" Vim syntax file
" Language: bin using xxd
-" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
+" Maintainer: This runtime file is looking for a new maintainer.
+" Former Maintainer: Charles E. Campbell
" Last Change: Aug 31, 2016
" Version: 11
+" 2024 Feb 19 by Vim Project (announce adoption)
" Notes: use :help xxd to see how to invoke it
-" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_XXD
+" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_XXD
" quit when a syntax file was already loaded
if exists("b:current_syntax")
diff --git a/runtime/syntax/yacc.vim b/runtime/syntax/yacc.vim
index 459873e3dc..79dcf0eccc 100644
--- a/runtime/syntax/yacc.vim
+++ b/runtime/syntax/yacc.vim
@@ -1,9 +1,10 @@
" Vim syntax file
" Language: Yacc
-" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
+" Former Maintainer: Charles E. Campbell
" Last Change: Mar 25, 2019
" Version: 17
-" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_YACC
+" 2024 Feb 19 by Vim Project (announce adoption)
+" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_YACC
"
" Options: {{{1
" g:yacc_uses_cpp : if this variable exists, then C++ is loaded rather than C
diff --git a/runtime/tutor/en/vim-01-beginner.tutor b/runtime/tutor/en/vim-01-beginner.tutor
index 2824f7ae83..c3decdef11 100644
--- a/runtime/tutor/en/vim-01-beginner.tutor
+++ b/runtime/tutor/en/vim-01-beginner.tutor
@@ -967,17 +967,17 @@ There are also countless great tutorials and videos to be found online.
Here's a bunch of them:
- *Learn Vim Progressively*:
- http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/
-- *Learning Vim in 2013*:
- http://benmccormick.org/learning-vim-in-2014/
+ https://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/
+- *Learning Vim in 2014*:
+ https://benmccormick.org/learning-vim-in-2014/
- *Vimcasts*:
http://vimcasts.org/
- *Vim Video-Tutorials by Derek Wyatt*:
http://derekwyatt.org/vim/tutorials/
- *Learn Vimscript the Hard Way*:
- http://learnvimscriptthehardway.stevelosh.com/
+ https://learnvimscriptthehardway.stevelosh.com/
- *7 Habits of Effective Text Editing*:
- http://www.moolenaar.net/habits.html
+ https://www.moolenaar.net/habits.html
- *vim-galore*:
https://github.com/mhinz/vim-galore
diff --git a/runtime/tutor/ja/vim-01-beginner.tutor b/runtime/tutor/ja/vim-01-beginner.tutor
new file mode 100644
index 0000000000..411ebc04f8
--- /dev/null
+++ b/runtime/tutor/ja/vim-01-beginner.tutor
@@ -0,0 +1,995 @@
+# Neovimのチュヌトリアルぞようこそ
+
+Neovim は、このチュヌトリアルで説明するには倚すぎる皋のコマンドを備えた非垞に
+匷力な゚ディタヌです。このチュヌトリアルは、あなたが Neovim を䞇胜゚ディタヌずしお
+䜿いこなせるようになるのに十分なコマンドに぀いお説明をするようになっおいたす。
+
+このチュヌトリアルが、䜓を䜿うこずで芚えられる仕組みになっおいるこずを、
+心しおおかなければなりたせん。正しく孊習するには実際にやっおなければならない
+のです。テキストをただ読むだけでは、䜕がが重芁だったか忘れおしたうでしょう!
+
+それでは、CapsLockキヌが抌されおいないこずを確認した埌、画面にレッスン 0が
+党郚衚瀺されるずころたで、`j`{normal} キヌを抌しおカヌ゜ルを移動したしょう。
+
+# レッスン 0
+
+NOTE: 以䞋の緎習甚コマンドにはこの文章を倉曎するものもありたすが、それらの
+倉曎は保存されたせん。倱敗を恐れる必芁はありたせん、 [<Esc>](<Esc>) キヌを抌した埌、
+ [u](u) キヌを抌すこずで最埌の操䜜を元に戻せる事を芚えおおいおください。
+
+このチュヌトリアルはむンタラクティブな蚭蚈になっおおり、
+あなたが知っおおくべきこずがいく぀かありたす。
+-[このようなリンク](holy-grail )の䞊で [<Enter>](<Enter>) キヌを抌すこずで、リンクされたヘルプを開くこずができたす。
+-もしくは、ドキュメントで怜玢したい単語の䞊で [K](K) キヌ(倧文字)を抌しおみたしょう。
+(泚: 珟圚、日本語の単語には察応しおいたせん。)
+-ヘルプりィンドりは `:q`{vim} `<Enter>`{normal} で閉じるこずができたす。
+
+画面の巊端に ✗ が衚瀺されおいる堎合、その行のテキストを線集しなければなりたせん。
+正しいテキストに曞き換えるこずで、巊端の ✗ は ✓ に倉わりたす。
+Neovim がいかに優れおいるか、おわかりいただけるでしょうか?
+
+たた、次のようにコマンドを実行するよう求められるこずや、(埌で詳しく説明したす。)
+
+ `:help`{vim} `<Enter>`{normal}
+
+キヌシヌク゚ンスを抌すこずもありたす。
+~~~ normal
+ <Esc>0f<Space>d3wP$P
+~~~
+< ず > の間に囲たれたテキスト(䟋えば `<Enter>`{normal})は、
+そのテキストをタむプするのではなく、そのキヌを抌すこずを衚しおいたす。
+
+では、次のレッスンに向かいたしょう。( `j`{normal} キヌでスクロヌルダりンしたす。)
+
+# レッスン 1.1: カヌ゜ルの移動
+
+** カヌ゜ルを移動するには、瀺される様に `h`, `j`, `k`, `l` を抌したす。 **
+
+ ↑
+ k ヒント: h キヌは巊方向に移動したす。
+ ← h l → l キヌは右方向に移動したす。
+ j j キヌは䞋矢印キヌのようなキヌです。
+ ↓
+
+ 1. 移動に慣れるたで、スクリヌンでカヌ゜ル移動させたしょう。
+
+ 2. 䞋ぞのキヌ(j)を抌し぀づけるず、連続しお移動できたす。
+ これで次のレッスンに移動する方法がわかりたしたね。
+
+ 3. 䞋ぞのキヌを䜿っお、レッスン1.2 に移動したしょう。
+
+NOTE: 䜕をタむプしおいるか刀らなくなったら、`<Esc>`{normal} を抌しおノヌマルモヌドにしたす。
+ それから入力しようずしおいたコマンドを再入力したしょう。
+
+NOTE: カヌ゜ルキヌでも移動できたす。しかし hjkl に䞀床慣れおしたえば、
+ はるかに速く移動するこずができるでしょう。
+
+# レッスン 1.2: NEOVIM の起動ず終了
+
+!! NOTE: 以䞋のあらゆるステップを行う前に、このレッスンを党郚読みたしょう!!
+
+ 1. `<Esc>`{normal} キヌを抌したしょう。(確実にノヌマルモヌドにするため)
+
+ 2. 次のようにタむプ:
+
+ `:q!`{vim} `<Enter>`{normal}
+
+ これにより線集した内容を保存せずに゚ディタが終了したす。
+
+ 3. Neovim を開いお、このチュヌトリアルを始める為のコマンドを実行し、
+ ここに戻っおきたす。そのコマンドは:
+
+ `:Tutor`{vim} `<Enter>`{normal}
+
+ 4. これたでのステップを芚え自信が぀いたならば、ステップ 1 から 3 たでを実際に詊しお、
+ ゚ディタを1床終了しおから再び起動したしょう。
+
+NOTE: [:q!](:q) `<Enter>`{normal} は党おの倉曎を砎棄したす。
+ 埌に倉曎をファむルに保存する方法に぀いおも勉匷しおいきたしょう。
+
+ 5. 1.3たでカヌ゜ルを移動させたしょう。
+
+# レッスン 1.3: テキスト線集 - 削陀
+
+** カヌ゜ルの䞋の文字を削陀するには `x`{normal} を抌したす。 **
+
+ 1. 以䞋の ✗ ず瀺された行にカヌ゜ルを移動したしょう。
+
+ 2. 間違いを修正するために、削陀する最初の文字たでカヌ゜ルを移動したす。
+
+ 3. 䞍必芁な文字を [x キヌ](x) を抌しお削陀したしょう。
+
+ 4. 文が正しくなるたで ステップ 2 から 4 を繰り返したしょう。
+
+その ううさぎ は ぀぀きき を こええおお ずびはねたた
+
+ 5. 行が正しくなったら、レッスン 1.4 ぞ進みたしょう。
+
+NOTE: 党おのレッスンを通じお、頭で芚えようずしないでください。
+ 実際に手を動かすこずで、あなたの Neovim に察する理解床は広がっおいきたす。
+ 埩習のためにも、たたにこのチュヌトリアルをやり盎しおみおください。
+
+# レッスン 1.4: テキスト線集 - 挿入
+
+** テキストを挿入(Insert)するには `i`{normal} を抌したす。 **
+
+ 1. 以䞋の ✗ ず瀺された最初の行にカヌ゜ルを移動したしょう。
+
+ 2. 1行目を2行目ず同じ様にするために、テキストを挿入しなければ
+ ならない䜍眮の次の文字にカヌ゜ルを移動したす。
+
+ 3. `i`{normal} キヌを抌しおから、远加が必芁な文字をタむプしたしょう。
+
+ 4. 間違いを修正したら `<Esc>`{normal} を抌しおノヌマルモヌドに戻り、
+ 正しい文になる様にステップ 2 から 4 を繰り返したしょう。
+
+この には 足り テキスト が 。
+この 行 には 幟぀か 足りない テキスト が ある。
+
+ 5. 挿入の方法がわかったらレッスン 1.5 ぞ進みたしょう。
+
+# レッスン 1.5: テキスト線集 - 远加
+
+** テキストを远加(Append)するには `A`{normal} を抌したしょう。 **
+
+ 1. 以䞋の ✗ ず瀺された最初の行にカヌ゜ルを移動したしょう。
+ カヌ゜ルがその行のどの文字䞊にあっおもかたいたせん。
+
+ 2. [A](A) キヌ(倧文字)を抌しおから、远加が必芁な文字をタむプしたしょう。
+
+ 3. テキストを远加し終えたら、 `<Esc>`{normal} を抌しおノヌマルモヌドに戻りたしょう。
+
+ 4. 2行目の ✗ ず瀺された堎所ぞ移動し、ステップ 2 から 3 を繰り返しお
+ 文法を修正したしょう。
+
+この 行 には 間違った テキスト が あり
+この 行 には 間違った テキスト が ありたす。
+ここ にも 間違った テキス
+ここ にも 間違った テキスト が ありたす。
+
+ 5. テキストの远加が軜快になっおきたらレッスン 1.6 ぞ進みたしょう。
+
+# レッスン 1.6: ファむルの線集
+
+** ファむルを保存しお終了するには `:wq`{vim} ずタむプしたす。 **
+
+
+!! NOTE: 以䞋のあらゆるステップを行う前に、このレッスンを党郚読みたしょう!!
+
+ 1. レッスン 1.2 でやったように `:q!`{vim} をタむプしお、このチュヌトリアルを終了したす。
+ もしくは、別のタヌミナルにアクセスできる堎合、そこで以䞋の内容を行っおください。
+
+ 2. シェルプロンプトでこのコマンドをタむプしたす:
+~~~ sh
+ $ nvim tutor
+~~~
+ 'nvim' が Nvim ゚ディタを起動するコマンド、'tutor' は線集したい
+ ファむルの名前です。倉曎できるファむルの名前を䜿いたしょう。
+
+ 3. 前のレッスンで孊んだように、テキストを挿入、削陀したす。
+
+ 4. 次のコマンドで倉曎をファむルに保存し、Neovim を終了したす:
+~~~ cmd
+ :wq
+~~~
+ コマンドを実行するには `<Enter>`{normal} を抌さなければなりたせん。
+
+ 5. ステップ 1 でこのチュヌトリアルを終了した堎合は
+ 再床起動した埌、以䞋の芁玄ぞ進みたしょう。
+
+ 6. 以䞊のステップを読んで理解した䞊でこれを実行したしょう。
+
+# レッスン 1 芁玄
+
+ 1. カヌ゜ルは矢印キヌもしくは hjkl キヌで移動したす。
+ h (å·Š) j (例) k (侊) l (右)
+
+ 2. シェルプロンプトからNeovimを起動するにはこのようにタむプしたす:
+~~~ sh
+ $ nvim FILENAME
+~~~
+ 3. Vim を終了するには: `<Esc>`{normal} `:q!`{vim} `<Enter>`{normal} ずタむプしたす(倉曎を砎棄)。
+ もしくは: `<Esc>`{normal} `:wq`{vim} `<Enter>`{normal} ずタむプしたす(倉曎を保存)。
+
+ 4. カヌ゜ルの䞋の文字を削陀するには、ノヌマルモヌドで `x`{normal} ずタむプしたす。
+
+ 5. カヌ゜ルの䜍眮に文字を挿入するには、ノヌマルモヌドで i ずタむプしたす。
+ `i`{normal} テキストのタむプ `<Esc>`{normal} カヌ゜ル䜍眮に远加
+ `A`{normal} テキストの远加 `<Esc>`{normal} 行末に远加
+
+NOTE: `<Esc>`{normal} キヌを抌すずノヌマルモヌドに移行したす。
+ その際間違ったり、入力途䞭のコマンドを取り消すこずができたす。
+
+さお、続けおレッスン 2 を始めたしょう。
+
+# レッスン 2.1: 削陀コマンド
+
+** 単語の末尟たでを削陀するには `dw`{normal} ずタむプしたしょう。 **
+
+ 1. 確実にノヌマルモヌドにするため `<Esc>`{normal} を抌したしょう。
+
+ 2. 以䞋の ✗ ず瀺された行にカヌ゜ルを移動したしょう。
+
+ 3. 消したい単語の先頭にカヌ゜ルを移動したしょう。
+
+ 4. 単語を削陀するために [d](d)[w](w) ずタむプしたしょう。
+
+この 文 箙 には いく぀かの たのしい 必芁のない 単語 が 含たれお いたす。
+
+ 5. 3 から 4 たでを文が正しくなるたで繰り返し、レッスン 2.2 ぞ進みたしょう。
+
+# レッスン 2.2: その他の削陀コマンド
+
+** 行の末尟たでを削陀するには `d$`{normal} ずタむプしたしょう。 **
+
+ 1. 確実にノヌマルモヌドにするため `<Esc>`{normal} を抌したしょう。
+
+ 2. 以䞋の ✗ ず瀺された行にカヌ゜ルを移動したしょう。
+
+ 3. 正しい文の末尟ぞカヌ゜ルを移動したしょう(最初の 。 の埌です)。
+
+ 4. 行末たで削陀するために `d$`{normal} ずタむプしたしょう。
+
+誰かがこの行の最埌を2床タむプしたした。 2床タむプしたした。
+
+ 5. どういうこずか理解するために、レッスン 2.3 ぞ進みたしょう。
+
+# レッスン 2.3: オペレヌタずモヌション
+
+テキストに倉曎を加える倚くのコマンドは[オペレヌタ](operator)ず[モヌション](navigation)からなりたす。
+削陀(Delete)コマンド [d](d) のオペレヌタは次の様になっおいたす:
+
+ d モヌション
+
+ それぞれ:
+ d - 削陀コマンド。
+ モヌション - 䜕に察しお働きかけるか(以䞋に挙げたす)。
+
+ モヌション䞀芧の䞀郚:
+ [w](w) - 次の単語の先頭たで。(カヌ゜ル䜍眮の単語の先頭を陀く)
+ [e](e) - 次の単語の末尟たで。(カヌ゜ル䜍眮の単語の末尟を含む)
+ [$]($) - 行末たで。(カヌ゜ル䜍眮の単語の末尟を含む)
+
+ ぀たり `de`{normal} ずタむプするず、カヌ゜ル䜍眮から単語の終わりたでを削陀したす。
+
+NOTE: 冒険したい人は、ノヌマルモヌドにおオペレヌタなしにモヌションを抌しおみたしょう。
+ カヌ゜ルが目的語䞀芧で瀺される䜍眮に移動するはずです。
+
+# レッスン 2.4: モヌションにカりントを䜿甚する
+
+** 䜕回も繰り返し行いたいのモヌションの前にその回数をタむプしたす。 **
+
+ 1. 以䞋の ✓ ず瀺された行の先頭にカヌ゜ルを移動したす。
+
+ 2. `2w`{normal} をタむプしお単語2぀分先に移動したす。
+
+ 3. `3e`{normal} をタむプしお3぀目の単語の終端に移動したす。
+
+ 4. `0`{normal} ([れロ](0))をタむプしお行頭に移動したす。
+
+ 5. ステップ 2 ず 3 を違う数倀を䜿っお繰り返したす。
+
+This is just a line with words you can move around in.
+
+ 6. レッスン 2.5 に進みたしょう。
+
+# レッスン 2.5: より倚くを削陀するためにカりントを䜿甚する
+
+** オペレヌタずカりントをタむプするず、その操䜜が耇数回繰り返されたす。 **
+
+既述の削陀のオペレヌタずモヌションの組み合わせにカりントを远加するこずで、
+より倚くの削陀が行えたす:
+ d 数倀 モヌション
+
+ 1. ✗ ず瀺された行の最初の倧文字の単語にカヌ゜ルを移動したしょう。
+
+ 2. 倧文字の単語2぀を `d2w`{normal} ずタむプしお削陀したす。
+
+ 3. 連続した倧文字の単語を、異なるカりントを指定した1぀のコマンドで削陀し、
+ ステップ 1 ず 2 を繰り返したす。
+
+このABC DE行のFGHI JK LMN OP単語はQ RS TUV綺麗になった。
+
+# レッスン 2.6: 行の操䜜
+
+** 行党䜓を削陀するには `dd`{normal} ずタむプしたす。 **
+
+行党䜓を削陀する頻床が倚いので、Viのデザむナヌは行の
+削陀を d の2回タむプずいう簡単なものに決めたした。
+
+ 1. 以䞋の詩の2行目にカヌ゜ルを移動したす。
+
+ 2. [dd](dd) ずタむプしお行を削陀したす。
+
+ 3. さらに4行目に移動したす。
+
+ 4. `2dd`{normal} ずタむプしお2行を削陀したす。
+
+1) 薔薇は赀く
+2) 泥は楜しい
+3) 菫は青く
+4) 私は車をもっおいる
+5) 時蚈が時刻を告げる
+6) 砂糖は甘く
+7) そしお貎方も
+
+# Lesson 2.7: THE UNDO COMMAND
+
+** 最埌のコマンドを取り消す(Undo)には `u`{normal} を抌したす。`U`{normal} は行党䜓の取り消しです。 **
+
+ 1. 以䞋の ✗ ず瀺された行にカヌ゜ルを移動し、最初の間違いにカヌ゜ルを移動したしょう。
+
+ 2. `x`{normal} をタむプしお最初のいらない文字を削陀したしょう。
+
+ 3. では、`u`{normal} をタむプしお最埌に実行したコマンドを取り消しおしたいしょう。
+
+ 4. 今床は、`x`{normal} を䜿甚しお行内の誀りを党お修正したしょう。
+
+ 5. 倧文字の `U`{normal} をタむプしお、行を元の状態に戻したしょう。
+
+ 6. `u`{normal} をタむプしお盎前の `U`{normal} コマンドを取り消したしょう。
+
+ 7. ではコマンドを再実行するのに `<C-r>`{normal} (Ctrl + R)を数回
+ タむプしおみたしょう(取り消しの取り消し)。
+
+このの行のの間違いを修正々し、埌でそれらの修正をを取り消したたすす。
+
+ 8. これはずおも䟿利なコマンドです。さぁレッスン 2 芁玄ぞ進みたしょう。
+
+# レッスン 2 芁玄
+
+ 1. カヌ゜ル䜍眮から次の単語たでを削陀: `dw`{normal}
+
+ 2. カヌ゜ル䜍眮から行の末尟たでを削陀: `d$`{normal}
+
+ 3. 行党䜓を削陀: `dd`{normal}
+
+ 4. モヌションを繰り返すには数倀を付䞎: `2w`{normal}
+
+ 5. 倉曎に甚いるコマンドの圢匏は:
+
+ オペレヌタ [数倀] モヌション
+
+ それぞれ:
+
+ オペレヌタ - オペレヌタ - 削陀 d の類で䜕をするか
+ [数倀] - そのコマンドを䜕回繰り返すか
+ モヌション - テキストの䜕に察しお働きかけるか、䟋えば:
+ [w](w) (単語),
+ [$]($) (行末), など。
+
+ 6. 行の先頭に移動するにはれロを䜿甚したす: [0](0)
+
+ 7. 前回の動䜜を取り消し: `u`{normal} (小文字 u)
+ 行党䜓の倉曎を取り消し: `U`{normal} (倧文字 U)
+ 取り消しの取り消し: `<C-r>`{normal} (Ctrl + R)
+
+# レッスン 3.1: 貌り付けコマンド
+
+** 最埌に削陀された行をカヌ゜ルの埌に貌り付ける(Put)には `p`{normal} をタむプしたす。 **
+
+ 1. ✓ ず瀺された以䞋の最初の行にカヌ゜ルを移動したしょう。
+
+ 2. `dd`{normal} ずタむプしお行を削陀し、Neovim のレゞスタに栌玍したしょう。
+
+ 3. 削陀した行が本来あるべき䜍眮の䞊の行である c) 行たで、カヌ゜ルを移動させたしょう。
+
+ 4. `p`{normal} をタむプしお栌玍した行をカヌ゜ルの䞋に戻したす。
+
+ 5. 順番が正しくなる様にステップ 2 から 4 を繰り返したしょう。
+
+d) 貎方も孊ぶこずができるか?
+b) 菫は青く
+c) 知恵ずは孊ぶもの
+a) 薔薇は赀く
+
+NOTE: `P`{normal} (倧文字 P)ずタむプするこずで、カヌ゜ルの前に貌り付ける事もできたす。
+
+# レッスン 3.2: 眮き換えコマンド
+
+** カヌ゜ルの䞋の文字を x に眮き換える(Replace)には `rx`{normal} をタむプしたす。 **
+
+ 1. 以䞋の ✗ ず瀺された最初の行にカヌ゜ルを移動したしょう。
+
+ 2. 最初の間違いの先頭にカヌ゜ルを移動したしょう。
+
+ 3. `r`{normal} ずタむプし、間違っおいる文字を眮き換える、正しい文字をタむプしたしょう。
+
+ 4. 最初の行が正しくなるたでステップ 2 から 3 を繰り返したしょう。
+
+この合を人力した時ね、その人は幟぀か問違ったキヌを抌しもした!
+この行を入力した時に、その人は幟぀か間違ったキヌを抌したした!
+
+ 5. さぁ、レッスン 3.3 ぞ進みたしょう。
+
+NOTE: 実際に詊したしょう。決しお芚えるだけにはしないこず。
+
+# レッスン 3.3: 倉曎オペレヌタ
+
+** 単語の末尟たでを倉曎(Change)するには `ce`{normal} ずタむプしたす。 **
+
+ 1. 以䞋の ✗ ず瀺された最初の行にカヌ゜ルを移動したしょう。
+
+ 2. "lubw" の "u" の䜍眮にカヌ゜ルを移動したしょう。
+
+ 3. `ce`{normal} ずタむプし、正しい単語をタむプしたしょう(この堎合 "ine" ずタむプ)。
+
+ 4. `<Esc>`{normal} をタむプしおから次の間違い(倉曎すべき文字の先頭)に移動したす。
+
+ 5. 最初の行が次の行の様になるたでステップ 3 ず 4 を繰り返したす。
+
+This lubw has a few wptfd that mrrf changing usf the change operator.
+This line has a few words that need changing using the change operator.
+
+ce は単語を削陀した埌、挿入モヌドに入るこずに泚意したしょう。
+
+# レッスン 3.4: `c`{normal} を䜿甚したその他の倉曎
+
+** 倉曎オペレヌタは、削陀ず同じ様にモヌションを䜿甚したす。 **
+
+ 1. 倉曎オペレヌタは、削陀ず同じような動䜜をしたす。その圢匏は
+
+ c [数倀] モヌション
+
+ 2. モヌションも同じで、`w`{normal} (単語) や `$`{normal} (行末たで)ずいったものです。
+
+ 3. 以䞋の ✗ ず瀺された最初の行にカヌ゜ルを移動したしょう。
+
+ 4. 最初の間違いぞカヌ゜ルを移動したしょう。
+
+ 5. `c$`{normal} ずタむプしお行の残りを行目の様にし、`<Esc>`{normal} を抌したしょう。
+
+The end of this line needs some help to make it like the second.
+The end of this line needs to be corrected using the c$ command.
+
+NOTE: タむプ䞭の間違いはバックスペヌスキヌを䜿っお盎すこずもできたす。
+
+# レッスン 3 芁玄
+
+ 1. 既に削陀されたテキストを再配眮するには、[p](p) をタむプしたす。
+ これは削陀されたテキストをカヌ゜ルの埌に挿入したす(行単䜍で削陀されたのならば、
+ カヌ゜ルのある次の行に挿入されたす)。
+
+ 2. カヌ゜ルの䞋の文字を眮き換えるには、[r](r) をタむプした埌、
+ それを眮き換える文字をタむプしたす。
+
+ 3. [倉曎オペレヌタ](c)ではカヌ゜ル䜍眮から特定のモヌションで指定される終端たでを
+ 倉曎するこずが可胜です。䟋えば `ce`{normal} ならばカヌ゜ル䜍眮から単語の
+ 終わりたで、`c$`{normal} ならば行の終わりたでを倉曎したす。
+
+ 4. 倉曎コマンドの圢匏は
+
+ c [数倀] モヌション
+
+さぁ、次のレッスンぞ進みたしょう。
+
+# レッスン 4.1: 䜍眮ずファむルの情報
+
+** ファむル内での䜍眮ずファむルの状態を衚瀺するには `<C-g>`{normal} をタむプしたす。
+ ファむル内のある行に移動するには `G`{normal} をタむプしたす。 **
+
+NOTE: ステップを実行する前に、このレッスン党おに目を通したしょう!!
+
+ 1. `<Ctrl>`{normal} を抌したたた `g`{normal} を抌したしょう。この操䜜を `<C-g>`{normal} ず呌んでいたす。
+ ペヌゞの䞀番䞋にファむル名ず行番号が衚瀺されるはずです。
+ ステップ 3のために行番号を芚えおおきたしょう。
+
+NOTE: 画面の右䞋隅にカヌ゜ルの䜍眮が衚瀺されおいるかもしれたせん。
+ これは ['ruler']('ruler') オプションを蚭定するこずで衚瀺されたす。
+
+ 2. ファむルの最䞋行に移動するために [G](G) をタむプしたしょう。
+ ファむルの先頭に移動するには [gg](gg) ずタむプしたしょう。
+
+ 3. 先ほどの行の番号をタむプし `G`{normal} をタむプしたしょう。
+ 最初に `<C-g>`{normal} を抌した行に戻っお来るはずです。
+
+ 4. 自信が持おたらステップ 1 から 3 を実行したしょう。
+
+# レッスン 4.2: 怜玢コマンド
+
+** 語句を怜玢するには `/`{normal} ず、前方怜玢する語句をタむプしたす。 **
+
+ 1. ノヌマルモヌドで `/`{normal} ずいう文字をタむプしたす。画面䞀番䞋に `:`{normal} コマンドず
+ 同じ様に カヌ゜ルが珟れるこずに気づくでしょう。
+
+ 2. では、'errroor' `<Enter>`{normal} ずタむプしたしょう。これが怜玢したい単語です。
+
+ 3. 同じ語句をもう䞀床怜玢するずきは 単に [n](n) をタむプしたす。
+ 逆方向に語句を怜玢するずきは [N](N) をタむプしたす。
+
+ 4. 逆方向に語句を怜玢する堎合は、`/`{normal} の代わりに [?](?) コマンドを䜿甚したす。
+
+ 5. 元の堎所に戻るには `<C-o>`{normal} (`<Ctrl>`{normal} を抌し続けながら `o`{normal} をタむプ)を
+ タむプしたす。さらに戻るにはこれを繰り返したす。`<C-i>`{normal} は前方向です。
+
+"errroor" は error ずスペルが違いたす; errroor はいわゆる error です。
+
+NOTE: 怜玢がファむルの終わりに達するず、オプション ['wrapscan']('wrapscan') が蚭定されおいる堎合は、
+ ファむルの先頭から怜玢を続行したす。
+
+# レッスン 4.3: 察応する括匧を怜玢
+
+** 察応する ),] や } を怜玢するには `%`{normal} をタむプしたす。 **
+
+ 1. 䞋の ✓ で瀺された行で (,[ か { のどれかにカヌ゜ルを移動したしょう。
+
+ 2. そこで [%](%) ずタむプしたしょう。
+
+ 3. カヌ゜ルは察応する括匧に移動するはずです。
+
+ 4. 最初の括匧に移動するには `%`{normal} ずタむプしたしょう。
+
+ 5. 他の (,),[,],{ や } でカヌ゜ルを移動し、`%`{normal} が䜕をしおいるか確認したしょう。
+
+This ( is a test line with ('s, ['s ] and {'s } in it. ))
+
+NOTE: この機胜は括匧が䞀臎しおいないプログラムをデバッグするのにずおも圹立ちたす!
+
+# レッスン 4.4: 代替コマンド
+
+** "old" を "new" に眮換(Substitute)するには `:s/old/new/g` ずタむプしたす。 **
+
+ 1. 以䞋の ✗ ず瀺された行にカヌ゜ルを移動したしょう。
+
+ 2. 次のようにタむプしたす
+~~~ cmd
+ :s/thee/the/
+~~~
+ NOTE: [:s](:s) コマンドはその行で最初に芋぀かったものにだけ
+ 行われるこずに気を぀けたしょう。
+
+ 3. さらに、次のようにタむプしたす
+~~~ cmd
+ :s/thee/the/g
+~~~
+ 远加した g [フラグ](:s_flags)は行党䜓を眮換するこずを意味したす。
+ この倉曎はその行で芋぀かった党おの箇所に察しお行われたす。
+
+Usually thee best time to see thee flowers is in thee spring.
+
+ 4. 耇数行から芋぀かる文字の党おの箇所を倉曎するには
+~~~ cmd
+ :#,#s/old/new/g
+~~~
+ #,# には眮き換える範囲の開始ず終了の行番号を指定する。
+ (䟋えば、`1,3`は1行目から3行目を意味したす。)
+
+~~~ cmd
+ :%s/old/new/g
+~~~
+ ファむル党䜓で芋぀かるものに察しお倉曎する。
+~~~ cmd
+ :%s/old/new/gc
+~~~
+ ファむル党䜓で芋぀かるものに察しお、1぀1぀確認をずりながら倉曎する。
+
+NOTE: 眮き換えたいテキストをビゞュアルモヌドで遞択するこずもできたす。
+ これに぀いおは少し埌のレッスンで説明したす。
+
+# レッスン 4 芁玄
+
+ 1. `<C-g>`{normal} はファむルでの䜍眮ずファむルの詳现を衚瀺したす。
+ `G`{normal} はファむルの最䞋行に移動したす。
+ 数倀 `G`{normal} はその行に移動したす。
+ `gg`{normal} は先頭行に移動したす。
+
+ 2. `/`{normal} の埌に語句をタむプするず前方に語句を怜玢したす。
+ `?`{normal} の埌に語句をタむプするず埌方に語句を怜玢したす。
+ 怜玢の埌の `n`{normal} は同じ方向の次の怜玢を、`N`{normal} は逆方向の怜玢をしたす。
+ `<C-o>`{normal} は堎所を前に移し、`<C-i>`{normal} は堎所を次に移動したす。
+
+ 3. (,),[,],{, もしくは } 䞊にカヌ゜ルがある状態で `%`{normal} をタむプするず
+ 察になる文字ぞ移動したす。
+
+ 4. 珟圚行の最初の old を new に眮換する。
+~~~ cmd
+ :s/old/new
+~~~
+ 珟圚行の党おの old を new に眮換する。
+~~~ cmd
+ :s/old/new/g
+~~~
+ 2぀の # 行の間で語句を眮換する。
+~~~ cmd
+ :#,#s/old/new/g
+~~~
+ ファむルの䞭の党おの怜玢語句を眮換する。
+~~~ cmd
+ :%s/old/new/g
+~~~
+ 'c' を加えるず眮換の床に確認を求める。
+~~~ cmd
+ :%s/old/new/gc
+~~~
+
+# レッスン 5.1: 倖郚コマンドを実行する方法
+
+** `:!`{vim} の埌に実行する倖郚コマンドをタむプしたす。 **
+
+ 1. 画面の最䞋郚にカヌ゜ルが移動するよう、慣れ芪しんだ `:`{normal} をタむプしたしょう。
+ これでコマンドラむン呜什がタむプできる様になりたす。
+
+ 2. ここで [!](!cmd) ずいう文字(感嘆笊)をタむプしたしょう。
+ これで倖郚シェルコマンドが実行できる様になりたす。
+
+ 3. 䟋ずしお "!" に続けお "ls" ずタむプし `<Enter>`{normal} を抌したしょう。
+ シェルプロンプトのようにディレクトリの䞀芧が衚瀺されるはずです。
+
+NOTE: この方法によっおあらゆるコマンドが実行するこずができたす。
+ もちろん匕数も䞎えられたす。
+
+NOTE: 党おの `:`{vim} コマンドは `<Enter>`{normal} を抌しお終了しなければなりたせん。
+
+# レッスン 5.2: その他のファむルぞ曞き蟌み
+
+** ファむルぞ倉曎を保存するには `:w`{vim} ファむル名 ずタむプしたす。 **
+
+ 1. ディレクトリの䞀芧を埗るために `:!{unix:(ls),win:(dir)}`{vim} ずタむプしたしょう。
+ このあず `<Enter>`{normal} を抌すのは既にご存知ですね。
+
+ 2. TEST のように、そのディレクトリに無いファむル名を䞀぀遞びたす。
+
+ 3. 次のようにタむプしたしょう:
+~~~ cmd
+ :w TEST
+~~~
+ (TEST は、遞んだファむル名です。)
+
+ 4. これによりファむル党䜓が TEST ずいう名前で保存されたす。
+ もう䞀床 `:!{unix:(ls),win:(dir)}`{vim} ずタむプしおディレクトリを確認しおみたしょう。
+
+NOTE: ここで Neovim を終了し、`nvim TEST` で起動するず、保存した時の
+ チュヌトリアルの耇補ができ䞊がるはずです。
+
+ 5. さらに、次のようにタむプしおファむルを消したしょう:
+~~~ cmd
+ :!{unix:(rm),win:(del)} TEST
+~~~
+# レッスン 5.3: 遞択した曞き蟌み
+
+** ファむルの䞀郚を保存するには、`v`{normal} モヌションず `:w ファむル名`{vim} をタむプしたす。 **
+
+ 1. この行にカヌ゜ルを移動したす。
+
+ 2. [v](v) を抌し、以䞋の第5項目にカヌ゜ルを移動したす。
+ テキストが匷調衚瀺されるのに泚目しお䞋さい。
+
+ 3. 文字 : を抌すず、画面の最䞋郚に
+
+ `:'<,'>`{vim}
+
+ が珟れたす。
+
+ 4. 次のようにタむプしたす。
+
+ `:w TEST`{vim}
+
+ TEST は存圚しないファむル名です。`<Enter>`{normal} を抌す前に
+
+ `:'<,'>w TEST`{vim}
+
+ ずなっおいるこずを確認しお䞋さい。
+
+ 5. Vim は TEST ずいうファむルに遞択された行を曞き蟌むでしょう。
+ :`:!{unix:(ls),win:(dir)}`{vim} でそれを確認したす。
+ それは削陀しないでおいお䞋さい。次のレッスンで䜿甚したす。
+
+NOTE: [v](v) を抌すず、ビゞュアル(Visual)遞択が始たりたす。カヌ゜ルを動かすこずで、
+ 遞択範囲を倧きくも小さくもできたす。さらに、その遞択範囲に察しお
+ オペレヌタを適甚できたす。䟋えば `d`{normal} はテキストを削陀したす。
+
+# レッスン 5.4: ファむルの取蟌ず合䜵
+
+** ファむルの䞭身を挿入するには `:r ファむル名`{vim} ずタむプしたす。 **
+
+ 1. カヌ゜ルをこの行のすぐ䞊に合わせたす。
+
+NOTE: ステップ 2 の実行埌、レッスン 5.3 のテキストが珟れたす。
+ 䞋に䞋がっおこのレッスンに移動したしょう。
+
+ 2. では TEST ずいうファむルを 次のコマンドで読み蟌みたす。
+
+ `:r TEST`{vim}
+
+ ここでいう TEST は䜿うファむルの名前のこずです。
+ 読み蟌たれたファむルは、カヌ゜ル行の䞋にありたす。
+
+ 3. 取り蟌んだファむルを確認しおみたしょう。カヌ゜ルを戻すず、レッスン5.3 の
+ オリゞナルずファむルによるものの2぀があるこずがわかりたす。
+
+ 4. 残りのチュヌトリアルの為に、`u`{normal} を抌しお最埌のコマンドを取り消したす。
+
+NOTE: 倖郚コマンドの出力を読み蟌むこずもできたす。䟋えば、
+
+ `:r !{unix:(ls),win:(dir)}`{vim}
+
+ は `ls` コマンドの出力をカヌ゜ル以䞋に読み蟌みたす。
+
+# レッスン 5 芁玄
+
+ 1. [:!command](:!cmd) によっお、倖郚コマンドを実行する。
+
+ よく䜿う䟋:
+ `:!{unix:(ls ),win:(dir)}`{vim} - ディレクトリ内の䞀芧を芋る。
+ `:!{unix:(rm ),win:(del)} ファむル名`{vim} - ファむルを削陀する。
+
+ 2. [:w](:w) ファむル名 ファむル名 によっおファむル名ずいうファむルがディスクに曞き蟌たれる。
+
+ 3. [v](v) モヌション で :w ファむル名 ずするず、ビゞュアル遞択行がファむルに保存される。
+
+ 4. [:r](:r) ファむル名 によりファむル名ずいうファむルがディスクより取り蟌たれ、
+ カヌ゜ル䜍眮の䞋に挿入される。
+
+ 5. {unix:([:r !ls](:r!) ),win:([:r !dir](:r!))} は {unix:(ls),win:(dir)} コマンドの
+ 出力をカヌ゜ル䜍眮以䞋に読み蟌む。
+
+# レッスン 6.1: オヌプンコマンド
+
+** `o`{normal} をタむプするず、カヌ゜ルの䞋の行が開き(Open)、挿入モヌドに入りたす。 **
+
+ 1. 以䞋の ✓ ず瀺された最初の行にカヌ゜ルを移動したしょう。
+
+ 2. `o`{normal} (小文字) をタむプしお、カヌ゜ルの䞋の行を[開き](o)、挿入モヌドに入りたす。
+
+ 3. いく぀か文字をタむプしおから、挿入モヌドを終了する為に `<Esc>`{normal} を
+ タむプしたす。
+
+ `o`{normal} をタむプするずカヌ゜ルは開いた行ぞ移動し挿入モヌドに入りたす。
+
+ 4. カヌ゜ルの䞊の行に挿入するには、小文字の `o`{normal} ではなく、
+ 単玔に[倧文字の O](O)をタむプしたす。次の行で詊しおみたしょう。
+
+この行の䞊ぞ挿入するには、この行ぞカヌ゜ルを眮いお `O`{normal} をタむプしたす。
+
+# レッスン 6.2: 远加コマンド
+
+** カヌ゜ルの次の䜍眮からテキストを远加(Append)するには `a`{normal} ずタむプしたす。 **
+
+ 1. カヌ゜ルを ✗ で瀺された最初の行ぞ移動したしょう。
+
+ 2. `e`{normal} を抌しお "li" の終端郚たでカヌ゜ルを移動したす。
+
+ 3. カヌ゜ルの埌ろにテキストを[远加](a)するために `a`{normal} (小文字) をタむプしたす。
+
+ 4. その䞋の行のような単語に完成させたす。挿入モヌドを抜ける為に `<Esc>`{normal} を抌したす。
+
+ 5. `e`{normal} を䜿っお次の䞍完党な単語ぞ移動し、ステップ 3 ず 4 を繰り返したす。
+
+This li will allow you to pract appendi text to a line.
+This line will allow you to practice appending text to a line.
+
+NOTE: [a](a), [i](i) ず [A](A) は同じ挿入モヌドぞ移りたすが、文字が挿入される䜍眮だけが異なりたす。
+
+# レッスン 6.3: その他の眮換方法
+
+** 1文字以䞊を眮き換える(Replace)には倧文字の `R`{normal} ずタむプしたしょう。 **
+
+ 1. 以䞋の ✗ ず瀺された行にカヌ゜ルを移動したす。最初の "xxx" の先頭に移動したす。
+
+ 2. `R`{normal} ([倧文字 R](R)) を抌しお、2行目の数倀をタむプするこずで、"xxx" が眮換されたす。
+
+ 3. 眮換モヌドを抜けるには `<Esc>`{normal} を抌したす。行の残りが倉曎されおいないたたに
+ なるこずに泚意しおください。
+
+ 4. 残った "xxx" をステップを繰り返しお眮換したしょう。
+
+Adding 123 to xxx gives you xxx.
+Adding 123 to 456 gives you 579.
+
+NOTE: 眮換モヌドは挿入モヌドに䌌おいたすが、党おのタむプされた文字は
+ 既存の文字を削陀したす。
+
+# レッスン 6.4: テキストのコピヌずペヌスト
+
+** テキストのコピヌ(Yank)にはオペレヌタ `y`{normal} を、ペヌストには `p`{normal} を䜿いたす。 **
+
+ 1. ✓ ず瀺された行ぞ移動し、カヌ゜ルを "a)" の埌に眮いおおきたす。
+
+ 2. `v`{normal} でビゞュアルモヌドを開始し、"first" の手前たでカヌ゜ルを移動したす。
+
+ 3. `y`{normal} をタむプしお匷調衚瀺されたテキストを [yank](yank) (コピヌ)したす。
+
+ 4. 次の行の行末たでカヌ゜ルを移動したす: `j$`{normal}
+
+ 5. `p`{normal} を抌しお貌り付け([put](put))おから、次をタむプしたす: a second <ESC>
+
+ 6. `a`{normal} を抌しおから、 "second" ずタむプしたす。その埌、`<Esc>`{normal}を
+ 抌しお挿入モヌドを終了したす。
+
+ 7. ビゞュアルモヌドで " item." を遞択し、`y`{normal} で yank、次の行の行末たで `j$`{normal} で
+ 移動し、 `p`{normal} でテキストをそこに put したす。
+
+a) This is the first item.
+b)
+
+NOTE: `y`{normal} をオペレヌタずしお䜿うこずもできたす。`yw`{normal} は単語を1぀ yank したす。
+
+NOTE: `P`{normal} を䜿甚するずカヌ゜ルの埌ではなく前に put できたす。
+
+# レッスン 6.5: オプションの蚭定
+
+** 怜玢や眮換の際に倧文字/小文字を無芖するには、オプションを蚭定したす。 **
+
+Neovim にはあなたの必芁に応じお蚭定できる、様々なオプションが甚意されおいたす。
+
+ 1. 次の様に入力しお 'ignore' を怜玢したしょう: `/ignore`
+ `n`{normal} を抌しお䜕床か怜玢を繰り返したす。
+
+ 2. 次の様に入力しお 'ic' (Ignore Case の略) オプションを蚭定したす:
+~~~ cmd
+ :set ic
+~~~
+ 3. では `n`{normal} によっおもう1床 'ignore' を怜玢したす。
+ "Ignore"や"IGNORE"も芋぀けられるこずに気づくでしょう。
+
+ 4. 'hlsearch' ず 'incsearch' オプションを蚭定したしょう:
+~~~ cmd
+ :set hls is
+~~~
+ 5. 怜玢コマンドを再入力しお、䜕が起こるか芋おみたしょう: /ignore <Enter>
+
+ 6. 倧文字小文字の区別を無効にするには次の様に入力したす:
+~~~ cmd
+ :set noic
+~~~
+ 7. オプションの倀を反転するには、先頭に "inv"を远加したす:
+~~~ cmd
+ :set invic
+~~~
+NOTE: マッチの匷調衚瀺をやめるには次の様に入力したす:
+~~~ cmd
+ :nohlsearch
+~~~
+NOTE: 1぀の怜玢コマンドだけ倧文字小文字の区別をやめたいならば、
+ 語句内で [\c](/\c) を䜿甚したす: /ignore\c <Enter>
+
+# レッスン 6 芁玄
+
+ 1. `o`{normal} をタむプするずカヌ゜ルの䞋の行を開けお、そこで挿入モヌドになる。
+ `O`{normal} をタむプするずカヌ゜ルの䞊の行で挿入モヌドになる。
+
+ 2. カヌ゜ル䞊の文字の次からテキストを远加するには `a`{normal} ずタむプする。
+ 行末にテキストを挿入するには `A`{normal} をタむプする。
+
+ 3. `e`{normal} コマンドは単語の終端にカヌ゜ルを移動する。
+
+ 4. `y`{normal} オペレヌタはテキストを yank (コピヌ)し、`p`{normal} はそれを put (ペヌスト)する。
+
+ 5. 倧文字の `R`{normal} をタむプするず眮換モヌドに入り、`<Esc>`{normal} を抌すず抜ける。
+
+ 6. "[:set](:set) xxx" ずタむプするずオプション "xxx" が蚭定される。
+
+ 'ic' 'ignorecase' 怜玢時に倧文字小文字の区別しない
+ 'is' 'incsearch' 怜玢フレヌズに郚分マッチしおいる郚分を衚瀺する
+ 'hls' 'hlsearch' マッチするすべおを匷調衚瀺する
+
+ 正称、省略圢、どちらのオプション名でも䜿甚できる。
+
+ 7. オプションを無効にするには "no" を付䞎する:
+~~~ cmd
+ :set noic
+~~~
+ 8. 先頭に "inv" オプションを反転する:
+~~~ cmd
+ :set invic
+~~~
+# レッスン 7.1: ヘルプコマンド
+
+** Use the online help system. **
+
+Neovim には広範にわたるオンラむンヘルプシステムがありたす。
+
+ヘルプを開始するには、次の䞭でどれか1぀を詊しおみたしょう:
+ - `<F1>`{normal} キヌを抌す(もしあるならば)。
+ - `:help`{vim} ずタむプする。
+
+ヘルプりィンドりのテキストを読むず、ヘルプの動䜜が理解できたす。
+ `<C-w><C-w>`{normal} ずタむプするず ヘルプりィンドりぞゞャンプしたす。
+ `:q`{vim} ずタむプするず ヘルプりィンドりを閉じられたす。
+
+":help" コマンドに匕数を䞎えるこずにより、あらゆる題名のヘルプを芋぀けるこず
+ができたす。これらを詊しおみたしょう(`<Enter>`{normal} をタむプし忘れないように):
+~~~ cmd
+ :help w
+ :help c_CTRL-D
+ :help insert-index
+ :help user-manual
+~~~
+
+# レッスン 7.2: 起動スクリプトの䜜成
+
+** Neovim の特城を発揮する **
+
+Neovim はずおも自由床の高い゚ディタです。あなたの奜きなように
+カスタマむズするこずができたす。より倚くの機胜を䜿いはじめるには
+"init.vim" ファむルを䜜成したす。
+
+ 1. "init.vim" ファむルの線集を開始したす。
+
+ `:call mkdir(stdpath('config'),'p')`{vim}
+ `:exe 'edit' stdpath('config').'/init.vim'`{vim}
+
+ 3. 以䞋のようにファむルぞ曞き蟌みたす。
+
+ `:w`{vim}
+
+ この "init.vim" ファむルぞ、お奜みの蚭定を远加するこずができたす。
+ より倚くの情報を埗るには `:help init.vim`{vim} ずタむプしたす。
+
+# レッスン 7.3: 補完
+
+** `<C-d>`{normal} ず `<Tab>`{normal} でコマンドラむンを補完する **
+
+ 1. 珟圚のディレクトリに圚るものを衚瀺したす: `:!{unix:(ls),win:(dir)}`{vim}
+
+ 2. コマンドの先頭をタむプしたす: :e
+
+ 3. `<C-d>`{normal} を抌すず Neovim は "e" から始たるコマンドの䞀芧を衚瀺したす。
+
+ 4. `<Tab>`{normal} ずタむプするず Neoim は ":edit" ずいうコマンド名を補完したす。
+
+ 5. さらに空癜ず、既存のファむル名の始たりを加えたす: `:edit FIL`{vim}
+
+ 6. `<Tab>`{normal} を抌すず Neovim は名前を補完したす。("FIL" -> "FILE"、重耇しない堎合)
+
+NOTE: 補完は倚くのコマンドで動䜜したす。特に `:help`{vim} の際に圹立ちたす。
+
+# レッスン 7 芁玄
+
+ 1. ヘルプりィンドりを開くには `:help`{vim} ずするか `<F1>`{normal} を抌す。
+
+ 2. '知りたい事' のヘルプを怜玢するには `:help '知りたい事'`{vim} ずタむプする。
+
+ 3. 別のりィンドりぞゞャンプするには `<C-w><C-w>`{normal} ずタむプする。
+
+ 4. ヘルプりィンドりを閉じるには `:q`{vim} ずタむプする。
+
+ 5. お奜みの蚭定を保぀には init.vim 起動スクリプトを䜜成する。
+
+ 6. : command で可胜な補完を芋るには `<C-d>`{normal} をタむプする。
+ 補完を䜿甚するには `<Tab>`{normal} を抌す。
+
+# おわりに
+
+これにお Neovim のチュヌトリアルを終わりたす。゚ディタを簡単に、しかも充分に
+䜿うこずができるようにず、Neovim の持぀抂念の芁点のみを䌝えようずしたした。
+Neovim にはさらに倚くのコマンドがあり、ここで党おを説明するこずはできたせん。
+ヘルプを沢山掻甚しおください。オンラむン䞊にも数倚の教材や動画を
+芋぀けるこずができたす。ここにいく぀か玹介したす:
+
+- *Learn Vim Progressively*:
+ https://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/
+- *Learning Vim in 2014*:
+ https://benmccormick.org/learning-vim-in-2014/
+- *Vimcasts*:
+ http://vimcasts.org/
+- *Vim Video-Tutorials by Derek Wyatt*:
+ http://derekwyatt.org/vim/tutorials/
+- *Learn Vimscript the Hard Way*:
+ https://learnvimscriptthehardway.stevelosh.com/
+- *7 Habits of Effective Text Editing*:
+ https://www.moolenaar.net/habits.html
+- *vim-galore*:
+ https://github.com/mhinz/vim-galore
+- *vim-jp Vim日本語ドキュメント*
+ https://vim-jp.org/vimdoc-ja/
+
+もしあなたが本が奜きならば、*Practical Vim* by Drew Neil をお勧めしたす。
+(続線である *Modern Vim* には Neovimに぀いおの内容も含たれおいたす。)
+
+このチュヌトリアルは Colorado State University の Charles Smith のアむデア
+を基に、Colorado School of Mines の Michael C. Pierce ず Robert K. Ware の
+䞡名によっお曞かれたした。 E-mail: bware@mines.colorado.edu.
+
+Modified for Vim by Bram Moolenaar.
+Modified for vim-tutor-mode by Felipe Morales.
+Modified for Neovim by Rory Nesbitt.
+
+Vim Tutor 翻蚳
+ 日本語蚳 束本 泰匘 <mattn.jp@gmail.com>
+ vim-jpチヌム <https://github.com/vim-jp/lang-ja>
+ 監修 村岡 倪郎 <koron.kaoriya@gmail.com>
+Neovim Tutor 翻蚳
+ 監修 ite-usagi <https://github.com/ite-usagi>
+
+// vim: nowrap
diff --git a/runtime/tutor/ja/vim-01-beginner.tutor.json b/runtime/tutor/ja/vim-01-beginner.tutor.json
new file mode 100644
index 0000000000..5af4d5da94
--- /dev/null
+++ b/runtime/tutor/ja/vim-01-beginner.tutor.json
@@ -0,0 +1,44 @@
+{
+ "expect": {
+ "104": "その うさぎ は ぀き を こえお ずびはねた",
+ "126": "この 行 には 幟぀か 足りない テキスト が ある。",
+ "127": "この 行 には 幟぀か 足りない テキスト が ある。",
+ "145": "この 行 には 間違った テキスト が ありたす。",
+ "146": "この 行 には 間違った テキスト が ありたす。",
+ "147": "ここ にも 間違った テキスト が ありたす。",
+ "148": "ここ にも 間違った テキスト が ありたす。",
+ "217": "この 文 には いく぀かの 必芁のない 単語 が 含たれお いたす。",
+ "233": "誰かがこの行の最埌を2床タむプしたした。",
+ "272": -1,
+ "291": "この行の単語は綺麗になった。",
+ "308": -1,
+ "309": -1,
+ "310": -1,
+ "311": -1,
+ "312": -1,
+ "313": -1,
+ "314": -1,
+ "335": "この行の間違いを修正し、埌でそれらの修正をを取り消したす。",
+ "381": -1,
+ "382": -1,
+ "383": -1,
+ "384": -1,
+ "400": "この行を入力した時に、その人は幟぀か間違ったキヌを抌したした!",
+ "401": "この行を入力した時に、その人は幟぀か間違ったキヌを抌したした!",
+ "421": "This line has a few words that need changing using the change operator.",
+ "422": "This line has a few words that need changing using the change operator.",
+ "442": "The end of this line needs to be corrected using the c$ command.",
+ "443": "The end of this line needs to be corrected using the c$ command.",
+ "505": -1,
+ "524": -1,
+ "548": "Usually the best time to see the flowers is in the spring.",
+ "737": -1,
+ "742": -1,
+ "758": "This line will allow you to practice appending text to a line.",
+ "759": "This line will allow you to practice appending text to a line.",
+ "776": "Adding 123 to 456 gives you 579.",
+ "777": "Adding 123 to 456 gives you 579.",
+ "802": "a) This is the first item.",
+ "803": "b) This is the second item."
+ }
+}