aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-11-19 22:57:13 +0000
committerJosh Rahm <joshuarahm@gmail.com>2024-11-19 22:57:13 +0000
commit9be89f131f87608f224f0ee06d199fcd09d32176 (patch)
tree11022dcfa9e08cb4ac5581b16734196128688d48 /runtime
parentff7ed8f586589d620a806c3758fac4a47a8e7e15 (diff)
parent88085c2e80a7e3ac29aabb6b5420377eed99b8b6 (diff)
downloadrneovim-9be89f131f87608f224f0ee06d199fcd09d32176.tar.gz
rneovim-9be89f131f87608f224f0ee06d199fcd09d32176.tar.bz2
rneovim-9be89f131f87608f224f0ee06d199fcd09d32176.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'runtime')
-rw-r--r--runtime/autoload/dist/vim.vim3
-rw-r--r--runtime/autoload/hare.vim26
-rw-r--r--runtime/autoload/hcl.vim40
-rw-r--r--runtime/autoload/javaformat.vim92
-rw-r--r--runtime/autoload/msgpack.vim50
-rw-r--r--runtime/autoload/netrw.vim243
-rw-r--r--runtime/autoload/provider/clipboard.vim12
-rw-r--r--runtime/autoload/shada.vim4
-rw-r--r--runtime/autoload/typst.vim50
-rw-r--r--runtime/autoload/zip.vim282
-rw-r--r--runtime/colors/blue.vim16
-rw-r--r--runtime/colors/darkblue.vim16
-rw-r--r--runtime/colors/delek.vim19
-rw-r--r--runtime/colors/desert.vim10
-rw-r--r--runtime/colors/elflord.vim10
-rw-r--r--runtime/colors/evening.vim16
-rw-r--r--runtime/colors/habamax.vim293
-rw-r--r--runtime/colors/industry.vim10
-rw-r--r--runtime/colors/koehler.vim16
-rw-r--r--runtime/colors/lunaperche.vim26
-rw-r--r--runtime/colors/morning.vim16
-rw-r--r--runtime/colors/murphy.vim10
-rw-r--r--runtime/colors/pablo.vim16
-rw-r--r--runtime/colors/peachpuff.vim20
-rw-r--r--runtime/colors/quiet.vim21
-rw-r--r--runtime/colors/retrobox.vim48
-rw-r--r--runtime/colors/ron.vim16
-rw-r--r--runtime/colors/shine.vim16
-rw-r--r--runtime/colors/slate.vim18
-rw-r--r--runtime/colors/sorbet.vim26
-rw-r--r--runtime/colors/torte.vim16
-rw-r--r--runtime/colors/vim.lua154
-rw-r--r--runtime/colors/wildcharm.vim194
-rw-r--r--runtime/colors/zaibatsu.vim10
-rw-r--r--runtime/colors/zellner.vim18
-rw-r--r--runtime/compiler/README.txt2
-rw-r--r--runtime/compiler/cppcheck.vim40
-rw-r--r--runtime/compiler/groff.vim45
-rw-r--r--runtime/compiler/hare.vim23
-rw-r--r--runtime/compiler/javac.vim9
-rw-r--r--runtime/compiler/make.vim13
-rw-r--r--runtime/compiler/pandoc.vim50
-rw-r--r--runtime/compiler/typst.vim15
-rw-r--r--runtime/doc/api.txt204
-rw-r--r--runtime/doc/autocmd.txt5
-rw-r--r--runtime/doc/builtin.txt3288
-rw-r--r--runtime/doc/change.txt14
-rw-r--r--runtime/doc/cmdline.txt7
-rw-r--r--runtime/doc/deprecated.txt20
-rw-r--r--runtime/doc/dev_arch.txt59
-rw-r--r--runtime/doc/dev_style.txt31
-rw-r--r--runtime/doc/dev_tools.txt4
-rw-r--r--runtime/doc/dev_vimpatch.txt57
-rw-r--r--runtime/doc/develop.txt91
-rw-r--r--runtime/doc/diagnostic.txt133
-rw-r--r--runtime/doc/diff.txt6
-rw-r--r--runtime/doc/editing.txt24
-rw-r--r--runtime/doc/editorconfig.txt4
-rw-r--r--runtime/doc/eval.txt10
-rw-r--r--runtime/doc/filetype.txt54
-rw-r--r--runtime/doc/fold.txt6
-rw-r--r--runtime/doc/ft_ada.txt21
-rw-r--r--runtime/doc/ft_hare.txt77
-rw-r--r--runtime/doc/ft_sql.txt6
-rw-r--r--runtime/doc/gui.txt42
-rw-r--r--runtime/doc/health.txt6
-rw-r--r--runtime/doc/help.txt6
-rw-r--r--runtime/doc/indent.txt2
-rw-r--r--runtime/doc/index.txt13
-rw-r--r--runtime/doc/insert.txt27
-rw-r--r--runtime/doc/intro.txt2
-rw-r--r--runtime/doc/lsp.txt241
-rw-r--r--runtime/doc/lua-guide.txt1
-rw-r--r--runtime/doc/lua.txt412
-rw-r--r--runtime/doc/map.txt13
-rw-r--r--runtime/doc/mbyte.txt8
-rw-r--r--runtime/doc/message.txt3
-rw-r--r--runtime/doc/motion.txt19
-rw-r--r--runtime/doc/news-0.10.txt8
-rw-r--r--runtime/doc/news-0.9.txt20
-rw-r--r--runtime/doc/news.txt166
-rw-r--r--runtime/doc/nvim.txt2
-rw-r--r--runtime/doc/options.txt234
-rw-r--r--runtime/doc/pattern.txt8
-rw-r--r--runtime/doc/pi_netrw.txt2
-rw-r--r--runtime/doc/provider.txt6
-rw-r--r--runtime/doc/quickfix.txt104
-rw-r--r--runtime/doc/quickref.txt2
-rw-r--r--runtime/doc/repeat.txt10
-rw-r--r--runtime/doc/scroll.txt3
-rw-r--r--runtime/doc/sign.txt29
-rw-r--r--runtime/doc/spell.txt2
-rw-r--r--runtime/doc/starting.txt4
-rw-r--r--runtime/doc/support.txt16
-rw-r--r--runtime/doc/syntax.txt382
-rw-r--r--runtime/doc/tabpage.txt3
-rw-r--r--runtime/doc/tagsrch.txt46
-rw-r--r--runtime/doc/terminal.txt (renamed from runtime/doc/nvim_terminal_emulator.txt)26
-rw-r--r--runtime/doc/treesitter.txt582
-rw-r--r--runtime/doc/tui.txt (renamed from runtime/doc/term.txt)265
-rw-r--r--runtime/doc/ui.txt8
-rw-r--r--runtime/doc/undo.txt24
-rw-r--r--runtime/doc/usr_05.txt18
-rw-r--r--runtime/doc/usr_21.txt38
-rw-r--r--runtime/doc/usr_29.txt4
-rw-r--r--runtime/doc/usr_41.txt5
-rw-r--r--runtime/doc/usr_toc.txt10
-rw-r--r--runtime/doc/various.txt21
-rw-r--r--runtime/doc/vim_diff.txt66
-rw-r--r--runtime/doc/windows.txt71
-rw-r--r--runtime/filetype.lua20
-rw-r--r--runtime/ftplugin/abaqus.vim3
-rw-r--r--runtime/ftplugin/antlr4.vim14
-rw-r--r--runtime/ftplugin/arduino.lua3
-rw-r--r--runtime/ftplugin/arduino.vim3
-rw-r--r--runtime/ftplugin/asm.vim3
-rw-r--r--runtime/ftplugin/astro.vim7
-rw-r--r--runtime/ftplugin/asy.vim14
-rw-r--r--runtime/ftplugin/autohotkey.vim16
-rw-r--r--runtime/ftplugin/bindzone.vim16
-rw-r--r--runtime/ftplugin/bitbake.vim3
-rw-r--r--runtime/ftplugin/c.lua4
-rw-r--r--runtime/ftplugin/c.vim3
-rw-r--r--runtime/ftplugin/cabal.vim13
-rw-r--r--runtime/ftplugin/calendar.vim3
-rw-r--r--runtime/ftplugin/calender.lua1
-rw-r--r--runtime/ftplugin/cedar.vim13
-rw-r--r--runtime/ftplugin/cgdbrc.vim3
-rw-r--r--runtime/ftplugin/ch.lua3
-rw-r--r--runtime/ftplugin/chicken.vim16
-rw-r--r--runtime/ftplugin/cmakecache.vim13
-rw-r--r--runtime/ftplugin/context.vim10
-rw-r--r--runtime/ftplugin/cpp.vim9
-rw-r--r--runtime/ftplugin/cs.lua4
-rw-r--r--runtime/ftplugin/csh.vim3
-rw-r--r--runtime/ftplugin/css.lua1
-rw-r--r--runtime/ftplugin/css.vim3
-rw-r--r--runtime/ftplugin/csv.vim22
-rw-r--r--runtime/ftplugin/cuda.vim11
-rw-r--r--runtime/ftplugin/d.lua4
-rw-r--r--runtime/ftplugin/deb822sources.vim4
-rw-r--r--runtime/ftplugin/debcontrol.vim7
-rw-r--r--runtime/ftplugin/debsources.vim4
-rw-r--r--runtime/ftplugin/desktop.vim3
-rw-r--r--runtime/ftplugin/dot.lua3
-rw-r--r--runtime/ftplugin/dtd.vim3
-rw-r--r--runtime/ftplugin/dtrace.vim5
-rw-r--r--runtime/ftplugin/dts.vim3
-rw-r--r--runtime/ftplugin/editorconfig.vim13
-rw-r--r--runtime/ftplugin/erlang.vim5
-rw-r--r--runtime/ftplugin/eruby.vim3
-rw-r--r--runtime/ftplugin/faust.lua3
-rw-r--r--runtime/ftplugin/fennel.vim3
-rw-r--r--runtime/ftplugin/fish.vim3
-rw-r--r--runtime/ftplugin/fortran.vim3
-rw-r--r--runtime/ftplugin/fstab.vim3
-rw-r--r--runtime/ftplugin/gdb.vim3
-rw-r--r--runtime/ftplugin/gdscript.vim5
-rw-r--r--runtime/ftplugin/glsl.lua3
-rw-r--r--runtime/ftplugin/go.vim6
-rw-r--r--runtime/ftplugin/goaccess.vim14
-rw-r--r--runtime/ftplugin/gomod.vim16
-rw-r--r--runtime/ftplugin/gpg.vim22
-rw-r--r--runtime/ftplugin/groovy.vim3
-rw-r--r--runtime/ftplugin/hamster.vim3
-rw-r--r--runtime/ftplugin/hare.vim58
-rw-r--r--runtime/ftplugin/haredoc.vim44
-rw-r--r--runtime/ftplugin/hcl.vim10
-rw-r--r--runtime/ftplugin/help.lua9
-rw-r--r--runtime/ftplugin/help.vim72
-rw-r--r--runtime/ftplugin/hlsplaylist.vim37
-rw-r--r--runtime/ftplugin/html.vim3
-rw-r--r--runtime/ftplugin/htmlangular.vim12
-rw-r--r--runtime/ftplugin/http.vim13
-rw-r--r--runtime/ftplugin/indent.lua4
-rw-r--r--runtime/ftplugin/indent.vim3
-rw-r--r--runtime/ftplugin/initex.vim3
-rw-r--r--runtime/ftplugin/java.vim30
-rw-r--r--runtime/ftplugin/javacc.vim20
-rw-r--r--runtime/ftplugin/javascript.vim3
-rw-r--r--runtime/ftplugin/jq.vim11
-rw-r--r--runtime/ftplugin/jsonc.vim3
-rw-r--r--runtime/ftplugin/kdl.vim17
-rw-r--r--runtime/ftplugin/kivy.vim13
-rw-r--r--runtime/ftplugin/lc.vim13
-rw-r--r--runtime/ftplugin/ld.vim5
-rw-r--r--runtime/ftplugin/ldapconf.vim13
-rw-r--r--runtime/ftplugin/lex.vim14
-rw-r--r--runtime/ftplugin/liquid.vim3
-rw-r--r--runtime/ftplugin/lisp.vim3
-rw-r--r--runtime/ftplugin/lua.lua2
-rw-r--r--runtime/ftplugin/man.vim8
-rw-r--r--runtime/ftplugin/markdown.vim3
-rw-r--r--runtime/ftplugin/mediawiki.vim42
-rw-r--r--runtime/ftplugin/mermaid.vim5
-rw-r--r--runtime/ftplugin/mma.vim5
-rw-r--r--runtime/ftplugin/modconf.vim23
-rw-r--r--runtime/ftplugin/modula2.vim3
-rw-r--r--runtime/ftplugin/modula3.vim3
-rw-r--r--runtime/ftplugin/mojo.vim41
-rw-r--r--runtime/ftplugin/muttrc.vim22
-rw-r--r--runtime/ftplugin/mysql.vim9
-rw-r--r--runtime/ftplugin/nroff.vim6
-rw-r--r--runtime/ftplugin/nu.vim13
-rw-r--r--runtime/ftplugin/objc.lua3
-rw-r--r--runtime/ftplugin/objcpp.vim1
-rw-r--r--runtime/ftplugin/obse.vim7
-rw-r--r--runtime/ftplugin/ocaml.vim4
-rw-r--r--runtime/ftplugin/odin.vim5
-rw-r--r--runtime/ftplugin/openvpn.vim3
-rw-r--r--runtime/ftplugin/pascal.vim3
-rw-r--r--runtime/ftplugin/pdf.vim3
-rw-r--r--runtime/ftplugin/perl.vim3
-rw-r--r--runtime/ftplugin/php.vim3
-rw-r--r--runtime/ftplugin/ps1.vim21
-rw-r--r--runtime/ftplugin/ps1xml.vim3
-rw-r--r--runtime/ftplugin/qml.vim3
-rw-r--r--runtime/ftplugin/query.lua7
-rw-r--r--runtime/ftplugin/racket.vim5
-rw-r--r--runtime/ftplugin/raku.vim13
-rw-r--r--runtime/ftplugin/rasi.vim25
-rw-r--r--runtime/ftplugin/readline.vim22
-rw-r--r--runtime/ftplugin/requirements.vim6
-rw-r--r--runtime/ftplugin/rmd.vim8
-rw-r--r--runtime/ftplugin/rrst.vim8
-rw-r--r--runtime/ftplugin/rust.vim12
-rw-r--r--runtime/ftplugin/scdoc.vim9
-rw-r--r--runtime/ftplugin/scheme.vim19
-rw-r--r--runtime/ftplugin/sh.vim11
-rw-r--r--runtime/ftplugin/snakemake.vim13
-rw-r--r--runtime/ftplugin/spec.vim14
-rw-r--r--runtime/ftplugin/sql.vim26
-rw-r--r--runtime/ftplugin/squirrel.vim17
-rw-r--r--runtime/ftplugin/sshconfig.vim27
-rw-r--r--runtime/ftplugin/stata.lua3
-rw-r--r--runtime/ftplugin/sudoers.vim27
-rw-r--r--runtime/ftplugin/supercollider.lua3
-rw-r--r--runtime/ftplugin/svelte.vim13
-rw-r--r--runtime/ftplugin/swift.lua3
-rw-r--r--runtime/ftplugin/systemd.vim47
-rw-r--r--runtime/ftplugin/tcl.vim3
-rw-r--r--runtime/ftplugin/terraform.vim14
-rw-r--r--runtime/ftplugin/tf.vim13
-rw-r--r--runtime/ftplugin/thrift.vim17
-rw-r--r--runtime/ftplugin/typescript.vim3
-rw-r--r--runtime/ftplugin/typst.vim25
-rw-r--r--runtime/ftplugin/udevrules.vim27
-rw-r--r--runtime/ftplugin/vim.vim6
-rw-r--r--runtime/ftplugin/wat.vim3
-rw-r--r--runtime/ftplugin/xdefaults.lua1
-rw-r--r--runtime/ftplugin/xdefaults.vim9
-rw-r--r--runtime/ftplugin/xml.vim3
-rw-r--r--runtime/ftplugin/xs.lua3
-rw-r--r--runtime/ftplugin/yacc.vim16
-rw-r--r--runtime/ftplugin/yaml.vim7
-rw-r--r--runtime/ftplugin/zig.vim9
-rw-r--r--runtime/ftplugin/zsh.vim12
-rw-r--r--runtime/indent/asm.vim29
-rw-r--r--runtime/indent/glsl.vim14
-rw-r--r--runtime/indent/hare.vim31
-rw-r--r--runtime/indent/hcl.vim16
-rw-r--r--runtime/indent/kdl.vim30
-rw-r--r--runtime/indent/lua.vim9
-rw-r--r--runtime/indent/mojo.vim6
-rw-r--r--runtime/indent/ocaml.vim4
-rw-r--r--runtime/indent/proto.vim19
-rw-r--r--runtime/indent/query.lua4
-rw-r--r--runtime/indent/rust.vim9
-rw-r--r--runtime/indent/scheme.vim9
-rw-r--r--runtime/indent/terraform.vim11
-rw-r--r--runtime/indent/testdir/lua.in19
-rw-r--r--runtime/indent/testdir/lua.ok19
-rw-r--r--runtime/indent/testdir/thrift.in38
-rw-r--r--runtime/indent/testdir/thrift.ok38
-rw-r--r--runtime/indent/thrift.vim74
-rw-r--r--runtime/indent/typst.vim18
-rw-r--r--runtime/indent/yaml.vim5
-rw-r--r--runtime/keymap/georgian-qwerty.vim51
-rw-r--r--runtime/lua/editorconfig.lua21
-rw-r--r--runtime/lua/man.lua29
-rw-r--r--runtime/lua/tohtml.lua207
-rw-r--r--runtime/lua/vim/_comment.lua15
-rw-r--r--runtime/lua/vim/_defaults.lua264
-rw-r--r--runtime/lua/vim/_editor.lua106
-rw-r--r--runtime/lua/vim/_inspector.lua4
-rw-r--r--runtime/lua/vim/_meta.lua2
-rw-r--r--runtime/lua/vim/_meta/api.lua2290
-rw-r--r--runtime/lua/vim/_meta/api_keysets.lua3
-rw-r--r--runtime/lua/vim/_meta/api_keysets_extra.lua29
-rw-r--r--runtime/lua/vim/_meta/builtin.lua9
-rw-r--r--runtime/lua/vim/_meta/builtin_types.lua73
-rw-r--r--runtime/lua/vim/_meta/diff.lua26
-rw-r--r--runtime/lua/vim/_meta/lpeg.lua41
-rw-r--r--runtime/lua/vim/_meta/options.lua195
-rw-r--r--runtime/lua/vim/_meta/regex.lua26
-rw-r--r--runtime/lua/vim/_meta/spell.lua2
-rw-r--r--runtime/lua/vim/_meta/vimfn.lua1075
-rw-r--r--runtime/lua/vim/_options.lua12
-rw-r--r--runtime/lua/vim/_watch.lua88
-rw-r--r--runtime/lua/vim/deprecated/health.lua2
-rw-r--r--runtime/lua/vim/diagnostic.lua266
-rw-r--r--runtime/lua/vim/filetype.lua1405
-rw-r--r--runtime/lua/vim/filetype/detect.lua127
-rw-r--r--runtime/lua/vim/fs.lua84
-rw-r--r--runtime/lua/vim/glob.lua30
-rw-r--r--runtime/lua/vim/health.lua137
-rw-r--r--runtime/lua/vim/health/health.lua17
-rw-r--r--runtime/lua/vim/highlight.lua86
-rw-r--r--runtime/lua/vim/iter.lua12
-rw-r--r--runtime/lua/vim/keymap.lua22
-rw-r--r--runtime/lua/vim/loader.lua20
-rw-r--r--runtime/lua/vim/lsp.lua113
-rw-r--r--runtime/lua/vim/lsp/_completion.lua276
-rw-r--r--runtime/lua/vim/lsp/_dynamic.lua4
-rw-r--r--runtime/lua/vim/lsp/_meta/protocol.lua1556
-rw-r--r--runtime/lua/vim/lsp/_watchfiles.lua4
-rw-r--r--runtime/lua/vim/lsp/buf.lua71
-rw-r--r--runtime/lua/vim/lsp/client.lua53
-rw-r--r--runtime/lua/vim/lsp/codelens.lua8
-rw-r--r--runtime/lua/vim/lsp/completion.lua754
-rw-r--r--runtime/lua/vim/lsp/diagnostic.lua33
-rw-r--r--runtime/lua/vim/lsp/handlers.lua3
-rw-r--r--runtime/lua/vim/lsp/health.lua92
-rw-r--r--runtime/lua/vim/lsp/inlay_hint.lua41
-rw-r--r--runtime/lua/vim/lsp/log.lua4
-rw-r--r--runtime/lua/vim/lsp/protocol.lua382
-rw-r--r--runtime/lua/vim/lsp/rpc.lua16
-rw-r--r--runtime/lua/vim/lsp/semantic_tokens.lua16
-rw-r--r--runtime/lua/vim/lsp/sync.lua13
-rw-r--r--runtime/lua/vim/lsp/util.lua218
-rw-r--r--runtime/lua/vim/provider/health.lua259
-rw-r--r--runtime/lua/vim/secure.lua2
-rw-r--r--runtime/lua/vim/shared.lua297
-rw-r--r--runtime/lua/vim/snippet.lua80
-rw-r--r--runtime/lua/vim/text.lua15
-rw-r--r--runtime/lua/vim/treesitter.lua64
-rw-r--r--runtime/lua/vim/treesitter/_fold.lua36
-rw-r--r--runtime/lua/vim/treesitter/_meta.lua113
-rw-r--r--runtime/lua/vim/treesitter/_meta/misc.lua78
-rw-r--r--runtime/lua/vim/treesitter/_meta/tsnode.lua185
-rw-r--r--runtime/lua/vim/treesitter/_meta/tstree.lua44
-rw-r--r--runtime/lua/vim/treesitter/_query_linter.lua21
-rw-r--r--runtime/lua/vim/treesitter/_range.lua4
-rw-r--r--runtime/lua/vim/treesitter/dev.lua72
-rw-r--r--runtime/lua/vim/treesitter/health.lua3
-rw-r--r--runtime/lua/vim/treesitter/highlighter.lua15
-rw-r--r--runtime/lua/vim/treesitter/language.lua64
-rw-r--r--runtime/lua/vim/treesitter/languagetree.lua44
-rw-r--r--runtime/lua/vim/treesitter/query.lua43
-rw-r--r--runtime/lua/vim/ui.lua94
-rw-r--r--runtime/lua/vim/version.lua14
-rw-r--r--runtime/lua/vim/vimhelp.lua38
-rw-r--r--runtime/nvim.desktop1
-rw-r--r--runtime/optwin.vim8
-rw-r--r--runtime/pack/dist/opt/nohlsearch/plugin/nohlsearch.vim20
-rw-r--r--runtime/pack/dist/opt/termdebug/plugin/termdebug.vim331
-rw-r--r--runtime/plugin/matchparen.vim8
-rw-r--r--runtime/plugin/tohtml.lua4
-rw-r--r--runtime/queries/bash/folds.scm9
-rw-r--r--runtime/queries/bash/highlights.scm232
-rw-r--r--runtime/queries/bash/injections.scm3
-rw-r--r--runtime/queries/c/highlights.scm2
-rw-r--r--runtime/queries/lua/highlights.scm2
-rw-r--r--runtime/queries/markdown/highlights.scm24
-rw-r--r--runtime/queries/markdown_inline/highlights.scm19
-rw-r--r--runtime/queries/python/folds.scm28
-rw-r--r--runtime/queries/python/highlights.scm457
-rw-r--r--runtime/queries/query/highlights.scm19
-rw-r--r--runtime/queries/vimdoc/highlights.scm21
-rw-r--r--runtime/syntax/antlr4.vim30
-rw-r--r--runtime/syntax/asy.vim243
-rw-r--r--runtime/syntax/checkhealth.vim6
-rw-r--r--runtime/syntax/chicken.vim18
-rw-r--r--runtime/syntax/csv.vim38
-rw-r--r--runtime/syntax/deb822sources.vim2
-rw-r--r--runtime/syntax/debcopyright.vim4
-rw-r--r--runtime/syntax/dockerfile.vim4
-rw-r--r--runtime/syntax/dosbatch.vim9
-rw-r--r--runtime/syntax/dosini.vim6
-rw-r--r--runtime/syntax/dune.vim3
-rw-r--r--runtime/syntax/fstab.vim22
-rw-r--r--runtime/syntax/glsl.vim752
-rw-r--r--runtime/syntax/goaccess.vim34
-rw-r--r--runtime/syntax/hare.vim188
-rw-r--r--runtime/syntax/haredoc.vim32
-rw-r--r--runtime/syntax/hcl.vim66
-rw-r--r--runtime/syntax/help.vim10
-rw-r--r--runtime/syntax/hollywood.vim16
-rw-r--r--runtime/syntax/html.vim5
-rw-r--r--runtime/syntax/htmlangular.vim18
-rw-r--r--runtime/syntax/i3config.vim6
-rw-r--r--runtime/syntax/idlang.vim13
-rw-r--r--runtime/syntax/indent.vim4
-rw-r--r--runtime/syntax/java.vim762
-rw-r--r--runtime/syntax/javascript.vim9
-rw-r--r--runtime/syntax/jinja.vim86
-rw-r--r--runtime/syntax/kconfig.vim4
-rw-r--r--runtime/syntax/kdl.vim48
-rw-r--r--runtime/syntax/kivy.vim10
-rw-r--r--runtime/syntax/lc.vim2
-rw-r--r--runtime/syntax/logindefs.vim27
-rw-r--r--runtime/syntax/lyrics.vim4
-rw-r--r--runtime/syntax/make.vim21
-rw-r--r--runtime/syntax/mediawiki.vim292
-rw-r--r--runtime/syntax/mma.vim2
-rw-r--r--runtime/syntax/mysql.vim314
-rw-r--r--runtime/syntax/ocaml.vim407
-rw-r--r--runtime/syntax/opam.vim52
-rw-r--r--runtime/syntax/progress.vim14
-rw-r--r--runtime/syntax/query.lua4
-rw-r--r--runtime/syntax/rasi.vim298
-rw-r--r--runtime/syntax/salt.vim16
-rw-r--r--runtime/syntax/scheme.vim21
-rw-r--r--runtime/syntax/sdc.vim46
-rw-r--r--runtime/syntax/shared/debversions.vim9
-rw-r--r--runtime/syntax/shared/typescriptcommon.vim192
-rw-r--r--runtime/syntax/spec.vim3
-rw-r--r--runtime/syntax/stylus.vim12
-rw-r--r--runtime/syntax/sudoers.vim17
-rw-r--r--runtime/syntax/swayconfig.vim10
-rw-r--r--runtime/syntax/terraform.vim17
-rw-r--r--runtime/syntax/thrift.vim74
-rw-r--r--runtime/syntax/tmux.vim14
-rw-r--r--runtime/syntax/tsv.vim12
-rw-r--r--runtime/syntax/typescript.vim2
-rw-r--r--runtime/syntax/typescriptreact.vim7
-rw-r--r--runtime/syntax/typst.vim472
-rw-r--r--runtime/syntax/vim.vim450
-rw-r--r--runtime/syntax/yaml.vim2
-rw-r--r--runtime/syntax/zathurarc.vim4
-rw-r--r--runtime/tools/emoji_list.lua19
-rw-r--r--runtime/tools/emoji_list.vim21
-rw-r--r--runtime/tutor/en/vim-01-beginner.tutor2
-rw-r--r--runtime/tutor/en/vim-01-beginner.tutor.json14
-rw-r--r--runtime/windows_icon.rc4
435 files changed, 20586 insertions, 9034 deletions
diff --git a/runtime/autoload/dist/vim.vim b/runtime/autoload/dist/vim.vim
index 021244c93b..bb858c5732 100644
--- a/runtime/autoload/dist/vim.vim
+++ b/runtime/autoload/dist/vim.vim
@@ -18,6 +18,9 @@ endif
if !has('vim9script')
function dist#vim#IsSafeExecutable(filetype, executable)
let cwd = getcwd()
+ if empty(exepath(a:executable))
+ return v:false
+ endif
return get(g:, a:filetype .. '_exec', get(g:, 'plugin_exec', 0)) &&
\ (fnamemodify(exepath(a:executable), ':p:h') !=# cwd
\ || (split($PATH, has('win32') ? ';' : ':')->index(cwd) != -1 &&
diff --git a/runtime/autoload/hare.vim b/runtime/autoload/hare.vim
new file mode 100644
index 0000000000..c4581fccf9
--- /dev/null
+++ b/runtime/autoload/hare.vim
@@ -0,0 +1,26 @@
+" Vim autoload file.
+" Language: Hare
+" Maintainer: Amelia Clarke <selene@perilune.dev>
+" Last Updated: 2024-05-10
+" Upstream: https://git.sr.ht/~sircmpwn/hare.vim
+
+" Attempt to find the directory for a given Hare module.
+function hare#FindModule(str)
+ let path = substitute(trim(a:str, ':', 2), '::', '/', 'g')
+ let dir = finddir(path)
+ while !empty(path) && empty(dir)
+ let path = substitute(path, '/\?\h\w*$', '', '')
+ let dir = finddir(path)
+ endwhile
+ return dir
+endfunction
+
+" Return the value of HAREPATH if it exists. Otherwise use a reasonable default.
+function hare#GetPath()
+ if empty($HAREPATH)
+ return '/usr/src/hare/stdlib,/usr/src/hare/third-party'
+ endif
+ return substitute($HAREPATH, ':', ',', 'g')
+endfunction
+
+" vim: et sts=2 sw=2 ts=8
diff --git a/runtime/autoload/hcl.vim b/runtime/autoload/hcl.vim
new file mode 100644
index 0000000000..2215fc8f27
--- /dev/null
+++ b/runtime/autoload/hcl.vim
@@ -0,0 +1,40 @@
+" Language: HCL
+" Maintainer: Gregory Anders
+" Last Change: 2024-09-03
+" Based on: https://github.com/hashivim/vim-terraform
+
+function! hcl#indentexpr(lnum)
+ " Beginning of the file should have no indent
+ if a:lnum == 0
+ return 0
+ endif
+
+ " Usual case is to continue at the same indent as the previous non-blank line.
+ let prevlnum = prevnonblank(a:lnum-1)
+ let thisindent = indent(prevlnum)
+
+ " If that previous line is a non-comment ending in [ { (, increase the
+ " indent level.
+ let prevline = getline(prevlnum)
+ if prevline !~# '^\s*\(#\|//\)' && prevline =~# '[\[{\(]\s*$'
+ let thisindent += &shiftwidth
+ endif
+
+ " If the current line ends a block, decrease the indent level.
+ let thisline = getline(a:lnum)
+ if thisline =~# '^\s*[\)}\]]'
+ let thisindent -= &shiftwidth
+ endif
+
+ " If the previous line starts a block comment /*, increase by one
+ if prevline =~# '/\*'
+ let thisindent += 1
+ endif
+
+ " If the previous line ends a block comment */, decrease by one
+ if prevline =~# '\*/'
+ let thisindent -= 1
+ endif
+
+ return thisindent
+endfunction
diff --git a/runtime/autoload/javaformat.vim b/runtime/autoload/javaformat.vim
new file mode 100644
index 0000000000..4d7d32cf19
--- /dev/null
+++ b/runtime/autoload/javaformat.vim
@@ -0,0 +1,92 @@
+" Vim formatting plugin file
+" Language: Java
+" Maintainer: Aliaksei Budavei <0x000c70 AT gmail DOT com>
+" Repository: https://github.com/zzzyxwvut/java-vim.git
+" Last Change: 2024 Sep 26
+
+" Documented in ":help ft-java-plugin".
+if &cp || exists("g:loaded_javaformat") || exists("g:java_ignore_javadoc") || exists("g:java_ignore_markdown")
+ finish
+endif
+
+let g:loaded_javaformat = 1
+
+"""" STRIVE TO REMAIN COMPATIBLE FOR AT LEAST VIM 7.0.
+
+function! javaformat#RemoveCommonMarkdownWhitespace() abort
+ if mode() != 'n'
+ return 0
+ endif
+
+ let pattern = '\(^\s*///\)\(\s*\)\(.*\)'
+
+ " E121 for v:numbermax before v8.2.2388.
+ " E15 for expr-<< before v8.2.5003.
+ let common = 0x7fffffff
+ let comments = []
+
+ for n in range(v:lnum, (v:lnum + v:count - 1))
+ let parts = matchlist(getline(n), pattern)
+ let whitespace = get(parts, 2, '')
+ let nonwhitespace = get(parts, 3, '')
+
+ if !empty(whitespace)
+ let common = min([common, strlen(whitespace)])
+ elseif !empty(nonwhitespace) || empty(parts)
+ " No whitespace prefix or not a Markdown comment.
+ return 0
+ endif
+
+ call add(comments, [whitespace, parts[1], nonwhitespace])
+ endfor
+
+ let cursor = v:lnum
+
+ for line in comments
+ call setline(cursor, join(line[1 :], strpart(line[0], common)))
+ let cursor += 1
+ endfor
+
+ return 0
+endfunction
+
+" See ":help vim9-mix".
+if !has("vim9script")
+ finish
+endif
+
+def! g:javaformat#RemoveCommonMarkdownWhitespace(): number
+ if mode() != 'n'
+ return 0
+ endif
+
+ const pattern: string = '\(^\s*///\)\(\s*\)\(.*\)'
+ var common: number = v:numbermax
+ var comments: list<list<string>> = []
+
+ for n in range(v:lnum, (v:lnum + v:count - 1))
+ const parts: list<string> = matchlist(getline(n), pattern)
+ const whitespace: string = get(parts, 2, '')
+ const nonwhitespace: string = get(parts, 3, '')
+
+ if !empty(whitespace)
+ common = min([common, strlen(whitespace)])
+ elseif !empty(nonwhitespace) || empty(parts)
+ # No whitespace prefix or not a Markdown comment.
+ return 0
+ endif
+
+ add(comments, [whitespace, parts[1], nonwhitespace])
+ endfor
+
+ var cursor: number = v:lnum
+
+ for line in comments
+ setline(cursor, join(line[1 :], strpart(line[0], common)))
+ cursor += 1
+ endfor
+
+ return 0
+enddef
+
+" vim: fdm=syntax sw=4 ts=8 noet sta
diff --git a/runtime/autoload/msgpack.vim b/runtime/autoload/msgpack.vim
index 18dcd1e6a6..fb438def4f 100644
--- a/runtime/autoload/msgpack.vim
+++ b/runtime/autoload/msgpack.vim
@@ -361,7 +361,7 @@ endfunction
let s:MSGPACK_STANDARD_TYPES = {
\type(0): 'integer',
\type(0.0): 'float',
- \type(''): 'binary',
+ \type(''): 'string',
\type([]): 'array',
\type({}): 'map',
\type(v:true): 'boolean',
@@ -412,9 +412,15 @@ endfunction
""
" Dump |msgpack-special-dict| that represents a string. If any additional
" parameter is given then it dumps binary string.
-function s:msgpack_dump_string(v, ...) abort
- let ret = [a:0 ? '"' : '="']
- for v in a:v._VAL
+function s:msgpack_dump_string(v) abort
+ if type(a:v) == type({})
+ let val = a:v
+ else
+ let val = {'_VAL': split(a:v, "\n", 1)}
+ end
+
+ let ret = ['"']
+ for v in val._VAL
call add(
\ret,
\substitute(
@@ -427,16 +433,6 @@ function s:msgpack_dump_string(v, ...) abort
endfunction
""
-" Dump binary string.
-function s:msgpack_dump_binary(v) abort
- if type(a:v) == type({})
- return s:msgpack_dump_string(a:v, 1)
- else
- return s:msgpack_dump_string({'_VAL': split(a:v, "\n", 1)}, 1)
- endif
-endfunction
-
-""
" Dump array value.
function s:msgpack_dump_array(v) abort
let val = type(a:v) == type({}) ? a:v._VAL : a:v
@@ -449,7 +445,7 @@ function s:msgpack_dump_map(v) abort
let ret = ['{']
if msgpack#special_type(a:v) is 0
for [k, v] in items(a:v)
- let ret += [s:msgpack_dump_string({'_VAL': split(k, "\n", 1)}),
+ let ret += [s:msgpack_dump_string({'_VAL': split(k, "\n")}),
\': ',
\msgpack#string(v),
\', ']
@@ -479,7 +475,7 @@ endfunction
" Dump extension value.
function s:msgpack_dump_ext(v) abort
return printf('+(%i)%s', a:v._VAL[0],
- \s:msgpack_dump_string({'_VAL': a:v._VAL[1]}, 1))
+ \s:msgpack_dump_string({'_VAL': a:v._VAL[1]}))
endfunction
""
@@ -619,9 +615,7 @@ function msgpack#eval(s, special_objs) abort
throw '"-invalid:Invalid string: ' . s
endif
call add(expr, '{''_TYPE'': v:msgpack_types.')
- if empty(match[1])
- call add(expr, 'binary')
- elseif match[1] is# '='
+ if empty(match[1]) || match[1] is# '='
call add(expr, 'string')
else
call add(expr, 'ext')
@@ -772,7 +766,7 @@ function msgpack#equal(a, b)
let a = aspecial is 0 ? a:a : a:a._VAL
let b = bspecial is 0 ? a:b : a:b._VAL
return msgpack#equal(a, b)
- elseif atype is# 'binary'
+ elseif atype is# 'string'
let a = (aspecial is 0 ? split(a:a, "\n", 1) : a:a._VAL)
let b = (bspecial is 0 ? split(a:b, "\n", 1) : a:b._VAL)
return a ==# b
@@ -787,13 +781,17 @@ function msgpack#equal(a, b)
" Non-special mapping cannot have non-string keys
return 0
endif
- if (empty(k._VAL)
- \|| k._VAL ==# [""]
- \|| !empty(filter(copy(k._VAL), 'stridx(v:val, "\n") != -1')))
- " Non-special mapping cannot have zero byte in key or an empty key
- return 0
+ if type(k) == type({})
+ if (empty(k._VAL)
+ \|| k._VAL ==# [""]
+ \|| !empty(filter(copy(k._VAL), 'stridx(v:val, "\n") != -1')))
+ " Non-special mapping cannot have zero byte in key or an empty key
+ return 0
+ endif
+ let kstr = join(k._VAL, "\n")
+ else
+ let kstr = k
endif
- let kstr = join(k._VAL, "\n")
if !has_key(akeys, kstr)
" Protects from both missing and duplicate keys
return 0
diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim
index ae602c5be6..a96364fb4b 100644
--- a/runtime/autoload/netrw.vim
+++ b/runtime/autoload/netrw.vim
@@ -3,7 +3,7 @@
" Maintainer: This runtime file is looking for a new maintainer.
" Date: May 03, 2023
" Version: 173a
-" Last Change:
+" Last Change: {{{1
" 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)
" 2024 Feb 19 by Vim Project: (announce adoption)
@@ -12,6 +12,21 @@
" 2024 May 08 by Vim Project: cleanup legacy Win9X checks
" 2024 May 09 by Vim Project: remove hard-coded private.ppk
" 2024 May 10 by Vim Project: recursively delete directories by default
+" 2024 May 13 by Vim Project: prefer scp over pscp
+" 2024 Jun 04 by Vim Project: set bufhidden if buffer changed, nohidden is set and buffer shall be switched (#14915)
+" 2024 Jun 13 by Vim Project: glob() on Windows fails when a directory name contains [] (#14952)
+" 2024 Jun 23 by Vim Project: save ad restore registers when liststyle = WIDELIST (#15077, #15114)
+" 2024 Jul 22 by Vim Project: avoid endless recursion (#15318)
+" 2024 Jul 23 by Vim Project: escape filename before trying to delete it (#15330)
+" 2024 Jul 30 by Vim Project: handle mark-copy to same target directory (#12112)
+" 2024 Aug 02 by Vim Project: honor g:netrw_alt{o,v} for :{S,H,V}explore (#15417)
+" 2024 Aug 15 by Vim Project: style changes, prevent E121 (#15501)
+" 2024 Aug 22 by Vim Project: fix mf-selection highlight (#15551)
+" 2024 Aug 22 by Vim Project: adjust echo output of mx command (#15550)
+" 2024 Sep 15 by Vim Project: more strict confirmation dialog (#15680)
+" 2024 Sep 19 by Vim Project: mf-selection highlight uses wrong pattern (#15700)
+" 2024 Sep 21 by Vim Project: remove extraneous closing bracket (#15718)
+" }}}
" Former Maintainer: Charles E Campbell
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
" Copyright: Copyright (C) 2016 Charles E. Campbell {{{1
@@ -54,11 +69,6 @@ if exists("s:needspatches")
endif
let g:loaded_netrw = "v173"
-if !exists("s:NOTE")
- let s:NOTE = 0
- let s:WARNING = 1
- let s:ERROR = 2
-endif
let s:keepcpo= &cpo
setl cpo&vim
@@ -96,7 +106,7 @@ fun! netrw#ErrorMsg(level,msg,errnum)
endif
" call Decho("level=".level,'~'.expand("<slnum>"))
- if g:netrw_use_errorwindow == 2 && (v:version > 802 || (v:version == 802 && has("patch486")))
+ if g:netrw_use_errorwindow == 2 && exists("*popup_atcursor")
" use popup window
if type(a:msg) == 3
let msg = [level]+a:msg
@@ -212,6 +222,11 @@ if !exists("s:LONGLIST")
call s:NetrwInit("s:MAXLIST" ,4)
endif
+let s:NOTE = 0
+let s:WARNING = 1
+let s:ERROR = 2
+call s:NetrwInit("g:netrw_errorlvl", s:NOTE)
+
" ---------------------------------------------------------------------
" Default option values: {{{2
let g:netrw_localcopycmdopt = ""
@@ -337,7 +352,6 @@ call s:NetrwInit("s:didstarstar",0)
call s:NetrwInit("g:netrw_dirhistcnt" , 0)
call s:NetrwInit("g:netrw_decompress" , '{ ".gz" : "gunzip", ".bz2" : "bunzip2", ".zip" : "unzip", ".tar" : "tar -xf", ".xz" : "unxz" }')
call s:NetrwInit("g:netrw_dirhistmax" , 10)
-call s:NetrwInit("g:netrw_errorlvl" , s:NOTE)
call s:NetrwInit("g:netrw_fastbrowse" , 1)
call s:NetrwInit("g:netrw_ftp_browse_reject", '^total\s\+\d\+$\|^Trying\s\+\d\+.*$\|^KERBEROS_V\d rejected\|^Security extensions not\|No such file\|: connect to address [0-9a-fA-F:]*: No route to host$')
if !exists("g:netrw_ftp_list_cmd")
@@ -688,12 +702,11 @@ fun! netrw#Explore(indx,dosplit,style,...)
\ ((isdirectory(s:NetrwFile(a:1))))? 'is a directory' : 'is not a directory',
\ '~'.expand("<slnum>"))
if a:1 =~ "\\\s" && !filereadable(s:NetrwFile(a:1)) && !isdirectory(s:NetrwFile(a:1))
-" call Decho("re-trying Explore with <".substitute(a:1,'\\\(\s\)','\1','g').">",'~'.expand("<slnum>"))
- call netrw#Explore(a:indx,a:dosplit,a:style,substitute(a:1,'\\\(\s\)','\1','g'))
-" call Dret("netrw#Explore : returning from retry")
- return
-" else " Decho
-" call Decho("retry not needed",'~'.expand("<slnum>"))
+ let a1 = substitute(a:1, '\\\(\s\)', '\1', 'g')
+ if a1 != a:1
+ call netrw#Explore(a:indx, a:dosplit, a:style, a1)
+ return
+ endif
endif
endif
@@ -704,7 +717,6 @@ fun! netrw#Explore(indx,dosplit,style,...)
" -or- file has been modified AND file not hidden when abandoned
" -or- Texplore used
if a:dosplit || (&modified && &hidden == 0 && &bufhidden != "hide") || a:style == 6
-" call Decho("case dosplit=".a:dosplit." modified=".&modified." a:style=".a:style.": dosplit or file has been modified",'~'.expand("<slnum>"))
call s:SaveWinVars()
let winsz= g:netrw_winsize
if a:indx > 0
@@ -712,57 +724,41 @@ fun! netrw#Explore(indx,dosplit,style,...)
endif
if a:style == 0 " Explore, Sexplore
-" call Decho("style=0: Explore or Sexplore",'~'.expand("<slnum>"))
let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz
if winsz == 0|let winsz= ""|endif
- exe "noswapfile ".winsz."wincmd s"
-" call Decho("exe noswapfile ".winsz."wincmd s",'~'.expand("<slnum>"))
+ exe "noswapfile ".(g:netrw_alto ? "below " : "above ").winsz."wincmd s"
- elseif a:style == 1 "Explore!, Sexplore!
-" call Decho("style=1: Explore! or Sexplore!",'~'.expand("<slnum>"))
+ elseif a:style == 1 " Explore!, Sexplore!
let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz
if winsz == 0|let winsz= ""|endif
- exe "keepalt noswapfile ".winsz."wincmd v"
-" call Decho("exe keepalt noswapfile ".winsz."wincmd v",'~'.expand("<slnum>"))
+ exe "keepalt noswapfile ".(g:netrw_altv ? "rightbelow " : "leftabove ").winsz."wincmd v"
elseif a:style == 2 " Hexplore
-" call Decho("style=2: Hexplore",'~'.expand("<slnum>"))
let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz
if winsz == 0|let winsz= ""|endif
- exe "keepalt noswapfile bel ".winsz."wincmd s"
-" call Decho("exe keepalt noswapfile bel ".winsz."wincmd s",'~'.expand("<slnum>"))
+ exe "keepalt noswapfile ".(g:netrw_alto ? "below " : "above ").winsz."wincmd s"
elseif a:style == 3 " Hexplore!
-" call Decho("style=3: Hexplore!",'~'.expand("<slnum>"))
let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz
if winsz == 0|let winsz= ""|endif
- exe "keepalt noswapfile abo ".winsz."wincmd s"
-" call Decho("exe keepalt noswapfile abo ".winsz."wincmd s",'~'.expand("<slnum>"))
+ exe "keepalt noswapfile ".(!g:netrw_alto ? "below " : "above ").winsz."wincmd s"
elseif a:style == 4 " Vexplore
-" call Decho("style=4: Vexplore",'~'.expand("<slnum>"))
let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz
if winsz == 0|let winsz= ""|endif
- exe "keepalt noswapfile lefta ".winsz."wincmd v"
-" call Decho("exe keepalt noswapfile lefta ".winsz."wincmd v",'~'.expand("<slnum>"))
+ exe "keepalt noswapfile ".(g:netrw_altv ? "rightbelow " : "leftabove ").winsz."wincmd v"
elseif a:style == 5 " Vexplore!
-" call Decho("style=5: Vexplore!",'~'.expand("<slnum>"))
let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz
if winsz == 0|let winsz= ""|endif
- exe "keepalt noswapfile rightb ".winsz."wincmd v"
-" call Decho("exe keepalt noswapfile rightb ".winsz."wincmd v",'~'.expand("<slnum>"))
+ exe "keepalt noswapfile ".(!g:netrw_altv ? "rightbelow " : "leftabove ").winsz."wincmd v"
elseif a:style == 6 " Texplore
call s:SaveBufVars()
-" call Decho("style = 6: Texplore",'~'.expand("<slnum>"))
exe "keepalt tabnew ".fnameescape(curdir)
-" call Decho("exe keepalt tabnew ".fnameescape(curdir),'~'.expand("<slnum>"))
call s:RestoreBufVars()
endif
call s:RestoreWinVars()
-" else " Decho
-" call Decho("case a:dosplit=".a:dosplit." AND modified=".&modified." AND a:style=".a:style." is not 6",'~'.expand("<slnum>"))
endif
NetrwKeepj norm! 0
@@ -4188,7 +4184,7 @@ fun! s:NetrwGetBuffer(islocal,dirname)
endif
" call Decho(" NetrwTreeListing: bufnum#".bufnum,'~'.expand("<slnum>"))
if !bufexists(bufnum)
- call remove(s:netrwbuf,"NetrwTreeListing"])
+ call remove(s:netrwbuf,"NetrwTreeListing")
let bufnum= -1
endif
elseif bufnr("NetrwTreeListing") != -1
@@ -4446,7 +4442,15 @@ fun! s:NetrwGetWord()
call cursor(line("."),filestart+1)
NetrwKeepj norm! ma
endif
- let rega= @a
+
+ let dict={}
+ " save the unnamed register and register 0-9 and a
+ let dict.a=[getreg('a'), getregtype('a')]
+ for i in range(0, 9)
+ let dict[i] = [getreg(i), getregtype(i)]
+ endfor
+ let dict.unnamed = [getreg(''), getregtype('')]
+
let eofname= filestart + b:netrw_cpf + 1
if eofname <= col("$")
call cursor(line("."),filestart+b:netrw_cpf+1)
@@ -4454,8 +4458,10 @@ fun! s:NetrwGetWord()
else
NetrwKeepj norm! "ay$
endif
+
let dirname = @a
- let @a = rega
+ call s:RestoreRegister(dict)
+
" call Decho("2: dirname<".dirname.">",'~'.expand("<slnum>"))
let dirname= substitute(dirname,'\s\+$','','e')
" call Decho("3: dirname<".dirname.">",'~'.expand("<slnum>"))
@@ -5523,13 +5529,12 @@ endfun
" ---------------------------------------------------------------------
" netrw#BrowseXVis: used by gx in visual mode to select a file for browsing {{{2
fun! netrw#BrowseXVis()
-" call Dfunc("netrw#BrowseXVis()")
- let akeep = @a
+ let dict={}
+ let dict.a=[getreg('a'), getregtype('a')]
norm! gv"ay
let gxfile= @a
- let @a = akeep
+ call s:RestoreRegister(dict)
call netrw#BrowseX(gxfile,netrw#CheckIfRemote(gxfile))
-" call Dret("netrw#BrowseXVis")
endfun
" ---------------------------------------------------------------------
@@ -5681,6 +5686,9 @@ fun! s:NetrwEditFile(cmd,opt,fname)
exe "NetrwKeepj keepalt ".a:opt." ".a:cmd." ".fnameescape(a:fname)
else
" call Decho("exe NetrwKeepj ".a:opt." ".a:cmd." ".fnameescape(a:fname))
+ if a:cmd =~# 'e\%[new]!' && !&hidden && getbufvar(bufname('%'), '&modified', 0)
+ call setbufvar(bufname('%'), '&bufhidden', 'hide')
+ endif
exe "NetrwKeepj ".a:opt." ".a:cmd." ".fnameescape(a:fname)
endif
" call Dret("s:NetrwEditFile")
@@ -5751,16 +5759,20 @@ fun! s:NetrwGlob(direntry,expr,pare)
let filelist= w:netrw_treedict[a:direntry]
endif
let w:netrw_liststyle= keep_liststyle
- elseif v:version > 704 || (v:version == 704 && has("patch656"))
- let filelist= glob(s:ComposePath(fnameescape(a:direntry),a:expr),0,1,1)
- if a:pare
- let filelist= map(filelist,'substitute(v:val, "^.*/", "", "")')
- endif
else
- let filelist= glob(s:ComposePath(fnameescape(a:direntry),a:expr),0,1)
- if a:pare
- let filelist= map(filelist,'substitute(v:val, "^.*/", "", "")')
- endif
+ let path= s:ComposePath(fnameescape(a:direntry),a:expr)
+ if has("win32")
+ " escape [ so it is not detected as wildcard character, see :h wildcard
+ let path= substitute(path, '[', '[[]', 'g')
+ endif
+ if v:version > 704 || (v:version == 704 && has("patch656"))
+ let filelist= glob(path,0,1,1)
+ else
+ let filelist= glob(path,0,1)
+ endif
+ if a:pare
+ let filelist= map(filelist,'substitute(v:val, "^.*/", "", "")')
+ endif
endif
" call Dret("s:NetrwGlob ".string(filelist))
return filelist
@@ -6817,11 +6829,7 @@ fun! s:NetrwMarkFile(islocal,fname)
let ykeep = @@
let curbufnr= bufnr("%")
- if a:fname =~ '^\a'
- let leader= '\<'
- else
- let leader= ''
- endif
+ let leader= '\%(^\|\s\)\zs'
if a:fname =~ '\a$'
let trailer = '\>[@=|\/\*]\=\ze\%( \|\t\|$\)'
else
@@ -7084,7 +7092,7 @@ fun! s:NetrwMarkFileCopy(islocal,...)
endif
" copy marked files while within the same directory (ie. allow renaming)
- if simplify(s:netrwmftgt) == simplify(b:netrw_curdir)
+ if s:StripTrailingSlash(simplify(s:netrwmftgt)) == s:StripTrailingSlash(simplify(b:netrw_curdir))
if len(s:netrwmarkfilelist_{bufnr('%')}) == 1
" only one marked file
" call Decho("case: only one marked file",'~'.expand("<slnum>"))
@@ -7161,7 +7169,7 @@ fun! s:NetrwMarkFileCopy(islocal,...)
" call Decho("system(".copycmd." '".args."' '".tgt."')",'~'.expand("<slnum>"))
call system(copycmd.g:netrw_localcopycmdopt." '".args."' '".tgt."'")
if v:shell_error != 0
- if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && !g:netrw_keepdir
+ if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && g:netrw_keepdir
call netrw#ErrorMsg(s:ERROR,"copy failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-cd)",101)
else
call netrw#ErrorMsg(s:ERROR,"tried using g:netrw_localcopycmd<".g:netrw_localcopycmd.">; it doesn't work!",80)
@@ -7430,7 +7438,13 @@ fun! s:NetrwMarkFileExe(islocal,enbloc)
NetrwKeepj call netrw#ErrorMsg(s:ERROR,"command<".xcmd."> failed, aborting",54)
break
else
- echo ret
+ if ret !=# ''
+ echo "\n"
+ " skip trailing new line
+ echo ret[0:-2]
+ else
+ echo ret
+ endif
endif
endfor
@@ -9669,7 +9683,13 @@ fun! s:NetrwWideListing()
" fpl: filenames per line
" fpc: filenames per column
setl ma noro
- let keepa= @a
+ let dict={}
+ " save the unnamed register and register 0-9 and a
+ let dict.a=[getreg('a'), getregtype('a')]
+ for i in range(0, 9)
+ let dict[i] = [getreg(i), getregtype(i)]
+ endfor
+ let dict.unnamed = [getreg(''), getregtype('')]
" call Decho("setl ma noro",'~'.expand("<slnum>"))
let b:netrw_cpf= 0
if line("$") >= w:netrw_bannercnt
@@ -9677,7 +9697,8 @@ fun! s:NetrwWideListing()
exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif'
NetrwKeepj call histdel("/",-1)
else
- let @a= keepa
+ " restore stored registers
+ call s:RestoreRegister(dict)
" call Dret("NetrwWideListing")
return
endif
@@ -9719,7 +9740,7 @@ fun! s:NetrwWideListing()
exe 'nno <buffer> <silent> b :call search(''^.\\|\s\s\zs\S'',''bW'')'."\<cr>"
" call Decho("NetrwWideListing) setl noma nomod ro",'~'.expand("<slnum>"))
exe "setl ".g:netrw_bufsettings
- let @a= keepa
+ call s:RestoreRegister(dict)
" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
" call Dret("NetrwWideListing")
return
@@ -9731,7 +9752,6 @@ fun! s:NetrwWideListing()
sil! nunmap <buffer> b
endif
endif
-
endfun
" ---------------------------------------------------------------------
@@ -10052,7 +10072,8 @@ fun! s:SetupNetrwStatusLine(statline)
endif
" set up User9 highlighting as needed
- let keepa= @a
+ let dict={}
+ let dict.a=[getreg('a'), getregtype('a')]
redir @a
try
hi User9
@@ -10064,7 +10085,7 @@ fun! s:SetupNetrwStatusLine(statline)
endif
endtry
redir END
- let @a= keepa
+ call s:RestoreRegister(dict)
endif
" set up status line (may use User9 highlighting)
@@ -11257,7 +11278,7 @@ fun! s:NetrwLocalRm(path) range
let ok= s:NetrwLocalRmFile(a:path,fname,all)
if ok =~# 'q\%[uit]' || ok == "no"
break
- elseif ok =~# 'a\%[ll]'
+ elseif ok =~# '^a\%[ll]$'
let all= 1
endif
endfor
@@ -11286,7 +11307,7 @@ fun! s:NetrwLocalRm(path) range
let ok= s:NetrwLocalRmFile(a:path,curword,all)
if ok =~# 'q\%[uit]' || ok == "no"
break
- elseif ok =~# 'a\%[ll]'
+ elseif ok =~# '^a\%[ll]$'
let all= 1
endif
let ctr= ctr + 1
@@ -11315,7 +11336,7 @@ fun! s:NetrwLocalRmFile(path,fname,all)
let all= a:all
let ok = ""
NetrwKeepj norm! 0
- let rmfile= s:NetrwFile(s:ComposePath(a:path,a:fname))
+ let rmfile= s:NetrwFile(s:ComposePath(a:path,escape(a:fname, '\\')))
" call Decho("rmfile<".rmfile.">",'~'.expand("<slnum>"))
if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$')
@@ -11324,7 +11345,7 @@ fun! s:NetrwLocalRmFile(path,fname,all)
if !all
echohl Statement
call inputsave()
- let ok= input("Confirm deletion of file<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ")
+ let ok= input("Confirm deletion of file <".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ")
call inputrestore()
echohl NONE
if ok == ""
@@ -11333,12 +11354,12 @@ fun! s:NetrwLocalRmFile(path,fname,all)
" call Decho("response: ok<".ok.">",'~'.expand("<slnum>"))
let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
" call Decho("response: ok<".ok."> (after sub)",'~'.expand("<slnum>"))
- if ok =~# 'a\%[ll]'
+ if ok =~# '^a\%[ll]$'
let all= 1
endif
endif
- if all || ok =~# 'y\%[es]' || ok == ""
+ if all || ok =~# '^y\%[es]$' || ok == ""
let ret= s:NetrwDelete(rmfile)
" call Decho("errcode=".v:shell_error." ret=".ret,'~'.expand("<slnum>"))
endif
@@ -11348,19 +11369,19 @@ fun! s:NetrwLocalRmFile(path,fname,all)
if !all
echohl Statement
call inputsave()
- let ok= input("Confirm *recursive* deletion of directory<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ")
+ let ok= input("Confirm *recursive* deletion of directory <".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ")
call inputrestore()
let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
if ok == ""
let ok="no"
endif
- if ok =~# 'a\%[ll]'
+ if ok =~# '^a\%[ll]$'
let all= 1
endif
endif
let rmfile= substitute(rmfile,'[\/]$','','e')
- if all || ok =~# 'y\%[es]' || ok == ""
+ if all || ok =~# '^y\%[es]$' || ok == ""
if delete(rmfile,"rf")
call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".rmfile.">!",103)
endif
@@ -11508,6 +11529,13 @@ fun! netrw#WinPath(path)
endfun
" ---------------------------------------------------------------------
+" s:StripTrailingSlash: removes trailing slashes from a path {{{2
+fun! s:StripTrailingSlash(path)
+ " remove trailing slash
+ return substitute(a:path, '[/\\]$', '', 'g')
+endfun
+
+" ---------------------------------------------------------------------
" s:NetrwBadd: adds marked files to buffer list or vice versa {{{2
" cb : bl2mf=0 add marked files to buffer list
" cB : bl2mf=1 use bufferlist to mark files
@@ -11874,6 +11902,16 @@ fun! s:RestoreCursorline()
" call Dret("s:RestoreCursorline : restored cul=".&l:cursorline." cuc=".&l:cursorcolumn)
endfun
+" s:RestoreRegister: restores all registers given in the dict {{{2
+fun! s:RestoreRegister(dict)
+ for [key, val] in items(a:dict)
+ if key == 'unnamed'
+ let key = ''
+ endif
+ call setreg(key, val[0], val[1])
+ endfor
+endfun
+
" ---------------------------------------------------------------------
" s:NetrwDelete: Deletes a file. {{{2
" Uses Steve Hall's idea to insure that Windows paths stay
@@ -12681,54 +12719,3 @@ unlet s:keepcpo
" Modelines: {{{1
" ===============
" vim:ts=8 fdm=marker
-" doing autoload/netrw.vim version v172g ~57
-" varname<g:netrw_dirhistcnt> value=0 ~1
-" varname<s:THINLIST> value=0 ~1
-" varname<s:LONGLIST> value=1 ~1
-" varname<s:WIDELIST> value=2 ~1
-" varname<s:TREELIST> value=3 ~1
-" varname<s:MAXLIST> value=4 ~1
-" varname<g:netrw_use_errorwindow> value=2 ~1
-" varname<g:netrw_http_xcmd> value=-q -O ~1
-" varname<g:netrw_http_put_cmd> value=curl -T ~1
-" varname<g:netrw_keepj> value=keepj ~1
-" varname<g:netrw_rcp_cmd> value=rcp ~1
-" varname<g:netrw_rsync_cmd> value=rsync ~1
-" varname<g:netrw_rsync_sep> value=/ ~1
-" varname<g:netrw_scp_cmd> value=scp -q ~1
-" varname<g:netrw_sftp_cmd> value=sftp ~1
-" varname<g:netrw_ssh_cmd> value=ssh ~1
-" varname<g:netrw_alto> value=0 ~1
-" varname<g:netrw_altv> value=1 ~1
-" varname<g:netrw_banner> value=1 ~1
-" varname<g:netrw_browse_split> value=0 ~1
-" varname<g:netrw_bufsettings> value=noma nomod nonu nobl nowrap ro nornu ~1
-" varname<g:netrw_chgwin> value=-1 ~1
-" varname<g:netrw_clipboard> value=1 ~1
-" varname<g:netrw_compress> value=gzip ~1
-" varname<g:netrw_ctags> value=ctags ~1
-" varname<g:netrw_cursor> value=2 ~1
-" (netrw) COMBAK: cuc=0 cul=0 initialization of s:netrw_cu[cl]
-" varname<g:netrw_cygdrive> value=/cygdrive ~1
-" varname<s:didstarstar> value=0 ~1
-" varname<g:netrw_dirhistcnt> value=0 ~1
-" varname<g:netrw_decompress> value={ ".gz" : "gunzip", ".bz2" : "bunzip2", ".zip" : "unzip", ".tar" : "tar -xf", ".xz" : "unxz" } ~1
-" varname<g:netrw_dirhistmax> value=10 ~1
-" varname<g:netrw_errorlvl> value=0 ~1
-" varname<g:netrw_fastbrowse> value=1 ~1
-" varname<g:netrw_ftp_browse_reject> value=^total\s\+\d\+$\|^Trying\s\+\d\+.*$\|^KERBEROS_V\d rejected\|^Security extensions not\|No such file\|: connect to address [0-9a-fA-F:]*: No route to host$ ~1
-" varname<g:netrw_ftpmode> value=binary ~1
-" varname<g:netrw_hide> value=1 ~1
-" varname<g:netrw_keepdir> value=1 ~1
-" varname<g:netrw_list_hide> value= ~1
-" varname<g:netrw_localmkdir> value=mkdir ~1
-" varname<g:netrw_remote_mkdir> value=mkdir ~1
-" varname<g:netrw_liststyle> value=0 ~1
-" varname<g:netrw_markfileesc> value=*./[\~ ~1
-" varname<g:netrw_maxfilenamelen> value=32 ~1
-" varname<g:netrw_menu> value=1 ~1
-" varname<g:netrw_mkdir_cmd> value=ssh USEPORT HOSTNAME mkdir ~1
-" varname<g:netrw_mousemaps> value=1 ~1
-" varname<g:netrw_retmap> value=0 ~1
-" varname<g:netrw_chgperm> value=chmod PERM FILENAME ~1
-" varname<g:netrw_preview> value=0 ~1
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim
index 82e0953196..58d3d4550f 100644
--- a/runtime/autoload/provider/clipboard.vim
+++ b/runtime/autoload/provider/clipboard.vim
@@ -140,6 +140,18 @@ function! provider#clipboard#Executable() abort
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
return 'win32yank'
+ elseif executable('putclip') && executable('getclip')
+ let s:copy['+'] = ['putclip']
+ let s:paste['+'] = ['getclip']
+ let s:copy['*'] = s:copy['+']
+ let s:paste['*'] = s:paste['+']
+ return 'putclip'
+ elseif executable('clip') && executable('powershell')
+ let s:copy['+'] = ['clip']
+ let s:paste['+'] = ['powershell', '-NoProfile', '-NoLogo', '-Command', 'Get-Clipboard']
+ let s:copy['*'] = s:copy['+']
+ let s:paste['*'] = s:paste['+']
+ return 'clip'
elseif executable('termux-clipboard-set')
let s:copy['+'] = ['termux-clipboard-set']
let s:paste['+'] = ['termux-clipboard-get']
diff --git a/runtime/autoload/shada.vim b/runtime/autoload/shada.vim
index ae718ad2e7..4753973196 100644
--- a/runtime/autoload/shada.vim
+++ b/runtime/autoload/shada.vim
@@ -230,7 +230,7 @@ function s:shada_check_type(type, val) abort
return 0
elseif a:type is# 'bin'
" Binary string without zero bytes
- if type isnot# 'binary'
+ if type isnot# 'string'
return 'Expected binary string'
elseif (type(a:val) == type({})
\&& !empty(filter(copy(a:val._VAL), 'stridx(v:val, "\n") != -1')))
@@ -247,7 +247,7 @@ function s:shada_check_type(type, val) abort
if type isnot# 'array'
return 'Expected array value'
elseif !empty(filter(copy(type(a:val) == type({}) ? a:val._VAL : a:val),
- \'msgpack#type(v:val) isnot# "binary"'))
+ \'msgpack#type(v:val) isnot# "string"'))
return 'Expected array of binary strings'
else
for element in (type(a:val) == type({}) ? a:val._VAL : a:val)
diff --git a/runtime/autoload/typst.vim b/runtime/autoload/typst.vim
new file mode 100644
index 0000000000..55edd23928
--- /dev/null
+++ b/runtime/autoload/typst.vim
@@ -0,0 +1,50 @@
+" Language: Typst
+" Maintainer: Gregory Anders
+" Last Change: 2024-07-14
+" Based on: https://github.com/kaarmu/typst.vim
+
+function! typst#indentexpr() abort
+ let l:lnum = v:lnum
+ let s:sw = shiftwidth()
+
+ let [l:plnum, l:pline] = s:get_prev_nonblank(l:lnum - 1)
+ if l:plnum == 0 | return 0 | endif
+
+ let l:line = getline(l:lnum)
+ let l:ind = indent(l:plnum)
+
+ let l:synname = synIDattr(synID(l:lnum, 1, 1), 'name')
+
+ " Use last indent for block comments
+ if l:synname == 'typstCommentBlock'
+ return l:ind
+ endif
+
+ if l:pline =~ '\v[{[(]\s*$'
+ let l:ind += s:sw
+ endif
+
+ if l:line =~ '\v^\s*[}\])]'
+ let l:ind -= s:sw
+ endif
+
+ return l:ind
+endfunction
+
+" Gets the previous non-blank line that is not a comment.
+function! s:get_prev_nonblank(lnum) abort
+ let l:lnum = prevnonblank(a:lnum)
+ let l:line = getline(l:lnum)
+
+ while l:lnum > 0 && l:line =~ '^\s*//'
+ let l:lnum = prevnonblank(l:lnum - 1)
+ let l:line = getline(l:lnum)
+ endwhile
+
+ return [l:lnum, s:remove_comments(l:line)]
+endfunction
+
+" Removes comments from the given line.
+function! s:remove_comments(line) abort
+ return substitute(a:line, '\s*//.*', '', '')
+endfunction
diff --git a/runtime/autoload/zip.vim b/runtime/autoload/zip.vim
index c0034f8a7a..172de98d36 100644
--- a/runtime/autoload/zip.vim
+++ b/runtime/autoload/zip.vim
@@ -1,36 +1,38 @@
" zip.vim: Handles browsing zipfiles
-" AUTOLOAD PORTION
-" Date: Mar 12, 2023
-" Version: 33
+" AUTOLOAD PORTION
+" Date: 2024 Aug 21
+" Version: 34
" Maintainer: This runtime file is looking for a new maintainer.
" Former Maintainer: Charles E Campbell
+" Last Change:
+" 2024 Jun 16 by Vim Project: handle whitespace on Windows properly (#14998)
+" 2024 Jul 23 by Vim Project: fix 'x' command
+" 2024 Jul 24 by Vim Project: use delete() function
+" 2024 Jul 30 by Vim Project: fix opening remote zipfile
+" 2024 Aug 04 by Vim Project: escape '[' in name of file to be extracted
+" 2024 Aug 05 by Vim Project: workaround for the FreeBSD's unzip
+" 2024 Aug 05 by Vim Project: clean-up and make it work with shellslash on Windows
+" 2024 Aug 18 by Vim Project: correctly handle special globbing chars
+" 2024 Aug 21 by Vim Project: simplify condition to detect MS-Windows
" 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,
-" with or without modifications, provided that this copyright
-" notice is copied with it. Like anything else that's free,
-" zip.vim and zipPlugin.vim are provided *as is* and comes with
-" no warranty of any kind, either expressed or implied. By using
-" this plugin, you agree that in no event will the copyright
-" holder be liable for any damages resulting from the use
-" of this software.
-"redraw!|call DechoSep()|call inputsave()|call input("Press <cr> to continue")|call inputrestore()
+" Copyright: Copyright (C) 2005-2019 Charles E. Campbell {{{1
+" Permission is hereby granted to use and distribute this code,
+" with or without modifications, provided that this copyright
+" notice is copied with it. Like anything else that's free,
+" zip.vim and zipPlugin.vim are provided *as is* and comes with
+" no warranty of any kind, either expressed or implied. By using
+" this plugin, you agree that in no event will the copyright
+" holder be liable for any damages resulting from the use
+" of this software.
" ---------------------------------------------------------------------
" Load Once: {{{1
if &cp || exists("g:loaded_zip")
finish
endif
-let g:loaded_zip= "v33"
-if v:version < 702
- echohl WarningMsg
- echo "***warning*** this version of zip needs vim 7.2 or later"
- echohl Normal
- finish
-endif
+let g:loaded_zip= "v34"
let s:keepcpo= &cpo
set cpo&vim
-"DechoTabOn
let s:zipfile_escape = ' ?&;\'
let s:ERROR = 2
@@ -58,8 +60,27 @@ if !exists("g:zip_extractcmd")
let g:zip_extractcmd= g:zip_unzipcmd
endif
+" ---------------------------------------------------------------------
+" required early
+" s:Mess: {{{2
+fun! s:Mess(group, msg)
+ redraw!
+ exe "echohl " . a:group
+ echomsg a:msg
+ echohl Normal
+endfun
+
+if v:version < 702
+ call s:Mess('WarningMsg', "***warning*** this version of zip needs vim 7.2 or later")
+ finish
+endif
+" sanity checks
+if !executable(g:zip_unzipcmd)
+ call s:Mess('Error', "***error*** (zip#Browse) unzip not available on your system")
+ finish
+endif
if !dist#vim#IsSafeExecutable('zip', g:zip_unzipcmd)
- echoerr "Warning: NOT executing " .. g:zip_unzipcmd .. " from current directory!"
+ call s:Mess('Error', "Warning: NOT executing " .. g:zip_unzipcmd .. " from current directory!")
finish
endif
@@ -70,47 +91,28 @@ endif
" ---------------------------------------------------------------------
" zip#Browse: {{{2
fun! zip#Browse(zipfile)
-" call Dfunc("zip#Browse(zipfile<".a:zipfile.">)")
- " sanity check: insure that the zipfile has "PK" as its first two letters
- " (zipped files have a leading PK as a "magic cookie")
- if !filereadable(a:zipfile) || readfile(a:zipfile, "", 1)[0] !~ '^PK'
- exe "noswapfile noautocmd noswapfile e ".fnameescape(a:zipfile)
-" call Dret("zip#Browse : not a zipfile<".a:zipfile.">")
+ " sanity check: ensure that the zipfile has "PK" as its first two letters
+ " (zip files have a leading PK as a "magic cookie")
+ if filereadable(a:zipfile) && readblob(a:zipfile, 0, 2) != 0z50.4B
+ exe "noswapfile noautocmd e " .. fnameescape(a:zipfile)
return
-" else " Decho
-" call Decho("zip#Browse: a:zipfile<".a:zipfile."> passed PK test - it's a zip file")
endif
- let repkeep= &report
- set report=10
+ let dict = s:SetSaneOpts()
+ defer s:RestoreOpts(dict)
" sanity checks
- if !exists("*fnameescape")
- if &verbose > 1
- echoerr "the zip plugin is not available (your vim doesn't support fnameescape())"
- endif
- return
- endif
if !executable(g:zip_unzipcmd)
- redraw!
- echohl Error | echo "***error*** (zip#Browse) unzip not available on your system"
-" call inputsave()|call input("Press <cr> to continue")|call inputrestore()
- let &report= repkeep
-" call Dret("zip#Browse")
+ call s:Mess('Error', "***error*** (zip#Browse) unzip not available on your system")
return
endif
if !filereadable(a:zipfile)
if a:zipfile !~# '^\a\+://'
" if it's an url, don't complain, let url-handlers such as vim do its thing
- redraw!
- echohl Error | echo "***error*** (zip#Browse) File not readable<".a:zipfile.">" | echohl None
-" call inputsave()|call input("Press <cr> to continue")|call inputrestore()
+ call s:Mess('Error', "***error*** (zip#Browse) File not readable <".a:zipfile.">")
endif
- let &report= repkeep
-" call Dret("zip#Browse : file<".a:zipfile."> not readable")
return
endif
-" call Decho("passed sanity checks")
if &ma != 1
set ma
endif
@@ -135,19 +137,15 @@ fun! zip#Browse(zipfile)
\ '" Select a file with cursor and press ENTER'])
keepj $
-" call Decho("exe silent r! ".g:zip_unzipcmd." -l -- ".s:Escape(a:zipfile,1))
- exe "keepj sil! r! ".g:zip_unzipcmd." -Z -1 -- ".s:Escape(a:zipfile,1)
+ exe $"keepj sil r! {g:zip_unzipcmd} -Z1 -- {s:Escape(a:zipfile, 1)}"
if v:shell_error != 0
- redraw!
- echohl WarningMsg | echo "***warning*** (zip#Browse) ".fnameescape(a:zipfile)." is not a zip file" | echohl None
-" call inputsave()|call input("Press <cr> to continue")|call inputrestore()
+ call s:Mess('WarningMsg', "***warning*** (zip#Browse) ".fnameescape(a:zipfile)." is not a zip file")
keepj sil! %d
let eikeep= &ei
set ei=BufReadCmd,FileReadCmd
exe "keepj r ".fnameescape(a:zipfile)
let &ei= eikeep
keepj 1d
-" call Dret("zip#Browse")
return
endif
@@ -159,64 +157,46 @@ fun! zip#Browse(zipfile)
noremap <silent> <buffer> <leftmouse> <leftmouse>:call <SID>ZipBrowseSelect()<cr>
endif
- let &report= repkeep
-" call Dret("zip#Browse")
endfun
" ---------------------------------------------------------------------
" ZipBrowseSelect: {{{2
fun! s:ZipBrowseSelect()
- " call Dfunc("ZipBrowseSelect() zipfile<".((exists("b:zipfile"))? b:zipfile : "n/a")."> curfile<".expand("%").">")
- let repkeep= &report
- set report=10
+ let dict = s:SetSaneOpts()
+ defer s:RestoreOpts(dict)
let fname= getline(".")
if !exists("b:zipfile")
-" call Dret("ZipBrowseSelect : b:zipfile doesn't exist!")
return
endif
" sanity check
if fname =~ '^"'
- let &report= repkeep
-" call Dret("ZipBrowseSelect")
return
endif
if fname =~ '/$'
- redraw!
- echohl Error | echo "***error*** (zip#Browse) Please specify a file, not a directory" | echohl None
-" call inputsave()|call input("Press <cr> to continue")|call inputrestore()
- let &report= repkeep
-" call Dret("ZipBrowseSelect")
+ call s:Mess('Error', "***error*** (zip#Browse) Please specify a file, not a directory")
return
endif
-" call Decho("fname<".fname.">")
-
" get zipfile to the new-window
let zipfile = b:zipfile
let curfile = expand("%")
-" call Decho("zipfile<".zipfile.">")
-" call Decho("curfile<".curfile.">")
noswapfile new
if !exists("g:zip_nomax") || g:zip_nomax == 0
wincmd _
endif
let s:zipfile_{winnr()}= curfile
-" call Decho("exe e ".fnameescape("zipfile://".zipfile.'::'.fname))
exe "noswapfile e ".fnameescape("zipfile://".zipfile.'::'.fname)
filetype detect
- let &report= repkeep
-" call Dret("ZipBrowseSelect : s:zipfile_".winnr()."<".s:zipfile_{winnr()}.">")
endfun
" ---------------------------------------------------------------------
" zip#Read: {{{2
fun! zip#Read(fname,mode)
-" call Dfunc("zip#Read(fname<".a:fname.">,mode=".a:mode.")")
- let repkeep= &report
- set report=10
+ let dict = s:SetSaneOpts()
+ defer s:RestoreOpts(dict)
if has("unix")
let zipfile = substitute(a:fname,'zipfile://\(.\{-}\)::[^\\].*$','\1','')
@@ -224,28 +204,20 @@ fun! zip#Read(fname,mode)
else
let zipfile = substitute(a:fname,'^.\{-}zipfile://\(.\{-}\)::[^\\].*$','\1','')
let fname = substitute(a:fname,'^.\{-}zipfile://.\{-}::\([^\\].*\)$','\1','')
- let fname = substitute(fname, '[', '[[]', 'g')
endif
-" call Decho("zipfile<".zipfile.">")
-" call Decho("fname <".fname.">")
+ let fname = fname->substitute('[', '[[]', 'g')->escape('?*\\')
" sanity check
if !executable(substitute(g:zip_unzipcmd,'\s\+.*$','',''))
- redraw!
- echohl Error | echo "***error*** (zip#Read) sorry, your system doesn't appear to have the ".g:zip_unzipcmd." program" | echohl None
-" call inputsave()|call input("Press <cr> to continue")|call inputrestore()
- let &report= repkeep
-" call Dret("zip#Write")
+ call s:Mess('Error', "***error*** (zip#Read) sorry, your system doesn't appear to have the ".g:zip_unzipcmd." program")
return
endif
" the following code does much the same thing as
- " exe "keepj sil! r! ".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1)
+ " exe "keepj sil! r! ".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fname,1)
" but allows zipfile://... entries in quickfix lists
let temp = tempname()
-" call Decho("using temp file<".temp.">")
let fn = expand('%:p')
- exe "sil! !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1).' > '.temp
-" call Decho("exe sil! !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1).' > '.temp)
+ exe "sil !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fname,1).' > '.temp
sil exe 'keepalt file '.temp
sil keepj e!
sil exe 'keepalt file '.fnameescape(fn)
@@ -254,62 +226,44 @@ fun! zip#Read(fname,mode)
filetype detect
" cleanup
- " keepj 0d " used to be needed for the ...r! ... method
set nomod
- let &report= repkeep
-" call Dret("zip#Read")
endfun
" ---------------------------------------------------------------------
" zip#Write: {{{2
fun! zip#Write(fname)
-" call Dfunc("zip#Write(fname<".a:fname.">) zipfile_".winnr()."<".s:zipfile_{winnr()}.">")
- let repkeep= &report
- set report=10
+ let dict = s:SetSaneOpts()
+ defer s:RestoreOpts(dict)
" sanity checks
if !executable(substitute(g:zip_zipcmd,'\s\+.*$','',''))
- redraw!
- echohl Error | echo "***error*** (zip#Write) sorry, your system doesn't appear to have the ".g:zip_zipcmd." program" | echohl None
-" call inputsave()|call input("Press <cr> to continue")|call inputrestore()
- let &report= repkeep
-" call Dret("zip#Write")
+ call s:Mess('Error', "***error*** (zip#Write) sorry, your system doesn't appear to have the ".g:zip_zipcmd." program")
return
endif
if !exists("*mkdir")
- redraw!
- echohl Error | echo "***error*** (zip#Write) sorry, mkdir() doesn't work on your system" | echohl None
-" call inputsave()|call input("Press <cr> to continue")|call inputrestore()
- let &report= repkeep
-" call Dret("zip#Write")
+ call s:Mess('Error', "***error*** (zip#Write) sorry, mkdir() doesn't work on your system")
return
endif
let curdir= getcwd()
let tmpdir= tempname()
-" call Decho("orig tempname<".tmpdir.">")
if tmpdir =~ '\.'
let tmpdir= substitute(tmpdir,'\.[^.]*$','','e')
endif
-" call Decho("tmpdir<".tmpdir.">")
call mkdir(tmpdir,"p")
" attempt to change to the indicated directory
if s:ChgDir(tmpdir,s:ERROR,"(zip#Write) cannot cd to temporary directory")
- let &report= repkeep
-" call Dret("zip#Write")
return
endif
-" call Decho("current directory now: ".getcwd())
" place temporary files under .../_ZIPVIM_/
if isdirectory("_ZIPVIM_")
- call s:Rmdir("_ZIPVIM_")
+ call delete("_ZIPVIM_", "rf")
endif
call mkdir("_ZIPVIM_")
cd _ZIPVIM_
-" call Decho("current directory now: ".getcwd())
if has("unix")
let zipfile = substitute(a:fname,'zipfile://\(.\{-}\)::[^\\].*$','\1','')
@@ -318,21 +272,17 @@ fun! zip#Write(fname)
let zipfile = substitute(a:fname,'^.\{-}zipfile://\(.\{-}\)::[^\\].*$','\1','')
let fname = substitute(a:fname,'^.\{-}zipfile://.\{-}::\([^\\].*\)$','\1','')
endif
-" call Decho("zipfile<".zipfile.">")
-" call Decho("fname <".fname.">")
if fname =~ '/'
let dirpath = substitute(fname,'/[^/]\+$','','e')
if has("win32unix") && executable("cygpath")
let dirpath = substitute(system("cygpath ".s:Escape(dirpath,0)),'\n','','e')
endif
-" call Decho("mkdir(dirpath<".dirpath.">,p)")
call mkdir(dirpath,"p")
endif
if zipfile !~ '/'
let zipfile= curdir.'/'.zipfile
endif
-" call Decho("zipfile<".zipfile."> fname<".fname.">")
exe "w! ".fnameescape(fname)
if has("win32unix") && executable("cygpath")
@@ -343,17 +293,13 @@ fun! zip#Write(fname)
let fname = substitute(fname, '[', '[[]', 'g')
endif
-" call Decho(g:zip_zipcmd." -u ".s:Escape(fnamemodify(zipfile,":p"),0)." ".s:Escape(fname,0))
call system(g:zip_zipcmd." -u ".s:Escape(fnamemodify(zipfile,":p"),0)." ".s:Escape(fname,0))
if v:shell_error != 0
- redraw!
- echohl Error | echo "***error*** (zip#Write) sorry, unable to update ".zipfile." with ".fname | echohl None
-" call inputsave()|call input("Press <cr> to continue")|call inputrestore()
+ call s:Mess('Error', "***error*** (zip#Write) sorry, unable to update ".zipfile." with ".fname)
elseif s:zipfile_{winnr()} =~ '^\a\+://'
" support writing zipfiles across a network
let netzipfile= s:zipfile_{winnr()}
-" call Decho("handle writing <".zipfile."> across network as <".netzipfile.">")
1split|enew
let binkeep= &binary
let eikeep = &ei
@@ -365,64 +311,63 @@ fun! zip#Write(fname)
q!
unlet s:zipfile_{winnr()}
endif
-
+
" cleanup and restore current directory
cd ..
- call s:Rmdir("_ZIPVIM_")
+ call delete("_ZIPVIM_", "rf")
call s:ChgDir(curdir,s:WARNING,"(zip#Write) unable to return to ".curdir."!")
- call s:Rmdir(tmpdir)
+ call delete(tmpdir, "rf")
setlocal nomod
- let &report= repkeep
-" call Dret("zip#Write")
endfun
" ---------------------------------------------------------------------
" zip#Extract: extract a file from a zip archive {{{2
fun! zip#Extract()
-" call Dfunc("zip#Extract()")
- let repkeep= &report
- set report=10
+ let dict = s:SetSaneOpts()
+ defer s:RestoreOpts(dict)
let fname= getline(".")
-" call Decho("fname<".fname.">")
" sanity check
if fname =~ '^"'
- let &report= repkeep
-" call Dret("zip#Extract")
return
endif
if fname =~ '/$'
- redraw!
- echohl Error | echo "***error*** (zip#Extract) Please specify a file, not a directory" | echohl None
- let &report= repkeep
-" call Dret("zip#Extract")
+ call s:Mess('Error', "***error*** (zip#Extract) Please specify a file, not a directory")
return
endif
+ if filereadable(fname)
+ call s:Mess('Error', "***error*** (zip#Extract) <" .. fname .."> already exists in directory, not overwriting!")
+ return
+ endif
+ let target = fname->substitute('\[', '[[]', 'g')
+ if &shell =~ 'cmd' && has("win32")
+ let target = target
+ \ ->substitute('[?*]', '[&]', 'g')
+ \ ->substitute('[\\]', '?', 'g')
+ \ ->shellescape()
+ " there cannot be a file name with '\' in its name, unzip replaces it by _
+ let fname = fname->substitute('[\\?*]', '_', 'g')
+ else
+ let target = target->escape('*?\\')->shellescape()
+ endif
" extract the file mentioned under the cursor
-" call Decho("system(".g:zip_extractcmd." ".shellescape(b:zipfile)." ".shellescape(shell).")")
- call system(g:zip_extractcmd." ".shellescape(b:zipfile)." ".shellescape(shell))
-" call Decho("zipfile<".b:zipfile.">")
+ call system($"{g:zip_extractcmd} -o {shellescape(b:zipfile)} {target}")
if v:shell_error != 0
- echohl Error | echo "***error*** ".g:zip_extractcmd." ".b:zipfile." ".fname.": failed!" | echohl NONE
+ call s:Mess('Error', "***error*** ".g:zip_extractcmd." ".b:zipfile." ".fname.": failed!")
elseif !filereadable(fname)
- echohl Error | echo "***error*** attempted to extract ".fname." but it doesn't appear to be present!"
+ call s:Mess('Error', "***error*** attempted to extract ".fname." but it doesn't appear to be present!")
else
- echo "***note*** successfully extracted ".fname
+ echomsg "***note*** successfully extracted ".fname
endif
- " restore option
- let &report= repkeep
-
-" call Dret("zip#Extract")
endfun
" ---------------------------------------------------------------------
" s:Escape: {{{2
fun! s:Escape(fname,isfilt)
-" call Dfunc("QuoteFileDir(fname<".a:fname."> isfilt=".a:isfilt.")")
if exists("*shellescape")
if a:isfilt
let qnameq= shellescape(a:fname,1)
@@ -432,45 +377,48 @@ fun! s:Escape(fname,isfilt)
else
let qnameq= g:zip_shq.escape(a:fname,g:zip_shq).g:zip_shq
endif
-" call Dret("QuoteFileDir <".qnameq.">")
return qnameq
endfun
" ---------------------------------------------------------------------
-" ChgDir: {{{2
+" s:ChgDir: {{{2
fun! s:ChgDir(newdir,errlvl,errmsg)
-" call Dfunc("ChgDir(newdir<".a:newdir."> errlvl=".a:errlvl." errmsg<".a:errmsg.">)")
-
try
exe "cd ".fnameescape(a:newdir)
catch /^Vim\%((\a\+)\)\=:E344/
redraw!
if a:errlvl == s:NOTE
- echo "***note*** ".a:errmsg
+ echomsg "***note*** ".a:errmsg
elseif a:errlvl == s:WARNING
- echohl WarningMsg | echo "***warning*** ".a:errmsg | echohl NONE
+ call s:Mess("WarningMsg", "***warning*** ".a:errmsg)
elseif a:errlvl == s:ERROR
- echohl Error | echo "***error*** ".a:errmsg | echohl NONE
+ call s:Mess("Error", "***error*** ".a:errmsg)
endif
-" call inputsave()|call input("Press <cr> to continue")|call inputrestore()
-" call Dret("ChgDir 1")
return 1
endtry
-" call Dret("ChgDir 0")
return 0
endfun
" ---------------------------------------------------------------------
-" s:Rmdir: {{{2
-fun! s:Rmdir(fname)
-" call Dfunc("Rmdir(fname<".a:fname.">)")
- if (has("win32") || has("win95") || has("win64") || has("win16")) && &shell !~? 'sh$'
- call system("rmdir /S/Q ".s:Escape(a:fname,0))
- else
- call system("/bin/rm -rf ".s:Escape(a:fname,0))
- endif
-" call Dret("Rmdir")
+" s:SetSaneOpts: {{{2
+fun! s:SetSaneOpts()
+ let dict = {}
+ let dict.report = &report
+ let dict.shellslash = &shellslash
+
+ let &report = 10
+ let &shellslash = 0
+
+ return dict
+endfun
+
+" ---------------------------------------------------------------------
+" s:RestoreOpts: {{{2
+fun! s:RestoreOpts(dict)
+ for [key, val] in items(a:dict)
+ exe $"let &{key} = {val}"
+ endfor
endfun
" ------------------------------------------------------------------------
diff --git a/runtime/colors/blue.vim b/runtime/colors/blue.vim
index d6931e4c71..9ee878e103 100644
--- a/runtime/colors/blue.vim
+++ b/runtime/colors/blue.vim
@@ -4,7 +4,7 @@
" Maintainer: Original maintainer Steven Vertigan <steven@vertigan.wattle.id.au>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Mon 08 Jan 2024 09:42:49 AM AEDT
+" Last Change: 2024 Aug 15
" Generated by Colortemplate v2.2.3
@@ -27,9 +27,11 @@ hi Normal guifg=#ffd700 guibg=#000087 gui=NONE cterm=NONE
hi CursorLine guifg=NONE guibg=#005faf gui=NONE cterm=NONE
hi Pmenu guifg=#ffffff guibg=#008787 gui=NONE cterm=NONE
hi PmenuSel guifg=#008787 guibg=#ffffff gui=NONE cterm=NONE
+hi PmenuMatch guifg=#ffd700 guibg=#008787 gui=NONE cterm=NONE
+hi PmenuMatchSel guifg=#ff7f50 guibg=#ffffff gui=NONE cterm=NONE
hi QuickFixLine guifg=#000000 guibg=#d787d7 gui=NONE cterm=NONE
hi ColorColumn guifg=NONE guibg=#870087 gui=NONE cterm=NONE
-hi Conceal guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi Conceal guifg=#008787 guibg=NONE gui=NONE cterm=NONE
hi Cursor guifg=#000000 guibg=#00ff00 gui=NONE cterm=NONE
hi CursorColumn guifg=NONE guibg=#005faf gui=NONE cterm=NONE
hi CursorIM guifg=#000000 guibg=#ffd700 gui=NONE cterm=NONE
@@ -137,9 +139,11 @@ if s:t_Co >= 256
hi CursorLine ctermfg=NONE ctermbg=25 cterm=NONE
hi Pmenu ctermfg=231 ctermbg=30 cterm=NONE
hi PmenuSel ctermfg=30 ctermbg=231 cterm=NONE
+ hi PmenuMatch ctermfg=220 ctermbg=30 cterm=NONE
+ hi PmenuMatchSel ctermfg=209 ctermbg=231 cterm=NONE
hi QuickFixLine ctermfg=16 ctermbg=176 cterm=NONE
hi ColorColumn ctermfg=NONE ctermbg=90 cterm=NONE
- hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=30 ctermbg=NONE cterm=NONE
hi Cursor ctermfg=16 ctermbg=46 cterm=NONE
hi CursorColumn ctermfg=NONE ctermbg=25 cterm=NONE
hi CursorIM ctermfg=16 ctermbg=220 cterm=NONE
@@ -250,9 +254,11 @@ if s:t_Co >= 16
hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
hi Pmenu ctermfg=black ctermbg=darkcyan cterm=NONE
hi PmenuSel ctermfg=black ctermbg=white cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=darkcyan cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=white cterm=bold
hi QuickFixLine ctermfg=black ctermbg=magenta cterm=NONE
hi ColorColumn ctermfg=NONE ctermbg=darkmagenta cterm=NONE
- hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=darkcyan ctermbg=NONE cterm=NONE
hi Cursor ctermfg=black ctermbg=green cterm=NONE
hi CursorColumn ctermfg=NONE ctermbg=blue cterm=NONE
hi CursorIM ctermfg=black ctermbg=yellow cterm=NONE
@@ -363,6 +369,8 @@ if s:t_Co >= 8
hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
hi Pmenu ctermfg=black ctermbg=cyan cterm=NONE
hi PmenuSel ctermfg=black ctermbg=gray cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=cyan cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=gray cterm=bold
hi QuickFixLine ctermfg=black ctermbg=magenta cterm=NONE
hi ColorColumn ctermfg=NONE ctermbg=magenta cterm=NONE
hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
diff --git a/runtime/colors/darkblue.vim b/runtime/colors/darkblue.vim
index 471b8561fb..9451e397e5 100644
--- a/runtime/colors/darkblue.vim
+++ b/runtime/colors/darkblue.vim
@@ -4,7 +4,7 @@
" Maintainer: Original author Bohdan Vlasyuk <bohdan@vstu.edu.ua>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Mon 08 Jan 2024 09:43:03 AM AEDT
+" Last Change: 2024 Aug 15
" Generated by Colortemplate v2.2.3
@@ -73,7 +73,7 @@ hi! link CurSearch Search
hi! link MessageWindow Pmenu
hi! link PopupNotification Todo
hi Normal guifg=#c0c0c0 guibg=#000040 gui=NONE cterm=NONE
-hi Conceal guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi Conceal guifg=#008b8b guibg=NONE gui=NONE cterm=NONE
hi ColorColumn guifg=#c0c0c0 guibg=#8b0000 gui=NONE cterm=NONE
hi Cursor guifg=#000000 guibg=#ffff60 gui=NONE cterm=NONE
hi QuickFixLine guifg=#000000 guibg=#ff80ff gui=NONE cterm=NONE
@@ -90,6 +90,8 @@ hi Pmenu guifg=#ffffff guibg=#0030ff gui=NONE cterm=NONE
hi PmenuSbar guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuSel guifg=#0030ff guibg=#ffffff gui=NONE cterm=NONE
hi PmenuThumb guifg=NONE guibg=#ffffff gui=NONE cterm=NONE
+hi PmenuMatch guifg=#ff80ff guibg=#0030ff gui=NONE cterm=NONE
+hi PmenuMatchSel guifg=#ff00ff guibg=#ffffff gui=NONE cterm=NONE
hi Question guifg=#90f020 guibg=NONE gui=NONE cterm=NONE
hi SignColumn guifg=#808080 guibg=NONE gui=NONE cterm=NONE
hi SpecialKey guifg=#008b8b guibg=NONE gui=NONE cterm=NONE
@@ -181,7 +183,7 @@ if s:t_Co >= 256
hi! link MessageWindow Pmenu
hi! link PopupNotification Todo
hi Normal ctermfg=252 ctermbg=17 cterm=NONE
- hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=30 ctermbg=NONE cterm=NONE
hi ColorColumn ctermfg=252 ctermbg=88 cterm=NONE
hi Cursor ctermfg=16 ctermbg=227 cterm=NONE
hi QuickFixLine ctermfg=16 ctermbg=213 cterm=NONE
@@ -198,6 +200,8 @@ if s:t_Co >= 256
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuSel ctermfg=27 ctermbg=231 cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=231 cterm=NONE
+ hi PmenuMatch ctermfg=213 ctermbg=27 cterm=NONE
+ hi PmenuMatchSel ctermfg=201 ctermbg=231 cterm=NONE
hi Question ctermfg=118 ctermbg=NONE cterm=NONE
hi SignColumn ctermfg=102 ctermbg=NONE cterm=NONE
hi SpecialKey ctermfg=30 ctermbg=NONE cterm=NONE
@@ -243,7 +247,7 @@ endif
if s:t_Co >= 16
hi Normal ctermfg=grey ctermbg=black cterm=NONE
- hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=darkcyan ctermbg=NONE cterm=NONE
hi ColorColumn ctermfg=grey ctermbg=darkred cterm=NONE
hi Cursor ctermfg=black ctermbg=yellow cterm=NONE
hi QuickFixLine ctermfg=black ctermbg=magenta cterm=NONE
@@ -260,6 +264,8 @@ if s:t_Co >= 16
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuSel ctermfg=blue ctermbg=white cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=white cterm=NONE
+ hi PmenuMatch ctermfg=magenta ctermbg=blue cterm=NONE
+ hi PmenuMatchSel ctermfg=darkmagenta ctermbg=white cterm=NONE
hi Question ctermfg=green ctermbg=NONE cterm=NONE
hi SignColumn ctermfg=darkgrey ctermbg=NONE cterm=NONE
hi SpecialKey ctermfg=darkcyan ctermbg=NONE cterm=NONE
@@ -323,6 +329,8 @@ if s:t_Co >= 8
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuSel ctermfg=blue ctermbg=grey cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=grey cterm=NONE
+ hi PmenuMatch ctermfg=grey ctermbg=blue cterm=bold
+ hi PmenuMatchSel ctermfg=blue ctermbg=grey cterm=bold
hi Question ctermfg=darkgreen ctermbg=NONE cterm=bold
hi Search ctermfg=darkcyan ctermbg=blue cterm=NONE
hi SignColumn ctermfg=grey ctermbg=NONE cterm=NONE
diff --git a/runtime/colors/delek.vim b/runtime/colors/delek.vim
index 1919526760..35d4934f5c 100644
--- a/runtime/colors/delek.vim
+++ b/runtime/colors/delek.vim
@@ -4,7 +4,7 @@
" Maintainer: Original maintainer David Schweikert <david@schweikert.ch>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 15 Dec 2023 20:05:34
+" Last Change: 2024 Aug 15
" Generated by Colortemplate v2.2.3
@@ -43,6 +43,8 @@ hi Pmenu guifg=#000000 guibg=#add8e6 gui=NONE cterm=NONE
hi PmenuSel guifg=#ffffff guibg=#00008b gui=NONE cterm=NONE
hi PmenuSbar guifg=NONE guibg=#ffffff gui=NONE cterm=NONE
hi PmenuThumb guifg=NONE guibg=#008b8b gui=NONE cterm=NONE
+hi PmenuMatch guifg=#cd00cd guibg=#add8e6 gui=NONE cterm=NONE
+hi PmenuMatchSel guifg=#ff87ff guibg=#00008b gui=NONE cterm=NONE
hi TabLine guifg=#000000 guibg=#e4e4e4 gui=NONE cterm=NONE
hi TabLineFill guifg=NONE guibg=#bcbcbc gui=NONE cterm=NONE
hi TabLineSel guifg=#000000 guibg=#ffffff gui=bold cterm=bold
@@ -50,6 +52,7 @@ hi ToolbarLine guifg=NONE guibg=#e4e4e4 gui=NONE cterm=NONE
hi ToolbarButton guifg=#ffffff guibg=#bcbcbc gui=bold cterm=bold
hi NonText guifg=#bcbcbc guibg=NONE gui=NONE cterm=NONE
hi SpecialKey guifg=#bcbcbc guibg=NONE gui=NONE cterm=NONE
+hi Conceal guifg=#bcbcbc guibg=NONE gui=NONE cterm=NONE
hi Folded guifg=#00008b guibg=#e4e4e4 gui=NONE cterm=NONE
hi Visual guifg=#000000 guibg=#d0d0d0 gui=NONE cterm=NONE
hi VisualNOS guifg=NONE guibg=#ee0000 gui=NONE cterm=NONE
@@ -87,7 +90,6 @@ hi PreProc guifg=#cd00cd guibg=NONE gui=NONE cterm=NONE
hi Type guifg=#0000ff guibg=NONE gui=bold cterm=bold
hi Special guifg=#ff1493 guibg=NONE gui=NONE cterm=NONE
hi Directory guifg=#008b8b guibg=NONE gui=bold cterm=bold
-hi Conceal guifg=#ee0000 guibg=NONE gui=NONE cterm=NONE
hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi Title guifg=#cd00cd guibg=NONE gui=bold cterm=bold
hi CursorLine guifg=NONE guibg=#e4e4e4 gui=NONE cterm=NONE
@@ -117,6 +119,8 @@ if s:t_Co >= 256
hi PmenuSel ctermfg=231 ctermbg=18 cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=231 cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=30 cterm=NONE
+ hi PmenuMatch ctermfg=164 ctermbg=152 cterm=NONE
+ hi PmenuMatchSel ctermfg=213 ctermbg=18 cterm=NONE
hi TabLine ctermfg=16 ctermbg=254 cterm=NONE
hi TabLineFill ctermfg=NONE ctermbg=250 cterm=NONE
hi TabLineSel ctermfg=16 ctermbg=231 cterm=bold
@@ -124,6 +128,7 @@ if s:t_Co >= 256
hi ToolbarButton ctermfg=231 ctermbg=250 cterm=bold
hi NonText ctermfg=250 ctermbg=NONE cterm=NONE
hi SpecialKey ctermfg=250 ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=250 ctermbg=NONE cterm=NONE
hi Folded ctermfg=18 ctermbg=254 cterm=NONE
hi Visual ctermfg=16 ctermbg=252 cterm=NONE
hi VisualNOS ctermfg=NONE ctermbg=196 cterm=NONE
@@ -161,7 +166,6 @@ if s:t_Co >= 256
hi Type ctermfg=21 ctermbg=NONE cterm=bold
hi Special ctermfg=198 ctermbg=NONE cterm=NONE
hi Directory ctermfg=30 ctermbg=NONE cterm=bold
- hi Conceal ctermfg=196 ctermbg=NONE cterm=NONE
hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
hi Title ctermfg=164 ctermbg=NONE cterm=bold
hi CursorLine ctermfg=NONE ctermbg=254 cterm=NONE
@@ -185,6 +189,8 @@ if s:t_Co >= 16
hi PmenuSel ctermfg=white ctermbg=darkblue cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=white cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=darkcyan cterm=NONE
+ hi PmenuMatch ctermfg=darkmagenta ctermbg=grey cterm=NONE
+ hi PmenuMatchSel ctermfg=magenta ctermbg=darkblue cterm=NONE
hi TabLine ctermfg=black ctermbg=grey cterm=NONE
hi TabLineFill ctermfg=NONE ctermbg=darkgrey cterm=NONE
hi TabLineSel ctermfg=black ctermbg=white cterm=bold
@@ -192,6 +198,7 @@ if s:t_Co >= 16
hi ToolbarButton ctermfg=white ctermbg=darkgrey cterm=bold
hi NonText ctermfg=darkgrey ctermbg=NONE cterm=NONE
hi SpecialKey ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=darkgrey ctermbg=NONE cterm=NONE
hi Folded ctermfg=darkblue ctermbg=grey cterm=NONE
hi Visual ctermfg=black ctermbg=darkgrey cterm=NONE
hi VisualNOS ctermfg=NONE ctermbg=darkred cterm=NONE
@@ -229,7 +236,6 @@ if s:t_Co >= 16
hi Type ctermfg=blue ctermbg=NONE cterm=bold
hi Special ctermfg=magenta ctermbg=NONE cterm=NONE
hi Directory ctermfg=darkcyan ctermbg=NONE cterm=bold
- hi Conceal ctermfg=darkred ctermbg=NONE cterm=NONE
hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
hi Title ctermfg=darkmagenta ctermbg=NONE cterm=bold
hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
@@ -254,6 +260,8 @@ if s:t_Co >= 8
hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=darkgreen cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=darkcyan cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold
hi TabLine ctermfg=gray ctermbg=black cterm=NONE
hi TabLineFill ctermfg=NONE ctermbg=black cterm=NONE
hi TabLineSel ctermfg=black ctermbg=gray cterm=NONE
@@ -261,6 +269,7 @@ if s:t_Co >= 8
hi ToolbarButton ctermfg=black ctermbg=gray cterm=bold,reverse
hi NonText ctermfg=darkblue ctermbg=NONE cterm=NONE
hi SpecialKey ctermfg=darkblue ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
hi Folded ctermfg=darkyellow ctermbg=NONE cterm=NONE
hi Visual ctermfg=NONE ctermbg=NONE cterm=reverse
hi VisualNOS ctermfg=NONE ctermbg=NONE cterm=underline
@@ -296,7 +305,6 @@ if s:t_Co >= 8
hi Type ctermfg=darkblue ctermbg=NONE cterm=NONE
hi Special ctermfg=darkmagenta ctermbg=NONE cterm=bold
hi Directory ctermfg=darkcyan ctermbg=NONE cterm=bold
- hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
hi Title ctermfg=darkmagenta ctermbg=NONE cterm=bold
hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
@@ -403,6 +411,7 @@ endif
" Color: darkmagenta #870087 18 darkmagenta
" Color: darkcyan #008787 30 darkcyan
" Color: gray #878787 102 gray
+" Color: magenta #ff87ff 213 magenta
" Term colors: bg0 statement constant preproc identifier type special bg1
" Term colors: comment statement constant preproc identifier type special fg0
" Color: bgDiffA #5F875F 65 darkgreen
diff --git a/runtime/colors/desert.vim b/runtime/colors/desert.vim
index 453e966899..07ef937ab6 100644
--- a/runtime/colors/desert.vim
+++ b/runtime/colors/desert.vim
@@ -4,7 +4,7 @@
" Maintainer: Original maintainer Hans Fugal <hans@fugal.net>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 15 Dec 2023 20:05:34
+" Last Change: 2024 Aug 15
" Generated by Colortemplate v2.2.3
@@ -42,6 +42,8 @@ hi Pmenu guifg=#ffffff guibg=#666666 gui=NONE cterm=NONE
hi PmenuSel guifg=#333333 guibg=#f0e68c gui=NONE cterm=NONE
hi PmenuSbar guifg=NONE guibg=#333333 gui=NONE cterm=NONE
hi PmenuThumb guifg=NONE guibg=#c2bfa5 gui=NONE cterm=NONE
+hi PmenuMatch guifg=#ffa0a0 guibg=#666666 gui=NONE cterm=NONE
+hi PmenuMatchSel guifg=#cd5c5c guibg=#f0e68c gui=NONE cterm=NONE
hi TabLine guifg=#333333 guibg=#c2bfa5 gui=NONE cterm=NONE
hi TabLineFill guifg=NONE guibg=#c2bfa5 gui=NONE cterm=NONE
hi TabLineSel guifg=#333333 guibg=#f0e68c gui=NONE cterm=NONE
@@ -116,6 +118,8 @@ if s:t_Co >= 256
hi PmenuSel ctermfg=236 ctermbg=186 cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=236 cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=144 cterm=NONE
+ hi PmenuMatch ctermfg=217 ctermbg=241 cterm=NONE
+ hi PmenuMatchSel ctermfg=167 ctermbg=186 cterm=NONE
hi TabLine ctermfg=236 ctermbg=144 cterm=NONE
hi TabLineFill ctermfg=NONE ctermbg=144 cterm=NONE
hi TabLineSel ctermfg=236 ctermbg=186 cterm=NONE
@@ -182,6 +186,8 @@ if s:t_Co >= 16
hi PmenuSel ctermfg=black ctermbg=yellow cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=white cterm=NONE
+ hi PmenuMatch ctermfg=NONE ctermbg=darkgrey cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=yellow cterm=bold
hi TabLine ctermfg=black ctermbg=grey cterm=NONE
hi TabLineFill ctermfg=NONE ctermbg=white cterm=NONE
hi TabLineSel ctermfg=white ctermbg=black cterm=NONE
@@ -248,6 +254,8 @@ if s:t_Co >= 8
hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=grey cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=darkcyan cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold
hi TabLine ctermfg=black ctermbg=grey cterm=NONE
hi TabLineFill ctermfg=NONE ctermbg=grey cterm=NONE
hi TabLineSel ctermfg=grey ctermbg=black cterm=NONE
diff --git a/runtime/colors/elflord.vim b/runtime/colors/elflord.vim
index 001368861f..355e161a46 100644
--- a/runtime/colors/elflord.vim
+++ b/runtime/colors/elflord.vim
@@ -3,7 +3,7 @@
" Maintainer: original maintainer Ron Aaron <ron@ronware.org>
" Website: https://www.github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 15 Dec 2023 20:05:35
+" Last Change: 2024 Aug 15
" Generated by Colortemplate v2.2.3
@@ -77,6 +77,8 @@ hi Pmenu guifg=#ffffff guibg=#444444 gui=NONE cterm=NONE
hi PmenuSbar guifg=NONE guibg=#bebebe gui=NONE cterm=NONE
hi PmenuSel guifg=#000000 guibg=#00cdcd gui=NONE cterm=NONE
hi PmenuThumb guifg=NONE guibg=#ffffff gui=NONE cterm=NONE
+hi PmenuMatch guifg=#ff00ff guibg=#444444 gui=bold cterm=bold
+hi PmenuMatchSel guifg=#ff00ff guibg=#00cdcd gui=bold cterm=bold
hi Question guifg=#00ff00 guibg=NONE gui=bold cterm=bold
hi Search guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE
hi SignColumn guifg=#00ffff guibg=NONE gui=NONE cterm=NONE
@@ -145,6 +147,8 @@ if s:t_Co >= 256
hi PmenuSbar ctermfg=NONE ctermbg=250 cterm=NONE
hi PmenuSel ctermfg=16 ctermbg=44 cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=231 cterm=NONE
+ hi PmenuMatch ctermfg=201 ctermbg=238 cterm=bold
+ hi PmenuMatchSel ctermfg=201 ctermbg=44 cterm=bold
hi Question ctermfg=46 ctermbg=NONE cterm=bold
hi Search ctermfg=16 ctermbg=226 cterm=NONE
hi SignColumn ctermfg=51 ctermbg=NONE cterm=NONE
@@ -216,6 +220,8 @@ if s:t_Co >= 16
hi PmenuSbar ctermfg=NONE ctermbg=grey cterm=NONE
hi PmenuSel ctermfg=black ctermbg=darkcyan cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=white cterm=NONE
+ hi PmenuMatch ctermfg=magenta ctermbg=darkgrey cterm=bold
+ hi PmenuMatchSel ctermfg=magenta ctermbg=darkcyan cterm=bold
hi Question ctermfg=green ctermbg=NONE cterm=bold
hi Search ctermfg=black ctermbg=yellow cterm=NONE
hi SignColumn ctermfg=cyan ctermbg=NONE cterm=NONE
@@ -286,6 +292,8 @@ if s:t_Co >= 8
hi PmenuSbar ctermfg=grey ctermbg=grey cterm=NONE
hi PmenuSel ctermfg=black ctermbg=darkcyan cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=darkcyan cterm=NONE
+ hi PmenuMatch ctermfg=grey ctermbg=NONE cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkcyan cterm=bold
hi Question ctermfg=darkgreen ctermbg=NONE cterm=NONE
hi Search ctermfg=black ctermbg=darkyellow cterm=NONE
hi SignColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
diff --git a/runtime/colors/evening.vim b/runtime/colors/evening.vim
index 1abdd8006f..d5e081337a 100644
--- a/runtime/colors/evening.vim
+++ b/runtime/colors/evening.vim
@@ -4,7 +4,7 @@
" Maintainer: Original maintainer Steven Vertigan <steven@vertigan.wattle.id.au>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Mon 08 Jan 2024 09:43:27 AM AEDT
+" Last Change: 2024 Aug 15
" Generated by Colortemplate v2.2.3
@@ -80,6 +80,8 @@ hi StatusLine guifg=#333333 guibg=#ffffff gui=bold cterm=bold
hi StatusLineNC guifg=#333333 guibg=#d3d3d3 gui=NONE cterm=NONE
hi TabLineSel guifg=#333333 guibg=#ffffff gui=bold cterm=bold
hi TabLine guifg=#333333 guibg=#d3d3d3 gui=NONE cterm=NONE
+hi PmenuMatch guifg=#ff80ff guibg=#4d4d4d gui=NONE cterm=NONE
+hi PmenuMatchSel guifg=#8b008b guibg=#bebebe gui=NONE cterm=NONE
hi Pmenu guifg=#ffffff guibg=#4d4d4d gui=NONE cterm=NONE
hi PmenuSbar guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuSel guifg=#000000 guibg=#bebebe gui=NONE cterm=NONE
@@ -89,7 +91,7 @@ hi Cursor guifg=#000000 guibg=#00ff00 gui=NONE cterm=NONE
hi Error guifg=#ff0000 guibg=#ffffff gui=reverse cterm=reverse
hi ErrorMsg guifg=#ffffff guibg=#ff0000 gui=NONE cterm=NONE
hi LineNr guifg=#ffff00 guibg=NONE gui=NONE cterm=NONE
-hi Conceal guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+hi Conceal guifg=#666666 guibg=NONE gui=NONE cterm=NONE
hi FoldColumn guifg=#add8e6 guibg=NONE gui=NONE cterm=NONE
hi Folded guifg=#00008b guibg=#d3d3d3 gui=bold cterm=bold
hi IncSearch guifg=#00ff00 guibg=NONE gui=reverse cterm=reverse
@@ -188,6 +190,8 @@ if s:t_Co >= 256
hi StatusLineNC ctermfg=236 ctermbg=252 cterm=NONE
hi TabLineSel ctermfg=236 ctermbg=231 cterm=bold
hi TabLine ctermfg=236 ctermbg=252 cterm=NONE
+ hi PmenuMatch ctermfg=201 ctermbg=239 cterm=NONE
+ hi PmenuMatchSel ctermfg=90 ctermbg=250 cterm=NONE
hi Pmenu ctermfg=231 ctermbg=239 cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuSel ctermfg=16 ctermbg=250 cterm=NONE
@@ -197,7 +201,7 @@ if s:t_Co >= 256
hi Error ctermfg=196 ctermbg=231 cterm=reverse
hi ErrorMsg ctermfg=231 ctermbg=196 cterm=NONE
hi LineNr ctermfg=226 ctermbg=NONE cterm=NONE
- hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=241 ctermbg=NONE cterm=NONE
hi FoldColumn ctermfg=153 ctermbg=NONE cterm=NONE
hi Folded ctermfg=18 ctermbg=252 cterm=bold
hi IncSearch ctermfg=46 ctermbg=NONE cterm=reverse
@@ -299,6 +303,8 @@ if s:t_Co >= 16
hi StatusLineNC ctermfg=black ctermbg=gray cterm=NONE
hi TabLineSel ctermfg=black ctermbg=white cterm=NONE
hi TabLine ctermfg=black ctermbg=gray cterm=NONE
+ hi PmenuMatch ctermfg=white ctermbg=darkgray cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=gray cterm=bold
hi Pmenu ctermfg=white ctermbg=darkgray cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuSel ctermfg=black ctermbg=gray cterm=NONE
@@ -308,7 +314,7 @@ if s:t_Co >= 16
hi Error ctermfg=red ctermbg=white cterm=reverse
hi ErrorMsg ctermfg=white ctermbg=red cterm=NONE
hi LineNr ctermfg=darkyellow ctermbg=NONE cterm=NONE
- hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=darkgray ctermbg=NONE cterm=NONE
hi FoldColumn ctermfg=lightblue ctermbg=NONE cterm=NONE
hi Folded ctermfg=darkblue ctermbg=gray cterm=bold
hi IncSearch ctermfg=green ctermbg=NONE cterm=reverse
@@ -366,6 +372,8 @@ if s:t_Co >= 8
hi PmenuSbar ctermfg=NONE ctermbg=gray cterm=NONE
hi PmenuSel ctermfg=black ctermbg=gray cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=black cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=darkcyan cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=gray cterm=bold
hi QuickFixLine ctermfg=gray ctermbg=darkmagenta cterm=NONE
hi Error ctermfg=red ctermbg=gray cterm=reverse
hi ErrorMsg ctermfg=gray ctermbg=red cterm=NONE
diff --git a/runtime/colors/habamax.vim b/runtime/colors/habamax.vim
index 66f40ab56a..4b4c95e050 100644
--- a/runtime/colors/habamax.vim
+++ b/runtime/colors/habamax.vim
@@ -4,7 +4,7 @@
" Maintainer: Maxim Kim <habamax@gmail.com>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Mon 08 Jan 2024 09:39:53 AM AEDT
+" Last Change: 2024 Aug 15
" Generated by Colortemplate v2.2.3
@@ -17,7 +17,7 @@ let g:colors_name = 'habamax'
let s:t_Co = &t_Co
if (has('termguicolors') && &termguicolors) || has('gui_running')
- let g:terminal_ansi_colors = ['#1c1c1c', '#d75f5f', '#87af87', '#afaf87', '#5f87af', '#af87af', '#5f8787', '#9e9e9e', '#767676', '#d7875f', '#afd7af', '#d7d787', '#87afd7', '#d7afd7', '#87afaf', '#bcbcbc']
+ let g:terminal_ansi_colors = ['#1c1c1c', '#af5f5f', '#5faf5f', '#af875f', '#5f87af', '#af87af', '#5f8787', '#9e9e9e', '#767676', '#d75f87', '#87d787', '#d7af87', '#5fafd7', '#d787d7', '#87afaf', '#bcbcbc']
" Nvim uses g:terminal_color_{0-15} instead
for i in range(g:terminal_ansi_colors->len())
let g:terminal_color_{i} = g:terminal_ansi_colors[i]
@@ -27,7 +27,6 @@ hi! link Terminal Normal
hi! link StatuslineTerm Statusline
hi! link StatuslineTermNC StatuslineNC
hi! link MessageWindow Pmenu
-hi! link PopupNotification Todo
hi! link javaScriptFunction Statement
hi! link javaScriptIdentifier Statement
hi! link sqlKeyword Statement
@@ -39,7 +38,6 @@ hi! link vimOper Normal
hi! link vimSep Normal
hi! link vimParenSep Normal
hi! link vimCommentString Comment
-hi! link gitCommitSummary Title
hi! link markdownUrl String
hi Normal guifg=#bcbcbc guibg=#1c1c1c gui=NONE cterm=NONE
hi Statusline guifg=#1c1c1c guibg=#9e9e9e gui=NONE cterm=NONE
@@ -47,11 +45,11 @@ hi StatuslineNC guifg=#1c1c1c guibg=#767676 gui=NONE cterm=NONE
hi VertSplit guifg=#767676 guibg=#767676 gui=NONE cterm=NONE
hi TabLine guifg=#1c1c1c guibg=#767676 gui=NONE cterm=NONE
hi TabLineFill guifg=#1c1c1c guibg=#767676 gui=NONE cterm=NONE
-hi TabLineSel guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold
+hi TabLineSel guifg=#1c1c1c guibg=#9e9e9e gui=bold cterm=bold
hi ToolbarLine guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
-hi ToolbarButton guifg=#9e9e9e guibg=#1c1c1c gui=bold,reverse cterm=bold,reverse
+hi ToolbarButton guifg=#767676 guibg=#1c1c1c gui=bold,reverse cterm=bold,reverse
hi QuickFixLine guifg=#1c1c1c guibg=#5f87af gui=NONE cterm=NONE
-hi CursorLineNr guifg=#ffaf5f guibg=NONE gui=bold cterm=bold
+hi CursorLineNr guifg=#dadada guibg=NONE gui=bold cterm=bold
hi LineNr guifg=#585858 guibg=NONE gui=NONE cterm=NONE
hi LineNrAbove guifg=#585858 guibg=NONE gui=NONE cterm=NONE
hi LineNrBelow guifg=#585858 guibg=NONE gui=NONE cterm=NONE
@@ -59,71 +57,71 @@ hi NonText guifg=#585858 guibg=NONE gui=NONE cterm=NONE
hi EndOfBuffer guifg=#585858 guibg=NONE gui=NONE cterm=NONE
hi SpecialKey guifg=#585858 guibg=NONE gui=NONE cterm=NONE
hi FoldColumn guifg=#585858 guibg=NONE gui=NONE cterm=NONE
-hi Visual guifg=#1c1c1c guibg=#87afaf gui=NONE cterm=NONE
+hi Visual guifg=#87afaf guibg=#1c1c1c gui=reverse cterm=reverse
hi VisualNOS guifg=#1c1c1c guibg=#5f8787 gui=NONE cterm=NONE
hi Pmenu guifg=NONE guibg=#3a3a3a gui=NONE cterm=NONE
hi PmenuThumb guifg=NONE guibg=#767676 gui=NONE cterm=NONE
hi PmenuSbar guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
-hi PmenuSel guifg=#1c1c1c guibg=#afaf87 gui=NONE cterm=NONE
-hi PmenuKind guifg=#d7875f guibg=#3a3a3a gui=NONE cterm=NONE
-hi PmenuKindSel guifg=#d75f5f guibg=#afaf87 gui=NONE cterm=NONE
+hi PmenuSel guifg=NONE guibg=#585858 gui=NONE cterm=NONE
+hi PmenuKind guifg=#5f8787 guibg=#3a3a3a gui=NONE cterm=NONE
+hi PmenuKindSel guifg=#5f8787 guibg=#585858 gui=NONE cterm=NONE
hi PmenuExtra guifg=#767676 guibg=#3a3a3a gui=NONE cterm=NONE
-hi PmenuExtraSel guifg=#1c1c1c guibg=#afaf87 gui=NONE cterm=NONE
+hi PmenuExtraSel guifg=#9e9e9e guibg=#585858 gui=NONE cterm=NONE
+hi PmenuMatch guifg=#ffaf5f guibg=#3a3a3a gui=NONE cterm=NONE
+hi PmenuMatchSel guifg=#ffaf5f guibg=#585858 gui=NONE cterm=NONE
hi SignColumn guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
-hi Error guifg=#d75f5f guibg=#1c1c1c gui=reverse cterm=reverse
-hi ErrorMsg guifg=#d75f5f guibg=#1c1c1c gui=reverse cterm=reverse
-hi ModeMsg guifg=#1c1c1c guibg=#d7d787 gui=NONE cterm=NONE
-hi MoreMsg guifg=#87af87 guibg=NONE gui=NONE cterm=NONE
-hi Question guifg=#afaf87 guibg=NONE gui=NONE cterm=NONE
-hi WarningMsg guifg=#d7875f guibg=NONE gui=NONE cterm=NONE
-hi Todo guifg=#d7d787 guibg=#1c1c1c gui=reverse cterm=reverse
+hi Error guifg=#af5f5f guibg=#1c1c1c gui=reverse cterm=reverse
+hi ErrorMsg guifg=#af5f5f guibg=#1c1c1c gui=reverse cterm=reverse
+hi ModeMsg guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold
+hi MoreMsg guifg=#5faf5f guibg=NONE gui=NONE cterm=NONE
+hi Question guifg=#d7af87 guibg=NONE gui=NONE cterm=NONE
+hi WarningMsg guifg=#d75f87 guibg=NONE gui=NONE cterm=NONE
+hi Todo guifg=#dadada guibg=NONE gui=bold cterm=bold
hi MatchParen guifg=#ff00af guibg=NONE gui=bold cterm=bold
-hi Search guifg=#1c1c1c guibg=#87af87 gui=NONE cterm=NONE
-hi IncSearch guifg=#1c1c1c guibg=#ffaf5f gui=NONE cterm=NONE
-hi CurSearch guifg=#1c1c1c guibg=#afaf87 gui=NONE cterm=NONE
-hi WildMenu guifg=#1c1c1c guibg=#d7d787 gui=NONE cterm=NONE
+hi Search guifg=#5fafd7 guibg=#1c1c1c gui=reverse cterm=reverse
+hi IncSearch guifg=#ffaf5f guibg=#1c1c1c gui=reverse cterm=reverse
+hi CurSearch guifg=#ffaf5f guibg=#1c1c1c gui=reverse cterm=reverse
+hi WildMenu guifg=#1c1c1c guibg=#d7af87 gui=bold cterm=bold
hi debugPC guifg=#1c1c1c guibg=#5f87af gui=NONE cterm=NONE
-hi debugBreakpoint guifg=#1c1c1c guibg=#d7875f gui=NONE cterm=NONE
-hi Cursor guifg=#1c1c1c guibg=#ffaf5f gui=NONE cterm=NONE
+hi debugBreakpoint guifg=#1c1c1c guibg=#d75f87 gui=NONE cterm=NONE
+hi Cursor guifg=#000000 guibg=#dadada gui=NONE cterm=NONE
hi lCursor guifg=#1c1c1c guibg=#5fff00 gui=NONE cterm=NONE
hi CursorLine guifg=NONE guibg=#303030 gui=NONE cterm=NONE
hi CursorColumn guifg=NONE guibg=#303030 gui=NONE cterm=NONE
hi Folded guifg=#9e9e9e guibg=#262626 gui=NONE cterm=NONE
hi ColorColumn guifg=NONE guibg=#3a3a3a gui=NONE cterm=NONE
hi SpellBad guifg=NONE guibg=NONE guisp=#d75f5f gui=undercurl ctermfg=NONE ctermbg=NONE cterm=underline
-hi SpellCap guifg=NONE guibg=NONE guisp=#5f87af gui=undercurl ctermfg=NONE ctermbg=NONE cterm=underline
-hi SpellLocal guifg=NONE guibg=NONE guisp=#87af87 gui=undercurl ctermfg=NONE ctermbg=NONE cterm=underline
-hi SpellRare guifg=NONE guibg=NONE guisp=#d7afd7 gui=undercurl ctermfg=NONE ctermbg=NONE cterm=underline
+hi SpellCap guifg=NONE guibg=NONE guisp=#ffaf5f gui=undercurl ctermfg=NONE ctermbg=NONE cterm=underline
+hi SpellLocal guifg=NONE guibg=NONE guisp=#5fd75f gui=undercurl ctermfg=NONE ctermbg=NONE cterm=underline
+hi SpellRare guifg=NONE guibg=NONE guisp=#d787d7 gui=undercurl ctermfg=NONE ctermbg=NONE cterm=underline
hi Comment guifg=#767676 guibg=NONE gui=NONE cterm=NONE
-hi Constant guifg=#d7875f guibg=NONE gui=NONE cterm=NONE
-hi String guifg=#87af87 guibg=NONE gui=NONE cterm=NONE
-hi Character guifg=#afd7af guibg=NONE gui=NONE cterm=NONE
+hi Constant guifg=#d75f87 guibg=NONE gui=NONE cterm=NONE
+hi String guifg=#5faf5f guibg=NONE gui=NONE cterm=NONE
+hi Character guifg=#87d787 guibg=NONE gui=NONE cterm=NONE
hi Identifier guifg=#87afaf guibg=NONE gui=NONE cterm=NONE
hi Statement guifg=#af87af guibg=NONE gui=NONE cterm=NONE
-hi PreProc guifg=#afaf87 guibg=NONE gui=NONE cterm=NONE
-hi Type guifg=#87afd7 guibg=NONE gui=NONE cterm=NONE
+hi PreProc guifg=#af875f guibg=NONE gui=NONE cterm=NONE
+hi Type guifg=#5f87af guibg=NONE gui=NONE cterm=NONE
hi Special guifg=#5f8787 guibg=NONE gui=NONE cterm=NONE
hi Underlined guifg=NONE guibg=NONE gui=underline ctermfg=NONE ctermbg=NONE cterm=underline
-hi Title guifg=#d7d787 guibg=NONE gui=bold cterm=bold
+hi Title guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold
hi Directory guifg=#87afaf guibg=NONE gui=bold cterm=bold
-hi Conceal guifg=#767676 guibg=NONE gui=NONE cterm=NONE
+hi Conceal guifg=#585858 guibg=NONE gui=NONE cterm=NONE
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 Added guifg=#87af87 guibg=NONE gui=NONE cterm=NONE
-hi Changed guifg=#5f8787 guibg=NONE gui=NONE cterm=NONE
+hi DiffAdd guifg=#5faf5f guibg=NONE gui=reverse cterm=reverse
+hi DiffChange guifg=#5f87af guibg=NONE gui=reverse cterm=reverse
+hi DiffText guifg=#af87af guibg=NONE gui=reverse cterm=reverse
+hi DiffDelete guifg=#af5f5f guibg=NONE gui=reverse cterm=reverse
+hi Added guifg=#5fd75f guibg=NONE gui=NONE cterm=NONE
+hi Changed guifg=#ffaf5f 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
if s:t_Co >= 256
hi! link Terminal Normal
hi! link StatuslineTerm Statusline
hi! link StatuslineTermNC StatuslineNC
hi! link MessageWindow Pmenu
- hi! link PopupNotification Todo
hi! link javaScriptFunction Statement
hi! link javaScriptIdentifier Statement
hi! link sqlKeyword Statement
@@ -135,7 +133,6 @@ if s:t_Co >= 256
hi! link vimSep Normal
hi! link vimParenSep Normal
hi! link vimCommentString Comment
- hi! link gitCommitSummary Title
hi! link markdownUrl String
hi Normal ctermfg=250 ctermbg=234 cterm=NONE
hi Statusline ctermfg=234 ctermbg=247 cterm=NONE
@@ -143,11 +140,11 @@ if s:t_Co >= 256
hi VertSplit ctermfg=243 ctermbg=243 cterm=NONE
hi TabLine ctermfg=234 ctermbg=243 cterm=NONE
hi TabLineFill ctermfg=234 ctermbg=243 cterm=NONE
- hi TabLineSel ctermfg=NONE ctermbg=NONE cterm=bold
+ hi TabLineSel ctermfg=234 ctermbg=247 cterm=bold
hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
- hi ToolbarButton ctermfg=247 ctermbg=234 cterm=bold,reverse
+ hi ToolbarButton ctermfg=243 ctermbg=234 cterm=bold,reverse
hi QuickFixLine ctermfg=234 ctermbg=67 cterm=NONE
- hi CursorLineNr ctermfg=215 ctermbg=NONE cterm=bold
+ hi CursorLineNr ctermfg=253 ctermbg=NONE cterm=bold
hi LineNr ctermfg=240 ctermbg=NONE cterm=NONE
hi LineNrAbove ctermfg=240 ctermbg=NONE cterm=NONE
hi LineNrBelow ctermfg=240 ctermbg=NONE cterm=NONE
@@ -155,62 +152,63 @@ if s:t_Co >= 256
hi EndOfBuffer ctermfg=240 ctermbg=NONE cterm=NONE
hi SpecialKey ctermfg=240 ctermbg=NONE cterm=NONE
hi FoldColumn ctermfg=240 ctermbg=NONE cterm=NONE
- hi Visual ctermfg=234 ctermbg=109 cterm=NONE
+ hi Visual ctermfg=109 ctermbg=234 cterm=reverse
hi VisualNOS ctermfg=234 ctermbg=66 cterm=NONE
hi Pmenu ctermfg=NONE ctermbg=237 cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=243 cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
- hi PmenuSel ctermfg=234 ctermbg=144 cterm=NONE
- hi PmenuKind ctermfg=173 ctermbg=237 cterm=NONE
- hi PmenuKindSel ctermfg=167 ctermbg=144 cterm=NONE
+ hi PmenuSel ctermfg=NONE ctermbg=240 cterm=NONE
+ hi PmenuKind ctermfg=66 ctermbg=237 cterm=NONE
+ hi PmenuKindSel ctermfg=66 ctermbg=240 cterm=NONE
hi PmenuExtra ctermfg=243 ctermbg=237 cterm=NONE
- hi PmenuExtraSel ctermfg=234 ctermbg=144 cterm=NONE
+ hi PmenuExtraSel ctermfg=247 ctermbg=240 cterm=NONE
+ hi PmenuMatch ctermfg=215 ctermbg=237 cterm=NONE
+ hi PmenuMatchSel ctermfg=215 ctermbg=240 cterm=NONE
hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
- hi Error ctermfg=167 ctermbg=234 cterm=reverse
- hi ErrorMsg ctermfg=167 ctermbg=234 cterm=reverse
- hi ModeMsg ctermfg=234 ctermbg=186 cterm=NONE
- hi MoreMsg ctermfg=108 ctermbg=NONE cterm=NONE
- hi Question ctermfg=144 ctermbg=NONE cterm=NONE
- hi WarningMsg ctermfg=173 ctermbg=NONE cterm=NONE
- hi Todo ctermfg=186 ctermbg=234 cterm=reverse
+ hi Error ctermfg=131 ctermbg=234 cterm=reverse
+ hi ErrorMsg ctermfg=131 ctermbg=234 cterm=reverse
+ hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
+ hi MoreMsg ctermfg=71 ctermbg=NONE cterm=NONE
+ hi Question ctermfg=180 ctermbg=NONE cterm=NONE
+ hi WarningMsg ctermfg=168 ctermbg=NONE cterm=NONE
+ hi Todo ctermfg=253 ctermbg=NONE cterm=bold
hi MatchParen ctermfg=199 ctermbg=NONE cterm=bold
- hi Search ctermfg=234 ctermbg=108 cterm=NONE
- hi IncSearch ctermfg=234 ctermbg=215 cterm=NONE
- hi CurSearch ctermfg=234 ctermbg=144 cterm=NONE
- hi WildMenu ctermfg=234 ctermbg=186 cterm=NONE
+ hi Search ctermfg=74 ctermbg=234 cterm=reverse
+ hi IncSearch ctermfg=215 ctermbg=234 cterm=reverse
+ hi CurSearch ctermfg=215 ctermbg=234 cterm=reverse
+ hi WildMenu ctermfg=234 ctermbg=180 cterm=bold
hi debugPC ctermfg=234 ctermbg=67 cterm=NONE
- hi debugBreakpoint ctermfg=234 ctermbg=173 cterm=NONE
+ hi debugBreakpoint ctermfg=234 ctermbg=168 cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=236 cterm=NONE
hi CursorColumn ctermfg=NONE ctermbg=236 cterm=NONE
hi Folded ctermfg=247 ctermbg=235 cterm=NONE
hi ColorColumn ctermfg=NONE ctermbg=237 cterm=NONE
hi SpellBad ctermfg=167 ctermbg=NONE cterm=underline
- hi SpellCap ctermfg=67 ctermbg=NONE cterm=underline
- hi SpellLocal ctermfg=108 ctermbg=NONE cterm=underline
- hi SpellRare ctermfg=182 ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=215 ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=77 ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=176 ctermbg=NONE cterm=underline
hi Comment ctermfg=243 ctermbg=NONE cterm=NONE
- hi Constant ctermfg=173 ctermbg=NONE cterm=NONE
- hi String ctermfg=108 ctermbg=NONE cterm=NONE
- hi Character ctermfg=151 ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=168 ctermbg=NONE cterm=NONE
+ hi String ctermfg=71 ctermbg=NONE cterm=NONE
+ hi Character ctermfg=114 ctermbg=NONE cterm=NONE
hi Identifier ctermfg=109 ctermbg=NONE cterm=NONE
hi Statement ctermfg=139 ctermbg=NONE cterm=NONE
- hi PreProc ctermfg=144 ctermbg=NONE cterm=NONE
- hi Type ctermfg=110 ctermbg=NONE cterm=NONE
+ hi PreProc ctermfg=137 ctermbg=NONE cterm=NONE
+ hi Type ctermfg=67 ctermbg=NONE cterm=NONE
hi Special ctermfg=66 ctermbg=NONE cterm=NONE
hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
- hi Title ctermfg=186 ctermbg=NONE cterm=bold
+ hi Title ctermfg=NONE ctermbg=NONE cterm=bold
hi Directory ctermfg=109 ctermbg=NONE cterm=bold
- hi Conceal ctermfg=243 ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=240 ctermbg=NONE cterm=NONE
hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
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 Added ctermfg=108 ctermbg=NONE cterm=NONE
- hi Changed ctermfg=66 ctermbg=NONE cterm=NONE
+ hi DiffAdd ctermfg=71 ctermbg=NONE cterm=reverse
+ hi DiffChange ctermfg=67 ctermbg=NONE cterm=reverse
+ hi DiffText ctermfg=139 ctermbg=NONE cterm=reverse
+ hi DiffDelete ctermfg=131 ctermbg=NONE cterm=reverse
+ hi Added ctermfg=77 ctermbg=NONE cterm=NONE
+ hi Changed ctermfg=215 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
unlet s:t_Co
finish
endif
@@ -222,11 +220,11 @@ if s:t_Co >= 16
hi VertSplit ctermfg=darkgray ctermbg=darkgray cterm=NONE
hi TabLine ctermfg=black ctermbg=darkgray cterm=NONE
hi TabLineFill ctermfg=black ctermbg=darkgray cterm=NONE
- hi TabLineSel ctermfg=NONE ctermbg=NONE cterm=bold
+ hi TabLineSel ctermfg=black ctermbg=gray cterm=bold
hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
- hi ToolbarButton ctermfg=gray ctermbg=black cterm=bold,reverse
- hi QuickFixLine ctermfg=black ctermbg=blue cterm=NONE
- hi CursorLineNr ctermfg=red ctermbg=NONE cterm=bold
+ hi ToolbarButton ctermfg=darkgray ctermbg=black cterm=bold,reverse
+ hi QuickFixLine ctermfg=black ctermbg=darkblue cterm=NONE
+ hi CursorLineNr ctermfg=white ctermbg=NONE cterm=bold
hi LineNr ctermfg=darkgrey ctermbg=NONE cterm=NONE
hi LineNrAbove ctermfg=darkgrey ctermbg=NONE cterm=NONE
hi LineNrBelow ctermfg=darkgrey ctermbg=NONE cterm=NONE
@@ -234,7 +232,7 @@ if s:t_Co >= 16
hi EndOfBuffer ctermfg=darkgrey ctermbg=NONE cterm=NONE
hi SpecialKey ctermfg=darkgrey ctermbg=NONE cterm=NONE
hi FoldColumn ctermfg=darkgrey ctermbg=NONE cterm=NONE
- hi Visual ctermfg=black ctermbg=cyan cterm=NONE
+ hi Visual ctermfg=cyan ctermbg=black cterm=reverse
hi VisualNOS ctermfg=black ctermbg=darkcyan cterm=NONE
hi Pmenu ctermfg=black ctermbg=gray cterm=NONE
hi PmenuThumb ctermfg=gray ctermbg=black cterm=NONE
@@ -244,27 +242,29 @@ if s:t_Co >= 16
hi PmenuKindSel ctermfg=darkred ctermbg=darkyellow cterm=NONE
hi PmenuExtra ctermfg=darkgray ctermbg=gray cterm=NONE
hi PmenuExtraSel ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=gray cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold
hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
hi Error ctermfg=darkred ctermbg=black cterm=reverse
hi ErrorMsg ctermfg=darkred ctermbg=black cterm=reverse
- hi ModeMsg ctermfg=black ctermbg=yellow cterm=NONE
+ hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE
- hi Question ctermfg=darkyellow ctermbg=NONE cterm=NONE
+ hi Question ctermfg=yellow ctermbg=NONE cterm=NONE
hi WarningMsg ctermfg=red ctermbg=NONE cterm=NONE
- hi Todo ctermfg=yellow ctermbg=black cterm=reverse
+ hi Todo ctermfg=white ctermbg=NONE cterm=bold
hi MatchParen ctermfg=magenta ctermbg=NONE cterm=bold
- hi Search ctermfg=black ctermbg=darkgreen cterm=NONE
- hi IncSearch ctermfg=black ctermbg=red cterm=NONE
- hi CurSearch ctermfg=black ctermbg=darkyellow cterm=NONE
- hi WildMenu ctermfg=black ctermbg=yellow cterm=NONE
- hi debugPC ctermfg=black ctermbg=blue cterm=NONE
+ hi Search ctermfg=blue ctermbg=black cterm=reverse
+ hi IncSearch ctermfg=red ctermbg=black cterm=reverse
+ hi CurSearch ctermfg=red ctermbg=black cterm=reverse
+ hi WildMenu ctermfg=black ctermbg=yellow cterm=bold
+ hi debugPC ctermfg=black ctermbg=darkblue cterm=NONE
hi debugBreakpoint ctermfg=black ctermbg=red cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
hi CursorColumn ctermfg=black ctermbg=darkyellow cterm=NONE
hi Folded ctermfg=black ctermbg=darkyellow cterm=NONE
hi ColorColumn ctermfg=black ctermbg=darkyellow cterm=NONE
hi SpellBad ctermfg=darkred ctermbg=NONE cterm=underline
- hi SpellCap ctermfg=blue ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=darkyellow ctermbg=NONE cterm=underline
hi SpellLocal ctermfg=darkgreen ctermbg=NONE cterm=underline
hi SpellRare ctermfg=magenta ctermbg=NONE cterm=underline
hi Comment ctermfg=darkgray ctermbg=NONE cterm=NONE
@@ -274,22 +274,21 @@ if s:t_Co >= 16
hi Identifier ctermfg=cyan ctermbg=NONE cterm=NONE
hi Statement ctermfg=darkmagenta ctermbg=NONE cterm=NONE
hi PreProc ctermfg=darkyellow ctermbg=NONE cterm=NONE
- hi Type ctermfg=blue ctermbg=NONE cterm=NONE
+ hi Type ctermfg=darkblue ctermbg=NONE cterm=NONE
hi Special ctermfg=darkcyan ctermbg=NONE cterm=NONE
hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
- hi Title ctermfg=yellow ctermbg=NONE cterm=bold
+ hi Title ctermfg=NONE ctermbg=NONE cterm=bold
hi Directory ctermfg=cyan ctermbg=NONE cterm=bold
- hi Conceal ctermfg=darkgray ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=darkgrey ctermbg=NONE cterm=NONE
hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
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 DiffAdd ctermfg=darkgreen ctermbg=NONE cterm=reverse
+ hi DiffChange ctermfg=darkblue ctermbg=NONE cterm=reverse
+ hi DiffText ctermfg=darkmagenta ctermbg=NONE cterm=reverse
+ hi DiffDelete ctermfg=darkred ctermbg=NONE cterm=reverse
hi Added ctermfg=darkgreen ctermbg=NONE cterm=NONE
- hi Changed ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Changed ctermfg=darkyellow 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
unlet s:t_Co
finish
endif
@@ -298,13 +297,13 @@ if s:t_Co >= 8
hi Normal ctermfg=gray ctermbg=black cterm=NONE
hi Statusline ctermfg=gray ctermbg=black cterm=bold,reverse
hi StatuslineNC ctermfg=gray ctermbg=black cterm=reverse
- hi VertSplit ctermfg=gray ctermbg=black cterm=reverse
+ hi VertSplit ctermfg=gray ctermbg=gray cterm=NONE
hi TabLine ctermfg=black ctermbg=gray cterm=NONE
- hi TabLineFill ctermfg=black ctermbg=gray cterm=NONE
- hi TabLineSel ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi TabLineFill ctermfg=gray ctermbg=gray cterm=NONE
+ hi TabLineSel ctermfg=black ctermbg=gray cterm=bold
hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
- hi ToolbarButton ctermfg=gray ctermbg=black cterm=bold,reverse
- hi QuickFixLine ctermfg=black ctermbg=blue cterm=NONE
+ hi ToolbarButton ctermfg=gray ctermbg=black cterm=reverse
+ hi QuickFixLine ctermfg=black ctermbg=darkblue cterm=NONE
hi CursorLineNr ctermfg=darkyellow ctermbg=NONE cterm=bold
hi LineNr ctermfg=gray ctermbg=NONE cterm=bold
hi LineNrAbove ctermfg=gray ctermbg=NONE cterm=bold
@@ -323,52 +322,53 @@ if s:t_Co >= 8
hi PmenuKindSel ctermfg=darkred ctermbg=darkyellow cterm=NONE
hi PmenuExtra ctermfg=black ctermbg=gray cterm=NONE
hi PmenuExtraSel ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=gray cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold
hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
hi Error ctermfg=darkred ctermbg=gray cterm=bold,reverse
hi ErrorMsg ctermfg=darkred ctermbg=gray cterm=bold,reverse
- hi ModeMsg ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE
hi Question ctermfg=darkyellow ctermbg=NONE cterm=NONE
hi WarningMsg ctermfg=darkred ctermbg=NONE cterm=NONE
- hi Todo ctermfg=darkyellow ctermbg=black cterm=reverse
+ hi Todo ctermfg=gray ctermbg=NONE cterm=bold
hi MatchParen ctermfg=magenta ctermbg=NONE cterm=bold
- hi Search ctermfg=black ctermbg=darkgreen cterm=NONE
+ hi Search ctermfg=black ctermbg=darkblue cterm=NONE
hi IncSearch ctermfg=black ctermbg=darkyellow cterm=NONE
hi CurSearch ctermfg=black ctermbg=darkyellow cterm=NONE
hi WildMenu ctermfg=black ctermbg=darkyellow cterm=NONE
- hi debugPC ctermfg=black ctermbg=blue cterm=NONE
+ hi debugPC ctermfg=black ctermbg=darkblue cterm=NONE
hi debugBreakpoint ctermfg=black ctermbg=darkcyan cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
hi CursorColumn ctermfg=black ctermbg=darkyellow cterm=NONE
hi Folded ctermfg=black ctermbg=darkyellow cterm=NONE
hi ColorColumn ctermfg=black ctermbg=darkyellow cterm=NONE
hi SpellBad ctermfg=darkred ctermbg=gray cterm=reverse
- hi SpellCap ctermfg=blue ctermbg=gray cterm=reverse
+ hi SpellCap ctermfg=darkblue ctermbg=gray cterm=reverse
hi SpellLocal ctermfg=darkgreen ctermbg=black cterm=reverse
hi SpellRare ctermfg=darkmagenta ctermbg=gray cterm=reverse
hi Comment ctermfg=gray ctermbg=NONE cterm=bold
- hi Constant ctermfg=darkgreen ctermbg=NONE cterm=NONE
+ hi Constant ctermfg=darkred ctermbg=NONE cterm=NONE
hi String ctermfg=darkgreen ctermbg=NONE cterm=NONE
hi Character ctermfg=darkgreen ctermbg=NONE cterm=NONE
hi Identifier ctermfg=gray ctermbg=NONE cterm=NONE
hi Statement ctermfg=darkmagenta ctermbg=NONE cterm=NONE
hi PreProc ctermfg=darkyellow ctermbg=NONE cterm=NONE
- hi Type ctermfg=blue ctermbg=NONE cterm=NONE
+ hi Type ctermfg=darkblue ctermbg=NONE cterm=NONE
hi Special ctermfg=darkcyan ctermbg=NONE cterm=NONE
hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
- hi Title ctermfg=darkyellow ctermbg=NONE cterm=bold
+ hi Title ctermfg=NONE ctermbg=NONE cterm=bold
hi Directory ctermfg=darkcyan ctermbg=NONE cterm=bold
hi Conceal ctermfg=gray ctermbg=NONE cterm=NONE
hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
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 DiffAdd ctermfg=darkgreen ctermbg=NONE cterm=reverse
+ hi DiffChange ctermfg=darkblue ctermbg=NONE cterm=reverse
+ hi DiffText ctermfg=darkmagenta ctermbg=NONE cterm=reverse
+ hi DiffDelete ctermfg=darkred ctermbg=NONE cterm=reverse
hi Added ctermfg=darkgreen ctermbg=NONE cterm=NONE
- hi Changed ctermfg=darkcyan ctermbg=NONE cterm=NONE
+ hi Changed ctermfg=darkyellow 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
unlet s:t_Co
finish
endif
@@ -442,36 +442,39 @@ if s:t_Co >= 0
endif
" Background: dark
-" Color: color00 #1C1C1C 234 black
+" Color: color00 #1c1c1c 234 black
" Color: color08 #767676 243 darkgray
-" Color: color01 #D75F5F 167 darkred
-" Color: color09 #D7875F 173 red
-" Color: color02 #87AF87 108 darkgreen
-" Color: color10 #AFD7AF 151 green
-" Color: color03 #AFAF87 144 darkyellow
-" Color: color11 #D7D787 186 yellow
-" Color: color04 #5F87AF 67 blue
-" Color: color12 #87AFD7 110 blue
-" Color: color05 #AF87AF 139 darkmagenta
-" Color: color13 #D7AFD7 182 magenta
-" Color: color06 #5F8787 66 darkcyan
-" Color: color14 #87AFAF 109 cyan
-" Color: color07 #9E9E9E 247 gray
-" Color: color15 #BCBCBC 250 white
+" Color: color01 #af5f5f 131 darkred
+" Color: color09 #d75f87 168 red
+" Color: color02 #5faf5f 71 darkgreen
+" Color: color10 #87d787 114 green
+" Color: color03 #af875f 137 darkyellow
+" Color: color11 #d7af87 180 yellow
+" Color: color04 #5f87af 67 darkblue
+" Color: color12 #5fafd7 74 blue
+" Color: color05 #af87af 139 darkmagenta
+" Color: color13 #d787d7 176 magenta
+" Color: color06 #5f8787 66 darkcyan
+" Color: color14 #87afaf 109 cyan
+" Color: color07 #9e9e9e 247 gray
+" Color: color15 #bcbcbc 250 white
" Color: colorLine #303030 236 darkgrey
" Color: colorB #3a3a3a 237 darkgrey
" Color: colorF #262626 235 darkgrey
" Color: colorNonT #585858 240 darkgrey
-" Color: colorC #FFAF5F 215 red
-" Color: colorlC #5FFF00 82 green
-" Color: colorV #1F3F5F 109 cyan
+" Color: colorC #ffaf5f 215 red
+" Color: colorlC #5fff00 82 green
+" Color: colorV #1f3f5f 109 cyan
" Color: colorMP #ff00af 199 magenta
-" Color: diffAdd #5f875f 65 darkgreen
-" Color: diffDelete #af875f 137 darkyellow
-" Color: diffChange #5f5f5f 59 darkgray
-" Color: diffText #878787 102 lightgrey
+" Color: diffAdd #5faf5f 71 darkgreen
+" Color: diffDelete #af5f5f 131 darkred
+" Color: diffChange #5f87af 67 darkblue
+" Color: diffText #af87af 139 darkmagenta
" Color: black #000000 16 black
" Color: white #dadada 253 white
+" Color: Added #5fd75f 77 darkgreen
+" Color: Changed #ffaf5f 215 darkyellow
+" Color: Removed #d75f5f 167 darkred
" Term colors: color00 color01 color02 color03 color04 color05 color06 color07
" Term colors: color08 color09 color10 color11 color12 color13 color14 color15
" vim: et ts=8 sw=2 sts=2
diff --git a/runtime/colors/industry.vim b/runtime/colors/industry.vim
index 449bf3b676..6e66a4a791 100644
--- a/runtime/colors/industry.vim
+++ b/runtime/colors/industry.vim
@@ -4,7 +4,7 @@
" Maintainer: Original maintainer Shian Lee.
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 15 Dec 2023 20:05:36
+" Last Change: 2024 Aug 15
" Generated by Colortemplate v2.2.3
@@ -34,6 +34,8 @@ hi Pmenu guifg=#dadada guibg=#444444 gui=NONE cterm=NONE
hi PmenuSel guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE
hi PmenuSbar guifg=NONE guibg=#000000 gui=NONE cterm=NONE
hi PmenuThumb guifg=NONE guibg=#6c6c6c gui=NONE cterm=NONE
+hi PmenuMatch guifg=#ff00ff guibg=#444444 gui=NONE cterm=NONE
+hi PmenuMatchSel guifg=#ff00ff guibg=#ffff00 gui=NONE cterm=NONE
hi TabLine guifg=#dadada guibg=#444444 gui=NONE cterm=NONE
hi TabLineFill guifg=NONE guibg=#6c6c6c gui=NONE cterm=NONE
hi TabLineSel guifg=#ffffff guibg=#000000 gui=bold cterm=bold
@@ -108,6 +110,8 @@ if s:t_Co >= 256
hi PmenuSel ctermfg=16 ctermbg=226 cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=16 cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=242 cterm=NONE
+ hi PmenuMatch ctermfg=201 ctermbg=238 cterm=NONE
+ hi PmenuMatchSel ctermfg=201 ctermbg=226 cterm=NONE
hi TabLine ctermfg=253 ctermbg=238 cterm=NONE
hi TabLineFill ctermfg=NONE ctermbg=242 cterm=NONE
hi TabLineSel ctermfg=231 ctermbg=16 cterm=bold
@@ -185,6 +189,8 @@ if s:t_Co >= 16
hi PmenuSel ctermfg=black ctermbg=yellow cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=grey cterm=NONE
+ hi PmenuMatch ctermfg=white ctermbg=darkgrey cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=yellow cterm=bold
hi TabLine ctermfg=white ctermbg=darkgrey cterm=NONE
hi TabLineFill ctermfg=NONE ctermbg=grey cterm=NONE
hi TabLineSel ctermfg=white ctermbg=black cterm=bold
@@ -262,6 +268,8 @@ if s:t_Co >= 8
hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE
hi PmenuThumb ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=grey cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold
hi TabLine ctermfg=black ctermbg=grey cterm=NONE
hi TabLineFill ctermfg=NONE ctermbg=grey cterm=NONE
hi TabLineSel ctermfg=grey ctermbg=black cterm=NONE
diff --git a/runtime/colors/koehler.vim b/runtime/colors/koehler.vim
index 8a63f91a94..953c6a67fa 100644
--- a/runtime/colors/koehler.vim
+++ b/runtime/colors/koehler.vim
@@ -3,7 +3,7 @@
" Maintainer: original maintainer Ron Aaron <ron@ronware.org>
" Website: https://www.github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 15 Dec 2023 20:05:36
+" Last Change: 2024 Aug 15
" Generated by Colortemplate v2.2.3
@@ -67,7 +67,7 @@ hi CursorLine guifg=NONE guibg=#555555 gui=NONE cterm=NONE
hi CursorLineNr guifg=#ffff00 guibg=NONE gui=bold cterm=bold
hi Folded guifg=#00cdcd guibg=#666666 gui=NONE cterm=NONE
hi QuickFixLine guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE
-hi Conceal guifg=#e5e5e5 guibg=#a9a9a9 gui=NONE cterm=NONE
+hi Conceal guifg=#666666 guibg=NONE gui=NONE cterm=NONE
hi Cursor guifg=#000000 guibg=#00ff00 gui=NONE cterm=NONE
hi Directory guifg=#cc8000 guibg=NONE gui=NONE cterm=NONE
hi EndOfBuffer guifg=#cd0000 guibg=NONE gui=bold cterm=bold
@@ -82,6 +82,8 @@ hi Pmenu guifg=#ffffff guibg=#444444 gui=NONE cterm=NONE
hi PmenuSbar guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuSel guifg=#000000 guibg=#00cdcd gui=NONE cterm=NONE
hi PmenuThumb guifg=NONE guibg=#ffffff gui=NONE cterm=NONE
+hi PmenuMatch guifg=#ff00ff guibg=#444444 gui=NONE cterm=NONE
+hi PmenuMatchSel guifg=#ff0000 guibg=#00cdcd gui=NONE cterm=NONE
hi Question guifg=#5c5cff guibg=NONE gui=bold cterm=bold
hi Search guifg=#ffffff guibg=#ff0000 gui=NONE cterm=NONE
hi SignColumn guifg=#00ffff guibg=NONE gui=NONE cterm=NONE
@@ -128,7 +130,7 @@ if s:t_Co >= 256
hi CursorLineNr ctermfg=226 ctermbg=NONE cterm=bold
hi Folded ctermfg=44 ctermbg=59 cterm=NONE
hi QuickFixLine ctermfg=16 ctermbg=226 cterm=NONE
- hi Conceal ctermfg=254 ctermbg=145 cterm=NONE
+ hi Conceal ctermfg=59 ctermbg=NONE cterm=NONE
hi Cursor ctermfg=16 ctermbg=46 cterm=NONE
hi Directory ctermfg=172 ctermbg=NONE cterm=NONE
hi EndOfBuffer ctermfg=160 ctermbg=NONE cterm=bold
@@ -143,6 +145,8 @@ if s:t_Co >= 256
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuSel ctermfg=16 ctermbg=44 cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=231 cterm=NONE
+ hi PmenuMatch ctermfg=201 ctermbg=238 cterm=NONE
+ hi PmenuMatchSel ctermfg=196 ctermbg=44 cterm=NONE
hi Question ctermfg=63 ctermbg=NONE cterm=bold
hi Search ctermfg=231 ctermbg=196 cterm=NONE
hi SignColumn ctermfg=51 ctermbg=NONE cterm=NONE
@@ -192,7 +196,7 @@ if s:t_Co >= 16
hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
hi Folded ctermfg=darkblue ctermbg=NONE cterm=NONE
hi QuickFixLine ctermfg=black ctermbg=yellow cterm=NONE
- hi Conceal ctermfg=grey ctermbg=grey cterm=NONE
+ hi Conceal ctermfg=darkgrey ctermbg=NONE cterm=NONE
hi Cursor ctermfg=black ctermbg=green cterm=NONE
hi Directory ctermfg=darkyellow ctermbg=NONE cterm=NONE
hi EndOfBuffer ctermfg=darkred ctermbg=NONE cterm=bold
@@ -207,6 +211,8 @@ if s:t_Co >= 16
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuSel ctermfg=black ctermbg=darkcyan cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=white cterm=NONE
+ hi PmenuMatch ctermfg=white ctermbg=darkgrey cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkcyan cterm=bold
hi Question ctermfg=blue ctermbg=NONE cterm=bold
hi Search ctermfg=white ctermbg=red cterm=NONE
hi SignColumn ctermfg=cyan ctermbg=NONE cterm=NONE
@@ -270,6 +276,8 @@ if s:t_Co >= 8
hi PmenuSbar ctermfg=NONE ctermbg=grey cterm=NONE
hi PmenuSel ctermfg=black ctermbg=darkcyan cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=darkcyan cterm=NONE
+ hi PmenuMatch ctermfg=grey ctermbg=darkgrey cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkcyan cterm=bold
hi Question ctermfg=darkblue ctermbg=NONE cterm=bold
hi Search ctermfg=grey ctermbg=darkred cterm=NONE
hi SignColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
diff --git a/runtime/colors/lunaperche.vim b/runtime/colors/lunaperche.vim
index 62538468dc..75d25e2a23 100644
--- a/runtime/colors/lunaperche.vim
+++ b/runtime/colors/lunaperche.vim
@@ -4,7 +4,7 @@
" Maintainer: Maxim Kim <habamax@gmail.com>
" Website: https://www.github.com/vim/colorschemes
" License: Vim License (see `:help license`)
-" Last Updated: Mon 08 Jan 2024 09:41:03 AM AEDT
+" Last Change: 2024 Aug 15
" Generated by Colortemplate v2.2.3
@@ -125,6 +125,8 @@ if &background ==# 'dark'
hi PmenuKindSel guifg=#ff5f5f guibg=#4e4e4e gui=NONE cterm=NONE
hi PmenuExtra guifg=#767676 guibg=#303030 gui=NONE cterm=NONE
hi PmenuExtraSel guifg=#767676 guibg=#4e4e4e gui=NONE cterm=NONE
+ hi PmenuMatch guifg=#d787d7 guibg=#303030 gui=NONE cterm=NONE
+ hi PmenuMatchSel guifg=#d787d7 guibg=#4e4e4e gui=NONE cterm=NONE
hi SignColumn guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi Error guifg=#ffffff guibg=#ff5f5f gui=NONE cterm=NONE
hi ErrorMsg guifg=#ffffff guibg=#ff5f5f gui=NONE cterm=NONE
@@ -163,7 +165,7 @@ if &background ==# 'dark'
hi Underlined guifg=NONE guibg=NONE gui=underline ctermfg=NONE ctermbg=NONE cterm=underline
hi Title guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold
hi Directory guifg=#5fafff guibg=NONE gui=bold cterm=bold
- hi Conceal guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Conceal guifg=#585858 guibg=NONE gui=NONE cterm=NONE
hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi DiffAdd guifg=#c6c6c6 guibg=#875f87 gui=NONE cterm=NONE
hi DiffChange guifg=#c6c6c6 guibg=#5f5f5f gui=NONE cterm=NONE
@@ -220,6 +222,8 @@ else
hi PmenuKindSel guifg=#af0000 guibg=#c6c6c6 gui=NONE cterm=NONE
hi PmenuExtra guifg=#767676 guibg=#e4e4e4 gui=NONE cterm=NONE
hi PmenuExtraSel guifg=#767676 guibg=#c6c6c6 gui=NONE cterm=NONE
+ hi PmenuMatch guifg=#af00af guibg=#e4e4e4 gui=NONE cterm=NONE
+ hi PmenuMatchSel guifg=#af00af guibg=#c6c6c6 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
@@ -258,7 +262,7 @@ else
hi Underlined guifg=NONE guibg=NONE gui=underline ctermfg=NONE ctermbg=NONE cterm=underline
hi Title guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold
hi Directory guifg=#005fd7 guibg=NONE gui=bold cterm=bold
- hi Conceal guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Conceal guifg=#9e9e9e guibg=NONE gui=NONE cterm=NONE
hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi DiffAdd guifg=#000000 guibg=#d7afd7 gui=NONE cterm=NONE
hi DiffChange guifg=#000000 guibg=#d0d0d0 gui=NONE cterm=NONE
@@ -390,6 +394,8 @@ if s:t_Co >= 256
hi PmenuKindSel ctermfg=203 ctermbg=239 cterm=NONE
hi PmenuExtra ctermfg=243 ctermbg=236 cterm=NONE
hi PmenuExtraSel ctermfg=243 ctermbg=239 cterm=NONE
+ hi PmenuMatch ctermfg=176 ctermbg=236 cterm=NONE
+ hi PmenuMatchSel ctermfg=176 ctermbg=239 cterm=NONE
hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
hi Error ctermfg=231 ctermbg=203 cterm=NONE
hi ErrorMsg ctermfg=231 ctermbg=203 cterm=NONE
@@ -426,7 +432,7 @@ if s:t_Co >= 256
hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
hi Title ctermfg=NONE ctermbg=NONE cterm=bold
hi Directory ctermfg=75 ctermbg=NONE cterm=bold
- hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=240 ctermbg=NONE cterm=NONE
hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
hi DiffAdd ctermfg=251 ctermbg=96 cterm=NONE
hi DiffChange ctermfg=251 ctermbg=59 cterm=NONE
@@ -476,6 +482,8 @@ if s:t_Co >= 256
hi PmenuKindSel ctermfg=124 ctermbg=251 cterm=NONE
hi PmenuExtra ctermfg=243 ctermbg=254 cterm=NONE
hi PmenuExtraSel ctermfg=243 ctermbg=251 cterm=NONE
+ hi PmenuMatch ctermfg=127 ctermbg=254 cterm=NONE
+ hi PmenuMatchSel ctermfg=127 ctermbg=251 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
@@ -512,7 +520,7 @@ if s:t_Co >= 256
hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
hi Title ctermfg=NONE ctermbg=NONE cterm=bold
hi Directory ctermfg=26 ctermbg=NONE cterm=bold
- hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=247 ctermbg=NONE cterm=NONE
hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
hi DiffAdd ctermfg=16 ctermbg=182 cterm=NONE
hi DiffChange ctermfg=16 ctermbg=252 cterm=NONE
@@ -568,6 +576,8 @@ if s:t_Co >= 16
hi PmenuKindSel ctermfg=darkred ctermbg=darkcyan cterm=NONE
hi PmenuExtra ctermfg=black ctermbg=grey cterm=NONE
hi PmenuExtraSel ctermfg=black ctermbg=darkcyan cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=grey cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkcyan cterm=bold
hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
hi Error ctermfg=white ctermbg=red cterm=NONE
hi ErrorMsg ctermfg=white ctermbg=red cterm=NONE
@@ -603,7 +613,7 @@ if s:t_Co >= 16
hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
hi Title ctermfg=NONE ctermbg=NONE cterm=bold
hi Directory ctermfg=blue ctermbg=NONE cterm=bold
- hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=grey ctermbg=NONE cterm=NONE
hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
hi DiffAdd ctermfg=white ctermbg=darkmagenta cterm=NONE
hi DiffChange ctermfg=white ctermbg=darkgreen cterm=NONE
@@ -689,7 +699,7 @@ if s:t_Co >= 16
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 Conceal ctermfg=darkgrey 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=lightgray cterm=NONE
@@ -745,6 +755,8 @@ if s:t_Co >= 8
hi PmenuKindSel ctermfg=darkred ctermbg=darkcyan cterm=NONE
hi PmenuExtra ctermfg=black ctermbg=grey cterm=NONE
hi PmenuExtraSel ctermfg=black ctermbg=darkcyan cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=grey cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkcyan cterm=bold
hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
hi Error ctermfg=grey ctermbg=darkred cterm=NONE
hi ErrorMsg ctermfg=grey ctermbg=darkred cterm=NONE
diff --git a/runtime/colors/morning.vim b/runtime/colors/morning.vim
index 12f1efe9a6..82a3d6d97d 100644
--- a/runtime/colors/morning.vim
+++ b/runtime/colors/morning.vim
@@ -4,7 +4,7 @@
" Maintainer: Original maintainer Bram Moolenaar <Bram@vim.org>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 15 Dec 2023 20:05:37
+" Last Change: 2024 Aug 15
" Generated by Colortemplate v2.2.3
@@ -47,6 +47,8 @@ hi Pmenu guifg=#000000 guibg=#b2b2b2 gui=NONE cterm=NONE
hi PmenuSel guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE
hi PmenuSbar guifg=NONE guibg=#e4e4e4 gui=NONE cterm=NONE
hi PmenuThumb guifg=NONE guibg=#000000 gui=NONE cterm=NONE
+hi PmenuMatch guifg=#a52a2a guibg=#b2b2b2 gui=NONE cterm=NONE
+hi PmenuMatchSel guifg=#a52a2a guibg=#ffff00 gui=NONE cterm=NONE
hi TabLine guifg=#000000 guibg=#bcbcbc gui=underline cterm=underline
hi TabLineFill guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse
hi TabLineSel guifg=#000000 guibg=#e4e4e4 gui=bold cterm=bold
@@ -87,7 +89,7 @@ hi Type guifg=#2e8b57 guibg=NONE gui=bold cterm=bold
hi Special guifg=#6a5acd guibg=NONE gui=NONE cterm=NONE
hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi Directory guifg=#008787 guibg=NONE gui=bold cterm=bold
-hi Conceal guifg=#0000ff guibg=NONE gui=NONE cterm=NONE
+hi Conceal guifg=#878787 guibg=NONE gui=NONE cterm=NONE
hi Title guifg=#a52a2a guibg=NONE gui=bold cterm=bold
hi DiffAdd guifg=#ffffff guibg=#5f875f gui=NONE cterm=NONE
hi DiffChange guifg=#ffffff guibg=#5f87af gui=NONE cterm=NONE
@@ -119,6 +121,8 @@ if s:t_Co >= 256
hi PmenuSel ctermfg=16 ctermbg=226 cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=254 cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=16 cterm=NONE
+ hi PmenuMatch ctermfg=124 ctermbg=249 cterm=NONE
+ hi PmenuMatchSel ctermfg=124 ctermbg=226 cterm=NONE
hi TabLine ctermfg=16 ctermbg=250 cterm=underline
hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
hi TabLineSel ctermfg=16 ctermbg=254 cterm=bold
@@ -159,7 +163,7 @@ if s:t_Co >= 256
hi Special ctermfg=62 ctermbg=NONE cterm=NONE
hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
hi Directory ctermfg=30 ctermbg=NONE cterm=bold
- hi Conceal ctermfg=21 ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=102 ctermbg=NONE cterm=NONE
hi Title ctermfg=124 ctermbg=NONE cterm=bold
hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE
hi DiffChange ctermfg=231 ctermbg=67 cterm=NONE
@@ -184,6 +188,8 @@ if s:t_Co >= 16
hi PmenuSel ctermfg=black ctermbg=yellow cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=grey cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=black cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=white cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=yellow cterm=bold
hi TabLine ctermfg=black ctermbg=white cterm=underline
hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
hi TabLineSel ctermfg=black ctermbg=grey cterm=bold
@@ -224,7 +230,7 @@ if s:t_Co >= 16
hi Special ctermfg=darkblue ctermbg=NONE cterm=NONE
hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
hi Directory ctermfg=darkcyan ctermbg=NONE cterm=bold
- hi Conceal ctermfg=blue ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=gray ctermbg=NONE cterm=NONE
hi Title ctermfg=darkred ctermbg=NONE cterm=bold
hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
hi DiffChange ctermfg=white ctermbg=blue cterm=NONE
@@ -249,6 +255,8 @@ if s:t_Co >= 8
hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=darkgreen cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=darkcyan cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold
hi TabLine ctermfg=gray ctermbg=black cterm=NONE
hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
hi TabLineSel ctermfg=black ctermbg=gray cterm=NONE
diff --git a/runtime/colors/murphy.vim b/runtime/colors/murphy.vim
index c1612fbc0e..f38c8259dd 100644
--- a/runtime/colors/murphy.vim
+++ b/runtime/colors/murphy.vim
@@ -4,7 +4,7 @@
" Maintainer: Original maintainer Ron Aaron <ron@ronware.org>.
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Mon 08 Jan 2024 09:50:15 AM AEDT
+" Last Change: 2024 Aug 15
" Generated by Colortemplate v2.2.3
@@ -43,6 +43,8 @@ hi Pmenu guifg=#ffffff guibg=#444444 gui=NONE cterm=NONE
hi PmenuSel guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE
hi PmenuSbar guifg=NONE guibg=#303030 gui=NONE cterm=NONE
hi PmenuThumb guifg=NONE guibg=#bcbcbc gui=NONE cterm=NONE
+hi PmenuMatch guifg=#ff00ff guibg=#444444 gui=NONE cterm=NONE
+hi PmenuMatchSel guifg=#ff00ff guibg=#ffff00 gui=NONE cterm=NONE
hi TabLineFill guifg=NONE guibg=#303030 gui=NONE cterm=NONE
hi TabLine guifg=#87ff87 guibg=#444444 gui=NONE cterm=NONE
hi TabLineSel guifg=#ffffff guibg=#000000 gui=NONE cterm=NONE
@@ -116,6 +118,8 @@ if s:t_Co >= 256
hi PmenuSel ctermfg=16 ctermbg=226 cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=236 cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=250 cterm=NONE
+ hi PmenuMatch ctermfg=201 ctermbg=238 cterm=NONE
+ hi PmenuMatchSel ctermfg=201 ctermbg=226 cterm=NONE
hi TabLineFill ctermfg=NONE ctermbg=236 cterm=NONE
hi TabLine ctermfg=120 ctermbg=238 cterm=NONE
hi TabLineSel ctermfg=231 ctermbg=16 cterm=NONE
@@ -181,6 +185,8 @@ if s:t_Co >= 16
hi PmenuSel ctermfg=black ctermbg=yellow cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=grey cterm=NONE
+ hi PmenuMatch ctermfg=white ctermbg=darkgrey cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=yellow cterm=bold
hi TabLineFill ctermfg=NONE ctermbg=grey cterm=NONE
hi TabLine ctermfg=green ctermbg=darkgrey cterm=NONE
hi TabLineSel ctermfg=white ctermbg=black cterm=NONE
@@ -246,6 +252,8 @@ if s:t_Co >= 8
hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=grey cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=darkcyan cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold
hi TabLineFill ctermfg=NONE ctermbg=grey cterm=NONE
hi TabLine ctermfg=grey ctermbg=black cterm=reverse
hi TabLineSel ctermfg=grey ctermbg=black cterm=NONE
diff --git a/runtime/colors/pablo.vim b/runtime/colors/pablo.vim
index f53739bc6d..de585adfe2 100644
--- a/runtime/colors/pablo.vim
+++ b/runtime/colors/pablo.vim
@@ -3,7 +3,7 @@
" Maintainer: Original maintainerRon Aaron <ron@ronware.org>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 15 Dec 2023 20:05:38
+" Last Change: 2024 Aug 15
" Generated by Colortemplate v2.2.3
@@ -42,7 +42,7 @@ hi Underlined guifg=#80a0ff guibg=NONE gui=underline cterm=underline
hi Ignore guifg=#000000 guibg=#000000 gui=NONE cterm=NONE
hi Error guifg=#ffffff guibg=#ff0000 gui=NONE cterm=NONE
hi Todo guifg=#000000 guibg=#c0c000 gui=NONE cterm=NONE
-hi Conceal guifg=#e5e5e5 guibg=#a9a9a9 gui=NONE cterm=NONE
+hi Conceal guifg=#666666 guibg=NONE gui=NONE cterm=NONE
hi Cursor guifg=#000000 guibg=#ffffff gui=NONE cterm=NONE
hi lCursor guifg=#000000 guibg=#ffffff gui=NONE cterm=NONE
hi CursorIM guifg=NONE guibg=fg gui=NONE cterm=NONE
@@ -85,6 +85,8 @@ hi TabLineFill guifg=NONE guibg=#000000 gui=reverse cterm=reverse
hi TabLineSel guifg=#ffffff guibg=#000000 gui=bold cterm=bold
hi ToolbarLine guifg=NONE guibg=#000000 gui=NONE cterm=NONE
hi ToolbarButton guifg=#000000 guibg=#e5e5e5 gui=bold cterm=bold
+hi PmenuMatch guifg=#ff00ff guibg=#303030 gui=NONE cterm=NONE
+hi PmenuMatchSel guifg=#ff00ff guibg=#e5e5e5 gui=NONE cterm=NONE
hi Pmenu guifg=fg guibg=#303030 gui=NONE cterm=NONE
hi PmenuSbar guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuSel guifg=#000000 guibg=#e5e5e5 gui=NONE cterm=NONE
@@ -115,7 +117,7 @@ if s:t_Co >= 256
hi Ignore ctermfg=16 ctermbg=16 cterm=NONE
hi Error ctermfg=231 ctermbg=196 cterm=NONE
hi Todo ctermfg=16 ctermbg=142 cterm=NONE
- hi Conceal ctermfg=254 ctermbg=248 cterm=NONE
+ hi Conceal ctermfg=241 ctermbg=NONE cterm=NONE
hi Cursor ctermfg=16 ctermbg=231 cterm=NONE
hi lCursor ctermfg=16 ctermbg=231 cterm=NONE
hi CursorIM ctermfg=NONE ctermbg=fg cterm=NONE
@@ -158,6 +160,8 @@ if s:t_Co >= 256
hi TabLineSel ctermfg=231 ctermbg=16 cterm=bold
hi ToolbarLine ctermfg=NONE ctermbg=16 cterm=NONE
hi ToolbarButton ctermfg=16 ctermbg=254 cterm=bold
+ hi PmenuMatch ctermfg=201 ctermbg=236 cterm=NONE
+ hi PmenuMatchSel ctermfg=201 ctermbg=254 cterm=NONE
hi Pmenu ctermfg=fg ctermbg=236 cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuSel ctermfg=16 ctermbg=254 cterm=NONE
@@ -183,7 +187,7 @@ if s:t_Co >= 16
hi Ignore ctermfg=black ctermbg=black cterm=NONE
hi Error ctermfg=white ctermbg=red cterm=NONE
hi Todo ctermfg=black ctermbg=darkyellow cterm=NONE
- hi Conceal ctermfg=grey ctermbg=grey cterm=NONE
+ hi Conceal ctermfg=darkgrey ctermbg=NONE cterm=NONE
hi Cursor ctermfg=black ctermbg=white cterm=NONE
hi lCursor ctermfg=black ctermbg=white cterm=NONE
hi CursorIM ctermfg=NONE ctermbg=fg cterm=NONE
@@ -226,6 +230,8 @@ if s:t_Co >= 16
hi TabLineSel ctermfg=white ctermbg=black cterm=bold
hi ToolbarLine ctermfg=NONE ctermbg=black cterm=NONE
hi ToolbarButton ctermfg=black ctermbg=grey cterm=bold
+ hi PmenuMatch ctermfg=fg ctermbg=darkgrey cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=grey cterm=bold
hi Pmenu ctermfg=fg ctermbg=darkgrey cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuSel ctermfg=black ctermbg=grey cterm=NONE
@@ -250,6 +256,8 @@ if s:t_Co >= 8
hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE
hi PmenuThumb ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=grey cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold
hi TabLine ctermfg=black ctermbg=grey cterm=NONE
hi TabLineFill ctermfg=NONE ctermbg=grey cterm=NONE
hi TabLineSel ctermfg=grey ctermbg=black cterm=NONE
diff --git a/runtime/colors/peachpuff.vim b/runtime/colors/peachpuff.vim
index f4c1e21697..91c98119b3 100644
--- a/runtime/colors/peachpuff.vim
+++ b/runtime/colors/peachpuff.vim
@@ -4,7 +4,7 @@
" 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 15 Dec 2023 20:05:39
+" Last Change: 2024 Aug 15
" Generated by Colortemplate v2.2.3
@@ -44,9 +44,11 @@ hi StatusLineTerm guifg=#ffffff guibg=#2e8b57 gui=bold cterm=bold
hi StatusLineTermNC guifg=#ffdab9 guibg=#008b8b gui=bold cterm=bold
hi VertSplit guifg=#ffdab9 guibg=#737373 gui=NONE cterm=NONE
hi Pmenu guifg=#000000 guibg=#ffaf87 gui=NONE cterm=NONE
-hi PmenuSel guifg=#000000 guibg=#f5c195 gui=bold cterm=bold
hi PmenuSbar guifg=NONE guibg=#ffdab9 gui=NONE cterm=NONE
hi PmenuThumb guifg=NONE guibg=#737373 gui=NONE cterm=NONE
+hi PmenuSel guifg=#000000 guibg=#f5c195 gui=bold cterm=bold
+hi PmenuMatch guifg=#a52a2a guibg=#ffaf87 gui=NONE cterm=NONE
+hi PmenuMatchSel guifg=#a52a2a guibg=#f5c195 gui=bold cterm=bold
hi TabLine guifg=#ffdab9 guibg=#737373 gui=underline cterm=underline
hi TabLineFill guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse
hi TabLineSel guifg=#000000 guibg=#ffdab9 gui=bold cterm=bold
@@ -86,7 +88,7 @@ hi PreProc guifg=#cd00cd guibg=NONE gui=NONE cterm=NONE
hi Type guifg=#2e8b57 guibg=NONE gui=bold cterm=bold
hi Special guifg=#6a5acd guibg=NONE gui=NONE cterm=NONE
hi Directory guifg=#008b8b guibg=NONE gui=bold cterm=bold
-hi Conceal guifg=#406090 guibg=NONE gui=NONE cterm=NONE
+hi Conceal guifg=#737373 guibg=NONE gui=NONE cterm=NONE
hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi Title guifg=#cd00cd guibg=NONE gui=bold cterm=bold
hi DiffAdd guifg=#ffffff guibg=#5f875f gui=NONE cterm=NONE
@@ -116,9 +118,11 @@ if s:t_Co >= 256
hi StatusLineTermNC ctermfg=223 ctermbg=30 cterm=bold
hi VertSplit ctermfg=223 ctermbg=243 cterm=NONE
hi Pmenu ctermfg=16 ctermbg=216 cterm=NONE
- hi PmenuSel ctermfg=16 ctermbg=180 cterm=bold
hi PmenuSbar ctermfg=NONE ctermbg=223 cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=243 cterm=NONE
+ hi PmenuSel ctermfg=16 ctermbg=180 cterm=bold
+ hi PmenuMatch ctermfg=124 ctermbg=216 cterm=NONE
+ hi PmenuMatchSel ctermfg=124 ctermbg=180 cterm=bold
hi TabLine ctermfg=223 ctermbg=243 cterm=underline
hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
hi TabLineSel ctermfg=16 ctermbg=223 cterm=bold
@@ -158,7 +162,7 @@ if s:t_Co >= 256
hi Type ctermfg=29 ctermbg=NONE cterm=bold
hi Special ctermfg=62 ctermbg=NONE cterm=NONE
hi Directory ctermfg=30 ctermbg=NONE cterm=bold
- hi Conceal ctermfg=25 ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=243 ctermbg=NONE cterm=NONE
hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
hi Title ctermfg=164 ctermbg=NONE cterm=bold
hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE
@@ -183,9 +187,11 @@ if s:t_Co >= 16
hi StatusLineTermNC ctermfg=white ctermbg=darkcyan cterm=bold
hi VertSplit ctermfg=white ctermbg=darkgrey cterm=NONE
hi Pmenu ctermfg=black ctermbg=grey cterm=NONE
- hi PmenuSel ctermfg=black ctermbg=yellow cterm=bold
hi PmenuSbar ctermfg=NONE ctermbg=white cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=darkgrey cterm=NONE
+ hi PmenuSel ctermfg=black ctermbg=yellow cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=grey cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=yellow cterm=bold
hi TabLine ctermfg=white ctermbg=darkgrey cterm=underline
hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
hi TabLineSel ctermfg=black ctermbg=white cterm=bold
@@ -253,6 +259,8 @@ if s:t_Co >= 8
hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=darkgreen cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=darkcyan cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold
hi TabLine ctermfg=gray ctermbg=black cterm=NONE
hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
hi TabLineSel ctermfg=black ctermbg=white cterm=NONE
diff --git a/runtime/colors/quiet.vim b/runtime/colors/quiet.vim
index d7f8582888..bcf2eced16 100644
--- a/runtime/colors/quiet.vim
+++ b/runtime/colors/quiet.vim
@@ -4,7 +4,7 @@
" Maintainer: Maxence Weynans <neutaaaaan@gmail.com>
" Website: https://github.com/vim/colorschemes
" License: Vim License (see `:help license`)`
-" Last Updated: Fri 15 Dec 2023 20:05:39
+" Last Change: 2024 Aug 05
" Generated by Colortemplate v2.2.3
@@ -14,6 +14,9 @@ let g:colors_name = 'quiet'
let s:t_Co = &t_Co
+hi! link Added Normal
+hi! link Changed Normal
+hi! link Removed Normal
hi! link Terminal Normal
hi! link StatusLineTerm StatusLine
hi! link StatusLineTermNC StatusLineNC
@@ -79,10 +82,12 @@ if &background ==# 'dark'
hi MoreMsg guifg=#dadada guibg=NONE gui=NONE cterm=NONE
hi NonText guifg=#707070 guibg=NONE gui=NONE cterm=NONE
hi Pmenu guifg=#000000 guibg=#a8a8a8 gui=NONE cterm=NONE
+ hi PmenuMatch guifg=#d7005f guibg=#a8a8a8 gui=NONE cterm=NONE
hi PmenuExtra guifg=#000000 guibg=#a8a8a8 gui=NONE cterm=NONE
hi PmenuKind guifg=#000000 guibg=#a8a8a8 gui=bold cterm=bold
hi PmenuSbar guifg=#707070 guibg=#585858 gui=NONE cterm=NONE
hi PmenuSel guifg=#000000 guibg=#dadada gui=NONE cterm=NONE
+ hi PmenuMatchSel guifg=#d7005f guibg=#dadada gui=bold cterm=bold
hi PmenuExtraSel guifg=#000000 guibg=#dadada gui=NONE cterm=NONE
hi PmenuKindSel guifg=#000000 guibg=#dadada gui=bold cterm=bold
hi PmenuThumb guifg=#dadada guibg=#dadada gui=NONE cterm=NONE
@@ -153,10 +158,12 @@ else
hi MoreMsg guifg=#000000 guibg=NONE gui=NONE cterm=NONE
hi NonText guifg=#626262 guibg=NONE gui=NONE cterm=NONE
hi Pmenu guifg=#000000 guibg=#a8a8a8 gui=NONE cterm=NONE
+ hi PmenuMatch guifg=#d70000 guibg=#a8a8a8 gui=NONE cterm=NONE
hi PmenuExtra guifg=#000000 guibg=#a8a8a8 gui=NONE cterm=NONE
hi PmenuKind guifg=#000000 guibg=#a8a8a8 gui=bold cterm=bold
hi PmenuSbar guifg=#000000 guibg=#e4e4e4 gui=NONE cterm=NONE
hi PmenuSel guifg=#d7d7d7 guibg=#000000 gui=NONE cterm=NONE
+ hi PmenuMatchSel guifg=#d70000 guibg=#000000 gui=bold cterm=bold
hi PmenuExtraSel guifg=#d7d7d7 guibg=#000000 gui=NONE cterm=NONE
hi PmenuKindSel guifg=#d7d7d7 guibg=#000000 gui=bold cterm=bold
hi PmenuThumb guifg=#000000 guibg=#000000 gui=NONE cterm=NONE
@@ -222,10 +229,12 @@ if s:t_Co >= 256
hi MoreMsg ctermfg=253 ctermbg=NONE cterm=NONE
hi NonText ctermfg=242 ctermbg=NONE cterm=NONE
hi Pmenu ctermfg=16 ctermbg=248 cterm=NONE
+ hi PmenuMatch ctermfg=161 ctermbg=248 cterm=NONE
hi PmenuExtra ctermfg=16 ctermbg=248 cterm=NONE
hi PmenuKind ctermfg=16 ctermbg=248 cterm=bold
hi PmenuSbar ctermfg=242 ctermbg=240 cterm=NONE
hi PmenuSel ctermfg=16 ctermbg=253 cterm=NONE
+ hi PmenuMatchSel ctermfg=161 ctermbg=253 cterm=bold
hi PmenuExtraSel ctermfg=16 ctermbg=253 cterm=NONE
hi PmenuKindSel ctermfg=16 ctermbg=253 cterm=bold
hi PmenuThumb ctermfg=253 ctermbg=253 cterm=NONE
@@ -289,10 +298,12 @@ if s:t_Co >= 256
hi MoreMsg ctermfg=16 ctermbg=NONE cterm=NONE
hi NonText ctermfg=241 ctermbg=NONE cterm=NONE
hi Pmenu ctermfg=16 ctermbg=248 cterm=NONE
+ hi PmenuMatch ctermfg=160 ctermbg=248 cterm=NONE
hi PmenuExtra ctermfg=16 ctermbg=248 cterm=NONE
hi PmenuKind ctermfg=16 ctermbg=248 cterm=bold
hi PmenuSbar ctermfg=16 ctermbg=254 cterm=NONE
hi PmenuSel ctermfg=188 ctermbg=16 cterm=NONE
+ hi PmenuMatchSel ctermfg=160 ctermbg=16 cterm=bold
hi PmenuExtraSel ctermfg=188 ctermbg=16 cterm=NONE
hi PmenuKindSel ctermfg=188 ctermbg=16 cterm=bold
hi PmenuThumb ctermfg=16 ctermbg=16 cterm=NONE
@@ -368,9 +379,11 @@ if s:t_Co >= 16
hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
hi MoreMsg ctermfg=NONE ctermbg=NONE cterm=NONE
hi Pmenu ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi PmenuMatch ctermfg=NONE ctermbg=darkred cterm=reverse
hi PmenuExtra ctermfg=NONE ctermbg=NONE cterm=reverse
hi PmenuKind ctermfg=NONE ctermbg=NONE cterm=bold,reverse
hi PmenuSel ctermfg=NONE ctermbg=NONE cterm=bold
+ hi PmenuMatchSel ctermfg=darkred ctermbg=NONE cterm=bold
hi PmenuExtraSel ctermfg=NONE ctermbg=NONE cterm=bold
hi PmenuKindSel ctermfg=NONE ctermbg=NONE cterm=bold
hi PmenuThumb ctermfg=NONE ctermbg=NONE cterm=NONE
@@ -434,9 +447,11 @@ if s:t_Co >= 16
hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
hi MoreMsg ctermfg=NONE ctermbg=NONE cterm=NONE
hi Pmenu ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi PmenuMatch ctermfg=NONE ctermbg=darkred cterm=reverse
hi PmenuExtra ctermfg=NONE ctermbg=NONE cterm=reverse
hi PmenuKind ctermfg=NONE ctermbg=NONE cterm=bold,reverse
hi PmenuSel ctermfg=NONE ctermbg=NONE cterm=bold
+ hi PmenuMatchSel ctermfg=darkred ctermbg=NONE cterm=bold
hi PmenuExtraSel ctermfg=NONE ctermbg=NONE cterm=bold
hi PmenuKindSel ctermfg=NONE ctermbg=NONE cterm=bold
hi PmenuThumb ctermfg=NONE ctermbg=NONE cterm=NONE
@@ -507,9 +522,11 @@ if s:t_Co >= 8
hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
hi MoreMsg ctermfg=NONE ctermbg=NONE cterm=NONE
hi Pmenu ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi PmenuMatch ctermfg=NONE ctermbg=darkred cterm=reverse
hi PmenuExtra ctermfg=NONE ctermbg=NONE cterm=reverse
hi PmenuKind ctermfg=NONE ctermbg=NONE cterm=bold,reverse
hi PmenuSel ctermfg=NONE ctermbg=NONE cterm=bold
+ hi PmenuMatchSel ctermfg=darkred ctermbg=NONE cterm=bold
hi PmenuExtraSel ctermfg=NONE ctermbg=NONE cterm=bold
hi PmenuKindSel ctermfg=NONE ctermbg=NONE cterm=bold
hi PmenuThumb ctermfg=NONE ctermbg=NONE cterm=NONE
@@ -573,9 +590,11 @@ if s:t_Co >= 8
hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
hi MoreMsg ctermfg=NONE ctermbg=NONE cterm=NONE
hi Pmenu ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi PmenuMatch ctermfg=NONE ctermbg=darkred cterm=reverse
hi PmenuExtra ctermfg=NONE ctermbg=NONE cterm=reverse
hi PmenuKind ctermfg=NONE ctermbg=NONE cterm=bold,reverse
hi PmenuSel ctermfg=NONE ctermbg=NONE cterm=bold
+ hi PmenuMatchSel ctermfg=darkred ctermbg=NONE cterm=bold
hi PmenuExtraSel ctermfg=NONE ctermbg=NONE cterm=bold
hi PmenuKindSel ctermfg=NONE ctermbg=NONE cterm=bold
hi PmenuThumb ctermfg=NONE ctermbg=NONE cterm=NONE
diff --git a/runtime/colors/retrobox.vim b/runtime/colors/retrobox.vim
index b4a194d885..a89bf0557e 100644
--- a/runtime/colors/retrobox.vim
+++ b/runtime/colors/retrobox.vim
@@ -4,7 +4,7 @@
" 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: Fri 15 Dec 2023 20:05:40
+" Last Change: 2024 Aug 15
" Generated by Colortemplate v2.2.3
@@ -22,7 +22,8 @@ hi! link Tag Special
hi! link lCursor Cursor
hi! link MessageWindow PMenu
hi! link PopupNotification Todo
-hi! link CurSearch Search
+hi! link CurSearch IncSearch
+hi! link Terminal Normal
if &background ==# 'dark'
if (has('termguicolors') && &termguicolors) || has('gui_running')
@@ -33,7 +34,7 @@ if &background ==# 'dark'
endfor
endif
hi Normal guifg=#ebdbb2 guibg=#1c1c1c gui=NONE cterm=NONE
- hi CursorLineNr guifg=#fabd2f guibg=#303030 gui=NONE cterm=NONE
+ hi CursorLineNr guifg=#fabd2f guibg=#1c1c1c gui=bold cterm=bold
hi FoldColumn guifg=#928374 guibg=#1c1c1c gui=NONE cterm=NONE
hi SignColumn guifg=#928374 guibg=#1c1c1c gui=NONE cterm=NONE
hi VertSplit guifg=#303030 guibg=#1c1c1c gui=NONE cterm=NONE
@@ -54,6 +55,8 @@ if &background ==# 'dark'
hi PmenuKindSel guifg=#fb4934 guibg=#83a598 gui=NONE cterm=NONE
hi PmenuExtra guifg=#a89984 guibg=#3c3836 gui=NONE cterm=NONE
hi PmenuExtraSel guifg=#303030 guibg=#83a598 gui=NONE cterm=NONE
+ hi PmenuMatch guifg=#b16286 guibg=#3c3836 gui=NONE cterm=NONE
+ hi PmenuMatchSel guifg=#b16286 guibg=#83a598 gui=bold cterm=bold
hi SpecialKey guifg=#928374 guibg=NONE gui=NONE cterm=NONE
hi StatusLine guifg=#504945 guibg=#ebdbb2 gui=bold,reverse cterm=bold,reverse
hi StatusLineNC guifg=#3c3836 guibg=#a89984 gui=reverse cterm=reverse
@@ -65,7 +68,7 @@ if &background ==# 'dark'
hi Visual guifg=#1c1c1c guibg=#83a598 gui=NONE cterm=NONE
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 Conceal guifg=#504945 guibg=NONE gui=NONE cterm=NONE
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
@@ -128,7 +131,7 @@ else
endfor
endif
hi Normal guifg=#3c3836 guibg=#fbf1c7 gui=NONE cterm=NONE
- hi CursorLineNr guifg=#b57614 guibg=#e5d4b1 gui=NONE cterm=NONE
+ hi CursorLineNr guifg=#b57614 guibg=#fbf1c7 gui=bold cterm=bold
hi FoldColumn guifg=#928374 guibg=#fbf1c7 gui=NONE cterm=NONE
hi SignColumn guifg=#3c3836 guibg=#fbf1c7 gui=NONE cterm=NONE
hi VertSplit guifg=#bdae93 guibg=#fbf1c7 gui=NONE cterm=NONE
@@ -149,6 +152,8 @@ else
hi PmenuKindSel guifg=#9d0006 guibg=#076678 gui=NONE cterm=NONE
hi PmenuExtra guifg=#7c6f64 guibg=#e5d4b1 gui=NONE cterm=NONE
hi PmenuExtraSel guifg=#bdae93 guibg=#076678 gui=NONE cterm=NONE
+ hi PmenuMatch guifg=#8f3f71 guibg=#e5d4b1 gui=NONE cterm=NONE
+ hi PmenuMatchSel guifg=#d3869b guibg=#076678 gui=bold cterm=bold
hi SpecialKey guifg=#928374 guibg=NONE gui=NONE cterm=NONE
hi StatusLine guifg=#bdae93 guibg=#3c3836 gui=bold,reverse cterm=bold,reverse
hi StatusLineNC guifg=#ebdbb2 guibg=#3c3836 gui=reverse cterm=reverse
@@ -160,7 +165,7 @@ else
hi Visual guifg=#fbf1c7 guibg=#076678 gui=NONE cterm=NONE
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 Conceal guifg=#a89984 guibg=NONE gui=NONE cterm=NONE
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
@@ -218,7 +223,7 @@ endif
if s:t_Co >= 256
if &background ==# 'dark'
hi Normal ctermfg=187 ctermbg=234 cterm=NONE
- hi CursorLineNr ctermfg=214 ctermbg=236 cterm=NONE
+ hi CursorLineNr ctermfg=214 ctermbg=234 cterm=bold
hi FoldColumn ctermfg=102 ctermbg=234 cterm=NONE
hi SignColumn ctermfg=102 ctermbg=234 cterm=NONE
hi VertSplit ctermfg=236 ctermbg=234 cterm=NONE
@@ -239,6 +244,8 @@ if s:t_Co >= 256
hi PmenuKindSel ctermfg=203 ctermbg=109 cterm=NONE
hi PmenuExtra ctermfg=102 ctermbg=237 cterm=NONE
hi PmenuExtraSel ctermfg=236 ctermbg=109 cterm=NONE
+ hi PmenuMatch ctermfg=132 ctermbg=237 cterm=NONE
+ hi PmenuMatchSel ctermfg=132 ctermbg=109 cterm=bold
hi SpecialKey ctermfg=102 ctermbg=NONE cterm=NONE
hi StatusLine ctermfg=239 ctermbg=187 cterm=bold,reverse
hi StatusLineNC ctermfg=237 ctermbg=102 cterm=reverse
@@ -250,7 +257,7 @@ if s:t_Co >= 256
hi Visual ctermfg=234 ctermbg=109 cterm=NONE
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 Conceal ctermfg=239 ctermbg=NONE cterm=NONE
hi Cursor ctermfg=234 ctermbg=230 cterm=NONE
hi DiffAdd ctermfg=142 ctermbg=234 cterm=reverse
hi DiffChange ctermfg=107 ctermbg=234 cterm=reverse
@@ -306,7 +313,7 @@ if s:t_Co >= 256
else
" Light background
hi Normal ctermfg=237 ctermbg=230 cterm=NONE
- hi CursorLineNr ctermfg=172 ctermbg=188 cterm=NONE
+ hi CursorLineNr ctermfg=172 ctermbg=230 cterm=bold
hi FoldColumn ctermfg=102 ctermbg=230 cterm=NONE
hi SignColumn ctermfg=237 ctermbg=230 cterm=NONE
hi VertSplit ctermfg=144 ctermbg=230 cterm=NONE
@@ -327,6 +334,8 @@ if s:t_Co >= 256
hi PmenuKindSel ctermfg=124 ctermbg=23 cterm=NONE
hi PmenuExtra ctermfg=243 ctermbg=188 cterm=NONE
hi PmenuExtraSel ctermfg=144 ctermbg=23 cterm=NONE
+ hi PmenuMatch ctermfg=126 ctermbg=188 cterm=NONE
+ hi PmenuMatchSel ctermfg=175 ctermbg=23 cterm=bold
hi SpecialKey ctermfg=102 ctermbg=NONE cterm=NONE
hi StatusLine ctermfg=144 ctermbg=237 cterm=bold,reverse
hi StatusLineNC ctermfg=187 ctermbg=237 cterm=reverse
@@ -338,7 +347,7 @@ if s:t_Co >= 256
hi Visual ctermfg=230 ctermbg=23 cterm=NONE
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 Conceal ctermfg=137 ctermbg=NONE cterm=NONE
hi Cursor ctermfg=230 ctermbg=235 cterm=NONE
hi DiffAdd ctermfg=64 ctermbg=230 cterm=reverse
hi DiffChange ctermfg=29 ctermbg=230 cterm=reverse
@@ -418,6 +427,8 @@ if s:t_Co >= 16
hi PmenuKindSel ctermfg=DarkRed ctermbg=Blue cterm=NONE
hi PmenuExtra ctermfg=gray ctermbg=DarkGray cterm=NONE
hi PmenuExtraSel ctermfg=Black ctermbg=Blue cterm=NONE
+ hi PmenuMatch ctermfg=White ctermbg=DarkGray cterm=bold
+ hi PmenuMatchSel ctermfg=Black ctermbg=Blue cterm=bold
hi SignColumn ctermfg=DarkGray ctermbg=NONE cterm=NONE
hi SpecialKey ctermfg=DarkGray ctermbg=NONE cterm=NONE
hi StatusLine ctermfg=gray ctermbg=Black cterm=bold,reverse
@@ -431,7 +442,7 @@ if s:t_Co >= 16
hi Visual ctermfg=Black ctermbg=Blue cterm=NONE
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 Conceal ctermfg=DarkGray ctermbg=NONE cterm=NONE
hi Cursor ctermfg=Black ctermbg=White cterm=NONE
hi DiffAdd ctermfg=Green ctermbg=Black cterm=reverse
hi DiffChange ctermfg=Cyan ctermbg=Black cterm=reverse
@@ -506,6 +517,8 @@ if s:t_Co >= 16
hi PmenuKindSel ctermfg=DarkRed ctermbg=Blue cterm=NONE
hi PmenuExtra ctermfg=DarkGray ctermbg=Grey cterm=NONE
hi PmenuExtraSel ctermfg=White ctermbg=Blue cterm=NONE
+ hi PmenuMatch ctermfg=Black ctermbg=Grey cterm=bold
+ hi PmenuMatchSel ctermfg=White ctermbg=Blue cterm=bold
hi SignColumn ctermfg=Grey ctermbg=NONE cterm=NONE
hi SpecialKey ctermfg=Grey ctermbg=NONE cterm=NONE
hi StatusLine ctermfg=DarkGray ctermbg=White cterm=bold,reverse
@@ -519,7 +532,7 @@ if s:t_Co >= 16
hi Visual ctermfg=White ctermbg=Blue cterm=NONE
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 Conceal ctermfg=Grey ctermbg=NONE cterm=NONE
hi Cursor ctermfg=White ctermbg=DarkGray cterm=NONE
hi DiffAdd ctermfg=Green ctermbg=White cterm=reverse
hi DiffChange ctermfg=Cyan ctermbg=White cterm=reverse
@@ -599,6 +612,8 @@ if s:t_Co >= 8
hi PmenuKindSel ctermfg=Red ctermbg=Blue cterm=NONE
hi PmenuExtra ctermfg=DarkGray ctermbg=White cterm=NONE
hi PmenuExtraSel ctermfg=DarkGray ctermbg=Blue cterm=NONE
+ hi PmenuMatch ctermfg=DarkGray ctermbg=White cterm=bold
+ hi PmenuMatchSel ctermfg=Black ctermbg=Blue cterm=bold
hi SignColumn ctermfg=gray ctermbg=NONE cterm=NONE
hi SpecialKey ctermfg=gray ctermbg=NONE cterm=NONE
hi StatusLine ctermfg=gray ctermbg=Black cterm=bold,reverse
@@ -612,7 +627,7 @@ if s:t_Co >= 8
hi Visual ctermfg=Black ctermbg=Blue cterm=NONE
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 Conceal ctermfg=DarkGray ctermbg=NONE cterm=NONE
hi Cursor ctermfg=Black ctermbg=White cterm=NONE
hi DiffAdd ctermfg=Green ctermbg=Black cterm=reverse
hi DiffChange ctermfg=Cyan ctermbg=Black cterm=reverse
@@ -687,6 +702,8 @@ if s:t_Co >= 8
hi PmenuKindSel ctermfg=Red ctermbg=Blue cterm=NONE
hi PmenuExtra ctermfg=Grey ctermbg=Black cterm=NONE
hi PmenuExtraSel ctermfg=Grey ctermbg=Blue cterm=NONE
+ hi PmenuMatch ctermfg=Grey ctermbg=Black cterm=bold
+ hi PmenuMatchSel ctermfg=White ctermbg=Blue cterm=bold
hi SignColumn ctermfg=Black ctermbg=NONE cterm=NONE
hi SpecialKey ctermfg=Black ctermbg=NONE cterm=NONE
hi StatusLine ctermfg=Black ctermbg=White cterm=bold,reverse
@@ -700,7 +717,7 @@ if s:t_Co >= 8
hi Visual ctermfg=White ctermbg=Blue cterm=NONE
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 Conceal ctermfg=Grey ctermbg=NONE cterm=NONE
hi Cursor ctermfg=White ctermbg=DarkGray cterm=NONE
hi DiffAdd ctermfg=Green ctermbg=White cterm=reverse
hi DiffChange ctermfg=Cyan ctermbg=White cterm=reverse
@@ -861,7 +878,7 @@ endif
" Color: bg1 #ebdbb2 187 Grey
" Color: bg2 #e5d4b1 188 Grey
" Color: bg3 #bdae93 144
-" Color: bg4 #a89984 137
+" Color: bg4 #a89984 137 Grey
" Color: bg5 #ebe1b7 229 Grey
" Color: bg6 #ffffd7 231 Grey
" Color: fg0 #282828 235 DarkGray
@@ -875,6 +892,7 @@ endif
" Color: yellow #b57614 172 Yellow
" Color: blue #076678 23 Blue
" Color: purple #8f3f71 126 Magenta
+" Color: lightpurple #d3869b 175 Magenta
" Color: aqua #427b58 29 Cyan
" Color: orange #ff5f00 202 Magenta
" Term colors: fg1 neutralred neutralgreen neutralyellow neutralblue neutralpurple neutralaqua fg4
diff --git a/runtime/colors/ron.vim b/runtime/colors/ron.vim
index 4d55f9978f..f847ff3dd4 100644
--- a/runtime/colors/ron.vim
+++ b/runtime/colors/ron.vim
@@ -3,7 +3,7 @@
" Maintainer: original maintainer Ron Aaron <ron@ronware.org>
" Website: https://www.github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 15 Dec 2023 20:05:41
+" Last Change: 2024 Aug 15
" Generated by Colortemplate v2.2.3
@@ -63,7 +63,7 @@ hi CursorColumn guifg=NONE guibg=#666666 gui=NONE cterm=NONE
hi CursorLine guifg=NONE guibg=#666666 gui=NONE cterm=NONE
hi CursorLineNr guifg=#ffff00 guibg=NONE gui=bold cterm=NONE
hi QuickFixLine guifg=#000000 guibg=#00cdcd gui=NONE cterm=NONE
-hi Conceal guifg=#e5e5e5 guibg=#a9a9a9 gui=NONE cterm=NONE
+hi Conceal guifg=#666666 guibg=NONE gui=NONE cterm=NONE
hi Cursor guifg=#ffffff guibg=#60a060 gui=NONE cterm=NONE
hi Directory guifg=#00ffff guibg=NONE gui=NONE cterm=NONE
hi EndOfBuffer guifg=#ffff00 guibg=#303030 gui=NONE cterm=NONE
@@ -80,6 +80,8 @@ hi Pmenu guifg=#ffffff guibg=#444444 gui=NONE cterm=NONE
hi PmenuSbar guifg=NONE guibg=#000000 gui=NONE cterm=NONE
hi PmenuSel guifg=#000000 guibg=#00cdcd gui=NONE cterm=NONE
hi PmenuThumb guifg=NONE guibg=#e5e5e5 gui=NONE cterm=NONE
+hi PmenuMatch guifg=#ff00ff guibg=#444444 gui=NONE cterm=NONE
+hi PmenuMatchSel guifg=#ff00ff guibg=#00cdcd gui=NONE cterm=NONE
hi Question guifg=#00ff00 guibg=#000000 gui=bold cterm=NONE
hi Search guifg=#000000 guibg=#a9a9a9 gui=bold cterm=NONE
hi SignColumn guifg=#00ffff guibg=NONE gui=NONE cterm=NONE
@@ -128,7 +130,7 @@ if s:t_Co >= 256
hi CursorLine ctermfg=NONE ctermbg=59 cterm=NONE
hi CursorLineNr ctermfg=226 ctermbg=NONE cterm=NONE
hi QuickFixLine ctermfg=16 ctermbg=44 cterm=NONE
- hi Conceal ctermfg=254 ctermbg=145 cterm=NONE
+ hi Conceal ctermfg=59 ctermbg=NONE cterm=NONE
hi Cursor ctermfg=231 ctermbg=71 cterm=NONE
hi Directory ctermfg=51 ctermbg=NONE cterm=NONE
hi EndOfBuffer ctermfg=226 ctermbg=236 cterm=NONE
@@ -145,6 +147,8 @@ if s:t_Co >= 256
hi PmenuSbar ctermfg=NONE ctermbg=16 cterm=NONE
hi PmenuSel ctermfg=16 ctermbg=44 cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=254 cterm=NONE
+ hi PmenuMatch ctermfg=201 ctermbg=238 cterm=NONE
+ hi PmenuMatchSel ctermfg=201 ctermbg=44 cterm=NONE
hi Question ctermfg=46 ctermbg=16 cterm=NONE
hi Search ctermfg=16 ctermbg=145 cterm=NONE
hi SignColumn ctermfg=51 ctermbg=NONE cterm=NONE
@@ -196,7 +200,7 @@ if s:t_Co >= 16
hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
hi CursorLineNr ctermfg=yellow ctermbg=NONE cterm=underline
hi QuickFixLine ctermfg=black ctermbg=darkcyan cterm=NONE
- hi Conceal ctermfg=grey ctermbg=grey cterm=NONE
+ hi Conceal ctermfg=darkgrey ctermbg=NONE cterm=NONE
hi Cursor ctermfg=white ctermbg=green cterm=NONE
hi Directory ctermfg=cyan ctermbg=NONE cterm=NONE
hi EndOfBuffer ctermfg=yellow ctermbg=darkgrey cterm=NONE
@@ -213,6 +217,8 @@ if s:t_Co >= 16
hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE
hi PmenuSel ctermfg=black ctermbg=darkcyan cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=grey cterm=NONE
+ hi PmenuMatch ctermfg=white ctermbg=darkgrey cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkcyan cterm=bold
hi Question ctermfg=green ctermbg=black cterm=NONE
hi Search ctermfg=black ctermbg=grey cterm=NONE
hi SignColumn ctermfg=cyan ctermbg=NONE cterm=NONE
@@ -280,6 +286,8 @@ if s:t_Co >= 8
hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE
hi PmenuSel ctermfg=black ctermbg=darkcyan cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=grey cterm=NONE
+ hi PmenuMatch ctermfg=grey ctermbg=darkgrey cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkcyan cterm=bold
hi Question ctermfg=darkgreen ctermbg=black cterm=bold
hi Search ctermfg=black ctermbg=grey cterm=NONE
hi SignColumn ctermfg=darkcyan ctermbg=NONE cterm=NONE
diff --git a/runtime/colors/shine.vim b/runtime/colors/shine.vim
index b4a8793589..f3697c9ad6 100644
--- a/runtime/colors/shine.vim
+++ b/runtime/colors/shine.vim
@@ -4,7 +4,7 @@
" Maintainer: Original maintainer is Yasuhiro Matsumoto <mattn@mail.goo.ne.jp>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 15 Dec 2023 20:05:41
+" Last Change: 2024 Aug 15
" Generated by Colortemplate v2.2.3
@@ -50,6 +50,8 @@ hi Pmenu guifg=#000000 guibg=#a8a8a8 gui=NONE cterm=NONE
hi PmenuSel guifg=#000000 guibg=#ffff60 gui=NONE cterm=NONE
hi PmenuSbar guifg=#ffffff guibg=#ffffff gui=NONE cterm=NONE
hi PmenuThumb guifg=#767676 guibg=#767676 gui=NONE cterm=NONE
+hi PmenuMatch guifg=#ff0000 guibg=#a8a8a8 gui=NONE cterm=NONE
+hi PmenuMatchSel guifg=#ff0000 guibg=#ffff60 gui=NONE cterm=NONE
hi TabLine guifg=#000000 guibg=#dadada gui=underline cterm=underline
hi TabLineFill guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse
hi TabLineSel guifg=#000000 guibg=#ffffff gui=bold cterm=bold
@@ -84,7 +86,7 @@ hi Statement guifg=#2e8b57 guibg=NONE gui=bold cterm=bold
hi Type guifg=#2e8b57 guibg=NONE gui=bold cterm=bold
hi Comment guifg=#a8a8a8 guibg=NONE gui=bold cterm=NONE
hi StorageClass guifg=#ff0000 guibg=NONE gui=bold cterm=bold
-hi Conceal guifg=#dadada guibg=#767676 gui=NONE cterm=NONE
+hi Conceal guifg=#add8e6 guibg=NONE gui=NONE cterm=NONE
hi Identifier guifg=#008b8b guibg=NONE gui=NONE cterm=NONE
hi Constant guifg=#a07070 guibg=NONE gui=NONE cterm=NONE
hi Number guifg=#a07070 guibg=NONE gui=bold cterm=bold
@@ -128,6 +130,8 @@ if s:t_Co >= 256
hi PmenuSel ctermfg=16 ctermbg=228 cterm=NONE
hi PmenuSbar ctermfg=231 ctermbg=231 cterm=NONE
hi PmenuThumb ctermfg=243 ctermbg=243 cterm=NONE
+ hi PmenuMatch ctermfg=196 ctermbg=248 cterm=NONE
+ hi PmenuMatchSel ctermfg=196 ctermbg=228 cterm=NONE
hi TabLine ctermfg=16 ctermbg=253 cterm=underline
hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
hi TabLineSel ctermfg=16 ctermbg=231 cterm=bold
@@ -162,7 +166,7 @@ if s:t_Co >= 256
hi Type ctermfg=29 ctermbg=NONE cterm=bold
hi Comment ctermfg=248 ctermbg=NONE cterm=NONE
hi StorageClass ctermfg=196 ctermbg=NONE cterm=bold
- hi Conceal ctermfg=253 ctermbg=243 cterm=NONE
+ hi Conceal ctermfg=153 ctermbg=NONE cterm=NONE
hi Identifier ctermfg=30 ctermbg=NONE cterm=NONE
hi Constant ctermfg=95 ctermbg=NONE cterm=NONE
hi Number ctermfg=95 ctermbg=NONE cterm=bold
@@ -197,6 +201,8 @@ if s:t_Co >= 16
hi PmenuSel ctermfg=black ctermbg=yellow cterm=NONE
hi PmenuSbar ctermfg=white ctermbg=white cterm=NONE
hi PmenuThumb ctermfg=darkgrey ctermbg=darkgrey cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=darkgrey cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=yellow cterm=bold
hi TabLine ctermfg=black ctermbg=grey cterm=underline
hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
hi TabLineSel ctermfg=black ctermbg=white cterm=bold
@@ -231,7 +237,7 @@ if s:t_Co >= 16
hi Type ctermfg=darkgreen ctermbg=NONE cterm=bold
hi Comment ctermfg=darkgrey ctermbg=NONE cterm=NONE
hi StorageClass ctermfg=red ctermbg=NONE cterm=bold
- hi Conceal ctermfg=grey ctermbg=darkgrey cterm=NONE
+ hi Conceal ctermfg=blue ctermbg=NONE cterm=NONE
hi Identifier ctermfg=darkcyan ctermbg=NONE cterm=NONE
hi Constant ctermfg=darkred ctermbg=NONE cterm=NONE
hi Number ctermfg=darkred ctermbg=NONE cterm=bold
@@ -266,6 +272,8 @@ if s:t_Co >= 8
hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE
hi PmenuSbar ctermfg=grey ctermbg=grey cterm=NONE
hi PmenuThumb ctermfg=black ctermbg=black cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=darkcyan cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold
hi TabLine ctermfg=black ctermbg=grey cterm=reverse
hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
hi TabLineSel ctermfg=grey ctermbg=black cterm=reverse
diff --git a/runtime/colors/slate.vim b/runtime/colors/slate.vim
index aab6208b26..c9ce78946b 100644
--- a/runtime/colors/slate.vim
+++ b/runtime/colors/slate.vim
@@ -4,7 +4,7 @@
" Maintainer: Original maintainer Ralph Amissah <ralph@amissah.com>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 15 Dec 2023 20:05:41
+" Last Change: 2024 Aug 15
" Generated by Colortemplate v2.2.3
@@ -38,10 +38,12 @@ hi StatusLineNC guifg=#666666 guibg=#afaf87 gui=NONE cterm=NONE
hi StatusLineTerm guifg=#000000 guibg=#afaf87 gui=NONE cterm=NONE
hi StatusLineTermNC guifg=#666666 guibg=#afaf87 gui=NONE cterm=NONE
hi VertSplit guifg=#666666 guibg=#afaf87 gui=NONE cterm=NONE
-hi PmenuSel guifg=#262626 guibg=#d7d787 gui=NONE cterm=NONE
hi Pmenu guifg=NONE guibg=#4a4a4a gui=NONE cterm=NONE
+hi PmenuSel guifg=#262626 guibg=#d7d787 gui=NONE cterm=NONE
hi PmenuSbar guifg=NONE guibg=#262626 gui=NONE cterm=NONE
hi PmenuThumb guifg=NONE guibg=#ffd700 gui=NONE cterm=NONE
+hi PmenuMatch guifg=#d7875f guibg=#4a4a4a gui=NONE cterm=NONE
+hi PmenuMatchSel guifg=#d7875f guibg=#d7d787 gui=NONE cterm=NONE
hi TabLineSel guifg=#000000 guibg=#afaf87 gui=NONE cterm=NONE
hi TabLine guifg=#666666 guibg=#333333 gui=NONE cterm=NONE
hi TabLineFill guifg=#ff8787 guibg=#333333 gui=NONE cterm=NONE
@@ -115,10 +117,12 @@ if s:t_Co >= 256
hi StatusLineTerm ctermfg=16 ctermbg=144 cterm=NONE
hi StatusLineTermNC ctermfg=241 ctermbg=144 cterm=NONE
hi VertSplit ctermfg=241 ctermbg=144 cterm=NONE
- hi PmenuSel ctermfg=235 ctermbg=186 cterm=NONE
hi Pmenu ctermfg=NONE ctermbg=239 cterm=NONE
+ hi PmenuSel ctermfg=235 ctermbg=186 cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=235 cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=220 cterm=NONE
+ hi PmenuMatch ctermfg=173 ctermbg=239 cterm=NONE
+ hi PmenuMatchSel ctermfg=173 ctermbg=186 cterm=NONE
hi TabLineSel ctermfg=16 ctermbg=144 cterm=NONE
hi TabLine ctermfg=241 ctermbg=236 cterm=NONE
hi TabLineFill ctermfg=210 ctermbg=236 cterm=NONE
@@ -185,10 +189,12 @@ if s:t_Co >= 16
hi StatusLineTerm ctermfg=white ctermbg=black cterm=bold,reverse
hi StatusLineTermNC ctermfg=black ctermbg=grey cterm=NONE
hi VertSplit ctermfg=darkgrey ctermbg=grey cterm=NONE
- hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE
hi Pmenu ctermfg=NONE ctermbg=darkgrey cterm=NONE
+ hi PmenuSel ctermfg=black ctermbg=darkmagenta cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=yellow cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=darkgrey cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkmagenta cterm=bold
hi TabLineSel ctermfg=black ctermbg=darkyellow cterm=NONE
hi TabLine ctermfg=grey ctermbg=darkgrey cterm=NONE
hi TabLineFill ctermfg=cyan ctermbg=darkgrey cterm=NONE
@@ -255,10 +261,12 @@ if s:t_Co >= 8
hi StatusLineTerm ctermfg=grey ctermbg=black cterm=bold,reverse
hi StatusLineTermNC ctermfg=grey ctermbg=black cterm=reverse
hi VertSplit ctermfg=grey ctermbg=black cterm=reverse
- hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE
hi Pmenu ctermfg=black ctermbg=darkcyan cterm=NONE
+ hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=darkyellow cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=darkcyan cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold
hi TabLineSel ctermfg=black ctermbg=darkyellow cterm=NONE
hi TabLine ctermfg=grey ctermbg=black cterm=reverse
hi TabLineFill ctermfg=grey ctermbg=black cterm=reverse
diff --git a/runtime/colors/sorbet.vim b/runtime/colors/sorbet.vim
index e4ef42469c..bd4fb7baf7 100644
--- a/runtime/colors/sorbet.vim
+++ b/runtime/colors/sorbet.vim
@@ -4,7 +4,7 @@
" Maintainer: Maxence Weynans <neutaaaaan@gmail.com>
" Website: https://github.com/vim/colorschemes
" License: Vim License (see `:help license`)`
-" Last Updated: Fri 15 Dec 2023 20:05:42
+" Last Change: 2024 Aug 05
" Generated by Colortemplate v2.2.3
@@ -56,6 +56,9 @@ if (has('termguicolors') && &termguicolors) || has('gui_running')
endfor
endif
hi Normal guifg=#dadada guibg=#161821 gui=NONE cterm=NONE
+hi Added guifg=#87d75f guibg=NONE gui=NONE cterm=NONE
+hi Changed guifg=#87afd7 guibg=NONE gui=NONE cterm=NONE
+hi Removed guifg=#d75f5f guibg=NONE gui=NONE cterm=NONE
hi ColorColumn guifg=NONE guibg=#262831 gui=NONE cterm=NONE
hi Conceal guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi CurSearch guifg=#ff5fff guibg=#000000 gui=reverse cterm=reverse
@@ -78,10 +81,12 @@ hi ModeMsg guifg=#dadada guibg=NONE gui=bold cterm=bold
hi MoreMsg guifg=#dadada guibg=NONE gui=NONE cterm=NONE
hi NonText guifg=#707070 guibg=NONE gui=NONE cterm=NONE
hi Pmenu guifg=#000000 guibg=#a6a8b1 gui=NONE cterm=NONE
+hi PmenuMatch guifg=#d7005f guibg=#a6a8b1 gui=NONE cterm=NONE
hi PmenuExtra guifg=#000000 guibg=#a6a8b1 gui=NONE cterm=NONE
hi PmenuKind guifg=#000000 guibg=#a6a8b1 gui=bold cterm=bold
hi PmenuSbar guifg=#707070 guibg=#5f5f87 gui=NONE cterm=NONE
hi PmenuSel guifg=#000000 guibg=#d7d7ff gui=NONE cterm=NONE
+hi PmenuMatchSel guifg=#d7005f guibg=#d7d7ff gui=bold cterm=bold
hi PmenuExtraSel guifg=#000000 guibg=#d7d7ff gui=NONE cterm=NONE
hi PmenuKindSel guifg=#000000 guibg=#d7d7ff gui=bold cterm=bold
hi PmenuThumb guifg=#dadada guibg=#d7d7ff gui=NONE cterm=NONE
@@ -120,11 +125,13 @@ hi Underlined guifg=#dadada guibg=NONE gui=underline cterm=underline
hi CursorIM guifg=#000000 guibg=#afff00 gui=NONE cterm=NONE
hi ToolbarLine guifg=NONE guibg=#000000 gui=NONE cterm=NONE
hi ToolbarButton guifg=#dadada guibg=#000000 gui=bold cterm=bold
-hi DiffRemoved guifg=#d75f5f guibg=NONE gui=NONE cterm=NONE
hi debugBreakpoint guifg=#8787af guibg=#000000 gui=bold,reverse cterm=bold,reverse
if s:t_Co >= 256
hi Normal ctermfg=253 ctermbg=233 cterm=NONE
+ hi Added ctermfg=113 ctermbg=NONE cterm=NONE
+ hi Changed ctermfg=110 ctermbg=NONE cterm=NONE
+ hi Removed ctermfg=167 ctermbg=NONE cterm=NONE
hi ColorColumn ctermfg=NONE ctermbg=235 cterm=NONE
hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
hi CurSearch ctermfg=207 ctermbg=16 cterm=reverse
@@ -147,10 +154,12 @@ if s:t_Co >= 256
hi MoreMsg ctermfg=253 ctermbg=NONE cterm=NONE
hi NonText ctermfg=242 ctermbg=NONE cterm=NONE
hi Pmenu ctermfg=16 ctermbg=248 cterm=NONE
+ hi PmenuMatch ctermfg=161 ctermbg=248 cterm=NONE
hi PmenuExtra ctermfg=16 ctermbg=248 cterm=NONE
hi PmenuKind ctermfg=16 ctermbg=248 cterm=bold
hi PmenuSbar ctermfg=242 ctermbg=60 cterm=NONE
hi PmenuSel ctermfg=16 ctermbg=189 cterm=NONE
+ hi PmenuMatchSel ctermfg=161 ctermbg=189 cterm=bold
hi PmenuExtraSel ctermfg=16 ctermbg=189 cterm=NONE
hi PmenuKindSel ctermfg=16 ctermbg=189 cterm=bold
hi PmenuThumb ctermfg=253 ctermbg=189 cterm=NONE
@@ -189,7 +198,6 @@ if s:t_Co >= 256
hi CursorIM ctermfg=16 ctermbg=154 cterm=NONE
hi ToolbarLine ctermfg=NONE ctermbg=16 cterm=NONE
hi ToolbarButton ctermfg=253 ctermbg=16 cterm=bold
- hi DiffRemoved ctermfg=167 ctermbg=NONE cterm=NONE
hi debugBreakpoint ctermfg=103 ctermbg=16 cterm=bold,reverse
unlet s:t_Co
finish
@@ -209,6 +217,9 @@ if s:t_Co >= 16
hi TabLine ctermfg=darkgrey ctermbg=NONE cterm=reverse
hi VertSplit ctermfg=darkgrey ctermbg=NONE cterm=NONE
hi Normal ctermfg=NONE 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
hi ColorColumn ctermfg=NONE ctermbg=NONE cterm=reverse
hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
hi Cursor ctermfg=NONE ctermbg=NONE cterm=reverse
@@ -225,9 +236,11 @@ if s:t_Co >= 16
hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
hi MoreMsg ctermfg=NONE ctermbg=NONE cterm=NONE
hi Pmenu ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi PmenuMatch ctermfg=NONE ctermbg=darkred cterm=reverse
hi PmenuExtra ctermfg=NONE ctermbg=NONE cterm=reverse
hi PmenuKind ctermfg=NONE ctermbg=NONE cterm=bold,reverse
hi PmenuSel ctermfg=NONE ctermbg=NONE cterm=bold
+ hi PmenuMatchSel ctermfg=darkred ctermbg=NONE cterm=bold
hi PmenuExtraSel ctermfg=NONE ctermbg=NONE cterm=bold
hi PmenuKindSel ctermfg=NONE ctermbg=NONE cterm=bold
hi PmenuThumb ctermfg=NONE ctermbg=NONE cterm=NONE
@@ -261,7 +274,6 @@ if s:t_Co >= 16
hi CursorIM ctermfg=NONE ctermbg=NONE cterm=NONE
hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=reverse
hi ToolbarButton ctermfg=NONE ctermbg=NONE cterm=bold,reverse
- hi DiffRemoved ctermfg=darkred ctermbg=NONE cterm=NONE
hi debugBreakpoint ctermfg=NONE ctermbg=NONE cterm=bold,reverse
unlet s:t_Co
finish
@@ -281,6 +293,9 @@ if s:t_Co >= 8
hi TabLine ctermfg=NONE ctermbg=NONE cterm=bold,underline
hi VertSplit ctermfg=NONE ctermbg=NONE cterm=NONE
hi Normal ctermfg=NONE 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
hi ColorColumn ctermfg=NONE ctermbg=NONE cterm=reverse
hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
hi Cursor ctermfg=NONE ctermbg=NONE cterm=reverse
@@ -297,9 +312,11 @@ if s:t_Co >= 8
hi ModeMsg ctermfg=NONE ctermbg=NONE cterm=bold
hi MoreMsg ctermfg=NONE ctermbg=NONE cterm=NONE
hi Pmenu ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi PmenuMatch ctermfg=NONE ctermbg=darkred cterm=reverse
hi PmenuExtra ctermfg=NONE ctermbg=NONE cterm=reverse
hi PmenuKind ctermfg=NONE ctermbg=NONE cterm=bold,reverse
hi PmenuSel ctermfg=NONE ctermbg=NONE cterm=bold
+ hi PmenuMatchSel ctermfg=darkred ctermbg=NONE cterm=bold
hi PmenuExtraSel ctermfg=NONE ctermbg=NONE cterm=bold
hi PmenuKindSel ctermfg=NONE ctermbg=NONE cterm=bold
hi PmenuThumb ctermfg=NONE ctermbg=NONE cterm=NONE
@@ -333,7 +350,6 @@ if s:t_Co >= 8
hi CursorIM ctermfg=NONE ctermbg=NONE cterm=NONE
hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=reverse
hi ToolbarButton ctermfg=NONE ctermbg=NONE cterm=bold,reverse
- hi DiffRemoved ctermfg=darkred ctermbg=NONE cterm=NONE
hi debugBreakpoint ctermfg=NONE ctermbg=NONE cterm=bold,reverse
unlet s:t_Co
finish
diff --git a/runtime/colors/torte.vim b/runtime/colors/torte.vim
index 36da28e596..7271188f0d 100644
--- a/runtime/colors/torte.vim
+++ b/runtime/colors/torte.vim
@@ -4,7 +4,7 @@
" Maintainer: Original maintainer Thorsten Maerz <info@netztorte.de>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 15 Dec 2023 20:05:42
+" Last Change: 2024 Aug 15
" Generated by Colortemplate v2.2.3
@@ -53,7 +53,7 @@ hi CursorLineNr guifg=#ffff00 guibg=#666666 gui=NONE cterm=NONE
hi SignColumn guifg=#00ffff guibg=NONE gui=NONE cterm=NONE
hi FoldColumn guifg=#00ffff guibg=NONE gui=NONE cterm=NONE
hi ColorColumn guifg=#cccccc guibg=#8b0000 gui=NONE cterm=NONE
-hi Conceal guifg=#e5e5e5 guibg=#a9a9a9 gui=NONE cterm=NONE
+hi Conceal guifg=#666666 guibg=NONE gui=NONE cterm=NONE
hi Cursor guifg=#000000 guibg=#00ff00 gui=bold cterm=NONE
hi lCursor guifg=#000000 guibg=#e5e5e5 gui=NONE cterm=NONE
hi CursorIM guifg=NONE guibg=fg gui=NONE cterm=NONE
@@ -86,6 +86,8 @@ hi TabLineFill guifg=NONE guibg=#000000 gui=reverse cterm=reverse
hi TabLineSel guifg=#cccccc guibg=#000000 gui=bold cterm=bold
hi ToolbarLine guifg=NONE guibg=#000000 gui=NONE cterm=NONE
hi ToolbarButton guifg=#000000 guibg=#e5e5e5 gui=bold cterm=bold
+hi PmenuMatch guifg=#ff00ff guibg=#303030 gui=NONE cterm=NONE
+hi PmenuMatchSel guifg=#ff00ff guibg=#ffff00 gui=NONE cterm=NONE
hi Pmenu guifg=fg guibg=#303030 gui=NONE cterm=NONE
hi PmenuSbar guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuSel guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE
@@ -126,7 +128,7 @@ if s:t_Co >= 256
hi SignColumn ctermfg=51 ctermbg=NONE cterm=NONE
hi FoldColumn ctermfg=51 ctermbg=NONE cterm=NONE
hi ColorColumn ctermfg=251 ctermbg=88 cterm=NONE
- hi Conceal ctermfg=254 ctermbg=248 cterm=NONE
+ hi Conceal ctermfg=242 ctermbg=NONE cterm=NONE
hi Cursor ctermfg=16 ctermbg=46 cterm=NONE
hi lCursor ctermfg=16 ctermbg=254 cterm=NONE
hi CursorIM ctermfg=NONE ctermbg=fg cterm=NONE
@@ -159,6 +161,8 @@ if s:t_Co >= 256
hi TabLineSel ctermfg=251 ctermbg=16 cterm=bold
hi ToolbarLine ctermfg=NONE ctermbg=16 cterm=NONE
hi ToolbarButton ctermfg=16 ctermbg=254 cterm=bold
+ hi PmenuMatch ctermfg=201 ctermbg=236 cterm=NONE
+ hi PmenuMatchSel ctermfg=201 ctermbg=226 cterm=NONE
hi Pmenu ctermfg=fg ctermbg=236 cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuSel ctermfg=16 ctermbg=226 cterm=NONE
@@ -192,7 +196,7 @@ if s:t_Co >= 16
hi SignColumn ctermfg=cyan ctermbg=NONE cterm=NONE
hi FoldColumn ctermfg=cyan ctermbg=NONE cterm=NONE
hi ColorColumn ctermfg=white ctermbg=darkred cterm=NONE
- hi Conceal ctermfg=grey ctermbg=grey cterm=NONE
+ hi Conceal ctermfg=grey ctermbg=NONE cterm=NONE
hi Cursor ctermfg=black ctermbg=green cterm=NONE
hi lCursor ctermfg=black ctermbg=grey cterm=NONE
hi CursorIM ctermfg=NONE ctermbg=fg cterm=NONE
@@ -225,6 +229,8 @@ if s:t_Co >= 16
hi TabLineSel ctermfg=white ctermbg=black cterm=bold
hi ToolbarLine ctermfg=NONE ctermbg=black cterm=NONE
hi ToolbarButton ctermfg=black ctermbg=grey cterm=bold
+ hi PmenuMatch ctermfg=fg ctermbg=darkgrey cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=yellow cterm=bold
hi Pmenu ctermfg=fg ctermbg=darkgrey cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuSel ctermfg=black ctermbg=yellow cterm=NONE
@@ -292,6 +298,8 @@ if s:t_Co >= 8
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=darkmagenta cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=darkcyan cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold
hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
hi DiffChange ctermfg=white ctermbg=darkblue cterm=NONE
hi DiffText ctermfg=black ctermbg=grey cterm=NONE
diff --git a/runtime/colors/vim.lua b/runtime/colors/vim.lua
index 7231418f5f..5b9309ab38 100644
--- a/runtime/colors/vim.lua
+++ b/runtime/colors/vim.lua
@@ -56,6 +56,8 @@ hi('CursorLineFold', { link = 'FoldColumn' })
hi('CurSearch', { link = 'Search' })
hi('PmenuKind', { link = 'Pmenu' })
hi('PmenuKindSel', { link = 'PmenuSel' })
+hi('PmenuMatch', { link = 'Pmenu' })
+hi('PmenuMatchSel', { link = 'PmenuSel' })
hi('PmenuExtra', { link = 'Pmenu' })
hi('PmenuExtraSel', { link = 'PmenuSel' })
hi('Substitute', { link = 'Search' })
@@ -209,81 +211,85 @@ 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' })
+ 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('StatusLineTerm', { fg = 'White', bg = 'DarkGreen', bold = true, ctermfg = 'White', ctermbg = 'DarkGreen', cterm = { bold = true } })
+ hi('StatusLineTermNC', { fg = 'White', bg = 'DarkGreen', ctermfg = 'White', ctermbg = 'DarkGreen' })
+ 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' })
+ 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('StatusLineTerm', { fg = 'Black', bg = 'LightGreen', bold = true, ctermfg = 'Black', ctermbg = 'LightGreen', cterm = { bold = true } })
+ hi('StatusLineTermNC', { fg = 'Black', bg = 'LightGreen', ctermfg = 'Black', ctermbg = 'LightGreen' })
+ 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 c47a66d148..47ca5a1408 100644
--- a/runtime/colors/wildcharm.vim
+++ b/runtime/colors/wildcharm.vim
@@ -4,7 +4,7 @@
" Maintainer: Maxim Kim <habamax@gmail.com>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Mon 08 Jan 2024 09:40:36 AM AEDT
+" Last Change: 2024 Aug 15
" Generated by Colortemplate v2.2.3
@@ -31,14 +31,14 @@ if &background ==# 'dark'
endfor
endif
hi Normal guifg=#d0d0d0 guibg=#000000 gui=NONE cterm=NONE
- hi Statusline guifg=#d0d0d0 guibg=#000000 gui=reverse cterm=reverse
+ hi Statusline guifg=#9e9e9e guibg=#000000 gui=bold,reverse cterm=bold,reverse
hi StatuslineNC guifg=#767676 guibg=#000000 gui=reverse cterm=reverse
- hi VertSplit guifg=#767676 guibg=#767676 gui=NONE cterm=NONE
- hi TabLine guifg=#000000 guibg=#d0d0d0 gui=NONE cterm=NONE
- hi TabLineFill guifg=NONE guibg=#767676 gui=NONE cterm=NONE
- hi TabLineSel guifg=#ffffff guibg=#000000 gui=NONE cterm=NONE
+ hi VertSplit guifg=#767676 guibg=NONE gui=NONE cterm=NONE
+ hi TabLine guifg=#000000 guibg=#767676 gui=NONE cterm=NONE
+ hi TabLineFill guifg=NONE guibg=#000000 gui=NONE cterm=NONE
+ hi TabLineSel guifg=#000000 guibg=#9e9e9e gui=bold cterm=bold
hi ToolbarLine guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
- hi ToolbarButton guifg=#000000 guibg=#ffffff gui=NONE cterm=NONE
+ hi ToolbarButton guifg=#000000 guibg=#d0d0d0 gui=NONE cterm=NONE
hi QuickFixLine guifg=#000000 guibg=#ff87ff gui=NONE cterm=NONE
hi CursorLineNr guifg=#ffffff guibg=NONE gui=bold cterm=bold
hi LineNr guifg=#585858 guibg=NONE gui=NONE cterm=NONE
@@ -48,13 +48,15 @@ if &background ==# 'dark'
hi EndOfBuffer guifg=#585858 guibg=NONE gui=NONE cterm=NONE
hi EndOfBuffer guifg=#767676 guibg=NONE gui=NONE cterm=NONE
hi Pmenu guifg=#d0d0d0 guibg=#303030 gui=NONE cterm=NONE
- hi PmenuSel guifg=#000000 guibg=#ffaf00 gui=NONE cterm=NONE
+ hi PmenuSel guifg=#d0d0d0 guibg=#585858 gui=NONE cterm=NONE
hi PmenuThumb guifg=NONE guibg=#d0d0d0 gui=NONE cterm=NONE
hi PmenuSbar guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuKind guifg=#ff5f87 guibg=#303030 gui=NONE cterm=NONE
- hi PmenuKindSel guifg=#d7005f guibg=#ffaf00 gui=NONE cterm=NONE
+ hi PmenuKindSel guifg=#ff5f87 guibg=#585858 gui=NONE cterm=NONE
hi PmenuExtra guifg=#767676 guibg=#303030 gui=NONE cterm=NONE
- hi PmenuExtraSel guifg=#000000 guibg=#ffaf00 gui=NONE cterm=NONE
+ hi PmenuExtraSel guifg=#767676 guibg=#585858 gui=NONE cterm=NONE
+ hi PmenuMatch guifg=#d787d7 guibg=#303030 gui=NONE cterm=NONE
+ hi PmenuMatchSel guifg=#d787d7 guibg=#585858 gui=NONE cterm=NONE
hi SignColumn guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi Error guifg=#d7005f guibg=#ffffff gui=reverse cterm=reverse
hi ErrorMsg guifg=#d7005f guibg=#ffffff gui=reverse cterm=reverse
@@ -70,7 +72,7 @@ if &background ==# 'dark'
hi debugBreakpoint guifg=#00afaf guibg=NONE gui=reverse cterm=reverse
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 Visual guifg=#5fd7ff 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
@@ -92,7 +94,7 @@ if &background ==# 'dark'
hi Underlined guifg=NONE guibg=NONE gui=underline ctermfg=NONE ctermbg=NONE cterm=underline
hi Title guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold
hi Directory guifg=#00afff guibg=NONE gui=bold cterm=bold
- hi Conceal guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Conceal guifg=#585858 guibg=NONE gui=NONE cterm=NONE
hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi DiffAdd guifg=#afffaf guibg=#5f875f gui=NONE cterm=NONE
hi DiffChange guifg=#d0d0d0 guibg=#5f5f5f gui=NONE cterm=NONE
@@ -111,14 +113,14 @@ else
endfor
endif
hi Normal guifg=#000000 guibg=#ffffff gui=NONE cterm=NONE
- hi Statusline guifg=#ffffff guibg=#5f5f5f gui=NONE cterm=NONE
+ hi Statusline guifg=#ffffff guibg=#5f5f5f gui=bold cterm=bold
hi StatuslineNC guifg=#000000 guibg=#d0d0d0 gui=NONE cterm=NONE
- hi VertSplit guifg=#d0d0d0 guibg=#d0d0d0 gui=NONE cterm=NONE
+ hi VertSplit guifg=#5f5f5f guibg=NONE gui=NONE cterm=NONE
hi TabLine guifg=#000000 guibg=#d0d0d0 gui=NONE cterm=NONE
- hi TabLineFill guifg=NONE guibg=#808080 gui=NONE cterm=NONE
- hi TabLineSel guifg=#ffffff guibg=#000000 gui=reverse cterm=reverse
+ hi TabLineFill guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi TabLineSel guifg=#5f5f5f guibg=#ffffff gui=bold,reverse cterm=bold,reverse
hi ToolbarLine guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
- hi ToolbarButton guifg=#ffffff guibg=#000000 gui=NONE cterm=NONE
+ hi ToolbarButton guifg=#ffffff guibg=#5f5f5f gui=NONE cterm=NONE
hi QuickFixLine guifg=#ffffff guibg=#870087 gui=NONE cterm=NONE
hi CursorLineNr guifg=#000000 guibg=NONE gui=bold cterm=bold
hi LineNr guifg=#b2b2b2 guibg=NONE gui=NONE cterm=NONE
@@ -127,13 +129,15 @@ else
hi EndOfBuffer guifg=#b2b2b2 guibg=NONE gui=NONE cterm=NONE
hi SpecialKey guifg=#b2b2b2 guibg=NONE gui=NONE cterm=NONE
hi Pmenu guifg=#000000 guibg=#e4e4e4 gui=NONE cterm=NONE
- hi PmenuSel guifg=#ffffff guibg=#d78700 gui=NONE cterm=NONE
+ hi PmenuSel guifg=#000000 guibg=#b2b2b2 gui=NONE cterm=NONE
hi PmenuThumb guifg=NONE guibg=#808080 gui=NONE cterm=NONE
hi PmenuSbar guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuKind guifg=#d70000 guibg=#e4e4e4 gui=NONE cterm=NONE
- hi PmenuKindSel guifg=#af0000 guibg=#d78700 gui=NONE cterm=NONE
+ hi PmenuKindSel guifg=#d70000 guibg=#b2b2b2 gui=NONE cterm=NONE
hi PmenuExtra guifg=#808080 guibg=#e4e4e4 gui=NONE cterm=NONE
- hi PmenuExtraSel guifg=#ffffff guibg=#d78700 gui=NONE cterm=NONE
+ hi PmenuExtraSel guifg=#808080 guibg=#b2b2b2 gui=NONE cterm=NONE
+ hi PmenuMatch guifg=#870087 guibg=#e4e4e4 gui=NONE cterm=NONE
+ hi PmenuMatchSel guifg=#870087 guibg=#b2b2b2 gui=NONE cterm=NONE
hi SignColumn guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi Error guifg=#d70000 guibg=#ffffff gui=reverse cterm=reverse
hi ErrorMsg guifg=#d70000 guibg=#ffffff gui=reverse cterm=reverse
@@ -141,7 +145,7 @@ else
hi MoreMsg guifg=#008700 guibg=NONE gui=NONE cterm=NONE
hi Question guifg=#870087 guibg=NONE gui=NONE cterm=NONE
hi WarningMsg guifg=#af5f00 guibg=NONE gui=NONE cterm=NONE
- hi Todo guifg=#8700ff guibg=#ffffff gui=reverse cterm=reverse
+ hi Todo guifg=#5f00d7 guibg=#ffffff gui=reverse cterm=reverse
hi Search guifg=#ffffff guibg=#008700 gui=NONE cterm=NONE
hi IncSearch guifg=#ffffff guibg=#d78700 gui=NONE cterm=NONE
hi WildMenu guifg=#ffffff guibg=#d78700 gui=NONE cterm=NONE
@@ -167,11 +171,11 @@ else
hi Statement guifg=#005faf guibg=NONE gui=NONE cterm=NONE
hi Type guifg=#af5f00 guibg=NONE gui=NONE cterm=NONE
hi PreProc guifg=#008787 guibg=NONE gui=NONE cterm=NONE
- hi Special guifg=#8700ff guibg=NONE gui=NONE cterm=NONE
+ hi Special guifg=#5f00d7 guibg=NONE gui=NONE cterm=NONE
hi Underlined guifg=NONE guibg=NONE gui=underline ctermfg=NONE ctermbg=NONE cterm=underline
hi Title guifg=NONE guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=bold
hi Directory guifg=#005faf guibg=NONE gui=bold cterm=bold
- hi Conceal guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Conceal guifg=#b2b2b2 guibg=NONE gui=NONE cterm=NONE
hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi DiffAdd guifg=#005f00 guibg=#afd7af gui=NONE cterm=NONE
hi DiffChange guifg=#262626 guibg=#dadada gui=NONE cterm=NONE
@@ -193,14 +197,14 @@ if s:t_Co >= 256
hi! link CurSearch IncSearch
if &background ==# 'dark'
hi Normal ctermfg=252 ctermbg=16 cterm=NONE
- hi Statusline ctermfg=252 ctermbg=16 cterm=reverse
+ hi Statusline ctermfg=247 ctermbg=16 cterm=bold,reverse
hi StatuslineNC ctermfg=243 ctermbg=16 cterm=reverse
- hi VertSplit ctermfg=243 ctermbg=243 cterm=NONE
- hi TabLine ctermfg=16 ctermbg=252 cterm=NONE
- hi TabLineFill ctermfg=NONE ctermbg=243 cterm=NONE
- hi TabLineSel ctermfg=231 ctermbg=16 cterm=NONE
+ hi VertSplit ctermfg=243 ctermbg=NONE cterm=NONE
+ hi TabLine ctermfg=16 ctermbg=243 cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=16 cterm=NONE
+ hi TabLineSel ctermfg=16 ctermbg=247 cterm=bold
hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
- hi ToolbarButton ctermfg=16 ctermbg=231 cterm=NONE
+ hi ToolbarButton ctermfg=16 ctermbg=252 cterm=NONE
hi QuickFixLine ctermfg=16 ctermbg=213 cterm=NONE
hi CursorLineNr ctermfg=231 ctermbg=NONE cterm=bold
hi LineNr ctermfg=240 ctermbg=NONE cterm=NONE
@@ -210,13 +214,15 @@ if s:t_Co >= 256
hi EndOfBuffer ctermfg=240 ctermbg=NONE cterm=NONE
hi EndOfBuffer ctermfg=243 ctermbg=NONE cterm=NONE
hi Pmenu ctermfg=252 ctermbg=236 cterm=NONE
- hi PmenuSel ctermfg=16 ctermbg=214 cterm=NONE
+ hi PmenuSel ctermfg=252 ctermbg=240 cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=252 cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuKind ctermfg=204 ctermbg=236 cterm=NONE
- hi PmenuKindSel ctermfg=161 ctermbg=214 cterm=NONE
+ hi PmenuKindSel ctermfg=204 ctermbg=240 cterm=NONE
hi PmenuExtra ctermfg=243 ctermbg=236 cterm=NONE
- hi PmenuExtraSel ctermfg=16 ctermbg=214 cterm=NONE
+ hi PmenuExtraSel ctermfg=243 ctermbg=240 cterm=NONE
+ hi PmenuMatch ctermfg=176 ctermbg=236 cterm=NONE
+ hi PmenuMatchSel ctermfg=176 ctermbg=240 cterm=NONE
hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
hi Error ctermfg=161 ctermbg=231 cterm=reverse
hi ErrorMsg ctermfg=161 ctermbg=231 cterm=reverse
@@ -230,17 +236,17 @@ 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=32 ctermbg=16 cterm=reverse
+ hi Visual ctermfg=81 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
hi Folded ctermfg=243 ctermbg=236 cterm=NONE
hi ColorColumn ctermfg=NONE ctermbg=236 cterm=NONE
hi MatchParen ctermfg=199 ctermbg=NONE cterm=bold
- hi SpellBad ctermfg=161 ctermbg=231 cterm=reverse
- hi SpellCap ctermfg=37 ctermbg=16 cterm=reverse
- hi SpellLocal ctermfg=41 ctermbg=16 cterm=reverse
- hi SpellRare ctermfg=213 ctermbg=16 cterm=reverse
+ hi SpellBad ctermfg=161 ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=37 ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=41 ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=213 ctermbg=NONE cterm=underline
hi Comment ctermfg=243 ctermbg=NONE cterm=NONE
hi Constant ctermfg=204 ctermbg=NONE cterm=NONE
hi String ctermfg=41 ctermbg=NONE cterm=NONE
@@ -252,7 +258,7 @@ if s:t_Co >= 256
hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
hi Title ctermfg=NONE ctermbg=NONE cterm=bold
hi Directory ctermfg=39 ctermbg=NONE cterm=bold
- hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=240 ctermbg=NONE cterm=NONE
hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
hi DiffAdd ctermfg=157 ctermbg=65 cterm=NONE
hi DiffChange ctermfg=252 ctermbg=59 cterm=NONE
@@ -264,14 +270,14 @@ if s:t_Co >= 256
else
" Light background
hi Normal ctermfg=16 ctermbg=231 cterm=NONE
- hi Statusline ctermfg=231 ctermbg=59 cterm=NONE
+ hi Statusline ctermfg=231 ctermbg=59 cterm=bold
hi StatuslineNC ctermfg=16 ctermbg=252 cterm=NONE
- hi VertSplit ctermfg=252 ctermbg=252 cterm=NONE
+ hi VertSplit ctermfg=59 ctermbg=NONE cterm=NONE
hi TabLine ctermfg=16 ctermbg=252 cterm=NONE
- hi TabLineFill ctermfg=NONE ctermbg=240 cterm=NONE
- hi TabLineSel ctermfg=231 ctermbg=16 cterm=reverse
+ hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi TabLineSel ctermfg=59 ctermbg=231 cterm=bold,reverse
hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
- hi ToolbarButton ctermfg=231 ctermbg=16 cterm=NONE
+ hi ToolbarButton ctermfg=231 ctermbg=59 cterm=NONE
hi QuickFixLine ctermfg=231 ctermbg=90 cterm=NONE
hi CursorLineNr ctermfg=16 ctermbg=NONE cterm=bold
hi LineNr ctermfg=249 ctermbg=NONE cterm=NONE
@@ -280,13 +286,15 @@ if s:t_Co >= 256
hi EndOfBuffer ctermfg=249 ctermbg=NONE cterm=NONE
hi SpecialKey ctermfg=249 ctermbg=NONE cterm=NONE
hi Pmenu ctermfg=16 ctermbg=254 cterm=NONE
- hi PmenuSel ctermfg=231 ctermbg=172 cterm=NONE
+ hi PmenuSel ctermfg=16 ctermbg=249 cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=240 cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuKind ctermfg=160 ctermbg=254 cterm=NONE
- hi PmenuKindSel ctermfg=124 ctermbg=172 cterm=NONE
+ hi PmenuKindSel ctermfg=160 ctermbg=249 cterm=NONE
hi PmenuExtra ctermfg=240 ctermbg=254 cterm=NONE
- hi PmenuExtraSel ctermfg=231 ctermbg=172 cterm=NONE
+ hi PmenuExtraSel ctermfg=240 ctermbg=249 cterm=NONE
+ hi PmenuMatch ctermfg=90 ctermbg=254 cterm=NONE
+ hi PmenuMatchSel ctermfg=90 ctermbg=249 cterm=NONE
hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
hi Error ctermfg=160 ctermbg=231 cterm=reverse
hi ErrorMsg ctermfg=160 ctermbg=231 cterm=reverse
@@ -294,7 +302,7 @@ if s:t_Co >= 256
hi MoreMsg ctermfg=28 ctermbg=NONE cterm=NONE
hi Question ctermfg=90 ctermbg=NONE cterm=NONE
hi WarningMsg ctermfg=130 ctermbg=NONE cterm=NONE
- hi Todo ctermfg=93 ctermbg=231 cterm=reverse
+ hi Todo ctermfg=56 ctermbg=231 cterm=reverse
hi Search ctermfg=231 ctermbg=28 cterm=NONE
hi IncSearch ctermfg=231 ctermbg=172 cterm=NONE
hi WildMenu ctermfg=231 ctermbg=172 cterm=NONE
@@ -307,10 +315,10 @@ if s:t_Co >= 256
hi Folded ctermfg=240 ctermbg=254 cterm=NONE
hi ColorColumn ctermfg=NONE ctermbg=254 cterm=NONE
hi MatchParen ctermfg=199 ctermbg=NONE cterm=bold
- hi SpellBad ctermfg=160 ctermbg=231 cterm=reverse
- hi SpellCap ctermfg=30 ctermbg=231 cterm=reverse
- hi SpellLocal ctermfg=28 ctermbg=231 cterm=reverse
- hi SpellRare ctermfg=127 ctermbg=231 cterm=reverse
+ hi SpellBad ctermfg=160 ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=30 ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=28 ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=127 ctermbg=NONE cterm=underline
hi Comment ctermfg=245 ctermbg=NONE cterm=NONE
hi Constant ctermfg=124 ctermbg=NONE cterm=NONE
hi String ctermfg=28 ctermbg=NONE cterm=NONE
@@ -318,11 +326,11 @@ if s:t_Co >= 256
hi Statement ctermfg=25 ctermbg=NONE cterm=NONE
hi Type ctermfg=130 ctermbg=NONE cterm=NONE
hi PreProc ctermfg=30 ctermbg=NONE cterm=NONE
- hi Special ctermfg=93 ctermbg=NONE cterm=NONE
+ hi Special ctermfg=56 ctermbg=NONE cterm=NONE
hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
hi Title ctermfg=NONE ctermbg=NONE cterm=bold
hi Directory ctermfg=25 ctermbg=NONE cterm=bold
- hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=249 ctermbg=NONE cterm=NONE
hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
hi DiffAdd ctermfg=22 ctermbg=151 cterm=NONE
hi DiffChange ctermfg=235 ctermbg=253 cterm=NONE
@@ -339,14 +347,14 @@ endif
if s:t_Co >= 16
if &background ==# 'dark'
hi Normal ctermfg=grey ctermbg=black cterm=NONE
- hi Statusline ctermfg=grey ctermbg=black cterm=reverse
+ hi Statusline ctermfg=grey ctermbg=black cterm=bold,reverse
hi StatuslineNC ctermfg=darkgrey ctermbg=black cterm=reverse
- hi VertSplit ctermfg=darkgrey ctermbg=darkgrey cterm=NONE
- hi TabLine ctermfg=black ctermbg=grey cterm=NONE
- hi TabLineFill ctermfg=NONE ctermbg=darkgrey cterm=NONE
- hi TabLineSel ctermfg=white ctermbg=black cterm=NONE
+ hi VertSplit ctermfg=darkgrey ctermbg=NONE cterm=NONE
+ hi TabLine ctermfg=black ctermbg=darkgrey cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=black cterm=NONE
+ hi TabLineSel ctermfg=black ctermbg=grey cterm=bold
hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
- hi ToolbarButton ctermfg=black ctermbg=white cterm=NONE
+ hi ToolbarButton ctermfg=black ctermbg=grey cterm=NONE
hi QuickFixLine ctermfg=black ctermbg=magenta cterm=NONE
hi CursorLineNr ctermfg=white ctermbg=NONE cterm=bold
hi LineNr ctermfg=grey ctermbg=NONE cterm=NONE
@@ -362,6 +370,8 @@ if s:t_Co >= 16
hi PmenuKindSel ctermfg=darkred ctermbg=darkyellow cterm=NONE
hi PmenuExtra ctermfg=darkgrey ctermbg=grey cterm=NONE
hi PmenuExtraSel ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=grey cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold
hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
hi Error ctermfg=darkred ctermbg=white cterm=reverse
hi ErrorMsg ctermfg=darkred ctermbg=white cterm=reverse
@@ -375,17 +385,17 @@ 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=darkblue ctermbg=black cterm=reverse
+ hi Visual ctermfg=cyan 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
hi Folded ctermfg=black ctermbg=NONE cterm=bold
hi ColorColumn ctermfg=black ctermbg=darkyellow cterm=NONE
hi MatchParen ctermfg=NONE ctermbg=NONE cterm=bold,underline
- hi SpellBad ctermfg=darkred ctermbg=white cterm=reverse
- hi SpellCap ctermfg=darkcyan ctermbg=black cterm=reverse
- hi SpellLocal ctermfg=green ctermbg=black cterm=reverse
- hi SpellRare ctermfg=magenta ctermbg=black cterm=reverse
+ hi SpellBad ctermfg=darkred ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=darkcyan ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=green ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=magenta ctermbg=NONE cterm=underline
hi Comment ctermfg=darkgrey ctermbg=NONE cterm=NONE
hi Constant ctermfg=red ctermbg=NONE cterm=NONE
hi String ctermfg=green ctermbg=NONE cterm=NONE
@@ -397,7 +407,7 @@ if s:t_Co >= 16
hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
hi Title ctermfg=NONE ctermbg=NONE cterm=bold
hi Directory ctermfg=blue ctermbg=NONE cterm=bold
- hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=grey ctermbg=NONE cterm=NONE
hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
hi DiffAdd ctermfg=black ctermbg=darkgreen cterm=NONE
hi DiffChange ctermfg=black ctermbg=lightgray cterm=NONE
@@ -409,14 +419,14 @@ if s:t_Co >= 16
else
" Light background
hi Normal ctermfg=black ctermbg=white cterm=NONE
- hi Statusline ctermfg=white ctermbg=darkgrey cterm=NONE
+ hi Statusline ctermfg=white ctermbg=darkgrey cterm=bold
hi StatuslineNC ctermfg=black ctermbg=lightgrey cterm=NONE
- hi VertSplit ctermfg=lightgrey ctermbg=lightgrey cterm=NONE
+ hi VertSplit ctermfg=darkgrey ctermbg=NONE cterm=NONE
hi TabLine ctermfg=black ctermbg=lightgrey cterm=NONE
- hi TabLineFill ctermfg=NONE ctermbg=darkgrey cterm=NONE
- hi TabLineSel ctermfg=white ctermbg=black cterm=reverse
+ hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi TabLineSel ctermfg=darkgrey ctermbg=white cterm=bold,reverse
hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
- hi ToolbarButton ctermfg=white ctermbg=black cterm=NONE
+ hi ToolbarButton ctermfg=white ctermbg=darkgrey cterm=NONE
hi QuickFixLine ctermfg=white ctermbg=darkmagenta cterm=NONE
hi CursorLineNr ctermfg=black ctermbg=NONE cterm=bold
hi LineNr ctermfg=darkgrey ctermbg=NONE cterm=NONE
@@ -432,6 +442,8 @@ if s:t_Co >= 16
hi PmenuKindSel ctermfg=darkred ctermbg=darkyellow cterm=NONE
hi PmenuExtra ctermfg=darkgrey ctermbg=grey cterm=NONE
hi PmenuExtraSel ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=grey cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold
hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
hi Error ctermfg=red ctermbg=white cterm=reverse
hi ErrorMsg ctermfg=red ctermbg=white cterm=reverse
@@ -439,7 +451,7 @@ if s:t_Co >= 16
hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE
hi Question ctermfg=darkmagenta ctermbg=NONE cterm=NONE
hi WarningMsg ctermfg=darkyellow ctermbg=NONE cterm=NONE
- hi Todo ctermfg=darkred ctermbg=white cterm=reverse
+ hi Todo ctermfg=blue ctermbg=white cterm=reverse
hi Search ctermfg=white ctermbg=darkgreen cterm=NONE
hi IncSearch ctermfg=white ctermbg=yellow cterm=NONE
hi WildMenu ctermfg=white ctermbg=yellow cterm=NONE
@@ -452,10 +464,10 @@ if s:t_Co >= 16
hi Folded ctermfg=black ctermbg=NONE cterm=bold
hi ColorColumn ctermfg=black ctermbg=darkyellow cterm=NONE
hi MatchParen ctermfg=NONE ctermbg=NONE cterm=bold,underline
- hi SpellBad ctermfg=red ctermbg=white cterm=reverse
- hi SpellCap ctermfg=darkcyan ctermbg=white cterm=reverse
- hi SpellLocal ctermfg=darkgreen ctermbg=white cterm=reverse
- hi SpellRare ctermfg=magenta ctermbg=white cterm=reverse
+ hi SpellBad ctermfg=red ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=darkcyan ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=darkgreen ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=magenta ctermbg=NONE cterm=underline
hi Comment ctermfg=darkgrey ctermbg=NONE cterm=NONE
hi Constant ctermfg=darkred ctermbg=NONE cterm=NONE
hi String ctermfg=darkgreen ctermbg=NONE cterm=NONE
@@ -463,11 +475,11 @@ if s:t_Co >= 16
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=darkred ctermbg=NONE cterm=NONE
+ hi Special ctermfg=blue 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 Conceal ctermfg=darkgrey ctermbg=NONE cterm=NONE
hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
hi DiffAdd ctermfg=black ctermbg=darkgreen cterm=NONE
hi DiffChange ctermfg=black ctermbg=lightgray cterm=NONE
@@ -486,10 +498,10 @@ if s:t_Co >= 8
hi Normal ctermfg=grey ctermbg=black cterm=NONE
hi Statusline ctermfg=grey ctermbg=black cterm=bold,reverse
hi StatuslineNC ctermfg=black ctermbg=grey cterm=NONE
- hi VertSplit ctermfg=grey ctermbg=grey cterm=NONE
- hi TabLine ctermfg=grey ctermbg=black cterm=reverse
- hi TabLineFill ctermfg=NONE ctermbg=grey cterm=NONE
- hi TabLineSel ctermfg=grey ctermbg=black cterm=NONE
+ hi VertSplit ctermfg=grey ctermbg=NONE cterm=NONE
+ hi TabLine ctermfg=grey ctermbg=black cterm=NONE
+ hi TabLineFill ctermfg=grey ctermbg=NONE cterm=NONE
+ hi TabLineSel ctermfg=grey ctermbg=black cterm=bold,reverse
hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
hi ToolbarButton ctermfg=grey ctermbg=black cterm=bold,reverse
hi QuickFixLine ctermfg=black ctermbg=darkmagenta cterm=NONE
@@ -507,6 +519,8 @@ if s:t_Co >= 8
hi PmenuKindSel ctermfg=darkred ctermbg=darkyellow cterm=NONE
hi PmenuExtra ctermfg=black ctermbg=grey cterm=NONE
hi PmenuExtraSel ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=grey cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold
hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
hi Error ctermfg=grey ctermbg=darkred cterm=NONE
hi ErrorMsg ctermfg=grey ctermbg=darkred cterm=NONE
@@ -553,10 +567,10 @@ if s:t_Co >= 8
hi Normal ctermfg=black ctermbg=grey cterm=NONE
hi Statusline ctermfg=grey ctermbg=black cterm=bold
hi StatuslineNC ctermfg=grey ctermbg=darkgrey cterm=NONE
- hi VertSplit ctermfg=black ctermbg=black cterm=NONE
- hi TabLine ctermfg=black ctermbg=grey cterm=reverse
- hi TabLineFill ctermfg=NONE ctermbg=darkgrey cterm=NONE
- hi TabLineSel ctermfg=black ctermbg=grey cterm=NONE
+ hi VertSplit ctermfg=black ctermbg=NONE cterm=NONE
+ hi TabLine ctermfg=black ctermbg=grey cterm=NONE
+ hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=NONE
+ hi TabLineSel ctermfg=grey ctermbg=black cterm=bold
hi ToolbarLine ctermfg=NONE ctermbg=NONE cterm=NONE
hi ToolbarButton ctermfg=grey ctermbg=black cterm=bold
hi QuickFixLine ctermfg=black ctermbg=darkmagenta cterm=NONE
@@ -574,6 +588,8 @@ if s:t_Co >= 8
hi PmenuKindSel ctermfg=darkred ctermbg=darkyellow cterm=NONE
hi PmenuExtra ctermfg=grey ctermbg=black cterm=NONE
hi PmenuExtraSel ctermfg=black ctermbg=darkyellow cterm=NONE
+ hi PmenuMatch ctermfg=grey ctermbg=black cterm=bold
+ hi PmenuMatchSel ctermfg=NONE ctermbg=darkyellow cterm=bold
hi SignColumn ctermfg=NONE ctermbg=NONE cterm=NONE
hi Error ctermfg=white ctermbg=darkred cterm=NONE
hi ErrorMsg ctermfg=white ctermbg=darkred cterm=NONE
@@ -581,7 +597,7 @@ if s:t_Co >= 8
hi MoreMsg ctermfg=darkgreen ctermbg=NONE cterm=NONE
hi Question ctermfg=darkmagenta ctermbg=NONE cterm=NONE
hi WarningMsg ctermfg=darkyellow ctermbg=NONE cterm=NONE
- hi Todo ctermfg=darkred ctermbg=black cterm=reverse
+ hi Todo ctermfg=blue ctermbg=black cterm=reverse
hi Search ctermfg=darkgreen ctermbg=black cterm=reverse
hi IncSearch ctermfg=darkyellow ctermbg=black cterm=reverse
hi WildMenu ctermfg=black ctermbg=darkyellow cterm=NONE
@@ -715,6 +731,8 @@ endif
" Color: colorlC #ff5fff 207 magenta
" Color: colorDim #878787 102 grey
" Color: colorMP #ff00af 199 magenta
+" Color: colorV #5fd7ff 81 cyan
+" Color: colorSt #9e9e9e 247 grey
" Color: diffAdd #5f875f 65 darkgreen
" Color: diffAddFg #afffaf 157 black
" Color: diffDelete #875f5f 95 darkred
@@ -742,7 +760,7 @@ endif
" Color: color14 #00afaf 37 cyan
" Color: color07 #8a8a8a 245 grey
" Color: color15 #ffffff 231 white
-" Color: color16 #8700ff 93 darkred
+" Color: color16 #5f00d7 56 blue
" Color: colorCm #8a8a8a 245 darkgrey
" Color: colorLine #EEEEEE 255 grey
" Color: colorB #E4E4E4 254 grey
@@ -750,7 +768,7 @@ endif
" Color: colorTab #d0d0d0 252 lightgrey
" Color: colorC #000000 16 black
" Color: colorlC #FF00FF 201 magenta
-" Color: colorV #5F87AF 67 darkblue
+" Color: colorV #0087af 31 darkcyan
" Color: colorDim #626262 241 darkgrey
" Color: colorSt #5f5f5f 59 darkgrey
" Color: colorMP #ff00af 199 magenta
diff --git a/runtime/colors/zaibatsu.vim b/runtime/colors/zaibatsu.vim
index 726843345b..90c6104afe 100644
--- a/runtime/colors/zaibatsu.vim
+++ b/runtime/colors/zaibatsu.vim
@@ -4,7 +4,7 @@
" Maintainer: Romain Lafourcade <romainlafourcade@gmail.com>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 15 Dec 2023 20:05:43
+" Last Change: 2024 Aug 15
" Generated by Colortemplate v2.2.3
@@ -40,6 +40,8 @@ hi PmenuExtra guifg=#878092 guibg=#ffffff gui=NONE cterm=NONE
hi! link PmenuExtraSel PmenuSel
hi PmenuKind guifg=#878092 guibg=#ffffff gui=NONE cterm=NONE
hi! link PmenuKindSel PmenuSel
+hi PmenuMatch guifg=#d700ff guibg=#ffffff gui=NONE cterm=NONE
+hi PmenuMatchSel guifg=#d700ff guibg=#afafff gui=NONE cterm=NONE
hi ColorColumn guifg=NONE guibg=#510039 gui=NONE cterm=NONE
hi CursorLine guifg=NONE guibg=#362b49 gui=NONE cterm=NONE
hi CursorColumn guifg=NONE guibg=#362b49 gui=NONE cterm=NONE
@@ -143,6 +145,8 @@ if s:t_Co >= 256
hi! link PmenuExtraSel PmenuSel
hi PmenuKind ctermfg=103 ctermbg=231 cterm=NONE
hi! link PmenuKindSel PmenuSel
+ hi PmenuMatch ctermfg=165 ctermbg=231 cterm=NONE
+ hi PmenuMatchSel ctermfg=165 ctermbg=147 cterm=NONE
hi ColorColumn ctermfg=NONE ctermbg=52 cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=237 cterm=NONE
hi CursorColumn ctermfg=NONE ctermbg=237 cterm=NONE
@@ -249,6 +253,8 @@ if s:t_Co >= 16
hi! link PmenuExtraSel PmenuSel
hi PmenuKind ctermfg=darkgray ctermbg=white cterm=NONE
hi! link PmenuKindSel PmenuSel
+ hi PmenuMatch ctermfg=black ctermbg=white cterm=bold
+ hi PmenuMatchSel ctermfg=white ctermbg=blue cterm=bold
hi ColorColumn ctermfg=white ctermbg=darkred cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
hi CursorColumn ctermfg=NONE ctermbg=blue cterm=NONE
@@ -355,6 +361,8 @@ if s:t_Co >= 8
hi! link PmenuExtraSel PmenuSel
hi! link PmenuKind Pmenu
hi! link PmenuKindSel PmenuSel
+ hi PmenuMatch ctermfg=black ctermbg=white cterm=bold
+ hi PmenuMatchSel ctermfg=white ctermbg=blue cterm=bold
hi ColorColumn ctermfg=white ctermbg=darkred cterm=NONE
hi CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
hi CursorColumn ctermfg=NONE ctermbg=blue cterm=NONE
diff --git a/runtime/colors/zellner.vim b/runtime/colors/zellner.vim
index 37f012e92d..7781ca9ab8 100644
--- a/runtime/colors/zellner.vim
+++ b/runtime/colors/zellner.vim
@@ -4,7 +4,7 @@
" Maintainer: Original maintainer Ron Aaron <ron@ronware.org>
" Website: https://github.com/vim/colorschemes
" License: Same as Vim
-" Last Updated: Fri 15 Dec 2023 20:05:44
+" Last Change: 2024 Aug 15
" Generated by Colortemplate v2.2.3
@@ -47,6 +47,8 @@ hi Pmenu guifg=#000000 guibg=#dadada gui=NONE cterm=NONE
hi PmenuSel guifg=#000000 guibg=#ffff00 gui=NONE cterm=NONE
hi PmenuSbar guifg=NONE guibg=#ffffff gui=NONE cterm=NONE
hi PmenuThumb guifg=NONE guibg=#a9a9a9 gui=NONE cterm=NONE
+hi PmenuMatch guifg=#a52a2a guibg=#dadada gui=NONE cterm=NONE
+hi PmenuMatchSel guifg=#a52a2a guibg=#ffff00 gui=NONE cterm=NONE
hi TabLine guifg=#000000 guibg=#a9a9a9 gui=underline cterm=underline
hi TabLineFill guifg=NONE guibg=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse
hi TabLineSel guifg=#000000 guibg=#ffffff gui=bold cterm=bold
@@ -87,7 +89,7 @@ hi Type guifg=#0000ff guibg=NONE gui=NONE cterm=NONE
hi Special guifg=#ff00ff guibg=NONE gui=NONE cterm=NONE
hi Tag guifg=#006400 guibg=NONE gui=NONE cterm=NONE
hi Directory guifg=#0000ff guibg=NONE gui=bold cterm=bold
-hi Conceal guifg=#ff0000 guibg=NONE gui=NONE cterm=NONE
+hi Conceal guifg=#a9a9a9 guibg=NONE gui=NONE cterm=NONE
hi Ignore guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi Title guifg=#a020f0 guibg=NONE gui=bold cterm=bold
hi DiffAdd guifg=#ffffff guibg=#5f875f gui=NONE cterm=NONE
@@ -120,6 +122,8 @@ if s:t_Co >= 256
hi PmenuSel ctermfg=16 ctermbg=226 cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=231 cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=248 cterm=NONE
+ hi PmenuMatch ctermfg=124 ctermbg=253 cterm=NONE
+ hi PmenuMatchSel ctermfg=124 ctermbg=226 cterm=NONE
hi TabLine ctermfg=16 ctermbg=248 cterm=underline
hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
hi TabLineSel ctermfg=16 ctermbg=231 cterm=bold
@@ -160,7 +164,7 @@ if s:t_Co >= 256
hi Special ctermfg=201 ctermbg=NONE cterm=NONE
hi Tag ctermfg=22 ctermbg=NONE cterm=NONE
hi Directory ctermfg=21 ctermbg=NONE cterm=bold
- hi Conceal ctermfg=196 ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=248 ctermbg=NONE cterm=NONE
hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
hi Title ctermfg=129 ctermbg=NONE cterm=bold
hi DiffAdd ctermfg=231 ctermbg=65 cterm=NONE
@@ -188,6 +192,8 @@ if s:t_Co >= 16
hi PmenuSel ctermfg=black ctermbg=yellow cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=white cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=darkgrey cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=grey cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=yellow cterm=bold
hi TabLine ctermfg=black ctermbg=grey cterm=underline
hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
hi TabLineSel ctermfg=black ctermbg=white cterm=bold
@@ -228,7 +234,7 @@ if s:t_Co >= 16
hi Special ctermfg=magenta ctermbg=NONE cterm=NONE
hi Tag ctermfg=darkgreen ctermbg=NONE cterm=NONE
hi Directory ctermfg=blue ctermbg=NONE cterm=bold
- hi Conceal ctermfg=red ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=grey ctermbg=NONE cterm=NONE
hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
hi Title ctermfg=darkmagenta ctermbg=NONE cterm=bold
hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
@@ -256,6 +262,8 @@ if s:t_Co >= 8
hi PmenuSel ctermfg=black ctermbg=darkyellow cterm=NONE
hi PmenuSbar ctermfg=NONE ctermbg=black cterm=NONE
hi PmenuThumb ctermfg=NONE ctermbg=darkmagenta cterm=NONE
+ hi PmenuMatch ctermfg=black ctermbg=darkcyan cterm=bold
+ hi PmenuMatchSel ctermfg=black ctermbg=darkyellow cterm=bold
hi TabLine ctermfg=black ctermbg=gray cterm=reverse
hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=reverse
hi TabLineSel ctermfg=gray ctermbg=black cterm=bold,reverse
@@ -293,7 +301,7 @@ if s:t_Co >= 8
hi Type ctermfg=darkblue ctermbg=NONE cterm=bold
hi Special ctermfg=darkgreen ctermbg=NONE cterm=NONE
hi Directory ctermfg=darkblue ctermbg=NONE cterm=bold
- hi Conceal ctermfg=darkred ctermbg=NONE cterm=NONE
+ hi Conceal ctermfg=NONE ctermbg=NONE cterm=NONE
hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
hi Title ctermfg=darkmagenta ctermbg=NONE cterm=bold
hi DiffAdd ctermfg=white ctermbg=darkgreen cterm=NONE
diff --git a/runtime/compiler/README.txt b/runtime/compiler/README.txt
index dccf4a9762..327d0a7fde 100644
--- a/runtime/compiler/README.txt
+++ b/runtime/compiler/README.txt
@@ -4,6 +4,8 @@ They are used with the ":compiler" command.
These scripts usually set options, for example 'errorformat'.
See ":help write-compiler-plugin".
+To undo the effect of a compiler plugin, use the make compiler plugin.
+
If you want to write your own compiler plugin, have a look at the other files
for how to do it, the format is simple.
diff --git a/runtime/compiler/cppcheck.vim b/runtime/compiler/cppcheck.vim
new file mode 100644
index 0000000000..ed7c46e90f
--- /dev/null
+++ b/runtime/compiler/cppcheck.vim
@@ -0,0 +1,40 @@
+" vim compiler file
+" Compiler: cppcheck (C++ static checker)
+" Maintainer: Vincent B. (twinside@free.fr)
+" Last Change: 2024 Oct 4 by @Konfekt
+
+if exists("cppcheck")
+ finish
+endif
+let current_compiler = "cppcheck"
+
+let s:cpo_save = &cpo
+set cpo-=C
+
+if !exists('g:c_cppcheck_params')
+ let g:c_cppcheck_params = '--verbose --force --inline-suppr'
+ \ ..' '..'--enable=warning,style,performance,portability,information,missingInclude'
+ \ ..' '..(executable('getconf') ? '-j' .. systemlist('getconf _NPROCESSORS_ONLN')[0] : '')
+ let s:undo_compiler = 'unlet! g:c_cppcheck_params'
+endif
+
+let &l:makeprg = 'cppcheck --quiet'
+ \ ..' --template="{file}:{line}:{column}: {severity}: [{id}] {message} {callstack}"'
+ \ ..' '..get(b:, 'c_cppcheck_params',
+ \ g:c_cppcheck_params..' '..(&filetype ==# 'cpp' ? ' --language=c++' : ''))
+ \ ..' '..get(b:, 'c_cppcheck_includes', get(g:, 'c_cppcheck_includes',
+ \ (filereadable('compile_commands.json') ? '--project=compile_commands.json' :
+ \ (empty(&path) ? '' : '-I')..join(map(filter(split(&path, ','), 'isdirectory(v:val)'),'shellescape(v:val)'), ' -I'))))
+silent CompilerSet makeprg
+
+CompilerSet errorformat=
+ \%f:%l:%c:\ %tarning:\ %m,
+ \%f:%l:%c:\ %trror:\ %m,
+ \%f:%l:%c:\ %tnformation:\ %m,
+ \%f:%l:%c:\ %m,
+ \%.%#\ :\ [%f:%l]\ %m
+
+exe get(s:, 'undo_compiler', '')
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/compiler/groff.vim b/runtime/compiler/groff.vim
new file mode 100644
index 0000000000..640146d6a1
--- /dev/null
+++ b/runtime/compiler/groff.vim
@@ -0,0 +1,45 @@
+" Vim compiler file
+" Compiler: Groff
+" Maintainer: Konfekt
+" Last Change: 2024 Sep 8
+"
+" Expects output file extension, say `:make html` or `:make pdf`.
+" Supported devices as of Sept 2024 are: (x)html, pdf, ps, dvi, lj4, lbp ...
+" Adjust command-line flags, language, encoding by buffer-local/global variables
+" groff_compiler_args, groff_compiler_lang, and groff_compiler_encoding,
+" which default to '', &spelllang and 'utf8'.
+
+if exists("current_compiler")
+ finish
+endif
+
+let s:keepcpo = &cpo
+set cpo&vim
+
+let current_compiler = 'groff'
+
+silent! function s:groff_compiler_lang()
+ let lang = get(b:, 'groff_compiler_lang',
+ \ &spell ? matchstr(&spelllang, '^\a\a') : '')
+ if lang ==# 'en' | let lang = '' | endif
+ return empty(lang) ? '' : '-m'..lang
+endfunction
+
+" Requires output format (= device) to be set by user after :make.
+execute 'CompilerSet makeprg=groff'..escape(
+ \ ' '..s:groff_compiler_lang()..
+ \ ' -K'..get(b:, 'groff_compiler_encoding', get(g:, 'groff_compiler_encoding', 'utf8'))..
+ \ ' '..get(b:, 'groff_compiler_args', get(g:, 'groff_compiler_args', ''))..
+ \ ' -mom -T$* -- %:S > %:r:S.$*', ' ')
+" From Gavin Freeborn's https://github.com/Gavinok/vim-troff under Vim License
+" https://github.com/Gavinok/vim-troff/blob/91017b1423caa80aba541c997909a4f810edd275/compiler/troff.vim#L39
+CompilerSet errorformat=%o:<standard\ input>\ (%f):%l:%m,
+ \%o:\ <standard\ input>\ (%f):%l:%m,
+ \%o:%f:%l:%m,
+ \%o:\ %f:%l:%m,
+ \%f:%l:\ macro\ %trror:%m,
+ \%f:%l:%m,
+ \%W%tarning:\ file\ '%f'\\,\ around\ line\ %l:,%Z%m
+
+let &cpo = s:keepcpo
+unlet s:keepcpo
diff --git a/runtime/compiler/hare.vim b/runtime/compiler/hare.vim
index c98bbb9c63..33edb3a281 100644
--- a/runtime/compiler/hare.vim
+++ b/runtime/compiler/hare.vim
@@ -1,28 +1,29 @@
-" Vim compiler file
-" Compiler: Hare Compiler
-" Maintainer: Amelia Clarke <me@rsaihe.dev>
-" Last Change: 2022-09-21
-" 2024 Apr 05 by The Vim Project (removed :CompilerSet definition)
+" Vim compiler file.
+" Compiler: Hare
+" Maintainer: Amelia Clarke <selene@perilune.dev>
+" Last Change: 2024-05-23
+" Upstream: https://git.sr.ht/~sircmpwn/hare.vim
-if exists("g:current_compiler")
+if exists('current_compiler')
finish
endif
-let g:current_compiler = "hare"
+let current_compiler = 'hare'
let s:cpo_save = &cpo
set cpo&vim
-if filereadable("Makefile") || filereadable("makefile")
+if filereadable('Makefile') || filereadable('makefile')
CompilerSet makeprg=make
else
CompilerSet makeprg=hare\ build
endif
CompilerSet errorformat=
- \Error\ %f:%l:%c:\ %m,
- \Syntax\ error:\ %.%#\ at\ %f:%l:%c\\,\ %m,
+ \%f:%l:%c:\ syntax\ error:\ %m,
+ \%f:%l:%c:\ error:\ %m,
\%-G%.%#
let &cpo = s:cpo_save
unlet s:cpo_save
-" vim: tabstop=2 shiftwidth=2 expandtab
+
+" vim: et sts=2 sw=2 ts=8
diff --git a/runtime/compiler/javac.vim b/runtime/compiler/javac.vim
index f5fe84124f..9bd4cdf270 100644
--- a/runtime/compiler/javac.vim
+++ b/runtime/compiler/javac.vim
@@ -1,7 +1,7 @@
" Vim compiler file
" Compiler: Java Development Kit Compiler
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2024 Apr 03
+" Last Change: 2024 Jun 14
if exists("current_compiler")
finish
@@ -11,7 +11,12 @@ let current_compiler = "javac"
let s:cpo_save = &cpo
set cpo&vim
-CompilerSet makeprg=javac
+if exists("g:javac_makeprg_params")
+ execute $'CompilerSet makeprg=javac\ {escape(g:javac_makeprg_params, ' \|"')}'
+else
+ CompilerSet makeprg=javac
+endif
+
CompilerSet errorformat=%E%f:%l:\ error:\ %m,
\%W%f:%l:\ warning:\ %m,
\%-Z%p^,
diff --git a/runtime/compiler/make.vim b/runtime/compiler/make.vim
new file mode 100644
index 0000000000..748251bf8e
--- /dev/null
+++ b/runtime/compiler/make.vim
@@ -0,0 +1,13 @@
+" Vim compiler plugin
+"
+" Maintainer: The Vim Project <https://github.com/vim/vim>
+" Last Change: 2024 Sep 10
+" Original Author: Konfekt
+"
+" This compiler plugin is used to reset previously set compiler options.
+
+if exists("g:current_compiler") | unlet g:current_compiler | endif
+if exists("b:current_compiler") | unlet b:current_compiler | endif
+
+CompilerSet makeprg&
+CompilerSet errorformat&
diff --git a/runtime/compiler/pandoc.vim b/runtime/compiler/pandoc.vim
index 6c151930c5..6c15e104c3 100644
--- a/runtime/compiler/pandoc.vim
+++ b/runtime/compiler/pandoc.vim
@@ -1,9 +1,12 @@
" Vim compiler file
" Compiler: Pandoc
" Maintainer: Konfekt
+" Last Change: 2024 Sep 8
"
" Expects output file extension, say `:make html` or `:make pdf`.
" Passes additional arguments to pandoc, say `:make html --self-contained`.
+" Adjust command-line flags by buffer-local/global variable
+" b/g:pandoc_compiler_args which defaults to empty.
if exists("current_compiler")
finish
@@ -25,31 +28,36 @@ let s:supported_filetypes =
silent! function s:PandocFiletype(filetype) abort
let ft = a:filetype
- if ft ==# 'pandoc'
- return 'markdown'
- elseif ft ==# 'tex'
- return 'latex'
- elseif ft ==# 'xml'
- " Pandoc does not support XML as a generic input format, but it does support
- " EndNote XML and Jats XML out of which the latter seems more universal.
- return 'jats'
- elseif ft ==# 'text' || empty(ft)
- return 'markdown'
- elseif index(s:supported_filetypes, &ft) >= 0
- return ft
+
+ if ft ==# 'pandoc' | return 'markdown'
+ elseif ft ==# 'tex' | return 'latex'
+ " Pandoc does not support XML as a generic input format, but it does support
+ " EndNote XML and Jats XML out of which the latter seems more universal.
+ elseif ft ==# 'xml' | return 'jats'
+ elseif ft ==# 'text' || empty(ft) | return 'markdown'
+ elseif index(s:supported_filetypes, &ft) >= 0 | return ft
else
- echomsg 'Unsupported filetype: ' . ft . ', falling back to Markdown as input format!'
+ echomsg 'Unsupported filetype: '..ft..', falling back to Markdown as input format!'
return 'markdown'
endif
endfunction
-execute 'CompilerSet makeprg=pandoc\ --standalone' .
- \ '\ --metadata\ title=%:t:r:S' .
- \ '\ --metadata\ lang=' . matchstr(&spelllang, '^\a\a') .
- \ '\ --from=' . s:PandocFiletype(&filetype) .
- \ '\ ' . escape(get(b:, 'pandoc_compiler_args', get(g:, 'pandoc_compiler_args', '')), ' ') .
- \ '\ --output\ %:r:S.$*\ %:S'
-
-CompilerSet errorformat="%f",\ line\ %l:\ %m
+
+silent! function s:PandocLang()
+ let lang = get(b:, 'pandoc_compiler_lang',
+ \ &spell ? matchstr(&spelllang, '^\a\a') : '')
+ if lang ==# 'en' | let lang = '' | endif
+ return empty(lang) ? '' : '--metadata lang='..lang
+endfunction
+
+execute 'CompilerSet makeprg=pandoc'..escape(
+ \ ' --standalone'..
+ \ (s:PandocFiletype(&filetype) ==# 'markdown' && (getline(1) =~# '^%\s\+\S\+' || (search('^title:\s+\S+', 'cnw') > 0)) ?
+ \ '' : ' --metadata title=%:t:r:S')..
+ \ ' '..s:PandocLang()..
+ \ ' --from='..s:PandocFiletype(&filetype)..
+ \ ' '..get(b:, 'pandoc_compiler_args', get(g:, 'pandoc_compiler_args', ''))..
+ \ ' --output %:r:S.$* -- %:S', ' ')
+CompilerSet errorformat=\"%f\",\ line\ %l:\ %m
let &cpo = s:keepcpo
unlet s:keepcpo
diff --git a/runtime/compiler/typst.vim b/runtime/compiler/typst.vim
new file mode 100644
index 0000000000..33e55818e9
--- /dev/null
+++ b/runtime/compiler/typst.vim
@@ -0,0 +1,15 @@
+" Vim compiler file
+" Language: Typst
+" Maintainer: Gregory Anders
+" Last Change: 2024-07-14
+" Based on: https://github.com/kaarmu/typst.vim
+
+if exists('current_compiler')
+ finish
+endif
+let current_compiler = get(g:, 'typst_cmd', 'typst')
+
+" With `--diagnostic-format` we can use the default errorformat
+let s:makeprg = [current_compiler, 'compile', '--diagnostic-format', 'short', '%:S']
+
+execute 'CompilerSet makeprg=' . join(s:makeprg, '\ ')
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index 2aa147770d..dee0324a5b 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -42,9 +42,9 @@ The RPC API is like a more powerful version of Vim's "clientserver" feature.
CONNECTING *rpc-connecting*
See |channel-intro| for various ways to open a channel. Channel-opening
-functions take an `rpc` key in the options dictionary. RPC channels can also
-be opened by other processes connecting to TCP/IP sockets or named pipes
-listened to by Nvim.
+functions take an `rpc` key in the options dict. RPC channels can also be
+opened by other processes connecting to TCP/IP sockets or named pipes listened
+to by Nvim.
Nvim creates a default RPC socket at |startup|, given by |v:servername|. To
start with a TCP/IP socket instead, use |--listen| with a TCP-style address: >
@@ -108,9 +108,9 @@ Basic types ~
Integer (signed 64-bit integer) int64_t
Float (IEEE 754 double precision) double
String {char* data, size_t size} struct
- Array
- Dictionary (msgpack: map)
- Object
+ Array kvec
+ Dict (msgpack: map) kvec
+ Object any of the above
<
Note:
- Empty Array is accepted as a valid Dictionary parameter.
@@ -708,12 +708,12 @@ nvim_eval_statusline({str}, {opts}) *nvim_eval_statusline()*
line number instead of statusline.
Return: ~
- Dictionary containing statusline information, with these keys:
+ Dict containing statusline information, with these keys:
• str: (string) Characters that will be displayed on the statusline.
• width: (number) Display width of the statusline.
• highlights: Array containing highlight information of the
statusline. Only included when the "highlights" key in {opts} is
- true. Each element of the array is a |Dictionary| with these keys:
+ true. Each element of the array is a |Dict| with these keys:
• start: (number) Byte index (0-based) of first character that uses
the highlight.
• group: (string) Name of highlight group.
@@ -763,7 +763,7 @@ nvim_feedkeys({keys}, {mode}, {escape_ks}) *nvim_feedkeys()*
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).
+ 1 is the |api-metadata| map (Dict).
Attributes: ~
|api-fast|
@@ -779,7 +779,7 @@ nvim_get_chan_info({chan}) *nvim_get_chan_info()*
• {chan} channel_id, or 0 for current channel
Return: ~
- Dictionary describing a channel, with these keys:
+ Channel info dict with these keys:
• "id" Channel id.
• "argv" (optional) Job arguments list.
• "stream" Stream underlying the channel.
@@ -792,11 +792,11 @@ nvim_get_chan_info({chan}) *nvim_get_chan_info()*
• "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).
- • "buffer" (optional) Buffer with connected |terminal| instance.
+ device path like "/dev/pts/1". If unknown, the key will still be
+ present if a pty is used (e.g. for conpty on Windows).
+ • "buffer" (optional) Buffer connected to |terminal| instance.
• "client" (optional) Info about the peer (client on the other end of
- the RPC channel), if provided by it via |nvim_set_client_info()|.
+ the RPC channel), which it provided via |nvim_set_client_info()|.
nvim_get_color_by_name({name}) *nvim_get_color_by_name()*
Returns the 24-bit RGB value of a |nvim_get_color_map()| color name or
@@ -939,7 +939,7 @@ nvim_get_mode() *nvim_get_mode()*
|api-fast|
Return: ~
- Dictionary { "mode": String, "blocking": Boolean }
+ Dict { "mode": String, "blocking": Boolean }
nvim_get_proc({pid}) *nvim_get_proc()*
Gets info describing process `pid`.
@@ -954,11 +954,11 @@ nvim_get_proc_children({pid}) *nvim_get_proc_children()*
Array of child process ids, empty if process not found.
nvim_get_runtime_file({name}, {all}) *nvim_get_runtime_file()*
- Find files in runtime directories
+ Finds files in runtime directories, in 'runtimepath' order.
"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
+ `nvim_get_runtime_file("colors/*.{vim,lua}", 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.
@@ -996,6 +996,9 @@ nvim_input({keys}) *nvim_input()*
input buffer and the call is non-blocking (input is processed
asynchronously by the eventloop).
+ To input blocks of text, |nvim_paste()| is much faster and should be
+ preferred.
+
On execution error: does not fail, but updates v:errmsg.
Note: ~
@@ -1148,21 +1151,35 @@ nvim_out_write({str}) *nvim_out_write()*
• {str} Message
nvim_paste({data}, {crlf}, {phase}) *nvim_paste()*
- Pastes at cursor, in any mode.
+ Pastes at cursor (in any mode), and sets "redo" so dot (|.|) will repeat
+ the input. UIs call this to implement "paste", but it's also intended for
+ use by scripts to input large, dot-repeatable blocks of text (as opposed
+ to |nvim_input()| which is subject to mappings/events and is thus much
+ slower).
- Invokes the `vim.paste` handler, which handles each mode appropriately.
- Sets redo/undo. Faster than |nvim_input()|. Lines break at LF ("\n").
+ Invokes the |vim.paste()| handler, which handles each mode appropriately.
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
- the next paste is initiated (phase 1 or -1).
+ `vim.paste()`). On error or cancel, subsequent calls are ignored
+ ("drained") until the next paste is initiated (phase 1 or -1).
+
+ Useful in mappings and scripts to insert multiline text. Example: >lua
+ vim.keymap.set('n', 'x', function()
+ vim.api.nvim_paste([[
+ line1
+ line2
+ line3
+ ]], false, -1)
+ end, { buffer = true })
+<
Attributes: ~
not allowed when |textlock| is active
Parameters: ~
- • {data} Multiline input. May be binary (containing NUL bytes).
+ • {data} Multiline input. Lines break at LF ("\n"). 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
@@ -1173,10 +1190,11 @@ nvim_paste({data}, {crlf}, {phase}) *nvim_paste()*
Return: ~
• true: Client may continue pasting.
- • false: Client must cancel the paste.
+ • false: Client should cancel the paste.
nvim_put({lines}, {type}, {after}, {follow}) *nvim_put()*
- Puts text at cursor, in any mode.
+ Puts text at cursor, in any mode. For dot-repeatable input, use
+ |nvim_paste()|.
Compare |:put| and |p| which are always linewise.
@@ -1249,8 +1267,7 @@ nvim_set_client_info({name}, {version}, {type}, {methods}, {attributes})
Parameters: ~
• {name} Short name for the connected client
- • {version} Dictionary describing the version, with these (optional)
- keys:
+ • {version} Dict describing the version, with these (optional) keys:
• "major" major version (defaults to 0 if not set, for
no release yet)
• "minor" minor version
@@ -1285,6 +1302,7 @@ nvim_set_client_info({name}, {version}, {type}, {methods}, {attributes})
inclusive.
• {attributes} Arbitrary string:string map of informal client
properties. Suggested keys:
+ • "pid": Process id.
• "website": Client homepage URL (e.g. GitHub
repository)
• "license": License description ("Apache 2", "GPLv3",
@@ -1474,7 +1492,7 @@ nvim__complete_set({index}, {opts}) *nvim__complete_set()*
• info: (string) info text.
Return: ~
- Dictionary containing these keys:
+ Dict containing these keys:
• winid: (number) floating window id
• bufnr: (number) buffer id in floating window
@@ -1516,14 +1534,14 @@ nvim__id_array({arr}) *nvim__id_array()*
Return: ~
its argument.
-nvim__id_dictionary({dct}) *nvim__id_dictionary()*
- Returns dictionary given as argument.
+nvim__id_dict({dct}) *nvim__id_dict()*
+ Returns dict given as argument.
This API function is used for testing. One should not rely on its presence
in plugins.
Parameters: ~
- • {dct} Dictionary to return.
+ • {dct} Dict to return.
Return: ~
its argument.
@@ -1594,7 +1612,7 @@ nvim_call_dict_function({dict}, {fn}, {args})
On execution error: fails with Vimscript error, updates v:errmsg.
Parameters: ~
- • {dict} Dictionary, or String evaluating to a Vimscript |self| dict
+ • {dict} Dict, or String evaluating to a Vimscript |self| dict
• {fn} Name of the function defined on the Vimscript dict
• {args} Function arguments packed in an Array
@@ -1628,7 +1646,7 @@ nvim_command({command}) *nvim_command()*
• {command} Ex command string
nvim_eval({expr}) *nvim_eval()*
- Evaluates a Vimscript |expression|. Dictionaries and Lists are recursively
+ Evaluates a Vimscript |expression|. Dicts and Lists are recursively
expanded.
On execution error: fails with Vimscript error, updates v:errmsg.
@@ -1655,7 +1673,7 @@ nvim_exec2({src}, {opts}) *nvim_exec2()*
return all (non-error, non-shell |:!|) output.
Return: ~
- Dictionary containing information about execution, with these keys:
+ Dict containing information about execution, with these keys:
• output: (string|nil) Output if `opts.output` is true.
See also: ~
@@ -1692,9 +1710,9 @@ 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:
+ • AST: top-level dict with these keys:
+ • "error": Dict 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.
@@ -1702,7 +1720,7 @@ nvim_parse_expression({expr}, {flags}, {highlight})
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:
+ • "ast": AST, either nil or a dict 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
@@ -1778,8 +1796,8 @@ nvim_buf_get_commands({buffer}, {opts}) *nvim_buf_get_commands()*
nvim_cmd({cmd}, {opts}) *nvim_cmd()*
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
+ Unlike |nvim_command()| this command takes a structured Dict 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
@@ -1793,8 +1811,8 @@ nvim_cmd({cmd}, {opts}) *nvim_cmd()*
On execution error: fails with Vimscript error, updates v:errmsg.
Parameters: ~
- • {cmd} Command to execute. Must be a Dictionary that can contain the
- same values as the return value of |nvim_parse_cmd()| except
+ • {cmd} Command to execute. Must be a Dict 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.
• {opts} Optional parameters.
@@ -1896,7 +1914,7 @@ nvim_parse_cmd({str}, {opts}) *nvim_parse_cmd()*
• {opts} Optional parameters. Reserved for future use.
Return: ~
- Dictionary containing command information, with these keys:
+ Dict 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
@@ -1913,15 +1931,15 @@ nvim_parse_cmd({str}, {opts}) *nvim_parse_cmd()*
• nargs: (string) Value of |:command-nargs|.
• nextcmd: (string) Next command if there are multiple commands
separated by a |:bar|. Empty if there isn't a next command.
- • magic: (dictionary) Which characters have special meaning in the
- command arguments.
+ • magic: (dict) Which characters have special meaning in the command
+ arguments.
• file: (boolean) The command expands filenames. Which means
characters such as "%", "#" and wildcards are expanded.
• 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|.
+ • mods: (dict) |:command-modifiers|.
+ • filter: (dict) |:filter|.
• pattern: (string) Filter pattern. Empty string if there is no
filter.
• force: (boolean) Whether filter is inverted or not.
@@ -1958,11 +1976,11 @@ Options Functions *api-options*
nvim_get_all_options_info() *nvim_get_all_options_info()*
Gets the option information for all options.
- The dictionary has the full option names as keys and option metadata
- dictionaries as detailed at |nvim_get_option_info2()|.
+ The dict has the full option names as keys and option metadata dicts as
+ detailed at |nvim_get_option_info2()|.
Return: ~
- dictionary of all options
+ dict of all options
See also: ~
• |nvim_get_commands()|
@@ -1970,7 +1988,7 @@ nvim_get_all_options_info() *nvim_get_all_options_info()*
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:
+ Resulting dict has keys:
• name: Name of the option (like 'filetype')
• shortname: Shortened name of the option (like 'ft')
• type: type of option ("string", "number" or "boolean")
@@ -2138,14 +2156,14 @@ nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
• |api-buffer-updates-lua|
nvim_buf_call({buffer}, {fun}) *nvim_buf_call()*
- call a function with buffer as temporary current buffer
+ 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.
+ window already shows "buffer", the window is not switched. If a window
+ inside the current tabpage (including a float) already shows the buffer,
+ then 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()|.
@@ -2460,10 +2478,11 @@ nvim_buf_set_text({buffer}, {start_row}, {start_col}, {end_row}, {end_col},
`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.
+ Note: ~
+ • Prefer |nvim_buf_set_lines()| (for performance) to add or delete
+ entire lines.
+ • Prefer |nvim_paste()| or |nvim_put()| to insert (instead of replace)
+ text at cursor.
Attributes: ~
not allowed when |textlock| is active
@@ -2476,10 +2495,6 @@ nvim_buf_set_text({buffer}, {start_row}, {start_col}, {end_row}, {end_col},
• {end_col} Ending column (byte offset) on last line, exclusive
• {replacement} Array of lines to use as replacement
- See also: ~
- • |nvim_buf_set_lines()|
- • |nvim_put()|
-
nvim_buf_set_var({buffer}, {name}, {value}) *nvim_buf_set_var()*
Sets a buffer-scoped (b:) variable
@@ -2758,8 +2773,6 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts})
• 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 (EXPERIMENTAL) enables "scoping" for the
- extmark. See |nvim__win_add_ns()|
Return: ~
Id of the created/updated extmark
@@ -2802,7 +2815,7 @@ nvim_set_decoration_provider({ns_id}, {opts})
Note: this function should not be called often. Rather, the callbacks
themselves can be used to throttle unneeded callbacks. the `on_start`
callback can return `false` to disable the provider until the next redraw.
- Similarly, return `false` in `on_win` will skip the `on_lines` calls for
+ Similarly, return `false` in `on_win` will skip the `on_line` calls for
that window (but any extmarks set in `on_win` will still be used). A
plugin managing multiple sources of decoration should ideally only set one
provider, and merge the sources internally. You can use multiple `ns_id`
@@ -2811,10 +2824,10 @@ nvim_set_decoration_provider({ns_id}, {opts})
Note: doing anything other than setting extmarks is considered
experimental. Doing things like changing options are not explicitly
forbidden, but is likely to have unexpected consequences (such as 100% CPU
- consumption). doing `vim.rpcnotify` should be OK, but `vim.rpcrequest` is
+ consumption). Doing `vim.rpcnotify` should be OK, but `vim.rpcrequest` is
quite dubious for the moment.
- Note: It is not allowed to remove or update extmarks in 'on_line'
+ Note: It is not allowed to remove or update extmarks in `on_line`
callbacks.
Attributes: ~
@@ -2831,7 +2844,7 @@ nvim_set_decoration_provider({ns_id}, {opts})
["buf", bufnr, tick]
<
• on_win: called when starting to redraw a specific window. >
- ["win", winid, bufnr, topline, botline]
+ ["win", winid, bufnr, toprow, botrow]
<
• on_line: called for each buffer line being redrawn. (The
interaction with fold lines is subject to change) >
@@ -2841,41 +2854,26 @@ nvim_set_decoration_provider({ns_id}, {opts})
["end", tick]
<
-nvim__win_add_ns({window}, {ns_id}) *nvim__win_add_ns()*
+nvim__ns_get({ns_id}) *nvim__ns_get()*
EXPERIMENTAL: this API will change in the future.
- Scopes a namespace to the a window, so extmarks in the namespace will be
- active only in the given window.
+ Get the properties for namespace
Parameters: ~
- • {window} Window handle, or 0 for current window
- • {ns_id} Namespace
+ • {ns_id} Namespace
Return: ~
- true if the namespace was added, else false
+ Map defining the namespace properties, see |nvim__ns_set()|
-nvim__win_del_ns({window}, {ns_id}) *nvim__win_del_ns()*
+nvim__ns_set({ns_id}, {opts}) *nvim__ns_set()*
EXPERIMENTAL: this API will change in the future.
- Unscopes a namespace (un-binds it from the given scope).
+ Set some properties for namespace
Parameters: ~
- • {window} Window handle, or 0 for current window
- • {ns_id} the namespace to remove
-
- Return: ~
- true if the namespace was removed, else false
-
-nvim__win_get_ns({window}) *nvim__win_get_ns()*
- EXPERIMENTAL: this API will change in the future.
-
- Gets the namespace scopes for a given window.
-
- Parameters: ~
- • {window} Window handle, or 0 for current window
-
- Return: ~
- a list of namespaces ids
+ • {ns_id} Namespace
+ • {opts} Optional parameters to set:
+ • wins: a list of windows to be scoped in
==============================================================================
@@ -3097,7 +3095,7 @@ nvim_win_text_height({window}, {opts}) *nvim_win_text_height()*
omitted include the whole line.
Return: ~
- Dictionary containing text height information, with these keys:
+ Dict containing text height information, with these keys:
• all: The total number of screen lines occupied by the range.
• fill: The number of diff filler or virtual lines among them.
@@ -3259,13 +3257,15 @@ nvim_open_win({buffer}, {enter}, {config}) *nvim_open_win()*
<
• title: Title (optional) in window border, string or list.
List should consist of `[text, highlight]` tuples. If
- string, the default highlight group is `FloatTitle`.
+ string, or a tuple lacks a highlight, the default
+ highlight group is `FloatTitle`.
• title_pos: Title position. Must be set with `title`
option. Value can be one of "left", "center", or "right".
Default is `"left"`.
• footer: Footer (optional) in window border, string or
list. List should consist of `[text, highlight]` tuples.
- If string, the default highlight group is `FloatFooter`.
+ If string, or a tuple lacks a highlight, the default
+ highlight group is `FloatFooter`.
• footer_pos: Footer position. Must be set with `footer`
option. Value can be one of "left", "center", or "right".
Default is `"left"`.
@@ -3419,7 +3419,7 @@ nvim_create_augroup({name}, {opts}) *nvim_create_augroup()*
Parameters: ~
• {name} String: The name of the group
- • {opts} Dictionary Parameters
+ • {opts} Dict Parameters
• clear (bool) optional: defaults to true. Clear existing
commands if the group already exists |autocmd-groups|.
@@ -3538,7 +3538,7 @@ nvim_exec_autocmds({event}, {opts}) *nvim_exec_autocmds()*
Parameters: ~
• {event} (String|Array) The event or events to execute
- • {opts} Dictionary of autocommand options:
+ • {opts} Dict of autocommand options:
• group (string|integer) optional: the autocommand group name
or id to match against. |autocmd-groups|.
• pattern (string|array) optional: defaults to "*"
@@ -3574,7 +3574,7 @@ nvim_get_autocmds({opts}) *nvim_get_autocmds()*
autocommands that match any combination of them.
Parameters: ~
- • {opts} Dictionary with at least one of the following:
+ • {opts} Dict with at least one of the following:
• group (string|integer): the autocommand group name or id to
match against.
• event (string|array): event or events to match against
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index ca816851dd..8e5e2628de 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -522,6 +522,11 @@ CursorMoved After the cursor was moved in Normal or Visual
Careful: This is triggered very often, don't
do anything that the user does not expect or
that is slow.
+ *CursorMovedC*
+CursorMovedC After the cursor was moved in the command
+ line. Be careful not to mess up the command
+ line, it may cause Vim to lock up.
+ <afile> expands to the |cmdline-char|.
*CursorMovedI*
CursorMovedI After the cursor was moved in Insert mode.
Not triggered when the popup menu is visible.
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index ff7d5f9ce8..4c726f86d2 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -25,6 +25,12 @@ abs({expr}) *abs()*
echo abs(-4)
< 4
+ Parameters: ~
+ • {expr} (`number`)
+
+ Return: ~
+ (`number`)
+
acos({expr}) *acos()*
Return the arc cosine of {expr} measured in radians, as a
|Float| in the range of [0, pi].
@@ -38,6 +44,12 @@ acos({expr}) *acos()*
echo acos(-0.5)
< 2.094395
+ Parameters: ~
+ • {expr} (`number`)
+
+ Return: ~
+ (`number`)
+
add({object}, {expr}) *add()*
Append the item {expr} to |List| or |Blob| {object}. Returns
the resulting |List| or |Blob|. Examples: >vim
@@ -49,6 +61,14 @@ add({object}, {expr}) *add()*
Use |insert()| to add an item at another position.
Returns 1 if {object} is not a |List| or a |Blob|.
+ Parameters: ~
+ • {object} (`any`)
+ • {expr} (`any`)
+
+ Return: ~
+ (`any`) Resulting |List| or |Blob|, or 1 if {object} is not
+ a |List| or a |Blob|.
+
and({expr}, {expr}) *and()*
Bitwise AND on the two arguments. The arguments are converted
to a number. A List, Dict or Float argument causes an error.
@@ -57,6 +77,13 @@ and({expr}, {expr}) *and()*
let flag = and(bits, 0x80)
<
+ Parameters: ~
+ • {expr} (`number`)
+ • {expr1} (`number`)
+
+ Return: ~
+ (`integer`)
+
api_info() *api_info()*
Returns Dictionary of |api-metadata|.
@@ -64,6 +91,9 @@ api_info() *api_info()*
lua vim.print(vim.fn.api_info())
<
+ Return: ~
+ (`table`)
+
append({lnum}, {text}) *append()*
When {text} is a |List|: Append each item of the |List| as a
text line below line {lnum} in the current buffer.
@@ -79,6 +109,13 @@ append({lnum}, {text}) *append()*
let failed = append(0, ["Chapter 1", "the beginning"])
<
+ Parameters: ~
+ • {lnum} (`integer`)
+ • {text} (`string|string[]`)
+
+ Return: ~
+ (`0|1`)
+
appendbufline({buf}, {lnum}, {text}) *appendbufline()*
Like |append()| but append the text in buffer {expr}.
@@ -100,6 +137,14 @@ appendbufline({buf}, {lnum}, {text}) *appendbufline()*
< However, when {text} is an empty list then no error is given
for an invalid {lnum}, since {lnum} isn't actually used.
+ Parameters: ~
+ • {buf} (`integer|string`)
+ • {lnum} (`integer`)
+ • {text} (`string`)
+
+ Return: ~
+ (`0|1`)
+
argc([{winid}]) *argc()*
The result is the number of files in the argument list. See
|arglist|.
@@ -110,10 +155,19 @@ argc([{winid}]) *argc()*
list is used: either the window number or the window ID.
Returns -1 if the {winid} argument is invalid.
+ Parameters: ~
+ • {winid} (`integer?`)
+
+ Return: ~
+ (`integer`)
+
argidx() *argidx()*
The result is the current index in the argument list. 0 is
the first file. argc() - 1 is the last one. See |arglist|.
+ Return: ~
+ (`integer`)
+
arglistid([{winnr} [, {tabnr}]]) *arglistid()*
Return the argument list ID. This is a number which
identifies the argument list being used. Zero is used for the
@@ -126,6 +180,13 @@ arglistid([{winnr} [, {tabnr}]]) *arglistid()*
page.
{winnr} can be the window number or the |window-ID|.
+ Parameters: ~
+ • {winnr} (`integer?`)
+ • {tabnr} (`integer?`)
+
+ Return: ~
+ (`integer`)
+
argv([{nr} [, {winid}]]) *argv()*
The result is the {nr}th file in the argument list. See
|arglist|. "argv(0)" is the first one. Example: >vim
@@ -145,6 +206,13 @@ argv([{nr} [, {winid}]]) *argv()*
the argument list. Returns an empty List if the {winid}
argument is invalid.
+ Parameters: ~
+ • {nr} (`integer?`)
+ • {winid} (`integer?`)
+
+ Return: ~
+ (`string|string[]`)
+
asin({expr}) *asin()*
Return the arc sine of {expr} measured in radians, as a |Float|
in the range of [-pi/2, pi/2].
@@ -158,27 +226,48 @@ asin({expr}) *asin()*
echo asin(-0.5)
< -0.523599
+ Parameters: ~
+ • {expr} (`any`)
+
+ Return: ~
+ (`number`)
+
assert_beeps({cmd}) *assert_beeps()*
Run {cmd} and add an error message to |v:errors| if it does
NOT produce a beep or visual bell.
Also see |assert_fails()|, |assert_nobeep()| and
|assert-return|.
+ Parameters: ~
+ • {cmd} (`string`)
+
+ Return: ~
+ (`0|1`)
+
assert_equal({expected}, {actual} [, {msg}]) *assert_equal()*
When {expected} and {actual} are not equal an error message is
added to |v:errors| and 1 is returned. Otherwise zero is
returned. |assert-return|
The error is in the form "Expected {expected} but got
- {actual}". When {msg} is present it is prefixed to that.
+ {actual}". When {msg} is present it is prefixed to that,
+ along with the location of the assert when run from a script.
There is no automatic conversion, the String "4" is different
from the Number 4. And the number 4 is different from the
Float 4.0. The value of 'ignorecase' is not used here, case
always matters.
Example: >vim
- assert_equal('foo', 'bar')
-< Will result in a string to be added to |v:errors|:
- test.vim line 12: Expected 'foo' but got 'bar' ~
+ call assert_equal('foo', 'bar', 'baz')
+< Will add the following to |v:errors|:
+ test.vim line 12: baz: Expected 'foo' but got 'bar' ~
+
+ Parameters: ~
+ • {expected} (`any`)
+ • {actual} (`any`)
+ • {msg} (`any?`)
+
+ Return: ~
+ (`0|1`)
assert_equalfile({fname-one}, {fname-two}) *assert_equalfile()*
When the files {fname-one} and {fname-two} do not contain
@@ -187,6 +276,13 @@ assert_equalfile({fname-one}, {fname-two}) *assert_equalfile()*
When {fname-one} or {fname-two} does not exist the error will
mention that.
+ Parameters: ~
+ • {fname-one} (`string`)
+ • {fname-two} (`string`)
+
+ Return: ~
+ (`0|1`)
+
assert_exception({error} [, {msg}]) *assert_exception()*
When v:exception does not contain the string {error} an error
message is added to |v:errors|. Also see |assert-return|.
@@ -201,6 +297,13 @@ assert_exception({error} [, {msg}]) *assert_exception()*
endtry
<
+ Parameters: ~
+ • {error} (`any`)
+ • {msg} (`any?`)
+
+ Return: ~
+ (`0|1`)
+
*assert_fails()*
assert_fails({cmd} [, {error} [, {msg} [, {lnum} [, {context}]]]])
Run {cmd} and add an error message to |v:errors| if it does
@@ -210,25 +313,25 @@ assert_fails({cmd} [, {error} [, {msg} [, {lnum} [, {context}]]]])
When {error} is a string it must be found literally in the
first reported error. Most often this will be the error code,
including the colon, e.g. "E123:". >vim
- assert_fails('bad cmd', 'E987:')
+ call assert_fails('bad cmd', 'E987:')
<
When {error} is a |List| with one or two strings, these are
used as patterns. The first pattern is matched against the
first reported error: >vim
- assert_fails('cmd', ['E987:.*expected bool'])
+ call assert_fails('cmd', ['E987:.*expected bool'])
< The second pattern, if present, is matched against the last
reported error. To only match the last error use an empty
string for the first error: >vim
- assert_fails('cmd', ['', 'E987:'])
+ call assert_fails('cmd', ['', 'E987:'])
<
If {msg} is empty then it is not used. Do this to get the
default message when passing the {lnum} argument.
-
+ *E1115*
When {lnum} is present and not negative, and the {error}
argument is present and matches, then this is compared with
the line number at which the error was reported. That can be
the line number in a function or in a script.
-
+ *E1116*
When {context} is present it is used as a pattern and matched
against the context (script name or function name) where
{lnum} is located in.
@@ -236,16 +339,34 @@ assert_fails({cmd} [, {error} [, {msg} [, {lnum} [, {context}]]]])
Note that beeping is not considered an error, and some failing
commands only beep. Use |assert_beeps()| for those.
+ Parameters: ~
+ • {cmd} (`string`)
+ • {error} (`any?`)
+ • {msg} (`any?`)
+ • {lnum} (`integer?`)
+ • {context} (`any?`)
+
+ Return: ~
+ (`0|1`)
+
assert_false({actual} [, {msg}]) *assert_false()*
When {actual} is not false an error message is added to
|v:errors|, like with |assert_equal()|.
The error is in the form "Expected False but got {actual}".
- When {msg} is present it is prepended to that.
+ When {msg} is present it is prefixed to that, along with the
+ location of the assert when run from a script.
Also see |assert-return|.
A value is false when it is zero. When {actual} is not a
number the assert fails.
+ Parameters: ~
+ • {actual} (`any`)
+ • {msg} (`any?`)
+
+ Return: ~
+ (`0|1`)
+
assert_inrange({lower}, {upper}, {actual} [, {msg}]) *assert_inrange()*
This asserts number and |Float| values. When {actual} is lower
than {lower} or higher than {upper} an error message is added
@@ -254,11 +375,21 @@ assert_inrange({lower}, {upper}, {actual} [, {msg}]) *assert_inrange()*
but got {actual}". When {msg} is present it is prefixed to
that.
+ Parameters: ~
+ • {lower} (`number`)
+ • {upper} (`number`)
+ • {actual} (`number`)
+ • {msg} (`string?`)
+
+ Return: ~
+ (`0|1`)
+
assert_match({pattern}, {actual} [, {msg}]) *assert_match()*
When {pattern} does not match {actual} an error message is
added to |v:errors|. Also see |assert-return|.
The error is in the form "Pattern {pattern} does not match
- {actual}". When {msg} is present it is prefixed to that.
+ {actual}". When {msg} is present it is prefixed to that,
+ along with the location of the assert when run from a script.
{pattern} is used as with |expr-=~|: The matching is always done
like 'magic' was set and 'cpoptions' is empty, no matter what
@@ -269,36 +400,80 @@ assert_match({pattern}, {actual} [, {msg}]) *assert_match()*
Use both to match the whole text.
Example: >vim
- assert_match('^f.*o$', 'foobar')
+ call assert_match('^f.*o$', 'foobar')
< Will result in a string to be added to |v:errors|:
test.vim line 12: Pattern '^f.*o$' does not match 'foobar' ~
+ Parameters: ~
+ • {pattern} (`string`)
+ • {actual} (`string`)
+ • {msg} (`string?`)
+
+ Return: ~
+ (`0|1`)
+
assert_nobeep({cmd}) *assert_nobeep()*
Run {cmd} and add an error message to |v:errors| if it
produces a beep or visual bell.
Also see |assert_beeps()|.
+ Parameters: ~
+ • {cmd} (`string`)
+
+ Return: ~
+ (`0|1`)
+
assert_notequal({expected}, {actual} [, {msg}]) *assert_notequal()*
The opposite of `assert_equal()`: add an error message to
|v:errors| when {expected} and {actual} are equal.
Also see |assert-return|.
+ Parameters: ~
+ • {expected} (`any`)
+ • {actual} (`any`)
+ • {msg} (`any?`)
+
+ Return: ~
+ (`0|1`)
+
assert_notmatch({pattern}, {actual} [, {msg}]) *assert_notmatch()*
The opposite of `assert_match()`: add an error message to
|v:errors| when {pattern} matches {actual}.
Also see |assert-return|.
+ Parameters: ~
+ • {pattern} (`string`)
+ • {actual} (`string`)
+ • {msg} (`string?`)
+
+ Return: ~
+ (`0|1`)
+
assert_report({msg}) *assert_report()*
Report a test failure directly, using String {msg}.
Always returns one.
+ Parameters: ~
+ • {msg} (`string`)
+
+ Return: ~
+ (`0|1`)
+
assert_true({actual} [, {msg}]) *assert_true()*
When {actual} is not true an error message is added to
|v:errors|, like with |assert_equal()|.
Also see |assert-return|.
A value is |TRUE| when it is a non-zero number or |v:true|.
When {actual} is not a number or |v:true| the assert fails.
- When {msg} is given it precedes the default message.
+ When {msg} is given it is prefixed to the default message,
+ along with the location of the assert when run from a script.
+
+ Parameters: ~
+ • {actual} (`any`)
+ • {msg} (`string?`)
+
+ Return: ~
+ (`0|1`)
atan({expr}) *atan()*
Return the principal value of the arc tangent of {expr}, in
@@ -311,6 +486,12 @@ atan({expr}) *atan()*
echo atan(-4.01)
< -1.326405
+ Parameters: ~
+ • {expr} (`number`)
+
+ Return: ~
+ (`number`)
+
atan2({expr1}, {expr2}) *atan2()*
Return the arc tangent of {expr1} / {expr2}, measured in
radians, as a |Float| in the range [-pi, pi].
@@ -323,6 +504,13 @@ atan2({expr1}, {expr2}) *atan2()*
echo atan2(1, -1)
< 2.356194
+ Parameters: ~
+ • {expr1} (`number`)
+ • {expr2} (`number`)
+
+ Return: ~
+ (`number`)
+
blob2list({blob}) *blob2list()*
Return a List containing the number value of each byte in Blob
{blob}. Examples: >vim
@@ -331,6 +519,12 @@ blob2list({blob}) *blob2list()*
< Returns an empty List on error. |list2blob()| does the
opposite.
+ Parameters: ~
+ • {blob} (`any`)
+
+ Return: ~
+ (`any[]`)
+
browse({save}, {title}, {initdir}, {default}) *browse()*
Put up a file requester. This only works when "has("browse")"
returns |TRUE| (only in some GUI versions).
@@ -342,6 +536,15 @@ browse({save}, {title}, {initdir}, {default}) *browse()*
An empty string is returned when the "Cancel" button is hit,
something went wrong, or browsing is not possible.
+ Parameters: ~
+ • {save} (`any`)
+ • {title} (`string`)
+ • {initdir} (`string`)
+ • {default} (`string`)
+
+ Return: ~
+ (`0|1`)
+
browsedir({title}, {initdir}) *browsedir()*
Put up a directory requester. This only works when
"has("browse")" returns |TRUE| (only in some GUI versions).
@@ -354,6 +557,13 @@ browsedir({title}, {initdir}) *browsedir()*
When the "Cancel" button is hit, something went wrong, or
browsing is not possible, an empty string is returned.
+ Parameters: ~
+ • {title} (`string`)
+ • {initdir} (`string`)
+
+ Return: ~
+ (`0|1`)
+
bufadd({name}) *bufadd()*
Add a buffer to the buffer list with name {name} (must be a
String).
@@ -368,6 +578,12 @@ bufadd({name}) *bufadd()*
call setbufline(bufnr, 1, ['some', 'text'])
< Returns 0 on error.
+ Parameters: ~
+ • {name} (`string`)
+
+ Return: ~
+ (`integer`)
+
bufexists({buf}) *bufexists()*
The result is a Number, which is |TRUE| if a buffer called
{buf} exists.
@@ -390,11 +606,23 @@ bufexists({buf}) *bufexists()*
Use "bufexists(0)" to test for the existence of an alternate
file name.
+ Parameters: ~
+ • {buf} (`any`)
+
+ Return: ~
+ (`0|1`)
+
buflisted({buf}) *buflisted()*
The result is a Number, which is |TRUE| if a buffer called
{buf} exists and is listed (has the 'buflisted' option set).
The {buf} argument is used like with |bufexists()|.
+ Parameters: ~
+ • {buf} (`any`)
+
+ Return: ~
+ (`0|1`)
+
bufload({buf}) *bufload()*
Ensure the buffer {buf} is loaded. When the buffer name
refers to an existing file then the file is read. Otherwise
@@ -405,11 +633,20 @@ bufload({buf}) *bufload()*
there will be no dialog, the buffer will be loaded anyway.
The {buf} argument is used like with |bufexists()|.
+ Parameters: ~
+ • {buf} (`any`)
+
bufloaded({buf}) *bufloaded()*
The result is a Number, which is |TRUE| if a buffer called
{buf} exists and is loaded (shown in a window or hidden).
The {buf} argument is used like with |bufexists()|.
+ Parameters: ~
+ • {buf} (`any`)
+
+ Return: ~
+ (`0|1`)
+
bufname([{buf}]) *bufname()*
The result is the name of a buffer. Mostly as it is displayed
by the `:ls` command, but not using special names such as
@@ -441,6 +678,12 @@ bufname([{buf}]) *bufname()*
echo bufname("file2") " name of buffer where "file2" matches.
<
+ Parameters: ~
+ • {buf} (`integer|string?`)
+
+ Return: ~
+ (`string`)
+
bufnr([{buf} [, {create}]]) *bufnr()*
The result is the number of a buffer, as it is displayed by
the `:ls` command. For the use of {buf}, see |bufname()|
@@ -455,6 +698,13 @@ bufnr([{buf} [, {create}]]) *bufnr()*
number necessarily exist, because ":bwipeout" may have removed
them. Use bufexists() to test for the existence of a buffer.
+ Parameters: ~
+ • {buf} (`integer|string?`)
+ • {create} (`any?`)
+
+ Return: ~
+ (`integer`)
+
bufwinid({buf}) *bufwinid()*
The result is a Number, which is the |window-ID| of the first
window associated with buffer {buf}. For the use of {buf},
@@ -466,6 +716,12 @@ bufwinid({buf}) *bufwinid()*
Only deals with the current tab page. See |win_findbuf()| for
finding more.
+ Parameters: ~
+ • {buf} (`any`)
+
+ Return: ~
+ (`integer`)
+
bufwinnr({buf}) *bufwinnr()*
Like |bufwinid()| but return the window number instead of the
|window-ID|.
@@ -477,6 +733,12 @@ bufwinnr({buf}) *bufwinnr()*
< The number can be used with |CTRL-W_w| and ":wincmd w"
|:wincmd|.
+ Parameters: ~
+ • {buf} (`any`)
+
+ Return: ~
+ (`integer`)
+
byte2line({byte}) *byte2line()*
Return the line number that contains the character at byte
count {byte} in the current buffer. This includes the
@@ -487,6 +749,12 @@ byte2line({byte}) *byte2line()*
Returns -1 if the {byte} value is invalid.
+ Parameters: ~
+ • {byte} (`any`)
+
+ Return: ~
+ (`integer`)
+
byteidx({expr}, {nr} [, {utf16}]) *byteidx()*
Return byte index of the {nr}th character in the String
{expr}. Use zero for the first character, it then returns
@@ -523,6 +791,14 @@ byteidx({expr}, {nr} [, {utf16}]) *byteidx()*
echo byteidx('a😊😊', 3, 1) " returns 5
<
+ Parameters: ~
+ • {expr} (`any`)
+ • {nr} (`integer`)
+ • {utf16} (`any?`)
+
+ Return: ~
+ (`integer`)
+
byteidxcomp({expr}, {nr} [, {utf16}]) *byteidxcomp()*
Like byteidx(), except that a composing character is counted
as a separate character. Example: >vim
@@ -534,6 +810,14 @@ byteidxcomp({expr}, {nr} [, {utf16}]) *byteidxcomp()*
character is 3 bytes), the second echo results in 1 ('e' is
one byte).
+ Parameters: ~
+ • {expr} (`any`)
+ • {nr} (`integer`)
+ • {utf16} (`any?`)
+
+ Return: ~
+ (`integer`)
+
call({func}, {arglist} [, {dict}]) *call()* *E699*
Call function {func} with the items in |List| {arglist} as
arguments.
@@ -543,6 +827,14 @@ call({func}, {arglist} [, {dict}]) *call()* *E69
{dict} is for functions with the "dict" attribute. It will be
used to set the local variable "self". |Dictionary-function|
+ Parameters: ~
+ • {func} (`any`)
+ • {arglist} (`any`)
+ • {dict} (`any?`)
+
+ Return: ~
+ (`any`)
+
ceil({expr}) *ceil()*
Return the smallest integral value greater than or equal to
{expr} as a |Float| (round up).
@@ -557,6 +849,12 @@ ceil({expr}) *ceil()*
Returns 0.0 if {expr} is not a |Float| or a |Number|.
+ Parameters: ~
+ • {expr} (`number`)
+
+ Return: ~
+ (`number`)
+
chanclose({id} [, {stream}]) *chanclose()*
Close a channel or a specific stream associated with it.
For a job, {stream} can be one of "stdin", "stdout",
@@ -567,6 +865,13 @@ chanclose({id} [, {stream}]) *chanclose()*
For a socket, there is only one stream, and {stream} should be
omitted.
+ Parameters: ~
+ • {id} (`integer`)
+ • {stream} (`string?`)
+
+ Return: ~
+ (`0|1`)
+
changenr() *changenr()*
Return the number of the most recent change. This is the same
number as what is displayed with |:undolist| and can be used
@@ -576,6 +881,9 @@ changenr() *changenr()*
one less than the number of the undone change.
Returns 0 if the undo list is empty.
+ Return: ~
+ (`integer`)
+
chansend({id}, {data}) *chansend()*
Send data to channel {id}. For a job, it writes it to the
stdin of the process. For the stdio channel |channel-stdio|,
@@ -594,6 +902,13 @@ chansend({id}, {data}) *chansend()*
was created with `"rpc":v:true` then the channel expects RPC
messages, use |rpcnotify()| and |rpcrequest()| instead.
+ Parameters: ~
+ • {id} (`number`)
+ • {data} (`string|string[]`)
+
+ Return: ~
+ (`0|1`)
+
char2nr({string} [, {utf8}]) *char2nr()*
Return Number value of the first char in {string}.
Examples: >vim
@@ -609,6 +924,13 @@ char2nr({string} [, {utf8}]) *char2nr()*
Returns 0 if {string} is not a |String|.
+ Parameters: ~
+ • {string} (`string`)
+ • {utf8} (`any?`)
+
+ Return: ~
+ (`0|1`)
+
charclass({string}) *charclass()*
Return the character class of the first character in {string}.
The character class is one of:
@@ -620,6 +942,12 @@ charclass({string}) *charclass()*
The class is used in patterns and word motions.
Returns 0 if {string} is not a |String|.
+ Parameters: ~
+ • {string} (`string`)
+
+ Return: ~
+ (`0|1|2|3|'other'`)
+
charcol({expr} [, {winid}]) *charcol()*
Same as |col()| but returns the character index of the column
position given with {expr} instead of the byte position.
@@ -628,6 +956,14 @@ charcol({expr} [, {winid}]) *charcol()*
With the cursor on '세' in line 5 with text "여보세요": >vim
echo charcol('.') " returns 3
echo col('.') " returns 7
+<
+
+ Parameters: ~
+ • {expr} (`string|integer[]`)
+ • {winid} (`integer?`)
+
+ Return: ~
+ (`integer`)
charidx({string}, {idx} [, {countcc} [, {utf16}]]) *charidx()*
Return the character index of the byte at {idx} in {string}.
@@ -663,6 +999,15 @@ charidx({string}, {idx} [, {countcc} [, {utf16}]]) *charidx()*
echo charidx('a😊😊', 4, 0, 1) " returns 2
<
+ Parameters: ~
+ • {string} (`string`)
+ • {idx} (`integer`)
+ • {countcc} (`boolean?`)
+ • {utf16} (`boolean?`)
+
+ Return: ~
+ (`integer`)
+
chdir({dir}) *chdir()*
Change the current working directory to {dir}. The scope of
the directory change depends on the directory of the current
@@ -684,6 +1029,13 @@ chdir({dir}) *chdir()*
" ... do some work
call chdir(save_dir)
endif
+<
+
+ Parameters: ~
+ • {dir} (`string`)
+
+ Return: ~
+ (`string`)
cindent({lnum}) *cindent()*
Get the amount of indent for line {lnum} according the C
@@ -693,41 +1045,50 @@ cindent({lnum}) *cindent()*
When {lnum} is invalid -1 is returned.
See |C-indenting|.
+ Parameters: ~
+ • {lnum} (`integer`)
+
+ Return: ~
+ (`integer`)
+
clearmatches([{win}]) *clearmatches()*
Clears all matches previously defined for the current window
by |matchadd()| and the |:match| commands.
If {win} is specified, use the window with this number or
window ID instead of the current window.
+ Parameters: ~
+ • {win} (`integer?`)
+
col({expr} [, {winid}]) *col()*
The result is a Number, which is the byte index of the column
- position given with {expr}. The accepted positions are:
- . the cursor position
- $ the end of the cursor line (the result is the
- number of bytes in the cursor line plus one)
- 'x position of mark x (if the mark is not set, 0 is
- returned)
- v In Visual mode: the start of the Visual area (the
- cursor is the end). When not in Visual mode
- returns the cursor position. Differs from |'<| in
- that it's updated right away.
+ position given with {expr}.
+ For accepted positions see |getpos()|.
+ When {expr} is "$", it means the end of the cursor line, so
+ the result is the number of bytes in the cursor line plus one.
Additionally {expr} can be [lnum, col]: a |List| with the line
and column number. Most useful when the column is "$", to get
the last column of a specific line. When "lnum" or "col" is
out of range then col() returns zero.
+
With the optional {winid} argument the values are obtained for
that window instead of the current window.
+
To get the line number use |line()|. To get both use
|getpos()|.
+
For the screen column position use |virtcol()|. For the
character position use |charcol()|.
+
Note that only marks in the current file can be used.
+
Examples: >vim
echo col(".") " column of cursor
echo col("$") " length of cursor line plus one
echo col("'t") " column of mark t
echo col("'" .. markname) " column of mark markname
-< The first column is 1. Returns 0 if {expr} is invalid or when
+<
+ The first column is 1. Returns 0 if {expr} is invalid or when
the window with ID {winid} is not found.
For an uppercase mark the column may actually be in another
buffer.
@@ -736,6 +1097,14 @@ col({expr} [, {winid}]) *col()*
line. Also, when using a <Cmd> mapping the cursor isn't
moved, this can be used to obtain the column in Insert mode: >vim
imap <F2> <Cmd>echo col(".").."\n"<CR>
+<
+
+ Parameters: ~
+ • {expr} (`string|integer[]`)
+ • {winid} (`integer?`)
+
+ Return: ~
+ (`integer`)
complete({startcol}, {matches}) *complete()* *E785*
Set the matches for Insert mode completion.
@@ -767,6 +1136,10 @@ complete({startcol}, {matches}) *complete()* *E78
< This isn't very useful, but it shows how it works. Note that
an empty string is returned to avoid a zero being inserted.
+ Parameters: ~
+ • {startcol} (`integer`)
+ • {matches} (`any[]`)
+
complete_add({expr}) *complete_add()*
Add {expr} to the list of matches. Only to be used by the
function specified with the 'completefunc' option.
@@ -776,6 +1149,12 @@ complete_add({expr}) *complete_add()*
See |complete-functions| for an explanation of {expr}. It is
the same as one item in the list that 'omnifunc' would return.
+ Parameters: ~
+ • {expr} (`any`)
+
+ Return: ~
+ (`0|1|2`)
+
complete_check() *complete_check()*
Check for a key typed while looking for completion matches.
This is to be used when looking for matches takes some time.
@@ -784,6 +1163,9 @@ complete_check() *complete_check()*
Only to be used by the function specified with the
'completefunc' option.
+ Return: ~
+ (`0|1`)
+
complete_info([{what}]) *complete_info()*
Returns a |Dictionary| with information about Insert mode
completion. See |ins-completion|.
@@ -843,6 +1225,13 @@ complete_info([{what}]) *complete_info()*
call complete_info(['mode'])
" Get only 'mode' and 'pum_visible'
call complete_info(['mode', 'pum_visible'])
+<
+
+ Parameters: ~
+ • {what} (`any[]?`)
+
+ Return: ~
+ (`table`)
confirm({msg} [, {choices} [, {default} [, {type}]]]) *confirm()*
confirm() offers the user a dialog, from which a choice can be
@@ -896,6 +1285,15 @@ confirm({msg} [, {choices} [, {default} [, {type}]]]) *confirm()*
don't fit, a vertical layout is used anyway. For some systems
the horizontal layout is always used.
+ Parameters: ~
+ • {msg} (`string`)
+ • {choices} (`string?`)
+ • {default} (`integer?`)
+ • {type} (`string?`)
+
+ Return: ~
+ (`integer`)
+
copy({expr}) *copy()*
Make a copy of {expr}. For Numbers and Strings this isn't
different from using {expr} directly.
@@ -906,6 +1304,12 @@ copy({expr}) *copy()*
A |Dictionary| is copied in a similar way as a |List|.
Also see |deepcopy()|.
+ Parameters: ~
+ • {expr} (`any`)
+
+ Return: ~
+ (`any`)
+
cos({expr}) *cos()*
Return the cosine of {expr}, measured in radians, as a |Float|.
{expr} must evaluate to a |Float| or a |Number|.
@@ -916,6 +1320,12 @@ cos({expr}) *cos()*
echo cos(-4.01)
< -0.646043
+ Parameters: ~
+ • {expr} (`number`)
+
+ Return: ~
+ (`number`)
+
cosh({expr}) *cosh()*
Return the hyperbolic cosine of {expr} as a |Float| in the range
[1, inf].
@@ -927,6 +1337,12 @@ cosh({expr}) *cosh()*
echo cosh(-0.5)
< -1.127626
+ Parameters: ~
+ • {expr} (`number`)
+
+ Return: ~
+ (`number`)
+
count({comp}, {expr} [, {ic} [, {start}]]) *count()* *E706*
Return the number of times an item with value {expr} appears
in |String|, |List| or |Dictionary| {comp}.
@@ -940,15 +1356,33 @@ count({comp}, {expr} [, {ic} [, {start}]]) *count()* *E70
occurrences of {expr} is returned. Zero is returned when
{expr} is an empty string.
+ Parameters: ~
+ • {comp} (`string|table|any[]`)
+ • {expr} (`any`)
+ • {ic} (`boolean?`)
+ • {start} (`integer?`)
+
+ Return: ~
+ (`integer`)
+
ctxget([{index}]) *ctxget()*
Returns a |Dictionary| representing the |context| at {index}
from the top of the |context-stack| (see |context-dict|).
If {index} is not given, it is assumed to be 0 (i.e.: top).
+ Parameters: ~
+ • {index} (`integer?`)
+
+ Return: ~
+ (`table`)
+
ctxpop() *ctxpop()*
Pops and restores the |context| at the top of the
|context-stack|.
+ Return: ~
+ (`any`)
+
ctxpush([{types}]) *ctxpush()*
Pushes the current editor state (|context|) on the
|context-stack|.
@@ -956,15 +1390,31 @@ ctxpush([{types}]) *ctxpush()*
which |context-types| to include in the pushed context.
Otherwise, all context types are included.
+ Parameters: ~
+ • {types} (`string[]?`)
+
+ Return: ~
+ (`any`)
+
ctxset({context} [, {index}]) *ctxset()*
Sets the |context| at {index} from the top of the
|context-stack| to that represented by {context}.
{context} is a Dictionary with context data (|context-dict|).
If {index} is not given, it is assumed to be 0 (i.e.: top).
+ Parameters: ~
+ • {context} (`table`)
+ • {index} (`integer?`)
+
+ Return: ~
+ (`any`)
+
ctxsize() *ctxsize()*
Returns the size of the |context-stack|.
+ Return: ~
+ (`any`)
+
cursor({lnum}, {col} [, {off}]) *cursor()*
cursor({list})
Positions the cursor at the column (byte count) {col} in the
@@ -998,6 +1448,12 @@ cursor({list})
position within a <Tab> or after the last character.
Returns 0 when the position could be set, -1 otherwise.
+ Parameters: ~
+ • {list} (`integer[]`)
+
+ Return: ~
+ (`any`)
+
debugbreak({pid}) *debugbreak()*
Specifically used to interrupt a program being debugged. It
will cause process {pid} to get a SIGTRAP. Behavior for other
@@ -1007,6 +1463,12 @@ debugbreak({pid}) *debugbreak()*
Returns |TRUE| if successfully interrupted the program.
Otherwise returns |FALSE|.
+ Parameters: ~
+ • {pid} (`integer`)
+
+ Return: ~
+ (`any`)
+
deepcopy({expr} [, {noref}]) *deepcopy()* *E698*
Make a copy of {expr}. For Numbers and Strings this isn't
different from using {expr} directly.
@@ -1027,6 +1489,13 @@ deepcopy({expr} [, {noref}]) *deepcopy()* *E69
{noref} set to 1 will fail.
Also see |copy()|.
+ Parameters: ~
+ • {expr} (`any`)
+ • {noref} (`boolean?`)
+
+ Return: ~
+ (`any`)
+
delete({fname} [, {flags}]) *delete()*
Without {flags} or with {flags} empty: Deletes the file by the
name {fname}.
@@ -1046,6 +1515,13 @@ delete({fname} [, {flags}]) *delete()*
operation was successful and -1/true when the deletion failed
or partly failed.
+ Parameters: ~
+ • {fname} (`string`)
+ • {flags} (`string?`)
+
+ Return: ~
+ (`integer`)
+
deletebufline({buf}, {first} [, {last}]) *deletebufline()*
Delete lines {first} to {last} (inclusive) from buffer {buf}.
If {last} is omitted then delete line {first} only.
@@ -1060,6 +1536,14 @@ deletebufline({buf}, {first} [, {last}]) *deletebufline()*
when using |line()| this refers to the current buffer. Use "$"
to refer to the last line in buffer {buf}.
+ Parameters: ~
+ • {buf} (`integer|string`)
+ • {first} (`integer|string`)
+ • {last} (`integer|string?`)
+
+ Return: ~
+ (`any`)
+
dictwatcheradd({dict}, {pattern}, {callback}) *dictwatcheradd()*
Adds a watcher to a dictionary. A dictionary watcher is
identified by three components:
@@ -1100,11 +1584,27 @@ dictwatcheradd({dict}, {pattern}, {callback}) *dictwatcheradd()*
This function can be used by plugins to implement options with
validation and parsing logic.
+ Parameters: ~
+ • {dict} (`table`)
+ • {pattern} (`string`)
+ • {callback} (`function`)
+
+ Return: ~
+ (`any`)
+
dictwatcherdel({dict}, {pattern}, {callback}) *dictwatcherdel()*
Removes a watcher added with |dictwatcheradd()|. All three
arguments must match the ones passed to |dictwatcheradd()| in
order for the watcher to be successfully deleted.
+ Parameters: ~
+ • {dict} (`any`)
+ • {pattern} (`string`)
+ • {callback} (`function`)
+
+ Return: ~
+ (`any`)
+
did_filetype() *did_filetype()*
Returns |TRUE| when autocommands are being executed and the
FileType event has been triggered at least once. Can be used
@@ -1117,6 +1617,9 @@ did_filetype() *did_filetype()*
editing another buffer to set 'filetype' and load a syntax
file.
+ Return: ~
+ (`any`)
+
diff_filler({lnum}) *diff_filler()*
Returns the number of filler lines above line {lnum}.
These are the lines that were inserted at this point in
@@ -1126,6 +1629,12 @@ diff_filler({lnum}) *diff_filler()*
line, "'m" mark m, etc.
Returns 0 if the current window is not in diff mode.
+ Parameters: ~
+ • {lnum} (`integer`)
+
+ Return: ~
+ (`any`)
+
diff_hlID({lnum}, {col}) *diff_hlID()*
Returns the highlight ID for diff mode at line {lnum} column
{col} (byte index). When the current line does not have a
@@ -1137,6 +1646,13 @@ diff_hlID({lnum}, {col}) *diff_hlID()*
The highlight ID can be used with |synIDattr()| to obtain
syntax information about the highlighting.
+ Parameters: ~
+ • {lnum} (`integer`)
+ • {col} (`integer`)
+
+ Return: ~
+ (`any`)
+
digraph_get({chars}) *digraph_get()* *E1214*
Return the digraph of {chars}. This should be a string with
exactly two characters. If {chars} are not just two
@@ -1154,6 +1670,12 @@ digraph_get({chars}) *digraph_get()* *E121
echo digraph_get('aa') " Returns 'ã‚'
<
+ Parameters: ~
+ • {chars} (`string`)
+
+ Return: ~
+ (`any`)
+
digraph_getlist([{listall}]) *digraph_getlist()*
Return a list of digraphs. If the {listall} argument is given
and it is TRUE, return all digraphs, including the default
@@ -1169,6 +1691,12 @@ digraph_getlist([{listall}]) *digraph_getlist()*
echo digraph_getlist(1)
<
+ Parameters: ~
+ • {listall} (`boolean?`)
+
+ Return: ~
+ (`any`)
+
digraph_set({chars}, {digraph}) *digraph_set()*
Add digraph {chars} to the list. {chars} must be a string
with two characters. {digraph} is a string with one UTF-8
@@ -1186,9 +1714,13 @@ digraph_set({chars}, {digraph}) *digraph_set()*
Example: >vim
call digraph_set(' ', 'ã‚')
<
- Can be used as a |method|: >vim
- GetString()->digraph_set('ã‚')
-<
+
+ Parameters: ~
+ • {chars} (`string`)
+ • {digraph} (`string`)
+
+ Return: ~
+ (`any`)
digraph_setlist({digraphlist}) *digraph_setlist()*
Similar to |digraph_set()| but this function can add multiple
@@ -1205,9 +1737,11 @@ digraph_setlist({digraphlist}) *digraph_setlist()*
< Except that the function returns after the first error,
following digraphs will not be added.
- Can be used as a |method|: >vim
- GetList()->digraph_setlist()
-<
+ Parameters: ~
+ • {digraphlist} (`table<integer,string[]>`)
+
+ Return: ~
+ (`any`)
empty({expr}) *empty()*
Return the Number 1 if {expr} is empty, zero otherwise.
@@ -1218,6 +1752,12 @@ empty({expr}) *empty()*
- |v:false| and |v:null| are empty, |v:true| is not.
- A |Blob| is empty when its length is zero.
+ Parameters: ~
+ • {expr} (`any`)
+
+ Return: ~
+ (`any`)
+
environ() *environ()*
Return all of environment variables as dictionary. You can
check if an environment variable exists like this: >vim
@@ -1227,6 +1767,9 @@ environ() *environ()*
echo index(keys(environ()), 'HOME', 0, 1) != -1
<
+ Return: ~
+ (`any`)
+
escape({string}, {chars}) *escape()*
Escape the characters in {chars} that occur in {string} with a
backslash. Example: >vim
@@ -1235,6 +1778,13 @@ escape({string}, {chars}) *escape()*
c:\\program\ files\\vim
< Also see |shellescape()| and |fnameescape()|.
+ Parameters: ~
+ • {string} (`string`)
+ • {chars} (`string`)
+
+ Return: ~
+ (`any`)
+
eval({string}) *eval()*
Evaluate {string} and return the result. Especially useful to
turn the result of |string()| back into the original value.
@@ -1242,34 +1792,56 @@ eval({string}) *eval()*
of them. Also works for |Funcref|s that refer to existing
functions.
+ Parameters: ~
+ • {string} (`string`)
+
+ Return: ~
+ (`any`)
+
eventhandler() *eventhandler()*
Returns 1 when inside an event handler. That is that Vim got
interrupted while waiting for the user to type a character,
e.g., when dropping a file on Vim. This means interactive
commands cannot be used. Otherwise zero is returned.
+ Return: ~
+ (`any`)
+
executable({expr}) *executable()*
This function checks if an executable with the name {expr}
exists. {expr} must be the name of the program without any
arguments.
+
executable() uses the value of $PATH and/or the normal
- searchpath for programs. *PATHEXT*
+ searchpath for programs.
+ *PATHEXT*
On MS-Windows the ".exe", ".bat", etc. can optionally be
included. Then the extensions in $PATHEXT are tried. Thus if
"foo.exe" does not exist, "foo.exe.bat" can be found. If
- $PATHEXT is not set then ".exe;.com;.bat;.cmd" is used. A dot
+ $PATHEXT is not set then ".com;.exe;.bat;.cmd" is used. A dot
by itself can be used in $PATHEXT to try using the name
without an extension. When 'shell' looks like a Unix shell,
then the name is also tried without adding an extension.
On MS-Windows it only checks if the file exists and is not a
directory, not if it's really executable.
- On Windows an executable in the same directory as Vim is
- always found (it is added to $PATH at |startup|).
+ On MS-Windows an executable in the same directory as the Vim
+ executable is always found (it's added to $PATH at |startup|).
+ *NoDefaultCurrentDirectoryInExePath*
+ On MS-Windows an executable in Vim's current working directory
+ is also normally found, but this can be disabled by setting
+ the $NoDefaultCurrentDirectoryInExePath environment variable.
+
The result is a Number:
1 exists
0 does not exist
|exepath()| can be used to get the full path of an executable.
+ Parameters: ~
+ • {expr} (`string`)
+
+ Return: ~
+ (`0|1`)
+
execute({command} [, {silent}]) *execute()*
Execute {command} and capture its output.
If {command} is a |String|, returns {command} output.
@@ -1298,12 +1870,25 @@ execute({command} [, {silent}]) *execute()*
To execute a command in another window than the current one
use `win_execute()`.
+ Parameters: ~
+ • {command} (`string|string[]`)
+ • {silent} (`''|'silent'|'silent!'?`)
+
+ Return: ~
+ (`string`)
+
exepath({expr}) *exepath()*
Returns the full path of {expr} if it is an executable and
given as a (partial or full) path or is found in $PATH.
Returns empty string otherwise.
If {expr} starts with "./" the |current-directory| is used.
+ Parameters: ~
+ • {expr} (`string`)
+
+ Return: ~
+ (`string`)
+
exists({expr}) *exists()*
The result is a Number, which is |TRUE| if {expr} is
defined, zero otherwise.
@@ -1393,6 +1978,12 @@ exists({expr}) *exists()*
< This doesn't check for existence of the "bufcount" variable,
but gets the value of "bufcount", and checks if that exists.
+ Parameters: ~
+ • {expr} (`string`)
+
+ Return: ~
+ (`0|1`)
+
exp({expr}) *exp()*
Return the exponential of {expr} as a |Float| in the range
[0, inf].
@@ -1404,6 +1995,12 @@ exp({expr}) *exp()*
echo exp(-1)
< 0.367879
+ Parameters: ~
+ • {expr} (`number`)
+
+ Return: ~
+ (`any`)
+
expand({string} [, {nosuf} [, {list}]]) *expand()*
Expand wildcards and the following special keywords in
{string}. 'wildignorecase' applies.
@@ -1495,6 +2092,14 @@ expand({string} [, {nosuf} [, {list}]]) *expand()*
See |glob()| for finding existing files. See |system()| for
getting the raw output of an external command.
+ Parameters: ~
+ • {string} (`string`)
+ • {nosuf} (`boolean?`)
+ • {list} (`nil|false?`)
+
+ Return: ~
+ (`string`)
+
expandcmd({string} [, {options}]) *expandcmd()*
Expand special items in String {string} like what is done for
an Ex command such as `:edit`. This expands special keywords,
@@ -1519,6 +2124,13 @@ expandcmd({string} [, {options}]) *expandcmd()*
echo expandcmd('make %<.o', {'errmsg': v:true})
<
+ Parameters: ~
+ • {string} (`string`)
+ • {options} (`table?`)
+
+ Return: ~
+ (`any`)
+
extend({expr1}, {expr2} [, {expr3}]) *extend()*
{expr1} and {expr2} must be both |Lists| or both
|Dictionaries|.
@@ -1555,11 +2167,27 @@ extend({expr1}, {expr2} [, {expr3}]) *extend()*
fails.
Returns {expr1}. Returns 0 on error.
+ Parameters: ~
+ • {expr1} (`table`)
+ • {expr2} (`table`)
+ • {expr3} (`table?`)
+
+ Return: ~
+ (`any`)
+
extendnew({expr1}, {expr2} [, {expr3}]) *extendnew()*
Like |extend()| but instead of adding items to {expr1} a new
List or Dictionary is created and returned. {expr1} remains
unchanged.
+ Parameters: ~
+ • {expr1} (`table`)
+ • {expr2} (`table`)
+ • {expr3} (`table?`)
+
+ Return: ~
+ (`any`)
+
feedkeys({string} [, {mode}]) *feedkeys()*
Characters in {string} are queued for processing as if they
come from a mapping or were typed by the user.
@@ -1606,6 +2234,29 @@ feedkeys({string} [, {mode}]) *feedkeys()*
Return value is always 0.
+ Parameters: ~
+ • {string} (`string`)
+ • {mode} (`string?`)
+
+ Return: ~
+ (`any`)
+
+filecopy({from}, {to}) *filecopy()*
+ Copy the file pointed to by the name {from} to {to}. The
+ result is a Number, which is |TRUE| if the file was copied
+ successfully, and |FALSE| when it failed.
+ If a file with name {to} already exists, it will fail.
+ Note that it does not handle directories (yet).
+
+ This function is not available in the |sandbox|.
+
+ Parameters: ~
+ • {from} (`string`)
+ • {to} (`string`)
+
+ Return: ~
+ (`0|1`)
+
filereadable({file}) *filereadable()*
The result is a Number, which is |TRUE| when a file with the
name {file} exists, and can be read. If {file} doesn't exist,
@@ -1623,12 +2274,24 @@ filereadable({file}) *filereadable()*
1
<
+ Parameters: ~
+ • {file} (`string`)
+
+ Return: ~
+ (`0|1`)
+
filewritable({file}) *filewritable()*
The result is a Number, which is 1 when a file with the
name {file} exists, and can be written. If {file} doesn't
exist, or is not writable, the result is 0. If {file} is a
directory, and we can write to it, the result is 2.
+ Parameters: ~
+ • {file} (`string`)
+
+ Return: ~
+ (`0|1`)
+
filter({expr1}, {expr2}) *filter()*
{expr1} must be a |List|, |String|, |Blob| or |Dictionary|.
For each item in {expr1} evaluate {expr2} and when the result
@@ -1682,6 +2345,13 @@ filter({expr1}, {expr2}) *filter()*
When {expr2} is a Funcref errors inside a function are ignored,
unless it was defined with the "abort" flag.
+ Parameters: ~
+ • {expr1} (`string|table`)
+ • {expr2} (`string|function`)
+
+ Return: ~
+ (`any`)
+
finddir({name} [, {path} [, {count}]]) *finddir()*
Find directory {name} in {path}. Supports both downwards and
upwards recursive directory searches. See |file-searching|
@@ -1700,6 +2370,14 @@ finddir({name} [, {path} [, {count}]]) *finddir()*
This is quite similar to the ex-command `:find`.
+ Parameters: ~
+ • {name} (`string`)
+ • {path} (`string?`)
+ • {count} (`integer?`)
+
+ Return: ~
+ (`any`)
+
findfile({name} [, {path} [, {count}]]) *findfile()*
Just like |finddir()|, but find a file instead of a directory.
Uses 'suffixesadd'.
@@ -1708,6 +2386,14 @@ findfile({name} [, {path} [, {count}]]) *findfile()*
< Searches from the directory of the current file upwards until
it finds the file "tags.vim".
+ Parameters: ~
+ • {name} (`string`)
+ • {path} (`string?`)
+ • {count} (`any?`)
+
+ Return: ~
+ (`any`)
+
flatten({list} [, {maxdepth}]) *flatten()*
Flatten {list} up to {maxdepth} levels. Without {maxdepth}
the result is a |List| without nesting, as if {maxdepth} is
@@ -1727,9 +2413,23 @@ flatten({list} [, {maxdepth}]) *flatten()*
echo flatten([1, [2, [3, 4]], 5], 1)
< [1, 2, [3, 4], 5]
+ Parameters: ~
+ • {list} (`any[]`)
+ • {maxdepth} (`integer?`)
+
+ Return: ~
+ (`any[]|0`)
+
flattennew({list} [, {maxdepth}]) *flattennew()*
Like |flatten()| but first make a copy of {list}.
+ Parameters: ~
+ • {list} (`any[]`)
+ • {maxdepth} (`integer?`)
+
+ Return: ~
+ (`any[]|0`)
+
float2nr({expr}) *float2nr()*
Convert {expr} to a Number by omitting the part after the
decimal point.
@@ -1752,6 +2452,12 @@ float2nr({expr}) *float2nr()*
echo float2nr(1.0e-100)
< 0
+ Parameters: ~
+ • {expr} (`number`)
+
+ Return: ~
+ (`any`)
+
floor({expr}) *floor()*
Return the largest integral value less than or equal to
{expr} as a |Float| (round down).
@@ -1765,6 +2471,12 @@ floor({expr}) *floor()*
echo floor(4.0)
< 4.0
+ Parameters: ~
+ • {expr} (`number`)
+
+ Return: ~
+ (`any`)
+
fmod({expr1}, {expr2}) *fmod()*
Return the remainder of {expr1} / {expr2}, even if the
division is not representable. Returns {expr1} - i * {expr2}
@@ -1781,6 +2493,13 @@ fmod({expr1}, {expr2}) *fmod()*
echo fmod(-12.33, 1.22)
< -0.13
+ Parameters: ~
+ • {expr1} (`number`)
+ • {expr2} (`number`)
+
+ Return: ~
+ (`any`)
+
fnameescape({string}) *fnameescape()*
Escape {string} for use as file name command argument. All
characters that have a special meaning, such as `'%'` and `'|'`
@@ -1798,6 +2517,12 @@ fnameescape({string}) *fnameescape()*
edit \+some\ str\%nge\|name
<
+ Parameters: ~
+ • {string} (`string`)
+
+ Return: ~
+ (`string`)
+
fnamemodify({fname}, {mods}) *fnamemodify()*
Modify file name {fname} according to {mods}. {mods} is a
string of characters like it is used for file names on the
@@ -1815,6 +2540,13 @@ fnamemodify({fname}, {mods}) *fnamemodify()*
Note: Environment variables don't work in {fname}, use
|expand()| first then.
+ Parameters: ~
+ • {fname} (`string`)
+ • {mods} (`string`)
+
+ Return: ~
+ (`string`)
+
foldclosed({lnum}) *foldclosed()*
The result is a Number. If the line {lnum} is in a closed
fold, the result is the number of the first line in that fold.
@@ -1822,6 +2554,12 @@ foldclosed({lnum}) *foldclosed()*
{lnum} is used like with |getline()|. Thus "." is the current
line, "'m" mark m, etc.
+ Parameters: ~
+ • {lnum} (`integer`)
+
+ Return: ~
+ (`integer`)
+
foldclosedend({lnum}) *foldclosedend()*
The result is a Number. If the line {lnum} is in a closed
fold, the result is the number of the last line in that fold.
@@ -1829,6 +2567,12 @@ foldclosedend({lnum}) *foldclosedend()*
{lnum} is used like with |getline()|. Thus "." is the current
line, "'m" mark m, etc.
+ Parameters: ~
+ • {lnum} (`integer`)
+
+ Return: ~
+ (`integer`)
+
foldlevel({lnum}) *foldlevel()*
The result is a Number, which is the foldlevel of line {lnum}
in the current buffer. For nested folds the deepest level is
@@ -1841,6 +2585,12 @@ foldlevel({lnum}) *foldlevel()*
{lnum} is used like with |getline()|. Thus "." is the current
line, "'m" mark m, etc.
+ Parameters: ~
+ • {lnum} (`integer`)
+
+ Return: ~
+ (`integer`)
+
foldtext() *foldtext()*
Returns a String, to be displayed for a closed fold. This is
the default function used for the 'foldtext' option and should
@@ -1858,6 +2608,9 @@ foldtext() *foldtext()*
setting.
Returns an empty string when there is no fold.
+ Return: ~
+ (`string`)
+
foldtextresult({lnum}) *foldtextresult()*
Returns the text that is displayed for the closed fold at line
{lnum}. Evaluates 'foldtext' in the appropriate context.
@@ -1867,6 +2620,12 @@ foldtextresult({lnum}) *foldtextresult()*
line, "'m" mark m, etc.
Useful when exporting folded text, e.g., to HTML.
+ Parameters: ~
+ • {lnum} (`integer`)
+
+ Return: ~
+ (`string`)
+
foreach({expr1}, {expr2}) *foreach()*
{expr1} must be a |List|, |String|, |Blob| or |Dictionary|.
For each item in {expr1} execute {expr2}. {expr1} is not
@@ -1902,6 +2661,13 @@ foreach({expr1}, {expr2}) *foreach()*
When {expr2} is a Funcref errors inside a function are ignored,
unless it was defined with the "abort" flag.
+ Parameters: ~
+ • {expr1} (`string|table`)
+ • {expr2} (`string|function`)
+
+ Return: ~
+ (`any`)
+
fullcommand({name}) *fullcommand()*
Get the full command name from a short abbreviated command
name; see |20.2| for details on command abbreviations.
@@ -1914,6 +2680,12 @@ fullcommand({name}) *fullcommand()*
For example `fullcommand('s')`, `fullcommand('sub')`,
`fullcommand(':%substitute')` all return "substitute".
+ Parameters: ~
+ • {name} (`string`)
+
+ Return: ~
+ (`string`)
+
funcref({name} [, {arglist}] [, {dict}]) *funcref()*
Just like |function()|, but the returned Funcref will lookup
the function by reference, not by name. This matters when the
@@ -1926,6 +2698,14 @@ funcref({name} [, {arglist}] [, {dict}]) *funcref()*
instead). {name} cannot be a builtin function.
Returns 0 on error.
+ Parameters: ~
+ • {name} (`string`)
+ • {arglist} (`any?`)
+ • {dict} (`any?`)
+
+ Return: ~
+ (`any`)
+
function({name} [, {arglist}] [, {dict}]) *function()* *partial* *E700* *E923*
Return a |Funcref| variable that refers to function {name}.
{name} can be the name of a user defined function or an
@@ -2008,6 +2788,14 @@ function({name} [, {arglist}] [, {dict}]) *function()* *partial* *E700*
<
Returns 0 on error.
+ Parameters: ~
+ • {name} (`string`)
+ • {arglist} (`any?`)
+ • {dict} (`any?`)
+
+ Return: ~
+ (`any`)
+
garbagecollect([{atexit}]) *garbagecollect()*
Cleanup unused |Lists| and |Dictionaries| that have circular
references.
@@ -2028,17 +2816,39 @@ garbagecollect([{atexit}]) *garbagecollect()*
it's safe to perform. This is when waiting for the user to
type a character.
-get({list}, {idx} [, {default}]) *get()*
+ Parameters: ~
+ • {atexit} (`boolean?`)
+
+ Return: ~
+ (`any`)
+
+get({list}, {idx} [, {default}]) *get()* *get()-list*
Get item {idx} from |List| {list}. When this item is not
available return {default}. Return zero when {default} is
omitted.
-get({blob}, {idx} [, {default}])
+ Parameters: ~
+ • {list} (`any[]`)
+ • {idx} (`integer`)
+ • {default} (`any?`)
+
+ Return: ~
+ (`any`)
+
+get({blob}, {idx} [, {default}]) *get()-blob*
Get byte {idx} from |Blob| {blob}. When this byte is not
available return {default}. Return -1 when {default} is
omitted.
-get({dict}, {key} [, {default}])
+ Parameters: ~
+ • {blob} (`string`)
+ • {idx} (`integer`)
+ • {default} (`any?`)
+
+ Return: ~
+ (`any`)
+
+get({dict}, {key} [, {default}]) *get()-dict*
Get item with key {key} from |Dictionary| {dict}. When this
item is not available return {default}. Return zero when
{default} is omitted. Useful example: >vim
@@ -2046,15 +2856,43 @@ get({dict}, {key} [, {default}])
< This gets the value of g:var_name if it exists, and uses
"default" when it does not exist.
-get({func}, {what})
- Get item {what} from Funcref {func}. Possible values for
+ Parameters: ~
+ • {dict} (`table<string,any>`)
+ • {key} (`string`)
+ • {default} (`any?`)
+
+ Return: ~
+ (`any`)
+
+get({func}, {what}) *get()-func*
+ Get item {what} from |Funcref| {func}. Possible values for
{what} are:
- "name" The function name
- "func" The function
- "dict" The dictionary
- "args" The list with arguments
+ "name" The function name
+ "func" The function
+ "dict" The dictionary
+ "args" The list with arguments
+ "arity" A dictionary with information about the number of
+ arguments accepted by the function (minus the
+ {arglist}) with the following fields:
+ required the number of positional arguments
+ optional the number of optional arguments,
+ in addition to the required ones
+ varargs |TRUE| if the function accepts a
+ variable number of arguments |...|
+
+ Note: There is no error, if the {arglist} of
+ the Funcref contains more arguments than the
+ Funcref expects, it's not validated.
+
Returns zero on error.
+ Parameters: ~
+ • {func} (`function`)
+ • {what} (`string`)
+
+ Return: ~
+ (`any`)
+
getbufinfo([{buf}]) *getbufinfo()*
getbufinfo([{dict}])
Get information about buffers as a List of Dictionaries.
@@ -2124,6 +2962,12 @@ getbufinfo([{dict}])
getbufvar({bufnr}, '&option_name')
<
+ Parameters: ~
+ • {dict} (`vim.fn.getbufinfo.dict?`)
+
+ Return: ~
+ (`vim.fn.getbufinfo.ret.item[]`)
+
getbufline({buf}, {lnum} [, {end}]) *getbufline()*
Return a |List| with the lines starting from {lnum} to {end}
(inclusive) in the buffer {buf}. If {end} is omitted, a
@@ -2148,11 +2992,27 @@ getbufline({buf}, {lnum} [, {end}]) *getbufline()*
Example: >vim
let lines = getbufline(bufnr("myfile"), 1, "$")
+<
+
+ Parameters: ~
+ • {buf} (`integer|string`)
+ • {lnum} (`integer`)
+ • {end_} (`integer?`)
+
+ Return: ~
+ (`any`)
getbufoneline({buf}, {lnum}) *getbufoneline()*
Just like `getbufline()` but only get one line and return it
as a string.
+ Parameters: ~
+ • {buf} (`integer|string`)
+ • {lnum} (`integer`)
+
+ Return: ~
+ (`string`)
+
getbufvar({buf}, {varname} [, {def}]) *getbufvar()*
The result is the value of option or local buffer variable
{varname} in buffer {buf}. Note that the name without "b:"
@@ -2174,12 +3034,23 @@ getbufvar({buf}, {varname} [, {def}]) *getbufvar()*
let bufmodified = getbufvar(1, "&mod")
echo "todo myvar = " .. getbufvar("todo", "myvar")
+ Parameters: ~
+ • {buf} (`integer|string`)
+ • {varname} (`string`)
+ • {def} (`any?`)
+
+ Return: ~
+ (`any`)
+
getcellwidths() *getcellwidths()*
Returns a |List| of cell widths of character ranges overridden
by |setcellwidths()|. The format is equal to the argument of
|setcellwidths()|. If no character ranges have their cell
widths overridden, an empty List is returned.
+ Return: ~
+ (`any`)
+
getchangelist([{buf}]) *getchangelist()*
Returns the |changelist| for the buffer {buf}. For the use
of {buf}, see |bufname()| above. If buffer {buf} doesn't
@@ -2196,6 +3067,12 @@ getchangelist([{buf}]) *getchangelist()*
position refers to the position in the list. For other
buffers, it is set to the length of the list.
+ Parameters: ~
+ • {buf} (`integer|string?`)
+
+ Return: ~
+ (`table[]`)
+
getchar([{expr}]) *getchar()*
Get a single character from the user or input stream.
If {expr} is omitted, wait until a character is available.
@@ -2261,6 +3138,12 @@ getchar([{expr}]) *getchar()*
endfunction
<
+ Parameters: ~
+ • {expr} (`0|1?`)
+
+ Return: ~
+ (`integer`)
+
getcharmod() *getcharmod()*
The result is a Number which is the state of the modifiers for
the last obtained character with getchar() or in another way.
@@ -2277,6 +3160,9 @@ getcharmod() *getcharmod()*
character itself are obtained. Thus Shift-a results in "A"
without a modifier. Returns 0 if no modifiers are used.
+ Return: ~
+ (`integer`)
+
getcharpos({expr}) *getcharpos()*
Get the position for String {expr}. Same as |getpos()| but the
column number in the returned List is a character index
@@ -2291,6 +3177,12 @@ getcharpos({expr}) *getcharpos()*
getpos('.') returns [0, 5, 7, 0]
<
+ Parameters: ~
+ • {expr} (`string`)
+
+ Return: ~
+ (`integer[]`)
+
getcharsearch() *getcharsearch()*
Return the current character search information as a {dict}
with the following entries:
@@ -2311,6 +3203,9 @@ getcharsearch() *getcharsearch()*
nnoremap <expr> , getcharsearch().forward ? ',' : ';'
< Also see |setcharsearch()|.
+ Return: ~
+ (`table`)
+
getcharstr([{expr}]) *getcharstr()*
Get a single character from the user or input stream as a
string.
@@ -2323,34 +3218,60 @@ getcharstr([{expr}]) *getcharstr()*
Otherwise this works like |getchar()|, except that a number
result is converted to a string.
+ Parameters: ~
+ • {expr} (`0|1?`)
+
+ Return: ~
+ (`string`)
+
getcmdcompltype() *getcmdcompltype()*
Return the type of the current command-line completion.
Only works when the command line is being edited, thus
requires use of |c_CTRL-\_e| or |c_CTRL-R_=|.
See |:command-completion| for the return string.
- Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()| and
- |setcmdline()|.
+ Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()|,
+ |getcmdprompt()| and |setcmdline()|.
Returns an empty string when completion is not defined.
+ Return: ~
+ (`string`)
+
getcmdline() *getcmdline()*
- Return the current command-line. Only works when the command
- line is being edited, thus requires use of |c_CTRL-\_e| or
- |c_CTRL-R_=|.
+ Return the current command-line input. Only works when the
+ command line is being edited, thus requires use of
+ |c_CTRL-\_e| or |c_CTRL-R_=|.
Example: >vim
cmap <F7> <C-\>eescape(getcmdline(), ' \')<CR>
-< Also see |getcmdtype()|, |getcmdpos()|, |setcmdpos()| and
- |setcmdline()|.
+< Also see |getcmdtype()|, |getcmdpos()|, |setcmdpos()|,
+ |getcmdprompt()| and |setcmdline()|.
Returns an empty string when entering a password or using
|inputsecret()|.
+ Return: ~
+ (`string`)
+
getcmdpos() *getcmdpos()*
Return the position of the cursor in the command line as a
byte count. The first column is 1.
Only works when editing the command line, thus requires use of
|c_CTRL-\_e| or |c_CTRL-R_=| or an expression mapping.
Returns 0 otherwise.
- Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()| and
- |setcmdline()|.
+ Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()|,
+ |getcmdprompt()| and |setcmdline()|.
+
+ Return: ~
+ (`integer`)
+
+getcmdprompt() *getcmdprompt()*
+ Return the current command-line prompt when using functions
+ like |input()| or |confirm()|.
+ Only works when the command line is being edited, thus
+ requires use of |c_CTRL-\_e| or |c_CTRL-R_=|.
+ Also see |getcmdtype()|, |getcmdline()|, |getcmdpos()|,
+ |setcmdpos()| and |setcmdline()|.
+
+ Return: ~
+ (`string`)
getcmdscreenpos() *getcmdscreenpos()*
Return the screen position of the cursor in the command line
@@ -2362,6 +3283,9 @@ getcmdscreenpos() *getcmdscreenpos()*
Also see |getcmdpos()|, |setcmdpos()|, |getcmdline()| and
|setcmdline()|.
+ Return: ~
+ (`any`)
+
getcmdtype() *getcmdtype()*
Return the current command-line type. Possible return values
are:
@@ -2377,11 +3301,17 @@ getcmdtype() *getcmdtype()*
Returns an empty string otherwise.
Also see |getcmdpos()|, |setcmdpos()| and |getcmdline()|.
+ Return: ~
+ (`':'|'>'|'/'|'?'|'@'|'-'|'='`)
+
getcmdwintype() *getcmdwintype()*
Return the current |command-line-window| type. Possible return
values are the same as |getcmdtype()|. Returns an empty string
when not in the command-line window.
+ Return: ~
+ (`':'|'>'|'/'|'?'|'@'|'-'|'='`)
+
getcompletion({pat}, {type} [, {filtered}]) *getcompletion()*
Return a list of command-line completion matches. The String
{type} argument specifies what for. The following completion
@@ -2399,6 +3329,7 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()*
customlist,{func} custom completion, defined via {func}
diff_buffer |:diffget| and |:diffput| completion
dir directory names
+ dir_in_path directory names in |'cdpath'|
environment environment variable names
event autocommand events
expression Vim expression
@@ -2451,6 +3382,14 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()*
If there are no matches, an empty list is returned. An
invalid value for {type} produces an error.
+ Parameters: ~
+ • {pat} (`string`)
+ • {type} (`string`)
+ • {filtered} (`boolean?`)
+
+ Return: ~
+ (`string[]`)
+
getcurpos([{winid}]) *getcurpos()*
Get the position of the cursor. This is like getpos('.'), but
includes an extra "curswant" item in the list:
@@ -2476,6 +3415,12 @@ getcurpos([{winid}]) *getcurpos()*
< Note that this only works within the window. See
|winrestview()| for restoring more state.
+ Parameters: ~
+ • {winid} (`integer?`)
+
+ Return: ~
+ (`any`)
+
getcursorcharpos([{winid}]) *getcursorcharpos()*
Same as |getcurpos()| but the column number in the returned
List is a character index instead of a byte index.
@@ -2486,6 +3431,12 @@ getcursorcharpos([{winid}]) *getcursorcharpos()*
getcurpos() " returns [0, 3, 4, 0, 3]
<
+ Parameters: ~
+ • {winid} (`integer?`)
+
+ Return: ~
+ (`any`)
+
getcwd([{winnr} [, {tabnr}]]) *getcwd()*
With no arguments, returns the name of the effective
|current-directory|. With {winnr} or {tabnr} the working
@@ -2502,6 +3453,13 @@ getcwd([{winnr} [, {tabnr}]]) *getcwd()*
directory is returned.
Throw error if the arguments are invalid. |E5000| |E5001| |E5002|
+ Parameters: ~
+ • {winnr} (`integer?`)
+ • {tabnr} (`integer?`)
+
+ Return: ~
+ (`string`)
+
getenv({name}) *getenv()*
Return the value of environment variable {name}. The {name}
argument is a string, without a leading '$'. Example: >vim
@@ -2511,6 +3469,12 @@ getenv({name}) *getenv()*
is different from a variable set to an empty string.
See also |expr-env|.
+ Parameters: ~
+ • {name} (`string`)
+
+ Return: ~
+ (`string`)
+
getfontname([{name}]) *getfontname()*
Without an argument returns the name of the normal font being
used. Like what is used for the Normal highlight group
@@ -2523,6 +3487,12 @@ getfontname([{name}]) *getfontname()*
gvimrc file. Use the |GUIEnter| autocommand to use this
function just after the GUI has started.
+ Parameters: ~
+ • {name} (`string?`)
+
+ Return: ~
+ (`string`)
+
getfperm({fname}) *getfperm()*
The result is a String, which is the read, write, and execute
permissions of the given file {fname}.
@@ -2540,6 +3510,12 @@ getfperm({fname}) *getfperm()*
For setting permissions use |setfperm()|.
+ Parameters: ~
+ • {fname} (`string`)
+
+ Return: ~
+ (`string`)
+
getfsize({fname}) *getfsize()*
The result is a Number, which is the size in bytes of the
given file {fname}.
@@ -2548,6 +3524,12 @@ getfsize({fname}) *getfsize()*
If the size of {fname} is too big to fit in a Number then -2
is returned.
+ Parameters: ~
+ • {fname} (`string`)
+
+ Return: ~
+ (`integer`)
+
getftime({fname}) *getftime()*
The result is a Number, which is the last modification time of
the given file {fname}. The value is measured as seconds
@@ -2555,6 +3537,12 @@ getftime({fname}) *getftime()*
|localtime()| and |strftime()|.
If the file {fname} can't be found -1 is returned.
+ Parameters: ~
+ • {fname} (`string`)
+
+ Return: ~
+ (`integer`)
+
getftype({fname}) *getftype()*
The result is a String, which is a description of the kind of
file of the given file {fname}.
@@ -2575,6 +3563,12 @@ getftype({fname}) *getftype()*
systems that support it. On some systems only "dir" and
"file" are returned.
+ Parameters: ~
+ • {fname} (`string`)
+
+ Return: ~
+ (`'file'|'dir'|'link'|'bdev'|'cdev'|'socket'|'fifo'|'other'`)
+
getjumplist([{winnr} [, {tabnr}]]) *getjumplist()*
Returns the |jumplist| for the specified window.
@@ -2595,6 +3589,13 @@ getjumplist([{winnr} [, {tabnr}]]) *getjumplist()*
filename filename if available
lnum line number
+ Parameters: ~
+ • {winnr} (`integer?`)
+ • {tabnr} (`integer?`)
+
+ Return: ~
+ (`vim.fn.getjumplist.ret`)
+
getline({lnum} [, {end}]) *getline()*
Without {end} the result is a String, which is line {lnum}
from the current buffer. Example: >vim
@@ -2620,6 +3621,13 @@ getline({lnum} [, {end}]) *getline()*
< To get lines from another buffer see |getbufline()| and
|getbufoneline()|
+ Parameters: ~
+ • {lnum} (`integer|string`)
+ • {end_} (`nil|false?`)
+
+ Return: ~
+ (`string`)
+
getloclist({nr} [, {what}]) *getloclist()*
Returns a |List| with all the entries in the location list for
window {nr}. {nr} can be the window number or the |window-ID|.
@@ -2652,6 +3660,13 @@ getloclist({nr} [, {what}]) *getloclist()*
echo getloclist(5, {'filewinid': 0})
<
+ Parameters: ~
+ • {nr} (`integer`)
+ • {what} (`table?`)
+
+ Return: ~
+ (`any`)
+
getmarklist([{buf}]) *getmarklist()*
Without the {buf} argument returns a |List| with information
about all the global marks. |mark|
@@ -2671,6 +3686,12 @@ getmarklist([{buf}]) *getmarklist()*
Refer to |getpos()| for getting information about a specific
mark.
+ Parameters: ~
+ • {buf} (`integer??`)
+
+ Return: ~
+ (`vim.fn.getmarklist.ret.item[]`)
+
getmatches([{win}]) *getmatches()*
Returns a |List| with all matches previously defined for the
current window by |matchadd()| and the |:match| commands.
@@ -2703,6 +3724,12 @@ getmatches([{win}]) *getmatches()*
unlet m
<
+ Parameters: ~
+ • {win} (`integer?`)
+
+ Return: ~
+ (`any`)
+
getmousepos() *getmousepos()*
Returns a |Dictionary| with the last known position of the
mouse. This can be used in a mapping for a mouse click. The
@@ -2734,14 +3761,45 @@ getmousepos() *getmousepos()*
When using |getchar()| the Vim variables |v:mouse_lnum|,
|v:mouse_col| and |v:mouse_winid| also provide these values.
+ Return: ~
+ (`vim.fn.getmousepos.ret`)
+
getpid() *getpid()*
Return a Number which is the process ID of the Vim process.
This is a unique number, until Vim exits.
+ Return: ~
+ (`integer`)
+
getpos({expr}) *getpos()*
- Get the position for String {expr}. For possible values of
- {expr} see |line()|. For getting the cursor position see
- |getcurpos()|.
+ Get the position for String {expr}.
+ The accepted values for {expr} are:
+ . The cursor position.
+ $ The last line in the current buffer.
+ 'x Position of mark x (if the mark is not set, 0 is
+ returned for all values).
+ w0 First line visible in current window (one if the
+ display isn't updated, e.g. in silent Ex mode).
+ w$ Last line visible in current window (this is one
+ less than "w0" if no lines are visible).
+ v When not in Visual mode, returns the cursor
+ position. In Visual mode, returns the other end
+ of the Visual area. A good way to think about
+ this is that in Visual mode "v" and "." complement
+ each other. While "." refers to the cursor
+ position, "v" refers to where |v_o| would move the
+ cursor. As a result, you can use "v" and "."
+ together to work on all of a selection in
+ characterwise Visual mode. If the cursor is at
+ the end of a characterwise Visual area, "v" refers
+ to the start of the same Visual area. And if the
+ cursor is at the start of a characterwise Visual
+ area, "v" refers to the end of the same Visual
+ area. "v" differs from |'<| and |'>| in that it's
+ updated right away.
+ Note that a mark in another file can be used. The line number
+ then applies to another buffer.
+
The result is a |List| with four numbers:
[bufnum, lnum, col, off]
"bufnum" is zero, unless a mark like '0 or 'A is used, then it
@@ -2752,20 +3810,31 @@ getpos({expr}) *getpos()*
it is the offset in screen columns from the start of the
character. E.g., a position within a <Tab> or after the last
character.
- Note that for '< and '> Visual mode matters: when it is "V"
- (visual line mode) the column of '< is zero and the column of
- '> is a large number equal to |v:maxcol|.
+
+ For getting the cursor position see |getcurpos()|.
The column number in the returned List is the byte position
within the line. To get the character position in the line,
use |getcharpos()|.
+
+ Note that for '< and '> Visual mode matters: when it is "V"
+ (visual line mode) the column of '< is zero and the column of
+ '> is a large number equal to |v:maxcol|.
A very large column number equal to |v:maxcol| can be returned,
in which case it means "after the end of the line".
If {expr} is invalid, returns a list with all zeros.
+
This can be used to save and restore the position of a mark: >vim
let save_a_mark = getpos("'a")
" ...
call setpos("'a", save_a_mark)
-< Also see |getcharpos()|, |getcurpos()| and |setpos()|.
+<
+ Also see |getcharpos()|, |getcurpos()| and |setpos()|.
+
+ Parameters: ~
+ • {expr} (`string`)
+
+ Return: ~
+ (`integer[]`)
getqflist([{what}]) *getqflist()*
Returns a |List| with all the current quickfix errors. Each
@@ -2871,6 +3940,12 @@ getqflist([{what}]) *getqflist()*
echo getqflist({'lines' : ["F1:10:L10"]})
<
+ Parameters: ~
+ • {what} (`table?`)
+
+ Return: ~
+ (`any`)
+
getreg([{regname} [, 1 [, {list}]]]) *getreg()*
The result is a String, which is the contents of register
{regname}. Example: >vim
@@ -2894,6 +3969,13 @@ getreg([{regname} [, 1 [, {list}]]]) *getreg()*
If {regname} is not specified, |v:register| is used.
+ Parameters: ~
+ • {regname} (`string?`)
+ • {list} (`nil|false?`)
+
+ Return: ~
+ (`string`)
+
getreginfo([{regname}]) *getreginfo()*
Returns detailed information about register {regname} as a
Dictionary with the following entries:
@@ -2918,6 +4000,12 @@ getreginfo([{regname}]) *getreginfo()*
If {regname} is not specified, |v:register| is used.
The returned Dictionary can be passed to |setreg()|.
+ Parameters: ~
+ • {regname} (`string?`)
+
+ Return: ~
+ (`table`)
+
getregion({pos1}, {pos2} [, {opts}]) *getregion()*
Returns the list of strings from {pos1} to {pos2} from a
buffer.
@@ -2930,14 +4018,14 @@ getregion({pos1}, {pos2} [, {opts}]) *getregion()*
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
+ type Specify the region's selection type.
+ See |getregtype()| for possible values,
+ except that the width can be omitted
+ and an empty string cannot be used.
+ (default: "v")
exclusive If |TRUE|, use exclusive selection
- for the end position
+ for the end position.
(default: follow 'selection')
You can get the last selection type by |visualmode()|.
@@ -2963,12 +4051,20 @@ getregion({pos1}, {pos2} [, {opts}]) *getregion()*
difference if the buffer is displayed in a window with
different 'virtualedit' or 'list' values.
- Examples: >
- :xnoremap <CR>
+ Examples: >vim
+ xnoremap <CR>
\ <Cmd>echom getregion(
\ getpos('v'), getpos('.'), #{ type: mode() })<CR>
<
+ Parameters: ~
+ • {pos1} (`table`)
+ • {pos2} (`table`)
+ • {opts} (`table?`)
+
+ Return: ~
+ (`string[]`)
+
getregionpos({pos1}, {pos2} [, {opts}]) *getregionpos()*
Same as |getregion()|, but returns a list of positions
describing the buffer text segments bound by {pos1} and
@@ -3001,6 +4097,14 @@ getregionpos({pos1}, {pos2} [, {opts}]) *getregionpos()*
value of 0 is used for both positions.
(default: |FALSE|)
+ Parameters: ~
+ • {pos1} (`table`)
+ • {pos2} (`table`)
+ • {opts} (`table?`)
+
+ Return: ~
+ (`integer[][][]`)
+
getregtype([{regname}]) *getregtype()*
The result is a String, which is type of register {regname}.
The value will be one of:
@@ -3012,6 +4116,12 @@ getregtype([{regname}]) *getregtype()*
The {regname} argument is a string. If {regname} is not
specified, |v:register| is used.
+ Parameters: ~
+ • {regname} (`string?`)
+
+ Return: ~
+ (`string`)
+
getscriptinfo([{opts}]) *getscriptinfo()*
Returns a |List| with information about all the sourced Vim
scripts in the order they were sourced, like what
@@ -3049,6 +4159,12 @@ getscriptinfo([{opts}]) *getscriptinfo()*
echo getscriptinfo({'sid': 15})[0].variables
<
+ Parameters: ~
+ • {opts} (`table?`)
+
+ Return: ~
+ (`vim.fn.getscriptinfo.ret[]`)
+
gettabinfo([{tabnr}]) *gettabinfo()*
If {tabnr} is not specified, then information about all the
tab pages is returned as a |List|. Each List item is a
@@ -3062,6 +4178,12 @@ gettabinfo([{tabnr}]) *gettabinfo()*
tabpage-local variables
windows List of |window-ID|s in the tab page.
+ Parameters: ~
+ • {tabnr} (`integer?`)
+
+ Return: ~
+ (`any`)
+
gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()*
Get the value of a tab-local variable {varname} in tab page
{tabnr}. |t:var|
@@ -3072,6 +4194,14 @@ gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()*
When the tab or variable doesn't exist {def} or an empty
string is returned, there is no error message.
+ Parameters: ~
+ • {tabnr} (`integer`)
+ • {varname} (`string`)
+ • {def} (`any?`)
+
+ Return: ~
+ (`any`)
+
gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()*
Get the value of window-local variable {varname} in window
{winnr} in tab page {tabnr}.
@@ -3099,6 +4229,15 @@ gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()*
gettabwinvar({tabnr}, {winnr}, '&')
<
+ Parameters: ~
+ • {tabnr} (`integer`)
+ • {winnr} (`integer`)
+ • {varname} (`string`)
+ • {def} (`any?`)
+
+ Return: ~
+ (`any`)
+
gettagstack([{winnr}]) *gettagstack()*
The result is a Dict, which is the tag stack of window {winnr}.
{winnr} can be the window number or the |window-ID|.
@@ -3127,6 +4266,12 @@ gettagstack([{winnr}]) *gettagstack()*
See |tagstack| for more information about the tag stack.
+ Parameters: ~
+ • {winnr} (`integer?`)
+
+ Return: ~
+ (`any`)
+
gettext({text}) *gettext()*
Translate String {text} if possible.
This is mainly for use in the distributed Vim scripts. When
@@ -3138,6 +4283,12 @@ gettext({text}) *gettext()*
xgettext does not understand escaping in single quoted
strings.
+ Parameters: ~
+ • {text} (`string`)
+
+ Return: ~
+ (`any`)
+
getwininfo([{winid}]) *getwininfo()*
Returns information about windows as a |List| with Dictionaries.
@@ -3172,6 +4323,12 @@ getwininfo([{winid}]) *getwininfo()*
winrow topmost screen line of the window;
"row" from |win_screenpos()|
+ Parameters: ~
+ • {winid} (`integer?`)
+
+ Return: ~
+ (`vim.fn.getwininfo.ret.item[]`)
+
getwinpos([{timeout}]) *getwinpos()*
The result is a |List| with two numbers, the result of
|getwinposx()| and |getwinposy()| combined:
@@ -3193,24 +4350,44 @@ getwinpos([{timeout}]) *getwinpos()*
endwhile
<
+ Parameters: ~
+ • {timeout} (`integer?`)
+
+ Return: ~
+ (`any`)
+
getwinposx() *getwinposx()*
The result is a Number, which is the X coordinate in pixels of
the left hand side of the GUI Vim window. The result will be
-1 if the information is not available.
The value can be used with `:winpos`.
+ Return: ~
+ (`integer`)
+
getwinposy() *getwinposy()*
The result is a Number, which is the Y coordinate in pixels of
the top of the GUI Vim window. The result will be -1 if the
information is not available.
The value can be used with `:winpos`.
+ Return: ~
+ (`integer`)
+
getwinvar({winnr}, {varname} [, {def}]) *getwinvar()*
Like |gettabwinvar()| for the current tabpage.
Examples: >vim
let list_is_on = getwinvar(2, '&list')
echo "myvar = " .. getwinvar(1, 'myvar')
+ Parameters: ~
+ • {winnr} (`integer`)
+ • {varname} (`string`)
+ • {def} (`any?`)
+
+ Return: ~
+ (`any`)
+
glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) *glob()*
Expand the file wildcards in {expr}. See |wildcards| for the
use of special characters.
@@ -3247,6 +4424,15 @@ glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) *glob()*
See |expand()| for expanding special Vim variables. See
|system()| for getting the raw output of an external command.
+ Parameters: ~
+ • {expr} (`string`)
+ • {nosuf} (`boolean?`)
+ • {list} (`boolean?`)
+ • {alllinks} (`boolean?`)
+
+ Return: ~
+ (`any`)
+
glob2regpat({string}) *glob2regpat()*
Convert a file pattern, as used by glob(), into a search
pattern. The result can be used to match with a string that
@@ -3263,6 +4449,12 @@ glob2regpat({string}) *glob2regpat()*
Note that the result depends on the system. On MS-Windows
a backslash usually means a path separator.
+ Parameters: ~
+ • {string} (`string`)
+
+ Return: ~
+ (`any`)
+
globpath({path}, {expr} [, {nosuf} [, {list} [, {allinks}]]]) *globpath()*
Perform glob() for String {expr} on all directories in {path}
and concatenate the results. Example: >vim
@@ -3298,6 +4490,16 @@ globpath({path}, {expr} [, {nosuf} [, {list} [, {allinks}]]]) *globpath()*
< Upwards search and limiting the depth of "**" is not
supported, thus using 'path' will not always work properly.
+ Parameters: ~
+ • {path} (`string`)
+ • {expr} (`string`)
+ • {nosuf} (`boolean?`)
+ • {list} (`boolean?`)
+ • {allinks} (`boolean?`)
+
+ Return: ~
+ (`any`)
+
has({feature}) *has()*
Returns 1 if {feature} is supported, 0 otherwise. The
{feature} argument is a feature name like "nvim-0.2.1" or
@@ -3366,11 +4568,24 @@ has({feature}) *has()*
endif
<
+ Parameters: ~
+ • {feature} (`string`)
+
+ Return: ~
+ (`0|1`)
+
has_key({dict}, {key}) *has_key()*
The result is a Number, which is TRUE if |Dictionary| {dict}
has an entry with key {key}. FALSE otherwise. The {key}
argument is a string.
+ Parameters: ~
+ • {dict} (`table`)
+ • {key} (`string`)
+
+ Return: ~
+ (`0|1`)
+
haslocaldir([{winnr} [, {tabnr}]]) *haslocaldir()*
The result is a Number, which is 1 when the window has set a
local path via |:lcd| or when {winnr} is -1 and the tabpage
@@ -3388,6 +4603,13 @@ haslocaldir([{winnr} [, {tabnr}]]) *haslocaldir()*
If {winnr} is -1 it is ignored, only the tab is resolved.
Throw error if the arguments are invalid. |E5000| |E5001| |E5002|
+ Parameters: ~
+ • {winnr} (`integer?`)
+ • {tabnr} (`integer?`)
+
+ Return: ~
+ (`0|1`)
+
hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()*
The result is a Number, which is TRUE if there is a mapping
that contains {what} in somewhere in the rhs (what it is
@@ -3419,6 +4641,14 @@ hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()*
< This installs the mapping to "\ABCdoit" only if there isn't
already a mapping to "\ABCdoit".
+ Parameters: ~
+ • {what} (`any`)
+ • {mode} (`string?`)
+ • {abbr} (`boolean?`)
+
+ Return: ~
+ (`0|1`)
+
histadd({history}, {item}) *histadd()*
Add the String {item} to the history {history} which can be
one of: *hist-names*
@@ -3440,6 +4670,13 @@ histadd({history}, {item}) *histadd()*
let date=input("Enter date: ")
< This function is not available in the |sandbox|.
+ Parameters: ~
+ • {history} (`string`)
+ • {item} (`any`)
+
+ Return: ~
+ (`0|1`)
+
histdel({history} [, {item}]) *histdel()*
Clear {history}, i.e. delete all its entries. See |hist-names|
for the possible values of {history}.
@@ -3473,6 +4710,13 @@ histdel({history} [, {item}]) *histdel()*
let @/ = histget("search", -1)
<
+ Parameters: ~
+ • {history} (`string`)
+ • {item} (`any?`)
+
+ Return: ~
+ (`0|1`)
+
histget({history} [, {index}]) *histget()*
The result is a String, the entry with Number {index} from
{history}. See |hist-names| for the possible values of
@@ -3489,6 +4733,13 @@ histget({history} [, {index}]) *histget()*
command -nargs=1 H execute histget("cmd", 0+<args>)
<
+ Parameters: ~
+ • {history} (`string`)
+ • {index} (`integer|string?`)
+
+ Return: ~
+ (`string`)
+
histnr({history}) *histnr()*
The result is the Number of the current entry in {history}.
See |hist-names| for the possible values of {history}.
@@ -3496,6 +4747,13 @@ histnr({history}) *histnr()*
Example: >vim
let inp_index = histnr("expr")
+<
+
+ Parameters: ~
+ • {history} (`string`)
+
+ Return: ~
+ (`integer`)
hlID({name}) *hlID()*
The result is a Number, which is the ID of the highlight group
@@ -3507,6 +4765,12 @@ hlID({name}) *hlID()*
echo synIDattr(synIDtrans(hlID("Comment")), "bg")
<
+ Parameters: ~
+ • {name} (`string`)
+
+ Return: ~
+ (`integer`)
+
hlexists({name}) *hlexists()*
The result is a Number, which is TRUE if a highlight group
called {name} exists. This is when the group has been
@@ -3514,11 +4778,20 @@ hlexists({name}) *hlexists()*
been defined for it, it may also have been used for a syntax
item.
+ Parameters: ~
+ • {name} (`string`)
+
+ Return: ~
+ (`0|1`)
+
hostname() *hostname()*
The result is a String, which is the name of the machine on
which Vim is currently running. Machine names greater than
256 characters long are truncated.
+ Return: ~
+ (`string`)
+
iconv({string}, {from}, {to}) *iconv()*
The result is a String, which is the text {string} converted
from encoding {from} to encoding {to}.
@@ -3531,6 +4804,14 @@ iconv({string}, {from}, {to}) *iconv()*
from/to UCS-2 is automatically changed to use UTF-8. You
cannot use UCS-2 in a string anyway, because of the NUL bytes.
+ Parameters: ~
+ • {string} (`string`)
+ • {from} (`string`)
+ • {to} (`string`)
+
+ Return: ~
+ (`any`)
+
id({expr}) *id()*
Returns a |String| which is a unique identifier of the
container type (|List|, |Dict|, |Blob| and |Partial|). It is
@@ -3539,7 +4820,7 @@ id({expr}) *id()*
Note that `v:_null_string`, `v:_null_list`, `v:_null_dict` and
`v:_null_blob` have the same `id()` with different types
because they are internally represented as NULL pointers.
- `id()` returns a hexadecimal representanion of the pointers to
+ `id()` returns a hexadecimal representation of the pointers to
the containers (i.e. like `0x994a40`), same as `printf("%p",
{expr})`, but it is advised against counting on the exact
format of the return value.
@@ -3548,6 +4829,12 @@ id({expr}) *id()*
will not be equal to some other `id()`: new containers may
reuse identifiers of the garbage-collected ones.
+ Parameters: ~
+ • {expr} (`any`)
+
+ Return: ~
+ (`any`)
+
indent({lnum}) *indent()*
The result is a Number, which is indent of line {lnum} in the
current buffer. The indent is counted in spaces, the value
@@ -3555,6 +4842,12 @@ indent({lnum}) *indent()*
|getline()|.
When {lnum} is invalid -1 is returned.
+ Parameters: ~
+ • {lnum} (`integer|string`)
+
+ Return: ~
+ (`integer`)
+
index({object}, {expr} [, {start} [, {ic}]]) *index()*
Find {expr} in {object} and return its index. See
|indexof()| for using a lambda to select the item.
@@ -3581,6 +4874,16 @@ index({object}, {expr} [, {start} [, {ic}]]) *index()*
if index(numbers, 123) >= 0
" ...
endif
+<
+
+ Parameters: ~
+ • {object} (`any`)
+ • {expr} (`any`)
+ • {start} (`integer?`)
+ • {ic} (`boolean?`)
+
+ Return: ~
+ (`any`)
indexof({object}, {expr} [, {opts}]) *indexof()*
Returns the index of an item in {object} where {expr} is
@@ -3619,9 +4922,26 @@ indexof({object}, {expr} [, {opts}]) *indexof()*
echo indexof(l, "v:val.n == 20")
echo indexof(l, {i, v -> v.n == 30})
echo indexof(l, "v:val.n == 20", #{startidx: 1})
+<
+
+ Parameters: ~
+ • {object} (`any`)
+ • {expr} (`any`)
+ • {opts} (`table?`)
+
+ Return: ~
+ (`any`)
input({prompt} [, {text} [, {completion}]]) *input()*
+ Parameters: ~
+ • {prompt} (`string`)
+ • {text} (`string?`)
+ • {completion} (`string?`)
+
+ Return: ~
+ (`any`)
+
input({opts})
The result is a String, which is whatever the user typed on
the command-line. The {prompt} argument is either a prompt
@@ -3731,6 +5051,13 @@ input({opts})
let g:Foo = input("enter search pattern: ")
call inputrestore()
endfunction
+<
+
+ Parameters: ~
+ • {opts} (`table`)
+
+ Return: ~
+ (`any`)
inputlist({textlist}) *inputlist()*
{textlist} must be a |List| of strings. This |List| is
@@ -3749,12 +5076,21 @@ inputlist({textlist}) *inputlist()*
let color = inputlist(['Select color:', '1. red',
\ '2. green', '3. blue'])
+ Parameters: ~
+ • {textlist} (`string[]`)
+
+ Return: ~
+ (`any`)
+
inputrestore() *inputrestore()*
Restore typeahead that was saved with a previous |inputsave()|.
Should be called the same number of times inputsave() is
called. Calling it more often is harmless though.
Returns TRUE when there is nothing to restore, FALSE otherwise.
+ Return: ~
+ (`any`)
+
inputsave() *inputsave()*
Preserve typeahead (also from mappings) and clear it, so that
a following prompt gets input from the user. Should be
@@ -3763,6 +5099,9 @@ inputsave() *inputsave()*
many inputrestore() calls.
Returns TRUE when out of memory, FALSE otherwise.
+ Return: ~
+ (`any`)
+
inputsecret({prompt} [, {text}]) *inputsecret()*
This function acts much like the |input()| function with but
two exceptions:
@@ -3774,6 +5113,13 @@ inputsecret({prompt} [, {text}]) *inputsecret()*
typed on the command-line in response to the issued prompt.
NOTE: Command-line completion is not supported.
+ Parameters: ~
+ • {prompt} (`string`)
+ • {text} (`string?`)
+
+ Return: ~
+ (`any`)
+
insert({object}, {item} [, {idx}]) *insert()*
When {object} is a |List| or a |Blob| insert {item} at the start
of it.
@@ -3791,6 +5137,14 @@ insert({object}, {item} [, {idx}]) *insert()*
Note that when {item} is a |List| it is inserted as a single
item. Use |extend()| to concatenate |Lists|.
+ Parameters: ~
+ • {object} (`any`)
+ • {item} (`any`)
+ • {idx} (`integer?`)
+
+ Return: ~
+ (`any`)
+
interrupt() *interrupt()*
Interrupt script execution. It works more or less like the
user typing CTRL-C, most commands won't execute and control
@@ -3805,18 +5159,54 @@ interrupt() *interrupt()*
au BufWritePre * call s:check_typoname(expand('<amatch>'))
<
+ Return: ~
+ (`any`)
+
invert({expr}) *invert()*
Bitwise invert. The argument is converted to a number. A
List, Dict or Float argument causes an error. Example: >vim
let bits = invert(bits)
<
+ Parameters: ~
+ • {expr} (`number`)
+
+ Return: ~
+ (`any`)
+
+isabsolutepath({path}) *isabsolutepath()*
+ The result is a Number, which is |TRUE| when {path} is an
+ absolute path.
+ On Unix, a path is considered absolute when it starts with '/'.
+ On MS-Windows, it is considered absolute when it starts with an
+ optional drive prefix and is followed by a '\' or '/'. UNC paths
+ are always absolute.
+ Example: >vim
+ echo isabsolutepath('/usr/share/') " 1
+ echo isabsolutepath('./foobar') " 0
+ echo isabsolutepath('C:\Windows') " 1
+ echo isabsolutepath('foobar') " 0
+ echo isabsolutepath('\\remote\file') " 1
+<
+
+ Parameters: ~
+ • {path} (`string`)
+
+ Return: ~
+ (`0|1`)
+
isdirectory({directory}) *isdirectory()*
The result is a Number, which is |TRUE| when a directory
with the name {directory} exists. If {directory} doesn't
exist, or isn't a directory, the result is |FALSE|. {directory}
is any expression, which is used as a String.
+ Parameters: ~
+ • {directory} (`string`)
+
+ Return: ~
+ (`0|1`)
+
isinf({expr}) *isinf()*
Return 1 if {expr} is a positive infinity, or -1 a negative
infinity, otherwise 0. >vim
@@ -3825,6 +5215,12 @@ isinf({expr}) *isinf()*
echo isinf(-1.0 / 0.0)
< -1
+ Parameters: ~
+ • {expr} (`number`)
+
+ Return: ~
+ (`1|0|-1`)
+
islocked({expr}) *islocked()* *E786*
The result is a Number, which is |TRUE| when {expr} is the
name of a locked variable.
@@ -3839,11 +5235,23 @@ islocked({expr}) *islocked()* *E78
< When {expr} is a variable that does not exist you get an error
message. Use |exists()| to check for existence.
+ Parameters: ~
+ • {expr} (`any`)
+
+ Return: ~
+ (`0|1`)
+
isnan({expr}) *isnan()*
Return |TRUE| if {expr} is a float with value NaN. >vim
echo isnan(0.0 / 0.0)
< 1
+ Parameters: ~
+ • {expr} (`number`)
+
+ Return: ~
+ (`0|1`)
+
items({dict}) *items()*
Return a |List| with all the key-value pairs of {dict}. Each
|List| item is a list with two items: the key of a {dict}
@@ -3853,15 +5261,39 @@ items({dict}) *items()*
for [key, value] in items(mydict)
echo key .. ': ' .. value
endfor
+<
+ A List or a String argument is also supported. In these
+ cases, items() returns a List with the index and the value at
+ the index.
+
+ Parameters: ~
+ • {dict} (`any`)
+
+ Return: ~
+ (`any`)
jobpid({job}) *jobpid()*
Return the PID (process id) of |job-id| {job}.
+ Parameters: ~
+ • {job} (`integer`)
+
+ Return: ~
+ (`integer`)
+
jobresize({job}, {width}, {height}) *jobresize()*
Resize the pseudo terminal window of |job-id| {job} to {width}
columns and {height} rows.
Fails if the job was not started with `"pty":v:true`.
+ Parameters: ~
+ • {job} (`integer`)
+ • {width} (`integer`)
+ • {height} (`integer`)
+
+ Return: ~
+ (`any`)
+
jobstart({cmd} [, {opts}]) *jobstart()*
Note: Prefer |vim.system()| in Lua (unless using the `pty` option).
@@ -3948,6 +5380,13 @@ jobstart({cmd} [, {opts}]) *jobstart()*
- -1 if {cmd}[0] is not executable.
See also |job-control|, |channel|, |msgpack-rpc|.
+ Parameters: ~
+ • {cmd} (`string|string[]`)
+ • {opts} (`table?`)
+
+ Return: ~
+ (`any`)
+
jobstop({id}) *jobstop()*
Stop |job-id| {id} by sending SIGTERM to the job process. If
the process does not terminate after a timeout then SIGKILL
@@ -3958,6 +5397,12 @@ jobstop({id}) *jobstop()*
Returns 1 for valid job id, 0 for invalid id, including jobs have
exited or stopped.
+ Parameters: ~
+ • {id} (`integer`)
+
+ Return: ~
+ (`any`)
+
jobwait({jobs} [, {timeout}]) *jobwait()*
Waits for jobs and their |on_exit| handlers to complete.
@@ -3979,6 +5424,13 @@ jobwait({jobs} [, {timeout}]) *jobwait()*
-2 if the job was interrupted (by |CTRL-C|)
-3 if the job-id is invalid
+ Parameters: ~
+ • {jobs} (`integer[]`)
+ • {timeout} (`integer?`)
+
+ Return: ~
+ (`any`)
+
join({list} [, {sep}]) *join()*
Join the items in {list} together into one String.
When {sep} is specified it is put in between the items. If
@@ -3990,6 +5442,13 @@ join({list} [, {sep}]) *join()*
converted into a string like with |string()|.
The opposite function is |split()|.
+ Parameters: ~
+ • {list} (`any[]`)
+ • {sep} (`string?`)
+
+ Return: ~
+ (`any`)
+
json_decode({expr}) *json_decode()*
Convert {expr} from JSON object. Accepts |readfile()|-style
list as the input, as well as regular string. May output any
@@ -4005,6 +5464,12 @@ json_decode({expr}) *json_decode()*
recommended and the only one required to be supported.
Non-UTF-8 characters are an error.
+ Parameters: ~
+ • {expr} (`any`)
+
+ Return: ~
+ (`any`)
+
json_encode({expr}) *json_encode()*
Convert {expr} into a JSON string. Accepts
|msgpack-special-dict| as the input. Will not convert
@@ -4017,10 +5482,22 @@ json_encode({expr}) *json_encode()*
or special escapes like "\t", other are dumped as-is.
|Blob|s are converted to arrays of the individual bytes.
+ Parameters: ~
+ • {expr} (`any`)
+
+ Return: ~
+ (`any`)
+
keys({dict}) *keys()*
Return a |List| with all the keys of {dict}. The |List| is in
arbitrary order. Also see |items()| and |values()|.
+ Parameters: ~
+ • {dict} (`table`)
+
+ Return: ~
+ (`any`)
+
keytrans({string}) *keytrans()*
Turn the internal byte representation of keys into a form that
can be used for |:map|. E.g. >vim
@@ -4028,6 +5505,12 @@ keytrans({string}) *keytrans()*
echo keytrans(xx)
< <C-Home>
+ Parameters: ~
+ • {string} (`string`)
+
+ Return: ~
+ (`any`)
+
len({expr}) *len()* *E701*
The result is a Number, which is the length of the argument.
When {expr} is a String or a Number the length in bytes is
@@ -4039,6 +5522,12 @@ len({expr}) *len()* *E70
|Dictionary| is returned.
Otherwise an error is given and returns zero.
+ Parameters: ~
+ • {expr} (`any`)
+
+ Return: ~
+ (`any`)
+
libcall({libname}, {funcname}, {argument}) *libcall()* *E364* *E368*
Call function {funcname} in the run-time library {libname}
with single argument {argument}.
@@ -4081,6 +5570,14 @@ libcall({libname}, {funcname}, {argument}) *libcall()* *E364* *E
Examples: >vim
echo libcall("libc.so", "getenv", "HOME")
+ Parameters: ~
+ • {libname} (`string`)
+ • {funcname} (`string`)
+ • {argument} (`any`)
+
+ Return: ~
+ (`any`)
+
libcallnr({libname}, {funcname}, {argument}) *libcallnr()*
Just like |libcall()|, but used for a function that returns an
int instead of a string.
@@ -4090,29 +5587,25 @@ libcallnr({libname}, {funcname}, {argument}) *libcallnr()*
call libcallnr("libc.so", "sleep", 10)
<
+ Parameters: ~
+ • {libname} (`string`)
+ • {funcname} (`string`)
+ • {argument} (`any`)
+
+ Return: ~
+ (`any`)
+
line({expr} [, {winid}]) *line()*
- The result is a Number, which is the line number of the file
- position given with {expr}. The {expr} argument is a string.
- The accepted positions are:
- . the cursor position
- $ the last line in the current buffer
- 'x position of mark x (if the mark is not set, 0 is
- returned)
- w0 first line visible in current window (one if the
- display isn't updated, e.g. in silent Ex mode)
- w$ last line visible in current window (this is one
- less than "w0" if no lines are visible)
- v In Visual mode: the start of the Visual area (the
- cursor is the end). When not in Visual mode
- returns the cursor position. Differs from |'<| in
- that it's updated right away.
- Note that a mark in another file can be used. The line number
- then applies to another buffer.
+ See |getpos()| for accepted positions.
+
To get the column number use |col()|. To get both use
|getpos()|.
+
With the optional {winid} argument the values are obtained for
that window instead of the current window.
+
Returns 0 for invalid values of {expr} and {winid}.
+
Examples: >vim
echo line(".") " line number of the cursor
echo line(".", winid) " idem, in window "winid"
@@ -4122,6 +5615,13 @@ line({expr} [, {winid}]) *line()*
To jump to the last known position when opening a file see
|last-position-jump|.
+ Parameters: ~
+ • {expr} (`string|integer[]`)
+ • {winid} (`integer?`)
+
+ Return: ~
+ (`integer`)
+
line2byte({lnum}) *line2byte()*
Return the byte count from the start of the buffer for line
{lnum}. This includes the end-of-line character, depending on
@@ -4135,6 +5635,12 @@ line2byte({lnum}) *line2byte()*
|getline()|. When {lnum} is invalid -1 is returned.
Also see |byte2line()|, |go| and |:goto|.
+ Parameters: ~
+ • {lnum} (`integer`)
+
+ Return: ~
+ (`integer`)
+
lispindent({lnum}) *lispindent()*
Get the amount of indent for line {lnum} according the lisp
indenting rules, as with 'lisp'.
@@ -4142,6 +5648,12 @@ lispindent({lnum}) *lispindent()*
relevant. {lnum} is used just like in |getline()|.
When {lnum} is invalid, -1 is returned.
+ Parameters: ~
+ • {lnum} (`integer`)
+
+ Return: ~
+ (`any`)
+
list2blob({list}) *list2blob()*
Return a Blob concatenating all the number values in {list}.
Examples: >vim
@@ -4152,6 +5664,12 @@ list2blob({list}) *list2blob()*
|blob2list()| does the opposite.
+ Parameters: ~
+ • {list} (`any[]`)
+
+ Return: ~
+ (`any`)
+
list2str({list} [, {utf8}]) *list2str()*
Convert each number in {list} to a character string can
concatenate them all. Examples: >vim
@@ -4168,10 +5686,20 @@ list2str({list} [, {utf8}]) *list2str()*
<
Returns an empty string on error.
+ Parameters: ~
+ • {list} (`any[]`)
+ • {utf8} (`boolean?`)
+
+ Return: ~
+ (`any`)
+
localtime() *localtime()*
Return the current time, measured as seconds since 1st Jan
1970. See also |strftime()|, |strptime()| and |getftime()|.
+ Return: ~
+ (`any`)
+
log({expr}) *log()*
Return the natural logarithm (base e) of {expr} as a |Float|.
{expr} must evaluate to a |Float| or a |Number| in the range
@@ -4183,6 +5711,12 @@ log({expr}) *log()*
echo log(exp(5))
< 5.0
+ Parameters: ~
+ • {expr} (`number`)
+
+ Return: ~
+ (`any`)
+
log10({expr}) *log10()*
Return the logarithm of Float {expr} to base 10 as a |Float|.
{expr} must evaluate to a |Float| or a |Number|.
@@ -4193,10 +5727,23 @@ log10({expr}) *log10()*
echo log10(0.01)
< -2.0
+ Parameters: ~
+ • {expr} (`number`)
+
+ Return: ~
+ (`any`)
+
luaeval({expr} [, {expr}]) *luaeval()*
Evaluate Lua expression {expr} and return its result converted
to Vim data structures. See |lua-eval| for more details.
+ Parameters: ~
+ • {expr} (`string`)
+ • {expr1} (`any[]?`)
+
+ Return: ~
+ (`any`)
+
map({expr1}, {expr2}) *map()*
{expr1} must be a |List|, |String|, |Blob| or |Dictionary|.
When {expr1} is a |List|| or |Dictionary|, replace each
@@ -4251,6 +5798,13 @@ map({expr1}, {expr2}) *map()*
When {expr2} is a Funcref errors inside a function are ignored,
unless it was defined with the "abort" flag.
+ Parameters: ~
+ • {expr1} (`string|table|any[]`)
+ • {expr2} (`string|function`)
+
+ Return: ~
+ (`any`)
+
maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()*
When {dict} is omitted or zero: Return the rhs of mapping
{name} in mode {mode}. The returned String has special
@@ -4290,6 +5844,7 @@ maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()*
"lhsrawalt" The {lhs} of the mapping as raw bytes, alternate
form, only present when it differs from "lhsraw"
"rhs" The {rhs} of the mapping as typed.
+ "callback" Lua function, if RHS was defined as such.
"silent" 1 for a |:map-silent| mapping, else 0.
"noremap" 1 if the {rhs} of the mapping is not remappable.
"script" 1 if mapping was defined with <script>.
@@ -4322,6 +5877,16 @@ maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()*
This function can be used to map a key even when it's already
mapped, and have it do the original mapping too. Sketch: >vim
exe 'nnoremap <Tab> ==' .. maparg('<Tab>', 'n')
+<
+
+ Parameters: ~
+ • {name} (`string`)
+ • {mode} (`string?`)
+ • {abbr} (`boolean?`)
+ • {dict} (`false?`)
+
+ Return: ~
+ (`string`)
mapcheck({name} [, {mode} [, {abbr}]]) *mapcheck()*
Check if there is a mapping that matches with {name} in mode
@@ -4356,6 +5921,14 @@ mapcheck({name} [, {mode} [, {abbr}]]) *mapcheck()*
< This avoids adding the "_vv" mapping when there already is a
mapping for "_v" or for "_vvv".
+ Parameters: ~
+ • {name} (`string`)
+ • {mode} (`string?`)
+ • {abbr} (`boolean?`)
+
+ Return: ~
+ (`any`)
+
maplist([{abbr}]) *maplist()*
Returns a |List| of all mappings. Each List item is a |Dict|,
the same as what is returned by |maparg()|, see
@@ -4386,6 +5959,13 @@ maplist([{abbr}]) *maplist()*
\ {_, m -> m.lhs == 'xyzzy'})[0].mode_bits
ounmap xyzzy
echo printf("Operator-pending mode bit: 0x%x", op_bit)
+<
+
+ Parameters: ~
+ • {abbr} (`0|1?`)
+
+ Return: ~
+ (`table[]`)
mapnew({expr1}, {expr2}) *mapnew()*
Like |map()| but instead of replacing items in {expr1} a new
@@ -4393,6 +5973,13 @@ mapnew({expr1}, {expr2}) *mapnew()*
unchanged. Items can still be changed by {expr2}, if you
don't want that use |deepcopy()| first.
+ Parameters: ~
+ • {expr1} (`any`)
+ • {expr2} (`any`)
+
+ Return: ~
+ (`any`)
+
mapset({mode}, {abbr}, {dict}) *mapset()*
mapset({dict})
Restore a mapping from a dictionary, possibly returned by
@@ -4429,6 +6016,13 @@ mapset({dict})
for d in save_maps
call mapset(d)
endfor
+<
+
+ Parameters: ~
+ • {dict} (`boolean`)
+
+ Return: ~
+ (`any`)
match({expr}, {pat} [, {start} [, {count}]]) *match()*
When {expr} is a |List| then this returns the index of the
@@ -4493,6 +6087,15 @@ match({expr}, {pat} [, {start} [, {count}]]) *match()*
zero matches at the start instead of a number of matches
further down in the text.
+ Parameters: ~
+ • {expr} (`string|any[]`)
+ • {pat} (`string`)
+ • {start} (`integer?`)
+ • {count} (`integer?`)
+
+ Return: ~
+ (`any`)
+
*matchadd()* *E798* *E799* *E801* *E957*
matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]])
Defines a pattern to be highlighted in the current window (a
@@ -4552,13 +6155,23 @@ matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]])
available from |getmatches()|. All matches can be deleted in
one operation by |clearmatches()|.
+ Parameters: ~
+ • {group} (`integer|string`)
+ • {pattern} (`string`)
+ • {priority} (`integer?`)
+ • {id} (`integer?`)
+ • {dict} (`string?`)
+
+ Return: ~
+ (`any`)
+
matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]]) *matchaddpos()*
Same as |matchadd()|, but requires a list of positions {pos}
instead of a pattern. This command is faster than |matchadd()|
- because it does not require to handle regular expressions and
- sets buffer line boundaries to redraw screen. It is supposed
- to be used when fast match additions and deletions are
- required, for example to highlight matching parentheses.
+ because it does not handle regular expressions and it sets
+ buffer line boundaries to redraw screen. It is supposed to be
+ used when fast match additions and deletions are required, for
+ example to highlight matching parentheses.
*E5030* *E5031*
{pos} is a list of positions. Each position can be one of
these:
@@ -4589,6 +6202,16 @@ matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]]) *matchaddpos()*
< Matches added by |matchaddpos()| are returned by
|getmatches()|.
+ Parameters: ~
+ • {group} (`integer|string`)
+ • {pos} (`any[]`)
+ • {priority} (`integer?`)
+ • {id} (`integer?`)
+ • {dict} (`string?`)
+
+ Return: ~
+ (`any`)
+
matcharg({nr}) *matcharg()*
Selects the {nr} match item, as set with a |:match|,
|:2match| or |:3match| command.
@@ -4601,6 +6224,12 @@ matcharg({nr}) *matcharg()*
Highlighting matches using the |:match| commands are limited
to three matches. |matchadd()| does not have this limitation.
+ Parameters: ~
+ • {nr} (`integer`)
+
+ Return: ~
+ (`any`)
+
matchbufline({buf}, {pat}, {lnum}, {end}, [, {dict}]) *matchbufline()*
Returns the |List| of matches in lines from {lnum} to {end} in
buffer {buf} where {pat} matches.
@@ -4629,22 +6258,32 @@ matchbufline({buf}, {pat}, {lnum}, {end}, [, {dict}]) *matchbufline()*
Examples: >vim
" Assuming line 3 in buffer 5 contains "a"
- :echo matchbufline(5, '\<\k\+\>', 3, 3)
- [{'lnum': 3, 'byteidx': 0, 'text': 'a'}]
+ echo matchbufline(5, '\<\k\+\>', 3, 3)
+< `[{'lnum': 3, 'byteidx': 0, 'text': 'a'}]` >vim
" Assuming line 4 in buffer 10 contains "tik tok"
- :echo matchbufline(10, '\<\k\+\>', 1, 4)
- [{'lnum': 4, 'byteidx': 0, 'text': 'tik'}, {'lnum': 4, 'byteidx': 4, 'text': 'tok'}]
-<
+ echo matchbufline(10, '\<\k\+\>', 1, 4)
+< `[{'lnum': 4, 'byteidx': 0, 'text': 'tik'}, {'lnum': 4, 'byteidx': 4, 'text': 'tok'}]`
+
If {submatch} is present and is v:true, then submatches like
"\1", "\2", etc. are also returned. Example: >vim
" Assuming line 2 in buffer 2 contains "acd"
- :echo matchbufline(2, '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2, 2
+ echo matchbufline(2, '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2, 2
\ {'submatches': v:true})
- [{'lnum': 2, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]
-< The "submatches" List always contains 9 items. If a submatch
+< `[{'lnum': 2, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]`
+ The "submatches" List always contains 9 items. If a submatch
is not found, then an empty string is returned for that
submatch.
+ Parameters: ~
+ • {buf} (`string|integer`)
+ • {pat} (`string`)
+ • {lnum} (`string|integer`)
+ • {end_} (`string|integer`)
+ • {dict} (`table?`)
+
+ Return: ~
+ (`any`)
+
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,
@@ -4653,6 +6292,13 @@ matchdelete({id} [, {win}]) *matchdelete()* *E802* *E
If {win} is specified, use the window with this number or
window ID instead of the current window.
+ Parameters: ~
+ • {id} (`integer`)
+ • {win} (`integer?`)
+
+ Return: ~
+ (`any`)
+
matchend({expr}, {pat} [, {start} [, {count}]]) *matchend()*
Same as |match()|, but return the index of first character
after the match. Example: >vim
@@ -4672,6 +6318,15 @@ matchend({expr}, {pat} [, {start} [, {count}]]) *matchend()*
< result is "-1".
When {expr} is a |List| the result is equal to |match()|.
+ Parameters: ~
+ • {expr} (`any`)
+ • {pat} (`string`)
+ • {start} (`integer?`)
+ • {count} (`integer?`)
+
+ Return: ~
+ (`any`)
+
matchfuzzy({list}, {str} [, {dict}]) *matchfuzzy()*
If {list} is a list of strings, then returns a |List| with all
the strings in {list} that fuzzy match {str}. The strings in
@@ -4735,6 +6390,14 @@ matchfuzzy({list}, {str} [, {dict}]) *matchfuzzy()*
\ {'matchseq': 1})
< results in `['two one']`.
+ Parameters: ~
+ • {list} (`any[]`)
+ • {str} (`string`)
+ • {dict} (`string?`)
+
+ Return: ~
+ (`any`)
+
matchfuzzypos({list}, {str} [, {dict}]) *matchfuzzypos()*
Same as |matchfuzzy()|, but returns the list of matched
strings, the list of character positions where characters
@@ -4757,6 +6420,14 @@ matchfuzzypos({list}, {str} [, {dict}]) *matchfuzzypos()*
\ ->matchfuzzypos('ll', {'key' : 'text'})
< results in `[[{"id": 10, "text": "hello"}], [[2, 3]], [127]]`
+ Parameters: ~
+ • {list} (`any[]`)
+ • {str} (`string`)
+ • {dict} (`string?`)
+
+ Return: ~
+ (`any`)
+
matchlist({expr}, {pat} [, {start} [, {count}]]) *matchlist()*
Same as |match()|, but return a |List|. The first item in the
list is the matched string, same as what matchstr() would
@@ -4769,6 +6440,15 @@ matchlist({expr}, {pat} [, {start} [, {count}]]) *matchlist()*
You can pass in a List, but that is not very useful.
+ Parameters: ~
+ • {expr} (`any`)
+ • {pat} (`string`)
+ • {start} (`integer?`)
+ • {count} (`integer?`)
+
+ Return: ~
+ (`any`)
+
matchstr({expr}, {pat} [, {start} [, {count}]]) *matchstr()*
Same as |match()|, but return the matched string. Example: >vim
echo matchstr("testing", "ing")
@@ -4782,6 +6462,15 @@ 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.
+ Parameters: ~
+ • {expr} (`any`)
+ • {pat} (`string`)
+ • {start} (`integer?`)
+ • {count} (`integer?`)
+
+ Return: ~
+ (`any`)
+
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
@@ -4801,20 +6490,28 @@ matchstrlist({list}, {pat} [, {dict}]) *matchstrlist()*
option settings on the pattern.
Example: >vim
- :echo matchstrlist(['tik tok'], '\<\k\+\>')
- [{'idx': 0, 'byteidx': 0, 'text': 'tik'}, {'idx': 0, 'byteidx': 4, 'text': 'tok'}]
- :echo matchstrlist(['a', 'b'], '\<\k\+\>')
- [{'idx': 0, 'byteidx': 0, 'text': 'a'}, {'idx': 1, 'byteidx': 0, 'text': 'b'}]
-<
+ echo matchstrlist(['tik tok'], '\<\k\+\>')
+< `[{'idx': 0, 'byteidx': 0, 'text': 'tik'}, {'idx': 0, 'byteidx': 4, 'text': 'tok'}]` >vim
+ echo matchstrlist(['a', 'b'], '\<\k\+\>')
+< `[{'idx': 0, 'byteidx': 0, 'text': 'a'}, {'idx': 1, 'byteidx': 0, 'text': 'b'}]`
+
If "submatches" is present and is v:true, then submatches like
"\1", "\2", etc. are also returned. Example: >vim
- :echo matchstrlist(['acd'], '\(a\)\?\(b\)\?\(c\)\?\(.*\)',
+ echo matchstrlist(['acd'], '\(a\)\?\(b\)\?\(c\)\?\(.*\)',
\ #{submatches: v:true})
- [{'idx': 0, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]
-< The "submatches" List always contains 9 items. If a submatch
+< `[{'idx': 0, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]`
+ The "submatches" List always contains 9 items. If a submatch
is not found, then an empty string is returned for that
submatch.
+ Parameters: ~
+ • {list} (`string[]`)
+ • {pat} (`string`)
+ • {dict} (`table?`)
+
+ Return: ~
+ (`any`)
+
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
@@ -4833,6 +6530,15 @@ matchstrpos({expr}, {pat} [, {start} [, {count}]]) *matchstrpos()*
< result is ["x", 1, 2, 3].
The type isn't changed, it's not necessarily a String.
+ Parameters: ~
+ • {expr} (`any`)
+ • {pat} (`string`)
+ • {start} (`integer?`)
+ • {count} (`integer?`)
+
+ Return: ~
+ (`any`)
+
max({expr}) *max()*
Return the maximum value of all items in {expr}. Example: >vim
echo max([apples, pears, oranges])
@@ -4843,6 +6549,12 @@ max({expr}) *max()*
items in {expr} cannot be used as a Number this results in
an error. An empty |List| or |Dictionary| results in zero.
+ Parameters: ~
+ • {expr} (`any`)
+
+ Return: ~
+ (`any`)
+
menu_get({path} [, {modes}]) *menu_get()*
Returns a |List| of |Dictionaries| describing |menus| (defined
by |:menu|, |:amenu|, …), including |hidden-menus|.
@@ -4889,6 +6601,13 @@ menu_get({path} [, {modes}]) *menu_get()*
} ]
<
+ Parameters: ~
+ • {path} (`string`)
+ • {modes} (`string?`)
+
+ Return: ~
+ (`any`)
+
menu_info({name} [, {mode}]) *menu_info()*
Return information about the specified menu {name} in
mode {mode}. The menu name should be specified without the
@@ -4960,6 +6679,13 @@ menu_info({name} [, {mode}]) *menu_info()*
endfor
<
+ Parameters: ~
+ • {name} (`string`)
+ • {mode} (`string?`)
+
+ Return: ~
+ (`any`)
+
min({expr}) *min()*
Return the minimum value of all items in {expr}. Example: >vim
echo min([apples, pears, oranges])
@@ -4970,23 +6696,26 @@ min({expr}) *min()*
items in {expr} cannot be used as a Number this results in
an error. An empty |List| or |Dictionary| results in zero.
+ Parameters: ~
+ • {expr} (`any`)
+
+ Return: ~
+ (`any`)
+
mkdir({name} [, {flags} [, {prot}]]) *mkdir()* *E739*
Create directory {name}.
When {flags} is present it must be a string. An empty string
has no effect.
- If {flags} contains "p" then intermediate directories are
- created as necessary.
+ {flags} can contain these character flags:
+ "p" intermediate directories will be created as necessary
+ "D" {name} will be deleted at the end of the current
+ function, but not recursively |:defer|
+ "R" {name} will be deleted recursively at the end of the
+ current function |:defer|
- If {flags} contains "D" then {name} is deleted at the end of
- the current function, as with: >vim
- defer delete({name}, 'd')
-<
- If {flags} contains "R" then {name} is deleted recursively at
- the end of the current function, as with: >vim
- defer delete({name}, 'rf')
-< Note that when {name} has more than one part and "p" is used
+ Note that when {name} has more than one part and "p" is used
some directories may already exist. Only the first one that
is created and what it contains is scheduled to be deleted.
E.g. when using: >vim
@@ -5013,6 +6742,14 @@ mkdir({name} [, {flags} [, {prot}]]) *mkdir()* *E73
successful or FALSE if the directory creation failed or partly
failed.
+ Parameters: ~
+ • {name} (`string`)
+ • {flags} (`string?`)
+ • {prot} (`string?`)
+
+ Return: ~
+ (`any`)
+
mode([{expr}]) *mode()*
Return a string that indicates the current mode.
If {expr} is supplied and it evaluates to a non-zero Number or
@@ -5067,6 +6804,12 @@ mode([{expr}]) *mode()*
the leading character(s).
Also see |visualmode()|.
+ Parameters: ~
+ • {expr} (`any?`)
+
+ Return: ~
+ (`any`)
+
msgpackdump({list} [, {type}]) *msgpackdump()*
Convert a list of Vimscript objects to msgpack. Returned value is a
|readfile()|-style list. When {type} contains "B", a |Blob| is
@@ -5086,6 +6829,13 @@ msgpackdump({list} [, {type}]) *msgpackdump()*
4. Other strings and |Blob|s are always dumped as BIN strings.
5. Points 3. and 4. do not apply to |msgpack-special-dict|s.
+ Parameters: ~
+ • {list} (`any`)
+ • {type} (`any?`)
+
+ Return: ~
+ (`any`)
+
msgpackparse({data}) *msgpackparse()*
Convert a |readfile()|-style list or a |Blob| to a list of
Vimscript objects.
@@ -5137,12 +6887,7 @@ msgpackparse({data}) *msgpackparse()*
C parser does not support such values.
float |Float|. This value cannot possibly appear in
|msgpackparse()| output.
- string |readfile()|-style list of strings. This value will
- appear in |msgpackparse()| output if string contains
- zero byte or if string is a mapping key and mapping is
- being represented as special dictionary for other
- reasons.
- binary |String|, or |Blob| if binary string contains zero
+ string |String|, or |Blob| if binary string contains zero
byte. This value cannot appear in |msgpackparse()|
output since blobs were introduced.
array |List|. This value cannot appear in |msgpackparse()|
@@ -5159,6 +6904,12 @@ msgpackparse({data}) *msgpackparse()*
representing extension type. Second is
|readfile()|-style list of strings.
+ Parameters: ~
+ • {data} (`any`)
+
+ Return: ~
+ (`any`)
+
nextnonblank({lnum}) *nextnonblank()*
Return the line number of the first line at or below {lnum}
that is not blank. Example: >vim
@@ -5168,6 +6919,12 @@ nextnonblank({lnum}) *nextnonblank()*
{lnum} is used like with |getline()|.
See also |prevnonblank()|.
+ Parameters: ~
+ • {lnum} (`integer`)
+
+ Return: ~
+ (`any`)
+
nr2char({expr} [, {utf8}]) *nr2char()*
Return a string with a single character, which has the number
value {expr}. Examples: >vim
@@ -5183,6 +6940,13 @@ nr2char({expr} [, {utf8}]) *nr2char()*
characters. nr2char(0) is a real NUL and terminates the
string, thus results in an empty string.
+ Parameters: ~
+ • {expr} (`integer`)
+ • {utf8} (`boolean?`)
+
+ Return: ~
+ (`any`)
+
nvim_...({...}) *nvim_...()* *E5555* *eval-api*
Call nvim |api| functions. The type checking of arguments will
be stricter than for most other builtins. For instance,
@@ -5194,6 +6958,12 @@ nvim_...({...}) *nvim_...()* *E5555* *eval-
also take the numerical value 0 to indicate the current
(focused) object.
+ Parameters: ~
+ • {...} (`any`)
+
+ Return: ~
+ (`any`)
+
or({expr}, {expr}) *or()*
Bitwise OR on the two arguments. The arguments are converted
to a number. A List, Dict or Float argument causes an error.
@@ -5206,6 +6976,13 @@ or({expr}, {expr}) *or()*
to separate commands. In many places it would not be clear if
"|" is an operator or a command separator.
+ Parameters: ~
+ • {expr} (`number`)
+ • {expr1} (`number`)
+
+ Return: ~
+ (`any`)
+
pathshorten({path} [, {len}]) *pathshorten()*
Shorten directory names in the path {path} and return the
result. The tail, the file name, is kept as-is. The other
@@ -5220,6 +6997,13 @@ pathshorten({path} [, {len}]) *pathshorten()*
It doesn't matter if the path exists or not.
Returns an empty string on error.
+ Parameters: ~
+ • {path} (`string`)
+ • {len} (`integer?`)
+
+ Return: ~
+ (`any`)
+
perleval({expr}) *perleval()*
Evaluate |perl| expression {expr} and return its result
converted to Vim data structures.
@@ -5235,6 +7019,12 @@ perleval({expr}) *perleval()*
echo perleval('[1 .. 4]')
< [1, 2, 3, 4]
+ Parameters: ~
+ • {expr} (`any`)
+
+ Return: ~
+ (`any`)
+
pow({x}, {y}) *pow()*
Return the power of {x} to the exponent {y} as a |Float|.
{x} and {y} must evaluate to a |Float| or a |Number|.
@@ -5247,6 +7037,13 @@ pow({x}, {y}) *pow()*
echo pow(32, 0.20)
< 2.0
+ Parameters: ~
+ • {x} (`number`)
+ • {y} (`number`)
+
+ Return: ~
+ (`any`)
+
prevnonblank({lnum}) *prevnonblank()*
Return the line number of the first line at or above {lnum}
that is not blank. Example: >vim
@@ -5256,6 +7053,12 @@ prevnonblank({lnum}) *prevnonblank()*
{lnum} is used like with |getline()|.
Also see |nextnonblank()|.
+ Parameters: ~
+ • {lnum} (`integer`)
+
+ Return: ~
+ (`any`)
+
printf({fmt}, {expr1} ...) *printf()*
Return a String with {fmt}, where "%" items are replaced by
the formatted form of their respective arguments. Example: >vim
@@ -5579,6 +7382,13 @@ printf({fmt}, {expr1} ...) *printf()*
into this, copying the exact format string and parameters that
were used.
+ Parameters: ~
+ • {fmt} (`string`)
+ • {expr1} (`any?`)
+
+ Return: ~
+ (`string`)
+
prompt_getprompt({buf}) *prompt_getprompt()*
Returns the effective prompt text for buffer {buf}. {buf} can
be a buffer name or number. See |prompt-buffer|.
@@ -5586,6 +7396,12 @@ prompt_getprompt({buf}) *prompt_getprompt()*
If the buffer doesn't exist or isn't a prompt buffer, an empty
string is returned.
+ Parameters: ~
+ • {buf} (`integer|string`)
+
+ Return: ~
+ (`any`)
+
prompt_setcallback({buf}, {expr}) *prompt_setcallback()*
Set prompt callback for buffer {buf} to {expr}. When {expr}
is an empty string the callback is removed. This has only
@@ -5618,6 +7434,13 @@ prompt_setcallback({buf}, {expr}) *prompt_setcallback()*
endfunc
call prompt_setcallback(bufnr(), function('s:TextEntered'))
+ Parameters: ~
+ • {buf} (`integer|string`)
+ • {expr} (`string|function`)
+
+ Return: ~
+ (`any`)
+
prompt_setinterrupt({buf}, {expr}) *prompt_setinterrupt()*
Set a callback for buffer {buf} to {expr}. When {expr} is an
empty string the callback is removed. This has only effect if
@@ -5627,6 +7450,13 @@ prompt_setinterrupt({buf}, {expr}) *prompt_setinterrupt()*
mode. Without setting a callback Vim will exit Insert mode,
as in any buffer.
+ Parameters: ~
+ • {buf} (`integer|string`)
+ • {expr} (`string|function`)
+
+ Return: ~
+ (`any`)
+
prompt_setprompt({buf}, {text}) *prompt_setprompt()*
Set prompt for buffer {buf} to {text}. You most likely want
{text} to end in a space.
@@ -5635,6 +7465,13 @@ prompt_setprompt({buf}, {text}) *prompt_setprompt()*
call prompt_setprompt(bufnr(''), 'command: ')
<
+ Parameters: ~
+ • {buf} (`integer|string`)
+ • {text} (`string`)
+
+ Return: ~
+ (`any`)
+
pum_getpos() *pum_getpos()*
If the popup menu (see |ins-completion-menu|) is not visible,
returns an empty |Dictionary|, otherwise, returns a
@@ -5648,12 +7485,18 @@ pum_getpos() *pum_getpos()*
The values are the same as in |v:event| during |CompleteChanged|.
+ Return: ~
+ (`any`)
+
pumvisible() *pumvisible()*
Returns non-zero when the popup menu is visible, zero
otherwise. See |ins-completion-menu|.
This can be used to avoid some things that would remove the
popup menu.
+ Return: ~
+ (`any`)
+
py3eval({expr}) *py3eval()*
Evaluate Python expression {expr} and return its result
converted to Vim data structures.
@@ -5664,6 +7507,12 @@ py3eval({expr}) *py3eval()*
Dictionaries are represented as Vim |Dictionary| type with
keys converted to strings.
+ Parameters: ~
+ • {expr} (`any`)
+
+ Return: ~
+ (`any`)
+
pyeval({expr}) *pyeval()* *E858* *E859*
Evaluate Python expression {expr} and return its result
converted to Vim data structures.
@@ -5673,12 +7522,24 @@ pyeval({expr}) *pyeval()* *E858* *E
Dictionaries are represented as Vim |Dictionary| type,
non-string keys result in error.
+ Parameters: ~
+ • {expr} (`any`)
+
+ Return: ~
+ (`any`)
+
pyxeval({expr}) *pyxeval()*
Evaluate Python expression {expr} and return its result
converted to Vim data structures.
Uses Python 2 or 3, see |python_x| and 'pyxversion'.
See also: |pyeval()|, |py3eval()|
+ Parameters: ~
+ • {expr} (`any`)
+
+ Return: ~
+ (`any`)
+
rand([{expr}]) *rand()*
Return a pseudo-random Number generated with an xoshiro128**
algorithm using seed {expr}. The returned number is 32 bits,
@@ -5695,6 +7556,12 @@ rand([{expr}]) *rand()*
echo rand(seed) % 16 " random number 0 - 15
<
+ Parameters: ~
+ • {expr} (`number?`)
+
+ Return: ~
+ (`any`)
+
range({expr} [, {max} [, {stride}]]) *range()* *E726* *E727*
Returns a |List| with Numbers:
- If only {expr} is specified: [0, 1, ..., {expr} - 1]
@@ -5714,6 +7581,14 @@ range({expr} [, {max} [, {stride}]]) *range()* *E726* *E
echo range(2, 0) " error!
<
+ Parameters: ~
+ • {expr} (`any`)
+ • {max} (`integer?`)
+ • {stride} (`integer?`)
+
+ Return: ~
+ (`any`)
+
readblob({fname} [, {offset} [, {size}]]) *readblob()*
Read file {fname} in binary mode and return a |Blob|.
If {offset} is specified, read the file from the specified
@@ -5738,6 +7613,14 @@ readblob({fname} [, {offset} [, {size}]]) *readblob()*
is truncated.
Also see |readfile()| and |writefile()|.
+ Parameters: ~
+ • {fname} (`string`)
+ • {offset} (`integer?`)
+ • {size} (`integer?`)
+
+ Return: ~
+ (`any`)
+
readdir({directory} [, {expr}]) *readdir()*
Return a list with file and directory names in {directory}.
You can also use |glob()| if you don't need to do complicated
@@ -5768,6 +7651,13 @@ readdir({directory} [, {expr}]) *readdir()*
<
Returns an empty List on error.
+ Parameters: ~
+ • {directory} (`string`)
+ • {expr} (`integer?`)
+
+ Return: ~
+ (`any`)
+
readfile({fname} [, {type} [, {max}]]) *readfile()*
Read file {fname} and return a |List|, each line of the file
as an item. Lines are broken at NL characters. Macintosh
@@ -5801,6 +7691,14 @@ readfile({fname} [, {type} [, {max}]]) *readfile()*
the result is an empty list.
Also see |writefile()|.
+ Parameters: ~
+ • {fname} (`string`)
+ • {type} (`string?`)
+ • {max} (`integer?`)
+
+ Return: ~
+ (`any`)
+
reduce({object}, {func} [, {initial}]) *reduce()* *E998*
{func} is called for every item in {object}, which can be a
|String|, |List| or a |Blob|. {func} is called with two
@@ -5819,20 +7717,37 @@ reduce({object}, {func} [, {initial}]) *reduce()* *E99
echo reduce('xyz', { acc, val -> acc .. ',' .. val })
<
+ Parameters: ~
+ • {object} (`any`)
+ • {func} (`function`)
+ • {initial} (`any?`)
+
+ Return: ~
+ (`any`)
+
reg_executing() *reg_executing()*
Returns the single letter name of the register being executed.
Returns an empty string when no register is being executed.
See |@|.
+ Return: ~
+ (`any`)
+
reg_recorded() *reg_recorded()*
Returns the single letter name of the last recorded register.
Returns an empty string when nothing was recorded yet.
See |q| and |Q|.
+ Return: ~
+ (`any`)
+
reg_recording() *reg_recording()*
Returns the single letter name of the register being recorded.
Returns an empty string when not recording. See |q|.
+ Return: ~
+ (`any`)
+
reltime() *reltime()*
reltime({start})
reltime({start}, {end})
@@ -5855,6 +7770,13 @@ reltime({start}, {end})
Note: |localtime()| returns the current (non-relative) time.
+ Parameters: ~
+ • {start} (`any?`)
+ • {end_} (`any?`)
+
+ Return: ~
+ (`any`)
+
reltimefloat({time}) *reltimefloat()*
Return a Float that represents the time value of {time}.
Unit of time is seconds.
@@ -5866,6 +7788,12 @@ reltimefloat({time}) *reltimefloat()*
Also see |profiling|.
If there is an error an empty string is returned
+ Parameters: ~
+ • {time} (`any`)
+
+ Return: ~
+ (`any`)
+
reltimestr({time}) *reltimestr()*
Return a String that represents the time value of {time}.
This is the number of seconds, a dot and the number of
@@ -5880,6 +7808,12 @@ reltimestr({time}) *reltimestr()*
< Also see |profiling|.
If there is an error an empty string is returned
+ Parameters: ~
+ • {time} (`any`)
+
+ Return: ~
+ (`any`)
+
remove({list}, {idx}) *remove()*
remove({list}, {idx}, {end})
Without {end}: Remove the item at {idx} from |List| {list} and
@@ -5896,6 +7830,14 @@ remove({list}, {idx}, {end})
<
Use |delete()| to remove a file.
+ Parameters: ~
+ • {list} (`any[]`)
+ • {idx} (`integer`)
+ • {end_} (`integer?`)
+
+ Return: ~
+ (`any`)
+
remove({blob}, {idx})
remove({blob}, {idx}, {end})
Without {end}: Remove the byte at {idx} from |Blob| {blob} and
@@ -5910,6 +7852,14 @@ remove({blob}, {idx}, {end})
call remove(mylist, 0, 9)
<
+ Parameters: ~
+ • {blob} (`any`)
+ • {idx} (`integer`)
+ • {end_} (`integer?`)
+
+ Return: ~
+ (`any`)
+
remove({dict}, {key})
Remove the entry from {dict} with key {key} and return it.
Example: >vim
@@ -5917,6 +7867,13 @@ remove({dict}, {key})
< If there is no {key} in {dict} this is an error.
Returns zero on error.
+ Parameters: ~
+ • {dict} (`any`)
+ • {key} (`string`)
+
+ Return: ~
+ (`any`)
+
rename({from}, {to}) *rename()*
Rename the file by the name {from} to the name {to}. This
should also work to move files across file systems. The
@@ -5925,6 +7882,13 @@ rename({from}, {to}) *rename()*
NOTE: If {to} exists it is overwritten without warning.
This function is not available in the |sandbox|.
+ Parameters: ~
+ • {from} (`string`)
+ • {to} (`string`)
+
+ Return: ~
+ (`any`)
+
repeat({expr}, {count}) *repeat()*
Repeat {expr} {count} times and return the concatenated
result. Example: >vim
@@ -5935,6 +7899,13 @@ repeat({expr}, {count}) *repeat()*
let longlist = repeat(['a', 'b'], 3)
< Results in ['a', 'b', 'a', 'b', 'a', 'b'].
+ Parameters: ~
+ • {expr} (`any`)
+ • {count} (`integer`)
+
+ Return: ~
+ (`any`)
+
resolve({filename}) *resolve()* *E655*
On MS-Windows, when {filename} is a shortcut (a .lnk file),
returns the path the shortcut points to in a simplified form.
@@ -5948,6 +7919,12 @@ resolve({filename}) *resolve()* *E65
current directory (provided the result is still a relative
path name) and also keeps a trailing path separator.
+ Parameters: ~
+ • {filename} (`string`)
+
+ Return: ~
+ (`any`)
+
reverse({object}) *reverse()*
Reverse the order of items in {object}. {object} can be a
|List|, a |Blob| or a |String|. For a List and a Blob the
@@ -5959,6 +7936,12 @@ reverse({object}) *reverse()*
let revlist = reverse(copy(mylist))
<
+ Parameters: ~
+ • {object} (`any`)
+
+ Return: ~
+ (`any`)
+
round({expr}) *round()*
Round off {expr} to the nearest integral value and return it
as a |Float|. If {expr} lies halfway between two integral
@@ -5973,6 +7956,12 @@ round({expr}) *round()*
echo round(-4.5)
< -5.0
+ Parameters: ~
+ • {expr} (`number`)
+
+ Return: ~
+ (`any`)
+
rpcnotify({channel}, {event} [, {args}...]) *rpcnotify()*
Sends {event} to {channel} via |RPC| and returns immediately.
If {channel} is 0, the event is broadcast to all channels.
@@ -5980,6 +7969,14 @@ rpcnotify({channel}, {event} [, {args}...]) *rpcnotify()*
au VimLeave call rpcnotify(0, "leaving")
<
+ Parameters: ~
+ • {channel} (`integer`)
+ • {event} (`string`)
+ • {args} (`any?`)
+
+ Return: ~
+ (`any`)
+
rpcrequest({channel}, {method} [, {args}...]) *rpcrequest()*
Sends a request to {channel} to invoke {method} via
|RPC| and blocks until a response is received.
@@ -5987,12 +7984,13 @@ rpcrequest({channel}, {method} [, {args}...]) *rpcrequest()*
let result = rpcrequest(rpc_chan, "func", 1, 2, 3)
<
-rpcstart({prog} [, {argv}]) *rpcstart()*
- Deprecated. Replace >vim
- let id = rpcstart('prog', ['arg1', 'arg2'])
-< with >vim
- let id = jobstart(['prog', 'arg1', 'arg2'], {'rpc': v:true})
-<
+ Parameters: ~
+ • {channel} (`integer`)
+ • {method} (`string`)
+ • {args} (`any?`)
+
+ Return: ~
+ (`any`)
rubyeval({expr}) *rubyeval()*
Evaluate Ruby expression {expr} and return its result
@@ -6004,12 +8002,25 @@ rubyeval({expr}) *rubyeval()*
Other objects are represented as strings resulted from their
"Object#to_s" method.
+ Parameters: ~
+ • {expr} (`any`)
+
+ Return: ~
+ (`any`)
+
screenattr({row}, {col}) *screenattr()*
Like |screenchar()|, but return the attribute. This is a rather
arbitrary number that can only be used to compare to the
attribute at other positions.
Returns -1 when row or col is out of range.
+ Parameters: ~
+ • {row} (`integer`)
+ • {col} (`integer`)
+
+ Return: ~
+ (`any`)
+
screenchar({row}, {col}) *screenchar()*
The result is a Number, which is the character at position
[row, col] on the screen. This works for every possible
@@ -6020,6 +8031,13 @@ screenchar({row}, {col}) *screenchar()*
This is mainly to be used for testing.
Returns -1 when row or col is out of range.
+ Parameters: ~
+ • {row} (`integer`)
+ • {col} (`integer`)
+
+ Return: ~
+ (`any`)
+
screenchars({row}, {col}) *screenchars()*
The result is a |List| of Numbers. The first number is the same
as what |screenchar()| returns. Further numbers are
@@ -6027,6 +8045,13 @@ screenchars({row}, {col}) *screenchars()*
This is mainly to be used for testing.
Returns an empty List when row or col is out of range.
+ Parameters: ~
+ • {row} (`integer`)
+ • {col} (`integer`)
+
+ Return: ~
+ (`any`)
+
screencol() *screencol()*
The result is a Number, which is the current screen column of
the cursor. The leftmost column has number 1.
@@ -6039,9 +8064,12 @@ screencol() *screencol()*
the following mappings: >vim
nnoremap <expr> GG ":echom " .. screencol() .. "\n"
nnoremap <silent> GG :echom screencol()<CR>
- noremap GG <Cmd>echom screencol()<Cr>
+ noremap GG <Cmd>echom screencol()<CR>
<
+ Return: ~
+ (`any`)
+
screenpos({winid}, {lnum}, {col}) *screenpos()*
The result is a Dict with the screen position of the text
character in window {winid} at buffer line {lnum} and column
@@ -6066,6 +8094,14 @@ screenpos({winid}, {lnum}, {col}) *screenpos()*
first character is returned, {col} is not used.
Returns an empty Dict if {winid} is invalid.
+ Parameters: ~
+ • {winid} (`integer`)
+ • {lnum} (`integer`)
+ • {col} (`integer`)
+
+ Return: ~
+ (`any`)
+
screenrow() *screenrow()*
The result is a Number, which is the current screen row of the
cursor. The top line has number one.
@@ -6074,6 +8110,9 @@ screenrow() *screenrow()*
Note: Same restrictions as with |screencol()|.
+ Return: ~
+ (`any`)
+
screenstring({row}, {col}) *screenstring()*
The result is a String that contains the base character and
any composing characters at position [row, col] on the screen.
@@ -6082,6 +8121,13 @@ screenstring({row}, {col}) *screenstring()*
This is mainly to be used for testing.
Returns an empty String when row or col is out of range.
+ Parameters: ~
+ • {row} (`integer`)
+ • {col} (`integer`)
+
+ Return: ~
+ (`any`)
+
search({pattern} [, {flags} [, {stopline} [, {timeout} [, {skip}]]]]) *search()*
Search for regexp pattern {pattern}. The search starts at the
cursor position (you can use |cursor()| to set it).
@@ -6137,6 +8183,9 @@ search({pattern} [, {flags} [, {stopline} [, {timeout} [, {skip}]]]]) *search()*
The value must not be negative. A zero value is like not
giving the argument.
+ Note: the timeout is only considered when searching, not
+ while evaluating the {skip} expression.
+
If the {skip} expression is given it is evaluated with the
cursor positioned on the start of a match. If it evaluates to
non-zero this match is skipped. This can be used, for
@@ -6184,6 +8233,16 @@ search({pattern} [, {flags} [, {stopline} [, {timeout} [, {skip}]]]]) *search()*
without the 'e' flag if the cursor is on the "f" of "if".
The 'n' flag tells the function not to move the cursor.
+ Parameters: ~
+ • {pattern} (`string`)
+ • {flags} (`string?`)
+ • {stopline} (`integer?`)
+ • {timeout} (`integer?`)
+ • {skip} (`string|function?`)
+
+ Return: ~
+ (`any`)
+
searchcount([{options}]) *searchcount()*
Get or update the last search count, like what is displayed
without the "S" flag in 'shortmess'. This works even if
@@ -6305,6 +8364,12 @@ searchcount([{options}]) *searchcount()*
value. see |cursor()|, |getpos()|
(default: cursor's position)
+ Parameters: ~
+ • {options} (`table?`)
+
+ Return: ~
+ (`any`)
+
searchdecl({name} [, {global} [, {thisblock}]]) *searchdecl()*
Search for the declaration of {name}.
@@ -6324,6 +8389,14 @@ searchdecl({name} [, {global} [, {thisblock}]]) *searchdecl()*
endif
<
+ Parameters: ~
+ • {name} (`string`)
+ • {global} (`boolean?`)
+ • {thisblock} (`boolean?`)
+
+ Return: ~
+ (`any`)
+
*searchpair()*
searchpair({start}, {middle}, {end} [, {flags} [, {skip} [, {stopline} [, {timeout}]]]])
Search for the match of a nested start-end pair. This can be
@@ -6410,6 +8483,18 @@ searchpair({start}, {middle}, {end} [, {flags} [, {skip} [, {stopline} [, {timeo
\ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string"')
<
+ Parameters: ~
+ • {start} (`string`)
+ • {middle} (`string`)
+ • {end_} (`string`)
+ • {flags} (`string?`)
+ • {skip} (`string|function?`)
+ • {stopline} (`integer?`)
+ • {timeout} (`integer?`)
+
+ Return: ~
+ (`integer`)
+
*searchpairpos()*
searchpairpos({start}, {middle}, {end} [, {flags} [, {skip} [, {stopline} [, {timeout}]]]])
Same as |searchpair()|, but returns a |List| with the line and
@@ -6422,6 +8507,18 @@ searchpairpos({start}, {middle}, {end} [, {flags} [, {skip} [, {stopline} [, {ti
<
See |match-parens| for a bigger and more useful example.
+ Parameters: ~
+ • {start} (`string`)
+ • {middle} (`string`)
+ • {end_} (`string`)
+ • {flags} (`string?`)
+ • {skip} (`string|function?`)
+ • {stopline} (`integer?`)
+ • {timeout} (`integer?`)
+
+ Return: ~
+ (`[integer, integer]`)
+
*searchpos()*
searchpos({pattern} [, {flags} [, {stopline} [, {timeout} [, {skip}]]]])
Same as |search()|, but returns a |List| with the line and
@@ -6438,6 +8535,16 @@ searchpos({pattern} [, {flags} [, {stopline} [, {timeout} [, {skip}]]]])
< In this example "submatch" is 2 when a lowercase letter is
found |/\l|, 3 when an uppercase letter is found |/\u|.
+ Parameters: ~
+ • {pattern} (`string`)
+ • {flags} (`string?`)
+ • {stopline} (`integer?`)
+ • {timeout} (`integer?`)
+ • {skip} (`string|function?`)
+
+ Return: ~
+ (`any`)
+
serverlist() *serverlist()*
Returns a list of server addresses, or empty if all servers
were stopped. |serverstart()| |serverstop()|
@@ -6445,6 +8552,9 @@ serverlist() *serverlist()*
echo serverlist()
<
+ Return: ~
+ (`any`)
+
serverstart([{address}]) *serverstart()*
Opens a socket or named pipe at {address} and listens for
|RPC| messages. Clients can send |API| commands to the
@@ -6479,12 +8589,24 @@ serverstart([{address}]) *serverstart()*
echo serverstart('::1:12345')
<
+ Parameters: ~
+ • {address} (`string?`)
+
+ Return: ~
+ (`any`)
+
serverstop({address}) *serverstop()*
Closes the pipe or socket at {address}.
Returns TRUE if {address} is valid, else FALSE.
If |v:servername| is stopped it is set to the next available
address in |serverlist()|.
+ Parameters: ~
+ • {address} (`string`)
+
+ Return: ~
+ (`any`)
+
setbufline({buf}, {lnum}, {text}) *setbufline()*
Set line {lnum} to {text} in buffer {buf}. This works like
|setline()| for the specified buffer.
@@ -6510,6 +8632,14 @@ setbufline({buf}, {lnum}, {text}) *setbufline()*
If {buf} is not a valid buffer or {lnum} is not valid, an
error message is given.
+ Parameters: ~
+ • {buf} (`integer|string`)
+ • {lnum} (`integer`)
+ • {text} (`string|string[]`)
+
+ Return: ~
+ (`any`)
+
setbufvar({buf}, {varname}, {val}) *setbufvar()*
Set option or local variable {varname} in buffer {buf} to
{val}.
@@ -6524,6 +8654,14 @@ setbufvar({buf}, {varname}, {val}) *setbufvar()*
call setbufvar("todo", "myvar", "foobar")
< This function is not available in the |sandbox|.
+ Parameters: ~
+ • {buf} (`integer|string`)
+ • {varname} (`string`)
+ • {val} (`any`)
+
+ Return: ~
+ (`any`)
+
setcellwidths({list}) *setcellwidths()*
Specify overrides for cell widths of character ranges. This
tells Vim how wide characters are when displayed in the
@@ -6552,12 +8690,18 @@ setcellwidths({list}) *setcellwidths()*
To clear the overrides pass an empty {list}: >vim
call setcellwidths([])
-< You can use the script $VIMRUNTIME/tools/emoji_list.vim to see
+< You can use the script $VIMRUNTIME/tools/emoji_list.lua to see
the effect for known emoji characters. Move the cursor
through the text to check if the cell widths of your terminal
match with what Vim knows about each emoji. If it doesn't
look right you need to adjust the {list} argument.
+ Parameters: ~
+ • {list} (`any[]`)
+
+ Return: ~
+ (`any`)
+
setcharpos({expr}, {list}) *setcharpos()*
Same as |setpos()| but uses the specified column number as the
character index instead of the byte index in the line.
@@ -6569,6 +8713,13 @@ setcharpos({expr}, {list}) *setcharpos()*
call setpos('.', [0, 8, 4, 0])
< positions the cursor on the second character 'ë³´'.
+ Parameters: ~
+ • {expr} (`string`)
+ • {list} (`integer[]`)
+
+ Return: ~
+ (`any`)
+
setcharsearch({dict}) *setcharsearch()*
Set the current character search information to {dict},
which contains one or more of the following entries:
@@ -6589,6 +8740,12 @@ setcharsearch({dict}) *setcharsearch()*
call setcharsearch(prevsearch)
< Also see |getcharsearch()|.
+ Parameters: ~
+ • {dict} (`string`)
+
+ Return: ~
+ (`any`)
+
setcmdline({str} [, {pos}]) *setcmdline()*
Set the command line to {str} and set the cursor position to
{pos}.
@@ -6596,6 +8753,13 @@ setcmdline({str} [, {pos}]) *setcmdline()*
Returns 0 when successful, 1 when not editing the command
line.
+ Parameters: ~
+ • {str} (`string`)
+ • {pos} (`integer?`)
+
+ Return: ~
+ (`any`)
+
setcmdpos({pos}) *setcmdpos()*
Set the cursor position in the command line to byte position
{pos}. The first position is 1.
@@ -6611,6 +8775,12 @@ setcmdpos({pos}) *setcmdpos()*
Returns 0 when successful, 1 when not editing the command
line.
+ Parameters: ~
+ • {pos} (`integer`)
+
+ Return: ~
+ (`any`)
+
setcursorcharpos({lnum}, {col} [, {off}]) *setcursorcharpos()*
setcursorcharpos({list})
Same as |cursor()| but uses the specified column number as the
@@ -6623,6 +8793,12 @@ setcursorcharpos({list})
call cursor(4, 3)
< positions the cursor on the first character 'ì—¬'.
+ Parameters: ~
+ • {list} (`integer[]`)
+
+ Return: ~
+ (`any`)
+
setenv({name}, {val}) *setenv()*
Set environment variable {name} to {val}. Example: >vim
call setenv('HOME', '/home/myhome')
@@ -6630,6 +8806,13 @@ setenv({name}, {val}) *setenv()*
< When {val} is |v:null| the environment variable is deleted.
See also |expr-env|.
+ Parameters: ~
+ • {name} (`string`)
+ • {val} (`string`)
+
+ Return: ~
+ (`any`)
+
setfperm({fname}, {mode}) *setfperm()* *chmod*
Set the file permissions for {fname} to {mode}.
{mode} must be a string with 9 characters. It is of the form
@@ -6647,6 +8830,13 @@ setfperm({fname}, {mode}) *setfperm()* *chmo
To read permissions see |getfperm()|.
+ Parameters: ~
+ • {fname} (`string`)
+ • {mode} (`string`)
+
+ Return: ~
+ (`any`)
+
setline({lnum}, {text}) *setline()*
Set line {lnum} of the current buffer to {text}. To insert
lines use |append()|. To set lines in another buffer use
@@ -6675,6 +8865,13 @@ setline({lnum}, {text}) *setline()*
< Note: The '[ and '] marks are not set.
+ Parameters: ~
+ • {lnum} (`integer`)
+ • {text} (`any`)
+
+ Return: ~
+ (`any`)
+
setloclist({nr}, {list} [, {action} [, {what}]]) *setloclist()*
Create or replace or add to the location list for window {nr}.
{nr} can be the window number or the |window-ID|.
@@ -6691,6 +8888,15 @@ setloclist({nr}, {list} [, {action} [, {what}]]) *setloclist()*
only the items listed in {what} are set. Refer to |setqflist()|
for the list of supported keys in {what}.
+ Parameters: ~
+ • {nr} (`integer`)
+ • {list} (`any`)
+ • {action} (`string?`)
+ • {what} (`table?`)
+
+ Return: ~
+ (`any`)
+
setmatches({list} [, {win}]) *setmatches()*
Restores a list of matches saved by |getmatches()| for the
current window. Returns 0 if successful, otherwise -1. All
@@ -6699,6 +8905,13 @@ setmatches({list} [, {win}]) *setmatches()*
If {win} is specified, use the window with this number or
window ID instead of the current window.
+ Parameters: ~
+ • {list} (`any`)
+ • {win} (`integer?`)
+
+ Return: ~
+ (`any`)
+
setpos({expr}, {list}) *setpos()*
Set the position for String {expr}. Possible values:
. the cursor
@@ -6748,6 +8961,13 @@ setpos({expr}, {list}) *setpos()*
also set the preferred column. Also see the "curswant" key in
|winrestview()|.
+ Parameters: ~
+ • {expr} (`string`)
+ • {list} (`integer[]`)
+
+ Return: ~
+ (`any`)
+
setqflist({list} [, {action} [, {what}]]) *setqflist()*
Create or replace or add to the quickfix list.
@@ -6862,6 +9082,14 @@ setqflist({list} [, {action} [, {what}]]) *setqflist()*
independent of the 'errorformat' setting. Use a command like
`:cc 1` to jump to the first position.
+ Parameters: ~
+ • {list} (`any[]`)
+ • {action} (`string?`)
+ • {what} (`table?`)
+
+ Return: ~
+ (`any`)
+
setreg({regname}, {value} [, {options}]) *setreg()*
Set the register {regname} to {value}.
If {regname} is "" or "@", the unnamed register '"' is used.
@@ -6918,6 +9146,14 @@ setreg({regname}, {value} [, {options}]) *setreg()*
nothing: >vim
call setreg('a', '', 'al')
+ Parameters: ~
+ • {regname} (`string`)
+ • {value} (`any`)
+ • {options} (`string?`)
+
+ Return: ~
+ (`any`)
+
settabvar({tabnr}, {varname}, {val}) *settabvar()*
Set tab-local variable {varname} to {val} in tab page {tabnr}.
|t:var|
@@ -6926,6 +9162,14 @@ settabvar({tabnr}, {varname}, {val}) *settabvar()*
Tabs are numbered starting with one.
This function is not available in the |sandbox|.
+ Parameters: ~
+ • {tabnr} (`integer`)
+ • {varname} (`string`)
+ • {val} (`any`)
+
+ Return: ~
+ (`any`)
+
settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()*
Set option or local variable {varname} in window {winnr} to
{val}.
@@ -6942,6 +9186,15 @@ settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()*
call settabwinvar(3, 2, "myvar", "foobar")
< This function is not available in the |sandbox|.
+ Parameters: ~
+ • {tabnr} (`integer`)
+ • {winnr} (`integer`)
+ • {varname} (`string`)
+ • {val} (`any`)
+
+ Return: ~
+ (`any`)
+
settagstack({nr}, {dict} [, {action}]) *settagstack()*
Modify the tag stack of the window {nr} using {dict}.
{nr} can be the window number or the |window-ID|.
@@ -6976,16 +9229,38 @@ settagstack({nr}, {dict} [, {action}]) *settagstack()*
unlet stack
<
+ Parameters: ~
+ • {nr} (`integer`)
+ • {dict} (`any`)
+ • {action} (`string?`)
+
+ Return: ~
+ (`any`)
+
setwinvar({nr}, {varname}, {val}) *setwinvar()*
Like |settabwinvar()| for the current tab page.
Examples: >vim
call setwinvar(1, "&list", 0)
call setwinvar(2, "myvar", "foobar")
+ Parameters: ~
+ • {nr} (`integer`)
+ • {varname} (`string`)
+ • {val} (`any`)
+
+ Return: ~
+ (`any`)
+
sha256({string}) *sha256()*
Returns a String with 64 hex characters, which is the SHA256
checksum of {string}.
+ Parameters: ~
+ • {string} (`string`)
+
+ Return: ~
+ (`any`)
+
shellescape({string} [, {special}]) *shellescape()*
Escape {string} for use as a shell command argument.
@@ -7018,6 +9293,13 @@ shellescape({string} [, {special}]) *shellescape()*
call system("chmod +w -- " .. shellescape(expand("%")))
< See also |::S|.
+ Parameters: ~
+ • {string} (`string`)
+ • {special} (`boolean?`)
+
+ Return: ~
+ (`any`)
+
shiftwidth([{col}]) *shiftwidth()*
Returns the effective value of 'shiftwidth'. This is the
'shiftwidth' value unless it is zero, in which case it is the
@@ -7039,6 +9321,12 @@ shiftwidth([{col}]) *shiftwidth()*
'vartabstop' feature. If no {col} argument is given, column 1
will be assumed.
+ Parameters: ~
+ • {col} (`integer?`)
+
+ Return: ~
+ (`integer`)
+
sign_define({name} [, {dict}]) *sign_define()*
sign_define({list})
Define a new sign named {name} or modify the attributes of an
@@ -7053,6 +9341,7 @@ sign_define({list})
icon full path to the bitmap file for the sign.
linehl highlight group used for the whole line the
sign is placed in.
+ priority default priority value of the sign
numhl highlight group used for the line number where
the sign is placed.
text text that is displayed when there is no icon
@@ -7086,6 +9375,12 @@ sign_define({list})
\ ])
<
+ Parameters: ~
+ • {list} (`vim.fn.sign_define.dict[]`)
+
+ Return: ~
+ (`(0|-1)[]`)
+
sign_getdefined([{name}]) *sign_getdefined()*
Get a list of defined signs and their attributes.
This is similar to the |:sign-list| command.
@@ -7100,6 +9395,7 @@ sign_getdefined([{name}]) *sign_getdefined()*
linehl highlight group used for the whole line the
sign is placed in; not present if not set.
name name of the sign
+ priority default priority value of the sign
numhl highlight group used for the line number where
the sign is placed; not present if not set.
text text that is displayed when there is no icon
@@ -7122,6 +9418,12 @@ sign_getdefined([{name}]) *sign_getdefined()*
echo sign_getdefined("mySign")
<
+ Parameters: ~
+ • {name} (`string?`)
+
+ Return: ~
+ (`vim.fn.sign_getdefined.ret.item[]`)
+
sign_getplaced([{buf} [, {dict}]]) *sign_getplaced()*
Return a list of signs placed in a buffer or all the buffers.
This is similar to the |:sign-place-list| command.
@@ -7183,6 +9485,13 @@ sign_getplaced([{buf} [, {dict}]]) *sign_getplaced()*
echo sign_getplaced()
<
+ Parameters: ~
+ • {buf} (`integer|string?`)
+ • {dict} (`vim.fn.sign_getplaced.dict?`)
+
+ Return: ~
+ (`vim.fn.sign_getplaced.ret.item[]`)
+
sign_jump({id}, {group}, {buf}) *sign_jump()*
Open the buffer {buf} or jump to the window that contains
{buf} and position the cursor at sign {id} in group {group}.
@@ -7199,6 +9508,14 @@ sign_jump({id}, {group}, {buf}) *sign_jump()*
call sign_jump(10, '', '')
<
+ Parameters: ~
+ • {id} (`integer`)
+ • {group} (`string`)
+ • {buf} (`integer|string`)
+
+ Return: ~
+ (`integer`)
+
sign_place({id}, {group}, {name}, {buf} [, {dict}]) *sign_place()*
Place the sign defined as {name} at line {lnum} in file or
buffer {buf} and assign {id} and {group} to sign. This is
@@ -7248,6 +9565,16 @@ sign_place({id}, {group}, {name}, {buf} [, {dict}]) *sign_place()*
\ {'lnum' : 40, 'priority' : 90})
<
+ Parameters: ~
+ • {id} (`integer`)
+ • {group} (`string`)
+ • {name} (`string`)
+ • {buf} (`integer|string`)
+ • {dict} (`vim.fn.sign_place.dict?`)
+
+ Return: ~
+ (`integer`)
+
sign_placelist({list}) *sign_placelist()*
Place one or more signs. This is similar to the
|sign_place()| function. The {list} argument specifies the
@@ -7272,7 +9599,8 @@ sign_placelist({list}) *sign_placelist()*
priority Priority of the sign. When multiple signs are
placed on a line, the sign with the highest
priority is used. If not specified, the
- default value of 10 is used. See
+ default value of 10 is used, unless specified
+ otherwise by the sign definition. See
|sign-priority| for more information.
If {id} refers to an existing sign, then the existing sign is
@@ -7307,6 +9635,12 @@ sign_placelist({list}) *sign_placelist()*
\ ])
<
+ Parameters: ~
+ • {list} (`vim.fn.sign_placelist.list.item[]`)
+
+ Return: ~
+ (`integer[]`)
+
sign_undefine([{name}]) *sign_undefine()*
sign_undefine({list})
Deletes a previously defined sign {name}. This is similar to
@@ -7331,6 +9665,12 @@ sign_undefine({list})
call sign_undefine()
<
+ Parameters: ~
+ • {list} (`string[]?`)
+
+ Return: ~
+ (`integer[]`)
+
sign_unplace({group} [, {dict}]) *sign_unplace()*
Remove a previously placed sign in one or more buffers. This
is similar to the |:sign-unplace| command.
@@ -7373,6 +9713,13 @@ sign_unplace({group} [, {dict}]) *sign_unplace()*
" Remove all the placed signs from all the buffers
call sign_unplace('*')
+ Parameters: ~
+ • {group} (`string`)
+ • {dict} (`vim.fn.sign_unplace.dict?`)
+
+ Return: ~
+ (`0|-1`)
+
sign_unplacelist({list}) *sign_unplacelist()*
Remove previously placed signs from one or more buffers. This
is similar to the |sign_unplace()| function.
@@ -7402,6 +9749,12 @@ sign_unplacelist({list}) *sign_unplacelist()*
\ ])
<
+ Parameters: ~
+ • {list} (`vim.fn.sign_unplacelist.list.item`)
+
+ Return: ~
+ (`(0|-1)[]`)
+
simplify({filename}) *simplify()*
Simplify the file name as much as possible without changing
the meaning. Shortcuts (on MS-Windows) or symbolic links (on
@@ -7419,6 +9772,12 @@ simplify({filename}) *simplify()*
directory. In order to resolve all the involved symbolic
links before simplifying the path name, use |resolve()|.
+ Parameters: ~
+ • {filename} (`string`)
+
+ Return: ~
+ (`any`)
+
sin({expr}) *sin()*
Return the sine of {expr}, measured in radians, as a |Float|.
{expr} must evaluate to a |Float| or a |Number|.
@@ -7429,6 +9788,12 @@ sin({expr}) *sin()*
echo sin(-4.01)
< 0.763301
+ Parameters: ~
+ • {expr} (`number`)
+
+ Return: ~
+ (`any`)
+
sinh({expr}) *sinh()*
Return the hyperbolic sine of {expr} as a |Float| in the range
[-inf, inf].
@@ -7440,6 +9805,12 @@ sinh({expr}) *sinh()*
echo sinh(-0.9)
< -1.026517
+ Parameters: ~
+ • {expr} (`number`)
+
+ Return: ~
+ (`any`)
+
slice({expr}, {start} [, {end}]) *slice()*
Similar to using a |slice| "expr[start : end]", but "end" is
used exclusive. And for a string the indexes are used as
@@ -7450,6 +9821,14 @@ slice({expr}, {start} [, {end}]) *slice()*
When {end} is -1 the last item is omitted.
Returns an empty value if {start} or {end} are invalid.
+ Parameters: ~
+ • {expr} (`any`)
+ • {start} (`integer`)
+ • {end_} (`integer?`)
+
+ Return: ~
+ (`any`)
+
sockconnect({mode}, {address} [, {opts}]) *sockconnect()*
Connect a socket to an address. If {mode} is "pipe" then
{address} should be the path of a local domain socket (on
@@ -7475,6 +9854,14 @@ sockconnect({mode}, {address} [, {opts}]) *sockconnect()*
- The channel ID on success (greater than zero)
- 0 on invalid arguments or connection failure.
+ Parameters: ~
+ • {mode} (`string`)
+ • {address} (`string`)
+ • {opts} (`table?`)
+
+ Return: ~
+ (`any`)
+
sort({list} [, {how} [, {dict}]]) *sort()* *E702*
Sort the items in {list} in-place. Returns {list}.
@@ -7548,6 +9935,14 @@ sort({list} [, {how} [, {dict}]]) *sort()* *E70
eval mylist->sort({i1, i2 -> i1 - i2})
<
+ Parameters: ~
+ • {list} (`any`)
+ • {how} (`string|function?`)
+ • {dict} (`any?`)
+
+ Return: ~
+ (`any`)
+
soundfold({word}) *soundfold()*
Return the sound-folded equivalent of {word}. Uses the first
language in 'spelllang' for the current window that supports
@@ -7556,6 +9951,12 @@ soundfold({word}) *soundfold()*
This can be used for making spelling suggestions. Note that
the method can be quite slow.
+ Parameters: ~
+ • {word} (`string`)
+
+ Return: ~
+ (`any`)
+
spellbadword([{sentence}]) *spellbadword()*
Without argument: The result is the badly spelled word under
or after the cursor. The cursor is moved to the start of the
@@ -7580,6 +9981,12 @@ spellbadword([{sentence}]) *spellbadword()*
The spelling information for the current window and the value
of 'spelllang' are used.
+ Parameters: ~
+ • {sentence} (`string?`)
+
+ Return: ~
+ (`any`)
+
spellsuggest({word} [, {max} [, {capital}]]) *spellsuggest()*
Return a |List| with spelling suggestions to replace {word}.
When {max} is given up to this number of suggestions are
@@ -7601,10 +10008,18 @@ spellsuggest({word} [, {max} [, {capital}]]) *spellsuggest()*
The spelling information for the current window is used. The
values of 'spelllang' and 'spellsuggest' are used.
+ Parameters: ~
+ • {word} (`string`)
+ • {max} (`integer?`)
+ • {capital} (`boolean?`)
+
+ Return: ~
+ (`any`)
+
split({string} [, {pattern} [, {keepempty}]]) *split()*
Make a |List| out of {string}. When {pattern} is omitted or
- empty each white-separated sequence of characters becomes an
- item.
+ empty each white space separated sequence of characters
+ becomes an item.
Otherwise the string is split where {pattern} matches,
removing the matched characters. 'ignorecase' is not used
here, add \c to ignore case. |/\c|
@@ -7626,6 +10041,14 @@ split({string} [, {pattern} [, {keepempty}]]) *split()*
let items = split(line, ':', 1)
< The opposite function is |join()|.
+ Parameters: ~
+ • {string} (`string`)
+ • {pattern} (`string?`)
+ • {keepempty} (`boolean?`)
+
+ Return: ~
+ (`any`)
+
sqrt({expr}) *sqrt()*
Return the non-negative square root of Float {expr} as a
|Float|.
@@ -7639,6 +10062,12 @@ sqrt({expr}) *sqrt()*
< str2float("nan")
NaN may be different, it depends on system libraries.
+ Parameters: ~
+ • {expr} (`number`)
+
+ Return: ~
+ (`any`)
+
srand([{expr}]) *srand()*
Initialize seed used by |rand()|:
- If {expr} is not given, seed values are initialized by
@@ -7654,6 +10083,12 @@ srand([{expr}]) *srand()*
echo rand(seed)
<
+ Parameters: ~
+ • {expr} (`number?`)
+
+ Return: ~
+ (`any`)
+
state([{what}]) *state()*
Return a string which contains characters indicating the
current state. Mostly useful in callbacks that want to do
@@ -7684,6 +10119,12 @@ state([{what}]) *state()*
recursiveness up to "ccc")
s screen has scrolled for messages
+ Parameters: ~
+ • {what} (`string?`)
+
+ Return: ~
+ (`any`)
+
stdioopen({opts}) *stdioopen()*
With |--headless| this opens stdin and stdout as a |channel|.
May be called only once. See |channel-stdio|. stderr is not
@@ -7705,6 +10146,12 @@ stdioopen({opts}) *stdioopen()*
- |channel-id| on success (value is always 1)
- 0 on invalid arguments
+ Parameters: ~
+ • {opts} (`table`)
+
+ Return: ~
+ (`any`)
+
stdpath({what}) *stdpath()* *E6100*
Returns |standard-path| locations of various default files and
directories.
@@ -7727,6 +10174,13 @@ stdpath({what}) *stdpath()* *E610
echo stdpath("config")
<
+ Parameters: ~
+ • {what}
+ (`'cache'|'config'|'config_dirs'|'data'|'data_dirs'|'log'|'run'|'state'`)
+
+ Return: ~
+ (`string|string[]`)
+
str2float({string} [, {quoted}]) *str2float()*
Convert String {string} to a Float. This mostly works the
same as when using a floating point number in an expression,
@@ -7746,6 +10200,13 @@ str2float({string} [, {quoted}]) *str2float()*
<
Returns 0.0 if the conversion fails.
+ Parameters: ~
+ • {string} (`string`)
+ • {quoted} (`boolean?`)
+
+ Return: ~
+ (`any`)
+
str2list({string} [, {utf8}]) *str2list()*
Return a list containing the number values which represent
each character in String {string}. Examples: >vim
@@ -7758,6 +10219,13 @@ str2list({string} [, {utf8}]) *str2list()*
With UTF-8 composing characters are handled properly: >vim
echo str2list("aÌ") " returns [97, 769]
+ Parameters: ~
+ • {string} (`string`)
+ • {utf8} (`boolean?`)
+
+ Return: ~
+ (`any`)
+
str2nr({string} [, {base}]) *str2nr()*
Convert string {string} to a number.
{base} is the conversion base, it can be 2, 8, 10 or 16.
@@ -7777,6 +10245,13 @@ str2nr({string} [, {base}]) *str2nr()*
Returns 0 if {string} is empty or on error.
+ Parameters: ~
+ • {string} (`string`)
+ • {base} (`integer?`)
+
+ Return: ~
+ (`any`)
+
strcharlen({string}) *strcharlen()*
The result is a Number, which is the number of characters
in String {string}. Composing characters are ignored.
@@ -7787,6 +10262,12 @@ strcharlen({string}) *strcharlen()*
Also see |strlen()|, |strdisplaywidth()| and |strwidth()|.
+ Parameters: ~
+ • {string} (`string`)
+
+ Return: ~
+ (`any`)
+
strcharpart({src}, {start} [, {len} [, {skipcc}]]) *strcharpart()*
Like |strpart()| but using character index and length instead
of byte index and length.
@@ -7802,6 +10283,15 @@ strcharpart({src}, {start} [, {len} [, {skipcc}]]) *strcharpart()*
Returns an empty string on error.
+ Parameters: ~
+ • {src} (`string`)
+ • {start} (`integer`)
+ • {len} (`integer?`)
+ • {skipcc} (`boolean?`)
+
+ Return: ~
+ (`any`)
+
strchars({string} [, {skipcc}]) *strchars()*
The result is a Number, which is the number of characters
in String {string}.
@@ -7831,6 +10321,13 @@ strchars({string} [, {skipcc}]) *strchars()*
endif
<
+ Parameters: ~
+ • {string} (`string`)
+ • {skipcc} (`boolean?`)
+
+ Return: ~
+ (`integer`)
+
strdisplaywidth({string} [, {col}]) *strdisplaywidth()*
The result is a Number, which is the number of display cells
String {string} occupies on the screen when it starts at {col}
@@ -7845,6 +10342,13 @@ strdisplaywidth({string} [, {col}]) *strdisplaywidth()*
Returns zero on error.
Also see |strlen()|, |strwidth()| and |strchars()|.
+ Parameters: ~
+ • {string} (`string`)
+ • {col} (`integer?`)
+
+ Return: ~
+ (`integer`)
+
strftime({format} [, {time}]) *strftime()*
The result is a String, which is a formatted date and time, as
specified by the {format} string. The given {time} is used,
@@ -7862,6 +10366,13 @@ strftime({format} [, {time}]) *strftime()*
echo strftime("%c", getftime("file.c"))
" Show mod time of file.c.
+ Parameters: ~
+ • {format} (`string`)
+ • {time} (`number?`)
+
+ Return: ~
+ (`string`)
+
strgetchar({str}, {index}) *strgetchar()*
Get a Number corresponding to the character at {index} in
{str}. This uses a zero-based character index, not a byte
@@ -7871,6 +10382,13 @@ strgetchar({str}, {index}) *strgetchar()*
Returns -1 if {index} is invalid.
Also see |strcharpart()| and |strchars()|.
+ Parameters: ~
+ • {str} (`string`)
+ • {index} (`integer`)
+
+ Return: ~
+ (`integer`)
+
stridx({haystack}, {needle} [, {start}]) *stridx()*
The result is a Number, which gives the byte index in
{haystack} of the first occurrence of the String {needle}.
@@ -7890,6 +10408,14 @@ stridx({haystack}, {needle} [, {start}]) *stridx()*
stridx() works similar to the C function strstr(). When used
with a single character it works similar to strchr().
+ Parameters: ~
+ • {haystack} (`string`)
+ • {needle} (`string`)
+ • {start} (`integer?`)
+
+ Return: ~
+ (`integer`)
+
string({expr}) *string()*
Return {expr} converted to a String. If {expr} is a Number,
Float, String, Blob or a composition of them, then the result
@@ -7914,6 +10440,12 @@ string({expr}) *string()*
method. Use |msgpackdump()| or |json_encode()| if you need to
share data with other applications.
+ Parameters: ~
+ • {expr} (`any`)
+
+ Return: ~
+ (`string`)
+
strlen({string}) *strlen()*
The result is a Number, which is the length of the String
{string} in bytes.
@@ -7923,6 +10455,12 @@ strlen({string}) *strlen()*
|strchars()|.
Also see |len()|, |strdisplaywidth()| and |strwidth()|.
+ Parameters: ~
+ • {string} (`string`)
+
+ Return: ~
+ (`integer`)
+
strpart({src}, {start} [, {len} [, {chars}]]) *strpart()*
The result is a String, which is part of {src}, starting from
byte {start}, with the byte length {len}.
@@ -7948,6 +10486,15 @@ strpart({src}, {start} [, {len} [, {chars}]]) *strpart()*
<
Returns an empty string on error.
+ Parameters: ~
+ • {src} (`string`)
+ • {start} (`integer`)
+ • {len} (`integer?`)
+ • {chars} (`0|1?`)
+
+ Return: ~
+ (`string`)
+
strptime({format}, {timestring}) *strptime()*
The result is a Number, which is a unix timestamp representing
the date and time in {timestring}, which is expected to match
@@ -7972,6 +10519,13 @@ strptime({format}, {timestring}) *strptime()*
echo strftime("%c", strptime("%Y%m%d%H%M%S", "19970427115355") + 3600)
< Sun Apr 27 12:53:55 1997
+ Parameters: ~
+ • {format} (`string`)
+ • {timestring} (`string`)
+
+ Return: ~
+ (`integer`)
+
strridx({haystack}, {needle} [, {start}]) *strridx()*
The result is a Number, which gives the byte index in
{haystack} of the last occurrence of the String {needle}.
@@ -7990,6 +10544,14 @@ strridx({haystack}, {needle} [, {start}]) *strridx()*
When used with a single character it works similar to the C
function strrchr().
+ Parameters: ~
+ • {haystack} (`string`)
+ • {needle} (`string`)
+ • {start} (`integer?`)
+
+ Return: ~
+ (`integer`)
+
strtrans({string}) *strtrans()*
The result is a String, which is {string} with all unprintable
characters translated into printable characters |'isprint'|.
@@ -8000,6 +10562,12 @@ strtrans({string}) *strtrans()*
Returns an empty string on error.
+ Parameters: ~
+ • {string} (`string`)
+
+ Return: ~
+ (`string`)
+
strutf16len({string} [, {countcc}]) *strutf16len()*
The result is a Number, which is the number of UTF-16 code
units in String {string} (after converting it to UTF-16).
@@ -8020,6 +10588,13 @@ strutf16len({string} [, {countcc}]) *strutf16len()*
echo strutf16len('ąÌ', v:true) " returns 3
<
+ Parameters: ~
+ • {string} (`string`)
+ • {countcc} (`0|1?`)
+
+ Return: ~
+ (`integer`)
+
strwidth({string}) *strwidth()*
The result is a Number, which is the number of display cells
String {string} occupies. A Tab character is counted as one
@@ -8029,6 +10604,12 @@ strwidth({string}) *strwidth()*
Returns zero on error.
Also see |strlen()|, |strdisplaywidth()| and |strchars()|.
+ Parameters: ~
+ • {string} (`string`)
+
+ Return: ~
+ (`integer`)
+
submatch({nr} [, {list}]) *submatch()* *E935*
Only for an expression in a |:substitute| command or
substitute() function.
@@ -8057,6 +10638,13 @@ submatch({nr} [, {list}]) *submatch()* *E93
< This finds the first number in the line and adds one to it.
A line break is included as a newline character.
+ Parameters: ~
+ • {nr} (`integer`)
+ • {list} (`nil?`)
+
+ Return: ~
+ (`string`)
+
substitute({string}, {pat}, {sub}, {flags}) *substitute()*
The result is a String, which is a copy of {string}, in which
the first match of {pat} is replaced with {sub}.
@@ -8100,6 +10688,15 @@ substitute({string}, {pat}, {sub}, {flags}) *substitute()*
< Returns an empty string on error.
+ Parameters: ~
+ • {string} (`string`)
+ • {pat} (`string`)
+ • {sub} (`string`)
+ • {flags} (`string`)
+
+ Return: ~
+ (`string`)
+
swapfilelist() *swapfilelist()*
Returns a list of swap file names, like what "vim -r" shows.
See the |-r| command argument. The 'directory' option is used
@@ -8111,6 +10708,9 @@ swapfilelist() *swapfilelist()*
let swapfiles = swapfilelist()
let &directory = save_dir
+ Return: ~
+ (`string[]`)
+
swapinfo({fname}) *swapinfo()*
The result is a dictionary, which holds information about the
swapfile {fname}. The available fields are:
@@ -8129,6 +10729,12 @@ swapinfo({fname}) *swapinfo()*
Not a swap file: does not contain correct block ID
Magic number mismatch: Info in first block is invalid
+ Parameters: ~
+ • {fname} (`string`)
+
+ Return: ~
+ (`any`)
+
swapname({buf}) *swapname()*
The result is the swap file path of the buffer {buf}.
For the use of {buf}, see |bufname()| above.
@@ -8136,6 +10742,12 @@ swapname({buf}) *swapname()*
|:swapname| (unless there is no swap file).
If buffer {buf} has no swap file, returns an empty string.
+ Parameters: ~
+ • {buf} (`integer|string`)
+
+ Return: ~
+ (`string`)
+
synID({lnum}, {col}, {trans}) *synID()*
The result is a Number, which is the syntax ID at the position
{lnum} and {col} in the current window.
@@ -8162,6 +10774,14 @@ synID({lnum}, {col}, {trans}) *synID()*
echo synIDattr(synID(line("."), col("."), 1), "name")
<
+ Parameters: ~
+ • {lnum} (`integer`)
+ • {col} (`integer`)
+ • {trans} (`0|1`)
+
+ Return: ~
+ (`integer`)
+
synIDattr({synID}, {what} [, {mode}]) *synIDattr()*
The result is a String, which is the {what} attribute of
syntax ID {synID}. This can be used to obtain information
@@ -8208,6 +10828,14 @@ synIDattr({synID}, {what} [, {mode}]) *synIDattr()*
echo synID(line("."), col("."), 1)->synIDtrans()->synIDattr("fg")
<
+ Parameters: ~
+ • {synID} (`integer`)
+ • {what} (`string`)
+ • {mode} (`string?`)
+
+ Return: ~
+ (`string`)
+
synIDtrans({synID}) *synIDtrans()*
The result is a Number, which is the translated syntax ID of
{synID}. This is the syntax group ID of what is being used to
@@ -8216,6 +10844,12 @@ synIDtrans({synID}) *synIDtrans()*
Returns zero on error.
+ Parameters: ~
+ • {synID} (`integer`)
+
+ Return: ~
+ (`integer`)
+
synconcealed({lnum}, {col}) *synconcealed()*
The result is a |List| with currently three items:
1. The first item in the list is 0 if the character at the
@@ -8245,6 +10879,13 @@ synconcealed({lnum}, {col}) *synconcealed()*
since syntax and matching highlighting are two different
mechanisms |syntax-vs-match|.
+ Parameters: ~
+ • {lnum} (`integer`)
+ • {col} (`integer`)
+
+ Return: ~
+ (`[integer, string, integer]`)
+
synstack({lnum}, {col}) *synstack()*
Return a |List|, which is the stack of syntax items at the
position {lnum} and {col} in the current window. {lnum} is
@@ -8264,6 +10905,13 @@ synstack({lnum}, {col}) *synstack()*
character in a line and the first column in an empty line are
valid positions.
+ Parameters: ~
+ • {lnum} (`integer`)
+ • {col} (`integer`)
+
+ Return: ~
+ (`integer[]`)
+
system({cmd} [, {input}]) *system()* *E677*
Note: Prefer |vim.system()| in Lua.
@@ -8313,6 +10961,13 @@ system({cmd} [, {input}]) *system()* *E67
< Unlike ":!cmd" there is no automatic check for changed files.
Use |:checktime| to force a check.
+ Parameters: ~
+ • {cmd} (`string|string[]`)
+ • {input} (`string|string[]|integer?`)
+
+ Return: ~
+ (`string`)
+
systemlist({cmd} [, {input} [, {keepempty}]]) *systemlist()*
Same as |system()|, but returns a |List| with lines (parts of
output separated by NL) with NULs transformed into NLs. Output
@@ -8327,6 +10982,14 @@ systemlist({cmd} [, {input} [, {keepempty}]]) *systemlist()*
<
Returns an empty string on error.
+ Parameters: ~
+ • {cmd} (`string|string[]`)
+ • {input} (`string|string[]|integer?`)
+ • {keepempty} (`integer?`)
+
+ Return: ~
+ (`string[]`)
+
tabpagebuflist([{arg}]) *tabpagebuflist()*
The result is a |List|, where each item is the number of the
buffer associated with each window in the current tab page.
@@ -8340,6 +11003,12 @@ tabpagebuflist([{arg}]) *tabpagebuflist()*
endfor
< Note that a buffer may appear in more than one window.
+ Parameters: ~
+ • {arg} (`integer?`)
+
+ Return: ~
+ (`any`)
+
tabpagenr([{arg}]) *tabpagenr()*
The result is a Number, which is the number of the current
tab page. The first tab page has number 1.
@@ -8354,6 +11023,12 @@ tabpagenr([{arg}]) *tabpagenr()*
Returns zero on error.
+ Parameters: ~
+ • {arg} (`'$'|'#'?`)
+
+ Return: ~
+ (`integer`)
+
tabpagewinnr({tabarg} [, {arg}]) *tabpagewinnr()*
Like |winnr()| but for tab page {tabarg}.
{tabarg} specifies the number of tab page to be used.
@@ -8367,10 +11042,20 @@ tabpagewinnr({tabarg} [, {arg}]) *tabpagewinnr()*
tabpagewinnr(4, '$') " number of windows in tab page 4
< When {tabarg} is invalid zero is returned.
+ Parameters: ~
+ • {tabarg} (`integer`)
+ • {arg} (`'$'|'#'?`)
+
+ Return: ~
+ (`integer`)
+
tagfiles() *tagfiles()*
Returns a |List| with the file names used to search for tags
for the current buffer. This is the 'tags' option expanded.
+ Return: ~
+ (`string[]`)
+
taglist({expr} [, {filename}]) *taglist()*
Returns a |List| of tags matching the regular expression {expr}.
@@ -8414,6 +11099,13 @@ taglist({expr} [, {filename}]) *taglist()*
located by Vim. Refer to |tags-file-format| for the format of
the tags file generated by the different ctags tools.
+ Parameters: ~
+ • {expr} (`any`)
+ • {filename} (`string?`)
+
+ Return: ~
+ (`any`)
+
tan({expr}) *tan()*
Return the tangent of {expr}, measured in radians, as a |Float|
in the range [-inf, inf].
@@ -8425,6 +11117,12 @@ tan({expr}) *tan()*
echo tan(-4.01)
< -1.181502
+ Parameters: ~
+ • {expr} (`number`)
+
+ Return: ~
+ (`number`)
+
tanh({expr}) *tanh()*
Return the hyperbolic tangent of {expr} as a |Float| in the
range [-1, 1].
@@ -8436,6 +11134,12 @@ tanh({expr}) *tanh()*
echo tanh(-1)
< -0.761594
+ Parameters: ~
+ • {expr} (`number`)
+
+ Return: ~
+ (`number`)
+
tempname() *tempname()*
Generates a (non-existent) filename located in the Nvim root
|tempdir|. Scripts can use the filename as a temporary file.
@@ -8444,6 +11148,9 @@ tempname() *tempname()*
exe "redir > " .. tmpfile
<
+ Return: ~
+ (`string`)
+
termopen({cmd} [, {opts}]) *termopen()*
Spawns {cmd} in a new pseudo-terminal session connected
to the current (unmodified) buffer. Parameters and behavior
@@ -8459,11 +11166,21 @@ termopen({cmd} [, {opts}]) *termopen()*
except $TERM is set to "xterm-256color". Full behavior is
described in |terminal|.
+ Parameters: ~
+ • {cmd} (`string|string[]`)
+ • {opts} (`table?`)
+
+ Return: ~
+ (`any`)
+
test_garbagecollect_now() *test_garbagecollect_now()*
Like |garbagecollect()|, but executed right away. This must
only be called directly to avoid any structure to exist
internally, and |v:testing| must have been set before calling
- any function.
+ any function. *E1142*
+
+ Return: ~
+ (`any`)
timer_info([{id}]) *timer_info()*
Return a list with information about timers.
@@ -8480,6 +11197,12 @@ timer_info([{id}]) *timer_info()*
-1 means forever
"callback" the callback
+ Parameters: ~
+ • {id} (`integer?`)
+
+ Return: ~
+ (`any`)
+
timer_pause({timer}, {paused}) *timer_pause()*
Pause or unpause a timer. A paused timer does not invoke its
callback when its time expires. Unpausing a timer may cause
@@ -8493,6 +11216,13 @@ timer_pause({timer}, {paused}) *timer_pause()*
String, then the timer is paused, otherwise it is unpaused.
See |non-zero-arg|.
+ Parameters: ~
+ • {timer} (`integer`)
+ • {paused} (`boolean`)
+
+ Return: ~
+ (`any`)
+
timer_start({time}, {callback} [, {options}]) *timer_start()* *timer*
Create a timer and return the timer ID.
@@ -8523,26 +11253,55 @@ timer_start({time}, {callback} [, {options}]) *timer_start()* *time
\ {'repeat': 3})
< This invokes MyHandler() three times at 500 msec intervals.
+ Parameters: ~
+ • {time} (`number`)
+ • {callback} (`string|function`)
+ • {options} (`table?`)
+
+ Return: ~
+ (`any`)
+
timer_stop({timer}) *timer_stop()*
Stop a timer. The timer callback will no longer be invoked.
{timer} is an ID returned by timer_start(), thus it must be a
Number. If {timer} does not exist there is no error.
+ Parameters: ~
+ • {timer} (`integer`)
+
+ Return: ~
+ (`any`)
+
timer_stopall() *timer_stopall()*
Stop all timers. The timer callbacks will no longer be
invoked. Useful if some timers is misbehaving. If there are
no timers there is no error.
+ Return: ~
+ (`any`)
+
tolower({expr}) *tolower()*
The result is a copy of the String given, with all uppercase
characters turned into lowercase (just like applying |gu| to
the string). Returns an empty string on error.
+ Parameters: ~
+ • {expr} (`string`)
+
+ Return: ~
+ (`string`)
+
toupper({expr}) *toupper()*
The result is a copy of the String given, with all lowercase
characters turned into uppercase (just like applying |gU| to
the string). Returns an empty string on error.
+ Parameters: ~
+ • {expr} (`string`)
+
+ Return: ~
+ (`string`)
+
tr({src}, {fromstr}, {tostr}) *tr()*
The result is a copy of the {src} string with all characters
which appear in {fromstr} replaced by the character in that
@@ -8559,6 +11318,14 @@ tr({src}, {fromstr}, {tostr}) *tr()*
echo tr("<blob>", "<>", "{}")
< returns "{blob}"
+ Parameters: ~
+ • {src} (`string`)
+ • {fromstr} (`string`)
+ • {tostr} (`string`)
+
+ Return: ~
+ (`string`)
+
trim({text} [, {mask} [, {dir}]]) *trim()*
Return {text} as a String where any character in {mask} is
removed from the beginning and/or end of {text}.
@@ -8587,6 +11354,14 @@ trim({text} [, {mask} [, {dir}]]) *trim()*
echo trim(" vim ", " ", 2)
< returns " vim"
+ Parameters: ~
+ • {text} (`string`)
+ • {mask} (`string?`)
+ • {dir} (`0|1|2?`)
+
+ Return: ~
+ (`string`)
+
trunc({expr}) *trunc()*
Return the largest integral value with magnitude less than or
equal to {expr} as a |Float| (truncate towards zero).
@@ -8600,6 +11375,12 @@ trunc({expr}) *trunc()*
echo trunc(4.0)
< 4.0
+ Parameters: ~
+ • {expr} (`number`)
+
+ Return: ~
+ (`integer`)
+
type({expr}) *type()*
The result is a Number representing the type of {expr}.
Instead of using the number directly, it is better to use the
@@ -8626,6 +11407,13 @@ type({expr}) *type()*
if myvar is v:null | endif
< To check if the v:t_ variables exist use this: >vim
if exists('v:t_number') | endif
+<
+
+ Parameters: ~
+ • {expr} (`any`)
+
+ Return: ~
+ (`integer`)
undofile({name}) *undofile()*
Return the name of the undo file that would be used for a file
@@ -8638,6 +11426,12 @@ undofile({name}) *undofile()*
buffer without a file name will not write an undo file.
Useful in combination with |:wundo| and |:rundo|.
+ Parameters: ~
+ • {name} (`string`)
+
+ Return: ~
+ (`string`)
+
undotree([{buf}]) *undotree()*
Return the current state of the undo tree for the current
buffer, or for a specific buffer if {buf} is given. The
@@ -8682,6 +11476,12 @@ undotree([{buf}]) *undotree()*
blocks. Each item may again have an "alt"
item.
+ Parameters: ~
+ • {buf} (`integer|string?`)
+
+ Return: ~
+ (`vim.fn.undotree.ret`)
+
uniq({list} [, {func} [, {dict}]]) *uniq()* *E882*
Remove second and succeeding copies of repeated adjacent
{list} items in-place. Returns {list}. If you want a list
@@ -8692,6 +11492,14 @@ uniq({list} [, {func} [, {dict}]]) *uniq()* *E88
Returns zero if {list} is not a |List|.
+ Parameters: ~
+ • {list} (`any`)
+ • {func} (`any?`)
+ • {dict} (`any?`)
+
+ Return: ~
+ (`any[]|0`)
+
utf16idx({string}, {idx} [, {countcc} [, {charidx}]]) *utf16idx()*
Same as |charidx()| but returns the UTF-16 code unit index of
the byte at {idx} in {string} (after converting it to UTF-16).
@@ -8720,11 +11528,26 @@ utf16idx({string}, {idx} [, {countcc} [, {charidx}]]) *utf16idx()*
echo utf16idx('a😊😊', 9) " returns -1
<
+ Parameters: ~
+ • {string} (`string`)
+ • {idx} (`integer`)
+ • {countcc} (`boolean?`)
+ • {charidx} (`boolean?`)
+
+ Return: ~
+ (`integer`)
+
values({dict}) *values()*
Return a |List| with all the values of {dict}. The |List| is
in arbitrary order. Also see |items()| and |keys()|.
Returns zero if {dict} is not a |Dict|.
+ Parameters: ~
+ • {dict} (`any`)
+
+ Return: ~
+ (`any`)
+
virtcol({expr} [, {list} [, {winid}]]) *virtcol()*
The result is a Number, which is the screen column of the file
position given with {expr}. That is, the last screen position
@@ -8735,7 +11558,9 @@ virtcol({expr} [, {list} [, {winid}]]) *virtcol()*
set to 8, it returns 8. |conceal| is ignored.
For the byte position use |col()|.
- For the use of {expr} see |col()|.
+ For the use of {expr} see |getpos()| and |col()|.
+ When {expr} is "$", it means the end of the cursor line, so
+ the result is the number of cells in the cursor line plus one.
When 'virtualedit' is used {expr} can be [lnum, col, off],
where "off" is the offset in screen columns from the start of
@@ -8745,18 +11570,6 @@ virtcol({expr} [, {list} [, {winid}]]) *virtcol()*
beyond the end of the line can be returned. Also see
|'virtualedit'|
- The accepted positions are:
- . the cursor position
- $ the end of the cursor line (the result is the
- number of displayed characters in the cursor line
- plus one)
- 'x position of mark x (if the mark is not set, 0 is
- returned)
- v In Visual mode: the start of the Visual area (the
- cursor is the end). When not in Visual mode
- returns the cursor position. Differs from |'<| in
- that it's updated right away.
-
If {list} is present and non-zero then virtcol() returns a
List with the first and last screen position occupied by the
character.
@@ -8775,10 +11588,21 @@ virtcol({expr} [, {list} [, {winid}]]) *virtcol()*
" With text " there", with 't at 'h':
echo virtcol("'t") " returns 6
-< The first column is 1. 0 or [0, 0] is returned for an error.
+<
+ The first column is 1. 0 or [0, 0] is returned for an error.
+
A more advanced example that echoes the maximum length of
all lines: >vim
echo max(map(range(1, line('$')), "virtcol([v:val, '$'])"))
+<
+
+ Parameters: ~
+ • {expr} (`string|integer[]`)
+ • {list} (`boolean?`)
+ • {winid} (`integer?`)
+
+ Return: ~
+ (`any`)
virtcol2col({winid}, {lnum}, {col}) *virtcol2col()*
The result is a Number, which is the byte index of the
@@ -8802,6 +11626,14 @@ virtcol2col({winid}, {lnum}, {col}) *virtcol2col()*
See also |screenpos()|, |virtcol()| and |col()|.
+ Parameters: ~
+ • {winid} (`integer`)
+ • {lnum} (`integer`)
+ • {col} (`integer`)
+
+ Return: ~
+ (`any`)
+
visualmode([{expr}]) *visualmode()*
The result is a String, which describes the last Visual mode
used in the current buffer. Initially it returns an empty
@@ -8820,6 +11652,12 @@ visualmode([{expr}]) *visualmode()*
a non-empty String, then the Visual mode will be cleared and
the old value is returned. See |non-zero-arg|.
+ Parameters: ~
+ • {expr} (`boolean?`)
+
+ Return: ~
+ (`any`)
+
wait({timeout}, {condition} [, {interval}]) *wait()*
Waits until {condition} evaluates to |TRUE|, where {condition}
is a |Funcref| or |string| containing an expression.
@@ -8836,6 +11674,14 @@ wait({timeout}, {condition} [, {interval}]) *wait()*
-2 if the function was interrupted (by |CTRL-C|)
-3 if an error occurred
+ Parameters: ~
+ • {timeout} (`integer`)
+ • {condition} (`any`)
+ • {interval} (`number?`)
+
+ Return: ~
+ (`any`)
+
wildmenumode() *wildmenumode()*
Returns |TRUE| when the wildmenu is active and |FALSE|
otherwise. See 'wildmenu' and 'wildmode'.
@@ -8847,6 +11693,9 @@ wildmenumode() *wildmenumode()*
<
(Note, this needs the 'wildcharm' option set appropriately).
+ Return: ~
+ (`any`)
+
win_execute({id}, {command} [, {silent}]) *win_execute()*
Like `execute()` but in the context of window {id}.
The window will temporarily be made the current window,
@@ -8861,10 +11710,24 @@ win_execute({id}, {command} [, {silent}]) *win_execute()*
When window {id} does not exist then no error is given and
an empty string is returned.
+ Parameters: ~
+ • {id} (`integer`)
+ • {command} (`string`)
+ • {silent} (`boolean?`)
+
+ Return: ~
+ (`any`)
+
win_findbuf({bufnr}) *win_findbuf()*
Returns a |List| with |window-ID|s for windows that contain
buffer {bufnr}. When there is none the list is empty.
+ Parameters: ~
+ • {bufnr} (`integer`)
+
+ Return: ~
+ (`integer[]`)
+
win_getid([{win} [, {tab}]]) *win_getid()*
Get the |window-ID| for the specified window.
When {win} is missing use the current window.
@@ -8874,6 +11737,13 @@ win_getid([{win} [, {tab}]]) *win_getid()*
number {tab}. The first tab has number one.
Return zero if the window cannot be found.
+ Parameters: ~
+ • {win} (`integer?`)
+ • {tab} (`integer?`)
+
+ Return: ~
+ (`integer`)
+
win_gettype([{nr}]) *win_gettype()*
Return the type of the window:
"autocmd" autocommand window. Temporary window
@@ -8892,20 +11762,44 @@ win_gettype([{nr}]) *win_gettype()*
Also see the 'buftype' option.
+ Parameters: ~
+ • {nr} (`integer?`)
+
+ Return: ~
+ (`'autocmd'|'command'|''|'loclist'|'popup'|'preview'|'quickfix'|'unknown'`)
+
win_gotoid({expr}) *win_gotoid()*
Go to window with ID {expr}. This may also change the current
tabpage.
Return TRUE if successful, FALSE if the window cannot be found.
+ Parameters: ~
+ • {expr} (`integer`)
+
+ Return: ~
+ (`0|1`)
+
win_id2tabwin({expr}) *win_id2tabwin()*
Return a list with the tab number and window number of window
with ID {expr}: [tabnr, winnr].
Return [0, 0] if the window cannot be found.
+ Parameters: ~
+ • {expr} (`integer`)
+
+ Return: ~
+ (`any`)
+
win_id2win({expr}) *win_id2win()*
Return the window number of window with ID {expr}.
Return 0 if the window cannot be found in the current tabpage.
+ Parameters: ~
+ • {expr} (`integer`)
+
+ Return: ~
+ (`any`)
+
win_move_separator({nr}, {offset}) *win_move_separator()*
Move window {nr}'s vertical separator (i.e., the right border)
by {offset} columns, as if being dragged by the mouse. {nr}
@@ -8921,6 +11815,13 @@ win_move_separator({nr}, {offset}) *win_move_separator()*
window, since it has no separator on the right.
Only works for the current tab page. *E1308*
+ Parameters: ~
+ • {nr} (`integer`)
+ • {offset} (`integer`)
+
+ Return: ~
+ (`any`)
+
win_move_statusline({nr}, {offset}) *win_move_statusline()*
Move window {nr}'s status line (i.e., the bottom border) by
{offset} rows, as if being dragged by the mouse. {nr} can be a
@@ -8933,6 +11834,13 @@ win_move_statusline({nr}, {offset}) *win_move_statusline()*
be found and FALSE otherwise.
Only works for the current tab page.
+ Parameters: ~
+ • {nr} (`integer`)
+ • {offset} (`integer`)
+
+ Return: ~
+ (`any`)
+
win_screenpos({nr}) *win_screenpos()*
Return the screen position of window {nr} as a list with two
numbers: [row, col]. The first window always has position
@@ -8941,6 +11849,12 @@ win_screenpos({nr}) *win_screenpos()*
for the current window.
Returns [0, 0] if the window cannot be found.
+ Parameters: ~
+ • {nr} (`integer`)
+
+ Return: ~
+ (`any`)
+
win_splitmove({nr}, {target} [, {options}]) *win_splitmove()*
Temporarily switch to window {target}, then move window {nr}
to a new split adjacent to {target}.
@@ -8961,6 +11875,14 @@ win_splitmove({nr}, {target} [, {options}]) *win_splitmove()*
present, the values of 'splitbelow' and
'splitright' are used.
+ Parameters: ~
+ • {nr} (`integer`)
+ • {target} (`integer`)
+ • {options} (`table?`)
+
+ Return: ~
+ (`any`)
+
winbufnr({nr}) *winbufnr()*
The result is a Number, which is the number of the buffer
associated with window {nr}. {nr} can be the window number or
@@ -8972,17 +11894,29 @@ winbufnr({nr}) *winbufnr()*
echo "The file in the current window is " .. bufname(winbufnr(0))
<
+ Parameters: ~
+ • {nr} (`integer`)
+
+ Return: ~
+ (`integer`)
+
wincol() *wincol()*
The result is a Number, which is the virtual column of the
cursor in the window. This is counting screen cells from the
left side of the window. The leftmost column is one.
+ Return: ~
+ (`integer`)
+
windowsversion() *windowsversion()*
The result is a String. For MS-Windows it indicates the OS
version. E.g, Windows 10 is "10.0", Windows 8 is "6.2",
Windows XP is "5.1". For non-MS-Windows systems the result is
an empty string.
+ Return: ~
+ (`string`)
+
winheight({nr}) *winheight()*
The result is a Number, which is the height of window {nr}.
{nr} can be the window number or the |window-ID|.
@@ -8992,6 +11926,13 @@ winheight({nr}) *winheight()*
This excludes any window toolbar line.
Examples: >vim
echo "The current window has " .. winheight(0) .. " lines."
+<
+
+ Parameters: ~
+ • {nr} (`integer`)
+
+ Return: ~
+ (`integer`)
winlayout([{tabnr}]) *winlayout()*
The result is a nested List containing the layout of windows
@@ -9030,6 +11971,12 @@ winlayout([{tabnr}]) *winlayout()*
['leaf', 1001]]], ['leaf', 1000]]]
<
+ Parameters: ~
+ • {tabnr} (`integer?`)
+
+ Return: ~
+ (`any`)
+
winline() *winline()*
The result is a Number, which is the screen line of the cursor
in the window. This is counting screen lines from the top of
@@ -9037,6 +11984,9 @@ winline() *winline()*
If the cursor was moved the view on the file will be updated
first, this may cause a scroll.
+ Return: ~
+ (`integer`)
+
winnr([{arg}]) *winnr()*
The result is a Number, which is the number of the current
window. The top window has number 1.
@@ -9067,6 +12017,13 @@ winnr([{arg}]) *winnr()*
let window_count = winnr('$')
let prev_window = winnr('#')
let wnum = winnr('3k')
+<
+
+ Parameters: ~
+ • {arg} (`string|integer?`)
+
+ Return: ~
+ (`any`)
winrestcmd() *winrestcmd()*
Returns a sequence of |:resize| commands that should restore
@@ -9079,6 +12036,9 @@ winrestcmd() *winrestcmd()*
exe cmd
<
+ Return: ~
+ (`any`)
+
winrestview({dict}) *winrestview()*
Uses the |Dictionary| returned by |winsaveview()| to restore
the view of the current window.
@@ -9095,6 +12055,12 @@ winrestview({dict}) *winrestview()*
If you have changed the values the result is unpredictable.
If the window size changed the result won't be the same.
+ Parameters: ~
+ • {dict} (`vim.fn.winrestview.dict`)
+
+ Return: ~
+ (`any`)
+
winsaveview() *winsaveview()*
Returns a |Dictionary| that contains information to restore
the view of the current window. Use |winrestview()| to
@@ -9122,6 +12088,9 @@ winsaveview() *winsaveview()*
skipcol columns skipped
Note that no option values are saved.
+ Return: ~
+ (`vim.fn.winsaveview.ret`)
+
winwidth({nr}) *winwidth()*
The result is a Number, which is the width of window {nr}.
{nr} can be the window number or the |window-ID|.
@@ -9136,6 +12105,12 @@ winwidth({nr}) *winwidth()*
< For getting the terminal or screen size, see the 'columns'
option.
+ Parameters: ~
+ • {nr} (`integer`)
+
+ Return: ~
+ (`any`)
+
wordcount() *wordcount()*
The result is a dictionary of byte/chars/word statistics for
the current buffer. This is the same info as provided by
@@ -9157,6 +12132,9 @@ wordcount() *wordcount()*
visual_words Number of words visually selected
(only in Visual mode)
+ Return: ~
+ (`any`)
+
writefile({object}, {fname} [, {flags}]) *writefile()*
When {object} is a |List| write it to file {fname}. Each list
item is separated with a NL. Each list item must be a String
@@ -9202,6 +12180,15 @@ writefile({object}, {fname} [, {flags}]) *writefile()*
To copy a file byte for byte: >vim
let fl = readfile("foo", "b")
call writefile(fl, "foocopy", "b")
+<
+
+ Parameters: ~
+ • {object} (`any`)
+ • {fname} (`string`)
+ • {flags} (`string?`)
+
+ Return: ~
+ (`any`)
xor({expr}, {expr}) *xor()*
Bitwise XOR on the two arguments. The arguments are converted
@@ -9211,6 +12198,13 @@ xor({expr}, {expr}) *xor()*
let bits = xor(bits, 0x80)
<
+ Parameters: ~
+ • {expr} (`number`)
+ • {expr1} (`number`)
+
+ Return: ~
+ (`any`)
+
==============================================================================
2. Matching a pattern in a String *string-match*
diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt
index 9ff16165d7..928b834600 100644
--- a/runtime/doc/change.txt
+++ b/runtime/doc/change.txt
@@ -1227,13 +1227,13 @@ Vim fills these registers with text from yank and delete commands.
Numbered register 0 contains the text from the most recent yank command,
unless the command specified another register with ["x].
Numbered register 1 contains the text deleted by the most recent delete or
-change command, unless the command specified another register or the text is
-less than one line (the small delete register is used then). An exception is
-made for the delete operator with these movement commands: |%|, |(|, |)|, |`|,
-|/|, |?|, |n|, |N|, |{| and |}|. Register "1 is always used then (this is Vi
-compatible). The "- register is used as well if the delete is within a line.
-Note that these characters may be mapped. E.g. |%| is mapped by the matchit
-plugin.
+change command (even when the command specified another register), unless the
+text is less than one line (the small delete register is used then). An
+exception is made for the delete operator with these movement commands: |%|,
+|(|, |)|, |`|, |/|, |?|, |n|, |N|, |{| and |}|.
+Register "1 is always used then (this is Vi compatible). The "- register is
+used as well if the delete is within a line. Note that these characters may be
+mapped. E.g. |%| is mapped by the matchit plugin.
With each successive deletion or change, Vim shifts the previous contents
of register 1 into register 2, 2 into 3, and so forth, losing the previous
contents of register 9.
diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt
index f306067a9c..7967e2ce1a 100644
--- a/runtime/doc/cmdline.txt
+++ b/runtime/doc/cmdline.txt
@@ -348,7 +348,8 @@ terminals)
:keepp[atterns] {command} *:keepp* *:keeppatterns*
Execute {command}, without adding anything to the search
- history
+ history and, in case of |:s| or |:&|, without modifying the
+ last substitute pattern or substitute string.
==============================================================================
2. Command-line completion *cmdline-completion*
@@ -448,13 +449,13 @@ The 'wildignorecase' option can be set to ignore case in filenames. For
completing other texts (e.g. command names), the 'ignorecase' option is used
instead (fuzzy matching always ignores case, however).
-If you like tcsh's autolist completion, you can use this mapping:
+If you like tcsh's autolist completion, you can use this mapping: >
:cnoremap X <C-L><C-D>
(Where X is the command key to use, <C-L> is CTRL-L and <C-D> is CTRL-D)
This will find the longest match and then list all matching files.
If you like tcsh's autolist completion, you can use the 'wildmode' option to
-emulate it. For example, this mimics autolist=ambiguous:
+emulate it. For example, this mimics autolist=ambiguous: >
:set wildmode=longest,list
This will find the longest match with the first 'wildchar', then list all
matching files with the next.
diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt
index 646ba72bd8..72d2faca02 100644
--- a/runtime/doc/deprecated.txt
+++ b/runtime/doc/deprecated.txt
@@ -19,6 +19,22 @@ API
- nvim_subscribe() Plugins must maintain their own "multicast" channels list.
- nvim_unsubscribe() Plugins must maintain their own "multicast" channels list.
+LUA
+- vim.region() Use |getregionpos()| instead.
+
+DIAGNOSTICS
+- *vim.diagnostic.goto_next()* Use |vim.diagnostic.jump()| with `{count=1, float=true}` instead.
+- *vim.diagnostic.goto_prev()* Use |vim.diagnostic.jump()| with `{count=-1, float=true}` instead.
+- *vim.diagnostic.get_next_pos()*
+ Use the "lnum" and "col" fields from the return value of
+ |vim.diagnostic.get_next()| instead.
+- *vim.diagnostic.get_prev_pos()*
+ Use the "lnum" and "col" fields from the return value of
+ |vim.diagnostic.get_prev()| instead.
+- The "win_id" parameter used by various functions is deprecated in favor of
+ "winid" |winid|
+- The "cursor_position" parameter of |vim.diagnostic.JumpOpts| is renamed to
+ "pos"
------------------------------------------------------------------------------
DEPRECATED IN 0.10 *deprecated-0.10*
@@ -157,6 +173,7 @@ FUNCTIONS
- *jobclose()* Obsolete name for |chanclose()|
- *jobsend()* Obsolete name for |chansend()|
- *last_buffer_nr()* Obsolete name for bufnr("$").
+- *rpcstart()* Use |jobstart()| with `{'rpc': v:true}` instead.
- *rpcstop()* Use |jobstop()| instead to stop any job, or
`chanclose(id, "rpc")` to close RPC communication
without stopping the job. Use chanclose(id) to close
@@ -202,9 +219,6 @@ 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
diff --git a/runtime/doc/dev_arch.txt b/runtime/doc/dev_arch.txt
new file mode 100644
index 0000000000..1cb3b9ad67
--- /dev/null
+++ b/runtime/doc/dev_arch.txt
@@ -0,0 +1,59 @@
+*dev_arch.txt* Nvim
+
+
+ NVIM REFERENCE MANUAL
+
+
+How to develop Nvim, explanation of modules and subsystems *dev-arch*
+
+The top of each major module has (or should have) an overview in a comment at
+the top of its file. The purpose of this document is to give:
+
+1. an overview of how it all fits together
+2. how-to guides for common tasks such as:
+ - deprecating public functions
+ - adding a new public (API) function
+ - adding a new public (UI) event
+3. TODO: move src/nvim/README.md into this doc.
+
+ Type |gO| to see the table of contents.
+
+==============================================================================
+Data structures
+
+Use `kvec.h` for most lists. When you absolutely need a linked list, use
+`lib/queue_defs.h` which defines an "intrusive" linked list.
+
+==============================================================================
+UI events
+
+The source files most directly involved with UI events are:
+1. `src/nvim/ui.*`: calls handler functions of registered UI structs (independent from msgpack-rpc)
+2. `src/nvim/api/ui.*`: forwards messages over msgpack-rpc to remote UIs.
+
+UI events are defined in `src/nvim/api/ui_events.in.h` , this file is not
+compiled directly, rather it parsed by
+`src/nvim/generators/gen_api_ui_events.lua` which autogenerates wrapper
+functions used by the source files above. It also generates metadata
+accessible as `api_info().ui_events`.
+
+See commit d3a8e9217f39c59dd7762bd22a76b8bd03ca85ff for an example of adding
+a new UI event.
+
+UI events are deferred to UIs, which implies a deepcopy of the UI event data.
+
+Remember to bump NVIM_API_LEVEL if it wasn't already during this development
+cycle.
+
+Other references:
+* |msgpack-rpc|
+* |ui|
+* https://github.com/neovim/neovim/pull/3246
+* https://github.com/neovim/neovim/pull/18375
+* https://github.com/neovim/neovim/pull/21605
+
+
+
+==============================================================================
+
+vim:tw=78:ts=8:sw=4:et:ft=help:norl:
diff --git a/runtime/doc/dev_style.txt b/runtime/doc/dev_style.txt
index 6c805963a9..32f7279704 100644
--- a/runtime/doc/dev_style.txt
+++ b/runtime/doc/dev_style.txt
@@ -95,9 +95,9 @@ variable is and what it was initialized to. In particular, initialization
should be used instead of declaration and assignment, e.g. >c
int i;
- i = f(); // BAD: initialization separate from declaration.
+ i = f(); // âŒ: initialization separate from declaration.
- int j = g(); // GOOD: declaration has initialization.
+ int j = g(); // ✅: declaration has initialization.
Initialization ~
@@ -107,16 +107,13 @@ 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 j; // ✅
+ int i, j; // ✅: 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 j = 0; // ✅: one initialization per line.
- int i = 0, j = 0; // BAD: multiple declarations with initialization.
+ int i = 0, j; // âŒ: multiple declarations with initialization.
+ int i = 0, j = 0; // âŒ: multiple declarations with initialization.
==============================================================================
Nvim-Specific Magic
@@ -152,10 +149,10 @@ Postincrement and Postdecrement ~
Use postfix form (`i++`) in statements. >c
for (int i = 0; i < 3; i++) { }
- int j = ++i; // OK: ++i is used as an expression.
+ int j = ++i; // ✅: ++i is used as an expression.
for (int i = 0; i < 3; ++i) { }
- ++i; // BAD: ++i is used as a statement.
+ ++i; // âŒ: ++i is used as a statement.
Use of const ~
@@ -217,7 +214,7 @@ Booleans ~
Use `bool` to represent boolean values. >c
- int loaded = 1; // BAD: loaded should have type bool.
+ int loaded = 1; // âŒ: loaded should have type bool.
Conditions ~
@@ -382,7 +379,7 @@ Filenames should be all lowercase and can include underscores (`_`).
Use underscores to separate words. Examples of acceptable file names: >
my_useful_file.c
- getline_fix.c // OK: getline refers to the glibc function.
+ getline_fix.c // ✅: getline refers to the glibc function.
C files should end in `.c` and header files should end in `.h`.
@@ -415,10 +412,10 @@ instance: `my_exciting_local_variable`.
For example: >c
- string table_name; // OK: uses underscore.
- string tablename; // OK: all lowercase.
+ string table_name; // ✅: uses underscore.
+ string tablename; // ✅: all lowercase.
- string tableName; // BAD: mixed case.
+ string tableName; // âŒ: mixed case.
<
Struct Variables ~
diff --git a/runtime/doc/dev_tools.txt b/runtime/doc/dev_tools.txt
index 52513db31d..efc6ce277a 100644
--- a/runtime/doc/dev_tools.txt
+++ b/runtime/doc/dev_tools.txt
@@ -7,7 +7,9 @@
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.
+itself.
+
+TODO: merge |debug.txt| into here.
Type |gO| to see the table of contents.
diff --git a/runtime/doc/dev_vimpatch.txt b/runtime/doc/dev_vimpatch.txt
index d6e4ced054..5119613b55 100644
--- a/runtime/doc/dev_vimpatch.txt
+++ b/runtime/doc/dev_vimpatch.txt
@@ -139,7 +139,6 @@ TYPES OF "NOT APPLICABLE" VIM PATCHES ~
- 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
@@ -204,6 +203,8 @@ information.
mb_ptr2char utf_ptr2char
mb_head_off utf_head_off
mb_tail_off utf_cp_bounds
+ mb_strnicmp2 utf_strnicmp
+ MB_STRNICMP2 utf_strnicmp
mb_lefthalve grid_lefthalve
mb_fix_col grid_fix_col
utf_off2cells grid_off2cells
@@ -302,4 +303,58 @@ 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)
+==============================================================================
+FILETYPE DETECTION *dev-vimpatch-filetype*
+
+Nvim's filetype detection behavior matches Vim, but is implemented as part of
+|vim.filetype| (see `$VIMRUNTIME/lua/vim/filetype.lua`). The logic is encoded in
+three tables, listed in order of precedence (the first match is returned):
+1. `filename` for literal full path or basename lookup;
+2. `pattern` for matching filenames or paths against |lua-patterns|, optimized
+ for fast lookup;
+3. `extension` for literal extension lookup.
+
+Logic that requires checking file contents or buffer variables is implemented
+in `$VIMRUNTIME/lua/vim/filetype/detect.lua`.
+
+When porting filetype patches from Vim, keep the following in mind:
+
+Prefer explicit filenames or extensions over patterns, especially for case
+insensitive matches (see https://github.com/neovim/neovim/pull/29800): >
+ "*[mM]akefile" regex -> "makefile", "Makefile" filenames
+ "*.js\c" regex -> "js", "jS", "Js", "jS" extensions
+
+Pattern matching has several differences:
+- It is done using explicit Lua patterns without implicit anchoring instead
+ of Vim regexes: >
+ "*/debian/changelog" -> "/debian/changelog$"
+ "*/bind/db.*" -> "/bind/db%."
+<
+- Filetype patterns are grouped by their parent pattern to improve matching
+ performance: If the parent pattern does not match, skip testing all child
+ patterns. Note that unlike leaf patterns, parent patterns do not have
+ special matching behaviour if they contain a `/`.
+
+ When adding a new filetype with pattern matching, consider the following:
+ - If there is already a group with appropriate parent pattern, use it.
+ - If there can be a fast and specific enough pattern to group at least 3
+ filetype patterns, add it as a separate grouped entry.
+
+ New parent patterns should be
+ - fast: rule of thumb is that it should be a short explicit string
+ (i.e. no quantifiers or character sets);
+ - specific: rules of thumb, in order:
+ - full directory name (e.g., `"/etc/"`, `"/log/"`);
+ - part of a rare enough directory name (e.g., `"/conf"`, `"git/"`);
+ - string rarely used in real full paths (e.g., `"nginx"`).
+
+ Example:
+ - Filetype pattern: `".*/etc/a2ps/.*%.cfg"`
+ - Good parents: `"/etc/"` or `"%.cfg$"`
+ - Bad parents: `"%."` (fast but not specific) or `"/a2ps/.*%."` (specific
+ but slow)
+
+ When modifying an existing regular pattern, make sure that it still fits its
+ group.
+
vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt
index d7837dc2fe..a61c569a67 100644
--- a/runtime/doc/develop.txt
+++ b/runtime/doc/develop.txt
@@ -7,8 +7,8 @@
Development of Nvim *development* *dev*
This reference describes design constraints and guidelines, for developing
-Nvim applications or Nvim itself.
-Architecture and internal concepts are covered in src/nvim/README.md
+Nvim applications or Nvim itself. See |dev-arch| for discussion of Nvim's
+architecture and internal concepts.
Nvim is free and open source. Everybody is encouraged to contribute.
https://github.com/neovim/neovim/blob/master/CONTRIBUTING.md
@@ -138,15 +138,15 @@ DOCUMENTATION *dev-doc*
- Write docstrings (as opposed to inline comments) with present tense ("Gets"),
not imperative ("Get"). This tends to reduce ambiguity and improve clarity
by describing "What" instead of "How". >
- GOOD:
+ ✅ OK:
/// Gets a highlight definition.
- BAD:
+ ⌠NO:
/// Get a highlight definition.
- Avoid starting docstrings with "The" or "A" unless needed to avoid
ambiguity. This is a visual aid and reduces noise. >
- GOOD:
+ ✅ OK:
/// @param dirname Path fragment before `pend`
- BAD:
+ ⌠NO:
/// @param dirname The path fragment before `pend`
- Vim differences:
- Do not prefix help tags with "nvim-". Use |vim_diff.txt| to catalog
@@ -247,6 +247,10 @@ Docstring format:
- References are written as `[tag]`
- Use ``` for code samples.
Code samples can be annotated as `vim` or `lua`
+- Use `@since <api-level>` to note the |api-level| when the function became
+ "stable". If `<api-level>` is greater than the current stable release (or
+ 0), it is marked as "experimental".
+ - See scripts/util.lua for the mapping of api-level to Nvim version.
- Use `@nodoc` to prevent documentation generation.
- Use `@inlinedoc` to inline `@class` blocks into `@param` blocks.
E.g. >lua
@@ -271,7 +275,7 @@ Docstring format:
- {somefield}? (integer) Documentation
for some field
<
-- Files which has `@meta` are only used for typing and documentation.
+- Files declared as `@meta` are only used for typing and documentation (similar to "*.d.ts" typescript files).
Example: the help for |vim.paste()| is generated from a docstring decorating
vim.paste in runtime/lua/vim/_editor.lua like this: >
@@ -288,6 +292,7 @@ vim.paste in runtime/lua/vim/_editor.lua like this: >
--- end)()
--- ```
---
+ --- @since 12
--- @see |paste|
---
--- @param lines ...
@@ -307,19 +312,36 @@ See also |dev-naming|.
easier to inspect and print, and inherently compatible with all Lua plugins.
(This guideline doesn't apply to opaque, non-data objects like `vim.cmd`.)
- stdlib functions should follow these common patterns:
- - accept iterable instead of table
- - exception: in some cases iterable doesn't make sense, e.g. spair() sorts
- the input by definition, so there is no reason for it to accept an
- iterable, because the input needs to be "reified"; it can't operate on
- a "stream".
- - return iterable instead of table
- - mimic the pairs() or ipairs() interface if the function is intended to be
- used in a "for" loop.
- - when a result-or-error interface is needed, return `result|nil, nil|errmsg`: >
- ---@return Foo|nil # Result object, or nil if not found.
- ---@return nil|string # Error message on failure, or nil on success.
-<
- - Examples: |vim.ui.open()| |io.open()| |luv-error-handling|
+ - Return |lua-result-or-message| (`any|nil,nil|string`) to communicate
+ failure, or choose from |dev-error-patterns| when appropriate.
+ - Accept iterable instead of only table.
+ - Note: in some cases iterable doesn't make sense, e.g. spair() sorts the
+ input by definition, so there is no reason for it to accept an iterable,
+ because the input needs to be "reified"; it can't operate on a "stream".
+ - Return an iterable (generator) instead of table, if possible.
+ - Mimic the pairs() or ipairs() interface if the function is intended for
+ use in a |for-in| loop.
+
+ *dev-error-patterns*
+To communicate failure to a consumer, choose from these patterns (in order of
+preference):
+1. `retval, errmsg`
+ - When failure is normal, or when it is practical for the consumer to
+ continue (fallback) in some other way. See |lua-result-or-message|.
+2. optional result, no errormsg
+ - Special case of 1. When there is only a single case of "doesn't exist"
+ (e.g. cache lookup, dict lookup).
+3. `error("no luck")`
+ - For invalid state ("must not happen"), when failure is exceptional, or at
+ a low level where the consumers are unlikely to handle it in a meaningful
+ way. Advantage is that propagation happens for free and it's harder to
+ accidentally swallow errors. (E.g. using
+ `uv_handle/pipe:write()` without checking return values is common.)
+4. `on_error` parameter
+ - For async and "visitors" traversing a graph, where many errors may be
+ collected while work continues.
+5. `vim.notify` (sometimes with optional `opts.silent` (async, visitors ^))
+ - High-level / application-level messages. End-user invokes these directly.
*dev-patterns*
Interface conventions ~
@@ -329,13 +351,20 @@ Where possible, these patterns apply to _both_ Lua and the API:
- When accepting a buffer id, etc., 0 means "current buffer", nil means "all
buffers". Likewise for window id, tabpage id, etc.
- Examples: |vim.lsp.codelens.clear()| |vim.diagnostic.enable()|
-- Any function signature that accepts a callback function should define the
- callback as the LAST parameter, if possible. This improves readability of
- calls by placing the less "noisy" arguments near the start. >
- GOOD:
- filter(table, opts, function() … end)
- BAD:
- filter(function() … end, table, opts)
+- Any function signature that accepts a callback (example: |table.foreach()|)
+ should place it as the LAST parameter (after opts), if possible (or ALWAYS
+ for "continuation callbacks"—functions called exactly once).
+ - Improves readability by placing the less "noisy" arguments near the start.
+ - Consistent with luv.
+ - Useful for future async lib which transforms functions of the form
+ `function(<args>, cb(<ret)>))` => `function(<args>) -> <ret>`.
+ - Example: >lua
+ -- ✅ OK:
+ filter(…, opts, function() … end)
+ -- ⌠NO:
+ filter(function() … end, …, opts)
+ -- ⌠NO:
+ filter(…, function() … end, opts)
- "Enable" ("toggle") interface and behavior:
- `enable(…, nil)` and `enable(…, {buf=nil})` are synonyms and control the
the "global" enablement of a feature.
@@ -566,10 +595,10 @@ a good name: it's idiomatic and unambiguous. If the package is named "neovim",
it confuses users, and complicates documentation and discussions.
Examples of API-client package names:
-- GOOD: nvim-racket
-- GOOD: pynvim
-- BAD: python-client
-- BAD: neovim_
+- ✅ OK: nvim-racket
+- ✅ OK: pynvim
+- ⌠NO: python-client
+- ⌠NO: neovim_
API client implementation guidelines ~
diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt
index 36616b9a0d..342947595e 100644
--- a/runtime/doc/diagnostic.txt
+++ b/runtime/doc/diagnostic.txt
@@ -363,7 +363,6 @@ Lua module: vim.diagnostic *diagnostic-api*
• {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`)
@@ -378,28 +377,38 @@ Lua module: vim.diagnostic *diagnostic-api*
• {severity}? (`vim.diagnostic.SeverityFilter`) See
|diagnostic-severity|.
-*vim.diagnostic.GotoOpts*
+*vim.diagnostic.JumpOpts*
Extends: |vim.diagnostic.GetOpts|
- Configuration table with the following keys:
+ Configuration table with the keys listed below. Some parameters can have
+ their default values changed with |vim.diagnostic.config()|.
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.SeverityFilter`) 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
+ • {diagnostic}? (`vim.Diagnostic`) The diagnostic to jump to. Mutually
+ exclusive with {count}, {namespace}, and {severity}.
+ See |vim.Diagnostic|.
+ • {count}? (`integer`) The number of diagnostics to move by,
+ starting from {pos}. A positive integer moves forward
+ by {count} diagnostics, while a negative integer moves
+ backward by {count} diagnostics. Mutually exclusive
+ with {diagnostic}.
+ • {pos}? (`[integer,integer]`) Cursor position as a `(row, col)`
+ tuple. See |nvim_win_get_cursor()|. Used to find the
+ nearest diagnostic when {count} is used. Only used when
+ {count} is non-nil. Default is the current cursor
+ position.
+ • {wrap}? (`boolean`, default: `true`) Whether to loop around
+ file or not. Similar to 'wrapscan'.
+ • {severity}? (`vim.diagnostic.SeverityFilter`) See
+ |diagnostic-severity|.
+ • {float}? (`boolean|vim.diagnostic.Opts.Float`, default: `false`)
+ 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).
+ • {winid}? (`integer`, default: `0`) Window ID
*vim.diagnostic.NS*
@@ -410,7 +419,7 @@ Lua module: vim.diagnostic *diagnostic-api*
• {disabled}? (`boolean`)
*vim.diagnostic.Opts*
- Each of the configuration options below accepts one of the following:
+ Many of the configuration options below accept 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
@@ -441,6 +450,9 @@ Lua module: vim.diagnostic *diagnostic-api*
displayed before lower severities (e.g. ERROR is
displayed before WARN). Options:
• {reverse}? (boolean) Reverse sort order
+ • {jump}? (`vim.diagnostic.Opts.Jump`) Default values for
+ |vim.diagnostic.jump()|. See
+ |vim.diagnostic.Opts.Jump|.
*vim.diagnostic.Opts.Float*
@@ -454,18 +466,18 @@ Lua module: vim.diagnostic *diagnostic-api*
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.
+ • {pos}? (`integer|[integer,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
+ • {header}? (`string|[string,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
@@ -500,6 +512,17 @@ Lua module: vim.diagnostic *diagnostic-api*
• {focus_id}? (`string`)
• {border}? (`string`) see |nvim_open_win()|.
+*vim.diagnostic.Opts.Jump*
+
+ Fields: ~
+ • {float}? (`boolean|vim.diagnostic.Opts.Float`, default: false)
+ Default value of the {float} parameter of
+ |vim.diagnostic.jump()|.
+ • {wrap}? (`boolean`, default: true) Default value of the {wrap}
+ parameter of |vim.diagnostic.jump()|.
+ • {severity}? (`vim.diagnostic.SeverityFilter`) Default value of the
+ {severity} parameter of |vim.diagnostic.jump()|.
+
*vim.diagnostic.Opts.Signs*
Fields: ~
@@ -568,8 +591,7 @@ Lua module: vim.diagnostic *diagnostic-api*
<
• {hl_mode}? (`'replace'|'combine'|'blend'`) See
|nvim_buf_set_extmark()|.
- • {virt_text}? (`{[1]:string,[2]:any}[]`) See
- |nvim_buf_set_extmark()|.
+ • {virt_text}? (`[string,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()|.
@@ -678,52 +700,20 @@ get_next({opts}) *vim.diagnostic.get_next()*
Get the next diagnostic closest to the cursor position.
Parameters: ~
- • {opts} (`vim.diagnostic.GotoOpts?`) See |vim.diagnostic.GotoOpts|.
+ • {opts} (`vim.diagnostic.JumpOpts?`) See |vim.diagnostic.JumpOpts|.
Return: ~
(`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} (`vim.diagnostic.GotoOpts?`) See |vim.diagnostic.GotoOpts|.
-
- Return: ~
- (`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} (`vim.diagnostic.GotoOpts?`) See |vim.diagnostic.GotoOpts|.
+ • {opts} (`vim.diagnostic.JumpOpts?`) See |vim.diagnostic.JumpOpts|.
Return: ~
(`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} (`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.
-
-goto_next({opts}) *vim.diagnostic.goto_next()*
- Move to the next diagnostic.
-
- Parameters: ~
- • {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} (`vim.diagnostic.GotoOpts?`) See |vim.diagnostic.GotoOpts|.
-
hide({namespace}, {bufnr}) *vim.diagnostic.hide()*
Hide currently displayed diagnostics.
@@ -743,6 +733,9 @@ hide({namespace}, {bufnr}) *vim.diagnostic.hide()*
is_enabled({filter}) *vim.diagnostic.is_enabled()*
Check whether diagnostics are enabled.
+ Attributes: ~
+ Since: 0.10.0
+
Parameters: ~
• {filter} (`table?`) Optional filters |kwargs|, or `nil` for all.
• {ns_id}? (`integer`) Diagnostic namespace, or `nil` for
@@ -753,6 +746,16 @@ is_enabled({filter}) *vim.diagnostic.is_enabled()*
Return: ~
(`boolean`)
+jump({opts}) *vim.diagnostic.jump()*
+ Move to a diagnostic.
+
+ Parameters: ~
+ • {opts} (`vim.diagnostic.JumpOpts`) See |vim.diagnostic.JumpOpts|.
+
+ Return: ~
+ (`vim.Diagnostic?`) The diagnostic that was moved to. See
+ |vim.Diagnostic|.
+
*vim.diagnostic.match()*
match({str}, {pat}, {groups}, {severity_map}, {defaults})
Parse a diagnostic from a string.
@@ -792,7 +795,7 @@ open_float({opts}) *vim.diagnostic.open_float()*
Return (multiple): ~
(`integer?`) float_bufnr
- (`integer?`) win_id
+ (`integer?`) winid
reset({namespace}, {bufnr}) *vim.diagnostic.reset()*
Remove all diagnostics from the given namespace.
@@ -831,7 +834,7 @@ setloclist({opts}) *vim.diagnostic.setloclist()*
after setting.
• {title}? (`string`) Title of the location list. Defaults to
"Diagnostics".
- • {severity}? (`vim.diagnostic.Severity`) See
+ • {severity}? (`vim.diagnostic.SeverityFilter`) See
|diagnostic-severity|.
setqflist({opts}) *vim.diagnostic.setqflist()*
@@ -845,7 +848,7 @@ setqflist({opts}) *vim.diagnostic.setqflist()*
after setting.
• {title}? (`string`) Title of quickfix list. Defaults to
"Diagnostics".
- • {severity}? (`vim.diagnostic.Severity`) See
+ • {severity}? (`vim.diagnostic.SeverityFilter`) See
|diagnostic-severity|.
*vim.diagnostic.show()*
diff --git a/runtime/doc/diff.txt b/runtime/doc/diff.txt
index 2f174a404e..c9de54342e 100644
--- a/runtime/doc/diff.txt
+++ b/runtime/doc/diff.txt
@@ -369,6 +369,9 @@ Additionally, 'diffexpr' should take care of "icase" and "iwhite" in the
'diffopt' option. 'diffexpr' cannot change the value of 'lines' and
'columns'.
+The advantage of using a function call without arguments is that it is faster,
+see |expr-option-function|.
+
Example (this does almost the same as 'diffexpr' being empty): >
set diffexpr=MyDiff()
@@ -434,6 +437,9 @@ will have the same effect. These variables are set to the file names used:
v:fname_diff patch file
v:fname_out resulting patched file
+The advantage of using a function call without arguments is that it is faster,
+see |expr-option-function|.
+
Example (this does the same as 'patchexpr' being empty): >
set patchexpr=MyPatch()
diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt
index 662d89895d..0008713025 100644
--- a/runtime/doc/editing.txt
+++ b/runtime/doc/editing.txt
@@ -646,7 +646,7 @@ list of the current window.
Also see |++opt| and |+cmd|.
:[count]arga[dd] {name} .. *:arga* *:argadd* *E479*
-:[count]arga[dd]
+:[count]arga[dd] *E1156*
Add the {name}s to the argument list. When {name} is
omitted add the current buffer name to the argument
list.
@@ -714,7 +714,7 @@ list of the current window.
omitted the current entry is used.
Also see |++opt| and |+cmd|.
-:[count]n[ext] [++opt] [+cmd] *:n* *:ne* *:next* *E165* *E163*
+:[count]n[ext] [++opt] [+cmd] *:n* *:ne* *:next* *]a* *E165* *E163*
Edit [count] next file. This fails when changes have
been made and Vim does not want to |abandon| the
current buffer. Also see |++opt| and |+cmd|.
@@ -740,10 +740,10 @@ list of the current window.
any changes to the buffer. Also see |++opt| and
|+cmd|.
-:[count]prev[ious] [count] [++opt] [+cmd] *:prev* *:previous*
+:[count]prev[ious] [count] [++opt] [+cmd] *:prev* *:previous* *[a*
Same as :Next. Also see |++opt| and |+cmd|.
- *:rew* *:rewind*
+ *:rew* *:rewind* *[A*
:rew[ind] [++opt] [+cmd]
Start editing the first file in the argument list.
This fails when changes have been made and Vim does
@@ -759,7 +759,7 @@ list of the current window.
:fir[st][!] [++opt] [+cmd]
Other name for ":rewind".
- *:la* *:last*
+ *:la* *:last* *]A*
:la[st] [++opt] [+cmd]
Start editing the last file in the argument list.
This fails when changes have been made and Vim does
@@ -1623,7 +1623,7 @@ There are three different types of searching:
stop-directories are appended to the path (for the 'path' option) or to
the filename (for the 'tags' option) with a ';'. If you want several
stop-directories separate them with ';'. If you want no stop-directory
- ("search upward till the root directory) just use ';'. >
+ ("search upward till the root directory") just use ';'. >
/usr/include/sys;/usr
< will search in: >
/usr/include/sys
@@ -1636,7 +1636,7 @@ There are three different types of searching:
If Vim's current path is /u/user_x/work/release and you do >
:set path=include;/u/user_x
-< and then search for a file with |gf| the file is searched in: >
+< and then search for a file with |gf| the file is searched in: >
/u/user_x/work/release/include
/u/user_x/work/include
/u/user_x/include
@@ -1648,7 +1648,7 @@ There are three different types of searching:
3) Combined up/downward search:
If Vim's current path is /u/user_x/work/release and you do >
set path=**;/u/user_x
-< and then search for a file with |gf| the file is searched in: >
+< and then search for a file with |gf| the file is searched in: >
/u/user_x/work/release/**
/u/user_x/work/**
/u/user_x/**
@@ -1660,10 +1660,10 @@ There are three different types of searching:
In the above example you might want to set path to: >
:set path=**,/u/user_x/**
-< This searches:
- /u/user_x/work/release/** ~
- /u/user_x/** ~
- This searches the same directories, but in a different order.
+< This searches: >
+ /u/user_x/work/release/**
+ /u/user_x/**
+< This searches the same directories, but in a different order.
Note that completion for ":find", ":sfind", and ":tabfind" commands do not
currently work with 'path' items that contain a URL or use the double star
diff --git a/runtime/doc/editorconfig.txt b/runtime/doc/editorconfig.txt
index 0b20c77801..eef14ed51c 100644
--- a/runtime/doc/editorconfig.txt
+++ b/runtime/doc/editorconfig.txt
@@ -78,6 +78,10 @@ root *editorconfig.root*
directories. This property must be at the top-level of the `.editorconfig`
file (i.e. it must not be within a glob section).
+spelling_language *editorconfig.spelling_language*
+ A code of the format ss or ss-TT, where ss is an ISO 639 language code and
+ TT is an ISO 3166 territory identifier. Sets the 'spelllang' option.
+
tab_width *editorconfig.tab_width*
The display size of a single tab character. Sets the 'tabstop' option.
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 7b4dba5a50..e0c45503cc 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -894,6 +894,9 @@ Example: >
All expressions within one level are parsed from left to right.
+Expression nesting is limited to 1000 levels deep (300 when build with MSVC)
+to avoid running out of stack and crashing. *E1169*
+
------------------------------------------------------------------------------
expr1 *expr1* *ternary* *falsy-operator* *??* *E109*
@@ -2166,9 +2169,10 @@ text...
let lconst[0] = 2 " Error!
let lconst[1][0] = 'b' " OK
< *E995*
- |:const| does not allow to for changing a variable. >
+ It is an error to specify an existing variable with
+ |:const|. >
:let x = 1
- :const x = 2 " Error!
+ :const x = 1 " Error!
< *E996*
Note that environment variables, option values and
register values cannot be used here, since they cannot
@@ -2186,7 +2190,7 @@ text...
:lockvar v
:let v = 'asdf' " fails!
:unlet v " works
-< *E741* *E940*
+< *E741* *E940* *E1122*
If you try to change a locked variable you get an
error message: "E741: Value is locked: {name}".
If you try to lock or unlock a built-in variable you
diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt
index 5eae78744c..a577b0c5fb 100644
--- a/runtime/doc/filetype.txt
+++ b/runtime/doc/filetype.txt
@@ -147,6 +147,7 @@ variables can be used to overrule the filetype used for certain extensions:
`*.csh` g:filetype_csh |ft-csh-syntax|
`*.dat` g:filetype_dat
`*.def` g:filetype_def
+ `*.dsp` g:filetype_dsp
`*.f` g:filetype_f |ft-forth-syntax|
`*.frm` g:filetype_frm |ft-form-syntax|
`*.fs` g:filetype_fs |ft-forth-syntax|
@@ -585,6 +586,17 @@ any #lang directive overrides, use the following command: >
let g:freebasic_lang = "fblite"
+GDSCRIPT *ft-gdscript-plugin*
+
+By default the following options are set, based on Godot official docs: >
+
+ setlocal noexpandtab softtabstop=0 shiftwidth=0
+
+To disable this behavior, set the following variable in your vimrc: >
+
+ let g:gdscript_recommended_style = 0
+
+
GIT COMMIT *ft-gitcommit-plugin*
One command, :DiffGitCached, is provided to show a diff of the current commit
@@ -592,6 +604,17 @@ in the preview window. It is equivalent to calling "git diff --cached" plus
any arguments given to the command.
+GO *ft-go-plugin*
+
+By default the following options are set, based on Golang official docs: >
+
+ setlocal noexpandtab softtabstop=0 shiftwidth=0
+
+To disable this behavior, set the following variable in your vimrc: >
+
+ let g:go_recommended_style = 0
+
+
GPROF *ft-gprof-plugin*
The gprof filetype plugin defines a mapping <C-]> to jump from a function
@@ -602,6 +625,12 @@ The mapping can be disabled with: >
let g:no_gprof_maps = 1
+HARE *ft-hare*
+
+Since the text for this plugin is rather long it has been put in a separate
+file: |ft_hare.txt|.
+
+
JAVA *ft-java-plugin*
Whenever the variable "g:ftplugin_java_source_path" is defined and its value
@@ -632,6 +661,27 @@ Remember to manually trigger the |FileType| event from a buffer with a Java
file loaded in it each time after assigning a new value to the variable: >
doautocmd FileType
<
+Markdown documentation comments may contain common runs of vertical leading
+whitespace following the comment marks (`///`) for aesthetic reasons; however,
+some horizontal runs of leading whitespace are significant in Markdown because
+they denote code blocks etc. For convenience, a 'formatexpr' function is
+provided for the |gq| operator. As long as neither "g:java_ignore_javadoc"
+nor "g:java_ignore_markdown" is defined, the reformatting of Markdown comments
+can be enabled on demand with: >
+ setlocal formatexpr=g:javaformat#RemoveCommonMarkdownWhitespace()
+<
+Or for Vim versions less than `7.4.265`, with: >
+ setlocal formatexpr=javaformat#RemoveCommonMarkdownWhitespace()
+<
+This function accepts a range of lines, removes a common run of vertical
+leading whitespace, and rewrites the lines of the range. Depending on the
+author's layout style and the comment contents, which lines to select for
+reformatting can vary from the whole comment to only some portion of it.
+To enable the recognition of Markdown comments each time after removing
+"g:java_ignore_markdown" or "g:java_ignore_javadoc", remember to manually
+re-source "javaformat.vim" for Vim versions greater than `8.2.1397`: >
+ runtime autoload/javaformat.vim
+<
MAIL *ft-mail-plugin*
@@ -984,6 +1034,10 @@ You can change the default by defining the variable g:tex_flavor to the format
let g:tex_flavor = "latex"
Currently no other formats are recognized.
+TYPST *ft-typst-plugin*
+
+ *g:typst_conceal*
+When |TRUE| the Typst filetype plugin will set the 'conceallevel' option to 2.
VIM *ft-vim-plugin*
diff --git a/runtime/doc/fold.txt b/runtime/doc/fold.txt
index 8f7393f5e3..b844e0ed85 100644
--- a/runtime/doc/fold.txt
+++ b/runtime/doc/fold.txt
@@ -69,8 +69,6 @@ method. The value of the 'foldexpr' option is evaluated to get the foldlevel
of a line. Examples:
This will create a fold for all consecutive lines that start with a tab: >
:set foldexpr=getline(v:lnum)[0]==\"\\t\"
-This will call a function to compute the fold level: >
- :set foldexpr=MyFoldLevel(v:lnum)
This will make a fold out of paragraphs separated by blank lines: >
:set foldexpr=getline(v:lnum)=~'^\\s*$'&&getline(v:lnum+1)=~'\\S'?'<1':1
This does the same: >
@@ -79,6 +77,10 @@ This does the same: >
Note that backslashes must be used to escape characters that ":set" handles
differently (space, backslash, double quote, etc., see |option-backslash|).
+The most efficient is to call a function without arguments: >
+ :set foldexpr=MyFoldLevel()
+The function must use v:lnum. See |expr-option-function|.
+
These are the conditions with which the expression is evaluated:
- The current buffer and window are set for the line.
- The variable "v:lnum" is set to the line number.
diff --git a/runtime/doc/ft_ada.txt b/runtime/doc/ft_ada.txt
index a9302cde97..337a4cba6a 100644
--- a/runtime/doc/ft_ada.txt
+++ b/runtime/doc/ft_ada.txt
@@ -48,14 +48,12 @@ ctermfg=White often shows well).
There are several options you can select in this Ada mode. See |ft-ada-options|
for a complete list.
-To enable them, assign a value to the option. For example, to turn one on:
- >
- > let g:ada_standard_types = 1
-
-To disable them use ":unlet". Example:
->
- > unlet g:ada_standard_types
-
+To enable them, assign a value to the option. For example, to turn one on: >
+ let g:ada_standard_types = 1
+<
+To disable them use ":unlet". Example: >
+ unlet g:ada_standard_types
+<
You can just use ":" and type these into the command line to set these
temporarily before loading an Ada file. You can make these option settings
permanent by adding the "let" command(s), without a colon, to your |init.vim|
@@ -158,10 +156,9 @@ several versions available which differ in the licence terms used.
The GNAT compiler plug-in will perform a compile on pressing <F7> and then
immediately shows the result. You can set the project file to be used by
-setting:
- >
- > call g:gnat.Set_Project_File ('my_project.gpr')
-
+setting: >
+ call g:gnat.Set_Project_File ('my_project.gpr')
+<
Setting a project file will also create a Vim session (|views-sessions|) so -
like with the GPS - opened files, window positions etc. will be remembered
separately for all projects.
diff --git a/runtime/doc/ft_hare.txt b/runtime/doc/ft_hare.txt
new file mode 100644
index 0000000000..937c5e0961
--- /dev/null
+++ b/runtime/doc/ft_hare.txt
@@ -0,0 +1,77 @@
+*ft_hare.txt* Support for the Hare programming language
+
+==============================================================================
+CONTENTS *hare*
+
+1. Introduction |hare-intro|
+2. Filetype plugin |hare-plugin|
+3. Settings |hare-settings|
+
+==============================================================================
+INTRODUCTION *hare-intro*
+
+This plugin provides syntax highlighting, indentation, and other functionality
+for the Hare programming language. Support is also provided for README files
+inside Hare modules, but this must be enabled by setting |g:filetype_haredoc|.
+
+==============================================================================
+FILETYPE PLUGIN *hare-plugin*
+
+This plugin automatically sets the value of 'path' to include the contents of
+the HAREPATH environment variable, allowing commands such as |gf| to directly
+open standard library or third-party modules. If HAREPATH is not set, it
+defaults to the recommended paths for most Unix-like filesystems, namely
+/usr/src/hare/stdlib and /usr/src/hare/third-party.
+
+==============================================================================
+SETTINGS *hare-settings*
+
+This plugin provides a small number of variables that you can define in your
+vimrc to configure its behavior.
+
+ *g:filetype_haredoc*
+This plugin is able to automatically detect Hare modules and set the "haredoc"
+filetype for any README files. As the recursive directory search used as a
+heuristic has a minor performance impact, this feature is disabled by default
+and must be specifically opted into: >
+ let g:filetype_haredoc = 1
+<
+See |g:haredoc_search_depth| for ways to tweak the searching behavior.
+
+ *g:hare_recommended_style*
+The following options are set by default, in accordance with the official Hare
+style guide: >
+ setlocal noexpandtab
+ setlocal shiftwidth=0
+ setlocal softtabstop=0
+ setlocal tabstop=8
+ setlocal textwidth=80
+<
+To disable this behavior: >
+ let g:hare_recommended_style = 0
+<
+ *g:hare_space_error*
+By default, trailing whitespace and tabs preceded by space characters are
+highlighted as errors. This is automatically turned off when in insert mode.
+To disable this highlighting completely: >
+ let g:hare_space_error = 0
+<
+ *g:haredoc_search_depth*
+By default, when |g:filetype_haredoc| is enabled, only the current directory
+and its immediate subdirectories are searched for Hare files. The maximum
+search depth may be adjusted with: >
+ let g:haredoc_search_depth = 2
+<
+ Value Effect~
+ 0 Only search the current directory.
+ 1 Search the current directory and immediate
+ subdirectories.
+ 2 Search the current directory and two levels of
+ subdirectories.
+
+The maximum search depth can be set to any integer, but using values higher
+than 2 is not recommended, and will likely provide no tangible benefit in most
+situations.
+
+==============================================================================
+ vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/ft_sql.txt b/runtime/doc/ft_sql.txt
index 241fa4bd74..1dbac66db0 100644
--- a/runtime/doc/ft_sql.txt
+++ b/runtime/doc/ft_sql.txt
@@ -293,7 +293,7 @@ loaded by Vim: >
ftplugin/sql.vim
syntax/sqlinformix.vim
indent/sql.vim
->
+<
Notice indent/sqlinformix.sql was not loaded. There is no indent file
for Informix, Vim loads the default files if the specified files does not
exist.
@@ -349,7 +349,7 @@ The defaults static maps are: >
The use of "<C-C>" can be user chosen by using the following in your |init.vim|
as it may not work properly on all platforms: >
let g:ftplugin_sql_omni_key = '<C-C>'
->
+<
The static maps (which are based on the syntax highlight groups) follow this
format: >
imap <buffer> <C-C>k <C-\><C-O>:call sqlcomplete#Map('sqlKeyword')<CR><C-X><C-O>
@@ -664,7 +664,7 @@ your |init.vim|: >
filetype is changed temporarily to SQL, the sqlcompletion plugin
will cache the syntax groups listed in the List specified in this
option.
->
+
------------------------------------------------------------------------------
4.5 SQL Maps *sql-completion-maps*
diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt
index a64d722177..9ab5bf4e1e 100644
--- a/runtime/doc/gui.txt
+++ b/runtime/doc/gui.txt
@@ -6,14 +6,38 @@
Nvim Graphical User Interface *gui* *GUI*
+Any client that supports the Nvim |ui-protocol| can be used as a UI for Nvim.
+And multiple UIs can connect to the same Nvim instance! The terms "UI" and
+"GUI" are often used interchangeably because all Nvim UI clients have the same
+potential capabilities; the "TUI" refers to a UI client that outputs to your
+terminal, whereas a "GUI" outputs directly to the OS graphics system.
+
+Except where noted, this document describes UI capabilities available to both
+TUI and GUI (assuming the UI supports the given feature). See |TUI| for notes
+specific to the terminal UI. Help tags with the "gui-" prefix refer to UI
+features, whereas help tags with the "ui-" prefix refer to the |ui-protocol|.
+
+Nvim provides a default, builtin UI (the |TUI|), but there are many other
+(third-party) GUIs that you can use instead:
+
+- Firenvim (Nvim in your web browser!) https://github.com/glacambre/firenvim
+- vscode-neovim (Nvim in VSCode!) https://github.com/vscode-neovim/vscode-neovim
+- Neovide https://neovide.dev/
+- Goneovim https://github.com/akiyosi/goneovim
+- Nvy https://github.com/RMichelsen/Nvy
+- Neovim-Qt (Qt5) https://github.com/equalsraf/neovim-qt
+- VimR (macOS) https://github.com/qvacua/vimr
+- Others https://github.com/neovim/neovim/wiki/Related-projects#gui
+
Type |gO| to see the table of contents.
==============================================================================
-Starting the GUI *gui-start* *E229* *E233*
+Starting the GUI *gui-config* *gui-start*
*ginit.vim* *gui-init* *gvimrc* *$MYGVIMRC*
For GUI-specific configuration Nvim provides the |UIEnter| event. This
-happens after other |initialization|s, like reading your vimrc file.
+happens after other |initialization|s, or whenever a UI attaches (multiple UIs
+can connect to any Nvim instance).
Example: this sets "g:gui" to the value of the UI's "rgb" field: >
:autocmd UIEnter * let g:gui = filter(nvim_list_uis(),{k,v-> v.chan==v:event.chan})[0].rgb
@@ -221,7 +245,7 @@ is right aligned, and the "O" is underlined, to indicate it is the shortcut.
*:am* *:amenu* *:an* *:anoremenu*
The ":amenu" command can be used to define menu entries for all modes at once,
-expect for Terminal mode. To make the command work correctly, a character is
+except for Terminal mode. To make the command work correctly, a character is
automatically inserted for some modes:
mode inserted appended ~
Normal nothing nothing
@@ -444,6 +468,10 @@ when the right mouse button is pressed, if 'mousemodel' is set to popup or
popup_setpos.
The default "PopUp" menu is: >vim
+ anoremenu PopUp.Go\ to\ definition <Cmd>lua vim.lsp.buf.definition()<CR>
+ amenu PopUp.Open\ in\ web\ browser gx
+ anoremenu PopUp.Inspect <Cmd>Inspect<CR>
+ anoremenu PopUp.-1- <Nop>
vnoremenu PopUp.Cut "+x
vnoremenu PopUp.Copy "+y
anoremenu PopUp.Paste "+gP
@@ -452,8 +480,7 @@ The default "PopUp" menu is: >vim
nnoremenu PopUp.Select\ All ggVG
vnoremenu PopUp.Select\ All gg0oG$
inoremenu PopUp.Select\ All <C-Home><C-O>VG
- anoremenu PopUp.Inspect <Cmd>Inspect<CR>
- anoremenu PopUp.-1- <Nop>
+ anoremenu PopUp.-2- <Nop>
anoremenu PopUp.How-to\ disable\ mouse <Cmd>help disable-mouse<CR>
<
@@ -548,7 +575,7 @@ name and all existing submenus below it are affected.
Examples for Menus *menu-examples*
-Here is an example on how to add menu items with menu's! You can add a menu
+Here is an example on how to add menu items with menus! You can add a menu
item for the keyword under the cursor. The register "z" is used. >
:nmenu Words.Add\ Var wb"zye:menu! Words.<C-R>z <C-R>z<CR>
@@ -612,9 +639,6 @@ a menu item - you don't need to do a :tunmenu as well.
You can cause a menu to popup at the cursor. This behaves similarly to the
PopUp menus except that any menu tree can be popped up.
-This command is for backwards compatibility, using it is discouraged, because
-it behaves in a strange way.
-
*:popup* *:popu*
:popu[p] {name} Popup the menu {name}. The menu named must
have at least one subentry, but need not
diff --git a/runtime/doc/health.txt b/runtime/doc/health.txt
index e879f11351..cb70961b55 100644
--- a/runtime/doc/health.txt
+++ b/runtime/doc/health.txt
@@ -7,10 +7,10 @@
Type |gO| to see the table of contents.
==============================================================================
-Checkhealth *health*
+Checkhealth *vim.health* *health*
-health.vim is a minimal framework to help users troubleshoot configuration and
+vim.health is a minimal framework to help users troubleshoot configuration and
any other environment conditions that a plugin might care about. Nvim ships
with healthchecks for configuration, performance, python support, ruby
support, clipboard support, and more.
@@ -49,7 +49,7 @@ Commands *health-commands*
:checkhealth vim*
<
-Create a healthcheck *health-dev* *vim.health*
+Create a healthcheck *health-dev*
Healthchecks are functions that check the user environment, configuration, or
any other prerequisites that a plugin cares about. Nvim ships with
diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt
index 43f80101ed..fd8bfd644f 100644
--- a/runtime/doc/help.txt
+++ b/runtime/doc/help.txt
@@ -127,6 +127,7 @@ PROGRAMMING LANGUAGE SUPPORT
|filetype| Settings for specific types of files
|quickfix| Commands for a quick edit-compile-fix cycle
|ft_ada.txt| Ada filetype plugin
+|ft_hare.txt| Filetype plugin for Hare
|ft_ps1.txt| PowerShell filetype plugin
|ft_raku.txt| Raku filetype plugin
|ft_rust.txt| Rust filetype plugin
@@ -168,6 +169,7 @@ VERSIONS
DEVELOPING NVIM
|dev| Development of Nvim
+|dev-arch| Internal architecture, modules, data structures
|dev-style| Development style guidelines
|dev-theme| Design guidelines (colorschemes etc.)
|dev-tools| Tools and techniques for developing Nvim
@@ -187,7 +189,7 @@ Local additions ~
*local-additions*
------------------------------------------------------------------------------
-*bars* Bars example
+Bars example *bars*
Now that you've jumped here with CTRL-] or a double mouse click, you can use
CTRL-T, CTRL-O, g<RightMouse>, or <C-RightMouse> to go back to where you were.
@@ -199,5 +201,5 @@ You can use CTRL-] on any word (even if it is not within "|") and Nvim will
try to find help for it. Especially for options in single quotes, e.g.
'hlsearch'.
-------------------------------------------------------------------------------
+
vim:tw=78:isk=!-~,^*,^\|,^\":ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt
index a890d531ac..f97ae24068 100644
--- a/runtime/doc/indent.txt
+++ b/runtime/doc/indent.txt
@@ -116,7 +116,7 @@ If you really want to reindent when you type 'o', 'O', 'e', '0', '<', '>',
"<!>", respectively, for those keys.
For an emacs-style indent mode where lines aren't indented every time you
-press <Enter> but only if you press <Tab>, I suggest:
+press <Enter> but only if you press <Tab>, I suggest: >
:set cinkeys=0{,0},:,0#,!<Tab>,!^F
You might also want to switch off 'autoindent' then.
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index 79f10b33f1..9ee75ea950 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -196,10 +196,12 @@ tag char note action in Normal mode ~
|<Tab>| <Tab> 1 go to N newer entry in jump list
|CTRL-I| CTRL-I 1 same as <Tab>
|<NL>| <NL> 1 same as "j"
+|<S-NL>| <S-NL> 1 same as CTRL-F
|CTRL-J| CTRL-J 1 same as "j"
CTRL-K not used
|CTRL-L| CTRL-L redraw screen
|<CR>| <CR> 1 cursor to the first CHAR N lines lower
+|<S-CR>| <S-CR> 1 same as CTRL-F
|CTRL-M| CTRL-M 1 same as <CR>
|CTRL-N| CTRL-N 1 same as "j"
|CTRL-O| CTRL-O 1 go to N older entry in jump list
@@ -272,9 +274,11 @@ tag char note action in Normal mode ~
|star| * 1 search forward for the Nth occurrence of
the ident under the cursor
|+| + 1 same as <CR>
+|<S-Plus>| <S-+> 1 same as CTRL-F
|,| , 1 repeat latest f, t, F or T in opposite
direction N times
|-| - 1 cursor to the first CHAR N lines higher
+|<S-Minus>| <S--> 1 same as CTRL-B
|.| . 2 repeat last change with count replaced with
N
|/| /{pattern}<CR> 1 search forward for the Nth occurrence of
@@ -366,7 +370,7 @@ tag char note action in Normal mode ~
or start of putted text
|`]| `] 1 cursor to the end of last operated text or
end of putted text
-|``| `` 1 cursor to the position before latest jump
+|``| "``" 1 cursor to the position before latest jump
|`{| `{ 1 cursor to the start of the current paragraph
|`}| `} 1 cursor to the end of the current paragraph
|a| a 2 append text after the cursor N times
@@ -397,7 +401,7 @@ tag char note action in Normal mode ~
|q| q{0-9a-zA-Z"} record typed characters into named register
{0-9a-zA-Z"} (uppercase to append)
|q| q (while recording) stops recording
-|Q| Q replay last recorded macro
+|Q| Q 2 replay last recorded register
|q:| q: edit : command-line in command-line window
|q/| q/ edit / command-line in command-line window
|q?| q? edit ? command-line in command-line window
@@ -736,7 +740,7 @@ tag char note action in Normal mode ~
search pattern and Visually select it
|gP| ["x]gP 2 put the text [from register x] before the
cursor N times, leave the cursor after it
-|gQ| gQ switch to "Ex" mode with Vim editing
+|gQ| gQ switch to "Ex" mode with Vim editing
|gR| gR 2 enter Virtual Replace mode
|gT| gT go to the previous tab page
|gU| gU{motion} 2 make Nmove text uppercase
@@ -923,7 +927,6 @@ tag command note action in Visual mode ~
|v_O| O move horizontally to other corner of area
|v_P| P replace highlighted area with register
contents; registers are unchanged
- Q does not start Ex mode
|v_R| R 2 delete the highlighted lines and start
insert
|v_S| S 2 delete the highlighted lines and start
@@ -1136,7 +1139,7 @@ tag command action ~
|:!!| :!! repeat last ":!" command
|:#| :# same as ":number"
|:&| :& repeat last ":substitute"
-|:star| :* use the last Visual area, like :'<,'>
+|:star| :* use the last Visual area, like ":'<,'>"
|:<| :< shift lines one 'shiftwidth' left
|:=| := print the last line number
|:>| :> shift lines one 'shiftwidth' right
diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt
index 91b0d41f1c..d7cbb7c78e 100644
--- a/runtime/doc/insert.txt
+++ b/runtime/doc/insert.txt
@@ -1177,6 +1177,18 @@ items:
user_data custom data which is associated with the item and
available in |v:completed_item|; it can be any type;
defaults to an empty string
+ hl_group an additional highlight group whose attributes are
+ combined with |hl-PmenuSel| and |hl-Pmenu| or
+ |hl-PmenuMatchSel| and |hl-PmenuMatch| highlight
+ attributes in the popup menu to apply cterm and gui
+ properties (with higher priority) like strikethrough
+ to the completion items
+ kind_hlgroup an additional highlight group specifically for setting
+ the highlight attributes of the completion kind. When
+ this field is present, it will override the
+ |hl-PmenuKind| highlight group, allowing for the
+ customization of ctermfg and guifg properties for the
+ completion kind
All of these except "icase", "equal", "dup" and "empty" must be a string. If
an item does not meet these requirements then an error message is given and
@@ -1927,11 +1939,16 @@ These two commands will keep on asking for lines, until you type a line
containing only a ".". Watch out for lines starting with a backslash, see
|line-continuation|.
-When in Ex mode (see |-e|) a backslash at the end of the line can be used to
-insert a NUL character. To be able to have a line ending in a backslash use
-two backslashes. This means that the number of backslashes is halved, but
-only at the end of the line.
-
+Text typed after a "|" command separator is used first. So the following
+command in ex mode: >
+ :a|one
+ two
+ .
+ :visual
+appends the following text, after the cursor line: >
+ one
+ two
+<
NOTE: These commands cannot be used with |:global| or |:vglobal|.
":append" and ":insert" don't work properly in between ":if" and
":endif", ":for" and ":endfor", ":while" and ":endwhile".
diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt
index 4c757cc1f6..41846f8eed 100644
--- a/runtime/doc/intro.txt
+++ b/runtime/doc/intro.txt
@@ -688,7 +688,7 @@ The current mode is "-- INSERT --" or "-- REPLACE --", see |'showmode'|. The
command characters are those that you typed but were not used yet.
If you have a slow terminal you can switch off the status messages to speed
-up editing:
+up editing: >
:set nosc noru nosm
If there is an error, an error message will be shown for at least one second
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
index 50fffca497..419f583c36 100644
--- a/runtime/doc/lsp.txt
+++ b/runtime/doc/lsp.txt
@@ -34,16 +34,16 @@ Follow these steps to get LSP features:
vim.api.nvim_create_autocmd('FileType', {
-- This handler will fire when the buffer's 'filetype' is "python"
pattern = 'python',
- callback = function(ev)
+ callback = function(args)
vim.lsp.start({
name = 'my-server-name',
cmd = {'name-of-language-server-executable', '--option', 'arg1', 'arg2'},
-- Set the "root directory" to the parent directory of the file in the
- -- current buffer (`ev.buf`) that contains either a "setup.py" or a
+ -- current buffer (`args.buf`) that contains either a "setup.py" or a
-- "pyproject.toml" file. Files that share a root directory will reuse
-- the connection to the same LSP server.
- root_dir = vim.fs.root(ev.buf, {'setup.py', 'pyproject.toml'}),
+ root_dir = vim.fs.root(args.buf, {'setup.py', 'pyproject.toml'}),
})
end,
})
@@ -86,18 +86,21 @@ To override or delete any of the above defaults, set or unset the options on
|LspAttach|: >lua
vim.api.nvim_create_autocmd('LspAttach', {
- callback = function(ev)
- vim.bo[ev.buf].formatexpr = nil
- vim.bo[ev.buf].omnifunc = nil
- vim.keymap.del('n', 'K', { buffer = ev.buf })
+ callback = function(args)
+ -- Unset 'formatexpr'
+ vim.bo[args.buf].formatexpr = nil
+ -- Unset 'omnifunc'
+ vim.bo[args.buf].omnifunc = nil
+ -- Unmap K
+ vim.keymap.del('n', 'K', { buffer = args.buf })
end,
})
<
*lsp-config*
-To use other LSP features, set keymaps on |LspAttach|. Not all language
-servers provide the same capabilities. To ensure you only set keymaps if the
-language server supports a feature, guard keymaps behind capability checks.
-Example: >lua
+To use other LSP features, set keymaps and other buffer options on
+|LspAttach|. Not all language servers provide the same capabilities. Use
+capability checks to ensure you only use features supported by the language
+server. Example: >lua
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(args)
@@ -105,6 +108,21 @@ Example: >lua
if client.supports_method('textDocument/implementation') then
-- Create a keymap for vim.lsp.buf.implementation
end
+
+ if client.supports_method('textDocument/completion') then
+ -- Enable auto-completion
+ vim.lsp.completion.enable(true, client.id, args.buf, {autotrigger = true})
+ end
+
+ if client.supports_method('textDocument/formatting') then
+ -- Format the current buffer on save
+ vim.api.nvim_create_autocmd('BufWritePre', {
+ buffer = args.buf,
+ callback = function()
+ vim.lsp.buf.format({bufnr = args.buf, id = client.id})
+ end,
+ })
+ end
end,
})
<
@@ -191,6 +209,7 @@ won't run if your server doesn't support them.
- textDocument/prepareTypeHierarchy
- textDocument/publishDiagnostics
- textDocument/rangeFormatting
+- textDocument/rangesFormatting
- textDocument/references
- textDocument/rename
- textDocument/semanticTokens/full
@@ -220,26 +239,26 @@ Each response handler has this signature: >
function(err, result, ctx, config)
<
Parameters: ~
- - {err} (table|nil) Error info dict, or `nil` if the request
- completed.
- - {result} (Result | Params | nil) `result` key of the |lsp-response| or
- `nil` if the request failed.
- - {ctx} (table) Table of calling state associated with the
- handler, with these keys:
- - {method} (string) |lsp-method| name.
- - {client_id} (number) |vim.lsp.Client| identifier.
- - {bufnr} (Buffer) Buffer handle.
- - {params} (table|nil) Request parameters table.
- - {version} (number) Document version at time of
- request. Handlers can compare this to the
- current document version to check if the
- response is "stale". See also |b:changedtick|.
- - {config} (table) Handler-defined configuration table, which allows
- users to customize handler behavior.
- For an example, see:
- |vim.lsp.diagnostic.on_publish_diagnostics()|
- To configure a particular |lsp-handler|, see:
- |lsp-handler-configuration|
+ • {err} (`table|nil`) Error info dict, or `nil` if the request
+ completed.
+ • {result} (`Result|Params|nil`) `result` key of the |lsp-response| or
+ `nil` if the request failed.
+ • {ctx} (`table`) Table of calling state associated with the
+ handler, with these keys:
+ • {method} (`string`) |lsp-method| name.
+ • {client_id} (`number`) |vim.lsp.Client| identifier.
+ • {bufnr} (`Buffer`) Buffer handle.
+ • {params} (`table|nil`) Request parameters table.
+ • {version} (`number`) Document version at time of
+ request. Handlers can compare this to the
+ current document version to check if the
+ response is "stale". See also |b:changedtick|.
+ • {config} (`table`) Handler-defined configuration table, which allows
+ users to customize handler behavior.
+ For an example, see:
+ |vim.lsp.diagnostic.on_publish_diagnostics()|
+ To configure a particular |lsp-handler|, see:
+ |lsp-handler-configuration|
Returns: ~
Two values `result, err` where `err` is shaped like an RPC error: >
@@ -302,7 +321,7 @@ To configure the behavior of a builtin |lsp-handler|, the convenient method
}
<
Some handlers do not have an explicitly named handler function (such as
- ||vim.lsp.diagnostic.on_publish_diagnostics()|). To override these, first
+ |vim.lsp.diagnostic.on_publish_diagnostics()|). To override these, first
create a reference to the existing handler: >lua
local on_references = vim.lsp.handlers["textDocument/references"]
@@ -508,32 +527,25 @@ EVENTS *lsp-events*
LspAttach *LspAttach*
After an LSP client attaches to a buffer. The |autocmd-pattern| is the
name of the buffer. When used from Lua, the client ID is passed to the
- callback in the "data" table. Example: >lua
-
- vim.api.nvim_create_autocmd("LspAttach", {
- callback = function(args)
- local bufnr = args.buf
- local client = vim.lsp.get_client_by_id(args.data.client_id)
- if client.server_capabilities.completionProvider then
- vim.bo[bufnr].omnifunc = "v:lua.vim.lsp.omnifunc"
- end
- if client.server_capabilities.definitionProvider then
- vim.bo[bufnr].tagfunc = "v:lua.vim.lsp.tagfunc"
- end
- end,
- })
-<
+ callback in the "data" table. See |lsp-config| for an example.
LspDetach *LspDetach*
Just before an LSP client detaches from a buffer. The |autocmd-pattern|
is the name of the buffer. When used from Lua, the client ID is passed
to the callback in the "data" table. Example: >lua
- vim.api.nvim_create_autocmd("LspDetach", {
+ vim.api.nvim_create_autocmd('LspDetach', {
callback = function(args)
+ -- Get the detaching client
local client = vim.lsp.get_client_by_id(args.data.client_id)
- -- Do something with the client
- vim.cmd("setlocal tagfunc< omnifunc<")
+
+ -- Remove the autocommand to format the buffer on save, if it exists
+ if client.supports_method('textDocument/formatting') then
+ vim.api.nvim_clear_autocmds({
+ event = 'BufWritePre',
+ buffer = args.buf,
+ })
+ end
end,
})
<
@@ -750,7 +762,7 @@ formatexpr({opts}) *vim.lsp.formatexpr()*
function.
Currently only supports a single client. This can be set via
- `setlocal formatexpr=v:lua.vim.lsp.formatexpr()` but will typically or in
+ `setlocal formatexpr=v:lua.vim.lsp.formatexpr()` or (more typically) in
`on_attach` via
`vim.bo[bufnr].formatexpr = 'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})'`.
@@ -874,13 +886,13 @@ start({config}, {opts}) *vim.lsp.start()*
• {config} (`vim.lsp.ClientConfig`) Configuration for the server. See
|vim.lsp.ClientConfig|.
• {opts} (`table?`) Optional keyword arguments
- • {reuse_client}
+ • {reuse_client}?
(`fun(client: vim.lsp.Client, config: vim.lsp.ClientConfig): 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} (`integer`) 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).
• {silent}? (`boolean`) Suppress error reporting if the LSP
server fails to start (default false).
@@ -996,7 +1008,7 @@ Lua module: vim.lsp.client *lsp-client*
if the client supports workspace folders. It
can be `null` if the client supports workspace
folders but none are configured.
- • {root_dir} (`string`)
+ • {root_dir} (`string?`)
• {attached_buffers} (`table<integer,true>`)
• {commands} (`table<string,fun(command: lsp.Command, ctx: table)>`)
Table of command name to function which is
@@ -1043,7 +1055,7 @@ Lua module: vim.lsp.client *lsp-client*
`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
+ err # a dict
• {notify} (`fun(method: string, params: table?): boolean`)
Sends a notification to an LSP server.
Returns: a boolean to indicate if the
@@ -1371,15 +1383,22 @@ format({opts}) *vim.lsp.buf.format()*
(client.id) matching this field.
• {name}? (`string`) Restrict formatting to the client with
name (client.name) matching this field.
- • {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.
+ • {range}?
+ (`{start:[integer,integer],end:[integer, integer]}|{start:[integer,integer],end:[integer,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. Can also be a list of tables that
+ contain `start` and `end` keys as described above, in which
+ case `textDocument/rangesFormatting` support is required.
hover() *vim.lsp.buf.hover()*
Displays hover information about the symbol under the cursor in a floating
- window. Calling the function twice will jump into the floating window.
+ window. The window will be dismissed on cursor move. Calling the function
+ twice will jump into the floating window (thus by default, "KK" will open
+ the hover window and focus it). In the floating window, all commands and
+ mappings are available as usual, except that "q" dismisses the window. You
+ can scroll the contents the same as you would any other buffer.
implementation({opts}) *vim.lsp.buf.implementation()*
Lists all the implementations for the symbol under the cursor in the
@@ -1468,6 +1487,15 @@ workspace_symbol({query}, {opts}) *vim.lsp.buf.workspace_symbol()*
==============================================================================
Lua module: vim.lsp.diagnostic *lsp-diagnostic*
+from({diagnostics}) *vim.lsp.diagnostic.from()*
+ Converts the input `vim.Diagnostic`s to LSP diagnostics.
+
+ Parameters: ~
+ • {diagnostics} (`vim.Diagnostic[]`)
+
+ Return: ~
+ (`lsp.Diagnostic[]`)
+
*vim.lsp.diagnostic.get_namespace()*
get_namespace({client_id}, {is_pull})
Get the diagnostic namespace associated with an LSP client
@@ -1605,6 +1633,34 @@ save({lenses}, {bufnr}, {client_id}) *vim.lsp.codelens.save()*
==============================================================================
+Lua module: vim.lsp.completion *lsp-completion*
+
+*vim.lsp.completion.BufferOpts*
+
+ Fields: ~
+ • {autotrigger}? (`boolean`) Whether to trigger completion
+ automatically. Default: false
+ • {convert}? (`fun(item: lsp.CompletionItem): table`) Transforms an
+ LSP CompletionItem to |complete-items|.
+
+
+ *vim.lsp.completion.enable()*
+enable({enable}, {client_id}, {bufnr}, {opts})
+ Enables or disables completions from the given language client in the
+ given buffer.
+
+ Parameters: ~
+ • {enable} (`boolean`) True to enable, false to disable
+ • {client_id} (`integer`) Client ID
+ • {bufnr} (`integer`) Buffer handle, or 0 for the current buffer
+ • {opts} (`vim.lsp.completion.BufferOpts?`) See
+ |vim.lsp.completion.BufferOpts|.
+
+trigger() *vim.lsp.completion.trigger()*
+ Trigger LSP completion in the current buffer.
+
+
+==============================================================================
Lua module: vim.lsp.inlay_hint *lsp-inlay_hint*
enable({enable}, {filter}) *vim.lsp.inlay_hint.enable()*
@@ -1614,6 +1670,9 @@ enable({enable}, {filter}) *vim.lsp.inlay_hint.enable()*
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
<
+ Attributes: ~
+ Since: 0.10.0
+
Parameters: ~
• {enable} (`boolean?`) true/nil to enable, false to disable
• {filter} (`table?`) Optional filters |kwargs|, or `nil` for all.
@@ -1638,6 +1697,9 @@ get({filter}) *vim.lsp.inlay_hint.get()*
})
<
+ Attributes: ~
+ Since: 0.10.0
+
Parameters: ~
• {filter} (`table?`) Optional filters |kwargs|:
• {bufnr} (`integer?`)
@@ -1652,8 +1714,11 @@ get({filter}) *vim.lsp.inlay_hint.get()*
is_enabled({filter}) *vim.lsp.inlay_hint.is_enabled()*
Query whether inlay hint is enabled in the {filter}ed scope
+ Attributes: ~
+ Since: 0.10.0
+
Parameters: ~
- • {filter} (`table`) Optional filters |kwargs|, or `nil` for all.
+ • {filter} (`table?`) Optional filters |kwargs|, or `nil` for all.
• {bufnr} (`integer?`) Buffer number, or 0 for current
buffer, or nil for all.
@@ -1806,8 +1871,8 @@ 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
+ • {text_document_edit} (`lsp.TextDocumentEdit`)
+ • {index} (`integer?`) Optional index of the edit, if from
a list of edits (or nil, if not from a list)
• {offset_encoding} (`string?`)
@@ -1819,7 +1884,7 @@ 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
+ • {text_edits} (`lsp.TextEdit[]`)
• {bufnr} (`integer`) Buffer id
• {offset_encoding} (`string`) utf-8|utf-16|utf-32
@@ -1831,7 +1896,7 @@ apply_workspace_edit({workspace_edit}, {offset_encoding})
Applies a `WorkspaceEdit`.
Parameters: ~
- • {workspace_edit} (`table`) `WorkspaceEdit`
+ • {workspace_edit} (`lsp.WorkspaceEdit`)
• {offset_encoding} (`string`) utf-8|utf-16|utf-32 (required)
See also: ~
@@ -1849,8 +1914,7 @@ buf_highlight_references({bufnr}, {references}, {offset_encoding})
Parameters: ~
• {bufnr} (`integer`) Buffer id
- • {references} (`table`) List of `DocumentHighlight` objects to
- highlight
+ • {references} (`lsp.DocumentHighlight[]`) objects to highlight
• {offset_encoding} (`string`) One of "utf-8", "utf-16", "utf-32".
See also: ~
@@ -1884,8 +1948,8 @@ convert_input_to_markdown_lines({input}, {contents})
Parameters: ~
• {input} (`lsp.MarkedString|lsp.MarkedString[]|lsp.MarkupContent`)
- • {contents} (`table?`) List of strings to extend with converted lines.
- Defaults to {}.
+ • {contents} (`string[]?`) List of strings to extend with converted
+ lines. Defaults to {}.
Return: ~
(`string[]`) extended with lines of converted markdown.
@@ -1898,15 +1962,16 @@ 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`
+ • {signature_help} (`lsp.SignatureHelp`) Response of
+ `textDocument/SignatureHelp`
• {ft} (`string?`) filetype that will be use as the `lang`
for the label markdown code block
• {triggers} (`table?`) list of trigger characters from the lsp
server. used to better determine parameter offsets
Return (multiple): ~
- (`table?`) table list of lines of converted markdown.
- (`table?`) table of active hl
+ (`string[]?`) table list of lines of converted markdown.
+ (`number[]?`) table of active hl
See also: ~
• https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_signatureHelp
@@ -1928,7 +1993,7 @@ jump_to_location({location}, {offset_encoding}, {reuse_win})
Jumps to a location.
Parameters: ~
- • {location} (`table`) (`Location`|`LocationLink`)
+ • {location} (`lsp.Location|lsp.LocationLink`)
• {offset_encoding} (`string?`) utf-8|utf-16|utf-32
• {reuse_win} (`boolean?`) Jump to existing window if buffer is
already open.
@@ -1957,7 +2022,9 @@ locations_to_items({locations}, {offset_encoding})
(`table[]`) A list of objects with the following fields:
• {filename} (`string`)
• {lnum} (`integer`) 1-indexed line number
+ • {end_lnum} (`integer`) 1-indexed end line number
• {col} (`integer`) 1-indexed column
+ • {end_col} (`integer`) 1-indexed end column
• {text} (`string`)
• {user_data} (`lsp.Location|lsp.LocationLink`)
@@ -1993,7 +2060,8 @@ make_formatting_params({options})
cursor position.
Parameters: ~
- • {options} (`table?`) with valid `FormattingOptions` entries
+ • {options} (`lsp.FormattingOptions?`) with valid `FormattingOptions`
+ entries
Return: ~
(`lsp.DocumentFormattingParams`) object
@@ -2033,7 +2101,7 @@ make_position_params({window}, {offset_encoding})
`window`
Return: ~
- (`table`) `TextDocumentPositionParams` object
+ (`lsp.TextDocumentPositionParams`)
See also: ~
• https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentPositionParams
@@ -2064,7 +2132,7 @@ make_text_document_params({bufnr})
• {bufnr} (`integer?`) Buffer handle, defaults to current
Return: ~
- (`table`) `TextDocumentIdentifier`
+ (`lsp.TextDocumentIdentifier`)
See also: ~
• https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentIdentifier
@@ -2074,8 +2142,11 @@ make_workspace_params({added}, {removed})
Create the workspace params
Parameters: ~
- • {added} (`table`)
- • {removed} (`table`)
+ • {added} (`lsp.WorkspaceFolder[]`)
+ • {removed} (`lsp.WorkspaceFolder[]`)
+
+ Return: ~
+ (`lsp.WorkspaceFoldersChangeEvent`)
*vim.lsp.util.open_floating_preview()*
open_floating_preview({contents}, {syntax}, {opts})
@@ -2119,7 +2190,7 @@ preview_location({location}, {opts}) *vim.lsp.util.preview_location()*
definition)
Parameters: ~
- • {location} (`table`) a single `Location` or `LocationLink`
+ • {location} (`lsp.Location|lsp.LocationLink`)
• {opts} (`table`)
Return (multiple): ~
@@ -2149,7 +2220,7 @@ show_document({location}, {offset_encoding}, {opts})
Shows document and optionally jumps to the location.
Parameters: ~
- • {location} (`table`) (`Location`|`LocationLink`)
+ • {location} (`lsp.Location|lsp.LocationLink`)
• {offset_encoding} (`string?`) utf-8|utf-16|utf-32
• {opts} (`table?`) options
• reuse_win (boolean) Jump to existing window if
@@ -2174,7 +2245,7 @@ stylize_markdown({bufnr}, {contents}, {opts})
Parameters: ~
• {bufnr} (`integer`)
- • {contents} (`table`) of lines to show in window
+ • {contents} (`string[]`) of lines to show in window
• {opts} (`table`) with optional fields
• height of floating window
• width of floating window
@@ -2191,7 +2262,7 @@ symbols_to_items({symbols}, {bufnr}) *vim.lsp.util.symbols_to_items()*
Parameters: ~
• {symbols} (`table`) DocumentSymbol[] or SymbolInformation[]
- • {bufnr} (`integer`)
+ • {bufnr} (`integer?`)
==============================================================================
@@ -2238,7 +2309,7 @@ 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?`)
+ • {request} (`fun(method: string, params: table?, callback: fun(err: lsp.ResponseError?, result: any), notify_reply_callback: fun(message_id: integer)?):boolean,integer?`)
see |vim.lsp.rpc.request()|
• {notify} (`fun(method: string, params: any):boolean`) see
|vim.lsp.rpc.notify()|
diff --git a/runtime/doc/lua-guide.txt b/runtime/doc/lua-guide.txt
index e8757a1859..5f06d51f42 100644
--- a/runtime/doc/lua-guide.txt
+++ b/runtime/doc/lua-guide.txt
@@ -225,7 +225,6 @@ Vimscript are automatically converted:
end
vim.fn.jobstart('ls', { on_stdout = print_stdout })
- print(vim.fn.printf('Hello from %s', 'Lua'))
<
This works for both |builtin-functions| and |user-function|s.
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index 3d8453c5a2..396f24a1aa 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -28,17 +28,18 @@ You can also run Lua scripts from your shell using the |-l| argument: >
nvim -l foo.lua [args...]
<
*lua-compat*
-Lua 5.1 is the permanent interface for Nvim Lua. Plugins need only consider
-Lua 5.1, not worry about forward-compatibility with future Lua versions. If
-Nvim ever ships with Lua 5.4+, a Lua 5.1 compatibility shim will be provided
-so that old plugins continue to work transparently.
+Lua 5.1 is the permanent interface for Nvim Lua. Plugins should target Lua 5.1
+as specified in |luaref|; later versions (which are essentially different,
+incompatible, dialects) are not supported. This includes extensions such as
+`goto` that some Lua 5.1 interpreters like LuaJIT may support.
*lua-luajit*
-On supported platforms, Nvim is built with LuaJIT, which provides extra
-functionality (compared to PUC Lua) such as "bit" and various utilities (see
-|lua-profile|). Lua code in |init.lua| and plugins can assume its presence on
-many platforms, but for maximum compatibility should check the `jit` global
-variable: >lua
+While Nvim officially only requires Lua 5.1 support, it should be built with
+LuaJIT or a compatible fork on supported platforms for performance reasons.
+LuaJIT also comes with useful extensions such as `ffi`, |lua-profile|, and
+enhanced standard library functions; these cannot be assumed to be available,
+and Lua code in |init.lua| or plugins should check the `jit` global variable
+before using them: >lua
if jit then
-- code for luajit
else
@@ -46,11 +47,12 @@ variable: >lua
end
<
*lua-bit*
-The LuaJIT "bit" extension module is _always_ available: when built with PUC
-Lua, Nvim includes a fallback implementation which provides `require("bit")`.
+One exception is the LuaJIT `bit` extension, which is always available: when
+built with PUC Lua, Nvim includes a fallback implementation which provides
+`require("bit")`.
*lua-profile*
-To profile Lua code (with LuaJIT-enabled Nvim), the basic steps are: >lua
+If Nvim is built with LuaJIT, Lua code can be profiled via >lua
-- Start a profiling session:
require('jit.p').start('ri1', '/tmp/profile')
@@ -59,13 +61,13 @@ To profile Lua code (with LuaJIT-enabled Nvim), the basic steps are: >lua
-- Stop the session. Profile is written to /tmp/profile.
require('jit.p').stop()
-See https://luajit.org/ext_profiler.html or the "p.lua" source for details: >
+See https://luajit.org/ext_profiler.html or the `p.lua` source for details: >
:lua vim.cmd.edit(package.searchpath('jit.p', package.path))
==============================================================================
LUA CONCEPTS AND IDIOMS *lua-concepts*
-Lua is very simple: this means that, while there are some quirks, once you
+Lua is very simple, and _consistent_: while there are some quirks, once you
internalize those quirks, everything works the same everywhere. Scopes
(closures) in particular are very consistent, unlike JavaScript or most other
languages.
@@ -83,6 +85,36 @@ https://www.lua.org/doc/cacm2018.pdf
- Stackful coroutines enable cooperative multithreading, generators, and
versatile control for both Lua and its host (Nvim).
+ *lua-error-handling*
+Lua functions may throw |lua-errors| for exceptional (unexpected) failures,
+which you can handle with |pcall()|.
+ *lua-result-or-message*
+When failure is normal and expected, it's idiomatic to return `nil` which
+signals to the caller that failure is not "exceptional" and must be handled.
+This "result-or-message" pattern is expressed as the multi-value return type
+`any|nil,nil|string`, or in LuaLS notation: >
+
+ ---@return any|nil # result on success, nil on failure.
+ ---@return nil|string # nil on success, error message on failure.
+<
+Examples of the "result-or-message" pattern:
+- |vim.ui.open()|
+- |io.open()|
+- |luv-error-handling|
+
+When a caller can't proceed on failure, it's idiomatic to `assert()` the
+"result-or-message" result: >lua
+
+ local value = assert(fn())
+
+Guidance: use the "result-or-message" pattern for...
+- Functions where failure is expected, especially when communicating with the
+ external world. E.g. HTTP requests or LSP requests often fail because of
+ server problems, even if the caller did everything right.
+- Functions that return a value, e.g. Foo:new().
+- When there is a list of known error codes which can be returned as a third
+ value (like |luv-error-handling|).
+<
*iterator*
An iterator is just a function that can be called repeatedly to get the "next"
value of a collection (or any other |iterable|). This interface is expected by
@@ -350,16 +382,14 @@ Example: >vim
<
*lua-table-ambiguous*
Lua tables are used as both dictionaries and lists, so it is impossible to
-determine whether empty table is meant to be empty list or empty dictionary.
-Additionally Lua does not have integer numbers. To distinguish between these
-cases there is the following agreement:
+decide whether empty table is a list or a dict. Also Lua does not have integer
+numbers. To disambiguate these cases, we define:
*lua-list*
-0. Empty table is empty list.
-1. Table with N consecutive integer indices starting from 1 and ending with
- N is considered a list. See also |list-iterator|.
+0. Empty table is a list. Use |vim.empty_dict()| to represent empty dict.
+1. Table with N consecutive (no `nil` values, aka "holes") integer keys 1…N is
+ a list. See also |list-iterator|.
*lua-dict*
-2. Table with string keys, none of which contains NUL byte, is considered to
- be a dictionary.
+2. Table with string keys, none of which contains NUL byte, is a dict.
3. Table with string keys, at least one of which contains NUL byte, is also
considered to be a dictionary, but this time it is converted to
a |msgpack-special-map|.
@@ -543,16 +573,19 @@ Example: File-change detection *watch-file*
vim.api.nvim_command(
"command! -nargs=1 Watch call luaeval('watch_file(_A)', expand('<args>'))")
<
- *fswatch-limitations*
-When on Linux and using fswatch, you may need to increase the maximum number
-of `inotify` watches and queued events as the default limit can be too low. To
-increase the limit, run: >sh
- sysctl fs.inotify.max_user_watches=100000
- sysctl fs.inotify.max_queued_events=100000
+ *inotify-limitations*
+When on Linux you may need to increase the maximum number of `inotify` watches
+and queued events as the default limit can be too low. To increase the limit,
+run: >sh
+ sysctl fs.inotify.max_user_watches=494462
<
-This will increase the limit to 100000 watches and queued events. These lines
+This will increase the limit to 494462 watches and queued events. These lines
can be added to `/etc/sysctl.conf` to make the changes persistent.
+Note that each watch is a structure in the Kernel, thus available memory is
+also a bottleneck for using inotify. In fact, a watch can take up to 1KB of
+space. This means a million watches could result in 1GB of extra RAM usage.
+
Example: TCP echo-server *tcp-server*
1. Save this code to a file.
2. Execute it with ":luafile %".
@@ -646,8 +679,8 @@ vim.highlight.range({bufnr}, {ns}, {higroup}, {start}, {finish}, {opts})
• {finish} (`integer[]|string`) End of region as a (line, column)
tuple or string accepted by |getpos()|
• {opts} (`table?`) A table with the following fields:
- • {regtype}? (`string`, default: `'charwise'`) Type of
- range. See |setreg()|
+ • {regtype}? (`string`, default: `'v'` i.e. charwise) Type
+ of range. See |getregtype()|
• {inclusive}? (`boolean`, default: `false`) Indicates
whether the range is end-inclusive
• {priority}? (`integer`, default:
@@ -680,47 +713,47 @@ vim.diff({a}, {b}, {opts}) *vim.diff()*
Parameters: ~
• {a} (`string`) First string to compare
• {b} (`string`) Second string to compare
- • {opts} (`table`) Optional parameters:
- • {on_hunk}
- (`fun(start_a: integer, count_a: integer, start_b: integer, count_b: integer): integer`)
+ • {opts} (`table?`) Optional parameters:
+ • {on_hunk}?
+ (`fun(start_a: integer, count_a: integer, start_b: integer, count_b: integer): integer?`)
Invoked for each hunk in the diff. Return a negative number
to cancel the callback for any remaining hunks. Arguments:
• `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} (`'unified'|'indices'`, default: `'unified'`)
+ • {result_type}? (`'unified'|'indices'`, default: `'unified'`)
Form of the returned diff:
• `unified`: 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
+ • {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
`result_type = indices`, ignored otherwise.
- • {algorithm} (`'myers'|'minimal'|'patience'|'histogram'`,
+ • {algorithm}? (`'myers'|'minimal'|'patience'|'histogram'`,
default: `'myers'`) Diff algorithm to use. Values:
• `myers`: the default algorithm
• `minimal`: spend extra time to generate the smallest
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
- • {ignore_whitespace_change} (`boolean`) Ignore whitespace
+ • {ctxlen}? (`integer`) Context length
+ • {interhunkctxlen}? (`integer`) Inter hunk context length
+ • {ignore_whitespace}? (`boolean`) Ignore whitespace
+ • {ignore_whitespace_change}? (`boolean`) Ignore whitespace
change
- • {ignore_whitespace_change_at_eol} (`boolean`) Ignore
+ • {ignore_whitespace_change_at_eol}? (`boolean`) Ignore
whitespace change at end-of-line.
- • {ignore_cr_at_eol} (`boolean`) Ignore carriage return at
+ • {ignore_cr_at_eol}? (`boolean`) Ignore carriage return at
end-of-line
- • {ignore_blank_lines} (`boolean`) Ignore blank lines
- • {indent_heuristic} (`boolean`) Use the indent heuristic for
+ • {ignore_blank_lines}? (`boolean`) Ignore blank lines
+ • {indent_heuristic}? (`boolean`) Use the indent heuristic for
the internal diff library.
Return: ~
- (`string|integer[]`) See {opts.result_type}. `nil` if {opts.on_hunk}
- is given.
+ (`string|integer[][]?`) See {opts.result_type}. `nil` if
+ {opts.on_hunk} is given.
==============================================================================
@@ -834,8 +867,8 @@ vim.spell.check({str}) *vim.spell.check()*
• {str} (`string`)
Return: ~
- (`{[1]: string, [2]: 'bad'|'rare'|'local'|'caps', [3]: integer}[]`)
- List of tuples with three items:
+ (`[string, 'bad'|'rare'|'local'|'caps', integer][]`) 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
@@ -981,6 +1014,9 @@ vim.str_byteindex({str}, {index}, {use_utf16}) *vim.str_byteindex()*
• {index} (`integer`)
• {use_utf16} (`boolean?`)
+ Return: ~
+ (`integer`)
+
vim.str_utf_end({str}, {index}) *vim.str_utf_end()*
Gets the distance (in bytes) from the last byte of the codepoint
(character) that {index} points to.
@@ -1067,7 +1103,9 @@ vim.stricmp({a}, {b}) *vim.stricmp()*
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
+ WARNING: This feature is experimental/unstable.
+
+ Attach to |ui-events|, similar to |nvim_ui_attach()| but receive events as
Lua callback. Can be used to implement screen elements like popupmenu or
message handling in Lua.
@@ -1660,8 +1698,11 @@ vim.on_key({fn}, {ns_id}) *vim.on_key()*
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
- |TUI|) pastes text into the editor.
+ Paste handler, invoked by |nvim_paste()|.
+
+ Note: This is provided only as a "hook", don't call it directly; call
+ |nvim_paste()| instead, which arranges redo (dot-repeat) and invokes
+ `vim.paste`.
Example: To remove ANSI color codes when pasting: >lua
vim.paste = (function(overridden)
@@ -1670,7 +1711,7 @@ vim.paste({lines}, {phase}) *vim.paste()*
-- Scrub ANSI color codes from paste input.
lines[i] = line:gsub('\27%[[0-9;mK]+', '')
end
- overridden(lines, phase)
+ return overridden(lines, phase)
end
end)(vim.paste)
<
@@ -1708,30 +1749,6 @@ vim.print({...}) *vim.print()*
• |vim.inspect()|
• |:=|
- *vim.region()*
-vim.region({bufnr}, {pos1}, {pos2}, {regtype}, {inclusive})
- Gets a dict of line segment ("chunk") positions for the region from `pos1`
- to `pos2`.
-
- Input and output positions are byte positions, (0,0)-indexed. "End of
- line" column position (for example, |linewise| visual selection) is
- 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)
- 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').
-
- Return: ~
- (`table`) region Dict of the form `{linenr = {startcol,endcol}}`.
- `endcol` is exclusive, and whole lines are returned as
- `{startcol,endcol} = {0,-1}`.
-
vim.schedule_wrap({fn}) *vim.schedule_wrap()*
Returns a function which calls {fn} via |vim.schedule()|.
@@ -1841,6 +1858,9 @@ vim.inspect_pos({bufnr}, {row}, {col}, {filter}) *vim.inspect_pos()*
Can also be pretty-printed with `:Inspect!`. *:Inspect!*
+ Attributes: ~
+ Since: 0.9.0
+
Parameters: ~
• {bufnr} (`integer?`) defaults to the current buffer
• {row} (`integer?`) row to inspect, 0-based. Defaults to the row of
@@ -1874,6 +1894,9 @@ vim.show_pos({bufnr}, {row}, {col}, {filter}) *vim.show_pos()*
Can also be shown with `:Inspect`. *:Inspect*
+ Attributes: ~
+ Since: 0.9.0
+
Parameters: ~
• {bufnr} (`integer?`) defaults to the current buffer
• {row} (`integer?`) row to inspect, 0-based. Defaults to the row of
@@ -2248,6 +2271,12 @@ vim.tbl_count({t}) *vim.tbl_count()*
vim.tbl_deep_extend({behavior}, {...}) *vim.tbl_deep_extend()*
Merges recursively two or more tables.
+ Only values that are empty tables or tables that are not |lua-list|s
+ (indexed by consecutive integers starting from 1) are merged recursively.
+ This is useful for merging nested tables like default and user
+ configurations where lists should be treated as literals (i.e., are
+ overwritten instead of merged).
+
Parameters: ~
• {behavior} (`'error'|'keep'|'force'`) Decides what to do if a key is
found in more than one map:
@@ -2366,7 +2395,26 @@ vim.trim({s}) *vim.trim()*
• https://www.lua.org/pil/20.2.html
vim.validate({opt}) *vim.validate()*
- Validates a parameter specification (types and values). Specs are
+ Validate function arguments.
+
+ This function has two valid forms:
+ 1. vim.validate(name: str, value: any, type: string, optional?: bool)
+ 2. vim.validate(spec: table)
+
+ Form 1 validates that argument {name} with value {value} has the type
+ {type}. {type} must be a value returned by |lua-type()|. If {optional} is
+ true, then {value} may be null. This form is significantly faster and
+ should be preferred for simple cases.
+
+ Example: >lua
+ function vim.startswith(s, prefix)
+ vim.validate('s', s, 'string')
+ vim.validate('prefix', prefix, 'string')
+ ...
+ end
+<
+
+ Form 2 validates a parameter specification (types and values). Specs are
evaluated in alphanumeric order, until the first failure.
Usage example: >lua
@@ -2421,11 +2469,15 @@ vim.validate({opt}) *vim.validate()*
Lua module: vim.loader *vim.loader*
vim.loader.disable() *vim.loader.disable()*
+ WARNING: This feature is experimental/unstable.
+
Disables the experimental Lua module loader:
• removes the loaders
• adds the default Nvim loader
vim.loader.enable() *vim.loader.enable()*
+ WARNING: This feature is experimental/unstable.
+
Enables the experimental Lua module loader:
• overrides loadfile
• adds the Lua loader using the byte-compilation cache
@@ -2433,6 +2485,8 @@ vim.loader.enable() *vim.loader.enable()*
• removes the default Nvim loader
vim.loader.find({modname}, {opts}) *vim.loader.find()*
+ WARNING: This feature is experimental/unstable.
+
Finds Lua modules for the given module name.
Parameters: ~
@@ -2458,6 +2512,8 @@ vim.loader.find({modname}, {opts}) *vim.loader.find()*
returned for `modname="*"`
vim.loader.reset({path}) *vim.loader.reset()*
+ WARNING: This feature is experimental/unstable.
+
Resets the cache for the path, or all the paths if path is nil.
Parameters: ~
@@ -2552,7 +2608,7 @@ vim.ui.input({opts}, {on_confirm}) *vim.ui.input()*
typed (it might be an empty string if nothing was
entered), or `nil` if the user aborted the dialog.
-vim.ui.open({path}) *vim.ui.open()*
+vim.ui.open({path}, {opt}) *vim.ui.open()*
Opens `path` with the system default handler (macOS `open`, Windows
`explorer.exe`, Linux `xdg-open`, …), or returns (but does not show) an
error message on failure.
@@ -2563,6 +2619,8 @@ vim.ui.open({path}) *vim.ui.open()*
-- Asynchronous.
vim.ui.open("https://neovim.io/")
vim.ui.open("~/path/to/file")
+ -- Use the "osurl" command to handle the path or URL.
+ vim.ui.open("gh#neovim/neovim!29490", { cmd = { 'osurl' } })
-- Synchronous (wait until the process exits).
local cmd, err = vim.ui.open("$VIMRUNTIME")
if cmd then
@@ -2572,6 +2630,8 @@ vim.ui.open({path}) *vim.ui.open()*
Parameters: ~
• {path} (`string`) Path or URL to open
+ • {opt} (`{ cmd?: string[] }?`) Options
+ • cmd string[]|nil Command used to open the path or URL.
Return (multiple): ~
(`vim.SystemObj?`) Command object, or nil if not found.
@@ -2671,7 +2731,7 @@ vim.filetype.add({filetypes}) *vim.filetype.add()*
['.*/etc/foo/.*%.conf'] = { 'dosini', { priority = 10 } },
-- A pattern containing an environment variable
['${XDG_CONFIG_HOME}/foo/git'] = 'git',
- ['README.(%a+)$'] = function(path, bufnr, ext)
+ ['.*README.(%a+)'] = function(path, bufnr, ext)
if ext == 'md' then
return 'markdown'
elseif ext == 'rst' then
@@ -2723,6 +2783,9 @@ vim.filetype.get_option({filetype}, {option})
means |ftplugin| and |FileType| autocommands are only triggered once and
may not reflect later changes.
+ Attributes: ~
+ Since: 0.9.0
+
Parameters: ~
• {filetype} (`string`) Filetype
• {option} (`string`) Option name
@@ -2803,24 +2866,24 @@ vim.keymap.del({modes}, {lhs}, {opts}) *vim.keymap.del()*
• |vim.keymap.set()|
vim.keymap.set({mode}, {lhs}, {rhs}, {opts}) *vim.keymap.set()*
- Adds a new |mapping|. Examples: >lua
- -- Map to a Lua function:
- vim.keymap.set('n', 'lhs', function() print("real lua function") end)
- -- Map to multiple modes:
- vim.keymap.set({'n', 'v'}, '<leader>lr', vim.lsp.buf.references, { buffer = true })
- -- Buffer-local mapping:
- vim.keymap.set('n', '<leader>w', "<cmd>w<cr>", { silent = true, buffer = 5 })
- -- Expr mapping:
+ Defines a |mapping| of |keycodes| to a function or keycodes.
+
+ Examples: >lua
+ -- Map "x" to a Lua function:
+ vim.keymap.set('n', 'x', function() print("real lua function") end)
+ -- Map "<leader>x" to multiple modes for the current buffer:
+ vim.keymap.set({'n', 'v'}, '<leader>x', vim.lsp.buf.references, { buffer = true })
+ -- Map <Tab> to an expression (|:map-<expr>|):
vim.keymap.set('i', '<Tab>', function()
return vim.fn.pumvisible() == 1 and "<C-n>" or "<Tab>"
end, { expr = true })
- -- <Plug> mapping:
+ -- Map "[%%" to a <Plug> mapping:
vim.keymap.set('n', '[%%', '<Plug>(MatchitNormalMultiBackward)')
<
Parameters: ~
- • {mode} (`string|string[]`) Mode short-name, see |nvim_set_keymap()|.
- Can also be list of modes to create mapping on multiple modes.
+ • {mode} (`string|string[]`) Mode "short-name" (see
+ |nvim_set_keymap()|), or a list thereof.
• {lhs} (`string`) Left-hand side |{lhs}| of the mapping.
• {rhs} (`string|function`) Right-hand side |{rhs}| of the mapping,
can be a Lua function.
@@ -2847,6 +2910,9 @@ Lua module: vim.fs *vim.fs*
vim.fs.basename({file}) *vim.fs.basename()*
Return the basename of the given path
+ Attributes: ~
+ Since: 0.8.0
+
Parameters: ~
• {file} (`string?`) Path
@@ -2856,6 +2922,9 @@ vim.fs.basename({file}) *vim.fs.basename()*
vim.fs.dir({path}, {opts}) *vim.fs.dir()*
Return an iterator over the items located in {path}
+ Attributes: ~
+ Since: 0.8.0
+
Parameters: ~
• {path} (`string`) An absolute or relative path to the directory to
iterate over. The path is first normalized
@@ -2875,6 +2944,9 @@ vim.fs.dir({path}, {opts}) *vim.fs.dir()*
vim.fs.dirname({file}) *vim.fs.dirname()*
Return the parent directory of the given path
+ Attributes: ~
+ Since: 0.8.0
+
Parameters: ~
• {file} (`string?`) Path
@@ -2907,6 +2979,9 @@ vim.fs.find({names}, {opts}) *vim.fs.find()*
end, {limit = math.huge, type = 'file'})
<
+ Attributes: ~
+ Since: 0.8.0
+
Parameters: ~
• {names} (`string|string[]|fun(name: string, path: string): boolean`)
Names of the items to find. Must be base names, paths and
@@ -2938,6 +3013,9 @@ 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"`)
+ Attributes: ~
+ Since: 0.10.0
+
Parameters: ~
• {...} (`string`)
@@ -2974,6 +3052,9 @@ vim.fs.normalize({path}, {opts}) *vim.fs.normalize()*
[[\\?\UNC\server\share\foo\..\..\..\bar]] => "//?/UNC/server/share/bar"
<
+ Attributes: ~
+ Since: 0.8.0
+
Parameters: ~
• {path} (`string`) Path to normalize
• {opts} (`table?`) A table with the following fields:
@@ -3002,6 +3083,9 @@ vim.fs.parents({start}) *vim.fs.parents()*
end
<
+ Attributes: ~
+ Since: 0.8.0
+
Parameters: ~
• {start} (`string`) Initial path.
@@ -3010,6 +3094,18 @@ vim.fs.parents({start}) *vim.fs.parents()*
(`nil`)
(`string?`)
+vim.fs.rm({path}, {opts}) *vim.fs.rm()*
+ WARNING: This feature is experimental/unstable.
+
+ Remove files or directories
+
+ Parameters: ~
+ • {path} (`string`) Path to remove
+ • {opts} (`table?`) A table with the following fields:
+ • {recursive}? (`boolean`) Remove directories and their
+ contents recursively
+ • {force}? (`boolean`) Ignore nonexistent files and arguments
+
vim.fs.root({source}, {marker}) *vim.fs.root()*
Find the first parent directory containing a specific "marker", relative
to a file path or buffer.
@@ -3030,6 +3126,9 @@ vim.fs.root({source}, {marker}) *vim.fs.root()*
end)
<
+ Attributes: ~
+ Since: 0.10.0
+
Parameters: ~
• {source} (`integer|string`) Buffer number (0 for current buffer) or
file path (absolute or relative to the |current-directory|)
@@ -3089,7 +3188,7 @@ In addition, its regex-like interface is available as |vim.re|
-Pattern:match({subject}, {init}) *Pattern:match()*
+Pattern:match({subject}, {init}, {...}) *Pattern:match()*
Matches the given `pattern` against the `subject` string. If the match
succeeds, returns the index in the subject of the first character after
the match, or the captured values (if the pattern captured any value). An
@@ -3112,9 +3211,10 @@ Pattern:match({subject}, {init}) *Pattern:match()*
Parameters: ~
• {subject} (`string`)
• {init} (`integer?`)
+ • {...} (`any`)
Return: ~
- (`integer|vim.lpeg.Capture?`)
+ (`any`) ...
vim.lpeg.B({pattern}) *vim.lpeg.B()*
Returns a pattern that matches only if the input string at the current
@@ -3124,7 +3224,7 @@ vim.lpeg.B({pattern}) *vim.lpeg.B()*
or failure.
Parameters: ~
- • {pattern} (`vim.lpeg.Pattern`)
+ • {pattern} (`vim.lpeg.Pattern|string|integer|boolean|table`)
Return: ~
(`vim.lpeg.Pattern`)
@@ -3148,7 +3248,7 @@ vim.lpeg.C({patt}) *vim.lpeg.C()*
<
Parameters: ~
- • {patt} (`vim.lpeg.Pattern`)
+ • {patt} (`vim.lpeg.Pattern|string|integer|boolean|table|function`)
Return: ~
(`vim.lpeg.Capture`)
@@ -3199,11 +3299,11 @@ vim.lpeg.Cf({patt}, {func}) *vim.lpeg.Cf()*
This capture assumes that `patt` should produce at least one capture with
at least one value (of any type), which becomes the initial value of an
accumulator. (If you need a specific initial value, you may prefix a
- constant captureto `patt`.) For each subsequent capture, LPeg calls `func`
- with this accumulator as the first argument and all values produced by the
- capture as extra arguments; the first result from this call becomes the
- new value for the accumulator. The final value of the accumulator becomes
- the captured value.
+ constant capture to `patt`.) For each subsequent capture, LPeg calls
+ `func` with this accumulator as the first argument and all values produced
+ by the capture as extra arguments; the first result from this call becomes
+ the new value for the accumulator. The final value of the accumulator
+ becomes the captured value.
Example: >lua
local number = lpeg.R('09') ^ 1 / tonumber
@@ -3214,7 +3314,7 @@ vim.lpeg.Cf({patt}, {func}) *vim.lpeg.Cf()*
<
Parameters: ~
- • {patt} (`vim.lpeg.Pattern`)
+ • {patt} (`vim.lpeg.Pattern|string|integer|boolean|table|function`)
• {func} (`fun(acc, newvalue)`)
Return: ~
@@ -3226,7 +3326,7 @@ vim.lpeg.Cg({patt}, {name}) *vim.lpeg.Cg()*
with the given name (which can be any non-nil Lua value).
Parameters: ~
- • {patt} (`vim.lpeg.Pattern`)
+ • {patt} (`vim.lpeg.Pattern|string|integer|boolean|table|function`)
• {name} (`string?`)
Return: ~
@@ -3249,8 +3349,9 @@ vim.lpeg.Cmt({patt}, {fn}) *vim.lpeg.Cmt()*
function become the values produced by the capture.
Parameters: ~
- • {patt} (`vim.lpeg.Pattern`)
- • {fn} (`function`)
+ • {patt} (`vim.lpeg.Pattern|string|integer|boolean|table|function`)
+ • {fn} (`fun(s: string, i: integer, ...: any)`) (position:
+ boolean|integer, ...: any)
Return: ~
(`vim.lpeg.Capture`)
@@ -3289,7 +3390,7 @@ vim.lpeg.Cs({patt}) *vim.lpeg.Cs()*
<
Parameters: ~
- • {patt} (`vim.lpeg.Pattern`)
+ • {patt} (`vim.lpeg.Pattern|string|integer|boolean|table|function`)
Return: ~
(`vim.lpeg.Capture`)
@@ -3302,7 +3403,7 @@ vim.lpeg.Ct({patt}) *vim.lpeg.Ct()*
the group name as its key. The captured value is only the table.
Parameters: ~
- • {patt} (`vim.lpeg.Pattern|''`)
+ • {patt} (`vim.lpeg.Pattern|string|integer|boolean|table|function`)
Return: ~
(`vim.lpeg.Capture`)
@@ -3337,7 +3438,7 @@ vim.lpeg.locale({tab}) *vim.lpeg.locale()*
Return: ~
(`vim.lpeg.Locale`)
-vim.lpeg.match({pattern}, {subject}, {init}) *vim.lpeg.match()*
+vim.lpeg.match({pattern}, {subject}, {init}, {...}) *vim.lpeg.match()*
Matches the given `pattern` against the `subject` string. If the match
succeeds, returns the index in the subject of the first character after
the match, or the captured values (if the pattern captured any value). An
@@ -3358,12 +3459,13 @@ vim.lpeg.match({pattern}, {subject}, {init}) *vim.lpeg.match()*
<
Parameters: ~
- • {pattern} (`vim.lpeg.Pattern`)
+ • {pattern} (`vim.lpeg.Pattern|string|integer|boolean|table|function`)
• {subject} (`string`)
• {init} (`integer?`)
+ • {...} (`any`)
Return: ~
- (`integer|vim.lpeg.Capture?`)
+ (`any`) ...
vim.lpeg.P({value}) *vim.lpeg.P()*
Converts the given value into a proper pattern. The following rules are
@@ -3457,7 +3559,7 @@ vim.lpeg.V({v}) *vim.lpeg.V()*
<
Parameters: ~
- • {v} (`string|integer`)
+ • {v} (`boolean|string|number|function|table|thread|userdata|lightuserdata`)
Return: ~
(`vim.lpeg.Pattern`)
@@ -3550,10 +3652,10 @@ 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}.
+ Matches line at `line_idx` (zero-based) in buffer `bufnr`. Match is
+ restricted to byte index range `start` and `end_` if given, otherwise see
+ |regex:match_str()|. Returned byte indices are relative to `start` if
+ given.
Parameters: ~
• {bufnr} (`integer`)
@@ -3561,19 +3663,28 @@ regex:match_line({bufnr}, {line_idx}, {start}, {end_})
• {start} (`integer?`)
• {end_} (`integer?`)
+ Return (multiple): ~
+ (`integer?`) match start (byte index) relative to `start`, or `nil` if
+ no match
+ (`integer?`) match end (byte index) relative to `start`, or `nil` if
+ no match
+
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.
+ Matches string `str` against this regex. To match the string precisely,
+ surround the regex with "^" and "$". Returns the byte indices for the
+ start and end of the match, or `nil` if there is no match. Because any
+ integer is "truthy", `regex:match_str()` can be directly used as a
+ condition in an if-statement.
Parameters: ~
• {str} (`string`)
+ Return (multiple): ~
+ (`integer?`) match start (byte index), or `nil` if no match
+ (`integer?`) match end (byte index), or `nil` if no match
+
vim.regex({re}) *vim.regex()*
- Parse the Vim regex {re} and return a regex object. Regexes are "magic"
+ Parses the Vim regex `re` and returns 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|.
@@ -3592,6 +3703,9 @@ vim.secure.read({path}) *vim.secure.read()*
be trusted. The user's choice is persisted in a trust database at
$XDG_STATE_HOME/nvim/trust.
+ Attributes: ~
+ Since: 0.9.0
+
Parameters: ~
• {path} (`string`) Path to a file to read.
@@ -3607,6 +3721,9 @@ vim.secure.trust({opts}) *vim.secure.trust()*
The trust database is located at |$XDG_STATE_HOME|/nvim/trust.
+ Attributes: ~
+ Since: 0.9.0
+
Parameters: ~
• {opts} (`table`) A table with the following fields:
• {action} (`'allow'|'deny'|'remove'`) - `'allow'` to add a
@@ -3698,6 +3815,9 @@ vim.version.cmp({v1}, {v2}) *vim.version.cmp()*
• Per semver, build metadata is ignored when comparing two
otherwise-equivalent versions.
+ Attributes: ~
+ Since: 0.9.0
+
Parameters: ~
• {v1} (`vim.Version|number[]|string`) Version object.
• {v2} (`vim.Version|number[]|string`) Version to compare with `v1`.
@@ -3709,6 +3829,9 @@ vim.version.eq({v1}, {v2}) *vim.version.eq()*
Returns `true` if the given versions are equal. See |vim.version.cmp()|
for usage.
+ Attributes: ~
+ Since: 0.9.0
+
Parameters: ~
• {v1} (`vim.Version|number[]|string`)
• {v2} (`vim.Version|number[]|string`)
@@ -3719,6 +3842,9 @@ vim.version.eq({v1}, {v2}) *vim.version.eq()*
vim.version.ge({v1}, {v2}) *vim.version.ge()*
Returns `true` if `v1 >= v2`. See |vim.version.cmp()| for usage.
+ Attributes: ~
+ Since: 0.10.0
+
Parameters: ~
• {v1} (`vim.Version|number[]|string`)
• {v2} (`vim.Version|number[]|string`)
@@ -3729,6 +3855,9 @@ vim.version.ge({v1}, {v2}) *vim.version.ge()*
vim.version.gt({v1}, {v2}) *vim.version.gt()*
Returns `true` if `v1 > v2`. See |vim.version.cmp()| for usage.
+ Attributes: ~
+ Since: 0.9.0
+
Parameters: ~
• {v1} (`vim.Version|number[]|string`)
• {v2} (`vim.Version|number[]|string`)
@@ -3748,6 +3877,9 @@ vim.version.last({versions}) *vim.version.last()*
vim.version.le({v1}, {v2}) *vim.version.le()*
Returns `true` if `v1 <= v2`. See |vim.version.cmp()| for usage.
+ Attributes: ~
+ Since: 0.10.0
+
Parameters: ~
• {v1} (`vim.Version|number[]|string`)
• {v2} (`vim.Version|number[]|string`)
@@ -3758,6 +3890,9 @@ vim.version.le({v1}, {v2}) *vim.version.le()*
vim.version.lt({v1}, {v2}) *vim.version.lt()*
Returns `true` if `v1 < v2`. See |vim.version.cmp()| for usage.
+ Attributes: ~
+ Since: 0.9.0
+
Parameters: ~
• {v1} (`vim.Version|number[]|string`)
• {v2} (`vim.Version|number[]|string`)
@@ -3772,6 +3907,9 @@ vim.version.parse({version}, {opts}) *vim.version.parse()*
{ major = 1, minor = 0, patch = 1, prerelease = "rc1", build = "build.2" }
<
+ Attributes: ~
+ Since: 0.9.0
+
Parameters: ~
• {version} (`string`) Version string to parse.
• {opts} (`table?`) Optional keyword arguments:
@@ -3812,6 +3950,9 @@ vim.version.range({spec}) *vim.version.range()*
print(vim.version.ge({1,0,3}, r.from) and vim.version.lt({1,0,3}, r.to))
<
+ Attributes: ~
+ Since: 0.9.0
+
Parameters: ~
• {spec} (`string`) Version range "spec"
@@ -3833,10 +3974,12 @@ argument into an *Iter* object with methods (such as |Iter:filter()| and
chained to create iterator "pipelines": the output of each pipeline stage is
input to the next stage. The first stage depends on the type passed to
`vim.iter()`:
-• List tables (arrays, |lua-list|) yield only the value of each element.
- • Holes (nil values) are allowed.
+• Lists or arrays (|lua-list|) yield only the value of each element.
+ • Holes (nil values) are allowed (but discarded).
+ • Use pairs() to treat array/list tables as dicts (preserve holes and
+ non-contiguous integer keys): `vim.iter(pairs(…))`.
• Use |Iter:enumerate()| to also pass the index to the next stage.
- • Or initialize with ipairs(): `vim.iter(ipairs(…))`.
+ • Or initialize with ipairs(): `vim.iter(ipairs(…))`.
• Non-list tables (|lua-dict|) yield both the key and value of each element.
• Function |iterator|s yield all values returned by the underlying function.
• Tables with a |__call()| metamethod are treated as function iterators.
@@ -4084,10 +4227,10 @@ Iter:map({f}) *Iter:map()*
<
Parameters: ~
- • {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.
+ • {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`)
@@ -4332,7 +4475,7 @@ vim.snippet.active({filter}) *vim.snippet.active()*
You can use this function to navigate a snippet as follows: >lua
vim.keymap.set({ 'i', 's' }, '<Tab>', function()
if vim.snippet.active({ direction = 1 }) then
- return '<cmd>lua vim.snippet.jump(1)<cr>'
+ return '<Cmd>lua vim.snippet.jump(1)<CR>'
else
return '<Tab>'
end
@@ -4366,7 +4509,7 @@ vim.snippet.jump({direction}) *vim.snippet.jump()*
For example, map `<Tab>` to jump while a snippet is active: >lua
vim.keymap.set({ 'i', 's' }, '<Tab>', function()
if vim.snippet.active({ direction = 1 }) then
- return '<cmd>lua vim.snippet.jump(1)<cr>'
+ return '<Cmd>lua vim.snippet.jump(1)<CR>'
else
return '<Tab>'
end
@@ -4390,8 +4533,9 @@ vim.text.hexdecode({enc}) *vim.text.hexdecode()*
Parameters: ~
• {enc} (`string`) String to decode
- Return: ~
- (`string`) Decoded string
+ Return (multiple): ~
+ (`string?`) Decoded string
+ (`string?`) Error message, if any
vim.text.hexencode({str}) *vim.text.hexencode()*
Hex encode a string.
@@ -4407,7 +4551,7 @@ vim.text.hexencode({str}) *vim.text.hexencode()*
Lua module: tohtml *vim.tohtml*
-:TOhtml {file} *:TOhtml*
+:[range]TOhtml {file} *:TOhtml*
Converts the buffer shown in the current window to HTML, opens the generated
HTML in a new split window, and saves its contents to {file}. If {file} is not
given, a temporary file (created by |tempname()|) is used.
@@ -4429,6 +4573,8 @@ tohtml.tohtml({winid}, {opt}) *tohtml.tohtml.tohtml()*
• {width}? (`integer`, default: 'textwidth' if non-zero or
window width otherwise) Width used for items which are
either right aligned or repeat a character infinitely.
+ • {range}? (`integer[]`, default: entire buffer) Range of
+ rows to use.
Return: ~
(`string[]`)
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index 9ec34d5d52..7fd1f3bfbb 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -354,7 +354,8 @@ Note:
*E1255* *E1136*
<Cmd> commands must terminate, that is, they must be followed by <CR> in the
-{rhs} of the mapping definition. |Command-line| mode is never entered.
+{rhs} of the mapping definition. |Command-line| mode is never entered. To use
+a literal <CR> in the {rhs}, use |<lt>|.
1.3 MAPPING AND MODES *:map-modes*
@@ -1380,12 +1381,14 @@ completion can be enabled:
-complete=arglist file names in argument list
-complete=augroup autocmd groups
+ -complete=breakpoint |:breakadd| suboptions
-complete=buffer buffer names
- -complete=behave :behave suboptions
-complete=color color schemes
-complete=command Ex command (and arguments)
-complete=compiler compilers
+ -complete=diff_buffer diff buffer names
-complete=dir directory names
+ -complete=dir_in_path directory names in |'cdpath'|
-complete=environment environment variable names
-complete=event autocommand events
-complete=expression Vim expression
@@ -1395,7 +1398,7 @@ completion can be enabled:
-complete=function function name
-complete=help help subjects
-complete=highlight highlight groups
- -complete=history :history suboptions
+ -complete=history |:history| suboptions
-complete=keymap keyboard mappings
-complete=locale locale names (as output of locale -a)
-complete=lua Lua expression |:lua|
@@ -1405,6 +1408,8 @@ completion can be enabled:
-complete=messages |:messages| suboptions
-complete=option options
-complete=packadd optional package |pack-add| names
+ -complete=runtime file and directory names in |'runtimepath'|
+ -complete=scriptnames sourced script names
-complete=shellcmd Shell command
-complete=sign |:sign| suboptions
-complete=syntax syntax file names |'syntax'|
@@ -1679,7 +1684,7 @@ The valid escape sequences are
nothing. Supported modifiers are |:aboveleft|, |:belowright|,
|:botright|, |:browse|, |:confirm|, |:hide|, |:horizontal|,
|:keepalt|, |:keepjumps|, |:keepmarks|, |:keeppatterns|,
- |:leftabove|, |:lockmarks|, |:noautocmd|, |:noswapfile|
+ |:leftabove|, |:lockmarks|, |:noautocmd|, |:noswapfile|,
|:rightbelow|, |:sandbox|, |:silent|, |:tab|, |:topleft|,
|:unsilent|, |:verbose|, and |:vertical|.
Note that |:filter| is not supported.
diff --git a/runtime/doc/mbyte.txt b/runtime/doc/mbyte.txt
index 0a7e0baad3..47fd4f3343 100644
--- a/runtime/doc/mbyte.txt
+++ b/runtime/doc/mbyte.txt
@@ -646,6 +646,12 @@ widespread as file format.
A composing or combining character is used to change the meaning of the
character before it. The combining characters are drawn on top of the
preceding character.
+
+Nvim largely follows the definition of extended grapheme clusters in UAX#29
+in the Unicode standard, with some modifications: An ascii char will always
+start a new cluster. In addition 'arabicshape' enables the combining of some
+arabic letters, when they are shaped to be displayed together in a single cell.
+
Too big combined characters cannot be displayed, but they can still be
inspected using the |g8| and |ga| commands described below.
When editing text a composing character is mostly considered part of the
@@ -686,7 +692,7 @@ You might want to select the font used for the menus. Unfortunately this
doesn't always work. See the system specific remarks below, and 'langmenu'.
-USING UTF-8 IN X-Windows *utf-8-in-xwindows*
+USING UTF-8 IN X-WINDOWS *utf-8-in-xwindows*
You need to specify a font to be used. For double-wide characters another
font is required, which is exactly twice as wide. There are three ways to do
diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt
index afe64300e7..ac151811c2 100644
--- a/runtime/doc/message.txt
+++ b/runtime/doc/message.txt
@@ -690,6 +690,7 @@ Ex command or function was given an invalid argument. Or |jobstart()| or
*E488* >
Trailing characters
+ Trailing characters: {text}
An argument was given to an Ex command that does not permit one.
Or the argument has invalid characters and has not been recognized.
@@ -756,7 +757,7 @@ src/ex_cmds.lua. Update the lookup table by re-running the build. >
This is an (incomplete) overview of various messages that Vim gives:
*hit-enter* *press-enter* *hit-return*
- *press-return* *hit-enter-prompt*
+ *press-return* *hit-enter-prompt* >
Press ENTER or type command to continue
diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt
index e80969c583..48e13d795e 100644
--- a/runtime/doc/motion.txt
+++ b/runtime/doc/motion.txt
@@ -60,10 +60,12 @@ When doubling the operator it operates on a line. When using a count, before
or after the first character, that many lines are operated upon. Thus `3dd`
deletes three lines. A count before and after the first character is
multiplied, thus `2y3y` yanks six lines.
-
+ *operator-resulting-pos*
After applying the operator the cursor is mostly left at the start of the text
that was operated upon. For example, "yfe" doesn't move the cursor, but "yFe"
moves the cursor leftwards to the "e" where the yank started.
+The 'startofline' option applies only to the "d", "<<", "==" and ">>" linewise
+operations.
*linewise* *charwise* *characterwise*
The operator either affects whole lines, or the characters between the start
@@ -162,9 +164,9 @@ h or *h*
CTRL-H or *CTRL-H* *<BS>*
<BS> [count] characters to the left. |exclusive| motion.
Note: If you prefer <BS> to delete a character, use
- the mapping:
+ the mapping: >
:map CTRL-V<BS> X
- (to enter "CTRL-V<BS>" type the CTRL-V key, followed
+< (to enter "CTRL-V<BS>" type the CTRL-V key, followed
by the <BS> key)
l or *l*
@@ -342,6 +344,7 @@ gg Goto line [count], default first line, on the first
*:[range]*
:[range] Set the cursor on the last line number in [range].
+ In Ex mode, print the lines in [range].
[range] can also be just one line number, e.g., ":1"
or ":'m".
In contrast with |G| this command does not modify the
@@ -354,11 +357,11 @@ gg Goto line [count], default first line, on the first
See also 'startofline' option.
:[range]go[to] [count] *:go* *:goto* *go*
-[count]go Go to [count] byte in the buffer. Default [count] is
- one, start of the file. When giving [range], the
- last number in it used as the byte count. End-of-line
- characters are counted depending on the current
- 'fileformat' setting.
+[count]go Go to [count] byte in the buffer. |exclusive| motion.
+ Default [count] is one, start of the file. When
+ giving [range], the last number in it used as the byte
+ count. End-of-line characters are counted depending
+ on the current 'fileformat' setting.
Also see the |line2byte()| function, and the 'o'
option in 'statusline'.
diff --git a/runtime/doc/news-0.10.txt b/runtime/doc/news-0.10.txt
index 8a0e7e92e7..a5ded1ca22 100644
--- a/runtime/doc/news-0.10.txt
+++ b/runtime/doc/news-0.10.txt
@@ -155,8 +155,6 @@ The following new features were added.
• |nvim_input_mouse()| supports mouse buttons "x1" and "x2".
• Added "force_crlf" option field in |nvim_open_term()|.
• Added |nvim_tabpage_set_win()| to set the current window of a tabpage.
- • |nvim__win_add_ns()| can bind a |namespace| to a window-local scope(s).
- • Extmarks opt-in to this scoping via the `scoped` flag of |nvim_buf_set_extmark()|.
• Mapping APIs now support abbreviations when mode short-name has suffix "a".
• Floating windows can now show footer with new `footer` and `footer_pos`
config fields. Uses |hl-FloatFooter| by default.
@@ -307,7 +305,7 @@ The following new features were added.
a predicate function that is checked for each value. (Use
|vim.list_contains()| for checking list-like tables (integer keys without
gaps) for literal values.)
- • |vim.region()| can use a string accepted by |getpos()| as position.
+ • vim.region() can use a string accepted by |getpos()| as position.
• Options:
• 'winfixbuf' keeps a window focused onto a specific buffer
@@ -349,8 +347,8 @@ The following new features were added.
|default-autocmds|
• Treesitter:
- • Bundled parsers and queries (highlight, folds) for Markdown, Python, and
- Bash.
+ • Bundled parser and queries (highlight, folds) for Markdown (used for LSP
+ hover).
• |:InspectTree| shows root nodes.
• |:InspectTree| now supports |folding|.
• |:InspectTree| shows node ranges in 0-based instead of 1-based indexing.
diff --git a/runtime/doc/news-0.9.txt b/runtime/doc/news-0.9.txt
index 7905d6c3e3..3b078cf2cd 100644
--- a/runtime/doc/news-0.9.txt
+++ b/runtime/doc/news-0.9.txt
@@ -92,7 +92,7 @@ The following new APIs or features were added.
showing a text representation of the nodes in a language tree for the current
buffer.
-• |'statuscolumn'| option to customize the area to the side of a window,
+• 'statuscolumn' option to customize the area to the side of a window,
normally containing the fold, sign and number columns. This new option follows
the 'statusline' syntax and can be used to transform the line numbers, create
mouse click callbacks for |signs|, introduce a custom margin or separator etc.
@@ -129,15 +129,17 @@ The following new APIs or features were added.
• When using Nvim inside tmux 3.2 or later, the default clipboard provider
will now copy to the system clipboard. |provider-clipboard|
-• |'showcmdloc'| option to display the 'showcmd' information in the
- status line or tab line. A new %S statusline item is available to place
- the 'showcmd' text in a custom 'statusline'. Useful for when |'cmdheight'|
- is set to 0.
+• 'showcmdloc' option to display the 'showcmd' information in the status
+ line or tab line. A new %S statusline item is available to place the
+ 'showcmd' text in a custom 'statusline'. Useful for when 'cmdheight' is set
+ to 0.
-• |'splitkeep'| option to control the scroll behavior of horizontal splits.
+• 'splitkeep' option to control the scroll behavior of horizontal splits.
-• |'diffopt'| now includes a `linematch` option to enable a second-stage diff
- on individual hunks to provide much more accurate diffs. This option is also
+• 'wildoptions' flag "fuzzy" enables |fuzzy-matching| during |cmdline-completion|.
+
+• 'diffopt' now includes a `linematch` option to enable a second-stage diff on
+ individual hunks to provide much more accurate diffs. This option is also
available to |vim.diff()|
See https://github.com/neovim/neovim/pull/14537.
@@ -235,7 +237,7 @@ The following changes to existing APIs or features add new behavior.
relative to the mouse. Note that the mouse doesn't update frequently without
setting `vim.o.mousemoveevent = true`
-• |nvim_eval_statusline()| supports evaluating the |'statuscolumn'| through a
+• |nvim_eval_statusline()| supports evaluating the 'statuscolumn' through a
new `opts` field: `use_statuscol_lnum`.
• |nvim_buf_get_extmarks()| now accepts a -1 `ns_id` to request extmarks from
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index 708e127136..ed5bd973be 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -18,6 +18,10 @@ BREAKING CHANGES IN HEAD *news-breaking-dev*
The following changes to UNRELEASED features were made during the development
cycle (Nvim HEAD, the "master" branch).
+OPTIONS
+
+• 'jumpoptions' flag "unload" has been renamed to "clean".
+
==============================================================================
BREAKING CHANGES *news-breaking*
@@ -25,20 +29,40 @@ These changes may require adaptations in your config or plugins.
API
+• Improved API "meta" docstrings and :help documentation.
• `vim.rpcnotify(0)` and `rpcnotify(0)` broadcast to ALL channels. Previously
they would "multicast" only to subscribed channels (controlled by
`nvim_subscribe()`). Plugins and clients that want "multicast" behavior must
now maintain their own list of channels.
• In the future, |vim.rpcnotify()| may accept a list of channels, if there
is demand for this use-case.
+• "Dictionary" was renamed to "Dict" internally and in the RPC |api-metadata|.
+ This is not expected to break clients because there are no known clients
+ that actually use the `return_type` field or the parameter type names
+ reported by |--api-info| or |nvim_get_api_info()|.
+• Renamed `nvim__id_dictionary` (unsupported/experimental API) to
+ `nvim__id_dict`.
DEFAULTS
-• TODO
+• |]d-default| and |[d-default| accept a count.
+• |[D-default| and |]D-default| jump to the first and last diagnostic in the
+ current buffer, respectively.
+
+DIAGNOSTICS
+
+• |vim.diagnostic.config()| accepts a "jump" table to specify defaults for
+ |vim.diagnostic.jump()|.
EDITOR
-• The order in which signs are placed was changed. Higher priority signs will now appear left of lower priority signs.
+• The order in which signs are placed was changed. Higher priority signs will
+ now appear left of lower priority signs.
+• |hl-CurSearch| now behaves the same as Vim and no longer updates on every
+ cursor movement.
+• Moving in the buffer list using |:bnext| and similar commands behaves as
+ documented and skips help buffers if run from a non-help buffer, otherwise
+ it moves to another help buffer.
EVENTS
@@ -46,15 +70,26 @@ EVENTS
LSP
-• TODO
+• Improved rendering of LSP hover docs. |K-lsp-default|
+• |vim.lsp.completion.enable()| gained the `convert` callback which enables
+ customizing the transformation of an LSP CompletionItem to |complete-items|.
+• |vim.lsp.diagnostic.from()| can be used to convert a list of
+ |vim.Diagnostic| objects into their LSP diagnostic representation.
LUA
-• TODO
+• API functions now consistently return an empty dictionary as
+ |vim.empty_dict()|. Earlier, a |lua-special-tbl| was sometimes used.
+• Command-line completions for: `vim.g`, `vim.t`, `vim.w`, `vim.b`, `vim.v`,
+ `vim.o`, `vim.wo`, `vim.bo`, `vim.opt`, `vim.opt_local`, `vim.opt_global`,
+ and `vim.fn`.
OPTIONS
-• TODO
+• The 'statuscolumn' `%l` item can now be used as a number column segment that
+ changes according to related options. It takes care of alignment, 'number',
+ 'relativenumber' and 'signcolumn' set to "number". The now redundant `%r` item
+ is no longer treated specially for 'statuscolumn'.
PLUGINS
@@ -62,12 +97,28 @@ PLUGINS
TREESITTER
-• TODO
+• |Query:iter_matches()| correctly returns all matching nodes in a match
+ instead of only the last node. This means that the returned table maps
+ capture IDs to a list of nodes that need to be iterated over. For
+ backwards compatibility, an option `all=false` (only return the last
+ matching node) is provided that will be removed in a future release.
+• |vim.treesitter.language.get_filetypes()| always includes the {language}
+ argument in addition to explicitly registered filetypes.
+• |vim.treesitter.language.get_lang()| falls back to the {filetype} argument
+ if no languages are explicitly registered.
+• |vim.treesitter.language.add()| returns `true` if a parser was loaded
+ successfully and `nil,errmsg` otherwise instead of throwing an error.
TUI
• TODO
+VIMSCRIPT
+
+• |v:msgpack_types| has the type "binary" removed. |msgpackparse()| no longer
+ treats BIN, STR and FIXSTR as separate types. Any of these is returned as a
+ string if possible, or a |blob| if the value contained embedded NUL:s.
+
==============================================================================
NEW FEATURES *news-features*
@@ -75,35 +126,67 @@ The following new features were added.
API
-• TODO
+• |nvim__ns_set()| can set properties for a namespace
DEFAULTS
-• Keymaps:
- - |grn| in Normal mode maps to |vim.lsp.buf.rename()|
- - |grr| in Normal mode maps to |vim.lsp.buf.references()|
- - |gra| in Normal and Visual mode maps to |vim.lsp.buf.code_action()|
- - CTRL-S in Insert mode maps to |vim.lsp.buf.signature_help()|
+• Highlighting:
+ • Improved styling of :checkhealth and :help buffers.
+
+• Mappings:
+ • |grn| in Normal mode maps to |vim.lsp.buf.rename()|
+ • |grr| in Normal mode maps to |vim.lsp.buf.references()|
+ • |gra| in Normal and Visual mode maps to |vim.lsp.buf.code_action()|
+ • CTRL-S in Insert mode maps to |vim.lsp.buf.signature_help()|
+ • Mouse |popup-menu| includes an "Open in web browser" item when you right-click
+ on a URL.
+ • Mouse |popup-menu| includes a "Go to definition" item when LSP is active
+ in the buffer.
+ • Mappings inspired by Tim Pope's vim-unimpaired:
+ • |[q|, |]q|, |[Q|, |]Q|, |[CTRL-Q|, |]CTRL-Q| navigate through the |quickfix| list
+ • |[l|, |]l|, |[L|, |]L|, |[CTRL-L|, |]CTRL-L| navigate through the |location-list|
+ • |[t|, |]t|, |[T|, |]T|, |[CTRL-T|, |]CTRL-T| navigate through the |tag-matchlist|
+ • |[a|, |]a|, |[A|, |]A| navigate through the |argument-list|
+ • |[b|, |]b|, |[B|, |]B| navigate through the |buffer-list|
+
+• Snippet:
+ • `<Tab>` in Insert and Select mode maps to `vim.snippet.jump({ direction = 1 })`
+ when a snippet is active and jumpable forwards.
+ • `<S-Tab>` in Insert and Select mode maps to `vim.snippet.jump({ direction = -1 })`
+ when a snippet is active and jumpable backwards.
EDITOR
-• TODO
+• Improved |paste| handling for redo (dot-repeat) and macros (|recording|):
+ • Redoing a large paste is significantly faster and ignores 'autoindent'.
+ • Replaying a macro with |@| also replays pasted text.
+• On Windows, filename arguments on the command-line prefixed with "~\" or
+ "~/" are now expanded to the user's profile directory, not a relative path
+ to a literal "~" directory.
+• |hl-PmenuMatch| and |hl-PmenuMatchSel| show matched text in completion popup.
EVENTS
-• TODO
+• |CompleteDone| now sets the `reason` key in `v:event` which specifies the reason
+ for completion being done.
LSP
-• TODO
+• Completion side effects (including snippet expansion, execution of commands
+ and application of additional text edits) is now built-in.
+• |vim.lsp.util.locations_to_items()| sets `end_col` and `end_lnum` fields.
+• |vim.lsp.buf.format()| now supports passing a list of ranges
+ via the `range` parameter (this requires support for the
+ `textDocument/rangesFormatting` request).
LUA
-• TODO
+• |vim.fs.rm()| can delete files and directories.
OPTIONS
-• TODO
+• 'completeopt' flag "fuzzy" enables |fuzzy-matching| during |ins-completion|.
+• 'tabclose' controls which tab page to focus when closing a tab page.
PERFORMANCE
@@ -111,38 +194,65 @@ PERFORMANCE
PLUGINS
-• TODO
+• EditorConfig
+ • spelling_language property is now supported.
STARTUP
-• TODO
+• Nvim will fail if the |--listen| or |$NVIM_LISTEN_ADDRESS| address is
+ invalid, instead of silently skipping an invalid address.
TERMINAL
-• TODO
+• The |terminal| now understands the OSC 52 escape sequence to write to the
+ system clipboard (copy). Querying with OSC 52 (paste) is not supported.
+• |hl-StatusLineTerm| and |hl-StatusLineTermNC| define highlights for the
+ status line in |terminal| windows.
+• 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.
+• The |terminal| now supports OSC 8 escape sequences and will display
+ hyperlinks in supporting host terminals.
TREESITTER
-• TODO
+• |LanguageTree:node_for_range()| gets anonymous and named nodes for a range
+• |vim.treesitter.get_node()| now takes an option `include_anonymous`, default
+ false, which allows it to return anonymous nodes as well as named nodes.
TUI
-• TODO
+• The builtin UI declares info |nvim_set_client_info()| on its channel. See
+ |startup-tui|. To see the current UI info, try this: >
+ :lua =vim.api.nvim_get_chan_info(vim.api.nvim_list_uis()[1].chan)
+• |log| messages written by the builtin UI client (TUI, |--remote-ui|) are
+ now prefixed with "ui" instead of "?".
UI
-• TODO
-
-
-• |CompleteDone| now sets the `reason` key in `v:event` which specifies the reason
- for completion being done.
+• |vim.ui.open()| (by default bound to |gx|) accepts an `opt.cmd` parameter
+ which controls the tool used to open the given path or URL. If you want to
+ globally set this, you can override vim.ui.open using the same approach
+ described at |vim.paste()|.
==============================================================================
CHANGED FEATURES *news-changed*
These existing features changed their behavior.
-• N/A
+• 'scrollbind' now works properly with buffers that contain virtual lines.
+
+ Scrollbind works by aligning to a target top line of each window in a tab
+ page. Previously this was done by calculating the difference between the old
+ top line and the target top line, and scrolling by that amount. Now the
+ top lines are calculated using screen line numbers which take virtual lines
+ into account.
+
+• The implementation of grapheme clusters (or combining chars |mbyte-combining|)
+ was upgraded to closely follow extended grapheme clusters as defined by UAX#29
+ in the unicode standard. Noteworthily, this enables proper display of many
+ more emoji characters than before, including those encoded with multiple
+ emoji codepoints combined with ZWJ (zero width joiner) codepoints.
==============================================================================
REMOVED FEATURES *news-removed*
diff --git a/runtime/doc/nvim.txt b/runtime/doc/nvim.txt
index ef407922da..f8eba3f7f8 100644
--- a/runtime/doc/nvim.txt
+++ b/runtime/doc/nvim.txt
@@ -4,7 +4,7 @@
NVIM REFERENCE MANUAL
-Nvim *nvim* *nvim-intro*
+Nvim *neovim* *nvim* *nvim-intro*
Nvim is based on Vim by Bram Moolenaar.
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 5570e62ab8..6dd062124b 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -58,7 +58,8 @@ achieve special effects. These options come in three forms:
:se[t] {option}:{value}
Set string or number option to {value}.
For numeric options the value can be given in decimal,
- hex (preceded with 0x) or octal (preceded with '0').
+ hex (preceded with 0x) or octal (preceded with '0' or
+ '0o').
The old value can be inserted by typing 'wildchar' (by
default this is a <Tab>). Many string options with
fixed syntax also support completing known values.
@@ -332,13 +333,14 @@ between string and number-based options.
options which are different from the default.
For buffer-local and window-local options:
- Command global value local value ~
- :set option=value set set
- :setlocal option=value - set
-:setglobal option=value set -
- :set option? - display
- :setlocal option? - display
-:setglobal option? display -
+ Command global value local value condition ~
+ :set option=value set set
+ :setlocal option=value - set
+:setglobal option=value set -
+ :set option? - display local value is set
+ :set option? display - local value is not set
+ :setlocal option? - display
+:setglobal option? display -
Global options with a local value *global-local*
@@ -383,15 +385,37 @@ the name, e.g. "<lambda>123". Examples:
set opfunc=function('MyOpFunc')
set opfunc=funcref('MyOpFunc')
set opfunc={a\ ->\ MyOpFunc(a)}
- " set using a funcref variable
+
+Set to a script-local function: >
+ set opfunc=s:MyLocalFunc
+ set opfunc=<SID>MyLocalFunc
+
+Set using a funcref variable: >
let Fn = function('MyTagFunc')
let &tagfunc = Fn
- " set using a lambda expression
+
+Set using a lambda expression: >
let &tagfunc = {t -> MyTagFunc(t)}
- " set using a variable with lambda expression
+
+Set using a variable with lambda expression: >
let L = {a, b, c -> MyTagFunc(a, b , c)}
let &tagfunc = L
-<
+
+Calling a function in an expr option *expr-option-function*
+
+The value of a few options, such as 'foldexpr', is an expression that is
+evaluated to get a value. The evaluation can have quite a bit of overhead.
+One way to minimize the overhead, and also to keep the option value very
+simple, is to define a function and set the option to call it without
+arguments. A |v:lua-call| can also be used. Example: >vim
+ lua << EOF
+ function _G.MyFoldFunc()
+ -- ... compute fold level for line v:lnum
+ return level
+ end
+ EOF
+ set foldexpr=v:lua.MyFoldFunc()
+
Setting the filetype
@@ -1092,7 +1116,7 @@ A jump table for the options with a short description can be found at |Q_op|.
applying 'breakindent', even if the resulting
text should normally be narrower. This prevents
text indented almost to the right window border
- occupying lot of vertical space when broken.
+ occupying lots of vertical space when broken.
(default: 20)
shift:{n} After applying 'breakindent', the wrapped line's
beginning will be shifted by the given number of
@@ -1106,9 +1130,9 @@ A jump table for the options with a short description can be found at |Q_op|.
list:{n} Adds an additional indent for lines that match a
numbered or bulleted list (using the
'formatlistpat' setting).
- list:-1 Uses the length of a match with 'formatlistpat'
- for indentation.
(default: 0)
+ list:-1 Uses the width of a match with 'formatlistpat' for
+ indentation.
column:{n} Indent at column {n}. Will overrule the other
sub-options. Note: an additional indent may be
added for the 'showbreak' setting.
@@ -1252,9 +1276,10 @@ 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: >vim
- exe "set cedit=\<C-Y>"
- exe "set cedit=\<Esc>"
+ type. The preferred way is to use |key-notation| (e.g. <Up>, <C-F>) or
+ a letter preceded with a caret (e.g. `^F` is CTRL-F). Examples: >vim
+ set cedit=^Y
+ set cedit=<Esc>
< |Nvi| also has this option, but it only uses the first character.
See |cmdwin|.
@@ -1298,6 +1323,17 @@ A jump table for the options with a short description can be found at |Q_op|.
v:fname_in name of the input file
v:fname_out name of the output file
Note that v:fname_in and v:fname_out will never be the same.
+
+ The advantage of using a function call without arguments is that it is
+ faster, see |expr-option-function|.
+
+ If the 'charconvert' expression starts with s: or |<SID>|, then it is
+ replaced with the script ID (|local-function|). Example: >vim
+ set charconvert=s:MyConvert()
+ set charconvert=<SID>SomeConvert()
+< Otherwise the expression is evaluated in the context of the script
+ where the option was set, thus script-local items are available.
+
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
@@ -1388,11 +1424,10 @@ A jump table for the options with a short description can be found at |Q_op|.
used. The command-line will cover the last line of the screen when
shown.
- WARNING: `cmdheight=0` is considered experimental. Expect some
- unwanted behaviour. Some 'shortmess' flags and similar
- mechanism might fail to take effect, causing unwanted hit-enter
- prompts. Some informative messages, both from Nvim itself and
- plugins, will not be displayed.
+ WARNING: `cmdheight=0` is EXPERIMENTAL. Expect some unwanted behaviour.
+ Some 'shortmess' flags and similar mechanism might fail to take effect,
+ causing unwanted hit-enter prompts. Some informative messages, both
+ from Nvim itself and plugins, will not be displayed.
*'cmdwinheight'* *'cwh'*
'cmdwinheight' 'cwh' number (default 7)
@@ -1442,8 +1477,8 @@ A jump table for the options with a short description can be found at |Q_op|.
'commentstring' 'cms' string (default "")
local to buffer
A template for a comment. The "%s" in the value is replaced with the
- comment text. For example, C uses "/*%s*/". Used for |commenting| and to
- add markers for folding, see |fold-marker|.
+ comment text, and should be padded with a space when possible.
+ Used for |commenting| and to add markers for folding, see |fold-marker|.
*'complete'* *'cpt'* *E535*
'complete' 'cpt' string (default ".,w,b,u,t")
@@ -1493,9 +1528,19 @@ 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.
+ *'completeitemalign'* *'cia'*
+'completeitemalign' 'cia' string (default "abbr,kind,menu")
+ global
+ A comma-separated list of |complete-items| that controls the alignment
+ and display order of items in the popup menu during Insert mode
+ completion. The supported values are abbr, kind, and menu. These
+ options allow to customize how the completion items are shown in the
+ popup menu. Note: must always contain those three values in any
+ order.
+
*'completeopt'* *'cot'*
'completeopt' 'cot' string (default "menu,preview")
- global
+ global or local to buffer |global-local|
A comma-separated list of options for Insert mode completion
|ins-completion|. The supported values are:
@@ -1517,6 +1562,10 @@ 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".
+ popup Show extra information about the currently selected
+ completion in a popup window. Only works in combination
+ with "menu" or "menuone". Overrides "preview".
+
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.
@@ -1525,9 +1574,13 @@ A jump table for the options with a short description can be found at |Q_op|.
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".
+ fuzzy Enable |fuzzy-matching| for completion candidates. This
+ allows for more flexible and intuitive matching, where
+ characters can be skipped and matches can be found even
+ if the exact sequence is not typed. Only makes a
+ difference how completion candidates are reduced from the
+ list of alternatives, but not how the candidates are
+ collected (using different completion types).
*'completeslash'* *'csl'*
'completeslash' 'csl' string (default "")
@@ -2175,9 +2228,12 @@ A jump table for the options with a short description can be found at |Q_op|.
global
When on all Unicode emoji characters are considered to be full width.
This excludes "text emoji" characters, which are normally displayed as
- single width. Unfortunately there is no good specification for this
- and it has been determined on trial-and-error basis. Use the
- |setcellwidths()| function to change the behavior.
+ single width. However, such "text emoji" are treated as full-width
+ emoji if they are followed by the U+FE0F variant selector.
+
+ Unfortunately there is no good specification for this and it has been
+ determined on trial-and-error basis. Use the |setcellwidths()|
+ function to change the behavior.
*'encoding'* *'enc'*
'encoding' 'enc' string (default "utf-8")
@@ -2483,14 +2539,14 @@ A jump table for the options with a short description can be found at |Q_op|.
/* vim: set filetype=idl : */
< |FileType| |filetypes|
When a dot appears in the value then this separates two filetype
- names. Example: >c
+ names, it should therefore not be used for a filetype. 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
one dot may appear.
This option is not copied to another buffer, independent of the 's' or
'S' flag in 'cpoptions'.
- Only normal file name characters can be used, `/\*?[|<>` are illegal.
+ Only alphanumeric characters, '-' and '_' can be used.
*'fillchars'* *'fcs'*
'fillchars' 'fcs' string (default "")
@@ -2749,6 +2805,9 @@ A jump table for the options with a short description can be found at |Q_op|.
< This will invoke the mylang#Format() function in the
autoload/mylang.vim file in 'runtimepath'. |autoload|
+ The advantage of using a function call without arguments is that it is
+ faster, see |expr-option-function|.
+
The expression is also evaluated when 'textwidth' is set and adding
text beyond that limit. This happens under the same conditions as
when internal formatting is used. Make sure the cursor is kept in the
@@ -3384,11 +3443,14 @@ A jump table for the options with a short description can be found at |Q_op|.
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)
+ setlocal includeexpr=s:MyIncludeExpr()
+ setlocal includeexpr=<SID>SomeIncludeExpr()
< Otherwise, the expression is evaluated in the context of the script
where the option was set, thus script-local items are available.
+ It is more efficient if the value is just a function call without
+ arguments, see |expr-option-function|.
+
The expression will be evaluated in the |sandbox| when set from a
modeline, see |sandbox-option|.
This option cannot be set in a modeline when 'modelineexpr' is off.
@@ -3439,7 +3501,7 @@ A jump table for the options with a short description can be found at |Q_op|.
in Insert mode as specified with the 'indentkeys' option.
When this option is not empty, it overrules the 'cindent' and
'smartindent' indenting. When 'lisp' is set, this option is
- is only used when 'lispoptions' contains "expr:1".
+ only used when 'lispoptions' contains "expr:1".
The expression is evaluated with |v:lnum| set to the line number for
which the indent is to be computed. The cursor is also in this line
when the expression is evaluated (but it may be moved around).
@@ -3451,6 +3513,9 @@ A jump table for the options with a short description can be found at |Q_op|.
< Otherwise, the expression is evaluated in the context of the script
where the option was set, thus script-local items are available.
+ The advantage of using a function call without arguments is that it is
+ faster, see |expr-option-function|.
+
The expression must return the number of spaces worth of indent. It
can return "-1" to keep the current indent (this means 'autoindent' is
used for the indent).
@@ -3611,7 +3676,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Otherwise only one space is inserted.
*'jumpoptions'* *'jop'*
-'jumpoptions' 'jop' string (default "")
+'jumpoptions' 'jop' string (default "clean")
global
List of words that change the behavior of the |jumplist|.
stack Make the jumplist behave like the tagstack.
@@ -3624,6 +3689,9 @@ A jump table for the options with a short description can be found at |Q_op|.
|alternate-file| or using |mark-motions| try to
restore the |mark-view| in which the action occurred.
+ clean Remove unloaded buffers from the jumplist.
+ EXPERIMENTAL: this flag may change in the future.
+
*'keymap'* *'kmp'*
'keymap' 'kmp' string (default "")
local to buffer
@@ -3631,7 +3699,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Setting this option to a valid keymap name has the side effect of
setting 'iminsert' to one, so that the keymap becomes effective.
'imsearch' is also set to one, unless it was -1
- Only normal file name characters can be used, `/\*?[|<>` are illegal.
+ Only alphanumeric characters, '.', '-' and '_' can be used.
*'keymodel'* *'km'*
'keymodel' 'km' string (default "")
@@ -3688,7 +3756,7 @@ A jump table for the options with a short description can be found at |Q_op|.
part can be in one of two forms:
1. A list of pairs. Each pair is a "from" character immediately
followed by the "to" character. Examples: "aA", "aAbBcC".
- 2. A list of "from" characters, a semi-colon and a list of "to"
+ 2. A list of "from" characters, a semicolon and a list of "to"
characters. Example: "abc;ABC"
Example: "aA,fgh;FGH,cCdDeE"
Special characters need to be preceded with a backslash. These are
@@ -3756,7 +3824,7 @@ A jump table for the options with a short description can be found at |Q_op|.
update use |:redraw|.
This may occasionally cause display errors. It is only meant to be set
temporarily when performing an operation where redrawing may cause
- flickering or cause a slow down.
+ flickering or cause a slowdown.
*'linebreak'* *'lbr'* *'nolinebreak'* *'nolbr'*
'linebreak' 'lbr' boolean (default off)
@@ -3834,6 +3902,9 @@ A jump table for the options with a short description can be found at |Q_op|.
between tabs and spaces and for trailing blanks. Further changed by
the 'listchars' option.
+ When 'listchars' does not contain "tab" field, tabs are shown as "^I"
+ or "<09>", like how unprintable characters are displayed.
+
The cursor is displayed at the start of the space a Tab character
occupies, not at the end as usual in Normal mode. To get this cursor
position while displaying Tabs with spaces, use: >vim
@@ -4416,6 +4487,20 @@ A jump table for the options with a short description can be found at |Q_op|.
(without "unsigned" it would become "9-2019").
Using CTRL-X on "0" or CTRL-A on "18446744073709551615"
(2^64 - 1) has no effect, overflow is prevented.
+ blank If included, treat numbers as signed or unsigned based on
+ preceding whitespace. If a number with a leading dash has its
+ dash immediately preceded by a non-whitespace character (i.e.,
+ not a tab or a " "), the negative sign won't be considered as
+ part of the number. For example:
+ Using CTRL-A on "14" in "Carbon-14" results in "Carbon-15"
+ (without "blank" it would become "Carbon-13").
+ Using CTRL-X on "8" in "Carbon -8" results in "Carbon -9"
+ (because -8 is preceded by whitespace. If "unsigned" was
+ set, it would result in "Carbon -7").
+ If this format is included, overflow is prevented as if
+ "unsigned" were set. If both this format and "unsigned" are
+ included, "unsigned" will take precedence.
+
Numbers which simply begin with a digit in the range 1-9 are always
considered decimal. This also happens for numbers that are not
recognized as octal or hex.
@@ -4582,7 +4667,7 @@ A jump table for the options with a short description can be found at |Q_op|.
set path+=
< To use an environment variable, you probably need to replace the
separator. Here is an example to append $INCL, in which directory
- names are separated with a semi-colon: >vim
+ names are separated with a semicolon: >vim
let &path = &path .. "," .. substitute($INCL, ';', ',', 'g')
< Replace the ';' with a ':' or whatever separator is used. Note that
this doesn't work when $INCL contains a comma or white space.
@@ -4960,6 +5045,9 @@ A jump table for the options with a short description can be found at |Q_op|.
Minimum is 1, maximum is 100000.
Only in |terminal| buffers.
+ Note: Lines that are not visible and kept in scrollback are not
+ reflown when the terminal buffer is resized horizontally.
+
*'scrollbind'* *'scb'* *'noscrollbind'* *'noscb'*
'scrollbind' 'scb' boolean (default off)
local to window
@@ -5442,7 +5530,7 @@ A jump table for the options with a short description can be found at |Q_op|.
'shortmess' 'shm' string (default "ltToOCF")
global
This option helps to avoid all the |hit-enter| prompts caused by file
- messages, for example with CTRL-G, and to avoid some other messages.
+ messages, for example with CTRL-G, and to avoid some other messages.
It is a list of flags:
flag meaning when present ~
l use "999L, 888B" instead of "999 lines, 888 bytes" *shm-l*
@@ -5459,8 +5547,8 @@ A jump table for the options with a short description can be found at |Q_op|.
message; also for quickfix message (e.g., ":cn")
s don't give "search hit BOTTOM, continuing at TOP" or *shm-s*
"search hit TOP, continuing at BOTTOM" messages; when using
- the search count do not show "W" after the count message (see
- S below)
+ the search count do not show "W" before the count message
+ (see |shm-S| below)
t truncate file message at the start if it is too long *shm-t*
to fit on the command-line, "<" will appear in the left most
column; ignored in Ex mode
@@ -5482,7 +5570,11 @@ A jump table for the options with a short description can be found at |Q_op|.
`: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]"
+ "[1/5]". When the "S" flag is not present (e.g. search count
+ is shown), the "search hit BOTTOM, continuing at TOP" and
+ "search hit TOP, continuing at BOTTOM" messages are only
+ indicated by a "W" (Mnemonic: Wrapped) letter before the
+ search count statistics.
This gives you the opportunity to avoid that a change between buffers
requires you to hit <Enter>, but still gives as useful a message as
@@ -5847,7 +5939,7 @@ A jump table for the options with a short description can be found at |Q_op|.
minus two.
timeout:{millisec} Limit the time searching for suggestions to
- {millisec} milli seconds. Applies to the following
+ {millisec} milliseconds. Applies to the following
methods. When omitted the limit is 5000. When
negative there is no limit.
@@ -5867,9 +5959,11 @@ A jump table for the options with a short description can be found at |Q_op|.
The file is used for all languages.
expr:{expr} Evaluate expression {expr}. Use a function to avoid
- trouble with spaces. |v:val| holds the badly spelled
- word. The expression must evaluate to a List of
- Lists, each with a suggestion and a score.
+ trouble with spaces. Best is to call a function
+ without arguments, see |expr-option-function|.
+ |v:val| holds the badly spelled word. The expression
+ must evaluate to a List of Lists, each with a
+ suggestion and a score.
Example:
[['the', 33], ['that', 44]] ~
Set 'verbose' and use |z=| to see the scores that the
@@ -5921,7 +6015,8 @@ A jump table for the options with a short description can be found at |Q_op|.
non-blank of the line. When off the cursor is kept in the same column
(if possible). This applies to the commands:
- CTRL-D, CTRL-U, CTRL-B, CTRL-F, "G", "H", "M", "L", "gg"
- - "d", "<<" and ">>" with a linewise operator
+ - "d", "<<", "==" and ">>" with a linewise operator
+ (|operator-resulting-pos|)
- "%" with a count
- buffer changing commands (CTRL-^, :bnext, :bNext, etc.)
- Ex commands that only have a line number, e.g., ":25" or ":+".
@@ -5931,7 +6026,6 @@ A jump table for the options with a short description can be found at |Q_op|.
*'statuscolumn'* *'stc'*
'statuscolumn' 'stc' string (default "")
local to window
- EXPERIMENTAL
When non-empty, this option determines the content of the area to the
side of a window, normally containing the fold, sign and number columns.
The format of this option is like that of 'statusline'.
@@ -5939,8 +6033,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Some of the items from the 'statusline' format are different for
'statuscolumn':
- %l line number of currently drawn line
- %r relative line number of currently drawn line
+ %l line number column for currently drawn line
%s sign column for currently drawn line
%C fold column for currently drawn line
@@ -5967,11 +6060,8 @@ A jump table for the options with a short description can be found at |Q_op|.
handler should be written with this in mind.
Examples: >vim
- " Relative number with bar separator and click handlers:
- set statuscolumn=%@SignCb@%s%=%T%@NumCb@%r│%T
-
- " Right aligned relative cursor line number:
- let &stc='%=%{v:relnum?v:relnum:v:lnum} '
+ " Line number with bar separator and click handlers:
+ set statuscolumn=%@SignCb@%s%=%T%@NumCb@%l│%T
" Line numbers in hexadecimal for non wrapped part of lines:
let &stc='%=%{v:virtnum>0?"":printf("%x",v:lnum)} '
@@ -6313,7 +6403,20 @@ A jump table for the options with a short description can be found at |Q_op|.
Syntax autocommand event is triggered with the value as argument.
This option is not copied to another buffer, independent of the 's' or
'S' flag in 'cpoptions'.
- Only normal file name characters can be used, `/\*?[|<>` are illegal.
+ Only alphanumeric characters, '.', '-' and '_' can be used.
+
+ *'tabclose'* *'tcl'*
+'tabclose' 'tcl' string (default "")
+ global
+ This option controls the behavior when closing tab pages (e.g., using
+ |:tabclose|). When empty Vim goes to the next (right) tab page.
+
+ Possible values (comma-separated list):
+ left If included, go to the previous tab page instead of
+ the next one.
+ uselast If included, go to the previously used tab page if
+ possible. This option takes precedence over the
+ others.
*'tabline'* *'tal'*
'tabline' 'tal' string (default "")
@@ -6621,7 +6724,7 @@ A jump table for the options with a short description can be found at |Q_op|.
global
When on, the title of the window will be set to the value of
'titlestring' (if it is not empty), or to:
- filename [+=-] (path) - NVIM
+ filename [+=-] (path) - Nvim
Where:
filename the name of the file being edited
- indicates the file cannot be modified, 'ma' off
@@ -6629,7 +6732,7 @@ A jump table for the options with a short description can be found at |Q_op|.
= indicates the file is read-only
=+ indicates the file is read-only and modified
(path) is the path of the file being edited
- - NVIM the server name |v:servername| or "NVIM"
+ - Nvim the server name |v:servername| or "Nvim"
*'titlelen'*
'titlelen' number (default 85)
@@ -7022,7 +7125,12 @@ 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: >vim
+ Although 'wc' is a number option, it can be specified as a number, a
+ single character, a |key-notation| (e.g. <Up>, <C-F>) or a letter
+ preceded with a caret (e.g. `^F` is CTRL-F): >vim
+ :set wc=27
+ :set wc=X
+ :set wc=^I
set wc=<Tab>
<
diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt
index 1ef182127c..8ec02276cc 100644
--- a/runtime/doc/pattern.txt
+++ b/runtime/doc/pattern.txt
@@ -141,13 +141,17 @@ CTRL-C Interrupt current (search) command.
executing autocommands |autocmd-searchpat|.
Same thing for when invoking a user function.
+
While typing the search pattern the current match will be shown if the
'incsearch' option is on. Remember that you still have to finish the search
command with <CR> to actually position the cursor at the displayed match. Or
use <Esc> to abandon the search.
+ *nohlsearch-auto*
All matches for the last used search pattern will be highlighted if you set
-the 'hlsearch' option. This can be suspended with the |:nohlsearch| command.
+the 'hlsearch' option. This can be suspended with the |:nohlsearch| command
+or auto suspended with nohlsearch plugin. See |nohlsearch-install|.
+
When 'shortmess' does not include the "S" flag, Vim will automatically show an
index, on which the cursor is. This can look like this: >
@@ -1494,5 +1498,7 @@ the matching positions and the fuzzy match scores.
The "f" flag of `:vimgrep` enables fuzzy matching.
+To enable fuzzy matching for |ins-completion|, add the "fuzzy" value to the
+'completeopt' option.
vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt
index 81acd9cf7e..0652fb27e7 100644
--- a/runtime/doc/pi_netrw.txt
+++ b/runtime/doc/pi_netrw.txt
@@ -3858,7 +3858,7 @@ netrw:
netrw-safe guioptions
Nov 15, 2021 * removed netrw_localrm and netrw_localrmdir
references
- Aug 18, 2022 * (Miguel Barro) improving compatability with
+ Aug 18, 2022 * (Miguel Barro) improving compatibility with
powershell
v171: Oct 09, 2020 * included code in s:NetrwOptionsSafe()
to allow |'bh'| to be set to delete when
diff --git a/runtime/doc/provider.txt b/runtime/doc/provider.txt
index a39f4bc5d7..f1b0daee76 100644
--- a/runtime/doc/provider.txt
+++ b/runtime/doc/provider.txt
@@ -194,6 +194,8 @@ registers. Nvim looks for these clipboard tools, in order of priority:
- lemonade (for SSH) https://github.com/pocke/lemonade
- doitclient (for SSH) https://www.chiark.greenend.org.uk/~sgtatham/doit/
- win32yank (Windows)
+ - putclip, getclip (Windows) https://cygwin.com/packages/summary/cygutils.html
+ - clip, powershell (Windows) https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/clip
- termux (via termux-clipboard-set, termux-clipboard-set)
- tmux (if $TMUX is set)
@@ -248,8 +250,8 @@ For Windows WSL, try this g:clipboard definition:
\ '*': 'clip.exe',
\ },
\ 'paste': {
- \ '+': 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
- \ '*': 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
+ \ '+': 'powershell.exe -NoLogo -NoProfile -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
+ \ '*': 'powershell.exe -NoLogo -NoProfile -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
\ },
\ 'cache_enabled': 0,
\ }
diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt
index 5d3c0cbdc2..63109bdaf3 100644
--- a/runtime/doc/quickfix.txt
+++ b/runtime/doc/quickfix.txt
@@ -91,24 +91,24 @@ processing a quickfix or location list command, it will be aborted.
:ll[!] [nr] Same as ":cc", except the location list for the
:[nr]ll[!] current window is used instead of the quickfix list.
- *:cn* *:cne* *:cnext* *E553*
+ *:cn* *:cne* *:cnext* *E553* *]q*
:[count]cn[ext][!] Display the [count] next error in the list that
includes a file name. If there are no file names at
all, go to the [count] next error. See |:cc| for
[!] and 'switchbuf'.
- *:lne* *:lnext*
+ *:lne* *:lnext* *]l*
:[count]lne[xt][!] Same as ":cnext", except the location list for the
current window is used instead of the quickfix list.
-:[count]cN[ext][!] *:cp* *:cprevious* *:cprev* *:cN* *:cNext*
+:[count]cN[ext][!] *:cp* *:cprevious* *:cprev* *:cN* *:cNext* *[q*
:[count]cp[revious][!] Display the [count] previous error in the list that
includes a file name. If there are no file names at
all, go to the [count] previous error. See |:cc| for
[!] and 'switchbuf'.
-:[count]lN[ext][!] *:lp* *:lprevious* *:lprev* *:lN* *:lNext*
+:[count]lN[ext][!] *:lp* *:lprevious* *:lprev* *:lN* *:lNext* *[l*
:[count]lp[revious][!] Same as ":cNext" and ":cprevious", except the location
list for the current window is used instead of the
quickfix list.
@@ -171,18 +171,18 @@ processing a quickfix or location list command, it will be aborted.
:[count]laf[ter] Same as ":cafter", except the location list for the
current window is used instead of the quickfix list.
- *:cnf* *:cnfile*
+ *:cnf* *:cnfile* *]CTRL-Q*
:[count]cnf[ile][!] Display the first error in the [count] next file in
the list that includes a file name. If there are no
file names at all or if there is no next file, go to
the [count] next error. See |:cc| for [!] and
'switchbuf'.
- *:lnf* *:lnfile*
+ *:lnf* *:lnfile* *]CTRL-L*
:[count]lnf[ile][!] Same as ":cnfile", except the location list for the
current window is used instead of the quickfix list.
-:[count]cNf[ile][!] *:cpf* *:cpfile* *:cNf* *:cNfile*
+:[count]cNf[ile][!] *:cpf* *:cpfile* *:cNf* *:cNfile* *[CTRL-Q*
:[count]cpf[ile][!] Display the last error in the [count] previous file in
the list that includes a file name. If there are no
file names at all or if there is no next file, go to
@@ -190,16 +190,16 @@ processing a quickfix or location list command, it will be aborted.
'switchbuf'.
-:[count]lNf[ile][!] *:lpf* *:lpfile* *:lNf* *:lNfile*
+:[count]lNf[ile][!] *:lpf* *:lpfile* *:lNf* *:lNfile* *[CTRL-L*
:[count]lpf[ile][!] Same as ":cNfile" and ":cpfile", except the location
list for the current window is used instead of the
quickfix list.
- *:crewind* *:cr*
+ *:crewind* *:cr* *[Q*
:cr[ewind][!] [nr] Display error [nr]. If [nr] is omitted, the FIRST
error is displayed. See |:cc|.
- *:lrewind* *:lr*
+ *:lrewind* *:lr* *[L*
:lr[ewind][!] [nr] Same as ":crewind", except the location list for the
current window is used instead of the quickfix list.
@@ -209,11 +209,11 @@ processing a quickfix or location list command, it will be aborted.
*:lfirst* *:lfir*
:lfir[st][!] [nr] Same as ":lrewind".
- *:clast* *:cla*
+ *:clast* *:cla* *]Q*
:cla[st][!] [nr] Display error [nr]. If [nr] is omitted, the LAST
error is displayed. See |:cc|.
- *:llast* *:lla*
+ *:llast* *:lla* *]L*
:lla[st][!] [nr] Same as ":clast", except the location list for the
current window is used instead of the quickfix list.
@@ -994,7 +994,7 @@ Another option is using 'makeencoding'.
==============================================================================
5. Using :vimgrep and :grep *grep* *lid*
-Vim has two ways to find matches for a pattern: Internal and external. The
+Vim has two ways to find matches for a pattern: internal and external. The
advantage of the internal grep is that it works on all systems and uses the
powerful Vim search patterns. An external grep program can be used when the
Vim grep does not do what you want.
@@ -1023,7 +1023,7 @@ commands can be combined to create a NewGrep command: >
command! -nargs=+ NewGrep execute 'silent grep! <args>' | copen 42
-5.1 using Vim's internal grep
+5.1 Using Vim's internal grep
*:vim* *:vimgrep* *E682* *E683*
:vim[grep][!] /{pattern}/[g][j][f] {file} ...
@@ -1080,8 +1080,8 @@ commands can be combined to create a NewGrep command: >
:vim[grep][!] {pattern} {file} ...
Like above, but instead of enclosing the pattern in a
- non-ID character use a white-separated pattern. The
- pattern must start with an ID character.
+ non-ID character use a white space separated pattern.
+ The pattern must start with an ID character.
Example: >
:vimgrep Error *.c
<
@@ -1262,6 +1262,33 @@ not "b:current_compiler". What the command actually does is the following:
For writing a compiler plugin, see |write-compiler-plugin|.
+Use the |compiler-make| plugin to undo the effect of a compiler plugin.
+
+CPPCHECK *quickfix-cppcheck* *compiler-cppcheck*
+
+Use g/b:`c_cppcheck_params` to set cppcheck parameters. The global
+settings by default include
+
+- `--verbose`: Enables verbose output.
+- `--force`: Forces checking of all configurations.
+- `--inline-suppr`: Allows inline suppressions.
+- `--enable=...`: Enables specific checks like warnings, style, performance,
+ portability, information, and missing includes.
+- `-j`: Utilizes multiple processors if available, determined by the
+ `getconf` command if available (requires omitting the unusedFunction check)
+
+For C++ files (`filetype == 'cpp'`), the `--language=c++` option is added to
+ensure Cppcheck treats the file as C++.
+
+If compile_commands.json is present in the current directory, it is added as a
+`--project` parameter to the command line. Otherwise, by default the
+directories in &path are passed as include directories. These can be set by
+g/b:`c_cppcheck_includes` as a list of `-I` flags. Tim Pope's vim-apathy
+plug-in [0] can expand &path. To also append the folders in a git repo use >
+
+ let &l:path = join(systemlist('git ls-tree -d --name-only -r HEAD'), ',')
+
+[0] https://github.com/tpope/vim-apathy
DOTNET *compiler-dotnet*
@@ -1277,7 +1304,6 @@ Example: limit output to only display errors, and suppress the project name: >
let dotnet_show_project_file = v:false
compiler dotnet
<
-
GCC *quickfix-gcc* *compiler-gcc*
There's one variable you can set for the GCC compiler:
@@ -1288,6 +1314,31 @@ g:compiler_gcc_ignore_unmatched_lines
commands run from make are generating false
positives.
+JAVAC *compiler-javac*
+
+Commonly used compiler options can be added to 'makeprg' by setting the
+g:javac_makeprg_params variable. For example: >
+ let g:javac_makeprg_params = "-Xlint:all -encoding utf-8"
+<
+GNU MAKE *compiler-make*
+
+Since the default make program is "make", the compiler plugin for make,
+:compiler make, will reset the 'makeprg' and 'errorformat' option to
+the default values and unlet any variables that may have been set by a
+previous compiler plugin.
+
+GROFF *quickfix-groff* *compiler-groff*
+
+The GROFF compiler plugin uses the mom macro set (documented in the groff_mom
+manpage) as input and expects that the output file type extension is passed to
+make, say :make html or :make pdf.
+
+Additional arguments can be passed to groff by setting them in
+`b:groff_compiler_args` or `g:groff_compiler_args`. The `language` argument
+passed to groff is set using 'spelllang'; it can be overridden by setting
+`b:groff_compiler_lang`. The default encoding is `UTF-8` and can be changed
+by setting `b:groff_compiler_encoding` or `g:groff_compiler_encoding`.
+
PANDOC *quickfix-pandoc* *compiler-pandoc*
The Pandoc compiler plugin expects that an output file type extension is
@@ -1296,7 +1347,13 @@ passed to make, say :make html or :make pdf.
Additional arguments can be passed to pandoc:
- either by appending them to make, say `:make html --self-contained` .
-- or setting them in `b:pandoc_compiler_args` or `g:pandoc_compiler_args`
+- or setting them in `b:pandoc_compiler_args` or `g:pandoc_compiler_args`.
+
+The `--from` argument is an educated guess using the buffer file type;
+it can be overridden by setting `b:pandoc_compiler_from`.
+The `--metadata lang` argument is set using 'spelllang';
+If `--from=markdown` is assumed and no title set in a title header or
+YAML block, then the filename (without extension) is used as the title.
PERL *quickfix-perl* *compiler-perl*
@@ -1365,6 +1422,17 @@ shells and OSes and also does not allow to use other available TeX options,
if any. If your TeX doesn't support "-interaction=nonstopmode", please
report it with different means to express \nonstopmode from the command line.
+TYPST COMPILER *compiler-typst*
+
+Vim includes a compiler plugin for Typst files. This compiler is enabled
+automatically in Typst buffers by the Typst filetype plugin |ft-typst-plugin|.
+Run |:make| to compile the current Typst file.
+
+ *g:typst_cmd*
+By default Vim will use "typst" as the command to run the Typst compiler. This
+can be changed by setting the |g:typst_cmd| variable: >
+ let g:typst_cmd = "/path/to/other/command"
+
=============================================================================
7. The error format *error-file-format*
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
index c0d00d16cb..d77750b485 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -886,6 +886,7 @@ Short explanation of each option: *option-list*
'switchbuf' 'swb' sets behavior when switching to another buffer
'synmaxcol' 'smc' maximum column to find syntax items
'syntax' 'syn' syntax to be loaded for current buffer
+'tabclose' 'tcl' which tab page to focus when closing a tab
'tabline' 'tal' custom format for the console tab pages line
'tabpagemax' 'tpm' maximum number of tab pages for |-p| and "tab all"
'tabstop' 'ts' number of spaces that <Tab> in file uses
@@ -898,6 +899,7 @@ Short explanation of each option: *option-list*
'tagstack' 'tgst' push tags onto the tag stack
'term' name of the terminal
'termbidi' 'tbidi' terminal takes care of bi-directionality
+'termguicolors' 'tgc' enable 24-bit RGB color in the TUI
'textwidth' 'tw' maximum width of text that is being inserted
'thesaurus' 'tsr' list of thesaurus files for keyword completion
'thesaurusfunc' 'tsrfu' function to be used for thesaurus completion
diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt
index 2263b20d1a..521d690d93 100644
--- a/runtime/doc/repeat.txt
+++ b/runtime/doc/repeat.txt
@@ -96,9 +96,9 @@ where the cursor was before the global command).
The global command sets both the last used search pattern and the last used
substitute pattern (this is vi compatible). This makes it easy to globally
-replace a string:
+replace a string: >
:g/pat/s//PAT/g
-This replaces all occurrences of "pat" with "PAT". The same can be done with:
+This replaces all occurrences of "pat" with "PAT". The same can be done with: >
:%s/pat/PAT/g
Which is two characters shorter!
@@ -447,7 +447,7 @@ Example: the lines >
\:%,
\n:>,
\fb:-
-are interpreted as if they were given in one line:
+are interpreted as if they were given in one line: >
:set comments=sr:/*,mb:*,el:*/,://,b:#,:%,n:>,fb:-
All leading whitespace characters in the line before a backslash are ignored.
@@ -540,7 +540,7 @@ the runtime path. Example: >
Using a package and loading automatically ~
Let's assume your Nvim files are in "~/.local/share/nvim/site" and you want to
-add a package from a zip archive "/tmp/foopack.zip":
+add a package from a zip archive "/tmp/foopack.zip": >
% mkdir -p ~/.local/share/nvim/site/pack/foo
% cd ~/.local/share/nvim/site/pack/foo
% unzip /tmp/foopack.zip
@@ -589,7 +589,7 @@ If the package has an "after" directory, that directory is added to the end of
Using a single plugin and loading it automatically ~
If you don't have a package but a single plugin, you need to create the extra
-directory level:
+directory level: >
% mkdir -p ~/.local/share/nvim/site/pack/foo/start/foobar
% cd ~/.local/share/nvim/site/pack/foo/start/foobar
% unzip /tmp/someplugin.zip
diff --git a/runtime/doc/scroll.txt b/runtime/doc/scroll.txt
index 29d6177213..8b727a86fb 100644
--- a/runtime/doc/scroll.txt
+++ b/runtime/doc/scroll.txt
@@ -43,6 +43,8 @@ CTRL-D Scroll window Downwards in the buffer. The number of
<S-Down> or *<S-Down>* *<kPageDown>*
<PageDown> or *<PageDown>* *CTRL-F*
+<S-CR> or *<S-CR>* *<S-NL>*
+<S-+> or *SHIFT-+* *<S-Plus>*
CTRL-F Scroll window [count] pages Forwards (downwards) in
the buffer. See also 'startofline' option.
When there is only one window the 'window' option
@@ -80,6 +82,7 @@ CTRL-U Scroll window Upwards in the buffer. The number of
<S-Up> or *<S-Up>* *<kPageUp>*
<PageUp> or *<PageUp>* *CTRL-B*
+<S--> or *<S-Minus>* *SHIFT-MINUS*
CTRL-B Scroll window [count] pages Backwards (upwards) in the
buffer. See also 'startofline' option.
When there is only one window the 'window' option
diff --git a/runtime/doc/sign.txt b/runtime/doc/sign.txt
index 6fa260be40..9d74f1f376 100644
--- a/runtime/doc/sign.txt
+++ b/runtime/doc/sign.txt
@@ -67,15 +67,13 @@ sign group allows Vim plugins to use unique signs without interfering with
other plugins using signs.
*sign-priority*
-Each placed sign is assigned a priority value. When multiple signs are placed
-on the same line, the attributes of the sign with the highest priority is used
-independently of the sign group. The default priority for a sign is 10. The
-priority is assigned at the time of placing a sign.
-
-When multiple signs that each have an icon or text are present, signs are
-ordered with increasing priority from left to right, up until the maximum
-width set in 'signcolumn'. Lower priority signs that do not fit are hidden.
-Highest priority signs with highlight attributes are always shown.
+Each placed sign is assigned a priority value independently of the sign group.
+The default priority for a sign is 10, this value can be changed for different
+signs by specifying a different value at definition time. When multiple signs
+that each have an icon or text are placed on the same line, signs are ordered
+with decreasing priority from left to right, up until the maximum width set in
+'signcolumn'. Low priority signs that do not fit are hidden. Highest priority
+signs with highlight attributes are always shown.
When the line on which the sign is placed is deleted, the sign is removed along
with it.
@@ -116,6 +114,9 @@ See |sign_define()| for the equivalent Vim script function.
toolkit supports ~
Win32 .bmp, .ico, .cur
+ priority={prio}
+ Default priority for the sign, see |sign-priority|.
+
linehl={group}
Highlighting group used for the whole line the sign is placed
in. Most useful is defining a background color.
@@ -186,11 +187,11 @@ See |sign_place()| for the equivalent Vim script function.
By default, the sign is placed in the global sign group.
- By default, the sign is assigned a default priority of 10. To
- assign a different priority value, use "priority={prio}" to
- specify a value. The priority is used to determine the sign
- that is displayed when multiple signs are placed on the same
- line.
+ By default, the sign is assigned a default priority of 10,
+ unless specified otherwise by the sign definition. To assign a
+ different priority value, use "priority={prio}" to specify a
+ value. The priority is used to determine the sign that is
+ displayed when multiple signs are placed on the same line.
Examples: >
:sign place 5 line=3 name=sign1 file=a.py
diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt
index 269d52352d..a13bf079e8 100644
--- a/runtime/doc/spell.txt
+++ b/runtime/doc/spell.txt
@@ -776,7 +776,7 @@ them before the Vim word list is made. The tools for this can be found in the
The format for the affix and word list files is based on what Myspell uses
(the spell checker of Mozilla and OpenOffice.org). A description can be found
here:
- https://lingucomponent.openoffice.org/affix.readme ~
+ https://lingucomponent.openoffice.org/affix.readme
Note that affixes are case sensitive, this isn't obvious from the description.
Vim supports quite a few extras. They are described below |spell-affix-vim|.
diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt
index fb8ed0344b..3b0fa2b371 100644
--- a/runtime/doc/starting.txt
+++ b/runtime/doc/starting.txt
@@ -422,6 +422,10 @@ argument.
Start |RPC| server on pipe or TCP address {addr}. Sets the
primary listen address |v:servername| to {addr}. |serverstart()|
+ To start the server on-demand with systemd, use a systemd
+ socket unit and associated service unit running: >
+ systemd-socket-proxyd --exit-idle-time
+<
==============================================================================
Initialization *initialization* *startup*
diff --git a/runtime/doc/support.txt b/runtime/doc/support.txt
index 5b8b32fa16..0ddf037fba 100644
--- a/runtime/doc/support.txt
+++ b/runtime/doc/support.txt
@@ -12,9 +12,9 @@ Support *support*
Supported platforms *supported-platforms*
`System` `Tier` `Versions` `Tested versions`
-Linux 1 >= 2.6.32, glibc >= 2.12 Ubuntu 22.04
+Linux 1 >= 2.6.32, glibc >= 2.12 Ubuntu 24.04
macOS (Intel) 1 >= 11 macOS 12
-macOS (M1) 2 >= 11 macOS 14
+macOS (M1) 1 >= 11 macOS 15
Windows 64-bit 1 >= Windows 10 Version 1809 Windows Server 2022
FreeBSD 1 >= 10 FreeBSD 13
OpenBSD 2 >= 7
@@ -25,13 +25,16 @@ Note: Windows 10 "Version 1809" or later is required for |:terminal|. To check
your Windows version, run the "winver" command and look for "Version xxxx"
(NOT "OS Build").
+Note: On Windows "Server" you may need to install vcruntime140.dll:
+https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170
+
Support types ~
* Tier 1: Officially supported and tested with CI. Any contributed patch
- MUST NOT break such systems.
+ MUST NOT break support for such platforms.
-* Tier 2: Officially supported, but not necessarily tested with CI. These
- systems are maintained to the best of our ability, without being a top
+* Tier 2: Officially supported, but not necessarily tested with CI. Support
+ for these platforms are maintained by best effort, without being a top
priority.
* Tier 3: Not tested and no guarantees, and not all features may work.
@@ -47,7 +50,8 @@ Common
Some common notes when adding support for new platforms:
-Cmake is the only supported build system. The platform must be buildable with cmake.
+CMake is the only supported build system. Nvim must be buildable on the
+platform with CMake.
All functionality related to the new platform must be implemented in its own
file inside `src/nvim/os` unless it's already done in a common file, in which
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index 7893822a66..219be92c58 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -152,8 +152,7 @@ add a few items or change the highlighting, follow these steps:
1. Create your user directory from 'runtimepath', see above.
2. Create a directory in there called "after/syntax". For Unix: >
- mkdir ~/.config/nvim/after
- mkdir ~/.config/nvim/after/syntax
+ mkdir -p ~/.config/nvim/after/syntax
3. Write a Vim script that contains the commands you want to use. For
example, to change the colors for the C syntax: >
@@ -466,14 +465,14 @@ ASTRO *astro.vim* *ft-astro-syntax*
Configuration
The following variables control certain syntax highlighting features.
-You can add them to your .vimrc: >
+You can add them to your .vimrc.
+
+To enable TypeScript and TSX for ".astro" files (default "disable"): >
let g:astro_typescript = "enable"
<
-Enables TypeScript and TSX for ".astro" files. Default Value: "disable" >
+To enable Stylus for ".astro" files (default "disable"): >
let g:astro_stylus = "enable"
<
-Enables Stylus for ".astro" files. Default Value: "disable"
-
NOTE: You need to install an external plugin to support stylus in astro files.
@@ -489,6 +488,25 @@ For Visual Basic use: >
:let g:filetype_asa = "aspvbs"
:let g:filetype_asp = "aspvbs"
+ASYMPTOTE *asy.vim* *ft-asy-syntax*
+
+By default, only basic Asymptote keywords are highlighted. To highlight
+extended geometry keywords: >
+
+ :let g:asy_syn_plain = 1
+
+and for highlighting keywords related to 3D constructions: >
+
+ :let g:asy_syn_three = 1
+
+By default, Asymptote-defined colors (e.g: lightblue) are highlighted. To
+highlight TeX-defined colors (e.g: BlueViolet) use: >
+
+ :let g:asy_syn_texcolors = 1
+
+or for Xorg colors (e.g: AliceBlue): >
+
+ :let g:asy_syn_x11colors = 1
BAAN *baan.vim* *baan-syntax*
@@ -752,6 +770,21 @@ will be classified as tcsh, UNLESS the "filetype_csh" variable exists. If the
"filetype_csh" variable exists, the filetype will be set to the value of the
variable.
+CSV *ft-csv-syntax*
+
+If you change the delimiter of a CSV file, its syntax highlighting will no
+longer match the changed file content. You will need to unlet the following
+variable: >
+
+ :unlet b:csv_delimiter
+
+And afterwards save and reload the file: >
+
+ :w
+ :e
+
+Now the syntax engine should determine the newly changed CSV delimiter.
+
CYNLIB *cynlib.vim* *ft-cynlib-syntax*
@@ -1402,6 +1435,10 @@ You can also disable this rendering by adding the following line to your
vimrc file: >
:let html_no_rendering=1
+By default Vim synchronises the syntax to 250 lines before the first displayed
+line. This can be configured using: >
+ :let html_minlines = 500
+<
HTML comments are rather special (see an HTML reference document for the
details), and the syntax coloring scheme will highlight all errors.
However, if you prefer to use the wrong style (starts with <!-- and
@@ -1437,7 +1474,7 @@ Note: Syntax folding might slow down syntax highlighting significantly,
especially for large files.
-HTML/OS (by Aestiva) *htmlos.vim* *ft-htmlos-syntax*
+HTML/OS (BY AESTIVA) *htmlos.vim* *ft-htmlos-syntax*
The coloring scheme for HTML/OS works as follows:
@@ -1521,102 +1558,172 @@ idlsyntax_showerror_soft Use softer colours by default for errors
JAVA *java.vim* *ft-java-syntax*
-The java.vim syntax highlighting file offers several options:
+The java.vim syntax highlighting file offers several options.
-In Java 1.0.2 it was never possible to have braces inside parens, so this was
-flagged as an error. Since Java 1.1 this is possible (with anonymous
-classes), and therefore is no longer marked as an error. If you prefer the
-old way, put the following line into your vim startup file: >
- :let java_mark_braces_in_parens_as_errors=1
+In Java 1.0.2, it was never possible to have braces inside parens, so this was
+flagged as an error. Since Java 1.1, this is possible (with anonymous
+classes); and, therefore, is no longer marked as an error. If you prefer the
+old way, put the following line into your Vim startup file: >
+ :let g:java_mark_braces_in_parens_as_errors = 1
-All identifiers in java.lang.* are always visible in all classes. To
-highlight them use: >
- :let java_highlight_java_lang_ids=1
+All (exported) public types declared in `java.lang` are always automatically
+imported and available as simple names. To highlight them, use: >
+ :let g:java_highlight_java_lang_ids = 1
-You can also highlight identifiers of most standard Java packages if you
-download the javaid.vim script at https://www.fleiner.com/vim/download.html.
-If you prefer to only highlight identifiers of a certain package, say java.io
-use the following: >
- :let java_highlight_java_io=1
+You can also highlight types of most standard Java packages if you download
+the javaid.vim script at https://www.fleiner.com/vim/download.html. If you
+prefer to only highlight types of a certain package, say `java.io`, use the
+following: >
+ :let g:java_highlight_java_io = 1
Check the javaid.vim file for a list of all the packages that are supported.
-Function names are not highlighted, as the way to find functions depends on
-how you write Java code. The syntax file knows two possible ways to highlight
-functions:
-
-If you write function declarations that are consistently indented by either
-a tab, or a space . . . or eight space character(s), you may want to set >
- :let java_highlight_functions="indent"
- :let java_highlight_functions="indent1"
- :let java_highlight_functions="indent2"
- :let java_highlight_functions="indent3"
- :let java_highlight_functions="indent4"
- :let java_highlight_functions="indent5"
- :let java_highlight_functions="indent6"
- :let java_highlight_functions="indent7"
- :let java_highlight_functions="indent8"
+Headers of indented function declarations can be highlighted (along with parts
+of lambda expressions and method reference expressions), but it depends on how
+you write Java code. Two formats are recognized:
+
+1) If you write function declarations that are consistently indented by either
+a tab, or a space . . . or eight space character(s), you may want to set one
+of >
+ :let g:java_highlight_functions = "indent"
+ :let g:java_highlight_functions = "indent1"
+ :let g:java_highlight_functions = "indent2"
+ :let g:java_highlight_functions = "indent3"
+ :let g:java_highlight_functions = "indent4"
+ :let g:java_highlight_functions = "indent5"
+ :let g:java_highlight_functions = "indent6"
+ :let g:java_highlight_functions = "indent7"
+ :let g:java_highlight_functions = "indent8"
Note that in terms of 'shiftwidth', this is the leftmost step of indentation.
-However, if you follow the Java guidelines about how functions and classes are
-supposed to be named (with respect to upper- and lowercase) and there is any
-amount of indentation, you may want to set >
- :let java_highlight_functions="style"
-If neither setting does work for you, but you would still want function
-declarations to be highlighted, create your own definitions by changing the
-definitions in java.vim or by creating your own java.vim that includes the
-original one and then adds the code to highlight functions.
-
-In Java 1.1 the functions System.out.println() and System.err.println() should
-only be used for debugging. Therefore it is possible to highlight debugging
-statements differently. To do this you must add the following definition in
-your startup file: >
- :let java_highlight_debug=1
-The result will be that those statements are highlighted as 'Special'
-characters. If you prefer to have them highlighted differently you must define
-new highlightings for the following groups.:
- Debug, DebugSpecial, DebugString, DebugBoolean, DebugType
-which are used for the statement itself, special characters used in debug
-strings, strings, boolean constants and types (this, super) respectively. I
-have opted to choose another background for those statements.
+
+2) However, if you follow the Java guidelines about how functions and types
+are supposed to be named (with respect to upper- and lowercase) and there is
+any amount of indentation, you may want to set >
+ :let g:java_highlight_functions = "style"
+
+In addition, you can combine any value of "g:java_highlight_functions" with >
+ :let g:java_highlight_signature = 1
+to have the name of a function with its parameter list parens distinctly
+highlighted from its type parameters, return type, and formal parameters; and
+to have the parameter list parens of a lambda expression with its arrow
+distinctly highlighted from its formal parameters or identifiers.
+
+If neither setting does work for you, but you would still want headers of
+function declarations to be highlighted, modify the current syntax definitions
+or compose new ones.
+
+Higher-order function types can be hard to parse by eye, so uniformly toning
+down some of their components may be of value. Provided that such type names
+conform to the Java naming guidelines, you may arrange it with >
+ :let g:java_highlight_generics = 1
+
+In Java 1.1, the functions `System.out.println()` and `System.err.println()`
+should only be used for debugging. Consider adding the following definition
+in your startup file: >
+ :let g:java_highlight_debug = 1
+to have the bulk of those statements colored as
+ `*Debug` debugging statements,
+and to make some of their own items further grouped and linked:
+ `*Special` as DebugSpecial,
+ `*String` as DebugString,
+ `*Boolean` as DebugBoolean,
+ `*Type` as DebugType,
+which are used for special characters appearing in strings, strings proper,
+boolean literals, and special instance references (`super`, `this`, `null`),
+respectively.
Javadoc is a program that takes special comments out of Java program files and
creates HTML pages. The standard configuration will highlight this HTML code
-similarly to HTML files (see |html.vim|). You can even add Javascript
-and CSS inside this code (see below). There are four differences however:
- 1. The title (all characters up to the first '.' which is followed by
- some white space or up to the first '@') is colored differently (to change
- the color change the group CommentTitle).
- 2. The text is colored as 'Comment'.
- 3. HTML comments are colored as 'Special'
- 4. The special Javadoc tags (@see, @param, ...) are highlighted as specials
- and the argument (for @see, @param, @exception) as Function.
-To turn this feature off add the following line to your startup file: >
- :let java_ignore_javadoc=1
-
-If you use the special Javadoc comment highlighting described above you
-can also turn on special highlighting for Javascript, visual basic
-scripts and embedded CSS (stylesheets). This makes only sense if you
-actually have Javadoc comments that include either Javascript or embedded
-CSS. The options to use are >
- :let java_javascript=1
- :let java_css=1
- :let java_vb=1
-
-In order to highlight nested parens with different colors define colors
-for javaParen, javaParen1 and javaParen2, for example with >
+similarly to HTML files (see |html.vim|). You can even add JavaScript and CSS
+inside this code (see below). The HTML rendering and the Markdown rendering
+diverge as follows:
+ 1. The first sentence (all characters up to the first period `.`, which is
+ followed by a whitespace character or a line terminator, or up to the
+ first block tag, e.g. `@param`, `@return`) is colored as
+ *SpecialComment special comments.
+ 2. The text is colored as
+ `*Comment` comments.
+ 3. HTML comments are colored as
+ `*Special` special symbols.
+ 4. The standard Javadoc tags (`@code`, `@see`, etc.) are colored as
+ `*Special` special symbols
+ and some of their arguments are colored as
+ `*Function` function names.
+To turn this feature off for both HTML and Markdown, add the following line to
+your startup file: >
+ :let g:java_ignore_javadoc = 1
+Alternatively, only suppress HTML comments or Markdown comments: >
+ :let g:java_ignore_html = 1
+ :let g:java_ignore_markdown = 1
+See |ft-java-plugin| for additional support available for Markdown comments.
+
+If you use the special Javadoc comment highlighting described above, you can
+also turn on special highlighting for JavaScript, Visual Basic scripts, and
+embedded CSS (stylesheets). This only makes sense if any of these languages
+actually appear in Javadoc comments. The variables to use are >
+ :let g:java_javascript = 1
+ :let g:java_css = 1
+ :let g:java_vb = 1
+Note that these three variables are maintained in the HTML syntax file.
+
+Numbers and strings can be recognized in non-Javadoc comments with >
+ :let g:java_comment_strings = 1
+
+When 'foldmethod' is set to "syntax", blocks of code and multi-line comments
+will be folded. No text is usually written in the first line of a multi-line
+comment, making folded contents of Javadoc comments less informative with the
+default 'foldtext' value; you may opt for showing the contents of a second
+line for any comments written in this way, and showing the contents of a first
+line otherwise, with >
+ :let g:java_foldtext_show_first_or_second_line = 1
+
+Trailing whitespace characters or a run of space characters before a tab
+character can be marked as an error with >
+ :let g:java_space_errors = 1
+but either kind of an error can be suppressed by also defining one of >
+ :let g:java_no_trail_space_error = 1
+ :let g:java_no_tab_space_error = 1
+
+In order to highlight nested parens with different colors, define colors for
+`javaParen`, `javaParen1`, and `javaParen2`. For example, >
:hi link javaParen Comment
or >
:hi javaParen ctermfg=blue guifg=#0000ff
+Certain modifiers are incompatible with each other, e.g. `abstract` and
+`final`: >
+ :syn list javaConceptKind
+and can be differently highlighted as a group than other modifiers with >
+ :hi link javaConceptKind NonText
+
If you notice highlighting errors while scrolling backwards, which are fixed
-when redrawing with CTRL-L, try setting the "java_minlines" internal variable
-to a larger number: >
- :let java_minlines = 50
+when redrawing with CTRL-L, try setting the "g:java_minlines" variable to
+a larger number: >
+ :let g:java_minlines = 50
This will make the syntax synchronization start 50 lines before the first
displayed line. The default value is 10. The disadvantage of using a larger
number is that redrawing can become slow.
+Significant changes to the Java platform are gradually introduced in the form
+of JDK Enhancement Proposals (JEPs) that can be implemented for a release and
+offered as its preview features. It may take several JEPs and a few release
+cycles for such a feature to become either integrated into the platform or
+withdrawn from this effort. To cater for early adopters, there is optional
+support in Vim for syntax related preview features that are implemented. You
+can request it by specifying a list of preview feature numbers as follows: >
+ :let g:java_syntax_previews = [455, 476]
+
+The supported JEP numbers are to be drawn from this table:
+ `430`: String Templates [JDK 21]
+ `455`: Primitive types in Patterns, instanceof, and switch
+ `476`: Module Import Declarations
+
+Note that as soon as the particular preview feature will have been integrated
+into the Java platform, its entry will be removed from the table and related
+optionality will be discontinued.
+
-JSON *json.vim* *ft-json-syntax*
+JSON *json.vim* *ft-json-syntax* *g:vim_json_conceal*
+ *g:vim_json_warnings*
The json syntax file provides syntax highlighting with conceal support by
default. To disable concealment: >
@@ -1759,7 +1866,7 @@ By default mail.vim synchronises syntax to 100 lines before the first
displayed line. If you have a slow machine, and generally deal with emails
with short headers, you can change this to a smaller value: >
- :let mail_minlines = 30
+ :let mail_minlines = 30
MAKE *make.vim* *ft-make-syntax*
@@ -1770,6 +1877,16 @@ feature off by using: >
:let make_no_commands = 1
+Comments are also highlighted by default. You can turn this off by using: >
+
+ :let make_no_comments = 1
+
+Microsoft Makefile handles variable expansion and comments differently
+(backslashes are not used for escape). If you see any wrong highlights
+because of this, you can try this: >
+
+ :let make_microsoft = 1
+
MAPLE *maple.vim* *ft-maple-syntax*
@@ -1796,7 +1913,8 @@ $VIMRUNTIME/syntax/syntax.vim).
mv_finance mv_logic mv_powseries
-MARKDOWN *ft-markdown-syntax*
+MARKDOWN *ft-markdown-syntax* *g:markdown_minlines*
+ *g:markdown_fenced_languages* *g:markdown_syntax_conceal*
If you have long regions there might be wrong highlighting. At the cost of
slowing down displaying, you can have the engine look further back to sync on
@@ -1821,6 +1939,17 @@ have the following in your vimrc: >
let filetype_m = "mma"
+MEDIAWIKI *ft-mediawiki-syntax*
+
+By default, syntax highlighting includes basic HTML tags like style and
+headers |html.vim|. For strict Mediawiki syntax highlighting: >
+
+ let g:html_no_rendering = 1
+
+If HTML highlighting is desired, terminal-based text formatting such as bold
+and italic is possible by: >
+
+ let g:html_style_rendering = 1
MODULA2 *modula2.vim* *ft-modula2-syntax*
@@ -2034,9 +2163,9 @@ PANDOC *ft-pandoc-syntax*
By default, markdown files will be detected as filetype "markdown".
Alternatively, you may want them to be detected as filetype "pandoc" instead.
-To do so, set the following: >
+To do so, set the *g:filetype_md* var: >
- :let g:markdown_md = 'pandoc'
+ :let g:filetype_md = 'pandoc'
The pandoc syntax plugin uses |conceal| for pretty highlighting. Default is 1 >
@@ -2575,6 +2704,13 @@ To highlight R code in knitr chunk headers, add to your |vimrc|: >
let rrst_syn_hl_chunk = 1
+RASI *rasi.vim* *ft-rasi-syntax*
+
+Rasi stands for Rofi Advanced Style Information. It is used by the program
+rofi to style the rendering of the search window. The language is heavily
+inspired by CSS stylesheet. Files with the following extensions are recognized
+as rasi files: .rasi.
+
READLINE *readline.vim* *ft-readline-syntax*
The readline library is primarily used by the BASH shell, which adds quite a
@@ -3289,6 +3425,28 @@ set "tf_minlines" to the value you desire. Example: >
:let tf_minlines = your choice
<
+TYPESCRIPT *typescript.vim* *ft-typescript-syntax*
+ *typescriptreact.vim* *ft-typescriptreact-syntax*
+
+There is one option to control the TypeScript syntax highlighting.
+
+ *g:typescript_host_keyword*
+When this variable is set to 1, host-specific APIs such as `addEventListener`
+are highlighted. To disable set it to zero in your .vimrc: >
+
+ let g:typescript_host_keyword = 0
+<
+The default value is 1.
+
+TYPST *ft-typst-syntax*
+
+ *g:typst_embedded_languages*
+Typst files can embed syntax highlighting for other languages by setting the
+|g:typst_embedded_languages| variable. This variable is a list of language
+names whose syntax definitions will be included in Typst files. Example: >
+
+ let g:typst_embedded_languages = ['python', 'r']
+
VIM *vim.vim* *ft-vim-syntax*
*g:vimsyn_minlines* *g:vimsyn_maxlines*
There is a trade-off between more accurate syntax highlighting versus screen
@@ -3307,23 +3465,31 @@ The g:vimsyn_embed option allows users to select what, if any, types of
embedded script highlighting they wish to have. >
g:vimsyn_embed == 0 : disable (don't embed any scripts)
- g:vimsyn_embed == 'lpPr' : support embedded lua, perl, python and ruby
+ g:vimsyn_embed == 'lpPr' : support embedded Lua, Perl, Python and Ruby
<
This option is disabled by default.
*g:vimsyn_folding*
-
-Some folding is now supported with syntax/vim.vim: >
+Some folding is now supported with when 'foldmethod' is set to "syntax": >
g:vimsyn_folding == 0 or doesn't exist: no syntax-based folding
g:vimsyn_folding =~ 'a' : augroups
g:vimsyn_folding =~ 'f' : fold functions
g:vimsyn_folding =~ 'h' : fold heredocs
- g:vimsyn_folding =~ 'l' : fold lua script
- g:vimsyn_folding =~ 'p' : fold perl script
- g:vimsyn_folding =~ 'P' : fold python script
- g:vimsyn_folding =~ 'r' : fold ruby script
+ g:vimsyn_folding =~ 'l' : fold Lua script
+ g:vimsyn_folding =~ 'p' : fold Perl script
+ g:vimsyn_folding =~ 'P' : fold Python script
+ g:vimsyn_folding =~ 'r' : fold Ruby script
<
- *g:vimsyn_noerror*
+
+By default, g:vimsyn_folding is unset. Concatenate the indicated characters
+to support folding of multiple syntax constructs (e.g.,
+g:vimsyn_folding = "fh" will enable folding of both functions and heredocs).
+
+ *g:vimsyn_comment_strings*
+By default, strings are highlighted inside comments. This may be disabled by
+setting g:vimsyn_comment_strings to false.
+
+ *g:vimsyn_noerror*
Not all error highlighting that syntax/vim.vim does may be correct; Vim script
is a difficult language to highlight correctly. A way to suppress error
highlighting is to put the following line in your |vimrc|: >
@@ -4527,7 +4693,7 @@ matches, nextgroup, etc. But there are a few differences:
line (or group of continued lines).
- When a match with a sync pattern is found, the rest of the line (or group of
continued lines) is searched for another match. The last match is used.
- This is used when a line can contain both the start end the end of a region
+ This is used when a line can contain both the start and the end of a region
(e.g., in a C-comment like `/* this */`, the last "*/" is used).
There are two ways how a match with a sync pattern can be used:
@@ -4926,11 +5092,13 @@ guisp={color-name} *guisp*
All values are hexadecimal, range from "00" to "ff". Examples: >
:highlight Comment guifg=#11f0c3 guibg=#ff00ff
<
-blend={integer} *highlight-blend*
+blend={integer} *highlight-blend* *opacity*
Override the blend level for a highlight group within the popupmenu
or floating windows. Only takes effect if 'pumblend' or 'winblend'
is set for the menu or window. See the help at the respective option.
+ See also the "blend" flag of |nvim_buf_set_extmark()|.
+
*highlight-groups* *highlight-default*
These are the builtin highlighting groups. Note that the highlighting depends
on the value of 'background'. You can see the current settings with the
@@ -4941,8 +5109,9 @@ ColorColumn Used for the columns set with 'colorcolumn'.
Conceal Placeholder characters substituted for concealed
text (see 'conceallevel').
*hl-CurSearch*
-CurSearch Used for highlighting a search pattern under the cursor
- (see 'hlsearch').
+CurSearch Current match for the last search pattern (see 'hlsearch').
+ Note: This is correct after a search, but may get outdated if
+ changes are made or the screen is redrawn.
*hl-Cursor* *hl-lCursor*
Cursor Character under the cursor.
lCursor Character under the cursor when |language-mapping|
@@ -4986,7 +5155,6 @@ IncSearch 'incsearch' highlighting; also used for the text replaced with
":s///c".
*hl-Substitute*
Substitute |:substitute| replacement text highlighting.
-
*hl-LineNr*
LineNr Line number for ":number" and ":#" commands, and when 'number'
or 'relativenumber' option is set.
@@ -5006,7 +5174,6 @@ CursorLineSign Like SignColumn when 'cursorline' is set for the cursor line.
*hl-MatchParen*
MatchParen Character under the cursor or just before it, if it
is a paired bracket, and its match. |pi_paren.txt|
-
*hl-ModeMsg*
ModeMsg 'showmode' message (e.g., "-- INSERT --").
*hl-MsgArea*
@@ -5048,11 +5215,15 @@ PmenuExtraSel Popup menu: Selected item "extra text".
PmenuSbar Popup menu: Scrollbar.
*hl-PmenuThumb*
PmenuThumb Popup menu: Thumb of the scrollbar.
+ *hl-PmenuMatch*
+PmenuMatch Popup menu: Matched text in normal item.
+ *hl-PmenuMatchSel*
+PmenuMatchSel Popup menu: Matched text in selected item.
*hl-Question*
Question |hit-enter| prompt and yes/no questions.
*hl-QuickFixLine*
QuickFixLine Current |quickfix| item in the quickfix window. Combined with
- |hl-CursorLine| when the cursor is there.
+ |hl-CursorLine| when the cursor is there.
*hl-Search*
Search Last search pattern highlighting (see 'hlsearch').
Also used for similar items that need to stand out.
@@ -5079,6 +5250,11 @@ SpellRare Word that is recognized by the spellchecker as one that is
StatusLine Status line of current window.
*hl-StatusLineNC*
StatusLineNC Status lines of not-current windows.
+ *hl-StatusLineTerm*
+StatusLineTerm Status line of |terminal| window.
+ *hl-StatusLineTermNC*
+StatusLineTermNC
+ Status line of non-current |terminal| windows.
*hl-TabLine*
TabLine Tab pages line, not active tab page label.
*hl-TabLineFill*
diff --git a/runtime/doc/tabpage.txt b/runtime/doc/tabpage.txt
index 2f50e31ee5..7bfa36e8ab 100644
--- a/runtime/doc/tabpage.txt
+++ b/runtime/doc/tabpage.txt
@@ -135,7 +135,8 @@ something else.
:tabclose $ " close the last tab page
:tabclose # " close the last accessed tab page
-When a tab is closed the next tab page will become the current one.
+When a tab is closed the next tab page will become the current one. This
+behaviour can be customized using the 'tabclose' option.
*:tabo* *:tabonly*
:tabo[nly][!] Close all other tab pages.
diff --git a/runtime/doc/tagsrch.txt b/runtime/doc/tagsrch.txt
index ef1654d365..d5e165a870 100644
--- a/runtime/doc/tagsrch.txt
+++ b/runtime/doc/tagsrch.txt
@@ -274,25 +274,25 @@ g CTRL-] Like CTRL-], but use ":tjump" instead of ":tag".
{Visual}g CTRL-] Same as "g CTRL-]", but use the highlighted text as
the identifier.
- *:tn* *:tnext*
+ *:tn* *:tnext* *]t*
:[count]tn[ext][!] Jump to [count] next matching tag (default 1). See
|tag-!| for [!].
- *:tp* *:tprevious*
+ *:tp* *:tprevious* *[t*
:[count]tp[revious][!] Jump to [count] previous matching tag (default 1).
See |tag-!| for [!].
*:tN* *:tNext*
:[count]tN[ext][!] Same as ":tprevious".
- *:tr* *:trewind*
+ *:tr* *:trewind* *[T*
:[count]tr[ewind][!] Jump to first matching tag. If [count] is given, jump
to [count]th matching tag. See |tag-!| for [!].
*:tf* *:tfirst*
:[count]tf[irst][!] Same as ":trewind".
- *:tl* *:tlast*
+ *:tl* *:tlast* *]T*
:tl[ast][!] Jump to last matching tag. See |tag-!| for [!].
*:lt* *:ltag*
@@ -335,10 +335,10 @@ the same as above, with a "p" prepended.
:ptj[ump][!] [name] Does ":tjump[!] [name]" and shows the new tag in a
"Preview" window. See |:ptag| for more info.
- *:ptn* *:ptnext*
+ *:ptn* *:ptnext* *]CTRL-T*
:[count]ptn[ext][!] ":tnext" in the preview window. See |:ptag|.
- *:ptp* *:ptprevious*
+ *:ptp* *:ptprevious* *[CTRL-T*
:[count]ptp[revious][!] ":tprevious" in the preview window. See |:ptag|.
*:ptN* *:ptNext*
@@ -565,12 +565,12 @@ ctags).
{term} ;" The two characters semicolon and double quote. This is
interpreted by Vi as the start of a comment, which makes the
following be ignored. This is for backwards compatibility
- with Vi, it ignores the following fields. Example:
+ with Vi, it ignores the following fields. Example: >
APP file /^static int APP;$/;" v
- When {tagaddress} is not a line number or search pattern, then
+< When {tagaddress} is not a line number or search pattern, then
{term} must be `|;"`. Here the bar ends the command (excluding
the bar) and `;"` is used to have Vi ignore the rest of the
- line. Example:
+ line. Example: >
APP file.c call cursor(3, 4)|;" v
{field} .. A list of optional fields. Each field has the form:
@@ -588,7 +588,9 @@ ctags).
There is one field that doesn't have a ':'. This is the kind
of the tag. It is handled like it was preceded with "kind:".
- See the documentation of ctags for the kinds it produces.
+ In the above example, this was "kind:v" (typically variable).
+ See the documentation of ctags for the kinds it produces, with
+ ctags you can use `ctags --list-kinds` .
The only other field currently recognized by Vim is "file:"
(with an empty value). It is used for a static tag.
@@ -633,14 +635,14 @@ If the command is a normal search command (it starts and ends with "/" or
The direction of the search is forward for "/", backward for "?".
Note that 'wrapscan' does not matter, the whole file is always searched.
- If the search fails, another try is done ignoring case. If that fails too,
- a search is done for:
+ a search is done for: >
"^tagname[ \t]*("
- (the tag with '^' prepended and "[ \t]*(" appended). When using function
+< (the tag with '^' prepended and "[ \t]*(" appended). When using function
names, this will find the function name when it is in column 0. This will
help when the arguments to the function have changed since the tags file was
- made. If this search also fails another search is done with:
+ made. If this search also fails another search is done with: >
"^[#a-zA-Z_].*\<tagname[ \t]*("
- This means: A line starting with '#' or an identifier and containing the tag
+< This means: A line starting with '#' or an identifier and containing the tag
followed by white space and a '('. This will find macro names and function
names with a type prepended.
@@ -781,15 +783,15 @@ CTRL-W i Open a new window, with the cursor on the first line
count'th matching line is displayed.
*[d-default*
- Mapped to |vim.diagnostic.goto_prev()| by default.
- |default-mappings|
+ Jumps to the previous diagnostic in the current buffer
+ by default. |vim.diagnostic.jump()| |default-mappings|
*]d*
]d like "[d", but start at the current cursor position.
*]d-default*
- Mapped to |vim.diagnostic.goto_next()| by default.
- |default-mappings|
+ Jumps to the next diagnostic in the current buffer by
+ default. |vim.diagnostic.jump()| |default-mappings|
*:ds* *:dsearch*
:[range]ds[earch][!] [count] [/]string[/]
@@ -803,9 +805,17 @@ CTRL-W i Open a new window, with the cursor on the first line
displayed for the found lines. The search starts
from the beginning of the file.
+ *[D-default*
+ Jumps to the first diagnostic in the current buffer by
+ default. |vim.diagnostic.jump()| |default-mappings|
+
*]D*
]D like "[D", but start at the current cursor position.
+ *]D-default*
+ Jumps to the last diagnostic in the current buffer by
+ default. |vim.diagnostic.jump()| |default-mappings|
+
*:dli* *:dlist*
:[range]dli[st][!] [/]string[/]
Like `[D` and `]D`, but search in [range] lines
diff --git a/runtime/doc/nvim_terminal_emulator.txt b/runtime/doc/terminal.txt
index a6ebc7e958..9c47e6de7d 100644
--- a/runtime/doc/nvim_terminal_emulator.txt
+++ b/runtime/doc/terminal.txt
@@ -1,4 +1,4 @@
-*terminal_emulator.txt* Nvim
+*terminal.txt* Nvim
NVIM REFERENCE MANUAL by Thiago de Arruda
@@ -164,7 +164,22 @@ directory indicated in the request. >lua
To try it out, select the above code and source it with `:'<,'>lua`, then run
this command in a :terminal buffer: >
- printf "\033]7;file://./foo/bar\033\\"
+ printf "\033]7;file://./foo/bar\033\\"
+
+OSC 52: write to system clipboard *terminal-osc52*
+
+Applications in the :terminal buffer can write to the system clipboard by
+emitting an OSC 52 sequence. Example: >
+
+ printf '\033]52;;%s\033\\' "$(echo -n 'Hello world' | base64)"
+
+Nvim uses the configured |clipboard| provider to write to the system
+clipboard. Reading from the system clipboard with OSC 52 is not supported, as
+this would allow any arbitrary program in the :terminal to read the user's
+clipboard.
+
+OSC 52 sequences sent from the :terminal buffer do not emit a |TermRequest|
+event. The event is handled directly by Nvim and is not forwarded to plugins.
==============================================================================
Status Variables *terminal-status*
@@ -186,7 +201,7 @@ Example: >vim
Use |jobwait()| to check if the terminal job has finished: >vim
let running = jobwait([&channel], 0)[0] == -1
-
+<
==============================================================================
:Termdebug plugin *terminal-debug*
@@ -198,6 +213,8 @@ Starting ~
*termdebug-starting*
Load the plugin with this command: >vim
packadd termdebug
+When loading the plugin from the |vimrc| file, add the "!" attribute: >vim
+ packadd! termdebug
< *:Termdebug*
To start debugging use `:Termdebug` or `:TermdebugCommand` followed by the
command name, for example: >vim
@@ -447,6 +464,9 @@ If there is no g:termdebug_config you can use: >vim
let g:termdebug_use_prompt = 1
<
Mappings ~
+The termdebug plugin enables a few default mappings. All those mappings
+are reset to their original values once the termdebug session concludes.
+
*termdebug_map_K* *termdebug-mappings*
The K key is normally mapped to |:Evaluate| unless a buffer local (|:map-local|)
mapping to K already exists. If you do not want this use: >vim
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index 0b84bb60d4..35192cc43d 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -49,151 +49,13 @@ treesitter parser for buffers with filetype `svg` or `xslt`, use: >lua
vim.treesitter.language.register('xml', { 'svg', 'xslt' })
<
+ *treesitter-parsers-wasm*
-==============================================================================
-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 treesitter library.
-
-An instance `TSTree` of a treesitter tree supports the following methods.
-
-TSTree:root() *TSTree:root()*
- Return the root node of this tree.
-
-TSTree:copy() *TSTree:copy()*
- Returns a copy of the `TSTree`.
-
-==============================================================================
-TREESITTER NODES *treesitter-node*
- *TSNode*
-
-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 treesitter library.
-
-An instance `TSNode` of a treesitter node supports the following methods.
-
-TSNode:parent() *TSNode:parent()*
- Get the node's immediate parent.
- Prefer |TSNode:child_containing_descendant()|
- for iterating over the node's ancestors.
-
-TSNode:next_sibling() *TSNode:next_sibling()*
- Get the node's next sibling.
-
-TSNode:prev_sibling() *TSNode:prev_sibling()*
- Get the node's previous sibling.
-
-TSNode:next_named_sibling() *TSNode:next_named_sibling()*
- Get the node's next named sibling.
-
-TSNode:prev_named_sibling() *TSNode:prev_named_sibling()*
- Get the node's previous named sibling.
-
-TSNode:iter_children() *TSNode:iter_children()*
- Iterates over all the direct children of {TSNode}, regardless of whether
- they are named or not.
- Returns the child node plus the eventual field name corresponding to this
- child node.
-
-TSNode:field({name}) *TSNode:field()*
- Returns a table of the nodes corresponding to the {name} field.
-
-TSNode:child_count() *TSNode:child_count()*
- Get the node's number of children.
-
-TSNode:child({index}) *TSNode:child()*
- Get the node's child at the given {index}, where zero represents the first
- child.
-
-TSNode:named_child_count() *TSNode:named_child_count()*
- Get the node's number of named children.
-
-TSNode:named_child({index}) *TSNode:named_child()*
- Get the node's named child at the given {index}, where zero represents the
- first named child.
-
-TSNode:child_containing_descendant({descendant}) *TSNode:child_containing_descendant()*
- Get the node's child that contains {descendant}.
-
-TSNode:start() *TSNode:start()*
- Get the node's start position. Return three values: the row, column and
- total byte count (all zero-based).
-
-TSNode:end_() *TSNode:end_()*
- Get the node's end position. Return three values: the row, column and
- total byte count (all zero-based).
-
-TSNode:range({include_bytes}) *TSNode:range()*
- Get the range of the node.
-
- Return four or six values:
- - start row
- - start column
- - start byte (if {include_bytes} is `true`)
- - end row
- - end column
- - end byte (if {include_bytes} is `true`)
-
-TSNode:type() *TSNode:type()*
- Get the node's type as a string.
-
-TSNode:symbol() *TSNode:symbol()*
- Get the node's type as a numerical id.
-
-TSNode:named() *TSNode:named()*
- Check if the node is named. Named nodes correspond to named rules in the
- grammar, whereas anonymous nodes correspond to string literals in the
- grammar.
-
-TSNode:missing() *TSNode:missing()*
- Check if the node is missing. Missing nodes are inserted by the parser in
- order to recover from certain kinds of syntax errors.
-
-TSNode:extra() *TSNode:extra()*
- Check if the node is extra. Extra nodes represent things like comments,
- which are not required by the grammar but can appear anywhere.
-
-TSNode:has_changes() *TSNode:has_changes()*
- Check if a syntax node has been edited.
-
-TSNode:has_error() *TSNode:has_error()*
- Check if the node is a syntax error or contains any syntax errors.
-
-TSNode:sexpr() *TSNode:sexpr()*
- Get an S-expression representing the node as a string.
-
-TSNode:id() *TSNode:id()*
- Get a unique identifier for the node inside its own tree.
-
- No guarantees are made about this identifier's internal representation,
- except for being a primitive Lua type with value equality (so not a
- table). Presently it is a (non-printable) string.
-
- Note: The `id` is not guaranteed to be unique for nodes from different
- trees.
-
-TSNode:tree() *TSNode:tree()*
- Get the |TSTree| of the node.
- *TSNode:descendant_for_range()*
-TSNode:descendant_for_range({start_row}, {start_col}, {end_row}, {end_col})
- Get the smallest node within this node that spans the given range of (row,
- column) positions
-
- *TSNode:named_descendant_for_range()*
-TSNode:named_descendant_for_range({start_row}, {start_col}, {end_row}, {end_col})
- Get the smallest named node within this node that spans the given range of
- (row, column) positions
- *TSNode:equal()*
-TSNode:equal({node})
- Check if {node} refers to the same node within the same tree.
+If Nvim is built with `ENABLE_WASMTIME`, then wasm parsers can also be
+loaded: >lua
- *TSNode:byte_length()*
-TSNode:byte_length()
- Return the number of bytes spanned by this node.
+ vim.treesitter.language.add('python', { path = "/path/to/python.wasm" })
+<
==============================================================================
TREESITTER QUERIES *treesitter-query*
@@ -335,7 +197,7 @@ TREESITTER QUERY DIRECTIVES *treesitter-directives*
Treesitter directives store metadata for a node or match and perform side
effects. For example, the `set!` directive sets metadata on the match or node: >query
- ((identifier) @foo (#set! "type" "parameter"))
+ ((identifier) @foo (#set! type "parameter"))
<
The following directives are built in:
@@ -350,13 +212,14 @@ The following directives are built in:
{value}
Examples: >query
- ((identifier) @foo (#set! @foo "kind" "parameter"))
- ((node1) @left (node2) @right (#set! "type" "pair"))
- ((codeblock) @markup.raw.block (#set! "priority" 90))
+ ((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
- set a new `Range4` object for the captured node with `capture_id` as
+ set a new range in the form of a list like { {start_row}, {start_col},
+ {end_row}, {end_col} } for the captured node with `capture_id` as
`metadata[capture_id].range`. Useful for |treesitter-language-injections|.
Parameters: ~
@@ -540,9 +403,9 @@ the exact definition):
@keyword.coroutine keywords related to coroutines (e.g. `go` in Go, `async/await` in Python)
@keyword.function keywords that define a function (e.g. `func` in Go, `def` in Python)
@keyword.operator operators that are English words (e.g. `and`, `or`)
-@keyword.import keywords for including modules (e.g. `import`, `from` in Python)
-@keyword.type keywords defining composite types (e.g. `struct`, `enum`)
-@keyword.modifier keywords defining type modifiers (e.g. `const`, `static`, `public`)
+@keyword.import keywords for including or exporting modules (e.g. `import`, `from` in Python)
+@keyword.type keywords describing namespaces and composite types (e.g. `struct`, `enum`)
+@keyword.modifier keywords modifying other constructs (e.g. `const`, `static`, `public`)
@keyword.repeat keywords related to loops (e.g. `for`, `while`)
@keyword.return keywords like `return` and `yield`
@keyword.debug keywords related to debugging
@@ -598,7 +461,7 @@ the exact definition):
@diff.delta changed text (for diff files)
@tag XML-style tag names (e.g. in XML, HTML, etc.)
-@tag.builtin XML-style tag names (e.g. HTML5 tags)
+@tag.builtin builtin tag names (e.g. HTML5 tags)
@tag.attribute XML-style tag attributes
@tag.delimiter XML-style tag delimiters
@@ -636,7 +499,7 @@ higher than treesitter. It is also possible to change the priority of an
individual query pattern manually by setting its `"priority"` metadata
attribute: >query
- ((super_important_node) @superimportant (#set! "priority" 105))
+ ((super_important_node) @superimportant (#set! priority 105))
<
==============================================================================
@@ -711,6 +574,278 @@ The earliest parser ABI version that is supported by the bundled treesitter
library.
==============================================================================
+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 treesitter library.
+
+An instance `TSTree` of a treesitter tree supports the following methods.
+
+
+TSTree:copy() *TSTree:copy()*
+ Returns a copy of the `TSTree`.
+
+ Return: ~
+ (`TSTree`)
+
+TSTree:root() *TSTree:root()*
+ Return the root node of this tree.
+
+ Return: ~
+ (`TSNode`)
+
+
+==============================================================================
+TREESITTER NODES *treesitter-node* *TSNode*
+
+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 treesitter library.
+
+An instance `TSNode` of a treesitter node supports the following methods.
+
+
+TSNode:byte_length() *TSNode:byte_length()*
+ Return the number of bytes spanned by this node.
+
+ Return: ~
+ (`integer`)
+
+TSNode:child({index}) *TSNode:child()*
+ Get the node's child at the given {index}, where zero represents the first
+ child.
+
+ Parameters: ~
+ • {index} (`integer`)
+
+ Return: ~
+ (`TSNode?`)
+
+ *TSNode:child_containing_descendant()*
+TSNode:child_containing_descendant({descendant})
+ Get the node's child that contains {descendant}.
+
+ Parameters: ~
+ • {descendant} (`TSNode`)
+
+ Return: ~
+ (`TSNode?`)
+
+TSNode:child_count() *TSNode:child_count()*
+ Get the node's number of children.
+
+ Return: ~
+ (`integer`)
+
+ *TSNode:descendant_for_range()*
+TSNode:descendant_for_range({start_row}, {start_col}, {end_row}, {end_col})
+ Get the smallest node within this node that spans the given range of (row,
+ column) positions
+
+ Parameters: ~
+ • {start_row} (`integer`)
+ • {start_col} (`integer`)
+ • {end_row} (`integer`)
+ • {end_col} (`integer`)
+
+ Return: ~
+ (`TSNode?`)
+
+TSNode:end_() *TSNode:end_()*
+ Get the node's end position. Return three values: the row, column and
+ total byte count (all zero-based).
+
+ Return (multiple): ~
+ (`integer`)
+ (`integer`)
+ (`integer`)
+
+TSNode:equal({node}) *TSNode:equal()*
+ Check if {node} refers to the same node within the same tree.
+
+ Parameters: ~
+ • {node} (`TSNode`)
+
+ Return: ~
+ (`boolean`)
+
+TSNode:extra() *TSNode:extra()*
+ Check if the node is extra. Extra nodes represent things like comments,
+ which are not required by the grammar but can appear anywhere.
+
+ Return: ~
+ (`boolean`)
+
+TSNode:field({name}) *TSNode:field()*
+ Returns a table of the nodes corresponding to the {name} field.
+
+ Parameters: ~
+ • {name} (`string`)
+
+ Return: ~
+ (`TSNode[]`)
+
+TSNode:has_changes() *TSNode:has_changes()*
+ Check if a syntax node has been edited.
+
+ Return: ~
+ (`boolean`)
+
+TSNode:has_error() *TSNode:has_error()*
+ Check if the node is a syntax error or contains any syntax errors.
+
+ Return: ~
+ (`boolean`)
+
+TSNode:id() *TSNode:id()*
+ Get a unique identifier for the node inside its own tree.
+
+ No guarantees are made about this identifier's internal representation,
+ except for being a primitive Lua type with value equality (so not a
+ table). Presently it is a (non-printable) string.
+
+ Note: The `id` is not guaranteed to be unique for nodes from different
+ trees.
+
+ Return: ~
+ (`string`)
+
+TSNode:iter_children() *TSNode:iter_children()*
+ Iterates over all the direct children of {TSNode}, regardless of whether
+ they are named or not. Returns the child node plus the eventual field name
+ corresponding to this child node.
+
+ Return: ~
+ (`fun(): TSNode, string`)
+
+TSNode:missing() *TSNode:missing()*
+ Check if the node is missing. Missing nodes are inserted by the parser in
+ order to recover from certain kinds of syntax errors.
+
+ Return: ~
+ (`boolean`)
+
+TSNode:named() *TSNode:named()*
+ Check if the node is named. Named nodes correspond to named rules in the
+ grammar, whereas anonymous nodes correspond to string literals in the
+ grammar.
+
+ Return: ~
+ (`boolean`)
+
+TSNode:named_child({index}) *TSNode:named_child()*
+ Get the node's named child at the given {index}, where zero represents the
+ first named child.
+
+ Parameters: ~
+ • {index} (`integer`)
+
+ Return: ~
+ (`TSNode?`)
+
+TSNode:named_child_count() *TSNode:named_child_count()*
+ Get the node's number of named children.
+
+ Return: ~
+ (`integer`)
+
+ *TSNode:named_descendant_for_range()*
+TSNode:named_descendant_for_range({start_row}, {start_col}, {end_row},
+ {end_col})
+ Get the smallest named node within this node that spans the given range of
+ (row, column) positions
+
+ Parameters: ~
+ • {start_row} (`integer`)
+ • {start_col} (`integer`)
+ • {end_row} (`integer`)
+ • {end_col} (`integer`)
+
+ Return: ~
+ (`TSNode?`)
+
+TSNode:next_named_sibling() *TSNode:next_named_sibling()*
+ Get the node's next named sibling.
+
+ Return: ~
+ (`TSNode?`)
+
+TSNode:next_sibling() *TSNode:next_sibling()*
+ Get the node's next sibling.
+
+ Return: ~
+ (`TSNode?`)
+
+TSNode:parent() *TSNode:parent()*
+ Get the node's immediate parent. Prefer
+ |TSNode:child_containing_descendant()| for iterating over the node's
+ ancestors.
+
+ Return: ~
+ (`TSNode?`)
+
+TSNode:prev_named_sibling() *TSNode:prev_named_sibling()*
+ Get the node's previous named sibling.
+
+ Return: ~
+ (`TSNode?`)
+
+TSNode:prev_sibling() *TSNode:prev_sibling()*
+ Get the node's previous sibling.
+
+ Return: ~
+ (`TSNode?`)
+
+TSNode:range({include_bytes}) *TSNode:range()*
+ Get the range of the node.
+
+ Return four or six values:
+ • start row
+ • start column
+ • start byte (if {include_bytes} is `true`)
+ • end row
+ • end column
+ • end byte (if {include_bytes} is `true`)
+
+ Parameters: ~
+ • {include_bytes} (`boolean?`)
+
+TSNode:sexpr() *TSNode:sexpr()*
+ Get an S-expression representing the node as a string.
+
+ Return: ~
+ (`string`)
+
+TSNode:start() *TSNode:start()*
+ Get the node's start position. Return three values: the row, column and
+ total byte count (all zero-based).
+
+ Return (multiple): ~
+ (`integer`)
+ (`integer`)
+ (`integer`)
+
+TSNode:symbol() *TSNode:symbol()*
+ Get the node's type as a numerical id.
+
+ Return: ~
+ (`integer`)
+
+TSNode:tree() *TSNode:tree()*
+ Get the |TSTree| of the node.
+
+ Return: ~
+ (`TSTree`)
+
+TSNode:type() *TSNode:type()*
+ Get the node's type as a string.
+
+ Return: ~
+ (`string`)
+
+
+==============================================================================
Lua module: vim.treesitter *lua-treesitter-core*
foldexpr({lnum}) *vim.treesitter.foldexpr()*
@@ -719,6 +854,9 @@ foldexpr({lnum}) *vim.treesitter.foldexpr()*
vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
<
+ Attributes: ~
+ Since: 0.9.0
+
Parameters: ~
• {lnum} (`integer?`) Line number to calculate fold level for
@@ -749,7 +887,7 @@ get_captures_at_pos({bufnr}, {row}, {col})
• {col} (`integer`) Position column
Return: ~
- (`{capture: string, lang: string, metadata: table}[]`)
+ (`{capture: string, lang: string, metadata: vim.treesitter.query.TSMetadata}[]`)
get_node({opts}) *vim.treesitter.get_node()*
Returns the smallest named node at the given position
@@ -764,13 +902,15 @@ get_node({opts}) *vim.treesitter.get_node()*
• {opts} (`table?`) Optional keyword arguments:
• {bufnr} (`integer?`) Buffer number (nil or 0 for current
buffer)
- • {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
+ • {pos} (`[integer, 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)
+ • {include_anonymous} (`boolean?`) Include anonymous nodes
+ (default false)
Return: ~
(`TSNode?`) Node at the given position
@@ -808,6 +948,11 @@ get_parser({bufnr}, {lang}, {opts}) *vim.treesitter.get_parser()*
If needed, this will create the parser.
+ If no parser can be created, an error is thrown. Set `opts.error = false`
+ to suppress this and return nil (and an error message) instead. WARNING:
+ This behavior will become default in Nvim 0.12 and the option will be
+ removed.
+
Parameters: ~
• {bufnr} (`integer?`) Buffer the parser should be tied to (default:
current buffer)
@@ -815,8 +960,9 @@ get_parser({bufnr}, {lang}, {opts}) *vim.treesitter.get_parser()*
filetype)
• {opts} (`table?`) Options to pass to the created language tree
- Return: ~
- (`vim.treesitter.LanguageTree`) object to use for parsing
+ Return (multiple): ~
+ (`vim.treesitter.LanguageTree?`) object to use for parsing
+ (`string?`) error message, if applicable
get_range({node}, {source}, {metadata}) *vim.treesitter.get_range()*
Get the range of a |TSNode|. Can also supply {source} and {metadata} to
@@ -829,7 +975,13 @@ get_range({node}, {source}, {metadata}) *vim.treesitter.get_range()*
• {metadata} (`vim.treesitter.query.TSMetadata?`)
Return: ~
- (`Range6`)
+ (`table`) A table with the following fields:
+ • {[1]} (`integer`) start row
+ • {[2]} (`integer`) start column
+ • {[3]} (`integer`) start bytes
+ • {[4]} (`integer`) end row
+ • {[5]} (`integer`) end column
+ • {[6]} (`integer`) end bytes
*vim.treesitter.get_string_parser()*
get_string_parser({str}, {lang}, {opts})
@@ -854,6 +1006,9 @@ inspect_tree({opts}) *vim.treesitter.inspect_tree()*
Can also be shown with `:InspectTree`. *:InspectTree*
+ Attributes: ~
+ Since: 0.9.0
+
Parameters: ~
• {opts} (`table?`) Optional options table with the following possible
keys:
@@ -942,19 +1097,29 @@ add({lang}, {opts}) *vim.treesitter.language.add()*
Load parser with name {lang}
Parsers are searched in the `parser` runtime directory, or the provided
- {path}
+ {path}. Can be used to check for available parsers before enabling
+ treesitter features, e.g., >lua
+ if vim.treesitter.language.add('markdown') then
+ vim.treesitter.start(bufnr, 'markdown')
+ end
+<
Parameters: ~
• {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
+ Return (multiple): ~
+ (`boolean?`) True if parser is loaded
+ (`string?`) Error if parser cannot be loaded
+
get_filetypes({lang}) *vim.treesitter.language.get_filetypes()*
- Get the filetypes associated with the parser named {lang}.
+ Returns the filetypes for which a parser named {lang} is used.
+
+ The list includes {lang} itself plus all filetypes registered via
+ |vim.treesitter.language.register()|.
Parameters: ~
• {lang} (`string`) Name of parser
@@ -963,6 +1128,11 @@ get_filetypes({lang}) *vim.treesitter.language.get_filetypes()*
(`string[]`) filetypes
get_lang({filetype}) *vim.treesitter.language.get_lang()*
+ Returns the language name to be used when loading a parser for {filetype}.
+
+ If no language has been explicitly registered via
+ |vim.treesitter.language.register()|, default to {filetype}. For composite
+ filetypes like `html.glimmer`, only the main filetype is returned.
Parameters: ~
• {filetype} (`string`)
@@ -1007,7 +1177,7 @@ add_directive({name}, {handler}, {opts})
Parameters: ~
• {name} (`string`) Name of the directive, without leading #
- • {handler} (`fun(match: table<integer,TSNode[]>, pattern: integer, source: integer|string, predicate: any[], metadata: table)`)
+ • {handler} (`fun(match: table<integer,TSNode[]>, pattern: integer, source: integer|string, predicate: any[], metadata: vim.treesitter.query.TSMetadata)`)
• match: A table mapping capture IDs to a list of captured
nodes
• pattern: the index of the matching pattern in the query
@@ -1020,9 +1190,8 @@ add_directive({name}, {handler}, {opts})
the same name
• {all}? (`boolean`) Use the correct implementation of the
match table where capture IDs map to a list of nodes
- instead of a single node. Defaults to false (for backward
- compatibility). This option will eventually become the
- default and removed.
+ instead of a single node. Defaults to true. This option
+ will be removed in a future release.
*vim.treesitter.query.add_predicate()*
add_predicate({name}, {handler}, {opts})
@@ -1030,17 +1199,16 @@ add_predicate({name}, {handler}, {opts})
Parameters: ~
• {name} (`string`) Name of the predicate, without leading #
- • {handler} (`fun(match: table<integer,TSNode[]>, pattern: integer, source: integer|string, predicate: any[], metadata: table)`)
+ • {handler} (`fun(match: table<integer,TSNode[]>, pattern: integer, source: integer|string, predicate: any[], metadata: vim.treesitter.query.TSMetadata)`)
• see |vim.treesitter.query.add_directive()| for argument
meanings
- • {opts} (`table`) A table with the following fields:
+ • {opts} (`table?`) A table with the following fields:
• {force}? (`boolean`) Override an existing predicate of
the same name
• {all}? (`boolean`) Use the correct implementation of the
match table where capture IDs map to a list of nodes
- instead of a single node. Defaults to false (for backward
- compatibility). This option will eventually become the
- default and removed.
+ instead of a single node. Defaults to true. This option
+ will be removed in a future release.
edit({lang}) *vim.treesitter.query.edit()*
Opens a live editor to query the buffer you started from.
@@ -1200,14 +1368,8 @@ Query:iter_matches({node}, {source}, {start}, {stop}, {opts})
indices to a list of nodes, and metadata from any directives processing
the match.
- WARNING: Set `all=true` to ensure all matching nodes in a match are
- returned, otherwise only the last node in a match is returned, breaking
- captures involving quantifiers such as `(comment)+ @comment`. The default
- option `all=false` is only provided for backward compatibility and will be
- removed after Nvim 0.10.
-
Example: >lua
- for pattern, match, metadata in cquery:iter_matches(tree:root(), bufnr, 0, -1, { all = true }) do
+ for pattern, match, metadata in cquery:iter_matches(tree:root(), bufnr, 0, -1) do
for id, nodes in pairs(match) do
local name = query.captures[id]
for _, node in ipairs(nodes) do
@@ -1232,16 +1394,15 @@ Query:iter_matches({node}, {source}, {start}, {stop}, {opts})
start depth for each match. This is used to prevent
traversing too deep into a tree.
• match_limit (integer) Set the maximum number of
- in-progress matches (Default: 256).
- • all (boolean) When set, the returned match table maps
- capture IDs to a list of nodes. Older versions of
- iter_matches incorrectly mapped capture IDs to a single
- node, which is incorrect behavior. This option will
- eventually become the default and removed.
+ in-progress matches (Default: 256). all (boolean) When
+ `false` (default `true`), the returned table maps capture
+ IDs to a single (last) node instead of the full list of
+ matching nodes. This option is only for backward
+ compatibility and will be removed in a future release.
Return: ~
- (`fun(): integer, table<integer, TSNode[]>, table`) pattern id, match,
- metadata
+ (`fun(): integer, table<integer, TSNode[]>, vim.treesitter.query.TSMetadata`)
+ pattern id, match, metadata
set({lang}, {query_name}, {text}) *vim.treesitter.query.set()*
Sets the runtime query named {query_name} for {lang}
@@ -1296,7 +1457,11 @@ LanguageTree:contains({range}) *LanguageTree:contains()*
Determines whether {range} is contained in the |LanguageTree|.
Parameters: ~
- • {range} (`Range4`) `{ start_line, start_col, end_line, end_col }`
+ • {range} (`table`) A table with the following fields:
+ • {[1]} (`integer`) start row
+ • {[2]} (`integer`) start column
+ • {[3]} (`integer`) end row
+ • {[4]} (`integer`) end column
Return: ~
(`boolean`)
@@ -1320,7 +1485,9 @@ LanguageTree:for_each_tree({fn}) *LanguageTree:for_each_tree()*
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.
+ |LanguageTree:parse()| drops the regions outside the requested range. Each
+ list represents a range in the form of { {start_row}, {start_col},
+ {start_bytes}, {end_row}, {end_col}, {end_bytes} }.
Return: ~
(`table<integer, Range6[]>`)
@@ -1355,7 +1522,11 @@ LanguageTree:language_for_range({range})
Gets the appropriate language that contains {range}.
Parameters: ~
- • {range} (`Range4`) `{ start_line, start_col, end_line, end_col }`
+ • {range} (`table`) A table with the following fields:
+ • {[1]} (`integer`) start row
+ • {[2]} (`integer`) start column
+ • {[3]} (`integer`) end row
+ • {[4]} (`integer`) end column
Return: ~
(`vim.treesitter.LanguageTree`) tree Managing {range}
@@ -1365,7 +1536,28 @@ LanguageTree:named_node_for_range({range}, {opts})
Gets the smallest named node that contains {range}.
Parameters: ~
- • {range} (`Range4`) `{ start_line, start_col, end_line, end_col }`
+ • {range} (`table`) A table with the following fields:
+ • {[1]} (`integer`) start row
+ • {[2]} (`integer`) start column
+ • {[3]} (`integer`) end row
+ • {[4]} (`integer`) end column
+ • {opts} (`table?`) A table with the following fields:
+ • {ignore_injections}? (`boolean`, default: `true`) Ignore
+ injected languages
+
+ Return: ~
+ (`TSNode?`)
+
+ *LanguageTree:node_for_range()*
+LanguageTree:node_for_range({range}, {opts})
+ Gets the smallest node that contains {range}.
+
+ Parameters: ~
+ • {range} (`table`) A table with the following fields:
+ • {[1]} (`integer`) start row
+ • {[2]} (`integer`) start column
+ • {[3]} (`integer`) end row
+ • {[4]} (`integer`) end column
• {opts} (`table?`) A table with the following fields:
• {ignore_injections}? (`boolean`, default: `true`) Ignore
injected languages
@@ -1426,7 +1618,11 @@ LanguageTree:tree_for_range({range}, {opts})
Gets the tree that contains {range}.
Parameters: ~
- • {range} (`Range4`) `{ start_line, start_col, end_line, end_col }`
+ • {range} (`table`) A table with the following fields:
+ • {[1]} (`integer`) start row
+ • {[2]} (`integer`) start column
+ • {[3]} (`integer`) end row
+ • {[4]} (`integer`) end column
• {opts} (`table?`) A table with the following fields:
• {ignore_injections}? (`boolean`, default: `true`) Ignore
injected languages
diff --git a/runtime/doc/term.txt b/runtime/doc/tui.txt
index 8ef8675d13..9493f91b1e 100644
--- a/runtime/doc/term.txt
+++ b/runtime/doc/tui.txt
@@ -1,4 +1,4 @@
-*term.txt* Nvim
+*tui.txt* Nvim
NVIM REFERENCE MANUAL
@@ -6,28 +6,45 @@
Terminal UI *TUI* *tui*
-Nvim uses a list of terminal capabilities to display its user interface
-(except in |--embed| and |--headless| modes). If that information is wrong,
-the screen may be messed up or keys may not be recognized.
+By default when you run `nvim` (without |--embed| or |--headless|) it starts
+the builtin "terminal UI" (TUI). This default UI is optional: you can run Nvim
+as a "headless" server, or you can use a |GUI|.
Type |gO| to see the table of contents.
==============================================================================
-Startup *startup-terminal*
+Startup *startup-tui* *startup-terminal*
+
+Nvim has a client-server architecture: by default when you run `nvim`, this
+starts the builtin UI client, which starts a `nvim --embed` server (child)
+process that the UI client connects to. After attaching to the server, the UI
+client calls |nvim_set_client_info()| (as recommended for all UIs |dev-ui|)
+and sets these fields on its channel: >
+
+ client = {
+ attributes = {
+ license = 'Apache 2',
+ pid = …,
+ website = 'https://neovim.io',
+ },
+ name = 'nvim-tui',
+ type = 'ui',
+ version = { … },
+ }
Nvim guesses the terminal type when it starts (except in |--embed| and
|--headless| modes). The |$TERM| environment variable is the primary hint that
determines the terminal type.
*terminfo* *E557* *E558* *E559*
-The terminfo database is used if available.
-
-The Unibilium library (used by Nvim to read terminfo) allows you to override
-the system terminfo with one in $HOME/.terminfo/ directory, in part or in
-whole.
-
-Building your own terminfo is usually as simple as running this as
-a non-superuser:
+To display its user interface, Nvim reads a list of "terminal capabilities"
+from the system terminfo database (or builtin defaults if terminfo is not
+found). If that information is wrong, the screen may be messed up or keys may
+not be recognized.
+
+The Unibilium library (used to read terminfo) allows you to override the
+system terminfo with one in the "$HOME/.terminfo/" directory. Building your
+own terminfo is usually as simple as running this:
>
curl -LO https://invisible-island.net/datafiles/current/terminfo.src.gz
gunzip terminfo.src.gz
@@ -41,6 +58,7 @@ or sub-optimal behavior will result (scrolling quirks, wrong colors, etc.).
$TERM is also important because it is forwarded by SSH to the remote session,
unlike most other environment variables.
+>
For this terminal Set $TERM to |builtin-terms|
-------------------------------------------------------------------------
anything libvte-based vte, vte-256color Y
@@ -61,6 +79,7 @@ unlike most other environment variables.
Windows/VTP console vtpcon Y
Windows/legacy console win32con Y
xterm or compatible xterm, xterm-256color Y
+<
*builtin-terms* *builtin_terms*
If a |terminfo| database is not available or there is no entry for the current
@@ -126,27 +145,27 @@ extended keys a.k.a. "modifyOtherKeys" or "CSI u") can also be parsed.
For example, when running Nvim in tmux, this makes Nvim leave Insert mode and
go to the window below: >
- tmux send-keys 'Escape' [ 2 7 u 'C-W' j
+ tmux send-keys 'Escape' [ 2 7 u 'C-W' j
Where `'Escape' [ 2 7 u` is an unambiguous "CSI u" sequence for the <Esc> key.
The kitty keyboard protocol https://sw.kovidgoyal.net/kitty/keyboard-protocol/
is partially supported, including keypad keys in Unicode Private Use Area.
For example, this sequence is recognized by Nvim as <C-kEnter>: >
- CSI 57414 ; 5 u
+ CSI 57414 ; 5 u
and can be used differently from <C-CR> in mappings.
*tui-modifyOtherKeys* *tui-csiu*
At startup Nvim will query your terminal to see if it supports the "CSI u"
encoding by writing the sequence >
- CSI ? u CSI c
+ CSI ? u CSI c
If your terminal emulator responds with >
- CSI ? <flags> u
+ CSI ? <flags> u
this means your terminal supports the "CSI u" encoding and Nvim will tell your
terminal to enable it by writing the sequence >
- CSI > 1 u
+ CSI > 1 u
If your terminal does not support "CSI u" then Nvim will instead enable the
"modifyOtherKeys" encoding by writing the sequence >
- CSI > 4 ; 2 m
+ CSI > 4 ; 2 m
When Nvim exits cleanly it will send the corresponding sequence to disable the
special key encoding. If Nvim does not exit cleanly then your terminal
@@ -215,9 +234,9 @@ are not in terminfo you must add them by setting "terminal-overrides" in
See the tmux(1) manual page for the details of how and what to do in the tmux
configuration file. It will look something like: >bash
- set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'
-<or (alas!) for Konsole 18.07.70 or older, something more complex like: >bash
- set -ga terminal-overrides 'xterm*:\E]50;CursorShape=%?%p1%{3}%<%t%{0}%e%{1}%;%d\007'
+ set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'
+or (alas!) for Konsole 18.07.70 or older, something more complex like: >bash
+ set -ga terminal-overrides 'xterm*:\E]50;CursorShape=%?%p1%{3}%<%t%{0}%e%{1}%;%d\007'
<
==============================================================================
Window size *window-size*
@@ -250,12 +269,11 @@ number of lines that Vim uses with the command "z{height}<CR>".
If the characters from the terminal are arriving with more than 1 second
between them you might want to set the 'timeout' and/or 'ttimeout' option.
-See the "Options" chapter |options|.
If you are using a color terminal that is slow when displaying lines beyond
the end of a buffer, this is because Nvim is drawing the whitespace twice, in
two sets of colours and attributes. To prevent this, use this command: >vim
- hi NonText cterm=NONE ctermfg=NONE
+ hi NonText cterm=NONE ctermfg=NONE
This draws the spaces with the default colours and attributes, which allows the
second pass of drawing to be optimized away. Note: Although in theory the
colours of whitespace are immaterial, in practice they change the colours of
@@ -268,57 +286,65 @@ Using the mouse *mouse-using*
*mouse-mode-table* *mouse-overview*
Overview of what the mouse buttons do, when 'mousemodel' is "extend":
-Normal Mode:
-event position selection change action ~
- cursor window ~
-<LeftMouse> yes end yes
-<C-LeftMouse> yes end yes "CTRL-]" (2)
-<S-LeftMouse> yes no change yes "*" (2) *<S-LeftMouse>*
-<LeftDrag> yes start or extend (1) no *<LeftDrag>*
-<LeftRelease> yes start or extend (1) no
-<MiddleMouse> yes if not active no put
-<MiddleMouse> yes if active no yank and put
-<RightMouse> yes start or extend yes
-<A-RightMouse> yes start or extend blockw. yes *<A-RightMouse>*
-<S-RightMouse> yes no change yes "#" (2) *<S-RightMouse>*
-<C-RightMouse> no no change no "CTRL-T"
-<RightDrag> yes extend no *<RightDrag>*
-<RightRelease> yes extend no *<RightRelease>*
-
-Insert or Replace Mode:
-event position selection change action ~
- cursor window ~
-<LeftMouse> yes (cannot be active) yes
-<C-LeftMouse> yes (cannot be active) yes "CTRL-O^]" (2)
-<S-LeftMouse> yes (cannot be active) yes "CTRL-O*" (2)
-<LeftDrag> yes start or extend (1) no like CTRL-O (1)
-<LeftRelease> yes start or extend (1) no like CTRL-O (1)
-<MiddleMouse> no (cannot be active) no put register
-<RightMouse> yes start or extend yes like CTRL-O
-<A-RightMouse> yes start or extend blockw. yes
-<S-RightMouse> yes (cannot be active) yes "CTRL-O#" (2)
-<C-RightMouse> no (cannot be active) no "CTRL-O CTRL-T"
-
-In a help window:
-event position selection change action ~
- cursor window ~
-<2-LeftMouse> yes (cannot be active) no "^]" (jump to help tag)
+ *<S-LeftMouse>* *<A-RightMouse>* *<S-RightMouse>* *<RightDrag>*
+ *<RightRelease>* *<LeftDrag>*
+Normal Mode: >
+ event position selection change action
+ cursor window
+ ---------------------------------------------------------------------------
+ <LeftMouse> yes end yes
+ <C-LeftMouse> yes end yes "CTRL-]" (2)
+ <S-LeftMouse> yes no change yes "*" (2)
+ <LeftDrag> yes start or extend (1) no
+ <LeftRelease> yes start or extend (1) no
+ <MiddleMouse> yes if not active no put
+ <MiddleMouse> yes if active no yank and put
+ <RightMouse> yes start or extend yes
+ <A-RightMouse> yes start or extend blockw. yes
+ <S-RightMouse> yes no change yes "#" (2)
+ <C-RightMouse> no no change no "CTRL-T"
+ <RightDrag> yes extend no
+ <RightRelease> yes extend no
+
+Insert or Replace Mode: >
+ event position selection change action
+ cursor window
+ ---------------------------------------------------------------------------
+ <LeftMouse> yes (cannot be active) yes
+ <C-LeftMouse> yes (cannot be active) yes "CTRL-O^]" (2)
+ <S-LeftMouse> yes (cannot be active) yes "CTRL-O*" (2)
+ <LeftDrag> yes start or extend (1) no like CTRL-O (1)
+ <LeftRelease> yes start or extend (1) no like CTRL-O (1)
+ <MiddleMouse> no (cannot be active) no put register
+ <RightMouse> yes start or extend yes like CTRL-O
+ <A-RightMouse> yes start or extend blockw. yes
+ <S-RightMouse> yes (cannot be active) yes "CTRL-O#" (2)
+ <C-RightMouse> no (cannot be active) no "CTRL-O CTRL-T"
+
+In a help window: >
+ event position selection change action
+ cursor window
+ ---------------------------------------------------------------------------
+ <2-LeftMouse> yes (cannot be active) no "^]" (jump to help tag)
When 'mousemodel' is "popup", these are different:
-Normal Mode:
-event position selection change action ~
- cursor window ~
-<S-LeftMouse> yes start or extend (1) no
-<A-LeftMouse> yes start or extend blockw. no *<A-LeftMouse>*
-<RightMouse> no popup menu no
-
-Insert or Replace Mode:
-event position selection change action ~
- cursor window ~
-<S-LeftMouse> yes start or extend (1) no like CTRL-O (1)
-<A-LeftMouse> yes start or extend blockw. no
-<RightMouse> no popup menu no
+ *<A-LeftMouse>*
+Normal Mode: >
+ event position selection change action
+ cursor window
+ ---------------------------------------------------------------------------
+ <S-LeftMouse> yes start or extend (1) no
+ <A-LeftMouse> yes start/extend blockw no
+ <RightMouse> no popup menu no
+
+Insert or Replace Mode: >
+ event position selection change action
+ cursor window
+ ---------------------------------------------------------------------------
+ <S-LeftMouse> yes start or extend (1) no like CTRL-O (1)
+ <A-LeftMouse> yes start/extend blockw no
+ <RightMouse> no popup menu no
(1) only if mouse pointer moved since press
(2) only if click is in same buffer
@@ -348,16 +374,20 @@ key pressed causes the Visual area to become blockwise. When 'mousemodel' is
work on systems where the window manager consumes the mouse events when the
alt key is pressed (it may move the window).
- *double-click*
+ *double-click* *<2-LeftMouse>* *<3-LeftMouse>* *<4-LeftMouse>*
Double, triple and quadruple clicks are supported when the GUI is active, for
Win32 and for an xterm. For selecting text, extra clicks extend the
-selection:
- click select ~
- double word or % match *<2-LeftMouse>*
- triple line *<3-LeftMouse>*
- quadruple rectangular block *<4-LeftMouse>*
+selection: >
+
+ click select
+ ---------------------------------
+ double word or % match
+ triple line
+ quadruple rectangular block
+
Exception: In a Help window a double click jumps to help for the word that is
clicked on.
+
A double click on a word selects that word. 'iskeyword' is used to specify
which characters are included in a word. A double click on a character
that has a match selects until that match (like using "v%"). If the match is
@@ -365,7 +395,7 @@ an #if/#else/#endif block, the selection becomes linewise.
For MS-Windows and xterm the time for double clicking can be set with the
'mousetime' option. For the other systems this time is defined outside of Vim.
An example, for using a double click to jump to the tag under the cursor: >vim
- :map <2-LeftMouse> :exe "tag " .. expand("<cword>")<CR>
+ :map <2-LeftMouse> :exe "tag " .. expand("<cword>")<CR>
Dragging the mouse with a double click (button-down, button-up, button-down
and then drag) will result in whole words to be selected. This continues
@@ -379,59 +409,62 @@ temporarily. When Visual or Select mode ends, it returns to Insert mode.
This is like using CTRL-O in Insert mode. Select mode is used when the
'selectmode' option contains "mouse".
- *<MiddleRelease>* *<MiddleDrag>*
-Mouse clicks can be mapped. The codes for mouse clicks are:
- code mouse button normal action ~
- <LeftMouse> left pressed set cursor position
- <LeftDrag> left moved while pressed extend selection
- <LeftRelease> left released set selection end
- <MiddleMouse> middle pressed paste text at cursor position
- <MiddleDrag> middle moved while pressed -
- <MiddleRelease> middle released -
- <RightMouse> right pressed extend selection
- <RightDrag> right moved while pressed extend selection
- <RightRelease> right released set selection end
- <X1Mouse> X1 button pressed - *X1Mouse*
- <X1Drag> X1 moved while pressed - *X1Drag*
- <X1Release> X1 button release - *X1Release*
- <X2Mouse> X2 button pressed - *X2Mouse*
- <X2Drag> X2 moved while pressed - *X2Drag*
- <X2Release> X2 button release - *X2Release*
+ *X1Mouse* *X1Drag* *X1Release*
+ *X2Mouse* *X2Drag* *X2Release*
+ *<MiddleRelease>* *<MiddleDrag>*
+Mouse clicks can be mapped. The codes for mouse clicks are: >
+ code mouse button normal action
+ ---------------------------------------------------------------------------
+ <LeftMouse> left pressed set cursor position
+ <LeftDrag> left moved while pressed extend selection
+ <LeftRelease> left released set selection end
+ <MiddleMouse> middle pressed paste text at cursor position
+ <MiddleDrag> middle moved while pressed -
+ <MiddleRelease> middle released -
+ <RightMouse> right pressed extend selection
+ <RightDrag> right moved while pressed extend selection
+ <RightRelease> right released set selection end
+ <X1Mouse> X1 button pressed -
+ <X1Drag> X1 moved while pressed -
+ <X1Release> X1 button release -
+ <X2Mouse> X2 button pressed -
+ <X2Drag> X2 moved while pressed -
+ <X2Release> X2 button release -
The X1 and X2 buttons refer to the extra buttons found on some mice. The
'Microsoft Explorer' mouse has these buttons available to the right thumb.
Currently X1 and X2 only work on Win32 and X11 environments.
Examples: >vim
- :noremap <MiddleMouse> <LeftMouse><MiddleMouse>
+ :noremap <MiddleMouse> <LeftMouse><MiddleMouse>
Paste at the position of the middle mouse button click (otherwise the paste
would be done at the cursor position). >vim
- :noremap <LeftRelease> <LeftRelease>y
+ :noremap <LeftRelease> <LeftRelease>y
Immediately yank the selection, when using Visual mode.
Note the use of ":noremap" instead of "map" to avoid a recursive mapping.
>vim
- :map <X1Mouse> <C-O>
- :map <X2Mouse> <C-I>
+ :map <X1Mouse> <C-O>
+ :map <X2Mouse> <C-I>
Map the X1 and X2 buttons to go forwards and backwards in the jump list, see
|CTRL-O| and |CTRL-I|.
*mouse-swap-buttons*
To swap the meaning of the left and right mouse buttons: >vim
- :noremap <LeftMouse> <RightMouse>
- :noremap <LeftDrag> <RightDrag>
- :noremap <LeftRelease> <RightRelease>
- :noremap <RightMouse> <LeftMouse>
- :noremap <RightDrag> <LeftDrag>
- :noremap <RightRelease> <LeftRelease>
- :noremap g<LeftMouse> <C-RightMouse>
- :noremap g<RightMouse> <C-LeftMouse>
- :noremap! <LeftMouse> <RightMouse>
- :noremap! <LeftDrag> <RightDrag>
- :noremap! <LeftRelease> <RightRelease>
- :noremap! <RightMouse> <LeftMouse>
- :noremap! <RightDrag> <LeftDrag>
- :noremap! <RightRelease> <LeftRelease>
+ :noremap <LeftMouse> <RightMouse>
+ :noremap <LeftDrag> <RightDrag>
+ :noremap <LeftRelease> <RightRelease>
+ :noremap <RightMouse> <LeftMouse>
+ :noremap <RightDrag> <LeftDrag>
+ :noremap <RightRelease> <LeftRelease>
+ :noremap g<LeftMouse> <C-RightMouse>
+ :noremap g<RightMouse> <C-LeftMouse>
+ :noremap! <LeftMouse> <RightMouse>
+ :noremap! <LeftDrag> <RightDrag>
+ :noremap! <LeftRelease> <RightRelease>
+ :noremap! <RightMouse> <LeftMouse>
+ :noremap! <RightDrag> <LeftDrag>
+ :noremap! <RightRelease> <LeftRelease>
<
- vim:tw=78:ts=8:ft=help:norl:
+ vim:et:sw=2:tw=78:ts=8:ft=help:norl:
diff --git a/runtime/doc/ui.txt b/runtime/doc/ui.txt
index 1f5132bd30..d37cdfb9df 100644
--- a/runtime/doc/ui.txt
+++ b/runtime/doc/ui.txt
@@ -9,7 +9,7 @@ Nvim UI protocol *UI* *ui*
Type |gO| to see the table of contents.
==============================================================================
-UI Events *ui-events*
+UI Events *ui-protocol* *ui-events*
UIs can be implemented as external client processes communicating with Nvim
over the RPC API. The default UI model is a terminal-like grid with a single,
@@ -398,8 +398,8 @@ numerical highlight ids to the actual attributes.
`grid` will not be used anymore and the UI can free any data associated
with it.
-["grid_cursor_goto", grid, row, column] ~
- Makes `grid` the current grid and `row, column` the cursor position on this
+["grid_cursor_goto", grid, row, col] ~
+ Makes `grid` the current grid and `row, col` the cursor position on this
grid. This event will be sent at most once in a `redraw` batch and
indicates the visible cursor position.
@@ -610,7 +610,7 @@ tabs.
size). If the window was previously hidden, it should now be shown
again.
-["win_float_pos", grid, win, anchor, anchor_grid, anchor_row, anchor_col, focusable] ~
+["win_float_pos", grid, win, anchor, anchor_grid, anchor_row, anchor_col, focusable, zindex] ~
Display or reconfigure floating window `win`. The window should be
displayed above another grid `anchor_grid` at the specified position
`anchor_row` and `anchor_col`. For the meaning of `anchor` and more
diff --git a/runtime/doc/undo.txt b/runtime/doc/undo.txt
index 3fcc196250..b3a49dbb7e 100644
--- a/runtime/doc/undo.txt
+++ b/runtime/doc/undo.txt
@@ -165,13 +165,13 @@ This is explained in the user manual: |usr_32.txt|.
g- Go to older text state. With a count repeat that many
times.
*:ea* *:earlier*
-:earlier {count} Go to older text state {count} times.
-:earlier {N}s Go to older text state about {N} seconds before.
-:earlier {N}m Go to older text state about {N} minutes before.
-:earlier {N}h Go to older text state about {N} hours before.
-:earlier {N}d Go to older text state about {N} days before.
+:ea[rlier] {count} Go to older text state {count} times.
+:ea[rlier] {N}s Go to older text state about {N} seconds before.
+:ea[rlier] {N}m Go to older text state about {N} minutes before.
+:ea[rlier] {N}h Go to older text state about {N} hours before.
+:ea[rlier] {N}d Go to older text state about {N} days before.
-:earlier {N}f Go to older text state {N} file writes before.
+:ea[rlier] {N}f Go to older text state {N} file writes before.
When changes were made since the last write
":earlier 1f" will revert the text to the state when
it was written. Otherwise it will go to the write
@@ -184,13 +184,13 @@ g- Go to older text state. With a count repeat that many
g+ Go to newer text state. With a count repeat that many
times.
*:lat* *:later*
-:later {count} Go to newer text state {count} times.
-:later {N}s Go to newer text state about {N} seconds later.
-:later {N}m Go to newer text state about {N} minutes later.
-:later {N}h Go to newer text state about {N} hours later.
-:later {N}d Go to newer text state about {N} days later.
+:lat[er] {count} Go to newer text state {count} times.
+:lat[er] {N}s Go to newer text state about {N} seconds later.
+:lat[er] {N}m Go to newer text state about {N} minutes later.
+:lat[er] {N}h Go to newer text state about {N} hours later.
+:lat[er] {N}d Go to newer text state about {N} days later.
-:later {N}f Go to newer text state {N} file writes later.
+:lat[er] {N}f Go to newer text state {N} file writes later.
When at the state of the last file write, ":later 1f"
will go to the newest text state.
diff --git a/runtime/doc/usr_05.txt b/runtime/doc/usr_05.txt
index 076a50c582..698d1207d3 100644
--- a/runtime/doc/usr_05.txt
+++ b/runtime/doc/usr_05.txt
@@ -120,7 +120,7 @@ This switches on three very clever mechanisms:
*restore-cursor* *last-position-jump* >
augroup RestoreCursor
autocmd!
- autocmd BufRead * autocmd FileType <buffer> ++once
+ autocmd BufReadPre * autocmd FileType <buffer> ++once
\ let s:line = line("'\"")
\ | if s:line >= 1 && s:line <= line("$") && &filetype !~# 'commit'
\ && index(['xxd', 'gitrebase'], &filetype) == -1
@@ -234,6 +234,22 @@ an archive or as a repository. For an archive you can follow these steps:
Here "fancytext" is the name of the package, it can be anything
else.
+
+Adding nohlsearch package *nohlsearch-install*
+
+Load the plugin with this command: >
+ packadd nohlsearch
+<
+Automatically execute |:nohlsearch| after 'updatetime' or getting into
+|Insert| mode.
+Thus assuming default updatetime, hlsearch would be suspended/turned off after
+4 seconds of idle time.
+
+To disable the effect of the plugin after it has been loaded: >
+ au! nohlsearch
+<
+
+
More information about packages can be found here: |packages|.
==============================================================================
diff --git a/runtime/doc/usr_21.txt b/runtime/doc/usr_21.txt
index 4ae72bbe84..8671f04ba2 100644
--- a/runtime/doc/usr_21.txt
+++ b/runtime/doc/usr_21.txt
@@ -303,21 +303,21 @@ use, and save this in a session. Then you can go back to this layout whenever
you want.
For example, this is a nice layout to use:
>
- +----------------------------------------+
- | VIM - main help file |
- | |
- |Move around: Use the cursor keys, or "h|
- |help.txt================================|
- |explorer | |
- |dir |~ |
- |dir |~ |
- |file |~ |
- |file |~ |
- |file |~ |
- |file |~ |
- |~/=========|[No File]===================|
- | |
- +----------------------------------------+
+ +----------------------------------------+
+ | VIM - main help file |
+ | |
+ |Move around: Use the cursor keys, or "h|
+ |help.txt================================|
+ |explorer | |
+ |dir |~ |
+ |dir |~ |
+ |file |~ |
+ |file |~ |
+ |file |~ |
+ |file |~ |
+ |~/=========|[No File]===================|
+ | |
+ +----------------------------------------+
<
This has a help window at the top, so that you can read this text. The narrow
vertical window on the left contains a file explorer. This is a Vim plugin
@@ -448,9 +448,9 @@ trust the files you are editing: >
:set nomodeline
-Use this format for the modeline:
+Use this format for the modeline: >
- any-text vim:set {option}={value} ... : any-text ~
+ any-text vim:set {option}={value} ... : any-text
The "any-text" indicates that you can put any text before and after the part
that Vim will use. This allows making it look like a comment, like what was
@@ -462,9 +462,9 @@ using something like "gvim:" will not work.
typing the ":set" command, except that you need to insert a backslash before a
colon (otherwise it would be seen as the end of the modeline).
-Another example:
+Another example: >
- // vim:set textwidth=72 dir=c\:\tmp: use c:\tmp here ~
+ // vim:set textwidth=72 dir=c\:\tmp: use c:\tmp here
There is an extra backslash before the first colon, so that it's included in
the ":set" command. The text after the second colon is ignored, thus a remark
diff --git a/runtime/doc/usr_29.txt b/runtime/doc/usr_29.txt
index dd8598a3a0..eb20f7b6f2 100644
--- a/runtime/doc/usr_29.txt
+++ b/runtime/doc/usr_29.txt
@@ -34,7 +34,7 @@ following command: >
"ctags" is a separate program. Most Unix systems already have it installed.
If you do not have it yet, you can find Universal ctags at:
- https://ctags.io ~
+ https://ctags.io
Universal ctags is preferred, Exuberant ctags is no longer being developed.
@@ -87,7 +87,7 @@ The ":tags" command shows the list of tags that you traversed through:
1 1 write_line 8 write_block.c ~
2 1 write_char 7 write_line.c ~
> ~
->
+<
Now to go back. The CTRL-T command goes to the preceding tag. In the example
above you get back to the "write_line" function, in the call to "write_char".
This command takes a count argument that indicates how many tags to jump
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index ab2eecdfaf..8c7ed875cf 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -836,6 +836,7 @@ System functions and manipulation of files:
getfperm() get the permissions of a file
setfperm() set the permissions of a file
getftype() get the kind of a file
+ isabsolutepath() check if a path is absolute
isdirectory() check if a directory exists
getfsize() get the size of a file
getcwd() get the current working directory
@@ -855,6 +856,7 @@ System functions and manipulation of files:
readblob() read a file into a Blob
readdir() get a List of file names in a directory
writefile() write a List of lines or Blob into a file
+ filecopy() copy a file {from} to {to}
Date and Time: *date-functions* *time-functions*
getftime() get last modification time of a file
@@ -906,7 +908,8 @@ Buffers, windows and the argument list:
Command line: *command-line-functions*
getcmdcompltype() get the type of the current command line
completion
- getcmdline() get the current command line
+ getcmdline() get the current command line input
+ getcmdprompt() get the current command line prompt
getcmdpos() get position of the cursor in the command line
getcmdscreenpos() get screen position of the cursor in the
command line
diff --git a/runtime/doc/usr_toc.txt b/runtime/doc/usr_toc.txt
index dd0d5784f5..d1770ddcd5 100644
--- a/runtime/doc/usr_toc.txt
+++ b/runtime/doc/usr_toc.txt
@@ -2,12 +2,12 @@
VIM USER MANUAL - by Bram Moolenaar
- Table Of Contents *user-manual*
+ Table Of Contents *user-manual* *usr*
==============================================================================
Overview
-Getting Started
+Getting Started ~
|usr_01.txt| About the manuals
|usr_02.txt| The first steps in Vim
|usr_03.txt| Moving around
@@ -21,7 +21,7 @@ Getting Started
|usr_11.txt| Recovering from a crash
|usr_12.txt| Clever tricks
-Editing Effectively
+Editing Effectively ~
|usr_20.txt| Typing command-line commands quickly
|usr_21.txt| Go away and come back
|usr_22.txt| Finding the file to edit
@@ -36,7 +36,7 @@ Editing Effectively
|usr_31.txt| Exploiting the GUI
|usr_32.txt| The undo tree
-Tuning Vim
+Tuning Vim ~
|usr_40.txt| Make new commands
|usr_41.txt| Write a Vim script
|usr_42.txt| Add new menus
@@ -45,7 +45,7 @@ Tuning Vim
|usr_45.txt| Select your language (locale)
-Reference manual
+Reference manual ~
|reference_toc| More detailed information for all commands
The user manual is online:
diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt
index 0287271d4c..33da539c66 100644
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -28,8 +28,8 @@ CTRL-L Clears and redraws the screen. The redraw may happen
:redr[aw][!] Redraws pending screen updates now, or the entire
screen if "!" is included. To CLEAR the screen use
|:mode| or |CTRL-L|.
- Useful to update the screen during a script or
- function (or a mapping if 'lazyredraw' set).
+ It can be used to redraw the screen in a script
+ or function (or a mapping if |'lazyredraw'| is set).
See also |nvim__redraw()|.
*:redraws* *:redrawstatus*
@@ -78,10 +78,9 @@ ga Print the ascii value of the character under the
If the character can be inserted as a digraph, also
output the two characters that can be used to create
the character:
- <ö> 246, Hex 00f6, Oct 366, Digr o: ~
+ <ö> 246, Hex 00f6, Oct 366, Digr o: ~
This shows you can type CTRL-K o : to insert ö.
-
*g8*
g8 Print the hex values of the bytes used in the
character under the cursor, assuming it is in |UTF-8|
@@ -140,12 +139,18 @@ gx Opens the current filepath or URL (decided by
:[range]# [count] [flags]
synonym for :number.
- *:#!*
+ *:#!* *vim-shebang*
:#!{anything} Ignored, so that you can start a Vim script with: >
#!vim -S
- echo "this is a Vim script"
- quit
+ let mylogbook='$HOME/logbook.md'
+ exe $':e {mylogbook}'
+ $
+ put ='## ' .. strftime('%d. %b %Y')
+ norm! o
<
+ Make that script executable and run it to create a
+ new diary entry.
+
*:z* *E144*
:[range]z[+-^.=][count] Display several lines of text surrounding the line
specified with [range], or around the current line
@@ -209,7 +214,7 @@ gx Opens the current filepath or URL (decided by
This implies that an insert command must be completed
(to start Insert mode, see |:startinsert|). A ":"
command must be completed as well. And you can't use
- "Q" or "gQ" to start Ex mode.
+ "gQ" to start Ex mode.
The display is not updated while ":normal" is busy.
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index 5d894bb5e1..e069678b30 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -62,11 +62,12 @@ Defaults *nvim-defaults*
- 'isfname' does not include ":" (on Windows). Drive letters are handled
correctly without it. (Use |gF| for filepaths suffixed with ":line:col").
- 'joinspaces' is disabled
+- 'jumpoptions' defaults to "clean"
- 'langnoremap' is enabled
- 'langremap' is disabled
- 'laststatus' defaults to 2 (statusline is always shown)
- 'listchars' defaults to "tab:> ,trail:-,nbsp:+"
-- 'mouse' defaults to "nvi"
+- 'mouse' defaults to "nvi", see |default-mouse| for details
- 'mousemodel' defaults to "popup_setpos"
- 'nrformats' defaults to "bin,hex"
- 'path' defaults to ".,,". The C ftplugin adds "/usr/include" if it exists.
@@ -100,28 +101,35 @@ Defaults *nvim-defaults*
DEFAULT MOUSE
*default-mouse* *disable-mouse*
-By default the mouse is enabled, and <RightMouse> opens a |popup-menu| with
-standard actions ("Cut", "Copy", "Paste", …). Mouse is NOT enabled in
-|command-mode| or the |more-prompt|, so you can temporarily disable it just by
-typing ":".
+By default the mouse is enabled. This means |scroll-mouse-wheel| will scroll
+the window instead of moving the cursor; <LeftMouse> click places the cursor;
+and <RightMouse> click opens the default |popup-menu| with standard actions.
+
+Mouse is NOT enabled in |Cmdline-mode| or the |more-prompt|, so you can
+temporarily disable it just by typing ":". Or if you want to partially or
+fully disable the mouse or popup-menu, do any of the following:
-If you don't like this you can disable the mouse in your |config| using any of
-the following:
- Disable mouse completely by unsetting the 'mouse' option: >vim
set mouse=
-- Pressing <RightMouse> extends selection instead of showing popup-menu: >vim
+- Change the 'mousemodel', so <RightMouse> extends selection instead of
+ showing the popup-menu: >vim
set mousemodel=extend
-- Pressing <A-LeftMouse> releases mouse until the cursor moves: >vim
+- Map <A-LeftMouse> so that it temporarily disables mouse until the cursor
+ moves: >vim
nnoremap <A-LeftMouse> <Cmd>
\ set mouse=<Bar>
\ echo 'mouse OFF until next cursor-move'<Bar>
\ autocmd CursorMoved * ++once set mouse&<Bar>
\ echo 'mouse ON'<CR>
<
-To remove the "How-to disable mouse" menu item and the separator above it: >vim
+To remove the default popup-menu without disabling mouse: >vim
+ aunmenu PopUp
+ autocmd! nvim_popupmenu
+
+To remove only the "How-to disable mouse" menu item (and its separator): >vim
aunmenu PopUp.How-to\ disable\ mouse
- aunmenu PopUp.-1-
-<
+ aunmenu PopUp.-2-
+
DEFAULT MAPPINGS
*default-mappings*
Nvim creates the following default mappings at |startup|. You can disable any
@@ -145,7 +153,14 @@ of these in your config by simply removing the mapping, e.g. ":unmap Y".
- <C-S> |i_CTRL-S|
- ]d |]d-default|
- [d |[d-default|
+- [D |[D-default|
+- ]D |]D-default|
- <C-W>d |CTRL-W_d-default|
+- |[q|, |]q|, |[Q|, |]Q|, |[CTRL-Q|, |]CTRL-Q|
+- |[l|, |]l|, |[L|, |]L|, |[CTRL-L|, |]CTRL-L|
+- |[t|, |]t|, |[T|, |]T|, |[CTRL-T|, |]CTRL-T|
+- |[a|, |]a|, |[A|, |]A|
+- |[b|, |]b|, |[B|, |]B|
- Nvim LSP client defaults |lsp-defaults|
- K |K-lsp-default|
@@ -164,6 +179,14 @@ nvim_terminal:
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.
+- TermOpen: Sets default options for |terminal| buffers:
+ - 'nomodifiable'
+ - 'undolevels' set to -1
+ - 'textwidth' set to 0
+ - 'nowrap'
+ - 'nolist'
+ - 'winhighlight' uses |hl-StatusLineTerm| and |hl-StatusLineTermNC| in
+ place of |hl-StatusLine| and |hl-StatusLineNC|
nvim_cmdwin:
- CmdwinEnter: Limits syntax sync to maxlines=1 in the |cmdwin|.
@@ -330,7 +353,9 @@ string options work.
- 'guicursor' works in the terminal (TUI)
- 'inccommand' shows interactive results for |:substitute|-like commands
and |:command-preview| commands
-- 'jumpoptions' "view" tries to restore the |mark-view| when moving through
+- 'jumpoptions'
+ - "view" tries to restore |mark-view| when moving through the jumplist.
+ - "clean" removes unloaded buffers from the jumplist.
- the |jumplist|, |changelist|, |alternate-file| or using |mark-motions|.
- 'laststatus' global statusline support
- 'mousescroll' amount to scroll by when scrolling with a mouse
@@ -529,13 +554,13 @@ Functions:
Highlight groups:
- |hl-ColorColumn|, |hl-CursorColumn| are lower priority than most other
groups
-- |hl-CurSearch| highlights match under cursor instead of last match found
- using |n| or |N|
- |hl-CursorLine| is low-priority unless foreground color is set
- |hl-VertSplit| superseded by |hl-WinSeparator|
- Highlight groups names are allowed to contain `@` characters.
- It is an error to define a highlight group with a name that doesn't match
the regexp `[a-zA-Z0-9_.@-]*` (see |group-name|).
+- |hl-StatusLineTerm| |hl-StatusLineTermNC| are implemented as 'winhighlight'
+ window-local highlights which are set by the default |TermOpen| handler.
Macro (|recording|) behavior:
- Replay of a macro recorded during :lmap produces the same actions as when it
@@ -663,17 +688,6 @@ Events:
- *SafeStateAgain*
- *SigUSR1* Use |Signal| to detect `SIGUSR1` signal instead.
-Highlight groups:
-- *hl-StatusLineTerm* *hl-StatusLineTermNC* are unnecessary because Nvim
- supports 'winhighlight' window-local highlights. For example, to mimic Vim's
- StatusLineTerm: >vim
- hi StatusLineTerm ctermfg=black ctermbg=green
- hi StatusLineTermNC ctermfg=green
- autocmd TermOpen,WinEnter * if &buftype=='terminal'
- \|setlocal winhighlight=StatusLine:StatusLineTerm,StatusLineNC:StatusLineTermNC
- \|else|setlocal winhighlight=|endif
-<
-
Options:
- *'aleph'* *'al'*
- antialias
diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt
index 4791e73929..5729dd0874 100644
--- a/runtime/doc/windows.txt
+++ b/runtime/doc/windows.txt
@@ -53,11 +53,27 @@ active yes yes 'a'
hidden no yes 'h'
inactive no no ' '
-Note: All CTRL-W commands can also be executed with |:wincmd|, for those
-places where a Normal mode command can't be used or is inconvenient.
+ *buffer-reuse*
+Each buffer has a unique number and the number will not change within a Vim
+session. The |bufnr()| and |bufname()| functions can be used to convert
+between a buffer name and the buffer number. There is one exception: if a new
+empty buffer is created and it is not modified, the buffer will be re-used
+when loading another file into that buffer. This also means the buffer number
+will not change.
The main Vim window can hold several split windows. There are also tab pages
|tab-page|, each of which can hold multiple windows.
+
+ *focusable*
+If a window is focusable, it is part of the "navigation stack", that is,
+editor commands such as :windo, |CTRL-W|, etc., will consider the window as
+one that can be made the "current window". A non-focusable window will be
+skipped by such commands (though it can be explicitly focused by
+|nvim_set_current_win()|).
+
+Windows (especially floating windows) can have many other |api-win_config|
+properties such as "hide" and "fixed" which also affect behavior.
+
*window-ID* *winid* *windowid*
Each window has a unique identifier called the window ID. This identifier
will not change within a Vim session. The |win_getid()| and |win_id2tabwin()|
@@ -69,9 +85,6 @@ across tabs. For most functions that take a window ID or a window number, the
window number only applies to the current tab, while the window ID can refer
to a window in any tab.
-Each buffer has a unique number and the number will not change within a Vim
-session. The |bufnr()| and |bufname()| functions can be used to convert
-between a buffer name and the buffer number.
==============================================================================
2. Starting Vim *windows-starting*
@@ -423,18 +436,19 @@ CTRL-W l Move cursor to Nth window right of current one. Uses the
cursor position to select between alternatives.
CTRL-W w *CTRL-W_w* *CTRL-W_CTRL-W*
-CTRL-W CTRL-W Without count: move cursor to window below/right of the
- current one. If there is no window below or right, go to
- top-left window.
- With count: go to Nth window (windows are numbered from
- top-left to bottom-right). To obtain the window number see
- |bufwinnr()| and |winnr()|. When N is larger than the number
- of windows go to the last window.
+CTRL-W CTRL-W Without count: move cursor to the |focusable| window
+ below/right of the current one. If there is no (focusable)
+ window below or right, go to top-left window. With count: go
+ to Nth window (windows are numbered from top-left to
+ bottom-right). To obtain the window number see |bufwinnr()|
+ and |winnr()|. When N is larger than the number of windows go
+ to the last window.
*CTRL-W_W*
-CTRL-W W Without count: move cursor to window above/left of current
- one. If there is no window above or left, go to bottom-right
- window. With count: go to Nth window, like with CTRL-W w.
+CTRL-W W Without count: move cursor to the |focusable| window
+ above/left of current one. If there is no window above or
+ left, go to bottom-right window. With count: go to Nth
+ window, like with CTRL-W w.
CTRL-W t *CTRL-W_t* *CTRL-W_CTRL-T*
CTRL-W CTRL-T Move cursor to top-left window.
@@ -468,6 +482,10 @@ These commands can also be executed with ":wincmd":
:exe nr .. "wincmd w"
< This goes to window "nr".
+Note: All CTRL-W commands can also be executed with |:wincmd|, for those
+places where a Normal mode command can't be used or is inconvenient (e.g.
+in a browser-based terminal).
+
==============================================================================
5. Moving windows around *window-moving*
@@ -787,9 +805,9 @@ can also get to them with the buffer list commands, like ":bnext".
8. Do a command in all buffers or windows *list-repeat*
*:windo*
-:[range]windo {cmd} Execute {cmd} in each window or if [range] is given
- only in windows for which the window number lies in
- the [range]. It works like doing this: >
+:[range]windo {cmd} Execute {cmd} in each |focusable| window, or only for
+ windows in a given [range] of window numbers. It works
+ like doing this: >
CTRL-W t
:{cmd}
CTRL-W w
@@ -1175,11 +1193,12 @@ list of buffers. |unlisted-buffer|
:bw[ipeout][!] N1 N2 ...
Like |:bdelete|, but really delete the buffer. Everything
related to the buffer is lost. All marks in this buffer
- become invalid, option settings are lost, etc. Don't use this
+ become invalid, option settings are lost, the jumplist and
+ tagstack data will be purged, etc. Don't use this
unless you know what you are doing. Examples: >
- :.+,$bwipeout " wipe out all buffers after the current
- " one
- :%bwipeout " wipe out all buffers
+ :.+,$bwipeout " wipe out all buffers after the current
+ " one
+ :%bwipeout " wipe out all buffers
<
:[N]bun[load][!] *:bun* *:bunload* *E515*
:bun[load][!] [N]
@@ -1242,7 +1261,7 @@ list of buffers. |unlisted-buffer|
:w foobar | sp #
< Also see |+cmd|.
-:[N]bn[ext][!] [+cmd] [N] *:bn* *:bnext* *E87*
+:[N]bn[ext][!] [+cmd] [N] *:bn* *:bnext* *[b* *E87*
Go to [N]th next buffer in buffer list. [N] defaults to one.
Wraps around the end of the buffer list.
See |:buffer-!| for [!].
@@ -1260,7 +1279,7 @@ list of buffers. |unlisted-buffer|
Wraps around the end of the buffer list. Uses 'switchbuf'
Also see |+cmd|.
-:[N]bN[ext][!] [+cmd] [N] *:bN* *:bNext* *:bp* *:bprevious* *E88*
+:[N]bN[ext][!] [+cmd] [N] *:bN* *:bNext* *:bp* *:bprevious* *]b* *E88*
:[N]bp[revious][!] [+cmd] [N]
Go to [N]th previous buffer in buffer list. [N] defaults to
one. Wraps around the start of the buffer list.
@@ -1274,7 +1293,7 @@ list of buffers. |unlisted-buffer|
Uses 'switchbuf'.
Also see |+cmd|.
-:br[ewind][!] [+cmd] *:br* *:bre* *:brewind*
+:br[ewind][!] [+cmd] *:br* *:bre* *:brewind* *[B*
Go to first buffer in buffer list. If the buffer list is
empty, go to the first unlisted buffer.
See |:buffer-!| for [!].
@@ -1292,7 +1311,7 @@ list of buffers. |unlisted-buffer|
:sbf[irst] [+cmd] *:sbf* *:sbfirst*
Same as ":sbrewind".
-:bl[ast][!] [+cmd] *:bl* *:blast*
+:bl[ast][!] [+cmd] *:bl* *:blast* *]B*
Go to last buffer in buffer list. If the buffer list is
empty, go to the last unlisted buffer.
See |:buffer-!| for [!].
diff --git a/runtime/filetype.lua b/runtime/filetype.lua
index 4880ed55ef..797033da06 100644
--- a/runtime/filetype.lua
+++ b/runtime/filetype.lua
@@ -21,7 +21,7 @@ vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile', 'StdinReadPost' }, {
-- Generic configuration file used as fallback
ft = require('vim.filetype.detect').conf(args.file, args.buf)
if ft then
- vim.api.nvim_buf_call(args.buf, function()
+ vim._with({ buf = args.buf }, function()
vim.api.nvim_cmd({ cmd = 'setf', args = { 'FALLBACK', ft } }, {})
end)
end
@@ -32,22 +32,13 @@ vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile', 'StdinReadPost' }, {
on_detect(args.buf)
end
- vim.api.nvim_buf_call(args.buf, function()
+ vim._with({ buf = args.buf }, function()
vim.api.nvim_cmd({ cmd = 'setf', args = { ft } }, {})
end)
end
end,
})
--- These *must* be sourced after the autocommand above is created
-if not vim.g.did_load_ftdetect then
- vim.cmd([[
- augroup filetypedetect
- runtime! ftdetect/*.{vim,lua}
- augroup END
- ]])
-end
-
-- Set up the autocmd for user scripts.vim
vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
group = 'filetypedetect',
@@ -62,3 +53,10 @@ vim.api.nvim_create_autocmd('StdinReadPost', {
if not vim.g.ft_ignore_pat then
vim.g.ft_ignore_pat = '\\.\\(Z\\|gz\\|bz2\\|zip\\|tgz\\)$'
end
+
+-- These *must* be sourced after the autocommands above are created
+vim.cmd([[
+ augroup filetypedetect
+ runtime! ftdetect/*.{vim,lua}
+ augroup END
+]])
diff --git a/runtime/ftplugin/abaqus.vim b/runtime/ftplugin/abaqus.vim
index c16e7b032e..d4bb6fe777 100644
--- a/runtime/ftplugin/abaqus.vim
+++ b/runtime/ftplugin/abaqus.vim
@@ -3,6 +3,7 @@
" Maintainer: Carl Osterwisch <costerwi@gmail.com>
" Last Change: 2022 Oct 08
" 2024 Jan 14 by Vim Project (browsefilter)
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin") | finish | endif
@@ -27,7 +28,7 @@ setlocal isfname-=,
" Define format of comment lines (see 'formatoptions' for uses)
setlocal comments=:**
-setlocal commentstring=**%s
+setlocal commentstring=**\ %s
" Definitions start with a * and assign a NAME, NSET, or ELSET
" Used in [d ^wd and other commands
diff --git a/runtime/ftplugin/antlr4.vim b/runtime/ftplugin/antlr4.vim
new file mode 100644
index 0000000000..610d5284fb
--- /dev/null
+++ b/runtime/ftplugin/antlr4.vim
@@ -0,0 +1,14 @@
+" Vim filetype plugin
+" Language: ANTLR4, ANother Tool for Language Recognition v4 <www.antlr.org>
+" Maintainer: Yinzuo Jiang <jiangyinzuo@foxmail.com>
+" Last Change: 2024 July 09
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
+setlocal commentstring=//\ %s
+
+let b:undo_ftplugin = 'setl com< cms<'
diff --git a/runtime/ftplugin/arduino.lua b/runtime/ftplugin/arduino.lua
new file mode 100644
index 0000000000..89ab42ef54
--- /dev/null
+++ b/runtime/ftplugin/arduino.lua
@@ -0,0 +1,3 @@
+vim.bo.commentstring = '// %s'
+
+vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<'
diff --git a/runtime/ftplugin/arduino.vim b/runtime/ftplugin/arduino.vim
index dae3dd83d3..60b11dab1a 100644
--- a/runtime/ftplugin/arduino.vim
+++ b/runtime/ftplugin/arduino.vim
@@ -3,6 +3,7 @@
" Maintainer: The Vim Project <https://github.com/vim/vim>
" Ken Takata <https://github.com/k-takata>
" Last Change: 2024 Apr 12
+" 2024 Jun 02 by Riley Bruins <ribru17@gmail.com> ('commentstring')
"
" Most of the part was copied from c.vim.
@@ -32,7 +33,7 @@ setlocal fo-=t fo+=croql
" These options have the right value as default, but the user may have
" overruled that.
-setlocal commentstring& define& include&
+setlocal commentstring=/*\ %s\ */ define& include&
" Set completion with CTRL-X CTRL-O to autoloaded function.
if exists('&ofu')
diff --git a/runtime/ftplugin/asm.vim b/runtime/ftplugin/asm.vim
index 0ae1610394..4482b90d0b 100644
--- a/runtime/ftplugin/asm.vim
+++ b/runtime/ftplugin/asm.vim
@@ -4,13 +4,14 @@
" Last Change: 2020 May 23
" 2023 Aug 28 by Vim Project (undo_ftplugin)
" 2024 Apr 09 by Vim Project (add Matchit support)
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
setl include=^\\s*%\\s*include
setl comments=:;,s1:/*,mb:*,ex:*/,://
-setl commentstring=;%s
+setl commentstring=;\ %s
let b:undo_ftplugin = "setl commentstring< comments< include<"
diff --git a/runtime/ftplugin/astro.vim b/runtime/ftplugin/astro.vim
index 0b0e03447b..5d35ba9624 100644
--- a/runtime/ftplugin/astro.vim
+++ b/runtime/ftplugin/astro.vim
@@ -2,6 +2,7 @@
" Language: Astro
" Maintainer: Romain Lafourcade <romainlafourcade@gmail.com>
" Last Change: 2024 Apr 21
+" 2024 May 24 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -25,17 +26,17 @@ function! s:AstroComments() abort
\ || s:IdentifyScope('^\s*<script', '^\s*<\/script>')
" ECMAScript comments
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
- setlocal commentstring=//%s
+ setlocal commentstring=//\ %s
elseif s:IdentifyScope('^\s*<style', '^\s*<\/style>')
" CSS comments
setlocal comments=s1:/*,mb:*,ex:*/
- setlocal commentstring=/*%s*/
+ setlocal commentstring=/*\ %s\ */
else
" HTML comments
setlocal comments=s:<!--,m:\ \ \ \ ,e:-->
- setlocal commentstring=<!--%s-->
+ setlocal commentstring=<!--\ %s\ -->
endif
endfunction
diff --git a/runtime/ftplugin/asy.vim b/runtime/ftplugin/asy.vim
new file mode 100644
index 0000000000..76bd69d202
--- /dev/null
+++ b/runtime/ftplugin/asy.vim
@@ -0,0 +1,14 @@
+" Vim filetype plugin
+" Language: Asymptote
+" Maintainer: AvidSeeker <avidseeker7@protonmail.com>
+" Last Change: 2024 Jul 13
+"
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let g:did_ftplugin = 1
+
+setlocal commentstring=/*\ %s\ */
+
+let b:undo_ftplugin = "setl commentstring<"
diff --git a/runtime/ftplugin/autohotkey.vim b/runtime/ftplugin/autohotkey.vim
new file mode 100644
index 0000000000..9cb4fd7fdf
--- /dev/null
+++ b/runtime/ftplugin/autohotkey.vim
@@ -0,0 +1,16 @@
+" Vim filetype plugin file
+" Language: AutoHotkey
+" Maintainer: Peter Aronoff <peteraronoff@fastmail.com>
+" Last Changed: 2024 Jul 25
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
+
+setlocal comments=:;
+setlocal commentstring=;\ %s
+
+let b:undo_ftplugin = "setlocal comments< commentstring<"
+
+" vim: nowrap sw=2 sts=2 ts=8 noet:
diff --git a/runtime/ftplugin/bindzone.vim b/runtime/ftplugin/bindzone.vim
new file mode 100644
index 0000000000..f9e5f4ba3c
--- /dev/null
+++ b/runtime/ftplugin/bindzone.vim
@@ -0,0 +1,16 @@
+" Vim filetype plugin file
+" Language: bind zone file
+" Maintainer: This runtime file is looking for a new maintainer.
+" Last Change: 2024 Jul 06
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin=1
+
+setlocal comments=b:;
+setlocal commentstring=;\ %s
+setlocal formatoptions-=t
+setlocal formatoptions+=crq
+
+let b:undo_ftplugin = "setlocal com< cms< fo<"
diff --git a/runtime/ftplugin/bitbake.vim b/runtime/ftplugin/bitbake.vim
index 99fe334627..4d50a7feb7 100644
--- a/runtime/ftplugin/bitbake.vim
+++ b/runtime/ftplugin/bitbake.vim
@@ -3,13 +3,14 @@
" Maintainer: Gregory Anders <greg@gpanders.com>
" Repository: https://github.com/openembedded/bitbake
" Latest Revision: 2022-07-23
+" 2024-05-23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
setlocal comments=:#
setlocal suffixesadd=.bb,.bbclass
diff --git a/runtime/ftplugin/c.lua b/runtime/ftplugin/c.lua
index 0ddbf09470..09e286201b 100644
--- a/runtime/ftplugin/c.lua
+++ b/runtime/ftplugin/c.lua
@@ -1,5 +1,5 @@
-- These are the default option values in Vim, but not in Nvim, so must be set explicitly.
-vim.bo.commentstring = '/*%s*/'
+vim.bo.commentstring = '// %s'
vim.bo.define = '^\\s*#\\s*define'
vim.bo.include = '^\\s*#\\s*include'
@@ -11,4 +11,4 @@ if vim.fn.isdirectory('/usr/include') == 1 then
]])
end
-vim.b.undo_ftplugin = vim.b.undo_ftplugin .. '|setl path<'
+vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring< define< include< path<'
diff --git a/runtime/ftplugin/c.vim b/runtime/ftplugin/c.vim
index 716b454675..8b2b784eb4 100644
--- a/runtime/ftplugin/c.vim
+++ b/runtime/ftplugin/c.vim
@@ -2,6 +2,7 @@
" Language: C
" Maintainer: The Vim Project <https://github.com/vim/vim>
" Last Change: 2023 Aug 22
+" 2024 Jun 02 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" Only do this when not done yet for this buffer
@@ -24,7 +25,7 @@ setlocal fo-=t fo+=croql
" These options have the right value as default, but the user may have
" overruled that.
-setlocal commentstring& define& include&
+setlocal commentstring=/*\ %s\ */ define& include&
" Set completion with CTRL-X CTRL-O to autoloaded function.
if exists('&ofu')
diff --git a/runtime/ftplugin/cabal.vim b/runtime/ftplugin/cabal.vim
new file mode 100644
index 0000000000..5ccfa1df70
--- /dev/null
+++ b/runtime/ftplugin/cabal.vim
@@ -0,0 +1,13 @@
+" Vim filetype plugin file
+" Language: Haskell Cabal Build file
+" Maintainer: Riley Bruins <ribru17@gmail.com>
+" Last Change: 2024 Jul 06
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setl comments=:-- commentstring=--\ %s
+
+let b:undo_ftplugin = 'setl com< cms<'
diff --git a/runtime/ftplugin/calendar.vim b/runtime/ftplugin/calendar.vim
index f454ba1dc8..c4e683acf6 100644
--- a/runtime/ftplugin/calendar.vim
+++ b/runtime/ftplugin/calendar.vim
@@ -2,6 +2,7 @@
" Language: calendar(1) input file
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2008-07-09
+" 2024-06-02 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -13,7 +14,7 @@ set cpo&vim
let b:undo_ftplugin = "setl com< cms< inc< fo<"
-setlocal comments=s1:/*,mb:*,ex:*/ commentstring& include&
+setlocal comments=s1:/*,mb:*,ex:*/ commentstring=/*\ %s\ */ include&
setlocal formatoptions-=t formatoptions+=croql
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/calender.lua b/runtime/ftplugin/calender.lua
deleted file mode 100644
index b4e68148f5..0000000000
--- a/runtime/ftplugin/calender.lua
+++ /dev/null
@@ -1 +0,0 @@
-vim.bo.commentstring = '/*%s*/'
diff --git a/runtime/ftplugin/cedar.vim b/runtime/ftplugin/cedar.vim
new file mode 100644
index 0000000000..74a1903b46
--- /dev/null
+++ b/runtime/ftplugin/cedar.vim
@@ -0,0 +1,13 @@
+" Vim filetype plugin
+" Language: Cedar
+" Maintainer: Riley Bruins <ribru17@gmail.com>
+" Last Change: 2024 Jul 4
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setl comments=:// commentstring=//\ %s
+
+let b:undo_ftplugin = 'setl com< cms<'
diff --git a/runtime/ftplugin/cgdbrc.vim b/runtime/ftplugin/cgdbrc.vim
index 46cf135c5c..99f9702d26 100644
--- a/runtime/ftplugin/cgdbrc.vim
+++ b/runtime/ftplugin/cgdbrc.vim
@@ -3,6 +3,7 @@
" Maintainer: Wu, Zhenyu <wuzhenyu@ustc.edu>
" Documentation: https://cgdb.github.io/docs/Configuring-CGDB.html
" Latest Revision: 2024-04-09
+" 2024-05-23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists('b:did_ftplugin')
finish
@@ -14,7 +15,7 @@ set cpoptions&vim
let b:undo_ftplugin = 'setl com< cms<'
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
setlocal comments=:#
let &cpoptions = s:save_cpoptions
diff --git a/runtime/ftplugin/ch.lua b/runtime/ftplugin/ch.lua
new file mode 100644
index 0000000000..89ab42ef54
--- /dev/null
+++ b/runtime/ftplugin/ch.lua
@@ -0,0 +1,3 @@
+vim.bo.commentstring = '// %s'
+
+vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<'
diff --git a/runtime/ftplugin/chicken.vim b/runtime/ftplugin/chicken.vim
index 84d45bae1e..b12b264f6e 100644
--- a/runtime/ftplugin/chicken.vim
+++ b/runtime/ftplugin/chicken.vim
@@ -1,12 +1,12 @@
" CHICKEN-specific Vim customizations
-" Last Change: 2018-03-05
-" Author: Evan Hanson <evhan@foldling.org>
-" Maintainer: Evan Hanson <evhan@foldling.org>
-" Repository: https://git.foldling.org/vim-scheme.git
-" URL: https://foldling.org/vim/ftplugin/chicken.vim
-" Notes: These are supplemental settings, to be loaded after the core
-" Scheme ftplugin file (ftplugin/scheme.vim). Enable it by setting
-" b:is_chicken=1 and filetype=scheme.
+" Last Change: 2024 Jun 21
+" Author: Evan Hanson <evhan@foldling.org>
+" Maintainer: Evan Hanson <evhan@foldling.org>
+" Repository: https://git.foldling.org/vim-scheme.git
+" URL: https://foldling.org/vim/ftplugin/chicken.vim
+" Notes: These are supplemental settings, to be loaded after the
+" core Scheme ftplugin file (ftplugin/scheme.vim). Enable
+" it by setting b:is_chicken=1 and filetype=scheme.
if !exists('b:did_scheme_ftplugin')
finish
diff --git a/runtime/ftplugin/cmakecache.vim b/runtime/ftplugin/cmakecache.vim
new file mode 100644
index 0000000000..6753cd284a
--- /dev/null
+++ b/runtime/ftplugin/cmakecache.vim
@@ -0,0 +1,13 @@
+" Vim filetype plugin
+" Language: cmakecache - CMakeCache.txt files generated by CMake
+" Maintainer: Riley Bruins <ribru17@gmail.com>
+" Last Change: 2024 Jul 06
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setl comments=:#,:// commentstring=//\ %s
+
+let b:undo_ftplugin = 'setl com< cms<'
diff --git a/runtime/ftplugin/context.vim b/runtime/ftplugin/context.vim
index 37f7240d7b..ed6b5fa672 100644
--- a/runtime/ftplugin/context.vim
+++ b/runtime/ftplugin/context.vim
@@ -12,10 +12,6 @@ let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo&vim
-if !exists('current_compiler')
- compiler context
-endif
-
let b:undo_ftplugin = "setl com< cms< def< inc< sua< fo< ofu<"
setlocal comments=b:%D,b:%C,b:%M,:% commentstring=%\ %s formatoptions+=tjcroql2
@@ -108,6 +104,12 @@ if get(g:, 'context_mappings', 1)
endif
endif
+if !exists('current_compiler')
+ let b:undo_ftplugin ..= "| compiler make"
+ compiler context
+endif
+
+let b:undo_ftplugin ..= "| sil! delc -buffer ConTeXt | sil! delc -buffer ConTeXtLog | sil! delc -buffer ConTeXtJobStatus | sil! delc -buffer ConTeXtStopJobs"
" Commands for asynchronous typesetting
command! -buffer -nargs=? -complete=file ConTeXt call context#typeset(<q-args>)
command! -nargs=0 ConTeXtJobStatus call context#job_status()
diff --git a/runtime/ftplugin/cpp.vim b/runtime/ftplugin/cpp.vim
index d4931a2533..73768bc592 100644
--- a/runtime/ftplugin/cpp.vim
+++ b/runtime/ftplugin/cpp.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: 2024 Jun 06
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" Only do this when not done yet for this buffer
@@ -10,7 +10,12 @@ if exists("b:did_ftplugin")
endif
" Behaves mostly just like C
-runtime! ftplugin/c.{vim,lua} ftplugin/c_*.{vim,lua} ftplugin/c/*.{vim,lua}
+" XXX: "[.]" in the first pattern makes it a wildcard on Windows
+runtime! ftplugin/c[.]{vim,lua} ftplugin/c_*.{vim,lua} ftplugin/c/*.{vim,lua}
+
+" Change 'commentstring' to "C++ style"/"mono-line" comments
+setlocal commentstring=//\ %s
+let b:undo_ftplugin ..= ' | setl commentstring<'
" C++ uses templates with <things>
" Disabled, because it gives an error for typing an unmatched ">".
diff --git a/runtime/ftplugin/cs.lua b/runtime/ftplugin/cs.lua
index b4e68148f5..89ab42ef54 100644
--- a/runtime/ftplugin/cs.lua
+++ b/runtime/ftplugin/cs.lua
@@ -1 +1,3 @@
-vim.bo.commentstring = '/*%s*/'
+vim.bo.commentstring = '// %s'
+
+vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<'
diff --git a/runtime/ftplugin/csh.vim b/runtime/ftplugin/csh.vim
index a22bee3279..74666b9680 100644
--- a/runtime/ftplugin/csh.vim
+++ b/runtime/ftplugin/csh.vim
@@ -4,6 +4,7 @@
" Previous Maintainer: Dan Sharp
" Contributor: Johannes Zellner <johannes@zellner.org>
" Last Change: 2024 Jan 14
+" 2024 May 23 by Riley Bruins ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -14,7 +15,7 @@ let s:save_cpo = &cpo
set cpo-=C
setlocal comments=:#
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
setlocal formatoptions-=t
setlocal formatoptions+=crql
diff --git a/runtime/ftplugin/css.lua b/runtime/ftplugin/css.lua
deleted file mode 100644
index b4e68148f5..0000000000
--- a/runtime/ftplugin/css.lua
+++ /dev/null
@@ -1 +0,0 @@
-vim.bo.commentstring = '/*%s*/'
diff --git a/runtime/ftplugin/css.vim b/runtime/ftplugin/css.vim
index ece2def4ee..778a9e12d6 100644
--- a/runtime/ftplugin/css.vim
+++ b/runtime/ftplugin/css.vim
@@ -3,6 +3,7 @@
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Last Change: 2020 Dec 21
+" 2024 Jun 02 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -14,7 +15,7 @@ set cpo&vim
let b:undo_ftplugin = "setl com< cms< inc< fo< ofu< isk<"
-setlocal comments=s1:/*,mb:*,ex:*/ commentstring&
+setlocal comments=s1:/*,mb:*,ex:*/ commentstring=/*\ %s\ */
setlocal formatoptions-=t formatoptions+=croql
setlocal omnifunc=csscomplete#CompleteCSS
setlocal iskeyword+=-
diff --git a/runtime/ftplugin/csv.vim b/runtime/ftplugin/csv.vim
new file mode 100644
index 0000000000..60412ee527
--- /dev/null
+++ b/runtime/ftplugin/csv.vim
@@ -0,0 +1,22 @@
+" Maintainer: Maxim Kim <habamax@gmail.com>
+" Converted from vim9script
+" Last Update: 2024-06-18
+
+if !exists("b:csv_delimiter")
+ " detect delimiter
+ let s:delimiters = ",;\t|"
+
+ let s:max = 0
+ for s:d in s:delimiters
+ let s:count = getline(1)->split(s:d)->len() + getline(2)->split(s:d)->len()
+ if s:count > s:max
+ let s:max = s:count
+ let b:csv_delimiter = s:d
+ endif
+ endfor
+endif
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
diff --git a/runtime/ftplugin/cuda.vim b/runtime/ftplugin/cuda.vim
new file mode 100644
index 0000000000..91d722b649
--- /dev/null
+++ b/runtime/ftplugin/cuda.vim
@@ -0,0 +1,11 @@
+" Vim filetype plugin
+" Language: CUDA
+" Maintainer: Riley Bruins <ribru17@gmail.com>
+" Last Change: 2024 Jul 29
+
+if exists('b:did_ftplugin')
+ finish
+endif
+
+" Behaves mostly just like C++
+runtime! ftplugin/cpp.vim
diff --git a/runtime/ftplugin/d.lua b/runtime/ftplugin/d.lua
index b4e68148f5..89ab42ef54 100644
--- a/runtime/ftplugin/d.lua
+++ b/runtime/ftplugin/d.lua
@@ -1 +1,3 @@
-vim.bo.commentstring = '/*%s*/'
+vim.bo.commentstring = '// %s'
+
+vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<'
diff --git a/runtime/ftplugin/deb822sources.vim b/runtime/ftplugin/deb822sources.vim
index 4936f42bf9..31c81b1a5d 100644
--- a/runtime/ftplugin/deb822sources.vim
+++ b/runtime/ftplugin/deb822sources.vim
@@ -1,6 +1,6 @@
" Language: Debian sources.list
" Maintainer: Debian Vim Maintainers <team+vim@tracker.debian.org>
-" Last Change: 2024 Mar 20
+" Last Change: 2024 May 25
" License: Vim License
" URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/ftplugin/deb822sources.vim
@@ -10,7 +10,7 @@ endif
let b:did_ftplugin=1
setlocal comments=:#
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
setlocal formatoptions-=t
let b:undo_ftplugin = 'setlocal comments< commentstring< formatoptions<'
diff --git a/runtime/ftplugin/debcontrol.vim b/runtime/ftplugin/debcontrol.vim
index bb710e597c..5b8292ba6e 100644
--- a/runtime/ftplugin/debcontrol.vim
+++ b/runtime/ftplugin/debcontrol.vim
@@ -2,7 +2,7 @@
" Language: Debian control files
" Maintainer: Debian Vim Maintainers
" Former Maintainer: Pierre Habouzit <madcoder@debian.org>
-" Last Change: 2023 Jan 16
+" Last Change: 2024 May 25
" URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/ftplugin/debcontrol.vim
" Do these settings once per buffer
@@ -19,8 +19,11 @@ if exists('g:debcontrol_fold_enable')
endif
setlocal textwidth=0
+setlocal comments=:#
+setlocal commentstring=#\ %s
+
" Clean unloading
-let b:undo_ftplugin = 'setlocal tw< foldmethod< foldexpr< foldtext<'
+let b:undo_ftplugin = 'setlocal tw< foldmethod< foldexpr< foldtext< comments< commentstring<'
" }}}1
diff --git a/runtime/ftplugin/debsources.vim b/runtime/ftplugin/debsources.vim
index cbb4fafd22..2c5ea3599f 100644
--- a/runtime/ftplugin/debsources.vim
+++ b/runtime/ftplugin/debsources.vim
@@ -1,6 +1,6 @@
" Language: Debian sources.list
" Maintainer: Debian Vim Maintainers <team+vim@tracker.debian.org>
-" Last Change: 2023 Aug 30
+" Last Change: 2024 May 25
" License: Vim License
" URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/ftplugin/debsources.vim
@@ -10,7 +10,7 @@ endif
let b:did_ftplugin=1
setlocal comments=:#
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
setlocal formatoptions-=t
let b:undo_ftplugin = 'setlocal comments< commentstring< formatoptions<'
diff --git a/runtime/ftplugin/desktop.vim b/runtime/ftplugin/desktop.vim
index bd6fd7097c..d15afd24b9 100644
--- a/runtime/ftplugin/desktop.vim
+++ b/runtime/ftplugin/desktop.vim
@@ -2,6 +2,7 @@
" Language: XDG desktop entry
" Maintainer: Eisuke Kawashima ( e.kawaschima+vim AT gmail.com )
" Last Change: 2022-07-26
+" 2024-05-24 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists('b:did_ftplugin')
finish
@@ -9,5 +10,5 @@ endif
let b:did_ftplugin = v:true
setl comments=:#
-setl commentstring=#%s
+setl commentstring=#\ %s
let b:undo_ftplugin = 'setl com< cms<'
diff --git a/runtime/ftplugin/dot.lua b/runtime/ftplugin/dot.lua
new file mode 100644
index 0000000000..89ab42ef54
--- /dev/null
+++ b/runtime/ftplugin/dot.lua
@@ -0,0 +1,3 @@
+vim.bo.commentstring = '// %s'
+
+vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<'
diff --git a/runtime/ftplugin/dtd.vim b/runtime/ftplugin/dtd.vim
index bea8c5c18a..f97014814b 100644
--- a/runtime/ftplugin/dtd.vim
+++ b/runtime/ftplugin/dtd.vim
@@ -6,6 +6,7 @@
" Former maintainer: Dan Sharp
" Last Change: 2009 Jan 20
" 2024 Jan 14 by Vim Project (browsefilter)
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
@@ -15,7 +16,7 @@ let b:did_ftplugin = 1
let s:save_cpo = &cpo
set cpo-=C
-setlocal commentstring=<!--%s-->
+setlocal commentstring=<!--\ %s\ -->
setlocal comments=s:<!--,m:\ \ \ \ \ ,e:-->
setlocal formatoptions-=t
diff --git a/runtime/ftplugin/dtrace.vim b/runtime/ftplugin/dtrace.vim
index 9288097f7f..a276b310a3 100644
--- a/runtime/ftplugin/dtrace.vim
+++ b/runtime/ftplugin/dtrace.vim
@@ -1,6 +1,7 @@
" Language: D script as described in "Solaris Dynamic Tracing Guide",
" http://docs.sun.com/app/docs/doc/817-6223
" Last Change: 2008/03/20
+" 2024/05/23 by Riley Bruins <ribru17@gmail.com ('commentstring')
" Version: 1.2
" Maintainer: Nicolas Weber <nicolasweber@gmx.de>
@@ -26,8 +27,8 @@ setlocal fo-=t fo+=croql
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/
" dtrace uses /* */ comments. Set this explicitly, just in case the user
-" changed this (/*%s*/ is the default)
-setlocal commentstring=/*%s*/
+" changed this (/*\ %s\ */ is the default)
+setlocal commentstring=/*\ %s\ */
setlocal iskeyword+=@,$
diff --git a/runtime/ftplugin/dts.vim b/runtime/ftplugin/dts.vim
index 42e38338b7..346ff94704 100644
--- a/runtime/ftplugin/dts.vim
+++ b/runtime/ftplugin/dts.vim
@@ -2,6 +2,7 @@
" Language: dts/dtsi (device tree files)
" Maintainer: Wu, Zhenyu <wuzhenyu@ustc.edu>
" Latest Revision: 2024 Apr 12
+" 2024 Jun 02 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists('b:did_ftplugin')
finish
@@ -12,5 +13,5 @@ let b:undo_ftplugin = 'setl inc< cms< com<'
setlocal include=^\\%(#include\\\|/include/\\)
" same as C
-setlocal commentstring&
+setlocal commentstring=/*\ %s\ */
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:///,://
diff --git a/runtime/ftplugin/editorconfig.vim b/runtime/ftplugin/editorconfig.vim
new file mode 100644
index 0000000000..6d437351eb
--- /dev/null
+++ b/runtime/ftplugin/editorconfig.vim
@@ -0,0 +1,13 @@
+" Vim filetype plugin
+" Language: EditorConfig
+" Maintainer: Riley Bruins <ribru17@gmail.com>
+" Last Change: 2024 Jul 06
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setl comments=:#,:; commentstring=#\ %s
+
+let b:undo_ftplugin = 'setl com< cms<'
diff --git a/runtime/ftplugin/erlang.vim b/runtime/ftplugin/erlang.vim
index 1cb57f4c85..5a3ab717d9 100644
--- a/runtime/ftplugin/erlang.vim
+++ b/runtime/ftplugin/erlang.vim
@@ -6,7 +6,8 @@
" Eduardo Lopez (http://github.com/tapichu)
" Arvid Bjurklint (http://github.com/slarwise)
" Paweł Zacharek (http://github.com/subc2)
-" Last Update: 2023-Dec-20
+" Riley Bruins (http://github.com/ribru17) ('commentstring')
+" Last Update: 2024 May 23
" License: Vim license
" URL: https://github.com/vim-erlang/vim-erlang-runtime
@@ -27,7 +28,7 @@ if get(g:, 'erlang_folding', 0)
endif
setlocal comments=:%%%,:%%,:%
-setlocal commentstring=%%s
+setlocal commentstring=%\ %s
setlocal formatoptions+=ro
diff --git a/runtime/ftplugin/eruby.vim b/runtime/ftplugin/eruby.vim
index b5c4665d24..b3e074aa20 100644
--- a/runtime/ftplugin/eruby.vim
+++ b/runtime/ftplugin/eruby.vim
@@ -5,6 +5,7 @@
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2022 May 15
" 2024 Jan 14 by Vim Project (browsefilter)
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -125,7 +126,7 @@ if exists("loaded_matchit")
endif
" TODO: comments=
-setlocal commentstring=<%#%s%>
+setlocal commentstring=<%#\ %s\ %>
let b:undo_ftplugin = "setl cms< " .
\ " | unlet! b:browsefilter b:match_words | " . b:undo_ftplugin
diff --git a/runtime/ftplugin/faust.lua b/runtime/ftplugin/faust.lua
new file mode 100644
index 0000000000..89ab42ef54
--- /dev/null
+++ b/runtime/ftplugin/faust.lua
@@ -0,0 +1,3 @@
+vim.bo.commentstring = '// %s'
+
+vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<'
diff --git a/runtime/ftplugin/fennel.vim b/runtime/ftplugin/fennel.vim
index 93cf366726..2a9623faff 100644
--- a/runtime/ftplugin/fennel.vim
+++ b/runtime/ftplugin/fennel.vim
@@ -2,13 +2,14 @@
" Language: Fennel
" Maintainer: Gregory Anders <greg[NOSPAM]@gpanders.com>
" Last Update: 2023 Jun 9
+" 2024 May 24 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists('b:did_ftplugin')
finish
endif
let b:did_ftplugin = 1
-setlocal commentstring=;%s
+setlocal commentstring=;\ %s
setlocal comments=:;;,:;
setlocal formatoptions-=t
setlocal suffixesadd=.fnl
diff --git a/runtime/ftplugin/fish.vim b/runtime/ftplugin/fish.vim
index f06ad3a0bf..55d7ea8dd9 100644
--- a/runtime/ftplugin/fish.vim
+++ b/runtime/ftplugin/fish.vim
@@ -4,6 +4,7 @@
" Repository: https://github.com/nickeb96/fish.vim
" Last Change: February 1, 2023
" 2023 Aug 28 by Vim Project (undo_ftplugin)
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -12,7 +13,7 @@ let b:did_ftplugin = 1
setlocal iskeyword=@,48-57,_,192-255,-,.
setlocal comments=:#
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
setlocal formatoptions+=crjq
let b:undo_ftplugin = "setl cms< com< fo< isk<"
diff --git a/runtime/ftplugin/fortran.vim b/runtime/ftplugin/fortran.vim
index 3c325818d3..19a4c1e62b 100644
--- a/runtime/ftplugin/fortran.vim
+++ b/runtime/ftplugin/fortran.vim
@@ -11,6 +11,7 @@
" Doug Kearns, and Fritz Reese.
" Last Change: 2023 Dec 22
" 2024 Jan 14 by Vim Project (browsefilter)
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Only do these settings when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -89,7 +90,7 @@ else
endif
" Set commentstring for foldmethod=marker
-setlocal cms=!%s
+setlocal cms=!\ %s
" Tabs are not a good idea in Fortran so the default is to expand tabs
if !exists("fortran_have_tabs")
diff --git a/runtime/ftplugin/fstab.vim b/runtime/ftplugin/fstab.vim
index 99805322cd..0e7ffda498 100644
--- a/runtime/ftplugin/fstab.vim
+++ b/runtime/ftplugin/fstab.vim
@@ -3,6 +3,7 @@
" Maintainer: Radu Dineiu <radu.dineiu@gmail.com>
" URL: https://raw.github.com/rid9/vim-fstab/master/ftplugin/fstab.vim
" Last Change: 2021 Jan 02
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Version: 1.0
"
" Credits:
@@ -13,7 +14,7 @@ if exists("b:did_ftplugin")
endif
let b:did_ftplugin = 1
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
let b:undo_ftplugin = "setlocal commentstring<"
" vim: ts=8 ft=vim
diff --git a/runtime/ftplugin/gdb.vim b/runtime/ftplugin/gdb.vim
index 7c10633be4..af88a04d54 100644
--- a/runtime/ftplugin/gdb.vim
+++ b/runtime/ftplugin/gdb.vim
@@ -3,11 +3,12 @@
" Maintainer: Michaël Peeters <NOSPAMm.vim@noekeon.org>
" Last Changed: 2017-10-26
" 2024-04-10: - add Matchit support (by Vim Project)
+" 2024-04-23: - add space to commentstring (by Riley Bruins) ('commentstring')
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
setlocal include=^\\s*source
" Undo the stuff we changed.
diff --git a/runtime/ftplugin/gdscript.vim b/runtime/ftplugin/gdscript.vim
index 692afdd0ea..8869c9a019 100644
--- a/runtime/ftplugin/gdscript.vim
+++ b/runtime/ftplugin/gdscript.vim
@@ -25,6 +25,11 @@ setlocal commentstring=#\ %s
setlocal foldignore=
setlocal foldexpr=s:GDScriptFoldLevel()
+if get(g:, 'gdscript_recommended_style', 1)
+ setlocal noexpandtab tabstop=4 softtabstop=0 shiftwidth=0
+ let b:undo_ftplugin ..= ' | setlocal expandtab< tabstop< softtabstop< shiftwidth<'
+endif
+
function s:GDScriptFoldLevel() abort
let line = getline(v:lnum)
diff --git a/runtime/ftplugin/glsl.lua b/runtime/ftplugin/glsl.lua
new file mode 100644
index 0000000000..89ab42ef54
--- /dev/null
+++ b/runtime/ftplugin/glsl.lua
@@ -0,0 +1,3 @@
+vim.bo.commentstring = '// %s'
+
+vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<'
diff --git a/runtime/ftplugin/go.vim b/runtime/ftplugin/go.vim
index 61dc1a13b7..75f78cfa4b 100644
--- a/runtime/ftplugin/go.vim
+++ b/runtime/ftplugin/go.vim
@@ -2,6 +2,7 @@
" Language: Go
" Maintainer: David Barnett (https://github.com/google/vim-ft-go)
" Last Change: 2014 Aug 16
+" 2024 Jul 16 by Vim Project (add recommended indent style)
if exists('b:did_ftplugin')
finish
@@ -15,4 +16,9 @@ setlocal commentstring=//\ %s
let b:undo_ftplugin = 'setl fo< com< cms<'
+if get(g:, 'go_recommended_style', 1)
+ setlocal noexpandtab softtabstop=0 shiftwidth=0
+ let b:undo_ftplugin ..= ' | setl et< sts< sw<'
+endif
+
" vim: sw=2 sts=2 et
diff --git a/runtime/ftplugin/goaccess.vim b/runtime/ftplugin/goaccess.vim
new file mode 100644
index 0000000000..fb557300c9
--- /dev/null
+++ b/runtime/ftplugin/goaccess.vim
@@ -0,0 +1,14 @@
+" Vim filetype plugin
+" Language: GoAccess configuration
+" Maintainer: Adam Monsen <haircut@gmail.com>
+" Last Change: 2024 Aug 1
+
+if exists('b:did_ftplugin')
+ finish
+endif
+
+let b:did_ftplugin = 1
+
+setl comments=:# commentstring=#\ %s
+
+let b:undo_ftplugin = 'setl com< cms<'
diff --git a/runtime/ftplugin/gomod.vim b/runtime/ftplugin/gomod.vim
new file mode 100644
index 0000000000..554c948eb0
--- /dev/null
+++ b/runtime/ftplugin/gomod.vim
@@ -0,0 +1,16 @@
+" Vim filetype plugin file
+" Language: go module file
+" Maintainer: YU YUK KUEN <yukkuen.yu719@gmail.com>
+" Last Change: 2024-06-21
+" 2024 Jul 16 by Vim Project (noexpandtab)
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setlocal noexpandtab
+setlocal formatoptions-=t formatoptions-=c
+setlocal commentstring=//\ %s
+
+let b:undo_ftplugin = 'setl et< fo< cms<'
diff --git a/runtime/ftplugin/gpg.vim b/runtime/ftplugin/gpg.vim
index 7fb4f47ed8..bb4e0c9a19 100644
--- a/runtime/ftplugin/gpg.vim
+++ b/runtime/ftplugin/gpg.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: gpg(1) configuration file
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2023-10-07
+" Latest Revision: 2024-09-19 (simplify keywordprg #15696)
if exists("b:did_ftplugin")
finish
@@ -15,20 +15,12 @@ let b:undo_ftplugin = "setl com< cms< fo<"
setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql
-if has('unix') && executable('less')
- if !has('gui_running')
- command -buffer -nargs=1 GpgKeywordPrg
- \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s+--' . <q-args> . '\b'' --hilite-search" man ' . 'gpg' |
- \ redraw!
- elseif has('terminal')
- command -buffer -nargs=1 GpgKeywordPrg
- \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+--' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'gpg'
- endif
- if exists(':GpgKeywordPrg') == 2
- setlocal iskeyword+=-
- setlocal keywordprg=:GpgKeywordPrg
- let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer GpgKeywordPrg'
- endif
+if has('unix') && executable('less') && exists(':terminal') == 2
+ command -buffer -nargs=1 GpgKeywordPrg
+ \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+--' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'gpg'
+ setlocal iskeyword+=-
+ setlocal keywordprg=:GpgKeywordPrg
+ let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer GpgKeywordPrg'
endif
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/groovy.vim b/runtime/ftplugin/groovy.vim
index cc7d6e35eb..a2e2b2f93e 100644
--- a/runtime/ftplugin/groovy.vim
+++ b/runtime/ftplugin/groovy.vim
@@ -2,6 +2,7 @@
" Language: groovy
" Maintainer: Justin M. Keyes <justinkz@gmail.com>
" Last Change: 2016 May 22
+" 2024 May 24 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists('b:did_ftplugin')
finish
@@ -13,7 +14,7 @@ set cpo-=C
let b:undo_ftplugin = 'setlocal commentstring<'
-setlocal commentstring=//%s
+setlocal commentstring=//\ %s
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/ftplugin/hamster.vim b/runtime/ftplugin/hamster.vim
index 5446e72286..904f267fdc 100644
--- a/runtime/ftplugin/hamster.vim
+++ b/runtime/ftplugin/hamster.vim
@@ -3,6 +3,7 @@
" Version: 2.0.6.0
" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
" Last Change: 2021 Jan 19
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -31,7 +32,7 @@ if &tw == 0
endif
" Comments start with a double quote
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
" Move around functions.
noremap <silent><buffer> [[ :call search('^\s*sub\>', "bW")<CR>
diff --git a/runtime/ftplugin/hare.vim b/runtime/ftplugin/hare.vim
index 0200ba5913..6c61c818d1 100644
--- a/runtime/ftplugin/hare.vim
+++ b/runtime/ftplugin/hare.vim
@@ -1,35 +1,61 @@
-" Vim filetype plugin
-" Language: Hare
-" Maintainer: Amelia Clarke <me@rsaihe.dev>
-" Previous Maintainer: Drew DeVault <sir@cmpwn.com>
-" Last Updated: 2022-09-28
-" 2023 Aug 28 by Vim Project (undo_ftplugin)
+" Vim filetype plugin.
+" Language: Hare
+" Maintainer: Amelia Clarke <selene@perilune.dev>
+" Last Updated: 2024 Oct 04
+" Upstream: https://git.sr.ht/~sircmpwn/hare.vim
if exists('b:did_ftplugin')
finish
endif
let b:did_ftplugin = 1
-" Formatting settings.
-setlocal formatoptions-=t formatoptions+=croql/
+let s:cpo_save = &cpo
+set cpo&vim
-" Miscellaneous.
+" Formatting settings.
setlocal comments=://
setlocal commentstring=//\ %s
+setlocal formatlistpat=^\ \\?-\
+setlocal formatoptions+=croqnlj/ formatoptions-=t
+
+" Search for Hare modules.
+setlocal include=^\\s*use\\>
+setlocal includeexpr=hare#FindModule(v:fname)
+setlocal isfname+=:
setlocal suffixesadd=.ha
-let b:undo_ftplugin = "setl cms< com< fo< sua<"
+" Add HAREPATH to the default search paths.
+setlocal path-=/usr/include,,
+let &l:path .= ',' .. hare#GetPath() .. ',,'
+
+let b:undo_ftplugin = 'setl cms< com< flp< fo< inc< inex< isf< pa< sua< mp<'
-" Hare recommended style.
-if get(g:, "hare_recommended_style", 1)
+" Follow the Hare style guide by default.
+if get(g:, 'hare_recommended_style', 1)
setlocal noexpandtab
- setlocal shiftwidth=8
+ setlocal shiftwidth=0
setlocal softtabstop=0
setlocal tabstop=8
setlocal textwidth=80
- let b:undo_ftplugin ..= " | setl et< sts< sw< ts< tw<"
+ let b:undo_ftplugin .= ' et< sts< sw< ts< tw<'
+endif
+
+augroup hare.vim
+ autocmd!
+
+ " Highlight whitespace errors by default.
+ if get(g:, 'hare_space_error', 1)
+ autocmd InsertEnter * hi link hareSpaceError NONE
+ autocmd InsertLeave * hi link hareSpaceError Error
+ endif
+augroup END
+
+if !exists('current_compiler')
+ let b:undo_ftplugin .= "| compiler make"
+ compiler hare
endif
-compiler hare
+let &cpo = s:cpo_save
+unlet s:cpo_save
-" vim: et sw=2 sts=2 ts=8
+" vim: et sts=2 sw=2 ts=8
diff --git a/runtime/ftplugin/haredoc.vim b/runtime/ftplugin/haredoc.vim
new file mode 100644
index 0000000000..69030b47ba
--- /dev/null
+++ b/runtime/ftplugin/haredoc.vim
@@ -0,0 +1,44 @@
+" Vim filetype plugin.
+" Language: Haredoc (Hare documentation format)
+" Maintainer: Amelia Clarke <selene@perilune.dev>
+" Last Updated: 2024-05-02
+" Upstream: https://git.sr.ht/~selene/hare.vim
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+" Formatting settings.
+setlocal comments=:\
+setlocal formatlistpat=^\ \\?-\
+setlocal formatoptions+=tnlj formatoptions-=c formatoptions-=q
+
+" Search for Hare modules.
+setlocal includeexpr=hare#FindModule(v:fname)
+setlocal isfname+=:
+setlocal suffixesadd=.ha
+
+" Add HAREPATH to the default search paths.
+setlocal path-=/usr/include,,
+let &l:path .= ',' .. hare#GetPath() .. ',,'
+
+let b:undo_ftplugin = 'setl com< flp< fo< inex< isf< pa< sua<'
+
+" Follow the Hare style guide by default.
+if get(g:, 'hare_recommended_style', 1)
+ setlocal noexpandtab
+ setlocal shiftwidth=0
+ setlocal softtabstop=0
+ setlocal tabstop=8
+ setlocal textwidth=80
+ let b:undo_ftplugin .= ' et< sts< sw< ts< tw<'
+endif
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: et sts=2 sw=2 ts=8
diff --git a/runtime/ftplugin/hcl.vim b/runtime/ftplugin/hcl.vim
new file mode 100644
index 0000000000..c47a0378d0
--- /dev/null
+++ b/runtime/ftplugin/hcl.vim
@@ -0,0 +1,10 @@
+" Vim filetype plugin
+" Language: HCL
+" Maintainer: Gregory Anders
+" Last Change: 2024-09-03
+
+if exists('b:did_ftplugin')
+ finish
+endif
+
+runtime! ftplugin/terraform.vim
diff --git a/runtime/ftplugin/help.lua b/runtime/ftplugin/help.lua
index 67c417b1be..8d991be0e4 100644
--- a/runtime/ftplugin/help.lua
+++ b/runtime/ftplugin/help.lua
@@ -1,7 +1,7 @@
-- use treesitter over syntax (for highlighted code blocks)
vim.treesitter.start()
--- add custom highlights for list in `:h highlight-groups`
+-- 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({
@@ -26,3 +26,10 @@ elseif vim.endswith(bufname, '/doc/lsp.txt') then
{ start = [[\*lsp-semantic-highlight\*]], stop = '^======', match = '^@[%w%p]+' },
})
end
+
+vim.keymap.set('n', 'gO', function()
+ require('vim.vimhelp').show_toc()
+end, { buffer = 0, silent = true })
+
+vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n exe "nunmap <buffer> gO"'
+vim.b.undo_ftplugin = vim.b.undo_ftplugin .. ' | call v:lua.vim.treesitter.stop()'
diff --git a/runtime/ftplugin/help.vim b/runtime/ftplugin/help.vim
index a188e45cb4..833baf5d8f 100644
--- a/runtime/ftplugin/help.vim
+++ b/runtime/ftplugin/help.vim
@@ -21,77 +21,5 @@ endif
" Prefer Vim help instead of manpages.
setlocal keywordprg=:help
-if !exists('g:no_plugin_maps')
- function! s:show_toc() abort
- let bufname = bufname('%')
- let info = getloclist(0, {'winid': 1})
- if !empty(info) && getwinvar(info.winid, 'qf_toc') ==# bufname
- lopen
- return
- endif
-
- let toc = []
- let lnum = 2
- let last_line = line('$') - 1
- let last_added = 0
- let has_section = 0
- let has_sub_section = 0
-
- while lnum && lnum <= last_line
- let level = 0
- let add_text = ''
- let text = getline(lnum)
-
- if text =~# '^=\+$' && lnum + 1 < last_line
- " A de-facto section heading. Other headings are inferred.
- let has_section = 1
- let has_sub_section = 0
- let lnum = nextnonblank(lnum + 1)
- let text = getline(lnum)
- let add_text = text
- while add_text =~# '\*[^*]\+\*\s*$'
- let add_text = matchstr(add_text, '.*\ze\*[^*]\+\*\s*$')
- endwhile
- elseif text =~# '^[A-Z0-9][-A-ZA-Z0-9 .][-A-Z0-9 .():]*\%([ \t]\+\*.\+\*\)\?$'
- " Any line that's yelling is important.
- let has_sub_section = 1
- let level = has_section
- let add_text = matchstr(text, '.\{-}\ze\s*\%([ \t]\+\*.\+\*\)\?$')
- elseif text =~# '\~$'
- \ && matchstr(text, '^\s*\zs.\{-}\ze\s*\~$') !~# '\t\|\s\{2,}'
- \ && getline(lnum - 1) =~# '^\s*<\?$\|^\s*\*.*\*$'
- \ && getline(lnum + 1) =~# '^\s*>\?$\|^\s*\*.*\*$'
- " These lines could be headers or code examples. We only want the
- " ones that have subsequent lines at the same indent or more.
- let l = nextnonblank(lnum + 1)
- if getline(l) =~# '\*[^*]\+\*$'
- " Ignore tag lines
- let l = nextnonblank(l + 1)
- endif
-
- if indent(lnum) <= indent(l)
- let level = has_section + has_sub_section
- let add_text = matchstr(text, '\S.\{-}\ze\s\=\~$')
- endif
- endif
-
- let add_text = substitute(add_text, '\s\+$', '', 'g')
- if !empty(add_text) && last_added != lnum
- let last_added = lnum
- call add(toc, {'bufnr': bufnr('%'), 'lnum': lnum,
- \ 'text': repeat("\u00a0\u00a0", level) . add_text})
- endif
- let lnum = nextnonblank(lnum + 1)
- endwhile
-
- call setloclist(0, toc, ' ')
- call setloclist(0, [], 'a', {'title': 'Help TOC'})
- lopen
- let w:qf_toc = bufname
- endfunction
-
- nnoremap <silent><buffer> gO :call <sid>show_toc()<cr>
-endif
-
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/ftplugin/hlsplaylist.vim b/runtime/ftplugin/hlsplaylist.vim
new file mode 100644
index 0000000000..879a04f0f9
--- /dev/null
+++ b/runtime/ftplugin/hlsplaylist.vim
@@ -0,0 +1,37 @@
+" Vim filetype plugin
+" Language: HLS/M3U Playlist
+" Maintainer: AvidSeeker <avidseeker7@protonmail.com>
+" Last Change: 2024 Jul 07
+"
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let g:did_ftplugin = 1
+
+setlocal commentstring=#%s
+
+let b:undo_ftplugin = "setl commentstring<"
+
+function! M3UFold() abort
+ let line = getline(v:lnum)
+ if line =~# '^#EXTGRP'
+ return ">1"
+ endif
+ return "="
+endfunction
+
+function! M3UFoldText() abort
+ let start_line = getline(v:foldstart)
+ let title = substitute(start_line, '^#EXTGRP:*', '', '')
+ let foldsize = (v:foldend - v:foldstart + 1)
+ let linecount = '['.foldsize.' lines]'
+ return title.' '.linecount
+endfunction
+
+if has("folding")
+ setlocal foldexpr=M3UFold()
+ setlocal foldmethod=expr
+ setlocal foldtext=M3UFoldText()
+ let b:undo_ftplugin .= "|setl foldexpr< foldmethod< foldtext<"
+endif
diff --git a/runtime/ftplugin/html.vim b/runtime/ftplugin/html.vim
index 3aa60a873e..5495f859de 100644
--- a/runtime/ftplugin/html.vim
+++ b/runtime/ftplugin/html.vim
@@ -3,6 +3,7 @@
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Dan Sharp
" Last Change: 2024 Jan 14
+" 2024 May 24 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -13,7 +14,7 @@ let s:save_cpo = &cpo
set cpo-=C
setlocal matchpairs+=<:>
-setlocal commentstring=<!--%s-->
+setlocal commentstring=<!--\ %s\ -->
setlocal comments=s:<!--,m:\ \ \ \ ,e:-->
let b:undo_ftplugin = "setlocal comments< commentstring< matchpairs<"
diff --git a/runtime/ftplugin/htmlangular.vim b/runtime/ftplugin/htmlangular.vim
new file mode 100644
index 0000000000..b114372442
--- /dev/null
+++ b/runtime/ftplugin/htmlangular.vim
@@ -0,0 +1,12 @@
+" Vim filetype plugin file
+" Language: Angular HTML Template
+" Maintainer: Dennis van den Berg <dennis@vdberg.dev>
+" Last Change: 2024 Jul 9
+
+" Only use this filetype plugin when no other was loaded.
+if exists("b:did_ftplugin")
+ finish
+endif
+
+" source the HTML ftplugin
+runtime! ftplugin/html.vim
diff --git a/runtime/ftplugin/http.vim b/runtime/ftplugin/http.vim
new file mode 100644
index 0000000000..ca5055011b
--- /dev/null
+++ b/runtime/ftplugin/http.vim
@@ -0,0 +1,13 @@
+" Vim filetype plugin
+" Language: HTTP
+" Maintainer: Riley Bruins <ribru17@gmail.com>
+" Last Change: 2024 Sep 28
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setl comments=:# commentstring=#\ %s
+
+let b:undo_ftplugin = 'setl com< cms<'
diff --git a/runtime/ftplugin/indent.lua b/runtime/ftplugin/indent.lua
index b4e68148f5..89ab42ef54 100644
--- a/runtime/ftplugin/indent.lua
+++ b/runtime/ftplugin/indent.lua
@@ -1 +1,3 @@
-vim.bo.commentstring = '/*%s*/'
+vim.bo.commentstring = '// %s'
+
+vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<'
diff --git a/runtime/ftplugin/indent.vim b/runtime/ftplugin/indent.vim
index 64a650ad7b..32208d38d8 100644
--- a/runtime/ftplugin/indent.vim
+++ b/runtime/ftplugin/indent.vim
@@ -3,6 +3,7 @@
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2008-07-09
+" 2024-06-02 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -14,7 +15,7 @@ set cpo&vim
let b:undo_ftplugin = "setl com< cms< fo<"
-setlocal comments=s1:/*,mb:*,ex:*/ commentstring&
+setlocal comments=s1:/*,mb:*,ex:*/ commentstring=/*\ %s\ */
setlocal formatoptions-=t formatoptions+=croql
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/initex.vim b/runtime/ftplugin/initex.vim
index 0ee3e8d899..71049df6bd 100644
--- a/runtime/ftplugin/initex.vim
+++ b/runtime/ftplugin/initex.vim
@@ -3,6 +3,7 @@
" Maintainer: Benji Fisher, Ph.D. <benji@member.AMS.org>
" Version: 1.0
" Last Change: Wed 19 Apr 2006
+" Last Change: Thu 23 May 2024 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Only do this when not done yet for this buffer.
if exists("b:did_ftplugin")
@@ -23,7 +24,7 @@ setlocal com=sO:%\ -,mO:%\ \ ,eO:%%,:%
" Set 'commentstring' to recognize the % comment character:
" (Thanks to Ajit Thakkar.)
-setlocal cms=%%s
+setlocal cms=%\ %s
" Allow "[d" to be used to find a macro definition:
let &l:define='\\\([egx]\|char\|mathchar\|count\|dimen\|muskip\|skip\|toks\)\='
diff --git a/runtime/ftplugin/java.vim b/runtime/ftplugin/java.vim
index fa2b61075f..55b358374f 100644
--- a/runtime/ftplugin/java.vim
+++ b/runtime/ftplugin/java.vim
@@ -3,17 +3,29 @@
" Maintainer: Aliaksei Budavei <0x000c70 AT gmail DOT com>
" Former Maintainer: Dan Sharp
" Repository: https://github.com/zzzyxwvut/java-vim.git
-" Last Change: 2024 Apr 18
+" Last Change: 2024 Sep 26
" 2024 Jan 14 by Vim Project (browsefilter)
-
-if exists("b:did_ftplugin") | finish | endif
-let b:did_ftplugin = 1
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Make sure the continuation lines below do not cause problems in
" compatibility mode.
let s:save_cpo = &cpo
set cpo-=C
+if (exists("g:java_ignore_javadoc") || exists("g:java_ignore_markdown")) &&
+ \ exists("*javaformat#RemoveCommonMarkdownWhitespace")
+ delfunction javaformat#RemoveCommonMarkdownWhitespace
+ unlet! g:loaded_javaformat
+endif
+
+if exists("b:did_ftplugin")
+ let &cpo = s:save_cpo
+ unlet s:save_cpo
+ finish
+endif
+
+let b:did_ftplugin = 1
+
" For filename completion, prefer the .java extension over the .class
" extension.
set suffixes+=.class
@@ -26,6 +38,8 @@ setlocal suffixesadd=.java
" Clean up in case this file is sourced again.
unlet! s:zip_func_upgradable
+"""" STRIVE TO REMAIN COMPATIBLE FOR AT LEAST VIM 7.0.
+
" Documented in ":help ft-java-plugin".
if exists("g:ftplugin_java_source_path") &&
\ type(g:ftplugin_java_source_path) == type("")
@@ -58,10 +72,11 @@ endif
" and insert the comment leader when hitting <CR> or using "o".
setlocal formatoptions-=t formatoptions+=croql
-" Set 'comments' to format dashed lists in comments. Behaves just like C.
-setlocal comments& comments^=sO:*\ -,mO:*\ \ ,exO:*/
+" Set 'comments' to format Markdown Javadoc comments and dashed lists
+" in other multi-line comments (it behaves just like C).
+setlocal comments& comments^=:///,sO:*\ -,mO:*\ \ ,exO:*/
-setlocal commentstring=//%s
+setlocal commentstring=//\ %s
" Change the :browse e filter to primarily show Java-related files.
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
@@ -102,3 +117,4 @@ endif
" Restore the saved compatibility options.
let &cpo = s:save_cpo
unlet s:save_cpo
+" vim: fdm=syntax sw=4 ts=8 noet sta
diff --git a/runtime/ftplugin/javacc.vim b/runtime/ftplugin/javacc.vim
new file mode 100644
index 0000000000..780c68b0f9
--- /dev/null
+++ b/runtime/ftplugin/javacc.vim
@@ -0,0 +1,20 @@
+" Vim filetype plugin
+" Language: JavaCC
+" Maintainer: Riley Bruins <ribru17@gmail.com>
+" Last Change: 2024 Jul 06
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+" Set 'formatoptions' to break comment lines but not other lines,
+" and insert the comment leader when hitting <CR> or using "o".
+setlocal formatoptions-=t formatoptions+=croql
+
+" Set 'comments' to format dashed lists in comments. Behaves just like C.
+setlocal comments& comments^=sO:*\ -,mO:*\ \ ,exO:*/
+
+setlocal commentstring=//\ %s
+
+let b:undo_ftplugin = 'setl fo< com< cms<'
diff --git a/runtime/ftplugin/javascript.vim b/runtime/ftplugin/javascript.vim
index 2633954903..455b794cf0 100644
--- a/runtime/ftplugin/javascript.vim
+++ b/runtime/ftplugin/javascript.vim
@@ -3,6 +3,7 @@
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Contributor: Romain Lafourcade <romainlafourcade@gmail.com>
" Last Change: 2024 Jan 14
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -24,7 +25,7 @@ endif
" Set 'comments' to format dashed lists in comments.
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
-setlocal commentstring=//%s
+setlocal commentstring=//\ %s
" Change the :browse e filter to primarily show JavaScript-related files.
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
diff --git a/runtime/ftplugin/jq.vim b/runtime/ftplugin/jq.vim
index 88958e80dd..307fbdb62d 100644
--- a/runtime/ftplugin/jq.vim
+++ b/runtime/ftplugin/jq.vim
@@ -2,6 +2,8 @@
" Language: jq
" Maintainer: Vito <vito.blog@gmail.com>
" Last Change: 2024 Apr 29
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
+" 2024 Oct 04 by Konfekt (unset compiler)
" Upstream: https://github.com/vito-c/jq.vim
if exists('b:did_ftplugin')
@@ -10,7 +12,12 @@ endif
let b:did_ftplugin = 1
setlocal include=^\\s*\\%(import\\\|include\\)
-setlocal commentstring=#%s
-compiler jq
+setlocal commentstring=#\ %s
let b:undo_ftplugin = 'setl commentstring< include<'
+
+if !exists('current_compiler')
+ let b:undo_ftplugin ..= "| compiler make"
+ compiler jq
+endif
+
diff --git a/runtime/ftplugin/jsonc.vim b/runtime/ftplugin/jsonc.vim
index e47a75f574..ec3268492c 100644
--- a/runtime/ftplugin/jsonc.vim
+++ b/runtime/ftplugin/jsonc.vim
@@ -5,6 +5,7 @@
" https://github.com/kevinoid/vim-jsonc
" License: MIT
" Last Change: 2021 Nov 22
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
runtime! ftplugin/json.vim
@@ -15,7 +16,7 @@ else
endif
" Set comment (formatting) related options. {{{1
-setlocal commentstring=//%s comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
+setlocal commentstring=//\ %s comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
" Let Vim know how to disable the plug-in.
let b:undo_ftplugin = 'setlocal commentstring< comments<'
diff --git a/runtime/ftplugin/kdl.vim b/runtime/ftplugin/kdl.vim
new file mode 100644
index 0000000000..c9a1d8b185
--- /dev/null
+++ b/runtime/ftplugin/kdl.vim
@@ -0,0 +1,17 @@
+" Vim filetype plugin
+" Language: KDL
+" Author: Aram Drevekenin <aram@poor.dev>
+" Maintainer: Yinzuo Jiang <jiangyinzuo@foxmail.com>
+" Last Change: 2024-06-10
+
+if exists("b:did_ftplugin")
+ finish
+endif
+
+let b:did_ftplugin = 1
+
+setlocal comments=://
+setlocal commentstring=//\ %s
+setlocal formatoptions-=t
+
+let b:undo_ftplugin = 'setlocal comments< commentstring< formatoptions<'
diff --git a/runtime/ftplugin/kivy.vim b/runtime/ftplugin/kivy.vim
new file mode 100644
index 0000000000..e19d832bf3
--- /dev/null
+++ b/runtime/ftplugin/kivy.vim
@@ -0,0 +1,13 @@
+" Vim filetype plugin
+" Language: Kivy
+" Maintainer: Riley Bruins <ribru17@gmail.com>
+" Last Change: 2024 Jul 06
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setl commentstring=#\ %s
+
+let b:undo_ftplugin = 'setl cms<'
diff --git a/runtime/ftplugin/lc.vim b/runtime/ftplugin/lc.vim
new file mode 100644
index 0000000000..e818f1aecb
--- /dev/null
+++ b/runtime/ftplugin/lc.vim
@@ -0,0 +1,13 @@
+" Vim filetype plugin
+" Language: Elsa
+" Maintainer: Riley Bruins <ribru17@gmail.com>
+" Last Change: 2024 May 25
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setl comments=:-- commentstring=--\ %s
+
+let b:undo_ftplugin = 'setl com< cms<'
diff --git a/runtime/ftplugin/ld.vim b/runtime/ftplugin/ld.vim
index 1ab80d533c..9cc70bd94d 100644
--- a/runtime/ftplugin/ld.vim
+++ b/runtime/ftplugin/ld.vim
@@ -1,7 +1,8 @@
" Vim filetype plugin file
" Language: ld(1) script
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2008-07-09
+" Latest Revision: 2008 Jul 09
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -13,7 +14,7 @@ set cpo&vim
let b:undo_ftplugin = "setl com< cms< inc< fo<"
-setlocal comments=s1:/*,mb:*,ex:*/ commentstring=/*%s*/ include=^\\s*INCLUDE
+setlocal comments=s1:/*,mb:*,ex:*/ commentstring=/*\ %s\ */ include=^\\s*INCLUDE
setlocal formatoptions-=t formatoptions+=croql
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/ldapconf.vim b/runtime/ftplugin/ldapconf.vim
new file mode 100644
index 0000000000..70557160e8
--- /dev/null
+++ b/runtime/ftplugin/ldapconf.vim
@@ -0,0 +1,13 @@
+" Vim filetype plugin
+" Language: ldap.conf(5) configuration file.
+" Maintainer: Riley Bruins <ribru17@gmail.com>
+" Last Change: 2024 Jul 06
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setl comments=:# commentstring=#\ %s
+
+let b:undo_ftplugin = 'setl com< cms<'
diff --git a/runtime/ftplugin/lex.vim b/runtime/ftplugin/lex.vim
new file mode 100644
index 0000000000..c6c47fedf0
--- /dev/null
+++ b/runtime/ftplugin/lex.vim
@@ -0,0 +1,14 @@
+" Vim filetype plugin
+" Language: Lex and Flex
+" Maintainer: Riley Bruins <ribru17@gmail.com>
+" Last Change: 2024 Jul 06
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
+setlocal commentstring=//\ %s
+
+let b:undo_ftplugin = 'setl com< cms<'
diff --git a/runtime/ftplugin/liquid.vim b/runtime/ftplugin/liquid.vim
index f24ec4cbb2..dbd8abe457 100644
--- a/runtime/ftplugin/liquid.vim
+++ b/runtime/ftplugin/liquid.vim
@@ -2,6 +2,7 @@
" Language: Liquid
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2022 Mar 15
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists('b:did_ftplugin')
finish
@@ -56,6 +57,6 @@ if exists('loaded_matchit')
let b:match_words .= '\<\%(if\w*\|unless\|case\)\>:\<\%(elsif\|else\|when\)\>:\<end\%(if\w*\|unless\|case\)\>,\<\%(for\|tablerow\)\>:\%({%\s*\)\@<=empty\>:\<end\%(for\|tablerow\)\>,\<\(capture\|comment\|highlight\)\>:\<end\1\>'
endif
-setlocal commentstring={%\ comment\ %}%s{%\ endcomment\ %}
+setlocal commentstring={%\ comment\ %}\ %s\ {%\ endcomment\ %}
let b:undo_ftplugin .= 'setl cms< | unlet! b:browsefilter b:match_words'
diff --git a/runtime/ftplugin/lisp.vim b/runtime/ftplugin/lisp.vim
index db3ac96631..fe3c6fe996 100644
--- a/runtime/ftplugin/lisp.vim
+++ b/runtime/ftplugin/lisp.vim
@@ -5,6 +5,7 @@
" Original author: Dorai Sitaram <ds26@gte.com>
" Original URL: http://www.ccs.neu.edu/~dorai/vimplugins/vimplugins.html
" Last Change: Mar 10, 2021
+" May 23, 2024 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -19,6 +20,6 @@ setl define=^\\s*(def\\k*
setl formatoptions-=t
setl iskeyword+=+,-,*,/,%,<,=,>,:,$,?,!,@-@,94
setl lisp
-setl commentstring=;%s
+setl commentstring=;\ %s
let b:undo_ftplugin = "setlocal comments< define< formatoptions< iskeyword< lisp< commentstring<"
diff --git a/runtime/ftplugin/lua.lua b/runtime/ftplugin/lua.lua
index 98f218e36e..75deb6b190 100644
--- a/runtime/ftplugin/lua.lua
+++ b/runtime/ftplugin/lua.lua
@@ -1,2 +1,4 @@
-- use treesitter over syntax
vim.treesitter.start()
+
+vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n call v:lua.vim.treesitter.stop()'
diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim
index fdeaae4c3f..37667477f3 100644
--- a/runtime/ftplugin/man.vim
+++ b/runtime/ftplugin/man.vim
@@ -8,14 +8,16 @@ let b:did_ftplugin = 1
setlocal noexpandtab tabstop=8 softtabstop=8 shiftwidth=8
setlocal wrap breakindent linebreak
+setlocal colorcolumn=0 nolist
" Parentheses and '-' for references like `git-ls-files(1)`; '@' for systemd
" pages; ':' for Perl and C++ pages. Here, I intentionally omit the locale
" specific characters matched by `@`.
setlocal iskeyword=@-@,:,a-z,A-Z,48-57,_,.,-,(,)
-setlocal nonumber norelativenumber
-setlocal foldcolumn=0 colorcolumn=0 nolist nofoldenable
+" man page content is likely preformatted for the terminal width, so
+" narrowing display by any additional columns leads to Embarrassing Line Wrap
+setlocal nonumber norelativenumber foldcolumn=0 signcolumn=auto
setlocal tagfunc=v:lua.require'man'.goto_tag
@@ -35,6 +37,8 @@ if get(g:, 'ft_man_folding_enable', 0)
setlocal foldenable
setlocal foldmethod=indent
setlocal foldnestmax=1
+else
+ setlocal nofoldenable
endif
let b:undo_ftplugin = ''
diff --git a/runtime/ftplugin/markdown.vim b/runtime/ftplugin/markdown.vim
index 022dd0d601..d4ee5ac242 100644
--- a/runtime/ftplugin/markdown.vim
+++ b/runtime/ftplugin/markdown.vim
@@ -2,6 +2,7 @@
" Language: Markdown
" Maintainer: Tim Pope <https://github.com/tpope/vim-markdown>
" Last Change: 2023 Dec 28
+" 2024 May 24 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -12,7 +13,7 @@ runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
let s:keepcpo= &cpo
set cpo&vim
-setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=<!--%s-->
+setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=<!--\ %s\ -->
setlocal formatoptions+=tcqln formatoptions-=r formatoptions-=o
setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]:\\&^.\\{4\\}
diff --git a/runtime/ftplugin/mediawiki.vim b/runtime/ftplugin/mediawiki.vim
new file mode 100644
index 0000000000..4618246106
--- /dev/null
+++ b/runtime/ftplugin/mediawiki.vim
@@ -0,0 +1,42 @@
+" Language: MediaWiki
+" Maintainer: Avid Seeker <avidseeker7@protonmail.com>
+" Home: http://en.wikipedia.org/wiki/Wikipedia:Text_editor_support#Vim
+" Last Change: 2024 Jul 14
+" Credits: chikamichi
+"
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
+
+" Many MediaWiki wikis prefer line breaks only at the end of paragraphs
+" (like in a text processor), which results in long, wrapping lines.
+setlocal wrap linebreak
+setlocal textwidth=0
+
+setlocal formatoptions-=tc formatoptions+=l formatoptions+=roq
+setlocal matchpairs+=<:>
+
+" Treat lists, indented text and tables as comment lines and continue with the
+" same formatting in the next line (i.e. insert the comment leader) when hitting
+" <CR> or using "o".
+setlocal comments=n:#,n:*,n:\:,s:{\|,m:\|,ex:\|},s:<!--,m:\ \ \ \ ,e:-->
+setlocal commentstring=<!--\ %s\ -->
+
+" match HTML tags (taken directly from $VIM/ftplugin/html.vim)
+if exists("loaded_matchit")
+ let b:match_ignorecase=0
+ let b:match_skip = 's:Comment'
+ let b:match_words = '<:>,' .
+ \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' .
+ \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' .
+ \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
+endif
+
+" Enable folding based on ==sections==
+setlocal foldexpr=getline(v:lnum)=~'^\\(=\\+\\)[^=]\\+\\1\\(\\s*<!--.*-->\\)\\=\\s*$'?\">\".(len(matchstr(getline(v:lnum),'^=\\+'))-1):\"=\"
+setlocal foldmethod=expr
+
+let b:undo_ftplugin = "setl commentstring< comments< formatoptions< foldexpr< foldmethod<"
+let b:undo_ftplugin += " matchpairs< linebreak< wrap< textwidth<"
diff --git a/runtime/ftplugin/mermaid.vim b/runtime/ftplugin/mermaid.vim
index fe84ab37cf..5547ad3e1f 100644
--- a/runtime/ftplugin/mermaid.vim
+++ b/runtime/ftplugin/mermaid.vim
@@ -2,6 +2,7 @@
" Language: Mermaid
" Maintainer: Craig MacEachern <https://github.com/craigmac/vim-mermaid>
" Last Change: 2022 Oct 13
+" 2024 Jul 18 by Vim Project (adjust comments)
if exists("b:did_ftplugin")
finish
@@ -16,9 +17,9 @@ setlocal shiftwidth=2
setlocal softtabstop=-1
setlocal tabstop=4
+setlocal comments=:%%
+setlocal commentstring=%%\ %s
" TODO: comments, formatlist stuff, based on what?
-setlocal comments=b:#,fb:-
-setlocal commentstring=#\ %s
setlocal formatoptions+=tcqln formatoptions-=r formatoptions-=o
setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]:\\&^.\\{4\\}
diff --git a/runtime/ftplugin/mma.vim b/runtime/ftplugin/mma.vim
index ce4cee18ae..91a8111bcb 100644
--- a/runtime/ftplugin/mma.vim
+++ b/runtime/ftplugin/mma.vim
@@ -1,7 +1,8 @@
" Vim filetype plugin file
" Language: Mathematica
" Maintainer: Ian Ford <ianf@wolfram.com>
-" Last Change: 22 January 2019
+" Last Change: 2019 Jan 22
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -13,4 +14,4 @@ let b:did_ftplugin = 1
let b:undo_ftplugin = "setlocal commentstring<"
-setlocal commentstring=\(*%s*\)
+setlocal commentstring=\(*\ %s\ *\)
diff --git a/runtime/ftplugin/modconf.vim b/runtime/ftplugin/modconf.vim
index 22d18a9aad..68ce69a446 100644
--- a/runtime/ftplugin/modconf.vim
+++ b/runtime/ftplugin/modconf.vim
@@ -1,7 +1,8 @@
" Vim filetype plugin file
" Language: modules.conf(5) configuration file
+" Maintainer: This runtime file is looking for a new maintainer.
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2023-10-07
+" Latest Revision: 2024-09-20 (remove erroneous endif)
if exists("b:did_ftplugin")
finish
@@ -16,20 +17,12 @@ let b:undo_ftplugin = "setl com< cms< inc< fo<"
setlocal comments=:# commentstring=#\ %s include=^\\s*include
setlocal formatoptions-=t formatoptions+=croql
-if has('unix') && executable('less')
- if !has('gui_running')
- command -buffer -nargs=1 ModconfKeywordPrg
- \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s{,8}' . <q-args> . '\b'' --hilite-search" man ' . 'modprobe.d' |
- \ redraw!
- elseif has('terminal')
- command -buffer -nargs=1 ModconfKeywordPrg
- \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s{,8}' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'modprobe.d'
- endif
- if exists(':ModconfKeywordPrg') == 2
- setlocal iskeyword+=-
- setlocal keywordprg=:ModconfKeywordPrg
- let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer ModconfKeywordPrg'
- endif
+if has('unix') && executable('less') && exists(':terminal') == 2
+ command -buffer -nargs=1 ModconfKeywordPrg
+ \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s{,8}' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'modprobe.d'
+ setlocal iskeyword+=-
+ setlocal keywordprg=:ModconfKeywordPrg
+ let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer ModconfKeywordPrg'
endif
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/modula2.vim b/runtime/ftplugin/modula2.vim
index 9c1acc276a..306688da05 100644
--- a/runtime/ftplugin/modula2.vim
+++ b/runtime/ftplugin/modula2.vim
@@ -2,6 +2,7 @@
" Language: Modula-2
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2024 Jan 14
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -17,7 +18,7 @@ if s:dialect ==# "r10"
setlocal comments=s:(*,m:\ ,e:*),:!
setlocal commentstring=!\ %s
else
- setlocal commentstring=(*%s*)
+ setlocal commentstring=(*\ %s\ *)
setlocal comments=s:(*,m:\ ,e:*)
endif
setlocal formatoptions-=t formatoptions+=croql
diff --git a/runtime/ftplugin/modula3.vim b/runtime/ftplugin/modula3.vim
index 45dd7ca01c..f899d1d103 100644
--- a/runtime/ftplugin/modula3.vim
+++ b/runtime/ftplugin/modula3.vim
@@ -2,6 +2,7 @@
" Language: Modula-3
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2024 Jan 14
+" 2024 May 24 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -12,7 +13,7 @@ let s:cpo_save = &cpo
set cpo&vim
setlocal comments=s0:(*,mb:\ ,ex:*)
-setlocal commentstring=(*%s*)
+setlocal commentstring=(*\ %s\ *)
setlocal formatoptions-=t formatoptions+=croql
setlocal suffixesadd+=.m3
setlocal formatprg=m3pp
diff --git a/runtime/ftplugin/mojo.vim b/runtime/ftplugin/mojo.vim
new file mode 100644
index 0000000000..ff50229934
--- /dev/null
+++ b/runtime/ftplugin/mojo.vim
@@ -0,0 +1,41 @@
+" Vim filetype plugin
+" Language: Mojo
+" Maintainer: Riley Bruins <ribru17@gmail.com>
+" Last Change: 2024 Jul 07
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setlocal include=^\\s*\\(from\\\|import\\)
+setlocal define=^\\s*\\(\\(async\\s\\+\\)\\?def\\\|class\\)
+
+" For imports with leading .., append / and replace additional .s with ../
+let b:grandparent_match = '^\(.\.\)\(\.*\)'
+let b:grandparent_sub = '\=submatch(1)."/".repeat("../",strlen(submatch(2)))'
+
+" For imports with a single leading ., replace it with ./
+let b:parent_match = '^\.\(\.\)\@!'
+let b:parent_sub = './'
+
+" Replace any . sandwiched between word characters with /
+let b:child_match = '\(\w\)\.\(\w\)'
+let b:child_sub = '\1/\2'
+
+setlocal includeexpr=substitute(substitute(substitute(
+ \v:fname,
+ \b:grandparent_match,b:grandparent_sub,''),
+ \b:parent_match,b:parent_sub,''),
+ \b:child_match,b:child_sub,'g')
+
+setlocal suffixesadd=.mojo
+setlocal comments=b:#,fb:-
+setlocal commentstring=#\ %s
+
+let b:undo_ftplugin = 'setlocal include<'
+ \ . '|setlocal define<'
+ \ . '|setlocal includeexpr<'
+ \ . '|setlocal suffixesadd<'
+ \ . '|setlocal comments<'
+ \ . '|setlocal commentstring<'
diff --git a/runtime/ftplugin/muttrc.vim b/runtime/ftplugin/muttrc.vim
index c9f6df31d0..7df61580bf 100644
--- a/runtime/ftplugin/muttrc.vim
+++ b/runtime/ftplugin/muttrc.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: mutt RC File
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2023-10-07
+" Latest Revision: 2024-09-19 (simplify keywordprg #15696)
if exists("b:did_ftplugin")
finish
@@ -18,20 +18,12 @@ setlocal formatoptions-=t formatoptions+=croql
let &l:include = '^\s*source\>'
-if has('unix') && executable('less')
- if !has('gui_running')
- command -buffer -nargs=1 MuttrcKeywordPrg
- \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s+' . <q-args> . '\b'' --hilite-search" man ' . 'muttrc' |
- \ redraw!
- elseif has('terminal')
- command -buffer -nargs=1 MuttrcKeywordPrg
- \ silent exe 'term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'muttrc'
- endif
- if exists(':MuttrcKeywordPrg') == 2
- setlocal iskeyword+=-
- setlocal keywordprg=:MuttrcKeywordPrg
- let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer MuttrcKeywordPrg'
- endif
+if has('unix') && executable('less') && exists(':terminal') == 2
+ command -buffer -nargs=1 MuttrcKeywordPrg
+ \ silent exe 'term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'muttrc'
+ setlocal iskeyword+=-
+ setlocal keywordprg=:MuttrcKeywordPrg
+ let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer MuttrcKeywordPrg'
endif
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/mysql.vim b/runtime/ftplugin/mysql.vim
new file mode 100644
index 0000000000..232df8c5a3
--- /dev/null
+++ b/runtime/ftplugin/mysql.vim
@@ -0,0 +1,9 @@
+" Vim filetype plugin
+" Language: MySQL
+" Maintainer: Riley Bruins <ribru17@gmail.com>
+" Last Change: 2024 Aug 12
+if exists("b:did_ftplugin")
+ finish
+endif
+
+runtime ftplugin/sql.vim
diff --git a/runtime/ftplugin/nroff.vim b/runtime/ftplugin/nroff.vim
index cf62d02daa..ed0b32f5f3 100644
--- a/runtime/ftplugin/nroff.vim
+++ b/runtime/ftplugin/nroff.vim
@@ -2,15 +2,15 @@
" Language: roff(7)
" Maintainer: Aman Verma
" Homepage: https://github.com/a-vrma/vim-nroff-ftplugin
-" Previous Maintainer: Chris Spiegel <cspiegel@gmail.com>
-" Last Change: 2020 Nov 21
+" Previous Maintainer: Chris Spiegel <cspiegel@gmail.com>
+" 2024 May 24 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
-setlocal commentstring=.\\\"%s
+setlocal commentstring=.\\\"\ %s
setlocal comments=:.\\\"
setlocal sections+=Sh
diff --git a/runtime/ftplugin/nu.vim b/runtime/ftplugin/nu.vim
new file mode 100644
index 0000000000..9efbc3b099
--- /dev/null
+++ b/runtime/ftplugin/nu.vim
@@ -0,0 +1,13 @@
+" Vim filetype plugin
+" Language: Nu
+" Maintainer: Marc Jakobi <marc@jakobi.dev>
+" Last Change: 2024 Aug 31
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setlocal commentstring=#\ %s
+
+let b:undo_ftplugin = 'setl com<'
diff --git a/runtime/ftplugin/objc.lua b/runtime/ftplugin/objc.lua
new file mode 100644
index 0000000000..89ab42ef54
--- /dev/null
+++ b/runtime/ftplugin/objc.lua
@@ -0,0 +1,3 @@
+vim.bo.commentstring = '// %s'
+
+vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<'
diff --git a/runtime/ftplugin/objcpp.vim b/runtime/ftplugin/objcpp.vim
new file mode 100644
index 0000000000..ffba685c7d
--- /dev/null
+++ b/runtime/ftplugin/objcpp.vim
@@ -0,0 +1 @@
+runtime! ftplugin/objc.vim
diff --git a/runtime/ftplugin/obse.vim b/runtime/ftplugin/obse.vim
index 6d865f05ee..bf5076f41f 100644
--- a/runtime/ftplugin/obse.vim
+++ b/runtime/ftplugin/obse.vim
@@ -2,8 +2,9 @@
" Language: Oblivion Language (obl)
" Original Creator: Kat <katisntgood@gmail.com>
" Maintainer: Kat <katisntgood@gmail.com>
-" Created: August 08, 2021
-" Last Change: 13 November 2022
+" Created: 2021 Aug 08
+" Last Change: 2022 Nov 13
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -20,7 +21,7 @@ noremap <script> <buffer> <silent> ]] <nop>
noremap <script> <buffer> <silent> [] <nop>
noremap <script> <buffer> <silent> ][ <nop>
-setlocal commentstring=;%s
+setlocal commentstring=;\ %s
setlocal comments=:;
function s:NextSection(type, backwards, visual)
diff --git a/runtime/ftplugin/ocaml.vim b/runtime/ftplugin/ocaml.vim
index 20172c9b32..8b88d8d001 100644
--- a/runtime/ftplugin/ocaml.vim
+++ b/runtime/ftplugin/ocaml.vim
@@ -5,12 +5,14 @@
" Pierre Vittet <pierre-vittet@pvittet.com>
" Stefano Zacchiroli <zack@bononia.it>
" Vincent Aravantinos <firstname.name@imag.fr>
+" Riley Bruins <ribru17@gmail.com> ('commentstring')
" URL: https://github.com/ocaml/vim-ocaml
" Last Change:
" 2013 Oct 27 - Added commentstring (MM)
" 2013 Jul 26 - load default compiler settings (MM)
" 2013 Jul 24 - removed superfluous efm-setting (MM)
" 2013 Jul 22 - applied fixes supplied by Hirotaka Hamada (MM)
+" 2024 May 23 - added space in commentstring (RB)
if exists("b:did_ftplugin")
finish
@@ -40,7 +42,7 @@ set cpo&vim
" Comment string
setlocal comments=sr:(*\ ,mb:\ ,ex:*)
setlocal comments^=sr:(**,mb:\ \ ,ex:*)
-setlocal commentstring=(*%s*)
+setlocal commentstring=(*\ %s\ *)
" Add mappings, unless the user didn't want this.
if !exists("no_plugin_maps") && !exists("no_ocaml_maps")
diff --git a/runtime/ftplugin/odin.vim b/runtime/ftplugin/odin.vim
index c50fea65a3..ca534bb30c 100644
--- a/runtime/ftplugin/odin.vim
+++ b/runtime/ftplugin/odin.vim
@@ -2,7 +2,8 @@
" Language: Odin
" Maintainer: Maxim Kim <habamax@gmail.com>
" Website: https://github.com/habamax/vim-odin
-" Last Change: 2024-01-15
+" Last Change: 2024 Jan 15
+" 2024-May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
"
" This file has been manually translated from Vim9 script.
@@ -19,7 +20,7 @@ let b:undo_ftplugin = 'setlocal commentstring<'
\ .. '| setlocal suffixesadd<'
setlocal suffixesadd=.odin
-setlocal commentstring=//%s
+setlocal commentstring=//\ %s
setlocal comments=s1:/*,mb:*,ex:*/,://
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/openvpn.vim b/runtime/ftplugin/openvpn.vim
index 56c0f25b39..9cd7b7ad1a 100644
--- a/runtime/ftplugin/openvpn.vim
+++ b/runtime/ftplugin/openvpn.vim
@@ -2,6 +2,7 @@
" Language: OpenVPN
" Maintainer: ObserverOfTime <chronobserver@disroot.org>
" Last Change: 2022 Oct 16
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists('b:did_ftplugin')
finish
@@ -9,6 +10,6 @@ endif
let b:did_ftplugin = 1
setlocal iskeyword+=-,.,/
-setlocal comments=:#,:; commentstring=#%s
+setlocal comments=:#,:; commentstring=#\ %s
let b:undo_ftplugin = 'setl isk< com< cms<'
diff --git a/runtime/ftplugin/pascal.vim b/runtime/ftplugin/pascal.vim
index 9abd7dd382..7c800c4fbd 100644
--- a/runtime/ftplugin/pascal.vim
+++ b/runtime/ftplugin/pascal.vim
@@ -3,6 +3,7 @@
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Dan Sharp
" Last Change: 2024 Jan 14
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
@@ -11,7 +12,7 @@ let s:cpo_save = &cpo
set cpo&vim
set comments=s:(*,m:\ ,e:*),s:{,m:\ ,e:}
-set commentstring={%s}
+set commentstring={\ %s\ }
if exists("pascal_delphi")
set comments+=:///
diff --git a/runtime/ftplugin/pdf.vim b/runtime/ftplugin/pdf.vim
index 1ed99117d6..96c77c870a 100644
--- a/runtime/ftplugin/pdf.vim
+++ b/runtime/ftplugin/pdf.vim
@@ -2,13 +2,14 @@
" Language: PDF
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
" Last Change: 2007 Dec 16
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
-setlocal commentstring=%%s
+setlocal commentstring=%\ %s
setlocal comments=:%
let b:undo_ftplugin = "setlocal cms< com< | unlet! b:match_words"
diff --git a/runtime/ftplugin/perl.vim b/runtime/ftplugin/perl.vim
index 8c6a80eb4f..03368a7af3 100644
--- a/runtime/ftplugin/perl.vim
+++ b/runtime/ftplugin/perl.vim
@@ -8,6 +8,7 @@
" 2023 Sep 07 by Vim Project (safety check: don't execute perl
" from current directory)
" 2024 Jan 14 by Vim Project (browsefilter)
+" 2024 May 24 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1
@@ -22,7 +23,7 @@ setlocal formatoptions+=crqol
setlocal keywordprg=perldoc\ -f
setlocal comments=:#
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
" Provided by Ned Konz <ned at bike-nomad dot com>
"---------------------------------------------
diff --git a/runtime/ftplugin/php.vim b/runtime/ftplugin/php.vim
index f03f14512a..e124961ba1 100644
--- a/runtime/ftplugin/php.vim
+++ b/runtime/ftplugin/php.vim
@@ -3,6 +3,7 @@
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Dan Sharp
" Last Change: 2024 Jan 14
+" Last Change: 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -44,7 +45,7 @@ if exists("b:match_skip")
endif
setlocal comments=s1:/*,mb:*,ex:*/,://,:#
-setlocal commentstring=/*%s*/
+setlocal commentstring=/*\ %s\ */
setlocal formatoptions+=l formatoptions-=t
if get(g:, "php_autocomment", 1)
diff --git a/runtime/ftplugin/ps1.vim b/runtime/ftplugin/ps1.vim
index d6ab01016b..e09bbf86dc 100644
--- a/runtime/ftplugin/ps1.vim
+++ b/runtime/ftplugin/ps1.vim
@@ -3,6 +3,8 @@
" URL: https://github.com/PProvost/vim-ps1
" Last Change: 2021 Apr 02
" 2024 Jan 14 by Vim Project (browsefilter)
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
+" 2024 Sep 19 by Konfekt (simplify keywordprg #15696)
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin") | finish | endif
@@ -14,7 +16,7 @@ let s:cpo_save = &cpo
set cpo&vim
setlocal tw=0
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
setlocal formatoptions=tcqro
" Enable autocompletion of hyphenated PowerShell commands,
" e.g. Get-Content or Get-ADUser
@@ -34,6 +36,10 @@ if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
endif
endif
+" Undo the stuff we changed
+let b:undo_ftplugin = "setlocal tw< cms< fo< iskeyword<" .
+ \ " | unlet! b:browsefilter"
+
" Look up keywords by Get-Help:
" check for PowerShell Core in Windows, Linux or MacOS
if executable('pwsh') | let s:pwsh_cmd = 'pwsh'
@@ -44,21 +50,14 @@ elseif executable('powershell.exe') | let s:pwsh_cmd = 'powershell.exe'
endif
if exists('s:pwsh_cmd')
- if !has('gui_running') && executable('less') &&
- \ !(exists('$ConEmuBuild') && &term =~? '^xterm')
- " For exclusion of ConEmu, see https://github.com/Maximus5/ConEmu/issues/2048
- command! -buffer -nargs=1 GetHelp silent exe '!' . s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full "<args>" | ' . (has('unix') ? 'LESS= less' : 'less') | redraw!
- elseif has('terminal')
+ if exists(':terminal') == 2
command! -buffer -nargs=1 GetHelp silent exe 'term ' . s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full "<args>"' . (executable('less') ? ' | less' : '')
else
command! -buffer -nargs=1 GetHelp echo system(s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full <args>')
endif
+ setlocal keywordprg=:GetHelp
+ let b:undo_ftplugin ..= " | setl kp< | sil! delc -buffer GetHelp"
endif
-setlocal keywordprg=:GetHelp
-
-" Undo the stuff we changed
-let b:undo_ftplugin = "setlocal tw< cms< fo< iskeyword< keywordprg<" .
- \ " | unlet! b:browsefilter"
let &cpo = s:cpo_save
unlet s:cpo_save
diff --git a/runtime/ftplugin/ps1xml.vim b/runtime/ftplugin/ps1xml.vim
index 17bb181f37..0052de19ce 100644
--- a/runtime/ftplugin/ps1xml.vim
+++ b/runtime/ftplugin/ps1xml.vim
@@ -3,6 +3,7 @@
" URL: https://github.com/PProvost/vim-ps1
" Last Change: 2021 Apr 02
" 2024 Jan 14 by Vim Project (browsefilter)
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin") | finish | endif
@@ -14,7 +15,7 @@ let s:cpo_save = &cpo
set cpo&vim
setlocal tw=0
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
setlocal formatoptions=tcqro
" Change the browse dialog on Win32 and GTK to show mainly PowerShell-related files
diff --git a/runtime/ftplugin/qml.vim b/runtime/ftplugin/qml.vim
index aa05c11bf9..53df11c6b8 100644
--- a/runtime/ftplugin/qml.vim
+++ b/runtime/ftplugin/qml.vim
@@ -3,6 +3,7 @@
" Maintainer: Chase Knowlden <haroldknowlden@gmail.com>
" Last Change: 2023 Aug 16
" 2023 Aug 23 by Vim Project (browsefilter)
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists( 'b:did_ftplugin' )
finish
@@ -28,7 +29,7 @@ endif
" Set 'comments' to format dashed lists in comments.
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
-setlocal commentstring=//%s
+setlocal commentstring=//\ %s
setlocal formatoptions-=t
setlocal formatoptions+=croql
diff --git a/runtime/ftplugin/query.lua b/runtime/ftplugin/query.lua
index c75dc30430..32d615c65c 100644
--- a/runtime/ftplugin/query.lua
+++ b/runtime/ftplugin/query.lua
@@ -1,6 +1,6 @@
-- Neovim filetype plugin file
-- Language: Treesitter query
--- Last Change: 2023 Aug 23
+-- Last Change: 2024 Jul 03
if vim.b.did_ftplugin == 1 then
return
@@ -32,4 +32,7 @@ if not vim.b.disable_query_linter and #query_lint_on > 0 then
end
-- it's a lisp!
-vim.cmd([[ runtime! ftplugin/lisp.vim ]])
+vim.cmd([[runtime! ftplugin/lisp.vim]])
+
+vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl omnifunc< iskeyword<'
+vim.b.undo_ftplugin = vim.b.undo_ftplugin .. ' | call v:lua.vim.treesitter.stop()'
diff --git a/runtime/ftplugin/racket.vim b/runtime/ftplugin/racket.vim
index 84f5422140..7bfd87ddc3 100644
--- a/runtime/ftplugin/racket.vim
+++ b/runtime/ftplugin/racket.vim
@@ -3,8 +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 29
-" 2024 Jan 14 by Vim Project (browsefilter)
+" Last Change: 2024 May 28
if exists("b:did_ftplugin")
finish
@@ -21,7 +20,7 @@ setlocal iskeyword=@,!,#-',*-:,<-Z,a-z,~,_,94
setlocal comments=:;;;;,:;;;,:;;,:;
setlocal formatoptions+=r
-"setlocal commentstring=;;%s
+"setlocal commentstring=;;\ %s
setlocal commentstring=#\|\ %s\ \|#
setlocal formatprg=raco\ fmt
diff --git a/runtime/ftplugin/raku.vim b/runtime/ftplugin/raku.vim
index 941222bd38..f57427e323 100644
--- a/runtime/ftplugin/raku.vim
+++ b/runtime/ftplugin/raku.vim
@@ -1,10 +1,11 @@
" Vim filetype plugin file
-" Language: Raku
-" Maintainer: vim-perl <vim-perl@googlegroups.com>
-" Homepage: https://github.com/Raku/vim-raku
+" Language: Raku
+" Maintainer: vim-perl <vim-perl@googlegroups.com>
+" Homepage: https://github.com/Raku/vim-raku
" Bugs/requests: https://github.com/Raku/vim-raku/issues
-" Last Change: 2021-04-16
-" Contributors: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
+" Last Change: 2021 Apr 16
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
+" Contributors: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
"
" Based on ftplugin/perl.vim by Dan Sharp <dwsharp at hotmail dot com>
@@ -21,7 +22,7 @@ setlocal formatoptions+=crqol
setlocal keywordprg=p6doc
setlocal comments=:#\|,:#=,:#
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
" Provided by Ned Konz <ned at bike-nomad dot com>
"---------------------------------------------
diff --git a/runtime/ftplugin/rasi.vim b/runtime/ftplugin/rasi.vim
new file mode 100644
index 0000000000..5f8ce862df
--- /dev/null
+++ b/runtime/ftplugin/rasi.vim
@@ -0,0 +1,25 @@
+" Vim filetype plugin file
+" Language: RASI
+" Maintainer: Pierrick Guillaume <pierguill@gmail.com>
+" Last Change: 2024 May 21
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+let b:undo_ftplugin = "setl com< cms< isk< inc<"
+
+setlocal comments=s1:/*,mb:*,ex:*/
+setlocal commentstring=//\ %s
+setlocal iskeyword+=-
+
+let &l:include = '^\s*@import\s\+\%(url(\)\='
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: ts=8
diff --git a/runtime/ftplugin/readline.vim b/runtime/ftplugin/readline.vim
index f5934ce2c0..77fab2a611 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: 2023 Aug 22
+" Last Change: 2024 Sep 19 (simplify keywordprg #15696)
if exists("b:did_ftplugin")
finish
@@ -34,20 +34,12 @@ if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
-if has('unix') && executable('less')
- if !has('gui_running')
- command -buffer -nargs=1 ReadlineKeywordPrg
- \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s+' . <q-args> . '\b'' --hilite-search" man ' . '3 readline' |
- \ redraw!
- elseif has('terminal')
- command -buffer -nargs=1 ReadlineKeywordPrg
- \ silent exe 'term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . '3 readline'
- endif
- if exists(':ReadlineKeywordPrg') == 2
- setlocal iskeyword+=-
- setlocal keywordprg=:ReadlineKeywordPrg
- let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer ReadlineKeywordPrg'
- endif
+if has('unix') && executable('less') && exists(':terminal') == 2
+ command -buffer -nargs=1 ReadlineKeywordPrg
+ \ silent exe 'term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . '3 readline'
+ setlocal iskeyword+=-
+ setlocal keywordprg=:ReadlineKeywordPrg
+ let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer ReadlineKeywordPrg'
endif
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/requirements.vim b/runtime/ftplugin/requirements.vim
index fcfc1ac269..babf33795c 100644
--- a/runtime/ftplugin/requirements.vim
+++ b/runtime/ftplugin/requirements.vim
@@ -36,7 +36,11 @@ let b:undo_ftplugin = "setl iskeyword< commentstring<"
" pip options contain "-"
setlocal iskeyword+=-
setlocal commentstring=#\ %s
-compiler pip_compile
+
+if !exists('current_compiler')
+ let b:undo_ftplugin ..= "| compiler make"
+ compiler pip_compile
+endif
let &cpoptions = s:save_cpoptions
unlet s:save_cpoptions
diff --git a/runtime/ftplugin/rmd.vim b/runtime/ftplugin/rmd.vim
index a537017aad..2390ab1cb9 100644
--- a/runtime/ftplugin/rmd.vim
+++ b/runtime/ftplugin/rmd.vim
@@ -3,7 +3,9 @@
" 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
+" Last Change:
+" 2024 Feb 28 by Vim Project
+" 2024 Sep 23 by Vim Project: properly restore fex option
" Original work by Alex Zvoleff (adjusted from R help for rmd by Michel Kuhlmann)
" Only do this when not yet done for this buffer
@@ -74,9 +76,9 @@ if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
endif
if exists('b:undo_ftplugin')
- let b:undo_ftplugin .= " | setl cms< com< fo< flp< isk< | unlet! b:browsefilter"
+ let b:undo_ftplugin .= " | setl cms< com< fo< flp< isk< fex< | unlet! b:browsefilter"
else
- let b:undo_ftplugin = "setl cms< com< fo< flp< isk< | unlet! b:browsefilter"
+ let b:undo_ftplugin = "setl cms< com< fo< flp< isk< fex< | unlet! b:browsefilter"
endif
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/rrst.vim b/runtime/ftplugin/rrst.vim
index d088f98224..73ebb75fea 100644
--- a/runtime/ftplugin/rrst.vim
+++ b/runtime/ftplugin/rrst.vim
@@ -3,7 +3,9 @@
" 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
+" Last Change:
+" 2024 Feb 28 by Vim Project
+" 2024 Sep 23 by Vim Project: properly restore fex option
" Original work by Alex Zvoleff
" Only do this when not yet done for this buffer
@@ -48,9 +50,9 @@ if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
endif
if exists('b:undo_ftplugin')
- let b:undo_ftplugin .= " | setl cms< com< fo< flp< isk< | unlet! b:browsefilter"
+ let b:undo_ftplugin .= " | setl cms< com< fo< flp< isk< fex< | unlet! b:browsefilter"
else
- let b:undo_ftplugin = "setl cms< com< fo< flp< isk< | unlet! b:browsefilter"
+ let b:undo_ftplugin = "setl cms< com< fo< flp< isk< fex< | unlet! b:browsefilter"
endif
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/rust.vim b/runtime/ftplugin/rust.vim
index fb15b444d0..3e2741f919 100644
--- a/runtime/ftplugin/rust.vim
+++ b/runtime/ftplugin/rust.vim
@@ -1,7 +1,8 @@
-" Language: Rust
-" Description: Vim ftplugin for Rust
-" Maintainer: Chris Morgan <me@chrismorgan.info>
-" Last Change: 2024-03-17
+" Language: Rust
+" Description: Vim ftplugin for Rust
+" Maintainer: Chris Morgan <me@chrismorgan.info>
+" Last Change: 2024 Mar 17
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com ('commentstring')
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
if exists("b:did_ftplugin")
@@ -36,7 +37,7 @@ if get(g:, 'rust_bang_comment_leader', 0)
else
setlocal comments=s0:/*!,ex:*/,s1:/*,mb:*,ex:*/,:///,://!,://
endif
-setlocal commentstring=//%s
+setlocal commentstring=//\ %s
setlocal formatoptions-=t formatoptions+=croqnl
" j was only added in 7.3.541, so stop complaints about its nonexistence
silent! setlocal formatoptions+=j
@@ -147,6 +148,7 @@ endif
" Cleanup {{{1
let b:undo_ftplugin = "
+ \ compiler make |
\ setlocal formatoptions< comments< commentstring< include< includeexpr< suffixesadd<
\|if exists('b:rust_set_style')
\|setlocal tabstop< shiftwidth< softtabstop< expandtab< textwidth<
diff --git a/runtime/ftplugin/scdoc.vim b/runtime/ftplugin/scdoc.vim
index 552c865baa..8225e437a8 100644
--- a/runtime/ftplugin/scdoc.vim
+++ b/runtime/ftplugin/scdoc.vim
@@ -1,7 +1,8 @@
" scdoc filetype plugin
-" Maintainer: Gregory Anders <contact@gpanders.com>
-" Last Updated: 2022-05-09
-" Upstream: https://github.com/gpanders/vim-scdoc
+" Maintainer: Gregory Anders <contact@gpanders.com>
+" Last Updated: 2022 May 09
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
+" Upstream: https://github.com/gpanders/vim-scdoc
" Only do this when not done yet for this buffer
if exists('b:did_ftplugin')
@@ -12,7 +13,7 @@ endif
let b:did_ftplugin = 1
setlocal comments=b:;
-setlocal commentstring=;%s
+setlocal commentstring=;\ %s
setlocal formatoptions+=t
setlocal noexpandtab
setlocal shiftwidth=0
diff --git a/runtime/ftplugin/scheme.vim b/runtime/ftplugin/scheme.vim
index 04655bc136..63e578199d 100644
--- a/runtime/ftplugin/scheme.vim
+++ b/runtime/ftplugin/scheme.vim
@@ -1,11 +1,12 @@
" Vim filetype plugin file
-" Language: Scheme (R7RS)
-" Last Change: 2019-11-19
-" Author: Evan Hanson <evhan@foldling.org>
-" Maintainer: Evan Hanson <evhan@foldling.org>
+" Language: Scheme (R7RS)
+" Last Change: 2024 Jun 21
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
+" Author: Evan Hanson <evhan@foldling.org>
+" Maintainer: Evan Hanson <evhan@foldling.org>
" Previous Maintainer: Sergey Khorev <sergey.khorev@gmail.com>
-" Repository: https://git.foldling.org/vim-scheme.git
-" URL: https://foldling.org/vim/ftplugin/scheme.vim
+" Repository: https://git.foldling.org/vim-scheme.git
+" URL: https://foldling.org/vim/ftplugin/scheme.vim
if exists('b:did_ftplugin')
finish
@@ -16,14 +17,16 @@ set cpo&vim
setl lisp
setl comments=:;;;;,:;;;,:;;,:;,sr:#\|,mb:\|,ex:\|#
-setl commentstring=;%s
+setl commentstring=;\ %s
setl define=^\\s*(def\\k*
setl iskeyword=33,35-39,42-43,45-58,60-90,94,95,97-122,126
+setl formatoptions-=t
-let b:undo_ftplugin = 'setl lisp< comments< commentstring< define< iskeyword<'
+let b:undo_ftplugin = 'setl lisp< comments< commentstring< define< iskeyword< formatoptions<'
setl lispwords+=case
setl lispwords+=define
+setl lispwords+=define-library
setl lispwords+=define-record-type
setl lispwords+=define-syntax
setl lispwords+=define-values
diff --git a/runtime/ftplugin/sh.vim b/runtime/ftplugin/sh.vim
index c47aa520e9..4c7695dcc6 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: 2024 May 06 by Vim Project (MANPAGER=)
+" Last Change: 2024 Sep 19 by Vim Project (compiler shellcheck)
if exists("b:did_ftplugin")
finish
@@ -45,15 +45,18 @@ if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
endif
if get(b:, "is_bash", 0)
- if !has("gui_running") && executable("less")
- command! -buffer -nargs=1 ShKeywordPrg silent exe '!bash -c "{ help "<args>" 2>/dev/null || MANPAGER= man "<args>"; } | LESS= less"' | redraw!
- elseif has("terminal")
+ if exists(':terminal') == 2
command! -buffer -nargs=1 ShKeywordPrg silent exe ':term bash -c "help "<args>" 2>/dev/null || man "<args>""'
else
command! -buffer -nargs=1 ShKeywordPrg echo system('bash -c "help <args>" 2>/dev/null || MANPAGER= man "<args>"')
endif
setlocal keywordprg=:ShKeywordPrg
let b:undo_ftplugin ..= " | setl kp< | sil! delc -buffer ShKeywordPrg"
+
+ if !exists('current_compiler')
+ compiler shellcheck
+ endif
+ let b:undo_ftplugin .= ' | compiler make'
endif
let &cpo = s:save_cpo
diff --git a/runtime/ftplugin/snakemake.vim b/runtime/ftplugin/snakemake.vim
new file mode 100644
index 0000000000..ab90ca10b5
--- /dev/null
+++ b/runtime/ftplugin/snakemake.vim
@@ -0,0 +1,13 @@
+" Vim filetype plugin
+" Language: snakemake
+" Maintainer: Riley Bruins <ribru17@gmail.com>
+" Last Change: 2024 Jun 13
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setl comments=:# commentstring=#\ %s
+
+let b:undo_ftplugin = 'setl com< cms<'
diff --git a/runtime/ftplugin/spec.vim b/runtime/ftplugin/spec.vim
index 9040e19ce1..fa125be52c 100644
--- a/runtime/ftplugin/spec.vim
+++ b/runtime/ftplugin/spec.vim
@@ -2,8 +2,9 @@
" Filename: spec.vim
" Maintainer: Igor Gnatenko i.gnatenko.brain@gmail.com
" Former Maintainer: Gustavo Niemeyer <niemeyer@conectiva.com> (until March 2014)
-" Last Change: Mon Jun 01 21:15 MSK 2015 Igor Gnatenko
-" Update by Zdenek Dohnal, 2022 May 17
+" Last Change: 2015 Jun 01
+" Update by Zdenek Dohnal, 2022 May 17
+" 2024 Sep 10 by Vim Project: add epoch support for spec changelog, #15537
if exists("b:did_ftplugin")
finish
@@ -66,9 +67,11 @@ if !exists("*s:SpecChangelog")
endif
let line = 0
let name = ""
+ let epoch = ""
let ver = ""
let rel = ""
let nameline = -1
+ let epochline = -1
let verline = -1
let relline = -1
let chgline = -1
@@ -77,6 +80,9 @@ if !exists("*s:SpecChangelog")
if name == "" && linestr =~? '^Name:'
let nameline = line
let name = substitute(strpart(linestr,5), '^[ ]*\([^ ]\+\)[ ]*$','\1','')
+ elseif epoch == "" && linestr =~? '^Epoch:'
+ let epochline = line
+ let epoch = substitute(strpart(linestr,6), '^[ ]*\([^ ]\+\)[ ]*$','\1','')
elseif ver == "" && linestr =~? '^Version:'
let verline = line
let ver = substitute(strpart(linestr,8), '^[ ]*\([^ ]\+\)[ ]*$','\1','')
@@ -93,6 +99,7 @@ if !exists("*s:SpecChangelog")
if nameline != -1 && verline != -1 && relline != -1
let include_release_info = exists("g:spec_chglog_release_info")
let name = s:ParseRpmVars(name, nameline)
+ let epoch = s:ParseRpmVars(epoch, epochline)
let ver = s:ParseRpmVars(ver, verline)
let rel = s:ParseRpmVars(rel, relline)
else
@@ -117,6 +124,9 @@ if !exists("*s:SpecChangelog")
if chgline != -1
let tmptime = v:lc_time
language time C
+ if strlen(epoch)
+ let ver = epoch.":".ver
+ endif
let parsed_format = "* ".strftime(format)." - ".ver."-".rel
execute "language time" tmptime
let release_info = "+ ".name."-".ver."-".rel
diff --git a/runtime/ftplugin/sql.vim b/runtime/ftplugin/sql.vim
index 61b7e67255..3b56acd674 100644
--- a/runtime/ftplugin/sql.vim
+++ b/runtime/ftplugin/sql.vim
@@ -3,8 +3,9 @@
" 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)
-" 2024 May 18 by Vim Project (set comment options)
+" 2024 Jan 14 by Vim Project: browsefilter
+" 2024 May 18 by Vim Project: set comment options
+" 2024 Aug 14 by Vim Project: remove redundant code
" Download: http://vim.sourceforge.net/script.php?script_id=454
" For more details please use:
@@ -92,13 +93,19 @@
" Only do this when not done yet for this buffer
" This ftplugin can be used with other ftplugins. So ensure loading
" happens if all elements of this plugin have not yet loaded.
-if exists("b:did_ftplugin") && exists("b:current_ftplugin") && b:current_ftplugin == 'sql'
+if exists("b:did_ftplugin")
finish
endif
+" Don't load another plugin for this buffer
+let b:did_ftplugin = 1
+
let s:save_cpo = &cpo
set cpo&vim
+let b:undo_ftplugin = "setl comments< commentstring< formatoptions< define< omnifunc<" .
+ \ " | unlet! b:browsefilter b:match_words"
+
" Disable autowrapping for code, but enable for comments
" t Auto-wrap text using textwidth
" c Auto-wrap comments using textwidth, inserting the current comment
@@ -263,19 +270,6 @@ elseif exists("g:sql_type_default")
endif
endif
-" If the above runtime command succeeded, do not load the default settings
-" as they should have already been loaded from a previous run.
-if exists("b:did_ftplugin") && exists("b:current_ftplugin") && b:current_ftplugin == 'sql'
- finish
-endif
-
-let b:undo_ftplugin = "setl comments< commentstring< formatoptions< define< omnifunc<" .
- \ " | unlet! b:browsefilter b:match_words"
-
-" Don't load another plugin for this buffer
-let b:did_ftplugin = 1
-let b:current_ftplugin = 'sql'
-
" 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"
diff --git a/runtime/ftplugin/squirrel.vim b/runtime/ftplugin/squirrel.vim
new file mode 100644
index 0000000000..559be88001
--- /dev/null
+++ b/runtime/ftplugin/squirrel.vim
@@ -0,0 +1,17 @@
+" Vim filetype plugin
+" Language: Squirrel
+" Maintainer: Riley Bruins <ribru17@gmail.com>
+" Last Change: 2024 Jul 06
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+" Set 'comments' to format dashed lists in comments.
+" Also include ///, used for Doxygen.
+setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:///,://
+
+setlocal commentstring=//\ %s
+
+let b:undo_ftplugin = 'setl com< cms<'
diff --git a/runtime/ftplugin/sshconfig.vim b/runtime/ftplugin/sshconfig.vim
index 4a054da52f..1cc4e609b0 100644
--- a/runtime/ftplugin/sshconfig.vim
+++ b/runtime/ftplugin/sshconfig.vim
@@ -1,7 +1,8 @@
" Vim filetype plugin file
-" Language: OpenSSH client configuration file
-" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2023-10-07
+" Language: OpenSSH client configuration file
+" Maintainer: This runtime file is looking for a new maintainer.
+" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2024-09-19 (simplify keywordprg #15696)
if exists("b:did_ftplugin")
finish
@@ -14,20 +15,12 @@ set cpo&vim
setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql
let b:undo_ftplugin = 'setlocal com< cms< fo<'
-if has('unix') && executable('less')
- if !has('gui_running')
- command -buffer -nargs=1 SshconfigKeywordPrg
- \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s+' . <q-args> . '$'' --hilite-search" man ' . 'ssh_config' |
- \ redraw!
- elseif has('terminal')
- command -buffer -nargs=1 SshconfigKeywordPrg
- \ silent exe 'term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '$', '\') . ''' --hilite-search" man ' . 'ssh_config'
- endif
- if exists(':SshconfigKeywordPrg') == 2
- setlocal iskeyword+=-
- setlocal keywordprg=:SshconfigKeywordPrg
- let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SshconfigKeywordPrg'
- endif
+if has('unix') && executable('less') && exists(':terminal') == 2
+ command -buffer -nargs=1 SshconfigKeywordPrg
+ \ silent exe 'term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '$', '\') . ''' --hilite-search" man ' . 'ssh_config'
+ setlocal iskeyword+=-
+ setlocal keywordprg=:SshconfigKeywordPrg
+ let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SshconfigKeywordPrg'
endif
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/stata.lua b/runtime/ftplugin/stata.lua
new file mode 100644
index 0000000000..89ab42ef54
--- /dev/null
+++ b/runtime/ftplugin/stata.lua
@@ -0,0 +1,3 @@
+vim.bo.commentstring = '// %s'
+
+vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<'
diff --git a/runtime/ftplugin/sudoers.vim b/runtime/ftplugin/sudoers.vim
index 81ce7906a9..e87fedaa01 100644
--- a/runtime/ftplugin/sudoers.vim
+++ b/runtime/ftplugin/sudoers.vim
@@ -1,7 +1,8 @@
" Vim filetype plugin file
-" Language: sudoers(5) configuration files
-" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2023-10-07
+" Language: sudoers(5) configuration files
+" Maintainer: This runtime file is looking for a new maintainer.
+" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2024-09-19 (simplify keywordprg #15696)
if exists("b:did_ftplugin")
finish
@@ -15,20 +16,12 @@ let b:undo_ftplugin = "setl com< cms< fo<"
setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql
-if has('unix') && executable('less')
- if !has('gui_running')
- command -buffer -nargs=1 SudoersKeywordPrg
- \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''\b' . <q-args> . '\b'' --hilite-search" man ' . 'sudoers' |
- \ redraw!
- elseif has('terminal')
- command -buffer -nargs=1 SudoersKeywordPrg
- \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('\b' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'sudoers'
- endif
- if exists(':SudoersKeywordPrg') == 2
- setlocal iskeyword+=-
- setlocal keywordprg=:SudoersKeywordPrg
- let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SudoersKeywordPrg'
- endif
+if has('unix') && executable('less') && exists(':terminal') == 2
+ command -buffer -nargs=1 SudoersKeywordPrg
+ \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('\b' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'sudoers'
+ setlocal iskeyword+=-
+ setlocal keywordprg=:SudoersKeywordPrg
+ let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SudoersKeywordPrg'
endif
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/supercollider.lua b/runtime/ftplugin/supercollider.lua
new file mode 100644
index 0000000000..89ab42ef54
--- /dev/null
+++ b/runtime/ftplugin/supercollider.lua
@@ -0,0 +1,3 @@
+vim.bo.commentstring = '// %s'
+
+vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<'
diff --git a/runtime/ftplugin/svelte.vim b/runtime/ftplugin/svelte.vim
new file mode 100644
index 0000000000..e0ec4e0ae3
--- /dev/null
+++ b/runtime/ftplugin/svelte.vim
@@ -0,0 +1,13 @@
+" Vim filetype plugin
+" Language: svelte
+" Maintainer: Igor Lacerda <igorlafarsi@gmail.com>
+" Last Change: 2024 Jun 09
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setl commentstring=<!--\ %s\ -->
+
+let b:undo_ftplugin = 'setl cms<'
diff --git a/runtime/ftplugin/swift.lua b/runtime/ftplugin/swift.lua
new file mode 100644
index 0000000000..89ab42ef54
--- /dev/null
+++ b/runtime/ftplugin/swift.lua
@@ -0,0 +1,3 @@
+vim.bo.commentstring = '// %s'
+
+vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<'
diff --git a/runtime/ftplugin/systemd.vim b/runtime/ftplugin/systemd.vim
index 8bcacdd381..1b1d242029 100644
--- a/runtime/ftplugin/systemd.vim
+++ b/runtime/ftplugin/systemd.vim
@@ -1,37 +1,30 @@
" Vim filetype plugin file
" Language: systemd.unit(5)
" Keyword Lookup Support: Enno Nagel <enno.nagel+vim@gmail.com>
-" Latest Revision: 2023-10-07
+" Latest Revision: 2024-10-02 (small fixes to &keywordprg)
-if !exists('b:did_ftplugin')
- " Looks a lot like dosini files.
- runtime! ftplugin/dosini.vim
+if exists("b:did_ftplugin")
+ finish
endif
+" Looks a lot like dosini files.
+runtime! ftplugin/dosini.vim
-if has('unix') && executable('less')
- if !has('gui_running')
- command -buffer -nargs=1 SystemdKeywordPrg silent exe '!' . KeywordLookup_systemd(<q-args>) | redraw!
- elseif has('terminal')
- command -buffer -nargs=1 SystemdKeywordPrg silent exe 'term ' . KeywordLookup_systemd(<q-args>)
- endif
- if exists(':SystemdKeywordPrg') == 2
- if !exists('*KeywordLookup_systemd')
- function KeywordLookup_systemd(keyword) abort
- let matches = matchlist(getline(search('\v^\s*\[\s*.+\s*\]\s*$', 'nbWz')), '\v^\s*\[\s*(\k+).*\]\s*$')
- if len(matches) > 1
- let section = matches[1]
- return 'LESS= MANPAGER="less --pattern=''(^|,)\s+' . a:keyword . '=$'' --hilite-search" man ' . 'systemd.' . section
- else
- return 'LESS= MANPAGER="less --pattern=''(^|,)\s+' . a:keyword . '=$'' --hilite-search" man ' . 'systemd'
- endif
- endfunction
- endif
- setlocal iskeyword+=-
- setlocal keywordprg=:SystemdKeywordPrg
- if !exists('b:undo_ftplugin') || empty(b:undo_ftplugin)
- let b:undo_ftplugin = 'setlocal keywordprg< iskeyword<'
+if has('unix') && executable('less') && exists(':terminal') == 2
+ command! -buffer -nargs=1 SystemdKeywordPrg silent exe 'term ++close ' KeywordLookup_systemd(<q-args>)
+ silent! function KeywordLookup_systemd(keyword) abort
+ let matches = matchlist(getline(search('\v^\s*\[\s*.+\s*\]\s*$', 'nbWz')), '\v^\s*\[\s*(\k+).*\]\s*$')
+ if len(matches) > 1
+ let section = matches[1]
+ return 'env LESS= MANPAGER="less --pattern=''(^|,)\\s+' . a:keyword . '=$'' --hilite-search" man ' . 'systemd.' . section
else
- let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SystemdKeywordPrg'
+ return 'env LESS= MANPAGER="less --pattern=''(^|,)\\s+' . a:keyword . '=$'' --hilite-search" man ' . 'systemd'
endif
+ endfunction
+ setlocal iskeyword+=-
+ setlocal keywordprg=:SystemdKeywordPrg
+ if !exists('b:undo_ftplugin') || empty(b:undo_ftplugin)
+ let b:undo_ftplugin = 'setlocal keywordprg< iskeyword< | sil! delc -buffer SystemdKeywordPrg'
+ else
+ let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SystemdKeywordPrg'
endif
endif
diff --git a/runtime/ftplugin/tcl.vim b/runtime/ftplugin/tcl.vim
index fa900096c0..214d9c256d 100644
--- a/runtime/ftplugin/tcl.vim
+++ b/runtime/ftplugin/tcl.vim
@@ -3,6 +3,7 @@
" Maintainer: Robert L Hicks <sigzero@gmail.com>
" Latest Revision: 2009-05-01
" 2024 Jan 14 by Vim Project (browsefilter)
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -15,7 +16,7 @@ let s:cpo_save = &cpo
set cpo-=C
setlocal comments=:#
-setlocal commentstring=#%s
+setlocal commentstring=#\ %s
setlocal formatoptions+=croql
" Change the browse dialog on Windows to show mainly Tcl-related files
diff --git a/runtime/ftplugin/terraform.vim b/runtime/ftplugin/terraform.vim
new file mode 100644
index 0000000000..b03cab3638
--- /dev/null
+++ b/runtime/ftplugin/terraform.vim
@@ -0,0 +1,14 @@
+" Vim filetype plugin
+" Language: terraform
+" Maintainer: Janno Tjarks (janno.tjarks@mailbox.org)
+" Last Change: 2024 Jul 3
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setlocal commentstring=#\ %s
+setlocal comments=://,:#
+
+let b:undo_ftplugin = "setlocal commentstring< comments<"
diff --git a/runtime/ftplugin/tf.vim b/runtime/ftplugin/tf.vim
new file mode 100644
index 0000000000..1571d5e508
--- /dev/null
+++ b/runtime/ftplugin/tf.vim
@@ -0,0 +1,13 @@
+" Vim filetype plugin
+" Language: tf (TinyFugue)
+" Maintainer: Riley Bruins <ribru17@gmail.com>
+" Last Change: 2024 Jul 06
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+setl comments=:#,:; commentstring=;\ %s
+
+let b:undo_ftplugin = 'setl com< cms<'
diff --git a/runtime/ftplugin/thrift.vim b/runtime/ftplugin/thrift.vim
new file mode 100644
index 0000000000..dd18e19948
--- /dev/null
+++ b/runtime/ftplugin/thrift.vim
@@ -0,0 +1,17 @@
+" Vim filetype plugin file
+" Language: Apache Thrift
+" Maintainer: Yinzuo Jiang <jiangyinzuo@foxmail.com>
+" Last Change: 2024/07/29
+
+if exists("b:did_ftplugin")
+ finish
+endif
+
+let b:did_ftplugin = 1
+
+" Thrift supports shell-style, C-style multi-line as well as single-line Java/C++ style comments.
+" Reference: https://diwakergupta.github.io/thrift-missing-guide/#_language_reference
+setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:///,://,b:#
+setlocal commentstring=//\ %s
+
+let b:undo_ftplugin = 'setl comments< commentstring<'
diff --git a/runtime/ftplugin/typescript.vim b/runtime/ftplugin/typescript.vim
index 680521df31..fb5f4e135f 100644
--- a/runtime/ftplugin/typescript.vim
+++ b/runtime/ftplugin/typescript.vim
@@ -2,6 +2,7 @@
" Language: TypeScript
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2024 Jan 14
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -18,7 +19,7 @@ setlocal formatoptions-=t formatoptions+=croql
" Set 'comments' to format dashed lists in comments.
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
-setlocal commentstring=//%s
+setlocal commentstring=//\ %s
setlocal suffixesadd+=.ts,.d.ts,.tsx,.js,.jsx,.cjs,.mjs
diff --git a/runtime/ftplugin/typst.vim b/runtime/ftplugin/typst.vim
index c2d7811ace..895fc688d9 100644
--- a/runtime/ftplugin/typst.vim
+++ b/runtime/ftplugin/typst.vim
@@ -1,14 +1,27 @@
-" Vim filetype plugin
-" Language: typst
-" Maintainer: Riley Bruins <ribru17@gmail.com>
-" Last Change: 2024 May 19
+" Vim filetype plugin file
+" Language: Typst
+" Maintainer: Gregory Anders
+" Last Change: 2024 Oct 04
+" Based on: https://github.com/kaarmu/typst.vim
if exists('b:did_ftplugin')
finish
endif
let b:did_ftplugin = 1
-setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
setlocal commentstring=//\ %s
+setlocal comments=s1:/*,mb:*,ex:*/,://
+setlocal formatoptions+=croq
+setlocal suffixesadd=.typ
-let b:undo_ftplugin = 'setl com< cms<'
+let b:undo_ftplugin = 'setl cms< com< fo< sua<'
+
+if get(g:, 'typst_conceal', 0)
+ setlocal conceallevel=2
+ let b:undo_ftplugin .= ' cole<'
+endif
+
+if !exists('current_compiler')
+ compiler typst
+ let b:undo_ftplugin ..= "| compiler make"
+endif
diff --git a/runtime/ftplugin/udevrules.vim b/runtime/ftplugin/udevrules.vim
index ec365f04c2..e6c7f113c2 100644
--- a/runtime/ftplugin/udevrules.vim
+++ b/runtime/ftplugin/udevrules.vim
@@ -1,7 +1,8 @@
" Vim filetype plugin file
-" Language: udev(8) rules file
-" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2023-10-07
+" Language: udev(8) rules file
+" Maintainer: This runtime file is looking for a new maintainer.
+" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2024-09-19 (simplify keywordprg #15696)
if exists("b:did_ftplugin")
finish
@@ -15,20 +16,12 @@ let b:undo_ftplugin = "setl com< cms< fo<"
setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql
-if has('unix') && executable('less')
- if !has('gui_running')
- command -buffer -nargs=1 UdevrulesKeywordPrg
- \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s{,8}' . <q-args> . '\b'' --hilite-search" man ' . 'udev' |
- \ redraw!
- elseif has('terminal')
- command -buffer -nargs=1 UdevrulesKeywordPrg
- \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s{,8}' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'udev'
- endif
- if exists(':UdevrulesKeywordPrg') == 2
- setlocal iskeyword+=-
- setlocal keywordprg=:UdevrulesKeywordPrg
- let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer UdevrulesKeywordPrg'
- endif
+if has('unix') && executable('less') && exists(':terminal') == 2
+ command -buffer -nargs=1 UdevrulesKeywordPrg
+ \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s{,8}' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'udev'
+ setlocal iskeyword+=-
+ setlocal keywordprg=:UdevrulesKeywordPrg
+ let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer UdevrulesKeywordPrg'
endif
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/vim.vim b/runtime/ftplugin/vim.vim
index 5c99df7f5a..b5e8e693f6 100644
--- a/runtime/ftplugin/vim.vim
+++ b/runtime/ftplugin/vim.vim
@@ -2,6 +2,7 @@
" Language: Vim
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2024 Apr 13
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" Only do this when not done yet for this buffer
@@ -51,7 +52,7 @@ setlocal keywordprg=:help
" Comments starts with # in Vim9 script. We have to guess which one to use.
if "\n" .. getline(1, 32)->join("\n") =~# '\n\s*vim9\%[script]\>'
- setlocal commentstring=#%s
+ setlocal commentstring=#\ %s
else
setlocal commentstring=\"%s
endif
@@ -66,9 +67,6 @@ if &tw == 0
setlocal tw=78
endif
-" Prefer Vim help instead of manpages.
-setlocal keywordprg=:help
-
if !exists("no_plugin_maps") && !exists("no_vim_maps")
let b:did_add_maps = 1
diff --git a/runtime/ftplugin/wat.vim b/runtime/ftplugin/wat.vim
index 35d2d6a322..ad1140bbb5 100644
--- a/runtime/ftplugin/wat.vim
+++ b/runtime/ftplugin/wat.vim
@@ -2,6 +2,7 @@
" Language: WebAssembly
" Maintainer: rhysd <lin90162@yahoo.co.jp>
" Last Change: Nov 14, 2023
+" May 24, 2024 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" For bugs, patches and license go to https://github.com/rhysd/vim-wasm
if exists("b:did_ftplugin")
@@ -10,7 +11,7 @@ endif
let b:did_ftplugin = 1
setlocal comments=s:(;,e:;),:;;
-setlocal commentstring=(;%s;)
+setlocal commentstring=(;\ %s\ ;)
setlocal formatoptions-=t
setlocal iskeyword+=$,.,/
diff --git a/runtime/ftplugin/xdefaults.lua b/runtime/ftplugin/xdefaults.lua
deleted file mode 100644
index b4e68148f5..0000000000
--- a/runtime/ftplugin/xdefaults.lua
+++ /dev/null
@@ -1 +0,0 @@
-vim.bo.commentstring = '/*%s*/'
diff --git a/runtime/ftplugin/xdefaults.vim b/runtime/ftplugin/xdefaults.vim
index c1aff70176..26c7516f8e 100644
--- a/runtime/ftplugin/xdefaults.vim
+++ b/runtime/ftplugin/xdefaults.vim
@@ -1,7 +1,8 @@
" Vim filetype plugin file
-" Language: X resources files like ~/.Xdefaults (xrdb)
-" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2008-07-09
+" Language: X resources files like ~/.Xdefaults (xrdb)
+" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2008 Jul 09
+" 2024 Jun 03 by Riley Bruins <ribru17@gmail.com> ('commentstring')
if exists("b:did_ftplugin")
finish
@@ -13,7 +14,7 @@ set cpo&vim
let b:undo_ftplugin = "setl com< cms< inc< fo<"
-setlocal comments=s1:/*,mb:*,ex:*/,:! commentstring& inc&
+setlocal comments=s1:/*,mb:*,ex:*/,:! commentstring=!\ %s inc&
setlocal formatoptions-=t formatoptions+=croql
let &cpo = s:cpo_save
diff --git a/runtime/ftplugin/xml.vim b/runtime/ftplugin/xml.vim
index b81c3980d2..83c528eff2 100644
--- a/runtime/ftplugin/xml.vim
+++ b/runtime/ftplugin/xml.vim
@@ -3,6 +3,7 @@
" Maintainer: Christian Brabandt <cb@256bit.org>
" Last Changed: Dec 07th, 2018
" 2024 Jan 14 by Vim Project (browsefilter)
+" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
" Repository: https://github.com/chrisbra/vim-xml-ftplugin
" Previous Maintainer: Dan Sharp
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin
@@ -15,7 +16,7 @@ let b:did_ftplugin = 1
let s:save_cpo = &cpo
set cpo&vim
-setlocal commentstring=<!--%s-->
+setlocal commentstring=<!--\ %s\ -->
" Remove the middlepart from the comments section, as this causes problems:
" https://groups.google.com/d/msg/vim_dev/x4GT-nqa0Kg/jvtRnEbtAnMJ
setlocal comments=s:<!--,e:-->
diff --git a/runtime/ftplugin/xs.lua b/runtime/ftplugin/xs.lua
new file mode 100644
index 0000000000..89ab42ef54
--- /dev/null
+++ b/runtime/ftplugin/xs.lua
@@ -0,0 +1,3 @@
+vim.bo.commentstring = '// %s'
+
+vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<'
diff --git a/runtime/ftplugin/yacc.vim b/runtime/ftplugin/yacc.vim
new file mode 100644
index 0000000000..d95e1ee600
--- /dev/null
+++ b/runtime/ftplugin/yacc.vim
@@ -0,0 +1,16 @@
+" Vim filetype plugin
+" Language: Yacc
+" Maintainer: Riley Bruins <ribru17@gmail.com>
+" Last Change: 2024 Jul 06
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+" Set 'comments' to format dashed lists in comments.
+" Also include ///, used for Doxygen.
+setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:///,://
+setlocal commentstring=//\ %s
+
+let b:undo_ftplugin = 'setl com< cms<'
diff --git a/runtime/ftplugin/yaml.vim b/runtime/ftplugin/yaml.vim
index 8bfc45e4c8..4e12350c22 100644
--- a/runtime/ftplugin/yaml.vim
+++ b/runtime/ftplugin/yaml.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: YAML (YAML Ain't Markup Language)
" Previous Maintainer: Nikolai Weibull <now@bitwi.se> (inactive)
-" Last Change: 2020 Mar 02
+" Last Change: 2024 Oct 04
if exists("b:did_ftplugin")
finish
@@ -18,7 +18,10 @@ setlocal formatoptions-=t formatoptions+=croql
" rime input method engine uses `*.custom.yaml` as its config files
if expand('%:r:e') ==# 'custom'
- compiler rime_deployer
+ if !exists('current_compiler')
+ compiler rime_deployer
+ let b:undo_ftplugin ..= "| compiler make"
+ endif
setlocal include=__include:\\s*
let b:undo_ftplugin ..= " inc<"
endif
diff --git a/runtime/ftplugin/zig.vim b/runtime/ftplugin/zig.vim
index ea229b6a49..ea584ed086 100644
--- a/runtime/ftplugin/zig.vim
+++ b/runtime/ftplugin/zig.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Zig
" Maintainer: Mathias Lindgren <math.lindgren@gmail.com>
-" Last Change: 2024 May 21
+" Last Change: 2024 Oct 04
" Based on: https://github.com/ziglang/zig.vim
if exists("b:did_ftplugin")
@@ -13,8 +13,6 @@ let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo&vim
-compiler zig_build
-
" Match Zig builtin fns
setlocal iskeyword+=@-@
setlocal formatoptions-=t formatoptions+=croql
@@ -47,6 +45,11 @@ if exists('g:zig_std_dir')
let b:undo_ftplugin .= ' | setl pa<'
endif
+if !exists('current_compiler')
+ compiler zig_build
+ let b:undo_ftplugin .= "| compiler make"
+endif
+
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: tabstop=8 shiftwidth=4 softtabstop=4 expandtab
diff --git a/runtime/ftplugin/zsh.vim b/runtime/ftplugin/zsh.vim
index aee890024f..5d4f4fe256 100644
--- a/runtime/ftplugin/zsh.vim
+++ b/runtime/ftplugin/zsh.vim
@@ -2,7 +2,7 @@
" Language: Zsh shell script
" Maintainer: Christian Brabandt <cb@256bit.org>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2024 May 06 by Vim Project (MANPAGER=)
+" Latest Revision: 2024 Sep 19
" License: Vim (see :h license)
" Repository: https://github.com/chrisbra/vim-zsh
@@ -19,18 +19,18 @@ setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql
let b:undo_ftplugin = "setl com< cms< fo< "
if executable('zsh') && &shell !~# '/\%(nologin\|false\)$'
- if !has('gui_running') && executable('less')
- command! -buffer -nargs=1 ZshKeywordPrg silent exe '!MANPAGER= zsh -c "autoload -Uz run-help; run-help <args> 2>/dev/null | LESS= less"' | redraw!
- elseif has('terminal')
+ if exists(':terminal') == 2
command! -buffer -nargs=1 ZshKeywordPrg silent exe ':term zsh -c "autoload -Uz run-help; run-help <args>"'
else
command! -buffer -nargs=1 ZshKeywordPrg echo system('MANPAGER= zsh -c "autoload -Uz run-help; run-help <args> 2>/dev/null"')
endif
+ setlocal keywordprg=:ZshKeywordPrg
+ let b:undo_ftplugin .= '| setl keywordprg< | sil! delc -buffer ZshKeywordPrg'
+
if !exists('current_compiler')
compiler zsh
endif
- setlocal keywordprg=:ZshKeywordPrg
- let b:undo_ftplugin .= 'keywordprg< | sil! delc -buffer ZshKeywordPrg'
+ let b:undo_ftplugin .= ' | compiler make'
endif
let b:match_words = '\<if\>:\<elif\>:\<else\>:\<fi\>'
diff --git a/runtime/indent/asm.vim b/runtime/indent/asm.vim
deleted file mode 100644
index 054612b9d6..0000000000
--- a/runtime/indent/asm.vim
+++ /dev/null
@@ -1,29 +0,0 @@
-" Vim indent file
-" Language: asm
-" Maintainer: Philip Jones <philj56@gmail.com>
-" Upstream: https://github.com/philj56/vim-asm-indent
-" Last Change: 2017-Jul-01
-" 2024 Apr 25 by Vim Project (undo_indent)
-
-if exists("b:did_indent")
- finish
-endif
-let b:did_indent = 1
-
-setlocal indentexpr=s:getAsmIndent()
-setlocal indentkeys=<:>,!^F,o,O
-
-let b:undo_indent = "setlocal indentexpr< indentkeys<"
-
-function! s:getAsmIndent()
- let line = getline(v:lnum)
- let ind = shiftwidth()
-
- " If the line is a label (starts with ':' terminated keyword),
- " then don't indent
- if line =~ '^\s*\k\+:'
- let ind = 0
- endif
-
- return ind
-endfunction
diff --git a/runtime/indent/glsl.vim b/runtime/indent/glsl.vim
new file mode 100644
index 0000000000..4ebee60656
--- /dev/null
+++ b/runtime/indent/glsl.vim
@@ -0,0 +1,14 @@
+" Language: OpenGL Shading Language
+" Maintainer: Gregory Anders <greg@gpanders.com>
+" Last Modified: 2024 Jul 21
+" Upstream: https://github.com/tikhomirov/vim-glsl
+
+if exists('b:did_indent')
+ finish
+endif
+let b:did_indent = 1
+
+setlocal autoindent cindent
+setlocal cinoptions&
+
+let b:undo_indent = 'setl ai< ci< cino<'
diff --git a/runtime/indent/hare.vim b/runtime/indent/hare.vim
index 0a9d8dafd8..1b51d1e80a 100644
--- a/runtime/indent/hare.vim
+++ b/runtime/indent/hare.vim
@@ -1,19 +1,16 @@
" Vim indent file
-" Language: Hare
-" Maintainer: Amelia Clarke <me@rsaihe.dev>
-" Last Change: 2022 Sep 22
-" 2023 Aug 28 by Vim Project (undo_indent)
+" Language: Hare
+" Maintainer: Amelia Clarke <selene@perilune.dev>
+" Last Change: 2024-04-14
+" Upstream: https://git.sr.ht/~sircmpwn/hare.vim
-if exists("b:did_indent")
+if exists('b:did_indent')
finish
endif
let b:did_indent = 1
-if !has("cindent") || !has("eval")
- finish
-endif
-
-setlocal cindent
+let s:cpo_save = &cpo
+set cpo&vim
" L0 -> don't deindent labels
" (s -> use one indent after a trailing (
@@ -41,7 +38,11 @@ setlocal cinwords=if,else,for,switch,match
setlocal indentexpr=GetHareIndent()
-let b:undo_indent = "setl cin< cino< cinw< inde< indk<"
+let b:undo_indent = 'setl cino< cinw< inde< indk<'
+
+if exists('*GetHareIndent()')
+ finish
+endif
function! FloorCindent(lnum)
return cindent(a:lnum) / shiftwidth() * shiftwidth()
@@ -122,7 +123,8 @@ function! GetHareIndent()
" Indent the body of a case.
" If the previous line ended in a semicolon and the line before that was a
" case, don't do any special indenting.
- if prevline =~# '\v;\s*(//.*)?$' && prevprevline =~# '\v\=\>\s*(//.*)?$' && line !~# '\v^\s*}'
+ if prevline =~# '\v;\s*(//.*)?$' && prevprevline =~# '\v\=\>\s*(//.*)?$'
+ \ && line !~# '\v^\s*}'
return indent(prevlnum)
endif
@@ -138,4 +140,7 @@ function! GetHareIndent()
return l:indent
endfunction
-" vim: tabstop=2 shiftwidth=2 expandtab
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: et sw=2 sts=2 ts=8
diff --git a/runtime/indent/hcl.vim b/runtime/indent/hcl.vim
new file mode 100644
index 0000000000..b13d2c5649
--- /dev/null
+++ b/runtime/indent/hcl.vim
@@ -0,0 +1,16 @@
+" Vim indent file
+" Language: HCL
+" Maintainer: Gregory Anders
+" Upstream: https://github.com/hashivim/vim-terraform
+" Last Change: 2024-09-03
+
+if exists('b:did_indent')
+ finish
+endif
+let b:did_indent = 1
+
+setlocal autoindent shiftwidth=2 tabstop=2 softtabstop=2 expandtab
+setlocal indentexpr=hcl#indentexpr(v:lnum)
+setlocal indentkeys+=<:>,0=},0=)
+
+let b:undo_indent = 'setlocal ai< sw< ts< sts< et< inde< indk<'
diff --git a/runtime/indent/kdl.vim b/runtime/indent/kdl.vim
new file mode 100644
index 0000000000..b0a6bd90d9
--- /dev/null
+++ b/runtime/indent/kdl.vim
@@ -0,0 +1,30 @@
+" Vim indent file
+" Language: KDL
+" Author: Aram Drevekenin <aram@poor.dev>
+" Maintainer: Yinzuo Jiang <jiangyinzuo@foxmail.com>
+" Last Change: 2024-06-16
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+setlocal indentexpr=KdlIndent()
+let b:undo_indent = "setlocal indentexpr<"
+
+function! KdlIndent(...)
+ let line = substitute(getline(v:lnum), '//.*$', '', '')
+ let previousNum = prevnonblank(v:lnum - 1)
+ let previous = substitute(getline(previousNum), '//.*$', '', '')
+
+ let l:indent = indent(previousNum)
+ if previous =~ "{" && previous !~ "}"
+ let l:indent += shiftwidth()
+ endif
+ if line =~ "}" && line !~ "{"
+ let l:indent -= shiftwidth()
+ endif
+ return l:indent
+endfunction
+" vim: sw=2 sts=2 et
diff --git a/runtime/indent/lua.vim b/runtime/indent/lua.vim
index 35b08d4037..ce6cfe18cd 100644
--- a/runtime/indent/lua.vim
+++ b/runtime/indent/lua.vim
@@ -4,6 +4,7 @@
" First Author: Max Ischenko <mfi 'at' ukr.net>
" Last Change: 2017 Jun 13
" 2022 Sep 07: b:undo_indent added by Doug Kearns
+" 2024 Jul 27: by Vim project: match '(', ')' in function GetLuaIndentIntern()
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -46,12 +47,12 @@ function! GetLuaIndentIntern()
endif
" Add a 'shiftwidth' after lines that start a block:
- " 'function', 'if', 'for', 'while', 'repeat', 'else', 'elseif', '{'
+ " 'function', 'if', 'for', 'while', 'repeat', 'else', 'elseif', '{', '('
let ind = indent(prevlnum)
let prevline = getline(prevlnum)
let midx = match(prevline, '^\s*\%(if\>\|for\>\|while\>\|repeat\>\|else\>\|elseif\>\|do\>\|then\>\)')
if midx == -1
- let midx = match(prevline, '{\s*\%(--\%([^[].*\)\?\)\?$')
+ let midx = match(prevline, '\%({\|(\)\s*\%(--\%([^[].*\)\?\)\?$')
if midx == -1
let midx = match(prevline, '\<function\>\s*\%(\k\|[.:]\)\{-}\s*(')
endif
@@ -65,9 +66,9 @@ function! GetLuaIndentIntern()
endif
endif
- " Subtract a 'shiftwidth' on end, else, elseif, until and '}'
+ " Subtract a 'shiftwidth' on end, else, elseif, until, '}' and ')'
" This is the part that requires 'indentkeys'.
- let midx = match(getline(v:lnum), '^\s*\%(end\>\|else\>\|elseif\>\|until\>\|}\)')
+ let midx = match(getline(v:lnum), '^\s*\%(end\>\|else\>\|elseif\>\|until\>\|}\|)\)')
if midx != -1 && synIDattr(synID(v:lnum, midx + 1, 1), "name") != "luaComment"
let ind = ind - shiftwidth()
endif
diff --git a/runtime/indent/mojo.vim b/runtime/indent/mojo.vim
new file mode 100644
index 0000000000..9b6a7d4c58
--- /dev/null
+++ b/runtime/indent/mojo.vim
@@ -0,0 +1,6 @@
+" Vim indent file
+" Language: Mojo
+" Maintainer: Riley Bruins <ribru17@gmail.com>
+" Last Change: 2024 Jul 07
+
+runtime! indent/python.vim
diff --git a/runtime/indent/ocaml.vim b/runtime/indent/ocaml.vim
index c9beb8be0b..d137796e3d 100644
--- a/runtime/indent/ocaml.vim
+++ b/runtime/indent/ocaml.vim
@@ -4,8 +4,7 @@
" Mike Leary <leary@nwlink.com>
" Markus Mottl <markus.mottl@gmail.com>
" URL: https://github.com/ocaml/vim-ocaml
-" Last Change: 2023 Aug 28 - Add undo_indent (Vim Project)
-" 2017 Jun 13
+" Last Change: 2017 Jun 13
" 2005 Jun 25 - Fixed multiple bugs due to 'else\nreturn ind' working
" 2005 May 09 - Added an option to not indent OCaml-indents specially (MM)
" 2013 June - commented textwidth (Marc Weber)
@@ -36,6 +35,7 @@ if !exists("no_ocaml_comments")
setlocal comments=sr:(*\ ,mb:\ ,ex:*)
setlocal comments^=sr:(**,mb:\ \ ,ex:*)
setlocal fo=cqort
+ let b:undo_indent .= " | setl com< fo<"
endif
endif
diff --git a/runtime/indent/proto.vim b/runtime/indent/proto.vim
new file mode 100644
index 0000000000..743f14094b
--- /dev/null
+++ b/runtime/indent/proto.vim
@@ -0,0 +1,19 @@
+" Vim indent file
+" Language: Protobuf
+" Maintainer: David Pedersen <limero@me.com>
+" Last Change: 2024 Aug 07
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+" Protobuf is like indenting C
+setlocal cindent
+setlocal expandtab
+setlocal shiftwidth=2
+
+let b:undo_indent = "setlocal cindent< expandtab< shiftwidth<"
+
+" vim: sw=2 sts=2 et
diff --git a/runtime/indent/query.lua b/runtime/indent/query.lua
index 3261376d87..c5b4f1f03d 100644
--- a/runtime/indent/query.lua
+++ b/runtime/indent/query.lua
@@ -1,6 +1,6 @@
-- Neovim indent file
-- Language: Treesitter query
--- Last Change: 2022 Mar 29
+-- Last Change: 2024 Jul 03
-- it's a lisp!
-vim.cmd([[ runtime! indent/lisp.vim ]])
+vim.cmd([[runtime! indent/lisp.vim]])
diff --git a/runtime/indent/rust.vim b/runtime/indent/rust.vim
index 7c055ec739..a96650d419 100644
--- a/runtime/indent/rust.vim
+++ b/runtime/indent/rust.vim
@@ -2,7 +2,10 @@
" Language: Rust
" Author: Chris Morgan <me@chrismorgan.info>
" Last Change: 2023-09-11
+" 2024 Jul 04 by Vim Project: use shiftwidth() instead of hard-coding shifted values (#15138)
+
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
+" Note: upstream seems umaintained: https://github.com/rust-lang/rust.vim/issues/502
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -179,7 +182,7 @@ function GetRustIndent(lnum)
" A standalone 'where' adds a shift.
let l:standalone_prevline_where = prevline =~# '\V\^\s\*where\s\*\$'
if l:standalone_prevline_where
- return indent(prevlinenum) + 4
+ return indent(prevlinenum) + shiftwidth()
endif
" Handle where clauses nicely: subsequent values should line up nicely.
@@ -197,7 +200,7 @@ function GetRustIndent(lnum)
let l:scope_start = searchpair('{\|(', '', '}\|)', 'nbW',
\ 's:is_string_comment(line("."), col("."))')
if l:scope_start != 0 && l:scope_start < a:lnum
- return indent(l:scope_start) + 4
+ return indent(l:scope_start) + shiftwidth()
endif
endif
@@ -268,7 +271,7 @@ function GetRustIndent(lnum)
" It's the closing line, dedent it
return 0
else
- return &shiftwidth
+ return shiftwidth()
endif
endif
endif
diff --git a/runtime/indent/scheme.vim b/runtime/indent/scheme.vim
index 496da3267d..888659b1de 100644
--- a/runtime/indent/scheme.vim
+++ b/runtime/indent/scheme.vim
@@ -1,9 +1,10 @@
" Vim indent file
-" Language: Scheme
-" Last Change: 2018 Jan 31
-" Maintainer: Evan Hanson <evhan@foldling.org>
+" Language: Scheme
+" Last Change: 2024 Jun 21
+" Maintainer: Evan Hanson <evhan@foldling.org>
" Previous Maintainer: Sergey Khorev <sergey.khorev@gmail.com>
-" URL: https://foldling.org/vim/indent/scheme.vim
+" Repository: https://git.foldling.org/vim-scheme.git
+" URL: https://foldling.org/vim/indent/scheme.vim
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
diff --git a/runtime/indent/terraform.vim b/runtime/indent/terraform.vim
new file mode 100644
index 0000000000..d62813d6a2
--- /dev/null
+++ b/runtime/indent/terraform.vim
@@ -0,0 +1,11 @@
+" Vim indent file
+" Language: Terraform
+" Maintainer: Gregory Anders
+" Upstream: https://github.com/hashivim/vim-terraform
+" Last Change: 2024-09-03
+
+if exists('b:did_indent')
+ finish
+endif
+
+runtime! indent/hcl.vim
diff --git a/runtime/indent/testdir/lua.in b/runtime/indent/testdir/lua.in
new file mode 100644
index 0000000000..c8f5d2bb8d
--- /dev/null
+++ b/runtime/indent/testdir/lua.in
@@ -0,0 +1,19 @@
+-- vim: set ft=lua sw=2 noet:
+
+-- START_INDENT
+function foo(a, b, c, d)
+ return { a, b, c, d }
+end
+
+local a = foo(
+1,
+2,
+"longxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
+4
+)
+
+local b = {
+1,
+ 2,
+}
+-- END_INDENT
diff --git a/runtime/indent/testdir/lua.ok b/runtime/indent/testdir/lua.ok
new file mode 100644
index 0000000000..95f9873beb
--- /dev/null
+++ b/runtime/indent/testdir/lua.ok
@@ -0,0 +1,19 @@
+-- vim: set ft=lua sw=2 noet:
+
+-- START_INDENT
+function foo(a, b, c, d)
+ return { a, b, c, d }
+end
+
+local a = foo(
+ 1,
+ 2,
+ "longxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
+ 4
+)
+
+local b = {
+ 1,
+ 2,
+}
+-- END_INDENT
diff --git a/runtime/indent/testdir/thrift.in b/runtime/indent/testdir/thrift.in
new file mode 100644
index 0000000000..7490dc8d30
--- /dev/null
+++ b/runtime/indent/testdir/thrift.in
@@ -0,0 +1,38 @@
+// vim: set ft=thrift sw=4 et:
+
+# START_INDENT
+namespace cpp foo
+namespace java com.foo.thrift
+
+include "Status.thrift"
+
+// These are supporting structs for JniFrontend.java, which serves as the glue
+// between our C++ execution environment and the Java frontend.
+
+struct TSetSessionParams {
+ 1: required string user
+}
+
+struct TAuthenticateParams {
+ 1: required string user
+ 2: required string passwd
+ 3: optional string host
+4: optional string db_name
+ 5: optional list<string> table_names;
+}
+
+/* {
+ * xxxx
+ * }
+ */
+// TColumnDesc
+struct TColumnDesc {
+ // {
+4: optional string tableName
+5: optional string columnDefault
+ // Let FE control the type, which makes it easier to modify and display complex types
+6: optional string columnTypeStr // deprecated
+7: optional string dataType
+ // }
+}
+# END_INDENT
diff --git a/runtime/indent/testdir/thrift.ok b/runtime/indent/testdir/thrift.ok
new file mode 100644
index 0000000000..9e2a48242b
--- /dev/null
+++ b/runtime/indent/testdir/thrift.ok
@@ -0,0 +1,38 @@
+// vim: set ft=thrift sw=4 et:
+
+# START_INDENT
+namespace cpp foo
+namespace java com.foo.thrift
+
+include "Status.thrift"
+
+// These are supporting structs for JniFrontend.java, which serves as the glue
+// between our C++ execution environment and the Java frontend.
+
+struct TSetSessionParams {
+ 1: required string user
+}
+
+struct TAuthenticateParams {
+ 1: required string user
+ 2: required string passwd
+ 3: optional string host
+ 4: optional string db_name
+ 5: optional list<string> table_names;
+}
+
+/* {
+ * xxxx
+ * }
+ */
+// TColumnDesc
+struct TColumnDesc {
+ // {
+ 4: optional string tableName
+ 5: optional string columnDefault
+ // Let FE control the type, which makes it easier to modify and display complex types
+ 6: optional string columnTypeStr // deprecated
+ 7: optional string dataType
+ // }
+}
+# END_INDENT
diff --git a/runtime/indent/thrift.vim b/runtime/indent/thrift.vim
new file mode 100644
index 0000000000..e0860e12a2
--- /dev/null
+++ b/runtime/indent/thrift.vim
@@ -0,0 +1,74 @@
+" Vim indent file
+" Language: Apache Thrift
+" Maintainer: Yinzuo Jiang <jiangyinzuo@foxmail.com>
+" Last Change: 2024/07/29
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
+
+setlocal cindent
+setlocal indentexpr=GetThriftIndent()
+
+let b:undo_indent = "set cindent< indentexpr<"
+
+" Only define the function once.
+if exists("*GetThriftIndent")
+ finish
+endif
+
+let s:keepcpo= &cpo
+set cpo&vim
+
+function! SkipThriftBlanksAndComments(startline)
+ let lnum = a:startline
+ while lnum > 1
+ let lnum = prevnonblank(lnum)
+ if getline(lnum) =~ '\*/\s*$'
+ while getline(lnum) !~ '/\*' && lnum > 1
+ let lnum = lnum - 1
+ endwhile
+ if getline(lnum) =~ '^\s*/\*'
+ let lnum = lnum - 1
+ else
+ break
+ endif
+ elseif getline(lnum) =~ '^\s*\(//\|#\)'
+ let lnum = lnum - 1
+ else
+ break
+ endif
+ endwhile
+ return lnum
+endfunction
+
+function GetThriftIndent()
+ " Thrift is just like C; use the built-in C indenting and then correct a few
+ " specific cases.
+ let theIndent = cindent(v:lnum)
+
+ " If we're in the middle of a comment then just trust cindent
+ if getline(v:lnum) =~ '^\s*\*'
+ return theIndent
+ endif
+
+ let line = substitute(getline(v:lnum), '\(//\|#\).*$', '', '')
+ let previousNum = SkipThriftBlanksAndComments(v:lnum - 1)
+ let previous = substitute(getline(previousNum), '\(//\|#\).*$', '', '')
+
+ let l:indent = indent(previousNum)
+ if previous =~ "{" && previous !~ "}"
+ let l:indent += shiftwidth()
+ endif
+ if line =~ "}" && line !~ "{"
+ let l:indent -= shiftwidth()
+ endif
+ return l:indent
+endfunction
+
+let &cpo = s:keepcpo
+unlet s:keepcpo
+
+" vim: sw=2 sts=2 et
diff --git a/runtime/indent/typst.vim b/runtime/indent/typst.vim
new file mode 100644
index 0000000000..6aaa04a53a
--- /dev/null
+++ b/runtime/indent/typst.vim
@@ -0,0 +1,18 @@
+" Vim indent file
+" Language: Typst
+" Maintainer: Gregory Anders <greg@gpanders.com>
+" Last Change: 2024-07-14
+" Based on: https://github.com/kaarmu/typst.vim
+
+if exists('b:did_indent')
+ finish
+endif
+let b:did_indent = 1
+
+setlocal expandtab
+setlocal softtabstop=2
+setlocal shiftwidth=2
+setlocal autoindent
+setlocal indentexpr=typst#indentexpr()
+
+let b:undo_indent = 'setl et< sts< sw< ai< inde<'
diff --git a/runtime/indent/yaml.vim b/runtime/indent/yaml.vim
index e5daf9f219..c38712745d 100644
--- a/runtime/indent/yaml.vim
+++ b/runtime/indent/yaml.vim
@@ -3,7 +3,8 @@
" 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)
+" 2024 Feb 29 by Vim project: disable mulitline indent by default
+" 2024 Aug 14 by Vim project: fix re-indenting when commenting out lines
" Only load this indent file when no other was loaded.
if exists('b:did_indent')
@@ -13,7 +14,7 @@ endif
let b:did_indent = 1
setlocal indentexpr=GetYAMLIndent(v:lnum)
-setlocal indentkeys=!^F,o,O,0#,0},0],<:>,0-
+setlocal indentkeys=!^F,o,O,0},0],<:>,0-
setlocal nosmartindent
let b:undo_indent = 'setlocal indentexpr< indentkeys< smartindent<'
diff --git a/runtime/keymap/georgian-qwerty.vim b/runtime/keymap/georgian-qwerty.vim
new file mode 100644
index 0000000000..df18729f06
--- /dev/null
+++ b/runtime/keymap/georgian-qwerty.vim
@@ -0,0 +1,51 @@
+" Vim keymap file for Georgian (Mkhedruli) layout
+" Maintainer: Mishiko Okropiridze <misho.okropiridze@gmail.com>
+" Last changed: 2024-06-14
+
+
+let b:keymap_name = "ge"
+
+loadkeymap
+a áƒ
+A áƒ
+b ბ
+c ც
+C ჩ
+d დ
+e ე
+E ე
+f ფ
+F ფ
+g გ
+G გ
+h ჰ
+H ჵ
+i ი
+I ი
+j ჯ
+J ჟ
+k კ
+l ლ
+m მ
+n ნ
+o áƒ
+p პ
+q ქ
+Q ქ
+r რ
+R ღ
+s ს
+S შ
+t ტ
+T თ
+u უ
+v ვ
+V ვ
+w წ
+W ჭ
+x ხ
+X ხ
+y ყ
+Y ყ
+z ზ
+Z ძ
diff --git a/runtime/lua/editorconfig.lua b/runtime/lua/editorconfig.lua
index dcd7425c29..e65d267a70 100644
--- a/runtime/lua/editorconfig.lua
+++ b/runtime/lua/editorconfig.lua
@@ -190,6 +190,27 @@ function properties.insert_final_newline(bufnr, val)
end
end
+--- A code of the format ss or ss-TT, where ss is an ISO 639 language code and TT is an ISO 3166 territory identifier.
+--- Sets the 'spelllang' option.
+function properties.spelling_language(bufnr, val)
+ local error_msg =
+ 'spelling_language must be of the format ss or ss-TT, where ss is an ISO 639 language code and TT is an ISO 3166 territory identifier.'
+
+ assert(val:len() == 2 or val:len() == 5, error_msg)
+
+ local language_code = val:sub(1, 2):lower()
+ assert(language_code:match('%l%l'), error_msg)
+ if val:len() == 2 then
+ vim.bo[bufnr].spelllang = language_code
+ else
+ assert(val:sub(3, 3) == '-', error_msg)
+
+ local territory_code = val:sub(4, 5):lower()
+ assert(territory_code:match('%l%l'), error_msg)
+ vim.bo[bufnr].spelllang = language_code .. '_' .. territory_code
+ end
+end
+
--- @private
--- Modified version of [glob2regpat()] that does not match path separators on `*`.
---
diff --git a/runtime/lua/man.lua b/runtime/lua/man.lua
index 02e841030f..fce8f89be8 100644
--- a/runtime/lua/man.lua
+++ b/runtime/lua/man.lua
@@ -35,7 +35,7 @@ local function highlight_line(line, linenr)
---@type string[]
local chars = {}
local prev_char = ''
- local overstrike, escape = false, false
+ local overstrike, escape, osc8 = false, false, false
---@type table<integer,{attr:integer,start:integer,final:integer}>
local hls = {} -- Store highlight groups as { attr, start, final }
@@ -139,6 +139,12 @@ local function highlight_line(line, linenr)
prev_char = ''
byte = byte + #char
chars[#chars + 1] = char
+ elseif osc8 then
+ -- eat characters until String Terminator or bell
+ if (prev_char == '\027' and char == '\\') or char == '\a' then
+ osc8 = false
+ end
+ prev_char = char
elseif escape then
-- Use prev_char to store the escape sequence
prev_char = prev_char .. char
@@ -157,8 +163,11 @@ local function highlight_line(line, linenr)
add_attr_hl(match + 0) -- coerce to number
end
escape = false
- elseif not prev_char:match('^%[[\032-\063]*$') then
- -- Stop looking if this isn't a partial CSI sequence
+ elseif prev_char == ']8;' then
+ osc8 = true
+ escape = false
+ elseif not prev_char:match('^[][][\032-\063]*$') then
+ -- Stop looking if this isn't a partial CSI or OSC sequence
escape = false
end
elseif char == '\027' then
@@ -470,7 +479,13 @@ local function put_page(page)
-- XXX: nroff justifies text by filling it with whitespace. That interacts
-- badly with our use of $MANWIDTH=999. Hack around this by using a fixed
-- size for those whitespace regions.
- vim.cmd([[silent! keeppatterns keepjumps %s/\s\{199,}/\=repeat(' ', 10)/g]])
+ -- Use try/catch to avoid setting v:errmsg.
+ vim.cmd([[
+ try
+ keeppatterns keepjumps %s/\s\{199,}/\=repeat(' ', 10)/g
+ catch
+ endtry
+ ]])
vim.cmd('1') -- Move cursor to first line
highlight_man_page()
set_options()
@@ -708,7 +723,7 @@ function M.open_page(count, smods, args)
end
sect, name = extract_sect_and_name_path(path)
- local buf = fn.bufnr()
+ local buf = api.nvim_get_current_buf()
local save_tfu = vim.bo[buf].tagfunc
vim.bo[buf].tagfunc = "v:lua.require'man'.goto_tag"
@@ -724,7 +739,9 @@ function M.open_page(count, smods, args)
end
end)
- vim.bo[buf].tagfunc = save_tfu
+ if api.nvim_buf_is_valid(buf) then
+ vim.bo[buf].tagfunc = save_tfu
+ end
if not ok then
error(ret)
diff --git a/runtime/lua/tohtml.lua b/runtime/lua/tohtml.lua
index 505de720ba..ed42b28725 100644
--- a/runtime/lua/tohtml.lua
+++ b/runtime/lua/tohtml.lua
@@ -1,6 +1,6 @@
--- @brief
---<pre>help
----:TOhtml {file} *:TOhtml*
+---:[range]TOhtml {file} *:TOhtml*
---Converts the buffer shown in the current window to HTML, opens the generated
---HTML in a new split window, and saves its contents to {file}. If {file} is not
---given, a temporary file (created by |tempname()|) is used.
@@ -40,13 +40,14 @@
--- @field winid integer
--- @field bufnr integer
--- @field width integer
---- @field buflen integer
+--- @field start integer
+--- @field end_ integer
--- @class (private) vim.tohtml.styletable
--- @field [integer] vim.tohtml.line (integer: (1-index, exclusive))
--- @class (private) vim.tohtml.line
---- @field virt_lines {[integer]:{[1]:string,[2]:integer}[]}
+--- @field virt_lines {[integer]:[string,integer][]}
--- @field pre_text string[][]
--- @field hide? boolean
--- @field [integer] vim.tohtml.cell? (integer: (1-index, exclusive))
@@ -57,6 +58,24 @@
--- @field [3] any[][] virt_text
--- @field [4] any[][] overlay_text
+--- @type string[]
+local notifications = {}
+
+---@param msg string
+local function notify(msg)
+ if #notifications == 0 then
+ vim.schedule(function()
+ if #notifications > 1 then
+ vim.notify(('TOhtml: %s (+ %d more warnings)'):format(notifications[1], #notifications - 1))
+ elseif #notifications == 1 then
+ vim.notify('TOhtml: ' .. notifications[1])
+ end
+ notifications = {}
+ end)
+ end
+ table.insert(notifications, msg)
+end
+
local HIDE_ID = -1
-- stylua: ignore start
local cterm_8_to_hex={
@@ -168,6 +187,8 @@ local background_color_cache = nil
--- @type string?
local foreground_color_cache = nil
+local len = vim.api.nvim_strwidth
+
--- @see https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
--- @param color "background"|"foreground"|integer
--- @return string?
@@ -215,7 +236,7 @@ local function cterm_to_hex(colorstr)
if hex then
cterm_color_cache[color] = hex
else
- vim.notify_once("Info(TOhtml): Couldn't get terminal colors, using fallback")
+ notify("Couldn't get terminal colors, using fallback")
local t_Co = tonumber(vim.api.nvim_eval('&t_Co'))
if t_Co <= 8 then
cterm_color_cache = cterm_8_to_hex
@@ -241,7 +262,7 @@ local function get_background_color()
end
local hex = try_query_terminal_color('background')
if not hex or not hex:match('#%x%x%x%x%x%x') then
- vim.notify_once("Info(TOhtml): Couldn't get terminal background colors, using fallback")
+ notify("Couldn't get terminal background colors, using fallback")
hex = vim.o.background == 'light' and '#ffffff' or '#000000'
end
background_color_cache = hex
@@ -259,7 +280,7 @@ local function get_foreground_color()
end
local hex = try_query_terminal_color('foreground')
if not hex or not hex:match('#%x%x%x%x%x%x') then
- vim.notify_once("Info(TOhtml): Couldn't get terminal foreground colors, using fallback")
+ notify("Couldn't get terminal foreground colors, using fallback")
hex = vim.o.background == 'light' and '#000000' or '#ffffff'
end
foreground_color_cache = hex
@@ -292,9 +313,12 @@ local function style_line_insert_virt_text(style_line, col, val)
end
--- @param state vim.tohtml.state
---- @param hl string|integer|nil
+--- @param hl string|integer|string[]|integer[]?
--- @return nil|integer
local function register_hl(state, hl)
+ if type(hl) == 'table' then
+ hl = hl[#hl]
+ end
if type(hl) == 'nil' then
return
elseif type(hl) == 'string' then
@@ -370,7 +394,7 @@ end
--- @param state vim.tohtml.state
local function styletable_syntax(state)
- for row = 1, state.buflen do
+ for row = state.start, state.end_ do
local prev_id = 0
local prev_col = nil
for col = 1, #vim.fn.getline(row) + 1 do
@@ -390,7 +414,7 @@ end
--- @param state vim.tohtml.state
local function styletable_diff(state)
local styletable = state.style
- for row = 1, state.buflen do
+ for row = state.start, state.end_ do
local style_line = styletable[row]
local filler = vim.fn.diff_filler(row)
if filler ~= 0 then
@@ -400,7 +424,7 @@ local function styletable_diff(state)
{ { fill:rep(state.width), register_hl(state, 'DiffDelete') } }
)
end
- if row == state.buflen + 1 then
+ if row == state.end_ + 1 then
break
end
local prev_id = 0
@@ -442,7 +466,9 @@ local function styletable_treesitter(state)
if not query then
return
end
- for capture, node, metadata in query:iter_captures(root, buf_highlighter.bufnr, 0, state.buflen) do
+ for capture, node, metadata in
+ query:iter_captures(root, buf_highlighter.bufnr, state.start - 1, state.end_)
+ do
local srow, scol, erow, ecol = node:range()
--- @diagnostic disable-next-line: invisible
local c = q._query.captures[capture]
@@ -458,7 +484,7 @@ local function styletable_treesitter(state)
end
--- @param state vim.tohtml.state
---- @param extmark {[1]:integer,[2]:integer,[3]:integer,[4]:vim.api.keyset.set_extmark|any}
+--- @param extmark [integer, integer, integer, 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
@@ -467,7 +493,7 @@ local function _styletable_extmarks_highlight(state, extmark, namespaces)
---TODO(altermo) LSP semantic tokens (and some other extmarks) are only
---generated in visible lines, and not in the whole buffer.
if (namespaces[extmark[4].ns_id] or ''):find('vim_lsp_semantic_tokens') then
- vim.notify_once('Info(TOhtml): lsp semantic tokens are not supported, HTML may be incorrect')
+ notify('lsp semantic tokens are not supported, HTML may be incorrect')
return
end
local srow, scol, erow, ecol =
@@ -480,18 +506,28 @@ local function _styletable_extmarks_highlight(state, extmark, namespaces)
end
--- @param state vim.tohtml.state
---- @param extmark {[1]:integer,[2]:integer,[3]:integer,[4]:vim.api.keyset.set_extmark|any}
-local function _styletable_extmarks_virt_text(state, extmark)
+--- @param extmark [integer, integer, integer, vim.api.keyset.set_extmark|any]
+--- @param namespaces table<integer,string>
+local function _styletable_extmarks_virt_text(state, extmark, namespaces)
if not extmark[4].virt_text then
return
end
+ ---TODO(altermo) LSP semantic tokens (and some other extmarks) are only
+ ---generated in visible lines, and not in the whole buffer.
+ if (namespaces[extmark[4].ns_id] or ''):find('vim_lsp_inlayhint') then
+ notify('lsp inlay hints are not supported, HTML may be incorrect')
+ return
+ end
local styletable = state.style
--- @type integer,integer
local row, col = extmark[2], extmark[3]
if
- extmark[4].virt_text_pos == 'inline'
- or extmark[4].virt_text_pos == 'eol'
- or extmark[4].virt_text_pos == 'overlay'
+ row < vim.api.nvim_buf_line_count(state.bufnr)
+ and (
+ extmark[4].virt_text_pos == 'inline'
+ or extmark[4].virt_text_pos == 'eol'
+ or extmark[4].virt_text_pos == 'overlay'
+ )
then
if extmark[4].virt_text_pos == 'eol' then
style_line_insert_virt_text(styletable[row + 1], #vim.fn.getline(row + 1) + 1, { ' ' })
@@ -510,7 +546,7 @@ local function _styletable_extmarks_virt_text(state, extmark)
else
style_line_insert_virt_text(styletable[row + 1], col + 1, { i[1], hlid })
end
- virt_text_len = virt_text_len + #i[1]
+ virt_text_len = virt_text_len + len(i[1])
end
if extmark[4].virt_text_pos == 'overlay' then
styletable_insert_range(state, row + 1, col + 1, row + 1, col + virt_text_len + 1, HIDE_ID)
@@ -521,17 +557,15 @@ local function _styletable_extmarks_virt_text(state, extmark)
hl_mode = 'blend',
hl_group = 'combine',
}
- for opt, val in ipairs(not_supported) do
+ for opt, val in pairs(not_supported) do
if extmark[4][opt] == val then
- vim.notify_once(
- ('Info(TOhtml): extmark.%s="%s" is not supported, HTML may be incorrect'):format(opt, val)
- )
+ notify(('extmark.%s="%s" is not supported, HTML may be incorrect'):format(opt, val))
end
end
end
--- @param state vim.tohtml.state
---- @param extmark {[1]:integer,[2]:integer,[3]:integer,[4]:vim.api.keyset.set_extmark|any}
+--- @param extmark [integer, integer, integer, 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
@@ -552,7 +586,7 @@ local function _styletable_extmarks_virt_lines(state, extmark)
end
--- @param state vim.tohtml.state
---- @param extmark {[1]:integer,[2]:integer,[3]:integer,[4]:vim.api.keyset.set_extmark|any}
+--- @param extmark [integer, integer, integer, 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
@@ -586,7 +620,7 @@ local function styletable_extmarks(state)
_styletable_extmarks_conceal(state, v)
end
for _, v in ipairs(extmarks) do
- _styletable_extmarks_virt_text(state, v)
+ _styletable_extmarks_virt_text(state, v, namespaces)
end
for _, v in ipairs(extmarks) do
_styletable_extmarks_virt_lines(state, v)
@@ -597,7 +631,7 @@ end
local function styletable_folds(state)
local styletable = state.style
local has_folded = false
- for row = 1, state.buflen do
+ for row = state.start, state.end_ do
if vim.fn.foldclosed(row) > 0 then
has_folded = true
styletable[row].hide = true
@@ -611,18 +645,16 @@ local function styletable_folds(state)
end
end
if has_folded and type(({ pcall(vim.api.nvim_eval, vim.o.foldtext) })[2]) == 'table' then
- vim.notify_once(
- 'Info(TOhtml): foldtext returning a table is half supported, HTML may be incorrect'
- )
+ notify('foldtext returning a table with highlights is not supported, HTML may be incorrect')
end
end
--- @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}>
+ vim._with({ buf = bufnr }, function()
+ for row = state.start, state.end_ do
+ --- @type table<integer,[integer,integer,string]>
local conceals = {}
local line_len_exclusive = #vim.fn.getline(row) + 1
for col = 1, line_len_exclusive do
@@ -738,8 +770,8 @@ local function styletable_statuscolumn(state)
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
+ vim._with({ buf = state.bufnr }, function()
+ for row = state.start, state.end_ do
local foldlevel = vim.fn.foldlevel(row)
if foldlevel > maxfold then
maxfold = foldlevel
@@ -754,12 +786,12 @@ local function styletable_statuscolumn(state)
--- @type table<integer,any>
local statuses = {}
- for row = 1, state.buflen do
+ for row = state.start, state.end_ do
local status = vim.api.nvim_eval_statusline(
statuscolumn,
{ winid = state.winid, use_statuscol_lnum = row, highlights = true }
)
- local width = vim.api.nvim_strwidth(status.str)
+ local width = len(status.str)
if width > minwidth then
minwidth = width
end
@@ -774,7 +806,7 @@ local function styletable_statuscolumn(state)
for k, v in ipairs(hls) do
local text = str:sub(v.start + 1, hls[k + 1] and hls[k + 1].start or nil)
if k == #hls then
- text = text .. (' '):rep(minwidth - vim.api.nvim_strwidth(str))
+ text = text .. (' '):rep(minwidth - len(str))
end
if text ~= '' then
local hlid = register_hl(state, v.group)
@@ -794,7 +826,6 @@ local function styletable_listchars(state)
local function utf8_sub(str, i, j)
return vim.fn.strcharpart(str, i - 1, j and j - i + 1 or nil)
end
- local len = vim.api.nvim_strwidth
--- @type table<string,string>
local listchars = vim.opt_local.listchars:get()
local ids = setmetatable({}, {
@@ -805,7 +836,7 @@ local function styletable_listchars(state)
})
if listchars.eol then
- for row = 1, state.buflen do
+ for row = state.start, state.end_ do
local style_line = state.style[row]
style_line_insert_overlay_char(
style_line,
@@ -972,6 +1003,7 @@ local function extend_style(out, state)
--TODO(altermo) use local namespace (instead of global 0)
local fg = vim.fn.synIDattr(hlid, 'fg#')
local bg = vim.fn.synIDattr(hlid, 'bg#')
+ local sp = vim.fn.synIDattr(hlid, 'sp#')
local decor_line = {}
if vim.fn.synIDattr(hlid, 'underline') ~= '' then
table.insert(decor_line, 'underline')
@@ -989,6 +1021,8 @@ local function extend_style(out, state)
['font-weight'] = vim.fn.synIDattr(hlid, 'bold') ~= '' and 'bold' or nil,
['text-decoration-line'] = not vim.tbl_isempty(decor_line) and table.concat(decor_line, ' ')
or nil,
+ -- TODO(ribru17): fallback to displayed text color if sp not set
+ ['text-decoration-color'] = sp ~= '' and cterm_to_hex(sp) or nil,
--TODO(altermo) if strikethrough and undercurl then the strikethrough becomes wavy
['text-decoration-style'] = vim.fn.synIDattr(hlid, 'undercurl') ~= '' and 'wavy' or nil,
}
@@ -1099,16 +1133,22 @@ end
local function extend_pre(out, state)
local styletable = state.style
table.insert(out, '<pre>')
+ local out_start = #out
local hide_count = 0
--- @type integer[]
local stack = {}
+ local before = ''
+ local after = ''
local function loop(row)
+ local inside = row <= state.end_ and row >= state.start
local style_line = styletable[row]
if style_line.hide and (styletable[row - 1] or {}).hide then
return
end
- _extend_virt_lines(out, state, row)
+ if inside then
+ _extend_virt_lines(out, state, row)
+ end
--Possible improvement (altermo):
--Instead of looping over all the buffer characters per line,
--why not loop over all the style_line cells,
@@ -1118,8 +1158,16 @@ local function extend_pre(out, state)
end
local line = vim.api.nvim_buf_get_lines(state.bufnr, row - 1, row, false)[1] or ''
local s = ''
- s = s .. _pre_text_to_html(state, row)
- for col = 1, #line + 1 do
+ if inside then
+ s = s .. _pre_text_to_html(state, row)
+ end
+ local true_line_len = #line + 1
+ for k in pairs(style_line) do
+ if type(k) == 'number' and k > true_line_len then
+ true_line_len = k
+ end
+ end
+ for col = 1, true_line_len do
local cell = style_line[col]
--- @type table?
local char
@@ -1159,18 +1207,18 @@ local function extend_pre(out, state)
end
end
- if cell[3] then
+ if cell[3] and inside then
s = s .. _virt_text_to_html(state, cell)
end
char = cell[4][#cell[4]]
end
- if col == #line + 1 and not char then
+ if col == true_line_len and not char then
break
end
- if hide_count == 0 then
+ if hide_count == 0 and inside then
s = s
.. _char_to_html(
state,
@@ -1179,12 +1227,20 @@ local function extend_pre(out, state)
)
end
end
- table.insert(out, s)
+ if row > state.end_ + 1 then
+ after = after .. s
+ elseif row < state.start then
+ before = s .. before
+ else
+ table.insert(out, s)
+ end
end
- for row = 1, state.buflen + 1 do
+ for row = 1, vim.api.nvim_buf_line_count(state.bufnr) + 1 do
loop(row)
end
+ out[out_start] = out[out_start] .. before
+ out[#out] = out[#out] .. after
assert(#stack == 0, 'an open HTML tag was never closed')
table.insert(out, '</pre>')
end
@@ -1216,6 +1272,7 @@ local function global_state_to_state(winid, global_state)
if not width or width < 1 then
width = vim.api.nvim_win_get_width(winid)
end
+ local range = opt.range or { 1, vim.api.nvim_buf_line_count(bufnr) }
local state = setmetatable({
winid = winid == 0 and vim.api.nvim_get_current_win() or winid,
opt = vim.wo[winid],
@@ -1223,7 +1280,8 @@ local function global_state_to_state(winid, global_state)
bufnr = bufnr,
tabstop = (' '):rep(vim.bo[bufnr].tabstop),
width = width,
- buflen = vim.api.nvim_buf_line_count(bufnr),
+ start = range[1],
+ end_ = range[2],
}, { __index = global_state })
return state --[[@as vim.tohtml.state]]
end
@@ -1235,9 +1293,25 @@ local function opt_to_global_state(opt, title)
local fonts = {}
if opt.font then
fonts = type(opt.font) == 'string' and { opt.font } or opt.font --[[@as (string[])]]
+ for i, v in pairs(fonts) do
+ fonts[i] = ('"%s"'):format(v)
+ end
elseif vim.o.guifont:match('^[^:]+') then
- table.insert(fonts, vim.o.guifont:match('^[^:]+'))
+ -- Example:
+ -- Input: "Font,Escape\,comma, Ignore space after comma"
+ -- Output: { "Font","Escape,comma","Ignore space after comma" }
+ local prev = ''
+ for name in vim.gsplit(vim.o.guifont:match('^[^:]+'), ',', { trimempty = true }) do
+ if vim.endswith(name, '\\') then
+ prev = prev .. vim.trim(name:sub(1, -2) .. ',')
+ elseif vim.trim(name) ~= '' then
+ table.insert(fonts, ('"%s%s"'):format(prev, vim.trim(name)))
+ prev = ''
+ end
+ end
end
+ -- Generic family names (monospace here) must not be quoted
+ -- because the browser recognizes them as font families.
table.insert(fonts, 'monospace')
--- @type vim.tohtml.state.global
local state = {
@@ -1266,7 +1340,7 @@ local styletable_funcs = {
--- @param state vim.tohtml.state
local function state_generate_style(state)
- vim.api.nvim_win_call(state.winid, function()
+ vim._with({ win = state.winid }, function()
for _, fn in ipairs(styletable_funcs) do
--- @type string?
local cond
@@ -1282,35 +1356,22 @@ local function state_generate_style(state)
end)
end
---- @param winid integer[]|integer
+--- @param winid integer
--- @param opt? vim.tohtml.opt
--- @return string[]
local function win_to_html(winid, opt)
- if type(winid) == 'number' then
- winid = { winid }
- end
- --- @cast winid integer[]
- assert(#winid > 0, 'no window specified')
opt = opt or {}
- local title = table.concat(
- vim.tbl_map(vim.api.nvim_buf_get_name, vim.tbl_map(vim.api.nvim_win_get_buf, winid)),
- ','
- )
+ local title = vim.api.nvim_buf_get_name(vim.api.nvim_win_get_buf(winid))
+
local global_state = opt_to_global_state(opt, title)
- --- @type vim.tohtml.state[]
- local states = {}
- for _, i in ipairs(winid) do
- local state = global_state_to_state(i, global_state)
- state_generate_style(state)
- table.insert(states, state)
- end
+ local state = global_state_to_state(winid, global_state)
+ state_generate_style(state)
+
local html = {}
extend_html(html, function()
extend_head(html, global_state)
extend_body(html, function()
- for _, state in ipairs(states) do
- extend_pre(html, state)
- end
+ extend_pre(html, state)
end)
end)
return html
@@ -1337,6 +1398,10 @@ local M = {}
--- infinitely.
--- (default: 'textwidth' if non-zero or window width otherwise)
--- @field width? integer
+---
+--- Range of rows to use.
+--- (default: entire buffer)
+--- @field range? integer[]
--- Converts the buffer shown in the window {winid} to HTML and returns the output as a list of string.
--- @param winid? integer Window to convert (defaults to current window)
diff --git a/runtime/lua/vim/_comment.lua b/runtime/lua/vim/_comment.lua
index 044cd69716..de7f62632c 100644
--- a/runtime/lua/vim/_comment.lua
+++ b/runtime/lua/vim/_comment.lua
@@ -9,8 +9,8 @@
local function get_commentstring(ref_position)
local buf_cs = vim.bo.commentstring
- local has_ts_parser, ts_parser = pcall(vim.treesitter.get_parser)
- if not has_ts_parser then
+ local ts_parser = vim.treesitter.get_parser(0, '', { error = false })
+ if not ts_parser then
return buf_cs
end
@@ -194,14 +194,9 @@ local function toggle_lines(line_start, line_end, ref_position)
-- - Debatable for highlighting in text area (like LSP semantic tokens).
-- Mostly because it causes flicker as highlighting is preserved during
-- comment toggling.
- package.loaded['vim._comment']._lines = vim.tbl_map(f, lines)
- local lua_cmd = string.format(
- 'vim.api.nvim_buf_set_lines(0, %d, %d, false, package.loaded["vim._comment"]._lines)',
- line_start - 1,
- line_end
- )
- vim.cmd.lua({ lua_cmd, mods = { lockmarks = true } })
- package.loaded['vim._comment']._lines = nil
+ vim._with({ lockmarks = true }, function()
+ vim.api.nvim_buf_set_lines(0, line_start - 1, line_end, false, vim.tbl_map(f, lines))
+ end)
end
--- Operator which toggles user-supplied range of lines
diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua
index 5b964b84a0..6cad1dbca9 100644
--- a/runtime/lua/vim/_defaults.lua
+++ b/runtime/lua/vim/_defaults.lua
@@ -85,13 +85,13 @@ do
vim.keymap.set(
'x',
'Q',
- "mode() == 'V' ? ':normal! @<C-R>=reg_recorded()<CR><CR>' : 'Q'",
+ "mode() ==# 'V' ? ':normal! @<C-R>=reg_recorded()<CR><CR>' : 'Q'",
{ silent = true, expr = true, desc = ':help v_Q-default' }
)
vim.keymap.set(
'x',
'@',
- "mode() == 'V' ? ':normal! @'.getcharstr().'<CR>' : '@'",
+ "mode() ==# 'V' ? ':normal! @'.getcharstr().'<CR>' : '@'",
{ silent = true, expr = true, desc = ':help v_@-default' }
)
@@ -113,9 +113,11 @@ do
local gx_desc =
'Opens filepath or URI under cursor with the system handler (file explorer, web browser, …)'
vim.keymap.set({ 'n' }, 'gx', function()
- local err = do_open(require('vim.ui')._get_url())
- if err then
- vim.notify(err, vim.log.levels.ERROR)
+ for _, url in ipairs(require('vim.ui')._get_urls()) do
+ local err = do_open(url)
+ if err then
+ vim.notify(err, vim.log.levels.ERROR)
+ end
end
end, { desc = gx_desc })
vim.keymap.set({ 'x' }, 'gx', function()
@@ -180,12 +182,20 @@ do
--- See |[d-default|, |]d-default|, and |CTRL-W_d-default|.
do
vim.keymap.set('n', ']d', function()
- vim.diagnostic.goto_next({ float = false })
- end, { desc = 'Jump to the next diagnostic' })
+ vim.diagnostic.jump({ count = vim.v.count1 })
+ end, { desc = 'Jump to the next diagnostic in the current buffer' })
vim.keymap.set('n', '[d', function()
- vim.diagnostic.goto_prev({ float = false })
- end, { desc = 'Jump to the previous diagnostic' })
+ vim.diagnostic.jump({ count = -vim.v.count1 })
+ end, { desc = 'Jump to the previous diagnostic in the current buffer' })
+
+ vim.keymap.set('n', ']D', function()
+ vim.diagnostic.jump({ count = math.huge, wrap = false })
+ end, { desc = 'Jump to the last diagnostic in the current buffer' })
+
+ vim.keymap.set('n', '[D', function()
+ vim.diagnostic.jump({ count = -math.huge, wrap = false })
+ end, { desc = 'Jump to the first diagnostic in the current buffer' })
vim.keymap.set('n', '<C-W>d', function()
vim.diagnostic.open_float()
@@ -198,13 +208,187 @@ do
{ remap = true, desc = 'Show diagnostics under the cursor' }
)
end
+
+ --- vim-unimpaired style mappings. See: https://github.com/tpope/vim-unimpaired
+ do
+ -- Quickfix mappings
+ vim.keymap.set('n', '[q', function()
+ vim.cmd.cprevious({ count = vim.v.count1 })
+ end, {
+ desc = ':cprevious',
+ })
+
+ vim.keymap.set('n', ']q', function()
+ vim.cmd.cnext({ count = vim.v.count1 })
+ end, {
+ desc = ':cnext',
+ })
+
+ vim.keymap.set('n', '[Q', function()
+ vim.cmd.crewind({ count = vim.v.count ~= 0 and vim.v.count or nil })
+ end, {
+ desc = ':crewind',
+ })
+
+ vim.keymap.set('n', ']Q', function()
+ vim.cmd.clast({ count = vim.v.count ~= 0 and vim.v.count or nil })
+ end, {
+ desc = ':clast',
+ })
+
+ vim.keymap.set('n', '[<C-Q>', function()
+ vim.cmd.cpfile({ count = vim.v.count1 })
+ end, {
+ desc = ':cpfile',
+ })
+
+ vim.keymap.set('n', ']<C-Q>', function()
+ vim.cmd.cnfile({ count = vim.v.count1 })
+ end, {
+ desc = ':cnfile',
+ })
+
+ -- Location list mappings
+ vim.keymap.set('n', '[l', function()
+ vim.cmd.lprevious({ count = vim.v.count1 })
+ end, {
+ desc = ':lprevious',
+ })
+
+ vim.keymap.set('n', ']l', function()
+ vim.cmd.lnext({ count = vim.v.count1 })
+ end, {
+ desc = ':lnext',
+ })
+
+ vim.keymap.set('n', '[L', function()
+ vim.cmd.lrewind({ count = vim.v.count ~= 0 and vim.v.count or nil })
+ end, {
+ desc = ':lrewind',
+ })
+
+ vim.keymap.set('n', ']L', function()
+ vim.cmd.llast({ count = vim.v.count ~= 0 and vim.v.count or nil })
+ end, {
+ desc = ':llast',
+ })
+
+ vim.keymap.set('n', '[<C-L>', function()
+ vim.cmd.lpfile({ count = vim.v.count1 })
+ end, {
+ desc = ':lpfile',
+ })
+
+ vim.keymap.set('n', ']<C-L>', function()
+ vim.cmd.lnfile({ count = vim.v.count1 })
+ end, {
+ desc = ':lnfile',
+ })
+
+ -- Argument list
+ vim.keymap.set('n', '[a', function()
+ vim.cmd.previous({ count = vim.v.count1 })
+ end, {
+ desc = ':previous',
+ })
+
+ vim.keymap.set('n', ']a', function()
+ -- count doesn't work with :next, must use range. See #30641.
+ vim.cmd.next({ range = { vim.v.count1 } })
+ end, {
+ desc = ':next',
+ })
+
+ vim.keymap.set('n', '[A', function()
+ if vim.v.count ~= 0 then
+ vim.cmd.argument({ count = vim.v.count })
+ else
+ vim.cmd.rewind()
+ end
+ end, {
+ desc = ':rewind',
+ })
+
+ vim.keymap.set('n', ']A', function()
+ if vim.v.count ~= 0 then
+ vim.cmd.argument({ count = vim.v.count })
+ else
+ vim.cmd.last()
+ end
+ end, {
+ desc = ':last',
+ })
+
+ -- Tags
+ vim.keymap.set('n', '[t', function()
+ -- count doesn't work with :tprevious, must use range. See #30641.
+ vim.cmd.tprevious({ range = { vim.v.count1 } })
+ end, { desc = ':tprevious' })
+
+ vim.keymap.set('n', ']t', function()
+ -- count doesn't work with :tnext, must use range. See #30641.
+ vim.cmd.tnext({ range = { vim.v.count1 } })
+ end, { desc = ':tnext' })
+
+ vim.keymap.set('n', '[T', function()
+ -- count doesn't work with :trewind, must use range. See #30641.
+ vim.cmd.trewind({ range = vim.v.count ~= 0 and { vim.v.count } or nil })
+ end, { desc = ':trewind' })
+
+ vim.keymap.set('n', ']T', function()
+ -- :tlast does not accept a count, so use :trewind if count given
+ if vim.v.count ~= 0 then
+ vim.cmd.trewind({ range = { vim.v.count } })
+ else
+ vim.cmd.tlast()
+ end
+ end, { desc = ':tlast' })
+
+ vim.keymap.set('n', '[<C-T>', function()
+ -- count doesn't work with :ptprevious, must use range. See #30641.
+ vim.cmd.ptprevious({ range = { vim.v.count1 } })
+ end, { desc = ' :ptprevious' })
+
+ vim.keymap.set('n', ']<C-T>', function()
+ -- count doesn't work with :ptnext, must use range. See #30641.
+ vim.cmd.ptnext({ range = { vim.v.count1 } })
+ end, { desc = ':ptnext' })
+
+ -- Buffers
+ vim.keymap.set('n', '[b', function()
+ vim.cmd.bprevious({ count = vim.v.count1 })
+ end, { desc = ':bprevious' })
+
+ vim.keymap.set('n', ']b', function()
+ vim.cmd.bnext({ count = vim.v.count1 })
+ end, { desc = ':bnext' })
+
+ vim.keymap.set('n', '[B', function()
+ if vim.v.count ~= 0 then
+ vim.cmd.buffer({ count = vim.v.count })
+ else
+ vim.cmd.brewind()
+ end
+ end, { desc = ':brewind' })
+
+ vim.keymap.set('n', ']B', function()
+ if vim.v.count ~= 0 then
+ vim.cmd.buffer({ count = vim.v.count })
+ else
+ vim.cmd.blast()
+ end
+ end, { desc = ':blast' })
+ end
end
--- Default menus
do
--- Right click popup menu
- -- TODO VimScript, no l10n
vim.cmd([[
+ anoremenu PopUp.Go\ to\ definition <Cmd>lua vim.lsp.buf.definition()<CR>
+ amenu PopUp.Open\ in\ web\ browser gx
+ anoremenu PopUp.Inspect <Cmd>Inspect<CR>
+ anoremenu PopUp.-1- <Nop>
vnoremenu PopUp.Cut "+x
vnoremenu PopUp.Copy "+y
anoremenu PopUp.Paste "+gP
@@ -213,10 +397,36 @@ do
nnoremenu PopUp.Select\ All ggVG
vnoremenu PopUp.Select\ All gg0oG$
inoremenu PopUp.Select\ All <C-Home><C-O>VG
- anoremenu PopUp.Inspect <Cmd>Inspect<CR>
- anoremenu PopUp.-1- <Nop>
+ anoremenu PopUp.-2- <Nop>
anoremenu PopUp.How-to\ disable\ mouse <Cmd>help disable-mouse<CR>
]])
+
+ local function enable_ctx_menu(ctx)
+ vim.cmd([[
+ amenu disable PopUp.Go\ to\ definition
+ amenu disable PopUp.Open\ in\ web\ browser
+ ]])
+
+ if ctx == 'url' then
+ vim.cmd([[amenu enable PopUp.Open\ in\ web\ browser]])
+ elseif ctx == 'lsp' then
+ vim.cmd([[anoremenu enable PopUp.Go\ to\ definition]])
+ end
+ end
+
+ local nvim_popupmenu_augroup = vim.api.nvim_create_augroup('nvim_popupmenu', {})
+ vim.api.nvim_create_autocmd('MenuPopup', {
+ pattern = '*',
+ group = nvim_popupmenu_augroup,
+ desc = 'Mouse popup menu',
+ -- nested = true,
+ callback = function()
+ local urls = require('vim.ui')._get_urls()
+ local url = vim.startswith(urls[1], 'http')
+ local ctx = url and 'url' or (vim.lsp.get_clients({ bufnr = 0 })[1] and 'lsp' or nil)
+ enable_ctx_menu(ctx)
+ end,
+ })
end
--- Default autocommands. See |default-autocmds|
@@ -274,6 +484,26 @@ do
end,
})
+ vim.api.nvim_create_autocmd('TermOpen', {
+ group = nvim_terminal_augroup,
+ desc = 'Default settings for :terminal buffers',
+ callback = function()
+ vim.bo.modifiable = false
+ vim.bo.undolevels = -1
+ vim.bo.scrollback = vim.o.scrollback < 0 and 10000 or math.max(1, vim.o.scrollback)
+ vim.bo.textwidth = 0
+ vim.wo[0][0].wrap = false
+ vim.wo[0][0].list = false
+
+ -- This is gross. Proper list options support when?
+ local winhl = vim.o.winhighlight
+ if winhl ~= '' then
+ winhl = winhl .. ','
+ end
+ vim.wo[0][0].winhighlight = winhl .. 'StatusLine:StatusLineTerm,StatusLineNC:StatusLineTermNC'
+ end,
+ })
+
vim.api.nvim_create_autocmd('CmdwinEnter', {
pattern = '[:>]',
desc = 'Limit syntax sync to maxlines=1 in the command window',
@@ -462,10 +692,14 @@ do
--- response indicates that it does support truecolor enable 'termguicolors',
--- but only if the user has not already disabled it.
do
- if tty.rgb then
- -- The TUI was able to determine truecolor support
+ local colorterm = os.getenv('COLORTERM')
+ if tty.rgb or colorterm == 'truecolor' or colorterm == '24bit' then
+ -- The TUI was able to determine truecolor support or $COLORTERM explicitly indicates
+ -- truecolor support
setoption('termguicolors', true)
- else
+ elseif colorterm == nil or colorterm == '' then
+ -- Neither the TUI nor $COLORTERM indicate that truecolor is supported, so query the
+ -- terminal
local caps = {} ---@type table<string, boolean>
require('vim.termcap').query({ 'Tc', 'RGB', 'setrgbf', 'setrgbb' }, function(cap, found)
if not found then
diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua
index 5e9be509c8..2e829578a7 100644
--- a/runtime/lua/vim/_editor.lua
+++ b/runtime/lua/vim/_editor.lua
@@ -1,17 +1,19 @@
-- Nvim-Lua stdlib: the `vim` module (:help lua-stdlib)
--
--- Lua code lives in one of three places:
--- 1. runtime/lua/vim/ (the runtime): For "nice to have" features, e.g. the
--- `inspect` and `lpeg` modules.
--- 2. runtime/lua/vim/shared.lua: pure Lua functions which always
--- are available. Used in the test runner, as well as worker threads
--- and processes launched from Nvim.
--- 3. runtime/lua/vim/_editor.lua: Code which directly interacts with
--- the Nvim editor state. Only available in the main thread.
+-- Lua code lives in one of four places:
+-- 1. Plugins! Not everything needs to live on "vim.*". Plugins are the correct model for
+-- non-essential features which the user may want to disable or replace with a third-party
+-- plugin. Examples: "editorconfig", "comment".
+-- - "opt-out": runtime/plugin/*.lua
+-- - "opt-in": runtime/pack/dist/opt/
+-- 2. runtime/lua/vim/ (the runtime): Lazy-loaded modules. Examples: `inspect`, `lpeg`.
+-- 3. runtime/lua/vim/shared.lua: pure Lua functions which always are available. Used in the test
+-- runner, as well as worker threads and processes launched from Nvim.
+-- 4. runtime/lua/vim/_editor.lua: Eager-loaded code which directly interacts with the Nvim
+-- editor state. Only available in the main thread.
--
--- Guideline: "If in doubt, put it in the runtime".
---
--- Most functions should live directly in `vim.`, not in submodules.
+-- The top level "vim.*" namespace is for fundamental Lua and editor features. Use submodules for
+-- everything else (but avoid excessive "nesting"), or plugins (see above).
--
-- Compatibility with Vim's `if_lua` is explicitly a non-goal.
--
@@ -19,9 +21,7 @@
-- - https://github.com/luafun/luafun
-- - https://github.com/rxi/lume
-- - http://leafo.net/lapis/reference/utilities.html
--- - https://github.com/torch/paths
-- - https://github.com/bakpakin/Fennel (pretty print, repl)
--- - https://github.com/howl-editor/howl/tree/master/lib/howl/util
-- These are for loading runtime modules lazily since they aren't available in
-- the nvim binary as specified in executor.c
@@ -208,8 +208,10 @@ vim.inspect = vim.inspect
do
local tdots, tick, got_line1, undo_started, trailing_nl = 0, 0, false, false, false
- --- Paste handler, invoked by |nvim_paste()| when a conforming UI
- --- (such as the |TUI|) pastes text into the editor.
+ --- Paste handler, invoked by |nvim_paste()|.
+ ---
+ --- Note: This is provided only as a "hook", don't call it directly; call |nvim_paste()| instead,
+ --- which arranges redo (dot-repeat) and invokes `vim.paste`.
---
--- Example: To remove ANSI color codes when pasting:
---
@@ -220,7 +222,7 @@ do
--- -- Scrub ANSI color codes from paste input.
--- lines[i] = line:gsub('\27%[[0-9;mK]+', '')
--- end
- --- overridden(lines, phase)
+ --- return overridden(lines, phase)
--- end
--- end)(vim.paste)
--- ```
@@ -494,6 +496,7 @@ do
vim.t = make_dict_accessor('t')
end
+--- @deprecated
--- Gets a dict of line segment ("chunk") positions for the region from `pos1` to `pos2`.
---
--- Input and output positions are byte positions, (0,0)-indexed. "End of line" column
@@ -507,6 +510,8 @@ end
---@return table region Dict of the form `{linenr = {startcol,endcol}}`. `endcol` is exclusive, and
---whole lines are returned as `{startcol,endcol} = {0,-1}`.
function vim.region(bufnr, pos1, pos2, regtype, inclusive)
+ vim.deprecate('vim.region', 'vim.fn.getregionpos()', '0.13')
+
if not vim.api.nvim_buf_is_loaded(bufnr) then
vim.fn.bufload(bufnr)
end
@@ -605,10 +610,9 @@ end
--- Displays a notification to the user.
---
---- This function can be overridden by plugins to display notifications using a
---- custom provider (such as the system notification provider). By default,
+--- This function can be overridden by plugins to display notifications using
+--- a custom provider (such as the system notification provider). By default,
--- writes to |:messages|.
----
---@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.
@@ -783,7 +787,7 @@ function vim._expand_pat(pat, env)
if mt and type(mt.__index) == 'table' then
field = rawget(mt.__index, key)
elseif final_env == vim and (vim._submodules[key] or vim._extra[key]) then
- field = vim[key]
+ field = vim[key] --- @type any
end
end
final_env = field
@@ -794,14 +798,24 @@ function vim._expand_pat(pat, env)
end
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
+ if
+ type(k) == 'string'
+ and string.sub(k, 1, string.len(match_part)) == match_part
+ and k:match('^[_%w]+$') ~= nil -- filter out invalid identifiers for field, e.g. 'foo#bar'
+ then
keys[k] = true
end
end
end
+ ---@param acc table<string,any>
+ local function _fold_to_map(acc, k, v)
+ acc[k] = (v or true)
+ return acc
+ end
if type(final_env) == 'table' then
insert_keys(final_env)
@@ -810,11 +824,61 @@ function vim._expand_pat(pat, env)
if mt and type(mt.__index) == 'table' then
insert_keys(mt.__index)
end
+
if final_env == vim then
insert_keys(vim._submodules)
insert_keys(vim._extra)
end
+ -- Completion for dict accessors (special vim variables and vim.fn)
+ if mt and vim.tbl_contains({ vim.g, vim.t, vim.w, vim.b, vim.v, vim.fn }, final_env) then
+ local prefix, type = unpack(
+ vim.fn == final_env and { '', 'function' }
+ or vim.g == final_env and { 'g:', 'var' }
+ or vim.t == final_env and { 't:', 'var' }
+ or vim.w == final_env and { 'w:', 'var' }
+ or vim.b == final_env and { 'b:', 'var' }
+ or vim.v == final_env and { 'v:', 'var' }
+ or { nil, nil }
+ )
+ assert(prefix, "Can't resolve final_env")
+ local vars = vim.fn.getcompletion(prefix .. match_part, type) --- @type string[]
+ insert_keys(vim
+ .iter(vars)
+ :map(function(s) ---@param s string
+ s = s:gsub('[()]+$', '') -- strip '(' and ')' for function completions
+ return s:sub(#prefix + 1) -- strip the prefix, e.g., 'g:foo' => 'foo'
+ end)
+ :fold({}, _fold_to_map))
+ end
+
+ -- Completion for option accessors (full names only)
+ if
+ mt
+ and vim.tbl_contains(
+ { vim.o, vim.go, vim.bo, vim.wo, vim.opt, vim.opt_local, vim.opt_global },
+ final_env
+ )
+ then
+ --- @type fun(option_name: string, option: vim.api.keyset.get_option_info): boolean
+ local filter = function(_, _)
+ return true
+ end
+ if vim.bo == final_env then
+ filter = function(_, option)
+ return option.scope == 'buf'
+ end
+ elseif vim.wo == final_env then
+ filter = function(_, option)
+ return option.scope == 'win'
+ end
+ end
+
+ --- @type table<string, vim.api.keyset.get_option_info>
+ local options = vim.api.nvim_get_all_options_info()
+ insert_keys(vim.iter(options):filter(filter):fold({}, _fold_to_map))
+ end
+
keys = vim.tbl_keys(keys)
table.sort(keys)
diff --git a/runtime/lua/vim/_inspector.lua b/runtime/lua/vim/_inspector.lua
index f5d1640c82..fccf4b8dbe 100644
--- a/runtime/lua/vim/_inspector.lua
+++ b/runtime/lua/vim/_inspector.lua
@@ -27,6 +27,7 @@ local defaults = {
---
---Can also be pretty-printed with `:Inspect!`. [:Inspect!]()
---
+---@since 11
---@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
@@ -84,7 +85,7 @@ function vim.inspect_pos(bufnr, row, col, filter)
-- syntax
if filter.syntax and vim.api.nvim_buf_is_valid(bufnr) then
- vim.api.nvim_buf_call(bufnr, function()
+ vim._with({ buf = bufnr }, function()
for _, i1 in ipairs(vim.fn.synstack(row + 1, col + 1)) do
results.syntax[#results.syntax + 1] =
resolve_hl({ hl_group = vim.fn.synIDattr(i1, 'name') })
@@ -145,6 +146,7 @@ end
---
---Can also be shown with `:Inspect`. [:Inspect]()
---
+---@since 11
---@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
diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua
index 731dd5b923..c9f207cb20 100644
--- a/runtime/lua/vim/_meta.lua
+++ b/runtime/lua/vim/_meta.lua
@@ -34,3 +34,5 @@ vim.uri_from_fname = uri.uri_from_fname
vim.uri_from_bufnr = uri.uri_from_bufnr
vim.uri_to_fname = uri.uri_to_fname
vim.uri_to_bufnr = uri.uri_to_bufnr
+
+vim.provider = require('vim.provider')
diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua
index 6edf2a5a96..c66b295d3a 100644
--- a/runtime/lua/vim/_meta/api.lua
+++ b/runtime/lua/vim/_meta/api.lua
@@ -20,14 +20,15 @@ function vim.api.nvim__buf_stats(buffer) end
--- @private
--- EXPERIMENTAL: this API may change in the future.
---
---- Sets info for the completion item at the given index. If the info text was
---- shown in a window, returns the window and buffer ids, or empty dict if not
---- shown.
+--- Sets info for the completion item at the given index. If the info text was shown in a window,
+--- returns the window and buffer ids, or empty dict if not shown.
---
--- @param index integer Completion candidate index
--- @param opts vim.api.keyset.complete_set Optional parameters.
---- • info: (string) info text.
---- @return table<string,any>
+--- - info: (string) info text.
+--- @return table<string,any> # Dict containing these keys:
+--- - winid: (number) floating window id
+--- - bufnr: (number) buffer id in floating window
function vim.api.nvim__complete_set(index, opts) end
--- @private
@@ -40,7 +41,7 @@ function vim.api.nvim__get_lib_dir() end
--- @param pat any[] pattern of files to search for
--- @param all boolean whether to return all matches or only the first
--- @param opts vim.api.keyset.runtime is_lua: only search Lua subdirs
---- @return string[]
+--- @return string[] # list of absolute paths to the found files
function vim.api.nvim__get_runtime(pat, all, opts) end
--- @private
@@ -50,7 +51,7 @@ function vim.api.nvim__get_runtime(pat, all, opts) end
--- in plugins.
---
--- @param obj any Object to return.
---- @return any
+--- @return any # its argument.
function vim.api.nvim__id(obj) end
--- @private
@@ -60,18 +61,18 @@ function vim.api.nvim__id(obj) end
--- in plugins.
---
--- @param arr any[] Array to return.
---- @return any[]
+--- @return any[] # its argument.
function vim.api.nvim__id_array(arr) end
--- @private
---- Returns dictionary given as argument.
+--- Returns dict given as argument.
---
--- This API function is used for testing. One should not rely on its presence
--- in plugins.
---
---- @param dct table<string,any> Dictionary to return.
---- @return table<string,any>
-function vim.api.nvim__id_dictionary(dct) end
+--- @param dct table<string,any> Dict to return.
+--- @return table<string,any> # its argument.
+function vim.api.nvim__id_dict(dct) end
--- @private
--- Returns floating-point value given as argument.
@@ -80,13 +81,11 @@ function vim.api.nvim__id_dictionary(dct) end
--- in plugins.
---
--- @param flt number Value to return.
---- @return number
+--- @return number # its argument.
function vim.api.nvim__id_float(flt) end
--- @private
---- NB: if your UI doesn't use hlstate, this will not return hlstate first
---- time.
----
+--- NB: if your UI doesn't use hlstate, this will not return hlstate first time.
--- @param grid integer
--- @param row integer
--- @param col integer
@@ -94,35 +93,55 @@ function vim.api.nvim__id_float(flt) end
function vim.api.nvim__inspect_cell(grid, row, col) end
--- @private
---- For testing. The condition in schar_cache_clear_if_full is hard to reach,
---- so this function can be used to force a cache clear in a test.
----
+--- For testing. The condition in schar_cache_clear_if_full is hard to
+--- reach, so this function can be used to force a cache clear in a test.
function vim.api.nvim__invalidate_glyph_cache() end
--- @private
+--- EXPERIMENTAL: this API will change in the future.
+---
+--- Get the properties for namespace
+---
+--- @param ns_id integer Namespace
+--- @return vim.api.keyset.ns_opts # Map defining the namespace properties, see |nvim__ns_set()|
+function vim.api.nvim__ns_get(ns_id) end
+
+--- @private
+--- EXPERIMENTAL: this API will change in the future.
+---
+--- Set some properties for namespace
+---
+--- @param ns_id integer Namespace
+--- @param opts vim.api.keyset.ns_opts Optional parameters to set:
+--- - wins: a list of windows to be scoped in
+function vim.api.nvim__ns_set(ns_id, opts) end
+
+--- @private
--- EXPERIMENTAL: this API may change in the future.
---
--- Instruct Nvim to redraw various components.
---
+---
+--- @see `:help :redraw`
--- @param opts vim.api.keyset.redraw Optional parameters.
---- • win: Target a specific `window-ID` as described below.
---- • buf: Target a specific buffer number as described below.
---- • flush: Update the screen with pending updates.
---- • valid: When present mark `win`, `buf`, or all windows for
---- redraw. When `true`, only redraw changed lines (useful for
---- decoration providers). When `false`, forcefully redraw.
---- • range: Redraw a range in `buf`, the buffer in `win` or the
---- current buffer (useful for decoration providers). Expects a
---- tuple `[first, last]` with the first and last line number of
---- the range, 0-based end-exclusive `api-indexing`.
---- • cursor: Immediately update cursor position on the screen in
---- `win` or the current window.
---- • statuscolumn: Redraw the 'statuscolumn' in `buf`, `win` or
---- all windows.
---- • statusline: Redraw the 'statusline' in `buf`, `win` or all
---- windows.
---- • winbar: Redraw the 'winbar' in `buf`, `win` or all windows.
---- • tabline: Redraw the 'tabline'.
+--- - win: Target a specific `window-ID` as described below.
+--- - buf: Target a specific buffer number as described below.
+--- - flush: Update the screen with pending updates.
+--- - valid: When present mark `win`, `buf`, or all windows for
+--- redraw. When `true`, only redraw changed lines (useful for
+--- decoration providers). When `false`, forcefully redraw.
+--- - range: Redraw a range in `buf`, the buffer in `win` or the
+--- current buffer (useful for decoration providers). Expects a
+--- tuple `[first, last]` with the first and last line number
+--- of the range, 0-based end-exclusive `api-indexing`.
+--- - cursor: Immediately update cursor position on the screen in
+--- `win` or the current window.
+--- - statuscolumn: Redraw the 'statuscolumn' in `buf`, `win` or
+--- all windows.
+--- - statusline: Redraw the 'statusline' in `buf`, `win` or all
+--- windows.
+--- - winbar: Redraw the 'winbar' in `buf`, `win` or all windows.
+--- - tabline: Redraw the 'tabline'.
function vim.api.nvim__redraw(opts) end
--- @private
@@ -136,7 +155,7 @@ function vim.api.nvim__screenshot(path) end
--- @private
--- Gets internal stats.
---
---- @return table<string,any>
+--- @return table<string,any> # Map of various internal stats.
function vim.api.nvim__stats() end
--- @private
@@ -144,50 +163,20 @@ function vim.api.nvim__stats() end
--- @return any
function vim.api.nvim__unpack(str) end
---- @private
---- EXPERIMENTAL: this API will change in the future.
----
---- Scopes a namespace to the a window, so extmarks in the namespace will be
---- active only in the given window.
----
---- @param window integer Window handle, or 0 for current window
---- @param ns_id integer Namespace
---- @return boolean
-function vim.api.nvim__win_add_ns(window, ns_id) end
-
---- @private
---- EXPERIMENTAL: this API will change in the future.
----
---- Unscopes a namespace (un-binds it from the given scope).
----
---- @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_del_ns(window, ns_id) end
-
---- @private
---- EXPERIMENTAL: this API will change in the future.
----
---- Gets the namespace scopes for a given window.
----
---- @param window integer Window handle, or 0 for current window
---- @return integer[]
-function vim.api.nvim__win_get_ns(window) 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.
+--- 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`.
+--- 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
@@ -200,98 +189,100 @@ function vim.api.nvim__win_get_ns(window) end
--- @param hl_group string Name of the highlight group to use
--- @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
---- @return integer
+--- @param col_end integer End of (byte-indexed) column range to highlight,
+--- or -1 to highlight to end of line
+--- @return integer # The ns_id that was used
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):
+--- Example (Lua): capture buffer updates in a global `events` variable
+--- (use "vim.print(events)" to see its contents):
---
--- ```lua
---- events = {}
---- vim.api.nvim_buf_attach(0, false, {
---- on_lines = function(...)
---- table.insert(events, {...})
---- end,
---- })
+--- events = {}
+--- vim.api.nvim_buf_attach(0, false, {
+--- on_lines = function(...)
+--- table.insert(events, {...})
+--- end,
+--- })
--- ```
---
---
+--- @see vim.api.nvim_buf_detach
+--- @see `:help api-buffer-updates-lua`
--- @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.
+--- 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 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
+--- - 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 # False if attach failed (invalid parameter, or buffer isn't loaded);
+--- otherwise True. TODO: LUA_API_NO_EVAL
function vim.api.nvim_buf_attach(buffer, send_buffer, opts) end
---- call a function with buffer as temporary current buffer
+--- 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 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, then 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)
---- @return any
+--- only)
+--- @return any # Return value of function.
function vim.api.nvim_buf_call(buffer, fun) end
--- @deprecated
@@ -301,21 +292,22 @@ function vim.api.nvim_buf_call(buffer, fun) end
--- @param line_end integer
function vim.api.nvim_buf_clear_highlight(buffer, ns_id, line_start, line_end) end
---- Clears `namespace`d objects (highlights, `extmarks`, virtual text) from a
---- region.
+--- Clears `namespace`d objects (highlights, `extmarks`, virtual text) from
+--- a region.
---
---- Lines are 0-indexed. `api-indexing` To clear the namespace in the entire
+--- 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.
+--- 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`.
---
+--- @see vim.api.nvim_create_user_command
--- @param buffer integer Buffer handle, or 0 for current buffer.
--- @param name string
--- @param command any
@@ -327,11 +319,13 @@ function vim.api.nvim_buf_create_user_command(buffer, name, command, 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
---- @return boolean
+--- @return boolean # true if the extmark was found, else false
function vim.api.nvim_buf_del_extmark(buffer, ns_id, id) end
--- Unmaps a buffer-local `mapping` for the given mode.
---
+---
+--- @see vim.api.nvim_del_keymap
--- @param buffer integer Buffer handle, or 0 for current buffer
--- @param mode string
--- @param lhs string
@@ -339,9 +333,15 @@ function vim.api.nvim_buf_del_keymap(buffer, mode, lhs) end
--- Deletes a named mark in the buffer. See `mark-motions`.
---
+--- Note:
+--- only deletes marks set in the buffer, if the mark is not set
+--- in the buffer it will return false.
+---
+--- @see vim.api.nvim_buf_set_mark
+--- @see vim.api.nvim_del_mark
--- @param buffer integer Buffer to set the mark on
--- @param name string Mark name
---- @return boolean
+--- @return boolean # true if the mark was deleted, else false.
function vim.api.nvim_buf_del_mark(buffer, name) end
--- Delete a buffer-local user-defined command.
@@ -363,21 +363,21 @@ function vim.api.nvim_buf_del_var(buffer, name) end
---
--- @param buffer integer Buffer handle, or 0 for current buffer
--- @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`
+--- - 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
---
--- @param buffer integer Buffer handle, or 0 for current buffer
---- @return integer
+--- @return integer # `b:changedtick` value.
function vim.api.nvim_buf_get_changedtick(buffer) end
--- Gets a map of buffer-local `user-commands`.
---
--- @param buffer integer Buffer handle, or 0 for current buffer
--- @param opts vim.api.keyset.get_commands Optional parameters. Currently not used.
---- @return table<string,any>
+--- @return table<string,any> # Map of maps describing commands.
function vim.api.nvim_buf_get_commands(buffer, opts) end
--- Gets the position (0-indexed) of an `extmark`.
@@ -386,10 +386,10 @@ function vim.api.nvim_buf_get_commands(buffer, opts) end
--- @param ns_id integer Namespace id from `nvim_create_namespace()`
--- @param id integer Extmark id
--- @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
+--- - 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_by_id # 0-indexed (row, col) tuple or empty list () if extmark id was
+--- absent
function vim.api.nvim_buf_get_extmark_by_id(buffer, ns_id, id, opts) end
--- Gets `extmarks` in "traversal order" from a `charwise` region defined by
@@ -400,70 +400,67 @@ function vim.api.nvim_buf_get_extmark_by_id(buffer, ns_id, id, opts) end
--- respectively, thus the following are equivalent:
---
--- ```lua
---- vim.api.nvim_buf_get_extmarks(0, my_ns, 0, -1, {})
---- vim.api.nvim_buf_get_extmarks(0, my_ns, {0,0}, {-1,-1}, {})
+--- vim.api.nvim_buf_get_extmarks(0, my_ns, 0, -1, {})
+--- vim.api.nvim_buf_get_extmarks(0, my_ns, {0,0}, {-1,-1}, {})
--- ```
---
---- If `end` is less than `start`, traversal works backwards. (Useful with
---- `limit`, to get the first marks prior to a given position.)
+--- 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.
+--- 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
+--- 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)
---- local ns = api.nvim_create_namespace('my-plugin')
---- -- Create new extmark at line 1, column 1.
---- local m1 = api.nvim_buf_set_extmark(0, ns, 0, 0, {})
---- -- Create new extmark at line 3, column 1.
---- local m2 = api.nvim_buf_set_extmark(0, ns, 2, 0, {})
---- -- Get extmarks only from line 3.
---- local ms = api.nvim_buf_get_extmarks(0, ns, {2,0}, {2,0}, {})
---- -- Get all marks in this buffer + namespace.
---- local all = api.nvim_buf_get_extmarks(0, ns, 0, -1, {})
---- vim.print(ms)
+--- local api = vim.api
+--- local pos = api.nvim_win_get_cursor(0)
+--- local ns = api.nvim_create_namespace('my-plugin')
+--- -- Create new extmark at line 1, column 1.
+--- local m1 = api.nvim_buf_set_extmark(0, ns, 0, 0, {})
+--- -- Create new extmark at line 3, column 1.
+--- local m2 = api.nvim_buf_set_extmark(0, ns, 2, 0, {})
+--- -- Get extmarks only from line 3.
+--- local ms = api.nvim_buf_get_extmarks(0, ns, {2,0}, {2,0}, {})
+--- -- Get all marks in this buffer + namespace.
+--- local all = api.nvim_buf_get_extmarks(0, ns, 0, -1, {})
+--- 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
+--- @param ns_id integer Namespace id from `nvim_create_namespace()` or -1 for all 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 vim.api.keyset.get_extmark_item[]
+--- - 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[] # List of `[extmark_id, row, col]` tuples in "traversal order".
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 vim.api.keyset.keymap[]
+--- @return vim.api.keyset.keymap[] # Array of |maparg()|-like dictionaries describing mappings.
+--- The "buffer" key holds the associated buffer handle.
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.
+--- 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.
@@ -472,24 +469,27 @@ function vim.api.nvim_buf_get_keymap(buffer, mode) end
--- @param start integer First line index
--- @param end_ integer Last line index, exclusive
--- @param strict_indexing boolean Whether out-of-bounds should be an error.
---- @return string[]
+--- @return string[] # Array of lines, or empty array for unloaded buffer.
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`.
+--- "End of line" column position is returned as `v:maxcol` (big number).
+--- See `mark-motions`.
---
--- Marks are (1,0)-indexed. `api-indexing`
---
+--- @see vim.api.nvim_buf_set_mark
+--- @see vim.api.nvim_buf_del_mark
--- @param buffer integer Buffer handle, or 0 for current buffer
--- @param name string Mark name
---- @return integer[]
+--- @return integer[] # (row, col) tuple, (0, 0) if the mark is not set, or is an
+--- uppercase/file mark set in another buffer.
function vim.api.nvim_buf_get_mark(buffer, name) end
--- Gets the full file name for the buffer
---
--- @param buffer integer Buffer handle, or 0 for current buffer
---- @return string
+--- @return string # Buffer name
function vim.api.nvim_buf_get_name(buffer) end
--- @deprecated
@@ -504,12 +504,12 @@ function vim.api.nvim_buf_get_number(buffer) end
--- 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.
+--- Unlike `line2byte()`, throws error for out-of-bounds indexing.
+--- Returns -1 for unloaded buffer.
---
--- @param buffer integer Buffer handle, or 0 for current buffer
--- @param index integer Line index
---- @return integer
+--- @return integer # Integer byte offset, or -1 for unloaded buffer.
function vim.api.nvim_buf_get_offset(buffer, index) end
--- @deprecated
@@ -534,49 +534,54 @@ function vim.api.nvim_buf_get_option(buffer, name) end
--- @param end_row integer Last line index, inclusive
--- @param end_col integer Ending column (byte offset) on last line, exclusive
--- @param opts vim.api.keyset.empty Optional parameters. Currently unused.
---- @return string[]
+--- @return string[] # Array of lines, or empty array for unloaded buffer.
function vim.api.nvim_buf_get_text(buffer, start_row, start_col, end_row, end_col, opts) end
--- Gets a buffer-scoped (b:) variable.
---
--- @param buffer integer Buffer handle, or 0 for current buffer
--- @param name string Variable name
---- @return any
+--- @return any # Variable value
function vim.api.nvim_buf_get_var(buffer, name) end
--- Checks if a buffer is valid and loaded. See `api-buffer` for more info
--- about unloaded buffers.
---
--- @param buffer integer Buffer handle, or 0 for current buffer
---- @return boolean
+--- @return boolean # true if the buffer is valid and loaded, false otherwise.
function vim.api.nvim_buf_is_loaded(buffer) end
--- Checks if a buffer is valid.
---
+--- Note:
+--- Even if a buffer is valid it may have been unloaded. See |api-buffer|
+--- for more info about unloaded buffers.
+---
+---
--- @param buffer integer Buffer handle, or 0 for current buffer
---- @return boolean
+--- @return boolean # true if the buffer is valid, false otherwise.
function vim.api.nvim_buf_is_valid(buffer) end
--- Returns the number of lines in the given buffer.
---
--- @param buffer integer Buffer handle, or 0 for current buffer
---- @return integer
+--- @return integer # Line count, or 0 for unloaded buffer. |api-buffer|
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.)
+--- 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.
+--- 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
+--- 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
--- range (no highlighting).
---
--- @param buffer integer Buffer handle, or 0 for current buffer
@@ -584,115 +589,122 @@ 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.
---- • 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 (EXPERIMENTAL) enables "scoping" for the
---- extmark. See `nvim__win_add_ns()`
---- @return integer
+--- - 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.
+--- @return integer # Id of the created/updated extmark
function vim.api.nvim_buf_set_extmark(buffer, ns_id, line, col, opts) end
--- Sets a buffer-local `mapping` for the given mode.
---
+---
+--- @see vim.api.nvim_set_keymap
--- @param buffer integer Buffer handle, or 0 for current buffer
--- @param mode string
--- @param lhs string
@@ -702,9 +714,9 @@ 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.
+--- 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.
@@ -712,6 +724,8 @@ function vim.api.nvim_buf_set_keymap(buffer, mode, lhs, rhs, opts) end
--- Out-of-bounds indices are clamped to the nearest valid value, unless
--- `strict_indexing` is set.
---
+---
+--- @see vim.api.nvim_buf_set_text
--- @param buffer integer Buffer handle, or 0 for current buffer
--- @param start integer First line index
--- @param end_ integer Last line index, exclusive
@@ -724,12 +738,18 @@ function vim.api.nvim_buf_set_lines(buffer, start, end_, strict_indexing, replac
---
--- Marks are (1,0)-indexed. `api-indexing`
---
+--- Note:
+--- Passing 0 as line deletes the mark
+---
+---
+--- @see vim.api.nvim_buf_del_mark
+--- @see vim.api.nvim_buf_get_mark
--- @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 vim.api.keyset.empty Optional parameters. Reserved for future use.
---- @return boolean
+--- @return boolean # true if the mark was set, else false.
function vim.api.nvim_buf_set_mark(buffer, name, line, col, opts) end
--- Sets the full file name for a buffer, like `:file_f`
@@ -746,21 +766,21 @@ 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.
+--- 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.
+--- Note:
+--- Prefer |nvim_buf_set_lines()| (for performance) to add or delete entire lines.
+--- Prefer |nvim_paste()| or |nvim_put()| to insert (instead of replace) text at cursor.
---
---- Prefer `nvim_put()` if you want to insert text at the cursor position.
---
--- @param buffer integer Buffer handle, or 0 for current buffer
--- @param start_row integer First line index
@@ -790,10 +810,10 @@ function vim.api.nvim_buf_set_virtual_text(buffer, src_id, line, chunks, opts) e
---
--- On execution error: fails with Vimscript error, updates v:errmsg.
---
---- @param dict any Dictionary, or String evaluating to a Vimscript `self` dict
+--- @param dict any Dict, or String evaluating to a Vimscript `self` dict
--- @param fn string Name of the function defined on the Vimscript dict
--- @param args any[] Function arguments packed in an Array
---- @return any
+--- @return any # Result of the function call
function vim.api.nvim_call_dict_function(dict, fn, args) end
--- Calls a Vimscript function with the given arguments.
@@ -802,85 +822,83 @@ function vim.api.nvim_call_dict_function(dict, fn, args) end
---
--- @param fn string Function to call
--- @param args any[] Function arguments packed in an Array
---- @return any
+--- @return any # Result of the function call
function vim.api.nvim_call_function(fn, args) end
---- Send data to channel `id`. For a job, it writes it to the stdin of the
---- 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.
+--- Send data to channel `id`. For a job, it writes it to the
+--- stdin of the 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.
+--- 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.
---
--- @param chan integer id of the channel
--- @param data string data to write. 8-bit clean: can contain NUL bytes.
function vim.api.nvim_chan_send(chan, data) end
---- Clears all autocommands selected by {opts}. To delete autocmds see
---- `nvim_del_autocmd()`.
+--- Clears all autocommands selected by {opts}. To delete autocmds see `nvim_del_autocmd()`.
---
--- @param opts vim.api.keyset.clear_autocmds Parameters
---- • event: (string|table) Examples:
---- • 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.
+--- - event: (string|table)
+--- Examples:
+--- - 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.
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.
+--- Unlike `nvim_command()` this command takes a structured Dict 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)`.
+--- 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.
+---
+--- @see vim.api.nvim_exec2
+--- @see vim.api.nvim_command
+--- @param cmd vim.api.keyset.cmd Command to execute. Must be a Dict 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.
--- @param opts vim.api.keyset.cmd_opts Optional parameters.
---- • output: (boolean, default false) Whether to return command
---- output.
---- @return string
+--- - output: (boolean, default false) Whether to return command output.
+--- @return string # Command output (non-error, non-shell |:!|) if `output` is true, else empty string.
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
---- then execute it, use `nvim_cmd()`. To modify an Ex command before
---- evaluating it, use `nvim_parse_cmd()` in conjunction with `nvim_cmd()`.
+--- 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 then execute it, use `nvim_cmd()`. To modify an Ex command before evaluating it, use
+--- `nvim_parse_cmd()` in conjunction with `nvim_cmd()`.
---
--- @param command string Ex command string
function vim.api.nvim_command(command) end
--- @deprecated
+--- @see vim.api.nvim_exec2
--- @param command string
--- @return string
function vim.api.nvim_command_output(command) end
@@ -890,106 +908,99 @@ function vim.api.nvim_command_output(command) end
--- To get an existing group id, do:
---
--- ```lua
---- local id = vim.api.nvim_create_augroup("MyGroup", {
---- clear = false
---- })
+--- local id = vim.api.nvim_create_augroup("MyGroup", {
+--- clear = false
+--- })
--- ```
---
----
+--- @see `:help autocmd-groups`
--- @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
---- commands if the group already exists `autocmd-groups`.
---- @return integer
+--- @param opts vim.api.keyset.create_augroup Dict Parameters
+--- - clear (bool) optional: defaults to true. Clear existing
+--- commands if the group already exists `autocmd-groups`.
+--- @return integer # Integer id of the created group.
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
---- vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
---- pattern = {"*.c", "*.h"},
---- callback = function(ev)
---- print(string.format('event fired: %s', vim.inspect(ev)))
---- end
---- })
+--- vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
+--- pattern = {"*.c", "*.h"},
+--- callback = function(ev)
+--- print(string.format('event fired: %s', vim.inspect(ev)))
+--- end
+--- })
--- ```
---
--- Example using an Ex command as the handler:
---
--- ```lua
---- vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
---- pattern = {"*.c", "*.h"},
---- command = "echo 'Entering a C or C++ file'",
---- })
+--- vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
+--- pattern = {"*.c", "*.h"},
+--- command = "echo 'Entering a C or C++ file'",
+--- })
--- ```
---
---- Note: `pattern` is NOT automatically expanded (unlike with `:autocmd`),
---- thus names like "$HOME" and "~" must be expanded explicitly:
+--- Note: `pattern` is NOT automatically expanded (unlike with `:autocmd`), thus names like "$HOME"
+--- and "~" must be expanded explicitly:
---
--- ```lua
---- pattern = vim.fn.expand("~") .. "/some/path/*.py"
+--- pattern = vim.fn.expand("~") .. "/some/path/*.py"
--- ```
---
----
---- @param event any (string|array) Event(s) that will trigger the handler
---- (`callback` or `command`).
+--- @see `:help autocommand`
+--- @see vim.api.nvim_del_autocmd
+--- @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 a truthy value (not
---- `false` or `nil`) to delete the autocommand. Receives one
---- argument, a table with these keys: *event-args*
---- • 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()` *event-data*
---- • 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
+--- - 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 one argument,
+--- a table with these keys: [event-args]()
+--- - 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()] [event-data]()
+--- - 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 # Autocommand id (number)
function vim.api.nvim_create_autocmd(event, opts) end
--- Creates a new, empty, unnamed buffer.
---
+--- @see buf_open_scratch
--- @param listed boolean Sets 'buflisted'
--- @param scratch boolean Creates a "throwaway" `scratch-buffer` for temporary work
---- (always 'nomodified'). Also sets 'nomodeline' on the
---- buffer.
---- @return integer
+--- (always 'nomodified'). Also sets 'nomodeline' on the buffer.
+--- @return integer # Buffer handle, or 0 on error
+---
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.
+--- namespace, the associated id is returned. If `name` is an empty string
+--- a new, anonymous namespace is created.
---
--- @param name string Namespace name or empty string
---- @return integer
+--- @return integer # Namespace id
function vim.api.nvim_create_namespace(name) end
--- Creates a global `user-commands` command.
@@ -999,70 +1010,57 @@ function vim.api.nvim_create_namespace(name) end
--- Example:
---
--- ```vim
---- :call nvim_create_user_command('SayHello', 'echo "Hello world!"', {'bang': v:true})
---- :SayHello
---- Hello world!
+--- :call nvim_create_user_command('SayHello', 'echo "Hello world!"', {'bang': v:true})
+--- :SayHello
+--- Hello world!
--- ```
---
----
---- @param name string Name of the new user command. Must begin with an uppercase
---- 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>
---- • fargs: (table) The args split by unescaped whitespace
---- (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>
---- • line1: (number) The starting line of the command range
---- <line1>
---- • line2: (number) The final line of the command range
---- <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>
---- • smods: (table) Command modifiers in a structured format.
---- Has the same structure as the "mods" key of
---- `nvim_parse_cmd()`.
+--- @param name string Name of the new user command. Must begin with an uppercase 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>]
+--- - fargs: (table) The args split by unescaped whitespace (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>]
+--- - line1: (number) The starting line of the command range [<line1>]
+--- - line2: (number) The final line of the command range [<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>]
+--- - 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.
----
+--- 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.
+--- @see vim.api.nvim_del_augroup_by_name
+--- @see vim.api.nvim_create_augroup
--- @param id integer Integer The id of the group.
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.
----
+--- 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.
+--- @see `:help autocmd-groups`
--- @param name string String The name of the group.
function vim.api.nvim_del_augroup_by_name(name) end
@@ -1079,14 +1077,20 @@ function vim.api.nvim_del_current_line() end
---
--- To unmap a buffer-local mapping, use `nvim_buf_del_keymap()`.
---
+--- @see vim.api.nvim_set_keymap
--- @param mode string
--- @param lhs string
function vim.api.nvim_del_keymap(mode, lhs) end
--- Deletes an uppercase/file named mark. See `mark-motions`.
---
+--- Note:
+--- Lowercase name (or other buffer-local mark) is an error.
+---
+--- @see vim.api.nvim_buf_del_mark
+--- @see vim.api.nvim_get_mark
--- @param name string Mark name
---- @return boolean
+--- @return boolean # true if the mark was deleted, else false.
function vim.api.nvim_del_mark(name) end
--- Delete a user-defined command.
@@ -1102,14 +1106,13 @@ 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.
+--- 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
@@ -1121,39 +1124,43 @@ function vim.api.nvim_err_write(str) end
--- Writes a message to the Vim error buffer. Appends "\n", so the buffer is
--- flushed (and displayed).
---
+--- @see vim.api.nvim_err_write
--- @param str string Message
function vim.api.nvim_err_writeln(str) end
---- Evaluates a Vimscript `expression`. Dictionaries and Lists are recursively
---- expanded.
+--- Evaluates a Vimscript `expression`. Dicts and Lists are recursively expanded.
---
--- On execution error: fails with Vimscript error, updates v:errmsg.
---
--- @param expr string Vimscript expression string
---- @return any
+--- @return any # Evaluation result or expanded object
function vim.api.nvim_eval(expr) end
--- Evaluates statusline string.
---
--- @param str string Statusline string (see 'statusline').
--- @param opts vim.api.keyset.eval_statusline Optional parameters.
---- • winid: (number) `window-ID` of the window to use as context
---- for statusline.
---- • maxwidth: (number) Maximum width of statusline.
---- • fillchar: (string) Character to fill blank spaces in the
---- statusline (see 'fillchars'). Treated as single-width even
---- if it isn't.
---- • highlights: (boolean) Return highlight information.
---- • use_winbar: (boolean) Evaluate winbar instead of statusline.
---- • use_tabline: (boolean) Evaluate tabline instead of
---- statusline. When true, {winid} is ignored. Mutually
---- exclusive with {use_winbar}.
---- • use_statuscol_lnum: (number) Evaluate statuscolumn for this
---- line number instead of statusline.
---- @return table<string,any>
+--- - winid: (number) `window-ID` of the window to use as context for statusline.
+--- - maxwidth: (number) Maximum width of statusline.
+--- - fillchar: (string) Character to fill blank spaces in the statusline (see
+--- 'fillchars'). Treated as single-width even if it isn't.
+--- - highlights: (boolean) Return highlight information.
+--- - use_winbar: (boolean) Evaluate winbar instead of statusline.
+--- - use_tabline: (boolean) Evaluate tabline instead of statusline. When true, {winid}
+--- is ignored. Mutually exclusive with {use_winbar}.
+--- - use_statuscol_lnum: (number) Evaluate statuscolumn for this line number instead of statusline.
+--- @return table<string,any> # Dict containing statusline information, with these keys:
+--- - str: (string) Characters that will be displayed on the statusline.
+--- - width: (number) Display width of the statusline.
+--- - highlights: Array containing highlight information of the statusline. Only included when
+--- the "highlights" key in {opts} is true. Each element of the array is a
+--- |Dict| with these keys:
+--- - start: (number) Byte index (0-based) of first character that uses the highlight.
+--- - group: (string) Name of highlight group.
function vim.api.nvim_eval_statusline(str, opts) end
--- @deprecated
+--- @see vim.api.nvim_exec2
--- @param src string
--- @param output boolean
--- @return string
@@ -1162,33 +1169,38 @@ 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.
+--- Unlike `nvim_command()` this function supports heredocs, script-scope (s:),
+--- etc.
---
--- On execution error: fails with Vimscript error, updates v:errmsg.
---
+---
+--- @see `:help execute()`
+--- @see vim.api.nvim_command
+--- @see vim.api.nvim_cmd
--- @param src string Vimscript code
--- @param opts vim.api.keyset.exec_opts Optional parameters.
---- • output: (boolean, default false) Whether to capture and
---- return all (non-error, non-shell `:!`) output.
---- @return table<string,any>
+--- - output: (boolean, default false) Whether to capture and return
+--- all (non-error, non-shell `:!`) output.
+--- @return table<string,any> # Dict containing information about execution, with these keys:
+--- - output: (string|nil) Output if `opts.output` is true.
function vim.api.nvim_exec2(src, opts) end
---- Execute all autocommands for {event} that match the corresponding {opts}
---- `autocmd-execute`.
----
+--- Execute all autocommands for {event} that match the corresponding
+--- {opts} `autocmd-execute`.
+--- @see `:help :doautocmd`
--- @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.
+--- @param opts vim.api.keyset.exec_autocmds Dict 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.
function vim.api.nvim_exec_autocmds(event, opts) end
--- Sends input-keys to Nvim, subject to various quirks controlled by `mode`
@@ -1196,31 +1208,34 @@ function vim.api.nvim_exec_autocmds(event, opts) end
---
--- On execution error: does not fail, but updates v:errmsg.
---
---- To input sequences like <C-o> use `nvim_replace_termcodes()` (typically
+--- 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
---- :let key = nvim_replace_termcodes("<C-o>", v:true, v:false, v:true)
---- :call nvim_feedkeys(key, 'n', v:false)
+--- :let key = nvim_replace_termcodes("<C-o>", v:true, v:false, v:true)
+--- :call nvim_feedkeys(key, 'n', v:false)
--- ```
---
----
+--- @see feedkeys()
+--- @see vim_strsave_escape_ks
--- @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
---- false if you already used `nvim_replace_termcodes()`, and
---- true otherwise.
+--- @param escape_ks boolean If true, escape K_SPECIAL bytes in `keys`.
+--- This should be false if you already used
+--- `nvim_replace_termcodes()`, and true otherwise.
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()`.
+--- The dict has the full option names as keys and option metadata dicts as detailed at
+--- `nvim_get_option_info2()`.
---
---- @return table<string,any>
+---
+--- @see vim.api.nvim_get_commands
+--- @return table<string,any> # dict of all options
function vim.api.nvim_get_all_options_info() end
--- Get all autocommands that match the corresponding {opts}.
@@ -1228,39 +1243,68 @@ function vim.api.nvim_get_all_options_info() end
--- These examples will get autocommands matching ALL the given criteria:
---
--- ```lua
---- -- Matches all criteria
---- autocommands = vim.api.nvim_get_autocmds({
---- group = "MyGroup",
---- event = {"BufEnter", "BufWinEnter"},
---- pattern = {"*.c", "*.h"}
---- })
----
---- -- All commands from one group
---- autocommands = vim.api.nvim_get_autocmds({
---- group = "MyGroup",
---- })
+--- -- Matches all criteria
+--- autocommands = vim.api.nvim_get_autocmds({
+--- group = "MyGroup",
+--- event = {"BufEnter", "BufWinEnter"},
+--- pattern = {"*.c", "*.h"}
+--- })
+---
+--- -- All commands from one group
+--- autocommands = vim.api.nvim_get_autocmds({
+--- group = "MyGroup",
+--- })
--- ```
---
---- NOTE: When multiple patterns or events are provided, it will find all the
---- autocommands that match any combination of them.
----
---- @param opts vim.api.keyset.get_autocmds Dictionary with at least one of the following:
---- • group (string|integer): the autocommand group name or id to
---- match against.
---- • event (string|array): event or events to match against
---- `autocmd-events`.
---- • pattern (string|array): pattern or patterns to match against
---- `autocmd-pattern`. Cannot be used with {buffer}
---- • buffer: Buffer number or list of buffer numbers for buffer
---- local autocommands `autocmd-buflocal`. Cannot be used with
---- {pattern}
---- @return vim.api.keyset.get_autocmds.ret[]
+--- NOTE: When multiple patterns or events are provided, it will find all the autocommands that
+--- match any combination of them.
+---
+--- @param opts vim.api.keyset.get_autocmds Dict with at least one of the following:
+--- - group (string|integer): the autocommand group name or id to match against.
+--- - event (string|array): event or events to match against `autocmd-events`.
+--- - pattern (string|array): pattern or patterns to match against `autocmd-pattern`.
+--- Cannot be used with {buffer}
+--- - buffer: Buffer number or list of buffer numbers for buffer local autocommands
+--- `autocmd-buflocal`. Cannot be used with {pattern}
+--- @return vim.api.keyset.get_autocmds.ret[] # Array of autocommands matching the criteria, with each item
+--- containing the following fields:
+--- - id (number): the autocommand id (only when defined with the API).
+--- - group (integer): the autocommand group id.
+--- - group_name (string): the autocommand group name.
+--- - desc (string): the autocommand description.
+--- - event (string): the autocommand event.
+--- - command (string): the autocommand command. Note: this will be empty if a callback is set.
+--- - callback (function|string|nil): Lua function or name of a Vim script function
+--- which is executed when this autocommand is triggered.
+--- - once (boolean): whether the autocommand is only run once.
+--- - pattern (string): the autocommand pattern.
+--- If the autocommand is buffer local |autocmd-buffer-local|:
+--- - buflocal (boolean): true if the autocommand is buffer local.
+--- - buffer (number): the buffer number.
function vim.api.nvim_get_autocmds(opts) end
--- Gets information about a channel.
---
--- @param chan integer channel_id, or 0 for current channel
---- @return table<string,any>
+--- @return table<string,any> # Channel info dict with these keys:
+--- - "id" Channel id.
+--- - "argv" (optional) Job arguments list.
+--- - "stream" Stream underlying the channel.
+--- - "stdio" stdin and stdout of this Nvim instance
+--- - "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 unknown, the key will still be present if a pty is used (e.g.
+--- for conpty on Windows).
+--- - "buffer" (optional) Buffer connected to |terminal| instance.
+--- - "client" (optional) Info about the peer (client on the other end of the RPC channel),
+--- which it provided via |nvim_set_client_info()|.
+---
function vim.api.nvim_get_chan_info(chan) end
--- Returns the 24-bit RGB value of a `nvim_get_color_map()` color name or
@@ -1269,13 +1313,12 @@ function vim.api.nvim_get_chan_info(chan) end
--- Example:
---
--- ```vim
---- :echo nvim_get_color_by_name("Pink")
---- :echo nvim_get_color_by_name("#cbcbcb")
+--- :echo nvim_get_color_by_name("Pink")
+--- :echo nvim_get_color_by_name("#cbcbcb")
--- ```
---
----
--- @param name string Color name or "#rrggbb" string
---- @return integer
+--- @return integer # 24-bit RGB value, or -1 for invalid argument.
function vim.api.nvim_get_color_by_name(name) end
--- Returns a map of color names and RGB values.
@@ -1283,67 +1326,75 @@ function vim.api.nvim_get_color_by_name(name) end
--- Keys are color names (e.g. "Aqua") and values are 24-bit RGB color values
--- (e.g. 65535).
---
---- @return table<string,integer>
+--- @return table<string,integer> # Map of color names and RGB values.
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}
---- @return table<string,any>
+---
+--- @see vim.api.nvim_get_all_options_info
+--- @param opts vim.api.keyset.get_commands Optional parameters. Currently only supports
+--- {"builtin":false}
+--- @return table<string,any> # Map of maps describing commands.
function vim.api.nvim_get_commands(opts) end
--- Gets a map of the current editor state.
---
--- @param opts vim.api.keyset.context Optional parameters.
---- • types: List of `context-types` ("regs", "jumps", "bufs",
---- "gvars", …) to gather, or empty for "all".
---- @return table<string,any>
+--- - types: List of `context-types` ("regs", "jumps", "bufs",
+--- "gvars", …) to gather, or empty for "all".
+--- @return table<string,any> # map of global |context|.
function vim.api.nvim_get_context(opts) end
--- Gets the current buffer.
---
---- @return integer
+--- @return integer # Buffer handle
function vim.api.nvim_get_current_buf() end
--- Gets the current line.
---
---- @return string
+--- @return string # Current line string
function vim.api.nvim_get_current_line() end
--- Gets the current tabpage.
---
---- @return integer
+--- @return integer # Tabpage handle
function vim.api.nvim_get_current_tabpage() end
--- Gets the current window.
---
---- @return integer
+--- @return integer # Window handle
function vim.api.nvim_get_current_win() end
--- Gets all or specific highlight groups in a namespace.
---
---- @param ns_id integer Get highlight groups for namespace ns_id
---- `nvim_get_namespaces()`. Use 0 to get global highlight groups
---- `:highlight`.
+--- Note:
+--- When the `link` attribute is defined in the highlight definition
+--- map, other attributes will not be taking effect (see |:hi-link|).
+---
+---
+--- @param ns_id integer Get highlight groups for namespace ns_id `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 vim.api.keyset.hl_info
+--- - 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.get_hl_info # Highlight groups as a map from group name to a highlight definition map as in |nvim_set_hl()|,
+--- or only a single highlight definition map if requested by name or id.
function vim.api.nvim_get_hl(ns_id, opts) end
--- @deprecated
+--- @see vim.api.nvim_get_hl_by_name
--- @param hl_id integer
--- @param rgb boolean
--- @return table<string,any>
function vim.api.nvim_get_hl_by_id(hl_id, rgb) end
--- @deprecated
+--- @see vim.api.nvim_get_hl_by_id
--- @param name string
--- @param rgb boolean
--- @return table<string,any>
@@ -1352,7 +1403,6 @@ 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
--- @return integer
function vim.api.nvim_get_hl_id_by_name(name) end
@@ -1360,39 +1410,46 @@ function vim.api.nvim_get_hl_id_by_name(name) end
--- Gets the active highlight namespace.
---
--- @param opts vim.api.keyset.get_ns Optional parameters
---- • winid: (number) `window-ID` for retrieving a window's
---- highlight namespace. A value of -1 is returned when
---- `nvim_win_set_hl_ns()` has not been called for the window
---- (or was called with a namespace of -1).
---- @return integer
+--- - winid: (number) `window-ID` for retrieving a window's highlight
+--- namespace. A value of -1 is returned when `nvim_win_set_hl_ns()`
+--- has not been called for the window (or was called with a namespace
+--- of -1).
+--- @return integer # Namespace id, or -1
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 vim.api.keyset.keymap[]
+--- @return vim.api.keyset.keymap[] # Array of |maparg()|-like dictionaries describing mappings.
+--- The "buffer" key is always zero.
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`.
+--- 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`
---
+--- Note:
+--- Lowercase name (or other buffer-local mark) is an error.
+---
+--- @see vim.api.nvim_buf_set_mark
+--- @see vim.api.nvim_del_mark
--- @param name string Mark name
--- @param opts vim.api.keyset.empty Optional parameters. Reserved for future use.
---- @return vim.api.keyset.get_mark
+--- @return vim.api.keyset.get_mark # 4-tuple (row, col, buffer, buffername), (0, 0, 0, '') if the mark is
+--- not set.
function vim.api.nvim_get_mark(name, opts) end
---- Gets the current mode. `mode()` "blocking" is true if Nvim is waiting for
---- input.
+--- Gets the current mode. `mode()`
+--- "blocking" is true if Nvim is waiting for input.
---
---- @return vim.api.keyset.get_mode
+--- @return vim.api.keyset.get_mode # Dict { "mode": String, "blocking": Boolean }
function vim.api.nvim_get_mode() end
--- Gets existing, non-anonymous `namespace`s.
---
---- @return table<string,integer>
+--- @return table<string,integer> # dict that maps from names to namespace ids.
function vim.api.nvim_get_namespaces() end
--- @deprecated
@@ -1407,100 +1464,113 @@ 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')
---- • type: type of option ("string", "number" or "boolean")
---- • default: The default value for the option
---- • was_set: Whether the option was set.
---- • last_set_sid: Last set script id (if any)
---- • last_set_linenr: line number where option was set
---- • last_set_chan: Channel where option was set (0 for local)
---- • scope: one of "global", "win", or "buf"
---- • global_local: whether win or buf option has a global value
---- • commalist: List of comma separated values
---- • flaglist: List of single char flags
----
---- When {scope} is not provided, the last set information applies to the
---- local value in the current buffer or window if it is available, otherwise
---- the global value information is returned. This behavior can be disabled by
+--- Resulting dict has keys:
+--- - name: Name of the option (like 'filetype')
+--- - shortname: Shortened name of the option (like 'ft')
+--- - type: type of option ("string", "number" or "boolean")
+--- - default: The default value for the option
+--- - was_set: Whether the option was set.
+---
+--- - last_set_sid: Last set script id (if any)
+--- - last_set_linenr: line number where option was set
+--- - last_set_chan: Channel where option was set (0 for local)
+---
+--- - scope: one of "global", "win", or "buf"
+--- - global_local: whether win or buf option has a global value
+---
+--- - commalist: List of comma separated values
+--- - flaglist: List of single char flags
+---
+--- When {scope} is not provided, the last set information applies to the local
+--- value in the current buffer or window if it is available, otherwise the
+--- global value information is returned. This behavior can be disabled by
--- explicitly specifying {scope} in the {opts} table.
---
--- @param name string Option name
--- @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 getting window local options.
---- • buf: Buffer number. Used for getting buffer local options.
---- Implies {scope} is "local".
---- @return vim.api.keyset.get_option_info
+--- - scope: One of "global" or "local". Analogous to
+--- `:setglobal` and `:setlocal`, respectively.
+--- - win: `window-ID`. Used for getting window local options.
+--- - buf: Buffer number. Used for getting buffer local options.
+--- Implies {scope} is "local".
+--- @return vim.api.keyset.get_option_info # Option Information
function vim.api.nvim_get_option_info2(name, opts) end
--- 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
---- current buffer or window, unless "buf" or "win" is set in {opts}.
+--- the global value is returned. Local values always correspond to the current
+--- buffer or window, unless "buf" or "win" is set in {opts}.
---
--- @param name string Option name
--- @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 getting window local options.
---- • buf: Buffer number. Used for getting buffer local options.
---- Implies {scope} is "local".
---- • filetype: `filetype`. Used to get the default option for a
---- specific filetype. Cannot be used with any other option.
---- Note: this will trigger `ftplugin` and all `FileType`
---- autocommands for the corresponding filetype.
---- @return any
+--- - scope: One of "global" or "local". Analogous to
+--- `:setglobal` and `:setlocal`, respectively.
+--- - win: `window-ID`. Used for getting window local options.
+--- - buf: Buffer number. Used for getting buffer local options.
+--- Implies {scope} is "local".
+--- - filetype: `filetype`. Used to get the default option for a
+--- specific filetype. Cannot be used with any other option.
+--- Note: this will trigger `ftplugin` and all `FileType`
+--- autocommands for the corresponding filetype.
+--- @return any # Option value
function vim.api.nvim_get_option_value(name, opts) end
--- Gets info describing process `pid`.
---
--- @param pid integer
---- @return any
+--- @return any # Map of process properties, or NIL if process not found.
function vim.api.nvim_get_proc(pid) end
--- Gets the immediate children of process `pid`.
---
--- @param pid integer
---- @return any[]
+--- @return any[] # Array of child process ids, empty if process not found.
function vim.api.nvim_get_proc_children(pid) end
---- Find files in runtime directories
+--- Finds files in runtime directories, in 'runtimepath' order.
---
--- "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
+--- `nvim_get_runtime_file("colors/*.{vim,lua}", 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
--- @param all boolean whether to return all matches or only the first
---- @return string[]
+--- @return string[] # list of absolute paths to the found files
function vim.api.nvim_get_runtime_file(name, all) end
--- Gets a global (g:) variable.
---
--- @param name string Variable name
---- @return any
+--- @return any # Variable value
function vim.api.nvim_get_var(name) end
--- Gets a v: variable.
---
--- @param name string Variable name
---- @return any
+--- @return any # Variable value
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).
+--- 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).
+---
+--- To input blocks of text, `nvim_paste()` is much faster and should be preferred.
---
--- On execution error: does not fail, but updates v:errmsg.
---
+--- Note:
+--- |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.
+---
+---
--- @param keys string to be typed
---- @return integer
+--- @return integer # Number of bytes actually written (can be fewer than
+--- requested if the buffer becomes full).
function vim.api.nvim_input(keys) end
--- Send mouse event from GUI.
@@ -1508,15 +1578,22 @@ function vim.api.nvim_input(keys) end
--- 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", "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"
---- can all be used to specify Ctrl+Alt+click.
+--- Note:
+--- 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 |nvim_input()| has the same limitation.
+---
+---
+--- @param button string Mouse button: one of "left", "right", "middle", "wheel", "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" can all be used to specify Ctrl+Alt+click.
--- @param grid integer Grid number if the client uses `ui-multigrid`, else 0.
--- @param row integer Mouse row-position (zero-based, like redraw events)
--- @param col integer Mouse column-position (zero-based, like redraw events)
@@ -1524,35 +1601,41 @@ 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.
+--- Includes unlisted (unloaded/deleted) buffers, like `:ls!`.
+--- Use `nvim_buf_is_loaded()` to check if a buffer is loaded.
---
---- @return integer[]
+--- @return integer[] # List of buffer handles
function vim.api.nvim_list_bufs() end
--- Get information about all open channels.
---
---- @return any[]
+--- @return any[] # Array of Dictionaries, each describing a channel with
+--- the format specified at |nvim_get_chan_info()|.
function vim.api.nvim_list_chans() end
--- Gets the paths contained in `runtime-search-path`.
---
---- @return string[]
+--- @return string[] # List of paths
function vim.api.nvim_list_runtime_paths() end
--- Gets the current list of tabpage handles.
---
---- @return integer[]
+--- @return integer[] # List of tabpage handles
function vim.api.nvim_list_tabpages() end
--- Gets a list of dictionaries representing attached UIs.
---
---- @return any[]
+--- @return any[] # Array of UI dictionaries, each with these keys:
+--- - "height" Requested height of the UI
+--- - "width" Requested width of the UI
+--- - "rgb" true if the UI uses RGB colors (false implies |cterm-colors|)
+--- - "ext_..." Requested UI extensions, see |ui-option|
+--- - "chan" |channel-id| of remote UI
function vim.api.nvim_list_uis() end
--- Gets the current list of window handles.
---
---- @return integer[]
+--- @return integer[] # List of window handles
function vim.api.nvim_list_wins() end
--- Sets the current editor state from the given `context` map.
@@ -1575,210 +1658,194 @@ 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.
+--- 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()`,
---- then display it using `nvim_open_win()`, and then call this function. Then
---- `nvim_chan_send()` can be called immediately to process sequences in a
---- virtual terminal having the intended size.
+--- then display it using `nvim_open_win()`, and then call this function.
+--- Then `nvim_chan_send()` can be called immediately to process sequences
+--- in a virtual terminal having the intended size.
---
--- @param buffer integer the buffer to use (expected to be empty)
--- @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
+--- - 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 # Channel id, or 0 on error
function vim.api.nvim_open_term(buffer, opts) end
--- 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.
+--- 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`.
---
--- 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.
+--- 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.
+--- 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
---- vim.api.nvim_open_win(0, false,
---- {relative='win', row=3, col=3, width=12, height=3})
+--- vim.api.nvim_open_win(0, false,
+--- {relative='win', row=3, col=3, width=12, height=3})
--- ```
---
--- 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}})
+--- 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
---- })
+--- 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.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
---- • "win" Window given by the `win` field, or current
---- window.
---- • "cursor" Cursor position in current window.
---- • "mouse" Mouse position
---- • 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:
---- • `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
---- be fractional.
---- • focusable: Enable focus by user actions (wincmds, mouse
---- events). Defaults to true. Non-focusable windows can be
---- entered by `nvim_set_current_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
---- z-indices:
---- • 100: insert completion popupmenu
---- • 200: message scrollback
---- • 250: cmdline completion popupmenu (when
---- 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
---- options disabled. This is useful when displaying a
---- temporary float where the text should not be edited.
---- Disables 'number', 'relativenumber', 'cursorline',
---- 'cursorcolumn', 'foldcolumn', 'spell' and 'list'
---- options. 'signcolumn' is changed to `auto` and
---- 'colorcolumn' is cleared. 'statuscolumn' is changed to
---- 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.).
---- • "solid": Adds padding by a single whitespace cell.
---- • "shadow": A drop shadow effect by blending with the
---- background.
---- • If it is an array, it should have a length of eight or
---- 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"] ].
---- ```
----
---- • title: Title (optional) in window border, string or list.
---- List should consist of `[text, highlight]` tuples. If
---- string, the default highlight group is `FloatTitle`.
---- • title_pos: Title position. Must be set with `title`
---- option. Value can be one of "left", "center", or "right".
---- Default is `"left"`.
---- • footer: Footer (optional) in window border, string or
---- list. List should consist of `[text, highlight]` tuples.
---- If string, the default highlight group is `FloatFooter`.
---- • footer_pos: Footer position. Must be set with `footer`
---- option. Value can be one of "left", "center", or "right".
---- Default is `"left"`.
---- • noautocmd: If true then all autocommands are blocked for
---- the duration of the call.
---- • 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
+--- - relative: Sets the window layout to "floating", placed at (row,col)
+--- coordinates relative to:
+--- - "editor" The global editor grid
+--- - "win" Window given by the `win` field, or current window.
+--- - "cursor" Cursor position in current window.
+--- - "mouse" Mouse position
+--- - 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:
+--- - `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 be
+--- fractional.
+--- - focusable: Enable focus by user actions (wincmds, mouse events).
+--- Defaults to true. Non-focusable windows can be entered by
+--- `nvim_set_current_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 z-indices:
+--- - 100: insert completion popupmenu
+--- - 200: message scrollback
+--- - 250: cmdline completion popupmenu (when 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 options
+--- disabled. This is useful when displaying a temporary
+--- float where the text should not be edited. Disables
+--- 'number', 'relativenumber', 'cursorline', 'cursorcolumn',
+--- 'foldcolumn', 'spell' and 'list' options. 'signcolumn'
+--- is changed to `auto` and 'colorcolumn' is cleared.
+--- 'statuscolumn' is changed to 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.).
+--- - "solid": Adds padding by a single whitespace cell.
+--- - "shadow": A drop shadow effect by blending with the background.
+--- - If it is an array, it should have a length of eight or 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"] ].
+--- ```
+--- - title: Title (optional) in window border, string or list.
+--- List should consist of `[text, highlight]` tuples.
+--- If string, or a tuple lacks a highlight, the default highlight group is `FloatTitle`.
+--- - title_pos: Title position. Must be set with `title` option.
+--- Value can be one of "left", "center", or "right".
+--- Default is `"left"`.
+--- - footer: Footer (optional) in window border, string or list.
+--- List should consist of `[text, highlight]` tuples.
+--- If string, or a tuple lacks a highlight, the default highlight group is `FloatFooter`.
+--- - footer_pos: Footer position. Must be set with `footer` option.
+--- Value can be one of "left", "center", or "right".
+--- Default is `"left"`.
+--- - noautocmd: If true then all autocommands are blocked for the duration of
+--- the call.
+--- - 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 # Window handle, or 0 on error
function vim.api.nvim_open_win(buffer, enter, config) end
--- Writes a message to the Vim output buffer. Does not append "\n", the
@@ -1793,92 +1860,207 @@ function vim.api.nvim_out_write(str) end
---
--- @param str string Command line string to parse. Cannot contain "\n".
--- @param opts vim.api.keyset.empty Optional parameters. Reserved for future use.
---- @return vim.api.keyset.parse_cmd
+--- @return vim.api.keyset.parse_cmd # Dict 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 cannot take a count.
+--- - reg: (string) (optional) Command [<register>].
+--- Omitted if command cannot take a register.
+--- - bang: (boolean) Whether command contains a [<bang>] (!) modifier.
+--- - args: (array) Command arguments.
+--- - addr: (string) Value of |:command-addr|. Uses short name or "line" for -addr=lines.
+--- - nargs: (string) Value of |:command-nargs|.
+--- - nextcmd: (string) Next command if there are multiple commands separated by a |:bar|.
+--- Empty if there isn't a next command.
+--- - magic: (dict) Which characters have special meaning in the command arguments.
+--- - file: (boolean) The command expands filenames. Which means characters such as "%",
+--- "#" and wildcards are expanded.
+--- - bar: (boolean) The "|" character is treated as a command separator and the double
+--- quote character (") is treated as the start of a comment.
+--- - mods: (dict) |:command-modifiers|.
+--- - filter: (dict) |: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|.
+--- - sandbox: (boolean) |:sandbox|.
+--- - noautocmd: (boolean) |:noautocmd|.
+--- - browse: (boolean) |:browse|.
+--- - confirm: (boolean) |:confirm|.
+--- - hide: (boolean) |:hide|.
+--- - horizontal: (boolean) |:horizontal|.
+--- - keepalt: (boolean) |:keepalt|.
+--- - keepjumps: (boolean) |:keepjumps|.
+--- - keepmarks: (boolean) |:keepmarks|.
+--- - keeppatterns: (boolean) |:keeppatterns|.
+--- - lockmarks: (boolean) |:lockmarks|.
+--- - noswapfile: (boolean) |:noswapfile|.
+--- - tab: (integer) |:tab|. -1 when omitted.
+--- - verbose: (integer) |:verbose|. -1 when omitted.
+--- - vertical: (boolean) |:vertical|.
+--- - split: (string) Split modifier string, is an empty string when there's no split
+--- modifier. If there is a split modifier it can be one of:
+--- - "aboveleft": |:aboveleft|.
+--- - "belowright": |:belowright|.
+--- - "topleft": |:topleft|.
+--- - "botright": |:botright|.
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".
---- @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
---- highlighted region and represent line, starting column
---- and ending column (latter exclusive: one should highlight
---- region [start_col, end_col)).
---- @return table<string,any>
+--- - "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 highlighted region and represent line,
+--- starting column and ending column (latter exclusive:
+--- one should highlight region [start_col, end_col)).
+--- @return table<string,any> #
+--- - AST: top-level dict with these keys:
+--- - "error": Dict 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".)
+--- - "ast": AST, either nil or a dict with these keys:
+--- - "type": node type, one of the value names from ExprASTNodeType
+--- stringified without "kExprNode" prefix.
+--- - "start": a pair `[line, column]` describing where node is "started"
+--- where "line" is always 0 (will not be 0 if you will be
+--- using this API on e.g. ":let", but that is not
+--- present yet). Both elements are Integers.
+--- - "len": “length†of the node. This and "start" are there for
+--- debugging purposes primary (debugging parser and providing
+--- debug information).
+--- - "children": a list of nodes described in top/"ast". There always
+--- is zero, one or two children, key will not be present
+--- if node has no children. Maximum number of children
+--- may be found in node_maxchildren array.
+--- - Local values (present only for certain nodes):
+--- - "scope": a single Integer, specifies scope for "Option" and
+--- "PlainIdentifier" nodes. For "Option" it is one of
+--- ExprOptScope values, for "PlainIdentifier" it is one of
+--- ExprVarScope values.
+--- - "ident": identifier (without scope, if any), present for "Option",
+--- "PlainIdentifier", "PlainKey" and "Environment" nodes.
+--- - "name": Integer, register name (one character) or -1. Only present
+--- for "Register" nodes.
+--- - "cmp_type": String, comparison type, one of the value names from
+--- ExprComparisonType, stringified without "kExprCmp"
+--- prefix. Only present for "Comparison" nodes.
+--- - "ccs_strategy": String, case comparison strategy, one of the
+--- value names from ExprCaseCompareStrategy,
+--- stringified without "kCCStrategy" prefix. Only
+--- present for "Comparison" nodes.
+--- - "augmentation": String, augmentation type for "Assignment" nodes.
+--- Is either an empty string, "Add", "Subtract" or
+--- "Concat" for "=", "+=", "-=" or ".=" respectively.
+--- - "invert": Boolean, true if result of comparison needs to be
+--- inverted. Only present for "Comparison" nodes.
+--- - "ivalue": Integer, integer value for "Integer" nodes.
+--- - "fvalue": Float, floating-point value for "Float" nodes.
+--- - "svalue": String, value for "SingleQuotedString" and
+--- "DoubleQuotedString" nodes.
function vim.api.nvim_parse_expression(expr, flags, highlight) end
---- Pastes at cursor, in any mode.
+--- Pastes at cursor (in any mode), and sets "redo" so dot (`.`) will repeat the input. UIs call
+--- this to implement "paste", but it's also intended for use by scripts to input large,
+--- dot-repeatable blocks of text (as opposed to `nvim_input()` which is subject to mappings/events
+--- and is thus much slower).
+---
+--- Invokes the `vim.paste()` handler, which handles each mode appropriately.
---
---- 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 or cancel, subsequent calls
+--- are ignored ("drained") until the next paste is initiated (phase 1 or -1).
---
---- 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
---- the next paste is initiated (phase 1 or -1).
+--- Useful in mappings and scripts to insert multiline text. Example:
---
---- @param data string Multiline input. May be binary (containing NUL bytes).
+--- ```lua
+--- vim.keymap.set('n', 'x', function()
+--- vim.api.nvim_paste([[
+--- line1
+--- line2
+--- line3
+--- ]], false, -1)
+--- end, { buffer = true })
+--- ```
+---
+--- @param data string Multiline input. Lines break at LF ("\n"). 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:
---- • 1: starts the paste (exactly once)
---- • 2: continues the paste (zero or more times)
---- • 3: ends the paste (exactly once)
---- @return boolean
+--- @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:
+--- - 1: starts the paste (exactly once)
+--- - 2: continues the paste (zero or more times)
+--- - 3: ends the paste (exactly once)
+--- @return boolean #
+--- - true: Client may continue pasting.
+--- - false: Client should cancel the paste.
function vim.api.nvim_paste(data, crlf, phase) end
---- Puts text at cursor, in any mode.
+--- Puts text at cursor, in any mode. For dot-repeatable input, use `nvim_paste()`.
---
--- 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()`
+--- - "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
---- Replaces terminal codes and `keycodes` (<CR>, <Esc>, ...) in a string with
+--- Replaces terminal codes and `keycodes` ([<CR>], [<Esc>], ...) in a string with
--- the internal representation.
---
+--- @see replace_termcodes
+--- @see cpoptions
--- @param str string String to be converted.
--- @param from_part boolean Legacy Vim parameter. Usually true.
---- @param do_lt boolean Also translate <lt>. Ignored if `special` is false.
---- @param special boolean Replace `keycodes`, e.g. <CR> becomes a "\r" char.
+--- @param do_lt boolean Also translate [<lt>]. Ignored if `special` is false.
+--- @param special boolean Replace `keycodes`, e.g. [<CR>] becomes a "\r" char.
--- @return string
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
+--- 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 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 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 vim.api.keyset.empty Optional parameters. Reserved for future use.
function vim.api.nvim_select_popupmenu_item(item, insert, finish, opts) end
@@ -1909,111 +2091,118 @@ 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.
+--- 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).
+--- 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.
---- Similarly, return `false` in `on_win` will skip the `on_lines` calls for
---- that window (but any extmarks set in `on_win` will still be used). A
---- plugin managing multiple sources of decoration should ideally only set one
---- provider, and merge the sources internally. You can use multiple `ns_id`
+--- Similarly, return `false` in `on_win` will skip the `on_line` calls
+--- for that window (but any extmarks set in `on_win` will still be used).
+--- A plugin managing multiple sources of decoration should ideally only set
+--- one provider, and merge the sources internally. You can use multiple `ns_id`
--- 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: 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.
+--- 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_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, toprow, botrow]
+--- ```
+--- - 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.
---
---- • on_buf: called for each buffer being redrawn (before window
---- callbacks)
---- ```
---- ["buf", bufnr, tick]
---- ```
+--- Note:
+--- 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'.
---
---- • on_win: called when starting to redraw a specific window.
---- ```
---- ["win", winid, bufnr, topline, botline]
---- ```
+--- 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.
---
---- • 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.
+--- If `link` is used in combination with other attributes; only the
+--- `link` will take effect (see |:hi-link|).
+---
---
--- @param ns_id integer Namespace id for this highlight `nvim_create_namespace()`.
---- Use 0 to set a highlight group globally `:highlight`.
---- Highlights from non-global namespaces are not active by
---- default, use `nvim_set_hl_ns()` or `nvim_win_set_hl_ns()` to
---- activate them.
+--- Use 0 to set a highlight group globally `:highlight`.
+--- Highlights from non-global namespaces are not active by default, use
+--- `nvim_set_hl_ns()` or `nvim_win_set_hl_ns()` to 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: 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.
+--- - 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
---- be set for a single window, see `nvim_win_set_hl_ns()`.
+--- Set active namespace for highlights defined with `nvim_set_hl()`. This can be set for
+--- a single window, see `nvim_win_set_hl_ns()`.
---
--- @param ns_id integer the namespace to use
function vim.api.nvim_set_hl_ns(ns_id) end
---- Set active namespace for highlights defined with `nvim_set_hl()` while
---- redrawing.
+--- 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.
+--- `nvim_set_decoration_provider()` on_win and on_line callbacks, which
+--- are allowed to change the namespace during a redraw cycle.
---
--- @param ns_id integer the namespace to activate
function vim.api.nvim_set_hl_ns_fast(ns_id) end
@@ -2022,37 +2211,34 @@ function vim.api.nvim_set_hl_ns_fast(ns_id) end
---
--- 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.
+--- Unlike `:map`, leading/trailing whitespace is accepted as part of the {lhs} or {rhs}.
+--- Empty {rhs} is [<Nop>]. `keycodes` are replaced as usual.
---
--- Example:
---
--- ```vim
---- call nvim_set_keymap('n', ' <NL>', '', {'nowait': v:true})
+--- call nvim_set_keymap('n', ' <NL>', '', {'nowait': v:true})
--- ```
---
--- is equivalent to:
---
--- ```vim
---- nmap <nowait> <Space><NL> <Nop>
+--- 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
---- "!a" for abbreviation in Insert mode, Cmdline mode, or both,
---- respectively
+--- 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:
---- • "noremap" disables `recursive_mapping`, like `:noremap`
---- • "desc" human-readable description.
---- • "callback" Lua function called in place of {rhs}.
---- • "replace_keycodes" (boolean) When "expr" is true, replace
---- keycodes in the resulting string (see
---- `nvim_replace_termcodes()`). Returning nil from the Lua
---- "callback" is equivalent to returning an empty string.
+--- @param opts vim.api.keyset.keymap Optional parameters map: Accepts all `:map-arguments` as keys 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}.
+--- - "replace_keycodes" (boolean) When "expr" is true, replace keycodes in the
+--- resulting string (see `nvim_replace_termcodes()`). Returning nil from the Lua
+--- "callback" is equivalent to returning an empty string.
function vim.api.nvim_set_keymap(mode, lhs, rhs, opts) end
--- @deprecated
@@ -2069,10 +2255,10 @@ function vim.api.nvim_set_option(name, value) end
--- @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.
@@ -2087,11 +2273,11 @@ function vim.api.nvim_set_var(name, value) end
--- @param value any Variable value
function vim.api.nvim_set_vvar(name, value) end
---- Calculates the number of display cells occupied by `text`. Control
---- characters including <Tab> count as one cell.
+--- Calculates the number of display cells occupied by `text`.
+--- Control characters including [<Tab>] count as one cell.
---
--- @param text string Some text
---- @return integer
+--- @return integer # Number of cells
function vim.api.nvim_strwidth(text) end
--- Removes a tab-scoped (t:) variable
@@ -2103,32 +2289,32 @@ function vim.api.nvim_tabpage_del_var(tabpage, name) end
--- Gets the tabpage number
---
--- @param tabpage integer Tabpage handle, or 0 for current tabpage
---- @return integer
+--- @return integer # Tabpage number
function vim.api.nvim_tabpage_get_number(tabpage) end
--- Gets a tab-scoped (t:) variable
---
--- @param tabpage integer Tabpage handle, or 0 for current tabpage
--- @param name string Variable name
---- @return any
+--- @return any # Variable value
function vim.api.nvim_tabpage_get_var(tabpage, name) end
--- Gets the current window in a tabpage
---
--- @param tabpage integer Tabpage handle, or 0 for current tabpage
---- @return integer
+--- @return integer # Window handle
function vim.api.nvim_tabpage_get_win(tabpage) end
--- Checks if a tabpage is valid
---
--- @param tabpage integer Tabpage handle, or 0 for current tabpage
---- @return boolean
+--- @return boolean # true if the tabpage is valid, false otherwise
function vim.api.nvim_tabpage_is_valid(tabpage) end
--- Gets the windows in a tabpage
---
--- @param tabpage integer Tabpage handle, or 0 for current tabpage
---- @return integer[]
+--- @return integer[] # List of windows in `tabpage`
function vim.api.nvim_tabpage_list_wins(tabpage) end
--- Sets a tab-scoped (t:) variable
@@ -2146,18 +2332,21 @@ function vim.api.nvim_tabpage_set_win(tabpage, win) end
--- Calls a function with window as temporary current window.
---
+---
+--- @see `:help win_execute()`
+--- @see vim.api.nvim_buf_call
--- @param window integer Window handle, or 0 for current window
--- @param fun function Function to call inside the window (currently Lua callable
---- only)
---- @return any
+--- only)
+--- @return any # Return value of function.
function vim.api.nvim_win_call(window, fun) end
--- Closes the window (like `:close` with a `window-ID`).
---
--- @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
@@ -2169,7 +2358,7 @@ function vim.api.nvim_win_del_var(window, name) end
--- Gets the current buffer in a window
---
--- @param window integer Window handle, or 0 for current window
---- @return integer
+--- @return integer # Buffer handle
function vim.api.nvim_win_get_buf(window) end
--- Gets window configuration.
@@ -2179,27 +2368,29 @@ function vim.api.nvim_win_get_buf(window) end
--- `relative` is empty for normal windows.
---
--- @param window integer Window handle, or 0 for current window
---- @return vim.api.keyset.win_config
+--- @return vim.api.keyset.win_config # Map defining the window configuration, see |nvim_open_win()|
function vim.api.nvim_win_get_config(window) end
--- Gets the (1,0)-indexed, buffer-relative cursor position for a given window
--- (different windows showing the same buffer have independent cursor
--- positions). `api-indexing`
---
+---
+--- @see `:help getcurpos()`
--- @param window integer Window handle, or 0 for current window
---- @return integer[]
+--- @return integer[] # (row, col) tuple
function vim.api.nvim_win_get_cursor(window) end
--- Gets the window height
---
--- @param window integer Window handle, or 0 for current window
---- @return integer
+--- @return integer # Height as a count of rows
function vim.api.nvim_win_get_height(window) end
--- Gets the window number
---
--- @param window integer Window handle, or 0 for current window
---- @return integer
+--- @return integer # Window number
function vim.api.nvim_win_get_number(window) end
--- @deprecated
@@ -2211,34 +2402,34 @@ function vim.api.nvim_win_get_option(window, name) end
--- Gets the window position in display cells. First position is zero.
---
--- @param window integer Window handle, or 0 for current window
---- @return integer[]
+--- @return integer[] # (row, col) tuple with the window position
function vim.api.nvim_win_get_position(window) end
--- Gets the window tabpage
---
--- @param window integer Window handle, or 0 for current window
---- @return integer
+--- @return integer # Tabpage that contains the window
function vim.api.nvim_win_get_tabpage(window) end
--- Gets a window-scoped (w:) variable
---
--- @param window integer Window handle, or 0 for current window
--- @param name string Variable name
---- @return any
+--- @return any # Variable value
function vim.api.nvim_win_get_var(window, name) end
--- Gets the window width
---
--- @param window integer Window handle, or 0 for current window
---- @return integer
+--- @return integer # Width as a count of columns
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.
+--- 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.
---
--- @param window integer Window handle, or 0 for current window
function vim.api.nvim_win_hide(window) end
@@ -2246,7 +2437,7 @@ function vim.api.nvim_win_hide(window) end
--- Checks if a window is valid
---
--- @param window integer Window handle, or 0 for current window
---- @return boolean
+--- @return boolean # true if the window is valid, false otherwise
function vim.api.nvim_win_is_valid(window) end
--- Sets the current buffer in a window, without side effects
@@ -2261,12 +2452,15 @@ function vim.api.nvim_win_set_buf(window, buffer) end
--- When reconfiguring a window, absent option keys will not be changed.
--- `row`/`col` and `relative` must be reconfigured together.
---
+---
+--- @see vim.api.nvim_open_win
--- @param window integer Window handle, or 0 for current window
---- @param config vim.api.keyset.win_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
---- scrolls the window even if it is not the current one.
+--- Sets the (1,0)-indexed cursor position in the window. `api-indexing`
+--- This scrolls the window even if it is not the current one.
---
--- @param window integer Window handle, or 0 for current window
--- @param pos integer[] (row, col) tuple representing the new position
@@ -2278,9 +2472,9 @@ function vim.api.nvim_win_set_cursor(window, pos) end
--- @param height integer Height as a count of rows
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.
+--- 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.
---
@@ -2308,28 +2502,32 @@ function vim.api.nvim_win_set_var(window, name, value) end
--- @param width integer Width as a count of columns
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.
+--- 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 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.
+--- 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()`.
---
+--- @see `:help virtcol()` for text width.
--- @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.
---- @return table<string,any>
+--- - 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> # Dict containing text height information, with these keys:
+--- - all: The total number of screen lines occupied by the range.
+--- - fill: The number of diff filler or virtual lines among them.
+---
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 f7cd92a3b2..2fe5c32faf 100644
--- a/runtime/lua/vim/_meta/api_keysets.lua
+++ b/runtime/lua/vim/_meta/api_keysets.lua
@@ -197,6 +197,9 @@ error('Cannot require a meta file')
--- @field desc? string
--- @field replace_keycodes? boolean
+--- @class vim.api.keyset.ns_opts
+--- @field wins? any[]
+
--- @class vim.api.keyset.open_term
--- @field on_input? function
--- @field force_crlf? boolean
diff --git a/runtime/lua/vim/_meta/api_keysets_extra.lua b/runtime/lua/vim/_meta/api_keysets_extra.lua
index 76b56b04e7..81bce50746 100644
--- a/runtime/lua/vim/_meta/api_keysets_extra.lua
+++ b/runtime/lua/vim/_meta/api_keysets_extra.lua
@@ -23,16 +23,16 @@ error('Cannot require a meta file')
--- @field conceal? boolean
--- @field spell? boolean
--- @field ui_watched? boolean
---- @field url? boolean
+--- @field url? string
--- @field hl_mode? string
---
---- @field virt_text? {[1]: string, [2]: string}[]
+--- @field virt_text? [string, 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? [string, string][][]
--- @field virt_lines_above? boolean
--- @field virt_lines_leftcol? boolean
---
@@ -43,11 +43,17 @@ error('Cannot require a meta file')
--- @field line_hl_group? string
--- @field cursorline_hl_group? string
---- @class vim.api.keyset.get_extmark_item
+--- @class vim.api.keyset.get_extmark_item_by_id
--- @field [1] integer row
--- @field [2] integer col
--- @field [3] vim.api.keyset.extmark_details?
+--- @class vim.api.keyset.get_extmark_item
+--- @field [1] integer extmark_id
+--- @field [2] integer row
+--- @field [3] integer col
+--- @field [4] vim.api.keyset.extmark_details?
+
--- @class vim.api.keyset.get_mark
--- @field [1] integer row
--- @field [2] integer col
@@ -96,20 +102,29 @@ error('Cannot require a meta file')
--- @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
+
+--- @class vim.api.keyset.hl_info.cterm : vim.api.keyset.hl_info.base
--- @field foreground? integer
--- @field background? integer
---- @class vim.api.keyset.hl_info : vim.api.keyset.hl_info.base
+--- @class vim.api.keyset.get_hl_info : vim.api.keyset.hl_info.base
--- @field fg? integer
--- @field bg? integer
--- @field sp? integer
--- @field default? true
+--- @field blend? integer
+--- @field cterm? vim.api.keyset.hl_info.cterm
+
+--- @class vim.api.keyset.set_hl_info : vim.api.keyset.hl_info.base
+--- @field fg? integer|string
+--- @field bg? integer|string
+--- @field sp? integer|string
+--- @field default? true
--- @field link? string
--- @field blend? integer
+--- @field force? true
--- @field cterm? vim.api.keyset.hl_info.cterm
--- @class vim.api.keyset.get_mode
diff --git a/runtime/lua/vim/_meta/builtin.lua b/runtime/lua/vim/_meta/builtin.lua
index 75737bd040..13bd1c1294 100644
--- a/runtime/lua/vim/_meta/builtin.lua
+++ b/runtime/lua/vim/_meta/builtin.lua
@@ -121,6 +121,7 @@ function vim.stricmp(a, b) end
--- @param str string
--- @param index integer
--- @param use_utf16? boolean
+--- @return integer
function vim.str_byteindex(str, index, use_utf16) end
--- Gets a list of the starting byte positions of each UTF-8 codepoint in the given string.
@@ -181,8 +182,8 @@ function vim.str_utf_end(str, index) end
--- that sequence.
--- @param str string
--- @param index? integer
---- @return integer UTF-32 index
---- @return integer UTF-16 index
+--- @return integer # UTF-32 index
+--- @return integer # UTF-16 index
function vim.str_utfindex(str, index) end
--- The result is a String, which is the text {str} converted from
@@ -247,7 +248,7 @@ function vim.schedule(fn) end
--- - If {callback} errors, the error is raised.
function vim.wait(time, callback, interval, fast_only) end
---- Attach to ui events, similar to |nvim_ui_attach()| but receive events
+--- Attach to |ui-events|, similar to |nvim_ui_attach()| but receive events
--- as Lua callback. Can be used to implement screen elements like
--- popupmenu or message handling in Lua.
---
@@ -281,6 +282,8 @@ function vim.wait(time, callback, interval, fast_only) end
--- end)
--- ```
---
+--- @since 0
+---
--- @param ns integer
--- @param options table<string, any>
--- @param callback fun()
diff --git a/runtime/lua/vim/_meta/builtin_types.lua b/runtime/lua/vim/_meta/builtin_types.lua
index 9f0d2e7038..aca6649957 100644
--- a/runtime/lua/vim/_meta/builtin_types.lua
+++ b/runtime/lua/vim/_meta/builtin_types.lua
@@ -25,7 +25,7 @@
--- @field variables table<string,any>
--- @field windows integer[]
---- @alias vim.fn.getjumplist.ret {[1]: vim.fn.getjumplist.ret.item[], [2]: integer}
+--- @alias vim.fn.getjumplist.ret [vim.fn.getjumplist.ret.item[], integer]
--- @class vim.fn.getjumplist.ret.item
--- @field bufnr integer
@@ -34,6 +34,11 @@
--- @field filename? string
--- @field lnum integer
+--- @class vim.fn.getmarklist.ret.item
+--- @field mark string
+--- @field pos [integer, integer, integer, integer]
+--- @field file string
+
--- @class vim.fn.getmousepos.ret
--- @field screenrow integer
--- @field screencol integer
@@ -135,3 +140,69 @@
--- @field sid string
--- @field variables? table<string, any>
--- @field version 1
+
+--- @class vim.fn.undotree.entry
+---
+--- Undo sequence number. Same as what appears in
+--- \|:undolist|.
+--- @field seq integer
+---
+--- Timestamp when the change happened. Use
+--- \|strftime()| to convert to something readable.
+--- @field time integer
+---
+--- Only appears in the item that is the last one
+--- that was added. This marks the last change
+--- and where further changes will be added.
+--- @field newhead? integer
+---
+--- Only appears in the item that is the last one
+--- that was undone. This marks the current
+--- position in the undo tree, the block that will
+--- be used by a redo command. When nothing was
+--- undone after the last change this item will
+--- not appear anywhere.
+--- @field curhead? integer
+---
+--- Only appears on the last block before a file
+--- write. The number is the write count. The
+--- first write has number 1, the last one the
+--- "save_last" mentioned above.
+--- @field save integer
+---
+--- Alternate entry. This is again a List of undo
+--- blocks. Each item may again have an "alt"
+--- item.
+--- @field alt vim.fn.undotree.entry[]
+
+--- @class vim.fn.undotree.ret
+---
+--- The highest undo sequence number used.
+--- @field seq_last integer
+---
+--- The sequence number of the current position in
+--- the undo tree. This differs from "seq_last"
+--- when some changes were undone.
+--- @field seq_cur integer
+---
+--- Time last used for |:earlier| and related
+--- commands. Use |strftime()| to convert to
+--- something readable.
+--- @field time_cur integer
+---
+--- Number of the last file write. Zero when no
+--- write yet.
+--- @field save_last integer
+---
+--- Number of the current position in the undo
+--- tree.
+--- @field save_cur integer
+---
+--- Non-zero when the last undo block was synced.
+--- This happens when waiting from input from the
+--- user. See |undo-blocks|.
+--- @field synced integer
+---
+--- A list of dictionaries with information about
+--- undo blocks.
+--- @field entries vim.fn.undotree.entry[]
diff --git a/runtime/lua/vim/_meta/diff.lua b/runtime/lua/vim/_meta/diff.lua
index 617bc87f59..4803ed4775 100644
--- a/runtime/lua/vim/_meta/diff.lua
+++ b/runtime/lua/vim/_meta/diff.lua
@@ -11,19 +11,19 @@
--- - `count_a` (`integer`): Hunk size in {a}.
--- - `start_b` (`integer`): Start line of hunk in {b}.
--- - `count_b` (`integer`): Hunk size in {b}.
---- @field on_hunk fun(start_a: integer, count_a: integer, start_b: integer, count_b: integer): integer
+--- @field on_hunk? fun(start_a: integer, count_a: integer, start_b: integer, count_b: integer): integer?
---
--- Form of the returned diff:
--- - `unified`: String in unified format.
--- - `indices`: Array of hunk locations.
--- Note: This option is ignored if `on_hunk` is used.
--- (default: `'unified'`)
---- @field result_type 'unified'|'indices'
+--- @field result_type? 'unified'|'indices'
---
--- Run linematch on the resulting hunks from xdiff. When integer, only hunks
--- upto this size in lines are run through linematch.
--- Requires `result_type = indices`, ignored otherwise.
---- @field linematch boolean|integer
+--- @field linematch? boolean|integer
---
--- Diff algorithm to use. Values:
--- - `myers`: the default algorithm
@@ -31,15 +31,15 @@
--- - `patience`: patience diff algorithm
--- - `histogram`: histogram diff algorithm
--- (default: `'myers'`)
---- @field algorithm 'myers'|'minimal'|'patience'|'histogram'
---- @field ctxlen integer Context length
---- @field interhunkctxlen integer Inter hunk context length
---- @field ignore_whitespace boolean Ignore whitespace
---- @field ignore_whitespace_change boolean Ignore whitespace change
---- @field ignore_whitespace_change_at_eol boolean Ignore whitespace change at end-of-line.
---- @field ignore_cr_at_eol boolean Ignore carriage return at end-of-line
---- @field ignore_blank_lines boolean Ignore blank lines
---- @field indent_heuristic boolean Use the indent heuristic for the internal diff library.
+--- @field algorithm? 'myers'|'minimal'|'patience'|'histogram'
+--- @field ctxlen? integer Context length
+--- @field interhunkctxlen? integer Inter hunk context length
+--- @field ignore_whitespace? boolean Ignore whitespace
+--- @field ignore_whitespace_change? boolean Ignore whitespace change
+--- @field ignore_whitespace_change_at_eol? boolean Ignore whitespace change at end-of-line.
+--- @field ignore_cr_at_eol? boolean Ignore carriage return at end-of-line
+--- @field ignore_blank_lines? boolean Ignore blank lines
+--- @field indent_heuristic? boolean Use the indent heuristic for the internal diff library.
-- luacheck: no unused args
@@ -65,7 +65,7 @@
---
---@param a string First string to compare
---@param b string Second string to compare
----@param opts vim.diff.Opts
+---@param opts? vim.diff.Opts
---@return string|integer[][]?
--- See {opts.result_type}. `nil` if {opts.on_hunk} is given.
function vim.diff(a, b, opts) end
diff --git a/runtime/lua/vim/_meta/lpeg.lua b/runtime/lua/vim/_meta/lpeg.lua
index 73b3375c82..d354de95df 100644
--- a/runtime/lua/vim/_meta/lpeg.lua
+++ b/runtime/lua/vim/_meta/lpeg.lua
@@ -2,7 +2,7 @@
error('Cannot require a meta file')
-- These types were taken from https://github.com/LuaCATS/lpeg
--- (based on revision e6789e28e5b91a4a277a2a03081d708c403a3e34)
+-- (based on revision 33f4ff5343a64cf613a0634d70092fbc2b64291b)
-- with types being renamed to include the vim namespace and with some descriptions made less verbose.
--- @brief <pre>help
@@ -22,17 +22,18 @@ vim.lpeg = {}
--- @nodoc
--- @class vim.lpeg.Pattern
+--- @operator len: vim.lpeg.Pattern
--- @operator unm: vim.lpeg.Pattern
--- @operator add(vim.lpeg.Pattern): vim.lpeg.Pattern
--- @operator sub(vim.lpeg.Pattern): vim.lpeg.Pattern
--- @operator mul(vim.lpeg.Pattern): vim.lpeg.Pattern
--- @operator mul(vim.lpeg.Capture): vim.lpeg.Pattern
--- @operator div(string): vim.lpeg.Capture
---- @operator div(number): vim.lpeg.Capture
+--- @operator div(integer): vim.lpeg.Capture
--- @operator div(table): vim.lpeg.Capture
--- @operator div(function): vim.lpeg.Capture
---- @operator pow(number): vim.lpeg.Pattern
---- @operator mod(function): nil
+--- @operator pow(integer): vim.lpeg.Pattern
+--- @operator mod(function): vim.lpeg.Capture
local Pattern = {}
--- @alias vim.lpeg.Capture vim.lpeg.Pattern
@@ -55,11 +56,12 @@ local Pattern = {}
--- assert(pattern:match('1 hello') == nil)
--- ```
---
---- @param pattern vim.lpeg.Pattern
+--- @param pattern vim.lpeg.Pattern|string|integer|boolean|table|function
--- @param subject string
--- @param init? integer
---- @return integer|vim.lpeg.Capture|nil
-function vim.lpeg.match(pattern, subject, init) end
+--- @param ... any
+--- @return any ...
+function vim.lpeg.match(pattern, subject, init, ...) end
--- Matches the given `pattern` against the `subject` string. If the match succeeds, returns the
--- index in the subject of the first character after the match, or the captured values (if the
@@ -81,8 +83,9 @@ function vim.lpeg.match(pattern, subject, init) end
---
--- @param subject string
--- @param init? integer
---- @return integer|vim.lpeg.Capture|nil
-function Pattern:match(subject, init) end
+--- @param ... any
+--- @return any ...
+function Pattern:match(subject, init, ...) end
--- Returns the string `"pattern"` if the given value is a pattern, otherwise `nil`.
---
@@ -123,7 +126,7 @@ function vim.lpeg.P(value) end
--- Pattern `patt` must match only strings with some fixed length, and it cannot contain captures.
--- Like the `and` predicate, this pattern never consumes any input, independently of success or failure.
---
---- @param pattern vim.lpeg.Pattern
+--- @param pattern vim.lpeg.Pattern|string|integer|boolean|table
--- @return vim.lpeg.Pattern
function vim.lpeg.B(pattern) end
@@ -163,7 +166,7 @@ function vim.lpeg.S(string) end
--- assert(b:match('(') == nil)
--- ```
---
---- @param v string|integer
+--- @param v boolean|string|number|function|table|thread|userdata|lightuserdata
--- @return vim.lpeg.Pattern
function vim.lpeg.V(v) end
@@ -227,7 +230,7 @@ function vim.lpeg.locale(tab) end
--- assert(c == 'c')
--- ```
---
---- @param patt vim.lpeg.Pattern
+--- @param patt vim.lpeg.Pattern|string|integer|boolean|table|function
--- @return vim.lpeg.Capture
function vim.lpeg.C(patt) end
@@ -258,7 +261,7 @@ function vim.lpeg.Cc(...) end
--- `func(...func(func(C1, C2), C3)...,Cn)`, that is, it will fold (or accumulate, or reduce) the captures from
--- `patt` using function `func`. This capture assumes that `patt` should produce at least one capture with at
--- least one value (of any type), which becomes the initial value of an accumulator. (If you need a specific
---- initial value, you may prefix a constant captureto `patt`.) For each subsequent capture, LPeg calls `func`
+--- initial value, you may prefix a constant capture to `patt`.) For each subsequent capture, LPeg calls `func`
--- with this accumulator as the first argument and all values produced by the capture as extra arguments;
--- the first result from this call becomes the new value for the accumulator. The final value of the accumulator
--- becomes the captured value.
@@ -273,7 +276,7 @@ function vim.lpeg.Cc(...) end
--- assert(sum:match('10,30,43') == 83)
--- ```
---
---- @param patt vim.lpeg.Pattern
+--- @param patt vim.lpeg.Pattern|string|integer|boolean|table|function
--- @param func fun(acc, newvalue)
--- @return vim.lpeg.Capture
function vim.lpeg.Cf(patt, func) end
@@ -282,7 +285,7 @@ function vim.lpeg.Cf(patt, func) end
--- The group may be anonymous (if no name is given) or named with the given name (which
--- can be any non-nil Lua value).
---
---- @param patt vim.lpeg.Pattern
+--- @param patt vim.lpeg.Pattern|string|integer|boolean|table|function
--- @param name? string
--- @return vim.lpeg.Capture
function vim.lpeg.Cg(patt, name) end
@@ -320,7 +323,7 @@ function vim.lpeg.Cp() end
--- assert(gsub('Hello, xxx!', 'xxx', 'World') == 'Hello, World!')
--- ```
---
---- @param patt vim.lpeg.Pattern
+--- @param patt vim.lpeg.Pattern|string|integer|boolean|table|function
--- @return vim.lpeg.Capture
function vim.lpeg.Cs(patt) end
@@ -329,7 +332,7 @@ function vim.lpeg.Cs(patt) end
--- Moreover, for each named capture group created by `patt`, the first value of the group is put into
--- the table with the group name as its key. The captured value is only the table.
---
---- @param patt vim.lpeg.Pattern|''
+--- @param patt vim.lpeg.Pattern|string|integer|boolean|table|function
--- @return vim.lpeg.Capture
function vim.lpeg.Ct(patt) end
@@ -343,7 +346,7 @@ function vim.lpeg.Ct(patt) end
--- (so, to return true is equivalent to return `i`). If the call returns `false`, `nil`, or no value, the match fails.
--- Any extra values returned by the function become the values produced by the capture.
---
---- @param patt vim.lpeg.Pattern
---- @param fn function
+--- @param patt vim.lpeg.Pattern|string|integer|boolean|table|function
+--- @param fn fun(s: string, i: integer, ...: any): (position: boolean|integer, ...: any)
--- @return vim.lpeg.Capture
function vim.lpeg.Cmt(patt, fn) end
diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua
index 428b7c4d4f..ce3ff4f861 100644
--- a/runtime/lua/vim/_meta/options.lua
+++ b/runtime/lua/vim/_meta/options.lua
@@ -544,7 +544,7 @@ vim.wo.bri = vim.wo.breakindent
--- applying 'breakindent', even if the resulting
--- text should normally be narrower. This prevents
--- text indented almost to the right window border
---- occupying lot of vertical space when broken.
+--- occupying lots of vertical space when broken.
--- (default: 20)
--- shift:{n} After applying 'breakindent', the wrapped line's
--- beginning will be shifted by the given number of
@@ -558,9 +558,9 @@ vim.wo.bri = vim.wo.breakindent
--- list:{n} Adds an additional indent for lines that match a
--- numbered or bulleted list (using the
--- 'formatlistpat' setting).
---- list:-1 Uses the length of a match with 'formatlistpat'
---- for indentation.
--- (default: 0)
+--- list:-1 Uses the width of a match with 'formatlistpat' for
+--- indentation.
--- column:{n} Indent at column {n}. Will overrule the other
--- sub-options. Note: an additional indent may be
--- added for the 'showbreak' setting.
@@ -731,11 +731,12 @@ vim.go.cd = vim.go.cdpath
--- 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:
+--- type. The preferred way is to use `key-notation` (e.g. <Up>, <C-F>) or
+--- a letter preceded with a caret (e.g. `^F` is CTRL-F). Examples:
---
--- ```vim
---- exe "set cedit=\\<C-Y>"
---- exe "set cedit=\\<Esc>"
+--- set cedit=^Y
+--- set cedit=<Esc>
--- ```
--- `Nvi` also has this option, but it only uses the first character.
--- See `cmdwin`.
@@ -785,6 +786,20 @@ vim.bo.channel = vim.o.channel
--- v:fname_in name of the input file
--- v:fname_out name of the output file
--- Note that v:fname_in and v:fname_out will never be the same.
+---
+--- The advantage of using a function call without arguments is that it is
+--- faster, see `expr-option-function`.
+---
+--- If the 'charconvert' expression starts with s: or `<SID>`, then it is
+--- replaced with the script ID (`local-function`). Example:
+---
+--- ```vim
+--- set charconvert=s:MyConvert()
+--- set charconvert=<SID>SomeConvert()
+--- ```
+--- Otherwise the expression is evaluated in the context of the script
+--- where the option was set, thus script-local items are available.
+---
--- This option cannot be set from a `modeline` or in the `sandbox`, for
--- security reasons.
---
@@ -899,11 +914,10 @@ vim.go.cb = vim.go.clipboard
--- used. The command-line will cover the last line of the screen when
--- shown.
---
---- WARNING: `cmdheight=0` is considered experimental. Expect some
---- unwanted behaviour. Some 'shortmess' flags and similar
---- mechanism might fail to take effect, causing unwanted hit-enter
---- prompts. Some informative messages, both from Nvim itself and
---- plugins, will not be displayed.
+--- WARNING: `cmdheight=0` is EXPERIMENTAL. Expect some unwanted behaviour.
+--- Some 'shortmess' flags and similar mechanism might fail to take effect,
+--- causing unwanted hit-enter prompts. Some informative messages, both
+--- from Nvim itself and plugins, will not be displayed.
---
--- @type integer
vim.o.cmdheight = 1
@@ -974,8 +988,8 @@ vim.bo.comments = vim.o.comments
vim.bo.com = vim.bo.comments
--- A template for a comment. The "%s" in the value is replaced with the
---- comment text. For example, C uses "/*%s*/". Used for `commenting` and to
---- add markers for folding, see `fold-marker`.
+--- comment text, and should be padded with a space when possible.
+--- Used for `commenting` and to add markers for folding, see `fold-marker`.
---
--- @type string
vim.o.commentstring = ""
@@ -1040,6 +1054,19 @@ vim.o.cfu = vim.o.completefunc
vim.bo.completefunc = vim.o.completefunc
vim.bo.cfu = vim.bo.completefunc
+--- A comma-separated list of `complete-items` that controls the alignment
+--- and display order of items in the popup menu during Insert mode
+--- completion. The supported values are abbr, kind, and menu. These
+--- options allow to customize how the completion items are shown in the
+--- popup menu. Note: must always contain those three values in any
+--- order.
+---
+--- @type string
+vim.o.completeitemalign = "abbr,kind,menu"
+vim.o.cia = vim.o.completeitemalign
+vim.go.completeitemalign = vim.o.completeitemalign
+vim.go.cia = vim.go.completeitemalign
+
--- A comma-separated list of options for Insert mode completion
--- `ins-completion`. The supported values are:
---
@@ -1061,6 +1088,10 @@ vim.bo.cfu = vim.bo.completefunc
--- completion in the preview window. 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".
+---
--- 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.
@@ -1069,13 +1100,19 @@ vim.bo.cfu = vim.bo.completefunc
--- 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".
+--- fuzzy Enable `fuzzy-matching` for completion candidates. This
+--- allows for more flexible and intuitive matching, where
+--- characters can be skipped and matches can be found even
+--- if the exact sequence is not typed. Only makes a
+--- difference how completion candidates are reduced from the
+--- list of alternatives, but not how the candidates are
+--- collected (using different completion types).
---
--- @type string
vim.o.completeopt = "menu,preview"
vim.o.cot = vim.o.completeopt
+vim.bo.completeopt = vim.o.completeopt
+vim.bo.cot = vim.bo.completeopt
vim.go.completeopt = vim.o.completeopt
vim.go.cot = vim.go.completeopt
@@ -1805,9 +1842,12 @@ vim.go.ead = vim.go.eadirection
--- When on all Unicode emoji characters are considered to be full width.
--- This excludes "text emoji" characters, which are normally displayed as
---- single width. Unfortunately there is no good specification for this
---- and it has been determined on trial-and-error basis. Use the
---- `setcellwidths()` function to change the behavior.
+--- single width. However, such "text emoji" are treated as full-width
+--- emoji if they are followed by the U+FE0F variant selector.
+---
+--- Unfortunately there is no good specification for this and it has been
+--- determined on trial-and-error basis. Use the `setcellwidths()`
+--- function to change the behavior.
---
--- @type boolean
vim.o.emoji = true
@@ -2177,7 +2217,7 @@ vim.go.fic = vim.go.fileignorecase
--- ```
--- `FileType` `filetypes`
--- When a dot appears in the value then this separates two filetype
---- names. Example: >c
+--- names, it should therefore not be used for a filetype. Example: >c
--- /* vim: set filetype=c.doxygen : */
--- ```
--- This will use the "c" filetype first, then the "doxygen" filetype.
@@ -2185,7 +2225,7 @@ vim.go.fic = vim.go.fileignorecase
--- one dot may appear.
--- This option is not copied to another buffer, independent of the 's' or
--- 'S' flag in 'cpoptions'.
---- Only normal file name characters can be used, `/\*?[|<>` are illegal.
+--- Only alphanumeric characters, '-' and '_' can be used.
---
--- @type string
vim.o.filetype = ""
@@ -2500,6 +2540,9 @@ vim.wo.fdt = vim.wo.foldtext
--- This will invoke the mylang#Format() function in the
--- autoload/mylang.vim file in 'runtimepath'. `autoload`
---
+--- The advantage of using a function call without arguments is that it is
+--- faster, see `expr-option-function`.
+---
--- The expression is also evaluated when 'textwidth' is set and adding
--- text beyond that limit. This happens under the same conditions as
--- when internal formatting is used. Make sure the cursor is kept in the
@@ -3265,12 +3308,15 @@ vim.go.inc = vim.go.include
--- the script ID (`local-function`). Example:
---
--- ```vim
---- setlocal includeexpr=s:MyIncludeExpr(v:fname)
---- setlocal includeexpr=<SID>SomeIncludeExpr(v:fname)
+--- setlocal includeexpr=s:MyIncludeExpr()
+--- setlocal includeexpr=<SID>SomeIncludeExpr()
--- ```
--- Otherwise, the expression is evaluated in the context of the script
--- where the option was set, thus script-local items are available.
---
+--- It is more efficient if the value is just a function call without
+--- arguments, see `expr-option-function`.
+---
--- The expression will be evaluated in the `sandbox` when set from a
--- modeline, see `sandbox-option`.
--- This option cannot be set in a modeline when 'modelineexpr' is off.
@@ -3330,7 +3376,7 @@ vim.go.is = vim.go.incsearch
--- in Insert mode as specified with the 'indentkeys' option.
--- When this option is not empty, it overrules the 'cindent' and
--- 'smartindent' indenting. When 'lisp' is set, this option is
---- is only used when 'lispoptions' contains "expr:1".
+--- only used when 'lispoptions' contains "expr:1".
--- The expression is evaluated with `v:lnum` set to the line number for
--- which the indent is to be computed. The cursor is also in this line
--- when the expression is evaluated (but it may be moved around).
@@ -3345,6 +3391,9 @@ vim.go.is = vim.go.incsearch
--- Otherwise, the expression is evaluated in the context of the script
--- where the option was set, thus script-local items are available.
---
+--- The advantage of using a function call without arguments is that it is
+--- faster, see `expr-option-function`.
+---
--- The expression must return the number of spaces worth of indent. It
--- can return "-1" to keep the current indent (this means 'autoindent' is
--- used for the indent).
@@ -3541,8 +3590,11 @@ vim.go.js = vim.go.joinspaces
--- |alternate-file` or using `mark-motions` try to
--- restore the `mark-view` in which the action occurred.
---
+--- clean Remove unloaded buffers from the jumplist.
+--- EXPERIMENTAL: this flag may change in the future.
+---
--- @type string
-vim.o.jumpoptions = ""
+vim.o.jumpoptions = "clean"
vim.o.jop = vim.o.jumpoptions
vim.go.jumpoptions = vim.o.jumpoptions
vim.go.jop = vim.go.jumpoptions
@@ -3551,7 +3603,7 @@ vim.go.jop = vim.go.jumpoptions
--- Setting this option to a valid keymap name has the side effect of
--- setting 'iminsert' to one, so that the keymap becomes effective.
--- 'imsearch' is also set to one, unless it was -1
---- Only normal file name characters can be used, `/\*?[|<>` are illegal.
+--- Only alphanumeric characters, '.', '-' and '_' can be used.
---
--- @type string
vim.o.keymap = ""
@@ -3628,7 +3680,7 @@ vim.go.kp = vim.go.keywordprg
--- part can be in one of two forms:
--- 1. A list of pairs. Each pair is a "from" character immediately
--- followed by the "to" character. Examples: "aA", "aAbBcC".
---- 2. A list of "from" characters, a semi-colon and a list of "to"
+--- 2. A list of "from" characters, a semicolon and a list of "to"
--- characters. Example: "abc;ABC"
--- Example: "aA,fgh;FGH,cCdDeE"
--- Special characters need to be preceded with a backslash. These are
@@ -3720,7 +3772,7 @@ vim.go.ls = vim.go.laststatus
--- update use `:redraw`.
--- This may occasionally cause display errors. It is only meant to be set
--- temporarily when performing an operation where redrawing may cause
---- flickering or cause a slow down.
+--- flickering or cause a slowdown.
---
--- @type boolean
vim.o.lazyredraw = false
@@ -3820,6 +3872,9 @@ vim.go.lw = vim.go.lispwords
--- between tabs and spaces and for trailing blanks. Further changed by
--- the 'listchars' option.
---
+--- When 'listchars' does not contain "tab" field, tabs are shown as "^I"
+--- or "<09>", like how unprintable characters are displayed.
+---
--- The cursor is displayed at the start of the space a Tab character
--- occupies, not at the end as usual in Normal mode. To get this cursor
--- position while displaying Tabs with spaces, use:
@@ -4533,6 +4588,20 @@ vim.go.mouset = vim.go.mousetime
--- (without "unsigned" it would become "9-2019").
--- Using CTRL-X on "0" or CTRL-A on "18446744073709551615"
--- (2^64 - 1) has no effect, overflow is prevented.
+--- blank If included, treat numbers as signed or unsigned based on
+--- preceding whitespace. If a number with a leading dash has its
+--- dash immediately preceded by a non-whitespace character (i.e.,
+--- not a tab or a " "), the negative sign won't be considered as
+--- part of the number. For example:
+--- Using CTRL-A on "14" in "Carbon-14" results in "Carbon-15"
+--- (without "blank" it would become "Carbon-13").
+--- Using CTRL-X on "8" in "Carbon -8" results in "Carbon -9"
+--- (because -8 is preceded by whitespace. If "unsigned" was
+--- set, it would result in "Carbon -7").
+--- If this format is included, overflow is prevented as if
+--- "unsigned" were set. If both this format and "unsigned" are
+--- included, "unsigned" will take precedence.
+---
--- Numbers which simply begin with a digit in the range 1-9 are always
--- considered decimal. This also happens for numbers that are not
--- recognized as octal or hex.
@@ -4757,7 +4826,7 @@ vim.go.pm = vim.go.patchmode
--- ```
--- To use an environment variable, you probably need to replace the
--- separator. Here is an example to append $INCL, in which directory
---- names are separated with a semi-colon:
+--- names are separated with a semicolon:
---
--- ```vim
--- let &path = &path .. "," .. substitute($INCL, ';', ',', 'g')
@@ -5200,6 +5269,9 @@ vim.wo.scr = vim.wo.scroll
--- Minimum is 1, maximum is 100000.
--- Only in `terminal` buffers.
---
+--- Note: Lines that are not visible and kept in scrollback are not
+--- reflown when the terminal buffer is resized horizontally.
+---
--- @type integer
vim.o.scrollback = -1
vim.o.scbk = vim.o.scrollback
@@ -5764,7 +5836,7 @@ vim.bo.shiftwidth = vim.o.shiftwidth
vim.bo.sw = vim.bo.shiftwidth
--- This option helps to avoid all the `hit-enter` prompts caused by file
---- messages, for example with CTRL-G, and to avoid some other messages.
+--- messages, for example with CTRL-G, and to avoid some other messages.
--- It is a list of flags:
--- flag meaning when present ~
--- l use "999L, 888B" instead of "999 lines, 888 bytes" *shm-l*
@@ -5781,8 +5853,8 @@ vim.bo.sw = vim.bo.shiftwidth
--- message; also for quickfix message (e.g., ":cn")
--- s don't give "search hit BOTTOM, continuing at TOP" or *shm-s*
--- "search hit TOP, continuing at BOTTOM" messages; when using
---- the search count do not show "W" after the count message (see
---- S below)
+--- the search count do not show "W" before the count message
+--- (see `shm-S` below)
--- t truncate file message at the start if it is too long *shm-t*
--- to fit on the command-line, "<" will appear in the left most
--- column; ignored in Ex mode
@@ -5804,7 +5876,11 @@ vim.bo.sw = vim.bo.shiftwidth
--- `: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]"
+--- "[1/5]". When the "S" flag is not present (e.g. search count
+--- is shown), the "search hit BOTTOM, continuing at TOP" and
+--- "search hit TOP, continuing at BOTTOM" messages are only
+--- indicated by a "W" (Mnemonic: Wrapped) letter before the
+--- search count statistics.
---
--- This gives you the opportunity to avoid that a change between buffers
--- requires you to hit <Enter>, but still gives as useful a message as
@@ -6249,7 +6325,7 @@ vim.bo.spo = vim.bo.spelloptions
--- minus two.
---
--- timeout:{millisec} Limit the time searching for suggestions to
---- {millisec} milli seconds. Applies to the following
+--- {millisec} milliseconds. Applies to the following
--- methods. When omitted the limit is 5000. When
--- negative there is no limit.
---
@@ -6269,9 +6345,11 @@ vim.bo.spo = vim.bo.spelloptions
--- The file is used for all languages.
---
--- expr:{expr} Evaluate expression {expr}. Use a function to avoid
---- trouble with spaces. `v:val` holds the badly spelled
---- word. The expression must evaluate to a List of
---- Lists, each with a suggestion and a score.
+--- trouble with spaces. Best is to call a function
+--- without arguments, see `expr-option-function|.
+--- |v:val` holds the badly spelled word. The expression
+--- must evaluate to a List of Lists, each with a
+--- suggestion and a score.
--- Example:
--- [['the', 33], ['that', 44]] ~
--- Set 'verbose' and use `z=` to see the scores that the
@@ -6338,7 +6416,8 @@ vim.go.spr = vim.go.splitright
--- non-blank of the line. When off the cursor is kept in the same column
--- (if possible). This applies to the commands:
--- - CTRL-D, CTRL-U, CTRL-B, CTRL-F, "G", "H", "M", "L", "gg"
---- - "d", "<<" and ">>" with a linewise operator
+--- - "d", "<<", "==" and ">>" with a linewise operator
+--- (`operator-resulting-pos`)
--- - "%" with a count
--- - buffer changing commands (CTRL-^, :bnext, :bNext, etc.)
--- - Ex commands that only have a line number, e.g., ":25" or ":+".
@@ -6351,7 +6430,6 @@ vim.o.sol = vim.o.startofline
vim.go.startofline = vim.o.startofline
vim.go.sol = vim.go.startofline
---- EXPERIMENTAL
--- When non-empty, this option determines the content of the area to the
--- side of a window, normally containing the fold, sign and number columns.
--- The format of this option is like that of 'statusline'.
@@ -6359,8 +6437,7 @@ vim.go.sol = vim.go.startofline
--- Some of the items from the 'statusline' format are different for
--- 'statuscolumn':
---
---- %l line number of currently drawn line
---- %r relative line number of currently drawn line
+--- %l line number column for currently drawn line
--- %s sign column for currently drawn line
--- %C fold column for currently drawn line
---
@@ -6389,11 +6466,8 @@ vim.go.sol = vim.go.startofline
--- Examples:
---
--- ```vim
---- " Relative number with bar separator and click handlers:
---- set statuscolumn=%@SignCb@%s%=%T%@NumCb@%r│%T
----
---- " Right aligned relative cursor line number:
---- let &stc='%=%{v:relnum?v:relnum:v:lnum} '
+--- " Line number with bar separator and click handlers:
+--- set statuscolumn=%@SignCb@%s%=%T%@NumCb@%l│%T
---
--- " Line numbers in hexadecimal for non wrapped part of lines:
--- let &stc='%=%{v:virtnum>0?"":printf("%x",v:lnum)} '
@@ -6799,7 +6873,7 @@ vim.bo.smc = vim.bo.synmaxcol
--- Syntax autocommand event is triggered with the value as argument.
--- This option is not copied to another buffer, independent of the 's' or
--- 'S' flag in 'cpoptions'.
---- Only normal file name characters can be used, `/\*?[|<>` are illegal.
+--- Only alphanumeric characters, '.', '-' and '_' can be used.
---
--- @type string
vim.o.syntax = ""
@@ -6807,6 +6881,22 @@ vim.o.syn = vim.o.syntax
vim.bo.syntax = vim.o.syntax
vim.bo.syn = vim.bo.syntax
+--- This option controls the behavior when closing tab pages (e.g., using
+--- `:tabclose`). When empty Vim goes to the next (right) tab page.
+---
+--- Possible values (comma-separated list):
+--- left If included, go to the previous tab page instead of
+--- the next one.
+--- uselast If included, go to the previously used tab page if
+--- possible. This option takes precedence over the
+--- others.
+---
+--- @type string
+vim.o.tabclose = ""
+vim.o.tcl = vim.o.tabclose
+vim.go.tabclose = vim.o.tabclose
+vim.go.tcl = vim.go.tabclose
+
--- When non-empty, this option determines the content of the tab pages
--- line at the top of the Vim window. When empty Vim will use a default
--- tab pages line. See `setting-tabline` for more info.
@@ -7178,7 +7268,7 @@ vim.go.tm = vim.go.timeoutlen
--- When on, the title of the window will be set to the value of
--- 'titlestring' (if it is not empty), or to:
---- filename [+=-] (path) - NVIM
+--- filename [+=-] (path) - Nvim
--- Where:
--- filename the name of the file being edited
--- - indicates the file cannot be modified, 'ma' off
@@ -7186,7 +7276,7 @@ vim.go.tm = vim.go.timeoutlen
--- = indicates the file is read-only
--- =+ indicates the file is read-only and modified
--- (path) is the path of the file being edited
---- - NVIM the server name `v:servername` or "NVIM"
+--- - Nvim the server name `v:servername` or "Nvim"
---
--- @type boolean
vim.o.title = false
@@ -7607,9 +7697,14 @@ vim.go.ww = vim.go.whichwrap
--- 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:
+--- Although 'wc' is a number option, it can be specified as a number, a
+--- single character, a `key-notation` (e.g. <Up>, <C-F>) or a letter
+--- preceded with a caret (e.g. `^F` is CTRL-F):
---
--- ```vim
+--- :set wc=27
+--- :set wc=X
+--- :set wc=^I
--- set wc=<Tab>
--- ```
---
diff --git a/runtime/lua/vim/_meta/regex.lua b/runtime/lua/vim/_meta/regex.lua
index 595ad96319..9c9cd7d29b 100644
--- a/runtime/lua/vim/_meta/regex.lua
+++ b/runtime/lua/vim/_meta/regex.lua
@@ -5,9 +5,9 @@
--- @brief Vim regexes can be used directly from Lua. Currently they only allow
--- matching within a single line.
---- 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|.
+--- Parses the Vim regex `re` and returns 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|.
--- @param re string
--- @return vim.regex
function vim.regex(re) end
@@ -16,20 +16,22 @@ function vim.regex(re) end
--- @class vim.regex
local regex = {} -- luacheck: no unused
---- 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.
+--- Matches string `str` against this regex. To match the string precisely, surround the regex with
+--- "^" and "$". Returns the byte indices for the start and end of the match, or `nil` if there is
+--- no match. Because any integer is "truthy", `regex:match_str()` can be directly used as
+--- a condition in an if-statement.
--- @param str string
+--- @return integer? # match start (byte index), or `nil` if no match
+--- @return integer? # match end (byte index), or `nil` if no match
function regex:match_str(str) 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}.
+--- Matches line at `line_idx` (zero-based) in buffer `bufnr`. Match is restricted to byte index
+--- range `start` and `end_` if given, otherwise see |regex:match_str()|. Returned byte indices are
+--- relative to `start` if given.
--- @param bufnr integer
--- @param line_idx integer
--- @param start? integer
--- @param end_? integer
+--- @return integer? # match start (byte index) relative to `start`, or `nil` if no match
+--- @return integer? # match end (byte index) relative to `start`, or `nil` if no match
function regex:match_line(bufnr, line_idx, start, end_) end
diff --git a/runtime/lua/vim/_meta/spell.lua b/runtime/lua/vim/_meta/spell.lua
index c636db3b53..b4e3bf6ca4 100644
--- a/runtime/lua/vim/_meta/spell.lua
+++ b/runtime/lua/vim/_meta/spell.lua
@@ -20,7 +20,7 @@
--- ```
---
--- @param str string
---- @return {[1]: string, [2]: 'bad'|'rare'|'local'|'caps', [3]: integer}[]
+--- @return [string, 'bad'|'rare'|'local'|'caps', integer][]
--- List of tuples with three items:
--- - The badly spelled word.
--- - The type of the spelling error:
diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua
index f4daacfb7d..3f6deba092 100644
--- a/runtime/lua/vim/_meta/vimfn.lua
+++ b/runtime/lua/vim/_meta/vimfn.lua
@@ -15,7 +15,7 @@ error('Cannot require a meta file')
--- echo abs(-4)
--- < 4
---
---- @param expr any
+--- @param expr number
--- @return number
function vim.fn.abs(expr) end
@@ -31,7 +31,7 @@ function vim.fn.abs(expr) end
--- echo acos(-0.5)
--- < 2.094395
---
---- @param expr any
+--- @param expr number
--- @return number
function vim.fn.acos(expr) end
@@ -47,7 +47,7 @@ function vim.fn.acos(expr) end
---
--- @param object any
--- @param expr any
---- @return any
+--- @return any # Resulting |List| or |Blob|, or 1 if {object} is not a |List| or a |Blob|.
function vim.fn.add(object, expr) end
--- Bitwise AND on the two arguments. The arguments are converted
@@ -57,8 +57,8 @@ function vim.fn.add(object, expr) end
--- let flag = and(bits, 0x80)
--- <
---
---- @param expr any
---- @param expr1 any
+--- @param expr number
+--- @param expr1 number
--- @return integer
vim.fn['and'] = function(expr, expr1) end
@@ -86,7 +86,7 @@ function vim.fn.api_info() end
--- <
---
--- @param lnum integer
---- @param text any
+--- @param text string|string[]
--- @return 0|1
function vim.fn.append(lnum, text) end
@@ -110,7 +110,7 @@ function vim.fn.append(lnum, text) end
--- <However, when {text} is an empty list then no error is given
--- for an invalid {lnum}, since {lnum} isn't actually used.
---
---- @param buf any
+--- @param buf integer|string
--- @param lnum integer
--- @param text string
--- @return 0|1
@@ -195,7 +195,7 @@ function vim.fn.asin(expr) end
--- Also see |assert_fails()|, |assert_nobeep()| and
--- |assert-return|.
---
---- @param cmd any
+--- @param cmd string
--- @return 0|1
function vim.fn.assert_beeps(cmd) end
@@ -203,16 +203,17 @@ function vim.fn.assert_beeps(cmd) end
--- added to |v:errors| and 1 is returned. Otherwise zero is
--- returned. |assert-return|
--- The error is in the form "Expected {expected} but got
---- {actual}". When {msg} is present it is prefixed to that.
+--- {actual}". When {msg} is present it is prefixed to that,
+--- along with the location of the assert when run from a script.
---
--- There is no automatic conversion, the String "4" is different
--- from the Number 4. And the number 4 is different from the
--- Float 4.0. The value of 'ignorecase' is not used here, case
--- always matters.
--- Example: >vim
---- assert_equal('foo', 'bar')
---- <Will result in a string to be added to |v:errors|:
---- test.vim line 12: Expected 'foo' but got 'bar' ~
+--- call assert_equal('foo', 'bar', 'baz')
+--- <Will add the following to |v:errors|:
+--- test.vim line 12: baz: Expected 'foo' but got 'bar' ~
---
--- @param expected any
--- @param actual any
@@ -226,8 +227,10 @@ function vim.fn.assert_equal(expected, actual, msg) end
--- When {fname-one} or {fname-two} does not exist the error will
--- mention that.
---
+--- @param fname-one string
+--- @param fname-two string
--- @return 0|1
-function vim.fn.assert_equalfile() end
+function vim.fn.assert_equalfile(fname-one, fname-two) end
--- When v:exception does not contain the string {error} an error
--- message is added to |v:errors|. Also see |assert-return|.
@@ -254,25 +257,25 @@ function vim.fn.assert_exception(error, msg) end
--- When {error} is a string it must be found literally in the
--- first reported error. Most often this will be the error code,
--- including the colon, e.g. "E123:". >vim
---- assert_fails('bad cmd', 'E987:')
+--- call assert_fails('bad cmd', 'E987:')
--- <
--- When {error} is a |List| with one or two strings, these are
--- used as patterns. The first pattern is matched against the
--- first reported error: >vim
---- assert_fails('cmd', ['E987:.*expected bool'])
+--- call assert_fails('cmd', ['E987:.*expected bool'])
--- <The second pattern, if present, is matched against the last
--- reported error. To only match the last error use an empty
--- string for the first error: >vim
---- assert_fails('cmd', ['', 'E987:'])
+--- call assert_fails('cmd', ['', 'E987:'])
--- <
--- If {msg} is empty then it is not used. Do this to get the
--- default message when passing the {lnum} argument.
----
+--- *E1115*
--- When {lnum} is present and not negative, and the {error}
--- argument is present and matches, then this is compared with
--- the line number at which the error was reported. That can be
--- the line number in a function or in a script.
----
+--- *E1116*
--- When {context} is present it is used as a pattern and matched
--- against the context (script name or function name) where
--- {lnum} is located in.
@@ -280,7 +283,7 @@ function vim.fn.assert_exception(error, msg) end
--- Note that beeping is not considered an error, and some failing
--- commands only beep. Use |assert_beeps()| for those.
---
---- @param cmd any
+--- @param cmd string
--- @param error? any
--- @param msg? any
--- @param lnum? integer
@@ -291,7 +294,8 @@ function vim.fn.assert_fails(cmd, error, msg, lnum, context) end
--- When {actual} is not false an error message is added to
--- |v:errors|, like with |assert_equal()|.
--- The error is in the form "Expected False but got {actual}".
---- When {msg} is present it is prepended to that.
+--- When {msg} is present it is prefixed to that, along with the
+--- location of the assert when run from a script.
--- Also see |assert-return|.
---
--- A value is false when it is zero. When {actual} is not a
@@ -309,17 +313,18 @@ function vim.fn.assert_false(actual, msg) end
--- but got {actual}". When {msg} is present it is prefixed to
--- that.
---
---- @param lower any
---- @param upper any
---- @param actual any
---- @param msg? any
+--- @param lower number
+--- @param upper number
+--- @param actual number
+--- @param msg? string
--- @return 0|1
function vim.fn.assert_inrange(lower, upper, actual, msg) end
--- When {pattern} does not match {actual} an error message is
--- added to |v:errors|. Also see |assert-return|.
--- The error is in the form "Pattern {pattern} does not match
---- {actual}". When {msg} is present it is prefixed to that.
+--- {actual}". When {msg} is present it is prefixed to that,
+--- along with the location of the assert when run from a script.
---
--- {pattern} is used as with |expr-=~|: The matching is always done
--- like 'magic' was set and 'cpoptions' is empty, no matter what
@@ -330,13 +335,13 @@ function vim.fn.assert_inrange(lower, upper, actual, msg) end
--- Use both to match the whole text.
---
--- Example: >vim
---- assert_match('^f.*o$', 'foobar')
+--- call assert_match('^f.*o$', 'foobar')
--- <Will result in a string to be added to |v:errors|:
--- test.vim line 12: Pattern '^f.*o$' does not match 'foobar' ~
---
---- @param pattern any
---- @param actual any
---- @param msg? any
+--- @param pattern string
+--- @param actual string
+--- @param msg? string
--- @return 0|1
function vim.fn.assert_match(pattern, actual, msg) end
@@ -344,7 +349,7 @@ function vim.fn.assert_match(pattern, actual, msg) end
--- produces a beep or visual bell.
--- Also see |assert_beeps()|.
---
---- @param cmd any
+--- @param cmd string
--- @return 0|1
function vim.fn.assert_nobeep(cmd) end
@@ -362,16 +367,16 @@ function vim.fn.assert_notequal(expected, actual, msg) end
--- |v:errors| when {pattern} matches {actual}.
--- Also see |assert-return|.
---
---- @param pattern any
---- @param actual any
---- @param msg? any
+--- @param pattern string
+--- @param actual string
+--- @param msg? string
--- @return 0|1
function vim.fn.assert_notmatch(pattern, actual, msg) end
--- Report a test failure directly, using String {msg}.
--- Always returns one.
---
---- @param msg any
+--- @param msg string
--- @return 0|1
function vim.fn.assert_report(msg) end
@@ -380,10 +385,11 @@ function vim.fn.assert_report(msg) end
--- Also see |assert-return|.
--- A value is |TRUE| when it is a non-zero number or |v:true|.
--- When {actual} is not a number or |v:true| the assert fails.
---- When {msg} is given it precedes the default message.
+--- When {msg} is given it is prefixed to the default message,
+--- along with the location of the assert when run from a script.
---
--- @param actual any
---- @param msg? any
+--- @param msg? string
--- @return 0|1
function vim.fn.assert_true(actual, msg) end
@@ -397,7 +403,7 @@ function vim.fn.assert_true(actual, msg) end
--- echo atan(-4.01)
--- < -1.326405
---
---- @param expr any
+--- @param expr number
--- @return number
function vim.fn.atan(expr) end
@@ -412,8 +418,8 @@ function vim.fn.atan(expr) end
--- echo atan2(1, -1)
--- < 2.356194
---
---- @param expr1 any
---- @param expr2 any
+--- @param expr1 number
+--- @param expr2 number
--- @return number
function vim.fn.atan2(expr1, expr2) end
@@ -439,9 +445,9 @@ function vim.fn.blob2list(blob) end
--- something went wrong, or browsing is not possible.
---
--- @param save any
---- @param title any
---- @param initdir any
---- @param default any
+--- @param title string
+--- @param initdir string
+--- @param default string
--- @return 0|1
function vim.fn.browse(save, title, initdir, default) end
@@ -456,8 +462,8 @@ function vim.fn.browse(save, title, initdir, default) end
--- When the "Cancel" button is hit, something went wrong, or
--- browsing is not possible, an empty string is returned.
---
---- @param title any
---- @param initdir any
+--- @param title string
+--- @param initdir string
--- @return 0|1
function vim.fn.browsedir(title, initdir) end
@@ -729,7 +735,7 @@ function vim.fn.call(func, arglist, dict) end
---
--- Returns 0.0 if {expr} is not a |Float| or a |Number|.
---
---- @param expr any
+--- @param expr number
--- @return number
function vim.fn.ceil(expr) end
@@ -742,8 +748,8 @@ function vim.fn.ceil(expr) end
--- For a socket, there is only one stream, and {stream} should be
--- omitted.
---
---- @param id any
---- @param stream? any
+--- @param id integer
+--- @param stream? string
--- @return 0|1
function vim.fn.chanclose(id, stream) end
@@ -775,8 +781,8 @@ function vim.fn.changenr() end
--- was created with `"rpc":v:true` then the channel expects RPC
--- messages, use |rpcnotify()| and |rpcrequest()| instead.
---
---- @param id any
---- @param data any
+--- @param id number
+--- @param data string|string[]
--- @return 0|1
function vim.fn.chansend(id, data) end
@@ -820,8 +826,9 @@ function vim.fn.charclass(string) end
--- With the cursor on '세' in line 5 with text "여보세요": >vim
--- echo charcol('.') " returns 3
--- echo col('.') " returns 7
+--- <
---
---- @param expr any
+--- @param expr string|integer[]
--- @param winid? integer
--- @return integer
function vim.fn.charcol(expr, winid) end
@@ -861,8 +868,8 @@ function vim.fn.charcol(expr, winid) end
---
--- @param string string
--- @param idx integer
---- @param countcc? any
---- @param utf16? any
+--- @param countcc? boolean
+--- @param utf16? boolean
--- @return integer
function vim.fn.charidx(string, idx, countcc, utf16) end
@@ -886,6 +893,7 @@ function vim.fn.charidx(string, idx, countcc, utf16) end
--- " ... do some work
--- call chdir(save_dir)
--- endif
+--- <
---
--- @param dir string
--- @return string
@@ -907,37 +915,37 @@ function vim.fn.cindent(lnum) end
--- If {win} is specified, use the window with this number or
--- window ID instead of the current window.
---
---- @param win? any
+--- @param win? integer
function vim.fn.clearmatches(win) end
--- The result is a Number, which is the byte index of the column
---- position given with {expr}. The accepted positions are:
---- . the cursor position
---- $ the end of the cursor line (the result is the
---- number of bytes in the cursor line plus one)
---- 'x position of mark x (if the mark is not set, 0 is
---- returned)
---- v In Visual mode: the start of the Visual area (the
---- cursor is the end). When not in Visual mode
---- returns the cursor position. Differs from |'<| in
---- that it's updated right away.
+--- position given with {expr}.
+--- For accepted positions see |getpos()|.
+--- When {expr} is "$", it means the end of the cursor line, so
+--- the result is the number of bytes in the cursor line plus one.
--- Additionally {expr} can be [lnum, col]: a |List| with the line
--- and column number. Most useful when the column is "$", to get
--- the last column of a specific line. When "lnum" or "col" is
--- out of range then col() returns zero.
+---
--- With the optional {winid} argument the values are obtained for
--- that window instead of the current window.
+---
--- To get the line number use |line()|. To get both use
--- |getpos()|.
+---
--- For the screen column position use |virtcol()|. For the
--- character position use |charcol()|.
+---
--- Note that only marks in the current file can be used.
+---
--- Examples: >vim
--- echo col(".") " column of cursor
--- echo col("$") " length of cursor line plus one
--- echo col("'t") " column of mark t
--- echo col("'" .. markname) " column of mark markname
---- <The first column is 1. Returns 0 if {expr} is invalid or when
+--- <
+--- The first column is 1. Returns 0 if {expr} is invalid or when
--- the window with ID {winid} is not found.
--- For an uppercase mark the column may actually be in another
--- buffer.
@@ -946,8 +954,9 @@ function vim.fn.clearmatches(win) end
--- line. Also, when using a <Cmd> mapping the cursor isn't
--- moved, this can be used to obtain the column in Insert mode: >vim
--- imap <F2> <Cmd>echo col(".").."\n"<CR>
+--- <
---
---- @param expr any
+--- @param expr string|integer[]
--- @param winid? integer
--- @return integer
function vim.fn.col(expr, winid) end
@@ -981,8 +990,8 @@ function vim.fn.col(expr, winid) end
--- <This isn't very useful, but it shows how it works. Note that
--- an empty string is returned to avoid a zero being inserted.
---
---- @param startcol any
---- @param matches any
+--- @param startcol integer
+--- @param matches any[]
function vim.fn.complete(startcol, matches) end
--- Add {expr} to the list of matches. Only to be used by the
@@ -1065,8 +1074,9 @@ function vim.fn.complete_check() end
--- call complete_info(['mode'])
--- " Get only 'mode' and 'pum_visible'
--- call complete_info(['mode', 'pum_visible'])
+--- <
---
---- @param what? any
+--- @param what? any[]
--- @return table
function vim.fn.complete_info(what) end
@@ -1121,10 +1131,10 @@ function vim.fn.complete_info(what) end
--- don't fit, a vertical layout is used anyway. For some systems
--- the horizontal layout is always used.
---
---- @param msg any
---- @param choices? any
---- @param default? any
---- @param type? any
+--- @param msg string
+--- @param choices? string
+--- @param default? integer
+--- @param type? string
--- @return integer
function vim.fn.confirm(msg, choices, default, type) end
@@ -1150,7 +1160,7 @@ function vim.fn.copy(expr) end
--- echo cos(-4.01)
--- < -0.646043
---
---- @param expr any
+--- @param expr number
--- @return number
function vim.fn.cos(expr) end
@@ -1164,7 +1174,7 @@ function vim.fn.cos(expr) end
--- echo cosh(-0.5)
--- < -1.127626
---
---- @param expr any
+--- @param expr number
--- @return number
function vim.fn.cosh(expr) end
@@ -1180,10 +1190,10 @@ function vim.fn.cosh(expr) end
--- occurrences of {expr} is returned. Zero is returned when
--- {expr} is an empty string.
---
---- @param comp any
+--- @param comp string|table|any[]
--- @param expr any
---- @param ic? any
---- @param start? any
+--- @param ic? boolean
+--- @param start? integer
--- @return integer
function vim.fn.count(comp, expr, ic, start) end
@@ -1191,7 +1201,7 @@ function vim.fn.count(comp, expr, ic, start) end
--- from the top of the |context-stack| (see |context-dict|).
--- If {index} is not given, it is assumed to be 0 (i.e.: top).
---
---- @param index? any
+--- @param index? integer
--- @return table
function vim.fn.ctxget(index) end
@@ -1207,7 +1217,7 @@ function vim.fn.ctxpop() end
--- which |context-types| to include in the pushed context.
--- Otherwise, all context types are included.
---
---- @param types? any
+--- @param types? string[]
--- @return any
function vim.fn.ctxpush(types) end
@@ -1216,8 +1226,8 @@ function vim.fn.ctxpush(types) end
--- {context} is a Dictionary with context data (|context-dict|).
--- If {index} is not given, it is assumed to be 0 (i.e.: top).
---
---- @param context any
---- @param index? any
+--- @param context table
+--- @param index? integer
--- @return any
function vim.fn.ctxset(context, index) end
@@ -1228,7 +1238,7 @@ function vim.fn.ctxsize() end
--- @param lnum integer
--- @param col? integer
---- @param off? any
+--- @param off? integer
--- @return any
function vim.fn.cursor(lnum, col, off) end
@@ -1263,7 +1273,7 @@ function vim.fn.cursor(lnum, col, off) end
--- position within a <Tab> or after the last character.
--- Returns 0 when the position could be set, -1 otherwise.
---
---- @param list any
+--- @param list integer[]
--- @return any
function vim.fn.cursor(list) end
@@ -1275,7 +1285,7 @@ function vim.fn.cursor(list) end
--- Returns |TRUE| if successfully interrupted the program.
--- Otherwise returns |FALSE|.
---
---- @param pid any
+--- @param pid integer
--- @return any
function vim.fn.debugbreak(pid) end
@@ -1299,7 +1309,7 @@ function vim.fn.debugbreak(pid) end
--- Also see |copy()|.
---
--- @param expr any
---- @param noref? any
+--- @param noref? boolean
--- @return any
function vim.fn.deepcopy(expr, noref) end
@@ -1339,9 +1349,9 @@ function vim.fn.delete(fname, flags) end
--- when using |line()| this refers to the current buffer. Use "$"
--- to refer to the last line in buffer {buf}.
---
---- @param buf any
---- @param first any
---- @param last? any
+--- @param buf integer|string
+--- @param first integer|string
+--- @param last? integer|string
--- @return any
function vim.fn.deletebufline(buf, first, last) end
@@ -1384,9 +1394,9 @@ function vim.fn.deletebufline(buf, first, last) end
--- This function can be used by plugins to implement options with
--- validation and parsing logic.
---
---- @param dict any
---- @param pattern any
---- @param callback any
+--- @param dict table
+--- @param pattern string
+--- @param callback function
--- @return any
function vim.fn.dictwatcheradd(dict, pattern, callback) end
@@ -1395,8 +1405,8 @@ function vim.fn.dictwatcheradd(dict, pattern, callback) end
--- order for the watcher to be successfully deleted.
---
--- @param dict any
---- @param pattern any
---- @param callback any
+--- @param pattern string
+--- @param callback function
--- @return any
function vim.fn.dictwatcherdel(dict, pattern, callback) end
@@ -1457,7 +1467,7 @@ function vim.fn.diff_hlID(lnum, col) end
--- echo digraph_get('aa') " Returns 'ã‚'
--- <
---
---- @param chars any
+--- @param chars string
--- @return any
function vim.fn.digraph_get(chars) end
@@ -1475,7 +1485,7 @@ function vim.fn.digraph_get(chars) end
--- echo digraph_getlist(1)
--- <
---
---- @param listall? any
+--- @param listall? boolean
--- @return any
function vim.fn.digraph_getlist(listall) end
@@ -1495,12 +1505,9 @@ function vim.fn.digraph_getlist(listall) end
--- Example: >vim
--- call digraph_set(' ', 'ã‚')
--- <
---- Can be used as a |method|: >vim
---- GetString()->digraph_set('ã‚')
---- <
---
---- @param chars any
---- @param digraph any
+--- @param chars string
+--- @param digraph string
--- @return any
function vim.fn.digraph_set(chars, digraph) end
@@ -1518,11 +1525,7 @@ function vim.fn.digraph_set(chars, digraph) end
--- <Except that the function returns after the first error,
--- following digraphs will not be added.
---
---- Can be used as a |method|: >vim
---- GetList()->digraph_setlist()
---- <
----
---- @param digraphlist any
+--- @param digraphlist table<integer,string[]>
--- @return any
function vim.fn.digraph_setlist(digraphlist) end
@@ -1557,7 +1560,7 @@ function vim.fn.environ() end
--- <Also see |shellescape()| and |fnameescape()|.
---
--- @param string string
---- @param chars any
+--- @param chars string
--- @return any
function vim.fn.escape(string, chars) end
@@ -1582,25 +1585,32 @@ function vim.fn.eventhandler() end
--- This function checks if an executable with the name {expr}
--- exists. {expr} must be the name of the program without any
--- arguments.
+---
--- executable() uses the value of $PATH and/or the normal
---- searchpath for programs. *PATHEXT*
+--- searchpath for programs.
+--- *PATHEXT*
--- On MS-Windows the ".exe", ".bat", etc. can optionally be
--- included. Then the extensions in $PATHEXT are tried. Thus if
--- "foo.exe" does not exist, "foo.exe.bat" can be found. If
---- $PATHEXT is not set then ".exe;.com;.bat;.cmd" is used. A dot
+--- $PATHEXT is not set then ".com;.exe;.bat;.cmd" is used. A dot
--- by itself can be used in $PATHEXT to try using the name
--- without an extension. When 'shell' looks like a Unix shell,
--- then the name is also tried without adding an extension.
--- On MS-Windows it only checks if the file exists and is not a
--- directory, not if it's really executable.
---- On Windows an executable in the same directory as Vim is
---- always found (it is added to $PATH at |startup|).
+--- On MS-Windows an executable in the same directory as the Vim
+--- executable is always found (it's added to $PATH at |startup|).
+--- *NoDefaultCurrentDirectoryInExePath*
+--- On MS-Windows an executable in Vim's current working directory
+--- is also normally found, but this can be disabled by setting
+--- the $NoDefaultCurrentDirectoryInExePath environment variable.
+---
--- The result is a Number:
--- 1 exists
--- 0 does not exist
--- |exepath()| can be used to get the full path of an executable.
---
---- @param expr any
+--- @param expr string
--- @return 0|1
function vim.fn.executable(expr) end
@@ -1641,8 +1651,8 @@ function vim.fn.execute(command, silent) end
--- Returns empty string otherwise.
--- If {expr} starts with "./" the |current-directory| is used.
---
---- @param expr any
---- @return any
+--- @param expr string
+--- @return string
function vim.fn.exepath(expr) end
--- The result is a Number, which is |TRUE| if {expr} is
@@ -1733,7 +1743,7 @@ function vim.fn.exepath(expr) end
--- <This doesn't check for existence of the "bufcount" variable,
--- but gets the value of "bufcount", and checks if that exists.
---
---- @param expr any
+--- @param expr string
--- @return 0|1
function vim.fn.exists(expr) end
@@ -1747,7 +1757,7 @@ function vim.fn.exists(expr) end
--- echo exp(-1)
--- < 0.367879
---
---- @param expr any
+--- @param expr number
--- @return any
function vim.fn.exp(expr) end
@@ -1916,9 +1926,9 @@ function vim.fn.expandcmd(string, options) end
--- fails.
--- Returns {expr1}. Returns 0 on error.
---
---- @param expr1 any
---- @param expr2 any
---- @param expr3? any
+--- @param expr1 table
+--- @param expr2 table
+--- @param expr3? table
--- @return any
function vim.fn.extend(expr1, expr2, expr3) end
@@ -1926,9 +1936,9 @@ function vim.fn.extend(expr1, expr2, expr3) end
--- List or Dictionary is created and returned. {expr1} remains
--- unchanged.
---
---- @param expr1 any
---- @param expr2 any
---- @param expr3? any
+--- @param expr1 table
+--- @param expr2 table
+--- @param expr3? table
--- @return any
function vim.fn.extendnew(expr1, expr2, expr3) end
@@ -1989,6 +1999,19 @@ function vim.fn.feedkeys(string, mode) end
--- @return any
function vim.fn.file_readable(file) end
+--- Copy the file pointed to by the name {from} to {to}. The
+--- result is a Number, which is |TRUE| if the file was copied
+--- successfully, and |FALSE| when it failed.
+--- If a file with name {to} already exists, it will fail.
+--- Note that it does not handle directories (yet).
+---
+--- This function is not available in the |sandbox|.
+---
+--- @param from string
+--- @param to string
+--- @return 0|1
+function vim.fn.filecopy(from, to) end
+
--- The result is a Number, which is |TRUE| when a file with the
--- name {file} exists, and can be read. If {file} doesn't exist,
--- or is a directory, the result is |FALSE|. {file} is any
@@ -2070,8 +2093,8 @@ function vim.fn.filewritable(file) end
--- 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
+--- @param expr1 string|table
+--- @param expr2 string|function
--- @return any
function vim.fn.filter(expr1, expr2) end
@@ -2094,7 +2117,7 @@ function vim.fn.filter(expr1, expr2) end
---
--- @param name string
--- @param path? string
---- @param count? any
+--- @param count? integer
--- @return any
function vim.fn.finddir(name, path, count) end
@@ -2129,15 +2152,15 @@ function vim.fn.findfile(name, path, count) end
--- echo flatten([1, [2, [3, 4]], 5], 1)
--- < [1, 2, [3, 4], 5]
---
---- @param list any
---- @param maxdepth? any
+--- @param list any[]
+--- @param maxdepth? integer
--- @return any[]|0
function vim.fn.flatten(list, maxdepth) end
--- Like |flatten()| but first make a copy of {list}.
---
---- @param list any
---- @param maxdepth? any
+--- @param list any[]
+--- @param maxdepth? integer
--- @return any[]|0
function vim.fn.flattennew(list, maxdepth) end
@@ -2162,7 +2185,7 @@ function vim.fn.flattennew(list, maxdepth) end
--- echo float2nr(1.0e-100)
--- < 0
---
---- @param expr any
+--- @param expr number
--- @return any
function vim.fn.float2nr(expr) end
@@ -2178,7 +2201,7 @@ function vim.fn.float2nr(expr) end
--- echo floor(4.0)
--- < 4.0
---
---- @param expr any
+--- @param expr number
--- @return any
function vim.fn.floor(expr) end
@@ -2197,8 +2220,8 @@ function vim.fn.floor(expr) end
--- echo fmod(-12.33, 1.22)
--- < -0.13
---
---- @param expr1 any
---- @param expr2 any
+--- @param expr1 number
+--- @param expr2 number
--- @return any
function vim.fn.fmod(expr1, expr2) end
@@ -2343,8 +2366,8 @@ function vim.fn.foldtextresult(lnum) end
--- 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
+--- @param expr1 string|table
+--- @param expr2 string|function
--- @return any
function vim.fn.foreach(expr1, expr2) end
@@ -2486,7 +2509,7 @@ vim.fn['function'] = function(name, arglist, dict) end
--- it's safe to perform. This is when waiting for the user to
--- type a character.
---
---- @param atexit? any
+--- @param atexit? boolean
--- @return any
function vim.fn.garbagecollect(atexit) end
@@ -2523,12 +2546,25 @@ function vim.fn.get(blob, idx, default) end
--- @return any
function vim.fn.get(dict, key, default) end
---- Get item {what} from Funcref {func}. Possible values for
+--- Get item {what} from |Funcref| {func}. Possible values for
--- {what} are:
---- "name" The function name
---- "func" The function
---- "dict" The dictionary
---- "args" The list with arguments
+--- "name" The function name
+--- "func" The function
+--- "dict" The dictionary
+--- "args" The list with arguments
+--- "arity" A dictionary with information about the number of
+--- arguments accepted by the function (minus the
+--- {arglist}) with the following fields:
+--- required the number of positional arguments
+--- optional the number of optional arguments,
+--- in addition to the required ones
+--- varargs |TRUE| if the function accepts a
+--- variable number of arguments |...|
+---
+--- Note: There is no error, if the {arglist} of
+--- the Funcref contains more arguments than the
+--- Funcref expects, it's not validated.
+---
--- Returns zero on error.
---
--- @param func function
@@ -2634,8 +2670,9 @@ function vim.fn.getbufinfo(dict) end
---
--- Example: >vim
--- let lines = getbufline(bufnr("myfile"), 1, "$")
+--- <
---
---- @param buf any
+--- @param buf integer|string
--- @param lnum integer
--- @param end_? integer
--- @return any
@@ -2669,7 +2706,7 @@ function vim.fn.getbufoneline(buf, lnum) end
--- let bufmodified = getbufvar(1, "&mod")
--- echo "todo myvar = " .. getbufvar("todo", "myvar")
---
---- @param buf any
+--- @param buf integer|string
--- @param varname string
--- @param def? any
--- @return any
@@ -2766,8 +2803,9 @@ function vim.fn.getchangelist(buf) end
--- endfunction
--- <
---
+--- @param expr? 0|1
--- @return integer
-function vim.fn.getchar() end
+function vim.fn.getchar(expr) end
--- The result is a Number which is the state of the modifiers for
--- the last obtained character with getchar() or in another way.
@@ -2800,7 +2838,7 @@ function vim.fn.getcharmod() end
--- getpos('.') returns [0, 5, 7, 0]
--- <
---
---- @param expr any
+--- @param expr string
--- @return integer[]
function vim.fn.getcharpos(expr) end
@@ -2823,7 +2861,7 @@ function vim.fn.getcharpos(expr) end
--- nnoremap <expr> , getcharsearch().forward ? ',' : ';'
--- <Also see |setcharsearch()|.
---
---- @return table[]
+--- @return table
function vim.fn.getcharsearch() end
--- Get a single character from the user or input stream as a
@@ -2837,27 +2875,28 @@ function vim.fn.getcharsearch() end
--- Otherwise this works like |getchar()|, except that a number
--- result is converted to a string.
---
+--- @param expr? 0|1
--- @return string
-function vim.fn.getcharstr() end
+function vim.fn.getcharstr(expr) end
--- Return the type of the current command-line completion.
--- Only works when the command line is being edited, thus
--- requires use of |c_CTRL-\_e| or |c_CTRL-R_=|.
--- See |:command-completion| for the return string.
---- Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()| and
---- |setcmdline()|.
+--- Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()|,
+--- |getcmdprompt()| and |setcmdline()|.
--- Returns an empty string when completion is not defined.
---
--- @return string
function vim.fn.getcmdcompltype() end
---- Return the current command-line. Only works when the command
---- line is being edited, thus requires use of |c_CTRL-\_e| or
---- |c_CTRL-R_=|.
+--- Return the current command-line input. Only works when the
+--- command line is being edited, thus requires use of
+--- |c_CTRL-\_e| or |c_CTRL-R_=|.
--- Example: >vim
--- cmap <F7> <C-\>eescape(getcmdline(), ' \')<CR>
---- <Also see |getcmdtype()|, |getcmdpos()|, |setcmdpos()| and
---- |setcmdline()|.
+--- <Also see |getcmdtype()|, |getcmdpos()|, |setcmdpos()|,
+--- |getcmdprompt()| and |setcmdline()|.
--- Returns an empty string when entering a password or using
--- |inputsecret()|.
---
@@ -2869,12 +2908,22 @@ function vim.fn.getcmdline() end
--- Only works when editing the command line, thus requires use of
--- |c_CTRL-\_e| or |c_CTRL-R_=| or an expression mapping.
--- Returns 0 otherwise.
---- Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()| and
---- |setcmdline()|.
+--- Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()|,
+--- |getcmdprompt()| and |setcmdline()|.
---
--- @return integer
function vim.fn.getcmdpos() end
+--- Return the current command-line prompt when using functions
+--- like |input()| or |confirm()|.
+--- Only works when the command line is being edited, thus
+--- requires use of |c_CTRL-\_e| or |c_CTRL-R_=|.
+--- Also see |getcmdtype()|, |getcmdline()|, |getcmdpos()|,
+--- |setcmdpos()| and |setcmdline()|.
+---
+--- @return string
+function vim.fn.getcmdprompt() end
+
--- Return the screen position of the cursor in the command line
--- as a byte count. The first column is 1.
--- Instead of |getcmdpos()|, it adds the prompt position.
@@ -2927,6 +2976,7 @@ function vim.fn.getcmdwintype() end
--- customlist,{func} custom completion, defined via {func}
--- diff_buffer |:diffget| and |:diffput| completion
--- dir directory names
+--- dir_in_path directory names in |'cdpath'|
--- environment environment variable names
--- event autocommand events
--- expression Vim expression
@@ -2979,9 +3029,9 @@ function vim.fn.getcmdwintype() end
--- If there are no matches, an empty list is returned. An
--- invalid value for {type} produces an error.
---
---- @param pat any
---- @param type any
---- @param filtered? any
+--- @param pat string
+--- @param type string
+--- @param filtered? boolean
--- @return string[]
function vim.fn.getcompletion(pat, type, filtered) end
@@ -3227,7 +3277,7 @@ function vim.fn.getline(lnum, end_) end
--- <
---
--- @param nr integer
---- @param what? any
+--- @param what? table
--- @return any
function vim.fn.getloclist(nr, what) end
@@ -3249,8 +3299,8 @@ function vim.fn.getloclist(nr, what) end
--- Refer to |getpos()| for getting information about a specific
--- mark.
---
---- @param buf? any
---- @return any
+--- @param buf? integer?
+--- @return vim.fn.getmarklist.ret.item[]
function vim.fn.getmarklist(buf) end
--- Returns a |List| with all matches previously defined for the
@@ -3284,7 +3334,7 @@ function vim.fn.getmarklist(buf) end
--- unlet m
--- <
---
---- @param win? any
+--- @param win? integer
--- @return any
function vim.fn.getmatches(win) end
@@ -3327,9 +3377,34 @@ function vim.fn.getmousepos() end
--- @return integer
function vim.fn.getpid() end
---- Get the position for String {expr}. For possible values of
---- {expr} see |line()|. For getting the cursor position see
---- |getcurpos()|.
+--- Get the position for String {expr}.
+--- The accepted values for {expr} are:
+--- . The cursor position.
+--- $ The last line in the current buffer.
+--- 'x Position of mark x (if the mark is not set, 0 is
+--- returned for all values).
+--- w0 First line visible in current window (one if the
+--- display isn't updated, e.g. in silent Ex mode).
+--- w$ Last line visible in current window (this is one
+--- less than "w0" if no lines are visible).
+--- v When not in Visual mode, returns the cursor
+--- position. In Visual mode, returns the other end
+--- of the Visual area. A good way to think about
+--- this is that in Visual mode "v" and "." complement
+--- each other. While "." refers to the cursor
+--- position, "v" refers to where |v_o| would move the
+--- cursor. As a result, you can use "v" and "."
+--- together to work on all of a selection in
+--- characterwise Visual mode. If the cursor is at
+--- the end of a characterwise Visual area, "v" refers
+--- to the start of the same Visual area. And if the
+--- cursor is at the start of a characterwise Visual
+--- area, "v" refers to the end of the same Visual
+--- area. "v" differs from |'<| and |'>| in that it's
+--- updated right away.
+--- Note that a mark in another file can be used. The line number
+--- then applies to another buffer.
+---
--- The result is a |List| with four numbers:
--- [bufnum, lnum, col, off]
--- "bufnum" is zero, unless a mark like '0 or 'A is used, then it
@@ -3340,20 +3415,25 @@ function vim.fn.getpid() end
--- it is the offset in screen columns from the start of the
--- character. E.g., a position within a <Tab> or after the last
--- character.
---- Note that for '< and '> Visual mode matters: when it is "V"
---- (visual line mode) the column of '< is zero and the column of
---- '> is a large number equal to |v:maxcol|.
+---
+--- For getting the cursor position see |getcurpos()|.
--- The column number in the returned List is the byte position
--- within the line. To get the character position in the line,
--- use |getcharpos()|.
+---
+--- Note that for '< and '> Visual mode matters: when it is "V"
+--- (visual line mode) the column of '< is zero and the column of
+--- '> is a large number equal to |v:maxcol|.
--- A very large column number equal to |v:maxcol| can be returned,
--- in which case it means "after the end of the line".
--- If {expr} is invalid, returns a list with all zeros.
+---
--- This can be used to save and restore the position of a mark: >vim
--- let save_a_mark = getpos("'a")
--- " ...
--- call setpos("'a", save_a_mark)
---- <Also see |getcharpos()|, |getcurpos()| and |setpos()|.
+--- <
+--- Also see |getcharpos()|, |getcurpos()| and |setpos()|.
---
--- @param expr string
--- @return integer[]
@@ -3462,7 +3542,7 @@ function vim.fn.getpos(expr) end
--- echo getqflist({'lines' : ["F1:10:L10"]})
--- <
---
---- @param what? any
+--- @param what? table
--- @return any
function vim.fn.getqflist(what) end
@@ -3536,14 +3616,14 @@ function vim.fn.getreginfo(regname) end
--- 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
+--- type Specify the region's selection type.
+--- See |getregtype()| for possible values,
+--- except that the width can be omitted
+--- and an empty string cannot be used.
+--- (default: "v")
---
--- exclusive If |TRUE|, use exclusive selection
---- for the end position
+--- for the end position.
--- (default: follow 'selection')
---
--- You can get the last selection type by |visualmode()|.
@@ -3569,8 +3649,8 @@ function vim.fn.getreginfo(regname) end
--- difference if the buffer is displayed in a window with
--- different 'virtualedit' or 'list' values.
---
---- Examples: >
---- :xnoremap <CR>
+--- Examples: >vim
+--- xnoremap <CR>
--- \ <Cmd>echom getregion(
--- \ getpos('v'), getpos('.'), #{ type: mode() })<CR>
--- <
@@ -3777,7 +3857,7 @@ function vim.fn.gettagstack(winnr) end
--- xgettext does not understand escaping in single quoted
--- strings.
---
---- @param text any
+--- @param text string
--- @return any
function vim.fn.gettext(text) end
@@ -3904,10 +3984,10 @@ function vim.fn.getwinvar(winnr, varname, def) end
--- See |expand()| for expanding special Vim variables. See
--- |system()| for getting the raw output of an external command.
---
---- @param expr any
+--- @param expr string
--- @param nosuf? boolean
---- @param list? any
---- @param alllinks? any
+--- @param list? boolean
+--- @param alllinks? boolean
--- @return any
function vim.fn.glob(expr, nosuf, list, alllinks) end
@@ -3965,10 +4045,10 @@ function vim.fn.glob2regpat(string) end
--- supported, thus using 'path' will not always work properly.
---
--- @param path string
---- @param expr any
+--- @param expr string
--- @param nosuf? boolean
---- @param list? any
---- @param allinks? any
+--- @param list? boolean
+--- @param allinks? boolean
--- @return any
function vim.fn.globpath(path, expr, nosuf, list, allinks) end
@@ -4039,7 +4119,7 @@ function vim.fn.globpath(path, expr, nosuf, list, allinks) end
--- endif
--- <
---
---- @param feature any
+--- @param feature string
--- @return 0|1
function vim.fn.has(feature) end
@@ -4047,8 +4127,8 @@ function vim.fn.has(feature) end
--- has an entry with key {key}. FALSE otherwise. The {key}
--- argument is a string.
---
---- @param dict any
---- @param key any
+--- @param dict table
+--- @param key string
--- @return 0|1
function vim.fn.has_key(dict, key) end
@@ -4105,7 +4185,7 @@ function vim.fn.haslocaldir(winnr, tabnr) end
---
--- @param what any
--- @param mode? string
---- @param abbr? any
+--- @param abbr? boolean
--- @return 0|1
function vim.fn.hasmapto(what, mode, abbr) end
@@ -4143,7 +4223,7 @@ function vim.fn.highlight_exists(name) end
--- let date=input("Enter date: ")
--- <This function is not available in the |sandbox|.
---
---- @param history any
+--- @param history string
--- @param item any
--- @return 0|1
function vim.fn.histadd(history, item) end
@@ -4180,7 +4260,7 @@ function vim.fn.histadd(history, item) end
--- let \@/ = histget("search", -1)
--- <
---
---- @param history any
+--- @param history string
--- @param item? any
--- @return 0|1
function vim.fn.histdel(history, item) end
@@ -4200,8 +4280,8 @@ function vim.fn.histdel(history, item) end
--- command -nargs=1 H execute histget("cmd", 0+<args>)
--- <
---
---- @param history any
---- @param index? any
+--- @param history string
+--- @param index? integer|string
--- @return string
function vim.fn.histget(history, index) end
@@ -4211,8 +4291,9 @@ function vim.fn.histget(history, index) end
---
--- Example: >vim
--- let inp_index = histnr("expr")
+--- <
---
---- @param history any
+--- @param history string
--- @return integer
function vim.fn.histnr(history) end
@@ -4258,8 +4339,8 @@ function vim.fn.hostname() end
--- cannot use UCS-2 in a string anyway, because of the NUL bytes.
---
--- @param string string
---- @param from any
---- @param to any
+--- @param from string
+--- @param to string
--- @return any
function vim.fn.iconv(string, from, to) end
@@ -4270,7 +4351,7 @@ function vim.fn.iconv(string, from, to) end
--- Note that `v:_null_string`, `v:_null_list`, `v:_null_dict` and
--- `v:_null_blob` have the same `id()` with different types
--- because they are internally represented as NULL pointers.
---- `id()` returns a hexadecimal representanion of the pointers to
+--- `id()` returns a hexadecimal representation of the pointers to
--- the containers (i.e. like `0x994a40`), same as `printf("%p",
--- {expr})`, but it is advised against counting on the exact
--- format of the return value.
@@ -4318,11 +4399,12 @@ function vim.fn.indent(lnum) end
--- if index(numbers, 123) >= 0
--- " ...
--- endif
+--- <
---
--- @param object any
--- @param expr any
---- @param start? any
---- @param ic? any
+--- @param start? integer
+--- @param ic? boolean
--- @return any
function vim.fn.index(object, expr, start, ic) end
@@ -4362,6 +4444,7 @@ function vim.fn.index(object, expr, start, ic) end
--- echo indexof(l, "v:val.n == 20")
--- echo indexof(l, {i, v -> v.n == 30})
--- echo indexof(l, "v:val.n == 20", #{startidx: 1})
+--- <
---
--- @param object any
--- @param expr any
@@ -4370,9 +4453,9 @@ function vim.fn.index(object, expr, start, ic) end
function vim.fn.indexof(object, expr, opts) end
---
---- @param prompt any
---- @param text? any
---- @param completion? any
+--- @param prompt string
+--- @param text? string
+--- @param completion? string
--- @return any
function vim.fn.input(prompt, text, completion) end
@@ -4484,6 +4567,7 @@ function vim.fn.input(prompt, text, completion) end
--- let g:Foo = input("enter search pattern: ")
--- call inputrestore()
--- endfunction
+--- <
---
--- @param opts table
--- @return any
@@ -4512,7 +4596,7 @@ function vim.fn.inputdialog(...) end
--- let color = inputlist(['Select color:', '1. red',
--- \ '2. green', '3. blue'])
---
---- @param textlist any
+--- @param textlist string[]
--- @return any
function vim.fn.inputlist(textlist) end
@@ -4544,8 +4628,8 @@ function vim.fn.inputsave() end
--- typed on the command-line in response to the issued prompt.
--- NOTE: Command-line completion is not supported.
---
---- @param prompt any
---- @param text? any
+--- @param prompt string
+--- @param text? string
--- @return any
function vim.fn.inputsecret(prompt, text) end
@@ -4592,16 +4676,34 @@ function vim.fn.interrupt() end
--- let bits = invert(bits)
--- <
---
---- @param expr any
+--- @param expr number
--- @return any
function vim.fn.invert(expr) end
+--- The result is a Number, which is |TRUE| when {path} is an
+--- absolute path.
+--- On Unix, a path is considered absolute when it starts with '/'.
+--- On MS-Windows, it is considered absolute when it starts with an
+--- optional drive prefix and is followed by a '\' or '/'. UNC paths
+--- are always absolute.
+--- Example: >vim
+--- echo isabsolutepath('/usr/share/') " 1
+--- echo isabsolutepath('./foobar') " 0
+--- echo isabsolutepath('C:\Windows') " 1
+--- echo isabsolutepath('foobar') " 0
+--- echo isabsolutepath('\\remote\file') " 1
+--- <
+---
+--- @param path string
+--- @return 0|1
+function vim.fn.isabsolutepath(path) end
+
--- The result is a Number, which is |TRUE| when a directory
--- with the name {directory} exists. If {directory} doesn't
--- exist, or isn't a directory, the result is |FALSE|. {directory}
--- is any expression, which is used as a String.
---
---- @param directory any
+--- @param directory string
--- @return 0|1
function vim.fn.isdirectory(directory) end
@@ -4612,7 +4714,7 @@ function vim.fn.isdirectory(directory) end
--- echo isinf(-1.0 / 0.0)
--- < -1
---
---- @param expr any
+--- @param expr number
--- @return 1|0|-1
function vim.fn.isinf(expr) end
@@ -4637,7 +4739,7 @@ function vim.fn.islocked(expr) end
--- echo isnan(0.0 / 0.0)
--- < 1
---
---- @param expr any
+--- @param expr number
--- @return 0|1
function vim.fn.isnan(expr) end
@@ -4649,6 +4751,10 @@ function vim.fn.isnan(expr) end
--- for [key, value] in items(mydict)
--- echo key .. ': ' .. value
--- endfor
+--- <
+--- A List or a String argument is also supported. In these
+--- cases, items() returns a List with the index and the value at
+--- the index.
---
--- @param dict any
--- @return any
@@ -4663,7 +4769,7 @@ function vim.fn.jobclose(...) end
--- Return the PID (process id) of |job-id| {job}.
---
---- @param job any
+--- @param job integer
--- @return integer
function vim.fn.jobpid(job) end
@@ -4671,7 +4777,7 @@ function vim.fn.jobpid(job) end
--- columns and {height} rows.
--- Fails if the job was not started with `"pty":v:true`.
---
---- @param job any
+--- @param job integer
--- @param width integer
--- @param height integer
--- @return any
@@ -4769,7 +4875,7 @@ function vim.fn.jobsend(...) end
--- - -1 if {cmd}[0] is not executable.
--- See also |job-control|, |channel|, |msgpack-rpc|.
---
---- @param cmd any
+--- @param cmd string|string[]
--- @param opts? table
--- @return any
function vim.fn.jobstart(cmd, opts) end
@@ -4783,7 +4889,7 @@ function vim.fn.jobstart(cmd, opts) end
--- Returns 1 for valid job id, 0 for invalid id, including jobs have
--- exited or stopped.
---
---- @param id any
+--- @param id integer
--- @return any
function vim.fn.jobstop(id) end
@@ -4807,7 +4913,7 @@ function vim.fn.jobstop(id) end
--- -2 if the job was interrupted (by |CTRL-C|)
--- -3 if the job-id is invalid
---
---- @param jobs any
+--- @param jobs integer[]
--- @param timeout? integer
--- @return any
function vim.fn.jobwait(jobs, timeout) end
@@ -4822,8 +4928,8 @@ function vim.fn.jobwait(jobs, timeout) end
--- converted into a string like with |string()|.
--- The opposite function is |split()|.
---
---- @param list any
---- @param sep? any
+--- @param list any[]
+--- @param sep? string
--- @return any
function vim.fn.join(list, sep) end
@@ -4863,7 +4969,7 @@ function vim.fn.json_encode(expr) end
--- Return a |List| with all the keys of {dict}. The |List| is in
--- arbitrary order. Also see |items()| and |values()|.
---
---- @param dict any
+--- @param dict table
--- @return any
function vim.fn.keys(dict) end
@@ -4958,28 +5064,16 @@ function vim.fn.libcall(libname, funcname, argument) end
--- @return any
function vim.fn.libcallnr(libname, funcname, argument) end
---- The result is a Number, which is the line number of the file
---- position given with {expr}. The {expr} argument is a string.
---- The accepted positions are:
---- . the cursor position
---- $ the last line in the current buffer
---- 'x position of mark x (if the mark is not set, 0 is
---- returned)
---- w0 first line visible in current window (one if the
---- display isn't updated, e.g. in silent Ex mode)
---- w$ last line visible in current window (this is one
---- less than "w0" if no lines are visible)
---- v In Visual mode: the start of the Visual area (the
---- cursor is the end). When not in Visual mode
---- returns the cursor position. Differs from |'<| in
---- that it's updated right away.
---- Note that a mark in another file can be used. The line number
---- then applies to another buffer.
+--- See |getpos()| for accepted positions.
+---
--- To get the column number use |col()|. To get both use
--- |getpos()|.
+---
--- With the optional {winid} argument the values are obtained for
--- that window instead of the current window.
+---
--- Returns 0 for invalid values of {expr} and {winid}.
+---
--- Examples: >vim
--- echo line(".") " line number of the cursor
--- echo line(".", winid) " idem, in window "winid"
@@ -4989,7 +5083,7 @@ function vim.fn.libcallnr(libname, funcname, argument) end
--- To jump to the last known position when opening a file see
--- |last-position-jump|.
---
---- @param expr any
+--- @param expr string|integer[]
--- @param winid? integer
--- @return integer
function vim.fn.line(expr, winid) end
@@ -5029,7 +5123,7 @@ function vim.fn.lispindent(lnum) end
---
--- |blob2list()| does the opposite.
---
---- @param list any
+--- @param list any[]
--- @return any
function vim.fn.list2blob(list) end
@@ -5048,8 +5142,8 @@ function vim.fn.list2blob(list) end
--- <
--- Returns an empty string on error.
---
---- @param list any
---- @param utf8? any
+--- @param list any[]
+--- @param utf8? boolean
--- @return any
function vim.fn.list2str(list, utf8) end
@@ -5069,7 +5163,7 @@ function vim.fn.localtime() end
--- echo log(exp(5))
--- < 5.0
---
---- @param expr any
+--- @param expr number
--- @return any
function vim.fn.log(expr) end
@@ -5082,7 +5176,7 @@ function vim.fn.log(expr) end
--- echo log10(0.01)
--- < -2.0
---
---- @param expr any
+--- @param expr number
--- @return any
function vim.fn.log10(expr) end
@@ -5139,8 +5233,8 @@ function vim.fn.log10(expr) end
--- 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
+--- @param expr1 string|table|any[]
+--- @param expr2 string|function
--- @return any
function vim.fn.map(expr1, expr2) end
@@ -5182,6 +5276,7 @@ function vim.fn.map(expr1, expr2) end
--- "lhsrawalt" The {lhs} of the mapping as raw bytes, alternate
--- form, only present when it differs from "lhsraw"
--- "rhs" The {rhs} of the mapping as typed.
+--- "callback" Lua function, if RHS was defined as such.
--- "silent" 1 for a |:map-silent| mapping, else 0.
--- "noremap" 1 if the {rhs} of the mapping is not remappable.
--- "script" 1 if mapping was defined with <script>.
@@ -5214,6 +5309,7 @@ function vim.fn.map(expr1, expr2) end
--- This function can be used to map a key even when it's already
--- mapped, and have it do the original mapping too. Sketch: >vim
--- exe 'nnoremap <Tab> ==' .. maparg('<Tab>', 'n')
+--- <
---
--- @param name string
--- @param mode? string
@@ -5263,7 +5359,7 @@ function vim.fn.maparg(name, mode, abbr, dict) end
---
--- @param name string
--- @param mode? string
---- @param abbr? any
+--- @param abbr? boolean
--- @return any
function vim.fn.mapcheck(name, mode, abbr) end
@@ -5296,9 +5392,11 @@ function vim.fn.mapcheck(name, mode, abbr) end
--- \ {_, m -> m.lhs == 'xyzzy'})[0].mode_bits
--- ounmap xyzzy
--- echo printf("Operator-pending mode bit: 0x%x", op_bit)
+--- <
---
---- @return any
-function vim.fn.maplist() end
+--- @param abbr? 0|1
+--- @return table[]
+function vim.fn.maplist(abbr) end
--- Like |map()| but instead of replacing items in {expr1} a new
--- List or Dictionary is created and returned. {expr1} remains
@@ -5311,8 +5409,8 @@ function vim.fn.maplist() end
function vim.fn.mapnew(expr1, expr2) end
--- @param mode string
---- @param abbr? any
---- @param dict? any
+--- @param abbr? boolean
+--- @param dict? boolean
--- @return any
function vim.fn.mapset(mode, abbr, dict) end
@@ -5350,8 +5448,9 @@ function vim.fn.mapset(mode, abbr, dict) end
--- for d in save_maps
--- call mapset(d)
--- endfor
+--- <
---
---- @param dict any
+--- @param dict boolean
--- @return any
function vim.fn.mapset(dict) end
@@ -5417,10 +5516,10 @@ function vim.fn.mapset(dict) end
--- zero matches at the start instead of a number of matches
--- further down in the text.
---
---- @param expr any
---- @param pat any
---- @param start? any
---- @param count? any
+--- @param expr string|any[]
+--- @param pat string
+--- @param start? integer
+--- @param count? integer
--- @return any
function vim.fn.match(expr, pat, start, count) end
@@ -5481,20 +5580,20 @@ function vim.fn.match(expr, pat, start, count) end
--- available from |getmatches()|. All matches can be deleted in
--- one operation by |clearmatches()|.
---
---- @param group any
---- @param pattern any
---- @param priority? any
---- @param id? any
---- @param dict? any
+--- @param group integer|string
+--- @param pattern string
+--- @param priority? integer
+--- @param id? integer
+--- @param dict? string
--- @return any
function vim.fn.matchadd(group, pattern, priority, id, dict) end
--- Same as |matchadd()|, but requires a list of positions {pos}
--- instead of a pattern. This command is faster than |matchadd()|
---- because it does not require to handle regular expressions and
---- sets buffer line boundaries to redraw screen. It is supposed
---- to be used when fast match additions and deletions are
---- required, for example to highlight matching parentheses.
+--- because it does not handle regular expressions and it sets
+--- buffer line boundaries to redraw screen. It is supposed to be
+--- used when fast match additions and deletions are required, for
+--- example to highlight matching parentheses.
--- *E5030* *E5031*
--- {pos} is a list of positions. Each position can be one of
--- these:
@@ -5525,11 +5624,11 @@ function vim.fn.matchadd(group, pattern, priority, id, dict) end
--- <Matches added by |matchaddpos()| are returned by
--- |getmatches()|.
---
---- @param group any
---- @param pos any
---- @param priority? any
---- @param id? any
---- @param dict? any
+--- @param group integer|string
+--- @param pos any[]
+--- @param priority? integer
+--- @param id? integer
+--- @param dict? string
--- @return any
function vim.fn.matchaddpos(group, pos, priority, id, dict) end
@@ -5575,19 +5674,19 @@ function vim.fn.matcharg(nr) end
---
--- Examples: >vim
--- " Assuming line 3 in buffer 5 contains "a"
---- :echo matchbufline(5, '\<\k\+\>', 3, 3)
---- [{'lnum': 3, 'byteidx': 0, 'text': 'a'}]
+--- echo matchbufline(5, '\<\k\+\>', 3, 3)
+--- < `[{'lnum': 3, 'byteidx': 0, 'text': 'a'}]` >vim
--- " Assuming line 4 in buffer 10 contains "tik tok"
---- :echo matchbufline(10, '\<\k\+\>', 1, 4)
---- [{'lnum': 4, 'byteidx': 0, 'text': 'tik'}, {'lnum': 4, 'byteidx': 4, 'text': 'tok'}]
---- <
+--- echo matchbufline(10, '\<\k\+\>', 1, 4)
+--- < `[{'lnum': 4, 'byteidx': 0, 'text': 'tik'}, {'lnum': 4, 'byteidx': 4, 'text': 'tok'}]`
+---
--- If {submatch} is present and is v:true, then submatches like
--- "\1", "\2", etc. are also returned. Example: >vim
--- " Assuming line 2 in buffer 2 contains "acd"
---- :echo matchbufline(2, '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2, 2
+--- echo matchbufline(2, '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2, 2
--- \ {'submatches': v:true})
---- [{'lnum': 2, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]
---- <The "submatches" List always contains 9 items. If a submatch
+--- < `[{'lnum': 2, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]`
+--- The "submatches" List always contains 9 items. If a submatch
--- is not found, then an empty string is returned for that
--- submatch.
---
@@ -5606,8 +5705,8 @@ function vim.fn.matchbufline(buf, pat, lnum, end_, dict) end
--- If {win} is specified, use the window with this number or
--- window ID instead of the current window.
---
---- @param id any
---- @param win? any
+--- @param id integer
+--- @param win? integer
--- @return any
function vim.fn.matchdelete(id, win) end
@@ -5630,9 +5729,9 @@ function vim.fn.matchdelete(id, win) end
--- When {expr} is a |List| the result is equal to |match()|.
---
--- @param expr any
---- @param pat any
---- @param start? any
---- @param count? any
+--- @param pat string
+--- @param start? integer
+--- @param count? integer
--- @return any
function vim.fn.matchend(expr, pat, start, count) end
@@ -5698,9 +5797,9 @@ function vim.fn.matchend(expr, pat, start, count) end
--- \ {'matchseq': 1})
--- <results in `['two one']`.
---
---- @param list any
---- @param str any
---- @param dict? any
+--- @param list any[]
+--- @param str string
+--- @param dict? string
--- @return any
function vim.fn.matchfuzzy(list, str, dict) end
@@ -5725,9 +5824,9 @@ function vim.fn.matchfuzzy(list, str, dict) end
--- \ ->matchfuzzypos('ll', {'key' : 'text'})
--- <results in `[[{"id": 10, "text": "hello"}], [[2, 3]], [127]]`
---
---- @param list any
---- @param str any
---- @param dict? any
+--- @param list any[]
+--- @param str string
+--- @param dict? string
--- @return any
function vim.fn.matchfuzzypos(list, str, dict) end
@@ -5743,9 +5842,9 @@ function vim.fn.matchfuzzypos(list, str, dict) end
--- You can pass in a List, but that is not very useful.
---
--- @param expr any
---- @param pat any
---- @param start? any
---- @param count? any
+--- @param pat string
+--- @param start? integer
+--- @param count? integer
--- @return any
function vim.fn.matchlist(expr, pat, start, count) end
@@ -5762,9 +5861,9 @@ function vim.fn.matchlist(expr, pat, start, count) end
--- The type isn't changed, it's not necessarily a String.
---
--- @param expr any
---- @param pat any
---- @param start? any
---- @param count? any
+--- @param pat string
+--- @param start? integer
+--- @param count? integer
--- @return any
function vim.fn.matchstr(expr, pat, start, count) end
@@ -5786,17 +5885,17 @@ function vim.fn.matchstr(expr, pat, start, count) end
--- option settings on the pattern.
---
--- Example: >vim
---- :echo matchstrlist(['tik tok'], '\<\k\+\>')
---- [{'idx': 0, 'byteidx': 0, 'text': 'tik'}, {'idx': 0, 'byteidx': 4, 'text': 'tok'}]
---- :echo matchstrlist(['a', 'b'], '\<\k\+\>')
---- [{'idx': 0, 'byteidx': 0, 'text': 'a'}, {'idx': 1, 'byteidx': 0, 'text': 'b'}]
---- <
+--- echo matchstrlist(['tik tok'], '\<\k\+\>')
+--- < `[{'idx': 0, 'byteidx': 0, 'text': 'tik'}, {'idx': 0, 'byteidx': 4, 'text': 'tok'}]` >vim
+--- echo matchstrlist(['a', 'b'], '\<\k\+\>')
+--- < `[{'idx': 0, 'byteidx': 0, 'text': 'a'}, {'idx': 1, 'byteidx': 0, 'text': 'b'}]`
+---
--- If "submatches" is present and is v:true, then submatches like
--- "\1", "\2", etc. are also returned. Example: >vim
---- :echo matchstrlist(['acd'], '\(a\)\?\(b\)\?\(c\)\?\(.*\)',
+--- echo matchstrlist(['acd'], '\(a\)\?\(b\)\?\(c\)\?\(.*\)',
--- \ #{submatches: v:true})
---- [{'idx': 0, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]
---- <The "submatches" List always contains 9 items. If a submatch
+--- < `[{'idx': 0, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]`
+--- The "submatches" List always contains 9 items. If a submatch
--- is not found, then an empty string is returned for that
--- submatch.
---
@@ -5824,9 +5923,9 @@ function vim.fn.matchstrlist(list, pat, dict) end
--- The type isn't changed, it's not necessarily a String.
---
--- @param expr any
---- @param pat any
---- @param start? any
---- @param count? any
+--- @param pat string
+--- @param start? integer
+--- @param count? integer
--- @return any
function vim.fn.matchstrpos(expr, pat, start, count) end
@@ -5889,7 +5988,7 @@ function vim.fn.max(expr) end
--- <
---
--- @param path string
---- @param modes? any
+--- @param modes? string
--- @return any
function vim.fn.menu_get(path, modes) end
@@ -5986,17 +6085,14 @@ function vim.fn.min(expr) end
--- When {flags} is present it must be a string. An empty string
--- has no effect.
---
---- If {flags} contains "p" then intermediate directories are
---- created as necessary.
+--- {flags} can contain these character flags:
+--- "p" intermediate directories will be created as necessary
+--- "D" {name} will be deleted at the end of the current
+--- function, but not recursively |:defer|
+--- "R" {name} will be deleted recursively at the end of the
+--- current function |:defer|
---
---- If {flags} contains "D" then {name} is deleted at the end of
---- the current function, as with: >vim
---- defer delete({name}, 'd')
---- <
---- If {flags} contains "R" then {name} is deleted recursively at
---- the end of the current function, as with: >vim
---- defer delete({name}, 'rf')
---- <Note that when {name} has more than one part and "p" is used
+--- Note that when {name} has more than one part and "p" is used
--- some directories may already exist. Only the first one that
--- is created and what it contains is scheduled to be deleted.
--- E.g. when using: >vim
@@ -6025,7 +6121,7 @@ function vim.fn.min(expr) end
---
--- @param name string
--- @param flags? string
---- @param prot? any
+--- @param prot? string
--- @return any
function vim.fn.mkdir(name, flags, prot) end
@@ -6159,12 +6255,7 @@ function vim.fn.msgpackdump(list, type) end
--- C parser does not support such values.
--- float |Float|. This value cannot possibly appear in
--- |msgpackparse()| output.
---- string |readfile()|-style list of strings. This value will
---- appear in |msgpackparse()| output if string contains
---- zero byte or if string is a mapping key and mapping is
---- being represented as special dictionary for other
---- reasons.
---- binary |String|, or |Blob| if binary string contains zero
+--- string |String|, or |Blob| if binary string contains zero
--- byte. This value cannot appear in |msgpackparse()|
--- output since blobs were introduced.
--- array |List|. This value cannot appear in |msgpackparse()|
@@ -6211,8 +6302,8 @@ function vim.fn.nextnonblank(lnum) end
--- characters. nr2char(0) is a real NUL and terminates the
--- string, thus results in an empty string.
---
---- @param expr any
---- @param utf8? any
+--- @param expr integer
+--- @param utf8? boolean
--- @return any
function vim.fn.nr2char(expr, utf8) end
@@ -6227,8 +6318,8 @@ function vim.fn.nr2char(expr, utf8) end
--- to separate commands. In many places it would not be clear if
--- "|" is an operator or a command separator.
---
---- @param expr any
---- @param expr1 any
+--- @param expr number
+--- @param expr1 number
--- @return any
vim.fn['or'] = function(expr, expr1) end
@@ -6246,7 +6337,7 @@ vim.fn['or'] = function(expr, expr1) end
--- Returns an empty string on error.
---
--- @param path string
---- @param len? any
+--- @param len? integer
--- @return any
function vim.fn.pathshorten(path, len) end
@@ -6279,8 +6370,8 @@ function vim.fn.perleval(expr) end
--- echo pow(32, 0.20)
--- < 2.0
---
---- @param x any
---- @param y any
+--- @param x number
+--- @param y number
--- @return any
function vim.fn.pow(x, y) end
@@ -6618,7 +6709,7 @@ function vim.fn.prevnonblank(lnum) end
--- into this, copying the exact format string and parameters that
--- were used.
---
---- @param fmt any
+--- @param fmt string
--- @param expr1? any
--- @return string
function vim.fn.printf(fmt, expr1) end
@@ -6629,7 +6720,7 @@ function vim.fn.printf(fmt, expr1) end
--- If the buffer doesn't exist or isn't a prompt buffer, an empty
--- string is returned.
---
---- @param buf any
+--- @param buf integer|string
--- @return any
function vim.fn.prompt_getprompt(buf) end
@@ -6664,8 +6755,8 @@ function vim.fn.prompt_getprompt(buf) end
--- endfunc
--- call prompt_setcallback(bufnr(), function('s:TextEntered'))
---
---- @param buf any
---- @param expr any
+--- @param buf integer|string
+--- @param expr string|function
--- @return any
function vim.fn.prompt_setcallback(buf, expr) end
@@ -6677,8 +6768,8 @@ function vim.fn.prompt_setcallback(buf, expr) end
--- mode. Without setting a callback Vim will exit Insert mode,
--- as in any buffer.
---
---- @param buf any
---- @param expr any
+--- @param buf integer|string
+--- @param expr string|function
--- @return any
function vim.fn.prompt_setinterrupt(buf, expr) end
@@ -6689,8 +6780,8 @@ function vim.fn.prompt_setinterrupt(buf, expr) end
--- call prompt_setprompt(bufnr(''), 'command: ')
--- <
---
---- @param buf any
---- @param text any
+--- @param buf integer|string
+--- @param text string
--- @return any
function vim.fn.prompt_setprompt(buf, text) end
@@ -6766,7 +6857,7 @@ function vim.fn.pyxeval(expr) end
--- echo rand(seed) % 16 " random number 0 - 15
--- <
---
---- @param expr? any
+--- @param expr? number
--- @return any
function vim.fn.rand(expr) end
@@ -6789,8 +6880,8 @@ function vim.fn.rand(expr) end
--- <
---
--- @param expr any
---- @param max? any
---- @param stride? any
+--- @param max? integer
+--- @param stride? integer
--- @return any
function vim.fn.range(expr, max, stride) end
@@ -6818,8 +6909,8 @@ function vim.fn.range(expr, max, stride) end
--- Also see |readfile()| and |writefile()|.
---
--- @param fname string
---- @param offset? any
---- @param size? any
+--- @param offset? integer
+--- @param size? integer
--- @return any
function vim.fn.readblob(fname, offset, size) end
@@ -6852,8 +6943,8 @@ function vim.fn.readblob(fname, offset, size) end
--- <
--- Returns an empty List on error.
---
---- @param directory any
---- @param expr? any
+--- @param directory string
+--- @param expr? integer
--- @return any
function vim.fn.readdir(directory, expr) end
@@ -6890,8 +6981,8 @@ function vim.fn.readdir(directory, expr) end
--- Also see |writefile()|.
---
--- @param fname string
---- @param type? any
---- @param max? any
+--- @param type? string
+--- @param max? integer
--- @return any
function vim.fn.readfile(fname, type, max) end
@@ -6913,7 +7004,7 @@ function vim.fn.readfile(fname, type, max) end
--- <
---
--- @param object any
---- @param func any
+--- @param func function
--- @param initial? any
--- @return any
function vim.fn.reduce(object, func, initial) end
@@ -7019,9 +7110,9 @@ function vim.fn.remove(list, idx) end
--- <
--- Use |delete()| to remove a file.
---
---- @param list any
+--- @param list any[]
--- @param idx integer
---- @param end_? any
+--- @param end_? integer
--- @return any
function vim.fn.remove(list, idx, end_) end
@@ -7044,7 +7135,7 @@ function vim.fn.remove(blob, idx) end
---
--- @param blob any
--- @param idx integer
---- @param end_? any
+--- @param end_? integer
--- @return any
function vim.fn.remove(blob, idx, end_) end
@@ -7055,7 +7146,7 @@ function vim.fn.remove(blob, idx, end_) end
--- Returns zero on error.
---
--- @param dict any
---- @param key any
+--- @param key string
--- @return any
function vim.fn.remove(dict, key) end
@@ -7066,8 +7157,8 @@ function vim.fn.remove(dict, key) end
--- NOTE: If {to} exists it is overwritten without warning.
--- This function is not available in the |sandbox|.
---
---- @param from any
---- @param to any
+--- @param from string
+--- @param to string
--- @return any
function vim.fn.rename(from, to) end
@@ -7081,7 +7172,7 @@ function vim.fn.rename(from, to) end
--- <Results in ['a', 'b', 'a', 'b', 'a', 'b'].
---
--- @param expr any
---- @param count any
+--- @param count integer
--- @return any
vim.fn['repeat'] = function(expr, count) end
@@ -7097,7 +7188,7 @@ vim.fn['repeat'] = function(expr, count) end
--- current directory (provided the result is still a relative
--- path name) and also keeps a trailing path separator.
---
---- @param filename any
+--- @param filename string
--- @return any
function vim.fn.resolve(filename) end
@@ -7128,7 +7219,7 @@ function vim.fn.reverse(object) end
--- echo round(-4.5)
--- < -5.0
---
---- @param expr any
+--- @param expr number
--- @return any
function vim.fn.round(expr) end
@@ -7138,8 +7229,8 @@ function vim.fn.round(expr) end
--- au VimLeave call rpcnotify(0, "leaving")
--- <
---
---- @param channel any
---- @param event any
+--- @param channel integer
+--- @param event string
--- @param args? any
--- @return any
function vim.fn.rpcnotify(channel, event, args) end
@@ -7150,19 +7241,20 @@ function vim.fn.rpcnotify(channel, event, args) end
--- let result = rpcrequest(rpc_chan, "func", 1, 2, 3)
--- <
---
---- @param channel any
---- @param method any
+--- @param channel integer
+--- @param method string
--- @param args? any
--- @return any
function vim.fn.rpcrequest(channel, method, args) end
+--- @deprecated
--- Deprecated. Replace >vim
--- let id = rpcstart('prog', ['arg1', 'arg2'])
--- <with >vim
--- let id = jobstart(['prog', 'arg1', 'arg2'], {'rpc': v:true})
--- <
---
---- @param prog any
+--- @param prog string
--- @param argv? any
--- @return any
function vim.fn.rpcstart(prog, argv) end
@@ -7195,7 +7287,7 @@ function vim.fn.rubyeval(expr) end
--- attribute at other positions.
--- Returns -1 when row or col is out of range.
---
---- @param row any
+--- @param row integer
--- @param col integer
--- @return any
function vim.fn.screenattr(row, col) end
@@ -7209,7 +7301,7 @@ function vim.fn.screenattr(row, col) end
--- This is mainly to be used for testing.
--- Returns -1 when row or col is out of range.
---
---- @param row any
+--- @param row integer
--- @param col integer
--- @return any
function vim.fn.screenchar(row, col) end
@@ -7220,7 +7312,7 @@ function vim.fn.screenchar(row, col) end
--- This is mainly to be used for testing.
--- Returns an empty List when row or col is out of range.
---
---- @param row any
+--- @param row integer
--- @param col integer
--- @return any
function vim.fn.screenchars(row, col) end
@@ -7236,7 +7328,7 @@ function vim.fn.screenchars(row, col) end
--- the following mappings: >vim
--- nnoremap <expr> GG ":echom " .. screencol() .. "\n"
--- nnoremap <silent> GG :echom screencol()<CR>
---- noremap GG <Cmd>echom screencol()<Cr>
+--- noremap GG <Cmd>echom screencol()<CR>
--- <
---
--- @return any
@@ -7288,7 +7380,7 @@ function vim.fn.screenrow() end
--- This is mainly to be used for testing.
--- Returns an empty String when row or col is out of range.
---
---- @param row any
+--- @param row integer
--- @param col integer
--- @return any
function vim.fn.screenstring(row, col) end
@@ -7347,6 +7439,9 @@ function vim.fn.screenstring(row, col) end
--- The value must not be negative. A zero value is like not
--- giving the argument.
---
+--- Note: the timeout is only considered when searching, not
+--- while evaluating the {skip} expression.
+---
--- If the {skip} expression is given it is evaluated with the
--- cursor positioned on the start of a match. If it evaluates to
--- non-zero this match is skipped. This can be used, for
@@ -7394,11 +7489,11 @@ function vim.fn.screenstring(row, col) end
--- without the 'e' flag if the cursor is on the "f" of "if".
--- The 'n' flag tells the function not to move the cursor.
---
---- @param pattern any
+--- @param pattern string
--- @param flags? string
---- @param stopline? any
+--- @param stopline? integer
--- @param timeout? integer
---- @param skip? any
+--- @param skip? string|function
--- @return any
function vim.fn.search(pattern, flags, stopline, timeout, skip) end
@@ -7545,8 +7640,8 @@ function vim.fn.searchcount(options) end
--- <
---
--- @param name string
---- @param global? any
---- @param thisblock? any
+--- @param global? boolean
+--- @param thisblock? boolean
--- @return any
function vim.fn.searchdecl(name, global, thisblock) end
@@ -7634,8 +7729,15 @@ function vim.fn.searchdecl(name, global, thisblock) end
--- \ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string"')
--- <
---
---- @return any
-function vim.fn.searchpair() end
+--- @param start string
+--- @param middle string
+--- @param end_ string
+--- @param flags? string
+--- @param skip? string|function
+--- @param stopline? integer
+--- @param timeout? integer
+--- @return integer
+function vim.fn.searchpair(start, middle, end_, flags, skip, stopline, timeout) end
--- Same as |searchpair()|, but returns a |List| with the line and
--- column position of the match. The first element of the |List|
@@ -7647,8 +7749,15 @@ function vim.fn.searchpair() end
--- <
--- See |match-parens| for a bigger and more useful example.
---
---- @return any
-function vim.fn.searchpairpos() end
+--- @param start string
+--- @param middle string
+--- @param end_ string
+--- @param flags? string
+--- @param skip? string|function
+--- @param stopline? integer
+--- @param timeout? integer
+--- @return [integer, integer]
+function vim.fn.searchpairpos(start, middle, end_, flags, skip, stopline, timeout) end
--- Same as |search()|, but returns a |List| with the line and
--- column position of the match. The first element of the |List|
@@ -7664,11 +7773,11 @@ function vim.fn.searchpairpos() end
--- <In this example "submatch" is 2 when a lowercase letter is
--- found |/\l|, 3 when an uppercase letter is found |/\u|.
---
---- @param pattern any
+--- @param pattern string
--- @param flags? string
---- @param stopline? any
+--- @param stopline? integer
--- @param timeout? integer
---- @param skip? any
+--- @param skip? string|function
--- @return any
function vim.fn.searchpos(pattern, flags, stopline, timeout, skip) end
@@ -7714,7 +7823,7 @@ function vim.fn.serverlist() end
--- echo serverstart('::1:12345')
--- <
---
---- @param address? any
+--- @param address? string
--- @return any
function vim.fn.serverstart(address) end
@@ -7723,7 +7832,7 @@ function vim.fn.serverstart(address) end
--- If |v:servername| is stopped it is set to the next available
--- address in |serverlist()|.
---
---- @param address any
+--- @param address string
--- @return any
function vim.fn.serverstop(address) end
@@ -7751,9 +7860,9 @@ function vim.fn.serverstop(address) end
--- If {buf} is not a valid buffer or {lnum} is not valid, an
--- error message is given.
---
---- @param buf any
+--- @param buf integer|string
--- @param lnum integer
---- @param text any
+--- @param text string|string[]
--- @return any
function vim.fn.setbufline(buf, lnum, text) end
@@ -7770,7 +7879,7 @@ function vim.fn.setbufline(buf, lnum, text) end
--- call setbufvar("todo", "myvar", "foobar")
--- <This function is not available in the |sandbox|.
---
---- @param buf any
+--- @param buf integer|string
--- @param varname string
--- @param val any
--- @return any
@@ -7803,13 +7912,13 @@ function vim.fn.setbufvar(buf, varname, val) end
--- To clear the overrides pass an empty {list}: >vim
--- call setcellwidths([])
---
---- <You can use the script $VIMRUNTIME/tools/emoji_list.vim to see
+--- <You can use the script $VIMRUNTIME/tools/emoji_list.lua to see
--- the effect for known emoji characters. Move the cursor
--- through the text to check if the cell widths of your terminal
--- match with what Vim knows about each emoji. If it doesn't
--- look right you need to adjust the {list} argument.
---
---- @param list any
+--- @param list any[]
--- @return any
function vim.fn.setcellwidths(list) end
@@ -7823,8 +7932,8 @@ function vim.fn.setcellwidths(list) end
--- call setpos('.', [0, 8, 4, 0])
--- <positions the cursor on the second character 'ë³´'.
---
---- @param expr any
---- @param list any
+--- @param expr string
+--- @param list integer[]
--- @return any
function vim.fn.setcharpos(expr, list) end
@@ -7847,7 +7956,7 @@ function vim.fn.setcharpos(expr, list) end
--- call setcharsearch(prevsearch)
--- <Also see |getcharsearch()|.
---
---- @param dict any
+--- @param dict string
--- @return any
function vim.fn.setcharsearch(dict) end
@@ -7857,8 +7966,8 @@ function vim.fn.setcharsearch(dict) end
--- Returns 0 when successful, 1 when not editing the command
--- line.
---
---- @param str any
---- @param pos? any
+--- @param str string
+--- @param pos? integer
--- @return any
function vim.fn.setcmdline(str, pos) end
@@ -7876,13 +7985,13 @@ function vim.fn.setcmdline(str, pos) end
--- Returns 0 when successful, 1 when not editing the command
--- line.
---
---- @param pos any
+--- @param pos integer
--- @return any
function vim.fn.setcmdpos(pos) end
--- @param lnum integer
--- @param col? integer
---- @param off? any
+--- @param off? integer
--- @return any
function vim.fn.setcursorcharpos(lnum, col, off) end
@@ -7896,7 +8005,7 @@ function vim.fn.setcursorcharpos(lnum, col, off) end
--- call cursor(4, 3)
--- <positions the cursor on the first character 'ì—¬'.
---
---- @param list any
+--- @param list integer[]
--- @return any
function vim.fn.setcursorcharpos(list) end
@@ -7907,7 +8016,7 @@ function vim.fn.setcursorcharpos(list) end
--- See also |expr-env|.
---
--- @param name string
---- @param val any
+--- @param val string
--- @return any
function vim.fn.setenv(name, val) end
@@ -7981,8 +8090,8 @@ function vim.fn.setline(lnum, text) end
---
--- @param nr integer
--- @param list any
---- @param action? any
---- @param what? any
+--- @param action? string
+--- @param what? table
--- @return any
function vim.fn.setloclist(nr, list, action, what) end
@@ -7994,7 +8103,7 @@ function vim.fn.setloclist(nr, list, action, what) end
--- window ID instead of the current window.
---
--- @param list any
---- @param win? any
+--- @param win? integer
--- @return any
function vim.fn.setmatches(list, win) end
@@ -8046,8 +8155,8 @@ function vim.fn.setmatches(list, win) end
--- also set the preferred column. Also see the "curswant" key in
--- |winrestview()|.
---
---- @param expr any
---- @param list any
+--- @param expr string
+--- @param list integer[]
--- @return any
function vim.fn.setpos(expr, list) end
@@ -8164,9 +8273,9 @@ function vim.fn.setpos(expr, list) end
--- independent of the 'errorformat' setting. Use a command like
--- `:cc 1` to jump to the first position.
---
---- @param list any
---- @param action? any
---- @param what? any
+--- @param list any[]
+--- @param action? string
+--- @param what? table
--- @return any
function vim.fn.setqflist(list, action, what) end
@@ -8301,7 +8410,7 @@ function vim.fn.settabwinvar(tabnr, winnr, varname, val) end
---
--- @param nr integer
--- @param dict any
---- @param action? any
+--- @param action? string
--- @return any
function vim.fn.settagstack(nr, dict, action) end
@@ -8355,7 +8464,7 @@ function vim.fn.sha256(string) end
--- <See also |::S|.
---
--- @param string string
---- @param special? any
+--- @param special? boolean
--- @return any
function vim.fn.shellescape(string, special) end
@@ -8400,6 +8509,7 @@ function vim.fn.sign_define(name, dict) end
--- icon full path to the bitmap file for the sign.
--- linehl highlight group used for the whole line the
--- sign is placed in.
+--- priority default priority value of the sign
--- numhl highlight group used for the line number where
--- the sign is placed.
--- text text that is displayed when there is no icon
@@ -8450,6 +8560,7 @@ function vim.fn.sign_define(list) end
--- linehl highlight group used for the whole line the
--- sign is placed in; not present if not set.
--- name name of the sign
+--- priority default priority value of the sign
--- numhl highlight group used for the line number where
--- the sign is placed; not present if not set.
--- text text that is displayed when there is no icon
@@ -8536,7 +8647,7 @@ function vim.fn.sign_getdefined(name) end
--- echo sign_getplaced()
--- <
---
---- @param buf? any
+--- @param buf? integer|string
--- @param dict? vim.fn.sign_getplaced.dict
--- @return vim.fn.sign_getplaced.ret.item[]
function vim.fn.sign_getplaced(buf, dict) end
@@ -8610,10 +8721,10 @@ function vim.fn.sign_jump(id, group, buf) end
--- \ {'lnum' : 40, 'priority' : 90})
--- <
---
---- @param id any
---- @param group any
+--- @param id integer
+--- @param group string
--- @param name string
---- @param buf any
+--- @param buf integer|string
--- @param dict? vim.fn.sign_place.dict
--- @return integer
function vim.fn.sign_place(id, group, name, buf, dict) end
@@ -8641,7 +8752,8 @@ function vim.fn.sign_place(id, group, name, buf, dict) end
--- priority Priority of the sign. When multiple signs are
--- placed on a line, the sign with the highest
--- priority is used. If not specified, the
---- default value of 10 is used. See
+--- default value of 10 is used, unless specified
+--- otherwise by the sign definition. See
--- |sign-priority| for more information.
---
--- If {id} refers to an existing sign, then the existing sign is
@@ -8804,7 +8916,7 @@ function vim.fn.sign_unplacelist(list) end
--- directory. In order to resolve all the involved symbolic
--- links before simplifying the path name, use |resolve()|.
---
---- @param filename any
+--- @param filename string
--- @return any
function vim.fn.simplify(filename) end
@@ -8817,7 +8929,7 @@ function vim.fn.simplify(filename) end
--- echo sin(-4.01)
--- < 0.763301
---
---- @param expr any
+--- @param expr number
--- @return any
function vim.fn.sin(expr) end
@@ -8831,7 +8943,7 @@ function vim.fn.sin(expr) end
--- echo sinh(-0.9)
--- < -1.026517
---
---- @param expr any
+--- @param expr number
--- @return any
function vim.fn.sinh(expr) end
@@ -8845,8 +8957,8 @@ function vim.fn.sinh(expr) end
--- Returns an empty value if {start} or {end} are invalid.
---
--- @param expr any
---- @param start any
---- @param end_? any
+--- @param start integer
+--- @param end_? integer
--- @return any
function vim.fn.slice(expr, start, end_) end
@@ -8875,7 +8987,7 @@ function vim.fn.slice(expr, start, end_) end
--- - 0 on invalid arguments or connection failure.
---
--- @param mode string
---- @param address any
+--- @param address string
--- @param opts? table
--- @return any
function vim.fn.sockconnect(mode, address, opts) end
@@ -8953,7 +9065,7 @@ function vim.fn.sockconnect(mode, address, opts) end
--- <
---
--- @param list any
---- @param how? any
+--- @param how? string|function
--- @param dict? any
--- @return any
function vim.fn.sort(list, how, dict) end
@@ -8965,7 +9077,7 @@ function vim.fn.sort(list, how, dict) end
--- This can be used for making spelling suggestions. Note that
--- the method can be quite slow.
---
---- @param word any
+--- @param word string
--- @return any
function vim.fn.soundfold(word) end
@@ -8992,7 +9104,7 @@ function vim.fn.soundfold(word) end
--- The spelling information for the current window and the value
--- of 'spelllang' are used.
---
---- @param sentence? any
+--- @param sentence? string
--- @return any
function vim.fn.spellbadword(sentence) end
@@ -9016,15 +9128,15 @@ function vim.fn.spellbadword(sentence) end
--- The spelling information for the current window is used. The
--- values of 'spelllang' and 'spellsuggest' are used.
---
---- @param word any
---- @param max? any
---- @param capital? any
+--- @param word string
+--- @param max? integer
+--- @param capital? boolean
--- @return any
function vim.fn.spellsuggest(word, max, capital) end
--- Make a |List| out of {string}. When {pattern} is omitted or
---- empty each white-separated sequence of characters becomes an
---- item.
+--- empty each white space separated sequence of characters
+--- becomes an item.
--- Otherwise the string is split where {pattern} matches,
--- removing the matched characters. 'ignorecase' is not used
--- here, add \c to ignore case. |/\c|
@@ -9047,8 +9159,8 @@ function vim.fn.spellsuggest(word, max, capital) end
--- <The opposite function is |join()|.
---
--- @param string string
---- @param pattern? any
---- @param keepempty? any
+--- @param pattern? string
+--- @param keepempty? boolean
--- @return any
function vim.fn.split(string, pattern, keepempty) end
@@ -9064,7 +9176,7 @@ function vim.fn.split(string, pattern, keepempty) end
--- < str2float("nan")
--- NaN may be different, it depends on system libraries.
---
---- @param expr any
+--- @param expr number
--- @return any
function vim.fn.sqrt(expr) end
@@ -9082,7 +9194,7 @@ function vim.fn.sqrt(expr) end
--- echo rand(seed)
--- <
---
---- @param expr? any
+--- @param expr? number
--- @return any
function vim.fn.srand(expr) end
@@ -9187,7 +9299,7 @@ function vim.fn.stdpath(what) end
--- Returns 0.0 if the conversion fails.
---
--- @param string string
---- @param quoted? any
+--- @param quoted? boolean
--- @return any
function vim.fn.str2float(string, quoted) end
@@ -9203,7 +9315,7 @@ function vim.fn.str2float(string, quoted) end
--- echo str2list("aÌ") " returns [97, 769]
---
--- @param string string
---- @param utf8? any
+--- @param utf8? boolean
--- @return any
function vim.fn.str2list(string, utf8) end
@@ -9226,7 +9338,7 @@ function vim.fn.str2list(string, utf8) end
--- Returns 0 if {string} is empty or on error.
---
--- @param string string
---- @param base? any
+--- @param base? integer
--- @return any
function vim.fn.str2nr(string, base) end
@@ -9257,10 +9369,10 @@ function vim.fn.strcharlen(string) end
---
--- Returns an empty string on error.
---
---- @param src any
---- @param start any
---- @param len? any
---- @param skipcc? any
+--- @param src string
+--- @param start integer
+--- @param len? integer
+--- @param skipcc? boolean
--- @return any
function vim.fn.strcharpart(src, start, len, skipcc) end
@@ -9293,7 +9405,7 @@ function vim.fn.strcharpart(src, start, len, skipcc) end
--- <
---
--- @param string string
---- @param skipcc? any
+--- @param skipcc? boolean
--- @return integer
function vim.fn.strchars(string, skipcc) end
@@ -9331,8 +9443,8 @@ function vim.fn.strdisplaywidth(string, col) end
--- echo strftime("%c", getftime("file.c"))
--- " Show mod time of file.c.
---
---- @param format any
---- @param time? any
+--- @param format string
+--- @param time? number
--- @return string
function vim.fn.strftime(format, time) end
@@ -9796,7 +9908,7 @@ function vim.fn.synIDtrans(synID) end
---
--- @param lnum integer
--- @param col integer
---- @return {[1]: integer, [2]: string, [3]: integer}
+--- @return [integer, string, integer]
function vim.fn.synconcealed(lnum, col) end
--- Return a |List|, which is the stack of syntax items at the
@@ -9906,7 +10018,7 @@ function vim.fn.systemlist(cmd, input, keepempty) end
--- endfor
--- <Note that a buffer may appear in more than one window.
---
---- @param arg? any
+--- @param arg? integer
--- @return any
function vim.fn.tabpagebuflist(arg) end
@@ -10049,7 +10161,7 @@ function vim.fn.tempname() end
--- except $TERM is set to "xterm-256color". Full behavior is
--- described in |terminal|.
---
---- @param cmd any
+--- @param cmd string|string[]
--- @param opts? table
--- @return any
function vim.fn.termopen(cmd, opts) end
@@ -10068,7 +10180,7 @@ function vim.fn.termopen(cmd, opts) end
--- -1 means forever
--- "callback" the callback
---
---- @param id? any
+--- @param id? integer
--- @return any
function vim.fn.timer_info(id) end
@@ -10084,8 +10196,8 @@ function vim.fn.timer_info(id) end
--- String, then the timer is paused, otherwise it is unpaused.
--- See |non-zero-arg|.
---
---- @param timer any
---- @param paused any
+--- @param timer integer
+--- @param paused boolean
--- @return any
function vim.fn.timer_pause(timer, paused) end
@@ -10118,8 +10230,8 @@ function vim.fn.timer_pause(timer, paused) end
--- \ {'repeat': 3})
--- <This invokes MyHandler() three times at 500 msec intervals.
---
---- @param time any
---- @param callback any
+--- @param time number
+--- @param callback string|function
--- @param options? table
--- @return any
function vim.fn.timer_start(time, callback, options) end
@@ -10128,7 +10240,7 @@ function vim.fn.timer_start(time, callback, options) end
--- {timer} is an ID returned by timer_start(), thus it must be a
--- Number. If {timer} does not exist there is no error.
---
---- @param timer any
+--- @param timer integer
--- @return any
function vim.fn.timer_stop(timer) end
@@ -10143,7 +10255,7 @@ function vim.fn.timer_stopall() end
--- characters turned into lowercase (just like applying |gu| to
--- the string). Returns an empty string on error.
---
---- @param expr any
+--- @param expr string
--- @return string
function vim.fn.tolower(expr) end
@@ -10151,7 +10263,7 @@ function vim.fn.tolower(expr) end
--- characters turned into uppercase (just like applying |gU| to
--- the string). Returns an empty string on error.
---
---- @param expr any
+--- @param expr string
--- @return string
function vim.fn.toupper(expr) end
@@ -10203,7 +10315,7 @@ function vim.fn.tr(src, fromstr, tostr) end
--- echo trim(" vim ", " ", 2)
--- <returns " vim"
---
---- @param text any
+--- @param text string
--- @param mask? string
--- @param dir? 0|1|2
--- @return string
@@ -10221,7 +10333,7 @@ function vim.fn.trim(text, mask, dir) end
--- echo trunc(4.0)
--- < 4.0
---
---- @param expr any
+--- @param expr number
--- @return integer
function vim.fn.trunc(expr) end
@@ -10250,6 +10362,7 @@ function vim.fn.trunc(expr) end
--- if myvar is v:null | endif
--- <To check if the v:t_ variables exist use this: >vim
--- if exists('v:t_number') | endif
+--- <
---
--- @param expr any
--- @return integer
@@ -10313,7 +10426,7 @@ function vim.fn.undofile(name) end
--- item.
---
--- @param buf? integer|string
---- @return any
+--- @return vim.fn.undotree.ret
function vim.fn.undotree(buf) end
--- Remove second and succeeding copies of repeated adjacent
@@ -10360,8 +10473,8 @@ function vim.fn.uniq(list, func, dict) end
---
--- @param string string
--- @param idx integer
---- @param countcc? any
---- @param charidx? any
+--- @param countcc? boolean
+--- @param charidx? boolean
--- @return integer
function vim.fn.utf16idx(string, idx, countcc, charidx) end
@@ -10382,7 +10495,9 @@ function vim.fn.values(dict) end
--- set to 8, it returns 8. |conceal| is ignored.
--- For the byte position use |col()|.
---
---- For the use of {expr} see |col()|.
+--- For the use of {expr} see |getpos()| and |col()|.
+--- When {expr} is "$", it means the end of the cursor line, so
+--- the result is the number of cells in the cursor line plus one.
---
--- When 'virtualedit' is used {expr} can be [lnum, col, off],
--- where "off" is the offset in screen columns from the start of
@@ -10392,18 +10507,6 @@ function vim.fn.values(dict) end
--- beyond the end of the line can be returned. Also see
--- |'virtualedit'|
---
---- The accepted positions are:
---- . the cursor position
---- $ the end of the cursor line (the result is the
---- number of displayed characters in the cursor line
---- plus one)
---- 'x position of mark x (if the mark is not set, 0 is
---- returned)
---- v In Visual mode: the start of the Visual area (the
---- cursor is the end). When not in Visual mode
---- returns the cursor position. Differs from |'<| in
---- that it's updated right away.
----
--- If {list} is present and non-zero then virtcol() returns a
--- List with the first and last screen position occupied by the
--- character.
@@ -10422,13 +10525,16 @@ function vim.fn.values(dict) end
--- " With text " there", with 't at 'h':
---
--- echo virtcol("'t") " returns 6
---- <The first column is 1. 0 or [0, 0] is returned for an error.
+--- <
+--- The first column is 1. 0 or [0, 0] is returned for an error.
+---
--- A more advanced example that echoes the maximum length of
--- all lines: >vim
--- echo max(map(range(1, line('$')), "virtcol([v:val, '$'])"))
+--- <
---
---- @param expr any
---- @param list? any
+--- @param expr string|integer[]
+--- @param list? boolean
--- @param winid? integer
--- @return any
function vim.fn.virtcol(expr, list, winid) end
@@ -10477,7 +10583,7 @@ function vim.fn.virtcol2col(winid, lnum, col) end
--- a non-empty String, then the Visual mode will be cleared and
--- the old value is returned. See |non-zero-arg|.
---
---- @param expr? any
+--- @param expr? boolean
--- @return any
function vim.fn.visualmode(expr) end
@@ -10498,7 +10604,7 @@ function vim.fn.visualmode(expr) end
---
--- @param timeout integer
--- @param condition any
---- @param interval? any
+--- @param interval? number
--- @return any
function vim.fn.wait(timeout, condition, interval) end
@@ -10528,8 +10634,8 @@ function vim.fn.wildmenumode() end
--- When window {id} does not exist then no error is given and
--- an empty string is returned.
---
---- @param id any
---- @param command any
+--- @param id integer
+--- @param command string
--- @param silent? boolean
--- @return any
function vim.fn.win_execute(id, command, silent) end
@@ -10537,7 +10643,7 @@ function vim.fn.win_execute(id, command, silent) end
--- Returns a |List| with |window-ID|s for windows that contain
--- buffer {bufnr}. When there is none the list is empty.
---
---- @param bufnr any
+--- @param bufnr integer
--- @return integer[]
function vim.fn.win_findbuf(bufnr) end
@@ -10549,8 +10655,8 @@ function vim.fn.win_findbuf(bufnr) end
--- number {tab}. The first tab has number one.
--- Return zero if the window cannot be found.
---
---- @param win? any
---- @param tab? any
+--- @param win? integer
+--- @param tab? integer
--- @return integer
function vim.fn.win_getid(win, tab) end
@@ -10579,7 +10685,7 @@ function vim.fn.win_gettype(nr) end
--- tabpage.
--- Return TRUE if successful, FALSE if the window cannot be found.
---
---- @param expr any
+--- @param expr integer
--- @return 0|1
function vim.fn.win_gotoid(expr) end
@@ -10587,14 +10693,14 @@ function vim.fn.win_gotoid(expr) end
--- with ID {expr}: [tabnr, winnr].
--- Return [0, 0] if the window cannot be found.
---
---- @param expr any
+--- @param expr integer
--- @return any
function vim.fn.win_id2tabwin(expr) end
--- Return the window number of window with ID {expr}.
--- Return 0 if the window cannot be found in the current tabpage.
---
---- @param expr any
+--- @param expr integer
--- @return any
function vim.fn.win_id2win(expr) end
@@ -10613,7 +10719,7 @@ function vim.fn.win_id2win(expr) end
--- Only works for the current tab page. *E1308*
---
--- @param nr integer
---- @param offset any
+--- @param offset integer
--- @return any
function vim.fn.win_move_separator(nr, offset) end
@@ -10629,7 +10735,7 @@ function vim.fn.win_move_separator(nr, offset) end
--- Only works for the current tab page.
---
--- @param nr integer
---- @param offset any
+--- @param offset integer
--- @return any
function vim.fn.win_move_statusline(nr, offset) end
@@ -10664,7 +10770,7 @@ function vim.fn.win_screenpos(nr) end
--- 'splitright' are used.
---
--- @param nr integer
---- @param target any
+--- @param target integer
--- @param options? table
--- @return any
function vim.fn.win_splitmove(nr, target, options) end
@@ -10706,6 +10812,7 @@ function vim.fn.windowsversion() end
--- This excludes any window toolbar line.
--- Examples: >vim
--- echo "The current window has " .. winheight(0) .. " lines."
+--- <
---
--- @param nr integer
--- @return integer
@@ -10789,8 +10896,9 @@ function vim.fn.winline() end
--- let window_count = winnr('$')
--- let prev_window = winnr('#')
--- let wnum = winnr('3k')
+--- <
---
---- @param arg? any
+--- @param arg? string|integer
--- @return any
function vim.fn.winnr(arg) end
@@ -10939,6 +11047,7 @@ function vim.fn.wordcount() end
--- To copy a file byte for byte: >vim
--- let fl = readfile("foo", "b")
--- call writefile(fl, "foocopy", "b")
+--- <
---
--- @param object any
--- @param fname string
@@ -10953,7 +11062,7 @@ function vim.fn.writefile(object, fname, flags) end
--- let bits = xor(bits, 0x80)
--- <
---
---- @param expr any
---- @param expr1 any
+--- @param expr number
+--- @param expr1 number
--- @return any
function vim.fn.xor(expr, expr1) end
diff --git a/runtime/lua/vim/_options.lua b/runtime/lua/vim/_options.lua
index b41e298dd7..a61fa61256 100644
--- a/runtime/lua/vim/_options.lua
+++ b/runtime/lua/vim/_options.lua
@@ -95,7 +95,6 @@
local api = vim.api
-- TODO(tjdevries): Improve option metadata so that this doesn't have to be hardcoded.
--- Can be done in a separate PR.
local key_value_options = {
fillchars = true,
fcs = true,
@@ -175,6 +174,11 @@ local function new_buf_opt_accessor(bufnr)
end
local function new_win_opt_accessor(winid, bufnr)
+ -- TODO(lewis6991): allow passing both buf and win to nvim_get_option_value
+ if bufnr ~= nil and bufnr ~= 0 then
+ error('only bufnr=0 is supported')
+ end
+
return setmetatable({}, {
__index = function(_, k)
if bufnr == nil and type(k) == 'number' then
@@ -185,11 +189,6 @@ local function new_win_opt_accessor(winid, bufnr)
end
end
- if bufnr ~= nil and bufnr ~= 0 then
- error('only bufnr=0 is supported')
- end
-
- -- TODO(lewis6991): allow passing both buf and win to nvim_get_option_value
return api.nvim_get_option_value(k, {
scope = bufnr and 'local' or nil,
win = winid or 0,
@@ -197,7 +196,6 @@ local function new_win_opt_accessor(winid, bufnr)
end,
__newindex = function(_, k, v)
- -- TODO(lewis6991): allow passing both buf and win to nvim_set_option_value
return api.nvim_set_option_value(k, v, {
scope = bufnr and 'local' or nil,
win = winid or 0,
diff --git a/runtime/lua/vim/_watch.lua b/runtime/lua/vim/_watch.lua
index 02b3f536c2..11f6742941 100644
--- a/runtime/lua/vim/_watch.lua
+++ b/runtime/lua/vim/_watch.lua
@@ -30,6 +30,8 @@ M.FileChangeType = {
--- @class vim._watch.watch.Opts : vim._watch.Opts
--- @field uvflags? uv.fs_event_start.flags
+--- Decides if `path` should be skipped.
+---
--- @param path string
--- @param opts? vim._watch.Opts
local function skip(path, opts)
@@ -69,7 +71,7 @@ function M.watch(path, opts, callback)
local uvflags = opts and opts.uvflags or {}
local handle = assert(uv.new_fs_event())
- local _, start_err = handle:start(path, uvflags, function(err, filename, events)
+ local _, start_err, start_errname = handle:start(path, uvflags, function(err, filename, events)
assert(not err, err)
local fullpath = path
if filename then
@@ -96,7 +98,15 @@ function M.watch(path, opts, callback)
callback(fullpath, change_type)
end)
- assert(not start_err, start_err)
+ if start_err then
+ if start_errname == 'ENOENT' then
+ -- Server may send "workspace/didChangeWatchedFiles" with nonexistent `baseUri` path.
+ -- This is mostly a placeholder until we have `nvim_log` API.
+ vim.notify_once(('watch.watch: %s'):format(start_err), vim.log.levels.INFO)
+ end
+ -- TODO(justinmk): log important errors once we have `nvim_log` API.
+ return function() end
+ end
return function()
local _, stop_err = handle:stop()
@@ -193,7 +203,18 @@ function M.watchdirs(path, opts, callback)
local root_handle = assert(uv.new_fs_event())
handles[path] = root_handle
- root_handle:start(path, {}, create_on_change(path))
+ local _, start_err, start_errname = root_handle:start(path, {}, create_on_change(path))
+
+ if start_err then
+ if start_errname == 'ENOENT' then
+ -- Server may send "workspace/didChangeWatchedFiles" with nonexistent `baseUri` path.
+ -- This is mostly a placeholder until we have `nvim_log` API.
+ vim.notify_once(('watch.watchdirs: %s'):format(start_err), vim.log.levels.INFO)
+ end
+ -- TODO(justinmk): log important errors once we have `nvim_log` API.
+
+ -- Continue. vim.fs.dir() will return nothing, so the code below is harmless.
+ end
--- "640K ought to be enough for anyone"
--- Who has folders this deep?
@@ -227,11 +248,12 @@ end
--- @param data string
--- @param opts vim._watch.Opts?
--- @param callback vim._watch.Callback
-local function fswatch_output_handler(data, opts, callback)
+local function on_inotifywait_output(data, opts, callback)
local d = vim.split(data, '%s+')
-- only consider the last reported event
- local fullpath, event = d[1], d[#d]
+ local path, event, file = d[1], d[2], d[#d]
+ local fullpath = vim.fs.joinpath(path, file)
if skip(fullpath, opts) then
return
@@ -240,20 +262,16 @@ local function fswatch_output_handler(data, opts, callback)
--- @type integer
local change_type
- if event == 'Created' then
+ if event == 'CREATE' then
change_type = M.FileChangeType.Created
- elseif event == 'Removed' then
+ elseif event == 'DELETE' then
change_type = M.FileChangeType.Deleted
- elseif event == 'Updated' then
+ elseif event == 'MODIFY' 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
+ elseif event == 'MOVED_FROM' then
+ change_type = M.FileChangeType.Deleted
+ elseif event == 'MOVED_TO' then
+ change_type = M.FileChangeType.Created
end
if change_type then
@@ -265,24 +283,22 @@ end
--- @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
-
+function M.inotify(path, opts, callback)
local obj = vim.system({
- 'fswatch',
- '--event=Created',
- '--event=Removed',
- '--event=Updated',
- '--event=Renamed',
- '--event-flags',
+ 'inotifywait',
+ '--quiet', -- suppress startup messages
+ '--no-dereference', -- don't follow symlinks
+ '--monitor', -- keep listening for events forever
'--recursive',
- '--latency=' .. tostring(latency),
- '--exclude',
- '/.git/',
+ '--event',
+ 'create',
+ '--event',
+ 'delete',
+ '--event',
+ 'modify',
+ '--event',
+ 'move',
+ string.format('@%s/.git', path), -- ignore git directory
path,
}, {
stderr = function(err, data)
@@ -292,11 +308,11 @@ function M.fswatch(path, opts, callback)
if data and #vim.trim(data) > 0 then
vim.schedule(function()
- if vim.fn.has('linux') == 1 and vim.startswith(data, 'Event queue overflow') then
- data = 'inotify(7) limit reached, see :h fswatch-limitations for more info.'
+ if vim.fn.has('linux') == 1 and vim.startswith(data, 'Failed to watch') then
+ data = 'inotify(7) limit reached, see :h inotify-limitations for more info.'
end
- vim.notify('fswatch: ' .. data, vim.log.levels.ERROR)
+ vim.notify('inotify: ' .. data, vim.log.levels.ERROR)
end)
end
end,
@@ -306,7 +322,7 @@ function M.fswatch(path, opts, callback)
end
for line in vim.gsplit(data or '', '\n', { plain = true, trimempty = true }) do
- fswatch_output_handler(line, opts, callback)
+ on_inotifywait_output(line, opts, callback)
end
end,
-- --latency is locale dependent but tostring() isn't and will always have '.' as decimal point.
diff --git a/runtime/lua/vim/deprecated/health.lua b/runtime/lua/vim/deprecated/health.lua
index 0f6b1f578c..eed889d90a 100644
--- a/runtime/lua/vim/deprecated/health.lua
+++ b/runtime/lua/vim/deprecated/health.lua
@@ -1,7 +1,7 @@
local M = {}
local health = vim.health
-local deprecated = {}
+local deprecated = {} ---@type [string, table, string][]
function M.check()
if next(deprecated) == nil then
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua
index 348204abb7..ef00a1fa51 100644
--- a/runtime/lua/vim/diagnostic.lua
+++ b/runtime/lua/vim/diagnostic.lua
@@ -42,7 +42,7 @@ local M = {}
---
--- @field namespace? integer
---- Each of the configuration options below accepts one of the following:
+--- Many of the configuration options below accept 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.
@@ -78,6 +78,9 @@ local M = {}
--- - {reverse}? (boolean) Reverse sort order
--- (default: `false`)
--- @field severity_sort? boolean|{reverse?:boolean}
+---
+--- Default values for |vim.diagnostic.jump()|. See |vim.diagnostic.Opts.Jump|.
+--- @field jump? vim.diagnostic.Opts.Jump
--- @class (private) vim.diagnostic.OptsResolved
--- @field float vim.diagnostic.Opts.Float
@@ -105,7 +108,7 @@ local M = {}
--- 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}
+--- @field pos? integer|[integer,integer]
---
--- Sort diagnostics by severity.
--- Overrides the setting from |vim.diagnostic.config()|.
@@ -119,7 +122,7 @@ local M = {}
--- 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}
+--- @field header? string|[string,any]
---
--- Include the diagnostic source in the message.
--- Use "if_many" to only show sources if there is more than one source of
@@ -200,7 +203,7 @@ local M = {}
--- @field hl_mode? 'replace'|'combine'|'blend'
---
--- See |nvim_buf_set_extmark()|.
---- @field virt_text? {[1]:string,[2]:any}[]
+--- @field virt_text? [string,any][]
---
--- See |nvim_buf_set_extmark()|.
--- @field virt_text_pos? 'eol'|'overlay'|'right_align'|'inline'
@@ -241,6 +244,22 @@ local M = {}
--- whole line the sign is placed in.
--- @field linehl? table<vim.diagnostic.Severity,string>
+--- @class vim.diagnostic.Opts.Jump
+---
+--- Default value of the {float} parameter of |vim.diagnostic.jump()|.
+--- (default: false)
+--- @field float? boolean|vim.diagnostic.Opts.Float
+---
+--- Default value of the {wrap} parameter of |vim.diagnostic.jump()|.
+--- (default: true)
+--- @field wrap? boolean
+---
+--- Default value of the {severity} parameter of |vim.diagnostic.jump()|.
+--- @field severity? vim.diagnostic.SeverityFilter
+---
+--- Default value of the {_highest} parameter of |vim.diagnostic.jump()|.
+--- @field package _highest? boolean
+
-- TODO: inherit from `vim.diagnostic.Opts`, implement its fields.
--- Optional filters |kwargs|, or `nil` for all.
--- @class vim.diagnostic.Filter
@@ -284,6 +303,13 @@ local global_diagnostic_options = {
float = true,
update_in_insert = false,
severity_sort = false,
+ jump = {
+ -- Do not show floating window
+ float = false,
+
+ -- Wrap around buffer
+ wrap = true,
+ },
}
--- @class (private) vim.diagnostic.Handler
@@ -835,21 +861,36 @@ local function filter_highest(diagnostics)
end
end
---- @param position {[1]: integer, [2]: integer}
--- @param search_forward boolean
---- @param bufnr integer
---- @param opts vim.diagnostic.GotoOpts
---- @param namespace integer[]|integer
+--- @param opts vim.diagnostic.JumpOpts?
--- @return vim.Diagnostic?
-local function next_diagnostic(position, search_forward, bufnr, opts, namespace)
+local function next_diagnostic(search_forward, opts)
+ opts = opts or {}
+
+ -- Support deprecated win_id alias
+ if opts.win_id then
+ vim.deprecate('opts.win_id', 'opts.winid', '0.13')
+ opts.winid = opts.win_id
+ opts.win_id = nil
+ end
+
+ -- Support deprecated cursor_position alias
+ if opts.cursor_position then
+ vim.deprecate('opts.cursor_position', 'opts.pos', '0.13')
+ opts.pos = opts.cursor_position
+ opts.cursor_position = nil
+ end
+
+ local winid = opts.winid or api.nvim_get_current_win()
+ local bufnr = api.nvim_win_get_buf(winid)
+ local position = opts.pos or api.nvim_win_get_cursor(winid)
+
+ -- Adjust row to be 0-indexed
position[1] = position[1] - 1
- bufnr = get_bufnr(bufnr)
- local wrap = if_nil(opts.wrap, true)
- local get_opts = vim.deepcopy(opts)
- get_opts.namespace = get_opts.namespace or namespace
+ local wrap = if_nil(opts.wrap, true)
- local diagnostics = get_diagnostics(bufnr, get_opts, true)
+ local diagnostics = get_diagnostics(bufnr, opts, true)
if opts._highest then
filter_highest(diagnostics)
@@ -902,32 +943,40 @@ 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 = if_nil(opts.float, true)
- local win_id = opts.win_id or api.nvim_get_current_win()
-
- if not pos then
+--- Move the cursor to the given diagnostic.
+---
+--- @param diagnostic vim.Diagnostic?
+--- @param opts vim.diagnostic.JumpOpts?
+local function goto_diagnostic(diagnostic, opts)
+ if not diagnostic then
api.nvim_echo({ { 'No more valid diagnostics to move to', 'WarningMsg' } }, true, {})
return
end
- api.nvim_win_call(win_id, function()
+ opts = opts or {}
+
+ -- Support deprecated win_id alias
+ if opts.win_id then
+ vim.deprecate('opts.win_id', 'opts.winid', '0.13')
+ opts.winid = opts.win_id
+ opts.win_id = nil
+ end
+
+ local winid = opts.winid or api.nvim_get_current_win()
+
+ vim._with({ win = winid }, function()
-- Save position in the window's jumplist
vim.cmd("normal! m'")
- api.nvim_win_set_cursor(win_id, { pos[1] + 1, pos[2] })
+ api.nvim_win_set_cursor(winid, { diagnostic.lnum + 1, diagnostic.col })
-- Open folds under the cursor
vim.cmd('normal! zv')
end)
- if float then
- local float_opts = type(float) == 'table' and float or {}
+ if opts.float then
+ local float_opts = type(opts.float) == 'table' and opts.float or {}
vim.schedule(function()
M.open_float(vim.tbl_extend('keep', float_opts, {
- bufnr = api.nvim_win_get_buf(win_id),
+ bufnr = api.nvim_win_get_buf(winid),
scope = 'cursor',
focus = false,
}))
@@ -1114,24 +1163,24 @@ end
--- Get the previous diagnostic closest to the cursor position.
---
----@param opts? vim.diagnostic.GotoOpts
+---@param opts? vim.diagnostic.JumpOpts
---@return vim.Diagnostic? : Previous diagnostic
function M.get_prev(opts)
- opts = opts or {}
-
- local win_id = opts.win_id or api.nvim_get_current_win()
- local bufnr = api.nvim_win_get_buf(win_id)
- local cursor_position = opts.cursor_position or api.nvim_win_get_cursor(win_id)
-
- return next_diagnostic(cursor_position, false, bufnr, opts, opts.namespace)
+ return next_diagnostic(false, opts)
end
--- Return the position of the previous diagnostic in the current buffer.
---
----@param opts? vim.diagnostic.GotoOpts
+---@param opts? vim.diagnostic.JumpOpts
---@return table|false: Previous diagnostic position as a `(row, col)` tuple
--- or `false` if there is no prior diagnostic.
+---@deprecated
function M.get_prev_pos(opts)
+ vim.deprecate(
+ 'vim.diagnostic.get_prev_pos()',
+ 'access the lnum and col fields from get_prev() instead',
+ '0.13'
+ )
local prev = M.get_prev(opts)
if not prev then
return false
@@ -1141,31 +1190,35 @@ function M.get_prev_pos(opts)
end
--- Move to the previous diagnostic in the current buffer.
----@param opts? vim.diagnostic.GotoOpts
+---@param opts? vim.diagnostic.JumpOpts
+---@deprecated
function M.goto_prev(opts)
- return diagnostic_move_pos(opts, M.get_prev_pos(opts))
+ vim.deprecate('vim.diagnostic.goto_prev()', 'vim.diagnostic.jump()', '0.13')
+ opts = opts or {}
+ opts.float = if_nil(opts.float, true)
+ goto_diagnostic(M.get_prev(opts), opts)
end
--- Get the next diagnostic closest to the cursor position.
---
----@param opts? vim.diagnostic.GotoOpts
+---@param opts? vim.diagnostic.JumpOpts
---@return vim.Diagnostic? : Next diagnostic
function M.get_next(opts)
- opts = opts or {}
-
- local win_id = opts.win_id or api.nvim_get_current_win()
- local bufnr = api.nvim_win_get_buf(win_id)
- local cursor_position = opts.cursor_position or api.nvim_win_get_cursor(win_id)
-
- return next_diagnostic(cursor_position, true, bufnr, opts, opts.namespace)
+ return next_diagnostic(true, opts)
end
--- Return the position of the next diagnostic in the current buffer.
---
----@param opts? vim.diagnostic.GotoOpts
+---@param opts? vim.diagnostic.JumpOpts
---@return table|false : Next diagnostic position as a `(row, col)` tuple or false if no next
--- diagnostic.
+---@deprecated
function M.get_next_pos(opts)
+ vim.deprecate(
+ 'vim.diagnostic.get_next_pos()',
+ 'access the lnum and col fields from get_next() instead',
+ '0.13'
+ )
local next = M.get_next(opts)
if not next then
return false
@@ -1186,13 +1239,23 @@ end
--- See |diagnostic-severity|.
--- @field severity? vim.diagnostic.SeverityFilter
---- Configuration table with the following keys:
---- @class vim.diagnostic.GotoOpts : vim.diagnostic.GetOpts
+--- Configuration table with the keys listed below. Some parameters can have their default values
+--- changed with |vim.diagnostic.config()|.
+--- @class vim.diagnostic.JumpOpts : vim.diagnostic.GetOpts
+---
+--- The diagnostic to jump to. Mutually exclusive with {count}, {namespace},
+--- and {severity}.
+--- @field diagnostic? vim.Diagnostic
---
---- Cursor position as a `(row, col)` tuple.
---- See |nvim_win_get_cursor()|.
---- (default: current cursor position)
---- @field cursor_position? {[1]:integer,[2]:integer}
+--- The number of diagnostics to move by, starting from {pos}. A positive
+--- integer moves forward by {count} diagnostics, while a negative integer moves
+--- backward by {count} diagnostics. Mutually exclusive with {diagnostic}.
+--- @field count? integer
+---
+--- Cursor position as a `(row, col)` tuple. See |nvim_win_get_cursor()|. Used
+--- to find the nearest diagnostic when {count} is used. Only used when {count}
+--- is non-nil. Default is the current cursor position.
+--- @field pos? [integer,integer]
---
--- Whether to loop around file or not. Similar to 'wrapscan'.
--- (default: `true`)
@@ -1209,18 +1272,78 @@ end
--- 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`)
+--- (default: `false`)
--- @field float? boolean|vim.diagnostic.Opts.Float
---
--- Window ID
--- (default: `0`)
---- @field win_id? integer
+--- @field winid? integer
+
+--- Move to a diagnostic.
+---
+--- @param opts vim.diagnostic.JumpOpts
+--- @return vim.Diagnostic? # The diagnostic that was moved to.
+function M.jump(opts)
+ vim.validate('opts', opts, 'table')
+
+ -- One of "diagnostic" or "count" must be provided
+ assert(
+ opts.diagnostic or opts.count,
+ 'One of "diagnostic" or "count" must be specified in the options to vim.diagnostic.jump()'
+ )
+
+ -- Apply configuration options from vim.diagnostic.config()
+ opts = vim.tbl_deep_extend('keep', opts, global_diagnostic_options.jump)
+
+ if opts.diagnostic then
+ goto_diagnostic(opts.diagnostic, opts)
+ return opts.diagnostic
+ end
+
+ local count = opts.count
+ if count == 0 then
+ return nil
+ end
+
+ -- Support deprecated cursor_position alias
+ if opts.cursor_position then
+ vim.deprecate('opts.cursor_position', 'opts.pos', '0.13')
+ opts.pos = opts.cursor_position
+ opts.cursor_position = nil
+ end
+
+ local diag = nil
+ while count ~= 0 do
+ local next = next_diagnostic(count > 0, opts)
+ if not next then
+ break
+ end
+
+ -- Update cursor position
+ opts.pos = { next.lnum + 1, next.col }
+
+ if count > 0 then
+ count = count - 1
+ else
+ count = count + 1
+ end
+ diag = next
+ end
+
+ goto_diagnostic(diag, opts)
+
+ return diag
+end
--- Move to the next diagnostic.
---
----@param opts? vim.diagnostic.GotoOpts
+---@param opts? vim.diagnostic.JumpOpts
+---@deprecated
function M.goto_next(opts)
- diagnostic_move_pos(opts, M.get_next_pos(opts))
+ vim.deprecate('vim.diagnostic.goto_next()', 'vim.diagnostic.jump()', '0.13')
+ opts = opts or {}
+ opts.float = if_nil(opts.float, true)
+ goto_diagnostic(M.get_next(opts), opts)
end
M.handlers.signs = {
@@ -1239,6 +1362,10 @@ M.handlers.signs = {
bufnr = get_bufnr(bufnr)
opts = opts or {}
+ if not api.nvim_buf_is_loaded(bufnr) then
+ return
+ end
+
if opts.signs and opts.signs.severity then
diagnostics = filter_by_severity(opts.signs.severity, diagnostics)
end
@@ -1321,8 +1448,10 @@ M.handlers.signs = {
local numhl = opts.signs.numhl or {}
local linehl = opts.signs.linehl or {}
+ local line_count = api.nvim_buf_line_count(bufnr)
+
for _, diagnostic in ipairs(diagnostics) do
- if api.nvim_buf_is_loaded(diagnostic.bufnr) then
+ if diagnostic.lnum <= line_count 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],
@@ -1688,7 +1817,7 @@ end
---
---@param opts vim.diagnostic.Opts.Float?
---@return integer? float_bufnr
----@return integer? win_id
+---@return integer? winid
function M.open_float(opts, ...)
-- Support old (bufnr, opts) signature
local bufnr --- @type integer?
@@ -1739,16 +1868,19 @@ function M.open_float(opts, ...)
if scope == 'line' then
--- @param d vim.Diagnostic
diagnostics = vim.tbl_filter(function(d)
- return lnum >= d.lnum and lnum <= d.end_lnum
+ return lnum >= d.lnum
+ and lnum <= d.end_lnum
+ and (d.lnum == d.end_lnum or lnum ~= d.end_lnum or d.end_col ~= 0)
end, diagnostics)
elseif scope == 'cursor' then
- -- LSP servers can send diagnostics with `end_col` past the length of the line
+ -- If `col` is past the end of the line, show if the cursor is on the last char in 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
- and (d.end_col >= col or d.end_lnum > lnum)
+ return lnum >= d.lnum
+ and lnum <= d.end_lnum
+ and (lnum ~= d.lnum or col >= math.min(d.col, line_length - 1))
+ and ((d.lnum == d.end_lnum and d.col == d.end_col) or lnum ~= d.end_lnum or col < d.end_col)
end, diagnostics)
end
@@ -1946,7 +2078,7 @@ end
--- @field title? string
---
--- See |diagnostic-severity|.
---- @field severity? vim.diagnostic.Severity
+--- @field severity? vim.diagnostic.SeverityFilter
--- Add all diagnostics to the quickfix list.
---
@@ -1974,7 +2106,7 @@ end
--- @field title? string
---
--- See |diagnostic-severity|.
---- @field severity? vim.diagnostic.Severity
+--- @field severity? vim.diagnostic.SeverityFilter
--- Add buffer diagnostics to the location list.
---
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua
index d1fdd0aa16..d3910e26eb 100644
--- a/runtime/lua/vim/filetype.lua
+++ b/runtime/lua/vim/filetype.lua
@@ -4,12 +4,13 @@ local fn = vim.fn
local M = {}
--- @alias vim.filetype.mapfn fun(path:string,bufnr:integer, ...):string?, fun(b:integer)?
---- @alias vim.filetype.maptbl {[1]:string|vim.filetype.mapfn, [2]:{priority:integer}}
+--- @alias vim.filetype.mapopts { parent: string, priority: number }
+--- @alias vim.filetype.maptbl [string|vim.filetype.mapfn, vim.filetype.mapopts]
--- @alias vim.filetype.mapping.value string|vim.filetype.mapfn|vim.filetype.maptbl
--- @alias vim.filetype.mapping table<string,vim.filetype.mapping.value>
--- @param ft string|vim.filetype.mapfn
---- @param opts? {priority:integer}
+--- @param opts? vim.filetype.mapopts
--- @return vim.filetype.maptbl
local function starsetf(ft, opts)
return {
@@ -26,6 +27,9 @@ local function starsetf(ft, opts)
end
end,
{
+ -- Allow setting "parent" to be reused in closures, but don't have default as it will be
+ -- assigned later from grouping
+ parent = opts and opts.parent,
-- Starset matches should have lowest priority by default
priority = (opts and opts.priority) or -math.huge,
},
@@ -144,6 +148,9 @@ end
local function detect_noext(path, bufnr)
local root = fn.fnamemodify(path, ':r')
+ if root == path then
+ return
+ end
return M.match({ buf = bufnr, filename = root })
end
@@ -170,9 +177,15 @@ end
-- luacheck: push no unused args
-- luacheck: push ignore 122
--- Filetypes based on file extension
+-- Filetype detection logic is encoded in three tables:
+-- 1. `extension` for literal extension lookup
+-- 2. `filename` for literal full path or basename lookup;
+-- 3. `pattern` for matching filenames or paths against Lua patterns,
+-- optimized for fast lookup.
+-- See `:h dev-vimpatch-filetype` for guidance when porting Vim filetype patches.
+
---@diagnostic disable: unused-local
---- @type vim.filetype.mapping
+---@type vim.filetype.mapping
local extension = {
-- BEGIN EXTENSION
['8th'] = '8th',
@@ -190,6 +203,7 @@ local extension = {
aidl = 'aidl',
aml = 'aml',
run = 'ampl',
+ g4 = 'antlr4',
scpt = 'applescript',
ino = 'arduino',
pde = 'arduino',
@@ -203,12 +217,17 @@ local extension = {
return 'aspvbs'
end,
asm = detect.asm,
+ s = detect.asm,
+ S = detect.asm,
+ a = detect.asm,
+ A = detect.asm,
lst = detect.asm,
mac = detect.asm,
asn1 = 'asn',
asn = 'asn',
asp = detect.asp,
astro = 'astro',
+ asy = 'asy',
atl = 'atlas',
as = 'atlas',
zed = 'authzed',
@@ -232,6 +251,7 @@ local extension = {
db = detect.bindzone,
bicep = 'bicep',
bicepparam = 'bicep',
+ zone = 'bindzone',
bb = 'bitbake',
bbappend = 'bitbake',
bbclass = 'bitbake',
@@ -257,10 +277,14 @@ local extension = {
cdc = 'cdc',
cdl = 'cdl',
toc = detect_line1('\\contentsline', 'tex', 'cdrtoc'),
+ cedar = 'cedar',
cfc = 'cf',
cfm = 'cf',
cfi = 'cf',
hgrc = 'cfg',
+ cfg = detect.cfg,
+ Cfg = detect.cfg,
+ CFG = detect.cfg,
chf = 'ch',
chai = 'chaiscript',
ch = detect.change,
@@ -281,7 +305,6 @@ local extension = {
cook = 'cook',
cmake = 'cmake',
cmod = 'cmod',
- lib = 'cobol',
cob = 'cobol',
cbl = 'cobol',
atg = 'coco',
@@ -344,6 +367,9 @@ local extension = {
dart = 'dart',
drt = 'dart',
ds = 'datascript',
+ dat = detect.dat,
+ Dat = detect.dat,
+ DAT = detect.dat,
dcd = 'dcd',
decl = detect.decl,
dec = detect.decl,
@@ -366,6 +392,9 @@ local extension = {
gv = 'dot',
drac = 'dracula',
drc = 'dracula',
+ lvs = 'dracula',
+ lpe = 'dracula',
+ dsp = detect.dsp,
dtd = 'dtd',
d = detect.dtrace,
dts = 'dts',
@@ -417,6 +446,7 @@ local extension = {
fal = 'falcon',
fan = 'fan',
fwt = 'fan',
+ lib = 'faust',
fnl = 'fennel',
m4gl = 'fgl',
['4gl'] = 'fgl',
@@ -468,8 +498,21 @@ local extension = {
gmi = 'gemtext',
gemini = 'gemtext',
gift = 'gift',
+ prettierignore = 'gitignore',
gleam = 'gleam',
+ vert = 'glsl',
+ tesc = 'glsl',
+ tese = 'glsl',
glsl = 'glsl',
+ geom = 'glsl',
+ frag = 'glsl',
+ comp = 'glsl',
+ rgen = 'glsl',
+ rmiss = 'glsl',
+ rchit = 'glsl',
+ rahit = 'glsl',
+ rint = 'glsl',
+ rcall = 'glsl',
gn = 'gn',
gni = 'gn',
gnuplot = 'gnuplot',
@@ -535,6 +578,7 @@ local extension = {
stm = detect.html,
htt = 'httest',
htb = 'httest',
+ http = 'http',
hurl = 'hurl',
hw = detect.hw,
module = detect.hw,
@@ -572,6 +616,7 @@ local extension = {
jsx = 'javascriptreact',
clp = 'jess',
jgr = 'jgraph',
+ jinja = 'jinja',
jjdescription = 'jj',
j73 = 'jovial',
jov = 'jovial',
@@ -582,6 +627,7 @@ local extension = {
json = 'json',
jsonp = 'json',
geojson = 'json',
+ mcmeta = 'json',
webmanifest = 'json',
ipynb = 'json',
['jupyterlab-settings'] = 'json',
@@ -606,6 +652,9 @@ local extension = {
kts = 'kotlin',
kt = 'kotlin',
ktm = 'kotlin',
+ sub = 'krl',
+ Sub = 'krl',
+ SUB = 'krl',
ks = 'kscript',
k = 'kwt',
ACE = 'lace',
@@ -639,6 +688,9 @@ local extension = {
lt = 'lite',
lite = 'lite',
livemd = 'livebook',
+ log = detect.log,
+ Log = detect.log,
+ LOG = detect.log,
lgt = 'logtalk',
lotos = 'lotos',
lot = detect_line1('\\contentsline', 'tex', 'lotos'),
@@ -664,9 +716,8 @@ local extension = {
return not (path:find('html%.m4$') or path:find('fvwm2rc')) and 'm4' or nil
end,
eml = 'mail',
- mk = 'make',
- mak = 'make',
- dsp = 'make',
+ mk = detect.make,
+ mak = detect.make,
page = 'mallard',
map = 'map',
mws = 'maple',
@@ -679,7 +730,6 @@ local extension = {
markdown = detect.markdown,
mdown = detect.markdown,
mhtml = 'mason',
- comp = 'mason',
mason = 'mason',
master = 'master',
mas = 'master',
@@ -689,6 +739,8 @@ local extension = {
dm3 = 'maxima',
dmt = 'maxima',
wxm = 'maxima',
+ mw = 'mediawiki',
+ wiki = 'mediawiki',
mel = 'mel',
mmd = 'mermaid',
mmdc = 'mermaid',
@@ -702,9 +754,17 @@ local extension = {
mixal = 'mix',
mm = detect.mm,
nb = 'mma',
+ wl = 'mma',
mmp = 'mmp',
mms = detect.mms,
+ mod = detect.mod,
+ Mod = detect.mod,
+ MOD = detect.mod,
DEF = 'modula2',
+ m3 = 'modula3',
+ i3 = 'modula3',
+ mg = 'modula3',
+ ig = 'modula3',
lm3 = 'modula3',
mojo = 'mojo',
['🔥'] = 'mojo', -- 🙄
@@ -729,6 +789,14 @@ local extension = {
n1ql = 'n1ql',
nql = 'n1ql',
nanorc = 'nanorc',
+ NSA = 'natural',
+ NSC = 'natural',
+ NSG = 'natural',
+ NSL = 'natural',
+ NSM = 'natural',
+ NSN = 'natural',
+ NSP = 'natural',
+ NSS = 'natural',
ncf = 'ncf',
nginx = 'nginx',
nim = 'nim',
@@ -738,6 +806,15 @@ local extension = {
nix = 'nix',
norg = 'norg',
nqc = 'nqc',
+ ['1'] = detect.nroff,
+ ['2'] = detect.nroff,
+ ['3'] = detect.nroff,
+ ['4'] = detect.nroff,
+ ['5'] = detect.nroff,
+ ['6'] = detect.nroff,
+ ['7'] = detect.nroff,
+ ['8'] = detect.nroff,
+ ['9'] = detect.nroff,
roff = 'nroff',
tmac = 'nroff',
man = 'nroff',
@@ -769,6 +846,14 @@ local extension = {
['or'] = 'openroad',
scad = 'openscad',
ovpn = 'openvpn',
+ opl = 'opl',
+ opL = 'opl',
+ oPl = 'opl',
+ oPL = 'opl',
+ Opl = 'opl',
+ OpL = 'opl',
+ OPl = 'opl',
+ OPL = 'opl',
ora = 'ora',
org = 'org',
org_archive = 'org',
@@ -800,6 +885,16 @@ local extension = {
ctp = 'php',
php = 'php',
phpt = 'php',
+ php0 = 'php',
+ php1 = 'php',
+ php2 = 'php',
+ php3 = 'php',
+ php4 = 'php',
+ php5 = 'php',
+ php6 = 'php',
+ php7 = 'php',
+ php8 = 'php',
+ php9 = 'php',
phtml = 'php',
theme = 'php',
pike = 'pike',
@@ -832,6 +927,9 @@ local extension = {
it = 'ppwiz',
ih = 'ppwiz',
action = 'privoxy',
+ prg = detect.prg,
+ Prg = detect.prg,
+ PRG = detect.prg,
pc = 'proc',
pdb = 'prolog',
pml = 'promela',
@@ -873,6 +971,19 @@ local extension = {
t6 = 'raku',
p6 = 'raku',
raml = 'raml',
+ sysx = 'rapid',
+ sysX = 'rapid',
+ Sysx = 'rapid',
+ SysX = 'rapid',
+ SYSX = 'rapid',
+ SYSx = 'rapid',
+ modx = 'rapid',
+ modX = 'rapid',
+ Modx = 'rapid',
+ ModX = 'rapid',
+ MODX = 'rapid',
+ MODx = 'rapid',
+ rasi = 'rasi',
rbs = 'rbs',
rego = 'rego',
rem = 'remind',
@@ -929,6 +1040,7 @@ local extension = {
rake = 'ruby',
rs = 'rust',
sage = 'sage',
+ sls = 'salt',
sas = 'sas',
sass = 'sass',
sa = 'sather',
@@ -952,6 +1064,7 @@ local extension = {
ebuild = detect.bash,
eclass = detect.bash,
env = detect.sh,
+ envrc = detect.sh,
ksh = detect.ksh,
sh = detect.sh,
mdd = 'sh',
@@ -984,6 +1097,7 @@ local extension = {
smt = 'smith',
smithy = 'smithy',
sml = 'sml',
+ smk = 'snakemake',
spt = 'snobol4',
sno = 'snobol4',
sln = 'solution',
@@ -1006,6 +1120,9 @@ local extension = {
sqi = 'sqr',
sqr = 'sqr',
nut = 'squirrel',
+ src = detect.src,
+ Src = detect.src,
+ SRC = detect.src,
s28 = 'srec',
s37 = 'srec',
srec = 'srec',
@@ -1030,8 +1147,12 @@ local extension = {
svelte = 'svelte',
svg = 'svg',
swift = 'swift',
+ swiftinterface = 'swift',
swig = 'swig',
swg = 'swig',
+ sys = detect.sys,
+ Sys = detect.sys,
+ SYS = detect.sys,
svh = 'systemverilog',
sv = 'systemverilog',
cmm = 'trace32',
@@ -1060,6 +1181,7 @@ local extension = {
nls = 'tex',
thm = 'tex',
eps_tex = 'tex',
+ pdf_tex = 'tex',
pygtex = 'tex',
pygstyle = 'tex',
clo = 'tex',
@@ -1153,6 +1275,8 @@ local extension = {
wbt = 'winbatch',
wit = 'wit',
wml = 'wml',
+ wsf = 'wsh',
+ wsc = 'wsh',
wsml = 'wsml',
ad = 'xdefaults',
xhtml = 'xhtml',
@@ -1206,6 +1330,8 @@ local extension = {
z8a = 'z8a',
zig = 'zig',
zon = 'zig',
+ ziggy = 'ziggy',
+ ['ziggy-schema'] = 'ziggy_schema',
zu = 'zimbu',
zut = 'zimbutempl',
zs = 'zserio',
@@ -1261,8 +1387,7 @@ local extension = {
['dpkg-new'] = detect_noext,
['in'] = function(path, bufnr)
if vim.fs.basename(path) ~= 'configure.in' then
- local root = fn.fnamemodify(path, ':r')
- return M.match({ buf = bufnr, filename = root })
+ return detect_noext(path, bufnr)
end
end,
new = detect_noext,
@@ -1275,7 +1400,7 @@ local extension = {
-- END EXTENSION
}
---- @type vim.filetype.mapping
+---@type vim.filetype.mapping
local filename = {
-- BEGIN FILENAME
['a2psrc'] = 'a2ps',
@@ -1290,7 +1415,17 @@ local filename = {
['/.aptitude/config'] = 'aptconf',
['=tagging-method'] = 'arch',
['.arch-inventory'] = 'arch',
+ ['makefile.am'] = 'automake',
+ ['Makefile.am'] = 'automake',
['GNUmakefile.am'] = 'automake',
+ ['.bash_aliases'] = detect.bash,
+ ['.bash-aliases'] = detect.bash,
+ ['.bash_history'] = detect.bash,
+ ['.bash-history'] = detect.bash,
+ ['.bash_logout'] = detect.bash,
+ ['.bash-logout'] = detect.bash,
+ ['.bash_profile'] = detect.bash,
+ ['.bash-profile'] = detect.bash,
['named.root'] = 'bindzone',
WORKSPACE = 'bzl',
['WORKSPACE.bzlmod'] = 'bzl',
@@ -1373,6 +1508,7 @@ local filename = {
jbuild = 'dune',
['dune-workspace'] = 'dune',
['dune-project'] = 'dune',
+ ['dune-file'] = 'dune',
Earthfile = 'earthfile',
['.editorconfig'] = 'editorconfig',
['elinks.conf'] = 'elinks',
@@ -1409,6 +1545,7 @@ local filename = {
gnashpluginrc = 'gnash',
gnashrc = 'gnash',
['.gnuplot_history'] = 'gnuplot',
+ ['goaccess.conf'] = 'goaccess',
['go.sum'] = 'gosum',
['go.work.sum'] = 'gosum',
['go.work'] = 'gowork',
@@ -1445,11 +1582,15 @@ local filename = {
['ipf.conf'] = 'ipfilter',
['ipf6.conf'] = 'ipfilter',
['ipf.rules'] = 'ipfilter',
+ ['.bun_repl_history'] = 'javascript',
['.node_repl_history'] = 'javascript',
+ ['deno_history.txt'] = 'javascript',
['Pipfile.lock'] = 'json',
['.firebaserc'] = 'json',
['.prettierrc'] = 'json',
['.stylelintrc'] = 'json',
+ ['.lintstagedrc'] = 'json',
+ ['deno.lock'] = 'json',
['flake.lock'] = 'json',
['.babelrc'] = 'jsonc',
['.eslintrc'] = 'jsonc',
@@ -1461,9 +1602,14 @@ local filename = {
['.swrc'] = 'jsonc',
['.vsconfig'] = 'jsonc',
['.justfile'] = 'just',
+ ['justfile'] = 'just',
+ ['Justfile'] = 'just',
Kconfig = 'kconfig',
['Kconfig.debug'] = 'kconfig',
['Config.in'] = 'kconfig',
+ ['ldaprc'] = 'ldapconf',
+ ['.ldaprc'] = 'ldapconf',
+ ['ldap.conf'] = 'ldapconf',
['lftp.conf'] = 'lftp',
['.lftprc'] = 'lftp',
['/.libao'] = 'libao',
@@ -1509,6 +1655,8 @@ local filename = {
mrxvtrc = 'mrxvtrc',
['.mrxvtrc'] = 'mrxvtrc',
['.msmtprc'] = 'msmtp',
+ ['Muttngrc'] = 'muttrc',
+ ['Muttrc'] = 'muttrc',
['.mysql_history'] = 'mysql',
['/etc/nanorc'] = 'nanorc',
Neomuttrc = 'neomuttrc',
@@ -1520,6 +1668,7 @@ local filename = {
['octave.conf'] = 'octave',
['.ondirrc'] = 'ondir',
opam = 'opam',
+ ['opam.locked'] = 'opam',
['pacman.log'] = 'pacmanlog',
['/etc/pam.conf'] = 'pamconf',
['pam_env.conf'] = 'pamenv',
@@ -1532,6 +1681,9 @@ local filename = {
['/etc/shadow-'] = 'passwd',
['/etc/shadow'] = 'passwd',
['/etc/passwd.edit'] = 'passwd',
+ ['.gitolite.rc'] = 'perl',
+ ['gitolite.rc'] = 'perl',
+ ['example.gitolite.rc'] = 'perl',
['latexmkrc'] = 'perl',
['.latexmkrc'] = 'perl',
['pf.conf'] = 'pf',
@@ -1587,6 +1739,10 @@ local filename = {
irbrc = 'ruby',
['.irb_history'] = 'ruby',
irb_history = 'ruby',
+ ['rakefile'] = 'ruby',
+ ['Rakefile'] = 'ruby',
+ ['rantfile'] = 'ruby',
+ ['Rantfile'] = 'ruby',
Vagrantfile = 'ruby',
['smb.conf'] = 'samba',
screenrc = 'screen',
@@ -1597,6 +1753,8 @@ local filename = {
['/etc/serial.conf'] = 'setserial',
['/etc/udev/cdsymlinks.conf'] = 'sh',
['.ash_history'] = 'sh',
+ ['.devscripts'] = 'sh',
+ ['devscripts.conf'] = 'sh',
['makepkg.conf'] = 'sh',
['.makepkg.conf'] = 'sh',
['user-dirs.dirs'] = 'sh',
@@ -1618,6 +1776,7 @@ local filename = {
['/etc/slp.spi'] = 'slpspi',
['.slrnrc'] = 'slrnrc',
['sendmail.cf'] = 'sm',
+ Snakefile = 'snakemake',
['.sqlite_history'] = 'sql',
['squid.conf'] = 'squid',
['ssh_config'] = 'sshconfig',
@@ -1637,7 +1796,7 @@ local filename = {
['.xsdbcmdhistory'] = 'tcl',
['texmf.cnf'] = 'texmf',
COPYING = 'text',
- README = 'text',
+ README = detect_seq(detect.haredoc, 'text'),
LICENSE = 'text',
AUTHORS = 'text',
tfrc = 'tf',
@@ -1703,528 +1862,568 @@ local filename = {
}
-- Re-use closures as much as possible
-local detect_apache = starsetf('apache')
-local detect_muttrc = starsetf('muttrc')
-local detect_neomuttrc = starsetf('neomuttrc')
+local detect_apache_diretc = starsetf('apache', { parent = '/etc/' })
+local detect_apache_dotconf = starsetf('apache', { parent = '%.conf' })
+local detect_muttrc = starsetf('muttrc', { parent = 'utt' })
+local detect_neomuttrc = starsetf('neomuttrc', { parent = 'utt' })
+local detect_xkb = starsetf('xkb', { parent = '/usr/' })
---- @type vim.filetype.mapping
+---@type table<string,vim.filetype.mapping>
local pattern = {
-- BEGIN PATTERN
- ['.*/etc/a2ps/.*%.cfg'] = 'a2ps',
- ['.*/etc/a2ps%.cfg'] = 'a2ps',
- ['.*/usr/share/alsa/alsa%.conf'] = 'alsaconf',
- ['.*/etc/asound%.conf'] = 'alsaconf',
- ['.*/etc/apache2/sites%-.*/.*%.com'] = 'apache',
- ['.*/etc/httpd/.*%.conf'] = 'apache',
- ['.*/etc/apache2/.*%.conf.*'] = detect_apache,
- ['.*/etc/apache2/conf%..*/.*'] = detect_apache,
- ['.*/etc/apache2/mods%-.*/.*'] = detect_apache,
- ['.*/etc/apache2/sites%-.*/.*'] = detect_apache,
- ['access%.conf.*'] = detect_apache,
- ['apache%.conf.*'] = detect_apache,
- ['apache2%.conf.*'] = detect_apache,
- ['httpd%.conf.*'] = detect_apache,
- ['srm%.conf.*'] = detect_apache,
- ['.*/etc/httpd/conf%..*/.*'] = detect_apache,
- ['.*/etc/httpd/conf%.d/.*%.conf.*'] = detect_apache,
- ['.*/etc/httpd/mods%-.*/.*'] = detect_apache,
- ['.*/etc/httpd/sites%-.*/.*'] = detect_apache,
- ['.*/etc/proftpd/.*%.conf.*'] = starsetf('apachestyle'),
- ['.*/etc/proftpd/conf%..*/.*'] = starsetf('apachestyle'),
- ['proftpd%.conf.*'] = starsetf('apachestyle'),
- ['.*asterisk/.*%.conf.*'] = starsetf('asterisk'),
- ['.*asterisk.*/.*voicemail%.conf.*'] = starsetf('asteriskvm'),
- ['.*/%.aptitude/config'] = 'aptconf',
- ['.*%.[aA]'] = detect.asm,
- ['.*%.[sS]'] = detect.asm,
- ['[mM]akefile%.am'] = 'automake',
- ['.*/bind/db%..*'] = starsetf('bindzone'),
- ['.*/named/db%..*'] = starsetf('bindzone'),
- ['.*/build/conf/.*%.conf'] = 'bitbake',
- ['.*/meta/conf/.*%.conf'] = 'bitbake',
- ['.*/meta%-.*/conf/.*%.conf'] = 'bitbake',
- ['.*%.blade%.php'] = 'blade',
- ['bzr_log%..*'] = 'bzr',
- ['.*enlightenment/.*%.cfg'] = 'c',
- ['.*/%.cabal/config'] = 'cabalconfig',
- ['.*/cabal/config'] = 'cabalconfig',
- ['cabal%.project%..*'] = starsetf('cabalproject'),
- ['.*/%.calendar/.*'] = starsetf('calendar'),
- ['.*/share/calendar/.*/calendar%..*'] = starsetf('calendar'),
- ['.*/share/calendar/calendar%..*'] = starsetf('calendar'),
- ['sgml%.catalog.*'] = starsetf('catalog'),
- ['.*/etc/defaults/cdrdao'] = 'cdrdaoconf',
- ['.*/etc/cdrdao%.conf'] = 'cdrdaoconf',
- ['.*/etc/default/cdrdao'] = 'cdrdaoconf',
- ['.*hgrc'] = 'cfg',
- ['.*%.[Cc][Ff][Gg]'] = {
- detect.cfg,
- -- Decrease priority to avoid conflicts with more specific patterns
- -- such as '.*/etc/a2ps/.*%.cfg', '.*enlightenment/.*%.cfg', etc.
- { priority = -1 },
+ ['/debian/'] = {
+ ['/debian/changelog$'] = 'debchangelog',
+ ['/debian/control$'] = 'debcontrol',
+ ['/debian/copyright$'] = 'debcopyright',
+ ['/debian/patches/'] = detect.dep3patch,
+ },
+ ['/etc/'] = {
+ ['/etc/a2ps/.*%.cfg$'] = 'a2ps',
+ ['/etc/a2ps%.cfg$'] = 'a2ps',
+ ['/etc/asound%.conf$'] = 'alsaconf',
+ ['/etc/apache2/sites%-.*/.*%.com$'] = 'apache',
+ ['/etc/httpd/.*%.conf$'] = 'apache',
+ ['/etc/apache2/.*%.conf'] = detect_apache_diretc,
+ ['/etc/apache2/conf%..*/'] = detect_apache_diretc,
+ ['/etc/apache2/mods%-.*/'] = detect_apache_diretc,
+ ['/etc/apache2/sites%-.*/'] = detect_apache_diretc,
+ ['/etc/httpd/conf%..*/'] = detect_apache_diretc,
+ ['/etc/httpd/conf%.d/.*%.conf'] = detect_apache_diretc,
+ ['/etc/httpd/mods%-.*/'] = detect_apache_diretc,
+ ['/etc/httpd/sites%-.*/'] = detect_apache_diretc,
+ ['/etc/proftpd/.*%.conf'] = starsetf('apachestyle'),
+ ['/etc/proftpd/conf%..*/'] = starsetf('apachestyle'),
+ ['/etc/cdrdao%.conf$'] = 'cdrdaoconf',
+ ['/etc/default/cdrdao$'] = 'cdrdaoconf',
+ ['/etc/defaults/cdrdao$'] = 'cdrdaoconf',
+ ['/etc/translate%-shell$'] = 'clojure',
+ ['/etc/hostname%.'] = starsetf('config'),
+ ['/etc/cron%.d/'] = starsetf('crontab'),
+ ['/etc/apt/sources%.list%.d/.*%.sources$'] = 'deb822sources',
+ ['/etc/apt/sources%.list%.d/.*%.list$'] = 'debsources',
+ ['/etc/apt/sources%.list$'] = 'debsources',
+ ['/etc/DIR_COLORS$'] = 'dircolors',
+ ['/etc/dnsmasq%.conf$'] = 'dnsmasq',
+ ['/etc/dnsmasq%.d/'] = starsetf('dnsmasq'),
+ ['/etc/yum%.conf$'] = 'dosini',
+ ['/etc/yum%.repos%.d/'] = starsetf('dosini'),
+ ['/etc/gitconfig%.d/'] = starsetf('gitconfig'),
+ ['/etc/gitconfig$'] = 'gitconfig',
+ ['/etc/gitattributes$'] = 'gitattributes',
+ ['/etc/group$'] = 'group',
+ ['/etc/group%-$'] = 'group',
+ ['/etc/group%.edit$'] = 'group',
+ ['/etc/gshadow%-$'] = 'group',
+ ['/etc/gshadow%.edit$'] = 'group',
+ ['/etc/gshadow$'] = 'group',
+ ['/etc/grub%.conf$'] = 'grub',
+ ['/etc/host%.conf$'] = 'hostconf',
+ ['/etc/hosts%.allow$'] = 'hostsaccess',
+ ['/etc/hosts%.deny$'] = 'hostsaccess',
+ ['/etc/initng/.*/.*%.i$'] = 'initng',
+ ['/etc/libao%.conf$'] = 'libao',
+ ['/etc/.*limits%.conf$'] = 'limits',
+ ['/etc/.*limits%.d/.*%.conf$'] = 'limits',
+ ['/etc/limits$'] = 'limits',
+ ['/etc/logcheck/.*%.d.*/'] = starsetf('logcheck'),
+ ['/etc/login%.access$'] = 'loginaccess',
+ ['/etc/login%.defs$'] = 'logindefs',
+ ['/etc/aliases$'] = 'mailaliases',
+ ['/etc/mail/aliases$'] = 'mailaliases',
+ ['/etc/man%.conf$'] = 'manconf',
+ ['/etc/conf%.modules$'] = 'modconf',
+ ['/etc/modprobe%.'] = starsetf('modconf'),
+ ['/etc/modules%.conf$'] = 'modconf',
+ ['/etc/modules$'] = 'modconf',
+ ['/etc/modutils/'] = starsetf(function(path, bufnr)
+ if fn.executable(fn.expand(path)) ~= 1 then
+ return 'modconf'
+ end
+ end),
+ ['/etc/Muttrc%.d/'] = starsetf('muttrc'),
+ ['/etc/nanorc$'] = 'nanorc',
+ ['/etc/nginx/'] = 'nginx',
+ ['/etc/pam%.conf$'] = 'pamconf',
+ ['/etc/pam%.d/'] = starsetf('pamconf'),
+ ['/etc/passwd%-$'] = 'passwd',
+ ['/etc/shadow$'] = 'passwd',
+ ['/etc/shadow%.edit$'] = 'passwd',
+ ['/etc/passwd$'] = 'passwd',
+ ['/etc/passwd%.edit$'] = 'passwd',
+ ['/etc/shadow%-$'] = 'passwd',
+ ['/etc/pinforc$'] = 'pinfo',
+ ['/etc/protocols$'] = 'protocols',
+ ['/etc/sensors%.d/[^.]'] = starsetf('sensors'),
+ ['/etc/sensors%.conf$'] = 'sensors',
+ ['/etc/sensors3%.conf$'] = 'sensors',
+ ['/etc/services$'] = 'services',
+ ['/etc/serial%.conf$'] = 'setserial',
+ ['/etc/udev/cdsymlinks%.conf$'] = 'sh',
+ ['/etc/profile$'] = detect.sh,
+ ['/etc/slp%.conf$'] = 'slpconf',
+ ['/etc/slp%.reg$'] = 'slpreg',
+ ['/etc/slp%.spi$'] = 'slpspi',
+ ['/etc/sudoers%.d/'] = starsetf('sudoers'),
+ ['/etc/ssh/ssh_config%.d/.*%.conf$'] = 'sshconfig',
+ ['/etc/ssh/sshd_config%.d/.*%.conf$'] = 'sshdconfig',
+ ['/etc/sudoers$'] = 'sudoers',
+ ['/etc/sysctl%.conf$'] = 'sysctl',
+ ['/etc/sysctl%.d/.*%.conf$'] = 'sysctl',
+ ['/etc/systemd/.*%.conf%.d/.*%.conf$'] = 'systemd',
+ ['/etc/systemd/system/.*%.d/.*%.conf$'] = 'systemd',
+ ['/etc/systemd/system/.*%.d/%.#'] = 'systemd',
+ ['/etc/systemd/system/%.#'] = 'systemd',
+ ['/etc/config/'] = starsetf(detect.uci),
+ ['/etc/udev/udev%.conf$'] = 'udevconf',
+ ['/etc/udev/permissions%.d/.*%.permissions$'] = 'udevperm',
+ ['/etc/updatedb%.conf$'] = 'updatedb',
+ ['/etc/init/.*%.conf$'] = 'upstart',
+ ['/etc/init/.*%.override$'] = 'upstart',
+ ['/etc/xinetd%.conf$'] = 'xinetd',
+ ['/etc/xinetd%.d/'] = starsetf('xinetd'),
+ ['/etc/blkid%.tab%.old$'] = 'xml',
+ ['/etc/blkid%.tab$'] = 'xml',
+ ['/etc/xdg/menus/.*%.menu$'] = 'xml',
+ ['/etc/zprofile$'] = 'zsh',
},
- ['[cC]hange[lL]og.*'] = starsetf(detect.changelog),
- ['.*%.%.ch'] = 'chill',
- ['.*/etc/translate%-shell'] = 'clojure',
- ['.*%.cmake%.in'] = 'cmake',
- -- */cmus/rc and */.cmus/rc
- ['.*/%.?cmus/rc'] = 'cmusrc',
- -- */cmus/*.theme and */.cmus/*.theme
- ['.*/%.?cmus/.*%.theme'] = 'cmusrc',
- ['.*/%.cmus/autosave'] = 'cmusrc',
- ['.*/%.cmus/command%-history'] = 'cmusrc',
- ['.*/etc/hostname%..*'] = starsetf('config'),
- ['crontab%..*'] = starsetf('crontab'),
- ['.*/etc/cron%.d/.*'] = starsetf('crontab'),
- ['%.cshrc.*'] = detect.csh,
- ['%.login.*'] = detect.csh,
- ['cvs%d+'] = 'cvs',
- ['.*%.[Dd][Aa][Tt]'] = detect.dat,
- ['.*/debian/patches/.*'] = detect.dep3patch,
- ['.*/etc/dnsmasq%.d/.*'] = starsetf('dnsmasq'),
- ['Containerfile%..*'] = starsetf('dockerfile'),
- ['Dockerfile%..*'] = starsetf('dockerfile'),
- ['.*/etc/yum%.repos%.d/.*'] = starsetf('dosini'),
- ['drac%..*'] = starsetf('dracula'),
- ['.*/debian/changelog'] = 'debchangelog',
- ['.*/debian/control'] = 'debcontrol',
- ['.*/debian/copyright'] = 'debcopyright',
- ['.*/etc/apt/sources%.list%.d/.*%.list'] = 'debsources',
- ['.*/etc/apt/sources%.list'] = 'debsources',
- ['.*/etc/apt/sources%.list%.d/.*%.sources'] = 'deb822sources',
- ['.*%.directory'] = 'desktop',
- ['.*%.desktop'] = 'desktop',
- ['dictd.*%.conf'] = 'dictdconf',
- ['.*/etc/DIR_COLORS'] = 'dircolors',
- ['.*/etc/dnsmasq%.conf'] = 'dnsmasq',
- ['php%.ini%-.*'] = 'dosini',
- ['.*/%.aws/config'] = 'confini',
- ['.*/%.aws/credentials'] = 'confini',
- ['.*/etc/yum%.conf'] = 'dosini',
- ['.*/lxqt/.*%.conf'] = 'dosini',
- ['.*/screengrab/.*%.conf'] = 'dosini',
- ['.*/bpython/config'] = 'dosini',
- ['.*/mypy/config'] = 'dosini',
- ['.*/flatpak/repo/config'] = 'dosini',
- ['.*lvs'] = 'dracula',
- ['.*lpe'] = 'dracula',
- ['.*/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,
- ['[a-zA-Z].*Properties%..*'] = detect.foam,
- ['.*Transport%..*'] = detect.foam,
- ['.*/constant/g'] = detect.foam,
- ['.*/0/.*'] = detect.foam,
- ['.*/0%.orig/.*'] = detect.foam,
- ['.*/%.fvwm/.*'] = starsetf('fvwm'),
- ['.*fvwmrc.*'] = starsetf(detect.fvwm_v1),
- ['.*fvwm95.*%.hook'] = starsetf(detect.fvwm_v1),
- ['.*fvwm2rc.*'] = starsetf(detect.fvwm_v2),
- ['.*/tmp/lltmp.*'] = starsetf('gedcom'),
- ['.*/etc/gitconfig%.d/.*'] = starsetf('gitconfig'),
- ['.*/gitolite%-admin/conf/.*'] = starsetf('gitolite'),
- ['tmac%..*'] = starsetf('nroff'),
- ['.*/%.gitconfig%.d/.*'] = starsetf('gitconfig'),
- ['.*%.git/.*'] = {
- detect.git,
- -- Decrease priority to run after simple pattern checks
- { priority = -1 },
+ ['/log/'] = {
+ ['/log/auth%.crit$'] = 'messages',
+ ['/log/auth%.err$'] = 'messages',
+ ['/log/auth%.info$'] = 'messages',
+ ['/log/auth%.log$'] = 'messages',
+ ['/log/auth%.notice$'] = 'messages',
+ ['/log/auth%.warn$'] = 'messages',
+ ['/log/auth$'] = 'messages',
+ ['/log/cron%.crit$'] = 'messages',
+ ['/log/cron%.err$'] = 'messages',
+ ['/log/cron%.info$'] = 'messages',
+ ['/log/cron%.log$'] = 'messages',
+ ['/log/cron%.notice$'] = 'messages',
+ ['/log/cron%.warn$'] = 'messages',
+ ['/log/cron$'] = 'messages',
+ ['/log/daemon%.crit$'] = 'messages',
+ ['/log/daemon%.err$'] = 'messages',
+ ['/log/daemon%.info$'] = 'messages',
+ ['/log/daemon%.log$'] = 'messages',
+ ['/log/daemon%.notice$'] = 'messages',
+ ['/log/daemon%.warn$'] = 'messages',
+ ['/log/daemon$'] = 'messages',
+ ['/log/debug%.crit$'] = 'messages',
+ ['/log/debug%.err$'] = 'messages',
+ ['/log/debug%.info$'] = 'messages',
+ ['/log/debug%.log$'] = 'messages',
+ ['/log/debug%.notice$'] = 'messages',
+ ['/log/debug%.warn$'] = 'messages',
+ ['/log/debug$'] = 'messages',
+ ['/log/kern%.crit$'] = 'messages',
+ ['/log/kern%.err$'] = 'messages',
+ ['/log/kern%.info$'] = 'messages',
+ ['/log/kern%.log$'] = 'messages',
+ ['/log/kern%.notice$'] = 'messages',
+ ['/log/kern%.warn$'] = 'messages',
+ ['/log/kern$'] = 'messages',
+ ['/log/lpr%.crit$'] = 'messages',
+ ['/log/lpr%.err$'] = 'messages',
+ ['/log/lpr%.info$'] = 'messages',
+ ['/log/lpr%.log$'] = 'messages',
+ ['/log/lpr%.notice$'] = 'messages',
+ ['/log/lpr%.warn$'] = 'messages',
+ ['/log/lpr$'] = 'messages',
+ ['/log/mail%.crit$'] = 'messages',
+ ['/log/mail%.err$'] = 'messages',
+ ['/log/mail%.info$'] = 'messages',
+ ['/log/mail%.log$'] = 'messages',
+ ['/log/mail%.notice$'] = 'messages',
+ ['/log/mail%.warn$'] = 'messages',
+ ['/log/mail$'] = 'messages',
+ ['/log/messages%.crit$'] = 'messages',
+ ['/log/messages%.err$'] = 'messages',
+ ['/log/messages%.info$'] = 'messages',
+ ['/log/messages%.log$'] = 'messages',
+ ['/log/messages%.notice$'] = 'messages',
+ ['/log/messages%.warn$'] = 'messages',
+ ['/log/messages$'] = 'messages',
+ ['/log/news/news%.crit$'] = 'messages',
+ ['/log/news/news%.err$'] = 'messages',
+ ['/log/news/news%.info$'] = 'messages',
+ ['/log/news/news%.log$'] = 'messages',
+ ['/log/news/news%.notice$'] = 'messages',
+ ['/log/news/news%.warn$'] = 'messages',
+ ['/log/news/news$'] = 'messages',
+ ['/log/syslog%.crit$'] = 'messages',
+ ['/log/syslog%.err$'] = 'messages',
+ ['/log/syslog%.info$'] = 'messages',
+ ['/log/syslog%.log$'] = 'messages',
+ ['/log/syslog%.notice$'] = 'messages',
+ ['/log/syslog%.warn$'] = 'messages',
+ ['/log/syslog$'] = 'messages',
+ ['/log/user%.crit$'] = 'messages',
+ ['/log/user%.err$'] = 'messages',
+ ['/log/user%.info$'] = 'messages',
+ ['/log/user%.log$'] = 'messages',
+ ['/log/user%.notice$'] = 'messages',
+ ['/log/user%.warn$'] = 'messages',
+ ['/log/user$'] = 'messages',
+ },
+ ['/systemd/'] = {
+ ['/%.config/systemd/user/%.#'] = 'systemd',
+ ['/%.config/systemd/user/.*%.d/%.#'] = 'systemd',
+ ['/%.config/systemd/user/.*%.d/.*%.conf$'] = 'systemd',
+ ['/systemd/.*%.automount$'] = 'systemd',
+ ['/systemd/.*%.dnssd$'] = 'systemd',
+ ['/systemd/.*%.link$'] = 'systemd',
+ ['/systemd/.*%.mount$'] = 'systemd',
+ ['/systemd/.*%.netdev$'] = 'systemd',
+ ['/systemd/.*%.network$'] = 'systemd',
+ ['/systemd/.*%.nspawn$'] = 'systemd',
+ ['/systemd/.*%.path$'] = 'systemd',
+ ['/systemd/.*%.service$'] = 'systemd',
+ ['/systemd/.*%.slice$'] = 'systemd',
+ ['/systemd/.*%.socket$'] = 'systemd',
+ ['/systemd/.*%.swap$'] = 'systemd',
+ ['/systemd/.*%.target$'] = 'systemd',
+ ['/systemd/.*%.timer$'] = 'systemd',
+ },
+ ['/usr/'] = {
+ ['/usr/share/alsa/alsa%.conf$'] = 'alsaconf',
+ ['/usr/.*/gnupg/options%.skel$'] = 'gpg',
+ ['/usr/share/upstart/.*%.conf$'] = 'upstart',
+ ['/usr/share/upstart/.*%.override$'] = 'upstart',
+ ['/usr/share/X11/xkb/compat/'] = detect_xkb,
+ ['/usr/share/X11/xkb/geometry/'] = detect_xkb,
+ ['/usr/share/X11/xkb/keycodes/'] = detect_xkb,
+ ['/usr/share/X11/xkb/symbols/'] = detect_xkb,
+ ['/usr/share/X11/xkb/types/'] = detect_xkb,
+ },
+ ['/var/'] = {
+ ['/var/backups/group%.bak$'] = 'group',
+ ['/var/backups/gshadow%.bak$'] = 'group',
+ ['/var/backups/passwd%.bak$'] = 'passwd',
+ ['/var/backups/shadow%.bak$'] = 'passwd',
+ },
+ ['/conf'] = {
+ ['/%.aptitude/config$'] = 'aptconf',
+ ['/build/conf/.*%.conf$'] = 'bitbake',
+ ['/meta%-.*/conf/.*%.conf$'] = 'bitbake',
+ ['/meta/conf/.*%.conf$'] = 'bitbake',
+ ['/%.cabal/config$'] = 'cabalconfig',
+ ['/cabal/config$'] = 'cabalconfig',
+ ['/%.aws/config$'] = 'confini',
+ ['/bpython/config$'] = 'dosini',
+ ['/flatpak/repo/config$'] = 'dosini',
+ ['/mypy/config$'] = 'dosini',
+ ['^${HOME}/%.config/notmuch/.*/config$'] = 'dosini',
+ ['^${XDG_CONFIG_HOME}/notmuch/.*/config$'] = 'dosini',
+ ['^${XDG_CONFIG_HOME}/git/config$'] = 'gitconfig',
+ ['%.git/config%.worktree$'] = 'gitconfig',
+ ['%.git/config$'] = 'gitconfig',
+ ['%.git/modules/.*/config$'] = 'gitconfig',
+ ['%.git/modules/config$'] = 'gitconfig',
+ ['%.git/worktrees/.*/config%.worktree$'] = 'gitconfig',
+ ['/%.config/git/config$'] = 'gitconfig',
+ ['/gitolite%-admin/conf/'] = starsetf('gitolite'),
+ ['/%.i3/config$'] = 'i3config',
+ ['/i3/config$'] = 'i3config',
+ ['/supertux2/config$'] = 'lisp',
+ ['/%.mplayer/config$'] = 'mplayerconf',
+ ['/neofetch/config%.conf$'] = 'sh',
+ ['/%.ssh/config$'] = 'sshconfig',
+ ['/%.sway/config$'] = 'swayconfig',
+ ['/sway/config$'] = 'swayconfig',
+ ['/%.cargo/config$'] = 'toml',
+ ['/%.bundle/config$'] = 'yaml',
+ },
+ ['/%.'] = {
+ ['/%.aws/credentials$'] = 'confini',
+ ['/%.gitconfig%.d/'] = starsetf('gitconfig'),
+ ['/%.gnupg/gpg%.conf$'] = 'gpg',
+ ['/%.gnupg/options$'] = 'gpg',
+ ['/%.icewm/menu$'] = 'icemenu',
+ ['/%.libao$'] = 'libao',
+ ['/%.pinforc$'] = 'pinfo',
+ ['/%.cargo/credentials$'] = 'toml',
+ ['/%.init/.*%.override$'] = 'upstart',
+ },
+ ['calendar/'] = {
+ ['/%.calendar/'] = starsetf('calendar'),
+ ['/share/calendar/.*/calendar%.'] = starsetf('calendar'),
+ ['/share/calendar/calendar%.'] = starsetf('calendar'),
+ },
+ ['cmus/'] = {
+ -- */cmus/*.theme and */.cmus/*.theme
+ ['/%.?cmus/.*%.theme$'] = 'cmusrc',
+ -- */cmus/rc and */.cmus/rc
+ ['/%.?cmus/rc$'] = 'cmusrc',
+ ['/%.cmus/autosave$'] = 'cmusrc',
+ ['/%.cmus/command%-history$'] = 'cmusrc',
+ },
+ ['git/'] = {
+ ['%.git/'] = {
+ detect.git,
+ -- Decrease priority to run after simple pattern checks
+ { priority = -1 },
+ },
+ ['^${XDG_CONFIG_HOME}/git/attributes$'] = 'gitattributes',
+ ['%.git/info/attributes$'] = 'gitattributes',
+ ['/%.config/git/attributes$'] = 'gitattributes',
+ ['^${XDG_CONFIG_HOME}/git/ignore$'] = 'gitignore',
+ ['%.git/info/exclude$'] = 'gitignore',
+ ['/%.config/git/ignore$'] = 'gitignore',
+ },
+ ['%.cfg'] = {
+ ['enlightenment/.*%.cfg$'] = 'c',
+ ['Eterm/.*%.cfg$'] = 'eterm',
+ ['baseq[2-3]/.*%.cfg$'] = 'quake',
+ ['id1/.*%.cfg$'] = 'quake',
+ ['quake[1-3]/.*%.cfg$'] = 'quake',
+ ['/tex/latex/.*%.cfg$'] = 'tex',
+ },
+ ['%.conf'] = {
+ ['^proftpd%.conf'] = starsetf('apachestyle'),
+ ['^access%.conf'] = detect_apache_dotconf,
+ ['^apache%.conf'] = detect_apache_dotconf,
+ ['^apache2%.conf'] = detect_apache_dotconf,
+ ['^httpd%.conf'] = detect_apache_dotconf,
+ ['^srm%.conf'] = detect_apache_dotconf,
+ ['asterisk/.*%.conf'] = starsetf('asterisk'),
+ ['asterisk.*/.*voicemail%.conf'] = starsetf('asteriskvm'),
+ ['^dictd.*%.conf$'] = 'dictdconf',
+ ['/lxqt/.*%.conf$'] = 'dosini',
+ ['/screengrab/.*%.conf$'] = 'dosini',
+ ['^${GNUPGHOME}/gpg%.conf$'] = 'gpg',
+ ['/boot/grub/grub%.conf$'] = 'grub',
+ ['^lilo%.conf'] = starsetf('lilo'),
+ ['^named.*%.conf$'] = 'named',
+ ['^rndc.*%.conf$'] = 'named',
+ ['/openvpn/.*/.*%.conf$'] = 'openvpn',
+ ['/%.ssh/.*%.conf$'] = 'sshconfig',
+ ['^%.?tmux.*%.conf$'] = 'tmux',
+ ['^%.?tmux.*%.conf'] = { 'tmux', { priority = -1 } },
+ ['/%.config/upstart/.*%.conf$'] = 'upstart',
+ ['/%.config/upstart/.*%.override$'] = 'upstart',
+ ['/%.init/.*%.conf$'] = 'upstart',
+ ['/xorg%.conf%.d/.*%.conf$'] = detect.xfree86_v4,
+ },
+ ['sst%.meta'] = {
+ ['%.%-sst%.meta$'] = 'sisu',
+ ['%._sst%.meta$'] = 'sisu',
+ ['%.sst%.meta$'] = 'sisu',
+ },
+ ['file'] = {
+ ['^Containerfile%.'] = starsetf('dockerfile'),
+ ['^Dockerfile%.'] = starsetf('dockerfile'),
+ ['[mM]akefile$'] = detect.make,
+ ['^[mM]akefile'] = starsetf('make'),
+ ['^[rR]akefile'] = starsetf('ruby'),
+ ['^%.profile'] = detect.sh,
+ },
+ ['fvwm'] = {
+ ['/%.fvwm/'] = starsetf('fvwm'),
+ ['fvwmrc'] = starsetf(detect.fvwm_v1),
+ ['fvwm95.*%.hook$'] = starsetf(detect.fvwm_v1),
+ ['fvwm2rc'] = starsetf(detect.fvwm_v2),
+ },
+ ['nginx'] = {
+ ['/nginx/.*%.conf$'] = 'nginx',
+ ['/usr/local/nginx/conf/'] = 'nginx',
+ ['nginx%.conf$'] = 'nginx',
+ ['^nginx.*%.conf$'] = 'nginx',
+ },
+ ['require'] = {
+ ['%-requirements%.txt$'] = 'requirements',
+ ['^requirements/.*%.txt$'] = 'requirements',
+ ['^requires/.*%.txt$'] = 'requirements',
+ },
+ ['s6'] = {
+ ['s6.*/down$'] = 'execline',
+ ['s6.*/finish$'] = 'execline',
+ ['s6.*/run$'] = 'execline',
+ ['s6.*/up$'] = 'execline',
+ ['^s6%-'] = 'execline',
+ },
+ ['utt'] = {
+ ['^mutt%-.*%-%w+$'] = 'mail',
+ ['^mutt' .. string.rep('[%w_-]', 6) .. '$'] = 'mail',
+ ['^muttng%-.*%-%w+$'] = 'mail',
+ ['^neomutt%-.*%-%w+$'] = 'mail',
+ ['^neomutt' .. string.rep('[%w_-]', 6) .. '$'] = 'mail',
+ -- muttngrc* and .muttngrc*
+ ['^%.?muttngrc'] = detect_muttrc,
+ -- muttrc* and .muttrc*
+ ['^%.?muttrc'] = detect_muttrc,
+ ['/%.mutt/muttrc'] = detect_muttrc,
+ ['/%.muttng/muttngrc'] = detect_muttrc,
+ ['/%.muttng/muttrc'] = detect_muttrc,
+ ['^Muttngrc'] = detect_muttrc,
+ ['^Muttrc'] = detect_muttrc,
+ -- neomuttrc* and .neomuttrc*
+ ['^%.?neomuttrc'] = detect_neomuttrc,
+ ['/%.neomutt/neomuttrc'] = detect_neomuttrc,
+ ['^Neomuttrc'] = detect_neomuttrc,
+ },
+ ['^%.'] = {
+ ['^%.cshrc'] = detect.csh,
+ ['^%.login'] = detect.csh,
+ ['^%.notmuch%-config%.'] = 'dosini',
+ ['^%.gitsendemail%.msg%.......$'] = 'gitsendemail',
+ ['^%.kshrc'] = detect.ksh,
+ ['^%.article%.%d+$'] = 'mail',
+ ['^%.letter%.%d+$'] = 'mail',
+ ['^%.reminders'] = starsetf('remind'),
+ ['^%.tcshrc'] = detect.tcsh,
+ ['^%.zcompdump'] = starsetf('zsh'),
+ },
+ ['proj%.user$'] = {
+ ['%.csproj%.user$'] = 'xml',
+ ['%.fsproj%.user$'] = 'xml',
+ ['%.vbproj%.user$'] = 'xml',
+ },
+ [''] = {
+ ['^bash%-fc[%-%.]'] = detect.bash,
+ ['/bind/db%.'] = starsetf('bindzone'),
+ ['/named/db%.'] = starsetf('bindzone'),
+ ['%.blade%.php$'] = 'blade',
+ ['^bzr_log%.'] = 'bzr',
+ ['^cabal%.project%.'] = starsetf('cabalproject'),
+ ['^sgml%.catalog'] = starsetf('catalog'),
+ ['hgrc$'] = 'cfg',
+ ['^[cC]hange[lL]og'] = starsetf(detect.changelog),
+ ['%.%.ch$'] = 'chill',
+ ['%.cmake%.in$'] = 'cmake',
+ ['^crontab%.'] = starsetf('crontab'),
+ ['^cvs%d+$'] = 'cvs',
+ ['^php%.ini%-'] = 'dosini',
+ ['^drac%.'] = starsetf('dracula'),
+ ['/dtrace/.*%.d$'] = 'dtrace',
+ ['esmtprc$'] = 'esmtprc',
+ ['/0%.orig/'] = detect.foam,
+ ['/0/'] = detect.foam,
+ ['/constant/g$'] = detect.foam,
+ ['Transport%.'] = detect.foam,
+ ['^[a-zA-Z0-9].*Dict%.'] = detect.foam,
+ ['^[a-zA-Z0-9].*Dict$'] = detect.foam,
+ ['^[a-zA-Z].*Properties%.'] = detect.foam,
+ ['^[a-zA-Z].*Properties$'] = detect.foam,
+ ['/tmp/lltmp'] = starsetf('gedcom'),
+ ['^gkrellmrc_.$'] = 'gkrellmrc',
+ ['^${GNUPGHOME}/options$'] = 'gpg',
+ ['/boot/grub/menu%.lst$'] = 'grub',
+ -- gtkrc* and .gtkrc*
+ ['^%.?gtkrc'] = starsetf('gtkrc'),
+ ['^${VIMRUNTIME}/doc/.*%.txt$'] = 'help',
+ ['^hg%-editor%-.*%.txt$'] = 'hgcommit',
+ ['%.html%.m4$'] = 'htmlm4',
+ ['^JAM.*%.'] = starsetf('jam'),
+ ['^Prl.*%.'] = starsetf('jam'),
+ ['%.properties_..$'] = 'jproperties',
+ ['%.properties_.._..$'] = 'jproperties',
+ ['%.properties_.._.._'] = starsetf('jproperties'),
+ ['^org%.eclipse%..*%.prefs$'] = 'jproperties',
+ ['^[jt]sconfig.*%.json$'] = 'jsonc',
+ ['^Config%.in%.'] = starsetf('kconfig'),
+ ['^Kconfig%.'] = starsetf('kconfig'),
+ ['/ldscripts/'] = 'ld',
+ ['lftp/rc$'] = 'lftp',
+ ['/LiteStep/.*/.*%.rc$'] = 'litestep',
+ ['^/tmp/SLRN[0-9A-Z.]+$'] = 'mail',
+ ['^ae%d+%.txt$'] = 'mail',
+ ['^pico%.%d+$'] = 'mail',
+ ['^reportbug%-'] = starsetf('mail'),
+ ['^snd%.%d+$'] = 'mail',
+ ['^rndc.*%.key$'] = 'named',
+ ['^tmac%.'] = starsetf('nroff'),
+ ['%.ml%.cppo$'] = 'ocaml',
+ ['%.mli%.cppo$'] = 'ocaml',
+ ['/octave/history$'] = 'octave',
+ ['%.opam%.locked$'] = 'opam',
+ ['%.opam%.template$'] = 'opam',
+ ['printcap'] = starsetf(function(path, bufnr)
+ return require('vim.filetype.detect').printcap('print')
+ end),
+ ['/queries/.*%.scm$'] = 'query', -- treesitter queries (Neovim only)
+ [',v$'] = 'rcs',
+ ['^svn%-commit.*%.tmp$'] = 'svn',
+ ['%.swift%.gyb$'] = 'swiftgyb',
+ ['termcap'] = starsetf(function(path, bufnr)
+ return require('vim.filetype.detect').printcap('term')
+ end),
+ ['%.t%.html$'] = 'tilde',
+ ['%.vhdl_[0-9]'] = starsetf('vhdl'),
+ ['vimrc'] = starsetf('vim'),
+ ['/Xresources/'] = starsetf('xdefaults'),
+ ['/app%-defaults/'] = starsetf('xdefaults'),
+ ['^Xresources'] = starsetf('xdefaults'),
+ -- Increase priority to run before the pattern below
+ ['^XF86Config%-4'] = starsetf(detect.xfree86_v4, { priority = -math.huge + 1 }),
+ ['^XF86Config'] = starsetf(detect.xfree86_v3),
+ ['Xmodmap$'] = 'xmodmap',
+ ['xmodmap'] = starsetf('xmodmap'),
+ -- .zlog* and zlog*
+ ['^%.?zlog'] = starsetf('zsh'),
+ -- .zsh* and zsh*
+ ['^%.?zsh'] = starsetf('zsh'),
+ -- Ignored extension
+ ['~$'] = function(path, bufnr)
+ local short = path:gsub('~+$', '', 1)
+ if path ~= short and short ~= '' then
+ return M.match({ buf = bufnr, filename = fn.fnameescape(short) })
+ end
+ end,
},
- ['.*%.git/modules/.*/config'] = 'gitconfig',
- ['.*%.git/modules/config'] = 'gitconfig',
- ['.*%.git/config'] = 'gitconfig',
- ['.*/etc/gitconfig'] = 'gitconfig',
- ['.*/%.config/git/config'] = 'gitconfig',
- ['.*%.git/config%.worktree'] = 'gitconfig',
- ['.*%.git/worktrees/.*/config%.worktree'] = 'gitconfig',
- ['${XDG_CONFIG_HOME}/git/config'] = 'gitconfig',
- ['.*%.git/info/attributes'] = 'gitattributes',
- ['.*/etc/gitattributes'] = 'gitattributes',
- ['.*/%.config/git/attributes'] = 'gitattributes',
- ['${XDG_CONFIG_HOME}/git/attributes'] = 'gitattributes',
- ['.*%.git/info/exclude'] = 'gitignore',
- ['.*/%.config/git/ignore'] = 'gitignore',
- ['${XDG_CONFIG_HOME}/git/ignore'] = 'gitignore',
- ['%.gitsendemail%.msg%.......'] = 'gitsendemail',
- ['gkrellmrc_.'] = 'gkrellmrc',
- ['.*/usr/.*/gnupg/options%.skel'] = 'gpg',
- ['.*/%.gnupg/options'] = 'gpg',
- ['.*/%.gnupg/gpg%.conf'] = 'gpg',
- ['${GNUPGHOME}/options'] = 'gpg',
- ['${GNUPGHOME}/gpg%.conf'] = 'gpg',
- ['.*/etc/group'] = 'group',
- ['.*/etc/gshadow'] = 'group',
- ['.*/etc/group%.edit'] = 'group',
- ['.*/var/backups/gshadow%.bak'] = 'group',
- ['.*/etc/group%-'] = 'group',
- ['.*/etc/gshadow%-'] = 'group',
- ['.*/var/backups/group%.bak'] = 'group',
- ['.*/etc/gshadow%.edit'] = 'group',
- ['.*/boot/grub/grub%.conf'] = 'grub',
- ['.*/boot/grub/menu%.lst'] = 'grub',
- ['.*/etc/grub%.conf'] = 'grub',
- -- gtkrc* and .gtkrc*
- ['%.?gtkrc.*'] = starsetf('gtkrc'),
- ['${VIMRUNTIME}/doc/.*%.txt'] = 'help',
- ['hg%-editor%-.*%.txt'] = 'hgcommit',
- ['.*/etc/host%.conf'] = 'hostconf',
- ['.*/etc/hosts%.deny'] = 'hostsaccess',
- ['.*/etc/hosts%.allow'] = 'hostsaccess',
- ['.*%.html%.m4'] = 'htmlm4',
- ['.*/%.i3/config'] = 'i3config',
- ['.*/i3/config'] = 'i3config',
- ['.*/%.icewm/menu'] = 'icemenu',
- ['.*/etc/initng/.*/.*%.i'] = 'initng',
- ['JAM.*%..*'] = starsetf('jam'),
- ['Prl.*%..*'] = starsetf('jam'),
- ['.*%.properties_..'] = 'jproperties',
- ['.*%.properties_.._..'] = 'jproperties',
- ['org%.eclipse%..*%.prefs'] = 'jproperties',
- ['.*%.properties_.._.._.*'] = starsetf('jproperties'),
- ['[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'),
- ['.*/ldscripts/.*'] = 'ld',
- ['.*lftp/rc'] = 'lftp',
- ['.*/%.libao'] = 'libao',
- ['.*/etc/libao%.conf'] = 'libao',
- ['.*/etc/.*limits%.conf'] = 'limits',
- ['.*/etc/limits'] = 'limits',
- ['.*/etc/.*limits%.d/.*%.conf'] = 'limits',
- ['.*/supertux2/config'] = 'lisp',
- ['.*/LiteStep/.*/.*%.rc'] = 'litestep',
- ['.*/etc/login%.access'] = 'loginaccess',
- ['.*/etc/login%.defs'] = 'logindefs',
- ['%.letter%.%d+'] = 'mail',
- ['%.article%.%d+'] = 'mail',
- ['/tmp/SLRN[0-9A-Z.]+'] = 'mail',
- ['ae%d+%.txt'] = 'mail',
- ['pico%.%d+'] = 'mail',
- ['mutt%-.*%-%w+'] = 'mail',
- ['muttng%-.*%-%w+'] = 'mail',
- ['neomutt%-.*%-%w+'] = 'mail',
- ['mutt' .. string.rep('[%w_-]', 6)] = 'mail',
- ['neomutt' .. string.rep('[%w_-]', 6)] = 'mail',
- ['snd%.%d+'] = 'mail',
- ['reportbug%-.*'] = starsetf('mail'),
- ['.*/etc/mail/aliases'] = 'mailaliases',
- ['.*/etc/aliases'] = 'mailaliases',
- ['.*[mM]akefile'] = 'make',
- ['[mM]akefile.*'] = starsetf('make'),
- ['.*/etc/man%.conf'] = 'manconf',
- ['.*/log/auth'] = 'messages',
- ['.*/log/cron'] = 'messages',
- ['.*/log/daemon'] = 'messages',
- ['.*/log/debug'] = 'messages',
- ['.*/log/kern'] = 'messages',
- ['.*/log/lpr'] = 'messages',
- ['.*/log/mail'] = 'messages',
- ['.*/log/messages'] = 'messages',
- ['.*/log/news/news'] = 'messages',
- ['.*/log/syslog'] = 'messages',
- ['.*/log/user'] = 'messages',
- ['.*/log/auth%.log'] = 'messages',
- ['.*/log/cron%.log'] = 'messages',
- ['.*/log/daemon%.log'] = 'messages',
- ['.*/log/debug%.log'] = 'messages',
- ['.*/log/kern%.log'] = 'messages',
- ['.*/log/lpr%.log'] = 'messages',
- ['.*/log/mail%.log'] = 'messages',
- ['.*/log/messages%.log'] = 'messages',
- ['.*/log/news/news%.log'] = 'messages',
- ['.*/log/syslog%.log'] = 'messages',
- ['.*/log/user%.log'] = 'messages',
- ['.*/log/auth%.err'] = 'messages',
- ['.*/log/cron%.err'] = 'messages',
- ['.*/log/daemon%.err'] = 'messages',
- ['.*/log/debug%.err'] = 'messages',
- ['.*/log/kern%.err'] = 'messages',
- ['.*/log/lpr%.err'] = 'messages',
- ['.*/log/mail%.err'] = 'messages',
- ['.*/log/messages%.err'] = 'messages',
- ['.*/log/news/news%.err'] = 'messages',
- ['.*/log/syslog%.err'] = 'messages',
- ['.*/log/user%.err'] = 'messages',
- ['.*/log/auth%.info'] = 'messages',
- ['.*/log/cron%.info'] = 'messages',
- ['.*/log/daemon%.info'] = 'messages',
- ['.*/log/debug%.info'] = 'messages',
- ['.*/log/kern%.info'] = 'messages',
- ['.*/log/lpr%.info'] = 'messages',
- ['.*/log/mail%.info'] = 'messages',
- ['.*/log/messages%.info'] = 'messages',
- ['.*/log/news/news%.info'] = 'messages',
- ['.*/log/syslog%.info'] = 'messages',
- ['.*/log/user%.info'] = 'messages',
- ['.*/log/auth%.warn'] = 'messages',
- ['.*/log/cron%.warn'] = 'messages',
- ['.*/log/daemon%.warn'] = 'messages',
- ['.*/log/debug%.warn'] = 'messages',
- ['.*/log/kern%.warn'] = 'messages',
- ['.*/log/lpr%.warn'] = 'messages',
- ['.*/log/mail%.warn'] = 'messages',
- ['.*/log/messages%.warn'] = 'messages',
- ['.*/log/news/news%.warn'] = 'messages',
- ['.*/log/syslog%.warn'] = 'messages',
- ['.*/log/user%.warn'] = 'messages',
- ['.*/log/auth%.crit'] = 'messages',
- ['.*/log/cron%.crit'] = 'messages',
- ['.*/log/daemon%.crit'] = 'messages',
- ['.*/log/debug%.crit'] = 'messages',
- ['.*/log/kern%.crit'] = 'messages',
- ['.*/log/lpr%.crit'] = 'messages',
- ['.*/log/mail%.crit'] = 'messages',
- ['.*/log/messages%.crit'] = 'messages',
- ['.*/log/news/news%.crit'] = 'messages',
- ['.*/log/syslog%.crit'] = 'messages',
- ['.*/log/user%.crit'] = 'messages',
- ['.*/log/auth%.notice'] = 'messages',
- ['.*/log/cron%.notice'] = 'messages',
- ['.*/log/daemon%.notice'] = 'messages',
- ['.*/log/debug%.notice'] = 'messages',
- ['.*/log/kern%.notice'] = 'messages',
- ['.*/log/lpr%.notice'] = 'messages',
- ['.*/log/mail%.notice'] = 'messages',
- ['.*/log/messages%.notice'] = 'messages',
- ['.*/log/news/news%.notice'] = 'messages',
- ['.*/log/syslog%.notice'] = 'messages',
- ['.*/log/user%.notice'] = 'messages',
- ['.*%.[Mm][Oo][Dd]'] = detect.mod,
- ['.*/etc/modules%.conf'] = 'modconf',
- ['.*/etc/conf%.modules'] = 'modconf',
- ['.*/etc/modules'] = 'modconf',
- ['.*/etc/modprobe%..*'] = starsetf('modconf'),
- ['.*/etc/modutils/.*'] = starsetf(function(path, bufnr)
- if fn.executable(fn.expand(path)) ~= 1 then
- return 'modconf'
- end
- end),
- ['.*%.[mi][3g]'] = 'modula3',
- ['Muttrc'] = 'muttrc',
- ['Muttngrc'] = 'muttrc',
- ['.*/etc/Muttrc%.d/.*'] = starsetf('muttrc'),
- ['.*/%.mplayer/config'] = 'mplayerconf',
- ['Muttrc.*'] = detect_muttrc,
- ['Muttngrc.*'] = detect_muttrc,
- -- muttrc* and .muttrc*
- ['%.?muttrc.*'] = detect_muttrc,
- -- muttngrc* and .muttngrc*
- ['%.?muttngrc.*'] = detect_muttrc,
- ['.*/%.mutt/muttrc.*'] = detect_muttrc,
- ['.*/%.muttng/muttrc.*'] = detect_muttrc,
- ['.*/%.muttng/muttngrc.*'] = detect_muttrc,
- ['rndc.*%.conf'] = 'named',
- ['rndc.*%.key'] = 'named',
- ['named.*%.conf'] = 'named',
- ['.*/etc/nanorc'] = 'nanorc',
- ['.*%.NS[ACGLMNPS]'] = 'natural',
- ['Neomuttrc.*'] = detect_neomuttrc,
- -- neomuttrc* and .neomuttrc*
- ['%.?neomuttrc.*'] = detect_neomuttrc,
- ['.*/%.neomutt/neomuttrc.*'] = detect_neomuttrc,
- ['nginx.*%.conf'] = 'nginx',
- ['.*/etc/nginx/.*'] = 'nginx',
- ['.*nginx%.conf'] = 'nginx',
- ['.*/nginx/.*%.conf'] = 'nginx',
- ['.*/usr/local/nginx/conf/.*'] = 'nginx',
- ['.*%.[1-9]'] = detect.nroff,
- ['.*%.ml%.cppo'] = 'ocaml',
- ['.*%.mli%.cppo'] = 'ocaml',
- ['.*/octave/history'] = 'octave',
- ['.*%.opam%.template'] = 'opam',
- ['.*/openvpn/.*/.*%.conf'] = 'openvpn',
- ['.*%.[Oo][Pp][Ll]'] = 'opl',
- ['.*/etc/pam%.conf'] = 'pamconf',
- ['.*/etc/pam%.d/.*'] = starsetf('pamconf'),
- ['.*/etc/passwd%-'] = 'passwd',
- ['.*/etc/shadow'] = 'passwd',
- ['.*/etc/shadow%.edit'] = 'passwd',
- ['.*/var/backups/shadow%.bak'] = 'passwd',
- ['.*/var/backups/passwd%.bak'] = 'passwd',
- ['.*/etc/passwd'] = 'passwd',
- ['.*/etc/passwd%.edit'] = 'passwd',
- ['.*/etc/shadow%-'] = 'passwd',
- ['%.?gitolite%.rc'] = 'perl',
- ['example%.gitolite%.rc'] = 'perl',
- ['.*%.php%d'] = 'php',
- ['.*/%.pinforc'] = 'pinfo',
- ['.*/etc/pinforc'] = 'pinfo',
- ['.*%.[Pp][Rr][Gg]'] = detect.prg,
- ['.*/etc/protocols'] = 'protocols',
- ['.*printcap.*'] = starsetf(function(path, bufnr)
- return require('vim.filetype.detect').printcap('print')
- end),
- ['.*baseq[2-3]/.*%.cfg'] = 'quake',
- ['.*quake[1-3]/.*%.cfg'] = 'quake',
- ['.*id1/.*%.cfg'] = 'quake',
- ['.*/queries/.*%.scm'] = 'query', -- treesitter queries (Neovim only)
- ['.*,v'] = 'rcs',
- ['%.reminders.*'] = starsetf('remind'),
- ['.*%-requirements%.txt'] = 'requirements',
- ['requirements/.*%.txt'] = 'requirements',
- ['requires/.*%.txt'] = 'requirements',
- ['[rR]akefile.*'] = starsetf('ruby'),
- ['[rR]antfile'] = 'ruby',
- ['[rR]akefile'] = 'ruby',
- ['.*/etc/sensors%.d/[^.].*'] = starsetf('sensors'),
- ['.*/etc/sensors%.conf'] = 'sensors',
- ['.*/etc/sensors3%.conf'] = 'sensors',
- ['.*/etc/services'] = 'services',
- ['.*/etc/serial%.conf'] = 'setserial',
- ['.*/etc/udev/cdsymlinks%.conf'] = 'sh',
- ['.*/neofetch/config%.conf'] = 'sh',
- ['%.bash[_%-]aliases'] = detect.bash,
- ['%.bash[_%-]history'] = detect.bash,
- ['%.bash[_%-]logout'] = detect.bash,
- ['%.bash[_%-]profile'] = detect.bash,
- ['%.kshrc.*'] = detect.ksh,
- ['%.profile.*'] = detect.sh,
- ['.*/etc/profile'] = detect.sh,
- ['bash%-fc[%-%.].*'] = detect.bash,
- ['%.tcshrc.*'] = detect.tcsh,
- ['.*/etc/sudoers%.d/.*'] = starsetf('sudoers'),
- ['.*%._sst%.meta'] = 'sisu',
- ['.*%.%-sst%.meta'] = 'sisu',
- ['.*%.sst%.meta'] = 'sisu',
- ['.*/etc/slp%.conf'] = 'slpconf',
- ['.*/etc/slp%.reg'] = 'slpreg',
- ['.*/etc/slp%.spi'] = 'slpspi',
- ['.*/etc/ssh/ssh_config%.d/.*%.conf'] = 'sshconfig',
- ['.*/%.ssh/config'] = 'sshconfig',
- ['.*/%.ssh/.*%.conf'] = 'sshconfig',
- ['.*/etc/ssh/sshd_config%.d/.*%.conf'] = 'sshdconfig',
- ['.*%.[Ss][Rr][Cc]'] = detect.src,
- ['.*/etc/sudoers'] = 'sudoers',
- ['svn%-commit.*%.tmp'] = 'svn',
- ['.*/sway/config'] = 'swayconfig',
- ['.*/%.sway/config'] = 'swayconfig',
- ['.*%.swift%.gyb'] = 'swiftgyb',
- ['.*%.[Ss][Yy][Ss]'] = detect.sys,
- ['.*/etc/sysctl%.conf'] = 'sysctl',
- ['.*/etc/sysctl%.d/.*%.conf'] = 'sysctl',
- ['.*/systemd/.*%.automount'] = 'systemd',
- ['.*/systemd/.*%.dnssd'] = 'systemd',
- ['.*/systemd/.*%.link'] = 'systemd',
- ['.*/systemd/.*%.mount'] = 'systemd',
- ['.*/systemd/.*%.netdev'] = 'systemd',
- ['.*/systemd/.*%.network'] = 'systemd',
- ['.*/systemd/.*%.nspawn'] = 'systemd',
- ['.*/systemd/.*%.path'] = 'systemd',
- ['.*/systemd/.*%.service'] = 'systemd',
- ['.*/systemd/.*%.slice'] = 'systemd',
- ['.*/systemd/.*%.socket'] = 'systemd',
- ['.*/systemd/.*%.swap'] = 'systemd',
- ['.*/systemd/.*%.target'] = 'systemd',
- ['.*/systemd/.*%.timer'] = 'systemd',
- ['.*/etc/systemd/.*%.conf%.d/.*%.conf'] = 'systemd',
- ['.*/%.config/systemd/user/.*%.d/.*%.conf'] = 'systemd',
- ['.*/etc/systemd/system/.*%.d/.*%.conf'] = 'systemd',
- ['.*/etc/systemd/system/.*%.d/%.#.*'] = 'systemd',
- ['.*/etc/systemd/system/%.#.*'] = 'systemd',
- ['.*/%.config/systemd/user/.*%.d/%.#.*'] = 'systemd',
- ['.*/%.config/systemd/user/%.#.*'] = 'systemd',
- ['.*termcap.*'] = starsetf(function(path, bufnr)
- return require('vim.filetype.detect').printcap('term')
- end),
- ['.*/tex/latex/.*%.cfg'] = 'tex',
- ['.*%.t%.html'] = 'tilde',
- ['%.?tmux.*%.conf'] = 'tmux',
- ['%.?tmux.*%.conf.*'] = { 'tmux', { priority = -1 } },
- ['.*/%.cargo/config'] = 'toml',
- ['.*/%.cargo/credentials'] = 'toml',
- ['.*/etc/udev/udev%.conf'] = 'udevconf',
- ['.*/etc/udev/permissions%.d/.*%.permissions'] = 'udevperm',
- ['.*/etc/updatedb%.conf'] = 'updatedb',
- ['.*/%.init/.*%.override'] = 'upstart',
- ['.*/usr/share/upstart/.*%.conf'] = 'upstart',
- ['.*/%.config/upstart/.*%.override'] = 'upstart',
- ['.*/etc/init/.*%.conf'] = 'upstart',
- ['.*/etc/init/.*%.override'] = 'upstart',
- ['.*/%.config/upstart/.*%.conf'] = 'upstart',
- ['.*/%.init/.*%.conf'] = 'upstart',
- ['.*/usr/share/upstart/.*%.override'] = 'upstart',
- ['.*%.[Ll][Oo][Gg]'] = detect.log,
- ['.*/etc/config/.*'] = starsetf(detect.uci),
- ['.*%.vhdl_[0-9].*'] = starsetf('vhdl'),
- ['.*%.ws[fc]'] = 'wsh',
- ['.*/Xresources/.*'] = starsetf('xdefaults'),
- ['.*/app%-defaults/.*'] = starsetf('xdefaults'),
- ['.*/etc/xinetd%.conf'] = 'xinetd',
- ['.*/usr/share/X11/xkb/compat/.*'] = starsetf('xkb'),
- ['.*/usr/share/X11/xkb/geometry/.*'] = starsetf('xkb'),
- ['.*/usr/share/X11/xkb/keycodes/.*'] = starsetf('xkb'),
- ['.*/usr/share/X11/xkb/symbols/.*'] = starsetf('xkb'),
- ['.*/usr/share/X11/xkb/types/.*'] = starsetf('xkb'),
- ['.*/etc/blkid%.tab'] = 'xml',
- ['.*/etc/blkid%.tab%.old'] = 'xml',
- ['.*%.vbproj%.user'] = 'xml',
- ['.*%.fsproj%.user'] = 'xml',
- ['.*%.csproj%.user'] = 'xml',
- ['.*/etc/xdg/menus/.*%.menu'] = 'xml',
- ['.*Xmodmap'] = 'xmodmap',
- ['.*/etc/zprofile'] = 'zsh',
- ['.*vimrc.*'] = starsetf('vim'),
- ['Xresources.*'] = starsetf('xdefaults'),
- ['.*/etc/xinetd%.d/.*'] = starsetf('xinetd'),
- ['.*xmodmap.*'] = starsetf('xmodmap'),
- ['.*/xorg%.conf%.d/.*%.conf'] = detect.xfree86_v4,
- -- Increase priority to run before the pattern below
- ['XF86Config%-4.*'] = starsetf(detect.xfree86_v4, { priority = -math.huge + 1 }),
- ['XF86Config.*'] = starsetf(detect.xfree86_v3),
- ['.*/%.bundle/config'] = 'yaml',
- ['%.zcompdump.*'] = starsetf('zsh'),
- -- .zlog* and zlog*
- ['%.?zlog.*'] = starsetf('zsh'),
- -- .zsh* and zsh*
- ['%.?zsh.*'] = starsetf('zsh'),
- -- Ignored extension
- ['.*~'] = function(path, bufnr)
- local short = path:gsub('~+$', '', 1)
- if path ~= short and short ~= '' then
- return M.match({ buf = bufnr, filename = fn.fnameescape(short) })
- end
- end,
-- END PATTERN
}
-- luacheck: pop
-- luacheck: pop
---- @param t vim.filetype.mapping
+--- Lookup table/cache for patterns
+--- @alias vim.filetype.pattern_cache { has_env: boolean, has_slash: boolean }
+--- @type table<string,vim.filetype.pattern_cache>
+local pattern_lookup = {}
+
+local function compare_by_priority(a, b)
+ return a[next(a)][2].priority > b[next(b)][2].priority
+end
+
+--- @param pat string
+--- @return { has_env: boolean, has_slash: boolean }
+local function parse_pattern(pat)
+ return { has_env = pat:find('%$%b{}') ~= nil, has_slash = pat:find('/') ~= nil }
+end
+
+--- @param t table<string,vim.filetype.mapping>
+--- @return vim.filetype.mapping[]
--- @return vim.filetype.mapping[]
local function sort_by_priority(t)
- local sorted = {} --- @type vim.filetype.mapping[]
- for k, v in pairs(t) do
- local ft = type(v) == 'table' and v[1] or v
- assert(
- type(ft) == 'string' or type(ft) == 'function',
- 'Expected string or function for filetype'
- )
-
- local opts = (type(v) == 'table' and type(v[2]) == 'table') and v[2] or {}
- if not opts.priority then
- opts.priority = 0
+ -- Separate patterns with non-negative and negative priority because they
+ -- will be processed separately
+ local pos = {} --- @type vim.filetype.mapping[]
+ local neg = {} --- @type vim.filetype.mapping[]
+ for parent, ft_map in pairs(t) do
+ pattern_lookup[parent] = pattern_lookup[parent] or parse_pattern(parent)
+ for pat, maptbl in pairs(ft_map) do
+ local ft = type(maptbl) == 'table' and maptbl[1] or maptbl
+ assert(
+ type(ft) == 'string' or type(ft) == 'function',
+ 'Expected string or function for filetype'
+ )
+
+ -- Parse pattern for common data and cache it once
+ pattern_lookup[pat] = pattern_lookup[pat] or parse_pattern(pat)
+
+ local opts = (type(maptbl) == 'table' and type(maptbl[2]) == 'table') and maptbl[2] or {}
+ opts.parent = opts.parent or parent
+ opts.priority = opts.priority or 0
+
+ table.insert(opts.priority >= 0 and pos or neg, { [pat] = { ft, opts } })
end
- table.insert(sorted, { [k] = { ft, opts } })
end
- table.sort(sorted, function(a, b)
- return a[next(a)][2].priority > b[next(b)][2].priority
- end)
- return sorted
+
+ table.sort(pos, compare_by_priority)
+ table.sort(neg, compare_by_priority)
+ return pos, neg
end
-local pattern_sorted = sort_by_priority(pattern)
+local pattern_sorted_pos, pattern_sorted_neg = sort_by_priority(pattern)
--- @param path string
--- @param as_pattern? true
@@ -2302,7 +2501,7 @@ end
--- ['.*/etc/foo/.*%.conf'] = { 'dosini', { priority = 10 } },
--- -- A pattern containing an environment variable
--- ['${XDG_CONFIG_HOME}/foo/git'] = 'git',
---- ['README.(%a+)$'] = function(path, bufnr, ext)
+--- ['.*README.(%a+)'] = function(path, bufnr, ext)
--- if ext == 'md' then
--- return 'markdown'
--- elseif ext == 'rst' then
@@ -2344,11 +2543,16 @@ function M.add(filetypes)
end
for k, v in pairs(filetypes.pattern or {}) do
- pattern[normalize_path(k, true)] = v
+ -- Add to "match all" parent pattern (might be better to optimize later or document
+ -- supplying `opts.parent` directly)
+ -- User patterns are assumed to be implicitly anchored (as in Vim)
+ pattern['']['^' .. normalize_path(k, true) .. '$'] = v
end
if filetypes.pattern then
- pattern_sorted = sort_by_priority(pattern)
+ -- TODO: full resorting might be expensive with a lot of separate `vim.filetype.add()` calls.
+ -- Consider inserting new patterns precisely into already sorted lists of built-in patterns.
+ pattern_sorted_pos, pattern_sorted_neg = sort_by_priority(pattern)
end
end
@@ -2392,46 +2596,81 @@ local function dispatch(ft, path, bufnr, ...)
return ft0, on_detect
end
---- Lookup table/cache for patterns that contain an environment variable pattern, e.g. ${SOME_VAR}.
---- @type table<string,boolean>
-local expand_env_lookup = {}
+--- @param pat string
+--- @return boolean
+--- @return string
+local function expand_envvar_pattern(pat)
+ local some_env_missing = false
+ local expanded = pat:gsub('%${(%S-)}', function(env)
+ local val = vim.env[env] --- @type string?
+ some_env_missing = some_env_missing or val == nil
+ return vim.pesc(val or '')
+ end)
+ return some_env_missing, expanded
+end
--- @param name string
--- @param path string
--- @param tail string
--- @param pat string
---- @return string|false?
-local function match_pattern(name, path, tail, pat)
- if expand_env_lookup[pat] == nil then
- expand_env_lookup[pat] = pat:find('%${') ~= nil
- end
- if expand_env_lookup[pat] then
- local return_early --- @type true?
- --- @type string
- pat = pat:gsub('%${(%S-)}', function(env)
- -- If an environment variable is present in the pattern but not set, there is no match
- if not vim.env[env] then
- return_early = true
- return nil
- end
- return vim.pesc(vim.env[env])
- end)
- if return_early then
- return false
+--- @param try_all_candidates boolean
+--- @return string?
+local function match_pattern(name, path, tail, pat, try_all_candidates)
+ local pat_cache = pattern_lookup[pat]
+ local has_slash = pat_cache.has_slash
+
+ if pat_cache.has_env then
+ local some_env_missing, expanded = expand_envvar_pattern(pat)
+ -- If any environment variable is present in the pattern but not set, there is no match
+ if some_env_missing then
+ return nil
end
+ pat, has_slash = expanded, expanded:find('/') ~= nil
end
- -- If the pattern contains a / match against the full path, otherwise just the tail
- local fullpat = '^' .. pat .. '$'
+ -- Try all possible candidates to make parent patterns not depend on slash presence
+ if try_all_candidates then
+ return (path:match(pat) or name:match(pat) or tail:match(pat))
+ end
- if pat:find('/') then
+ -- If the pattern contains a / match against the full path, otherwise just the tail
+ if has_slash then
-- Similar to |autocmd-pattern|, if the pattern contains a '/' then check for a match against
-- both the short file name (as typed) and the full file name (after expanding to full path
-- and resolving symlinks)
- return (name:match(fullpat) or path:match(fullpat))
+ return (name:match(pat) or path:match(pat))
end
- return (tail:match(fullpat))
+ return (tail:match(pat))
+end
+
+--- @param name string
+--- @param path string
+--- @param tail string
+--- @param pattern_sorted vim.filetype.mapping[]
+--- @param parent_matches table<string,boolean>
+--- @param bufnr integer?
+local function match_pattern_sorted(name, path, tail, pattern_sorted, parent_matches, bufnr)
+ for i = 1, #pattern_sorted do
+ local pat, ft_data = next(pattern_sorted[i])
+
+ local parent = ft_data[2].parent
+ local parent_is_matched = parent_matches[parent]
+ if parent_is_matched == nil then
+ parent_matches[parent] = match_pattern(name, path, tail, parent, true) ~= nil
+ parent_is_matched = parent_matches[parent]
+ end
+
+ if parent_is_matched then
+ local matches = match_pattern(name, path, tail, pat, false)
+ if matches then
+ local ft, on_detect = dispatch(ft_data[1], path, bufnr, matches)
+ if ft then
+ return ft, on_detect
+ end
+ end
+ end
+ end
end
--- @class vim.filetype.match.args
@@ -2527,23 +2766,12 @@ function M.match(args)
end
-- Next, check the file path against available patterns with non-negative priority
- local j = 1
- for i, v in ipairs(pattern_sorted) do
- local k = next(v)
- local opts = v[k][2]
- if opts.priority < 0 then
- j = i
- break
- end
-
- local filetype = v[k][1]
- local matches = match_pattern(name, path, tail, k)
- if matches then
- ft, on_detect = dispatch(filetype, path, bufnr, matches)
- if ft then
- return ft, on_detect
- end
- end
+ -- Cache match results of all parent patterns to improve performance
+ local parent_matches = {}
+ ft, on_detect =
+ match_pattern_sorted(name, path, tail, pattern_sorted_pos, parent_matches, bufnr)
+ if ft then
+ return ft, on_detect
end
-- Next, check file extension
@@ -2556,18 +2784,10 @@ function M.match(args)
end
-- Next, check patterns with negative priority
- for i = j, #pattern_sorted do
- local v = pattern_sorted[i]
- local k = next(v)
-
- local filetype = v[k][1]
- local matches = match_pattern(name, path, tail, k)
- if matches then
- ft, on_detect = dispatch(filetype, path, bufnr, matches)
- if ft then
- return ft, on_detect
- end
- end
+ ft, on_detect =
+ match_pattern_sorted(name, path, tail, pattern_sorted_neg, parent_matches, bufnr)
+ if ft then
+ return ft, on_detect
end
end
@@ -2583,20 +2803,24 @@ function M.match(args)
contents = M._getlines(bufnr)
end
end
- -- If name is nil, catch any errors from the contents filetype detection function.
- -- If the function tries to use the filename that is nil then it will fail,
- -- but this enables checks which do not need a filename to still work.
- local ok
- ok, ft, on_detect = pcall(
- require('vim.filetype.detect').match_contents,
- contents,
- name,
- function(ext)
- return dispatch(extension[ext], name, bufnr)
+
+ -- Match based solely on content only if there is any content (for performance)
+ if not (#contents == 1 and contents[1] == '') then
+ -- If name is nil, catch any errors from the contents filetype detection function.
+ -- If the function tries to use the filename that is nil then it will fail,
+ -- but this enables checks which do not need a filename to still work.
+ local ok
+ ok, ft, on_detect = pcall(
+ require('vim.filetype.detect').match_contents,
+ contents,
+ name,
+ function(ext)
+ return dispatch(extension[ext], name, bufnr)
+ end
+ )
+ if ok then
+ return ft, on_detect
end
- )
- if ok then
- return ft, on_detect
end
end
end
@@ -2615,6 +2839,7 @@ end
--- Note: this uses |nvim_get_option_value()| but caches the result.
--- This means |ftplugin| and |FileType| autocommands are only
--- triggered once and may not reflect later changes.
+--- @since 11
--- @param filetype string Filetype
--- @param option string Option name
--- @return string|boolean|integer: Option value
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua
index ba86d8de5a..1cc81b177f 100644
--- a/runtime/lua/vim/filetype/detect.lua
+++ b/runtime/lua/vim/filetype/detect.lua
@@ -450,7 +450,7 @@ local function modula2(bufnr)
return 'modula2',
function(b)
- vim.api.nvim_buf_call(b, function()
+ vim._with({ buf = b }, function()
fn['modula2#SetDialect'](dialect, extension)
end)
end
@@ -472,6 +472,41 @@ function M.def(_, bufnr)
end
--- @type vim.filetype.mapfn
+function M.dsp(path, bufnr)
+ if vim.g.filetype_dsp then
+ return vim.g.filetype_dsp
+ end
+
+ -- Test the filename
+ local file_name = fn.fnamemodify(path, ':t')
+ if file_name:find('^[mM]akefile.*$') then
+ return 'make'
+ end
+
+ -- Test the file contents
+ for _, line in ipairs(getlines(bufnr, 1, 200)) do
+ if
+ findany(line, {
+ -- Check for comment style
+ [[#.*]],
+ -- Check for common lines
+ [[^.*Microsoft Developer Studio Project File.*$]],
+ [[^!MESSAGE This is not a valid makefile\..+$]],
+ -- Check for keywords
+ [[^!(IF,ELSEIF,ENDIF).*$]],
+ -- Check for common assignments
+ [[^SOURCE=.*$]],
+ })
+ then
+ return 'make'
+ end
+ end
+
+ -- Otherwise, assume we have a Faust file
+ return 'faust'
+end
+
+--- @type vim.filetype.mapfn
function M.e(_, bufnr)
if vim.g.filetype_euphoria then
return vim.g.filetype_euphoria
@@ -594,7 +629,7 @@ function M.frm(_, bufnr)
end
--- @type vim.filetype.mapfn
-function M.fvwm_1(_, _)
+function M.fvwm_v1(_, _)
return 'fvwm', function(bufnr)
vim.b[bufnr].fvwm_version = 1
end
@@ -650,13 +685,58 @@ function M.header(_, bufnr)
end
end
+--- Recursively search for Hare source files in a directory and any
+--- subdirectories, up to a given depth.
+--- @param dir string
+--- @param depth number
+--- @return boolean
+local function is_hare_module(dir, depth)
+ depth = math.max(depth, 0)
+ for name, _ in vim.fs.dir(dir, { depth = depth + 1 }) do
+ if name:find('%.ha$') then
+ return true
+ end
+ end
+ return false
+end
+
+--- @type vim.filetype.mapfn
+function M.haredoc(path, _)
+ if vim.g.filetype_haredoc then
+ if is_hare_module(vim.fs.dirname(path), vim.g.haredoc_search_depth or 1) then
+ return 'haredoc'
+ end
+ end
+end
+
--- @type vim.filetype.mapfn
function M.html(_, bufnr)
- for _, line in ipairs(getlines(bufnr, 1, 10)) do
- if matchregex(line, [[\<DTD\s\+XHTML\s]]) then
+ -- Disabled for the reasons mentioned here:
+ -- https://github.com/vim/vim/pull/13594#issuecomment-1834465890
+ -- local filename = fn.fnamemodify(path, ':t')
+ -- if filename:find('%.component%.html$') then
+ -- return 'htmlangular'
+ -- end
+
+ for _, line in ipairs(getlines(bufnr, 1, 40)) do
+ if
+ matchregex(
+ line,
+ [[@\(if\|for\|defer\|switch\)\|\*\(ngIf\|ngFor\|ngSwitch\|ngTemplateOutlet\)\|ng-template\|ng-content\|{{.*}}]]
+ )
+ then
+ return 'htmlangular'
+ elseif matchregex(line, [[\<DTD\s\+XHTML\s]]) then
return 'xhtml'
- elseif matchregex(line, [[\c{%\s*\(extends\|block\|load\)\>\|{#\s\+]]) then
+ elseif
+ matchregex(
+ line,
+ [[\c{%\s*\(autoescape\|block\|comment\|csrf_token\|cycle\|debug\|extends\|filter\|firstof\|for\|if\|ifchanged\|include\|load\|lorem\|now\|query_string\|regroup\|resetcycle\|spaceless\|templatetag\|url\|verbatim\|widthratio\|with\)\>\|{#\s\+]]
+ )
+ then
return 'htmldjango'
+ elseif findany(line, { '<extend', '<super>' }) then
+ return 'superhtml'
end
end
return 'html'
@@ -894,6 +974,24 @@ local function m4(contents)
end
end
+--- Check if it is a Microsoft Makefile
+--- @type vim.filetype.mapfn
+function M.make(_, bufnr)
+ vim.b.make_microsoft = nil
+ for _, line in ipairs(getlines(bufnr, 1, 1000)) do
+ if matchregex(line, [[\c^\s*!\s*\(ifn\=\(def\)\=\|include\|message\|error\)\>]]) then
+ vim.b.make_microsoft = 1
+ break
+ elseif
+ matchregex(line, [[^ *ifn\=\(eq\|def\)\>]])
+ or findany(line, { '^ *[-s]?%s', '^ *%w+%s*[!?:+]=' })
+ then
+ break
+ end
+ end
+ return 'make'
+end
+
--- @type vim.filetype.mapfn
function M.markdown(_, _)
return vim.g.filetype_md or 'markdown'
@@ -1038,6 +1136,8 @@ function M.perl(path, bufnr)
end
end
+local prolog_patterns = { '^%s*:%-', '^%s*%%+%s', '^%s*%%+$', '^%s*/%*', '%.%s*$' }
+
--- @type vim.filetype.mapfn
function M.pl(_, bufnr)
if vim.g.filetype_pl then
@@ -1046,11 +1146,7 @@ function M.pl(_, bufnr)
-- Recognize Prolog by specific text in the first non-empty line;
-- require a blank after the '%' because Perl uses "%list" and "%translate"
local line = nextnonblank(bufnr, 1)
- if
- line and line:find(':%-')
- or matchregex(line, [[\c\<prolog\>]])
- or findany(line, { '^%s*%%+%s', '^%s*%%+$', '^%s*/%*' })
- then
+ if line and matchregex(line, [[\c\<prolog\>]]) or findany(line, prolog_patterns) then
return 'prolog'
else
return 'perl'
@@ -1154,11 +1250,7 @@ function M.proto(_, bufnr)
-- Recognize Prolog by specific text in the first non-empty line;
-- require a blank after the '%' because Perl uses "%list" and "%translate"
local line = nextnonblank(bufnr, 1)
- if
- line and line:find(':%-')
- or matchregex(line, [[\c\<prolog\>]])
- or findany(line, { '^%s*%%+%s', '^%s*%%+$', '^%s*/%*' })
- then
+ if line and matchregex(line, [[\c\<prolog\>]]) or findany(line, prolog_patterns) then
return 'prolog'
end
end
@@ -1331,7 +1423,7 @@ end
function M.sgml(_, bufnr)
local lines = table.concat(getlines(bufnr, 1, 5))
if lines:find('linuxdoc') then
- return 'smgllnx'
+ return 'sgmllnx'
elseif lines:find('<!DOCTYPE.*DocBook') then
return 'docbk',
function(b)
@@ -1533,7 +1625,7 @@ function M.tex(path, bufnr)
end
end
--- Determine if a *.tf file is TF mud client or terraform
+-- Determine if a *.tf file is TF (TinyFugue) mud client or terraform
--- @type vim.filetype.mapfn
function M.tf(_, bufnr)
for _, line in ipairs(getlines(bufnr)) do
@@ -1759,6 +1851,7 @@ local patterns_hashbang = {
['^janet\\>'] = { 'janet', { vim_regex = true } },
['^dart\\>'] = { 'dart', { vim_regex = true } },
['^execlineb\\>'] = { 'execline', { vim_regex = true } },
+ ['^vim\\>'] = { 'vim', { vim_regex = true } },
}
---@private
diff --git a/runtime/lua/vim/fs.lua b/runtime/lua/vim/fs.lua
index b05220ee2c..ccddf826f7 100644
--- a/runtime/lua/vim/fs.lua
+++ b/runtime/lua/vim/fs.lua
@@ -1,6 +1,10 @@
+local uv = vim.uv
+
local M = {}
-local iswin = vim.uv.os_uname().sysname == 'Windows_NT'
+-- Can't use `has('win32')` because the `nvim -ll` test runner doesn't support `vim.fn` yet.
+local sysname = uv.os_uname().sysname:lower()
+local iswin = not not (sysname:find('windows') or sysname:find('mingw'))
local os_sep = iswin and '\\' or '/'
--- Iterate over all the parents of the given path.
@@ -21,6 +25,7 @@ local os_sep = iswin and '\\' or '/'
--- end
--- ```
---
+---@since 10
---@param start (string) Initial path.
---@return fun(_, dir: string): string? # Iterator
---@return nil
@@ -40,6 +45,7 @@ end
--- Return the parent directory of the given path
---
+---@since 10
---@generic T : string|nil
---@param file T Path
---@return T Parent directory of {file}
@@ -69,6 +75,7 @@ end
--- Return the basename of the given path
---
+---@since 10
---@generic T : string|nil
---@param file T Path
---@return T Basename of {file}
@@ -89,6 +96,7 @@ end
--- Concatenate directories and/or file paths into a single path with normalization
--- (e.g., `"foo/"` and `"bar"` get joined to `"foo/bar"`)
---
+---@since 12
---@param ... string
---@return string
function M.joinpath(...)
@@ -99,6 +107,7 @@ end
--- Return an iterator over the items located in {path}
---
+---@since 10
---@param path (string) An absolute or relative path to the directory to iterate
--- over. The path is first normalized |vim.fs.normalize()|.
--- @param opts table|nil Optional keyword arguments:
@@ -122,12 +131,12 @@ function M.dir(path, opts)
path = M.normalize(path)
if not opts.depth or opts.depth == 1 then
- local fs = vim.uv.fs_scandir(path)
+ local fs = uv.fs_scandir(path)
return function()
if not fs then
return
end
- return vim.uv.fs_scandir_next(fs)
+ return uv.fs_scandir_next(fs)
end
end
@@ -138,9 +147,9 @@ function M.dir(path, opts)
--- @type string, integer
local dir0, level = unpack(table.remove(dirs, 1))
local dir = level == 1 and dir0 or M.joinpath(path, dir0)
- local fs = vim.uv.fs_scandir(dir)
+ local fs = uv.fs_scandir(dir)
while fs do
- local name, t = vim.uv.fs_scandir_next(fs)
+ local name, t = uv.fs_scandir_next(fs)
if not name then
break
end
@@ -210,6 +219,7 @@ end
--- end, {limit = math.huge, type = 'file'})
--- ```
---
+---@since 10
---@param 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 item with args:
@@ -234,7 +244,7 @@ function M.find(names, opts)
names = { names }
end
- local path = opts.path or assert(vim.uv.cwd())
+ local path = opts.path or assert(uv.cwd())
local stop = opts.stop
local limit = opts.limit or 1
@@ -265,7 +275,7 @@ function M.find(names, opts)
local t = {} --- @type string[]
for _, name in ipairs(names) do
local f = M.joinpath(p, name)
- local stat = vim.uv.fs_stat(f)
+ local stat = uv.fs_stat(f)
if stat and (not opts.type or opts.type == stat.type) then
t[#t + 1] = f
end
@@ -349,6 +359,7 @@ end
--- end)
--- ```
---
+--- @since 12
--- @param source integer|string Buffer number (0 for current buffer) or file path (absolute or
--- relative to the |current-directory|) to begin the search from.
--- @param marker (string|string[]|fun(name: string, path: string): boolean) A marker, or list
@@ -365,7 +376,7 @@ function M.root(source, marker)
path = source
elseif type(source) == 'number' then
if vim.bo[source].buftype ~= '' then
- path = assert(vim.uv.cwd())
+ path = assert(uv.cwd())
else
path = vim.api.nvim_buf_get_name(source)
end
@@ -528,6 +539,7 @@ end
--- [[\\?\UNC\server\share\foo\..\..\..\bar]] => "//?/UNC/server/share/bar"
--- ```
---
+---@since 10
---@param path (string) Path to normalize
---@param opts? vim.fs.normalize.Opts
---@return (string) : Normalized path
@@ -552,7 +564,7 @@ function M.normalize(path, opts)
-- Expand ~ to users home directory
if vim.startswith(path, '~') then
- local home = vim.uv.os_homedir() or '~'
+ local home = uv.os_homedir() or '~'
if home:sub(-1) == os_sep_local then
home = home:sub(1, -2)
end
@@ -561,7 +573,7 @@ function M.normalize(path, opts)
-- Expand environment variables if `opts.expand_env` isn't `false`
if opts.expand_env == nil or opts.expand_env then
- path = path:gsub('%$([%w_]+)', vim.uv.os_getenv)
+ path = path:gsub('%$([%w_]+)', uv.os_getenv)
end
if win then
@@ -609,4 +621,56 @@ function M.normalize(path, opts)
return path
end
+--- @param path string Path to remove
+--- @param ty string type of path
+--- @param recursive? boolean
+--- @param force? boolean
+local function rm(path, ty, recursive, force)
+ --- @diagnostic disable-next-line:no-unknown
+ local rm_fn
+
+ if ty == 'directory' then
+ if recursive then
+ for file, fty in vim.fs.dir(path) do
+ rm(M.joinpath(path, file), fty, true, force)
+ end
+ elseif not force then
+ error(string.format('%s is a directory', path))
+ end
+
+ rm_fn = uv.fs_rmdir
+ else
+ rm_fn = uv.fs_unlink
+ end
+
+ local ret, err, errnm = rm_fn(path)
+ if ret == nil and (not force or errnm ~= 'ENOENT') then
+ error(err)
+ end
+end
+
+--- @class vim.fs.rm.Opts
+--- @inlinedoc
+---
+--- Remove directories and their contents recursively
+--- @field recursive? boolean
+---
+--- Ignore nonexistent files and arguments
+--- @field force? boolean
+
+--- Remove files or directories
+--- @since 13
+--- @param path string Path to remove
+--- @param opts? vim.fs.rm.Opts
+function M.rm(path, opts)
+ opts = opts or {}
+
+ local stat, err, errnm = uv.fs_stat(path)
+ if stat then
+ rm(path, stat.type, opts.recursive, opts.force)
+ elseif not opts.force or errnm ~= 'ENOENT' then
+ error(err)
+ end
+end
+
return M
diff --git a/runtime/lua/vim/glob.lua b/runtime/lua/vim/glob.lua
index ad4a915a94..22073b15c8 100644
--- a/runtime/lua/vim/glob.lua
+++ b/runtime/lua/vim/glob.lua
@@ -1,6 +1,6 @@
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 C, Cc, Ct, Cf, Cmt = lpeg.C, lpeg.Cc, lpeg.Ct, lpeg.Cf, lpeg.Cmt
local M = {}
@@ -29,8 +29,10 @@ function M.to_lpeg(pattern)
return patt
end
- local function add(acc, a)
- return acc + a
+ local function condlist(conds, after)
+ return vim.iter(conds):fold(P(false), function(acc, cond)
+ return acc + cond * after
+ end)
end
local function mul(acc, m)
@@ -45,13 +47,22 @@ function M.to_lpeg(pattern)
return (-after * P(1)) ^ 0 * after
end
+ -- luacheck: push ignore s
+ local function cut(s, idx, match)
+ return idx, match
+ end
+ -- luacheck: pop
+
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
+ Elem = Cmt(
+ Cf(
+ (V('DStar') + V('Star') + V('Ques') + V('Class') + V('CondList') + V('Literal'))
+ * (V('Elem') + V('End')),
+ mul
+ ),
+ cut
),
DStar = (B(pathsep) + -B(P(1)))
* P('**')
@@ -63,15 +74,14 @@ function M.to_lpeg(pattern)
* 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('}'),
+ CondList = P('{') * Ct(V('Cond') * (P(',') * V('Cond')) ^ 0) * P('}') * V('Pattern') / condlist,
-- 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)),
+ Cond = Cmt(Cf((V('Ques') + V('Class') + V('Literal') - S(',}')) ^ 1, mul), cut) + Cc(P(0)),
Literal = P(1) / P,
End = P(-1) * Cc(P(-1)),
})
diff --git a/runtime/lua/vim/health.lua b/runtime/lua/vim/health.lua
index f40f04a064..52a7a13966 100644
--- a/runtime/lua/vim/health.lua
+++ b/runtime/lua/vim/health.lua
@@ -1,6 +1,6 @@
--- @brief
---<pre>help
---- health.vim is a minimal framework to help users troubleshoot configuration and
+--- vim.health is a minimal framework to help users troubleshoot configuration and
--- any other environment conditions that a plugin might care about. Nvim ships
--- with healthchecks for configuration, performance, python support, ruby
--- support, clipboard support, and more.
@@ -39,7 +39,7 @@
--- :checkhealth vim*
--- <
---
---- Create a healthcheck *health-dev* *vim.health*
+--- Create a healthcheck *health-dev*
---
--- Healthchecks are functions that check the user environment, configuration, or
--- any other prerequisites that a plugin cares about. Nvim ships with
@@ -104,10 +104,10 @@ local function filepath_to_healthcheck(path)
local subpath = path:gsub('.*lua/', '')
if vim.fs.basename(subpath) == 'health.lua' then
-- */health.lua
- name = assert(vim.fs.dirname(subpath))
+ name = vim.fs.dirname(subpath)
else
-- */health/init.lua
- name = assert(vim.fs.dirname(assert(vim.fs.dirname(subpath))))
+ name = vim.fs.dirname(vim.fs.dirname(subpath))
end
name = name:gsub('/', '.')
@@ -275,114 +275,6 @@ function M.error(msg, ...)
collect_output(input)
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.uv.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.uv.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"
@@ -393,8 +285,8 @@ local path2name = function(path)
-- Remove everything up to the last /lua/ folder
path = path:gsub('^.*/lua/', '')
- -- Remove the filename (health.lua)
- path = vim.fs.dirname(path)
+ -- Remove the filename (health.lua) or (health/init.lua)
+ path = vim.fs.dirname(path:gsub('/init%.lua$', ''))
-- Change slashes to dots
path = path:gsub('/', '.')
@@ -409,11 +301,13 @@ end
local PATTERNS = { '/autoload/health/*.vim', '/lua/**/**/health.lua', '/lua/**/**/health/init.lua' }
--- :checkhealth completion function used by cmdexpand.c get_healthcheck_names()
M._complete = function()
- local unique = vim
+ local unique = vim ---@type table<string,boolean>
+ ---@param pattern string
.iter(vim.tbl_map(function(pattern)
return vim.tbl_map(path2name, vim.api.nvim_get_runtime_file(pattern, true))
end, PATTERNS))
:flatten()
+ ---@param t table<string,boolean>
:fold({}, function(t, name)
t[name] = true -- Remove duplicates
return t
@@ -472,7 +366,7 @@ function M._check(mods, plugin_names)
vim.fn.call(func, {})
else
local f = assert(loadstring(func))
- local ok, output = pcall(f)
+ local ok, output = pcall(f) ---@type boolean, string
if not ok then
M.error(
string.format('Failed to run healthcheck for "%s" plugin. Exception:\n%s\n', name, output)
@@ -485,7 +379,14 @@ function M._check(mods, plugin_names)
s_output = {}
M.error('The healthcheck report for "' .. name .. '" plugin is empty.')
end
- local header = { string.rep('=', 78), name .. ': ' .. func, '' }
+
+ local header = {
+ string.rep('=', 78),
+ -- Example: `foo.health: [ …] require("foo.health").check()`
+ ('%s: %s%s'):format(name, (' '):rep(76 - name:len() - func:len()), func),
+ '',
+ }
+
-- remove empty line after header from report_start
if s_output[1] == '' then
local tmp = {} ---@type string[]
@@ -499,7 +400,7 @@ function M._check(mods, plugin_names)
end
s_output[#s_output + 1] = ''
s_output = vim.list_extend(header, s_output)
- vim.fn.append('$', s_output)
+ vim.fn.append(vim.fn.line('$'), s_output)
vim.cmd.redraw()
end
diff --git a/runtime/lua/vim/health/health.lua b/runtime/lua/vim/health/health.lua
index 5bc03199ee..d226f35f9a 100644
--- a/runtime/lua/vim/health/health.lua
+++ b/runtime/lua/vim/health/health.lua
@@ -11,10 +11,14 @@ 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,
+ ['lua/provider/node/health.lua'] = false,
+ ['lua/provider/perl/health.lua'] = false,
+ ['lua/provider/python/health.lua'] = false,
+ ['lua/provider/ruby/health.lua'] = false,
+ ['plugin/health.vim'] = false,
['plugin/man.vim'] = false,
['queries/help/highlights.scm'] = false,
['queries/help/injections.scm'] = false,
@@ -39,7 +43,7 @@ local function check_runtime()
'Found old files in $VIMRUNTIME (this can cause weird behavior):\n%s',
bad_files_msg
),
- { 'Delete the $VIMRUNTIME directory (or uninstall Nvim), then reinstall Nvim.' }
+ { 'Delete the $VIMRUNTIME directory, then reinstall Nvim.' }
)
end
end
@@ -50,11 +54,11 @@ local function check_config()
local init_lua = vim.fn.stdpath('config') .. '/init.lua'
local init_vim = vim.fn.stdpath('config') .. '/init.vim'
- local vimrc = vim.env.MYVIMRC and vim.fn.expand(vim.env.MYVIMRC) or init_lua
+ local vimrc = vim.env.MYVIMRC and vim.fs.normalize(vim.env.MYVIMRC) or init_lua
if vim.fn.filereadable(vimrc) == 0 and vim.fn.filereadable(init_vim) == 0 then
ok = false
- local has_vim = vim.fn.filereadable(vim.fn.expand('~/.vimrc')) == 1
+ local has_vim = vim.fn.filereadable(vim.fs.normalize('~/.vimrc')) == 1
health.warn(
('%s user config file: %s'):format(
-1 == vim.fn.getfsize(vimrc) and 'Missing' or 'Unreadable',
@@ -114,7 +118,7 @@ local function check_config()
)
shadafile = (
vim.o.shadafile == ''
- and (shadafile == '' and vim.fn.stdpath('state') .. '/shada/main.shada' or vim.fn.expand(
+ and (shadafile == '' and vim.fn.stdpath('state') .. '/shada/main.shada' or vim.fs.normalize(
shadafile
))
or (vim.o.shadafile == 'NONE' and '' or vim.o.shadafile)
@@ -239,6 +243,7 @@ local function check_tmux()
return
end
+ ---@param option string
local get_tmux_option = function(option)
local cmd = 'tmux show-option -qvg ' .. option -- try global scope
local out = vim.fn.system(vim.fn.split(cmd))
@@ -378,7 +383,7 @@ local function check_terminal()
'SSH_TTY',
}) do
if vim.env[env_var] then
- health.info(vim.fn.printf('$%s="%s"', env_var, vim.env[env_var]))
+ health.info(string.format('$%s="%s"', env_var, vim.env[env_var]))
end
end
end
diff --git a/runtime/lua/vim/highlight.lua b/runtime/lua/vim/highlight.lua
index f278bd357f..a8d88db372 100644
--- a/runtime/lua/vim/highlight.lua
+++ b/runtime/lua/vim/highlight.lua
@@ -20,8 +20,8 @@ M.priorities = {
--- @class vim.highlight.range.Opts
--- @inlinedoc
---
---- Type of range. See [setreg()]
---- (default: `'charwise'`)
+--- Type of range. See [getregtype()]
+--- (default: `'v'` i.e. charwise)
--- @field regtype? string
---
--- Indicates whether the range is end-inclusive
@@ -31,8 +31,6 @@ M.priorities = {
--- Indicates priority of highlight
--- (default: `vim.highlight.priorities.user`)
--- @field priority? integer
----
---- @field package _scoped? boolean
--- Apply highlight group to range of text.
---
@@ -47,25 +45,72 @@ 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
- -- supported now
- local region = vim.region(bufnr, start, finish, regtype, inclusive)
- for linenr, cols in pairs(region) do
- local end_row
- if cols[2] == -1 then
- end_row = linenr + 1
- cols[2] = 0
+
+ local v_maxcol = vim.v.maxcol
+
+ local pos1 = type(start) == 'string' and vim.fn.getpos(start)
+ or {
+ bufnr,
+ start[1] + 1,
+ start[2] ~= -1 and start[2] ~= v_maxcol and start[2] + 1 or v_maxcol,
+ 0,
+ }
+ local pos2 = type(finish) == 'string' and vim.fn.getpos(finish)
+ or {
+ bufnr,
+ finish[1] + 1,
+ finish[2] ~= -1 and start[2] ~= v_maxcol and finish[2] + 1 or v_maxcol,
+ 0,
+ }
+
+ local buf_line_count = vim.api.nvim_buf_line_count(bufnr)
+ pos1[2] = math.min(pos1[2], buf_line_count)
+ pos2[2] = math.min(pos2[2], buf_line_count)
+
+ if pos1[2] <= 0 or pos1[3] <= 0 or pos2[2] <= 0 or pos2[3] <= 0 then
+ return
+ end
+
+ vim._with({ buf = bufnr }, function()
+ if pos1[3] ~= v_maxcol then
+ local max_col1 = vim.fn.col({ pos1[2], '$' })
+ pos1[3] = math.min(pos1[3], max_col1)
+ end
+ if pos2[3] ~= v_maxcol then
+ local max_col2 = vim.fn.col({ pos2[2], '$' })
+ pos2[3] = math.min(pos2[3], max_col2)
end
- api.nvim_buf_set_extmark(bufnr, ns, linenr, cols[1], {
+ end)
+
+ local region = vim.fn.getregionpos(pos1, pos2, {
+ type = regtype,
+ exclusive = not inclusive,
+ eol = true,
+ })
+ -- For non-blockwise selection, use a single extmark.
+ if regtype == 'v' or regtype == 'V' then
+ region = { { region[1][1], region[#region][2] } }
+ if
+ regtype == 'V'
+ or region[1][2][2] == pos1[2] and pos1[3] == v_maxcol
+ or region[1][2][2] == pos2[2] and pos2[3] == v_maxcol
+ then
+ region[1][2][2] = region[1][2][2] + 1
+ region[1][2][3] = 0
+ end
+ end
+
+ for _, res in ipairs(region) do
+ local start_row = res[1][2] - 1
+ local start_col = res[1][3] - 1
+ local end_row = res[2][2] - 1
+ local end_col = res[2][3]
+ api.nvim_buf_set_extmark(bufnr, ns, start_row, start_col, {
hl_group = higroup,
end_row = end_row,
- end_col = cols[2],
+ end_col = end_col,
priority = priority,
strict = false,
- scoped = scoped,
})
end
end
@@ -129,19 +174,18 @@ function M.on_yank(opts)
yank_cancel()
end
- vim.api.nvim__win_add_ns(winid, yank_ns)
+ vim.api.nvim__ns_set(yank_ns, { wins = { winid } })
M.range(bufnr, yank_ns, higroup, "'[", "']", {
regtype = event.regtype,
inclusive = event.inclusive,
priority = opts.priority or M.priorities.user,
- _scoped = true,
})
yank_cancel = function()
yank_timer = nil
yank_cancel = nil
pcall(vim.api.nvim_buf_clear_namespace, bufnr, yank_ns, 0, -1)
- pcall(vim.api.nvim__win_del_ns, winid, yank_ns)
+ pcall(vim.api.nvim__ns_set, { wins = {} })
end
yank_timer = vim.defer_fn(yank_cancel, timeout)
diff --git a/runtime/lua/vim/iter.lua b/runtime/lua/vim/iter.lua
index 1093759efe..4bbcaf16db 100644
--- a/runtime/lua/vim/iter.lua
+++ b/runtime/lua/vim/iter.lua
@@ -6,10 +6,12 @@
--- of each pipeline stage is input to the next stage. The first stage depends on the type passed to
--- `vim.iter()`:
---
---- - List tables (arrays, |lua-list|) yield only the value of each element.
---- - Holes (nil values) are allowed.
+--- - Lists or arrays (|lua-list|) yield only the value of each element.
+--- - Holes (nil values) are allowed (but discarded).
+--- - Use pairs() to treat array/list tables as dicts (preserve holes and non-contiguous integer
+--- keys): `vim.iter(pairs(…))`.
--- - Use |Iter:enumerate()| to also pass the index to the next stage.
---- - Or initialize with ipairs(): `vim.iter(ipairs(…))`.
+--- - Or initialize with ipairs(): `vim.iter(ipairs(…))`.
--- - Non-list tables (|lua-dict|) yield both the key and value of each element.
--- - Function |iterator|s yield all values returned by the underlying function.
--- - Tables with a |__call()| metamethod are treated as function iterators.
@@ -276,7 +278,7 @@ end
--- -- { 6, 12 }
--- ```
---
----@param f fun(...):any Mapping function. Takes all values returned from
+---@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
@@ -1034,7 +1036,7 @@ function Iter.new(src, ...)
if type(k) ~= 'number' or k <= 0 or math.floor(k) ~= k then
return Iter.new(pairs(src))
end
- t[#t + 1] = v
+ t[#t + 1] = v -- Coerce to list-like table.
end
return ArrayIter.new(t)
end
diff --git a/runtime/lua/vim/keymap.lua b/runtime/lua/vim/keymap.lua
index ec00c56c7a..50ca0d2d0e 100644
--- a/runtime/lua/vim/keymap.lua
+++ b/runtime/lua/vim/keymap.lua
@@ -15,30 +15,28 @@ local keymap = {}
--- (Default: `false`)
--- @field remap? boolean
---- Adds a new |mapping|.
+--- Defines a |mapping| of |keycodes| to a function or keycodes.
+---
--- Examples:
---
--- ```lua
---- -- Map to a Lua function:
---- vim.keymap.set('n', 'lhs', function() print("real lua function") end)
---- -- Map to multiple modes:
---- vim.keymap.set({'n', 'v'}, '<leader>lr', vim.lsp.buf.references, { buffer = true })
---- -- Buffer-local mapping:
---- vim.keymap.set('n', '<leader>w', "<cmd>w<cr>", { silent = true, buffer = 5 })
---- -- Expr mapping:
+--- -- Map "x" to a Lua function:
+--- vim.keymap.set('n', 'x', function() print("real lua function") end)
+--- -- Map "<leader>x" to multiple modes for the current buffer:
+--- vim.keymap.set({'n', 'v'}, '<leader>x', vim.lsp.buf.references, { buffer = true })
+--- -- Map <Tab> to an expression (|:map-<expr>|):
--- vim.keymap.set('i', '<Tab>', function()
--- return vim.fn.pumvisible() == 1 and "<C-n>" or "<Tab>"
--- end, { expr = true })
---- -- <Plug> mapping:
+--- -- Map "[%%" to a <Plug> mapping:
--- vim.keymap.set('n', '[%%', '<Plug>(MatchitNormalMultiBackward)')
--- ```
---
----@param mode string|string[] Mode short-name, see |nvim_set_keymap()|.
---- Can also be list of modes to create mapping on multiple modes.
+---@param mode string|string[] Mode "short-name" (see |nvim_set_keymap()|), or a list thereof.
---@param lhs string Left-hand side |{lhs}| of the mapping.
---@param rhs string|function Right-hand side |{rhs}| of the mapping, can be a Lua function.
----
---@param opts? vim.keymap.set.Opts
+---
---@see |nvim_set_keymap()|
---@see |maparg()|
---@see |mapcheck()|
diff --git a/runtime/lua/vim/loader.lua b/runtime/lua/vim/loader.lua
index ea77a22416..e86d33bf53 100644
--- a/runtime/lua/vim/loader.lua
+++ b/runtime/lua/vim/loader.lua
@@ -200,7 +200,7 @@ function Loader.loader(modname)
return chunk or error(err)
end
Loader._hashes = nil
- return '\ncache_loader: module ' .. modname .. ' not found'
+ return ("\n\tcache_loader: module '%s' not found"):format(modname)
end
--- The `package.loaders` loader for libs
@@ -208,8 +208,7 @@ end
---@return string|function
---@private
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 is_win = vim.fn.has('win32') == 1
local ret = M.find(modname, { patterns = is_win and { '.dll' } or { '.so' } })[1]
if ret then
-- Making function name in Lua 5.1 (see src/loadlib.c:mkfuncname) is
@@ -222,7 +221,7 @@ function Loader.loader_lib(modname)
local chunk, err = package.loadlib(ret.modpath, 'luaopen_' .. funcname:gsub('%.', '_'))
return chunk or error(err)
end
- return '\ncache_loader_lib: module ' .. modname .. ' not found'
+ return ("\n\tcache_loader_lib: module '%s' not found"):format(modname)
end
--- `loadfile` using the cache
@@ -290,6 +289,9 @@ function Loader.load(modpath, opts)
end
--- Finds Lua modules for the given module name.
+---
+--- @since 0
+---
---@param modname string Module name, or `"*"` to find the top-level modules instead
---@param opts? vim.loader.find.Opts Options for finding a module:
---@return vim.loader.ModuleInfo[]
@@ -378,8 +380,10 @@ function M.find(modname, opts)
return results
end
---- Resets the cache for the path, or all the paths
---- if path is nil.
+--- Resets the cache for the path, or all the paths if path is nil.
+---
+--- @since 0
+---
---@param path string? path to reset
function M.reset(path)
if path then
@@ -399,6 +403,8 @@ end
--- * adds the Lua loader using the byte-compilation cache
--- * adds the libs loader
--- * removes the default Nvim loader
+---
+--- @since 0
function M.enable()
if M.enabled then
return
@@ -422,6 +428,8 @@ end
--- Disables the experimental Lua module loader:
--- * removes the loaders
--- * adds the default Nvim loader
+---
+--- @since 0
function M.disable()
if not M.enabled then
return
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index 1592fd3151..60677554ce 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -3,7 +3,6 @@ local validate = vim.validate
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'
@@ -11,6 +10,7 @@ local lsp = vim._defer_require('vim.lsp', {
buf = ..., --- @module 'vim.lsp.buf'
client = ..., --- @module 'vim.lsp.client'
codelens = ..., --- @module 'vim.lsp.codelens'
+ completion = ..., --- @module 'vim.lsp.completion'
diagnostic = ..., --- @module 'vim.lsp.diagnostic'
handlers = ..., --- @module 'vim.lsp.handlers'
inlay_hint = ..., --- @module 'vim.lsp.inlay_hint'
@@ -33,43 +33,50 @@ 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 = {
- [ms.textDocument_hover] = { 'hoverProvider' },
- [ms.textDocument_signatureHelp] = { 'signatureHelpProvider' },
- [ms.textDocument_definition] = { 'definitionProvider' },
- [ms.textDocument_implementation] = { 'implementationProvider' },
- [ms.textDocument_declaration] = { 'declarationProvider' },
- [ms.textDocument_typeDefinition] = { 'typeDefinitionProvider' },
- [ms.textDocument_documentSymbol] = { 'documentSymbolProvider' },
- [ms.textDocument_prepareCallHierarchy] = { 'callHierarchyProvider' },
[ms.callHierarchy_incomingCalls] = { 'callHierarchyProvider' },
[ms.callHierarchy_outgoingCalls] = { 'callHierarchyProvider' },
- [ms.textDocument_prepareTypeHierarchy] = { 'typeHierarchyProvider' },
- [ms.typeHierarchy_subtypes] = { 'typeHierarchyProvider' },
- [ms.typeHierarchy_supertypes] = { 'typeHierarchyProvider' },
- [ms.textDocument_rename] = { 'renameProvider' },
- [ms.textDocument_prepareRename] = { 'renameProvider', 'prepareProvider' },
+ [ms.codeAction_resolve] = { 'codeActionProvider', 'resolveProvider' },
+ [ms.codeLens_resolve] = { 'codeLensProvider', 'resolveProvider' },
+ [ms.documentLink_resolve] = { 'documentLinkProvider', 'resolveProvider' },
+ [ms.inlayHint_resolve] = { 'inlayHintProvider', 'resolveProvider' },
[ms.textDocument_codeAction] = { 'codeActionProvider' },
[ms.textDocument_codeLens] = { 'codeLensProvider' },
- [ms.codeLens_resolve] = { 'codeLensProvider', 'resolveProvider' },
- [ms.codeAction_resolve] = { 'codeActionProvider', 'resolveProvider' },
- [ms.workspace_executeCommand] = { 'executeCommandProvider' },
- [ms.workspace_symbol] = { 'workspaceSymbolProvider' },
- [ms.textDocument_references] = { 'referencesProvider' },
- [ms.textDocument_rangeFormatting] = { 'documentRangeFormattingProvider' },
- [ms.textDocument_formatting] = { 'documentFormattingProvider' },
[ms.textDocument_completion] = { 'completionProvider' },
- [ms.textDocument_documentHighlight] = { 'documentHighlightProvider' },
- [ms.textDocument_semanticTokens_full] = { 'semanticTokensProvider' },
- [ms.textDocument_semanticTokens_full_delta] = { 'semanticTokensProvider' },
- [ms.textDocument_inlayHint] = { 'inlayHintProvider' },
+ [ms.textDocument_declaration] = { 'declarationProvider' },
+ [ms.textDocument_definition] = { 'definitionProvider' },
[ms.textDocument_diagnostic] = { 'diagnosticProvider' },
- [ms.inlayHint_resolve] = { 'inlayHintProvider', 'resolveProvider' },
- [ms.textDocument_documentLink] = { 'documentLinkProvider' },
- [ms.documentLink_resolve] = { 'documentLinkProvider', 'resolveProvider' },
[ms.textDocument_didClose] = { 'textDocumentSync', 'openClose' },
[ms.textDocument_didOpen] = { 'textDocumentSync', 'openClose' },
- [ms.textDocument_willSave] = { 'textDocumentSync', 'willSave' },
+ [ms.textDocument_documentColor] = { 'colorProvider' },
+ [ms.textDocument_documentHighlight] = { 'documentHighlightProvider' },
+ [ms.textDocument_documentLink] = { 'documentLinkProvider' },
+ [ms.textDocument_documentSymbol] = { 'documentSymbolProvider' },
+ [ms.textDocument_formatting] = { 'documentFormattingProvider' },
+ [ms.textDocument_hover] = { 'hoverProvider' },
+ [ms.textDocument_implementation] = { 'implementationProvider' },
+ [ms.textDocument_inlayHint] = { 'inlayHintProvider' },
+ [ms.textDocument_inlineValue] = { 'inlineValueProvider' },
+ [ms.textDocument_linkedEditingRange] = { 'linkedEditingRangeProvider' },
+ [ms.textDocument_moniker] = { 'monikerProvider' },
+ [ms.textDocument_onTypeFormatting] = { 'documentOnTypeFormattingProvider' },
+ [ms.textDocument_prepareCallHierarchy] = { 'callHierarchyProvider' },
+ [ms.textDocument_prepareRename] = { 'renameProvider', 'prepareProvider' },
+ [ms.textDocument_prepareTypeHierarchy] = { 'typeHierarchyProvider' },
+ [ms.textDocument_rangeFormatting] = { 'documentRangeFormattingProvider' },
+ [ms.textDocument_rangesFormatting] = { 'documentRangeFormattingProvider', 'rangesSupport' },
+ [ms.textDocument_references] = { 'referencesProvider' },
+ [ms.textDocument_rename] = { 'renameProvider' },
+ [ms.textDocument_selectionRange] = { 'selectionRangeProvider' },
+ [ms.textDocument_semanticTokens_full] = { 'semanticTokensProvider' },
+ [ms.textDocument_semanticTokens_full_delta] = { 'semanticTokensProvider' },
+ [ms.textDocument_signatureHelp] = { 'signatureHelpProvider' },
+ [ms.textDocument_typeDefinition] = { 'typeDefinitionProvider' },
[ms.textDocument_willSaveWaitUntil] = { 'textDocumentSync', 'willSaveWaitUntil' },
+ [ms.textDocument_willSave] = { 'textDocumentSync', 'willSave' },
+ [ms.typeHierarchy_subtypes] = { 'typeHierarchyProvider' },
+ [ms.typeHierarchy_supertypes] = { 'typeHierarchyProvider' },
+ [ms.workspace_executeCommand] = { 'executeCommandProvider' },
+ [ms.workspace_symbol] = { 'workspaceSymbolProvider' },
}
-- TODO improve handling of scratch buffers with LSP attached.
@@ -201,10 +208,10 @@ end
--- 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: vim.lsp.ClientConfig): boolean
+--- @field reuse_client? fun(client: vim.lsp.Client, config: vim.lsp.ClientConfig): boolean
---
--- Buffer handle to attach to if starting or re-using a client (0 for current).
---- @field bufnr integer
+--- @field bufnr? integer
---
--- Suppress error reporting if the LSP server fails to start (default false).
--- @field silent? boolean
@@ -351,7 +358,7 @@ function lsp._set_defaults(client, bufnr)
then
vim.bo[bufnr].formatexpr = 'v:lua.vim.lsp.formatexpr()'
end
- api.nvim_buf_call(bufnr, function()
+ vim._with({ buf = bufnr }, function()
if
client.supports_method(ms.textDocument_hover)
and is_empty_or_default(bufnr, 'keywordprg')
@@ -377,9 +384,9 @@ local function reset_defaults(bufnr)
if vim.bo[bufnr].formatexpr == 'v:lua.vim.lsp.formatexpr()' then
vim.bo[bufnr].formatexpr = nil
end
- api.nvim_buf_call(bufnr, function()
+ vim._with({ buf = bufnr }, function()
local keymap = vim.fn.maparg('K', 'n', false, true)
- if keymap and keymap.callback == vim.lsp.buf.hover then
+ if keymap and keymap.callback == vim.lsp.buf.hover and keymap.buffer == 1 then
vim.keymap.del('n', 'K', { buffer = bufnr })
end
end)
@@ -391,9 +398,9 @@ end
local function on_client_exit(code, signal, client_id)
local client = all_clients[client_id]
- for bufnr in pairs(client.attached_buffers) do
- vim.schedule(function()
- if client and client.attached_buffers[bufnr] then
+ vim.schedule(function()
+ for bufnr in pairs(client.attached_buffers) do
+ if client and client.attached_buffers[bufnr] and api.nvim_buf_is_valid(bufnr) then
api.nvim_exec_autocmds('LspDetach', {
buffer = bufnr,
modeline = false,
@@ -401,15 +408,16 @@ local function on_client_exit(code, signal, client_id)
})
end
- local namespace = vim.lsp.diagnostic.get_namespace(client_id)
- vim.diagnostic.reset(namespace, bufnr)
client.attached_buffers[bufnr] = nil
if #lsp.get_clients({ bufnr = bufnr, _uninitialized = true }) == 0 then
reset_defaults(bufnr)
end
- end)
- end
+ end
+
+ local namespace = vim.lsp.diagnostic.get_namespace(client_id)
+ vim.diagnostic.reset(namespace)
+ end)
local name = client.name or 'unknown'
@@ -519,7 +527,6 @@ local function buf_detach_client(bufnr, client)
end
client.attached_buffers[bufnr] = nil
- util.buf_versions[bufnr] = nil
local namespace = lsp.diagnostic.get_namespace(client.id)
vim.diagnostic.reset(namespace, bufnr)
@@ -577,7 +584,8 @@ local function buf_attach(bufnr)
api.nvim_buf_attach(bufnr, false, {
on_lines = function(_, _, changedtick, firstline, lastline, new_lastline)
if #lsp.get_clients({ bufnr = bufnr }) == 0 then
- return true -- detach
+ -- detach if there are no clients
+ return #lsp.get_clients({ bufnr = bufnr, _uninitialized = true }) == 0
end
util.buf_versions[bufnr] = changedtick
changetracking.send_changes(bufnr, firstline, lastline, new_lastline)
@@ -603,6 +611,7 @@ local function buf_attach(bufnr)
buf_detach_client(bufnr, client)
end
attached_buffers[bufnr] = nil
+ util.buf_versions[bufnr] = nil
end,
-- TODO if we know all of the potential clients ahead of time, then we
@@ -852,17 +861,20 @@ api.nvim_create_autocmd('VimLeavePre', {
---@param params table|nil Parameters to send to the server
---@param handler? lsp.Handler See |lsp-handler|
--- If nil, follows resolution strategy defined in |lsp-handler-configuration|
----
+---@param on_unsupported? fun()
+--- The function to call when the buffer has no clients that support the given method.
+--- Defaults to an `ERROR` level notification.
---@return table<integer, integer> client_request_ids Map of client-id:request-id pairs
---for all successful requests.
---@return function _cancel_all_requests Function which can be used to
---cancel all the requests. You could instead
---iterate all clients and call their `cancel_request()` methods.
-function lsp.buf_request(bufnr, method, params, handler)
+function lsp.buf_request(bufnr, method, params, handler, on_unsupported)
validate({
bufnr = { bufnr, 'n', true },
method = { method, 's' },
handler = { handler, 'f', true },
+ on_unsupported = { on_unsupported, 'f', true },
})
bufnr = resolve_bufnr(bufnr)
@@ -884,7 +896,11 @@ function lsp.buf_request(bufnr, method, params, handler)
-- if has client but no clients support the given method, notify the user
if next(clients) and not method_supported then
- vim.notify(lsp._unsupported_method(method), vim.log.levels.ERROR)
+ if on_unsupported == nil then
+ vim.notify(lsp._unsupported_method(method), vim.log.levels.ERROR)
+ else
+ on_unsupported()
+ end
vim.cmd.redraw()
return {}, function() end
end
@@ -1002,8 +1018,7 @@ 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)
- log.debug('omnifunc.findstart', { findstart = findstart, base = base })
- return vim.lsp._completion.omnifunc(findstart, base)
+ return vim.lsp.completion._omnifunc(findstart, base)
end
--- @class vim.lsp.formatexpr.Opts
@@ -1016,7 +1031,7 @@ end
--- Provides an interface between the built-in client and a `formatexpr` function.
---
--- Currently only supports a single client. This can be set via
---- `setlocal formatexpr=v:lua.vim.lsp.formatexpr()` but will typically or in `on_attach`
+--- `setlocal formatexpr=v:lua.vim.lsp.formatexpr()` or (more typically) in `on_attach`
--- via `vim.bo[bufnr].formatexpr = 'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})'`.
---
---@param opts? vim.lsp.formatexpr.Opts
diff --git a/runtime/lua/vim/lsp/_completion.lua b/runtime/lua/vim/lsp/_completion.lua
deleted file mode 100644
index a169f96565..0000000000
--- a/runtime/lua/vim/lsp/_completion.lua
+++ /dev/null
@@ -1,276 +0,0 @@
-local M = {}
-local api = vim.api
-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 vim.lsp._snippet_grammar.parse(input)
- end)
- return ok and tostring(parsed) or input
-end
-
---- Returns text that should be inserted when selecting completion item. The
---- precedence is as follows: textEdit.newText > insertText > label
----
---- See https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion
----
----@param item lsp.CompletionItem
----@return string
-local function get_completion_word(item)
- if item.textEdit ~= nil and item.textEdit.newText ~= nil and item.textEdit.newText ~= '' then
- if item.insertTextFormat == protocol.InsertTextFormat.PlainText then
- return item.textEdit.newText
- else
- return parse_snippet(item.textEdit.newText)
- end
- elseif item.insertText ~= nil and item.insertText ~= '' then
- if item.insertTextFormat == protocol.InsertTextFormat.PlainText then
- return item.insertText
- else
- return parse_snippet(item.insertText)
- end
- end
- return item.label
-end
-
---- 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
-end
-
---- Turns the result of a `textDocument/completion` request into vim-compatible
---- |complete-items|.
----
----@param result vim.lsp.CompletionResult Result of `textDocument/completion`
----@param prefix string prefix to filter the completion items
----@return table[]
----@see complete-items
-function M._lsp_to_complete_items(result, prefix)
- local items = get_items(result)
- if vim.tbl_isempty(items) then
- return {}
- end
-
- local function matches_prefix(item)
- return vim.startswith(get_completion_word(item), prefix)
- end
-
- items = vim.tbl_filter(matches_prefix, items) --[[@as lsp.CompletionItem[]|]]
- table.sort(items, function(a, b)
- return (a.sortText or a.label) < (b.sortText or b.label)
- end)
-
- local matches = {}
- for _, item in ipairs(items) do
- local info = ''
- local documentation = item.documentation
- if documentation then
- if type(documentation) == 'string' and documentation ~= '' then
- info = documentation
- elseif type(documentation) == 'table' and type(documentation.value) == 'string' then
- info = documentation.value
- else
- vim.notify(
- ('invalid documentation value %s'):format(vim.inspect(documentation)),
- vim.log.levels.WARN
- )
- end
- end
- local word = get_completion_word(item)
- table.insert(matches, {
- word = word,
- abbr = item.label,
- kind = protocol.CompletionItemKind[item.kind] or 'Unknown',
- menu = item.detail or '',
- info = #info > 0 and info or nil,
- icase = 1,
- dup = 1,
- empty = 1,
- user_data = {
- nvim = {
- lsp = {
- completion_item = item,
- },
- },
- },
- })
- end
- return matches
-end
-
----@param lnum integer 0-indexed
----@param items lsp.CompletionItem[]
-local function adjust_start_col(lnum, line, items, encoding)
- local min_start_char = nil
- for _, item in pairs(items) do
- if item.textEdit and item.textEdit.range.start.line == lnum then
- if min_start_char and min_start_char ~= item.textEdit.range.start.character then
- return nil
- end
- min_start_char = item.textEdit.range.start.character
- end
- end
- if min_start_char then
- return vim.lsp.util._str_byteindex_enc(line, min_start_char, encoding)
- else
- return nil
- end
-end
-
----@private
----@param line string line content
----@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 vim.lsp.CompletionResult
----@param encoding string
----@return table[] matches
----@return integer? server_start_boundary
-function M._convert_results(
- line,
- lnum,
- cursor_col,
- client_start_boundary,
- server_start_boundary,
- result,
- encoding
-)
- -- Completion response items may be relative to a position different than `client_start_boundary`.
- -- Concrete example, with lua-language-server:
- --
- -- require('plenary.asy|
- -- â–² â–² â–²
- -- │ │ └── cursor_pos: 20
- -- │ └────── client_start_boundary: 17
- -- └────────────── textEdit.range.start.character: 9
- -- .newText = 'plenary.async'
- -- ^^^
- -- prefix (We'd remove everything not starting with `asy`,
- -- so we'd eliminate the `plenary.async` result
- --
- -- `adjust_start_col` is used to prefer the language server boundary.
- --
- local candidates = get_items(result)
- local curstartbyte = adjust_start_col(lnum, line, candidates, encoding)
- if server_start_boundary == nil then
- server_start_boundary = curstartbyte
- elseif curstartbyte ~= nil and curstartbyte ~= server_start_boundary then
- server_start_boundary = client_start_boundary
- end
- local prefix = line:sub((server_start_boundary or client_start_boundary) + 1, cursor_col)
- local matches = M._lsp_to_complete_items(result, prefix)
- return matches, server_start_boundary
-end
-
----@param findstart integer 0 or 1, decides behavior
----@param base integer findstart=0, text to match against
----@return 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()|)
-function M.omnifunc(findstart, base)
- assert(base) -- silence luals
- local bufnr = api.nvim_get_current_buf()
- local clients = lsp.get_clients({ bufnr = bufnr, method = ms.textDocument_completion })
- local remaining = #clients
- if remaining == 0 then
- return findstart == 1 and -1 or {}
- end
-
- local win = api.nvim_get_current_win()
- local cursor = api.nvim_win_get_cursor(win)
- local lnum = cursor[1] - 1
- local cursor_col = cursor[2]
- local line = api.nvim_get_current_line()
- local line_to_cursor = line:sub(1, cursor_col)
- local client_start_boundary = vim.fn.match(line_to_cursor, '\\k*$') --[[@as integer]]
- local server_start_boundary = nil
- local items = {}
-
- local function on_done()
- local mode = api.nvim_get_mode()['mode']
- if mode == 'i' or mode == 'ic' then
- vim.fn.complete((server_start_boundary or client_start_boundary) + 1, items)
- end
- end
-
- local util = vim.lsp.util
- for _, client in ipairs(clients) do
- local params = util.make_position_params(win, client.offset_encoding)
- client.request(ms.textDocument_completion, params, function(err, result)
- if err then
- vim.lsp.log.warn(err.message)
- end
- if result and vim.fn.mode() == 'i' then
- local matches
- matches, server_start_boundary = M._convert_results(
- line,
- lnum,
- cursor_col,
- client_start_boundary,
- server_start_boundary,
- result,
- client.offset_encoding
- )
- vim.list_extend(items, matches)
- end
- remaining = remaining - 1
- if remaining == 0 then
- vim.schedule(on_done)
- end
- end, bufnr)
- end
-
- -- Return -2 to signal that we should continue completion so that we can
- -- async complete.
- return -2
-end
-
-return M
diff --git a/runtime/lua/vim/lsp/_dynamic.lua b/runtime/lua/vim/lsp/_dynamic.lua
index 819b03a63a..27113c0e74 100644
--- a/runtime/lua/vim/lsp/_dynamic.lua
+++ b/runtime/lua/vim/lsp/_dynamic.lua
@@ -24,7 +24,6 @@ function M:supports_registration(method)
end
--- @param registrations lsp.Registration[]
---- @package
function M:register(registrations)
-- remove duplicates
self:unregister(registrations)
@@ -38,7 +37,6 @@ function M:register(registrations)
end
--- @param unregisterations lsp.Unregistration[]
---- @package
function M:unregister(unregisterations)
for _, unreg in ipairs(unregisterations) do
local method = unreg.method
@@ -58,7 +56,6 @@ end
--- @param method string
--- @param opts? {bufnr: integer?}
--- @return lsp.Registration? (table|nil) the registration if found
---- @package
function M:get(method, opts)
opts = opts or {}
opts.bufnr = opts.bufnr or vim.api.nvim_get_current_buf()
@@ -78,7 +75,6 @@ end
--- @param method string
--- @param opts? {bufnr: integer?}
---- @package
function M:supports(method, opts)
return self:get(method, opts) ~= nil
end
diff --git a/runtime/lua/vim/lsp/_meta/protocol.lua b/runtime/lua/vim/lsp/_meta/protocol.lua
index 9a11972007..d83c40a09f 100644
--- a/runtime/lua/vim/lsp/_meta/protocol.lua
+++ b/runtime/lua/vim/lsp/_meta/protocol.lua
@@ -134,7 +134,7 @@ error('Cannot require a meta file')
---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
+---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
@@ -681,6 +681,11 @@ error('Cannot require a meta file')
---of a notebook cell.
---@field cellTextDocuments lsp.TextDocumentItem[]
+---Registration options specific to a notebook.
+---
+---@since 3.17.0
+---@class lsp.NotebookDocumentSyncRegistrationOptions: lsp.NotebookDocumentSyncOptions, lsp.StaticRegistrationOptions
+
---The params sent in a change notebook document notification.
---
---@since 3.17.0
@@ -789,7 +794,7 @@ error('Cannot require a meta file')
---Information about the server.
---
---@since 3.15.0
----@field serverInfo? lsp._anonym1.serverInfo
+---@field serverInfo? lsp.ServerInfo
---The data type of the ResponseError if the
---initialize request fails.
@@ -1115,7 +1120,7 @@ error('Cannot require a meta file')
---capability.
---
---@since 3.17.0
----@field itemDefaults? lsp._anonym2.itemDefaults
+---@field itemDefaults? lsp.CompletionItemDefaults
---
---The completion items.
---@field items lsp.CompletionItem[]
@@ -1171,7 +1176,7 @@ error('Cannot require a meta file')
---
---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
+---if the client specifies the client capability
---`textDocument.signatureHelp.noActiveParameterSupport === true`
---
---If omitted or the value lies outside the range of
@@ -1307,6 +1312,12 @@ error('Cannot require a meta file')
---Title of the command, like `save`.
---@field title string
---
+---An optional tooltip.
+---
+---@since 3.18.0
+---@proposed
+---@field tooltip? string
+---
---The identifier of the actual command handler.
---@field command string
---
@@ -1355,7 +1366,7 @@ error('Cannot require a meta file')
--- error message with `reason` in the editor.
---
---@since 3.16.0
----@field disabled? lsp._anonym4.disabled
+---@field disabled? lsp.CodeActionDisabled
---
---The workspace edit this code action performs.
---@field edit? lsp.WorkspaceEdit
@@ -1379,6 +1390,12 @@ error('Cannot require a meta file')
---
---A query string to filter symbols by. Clients may send an empty
---string here to request all symbols.
+---
+---The `query`-parameter should be interpreted in a *relaxed way* as editors
+---will apply their own highlighting and scoring on the results. A good rule
+---of thumb is to match case-insensitive and to simply check that the
+---characters of *query* appear in their order in a candidate symbol.
+---Servers shouldn't use prefix, substring, or similar strict matching.
---@field query string
---A special workspace symbol that supports locations without a range.
@@ -1393,7 +1410,7 @@ error('Cannot require a meta file')
---capability `workspace.symbol.resolveSupport`.
---
---See SymbolInformation#location for more details.
----@field location lsp.Location|lsp._anonym5.location
+---@field location lsp.Location|lsp.LocationUriOnly
---
---A data entry field that is preserved on a workspace symbol between a
---workspace symbol request and a workspace symbol resolve request.
@@ -1566,6 +1583,12 @@ error('Cannot require a meta file')
---
---The edits to apply.
---@field edit lsp.WorkspaceEdit
+---
+---Additional data about the edit.
+---
+---@since 3.18.0
+---@proposed
+---@field metadata? lsp.WorkspaceEditMetadata
---The result returned from the apply workspace edit request.
---
@@ -1650,7 +1673,7 @@ error('Cannot require a meta file')
---@class lsp.SetTraceParams
---
----@field value lsp.TraceValues
+---@field value lsp.TraceValue
---@class lsp.LogTraceParams
---
@@ -1848,10 +1871,10 @@ error('Cannot require a meta file')
---
---Server supports providing semantic tokens for a specific range
---of a document.
----@field range? boolean|lsp._anonym6.range
+---@field range? boolean|lsp._anonym1.range
---
---Server supports providing semantic tokens for a full document.
----@field full? boolean|lsp._anonym7.full
+---@field full? boolean|lsp.SemanticTokensFullDelta
---@since 3.16.0
---@class lsp.SemanticTokensEdit
@@ -1888,7 +1911,10 @@ error('Cannot require a meta file')
---
---@since 3.16.0 - support for AnnotatedTextEdit. This is guarded using a
---client capability.
----@field edits (lsp.TextEdit|lsp.AnnotatedTextEdit)[]
+---
+---@since 3.18.0 - support for SnippetTextEdit. This is guarded using a
+---client capability.
+---@field edits (lsp.TextEdit|lsp.AnnotatedTextEdit|lsp.SnippetTextEdit)[]
---Create file operation.
---@class lsp.CreateFile: lsp.ResourceOperation
@@ -2235,7 +2261,7 @@ error('Cannot require a meta file')
---@field uri lsp.DocumentUri
---
---The text document's language identifier.
----@field languageId string
+---@field languageId lsp.LanguageKind
---
---The version number of this document (it will increase after each
---change, including undo/redo).
@@ -2244,6 +2270,28 @@ error('Cannot require a meta file')
---The content of the opened text document.
---@field text string
+---Options specific to a notebook plus its cells
+---to be synced to the server.
+---
+---If a selector provides a notebook document
+---filter but no cell selector all cells of a
+---matching notebook document will be synced.
+---
+---If a selector provides no notebook document
+---filter but only a cell selector all notebook
+---document that contain at least one matching
+---cell will be synced.
+---
+---@since 3.17.0
+---@class lsp.NotebookDocumentSyncOptions
+---
+---The notebooks to be synced
+---@field notebookSelector (lsp.NotebookDocumentFilterWithNotebook|lsp.NotebookDocumentFilterWithCells)[]
+---
+---Whether save notification should be forwarded to
+---the server. Will only be honored if mode === `notebook`.
+---@field save? boolean
+
---A versioned notebook document identifier.
---
---@since 3.17.0
@@ -2266,7 +2314,7 @@ error('Cannot require a meta file')
---@field metadata? lsp.LSPObject
---
---Changes to cells
----@field cells? lsp._anonym8.cells
+---@field cells? lsp.NotebookDocumentCellChanges
---A literal to identify a notebook document in the client.
---
@@ -2348,7 +2396,7 @@ error('Cannot require a meta file')
---Information about the client
---
---@since 3.15.0
----@field clientInfo? lsp._anonym11.clientInfo
+---@field clientInfo? lsp.ClientInfo
---
---The locale the client is currently showing the user interface
---in. This must not necessarily be the locale of the operating
@@ -2380,7 +2428,7 @@ error('Cannot require a meta file')
---@field initializationOptions? lsp.LSPAny
---
---The initial trace setting. If omitted trace is disabled ('off').
----@field trace? lsp.TraceValues
+---@field trace? lsp.TraceValue
---@class lsp.WorkspaceFoldersInitializeParams
---
@@ -2534,18 +2582,24 @@ error('Cannot require a meta file')
---@proposed
---@field inlineCompletionProvider? boolean|lsp.InlineCompletionOptions
---
----Text document specific server capabilities.
----
----@since 3.18.0
----@proposed
----@field textDocument? lsp._anonym12.textDocument
----
---Workspace specific server capabilities.
----@field workspace? lsp._anonym14.workspace
+---@field workspace? lsp.WorkspaceOptions
---
---Experimental server capabilities.
---@field experimental? lsp.LSPAny
+---Information about the server
+---
+---@since 3.15.0
+---@since 3.18.0 ServerInfo type name added.
+---@class lsp.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
+
---A text document identifier to denote a specific version of a text document.
---@class lsp.VersionedTextDocumentIdentifier: lsp.TextDocumentIdentifier
---
@@ -2586,8 +2640,9 @@ error('Cannot require a meta file')
---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.
+---The diagnostic's severity. To avoid interpretation mismatches when a
+---server is used with different clients it is highly recommended that servers
+---always provide a severity value.
---@field severity? lsp.DiagnosticSeverity
---
---The diagnostic's code, which usually appear in the user interface.
@@ -2604,10 +2659,8 @@ error('Cannot require a meta file')
---appears in the user interface.
---@field source? string
---
----The diagnostic's message. It usually appears in the user interface.
----
----@since 3.18.0 - support for `MarkupContent`. This is guarded by the client capability `textDocument.diagnostic.markupMessageSupport`.
----@field message string|lsp.MarkupContent
+---The diagnostic's message. It usually appears in the user interface
+---@field message string
---
---Additional metadata about the diagnostic.
---
@@ -2661,6 +2714,46 @@ error('Cannot require a meta file')
---The range if the replace is requested.
---@field replace lsp.Range
+---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
+---be used if a completion item itself doesn't specify the value.
+---
+---If a completion list specifies a default value and a completion item
+---also specifies a corresponding value the one from the item is used.
+---
+---Servers are only allowed to return default values if the client
+---signals support for this via the `completionList.itemDefaults`
+---capability.
+---
+---@since 3.17.0
+---@class lsp.CompletionItemDefaults
+---
+---A default commit character set.
+---
+---@since 3.17.0
+---@field commitCharacters? string[]
+---
+---A default edit range.
+---
+---@since 3.17.0
+---@field editRange? lsp.Range|lsp.EditRangeWithInsertReplace
+---
+---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
+
---Completion options.
---@class lsp.CompletionOptions: lsp.WorkDoneProgressOptions
---
@@ -2692,7 +2785,7 @@ error('Cannot require a meta file')
---capabilities.
---
---@since 3.17.0
----@field completionItem? lsp._anonym15.completionItem
+---@field completionItem? lsp.ServerCompletionItemOptions
---Hover options.
---@class lsp.HoverOptions: lsp.WorkDoneProgressOptions
@@ -2742,7 +2835,7 @@ error('Cannot require a meta file')
---
---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
+---if the client specifies the client capability
---`textDocument.signatureHelp.noActiveParameterSupport === true`
---
---If provided (or `null`), this is used in place of
@@ -2819,8 +2912,6 @@ error('Cannot require a meta file')
---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.
----
----Note that the client should check the `textDocument.diagnostic.markupMessageSupport` server capability before sending diagnostics with markup messages to a server.
---@field diagnostics lsp.Diagnostic[]
---
---Requested kind of actions to return.
@@ -2834,6 +2925,16 @@ error('Cannot require a meta file')
---@since 3.17.0
---@field triggerKind? lsp.CodeActionTriggerKind
+---Captures why the code action is currently disabled.
+---
+---@since 3.18.0
+---@class lsp.CodeActionDisabled
+---
+---Human readable description of why the code action is currently disabled.
+---
+---This is displayed in the code actions UI.
+---@field reason string
+
---Provider options for a {@link CodeActionRequest}.
---@class lsp.CodeActionOptions: lsp.WorkDoneProgressOptions
---
@@ -2843,12 +2944,36 @@ error('Cannot require a meta file')
---may list out every specific kind they provide.
---@field codeActionKinds? lsp.CodeActionKind[]
---
+---Static documentation for a class of code actions.
+---
+---Documentation from the provider should be shown in the code actions menu if either:
+---
+---- Code actions of `kind` are requested by the editor. In this case, the editor will show the documentation that
+--- most closely matches the requested code action kind. For example, if a provider has documentation for
+--- both `Refactor` and `RefactorExtract`, when the user requests code actions for `RefactorExtract`,
+--- the editor will use the documentation for `RefactorExtract` instead of the documentation for `Refactor`.
+---
+---- Any code actions of `kind` are returned by the provider.
+---
+---At most one documentation entry should be shown per provider.
+---
+---@since 3.18.0
+---@proposed
+---@field documentation? lsp.CodeActionKindDocumentation[]
+---
---The server provides support to resolve additional
---information for a code action.
---
---@since 3.16.0
---@field resolveProvider? boolean
+---Location with only uri and does not include range.
+---
+---@since 3.18.0
+---@class lsp.LocationUriOnly
+---
+---@field uri lsp.DocumentUri
+
---Server capabilities for a {@link WorkspaceSymbolRequest}.
---@class lsp.WorkspaceSymbolOptions: lsp.WorkDoneProgressOptions
---
@@ -2923,12 +3048,33 @@ error('Cannot require a meta file')
---@since version 3.12.0
---@field prepareProvider? boolean
+---@since 3.18.0
+---@class lsp.PrepareRenamePlaceholder
+---
+---@field range lsp.Range
+---
+---@field placeholder string
+
+---@since 3.18.0
+---@class lsp.PrepareRenameDefaultBehavior
+---
+---@field defaultBehavior boolean
+
---The server capabilities of a {@link ExecuteCommandRequest}.
---@class lsp.ExecuteCommandOptions: lsp.WorkDoneProgressOptions
---
---The commands to be executed on the server
---@field commands string[]
+---Additional data about a workspace edit.
+---
+---@since 3.18.0
+---@proposed
+---@class lsp.WorkspaceEditMetadata
+---
+---Signal to the editor that this edit is a refactoring.
+---@field isRefactoring? boolean
+
---@since 3.16.0
---@class lsp.SemanticTokensLegend
---
@@ -2938,6 +3084,14 @@ error('Cannot require a meta file')
---The token modifiers a server uses.
---@field tokenModifiers string[]
+---Semantic tokens options to support deltas for full documents
+---
+---@since 3.18.0
+---@class lsp.SemanticTokensFullDelta
+---
+---The server supports deltas for full documents.
+---@field delta? boolean
+
---A text document identifier to optionally denote a specific version of a text document.
---@class lsp.OptionalVersionedTextDocumentIdentifier: lsp.TextDocumentIdentifier
---
@@ -2956,6 +3110,21 @@ error('Cannot require a meta file')
---The actual identifier of the change annotation
---@field annotationId lsp.ChangeAnnotationIdentifier
+---An interactive text edit.
+---
+---@since 3.18.0
+---@proposed
+---@class lsp.SnippetTextEdit
+---
+---The range of the text document to be manipulated.
+---@field range lsp.Range
+---
+---The snippet to be inserted.
+---@field snippet lsp.StringValue
+---
+---The actual identifier of the snippet edit.
+---@field annotationId? lsp.ChangeAnnotationIdentifier
+
---A generic resource operation.
---@class lsp.ResourceOperation
---
@@ -3066,20 +3235,43 @@ error('Cannot require a meta file')
---if supported by the client.
---@field executionSummary? lsp.ExecutionSummary
----A change describing how to move a `NotebookCell`
----array from state S to S'.
+---@since 3.18.0
+---@class lsp.NotebookDocumentFilterWithNotebook
---
----@since 3.17.0
----@class lsp.NotebookCellArrayChange
+---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 start oftest of the cell that changed.
----@field start uinteger
+---The cells of the matching notebook to be synced.
+---@field cells? lsp.NotebookCellLanguage[]
+
+---@since 3.18.0
+---@class lsp.NotebookDocumentFilterWithCells
---
----The deleted cells
----@field deleteCount uinteger
+---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 new cells, if any
----@field cells? lsp.NotebookCell[]
+---The cells of the matching notebook to be synced.
+---@field cells lsp.NotebookCellLanguage[]
+
+---Cell changes to a notebook document.
+---
+---@since 3.18.0
+---@class lsp.NotebookDocumentCellChanges
+---
+---Changes to the cell structure to add or
+---remove cells.
+---@field structure? lsp.NotebookDocumentCellChangeStructure
+---
+---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? lsp.NotebookDocumentCellContentChanges[]
---Describes the currently selected completion item.
---
@@ -3093,6 +3285,18 @@ error('Cannot require a meta file')
---The text the range will be replaced with if this completion is accepted.
---@field text string
+---Information about the client
+---
+---@since 3.15.0
+---@since 3.18.0 ClientInfo type name added.
+---@class lsp.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
+
---Defines the capabilities provided by the client.
---@class lsp.ClientCapabilities
---
@@ -3140,69 +3344,40 @@ error('Cannot require a meta file')
---sent.
---@field save? boolean|lsp.SaveOptions
----Options specific to a notebook plus its cells
----to be synced to the server.
+---Defines workspace specific capabilities of the server.
---
----If a selector provides a notebook document
----filter but no cell selector all cells of a
----matching notebook document will be synced.
+---@since 3.18.0
+---@class lsp.WorkspaceOptions
---
----If a selector provides no notebook document
----filter but only a cell selector all notebook
----document that contain at least one matching
----cell will be synced.
+---The server supports workspace folder.
---
----@since 3.17.0
----@class lsp.NotebookDocumentSyncOptions
+---@since 3.6.0
+---@field workspaceFolders? lsp.WorkspaceFoldersServerCapabilities
---
----The notebooks to be synced
----@field notebookSelector (lsp._anonym16.notebookSelector|lsp._anonym18.notebookSelector)[]
+---The server is interested in notifications/requests for operations on files.
---
----Whether save notification should be forwarded to
----the server. Will only be honored if mode === `notebook`.
----@field save? boolean
+---@since 3.16.0
+---@field fileOperations? lsp.FileOperationOptions
----Registration options specific to a notebook.
+---@since 3.18.0
+---@class lsp.TextDocumentContentChangePartial
---
----@since 3.17.0
----@class lsp.NotebookDocumentSyncRegistrationOptions: lsp.NotebookDocumentSyncOptions, lsp.StaticRegistrationOptions
-
----@class lsp.WorkspaceFoldersServerCapabilities
+---The range of the document that changed.
+---@field range lsp.Range
---
----The server has support for workspace folders
----@field supported? boolean
+---The optional length of the range that got replaced.
---
----Whether the server wants to receive workspace folder
----change notifications.
+---@deprecated use range instead.
+---@field rangeLength? uinteger
---
----If a string is provided the string is treated as an ID
----under which the notification is registered on the client
----side. The ID can be used to unregister for these events
----using the `client/unregisterCapability` request.
----@field changeNotifications? string|boolean
+---The new text for the provided range.
+---@field text string
----Options for notifications/requests for user operations on files.
----
----@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
+---@since 3.18.0
+---@class lsp.TextDocumentContentChangeWholeDocument
---
----The server is interested in receiving willDeleteFiles file requests.
----@field willDelete? lsp.FileOperationRegistrationOptions
+---The new text of the whole document.
+---@field text string
---Structure to capture a description for an error code.
---
@@ -3223,6 +3398,33 @@ error('Cannot require a meta file')
---The message of this related diagnostic information.
---@field message string
+---Edit range variant that includes ranges for insert and replace operations.
+---
+---@since 3.18.0
+---@class lsp.EditRangeWithInsertReplace
+---
+---@field insert lsp.Range
+---
+---@field replace lsp.Range
+
+---@since 3.18.0
+---@class lsp.ServerCompletionItemOptions
+---
+---The server has support for completion item label
+---details (see also `CompletionItemLabelDetails`) when
+---receiving a completion item in a resolve call.
+---
+---@since 3.17.0
+---@field labelDetailsSupport? boolean
+
+---@since 3.18.0
+---@deprecated use MarkupContent instead.
+---@class lsp.MarkedStringWithLanguage
+---
+---@field language string
+---
+---@field value string
+
---Represents a parameter of a callable-signature. A parameter can
---have a label and a doc-comment.
---@class lsp.ParameterInformation
@@ -3233,14 +3435,36 @@ error('Cannot require a meta file')
---signature label. (see SignatureInformation.label). The offsets are based on a UTF-16
---string representation as `Position` and `Range` does.
---
+---To avoid ambiguities a server should use the [start, end] offset value instead of using
+---a substring. Whether a client support this is controlled via `labelOffsetSupport` client
+---capability.
+---
---*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 }
+---@field label string|[uinteger, uinteger]
---
---The human-readable doc-comment of this parameter. Will be shown
---in the UI but can be omitted.
---@field documentation? string|lsp.MarkupContent
+---Documentation for a class of code actions.
+---
+---@since 3.18.0
+---@proposed
+---@class lsp.CodeActionKindDocumentation
+---
+---The kind of the code action being documented.
+---
+---If the kind is generic, such as `CodeActionKind.Refactor`, the documentation will be shown whenever any
+---refactorings are returned. If the kind if more specific, such as `CodeActionKind.RefactorExtract`, the
+---documentation will only be shown when extract refactoring code actions are returned.
+---@field kind lsp.CodeActionKind
+---
+---Command that is ued to display the documentation to the user.
+---
+---The title of this documentation code action is taken from {@linkcode Command.title}
+---@field command lsp.Command
+
---A notebook cell text document filter denotes a cell text
---document by different properties.
---
@@ -3278,6 +3502,34 @@ error('Cannot require a meta file')
---not if known by the client.
---@field success? boolean
+---@since 3.18.0
+---@class lsp.NotebookCellLanguage
+---
+---@field language string
+
+---Structural changes to cells in a notebook document.
+---
+---@since 3.18.0
+---@class lsp.NotebookDocumentCellChangeStructure
+---
+---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[]
+
+---Content changes to a cell in a notebook document.
+---
+---@since 3.18.0
+---@class lsp.NotebookDocumentCellContentChanges
+---
+---@field document lsp.VersionedTextDocumentIdentifier
+---
+---@field changes lsp.TextDocumentContentChangeEvent[]
+
---Workspace specific client capabilities.
---@class lsp.WorkspaceClientCapabilities
---
@@ -3524,7 +3776,7 @@ error('Cannot require a meta file')
---anymore since the information is outdated).
---
---@since 3.17.0
----@field staleRequestSupport? lsp._anonym20.staleRequestSupport
+---@field staleRequestSupport? lsp.StaleRequestSupportOptions
---
---Client capabilities specific to regular expressions.
---
@@ -3556,6 +3808,43 @@ error('Cannot require a meta file')
---@since 3.17.0
---@field positionEncodings? lsp.PositionEncodingKind[]
+---@class lsp.WorkspaceFoldersServerCapabilities
+---
+---The server has support for workspace folders
+---@field supported? boolean
+---
+---Whether the server wants to receive workspace folder
+---change notifications.
+---
+---If a string is provided the string is treated as an ID
+---under which the notification is registered on the client
+---side. The ID can be used to unregister for these events
+---using the `client/unregisterCapability` request.
+---@field changeNotifications? string|boolean
+
+---Options for notifications/requests for user operations on files.
+---
+---@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
+
---A relative pattern is a helper to construct glob patterns that are matched
---relatively to a base URI. The common value for a `baseUri` is a workspace
---folder root, but it can be another absolute URI as well.
@@ -3570,6 +3859,111 @@ error('Cannot require a meta file')
---The actual glob pattern;
---@field pattern lsp.Pattern
+---A document filter where `language` is required field.
+---
+---@since 3.18.0
+---@class lsp.TextDocumentFilterLanguage
+---
+---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}. See TextDocumentFilter for examples.
+---
+---@since 3.18.0 - support for relative patterns.
+---@field pattern? lsp.GlobPattern
+
+---A document filter where `scheme` is required field.
+---
+---@since 3.18.0
+---@class lsp.TextDocumentFilterScheme
+---
+---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}. See TextDocumentFilter for examples.
+---
+---@since 3.18.0 - support for relative patterns.
+---@field pattern? lsp.GlobPattern
+
+---A document filter where `pattern` is required field.
+---
+---@since 3.18.0
+---@class lsp.TextDocumentFilterPattern
+---
+---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}. See TextDocumentFilter for examples.
+---
+---@since 3.18.0 - support for relative patterns.
+---@field pattern lsp.GlobPattern
+
+---A notebook document filter where `notebookType` is required field.
+---
+---@since 3.18.0
+---@class lsp.NotebookDocumentFilterNotebookType
+---
+---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? lsp.GlobPattern
+
+---A notebook document filter where `scheme` is required field.
+---
+---@since 3.18.0
+---@class lsp.NotebookDocumentFilterScheme
+---
+---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? lsp.GlobPattern
+
+---A notebook document filter where `pattern` is required field.
+---
+---@since 3.18.0
+---@class lsp.NotebookDocumentFilterPattern
+---
+---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 lsp.GlobPattern
+
+---A change describing how to move a `NotebookCell`
+---array from state S to S'.
+---
+---@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[]
+
---@class lsp.WorkspaceEditClientCapabilities
---
---The client supports versioned document changes in `WorkspaceEdit`s
@@ -3600,7 +3994,19 @@ error('Cannot require a meta file')
---create file, rename file and delete file changes.
---
---@since 3.16.0
----@field changeAnnotationSupport? lsp._anonym21.changeAnnotationSupport
+---@field changeAnnotationSupport? lsp.ChangeAnnotationsSupportOptions
+---
+---Whether the client supports `WorkspaceEditMetadata` in `WorkspaceEdit`s.
+---
+---@since 3.18.0
+---@proposed
+---@field metadataSupport? boolean
+---
+---Whether the client supports snippets as text edits.
+---
+---@since 3.18.0
+---@proposed
+---@field snippetEditSupport? boolean
---@class lsp.DidChangeConfigurationClientCapabilities
---
@@ -3627,20 +4033,20 @@ error('Cannot require a meta file')
---@field dynamicRegistration? boolean
---
---Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.
----@field symbolKind? lsp._anonym22.symbolKind
+---@field symbolKind? lsp.ClientSymbolKindOptions
---
---The client supports tags on `SymbolInformation`.
---Clients supporting tags have to handle unknown tags gracefully.
---
---@since 3.16.0
----@field tagSupport? lsp._anonym23.tagSupport
+---@field tagSupport? lsp.ClientSymbolTagOptions
---
---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? lsp._anonym24.resolveSupport
+---@field resolveSupport? lsp.ClientSymbolResolveOptions
---The client capabilities of a {@link ExecuteCommandRequest}.
---@class lsp.ExecuteCommandClientCapabilities
@@ -3785,9 +4191,9 @@ error('Cannot require a meta file')
---
---The client supports the following `CompletionItem` specific
---capabilities.
----@field completionItem? lsp._anonym25.completionItem
+---@field completionItem? lsp.ClientCompletionItemOptions
---
----@field completionItemKind? lsp._anonym29.completionItemKind
+---@field completionItemKind? lsp.ClientCompletionItemOptionsKind
---
---Defines how the client handles whitespace and indentation
---when accepting a completion item that uses multi line
@@ -3804,7 +4210,7 @@ error('Cannot require a meta file')
---capabilities.
---
---@since 3.17.0
----@field completionList? lsp._anonym30.completionList
+---@field completionList? lsp.CompletionListCapabilities
---@class lsp.HoverClientCapabilities
---
@@ -3823,7 +4229,7 @@ error('Cannot require a meta file')
---
---The client supports the following `SignatureInformation`
---specific properties.
----@field signatureInformation? lsp._anonym31.signatureInformation
+---@field signatureInformation? lsp.ClientSignatureInformationOptions
---
---The client supports to send additional context information for a
---`textDocument/signatureHelp` request. A client that opts into
@@ -3901,7 +4307,7 @@ error('Cannot require a meta file')
---
---Specific capabilities for the `SymbolKind` in the
---`textDocument/documentSymbol` request.
----@field symbolKind? lsp._anonym33.symbolKind
+---@field symbolKind? lsp.ClientSymbolKindOptions
---
---The client supports hierarchical document symbols.
---@field hierarchicalDocumentSymbolSupport? boolean
@@ -3911,7 +4317,7 @@ error('Cannot require a meta file')
---Clients supporting tags have to handle unknown tags gracefully.
---
---@since 3.16.0
----@field tagSupport? lsp._anonym34.tagSupport
+---@field tagSupport? lsp.ClientSymbolTagOptions
---
---The client supports an additional label presented in the UI when
---registering a document symbol provider.
@@ -3930,7 +4336,7 @@ error('Cannot require a meta file')
---set the request can only return `Command` literals.
---
---@since 3.8.0
----@field codeActionLiteralSupport? lsp._anonym35.codeActionLiteralSupport
+---@field codeActionLiteralSupport? lsp.ClientCodeActionLiteralOptions
---
---Whether code action supports the `isPreferred` property.
---
@@ -3953,7 +4359,7 @@ error('Cannot require a meta file')
---properties via a separate `codeAction/resolve` request.
---
---@since 3.16.0
----@field resolveSupport? lsp._anonym37.resolveSupport
+---@field resolveSupport? lsp.ClientCodeActionResolveOptions
---
---Whether the client honors the change annotations in
---text edits and resource operations returned via the
@@ -3963,12 +4369,25 @@ error('Cannot require a meta file')
---
---@since 3.16.0
---@field honorsChangeAnnotations? boolean
+---
+---Whether the client supports documentation for a class of
+---code actions.
+---
+---@since 3.18.0
+---@proposed
+---@field documentationSupport? boolean
---The client capabilities of a {@link CodeLensRequest}.
---@class lsp.CodeLensClientCapabilities
---
---Whether code lens supports dynamic registration.
---@field dynamicRegistration? boolean
+---
+---Whether the client supports resolving additional code lens
+---properties via a separate `codeLens/resolve` request.
+---
+---@since 3.18.0
+---@field resolveSupport? lsp.ClientCodeLensResolveOptions
---The client capabilities of a {@link DocumentLinkRequest}.
---@class lsp.DocumentLinkClientCapabilities
@@ -4061,12 +4480,12 @@ error('Cannot require a meta file')
---Specific options for the folding range kind.
---
---@since 3.17.0
----@field foldingRangeKind? lsp._anonym38.foldingRangeKind
+---@field foldingRangeKind? lsp.ClientFoldingRangeKindOptions
---
---Specific options for the folding range.
---
---@since 3.17.0
----@field foldingRange? lsp._anonym39.foldingRange
+---@field foldingRange? lsp.ClientFoldingRangeOptions
---@class lsp.SelectionRangeClientCapabilities
---
@@ -4076,34 +4495,13 @@ error('Cannot require a meta file')
---@field dynamicRegistration? boolean
---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? lsp._anonym40.tagSupport
+---@class lsp.PublishDiagnosticsClientCapabilities: lsp.DiagnosticsCapabilities
---
---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.
----
----@since 3.16.0
----@field dataSupport? boolean
---@since 3.16.0
---@class lsp.CallHierarchyClientCapabilities
@@ -4129,7 +4527,7 @@ 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 lsp._anonym41.requests
+---@field requests lsp.ClientSemanticTokensRequestOptions
---
---The token types that the client supports.
---@field tokenTypes string[]
@@ -4212,12 +4610,12 @@ error('Cannot require a meta file')
---
---Indicates which properties a client can resolve lazily on an inlay
---hint.
----@field resolveSupport? lsp._anonym44.resolveSupport
+---@field resolveSupport? lsp.ClientInlayHintResolveOptions
---Client capabilities specific to diagnostic pull requests.
---
---@since 3.17.0
----@class lsp.DiagnosticClientCapabilities
+---@class lsp.DiagnosticClientCapabilities: lsp.DiagnosticsCapabilities
---
---Whether implementation supports dynamic registration. If this is set to `true`
---the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
@@ -4226,9 +4624,6 @@ error('Cannot require a meta file')
---
---Whether the clients supports related documents for document diagnostic pulls.
---@field relatedDocumentSupport? boolean
----
----Whether the client supports `MarkupContent` in diagnostic messages.
----@field markupMessageSupport? boolean
---Client capabilities specific to inline completions.
---
@@ -4257,7 +4652,7 @@ error('Cannot require a meta file')
---@class lsp.ShowMessageRequestClientCapabilities
---
---Capabilities specific to the `MessageActionItem` type.
----@field messageActionItem? lsp._anonym45.messageActionItem
+---@field messageActionItem? lsp.ClientShowMessageActionItemOptions
---Client capabilities for the showDocument request.
---
@@ -4268,13 +4663,24 @@ error('Cannot require a meta file')
---request.
---@field support boolean
+---@since 3.18.0
+---@class lsp.StaleRequestSupportOptions
+---
+---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[]
+
---Client capabilities specific to regular expressions.
---
---@since 3.16.0
---@class lsp.RegularExpressionsClientCapabilities
---
---The engine's name.
----@field engine string
+---@field engine lsp.RegularExpressionEngineKind
---
---The engine's version.
---@field version? string
@@ -4296,6 +4702,285 @@ error('Cannot require a meta file')
---@since 3.17.0
---@field allowedTags? string[]
+---@since 3.18.0
+---@class lsp.ChangeAnnotationsSupportOptions
+---
+---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
+
+---@since 3.18.0
+---@class lsp.ClientSymbolKindOptions
+---
+---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
+---to a default value when unknown.
+---
+---If this property is not present the client only supports
+---the symbol kinds from `File` to `Array` as defined in
+---the initial version of the protocol.
+---@field valueSet? lsp.SymbolKind[]
+
+---@since 3.18.0
+---@class lsp.ClientSymbolTagOptions
+---
+---The tags supported by the client.
+---@field valueSet lsp.SymbolTag[]
+
+---@since 3.18.0
+---@class lsp.ClientSymbolResolveOptions
+---
+---The properties that a client can resolve lazily. Usually
+---`location.range`
+---@field properties string[]
+
+---@since 3.18.0
+---@class lsp.ClientCompletionItemOptions
+---
+---Client supports snippets as insert text.
+---
+---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. 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? lsp.CompletionItemTagOptions
+---
+---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? lsp.ClientCompletionItemResolveOptions
+---
+---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? lsp.ClientCompletionItemInsertTextModeOptions
+---
+---The client has support for completion item label
+---details (see also `CompletionItemLabelDetails`).
+---
+---@since 3.17.0
+---@field labelDetailsSupport? boolean
+
+---@since 3.18.0
+---@class lsp.ClientCompletionItemOptionsKind
+---
+---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
+---to a default value when unknown.
+---
+---If this property is not present the client only supports
+---the completion items kinds from `Text` to `Reference` as defined in
+---the initial version of the protocol.
+---@field valueSet? lsp.CompletionItemKind[]
+
+---The client supports the following `CompletionList` specific
+---capabilities.
+---
+---@since 3.17.0
+---@class lsp.CompletionListCapabilities
+---
+---The client supports the following itemDefaults on
+---a completion list.
+---
+---The value lists the supported property names of the
+---`CompletionList.itemDefaults` object. If omitted
+---no properties are supported.
+---
+---@since 3.17.0
+---@field itemDefaults? string[]
+
+---@since 3.18.0
+---@class lsp.ClientSignatureInformationOptions
+---
+---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? lsp.ClientSignatureParameterInformationOptions
+---
+---The client supports the `activeParameter` property on `SignatureInformation`
+---literal.
+---
+---@since 3.16.0
+---@field activeParameterSupport? boolean
+---
+---The client supports the `activeParameter` property on
+---`SignatureHelp`/`SignatureInformation` being set to `null` to
+---indicate that no parameter should be active.
+---
+---@since 3.18.0
+---@proposed
+---@field noActiveParameterSupport? boolean
+
+---@since 3.18.0
+---@class lsp.ClientCodeActionLiteralOptions
+---
+---The code action kind is support with the following value
+---set.
+---@field codeActionKind lsp.ClientCodeActionKindOptions
+
+---@since 3.18.0
+---@class lsp.ClientCodeActionResolveOptions
+---
+---The properties that a client can resolve lazily.
+---@field properties string[]
+
+---@since 3.18.0
+---@class lsp.ClientCodeLensResolveOptions
+---
+---The properties that a client can resolve lazily.
+---@field properties string[]
+
+---@since 3.18.0
+---@class lsp.ClientFoldingRangeKindOptions
+---
+---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[]
+
+---@since 3.18.0
+---@class lsp.ClientFoldingRangeOptions
+---
+---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
+
+---General diagnostics capabilities for pull and push model.
+---@class lsp.DiagnosticsCapabilities
+---
+---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? lsp.ClientDiagnosticsTagOptions
+---
+---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.
+---
+---@since 3.16.0
+---@field dataSupport? boolean
+
+---@since 3.18.0
+---@class lsp.ClientSemanticTokensRequestOptions
+---
+---The client will send the `textDocument/semanticTokens/range` request if
+---the server provides a corresponding handler.
+---@field range? boolean|lsp._anonym2.range
+---
+---The client will send the `textDocument/semanticTokens/full` request if
+---the server provides a corresponding handler.
+---@field full? boolean|lsp.ClientSemanticTokensRequestFullDelta
+
+---@since 3.18.0
+---@class lsp.ClientInlayHintResolveOptions
+---
+---The properties that a client can resolve lazily.
+---@field properties string[]
+
+---@since 3.18.0
+---@class lsp.ClientShowMessageActionItemOptions
+---
+---Whether the client supports additional attributes which
+---are preserved and send back to the server in the
+---request's response.
+---@field additionalPropertiesSupport? boolean
+
+---@since 3.18.0
+---@class lsp.CompletionItemTagOptions
+---
+---The tags supported by the client.
+---@field valueSet lsp.CompletionItemTag[]
+
+---@since 3.18.0
+---@class lsp.ClientCompletionItemResolveOptions
+---
+---The properties that a client can resolve lazily.
+---@field properties string[]
+
+---@since 3.18.0
+---@class lsp.ClientCompletionItemInsertTextModeOptions
+---
+---@field valueSet lsp.InsertTextMode[]
+
+---@since 3.18.0
+---@class lsp.ClientSignatureParameterInformationOptions
+---
+---The client supports processing label offsets instead of a
+---simple label string.
+---
+---@since 3.14.0
+---@field labelOffsetSupport? boolean
+
+---@since 3.18.0
+---@class lsp.ClientCodeActionKindOptions
+---
+---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[]
+
+---@since 3.18.0
+---@class lsp.ClientDiagnosticsTagOptions
+---
+---The tags supported by the client.
+---@field valueSet lsp.DiagnosticTag[]
+
+---@since 3.18.0
+---@class lsp.ClientSemanticTokensRequestFullDelta
+---
+---The client will send the `textDocument/semanticTokens/full/delta` request if
+---the server provides a corresponding handler.
+---@field delta? boolean
+
---A set of predefined token types. This set is not fixed
---an clients can specify additional token types via the
---corresponding client capabilities.
@@ -4325,6 +5010,7 @@ error('Cannot require a meta file')
---| "regexp" # regexp
---| "operator" # operator
---| "decorator" # decorator
+---| "label" # label
---A set of predefined token modifiers. This set is not fixed
---an clients can specify additional token types via the
@@ -4515,12 +5201,14 @@ error('Cannot require a meta file')
---| "refactor" # Refactor
---| "refactor.extract" # RefactorExtract
---| "refactor.inline" # RefactorInline
+---| "refactor.move" # RefactorMove
---| "refactor.rewrite" # RefactorRewrite
---| "source" # Source
---| "source.organizeImports" # SourceOrganizeImports
---| "source.fixAll" # SourceFixAll
+---| "notebook" # Notebook
----@alias lsp.TraceValues
+---@alias lsp.TraceValue
---| "off" # Off
---| "messages" # Messages
---| "verbose" # Verbose
@@ -4534,13 +5222,79 @@ error('Cannot require a meta file')
---| "plaintext" # PlainText
---| "markdown" # Markdown
+---Predefined Language kinds
+---@since 3.18.0
+---@proposed
+---@alias lsp.LanguageKind
+---| "abap" # ABAP
+---| "bat" # WindowsBat
+---| "bibtex" # BibTeX
+---| "clojure" # Clojure
+---| "coffeescript" # Coffeescript
+---| "c" # C
+---| "cpp" # CPP
+---| "csharp" # CSharp
+---| "css" # CSS
+---| "d" # D
+---| "pascal" # Delphi
+---| "diff" # Diff
+---| "dart" # Dart
+---| "dockerfile" # Dockerfile
+---| "elixir" # Elixir
+---| "erlang" # Erlang
+---| "fsharp" # FSharp
+---| "git-commit" # GitCommit
+---| "rebase" # GitRebase
+---| "go" # Go
+---| "groovy" # Groovy
+---| "handlebars" # Handlebars
+---| "haskell" # Haskell
+---| "html" # HTML
+---| "ini" # Ini
+---| "java" # Java
+---| "javascript" # JavaScript
+---| "javascriptreact" # JavaScriptReact
+---| "json" # JSON
+---| "latex" # LaTeX
+---| "less" # Less
+---| "lua" # Lua
+---| "makefile" # Makefile
+---| "markdown" # Markdown
+---| "objective-c" # ObjectiveC
+---| "objective-cpp" # ObjectiveCPP
+---| "pascal" # Pascal
+---| "perl" # Perl
+---| "perl6" # Perl6
+---| "php" # PHP
+---| "powershell" # Powershell
+---| "jade" # Pug
+---| "python" # Python
+---| "r" # R
+---| "razor" # Razor
+---| "ruby" # Ruby
+---| "rust" # Rust
+---| "scss" # SCSS
+---| "sass" # SASS
+---| "scala" # Scala
+---| "shaderlab" # ShaderLab
+---| "shellscript" # ShellScript
+---| "sql" # SQL
+---| "swift" # Swift
+---| "typescript" # TypeScript
+---| "typescriptreact" # TypeScriptReact
+---| "tex" # TeX
+---| "vb" # VisualBasic
+---| "xml" # XML
+---| "xsl" # XSL
+---| "yaml" # YAML
+
---Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered.
---
---@since 3.18.0
---@proposed
---@alias lsp.InlineCompletionTriggerKind
----| 0 # Invoked
----| 1 # Automatic
+---| 1 # Invoked
+---| 2 # Automatic
---A set of predefined position encoding kinds.
---
@@ -4684,7 +5438,7 @@ error('Cannot require a meta file')
---@since 3.17.0
---@alias lsp.DocumentDiagnosticReport lsp.RelatedFullDocumentDiagnosticReport|lsp.RelatedUnchangedDocumentDiagnosticReport
----@alias lsp.PrepareRenameResult lsp.Range|lsp._anonym46.PrepareRenameResult|lsp._anonym47.PrepareRenameResult
+---@alias lsp.PrepareRenameResult lsp.Range|lsp.PrepareRenamePlaceholder|lsp.PrepareRenameDefaultBehavior
---A document selector is the combination of one or many document filters.
---
@@ -4705,7 +5459,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 lsp._anonym48.TextDocumentContentChangeEvent|lsp._anonym49.TextDocumentContentChangeEvent
+---@alias lsp.TextDocumentContentChangeEvent lsp.TextDocumentContentChangePartial|lsp.TextDocumentContentChangeWholeDocument
---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
@@ -4719,7 +5473,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|lsp._anonym50.MarkedString
+---@alias lsp.MarkedString string|lsp.MarkedStringWithLanguage
---A document filter describes a top level text document or
---a notebook cell document.
@@ -4752,14 +5506,14 @@ error('Cannot require a meta file')
---\@sample A language filter that applies to all package.json paths: `{ language: 'json', pattern: '**package.json' }`
---
---@since 3.17.0
----@alias lsp.TextDocumentFilter lsp._anonym51.TextDocumentFilter|lsp._anonym52.TextDocumentFilter|lsp._anonym53.TextDocumentFilter
+---@alias lsp.TextDocumentFilter lsp.TextDocumentFilterLanguage|lsp.TextDocumentFilterScheme|lsp.TextDocumentFilterPattern
---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 lsp._anonym54.NotebookDocumentFilter|lsp._anonym55.NotebookDocumentFilter|lsp._anonym56.NotebookDocumentFilter
+---@alias lsp.NotebookDocumentFilter lsp.NotebookDocumentFilterNotebookType|lsp.NotebookDocumentFilterScheme|lsp.NotebookDocumentFilterPattern
---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
@@ -4772,512 +5526,8 @@ error('Cannot require a meta file')
---@since 3.17.0
---@alias lsp.Pattern string
----@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 lsp._anonym3.itemDefaults.editRange
----
----@field insert lsp.Range
----
----@field replace lsp.Range
-
----@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|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 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 lsp._anonym5.location
----
----@field uri lsp.DocumentUri
-
----@class lsp._anonym6.range
-
----@class lsp._anonym7.full
----
----The server supports deltas for full documents.
----@field delta? boolean
-
----@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 lsp._anonym10.cells.textContent
----
----@field document lsp.VersionedTextDocumentIdentifier
----
----@field changes lsp.TextDocumentContentChangeEvent[]
-
----@class lsp._anonym8.cells
----
----Changes to the cell structure to add or
----remove cells.
----@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? lsp._anonym10.cells.textContent[]
-
----@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 lsp._anonym13.textDocument.diagnostic
----
----Whether the server supports `MarkupContent` in diagnostic messages.
----@field markupMessageSupport? boolean
-
----@class lsp._anonym12.textDocument
----
----Capabilities specific to the diagnostic pull model.
----
----@since 3.18.0
----@field diagnostic? lsp._anonym13.textDocument.diagnostic
-
----@class lsp._anonym14.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 lsp._anonym15.completionItem
----
----The server has support for completion item label
----details (see also `CompletionItemLabelDetails`) when
----receiving a completion item in a resolve call.
----
----@since 3.17.0
----@field labelDetailsSupport? boolean
-
----@class lsp._anonym17.notebookSelector.cells
----
----@field language string
-
----@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? lsp._anonym17.notebookSelector.cells[]
-
----@class lsp._anonym19.notebookSelector.cells
----
----@field language string
-
----@class lsp._anonym18.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 lsp._anonym19.notebookSelector.cells[]
-
----@class lsp._anonym20.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 lsp._anonym21.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
+---@alias lsp.RegularExpressionEngineKind string
----@class lsp._anonym22.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
----to a default value when unknown.
----
----If this property is not present the client only supports
----the symbol kinds from `File` to `Array` as defined in
----the initial version of the protocol.
----@field valueSet? lsp.SymbolKind[]
+---@class lsp._anonym1.range
----@class lsp._anonym23.tagSupport
----
----The tags supported by the client.
----@field valueSet lsp.SymbolTag[]
-
----@class lsp._anonym24.resolveSupport
----
----The properties that a client can resolve lazily. Usually
----`location.range`
----@field properties string[]
-
----@class lsp._anonym26.completionItem.tagSupport
----
----The tags supported by the client.
----@field valueSet lsp.CompletionItemTag[]
-
----@class lsp._anonym27.completionItem.resolveSupport
----
----The properties that a client can resolve lazily.
----@field properties string[]
-
----@class lsp._anonym28.completionItem.insertTextModeSupport
----
----@field valueSet lsp.InsertTextMode[]
-
----@class lsp._anonym25.completionItem
----
----Client supports snippets as insert text.
----
----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. 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? lsp._anonym26.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? lsp._anonym27.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? lsp._anonym28.completionItem.insertTextModeSupport
----
----The client has support for completion item label
----details (see also `CompletionItemLabelDetails`).
----
----@since 3.17.0
----@field labelDetailsSupport? boolean
-
----@class lsp._anonym29.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
----to a default value when unknown.
----
----If this property is not present the client only supports
----the completion items kinds from `Text` to `Reference` as defined in
----the initial version of the protocol.
----@field valueSet? lsp.CompletionItemKind[]
-
----@class lsp._anonym30.completionList
----
----The client supports the following itemDefaults on
----a completion list.
----
----The value lists the supported property names of the
----`CompletionList.itemDefaults` object. If omitted
----no properties are supported.
----
----@since 3.17.0
----@field itemDefaults? string[]
-
----@class lsp._anonym32.signatureInformation.parameterInformation
----
----The client supports processing label offsets instead of a
----simple label string.
----
----@since 3.14.0
----@field labelOffsetSupport? boolean
-
----@class lsp._anonym31.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? lsp._anonym32.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 lsp._anonym33.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
----to a default value when unknown.
----
----If this property is not present the client only supports
----the symbol kinds from `File` to `Array` as defined in
----the initial version of the protocol.
----@field valueSet? lsp.SymbolKind[]
-
----@class lsp._anonym34.tagSupport
----
----The tags supported by the client.
----@field valueSet lsp.SymbolTag[]
-
----@class lsp._anonym36.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 lsp._anonym35.codeActionLiteralSupport
----
----The code action kind is support with the following value
----set.
----@field codeActionKind lsp._anonym36.codeActionLiteralSupport.codeActionKind
-
----@class lsp._anonym37.resolveSupport
----
----The properties that a client can resolve lazily.
----@field properties string[]
-
----@class lsp._anonym38.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 lsp._anonym39.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 lsp._anonym40.tagSupport
----
----The tags supported by the client.
----@field valueSet lsp.DiagnosticTag[]
-
----@class lsp._anonym42.requests.range
-
----@class lsp._anonym43.requests.full
----
----The client will send the `textDocument/semanticTokens/full/delta` request if
----the server provides a corresponding handler.
----@field delta? boolean
-
----@class lsp._anonym41.requests
----
----The client will send the `textDocument/semanticTokens/range` request if
----the server provides a corresponding handler.
----@field range? boolean|lsp._anonym42.requests.range
----
----The client will send the `textDocument/semanticTokens/full` request if
----the server provides a corresponding handler.
----@field full? boolean|lsp._anonym43.requests.full
-
----@class lsp._anonym44.resolveSupport
----
----The properties that a client can resolve lazily.
----@field properties string[]
-
----@class lsp._anonym45.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 lsp._anonym46.PrepareRenameResult
----
----@field range lsp.Range
----
----@field placeholder string
-
----@class lsp._anonym47.PrepareRenameResult
----
----@field defaultBehavior boolean
-
----@class lsp._anonym48.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 lsp._anonym49.TextDocumentContentChangeEvent
----
----The new text of the whole document.
----@field text string
-
----@class lsp._anonym50.MarkedString
----
----@field language string
----
----@field value string
-
----@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}. See TextDocumentFilter for examples.
----@field pattern? string
-
----@class lsp._anonym52.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}. See TextDocumentFilter for examples.
----@field pattern? string
-
----@class lsp._anonym53.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}. See TextDocumentFilter for examples.
----@field pattern string
-
----@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
-
----@class lsp._anonym55.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 lsp._anonym56.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 lsp._anonym2.range
diff --git a/runtime/lua/vim/lsp/_watchfiles.lua b/runtime/lua/vim/lsp/_watchfiles.lua
index 49328fbe9b..98e9818bcd 100644
--- a/runtime/lua/vim/lsp/_watchfiles.lua
+++ b/runtime/lua/vim/lsp/_watchfiles.lua
@@ -9,8 +9,8 @@ local M = {}
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
+elseif vim.fn.executable('inotifywait') == 1 then
+ M._watchfunc = watch.inotify
else
M._watchfunc = watch.watchdirs
end
diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua
index 49833eaeec..301c1f0cb6 100644
--- a/runtime/lua/vim/lsp/buf.lua
+++ b/runtime/lua/vim/lsp/buf.lua
@@ -29,7 +29,12 @@ local function request(method, params, handler)
end
--- Displays hover information about the symbol under the cursor in a floating
---- window. Calling the function twice will jump into the floating window.
+--- window. The window will be dismissed on cursor move.
+--- Calling the function twice will jump into the floating window
+--- (thus by default, "KK" will open the hover window and focus it).
+--- In the floating window, all commands and mappings are available as usual,
+--- except that "q" dismisses the window.
+--- You can scroll the contents the same as you would any other buffer.
function M.hover()
local params = util.make_position_params()
request(ms.textDocument_hover, params)
@@ -135,7 +140,7 @@ end
---@param mode "v"|"V"
---@return table {start={row,col}, end={row,col}} using (1, 0) indexing
local function range_from_selection(bufnr, mode)
- -- TODO: Use `vim.region()` instead https://github.com/neovim/neovim/pull/13896
+ -- TODO: Use `vim.fn.getregionpos()` instead.
-- [bufnum, lnum, col, off]; both row and column 1-indexed
local start = vim.fn.getpos('v')
@@ -205,9 +210,11 @@ end
--- Range to format.
--- Table must contain `start` and `end` keys with {row,col} tuples using
--- (1,0) indexing.
+--- Can also be a list of tables that contain `start` and `end` keys as described above,
+--- in which case `textDocument/rangesFormatting` support is required.
--- (Default: current selection in visual mode, `nil` in other modes,
--- formatting the full buffer)
---- @field range? {start:integer[],end:integer[]}
+--- @field range? {start:[integer,integer],end:[integer, integer]}|{start:[integer,integer],end:[integer,integer]}[]
--- Formats a buffer using the attached (and optionally filtered) language
--- server clients.
@@ -218,10 +225,20 @@ function M.format(opts)
local bufnr = opts.bufnr or api.nvim_get_current_buf()
local mode = api.nvim_get_mode().mode
local range = opts.range
+ -- Try to use visual selection if no range is given
if not range and mode == 'v' or mode == 'V' then
range = range_from_selection(bufnr, mode)
end
- local method = range and ms.textDocument_rangeFormatting or ms.textDocument_formatting
+
+ local passed_multiple_ranges = (range and #range ~= 0 and type(range[1]) == 'table')
+ local method ---@type string
+ if passed_multiple_ranges then
+ method = ms.textDocument_rangesFormatting
+ elseif range then
+ method = ms.textDocument_rangeFormatting
+ else
+ method = ms.textDocument_formatting
+ end
local clients = vim.lsp.get_clients({
id = opts.id,
@@ -241,10 +258,14 @@ function M.format(opts)
--- @param params lsp.DocumentFormattingParams
--- @return lsp.DocumentFormattingParams
local function set_range(client, params)
- if range then
- local range_params =
- util.make_given_range_params(range.start, range['end'], bufnr, client.offset_encoding)
- params.range = range_params.range
+ local to_lsp_range = function(r) ---@return lsp.DocumentRangeFormattingParams|lsp.DocumentRangesFormattingParams
+ return util.make_given_range_params(r.start, r['end'], bufnr, client.offset_encoding).range
+ end
+
+ if passed_multiple_ranges then
+ params.ranges = vim.tbl_map(to_lsp_range, range)
+ elseif range then
+ params.range = to_lsp_range(range)
end
return params
end
@@ -431,11 +452,9 @@ function M.document_symbol(opts)
request_with_opts(ms.textDocument_documentSymbol, params, opts)
end
---- @param call_hierarchy_items lsp.CallHierarchyItem[]?
+--- @param call_hierarchy_items lsp.CallHierarchyItem[]
+--- @return lsp.CallHierarchyItem?
local function pick_call_hierarchy_item(call_hierarchy_items)
- if not call_hierarchy_items then
- return
- end
if #call_hierarchy_items == 1 then
return call_hierarchy_items[1]
end
@@ -448,7 +467,7 @@ local function pick_call_hierarchy_item(call_hierarchy_items)
if choice < 1 or choice > #items then
return
end
- return choice
+ return call_hierarchy_items[choice]
end
--- @param method string
@@ -460,7 +479,7 @@ local function call_hierarchy(method)
vim.notify(err.message, vim.log.levels.WARN)
return
end
- if not result then
+ if not result or vim.tbl_isempty(result) then
vim.notify('No item resolved', vim.log.levels.WARN)
return
end
@@ -836,14 +855,10 @@ function M.code_action(opts)
if opts.diagnostics or opts.only then
opts = { options = opts }
end
- local context = opts.context or {}
+ local context = opts.context and vim.deepcopy(opts.context) or {}
if not context.triggerKind then
context.triggerKind = vim.lsp.protocol.CodeActionTriggerKind.Invoked
end
- if not context.diagnostics then
- local bufnr = api.nvim_get_current_buf()
- context.diagnostics = vim.lsp.diagnostic.get_line_diagnostics(bufnr)
- end
local mode = api.nvim_get_mode().mode
local bufnr = api.nvim_get_current_buf()
local win = api.nvim_get_current_win()
@@ -885,7 +900,23 @@ function M.code_action(opts)
else
params = util.make_range_params(win, client.offset_encoding)
end
- params.context = context
+ if context.diagnostics then
+ params.context = context
+ else
+ local ns_push = vim.lsp.diagnostic.get_namespace(client.id, false)
+ local ns_pull = vim.lsp.diagnostic.get_namespace(client.id, true)
+ local diagnostics = {}
+ local lnum = api.nvim_win_get_cursor(0)[1] - 1
+ vim.list_extend(diagnostics, vim.diagnostic.get(bufnr, { namespace = ns_pull, lnum = lnum }))
+ vim.list_extend(diagnostics, vim.diagnostic.get(bufnr, { namespace = ns_push, lnum = lnum }))
+ params.context = vim.tbl_extend('force', context, {
+ ---@diagnostic disable-next-line: no-unknown
+ diagnostics = vim.tbl_map(function(d)
+ return d.user_data.lsp
+ end, diagnostics),
+ })
+ end
+
client.request(ms.textDocument_codeAction, params, on_result, bufnr)
end
end
diff --git a/runtime/lua/vim/lsp/client.lua b/runtime/lua/vim/lsp/client.lua
index 4beb7fefda..e3c82f4169 100644
--- a/runtime/lua/vim/lsp/client.lua
+++ b/runtime/lua/vim/lsp/client.lua
@@ -182,7 +182,7 @@ local validate = vim.validate
--- It can be `null` if the client supports workspace folders but none are
--- configured.
--- @field workspace_folders lsp.WorkspaceFolder[]?
---- @field root_dir string
+--- @field root_dir string?
---
--- @field attached_buffers table<integer,true>
---
@@ -233,11 +233,11 @@ local validate = vim.validate
---
--- 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`
+--- Returns: { err=err, result=result }, a dict, 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
+--- @field request_sync fun(method: string, params: table?, timeout_ms: integer?, bufnr: integer): {err: lsp.ResponseError|nil, result:any}|nil, string|nil err # a dict
---
--- Sends a notification to an LSP server.
--- Returns: a boolean to indicate if the notification was successful. If
@@ -436,7 +436,7 @@ local function ensure_list(x)
return { x }
end
---- @package
+--- @nodoc
--- @param config vim.lsp.ClientConfig
--- @return vim.lsp.Client?
function Client.create(config)
@@ -470,7 +470,6 @@ function Client.create(config)
_on_exit_cbs = ensure_list(config.on_exit),
_on_attach_cbs = ensure_list(config.on_attach),
_on_error_cb = config.on_error,
- _root_dir = config.root_dir,
_trace = get_trace(config.trace),
--- Contains $/progress report messages.
@@ -536,7 +535,7 @@ function Client:_run_callbacks(cbs, error_id, ...)
end
end
---- @package
+--- @nodoc
function Client:initialize()
local config = self.config
@@ -657,7 +656,7 @@ end
--- @param method string LSP method name.
--- @param params? table LSP request params.
--- @param handler? lsp.Handler Response |lsp-handler| for this method.
---- @param bufnr? integer Buffer handle (0 for current).
+--- @param bufnr integer Buffer handle (0 for current).
--- @return boolean status, integer? 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
@@ -739,7 +738,7 @@ end
--- @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
+--- @return {err: lsp.ResponseError|nil, result:any}|nil, string|nil err # a dict, 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
@@ -862,14 +861,14 @@ 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)
+--- @param on_unsupported? function handler invoked when the command is not supported by the client.
+function Client:_exec_cmd(command, context, handler, on_unsupported)
context = vim.deepcopy(context or {}, true) --[[@as lsp.HandlerContext]]
context.bufnr = context.bufnr or api.nvim_get_current_buf()
context.client_id = self.id
@@ -883,14 +882,18 @@ function Client:_exec_cmd(command, context, handler)
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
- )
+ if on_unsupported then
+ on_unsupported()
+ else
+ 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
+ )
+ end
return
end
-- Not using command directly to exclude extra properties,
@@ -902,7 +905,6 @@ function Client:_exec_cmd(command, context, handler)
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
@@ -914,18 +916,16 @@ function Client:_text_document_did_open_handler(bufnr)
if not api.nvim_buf_is_loaded(bufnr) then
return
end
- local filetype = vim.bo[bufnr].filetype
- local params = {
+ local filetype = vim.bo[bufnr].filetype
+ self.notify(ms.textDocument_didOpen, {
textDocument = {
- version = 0,
+ version = lsp.util.buf_versions[bufnr],
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()
@@ -938,7 +938,6 @@ function Client:_text_document_did_open_handler(bufnr)
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)
@@ -1061,7 +1060,6 @@ function Client:_on_exit(code, signal)
)
end
---- @package
--- Add a directory to the workspace folders.
--- @param dir string?
function Client:_add_workspace_folder(dir)
@@ -1084,7 +1082,6 @@ function Client:_add_workspace_folder(dir)
vim.list_extend(self.workspace_folders, wf)
end
---- @package
--- Remove a directory to the workspace folders.
--- @param dir string?
function Client:_remove_workspace_folder(dir)
diff --git a/runtime/lua/vim/lsp/codelens.lua b/runtime/lua/vim/lsp/codelens.lua
index c85bb6aa32..c1b6bfb28c 100644
--- a/runtime/lua/vim/lsp/codelens.lua
+++ b/runtime/lua/vim/lsp/codelens.lua
@@ -307,7 +307,13 @@ function M.refresh(opts)
}
active_refreshes[buf] = true
- local request_ids = vim.lsp.buf_request(buf, ms.textDocument_codeLens, params, M.on_codelens)
+ local request_ids = vim.lsp.buf_request(
+ buf,
+ ms.textDocument_codeLens,
+ params,
+ M.on_codelens,
+ function() end
+ )
if vim.tbl_isempty(request_ids) then
active_refreshes[buf] = nil
end
diff --git a/runtime/lua/vim/lsp/completion.lua b/runtime/lua/vim/lsp/completion.lua
new file mode 100644
index 0000000000..71ea2df100
--- /dev/null
+++ b/runtime/lua/vim/lsp/completion.lua
@@ -0,0 +1,754 @@
+local M = {}
+
+local api = vim.api
+local lsp = vim.lsp
+local protocol = lsp.protocol
+local ms = protocol.Methods
+
+local rtt_ms = 50
+local ns_to_ms = 0.000001
+
+--- @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).
+--- @nodoc
+--- @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
+
+--- @nodoc
+--- @class vim.lsp.completion.BufHandle
+--- @field clients table<integer, vim.lsp.Client>
+--- @field triggers table<string, vim.lsp.Client[]>
+--- @field convert? fun(item: lsp.CompletionItem): table
+
+--- @type table<integer, vim.lsp.completion.BufHandle>
+local buf_handles = {}
+
+--- @nodoc
+--- @class vim.lsp.completion.Context
+local Context = {
+ cursor = nil, --- @type [integer, integer]?
+ last_request_time = nil, --- @type integer?
+ pending_requests = {}, --- @type function[]
+ isIncomplete = false,
+}
+
+--- @nodoc
+function Context:cancel_pending()
+ for _, cancel in ipairs(self.pending_requests) do
+ cancel()
+ end
+
+ self.pending_requests = {}
+end
+
+--- @nodoc
+function Context:reset()
+ -- Note that the cursor isn't reset here, it needs to survive a `CompleteDone` event.
+ self.isIncomplete = false
+ self.last_request_time = nil
+ self:cancel_pending()
+end
+
+--- @type uv.uv_timer_t?
+local completion_timer = nil
+
+--- @return uv.uv_timer_t
+local function new_timer()
+ return assert(vim.uv.new_timer())
+end
+
+local function reset_timer()
+ if completion_timer then
+ completion_timer:stop()
+ completion_timer:close()
+ end
+
+ completion_timer = nil
+end
+
+--- @param window integer
+--- @param warmup integer
+--- @return fun(sample: number): number
+local function exp_avg(window, warmup)
+ local count = 0
+ local sum = 0
+ local value = 0
+
+ return function(sample)
+ if count < warmup then
+ count = count + 1
+ sum = sum + sample
+ value = sum / count
+ else
+ local factor = 2.0 / (window + 1)
+ value = value * (1 - factor) + sample * factor
+ end
+ return value
+ end
+end
+local compute_new_average = exp_avg(10, 10)
+
+--- @return number
+local function next_debounce()
+ if not Context.last_request_time then
+ return rtt_ms
+ end
+
+ local ms_since_request = (vim.uv.hrtime() - Context.last_request_time) * ns_to_ms
+ return math.max((ms_since_request - rtt_ms) * -1, 0)
+end
+
+--- @param input string Unparsed snippet
+--- @return string # Parsed snippet if successful, else returns its input
+local function parse_snippet(input)
+ local ok, parsed = pcall(function()
+ return lsp._snippet_grammar.parse(input)
+ end)
+ return ok and tostring(parsed) or input
+end
+
+--- @param item lsp.CompletionItem
+--- @param suffix? string
+local function apply_snippet(item, suffix)
+ if item.textEdit then
+ vim.snippet.expand(item.textEdit.newText .. suffix)
+ elseif item.insertText then
+ vim.snippet.expand(item.insertText .. suffix)
+ end
+end
+
+--- Returns text that should be inserted when a selecting completion item. The
+--- precedence is as follows: textEdit.newText > insertText > label
+---
+--- See https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_completion
+---
+--- @param item lsp.CompletionItem
+--- @return string
+local function get_completion_word(item)
+ if item.insertTextFormat == protocol.InsertTextFormat.Snippet then
+ if item.textEdit then
+ -- Use label instead of text if text has different starting characters.
+ -- label is used as abbr (=displayed), but word is used for filtering
+ -- This is required for things like postfix completion.
+ -- E.g. in lua:
+ --
+ -- local f = {}
+ -- f@|
+ -- â–²
+ -- └─ cursor
+ --
+ -- item.textEdit.newText: table.insert(f, $0)
+ -- label: insert
+ --
+ -- Typing `i` would remove the candidate because newText starts with `t`.
+ local text = parse_snippet(item.insertText or item.textEdit.newText)
+ return #text < #item.label and vim.fn.matchstr(text, '\\k*') or item.label
+ elseif item.insertText and item.insertText ~= '' then
+ return parse_snippet(item.insertText)
+ else
+ return item.label
+ end
+ elseif item.textEdit then
+ local word = item.textEdit.newText
+ return word:match('^(%S*)') or word
+ elseif item.insertText and item.insertText ~= '' then
+ return item.insertText
+ end
+ return item.label
+end
+
+--- 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 or item.label
+ 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
+ -- When we have a list, apply the defaults and return an array of items.
+ for _, item in ipairs(result.items) do
+ ---@diagnostic disable-next-line: param-type-mismatch
+ apply_defaults(item, result.itemDefaults)
+ end
+ return result.items
+ else
+ -- Else just return the items as they are.
+ return result
+ end
+end
+
+---@param item lsp.CompletionItem
+---@return string
+local function get_doc(item)
+ local doc = item.documentation
+ if not doc then
+ return ''
+ end
+ if type(doc) == 'string' then
+ return doc
+ end
+ if type(doc) == 'table' and type(doc.value) == 'string' then
+ return doc.value
+ end
+
+ vim.notify('invalid documentation value: ' .. vim.inspect(doc), vim.log.levels.WARN)
+ return ''
+end
+
+--- Turns the result of a `textDocument/completion` request into vim-compatible
+--- |complete-items|.
+---
+--- @private
+--- @param result vim.lsp.CompletionResult Result of `textDocument/completion`
+--- @param prefix string prefix to filter the completion items
+--- @param client_id integer? Client ID
+--- @return table[]
+--- @see complete-items
+function M._lsp_to_complete_items(result, prefix, client_id)
+ local items = get_items(result)
+ if vim.tbl_isempty(items) then
+ return {}
+ end
+
+ ---@type fun(item: lsp.CompletionItem):boolean
+ local matches
+ if not prefix:find('%w') then
+ matches = function(_)
+ return true
+ end
+ else
+ ---@param item lsp.CompletionItem
+ matches = function(item)
+ local text = item.filterText or item.label
+ return next(vim.fn.matchfuzzy({ text }, prefix)) ~= nil
+ end
+ end
+
+ local candidates = {}
+ local bufnr = api.nvim_get_current_buf()
+ local user_convert = vim.tbl_get(buf_handles, bufnr, 'convert')
+ for _, item in ipairs(items) do
+ if matches(item) then
+ local word = get_completion_word(item)
+ local hl_group = ''
+ if
+ item.deprecated
+ or vim.list_contains((item.tags or {}), protocol.CompletionTag.Deprecated)
+ then
+ hl_group = 'DiagnosticDeprecated'
+ end
+ local completion_item = {
+ word = word,
+ abbr = item.label,
+ kind = protocol.CompletionItemKind[item.kind] or 'Unknown',
+ menu = item.detail or '',
+ info = get_doc(item),
+ icase = 1,
+ dup = 1,
+ empty = 1,
+ hl_group = hl_group,
+ user_data = {
+ nvim = {
+ lsp = {
+ completion_item = item,
+ client_id = client_id,
+ },
+ },
+ },
+ }
+ if user_convert then
+ completion_item = vim.tbl_extend('keep', user_convert(item), completion_item)
+ end
+ table.insert(candidates, completion_item)
+ end
+ end
+ ---@diagnostic disable-next-line: no-unknown
+ table.sort(candidates, function(a, b)
+ ---@type lsp.CompletionItem
+ local itema = a.user_data.nvim.lsp.completion_item
+ ---@type lsp.CompletionItem
+ local itemb = b.user_data.nvim.lsp.completion_item
+ return (itema.sortText or itema.label) < (itemb.sortText or itemb.label)
+ end)
+
+ return candidates
+end
+
+--- @param lnum integer 0-indexed
+--- @param line string
+--- @param items lsp.CompletionItem[]
+--- @param encoding string
+--- @return integer?
+local function adjust_start_col(lnum, line, items, encoding)
+ local min_start_char = nil
+ for _, item in pairs(items) do
+ if item.textEdit and item.textEdit.range.start.line == lnum then
+ if min_start_char and min_start_char ~= item.textEdit.range.start.character then
+ return nil
+ end
+ min_start_char = item.textEdit.range.start.character
+ end
+ end
+ if min_start_char then
+ return lsp.util._str_byteindex_enc(line, min_start_char, encoding)
+ else
+ return nil
+ end
+end
+
+--- @private
+--- @param line string line content
+--- @param lnum integer 0-indexed line number
+--- @param cursor_col integer
+--- @param client_id integer client ID
+--- @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 vim.lsp.CompletionResult
+--- @param encoding string
+--- @return table[] matches
+--- @return integer? server_start_boundary
+function M._convert_results(
+ line,
+ lnum,
+ cursor_col,
+ client_id,
+ client_start_boundary,
+ server_start_boundary,
+ result,
+ encoding
+)
+ -- Completion response items may be relative to a position different than `client_start_boundary`.
+ -- Concrete example, with lua-language-server:
+ --
+ -- require('plenary.asy|
+ -- â–² â–² â–²
+ -- │ │ └── cursor_pos: 20
+ -- │ └────── client_start_boundary: 17
+ -- └────────────── textEdit.range.start.character: 9
+ -- .newText = 'plenary.async'
+ -- ^^^
+ -- prefix (We'd remove everything not starting with `asy`,
+ -- so we'd eliminate the `plenary.async` result
+ --
+ -- `adjust_start_col` is used to prefer the language server boundary.
+ --
+ local candidates = get_items(result)
+ local curstartbyte = adjust_start_col(lnum, line, candidates, encoding)
+ if server_start_boundary == nil then
+ server_start_boundary = curstartbyte
+ elseif curstartbyte ~= nil and curstartbyte ~= server_start_boundary then
+ server_start_boundary = client_start_boundary
+ end
+ local prefix = line:sub((server_start_boundary or client_start_boundary) + 1, cursor_col)
+ local matches = M._lsp_to_complete_items(result, prefix, client_id)
+ return matches, server_start_boundary
+end
+
+--- @param clients table<integer, vim.lsp.Client> # keys != client_id
+--- @param bufnr integer
+--- @param win integer
+--- @param callback fun(responses: table<integer, { err: lsp.ResponseError, result: vim.lsp.CompletionResult }>)
+--- @return function # Cancellation function
+local function request(clients, bufnr, win, callback)
+ local responses = {} --- @type table<integer, { err: lsp.ResponseError, result: any }>
+ local request_ids = {} --- @type table<integer, integer>
+ local remaining_requests = vim.tbl_count(clients)
+
+ for _, client in pairs(clients) do
+ local client_id = client.id
+ local params = lsp.util.make_position_params(win, client.offset_encoding)
+ local ok, request_id = client.request(ms.textDocument_completion, params, function(err, result)
+ responses[client_id] = { err = err, result = result }
+ remaining_requests = remaining_requests - 1
+ if remaining_requests == 0 then
+ callback(responses)
+ end
+ end, bufnr)
+
+ if ok then
+ request_ids[client_id] = request_id
+ end
+ end
+
+ return function()
+ for client_id, request_id in pairs(request_ids) do
+ local client = lsp.get_client_by_id(client_id)
+ if client then
+ client.cancel_request(request_id)
+ end
+ end
+ end
+end
+
+local function trigger(bufnr, clients)
+ reset_timer()
+ Context:cancel_pending()
+
+ if tonumber(vim.fn.pumvisible()) == 1 and not Context.isIncomplete then
+ return
+ end
+
+ local win = api.nvim_get_current_win()
+ local cursor_row, cursor_col = unpack(api.nvim_win_get_cursor(win)) --- @type integer, integer
+ local line = api.nvim_get_current_line()
+ local line_to_cursor = line:sub(1, cursor_col)
+ local word_boundary = vim.fn.match(line_to_cursor, '\\k*$')
+ local start_time = vim.uv.hrtime()
+ Context.last_request_time = start_time
+
+ local cancel_request = request(clients, bufnr, win, function(responses)
+ local end_time = vim.uv.hrtime()
+ rtt_ms = compute_new_average((end_time - start_time) * ns_to_ms)
+
+ Context.pending_requests = {}
+ Context.isIncomplete = false
+
+ local row_changed = api.nvim_win_get_cursor(win)[1] ~= cursor_row
+ local mode = api.nvim_get_mode().mode
+ if row_changed or not (mode == 'i' or mode == 'ic') then
+ return
+ end
+
+ local matches = {}
+ local server_start_boundary --- @type integer?
+ for client_id, response in pairs(responses) do
+ if response.err then
+ vim.notify_once(response.err.message, vim.log.levels.warn)
+ end
+
+ local result = response.result
+ if result then
+ Context.isIncomplete = Context.isIncomplete or result.isIncomplete
+ local client = lsp.get_client_by_id(client_id)
+ local encoding = client and client.offset_encoding or 'utf-16'
+ local client_matches
+ client_matches, server_start_boundary = M._convert_results(
+ line,
+ cursor_row - 1,
+ cursor_col,
+ client_id,
+ word_boundary,
+ nil,
+ result,
+ encoding
+ )
+ vim.list_extend(matches, client_matches)
+ end
+ end
+ local start_col = (server_start_boundary or word_boundary) + 1
+ vim.fn.complete(start_col, matches)
+ end)
+
+ table.insert(Context.pending_requests, cancel_request)
+end
+
+--- @param handle vim.lsp.completion.BufHandle
+local function on_insert_char_pre(handle)
+ if tonumber(vim.fn.pumvisible()) == 1 then
+ if Context.isIncomplete then
+ reset_timer()
+
+ local debounce_ms = next_debounce()
+ if debounce_ms == 0 then
+ vim.schedule(M.trigger)
+ else
+ completion_timer = new_timer()
+ completion_timer:start(debounce_ms, 0, vim.schedule_wrap(M.trigger))
+ end
+ end
+
+ return
+ end
+
+ local char = api.nvim_get_vvar('char')
+ if not completion_timer and handle.triggers[char] then
+ completion_timer = assert(vim.uv.new_timer())
+ completion_timer:start(25, 0, function()
+ reset_timer()
+ vim.schedule(M.trigger)
+ end)
+ end
+end
+
+local function on_insert_leave()
+ reset_timer()
+ Context.cursor = nil
+ Context:reset()
+end
+
+local function on_complete_done()
+ local completed_item = api.nvim_get_vvar('completed_item')
+ if not completed_item or not completed_item.user_data or not completed_item.user_data.nvim then
+ Context:reset()
+ return
+ end
+
+ local cursor_row, cursor_col = unpack(api.nvim_win_get_cursor(0)) --- @type integer, integer
+ cursor_row = cursor_row - 1
+ local completion_item = completed_item.user_data.nvim.lsp.completion_item --- @type lsp.CompletionItem
+ local client_id = completed_item.user_data.nvim.lsp.client_id --- @type integer
+ if not completion_item or not client_id then
+ Context:reset()
+ return
+ end
+
+ local bufnr = api.nvim_get_current_buf()
+ local expand_snippet = completion_item.insertTextFormat == protocol.InsertTextFormat.Snippet
+ and (completion_item.textEdit ~= nil or completion_item.insertText ~= nil)
+
+ Context:reset()
+
+ local client = lsp.get_client_by_id(client_id)
+ if not client then
+ return
+ end
+
+ local offset_encoding = client.offset_encoding or 'utf-16'
+ local resolve_provider = (client.server_capabilities.completionProvider or {}).resolveProvider
+
+ local function clear_word()
+ if not expand_snippet then
+ return nil
+ end
+
+ -- Remove the already inserted word.
+ local start_char = cursor_col - #completed_item.word
+ local line = api.nvim_buf_get_lines(bufnr, cursor_row, cursor_row + 1, true)[1]
+ api.nvim_buf_set_text(bufnr, cursor_row, start_char, cursor_row, #line, { '' })
+ return line:sub(cursor_col + 1)
+ end
+
+ --- @param suffix? string
+ local function apply_snippet_and_command(suffix)
+ if expand_snippet then
+ apply_snippet(completion_item, suffix)
+ end
+
+ local command = completion_item.command
+ if command then
+ client:_exec_cmd(command, { bufnr = bufnr }, nil, function()
+ vim.lsp.log.warn(
+ string.format(
+ 'Language server `%s` does not support command `%s`. This command may require a client extension.',
+ client.name,
+ command.command
+ )
+ )
+ end)
+ end
+ end
+
+ if completion_item.additionalTextEdits and next(completion_item.additionalTextEdits) then
+ local suffix = clear_word()
+ lsp.util.apply_text_edits(completion_item.additionalTextEdits, bufnr, offset_encoding)
+ apply_snippet_and_command(suffix)
+ elseif resolve_provider and type(completion_item) == 'table' then
+ local changedtick = vim.b[bufnr].changedtick
+
+ --- @param result lsp.CompletionItem
+ client.request(ms.completionItem_resolve, completion_item, function(err, result)
+ if changedtick ~= vim.b[bufnr].changedtick then
+ return
+ end
+
+ local suffix = clear_word()
+ if err then
+ vim.notify_once(err.message, vim.log.levels.WARN)
+ elseif result and result.additionalTextEdits then
+ lsp.util.apply_text_edits(result.additionalTextEdits, bufnr, offset_encoding)
+ if result.command then
+ completion_item.command = result.command
+ end
+ end
+
+ apply_snippet_and_command(suffix)
+ end, bufnr)
+ else
+ local suffix = clear_word()
+ apply_snippet_and_command(suffix)
+ end
+end
+
+--- @class vim.lsp.completion.BufferOpts
+--- @field autotrigger? boolean Whether to trigger completion automatically. Default: false
+--- @field convert? fun(item: lsp.CompletionItem): table Transforms an LSP CompletionItem to |complete-items|.
+
+---@param client_id integer
+---@param bufnr integer
+---@param opts vim.lsp.completion.BufferOpts
+local function enable_completions(client_id, bufnr, opts)
+ local buf_handle = buf_handles[bufnr]
+ if not buf_handle then
+ buf_handle = { clients = {}, triggers = {}, convert = opts.convert }
+ buf_handles[bufnr] = buf_handle
+
+ -- Attach to buffer events.
+ api.nvim_buf_attach(bufnr, false, {
+ on_detach = function(_, buf)
+ buf_handles[buf] = nil
+ end,
+ on_reload = function(_, buf)
+ M.enable(true, client_id, buf, opts)
+ end,
+ })
+
+ -- Set up autocommands.
+ local group =
+ api.nvim_create_augroup(string.format('vim/lsp/completion-%d', bufnr), { clear = true })
+ api.nvim_create_autocmd('CompleteDone', {
+ group = group,
+ buffer = bufnr,
+ callback = function()
+ local reason = api.nvim_get_vvar('event').reason --- @type string
+ if reason == 'accept' then
+ on_complete_done()
+ end
+ end,
+ })
+ if opts.autotrigger then
+ api.nvim_create_autocmd('InsertCharPre', {
+ group = group,
+ buffer = bufnr,
+ callback = function()
+ on_insert_char_pre(buf_handles[bufnr])
+ end,
+ })
+ api.nvim_create_autocmd('InsertLeave', {
+ group = group,
+ buffer = bufnr,
+ callback = on_insert_leave,
+ })
+ end
+ end
+
+ if not buf_handle.clients[client_id] then
+ local client = lsp.get_client_by_id(client_id)
+ assert(client, 'invalid client ID')
+
+ -- Add the new client to the buffer's clients.
+ buf_handle.clients[client_id] = client
+
+ -- Add the new client to the clients that should be triggered by its trigger characters.
+ --- @type string[]
+ local triggers = vim.tbl_get(
+ client.server_capabilities,
+ 'completionProvider',
+ 'triggerCharacters'
+ ) or {}
+ for _, char in ipairs(triggers) do
+ local clients_for_trigger = buf_handle.triggers[char]
+ if not clients_for_trigger then
+ clients_for_trigger = {}
+ buf_handle.triggers[char] = clients_for_trigger
+ end
+ local client_exists = vim.iter(clients_for_trigger):any(function(c)
+ return c.id == client_id
+ end)
+ if not client_exists then
+ table.insert(clients_for_trigger, client)
+ end
+ end
+ end
+end
+
+--- @param client_id integer
+--- @param bufnr integer
+local function disable_completions(client_id, bufnr)
+ local handle = buf_handles[bufnr]
+ if not handle then
+ return
+ end
+
+ handle.clients[client_id] = nil
+ if not next(handle.clients) then
+ buf_handles[bufnr] = nil
+ api.nvim_del_augroup_by_name(string.format('vim/lsp/completion-%d', bufnr))
+ else
+ for char, clients in pairs(handle.triggers) do
+ --- @param c vim.lsp.Client
+ handle.triggers[char] = vim.tbl_filter(function(c)
+ return c.id ~= client_id
+ end, clients)
+ end
+ end
+end
+
+--- Enables or disables completions from the given language client in the given buffer.
+---
+--- @param enable boolean True to enable, false to disable
+--- @param client_id integer Client ID
+--- @param bufnr integer Buffer handle, or 0 for the current buffer
+--- @param opts? vim.lsp.completion.BufferOpts
+function M.enable(enable, client_id, bufnr, opts)
+ bufnr = (bufnr == 0 and api.nvim_get_current_buf()) or bufnr
+
+ if enable then
+ enable_completions(client_id, bufnr, opts or {})
+ else
+ disable_completions(client_id, bufnr)
+ end
+end
+
+--- Trigger LSP completion in the current buffer.
+function M.trigger()
+ local bufnr = api.nvim_get_current_buf()
+ local clients = (buf_handles[bufnr] or {}).clients or {}
+ trigger(bufnr, clients)
+end
+
+--- Implements 'omnifunc' compatible LSP completion.
+---
+--- @see |complete-functions|
+--- @see |complete-items|
+--- @see |CompleteDone|
+---
+--- @param findstart integer 0 or 1, decides behavior
+--- @param base integer findstart=0, text to match against
+---
+--- @return 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()|)
+function M._omnifunc(findstart, base)
+ vim.lsp.log.debug('omnifunc.findstart', { findstart = findstart, base = base })
+ assert(base) -- silence luals
+ local bufnr = api.nvim_get_current_buf()
+ local clients = lsp.get_clients({ bufnr = bufnr, method = ms.textDocument_completion })
+ local remaining = #clients
+ if remaining == 0 then
+ return findstart == 1 and -1 or {}
+ end
+
+ trigger(bufnr, clients)
+
+ -- Return -2 to signal that we should continue completion so that we can
+ -- async complete.
+ return -2
+end
+
+return M
diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua
index 08cea13548..c10312484b 100644
--- a/runtime/lua/vim/lsp/diagnostic.lua
+++ b/runtime/lua/vim/lsp/diagnostic.lua
@@ -110,6 +110,14 @@ local function diagnostic_lsp_to_vim(diagnostics, bufnr, client_id)
return vim.tbl_map(function(diagnostic)
local start = diagnostic.range.start
local _end = diagnostic.range['end']
+ local message = diagnostic.message
+ if type(message) ~= 'string' then
+ vim.notify_once(
+ string.format('Unsupported Markup message from LSP client %d', client_id),
+ vim.lsp.log_levels.ERROR
+ )
+ message = diagnostic.message.value
+ end
--- @type vim.Diagnostic
return {
lnum = start.line,
@@ -117,18 +125,12 @@ local function diagnostic_lsp_to_vim(diagnostics, bufnr, client_id)
end_lnum = _end.line,
end_col = line_byte_from_position(buf_lines, _end.line, _end.character, offset_encoding),
severity = severity_lsp_to_vim(diagnostic.severity),
- message = diagnostic.message,
+ message = message,
source = diagnostic.source,
code = diagnostic.code,
_tags = tags_lsp_to_vim(diagnostic, client_id),
user_data = {
- lsp = {
- -- usage of user_data.lsp.code is deprecated in favor of the top-level code field
- code = diagnostic.code,
- codeDescription = diagnostic.codeDescription,
- relatedInformation = diagnostic.relatedInformation,
- data = diagnostic.data,
- },
+ lsp = diagnostic,
},
}
end, diagnostics)
@@ -151,14 +153,18 @@ local function tags_vim_to_lsp(diagnostic)
return tags
end
+--- Converts the input `vim.Diagnostic`s to LSP diagnostics.
--- @param diagnostics vim.Diagnostic[]
--- @return lsp.Diagnostic[]
-local function diagnostic_vim_to_lsp(diagnostics)
+function M.from(diagnostics)
---@param diagnostic vim.Diagnostic
---@return lsp.Diagnostic
return vim.tbl_map(function(diagnostic)
- return vim.tbl_extend('keep', {
- -- "keep" the below fields over any duplicate fields in diagnostic.user_data.lsp
+ local user_data = diagnostic.user_data or {}
+ if user_data.lsp then
+ return user_data.lsp
+ end
+ return {
range = {
start = {
line = diagnostic.lnum,
@@ -174,7 +180,7 @@ local function diagnostic_vim_to_lsp(diagnostics)
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
@@ -366,6 +372,7 @@ end
--- Structured: { [1] = {...}, [5] = {.... } }
---@private
function M.get_line_diagnostics(bufnr, line_nr, opts, client_id)
+ vim.deprecate('vim.lsp.diagnostic.get_line_diagnostics', 'vim.diagnostic.get', '0.12')
convert_severity(opts)
local diag_opts = {} --- @type vim.diagnostic.GetOpts
@@ -379,7 +386,7 @@ function M.get_line_diagnostics(bufnr, line_nr, opts, client_id)
diag_opts.lnum = line_nr or (api.nvim_win_get_cursor(0)[1] - 1)
- return diagnostic_vim_to_lsp(vim.diagnostic.get(bufnr, diag_opts))
+ return M.from(vim.diagnostic.get(bufnr, diag_opts))
end
--- Clear diagnostics from pull based clients
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index f9d394642c..44548fec92 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -3,7 +3,7 @@ local protocol = require('vim.lsp.protocol')
local ms = protocol.Methods
local util = require('vim.lsp.util')
local api = vim.api
-local completion = require('vim.lsp._completion')
+local completion = require('vim.lsp.completion')
--- @type table<string,lsp.Handler>
local M = {}
@@ -646,6 +646,7 @@ M[ms.window_showMessage] = function(_, result, ctx, _)
if message_type == protocol.MessageType.Error then
err_message('LSP[', client_name, '] ', message)
else
+ --- @type string
local message_type_name = protocol.MessageType[message_type]
api.nvim_out_write(string.format('LSP[%s][%s] %s\n', client_name, message_type_name, message))
end
diff --git a/runtime/lua/vim/lsp/health.lua b/runtime/lua/vim/lsp/health.lua
index a79ae76eb9..18066a84db 100644
--- a/runtime/lua/vim/lsp/health.lua
+++ b/runtime/lua/vim/lsp/health.lua
@@ -33,16 +33,25 @@ local function check_active_clients()
local clients = vim.lsp.get_clients()
if next(clients) then
for _, client in pairs(clients) do
- local attached_to = table.concat(vim.tbl_keys(client.attached_buffers or {}), ',')
- report_info(
+ local cmd ---@type string
+ if type(client.config.cmd) == 'table' then
+ cmd = table.concat(client.config.cmd --[[@as table]], ' ')
+ elseif type(client.config.cmd) == 'function' then
+ cmd = tostring(client.config.cmd)
+ end
+ report_info(table.concat({
+ string.format('%s (id: %d)', client.name, client.id),
string.format(
- '%s (id=%s, root_dir=%s, attached_to=[%s])',
- client.name,
- client.id,
- vim.fn.fnamemodify(client.root_dir, ':~'),
- attached_to
- )
- )
+ ' Root directory: %s',
+ client.root_dir and vim.fn.fnamemodify(client.root_dir, ':~') or nil
+ ),
+ string.format(' Command: %s', cmd),
+ string.format(' Settings: %s', vim.inspect(client.settings, { newline = '\n ' })),
+ string.format(
+ ' Attached buffers: %s',
+ vim.iter(pairs(client.attached_buffers)):map(tostring):join(', ')
+ ),
+ }, '\n'))
end
else
report_info('No active clients')
@@ -50,7 +59,7 @@ local function check_active_clients()
end
local function check_watcher()
- vim.health.start('vim.lsp: File watcher')
+ vim.health.start('vim.lsp: File Watcher')
-- Only run the check if file watching has been enabled by a client.
local clients = vim.lsp.get_clients()
@@ -81,8 +90,8 @@ local function check_watcher()
watchfunc_name = 'libuv-watch'
elseif watchfunc == vim._watch.watchdirs then
watchfunc_name = 'libuv-watchdirs'
- elseif watchfunc == vim._watch.fswatch then
- watchfunc_name = 'fswatch'
+ elseif watchfunc == vim._watch.inotifywait then
+ watchfunc_name = 'inotifywait'
else
local nm = debug.getinfo(watchfunc, 'S').source
watchfunc_name = string.format('Custom (%s)', nm)
@@ -90,7 +99,63 @@ local function check_watcher()
report_info('File watch backend: ' .. watchfunc_name)
if watchfunc_name == 'libuv-watchdirs' then
- report_warn('libuv-watchdirs has known performance issues. Consider installing fswatch.')
+ report_warn('libuv-watchdirs has known performance issues. Consider installing inotify-tools.')
+ end
+end
+
+local function check_position_encodings()
+ vim.health.start('vim.lsp: Position Encodings')
+ local clients = vim.lsp.get_clients()
+ if next(clients) then
+ local position_encodings = {} ---@type table<integer, table<string, integer[]>>
+ for _, client in pairs(clients) do
+ for bufnr in pairs(client.attached_buffers) do
+ if not position_encodings[bufnr] then
+ position_encodings[bufnr] = {}
+ end
+ if not position_encodings[bufnr][client.offset_encoding] then
+ position_encodings[bufnr][client.offset_encoding] = {}
+ end
+ table.insert(position_encodings[bufnr][client.offset_encoding], client.id)
+ end
+ end
+
+ -- Check if any buffers are attached to multiple clients with different position encodings
+ local buffers = {} ---@type integer[]
+ for bufnr, encodings in pairs(position_encodings) do
+ local list = {} ---@type string[]
+ for k in pairs(encodings) do
+ list[#list + 1] = k
+ end
+
+ if #list > 1 then
+ buffers[#buffers + 1] = bufnr
+ end
+ end
+
+ if #buffers > 0 then
+ local lines =
+ { 'Found buffers attached to multiple clients with different position encodings.' }
+ for _, bufnr in ipairs(buffers) do
+ local encodings = position_encodings[bufnr]
+ local parts = {}
+ for encoding, client_ids in pairs(encodings) do
+ table.insert(
+ parts,
+ string.format('%s (client id(s): %s)', encoding:upper(), table.concat(client_ids, ', '))
+ )
+ end
+ table.insert(lines, string.format('- Buffer %d: %s', bufnr, table.concat(parts, ', ')))
+ end
+ report_warn(
+ table.concat(lines, '\n'),
+ 'Use the positionEncodings client capability to ensure all clients use the same position encoding'
+ )
+ else
+ report_info('No buffers contain mixed position encodings')
+ end
+ else
+ report_info('No active clients')
end
end
@@ -99,6 +164,7 @@ function M.check()
check_log()
check_active_clients()
check_watcher()
+ check_position_encodings()
end
return M
diff --git a/runtime/lua/vim/lsp/inlay_hint.lua b/runtime/lua/vim/lsp/inlay_hint.lua
index f98496456b..61059180fe 100644
--- a/runtime/lua/vim/lsp/inlay_hint.lua
+++ b/runtime/lua/vim/lsp/inlay_hint.lua
@@ -43,17 +43,16 @@ function M.on_inlayhint(err, result, ctx, _)
return
end
local bufnr = assert(ctx.bufnr)
- if util.buf_versions[bufnr] ~= ctx.version then
+ if
+ util.buf_versions[bufnr] ~= ctx.version
+ or not result
+ or not api.nvim_buf_is_loaded(bufnr)
+ or not bufstates[bufnr].enabled
+ then
return
end
local client_id = ctx.client_id
- if not result then
- return
- end
local bufstate = bufstates[bufnr]
- if not bufstate.enabled then
- return
- end
if not (bufstate.client_hints and bufstate.version) then
bufstate.client_hints = vim.defaulttable()
bufstate.version = ctx.version
@@ -77,12 +76,7 @@ function M.on_inlayhint(err, result, ctx, _)
local col = position.character
if col > 0 then
local line = lines[position.line + 1] or ''
- local ok, convert_result
- ok, convert_result = pcall(util._str_byteindex_enc, line, col, client.offset_encoding)
- if ok then
- return convert_result
- end
- return math.min(#line, col)
+ return util._str_byteindex_enc(line, col, client.offset_encoding)
end
return col
end
@@ -336,6 +330,8 @@ api.nvim_set_decoration_provider(namespace, {
for lnum = topline, botline do
if bufstate.applied[lnum] ~= bufstate.version then
api.nvim_buf_clear_namespace(bufnr, namespace, lnum, lnum + 1)
+
+ local hint_virtual_texts = {} --- @type table<integer, [string, string?][]>
for _, lnum_hints in pairs(client_hints) do
local hints = lnum_hints[lnum] or {}
for _, hint in pairs(hints) do
@@ -348,7 +344,7 @@ api.nvim_set_decoration_provider(namespace, {
text = text .. part.value
end
end
- local vt = {} --- @type {[1]: string, [2]: string?}[]
+ local vt = hint_virtual_texts[hint.position.character] or {}
if hint.paddingLeft then
vt[#vt + 1] = { ' ' }
end
@@ -356,13 +352,18 @@ api.nvim_set_decoration_provider(namespace, {
if hint.paddingRight then
vt[#vt + 1] = { ' ' }
end
- api.nvim_buf_set_extmark(bufnr, namespace, lnum, hint.position.character, {
- virt_text_pos = 'inline',
- ephemeral = false,
- virt_text = vt,
- })
+ hint_virtual_texts[hint.position.character] = vt
end
end
+
+ for pos, vt in pairs(hint_virtual_texts) do
+ api.nvim_buf_set_extmark(bufnr, namespace, lnum, pos, {
+ virt_text_pos = 'inline',
+ ephemeral = false,
+ virt_text = vt,
+ })
+ end
+
bufstate.applied[lnum] = bufstate.version
end
end
@@ -370,7 +371,7 @@ api.nvim_set_decoration_provider(namespace, {
})
--- Query whether inlay hint is enabled in the {filter}ed scope
---- @param filter vim.lsp.inlay_hint.enable.Filter
+--- @param filter? vim.lsp.inlay_hint.enable.Filter
--- @return boolean
--- @since 12
function M.is_enabled(filter)
diff --git a/runtime/lua/vim/lsp/log.lua b/runtime/lua/vim/lsp/log.lua
index 9f2bd71158..4f177b47fd 100644
--- a/runtime/lua/vim/lsp/log.lua
+++ b/runtime/lua/vim/lsp/log.lua
@@ -9,7 +9,7 @@ local log_levels = vim.log.levels
--- 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>
+--- @type table<string,integer> | table<integer, string>
--- @nodoc
log.levels = vim.deepcopy(log_levels)
@@ -19,7 +19,7 @@ local current_log_level = log_levels.WARN
local log_date_format = '%F %H:%M:%S'
local function format_func(arg)
- return vim.inspect(arg, { newline = '' })
+ return vim.inspect(arg, { newline = ' ', indent = '' })
end
local function notify(msg, level)
diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua
index 419c2ff644..1699fff0c1 100644
--- a/runtime/lua/vim/lsp/protocol.lua
+++ b/runtime/lua/vim/lsp/protocol.lua
@@ -12,9 +12,6 @@ end
local sysname = vim.uv.os_uname().sysname
--- Protocol for the Microsoft Language Server Protocol (mslsp)
-local protocol = {}
-
local constants = {
--- @enum lsp.DiagnosticSeverity
DiagnosticSeverity = {
@@ -46,6 +43,8 @@ local constants = {
Info = 3,
-- A log message.
Log = 4,
+ -- A debug message.
+ Debug = 5,
},
-- The file event type.
@@ -100,6 +99,13 @@ local constants = {
TriggerForIncompleteCompletions = 3,
},
+ -- Completion item tags are extra annotations that tweak the rendering of a
+ -- completion item
+ CompletionTag = {
+ -- Render a completion as obsolete, usually using a strike-out.
+ Deprecated = 1,
+ },
+
-- A document highlight kind.
DocumentHighlightKind = {
-- A textual occurrence.
@@ -308,326 +314,18 @@ local constants = {
},
}
-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
+-- Protocol for the Microsoft Language Server Protocol (mslsp)
+local protocol = {}
+
+--- @diagnostic disable:no-unknown
+for k1, v1 in pairs(vim.deepcopy(constants, true)) do
+ for _, k2 in ipairs(vim.tbl_keys(v1)) do
+ local v2 = v1[k2]
+ v1[v2] = k2
end
- protocol[k1] = tbl
+ protocol[k1] = v1
end
-
---[=[
---Text document specific client capabilities.
-export interface TextDocumentClientCapabilities {
- synchronization?: {
- --Whether text document synchronization supports dynamic registration.
- dynamicRegistration?: boolean;
- --The client supports sending will save notifications.
- 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.
- willSaveWaitUntil?: boolean;
- --The client supports did save notifications.
- didSave?: boolean;
- }
- --Capabilities specific to the `textDocument/completion`
- completion?: {
- --Whether completion supports dynamic registration.
- dynamicRegistration?: boolean;
- --The client supports the following `CompletionItem` specific
- --capabilities.
- completionItem?: {
- --The client supports snippets as insert text.
- --
- --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. Placeholders with equal identifiers are linked,
- --that is typing in one will update others too.
- snippetSupport?: boolean;
- --The client supports commit characters on a completion item.
- commitCharactersSupport?: boolean
- --The client supports the following content formats for the documentation
- --property. The order describes the preferred format of the client.
- documentationFormat?: MarkupKind[];
- --The client supports the deprecated property on a completion item.
- deprecatedSupport?: boolean;
- --The client supports the preselect property on a completion item.
- preselectSupport?: boolean;
- }
- 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
- --to a default value when unknown.
- --
- --If this property is not present the client only supports
- --the completion items kinds from `Text` to `Reference` as defined in
- --the initial version of the protocol.
- valueSet?: CompletionItemKind[];
- },
- --The client supports to send additional context information for a
- --`textDocument/completion` request.
- contextSupport?: boolean;
- };
- --Capabilities specific to the `textDocument/hover`
- hover?: {
- --Whether hover supports dynamic registration.
- dynamicRegistration?: boolean;
- --The client supports the follow content formats for the content
- --property. The order describes the preferred format of the client.
- contentFormat?: MarkupKind[];
- };
- --Capabilities specific to the `textDocument/signatureHelp`
- signatureHelp?: {
- --Whether signature help supports dynamic registration.
- dynamicRegistration?: boolean;
- --The client supports the following `SignatureInformation`
- --specific properties.
- signatureInformation?: {
- --The client supports the follow content formats for the documentation
- --property. The order describes the preferred format of the client.
- documentationFormat?: MarkupKind[];
- --Client capabilities specific to parameter information.
- parameterInformation?: {
- --The client supports processing label offsets instead of a
- --simple label string.
- --
- --Since 3.14.0
- labelOffsetSupport?: boolean;
- }
- };
- };
- --Capabilities specific to the `textDocument/references`
- references?: {
- --Whether references supports dynamic registration.
- dynamicRegistration?: boolean;
- };
- --Capabilities specific to the `textDocument/documentHighlight`
- documentHighlight?: {
- --Whether document highlight supports dynamic registration.
- dynamicRegistration?: boolean;
- };
- --Capabilities specific to the `textDocument/documentSymbol`
- documentSymbol?: {
- --Whether document symbol supports dynamic registration.
- dynamicRegistration?: boolean;
- --Specific capabilities for the `SymbolKind`.
- 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
- --to a default value when unknown.
- --
- --If this property is not present the client only supports
- --the symbol kinds from `File` to `Array` as defined in
- --the initial version of the protocol.
- valueSet?: SymbolKind[];
- }
- --The client supports hierarchical document symbols.
- hierarchicalDocumentSymbolSupport?: boolean;
- };
- --Capabilities specific to the `textDocument/formatting`
- formatting?: {
- --Whether formatting supports dynamic registration.
- dynamicRegistration?: boolean;
- };
- --Capabilities specific to the `textDocument/rangeFormatting`
- rangeFormatting?: {
- --Whether range formatting supports dynamic registration.
- dynamicRegistration?: boolean;
- };
- --Capabilities specific to the `textDocument/onTypeFormatting`
- onTypeFormatting?: {
- --Whether on type formatting supports dynamic registration.
- dynamicRegistration?: boolean;
- };
- --Capabilities specific to the `textDocument/declaration`
- declaration?: {
- --Whether declaration 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.
- dynamicRegistration?: boolean;
- --The client supports additional metadata in the form of declaration links.
- --
- --Since 3.14.0
- linkSupport?: boolean;
- };
- --Capabilities specific to the `textDocument/definition`.
- --
- --Since 3.14.0
- definition?: {
- --Whether definition supports dynamic registration.
- dynamicRegistration?: boolean;
- --The client supports additional metadata in the form of definition links.
- linkSupport?: boolean;
- };
- --Capabilities specific to the `textDocument/typeDefinition`
- --
- --Since 3.6.0
- typeDefinition?: {
- --Whether typeDefinition 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.
- dynamicRegistration?: boolean;
- --The client supports additional metadata in the form of definition links.
- --
- --Since 3.14.0
- linkSupport?: boolean;
- };
- --Capabilities specific to the `textDocument/implementation`.
- --
- --Since 3.6.0
- implementation?: {
- --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.
- dynamicRegistration?: boolean;
- --The client supports additional metadata in the form of definition links.
- --
- --Since 3.14.0
- linkSupport?: boolean;
- };
- --Capabilities specific to the `textDocument/codeAction`
- codeAction?: {
- --Whether code action supports dynamic registration.
- dynamicRegistration?: boolean;
- --The client support code action literals as a valid
- --response of the `textDocument/codeAction` request.
- --
- --Since 3.8.0
- codeActionLiteralSupport?: {
- --The code action kind is support with the following value
- --set.
- 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.
- valueSet: CodeActionKind[];
- };
- };
- };
- --Capabilities specific to the `textDocument/codeLens`
- codeLens?: {
- --Whether code lens supports dynamic registration.
- dynamicRegistration?: boolean;
- };
- --Capabilities specific to the `textDocument/documentLink`
- documentLink?: {
- --Whether document link supports dynamic registration.
- dynamicRegistration?: boolean;
- };
- --Capabilities specific to the `textDocument/documentColor` and the
- --`textDocument/colorPresentation` request.
- --
- --Since 3.6.0
- colorProvider?: {
- --Whether colorProvider supports dynamic registration. If this is set to `true`
- --the client supports the new `(ColorProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions)`
- --return value for the corresponding server capability as well.
- dynamicRegistration?: boolean;
- }
- --Capabilities specific to the `textDocument/rename`
- rename?: {
- --Whether rename supports dynamic registration.
- dynamicRegistration?: boolean;
- --The client supports testing for validity of rename operations
- --before execution.
- prepareSupport?: boolean;
- };
- --Capabilities specific to `textDocument/publishDiagnostics`.
- publishDiagnostics?: {
- --Whether the clients accepts diagnostics with related information.
- 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
- tagSupport?: {
- --The tags supported by this client
- valueSet: DiagnosticTag[];
- };
- };
- --Capabilities specific to `textDocument/foldingRange` requests.
- --
- --Since 3.10.0
- foldingRange?: {
- --Whether implementation supports dynamic registration for folding range providers. If this is set to `true`
- --the client supports the new `(FoldingRangeProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions)`
- --return value for the corresponding server capability as well.
- 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.
- rangeLimit?: number;
- --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.
- lineFoldingOnly?: boolean;
- };
-}
---]=]
-
---[=[
---Workspace specific client capabilities.
-export interface WorkspaceClientCapabilities {
- --The client supports applying batch edits to the workspace by supporting
- --the request 'workspace/applyEdit'
- applyEdit?: boolean;
- --Capabilities specific to `WorkspaceEdit`s
- workspaceEdit?: {
- --The client supports versioned document changes in `WorkspaceEdit`s
- documentChanges?: boolean;
- --The resource operations the client supports. Clients should at least
- --support 'create', 'rename' and 'delete' files and folders.
- resourceOperations?: ResourceOperationKind[];
- --The failure handling strategy of a client if applying the workspace edit
- --fails.
- failureHandling?: FailureHandlingKind;
- };
- --Capabilities specific to the `workspace/didChangeConfiguration` notification.
- didChangeConfiguration?: {
- --Did change configuration notification supports dynamic registration.
- dynamicRegistration?: boolean;
- };
- --Capabilities specific to the `workspace/didChangeWatchedFiles` notification.
- didChangeWatchedFiles?: {
- --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.
- dynamicRegistration?: boolean;
- };
- --Capabilities specific to the `workspace/symbol` request.
- symbol?: {
- --Symbol request supports dynamic registration.
- dynamicRegistration?: boolean;
- --Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.
- 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
- --to a default value when unknown.
- --
- --If this property is not present the client only supports
- --the symbol kinds from `File` to `Array` as defined in
- --the initial version of the protocol.
- valueSet?: SymbolKind[];
- }
- };
- --Capabilities specific to the `workspace/executeCommand` request.
- executeCommand?: {
- --Execute command supports dynamic registration.
- dynamicRegistration?: boolean;
- };
- --The client has support for workspace folders.
- --
- --Since 3.6.0
- workspaceFolders?: boolean;
- --The client supports `workspace/configuration` requests.
- --
- --Since 3.6.0
- configuration?: boolean;
-}
---]=]
+--- @diagnostic enable:no-unknown
--- Gets a new ClientCapabilities object describing the LSP client
--- capabilities.
@@ -729,23 +427,35 @@ function protocol.make_client_capabilities()
properties = { 'edit' },
},
},
+ codeLens = {
+ dynamicRegistration = false,
+ resolveSupport = {
+ properties = { 'command' },
+ },
+ },
formatting = {
dynamicRegistration = true,
},
rangeFormatting = {
dynamicRegistration = true,
+ rangesSupport = true,
},
completion = {
dynamicRegistration = false,
completionItem = {
- -- Until we can actually expand snippet, move cursor and allow for true snippet experience,
- -- this should be disabled out of the box.
- -- However, users can turn this back on if they have a snippet plugin.
- snippetSupport = false,
+ snippetSupport = true,
commitCharactersSupport = false,
preselectSupport = false,
- deprecatedSupport = false,
+ deprecatedSupport = true,
documentationFormat = { constants.MarkupKind.Markdown, constants.MarkupKind.PlainText },
+ resolveSupport = {
+ properties = {
+ 'additionalTextEdits',
+ },
+ },
+ tagSupport = {
+ valueSet = get_value_set(constants.CompletionTag),
+ },
},
completionItemKind = {
valueSet = get_value_set(constants.CompletionItemKind),
@@ -852,7 +562,7 @@ function protocol.make_client_capabilities()
workDoneProgress = true,
showMessage = {
messageActionItem = {
- additionalPropertiesSupport = false,
+ additionalPropertiesSupport = true,
},
},
showDocument = {
@@ -905,9 +615,10 @@ function protocol.resolve_capabilities(server_capabilities)
end
-- Generated by gen_lsp.lua, keep at end of file.
---- LSP method names.
---
+---@enum vim.lsp.protocol.Methods
---@see https://microsoft.github.io/language-server-protocol/specification/#metaModel
+--- LSP method names.
protocol.Methods = {
--- A request to resolve the incoming calls for a given `CallHierarchyItem`.
--- @since 3.16.0
@@ -1170,14 +881,14 @@ protocol.Methods = {
--- symbol's location.
--- @since 3.17.0
workspaceSymbol_resolve = 'workspaceSymbol/resolve',
- --- A request sent from the server to the client to modify certain resources.
+ --- A request sent from the server to the client to modified 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 where the client signaled configuration change via an
+ --- This pull model replaces the old push model were 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.
@@ -1210,7 +921,7 @@ protocol.Methods = {
--- files were renamed from within the client.
--- @since 3.16.0
workspace_didRenameFiles = 'workspace/didRenameFiles',
- --- A request sent from the client to the server to execute a command. The request might return
+ --- A request send 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
@@ -1248,14 +959,5 @@ protocol.Methods = {
--- The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders.
workspace_workspaceFolders = 'workspace/workspaceFolders',
}
-local function freeze(t)
- return setmetatable({}, {
- __index = t,
- __newindex = function()
- error('cannot modify immutable table')
- end,
- })
-end
-protocol.Methods = freeze(protocol.Methods)
return protocol
diff --git a/runtime/lua/vim/lsp/rpc.lua b/runtime/lua/vim/lsp/rpc.lua
index 3c63a12da2..e79dbd2db3 100644
--- a/runtime/lua/vim/lsp/rpc.lua
+++ b/runtime/lua/vim/lsp/rpc.lua
@@ -3,7 +3,7 @@ local log = require('vim.lsp.log')
local protocol = require('vim.lsp.protocol')
local validate, schedule, schedule_wrap = vim.validate, vim.schedule, vim.schedule_wrap
-local is_win = uv.os_uname().version:find('Windows')
+local is_win = vim.fn.has('win32') == 1
--- Checks whether a given path exists and is a directory.
---@param filename string path to check
@@ -140,7 +140,7 @@ local client_errors = {
SERVER_RESULT_CALLBACK_ERROR = 7,
}
---- @type table<string|integer, string|integer>
+--- @type table<string,integer> | table<integer,string>
--- @nodoc
M.client_errors = vim.deepcopy(client_errors)
for k, v in pairs(client_errors) do
@@ -407,7 +407,9 @@ function Client:handle_body(body)
end
log.debug('rpc.receive', decoded)
- if type(decoded.method) == 'string' and decoded.id then
+ if type(decoded) ~= 'table' then
+ self:on_error(M.client_errors.INVALID_SERVER_MESSAGE, decoded)
+ elseif type(decoded.method) == 'string' and decoded.id then
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.
@@ -502,7 +504,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,
@@ -548,7 +550,7 @@ local function new_client(dispatchers, transport)
end
---@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 request fun(method: string, params: table?, callback: fun(err: lsp.ResponseError|nil, result: any), notify_reply_callback: fun(message_id: 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()
@@ -701,7 +703,9 @@ function M.connect(host_or_path, port)
if port == nil then
handle:connect(host_or_path, on_connect)
else
- handle:connect(host_or_path, port, on_connect)
+ local info = uv.getaddrinfo(host_or_path, nil)
+ local resolved_host = info and info[1] and info[1].addr or host_or_path
+ handle:connect(resolved_host, port, on_connect)
end
return public_client(client)
diff --git a/runtime/lua/vim/lsp/semantic_tokens.lua b/runtime/lua/vim/lsp/semantic_tokens.lua
index ef2502b12e..8182457dd0 100644
--- a/runtime/lua/vim/lsp/semantic_tokens.lua
+++ b/runtime/lua/vim/lsp/semantic_tokens.lua
@@ -140,12 +140,7 @@ local function tokens_to_ranges(data, bufnr, client, request)
local function _get_byte_pos(col)
if col > 0 then
local buf_line = lines[line + 1] or ''
- local ok, result
- ok, result = pcall(util._str_byteindex_enc, buf_line, col, client.offset_encoding)
- if ok then
- return result
- end
- return math.min(#buf_line, col)
+ return util._str_byteindex_enc(buf_line, col, client.offset_encoding)
end
return col
end
@@ -197,12 +192,6 @@ function STHighlighter.new(bufnr)
highlighter:send_request()
end
end,
- on_detach = function(_, buf)
- local highlighter = STHighlighter.active[buf]
- if highlighter then
- highlighter:destroy()
- end
- end,
})
api.nvim_create_autocmd({ 'BufWinEnter', 'InsertLeave' }, {
@@ -418,7 +407,7 @@ end
function STHighlighter:on_win(topline, botline)
for client_id, state in pairs(self.client_state) do
local current_result = state.current_result
- if current_result.version and current_result.version == util.buf_versions[self.bufnr] then
+ if current_result.version == util.buf_versions[self.bufnr] then
if not current_result.namespace_cleared then
api.nvim_buf_clear_namespace(self.bufnr, state.namespace, 0, -1)
current_result.namespace_cleared = true
@@ -779,7 +768,6 @@ 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
diff --git a/runtime/lua/vim/lsp/sync.lua b/runtime/lua/vim/lsp/sync.lua
index 936579e003..bdfe8d51b8 100644
--- a/runtime/lua/vim/lsp/sync.lua
+++ b/runtime/lua/vim/lsp/sync.lua
@@ -212,7 +212,8 @@ end
---@param lastline integer
---@param new_lastline integer
---@param offset_encoding string
----@return vim.lsp.sync.Range, vim.lsp.sync.Range
+---@return vim.lsp.sync.Range prev_end_range
+---@return vim.lsp.sync.Range curr_end_range
local function compute_end_range(
prev_lines,
curr_lines,
@@ -222,6 +223,16 @@ local function compute_end_range(
new_lastline,
offset_encoding
)
+ -- A special case for the following `firstline == new_lastline` case where lines are deleted.
+ -- Even if the buffer has become empty, nvim behaves as if it has an empty line with eol.
+ if #curr_lines == 1 and curr_lines[1] == '' then
+ local prev_line = prev_lines[lastline - 1]
+ return {
+ line_idx = lastline - 1,
+ byte_idx = #prev_line + 1,
+ char_idx = compute_line_length(prev_line, offset_encoding) + 1,
+ }, { line_idx = 1, byte_idx = 1, char_idx = 1 }
+ end
-- If firstline == new_lastline, the first change occurred on a line that was deleted.
-- In this case, the last_byte...
if firstline == new_lastline then
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index 5a229a1169..882ec22ca6 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -99,9 +99,26 @@ local function get_border_size(opts)
return { height = height, width = width }
end
-local function split_lines(value)
- value = string.gsub(value, '\r\n?', '\n')
- return split(value, '\n', { plain = true, trimempty = true })
+--- Splits string at newlines, optionally removing unwanted blank lines.
+---
+--- @param s string Multiline string
+--- @param no_blank boolean? Drop blank lines for each @param/@return (except one empty line
+--- separating each). Workaround for https://github.com/LuaLS/lua-language-server/issues/2333
+local function split_lines(s, no_blank)
+ s = string.gsub(s, '\r\n?', '\n')
+ local lines = {}
+ local in_desc = true -- Main description block, before seeing any @foo.
+ for line in vim.gsplit(s, '\n', { plain = true, trimempty = true }) do
+ local start_annotation = not not line:find('^ ?%@.?[pr]')
+ in_desc = (not start_annotation) and in_desc or false
+ if start_annotation and no_blank and not (lines[#lines] or ''):find('^%s*$') then
+ table.insert(lines, '') -- Separate each @foo with a blank line.
+ end
+ if in_desc or not no_blank or not line:find('^%s*$') then
+ table.insert(lines, line)
+ end
+ end
+ return lines
end
local function create_window_without_focus()
@@ -116,9 +133,10 @@ end
--- Convenience wrapper around vim.str_utfindex
---@param line string line to be indexed
---@param index integer|nil byte index (utf-8), or `nil` for length
----@param encoding string|nil utf-8|utf-16|utf-32|nil defaults to utf-16
+---@param encoding 'utf-8'|'utf-16'|'utf-32'|nil defaults to utf-16
---@return integer `encoding` index of `index` in `line`
function M._str_utfindex_enc(line, index, encoding)
+ local len32, len16 = vim.str_utfindex(line)
if not encoding then
encoding = 'utf-16'
end
@@ -129,9 +147,15 @@ function M._str_utfindex_enc(line, index, encoding)
return #line
end
elseif encoding == 'utf-16' then
+ if not index or index > len16 then
+ return len16
+ end
local _, col16 = vim.str_utfindex(line, index)
return col16
elseif encoding == 'utf-32' then
+ if not index or index > len32 then
+ return len32
+ end
local col32, _ = vim.str_utfindex(line, index)
return col32
else
@@ -147,6 +171,12 @@ end
---@param encoding string utf-8|utf-16|utf-32| defaults to utf-16
---@return integer byte (utf-8) index of `encoding` index `index` in `line`
function M._str_byteindex_enc(line, index, encoding)
+ local len = #line
+ if index > len then
+ -- LSP spec: if character > line length, default to the line length.
+ -- https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#position
+ return len
+ end
if not encoding then
encoding = 'utf-16'
end
@@ -154,7 +184,7 @@ function M._str_byteindex_enc(line, index, encoding)
if index then
return index
else
- return #line
+ return len
end
elseif encoding == 'utf-16' then
return vim.str_byteindex(line, index, true)
@@ -165,19 +195,16 @@ function M._str_byteindex_enc(line, index, encoding)
end
end
-local _str_utfindex_enc = M._str_utfindex_enc
-local _str_byteindex_enc = M._str_byteindex_enc
-
--- Replaces text in a range with new text.
---
--- CAUTION: Changes in-place!
---
---@deprecated
----@param lines (table) Original list of strings
----@param A (table) Start position; a 2-tuple of {line,col} numbers
----@param B (table) End position; a 2-tuple of {line,col} numbers
----@param new_lines (table) list of strings to replace the original
----@return table The modified {lines} object
+---@param lines string[] Original list of strings
+---@param A [integer, integer] Start position; a 2-tuple of {line,col} numbers
+---@param B [integer, integer] End position; a 2-tuple {line,col} numbers
+---@param new_lines string[] list of strings to replace the original
+---@return string[] 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
@@ -238,6 +265,7 @@ end
---@param rows integer[] zero-indexed line numbers
---@return table<integer, string>|string a table mapping rows to lines
local function get_lines(bufnr, rows)
+ --- @type integer[]
rows = type(rows) == 'table' and rows or { rows }
-- This is needed for bufload and bufloaded
@@ -246,7 +274,7 @@ local function get_lines(bufnr, rows)
end
local function buf_lines()
- local lines = {}
+ local lines = {} --- @type table<integer,string>
for _, row in ipairs(rows) do
lines[row] = (api.nvim_buf_get_lines(bufnr, row, row + 1, false) or { '' })[1]
end
@@ -268,17 +296,20 @@ local function get_lines(bufnr, rows)
end
local filename = api.nvim_buf_get_name(bufnr)
+ if vim.fn.isdirectory(filename) ~= 0 then
+ return {}
+ end
-- get the data from the file
local fd = uv.fs_open(filename, 'r', 438)
if not fd then
return ''
end
- local stat = uv.fs_fstat(fd)
- local data = uv.fs_read(fd, stat.size, 0)
+ local stat = assert(uv.fs_fstat(fd))
+ local data = assert(uv.fs_read(fd, stat.size, 0))
uv.fs_close(fd)
- local lines = {} -- rows we need to retrieve
+ local lines = {} --- @type table<integer,true|string> rows we need to retrieve
local need = 0 -- keep track of how many unique rows we need
for _, row in pairs(rows) do
if not lines[row] then
@@ -307,7 +338,7 @@ local function get_lines(bufnr, rows)
lines[i] = ''
end
end
- return lines
+ return lines --[[@as table<integer,string>]]
end
--- Gets the zero-indexed line from the given buffer.
@@ -322,7 +353,8 @@ local function get_line(bufnr, row)
end
--- Position is a https://microsoft.github.io/language-server-protocol/specifications/specification-current/#position
----@param offset_encoding string|nil utf-8|utf-16|utf-32
+---@param position lsp.Position
+---@param offset_encoding? string utf-8|utf-16|utf-32
---@return integer
local function get_line_byte_from_position(bufnr, position, offset_encoding)
-- LSP's line and characters are 0-indexed
@@ -332,18 +364,13 @@ local function get_line_byte_from_position(bufnr, position, offset_encoding)
-- character
if col > 0 then
local line = get_line(bufnr, position.line) or ''
- local ok, result
- ok, result = pcall(_str_byteindex_enc, line, col, offset_encoding)
- if ok then
- return result
- end
- return math.min(#line, col)
+ return M._str_byteindex_enc(line, col, offset_encoding or 'utf-16')
end
return col
end
--- Applies a list of text edits to a buffer.
----@param text_edits table list of `TextEdit` objects
+---@param text_edits lsp.TextEdit[]
---@param bufnr integer Buffer id
---@param offset_encoding string utf-8|utf-16|utf-32
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textEdit
@@ -366,6 +393,7 @@ function M.apply_text_edits(text_edits, bufnr, offset_encoding)
-- Fix reversed range and indexing each text_edits
local index = 0
+ --- @param text_edit lsp.TextEdit
text_edits = vim.tbl_map(function(text_edit)
index = index + 1
text_edit._index = index
@@ -383,6 +411,9 @@ function M.apply_text_edits(text_edits, bufnr, offset_encoding)
end, text_edits)
-- Sort text_edits
+ ---@param a lsp.TextEdit | { _index: integer }
+ ---@param b lsp.TextEdit | { _index: integer }
+ ---@return boolean
table.sort(text_edits, function(a, b)
if a.range.start.line ~= b.range.start.line then
return a.range.start.line > b.range.start.line
@@ -390,13 +421,11 @@ function M.apply_text_edits(text_edits, bufnr, offset_encoding)
if a.range.start.character ~= b.range.start.character then
return a.range.start.character > b.range.start.character
end
- if a._index ~= b._index then
- return a._index > b._index
- end
+ return a._index > b._index
end)
-- save and restore local marks since they get deleted by nvim_buf_set_lines
- local marks = {}
+ local marks = {} --- @type table<string,[integer,integer]>
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
@@ -432,14 +461,15 @@ function M.apply_text_edits(text_edits, bufnr, offset_encoding)
e.end_col = last_line_len
has_eol_text_edit = true
else
- -- If the replacement is over the end of a line (i.e. e.end_col is out of bounds and the
+ -- If the replacement is over the end of a line (i.e. e.end_col is equal to the line length and the
-- replacement text ends with a newline We can likely assume that the replacement is assumed
-- to be meant to replace the newline with another newline and we need to make sure this
-- doesn't add an extra empty line. E.g. when the last line to be replaced contains a '\r'
-- in the file some servers (clangd on windows) will include that character in the line
-- while nvim_buf_set_text doesn't count it as part of the line.
if
- e.end_col > last_line_len
+ e.end_col >= last_line_len
+ and text_edit.range['end'].character > e.end_col
and #text_edit.newText > 0
and string.sub(text_edit.newText, -1) == '\n'
then
@@ -481,8 +511,8 @@ end
--- Applies a `TextDocumentEdit`, which is a list of changes to a single
--- document.
---
----@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 text_document_edit lsp.TextDocumentEdit
+---@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)
@@ -509,7 +539,6 @@ function M.apply_text_document_edit(text_document_edit, index, offset_encoding)
and (
text_document.version
and text_document.version > 0
- and M.buf_versions[bufnr]
and M.buf_versions[bufnr] > text_document.version
)
then
@@ -534,6 +563,7 @@ local function path_under_prefix(path, prefix)
end
--- Get list of buffers whose filename matches the given path prefix (normalized full path)
+---@param prefix string
---@return integer[]
local function get_bufs_with_prefix(prefix)
prefix = path_components(prefix)
@@ -616,7 +646,7 @@ function M.rename(old_fname, new_fname, opts)
buf_rename[b] = { from = old_bname, to = new_bname }
end
- local newdir = assert(vim.fs.dirname(new_fname))
+ local newdir = vim.fs.dirname(new_fname)
vim.fn.mkdir(newdir, 'p')
local ok, err = os.rename(old_fname_full, new_fname)
@@ -625,7 +655,7 @@ function M.rename(old_fname, new_fname, opts)
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')
+ vim.fn.mkdir(vim.fs.dirname(new_undofile), 'p')
os.rename(old_undofile, new_undofile)
end
@@ -633,7 +663,7 @@ function M.rename(old_fname, new_fname, opts)
-- 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._with({ buf = 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
@@ -642,6 +672,7 @@ function M.rename(old_fname, new_fname, opts)
end
end
+--- @param change lsp.CreateFile
local function create_file(change)
local opts = change.options or {}
-- from spec: Overwrite wins over `ignoreIfExists`
@@ -656,29 +687,21 @@ local function create_file(change)
vim.fn.bufadd(fname)
end
+--- @param change lsp.DeleteFile
local function delete_file(change)
local opts = change.options or {}
local fname = vim.uri_to_fname(change.uri)
- local stat = uv.fs_stat(fname)
- if opts.ignoreIfNotExists and not stat then
- return
- end
- assert(stat, 'Cannot delete not existing file or folder ' .. fname)
- local flags
- if stat and stat.type == 'directory' then
- flags = opts.recursive and 'rf' or 'd'
- else
- flags = ''
- end
local bufnr = vim.fn.bufadd(fname)
- local result = tonumber(vim.fn.delete(fname, flags))
- assert(result == 0, 'Could not delete file: ' .. fname .. ', stat: ' .. vim.inspect(stat))
+ vim.fs.rm(fname, {
+ force = opts.ignoreIfNotExists,
+ recursive = opts.recursive,
+ })
api.nvim_buf_delete(bufnr, { force = true })
end
--- Applies a `WorkspaceEdit`.
---
----@param workspace_edit table `WorkspaceEdit`
+---@param workspace_edit lsp.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
function M.apply_workspace_edit(workspace_edit, offset_encoding)
@@ -724,21 +747,21 @@ 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 (lsp.MarkedString | lsp.MarkedString[] | lsp.MarkupContent)
----@param contents (table|nil) List of strings to extend with converted lines. Defaults to {}.
+---@param input lsp.MarkedString|lsp.MarkedString[]|lsp.MarkupContent
+---@param contents string[]|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
function M.convert_input_to_markdown_lines(input, contents)
contents = contents or {}
-- MarkedString variation 1
if type(input) == 'string' then
- list_extend(contents, split_lines(input))
+ list_extend(contents, split_lines(input, true))
else
assert(type(input) == 'table', 'Expected a table for LSP input')
-- MarkupContent
if input.kind then
local value = input.value or ''
- list_extend(contents, split_lines(value))
+ list_extend(contents, split_lines(value, true))
-- MarkupString variation 2
elseif input.language then
table.insert(contents, '```' .. input.language)
@@ -760,11 +783,11 @@ end
--- Converts `textDocument/signatureHelp` response to markdown lines.
---
----@param signature_help table Response of `textDocument/SignatureHelp`
+---@param signature_help lsp.SignatureHelp Response of `textDocument/SignatureHelp`
---@param ft string|nil filetype that will be use as the `lang` for the label markdown code block
---@param triggers table|nil list of trigger characters from the lsp server. used to better determine parameter offsets
----@return table|nil table list of lines of converted markdown.
----@return table|nil table of active hl
+---@return string[]|nil table list of lines of converted markdown.
+---@return number[]|nil table of active hl
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_signatureHelp
function M.convert_signature_help_to_markdown_lines(signature_help, ft, triggers)
if not signature_help.signatures then
@@ -961,7 +984,7 @@ end
--- Shows document and optionally jumps to the location.
---
----@param location table (`Location`|`LocationLink`)
+---@param location lsp.Location|lsp.LocationLink
---@param offset_encoding string|nil utf-8|utf-16|utf-32
---@param opts table|nil options
--- - reuse_win (boolean) Jump to existing window if buffer is already open.
@@ -1007,7 +1030,7 @@ function M.show_document(location, offset_encoding, opts)
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 })
- api.nvim_win_call(win, function()
+ vim._with({ win = win }, function()
-- Open folds under the cursor
vim.cmd('normal! zv')
end)
@@ -1018,7 +1041,7 @@ end
--- Jumps to a location.
---
----@param location table (`Location`|`LocationLink`)
+---@param location lsp.Location|lsp.LocationLink
---@param offset_encoding string|nil utf-8|utf-16|utf-32
---@param reuse_win boolean|nil Jump to existing window if buffer is already open.
---@return boolean `true` if the jump succeeded
@@ -1039,7 +1062,7 @@ end
--- - for Location, range is shown (e.g., function definition)
--- - for LocationLink, targetRange is shown (e.g., body of function definition)
---
----@param location table a single `Location` or `LocationLink`
+---@param location lsp.Location|lsp.LocationLink
---@param opts table
---@return integer|nil buffer id of float window
---@return integer|nil window id of float window
@@ -1155,7 +1178,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 contents string[] of lines to show in window
---@param opts table with optional fields
--- - height of floating window
--- - width of floating window
@@ -1327,7 +1350,7 @@ function M.stylize_markdown(bufnr, contents, opts)
end
-- needs to run in the buffer for the regions to work
- api.nvim_buf_call(bufnr, function()
+ vim._with({ buf = bufnr }, function()
-- we need to apply lsp_markdown regions speperately, since otherwise
-- markdown regions can "bleed" through the other syntax regions
-- and mess up the formatting
@@ -1438,7 +1461,7 @@ end
--- Computes size of float needed to show contents (with optional wrapping)
---
---@param contents table of lines to show in window
----@param opts table with optional fields
+---@param opts? table with optional fields
--- - height of floating window
--- - width of floating window
--- - wrap_at character to wrap at for computing height
@@ -1630,10 +1653,9 @@ function M.open_floating_preview(contents, syntax, opts)
if do_stylize then
vim.wo[floating_winnr].conceallevel = 2
end
- -- disable folding
- vim.wo[floating_winnr].foldenable = false
- -- soft wrapping
- vim.wo[floating_winnr].wrap = opts.wrap
+ vim.wo[floating_winnr].foldenable = false -- Disable folding.
+ vim.wo[floating_winnr].wrap = opts.wrap -- Soft wrapping.
+ vim.wo[floating_winnr].breakindent = true -- Slightly better list presentation.
vim.bo[floating_bufnr].modifiable = false
vim.bo[floating_bufnr].bufhidden = 'wipe'
@@ -1670,7 +1692,7 @@ do --[[ References ]]
--- Shows a list of document highlights for a certain buffer.
---
---@param bufnr integer Buffer id
- ---@param references table List of `DocumentHighlight` objects to highlight
+ ---@param references lsp.DocumentHighlight[] objects to highlight
---@param offset_encoding string One of "utf-8", "utf-16", "utf-32".
---@see https://microsoft.github.io/language-server-protocol/specification/#textDocumentContentChangeEvent
function M.buf_highlight_references(bufnr, references, offset_encoding)
@@ -1721,7 +1743,9 @@ end)
---@inlinedoc
---@field filename string
---@field lnum integer 1-indexed line number
+---@field end_lnum integer 1-indexed end line number
---@field col integer 1-indexed column
+---@field end_col integer 1-indexed end column
---@field text string
---@field user_data lsp.Location|lsp.LocationLink
@@ -1748,7 +1772,7 @@ function M.locations_to_items(locations, offset_encoding)
end
local items = {}
- ---@type table<string, {start: lsp.Position, location: lsp.Location|lsp.LocationLink}[]>
+ ---@type table<string, {start: lsp.Position, end: lsp.Position, location: lsp.Location|lsp.LocationLink}[]>
local grouped = setmetatable({}, {
__index = function(t, k)
local v = {}
@@ -1760,7 +1784,7 @@ function M.locations_to_items(locations, offset_encoding)
-- locations may be Location or LocationLink
local uri = d.uri or d.targetUri
local range = d.range or d.targetSelectionRange
- table.insert(grouped[uri], { start = range.start, location = d })
+ table.insert(grouped[uri], { start = range.start, ['end'] = range['end'], location = d })
end
---@type string[]
@@ -1775,6 +1799,9 @@ function M.locations_to_items(locations, offset_encoding)
local line_numbers = {}
for _, temp in ipairs(rows) do
table.insert(line_numbers, temp.start.line)
+ if temp.start.line ~= temp['end'].line then
+ table.insert(line_numbers, temp['end'].line)
+ end
end
-- get all the lines for this uri
@@ -1782,13 +1809,20 @@ function M.locations_to_items(locations, offset_encoding)
for _, temp in ipairs(rows) do
local pos = temp.start
+ local end_pos = temp['end']
local row = pos.line
+ local end_row = end_pos.line
local line = lines[row] or ''
+ local end_line = lines[end_row] or ''
local col = M._str_byteindex_enc(line, pos.character, offset_encoding)
+ local end_col = M._str_byteindex_enc(end_line, end_pos.character, offset_encoding)
+
table.insert(items, {
filename = filename,
lnum = row + 1,
+ end_lnum = end_row + 1,
col = col + 1,
+ end_col = end_col + 1,
text = line,
user_data = temp.location,
})
@@ -1807,7 +1841,7 @@ end
--- Converts symbols to quickfix list items.
---
---@param symbols table DocumentSymbol[] or SymbolInformation[]
----@param bufnr integer
+---@param bufnr? integer
function M.symbols_to_items(symbols, bufnr)
local function _symbols_to_items(_symbols, _items, _bufnr)
for _, symbol in ipairs(_symbols) do
@@ -1874,7 +1908,7 @@ end
--- CAUTION: Modifies the input in-place!
---
---@deprecated
----@param lines table list of lines
+---@param lines string[] 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')
@@ -1899,7 +1933,7 @@ function M.try_trim_markdown_code_blocks(lines)
end
---@param window integer|nil: window handle or 0 for current, defaults to current
----@param offset_encoding string utf-8|utf-16|utf-32|nil defaults to `offset_encoding` of first client of buffer of `window`
+---@param offset_encoding? string utf-8|utf-16|utf-32|nil defaults to `offset_encoding` of first client of buffer of `window`
local function make_position_param(window, offset_encoding)
window = window or 0
local buf = api.nvim_win_get_buf(window)
@@ -1911,7 +1945,7 @@ local function make_position_param(window, offset_encoding)
return { line = 0, character = 0 }
end
- col = _str_utfindex_enc(line, col, offset_encoding)
+ col = M._str_utfindex_enc(line, col, offset_encoding)
return { line = row, character = col }
end
@@ -1920,7 +1954,7 @@ end
---
---@param window integer|nil: window handle or 0 for current, defaults to current
---@param offset_encoding string|nil utf-8|utf-16|utf-32|nil defaults to `offset_encoding` of first client of buffer of `window`
----@return table `TextDocumentPositionParams` object
+---@return lsp.TextDocumentPositionParams
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentPositionParams
function M.make_position_params(window, offset_encoding)
window = window or 0
@@ -1933,7 +1967,7 @@ function M.make_position_params(window, offset_encoding)
end
--- Utility function for getting the encoding of the first LSP client on the given buffer.
----@param bufnr (integer) buffer handle or 0 for current, defaults to current
+---@param bufnr integer buffer handle or 0 for current, defaults to current
---@return string encoding first client if there is one, nil otherwise
function M._get_offset_encoding(bufnr)
validate({
@@ -2034,15 +2068,16 @@ end
--- Creates a `TextDocumentIdentifier` object for the current buffer.
---
---@param bufnr integer|nil: Buffer handle, defaults to current
----@return table `TextDocumentIdentifier`
+---@return lsp.TextDocumentIdentifier
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentIdentifier
function M.make_text_document_params(bufnr)
return { uri = vim.uri_from_bufnr(bufnr or 0) }
end
--- Create the workspace params
----@param added table
----@param removed table
+---@param added lsp.WorkspaceFolder[]
+---@param removed lsp.WorkspaceFolder[]
+---@return lsp.WorkspaceFoldersChangeEvent
function M.make_workspace_params(added, removed)
return { event = { added = added, removed = removed } }
end
@@ -2050,8 +2085,8 @@ end
--- Returns indentation size.
---
---@see 'shiftwidth'
----@param bufnr (integer|nil): Buffer handle, defaults to current
----@return (integer) indentation size
+---@param bufnr integer|nil: Buffer handle, defaults to current
+---@return integer indentation size
function M.get_effective_tabstop(bufnr)
validate({ bufnr = { bufnr, 'n', true } })
local bo = bufnr and vim.bo[bufnr] or vim.bo
@@ -2061,7 +2096,7 @@ end
--- Creates a `DocumentFormattingParams` object for the current buffer and cursor position.
---
----@param options table|nil with valid `FormattingOptions` entries
+---@param options lsp.FormattingOptions|nil with valid `FormattingOptions` entries
---@return lsp.DocumentFormattingParams object
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting
function M.make_formatting_params(options)
@@ -2092,11 +2127,7 @@ function M.character_offset(buf, row, col, offset_encoding)
)
offset_encoding = vim.lsp.get_clients({ bufnr = buf })[1].offset_encoding
end
- -- If the col is past the EOL, use the line length.
- if col > #line then
- return _str_utfindex_enc(line, nil, offset_encoding)
- end
- return _str_utfindex_enc(line, col, offset_encoding)
+ return M._str_utfindex_enc(line, col, offset_encoding)
end
--- Helper function to return nested values in language server settings
@@ -2203,6 +2234,11 @@ end
M._get_line_byte_from_position = get_line_byte_from_position
---@nodoc
-M.buf_versions = {} ---@type table<integer,integer>
+---@type table<integer,integer>
+M.buf_versions = setmetatable({}, {
+ __index = function(t, bufnr)
+ return rawget(t, bufnr) or 0
+ end,
+})
return M
diff --git a/runtime/lua/vim/provider/health.lua b/runtime/lua/vim/provider/health.lua
index 63e0da448a..47c2080e3c 100644
--- a/runtime/lua/vim/provider/health.lua
+++ b/runtime/lua/vim/provider/health.lua
@@ -1,8 +1,114 @@
local health = vim.health
-local iswin = vim.uv.os_uname().sysname == 'Windows_NT'
+local iswin = vim.fn.has('win32') == 1
local M = {}
+local function cmd_ok(cmd)
+ local out = vim.fn.system(cmd)
+ return vim.v.shell_error == 0, out
+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
+
+-- 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
+
+--- @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)
+local function 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.uv.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.uv.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 vim.trim(vim.fn.system(cmd)), shell_error_code
+end
+
+---@param provider string
+local function provider_disabled(provider)
+ local loaded_var = 'loaded_' .. provider .. '_provider'
+ local v = vim.g[loaded_var]
+ if v == 0 then
+ health.info('Disabled (' .. loaded_var .. '=' .. v .. ').')
+ return true
+ end
+ return false
+end
+
local function clipboard()
health.start('Clipboard (optional)')
@@ -10,7 +116,7 @@ local function clipboard()
os.getenv('TMUX')
and vim.fn.executable('tmux') == 1
and vim.fn.executable('pbpaste') == 1
- and not health._cmd_ok('pbpaste')
+ and not cmd_ok('pbpaste')
then
local tmux_version = string.match(vim.fn.system('tmux -V'), '%d+%.%d+')
local advice = {
@@ -20,9 +126,9 @@ local function clipboard()
health.error('pbcopy does not work with tmux version: ' .. tmux_version, advice)
end
- local clipboard_tool = vim.fn['provider#clipboard#Executable']()
+ local clipboard_tool = vim.fn['provider#clipboard#Executable']() ---@type string
if vim.g.clipboard ~= nil and clipboard_tool == '' then
- local error_message = vim.fn['provider#clipboard#Error']()
+ local error_message = vim.fn['provider#clipboard#Error']() ---@type string
health.error(
error_message,
"Use the example in :help g:clipboard as a template, or don't set g:clipboard at all."
@@ -40,7 +146,7 @@ end
local function node()
health.start('Node.js provider (optional)')
- if health._provider_disabled('node') then
+ if provider_disabled('node') then
return
end
@@ -60,7 +166,7 @@ local function node()
end
-- local node_v = vim.fn.split(system({'node', '-v'}), "\n")[1] or ''
- local ok, node_v = health._cmd_ok({ 'node', '-v' })
+ local ok, node_v = 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)
@@ -73,7 +179,7 @@ local function node()
)
end
- local node_detect_table = vim.fn['provider#node#Detect']()
+ local node_detect_table = vim.fn['provider#node#Detect']() ---@type string[]
local host = node_detect_table[1]
if host:find('^%s*$') then
health.warn('Missing "neovim" npm (or yarn, pnpm) package.', {
@@ -97,7 +203,7 @@ local function node()
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, ' '))
+ ok, latest_npm = cmd_ok(vim.split(latest_npm_cmd, ' '))
if not ok or latest_npm:find('^%s$') then
health.error(
'Failed to run: ' .. latest_npm_cmd,
@@ -115,7 +221,7 @@ local function node()
local current_npm_cmd = { 'node', host, '--version' }
local current_npm
- ok, current_npm = health._cmd_ok(current_npm_cmd)
+ ok, current_npm = cmd_ok(current_npm_cmd)
if not ok then
health.error(
'Failed to run: ' .. table.concat(current_npm_cmd, ' '),
@@ -143,7 +249,7 @@ end
local function perl()
health.start('Perl provider (optional)')
- if health._provider_disabled('perl') then
+ if provider_disabled('perl') then
return
end
@@ -162,7 +268,7 @@ local function perl()
-- 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', '' })
+ local ok = cmd_ok({ perl_exec, '-W', '-MApp::cpanminus', '-e', '' })
if not ok then
return { perl_exec, '"App::cpanminus" module is not installed' }
end
@@ -174,7 +280,7 @@ local function perl()
'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)
+ ok, latest_cpan = cmd_ok(latest_cpan_cmd)
if not ok or latest_cpan:find('^%s*$') then
health.error(
'Failed to run: ' .. table.concat(latest_cpan_cmd, ' '),
@@ -184,7 +290,7 @@ local function perl()
elseif latest_cpan[1] == '!' then
local cpanm_errs = vim.split(latest_cpan, '!')
if cpanm_errs[1]:find("Can't write to ") then
- local advice = {}
+ local advice = {} ---@type string[]
for i = 2, #cpanm_errs do
advice[#advice + 1] = cpanm_errs[i]
end
@@ -197,7 +303,7 @@ local function perl()
return
end
end
- latest_cpan = vim.fn.matchstr(latest_cpan, [[\(\.\?\d\)\+]])
+ latest_cpan = tostring(vim.fn.matchstr(latest_cpan, [[\(\.\?\d\)\+]]))
if latest_cpan:find('^%s*$') then
health.error('Cannot parse version number from cpanm output: ' .. latest_cpan)
return
@@ -205,7 +311,7 @@ local function perl()
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)
+ ok, current_cpan = cmd_ok(current_cpan_cmd)
if not ok then
health.error(
'Failed to run: ' .. table.concat(current_cpan_cmd, ' '),
@@ -243,9 +349,11 @@ local function python_exepath(invocation)
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.
+--- 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.
+---
+--- @return [string, string]
local function check_for_pyenv()
local pyenv_path = vim.fn.resolve(vim.fn.exepath('pyenv'))
@@ -258,7 +366,17 @@ local function check_for_pyenv()
local pyenv_root = vim.fn.resolve(os.getenv('PYENV_ROOT') or '')
if pyenv_root == '' then
- pyenv_root = vim.fn.system({ pyenv_path, 'root' })
+ local p = vim.system({ pyenv_path, 'root' }):wait()
+ if p.code ~= 0 then
+ local message = string.format(
+ 'pyenv: Failed to infer the root of pyenv by running `%s root` : %s. Ignoring pyenv for all following checks.',
+ pyenv_path,
+ p.stderr
+ )
+ health.warn(message)
+ return { '', '' }
+ end
+ pyenv_root = vim.trim(p.stdout)
health.info('pyenv: $PYENV_ROOT is not set. Infer from `pyenv root`.')
end
@@ -288,24 +406,29 @@ local function check_bin(bin)
return true
end
--- Fetch the contents of a URL.
+--- Fetch the contents of a URL.
+---
+--- @param url string
local function download(url)
local has_curl = vim.fn.executable('curl') == 1
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 })
+ local out, rc = system({ 'curl', '-sL', url }, { stderr = true, ignore_error = true })
if rc ~= 0 then
return 'curl error with ' .. url .. ': ' .. rc
else
return out
end
elseif vim.fn.executable('python') == 1 then
- local script = "try:\n\
- from urllib.request import urlopen\n\
- except ImportError:\n\
- from urllib2 import urlopen\n\
- response = urlopen('" .. url .. "')\n\
- print(response.read().decode('utf8'))\n"
- local out, rc = health._system({ 'python', '-c', script })
+ local script = ([[
+try:
+ from urllib.request import urlopen
+except ImportError:
+ from urllib2 import urlopen
+
+response = urlopen('%s')
+print(response.read().decode('utf8'))
+]]):format(url)
+ local out, rc = system({ 'python', '-c', script })
if out == '' and rc ~= 0 then
return 'python urllib.request error: ' .. rc
else
@@ -323,25 +446,24 @@ local function download(url)
return message
end
--- Get the latest Nvim Python client (pynvim) version from PyPI.
+--- 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
+ if not pcall_ok then
return 'error: ' .. pypi_response
end
+ local pypi_data = output
local pypi_element = pypi_data['info'] or {}
pypi_version = pypi_element['version'] or 'unable to parse'
end
return pypi_version
end
+--- @param s string
local function is_bad_response(s)
local lower = s:lower()
return vim.startswith(lower, 'unable')
@@ -349,20 +471,22 @@ local function is_bad_response(s)
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}
--- }
+--- 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.
+---
+--- @param python string
+---
+--- 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({
+ local python_version, rc = system({
python,
'-c',
'import sys; print(".".join(str(x) for x in sys.version_info[:3]))',
@@ -373,7 +497,7 @@ local function version_info(python)
end
local nvim_path
- nvim_path, rc = health._system({
+ nvim_path, rc = system({
python,
'-c',
'import sys; sys.path = [p for p in sys.path if p != ""]; import neovim; print(neovim.__file__)',
@@ -398,7 +522,7 @@ local function version_info(python)
-- Try to get neovim.VERSION (added in 0.1.11dev).
local nvim_version
- nvim_version, rc = health._system({
+ nvim_version, rc = system({
python,
'-c',
'from neovim import VERSION as v; print("{}.{}.{}{}".format(v.major, v.minor, v.patch, v.prerelease))',
@@ -406,9 +530,9 @@ local function version_info(python)
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))
+ local metas = vim.fn.glob(base .. '-*/METADATA', true, 1)
+ vim.list_extend(metas, vim.fn.glob(base .. '-*/PKG-INFO', true, 1))
+ vim.list_extend(metas, vim.fn.glob(base .. '.egg-info/PKG-INFO', true, 1))
metas = table.sort(metas, compare)
if metas and next(metas) ~= nil then
@@ -438,14 +562,13 @@ end
local function python()
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 = {}
+ local host_prog_var = 'python3_host_prog'
+ local python_multiple = {} ---@type string[]
- if health._provider_disabled(pyname) then
+ if provider_disabled('python3') then
return
end
@@ -458,8 +581,7 @@ local function python()
health.info(message)
end
- local pythonx_warnings
- pyname, pythonx_warnings = vim.provider.python.detect_by_module('neovim')
+ local pyname, pythonx_warnings = vim.provider.python.detect_by_module('neovim')
if not pyname then
health.warn(
@@ -487,7 +609,7 @@ local function python()
end
if pyenv ~= '' then
- python_exe = health._system({ pyenv, 'which', pyname }, { stderr = true })
+ python_exe = system({ pyenv, 'which', pyname }, { stderr = true })
if python_exe == '' then
health.warn('pyenv could not find ' .. pyname .. '.')
end
@@ -547,12 +669,7 @@ local function python()
)
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
+ local venv_root = pyenv_root ~= '' and pyenv_root or vim.fs.dirname(venv)
if vim.startswith(vim.fn.resolve(python_exe), venv_root .. '/') then
local advice = string.format(
@@ -637,9 +754,9 @@ local function python()
health.ok('no $VIRTUAL_ENV')
return
end
- local errors = {}
+ local errors = {} ---@type string[]
-- Keep hints as dict keys in order to discard duplicates.
- local hints = {}
+ local hints = {} ---@type table<string, boolean>
-- 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.
@@ -647,7 +764,7 @@ local function python()
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')
+ 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
@@ -710,9 +827,7 @@ local function python()
health.info(msg)
health.info(
'Python version: '
- .. health._system(
- 'python -c "import platform, sys; sys.stdout.write(platform.python_version())"'
- )
+ .. system('python -c "import platform, sys; sys.stdout.write(platform.python_version())"')
)
health.ok('$VIRTUAL_ENV provides :!python.')
end
@@ -721,7 +836,7 @@ end
local function ruby()
health.start('Ruby provider (optional)')
- if health._provider_disabled('ruby') then
+ if provider_disabled('ruby') then
return
end
@@ -732,7 +847,7 @@ local function ruby()
)
return
end
- health.info('Ruby: ' .. health._system({ 'ruby', '-v' }))
+ health.info('Ruby: ' .. system({ 'ruby', '-v' }))
local host, _ = vim.provider.ruby.detect()
if (not host) or host:find('^%s*$') then
@@ -748,7 +863,7 @@ local function ruby()
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, ' '))
+ local ok, latest_gem = cmd_ok(vim.split(latest_gem_cmd, ' '))
if not ok or latest_gem:find('^%s*$') then
health.error(
'Failed to run: ' .. latest_gem_cmd,
@@ -761,7 +876,7 @@ local function ruby()
local current_gem_cmd = { host, '--version' }
local current_gem
- ok, current_gem = health._cmd_ok(current_gem_cmd)
+ ok, current_gem = cmd_ok(current_gem_cmd)
if not ok then
health.error(
'Failed to run: ' .. table.concat(current_gem_cmd, ' '),
diff --git a/runtime/lua/vim/secure.lua b/runtime/lua/vim/secure.lua
index 41a3d3ba25..266725cce2 100644
--- a/runtime/lua/vim/secure.lua
+++ b/runtime/lua/vim/secure.lua
@@ -41,6 +41,7 @@ end
--- trusted. The user's choice is persisted in a trust database at
--- $XDG_STATE_HOME/nvim/trust.
---
+---@since 11
---@see |:trust|
---
---@param path (string) Path to a file to read.
@@ -126,6 +127,7 @@ end
---
--- The trust database is located at |$XDG_STATE_HOME|/nvim/trust.
---
+---@since 11
---@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
diff --git a/runtime/lua/vim/shared.lua b/runtime/lua/vim/shared.lua
index e9e4326057..4d06cdd77d 100644
--- a/runtime/lua/vim/shared.lua
+++ b/runtime/lua/vim/shared.lua
@@ -214,7 +214,7 @@ end
---@param t table<T, any> (table) Table
---@return T[] : List of keys
function vim.tbl_keys(t)
- vim.validate({ t = { t, 't' } })
+ vim.validate('t', t, 'table')
--- @cast t table<any,any>
local keys = {}
@@ -231,7 +231,7 @@ end
---@param t table<any, T> (table) Table
---@return T[] : List of values
function vim.tbl_values(t)
- vim.validate({ t = { t, 't' } })
+ vim.validate('t', t, 'table')
local values = {}
for _, v in
@@ -332,7 +332,7 @@ end
---@param value any Value to compare
---@return boolean `true` if `t` contains `value`
function vim.list_contains(t, value)
- vim.validate({ t = { t, 't' } })
+ vim.validate('t', t, 'table')
--- @cast t table<any,any>
for _, v in ipairs(t) do
@@ -350,41 +350,32 @@ end
---@param t table Table to check
---@return boolean `true` if `t` is empty
function vim.tbl_isempty(t)
- vim.validate({ t = { t, 't' } })
+ vim.validate('t', t, 'table')
return next(t) == nil
end
---- We only merge empty tables or tables that are not an array (indexed by integers)
+--- We only merge empty tables or tables that are not list-like (indexed by consecutive integers
+--- starting from 1)
local function can_merge(v)
- return type(v) == 'table' and (vim.tbl_isempty(v) or not vim.isarray(v))
+ return type(v) == 'table' and (vim.tbl_isempty(v) or not vim.islist(v))
end
-local function tbl_extend(behavior, deep_extend, ...)
- if behavior ~= 'error' and behavior ~= 'keep' and behavior ~= 'force' then
- error('invalid "behavior": ' .. tostring(behavior))
- end
-
- if select('#', ...) < 2 then
- error(
- 'wrong number of arguments (given '
- .. tostring(1 + select('#', ...))
- .. ', expected at least 3)'
- )
- end
-
+--- Recursive worker for tbl_extend
+--- @param behavior 'error'|'keep'|'force'
+--- @param deep_extend boolean
+--- @param ... table<any,any>
+local function tbl_extend_rec(behavior, deep_extend, ...)
local ret = {} --- @type table<any,any>
if vim._empty_dict_mt ~= nil and getmetatable(select(1, ...)) == vim._empty_dict_mt then
ret = vim.empty_dict()
end
for i = 1, select('#', ...) do
- local tbl = select(i, ...)
- vim.validate({ ['after the second argument'] = { tbl, 't' } })
- --- @cast tbl table<any,any>
+ local tbl = select(i, ...) --[[@as table<any,any>]]
if tbl then
for k, v in pairs(tbl) do
if deep_extend and can_merge(v) and can_merge(ret[k]) then
- ret[k] = tbl_extend(behavior, true, ret[k], v)
+ ret[k] = tbl_extend_rec(behavior, true, ret[k], v)
elseif behavior ~= 'force' and ret[k] ~= nil then
if behavior == 'error' then
error('key found in more than one map: ' .. k)
@@ -395,9 +386,31 @@ local function tbl_extend(behavior, deep_extend, ...)
end
end
end
+
return ret
end
+--- @param behavior 'error'|'keep'|'force'
+--- @param deep_extend boolean
+--- @param ... table<any,any>
+local function tbl_extend(behavior, deep_extend, ...)
+ if behavior ~= 'error' and behavior ~= 'keep' and behavior ~= 'force' then
+ error('invalid "behavior": ' .. tostring(behavior))
+ end
+
+ local nargs = select('#', ...)
+
+ if nargs < 2 then
+ error(('wrong number of arguments (given %d, expected at least 3)'):format(1 + nargs))
+ end
+
+ for i = 1, nargs do
+ vim.validate('after the second argument', select(i, ...), 'table')
+ end
+
+ return tbl_extend_rec(behavior, deep_extend, ...)
+end
+
--- Merges two or more tables.
---
---@see |extend()|
@@ -414,6 +427,11 @@ end
--- Merges recursively two or more tables.
---
+--- Only values that are empty tables or tables that are not |lua-list|s (indexed by consecutive
+--- integers starting from 1) are merged recursively. This is useful for merging nested tables
+--- like default and user configurations where lists should be treated as literals (i.e., are
+--- overwritten instead of merged).
+---
---@see |vim.tbl_extend()|
---
---@generic T1: table
@@ -580,7 +598,7 @@ end
---@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', ('expected table, got %s'):format(type(t)))
+ vim.validate('t', t, 'table')
--- @cast t table<any,any>
-- collect the keys
@@ -691,7 +709,7 @@ end
---@param t table Table
---@return integer : Number of non-nil values in table
function vim.tbl_count(t)
- vim.validate({ t = { t, 't' } })
+ vim.validate('t', t, 'table')
--- @cast t table<any,any>
local count = 0
@@ -723,7 +741,7 @@ end
---@param s string String to trim
---@return string String with whitespace removed from its beginning and end
function vim.trim(s)
- vim.validate({ s = { s, 's' } })
+ vim.validate('s', s, 'string')
return s:match('^%s*(.*%S)') or ''
end
@@ -733,7 +751,7 @@ end
---@param s string String to escape
---@return string %-escaped pattern string
function vim.pesc(s)
- vim.validate({ s = { s, 's' } })
+ vim.validate('s', s, 'string')
return (s:gsub('[%(%)%.%%%+%-%*%?%[%]%^%$]', '%%%1'))
end
@@ -743,7 +761,8 @@ end
---@param prefix string Prefix to match
---@return boolean `true` if `prefix` is a prefix of `s`
function vim.startswith(s, prefix)
- vim.validate({ s = { s, 's' }, prefix = { prefix, 's' } })
+ vim.validate('s', s, 'string')
+ vim.validate('prefix', prefix, 'string')
return s:sub(1, #prefix) == prefix
end
@@ -753,7 +772,8 @@ end
---@param suffix string Suffix to match
---@return boolean `true` if `suffix` is a suffix of `s`
function vim.endswith(s, suffix)
- vim.validate({ s = { s, 's' }, suffix = { suffix, 's' } })
+ vim.validate('s', s, 'string')
+ vim.validate('suffix', suffix, 'string')
return #suffix == 0 or s:sub(-#suffix) == suffix
end
@@ -787,7 +807,7 @@ do
}
--- @nodoc
- --- @class vim.validate.Spec {[1]: any, [2]: string|string[], [3]: boolean }
+ --- @class vim.validate.Spec [any, string|string[], boolean]
--- @field [1] any Argument value
--- @field [2] string|string[]|fun(v:any):boolean, string? Type name, or callable
--- @field [3]? boolean
@@ -877,8 +897,30 @@ do
return true
end
- --- Validates a parameter specification (types and values). Specs are evaluated in alphanumeric
- --- order, until the first failure.
+ --- Validate function arguments.
+ ---
+ --- This function has two valid forms:
+ ---
+ --- 1. vim.validate(name: str, value: any, type: string, optional?: bool)
+ --- 2. vim.validate(spec: table)
+ ---
+ --- Form 1 validates that argument {name} with value {value} has the type
+ --- {type}. {type} must be a value returned by |lua-type()|. If {optional} is
+ --- true, then {value} may be null. This form is significantly faster and
+ --- should be preferred for simple cases.
+ ---
+ --- Example:
+ ---
+ --- ```lua
+ --- function vim.startswith(s, prefix)
+ --- vim.validate('s', s, 'string')
+ --- vim.validate('prefix', prefix, 'string')
+ --- ...
+ --- end
+ --- ```
+ ---
+ --- Form 2 validates a parameter specification (types and values). Specs are
+ --- evaluated in alphanumeric order, until the first failure.
---
--- Usage example:
---
@@ -930,8 +972,32 @@ do
--- only if the argument is valid. Can optionally return an additional
--- informative error message as the second returned value.
--- - msg: (optional) error string if validation fails
- function vim.validate(opt)
- local ok, err_msg = is_valid(opt)
+ --- @overload fun(name: string, val: any, expected: string, optional?: boolean)
+ function vim.validate(opt, ...)
+ local ok = false
+ local err_msg ---@type string?
+ local narg = select('#', ...)
+ if narg == 0 then
+ ok, err_msg = is_valid(opt)
+ elseif narg >= 2 then
+ -- Overloaded signature for fast/simple cases
+ local name = opt --[[@as string]]
+ local v, expected, optional = ... ---@type string, string, boolean?
+ local actual = type(v)
+
+ ok = (actual == expected) or (v == nil and optional == true)
+ if not ok then
+ err_msg = ('%s: expected %s, got %s%s'):format(
+ name,
+ expected,
+ actual,
+ v and (' (%s)'):format(v) or ''
+ )
+ end
+ else
+ error('invalid arguments')
+ end
+
if not ok then
error(err_msg, 2)
end
@@ -949,7 +1015,7 @@ function vim.is_callable(f)
if m == nil then
return false
end
- return type(m.__call) == 'function'
+ return type(rawget(m, '__call')) == 'function'
end
--- Creates a table whose missing keys are provided by {createfn} (like Python's "defaultdict").
@@ -1091,4 +1157,165 @@ function vim._defer_require(root, mod)
})
end
+--- @nodoc
+--- @class vim.context.mods
+--- @field bo? table<string, any>
+--- @field buf? integer
+--- @field emsg_silent? boolean
+--- @field env? table<string, any>
+--- @field go? table<string, any>
+--- @field hide? boolean
+--- @field keepalt? boolean
+--- @field keepjumps? boolean
+--- @field keepmarks? boolean
+--- @field keeppatterns? boolean
+--- @field lockmarks? boolean
+--- @field noautocmd? boolean
+--- @field o? table<string, any>
+--- @field sandbox? boolean
+--- @field silent? boolean
+--- @field unsilent? boolean
+--- @field win? integer
+--- @field wo? table<string, any>
+
+--- @nodoc
+--- @class vim.context.state
+--- @field bo? table<string, any>
+--- @field env? table<string, any>
+--- @field go? table<string, any>
+--- @field wo? table<string, any>
+
+local scope_map = { buf = 'bo', global = 'go', win = 'wo' }
+local scope_order = { 'o', 'wo', 'bo', 'go', 'env' }
+local state_restore_order = { 'bo', 'wo', 'go', 'env' }
+
+--- Gets data about current state, enough to properly restore specified options/env/etc.
+--- @param context vim.context.mods
+--- @return vim.context.state
+local get_context_state = function(context)
+ local res = { bo = {}, env = {}, go = {}, wo = {} }
+
+ -- Use specific order from possibly most to least intrusive
+ for _, scope in ipairs(scope_order) do
+ for name, _ in pairs(context[scope] or {}) do
+ local sc = scope == 'o' and scope_map[vim.api.nvim_get_option_info2(name, {}).scope] or scope
+
+ -- Do not override already set state and fall back to `vim.NIL` for
+ -- state `nil` values (which still needs restoring later)
+ res[sc][name] = res[sc][name] or vim[sc][name] or vim.NIL
+
+ -- Always track global option value to properly restore later.
+ -- This matters for at least `o` and `wo` (which might set either/both
+ -- local and global option values).
+ if sc ~= 'env' then
+ res.go[name] = res.go[name] or vim.go[name]
+ end
+ end
+ end
+
+ return res
+end
+
+--- Executes function `f` with the given context specification.
+---
+--- Notes:
+--- - Context `{ buf = buf }` has no guarantees about current window when
+--- inside context.
+--- - Context `{ buf = buf, win = win }` is yet not allowed, but this seems
+--- to be an implementation detail.
+--- - There should be no way to revert currently set `context.sandbox = true`
+--- (like with nested `vim._with()` calls). Otherwise it kind of breaks the
+--- whole purpose of sandbox execution.
+--- - Saving and restoring option contexts (`bo`, `go`, `o`, `wo`) trigger
+--- `OptionSet` events. This is an implementation issue because not doing it
+--- seems to mean using either 'eventignore' option or extra nesting with
+--- `{ noautocmd = true }` (which itself is a wrapper for 'eventignore').
+--- As `{ go = { eventignore = '...' } }` is a valid context which should be
+--- properly set and restored, this is not a good approach.
+--- Not triggering `OptionSet` seems to be a good idea, though. So probably
+--- only moving context save and restore to lower level might resolve this.
+---
+--- @param context vim.context.mods
+--- @param f function
+--- @return any
+function vim._with(context, f)
+ vim.validate('context', context, 'table')
+ vim.validate('f', f, 'function')
+
+ vim.validate('context.bo', context.bo, 'table', true)
+ vim.validate('context.buf', context.buf, 'number', true)
+ vim.validate('context.emsg_silent', context.emsg_silent, 'boolean', true)
+ vim.validate('context.env', context.env, 'table', true)
+ vim.validate('context.go', context.go, 'table', true)
+ vim.validate('context.hide', context.hide, 'boolean', true)
+ vim.validate('context.keepalt', context.keepalt, 'boolean', true)
+ vim.validate('context.keepjumps', context.keepjumps, 'boolean', true)
+ vim.validate('context.keepmarks', context.keepmarks, 'boolean', true)
+ vim.validate('context.keeppatterns', context.keeppatterns, 'boolean', true)
+ vim.validate('context.lockmarks', context.lockmarks, 'boolean', true)
+ vim.validate('context.noautocmd', context.noautocmd, 'boolean', true)
+ vim.validate('context.o', context.o, 'table', true)
+ vim.validate('context.sandbox', context.sandbox, 'boolean', true)
+ vim.validate('context.silent', context.silent, 'boolean', true)
+ vim.validate('context.unsilent', context.unsilent, 'boolean', true)
+ vim.validate('context.win', context.win, 'number', true)
+ vim.validate('context.wo', context.wo, 'table', true)
+
+ -- Check buffer exists
+ if context.buf then
+ if not vim.api.nvim_buf_is_valid(context.buf) then
+ error('Invalid buffer id: ' .. context.buf)
+ end
+ end
+
+ -- Check window exists
+ if context.win then
+ if not vim.api.nvim_win_is_valid(context.win) then
+ error('Invalid window id: ' .. context.win)
+ end
+ -- TODO: Maybe allow it?
+ if context.buf and vim.api.nvim_win_get_buf(context.win) ~= context.buf then
+ error('Can not set both `buf` and `win` context.')
+ end
+ end
+
+ -- Decorate so that save-set-restore options is done in correct window-buffer
+ local callback = function()
+ -- Cache current values to be changed by context
+ -- Abort early in case of bad context value
+ local ok, state = pcall(get_context_state, context)
+ if not ok then
+ error(state, 0)
+ end
+
+ -- Apply some parts of the context in specific order
+ -- NOTE: triggers `OptionSet` event
+ for _, scope in ipairs(scope_order) do
+ for name, context_value in pairs(context[scope] or {}) do
+ vim[scope][name] = context_value
+ end
+ end
+
+ -- Execute
+ local res = { pcall(f) }
+
+ -- Restore relevant cached values in specific order, global scope last
+ -- NOTE: triggers `OptionSet` event
+ for _, scope in ipairs(state_restore_order) do
+ for name, cached_value in pairs(state[scope]) do
+ vim[scope][name] = cached_value
+ end
+ end
+
+ -- Return
+ if not res[1] then
+ error(res[2], 0)
+ end
+ table.remove(res, 1)
+ return unpack(res, 1, table.maxn(res))
+ end
+
+ return vim._with_c(context, callback)
+end
+
return vim
diff --git a/runtime/lua/vim/snippet.lua b/runtime/lua/vim/snippet.lua
index 3d8f73f362..af7e3c6d33 100644
--- a/runtime/lua/vim/snippet.lua
+++ b/runtime/lua/vim/snippet.lua
@@ -2,6 +2,8 @@ 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'
+local jump_forward_key = '<tab>'
+local jump_backward_key = '<s-tab>'
--- Returns the 0-based cursor position.
---
@@ -182,6 +184,8 @@ end
--- @field extmark_id integer
--- @field tabstops table<integer, vim.snippet.Tabstop[]>
--- @field current_tabstop vim.snippet.Tabstop
+--- @field tab_keymaps { i: table<string, any>?, s: table<string, any>? }
+--- @field shift_tab_keymaps { i: table<string, any>?, s: table<string, any>? }
local Session = {}
--- Creates a new snippet session in the current buffer.
@@ -197,6 +201,8 @@ function Session.new(bufnr, snippet_extmark, tabstop_data)
extmark_id = snippet_extmark,
tabstops = {},
current_tabstop = Tabstop.new(0, bufnr, { 0, 0, 0, 0 }),
+ tab_keymaps = { i = nil, s = nil },
+ shift_tab_keymaps = { i = nil, s = nil },
}, { __index = Session })
-- Create the tabstops.
@@ -207,9 +213,64 @@ function Session.new(bufnr, snippet_extmark, tabstop_data)
end
end
+ self:set_keymaps()
+
return self
end
+--- Sets the snippet navigation keymaps.
+---
+--- @package
+function Session:set_keymaps()
+ local function maparg(key, mode)
+ local map = vim.fn.maparg(key, mode, false, true) --[[ @as table ]]
+ if not vim.tbl_isempty(map) and map.buffer == 1 then
+ return map
+ else
+ return nil
+ end
+ end
+
+ local function set(jump_key, direction)
+ vim.keymap.set({ 'i', 's' }, jump_key, function()
+ return vim.snippet.active({ direction = direction })
+ and '<cmd>lua vim.snippet.jump(' .. direction .. ')<cr>'
+ or jump_key
+ end, { expr = true, silent = true, buffer = self.bufnr })
+ end
+
+ self.tab_keymaps = {
+ i = maparg(jump_forward_key, 'i'),
+ s = maparg(jump_forward_key, 's'),
+ }
+ self.shift_tab_keymaps = {
+ i = maparg(jump_backward_key, 'i'),
+ s = maparg(jump_backward_key, 's'),
+ }
+ set(jump_forward_key, 1)
+ set(jump_backward_key, -1)
+end
+
+--- Restores/deletes the keymaps used for snippet navigation.
+---
+--- @package
+function Session:restore_keymaps()
+ local function restore(keymap, lhs, mode)
+ if keymap then
+ vim._with({ buf = self.bufnr }, function()
+ vim.fn.mapset(keymap)
+ end)
+ else
+ vim.api.nvim_buf_del_keymap(self.bufnr, mode, lhs)
+ end
+ end
+
+ restore(self.tab_keymaps.i, jump_forward_key, 'i')
+ restore(self.tab_keymaps.s, jump_forward_key, 's')
+ restore(self.shift_tab_keymaps.i, jump_backward_key, 'i')
+ restore(self.shift_tab_keymaps.s, jump_backward_key, 's')
+end
+
--- Returns the destination tabstop index when jumping in the given direction.
---
--- @package
@@ -315,7 +376,7 @@ local function select_tabstop(tabstop)
move_cursor_to(range[1] + 1, range[2] + 1)
feedkeys('v')
move_cursor_to(range[3] + 1, range[4])
- feedkeys('o<c-g>')
+ feedkeys('o<c-g><c-r>_')
end
end
@@ -395,6 +456,15 @@ local function setup_autocmds(bufnr)
end
end,
})
+
+ vim.api.nvim_create_autocmd('BufLeave', {
+ group = snippet_group,
+ desc = 'Stop the snippet session when leaving the buffer',
+ buffer = bufnr,
+ callback = function()
+ M.stop()
+ end,
+ })
end
--- Expands the given snippet text.
@@ -444,7 +514,7 @@ function M.expand(input)
local snippet_lines = text_to_lines(snippet_text)
-- Get the base indentation based on the current line and the last line of the snippet.
if #snippet_lines > 0 then
- base_indent = base_indent .. (snippet_lines[#snippet_lines]:match('(^%s*)%S') or '') --- @type string
+ base_indent = base_indent .. (snippet_lines[#snippet_lines]:match('(^%s+)%S') or '') --- @type string
end
local shiftwidth = vim.fn.shiftwidth()
@@ -539,7 +609,7 @@ end
--- ```lua
--- vim.keymap.set({ 'i', 's' }, '<Tab>', function()
--- if vim.snippet.active({ direction = 1 }) then
---- return '<cmd>lua vim.snippet.jump(1)<cr>'
+--- return '<Cmd>lua vim.snippet.jump(1)<CR>'
--- else
--- return '<Tab>'
--- end
@@ -591,7 +661,7 @@ end
--- ```lua
--- vim.keymap.set({ 'i', 's' }, '<Tab>', function()
--- if vim.snippet.active({ direction = 1 }) then
---- return '<cmd>lua vim.snippet.jump(1)<cr>'
+--- return '<Cmd>lua vim.snippet.jump(1)<CR>'
--- else
--- return '<Tab>'
--- end
@@ -619,6 +689,8 @@ function M.stop()
return
end
+ M._session:restore_keymaps()
+
vim.api.nvim_clear_autocmds({ group = snippet_group, buffer = M._session.bufnr })
vim.api.nvim_buf_clear_namespace(M._session.bufnr, snippet_ns, 0, -1)
diff --git a/runtime/lua/vim/text.lua b/runtime/lua/vim/text.lua
index bc90d490aa..d45c8021c6 100644
--- a/runtime/lua/vim/text.lua
+++ b/runtime/lua/vim/text.lua
@@ -7,10 +7,9 @@ local M = {}
--- @param str string String to encode
--- @return string : Hex encoded string
function M.hexencode(str)
- local bytes = { str:byte(1, #str) }
local enc = {} ---@type string[]
- for i = 1, #bytes do
- enc[i] = string.format('%02X', bytes[i])
+ for i = 1, #str do
+ enc[i] = string.format('%02X', str:byte(i, i + 1))
end
return table.concat(enc)
end
@@ -18,15 +17,19 @@ end
--- Hex decode a string.
---
--- @param enc string String to decode
---- @return string : Decoded string
+--- @return string? : Decoded string
+--- @return string? : Error message, if any
function M.hexdecode(enc)
- assert(#enc % 2 == 0, 'string must have an even number of hex characters')
+ if #enc % 2 ~= 0 then
+ return nil, 'string must have an even number of hex characters'
+ end
+
local str = {} ---@type string[]
for i = 1, #enc, 2 do
local n = assert(tonumber(enc:sub(i, i + 1), 16))
str[#str + 1] = string.char(n)
end
- return table.concat(str)
+ return table.concat(str), nil
end
return M
diff --git a/runtime/lua/vim/treesitter.lua b/runtime/lua/vim/treesitter.lua
index db544c1ab1..ed7d31e1f7 100644
--- a/runtime/lua/vim/treesitter.lua
+++ b/runtime/lua/vim/treesitter.lua
@@ -76,36 +76,48 @@ end
---
--- If needed, this will create the parser.
---
+--- If no parser can be created, an error is thrown. Set `opts.error = false` to suppress this and
+--- return nil (and an error message) instead. WARNING: This behavior will become default in Nvim
+--- 0.12 and the option will be removed.
+---
---@param bufnr (integer|nil) Buffer the parser should be tied to (default: current buffer)
---@param lang (string|nil) Language of this parser (default: from buffer filetype)
---@param opts (table|nil) Options to pass to the created language tree
---
----@return vim.treesitter.LanguageTree object to use for parsing
+---@return vim.treesitter.LanguageTree? object to use for parsing
+---@return string? error message, if applicable
function M.get_parser(bufnr, lang, opts)
opts = opts or {}
+ local should_error = opts.error == nil or opts.error
if bufnr == nil or bufnr == 0 then
bufnr = api.nvim_get_current_buf()
end
if not valid_lang(lang) then
- lang = M.language.get_lang(vim.bo[bufnr].filetype) or vim.bo[bufnr].filetype
+ lang = M.language.get_lang(vim.bo[bufnr].filetype)
end
if not valid_lang(lang) then
if not parsers[bufnr] then
- error(
- string.format(
- 'There is no parser available for buffer %d and one could not be'
- .. ' created because lang could not be determined. Either pass lang'
- .. ' or set the buffer filetype',
- bufnr
- )
- )
+ local err_msg =
+ string.format('Parser not found for buffer %s: language could not be determined', bufnr)
+ if should_error then
+ error(err_msg)
+ end
+ return nil, err_msg
end
elseif parsers[bufnr] == nil or parsers[bufnr]:lang() ~= lang then
- assert(lang, 'lang should be valid')
- parsers[bufnr] = M._create_parser(bufnr, lang, opts)
+ local parser = vim.F.npcall(M._create_parser, bufnr, lang, opts)
+ if not parser then
+ local err_msg =
+ string.format('Parser could not be created for buffer %s and language "%s"', bufnr, lang)
+ if should_error then
+ error(err_msg)
+ end
+ return nil, err_msg
+ end
+ parsers[bufnr] = parser
end
parsers[bufnr]:register_cbs(opts.buf_attach_cbs)
@@ -140,16 +152,8 @@ function M.is_ancestor(dest, source)
return false
end
- local current = source ---@type TSNode?
- while current ~= nil do
- if current == dest then
- return true
- end
-
- current = current:parent()
- end
-
- return false
+ -- child_containing_descendant returns nil if dest is a direct parent
+ return source:parent() == dest or dest:child_containing_descendant(source) ~= nil
end
--- Returns the node's range or an unpacked range table
@@ -257,7 +261,7 @@ end
---@param row integer Position row
---@param col integer Position column
---
----@return {capture: string, lang: string, metadata: table}[]
+---@return {capture: string, lang: string, metadata: vim.treesitter.query.TSMetadata}[]
function M.get_captures_at_pos(bufnr, row, col)
if bufnr == 0 then
bufnr = api.nvim_get_current_buf()
@@ -335,13 +339,16 @@ end
---
--- 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 }?
+--- @field pos [integer, integer]?
---
--- Parser language. (default: from buffer filetype)
--- @field lang string?
---
--- Ignore injected languages (default true)
--- @field ignore_injections boolean?
+---
+--- Include anonymous nodes (default false)
+--- @field include_anonymous boolean?
--- Returns the smallest named node at the given position
---
@@ -383,11 +390,14 @@ function M.get_node(opts)
local ts_range = { row, col, row, col }
- local root_lang_tree = M.get_parser(bufnr, opts.lang)
+ local root_lang_tree = M.get_parser(bufnr, opts.lang, { error = false })
if not root_lang_tree then
return
end
+ if opts.include_anonymous then
+ return root_lang_tree:node_for_range(ts_range, opts)
+ end
return root_lang_tree:named_node_for_range(ts_range, opts)
end
@@ -413,7 +423,7 @@ end
---@param lang (string|nil) Language of the parser (default: from buffer filetype)
function M.start(bufnr, lang)
bufnr = bufnr or api.nvim_get_current_buf()
- local parser = M.get_parser(bufnr, lang)
+ local parser = assert(M.get_parser(bufnr, lang, { error = false }))
M.highlighter.new(parser)
end
@@ -437,6 +447,7 @@ end
---
--- Can also be shown with `:InspectTree`. [:InspectTree]()
---
+---@since 11
---@param opts table|nil Optional options table with the following possible keys:
--- - lang (string|nil): The language of the source buffer. If omitted, detect
--- from the filetype of the source buffer.
@@ -460,6 +471,7 @@ end
--- vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
--- ```
---
+---@since 11
---@param lnum integer|nil Line number to calculate fold level for
---@return string
function M.foldexpr(lnum)
diff --git a/runtime/lua/vim/treesitter/_fold.lua b/runtime/lua/vim/treesitter/_fold.lua
index eecf1ad6b1..7237d2e7d4 100644
--- a/runtime/lua/vim/treesitter/_fold.lua
+++ b/runtime/lua/vim/treesitter/_fold.lua
@@ -87,7 +87,7 @@ end
---@param srow integer
---@param erow integer 0-indexed, exclusive
function FoldInfo:add_range(srow, erow)
- list_insert(self.levels, srow + 1, erow, '=')
+ list_insert(self.levels, srow + 1, erow, -1)
list_insert(self.levels0, srow + 1, erow, -1)
end
@@ -114,7 +114,7 @@ local function compute_folds_levels(bufnr, info, srow, erow, parse_injections)
srow = srow or 0
erow = erow or api.nvim_buf_line_count(bufnr)
- local parser = ts.get_parser(bufnr)
+ local parser = assert(ts.get_parser(bufnr, nil, { error = false }))
parser:parse(parse_injections and { srow, erow } or nil)
@@ -131,24 +131,18 @@ local function compute_folds_levels(bufnr, info, srow, erow, parse_injections)
-- Collect folds starting from srow - 1, because we should first subtract the folds that end at
-- srow - 1 from the level of srow - 1 to get accurate level of srow.
- for _, match, metadata in
- query:iter_matches(tree:root(), bufnr, math.max(srow - 1, 0), erow, { all = true })
- do
+ for _, match, metadata in query:iter_matches(tree:root(), bufnr, math.max(srow - 1, 0), erow) do
for id, nodes in pairs(match) do
if query.captures[id] == 'fold' then
local range = ts.get_range(nodes[1], bufnr, metadata[id])
local start, _, stop, stop_col = Range.unpack4(range)
- for i = 2, #nodes, 1 do
- local node_range = ts.get_range(nodes[i], bufnr, metadata[id])
- local node_start, _, node_stop, node_stop_col = Range.unpack4(node_range)
- if node_start < start then
- start = node_start
- end
- if node_stop > stop then
- stop = node_stop
- stop_col = node_stop_col
- end
+ if #nodes > 1 then
+ -- assumes nodes are ordered by range
+ local end_range = ts.get_range(nodes[#nodes], bufnr, metadata[id])
+ local _, _, end_stop, end_stop_col = Range.unpack4(end_range)
+ stop = end_stop
+ stop_col = end_stop_col
end
if stop_col == 0 then
@@ -268,6 +262,15 @@ end
---@package
function FoldInfo:do_foldupdate(bufnr)
+ -- InsertLeave is not executed when <C-C> is used for exiting the insert mode, leaving
+ -- do_foldupdate untouched. If another execution of foldupdate consumes foldupdate_range, the
+ -- InsertLeave do_foldupdate gets nil foldupdate_range. In that case, skip the update. This is
+ -- correct because the update that consumed the range must have incorporated the range that
+ -- InsertLeave meant to update.
+ if not self.foldupdate_range then
+ return
+ end
+
local srow, erow = self.foldupdate_range[1], self.foldupdate_range[2]
self.foldupdate_range = nil
for _, win in ipairs(vim.fn.win_findbuf(bufnr)) do
@@ -383,14 +386,13 @@ local function on_bytes(bufnr, foldinfo, start_row, start_col, old_row, old_col,
end
end
----@package
---@param lnum integer|nil
---@return string
function M.foldexpr(lnum)
lnum = lnum or vim.v.lnum
local bufnr = api.nvim_get_current_buf()
- local parser = vim.F.npcall(ts.get_parser, bufnr)
+ local parser = ts.get_parser(bufnr, nil, { error = false })
if not parser then
return '0'
end
diff --git a/runtime/lua/vim/treesitter/_meta.lua b/runtime/lua/vim/treesitter/_meta.lua
deleted file mode 100644
index 177699a207..0000000000
--- a/runtime/lua/vim/treesitter/_meta.lua
+++ /dev/null
@@ -1,113 +0,0 @@
----@meta
-error('Cannot require a meta file')
-
----@class TSNode: userdata
----@field id fun(self: TSNode): string
----@field tree fun(self: TSNode): TSTree
----@field range fun(self: TSNode, include_bytes: false?): integer, integer, integer, integer
----@field range fun(self: TSNode, include_bytes: true): integer, integer, integer, integer, integer, integer
----@field start fun(self: TSNode): integer, integer, integer
----@field end_ fun(self: TSNode): integer, integer, integer
----@field type fun(self: TSNode): string
----@field symbol fun(self: TSNode): integer
----@field named fun(self: TSNode): boolean
----@field missing fun(self: TSNode): boolean
----@field extra fun(self: TSNode): boolean
----@field child_count fun(self: TSNode): integer
----@field named_child_count fun(self: TSNode): integer
----@field child fun(self: TSNode, index: integer): TSNode?
----@field named_child fun(self: TSNode, index: integer): TSNode?
----@field descendant_for_range fun(self: TSNode, start_row: integer, start_col: integer, end_row: integer, end_col: integer): TSNode?
----@field named_descendant_for_range fun(self: TSNode, start_row: integer, start_col: integer, end_row: integer, end_col: integer): TSNode?
----@field parent fun(self: TSNode): TSNode?
----@field child_containing_descendant fun(self: TSNode, descendant: TSNode): TSNode?
----@field next_sibling fun(self: TSNode): TSNode?
----@field prev_sibling fun(self: TSNode): TSNode?
----@field next_named_sibling fun(self: TSNode): TSNode?
----@field prev_named_sibling fun(self: TSNode): TSNode?
----@field named_children fun(self: TSNode): TSNode[]
----@field has_changes fun(self: TSNode): boolean
----@field has_error fun(self: TSNode): boolean
----@field sexpr fun(self: TSNode): string
----@field equal fun(self: TSNode, other: TSNode): boolean
----@field iter_children fun(self: TSNode): fun(): TSNode, string
----@field field fun(self: TSNode, name: string): TSNode[]
----@field byte_length fun(self: TSNode): integer
-local TSNode = {}
-
----@alias TSLoggerCallback fun(logtype: 'parse'|'lex', msg: string)
-
----@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)[])
----@field set_timeout fun(self: TSParser, timeout: integer)
----@field timeout fun(self: TSParser): integer
----@field _set_logger fun(self: TSParser, lex: boolean, parse: boolean, cb: TSLoggerCallback)
----@field _logger fun(self: TSParser): TSLoggerCallback
-
----@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)[][]>
-
---- @param lang string
-vim._ts_inspect_language = function(lang) end
-
----@return integer
-vim._ts_get_language_version = function() end
-
---- @param path string
---- @param lang string
---- @param symbol_name? string
-vim._ts_add_language = function(path, lang, symbol_name) 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
-
---- @class TSQueryMatch: userdata
---- @field captures fun(self: TSQueryMatch): table<integer,TSNode[]>
-local TSQueryMatch = {}
-
---- @return integer match_id
---- @return integer pattern_index
-function TSQueryMatch:info() end
-
---- @class TSQueryCursor: userdata
---- @field remove_match fun(self: TSQueryCursor, id: integer)
-local TSQueryCursor = {}
-
---- @return integer capture
---- @return TSNode captured_node
---- @return TSQueryMatch match
-function TSQueryCursor:next_capture() end
-
---- @return TSQueryMatch match
-function TSQueryCursor:next_match() end
-
---- @param node TSNode
---- @param query TSQuery
---- @param start integer?
---- @param stop integer?
---- @param opts? { max_start_depth?: integer, match_limit?: integer}
---- @return TSQueryCursor
-function vim._create_ts_querycursor(node, query, start, stop, opts) end
diff --git a/runtime/lua/vim/treesitter/_meta/misc.lua b/runtime/lua/vim/treesitter/_meta/misc.lua
new file mode 100644
index 0000000000..33701ef254
--- /dev/null
+++ b/runtime/lua/vim/treesitter/_meta/misc.lua
@@ -0,0 +1,78 @@
+---@meta
+-- luacheck: no unused args
+error('Cannot require a meta file')
+
+---@alias TSLoggerCallback fun(logtype: 'parse'|'lex', msg: string)
+
+---@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)[])
+---@field set_timeout fun(self: TSParser, timeout: integer)
+---@field timeout fun(self: TSParser): integer
+---@field _set_logger fun(self: TSParser, lex: boolean, parse: boolean, cb: TSLoggerCallback)
+---@field _logger fun(self: TSParser): TSLoggerCallback
+
+---@class TSQuery: userdata
+---@field inspect fun(self: TSQuery): TSQueryInfo
+
+---@class (exact) TSQueryInfo
+---@field captures string[]
+---@field patterns table<integer, (integer|string)[][]>
+
+--- @param lang string
+--- @return table
+vim._ts_inspect_language = function(lang) end
+
+---@return integer
+vim._ts_get_language_version = function() end
+
+--- @param path string
+--- @param lang string
+--- @param symbol_name? string
+vim._ts_add_language_from_object = function(path, lang, symbol_name) end
+
+--- @param path string
+--- @param lang string
+vim._ts_add_language_from_wasm = function(path, lang) 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
+
+--- @class TSQueryMatch: userdata
+--- @field captures fun(self: TSQueryMatch): table<integer,TSNode[]>
+local TSQueryMatch = {} -- luacheck: no unused
+
+--- @return integer match_id
+--- @return integer pattern_index
+function TSQueryMatch:info() end
+
+--- @class TSQueryCursor: userdata
+--- @field remove_match fun(self: TSQueryCursor, id: integer)
+local TSQueryCursor = {} -- luacheck: no unused
+
+--- @return integer capture
+--- @return TSNode captured_node
+--- @return TSQueryMatch match
+function TSQueryCursor:next_capture() end
+
+--- @return TSQueryMatch match
+function TSQueryCursor:next_match() end
+
+--- @param node TSNode
+--- @param query TSQuery
+--- @param start integer?
+--- @param stop integer?
+--- @param opts? { max_start_depth?: integer, match_limit?: integer}
+--- @return TSQueryCursor
+function vim._create_ts_querycursor(node, query, start, stop, opts) end
diff --git a/runtime/lua/vim/treesitter/_meta/tsnode.lua b/runtime/lua/vim/treesitter/_meta/tsnode.lua
new file mode 100644
index 0000000000..acc9f8d24e
--- /dev/null
+++ b/runtime/lua/vim/treesitter/_meta/tsnode.lua
@@ -0,0 +1,185 @@
+---@meta
+-- luacheck: no unused args
+error('Cannot require a meta file')
+
+--- @brief 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 treesitter library.
+---
+--- An instance `TSNode` of a treesitter node supports the following methods.
+
+---@nodoc
+---@class TSNode: userdata
+---@field named_children fun(self: TSNode): TSNode[]
+---@field __has_ancestor fun(self: TSNode, node_types: string[]): boolean
+local TSNode = {} -- luacheck: no unused
+
+--- Get the node's immediate parent.
+--- Prefer |TSNode:child_containing_descendant()|
+--- for iterating over the node's ancestors.
+--- @return TSNode?
+function TSNode:parent() end
+
+--- Get the node's next sibling.
+--- @return TSNode?
+function TSNode:next_sibling() end
+
+--- Get the node's previous sibling.
+--- @return TSNode?
+function TSNode:prev_sibling() end
+
+--- Get the node's next named sibling.
+--- @return TSNode?
+function TSNode:next_named_sibling() end
+
+--- Get the node's previous named sibling.
+--- @return TSNode?
+function TSNode:prev_named_sibling() end
+
+--- Iterates over all the direct children of {TSNode}, regardless of whether
+--- they are named or not.
+--- Returns the child node plus the eventual field name corresponding to this
+--- child node.
+--- @return fun(): TSNode, string
+function TSNode:iter_children() end
+
+--- Returns a table of the nodes corresponding to the {name} field.
+--- @param name string
+--- @return TSNode[]
+function TSNode:field(name) end
+
+--- Get the node's number of children.
+--- @return integer
+function TSNode:child_count() end
+
+--- Get the node's child at the given {index}, where zero represents the first
+--- child.
+--- @param index integer
+--- @return TSNode?
+function TSNode:child(index) end
+
+--- Get the node's number of named children.
+--- @return integer
+function TSNode:named_child_count() end
+
+--- Get the node's named child at the given {index}, where zero represents the
+--- first named child.
+--- @param index integer
+--- @return TSNode?
+function TSNode:named_child(index) end
+
+--- Get the node's child that contains {descendant}.
+--- @param descendant TSNode
+--- @return TSNode?
+function TSNode:child_containing_descendant(descendant) end
+
+--- Get the node's start position. Return three values: the row, column and
+--- total byte count (all zero-based).
+--- @return integer, integer, integer
+function TSNode:start() end
+
+--- Get the node's end position. Return three values: the row, column and
+--- total byte count (all zero-based).
+--- @return integer, integer, integer
+function TSNode:end_() end
+
+--- Get the range of the node.
+---
+--- Return four or six values:
+---
+--- - start row
+--- - start column
+--- - start byte (if {include_bytes} is `true`)
+--- - end row
+--- - end column
+--- - end byte (if {include_bytes} is `true`)
+--- @param include_bytes boolean?
+function TSNode:range(include_bytes) end
+
+--- @nodoc
+--- @param include_bytes false?
+--- @return integer, integer, integer, integer
+function TSNode:range(include_bytes) end
+
+--- @nodoc
+--- @param include_bytes true
+--- @return integer, integer, integer, integer, integer, integer
+function TSNode:range(include_bytes) end
+
+--- Get the node's type as a string.
+--- @return string
+function TSNode:type() end
+
+--- Get the node's type as a numerical id.
+--- @return integer
+function TSNode:symbol() end
+
+--- Check if the node is named. Named nodes correspond to named rules in the
+--- grammar, whereas anonymous nodes correspond to string literals in the
+--- grammar.
+--- @return boolean
+function TSNode:named() end
+
+--- Check if the node is missing. Missing nodes are inserted by the parser in
+--- order to recover from certain kinds of syntax errors.
+--- @return boolean
+function TSNode:missing() end
+
+--- Check if the node is extra. Extra nodes represent things like comments,
+--- which are not required by the grammar but can appear anywhere.
+--- @return boolean
+function TSNode:extra() end
+
+--- Check if a syntax node has been edited.
+--- @return boolean
+function TSNode:has_changes() end
+
+--- Check if the node is a syntax error or contains any syntax errors.
+--- @return boolean
+function TSNode:has_error() end
+
+--- Get an S-expression representing the node as a string.
+--- @return string
+function TSNode:sexpr() end
+
+--- Get a unique identifier for the node inside its own tree.
+---
+--- No guarantees are made about this identifier's internal representation,
+--- except for being a primitive Lua type with value equality (so not a
+--- table). Presently it is a (non-printable) string.
+---
+--- Note: The `id` is not guaranteed to be unique for nodes from different
+--- trees.
+--- @return string
+function TSNode:id() end
+
+--- Get the |TSTree| of the node.
+--- @return TSTree
+function TSNode:tree() end
+
+--- Get the smallest node within this node that spans the given range of (row,
+--- column) positions
+--- @param start_row integer
+--- @param start_col integer
+--- @param end_row integer
+--- @param end_col integer
+--- @return TSNode?
+function TSNode:descendant_for_range(start_row, start_col, end_row, end_col) end
+
+--- Get the smallest named node within this node that spans the given range of
+--- (row, column) positions
+--- @param start_row integer
+--- @param start_col integer
+--- @param end_row integer
+--- @param end_col integer
+--- @return TSNode?
+function TSNode:named_descendant_for_range(start_row, start_col, end_row, end_col) end
+
+--- Check if {node} refers to the same node within the same tree.
+--- @param node TSNode
+--- @return boolean
+function TSNode:equal(node) end
+
+--- Return the number of bytes spanned by this node.
+--- @return integer
+function TSNode:byte_length() end
diff --git a/runtime/lua/vim/treesitter/_meta/tstree.lua b/runtime/lua/vim/treesitter/_meta/tstree.lua
new file mode 100644
index 0000000000..24cb60040e
--- /dev/null
+++ b/runtime/lua/vim/treesitter/_meta/tstree.lua
@@ -0,0 +1,44 @@
+---@meta
+-- luacheck: no unused args
+error('Cannot require a meta file')
+
+--- @brief 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 treesitter library.
+---
+--- An instance `TSTree` of a treesitter tree supports the following methods.
+
+---@nodoc
+---@class TSTree: userdata
+local TSTree = {} -- luacheck: no unused
+
+--- Return the root node of this tree.
+---@return TSNode
+function TSTree:root() end
+
+-- stylua: ignore
+---@param start_byte integer
+---@param end_byte_old integer
+---@param end_byte_new integer
+---@param start_row integer
+---@param start_col integer
+---@param end_row_old integer
+---@param end_col_old integer
+---@param end_row_new integer
+---@param end_col_new integer
+---@nodoc
+function TSTree:edit(start_byte, end_byte_old, end_byte_new, start_row, start_col, end_row_old, end_col_old, end_row_new, end_col_new) end
+
+--- Returns a copy of the `TSTree`.
+---@return TSTree
+function TSTree:copy() end
+
+---@param include_bytes true
+---@return Range6[]
+---@nodoc
+function TSTree:included_ranges(include_bytes) end
+
+---@param include_bytes false
+---@return Range4[]
+---@nodoc
+function TSTree:included_ranges(include_bytes) end
diff --git a/runtime/lua/vim/treesitter/_query_linter.lua b/runtime/lua/vim/treesitter/_query_linter.lua
index 12b4cbc7b9..c5e4b86e1e 100644
--- a/runtime/lua/vim/treesitter/_query_linter.lua
+++ b/runtime/lua/vim/treesitter/_query_linter.lua
@@ -40,7 +40,8 @@ end
local function guess_query_lang(buf)
local filename = api.nvim_buf_get_name(buf)
if filename ~= '' then
- return vim.F.npcall(vim.fn.fnamemodify, filename, ':p:h:t')
+ local resolved_filename = vim.F.npcall(vim.fn.fnamemodify, filename, ':p:h:t')
+ return resolved_filename and vim.treesitter.language.get_lang(resolved_filename)
end
end
@@ -64,7 +65,7 @@ local function normalize_opts(buf, opts)
end
local lint_query = [[;; query
- (program [(named_node) (list) (grouping)] @toplevel)
+ (program [(named_node) (anonymous_node) (list) (grouping)] @toplevel)
(named_node
name: _ @node.named)
(anonymous_node
@@ -170,17 +171,17 @@ function M.lint(buf, opts)
--- @type (table|nil)
local parser_info = vim.F.npcall(vim.treesitter.language.inspect, lang)
+ local lang_context = {
+ lang = lang,
+ parser_info = parser_info,
+ is_first_lang = i == 1,
+ }
- local parser = vim.treesitter.get_parser(buf)
+ local parser = assert(vim.treesitter.get_parser(buf, nil, { error = false }))
parser:parse()
parser:for_each_tree(function(tree, ltree)
if ltree:lang() == 'query' then
- for _, match, _ in query:iter_matches(tree:root(), buf, 0, -1, { all = true }) do
- local lang_context = {
- lang = lang,
- parser_info = parser_info,
- is_first_lang = i == 1,
- }
+ for _, match, _ in query:iter_matches(tree:root(), buf, 0, -1) do
lint_match(buf, match, query, lang_context, diagnostics)
end
end
@@ -240,7 +241,7 @@ function M.omnifunc(findstart, base)
end
end
for _, s in pairs(parser_info.symbols) do
- local text = s[2] and s[1] or '"' .. s[1]:gsub([[\]], [[\\]]) .. '"' ---@type string
+ local text = s[2] and s[1] or string.format('%q', s[1]):gsub('\n', 'n') ---@type string
if text:find(base, 1, true) then
table.insert(items, text)
end
diff --git a/runtime/lua/vim/treesitter/_range.lua b/runtime/lua/vim/treesitter/_range.lua
index 8d727c3c52..82ab8517aa 100644
--- a/runtime/lua/vim/treesitter/_range.lua
+++ b/runtime/lua/vim/treesitter/_range.lua
@@ -3,16 +3,19 @@ local api = vim.api
local M = {}
---@class Range2
+---@inlinedoc
---@field [1] integer start row
---@field [2] integer end row
---@class Range4
+---@inlinedoc
---@field [1] integer start row
---@field [2] integer start column
---@field [3] integer end row
---@field [4] integer end column
---@class Range6
+---@inlinedoc
---@field [1] integer start row
---@field [2] integer start column
---@field [3] integer start bytes
@@ -150,6 +153,7 @@ function M.contains(r1, r2)
return true
end
+--- @private
--- @param source integer|string
--- @param index integer
--- @return integer
diff --git a/runtime/lua/vim/treesitter/dev.lua b/runtime/lua/vim/treesitter/dev.lua
index 5c91f101c0..90c3720b80 100644
--- a/runtime/lua/vim/treesitter/dev.lua
+++ b/runtime/lua/vim/treesitter/dev.lua
@@ -76,10 +76,14 @@ end
---
---@package
function TSTreeView:new(bufnr, lang)
- local ok, parser = pcall(vim.treesitter.get_parser, bufnr or 0, lang)
- if not ok then
- local err = parser --[[ @as string ]]
- return nil, 'No parser available for the given buffer:\n' .. err
+ local parser = vim.treesitter.get_parser(bufnr or 0, lang, { error = false })
+ if not parser then
+ return nil,
+ string.format(
+ 'Failed to create TSTreeView for buffer %s: no parser for lang "%s"',
+ bufnr,
+ lang
+ )
end
-- For each child tree (injected language), find the root of the tree and locate the node within
@@ -154,7 +158,8 @@ end
---@param w integer
---@param b integer
-local function set_dev_properties(w, b)
+---@param opts nil|{ indent?: integer }
+local function set_dev_options(w, b, opts)
vim.wo[w].scrolloff = 5
vim.wo[w].wrap = false
vim.wo[w].foldmethod = 'expr'
@@ -165,6 +170,12 @@ local function set_dev_properties(w, b)
vim.bo[b].buftype = 'nofile'
vim.bo[b].bufhidden = 'wipe'
vim.bo[b].filetype = 'query'
+ vim.bo[b].swapfile = false
+
+ opts = opts or {}
+ if opts.indent then
+ vim.bo[b].shiftwidth = opts.indent
+ end
end
--- Updates the cursor position in the inspector to match the node under the cursor.
@@ -174,7 +185,7 @@ end
--- @param source_buf integer
--- @param inspect_buf integer
--- @param inspect_win integer
---- @param pos? { [1]: integer, [2]: integer }
+--- @param pos? [integer, integer]
local function set_inspector_cursor(treeview, lang, source_buf, inspect_buf, inspect_win, pos)
api.nvim_buf_clear_namespace(inspect_buf, treeview.ns, 0, -1)
@@ -183,6 +194,7 @@ local function set_inspector_cursor(treeview, lang, source_buf, inspect_buf, ins
lang = lang,
pos = pos,
ignore_injections = false,
+ include_anonymous = treeview.opts.anon,
})
if not cursor_node then
return
@@ -220,14 +232,13 @@ function TSTreeView:draw(bufnr)
local text ---@type string
if item.node:named() then
- if item.field then
- text = string.format('%s: (%s', item.field, item.node:type())
- else
- text = string.format('(%s', item.node:type())
- end
+ text = string.format('(%s', item.node:type())
else
text = string.format('%q', item.node:type()):gsub('\n', 'n')
end
+ if item.field then
+ text = string.format('%s: %s', item.field, text)
+ end
local next = self:get(i + 1)
if not next or next.depth <= item.depth then
@@ -325,7 +336,10 @@ function M.inspect_tree(opts)
opts = opts or {}
+ -- source buffer
local buf = api.nvim_get_current_buf()
+
+ -- window id for source buffer
local win = api.nvim_get_current_win()
local treeview = assert(TSTreeView:new(buf, opts.lang))
@@ -334,12 +348,14 @@ function M.inspect_tree(opts)
close_win(vim.b[buf].dev_inspect)
end
+ -- window id for tree buffer
local w = opts.winid
if not w then
vim.cmd(opts.command or '60vnew')
w = api.nvim_get_current_win()
end
+ -- tree buffer
local b = opts.bufnr
if b then
api.nvim_win_set_buf(w, b)
@@ -350,7 +366,7 @@ function M.inspect_tree(opts)
vim.b[buf].dev_inspect = w
vim.b[b].dev_base = win -- base window handle
vim.b[b].disable_query_linter = true
- set_dev_properties(w, b)
+ set_dev_options(w, b, { indent = treeview.opts.indent })
local title --- @type string?
local opts_title = opts.title
@@ -375,6 +391,12 @@ function M.inspect_tree(opts)
callback = function()
local row = api.nvim_win_get_cursor(w)[1]
local lnum, col = treeview:get(row).node:start()
+
+ -- update source window if original was closed
+ if not api.nvim_win_is_valid(win) then
+ win = vim.fn.win_findbuf(buf)[1]
+ end
+
api.nvim_set_current_win(win)
api.nvim_win_set_cursor(win, { lnum + 1, col })
end,
@@ -432,6 +454,7 @@ function M.inspect_tree(opts)
return true
end
+ w = api.nvim_get_current_win()
api.nvim_buf_clear_namespace(buf, treeview.ns, 0, -1)
local row = api.nvim_win_get_cursor(w)[1]
local lnum, col, end_lnum, end_col = treeview:get(row).node:range()
@@ -441,6 +464,11 @@ function M.inspect_tree(opts)
hl_group = 'Visual',
})
+ -- update source window if original was closed
+ if not api.nvim_win_is_valid(win) then
+ win = vim.fn.win_findbuf(buf)[1]
+ end
+
local topline, botline = vim.fn.line('w0', win), vim.fn.line('w$', win)
-- Move the cursor if highlighted range is completely out of view
@@ -506,7 +534,10 @@ function M.inspect_tree(opts)
buffer = buf,
once = true,
callback = function()
- close_win(w)
+ -- close all tree windows
+ for _, window in pairs(vim.fn.win_findbuf(b)) do
+ close_win(window)
+ end
end,
})
end
@@ -519,7 +550,7 @@ local edit_ns = api.nvim_create_namespace('treesitter/dev-edit')
local function update_editor_highlights(query_win, base_win, lang)
local base_buf = api.nvim_win_get_buf(base_win)
local query_buf = api.nvim_win_get_buf(query_win)
- local parser = vim.treesitter.get_parser(base_buf, lang)
+ local parser = assert(vim.treesitter.get_parser(base_buf, lang, { error = false }))
api.nvim_buf_clear_namespace(base_buf, edit_ns, 0, -1)
local query_content = table.concat(api.nvim_buf_get_lines(query_buf, 0, -1, false), '\n')
@@ -554,6 +585,8 @@ end
--- @private
--- @param lang? string language to open the query editor for.
+--- @return boolean? `true` on success, `nil` on failure
+--- @return string? error message, if applicable
function M.edit_query(lang)
local buf = api.nvim_get_current_buf()
local win = api.nvim_get_current_win()
@@ -576,9 +609,10 @@ function M.edit_query(lang)
end
vim.cmd(cmd)
- local ok, parser = pcall(vim.treesitter.get_parser, buf, lang)
- if not ok then
- return nil, 'No parser available for the given buffer'
+ local parser = vim.treesitter.get_parser(buf, lang, { error = false })
+ if not parser then
+ return nil,
+ string.format('Failed to show query editor for buffer %s: no parser for lang "%s"', buf, lang)
end
lang = parser:lang()
@@ -587,7 +621,7 @@ function M.edit_query(lang)
vim.b[buf].dev_edit = query_win
vim.bo[query_buf].omnifunc = 'v:lua.vim.treesitter.query.omnifunc'
- set_dev_properties(query_win, query_buf)
+ set_dev_options(query_win, query_buf)
-- Note that omnifunc guesses the language based on the containing folder,
-- so we add the parser's language to the buffer's name so that omnifunc
@@ -652,6 +686,8 @@ function M.edit_query(lang)
})
vim.cmd('normal! G')
vim.cmd.startinsert()
+
+ return true
end
return M
diff --git a/runtime/lua/vim/treesitter/health.lua b/runtime/lua/vim/treesitter/health.lua
index ed3616ef46..637f9ea543 100644
--- a/runtime/lua/vim/treesitter/health.lua
+++ b/runtime/lua/vim/treesitter/health.lua
@@ -28,6 +28,9 @@ function M.check()
)
end
end
+
+ local can_wasm = vim._ts_add_language_from_wasm ~= nil
+ health.info(string.format('Can load WASM parsers: %s', tostring(can_wasm)))
end
return M
diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua
index d2f986b874..a94c408f4e 100644
--- a/runtime/lua/vim/treesitter/highlighter.lua
+++ b/runtime/lua/vim/treesitter/highlighter.lua
@@ -47,7 +47,7 @@ function TSHighlighterQuery:get_hl_from_capture(capture)
return self.hl_cache[capture]
end
----@package
+---@nodoc
function TSHighlighterQuery:query()
return self._query
end
@@ -75,7 +75,7 @@ local TSHighlighter = {
TSHighlighter.__index = TSHighlighter
----@package
+---@nodoc
---
--- Creates a highlighter for `tree`.
---
@@ -139,11 +139,14 @@ function TSHighlighter.new(tree, opts)
-- but use synload.vim rather than syntax.vim to not enable
-- syntax FileType autocmds. Later on we should integrate with the
-- `:syntax` and `set syntax=...` machinery properly.
+ -- Still need to ensure that syntaxset augroup exists, so that calling :destroy()
+ -- immediately afterwards will not error.
if vim.g.syntax_on ~= 1 then
vim.cmd.runtime({ 'syntax/synload.vim', bang = true })
+ vim.api.nvim_create_augroup('syntaxset', { clear = false })
end
- api.nvim_buf_call(self.bufnr, function()
+ vim._with({ buf = self.bufnr }, function()
vim.opt_local.spelloptions:append('noplainbuffer')
end)
@@ -232,7 +235,7 @@ function TSHighlighter:on_changedtree(changes)
end
--- Gets the query used for @param lang
----@package
+---@nodoc
---@param lang string Language used by the highlighter.
---@return vim.treesitter.highlighter.Query
function TSHighlighter:get_query(lang)
@@ -377,11 +380,15 @@ function TSHighlighter._on_spell_nav(_, _, buf, srow, _, erow, _)
return
end
+ -- Do not affect potentially populated highlight state. Here we just want a temporary
+ -- empty state so the C code can detect whether the region should be spell checked.
+ local highlight_states = self._highlight_states
self:prepare_highlight_states(srow, erow)
for row = srow, erow do
on_line_impl(self, buf, row, true)
end
+ self._highlight_states = highlight_states
end
---@private
diff --git a/runtime/lua/vim/treesitter/language.lua b/runtime/lua/vim/treesitter/language.lua
index d0a74daa6c..9f7807e036 100644
--- a/runtime/lua/vim/treesitter/language.lua
+++ b/runtime/lua/vim/treesitter/language.lua
@@ -7,11 +7,15 @@ local ft_to_lang = {
help = 'vimdoc',
}
---- Get the filetypes associated with the parser named {lang}.
+--- Returns the filetypes for which a parser named {lang} is used.
+---
+--- The list includes {lang} itself plus all filetypes registered via
+--- |vim.treesitter.language.register()|.
+---
--- @param lang string Name of parser
--- @return string[] filetypes
function M.get_filetypes(lang)
- local r = {} ---@type string[]
+ local r = { lang } ---@type string[]
for ft, p in pairs(ft_to_lang) do
if p == lang then
r[#r + 1] = ft
@@ -20,6 +24,12 @@ function M.get_filetypes(lang)
return r
end
+--- Returns the language name to be used when loading a parser for {filetype}.
+---
+--- If no language has been explicitly registered via |vim.treesitter.language.register()|,
+--- default to {filetype}. For composite filetypes like `html.glimmer`, only the main filetype is
+--- returned.
+---
--- @param filetype string
--- @return string|nil
function M.get_lang(filetype)
@@ -29,9 +39,9 @@ function M.get_lang(filetype)
if ft_to_lang[filetype] then
return ft_to_lang[filetype]
end
- -- support subfiletypes like html.glimmer
+ -- for subfiletypes like html.glimmer use only "main" filetype
filetype = vim.split(filetype, '.', { plain = true })[1]
- return ft_to_lang[filetype]
+ return ft_to_lang[filetype] or filetype
end
---@deprecated
@@ -52,17 +62,27 @@ function M.require_language(lang, path, silent, symbol_name)
return installed
end
- M.add(lang, opts)
- return true
+ return M.add(lang, opts)
+end
+
+--- Load wasm or native parser (wrapper)
+--- todo(clason): move to C
+---
+---@param path string Path of parser library
+---@param lang string Language name
+---@param symbol_name? string Internal symbol name for the language to load (default lang)
+---@return boolean? True if parser is loaded
+local function loadparser(path, lang, symbol_name)
+ if vim.endswith(path, '.wasm') then
+ return vim._ts_add_language_from_wasm and vim._ts_add_language_from_wasm(path, lang)
+ else
+ return vim._ts_add_language_from_object(path, lang, symbol_name)
+ end
end
---@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
---
@@ -71,46 +91,52 @@ end
--- Load parser with name {lang}
---
---- Parsers are searched in the `parser` runtime directory, or the provided {path}
+--- Parsers are searched in the `parser` runtime directory, or the provided {path}.
+--- Can be used to check for available parsers before enabling treesitter features, e.g.,
+--- ```lua
+--- if vim.treesitter.language.add('markdown') then
+--- vim.treesitter.start(bufnr, 'markdown')
+--- end
+--- ```
---
---@param lang string Name of the parser (alphanumerical and `_` only)
---@param opts? vim.treesitter.language.add.Opts Options:
+---@return boolean? True if parser is loaded
+---@return string? Error if parser cannot be loaded
function M.add(lang, opts)
opts = opts or {}
local path = opts.path
- local filetype = opts.filetype or lang
local symbol_name = opts.symbol_name
vim.validate({
lang = { lang, 'string' },
path = { path, 'string', true },
symbol_name = { symbol_name, 'string', true },
- filetype = { filetype, { 'string', 'table' }, true },
})
-- parser names are assumed to be lowercase (consistent behavior on case-insensitive file systems)
lang = lang:lower()
if vim._ts_has_language(lang) then
- M.register(lang, filetype)
- return
+ return true
end
if path == nil then
+ -- allow only safe language names when looking for libraries to load
if not (lang and lang:match('[%w_]+') == lang) then
- error("'" .. lang .. "' is not a valid language name")
+ return nil, string.format('Invalid language name "%s"', lang)
end
local fname = 'parser/' .. lang .. '.*'
local paths = api.nvim_get_runtime_file(fname, false)
if #paths == 0 then
- error("no parser for '" .. lang .. "' language, see :help treesitter-parsers")
+ return nil, string.format('No parser for language "%s"', lang)
end
path = paths[1]
end
- vim._ts_add_language(path, lang, symbol_name)
- M.register(lang, filetype)
+ return loadparser(path, lang, symbol_name) or nil,
+ string.format('Cannot load parser %s for language "%s"', path, lang)
end
--- @param x string|string[]
diff --git a/runtime/lua/vim/treesitter/languagetree.lua b/runtime/lua/vim/treesitter/languagetree.lua
index b0812123b9..fd68c2b910 100644
--- a/runtime/lua/vim/treesitter/languagetree.lua
+++ b/runtime/lua/vim/treesitter/languagetree.lua
@@ -98,9 +98,9 @@ local LanguageTree = {}
LanguageTree.__index = LanguageTree
---- @package
+--- @nodoc
---
---- |LanguageTree| contains a tree of parsers: the root treesitter parser for {lang} and any
+--- LanguageTree contains a tree of parsers: the root treesitter parser for {lang} and any
--- "injected" language parsers, which themselves may inject other languages, recursively.
---
---@param source (integer|string) Buffer or text string to parse
@@ -108,7 +108,7 @@ LanguageTree.__index = LanguageTree
---@param opts vim.treesitter.LanguageTree.new.Opts?
---@return vim.treesitter.LanguageTree parser object
function LanguageTree.new(source, lang, opts)
- language.add(lang)
+ assert(language.add(lang))
opts = opts or {}
if source == 0 then
@@ -638,6 +638,8 @@ end
---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.
+---Each list represents a range in the form of
+---{ {start_row}, {start_col}, {start_bytes}, {end_row}, {end_col}, {end_bytes} }.
---@return table<integer, Range6[]>
function LanguageTree:included_regions()
if self._regions then
@@ -732,7 +734,7 @@ local function add_injection(t, tree_index, pattern, lang, combined, ranges)
table.insert(t[tree_index][lang][pattern].regions, ranges)
end
--- TODO(clason): replace by refactored `ts.has_parser` API (without registering)
+-- TODO(clason): replace by refactored `ts.has_parser` API (without side effects)
--- The result of this function is cached to prevent nvim_get_runtime_file from being
--- called too often
--- @param lang string parser name
@@ -831,13 +833,7 @@ function LanguageTree:_get_injections()
local start_line, _, end_line, _ = root_node:range()
for pattern, match, metadata in
- self._injection_query:iter_matches(
- root_node,
- self._source,
- start_line,
- end_line + 1,
- { all = true }
- )
+ self._injection_query:iter_matches(root_node, self._source, start_line, end_line + 1)
do
local lang, combined, ranges = self:_get_injection(match, metadata)
if lang then
@@ -951,7 +947,7 @@ function LanguageTree:_edit(
end
end
----@package
+---@nodoc
---@param bufnr integer
---@param changed_tick integer
---@param start_row integer
@@ -1023,12 +1019,12 @@ function LanguageTree:_on_bytes(
)
end
----@package
+---@nodoc
function LanguageTree:_on_reload()
self:invalidate(true)
end
----@package
+---@nodoc
function LanguageTree:_on_detach(...)
self:invalidate(true)
self:_do_callback('detach', ...)
@@ -1087,7 +1083,7 @@ end
--- Determines whether {range} is contained in the |LanguageTree|.
---
----@param range Range4 `{ start_line, start_col, end_line, end_col }`
+---@param range Range4
---@return boolean
function LanguageTree:contains(range)
for _, tree in pairs(self._trees) do
@@ -1108,7 +1104,7 @@ end
--- Gets the tree that contains {range}.
---
----@param range Range4 `{ start_line, start_col, end_line, end_col }`
+---@param range Range4
---@param opts? vim.treesitter.LanguageTree.tree_for_range.Opts
---@return TSTree?
function LanguageTree:tree_for_range(range, opts)
@@ -1133,9 +1129,21 @@ function LanguageTree:tree_for_range(range, opts)
return nil
end
+--- Gets the smallest node that contains {range}.
+---
+---@param range Range4
+---@param opts? vim.treesitter.LanguageTree.tree_for_range.Opts
+---@return TSNode?
+function LanguageTree:node_for_range(range, opts)
+ local tree = self:tree_for_range(range, opts)
+ if tree then
+ return tree:root():descendant_for_range(unpack(range))
+ end
+end
+
--- Gets the smallest named node that contains {range}.
---
----@param range Range4 `{ start_line, start_col, end_line, end_col }`
+---@param range Range4
---@param opts? vim.treesitter.LanguageTree.tree_for_range.Opts
---@return TSNode?
function LanguageTree:named_node_for_range(range, opts)
@@ -1147,7 +1155,7 @@ end
--- Gets the appropriate language that contains {range}.
---
----@param range Range4 `{ start_line, start_col, end_line, end_col }`
+---@param range Range4
---@return vim.treesitter.LanguageTree tree Managing {range}
function LanguageTree:language_for_range(range)
for _, child in pairs(self._children) do
diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua
index ef5c2143a7..4614967799 100644
--- a/runtime/lua/vim/treesitter/query.lua
+++ b/runtime/lua/vim/treesitter/query.lua
@@ -247,8 +247,7 @@ end)
---
---@see [vim.treesitter.query.get()]
M.parse = memoize('concat-2', function(lang, query)
- language.add(lang)
-
+ assert(language.add(lang))
local ts_query = vim._ts_parse_query(lang, query)
return Query.new(lang, ts_query)
end)
@@ -487,8 +486,8 @@ predicate_handlers['any-vim-match?'] = predicate_handlers['any-match?']
---@class vim.treesitter.query.TSMetadata
---@field range? Range
---@field conceal? string
----@field [integer] vim.treesitter.query.TSMetadata
----@field [string] integer|string
+---@field [integer]? vim.treesitter.query.TSMetadata
+---@field [string]? integer|string
---@alias TSDirective fun(match: table<integer,TSNode[]>, _, _, predicate: (string|integer)[], metadata: vim.treesitter.query.TSMetadata)
@@ -620,16 +619,16 @@ local directive_handlers = {
--- @field force? boolean
---
--- Use the correct implementation of the match table where capture IDs map to
---- a list of nodes instead of a single node. Defaults to false (for backward
---- compatibility). This option will eventually become the default and removed.
+--- a list of nodes instead of a single node. Defaults to true. This option will
+--- be removed in a future release.
--- @field all? boolean
--- Adds a new predicate to be used in queries
---
---@param name string Name of the predicate, without leading #
----@param handler fun(match: table<integer,TSNode[]>, pattern: integer, source: integer|string, predicate: any[], metadata: table)
+---@param handler fun(match: table<integer,TSNode[]>, pattern: integer, source: integer|string, predicate: any[], metadata: vim.treesitter.query.TSMetadata)
--- - see |vim.treesitter.query.add_directive()| for argument meanings
----@param opts vim.treesitter.query.add_predicate.Opts
+---@param opts? vim.treesitter.query.add_predicate.Opts
function M.add_predicate(name, handler, opts)
-- Backward compatibility: old signature had "force" as boolean argument
if type(opts) == 'boolean' then
@@ -642,7 +641,7 @@ function M.add_predicate(name, handler, opts)
error(string.format('Overriding existing predicate %s', name))
end
- if opts.all then
+ if opts.all ~= false then
predicate_handlers[name] = handler
else
--- @param match table<integer, TSNode[]>
@@ -667,7 +666,7 @@ end
--- metadata table `metadata[capture_id].key = value`
---
---@param name string Name of the directive, without leading #
----@param handler fun(match: table<integer,TSNode[]>, pattern: integer, source: integer|string, predicate: any[], metadata: table)
+---@param handler fun(match: table<integer,TSNode[]>, pattern: integer, source: integer|string, predicate: any[], metadata: vim.treesitter.query.TSMetadata)
--- - match: A table mapping capture IDs to a list of captured nodes
--- - pattern: the index of the matching pattern in the query file
--- - predicate: list of strings containing the full directive being called, e.g.
@@ -894,16 +893,10 @@ end
--- index of the pattern in the query, a table mapping capture indices to a list
--- of nodes, and metadata from any directives processing the match.
---
---- WARNING: Set `all=true` to ensure all matching nodes in a match are
---- returned, otherwise only the last node in a match is returned, breaking captures
---- involving quantifiers such as `(comment)+ @comment`. The default option
---- `all=false` is only provided for backward compatibility and will be removed
---- after Nvim 0.10.
----
--- Example:
---
--- ```lua
---- for pattern, match, metadata in cquery:iter_matches(tree:root(), bufnr, 0, -1, { all = true }) do
+--- for pattern, match, metadata in cquery:iter_matches(tree:root(), bufnr, 0, -1) do
--- for id, nodes in pairs(match) do
--- local name = query.captures[id]
--- for _, node in ipairs(nodes) do
@@ -925,11 +918,11 @@ end
--- - max_start_depth (integer) if non-zero, sets the maximum start depth
--- for each match. This is used to prevent traversing too deep into a tree.
--- - match_limit (integer) Set the maximum number of in-progress matches (Default: 256).
---- - all (boolean) When set, the returned match table maps capture IDs to a list of nodes.
---- Older versions of iter_matches incorrectly mapped capture IDs to a single node, which is
---- incorrect behavior. This option will eventually become the default and removed.
+--- - all (boolean) When `false` (default `true`), the returned table maps capture IDs to a single
+--- (last) node instead of the full list of matching nodes. This option is only for backward
+--- compatibility and will be removed in a future release.
---
----@return (fun(): integer, table<integer, TSNode[]>, table): pattern id, match, metadata
+---@return (fun(): integer, table<integer, TSNode[]>, vim.treesitter.query.TSMetadata): pattern id, match, metadata
function Query:iter_matches(node, source, start, stop, opts)
opts = opts or {}
opts.match_limit = opts.match_limit or 256
@@ -960,10 +953,10 @@ function Query:iter_matches(node, source, start, stop, opts)
local captures = match:captures()
- if not opts.all then
+ if opts.all == false then
-- Convert the match table into the old buggy version for backward
- -- compatibility. This is slow. Plugin authors, if you're reading this, set the "all"
- -- option!
+ -- compatibility. This is slow, but we only do it when the caller explicitly opted into it by
+ -- setting `all` to `false`.
local old_match = {} ---@type table<integer, TSNode>
for k, v in pairs(captures or {}) do
old_match[k] = v[#v]
@@ -1034,7 +1027,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)
- vim.treesitter.dev.edit_query(lang)
+ assert(vim.treesitter.dev.edit_query(lang))
end
return M
diff --git a/runtime/lua/vim/ui.lua b/runtime/lua/vim/ui.lua
index 99b9b78e2a..532decf5e9 100644
--- a/runtime/lua/vim/ui.lua
+++ b/runtime/lua/vim/ui.lua
@@ -117,6 +117,8 @@ end
--- -- Asynchronous.
--- vim.ui.open("https://neovim.io/")
--- vim.ui.open("~/path/to/file")
+--- -- Use the "osurl" command to handle the path or URL.
+--- vim.ui.open("gh#neovim/neovim!29490", { cmd = { 'osurl' } })
--- -- Synchronous (wait until the process exits).
--- local cmd, err = vim.ui.open("$VIMRUNTIME")
--- if cmd then
@@ -125,23 +127,29 @@ end
--- ```
---
---@param path string Path or URL to open
+---@param opt? { cmd?: string[] } Options
+--- - cmd string[]|nil Command used to open the path or URL.
---
---@return vim.SystemObj|nil # Command object, or nil if not found.
---@return nil|string # Error message on failure, or nil on success.
---
---@see |vim.system()|
-function M.open(path)
+function M.open(path, opt)
vim.validate({
path = { path, 'string' },
})
local is_uri = path:match('%w+:')
if not is_uri then
- path = vim.fn.expand(path)
+ path = vim.fs.normalize(path)
end
- local cmd --- @type string[]
+ opt = opt or {}
+ local cmd ---@type string[]
+ local job_opt = { text = true, detach = true } --- @type vim.SystemOpts
- if vim.fn.has('mac') == 1 then
+ if opt.cmd then
+ cmd = vim.list_extend(opt.cmd --[[@as string[] ]], { path })
+ elseif vim.fn.has('mac') == 1 then
cmd = { 'open', path }
elseif vim.fn.has('win32') == 1 then
if vim.fn.executable('rundll32') == 1 then
@@ -149,37 +157,79 @@ function M.open(path)
else
return nil, 'vim.ui.open: rundll32 not found'
end
+ elseif vim.fn.executable('xdg-open') == 1 then
+ cmd = { 'xdg-open', path }
+ job_opt.stdout = false
+ job_opt.stderr = false
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, explorer.exe, xdg-open)'
end
- return vim.system(cmd, { text = true, detach = true }), nil
+ return vim.system(cmd, job_opt), nil
end
---- Gets the URL at cursor, if any.
-function M._get_url()
- if vim.bo.filetype == 'markdown' then
- local range = vim.api.nvim_win_get_cursor(0)
- vim.treesitter.get_parser():parse(range)
- -- marking the node as `markdown_inline` is required. Setting it to `markdown` does not
- -- work.
- local current_node = vim.treesitter.get_node { lang = 'markdown_inline' }
- while current_node do
- local type = current_node:type()
- if type == 'inline_link' or type == 'image' then
- local child = assert(current_node:named_child(1))
- return vim.treesitter.get_node_text(child, 0)
+--- Returns all URLs at cursor, if any.
+--- @return string[]
+function M._get_urls()
+ local urls = {} ---@type string[]
+
+ local bufnr = vim.api.nvim_get_current_buf()
+ local cursor = vim.api.nvim_win_get_cursor(0)
+ local row = cursor[1] - 1
+ local col = cursor[2]
+ local extmarks = vim.api.nvim_buf_get_extmarks(bufnr, -1, { row, col }, { row, col }, {
+ details = true,
+ type = 'highlight',
+ overlap = true,
+ })
+ for _, v in ipairs(extmarks) do
+ local details = v[4]
+ if details and details.url then
+ urls[#urls + 1] = details.url
+ end
+ end
+
+ local highlighter = vim.treesitter.highlighter.active[bufnr]
+ if highlighter then
+ local range = { row, col, row, col }
+ local ltree = highlighter.tree:language_for_range(range)
+ local lang = ltree:lang()
+ local query = vim.treesitter.query.get(lang, 'highlights')
+ if query then
+ local tree = assert(ltree:tree_for_range(range))
+ for _, match, metadata in query:iter_matches(tree:root(), bufnr, row, row + 1) do
+ for id, nodes in pairs(match) do
+ for _, node in ipairs(nodes) do
+ if vim.treesitter.node_contains(node, range) then
+ local url = metadata[id] and metadata[id].url
+ if url and match[url] then
+ for _, n in ipairs(match[url]) do
+ urls[#urls + 1] =
+ vim.treesitter.get_node_text(n, bufnr, { metadata = metadata[url] })
+ end
+ end
+ end
+ end
+ end
end
- current_node = current_node:parent()
end
end
- return vim.fn.expand('<cfile>')
+
+ if #urls == 0 then
+ -- If all else fails, use the filename under the cursor
+ table.insert(
+ urls,
+ vim._with({ go = { isfname = vim.o.isfname .. ',@-@' } }, function()
+ return vim.fn.expand('<cfile>')
+ end)
+ )
+ end
+
+ return urls
end
return M
diff --git a/runtime/lua/vim/version.lua b/runtime/lua/vim/version.lua
index 0b149700b5..d64ef98d2d 100644
--- a/runtime/lua/vim/version.lua
+++ b/runtime/lua/vim/version.lua
@@ -174,6 +174,10 @@ function M._version(version, strict) -- Adapted from https://github.com/folke/la
version = version:match('%d[^ ]*')
end
+ if version == nil then
+ return nil
+ end
+
local prerel = version:match('%-([^+]*)')
local prerel_strict = version:match('%-([0-9A-Za-z-]*)')
if
@@ -272,6 +276,7 @@ end
--- ```
---
--- @see # https://github.com/npm/node-semver#ranges
+--- @since 11
---
--- @param spec string Version range "spec"
--- @return vim.VersionRange?
@@ -371,6 +376,7 @@ end
--- ```
---
--- @note Per semver, build metadata is ignored when comparing two otherwise-equivalent versions.
+--- @since 11
---
---@param v1 vim.Version|number[]|string Version object.
---@param v2 vim.Version|number[]|string Version to compare with `v1`.
@@ -388,6 +394,7 @@ function M.cmp(v1, v2)
end
---Returns `true` if the given versions are equal. See |vim.version.cmp()| for usage.
+---@since 11
---@param v1 vim.Version|number[]|string
---@param v2 vim.Version|number[]|string
---@return boolean
@@ -396,6 +403,7 @@ function M.eq(v1, v2)
end
---Returns `true` if `v1 <= v2`. See |vim.version.cmp()| for usage.
+---@since 12
---@param v1 vim.Version|number[]|string
---@param v2 vim.Version|number[]|string
---@return boolean
@@ -404,6 +412,7 @@ function M.le(v1, v2)
end
---Returns `true` if `v1 < v2`. See |vim.version.cmp()| for usage.
+---@since 11
---@param v1 vim.Version|number[]|string
---@param v2 vim.Version|number[]|string
---@return boolean
@@ -412,6 +421,7 @@ function M.lt(v1, v2)
end
---Returns `true` if `v1 >= v2`. See |vim.version.cmp()| for usage.
+---@since 12
---@param v1 vim.Version|number[]|string
---@param v2 vim.Version|number[]|string
---@return boolean
@@ -420,6 +430,7 @@ function M.ge(v1, v2)
end
---Returns `true` if `v1 > v2`. See |vim.version.cmp()| for usage.
+---@since 11
---@param v1 vim.Version|number[]|string
---@param v2 vim.Version|number[]|string
---@return boolean
@@ -434,7 +445,8 @@ end
--- { major = 1, minor = 0, patch = 1, prerelease = "rc1", build = "build.2" }
--- ```
---
---- @see # https://semver.org/spec/v2.0.0.html
+---@see # https://semver.org/spec/v2.0.0.html
+---@since 11
---
---@param version string Version string to parse.
---@param opts table|nil Optional keyword arguments:
diff --git a/runtime/lua/vim/vimhelp.lua b/runtime/lua/vim/vimhelp.lua
index 4af6866d48..5579cc0174 100644
--- a/runtime/lua/vim/vimhelp.lua
+++ b/runtime/lua/vim/vimhelp.lua
@@ -30,4 +30,42 @@ function M.highlight_groups(patterns)
vim.fn.setpos('.', save_cursor)
end
+--- Show a table of contents for the help buffer in a loclist
+function M.show_toc()
+ local bufnr = vim.api.nvim_get_current_buf()
+ local parser = assert(vim.treesitter.get_parser(bufnr, 'vimdoc', { error = false }))
+ local query = vim.treesitter.query.parse(
+ parser:lang(),
+ [[
+ (h1 (heading) @h1)
+ (h2 (heading) @h2)
+ (h3 (heading) @h3)
+ (column_heading (heading) @h4)
+ ]]
+ )
+ local root = parser:parse()[1]:root()
+ local headings = {}
+ for id, node, _, _ in query:iter_captures(root, bufnr) do
+ local text = vim.treesitter.get_node_text(node, bufnr)
+ local capture = query.captures[id]
+ local row, col = node:start()
+ -- only column_headings at col 1 are headings, otherwise it's code examples
+ local is_code = (capture == 'h4' and col > 0)
+ -- ignore tabular material
+ local is_table = (capture == 'h4' and (text:find('\t') or text:find(' ')))
+ -- ignore tag-only headings
+ local is_tag = node:child_count() == 1 and node:child(0):type() == 'tag'
+ if not (is_code or is_table or is_tag) then
+ table.insert(headings, {
+ bufnr = bufnr,
+ lnum = row + 1,
+ text = (capture == 'h3' or capture == 'h4') and '  ' .. text or text,
+ })
+ end
+ end
+ vim.fn.setloclist(0, headings, ' ')
+ vim.fn.setloclist(0, {}, 'a', { title = 'Help TOC' })
+ vim.cmd.lopen()
+end
+
return M
diff --git a/runtime/nvim.desktop b/runtime/nvim.desktop
index 224353c6ad..f9feae926d 100644
--- a/runtime/nvim.desktop
+++ b/runtime/nvim.desktop
@@ -4,6 +4,7 @@ GenericName=Text Editor
GenericName[ckb]=دەستکاریکەری دەق
GenericName[de]=Texteditor
GenericName[fr]=Éditeur de texte
+GenericName[pl]=Edytor tekstu
GenericName[ru]=ТекÑтовый редактор
GenericName[sr]=Едитор текÑÑ‚
GenericName[tr]=Metin Düzenleyici
diff --git a/runtime/optwin.vim b/runtime/optwin.vim
index 5b5b33e4ad..da70ff1afe 100644
--- a/runtime/optwin.vim
+++ b/runtime/optwin.vim
@@ -1,7 +1,7 @@
" These commands create the option window.
"
" Maintainer: The Vim Project <https://github.com/vim/vim>
-" Last Change: 2023 Aug 31
+" Last Change: 2024 Jul 12
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" If there already is an option window, jump to that one.
@@ -507,6 +507,8 @@ endif
call <SID>Header(gettext("multiple tab pages"))
call <SID>AddOption("showtabline", gettext("0, 1 or 2; when to use a tab pages line"))
call append("$", " \tset stal=" . &stal)
+call <SID>AddOption("tabclose", gettext("behaviour when closing tab pages: left, uselast or empty"))
+call append("$", " \tset tcl=" . &tcl)
call <SID>AddOption("tabpagemax", gettext("maximum number of tab pages to open for -p and \"tab all\""))
call append("$", " \tset tpm=" . &tpm)
call <SID>AddOption("tabline", gettext("custom tab pages line"))
@@ -723,7 +725,9 @@ if has("insert_expand")
call append("$", "\t" .. s:local_to_buffer)
call <SID>OptionL("cpt")
call <SID>AddOption("completeopt", gettext("whether to use a popup menu for Insert mode completion"))
- call <SID>OptionG("cot", &cot)
+ call <SID>OptionL("cot")
+ call <SID>AddOption("completeitemalign", gettext("popup menu item align order"))
+ call <SID>OptionG("cia", &cia)
call <SID>AddOption("pumheight", gettext("maximum height of the popup menu"))
call <SID>OptionG("ph", &ph)
call <SID>AddOption("pumwidth", gettext("minimum width of the popup menu"))
diff --git a/runtime/pack/dist/opt/nohlsearch/plugin/nohlsearch.vim b/runtime/pack/dist/opt/nohlsearch/plugin/nohlsearch.vim
new file mode 100644
index 0000000000..a2d766e41a
--- /dev/null
+++ b/runtime/pack/dist/opt/nohlsearch/plugin/nohlsearch.vim
@@ -0,0 +1,20 @@
+" nohlsearch.vim: Auto turn off hlsearch
+" Last Change: 2024-07-31
+" Maintainer: Maxim Kim <habamax@gmail.com>
+"
+" turn off hlsearch after:
+" - doing nothing for 'updatetime'
+" - getting into insert mode
+
+if exists('g:loaded_nohlsearch')
+ finish
+endif
+let g:loaded_nohlsearch = 1
+
+augroup nohlsearch
+ au!
+ noremap <Plug>(nohlsearch) <cmd>nohlsearch<cr>
+ noremap! <Plug>(nohlsearch) <cmd>nohlsearch<cr>
+ au CursorHold * call feedkeys("\<Plug>(nohlsearch)", 'm')
+ au InsertEnter * call feedkeys("\<Plug>(nohlsearch)", 'm')
+augroup END
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index f78a082cb7..9412a821e8 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -44,8 +44,13 @@
" - job_info && term_getjob -> nvim_get_chan_info
" - balloon -> vim.lsp.util.open_floating_preview
+func s:Echoerr(msg)
+ echohl ErrorMsg | echom $'[termdebug] {a:msg}' | echohl None
+endfunc
+
" In case this gets sourced twice.
if exists(':Termdebug')
+ call s:Echoerr('Termdebug already loaded.')
finish
endif
@@ -67,8 +72,8 @@ command -nargs=+ -complete=file -bang TermdebugCommand call s:StartDebugCommand(
let s:pc_id = 12
let s:asm_id = 13
let s:break_id = 14 " breakpoint number is added to this
-let s:stopped = 1
-let s:running = 0
+let s:stopped = v:true
+let s:running = v:false
let s:parsing_disasm_msg = 0
let s:asm_lines = []
@@ -86,9 +91,9 @@ endfunction
func s:Highlight(init, old, new)
let default = a:init ? 'default ' : ''
if a:new ==# 'light' && a:old !=# 'light'
- exe "hi " . default . "debugPC term=reverse ctermbg=lightblue guibg=lightblue"
+ exe $"hi {default}debugPC term=reverse ctermbg=lightblue guibg=lightblue"
elseif a:new ==# 'dark' && a:old !=# 'dark'
- exe "hi " . default . "debugPC term=reverse ctermbg=darkblue guibg=darkblue"
+ exe $"hi {default}debugPC term=reverse ctermbg=darkblue guibg=darkblue"
endif
endfunc
@@ -121,10 +126,6 @@ func s:GetCommand()
return type(cmd) == v:t_list ? copy(cmd) : [cmd]
endfunc
-func s:Echoerr(msg)
- echohl ErrorMsg | echom '[termdebug] ' .. a:msg | echohl None
-endfunc
-
func s:StartDebug(bang, ...)
" First argument is the command to debug, second core file or process ID.
call s:StartDebug_internal({'gdb_args': a:000, 'bang': a:bang})
@@ -142,16 +143,16 @@ func s:StartDebug_internal(dict)
endif
let gdbcmd = s:GetCommand()
if !executable(gdbcmd[0])
- call s:Echoerr('Cannot execute debugger program "' .. gdbcmd[0] .. '"')
+ call s:Echoerr($'Cannot execute debugger program "{gdbcmd[0]}"')
return
endif
let s:ptywin = 0
let s:pid = 0
let s:asmwin = 0
- let s:asmbuf = 0
+ let s:asmbufnr = 0
let s:varwin = 0
- let s:varbuf = 0
+ let s:varbufnr = 0
if exists('#User#TermdebugStartPre')
doauto <nomodeline> User TermdebugStartPre
@@ -167,8 +168,8 @@ func s:StartDebug_internal(dict)
let b:save_signcolumn = &signcolumn
let s:signcolumn_buflist = [bufnr()]
- let s:save_columns = 0
- let s:allleft = 0
+ let s:saved_columns = 0
+ let s:allleft = v:false
let wide = 0
if exists('g:termdebug_config')
let wide = get(g:termdebug_config, 'wide', 0)
@@ -177,15 +178,15 @@ func s:StartDebug_internal(dict)
endif
if wide > 0
if &columns < wide
- let s:save_columns = &columns
+ let s:saved_columns = &columns
let &columns = wide
" If we make the Vim window wider, use the whole left half for the debug
" windows.
- let s:allleft = 1
+ let s:allleft = v:true
endif
- let s:vertical = 1
+ let s:vertical = v:true
else
- let s:vertical = 0
+ let s:vertical = v:false
endif
" Override using a terminal window by setting g:termdebug_use_prompt to 1.
@@ -226,24 +227,25 @@ endfunc
" Use when debugger didn't start or ended.
func s:CloseBuffers()
- exe 'bwipe! ' . s:ptybuf
- if s:asmbuf > 0 && bufexists(s:asmbuf)
- exe 'bwipe! ' . s:asmbuf
+ exe $'bwipe! {s:ptybufnr}'
+ if s:asmbufnr > 0 && bufexists(s:asmbufnr)
+ exe $'bwipe! {s:asmbufnr}'
endif
- if s:varbuf > 0 && bufexists(s:varbuf)
- exe 'bwipe! ' . s:varbuf
+ if s:varbufnr > 0 && bufexists(s:varbufnr)
+ exe $'bwipe! {s:varbufnr}'
endif
- let s:running = 0
+ let s:running = v:false
unlet! s:gdbwin
endfunc
-func s:CheckGdbRunning()
+func s:IsGdbStarted()
if !s:gdb_running
- call s:Echoerr(string(s:GetCommand()[0]) . ' exited unexpectedly')
+ let cmd_name = string(s:GetCommand()[0])
+ call s:Echoerr($'{cmd_name} exited unexpectedly')
call s:CloseBuffers()
- return ''
+ return v:false
endif
- return 'ok'
+ return v:true
endfunc
" Open a terminal window without a job, to run the debugged program in.
@@ -258,13 +260,13 @@ func s:StartDebug_term(dict)
return
endif
let pty_job_info = nvim_get_chan_info(s:pty_job_id)
- let s:ptybuf = pty_job_info['buffer']
+ let s:ptybufnr = pty_job_info['buffer']
let pty = pty_job_info['pty']
let s:ptywin = win_getid()
if s:vertical
" Assuming the source code window will get a signcolumn, use two more
" columns for that, thus one less for the terminal window.
- exe (&columns / 2 - 1) . "wincmd |"
+ exe $":{(&columns / 2 - 1)}wincmd |"
if s:allleft
" use the whole left column
wincmd H
@@ -279,11 +281,11 @@ func s:StartDebug_term(dict)
" hide terminal buffer
if s:comm_job_id == 0
call s:Echoerr('Invalid argument (or job table is full) while opening communication terminal window')
- exe 'bwipe! ' . s:ptybuf
+ exe 'bwipe! ' . s:ptybufnr
return
elseif s:comm_job_id == -1
call s:Echoerr('Failed to open the communication terminal window')
- exe 'bwipe! ' . s:ptybuf
+ exe $'bwipe! {s:ptybufnr}'
return
endif
let comm_job_info = nvim_get_chan_info(s:comm_job_id)
@@ -320,11 +322,11 @@ func s:StartDebug_term(dict)
let gdb_cmd += gdb_args
execute 'new'
- " call ch_log('executing "' . join(gdb_cmd) . '"')
+ " call ch_log($'executing "{join(gdb_cmd)}"')
let s:gdb_job_id = termopen(gdb_cmd, {'on_exit': function('s:EndTermDebug')})
if s:gdb_job_id == 0
call s:Echoerr('Invalid argument (or job table is full) while opening gdb terminal window')
- exe 'bwipe! ' . s:ptybuf
+ exe 'bwipe! ' . s:ptybufnr
return
elseif s:gdb_job_id == -1
call s:Echoerr('Failed to open the gdb terminal window')
@@ -334,18 +336,18 @@ func s:StartDebug_term(dict)
let s:gdb_running = v:true
let s:starting = v:true
let gdb_job_info = nvim_get_chan_info(s:gdb_job_id)
- let s:gdbbuf = gdb_job_info['buffer']
+ let s:gdbbufnr = gdb_job_info['buffer']
let s:gdbwin = win_getid()
" Wait for the "startupdone" message before sending any commands.
let try_count = 0
while 1
- if s:CheckGdbRunning() != 'ok'
+ if !s:IsGdbStarted()
return
endif
for lnum in range(1, 200)
- if get(getbufline(s:gdbbuf, lnum), 0, '') =~ 'startupdone'
+ if get(getbufline(s:gdbbufnr, lnum), 0, '') =~ 'startupdone'
let try_count = 9999
break
endif
@@ -359,26 +361,26 @@ func s:StartDebug_term(dict)
endwhile
" Set arguments to be run.
- if len(proc_args)
- call chansend(s:gdb_job_id, 'server set args ' . join(proc_args) . "\r")
+ if !empty(proc_args)
+ call chansend(s:gdb_job_id, $"server set args {join(proc_args)}\r")
endif
" Connect gdb to the communication pty, using the GDB/MI interface.
" Prefix "server" to avoid adding this to the history.
- call chansend(s:gdb_job_id, 'server new-ui mi ' . commpty . "\r")
+ call chansend(s:gdb_job_id, $"server new-ui mi {commpty}\r")
" Wait for the response to show up, users may not notice the error and wonder
" why the debugger doesn't work.
let try_count = 0
while 1
- if s:CheckGdbRunning() != 'ok'
+ if !s:IsGdbStarted()
return
endif
let response = ''
for lnum in range(1, 200)
- let line1 = get(getbufline(s:gdbbuf, lnum), 0, '')
- let line2 = get(getbufline(s:gdbbuf, lnum + 1), 0, '')
+ let line1 = get(getbufline(s:gdbbufnr, lnum), 0, '')
+ let line2 = get(getbufline(s:gdbbufnr, lnum + 1), 0, '')
if line1 =~ 'new-ui mi '
" response can be in the same line or the next line
let response = line1 . line2
@@ -444,7 +446,7 @@ func s:StartDebug_prompt(dict)
if s:vertical
" Assuming the source code window will get a signcolumn, use two more
" columns for that, thus one less for the terminal window.
- exe (&columns / 2 - 1) . "wincmd |"
+ exe $":{(&columns / 2 - 1)}wincmd |"
endif
let gdb_args = get(a:dict, 'gdb_args', [])
@@ -465,14 +467,14 @@ func s:StartDebug_prompt(dict)
" Adding arguments requested by the user
let gdb_cmd += gdb_args
- " call ch_log('executing "' . join(gdb_cmd) . '"')
+ " call ch_log($'executing "{join(gdb_cmd)}"')
let s:gdbjob = jobstart(gdb_cmd, {
\ 'on_exit': function('s:EndPromptDebug'),
\ 'on_stdout': function('s:JobOutCallback', {'last_line': '', 'real_cb': function('s:GdbOutCallback')}),
\ })
if s:gdbjob == 0
call s:Echoerr('Invalid argument (or job table is full) while starting gdb job')
- exe 'bwipe! ' . s:ptybuf
+ exe $'bwipe! {s:ptybufnr}'
return
elseif s:gdbjob == -1
call s:Echoerr('Failed to start the gdb job')
@@ -481,7 +483,7 @@ func s:StartDebug_prompt(dict)
endif
exe $'au BufUnload <buffer={s:promptbuf}> ++once call jobstop(s:gdbjob)'
- let s:ptybuf = 0
+ let s:ptybufnr = 0
if has('win32')
" MS-Windows: run in a new console window for maximum compatibility
call s:SendCommand('set new-console on')
@@ -498,26 +500,26 @@ func s:StartDebug_prompt(dict)
return
endif
let pty_job_info = nvim_get_chan_info(s:pty_job_id)
- let s:ptybuf = pty_job_info['buffer']
+ let s:ptybufnr = pty_job_info['buffer']
let pty = pty_job_info['pty']
let s:ptywin = win_getid()
- call s:SendCommand('tty ' . pty)
+ call s:SendCommand($'tty {pty}')
" Since GDB runs in a prompt window, the environment has not been set to
" match a terminal window, need to do that now.
call s:SendCommand('set env TERM = xterm-color')
- call s:SendCommand('set env ROWS = ' . winheight(s:ptywin))
- call s:SendCommand('set env LINES = ' . winheight(s:ptywin))
- call s:SendCommand('set env COLUMNS = ' . winwidth(s:ptywin))
- call s:SendCommand('set env COLORS = ' . &t_Co)
- call s:SendCommand('set env VIM_TERMINAL = ' . v:version)
+ call s:SendCommand($'set env ROWS = {winheight(s:ptywin)}')
+ call s:SendCommand($'set env LINES = {winheight(s:ptywin)}')
+ call s:SendCommand($'set env COLUMNS = {winwidth(s:ptywin)}')
+ call s:SendCommand($'set env COLORS = {&t_Co}')
+ call s:SendCommand($'set env VIM_TERMINAL = {v:version}')
endif
call s:SendCommand('set print pretty on')
call s:SendCommand('set breakpoint pending on')
" Set arguments to be run
- if len(proc_args)
- call s:SendCommand('set args ' . join(proc_args))
+ if !empty(proc_args)
+ call s:SendCommand($'set args {join(proc_args)}')
endif
call s:StartDebugCommon(a:dict)
@@ -563,18 +565,18 @@ endfunc
" Send a command to gdb. "cmd" is the string without line terminator.
func s:SendCommand(cmd)
- "call ch_log('sending to gdb: ' . a:cmd)
+ " call ch_log($'sending to gdb: {a:cmd}')
if s:way == 'prompt'
- call chansend(s:gdbjob, a:cmd . "\n")
+ call chansend(s:gdbjob, $"{a:cmd}\n")
else
- call chansend(s:comm_job_id, a:cmd . "\r")
+ call chansend(s:comm_job_id, $"{a:cmd}\r")
endif
endfunc
" This is global so that a user can create their mappings with this.
func TermDebugSendCommand(cmd)
if s:way == 'prompt'
- call chansend(s:gdbjob, a:cmd . "\n")
+ call chansend(s:gdbjob, $"{a:cmd}\n")
else
let do_continue = 0
if !s:stopped
@@ -589,7 +591,7 @@ func TermDebugSendCommand(cmd)
sleep 10m
endif
" TODO: should we prepend CTRL-U to clear the command?
- call chansend(s:gdb_job_id, a:cmd . "\r")
+ call chansend(s:gdb_job_id, $"{a:cmd}\r")
if do_continue
Continue
endif
@@ -602,11 +604,11 @@ endfunc
func s:SendResumingCommand(cmd)
if s:stopped
" reset s:stopped here, it may take a bit of time before we get a response
- let s:stopped = 0
+ let s:stopped = v:false
" call ch_log('assume that program is running after this command')
call s:SendCommand(a:cmd)
" else
- " call ch_log('dropping command, program is running: ' . a:cmd)
+ " call ch_log($'dropping command, program is running: {a:cmd}')
endif
endfunc
@@ -651,7 +653,7 @@ endfunc
" Function called when gdb outputs text.
func s:GdbOutCallback(job_id, msgs, event)
- "call ch_log('received from gdb: ' . a:text)
+ " call ch_log($'received from gdb: {a:text}')
let comm_msgs = []
let lines = []
@@ -710,7 +712,7 @@ endfunc
" - change \\ to \
func s:DecodeMessage(quotedText, literal)
if a:quotedText[0] != '"'
- call s:Echoerr('DecodeMessage(): missing quote in ' . a:quotedText)
+ call s:Echoerr($'DecodeMessage(): missing quote in {a:quotedText}')
return
endif
let msg = a:quotedText
@@ -776,23 +778,23 @@ endfunc
func s:EndDebugCommon()
let curwinid = win_getid()
- if exists('s:ptybuf') && s:ptybuf
- exe 'bwipe! ' . s:ptybuf
+ if exists('s:ptybufnr') && s:ptybufnr
+ exe $'bwipe! {s:ptybufnr}'
endif
- if s:asmbuf > 0 && bufexists(s:asmbuf)
- exe 'bwipe! ' . s:asmbuf
+ if s:asmbufnr > 0 && bufexists(s:asmbufnr)
+ exe $'bwipe! {s:asmbufnr}'
endif
- if s:varbuf > 0 && bufexists(s:varbuf)
- exe 'bwipe! ' . s:varbuf
+ if s:varbufnr > 0 && bufexists(s:varbufnr)
+ exe $'bwipe! {s:varbufnr}'
endif
- let s:running = 0
+ let s:running = v:false
" Restore 'signcolumn' in all buffers for which it was set.
call win_gotoid(s:sourcewin)
let was_buf = bufnr()
for bufnr in s:signcolumn_buflist
if bufexists(bufnr)
- exe bufnr .. "buf"
+ exe $":{bufnr}buf"
if exists('b:save_signcolumn')
let &signcolumn = b:save_signcolumn
unlet b:save_signcolumn
@@ -800,15 +802,15 @@ func s:EndDebugCommon()
endif
endfor
if bufexists(was_buf)
- exe was_buf .. "buf"
+ exe $":{was_buf}buf"
endif
call s:DeleteCommands()
call win_gotoid(curwinid)
- if s:save_columns > 0
- let &columns = s:save_columns
+ if s:saved_columns > 0
+ let &columns = s:saved_columns
endif
if exists('#User#TermdebugStopPost')
@@ -824,7 +826,7 @@ func s:EndPromptDebug(job_id, exit_code, event)
endif
if bufexists(s:promptbuf)
- exe 'bwipe! ' . s:promptbuf
+ exe $'bwipe! {s:promptbuf}'
endif
call s:EndDebugCommon()
@@ -853,7 +855,7 @@ func s:HandleDisasmMsg(msg)
set nomodified
set filetype=asm
- let lnum = search('^' . s:asm_addr)
+ let lnum = search($'^{s:asm_addr}')
if lnum != 0
call sign_unplace('TermDebug', #{id: s:asm_id})
call sign_place(s:asm_id, 'TermDebug', 'debugPC', '%', #{lnum: lnum})
@@ -915,11 +917,8 @@ func s:HandleVariablesMsg(msg)
silent! %delete _
let spaceBuffer = 20
- call setline(1, 'Type' .
- \ repeat(' ', 16) .
- \ 'Name' .
- \ repeat(' ', 16) .
- \ 'Value')
+ let spaces = repeat(' ', 16)
+ call setline(1, $'Type{spaces}Name{spaces}Value')
let cnt = 1
let capture = '{name=".\{-}",\%(arg=".\{-}",\)\{0,1\}type=".\{-}"\%(,value=".\{-}"\)\{0,1\}}'
let varinfo = matchstr(a:msg, capture, 0, cnt)
@@ -1027,8 +1026,8 @@ func s:InstallCommands()
let map = g:termdebug_map_K
endif
if map
- let s:k_map_saved = maparg('K', 'n', 0, 1)
- if !empty(s:k_map_saved) && !s:k_map_saved.buffer || empty(s:k_map_saved)
+ let s:saved_K_map = maparg('K', 'n', 0, 1)
+ if !empty(s:saved_K_map) && !s:saved_K_map.buffer || empty(s:saved_K_map)
nnoremap K :Evaluate<CR>
endif
endif
@@ -1038,8 +1037,8 @@ func s:InstallCommands()
let map = get(g:termdebug_config, 'map_plus', 1)
endif
if map
- let s:plus_map_saved = maparg('+', 'n', 0, 1)
- if !empty(s:plus_map_saved) && !s:plus_map_saved.buffer || empty(s:plus_map_saved)
+ let s:saved_plus_map = maparg('+', 'n', 0, 1)
+ if !empty(s:saved_plus_map) && !s:saved_plus_map.buffer || empty(s:saved_plus_map)
nnoremap <expr> + $'<Cmd>{v:count1}Up<CR>'
endif
endif
@@ -1049,8 +1048,8 @@ func s:InstallCommands()
let map = get(g:termdebug_config, 'map_minus', 1)
endif
if map
- let s:minus_map_saved = maparg('-', 'n', 0, 1)
- if !empty(s:minus_map_saved) && !s:minus_map_saved.buffer || empty(s:minus_map_saved)
+ let s:saved_minus_map = maparg('-', 'n', 0, 1)
+ if !empty(s:saved_minus_map) && !s:saved_minus_map.buffer || empty(s:saved_minus_map)
nnoremap <expr> - $'<Cmd>{v:count1}Down<CR>'
endif
endif
@@ -1118,32 +1117,32 @@ func s:DeleteCommands()
delcommand Var
delcommand Winbar
- if exists('s:k_map_saved')
- if !empty(s:k_map_saved) && !s:k_map_saved.buffer
+ if exists('s:saved_K_map')
+ if !empty(s:saved_K_map) && !s:saved_K_map.buffer
nunmap K
- call mapset(s:k_map_saved)
- elseif empty(s:k_map_saved)
+ call mapset(s:saved_K_map)
+ elseif empty(s:saved_K_map)
nunmap K
endif
- unlet s:k_map_saved
+ unlet s:saved_K_map
endif
- if exists('s:plus_map_saved')
- if !empty(s:plus_map_saved) && !s:plus_map_saved.buffer
+ if exists('s:saved_plus_map')
+ if !empty(s:saved_plus_map) && !s:saved_plus_map.buffer
nunmap +
- call mapset(s:plus_map_saved)
- elseif empty(s:plus_map_saved)
+ call mapset(s:saved_plus_map)
+ elseif empty(s:saved_plus_map)
nunmap +
endif
- unlet s:plus_map_saved
+ unlet s:saved_plus_map
endif
- if exists('s:minus_map_saved')
- if !empty(s:minus_map_saved) && !s:minus_map_saved.buffer
+ if exists('s:saved_minus_map')
+ if !empty(s:saved_minus_map) && !s:saved_minus_map.buffer
nunmap -
- call mapset(s:minus_map_saved)
- elseif empty(s:minus_map_saved)
+ call mapset(s:saved_minus_map)
+ elseif empty(s:saved_minus_map)
nunmap -
endif
- unlet s:minus_map_saved
+ unlet s:saved_minus_map
endif
if has('menu')
@@ -1182,16 +1181,21 @@ func s:DeleteCommands()
let s:BreakpointSigns = []
endfunc
+func s:QuoteArg(x)
+ " Find all the occurrences of " and \ and escape them and double quote
+ " the resulting string.
+ return printf('"%s"', a:x->substitute('[\\"]', '\\&', 'g'))
+endfunc
+
" :Until - Execute until past a specified position or current line
func s:Until(at)
if s:stopped
" reset s:stopped here, it may take a bit of time before we get a response
- let s:stopped = 0
+ let s:stopped = v:false
" call ch_log('assume that program is running after this command')
" Use the fname:lnum format
- let at = empty(a:at) ?
- \ fnameescape(expand('%:p')) . ':' . line('.') : a:at
- call s:SendCommand('-exec-until ' . at)
+ let at = empty(a:at) ? s:QuoteArg($"{expand('%:p')}:{line('.')}") : a:at
+ call s:SendCommand($'-exec-until {at}')
" else
" call ch_log('dropping command, program is running: exec-until')
endif
@@ -1209,12 +1213,11 @@ func s:SetBreakpoint(at, tbreak=v:false)
endif
" Use the fname:lnum format, older gdb can't handle --source.
- let at = empty(a:at) ?
- \ fnameescape(expand('%:p')) . ':' . line('.') : a:at
+ let at = empty(a:at) ? s:QuoteArg($"{expand('%:p')}:{line('.')}") : a:at
if a:tbreak
- let cmd = '-break-insert -t ' . at
+ let cmd = $'-break-insert -t {at}'
else
- let cmd = '-break-insert ' . at
+ let cmd = $'-break-insert {at}'
endif
call s:SendCommand(cmd)
if do_continue
@@ -1233,7 +1236,7 @@ func s:ClearBreakpoint()
for id in s:breakpoint_locations[bploc]
if has_key(s:breakpoints, id)
" Assume this always works, the reply is simply "^done".
- call s:SendCommand('-break-delete ' . id)
+ call s:SendCommand($'-break-delete {id}')
for subid in keys(s:breakpoints[id])
call sign_unplace('TermDebug',
\ #{id: s:Breakpoint2SignNumber(id, subid)})
@@ -1250,18 +1253,18 @@ func s:ClearBreakpoint()
if empty(s:breakpoint_locations[bploc])
unlet s:breakpoint_locations[bploc]
endif
- echomsg 'Breakpoint ' . id . ' cleared from line ' . lnum . '.'
+ echomsg $'Breakpoint {nr} cleared from line {lnum}.'
else
- call s:Echoerr('Internal error trying to remove breakpoint at line ' . lnum . '!')
+ call s:Echoerr($'Internal error trying to remove breakpoint at line {lnum}!')
endif
else
- echomsg 'No breakpoint to remove at line ' . lnum . '.'
+ echomsg $'No breakpoint to remove at line {lnum}.'
endif
endfunc
func s:Run(args)
if a:args != ''
- call s:SendResumingCommand('-exec-arguments ' . a:args)
+ call s:SendResumingCommand($'-exec-arguments {a:args}')
endif
call s:SendResumingCommand('-exec-run')
endfunc
@@ -1275,13 +1278,13 @@ func s:Frame(arg)
" already parsed and allows for more formats
if a:arg =~ '^\d\+$' || a:arg == ''
" specify frame by number
- call s:SendCommand('-interpreter-exec mi "frame ' . a:arg .'"')
+ call s:SendCommand($'-interpreter-exec mi "frame {a:arg}"')
elseif a:arg =~ '^0x[0-9a-fA-F]\+$'
" specify frame by stack address
- call s:SendCommand('-interpreter-exec mi "frame address ' . a:arg .'"')
+ call s:SendCommand($'-interpreter-exec mi "frame address {a:arg}"')
else
" specify frame by function name
- call s:SendCommand('-interpreter-exec mi "frame function ' . a:arg .'"')
+ call s:SendCommand($'-interpreter-exec mi "frame function {a:arg}"')
endif
endfunc
@@ -1307,10 +1310,10 @@ func s:SendEval(expr)
endif
" encoding expression to prevent bad errors
- let expr = a:expr
- let expr = substitute(expr, '\\', '\\\\', 'g')
- let expr = substitute(expr, '"', '\\"', 'g')
- call s:SendCommand('-data-evaluate-expression "' . expr . '"')
+ let expr_escaped = a:expr
+ \ ->substitute('\\', '\\\\', 'g')
+ \ ->substitute('"', '\\"', 'g')
+ call s:SendCommand($'-data-evaluate-expression "{expr_escaped}"')
let s:evalexpr = exprLHS
endfunc
@@ -1322,9 +1325,9 @@ func s:Evaluate(range, arg)
return
endif
let expr = s:GetEvaluationExpression(a:range, a:arg)
- let s:evalFromBalloonExpr = 1
+ let s:evalFromBalloonExpr = v:true
let s:evalFromBalloonExprResult = ''
- let s:ignoreEvalError = 0
+ let s:ignoreEvalError = v:false
call s:SendEval(expr)
endfunc
@@ -1343,12 +1346,12 @@ func s:GetEvaluationExpression(range, arg)
let expr = s:CleanupExpr(@v)
call setpos('.', pos)
call setreg('v', reg, regt)
- let s:evalFromBalloonExpr = 1
+ let s:evalFromBalloonExpr = v:true
else
" no evaluation provided: get from C-expression under cursor
" TODO: allow filetype specific lookup #9057
let expr = expand('<cexpr>')
- let s:evalFromBalloonExpr = 1
+ let s:evalFromBalloonExpr = v:true
endif
return expr
endfunc
@@ -1376,8 +1379,8 @@ func s:CleanupExpr(expr)
return expr
endfunc
-let s:ignoreEvalError = 0
-let s:evalFromBalloonExpr = 0
+let s:ignoreEvalError = v:false
+let s:evalFromBalloonExpr = v:false
let s:evalFromBalloonExprResult = ''
let s:eval_float_win_id = -1
@@ -1400,9 +1403,9 @@ func s:HandleEvaluate(msg)
\ ->substitute(' ', '\1', '')
if s:evalFromBalloonExpr
if s:evalFromBalloonExprResult == ''
- let s:evalFromBalloonExprResult = s:evalexpr . ': ' . value
+ let s:evalFromBalloonExprResult = $'{s:evalexpr}: {value}'
else
- let s:evalFromBalloonExprResult .= ' = ' . value
+ let s:evalFromBalloonExprResult ..= $' = {value}'
endif
" NEOVIM:
" - Result pretty-printing is not implemented. Vim prettifies the result
@@ -1414,13 +1417,13 @@ func s:HandleEvaluate(msg)
" 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
+ echomsg $'"{s:evalexpr}": {value}'
endif
if s:evalexpr[0] != '*' && value =~ '^0x' && value != '0x0' && value !~ '"$'
" Looks like a pointer, also display what it points to.
- let s:ignoreEvalError = 1
- call s:SendEval('*' . s:evalexpr)
+ let s:ignoreEvalError = v:true
+ call s:SendEval($'*{s:evalexpr}')
endif
endfunc
@@ -1428,8 +1431,8 @@ endfunc
func s:HandleError(msg)
if s:ignoreEvalError
" Result of s:SendEval() failed, ignore.
- let s:ignoreEvalError = 0
- let s:evalFromBalloonExpr = 0
+ let s:ignoreEvalError = v:false
+ let s:evalFromBalloonExpr = v:false
return
endif
let msgVal = substitute(a:msg, '.*msg="\(.*\)"', '\1', '')
@@ -1471,7 +1474,7 @@ func s:GotoAsmwinOrCreateIt()
" 60 is approx spaceBuffer * 3
if winwidth(0) > (78 + 60)
let mdf = 'vert'
- exe mdf .. ' ' .. 60 .. 'new'
+ exe $'{mdf} :60new'
else
exe 'rightbelow new'
endif
@@ -1489,23 +1492,23 @@ func s:GotoAsmwinOrCreateIt()
setlocal signcolumn=no
setlocal modifiable
- if s:asmbuf > 0 && bufexists(s:asmbuf)
- exe 'buffer' . s:asmbuf
+ if s:asmbufnr > 0 && bufexists(s:asmbufnr)
+ exe $'buffer {s:asmbufnr}'
elseif empty(glob('Termdebug-asm-listing'))
silent file Termdebug-asm-listing
- let s:asmbuf = bufnr('Termdebug-asm-listing')
+ let s:asmbufnr = bufnr('Termdebug-asm-listing')
else
call s:Echoerr("You have a file/folder named 'Termdebug-asm-listing'.
\ Please exit and rename it because Termdebug may not work as expected.")
endif
if mdf != 'vert' && s:GetDisasmWindowHeight() > 0
- exe 'resize ' .. s:GetDisasmWindowHeight()
+ exe $'resize {s:GetDisasmWindowHeight()}'
endif
endif
if s:asm_addr != ''
- let lnum = search('^' . s:asm_addr)
+ let lnum = search($'^{s:asm_addr}')
if lnum == 0
if s:stopped
call s:SendCommand('disassemble $pc')
@@ -1544,7 +1547,7 @@ func s:GotoVariableswinOrCreateIt()
" 60 is approx spaceBuffer * 3
if winwidth(0) > (78 + 60)
let mdf = 'vert'
- exe mdf .. ' ' .. 60 .. 'new'
+ exe $'{mdf} :60new'
else
exe 'rightbelow new'
endif
@@ -1561,18 +1564,18 @@ func s:GotoVariableswinOrCreateIt()
setlocal signcolumn=no
setlocal modifiable
- if s:varbuf > 0 && bufexists(s:varbuf)
- exe 'buffer' . s:varbuf
+ if s:varbufnr > 0 && bufexists(s:varbufnr)
+ exe $'buffer {s:varbufnr}'
elseif empty(glob('Termdebug-variables-listing'))
silent file Termdebug-variables-listing
- let s:varbuf = bufnr('Termdebug-variables-listing')
+ let s:varbufnr = bufnr('Termdebug-variables-listing')
else
call s:Echoerr("You have a file/folder named 'Termdebug-variables-listing'.
\ Please exit and rename it because Termdebug may not work as expected.")
endif
if mdf != 'vert' && s:GetVariablesWindowHeight() > 0
- exe 'resize ' .. s:GetVariablesWindowHeight()
+ exe $'resize {s:GetVariablesWindowHeight()}'
endif
endif
@@ -1588,14 +1591,14 @@ func s:HandleCursor(msg)
if a:msg =~ '^\*stopped'
"call ch_log('program stopped')
- let s:stopped = 1
+ let s:stopped = v:true
if a:msg =~ '^\*stopped,reason="exited-normally"'
- let s:running = 0
+ let s:running = v:false
endif
elseif a:msg =~ '^\*running'
"call ch_log('program running')
- let s:stopped = 0
- let s:running = 1
+ let s:stopped = v:false
+ let s:running = v:true
endif
if a:msg =~ 'fullname='
@@ -1611,7 +1614,7 @@ func s:HandleCursor(msg)
let curwinid = win_getid()
if win_gotoid(s:asmwin)
- let lnum = search('^' . s:asm_addr)
+ let lnum = search($'^{s:asm_addr}')
if lnum == 0
call s:SendCommand('disassemble $pc')
else
@@ -1633,7 +1636,7 @@ func s:HandleCursor(msg)
if lnum =~ '^[0-9]*$'
call s:GotoSourcewinOrCreateIt()
if expand('%:p') != fnamemodify(fname, ':p')
- echomsg 'different fname: "' .. expand('%:p') .. '" vs "' .. fnamemodify(fname, ':p') .. '"'
+ echomsg $"different fname: '{expand('%:p')}' vs '{fnamemodify(fname, ':p')}'"
augroup Termdebug
" Always open a file read-only instead of showing the ATTENTION
" prompt, since it is unlikely we want to edit the file.
@@ -1645,17 +1648,17 @@ func s:HandleCursor(msg)
augroup END
if &modified
" TODO: find existing window
- exe 'split ' . fnameescape(fname)
+ exe $'split {fnameescape(fname)}'
let s:sourcewin = win_getid()
call s:InstallWinbar(0)
else
- exe 'edit ' . fnameescape(fname)
+ exe $'edit {fnameescape(fname)}'
endif
augroup Termdebug
au! SwapExists
augroup END
endif
- exe lnum
+ exe $":{lnum}"
normal! zv
call sign_unplace('TermDebug', #{id: s:pc_id})
call sign_place(s:pc_id, 'TermDebug', 'debugPC', fname,
@@ -1694,7 +1697,7 @@ func s:CreateBreakpoint(id, subid, enabled)
let label = 'F+'
endif
endif
- call sign_define('debugBreakpoint' .. nr,
+ call sign_define($'debugBreakpoint{nr}',
\ #{text: slice(label, 0, 2),
\ texthl: hiName})
endif
@@ -1712,7 +1715,7 @@ func s:HandleNewBreakpoint(msg, modifiedFlag)
if a:msg =~ 'pending='
let nr = substitute(a:msg, '.*number=\"\([0-9.]*\)\".*', '\1', '')
let target = substitute(a:msg, '.*pending=\"\([^"]*\)\".*', '\1', '')
- echomsg 'Breakpoint ' . nr . ' (' . target . ') pending.'
+ echomsg $'Breakpoint {nr} ({target}) pending.'
endif
return
endif
@@ -1757,9 +1760,9 @@ func s:HandleNewBreakpoint(msg, modifiedFlag)
if bufloaded(fname)
call s:PlaceSign(id, subid, entry)
- let posMsg = ' at line ' . lnum . '.'
+ let posMsg = $' at line {lnum}.'
else
- let posMsg = ' in ' . fname . ' at line ' . lnum . '.'
+ let posMsg = $' in {fname} at line {lnum}.'
endif
if !a:modifiedFlag
let actionTaken = 'created'
@@ -1768,14 +1771,14 @@ func s:HandleNewBreakpoint(msg, modifiedFlag)
else
let actionTaken = 'enabled'
endif
- echomsg 'Breakpoint ' . nr . ' ' . actionTaken . posMsg
+ echom $'Breakpoint {nr} {actionTaken}{posMsg}'
endfor
endfunc
func s:PlaceSign(id, subid, entry)
let nr = printf('%d.%d', a:id, a:subid)
call sign_place(s:Breakpoint2SignNumber(a:id, a:subid), 'TermDebug',
- \ 'debugBreakpoint' .. nr, a:entry['fname'],
+ \ $'debugBreakpoint{nr}', a:entry['fname'],
\ #{lnum: a:entry['lnum'], priority: 110})
let a:entry['placed'] = 1
endfunc
@@ -1796,7 +1799,7 @@ func s:HandleBreakpointDelete(msg)
endif
endfor
unlet s:breakpoints[id]
- echomsg 'Breakpoint ' . id . ' cleared.'
+ echomsg $'Breakpoint {id} cleared.'
endif
endfunc
@@ -1808,7 +1811,7 @@ func s:HandleProgramRun(msg)
return
endif
let s:pid = nr
- "call ch_log('Detected process ID: ' . s:pid)
+ " call ch_log($'Detected process ID: {s:pid}')
endfunc
" Handle a BufRead autocommand event: place any signs.
diff --git a/runtime/plugin/matchparen.vim b/runtime/plugin/matchparen.vim
index 6c061c9fb8..2899612dce 100644
--- a/runtime/plugin/matchparen.vim
+++ b/runtime/plugin/matchparen.vim
@@ -60,12 +60,8 @@ func s:Highlight_Matching_Pair()
let before = 0
let text = getline(c_lnum)
- let matches = matchlist(text, '\(.\)\=\%'.c_col.'c\(.\=\)')
- if empty(matches)
- let [c_before, c] = ['', '']
- else
- let [c_before, c] = matches[1:2]
- endif
+ let c_before = text->strpart(0, c_col - 1)->slice(-1)
+ let c = text->strpart(c_col - 1)->slice(0, 1)
let plist = split(&matchpairs, '.\zs[:,]')
let i = index(plist, c)
if i < 0
diff --git a/runtime/plugin/tohtml.lua b/runtime/plugin/tohtml.lua
index 79f2794a40..0cb4562938 100644
--- a/runtime/plugin/tohtml.lua
+++ b/runtime/plugin/tohtml.lua
@@ -5,8 +5,8 @@ vim.g.loaded_2html_plugin = true
vim.api.nvim_create_user_command('TOhtml', function(args)
local outfile = args.args ~= '' and args.args or vim.fn.tempname() .. '.html'
- local html = require('tohtml').tohtml()
+ local html = require('tohtml').tohtml(0, { range = { args.line1, args.line2 } })
vim.fn.writefile(html, outfile)
vim.cmd.split(outfile)
vim.bo.filetype = 'html'
-end, { bar = true, nargs = '?' })
+end, { bar = true, nargs = '?', range = '%' })
diff --git a/runtime/queries/bash/folds.scm b/runtime/queries/bash/folds.scm
deleted file mode 100644
index 766dbe598b..0000000000
--- a/runtime/queries/bash/folds.scm
+++ /dev/null
@@ -1,9 +0,0 @@
-[
- (function_definition)
- (if_statement)
- (case_statement)
- (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
deleted file mode 100644
index feb0e038ea..0000000000
--- a/runtime/queries/bash/highlights.scm
+++ /dev/null
@@ -1,232 +0,0 @@
-[
- "("
- ")"
- "{"
- "}"
- "["
- "]"
- "[["
- "]]"
- "(("
- "))"
-] @punctuation.bracket
-
-[
- ";"
- ";;"
- ";&"
- ";;&"
- "&"
-] @punctuation.delimiter
-
-[
- ">"
- ">>"
- "<"
- "<<"
- "&&"
- "|"
- "|&"
- "||"
- "="
- "+="
- "=~"
- "=="
- "!="
- "&>"
- "&>>"
- "<&"
- ">&"
- ">|"
- "<&-"
- ">&-"
- "<<-"
- "<<<"
- ".."
- "!"
-] @operator
-
-; Do *not* spell check strings since they typically have some sort of
-; interpolation in them, or, are typically used for things like filenames, URLs,
-; flags and file content.
-[
- (string)
- (raw_string)
- (ansi_c_string)
- (heredoc_body)
-] @string
-
-[
- (heredoc_start)
- (heredoc_end)
-] @label
-
-(variable_assignment
- (word) @string)
-
-(command
- argument: "$" @string) ; bare dollar
-
-(concatenation
- (word) @string)
-
-[
- "if"
- "then"
- "else"
- "elif"
- "fi"
- "case"
- "in"
- "esac"
-] @keyword.conditional
-
-[
- "for"
- "do"
- "done"
- "select"
- "until"
- "while"
-] @keyword.repeat
-
-[
- "declare"
- "typeset"
- "export"
- "readonly"
- "local"
- "unset"
- "unsetenv"
-] @keyword
-
-"function" @keyword.function
-
-(special_variable_name) @constant
-
-; trap -l
-((word) @constant.builtin
- (#any-of? @constant.builtin
- "SIGHUP" "SIGINT" "SIGQUIT" "SIGILL" "SIGTRAP" "SIGABRT" "SIGBUS" "SIGFPE" "SIGKILL" "SIGUSR1"
- "SIGSEGV" "SIGUSR2" "SIGPIPE" "SIGALRM" "SIGTERM" "SIGSTKFLT" "SIGCHLD" "SIGCONT" "SIGSTOP"
- "SIGTSTP" "SIGTTIN" "SIGTTOU" "SIGURG" "SIGXCPU" "SIGXFSZ" "SIGVTALRM" "SIGPROF" "SIGWINCH"
- "SIGIO" "SIGPWR" "SIGSYS" "SIGRTMIN" "SIGRTMIN+1" "SIGRTMIN+2" "SIGRTMIN+3" "SIGRTMIN+4"
- "SIGRTMIN+5" "SIGRTMIN+6" "SIGRTMIN+7" "SIGRTMIN+8" "SIGRTMIN+9" "SIGRTMIN+10" "SIGRTMIN+11"
- "SIGRTMIN+12" "SIGRTMIN+13" "SIGRTMIN+14" "SIGRTMIN+15" "SIGRTMAX-14" "SIGRTMAX-13"
- "SIGRTMAX-12" "SIGRTMAX-11" "SIGRTMAX-10" "SIGRTMAX-9" "SIGRTMAX-8" "SIGRTMAX-7" "SIGRTMAX-6"
- "SIGRTMAX-5" "SIGRTMAX-4" "SIGRTMAX-3" "SIGRTMAX-2" "SIGRTMAX-1" "SIGRTMAX"))
-
-((word) @boolean
- (#any-of? @boolean "true" "false"))
-
-(comment) @comment @spell
-
-(test_operator) @operator
-
-(command_substitution
- "$(" @punctuation.special
- ")" @punctuation.special)
-
-(process_substitution
- [
- "<("
- ">("
- ] @punctuation.special
- ")" @punctuation.special)
-
-(arithmetic_expansion
- [
- "$(("
- "(("
- ] @punctuation.special
- "))" @punctuation.special)
-
-(arithmetic_expansion
- "," @punctuation.delimiter)
-
-(ternary_expression
- [
- "?"
- ":"
- ] @keyword.conditional.ternary)
-
-(binary_expression
- operator: _ @operator)
-
-(unary_expression
- operator: _ @operator)
-
-(postfix_expression
- operator: _ @operator)
-
-(function_definition
- name: (word) @function)
-
-(command_name
- (word) @function.call)
-
-(command_name
- (word) @function.builtin
- (#any-of? @function.builtin
- "alias" "bg" "bind" "break" "builtin" "caller" "cd" "command" "compgen" "complete" "compopt"
- "continue" "coproc" "dirs" "disown" "echo" "enable" "eval" "exec" "exit" "fc" "fg" "getopts"
- "hash" "help" "history" "jobs" "kill" "let" "logout" "mapfile" "popd" "printf" "pushd" "pwd"
- "read" "readarray" "return" "set" "shift" "shopt" "source" "suspend" "test" "time" "times"
- "trap" "type" "typeset" "ulimit" "umask" "unalias" "wait"))
-
-(command
- argument: [
- (word) @variable.parameter
- (concatenation
- (word) @variable.parameter)
- ])
-
-(number) @number
-
-((word) @number
- (#lua-match? @number "^[0-9]+$"))
-
-(file_redirect
- destination: (word) @variable.parameter)
-
-(file_descriptor) @operator
-
-(simple_expansion
- "$" @punctuation.special) @none
-
-(expansion
- "${" @punctuation.special
- "}" @punctuation.special) @none
-
-(expansion
- operator: _ @punctuation.special)
-
-(expansion
- "@"
- .
- operator: _ @character.special)
-
-((expansion
- (subscript
- index: (word) @character.special))
- (#any-of? @character.special "@" "*"))
-
-"``" @punctuation.special
-
-(variable_name) @variable
-
-((variable_name) @constant
- (#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
-
-(case_item
- value: (word) @variable.parameter)
-
-[
- (regex)
- (extglob_pattern)
-] @string.regexp
-
-((program
- .
- (comment) @keyword.directive @nospell)
- (#lua-match? @keyword.directive "^#!/"))
diff --git a/runtime/queries/bash/injections.scm b/runtime/queries/bash/injections.scm
deleted file mode 100644
index 427b414958..0000000000
--- a/runtime/queries/bash/injections.scm
+++ /dev/null
@@ -1,3 +0,0 @@
-(heredoc_redirect
- (heredoc_body) @injection.content
- (heredoc_end) @injection.language)
diff --git a/runtime/queries/c/highlights.scm b/runtime/queries/c/highlights.scm
index 170937c8f8..eba272d5c9 100644
--- a/runtime/queries/c/highlights.scm
+++ b/runtime/queries/c/highlights.scm
@@ -1,6 +1,6 @@
; Lower priority to prefer @variable.parameter when identifier appears in parameter_declaration.
((identifier) @variable
- (#set! "priority" 95))
+ (#set! priority 95))
(preproc_def
(preproc_arg) @variable)
diff --git a/runtime/queries/lua/highlights.scm b/runtime/queries/lua/highlights.scm
index 0c8f07f290..01c280f2d5 100644
--- a/runtime/queries/lua/highlights.scm
+++ b/runtime/queries/lua/highlights.scm
@@ -162,7 +162,7 @@
; Tables
(field
- name: (identifier) @variable.member)
+ name: (identifier) @property)
(dot_index_expression
field: (identifier) @variable.member)
diff --git a/runtime/queries/markdown/highlights.scm b/runtime/queries/markdown/highlights.scm
index 4b445e02f3..a12669ca2b 100644
--- a/runtime/queries/markdown/highlights.scm
+++ b/runtime/queries/markdown/highlights.scm
@@ -8,28 +8,22 @@
(setext_h2_underline) @markup.heading.2)
(atx_heading
- (atx_h1_marker) @markup.heading.1
- (inline) @markup.heading.1)
+ (atx_h1_marker)) @markup.heading.1
(atx_heading
- (atx_h2_marker) @markup.heading.2
- (inline) @markup.heading.2)
+ (atx_h2_marker)) @markup.heading.2
(atx_heading
- (atx_h3_marker) @markup.heading.3
- (inline) @markup.heading.3)
+ (atx_h3_marker)) @markup.heading.3
(atx_heading
- (atx_h4_marker) @markup.heading.4
- (inline) @markup.heading.4)
+ (atx_h4_marker)) @markup.heading.4
(atx_heading
- (atx_h5_marker) @markup.heading.5
- (inline) @markup.heading.5)
+ (atx_h5_marker)) @markup.heading.5
(atx_heading
- (atx_h6_marker) @markup.heading.6
- (inline) @markup.heading.6)
+ (atx_h6_marker)) @markup.heading.6
(info_string) @label
@@ -51,7 +45,7 @@
(indented_code_block) @markup.raw.block
((fenced_code_block) @markup.raw.block
- (#set! "priority" 90))
+ (#set! priority 90))
(fenced_code_block
(fenced_code_block_delimiter) @markup.raw.block
@@ -109,13 +103,13 @@
(task_list_marker_checked) @markup.list.checked
((block_quote) @markup.quote
- (#set! "priority" 90))
+ (#set! priority 90))
([
(plus_metadata)
(minus_metadata)
] @keyword.directive
- (#set! "priority" 90))
+ (#set! priority 90))
[
(block_continuation)
diff --git a/runtime/queries/markdown_inline/highlights.scm b/runtime/queries/markdown_inline/highlights.scm
index 233ab411cd..148ef0fad0 100644
--- a/runtime/queries/markdown_inline/highlights.scm
+++ b/runtime/queries/markdown_inline/highlights.scm
@@ -43,7 +43,12 @@
(inline_link
(link_text) @_label
(link_destination) @_url
- (#set! @_label "url" @_url))
+ (#set! @_label url @_url))
+
+(image
+ (image_description) @_label
+ (link_destination) @_url
+ (#set! @_label url @_url))
; Conceal image links
(image
@@ -85,12 +90,22 @@
[
(link_destination)
(uri_autolink)
+ (email_autolink)
] @markup.link.url @nospell
+((link_destination) @_url
+ (#set! @_url url @_url))
+
+((uri_autolink) @_url
+ (#offset! @_url 0 1 0 -1)
+ (#set! @_url url @_url))
+
+(entity_reference) @nospell
+
; Replace common HTML entities.
((entity_reference) @character.special
(#eq? @character.special "&nbsp;")
- (#set! conceal ""))
+ (#set! conceal " "))
((entity_reference) @character.special
(#eq? @character.special "&lt;")
diff --git a/runtime/queries/python/folds.scm b/runtime/queries/python/folds.scm
deleted file mode 100644
index ecb9352d78..0000000000
--- a/runtime/queries/python/folds.scm
+++ /dev/null
@@ -1,28 +0,0 @@
-[
- (function_definition)
- (class_definition)
- (while_statement)
- (for_statement)
- (if_statement)
- (with_statement)
- (try_statement)
- (match_statement)
- (import_from_statement)
- (parameters)
- (argument_list)
- (parenthesized_expression)
- (generator_expression)
- (list_comprehension)
- (set_comprehension)
- (dictionary_comprehension)
- (tuple)
- (list)
- (set)
- (dictionary)
- (string)
-] @fold
-
-[
- (import_statement)
- (import_from_statement)
-]+ @fold
diff --git a/runtime/queries/python/highlights.scm b/runtime/queries/python/highlights.scm
deleted file mode 100644
index 5e5a2a88de..0000000000
--- a/runtime/queries/python/highlights.scm
+++ /dev/null
@@ -1,457 +0,0 @@
-; From tree-sitter-python licensed under MIT License
-; Copyright (c) 2016 Max Brunsfeld
-; Variables
-(identifier) @variable
-
-; Reset highlighting in f-string interpolations
-(interpolation) @none
-
-; Identifier naming conventions
-((identifier) @type
- (#lua-match? @type "^[A-Z].*[a-z]"))
-
-((identifier) @constant
- (#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
-
-((identifier) @constant.builtin
- (#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$"))
-
-((identifier) @constant.builtin
- (#any-of? @constant.builtin
- ; https://docs.python.org/3/library/constants.html
- "NotImplemented" "Ellipsis" "quit" "exit" "copyright" "credits" "license"))
-
-"_" @constant.builtin ; match wildcard
-
-((attribute
- attribute: (identifier) @variable.member)
- (#lua-match? @variable.member "^[%l_].*$"))
-
-((assignment
- left: (identifier) @type.definition
- (type
- (identifier) @_annotation))
- (#eq? @_annotation "TypeAlias"))
-
-((assignment
- left: (identifier) @type.definition
- right: (call
- function: (identifier) @_func))
- (#any-of? @_func "TypeVar" "NewType"))
-
-; Function calls
-(call
- function: (identifier) @function.call)
-
-(call
- function: (attribute
- attribute: (identifier) @function.method.call))
-
-((call
- function: (identifier) @constructor)
- (#lua-match? @constructor "^%u"))
-
-((call
- function: (attribute
- attribute: (identifier) @constructor))
- (#lua-match? @constructor "^%u"))
-
-; Decorators
-((decorator
- "@" @attribute)
- (#set! "priority" 101))
-
-(decorator
- (identifier) @attribute)
-
-(decorator
- (attribute
- attribute: (identifier) @attribute))
-
-(decorator
- (call
- (identifier) @attribute))
-
-(decorator
- (call
- (attribute
- attribute: (identifier) @attribute)))
-
-((decorator
- (identifier) @attribute.builtin)
- (#any-of? @attribute.builtin "classmethod" "property" "staticmethod"))
-
-; Builtin functions
-((call
- function: (identifier) @function.builtin)
- (#any-of? @function.builtin
- "abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr"
- "classmethod" "compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec"
- "filter" "float" "format" "frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id"
- "input" "int" "isinstance" "issubclass" "iter" "len" "list" "locals" "map" "max" "memoryview"
- "min" "next" "object" "oct" "open" "ord" "pow" "print" "property" "range" "repr" "reversed"
- "round" "set" "setattr" "slice" "sorted" "staticmethod" "str" "sum" "super" "tuple" "type"
- "vars" "zip" "__import__"))
-
-; Function definitions
-(function_definition
- name: (identifier) @function)
-
-(type
- (identifier) @type)
-
-(type
- (subscript
- (identifier) @type)) ; type subscript: Tuple[int]
-
-((call
- function: (identifier) @_isinstance
- arguments: (argument_list
- (_)
- (identifier) @type))
- (#eq? @_isinstance "isinstance"))
-
-; Normal parameters
-(parameters
- (identifier) @variable.parameter)
-
-; Lambda parameters
-(lambda_parameters
- (identifier) @variable.parameter)
-
-(lambda_parameters
- (tuple_pattern
- (identifier) @variable.parameter))
-
-; Default parameters
-(keyword_argument
- name: (identifier) @variable.parameter)
-
-; Naming parameters on call-site
-(default_parameter
- name: (identifier) @variable.parameter)
-
-(typed_parameter
- (identifier) @variable.parameter)
-
-(typed_default_parameter
- name: (identifier) @variable.parameter)
-
-; Variadic parameters *args, **kwargs
-(parameters
- (list_splat_pattern ; *args
- (identifier) @variable.parameter))
-
-(parameters
- (dictionary_splat_pattern ; **kwargs
- (identifier) @variable.parameter))
-
-; Typed variadic parameters
-(parameters
- (typed_parameter
- (list_splat_pattern ; *args: type
- (identifier) @variable.parameter)))
-
-(parameters
- (typed_parameter
- (dictionary_splat_pattern ; *kwargs: type
- (identifier) @variable.parameter)))
-
-; Lambda parameters
-(lambda_parameters
- (list_splat_pattern
- (identifier) @variable.parameter))
-
-(lambda_parameters
- (dictionary_splat_pattern
- (identifier) @variable.parameter))
-
-; Literals
-(none) @constant.builtin
-
-[
- (true)
- (false)
-] @boolean
-
-((identifier) @variable.builtin
- (#eq? @variable.builtin "self"))
-
-((identifier) @variable.builtin
- (#eq? @variable.builtin "cls"))
-
-(integer) @number
-
-(float) @number.float
-
-(comment) @comment @spell
-
-((module
- .
- (comment) @keyword.directive @nospell)
- (#lua-match? @keyword.directive "^#!/"))
-
-(string) @string
-
-[
- (escape_sequence)
- (escape_interpolation)
-] @string.escape
-
-; doc-strings
-(module
- .
- (comment)*
- .
- (expression_statement
- (string) @string.documentation))
-
-(class_definition
- body: (block
- .
- (expression_statement
- (string) @string.documentation)))
-
-(function_definition
- body: (block
- .
- (expression_statement
- (string) @string.documentation)))
-
-(module
- .
- (comment)*
- .
- (expression_statement
- (string
- (string_content) @spell)))
-
-(class_definition
- body: (block
- .
- (expression_statement
- (string
- (string_content) @spell))))
-
-(function_definition
- body: (block
- .
- (expression_statement
- (string
- (string_content) @spell))))
-
-; Tokens
-[
- "-"
- "-="
- ":="
- "!="
- "*"
- "**"
- "**="
- "*="
- "/"
- "//"
- "//="
- "/="
- "&"
- "&="
- "%"
- "%="
- "^"
- "^="
- "+"
- "+="
- "<"
- "<<"
- "<<="
- "<="
- "<>"
- "="
- "=="
- ">"
- ">="
- ">>"
- ">>="
- "@"
- "@="
- "|"
- "|="
- "~"
- "->"
-] @operator
-
-; Keywords
-[
- "and"
- "in"
- "is"
- "not"
- "or"
- "is not"
- "not in"
- "del"
-] @keyword.operator
-
-[
- "def"
- "lambda"
-] @keyword.function
-
-[
- "assert"
- "exec"
- "global"
- "nonlocal"
- "pass"
- "print"
- "with"
- "as"
-] @keyword
-
-[
- "type"
- "class"
-] @keyword.type
-
-[
- "async"
- "await"
-] @keyword.coroutine
-
-[
- "return"
- "yield"
-] @keyword.return
-
-(yield
- "from" @keyword.return)
-
-(future_import_statement
- "from" @keyword.import
- "__future__" @constant.builtin)
-
-(import_from_statement
- "from" @keyword.import)
-
-"import" @keyword.import
-
-(aliased_import
- "as" @keyword.import)
-
-[
- "if"
- "elif"
- "else"
- "match"
- "case"
-] @keyword.conditional
-
-[
- "for"
- "while"
- "break"
- "continue"
-] @keyword.repeat
-
-[
- "try"
- "except"
- "except*"
- "raise"
- "finally"
-] @keyword.exception
-
-(raise_statement
- "from" @keyword.exception)
-
-(try_statement
- (else_clause
- "else" @keyword.exception))
-
-[
- "("
- ")"
- "["
- "]"
- "{"
- "}"
-] @punctuation.bracket
-
-(interpolation
- "{" @punctuation.special
- "}" @punctuation.special)
-
-(type_conversion) @function.macro
-
-[
- ","
- "."
- ":"
- ";"
- (ellipsis)
-] @punctuation.delimiter
-
-; Class definitions
-(class_definition
- name: (identifier) @type)
-
-(class_definition
- body: (block
- (function_definition
- name: (identifier) @function.method)))
-
-(class_definition
- superclasses: (argument_list
- (identifier) @type))
-
-((class_definition
- body: (block
- (expression_statement
- (assignment
- left: (identifier) @variable.member))))
- (#lua-match? @variable.member "^[%l_].*$"))
-
-((class_definition
- body: (block
- (expression_statement
- (assignment
- left: (_
- (identifier) @variable.member)))))
- (#lua-match? @variable.member "^[%l_].*$"))
-
-((class_definition
- (block
- (function_definition
- name: (identifier) @constructor)))
- (#any-of? @constructor "__new__" "__init__"))
-
-((identifier) @type.builtin
- (#any-of? @type.builtin
- ; https://docs.python.org/3/library/exceptions.html
- "BaseException" "Exception" "ArithmeticError" "BufferError" "LookupError" "AssertionError"
- "AttributeError" "EOFError" "FloatingPointError" "GeneratorExit" "ImportError"
- "ModuleNotFoundError" "IndexError" "KeyError" "KeyboardInterrupt" "MemoryError" "NameError"
- "NotImplementedError" "OSError" "OverflowError" "RecursionError" "ReferenceError" "RuntimeError"
- "StopIteration" "StopAsyncIteration" "SyntaxError" "IndentationError" "TabError" "SystemError"
- "SystemExit" "TypeError" "UnboundLocalError" "UnicodeError" "UnicodeEncodeError"
- "UnicodeDecodeError" "UnicodeTranslateError" "ValueError" "ZeroDivisionError" "EnvironmentError"
- "IOError" "WindowsError" "BlockingIOError" "ChildProcessError" "ConnectionError"
- "BrokenPipeError" "ConnectionAbortedError" "ConnectionRefusedError" "ConnectionResetError"
- "FileExistsError" "FileNotFoundError" "InterruptedError" "IsADirectoryError"
- "NotADirectoryError" "PermissionError" "ProcessLookupError" "TimeoutError" "Warning"
- "UserWarning" "DeprecationWarning" "PendingDeprecationWarning" "SyntaxWarning" "RuntimeWarning"
- "FutureWarning" "ImportWarning" "UnicodeWarning" "BytesWarning" "ResourceWarning"
- ; https://docs.python.org/3/library/stdtypes.html
- "bool" "int" "float" "complex" "list" "tuple" "range" "str" "bytes" "bytearray" "memoryview"
- "set" "frozenset" "dict" "type" "object"))
-
-; Regex from the `re` module
-(call
- function: (attribute
- object: (identifier) @_re)
- arguments: (argument_list
- .
- (string
- (string_content) @string.regexp))
- (#eq? @_re "re"))
diff --git a/runtime/queries/query/highlights.scm b/runtime/queries/query/highlights.scm
index 210d03dc33..e459b44602 100644
--- a/runtime/queries/query/highlights.scm
+++ b/runtime/queries/query/highlights.scm
@@ -5,9 +5,6 @@
(capture
(identifier) @type)
-(anonymous_node
- (identifier) @string)
-
(predicate
name: (identifier) @function.call)
@@ -15,7 +12,7 @@
name: (identifier) @variable)
(field_definition
- name: (identifier) @property)
+ name: (identifier) @variable.member)
(negated_field
"!" @operator
@@ -36,7 +33,10 @@
")"
] @punctuation.bracket
-":" @punctuation.delimiter
+[
+ ":"
+ "/"
+] @punctuation.delimiter
[
"@"
@@ -69,6 +69,15 @@
((predicate
name: (identifier) @_name
parameters: (parameters
+ .
+ (capture)?
+ .
+ (identifier) @property))
+ (#eq? @_name "set"))
+
+((predicate
+ name: (identifier) @_name
+ parameters: (parameters
(string
"\"" @string
"\"" @string) @string.regexp))
diff --git a/runtime/queries/vimdoc/highlights.scm b/runtime/queries/vimdoc/highlights.scm
index 70a3a2f206..1f809c2f60 100644
--- a/runtime/queries/vimdoc/highlights.scm
+++ b/runtime/queries/vimdoc/highlights.scm
@@ -1,13 +1,19 @@
-(h1) @markup.heading.1
+(h1
+ (delimiter) @markup.heading.1.delimiter
+ (heading) @markup.heading.1)
-(h2) @markup.heading.2
+(h2
+ (delimiter) @markup.heading.2.delimiter
+ (heading) @markup.heading.2)
-(h3) @markup.heading.3
+(h3
+ (heading) @markup.heading.3)
-(column_heading) @markup.heading.4
+(column_heading
+ (heading) @markup.heading.4)
(column_heading
- "~" @markup.heading.4
+ (delimiter) @markup.heading.4
(#set! conceal ""))
(tag
@@ -35,7 +41,7 @@
text: (_) @markup.raw)
((codeblock) @markup.raw.block
- (#set! "priority" 90))
+ (#set! priority 90))
(codeblock
">" @markup.raw
@@ -53,7 +59,8 @@
(keycode) @string.special
-(url) @string.special.url
+((url) @string.special.url
+ (#set! @string.special.url url @string.special.url))
(modeline) @keyword.directive
diff --git a/runtime/syntax/antlr4.vim b/runtime/syntax/antlr4.vim
new file mode 100644
index 0000000000..33cc865ccc
--- /dev/null
+++ b/runtime/syntax/antlr4.vim
@@ -0,0 +1,30 @@
+" Vim syntax file
+" Language: ANTLR4, ANother Tool for Language Recognition v4 <www.antlr.org>
+" Maintainer: Yinzuo Jiang <jiangyinzuo@foxmail.com>
+" Last Change: 2024 July 09
+
+" quit when a syntax file was already loaded
+if exists("b:current_syntax")
+ finish
+endif
+
+" Keywords. See https://github.com/antlr/antlr4/blob/4.13.1/doc/lexicon.md
+syn keyword antlr4Include import
+" https://github.com/antlr/antlr4/blob/4.13.1/doc/options.md
+" https://github.com/antlr/antlr4/blob/4.13.1/doc/grammars.md
+syn keyword antlr4Structure fragment lexer parser grammar options channels tokens mode
+syn keyword antlr4Statement returns locals
+syn keyword antlr4Exceptions throws catch finally
+
+" Comments.
+syn keyword antlr4Todo contained TODO FIXME XXX NOTE
+syn region antlr4Comment start="//" end="$" contains=antlr4Todo,@Spell
+syn region antlr4Comment start="/\*" end="\*/" contains=antlr4Todo,@Spell
+
+hi def link antlr4Include Include
+hi def link antlr4Structure Structure
+hi def link antlr4Statement Statement
+hi def link antlr4Exceptions Structure
+hi def link antlr4Comment Comment
+
+let b:current_syntax = "antlr4"
diff --git a/runtime/syntax/asy.vim b/runtime/syntax/asy.vim
new file mode 100644
index 0000000000..ed2bf712f5
--- /dev/null
+++ b/runtime/syntax/asy.vim
@@ -0,0 +1,243 @@
+" Vim syntax file
+" Language: Asymptote
+" Maintainer: Avid Seeker <avidseeker7@protonmail.com>
+" Andy Hammerlindl
+" Last Change: 2022 Jan 05
+
+" Hacked together from Bram Moolenaar's C syntax file, and Claudio Fleiner's
+" Java syntax file.
+
+if exists("b:current_syntax")
+ finish
+endif
+
+" useful C/C++/Java keywords
+syn keyword asyStatement break return continue unravel
+syn keyword asyConditional if else
+syn keyword asyRepeat while for do
+syn keyword asyExternal access from import include
+syn keyword asyOperator new operator
+
+" basic asymptote keywords
+syn keyword asyConstant VERSION
+syn keyword asyConstant true false default infinity inf nan
+syn keyword asyConstant null nullframe nullpath nullpen
+syn keyword asyConstant intMin intMax realMin realMax
+syn keyword asyConstant realEpsilon realDigits
+syn keyword asyPathSpec and cycle controls tension atleast curl
+syn keyword asyStorageClass static public restricted private explicit
+syn keyword asyStructure struct typedef
+syn keyword asyType void bool bool3 int real string file
+syn keyword asyType pair triple transform guide path pen frame
+syn keyword asyType picture
+
+" module specific keywords
+if exists("asy_syn_plain")
+ syn keyword asyConstant currentpicture currentpen defaultpen
+ syn keyword asyConstant inch inches cm mm bp pt up down right left
+ syn keyword asyConstant E NE N NW W SW S SE
+ syn keyword asyConstant ENE NNE NNW WNW WSW SSW SSE ESE
+ syn keyword asyConstant I pi twopi
+ syn keyword asyConstant CCW CW
+ syn keyword asyConstant undefined sqrtEpsilon Align mantissaBits
+ syn keyword asyConstant identity zeroTransform invert
+ syn keyword asyConstant stdin stdout
+ syn keyword asyConstant unitsquare unitcircle circleprecision
+ syn keyword asyConstant solid dotted Dotted dashed dashdotted
+ syn keyword asyConstant longdashed longdashdotted
+ syn keyword asyConstant squarecap roundcap extendcap
+ syn keyword asyConstant miterjoin roundjoin beveljoin
+ syn keyword asyConstant zerowinding evenodd basealign nobasealign
+ syn keyword asyConstant black white gray red green blue Cyan Magenta
+ syn keyword asyConstant Yellow Black cyan magenta yellow palered
+ syn keyword asyConstant palegreen paleblue palecyan palemagenta
+ syn keyword asyConstant paleyellow palegray lightred lightgreen
+ syn keyword asyConstant lightblue lightcyan lightmagenta lightyellow
+ syn keyword asyConstant lightgray mediumred mediumgreen mediumblue
+ syn keyword asyConstant mediumcyan mediummagenta mediumyellow
+ syn keyword asyConstant mediumgray heavyred heavygreen heavyblue
+ syn keyword asyConstant heavycyan heavymagenta lightolive heavygray
+ syn keyword asyConstant deepred deepgreen deepblue deepcyan
+ syn keyword asyConstant deepmagenta deepyellow deepgray darkred
+ syn keyword asyConstant darkgreen darkblue darkcyan darkmagenta
+ syn keyword asyConstant darkolive darkgray orange fuchsia chartreuse
+ syn keyword asyConstant springgreen purple royalblue salmon brown
+ syn keyword asyConstant olive darkbrown pink palegrey lightgrey
+ syn keyword asyConstant mediumgrey grey heavygrey deepgrey darkgrey
+
+ if exists("asy_syn_texcolors")
+ syn keyword asyConstant GreenYellow Yellow Goldenrod Dandelion
+ syn keyword asyConstant Apricot Peach Melon YellowOrange Orange
+ syn keyword asyConstant BurntOrange Bittersweet RedOrange Mahogany
+ syn keyword asyConstant Maroon BrickRed Red OrangeRed RubineRed
+ syn keyword asyConstant WildStrawberry Salmon CarnationPink Magenta
+ syn keyword asyConstant VioletRed Rhodamine Mulberry RedViolet
+ syn keyword asyConstant Fuchsia Lavender Thistle Orchid DarkOrchid
+ syn keyword asyConstant Purple Plum Violet RoyalPurple BlueViolet
+ syn keyword asyConstant Periwinkle CadetBlue CornflowerBlue
+ syn keyword asyConstant MidnightBlue NavyBlue RoyalBlue Blue
+ syn keyword asyConstant Cerulean Cyan ProcessBlue SkyBlue Turquoise
+ syn keyword asyConstant TealBlue Aquamarine BlueGreen Emerald
+ syn keyword asyConstant JungleGreen SeaGreen Green ForestGreen
+ syn keyword asyConstant PineGreen LimeGreen YellowGreen SpringGreen
+ syn keyword asyConstant OliveGreen RawSienna Sepia Brown Tan Gray
+ syn keyword asyConstant Black White
+ endif
+
+ if exists("asy_syn_x11colors")
+ syn keyword asyConstant AliceBlue AntiqueWhite Aqua Aquamarine Azure
+ syn keyword asyConstant Beige Bisque Black BlanchedAlmond Blue
+ syn keyword asyConstant BlueViolet Brown BurlyWood CadetBlue
+ syn keyword asyConstant Chartreuse Chocolate Coral CornflowerBlue
+ syn keyword asyConstant Cornsilk Crimson Cyan DarkBlue DarkCyan
+ syn keyword asyConstant DarkGoldenrod DarkGray DarkGreen DarkKhaki
+ syn keyword asyConstant DarkMagenta DarkOliveGreen DarkOrange
+ syn keyword asyConstant DarkOrchid DarkRed DarkSalmon DarkSeaGreen
+ syn keyword asyConstant DarkSlateBlue DarkSlateGray DarkTurquoise
+ syn keyword asyConstant DarkViolet DeepPink DeepSkyBlue DimGray
+ syn keyword asyConstant DodgerBlue FireBrick FloralWhite ForestGreen
+ syn keyword asyConstant Fuchsia Gainsboro GhostWhite Gold Goldenrod
+ syn keyword asyConstant Gray Green GreenYellow Honeydew HotPink
+ syn keyword asyConstant IndianRed Indigo Ivory Khaki Lavender
+ syn keyword asyConstant LavenderBlush LawnGreen LemonChiffon
+ syn keyword asyConstant LightBlue LightCoral LightCyan
+ syn keyword asyConstant LightGoldenrodYellow LightGreen LightGrey
+ syn keyword asyConstant LightPink LightSalmon LightSeaGreen
+ syn keyword asyConstant LightSkyBlue LightSlateGray LightSteelBlue
+ syn keyword asyConstant LightYellow Lime LimeGreen Linen Magenta
+ syn keyword asyConstant Maroon MediumAquamarine MediumBlue
+ syn keyword asyConstant MediumOrchid MediumPurple MediumSeaGreen
+ syn keyword asyConstant MediumSlateBlue MediumSpringGreen
+ syn keyword asyConstant MediumTurquoise MediumVioletRed MidnightBlue
+ syn keyword asyConstant MintCream MistyRose Moccasin NavajoWhite
+ syn keyword asyConstant Navy OldLace Olive OliveDrab Orange
+ syn keyword asyConstant OrangeRed Orchid PaleGoldenrod PaleGreen
+ syn keyword asyConstant PaleTurquoise PaleVioletRed PapayaWhip
+ syn keyword asyConstant PeachPuff Peru Pink Plum PowderBlue Purple
+ syn keyword asyConstant Red RosyBrown RoyalBlue SaddleBrown Salmon
+ syn keyword asyConstant SandyBrown SeaGreen Seashell Sienna Silver
+ syn keyword asyConstant SkyBlue SlateBlue SlateGray Snow SpringGreen
+ syn keyword asyConstant SteelBlue Tan Teal Thistle Tomato Turquoise
+ syn keyword asyConstant Violet Wheat White WhiteSmoke Yellow
+ syn keyword asyConstant YellowGreen
+ endif
+
+ if exists("asy_syn_three")
+ syn keyword asyType path3 guide3 transform3
+ syn keyword asyType projection light material patch surface tube
+ syn keyword asyConstant currentprojection currentlight defaultrender
+ syn keyword asyConstant identity4 O X Y Z
+ syn keyword asyConstant nolight nullpens
+ syn keyword asyConstant unitsphere unithemisphere unitplane octant1
+ syn keyword asyConstant unitcone unitsolidcone unitcube unitcylinder
+ syn keyword asyConstant unitdisk unittube
+ endif
+endif
+
+
+" string constants
+syn region asyCString start=+'+ end=+'+ skip=+\\\\\|\\'+ contains=asyCSpecial
+syn match asyCSpecial display contained +\\\(['"?\\abfnrtv]\|\o\{1,3}\)+
+syn match asyCSpecial display contained +\\\(x[0-9A-F]\{1,2\}\|$\)+
+" double quoted strings only special character is \"
+syn region asyString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=asySpecial
+syn match asySpecial display contained +\(\\\)\@1<!\(\\\\\)*\zs\\"+
+
+
+" number constants
+syn match asyNumbers display transparent "\<\d\|\.\d"
+ \ contains=asyNumber,asyNumberError
+syn match asyNumber display contained "\d*\.\=\d*\(e[-+]\=\d\+\)\="
+" highlight number constants with two '.' or with '.' after an 'e'
+syn match asyNumberError display contained "\d*\.\(\d\|e[-+]\=\)*\.[0-9.]*"
+syn match asyNumberError display contained "\d*e[-+]\=\d*\.[0-9.]*"
+syn match asyNumberError display contained "\d*e[-+]\=\(e[-+]\=\)*\.[0-9.]*"
+
+
+" comments and comment strings
+syn keyword asyTodo contained TODO FIXME XXX
+syn sync ccomment asyComment minlines=15
+if exists("asy_comment_strings")
+ " A comment can contain asyString, asyCString, and asyNumber. But a "*/"
+ " inside a asy*String in a asyComment DOES end the comment! So we need to
+ " use a special type of asy*String: asyComment*String, which also ends on
+ " "*/", and sees a "*" at the start of the line as comment again.
+ " Unfortunately this doesn't very well work for // type of comments :-(
+ syn match asyCommentSkip contained "^\s*\*\($\|\s\+\)"
+ syn region asyCommentString contained start=+"+ skip=+\\\\\|\\"+ end=+"+
+ \ end=+\*/+me=s-1
+ \ contains=asySpecial,asyCommentSkip
+ syn region asyCommentCString contained start=+'+ skip=+\\\\\|\\'+ end=+'+
+ \ end=+\*/+me=s-1
+ \ contains=asyCSpecial,asyCommentSkip
+ syn region asyCommentLString contained start=+"+ skip=+\\\\\|\\"+ end=+"+
+ \ end="$" contains=asySpecial
+ syn region asyCommentLCString contained start=+'+ skip=+\\\\\|\\'+ end=+'+
+ \ end="$" contains=asyCSpecial
+ syn region asyCommentL start="//" skip="\\$" end="$" keepend
+ \ contains=asyTodo,asyCommentLString,
+ \ asyCommentLCString,asyNumbers
+ syn region asyComment matchgroup=asyComment start="/\*" end="\*/"
+ \ contains=asyTodo,asyCommentStartError,
+ \ asyCommentString,asyCommentCString,asyNumbers
+else
+ syn region asyCommentL start="//" skip="\\$" end="$" keepend
+ \ contains=asyTodo
+ syn region asyComment matchgroup=asyComment start="/\*" end="\*/"
+ \ contains=asyTodo,asyCommentStartError
+endif
+
+" highlight common errors when starting/ending C comments
+syn match asyCommentError display "\*/"
+syn match asyCommentStartError display "/\*"me=e-1 contained
+
+
+" delimiter matching errors
+syn region asyCurly transparent start='{' end='}'
+ \ contains=TOP,asyCurlyError
+syn region asyBrack transparent start='\[' end='\]' matchgroup=asyError
+ \ end=';' contains=TOP,asyBrackError
+syn region asyParen transparent start='(' end=')' matchgroup=asyError
+ \ end=';' contains=TOP,asyParenError
+syn match asyCurlyError display '}'
+syn match asyBrackError display '\]'
+syn match asyParenError display ')'
+" for (;;) constructs are exceptions that allow ; inside parenthesis
+syn region asyParen transparent matchgroup=asyParen
+ \ start='\(for\s*\)\@<=(' end=')'
+ \ contains=TOP,asyParenError
+
+" Define the default highlighting.
+hi def link asyCommentL asyComment
+hi def link asyConditional Conditional
+hi def link asyRepeat Repeat
+hi def link asyNumber Number
+hi def link asyNumberError asyError
+hi def link asyCurlyError asyError
+hi def link asyBracketError asyError
+hi def link asyParenError asyError
+hi def link asyCommentError asyError
+hi def link asyCommentStartError asyError
+hi def link asyOperator Operator
+hi def link asyStructure Structure
+hi def link asyStorageClass StorageClass
+hi def link asyExternal Include
+hi def link asyDefine Macro
+hi def link asyError Error
+hi def link asyStatement Statement
+hi def link asyType Type
+hi def link asyConstant Constant
+hi def link asyCommentString asyString
+hi def link asyCommentCString asyString
+hi def link asyCommentLString asyString
+hi def link asyCommentLCString asyString
+hi def link asyCommentSkip asyComment
+hi def link asyString String
+hi def link asyCString String
+hi def link asyComment Comment
+hi def link asySpecial SpecialChar
+hi def link asyCSpecial SpecialChar
+hi def link asyTodo Todo
+hi def link asyPathSpec Statement
+
+let b:current_syntax = "asy"
diff --git a/runtime/syntax/checkhealth.vim b/runtime/syntax/checkhealth.vim
index 2fd0aed601..a4f6e016cb 100644
--- a/runtime/syntax/checkhealth.vim
+++ b/runtime/syntax/checkhealth.vim
@@ -14,7 +14,9 @@ syn case match
syn keyword DiagnosticError ERROR[:]
syn keyword DiagnosticWarn WARNING[:]
syn keyword DiagnosticOk OK[:]
-syn match helpSectionDelim "^======*\n.*$"
-syn match healthHeadingChar "=" conceal cchar=─ contained containedin=helpSectionDelim
+" Note: hs=e starts higlighting on the title line (instead of the "===" line).
+syn match helpSectionDelim /^======*\n.*$/hs=e
+highlight helpSectionDelim gui=reverse cterm=reverse
+syn match healthHeadingChar "=" conceal cchar= contained containedin=helpSectionDelim
let b:current_syntax = "checkhealth"
diff --git a/runtime/syntax/chicken.vim b/runtime/syntax/chicken.vim
index f53d872e74..958fc1f361 100644
--- a/runtime/syntax/chicken.vim
+++ b/runtime/syntax/chicken.vim
@@ -1,13 +1,13 @@
" Vim syntax file
-" Language: Scheme (CHICKEN)
-" Last Change: 2021 Oct 01
-" Author: Evan Hanson <evhan@foldling.org>
-" Maintainer: Evan Hanson <evhan@foldling.org>
-" Repository: https://git.foldling.org/vim-scheme.git
-" URL: https://foldling.org/vim/syntax/chicken.vim
-" Notes: This is supplemental syntax, to be loaded after the core Scheme
-" syntax file (syntax/scheme.vim). Enable it by setting b:is_chicken=1
-" and filetype=scheme.
+" Language: Scheme (CHICKEN)
+" Last Change: 2024 Jun 21
+" Author: Evan Hanson <evhan@foldling.org>
+" Maintainer: Evan Hanson <evhan@foldling.org>
+" Repository: https://git.foldling.org/vim-scheme.git
+" URL: https://foldling.org/vim/syntax/chicken.vim
+" Notes: This is supplemental syntax, to be loaded after the core
+" Scheme syntax file (syntax/scheme.vim). Enable it by
+" setting b:is_chicken=1 and filetype=scheme.
" Only to be used on top of the Scheme syntax.
if !exists('b:did_scheme_syntax')
diff --git a/runtime/syntax/csv.vim b/runtime/syntax/csv.vim
new file mode 100644
index 0000000000..6295c3e29a
--- /dev/null
+++ b/runtime/syntax/csv.vim
@@ -0,0 +1,38 @@
+" Maintainer: Maxim Kim <habamax@gmail.com>
+" Converted from vim9script
+" Last Update: 2024-06-18
+
+if exists("b:current_syntax")
+ finish
+endif
+
+let s:delimiter = get(b:, "csv_delimiter", ",")
+
+" generate bunch of following syntaxes:
+" syntax match csvCol8 /.\{-}\(,\|$\)/ nextgroup=escCsvCol0,csvCol0
+" syntax region escCsvCol8 start=/ *"\([^"]*""\)*[^"]*/ end=/" *\(,\|$\)/ nextgroup=escCsvCol0,csvCol0
+for s:col in range(8, 0, -1)
+ let s:ncol = (s:col == 8 ? 0 : s:col + 1)
+ exe $'syntax match csvCol{s:col}' .. ' /.\{-}\(' .. s:delimiter .. '\|$\)/ nextgroup=escCsvCol' .. s:ncol .. ',csvCol' .. s:ncol
+ exe $'syntax region escCsvCol{s:col}' .. ' start=/ *"\([^"]*""\)*[^"]*/ end=/" *\(' .. s:delimiter .. '\|$\)/ nextgroup=escCsvCol' .. s:ncol .. ',csvCol' .. s:ncol
+endfor
+
+hi def link csvCol1 Statement
+hi def link csvCol2 Constant
+hi def link csvCol3 Type
+hi def link csvCol4 PreProc
+hi def link csvCol5 Identifier
+hi def link csvCol6 Special
+hi def link csvCol7 String
+hi def link csvCol8 Comment
+
+hi def link escCsvCol1 csvCol1
+hi def link escCsvCol2 csvCol2
+hi def link escCsvCol3 csvCol3
+hi def link escCsvCol4 csvCol4
+hi def link escCsvCol5 csvCol5
+hi def link escCsvCol6 csvCol6
+hi def link escCsvCol7 csvCol7
+hi def link escCsvCol8 csvCol8
+
+let b:current_syntax = "csv"
diff --git a/runtime/syntax/deb822sources.vim b/runtime/syntax/deb822sources.vim
index f7d337fce9..ec45605905 100644
--- a/runtime/syntax/deb822sources.vim
+++ b/runtime/syntax/deb822sources.vim
@@ -40,7 +40,7 @@ syn match deb822sourcesUri '\(https\?://\|ftp://\|[rs]sh://\|debtorre
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=deb822sourcesBooleanOptionField start="^\%(PDiffs\|Allow-Insecure\|Allow-Weak\|Allow-Downgrade-To-Insecure\|Trusted\|Check-Date\|Enabled\): *" end="$" contains=deb822sourcesYesNo oneline
syn region deb822sourcesStrictField matchgroup=deb822sourcesForceBooleanOptionField start="^\%(By-Hash\): *" end="$" contains=deb822sourcesForce,deb822sourcesYesNo oneline
hi def link deb822sourcesField Default
diff --git a/runtime/syntax/debcopyright.vim b/runtime/syntax/debcopyright.vim
index 6f76b5c868..cb9e8965de 100644
--- a/runtime/syntax/debcopyright.vim
+++ b/runtime/syntax/debcopyright.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: Debian copyright file
" Maintainer: Debian Vim Maintainers
-" Last Change: 2023 Jan 16
+" Last Change: 2024 Jul 28
" URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/syntax/debcopyright.vim
" Standard syntax initialization
@@ -15,7 +15,7 @@ set cpo&vim
syn case match
syn match debcopyrightUrl "\vhttps?://[[:alnum:]][-[:alnum:]]*[[:alnum:]]?(\.[[:alnum:]][-[:alnum:]]*[[:alnum:]]?)*\.[[:alpha:]][-[:alnum:]]*[[:alpha:]]?(:\d+)?(/[^[:space:]]*)?$"
-syn match debcopyrightKey "^\%(Format\|Upstream-Name\|Upstream-Contact\|Disclaimer\|Source\|Comment\|Files\|Copyright\|License\|Files-Excluded\%(-[-a-zA-Z0-9]\+\)\=\): *"
+syn match debcopyrightKey "^\%(Format\|Upstream-Name\|Upstream-Contact\|Disclaimer\|Source\|Comment\|Files\|Copyright\|License\|Files-\%(Excluded\|Included\)\%(-[-a-zA-Z0-9]\+\)\=\): *"
syn match debcopyrightEmail "[_=[:alnum:]\.+-]\+@[[:alnum:]\./\-]\+"
syn match debcopyrightEmail "<.\{-}>"
syn match debcopyrightComment "^#.*$" contains=@Spell
diff --git a/runtime/syntax/dockerfile.vim b/runtime/syntax/dockerfile.vim
index ce52e697cd..6ec71fcdb6 100644
--- a/runtime/syntax/dockerfile.vim
+++ b/runtime/syntax/dockerfile.vim
@@ -1,6 +1,6 @@
" dockerfile.vim - Syntax highlighting for Dockerfiles
" Maintainer: Honza Pokorny <https://honza.ca>
-" Last Change: 2020 Feb 11
+" Last Change: 2024 Jul 03
" License: BSD
" https://docs.docker.com/engine/reference/builder/
@@ -34,7 +34,7 @@ syntax region dockerfileJSON contained keepend start=/\v\[/ skip=/\v\\\_./ end
syntax region dockerfileShell contained keepend start=/\v/ skip=/\v\\\_./ end=/\v$/ contains=@Shell
syntax region dockerfileValue contained keepend start=/\v/ skip=/\v\\\_./ end=/\v$/ contains=dockerfileString
-syntax region dockerfileComment start=/\v^\s*#/ end=/\v$/
+syntax region dockerfileComment start=/\v^\s*#/ end=/\v$/ contains=@Spell
set commentstring=#\ %s
hi def link dockerfileString String
diff --git a/runtime/syntax/dosbatch.vim b/runtime/syntax/dosbatch.vim
index 55601996ad..0c3e99be3b 100644
--- a/runtime/syntax/dosbatch.vim
+++ b/runtime/syntax/dosbatch.vim
@@ -3,6 +3,7 @@
" Maintainer: Mike Williams <mrmrdubya@gmail.com>
" Filenames: *.bat
" Last Change: 3rd February 2024
+" 2024 Aug 14 by Vim Project: improve syntax (#15453)
"
" Options Flags:
" dosbatch_cmdextversion - 1 = Windows NT, 2 = Windows 2000 [default]
@@ -45,7 +46,7 @@ syn match dosbatchString "\<echo\([^)>|]\|\^\@<=[)>|]\)*"lc=4 contains=dosbatchV
syn match dosbatchEchoOperator "\<echo\s\+\(on\|off\)\s*$"lc=4
" For embedded commands
-syn match dosbatchCmd "(\s*'[^']*'"lc=1 contains=dosbatchString,dosbatchVariable,dosBatchArgument,@dosbatchNumber,dosbatchImplicit,dosbatchStatement,dosbatchConditional,dosbatchRepeat,dosbatchOperator
+syn match dosbatchCmd "(\s*'[^']*'"lc=1 contains=dosbatchString,dosbatchVariable,dosBatchArgument,@dosbatchNumber,dosbatchImplicit,dosbatchStatement,dosbatchConditional,dosbatchRepeat,dosbatchOperator,dosbatchIfOperator
" Numbers - surround with ws to not include in dir and filenames
syn match dosbatchInteger "[[:space:]=(/:,!~-]\d\+"lc=1
@@ -74,7 +75,7 @@ syn match dosbatchSet "\s\h\w*[+-]\==\{-1}" contains=dosbatchIdentifier,dosbatc
" Args to bat files and for loops, etc
syn match dosbatchArgument "%\(\d\|\*\)"
-syn match dosbatchArgument "%[a-z]\>"
+syn match dosbatchArgument "%%[a-z]\>"
if dosbatch_cmdextversion == 1
syn match dosbatchArgument "%\~[fdpnxs]\+\(\($PATH:\)\=[a-z]\|\d\)\>"
else
@@ -102,9 +103,11 @@ else
syn match dosbatchColonCommentErr contained "\s*:\s*:.*$"
endif
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 region dosbatchCodeBlock transparent start=+(+ end=+)+ contains=dosbatchString,dosbatchVariable,dosBatchArgument,@dosbatchNumber,dosbatchImplicit,dosbatchStatement,dosbatchConditional,dosbatchRepeat,dosbatchOperator,dosbatchIfOperator,@dosbatchCodeBlockComment,dosbatchColonCommentErr,dosbatchCodeBlock
syn match dosbatchCodeBlockErr ")"
+syn sync match dosbatchSyncCodeBlock grouphere NONE "^)\s*$"
+
syn keyword dosbatchImplicit append assoc at attrib break cacls cd chcp chdir
syn keyword dosbatchImplicit chkdsk chkntfs cls cmd color comp compact convert copy
syn keyword dosbatchImplicit date del dir diskcomp diskcopy doskey echo endlocal
diff --git a/runtime/syntax/dosini.vim b/runtime/syntax/dosini.vim
index 66e17ec9af..e8212b6d2e 100644
--- a/runtime/syntax/dosini.vim
+++ b/runtime/syntax/dosini.vim
@@ -1,12 +1,12 @@
" Vim syntax file
" Language: Configuration File (ini file) for MSDOS/MS Windows
-" Version: 2.3
+" Version: 2.4
" Original Author: Sean M. McKee <mckee@misslink.net>
" Previous Maintainer: Nima Talebi <nima@it.net.au>
" Current Maintainer: Hong Xu <hong@topbug.net>
" Homepage: http://www.vim.org/scripts/script.php?script_id=3747
" Repository: https://github.com/xuhdev/syntax-dosini.vim
-" Last Change: 2023 Aug 20
+" Last Change: 2024 Sept 08
" quit when a syntax file was already loaded
@@ -27,7 +27,7 @@ syn match dosiniNumber "=\zs\s*\d\+\s*$"
syn match dosiniNumber "=\zs\s*\d*\.\d\+\s*$"
syn match dosiniNumber "=\zs\s*\d\+e[+-]\=\d\+\s*$"
syn region dosiniHeader start="^\s*\[" end="\]"
-syn match dosiniComment "^[#;].*$"
+syn match dosiniComment "^[#;].*$" contains=@Spell
syn region dosiniSection start="\s*\[.*\]" end="\ze\s*\[.*\]" fold
\ contains=dosiniLabel,dosiniValue,dosiniNumber,dosiniHeader,dosiniComment
diff --git a/runtime/syntax/dune.vim b/runtime/syntax/dune.vim
index b4254057c0..3cfb47fbee 100644
--- a/runtime/syntax/dune.vim
+++ b/runtime/syntax/dune.vim
@@ -4,6 +4,7 @@
" Anton Kochkov <anton.kochkov@gmail.com>
" URL: https://github.com/ocaml/vim-ocaml
" Last Change:
+" 2023 Nov 24 - Add end-of-line strings (Samuel Hym)
" 2019 Feb 27 - Add newer keywords to the syntax (Simon Cruanes)
" 2018 May 8 - Check current_syntax (Kawahara Satoru)
" 2018 Mar 29 - Extend jbuild syntax with more keywords (Petter A. Urkedal)
@@ -38,6 +39,8 @@ syn keyword lispFunc ignore-stdout ignore-stderr ignore-outputs
syn keyword lispFunc with-stdout-to with-stderr-to with-outputs-to
syn keyword lispFunc write-file system bash
+syn region lispString start=+"\\[>|]+ end=+$+ contains=@Spell
+
syn cluster lispBaseListCluster add=duneVar
syn match duneVar '\${[@<^]}' containedin=lispSymbol
syn match duneVar '\${\k\+\(:\k\+\)\?}' containedin=lispSymbol
diff --git a/runtime/syntax/fstab.vim b/runtime/syntax/fstab.vim
index 91150bc37b..64d5bee3d0 100644
--- a/runtime/syntax/fstab.vim
+++ b/runtime/syntax/fstab.vim
@@ -2,8 +2,8 @@
" Language: fstab file
" Maintainer: Radu Dineiu <radu.dineiu@gmail.com>
" URL: https://raw.github.com/rid9/vim-fstab/master/syntax/fstab.vim
-" Last Change: 2023 Feb 19
-" Version: 1.6.3
+" Last Change: 2024 Jul 11
+" Version: 1.6.4
"
" Credits:
" David Necas (Yeti) <yeti@physics.muni.cz>
@@ -35,7 +35,7 @@ syn match fsOperator /[,=:#]/
" Device
syn cluster fsDeviceCluster contains=fsOperator,fsDeviceKeyword,fsDeviceError
syn match fsDeviceError /\%([^a-zA-Z0-9_\/#@:\.-]\|^\w\{-}\ze\W\)/ contained
-syn keyword fsDeviceKeyword contained none proc linproc tmpfs devpts devtmpfs sysfs usbfs
+syn keyword fsDeviceKeyword contained none proc linproc tmpfs devpts devtmpfs sysfs usbfs tracefs overlay
syn keyword fsDeviceKeyword contained LABEL nextgroup=fsDeviceLabel
syn keyword fsDeviceKeyword contained UUID nextgroup=fsDeviceUUID
syn keyword fsDeviceKeyword contained PARTLABEL nextgroup=fsDevicePARTLABEL
@@ -56,7 +56,7 @@ syn keyword fsMountPointKeyword contained none swap
" Type
syn cluster fsTypeCluster contains=fsTypeKeyword,fsTypeUnknown
syn match fsTypeUnknown /\s\+\zs\w\+/ contained
-syn keyword fsTypeKeyword contained adfs ados affs anon_inodefs atfs audiofs auto autofs bdev befs bfs btrfs binfmt_misc cd9660 ceph cfs cgroup cifs coda coherent configfs cpuset cramfs debugfs devfs devpts devtmpfs dlmfs e2compr ecryptfs efivarfs efs erofs exfat ext2 ext2fs ext3 ext4 f2fs fdesc ffs filecore fuse fuseblk fusectl gfs2 hfs hfsplus hpfs hugetlbfs iso9660 jffs jffs2 jfs kernfs lfs linprocfs mfs minix mqueue msdos ncpfs nfs nfs4 nfsd nilfs2 none ntfs ntfs3 null nwfs ocfs2 omfs overlay ovlfs pipefs portal proc procfs pstore ptyfs pvfs2 qnx4 qnx6 reiserfs ramfs romfs rpc_pipefs securityfs shm smbfs spufs squashfs sockfs sshfs std subfs swap sysfs sysv tcfs tmpfs ubifs udf ufs umap umsdos union usbfs userfs v9fs vfat virtiofs vs3fs vxfs wrapfs wvfs xenfs xenix xfs zisofs zonefs
+syn keyword fsTypeKeyword contained adfs ados affs anon_inodefs atfs audiofs auto autofs bdev befs bfs btrfs binfmt_misc cd9660 ceph cfs cgroup cifs coda coherent configfs cpuset cramfs debugfs devfs devpts devtmpfs dlmfs e2compr ecryptfs efivarfs efs erofs exfat ext2 ext2fs ext3 ext4 f2fs fdesc ffs filecore fuse fuseblk fusectl gfs2 hfs hfsplus hpfs hugetlbfs iso9660 jffs jffs2 jfs kernfs lfs linprocfs mfs minix mqueue msdos ncpfs nfs nfs4 nfsd nilfs2 none ntfs ntfs3 null nwfs ocfs2 omfs overlay ovlfs pipefs portal proc procfs pstore ptyfs pvfs2 qnx4 qnx6 reiserfs ramfs romfs rpc_pipefs securityfs shm smbfs spufs squashfs sockfs sshfs std subfs swap sysfs sysv tcfs tmpfs tracefs ubifs udf ufs umap umsdos union usbfs userfs v9fs vfat virtiofs vs3fs vxfs wrapfs wvfs xenfs xenix xfs zisofs zonefs
" Options
" -------
@@ -80,10 +80,10 @@ syn match fsOptionsKeywords contained /\<x-systemd\.\%(device-bound\|automount\|
syn match fsOptionsKeywords contained /\<x-initrd\.mount/
syn match fsOptionsKeywords contained /\<cache=/ nextgroup=fsOptionsCache
-syn keyword fsOptionsCache yes no none strict loose fscache mmap
+syn keyword fsOptionsCache contained yes no none strict loose fscache mmap
syn match fsOptionsKeywords contained /\<dax=/ nextgroup=fsOptionsDax
-syn keyword fsOptionsDax inode never always
+syn keyword fsOptionsDax contained inode never always
syn match fsOptionsKeywords contained /\<errors=/ nextgroup=fsOptionsErrors
syn keyword fsOptionsErrors contained continue panic withdraw remount-ro recover zone-ro zone-offline repair
@@ -288,8 +288,15 @@ syn match fsOptionsKeywords contained /\<\%(atime_quantum\|preferred_slot\|local
syn keyword fsOptionsKeywords contained strictatime inode64
" Options: overlay
+syn match fsOptionsKeywords contained /\<\%(index\|uuid\|nfs_export\|metacopy\)=/ nextgroup=fsOptionsOverlayBool
+syn keyword fsOptionsOverlayBool contained on off
+syn match fsOptionsKeywords contained /\<\%(lowerdir\|upperdir\|workdir\)=/ nextgroup=fsOptionsOverlayDir
+syn match fsOptionsOverlayDir contained /[^,[:space:]]*/
syn match fsOptionsKeywords contained /\<redirect_dir=/ nextgroup=fsOptionsOverlayRedirectDir
syn keyword fsOptionsOverlayRedirectDir contained on follow off nofollow
+syn match fsOptionsKeywords contained /\<xino=/ nextgroup=fsOptionsOverlayXino
+syn keyword fsOptionsOverlayXino contained on off auto
+syn keyword fsOptionsKeywords contained userxattr volatile
" Options: proc
syn match fsOptionsKeywords contained /\<\%(hidepid\|subset\)=/ nextgroup=fsOptionsString
@@ -462,7 +469,10 @@ hi def link fsOptionsNumberOctal Number
hi def link fsOptionsNumberSigned Number
hi def link fsOptionsOcfs2Coherency String
hi def link fsOptionsOcfs2ResvLevel Number
+hi def link fsOptionsOverlayBool Boolean
+hi def link fsOptionsOverlayDir String
hi def link fsOptionsOverlayRedirectDir String
+hi def link fsOptionsOverlayXino String
hi def link fsOptionsQnx4Bitmap String
hi def link fsOptionsQnx6Hold String
hi def link fsOptionsQnx6Sync String
diff --git a/runtime/syntax/glsl.vim b/runtime/syntax/glsl.vim
new file mode 100644
index 0000000000..06ffcba625
--- /dev/null
+++ b/runtime/syntax/glsl.vim
@@ -0,0 +1,752 @@
+" Language: OpenGL Shading Language
+" Maintainer: Gregory Anders <greg@gpanders.com>
+" Last Modified: 2024 Jul 21
+" Upstream: https://github.com/tikhomirov/vim-glsl
+
+if exists('b:current_syntax')
+ finish
+endif
+
+" Statements
+syn keyword glslConditional if else switch case default
+syn keyword glslRepeat for while do
+syn keyword glslStatement discard return break continue
+
+" Comments
+syn keyword glslTodo contained TODO FIXME XXX NOTE
+syn region glslCommentL start="//" skip="\\$" end="$" keepend contains=glslTodo,@Spell
+syn region glslComment matchgroup=glslCommentStart start="/\*" end="\*/" extend contains=glslTodo,@Spell
+
+" Preprocessor
+syn region glslPreCondit start="^\s*#\s*\(if\|ifdef\|ifndef\|else\|elif\|endif\)" skip="\\$" end="$" keepend
+syn region glslDefine start="^\s*#\s*\(define\|undef\)" skip="\\$" end="$" keepend
+syn keyword glslTokenConcat ##
+syn keyword glslPredefinedMacro __LINE__ __FILE__ __VERSION__ GL_ES
+syn region glslPreProc start="^\s*#\s*\(error\|pragma\|extension\|version\|line\)" skip="\\$" end="$" keepend
+syn region glslInclude start="^\s*#\s*include" skip="\\$" end="$" keepend
+
+" Folding Blocks
+syn region glslCurlyBlock start="{" end="}" transparent fold
+syn region glslParenBlock start="(" end=")" transparent fold
+
+" Boolean Constants
+syn keyword glslBoolean true false
+
+" Integer Numbers
+syn match glslDecimalInt display "\<\(0\|[1-9]\d*\)[uU]\?"
+syn match glslOctalInt display "\<0\o\+[uU]\?"
+syn match glslHexInt display "\<0[xX]\x\+[uU]\?"
+
+" Float Numbers
+syn match glslFloat display "\<\d\+\.\([eE][+-]\=\d\+\)\=\(lf\|LF\|f\|F\)\="
+syn match glslFloat display "\<\.\d\+\([eE][+-]\=\d\+\)\=\(lf\|LF\|f\|F\)\="
+syn match glslFloat display "\<\d\+[eE][+-]\=\d\+\(lf\|LF\|f\|F\)\="
+syn match glslFloat display "\<\d\+\.\d\+\([eE][+-]\=\d\+\)\=\(lf\|LF\|f\|F\)\="
+
+" Swizzles
+syn match glslSwizzle display /\.[xyzw]\{1,4\}\>/
+syn match glslSwizzle display /\.[rgba]\{1,4\}\>/
+syn match glslSwizzle display /\.[stpq]\{1,4\}\>/
+
+" Structure
+syn keyword glslStructure struct nextgroup=glslIdentifier skipwhite skipempty
+
+syn match glslIdentifier contains=glslIdentifierPrime "\%([a-zA-Z_]\)\%([a-zA-Z0-9_]\)*" display contained
+
+" Types
+syn keyword glslType accelerationStructureEXT
+syn keyword glslType atomic_uint
+syn keyword glslType bool
+syn keyword glslType bvec2
+syn keyword glslType bvec3
+syn keyword glslType bvec4
+syn keyword glslType dmat2
+syn keyword glslType dmat2x2
+syn keyword glslType dmat2x3
+syn keyword glslType dmat2x4
+syn keyword glslType dmat3
+syn keyword glslType dmat3x2
+syn keyword glslType dmat3x3
+syn keyword glslType dmat3x4
+syn keyword glslType dmat4
+syn keyword glslType dmat4x2
+syn keyword glslType dmat4x3
+syn keyword glslType dmat4x4
+syn keyword glslType double
+syn keyword glslType dvec2
+syn keyword glslType dvec3
+syn keyword glslType dvec4
+syn keyword glslType float
+syn keyword glslType iimage1D
+syn keyword glslType iimage1DArray
+syn keyword glslType iimage2D
+syn keyword glslType iimage2DArray
+syn keyword glslType iimage2DMS
+syn keyword glslType iimage2DMSArray
+syn keyword glslType iimage2DRect
+syn keyword glslType iimage3D
+syn keyword glslType iimageBuffer
+syn keyword glslType iimageCube
+syn keyword glslType iimageCubeArray
+syn keyword glslType image1D
+syn keyword glslType image1DArray
+syn keyword glslType image2D
+syn keyword glslType image2DArray
+syn keyword glslType image2DMS
+syn keyword glslType image2DMSArray
+syn keyword glslType image2DRect
+syn keyword glslType image3D
+syn keyword glslType imageBuffer
+syn keyword glslType imageCube
+syn keyword glslType imageCubeArray
+syn keyword glslType int
+syn keyword glslType isampler1D
+syn keyword glslType isampler1DArray
+syn keyword glslType isampler2D
+syn keyword glslType isampler2DArray
+syn keyword glslType isampler2DMS
+syn keyword glslType isampler2DMSArray
+syn keyword glslType isampler2DRect
+syn keyword glslType isampler3D
+syn keyword glslType isamplerBuffer
+syn keyword glslType isamplerCube
+syn keyword glslType isamplerCubeArray
+syn keyword glslType ivec2
+syn keyword glslType ivec3
+syn keyword glslType ivec4
+syn keyword glslType mat2
+syn keyword glslType mat2x2
+syn keyword glslType mat2x3
+syn keyword glslType mat2x4
+syn keyword glslType mat3
+syn keyword glslType mat3x2
+syn keyword glslType mat3x3
+syn keyword glslType mat3x4
+syn keyword glslType mat4
+syn keyword glslType mat4x2
+syn keyword glslType mat4x3
+syn keyword glslType mat4x4
+syn keyword glslType rayQueryEXT
+syn keyword glslType sampler1D
+syn keyword glslType sampler1DArray
+syn keyword glslType sampler1DArrayShadow
+syn keyword glslType sampler1DShadow
+syn keyword glslType sampler2D
+syn keyword glslType sampler2DArray
+syn keyword glslType sampler2DArrayShadow
+syn keyword glslType sampler2DMS
+syn keyword glslType sampler2DMSArray
+syn keyword glslType sampler2DRect
+syn keyword glslType sampler2DRectShadow
+syn keyword glslType sampler2DShadow
+syn keyword glslType sampler3D
+syn keyword glslType samplerBuffer
+syn keyword glslType samplerCube
+syn keyword glslType samplerCubeArray
+syn keyword glslType samplerCubeArrayShadow
+syn keyword glslType samplerCubeShadow
+syn keyword glslType uimage1D
+syn keyword glslType uimage1DArray
+syn keyword glslType uimage2D
+syn keyword glslType uimage2DArray
+syn keyword glslType uimage2DMS
+syn keyword glslType uimage2DMSArray
+syn keyword glslType uimage2DRect
+syn keyword glslType uimage3D
+syn keyword glslType uimageBuffer
+syn keyword glslType uimageCube
+syn keyword glslType uimageCubeArray
+syn keyword glslType uint
+syn keyword glslType usampler1D
+syn keyword glslType usampler1DArray
+syn keyword glslType usampler2D
+syn keyword glslType usampler2DArray
+syn keyword glslType usampler2DMS
+syn keyword glslType usampler2DMSArray
+syn keyword glslType usampler2DRect
+syn keyword glslType usampler3D
+syn keyword glslType usamplerBuffer
+syn keyword glslType usamplerCube
+syn keyword glslType usamplerCubeArray
+syn keyword glslType uvec2
+syn keyword glslType uvec3
+syn keyword glslType uvec4
+syn keyword glslType vec2
+syn keyword glslType vec3
+syn keyword glslType vec4
+syn keyword glslType void
+
+" Qualifiers
+syn keyword glslQualifier align
+syn keyword glslQualifier attribute
+syn keyword glslQualifier binding
+syn keyword glslQualifier buffer
+syn keyword glslQualifier callableDataEXT
+syn keyword glslQualifier callableDataInEXT
+syn keyword glslQualifier ccw
+syn keyword glslQualifier centroid
+syn keyword glslQualifier centroid varying
+syn keyword glslQualifier coherent
+syn keyword glslQualifier column_major
+syn keyword glslQualifier const
+syn keyword glslQualifier cw
+syn keyword glslQualifier depth_any
+syn keyword glslQualifier depth_greater
+syn keyword glslQualifier depth_less
+syn keyword glslQualifier depth_unchanged
+syn keyword glslQualifier early_fragment_tests
+syn keyword glslQualifier equal_spacing
+syn keyword glslQualifier flat
+syn keyword glslQualifier fractional_even_spacing
+syn keyword glslQualifier fractional_odd_spacing
+syn keyword glslQualifier highp
+syn keyword glslQualifier hitAttributeEXT
+syn keyword glslQualifier in
+syn keyword glslQualifier index
+syn keyword glslQualifier inout
+syn keyword glslQualifier invariant
+syn keyword glslQualifier invocations
+syn keyword glslQualifier isolines
+syn keyword glslQualifier layout
+syn keyword glslQualifier line_strip
+syn keyword glslQualifier lines
+syn keyword glslQualifier lines_adjacency
+syn keyword glslQualifier local_size_x
+syn keyword glslQualifier local_size_y
+syn keyword glslQualifier local_size_z
+syn keyword glslQualifier location
+syn keyword glslQualifier lowp
+syn keyword glslQualifier max_vertices
+syn keyword glslQualifier mediump
+syn keyword glslQualifier nonuniformEXT
+syn keyword glslQualifier noperspective
+syn keyword glslQualifier offset
+syn keyword glslQualifier origin_upper_left
+syn keyword glslQualifier out
+syn keyword glslQualifier packed
+syn keyword glslQualifier patch
+syn keyword glslQualifier pixel_center_integer
+syn keyword glslQualifier point_mode
+syn keyword glslQualifier points
+syn keyword glslQualifier precise
+syn keyword glslQualifier precision
+syn keyword glslQualifier quads
+syn keyword glslQualifier r11f_g11f_b10f
+syn keyword glslQualifier r16
+syn keyword glslQualifier r16_snorm
+syn keyword glslQualifier r16f
+syn keyword glslQualifier r16i
+syn keyword glslQualifier r16ui
+syn keyword glslQualifier r32f
+syn keyword glslQualifier r32i
+syn keyword glslQualifier r32ui
+syn keyword glslQualifier r8
+syn keyword glslQualifier r8_snorm
+syn keyword glslQualifier r8i
+syn keyword glslQualifier r8ui
+syn keyword glslQualifier rayPayloadEXT
+syn keyword glslQualifier rayPayloadInEXT
+syn keyword glslQualifier readonly
+syn keyword glslQualifier restrict
+syn keyword glslQualifier rg16
+syn keyword glslQualifier rg16_snorm
+syn keyword glslQualifier rg16f
+syn keyword glslQualifier rg16i
+syn keyword glslQualifier rg16ui
+syn keyword glslQualifier rg32f
+syn keyword glslQualifier rg32i
+syn keyword glslQualifier rg32ui
+syn keyword glslQualifier rg8
+syn keyword glslQualifier rg8_snorm
+syn keyword glslQualifier rg8i
+syn keyword glslQualifier rg8ui
+syn keyword glslQualifier rgb10_a2
+syn keyword glslQualifier rgb10_a2ui
+syn keyword glslQualifier rgba16
+syn keyword glslQualifier rgba16_snorm
+syn keyword glslQualifier rgba16f
+syn keyword glslQualifier rgba16i
+syn keyword glslQualifier rgba16ui
+syn keyword glslQualifier rgba32f
+syn keyword glslQualifier rgba32i
+syn keyword glslQualifier rgba32ui
+syn keyword glslQualifier rgba8
+syn keyword glslQualifier rgba8_snorm
+syn keyword glslQualifier rgba8i
+syn keyword glslQualifier rgba8ui
+syn keyword glslQualifier row_major
+syn keyword glslQualifier sample
+syn keyword glslQualifier shaderRecordEXT
+syn keyword glslQualifier shared
+syn keyword glslQualifier smooth
+syn keyword glslQualifier std140
+syn keyword glslQualifier std430
+syn keyword glslQualifier stream
+syn keyword glslQualifier triangle_strip
+syn keyword glslQualifier triangles
+syn keyword glslQualifier triangles_adjacency
+syn keyword glslQualifier uniform
+syn keyword glslQualifier varying
+syn keyword glslQualifier vertices
+syn keyword glslQualifier volatile
+syn keyword glslQualifier writeonly
+syn keyword glslQualifier xfb_buffer
+syn keyword glslQualifier xfb_offset
+syn keyword glslQualifier xfb_stride
+
+" Built-in Constants
+syn keyword glslBuiltinConstant gl_CullDistance
+syn keyword glslBuiltinConstant gl_HitKindBackFacingTriangleEXT
+syn keyword glslBuiltinConstant gl_HitKindFrontFacingTriangleEXT
+syn keyword glslBuiltinConstant gl_MaxAtomicCounterBindings
+syn keyword glslBuiltinConstant gl_MaxAtomicCounterBufferSize
+syn keyword glslBuiltinConstant gl_MaxClipDistances
+syn keyword glslBuiltinConstant gl_MaxClipPlanes
+syn keyword glslBuiltinConstant gl_MaxCombinedAtomicCounterBuffers
+syn keyword glslBuiltinConstant gl_MaxCombinedAtomicCounters
+syn keyword glslBuiltinConstant gl_MaxCombinedClipAndCullDistances
+syn keyword glslBuiltinConstant gl_MaxCombinedImageUniforms
+syn keyword glslBuiltinConstant gl_MaxCombinedImageUnitsAndFragmentOutputs
+syn keyword glslBuiltinConstant gl_MaxCombinedShaderOutputResources
+syn keyword glslBuiltinConstant gl_MaxCombinedTextureImageUnits
+syn keyword glslBuiltinConstant gl_MaxComputeAtomicCounterBuffers
+syn keyword glslBuiltinConstant gl_MaxComputeAtomicCounters
+syn keyword glslBuiltinConstant gl_MaxComputeImageUniforms
+syn keyword glslBuiltinConstant gl_MaxComputeTextureImageUnits
+syn keyword glslBuiltinConstant gl_MaxComputeUniformComponents
+syn keyword glslBuiltinConstant gl_MaxComputeWorkGroupCount
+syn keyword glslBuiltinConstant gl_MaxComputeWorkGroupSize
+syn keyword glslBuiltinConstant gl_MaxCullDistances
+syn keyword glslBuiltinConstant gl_MaxDrawBuffers
+syn keyword glslBuiltinConstant gl_MaxFragmentAtomicCounterBuffers
+syn keyword glslBuiltinConstant gl_MaxFragmentAtomicCounters
+syn keyword glslBuiltinConstant gl_MaxFragmentImageUniforms
+syn keyword glslBuiltinConstant gl_MaxFragmentInputComponents
+syn keyword glslBuiltinConstant gl_MaxFragmentInputVectors
+syn keyword glslBuiltinConstant gl_MaxFragmentUniformComponents
+syn keyword glslBuiltinConstant gl_MaxFragmentUniformVectors
+syn keyword glslBuiltinConstant gl_MaxGeometryAtomicCounterBuffers
+syn keyword glslBuiltinConstant gl_MaxGeometryAtomicCounters
+syn keyword glslBuiltinConstant gl_MaxGeometryImageUniforms
+syn keyword glslBuiltinConstant gl_MaxGeometryInputComponents
+syn keyword glslBuiltinConstant gl_MaxGeometryOutputComponents
+syn keyword glslBuiltinConstant gl_MaxGeometryOutputVertices
+syn keyword glslBuiltinConstant gl_MaxGeometryTextureImageUnits
+syn keyword glslBuiltinConstant gl_MaxGeometryTotalOutputComponents
+syn keyword glslBuiltinConstant gl_MaxGeometryUniformComponents
+syn keyword glslBuiltinConstant gl_MaxGeometryVaryingComponents
+syn keyword glslBuiltinConstant gl_MaxImageSamples
+syn keyword glslBuiltinConstant gl_MaxImageUnits
+syn keyword glslBuiltinConstant gl_MaxLights
+syn keyword glslBuiltinConstant gl_MaxPatchVertices
+syn keyword glslBuiltinConstant gl_MaxProgramTexelOffset
+syn keyword glslBuiltinConstant gl_MaxSamples
+syn keyword glslBuiltinConstant gl_MaxTessControlAtomicCounterBuffers
+syn keyword glslBuiltinConstant gl_MaxTessControlAtomicCounters
+syn keyword glslBuiltinConstant gl_MaxTessControlImageUniforms
+syn keyword glslBuiltinConstant gl_MaxTessControlInputComponents
+syn keyword glslBuiltinConstant gl_MaxTessControlOutputComponents
+syn keyword glslBuiltinConstant gl_MaxTessControlTextureImageUnits
+syn keyword glslBuiltinConstant gl_MaxTessControlTotalOutputComponents
+syn keyword glslBuiltinConstant gl_MaxTessControlUniformComponents
+syn keyword glslBuiltinConstant gl_MaxTessEvaluationAtomicCounterBuffers
+syn keyword glslBuiltinConstant gl_MaxTessEvaluationAtomicCounters
+syn keyword glslBuiltinConstant gl_MaxTessEvaluationImageUniforms
+syn keyword glslBuiltinConstant gl_MaxTessEvaluationInputComponents
+syn keyword glslBuiltinConstant gl_MaxTessEvaluationOutputComponents
+syn keyword glslBuiltinConstant gl_MaxTessEvaluationTextureImageUnits
+syn keyword glslBuiltinConstant gl_MaxTessEvaluationUniformComponents
+syn keyword glslBuiltinConstant gl_MaxTessGenLevel
+syn keyword glslBuiltinConstant gl_MaxTessPatchComponents
+syn keyword glslBuiltinConstant gl_MaxTextureCoords
+syn keyword glslBuiltinConstant gl_MaxTextureImageUnits
+syn keyword glslBuiltinConstant gl_MaxTextureUnits
+syn keyword glslBuiltinConstant gl_MaxTransformFeedbackBuffers
+syn keyword glslBuiltinConstant gl_MaxTransformFeedbackInterleavedComponents
+syn keyword glslBuiltinConstant gl_MaxVaryingComponents
+syn keyword glslBuiltinConstant gl_MaxVaryingFloats
+syn keyword glslBuiltinConstant gl_MaxVaryingVectors
+syn keyword glslBuiltinConstant gl_MaxVertexAtomicCounterBuffers
+syn keyword glslBuiltinConstant gl_MaxVertexAtomicCounters
+syn keyword glslBuiltinConstant gl_MaxVertexAttribs
+syn keyword glslBuiltinConstant gl_MaxVertexImageUniforms
+syn keyword glslBuiltinConstant gl_MaxVertexOutputComponents
+syn keyword glslBuiltinConstant gl_MaxVertexOutputVectors
+syn keyword glslBuiltinConstant gl_MaxVertexTextureImageUnits
+syn keyword glslBuiltinConstant gl_MaxVertexUniformComponents
+syn keyword glslBuiltinConstant gl_MaxVertexUniformVectors
+syn keyword glslBuiltinConstant gl_MaxViewports
+syn keyword glslBuiltinConstant gl_MinProgramTexelOffset
+syn keyword glslBuiltinConstant gl_RayFlagsCullBackFacingTrianglesEXT
+syn keyword glslBuiltinConstant gl_RayFlagsCullFrontFacingTrianglesEXT
+syn keyword glslBuiltinConstant gl_RayFlagsCullNoOpaqueEXT
+syn keyword glslBuiltinConstant gl_RayFlagsCullOpaqueEXT
+syn keyword glslBuiltinConstant gl_RayFlagsNoOpaqueEXT
+syn keyword glslBuiltinConstant gl_RayFlagsNoneEXT
+syn keyword glslBuiltinConstant gl_RayFlagsOpaqueEXT
+syn keyword glslBuiltinConstant gl_RayFlagsSkipClosestHitShaderEXT
+syn keyword glslBuiltinConstant gl_RayFlagsTerminateOnFirstHitEXT
+syn keyword glslBuiltinConstant gl_RayQueryCandidateIntersectionAABBEXT
+syn keyword glslBuiltinConstant gl_RayQueryCandidateIntersectionTriangleEXT
+syn keyword glslBuiltinConstant gl_RayQueryCommittedIntersectionGeneratedEXT
+syn keyword glslBuiltinConstant gl_RayQueryCommittedIntersectionNoneEXT
+syn keyword glslBuiltinConstant gl_RayQueryCommittedIntersectionTriangleEXT
+
+" Built-in Variables
+syn keyword glslBuiltinVariable gl_BackColor
+syn keyword glslBuiltinVariable gl_BackLightModelProduct
+syn keyword glslBuiltinVariable gl_BackLightProduct
+syn keyword glslBuiltinVariable gl_BackLightProduct
+syn keyword glslBuiltinVariable gl_BackMaterial
+syn keyword glslBuiltinVariable gl_BackSecondaryColor
+syn keyword glslBuiltinVariable gl_ClipDistance
+syn keyword glslBuiltinVariable gl_ClipPlane
+syn keyword glslBuiltinVariable gl_ClipVertex
+syn keyword glslBuiltinVariable gl_Color
+syn keyword glslBuiltinVariable gl_DepthRange
+syn keyword glslBuiltinVariable gl_EyePlaneQ
+syn keyword glslBuiltinVariable gl_EyePlaneR
+syn keyword glslBuiltinVariable gl_EyePlaneS
+syn keyword glslBuiltinVariable gl_EyePlaneT
+syn keyword glslBuiltinVariable gl_Fog
+syn keyword glslBuiltinVariable gl_FogCoord
+syn keyword glslBuiltinVariable gl_FogFragCoord
+syn keyword glslBuiltinVariable gl_FragColor
+syn keyword glslBuiltinVariable gl_FragCoord
+syn keyword glslBuiltinVariable gl_FragData
+syn keyword glslBuiltinVariable gl_FragDepth
+syn keyword glslBuiltinVariable gl_FrontColor
+syn keyword glslBuiltinVariable gl_FrontFacing
+syn keyword glslBuiltinVariable gl_FrontLightModelProduct
+syn keyword glslBuiltinVariable gl_FrontLightProduct
+syn keyword glslBuiltinVariable gl_FrontMaterial
+syn keyword glslBuiltinVariable gl_FrontSecondaryColor
+syn keyword glslBuiltinVariable gl_GeometryIndexEXT
+syn keyword glslBuiltinVariable gl_GlobalInvocationID
+syn keyword glslBuiltinVariable gl_HelperInvocation
+syn keyword glslBuiltinVariable gl_HitKindEXT
+syn keyword glslBuiltinVariable gl_HitTEXT
+syn keyword glslBuiltinVariable gl_IncomingRayFlagsEXT
+syn keyword glslBuiltinVariable gl_InstanceCustomIndexEXT
+syn keyword glslBuiltinVariable gl_InstanceID
+syn keyword glslBuiltinVariable gl_InstanceID
+syn keyword glslBuiltinVariable gl_InvocationID
+syn keyword glslBuiltinVariable gl_LaunchIDEXT
+syn keyword glslBuiltinVariable gl_LaunchSizeEXT
+syn keyword glslBuiltinVariable gl_Layer
+syn keyword glslBuiltinVariable gl_LightModel
+syn keyword glslBuiltinVariable gl_LightSource
+syn keyword glslBuiltinVariable gl_LocalInvocationID
+syn keyword glslBuiltinVariable gl_LocalInvocationIndex
+syn keyword glslBuiltinVariable gl_ModelViewMatrix
+syn keyword glslBuiltinVariable gl_ModelViewMatrixInverse
+syn keyword glslBuiltinVariable gl_ModelViewMatrixInverseTranspose
+syn keyword glslBuiltinVariable gl_ModelViewMatrixTranspose
+syn keyword glslBuiltinVariable gl_ModelViewProjectionMatrix
+syn keyword glslBuiltinVariable gl_ModelViewProjectionMatrixInverse
+syn keyword glslBuiltinVariable gl_ModelViewProjectionMatrixInverseTranspose
+syn keyword glslBuiltinVariable gl_ModelViewProjectionMatrixTranspose
+syn keyword glslBuiltinVariable gl_MultiTexCoord0
+syn keyword glslBuiltinVariable gl_MultiTexCoord1
+syn keyword glslBuiltinVariable gl_MultiTexCoord2
+syn keyword glslBuiltinVariable gl_MultiTexCoord3
+syn keyword glslBuiltinVariable gl_MultiTexCoord4
+syn keyword glslBuiltinVariable gl_MultiTexCoord5
+syn keyword glslBuiltinVariable gl_MultiTexCoord6
+syn keyword glslBuiltinVariable gl_MultiTexCoord7
+syn keyword glslBuiltinVariable gl_Normal
+syn keyword glslBuiltinVariable gl_NormalMatrix
+syn keyword glslBuiltinVariable gl_NormalScale
+syn keyword glslBuiltinVariable gl_NumSamples
+syn keyword glslBuiltinVariable gl_NumWorkGroups
+syn keyword glslBuiltinVariable gl_ObjectPlaneQ
+syn keyword glslBuiltinVariable gl_ObjectPlaneR
+syn keyword glslBuiltinVariable gl_ObjectPlaneS
+syn keyword glslBuiltinVariable gl_ObjectPlaneT
+syn keyword glslBuiltinVariable gl_ObjectRayDirectionEXT
+syn keyword glslBuiltinVariable gl_ObjectRayOriginEXT
+syn keyword glslBuiltinVariable gl_ObjectToWorld3x4EXT
+syn keyword glslBuiltinVariable gl_ObjectToWorldEXT
+syn keyword glslBuiltinVariable gl_PatchVerticesIn
+syn keyword glslBuiltinVariable gl_Point
+syn keyword glslBuiltinVariable gl_PointCoord
+syn keyword glslBuiltinVariable gl_PointSize
+syn keyword glslBuiltinVariable gl_Position
+syn keyword glslBuiltinVariable gl_PrimitiveID
+syn keyword glslBuiltinVariable gl_PrimitiveID
+syn keyword glslBuiltinVariable gl_PrimitiveIDIn
+syn keyword glslBuiltinVariable gl_ProjectionMatrix
+syn keyword glslBuiltinVariable gl_ProjectionMatrixInverse
+syn keyword glslBuiltinVariable gl_ProjectionMatrixInverseTranspose
+syn keyword glslBuiltinVariable gl_ProjectionMatrixTranspose
+syn keyword glslBuiltinVariable gl_RayTmaxEXT
+syn keyword glslBuiltinVariable gl_RayTminEXT
+syn keyword glslBuiltinVariable gl_SampleID
+syn keyword glslBuiltinVariable gl_SampleMask
+syn keyword glslBuiltinVariable gl_SampleMaskIn
+syn keyword glslBuiltinVariable gl_SamplePosition
+syn keyword glslBuiltinVariable gl_SecondaryColor
+syn keyword glslBuiltinVariable gl_TessCoord
+syn keyword glslBuiltinVariable gl_TessLevelInner
+syn keyword glslBuiltinVariable gl_TessLevelOuter
+syn keyword glslBuiltinVariable gl_TexCoord
+syn keyword glslBuiltinVariable gl_TextureEnvColor
+syn keyword glslBuiltinVariable gl_TextureMatrix
+syn keyword glslBuiltinVariable gl_TextureMatrixInverse
+syn keyword glslBuiltinVariable gl_TextureMatrixInverseTranspose
+syn keyword glslBuiltinVariable gl_TextureMatrixTranspose
+syn keyword glslBuiltinVariable gl_Vertex
+syn keyword glslBuiltinVariable gl_VertexID
+syn keyword glslBuiltinVariable gl_VertexIndex
+syn keyword glslBuiltinVariable gl_ViewportIndex
+syn keyword glslBuiltinVariable gl_WorkGroupID
+syn keyword glslBuiltinVariable gl_WorkGroupSize
+syn keyword glslBuiltinVariable gl_WorldRayDirectionEXT
+syn keyword glslBuiltinVariable gl_WorldRayOriginEXT
+syn keyword glslBuiltinVariable gl_WorldToObject3x4EXT
+syn keyword glslBuiltinVariable gl_WorldToObjectEXT
+syn keyword glslBuiltinVariable gl_in
+syn keyword glslBuiltinVariable gl_out
+
+" Built-in Functions
+syn keyword glslBuiltinFunction EmitStreamVertex
+syn keyword glslBuiltinFunction EmitVertex
+syn keyword glslBuiltinFunction EndPrimitive
+syn keyword glslBuiltinFunction EndStreamPrimitive
+syn keyword glslBuiltinFunction abs
+syn keyword glslBuiltinFunction acos
+syn keyword glslBuiltinFunction acosh
+syn keyword glslBuiltinFunction all
+syn keyword glslBuiltinFunction any
+syn keyword glslBuiltinFunction asin
+syn keyword glslBuiltinFunction asinh
+syn keyword glslBuiltinFunction atan
+syn keyword glslBuiltinFunction atanh
+syn keyword glslBuiltinFunction atomicAdd
+syn keyword glslBuiltinFunction atomicAnd
+syn keyword glslBuiltinFunction atomicCompSwap
+syn keyword glslBuiltinFunction atomicCounter
+syn keyword glslBuiltinFunction atomicCounterDecrement
+syn keyword glslBuiltinFunction atomicCounterIncrement
+syn keyword glslBuiltinFunction atomicExchange
+syn keyword glslBuiltinFunction atomicMax
+syn keyword glslBuiltinFunction atomicMin
+syn keyword glslBuiltinFunction atomicOr
+syn keyword glslBuiltinFunction atomicXor
+syn keyword glslBuiltinFunction barrier
+syn keyword glslBuiltinFunction bitCount
+syn keyword glslBuiltinFunction bitfieldExtract
+syn keyword glslBuiltinFunction bitfieldInsert
+syn keyword glslBuiltinFunction bitfieldReverse
+syn keyword glslBuiltinFunction ceil
+syn keyword glslBuiltinFunction clamp
+syn keyword glslBuiltinFunction cos
+syn keyword glslBuiltinFunction cosh
+syn keyword glslBuiltinFunction cross
+syn keyword glslBuiltinFunction dFdx
+syn keyword glslBuiltinFunction dFdxCoarse
+syn keyword glslBuiltinFunction dFdxFine
+syn keyword glslBuiltinFunction dFdy
+syn keyword glslBuiltinFunction dFdyCoarse
+syn keyword glslBuiltinFunction dFdyFine
+syn keyword glslBuiltinFunction degrees
+syn keyword glslBuiltinFunction determinant
+syn keyword glslBuiltinFunction distance
+syn keyword glslBuiltinFunction dot
+syn keyword glslBuiltinFunction equal
+syn keyword glslBuiltinFunction executeCallableEXT
+syn keyword glslBuiltinFunction exp
+syn keyword glslBuiltinFunction exp2
+syn keyword glslBuiltinFunction faceforward
+syn keyword glslBuiltinFunction findLSB
+syn keyword glslBuiltinFunction findMSB
+syn keyword glslBuiltinFunction floatBitsToInt
+syn keyword glslBuiltinFunction floatBitsToUint
+syn keyword glslBuiltinFunction floor
+syn keyword glslBuiltinFunction fma
+syn keyword glslBuiltinFunction fract
+syn keyword glslBuiltinFunction frexp
+syn keyword glslBuiltinFunction ftransform
+syn keyword glslBuiltinFunction fwidth
+syn keyword glslBuiltinFunction fwidthCoarse
+syn keyword glslBuiltinFunction fwidthFine
+syn keyword glslBuiltinFunction greaterThan
+syn keyword glslBuiltinFunction greaterThanEqual
+syn keyword glslBuiltinFunction groupMemoryBarrier
+syn keyword glslBuiltinFunction ignoreIntersectionEXT
+syn keyword glslBuiltinFunction imageAtomicAdd
+syn keyword glslBuiltinFunction imageAtomicAnd
+syn keyword glslBuiltinFunction imageAtomicCompSwap
+syn keyword glslBuiltinFunction imageAtomicExchange
+syn keyword glslBuiltinFunction imageAtomicMax
+syn keyword glslBuiltinFunction imageAtomicMin
+syn keyword glslBuiltinFunction imageAtomicOr
+syn keyword glslBuiltinFunction imageAtomicXor
+syn keyword glslBuiltinFunction imageLoad
+syn keyword glslBuiltinFunction imageSize
+syn keyword glslBuiltinFunction imageStore
+syn keyword glslBuiltinFunction imulExtended
+syn keyword glslBuiltinFunction intBitsToFloat
+syn keyword glslBuiltinFunction interpolateAtCentroid
+syn keyword glslBuiltinFunction interpolateAtOffset
+syn keyword glslBuiltinFunction interpolateAtSample
+syn keyword glslBuiltinFunction inverse
+syn keyword glslBuiltinFunction inversesqrt
+syn keyword glslBuiltinFunction isinf
+syn keyword glslBuiltinFunction isnan
+syn keyword glslBuiltinFunction ldexp
+syn keyword glslBuiltinFunction length
+syn keyword glslBuiltinFunction lessThan
+syn keyword glslBuiltinFunction lessThanEqual
+syn keyword glslBuiltinFunction log
+syn keyword glslBuiltinFunction log2
+syn keyword glslBuiltinFunction matrixCompMult
+syn keyword glslBuiltinFunction max
+syn keyword glslBuiltinFunction memoryBarrier
+syn keyword glslBuiltinFunction memoryBarrierAtomicCounter
+syn keyword glslBuiltinFunction memoryBarrierBuffer
+syn keyword glslBuiltinFunction memoryBarrierImage
+syn keyword glslBuiltinFunction memoryBarrierShared
+syn keyword glslBuiltinFunction min
+syn keyword glslBuiltinFunction mix
+syn keyword glslBuiltinFunction mod
+syn keyword glslBuiltinFunction modf
+syn keyword glslBuiltinFunction noise1
+syn keyword glslBuiltinFunction noise2
+syn keyword glslBuiltinFunction noise3
+syn keyword glslBuiltinFunction noise4
+syn keyword glslBuiltinFunction normalize
+syn keyword glslBuiltinFunction not
+syn keyword glslBuiltinFunction notEqual
+syn keyword glslBuiltinFunction outerProduct
+syn keyword glslBuiltinFunction packDouble2x32
+syn keyword glslBuiltinFunction packHalf2x16
+syn keyword glslBuiltinFunction packSnorm2x16
+syn keyword glslBuiltinFunction packSnorm4x8
+syn keyword glslBuiltinFunction packUnorm2x16
+syn keyword glslBuiltinFunction packUnorm4x8
+syn keyword glslBuiltinFunction pow
+syn keyword glslBuiltinFunction radians
+syn keyword glslBuiltinFunction rayQueryConfirmIntersectionEXT
+syn keyword glslBuiltinFunction rayQueryGenerateIntersectionEXT
+syn keyword glslBuiltinFunction rayQueryGetIntersectionBarycentricsEXT
+syn keyword glslBuiltinFunction rayQueryGetIntersectionCandidateAABBOpaqueEXT
+syn keyword glslBuiltinFunction rayQueryGetIntersectionFrontFaceEXT
+syn keyword glslBuiltinFunction rayQueryGetIntersectionGeometryIndexEXT
+syn keyword glslBuiltinFunction rayQueryGetIntersectionInstanceCustomIndexEXT
+syn keyword glslBuiltinFunction rayQueryGetIntersectionInstanceIdEXT
+syn keyword glslBuiltinFunction rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT
+syn keyword glslBuiltinFunction rayQueryGetIntersectionObjectRayDirectionEXT
+syn keyword glslBuiltinFunction rayQueryGetIntersectionObjectRayOriginEXT
+syn keyword glslBuiltinFunction rayQueryGetIntersectionObjectToWorldEXT
+syn keyword glslBuiltinFunction rayQueryGetIntersectionPrimitiveIndexEXT
+syn keyword glslBuiltinFunction rayQueryGetIntersectionTEXT
+syn keyword glslBuiltinFunction rayQueryGetIntersectionTypeEXT
+syn keyword glslBuiltinFunction rayQueryGetIntersectionWorldToObjectEXT
+syn keyword glslBuiltinFunction rayQueryGetRayFlagsEXT
+syn keyword glslBuiltinFunction rayQueryGetRayTMinEXT
+syn keyword glslBuiltinFunction rayQueryGetWorldRayDirectionEXT
+syn keyword glslBuiltinFunction rayQueryGetWorldRayOriginEXT
+syn keyword glslBuiltinFunction rayQueryInitializeEXT
+syn keyword glslBuiltinFunction rayQueryProceedEXT
+syn keyword glslBuiltinFunction rayQueryTerminateEXT
+syn keyword glslBuiltinFunction reflect
+syn keyword glslBuiltinFunction refract
+syn keyword glslBuiltinFunction reportIntersectionEXT
+syn keyword glslBuiltinFunction round
+syn keyword glslBuiltinFunction roundEven
+syn keyword glslBuiltinFunction shadow1D
+syn keyword glslBuiltinFunction shadow1DLod
+syn keyword glslBuiltinFunction shadow1DProj
+syn keyword glslBuiltinFunction shadow1DProjLod
+syn keyword glslBuiltinFunction shadow2D
+syn keyword glslBuiltinFunction shadow2DLod
+syn keyword glslBuiltinFunction shadow2DProj
+syn keyword glslBuiltinFunction shadow2DProjLod
+syn keyword glslBuiltinFunction sign
+syn keyword glslBuiltinFunction sin
+syn keyword glslBuiltinFunction sinh
+syn keyword glslBuiltinFunction smoothstep
+syn keyword glslBuiltinFunction sqrt
+syn keyword glslBuiltinFunction step
+syn keyword glslBuiltinFunction tan
+syn keyword glslBuiltinFunction tanh
+syn keyword glslBuiltinFunction terminateRayEXT
+syn keyword glslBuiltinFunction texelFetch
+syn keyword glslBuiltinFunction texelFetchOffset
+syn keyword glslBuiltinFunction texture
+syn keyword glslBuiltinFunction texture1D
+syn keyword glslBuiltinFunction texture1DLod
+syn keyword glslBuiltinFunction texture1DProj
+syn keyword glslBuiltinFunction texture1DProjLod
+syn keyword glslBuiltinFunction texture2D
+syn keyword glslBuiltinFunction texture2DLod
+syn keyword glslBuiltinFunction texture2DProj
+syn keyword glslBuiltinFunction texture2DProjLod
+syn keyword glslBuiltinFunction texture3D
+syn keyword glslBuiltinFunction texture3DLod
+syn keyword glslBuiltinFunction texture3DProj
+syn keyword glslBuiltinFunction texture3DProjLod
+syn keyword glslBuiltinFunction textureCube
+syn keyword glslBuiltinFunction textureCubeLod
+syn keyword glslBuiltinFunction textureGather
+syn keyword glslBuiltinFunction textureGatherOffset
+syn keyword glslBuiltinFunction textureGatherOffsets
+syn keyword glslBuiltinFunction textureGrad
+syn keyword glslBuiltinFunction textureGradOffset
+syn keyword glslBuiltinFunction textureLod
+syn keyword glslBuiltinFunction textureLodOffset
+syn keyword glslBuiltinFunction textureOffset
+syn keyword glslBuiltinFunction textureProj
+syn keyword glslBuiltinFunction textureProjGrad
+syn keyword glslBuiltinFunction textureProjGradOffset
+syn keyword glslBuiltinFunction textureProjLod
+syn keyword glslBuiltinFunction textureProjLodOffset
+syn keyword glslBuiltinFunction textureProjOffset
+syn keyword glslBuiltinFunction textureQueryLevels
+syn keyword glslBuiltinFunction textureQueryLod
+syn keyword glslBuiltinFunction textureSize
+syn keyword glslBuiltinFunction traceRayEXT
+syn keyword glslBuiltinFunction transpose
+syn keyword glslBuiltinFunction trunc
+syn keyword glslBuiltinFunction uaddCarry
+syn keyword glslBuiltinFunction uintBitsToFloat
+syn keyword glslBuiltinFunction umulExtended
+syn keyword glslBuiltinFunction unpackDouble2x32
+syn keyword glslBuiltinFunction unpackHalf2x16
+syn keyword glslBuiltinFunction unpackSnorm2x16
+syn keyword glslBuiltinFunction unpackSnorm4x8
+syn keyword glslBuiltinFunction unpackUnorm2x16
+syn keyword glslBuiltinFunction unpackUnorm4x8
+syn keyword glslBuiltinFunction usubBorrow
+
+hi def link glslConditional Conditional
+hi def link glslRepeat Repeat
+hi def link glslStatement Statement
+hi def link glslTodo Todo
+hi def link glslCommentL glslComment
+hi def link glslCommentStart glslComment
+hi def link glslComment Comment
+hi def link glslPreCondit PreCondit
+hi def link glslDefine Define
+hi def link glslTokenConcat glslPreProc
+hi def link glslPredefinedMacro Macro
+hi def link glslPreProc PreProc
+hi def link glslInclude Include
+hi def link glslBoolean Boolean
+hi def link glslDecimalInt glslInteger
+hi def link glslOctalInt glslInteger
+hi def link glslHexInt glslInteger
+hi def link glslInteger Number
+hi def link glslFloat Float
+hi def link glslIdentifierPrime glslIdentifier
+hi def link glslIdentifier Identifier
+hi def link glslStructure Structure
+hi def link glslType Type
+hi def link glslQualifier StorageClass
+hi def link glslBuiltinConstant Constant
+hi def link glslBuiltinFunction Function
+hi def link glslBuiltinVariable Identifier
+hi def link glslSwizzle Identifier
+
+let b:current_syntax = 'glsl'
diff --git a/runtime/syntax/goaccess.vim b/runtime/syntax/goaccess.vim
new file mode 100644
index 0000000000..4ca8f6d921
--- /dev/null
+++ b/runtime/syntax/goaccess.vim
@@ -0,0 +1,34 @@
+" Vim syntax file
+" Language: GoAccess configuration
+" Maintainer: Adam Monsen <haircut@gmail.com>
+" Last Change: 2024 Aug 1
+" Remark: see https://goaccess.io/man#configuration
+"
+" The GoAccess configuration file syntax is line-separated settings. Settings
+" are space-separated key value pairs. Comments are any line starting with a
+" hash mark.
+" Example: https://github.com/allinurl/goaccess/blob/master/config/goaccess.conf
+"
+" This syntax definition supports todo/fixme highlighting in comments, and
+" special (Keyword) highlighting if a setting's value is 'true' or 'false'.
+"
+" TODO: a value is required, so use extreme highlighting (e.g. bright red
+" background) if a setting is missing a value.
+
+if exists("b:current_syntax")
+ finish
+endif
+
+syn match goaccessSettingName '^[a-z-]\+' nextgroup=goaccessSettingValue
+syn match goaccessSettingValue '\s\+.\+$' contains=goaccessKeyword
+syn match goaccessComment "^#.*$" contains=goaccessTodo,@Spell
+syn keyword goaccessTodo TODO FIXME contained
+syn keyword goaccessKeyword true false contained
+
+hi def link goaccessSettingName Type
+hi def link goaccessSettingValue String
+hi def link goaccessComment Comment
+hi def link goaccessTodo Todo
+hi def link goaccessKeyword Keyword
+
+let b:current_syntax = "goaccess"
diff --git a/runtime/syntax/hare.vim b/runtime/syntax/hare.vim
index 07cf33fb11..4c7ae92486 100644
--- a/runtime/syntax/hare.vim
+++ b/runtime/syntax/hare.vim
@@ -1,119 +1,142 @@
-" PRELUDE {{{1
-" Vim syntax file
-" Language: Hare
-" Maintainer: Amelia Clarke <me@rsaihe.dev>
-" Last Change: 2022-09-21
+" Vim syntax file.
+" Language: Hare
+" Maintainer: Amelia Clarke <selene@perilune.dev>
+" Last Change: 2024-05-10
+" Upstream: https://git.sr.ht/~sircmpwn/hare.vim
-if exists("b:current_syntax")
+if exists('b:current_syntax')
finish
endif
-let b:current_syntax = "hare"
+syn include @haredoc syntax/haredoc.vim
+let b:current_syntax = 'hare'
-" SYNTAX {{{1
+" Syntax {{{1
syn case match
+syn iskeyword @,48-57,@-@,_
-" KEYWORDS {{{2
-syn keyword hareConditional if else match switch
+" Keywords {{{2
+syn keyword hareConditional else if match switch
+syn keyword hareDefine def
+syn keyword hareInclude use
syn keyword hareKeyword break continue return yield
+syn keyword hareKeyword case
+syn keyword hareKeyword const let
syn keyword hareKeyword defer
+syn keyword hareKeyword export static
syn keyword hareKeyword fn
-syn keyword hareKeyword let
-syn keyword hareLabel case
syn keyword hareOperator as is
syn keyword hareRepeat for
-syn keyword hareStorageClass const def export nullable static
-syn keyword hareStructure enum struct union
syn keyword hareTypedef type
-" C ABI.
-syn keyword hareKeyword vastart vaarg vaend
-
-" BUILTINS {{{2
-syn keyword hareBuiltin abort
+" Attributes.
+syn keyword hareAttribute @fini @init @test
+syn keyword hareAttribute @offset @packed
+syn keyword hareAttribute @symbol
+syn keyword hareAttribute @threadlocal
+
+" Builtins.
+syn keyword hareBuiltin abort assert
+syn keyword hareBuiltin align len offset
syn keyword hareBuiltin alloc free
syn keyword hareBuiltin append delete insert
-syn keyword hareBuiltin assert
-syn keyword hareBuiltin len offset
+syn keyword hareBuiltin vaarg vaend vastart
-" TYPES {{{2
+" Types {{{2
syn keyword hareType bool
-syn keyword hareType char str
+syn keyword hareType done
syn keyword hareType f32 f64
-syn keyword hareType u8 u16 u32 u64 i8 i16 i32 i64
-syn keyword hareType uint int
-syn keyword hareType rune
+syn keyword hareType i8 i16 i32 i64 int
+syn keyword hareType never
+syn keyword hareType opaque
+syn keyword hareType rune str
+syn keyword hareType u8 u16 u32 u64 uint
syn keyword hareType uintptr
+syn keyword hareType valist
syn keyword hareType void
-" C ABI.
-syn keyword hareType valist
+" Other types.
+syn keyword hareStorageClass nullable
+syn keyword hareStructure enum struct union
-" LITERALS {{{2
-syn keyword hareBoolean true false
-syn keyword hareNull null
-
-" Number literals.
-syn match hareNumber "\v(\.@1<!|\.\.)\zs<\d+([Ee][+-]?\d+)?(z|[iu](8|16|32|64)?)?>" display
-syn match hareNumber "\v(\.@1<!|\.\.)\zs<0b[01]+(z|[iu](8|16|32|64)?)?>" display
-syn match hareNumber "\v(\.@1<!|\.\.)\zs<0o\o+(z|[iu](8|16|32|64)?)?>" display
-syn match hareNumber "\v(\.@1<!|\.\.)\zs<0x\x+(z|[iu](8|16|32|64)?)?>" display
-
-" Floating-point number literals.
-syn match hareFloat "\v<\d+\.\d+([Ee][+-]?\d+)?(f32|f64)?>" display
-syn match hareFloat "\v<\d+([Ee][+-]?\d+)?(f32|f64)>" display
-
-" String and rune literals.
-syn match hareEscape "\\[\\'"0abfnrtv]" contained display
-syn match hareEscape "\v\\(x\x{2}|u\x{4}|U\x{8})" contained display
-syn match hareFormat "\v\{\d*(\%\d*|(:[ 0+-]?\d*(\.\d+)?[Xbox]?))?}" contained display
-syn match hareFormat "\({{\|}}\)" contained display
-syn region hareRune start="'" end="'\|$" skip="\\'" contains=hareEscape display extend
-syn region hareString start=+"+ end=+"\|$+ skip=+\\"+ contains=hareEscape,hareFormat display extend
-syn region hareString start="`" end="`\|$" contains=hareFormat display
-
-" MISCELLANEOUS {{{2
-syn keyword hareTodo FIXME TODO XXX contained
+" Literals {{{2
+syn keyword hareBoolean false true
+syn keyword hareConstant null
-" Attributes.
-syn match hareAttribute "@[a-z]*"
+" Integer literals.
+syn match hareNumber '\v<%(0|[1-9]%(_?\d)*)%([Ee]\+?\d+)?%([iu]%(8|16|32|64)?|z)?>' display
+syn match hareNumber '\v<0b[01]%(_?[01])*%([iu]%(8|16|32|64)?|z)?>' display
+syn match hareNumber '\v<0o\o%(_?\o)*%([iu]%(8|16|32|64)?|z)?>' display
+syn match hareNumber '\v<0x\x%(_?\x)*%([iu]%(8|16|32|64)?|z)?>' display
-" Blocks.
-syn region hareBlock start="{" end="}" fold transparent
+" Floating-point literals.
+syn match hareFloat '\v<%(0|[1-9]%(_?\d)*)\.\d%(_?\d)*%([Ee][+-]?\d+)?%(f32|f64)?>' display
+syn match hareFloat '\v<%(0|[1-9]%(_?\d)*)%([Ee][+-]?\d+)?%(f32|f64)>' display
+syn match hareFloat '\v<0x\x%(_?\x)*%(\.\x%(_?\x)*)?[Pp][+-]?\d+%(f32|f64)?>' display
+
+" Rune and string literals.
+syn region hareRune start="'" skip="\\'" end="'" contains=hareEscape
+syn region hareString start='"' skip='\\"' end='"' contains=hareEscape,hareFormat
+syn region hareString start='`' end='`' contains=hareFormat
+
+" Escape sequences.
+syn match hareEscape '\\[0abfnrtv\\'"]' contained
+syn match hareEscape '\v\\%(x\x{2}|u\x{4}|U\x{8})' contained display
+
+" Format sequences.
+syn match hareFormat '\v\{\d*%(:%(\.?\d+|[ +\-=Xbefgox]|F[.2ESUs]|_%(.|\\%([0abfnrtv\\'"]|x\x{2}|u\x{4}|U\x{8})))*)?}' contained contains=hareEscape display
+syn match hareFormat '{\d*%\d*}' contained display
+syn match hareFormat '{{\|}}' contained display
+
+" Miscellaneous {{{2
" Comments.
-syn region hareComment start="//" end="$" contains=hareCommentDoc,hareTodo,@Spell display keepend
-syn region hareCommentDoc start="\[\[" end="]]\|\ze\_s" contained display
+syn region hareComment start='//' end='$' contains=hareTodo,@haredoc,@Spell display
+syn keyword hareTodo FIXME TODO XXX contained
+
+" Identifiers.
+syn match hareDelimiter '::' display
+syn match hareName '\<\h\w*\>' nextgroup=@harePostfix skipempty skipwhite transparent
-" The size keyword can be either a builtin or a type.
-syn match hareBuiltin "\v<size>\ze(\_s*//.*\_$)*\_s*\(" contains=hareComment
-syn match hareType "\v<size>((\_s*//.*\_$)*\_s*\()@!" contains=hareComment
+" Labels.
+syn match hareLabel ':\h\w*\>' display
-" Trailing whitespace.
-syn match hareSpaceError "\v\s+$" display excludenl
-syn match hareSpaceError "\v\zs +\ze\t" display
+" Match `size` as a type unless it is followed by an open paren.
+syn match hareType '\<size\>' display
+syn match hareBuiltin '\<size\ze(' display
-" Use statement.
-syn region hareUse start="\v^\s*\zsuse>" end=";" contains=hareComment display
+" Postfix expressions.
+syn cluster harePostfix contains=hareErrorTest,hareField,hareIndex,hareParens
+syn match hareErrorTest '!=\@!' contained nextgroup=@harePostfix skipempty skipwhite
+syn match hareErrorTest '?' nextgroup=@harePostfix skipempty skipwhite
+syn match hareField '\.\w*\>'hs=s+1 contained contains=hareNumber nextgroup=@harePostfix skipempty skipwhite
+syn region hareIndex start='\[' end=']' contained nextgroup=@harePostfix skipempty skipwhite transparent
+syn region hareParens start='(' end=')' nextgroup=@harePostfix skipempty skipwhite transparent
-syn match hareErrorAssertion "\v(^([^/]|//@!)*\)\_s*)@<=!\=@!"
-syn match hareQuestionMark "?"
+" Whitespace errors.
+syn match hareSpaceError '^ \+\ze\t' display
+syn match hareSpaceError excludenl '\s\+$' containedin=ALL display
-" DEFAULT HIGHLIGHTING {{{1
-hi def link hareAttribute Keyword
+" Folding {{{3
+syn region hareBlock start='{' end='}' fold transparent
+
+" Default highlighting {{{1
+hi def link hareAttribute PreProc
hi def link hareBoolean Boolean
-hi def link hareBuiltin Function
+hi def link hareBuiltin Operator
hi def link hareComment Comment
-hi def link hareCommentDoc SpecialComment
hi def link hareConditional Conditional
+hi def link hareConstant Constant
+hi def link hareDefine Define
+hi def link hareDelimiter Delimiter
+hi def link hareErrorTest Special
hi def link hareEscape SpecialChar
hi def link hareFloat Float
hi def link hareFormat SpecialChar
+hi def link hareInclude Include
hi def link hareKeyword Keyword
-hi def link hareLabel Label
-hi def link hareNull Constant
+hi def link hareLabel Special
hi def link hareNumber Number
hi def link hareOperator Operator
-hi def link hareQuestionMark Special
hi def link hareRepeat Repeat
hi def link hareRune Character
hi def link hareStorageClass StorageClass
@@ -122,12 +145,13 @@ hi def link hareStructure Structure
hi def link hareTodo Todo
hi def link hareType Type
hi def link hareTypedef Typedef
-hi def link hareUse PreProc
-hi def link hareSpaceError Error
-autocmd InsertEnter * hi link hareSpaceError NONE
-autocmd InsertLeave * hi link hareSpaceError Error
+" Highlight embedded haredoc references.
+hi! def link haredocRefValid SpecialComment
-hi def hareErrorAssertion ctermfg=red cterm=bold guifg=red gui=bold
+" Highlight whitespace errors by default.
+if get(g:, 'hare_space_error', 1)
+ hi def link hareSpaceError Error
+endif
-" vim: tabstop=8 shiftwidth=2 expandtab
+" vim: et sts=2 sw=2 ts=8
diff --git a/runtime/syntax/haredoc.vim b/runtime/syntax/haredoc.vim
new file mode 100644
index 0000000000..09c99c1d56
--- /dev/null
+++ b/runtime/syntax/haredoc.vim
@@ -0,0 +1,32 @@
+" Vim syntax file.
+" Language: Haredoc (Hare documentation format)
+" Maintainer: Amelia Clarke <selene@perilune.dev>
+" Last Change: 2024-05-10
+" Upstream: https://git.sr.ht/~selene/hare.vim
+
+if exists('b:current_syntax')
+ finish
+endif
+let b:current_syntax = 'haredoc'
+
+" Syntax {{{1
+syn case match
+syn iskeyword @,48-57,_
+
+" Code samples.
+syn region haredocCodeSample excludenl start='\t\zs' end='$' contains=@NoSpell display
+
+" References to other declarations and modules.
+syn region haredocRef start='\[\[' end=']]' contains=haredocRefValid,@NoSpell display keepend oneline
+syn match haredocRefValid '\v\[\[\h\w*%(::\h\w*)*%(::)?]]' contained contains=@NoSpell display
+
+" Miscellaneous.
+syn keyword haredocTodo FIXME TODO XXX
+
+" Default highlighting {{{1
+hi def link haredocCodeSample Comment
+hi def link haredocRef Error
+hi def link haredocRefValid Special
+hi def link haredocTodo Todo
+
+" vim: et sts=2 sw=2 ts=8
diff --git a/runtime/syntax/hcl.vim b/runtime/syntax/hcl.vim
new file mode 100644
index 0000000000..5e9349ab38
--- /dev/null
+++ b/runtime/syntax/hcl.vim
@@ -0,0 +1,66 @@
+" Vim syntax file
+" Language: HCL
+" Maintainer: Gregory Anders
+" Upstream: https://github.com/hashivim/vim-terraform
+" Last Change: 2024-09-03
+
+if exists('b:current_syntax')
+ finish
+endif
+
+syn iskeyword a-z,A-Z,48-57,_,-
+
+syn case match
+
+" A block is introduced by a type, some number of labels - which are either
+" strings or identifiers - and an opening curly brace. Match the type.
+syn match hclBlockType /^\s*\zs\K\k*\ze\s\+\(\("\K\k*"\|\K\k*\)\s\+\)*{/
+
+" An attribute name is an identifier followed by an equals sign.
+syn match hclAttributeAssignment /\(\K\k*\.\)*\K\k*\s\+=\s/ contains=hclAttributeName
+syn match hclAttributeName /\<\K\k*\>/ contained
+
+syn keyword hclValueBool true false
+
+syn keyword hclTodo contained TODO FIXME XXX BUG
+syn region hclComment start="/\*" end="\*/" contains=hclTodo,@Spell
+syn region hclComment start="#" end="$" contains=hclTodo,@Spell
+syn region hclComment start="//" end="$" contains=hclTodo,@Spell
+
+""" misc.
+syn match hclValueDec "\<[0-9]\+\([kKmMgG]b\?\)\?\>"
+syn match hclValueHexaDec "\<0x[0-9a-f]\+\([kKmMgG]b\?\)\?\>"
+syn match hclBraces "[\[\]]"
+
+""" skip \" and \\ in strings.
+syn region hclValueString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=hclStringInterp
+syn region hclStringInterp matchgroup=hclBraces start=/\(^\|[^$]\)\$\zs{/ end=/}/ contained contains=ALLBUT,hclAttributeName
+syn region hclHereDocText start=/<<-\?\z([a-z0-9A-Z]\+\)/ end=/^\s*\z1/ contains=hclStringInterp
+
+"" Functions.
+syn match hclFunction "[a-z0-9]\+(\@="
+
+""" HCL2
+syn keyword hclRepeat for in
+syn keyword hclConditional if
+syn keyword hclValueNull null
+
+" enable block folding
+syn region hclBlockBody matchgroup=hclBraces start="{" end="}" fold transparent
+
+hi def link hclComment Comment
+hi def link hclTodo Todo
+hi def link hclBraces Delimiter
+hi def link hclAttributeName Identifier
+hi def link hclBlockType Type
+hi def link hclValueBool Boolean
+hi def link hclValueDec Number
+hi def link hclValueHexaDec Number
+hi def link hclValueString String
+hi def link hclHereDocText String
+hi def link hclFunction Function
+hi def link hclRepeat Repeat
+hi def link hclConditional Conditional
+hi def link hclValueNull Constant
+
+let b:current_syntax = 'hcl'
diff --git a/runtime/syntax/help.vim b/runtime/syntax/help.vim
index fced5e7dd1..fd128bb0b5 100644
--- a/runtime/syntax/help.vim
+++ b/runtime/syntax/help.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: Vim help file
" Maintainer: The Vim Project <https://github.com/vim/vim>
-" Last Change: 2023 Aug 10
+" Last Change: 2024 Oct 05
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" Quit when a (custom) syntax file was already loaded
@@ -15,7 +15,7 @@ set cpo&vim
syn match helpHeadline "^[A-Z.][-A-Z0-9 .,()_']*?\=\ze\(\s\+\*\|$\)"
syn match helpSectionDelim "^===.*===$"
syn match helpSectionDelim "^---.*--$"
-" Neovim: support language annotation in codeblocks
+" Nvim: support language annotation in codeblocks
if has("conceal")
syn region helpExample matchgroup=helpIgnore start=" >[a-z0-9]*$" start="^>[a-z0-9]*$" end="^[^ \t]"me=e-1 end="^<" concealends
else
@@ -60,10 +60,14 @@ syn match helpSpecial "\<N\.\s"me=e-2
syn match helpSpecial "(N\>"ms=s+1
syn match helpSpecial "\[N]"
-" avoid highlighting N N in help.txt
+" avoid highlighting N N in quickref.txt
syn match helpSpecial "N N"he=s+1
syn match helpSpecial "Nth"me=e-2
syn match helpSpecial "N-1"me=e-2
+" highlighting N of cinoptions-values in indent.txt
+syn match helpSpecial "^\t-\?\zsNs\?\s"me=s+1
+" highlighting N of cinoptions-values in indent.txt
+syn match helpSpecial "^\t[>enf{}^L:=lbghNEpti+cC/(uUwWkmMjJ)*#P]N\s"ms=s+2,me=e-1
syn match helpSpecial "{[-_a-zA-Z0-9'"*+/:%#=[\]<>.,]\+}"
syn match helpSpecial "\s\[[-a-z^A-Z0-9_]\{2,}]"ms=s+1
syn match helpSpecial "<[-a-zA-Z0-9_]\+>"
diff --git a/runtime/syntax/hollywood.vim b/runtime/syntax/hollywood.vim
index 7846d5230f..16df9fa736 100644
--- a/runtime/syntax/hollywood.vim
+++ b/runtime/syntax/hollywood.vim
@@ -2,7 +2,7 @@
" Language: Hollywood 10.0
" Maintainer: Ola Söder <rolfkopman@gmail.com>
" First Author: Tom Crecelius <holly@net-eclipse.net>
-" Last Change: 2023 Mar 22
+" Last Change: 2024 Jun 20
" Highlighting Issues:
" Depending on your colour schema, Strings or Comments might be highlighted in
" a way, you don't like. If so, try one of the following settings after
@@ -30,7 +30,7 @@ let s:cpo_save = &cpo
set cpo&vim
if !exists("hw_version")
- let hw_version = 9
+ let hw_version = 10
let hw_subversion = 0
elseif !exists("hw_subversion")
let hw_subversion = 0
@@ -54,9 +54,9 @@ syn match hwError "\<\%(If\|End\|Else\|ElseIf\|Then\|Until\|In\|EndIf\|EndSwitc
syn region hwFunctionBlock transparent matchgroup=hwFunction start="\<Function\>" end="\<EndFunction\>" contains=ALLBUT,hwTodo,hwSpecial,hwElseIf,hwElse,hwIn,hwStep,hwFallThrough,hwLineStatement
" If .. Then
-syn region hwIfThen transparent matchgroup=hwCond start="\<If\>" end="\<Then\>\{-}"me=e-4 skipwhite skipempty
+syn region hwIfThen transparent matchgroup=hwCond start="\<If\>" end="\<Then\>\{-}"me=e-4 oneline skipwhite skipempty
" Then ... Else
-syn region hwThenElse transparent matchgroup=hwCond start="\<Then\>" end="$" end="\<Else\>" contains=ALLBUT,hwTodo,hwSpecial,hwIn,hwStep,hwLineStatement,hwIfEndIf,hwElseEndif,hwIfThen,hwThenElse skipwhite skipempty
+syn region hwThenElse transparent matchgroup=hwCond start="\<Then\>" end="$" end="\<Else\>" contains=hwFunction,hwUserFunction,hwElseIf,hwStatement,hwConstant containedin=hwIfThen oneline skipwhite skipempty
" If .. EndIf
syn region hwIfEndIf transparent matchgroup=hwCond start="\<If\>\(\(.\{-}Then.\{-}\)\@!\)" end="\<EndIf\>" contains=ALLBUT,hwTodo,hwSpecial,hwIn,hwStep,hwLineStatement skipwhite skipempty
@@ -98,6 +98,12 @@ syn region hwForTo transparent matchgroup=hwRepeat start="\<For\>" end="\<To\>"m
" To .. Next
syn region hwToNext transparent matchgroup=hwRepeat start="\<To\>" end="\<Next\>" contains=ALLBUT,hwTodo,hwSpecial,hwElseIf,hwElse,hwIn,hwLineStatement skipwhite skipempty
+" For .. In
+syn region hwForIn transparent matchgroup=hwRepeat start="\<For\>\(\(.\{-}To.\{-}\)\@!\)" end="\<In\>"me=e-2, skipwhite skipempty nextgroup=hwInNext
+
+" In .. Next
+syn region hwInNext transparent matchgroup=hwRepeat start="\<In\>" end="\<Next\>" contains=ALLBUT,hwTodo,hwSpecial,hwElseIf,hwElse,hwLineStatement skipwhite skipempty
+
syn keyword hwStep contained Step
syn keyword hwIn contained In
@@ -116,7 +122,7 @@ syn match hwConstant "#\<\%(ACTIVEWINDOW\|ADF_ANIM\|ADF_FX\|ADF_MOVEOBJECT\|ALL\
syn keyword hwFunction Abs ACos ActivateDisplay Add AddArcToPath AddBoxToPath AddCircleToPath AddEllipseToPath AddFontPath AddIconImage AddMove AddStr AddTab AddTextToPath AllocConsoleColor AllocMem AllocMemFromPointer AllocMemFromVirtualFile AppendPath ApplyPatch Arc ArcDistortBrush ARGB ArrayToStr Asc ASin Assert AsyncDrawFrame ATan ATan2 BarrelDistortBrush Base64Str Beep BeepConsole BeginAnimStream BeginDoubleBuffer BeginRefresh BGPicToBrush BinStr BitClear BitComplement BitSet BitTest BitXor Blue BlurBrush Box BreakEventHandler BreakWhileMouseOn BrushToBGPic BrushToGray BrushToMonochrome BrushToPenArray BrushToRGBArray ByteAsc ByteChr ByteLen ByteOffset ByteStrStr ByteVal CallJavaMethod CancelAsyncDraw CancelAsyncOperation CanonizePath Cast Ceil ChangeApplicationIcon ChangeBrushTransparency ChangeDirectory ChangeDisplayMode ChangeDisplaySize ChangeInterval CharcoalBrush CharOffset CharWidth CheckEvent CheckEvents Chr Circle ClearClipboard ClearConsole ClearConsoleStyle ClearEvents ClearInterval ClearMove ClearObjectData ClearPath ClearScreen ClearSerialQueue ClearTimeout CloseAmigaGuide CloseAnim CloseAudio CloseCatalog CloseConnection CloseConsole CloseDirectory CloseDisplay CloseFile CloseFont CloseMusic ClosePath CloseResourceMonitor CloseSerialPort CloseServer CloseUDPObject CloseVideo Cls CollectGarbage Collision ColorRequest CompareDates CompareStr CompressFile Concat ConfigureJoystick ConsolePrint ConsolePrintChr ConsolePrintNR ConsolePrompt ContinueAsyncOperation ContrastBrush ContrastPalette ConvertStr ConvertToBrush CopyAnim CopyBGPic CopyBrush CopyConsoleWindow CopyFile CopyLayer CopyMem CopyObjectData CopyPalette CopyPath CopyPens CopySample CopySprite CopyTable CopyTextObject Cos CountDirectoryEntries CountJoysticks CountStr CRC32 CRC32Str CreateAnim CreateBGPic CreateBorderBrush CreateBrush CreateButton CreateClipRegion CreateConsoleWindow CreateCoroutine CreateDisplay CreateFont CreateGradientBGPic CreateGradientBrush CreateIcon CreateKeyDown CreateLayer CreateList CreateMenu CreateMusic CreatePalette CreatePointer CreatePort CreateRainbowBGPic CreateRexxPort CreateSample CreateServer CreateShadowBrush CreateShortcut CreateSprite CreateTextObject CreateTexturedBGPic CreateTexturedBrush CreateUDPObject CropBrush CtrlCQuit CurveTo CyclePalette DateToTimestamp DateToUTC DebugOutput DebugPrint DebugPrintNR DebugPrompt DebugStr DebugVal DecomposeConsoleChr DecompressFile DecreasePointer DefineVirtualFile DefineVirtualFileFromString Deg DeleteAlphaChannel DeleteButton DeleteConsoleChr DeleteConsoleLine DeleteFile DeleteMask DeletePrefs DeselectMenuItem DeserializeTable DirectoryItems DisableAdvancedConsole DisableButton DisableEvent DisableEventHandler DisableLayers DisableLineHook DisableMenuItem DisablePlugin DisablePrecalculation DisableVWait DisplayAnimFrame DisplayBGPic DisplayBGPicPart DisplayBGPicPartFX DisplayBrush DisplayBrushFX DisplayBrushPart DisplaySprite DisplayTextObject DisplayTextObjectFX DisplayTransitionFX DisplayVideoFrame Div DoMove DownloadFile DrawConsoleBorder DrawConsoleBox DrawConsoleHLine DrawConsoleVLine DrawPath DumpButtons DumpLayers DumpMem DumpVideo DumpVideoTime EdgeBrush Ellipse EmbossBrush EmptyStr EnableAdvancedConsole EnableButton EnableEvent EnableEventHandler EnableLayers EnableLineHook EnableMenuItem EnablePlugin EnablePrecalculation EnableVWait End EndDoubleBuffer EndianSwap EndRefresh EndSelect EndsWith Eof EraseConsole Error EscapeQuit Eval Execute Exists ExitOnError Exp ExtendBrush ExtractPalette FileAttributes FileLength FileLines FilePart FilePos FileRequest FileSize FileToString FillMem FillMusicBuffer FindStr FinishAnimStream FinishAsyncDraw FlashConsole Flip FlipBrush FlipSprite FloodFill Floor FlushFile FlushMusicBuffer FlushSerialPort FontRequest ForcePathUse ForceSound ForceVideoDriver ForceVideoMode ForEach ForEachI FormatConsoleLine FormatDate FormatNumber FormatStr Frac FreeAnim FreeBGPic FreeBrush FreeClipRegion FreeConsoleColor FreeConsoleWindow FreeDisplay FreeEventCache FreeGlyphCache FreeIcon FreeLayers FreeMem FreeMenu FreeModule FreePalette FreePath FreePointer FreeSample FreeSprite FreeTextObject FrExp FullPath GammaBrush GammaPalette GCInfo GetAllocConsoleColor GetAnimFrame GetApplicationInfo GetApplicationList GetAsset GetAttribute GetAvailableFonts GetBaudRate GetBestPen GetBrushLink GetBrushPen GetBulletColor GetCatalogString GetChannels GetCharMaps GetClipboard GetCommandLine GetConnectionIP GetConnectionPort GetConnectionProtocol GetConsoleBackground GetConsoleChr GetConsoleColor GetConsoleControlChr GetConsoleCursor GetConsoleOrigin GetConsoleSize GetConsoleStr GetConsoleStyle GetConsoleWindow GetConstant GetCoroutineStatus GetCountryInfo GetCurrentDirectory GetCurrentPoint GetDash GetDataBits GetDate GetDateNum GetDefaultAdapter GetDefaultEncoding GetDefaultLoader GetDirectoryEntry GetDisplayModes GetDTR GetEnv GetErrorName GetEventCode GetFileArgument GetFileAttributes GetFillRule GetFillStyle GetFlowControl GetFontColor GetFontStyle GetFormStyle GetFPSLimit GetFreePen GetFrontScreen GetHostName GetIconProperties GetItem GetKerningPair GetLanguageInfo GetLastError GetLayerAtPos GetLayerGroupMembers GetLayerGroups GetLayerPen GetLayerStyle GetLineCap GetLineJoin GetLineWidth GetLocaleInfo GetLocalInterfaces GetLocalIP GetLocalPort GetLocalProtocol GetMACAddress GetMemoryInfo GetMemPointer GetMemString GetMetaTable GetMiterLimit GetMonitors GetObjectData GetObjects GetObjectType GetPalettePen GetParity GetPathExtents GetPatternPosition GetPen GetPlugins GetProgramDirectory GetProgramInfo GetPubScreens GetRandomColor GetRandomFX GetRawArguments GetRealColor GetRTS GetSampleData GetSerializeMode GetShortcutPath GetSongPosition GetStartDirectory GetStopBits GetSystemCountry GetSystemInfo GetSystemLanguage GetTempFileName GetTime GetTimer GetTimestamp GetTimeZone GetType GetVersion GetVideoFrame GetVolumeInfo GetVolumeName GetWeekday Gosub Goto GrabDesktop Green GroupLayer HasItem HaveConsole HaveFreeChannel HaveItem HaveObject HaveObjectData HavePlugin HaveVolume HexStr HideConsoleCursor HideDisplay HideKeyboard HideLayer HideLayerFX HidePointer HideScreen Hypot IgnoreCase IIf ImageRequest IncreasePointer InitConsoleColor InKeyStr InsertConsoleChr InsertConsoleLine InsertConsoleStr InsertItem InsertLayer InsertSample InsertStr InstallEventHandler Int Intersection InvertAlphaChannel InvertBrush InvertMask InvertPalette IPairs IsAbsolutePath IsAlNum IsAlpha IsAnim IsAnimPlaying IsBrushEmpty IsChannelPlaying IsCntrl IsDigit IsDirectory IsFinite IsGraph IsInf IsKeyDown IsLeftMouse IsLower IsMenuItemDisabled IsMenuItemSelected IsMidMouse IsModule IsMusic IsMusicPlaying IsNan IsNil IsOnline IsPathEmpty IsPicture IsPrint IsPunct IsRightMouse IsSample IsSamplePlaying IsSound IsSpace IsTableEmpty IsUnicode IsUpper IsVideo IsVideoPlaying IsXDigit JoyAxisX JoyAxisY JoyAxisZ JoyButton JoyDir JoyFire Label JoyHat LayerExists LayerGroupExists LayerToBack LayerToFront Ld LdExp LeftMouseQuit LeftStr LegacyControl Limit Line LineTo ListItems ListRequest Ln LoadAnim LoadAnimFrame LoadBGPic LoadBrush LoadIcon LoadModule LoadPalette LoadPlugin LoadPrefs LoadSample LoadSprite Locate Log LowerStr MakeButton MakeConsoleChr MakeDate MakeDirectory MakeHostPath MatchPattern Matrix2D Max MD5 MD5Str MemToTable MergeLayers MidStr Min MixBrush MixRGB MixSample Mod ModifyAnimFrames ModifyButton ModifyKeyDown ModifyLayerFrames ModulateBrush ModulatePalette MonitorDirectory MouseX MouseY MoveAnim MoveBrush MoveConsoleWindow MoveDisplay MoveFile MoveLayer MovePointer MoveSprite MoveTextObject MoveTo Mul NearlyEqual NextDirectoryEntry NextFrame NextItem NormalizePath NPrint OilPaintBrush OpenAmigaGuide OpenAnim OpenAudio OpenCatalog OpenConnection OpenConsole OpenDirectory OpenDisplay OpenFile OpenFont OpenMusic OpenResourceMonitor OpenSerialPort OpenURL OpenVideo Pack PadNum Pairs PaletteToGray ParseDate PathItems PathPart PathRequest PathToBrush PatternFindStr PatternFindStrDirect PatternFindStrShort PatternReplaceStr PauseLayer PauseModule PauseMusic PauseTimer PauseVideo Peek PeekClipboard PenArrayToBrush PerformSelector PermissionRequest PerspectiveDistortBrush Pi PixelateBrush PlayAnim PlayAnimDisk PlayLayer PlayModule PlayMusic PlaySample PlaySubsong PlayVideo Plot Poke PolarDistortBrush PollSerialQueue Polygon PopupMenu Pow Print QuantizeBrush Rad RaiseOnError RasterizeBrush RawDiv RawEqual RawGet RawSet ReadBrushPixel ReadByte ReadBytes ReadChr ReadConsoleKey ReadConsoleStr ReadDirectory ReadFloat ReadFunction ReadInt ReadLine ReadMem ReadPen ReadPixel ReadRegistryKey ReadSerialData ReadShort ReadString ReadTable ReceiveData ReceiveUDPData Red ReduceAlphaChannel RefreshConsole RefreshDisplay RefreshLayer RelCurveTo RelLineTo RelMoveTo RemapBrush RemoveBrushPalette RemoveButton RemoveIconImage RemoveItem RemoveKeyDown RemoveLayer RemoveLayerFX RemoveLayers RemoveSprite RemoveSprites Rename RenderLayer RepeatStr ReplaceColors ReplaceStr ResetKeyStates ResetTabs ResetTimer ResolveHostName ResumeCoroutine ResumeLayer ResumeModule ResumeMusic ResumeTimer ResumeVideo ReverseFindStr ReverseStr RewindDirectory RGB RGBArrayToBrush RightStr Rnd RndF RndStrong Rol Ror RotateBrush RotateLayer RotateTextObject Round Rt Run RunCallback RunRexxScript Sar SaveAnim SaveBrush SaveIcon SavePalette SavePrefs SaveSample SaveSnapshot ScaleAnim ScaleBGPic ScaleBrush ScaleLayer ScaleSprite ScaleTextObject ScrollConsole Seek SeekLayer SeekMusic SeekVideo SelectAlphaChannel SelectAnim SelectBGPic SelectBrush SelectConsoleWindow SelectDisplay SelectLayer SelectMask SelectMenuItem SelectPalette SendApplicationMessage SendData SendMessage SendRexxCommand SendUDPData SepiaToneBrush SerializeTable SetAllocConsoleColor SetAlphaIntensity SetAnimFrameDelay SetAttribute SetBaudRate SetBorderPen SetBrushDepth SetBrushPalette SetBrushPen SetBrushTransparency SetBrushTransparentPen SetBulletColor SetBulletPen SetChannelVolume SetClipboard SetClipRegion SetConsoleBackground SetConsoleColor SetConsoleCursor SetConsoleOptions SetConsoleStyle SetConsoleTitle SetCycleTable SetDash SetDataBits SetDefaultAdapter SetDefaultEncoding SetDefaultLoader SetDepth SetDisplayAttributes SetDitherMode SetDrawPen SetDrawTagsDefault SetDTR SetEnv SetEventTimeout SetFileAttributes SetFileEncoding SetFillRule SetFillStyle SetFlowControl SetFont SetFontColor SetFontStyle SetFormStyle SetFPSLimit SetGradientPalette SetIconProperties SetInterval SetIOMode SetLayerAnchor SetLayerBorder SetLayerDepth SetLayerFilter SetLayerLight SetLayerName SetLayerPalette SetLayerPen SetLayerShadow SetLayerStyle SetLayerTint SetLayerTransparency SetLayerTransparentPen SetLayerVolume SetLayerZPos SetLineCap SetLineJoin SetLineWidth SetListItems SetMargins SetMaskMode SetMasterVolume SetMetaTable SetMiterLimit SetMusicVolume SetNetworkProtocol SetNetworkTimeout SetObjectData SetPalette SetPaletteDepth SetPaletteMode SetPalettePen SetPaletteTransparentPen SetPanning SetParity SetPen SetPitch SetPointer SetRTS SetScreenTitle SetSerializeMode SetSerializeOptions SetShadowPen SetSpriteZPos SetStandardIconImage SetStandardPalette SetStopBits SetSubtitle SetTimeout SetTimerElapse SetTitle SetTransparentPen SetTransparentThreshold SetTrayIcon SetVarType SetVectorEngine SetVideoPosition SetVideoSize SetVideoVolume SetVolume SetWBIcon Sgn SharpenBrush Shl ShowConsoleCursor ShowDisplay ShowKeyboard ShowLayer ShowLayerFX ShowNotification ShowPointer ShowRinghioMessage ShowScreen ShowToast Shr Sin Sleep SolarizeBrush SolarizePalette Sort SplitStr Sqrt StartConsoleColorMode StartPath StartSubPath StartsWith StartTimer StopAnim StopChannel StopLayer StopModule StopMusic StopSample StopTimer StopVideo StringRequest StringToFile StripStr StrLen StrStr StrToArray Sub SwapLayers SwirlBrush SystemRequest TableItems TableToMem Tan TextExtent TextHeight TextOut TextWidth TimerElapsed TimestampToDate TintBrush TintPalette ToHostName ToIP ToNumber ToString TouchConsoleWindow ToUserData TransformBox TransformBrush TransformLayer TransformPoint TransformTextObject TranslateLayer TranslatePath TrimBrush TrimStr UndefineVirtualStringFile Undo UndoFX UngroupLayer UnleftStr UnmidStr Unpack UnrightStr UnsetEnv UploadFile UpperStr Usage UseCarriageReturn UseFont UTCToDate Val ValidateDate ValidateStr Vibrate VWait Wait WaitAnimEnd WaitEvent WaitKeyDown WaitLeftMouse WaitMidMouse WaitMusicEnd WaitPatternPosition WaitRightMouse WaitSampleEnd WaitSongPosition WaitTimer WaterRippleBrush WhileKeyDown WhileMouseDown WhileMouseOn WhileRightMouseDown Wrap WriteAnimFrame WriteBrushPixel WriteByte WriteBytes WriteChr WriteFloat WriteFunction WriteInt WriteLine WriteMem WritePen WriteRegistryKey WriteSerialData WriteShort WriteString WriteTable YieldCoroutine
" user-defined constants
-syn match hwUserConstant "#\<\u\+\>"
+syn match hwUserConstant "#\<\(\u\|_\|-\|\d\)\+\>\$\?"
" user-defined functions
syn match hwUserFunction "\<p_\w\{-1,}\>("me=e-1
diff --git a/runtime/syntax/html.vim b/runtime/syntax/html.vim
index c975ae8620..ca7c7f1cdd 100644
--- a/runtime/syntax/html.vim
+++ b/runtime/syntax/html.vim
@@ -4,6 +4,7 @@
" Previous Maintainers: Jorge Maldonado Ventura <jorgesumle@freakspot.net>
" Claudio Fleiner <claudio@fleiner.com>
" Last Change: 2023 Nov 28
+" 2024 Jul 30 by Vim Project: increase syn-sync-minlines to 250
" See :help html.vim for some comments and a description of the options
@@ -191,7 +192,7 @@ syn keyword htmlArg contained step title translate typemustmatch
syn match htmlArg contained "\<data-\h\%(\w\|[-.]\)*\%(\_s*=\)\@="
" special characters
-syn match htmlSpecialChar "&#\=[0-9A-Za-z]\{1,8};"
+syn match htmlSpecialChar "&#\=[0-9A-Za-z]\{1,32};"
" Comments (the real ones or the old netscape ones)
if exists("html_wrong_comments")
@@ -320,7 +321,7 @@ if main_syntax == "html"
syn sync match htmlHighlight groupthere NONE "<[/a-zA-Z]"
syn sync match htmlHighlight groupthere javaScript "<script"
syn sync match htmlHighlightSkip "^.*['\"].*$"
- syn sync minlines=10
+ exe "syn sync minlines=" . get(g:, 'html_minlines', 250)
endif
" Folding
diff --git a/runtime/syntax/htmlangular.vim b/runtime/syntax/htmlangular.vim
new file mode 100644
index 0000000000..021e61f9b1
--- /dev/null
+++ b/runtime/syntax/htmlangular.vim
@@ -0,0 +1,18 @@
+" Vim syntax file
+" Language: Angular HTML template
+" Maintainer: Dennis van den Berg <dennis@vdberg.dev>
+" Last Change: 2024 Aug 22
+
+" quit when a syntax file was already loaded
+if exists("b:current_syntax")
+ finish
+endif
+
+if !exists("main_syntax")
+ let main_syntax = 'html'
+endif
+
+runtime! syntax/html.vim
+unlet b:current_syntax
+
+let b:current_syntax = "htmlangular"
diff --git a/runtime/syntax/i3config.vim b/runtime/syntax/i3config.vim
index f4d789e418..c95cb879ad 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.2.3
-" Last Change: 2024-05-23
+" Version: 1.2.4
+" Last Change: 2024-05-24
" References:
" http://i3wm.org/docs/userguide.html#configuring
@@ -67,7 +67,7 @@ syn keyword i3ConfigBindKeyword bindsym bindcode contained skipwhite nextgroup=i
syn region i3ConfigModeBlock matchgroup=i3ConfigKeyword start=/mode\ze\( --pango_markup\)\? \([^'" {]\+\|'[^']\+'\|".\+"\)\s\+{$/ end=/^}\zs$/ contained contains=i3ConfigShParam,@i3ConfigStrVar,i3ConfigBindKeyword,i3ConfigComment,i3ConfigParen fold keepend extend
" 4.7 Floating modifier
-syn match i3ConfigKeyword /^floating_modifier [$0-9A-Za-z]*$/ contains=i3ConfigVariable,i3ConfigBindModkey
+syn match i3ConfigKeyword /floating_modifier [$A-Z][0-9A-Za-z]*$/ contained contains=i3ConfigVariable,i3ConfigBindModkey
" 4.8 Floating window size
syn keyword i3ConfigSizeSpecial x contained
diff --git a/runtime/syntax/idlang.vim b/runtime/syntax/idlang.vim
index 14e976ce05..f7bfcb203a 100644
--- a/runtime/syntax/idlang.vim
+++ b/runtime/syntax/idlang.vim
@@ -1,7 +1,8 @@
" Interactive Data Language syntax file (IDL, too [:-)]
" Maintainer: Aleksandar Jelenak <ajelenak AT yahoo.com>
-" Last change: 2011 Apr 11
-" Created by: Hermann Rochholz <Hermann.Rochholz AT gmx.de>
+" Created By: Hermann Rochholz <Hermann.Rochholz AT gmx.de>
+" Last Change: 2011 Apr 11
+" 2024 Sep 10 by Vim Project: update syntax script, #15419
" Remove any old syntax stuff hanging around
" quit when a syntax file was already loaded
@@ -16,7 +17,7 @@ syn match idlangStatement "^\s*function\s"
syn keyword idlangStatement return continue mod do break
syn keyword idlangStatement compile_opt forward_function goto
syn keyword idlangStatement begin common end of
-syn keyword idlangStatement inherits on_ioerror begin
+syn keyword idlangStatement inherits on_error on_ioerror begin
syn keyword idlangConditional if else then for while case switch
syn keyword idlangConditional endcase endelse endfor endswitch
@@ -82,7 +83,7 @@ syn keyword idlangRoutine CALL_EXTERNAL CALL_FUNCTION CALL_METHOD
syn keyword idlangRoutine CALL_PROCEDURE CATCH CD CEIL CHEBYSHEV CHECK_MATH
syn keyword idlangRoutine CHISQR_CVF CHISQR_PDF CHOLDC CHOLSOL CINDGEN
syn keyword idlangRoutine CIR_3PNT CLOSE CLUST_WTS CLUSTER COLOR_CONVERT
-syn keyword idlangRoutine COLOR_QUAN COLORMAP_APPLICABLE COMFIT COMMON
+syn keyword idlangRoutine COLOR_QUAN COLORMAP_APPLICABLE COMFIT
syn keyword idlangRoutine COMPLEX COMPLEXARR COMPLEXROUND
syn keyword idlangRoutine COMPUTE_MESH_NORMALS COND CONGRID CONJ
syn keyword idlangRoutine CONSTRAINED_MIN CONTOUR CONVERT_COORD CONVOL
@@ -98,7 +99,7 @@ syn keyword idlangRoutine CW_PALETTE_EDITOR_GET CW_PALETTE_EDITOR_SET
syn keyword idlangRoutine CW_PDMENU CW_RGBSLIDER CW_TMPL CW_ZOOM DBLARR
syn keyword idlangRoutine DCINDGEN DCOMPLEX DCOMPLEXARR DEFINE_KEY DEFROI
syn keyword idlangRoutine DEFSYSV DELETE_SYMBOL DELLOG DELVAR DERIV DERIVSIG
-syn keyword idlangRoutine DETERM DEVICE DFPMIN DIALOG_MESSAGE
+syn keyword idlangRoutine DETERM DEVICE DFPMIN DIAG_MATRIX DIALOG_MESSAGE
syn keyword idlangRoutine DIALOG_PICKFILE DIALOG_PRINTERSETUP
syn keyword idlangRoutine DIALOG_PRINTJOB DIALOG_READ_IMAGE
syn keyword idlangRoutine DIALOG_WRITE_IMAGE DIGITAL_FILTER DILATE DINDGEN
@@ -155,7 +156,7 @@ syn keyword idlangRoutine MPEG_PUT MPEG_SAVE MSG_CAT_CLOSE MSG_CAT_COMPILE
syn keyword idlangRoutine MSG_CAT_OPEN MULTI N_ELEMENTS N_PARAMS N_TAGS
syn keyword idlangRoutine NEWTON NORM OBJ_CLASS OBJ_DESTROY OBJ_ISA OBJ_NEW
syn keyword idlangRoutine OBJ_VALID OBJARR ON_ERROR ON_IOERROR ONLINE_HELP
-syn keyword idlangRoutine OPEN OPENR OPENW OPLOT OPLOTERR P_CORRELATE
+syn keyword idlangRoutine OPEN OPENR OPENW OPENU OPLOT OPLOTERR P_CORRELATE
syn keyword idlangRoutine PARTICLE_TRACE PCOMP PLOT PLOT_3DBOX PLOT_FIELD
syn keyword idlangRoutine PLOTERR PLOTS PNT_LINE POINT_LUN POLAR_CONTOUR
syn keyword idlangRoutine POLAR_SURFACE POLY POLY_2D POLY_AREA POLY_FIT
diff --git a/runtime/syntax/indent.vim b/runtime/syntax/indent.vim
index b2a1a0c85f..921a0a8ad0 100644
--- a/runtime/syntax/indent.vim
+++ b/runtime/syntax/indent.vim
@@ -2,7 +2,7 @@
" Language: indent(1) configuration file
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Last Change: 2021 Nov 17
+" Last Change: 2024 Sep 29
" indent_is_bsd: If exists, will change somewhat to match BSD implementation
"
" TODO: is the deny-all (a la lilo.vim nice or no?)...
@@ -34,7 +34,7 @@ endif
syn match indentOptions '-\%(bli\|c\%([bl]i\|[dip]\)\=\|di\=\|ip\=\|lc\=\|pp\=i\|sbi\|ts\|-\%(brace-indent\|comment-indentation\|case-brace-indentation\|declaration-comment-column\|continuation-indentation\|case-indentation\|else-endif-column\|line-comments-indentation\|declaration-indentation\|indent-level\|parameter-indentation\|line-length\|comment-line-length\|paren-indentation\|preprocessor-indentation\|struct-brace-indentation\|tab-size\)\)'
\ nextgroup=indentNumber skipwhite skipempty
-syn match indentNumber display contained '\d\+\>'
+syn match indentNumber display contained '-\=\d\+\>'
syn match indentOptions '-T'
\ nextgroup=indentIdent skipwhite skipempty
diff --git a/runtime/syntax/java.vim b/runtime/syntax/java.vim
index 9867b147c2..307fc26349 100644
--- a/runtime/syntax/java.vim
+++ b/runtime/syntax/java.vim
@@ -3,18 +3,33 @@
" Maintainer: Aliaksei Budavei <0x000c70 AT gmail DOT com>
" Former Maintainer: Claudio Fleiner <claudio@fleiner.com>
" Repository: https://github.com/zzzyxwvut/java-vim.git
-" Last Change: 2024 May 10
+" Last Change: 2024 Oct 03
-" Please check :help java.vim for comments on some of the options available.
+" Please check ":help java.vim" for comments on some of the options
+" available.
-" quit when a syntax file was already loaded
-if !exists("main_syntax")
- if exists("b:current_syntax")
- finish
+" Do not aggregate syntax items from circular inclusion.
+if exists("b:current_syntax")
+ finish
+endif
+
+if exists("g:main_syntax")
+ " Reject attendant circularity for every :syn-included syntax file,
+ " but ACCEPT FAILURE when "g:main_syntax" is set to "java".
+ if g:main_syntax == 'html'
+ if !exists("g:java_ignore_html")
+ let g:java_ignore_html = 1
+ let s:clear_java_ignore_html = 1
+ endif
+ elseif g:main_syntax == 'markdown'
+ if !exists("g:java_ignore_markdown")
+ let g:java_ignore_markdown = 1
+ let s:clear_java_ignore_markdown = 1
+ endif
endif
- " we define it here so that included files can test for it
- let main_syntax='java'
- syn region javaFold start="{" end="}" transparent fold
+else
+ " Allow syntax files that include this file test for its inclusion.
+ let g:main_syntax = 'java'
endif
let s:cpo_save = &cpo
@@ -31,6 +46,10 @@ function! s:ff.RightConstant(x, y) abort
return a:y
endfunction
+function! s:ff.IsRequestedPreviewFeature(n) abort
+ return exists("g:java_syntax_previews") && index(g:java_syntax_previews, a:n) + 1
+endfunction
+
if !exists("*s:ReportOnce")
function s:ReportOnce(message) abort
echomsg 'syntax/java.vim: ' . a:message
@@ -40,6 +59,28 @@ else
endfunction
endif
+if exists("g:java_foldtext_show_first_or_second_line")
+ function! s:LazyPrefix(prefix, dashes, count) abort
+ return empty(a:prefix)
+ \ ? printf('+-%s%3d lines: ', a:dashes, a:count)
+ \ : a:prefix
+ endfunction
+
+ function! JavaSyntaxFoldTextExpr() abort
+ " Piggyback on NGETTEXT.
+ let summary = foldtext()
+ return getline(v:foldstart) !~ '/\*\+\s*$'
+ \ ? summary
+ \ : s:LazyPrefix(matchstr(summary, '^+-\+\s*\d\+\s.\{-1,}:\s'),
+ \ v:folddashes,
+ \ (v:foldend - v:foldstart + 1)) .
+ \ getline(v:foldstart + 1)
+ endfunction
+
+ " E120 for "fdt=s:JavaSyntaxFoldTextExpr()" before v8.2.3900.
+ setlocal foldtext=JavaSyntaxFoldTextExpr()
+endif
+
" Admit the ASCII dollar sign to keyword characters (JLS-17, §3.8):
try
exec 'syntax iskeyword ' . &l:iskeyword . ',$'
@@ -54,7 +95,6 @@ syn match javaError "<<<\|\.\.\|=>\|||=\|&&=\|\*\/"
" use separate name so that it can be deleted in javacc.vim
syn match javaError2 "#\|=<"
-hi def link javaError2 javaError
" Keywords (JLS-17, §3.9):
syn keyword javaExternal native package
@@ -68,6 +108,13 @@ syn keyword javaTypedef this super
syn keyword javaOperator new instanceof
syn match javaOperator "\<var\>\%(\s*(\)\@!"
+if s:ff.IsRequestedPreviewFeature(476)
+ " Module imports can be used in any source file.
+ syn match javaExternal "\<import\s\+module\>" contains=javaModuleImport
+ syn keyword javaModuleImport contained module
+ hi def link javaModuleImport Statement
+endif
+
" 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
@@ -76,18 +123,18 @@ syn match javaOperator "\<var\>\%(\s*(\)\@!"
" if necessary, on the line before that (h: \@<=), trying to match
" neither a method reference nor a qualified method invocation.
try
- syn match javaOperator "\%(\%(::\|\.\)[[:space:]\n]*\)\@80<!\<yield\>"
+ syn match javaOperator "\%(\%(::\|\.\)[[:space:]\n]*\)\@80<!\<yield\>"
let s:ff.Peek = s:ff.LeftConstant
catch /\<E59:/
call s:ReportOnce(v:exception)
- syn match javaOperator "\%(\%(::\|\.\)[[:space:]\n]*\)\@<!\<yield\>"
+ syn match javaOperator "\%(\%(::\|\.\)[[:space:]\n]*\)\@<!\<yield\>"
let s:ff.Peek = s:ff.RightConstant
endtry
syn keyword javaType boolean char byte short int long float double
syn keyword javaType void
syn keyword javaStatement return
-syn keyword javaStorageClass static synchronized transient volatile strictfp serializable
+syn keyword javaStorageClass static synchronized transient volatile strictfp
syn keyword javaExceptions throw try catch finally
syn keyword javaAssert assert
syn keyword javaMethodDecl throws
@@ -99,9 +146,10 @@ syn match javaClassDecl "\<record\>\%(\s*(\)\@!"
syn match javaClassDecl "^class\>"
syn match javaClassDecl "[^.]\s*\<class\>"ms=s+1
syn match javaAnnotation "@\%(\K\k*\.\)*\K\k*\>"
+syn region javaAnnotation transparent matchgroup=javaAnnotationStart start=/@\%(\K\k*\.\)*\K\k*(/ end=/)/ skip=/\/\*.\{-}\*\/\|\/\/.*$/ contains=javaAnnotation,javaParenT,javaBlock,javaString,javaBoolean,javaNumber,javaTypedef,javaComment,javaLineComment
syn match javaClassDecl "@interface\>"
syn keyword javaBranch break continue nextgroup=javaUserLabelRef skipwhite
-syn match javaUserLabelRef "\k\+" contained
+syn match javaUserLabelRef contained "\k\+"
syn match javaVarArg "\.\.\."
syn keyword javaScopeDecl public protected private
syn keyword javaConceptKind abstract final
@@ -109,15 +157,6 @@ syn match javaConceptKind "\<non-sealed\>"
syn match javaConceptKind "\<sealed\>\%(\s*(\)\@!"
syn match javaConceptKind "\<default\>\%(\s*\%(:\|->\)\)\@!"
-" Note that a "module-info" file will be recognised with an arbitrary
-" file extension (or no extension at all) so that more than one such
-" declaration for the same Java module can be maintained for modular
-" testing in a project without attendant confusion for IDEs, with the
-" ".java\=" extension used for a production version and an arbitrary
-" extension used for a testing version.
-let s:module_info_cur_buf = fnamemodify(bufname("%"), ":t") =~ '^module-info\%(\.class\>\)\@!'
-lockvar s:module_info_cur_buf
-
if !(v:version < 704)
" Request the new regexp engine for [:upper:] and [:lower:].
let [s:ff.Engine, s:ff.UpperCase, s:ff.LowerCase] = repeat([s:ff.LeftConstant], 3)
@@ -127,17 +166,68 @@ else
let [s:ff.Engine, s:ff.UpperCase, s:ff.LowerCase] = repeat([s:ff.RightConstant], 3)
endif
-" Java modules (since Java 9, for "module-info.java" file).
-if s:module_info_cur_buf
+if exists("g:java_highlight_signature")
+ let [s:ff.PeekTo, s:ff.PeekFrom, s:ff.GroupArgs] = repeat([s:ff.LeftConstant], 3)
+else
+ let [s:ff.PeekTo, s:ff.PeekFrom, s:ff.GroupArgs] = repeat([s:ff.RightConstant], 3)
+endif
+
+let s:with_html = !exists("g:java_ignore_html")
+let s:with_markdown = !exists("g:java_ignore_markdown")
+lockvar s:with_html s:with_markdown
+
+" Java module declarations (JLS-17, §7.7).
+"
+" Note that a "module-info" file will be recognised with an arbitrary
+" file extension (or no extension at all) so that more than one such
+" declaration for the same Java module can be maintained for modular
+" testing in a project without attendant confusion for IDEs, with the
+" ".java\=" extension used for a production version and an arbitrary
+" extension used for a testing version.
+if fnamemodify(bufname("%"), ":t") =~ '^module-info\>\%(\.class\>\)\@!'
syn keyword javaModuleStorageClass module transitive
syn keyword javaModuleStmt open requires exports opens uses provides
syn keyword javaModuleExternal to with
+ hi def link javaModuleStorageClass StorageClass
+ hi def link javaModuleStmt Statement
+ hi def link javaModuleExternal Include
+
+ if !exists("g:java_ignore_javadoc") && (s:with_html || s:with_markdown) && g:main_syntax != 'jsp'
+ syn match javaDocProvidesTag contained "@provides\_s\+\S\+" contains=javaDocParam
+ syn match javaDocUsesTag contained "@uses\_s\+\S\+" contains=javaDocParam
+ hi def link javaDocProvidesTag Special
+ hi def link javaDocUsesTag Special
+ endif
+endif
+
+" Fancy parameterised types (JLS-17, §4.5).
+"
+" Note that false positives may elsewhere occur whenever an identifier
+" is butted against a less-than operator. Cf. (X<Y) and (X < Y).
+if exists("g:java_highlight_generics")
+ syn keyword javaWildcardBound contained extends super
+
+ " Parameterised types are delegated to javaGenerics (s:ctx.gsg) and
+ " are not matched with javaTypeArgument.
+ exec 'syn match javaTypeArgument contained "' . s:ff.Engine('\%#=2', '') . '?\|\%(\<\%(b\%(oolean\|yte\)\|char\|short\|int\|long\|float\|double\)\[\]\|\%(\<\K\k*\>\.\)*\<' . s:ff.UpperCase('[$_[:upper:]]', '[^a-z0-9]') . '\k*\>\)\%(\[\]\)*"'
+
+ for s:ctx in [{'dsg': 'javaDimExpr', 'gsg': 'javaGenerics', 'ghg': 'javaGenericsC1', 'csg': 'javaGenericsX', 'c': ''},
+ \ {'dsg': 'javaDimExprX', 'gsg': 'javaGenericsX', 'ghg': 'javaGenericsC2', 'csg': 'javaGenerics', 'c': ' contained'}]
+ " Consider array creation expressions of reifiable types.
+ exec 'syn region ' . s:ctx.dsg . ' contained transparent matchgroup=' . s:ctx.ghg . ' start="\[" end="\]" nextgroup=' . s:ctx.dsg . ' skipwhite skipnl'
+ exec 'syn region ' . s:ctx.gsg . s:ctx.c . ' transparent matchgroup=' . s:ctx.ghg . ' start=/' . s:ff.Engine('\%#=2', '') . '\%(\<\K\k*\>\.\)*\<' . s:ff.UpperCase('[$_[:upper:]]', '[^a-z0-9]') . '\k*\><\%([[:space:]\n]*\%([?@]\|\<\%(b\%(oolean\|yte\)\|char\|short\|int\|long\|float\|double\)\[\]\|\%(\<\K\k*\>\.\)*\<' . s:ff.UpperCase('[$_[:upper:]]', '[^a-z0-9]') . '\k*\>\)\)\@=/ end=/>/ contains=' . s:ctx.csg . ',javaAnnotation,javaTypeArgument,javaWildcardBound,javaType,@javaClasses nextgroup=' . s:ctx.dsg . ' skipwhite skipnl'
+ endfor
+
+ unlet s:ctx
+ hi def link javaWildcardBound Question
+ hi def link javaGenericsC1 Function
+ hi def link javaGenericsC2 Type
endif
-if exists("java_highlight_java_lang_ids")
- let java_highlight_all=1
+if exists("g:java_highlight_java_lang_ids")
+ let g:java_highlight_all = 1
endif
-if exists("java_highlight_all") || exists("java_highlight_java") || exists("java_highlight_java_lang")
+if exists("g:java_highlight_all") || exists("g:java_highlight_java") || exists("g:java_highlight_java_lang")
" java.lang.*
"
" The keywords of javaR_JavaLang, javaC_JavaLang, javaE_JavaLang,
@@ -163,9 +253,15 @@ if exists("java_highlight_all") || exists("java_highlight_java") || exists("ja
exec 'syn match javaC_JavaLang "\%(\<ModuleLayer\.\)\@' . s:ff.Peek('12', '') . '<=\<Controller\>"'
exec 'syn match javaC_JavaLang "\%(\<Runtime\.\)\@' . s:ff.Peek('8', '') . '<=\<Version\>"'
exec 'syn match javaC_JavaLang "\%(\<System\.\)\@' . s:ff.Peek('7', '') . '<=\<LoggerFinder\>"'
- exec 'syn match javaC_JavaLang "\%(\<Enum\.\)\@' . s:ff.Peek('5', '') . '<=\<EnumDesc\>"'
- syn keyword javaC_JavaLang Boolean Character Class ClassLoader Compiler Double Float Integer Long Math Number Object Process Runtime SecurityManager String StringBuffer Thread ThreadGroup Byte Short Void InheritableThreadLocal Package RuntimePermission ThreadLocal StrictMath StackTraceElement Enum ProcessBuilder StringBuilder ClassValue Module ModuleLayer StackWalker Record
+ syn keyword javaC_JavaLang Boolean Character ClassLoader Compiler Double Float Integer Long Math Number Object Process Runtime SecurityManager String StringBuffer Thread ThreadGroup Byte Short Void Package RuntimePermission StrictMath StackTraceElement ProcessBuilder StringBuilder Module ModuleLayer StackWalker Record
syn match javaC_JavaLang "\<System\>" " See javaDebug.
+
+ if !exists("g:java_highlight_generics")
+ " The non-interface parameterised names of java.lang members.
+ exec 'syn match javaC_JavaLang "\%(\<Enum\.\)\@' . s:ff.Peek('5', '') . '<=\<EnumDesc\>"'
+ syn keyword javaC_JavaLang Class InheritableThreadLocal ThreadLocal Enum ClassValue
+ endif
+
" As of JDK 21, java.lang.Compiler is no more (deprecated in JDK 9).
syn keyword javaLangDeprecated Compiler
syn cluster javaClasses add=javaC_JavaLang
@@ -181,55 +277,68 @@ if exists("java_highlight_all") || exists("java_highlight_java") || exists("ja
hi def link javaC_Java javaC_
hi def link javaE_Java javaE_
hi def link javaX_Java javaX_
- hi def link javaX_ javaExceptions
- hi def link javaR_ javaExceptions
- hi def link javaE_ javaExceptions
- hi def link javaC_ javaConstant
-
- syn keyword javaLangObject clone equals finalize getClass hashCode
- syn keyword javaLangObject notify notifyAll toString wait
- hi def link javaLangObject javaConstant
+ hi def link javaX_ javaExceptions
+ hi def link javaR_ javaExceptions
+ hi def link javaE_ javaExceptions
+ hi def link javaC_ javaConstant
+
+ syn keyword javaLangObject getClass notify notifyAll wait
+
+ " Lower the syntax priority of overridable java.lang.Object method
+ " names for zero-width matching (define g:java_highlight_signature
+ " and see their base declarations for java.lang.Object):
+ syn match javaLangObject "\<clone\>"
+ syn match javaLangObject "\<equals\>"
+ syn match javaLangObject "\<finalize\>"
+ syn match javaLangObject "\<hashCode\>"
+ syn match javaLangObject "\<toString\>"
+ hi def link javaLangObject javaConstant
endif
if filereadable(expand("<sfile>:p:h") . "/javaid.vim")
source <sfile>:p:h/javaid.vim
endif
-if exists("java_space_errors")
- if !exists("java_no_trail_space_error")
- syn match javaSpaceError "\s\+$"
+if exists("g:java_space_errors")
+ if !exists("g:java_no_trail_space_error")
+ syn match javaSpaceError "\s\+$"
endif
- if !exists("java_no_tab_space_error")
- syn match javaSpaceError " \+\t"me=e-1
+ if !exists("g:java_no_tab_space_error")
+ syn match javaSpaceError " \+\t"me=e-1
endif
+ hi def link javaSpaceError Error
+endif
+
+exec 'syn match javaUserLabel "^\s*\<\K\k*\>\%(\<default\>\)\@' . s:ff.Peek('7', '') . '<!\s*::\@!"he=e-1'
+
+if s:ff.IsRequestedPreviewFeature(455)
+ syn region javaLabelRegion transparent matchgroup=javaLabel start="\<case\>" matchgroup=NONE end=":\|->" contains=javaBoolean,javaNumber,javaCharacter,javaString,javaConstant,@javaClasses,javaGenerics,javaType,javaLabelDefault,javaLabelVarType,javaLabelWhenClause
+else
+ syn region javaLabelRegion transparent matchgroup=javaLabel start="\<case\>" matchgroup=NONE end=":\|->" contains=javaLabelCastType,javaLabelNumber,javaCharacter,javaString,javaConstant,@javaClasses,javaGenerics,javaLabelDefault,javaLabelVarType,javaLabelWhenClause
+ syn keyword javaLabelCastType contained char byte short int
+ 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 javaLabelCastType javaType
+ hi def link javaLabelNumber javaNumber
endif
-exec 'syn match javaUserLabel "^\s*\<\K\k*\>\%(\<default\>\)\@' . s:ff.Peek('7', '') . '<!\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
+syn region javaLabelWhenClause contained transparent matchgroup=javaLabel start="\<when\>" matchgroup=NONE end=":"me=e-1 end="->"me=e-2 contains=TOP,javaExternal,javaLambdaDef
" Comments
-syn keyword javaTodo contained TODO FIXME XXX
+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 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
+if exists("g:java_comment_strings")
+ syn region javaCommentString contained start=+"+ end=+"+ end=+$+ end=+\*/+me=s-1,he=s-1 contains=javaSpecial,javaCommentStar,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 "'[^\\]'"
@@ -237,27 +346,65 @@ if exists("java_comment_strings")
syn cluster javaCommentSpecial2 add=javaComment2String,javaCommentCharacter,javaNumber,javaStrTempl
endif
-syn region javaComment matchgroup=javaCommentStart start="/\*" end="\*/" contains=@javaCommentSpecial,javaTodo,javaCommentError,javaSpaceError,@Spell
-syn match javaCommentStar contained "^\s*\*[^/]"me=e-1
-syn match javaCommentStar contained "^\s*\*$"
+syn region javaComment matchgroup=javaCommentStart start="/\*" end="\*/" contains=@javaCommentSpecial,javaTodo,javaCommentError,javaSpaceError,@Spell fold
+syn match javaCommentStar contained "^\s*\*[^/]"me=e-1
+syn match javaCommentStar contained "^\s*\*$"
syn match javaLineComment "//.*" contains=@javaCommentSpecial2,javaTodo,javaCommentMarkupTag,javaSpaceError,@Spell
syn match javaCommentMarkupTag contained "@\%(end\|highlight\|link\|replace\|start\)\>" nextgroup=javaCommentMarkupTagAttr,javaSpaceError skipwhite
syn match javaCommentMarkupTagAttr contained "\<region\>" nextgroup=javaCommentMarkupTagAttr,javaSpaceError skipwhite
-exec 'syn region javaCommentMarkupTagAttr contained transparent matchgroup=htmlArg start=/\<\%(re\%(gex\|gion\|placement\)\|substring\|t\%(arget\|ype\)\)\%(\s*=\)\@=/ matchgroup=htmlString end=/\%(=\s*\)\@' . s:ff.Peek('80', '') . '<=\%("[^"]\+"\|' . "\x27[^\x27]\\+\x27" . '\|\%([.-]\|\k\)\+\)/ nextgroup=javaCommentMarkupTagAttr,javaSpaceError skipwhite oneline'
-hi def link javaCommentMarkupTagAttr htmlArg
-hi def link javaCommentString javaString
-hi def link javaComment2String javaString
-hi def link javaCommentCharacter javaCharacter
+exec 'syn region javaCommentMarkupTagAttr contained transparent matchgroup=javaHtmlArg start=/\<\%(re\%(gex\|gion\|placement\)\|substring\|t\%(arget\|ype\)\)\%(\s*=\)\@=/ matchgroup=javaHtmlString end=/\%(=\s*\)\@' . s:ff.Peek('80', '') . '<=\%("[^"]\+"\|' . "\x27[^\x27]\\+\x27" . '\|\%([.-]\|\k\)\+\)/ nextgroup=javaCommentMarkupTagAttr,javaSpaceError skipwhite oneline'
syn match javaCommentError contained "/\*"me=e-1 display
-hi def link javaCommentError javaError
-hi def link javaCommentStart javaComment
-if !exists("java_ignore_javadoc") && main_syntax != 'jsp'
+if !exists("g:java_ignore_javadoc") && (s:with_html || s:with_markdown) && g:main_syntax != 'jsp'
+ " The overridable "html*" and "markdown*" default links must be
+ " defined _before_ the inclusion of the same default links from
+ " "html.vim" and "markdown.vim".
+ if s:with_html || s:with_markdown
+ hi def link htmlComment Special
+ hi def link htmlCommentPart Special
+ hi def link htmlArg Type
+ hi def link htmlString String
+ endif
+
+ if s:with_markdown
+ hi def link markdownCode Special
+ hi def link markdownCodeBlock Special
+ hi def link markdownCodeDelimiter Special
+ hi def link markdownLinkDelimiter Comment
+ endif
+
syntax case ignore
+ " Note that javaDocSeeTag is valid in HTML and Markdown.
+ let s:ff.WithMarkdown = s:ff.RightConstant
+
" Include HTML syntax coloring for Javadoc comments.
- syntax include @javaHtml syntax/html.vim
- unlet b:current_syntax
+ if s:with_html
+ try
+ syntax include @javaHtml syntax/html.vim
+ finally
+ unlet! b:current_syntax
+ endtry
+ endif
+
+ " Include Markdown syntax coloring (v7.2.437) for Javadoc comments.
+ if s:with_markdown
+ try
+ syntax include @javaMarkdown syntax/markdown.vim
+ let s:ff.WithMarkdown = s:ff.LeftConstant
+ catch /\<E48[45]:/
+ call s:ReportOnce(v:exception)
+ unlockvar s:with_markdown
+ let s:with_markdown = 0
+ lockvar s:with_markdown
+ hi clear markdownCode
+ hi clear markdownCodeBlock
+ hi clear markdownCodeDelimiter
+ hi clear markdownLinkDelimiter
+ finally
+ unlet! b:current_syntax
+ endtry
+ endif
" HTML enables spell checking for all text that is not in a syntax
" item (:syntax spell toplevel); instead, limit spell checking to
@@ -268,100 +415,275 @@ if !exists("java_ignore_javadoc") && main_syntax != 'jsp'
call s:ReportOnce(v:exception)
endtry
- syn region javaDocComment start="/\*\*" end="\*/" keepend contains=javaCommentTitle,@javaHtml,javaDocTags,javaDocSeeTag,javaDocCodeTag,javaDocSnippetTag,javaTodo,javaCommentError,javaSpaceError,@Spell
- exec 'syn region javaCommentTitle contained matchgroup=javaDocComment start="/\*\*" matchgroup=javaCommentTitle end="\.$" end="\.[ \t\r]\@=" end="\%(^\s*\**\s*\)\@' . s:ff.Peek('80', '') . '<=@"me=s-2,he=s-1 end="\*/"me=s-1,he=s-1 contains=@javaHtml,javaCommentStar,javaTodo,javaCommentError,javaSpaceError,@Spell,javaDocTags,javaDocSeeTag,javaDocCodeTag,javaDocSnippetTag'
- syn region javaCommentTitle contained matchgroup=javaDocComment start="/\*\*\s*\r\=\n\=\s*\**\s*\%({@return\>\)\@=" matchgroup=javaCommentTitle end="}\%(\s*\.*\)*" contains=@javaHtml,javaCommentStar,javaTodo,javaCommentError,javaSpaceError,@Spell,javaDocTags,javaDocSeeTag,javaDocCodeTag,javaDocSnippetTag
- syn region javaDocTags contained start="{@\%(li\%(teral\|nk\%(plain\)\=\)\|inherit[Dd]oc\|doc[rR]oot\|value\)\>" end="}"
- syn match javaDocTags contained "@\%(param\|exception\|throws\|since\)\s\+\S\+" contains=javaDocParam
- syn match javaDocParam contained "\s\S\+"
- syn match javaDocTags contained "@\%(version\|author\|return\|deprecated\|serial\%(Field\|Data\)\=\)\>"
- syn region javaDocSeeTag contained matchgroup=javaDocTags start="@see\s\+" matchgroup=NONE end="\_."re=e-1 contains=javaDocSeeTagParam
- syn match javaDocSeeTagParam contained @"\_[^"]\+"\|<a\s\+\_.\{-}</a>\|\%(\k\|\.\)*\%(#\k\+\%((\_[^)]*)\)\=\)\=@ contains=@javaHtml extend
+ if s:with_markdown
+ syn region javaMarkdownComment start="///" skip="^\s*///.*$" end="^" keepend contains=javaMarkdownCommentTitle,javaMarkdownShortcutLink,@javaMarkdown,@javaDocTags,javaTodo,@Spell nextgroup=javaMarkdownCommentTitle fold
+ syn match javaMarkdownCommentMask contained "^\s*///"
+ exec 'syn region javaMarkdownCommentTitle contained matchgroup=javaMarkdownComment start="\%(///.*\r\=\n\s*\)\@' . s:ff.Peek('80', '') . '<!///" matchgroup=javaMarkdownCommentTitle end="\.$" end="\.[ \t\r]\@=" end="\n\%(\s*///\s*$\)\@=" end="\%(^\s*///\s*\)\@' . s:ff.Peek('80', '') . '<=@"me=s-2,he=s-1 contains=javaMarkdownShortcutLink,@javaMarkdown,javaMarkdownCommentMask,javaTodo,@Spell,@javaDocTags'
+ exec 'syn region javaMarkdownCommentTitle contained matchgroup=javaMarkdownComment start="\%(///.*\r\=\n\s*\)\@' . s:ff.Peek('80', '') . '<!///\s*\%({@return\>\)\@=" matchgroup=javaMarkdownCommentTitle end="}\%(\s*\.*\)*" contains=javaMarkdownShortcutLink,@javaMarkdown,javaMarkdownCommentMask,javaTodo,@Spell,@javaDocTags,javaTitleSkipBlock'
+ exec 'syn region javaMarkdownCommentTitle contained matchgroup=javaMarkdownComment start="\%(///.*\r\=\n\s*\)\@' . s:ff.Peek('80', '') . '<!///\s*\%({@summary\>\)\@=" matchgroup=javaMarkdownCommentTitle end="}" contains=javaMarkdownShortcutLink,@javaMarkdown,javaMarkdownCommentMask,javaTodo,@Spell,@javaDocTags,javaTitleSkipBlock'
+
+ syn clear markdownId markdownLineStart markdownH1 markdownH2 markdownHeadingRule markdownRule markdownCode markdownCodeBlock markdownIdDeclaration
+ " REDEFINE THE MARKDOWN ITEMS ANCHORED WITH "^", OBSERVING THE
+ " DEFINITION ORDER.
+ syn match markdownLineStart contained "^\s*///\s*[<@]\@!" contains=@markdownBlock,javaMarkdownCommentTitle,javaMarkdownCommentMask nextgroup=@markdownBlock,htmlSpecialChar
+ " See https://spec.commonmark.org/0.31.2/#setext-headings.
+ syn match markdownH1 contained "^\s*/// \{,3}.\+\r\=\n\s*/// \{,3}=\+\s*$" contains=@markdownInline,markdownHeadingRule,markdownAutomaticLink,javaMarkdownCommentMask
+ syn match markdownH2 contained "^\s*/// \{,3}.\+\r\=\n\s*/// \{,3}-\+\s*$" contains=@markdownInline,markdownHeadingRule,markdownAutomaticLink,javaMarkdownCommentMask
+ " See https://spec.commonmark.org/0.31.2/#atx-headings.
+ syn region markdownH1 contained matchgroup=markdownH1Delimiter start=" \{,3}#\s" end="#*\s*$" keepend contains=@markdownInline,markdownAutomaticLink oneline
+ syn region markdownH2 contained matchgroup=markdownH2Delimiter start=" \{,3}##\s" end="#*\s*$" keepend contains=@markdownInline,markdownAutomaticLink oneline
+ syn match markdownHeadingRule contained "^\s*/// \{,3}[=-]\+\s*$" contains=javaMarkdownCommentMask
+ " See https://spec.commonmark.org/0.31.2/#thematic-breaks.
+ syn match markdownRule contained "^\s*/// \{,3}\*\s*\*\%(\s*\*\)\+\s*$" contains=javaMarkdownCommentMask
+ syn match markdownRule contained "^\s*/// \{,3}_\s*_\%(\s*_\)\+\s*$" contains=javaMarkdownCommentMask
+ syn match markdownRule contained "^\s*/// \{,3}-\s*-\%(\s*-\)\+\s*$" contains=javaMarkdownCommentMask
+ " See https://spec.commonmark.org/0.31.2/#indented-code-blocks.
+ syn region markdownCodeBlock contained start="^\s*///\%( \{4,}\|\t\)" end="^\ze\s*///\%(\s*$\| \{,3}\S\)" keepend contains=javaMarkdownCommentMask
+ " See https://spec.commonmark.org/0.31.2/#code-spans.
+ syn region markdownCode contained matchgroup=markdownCodeDelimiter start="\z(`\+\) \=" end=" \=\z1" keepend contains=markdownLineStart,javaMarkdownCommentMask
+ " See https://spec.commonmark.org/0.31.2/#fenced-code-blocks.
+ syn region markdownCodeBlock contained start="^\s*/// \{,3}\z(```\+\)\%(.\{-}[^`]`\)\@!" end="^\s*/// \{,3}\z1`*" keepend contains=javaMarkdownCommentMask
+ syn region markdownCodeBlock contained start="^\s*/// \{,3}\z(\~\~\~\+\)" end="^\s*/// \{,3}\z1\~*" keepend contains=javaMarkdownCommentMask
+ " See https://spec.commonmark.org/0.31.2/#link-reference-definitions.
+ syn region markdownIdDeclaration contained matchgroup=markdownLinkDelimiter start="^\s*/// \{,3\}!\=\[" end="\]:" keepend contains=javaMarkdownCommentMask nextgroup=markdownUrl oneline skipwhite
+ " See https://spec.commonmark.org/0.31.2/#link-label.
+ syn region markdownId contained matchgroup=markdownIdDelimiter start="\[\%([\t ]\]\)\@!" end="\]" contains=javaMarkdownSkipBrackets,javaMarkdownCommentMask
+ " Note that escaped brackets can be unbalanced.
+ syn match javaMarkdownSkipBrackets contained transparent "\\\[\|\\\]"
+ " See https://spec.commonmark.org/0.31.2/#shortcut-reference-link.
+ syn region javaMarkdownShortcutLink contained matchgroup=markdownLinkTextDelimiter start="!\=\[^\@!\%(\_[^][]*\%(\[\_[^][]*\]\_[^][]*\)*]\%([[(]\)\@!\)\@=" end="\]\%([[(]\)\@!" contains=@markdownInline,markdownLineStart,javaMarkdownSkipBrackets,javaMarkdownCommentMask nextgroup=markdownLink,markdownId skipwhite
+
+ for s:name in ['markdownFootnoteDefinition', 'markdownFootnote']
+ if hlexists(s:name)
+ exec 'syn clear ' . s:name
+ endif
+ endfor
+
+ unlet s:name
+
+ " COMBAK: Footnotes are recognised by "markdown.vim", but are not
+ " in CommonMark. See https://pandoc.org/MANUAL.html#footnotes.
+""""syn match markdownFootnoteDefinition contained "^\s*///\s*\[^[^\]]\+\]:" contains=javaMarkdownCommentMask
+
+ hi def link javaMarkdownComment Comment
+ hi def link javaMarkdownCommentMask javaMarkdownComment
+ hi def link javaMarkdownCommentTitle SpecialComment
+ hi def link javaMarkdownShortcutLink htmlLink
+ endif
+
+ if s:with_html
+ syn region javaDocComment start="/\*\*" end="\*/" keepend contains=javaCommentTitle,@javaHtml,@javaDocTags,javaTodo,javaCommentError,javaSpaceError,@Spell fold
+ exec 'syn region javaCommentTitle contained matchgroup=javaDocComment start="/\*\*" matchgroup=javaCommentTitle end="\.$" end="\.[ \t\r]\@=" end="\%(^\s*\**\s*\)\@' . s:ff.Peek('80', '') . '<=@"me=s-2,he=s-1 end="\*/"me=s-1,he=s-1 contains=@javaHtml,javaCommentStar,javaTodo,javaCommentError,javaSpaceError,@Spell,@javaDocTags'
+ syn region javaCommentTitle contained matchgroup=javaDocComment start="/\*\*\s*\r\=\n\=\s*\**\s*\%({@return\>\)\@=" matchgroup=javaCommentTitle end="}\%(\s*\.*\)*" contains=@javaHtml,javaCommentStar,javaTodo,javaCommentError,javaSpaceError,@Spell,@javaDocTags,javaTitleSkipBlock
+ syn region javaCommentTitle contained matchgroup=javaDocComment start="/\*\*\s*\r\=\n\=\s*\**\s*\%({@summary\>\)\@=" matchgroup=javaCommentTitle end="}" contains=@javaHtml,javaCommentStar,javaTodo,javaCommentError,javaSpaceError,@Spell,@javaDocTags,javaTitleSkipBlock
+ hi def link javaDocComment Comment
+ hi def link javaCommentTitle SpecialComment
+ endif
+
+ " The members of javaDocTags are sub-grouped according to the Java
+ " version of their introduction, and sub-group members in turn are
+ " arranged in alphabetical order, so that future newer members can
+ " be pre-sorted and appended without disturbing the current member
+ " placement.
+ " Since they only have significance in javaCommentTitle, neither
+ " javaDocSummaryTag nor javaDocReturnTitleTag are defined.
+ syn cluster javaDocTags contains=javaDocAuthorTag,javaDocDeprecatedTag,javaDocExceptionTag,javaDocParamTag,javaDocReturnTag,javaDocSeeTag,javaDocVersionTag,javaDocSinceTag,javaDocLinkTag,javaDocSerialTag,javaDocSerialDataTag,javaDocSerialFieldTag,javaDocThrowsTag,javaDocDocRootTag,javaDocInheritDocTag,javaDocLinkplainTag,javaDocValueTag,javaDocCodeTag,javaDocLiteralTag,javaDocHiddenTag,javaDocIndexTag,javaDocProvidesTag,javaDocUsesTag,javaDocSystemPropertyTag,javaDocSnippetTag,javaDocSpecTag
+
+ " Anticipate non-standard inline tags in {@return} and {@summary}.
+ syn region javaTitleSkipBlock contained transparent start="{\%(@\%(return\|summary\)\>\)\@!" end="}"
+ syn match javaDocDocRootTag contained "{@docRoot}"
+ syn match javaDocInheritDocTag contained "{@inheritDoc}"
+ syn region javaIndexSkipBlock contained transparent start="{\%(@index\>\)\@!" end="}" contains=javaIndexSkipBlock,javaDocIndexTag
+ syn region javaDocIndexTag contained start="{@index\>" end="}" contains=javaDocIndexTag,javaIndexSkipBlock
+ syn region javaLinkSkipBlock contained transparent start="{\%(@link\>\)\@!" end="}" contains=javaLinkSkipBlock,javaDocLinkTag
+ syn region javaDocLinkTag contained start="{@link\>" end="}" contains=javaDocLinkTag,javaLinkSkipBlock
+ syn region javaLinkplainSkipBlock contained transparent start="{\%(@linkplain\>\)\@!" end="}" contains=javaLinkplainSkipBlock,javaDocLinkplainTag
+ syn region javaDocLinkplainTag contained start="{@linkplain\>" end="}" contains=javaDocLinkplainTag,javaLinkplainSkipBlock
+ syn region javaLiteralSkipBlock contained transparent start="{\%(@literal\>\)\@!" end="}" contains=javaLiteralSkipBlock,javaDocLiteralTag
+ syn region javaDocLiteralTag contained start="{@literal\>" end="}" contains=javaDocLiteralTag,javaLiteralSkipBlock
+ syn region javaSystemPropertySkipBlock contained transparent start="{\%(@systemProperty\>\)\@!" end="}" contains=javaSystemPropertySkipBlock,javaDocSystemPropertyTag
+ syn region javaDocSystemPropertyTag contained start="{@systemProperty\>" end="}" contains=javaDocSystemPropertyTag,javaSystemPropertySkipBlock
+ syn region javaValueSkipBlock contained transparent start="{\%(@value\>\)\@!" end="}" contains=javaValueSkipBlock,javaDocValueTag
+ syn region javaDocValueTag contained start="{@value\>" end="}" contains=javaDocValueTag,javaValueSkipBlock
+
+ syn match javaDocParam contained "\s\zs\S\+"
+ syn match javaDocExceptionTag contained "@exception\s\+\S\+" contains=javaDocParam
+ syn match javaDocParamTag contained "@param\s\+\S\+" contains=javaDocParam
+ syn match javaDocSinceTag contained "@since\s\+\S\+" contains=javaDocParam
+ syn match javaDocThrowsTag contained "@throws\s\+\S\+" contains=javaDocParam
+ syn match javaDocSpecTag contained "@spec\_s\+\S\+\ze\_s\+\S\+" contains=javaDocParam
+
+ syn match javaDocAuthorTag contained "@author\>"
+ syn match javaDocDeprecatedTag contained "@deprecated\>"
+ syn match javaDocHiddenTag contained "@hidden\>"
+ syn match javaDocReturnTag contained "@return\>"
+ syn match javaDocSerialTag contained "@serial\>"
+ syn match javaDocSerialDataTag contained "@serialData\>"
+ syn match javaDocSerialFieldTag contained "@serialField\>"
+ syn match javaDocVersionTag contained "@version\>"
+
+ syn match javaDocSeeTag contained "@see\>\s*" nextgroup=javaDocSeeTag1,javaDocSeeTag2,javaDocSeeTag3,javaDocSeeTag4,javaDocSeeTagStar,javaDocSeeTagSlash skipwhite skipempty
+
+ if s:with_html
+ syn match javaDocSeeTagStar contained "^\s*\*\+\%(\s*{\=@\|/\|$\)\@!" nextgroup=javaDocSeeTag1,javaDocSeeTag2,javaDocSeeTag3,javaDocSeeTag4 skipwhite skipempty
+ hi def link javaDocSeeTagStar javaDocComment
+ endif
+
+ if s:with_markdown
+ syn match javaDocSeeTagSlash contained "^\s*///\%(\s*{\=@\|$\)\@!" nextgroup=javaDocSeeTag1,javaDocSeeTag2,javaDocSeeTag3,javaDocSeeTag4 skipwhite skipempty
+ hi def link javaDocSeeTagSlash javaMarkdownComment
+ endif
+
+ syn match javaDocSeeTag1 contained @"\_[^"]\+"@
+ syn match javaDocSeeTag2 contained @<a\s\+\_.\{-}</a>@ contains=@javaHtml extend
+ exec 'syn match javaDocSeeTag3 contained @[' . s:ff.WithMarkdown('[', '') . '"< \t]\@!\%(\k\|[/.]\)*\%(##\=\k\+\%((\_[^)]*)\)\=\)\=@ nextgroup=javaDocSeeTag3Label skipwhite skipempty'
+ syn match javaDocSeeTag3Label contained @\k\%(\k\+\s*\)*$@
+
+ " COMBAK: No support for type javaDocSeeTag2 in Markdown.
+""if s:with_markdown
+"" syn match javaDocSeeTag4 contained @\[.\+\]\s\=\%(\[.\+\]\|(.\+)\)@ contains=@javaMarkdown extend
+"" hi def link javaDocSeeTag4 Special
+""endif
+
syn region javaCodeSkipBlock contained transparent start="{\%(@code\>\)\@!" end="}" contains=javaCodeSkipBlock,javaDocCodeTag
syn region javaDocCodeTag contained start="{@code\>" end="}" contains=javaDocCodeTag,javaCodeSkipBlock
- exec 'syn region javaDocSnippetTagAttr contained transparent matchgroup=htmlArg start=/\<\%(class\|file\|id\|lang\|region\)\%(\s*=\)\@=/ matchgroup=htmlString end=/:$/ end=/\%(=\s*\)\@' . s:ff.Peek('80', '') . '<=\%("[^"]\+"\|' . "\x27[^\x27]\\+\x27" . '\|\%([.\\/-]\|\k\)\+\)/ nextgroup=javaDocSnippetTagAttr skipwhite skipnl'
+
+ exec 'syn region javaDocSnippetTagAttr contained transparent matchgroup=javaHtmlArg start=/\<\%(class\|file\|id\|lang\|region\)\%(\s*=\)\@=/ matchgroup=javaHtmlString end=/:$/ end=/\%(=\s*\)\@' . s:ff.Peek('80', '') . '<=\%("[^"]\+"\|' . "\x27[^\x27]\\+\x27" . '\|\%([.\\/-]\|\k\)\+\)/ nextgroup=javaDocSnippetTagAttr skipwhite skipnl'
syn region javaSnippetSkipBlock contained transparent start="{\%(@snippet\>\)\@!" end="}" contains=javaSnippetSkipBlock,javaDocSnippetTag,javaCommentMarkupTag
syn region javaDocSnippetTag contained start="{@snippet\>" end="}" contains=javaDocSnippetTag,javaSnippetSkipBlock,javaDocSnippetTagAttr,javaCommentMarkupTag
syntax case match
+ hi def link javaDocParam Function
+
+ hi def link javaDocAuthorTag Special
+ hi def link javaDocCodeTag Special
+ hi def link javaDocDeprecatedTag Special
+ hi def link javaDocDocRootTag Special
+ hi def link javaDocExceptionTag Special
+ hi def link javaDocHiddenTag Special
+ hi def link javaDocIndexTag Special
+ hi def link javaDocInheritDocTag Special
+ hi def link javaDocLinkTag Special
+ hi def link javaDocLinkplainTag Special
+ hi def link javaDocLiteralTag Special
+ hi def link javaDocParamTag Special
+ hi def link javaDocReturnTag Special
+ hi def link javaDocSeeTag Special
+ hi def link javaDocSeeTag1 String
+ hi def link javaDocSeeTag2 Special
+ hi def link javaDocSeeTag3 Function
+ hi def link javaDocSerialTag Special
+ hi def link javaDocSerialDataTag Special
+ hi def link javaDocSerialFieldTag Special
+ hi def link javaDocSinceTag Special
+ hi def link javaDocSnippetTag Special
+ hi def link javaDocSpecTag Special
+ hi def link javaDocSystemPropertyTag Special
+ hi def link javaDocThrowsTag Special
+ hi def link javaDocValueTag Special
+ hi def link javaDocVersionTag Special
endif
" match the special comment /**/
-syn match javaComment "/\*\*/"
+syn match javaComment "/\*\*/"
" Strings and constants
-syn match javaSpecialError contained "\\."
+syn match javaSpecialError contained "\\."
syn match javaSpecialCharError contained "[^']"
" Escape Sequences (JLS-17, §3.10.7):
-syn match javaSpecialChar contained "\\\%(u\x\x\x\x\|[0-3]\o\o\|\o\o\=\|[bstnfr"'\\]\)"
+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
syn region javaString start=+"""[ \t\x0c\r]*$+hs=e+1 end=+"""+he=s-1 contains=javaSpecialChar,javaSpecialError,javaTextBlockError,@Spell
syn match javaTextBlockError +"""\s*"""+
-syn region javaStrTemplEmbExp contained matchgroup=javaStrTempl start="\\{" end="}" contains=TOP
-exec 'syn region javaStrTempl start=+\%(\.[[:space:]\n]*\)\@' . s:ff.Peek('80', '') . '<="+ end=+"+ contains=javaStrTemplEmbExp,javaSpecialChar,javaSpecialError,@Spell'
-exec 'syn region javaStrTempl start=+\%(\.[[:space:]\n]*\)\@' . s:ff.Peek('80', '') . '<="""[ \t\x0c\r]*$+hs=e+1 end=+"""+he=s-1 contains=javaStrTemplEmbExp,javaSpecialChar,javaSpecialError,javaTextBlockError,@Spell'
-syn match javaCharacter "'[^']*'" contains=javaSpecialChar,javaSpecialCharError
-syn match javaCharacter "'\\''" contains=javaSpecialChar
-syn match javaCharacter "'[^\\]'"
+
+if s:ff.IsRequestedPreviewFeature(430)
+ syn region javaStrTemplEmbExp contained matchgroup=javaStrTempl start="\\{" end="}" contains=TOP
+ exec 'syn region javaStrTempl start=+\%(\.[[:space:]\n]*\)\@' . s:ff.Peek('80', '') . '<="+ end=+"+ contains=javaStrTemplEmbExp,javaSpecialChar,javaSpecialError,@Spell'
+ exec 'syn region javaStrTempl start=+\%(\.[[:space:]\n]*\)\@' . s:ff.Peek('80', '') . '<="""[ \t\x0c\r]*$+hs=e+1 end=+"""+he=s-1 contains=javaStrTemplEmbExp,javaSpecialChar,javaSpecialError,javaTextBlockError,@Spell'
+ hi def link javaStrTempl Macro
+endif
+
+syn match javaCharacter "'[^']*'" contains=javaSpecialChar,javaSpecialCharError
+syn match javaCharacter "'\\''" contains=javaSpecialChar
+syn match javaCharacter "'[^\\]'"
" 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]\=\>"
+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]\>"
+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]\=\>"
+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"
" Method declarations (JLS-17, §8.4.3, §8.4.4, §9.4).
-if exists("java_highlight_functions")
- syn cluster javaFuncParams contains=javaAnnotation,@javaClasses,javaType,javaVarArg,javaComment,javaLineComment
+if exists("g:java_highlight_functions")
+ syn cluster javaFuncParams contains=javaAnnotation,@javaClasses,javaGenerics,javaType,javaVarArg,javaComment,javaLineComment
- if java_highlight_functions =~# '^indent[1-8]\=$'
- let s:last = java_highlight_functions[-1 :]
- let s:indent = s:last != 't' ? repeat("\x20", s:last) : "\t"
+ if exists("g:java_highlight_signature")
+ syn cluster javaFuncParams add=javaParamModifier
+ hi def link javaFuncDefStart javaFuncDef
+ else
syn cluster javaFuncParams add=javaScopeDecl,javaConceptKind,javaStorageClass,javaExternal
+ endif
+
+ if g:java_highlight_functions =~# '^indent[1-8]\=$'
+ let s:last = g:java_highlight_functions[-1 :]
+ let s:indent = s:last != 't' ? repeat("\x20", s:last) : "\t"
" Try to not match other type members, initialiser blocks, enum
" constants (JLS-17, §8.9.1), and constructors (JLS-17, §8.1.7):
" at any _conventional_ indentation, skip over all fields with
" "[^=]*", all records with "\<record\s", and let the "*Skip*"
" definitions take care of constructor declarations and enum
- " constants (with no support for @Foo(value = "bar")).
- exec 'syn region javaFuncDef start=+^' . s:indent . '\%(<[^>]\+>\+\s\+\|\%(\%(@\%(\K\k*\.\)*\K\k*\>\)\s\+\)\+\)\=\%(\<\K\k*\>\.\)*\K\k*\>[^=]*\%(\<record\)\@' . s:ff.Peek('6', '') . '<!\s\K\k*\s*(+ end=+)+ contains=@javaFuncParams'
+ " constants (with no support for @Foo(value = "bar")). Also,
+ " reject inlined declarations with "[^{]" for signature.
+ exec 'syn region javaFuncDef ' . s:ff.GroupArgs('transparent matchgroup=javaFuncDefStart', '') . ' start=/' . s:ff.PeekTo('\%(', '') . '^' . s:indent . '\%(<[^>]\+>\+\s\+\|\%(\%(@\%(\K\k*\.\)*\K\k*\>\)\s\+\)\+\)\=\%(\<\K\k*\>\.\)*\K\k*\>[^={]*\%(\<record\)\@' . s:ff.Peek('6', '') . '<!\s' . s:ff.PeekFrom('\)\@' . s:ff.Peek('80', '') . '<=', '') . '\K\k*\s*(/ end=/)/ contains=@javaFuncParams'
" As long as package-private constructors cannot be matched with
" javaFuncDef, do not look with javaConstructorSkipDeclarator for
" them.
- exec 'syn match javaConstructorSkipDeclarator transparent +^' . s:indent . '\%(\%(@\%(\K\k*\.\)*\K\k*\>\)\s\+\)*p\%(ublic\|rotected\|rivate\)\s\+\%(<[^>]\+>\+\s\+\)\=\K\k*\s*\ze(+ contains=javaAnnotation,javaScopeDecl'
- exec 'syn match javaEnumSkipArgumentativeConstant transparent +^' . s:indent . '\%(\%(@\%(\K\k*\.\)*\K\k*\>\)\s\+\)*\K\k*\s*\ze(+ contains=javaAnnotation'
+ exec 'syn match javaConstructorSkipDeclarator transparent /^' . s:indent . '\%(\%(@\%(\K\k*\.\)*\K\k*\>\)\s\+\)*p\%(ublic\|rotected\|rivate\)\s\+\%(<[^>]\+>\+\s\+\)\=\K\k*\s*\ze(/ contains=javaAnnotation,javaScopeDecl,javaClassDecl,javaTypedef,javaGenerics'
+ " With a zero-width span for signature applicable on demand to
+ " javaFuncDef, make related adjustments:
+ " (1) Claim all enum constants of a line as a unit.
+ exec 'syn match javaEnumSkipConstant contained transparent /^' . s:indent . '\%(\%(\%(@\%(\K\k*\.\)*\K\k*\>\)\s\+\)*\K\k*\s*\%((.*)\)\=\s*[,;({]\s*\)\+/ contains=@javaEnumConstants'
+ " (2) Define a syntax group for top level enumerations and tell
+ " apart their constants from method declarations.
+ exec 'syn region javaTopEnumDeclaration transparent start=/\%(^\%(\%(@\%(\K\k*\.\)*\K\k*\>\)\s\+\)*\%(p\%(ublic\|rotected\|rivate\)\s\+\)\=\%(strictfp\s\+\)\=\<enum\_s\+\)\@' . s:ff.Peek('80', '') . '<=\K\k*\%(\_s\+implements\_s.\+\)\=\_s*{/ end=/}/ contains=@javaTop,javaEnumSkipConstant'
+ " (3) Define a base variant of javaParenT without using @javaTop
+ " in order to not include javaFuncDef.
+ syn region javaParenE transparent matchgroup=javaParen start="(" end=")" contains=@javaEnumConstants,javaInParen
+ syn region javaParenE transparent matchgroup=javaParen start="\[" end="\]" contains=@javaEnumConstants
+ syn cluster javaEnumConstants contains=TOP,javaTopEnumDeclaration,javaFuncDef,javaParenT
unlet s:indent s:last
else
" This is the "style" variant (:help ft-java-syntax).
- syn cluster javaFuncParams add=javaScopeDecl,javaConceptKind,javaStorageClass,javaExternal
" Match arbitrarily indented camelCasedName method declarations.
" Match: [@É] [abstract] [<α, β>] Τʬ[<γ>][[][]] μʭʭ(/* ... */);
- exec 'syn region javaFuncDef start=/' . s:ff.Engine('\%#=2', '') . '^\s\+\%(\%(@\%(\K\k*\.\)*\K\k*\>\)\s\+\)*\%(p\%(ublic\|rotected\|rivate\)\s\+\)\=\%(\%(abstract\|default\)\s\+\|\%(\%(final\|\%(native\|strictfp\)\|s\%(tatic\|ynchronized\)\)\s\+\)*\)\=\%(<.*[[:space:]-]\@' . s:ff.Peek('1', '') . '<!>\s\+\)\=\%(void\|\%(b\%(oolean\|yte\)\|char\|short\|int\|long\|float\|double\|\%(\<\K\k*\>\.\)*\<' . s:ff.UpperCase('[$_[:upper:]]', '[^a-z0-9]') . '\k*\>\%(<[^(){}]*[[:space:]-]\@' . s:ff.Peek('1', '') . '<!>\)\=\)\%(\[\]\)*\)\s\+\<' . s:ff.LowerCase('[$_[:lower:]]', '[^A-Z0-9]') . '\k*\>\s*(/ end=/)/ skip=/\/\*.\{-}\*\/\|\/\/.*$/ contains=@javaFuncParams'
+ exec 'syn region javaFuncDef ' . s:ff.GroupArgs('transparent matchgroup=javaFuncDefStart', '') . ' start=/' . s:ff.Engine('\%#=2', '') . s:ff.PeekTo('\%(', '') . '^\s\+\%(\%(@\%(\K\k*\.\)*\K\k*\>\)\s\+\)*\%(p\%(ublic\|rotected\|rivate\)\s\+\)\=\%(\%(abstract\|default\)\s\+\|\%(\%(final\|\%(native\|strictfp\)\|s\%(tatic\|ynchronized\)\)\s\+\)*\)\=\%(<.*[[:space:]-]\@' . s:ff.Peek('1', '') . '<!>\s\+\)\=\%(void\|\%(b\%(oolean\|yte\)\|char\|short\|int\|long\|float\|double\|\%(\<\K\k*\>\.\)*\<' . s:ff.UpperCase('[$_[:upper:]]', '[^a-z0-9]') . '\k*\>\%(<[^(){}]*[[:space:]-]\@' . s:ff.Peek('1', '') . '<!>\)\=\)\%(\[\]\)*\)\s\+' . s:ff.PeekFrom('\)\@' . s:ff.Peek('80', '') . '<=', '') . '\<' . s:ff.LowerCase('[$_[:lower:]]', '[^A-Z0-9]') . '\k*\>\s*(/ end=/)/ skip=/\/\*.\{-}\*\/\|\/\/.*$/ contains=@javaFuncParams'
endif
-
- exec 'syn match javaLambdaDef "\<\K\k*\>\%(\<default\>\)\@' . s:ff.Peek('7', '') . '<!\s*->"'
- syn match javaBraces "[{}]"
endif
-if exists("java_highlight_debug")
+if exists("g:java_highlight_debug")
" Strings and constants
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 region javaDebugString contained start=+"+ end=+"+ contains=javaDebugSpecial
syn region javaDebugString contained start=+"""[ \t\x0c\r]*$+hs=e+1 end=+"""+he=s-1 contains=javaDebugSpecial,javaDebugTextBlockError
- " The highlight groups of java{StrTempl,Debug{,Paren,StrTempl}}\,
- " share one colour by default. Do not conflate unrelated parens.
- syn region javaDebugStrTemplEmbExp contained matchgroup=javaDebugStrTempl start="\\{" end="}" contains=javaComment,javaLineComment,javaDebug\%(Paren\)\@!.*
- exec 'syn region javaDebugStrTempl contained start=+\%(\.[[:space:]\n]*\)\@' . s:ff.Peek('80', '') . '<="+ end=+"+ contains=javaDebugStrTemplEmbExp,javaDebugSpecial'
- exec 'syn region javaDebugStrTempl contained start=+\%(\.[[:space:]\n]*\)\@' . s:ff.Peek('80', '') . '<="""[ \t\x0c\r]*$+hs=e+1 end=+"""+he=s-1 contains=javaDebugStrTemplEmbExp,javaDebugSpecial,javaDebugTextBlockError'
+
+ if s:ff.IsRequestedPreviewFeature(430)
+ " The highlight groups of java{StrTempl,Debug{,Paren,StrTempl}}\,
+ " share one colour by default. Do not conflate unrelated parens.
+ syn region javaDebugStrTemplEmbExp contained matchgroup=javaDebugStrTempl start="\\{" end="}" contains=javaComment,javaLineComment,javaDebug\%(Paren\)\@!.*
+ exec 'syn region javaDebugStrTempl contained start=+\%(\.[[:space:]\n]*\)\@' . s:ff.Peek('80', '') . '<="+ end=+"+ contains=javaDebugStrTemplEmbExp,javaDebugSpecial'
+ exec 'syn region javaDebugStrTempl contained start=+\%(\.[[:space:]\n]*\)\@' . s:ff.Peek('80', '') . '<="""[ \t\x0c\r]*$+hs=e+1 end=+"""+he=s-1 contains=javaDebugStrTemplEmbExp,javaDebugSpecial,javaDebugTextBlockError'
+ hi def link javaDebugStrTempl Macro
+ endif
+
syn match javaDebugTextBlockError contained +"""\s*"""+
syn match javaDebugCharacter contained "'[^\\]'"
syn match javaDebugSpecialCharacter contained "'\\.'"
@@ -375,7 +697,7 @@ if exists("java_highlight_debug")
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
+ syn region javaDebugParen contained start=+(+ end=+)+ contains=javaDebug.*,javaDebugParen
" To make this work, define the highlighting for these groups.
syn match javaDebug "\<System\.\%(out\|err\)\.print\%(ln\)\=\s*("me=e-1 contains=javaDebug.* nextgroup=javaDebugParen
@@ -385,53 +707,88 @@ if exists("java_highlight_debug")
" FIXME: What API do "trace*" belong to?
" syn match javaDebug "\<trace[SL]\=\s*("me=e-1 contains=javaDebug.* nextgroup=javaDebugParen
- hi def link javaDebug Debug
- hi def link javaDebugString DebugString
- hi def link javaDebugStrTempl Macro
- hi def link javaDebugTextBlockError Error
- hi def link javaDebugType DebugType
- hi def link javaDebugBoolean DebugBoolean
- hi def link javaDebugNumber Debug
- hi def link javaDebugSpecial DebugSpecial
- hi def link javaDebugSpecialCharacter DebugSpecial
- hi def link javaDebugCharacter DebugString
- hi def link javaDebugParen Debug
-
- hi def link DebugString String
- hi def link DebugSpecial Special
- hi def link DebugBoolean Boolean
- hi def link DebugType Type
+ hi def link javaDebug Debug
+ hi def link javaDebugString DebugString
+ hi def link javaDebugTextBlockError Error
+ hi def link javaDebugType DebugType
+ hi def link javaDebugBoolean DebugBoolean
+ hi def link javaDebugNumber Debug
+ hi def link javaDebugSpecial DebugSpecial
+ hi def link javaDebugSpecialCharacter DebugSpecial
+ hi def link javaDebugCharacter DebugString
+ hi def link javaDebugParen Debug
+
+ hi def link DebugString String
+ hi def link DebugSpecial Special
+ hi def link DebugBoolean Boolean
+ hi def link DebugType Type
endif
-if exists("java_mark_braces_in_parens_as_errors")
- syn match javaInParen contained "[{}]"
- hi def link javaInParen javaError
+" Try not to fold top-level-type bodies under assumption that there is
+" but one such body.
+exec 'syn region javaBlock transparent start="\%(^\|^\S[^:]\+\)\@' . s:ff.Peek('120', '') . '<!{" end="}" fold'
+
+if exists("g:java_mark_braces_in_parens_as_errors")
+ syn match javaInParen contained "[{}]"
+ hi def link javaInParen javaError
endif
" catch errors caused by wrong parenthesis
-syn region javaParenT transparent matchgroup=javaParen start="(" end=")" contains=@javaTop,javaParenT1
-syn region javaParenT1 transparent matchgroup=javaParen1 start="(" end=")" contains=@javaTop,javaParenT2 contained
-syn region javaParenT2 transparent matchgroup=javaParen2 start="(" end=")" contains=@javaTop,javaParenT contained
-syn match javaParenError ")"
+syn region javaParenT transparent matchgroup=javaParen start="(" end=")" contains=@javaTop,javaInParen,javaParenT1
+syn region javaParenT1 contained transparent matchgroup=javaParen1 start="(" end=")" contains=@javaTop,javaInParen,javaParenT2
+syn region javaParenT2 contained transparent matchgroup=javaParen2 start="(" end=")" contains=@javaTop,javaInParen,javaParenT
+syn match javaParenError ")"
" catch errors caused by wrong square parenthesis
-syn region javaParenT transparent matchgroup=javaParen start="\[" end="\]" contains=@javaTop,javaParenT1
-syn region javaParenT1 transparent matchgroup=javaParen1 start="\[" end="\]" contains=@javaTop,javaParenT2 contained
-syn region javaParenT2 transparent matchgroup=javaParen2 start="\[" end="\]" contains=@javaTop,javaParenT contained
-syn match javaParenError "\]"
-
-hi def link javaParenError javaError
+syn region javaParenT transparent matchgroup=javaParen start="\[" end="\]" contains=@javaTop,javaParenT1
+syn region javaParenT1 contained transparent matchgroup=javaParen1 start="\[" end="\]" contains=@javaTop,javaParenT2
+syn region javaParenT2 contained transparent matchgroup=javaParen2 start="\[" end="\]" contains=@javaTop,javaParenT
+syn match javaParenError "\]"
+
+" Lambda expressions (JLS-17, §15.27) and method reference expressions
+" (JLS-17, §15.13).
+if exists("g:java_highlight_functions")
+ syn match javaMethodRef ":::\@!"
+
+ if exists("g:java_highlight_signature")
+ let s:ff.LambdaDef = s:ff.LeftConstant
+ else
+ let s:ff.LambdaDef = s:ff.RightConstant
+ endif
-if exists("java_highlight_functions")
" Make ()-matching definitions after the parenthesis error catcher.
- exec 'syn match javaLambdaDef "\k\@' . s:ff.Peek('4', '') . '<!(\%(\k\|[[:space:]<>?\[\]@,.]\)*)\s*->"'
+ "
+ " Note that here and elsewhere a single-line token is used for \z,
+ " with other tokens repeated as necessary, to overcome the lack of
+ " support for multi-line matching with \z.
+ "
+ " Match: ([@A [@B ...] final] var a[, var b, ...]) ->
+ " | ([@A [@B ...] final] T[<α>][[][]] a[, T b, ...]) ->
+ " There is no recognition of expressions interspersed with comments
+ " or of expressions whose parameterised parameter types are written
+ " across multiple lines.
+ exec 'syn ' . s:ff.LambdaDef('region javaLambdaDef transparent matchgroup=javaLambdaDefStart start=/', 'match javaLambdaDef "') . '\k\@' . s:ff.Peek('4', '') . '<!(' . s:ff.LambdaDef('\%(', '') . '[[:space:]\n]*\%(\%(@\%(\K\k*\.\)*\K\k*\>\%((\_.\{-1,})\)\{-,1}[[:space:]\n]\+\)*\%(final[[:space:]\n]\+\)\=\%(\<\K\k*\>\.\)*\<\K\k*\>\%(<[^(){}]*[[:space:]-]\@' . s:ff.Peek('1', '') . '<!>\)\=\%(\%(\%(\[\]\)\+\|\.\.\.\)\)\=[[:space:]\n]\+\<\K\k*\>\%(\[\]\)*\%(,[[:space:]\n]*\)\=\)\+)[[:space:]\n]*' . s:ff.LambdaDef('\z(->\)\)\@=/ end=/)[[:space:]\n]*\z1/', '->"') . ' contains=javaAnnotation,javaParamModifier,javaLambdaVarType,javaType,@javaClasses,javaGenerics,javaVarArg'
+ " Match: () ->
+ " | (a[, b, ...]) ->
+ exec 'syn ' . s:ff.LambdaDef('region javaLambdaDef transparent matchgroup=javaLambdaDefStart start=/', 'match javaLambdaDef "') . '\k\@' . s:ff.Peek('4', '') . '<!(' . s:ff.LambdaDef('\%(', '') . '[[:space:]\n]*\%(\<\K\k*\>\%(,[[:space:]\n]*\)\=\)*)[[:space:]\n]*' . s:ff.LambdaDef('\z(->\)\)\@=/ end=/)[[:space:]\n]*\z1/', '->"')
+ " Match: a ->
+ exec 'syn ' . s:ff.LambdaDef('region javaLambdaDef transparent start=/', 'match javaLambdaDef "') . '\<\K\k*\>\%(\<default\>\)\@' . s:ff.Peek('7', '') . '<!' . s:ff.LambdaDef('\%([[:space:]\n]*\z(->\)\)\@=/ matchgroup=javaLambdaDefStart end=/\z1/', '[[:space:]\n]*->"')
+
+ syn keyword javaParamModifier contained final
+ syn keyword javaLambdaVarType contained var
+ hi def link javaParamModifier javaConceptKind
+ hi def link javaLambdaVarType javaOperator
+ hi def link javaLambdaDef javaFuncDef
+ hi def link javaLambdaDefStart javaFuncDef
+ hi def link javaMethodRef javaFuncDef
+ hi def link javaFuncDef Function
endif
" The @javaTop cluster comprises non-contained Java syntax groups.
" Note that the syntax file "aidl.vim" relies on its availability.
-syn cluster javaTop contains=TOP,javaDocComment,javaFold,javaParenError,javaParenT
+syn cluster javaTop contains=TOP,javaTopEnumDeclaration
-if !exists("java_minlines")
- let java_minlines = 10
+if !exists("g:java_minlines")
+ let g:java_minlines = 10
endif
" Note that variations of a /*/ balanced comment, e.g., /*/*/, /*//*/,
@@ -440,17 +797,11 @@ endif
" to make synchronisation start further towards file's beginning by
" bumping up g:java_minlines or issuing ':syntax sync fromstart' or
" preferring &foldmethod set to 'syntax'.
-exec "syn sync ccomment javaComment minlines=" . java_minlines
+exec "syn sync ccomment javaComment minlines=" . g:java_minlines
" The default highlighting.
-hi def link javaLambdaDef Function
-hi def link javaFuncDef Function
hi def link javaVarArg Function
-hi def link javaBraces Function
hi def link javaBranch Conditional
-hi def link javaUserLabelRef javaUserLabel
-hi def link javaLabel Label
-hi def link javaUserLabel Label
hi def link javaConditional Conditional
hi def link javaRepeat Repeat
hi def link javaExceptions Exception
@@ -459,60 +810,91 @@ 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 javaConceptKind javaStorageClass
-hi def link javaBoolean Boolean
-hi def link javaSpecial Special
+hi def link javaBoolean Boolean
+hi def link javaSpecial Special
hi def link javaSpecialError Error
hi def link javaSpecialCharError Error
hi def link javaString String
-hi def link javaStrTempl Macro
hi def link javaCharacter Character
hi def link javaSpecialChar SpecialChar
hi def link javaNumber Number
hi def link javaError Error
+hi def link javaError2 javaError
hi def link javaTextBlockError Error
+hi def link javaParenError javaError
hi def link javaStatement Statement
hi def link javaOperator Operator
-hi def link javaComment Comment
-hi def link javaDocComment Comment
-hi def link javaLineComment Comment
hi def link javaConstant Constant
-hi def link javaTypedef Typedef
+hi def link javaTypedef Typedef
hi def link javaTodo Todo
hi def link javaAnnotation PreProc
+hi def link javaAnnotationStart javaAnnotation
+hi def link javaType Type
+hi def link javaExternal Include
+
+hi def link javaUserLabel Label
+hi def link javaUserLabelRef javaUserLabel
+hi def link javaLabel Label
+hi def link javaLabelDefault javaLabel
+hi def link javaLabelVarType javaOperator
-hi def link javaCommentTitle SpecialComment
-hi def link javaDocTags Special
-hi def link javaDocCodeTag Special
-hi def link javaDocSnippetTag Special
-hi def link javaDocParam Function
-hi def link javaDocSeeTagParam Function
+hi def link javaComment Comment
hi def link javaCommentStar javaComment
+hi def link javaLineComment Comment
+hi def link javaCommentMarkupTagAttr javaHtmlArg
+hi def link javaCommentString javaString
+hi def link javaComment2String javaString
+hi def link javaCommentCharacter javaCharacter
+hi def link javaCommentError javaError
+hi def link javaCommentStart javaComment
-hi def link javaType Type
-hi def link javaExternal Include
+hi def link javaHtmlArg Type
+hi def link javaHtmlString String
-hi def link htmlComment Special
-hi def link htmlCommentPart Special
-hi def link htmlArg Type
-hi def link htmlString String
-hi def link javaSpaceError Error
+let b:current_syntax = "java"
-if s:module_info_cur_buf
- hi def link javaModuleStorageClass StorageClass
- hi def link javaModuleStmt Statement
- hi def link javaModuleExternal Include
+if g:main_syntax == 'java'
+ unlet g:main_syntax
endif
-let b:current_syntax = "java"
+if exists("s:clear_java_ignore_html")
+ unlet! s:clear_java_ignore_html g:java_ignore_html
+endif
-if main_syntax == 'java'
- unlet main_syntax
+if exists("s:clear_java_ignore_markdown")
+ unlet! s:clear_java_ignore_markdown g:java_ignore_markdown
endif
let b:spell_options = "contained"
let &cpo = s:cpo_save
-unlet s:module_info_cur_buf s:ff s:cpo_save
+unlet s:cpo_save s:ff s:with_html s:with_markdown
-" vim: sw=2 ts=8 noet sta
+" See ":help vim9-mix".
+if !has("vim9script")
+ finish
+endif
+
+if exists("g:java_foldtext_show_first_or_second_line")
+ def! s:LazyPrefix(prefix: string, dashes: string, count: number): string
+ return empty(prefix)
+ ? printf('+-%s%3d lines: ', dashes, count)
+ : prefix
+ enddef
+
+ def! s:JavaSyntaxFoldTextExpr(): string
+ # Piggyback on NGETTEXT.
+ const summary: string = foldtext()
+ return getline(v:foldstart) !~ '/\*\+\s*$'
+ ? summary
+ : LazyPrefix(matchstr(summary, '^+-\+\s*\d\+\s.\{-1,}:\s'),
+ v:folddashes,
+ (v:foldend - v:foldstart + 1)) ..
+ getline(v:foldstart + 1)
+ enddef
+
+ setlocal foldtext=s:JavaSyntaxFoldTextExpr()
+ delfunction! g:JavaSyntaxFoldTextExpr
+endif
+" vim: fdm=syntax sw=2 ts=8 noet sta
diff --git a/runtime/syntax/javascript.vim b/runtime/syntax/javascript.vim
index e3b4cdf703..c73f5d7097 100644
--- a/runtime/syntax/javascript.vim
+++ b/runtime/syntax/javascript.vim
@@ -10,6 +10,7 @@
" Last Change: 2022 Jun 09
" 2013 Jun 12: adjusted javaScriptRegexpString (Kevin Locke)
" 2018 Apr 14: adjusted javaScriptRegexpString (LongJohnCoder)
+" 2024 Aug 14: fix a few stylistic issues (#15480)
" tuning parameters:
" unlet javaScript_fold
@@ -59,14 +60,15 @@ syn keyword javaScriptType Array Boolean Date Function Number Object String Reg
syn keyword javaScriptStatement return with await yield
syn keyword javaScriptBoolean true false
syn keyword javaScriptNull null undefined
-syn keyword javaScriptIdentifier arguments this var let
+syn keyword javaScriptIdentifier arguments this
syn keyword javaScriptLabel case default
syn keyword javaScriptException try catch finally throw
syn keyword javaScriptMessage alert confirm prompt status
syn keyword javaScriptGlobal self window top parent
syn keyword javaScriptMember document event location
syn keyword javaScriptDeprecated escape unescape
-syn keyword javaScriptReserved abstract boolean byte char class const debugger double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile async
+syn keyword javaScriptReserved abstract boolean byte char class const debugger double enum export extends final float from goto implements import int interface let long native package private protected public short super synchronized throws transient var volatile async
+syn keyword javaScriptModifier static
syn cluster javaScriptEmbededExpr contains=javaScriptBoolean,javaScriptNull,javaScriptIdentifier,javaScriptStringD,javaScriptStringS,javaScriptStringT
@@ -110,7 +112,7 @@ hi def link javaScriptBranch Conditional
hi def link javaScriptOperator Operator
hi def link javaScriptType Type
hi def link javaScriptStatement Statement
-hi def link javaScriptFunction Function
+hi def link javaScriptFunction Keyword
hi def link javaScriptBraces Function
hi def link javaScriptError Error
hi def link javaScrParenError javaScriptError
@@ -126,6 +128,7 @@ hi def link javaScriptGlobal Keyword
hi def link javaScriptMember Keyword
hi def link javaScriptDeprecated Exception
hi def link javaScriptReserved Keyword
+hi def link javaScriptModifier StorageClass
hi def link javaScriptDebug Debug
hi def link javaScriptConstant Label
hi def link javaScriptEmbed Special
diff --git a/runtime/syntax/jinja.vim b/runtime/syntax/jinja.vim
new file mode 100644
index 0000000000..6000855ff7
--- /dev/null
+++ b/runtime/syntax/jinja.vim
@@ -0,0 +1,86 @@
+" Vim syntax file
+" Language: Jinja
+" Maintainer: Gregory Anders
+" Upstream: https://gitlab.com/HiPhish/jinja.vim
+
+if exists('b:current_syntax')
+ finish
+endif
+
+syntax case match
+syntax sync fromstart
+
+" Jinja template built-in tags and parameters (without filter, macro, is and raw, they
+" have special threatment)
+syn keyword jinjaStatement containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained and if else in not or recursive as import
+
+syn keyword jinjaStatement containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained is filter skipwhite nextgroup=jinjaFilter
+syn keyword jinjaStatement containedin=jinjaTagBlock contained macro skipwhite nextgroup=jinjaFunction
+syn keyword jinjaStatement containedin=jinjaTagBlock contained block skipwhite nextgroup=jinjaBlockName
+
+" Variable Names
+syn match jinjaVariable containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /[a-zA-Z_][a-zA-Z0-9_]*/
+syn keyword jinjaSpecial containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained false true none False True None loop super caller varargs kwargs
+
+" Filters
+syn match jinjaOperator "|" containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained skipwhite nextgroup=jinjaFilter
+syn match jinjaFilter contained /[a-zA-Z_][a-zA-Z0-9_]*/
+syn match jinjaFunction contained /[a-zA-Z_][a-zA-Z0-9_]*/
+syn match jinjaBlockName contained /[a-zA-Z_][a-zA-Z0-9_]*/
+
+" Jinja template constants
+syn region jinjaString containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained start=/"/ skip=/\(\\\)\@<!\(\(\\\\\)\@>\)*\\"/ end=/"/
+syn region jinjaString containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained start=/'/ skip=/\(\\\)\@<!\(\(\\\\\)\@>\)*\\'/ end=/'/
+syn match jinjaNumber containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /[0-9]\+\(\.[0-9]\+\)\?/
+
+" Operators
+syn match jinjaOperator containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /[+\-*\/<>=!,:]/
+syn match jinjaPunctuation containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /[()\[\]]/
+syn match jinjaOperator containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained /\./ nextgroup=jinjaAttribute
+syn match jinjaAttribute contained /[a-zA-Z_][a-zA-Z0-9_]*/
+
+" Jinja template tag and variable blocks
+syn region jinjaNested matchgroup=jinjaOperator start="(" end=")" transparent display containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained
+syn region jinjaNested matchgroup=jinjaOperator start="\[" end="\]" transparent display containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained
+syn region jinjaNested matchgroup=jinjaOperator start="{" end="}" transparent display containedin=jinjaVarBlock,jinjaTagBlock,jinjaNested contained
+syn region jinjaTagBlock matchgroup=jinjaTagDelim start=/{%-\?/ end=/-\?%}/ containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment
+
+syn region jinjaVarBlock matchgroup=jinjaVarDelim start=/{{-\?/ end=/-\?}}/ containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaRaw,jinjaString,jinjaNested,jinjaComment
+
+" Jinja template 'raw' tag
+syn region jinjaRaw matchgroup=jinjaRawDelim start="{%\s*raw\s*%}" end="{%\s*endraw\s*%}" containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaString,jinjaComment
+
+" Jinja comments
+syn region jinjaComment matchgroup=jinjaCommentDelim start="{#" end="#}" containedin=ALLBUT,jinjaTagBlock,jinjaVarBlock,jinjaString
+
+" Block start keywords. A bit tricker. We only highlight at the start of a
+" tag block and only if the name is not followed by a comma or equals sign
+" which usually means that we have to deal with an assignment.
+syn match jinjaStatement containedin=jinjaTagBlock contained /\({%-\?\s*\)\@<=\<[a-zA-Z_][a-zA-Z0-9_]*\>\(\s*[,=]\)\@!/
+
+" and context modifiers
+syn match jinjaStatement containedin=jinjaTagBlock contained /\<with\(out\)\?\s\+context\>/
+
+hi def link jinjaPunctuation jinjaOperator
+hi def link jinjaAttribute jinjaVariable
+hi def link jinjaFunction jinjaFilter
+
+hi def link jinjaTagDelim jinjaTagBlock
+hi def link jinjaVarDelim jinjaVarBlock
+hi def link jinjaCommentDelim jinjaComment
+hi def link jinjaRawDelim jinja
+
+hi def link jinjaSpecial Special
+hi def link jinjaOperator Normal
+hi def link jinjaRaw Normal
+hi def link jinjaTagBlock PreProc
+hi def link jinjaVarBlock PreProc
+hi def link jinjaStatement Statement
+hi def link jinjaFilter Function
+hi def link jinjaBlockName Function
+hi def link jinjaVariable Identifier
+hi def link jinjaString Constant
+hi def link jinjaNumber Constant
+hi def link jinjaComment Comment
+
+let b:current_syntax = 'jinja'
diff --git a/runtime/syntax/kconfig.vim b/runtime/syntax/kconfig.vim
index c7a305b73c..0aecc00060 100644
--- a/runtime/syntax/kconfig.vim
+++ b/runtime/syntax/kconfig.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Maintainer: Christian Brabandt <cb@256bit.org>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2015-05-29
+" Latest Revision: 2024-07-19
" License: Vim (see :h license)
" Repository: https://github.com/chrisbra/vim-kconfig
@@ -715,8 +715,6 @@ syn region kconfigHelpText
\ skip='^$'
\ end='^\z1\@!'
-syn sync match kconfigSyncHelp grouphere kconfigHelpText 'help\|---help---'
-
hi def link kconfigTodo Todo
hi def link kconfigComment Comment
hi def link kconfigKeyword Keyword
diff --git a/runtime/syntax/kdl.vim b/runtime/syntax/kdl.vim
new file mode 100644
index 0000000000..97e8f93b61
--- /dev/null
+++ b/runtime/syntax/kdl.vim
@@ -0,0 +1,48 @@
+" Vim syntax file
+" Language: KDL
+" Maintainer: Aram Drevekenin <aram@poor.dev>
+" Maintainer: Yinzuo Jiang <jiangyinzuo@foxmail.com>
+" Latest Revision: 2024-06-16
+
+" quit when a syntax file was already loaded
+if exists("b:current_syntax")
+ finish
+endif
+
+syn match kdlNode '\v(\w|-|\=)' display
+syn match kdlBool '\v(true|false)' display
+
+syn keyword kdlTodo contained TODO FIXME XXX NOTE
+syn region kdlComment start="//" end="$" contains=kdlTodo,@Spell
+syn region kdlComment start="/\*" end="\*/" contains=kdlTodo,@Spell
+
+" Regular int like number with - + or nothing in front
+syn match kdlNumber '\d\+'
+syn match kdlNumber '[-+]\d\+'
+
+" Floating point number with decimal no E or e (+,-)
+syn match kdlNumber '\d\+\.\d*' contained display
+syn match kdlNumber '[-+]\d\+\.\d*' contained display
+
+" Floating point like number with E and no decimal point (+,-)
+syn match kdlNumber '[-+]\=\d[[:digit:]]*[eE][\-+]\=\d\+' contained display
+syn match kdlNumber '\d[[:digit:]]*[eE][\-+]\=\d\+' contained display
+
+" Floating point like number with E and decimal point (+,-)
+syn match kdlNumber '[-+]\=\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+' contained display
+syn match kdlNumber '\d[[:digit:]]*\.\d*[eE][\-+]\=\d\+' contained display
+
+syn region kdlString start='"' end='"' skip='\\\\\|\\"' display
+
+syn region kdlChildren start="{" end="}" contains=kdlString,kdlNumber,kdlNode,kdlBool,kdlComment
+
+hi def link kdlTodo Todo
+hi def link kdlComment Comment
+hi def link kdlNode Statement
+hi def link kdlBool Boolean
+hi def link kdlString String
+hi def link kdlNumber Number
+
+let b:current_syntax = "kdl"
+
+" vim: sw=2 sts=2 et
diff --git a/runtime/syntax/kivy.vim b/runtime/syntax/kivy.vim
index b145503478..d4bccfc147 100644
--- a/runtime/syntax/kivy.vim
+++ b/runtime/syntax/kivy.vim
@@ -1,9 +1,9 @@
" Vim syntax file
" Language: Kivy
-" Maintainer: Corey Prophitt <prophitt.corey@gmail.com>
-" Last Change: May 29th, 2014
+" Maintainer: Corey Prophitt <corey@prophitt.me>
+" Last Change: Jul 31st, 2024
" Version: 1
-" URL: http://kivy.org/
+" URL: https://kivy.org/
if exists("b:current_syntax")
finish
@@ -13,11 +13,11 @@ endif
syn include @pyth $VIMRUNTIME/syntax/python.vim
" Kivy language rules can be found here
-" http://kivy.org/docs/guide/lang.html
+" https://kivy.org/doc/stable/guide/lang.html
" Define Kivy syntax
syn match kivyPreProc /#:.*/
-syn match kivyComment /#.*/
+syn match kivyComment /#[^:].*/
syn match kivyRule /<\I\i*\(,\s*\I\i*\)*>:/
syn match kivyAttribute /\<\I\i*\>/ nextgroup=kivyValue
diff --git a/runtime/syntax/lc.vim b/runtime/syntax/lc.vim
index a334529385..1991c1b582 100644
--- a/runtime/syntax/lc.vim
+++ b/runtime/syntax/lc.vim
@@ -2,6 +2,7 @@
" Language: Elsa
" Maintainer: Miles Glapa-Grossklag <miles@glapa-grossklag.com>
" Last Change: 2023-01-29
+" 2024 May 25 by Riley Bruins <ribru17@gmail.com> (move 'commentstring' to ftplugin)
if exists('b:current_syntax')
finish
@@ -13,7 +14,6 @@ syntax match elsaKeyword "\v:"
highlight link elsaKeyword Keyword
" Comments
-setlocal commentstring=--%s
syntax match elsaComment "\v--.*$"
highlight link elsaComment Comment
diff --git a/runtime/syntax/logindefs.vim b/runtime/syntax/logindefs.vim
index 8cb4295eda..51fa19992c 100644
--- a/runtime/syntax/logindefs.vim
+++ b/runtime/syntax/logindefs.vim
@@ -1,7 +1,8 @@
-" Vim syntax file
+" Vim syntax file for login.defs(5)
" Language: login.defs(5) configuration file
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2010-11-29
+" 2024 Jul 12 by Vim Project: Update keywords
if exists("b:current_syntax")
finish
@@ -35,6 +36,8 @@ syn keyword logindefsBooleanKeyword contained
\ CREATE_HOME
\ DEFAULT_HOME
\ FAILLOG_ENAB
+ \ FORCE_SHADOW
+ \ GRANT_AUX_GROUP_SUBIDS
\ LASTLOG_ENAB
\ LOG_OK_LOGINS
\ LOG_UNKFAIL_ENAB
@@ -54,15 +57,20 @@ syn keyword logindefsBoolean contained yes no
syn keyword logindefsEncryptKeyword contained
\ ENCRYPT_METHOD
+ \ HMAC_CRYPTO_ALGO
\ nextgroup=logindefsEncryptMethod skipwhite
syn keyword logindefsEncryptMethod contained
+ \ BCRYPT
\ DES
\ MD5
\ SHA256
\ SHA512
+ \ YESCRYPT
syn keyword logindefsNumberKeyword contained
+ \ BCRYPT_MAX_ROUNDS
+ \ BCRYPT_MIN_ROUNDS
\ ERASECHAR
\ FAIL_DELAY
\ GID_MAX
@@ -79,6 +87,12 @@ syn keyword logindefsNumberKeyword contained
\ PASS_MIN_LEN
\ SHA_CRYPT_MAX_ROUNDS
\ SHA_CRYPT_MIN_ROUNDS
+ \ SUB_GID_COUNT
+ \ SUB_GID_MAX
+ \ SUB_GID_MIN
+ \ SUB_UID_COUNT
+ \ SUB_UID_MAX
+ \ SUB_UID_MIN
\ SYS_GID_MAX
\ SYS_GID_MIN
\ SYS_UID_MAX
@@ -86,9 +100,15 @@ syn keyword logindefsNumberKeyword contained
\ UID_MAX
\ UID_MIN
\ ULIMIT
- \ UMASK
+ \ YESCRYPT_COST_FACTOR
\ nextgroup=@logindefsNumber skipwhite
+syn keyword logindefsNumberKeyword contained
+ \ HOME_MODE
+ \ TTYPERM
+ \ UMASK
+ \ nextgroup=logindefsOctal,logindefsOctalError skipwhite
+
syn cluster logindefsNumber contains=
\ logindefsDecimal,
\ logindefsHex,
@@ -114,6 +134,7 @@ syn keyword logindefsPathKeyword contained
\ MAIL_DIR
\ MAIL_FILE
\ NOLOGINS_FILE
+ \ NONEXISTENT
\ SULOG_FILE
\ TTYTYPE_FILE
\ nextgroup=logindefsPath skipwhite
@@ -138,9 +159,9 @@ syn keyword logindefsStringKeyword contained
\ ENV_HZ
\ ENV_TZ
\ LOGIN_STRING
+ \ PREVENT_NO_AUTH
\ SU_NAME
\ TTYGROUP
- \ TTYPERM
\ USERDEL_CMD
\ nextgroup=logindefsString skipwhite
diff --git a/runtime/syntax/lyrics.vim b/runtime/syntax/lyrics.vim
index 42a288b51b..fd127988f2 100644
--- a/runtime/syntax/lyrics.vim
+++ b/runtime/syntax/lyrics.vim
@@ -2,7 +2,7 @@
" Language: LyRiCs
" Maintainer: ObserverOfTime <chronobserver@disroot.org>
" Filenames: *.lrc
-" Last Change: 2022 Sep 18
+" Last Change: 2024 Sep 20
if exists('b:current_syntax')
finish
@@ -23,7 +23,7 @@ syn match lrcTagName contained nextgroup=lrcTagValue
syn match lrcTagValue /:\zs.\+\ze\]/ contained
" Lyrics
-syn match lrcLyricTime /^\s*\[\d\d:\d\d\.\d\d\]/
+syn match lrcLyricTime /^\s*\(\[\d\d:\d\d\.\d\d\]\)\+/
\ contains=lrcNumber nextgroup=lrcLyricLine
syn match lrcLyricLine /.*$/ contained contains=lrcWordTime,@Spell
syn match lrcWordTime /<\d\d:\d\d\.\d\d>/ contained contains=lrcNumber,@NoSpell
diff --git a/runtime/syntax/make.vim b/runtime/syntax/make.vim
index b4573044ca..d3ddf78291 100644
--- a/runtime/syntax/make.vim
+++ b/runtime/syntax/make.vim
@@ -28,8 +28,13 @@ syn match makePreCondit "^!\s*\(cmdswitches\|error\|message\|include\|if\|ifdef\
syn case match
" identifiers
-syn region makeIdent start="\$(" skip="\\)\|\\\\" end=")" contains=makeStatement,makeIdent
-syn region makeIdent start="\${" skip="\\}\|\\\\" end="}" contains=makeStatement,makeIdent
+if exists("b:make_microsoft") || exists("make_microsoft")
+ syn region makeIdent start="\$(" end=")" contains=makeStatement,makeIdent
+ syn region makeIdent start="\${" end="}" contains=makeStatement,makeIdent
+else
+ syn region makeIdent start="\$(" skip="\\)\|\\\\" end=")" contains=makeStatement,makeIdent
+ syn region makeIdent start="\${" skip="\\}\|\\\\" end="}" contains=makeStatement,makeIdent
+endif
syn match makeIdent "\$\$\w*"
syn match makeIdent "\$[^({]"
syn match makeIdent "^ *[^:#= \t]*\s*[:+?!*]="me=e-2
@@ -78,11 +83,13 @@ syn match makeOverride "^ *override\>"
syn match makeStatement contained "(\(abspath\|addprefix\|addsuffix\|and\|basename\|call\|dir\|error\|eval\|file\|filter-out\|filter\|findstring\|firstword\|flavor\|foreach\|guile\|if\|info\|join\|lastword\|notdir\|or\|origin\|patsubst\|realpath\|shell\|sort\|strip\|subst\|suffix\|value\|warning\|wildcard\|word\|wordlist\|words\)\>"ms=s+1
" Comment
-if exists("make_microsoft")
- syn match makeComment "#.*" contains=@Spell,makeTodo
-elseif !exists("make_no_comments")
- syn region makeComment start="#" end="^$" end="[^\\]$" keepend contains=@Spell,makeTodo
- syn match makeComment "#$" contains=@Spell
+if !exists("make_no_comments")
+ if exists("b:make_microsoft") || exists("make_microsoft")
+ syn match makeComment "#.*" contains=@Spell,makeTodo
+ else
+ syn region makeComment start="#" end="^$" end="[^\\]$" keepend contains=@Spell,makeTodo
+ syn match makeComment "#$" contains=@Spell
+ endif
endif
syn keyword makeTodo TODO FIXME XXX contained
diff --git a/runtime/syntax/mediawiki.vim b/runtime/syntax/mediawiki.vim
new file mode 100644
index 0000000000..8ac30b93db
--- /dev/null
+++ b/runtime/syntax/mediawiki.vim
@@ -0,0 +1,292 @@
+" mediawiki.vim (formerly named Wikipedia.vim)
+"
+" Vim syntax file
+" Language: MediaWiki
+" Maintainer: Avid Seeker <avidseeker7@protonmail.com>
+" Home: http://en.wikipedia.org/wiki/Wikipedia:Text_editor_support#Vim
+" Last Change: 2024 Jul 14
+" Credits: [[User:Unforgettableid]] [[User:Aepd87]], [[User:Danny373]], [[User:Ingo Karkat]], et al.
+"
+" Published on Wikipedia in 2003-04 and declared authorless.
+"
+" Based on the HTML syntax file. Probably too closely based, in fact.
+" There may well be name collisions everywhere, but ignorance is bliss,
+" so they say.
+"
+
+if exists("b:current_syntax")
+ finish
+endif
+
+syntax case ignore
+syntax spell toplevel
+
+" Mark illegal characters
+sy match htmlError "[<>&]"
+
+" Tags
+sy region htmlString contained start=+"+ end=+"+ contains=htmlSpecialChar,@htmlPreproc
+sy region htmlString contained start=+'+ end=+'+ contains=htmlSpecialChar,@htmlPreproc
+sy match htmlValue contained "=[\t ]*[^'" \t>][^ \t>]*"hs=s+1 contains=@htmlPreproc
+sy region htmlEndTag start=+</+ end=+>+ contains=htmlTagN,htmlTagError
+sy region htmlTag start=+<[^/]+ end=+>+ contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster
+sy match htmlTagN contained +<\s*[-a-zA-Z0-9]\++hs=s+1 contains=htmlTagName,htmlSpecialTagName,@htmlTagNameCluster
+sy match htmlTagN contained +</\s*[-a-zA-Z0-9]\++hs=s+2 contains=htmlTagName,htmlSpecialTagName,@htmlTagNameCluster
+sy match htmlTagError contained "[^>]<"ms=s+1
+
+" Allowed HTML tag names
+sy keyword htmlTagName contained big blockquote br caption center cite code
+sy keyword htmlTagName contained dd del div dl dt font hr ins li
+sy keyword htmlTagName contained ol p pre rb rp rt ruby s small span strike sub
+sy keyword htmlTagName contained sup table td th tr tt ul var
+sy match htmlTagName contained "\<\(b\|i\|u\|h[1-6]\|em\|strong\)\>"
+" Allowed Wiki tag names
+sy keyword htmlTagName contained math nowiki references source syntaxhighlight
+
+" Allowed arg names
+sy keyword htmlArg contained align lang dir width height nowrap bgcolor clear
+sy keyword htmlArg contained noshade cite datetime size face color type start
+sy keyword htmlArg contained value compact summary border frame rules
+sy keyword htmlArg contained cellspacing cellpadding valign char charoff
+sy keyword htmlArg contained colgroup col span abbr axis headers scope rowspan
+sy keyword htmlArg contained colspan id class name style title
+
+" Special characters
+sy match htmlSpecialChar "&#\=[0-9A-Za-z]\{1,8};"
+
+" Comments
+sy region htmlComment start=+<!+ end=+>+ contains=htmlCommentPart,htmlCommentError
+sy match htmlCommentError contained "[^><!]"
+sy region htmlCommentPart contained start=+--+ end=+--\s*+ contains=@htmlPreProc
+sy region htmlComment start=+<!DOCTYPE+ keepend end=+>+
+
+if !exists("html_no_rendering")
+ sy cluster htmlTop contains=@Spell,htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment,htmlLink,@htmlPreproc
+
+ sy region htmlBold start="<b\>" end="</b>"me=e-4 contains=@htmlTop,htmlBoldUnderline,htmlBoldItalic
+ sy region htmlBold start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop,htmlBoldUnderline,htmlBoldItalic
+ sy region htmlBoldUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlBoldUnderlineItalic
+ sy region htmlBoldItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop,htmlBoldItalicUnderline
+ sy region htmlBoldItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop,htmlBoldItalicUnderline
+ sy region htmlBoldUnderlineItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop
+ sy region htmlBoldUnderlineItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop
+ sy region htmlBoldItalicUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlBoldUnderlineItalic
+
+ sy region htmlUnderline start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlUnderlineBold,htmlUnderlineItalic
+ sy region htmlUnderlineBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop,htmlUnderlineBoldItalic
+ sy region htmlUnderlineBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop,htmlUnderlineBoldItalic
+ sy region htmlUnderlineItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop,htmlUnderlineItalicBold
+ sy region htmlUnderlineItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop,htmlUnderlineItalicBold
+ sy region htmlUnderlineItalicBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop
+ sy region htmlUnderlineItalicBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop
+ sy region htmlUnderlineBoldItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop
+ sy region htmlUnderlineBoldItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop
+
+ sy region htmlItalic start="<i\>" end="</i>"me=e-4 contains=@htmlTop,htmlItalicBold,htmlItalicUnderline
+ sy region htmlItalic start="<em\>" end="</em>"me=e-5 contains=@htmlTop
+ sy region htmlItalicBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop,htmlItalicBoldUnderline
+ sy region htmlItalicBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop,htmlItalicBoldUnderline
+ sy region htmlItalicBoldUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop
+ sy region htmlItalicUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlItalicUnderlineBold
+ sy region htmlItalicUnderlineBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop
+ sy region htmlItalicUnderlineBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop
+
+ sy region htmlH1 start="<h1\>" end="</h1>"me=e-5 contains=@htmlTop
+ sy region htmlH2 start="<h2\>" end="</h2>"me=e-5 contains=@htmlTop
+ sy region htmlH3 start="<h3\>" end="</h3>"me=e-5 contains=@htmlTop
+ sy region htmlH4 start="<h4\>" end="</h4>"me=e-5 contains=@htmlTop
+ sy region htmlH5 start="<h5\>" end="</h5>"me=e-5 contains=@htmlTop
+ sy region htmlH6 start="<h6\>" end="</h6>"me=e-5 contains=@htmlTop
+endif
+
+
+" No htmlTop and wikiPre inside HTML preformatted areas, because
+" MediaWiki renders everything in there literally (HTML tags and
+" entities, too): <pre> tags work as the combination of <nowiki> and
+" the standard HTML <pre> tag: the content will preformatted, and it
+" will not be parsed, but shown as in the wikitext source.
+"
+" With wikiPre, indented lines would be rendered differently from
+" unindented lines.
+sy match htmlPreTag /<pre\>[^>]*>/ contains=htmlTag
+sy match htmlPreEndTag /<\/pre>/ contains=htmlEndTag
+sy match wikiNowikiTag /<nowiki>/ contains=htmlTag
+sy match wikiNowikiEndTag /<\/nowiki>/ contains=htmlEndTag
+sy match wikiSourceTag /<source\s\+[^>]\+>/ contains=htmlTag
+sy match wikiSourceEndTag /<\/source>/ contains=htmlEndTag
+sy match wikiSyntaxHLTag /<syntaxhighlight\s\+[^>]\+>/ contains=htmlTag
+sy match wikiSyntaxHLEndTag /<\/syntaxhighlight>/ contains=htmlEndTag
+
+" Note: Cannot use 'start="<pre>"rs=e', so still have the <pre> tag
+" highlighted correctly via separate sy-match. Unfortunately, this will
+" also highlight <pre> tags inside the preformatted region.
+sy region htmlPre start="<pre\>[^>]*>" end="<\/pre>"me=e-6 contains=htmlPreTag
+sy region wikiNowiki start="<nowiki>" end="<\/nowiki>"me=e-9 contains=wikiNowikiTag
+sy region wikiSource start="<source\s\+[^>]\+>" keepend end="<\/source>"me=e-9 contains=wikiSourceTag
+sy region wikiSyntaxHL start="<syntaxhighlight\s\+[^>]\+>" keepend end="<\/syntaxhighlight>"me=e-18 contains=wikiSyntaxHLTag
+
+sy include @TeX syntax/tex.vim
+unlet b:current_syntax
+sy region wikiTeX matchgroup=htmlTag start="<math>" end="<\/math>" contains=@texMathZoneGroup,wikiNowiki,wikiNowikiEndTag
+sy region wikiRef matchgroup=htmlTag start="<ref>" end="<\/ref>" contains=wikiNowiki,wikiNowikiEndTag
+
+sy cluster wikiText contains=wikiLink,wikiTemplate,wikiNowiki,wikiNowikiEndTag,wikiItalic,wikiBold,wikiBoldAndItalic
+
+" Tables
+sy cluster wikiTableFormat contains=wikiTemplate,htmlString,htmlArg,htmlValue
+sy region wikiTable matchgroup=wikiTableSeparator start="{|" end="|}" contains=wikiTableHeaderLine,wikiTableCaptionLine,wikiTableNewRow,wikiTableHeadingCell,wikiTableNormalCell,@wikiText
+sy match wikiTableSeparator /^!/ contained
+sy match wikiTableSeparator /^|/ contained
+sy match wikiTableSeparator /^|[+-]/ contained
+sy match wikiTableSeparator /||/ contained
+sy match wikiTableSeparator /!!/ contained
+sy match wikiTableFormatEnd /[!|]/ contained
+sy match wikiTableHeadingCell /\(^!\|!!\)\([^!|]*|\)\?.*/ contains=wikiTableSeparator,@wikiText,wikiTableHeadingFormat
+" Require at least one '=' in the format, to avoid spurious matches (e.g.
+" the | in [[foo|bar]] might be taken as the final |, indicating the beginning
+" of the cell). The same is done for wikiTableNormalFormat below.
+sy match wikiTableHeadingFormat /\%(^!\|!!\)[^!|]\+=[^!|]\+\([!|]\)\(\1\)\@!/me=e-1 contains=@wikiTableFormat,wikiTableSeparator nextgroup=wikiTableFormatEnd
+sy match wikiTableNormalCell /\(^|\|||\)\([^|]*|\)\?.*/ contains=wikiTableSeparator,@wikiText,wikiTableNormalFormat
+sy match wikiTableNormalFormat /\(^|\|||\)[^|]\+=[^|]\+||\@!/me=e-1 contains=@wikiTableFormat,wikiTableSeparator nextgroup=wikiTableFormatEnd
+sy match wikiTableHeaderLine /\(^{|\)\@<=.*$/ contained contains=@wikiTableFormat
+sy match wikiTableCaptionLine /^|+.*$/ contained contains=wikiTableSeparator,@wikiText
+sy match wikiTableNewRow /^|-.*$/ contained contains=wikiTableSeparator,@wikiTableFormat
+
+sy cluster wikiTop contains=@Spell,wikiLink,wikiNowiki,wikiNowikiEndTag
+
+sy region wikiItalic start=+'\@<!'''\@!+ end=+''+ oneline contains=@wikiTop,wikiItalicBold
+sy region wikiBold start=+'''+ end=+'''+ oneline contains=@wikiTop,wikiBoldItalic
+sy region wikiBoldAndItalic start=+'''''+ end=+'''''+ oneline contains=@wikiTop
+
+sy region wikiBoldItalic contained start=+'\@<!'''\@!+ end=+''+ oneline contains=@wikiTop
+sy region wikiItalicBold contained start=+'''+ end=+'''+ oneline contains=@wikiTop
+
+sy region wikiH1 start="^=" end="=" oneline contains=@wikiTop
+sy region wikiH2 start="^==" end="==" oneline contains=@wikiTop
+sy region wikiH3 start="^===" end="===" oneline contains=@wikiTop
+sy region wikiH4 start="^====" end="====" oneline contains=@wikiTop
+sy region wikiH5 start="^=====" end="=====" oneline contains=@wikiTop
+sy region wikiH6 start="^======" end="======" oneline contains=@wikiTop
+
+sy region wikiLink start="\[\[" end="\]\]\(s\|'s\|es\|ing\|\)" oneline contains=wikiLink,wikiNowiki,wikiNowikiEndTag
+
+sy region wikiLink start="https\?://" end="\W*\_s"me=s-1 oneline
+sy region wikiLink start="\[http:" end="\]" oneline contains=wikiNowiki,wikiNowikiEndTag
+sy region wikiLink start="\[https:" end="\]" oneline contains=wikiNowiki,wikiNowikiEndTag
+sy region wikiLink start="\[ftp:" end="\]" oneline contains=wikiNowiki,wikiNowikiEndTag
+sy region wikiLink start="\[gopher:" end="\]" oneline contains=wikiNowiki,wikiNowikiEndTag
+sy region wikiLink start="\[news:" end="\]" oneline contains=wikiNowiki,wikiNowikiEndTag
+sy region wikiLink start="\[mailto:" end="\]" oneline contains=wikiNowiki,wikiNowikiEndTag
+
+sy match wikiTemplateName /{{[^{|}<>\[\]]\+/hs=s+2 contained
+sy region wikiTemplate start="{{" end="}}" keepend extend contains=wikiNowiki,wikiNowikiEndTag,wikiTemplateName,wikiTemplateParam,wikiTemplate,wikiLink
+sy region wikiTemplateParam start="{{{\s*\d" end="}}}" extend contains=wikiTemplateName
+
+sy match wikiParaFormatChar /^[\:|\*|;|#]\+/
+sy match wikiParaFormatChar /^-----*/
+sy match wikiPre /^\ .*$/ contains=wikiNowiki,wikiNowikiEndTag
+
+" HTML highlighting
+
+hi def link htmlTag Function
+hi def link htmlEndTag Identifier
+hi def link htmlArg Type
+hi def link htmlTagName htmlStatement
+hi def link htmlSpecialTagName Exception
+hi def link htmlValue String
+hi def link htmlSpecialChar Special
+
+if !exists("html_no_rendering")
+ hi def link htmlTitle Title
+ hi def link htmlH1 htmlTitle
+ hi def link htmlH2 htmlTitle
+ hi def link htmlH3 htmlTitle
+ hi def link htmlH4 htmlTitle
+ hi def link htmlH5 htmlTitle
+ hi def link htmlH6 htmlTitle
+
+ hi def link htmlPreProc PreProc
+ hi def link htmlHead htmlPreProc
+ hi def link htmlPreProcAttrName htmlPreProc
+ hi def link htmlPreStmt htmlPreProc
+
+ hi def link htmlSpecial Special
+ hi def link htmlCssDefinition htmlSpecial
+ hi def link htmlEvent htmlSpecial
+ hi def link htmlSpecialChar htmlSpecial
+
+ hi def link htmlComment Comment
+ hi def link htmlCommentPart htmlComment
+ hi def link htmlCssStyleComment htmlComment
+
+ hi def link htmlString String
+ hi def link htmlPreAttr htmlString
+ hi def link htmlValue htmlString
+
+ hi def link htmlError Error
+ hi def link htmlBadArg htmlError
+ hi def link htmlBadTag htmlError
+ hi def link htmlCommentError htmlError
+ hi def link htmlPreError htmlError
+ hi def link htmlPreProcAttrError htmlError
+ hi def link htmlTagError htmlError
+
+ hi def link htmlStatement Statement
+
+ hi def link htmlConstant Constant
+
+ hi def link htmlBoldItalicUnderline htmlBoldUnderlineItalic
+ hi def link htmlUnderlineItalicBold htmlBoldUnderlineItalic
+ hi def link htmlUnderlineBoldItalic htmlBoldUnderlineItalic
+ hi def link htmlItalicBoldUnderline htmlBoldUnderlineItalic
+ hi def link htmlItalicUnderlineBold htmlBoldUnderlineItalic
+
+ hi def link htmlItalicBold htmlBoldItalic
+ hi def link htmlItalicUnderline htmlUnderlineItalic
+ hi def link htmlUnderlineBold htmlBoldUnderline
+
+ hi def link htmlLink Underlined
+
+ if !exists("html_style_rendering")
+ hi def htmlBold term=bold cterm=bold gui=bold
+ hi def htmlBoldUnderline term=bold,underline cterm=bold,underline gui=bold,underline
+ hi def htmlBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic
+ hi def htmlBoldUnderlineItalic term=bold,italic,underline cterm=bold,italic,underline gui=bold,italic,underline
+ hi def htmlUnderline term=underline cterm=underline gui=underline
+ hi def htmlUnderlineItalic term=italic,underline cterm=italic,underline gui=italic,underline
+ hi def htmlItalic term=italic cterm=italic gui=italic
+ endif
+endif
+
+" Wiki highlighting
+
+hi def link wikiItalic htmlItalic
+hi def link wikiBold htmlBold
+hi def link wikiBoldItalic htmlBoldItalic
+hi def link wikiItalicBold htmlBoldItalic
+hi def link wikiBoldAndItalic htmlBoldItalic
+
+hi def link wikiH1 htmlTitle
+hi def link wikiH2 htmlTitle
+hi def link wikiH3 htmlTitle
+hi def link wikiH4 htmlTitle
+hi def link wikiH5 htmlTitle
+hi def link wikiH6 htmlTitle
+
+hi def link wikiLink htmlLink
+hi def link wikiTemplate htmlSpecial
+hi def link wikiTemplateParam htmlSpecial
+hi def link wikiTemplateName Type
+hi def link wikiParaFormatChar htmlSpecial
+hi def link wikiPre htmlConstant
+hi def link wikiRef htmlComment
+
+hi def link htmlPre wikiPre
+hi def link wikiSource wikiPre
+hi def link wikiSyntaxHL wikiPre
+
+hi def link wikiTableSeparator Statement
+hi def link wikiTableFormatEnd wikiTableSeparator
+hi def link wikiTableHeadingCell htmlBold
+
+let b:current_syntax = "mediawiki"
diff --git a/runtime/syntax/mma.vim b/runtime/syntax/mma.vim
index d2f22e9be5..802cbe5538 100644
--- a/runtime/syntax/mma.vim
+++ b/runtime/syntax/mma.vim
@@ -2,6 +2,7 @@
" Language: Mathematica
" Maintainer: steve layland <layland@wolfram.com>
" Last Change: 2012 Feb 03 by Thilo Six
+" 2024 May 24 by Riley Bruins <ribru17@gmail.com> (remove 'commentstring')
" Source: http://members.wri.com/layland/vim/syntax/mma.vim
" http://vim.sourceforge.net/scripts/script.php?script_id=1273
" Id: $Id: mma.vim,v 1.4 2006/04/14 20:40:38 vimboss Exp $
@@ -248,7 +249,6 @@ syntax match mmaBoring "[(){}]" contained
"syntax region mmaRegion start="(\*\+[^<]*<!--[^>]*\*\+)" end="--> \*)" containedin=ALLBUT,@mmaStrings transparent fold keepend
" show fold text
-set commentstring='(*%s*)'
"set foldtext=MmaFoldText()
"function MmaFoldText()
diff --git a/runtime/syntax/mysql.vim b/runtime/syntax/mysql.vim
index 8bd7b6459a..49b53313c9 100644
--- a/runtime/syntax/mysql.vim
+++ b/runtime/syntax/mysql.vim
@@ -1,10 +1,13 @@
" Vim syntax file
" Language: mysql
" Maintainer: Kenneth J. Pronovici <pronovic@ieee.org>
-" Last Change: $LastChangedDate: 2016-04-11 10:31:04 -0500 (Mon, 11 Apr 2016) $
" Filenames: *.mysql
-" URL: ftp://cedar-solutions.com/software/mysql.vim
-" Note: The definitions below are taken from the mysql user manual as of April 2002, for version 3.23
+" URL: ftp://cedar-solutions.com/software/mysql.vim (https://github.com/pronovic/vim-syntax/blob/master/mysql.vim)
+" Note: The definitions below are taken from the mysql user manual as of April 2002, for version 3.23 and have been updated
+" in July 2024 with the docs for version 8.4
+" Last Change: 2016 Apr 11
+" 2024-07-21: update MySQL functions as of MySQL 8.4 (by Vim Project)
+"
" quit when a syntax file was already loaded
if exists("b:current_syntax")
@@ -92,23 +95,23 @@ syn keyword mysqlType tinytext mediumtext longtext text
syn keyword mysqlType tinyblob mediumblob longblob blob
syn region mysqlType start="float\W" end="."me=s-1
syn region mysqlType start="float$" end="."me=s-1
-syn region mysqlType start="float(" end=")" contains=mysqlNumber,mysqlVariable
+syn region mysqlType start="\<float(" end=")" contains=mysqlNumber,mysqlVariable
syn region mysqlType start="double\W" end="."me=s-1
syn region mysqlType start="double$" end="."me=s-1
-syn region mysqlType start="double(" end=")" contains=mysqlNumber,mysqlVariable
+syn region mysqlType start="\<double(" end=")" contains=mysqlNumber,mysqlVariable
syn region mysqlType start="double precision\W" end="."me=s-1
syn region mysqlType start="double precision$" end="."me=s-1
syn region mysqlType start="double precision(" end=")" contains=mysqlNumber,mysqlVariable
syn region mysqlType start="real\W" end="."me=s-1
syn region mysqlType start="real$" end="."me=s-1
-syn region mysqlType start="real(" end=")" contains=mysqlNumber,mysqlVariable
-syn region mysqlType start="numeric(" end=")" contains=mysqlNumber,mysqlVariable
+syn region mysqlType start="\<real(" end=")" contains=mysqlNumber,mysqlVariable
+syn region mysqlType start="\<numeric(" end=")" contains=mysqlNumber,mysqlVariable
syn region mysqlType start="dec\W" end="."me=s-1
syn region mysqlType start="dec$" end="."me=s-1
-syn region mysqlType start="dec(" end=")" contains=mysqlNumber,mysqlVariable
+syn region mysqlType start="\<dec(" end=")" contains=mysqlNumber,mysqlVariable
syn region mysqlType start="decimal\W" end="."me=s-1
syn region mysqlType start="decimal$" end="."me=s-1
-syn region mysqlType start="decimal(" end=")" contains=mysqlNumber,mysqlVariable
+syn region mysqlType start="\<decimal(" end=")" contains=mysqlNumber,mysqlVariable
syn region mysqlType start="\Wtimestamp\W" end="."me=s-1
syn region mysqlType start="\Wtimestamp$" end="."me=s-1
syn region mysqlType start="\Wtimestamp(" end=")" contains=mysqlNumber,mysqlVariable
@@ -117,25 +120,42 @@ syn region mysqlType start="^timestamp$" end="."me=s-1
syn region mysqlType start="^timestamp(" end=")" contains=mysqlNumber,mysqlVariable
syn region mysqlType start="\Wyear(" end=")" contains=mysqlNumber,mysqlVariable
syn region mysqlType start="^year(" end=")" contains=mysqlNumber,mysqlVariable
-syn region mysqlType start="char(" end=")" contains=mysqlNumber,mysqlVariable
-syn region mysqlType start="varchar(" end=")" contains=mysqlNumber,mysqlVariable
-syn region mysqlType start="enum(" end=")" contains=mysqlString,mysqlVariable
+syn region mysqlType start="\<char(" end=")" contains=mysqlNumber,mysqlVariable
+syn region mysqlType start="\<varchar(" end=")" contains=mysqlNumber,mysqlVariable
+syn region mysqlType start="\<enum(" end=")" contains=mysqlString,mysqlVariable
syn region mysqlType start="\Wset(" end=")" contains=mysqlString,mysqlVariable
syn region mysqlType start="^set(" end=")" contains=mysqlString,mysqlVariable
" Logical, string and numeric operators
syn keyword mysqlOperator between not and or is in like regexp rlike binary exists
-syn region mysqlOperator start="isnull(" end=")" contains=ALL
-syn region mysqlOperator start="coalesce(" end=")" contains=ALL
-syn region mysqlOperator start="interval(" end=")" contains=ALL
+syn region mysqlOperatorFunction start="\<isnull(" end=")" contains=ALL
+syn region mysqlOperatorFunction start="\<coalesce(" end=")" contains=ALL
+syn region mysqlOperatorFunction start="\<interval(" end=")" contains=ALL
-" Control flow functions
-syn keyword mysqlFlow case when then else end
-syn region mysqlFlow start="ifnull(" end=")" contains=ALL
-syn region mysqlFlow start="nullif(" end=")" contains=ALL
-syn region mysqlFlow start="if(" end=")" contains=ALL
+" Flow control functions
+" https://docs.oracle.com/cd/E17952_01/mysql-8.4-en/flow-control-functions.html
+syn keyword mysqlFlowLabel case when then else end
+syn region mysqlFlowFunction start="\<ifnull(" end=")" contains=ALL
+syn region mysqlFlowFunction start="\<nullif(" end=")" contains=ALL
+syn region mysqlFlowFunction start="\<if(" end=")" contains=ALL
-" General Functions
+" Window functions
+" https://docs.oracle.com/cd/E17952_01/mysql-8.4-en/window-functions-usage.html
+syn keyword mysqlWindowKeyword over partition window
+" https://docs.oracle.com/cd/E17952_01/mysql-8.4-en/window-function-descriptions.html
+syn region mysqlWindowFunction start="\<cume_dist(" end=")" contains=ALL
+syn region mysqlWindowFunction start="\<dense_rank(" end=")" contains=ALL
+syn region mysqlWindowFunction start="\<first_value(" end=")" contains=ALL
+syn region mysqlWindowFunction start="\<lag(" end=")" contains=ALL
+syn region mysqlWindowFunction start="\<last_value(" end=")" contains=ALL
+syn region mysqlWindowFunction start="\<lead(" end=")" contains=ALL
+syn region mysqlWindowFunction start="\<nth_value(" end=")" contains=ALL
+syn region mysqlWindowFunction start="\<ntile(" end=")" contains=ALL
+syn region mysqlWindowFunction start="\<percent_rank(" end=")" contains=ALL
+syn region mysqlWindowFunction start="\<rank(" end=")" contains=ALL
+syn region mysqlWindowFunction start="\<row_number(" end=")" contains=ALL
+
+" General functions
"
" I'm leery of just defining keywords for functions, since according to the MySQL manual:
"
@@ -147,140 +167,144 @@ syn region mysqlFlow start="if(" end=")" contains=ALL
" region to define them, not just a keyword. This will probably cause the syntax file
" to load more slowly, but at least it will be 'correct'.
-syn region mysqlFunction start="abs(" end=")" contains=ALL
-syn region mysqlFunction start="acos(" end=")" contains=ALL
-syn region mysqlFunction start="adddate(" end=")" contains=ALL
-syn region mysqlFunction start="ascii(" end=")" contains=ALL
-syn region mysqlFunction start="asin(" end=")" contains=ALL
-syn region mysqlFunction start="atan(" end=")" contains=ALL
-syn region mysqlFunction start="atan2(" end=")" contains=ALL
-syn region mysqlFunction start="avg(" end=")" contains=ALL
-syn region mysqlFunction start="benchmark(" end=")" contains=ALL
-syn region mysqlFunction start="bin(" end=")" contains=ALL
-syn region mysqlFunction start="bit_and(" end=")" contains=ALL
-syn region mysqlFunction start="bit_count(" end=")" contains=ALL
-syn region mysqlFunction start="bit_or(" end=")" contains=ALL
-syn region mysqlFunction start="ceiling(" end=")" contains=ALL
-syn region mysqlFunction start="character_length(" end=")" contains=ALL
-syn region mysqlFunction start="char_length(" end=")" contains=ALL
-syn region mysqlFunction start="concat(" end=")" contains=ALL
-syn region mysqlFunction start="concat_ws(" end=")" contains=ALL
-syn region mysqlFunction start="connection_id(" end=")" contains=ALL
-syn region mysqlFunction start="conv(" end=")" contains=ALL
-syn region mysqlFunction start="cos(" end=")" contains=ALL
-syn region mysqlFunction start="cot(" end=")" contains=ALL
-syn region mysqlFunction start="count(" end=")" contains=ALL
-syn region mysqlFunction start="curdate(" end=")" contains=ALL
-syn region mysqlFunction start="curtime(" end=")" contains=ALL
-syn region mysqlFunction start="date_add(" end=")" contains=ALL
-syn region mysqlFunction start="date_format(" end=")" contains=ALL
-syn region mysqlFunction start="date_sub(" end=")" contains=ALL
-syn region mysqlFunction start="dayname(" end=")" contains=ALL
-syn region mysqlFunction start="dayofmonth(" end=")" contains=ALL
-syn region mysqlFunction start="dayofweek(" end=")" contains=ALL
-syn region mysqlFunction start="dayofyear(" end=")" contains=ALL
-syn region mysqlFunction start="decode(" end=")" contains=ALL
-syn region mysqlFunction start="degrees(" end=")" contains=ALL
-syn region mysqlFunction start="elt(" end=")" contains=ALL
-syn region mysqlFunction start="encode(" end=")" contains=ALL
-syn region mysqlFunction start="encrypt(" end=")" contains=ALL
-syn region mysqlFunction start="exp(" end=")" contains=ALL
-syn region mysqlFunction start="export_set(" end=")" contains=ALL
-syn region mysqlFunction start="extract(" end=")" contains=ALL
-syn region mysqlFunction start="field(" end=")" contains=ALL
-syn region mysqlFunction start="find_in_set(" end=")" contains=ALL
-syn region mysqlFunction start="floor(" end=")" contains=ALL
-syn region mysqlFunction start="format(" end=")" contains=ALL
-syn region mysqlFunction start="from_days(" end=")" contains=ALL
-syn region mysqlFunction start="from_unixtime(" end=")" contains=ALL
-syn region mysqlFunction start="get_lock(" end=")" contains=ALL
-syn region mysqlFunction start="greatest(" end=")" contains=ALL
-syn region mysqlFunction start="group_unique_users(" end=")" contains=ALL
-syn region mysqlFunction start="hex(" end=")" contains=ALL
-syn region mysqlFunction start="inet_aton(" end=")" contains=ALL
-syn region mysqlFunction start="inet_ntoa(" end=")" contains=ALL
-syn region mysqlFunction start="instr(" end=")" contains=ALL
-syn region mysqlFunction start="lcase(" end=")" contains=ALL
-syn region mysqlFunction start="least(" end=")" contains=ALL
-syn region mysqlFunction start="length(" end=")" contains=ALL
-syn region mysqlFunction start="load_file(" end=")" contains=ALL
-syn region mysqlFunction start="locate(" end=")" contains=ALL
-syn region mysqlFunction start="log(" end=")" contains=ALL
-syn region mysqlFunction start="log10(" end=")" contains=ALL
-syn region mysqlFunction start="lower(" end=")" contains=ALL
-syn region mysqlFunction start="lpad(" end=")" contains=ALL
-syn region mysqlFunction start="ltrim(" end=")" contains=ALL
-syn region mysqlFunction start="make_set(" end=")" contains=ALL
-syn region mysqlFunction start="master_pos_wait(" end=")" contains=ALL
-syn region mysqlFunction start="max(" end=")" contains=ALL
-syn region mysqlFunction start="md5(" end=")" contains=ALL
-syn region mysqlFunction start="mid(" end=")" contains=ALL
-syn region mysqlFunction start="min(" end=")" contains=ALL
-syn region mysqlFunction start="mod(" end=")" contains=ALL
-syn region mysqlFunction start="monthname(" end=")" contains=ALL
-syn region mysqlFunction start="now(" end=")" contains=ALL
-syn region mysqlFunction start="oct(" end=")" contains=ALL
-syn region mysqlFunction start="octet_length(" end=")" contains=ALL
-syn region mysqlFunction start="ord(" end=")" contains=ALL
-syn region mysqlFunction start="period_add(" end=")" contains=ALL
-syn region mysqlFunction start="period_diff(" end=")" contains=ALL
-syn region mysqlFunction start="pi(" end=")" contains=ALL
-syn region mysqlFunction start="position(" end=")" contains=ALL
-syn region mysqlFunction start="pow(" end=")" contains=ALL
-syn region mysqlFunction start="power(" end=")" contains=ALL
-syn region mysqlFunction start="quarter(" end=")" contains=ALL
-syn region mysqlFunction start="radians(" end=")" contains=ALL
-syn region mysqlFunction start="rand(" end=")" contains=ALL
-syn region mysqlFunction start="release_lock(" end=")" contains=ALL
-syn region mysqlFunction start="repeat(" end=")" contains=ALL
-syn region mysqlFunction start="reverse(" end=")" contains=ALL
-syn region mysqlFunction start="round(" end=")" contains=ALL
-syn region mysqlFunction start="rpad(" end=")" contains=ALL
-syn region mysqlFunction start="rtrim(" end=")" contains=ALL
-syn region mysqlFunction start="sec_to_time(" end=")" contains=ALL
-syn region mysqlFunction start="session_user(" end=")" contains=ALL
-syn region mysqlFunction start="sign(" end=")" contains=ALL
-syn region mysqlFunction start="sin(" end=")" contains=ALL
-syn region mysqlFunction start="soundex(" end=")" contains=ALL
-syn region mysqlFunction start="space(" end=")" contains=ALL
-syn region mysqlFunction start="sqrt(" end=")" contains=ALL
-syn region mysqlFunction start="std(" end=")" contains=ALL
-syn region mysqlFunction start="stddev(" end=")" contains=ALL
-syn region mysqlFunction start="strcmp(" end=")" contains=ALL
-syn region mysqlFunction start="subdate(" end=")" contains=ALL
-syn region mysqlFunction start="substring(" end=")" contains=ALL
-syn region mysqlFunction start="substring_index(" end=")" contains=ALL
-syn region mysqlFunction start="subtime(" end=")" contains=ALL
-syn region mysqlFunction start="sum(" end=")" contains=ALL
-syn region mysqlFunction start="sysdate(" end=")" contains=ALL
-syn region mysqlFunction start="system_user(" end=")" contains=ALL
-syn region mysqlFunction start="tan(" end=")" contains=ALL
-syn region mysqlFunction start="time_format(" end=")" contains=ALL
-syn region mysqlFunction start="time_to_sec(" end=")" contains=ALL
-syn region mysqlFunction start="to_days(" end=")" contains=ALL
-syn region mysqlFunction start="trim(" end=")" contains=ALL
-syn region mysqlFunction start="ucase(" end=")" contains=ALL
-syn region mysqlFunction start="unique_users(" end=")" contains=ALL
-syn region mysqlFunction start="unix_timestamp(" end=")" contains=ALL
-syn region mysqlFunction start="upper(" end=")" contains=ALL
-syn region mysqlFunction start="user(" end=")" contains=ALL
-syn region mysqlFunction start="version(" end=")" contains=ALL
-syn region mysqlFunction start="week(" end=")" contains=ALL
-syn region mysqlFunction start="weekday(" end=")" contains=ALL
-syn region mysqlFunction start="yearweek(" end=")" contains=ALL
+syn region mysqlFunction start="\<abs(" end=")" contains=ALL
+syn region mysqlFunction start="\<acos(" end=")" contains=ALL
+syn region mysqlFunction start="\<adddate(" end=")" contains=ALL
+syn region mysqlFunction start="\<ascii(" end=")" contains=ALL
+syn region mysqlFunction start="\<asin(" end=")" contains=ALL
+syn region mysqlFunction start="\<atan(" end=")" contains=ALL
+syn region mysqlFunction start="\<atan2(" end=")" contains=ALL
+syn region mysqlFunction start="\<avg(" end=")" contains=ALL
+syn region mysqlFunction start="\<benchmark(" end=")" contains=ALL
+syn region mysqlFunction start="\<bin(" end=")" contains=ALL
+syn region mysqlFunction start="\<bit_and(" end=")" contains=ALL
+syn region mysqlFunction start="\<bit_count(" end=")" contains=ALL
+syn region mysqlFunction start="\<bit_or(" end=")" contains=ALL
+syn region mysqlFunction start="\<ceiling(" end=")" contains=ALL
+syn region mysqlFunction start="\<character_length(" end=")" contains=ALL
+syn region mysqlFunction start="\<char_length(" end=")" contains=ALL
+syn region mysqlFunction start="\<concat(" end=")" contains=ALL
+syn region mysqlFunction start="\<concat_ws(" end=")" contains=ALL
+syn region mysqlFunction start="\<connection_id(" end=")" contains=ALL
+syn region mysqlFunction start="\<conv(" end=")" contains=ALL
+syn region mysqlFunction start="\<cos(" end=")" contains=ALL
+syn region mysqlFunction start="\<cot(" end=")" contains=ALL
+syn region mysqlFunction start="\<count(" end=")" contains=ALL
+syn region mysqlFunction start="\<curdate(" end=")" contains=ALL
+syn region mysqlFunction start="\<curtime(" end=")" contains=ALL
+syn region mysqlFunction start="\<date_add(" end=")" contains=ALL
+syn region mysqlFunction start="\<date_format(" end=")" contains=ALL
+syn region mysqlFunction start="\<date_sub(" end=")" contains=ALL
+syn region mysqlFunction start="\<dayname(" end=")" contains=ALL
+syn region mysqlFunction start="\<dayofmonth(" end=")" contains=ALL
+syn region mysqlFunction start="\<dayofweek(" end=")" contains=ALL
+syn region mysqlFunction start="\<dayofyear(" end=")" contains=ALL
+syn region mysqlFunction start="\<decode(" end=")" contains=ALL
+syn region mysqlFunction start="\<degrees(" end=")" contains=ALL
+syn region mysqlFunction start="\<elt(" end=")" contains=ALL
+syn region mysqlFunction start="\<encode(" end=")" contains=ALL
+syn region mysqlFunction start="\<encrypt(" end=")" contains=ALL
+syn region mysqlFunction start="\<exp(" end=")" contains=ALL
+syn region mysqlFunction start="\<export_set(" end=")" contains=ALL
+syn region mysqlFunction start="\<extract(" end=")" contains=ALL
+syn region mysqlFunction start="\<field(" end=")" contains=ALL
+syn region mysqlFunction start="\<find_in_set(" end=")" contains=ALL
+syn region mysqlFunction start="\<floor(" end=")" contains=ALL
+syn region mysqlFunction start="\<format(" end=")" contains=ALL
+syn region mysqlFunction start="\<from_days(" end=")" contains=ALL
+syn region mysqlFunction start="\<from_unixtime(" end=")" contains=ALL
+syn region mysqlFunction start="\<get_lock(" end=")" contains=ALL
+syn region mysqlFunction start="\<greatest(" end=")" contains=ALL
+syn region mysqlFunction start="\<group_unique_users(" end=")" contains=ALL
+syn region mysqlFunction start="\<hex(" end=")" contains=ALL
+syn region mysqlFunction start="\<inet_aton(" end=")" contains=ALL
+syn region mysqlFunction start="\<inet_ntoa(" end=")" contains=ALL
+syn region mysqlFunction start="\<instr(" end=")" contains=ALL
+syn region mysqlFunction start="\<lcase(" end=")" contains=ALL
+syn region mysqlFunction start="\<least(" end=")" contains=ALL
+syn region mysqlFunction start="\<length(" end=")" contains=ALL
+syn region mysqlFunction start="\<load_file(" end=")" contains=ALL
+syn region mysqlFunction start="\<locate(" end=")" contains=ALL
+syn region mysqlFunction start="\<log(" end=")" contains=ALL
+syn region mysqlFunction start="\<log10(" end=")" contains=ALL
+syn region mysqlFunction start="\<lower(" end=")" contains=ALL
+syn region mysqlFunction start="\<lpad(" end=")" contains=ALL
+syn region mysqlFunction start="\<ltrim(" end=")" contains=ALL
+syn region mysqlFunction start="\<make_set(" end=")" contains=ALL
+syn region mysqlFunction start="\<master_pos_wait(" end=")" contains=ALL
+syn region mysqlFunction start="\<max(" end=")" contains=ALL
+syn region mysqlFunction start="\<md5(" end=")" contains=ALL
+syn region mysqlFunction start="\<mid(" end=")" contains=ALL
+syn region mysqlFunction start="\<min(" end=")" contains=ALL
+syn region mysqlFunction start="\<mod(" end=")" contains=ALL
+syn region mysqlFunction start="\<monthname(" end=")" contains=ALL
+syn region mysqlFunction start="\<now(" end=")" contains=ALL
+syn region mysqlFunction start="\<oct(" end=")" contains=ALL
+syn region mysqlFunction start="\<octet_length(" end=")" contains=ALL
+syn region mysqlFunction start="\<ord(" end=")" contains=ALL
+syn region mysqlFunction start="\<period_add(" end=")" contains=ALL
+syn region mysqlFunction start="\<period_diff(" end=")" contains=ALL
+syn region mysqlFunction start="\<pi(" end=")" contains=ALL
+syn region mysqlFunction start="\<position(" end=")" contains=ALL
+syn region mysqlFunction start="\<pow(" end=")" contains=ALL
+syn region mysqlFunction start="\<power(" end=")" contains=ALL
+syn region mysqlFunction start="\<quarter(" end=")" contains=ALL
+syn region mysqlFunction start="\<radians(" end=")" contains=ALL
+syn region mysqlFunction start="\<rand(" end=")" contains=ALL
+syn region mysqlFunction start="\<release_lock(" end=")" contains=ALL
+syn region mysqlFunction start="\<repeat(" end=")" contains=ALL
+syn region mysqlFunction start="\<reverse(" end=")" contains=ALL
+syn region mysqlFunction start="\<round(" end=")" contains=ALL
+syn region mysqlFunction start="\<rpad(" end=")" contains=ALL
+syn region mysqlFunction start="\<rtrim(" end=")" contains=ALL
+syn region mysqlFunction start="\<sec_to_time(" end=")" contains=ALL
+syn region mysqlFunction start="\<session_user(" end=")" contains=ALL
+syn region mysqlFunction start="\<sign(" end=")" contains=ALL
+syn region mysqlFunction start="\<sin(" end=")" contains=ALL
+syn region mysqlFunction start="\<soundex(" end=")" contains=ALL
+syn region mysqlFunction start="\<space(" end=")" contains=ALL
+syn region mysqlFunction start="\<sqrt(" end=")" contains=ALL
+syn region mysqlFunction start="\<std(" end=")" contains=ALL
+syn region mysqlFunction start="\<stddev(" end=")" contains=ALL
+syn region mysqlFunction start="\<strcmp(" end=")" contains=ALL
+syn region mysqlFunction start="\<subdate(" end=")" contains=ALL
+syn region mysqlFunction start="\<substring(" end=")" contains=ALL
+syn region mysqlFunction start="\<substring_index(" end=")" contains=ALL
+syn region mysqlFunction start="\<subtime(" end=")" contains=ALL
+syn region mysqlFunction start="\<sum(" end=")" contains=ALL
+syn region mysqlFunction start="\<sysdate(" end=")" contains=ALL
+syn region mysqlFunction start="\<system_user(" end=")" contains=ALL
+syn region mysqlFunction start="\<tan(" end=")" contains=ALL
+syn region mysqlFunction start="\<time_format(" end=")" contains=ALL
+syn region mysqlFunction start="\<time_to_sec(" end=")" contains=ALL
+syn region mysqlFunction start="\<to_days(" end=")" contains=ALL
+syn region mysqlFunction start="\<trim(" end=")" contains=ALL
+syn region mysqlFunction start="\<ucase(" end=")" contains=ALL
+syn region mysqlFunction start="\<unique_users(" end=")" contains=ALL
+syn region mysqlFunction start="\<unix_timestamp(" end=")" contains=ALL
+syn region mysqlFunction start="\<upper(" end=")" contains=ALL
+syn region mysqlFunction start="\<user(" end=")" contains=ALL
+syn region mysqlFunction start="\<version(" end=")" contains=ALL
+syn region mysqlFunction start="\<week(" end=")" contains=ALL
+syn region mysqlFunction start="\<weekday(" end=")" contains=ALL
+syn region mysqlFunction start="\<yearweek(" end=")" contains=ALL
" Define the default highlighting.
" Only when an item doesn't have highlighting yet
-hi def link mysqlKeyword Statement
+hi def link mysqlKeyword Keyword
hi def link mysqlSpecial Special
hi def link mysqlString String
hi def link mysqlNumber Number
hi def link mysqlVariable Identifier
hi def link mysqlComment Comment
hi def link mysqlType Type
-hi def link mysqlOperator Statement
-hi def link mysqlFlow Statement
+hi def link mysqlOperator Operator
+hi def link mysqlOperatorFunction Function
+hi def link mysqlFlowFunction Function
+hi def link mysqlFlowLabel Label
+hi def link mysqlWindowFunction Function
+hi def link mysqlWindowKeyword Keyword
hi def link mysqlFunction Function
diff --git a/runtime/syntax/ocaml.vim b/runtime/syntax/ocaml.vim
index af3efd3dab..04ba39203d 100644
--- a/runtime/syntax/ocaml.vim
+++ b/runtime/syntax/ocaml.vim
@@ -6,6 +6,7 @@
" Issac Trotts <ijtrotts@ucdavis.edu>
" URL: https://github.com/ocaml/vim-ocaml
" Last Change:
+" 2019 Nov 05 - Accurate type highlighting (Maëlan)
" 2018 Nov 08 - Improved highlighting of operators (Maëlan)
" 2018 Apr 22 - Improved support for PPX (Andrey Popp)
" 2018 Mar 16 - Remove raise, lnot and not from keywords (Étienne Millon, "copy")
@@ -38,25 +39,18 @@ syn case match
" Access to the method of an object
syn match ocamlMethod "#"
-" Script headers highlighted like comments
-syn match ocamlComment "^#!.*" contains=@Spell
-
" Scripting directives
syn match ocamlScript "^#\<\(quit\|labels\|warnings\|warn_error\|directory\|remove_directory\|cd\|load\|load_rec\|use\|mod_use\|install_printer\|remove_printer\|require\|list\|ppx\|principal\|predicates\|rectypes\|thread\|trace\|untrace\|untrace_all\|print_depth\|print_length\|camlp4o\|camlp4r\|topfind_log\|topfind_verbose\)\>"
" lowercase identifier - the standard way to match
syn match ocamlLCIdentifier /\<\(\l\|_\)\(\w\|'\)*\>/
-syn match ocamlKeyChar "|"
-
" Errors
syn match ocamlBraceErr "}"
syn match ocamlBrackErr "\]"
syn match ocamlParenErr ")"
syn match ocamlArrErr "|]"
-syn match ocamlCommentErr "\*)"
-
syn match ocamlCountErr "\<downto\>"
syn match ocamlCountErr "\<to\>"
@@ -75,19 +69,22 @@ else
syn match ocamlEndErr "\<end\>"
endif
-" Some convenient clusters
-syn cluster ocamlAllErrs contains=ocamlBraceErr,ocamlBrackErr,ocamlParenErr,ocamlCommentErr,ocamlCountErr,ocamlDoErr,ocamlDoneErr,ocamlEndErr,ocamlThenErr
+" These keywords are only expected nested in constructions that are handled by
+" the type linter, so outside of type contexts we highlight them as errors:
+syn match ocamlKwErr "\<\(mutable\|nonrec\|of\|private\)\>"
-syn cluster ocamlAENoParen contains=ocamlBraceErr,ocamlBrackErr,ocamlCommentErr,ocamlCountErr,ocamlDoErr,ocamlDoneErr,ocamlEndErr,ocamlThenErr
+" Some convenient clusters
+syn cluster ocamlAllErrs contains=@ocamlAENoParen,ocamlParenErr
+syn cluster ocamlAENoParen contains=ocamlBraceErr,ocamlBrackErr,ocamlCountErr,ocamlDoErr,ocamlDoneErr,ocamlEndErr,ocamlThenErr,ocamlKwErr
-syn cluster ocamlContained contains=ocamlTodo,ocamlPreDef,ocamlModParam,ocamlModParam1,ocamlMPRestr,ocamlMPRestr1,ocamlMPRestr2,ocamlMPRestr3,ocamlModRHS,ocamlFuncWith,ocamlFuncStruct,ocamlModTypeRestr,ocamlModTRWith,ocamlWith,ocamlWithRest,ocamlModType,ocamlFullMod,ocamlVal
+syn cluster ocamlContained contains=ocamlTodo,ocamlPreDef,ocamlModParam,ocamlModParam1,ocamlModTypePre,ocamlModRHS,ocamlFuncWith,ocamlModTypeRestr,ocamlModTRWith,ocamlWith,ocamlWithRest,ocamlFullMod,ocamlVal
" Enclosing delimiters
-syn region ocamlEncl transparent matchgroup=ocamlKeyword start="(" matchgroup=ocamlKeyword end=")" contains=ALLBUT,@ocamlContained,ocamlParenErr
-syn region ocamlEncl transparent matchgroup=ocamlKeyword start="{" matchgroup=ocamlKeyword end="}" contains=ALLBUT,@ocamlContained,ocamlBraceErr
-syn region ocamlEncl transparent matchgroup=ocamlKeyword start="\[" matchgroup=ocamlKeyword end="\]" contains=ALLBUT,@ocamlContained,ocamlBrackErr
-syn region ocamlEncl transparent matchgroup=ocamlKeyword start="\[|" matchgroup=ocamlKeyword end="|\]" contains=ALLBUT,@ocamlContained,ocamlArrErr
+syn region ocamlNone transparent matchgroup=ocamlEncl start="(" matchgroup=ocamlEncl end=")" contains=ALLBUT,@ocamlContained,ocamlParenErr
+syn region ocamlNone transparent matchgroup=ocamlEncl start="{" matchgroup=ocamlEncl end="}" contains=ALLBUT,@ocamlContained,ocamlBraceErr
+syn region ocamlNone transparent matchgroup=ocamlEncl start="\[" matchgroup=ocamlEncl end="\]" contains=ALLBUT,@ocamlContained,ocamlBrackErr
+syn region ocamlNone transparent matchgroup=ocamlEncl start="\[|" matchgroup=ocamlEncl end="|\]" contains=ALLBUT,@ocamlContained,ocamlArrErr
" Comments
@@ -124,10 +121,6 @@ syn region ocamlPpx matchgroup=ocamlPpxEncl start="\[@\{1,3\}" contains=TOP end=
"" Modules
-" "sig"
-syn region ocamlSig matchgroup=ocamlSigEncl start="\<sig\>" matchgroup=ocamlSigEncl end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr,ocamlModule
-syn region ocamlModSpec matchgroup=ocamlKeyword start="\<module\>" matchgroup=ocamlModule end="\<\u\(\w\|'\)*\>" contained contains=@ocamlAllErrs,ocamlComment skipwhite skipempty nextgroup=ocamlModTRWith,ocamlMPRestr
-
" "open"
syn match ocamlKeyword "\<open\>" skipwhite skipempty nextgroup=ocamlFullMod
@@ -135,51 +128,66 @@ syn match ocamlKeyword "\<open\>" skipwhite skipempty nextgroup=ocamlFullMod
syn match ocamlKeyword "\<include\>" skipwhite skipempty nextgroup=ocamlModParam,ocamlFullMod
" "module" - somewhat complicated stuff ;-)
-syn region ocamlModule matchgroup=ocamlKeyword start="\<module\>" matchgroup=ocamlModule end="\<\u\(\w\|'\)*\>" contains=@ocamlAllErrs,ocamlComment skipwhite skipempty nextgroup=ocamlPreDef
-syn region ocamlPreDef start="."me=e-1 matchgroup=ocamlKeyword end="\l\|=\|)"me=e-1 contained contains=@ocamlAllErrs,ocamlComment,ocamlModParam,ocamlGenMod,ocamlModTypeRestr,ocamlModTRWith nextgroup=ocamlModPreRHS
-syn region ocamlModParam start="([^*]" end=")" contained contains=ocamlGenMod,ocamlModParam1,ocamlSig,ocamlVal
+" 2022-10: please document it?
+syn region ocamlModule matchgroup=ocamlKeyword start="\<module\>" matchgroup=ocamlModule end="\<_\|\u\(\w\|'\)*\>" contains=@ocamlAllErrs,ocamlComment skipwhite skipempty nextgroup=ocamlPreDef
+syn region ocamlPreDef start="."me=e-1 end="[a-z:=)]\@=" contained contains=@ocamlAllErrs,ocamlComment,ocamlModParam,ocamlGenMod,ocamlModTypeRestr nextgroup=ocamlModTypePre,ocamlModPreRHS
+syn region ocamlModParam start="(\*\@!" end=")" contained contains=ocamlGenMod,ocamlModParam,ocamlModParam1,ocamlSig,ocamlVal
syn match ocamlModParam1 "\<\u\(\w\|'\)*\>" contained skipwhite skipempty
syn match ocamlGenMod "()" contained skipwhite skipempty
-syn region ocamlMPRestr start=":" end="."me=e-1 contained contains=@ocamlComment skipwhite skipempty nextgroup=ocamlMPRestr1,ocamlMPRestr2,ocamlMPRestr3
-syn region ocamlMPRestr1 matchgroup=ocamlSigEncl start="\ssig\s\=" matchgroup=ocamlSigEncl end="\<end\>" contained contains=ALLBUT,@ocamlContained,ocamlEndErr,ocamlModule
-syn region ocamlMPRestr2 start="\sfunctor\(\s\|(\)\="me=e-1 matchgroup=ocamlKeyword end="->" contained contains=@ocamlAllErrs,ocamlComment,ocamlModParam,ocamlGenMod skipwhite skipempty nextgroup=ocamlFuncWith,ocamlMPRestr2
-syn match ocamlMPRestr3 "\w\(\w\|'\)*\( *\. *\w\(\w\|'\)*\)*" contained
+syn match ocamlModTypePre ":" contained skipwhite skipempty nextgroup=ocamlModTRWith,ocamlSig,ocamlFunctor,ocamlModTypeRestr,ocamlModTypeOf
+syn match ocamlModTypeRestr "\<\w\(\w\|'\)*\( *\. *\w\(\w\|'\)*\)*\>" contained
+
syn match ocamlModPreRHS "=" contained skipwhite skipempty nextgroup=ocamlModParam,ocamlFullMod
syn keyword ocamlKeyword val
-syn region ocamlVal matchgroup=ocamlKeyword start="\<val\>" matchgroup=ocamlLCIdentifier end="\<\l\(\w\|'\)*\>" contains=@ocamlAllErrs,ocamlComment,ocamlFullMod skipwhite skipempty nextgroup=ocamlMPRestr
+syn region ocamlVal matchgroup=ocamlKeyword start="\<val\>" matchgroup=ocamlLCIdentifier end="\<\l\(\w\|'\)*\>" contains=@ocamlAllErrs,ocamlComment,ocamlFullMod skipwhite skipempty nextgroup=ocamlModTypePre
syn region ocamlModRHS start="." end=". *\w\|([^*]"me=e-2 contained contains=ocamlComment skipwhite skipempty nextgroup=ocamlModParam,ocamlFullMod
syn match ocamlFullMod "\<\u\(\w\|'\)*\( *\. *\u\(\w\|'\)*\)*" contained skipwhite skipempty nextgroup=ocamlFuncWith
-syn region ocamlFuncWith start="([^*)]"me=e-1 end=")" contained contains=ocamlComment,ocamlWith,ocamlFuncStruct skipwhite skipempty nextgroup=ocamlFuncWith
-syn region ocamlFuncStruct matchgroup=ocamlStructEncl start="[^a-zA-Z]struct\>"hs=s+1 matchgroup=ocamlStructEncl end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr
+syn region ocamlFuncWith start="([*)]\@!" end=")" contained contains=ocamlComment,ocamlWith,ocamlStruct skipwhite skipempty nextgroup=ocamlFuncWith
-syn match ocamlModTypeRestr "\<\w\(\w\|'\)*\( *\. *\w\(\w\|'\)*\)*\>" contained
-syn region ocamlModTRWith start=":\s*("hs=s+1 end=")" contained contains=@ocamlAENoParen,ocamlWith
+syn region ocamlModTRWith start="(\*\@!" end=")" contained contains=@ocamlAENoParen,ocamlWith
syn match ocamlWith "\<\(\u\(\w\|'\)* *\. *\)*\w\(\w\|'\)*\>" contained skipwhite skipempty nextgroup=ocamlWithRest
syn region ocamlWithRest start="[^)]" end=")"me=e-1 contained contains=ALLBUT,@ocamlContained
" "struct"
syn region ocamlStruct matchgroup=ocamlStructEncl start="\<\(module\s\+\)\=struct\>" matchgroup=ocamlStructEncl end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr
+" "sig"
+syn region ocamlSig matchgroup=ocamlSigEncl start="\<sig\>" matchgroup=ocamlSigEncl end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr
+
+" "functor"
+syn region ocamlFunctor start="\<functor\>" matchgroup=ocamlKeyword end="->" contains=@ocamlAllErrs,ocamlComment,ocamlModParam,ocamlGenMod skipwhite skipempty nextgroup=ocamlStruct,ocamlSig,ocamlFuncWith,ocamlFunctor
+
" "module type"
-syn region ocamlKeyword start="\<module\>\s*\<type\>\(\s*\<of\>\)\=" matchgroup=ocamlModule end="\<\w\(\w\|'\)*\>" contains=ocamlComment skipwhite skipempty nextgroup=ocamlMTDef
+syn region ocamlModTypeOf start="\<module\s\+type\(\s\+of\)\=\>" matchgroup=ocamlModule end="\<\w\(\w\|'\)*\>" contains=ocamlComment skipwhite skipempty nextgroup=ocamlMTDef
syn match ocamlMTDef "=\s*\w\(\w\|'\)*\>"hs=s+1,me=s+1 skipwhite skipempty nextgroup=ocamlFullMod
" Quoted strings
syn region ocamlString matchgroup=ocamlQuotedStringDelim start="{\z\([a-z_]*\)|" end="|\z1}" contains=@Spell
+syn region ocamlString matchgroup=ocamlQuotedStringDelim start="{%[a-z_]\+\(\.[a-z_]\+\)\?\( \z\([a-z_]\+\)\)\?|" end="|\z1}" contains=@Spell
syn keyword ocamlKeyword and as assert class
-syn keyword ocamlKeyword constraint else
-syn keyword ocamlKeyword exception external fun
-
+syn keyword ocamlKeyword else
+syn keyword ocamlKeyword external
syn keyword ocamlKeyword in inherit initializer
syn keyword ocamlKeyword lazy let match
-syn keyword ocamlKeyword method mutable new nonrec of
-syn keyword ocamlKeyword parser private rec
-syn keyword ocamlKeyword try type
+syn keyword ocamlKeyword method new
+syn keyword ocamlKeyword parser rec
+syn keyword ocamlKeyword try
syn keyword ocamlKeyword virtual when while with
+" Keywords which are handled by the type linter:
+" as (within a type equation)
+" constraint exception mutable nonrec of private type
+
+" The `fun` keyword has special treatment because of the syntax `fun … : t -> e`
+" where `->` ends the type context rather than being part of it; to handle that,
+" we blacklist the ocamlTypeAnnot matchgroup, and we plug ocamlFunTypeAnnot
+" instead (later in this file, by using containedin=ocamlFun):
+syn region ocamlFun matchgroup=ocamlKeyword start='\<fun\>' matchgroup=ocamlArrow end='->'
+\ contains=ALLBUT,@ocamlContained,ocamlArrow,ocamlInfixOp,ocamlTypeAnnot
+
if exists("ocaml_revised")
syn keyword ocamlKeyword do value
syn keyword ocamlBoolean True False
@@ -188,14 +196,10 @@ else
syn keyword ocamlBoolean true false
endif
-syn keyword ocamlType array bool char exn float format format4
-syn keyword ocamlType int int32 int64 lazy_t list nativeint option
-syn keyword ocamlType bytes string unit
-
-syn match ocamlConstructor "(\s*)"
-syn match ocamlConstructor "\[\s*\]"
-syn match ocamlConstructor "\[|\s*>|]"
-syn match ocamlConstructor "\[<\s*>\]"
+syn match ocamlEmptyConstructor "(\s*)"
+syn match ocamlEmptyConstructor "\[\s*\]"
+syn match ocamlEmptyConstructor "\[|\s*>|]"
+syn match ocamlEmptyConstructor "\[<\s*>\]"
syn match ocamlConstructor "\u\(\w\|'\)*\>"
" Polymorphic variants
@@ -210,26 +214,24 @@ syn match ocamlCharErr "'\\\d\d'\|'\\\d'"
syn match ocamlCharErr "'\\[^\'ntbr]'"
syn region ocamlString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell
-syn match ocamlTopStop ";;"
-
syn match ocamlAnyVar "\<_\>"
-syn match ocamlKeyChar "|[^\]]"me=e-1
+syn match ocamlKeyChar "|]\@!"
syn match ocamlKeyChar ";"
syn match ocamlKeyChar "\~"
syn match ocamlKeyChar "?"
+" NOTE: for correct precedence, the rule for ";;" must come after that for ";"
+syn match ocamlTopStop ";;"
+
"" Operators
" The grammar of operators is found there:
" https://caml.inria.fr/pub/docs/manual-ocaml/names.html#operator-name
" https://caml.inria.fr/pub/docs/manual-ocaml/extn.html#s:ext-ops
" https://caml.inria.fr/pub/docs/manual-ocaml/extn.html#s:index-operators
-" =, *, < and > are both operator names and keywords, we let the user choose how
-" to display them (has to be declared before regular infix operators):
+" = is both an operator name and a keyword, we let the user choose how
+" to display it (has to be declared before regular infix operators):
syn match ocamlEqual "="
-syn match ocamlStar "*"
-syn match ocamlAngle "<"
-syn match ocamlAngle ">"
" Custom indexing operators:
syn region ocamlIndexing matchgroup=ocamlIndexingOp
\ start="\.[~?!:|&$%=>@^/*+-][~?!.:|&$%<=>@^*/+-]*\_s*("
@@ -248,8 +250,8 @@ syn match ocamlExtensionOp "#[#~?!.:|&$%<=>@^*/+-]\+"
" Infix and prefix operators:
syn match ocamlPrefixOp "![~?!.:|&$%<=>@^*/+-]*"
syn match ocamlPrefixOp "[~?][~?!.:|&$%<=>@^*/+-]\+"
-syn match ocamlInfixOp "[&$%@^/+-][~?!.:|&$%<=>@^*/+-]*"
-syn match ocamlInfixOp "[|<=>*][~?!.:|&$%<=>@^*/+-]\+"
+syn match ocamlInfixOp "[&$%<>@^*/+-][~?!.:|&$%<=>@^*/+-]*"
+syn match ocamlInfixOp "[|=][~?!.:|&$%<=>@^*/+-]\+"
syn match ocamlInfixOp "#[~?!.:|&$%<=>@^*/+-]\+#\@!"
syn match ocamlInfixOp "!=[~?!.:|&$%<=>@^*/+-]\@!"
syn keyword ocamlInfixOpKeyword asr land lor lsl lsr lxor mod or
@@ -266,6 +268,9 @@ else
syn match ocamlKeyChar "<-[~?!.:|&$%<=>@^*/+-]\@!"
endif
+" Script shebang (has to be declared after operators)
+syn match ocamlShebang "\%1l^#!.*$"
+
syn match ocamlNumber "-\=\<\d\(_\|\d\)*[l|L|n]\?\>"
syn match ocamlNumber "-\=\<0[x|X]\(\x\|_\)\+[l|L|n]\?\>"
syn match ocamlNumber "-\=\<0[o|O]\(\o\|_\)\+[l|L|n]\?\>"
@@ -273,10 +278,264 @@ syn match ocamlNumber "-\=\<0[b|B]\([01]\|_\)\+[l|L|n]\?\>"
syn match ocamlFloat "-\=\<\d\(_\|\d\)*\.\?\(_\|\d\)*\([eE][-+]\=\d\(_\|\d\)*\)\=\>"
" Labels
-syn match ocamlLabel "\~\(\l\|_\)\(\w\|'\)*"lc=1
-syn match ocamlLabel "?\(\l\|_\)\(\w\|'\)*"lc=1
+syn match ocamlLabel "[~?]\(\l\|_\)\(\w\|'\)*:\?"
syn region ocamlLabel transparent matchgroup=ocamlLabel start="[~?](\(\l\|_\)\(\w\|'\)*"lc=2 end=")"me=e-1 contains=ALLBUT,@ocamlContained,ocamlParenErr
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+"" Type contexts
+
+" How we recognize type contexts is explained in `type-linter-notes.md`
+" and a test suite is found in `type-linter-test.ml`.
+"
+" ocamlTypeExpr is the cluster of things that can make up a type expression
+" (in a loose sense, e.g. the “as†keyword and universal quantification are
+" included). Regions containing a type expression use it like this:
+"
+" contains=@ocamlTypeExpr,...
+"
+" ocamlTypeContained is the cluster of things that can be found in a type
+" expression or a type definition. It is not expected to be used in any region,
+" it exists solely for throwing things in it that should not pollute the main
+" linter.
+"
+" Both clusters are filled in incrementally. Every match group that is not to be
+" found at the main level must be declared as “contained†and added to either
+" ocamlTypeExpr or ocamlTypeContained.
+"
+" In these clusters we don’t put generic things that can also be found elswhere,
+" i.e. ocamlComment and ocamlPpx, because everything that is in these clusters
+" is also put in ocamlContained and thus ignored by the main linter.
+
+"syn cluster ocamlTypeExpr contains=
+syn cluster ocamlTypeContained contains=@ocamlTypeExpr
+syn cluster ocamlContained add=@ocamlTypeContained
+
+" We’ll use a “catch-all†highlighting group to show as error anything that is
+" not matched more specifically; we don’t want spaces to be reported as errors
+" (different background color), so we just catch them here:
+syn cluster ocamlTypeExpr add=ocamlTypeBlank
+syn match ocamlTypeBlank contained "\_s\+"
+hi link ocamlTypeBlank NONE
+
+" NOTE: Carefully avoid catching "(*" here.
+syn cluster ocamlTypeExpr add=ocamlTypeParen
+syn region ocamlTypeParen contained transparent
+\ matchgroup=ocamlEncl start="(\*\@!"
+\ matchgroup=ocamlEncl end=")"
+\ contains=@ocamlTypeExpr,ocamlComment,ocamlPpx
+
+syn cluster ocamlTypeExpr add=ocamlTypeKeyChar,ocamlTypeAs
+syn match ocamlTypeKeyChar contained "->"
+syn match ocamlTypeKeyChar contained "\*"
+syn match ocamlTypeKeyChar contained "#"
+syn match ocamlTypeKeyChar contained ","
+syn match ocamlTypeKeyChar contained "\."
+syn keyword ocamlTypeAs contained as
+hi link ocamlTypeAs ocamlKeyword
+
+syn cluster ocamlTypeExpr add=ocamlTypeVariance
+syn match ocamlTypeVariance contained "[-+!]\ze *\('\|\<_\>\)"
+syn match ocamlTypeVariance contained "[-+] *!\+\ze *\('\|\<_\>\)"
+syn match ocamlTypeVariance contained "! *[-+]\+\ze *\('\|\<_\>\)"
+
+syn cluster ocamlTypeContained add=ocamlTypeEq
+syn match ocamlTypeEq contained "[+:]\?="
+hi link ocamlTypeEq ocamlKeyChar
+
+syn cluster ocamlTypeExpr add=ocamlTypeVar,ocamlTypeConstr,ocamlTypeAnyVar,ocamlTypeBuiltin
+syn match ocamlTypeVar contained "'\(\l\|_\)\(\w\|'\)*\>"
+syn match ocamlTypeConstr contained "\<\(\l\|_\)\(\w\|'\)*\>"
+" NOTE: for correct precedence, the rule for the wildcard (ocamlTypeAnyVar)
+" must come after the rule for type constructors (ocamlTypeConstr).
+syn match ocamlTypeAnyVar contained "\<_\>"
+" NOTE: For correct precedence, these builtin names must occur after the rule
+" for type constructors (ocamlTypeConstr) but before the rule for non-optional
+" labeled arguments (ocamlTypeLabel). For the latter to take precedence over
+" these builtin names, we use “syn match†here instead of “syn keywordâ€.
+syn match ocamlTypeBuiltin contained "\<array\>"
+syn match ocamlTypeBuiltin contained "\<bool\>"
+syn match ocamlTypeBuiltin contained "\<bytes\>"
+syn match ocamlTypeBuiltin contained "\<char\>"
+syn match ocamlTypeBuiltin contained "\<exn\>"
+syn match ocamlTypeBuiltin contained "\<float\>"
+syn match ocamlTypeBuiltin contained "\<format\>"
+syn match ocamlTypeBuiltin contained "\<format4\>"
+syn match ocamlTypeBuiltin contained "\<format6\>"
+syn match ocamlTypeBuiltin contained "\<in_channel\>"
+syn match ocamlTypeBuiltin contained "\<int\>"
+syn match ocamlTypeBuiltin contained "\<int32\>"
+syn match ocamlTypeBuiltin contained "\<int64\>"
+syn match ocamlTypeBuiltin contained "\<lazy_t\>"
+syn match ocamlTypeBuiltin contained "\<list\>"
+syn match ocamlTypeBuiltin contained "\<nativeint\>"
+syn match ocamlTypeBuiltin contained "\<option\>"
+syn match ocamlTypeBuiltin contained "\<out_channel\>"
+syn match ocamlTypeBuiltin contained "\<ref\>"
+syn match ocamlTypeBuiltin contained "\<result\>"
+syn match ocamlTypeBuiltin contained "\<scanner\>"
+syn match ocamlTypeBuiltin contained "\<string\>"
+syn match ocamlTypeBuiltin contained "\<unit\>"
+
+syn cluster ocamlTypeExpr add=ocamlTypeLabel
+syn match ocamlTypeLabel contained "?\?\(\l\|_\)\(\w\|'\)*\_s*:[>=]\@!"
+hi link ocamlTypeLabel ocamlLabel
+
+" Object type
+syn cluster ocamlTypeExpr add=ocamlTypeObject
+syn region ocamlTypeObject contained
+\ matchgroup=ocamlEncl start="<"
+\ matchgroup=ocamlEncl end=">"
+\ contains=ocamlTypeObjectDots,ocamlLCIdentifier,ocamlTypeObjectAnnot,ocamlTypeBlank,ocamlComment,ocamlPpx
+hi link ocamlTypeObject ocamlTypeCatchAll
+syn cluster ocamlTypeContained add=ocamlTypeObjectDots
+syn match ocamlTypeObjectDots contained "\.\."
+hi link ocamlTypeObjectDots ocamlKeyChar
+syn cluster ocamlTypeContained add=ocamlTypeObjectAnnot
+syn region ocamlTypeObjectAnnot contained
+\ matchgroup=ocamlKeyChar start=":"
+\ matchgroup=ocamlKeyChar end=";\|>\@="
+\ contains=@ocamlTypeExpr,ocamlComment,ocamlPpx
+hi link ocamlTypeObjectAnnot ocamlTypeCatchAll
+
+" Record type definition
+syn cluster ocamlTypeContained add=ocamlTypeRecordDecl
+syn region ocamlTypeRecordDecl contained
+\ matchgroup=ocamlEncl start="{"
+\ matchgroup=ocamlEncl end="}"
+\ contains=ocamlTypeMutable,ocamlLCIdentifier,ocamlTypeRecordAnnot,ocamlTypeBlank,ocamlComment,ocamlPpx
+hi link ocamlTypeRecordDecl ocamlTypeCatchAll
+syn cluster ocamlTypeContained add=ocamlTypeMutable
+syn keyword ocamlTypeMutable contained mutable
+hi link ocamlTypeMutable ocamlKeyword
+syn cluster ocamlTypeContained add=ocamlTypeRecordAnnot
+syn region ocamlTypeRecordAnnot contained
+\ matchgroup=ocamlKeyChar start=":"
+\ matchgroup=ocamlKeyChar end=";\|}\@="
+\ contains=@ocamlTypeExpr,ocamlComment,ocamlPpx
+hi link ocamlTypeRecordAnnot ocamlTypeCatchAll
+
+" Polymorphic variant types
+" NOTE: Carefully avoid catching "[@" here.
+syn cluster ocamlTypeExpr add=ocamlTypeVariant
+syn region ocamlTypeVariant contained
+\ matchgroup=ocamlEncl start="\[>" start="\[<" start="\[@\@!"
+\ matchgroup=ocamlEncl end="\]"
+\ contains=ocamlTypeVariantKeyChar,ocamlTypeVariantConstr,ocamlTypeVariantAnnot,ocamlTypeBlank,ocamlComment,ocamlPpx
+hi link ocamlTypeVariant ocamlTypeCatchAll
+syn cluster ocamlTypeContained add=ocamlTypeVariantKeyChar
+syn match ocamlTypeVariantKeyChar contained "|"
+syn match ocamlTypeVariantKeyChar contained ">"
+hi link ocamlTypeVariantKeyChar ocamlKeyChar
+syn cluster ocamlTypeContained add=ocamlTypeVariantConstr
+syn match ocamlTypeVariantConstr contained "`\w\(\w\|'\)*\>"
+hi link ocamlTypeVariantConstr ocamlConstructor
+syn cluster ocamlTypeContained add=ocamlTypeVariantAnnot
+syn region ocamlTypeVariantAnnot contained
+\ matchgroup=ocamlKeyword start="\<of\>"
+\ matchgroup=ocamlKeyChar end="|\|>\|\]\@="
+\ contains=@ocamlTypeExpr,ocamlTypeAmp,ocamlComment,ocamlPpx
+hi link ocamlTypeVariantAnnot ocamlTypeCatchAll
+syn cluster ocamlTypeContained add=ocamlTypeAmp
+syn match ocamlTypeAmp contained "&"
+hi link ocamlTypeAmp ocamlTypeKeyChar
+
+" Sum type definition
+syn cluster ocamlTypeContained add=ocamlTypeSumDecl
+syn region ocamlTypeSumDecl contained
+\ matchgroup=ocamlTypeSumBar start="|"
+\ matchgroup=ocamlTypeSumConstr start="\<\u\(\w\|'\)*\>"
+\ matchgroup=ocamlTypeSumConstr start="\<false\>" start="\<true\>"
+\ matchgroup=ocamlTypeSumConstr start="(\_s*)" start="\[\_s*]" start="(\_s*::\_s*)"
+\ matchgroup=NONE end="\(\<type\>\|\<exception\>\|\<val\>\|\<module\>\|\<class\>\|\<method\>\|\<constraint\>\|\<inherit\>\|\<object\>\|\<struct\>\|\<open\>\|\<include\>\|\<let\>\|\<external\>\|\<in\>\|\<end\>\|)\|]\|}\|;\|;;\|=\)\@="
+\ matchgroup=NONE end="\(\<and\>\)\@="
+\ contains=ocamlTypeSumBar,ocamlTypeSumConstr,ocamlTypeSumAnnot,ocamlTypeBlank,ocamlComment,ocamlPpx
+hi link ocamlTypeSumDecl ocamlTypeCatchAll
+syn cluster ocamlTypeContained add=ocamlTypeSumBar
+syn match ocamlTypeSumBar contained "|"
+hi link ocamlTypeSumBar ocamlKeyChar
+syn cluster ocamlTypeContained add=ocamlTypeSumConstr
+syn match ocamlTypeSumConstr contained "\<\u\(\w\|'\)*\>"
+syn match ocamlTypeSumConstr contained "\<false\>"
+syn match ocamlTypeSumConstr contained "\<true\>"
+syn match ocamlTypeSumConstr contained "(\_s*)"
+syn match ocamlTypeSumConstr contained "\[\_s*]"
+syn match ocamlTypeSumConstr contained "(\_s*::\_s*)"
+hi link ocamlTypeSumConstr ocamlConstructor
+syn cluster ocamlTypeContained add=ocamlTypeSumAnnot
+syn region ocamlTypeSumAnnot contained
+\ matchgroup=ocamlKeyword start="\<of\>"
+\ matchgroup=ocamlKeyChar start=":"
+\ matchgroup=NONE end="|\@="
+\ matchgroup=NONE end="\(\<type\>\|\<exception\>\|\<val\>\|\<module\>\|\<class\>\|\<method\>\|\<constraint\>\|\<inherit\>\|\<object\>\|\<struct\>\|\<open\>\|\<include\>\|\<let\>\|\<external\>\|\<in\>\|\<end\>\|)\|]\|}\|;\|;;\)\@="
+\ matchgroup=NONE end="\(\<and\>\)\@="
+\ contains=@ocamlTypeExpr,ocamlTypeRecordDecl,ocamlComment,ocamlPpx
+hi link ocamlTypeSumAnnot ocamlTypeCatchAll
+
+" Type context opened by “type†(type definition), “constraint†(type
+" constraint) and “exception†(exception definition)
+syn region ocamlTypeDef
+\ matchgroup=ocamlKeyword start="\<type\>\(\_s\+\<nonrec\>\)\?\|\<constraint\>\|\<exception\>"
+\ matchgroup=NONE end="\(\<type\>\|\<exception\>\|\<val\>\|\<module\>\|\<class\>\|\<method\>\|\<constraint\>\|\<inherit\>\|\<object\>\|\<struct\>\|\<open\>\|\<include\>\|\<let\>\|\<external\>\|\<in\>\|\<end\>\|)\|]\|}\|;\|;;\)\@="
+\ contains=@ocamlTypeExpr,ocamlTypeEq,ocamlTypePrivate,ocamlTypeDefDots,ocamlTypeRecordDecl,ocamlTypeSumDecl,ocamlTypeDefAnd,ocamlComment,ocamlPpx
+hi link ocamlTypeDef ocamlTypeCatchAll
+syn cluster ocamlTypeContained add=ocamlTypePrivate
+syn keyword ocamlTypePrivate contained private
+hi link ocamlTypePrivate ocamlKeyword
+syn cluster ocamlTypeContained add=ocamlTypeDefAnd
+syn keyword ocamlTypeDefAnd contained and
+hi link ocamlTypeDefAnd ocamlKeyword
+syn cluster ocamlTypeContained add=ocamlTypeDefDots
+syn match ocamlTypeDefDots contained "\.\."
+hi link ocamlTypeDefDots ocamlKeyChar
+
+" When "exception" is preceded by "with", "|" or "(", that’s not an exception
+" definition but an exception pattern; we simply highlight the keyword without
+" starting a type context.
+" NOTE: These rules must occur after that for "exception".
+syn match ocamlKeyword "\<with\_s\+exception\>"lc=4
+syn match ocamlKeyword "|\_s*exception\>"lc=1
+syn match ocamlKeyword "(\_s*exception\>"lc=1
+
+" Type context opened by “:†(countless kinds of type annotations) and “:>â€
+" (type coercions)
+syn region ocamlTypeAnnot matchgroup=ocamlKeyChar start=":\(>\|\_s*type\>\|[>:=]\@!\)"
+\ matchgroup=NONE end="\(\<type\>\|\<exception\>\|\<val\>\|\<module\>\|\<class\>\|\<method\>\|\<constraint\>\|\<inherit\>\|\<object\>\|\<struct\>\|\<open\>\|\<include\>\|\<let\>\|\<external\>\|\<in\>\|\<end\>\|)\|]\|}\|;\|;;\)\@="
+\ matchgroup=NONE end="\(;\|}\)\@="
+\ matchgroup=NONE end="\(=\|:>\)\@="
+\ contains=@ocamlTypeExpr,ocamlComment,ocamlPpx
+hi link ocamlTypeAnnot ocamlTypeCatchAll
+
+" Type annotation that gives the return type of a `fun` keyword
+" (the type context is ended by `->`)
+syn cluster ocamlTypeContained add=ocamlFunTypeAnnot
+syn region ocamlFunTypeAnnot contained containedin=ocamlFun
+\ matchgroup=ocamlKeyChar start=":"
+\ matchgroup=NONE end="\(->\)\@="
+\ contains=@ocamlTypeExpr,ocamlComment,ocamlPpx
+hi link ocamlFunTypeAnnot ocamlTypeCatchAll
+
+" Module paths (including functors) in types.
+" NOTE: This rule must occur after the rule for ocamlTypeSumDecl as it must take
+" precedence over it (otherwise the module name would be mistakenly highlighted
+" as a constructor).
+" NOTE: Carefully avoid catching "(*" here.
+syn cluster ocamlTypeExpr add=ocamlTypeModPath
+syn match ocamlTypeModPath contained "\<\u\(\w\|'\)*\_s*\."
+syn region ocamlTypeModPath contained transparent
+\ matchgroup=ocamlModPath start="\<\u\(\w\|'\)*\_s*(\*\@!"
+\ matchgroup=ocamlModPath end=")\_s*\."
+\ contains=ocamlTypeDotlessModPath,ocamlTypeBlank,ocamlComment,ocamlPpx
+hi link ocamlTypeModPath ocamlModPath
+syn cluster ocamlTypeContained add=ocamlTypeDotlessModPath
+syn match ocamlTypeDotlessModPath contained "\<\u\(\w\|'\)*\_s*\.\?"
+syn region ocamlTypeDotlessModPath contained transparent
+\ matchgroup=ocamlModPath start="\<\u\(\w\|'\)*\_s*(\*\@!"
+\ matchgroup=ocamlModPath end=")\_s*\.\?"
+\ contains=ocamlTypeDotlessModPath,ocamlTypeBlank,ocamlComment,ocamlPpx
+hi link ocamlTypeDotlessModPath ocamlTypeModPath
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Synchronization
syn sync minlines=50
@@ -306,27 +565,25 @@ hi def link ocamlBrackErr Error
hi def link ocamlParenErr Error
hi def link ocamlArrErr Error
-hi def link ocamlCommentErr Error
-
hi def link ocamlCountErr Error
hi def link ocamlDoErr Error
hi def link ocamlDoneErr Error
hi def link ocamlEndErr Error
hi def link ocamlThenErr Error
+hi def link ocamlKwErr Error
hi def link ocamlCharErr Error
hi def link ocamlErr Error
hi def link ocamlComment Comment
+hi def link ocamlShebang ocamlComment
hi def link ocamlModPath Include
hi def link ocamlObject Include
hi def link ocamlModule Include
hi def link ocamlModParam1 Include
hi def link ocamlGenMod Include
-hi def link ocamlModType Include
-hi def link ocamlMPRestr3 Include
hi def link ocamlFullMod Include
hi def link ocamlFuncWith Include
hi def link ocamlModParam Include
@@ -339,10 +596,13 @@ hi def link ocamlStructEncl ocamlModule
hi def link ocamlScript Include
hi def link ocamlConstructor Constant
+hi def link ocamlEmptyConstructor ocamlConstructor
hi def link ocamlVal Keyword
+hi def link ocamlModTypePre Keyword
hi def link ocamlModPreRHS Keyword
-hi def link ocamlMPRestr2 Keyword
+hi def link ocamlFunctor Keyword
+hi def link ocamlModTypeOf Keyword
hi def link ocamlKeyword Keyword
hi def link ocamlMethod Include
hi def link ocamlArrow Keyword
@@ -352,8 +612,6 @@ hi def link ocamlTopStop Keyword
hi def link ocamlRefAssign ocamlKeyChar
hi def link ocamlEqual ocamlKeyChar
-hi def link ocamlStar ocamlInfixOp
-hi def link ocamlAngle ocamlInfixOp
hi def link ocamlCons ocamlInfixOp
hi def link ocamlPrefixOp ocamlOperator
@@ -377,7 +635,24 @@ hi def link ocamlQuotedStringDelim Identifier
hi def link ocamlLabel Identifier
-hi def link ocamlType Type
+" Type linting groups that the user can customize:
+" - ocamlTypeCatchAll: anything in a type context that is not caught by more
+" specific rules (in principle, this should only match syntax errors)
+" - ocamlTypeConstr: type constructors
+" - ocamlTypeBuiltin: builtin type constructors (like int or list)
+" - ocamlTypeVar: type variables ('a)
+" - ocamlTypeAnyVar: wildcard (_)
+" - ocamlTypeVariance: variance and injectivity indications (+'a, !'a)
+" - ocamlTypeKeyChar: symbols such as -> and *
+" Default values below mimick the behavior before the type linter was
+" implemented, but now we can do better. :-)
+hi def link ocamlTypeCatchAll Error
+hi def link ocamlTypeConstr NONE
+hi def link ocamlTypeBuiltin Type
+hi def link ocamlTypeVar NONE
+hi def link ocamlTypeAnyVar NONE
+hi def link ocamlTypeVariance ocamlKeyChar
+hi def link ocamlTypeKeyChar ocamlKeyChar
hi def link ocamlTodo Todo
diff --git a/runtime/syntax/opam.vim b/runtime/syntax/opam.vim
index 9ac1d41ce7..da296627e5 100644
--- a/runtime/syntax/opam.vim
+++ b/runtime/syntax/opam.vim
@@ -1,5 +1,5 @@
" Vim syntax file
-" Language: OPAM - OCaml package manager
+" Language: opam - OCaml package manager
" Maintainer: Markus Mottl <markus.mottl@gmail.com>
" URL: https://github.com/ocaml/vim-ocaml
" Last Change:
@@ -11,20 +11,55 @@ endif
" need %{vars}%
" env: [[CAML_LD_LIBRARY_PATH = "%{lib}%/stublibs"]]
-syn keyword opamKeyword1 remove depends pin-depends depopts conflicts env packages patches version maintainer tags license homepage authors doc install author available name depexts substs synopsis description
-syn match opamKeyword2 "\v(bug-reports|post-messages|ocaml-version|opam-version|dev-repo|build-test|build-doc|build)"
+syn iskeyword a-z,A-Z,-
+syn keyword opamKeyword1 author
+syn keyword opamKeyword1 authors
+syn keyword opamKeyword1 available
+syn keyword opamKeyword1 bug-reports
+syn keyword opamKeyword1 build
+syn keyword opamKeyword1 build-env
+syn keyword opamKeyword1 conflict-class
+syn keyword opamKeyword1 conflicts
+syn keyword opamKeyword1 depends
+syn keyword opamKeyword1 depexts
+syn keyword opamKeyword1 depopts
+syn keyword opamKeyword1 description
+syn keyword opamKeyword1 dev-repo
+syn keyword opamKeyword1 doc
+syn keyword opamKeyword1 extra-files
+syn keyword opamKeyword1 features
+syn keyword opamKeyword1 flags
+syn keyword opamKeyword1 homepage
+syn keyword opamKeyword1 install
+syn keyword opamKeyword1 libraries
+syn keyword opamKeyword1 license
+syn keyword opamKeyword1 maintainer
+syn keyword opamKeyword1 messages
+syn keyword opamKeyword1 name
+syn keyword opamKeyword1 opam-version
+syn keyword opamKeyword1 patches
+syn keyword opamKeyword1 pin-depends
+syn keyword opamKeyword1 post-messages
+syn keyword opamKeyword1 remove
+syn keyword opamKeyword1 run-test
+syn keyword opamKeyword1 setenv
+syn keyword opamKeyword1 substs
+syn keyword opamKeyword1 synopsis
+syn keyword opamKeyword1 syntax
+syn keyword opamKeyword1 tags
+syn keyword opamKeyword1 version
syn keyword opamTodo FIXME NOTE NOTES TODO XXX contained
syn match opamComment "#.*$" contains=opamTodo,@Spell
syn match opamOperator ">\|<\|=\|<=\|>="
-syn region opamInterpolate start=/%{/ end=/}%/ contained
-syn region opamString start=/"/ end=/"/ contains=opamInterpolate
-syn region opamSeq start=/\[/ end=/\]/ contains=ALLBUT,opamKeyword1,opamKeyword2
-syn region opamExp start=/{/ end=/}/ contains=ALLBUT,opamKeyword1,opamKeyword2
+syn match opamUnclosedInterpolate "%{[^ "]*" contained
+syn match opamInterpolate "%{[^ "]\+}%" contained
+syn region opamString start=/"/ end=/"/ contains=opamInterpolate,OpamUnclosedInterpolate
+syn region opamSeq start=/\[/ end=/\]/ contains=ALLBUT,opamKeyword1
+syn region opamExp start=/{/ end=/}/ contains=ALLBUT,opamKeyword1
hi link opamKeyword1 Keyword
-hi link opamKeyword2 Keyword
hi link opamString String
hi link opamExp Function
@@ -32,6 +67,7 @@ hi link opamSeq Statement
hi link opamOperator Operator
hi link opamComment Comment
hi link opamInterpolate Identifier
+hi link opamUnclosedInterpolate Error
let b:current_syntax = "opam"
diff --git a/runtime/syntax/progress.vim b/runtime/syntax/progress.vim
index 5e7cfef299..4b8f61287c 100644
--- a/runtime/syntax/progress.vim
+++ b/runtime/syntax/progress.vim
@@ -3,13 +3,13 @@
" Filename extensions: *.p (collides with Pascal),
" *.i (collides with assembler)
" *.w (collides with cweb)
-" Maintainer: Philip Uren <philuSPAXY@ieee.org> Remove SPAXY spam block
+" Maintainer: Daniel Smith <daniel@rdnlsmith.com>
+" Previous Maintainer: Philip Uren <philuSPAXY@ieee.org> Remove SPAXY spam block
" Contributors: Matthew Stickney <mtstickneySPAXY@gmail.com>
" Chris Ruprecht <chrisSPAXY@ruprecht.org>
" Mikhail Kuperblum <mikhailSPAXY@whasup.com>
" John Florian <jflorianSPAXY@voyager.net>
-" Version: 13
-" Last Change: Nov 11 2012
+" Last Change: Jul 23 2024
" quit when a syntax file was already loaded
if exists("b:current_syntax")
@@ -116,8 +116,10 @@ syn match ProgressShowTab "\t"
" If you don't like white space on the end of lines, uncomment this:
" syn match ProgressSpaceError "\s\+$"
-syn region ProgressComment start="/\*" end="\*/" contains=ProgressComment,ProgressTodo,ProgressDebug,@Spell
-syn region ProgressInclude start="^[ ]*[{]" end="[}]" contains=ProgressPreProc,ProgressOperator,ProgressString,ProgressComment
+syn region ProgressBlockComment start="/\*" end="\*/" contains=ProgressBlockComment,ProgressTodo,ProgressDebug,@Spell
+syn match ProgressLineComment "//.*$" contains=ProgressTodo,ProgressDebug,@Spell
+syn cluster ProgressComment contains=ProgressBlockComment,ProgressLineComment
+syn region ProgressInclude start="^[ ]*[{]" end="[}]" contains=ProgressPreProc,ProgressOperator,ProgressString,@ProgressComment
syn region ProgressPreProc start="&" end="\>" contained
" This next line works reasonably well.
@@ -281,6 +283,8 @@ syn sync lines=800
hi def link ProgressByte Number
hi def link ProgressCase Repeat
hi def link ProgressComment Comment
+hi def link ProgressBlockComment ProgressComment
+hi def link ProgressLineComment ProgressComment
hi def link ProgressConditional Conditional
hi def link ProgressDebug Debug
hi def link ProgressDo Repeat
diff --git a/runtime/syntax/query.lua b/runtime/syntax/query.lua
index 1e129dbeff..2dfe29f69b 100644
--- a/runtime/syntax/query.lua
+++ b/runtime/syntax/query.lua
@@ -1,6 +1,6 @@
-- Neovim syntax file
-- Language: Treesitter query
--- Last Change: 2022 Apr 13
+-- Last Change: 2024 Jul 03
-- it's a lisp!
-vim.cmd([[ runtime! syntax/lisp.vim ]])
+vim.cmd([[runtime! syntax/lisp.vim]])
diff --git a/runtime/syntax/rasi.vim b/runtime/syntax/rasi.vim
new file mode 100644
index 0000000000..40c3393fc5
--- /dev/null
+++ b/runtime/syntax/rasi.vim
@@ -0,0 +1,298 @@
+" Vim syntax file
+" Language: rasi (Rofi Advanced Style Information)
+" Maintainer: Pierrick Guillaume <pierguill@gmail.com>
+" Last Change: 2024 May 21
+"
+" Syntax support for rasi config file
+
+" This file is based on syntax defined in rofi-theme man page
+" https://man.archlinux.org/man/community/rofi/rofi-theme.5.en
+
+if exists('b:current_syntax')
+ finish
+endif
+let b:current_syntax = 'rasi'
+
+" String {{{
+syn region rasiString start=+"+ skip=+\\"+ end=+"+ oneline contained
+syn match rasiCharacter +L\='[^\\]'+ contained
+
+syn cluster rasiPropertyVals add=rasiString,rasiCharacter
+" }}}
+
+" Integer/Real {{{
+syn match rasiNumber display contained '[+-]\?\d\+\(\.\d\+\)\?'
+
+syn cluster rasiPropertyVals add=rasiNumber
+" }}}
+
+" Boolean {{{
+syn keyword rasiBool contained true false
+
+syn cluster rasiPropertyVals add=rasiBool
+" }}}
+
+" Image {{{
+syn match rasiInvImage display contained 'url([^)]*)'
+syn keyword rasiImageK contained url linear-gradient
+
+syn match rasiImage display contained transparent 'url(\s*"\([^"]\|\\"\)\+"\(\s*,\s*\(none\|both\|width\|height\)\)\?\s*)' contains=rasiImageScale,rasiString,rasiImageK
+syn keyword rasiImageScale contained none both width height
+
+syn match rasiImage display contained transparent 'linear-gradient(\s*\(\(top\|left\|right\|bottom\)\s*,\s*\)\?[^,)]\+\s*\(,\s*[^,)]\+\s*\)\+)' contains=rasiImageDirection,@rasiColors,rasiImageK
+syn keyword rasiImageDirection contained top left right bottom
+
+syn match rasiImage display contained transparent 'linear-gradient(\s*\d\+\(rad\|grad\|deg\)\s*,\s*[^,)]\+\s*\(,\s*[^,)]\+\s*\)\+)' contains=rasiImageUnit,@rasiColor,@rasiInvColor,rasiNumber,rasiImageK
+syn match rasiImageUnit display contained '\(rad\|grad\|deg\)\>'
+
+syn cluster rasiPropertyVals add=rasiInvImage,rasiImage
+" }}}
+
+" Reference {{{
+syn match rasiReference display contained '@[a-zA-Z0-9-]\+'
+
+syn keyword rasiVarReferenceK contained var
+
+syn match rasiInvVarReference display contained 'var([^)]*)'
+syn match rasiVarReference display contained transparent 'var(\s*[a-zA-Z0-9-]\+\s*,\s*\(\a\+\s*([^)]*)\)\?[^),]*)' contains=rasiVarReferenceK,rasiPropertyIdRef,@rasiPropertyVals
+syn match rasiPropertyIdRef display contained '\a[a-zA-Z0-9-]*'
+
+syn cluster rasiPropertyVals add=rasiReference,rasiInvVarReference,rasiVarReference
+" }}}
+
+" Env variable {{{
+syn match rasiInvEnv display contained '${[^}]*}'
+syn match rasiEnv display contained '${\w\+}'hs=s+2,he=e-1
+
+syn keyword rasiEnvVarK contained env
+
+syn match rasiInvEnvVar display contained 'env([^)]*)'
+syn match rasiEnvVar display contained transparent 'env(\s*\w\+\s*,\s*\(\a\+([^)]*)\)\?[^),]*)' contains=rasiEnvVarK,rasiEnvRef,@rasiPropertyVals
+syn match rasiEnvRef display contained '\a\w*'
+
+syn cluster rasiPropertyVals add=rasiEnv,rasiInvEnv,rasiInvEnvVar,rasiEnvVar
+" }}}
+
+" Color {{{
+syn keyword rasiColorK contained rgb[a] hsl[a] hwb[a] cmyk
+
+syn match rasiHexColor display contained '#\x\{3,4}'
+syn match rasiHexColor display contained '#\x\{6}'
+syn match rasiHexColor display contained '#\x\{8}'
+syn match rasiInvHexColor display contained '#\x\{5}\X'he=e-1,me=e-1
+syn match rasiInvHexColor display contained '#\x\{7}\X'he=e-1,me=e-1
+
+syn match rasiInvRGBColor display contained 'rgb\(a\)\?([^)]*)'
+syn match rasiRGBColor display contained transparent 'rgb\(a\)\?(\s*\d\+\s*\(%\)\?\s*,\(\s*\d\+\s*\(%\)\?\s*\){2}\(,\s*\(\d\(\.\d*\)\?\|\d\{,3}%\)\s*\)\?)' contains=rasiColorK,rasiNumber,rasiDistance
+
+syn match rasiInvHSLColor display contained 'h\(sl\|wb\)\(a\)\?([^)]*)'
+syn match rasiHSLColor display contained transparent 'h\(sl\|wb\)\(a\)\?(\s*\d\+\(\.\d*\)\?\(deg\|rad\|grad\|turn\)\?\s*\(,\s*\(\d\(\.\d*\)\?\|\d\{,3}%\)\s*\)\{2,3})' contains=rasiColorK,rasiNumber,rasiDistance
+
+
+"this matches doesn't works properly (too long ?)
+syn match rasiInvCMYKColor display contained 'cmyk([^)]*)'
+syn match rasiCMYKColor display contained transparent 'cmyk(\s*\(\d\(\.\d*\)\?\|\d\{,3}%\)\s*\(,\s*\(\d\(\.\d*\)\?\|\d\{,3}%\)\s*\)\{3,4})' contains=rasiColorK,rasiNumber,rasiDistance
+
+syn case ignore
+syn keyword rasiNamedColor contained
+ \ AliceBlue AntiqueWhite Aqua Aquamarine Azure Beige Bisque Black BlanchedAlmond Blue
+ \ BlueViolet Brown BurlyWood CadetBlue Chartreuse Chocolate Coral CornflowerBlue Cornsilk
+ \ Crimson Cyan DarkBlue DarkCyan DarkGoldenRod DarkGray DarkGrey DarkGreen DarkKhaki DarkMagenta
+ \ DarkOliveGreen DarkOrange DarkOrchid DarkRed DarkSalmon DarkSeaGreen Dark SlateBlue
+ \ DarkSlateGray DarkSlateGrey DarkTurquoise DarkViolet DeepPink DeepSkyBlue DimGray DimGrey
+ \ DodgerBlue FireBrick FloralWhite ForestGreen Fuchsia Gainsboro GhostWhite Gold GoldenRod
+ \ Gray Grey Green GreenYellow HoneyDew HotPink IndianRed Indigo Ivory Khaki Lavender
+ \ LavenderBlush LawnGreen LemonChiffon LightBlue LightCoral LightCyan LightGoldenRodYellow
+ \ LightGray LightGrey LightGreen LightPink LightSalmon LightSeaGreen LightSkyBlue LightSlateGray
+ \ LightSlateGrey LightSteelBlue LightYellow Lime LimeGreen Linen Magenta Maroon MediumAquaMarine
+ \ MediumBlue MediumOrchid MediumPurple MediumSeaGreen MediumSlateBlue MediumSpringGreen
+ \ MediumTurquoise MediumVioletRed MidnightBlue MintCream MistyRose Moccasin NavajoWhite Navy
+ \ OldLace Olive OliveDrab Orange OrangeRed Orchid PaleGoldenRod PaleGreen PaleTurquoise
+ \ PaleVioletRed PapayaWhip PeachPuff Peru Pink Plum PowderBlue Purple RebeccaPurple Red
+ \ RosyBrown RoyalBlue SaddleBrown Salmon SandyBrown SeaGreen SeaShell Sienna Silver SkyBlue
+ \ SlateBlue SlateGray SlateGrey Snow SpringGreen SteelBlue Tan Teal Thistle Tomato Turquoise
+ \ Violet Wheat White WhiteSmoke Yellow YellowGreen transparent[] "uses `[]` to escape keyword
+
+syn cluster rasiColors add=rasiHexColor,rasiRGBColor,rasiHSLColor,rasiCMYKColor,rasiNamedColor
+syn cluster rasiColors add=rasiInvHexColor,rasiInvRGBColor,rasiInvHSLColor,rasiInvCMYKColor
+
+syn cluster rasiPropertyVals add=@rasiColors
+" }}}
+
+" Text-Style {{{
+syn keyword rasiTextStyle contained bold italic underline strikethrough none
+
+syn cluster rasiPropertyVals add=rasiTextStyle
+" }}}
+
+" Line-Style {{{
+syn keyword rasiLineStyle contained dash solid
+
+syn cluster rasiPropertyVals add=rasiLineStyle
+" }}}
+
+" Distance {{{
+syn match rasiDistanceUnit display contained '\(px\|em\|ch\|%\|mm\)'
+
+syn match rasiInvDistance display contained '[+-]\?\d\+\.\d\+\(px\|mm\)'
+syn match rasiDistance display contained transparent '[-+]\?\d\+\(px\|mm\)' contains=rasiDistanceUnit,rasiNumber
+syn match rasiDistance display contained transparent '[+-]\?\d\+\(\.\d\+\)\?\(em\|ch\|%\)' contains=rasiDistanceUnit,rasiNumber
+
+syn keyword rasiDistanceCalc contained calc nextgroup=rasiDistanceCalcBody
+syn region rasiDistanceCalcBody display contained start=+(+ end=+)+ contains=rasiDistanceCalcOp,rasiDistance,rasiInvDistance
+syn match rasiDistanceCalcOp display contained '\(+\|-\|/\|\*\|%\|min\|max\)'
+
+syn cluster rasiPropertyVals add=rasiInvDistance,rasiDistance,rasiDistanceCalc
+" }}}
+
+" Position {{{
+syn keyword rasiPosition contained center east north west south
+
+syn cluster rasiPropertyVals add=rasiPosition
+" }}}
+
+" Orientation {{{
+syn keyword rasiOrientation contained horizontal vertical
+
+syn cluster rasiPropertyVals add=rasiOrientation
+" }}}
+
+" Cursor {{{
+syn keyword rasiCursor contained default pointer text
+
+syn cluster rasiPropertyVals add=rasiCursor
+" }}}
+
+" Keyword List {{{
+syn region rasiKeywordList contained start=+\[+ end=+\]+ contains=rasiPropertyIdRef
+
+syn cluster rasiPropertyVals add=rasiKeywordList
+" }}}
+
+" Inherit {{{
+syn keyword rasiInherit contained inherit children
+
+syn cluster rasiPropertyVals add=rasiInherit
+" }}}
+
+syn match rasiGlobalImport display '^\s*@\(import\|theme\)' nextgroup=rasiString skipwhite
+
+" Section {{{
+" syn region rasiSection transparent start='^[^{]\+{'me=e-1 end='}' contains=rasiSectionOpenning,rasiSectionContent
+syn match rasiSectionOpenning transparent '^[^{]\+{'me=e-1 contains=rasiGlobalSection,rasiWidgetName,rasiGlobalMedia nextgroup=rasiThemeSectionContent
+" syn match rasiThemeInnerSectionOpenning transparent '^[^:${]\+{'me=e-1 contains=rasiWidgetName nextgroup=rasiThemeInnerSectionContent contained
+
+syn match rasiGlobalMedia display contained '^\s*@media' nextgroup=rasiInvMediaBody,rasiMediaBody skipwhite
+syn match rasiInvMediaBody display contained '([^)]*)'
+syn match rasiMediaBody display contained '(\s*[a-z-]\+\s*:\s*\d\+\(px\|mm\)\?\s*)' contains=rasiMediaK,rasiNumber,rasiDistance
+syn keyword rasiMediaK contained min-width max-width min-height max-height min-aspect-ratio max-aspect-ratio monitor-id
+
+syn match rasiGlobalSection display contained '^*'
+syn match rasiWidgetName display contained '[a-zA-Z0-9-]\+' nextgroup=rasiVisibleMod skipwhite
+
+syn keyword rasiVisibleMod contained normal selected alternate nextgroup=rasiVisibleMod,rasiStateWrapper skipwhite
+syn match rasiStateWrapper display contained transparent '\.\(normal\|active\|urgent\)' contains=rasiState
+syn keyword rasiState contained normal active urgent
+
+
+syn region rasiThemeSectionContent transparent start="{" end="}" contains=rasiProperty,rasiComment,rasiCommentL,rasiSectionOpenning contained
+" syn region rasiThemeInnerSectionContent transparent start="{" end="}" contains=rasiProperty,rasiComment,rasiCommentL,rasiThemeInnerSectionOpenning contained
+
+syn match rasiProperty transparent '^\s*\S\+\s*:.*;\s*$' keepend contained contains=rasiPropertyId,rasiInvPropertyId,rasiPropertyVal,rasiComment,rasiCommentL
+syn match rasiInvPropertyId '^\([^:]\&[^/]\{2}\)*:'me=e-1 contained
+syn match rasiPropertyId '^\s*[0-9a-zA-Z-]\+\s*:'me=e-1 contained
+syn match rasiInvPropertyVal ':[^;];\s*\S\+\s*$'ms=s+1,hs=s+1
+syn match rasiPropertyVal ':\s*[^;]\+;\s*$'ms=s+1,hs=s+1 contained contains=@rasiPropertyVals
+" }}}
+
+" Comment {{{
+syn cluster rasiCommentGroup contains=rasiTodo,rasiBadContinuation
+
+syn region rasiCommentL start="//" skip="\\$" end="$" keepend contains=@rasiCommentGroup,@Spell
+syn region rasiComment start="/\*" end="\*/" contains=@rasiCommentGroup,rasiCommentStartError,@Spell fold extend
+
+syn match rasiCommentError display '\*/'
+
+syn keyword rasiTodo contained TODO FIXME XXX NOTE
+
+if exists("rasi_minlines")
+ let b:rasi_minlines = rasi_minlines
+else
+ let b:rasi_minlines = 50
+endif
+exec "syn sync ccomment rasiComment minlines=" . b:rasi_minlines
+" }}}
+
+
+
+" Highlighting: {{{
+hi def link rasiError Error
+
+hi def link rasiTodo Todo
+hi def link rasiComment Comment
+hi def link rasiCommentStart rasiComment
+hi def link rasiCommentL rasiComment
+hi def link rasiCommentError rasiError
+
+hi def link rasiString String
+hi def link rasiNumber Number
+hi def link rasiBool Boolean
+
+hi def link rasiImageK Function
+hi def link rasiImageScale Keyword
+hi def link rasiImageDirection Keyword
+hi def link rasiImageUnit Type
+hi def link rasiInvImage rasiError
+
+hi def link rasiHexColor Number
+hi def link rasiColorK Function
+hi def link rasiNamedColor Number
+hi def link rasiInvColor rasiError
+hi def link rasiInvHexColor rasiInvColor
+hi def link rasiInvRGBColor rasiInvColor
+hi def link rasiInvHSLColor rasiInvColor
+hi def link rasiInvCMYKColor rasiInvColor
+
+hi def link rasiTextStyle Keyword
+hi def link rasiLineStyle Keyword
+
+hi def link rasiDistanceUnit Type
+hi def link rasiDistanceCalc Function
+hi def link rasiDistanceCalcOp Operator
+hi def link rasiInvDistance rasiError
+
+hi def link rasiPosition Keyword
+hi def link rasiOrientation Keyword
+hi def link rasiCursor Keyword
+
+hi def link rasiReference Identifier
+hi def link rasiPropertyIdRef Identifier
+hi def link rasiVarReferenceK Function
+hi def link rasiInvVarReference rasiError
+
+hi def link rasiEnv Identifier
+hi def link rasiEnvRef Identifier
+hi def link rasiEnvVarK Function
+hi def link rasiInvEnv rasiError
+hi def link rasiInvEnvVar rasiError
+
+hi def link rasiWidgetName StorageClass
+hi def link rasiGlobalSection StorageClass
+hi def link rasiVisibleMod Type
+hi def link rasiState Tag
+
+hi def link rasiInherit Identifier
+
+hi def link rasiGlobalImport Include
+
+hi def link rasiGlobalMedia Preproc
+hi def link rasiMediaK Keyword
+hi def link rasiInvMediaBody rasiError
+
+hi def link rasiPropertyId Identifier
+hi def link rasiInvProperty rasiError
+hi def link rasiInvPropertyId rasiError
+hi def link rasiInvPropertyVal rasiError
+" }}}
+
+" vim:ts=8
diff --git a/runtime/syntax/salt.vim b/runtime/syntax/salt.vim
new file mode 100644
index 0000000000..fdbce2f677
--- /dev/null
+++ b/runtime/syntax/salt.vim
@@ -0,0 +1,16 @@
+" Vim syntax file
+" Maintainer: Gregory Anders
+" Last Changed: 2024-09-16
+
+if exists('b:current_syntax')
+ finish
+endif
+
+" Salt state files are just YAML with embedded Jinja
+runtime! syntax/yaml.vim
+unlet! b:current_syntax
+
+runtime! syntax/jinja.vim
+unlet! b:current_syntax
+
+let b:current_syntax = 'salt'
diff --git a/runtime/syntax/scheme.vim b/runtime/syntax/scheme.vim
index c4454fc57c..59b0cc5b18 100644
--- a/runtime/syntax/scheme.vim
+++ b/runtime/syntax/scheme.vim
@@ -1,12 +1,12 @@
" Vim syntax file
-" Language: Scheme (R7RS)
-" Last Change: 2021-01-03
-" Author: Evan Hanson <evhan@foldling.org>
-" Maintainer: Evan Hanson <evhan@foldling.org>
-" Previous Author: Dirk van Deun <dirk@igwe.vub.ac.be>
+" Language: Scheme (R7RS)
+" Last Change: 2024 Jun 21
+" Author: Evan Hanson <evhan@foldling.org>
+" Maintainer: Evan Hanson <evhan@foldling.org>
+" Previous Author: Dirk van Deun <dirk@igwe.vub.ac.be>
" Previous Maintainer: Sergey Khorev <sergey.khorev@gmail.com>
-" Repository: https://git.foldling.org/vim-scheme.git
-" URL: https://foldling.org/vim/syntax/scheme.vim
+" Repository: https://git.foldling.org/vim-scheme.git
+" URL: https://foldling.org/vim/syntax/scheme.vim
if exists('b:current_syntax')
finish
@@ -50,9 +50,11 @@ syn match schemeBoolean /#f\(alse\)\?/
syn match schemeCharacter /#\\.[^ `'\t\n\[\]()]*/
syn match schemeCharacter /#\\x[0-9a-fA-F]\+/
-syn match schemeComment /;.*$/ contains=@Spell
+syn match schemeComment /;.*$/ contains=schemeTodo,@Spell
-syn region schemeMultilineComment start=/#|/ end=/|#/ contains=schemeMultilineComment,@Spell
+syn region schemeMultilineComment start=/#|/ end=/|#/ contains=schemeTodo,schemeMultilineComment,@Spell
+
+syn match schemeTodo /\c\<\(todo\|xxx\|fixme\|note\):\?\>/ contained
syn region schemeForm matchgroup=schemeParentheses start="(" end=")" contains=ALLBUT,schemeUnquote,schemeDatumCommentForm,@schemeImportCluster
syn region schemeForm matchgroup=schemeParentheses start="\[" end="\]" contains=ALLBUT,schemeUnquote,schemeDatumCommentForm,@schemeImportCluster
@@ -427,6 +429,7 @@ syn keyword schemeFunction write-string
syn keyword schemeFunction write-u8
syn keyword schemeFunction zero?
+hi def link schemeTodo Todo
hi def link schemeBoolean Boolean
hi def link schemeCharacter Character
hi def link schemeComment Comment
diff --git a/runtime/syntax/sdc.vim b/runtime/syntax/sdc.vim
index dbfa35eeb6..ae2aae5f07 100644
--- a/runtime/syntax/sdc.vim
+++ b/runtime/syntax/sdc.vim
@@ -1,9 +1,10 @@
" Vim syntax file
" Language: SDC - Synopsys Design Constraints
" Maintainer: Maurizio Tranchero - maurizio.tranchero@gmail.com
-" Last Change: Thu Mar 25 17:35:16 CET 2009
" Credits: based on TCL Vim syntax file
" Version: 0.3
+" Last Change: Thu Mar 25 17:35:16 CET 2009
+" 2024 Jul 17 by Vim Project (update to SDC 2.1)
" Quit when a syntax file was already loaded
if exists("b:current_syntax")
@@ -13,16 +14,48 @@ endif
" Read the TCL syntax to start with
runtime! syntax/tcl.vim
-" SDC-specific keywords
+" TCL extension related to SDC and available from some vendors
+" (not defined in SDC standard!)
syn keyword sdcCollections foreach_in_collection
-syn keyword sdcObjectsQuery get_clocks get_ports
syn keyword sdcObjectsInfo get_point_info get_node_info get_path_info
syn keyword sdcObjectsInfo get_timing_paths set_attribute
-syn keyword sdcConstraints set_false_path
+
+" SDC rev. 2.1 specific keywords
+syn keyword sdcObjectsQuery get_clocks get_ports get_cells
+syn keyword sdcObjectsQuery get_pins get_nets all_inputs
+syn keyword sdcObjectsQuery all_outputs all_registers all_clocks
+syn keyword sdcObjectsQuery get_libs get_lib_cells get_lib_pins
+
+syn keyword sdcConstraints set_false_path set_clock_groups set_sense
+syn keyword sdcConstraints set_propagated_clock set_clock_gating_check
+syn keyword sdcConstraints set_ideal_latency set_ideal_network
+syn keyword sdcConstraints set_ideal_transistion set_max_time_borrow
+syn keyword sdcConstraints set_data_check group_path set_max_transition
+syn keyword sdcConstraints set_max_fanout set_driving_cell
+syn keyword sdcConstraints set_port_fanout_number set_multi_cycle_path
+syn keyword sdcConstraints set_disable_timing set_min_pulse_width
+
syn keyword sdcNonIdealities set_min_delay set_max_delay
syn keyword sdcNonIdealities set_input_delay set_output_delay
syn keyword sdcNonIdealities set_load set_min_capacitance set_max_capacitance
+syn keyword sdcNonIdealities set_clock_latency set_clock_transition set_clock_uncertainty
+syn keyword sdcNonIdealities set_resistance set_timing_derate set_drive
+syn keyword sdcNonIdealities set_input_transition set_fanout_load
+
syn keyword sdcCreateOperations create_clock create_timing_netlist update_timing_netlist
+syn keyword sdcCreateOperations create_generated_clock
+
+syn keyword sdcPowerArea set_max_area create_voltage_area
+syn keyword sdcPowerArea set_level_shifter_threshold set_max_dynamic_power
+syn keyword sdcPowerArea set_level_shifter_strategy set_max_leakage_power
+
+syn keyword sdcModeConfig set_case_analysis set_logic_dc
+syn keyword sdcModeConfig set_logic_zero set_logic_one
+
+syn keyword sdcMiscCommmands sdc_version set_wire_load_selection_group
+syn keyword sdcMiscCommmands set_units set_wire_load_mode set_wire_load_model
+syn keyword sdcMiscCommmands set_wire_load_min_block_size set_operating_conditions
+syn keyword sdcMiscCommmands current_design
" command flags highlighting
syn match sdcFlags "[[:space:]]-[[:alpha:]_]*\>"
@@ -31,9 +64,12 @@ syn match sdcFlags "[[:space:]]-[[:alpha:]_]*\>"
hi def link sdcCollections Repeat
hi def link sdcObjectsInfo Operator
hi def link sdcCreateOperations Operator
-hi def link sdcObjectsQuery Operator
+hi def link sdcObjectsQuery Function
hi def link sdcConstraints Operator
hi def link sdcNonIdealities Operator
+hi def link sdcPowerArea Operator
+hi def link sdcModeConfig Operator
+hi def link sdcMiscCommmands Operator
hi def link sdcFlags Special
let b:current_syntax = "sdc"
diff --git a/runtime/syntax/shared/debversions.vim b/runtime/syntax/shared/debversions.vim
index e18eca96b1..56f18b969a 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: 2024 Apr 27
+" Last Change: 2024 May 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', 'mantic', 'noble', 'oracular',
+ \ 'focal', 'jammy', 'mantic', 'noble', 'oracular',
\ 'devel'
\ ]
let g:debSharedUnsupportedVersions = [
@@ -22,8 +22,9 @@ let g:debSharedUnsupportedVersions = [
\ 'warty', 'hoary', 'breezy', 'dapper', 'edgy', 'feisty',
\ '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', 'lunar', 'groovy'
+ \ 'trusty', 'utopic', 'vivid', 'wily', 'xenial', 'yakkety', 'zesty',
+ \ 'artful', 'bionic', 'cosmic', 'disco', 'eoan', 'hirsute',
+ \ 'impish', 'kinetic', 'lunar', 'groovy'
\ ]
let &cpo=s:cpo
diff --git a/runtime/syntax/shared/typescriptcommon.vim b/runtime/syntax/shared/typescriptcommon.vim
index d06525115e..3af79a38fb 100644
--- a/runtime/syntax/shared/typescriptcommon.vim
+++ b/runtime/syntax/shared/typescriptcommon.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: TypeScript and TypeScriptReact
" Maintainer: Herrington Darkholme
-" Last Change: 2023 Aug 24
+" Last Change: 2024 May 24
" Based On: Herrington Darkholme's yats.vim
" Changes: See https://github.com/HerringtonDarkholme/yats.vim
" Credits: See yats.vim on github
@@ -49,13 +49,13 @@ syntax match typescriptProp contained /\K\k*!\?/
\ nextgroup=@afterIdentifier
\ skipwhite skipempty
-syntax region typescriptIndexExpr contained matchgroup=typescriptProperty start=/\[/rs=s+1 end=/]/he=e-1 contains=@typescriptValue nextgroup=@typescriptSymbols,typescriptDotNotation,typescriptFuncCallArg skipwhite skipempty
+syntax region typescriptIndexExpr contained matchgroup=typescriptProperty start=/\[/ end=/]/ contains=@typescriptValue,typescriptCastKeyword nextgroup=@typescriptSymbols,typescriptDotNotation,typescriptFuncCallArg skipwhite skipempty
syntax match typescriptDotNotation /\.\|?\.\|!\./ nextgroup=typescriptProp skipnl
syntax match typescriptDotStyleNotation /\.style\./ nextgroup=typescriptDOMStyle transparent
" syntax match typescriptFuncCall contained /[a-zA-Z]\k*\ze(/ nextgroup=typescriptFuncCallArg
syntax region typescriptParenExp matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptComments,@typescriptValue,typescriptCastKeyword nextgroup=@typescriptSymbols skipwhite skipempty
-syntax region typescriptFuncCallArg contained matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptValue,@typescriptComments nextgroup=@typescriptSymbols,typescriptDotNotation skipwhite skipempty skipnl
+syntax region typescriptFuncCallArg contained matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptValue,@typescriptComments,typescriptCastKeyword nextgroup=@typescriptSymbols,typescriptDotNotation skipwhite skipempty skipnl
syntax region typescriptEventFuncCallArg contained matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptEventExpression
syntax region typescriptEventString contained start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1\|$/ contains=typescriptASCII,@events
@@ -116,20 +116,33 @@ syntax match typescriptASCII contained /\\\d\d\d/
syntax region typescriptTemplateSubstitution matchgroup=typescriptTemplateSB
\ start=/\${/ end=/}/
- \ contains=@typescriptValue
+ \ contains=@typescriptValue,typescriptCastKeyword
\ contained
-syntax region typescriptString
+syntax region typescriptString
\ start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1+ end=+$+
\ contains=typescriptSpecial,@Spell
+ \ nextgroup=@typescriptSymbols
+ \ skipwhite skipempty
\ extend
syntax match typescriptSpecial contained "\v\\%(x\x\x|u%(\x{4}|\{\x{1,6}})|c\u|.)"
-" From vim runtime
-" <https://github.com/vim/vim/blob/master/runtime/syntax/javascript.vim#L48>
-syntax region typescriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gimuy]\{0,5\}\s*$+ end=+/[gimuy]\{0,5\}\s*[;.,)\]}:]+me=e-1 nextgroup=typescriptDotNotation oneline
+" From pangloss/vim-javascript
+" <https://github.com/pangloss/vim-javascript/blob/d6e137563c47fb59f26ed25d044c0c7532304f18/syntax/javascript.vim#L64-L72>
+syntax region typescriptRegexpCharClass contained start=+\[+ skip=+\\.+ end=+\]+ contains=typescriptSpecial extend
+syntax match typescriptRegexpBoundary contained "\v\c[$^]|\\b"
+syntax match typescriptRegexpBackRef contained "\v\\[1-9]\d*"
+syntax match typescriptRegexpQuantifier contained "\v[^\\]%([?*+]|\{\d+%(,\d*)?})\??"lc=1
+syntax match typescriptRegexpOr contained "|"
+syntax match typescriptRegexpMod contained "\v\(\?[:=!>]"lc=1
+syntax region typescriptRegexpGroup contained start="[^\\]("lc=1 skip="\\.\|\[\(\\.\|[^]]\+\)\]" end=")" contains=typescriptRegexpCharClass,@typescriptRegexpSpecial keepend
+syntax region typescriptRegexpString
+ \ start=+\%(\%(\<return\|\<typeof\|\_[^)\]'"[:blank:][:alnum:]_$]\)\s*\)\@<=/\ze[^*/]+ skip=+\\.\|\[[^]]\{1,}\]+ end=+/[gimyus]\{,6}+
+ \ contains=typescriptRegexpCharClass,typescriptRegexpGroup,@typescriptRegexpSpecial
+ \ oneline keepend extend
+syntax cluster typescriptRegexpSpecial contains=typescriptSpecial,typescriptRegexpBoundary,typescriptRegexpBackRef,typescriptRegexpQuantifier,typescriptRegexpOr,typescriptRegexpMod
syntax region typescriptTemplate
\ start=/`/ skip=/\\\\\|\\`\|\n/ end=/`\|$/
@@ -140,7 +153,7 @@ syntax region typescriptTemplate
"Array
syntax region typescriptArray matchgroup=typescriptBraces
\ start=/\[/ end=/]/
- \ contains=@typescriptValue,@typescriptComments
+ \ contains=@typescriptValue,@typescriptComments,typescriptCastKeyword
\ nextgroup=@typescriptSymbols,typescriptDotNotation
\ skipwhite skipempty fold
@@ -153,7 +166,7 @@ syntax match typescriptNumber /\<\%(\d[0-9_]*\%(\.\d[0-9_]*\)\=\|\.\d[0-9_]*\)\%
syntax region typescriptObjectLiteral matchgroup=typescriptBraces
\ start=/{/ end=/}/
- \ contains=@typescriptComments,typescriptObjectLabel,typescriptStringProperty,typescriptComputedPropertyName,typescriptObjectAsyncKeyword
+ \ contains=@typescriptComments,typescriptObjectLabel,typescriptStringProperty,typescriptComputedPropertyName,typescriptObjectAsyncKeyword,typescriptTernary,typescriptCastKeyword
\ fold contained
syntax keyword typescriptObjectAsyncKeyword async contained
@@ -223,11 +236,11 @@ syntax match typescriptBinaryOp contained /\*\*=\?/ nextgroup=@typescriptValue
syntax cluster typescriptSymbols contains=typescriptBinaryOp,typescriptKeywordOp,typescriptTernary,typescriptAssign,typescriptCastKeyword
-" runtime syntax/basic/reserved.vim
+" runtime syntax/ts-common/reserved.vim
"Import
syntax keyword typescriptImport from as
syntax keyword typescriptImport import
- \ nextgroup=typescriptImportType
+ \ nextgroup=typescriptImportType,typescriptTypeBlock,typescriptDefaultImportName
\ skipwhite
syntax keyword typescriptImportType type
\ contained
@@ -238,20 +251,11 @@ syntax match typescriptExportType /\<type\s*{\@=/
\ contained skipwhite skipempty skipnl
syntax keyword typescriptModule namespace module
-"this
-
-"JavaScript Prototype
-syntax keyword typescriptPrototype prototype
- \ nextgroup=@afterIdentifier
-syntax keyword typescriptCastKeyword as
+syntax keyword typescriptCastKeyword as satisfies
\ nextgroup=@typescriptType
\ skipwhite
-"Program Keywords
-syntax keyword typescriptIdentifier arguments this super
- \ nextgroup=@afterIdentifier
-
syntax keyword typescriptVariable let var
\ nextgroup=@typescriptVariableDeclarations
\ skipwhite skipempty
@@ -260,6 +264,10 @@ syntax keyword typescriptVariable const
\ nextgroup=typescriptEnum,@typescriptVariableDeclarations
\ skipwhite skipempty
+syntax keyword typescriptUsing using
+ \ nextgroup=@typescriptVariableDeclarations
+ \ skipwhite skipempty
+
syntax region typescriptEnum matchgroup=typescriptEnumKeyword start=/enum / end=/\ze{/
\ nextgroup=typescriptBlock
\ skipwhite
@@ -272,7 +280,6 @@ syntax keyword typescriptOperator delete new typeof void
syntax keyword typescriptForOperator contained in of
syntax keyword typescriptBoolean true false nextgroup=@typescriptSymbols skipwhite skipempty
-syntax keyword typescriptNull null undefined nextgroup=@typescriptSymbols skipwhite skipempty
syntax keyword typescriptMessage alert confirm prompt status
\ nextgroup=typescriptDotNotation,typescriptFuncCallArg
syntax keyword typescriptGlobal self top parent
@@ -290,10 +297,10 @@ syntax keyword typescriptCase case nextgroup=@typescriptPrimiti
syntax keyword typescriptDefault default containedin=typescriptBlock nextgroup=@typescriptValue,typescriptClassKeyword,typescriptInterfaceKeyword skipwhite oneline
syntax keyword typescriptStatementKeyword with
syntax keyword typescriptStatementKeyword yield skipwhite nextgroup=@typescriptValue containedin=typescriptBlock
-syntax keyword typescriptStatementKeyword return skipwhite contained nextgroup=@typescriptValue containedin=typescriptBlock
syntax keyword typescriptTry try
-syntax keyword typescriptExceptions catch throw finally
+syntax keyword typescriptExceptions throw finally
+syntax keyword typescriptExceptions catch nextgroup=typescriptCall skipwhite skipempty oneline
syntax keyword typescriptDebugger debugger
syntax keyword typescriptAsyncFor await nextgroup=typescriptLoopParen skipwhite skipempty contained
@@ -321,6 +328,24 @@ syntax cluster typescriptAmbients contains=
\ typescriptEnumKeyword,typescriptEnum,
\ typescriptModule
+syntax keyword typescriptIdentifier arguments nextgroup=@afterIdentifier
+syntax match typescriptDefaultImportName /\v\h\k*( |,)/
+ \ contained
+ \ nextgroup=typescriptTypeBlock
+ \ skipwhite skipempty
+
+syntax region typescriptTypeBlock
+ \ matchgroup=typescriptBraces
+ \ start=/{/ end=/}/
+ \ contained
+ \ contains=typescriptIdentifierName,typescriptImportType
+ \ fold
+
+"Program Keywords
+syntax keyword typescriptNull null undefined nextgroup=@typescriptSymbols skipwhite skipempty
+syntax keyword typescriptIdentifier this super prototype nextgroup=@afterIdentifier
+syntax keyword typescriptStatementKeyword return skipwhite contained nextgroup=@typescriptValue containedin=typescriptBlock
+
"Syntax coloring for Node.js shebang line
syntax match shellbang "^#!.*node\>"
syntax match shellbang "^#!.*iojs\>"
@@ -536,7 +561,7 @@ syntax region typescriptGenericFunc matchgroup=typescriptTypeBrackets
\ contained skipwhite skipnl
syntax region typescriptFuncType matchgroup=typescriptParens
- \ start=/(/ end=/)\s*=>/me=e-2
+ \ start=/(\(\k\+:\|)\)\@=/ end=/)\s*=>/me=e-2
\ contains=@typescriptParameterList
\ nextgroup=typescriptFuncTypeArrow
\ contained skipwhite skipnl oneline
@@ -546,7 +571,6 @@ syntax match typescriptFuncTypeArrow /=>/
\ containedin=typescriptFuncType
\ contained skipwhite skipnl
-
syntax keyword typescriptConstructorType new
\ nextgroup=@typescriptFunctionType
\ contained skipwhite skipnl
@@ -623,25 +647,24 @@ syntax keyword typescriptReadonlyArrayKeyword readonly
" extension
-if get(g:, 'yats_host_keyword', 1)
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName Function Boolean
- " use of nextgroup Suggested by Doug Kearns
+if get(g:, 'typescript_host_keyword', 1)
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName Function Boolean nextgroup=typescriptFuncCallArg
syntax keyword typescriptGlobal containedin=typescriptIdentifierName Error EvalError nextgroup=typescriptFuncCallArg
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName InternalError
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName RangeError ReferenceError
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName StopIteration
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName SyntaxError TypeError
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName URIError Date
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName Float32Array
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName Float64Array
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName Int16Array Int32Array
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName Int8Array Uint16Array
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName Uint32Array Uint8Array
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName Uint8ClampedArray
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName ParallelArray
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName ArrayBuffer DataView
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName Iterator Generator
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName Reflect Proxy
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName InternalError nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName RangeError ReferenceError nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName StopIteration nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName SyntaxError TypeError nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName URIError Date nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName Float32Array nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName Float64Array nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName Int16Array Int32Array nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName Int8Array Uint16Array nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName Uint32Array Uint8Array nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName Uint8ClampedArray nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName ParallelArray nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName ArrayBuffer DataView nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName Iterator Generator nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName Reflect Proxy nextgroup=typescriptFuncCallArg
syntax keyword typescriptGlobal containedin=typescriptIdentifierName arguments
hi def link typescriptGlobal Structure
syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName eval uneval nextgroup=typescriptFuncCallArg
@@ -675,12 +698,12 @@ if get(g:, 'yats_host_keyword', 1)
hi def link typescriptStringStaticMethod Keyword
syntax keyword typescriptStringMethod contained anchor charAt charCodeAt codePointAt nextgroup=typescriptFuncCallArg
syntax keyword typescriptStringMethod contained concat endsWith includes indexOf lastIndexOf nextgroup=typescriptFuncCallArg
- syntax keyword typescriptStringMethod contained link localeCompare match normalize nextgroup=typescriptFuncCallArg
- syntax keyword typescriptStringMethod contained padStart padEnd repeat replace search nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptStringMethod contained link localeCompare match matchAll normalize nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptStringMethod contained padStart padEnd repeat replace replaceAll search nextgroup=typescriptFuncCallArg
syntax keyword typescriptStringMethod contained slice split startsWith substr substring nextgroup=typescriptFuncCallArg
syntax keyword typescriptStringMethod contained toLocaleLowerCase toLocaleUpperCase nextgroup=typescriptFuncCallArg
syntax keyword typescriptStringMethod contained toLowerCase toString toUpperCase trim nextgroup=typescriptFuncCallArg
- syntax keyword typescriptStringMethod contained valueOf nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptStringMethod contained trimEnd trimStart valueOf nextgroup=typescriptFuncCallArg
syntax cluster props add=typescriptStringMethod
hi def link typescriptStringMethod Keyword
@@ -689,18 +712,18 @@ if get(g:, 'yats_host_keyword', 1)
syntax keyword typescriptArrayStaticMethod contained from isArray of nextgroup=typescriptFuncCallArg
hi def link typescriptArrayStaticMethod Keyword
syntax keyword typescriptArrayMethod contained concat copyWithin entries every fill nextgroup=typescriptFuncCallArg
- syntax keyword typescriptArrayMethod contained filter find findIndex forEach indexOf nextgroup=typescriptFuncCallArg
- syntax keyword typescriptArrayMethod contained includes join keys lastIndexOf map nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptArrayMethod contained filter find findIndex flat flatMap forEach nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptArrayMethod contained includes indexOf join keys lastIndexOf map nextgroup=typescriptFuncCallArg
syntax keyword typescriptArrayMethod contained pop push reduce reduceRight reverse nextgroup=typescriptFuncCallArg
syntax keyword typescriptArrayMethod contained shift slice some sort splice toLocaleString nextgroup=typescriptFuncCallArg
- syntax keyword typescriptArrayMethod contained toSource toString unshift nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptArrayMethod contained toSource toString unshift values nextgroup=typescriptFuncCallArg
syntax cluster props add=typescriptArrayMethod
hi def link typescriptArrayMethod Keyword
syntax keyword typescriptGlobal containedin=typescriptIdentifierName Object nextgroup=typescriptGlobalObjectDot,typescriptFuncCallArg
syntax match typescriptGlobalObjectDot /\./ contained nextgroup=typescriptObjectStaticMethod,typescriptProp
syntax keyword typescriptObjectStaticMethod contained create defineProperties defineProperty nextgroup=typescriptFuncCallArg
- syntax keyword typescriptObjectStaticMethod contained entries freeze getOwnPropertyDescriptors nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptObjectStaticMethod contained entries freeze fromEntries getOwnPropertyDescriptors nextgroup=typescriptFuncCallArg
syntax keyword typescriptObjectStaticMethod contained getOwnPropertyDescriptor getOwnPropertyNames nextgroup=typescriptFuncCallArg
syntax keyword typescriptObjectStaticMethod contained getOwnPropertySymbols getPrototypeOf nextgroup=typescriptFuncCallArg
syntax keyword typescriptObjectStaticMethod contained is isExtensible isFrozen isSealed nextgroup=typescriptFuncCallArg
@@ -715,7 +738,7 @@ if get(g:, 'yats_host_keyword', 1)
syntax keyword typescriptGlobal containedin=typescriptIdentifierName Symbol nextgroup=typescriptGlobalSymbolDot,typescriptFuncCallArg
syntax match typescriptGlobalSymbolDot /\./ contained nextgroup=typescriptSymbolStaticProp,typescriptSymbolStaticMethod,typescriptProp
- syntax keyword typescriptSymbolStaticProp contained length iterator match replace
+ syntax keyword typescriptSymbolStaticProp contained description length iterator match matchAll replace
syntax keyword typescriptSymbolStaticProp contained search split hasInstance isConcatSpreadable
syntax keyword typescriptSymbolStaticProp contained unscopables species toPrimitive
syntax keyword typescriptSymbolStaticProp contained toStringTag
@@ -771,7 +794,7 @@ if get(g:, 'yats_host_keyword', 1)
syntax match typescriptGlobalRegExpDot /\./ contained nextgroup=typescriptRegExpStaticProp,typescriptProp
syntax keyword typescriptRegExpStaticProp contained lastIndex
hi def link typescriptRegExpStaticProp Keyword
- syntax keyword typescriptRegExpProp contained global ignoreCase multiline source sticky
+ syntax keyword typescriptRegExpProp contained dotAll global ignoreCase multiline source sticky
syntax cluster props add=typescriptRegExpProp
hi def link typescriptRegExpProp Keyword
syntax keyword typescriptRegExpMethod contained exec test nextgroup=typescriptFuncCallArg
@@ -805,7 +828,7 @@ if get(g:, 'yats_host_keyword', 1)
syntax keyword typescriptGlobal containedin=typescriptIdentifierName Promise nextgroup=typescriptGlobalPromiseDot,typescriptFuncCallArg
syntax match typescriptGlobalPromiseDot /\./ contained nextgroup=typescriptPromiseStaticMethod,typescriptProp
- syntax keyword typescriptPromiseStaticMethod contained resolve reject all race nextgroup=typescriptFuncCallArg
+ syntax keyword typescriptPromiseStaticMethod contained all allSettled any race reject resolve nextgroup=typescriptFuncCallArg
hi def link typescriptPromiseStaticMethod Keyword
syntax keyword typescriptPromiseMethod contained then catch finally nextgroup=typescriptFuncCallArg
syntax cluster props add=typescriptPromiseMethod
@@ -1232,7 +1255,8 @@ if get(g:, 'yats_host_keyword', 1)
syntax cluster props add=typescriptBOMHistoryMethod
hi def link typescriptBOMHistoryMethod Keyword
- syntax keyword typescriptGlobal containedin=typescriptIdentifierName console
+ syntax keyword typescriptGlobal containedin=typescriptIdentifierName console nextgroup=typescriptGlobalConsoleDot
+ syntax match typescriptGlobalConsoleDot /\./ contained nextgroup=typescriptConsoleMethod,typescriptProp
syntax keyword typescriptConsoleMethod contained count dir error group groupCollapsed nextgroup=typescriptFuncCallArg
syntax keyword typescriptConsoleMethod contained groupEnd info log time timeEnd trace nextgroup=typescriptFuncCallArg
syntax keyword typescriptConsoleMethod contained warn nextgroup=typescriptFuncCallArg
@@ -1735,8 +1759,6 @@ if get(g:, 'yats_host_keyword', 1)
syntax keyword typescriptServiceWorkerEvent contained install activate fetch
syntax cluster events add=typescriptServiceWorkerEvent
hi def link typescriptServiceWorkerEvent Title
-
-
endif
" patch
@@ -1764,6 +1786,7 @@ syntax cluster typescriptPropertyMemberDeclaration contains=
\ typescriptClassStatic,
\ typescriptAccessibilityModifier,
\ typescriptReadonlyModifier,
+ \ typescriptAutoAccessor,
\ typescriptMethodAccessor,
\ @typescriptMembers
" \ typescriptMemberVariableDeclaration
@@ -1780,7 +1803,9 @@ syntax keyword typescriptClassStatic static
syntax keyword typescriptAccessibilityModifier public private protected contained
-syntax keyword typescriptReadonlyModifier readonly contained
+syntax keyword typescriptReadonlyModifier readonly override contained
+
+syntax keyword typescriptAutoAccessor accessor contained
syntax region typescriptStringMember contained
\ start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1/
@@ -1789,7 +1814,7 @@ syntax region typescriptStringMember contained
syntax region typescriptComputedMember contained matchgroup=typescriptProperty
\ start=/\[/rs=s+1 end=/]/
- \ contains=@typescriptValue,typescriptMember,typescriptMappedIn
+ \ contains=@typescriptValue,typescriptMember,typescriptMappedIn,typescriptCastKeyword
\ nextgroup=@memberNextGroup
\ skipwhite skipempty
@@ -1861,7 +1886,7 @@ syntax match typescriptInterfaceComma /,/ contained nextgroup=typescriptInterfac
"Block VariableStatement EmptyStatement ExpressionStatement IfStatement IterationStatement ContinueStatement BreakStatement ReturnStatement WithStatement LabelledStatement SwitchStatement ThrowStatement TryStatement DebuggerStatement
syntax cluster typescriptStatement
- \ contains=typescriptBlock,typescriptVariable,
+ \ contains=typescriptBlock,typescriptVariable,typescriptUsing,
\ @typescriptTopExpression,typescriptAssign,
\ typescriptConditional,typescriptRepeat,typescriptBranch,
\ typescriptLabel,typescriptStatementKeyword,
@@ -1899,16 +1924,14 @@ syntax cluster typescriptValue
syntax cluster typescriptEventExpression contains=typescriptArrowFuncDef,typescriptParenExp,@typescriptValue,typescriptRegexpString,@typescriptEventTypes,typescriptOperator,typescriptGlobal,jsxRegion
syntax keyword typescriptAsyncFuncKeyword async
- \ nextgroup=typescriptFuncKeyword,typescriptArrowFuncDef
+ \ nextgroup=typescriptFuncKeyword,typescriptArrowFuncDef,typescriptArrowFuncTypeParameter
\ skipwhite
syntax keyword typescriptAsyncFuncKeyword await
- \ nextgroup=@typescriptValue
+ \ nextgroup=@typescriptValue,typescriptUsing
\ skipwhite
-syntax keyword typescriptFuncKeyword function
- \ nextgroup=typescriptAsyncFunc,typescriptFuncName,@typescriptCallSignature
- \ skipwhite skipempty
+syntax keyword typescriptFuncKeyword function nextgroup=typescriptAsyncFunc,typescriptFuncName,@typescriptCallSignature skipwhite skipempty
syntax match typescriptAsyncFunc contained /*/
\ nextgroup=typescriptFuncName,@typescriptCallSignature
@@ -1918,39 +1941,33 @@ syntax match typescriptFuncName contained /\K\k*/
\ nextgroup=@typescriptCallSignature
\ skipwhite
-" destructuring ({ a: ee }) =>
-syntax match typescriptArrowFuncDef contained /(\(\s*\({\_[^}]*}\|\k\+\)\(:\_[^)]\)\?,\?\)\+)\s*=>/
- \ contains=typescriptArrowFuncArg,typescriptArrowFunc
- \ nextgroup=@typescriptExpression,typescriptBlock
- \ skipwhite skipempty
-
-" matches `(a) =>` or `([a]) =>` or
-" `(
-" a) =>`
-syntax match typescriptArrowFuncDef contained /(\(\_s*[a-zA-Z\$_\[.]\_[^)]*\)*)\s*=>/
+syntax match typescriptArrowFuncDef contained /\K\k*\s*=>/
\ contains=typescriptArrowFuncArg,typescriptArrowFunc
\ nextgroup=@typescriptExpression,typescriptBlock
\ skipwhite skipempty
-syntax match typescriptArrowFuncDef contained /\K\k*\s*=>/
- \ contains=typescriptArrowFuncArg,typescriptArrowFunc
+syntax match typescriptArrowFuncDef contained /(\%(\_[^()]\+\|(\_[^()]*)\)*)\_s*=>/
+ \ contains=typescriptArrowFuncArg,typescriptArrowFunc,@typescriptCallSignature
\ nextgroup=@typescriptExpression,typescriptBlock
\ skipwhite skipempty
-" TODO: optimize this pattern
-syntax region typescriptArrowFuncDef contained start=/(\_[^(^)]*):/ end=/=>/
- \ contains=typescriptArrowFuncArg,typescriptArrowFunc,typescriptTypeAnnotation
+syntax region typescriptArrowFuncDef contained start=/(\%(\_[^()]\+\|(\_[^()]*)\)*):/ matchgroup=typescriptArrowFunc end=/=>/
+ \ contains=typescriptArrowFuncArg,typescriptTypeAnnotation,@typescriptCallSignature
\ nextgroup=@typescriptExpression,typescriptBlock
\ skipwhite skipempty keepend
+syntax region typescriptArrowFuncTypeParameter start=/</ end=/>/
+ \ contains=@typescriptTypeParameterCluster
+ \ nextgroup=typescriptArrowFuncDef
+ \ contained skipwhite skipnl
+
syntax match typescriptArrowFunc /=>/
syntax match typescriptArrowFuncArg contained /\K\k*/
-syntax region typescriptArrowFuncArg contained start=/<\|(/ end=/\ze=>/ contains=@typescriptCallSignature
syntax region typescriptReturnAnnotation contained start=/:/ end=/{/me=e-1 contains=@typescriptType nextgroup=typescriptBlock
-syntax region typescriptFuncImpl contained start=/function\>/ end=/{/me=e-1
+syntax region typescriptFuncImpl contained start=/function\>/ end=/{\|;\|\n/me=e-1
\ contains=typescriptFuncKeyword
\ nextgroup=typescriptBlock
@@ -1970,7 +1987,7 @@ syntax match typescriptDecorator /@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a
\ nextgroup=typescriptFuncCallArg,typescriptTypeArguments
\ contains=@_semantic,typescriptDotNotation
-" Define the default highlighting.
+
hi def link typescriptReserved Error
hi def link typescriptEndColons Exception
@@ -2013,6 +2030,7 @@ hi def link typescriptDefault typescriptCase
hi def link typescriptBranch Conditional
hi def link typescriptIdentifier Structure
hi def link typescriptVariable Identifier
+hi def link typescriptUsing Identifier
hi def link typescriptDestructureVariable PreProc
hi def link typescriptEnumKeyword Identifier
hi def link typescriptRepeat Repeat
@@ -2050,16 +2068,13 @@ hi def link typescriptFuncKeyword Keyword
hi def link typescriptAsyncFunc Keyword
hi def link typescriptArrowFunc Type
hi def link typescriptFuncName Function
-hi def link typescriptFuncArg PreProc
+hi def link typescriptFuncCallArg PreProc
hi def link typescriptArrowFuncArg PreProc
hi def link typescriptFuncComma Operator
hi def link typescriptClassKeyword Keyword
hi def link typescriptClassExtends Keyword
-" hi def link typescriptClassName Function
hi def link typescriptAbstract Special
-" hi def link typescriptClassHeritage Function
-" hi def link typescriptInterfaceHeritage Function
hi def link typescriptClassStatic StorageClass
hi def link typescriptReadonlyModifier Keyword
hi def link typescriptInterfaceKeyword Keyword
@@ -2077,6 +2092,7 @@ hi def link typescriptFuncTypeArrow Function
hi def link typescriptConstructorType Function
hi def link typescriptTypeQuery Keyword
hi def link typescriptAccessibilityModifier Keyword
+hi def link typescriptAutoAccessor Keyword
hi def link typescriptOptionalMark PreProc
hi def link typescriptFuncType Special
hi def link typescriptMappedIn Special
diff --git a/runtime/syntax/spec.vim b/runtime/syntax/spec.vim
index 4cb3a343eb..730a0b8cc5 100644
--- a/runtime/syntax/spec.vim
+++ b/runtime/syntax/spec.vim
@@ -4,6 +4,7 @@
" Maintainer: Igor Gnatenko i.gnatenko.brain@gmail.com
" Former Maintainer: Donovan Rebbechi elflord@panix.com (until March 2014)
" Last Change: 2020 May 25
+" 2024 Sep 10 by Vim Project: add file triggers support, #15569
" quit when a syntax file was already loaded
if exists("b:current_syntax")
@@ -111,7 +112,7 @@ syn region specDescriptionArea matchgroup=specSection start='^%description' end=
syn region specPackageArea matchgroup=specSection start='^%package' end='^%'me=e-1 contains=specPackageOpts,specPreAmble,specComment
"%% Scripts Section %%
-syn region specScriptArea matchgroup=specSection start='^%\(prep\|generate_buildrequires\|conf\|build\|install\|clean\|check\|pre\|postun\|preun\|post\|posttrans\)\>' skip='^%{\|^%\(define\|patch\d*\|configure\|GNUconfigure\|setup\|autosetup\|autopatch\|find_lang\|make_build\|makeinstall\|make_install\)\>' end='^%'me=e-1 contains=specSpecialVariables,specVariables,@specCommands,specVariables,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,shComment,shIf,specSpecialChar,specMacroIdentifier,specSectionMacroArea,specSectionMacroBracketArea,shOperator,shQuote1,shQuote2
+syn region specScriptArea matchgroup=specSection start='^%\(prep\|generate_buildrequires\|conf\|build\|install\|clean\|check\|pre\|postun\|preun\|post\|posttrans\|filetriggerin\|filetriggerun\|filetriggerpostun\|transfiletriggerin\|transfiletriggerun\|transfiletriggerpostun\)\>' skip='^%{\|^%\(define\|patch\d*\|configure\|GNUconfigure\|setup\|autosetup\|autopatch\|find_lang\|make_build\|makeinstall\|make_install\)\>' end='^%'me=e-1 contains=specSpecialVariables,specVariables,@specCommands,specVariables,shDo,shFor,shCaseEsac,specNoNumberHilite,specCommandOpts,shComment,shIf,specSpecialChar,specMacroIdentifier,specSectionMacroArea,specSectionMacroBracketArea,shOperator,shQuote1,shQuote2
"%% Changelog Section %%
syn region specChangelogArea matchgroup=specSection start='^%changelog' end='^%'me=e-1 contains=specEmail,specURL,specWeekday,specMonth,specNumber,specComment,specLicense
diff --git a/runtime/syntax/stylus.vim b/runtime/syntax/stylus.vim
index fd0f33b65a..d8bf641e60 100644
--- a/runtime/syntax/stylus.vim
+++ b/runtime/syntax/stylus.vim
@@ -4,17 +4,7 @@
" Filenames: *.styl, *.stylus
" Based On: Tim Pope (sass.vim)
" Created: Dec 14, 2011
-" Modified: Apr 29, 2024
-
-if main_syntax == "css"
- syn sync minlines=10
-endif
-
-" let b:current_syntax = "css"
-"
-if main_syntax == 'css'
- unlet main_syntax
-endif
+" Modified: May 28, 2024
syn case ignore
diff --git a/runtime/syntax/sudoers.vim b/runtime/syntax/sudoers.vim
index bf2d337d9e..4cdf598be0 100644
--- a/runtime/syntax/sudoers.vim
+++ b/runtime/syntax/sudoers.vim
@@ -2,9 +2,10 @@
" Language: sudoers(5) configuration files
" Maintainer: Eisuke Kawashima ( e.kawaschima+vim AT gmail.com )
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2021 Mar 15
+" Latest Revision: 2024 Sep 02
" Recent Changes: Support for #include and #includedir.
" Added many new options (Samuel D. Leslie)
+" Update allowed Tag_Spec Runas_Spec syntax items
if exists("b:current_syntax")
finish
@@ -22,7 +23,7 @@ syn match sudoersUserSpec '^' nextgroup=@sudoersUserInSpec skipwhite
syn match sudoersSpecEquals contained '=' nextgroup=@sudoersCmndSpecList skipwhite
-syn cluster sudoersCmndSpecList contains=sudoersUserRunasBegin,sudoersPASSWD,@sudoersCmndInSpec
+syn cluster sudoersCmndSpecList contains=sudoersUserRunasBegin,sudoersTagSpec,@sudoersCmndInSpec
syn keyword sudoersTodo contained TODO FIXME XXX NOTE
@@ -92,10 +93,11 @@ syn cluster sudoersUserList contains=sudoersUserListComma,sudoersUserLis
syn match sudoersUserSpecComma contained ',' nextgroup=@sudoersUserInSpec skipwhite skipnl
syn cluster sudoersUserSpec contains=sudoersUserSpecComma,@sudoersHostInSpec
-syn match sudoersUserRunasBegin contained '(' nextgroup=@sudoersUserInRunas skipwhite skipnl
+syn match sudoersUserRunasBegin contained '(' nextgroup=@sudoersUserInRunas,sudoersUserRunasColon skipwhite skipnl
syn match sudoersUserRunasComma contained ',' nextgroup=@sudoersUserInRunas skipwhite skipnl
-syn match sudoersUserRunasEnd contained ')' nextgroup=sudoersPASSWD,@sudoersCmndInSpec skipwhite skipnl
-syn cluster sudoersUserRunas contains=sudoersUserRunasComma,@sudoersUserInRunas,sudoersUserRunasEnd
+syn match sudoersUserRunasColon contained ':' nextgroup=@sudoersUserInRunas skipwhite skipnl
+syn match sudoersUserRunasEnd contained ')' nextgroup=sudoersTagSpec,@sudoersCmndInSpec skipwhite skipnl
+syn cluster sudoersUserRunas contains=sudoersUserRunasComma,sudoersUserRunasColon,@sudoersUserInRunas,sudoersUserRunasEnd
syn match sudoersHostAliasEquals contained '=' nextgroup=@sudoersHostInList skipwhite skipnl
@@ -291,7 +293,7 @@ syn region sudoersStringValue contained start=+"+ skip=+\\"+ end=+"+ nextgroup
syn match sudoersListValue contained '[^[:space:],:=\\]*\%(\\[[:space:],:=\\][^[:space:],:=\\]*\)*' nextgroup=sudoersParameterListComma skipwhite skipnl
syn region sudoersListValue contained start=+"+ skip=+\\"+ end=+"+ nextgroup=sudoersParameterListComma skipwhite skipnl
-syn match sudoersPASSWD contained '\%(NO\)\=PASSWD:' nextgroup=@sudoersCmndInSpec skipwhite
+syn match sudoersTagSpec contained '\%(NO\)\=\%(EXEC\|FOLLOW\|LOG_\%(INPUT\|OUTPUT\)\|MAIL\|INTERCEPT\|PASSWD\|SETENV\):' nextgroup=sudoersTagSpec,@sudoersCmndInSpec skipwhite
hi def link sudoersSpecEquals Operator
hi def link sudoersTodo Todo
@@ -345,6 +347,7 @@ hi def link sudoersUserListColon Delimiter
hi def link sudoersUserSpecComma Delimiter
hi def link sudoersUserRunasBegin Delimiter
hi def link sudoersUserRunasComma Delimiter
+hi def link sudoersUserRunasColon Delimiter
hi def link sudoersUserRunasEnd Delimiter
hi def link sudoersHostAliasEquals Operator
hi def link sudoersHostListComma Delimiter
@@ -381,7 +384,7 @@ hi def link sudoersListParameterEquals Operator
hi def link sudoersIntegerValue Number
hi def link sudoersStringValue String
hi def link sudoersListValue String
-hi def link sudoersPASSWD Special
+hi def link sudoersTagSpec Special
hi def link sudoersInclude Statement
let b:current_syntax = "sudoers"
diff --git a/runtime/syntax/swayconfig.vim b/runtime/syntax/swayconfig.vim
index 401412adfd..d09d476a5a 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.2.3
-" Last Change: 2024-05-23
+" Version: 1.2.4
+" Last Change: 2024-05-24
" References:
" http://i3wm.org/docs/userguide.html#configuring
@@ -34,12 +34,12 @@ syn region i3ConfigBindArgument start=/--input-device=['"]/ end=/\s/ contained c
syn region i3ConfigBindCombo matchgroup=i3ConfigParen start=/{$/ end=/^\s*}$/ contained contains=i3ConfigBindArgument,i3ConfigBindCombo,i3ConfigComment fold keepend extend
" hack for blocks with start outside parsing range
-syn region swayConfigBlockOrphan start=/^\s\+\(--[a-z-]\+ \)*\([A-Z$][$a-zA-Z0-9_+]\+\|[a-z]\) [a-z[]/ skip=/\\$\|$\n^\s*}$/ end=/$/ contains=i3ConfigBindArgument,i3ConfigBindCombo,i3ConfigParen keepend extend
+syn region swayConfigBlockOrphan start=/^\s\+\(--[a-z-]\+ \)*\([$A-Z][$0-9A-Za-z_+]\+\|[a-z]\) [a-z[]/ skip=/\\$\|$\n^\s*}$/ end=/$/ contains=i3ConfigBindArgument,i3ConfigBindCombo,i3ConfigParen keepend extend
syn region i3ConfigExec start=/ {$/ end=/^\s*}$/ contained contains=i3ConfigExecAction,@i3ConfigSh,i3ConfigComment fold keepend extend
syn keyword swayConfigFloatingModifierOpts normal inverse none contained
-syn match i3ConfigKeyword /floating_modifier \(none\|[$a-zA-Z0-9+]\+ \(normal\|inverse\)\)$/ contained contains=i3ConfigVariable,i3ConfigBindModkey,swayConfigFloatingModifierOpts
+syn match i3ConfigKeyword /floating_modifier \(none\|[$A-Z][0-9A-Za-z]\+ \(normal\|inverse\)\)$/ contained contains=i3ConfigVariable,i3ConfigBindModkey,swayConfigFloatingModifierOpts
syn match swayConfigI3Param /--i3/ contains=i3ConfigShParam skipwhite nextgroup=i3ConfigEdgeOpts
syn keyword i3ConfigKeyword hide_edge_borders contained skipwhite nextgroup=swayConfigI3Param,i3ConfigEdgeOpts
@@ -71,7 +71,7 @@ syn keyword i3ConfigBindKeyword bindswitch contained skipwhite nextgroup=swayCon
syn region swayConfigBlockOrphan start=/^\s\+\(lid\|tablet\):/ skip=/\\$\|$\n^\s*}$/ end=/$/ contains=swayConfigBindswitchArgument,swayConfigBindswitchType,i3ConfigParen keepend extend
" Bindgesture
-syn match swayConfigBindgestureArgument /--\(exact\|input-device=[:0-9a-zA-Z_/-]\+\|no-warn\) / contained nextgroup=swayConfigBindgestureArgument,swayConfigBindgestureCombo
+syn match swayConfigBindgestureArgument /--\(exact\|input-device=[:0-9A-Za-z_/-]\+\|no-warn\) / contained nextgroup=swayConfigBindgestureArgument,swayConfigBindgestureCombo
syn keyword swayConfigBindgestureType hold swipe pinch contained
syn keyword swayConfigBindgestureDir up down left right inward outward clockwise counterclockwise contained
syn match swayConfigBindgestureCombo /\(hold\(:[1-5]\)\?\|swipe\(:[3-5]\)\?\(:up\|:down\|:left\|:right\)\?\|pinch\(:[2-5]\)\?:\(+\?\(inward\|outward\|clockwise\|counterclockwise\|up\|down\|left\|right\)\)\+\) / contained contains=i3ConfigNumber,swayConfigBindgestureType,i3ConfigColonOperator,swayConfigBindgestureDir,i3ConfigBindModifier nextgroup=swayConfigBindgestureCombo,i3ConfigBind
diff --git a/runtime/syntax/terraform.vim b/runtime/syntax/terraform.vim
new file mode 100644
index 0000000000..559dc79568
--- /dev/null
+++ b/runtime/syntax/terraform.vim
@@ -0,0 +1,17 @@
+" Vim syntax file
+" Language: Terraform
+" Maintainer: Gregory Anders
+" Upstream: https://github.com/hashivim/vim-terraform
+" Last Change: 2024-09-03
+
+if exists('b:current_syntax')
+ finish
+endif
+
+runtime! syntax/hcl.vim
+
+syn keyword terraType string bool number object tuple list map set any
+
+hi def link terraType Type
+
+let b:current_syntax = 'terraform'
diff --git a/runtime/syntax/thrift.vim b/runtime/syntax/thrift.vim
new file mode 100644
index 0000000000..502e98852a
--- /dev/null
+++ b/runtime/syntax/thrift.vim
@@ -0,0 +1,74 @@
+" Vim syntax file
+" Language: Thrift
+" Original Author: Martin Smith <martin@facebook.com>
+" Maintainer: Yinzuo Jiang <jiangyinzuo@foxmail.com>
+" Last Change: 2024/07/29
+" https://github.com/apache/thrift/blob/master/contrib/thrift.vim
+"
+" Licensed to the Apache Software Foundation (ASF) under one
+" or more contributor license agreements. See the NOTICE file
+" distributed with this work for additional information
+" regarding copyright ownership. The ASF licenses this file
+" to you under the Apache License, Version 2.0 (the
+" "License"); you may not use this file except in compliance
+" with the License. You may obtain a copy of the License at
+"
+" http://www.apache.org/licenses/LICENSE-2.0
+"
+" Unless required by applicable law or agreed to in writing,
+" software distributed under the License is distributed on an
+" "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+" KIND, either express or implied. See the License for the
+" specific language governing permissions and limitations
+" under the License.
+"
+
+if exists("b:current_syntax")
+ finish
+endif
+
+" Todo
+syn keyword thriftTodo TODO todo FIXME fixme XXX xxx contained
+
+" Comments
+syn match thriftComment "#.*" contains=thriftTodo
+syn region thriftComment start="/\*" end="\*/" contains=thriftTodo
+syn match thriftComment "//.\{-}\(?>\|$\)\@="
+
+" String
+syn region thriftStringDouble matchgroup=None start=+"+ end=+"+
+
+" Number
+syn match thriftNumber "-\=\<\d\+\>" contained
+
+" Keywords
+syn keyword thriftKeyword namespace
+syn keyword thriftKeyword xsd_all xsd_optional xsd_nillable xsd_attrs
+syn keyword thriftKeyword include cpp_include cpp_type const optional required
+syn keyword thriftBasicTypes void bool byte i8 i16 i32 i64 double string binary
+syn keyword thriftStructure map list set struct typedef exception enum throws union
+
+" Special
+syn match thriftSpecial "\d\+:"
+
+" Structure
+syn keyword thriftStructure service oneway extends
+"async" { return tok_async; }
+"exception" { return tok_xception; }
+"extends" { return tok_extends; }
+"throws" { return tok_throws; }
+"service" { return tok_service; }
+"enum" { return tok_enum; }
+"const" { return tok_const; }
+
+hi def link thriftComment Comment
+hi def link thriftKeyword Special
+hi def link thriftBasicTypes Type
+hi def link thriftStructure StorageClass
+hi def link thriftTodo Todo
+hi def link thriftString String
+hi def link thriftNumber Number
+hi def link thriftSpecial Special
+hi def link thriftStructure Structure
+
+let b:current_syntax = "thrift"
diff --git a/runtime/syntax/tmux.vim b/runtime/syntax/tmux.vim
index 9766ed55d7..4b8454dd51 100644
--- a/runtime/syntax/tmux.vim
+++ b/runtime/syntax/tmux.vim
@@ -1,5 +1,5 @@
" Language: tmux(1) configuration file
-" Version: 3.4 (git-608d1134)
+" Version: 3.4 (git-3d8ead8a)
" URL: https://github.com/ericpruitt/tmux.vim/
" Maintainer: Eric Pruitt <eric.pruitt@gmail.com>
" License: 2-Clause BSD (http://opensource.org/licenses/BSD-2-Clause)
@@ -28,7 +28,7 @@ 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\)\($\|\s\)/ display
+syn match tmuxControl /\(^\|\s\)%\(if\|elif\|else\|endif\|hidden\)\($\|\s\)/ display
syn match tmuxEscape /\\\(u\x\{4\}\|U\x\{8\}\|\o\{3\}\|[\\ernt$]\)/ display
" Missing closing bracket.
@@ -37,7 +37,7 @@ syn match tmuxInvalidVariableExpansion /\${[^}]*$/ display
syn match tmuxInvalidVariableExpansion /\${[^A-Za-z_][^}]*}/ display
syn match tmuxInvalidVariableExpansion /\$[^A-Za-z_{ \t]/ display
" Contains invalid character.
-syn match tmuxInvalidVariableExpansion /\${[^}]*[^A-Za-z0-9_][^}]*}/ display
+syn match tmuxInvalidVariableExpansion /\${[^}]*[^A-Za-z0-9_}][^}]*}/ display
syn region tmuxComment start=/#/ skip=/\\\@<!\\$/ end=/$/ contains=tmuxTodo,@Spell
@@ -99,11 +99,11 @@ syn keyword tmuxOptions
\ 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
+\ allow-rename allow-set-title 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
+\ clock-mode-colour clock-mode-style command-alias command-error 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
diff --git a/runtime/syntax/tsv.vim b/runtime/syntax/tsv.vim
new file mode 100644
index 0000000000..f0dd9f717d
--- /dev/null
+++ b/runtime/syntax/tsv.vim
@@ -0,0 +1,12 @@
+" Vim filetype plugin file
+" Language: Tab separated values (TSV)
+" Last Change: 2024 Jul 16
+" This runtime file is looking for a new maintainer.
+
+if exists('b:current_syntax')
+ finish
+endif
+
+let b:csv_delimiter = '\t' " enforce tab delimiter
+runtime! syntax/csv.vim
+let b:current_syntax = 'tsv'
diff --git a/runtime/syntax/typescript.vim b/runtime/syntax/typescript.vim
index 5389c21497..03520fd56a 100644
--- a/runtime/syntax/typescript.vim
+++ b/runtime/syntax/typescript.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: TypeScript
" Maintainer: Herrington Darkholme
-" Last Change: 2023 Aug 13
+" Last Change: 2024 May 24
" Based On: Herrington Darkholme's yats.vim
" Changes: Go to https://github.com/HerringtonDarkholme/yats.vim for recent changes.
" Origin: https://github.com/othree/yajs
diff --git a/runtime/syntax/typescriptreact.vim b/runtime/syntax/typescriptreact.vim
index 1c510459f5..061ec4d81e 100644
--- a/runtime/syntax/typescriptreact.vim
+++ b/runtime/syntax/typescriptreact.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: TypeScript with React (JSX)
" Maintainer: The Vim Project <https://github.com/vim/vim>
-" Last Change: 2023 Aug 13
+" Last Change: 2024 May 26
" Based On: Herrington Darkholme's yats.vim
" Changes: See https://github.com/HerringtonDarkholme/yats.vim
" Credits: See yats.vim on github
@@ -118,13 +118,14 @@ syntax match tsxEqual +=+ display contained
" <tag id="sample">
" s~~~~~~e
-syntax region tsxString contained start=+"+ end=+"+ contains=tsxEntity,@Spell display
+syntax region tsxString contained start=+"+ skip=+\\"+ end=+"+ contains=tsxEntity,@Spell display
+syntax region tsxString contained start=+'+ skip=+\\'+ end=+'+ contains=tsxEntity,@Spell display
" <tag key={this.props.key}>
" s~~~~~~~~~~~~~~e
syntax region tsxEscJs
\ contained
- \ contains=@typescriptValue,@tsxComment
+ \ contains=@typescriptValue,@tsxComment,typescriptObjectSpread
\ matchgroup=typescriptBraces
\ start=+{+
\ end=+}+
diff --git a/runtime/syntax/typst.vim b/runtime/syntax/typst.vim
new file mode 100644
index 0000000000..82fdadb3d5
--- /dev/null
+++ b/runtime/syntax/typst.vim
@@ -0,0 +1,472 @@
+" Vim syntax file
+" Language: Typst
+" Maintainer: Gregory Anders <greg@gpanders.com>
+" Last Change: 2024-07-14
+" Based on: https://github.com/kaarmu/typst.vim
+
+if exists('b:current_syntax')
+ finish
+endif
+
+syntax sync fromstart
+syntax spell toplevel
+
+" Common {{{1
+syntax cluster typstCommon
+ \ contains=@typstComment
+
+" Common > Comment {{{2
+syntax cluster typstComment
+ \ contains=typstCommentBlock,typstCommentLine
+syntax match typstCommentBlock
+ \ #/\*\%(\_.\{-}\)\*/#
+ \ contains=typstCommentTodo,@Spell
+syntax match typstCommentLine
+ \ #//.*#
+ \ contains=typstCommentTodo,@Spell
+syntax keyword typstCommentTodo
+ \ contained
+ \ TODO FIXME XXX TBD
+
+
+" Code {{{1
+syntax cluster typstCode
+ \ contains=@typstCommon
+ \ ,@typstCodeKeywords
+ \ ,@typstCodeConstants
+ \ ,@typstCodeIdentifiers
+ \ ,@typstCodeFunctions
+ \ ,@typstCodeParens
+
+" Code > Keywords {{{2
+syntax cluster typstCodeKeywords
+ \ contains=typstCodeConditional
+ \ ,typstCodeRepeat
+ \ ,typstCodeKeyword
+ \ ,typstCodeStatement
+syntax keyword typstCodeConditional
+ \ contained
+ \ if else
+syntax keyword typstCodeRepeat
+ \ contained
+ \ while for
+syntax keyword typstCodeKeyword
+ \ contained
+ \ not in and or return
+syntax region typstCodeStatement
+ \ contained
+ \ matchgroup=typstCodeStatementWord start=/\v(let|set|import|include)>/
+ \ matchgroup=Noise end=/\v%(;|$)/
+ \ contains=@typstCode
+syntax region typstCodeStatement
+ \ contained
+ \ matchgroup=typstCodeStatementWord start=/show/
+ \ matchgroup=Noise end=/\v%(:|$)/ keepend
+ \ contains=@typstCode
+ \ skipwhite nextgroup=@typstCode,typstCodeShowRocket
+syntax match typstCodeShowRocket
+ \ contained
+ \ /.*=>/
+ \ contains=@typstCode
+ \ skipwhite nextgroup=@typstCode
+
+" Code > Identifiers {{{2
+syntax cluster typstCodeIdentifiers
+ \ contains=typstCodeIdentifier
+ \ ,typstCodeFieldAccess
+syntax match typstCodeIdentifier
+ \ contained
+ \ /\v\w\k*>(<%(let|set|show|import|include))@<![\.\[\(]@!/
+syntax match typstCodeFieldAccess
+ \ contained
+ \ /\v\w\k*>(<%(let|set|show|import|include))@<!\.[\[\(]@!/
+ \ nextgroup=typstCodeFieldAccess,typstCodeFunction
+
+" Code > Functions {{{2
+syntax cluster typstCodeFunctions
+ \ contains=typstCodeFunction
+syntax match typstCodeFunction
+ \ contained
+ \ /\v\w\k*>(<%(let|set|show|import|include))@<![\(\[]@=/
+ \ nextgroup=typstCodeFunctionArgument
+syntax match typstCodeFunctionArgument
+ \ contained
+ \ /\v%(%(\(.{-}\)|\[.{-}\]|\{.{-}\}))*/ transparent
+ \ contains=@typstCode
+
+" Code > Constants {{{2
+syntax cluster typstCodeConstants
+ \ contains=typstCodeConstant
+ \ ,typstCodeNumberInteger
+ \ ,typstCodeNumberFloat
+ \ ,typstCodeNumberLength
+ \ ,typstCodeNumberAngle
+ \ ,typstCodeNumberRatio
+ \ ,typstCodeNumberFraction
+ \ ,typstCodeString
+ \ ,typstCodeLabel
+syntax match typstCodeConstant
+ \ contained
+ \ /\v<%(none|auto|true|false)-@!>/
+syntax match typstCodeNumberInteger
+ \ contained
+ \ /\v<\d+>/
+
+syntax match typstCodeNumberFloat
+ \ contained
+ \ /\v<\d+\.\d*>/
+syntax match typstCodeNumberLength
+ \ contained
+ \ /\v<\d+(\.\d*)?(pt|mm|cm|in|em)>/
+syntax match typstCodeNumberAngle
+ \ contained
+ \ /\v<\d+(\.\d*)?(deg|rad)>/
+syntax match typstCodeNumberRatio
+ \ contained
+ \ /\v<\d+(\.\d*)?\%/
+syntax match typstCodeNumberFraction
+ \ contained
+ \ /\v<\d+(\.\d*)?fr>/
+syntax region typstCodeString
+ \ contained
+ \ start=/"/ skip=/\v\\\\|\\"/ end=/"/
+ \ contains=@Spell
+syntax match typstCodeLabel
+ \ contained
+ \ /\v\<\K%(\k*-*)*\>/
+
+" Code > Parens {{{2
+syntax cluster typstCodeParens
+ \ contains=typstCodeParen
+ \ ,typstCodeBrace
+ \ ,typstCodeBracket
+ \ ,typstCodeDollar
+ \ ,typstMarkupRawInline
+ \ ,typstMarkupRawBlock
+syntax region typstCodeParen
+ \ contained
+ \ matchgroup=Noise start=/(/ end=/)/
+ \ contains=@typstCode
+syntax region typstCodeBrace
+ \ contained
+ \ matchgroup=Noise start=/{/ end=/}/
+ \ contains=@typstCode
+syntax region typstCodeBracket
+ \ contained
+ \ matchgroup=Noise start=/\[/ end=/\]/
+ \ contains=@typstMarkup
+syntax region typstCodeDollar
+ \ contained
+ \ matchgroup=Number start=/\\\@<!\$/ end=/\\\@<!\$/
+ \ contains=@typstMath
+
+
+" Hashtag {{{1
+syntax cluster typstHashtag
+ \ contains=@typstHashtagKeywords
+ \ ,@typstHashtagConstants
+ \ ,@typstHashtagIdentifiers
+ \ ,@typstHashtagFunctions
+ \ ,@typstHashtagParens
+
+" Hashtag > Keywords {{{2
+syntax cluster typstHashtagKeywords
+ \ contains=typstHashtagConditional
+ \ ,typstHashtagRepeat
+ \ ,typstHashtagKeywords
+ \ ,typstHashtagStatement
+
+" syntax match typstHashtagControlFlowError
+" \ /\v#%(if|while|for)>-@!.{-}$\_.{-}%(\{|\[|\()/
+syntax match typstHashtagControlFlow
+ \ /\v#%(if|while|for)>.{-}\ze%(\{|\[|\()/
+ \ contains=typstHashtagConditional,typstHashtagRepeat
+ \ nextgroup=@typstCode
+syntax region typstHashtagConditional
+ \ contained
+ \ start=/\v#if>/ end=/\v\ze(\{|\[)/
+ \ contains=@typstCode
+syntax region typstHashtagRepeat
+ \ contained
+ \ start=/\v#(while|for)>/ end=/\v\ze(\{|\[)/
+ \ contains=@typstCode
+syntax match typstHashtagKeyword
+ \ /\v#(return)>/
+ \ skipwhite nextgroup=@typstCode
+syntax region typstHashtagStatement
+ \ matchgroup=typstHashtagStatementWord start=/\v#(let|set|import|include)>/
+ \ matchgroup=Noise end=/\v%(;|$)/
+ \ contains=@typstCode
+syntax region typstHashtagStatement
+ \ matchgroup=typstHashtagStatementWord start=/#show/
+ \ matchgroup=Noise end=/\v%(:|$)/ keepend
+ \ contains=@typstCode
+ \ skipwhite nextgroup=@typstCode,typstCodeShowRocket
+
+" Hashtag > Constants {{{2
+syntax cluster typstHashtagConstants
+ \ contains=typstHashtagConstant
+syntax match typstHashtagConstant
+ \ /\v#(none|auto|true|false)>/
+
+" Hashtag > Identifiers {{{2
+syntax cluster typstHashtagIdentifiers
+ \ contains=typstHashtagIdentifier
+ \ ,typstHashtagFieldAccess
+syntax match typstHashtagIdentifier
+ \ /\v#\w\k*>(<%(let|set|show|import|include))@<![\.\[\(]@!/
+syntax match typstHashtagFieldAccess
+ \ /\v#\w\k*>(<%(let|set|show|import|include))@<!\.[\[\(]@!/
+ \ nextgroup=typstCodeFieldAccess,typstCodeFunction
+
+" Hashtag > Functions {{{2
+syntax cluster typstHashtagFunctions
+ \ contains=typstHashtagFunction
+syntax match typstHashtagFunction
+ \ /\v#\w\k*>(<%(let|set|show|import|include))@<![\(\[]@=/
+ \ nextgroup=typstCodeFunctionArgument
+
+" Hashtag > Parens {{{2
+syntax cluster typstHashtagParens
+ \ contains=typstHashtagParen
+ \ ,typstHashtagBrace
+ \ ,typstHashtagBracket
+ \ ,typstHashtagDollar
+syntax region typstHashtagParen
+ \ matchgroup=Noise start=/#(/ end=/)/
+ \ contains=@typstCode
+syntax region typstHashtagBrace
+ \ matchgroup=Noise start=/#{/ end=/}/
+ \ contains=@typstCode
+syntax region typstHashtagBracket
+ \ matchgroup=Noise start=/#\[/ end=/\]/
+ \ contains=@typstMarkup
+syntax region typstHashtagDollar
+ \ matchgroup=Noise start=/#\$/ end=/\\\@<!\$/
+ \ contains=@typstMath
+
+
+" Markup {{{1
+syntax cluster typstMarkup
+ \ contains=@typstCommon
+ \ ,@Spell
+ \ ,@typstHashtag
+ \ ,@typstMarkupText
+ \ ,@typstMarkupParens
+
+" Markup > Text {{{2
+syntax cluster typstMarkupText
+ \ contains=typstMarkupRawInline
+ \ ,typstMarkupRawBlock
+ \ ,typstMarkupLabel
+ \ ,typstMarkupReference
+ \ ,typstMarkupUrl
+ \ ,typstMarkupHeading
+ \ ,typstMarkupBulletList
+ \ ,typstMarkupEnumList
+ \ ,typstMarkupTermList
+ \ ,typstMarkupBold
+ \ ,typstMarkupItalic
+ \ ,typstMarkupLinebreak
+ \ ,typstMarkupNonbreakingSpace
+ \ ,typstMarkupShy
+ \ ,typstMarkupDash
+ \ ,typstMarkupEllipsis
+
+" Raw Text
+syntax match typstMarkupRawInline
+ \ /`.\{-}`/
+syntax region typstMarkupRawBlock
+ \ matchgroup=Macro start=/```\w*/
+ \ matchgroup=Macro end=/```/ keepend
+syntax region typstMarkupCodeBlockTypst
+ \ matchgroup=Macro start=/```typst/
+ \ matchgroup=Macro end=/```/ contains=@typstCode keepend
+ \ concealends
+
+for s:name in get(g:, 'typst_embedded_languages', [])
+ let s:include = ['syntax include'
+ \ ,'@typstEmbedded_'..s:name
+ \ ,'syntax/'..s:name..'.vim']
+ let s:rule = ['syn region'
+ \,s:name
+ \,'matchgroup=Macro'
+ \,'start=/```'..s:name..'\>/ end=/```/'
+ \,'contains=@typstEmbedded_'..s:name
+ \,'keepend'
+ \,'concealends']
+ execute 'silent! ' .. join(s:include, ' ')
+ unlet! b:current_syntax
+ execute join(s:rule, ' ')
+endfor
+
+" Label & Reference
+syntax match typstMarkupLabel
+ \ /\v\<\K%(\k*-*)*\>/
+syntax match typstMarkupReference
+ \ /\v\@\K%(\k*-*)*/
+
+" URL
+syntax match typstMarkupUrl
+ \ #\v\w+://\S*#
+
+" Heading
+syntax match typstMarkupHeading
+ \ /^\s*\zs=\{1,6}\s.*$/
+ \ contains=typstMarkupLabel,@Spell
+
+" Lists
+syntax match typstMarkupBulletList
+ \ /\v^\s*-\s+/
+syntax match typstMarkupEnumList
+ \ /\v^\s*(\+|\d+\.)\s+/
+syntax region typstMarkupTermList
+ \ oneline start=/\v^\s*\/\s/ end=/:/
+ \ contains=@typstMarkup
+
+" Bold & Italic
+syntax match typstMarkupBold
+ \ /\v(\w|\\)@1<!\*\S@=.{-}(\n.{-1,})*\S@1<=\\@1<!\*/
+ \ contains=typstMarkupBoldRegion
+syntax match typstMarkupItalic
+ \ /\v(\w|\\)@1<!_\S@=.{-}(\n.{-1,})*\S@1<=\\@1<!_/
+ \ contains=typstMarkupItalicRegion
+syntax match typstMarkupBoldItalic
+ \ contained
+ \ /\v(\w|\\)@1<![_\*]\S@=.{-}(\n.{-1,})*\S@1<=\\@1<!\2/
+ \ contains=typstMarkupBoldRegion,typstMarkupItalicRegion
+syntax region typstMarkupBoldRegion
+ \ contained
+ \ transparent matchgroup=typstMarkupBold
+ \ start=/\(^\|[^0-9a-zA-Z]\)\@<=\*/ end=/\*\($\|[^0-9a-zA-Z]\)\@=/
+ \ concealends contains=typstMarkupBoldItalic,typstMarkupLabel,@Spell
+syntax region typstMarkupItalicRegion
+ \ contained
+ \ transparent matchgroup=typstMarkupItalic
+ \ start=/\(^\|[^0-9a-zA-Z]\)\@<=_/ end=/_\($\|[^0-9a-zA-Z]\)\@=/
+ \ concealends contains=typstMarkupBoldItalic,typstMarkupLabel,@Spell
+
+" Linebreak & Special Whitespace
+syntax match typstMarkupLinebreak
+ \ /\\\\/
+syntax match typstMarkupNonbreakingSpace
+ \ /\~/
+syntax match typstMarkupShy
+ \ /-?/
+
+" Special Symbols
+syntax match typstMarkupDash
+ \ /-\{2,3}/
+syntax match typstMarkupEllipsis
+ \ /\.\.\./
+
+" Markup > Parens {{{2
+syntax cluster typstMarkupParens
+ \ contains=typstMarkupBracket
+ \ ,typstMarkupDollar
+syntax region typstMarkupBracket
+ \ matchgroup=Noise start=/\[/ end=/\]/
+ \ contains=@typstMarkup
+syntax region typstMarkupDollar
+ \ matchgroup=Special start=/\\\@<!\$/ end=/\\\@<!\$/
+ \ contains=@typstMath
+
+
+" Math {{{1
+syntax cluster typstMath
+ \ contains=@typstCommon
+ \ ,@typstHashtag
+ \ ,typstMathIdentifier
+ \ ,typstMathFunction
+ \ ,typstMathNumber
+ \ ,typstMathSymbol
+ \ ,typstMathBold
+ \ ,typstMathScripts
+ \ ,typstMathQuote
+
+syntax match typstMathIdentifier
+ \ /\a\a\+/
+ \ contained
+syntax match typstMathFunction
+ \ /\a\a\+\ze(/
+ \ contained
+syntax match typstMathNumber
+ \ /\<\d\+\>/
+ \ contained
+syntax region typstMathQuote
+ \ matchgroup=String start=/"/ skip=/\\"/ end=/"/
+ \ contained
+
+" Math > Linked groups {{{2
+highlight default link typstMathIdentifier Identifier
+highlight default link typstMathFunction Statement
+highlight default link typstMathNumber Number
+highlight default link typstMathSymbol Statement
+
+" Highlighting {{{1
+
+" Highlighting > Linked groups {{{2
+highlight default link typstCommentBlock Comment
+highlight default link typstCommentLine Comment
+highlight default link typstCommentTodo Todo
+highlight default link typstCodeConditional Conditional
+highlight default link typstCodeRepeat Repeat
+highlight default link typstCodeKeyword Keyword
+highlight default link typstCodeConstant Constant
+highlight default link typstCodeNumberInteger Number
+highlight default link typstCodeNumberFloat Number
+highlight default link typstCodeNumberLength Number
+highlight default link typstCodeNumberAngle Number
+highlight default link typstCodeNumberRatio Number
+highlight default link typstCodeNumberFraction Number
+highlight default link typstCodeString String
+highlight default link typstCodeLabel Structure
+highlight default link typstCodeStatementWord Statement
+highlight default link typstCodeIdentifier Identifier
+highlight default link typstCodeFieldAccess Identifier
+highlight default link typstCodeFunction Function
+highlight default link typstCodeParen Noise
+highlight default link typstCodeBrace Noise
+highlight default link typstCodeBracket Noise
+highlight default link typstCodeDollar Noise
+" highlight default link typstHashtagControlFlowError Error
+highlight default link typstHashtagConditional Conditional
+highlight default link typstHashtagRepeat Repeat
+highlight default link typstHashtagKeyword Keyword
+highlight default link typstHashtagConstant Constant
+highlight default link typstHashtagStatementWord Statement
+highlight default link typstHashtagIdentifier Identifier
+highlight default link typstHashtagFieldAccess Identifier
+highlight default link typstHashtagFunction Function
+highlight default link typstHashtagParen Noise
+highlight default link typstHashtagBrace Noise
+highlight default link typstHashtagBracket Noise
+highlight default link typstHashtagDollar Noise
+highlight default link typstMarkupRawInline Macro
+highlight default link typstMarkupRawBlock Macro
+highlight default link typstMarkupLabel Structure
+highlight default link typstMarkupReference Structure
+highlight default link typstMarkupBulletList Structure
+" highlight default link typstMarkupItalicError Error
+" highlight default link typstMarkupBoldError Error
+highlight default link typstMarkupEnumList Structure
+highlight default link typstMarkupLinebreak Structure
+highlight default link typstMarkupNonbreakingSpace Structure
+highlight default link typstMarkupShy Structure
+highlight default link typstMarkupDash Structure
+highlight default link typstMarkupEllipsis Structure
+highlight default link typstMarkupTermList Structure
+highlight default link typstMarkupDollar Noise
+
+" Highlighting > Custom Styling {{{2
+highlight! Conceal ctermfg=NONE ctermbg=NONE guifg=NONE guibg=NONE
+
+highlight default typstMarkupHeading term=underline,bold cterm=underline,bold gui=underline,bold
+highlight default typstMarkupUrl term=underline cterm=underline gui=underline
+highlight default typstMarkupBold term=bold cterm=bold gui=bold
+highlight default typstMarkupItalic term=italic cterm=italic gui=italic
+highlight default typstMarkupBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic
+
+let b:current_syntax = 'typst'
+
+" }}}1
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 4fc640bab1..9073c6e7bf 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -36,8 +36,8 @@ 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
-" 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
+" GEN_SYN_VIM: vimOption term output code, START_STR='syn keyword vimOption contained', END_STR='skipwhite nextgroup=vimSetEqual,vimSetMod'
+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 t_xo skipwhite nextgroup=vimSetEqual,vimSetMod
" 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"
@@ -60,15 +60,20 @@ syn case ignore
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 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 vimHLGroup contained ErrorMsg IncSearch ModeMsg NonText StatusLine StatusLineNC EndOfBuffer VertSplit DiffText PmenuSbar TabLineSel TabLineFill Cursor lCursor QuickFixLine CursorLineSign CursorLineFold CurSearch PmenuKind PmenuKindSel PmenuMatch PmenuMatchSel 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 MatchParen StatusLineTerm StatusLineTermNC CursorIM LineNrAbove LineNrBelow
+syn match vimHLGroup contained "\<Conceal\>"
+syn keyword vimOnlyHLGroup contained Menu Scrollbar 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
+" Set up commands for this syntax highlighting file {{{2
+
+com! -nargs=* Vim9 execute <q-args> s:vim9script ? "" : "contained"
+com! -nargs=* VimL execute <q-args> s:vim9script ? "contained" : ""
+
if exists("g:vimsyn_folding") && g:vimsyn_folding =~# '[afhHlmpPrt]'
if g:vimsyn_folding =~# 'a'
com! -nargs=* VimFolda <args> fold
@@ -151,6 +156,14 @@ else
let s:vimsyn_maxlines= 60
endif
+" Nulls {{{2
+" =====
+Vim9 syn keyword vim9Null null null_blob null_channel null_class null_dict null_function null_job null_list null_object null_partial null_string
+
+" Booleans {{{2
+" ========
+Vim9 syn keyword vim9Boolean true false
+
" Numbers {{{2
" =======
syn case ignore
@@ -164,9 +177,11 @@ syn match vimNumber '\%(^\|\A\)\zs#\x\{6}' skipwhite nextgroup=vimGlobal,vimSub
syn case match
" All vimCommands are contained by vimIsCommand. {{{2
-syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimDef,@vimEcho,vimEnddef,vimEndfunction,vimExecute,vimIsCommand,vimExtCmd,vimFor,vimFunction,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNotFunc,vimNorm,vimSet,vimSyntax,vimUnlet,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate
+syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimCall,vimCatch,vimConst,vimDef,vimDelcommand,@vimEcho,vimEnddef,vimEndfunction,vimExecute,vimIsCommand,vimExtCmd,vimFor,vimFunction,vimFuncFold,vimGlobal,vimHighlight,vimLet,vimLoadkeymap,vimMap,vimMark,vimMatch,vimNotFunc,vimNorm,vimSet,vimSleep,vimSyntax,vimThrow,vimUnlet,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate,@vim9CmdList
+syn cluster vim9CmdList contains=vim9Const,vim9Final,vim9For,vim9Var
syn match vimCmdSep "[:|]\+" skipwhite nextgroup=@vimCmdList,vimSubst1
syn match vimIsCommand "\<\%(\h\w*\|[23]mat\%[ch]\)\>" contains=vimCommand
+syn match vimBang contained "!"
syn match vimVar contained "\<\h[a-zA-Z0-9#_]*\>"
syn match vimVar "\<[bwglstav]:\h[a-zA-Z0-9#_]*\>"
syn match vimVar "\s\zs&\%([lg]:\)\=\a\+\>"
@@ -175,7 +190,8 @@ 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
+syn cluster vimExprList contains=vimEnvvar,vimFunc,vimNumber,vimOper,vimOperParen,vimLetRegister,vimString,vimVar,@vim9ExprList
+syn cluster vim9ExprList contains=vim9Boolean,vim9Null
" Insertions And Appends: insert append {{{2
" (buftype != nofile test avoids having append, change, insert show up in the command window)
@@ -195,6 +211,15 @@ syn match vimBehave "\<be\%[have]\>" nextgroup=vimBehaveBang,vimBehaveModel,vi
syn match vimBehaveBang contained "\a\@1<=!" nextgroup=vimBehaveModel skipwhite
syn keyword vimBehaveModel contained mswin xterm
+" Call {{{2
+" ====
+syn match vimCall "\<call\=\>" skipwhite nextgroup=vimFunc
+
+" Exception Handling {{{2
+syn keyword vimThrow th[row] skipwhite nextgroup=@vimExprList
+syn keyword vimCatch cat[ch] skipwhite nextgroup=vimCatchPattern
+syn region vimCatchPattern contained matchgroup=Delimiter start="\z([!#$%&'()*+,-./:;<=>?@[\]^_`{}~]\)" skip="\\\\\|\\\z1" end="\z1" contains=@vimSubstList oneline
+
" Filetypes {{{2
" =========
syn match vimFiletype "\<filet\%[ype]\(\s\+\I\i*\)*" skipwhite contains=vimFTCmd,vimFTOption,vimFTError
@@ -224,8 +249,8 @@ syn keyword vimAugroupKey contained aug[roup] skipwhite nextgroup=vimAugroupBan
" Operators: {{{2
" =========
-syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimRegister,@vimContinue,vim9Comment,vimVar
-syn match vimOper "||\|&&\|[-+*/%.!]" skipwhite nextgroup=vimString,vimSpecFile
+syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimRegister,@vimContinue,vim9Comment,vimVar,vimBoolean,vimNull
+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=@vimOperGroup
@@ -240,8 +265,8 @@ syn cluster vimFuncList contains=vimFuncBang,vimFunctionError,vimFuncKey,vimFunc
syn cluster vimDefList contains=vimFuncBang,vimFunctionError,vimDefKey,vimFuncSID,Tag
syn cluster vimFuncBodyCommon contains=@vimCmdList,vimCmplxRepeat,vimContinue,vimCtrlChar,vimDef,vimEnvvar,vimFBVar,vimFunc,vimFunction,vimLetHereDoc,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegister,vimSearch,vimSpecFile,vimString,vimSubst,vimFuncFold
-syn cluster vimFuncBodyList contains=@vimFuncBodyCommon,vimComment,vimLineComment,vimFuncVar,vimInsert
-syn cluster vimDefBodyList contains=@vimFuncBodyCommon,vim9Comment,vim9LineComment
+syn cluster vimFuncBodyList contains=@vimFuncBodyCommon,vimComment,vimLineComment,vimFuncVar,vimInsert,vimConst,vimLet
+syn cluster vimDefBodyList contains=@vimFuncBodyCommon,vim9Comment,vim9LineComment,vim9Const,vim9Final,vim9Var,vim9Null,vim9Boolean,vim9For
syn region vimFuncPattern contained matchgroup=vimOper start="/" end="$" contains=@vimSubstList
syn match vimFunction "\<fu\%[nction]\>" skipwhite nextgroup=vimCmdSep,vimComment,vimFuncPattern contains=vimFuncKey
@@ -251,8 +276,8 @@ syn match vimFunction "\<fu\%[nction]\>!\=\s*\%(<[sS][iI][dD]>\|[sg]:\)\=\%(\i\|
syn match vimDef "\<def\s\+new\%(\i\|{.\{-1,}}\)\+" contains=@vimDefList nextgroup=vimDefParams
syn match vimDef "\<def\>!\=\s*\%(<[sS][iI][dD]>\|[sg]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)\+" contains=@vimDefList nextgroup=vimDefParams
-syn match vimFuncComment contained +".*+ skipwhite skipnl nextgroup=vimFuncBody,vimEndfunction
-syn match vimDefComment contained "#.*" skipwhite skipnl nextgroup=vimDefBody,vimEnddef
+syn match vimFuncComment contained +".*+ skipwhite skipempty nextgroup=vimFuncBody,vimEndfunction
+syn match vimDefComment contained "#.*" skipwhite skipempty nextgroup=vimDefBody,vimEnddef
syn match vimFuncBang contained "!"
syn match vimFuncSID contained "\c<sid>"
@@ -260,24 +285,24 @@ syn match vimFuncSID contained "\<[sg]:"
syn keyword vimFuncKey contained fu[nction]
syn keyword vimDefKey contained def
-syn region vimFuncParams contained matchgroup=Delimiter start="(" skip=+\n\s*\\\|\n\s*"\\ + end=")" skipwhite skipnl nextgroup=vimFuncBody,vimFuncComment,vimEndfunction,vimFuncMod contains=vimFuncParam,@vimContinue
-syn region vimDefParams contained matchgroup=Delimiter start="(" end=")" skipwhite skipnl nextgroup=vimDefBody,vimDefComment,vimEnddef,vimReturnType contains=vimDefParam,vim9Comment
+syn region vimFuncParams contained matchgroup=Delimiter start="(" skip=+\n\s*\\\|\n\s*"\\ + end=")" skipwhite skipempty nextgroup=vimFuncBody,vimFuncComment,vimEndfunction,vimFuncMod,vim9CommentError contains=vimFuncParam,@vimContinue
+syn region vimDefParams contained matchgroup=Delimiter start="(" end=")" skipwhite skipempty nextgroup=vimDefBody,vimDefComment,vimEnddef,vimReturnType,vimCommentError contains=vimDefParam,vim9Comment,vimFuncParamEquals
syn match vimFuncParam contained "\<\h\w*\>\|\.\.\." skipwhite nextgroup=vimFuncParamEquals
syn match vimDefParam contained "\<\h\w*\>" skipwhite nextgroup=vimParamType,vimFuncParamEquals
-syn match vimFuncParamEquals contained "=" skipwhite nextgroup=@vimExprList
-syn match vimFuncMod contained "\<\%(abort\|closure\|dict\|range\)\>" skipwhite skipnl nextgroup=vimFuncBody,vimFuncComment,vimEndfunction,vimFuncMod
+syn match vimFuncParamEquals contained "=" skipwhite nextgroup=@vimExprList
+syn match vimFuncMod contained "\<\%(abort\|closure\|dict\|range\)\>" skipwhite skipempty nextgroup=vimFuncBody,vimFuncComment,vimEndfunction,vimFuncMod,vim9CommentError
-syn region vimFuncBody contained start="^" matchgroup=vimCommand end="\<endfu\%[nction]\>" contains=@vimFuncBodyList
-syn region vimDefBody contained start="^" matchgroup=vimCommand end="\<enddef\>" contains=@vimDefBodyList
+syn region vimFuncBody contained start="^." matchgroup=vimCmdSep start="|" matchgroup=vimCommand end="\<endfu\%[nction]\>" contains=@vimFuncBodyList skipwhite nextgroup=vimCmdSep,vimComment,vim9CommentError
+syn region vimDefBody contained start="^." matchgroup=vimCmdSep start="|" matchgroup=vimCommand end="\<enddef\>" contains=@vimDefBodyList skipwhite nextgroup=vimCmdSep,vim9Comment,vimCommentError
-syn match vimEndfunction "\<endf\%[unction]\>"
-syn match vimEnddef "\<enddef\>"
+syn match vimEndfunction "\<endf\%[unction]\>" skipwhite nextgroup=vimCmdSep,vimComment,vim9CommentError
+syn match vimEnddef "\<enddef\>" skipwhite nextgroup=vimCmdSep,vim9Comment,vimCommentError
if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'f'
- syn region vimFuncFold start="^\s*:\=\s*fu\%[nction]\>!\=\s*\%(<[sS][iI][dD]>\|[sg]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)\+\s*(" end="^\s*:\=\s*endf\%[unction]\>" contains=vimFunction fold keepend extend transparent
- syn region vimFuncFold start="^\s*:\=\s*def\>!\=\s*\%(<[sS][iI][dD]>\|[sg]:\)\=\%(\i\|[#.]\)\+(" end="^\s*:\=\s*enddef\>" contains=vimDef fold keepend extend transparent
- syn region vimFuncFold start="^\s*:\=\s*def\s\+new\i\+(" end="^\s*:\=\s*enddef\>" contains=vimDef fold keepend extend transparent
+ syn region vimFuncFold start="\<fu\%[nction]\>!\=\s*\%(<[sS][iI][dD]>\|[sg]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)\+\s*(" end="\<endf\%[unction]\>" contains=vimFunction fold keepend extend transparent
+ syn region vimFuncFold start="\<def\>!\=\s*\%(<[sS][iI][dD]>\|[sg]:\)\=\%(\i\|[#.]\)\+(" end="\<enddef\>" contains=vimDef fold keepend extend transparent
+ syn region vimFuncFold start="\<def\s\+new\i\+(" end="\<enddef\>" contains=vimDef fold keepend extend transparent
endif
syn match vimFuncVar contained "a:\%(\K\k*\|\d\+\)\>"
@@ -285,9 +310,9 @@ syn match vimFuncBlank contained "\s\+"
" Types: {{{2
" =====
-" vimTypes : new for vim9
-syn region vimReturnType contained start=":\s" end="$" matchgroup=vim9Comment end="\ze#" skipwhite skipnl nextgroup=vimDefBody,vimDefComment,vimEnddef contains=vimTypeSep transparent
-syn match vimParamType contained ":\s\+\a" skipwhite skipnl nextgroup=vimFuncParamEquals contains=vimTypeSep,@vimType
+
+syn region vimReturnType contained start=":\s" end="$" matchgroup=vim9Comment end="\ze[#"]" skipwhite skipempty nextgroup=vimDefBody,vimDefComment,vimEnddef,vimCommentError contains=vimTypeSep transparent
+syn match vimParamType contained ":\s" skipwhite skipnl nextgroup=@vimType contains=vimTypeSep
syn match vimTypeSep contained ":\s\@=" skipwhite nextgroup=@vimType
syn keyword vimType contained any blob bool channel float job number string void
@@ -314,7 +339,7 @@ else
endif
syn cluster vimKeymapLineComment contains=vim9\=KeymapLineComment
-syn region vimKeymap matchgroup=vimCommand start="\<loadk\%[eymap]\>" end="\%$" contains=vimKeymapStart
+syn region vimLoadkeymap matchgroup=vimCommand start="\<loadk\%[eymap]\>" end="\%$" contains=vimKeymapStart
" Special Filenames, Modifiers, Extension Removal: {{{2
" ===============================================
@@ -329,67 +354,73 @@ syn match vimSpecFileMod "\(:[phtre]\)\+" contained
" User-Specified Commands: {{{2
" =======================
syn cluster vimUserCmdList contains=@vimCmdList,vimCmplxRepeat,@vimComment,vimCtrlChar,vimEscapeBrace,vimFunc,vimNotation,vimNumber,vimOper,vimRegister,vimSpecFile,vimString,vimSubst,vimSubstRep,vimSubstRange
-syn keyword vimUserCommand contained com[mand]
-syn match vimUserCmdName contained "\<\u\w*\>" nextgroup=vimUserCmdBlock skipwhite
-syn match vimUserCmd "\<com\%[mand]!\=\>.*$" contains=vimUserAttrb,vimUserAttrbError,vimUserCommand,@vimUserCmdList,vimComFilter,vimCmdBlock,vimUserCmdName
-syn match vimUserAttrbError contained "-\a\+\ze\s"
-syn match vimUserAttrb contained "-nargs=[01*?+]" contains=vimUserAttrbKey,vimOper
-syn match vimUserAttrb contained "-complete=" contains=vimUserAttrbKey,vimOper nextgroup=vimUserAttrbCmplt,vimUserCmdError
-syn match vimUserAttrb contained "-range\(=%\|=\d\+\)\=" contains=vimNumber,vimOper,vimUserAttrbKey
-syn match vimUserAttrb contained "-count\(=\d\+\)\=" contains=vimNumber,vimOper,vimUserAttrbKey
-syn match vimUserAttrb contained "-bang\>" contains=vimOper,vimUserAttrbKey
-syn match vimUserAttrb contained "-bar\>" contains=vimOper,vimUserAttrbKey
-syn match vimUserAttrb contained "-buffer\>" contains=vimOper,vimUserAttrbKey
-syn match vimUserAttrb contained "-register\>" contains=vimOper,vimUserAttrbKey
+syn keyword vimUserCmdKey contained com[mand]
+syn match vimUserCmdName contained "\<\u[[:alnum:]]*\>" skipwhite nextgroup=vimUserCmdBlock
+syn match vimUserCmd "\<com\%[mand]\>!\=.*$" contains=vimUserCmdKey,vimBang,vimUserCmdAttr,vimUserCmdAttrError,vimUserCmdName,@vimUserCmdList,vimComFilter
+syn match vimUserCmdAttrError contained "-\a\+\ze\%(\s\|=\)"
+syn match vimUserCmdAttr contained "-addr=" contains=vimUserCmdAttrKey nextgroup=vimUserCmdAttrAddr
+syn match vimUserCmdAttr contained "-bang\>" contains=vimUserCmdAttrKey
+syn match vimUserCmdAttr contained "-bar\>" contains=vimUserCmdAttrKey
+syn match vimUserCmdAttr contained "-buffer\>" contains=vimUserCmdAttrKey
+syn match vimUserCmdAttr contained "-complete=" contains=vimUserCmdAttrKey nextgroup=vimUserCmdAttrCmplt,vimUserCmdError
+syn match vimUserCmdAttr contained "-count\>" contains=vimUserCmdAttrKey
+syn match vimUserCmdAttr contained "-count=" contains=vimUserCmdAttrKey nextgroup=vimNumber
+syn match vimUserCmdAttr contained "-keepscript\>" contains=vimUserCmdAttrKey
+syn match vimUserCmdAttr contained "-nargs=" contains=vimUserCmdAttrKey nextgroup=vimUserCmdAttrNargs
+syn match vimUserCmdAttr contained "-range\>" contains=vimUserCmdAttrKey
+syn match vimUserCmdAttr contained "-range=" contains=vimUserCmdAttrKey nextgroup=vimNumber,vimUserCmdAttrRange
+syn match vimUserCmdAttr contained "-register\>" contains=vimUserCmdAttrKey
+
+syn match vimUserCmdAttrNargs contained "[01*?+]"
+syn match vimUserCmdAttrRange contained "%"
+
if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_nousercmderror")
syn match vimUserCmdError contained "\S\+\>"
endif
-syn case ignore
-syn keyword vimUserAttrbKey contained bar ban[g] cou[nt] ra[nge] com[plete] n[args] re[gister]
-" GEN_SYN_VIM: vimUserAttrbCmplt, START_STR='syn keyword vimUserAttrbCmplt contained', END_STR=''
-syn keyword vimUserAttrbCmplt contained arglist augroup behave 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 case ignore
+syn keyword vimUserCmdAttrKey contained a[ddr] ban[g] bar bu[ffer] com[plete] cou[nt] k[eepscript] n[args] ra[nge] re[gister]
+" GEN_SYN_VIM: vimUserCmdAttrCmplt, START_STR='syn keyword vimUserCmdAttrCmplt contained', END_STR=''
+syn keyword vimUserCmdAttrCmplt contained arglist augroup behave breakpoint buffer color command compiler cscope diff_buffer dir dir_in_path environment event expression file file_in_path filetype function help highlight history keymap locale mapclear mapping menu messages option packadd runtime scriptnames shellcmd sign syntax syntime tag tag_listfiles user var
+syn keyword vimUserCmdAttrCmplt contained custom customlist nextgroup=vimUserCmdAttrCmpltFunc,vimUserCmdError
+syn match vimUserCmdAttrCmpltFunc contained ",\%([sS]:\|<[sS][iI][dD]>\)\=\%(\h\w*\%([.#]\h\w*\)\+\|\h\w*\)"hs=s+1 nextgroup=vimUserCmdError
+" GEN_SYN_VIM: vimUserCmdAttrAddr, START_STR='syn keyword vimUserCmdAttrAddr contained', END_STR=''
+syn keyword vimUserCmdAttrAddr contained arguments arg buffers buf lines line loaded_buffers load other quickfix qf tabs tab windows win
+syn match vimUserCmdAttrAddr contained "?"
syn case match
-syn match vimUserAttrbCmplt contained "custom,\u\w*"
syn region vimUserCmdBlock contained matchgroup=vimSep start="{" end="}" contains=@vimDefBodyList
+syn match vimDelcommand "\<delc\%[ommand]\>" skipwhite nextgroup=vimDelcommandAttr
+syn match vimDelcommandAttr contained "-buffer\>"
+
" Lower Priority Comments: after some vim commands... {{{2
" =======================
-syn region vimCommentString contained oneline start='\S\s\+"'ms=e end='"'
+if get(g:, "vimsyn_comment_strings", 1)
+ syn region vimCommentString contained oneline start='\S\s\+"'ms=e end='"' extend
+endif
if s:vim9script
- syn match vimComment excludenl +\s"[^\-:.%#=*].*$+lc=1 contains=@vimCommentGroup,vimCommentString contained
- syn match vimComment +\<endif\s\+".*$+lc=5 contains=@vimCommentGroup,vimCommentString contained
- syn match vimComment +\<else\s\+".*$+lc=4 contains=@vimCommentGroup,vimCommentString contained
- " Vim9 comments - TODO: might be highlighted while they don't work
- syn match vim9Comment excludenl +\s#[^{].*$+lc=1 contains=@vimCommentGroup,vimCommentString
- syn match vim9Comment +\<endif\s\+#[^{].*$+lc=5 contains=@vimCommentGroup,vimCommentString
- syn match vim9Comment +\<else\s\+#[^{].*$+lc=4 contains=@vimCommentGroup,vimCommentString
- " Vim9 comment inside expression
- " syn match vim9Comment +\s\zs#[^{].*$+ms=s+1 contains=@vimCommentGroup,vimCommentString
- " syn match vim9Comment +^\s*#[^{].*$+ contains=@vimCommentGroup,vimCommentString
- " syn match vim9Comment +^\s*#$+ contains=@vimCommentGroup,vimCommentString
-
syn cluster vimComment contains=vim9Comment
else
- syn match vimComment excludenl +\s"[^\-:.%#=*].*$+lc=1 contains=@vimCommentGroup,vimCommentString
- syn match vimComment +\<endif\s\+".*$+lc=5 contains=@vimCommentGroup,vimCommentString
- syn match vimComment +\<else\s\+".*$+lc=4 contains=@vimCommentGroup,vimCommentString
- " Vim9 comments - TODO: might be highlighted while they don't work
- syn match vim9Comment excludenl +\s#[^{].*$+lc=1 contains=@vimCommentGroup,vimCommentString contained
- syn match vim9Comment +\<endif\s\+#[^{].*$+lc=5 contains=@vimCommentGroup,vimCommentString contained
- syn match vim9Comment +\<else\s\+#[^{].*$+lc=4 contains=@vimCommentGroup,vimCommentString contained
- " Vim9 comment inside expression
- syn match vim9Comment +\s\zs#[^{].*$+ms=s+1 contains=@vimCommentGroup,vimCommentString contained
- syn match vim9Comment +^\s*#[^{].*$+ contains=@vimCommentGroup,vimCommentString contained
- syn match vim9Comment +^\s*#$+ contains=@vimCommentGroup,vimCommentString contained
-
syn cluster vimComment contains=vimComment
endif
+VimL syn match vimComment excludenl +\s"[^\-:.%#=*].*$+lc=1 contains=@vimCommentGroup,vimCommentString extend
+VimL syn match vimComment +\<endif\s\+".*$+lc=5 contains=@vimCommentGroup,vimCommentString extend
+VimL syn match vimComment +\<else\s\+".*$+lc=4 contains=@vimCommentGroup,vimCommentString extend
+" Vim9 comments - TODO: might be highlighted while they don't work
+Vim9 syn match vim9Comment excludenl +\s#[^{].*$+lc=1 contains=@vimCommentGroup,vimCommentString extend
+Vim9 syn match vim9Comment +\<endif\s\+#[^{].*$+lc=5 contains=@vimCommentGroup,vimCommentString extend
+Vim9 syn match vim9Comment +\<else\s\+#[^{].*$+lc=4 contains=@vimCommentGroup,vimCommentString extend
+" Vim9 comment inside expression
+Vim9 syn match vim9Comment +\s\zs#[^{].*$+ms=s+1 contains=@vimCommentGroup,vimCommentString contained extend
+Vim9 syn match vim9Comment +^\s*#[^{].*$+ contains=@vimCommentGroup,vimCommentString contained extend
+Vim9 syn match vim9Comment +^\s*#$+ contains=@vimCommentGroup,vimCommentString contained extend
+
+syn match vim9CommentError contained "#.*"
+syn match vimCommentError contained +".*+
+
" Environment Variables: {{{2
" =====================
syn match vimEnvvar "\$\I\i*"
@@ -405,8 +436,8 @@ syn region vimPatSepZone oneline contained matchgroup=vimPatSepZ start="\\%\
syn region vimPatRegion contained transparent matchgroup=vimPatSepR start="\\[z%]\=(" end="\\)" contains=@vimSubstList oneline
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 keepend start=+[^a-zA-Z>!\\@]"+lc=1 skip=+\\\\\|\\"+ matchgroup=vimStringEnd end=+"+ contains=@vimStringGroup extend
+syn region vimString oneline keepend start=+[^a-zA-Z>!\\@]'+lc=1 end=+'+ extend
"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 +\(\\\\\|.\)\{-}[^\\]"+
@@ -416,23 +447,22 @@ syn match vimEscape contained "\\\o\{1,3}\|\\[xX]\x\{1,2}\|\\u\x\{1,4}\|\\U\x\{1
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 vimString oneline start=+$'+ skip=+''+ end=+'+ contains=@vimStringInterpolation extend
+syn region vimString oneline start=+$"+ end=+"+ contains=@vimStringGroup,@vimStringInterpolation extend
syn region vimStringInterpolationExpr oneline contained matchgroup=vimSep start=+{+ end=+}+ contains=@vimExprList
syn match vimStringInterpolationBrace contained "{{"
syn match vimStringInterpolationBrace contained "}}"
+syn cluster vimStringInterpolation contains=vimStringInterpolationExpr,vimStringInterpolationBrace
" 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\%[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
+syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)\>" skipwhite nextgroup=vimSubstPat
+syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)[_#]\@=" skipwhite nextgroup=vimSubstPat
+syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\>" skipwhite nextgroup=vimSubstPat
+syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)[_#]\@=" skipwhite 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
@@ -445,13 +475,17 @@ syn match vimSubstTwoBS contained "\\\\"
syn match vimSubstFlagErr contained "[^< \t\r|]\+" contains=vimSubstFlags
syn match vimSubstFlags contained "[&cegiIlnpr#]\+"
+" Vi compatibility
+syn match vimSubstDelim contained "\\"
+syn match vimSubstPat contained "\\\ze[/?&]" contains=vimSubstDelim nextgroup=vimSubstRep4
+
" 'String': {{{2
syn match vimString "[^(,]'[^']\{-}\zs'"
" Marks, Registers, Addresses, Filters: {{{2
syn match vimMark "'[a-zA-Z0-9]\ze[-+,!]" nextgroup=vimFilter,vimMarkNumber,vimSubst1
-syn match vimMark "'[<>]\ze[-+,!]" nextgroup=vimFilter,vimMarkNumber,vimSubst1
-syn match vimMark ",\zs'[<>]\ze" nextgroup=vimFilter,vimMarkNumber,vimSubst1
+syn match vimMark "'[[\]{}()<>]\ze[-+,!]" nextgroup=vimFilter,vimMarkNumber,vimSubst1
+syn match vimMark ",\zs'[[\]{}()<>]\ze" nextgroup=vimFilter,vimMarkNumber,vimSubst1
syn match vimMark "[!,:]\zs'[a-zA-Z0-9]" nextgroup=vimFilter,vimMarkNumber,vimSubst1
syn match vimMark "\<norm\%[al]\s\zs'[a-zA-Z0-9]" nextgroup=vimFilter,vimMarkNumber,vimSubst1
syn match vimMarkNumber "[-+]\d\+" contained contains=vimOper nextgroup=vimSubst1
@@ -478,28 +512,45 @@ 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,vimSetString,vimSetMod
-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 vimSet "\<\%(setl\%[ocal]\|setg\%[lobal]\|se\%[t]\)\>" skipwhite nextgroup=vimSetBang,vimSetRegion
+syn region vimSetRegion contained start="\S" skip=+\\\\\|\\|\|\n\s*\\\|\n\s*["#]\\ + matchgroup=vimCmdSep end="|" end="$" matchgroup=vimNotation end="<[cC][rR]>" keepend contains=@vimComment,@vimContinue,vimErrSetting,vimOption,vimSetAll,vimSetTermcap
+syn region vimSetEqual contained matchgroup=vimOper start="[=:]\|[-+^]=" skip=+\\\\\|\\|\|\\\s\|\n\s*\\\|\n\s*["#]\\ \|^\s*\\\|^\s*["#]\\ + matchgroup=vimCmdSep end="|" end="\ze\s" end="$" contains=@vimContinue,vimCtrlChar,vimEnvvar,vimNotation,vimSetSep
+syn match vimSetBang contained "\a\@1<=!" skipwhite nextgroup=vimSetAll,vimSetTermcap
+syn keyword vimSetAll contained all nextgroup=vimSetMod
+syn keyword vimSetTermcap contained termcap
+syn region vimSetString contained start=+="+hs=s+1 skip=+\\\\\|\\"+ end=+"+ contains=vimCtrlChar
syn match vimSetSep contained "[,:]"
-syn match vimSetMod contained "&vim\=\|[!&?<]\|all&"
+syn match vimSetMod contained "\a\@1<=\%(&vim\=\|[!&?<]\)"
-" Let: {{{2
-" ===
-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
+" Variable Declarations: {{{2
+" =====================
+VimL syn keyword vimLet let skipwhite nextgroup=vimVar,vimFuncVar,vimLetRegister,vimVarList
+VimL syn keyword vimConst cons[t] skipwhite nextgroup=vimVar,vimVarList
+syn region vimVarList contained start="\[" end="]" contains=vimVar,@vimContinue
-syn keyword vimUnlet unl[et] skipwhite nextgroup=vimUnletBang,vimUnletVars
+VimL 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*$' extend
-syn keyword vimLet var skipwhite nextgroup=vimVar,vimFuncVar,vimLetHereDoc
+VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='\%(^\z(\s*\)\S.*\)\@<==<<\s*trim\%(\s\+\)\@>\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\z1\=\z2$' extend
+VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\%(\s*\)\@>\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\z1$' extend
+VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='\%(^\z(\s*\)\S.*\)\@<==<<\s*\%(trim\s\+eval\|eval\s\+trim\)\%(\s\+\)\@>\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\z1\=\z2$' contains=@vimStringInterpolation extend
+VimFoldh syn region vimLetHereDoc matchgroup=vimLetHereDocStart start='=<<\s*eval\%(\s\+\)\@>\z(\L\S*\)' matchgroup=vimLetHereDocStop end='^\z1$' contains=@vimStringInterpolation extend
+
+Vim9 syn keyword vim9Const const skipwhite nextgroup=vim9Variable,vim9VariableList
+Vim9 syn keyword vim9Final final skipwhite nextgroup=vim9Variable,vim9VariableList
+Vim9 syn keyword vim9Var var skipwhite nextgroup=vim9Variable,vim9VariableList
+
+syn match vim9Variable contained "\<\h\w*\>" skipwhite nextgroup=vimTypeSep,vimLetHereDoc
+syn region vim9VariableList contained start="\[" end="]" contains=vim9Variable,@vimContinue
" For: {{{2
" ===
-syn keyword vimFor for skipwhite nextgroup=vimVar,vimVarList
+if s:vim9script
+ syn keyword vim9For for skipwhite nextgroup=vim9Variable,vim9VariableList
+else
+ syn keyword vimFor for skipwhite nextgroup=vimVar,vimVarList
+endif
" Abbreviations: {{{2
" =============
@@ -543,15 +594,17 @@ syn region vimExecute matchgroup=vimCommand start="\<exe\%[cute]\>" skip=+\\|\|\
" Maps: {{{2
" ====
-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 map, START_STR='syn keyword vimMap', END_STR='skipwhite nextgroup=vimMapMod,vimMapLhs'
+syn keyword vimMap cm[ap] cno[remap] im[ap] ino[remap] lm[ap] ln[oremap] nm[ap] nn[oremap] om[ap] ono[remap] smap snor[emap] tma[p] tno[remap] vm[ap] vn[oremap] xm[ap] xn[oremap] skipwhite nextgroup=vimMapMod,vimMapLhs
+syn match vimMap "\<map\>" skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs
+syn keyword vimMap no[remap] 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 keyword vimMap mapc[lear] skipwhite nextgroup=vimMapBang,vimMapMod
+" GEN_SYN_VIM: vimCommand unmap, START_STR='syn keyword vimUnmap', END_STR='skipwhite nextgroup=vimMapMod,vimMapLhs'
+syn keyword vimUnmap cu[nmap] iu[nmap] lu[nmap] nun[map] ou[nmap] sunm[ap] tunma[p] vu[nmap] xu[nmap] skipwhite nextgroup=vimMapMod,vimMapLhs
+syn keyword vimUnmap unm[ap] skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs
+
syn match vimMapLhs contained "\%(.\|\S\)\+" contains=vimCtrlChar,vimNotation skipwhite nextgroup=vimMapRhs
syn match vimMapLhs contained "\%(.\|\S\)\+\ze\s*$" contains=vimCtrlChar,vimNotation skipwhite skipnl nextgroup=vimMapRhsContinue
syn match vimMapBang contained "\a\@1<=!" skipwhite nextgroup=vimMapMod,vimMapLhs
@@ -618,6 +671,8 @@ syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\
syn match vimUserFunc contained "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\|\<\u[a-zA-Z0-9.]*\>\|\<if\>" contains=vimNotation
syn keyword vimFuncEcho contained ec ech echo
+syn match vimMap "\<map\%(\s\+(\)\@=" skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs
+
" User Command Highlighting: {{{2
syn match vimUsrCmd '^\s*\zs\u\%(\w*\)\@>\%([(#[]\|\s\+\%([-+*/%]\=\|\.\.\)=\)\@!'
@@ -630,13 +685,28 @@ if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_novimfunctionerror")
syn match vimBufnrWarn /\<bufnr\s*(\s*["']\.['"]\s*)/
endif
-syn match vimNotFunc "\<if\>\|\<el\%[seif]\>\|\<retu\%[rn]\>\|\<while\>" skipwhite nextgroup=vimOper,vimOperParen,vimVar,vimFunc,vimNotation
+syn match vimNotFunc "\<if\>\|\<el\%[seif]\>\|\<retu\%[rn]\>\|\<while\>" skipwhite nextgroup=@vimExprList,vimNotation
+
+" Match: {{{2
+" =====
+syn match vimMatch "\<[23]\=mat\%[ch]\>" skipwhite nextgroup=vimMatchGroup,vimMatchNone
+syn match vimMatchGroup contained "[[:alnum:]._-]\+" skipwhite nextgroup=vimMatchPattern
+syn case ignore
+syn keyword vimMatchNone contained none
+syn case match
+syn region vimMatchPattern contained matchgroup=Delimiter start="\z([!#$%&'()*+,-./:;<=>?@[\]^_`{}~]\)" skip="\\\\\|\\\z1" end="\z1" contains=@vimSubstList oneline
" Norm: {{{2
" ====
syn match vimNorm "\<norm\%[al]!\=" skipwhite nextgroup=vimNormCmds
syn match vimNormCmds contained ".*$"
+" Sleep: {{{2
+" =====
+syn keyword vimSleep sl[eep] skipwhite nextgroup=vimSleepBang,vimSleepArg
+syn match vimSleepBang contained "\a\@1<=!" skipwhite nextgroup=vimSleepArg
+syn match vimSleepArg contained "\<\%(\d\+\)\=m\=\>"
+
" Syntax: {{{2
"=======
syn match vimGroupList contained "[^[:space:],]\+\%(\s*,\s*[^[:space:],]\+\)*" contains=vimGroupSpecial
@@ -802,17 +872,20 @@ syn match vimCtrlChar "[- -]"
" Beginners - Patterns that involve ^ {{{2
" =========
-if s:vim9script
- syn match vimLineComment +^[ \t:]*".*$+ contains=@vimCommentGroup,vimCommentString,vimCommentTitle contained
- syn match vim9LineComment +^[ \t:]*#.*$+ contains=@vimCommentGroup,vimCommentString,vim9CommentTitle
-else
- syn match vimLineComment +^[ \t:]*".*$+ contains=@vimCommentGroup,vimCommentString,vimCommentTitle
- syn match vim9LineComment +^[ \t:]*#.*$+ contains=@vimCommentGroup,vimCommentString,vim9CommentTitle contained
-endif
+Vim9 syn region vim9LineComment start=+^[ \t:]*\zs#.*$+ skip=+\n\s*\\\|\n\s*#\\ + end="$" contains=@vimCommentGroup,vimCommentString,vim9CommentTitle extend
+VimL syn region vimLineComment start=+^[ \t:]*\zs".*$+ skip=+\n\s*\\\|\n\s*"\\ + end="$" contains=@vimCommentGroup,vimCommentString,vimCommentTitle extend
+
syn match vimCommentTitle '"\s*\%([sS]:\|\h\w*#\)\=\u\w*\(\s\+\u\w*\)*:'hs=s+1 contained contains=vimCommentTitleLeader,vimTodo,@vimCommentGroup
syn match vim9CommentTitle '#\s*\%([sS]:\|\h\w*#\)\=\u\w*\(\s\+\u\w*\)*:'hs=s+1 contained contains=vim9CommentTitleLeader,vimTodo,@vimCommentGroup
+
+" allowed anywhere in the file
+if !s:vim9script
+ syn match vimShebangError "^\s*\zs#!.*" display
+endif
+syn match vimShebang "\%^#!.*" display
+
syn match vimContinue "^\s*\zs\\"
-syn match vimContinueComment '^\s*\zs["#]\\ .*' contained
+syn match vimContinueComment '^\s*\zs["#]\\ .*'
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
@@ -845,12 +918,12 @@ endif
" Allows users to specify the type of embedded script highlighting
" they want: (perl/python/ruby/tcl support)
" g:vimsyn_embed == 0 : don't embed any scripts
-" g:vimsyn_embed =~# 'l' : embed lua
-" g:vimsyn_embed =~# 'm' : embed mzscheme
-" g:vimsyn_embed =~# 'p' : embed perl
-" g:vimsyn_embed =~# 'P' : embed python
-" g:vimsyn_embed =~# 'r' : embed ruby
-" g:vimsyn_embed =~# 't' : embed tcl
+" g:vimsyn_embed =~# 'l' : embed Lua
+" g:vimsyn_embed =~# 'm' : embed MzScheme
+" g:vimsyn_embed =~# 'p' : embed Perl
+" g:vimsyn_embed =~# 'P' : embed Python
+" g:vimsyn_embed =~# 'r' : embed Ruby
+" g:vimsyn_embed =~# 't' : embed Tcl
if !exists("g:vimsyn_embed")
let g:vimsyn_embed = 'l'
endif
@@ -869,12 +942,16 @@ if g:vimsyn_embed =~# 'l' && filereadable(s:luapath)
unlet! b:current_syntax
syn cluster vimFuncBodyList add=vimLuaRegion
exe "syn include @vimLuaScript ".s:luapath
- VimFoldl syn region vimLuaRegion matchgroup=vimScriptDelim start=+lua\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimLuaScript
- VimFoldl syn region vimLuaRegion matchgroup=vimScriptDelim start=+lua\s*<<\s*$+ end=+\.$+ contains=@vimLuaScript
+ VimFoldl syn region vimLuaRegion matchgroup=vimScriptDelim start=+^\z(\s*\)lua\s*<<\s*trim\s\+\z(\S\+\)+ end=+^\z1\z2$+ contains=@vimLuaScript
+ VimFoldl syn region vimLuaRegion matchgroup=vimScriptDelim start=+lua\s*<<\s*\z(\S*\)+ end=+^\z1$+ contains=@vimLuaScript
+ VimFoldl syn region vimLuaRegion matchgroup=vimScriptDelim start=+^\z(\s*\)lua\s*<<\s*trim\s*$+ end=+^\z1\.$+ contains=@vimLuaScript
+ VimFoldl syn region vimLuaRegion matchgroup=vimScriptDelim start=+lua\s*<<\s*$+ end=+^\.$+ contains=@vimLuaScript
syn cluster vimFuncBodyList add=vimLuaRegion
else
- syn region vimEmbedError start=+lua\s*<<\s*\z(.*\)$+ end=+^\z1$+
- syn region vimEmbedError start=+lua\s*<<\s*$+ end=+\.$+
+ syn region vimEmbedError start=+^\z(\s*\)lua\s*<<\s*trim\s\+\z(\S\+\)+ end=+^\z1\z2$+
+ syn region vimEmbedError start=+lua\s*<<\s*\z(\S*\)+ end=+^\z1$+
+ syn region vimEmbedError start=+^\z(\s*\)lua\s*<<\s*trim\s\*$+ end=+^\z1\.$+
+ syn region vimEmbedError start=+lua\s*<<\s*$+ end=+^\.$+
endif
unlet s:luapath
@@ -894,12 +971,16 @@ if g:vimsyn_embed =~# 'p' && filereadable(s:perlpath)
let s:foldmethod = &l:foldmethod
exe "syn include @vimPerlScript ".s:perlpath
let &l:foldmethod = s:foldmethod
- VimFoldp syn region vimPerlRegion matchgroup=vimScriptDelim start=+pe\%[rl]\s*<<\s*\z(\S*\)\ze\(\s*["#].*\)\=$+ end=+^\z1\ze\(\s*[#"].*\)\=$+ contains=@vimPerlScript
- VimFoldp syn region vimPerlRegion matchgroup=vimScriptDelim start=+pe\%[rl]\s*<<\s*$+ end=+\.$+ contains=@vimPerlScript
+ VimFoldp syn region vimPerlRegion matchgroup=vimScriptDelim start=+^\z(\s*\)pe\%[rl]\s*<<\s*trim\s\+\z(\S\+\)+ end=+^\z1\z2$+ contains=@vimPerlScript
+ VimFoldp syn region vimPerlRegion matchgroup=vimScriptDelim start=+pe\%[rl]\s*<<\s*\z(\S*\)+ end=+^\z1$+ contains=@vimPerlScript
+ VimFoldp syn region vimPerlRegion matchgroup=vimScriptDelim start=+^\z(\s*\)pe\%[rl]\s*<<\s*trim\s*$+ end=+^\z1\.$+ contains=@vimPerlScript
+ VimFoldp syn region vimPerlRegion matchgroup=vimScriptDelim start=+pe\%[rl]\s*<<\s*$+ end=+\.$+ contains=@vimPerlScript
syn cluster vimFuncBodyList add=vimPerlRegion
else
- syn region vimEmbedError start=+pe\%[rl]\s*<<\s*\z(.*\)$+ end=+^\z1$+
- syn region vimEmbedError start=+pe\%[rl]\s*<<\s*$+ end=+\.$+
+ syn region vimEmbedError start=+^\z(\s*\)pe\%[rl]\s*<<\s*trim\s\+\z(\S\+\)+ end=+^\z1\z2$+
+ syn region vimEmbedError start=+pe\%[rl]\s*<<\s*\z(\S*\)+ end=+^\z1$+
+ syn region vimEmbedError start=+^\z(\s*\)pe\%[rl]\s*<<\s*trim\s\*$+ end=+^\z1\.$+
+ syn region vimEmbedError start=+pe\%[rl]\s*<<\s*$+ end=+^\.$+
endif
unlet s:perlpath
@@ -919,12 +1000,16 @@ if g:vimsyn_embed =~# 'r' && filereadable(s:rubypath)
let s:foldmethod = &l:foldmethod
exe "syn include @vimRubyScript ".s:rubypath
let &l:foldmethod = s:foldmethod
- VimFoldr syn region vimRubyRegion matchgroup=vimScriptDelim start=+rub[y]\s*<<\s*\z(\S*\)\ze\(\s*#.*\)\=$+ end=+^\z1\ze\(\s*".*\)\=$+ contains=@vimRubyScript
- syn region vimRubyRegion matchgroup=vimScriptDelim start=+rub[y]\s*<<\s*$+ end=+\.$+ contains=@vimRubyScript
+ VimFoldr syn region vimRubyRegion matchgroup=vimScriptDelim start=+^\z(\s*\)rub\%[y]\s*<<\s*trim\s\+\z(\S\+\)+ end=+^\z1\z2$+ contains=@vimRubyScript
+ VimFoldr syn region vimRubyRegion matchgroup=vimScriptDelim start=+rub\%[y]\s*<<\s*\z(\S*\)+ end=+^\z1$+ contains=@vimRubyScript
+ VimFoldr syn region vimRubyRegion matchgroup=vimScriptDelim start=+^\z(\s*\)rub\%[y]\s*<<\s*trim\s*$+ end=+^\z1\.$+ contains=@vimRubyScript
+ VimFoldr syn region vimRubyRegion matchgroup=vimScriptDelim start=+rub\%[y]\s*<<\s*$+ end=+\.$+ contains=@vimRubyScript
syn cluster vimFuncBodyList add=vimRubyRegion
else
- syn region vimEmbedError start=+rub[y]\s*<<\s*\z(.*\)$+ end=+^\z1$+
- syn region vimEmbedError start=+rub[y]\s*<<\s*$+ end=+\.$+
+ syn region vimEmbedError start=+^\z(\s*\)rub\%[y]\s*<<\s*trim\s\+\z(\S\+\)+ end=+^\z1\z2$+
+ syn region vimEmbedError start=+rub\%[y]\s*<<\s*\z(\S.*\)+ end=+^\z1$+
+ syn region vimEmbedError start=+^\z(\s*\)rub\%[y]\s*<<\s*trim\s\*$+ end=+^\z1\.$+
+ syn region vimEmbedError start=+rub\%[y]\s*<<\s*$+ end=+^\.$+
endif
unlet s:rubypath
@@ -942,14 +1027,18 @@ if g:vimsyn_embed =~# 'P' && filereadable(s:pythonpath)
unlet! b:current_syntax
syn cluster vimFuncBodyList add=vimPythonRegion
exe "syn include @vimPythonScript ".s:pythonpath
- VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon][3x]\=\s*<<\s*\%(trim\s*\)\=\z(\S*\)\ze\(\s*#.*\)\=$+ end=+^\z1\ze\(\s*".*\)\=$+ contains=@vimPythonScript
- VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon][3x]\=\s*<<\s*\%(trim\s*\)\=$+ end=+\.$+ contains=@vimPythonScript
- VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+Py\%[thon]2or3\s*<<\s*\%(trim\s*\)\=\z(\S*\)\ze\(\s*#.*\)\=$+ end=+^\z1\ze\(\s*".*\)\=$+ contains=@vimPythonScript
- VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+Py\%[thon]2or3\=\s*<<\s*\%(trim\s*\)\=$+ end=+\.$+ contains=@vimPythonScript
+ VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+^\z(\s*\)py\%[thon][3x]\=\s*<<\s*trim\s\+\z(\S\+\)+ end=+^\z1\z2$+ contains=@vimPythonScript
+ VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon][3x]\=\s*<<\s*\z(\S\+\)+ end=+^\z1$+ contains=@vimPythonScript
+ VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+^\z(\s*\)py\%[thon][3x]\=\s*<<\s*trim\s*$+ end=+^\z1\.$+ contains=@vimPythonScript
+ VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon][3x]\=\s*<<\s*$+ end=+^\.$+ contains=@vimPythonScript
+ VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+Py\%[thon]2or3\s*<<\s*\%(trim\s*\)\=\z(\S\+\)+ end=+^\z1$+ contains=@vimPythonScript
+ VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+Py\%[thon]2or3\s*<<\s*\%(trim\s*\)\=$+ end=+^\.$+ contains=@vimPythonScript
syn cluster vimFuncBodyList add=vimPythonRegion
else
- syn region vimEmbedError start=+py\%[thon]3\=\s*<<\s*\z(.*\)$+ end=+^\z1$+
- syn region vimEmbedError start=+py\%[thon]3\=\s*<<\s*$+ end=+\.$+
+ syn region vimEmbedError start=+^\z(\s*\)py\%[thon][3x]\=\s*<<\s*trim\s\+\z(\S\+\)+ end=+^\z1\z2$+
+ syn region vimEmbedError start=+py\%[thon][3x]\=\s*<<\s*\z(\S\+\)+ end=+^\z1$+
+ syn region vimEmbedError start=+^\z(\s*\)py\%[thon][3x]\=\s*<<\s*trim\s*$+ end=+^\z1\.$+
+ syn region vimEmbedError start=+py\%[thon][3x]\=\s*<<\s*$+ end=+^\.$+
endif
unlet s:pythonpath
@@ -974,17 +1063,23 @@ if s:trytcl
unlet! b:current_syntax
syn cluster vimFuncBodyList add=vimTclRegion
exe "syn include @vimTclScript ".s:tclpath
- VimFoldt syn region vimTclRegion matchgroup=vimScriptDelim start=+tc[l]\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimTclScript
- VimFoldt syn region vimTclRegion matchgroup=vimScriptDelim start=+tc[l]\=\s*<<\s*$+ end=+\.$+ contains=@vimTclScript
+ VimFoldt syn region vimTclRegion matchgroup=vimScriptDelim start=+^\z(\s*\)tc\%[l]\s*<<\s*trim\s\+\z(\S\+\)+ end=+^\z1\z2$+ contains=@vimTclScript
+ VimFoldt syn region vimTclRegion matchgroup=vimScriptDelim start=+tc\%[l]\=\s*<<\s*\z(\S*\)+ end=+^\z1$+ contains=@vimTclScript
+ VimFoldt syn region vimTclRegion matchgroup=vimScriptDelim start=+^\z(\s*\)tc\%[l]\s*<<\s*trim\s*$+ end=+^\z1\.$+ contains=@vimTclScript
+ VimFoldt syn region vimTclRegion matchgroup=vimScriptDelim start=+tc\%[l]\=\s*<<\s*$+ end=+^\.$+ contains=@vimTclScript
syn cluster vimFuncBodyList add=vimTclScript
else
- syn region vimEmbedError start=+tc[l]\=\s*<<\s*\z(.*\)$+ end=+^\z1$+
- syn region vimEmbedError start=+tc[l]\=\s*<<\s*$+ end=+\.$+
+ syn region vimEmbedError start=+^\z(\s*\)tc\%[l]\s*<<\s*trim\s\+\z(\S\+\)+ end=+^\z1\z2$+
+ syn region vimEmbedError start=+tc\%[l]\=\s*<<\s*\z(\S*\)+ end=+^\z1$+
+ syn region vimEmbedError start=+^\z(\s*\)tc\%[l]\s*<<\s*trim\s\*$+ end=+^\z1\.$+
+ syn region vimEmbedError start=+tc\%[l]\=\s*<<\s*$+ end=+^\.$+
endif
unlet s:tclpath
else
- syn region vimEmbedError start=+tc[l]\=\s*<<\s*\z(.*\)$+ end=+^\z1$+
- syn region vimEmbedError start=+tc[l]\=\s*<<\s*$+ end=+\.$+
+ syn region vimEmbedError start=+^\z(\s*\)tc\%[l]\s*<<\s*trim\s\+\z(\S\+\)+ end=+^\z1\z2$+
+ syn region vimEmbedError start=+tc\%[l]\=\s*<<\s*\z(\S*\)+ end=+^\z1$+
+ syn region vimEmbedError start=+^\z(\s*\)tc\%[l]\s*<<\s*trim\s\*$+ end=+^\z1\.$+
+ syn region vimEmbedError start=+tc\%[l]\=\s*<<\s*$+ end=+^\.$+
endif
unlet s:trytcl
@@ -1005,12 +1100,16 @@ if g:vimsyn_embed =~# 'm' && filereadable(s:mzschemepath)
exe "syn include @vimMzSchemeScript ".s:mzschemepath
let &isk= s:iskKeep
unlet s:iskKeep
- VimFoldm syn region vimMzSchemeRegion matchgroup=vimScriptDelim start=+mz\%[scheme]\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimMzSchemeScript
- VimFoldm syn region vimMzSchemeRegion matchgroup=vimScriptDelim start=+mz\%[scheme]\s*<<\s*$+ end=+\.$+ contains=@vimMzSchemeScript
+ VimFoldm syn region vimMzSchemeRegion matchgroup=vimScriptDelim start=+^\z(\s*\)mz\%[scheme]\s*<<\s*trim\s\+\z(\S\+\)+ end=+^\z1\z2$+ contains=@vimMzSchemeScript
+ VimFoldm syn region vimMzSchemeRegion matchgroup=vimScriptDelim start=+mz\%[scheme]\s*<<\s*\z(\S*\)+ end=+^\z1$+ contains=@vimMzSchemeScript
+ VimFoldm syn region vimMzSchemeRegion matchgroup=vimScriptDelim start=+^\z(\s*\)mz\%[scheme]\s*<<\s*trim\s*$+ end=+^\z1\.$+ contains=@vimMzSchemeScript
+ VimFoldm syn region vimMzSchemeRegion matchgroup=vimScriptDelim start=+mz\%[scheme]\s*<<\s*$+ end=+^\.$+ contains=@vimMzSchemeScript
syn cluster vimFuncBodyList add=vimMzSchemeRegion
else
- syn region vimEmbedError start=+mz\%[scheme]\s*<<\s*\z(.*\)$+ end=+^\z1$+
- syn region vimEmbedError start=+mz\%[scheme]\s*<<\s*$+ end=+\.$+
+ syn region vimEmbedError start=+^\z(\s*\)mz\%[scheme]\s*<<\s*trim\s\+\z(\S\+\)+ end=+^\z1\z2$+
+ syn region vimEmbedError start=+mz\%[scheme]\s*<<\s*\z(\S*\)+ end=+^\z1$+
+ syn region vimEmbedError start=+^\z(\s*\)mz\%[scheme]\s*<<\s*trim\s\*$+ end=+^\z1\.$+
+ syn region vimEmbedError start=+mz\%[scheme]\s*<<\s*$+ end=+^\.$+
endif
unlet s:mzschemepath
@@ -1041,13 +1140,13 @@ if !exists("skip_vim_syntax_inits")
hi def link vimHiCtermError vimError
hi def link vimHiKeyError vimError
hi def link vimMapModErr vimError
+ hi def link vimShebangError 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 vim9Vim9ScriptArg Special
hi def link vimAbb vimCommand
hi def link vimAddress vimMark
hi def link vimAugroupBang vimBang
@@ -1061,21 +1160,24 @@ if !exists("skip_vim_syntax_inits")
hi def link vimBehaveModel vimBehave
hi def link vimBehave vimCommand
hi def link vimBracket Delimiter
+ hi def link vimCall vimCommand
+ hi def link vimCatch vimCommand
hi def link vimCmplxRepeat SpecialChar
hi def link vimCommand Statement
hi def link vimComment Comment
- hi def link vim9Comment Comment
+ hi def link vimCommentError vimError
hi def link vimCommentString vimString
hi def link vimCommentTitle PreProc
- hi def link vim9CommentTitle 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 vimDefComment vimComment
+ hi def link vimDefComment vim9Comment
hi def link vimDefKey vimCommand
hi def link vimDefParam vimVar
+ hi def link vimDelcommand vimCommand
+ hi def link vimDelcommandAttr vimUserCmdAttr
hi def link vimEcho vimCommand
hi def link vimEchohlNone vimGroup
hi def link vimEchohl vimCommand
@@ -1135,13 +1237,15 @@ if !exists("skip_vim_syntax_inits")
hi def link vimLetHereDocStop Special
hi def link vimLetRegister Special
hi def link vimLineComment vimComment
- hi def link vim9LineComment vimComment
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 vimMatch vimCommand
+ hi def link vimMatchGroup vimGroup
+ hi def link vimMatchNone vimGroup
hi def link vimMenuBang vimBang
hi def link vimMenuClear Special
hi def link vimMenuMod vimMapMod
@@ -1174,10 +1278,17 @@ if !exists("skip_vim_syntax_inits")
hi def link vimSearchDelim Statement
hi def link vimSearch vimString
hi def link vimSep Delimiter
+ hi def link vimSet vimCommand
+ hi def link vimSetAll vimOption
+ hi def link vimSetBang vimBang
hi def link vimSetMod vimOption
- hi def link vimSetSep Statement
+ hi def link vimSetSep vimSep
hi def link vimSetString vimString
- hi def link vim9Vim9Script vimCommand
+ hi def link vimSetTermcap vimOption
+ hi def link vimShebang PreProc
+ hi def link vimSleep vimCommand
+ hi def link vimSleepArg Constant
+ hi def link vimSleepBang vimBang
hi def link vimSpecFile Identifier
hi def link vimSpecFileMod vimSpecFile
hi def link vimSpecial Type
@@ -1218,22 +1329,39 @@ if !exists("skip_vim_syntax_inits")
hi def link vimSynReg Type
hi def link vimSyntax vimCommand
hi def link vimSynType vimSpecial
+ hi def link vimThrow vimCommand
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
- hi def link vimUserAttrbKey vimOption
- hi def link vimUserAttrb vimSpecial
- hi def link vimUserAttrbError Error
+ hi def link vimUserCmdAttrAddr vimSpecial
+ hi def link vimUserCmdAttrCmplt vimSpecial
+ hi def link vimUserCmdAttrNargs vimSpecial
+ hi def link vimUserCmdAttrRange vimSpecial
+ hi def link vimUserCmdAttrKey vimUserCmdAttr
+ hi def link vimUserCmdAttr Special
+ hi def link vimUserCmdAttrError Error
hi def link vimUserCmdError Error
- hi def link vimUserCommand vimCommand
+ hi def link vimUserCmdKey vimCommand
hi def link vimUserFunc Normal
hi def link vimVar Identifier
hi def link vimWarn WarningMsg
+ hi def link vim9Boolean Boolean
+ hi def link vim9Comment Comment
+ hi def link vim9CommentError vimError
+ hi def link vim9CommentTitle PreProc
+ hi def link vim9Const vimCommand
+ hi def link vim9Final vimCommand
+ hi def link vim9For vimCommand
+ hi def link vim9LineComment vimComment
+ hi def link vim9Null Constant
+ hi def link vim9Var vimCommand
+ hi def link vim9Variable vimVar
+ hi def link vim9Vim9Script vimCommand
+ hi def link vim9Vim9ScriptArg Special
+
hi def link nvimAutoEvent vimAutoEvent
hi def link nvimHLGroup vimHLGroup
endif
@@ -1243,6 +1371,8 @@ let b:current_syntax = "vim"
" ---------------------------------------------------------------------
" Cleanup: {{{1
+delc Vim9
+delc VimL
delc VimFolda
delc VimFoldf
delc VimFoldh
diff --git a/runtime/syntax/yaml.vim b/runtime/syntax/yaml.vim
index 6ec806a4cb..e992bc02e6 100644
--- a/runtime/syntax/yaml.vim
+++ b/runtime/syntax/yaml.vim
@@ -129,7 +129,7 @@ syn region yamlFlowCollection matchgroup=yamlFlowIndicator start='\[' end='\]' c
execute 'syn match yamlPlainScalar /'.s:ns_plain_out.'/'
execute 'syn match yamlPlainScalar contained /'.s:ns_plain_in.'/'
-execute 'syn match yamlFlowMappingKey /'.s:ns_plain_in.'\%(\s\+'.s:ns_plain_in.'\)*\ze\s*:/ contained '.
+execute 'syn match yamlFlowMappingKey /'.s:ns_plain_in.'\%(\s\+'.s:ns_plain_in.'\)*\ze\s*:\%(\s\|$\)/ contained '.
\'nextgroup=yamlFlowMappingDelimiter skipwhite'
syn match yamlFlowMappingKeyStart /?/ contained nextgroup=@yamlFlowNode skipwhite
syn match yamlFlowMappingMerge /<<\ze\s*:/ contained nextgroup=yamlFlowMappingDelimiter skipwhite
diff --git a/runtime/syntax/zathurarc.vim b/runtime/syntax/zathurarc.vim
index 5e0526d02a..32997c2d2d 100644
--- a/runtime/syntax/zathurarc.vim
+++ b/runtime/syntax/zathurarc.vim
@@ -3,7 +3,7 @@
" Maintainer: Wu, Zhenyu <wuzhenyu@ustc.edu>
" Documentation: https://pwmt.org/projects/zathura/documentation/
" Upstream: https://github.com/Freed-Wu/zathurarc.vim
-" Latest Revision: 2024-04-02
+" Latest Revision: 2024-09-16
if exists('b:current_syntax')
finish
@@ -22,7 +22,7 @@ syntax region zathurarcString start=`'` skip=`\\'` end=`'`
syntax keyword zathurarcMode normal fullscreen presentation index
syntax keyword zathurarcBoolean true false
syntax keyword zathurarcCommand include map set unmap
-syntax keyword zathurarcOption abort-clear-search adjust-open advance-pages-per-row completion-bg completion-fg completion-group-bg completion-group-fg completion-highlight-bg completion-highlight-fg continuous-hist-save database dbus-raise-window dbus-service default-bg default-fg exec-command filemonitor first-page-column font guioptions highlight-active-color highlight-color highlight-fg highlight-transparency incremental-search index-active-bg index-active-fg index-bg index-fg inputbar-bg inputbar-fg link-hadjust link-zoom n-completion-items notification-bg notification-error-bg notification-error-fg notification-fg notification-warning-bg notification-warning-fg page-cache-size page-padding page-right-to-left page-thumbnail-size pages-per-row recolor recolor-darkcolor recolor-keephue recolor-lightcolor recolor-reverse-video render-loading render-loading-bg render-loading-fg sandbox scroll-full-overlap scroll-hstep scroll-page-aware scroll-step scroll-wrap search-hadjust selection-clipboard selection-notification show-directories show-hidden show-recent statusbar-basename statusbar-bg statusbar-fg statusbar-h-padding statusbar-home-tilde statusbar-page-percent statusbar-v-padding synctex synctex-editor-command vertical-center window-height window-icon window-icon-document window-title-basename window-title-home-tilde window-title-page window-width zoom-center zoom-max zoom-min zoom-step
+syntax keyword zathurarcOption abort-clear-search adjust-open advance-pages-per-row completion-bg completion-fg completion-group-bg completion-group-fg completion-highlight-bg completion-highlight-fg continuous-hist-save database dbus-raise-window dbus-service default-bg default-fg double-click-follow exec-command filemonitor first-page-column font guioptions highlight-active-color highlight-color highlight-fg highlight-transparency incremental-search index-active-bg index-active-fg index-bg index-fg inputbar-bg inputbar-fg link-hadjust link-zoom n-completion-items notification-bg notification-error-bg notification-error-fg notification-fg notification-warning-bg notification-warning-fg page-cache-size page-padding page-right-to-left page-thumbnail-size pages-per-row recolor recolor-darkcolor recolor-keephue recolor-lightcolor recolor-reverse-video render-loading render-loading-bg render-loading-fg sandbox scroll-full-overlap scroll-hstep scroll-page-aware scroll-step scroll-wrap search-hadjust selection-clipboard selection-notification show-directories show-hidden show-recent statusbar-basename statusbar-bg statusbar-fg statusbar-h-padding statusbar-home-tilde statusbar-page-percent statusbar-v-padding synctex synctex-editor-command vertical-center window-height window-icon window-icon-document window-title-basename window-title-home-tilde window-title-page window-width zoom-center zoom-max zoom-min zoom-step
highlight default link zathurarcComment Comment
highlight default link zathurarcNumber Number
diff --git a/runtime/tools/emoji_list.lua b/runtime/tools/emoji_list.lua
new file mode 100644
index 0000000000..63bbbe4371
--- /dev/null
+++ b/runtime/tools/emoji_list.lua
@@ -0,0 +1,19 @@
+-- Script to fill the window with emoji characters, one per line.
+-- Source this script: :source %
+
+if vim.bo.modified then
+ vim.cmd.new()
+else
+ vim.cmd.enew()
+end
+
+local lnum = 1
+for c = 0x100, 0x1ffff do
+ local cs = vim.fn.nr2char(c)
+ if vim.fn.charclass(cs) == 3 then
+ vim.fn.setline(lnum, string.format('|%s| %d', cs, vim.fn.strwidth(cs)))
+ lnum = lnum + 1
+ end
+end
+
+vim.bo.modified = false
diff --git a/runtime/tools/emoji_list.vim b/runtime/tools/emoji_list.vim
deleted file mode 100644
index c335b8c88f..0000000000
--- a/runtime/tools/emoji_list.vim
+++ /dev/null
@@ -1,21 +0,0 @@
-" Script to fill the window with emoji characters, one per line.
-" Source this script: :source %
-
-if &modified
- new
-else
- enew
-endif
-
-lua << EOF
- local lnum = 1
- for c = 0x100, 0x1ffff do
- local cs = vim.fn.nr2char(c)
- if vim.fn.charclass(cs) == 3 then
- vim.fn.setline(lnum, '|' .. cs .. '| ' .. vim.fn.strwidth(cs))
- lnum = lnum + 1
- end
- end
-EOF
-
-set nomodified
diff --git a/runtime/tutor/en/vim-01-beginner.tutor b/runtime/tutor/en/vim-01-beginner.tutor
index 622eb7cc06..e6b81d63b9 100644
--- a/runtime/tutor/en/vim-01-beginner.tutor
+++ b/runtime/tutor/en/vim-01-beginner.tutor
@@ -888,7 +888,7 @@ NOTE: If you want to ignore case for just one search command, use [\c](/\c)
Neovim has a comprehensive online help system.
-To get started, try one of these three:
+To get started, try one of these two:
- press the `<F1>`{normal} key (if you have one)
- type `:help`{vim}
diff --git a/runtime/tutor/en/vim-01-beginner.tutor.json b/runtime/tutor/en/vim-01-beginner.tutor.json
index 8f88a3897d..835f0f6782 100644
--- a/runtime/tutor/en/vim-01-beginner.tutor.json
+++ b/runtime/tutor/en/vim-01-beginner.tutor.json
@@ -11,13 +11,13 @@
"232": "Somebody typed the end of this line twice.",
"271": -1,
"290": "This line of words is cleaned up.",
- "307": -1,
- "308": -1,
- "309": -1,
- "310": -1,
- "311": -1,
- "312": -1,
- "313": -1,
+ "307": "1) Roses are red,",
+ "308": "3) Violets are blue,",
+ "309": "6) Sugar is sweet",
+ "310": "7) And so are you.",
+ "311": "7) And so are you.",
+ "312": "7) And so are you.",
+ "313": "7) And so are you.",
"333": "Fix the errors on this line and replace them with undo.",
"379": -1,
"380": -1,
diff --git a/runtime/windows_icon.rc b/runtime/windows_icon.rc
new file mode 100644
index 0000000000..87b79e9ea7
--- /dev/null
+++ b/runtime/windows_icon.rc
@@ -0,0 +1,4 @@
+// NOTE: this resource file *must* be in the same folder as the icon.
+// Otherwise, absolute paths would need to be used.
+// see https://learn.microsoft.com/en-us/windows/win32/menurc/icon-resource
+NEOVIM_ICON ICON "neovim.ico"